diff --git a/.arcconfig b/.arcconfig new file mode 100644 index 00000000000..44cc06fa0dc --- /dev/null +++ b/.arcconfig @@ -0,0 +1,5 @@ +{ + "project.name": "S", + "phabricator.uri" : "https://phabric.freebsd.org/", + "history.immutable" : true +} diff --git a/.arclint b/.arclint new file mode 100644 index 00000000000..e1534587c5a --- /dev/null +++ b/.arclint @@ -0,0 +1,9 @@ +{ + "linters": { + "python": { + "type": "pep8", + "exclude": "(contrib)", + "include": "(\\.py$)" + } + } +} diff --git a/MAINTAINERS b/MAINTAINERS index 7bc9ff2633a..026290cd3bb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -102,13 +102,12 @@ linux emul emulation Please discuss changes here. bs{diff,patch} cperciva Pre-commit review requested. portsnap cperciva Pre-commit review requested. freebsd-update cperciva Pre-commit review requested. -openssl benl Pre-commit review requested. +openssl benl,jkim Pre-commit review requested. sys/netgraph/bluetooth emax Pre-commit review preferred. lib/libbluetooth emax Pre-commit review preferred. lib/libsdp emax Pre-commit review preferred. usr.bin/bluetooth emax Pre-commit review preferred. usr.sbin/bluetooth emax Pre-commit review preferred. -gnu/usr.bin/send-pr bugmaster Pre-commit review requested. *env(3) secteam Due to the problematic security history of this code, please have patches reviewed by secteam. share/zoneinfo edwin Heads-up appreciated, since our data is coming diff --git a/Makefile b/Makefile index b6cad2f953d..0631d4c9b57 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,7 @@ # specified with XDEV and XDEV_ARCH. # xdev-build - Build cross-development tools. # xdev-install - Install cross-development tools. +# xdev-links - Create traditional links in /usr/bin for cc, etc # # "quick" way to test all kernel builds: # _jflag=`sysctl -n hw.ncpu` @@ -82,7 +83,7 @@ # # See src/UPDATING `COMMON ITEMS' for more complete information. # -# If TARGET=machine (e.g. ia64, sparc64, ...) is specified you can +# If TARGET=machine (e.g. powerpc, sparc64, ...) is specified you can # cross build world for other machine types using the buildworld target, # and once the world is built you can cross build a kernel using the # buildkernel target. @@ -110,6 +111,7 @@ TGTS= all all-man buildenv buildenvvars buildkernel buildworld \ _worldtmp _legacy _bootstrap-tools _cleanobj _obj \ _build-tools _cross-tools _includes _libraries _depend \ build32 builddtb distribute32 install32 xdev xdev-build xdev-install \ + xdev-links \ TGTS+= ${SUBDIR_TARGETS} @@ -172,6 +174,13 @@ _TARGET=${TARGET} .if defined(TARGET_ARCH) && !defined(_TARGET_ARCH) _TARGET_ARCH=${TARGET_ARCH} .endif +# for historical compatibility for xdev targets +.if defined(XDEV) +_TARGET= ${XDEV} +.endif +.if defined(XDEV_ARCH) +_TARGET_ARCH= ${XDEV_ARCH} +.endif # Otherwise, default to current machine type and architecture. _TARGET?= ${MACHINE} _TARGET_ARCH?= ${MACHINE_ARCH} @@ -316,13 +325,6 @@ kernel: buildkernel installkernel upgrade_checks: .if ${HAVE_MAKE} != ${WANT_MAKE} @(cd ${.CURDIR} && ${MAKE} ${WANT_MAKE:S,^f,,}) -.elif ${WANT_MAKE} == "fmake" - @if ! (cd ${.CURDIR}/tools/build/make_check && \ - PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \ - PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \ - then \ - (cd ${.CURDIR} && ${MAKE} make); \ - fi .endif # @@ -334,20 +336,21 @@ MMAKEENV= MAKEOBJDIRPREFIX=${MYMAKE:H} \ DESTDIR= \ INSTALL="sh ${.CURDIR}/tools/install.sh" MMAKE= ${MMAKEENV} ${MAKE} \ - -D_UPGRADING -DNO_MAN -DNO_SHARED \ + -DNO_MAN -DNO_SHARED \ -DNO_CPU_CFLAGS -DNO_WERROR \ - DESTDIR= MK_TESTS=no PROGNAME=${MYMAKE:T} + MK_TESTS=no \ + DESTDIR= PROGNAME=${MYMAKE:T} -make bmake: .PHONY +bmake: .PHONY @echo @echo "--------------------------------------------------------------" - @echo ">>> Building an up-to-date make(1)" + @echo ">>> Building an up-to-date ${.TARGET}(1)" @echo "--------------------------------------------------------------" ${_+_}@cd ${.CURDIR}/usr.bin/${.TARGET}; \ ${MMAKE} obj && \ ${MMAKE} depend && \ ${MMAKE} all && \ - ${MMAKE} install DESTDIR=${MYMAKE:H} BINDIR= NO_MAN=t + ${MMAKE} install DESTDIR=${MYMAKE:H} BINDIR= tinderbox toolchains kernel-toolchains: upgrade_checks @@ -368,7 +371,7 @@ kernel-toolchains: # existing system is. # .if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets) -TARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64 +TARGETS?=amd64 arm i386 mips pc98 powerpc sparc64 TARGET_ARCHES_arm?= arm armeb armv6 armv6hf TARGET_ARCHES_mips?= mipsel mips mips64el mips64 mipsn32 TARGET_ARCHES_powerpc?= powerpc powerpc64 @@ -457,7 +460,7 @@ TARGET!= uname -m .if defined(MAKE_ALL_KERNELS) _THINNER=cat .else -_THINNER=xargs grep -L "^.NO_UNIVERSE" +_THINNER=xargs grep -L "^.NO_UNIVERSE" || true .endif KERNCONFS!= cd ${KERNSRCDIR}/${TARGET}/conf && \ find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \ diff --git a/Makefile.inc1 b/Makefile.inc1 index 549aa2fff00..62ed26a2e84 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -17,6 +17,7 @@ # -DNO_DOCUPDATE do not update doc in ${MAKE} update # -DWITHOUT_CTF do not run the DTrace CTF conversion tools on built objects # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list +# LOCAL_ITOOLS="list of tools" to add additional tools to the ITOOLS list # LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target # LOCAL_MTREE="list of mtree files" to process to allow local directories # to be created before files are installed @@ -139,7 +140,7 @@ SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ VERSION= FreeBSD ${REVISION}-${BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE} .endif -KNOWN_ARCHES?= amd64 arm armeb/arm armv6/arm armv6hf/arm i386 i386/pc98 ia64 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64 +KNOWN_ARCHES?= amd64 arm armeb/arm armv6/arm armv6hf/arm i386 i386/pc98 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64 .if ${TARGET} == ${TARGET_ARCH} _t= ${TARGET} .else @@ -245,10 +246,11 @@ BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ DESTDIR= \ BOOTSTRAPPING=${OSRELDATE} \ - SSP_CFLAGS= \ + SSP_CFLAGS= MK_PIE=no \ MK_HTML=no MK_INFO=no NO_LINT=yes MK_MAN=no \ -DNO_PIC MK_PROFILE=no -DNO_SHARED \ - -DNO_CPU_CFLAGS -DNO_WARNS MK_CTF=no -DEARLY_BUILD MK_TESTS=no + -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ + MK_CLANG_FULL=no MK_LLDB=no MK_TESTS=no # build-tools stage TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ @@ -256,9 +258,9 @@ TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ DESTDIR= \ BOOTSTRAPPING=${OSRELDATE} \ - SSP_CFLAGS= \ + SSP_CFLAGS= MK_PIE=no \ -DNO_LINT \ - -DNO_CPU_CFLAGS -DNO_WARNS MK_CTF=no -DEARLY_BUILD MK_TESTS=no + -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no MK_CLANG_FULL=no MK_LLDB=no MK_TESTS=no # cross-tools stage XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ @@ -274,10 +276,10 @@ KTMAKE= TOOLS_PREFIX=${WORLDTMP} MAKEOBJDIRPREFIX=${WORLDTMP} \ ${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ DESTDIR= \ BOOTSTRAPPING=${OSRELDATE} \ - SSP_CFLAGS= \ + SSP_CFLAGS= MK_PIE=no \ MK_HTML=no MK_INFO=no -DNO_LINT MK_MAN=no \ -DNO_PIC MK_PROFILE=no -DNO_SHARED \ - -DNO_CPU_CFLAGS -DNO_WARNS MK_CTF=no -DEARLY_BUILD + -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no # world stage WMAKEENV= ${CROSSENV} \ @@ -609,8 +611,8 @@ build32: WORLDTMP=${WORLDTMP} \ MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \ MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \ - DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS MK_CTF=no \ - -DEARLY_BUILD build-tools + DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ + build-tools .endfor cd ${.CURDIR}; \ ${LIB32WMAKE} -f Makefile.inc1 libraries @@ -755,7 +757,8 @@ _zoneinfo= zic tzsetup ITOOLS= [ awk cap_mkdb cat chflags chmod chown \ date echo egrep find grep id install ${_install-info} \ ln lockf make mkdir mtree mv pwd_mkdb \ - rm sed services_mkdb sh sysctl test true uname wc ${_zoneinfo} + rm sed services_mkdb sh sysctl test true uname wc ${_zoneinfo} \ + ${LOCAL_ITOOLS} # # distributeworld @@ -775,6 +778,14 @@ EXTRA_DISTRIBUTIONS+= games .if defined(LIB32TMP) && ${MK_LIB32} != "no" EXTRA_DISTRIBUTIONS+= lib32 .endif +.if ${MK_TESTS} != "no" +EXTRA_DISTRIBUTIONS+= tests +.endif + +DEBUG_DISTRIBUTIONS= +.if ${MK_DEBUG_FILES} != "no" +DEBUG_DISTRIBUTIONS+= base ${EXTRA_DISTRIBUTIONS:S,doc,,} +.endif MTREE_MAGIC?= mtree 2.0 @@ -816,6 +827,10 @@ distributeworld installworld: _installcheck_world mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null .endif +.if ${MK_TESTS} != "no" && ${dist} == "tests" + mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ + -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null +.endif .if defined(NO_ROOT) ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \ sed -e 's#^\./#./${dist}/#' >> ${METALOG} @@ -848,8 +863,7 @@ distributeworld installworld: _installcheck_world awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \ ${DESTDIR}/${DISTDIR}/${dist}.meta .endfor -.if ${MK_DEBUG_FILES} != "no" -. for dist in base ${EXTRA_DISTRIBUTIONS} +.for dist in ${DEBUG_DISTRIBUTIONS} @# For each file that exists in this dist, print the corresponding @# line from the METALOG. This relies on the fact that @# a line containing only the filename will sort immediatly before @@ -858,8 +872,7 @@ distributeworld installworld: _installcheck_world find ./${dist}/usr/lib/debug | sort -u ${METALOG} - | \ awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \ ${DESTDIR}/${DISTDIR}/${dist}.debug.meta -. endfor -.endif +.endfor .endif .endif @@ -877,19 +890,17 @@ packageworld: .endif .endfor -.if ${MK_DEBUG_FILES} != "no" -. for dist in base ${EXTRA_DISTRIBUTIONS} -. if defined(NO_ROOT) +.for dist in ${DEBUG_DISTRIBUTIONS} +. if defined(NO_ROOT) ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ - tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.debug.txz \ + tar cvJf ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz \ @${DESTDIR}/${DISTDIR}/${dist}.debug.meta -. else +. else ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ - tar cvJfL ${DESTDIR}/${DISTDIR}/${dist}.debug.txz \ + tar cvJfL ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz \ usr/lib/debug -. endif -. endfor -.endif +. endif +.endfor # # reinstall @@ -1188,6 +1199,10 @@ _gperf= gnu/usr.bin/gperf _groff= gnu/usr.bin/groff .endif +.if ${MK_VT} != "no" +_vtfontcvt= usr.bin/vtfontcvt +.endif + .if ${BOOTSTRAPPING} < 900002 _sed= usr.bin/sed .endif @@ -1237,9 +1252,8 @@ _clang_tblgen= \ .endif # dtrace tools are required for older bootstrap env and cross-build -.if ${MK_CDDL} != "no" && \ - ((${BOOTSTRAPPING} < 1000034 && \ - !(${BOOTSTRAPPING} >= 901505 && ${BOOTSTRAPPING} < 999999)) \ +# pre libdwarf +.if ${MK_CDDL} != "no" && (${BOOTSTRAPPING} < 1100006 \ || (${MACHINE} != ${TARGET} || ${MACHINE_ARCH} != ${TARGET_ARCH})) _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \ lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge @@ -1288,7 +1302,8 @@ bootstrap-tools: .MAKE ${_gensnmptree} \ usr.sbin/config \ ${_crunch} \ - ${_nmtree} + ${_nmtree} \ + ${_vtfontcvt} ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ cd ${.CURDIR}/${_tool} && \ ${MAKE} DIRPRFX=${_tool}/ obj && \ @@ -1351,9 +1366,6 @@ kernel-tools: .MAKE # # cross-tools: Build cross-building tools # -.if !defined(TARGET_ARCH) && defined(XDEV_ARCH) -TARGET_ARCH= ${XDEV_ARCH} -.endif .if ${TARGET_ARCH} != ${MACHINE_ARCH} .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" _btxld= usr.sbin/btxld @@ -1474,13 +1486,15 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ lib/libopie lib/libpam ${_lib_libthr} \ lib/libradius lib/libsbuf lib/libtacplus \ ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \ + ${_cddl_lib_libavl} \ ${_cddl_lib_libzfs_core} \ lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \ ${_secure_lib_libcrypto} ${_lib_libldns} \ ${_secure_lib_libssh} ${_secure_lib_libssl} -.if ${MK_GNUCXX} != "no" && ${MK_CXX} != "no" +.if ${MK_GNUCXX} != "no" _prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++ gnu/lib/libstdc++__L: lib/msun__L +gnu/lib/libsupc++__L: gnu/lib/libstdc++__L .endif .if defined(WITH_ATF) || ${MK_TESTS} != "no" @@ -1519,6 +1533,7 @@ lib/libopie__L lib/libtacplus__L: lib/libmd__L .if ${MK_CDDL} != "no" _cddl_lib_libumem= cddl/lib/libumem _cddl_lib_libnvpair= cddl/lib/libnvpair +_cddl_lib_libavl= cddl/lib/libavl _cddl_lib_libzfs_core= cddl/lib/libzfs_core _cddl_lib= cddl/lib cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L @@ -1836,9 +1851,9 @@ builddtb: ############### -.if defined(XDEV) && defined(XDEV_ARCH) +.if defined(TARGET) && defined(TARGET_ARCH) -.if ${XDEV} == ${MACHINE} && ${XDEV_ARCH} == ${MACHINE_ARCH} +.if ${TARGET} == ${MACHINE} && ${TARGET_ARCH} == ${MACHINE_ARCH} XDEV_CPUTYPE?=${CPUTYPE} .else XDEV_CPUTYPE?=${TARGET_CPUTYPE} @@ -1846,11 +1861,11 @@ XDEV_CPUTYPE?=${TARGET_CPUTYPE} NOFUN=-DNO_FSCHG MK_HTML=no MK_INFO=no -DNO_LINT \ MK_MAN=no MK_NLS=no MK_PROFILE=no \ - MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no -DNO_WARNS \ - TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \ + MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WARNS=no \ + TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ CPUTYPE=${XDEV_CPUTYPE} -XDDIR=${XDEV_ARCH}-freebsd +XDDIR=${TARGET_ARCH}-freebsd XDTP?=/usr/${XDDIR} .if ${XDTP:N/*} .error XDTP variable should be an absolute path @@ -1866,7 +1881,7 @@ CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \ -B${XDDESTDIR}/usr/bin -B${XDDESTDIR}/usr/lib CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" CXX="${CXX} ${CD2CFLAGS}" \ CPP="${CPP} ${CD2CFLAGS}" \ - MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH} + MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN} @@ -1876,7 +1891,7 @@ XDDESTDIR=${DESTDIR}/${XDTP} OSREL!= uname -r | sed -e 's/[-(].*//' .endif -.ORDER: xdev-build xdev-install +.ORDER: xdev-build xdev-install xdev-links xdev: xdev-build xdev-install .ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools @@ -1925,9 +1940,13 @@ _xi-mtree: -p ${XDDESTDIR}/usr >/dev/null mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ -p ${XDDESTDIR}/usr/include >/dev/null +.if ${MK_TESTS} != "no" + mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ + -p ${XDDESTDIR}/usr >/dev/null +.endif -.ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links -xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links +.ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries +xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-cross-tools: @echo "_xi-cross-tools" @@ -1950,9 +1969,9 @@ _xi-libraries: ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \ DESTDIR=${XDDESTDIR} -_xi-links: +xdev-links: ${_+_}cd ${XDDESTDIR}/usr/bin; \ - mkdir -p ../../../../usr/bin; \ + mkdir -p ../../../../usr/bin; \ for i in *; do \ ln -sf ../../${XDTP}/usr/bin/$$i \ ../../../../usr/bin/${XDDIR}-$$i; \ @@ -1960,6 +1979,6 @@ _xi-links: ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \ done .else -xdev xdev-build xdev-install: - @echo "*** Error: Both XDEV and XDEV_ARCH must be defined for \"${.TARGET}\" target" +xdev xdev-build xdev-install xdev-links: + @echo "*** Error: Both TARGET and TARGET_ARCH must be defined for \"${.TARGET}\" target" .endif diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 2f6f9f3e2be..d093d6e93e9 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -38,6 +38,92 @@ # xargs -n1 | sort | uniq -d; # done +# 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/rlconf.h +OLD_FILES+=usr/include/readline/rlstdc.h +OLD_FILES+=usr/include/readline/rltypedefs.h +OLD_FILES+=usr/include/readline/rltypedefs.h +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 @@ -507,6 +593,7 @@ OLD_FILES+=usr/share/man/man9/vfs_mount.9.gz 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 @@ -1127,9 +1214,6 @@ OLD_FILES+=usr/include/xmmintrin.h .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" || ${TARGET_ARCH} == "arm" OLD_FILES+=usr/include/mmintrin.h .endif -.if ${TARGET_ARCH} == "ia64" -OLD_FILES+=usr/include/ia64intrin.h -.endif .if ${TARGET_ARCH} == "powerpc" OLD_FILES+=usr/include/altivec.h OLD_FILES+=usr/include/ppc-asm.h @@ -1147,10 +1231,6 @@ OLD_FILES+=usr/include/machine/rm7000.h OLD_FILES+=usr/include/machine/defs.h OLD_FILES+=usr/include/machine/queue.h .endif -# 20100326: [ia64] removed -.if ${TARGET_ARCH} == "ia64" -OLD_FILES+=usr/include/machine/nexusvar.h -.endif # 20100326: gcpio removal OLD_FILES+=usr/bin/gcpio OLD_FILES+=usr/share/info/cpio.info.gz @@ -1164,11 +1244,6 @@ 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 -# 20100227: [ia64] removed and -.if ${TARGET_ARCH} == "ia64" -OLD_FILES+=usr/include/machine/sapicreg.h -OLD_FILES+=usr/include/machine/sapicvar.h -.endif # 20100208: man pages moved .if ${TARGET_ARCH} == "i386" OLD_FILES+=usr/share/man/man4/i386/alpm.4.gz @@ -1861,14 +1936,6 @@ OLD_FILES+=usr/share/man/man8/arlcontrol.8.gz OLD_FILES+=sbin/sunlabel OLD_FILES+=usr/share/man/man8/sunlabel.8.gz .endif -# 20080703: bsdlabel & fdisk removed on ia64 -.if ${TARGET_ARCH} == "ia64" -OLD_FILES+=sbin/bsdlabel -OLD_FILES+=usr/share/man/man8/bsdlabel.8.gz -OLD_FILES+=usr/share/man/man8/disklabel.8.gz -OLD_FILES+=sbin/fdisk -OLD_FILES+=usr/share/man/man8/fdisk.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 @@ -2077,12 +2144,6 @@ OLD_FILES+=usr/include/sys/_elf_solaris.h 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 -# 20071104: Removed bsdlabel, fdisk and gpt from rescue on ia64. -.if ${TARGET_ARCH} == "ia64" -OLD_FILES+=rescue/bsdlabel -OLD_FILES+=rescue/fdisk -OLD_FILES+=rescue/gpt -.endif # 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 @@ -2743,10 +2804,6 @@ OLD_FILES+=usr/share/man/man8/mount_std.8.gz 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 -.if ${TARGET_ARCH} == "ia64" -# 20061104: skiload.help removed -OLD_FILES+=boot/skiload.help -.endif # 20061018: pccardc removed OLD_FILES+=usr/sbin/pccardc usr/share/man/man8/pccardc.8.gz # 20060930: demangle.h from contrib/libstdc++/include/ext/ @@ -2817,7 +2874,6 @@ 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/vt.4.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 diff --git a/UPDATING b/UPDATING index c0585c84b5e..debbcd19a48 100644 --- a/UPDATING +++ b/UPDATING @@ -1,4 +1,4 @@ -Updating Information for FreeBSD current users +Updating Information for FreeBSD current users. This file is maintained and copyrighted by M. Warner Losh . See end of file for further details. For commonly done items, please see the @@ -31,6 +31,76 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20140723: + The xdev targets have been converted to using TARGET and + TARGET_ARCH instead of XDEV and XDEV_ARCH. + +20140719: + The default unbound configuration has been modified to address + issues with reverse lookups on networks that use private + address ranges. If you use the local_unbound service, run + "service local_unbound setup" as root to regenerate your + configuration, then "service local_unbound reload" to load the + new configuration. + +20140709: + The GNU texinfo and GNU info pages are not built and installed + anymore, WITH_INFO knob has been added to allow to built and install + them again. + +20140708: + The GNU readline library is now an INTERNALLIB - that is, it is + statically linked into consumers (GDB and variants) in the base + system, and the shared library is no longer installed. The + devel/readline port is available for third party software that + requires readline. + +20140702: + The Itanium architecture (ia64) has been removed from the list of + known architectures. This is the first step in the removal of the + architecture. + +20140701: + Commit r268115 has added NFSv4.1 server support, merged from + projects/nfsv4.1-server. Since this includes changes to the + internal interfaces between the NFS related modules, a full + build of the kernel and modules will be necessary. + __FreeBSD_version has been bumped. + +20140629: + The WITHOUT_VT_SUPPORT kernel config knob has been renamed + WITHOUT_VT. (The other _SUPPORT knobs have a consistent meaning + which differs from the behaviour controlled by this knob.) + +20140619: + Maximal length of the serial number in CTL was increased from 16 to + 64 chars, that breaks ABI. All CTL-related tools, such as ctladm + and ctld, need to be rebuilt to work with a new kernel. + +20140606: + The libatf-c and libatf-c++ major versions were downgraded to 0 and + 1 respectively to match the upstream numbers. They were out of + sync because, when they were originally added to FreeBSD, the + upstream versions were not respected. These libraries are private + and not yet built by default, so renumbering them should be a + non-issue. However, unclean source trees will yield broken test + programs once the operator executes "make delete-old-libs" after a + "make installworld". + + Additionally, the atf-sh binary was made private by moving it into + /usr/libexec/. Already-built shell test programs will keep the + path to the old binary so they will break after "make delete-old" + is run. + + If you are using WITH_TESTS=yes (not the default), wipe the object + tree and rebuild from scratch to prevent spurious test failures. + This is only needed once: the misnumbered libraries and misplaced + binaries have been added to OptionalObsoleteFiles.inc so they will + be removed during a clean upgrade. + +20140512: + Clang and llvm have been upgraded to 3.4.1 release. + 20140508: We bogusly installed src.opts.mk in /usr/share/mk. This file should be removed to avoid issues in the future (and has been added to @@ -47,7 +117,8 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW: Although this has survived make universe and some upgrade scenarios, other upgrade scenarios may have broken. At least one form of temporary breakage was fixed with MAKESYSPATH settings for buildworld - as well... + as well... In cases where MAKESYSPATH isn't working with this + setting, you'll need to set it to the full path to your tree. One side effect of all this cleaning up is that bsd.compiler.mk is no longer implicitly included by bsd.own.mk. If you wish to diff --git a/bin/chio/chio.1 b/bin/chio/chio.1 index 920c31e8164..a61242b2294 100644 --- a/bin/chio/chio.1 +++ b/bin/chio/chio.1 @@ -151,7 +151,6 @@ This command will query the status of the specified media unit, and will move it to the element specified in its source attribute. This is a convenient way to return media from a drive or portal to its previous element in the changer. -.Pp .It Ic position Xo .Ar .Op Cm inv @@ -173,7 +172,6 @@ Report which picker unit the changer is currently configured to use. .Xc Configure the changer to use picker .Ar . -.Pp .It Ic ielem Xo .Op Ar .Xc @@ -292,13 +290,11 @@ Configure the changer to use picker 2 (third picker) for operations. The .Nm program and SCSI changer driver were written by -.An Jason R. Thorpe Aq thorpej@and.com +.An Jason R. Thorpe Aq Mt thorpej@and.com for And Communications, .Pa http://www.and.com/ . .Pp Additional work by -.An Hans Huebner -.Aq hans@artcom.de +.An Hans Huebner Aq Mt hans@artcom.de and -.An Steve Gunn -.Aq csg@waterspout.com . +.An Steve Gunn Aq Mt csg@waterspout.com . diff --git a/bin/csh/Makefile b/bin/csh/Makefile index c8845f9523c..9f305b4f5f0 100644 --- a/bin/csh/Makefile +++ b/bin/csh/Makefile @@ -40,8 +40,8 @@ MLINKS= csh.1 tcsh.1 # utilities of the same name are handled with the associated manpage, # builtin.1 in share/man/man1/. -DPADD= ${LIBTERMCAP} ${LIBCRYPT} -LDADD= -ltermcap -lcrypt +DPADD= ${LIBTERMCAPW} ${LIBCRYPT} +LDADD= -ltermcapw -lcrypt LINKS= ${BINDIR}/csh ${BINDIR}/tcsh diff --git a/bin/csh/Makefile.depend b/bin/csh/Makefile.depend index 7d24a2b5c71..d86382c7ecd 100644 --- a/bin/csh/Makefile.depend +++ b/bin/csh/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ @@ -12,7 +13,7 @@ DIRDEPS = \ lib/libc \ lib/libcompiler_rt \ lib/libcrypt \ - lib/ncurses/ncurses \ + lib/ncurses/ncursesw \ .include diff --git a/bin/ed/Makefile b/bin/ed/Makefile index fb1c37da3d0..cc47a4271e9 100644 --- a/bin/ed/Makefile +++ b/bin/ed/Makefile @@ -7,9 +7,7 @@ SRCS= buf.c cbc.c glbl.c io.c main.c re.c sub.c undo.c LINKS= ${BINDIR}/ed ${BINDIR}/red MLINKS= ed.1 red.1 -.if !defined(RELEASE_CRUNCH) && \ - ${MK_OPENSSL} != "no" && \ - ${MK_ED_CRYPTO} != "no" +.if ${MK_OPENSSL} != "no" && ${MK_ED_CRYPTO} != "no" CFLAGS+=-DDES DPADD= ${LIBCRYPTO} LDADD= -lcrypto diff --git a/bin/freebsd-version/freebsd-version.1 b/bin/freebsd-version/freebsd-version.1 index 1eea5bbd972..7e471bf5955 100644 --- a/bin/freebsd-version/freebsd-version.1 +++ b/bin/freebsd-version/freebsd-version.1 @@ -121,4 +121,4 @@ command appeared in The .Nm utility and this manual page were written by -.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . +.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org . diff --git a/bin/ls/Makefile b/bin/ls/Makefile index 7149d9146b0..dce204655be 100644 --- a/bin/ls/Makefile +++ b/bin/ls/Makefile @@ -11,8 +11,8 @@ LDADD= -lutil .if !defined(RELEASE_CRUNCH) && \ ${MK_LS_COLORS} != no CFLAGS+= -DCOLORLS -DPADD+= ${LIBTERMCAP} -LDADD+= -ltermcap +DPADD+= ${LIBTERMCAPW} +LDADD+= -ltermcapw .endif .include diff --git a/bin/ls/Makefile.depend b/bin/ls/Makefile.depend index fa30ba59a75..549c3a26609 100644 --- a/bin/ls/Makefile.depend +++ b/bin/ls/Makefile.depend @@ -11,7 +11,6 @@ DIRDEPS = \ lib/libc \ lib/libcompiler_rt \ lib/libutil \ - lib/ncurses/ncurses \ lib/ncurses/ncursesw \ diff --git a/bin/mv/mv.c b/bin/mv/mv.c index 2710f890774..3e832acbfdf 100644 --- a/bin/mv/mv.c +++ b/bin/mv/mv.c @@ -278,6 +278,7 @@ fastcopy(const char *from, const char *to, struct stat *sbp) static char *bp = NULL; mode_t oldmode; int nread, from_fd, to_fd; + struct stat tsb; if ((from_fd = open(from, O_RDONLY, 0)) < 0) { warn("fastcopy: open() failed (from): %s", from); @@ -336,10 +337,18 @@ err: if (unlink(to)) * if the server supports flags and we were trying to *remove* flags * on a file that we copied, i.e., that we didn't create.) */ - errno = 0; - if (fchflags(to_fd, sbp->st_flags)) - if (errno != EOPNOTSUPP || sbp->st_flags != 0) - warn("%s: set flags (was: 0%07o)", to, sbp->st_flags); + if (fstat(to_fd, &tsb) == 0) { + if ((sbp->st_flags & ~UF_ARCHIVE) != + (tsb.st_flags & ~UF_ARCHIVE)) { + if (fchflags(to_fd, + sbp->st_flags | (tsb.st_flags & UF_ARCHIVE))) + if (errno != EOPNOTSUPP || + ((sbp->st_flags & ~UF_ARCHIVE) != 0)) + warn("%s: set flags (was: 0%07o)", + to, sbp->st_flags); + } + } else + warn("%s: cannot stat", to); tval[0].tv_sec = sbp->st_atime; tval[1].tv_sec = sbp->st_mtime; diff --git a/bin/pkill/pkill.1 b/bin/pkill/pkill.1 index 1ca383fa395..3f219b69a0f 100644 --- a/bin/pkill/pkill.1 +++ b/bin/pkill/pkill.1 @@ -291,5 +291,4 @@ Solaris 7. They made their first appearance in .Fx 5.3 . .Sh AUTHORS -.An Andrew Doran -.Aq ad@NetBSD.org +.An Andrew Doran Aq Mt ad@NetBSD.org diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c index 21e67912838..3a0c323b77d 100644 --- a/bin/ps/keyword.c +++ b/bin/ps/keyword.c @@ -87,8 +87,10 @@ static VAR var[] = { {"etimes", "ELAPSED", NULL, USER, elapseds, 0, CHAR, NULL, 0}, {"euid", "", "uid", 0, NULL, 0, CHAR, NULL, 0}, {"f", "F", NULL, 0, kvar, KOFF(ki_flag), INT, "x", 0}, + {"f2", "F2", NULL, 0, kvar, KOFF(ki_flag2), INT, "08x", 0}, {"fib", "FIB", NULL, 0, kvar, KOFF(ki_fibnum), INT, "d", 0}, {"flags", "", "f", 0, NULL, 0, CHAR, NULL, 0}, + {"flags2", "", "f2", 0, NULL, 0, CHAR, NULL, 0}, {"gid", "GID", NULL, 0, kvar, KOFF(ki_groups), UINT, UIDFMT, 0}, {"group", "GROUP", NULL, LJUST, egroupname, 0, CHAR, NULL, 0}, {"ignored", "", "sigignore", 0, NULL, 0, CHAR, NULL, 0}, diff --git a/bin/ps/ps.1 b/bin/ps/ps.1 index c4239ea5bcc..3d7edf7ea8e 100644 --- a/bin/ps/ps.1 +++ b/bin/ps/ps.1 @@ -29,7 +29,7 @@ .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd May 2, 2014 +.Dd June 6, 2014 .Dt PS 1 .Os .Sh NAME @@ -340,6 +340,15 @@ the include file .It Dv "P_SWAPPINGIN" Ta No "0x40000000" Ta "Process is being swapped in" .It Dv "P_PPTRACE" Ta No "0x80000000" Ta "Vforked child issued ptrace(PT_TRACEME)" .El +.It Cm flags2 +The flags kept in +.Va p_flag2 +associated with the process as in +the include file +.In sys/proc.h : +.Bl -column P2_INHERIT_PROTECTED 0x00000001 +.It Dv "P2_INHERIT_PROTECTED" Ta No "0x00000001" Ta "New children get P_PROTECTED" +.El .It Cm label The MAC label of the process. .It Cm lim @@ -534,6 +543,9 @@ default FIB number, see .It Cm flags the process flags, in hexadecimal (alias .Cm f ) +.It Cm flags2 +the additional set of process flags, in hexadecimal (alias +.Cm f2 ) .It Cm gid effective group ID (alias .Cm egid ) diff --git a/bin/rm/rm.1 b/bin/rm/rm.1 index 824b627dec4..840b560a7d4 100644 --- a/bin/rm/rm.1 +++ b/bin/rm/rm.1 @@ -121,7 +121,6 @@ each directory's contents are processed (as well as before the attempt is made to remove the directory). If the user does not respond affirmatively, the file hierarchy rooted in that directory is skipped. -.Pp .It Fl r Equivalent to .Fl R . diff --git a/bin/rm/rm.c b/bin/rm/rm.c index 976b4eeb57c..46807b9e4e5 100644 --- a/bin/rm/rm.c +++ b/bin/rm/rm.c @@ -335,7 +335,7 @@ rm_tree(char **argv) warn("%s", p->fts_path); eval = 1; } - if (errno) + if (!fflag && errno) err(1, "fts_read"); fts_close(fts); } diff --git a/bin/rmail/Makefile b/bin/rmail/Makefile index ad788a4745a..c07c9e19aa3 100644 --- a/bin/rmail/Makefile +++ b/bin/rmail/Makefile @@ -14,6 +14,8 @@ MAN= rmail.8 WARNS?= 2 CFLAGS+=-I${SENDMAIL_DIR}/include -I. +NO_PIE= yes + LIBSMDIR= ${.OBJDIR}/../../lib/libsm LIBSM= ${LIBSMDIR}/libsm.a diff --git a/bin/setfacl/setfacl.1 b/bin/setfacl/setfacl.1 index 410431560d5..7894233c0f5 100644 --- a/bin/setfacl/setfacl.1 +++ b/bin/setfacl/setfacl.1 @@ -485,6 +485,6 @@ NFSv4 ACL support was introduced in The .Nm utility was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . +.An Chris D. Faulhaber Aq Mt jedgar@fxp.org . NFSv4 ACL support was implemented by -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org . +.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org . diff --git a/bin/sh/Makefile b/bin/sh/Makefile index 6a982bc2b8b..ad43d33e6c3 100644 --- a/bin/sh/Makefile +++ b/bin/sh/Makefile @@ -18,8 +18,8 @@ SRCS= ${SHSRCS} ${GENSRCS} ${GENHDRS} # utilities of the same name are handled with the associated manpage, # builtin.1 in share/man/man1/. -DPADD= ${LIBEDIT} ${LIBTERMCAP} -LDADD= -ledit -ltermcap +DPADD= ${LIBEDIT} ${LIBTERMCAPW} +LDADD= -ledit -ltermcapw CFLAGS+=-DSHELL -I. -I${.CURDIR} # for debug: diff --git a/bin/sh/Makefile.depend b/bin/sh/Makefile.depend index cd6f78e660f..b2615f6310e 100644 --- a/bin/sh/Makefile.depend +++ b/bin/sh/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ @@ -11,7 +12,7 @@ DIRDEPS = \ lib/libc \ lib/libcompiler_rt \ lib/libedit \ - lib/ncurses/ncurses \ + lib/ncurses/ncursesw \ .include diff --git a/bin/sh/arith_yacc.c b/bin/sh/arith_yacc.c index fbf9a640c03..815d885eb6b 100644 --- a/bin/sh/arith_yacc.c +++ b/bin/sh/arith_yacc.c @@ -139,7 +139,7 @@ static arith_t do_binop(int op, arith_t a, arith_t b) case ARITH_SUB: return (uintmax_t)a - (uintmax_t)b; case ARITH_LSHIFT: - return a << b; + return (uintmax_t)a << b; case ARITH_RSHIFT: return a >> b; case ARITH_LT: diff --git a/bin/sh/eval.c b/bin/sh/eval.c index 4f7559e1848..3fd3050111d 100644 --- a/bin/sh/eval.c +++ b/bin/sh/eval.c @@ -1250,8 +1250,16 @@ bltincmd(int argc, char **argv) int breakcmd(int argc, char **argv) { - int n = argc > 1 ? number(argv[1]) : 1; + long n; + char *end; + if (argc > 1) { + /* Allow arbitrarily large numbers. */ + n = strtol(argv[1], &end, 10); + if (!is_digit(argv[1][0]) || *end != '\0') + error("Illegal number: %s", argv[1]); + } else + n = 1; if (n > loopnest) n = loopnest; if (n > 0) { diff --git a/bin/sh/exec.c b/bin/sh/exec.c index e547e313665..c9d4126488e 100644 --- a/bin/sh/exec.c +++ b/bin/sh/exec.c @@ -362,15 +362,13 @@ find_command(const char *name, struct cmdentry *entry, int act, e = ENOENT; idx = -1; -loop: - while ((fullname = padvance(&path, name)) != NULL) { - stunalloc(fullname); + for (;(fullname = padvance(&path, name)) != NULL; stunalloc(fullname)) { idx++; if (pathopt) { - if (prefix("func", pathopt)) { + if (strncmp(pathopt, "func", 4) == 0) { /* handled below */ } else { - goto loop; /* ignore unimplemented options */ + continue; /* ignore unimplemented options */ } } if (fullname[0] != '/') @@ -378,13 +376,12 @@ find_command(const char *name, struct cmdentry *entry, int act, if (stat(fullname, &statb) < 0) { if (errno != ENOENT && errno != ENOTDIR) e = errno; - goto loop; + continue; } e = EACCES; /* if we fail, this will be the error */ if (!S_ISREG(statb.st_mode)) - goto loop; + continue; if (pathopt) { /* this is a %func directory */ - stalloc(strlen(fullname) + 1); readcmdfile(fullname); if ((cmdp = cmdlookup(name, 0)) == NULL || cmdp->cmdtype != CMDFUNCTION) error("%s not defined in %s", name, fullname); @@ -405,6 +402,7 @@ find_command(const char *name, struct cmdentry *entry, int act, #endif TRACE(("searchexec \"%s\" returns \"%s\"\n", name, fullname)); INTOFF; + stunalloc(fullname); cmdp = cmdlookup(name, 1); if (cmdp->cmdtype == CMDFUNCTION) cmdp = &loc_cmd; diff --git a/bin/sh/expand.c b/bin/sh/expand.c index a126ca60a6d..15afc9ce67f 100644 --- a/bin/sh/expand.c +++ b/bin/sh/expand.c @@ -846,9 +846,11 @@ varisset(const char *name, int nulok) } } else if (is_digit(*name)) { char *ap; - int num = atoi(name); + long num; - if (num > shellparam.nparam) + errno = 0; + num = strtol(name, NULL, 10); + if (errno != 0 || num > shellparam.nparam) return 0; if (num == 0) @@ -928,17 +930,16 @@ varvalue(const char *name, int quoted, int subtype, int flag) STPUTC(sep, expdest); } break; - case '0': - p = arg0; - strtodest(p, flag, subtype, quoted); - break; default: if (is_digit(*name)) { num = atoi(name); - if (num > 0 && num <= shellparam.nparam) { + if (num == 0) + p = arg0; + else if (num > 0 && num <= shellparam.nparam) p = shellparam.p[num - 1]; - strtodest(p, flag, subtype, quoted); - } + else + break; + strtodest(p, flag, subtype, quoted); } break; } diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c index af5887e0280..93553c11e5b 100644 --- a/bin/sh/jobs.c +++ b/bin/sh/jobs.c @@ -562,6 +562,7 @@ getjob_nonotfound(const char *name) { int jobno; struct job *found, *jp; + size_t namelen; pid_t pid; int i; @@ -603,10 +604,12 @@ currentjob: if ((jp = getcurjob(NULL)) == NULL) if (found != NULL) return (found); } else { + namelen = strlen(name); found = NULL; for (jp = jobtab, i = njobs ; --i >= 0 ; jp++) { if (jp->used && jp->nprocs > 0 - && prefix(name + 1, jp->ps[0].cmd)) { + && strncmp(jp->ps[0].cmd, name + 1, + namelen - 1) == 0) { if (found) error("%s: ambiguous", name); found = jp; diff --git a/bin/sh/main.c b/bin/sh/main.c index e4974ea7f45..08f234e5ee5 100644 --- a/bin/sh/main.c +++ b/bin/sh/main.c @@ -140,11 +140,13 @@ main(int argc, char *argv[]) #endif rootpid = getpid(); rootshell = 1; + INTOFF; initvar(); setstackmark(&smark); setstackmark(&smark2); procargs(argc, argv); pwd_init(iflag); + INTON; if (iflag) chkmail(1); if (argv[0] && argv[0][0] == '-') { diff --git a/bin/sh/miscbltin.c b/bin/sh/miscbltin.c index 27fa53db2fb..027d8ae3faf 100644 --- a/bin/sh/miscbltin.c +++ b/bin/sh/miscbltin.c @@ -411,13 +411,32 @@ static const struct limits limits[] = { { (char *) 0, (char *)0, 0, 0, '\0' } }; +enum limithow { SOFT = 0x1, HARD = 0x2 }; + +static void +printlimit(enum limithow how, const struct rlimit *limit, + const struct limits *l) +{ + rlim_t val = 0; + + if (how & SOFT) + val = limit->rlim_cur; + else if (how & HARD) + val = limit->rlim_max; + if (val == RLIM_INFINITY) + out1str("unlimited\n"); + else + { + val /= l->factor; + out1fmt("%jd\n", (intmax_t)val); + } +} + int ulimitcmd(int argc __unused, char **argv __unused) { - int c; rlim_t val = 0; - enum { SOFT = 0x1, HARD = 0x2 } - how = SOFT | HARD; + enum limithow how = SOFT | HARD; const struct limits *l; int set, all = 0; int optc, what; @@ -453,17 +472,22 @@ ulimitcmd(int argc __unused, char **argv __unused) if (strcmp(p, "unlimited") == 0) val = RLIM_INFINITY; else { - val = 0; + char *end; + uintmax_t uval; - while ((c = *p++) >= '0' && c <= '9') - { - val = (val * 10) + (long)(c - '0'); - if (val < 0) - break; - } - if (c) + if (*p < '0' || *p > '9') + error("bad number"); + errno = 0; + uval = strtoumax(p, &end, 10); + if (errno != 0 || *end != '\0') + error("bad number"); + if (uval > UINTMAX_MAX / l->factor) + error("bad number"); + uval *= l->factor; + val = (rlim_t)uval; + if (val < 0 || (uintmax_t)val != uval || + val == RLIM_INFINITY) error("bad number"); - val *= l->factor; } } if (all) { @@ -471,10 +495,6 @@ ulimitcmd(int argc __unused, char **argv __unused) char optbuf[40]; if (getrlimit(l->cmd, &limit) < 0) error("can't get limit: %s", strerror(errno)); - if (how & SOFT) - val = limit.rlim_cur; - else if (how & HARD) - val = limit.rlim_max; if (l->units) snprintf(optbuf, sizeof(optbuf), @@ -483,13 +503,7 @@ ulimitcmd(int argc __unused, char **argv __unused) snprintf(optbuf, sizeof(optbuf), "(-%c) ", l->option); out1fmt("%-18s %18s ", l->name, optbuf); - if (val == RLIM_INFINITY) - out1str("unlimited\n"); - else - { - val /= l->factor; - out1fmt("%jd\n", (intmax_t)val); - } + printlimit(how, &limit, l); } return 0; } @@ -503,19 +517,7 @@ ulimitcmd(int argc __unused, char **argv __unused) limit.rlim_max = val; if (setrlimit(l->cmd, &limit) < 0) error("bad limit: %s", strerror(errno)); - } else { - if (how & SOFT) - val = limit.rlim_cur; - else if (how & HARD) - val = limit.rlim_max; - - if (val == RLIM_INFINITY) - out1str("unlimited\n"); - else - { - val /= l->factor; - out1fmt("%jd\n", (intmax_t)val); - } - } + } else + printlimit(how, &limit, l); return 0; } diff --git a/bin/sh/mystring.c b/bin/sh/mystring.c index de7e9b64895..03ea8bac608 100644 --- a/bin/sh/mystring.c +++ b/bin/sh/mystring.c @@ -60,21 +60,6 @@ char nullstr[1]; /* zero length string */ */ -/* - * prefix -- see if pfx is a prefix of string. - */ - -int -prefix(const char *pfx, const char *string) -{ - while (*pfx) { - if (*pfx++ != *string++) - return 0; - } - return 1; -} - - /* * Convert a string of digits to an integer, printing an error message on * failure. diff --git a/bin/sh/mystring.h b/bin/sh/mystring.h index 87b76c8acff..919fc867e7c 100644 --- a/bin/sh/mystring.h +++ b/bin/sh/mystring.h @@ -35,7 +35,6 @@ #include -int prefix(const char *, const char *); int number(const char *); int is_number(const char *); diff --git a/bin/sh/options.c b/bin/sh/options.c index ad0291e73a3..bf00a4e7d47 100644 --- a/bin/sh/options.c +++ b/bin/sh/options.c @@ -446,6 +446,7 @@ getopts(char *optstr, char *optvar, char **optfirst, char ***optnext, int ind = 0; int err = 0; char s[10]; + const char *optarg = NULL; if ((p = *optptr) == NULL || *p == '\0') { /* Current word is done, advance */ @@ -471,14 +472,12 @@ getopts(char *optstr, char *optvar, char **optfirst, char ***optnext, if (optstr[0] == ':') { s[0] = c; s[1] = '\0'; - err |= setvarsafe("OPTARG", s, 0); - } - else { - out1fmt("Illegal option -%c\n", c); - (void) unsetvar("OPTARG"); + optarg = s; } + else + out2fmt_flush("Illegal option -%c\n", c); c = '?'; - goto bad; + goto out; } if (*++q == ':') q++; @@ -489,33 +488,33 @@ getopts(char *optstr, char *optvar, char **optfirst, char ***optnext, if (optstr[0] == ':') { s[0] = c; s[1] = '\0'; - err |= setvarsafe("OPTARG", s, 0); + optarg = s; c = ':'; } else { - out1fmt("No arg for -%c option\n", c); - (void) unsetvar("OPTARG"); + out2fmt_flush("No arg for -%c option\n", c); c = '?'; } - goto bad; + goto out; } if (p == **optnext) (*optnext)++; - setvarsafe("OPTARG", p, 0); + optarg = p; p = NULL; } - else - setvarsafe("OPTARG", "", 0); - ind = *optnext - optfirst + 1; - goto out; -bad: - ind = 1; - *optnext = NULL; - p = NULL; out: + if (*optnext != NULL) + ind = *optnext - optfirst + 1; *optptr = p; + if (optarg != NULL) + err |= setvarsafe("OPTARG", optarg, 0); + else { + INTOFF; + err |= unsetvar("OPTARG"); + INTON; + } fmtstr(s, sizeof(s), "%d", ind); err |= setvarsafe("OPTIND", s, VNOFUNC); s[0] = c; diff --git a/bin/sh/tests/builtins/Makefile b/bin/sh/tests/builtins/Makefile index c0b21dc6072..4c988dabf52 100644 --- a/bin/sh/tests/builtins/Makefile +++ b/bin/sh/tests/builtins/Makefile @@ -14,6 +14,7 @@ FILES+= break2.0 break2.0.stdout FILES+= break3.0 FILES+= break4.4 FILES+= break5.4 +FILES+= break6.0 FILES+= builtin1.0 FILES+= case1.0 FILES+= case2.0 @@ -83,6 +84,9 @@ FILES+= getopts2.0 getopts2.0.stdout FILES+= getopts3.0 FILES+= getopts4.0 FILES+= getopts5.0 +FILES+= getopts6.0 +FILES+= getopts7.0 +FILES+= getopts8.0 getopts8.0.stdout FILES+= hash1.0 hash1.0.stdout FILES+= hash2.0 hash2.0.stdout FILES+= hash3.0 hash3.0.stdout @@ -96,7 +100,9 @@ FILES+= local1.0 FILES+= local2.0 FILES+= local3.0 FILES+= local4.0 +.if ${MK_NLS} != "no" FILES+= locale1.0 +.endif FILES+= printf1.0 FILES+= printf2.0 FILES+= printf3.0 diff --git a/bin/sh/tests/builtins/break6.0 b/bin/sh/tests/builtins/break6.0 new file mode 100644 index 00000000000..09fc0d85eaa --- /dev/null +++ b/bin/sh/tests/builtins/break6.0 @@ -0,0 +1,8 @@ +# $FreeBSD$ +# Per POSIX, this need only work if LONG_MAX > 4294967295. + +while :; do + break 4294967296 + echo bad + exit 3 +done diff --git a/bin/sh/tests/builtins/getopts1.0 b/bin/sh/tests/builtins/getopts1.0 index af31d559911..64763bc462c 100644 --- a/bin/sh/tests/builtins/getopts1.0 +++ b/bin/sh/tests/builtins/getopts1.0 @@ -15,7 +15,7 @@ printf -- '-2-\n' set -- -ab getopts "ab:" OPTION echo ${OPTION} -getopts "ab:" OPTION +getopts "ab:" OPTION 3>&2 2>&1 >&3 3>&- echo ${OPTION} # The 'shift' is aimed at causing an error. diff --git a/bin/sh/tests/builtins/getopts6.0 b/bin/sh/tests/builtins/getopts6.0 new file mode 100644 index 00000000000..1d3c39ba953 --- /dev/null +++ b/bin/sh/tests/builtins/getopts6.0 @@ -0,0 +1,7 @@ +# $FreeBSD$ + +set -- -x -y +getopts :x var || echo "First getopts bad: $?" +getopts :x var +r=$? +[ r != 0 ] && [ "$OPTIND" = 3 ] diff --git a/bin/sh/tests/builtins/getopts7.0 b/bin/sh/tests/builtins/getopts7.0 new file mode 100644 index 00000000000..3745555f8c1 --- /dev/null +++ b/bin/sh/tests/builtins/getopts7.0 @@ -0,0 +1,6 @@ +# $FreeBSD$ + +set -- -x +getopts :x: var +r=$? +[ r != 0 ] && [ "$OPTIND" = 2 ] diff --git a/bin/sh/tests/builtins/getopts8.0 b/bin/sh/tests/builtins/getopts8.0 new file mode 100644 index 00000000000..da4af6bd0b5 --- /dev/null +++ b/bin/sh/tests/builtins/getopts8.0 @@ -0,0 +1,8 @@ +# $FreeBSD$ + +set -- -yz -wx +opt=wrong1 OPTARG=wrong2 +while getopts :x opt; do + echo "$opt:${OPTARG-unset}" +done +echo "OPTIND=$OPTIND" diff --git a/bin/sh/tests/builtins/getopts8.0.stdout b/bin/sh/tests/builtins/getopts8.0.stdout new file mode 100644 index 00000000000..f10cefcd8c1 --- /dev/null +++ b/bin/sh/tests/builtins/getopts8.0.stdout @@ -0,0 +1,5 @@ +?:y +?:z +?:w +x:unset +OPTIND=3 diff --git a/bin/sh/tests/parameters/Makefile b/bin/sh/tests/parameters/Makefile index fafc059ec24..da49d1464ea 100644 --- a/bin/sh/tests/parameters/Makefile +++ b/bin/sh/tests/parameters/Makefile @@ -13,6 +13,9 @@ FILES+= optind1.0 FILES+= optind2.0 FILES+= positional1.0 FILES+= positional2.0 +FILES+= positional3.0 +FILES+= positional4.0 +FILES+= positional5.0 FILES+= pwd1.0 FILES+= pwd2.0 diff --git a/bin/sh/tests/parameters/positional3.0 b/bin/sh/tests/parameters/positional3.0 new file mode 100644 index 00000000000..1200469b4e1 --- /dev/null +++ b/bin/sh/tests/parameters/positional3.0 @@ -0,0 +1,4 @@ +# $FreeBSD$ + +r=$(${SH} -c 'echo ${01:+yes}${010:+yes}' '' a '' '' '' '' '' '' '' '' b) +[ "$r" = yesyes ] diff --git a/bin/sh/tests/parameters/positional4.0 b/bin/sh/tests/parameters/positional4.0 new file mode 100644 index 00000000000..c1c380c0fea --- /dev/null +++ b/bin/sh/tests/parameters/positional4.0 @@ -0,0 +1,4 @@ +# $FreeBSD$ + +set -- "x$0" 2 3 4 5 6 7 8 9 "y$0" +[ "${01}.${010}" = "$1.${10}" ] diff --git a/bin/sh/tests/parameters/positional5.0 b/bin/sh/tests/parameters/positional5.0 new file mode 100644 index 00000000000..eeaaba5321f --- /dev/null +++ b/bin/sh/tests/parameters/positional5.0 @@ -0,0 +1,14 @@ +# $FreeBSD$ + +i=1 +r=0 +while [ $i -lt $((0x100000000)) ]; do + t= + eval t=\${$i-x} + case $t in + x) ;; + *) echo "Problem with \${$i}" >&2; r=1 ;; + esac + i=$((i + 0x10000000)) +done +exit $r diff --git a/cddl/contrib/dtracetoolkit/rwsnoop b/cddl/contrib/dtracetoolkit/rwsnoop index 9d4932487cc..c96bd68f014 100755 --- a/cddl/contrib/dtracetoolkit/rwsnoop +++ b/cddl/contrib/dtracetoolkit/rwsnoop @@ -1,10 +1,10 @@ -#!/usr/bin/ksh +#!/bin/sh # # rwsnoop - snoop read/write events. -# Written using DTrace (Solaris 10 3/05). +# Originally written using DTrace (Solaris 10 3/05). # # This is measuring reads and writes at the application level. This matches -# the syscalls read, write, pread and pwrite. +# the syscalls read, and write. # # $Id: rwsnoop 3 2007-08-01 10:50:08Z brendan $ # @@ -12,15 +12,14 @@ # # rwsnoop # default output # -# -j # print project ID # -P # print parent process ID # -t # print timestamp, us # -v # print time, string -# -Z # print zone ID +# -J # print jail ID # -n name # this process name only # -p PID # this PID only # eg, -# rwsnoop -Z # print zone ID +# rwsnoop -J # print jail ID # rwsnoop -n bash # monitor processes named "bash" # rwsnoop > out.txt # recommended # @@ -32,8 +31,7 @@ # FIELDS: # TIME Timestamp, us # TIMESTR Time, string -# ZONE Zone ID -# PROJ Project ID +# JAIL JAIL ID # UID User ID # PID Process ID # PPID Parent Process ID @@ -71,6 +69,7 @@ # 24-Jul-2005 Brendan Gregg Created this. # 17-Sep-2005 " " Increased switchrate. # 17-Sep-2005 " " Last update. +# 26-Jul-2014 George Neville-Neil Port to FreeBSD # @@ -79,8 +78,8 @@ # ### default variables -opt_name=0; opt_pid=0; opt_proj=0; opt_zone=0; opt_time=0; opt_timestr=0 -opt_bytes=1; filter=0; pname=.; pid=0; opt_ppid=0 +opt_name=0; opt_pid=0; opt_jailid=0; opt_time=0; opt_timestr=0 +opt_bytes=1; filter=0; pname=.; pid=0; opt_ppid=0; ### process options while getopts n:Pp:jtvZ name @@ -89,23 +88,21 @@ do n) opt_name=1; pname=$OPTARG ;; p) opt_pid=1; pid=$OPTARG ;; P) opt_ppid=1 ;; - j) opt_proj=1 ;; t) opt_time=1 ;; v) opt_timestr=1 ;; - Z) opt_zone=1 ;; + J) opt_jailid=1 ;; h|?) cat <<-END >&2 USAGE: rwsnoop [-jPtvZ] [-n name] [-p pid] - -j # print project ID -P # print parent process ID -t # print timestamp, us -v # print time, string - -Z # print zone ID + -J # print jail ID -n name # this process name only -p PID # this PID only eg, rwsnoop # default output - rwsnoop -Z # print zone ID + rwsnoop -J # print jail ID rwsnoop -n bash # monitor processes named "bash" END exit 1 @@ -115,11 +112,13 @@ done shift $(( $OPTIND - 1 )) ### option logic -if (( opt_name || opt_pid )); then +if [ $opt_name -ne 0 ]; then filter=1 fi - +if [ $opt_pid -ne 0 ]; then + filter=1 +fi ################################# # --- Main Program, DTrace --- @@ -128,8 +127,7 @@ fi /* * Command line arguments */ - inline int OPT_proj = '$opt_proj'; - inline int OPT_zone = '$opt_zone'; + inline int OPT_jailid = '$opt_jailid'; inline int OPT_bytes = '$opt_bytes'; inline int OPT_name = '$opt_name'; inline int OPT_ppid = '$opt_ppid'; @@ -151,11 +149,10 @@ fi /* print header */ OPT_time ? printf("%-14s ", "TIME") : 1; OPT_timestr ? printf("%-20s ", "TIMESTR") : 1; - OPT_proj ? printf("%5s ", "PROJ") : 1; - OPT_zone ? printf("%5s ", "ZONE") : 1; + OPT_jailid ? printf("%5s ", "JAILID") : 1; OPT_ppid ? printf("%6s ", "PPID") : 1; - printf("%5s %6s %-12s %1s %7s %s\n", - "UID", "PID", "CMD", "D", "BYTES", "FILE"); + printf("%5s %6s %-12s %4s %1s %7s\n", + "UID", "PID", "CMD", "FD", "D", "BYTES"); } /* @@ -205,7 +202,10 @@ fi { /* * Fetch filename + * XXX Not yet implemented. */ +/* + this->filistp = curthread->t_procp->p_user.u_finfo.fi_list; this->ufentryp = (uf_entry_t *)((uint64_t)this->filistp + (uint64_t)self->fd * (uint64_t)sizeof(uf_entry_t)); @@ -213,17 +213,16 @@ fi this->vnodep = this->filep != 0 ? this->filep->f_vnode : 0; self->vpath = this->vnodep ? (this->vnodep->v_path != 0 ? cleanpath(this->vnodep->v_path) : "") : ""; - +*/ /* * Print details */ OPT_time ? printf("%-14d ", timestamp / 1000) : 1; OPT_timestr ? printf("%-20Y ", walltimestamp) : 1; - OPT_proj ? printf("%5d ", curpsinfo->pr_projid) : 1; - OPT_zone ? printf("%5d ", curpsinfo->pr_zoneid) : 1; + OPT_jailid ? printf("%5d ", curpsinfo->pr_jailid) : 1; OPT_ppid ? printf("%6d ", ppid) : 1; - printf("%5d %6d %-12.12s %1s %7d %s\n", - uid, pid, execname, self->rw, (int)self->size, self->vpath); + printf("%5d %6d %-12.12s %4d %1s %7d\n", + uid, pid, execname, self->fd, self->rw, (int)self->size); self->ok = 0; self->fd = 0; diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c index a745ceb7173..4cbb866cfad 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c +++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c @@ -25,6 +25,7 @@ */ /* * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013, Joyent, Inc. All rights reserved. */ #include @@ -513,6 +514,7 @@ static void print_probe_info(const dtrace_probeinfo_t *p) { char buf[BUFSIZ]; + char *user; int i; oprintf("\n\tProbe Description Attributes\n"); @@ -536,10 +538,14 @@ print_probe_info(const dtrace_probeinfo_t *p) oprintf("\n\tArgument Types\n"); for (i = 0; i < p->dtp_argc; i++) { + if (p->dtp_argv[i].dtt_flags & DTT_FL_USER) + user = "userland "; + else + user = ""; if (ctf_type_name(p->dtp_argv[i].dtt_ctfp, p->dtp_argv[i].dtt_type, buf, sizeof (buf)) == NULL) (void) strlcpy(buf, "(unknown)", sizeof (buf)); - oprintf("\t\targs[%d]: %s\n", i, buf); + oprintf("\t\targs[%d]: %s%s\n", i, user, buf); } if (p->dtp_argc == 0) diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggencoding.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggencoding.d new file mode 100644 index 00000000000..a594afc7d60 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggencoding.d @@ -0,0 +1,32 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright (c) 2013 Joyent, Inc. All rights reserved. + */ + +#pragma D option quiet +#pragma D option encoding=utf8 +#pragma D option aggzoom + +tick-1ms +/i++ < 320/ +{ + @ = lquantize(i, 0, 640, 1, i); + @ = lquantize(641 - i, 0, 640, 1, i); +} + +tick-1ms +/i == 320/ +{ + printa(@); + exit(0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggencoding.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggencoding.d.out new file mode 100644 index 00000000000..68482ffbe14 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggencoding.d.out @@ -0,0 +1,646 @@ + + + value ------------- Distribution ------------- count + 0 | 0 + 1 | 1 + 2 |▏ 2 + 3 |▎ 3 + 4 |▍ 4 + 5 |▌ 5 + 6 |▋ 6 + 7 |▊ 7 + 8 |▉ 8 + 9 |█ 9 + 10 |█▏ 10 + 11 |█▎ 11 + 12 |█▍ 12 + 13 |█▌ 13 + 14 |█▋ 14 + 15 |█▊ 15 + 16 |█▉ 16 + 17 |██ 17 + 18 |██▏ 18 + 19 |██▎ 19 + 20 |██▍ 20 + 21 |██▍ 21 + 22 |██▌ 22 + 23 |██▋ 23 + 24 |██▊ 24 + 25 |██▉ 25 + 26 |███ 26 + 27 |███▏ 27 + 28 |███▎ 28 + 29 |███▍ 29 + 30 |███▌ 30 + 31 |███▋ 31 + 32 |███▊ 32 + 33 |███▉ 33 + 34 |████ 34 + 35 |████▏ 35 + 36 |████▎ 36 + 37 |████▍ 37 + 38 |████▌ 38 + 39 |████▋ 39 + 40 |████▊ 40 + 41 |████▊ 41 + 42 |████▉ 42 + 43 |█████ 43 + 44 |█████▏ 44 + 45 |█████▎ 45 + 46 |█████▍ 46 + 47 |█████▌ 47 + 48 |█████▋ 48 + 49 |█████▊ 49 + 50 |█████▉ 50 + 51 |██████ 51 + 52 |██████▏ 52 + 53 |██████▎ 53 + 54 |██████▍ 54 + 55 |██████▌ 55 + 56 |██████▋ 56 + 57 |██████▊ 57 + 58 |██████▉ 58 + 59 |███████ 59 + 60 |███████▏ 60 + 61 |███████▏ 61 + 62 |███████▎ 62 + 63 |███████▍ 63 + 64 |███████▌ 64 + 65 |███████▋ 65 + 66 |███████▊ 66 + 67 |███████▉ 67 + 68 |████████ 68 + 69 |████████▏ 69 + 70 |████████▎ 70 + 71 |████████▍ 71 + 72 |████████▌ 72 + 73 |████████▋ 73 + 74 |████████▊ 74 + 75 |████████▉ 75 + 76 |█████████ 76 + 77 |█████████▏ 77 + 78 |█████████▎ 78 + 79 |█████████▍ 79 + 80 |█████████▌ 80 + 81 |█████████▌ 81 + 82 |█████████▋ 82 + 83 |█████████▊ 83 + 84 |█████████▉ 84 + 85 |██████████ 85 + 86 |██████████▏ 86 + 87 |██████████▎ 87 + 88 |██████████▍ 88 + 89 |██████████▌ 89 + 90 |██████████▋ 90 + 91 |██████████▊ 91 + 92 |██████████▉ 92 + 93 |███████████ 93 + 94 |███████████▏ 94 + 95 |███████████▎ 95 + 96 |███████████▍ 96 + 97 |███████████▌ 97 + 98 |███████████▋ 98 + 99 |███████████▊ 99 + 100 |███████████▉ 100 + 101 |███████████▉ 101 + 102 |████████████ 102 + 103 |████████████▏ 103 + 104 |████████████▎ 104 + 105 |████████████▍ 105 + 106 |████████████▌ 106 + 107 |████████████▋ 107 + 108 |████████████▊ 108 + 109 |████████████▉ 109 + 110 |█████████████ 110 + 111 |█████████████▏ 111 + 112 |█████████████▎ 112 + 113 |█████████████▍ 113 + 114 |█████████████▌ 114 + 115 |█████████████▋ 115 + 116 |█████████████▊ 116 + 117 |█████████████▉ 117 + 118 |██████████████ 118 + 119 |██████████████▏ 119 + 120 |██████████████▎ 120 + 121 |██████████████▎ 121 + 122 |██████████████▍ 122 + 123 |██████████████▌ 123 + 124 |██████████████▋ 124 + 125 |██████████████▊ 125 + 126 |██████████████▉ 126 + 127 |███████████████ 127 + 128 |███████████████▏ 128 + 129 |███████████████▎ 129 + 130 |███████████████▍ 130 + 131 |███████████████▌ 131 + 132 |███████████████▋ 132 + 133 |███████████████▊ 133 + 134 |███████████████▉ 134 + 135 |████████████████ 135 + 136 |████████████████▏ 136 + 137 |████████████████▎ 137 + 138 |████████████████▍ 138 + 139 |████████████████▌ 139 + 140 |████████████████▋ 140 + 141 |████████████████▋ 141 + 142 |████████████████▊ 142 + 143 |████████████████▉ 143 + 144 |█████████████████ 144 + 145 |█████████████████▏ 145 + 146 |█████████████████▎ 146 + 147 |█████████████████▍ 147 + 148 |█████████████████▌ 148 + 149 |█████████████████▋ 149 + 150 |█████████████████▊ 150 + 151 |█████████████████▉ 151 + 152 |██████████████████ 152 + 153 |██████████████████▏ 153 + 154 |██████████████████▎ 154 + 155 |██████████████████▍ 155 + 156 |██████████████████▌ 156 + 157 |██████████████████▋ 157 + 158 |██████████████████▊ 158 + 159 |██████████████████▉ 159 + 160 |███████████████████ 160 + 161 |███████████████████ 161 + 162 |███████████████████▏ 162 + 163 |███████████████████▎ 163 + 164 |███████████████████▍ 164 + 165 |███████████████████▌ 165 + 166 |███████████████████▋ 166 + 167 |███████████████████▊ 167 + 168 |███████████████████▉ 168 + 169 |████████████████████ 169 + 170 |████████████████████▏ 170 + 171 |████████████████████▎ 171 + 172 |████████████████████▍ 172 + 173 |████████████████████▌ 173 + 174 |████████████████████▋ 174 + 175 |████████████████████▊ 175 + 176 |████████████████████▉ 176 + 177 |█████████████████████ 177 + 178 |█████████████████████▏ 178 + 179 |█████████████████████▎ 179 + 180 |█████████████████████▍ 180 + 181 |█████████████████████▍ 181 + 182 |█████████████████████▌ 182 + 183 |█████████████████████▋ 183 + 184 |█████████████████████▊ 184 + 185 |█████████████████████▉ 185 + 186 |██████████████████████ 186 + 187 |██████████████████████▏ 187 + 188 |██████████████████████▎ 188 + 189 |██████████████████████▍ 189 + 190 |██████████████████████▌ 190 + 191 |██████████████████████▋ 191 + 192 |██████████████████████▊ 192 + 193 |██████████████████████▉ 193 + 194 |███████████████████████ 194 + 195 |███████████████████████▏ 195 + 196 |███████████████████████▎ 196 + 197 |███████████████████████▍ 197 + 198 |███████████████████████▌ 198 + 199 |███████████████████████▋ 199 + 200 |███████████████████████▊ 200 + 201 |███████████████████████▊ 201 + 202 |███████████████████████▉ 202 + 203 |████████████████████████ 203 + 204 |████████████████████████▏ 204 + 205 |████████████████████████▎ 205 + 206 |████████████████████████▍ 206 + 207 |████████████████████████▌ 207 + 208 |████████████████████████▋ 208 + 209 |████████████████████████▊ 209 + 210 |████████████████████████▉ 210 + 211 |█████████████████████████ 211 + 212 |█████████████████████████▏ 212 + 213 |█████████████████████████▎ 213 + 214 |█████████████████████████▍ 214 + 215 |█████████████████████████▌ 215 + 216 |█████████████████████████▋ 216 + 217 |█████████████████████████▊ 217 + 218 |█████████████████████████▉ 218 + 219 |██████████████████████████ 219 + 220 |██████████████████████████▏ 220 + 221 |██████████████████████████▏ 221 + 222 |██████████████████████████▎ 222 + 223 |██████████████████████████▍ 223 + 224 |██████████████████████████▌ 224 + 225 |██████████████████████████▋ 225 + 226 |██████████████████████████▊ 226 + 227 |██████████████████████████▉ 227 + 228 |███████████████████████████ 228 + 229 |███████████████████████████▏ 229 + 230 |███████████████████████████▎ 230 + 231 |███████████████████████████▍ 231 + 232 |███████████████████████████▌ 232 + 233 |███████████████████████████▋ 233 + 234 |███████████████████████████▊ 234 + 235 |███████████████████████████▉ 235 + 236 |████████████████████████████ 236 + 237 |████████████████████████████▏ 237 + 238 |████████████████████████████▎ 238 + 239 |████████████████████████████▍ 239 + 240 |████████████████████████████▌ 240 + 241 |████████████████████████████▌ 241 + 242 |████████████████████████████▋ 242 + 243 |████████████████████████████▊ 243 + 244 |████████████████████████████▉ 244 + 245 |█████████████████████████████ 245 + 246 |█████████████████████████████▏ 246 + 247 |█████████████████████████████▎ 247 + 248 |█████████████████████████████▍ 248 + 249 |█████████████████████████████▌ 249 + 250 |█████████████████████████████▋ 250 + 251 |█████████████████████████████▊ 251 + 252 |█████████████████████████████▉ 252 + 253 |██████████████████████████████ 253 + 254 |██████████████████████████████▏ 254 + 255 |██████████████████████████████▎ 255 + 256 |██████████████████████████████▍ 256 + 257 |██████████████████████████████▌ 257 + 258 |██████████████████████████████▋ 258 + 259 |██████████████████████████████▊ 259 + 260 |██████████████████████████████▉ 260 + 261 |██████████████████████████████▉ 261 + 262 |███████████████████████████████ 262 + 263 |███████████████████████████████▏ 263 + 264 |███████████████████████████████▎ 264 + 265 |███████████████████████████████▍ 265 + 266 |███████████████████████████████▌ 266 + 267 |███████████████████████████████▋ 267 + 268 |███████████████████████████████▊ 268 + 269 |███████████████████████████████▉ 269 + 270 |████████████████████████████████ 270 + 271 |████████████████████████████████▏ 271 + 272 |████████████████████████████████▎ 272 + 273 |████████████████████████████████▍ 273 + 274 |████████████████████████████████▌ 274 + 275 |████████████████████████████████▋ 275 + 276 |████████████████████████████████▊ 276 + 277 |████████████████████████████████▉ 277 + 278 |█████████████████████████████████ 278 + 279 |█████████████████████████████████▏ 279 + 280 |█████████████████████████████████▎ 280 + 281 |█████████████████████████████████▎ 281 + 282 |█████████████████████████████████▍ 282 + 283 |█████████████████████████████████▌ 283 + 284 |█████████████████████████████████▋ 284 + 285 |█████████████████████████████████▊ 285 + 286 |█████████████████████████████████▉ 286 + 287 |██████████████████████████████████ 287 + 288 |██████████████████████████████████▏ 288 + 289 |██████████████████████████████████▎ 289 + 290 |██████████████████████████████████▍ 290 + 291 |██████████████████████████████████▌ 291 + 292 |██████████████████████████████████▋ 292 + 293 |██████████████████████████████████▊ 293 + 294 |██████████████████████████████████▉ 294 + 295 |███████████████████████████████████ 295 + 296 |███████████████████████████████████▏ 296 + 297 |███████████████████████████████████▎ 297 + 298 |███████████████████████████████████▍ 298 + 299 |███████████████████████████████████▌ 299 + 300 |███████████████████████████████████▋ 300 + 301 |███████████████████████████████████▋ 301 + 302 |███████████████████████████████████▊ 302 + 303 |███████████████████████████████████▉ 303 + 304 |████████████████████████████████████ 304 + 305 |████████████████████████████████████▏ 305 + 306 |████████████████████████████████████▎ 306 + 307 |████████████████████████████████████▍ 307 + 308 |████████████████████████████████████▌ 308 + 309 |████████████████████████████████████▋ 309 + 310 |████████████████████████████████████▊ 310 + 311 |████████████████████████████████████▉ 311 + 312 |█████████████████████████████████████ 312 + 313 |█████████████████████████████████████▏ 313 + 314 |█████████████████████████████████████▎ 314 + 315 |█████████████████████████████████████▍ 315 + 316 |█████████████████████████████████████▌ 316 + 317 |█████████████████████████████████████▋ 317 + 318 |█████████████████████████████████████▊ 318 + 319 |█████████████████████████████████████▉ 319 + 320 |██████████████████████████████████████ 320 + 321 |██████████████████████████████████████ 320 + 322 |█████████████████████████████████████▉ 319 + 323 |█████████████████████████████████████▊ 318 + 324 |█████████████████████████████████████▋ 317 + 325 |█████████████████████████████████████▌ 316 + 326 |█████████████████████████████████████▍ 315 + 327 |█████████████████████████████████████▎ 314 + 328 |█████████████████████████████████████▏ 313 + 329 |█████████████████████████████████████ 312 + 330 |████████████████████████████████████▉ 311 + 331 |████████████████████████████████████▊ 310 + 332 |████████████████████████████████████▋ 309 + 333 |████████████████████████████████████▌ 308 + 334 |████████████████████████████████████▍ 307 + 335 |████████████████████████████████████▎ 306 + 336 |████████████████████████████████████▏ 305 + 337 |████████████████████████████████████ 304 + 338 |███████████████████████████████████▉ 303 + 339 |███████████████████████████████████▊ 302 + 340 |███████████████████████████████████▋ 301 + 341 |███████████████████████████████████▋ 300 + 342 |███████████████████████████████████▌ 299 + 343 |███████████████████████████████████▍ 298 + 344 |███████████████████████████████████▎ 297 + 345 |███████████████████████████████████▏ 296 + 346 |███████████████████████████████████ 295 + 347 |██████████████████████████████████▉ 294 + 348 |██████████████████████████████████▊ 293 + 349 |██████████████████████████████████▋ 292 + 350 |██████████████████████████████████▌ 291 + 351 |██████████████████████████████████▍ 290 + 352 |██████████████████████████████████▎ 289 + 353 |██████████████████████████████████▏ 288 + 354 |██████████████████████████████████ 287 + 355 |█████████████████████████████████▉ 286 + 356 |█████████████████████████████████▊ 285 + 357 |█████████████████████████████████▋ 284 + 358 |█████████████████████████████████▌ 283 + 359 |█████████████████████████████████▍ 282 + 360 |█████████████████████████████████▎ 281 + 361 |█████████████████████████████████▎ 280 + 362 |█████████████████████████████████▏ 279 + 363 |█████████████████████████████████ 278 + 364 |████████████████████████████████▉ 277 + 365 |████████████████████████████████▊ 276 + 366 |████████████████████████████████▋ 275 + 367 |████████████████████████████████▌ 274 + 368 |████████████████████████████████▍ 273 + 369 |████████████████████████████████▎ 272 + 370 |████████████████████████████████▏ 271 + 371 |████████████████████████████████ 270 + 372 |███████████████████████████████▉ 269 + 373 |███████████████████████████████▊ 268 + 374 |███████████████████████████████▋ 267 + 375 |███████████████████████████████▌ 266 + 376 |███████████████████████████████▍ 265 + 377 |███████████████████████████████▎ 264 + 378 |███████████████████████████████▏ 263 + 379 |███████████████████████████████ 262 + 380 |██████████████████████████████▉ 261 + 381 |██████████████████████████████▉ 260 + 382 |██████████████████████████████▊ 259 + 383 |██████████████████████████████▋ 258 + 384 |██████████████████████████████▌ 257 + 385 |██████████████████████████████▍ 256 + 386 |██████████████████████████████▎ 255 + 387 |██████████████████████████████▏ 254 + 388 |██████████████████████████████ 253 + 389 |█████████████████████████████▉ 252 + 390 |█████████████████████████████▊ 251 + 391 |█████████████████████████████▋ 250 + 392 |█████████████████████████████▌ 249 + 393 |█████████████████████████████▍ 248 + 394 |█████████████████████████████▎ 247 + 395 |█████████████████████████████▏ 246 + 396 |█████████████████████████████ 245 + 397 |████████████████████████████▉ 244 + 398 |████████████████████████████▊ 243 + 399 |████████████████████████████▋ 242 + 400 |████████████████████████████▌ 241 + 401 |████████████████████████████▌ 240 + 402 |████████████████████████████▍ 239 + 403 |████████████████████████████▎ 238 + 404 |████████████████████████████▏ 237 + 405 |████████████████████████████ 236 + 406 |███████████████████████████▉ 235 + 407 |███████████████████████████▊ 234 + 408 |███████████████████████████▋ 233 + 409 |███████████████████████████▌ 232 + 410 |███████████████████████████▍ 231 + 411 |███████████████████████████▎ 230 + 412 |███████████████████████████▏ 229 + 413 |███████████████████████████ 228 + 414 |██████████████████████████▉ 227 + 415 |██████████████████████████▊ 226 + 416 |██████████████████████████▋ 225 + 417 |██████████████████████████▌ 224 + 418 |██████████████████████████▍ 223 + 419 |██████████████████████████▎ 222 + 420 |██████████████████████████▏ 221 + 421 |██████████████████████████▏ 220 + 422 |██████████████████████████ 219 + 423 |█████████████████████████▉ 218 + 424 |█████████████████████████▊ 217 + 425 |█████████████████████████▋ 216 + 426 |█████████████████████████▌ 215 + 427 |█████████████████████████▍ 214 + 428 |█████████████████████████▎ 213 + 429 |█████████████████████████▏ 212 + 430 |█████████████████████████ 211 + 431 |████████████████████████▉ 210 + 432 |████████████████████████▊ 209 + 433 |████████████████████████▋ 208 + 434 |████████████████████████▌ 207 + 435 |████████████████████████▍ 206 + 436 |████████████████████████▎ 205 + 437 |████████████████████████▏ 204 + 438 |████████████████████████ 203 + 439 |███████████████████████▉ 202 + 440 |███████████████████████▊ 201 + 441 |███████████████████████▊ 200 + 442 |███████████████████████▋ 199 + 443 |███████████████████████▌ 198 + 444 |███████████████████████▍ 197 + 445 |███████████████████████▎ 196 + 446 |███████████████████████▏ 195 + 447 |███████████████████████ 194 + 448 |██████████████████████▉ 193 + 449 |██████████████████████▊ 192 + 450 |██████████████████████▋ 191 + 451 |██████████████████████▌ 190 + 452 |██████████████████████▍ 189 + 453 |██████████████████████▎ 188 + 454 |██████████████████████▏ 187 + 455 |██████████████████████ 186 + 456 |█████████████████████▉ 185 + 457 |█████████████████████▊ 184 + 458 |█████████████████████▋ 183 + 459 |█████████████████████▌ 182 + 460 |█████████████████████▍ 181 + 461 |█████████████████████▍ 180 + 462 |█████████████████████▎ 179 + 463 |█████████████████████▏ 178 + 464 |█████████████████████ 177 + 465 |████████████████████▉ 176 + 466 |████████████████████▊ 175 + 467 |████████████████████▋ 174 + 468 |████████████████████▌ 173 + 469 |████████████████████▍ 172 + 470 |████████████████████▎ 171 + 471 |████████████████████▏ 170 + 472 |████████████████████ 169 + 473 |███████████████████▉ 168 + 474 |███████████████████▊ 167 + 475 |███████████████████▋ 166 + 476 |███████████████████▌ 165 + 477 |███████████████████▍ 164 + 478 |███████████████████▎ 163 + 479 |███████████████████▏ 162 + 480 |███████████████████ 161 + 481 |███████████████████ 160 + 482 |██████████████████▉ 159 + 483 |██████████████████▊ 158 + 484 |██████████████████▋ 157 + 485 |██████████████████▌ 156 + 486 |██████████████████▍ 155 + 487 |██████████████████▎ 154 + 488 |██████████████████▏ 153 + 489 |██████████████████ 152 + 490 |█████████████████▉ 151 + 491 |█████████████████▊ 150 + 492 |█████████████████▋ 149 + 493 |█████████████████▌ 148 + 494 |█████████████████▍ 147 + 495 |█████████████████▎ 146 + 496 |█████████████████▏ 145 + 497 |█████████████████ 144 + 498 |████████████████▉ 143 + 499 |████████████████▊ 142 + 500 |████████████████▋ 141 + 501 |████████████████▋ 140 + 502 |████████████████▌ 139 + 503 |████████████████▍ 138 + 504 |████████████████▎ 137 + 505 |████████████████▏ 136 + 506 |████████████████ 135 + 507 |███████████████▉ 134 + 508 |███████████████▊ 133 + 509 |███████████████▋ 132 + 510 |███████████████▌ 131 + 511 |███████████████▍ 130 + 512 |███████████████▎ 129 + 513 |███████████████▏ 128 + 514 |███████████████ 127 + 515 |██████████████▉ 126 + 516 |██████████████▊ 125 + 517 |██████████████▋ 124 + 518 |██████████████▌ 123 + 519 |██████████████▍ 122 + 520 |██████████████▎ 121 + 521 |██████████████▎ 120 + 522 |██████████████▏ 119 + 523 |██████████████ 118 + 524 |█████████████▉ 117 + 525 |█████████████▊ 116 + 526 |█████████████▋ 115 + 527 |█████████████▌ 114 + 528 |█████████████▍ 113 + 529 |█████████████▎ 112 + 530 |█████████████▏ 111 + 531 |█████████████ 110 + 532 |████████████▉ 109 + 533 |████████████▊ 108 + 534 |████████████▋ 107 + 535 |████████████▌ 106 + 536 |████████████▍ 105 + 537 |████████████▎ 104 + 538 |████████████▏ 103 + 539 |████████████ 102 + 540 |███████████▉ 101 + 541 |███████████▉ 100 + 542 |███████████▊ 99 + 543 |███████████▋ 98 + 544 |███████████▌ 97 + 545 |███████████▍ 96 + 546 |███████████▎ 95 + 547 |███████████▏ 94 + 548 |███████████ 93 + 549 |██████████▉ 92 + 550 |██████████▊ 91 + 551 |██████████▋ 90 + 552 |██████████▌ 89 + 553 |██████████▍ 88 + 554 |██████████▎ 87 + 555 |██████████▏ 86 + 556 |██████████ 85 + 557 |█████████▉ 84 + 558 |█████████▊ 83 + 559 |█████████▋ 82 + 560 |█████████▌ 81 + 561 |█████████▌ 80 + 562 |█████████▍ 79 + 563 |█████████▎ 78 + 564 |█████████▏ 77 + 565 |█████████ 76 + 566 |████████▉ 75 + 567 |████████▊ 74 + 568 |████████▋ 73 + 569 |████████▌ 72 + 570 |████████▍ 71 + 571 |████████▎ 70 + 572 |████████▏ 69 + 573 |████████ 68 + 574 |███████▉ 67 + 575 |███████▊ 66 + 576 |███████▋ 65 + 577 |███████▌ 64 + 578 |███████▍ 63 + 579 |███████▎ 62 + 580 |███████▏ 61 + 581 |███████▏ 60 + 582 |███████ 59 + 583 |██████▉ 58 + 584 |██████▊ 57 + 585 |██████▋ 56 + 586 |██████▌ 55 + 587 |██████▍ 54 + 588 |██████▎ 53 + 589 |██████▏ 52 + 590 |██████ 51 + 591 |█████▉ 50 + 592 |█████▊ 49 + 593 |█████▋ 48 + 594 |█████▌ 47 + 595 |█████▍ 46 + 596 |█████▎ 45 + 597 |█████▏ 44 + 598 |█████ 43 + 599 |████▉ 42 + 600 |████▊ 41 + 601 |████▊ 40 + 602 |████▋ 39 + 603 |████▌ 38 + 604 |████▍ 37 + 605 |████▎ 36 + 606 |████▏ 35 + 607 |████ 34 + 608 |███▉ 33 + 609 |███▊ 32 + 610 |███▋ 31 + 611 |███▌ 30 + 612 |███▍ 29 + 613 |███▎ 28 + 614 |███▏ 27 + 615 |███ 26 + 616 |██▉ 25 + 617 |██▊ 24 + 618 |██▋ 23 + 619 |██▌ 22 + 620 |██▍ 21 + 621 |██▍ 20 + 622 |██▎ 19 + 623 |██▏ 18 + 624 |██ 17 + 625 |█▉ 16 + 626 |█▊ 15 + 627 |█▋ 14 + 628 |█▌ 13 + 629 |█▍ 12 + 630 |█▎ 11 + 631 |█▏ 10 + 632 |█ 9 + 633 |▉ 8 + 634 |▊ 7 + 635 |▋ 6 + 636 |▌ 5 + 637 |▍ 4 + 638 |▎ 3 + 639 |▏ 2 + >= 640 | 1 + + diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.agghist.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.agghist.d new file mode 100644 index 00000000000..317aecefddf --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.agghist.d @@ -0,0 +1,46 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright (c) 2013 Joyent, Inc. All rights reserved. + */ + +#pragma D option agghist +#pragma D option quiet + +BEGIN +{ + @["demerit"] = sum(-10); + @["wtf"] = sum(10); + @["bot"] = sum(20); + + @bagnoogle["SOAP/XML"] = sum(1); + @bagnoogle["XACML store"] = sum(5); + @bagnoogle["SAML token"] = sum(6); + + @stalloogle["breakfast"] = sum(-5); + @stalloogle["non-diet pepsi"] = sum(-20); + @stalloogle["parrot"] = sum(-100); + + printa(@); + printa(@bagnoogle); + printa(@stalloogle); + + printf("\nzoomed:"); + + setopt("aggzoom"); + printa(@); + printa(@bagnoogle); + printa(@stalloogle); + + exit(0); +} + diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.agghist.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.agghist.d.out new file mode 100644 index 00000000000..d76e4da4b82 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.agghist.d.out @@ -0,0 +1,38 @@ + + + key ------------- Distribution ------------- count + demerit @@@@@| -10 + wtf |@@@@@ 10 + bot |@@@@@@@@@@ 20 + + + key ------------- Distribution ------------- count + SOAP/XML |@@@ 1 + XACML store |@@@@@@@@@@@@@@@@@ 5 + SAML token |@@@@@@@@@@@@@@@@@@@@ 6 + + + key ------------- Distribution ------------- count + parrot @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -100 + non-diet pepsi @@@@@@| -20 + breakfast @@| -5 + +zoomed: + + key ------------- Distribution ------------- count + demerit @@@@@@@@@@| -10 + wtf |@@@@@@@@@@ 10 + bot |@@@@@@@@@@@@@@@@@@@ 20 + + + key ------------- Distribution ------------- count + SOAP/XML |@@@@@@@ 1 + XACML store |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 + SAML token |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 + + + key ------------- Distribution ------------- count + parrot @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -100 + non-diet pepsi @@@@@@@@| -20 + breakfast @@| -5 + diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggpack.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggpack.d new file mode 100644 index 00000000000..c9fdba76c4b --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggpack.d @@ -0,0 +1,53 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright (c) 2013 Joyent, Inc. All rights reserved. + */ + +#pragma D option aggpack +#pragma D option encoding=ascii +#pragma D option quiet + +BEGIN +{ + @x = quantize(1 << 32); + @y[1] = quantize(1); + @z["mumble"] = quantize(1); + @xx["foo", (char)1, (short)2, (long)3] = quantize(1); + + @neg = lquantize(-10, -10, 20, 1, -1); + @neg = lquantize(-5, -10, 20, 1, 1); + @neg = lquantize(0, -10, 20, 1, 1); + + i = 0; +} + +tick-1ms +{ + @a[i] = quantize(0, i); + @a[i] = quantize(1, 100 - i); + i++; +} + +tick-1ms +/i > 100/ +{ + exit(0); +} + +END +{ + setopt("aggzoom", "true"); + printa(@neg); + setopt("aggzoom", "false"); + printa(@neg); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggpack.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggpack.d.out new file mode 100644 index 00000000000..5300ebdbe93 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggpack.d.out @@ -0,0 +1,124 @@ + + + min .--------------------------------. max | count + < -10 : V X X : >= 20 | 1 + + + min .--------------------------------. max | count + < -10 : v x x : >= 20 | 1 + + + min .---. max | count + 2147483648 : X : 8589934592 | 1 + + key min .---. max | count + 1 0 : X : 2 | 1 + + key min .---. max | count + mumble 0 : X : 2 | 1 + + key min .---. max | count + foo 1 2 3 0 : X : 2 | 1 + + key min .---. max | count + 100 0 :X : 2 | 100 + 99 0 :X_ : 2 | 100 + 98 0 :X_ : 2 | 100 + 97 0 :X_ : 2 | 100 + 96 0 :X_ : 2 | 100 + 95 0 :X_ : 2 | 100 + 94 0 :X_ : 2 | 100 + 93 0 :X_ : 2 | 100 + 92 0 :X_ : 2 | 100 + 91 0 :X_ : 2 | 100 + 90 0 :X_ : 2 | 100 + 89 0 :X_ : 2 | 100 + 88 0 :X_ : 2 | 100 + 87 0 :X_ : 2 | 100 + 86 0 :X_ : 2 | 100 + 85 0 :X_ : 2 | 100 + 84 0 :X_ : 2 | 100 + 83 0 :X_ : 2 | 100 + 82 0 :X_ : 2 | 100 + 81 0 :X_ : 2 | 100 + 80 0 :X_ : 2 | 100 + 79 0 :X_ : 2 | 100 + 78 0 :xx : 2 | 100 + 77 0 :xx : 2 | 100 + 76 0 :xx : 2 | 100 + 75 0 :xx : 2 | 100 + 74 0 :xx : 2 | 100 + 73 0 :xx : 2 | 100 + 72 0 :xx : 2 | 100 + 71 0 :xx : 2 | 100 + 70 0 :xx : 2 | 100 + 69 0 :xx : 2 | 100 + 68 0 :xx : 2 | 100 + 67 0 :xx : 2 | 100 + 66 0 :xx : 2 | 100 + 65 0 :xx : 2 | 100 + 64 0 :xx : 2 | 100 + 63 0 :xx : 2 | 100 + 62 0 :xx : 2 | 100 + 61 0 :xx : 2 | 100 + 60 0 :xx : 2 | 100 + 59 0 :xx : 2 | 100 + 58 0 :xx : 2 | 100 + 57 0 :xx : 2 | 100 + 56 0 :xx : 2 | 100 + 55 0 :xx : 2 | 100 + 54 0 :xx : 2 | 100 + 53 0 :xx : 2 | 100 + 52 0 :xx : 2 | 100 + 51 0 :xx : 2 | 100 + 50 0 :xx : 2 | 100 + 49 0 :xx : 2 | 100 + 48 0 :xx : 2 | 100 + 47 0 :xx : 2 | 100 + 46 0 :xx : 2 | 100 + 45 0 :xx : 2 | 100 + 44 0 :xx : 2 | 100 + 43 0 :xx : 2 | 100 + 42 0 :xx : 2 | 100 + 41 0 :xx : 2 | 100 + 40 0 :xx : 2 | 100 + 39 0 :xx : 2 | 100 + 38 0 :xx : 2 | 100 + 37 0 :xx : 2 | 100 + 36 0 :xx : 2 | 100 + 35 0 :xx : 2 | 100 + 34 0 :xx : 2 | 100 + 33 0 :xx : 2 | 100 + 32 0 :xx : 2 | 100 + 31 0 :xx : 2 | 100 + 30 0 :xx : 2 | 100 + 29 0 :xx : 2 | 100 + 28 0 :xx : 2 | 100 + 27 0 :xx : 2 | 100 + 26 0 :xx : 2 | 100 + 25 0 :xx : 2 | 100 + 24 0 :xx : 2 | 100 + 23 0 :xx : 2 | 100 + 22 0 :xx : 2 | 100 + 21 0 :_X : 2 | 100 + 20 0 :_X : 2 | 100 + 19 0 :_X : 2 | 100 + 18 0 :_X : 2 | 100 + 17 0 :_X : 2 | 100 + 16 0 :_X : 2 | 100 + 15 0 :_X : 2 | 100 + 14 0 :_X : 2 | 100 + 13 0 :_X : 2 | 100 + 12 0 :_X : 2 | 100 + 11 0 :_X : 2 | 100 + 10 0 :_X : 2 | 100 + 9 0 :_X : 2 | 100 + 8 0 :_X : 2 | 100 + 7 0 :_X : 2 | 100 + 6 0 :_X : 2 | 100 + 5 0 :_X : 2 | 100 + 4 0 :_X : 2 | 100 + 3 0 :_X : 2 | 100 + 2 0 :_X : 2 | 100 + 1 0 :_X : 2 | 100 + 0 0 : X : 2 | 100 diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggpackbanner.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggpackbanner.ksh new file mode 100644 index 00000000000..f055a08c13e --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggpackbanner.ksh @@ -0,0 +1,75 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2013 Joyent, Inc. All rights reserved. +# + +let width=8 + +function outputchar +{ + banner $3 | /bin/nawk -v line=$1 -v pos=$2 -v width=$width '{ \ + for (i = 1; i <= length($0); i++) { \ + if (substr($0, i, 1) == " ") \ + continue; \ + printf("\t@letter%d[%d] = lquantize(%d, 0, 40, 1);\n", \ + line, NR, i + (pos * width)); + } \ + }' +} + +function outputstr +{ + let pos=0; + let line=0 + + printf "#pragma D option aggpack\n#pragma D option aggsortkey\n" + + printf "BEGIN\n{\n" + for c in `echo "$1" | /bin/nawk '{ \ + for (i = 1; i <= length($0); i++) { \ + c = substr($0, i, 1); \ + printf("%s\n", c == " " ? "space" : \ + c == "\n" ? "newline" : c); \ + } \ + }'`; do + if [[ "$c" == "space" ]]; then + let line=line+1 + let pos=0 + continue + fi + + outputchar $line $pos $c + let pos=pos+1 + done + + let i=0 + + while [[ $i -le $line ]]; do + printf "\tprinta(@letter%d);\n" $i + let i=i+1 + done + printf "\texit(0);\n}\n" +} + +dtrace -qs /dev/stdin -x encoding=utf8 <= 40 | 6 + 3 < 0 : ▂ ▂ ▂ ▂ ▂ ▂ : >= 40 | 6 + 4 < 0 : ▂ ▂ ▂▂▂▂▂▂ ▂ : >= 40 | 9 + 5 < 0 : ▂ ▂▂ ▂ ▂ ▂ ▂ : >= 40 | 7 + 6 < 0 : ▂▂ ▂▂ ▂ ▂ ▂ : >= 40 | 7 + 7 < 0 : ▂ ▂ ▂ ▂ ▂ : >= 40 | 5 + + + key min .------------------------------------------. max | count + 2 < 0 : ▂ ▂ ▂ ▂ ▂▂▂▂ ▂▂▂▂▂ : >= 40 | 13 + 3 < 0 : ▂▂ ▂▂ ▂ ▂ ▂ ▂ : >= 40 | 8 + 4 < 0 : ▂ ▂▂ ▂ ▂ ▂ ▂▂▂▂ ▂ : >= 40 | 11 + 5 < 0 : ▂ ▂ ▂ ▂ ▂ ▂ : >= 40 | 6 + 6 < 0 : ▂ ▂ ▂ ▂ ▂ ▂ ▂ : >= 40 | 7 + 7 < 0 : ▂ ▂ ▂▂▂▂ ▂▂▂▂ ▂ : >= 40 | 11 + + + key min .------------------------------------------. max | count + 2 < 0 : █ : >= 40 | 1 + 3 < 0 : █ : >= 40 | 1 + 4 < 0 : █ : >= 40 | 1 + 5 < 0 : █ : >= 40 | 1 + 6 < 0 : █ : >= 40 | 1 + 7 < 0 : █ : >= 40 | 1 + + + key min .------------------------------------------. max | count + 2 < 0 : ▂▂▂▂▂ ▂▂▂▂ : >= 40 | 9 + 3 < 0 : ▃ ▃ ▃ ▃ : >= 40 | 4 + 4 < 0 : ▃ ▃ ▃ ▃ : >= 40 | 4 + 5 < 0 : ▃ ▃ ▃ ▃ : >= 40 | 4 + 6 < 0 : ▃ ▃ ▃ ▃ : >= 40 | 4 + 7 < 0 : ▂▂▂▂▂ ▂▂▂▂ : >= 40 | 9 + + + key min .------------------------------------------. max | count + 2 < 0 : ▂▂▂▂▂ ▂ ▂ ▂ ▂▂▂▂ : >= 40 | 12 + 3 < 0 : ▂ ▂ ▂ ▂ ▂ : >= 40 | 5 + 4 < 0 : ▂ ▂▂▂▂▂▂ ▂ ▂▂▂▂ : >= 40 | 12 + 5 < 0 : ▂ ▂ ▂ ▂ ▂ : >= 40 | 5 + 6 < 0 : ▂ ▂ ▂ ▂ ▂ ▂ : >= 40 | 6 + 7 < 0 : ▂ ▂ ▂ ▂ ▂▂▂▂ : >= 40 | 8 + + + + key min .------------------------------------------. max | count + 2 < 0 : X : >= 40 | 1 + 3 < 0 : X : >= 40 | 1 + 4 < 0 : X : >= 40 | 1 + 5 < 0 : X : >= 40 | 1 + 6 < 0 : X : >= 40 | 1 + 7 < 0 : X : >= 40 | 1 + + + key min .------------------------------------------. max | count + 2 < 0 : XX X X : >= 40 | 4 + 3 < 0 : X X XX XX : >= 40 | 6 + 4 < 0 : X X X XX X : >= 40 | 6 + 5 < 0 : XXXXXX X X : >= 40 | 8 + 6 < 0 : X X X X : >= 40 | 4 + 7 < 0 : X X X X : >= 40 | 4 + + + key min .------------------------------------------. max | count + 2 < 0 : X X XXXX XXXXX : >= 40 | 11 + 3 < 0 : XX X X X X : >= 40 | 6 + 4 < 0 : X X X X X X : >= 40 | 6 + 5 < 0 : X X X X X X : >= 40 | 6 + 6 < 0 : X XX X X X : >= 40 | 6 + 7 < 0 : X X XXXX X : >= 40 | 7 + + + key min .------------------------------------------. max | count + 2 < 0 : X X XXXXXX X X : >= 40 | 10 + 3 < 0 : X X X X X : >= 40 | 5 + 4 < 0 : X X XXXXX X X : >= 40 | 9 + 5 < 0 : X XX X X X X : >= 40 | 7 + 6 < 0 : XX XX X X X : >= 40 | 7 + 7 < 0 : X X XXXXXX XXXXXX XXXXXX : >= 40 | 20 + + + + key min .------------------------------------------. max | count + 2 < 0 : ████ ██████ █ █ █████ : >= 40 | 17 + 3 < 0 : █ █ ██ █ █ █ : >= 40 | 7 + 4 < 0 : ████ █████ █ █ █ █ █ : >= 40 | 14 + 5 < 0 : █ █ █ █ █ █ █ : >= 40 | 7 + 6 < 0 : █ █ █ █ ██ █ █ : >= 40 | 8 + 7 < 0 : ████ ██████ █ █ █████ : >= 40 | 17 + + + key min .------------------------------------------. max | count + 2 < 0 : █ █ ██████ █ █████ : >= 40 | 14 + 3 < 0 : █ █ █ █ █ █ : >= 40 | 6 + 4 < 0 : ██████ █████ █ █ █ : >= 40 | 14 + 5 < 0 : █ █ █ █ █████ : >= 40 | 9 + 6 < 0 : █ █ █ █ █ : >= 40 | 5 + 7 < 0 : █ █ ██████ ██████ █ : >= 40 | 15 + diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggpackzoom.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggpackzoom.d new file mode 100644 index 00000000000..2f297e25939 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggpackzoom.d @@ -0,0 +1,43 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright (c) 2013 Joyent, Inc. All rights reserved. + */ + +#pragma D option encoding=ascii +#pragma D option quiet + +tick-1ms +/i++ < 30/ +{ + @[1] = lquantize(i, 0, 40, 1, 1000); + @[2] = lquantize(i, 0, 40, 1, 1000); + @[3] = lquantize(i, 0, 40, 1, 1000); +} + +tick-1ms +/i == 40/ +{ + @[1] = lquantize(0, 0, 40, 1, 1); + @[1] = lquantize(i, 0, 40, 1, 2000); + @[2] = lquantize(0, 0, 40, 1, 1); + @[2] = lquantize(i, 0, 40, 1, 2000); + @[3] = lquantize(0, 0, 40, 1, 1); + @[3] = lquantize(i, 0, 40, 1, 2000); + + printa(@); + setopt("aggpack"); + printa(@); + setopt("aggzoom"); + printa(@); + exit(0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggpackzoom.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggpackzoom.d.out new file mode 100644 index 00000000000..a22a2a4a173 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggpackzoom.d.out @@ -0,0 +1,149 @@ + + 1 + value ------------- Distribution ------------- count + < 0 | 0 + 0 | 1 + 1 |@ 1000 + 2 |@ 1000 + 3 |@ 1000 + 4 |@ 1000 + 5 |@ 1000 + 6 |@ 1000 + 7 |@ 1000 + 8 |@ 1000 + 9 |@ 1000 + 10 |@ 1000 + 11 |@ 1000 + 12 |@ 1000 + 13 |@ 1000 + 14 |@ 1000 + 15 |@ 1000 + 16 |@ 1000 + 17 |@ 1000 + 18 |@ 1000 + 19 |@ 1000 + 20 |@ 1000 + 21 |@ 1000 + 22 |@ 1000 + 23 |@ 1000 + 24 |@ 1000 + 25 |@ 1000 + 26 |@ 1000 + 27 |@ 1000 + 28 |@ 1000 + 29 |@ 1000 + 30 |@ 1000 + 31 | 0 + 32 | 0 + 33 | 0 + 34 | 0 + 35 | 0 + 36 | 0 + 37 | 0 + 38 | 0 + 39 | 0 + >= 40 |@@ 2000 + + 2 + value ------------- Distribution ------------- count + < 0 | 0 + 0 | 1 + 1 |@ 1000 + 2 |@ 1000 + 3 |@ 1000 + 4 |@ 1000 + 5 |@ 1000 + 6 |@ 1000 + 7 |@ 1000 + 8 |@ 1000 + 9 |@ 1000 + 10 |@ 1000 + 11 |@ 1000 + 12 |@ 1000 + 13 |@ 1000 + 14 |@ 1000 + 15 |@ 1000 + 16 |@ 1000 + 17 |@ 1000 + 18 |@ 1000 + 19 |@ 1000 + 20 |@ 1000 + 21 |@ 1000 + 22 |@ 1000 + 23 |@ 1000 + 24 |@ 1000 + 25 |@ 1000 + 26 |@ 1000 + 27 |@ 1000 + 28 |@ 1000 + 29 |@ 1000 + 30 |@ 1000 + 31 | 0 + 32 | 0 + 33 | 0 + 34 | 0 + 35 | 0 + 36 | 0 + 37 | 0 + 38 | 0 + 39 | 0 + >= 40 |@@ 2000 + + 3 + value ------------- Distribution ------------- count + < 0 | 0 + 0 | 1 + 1 |@ 1000 + 2 |@ 1000 + 3 |@ 1000 + 4 |@ 1000 + 5 |@ 1000 + 6 |@ 1000 + 7 |@ 1000 + 8 |@ 1000 + 9 |@ 1000 + 10 |@ 1000 + 11 |@ 1000 + 12 |@ 1000 + 13 |@ 1000 + 14 |@ 1000 + 15 |@ 1000 + 16 |@ 1000 + 17 |@ 1000 + 18 |@ 1000 + 19 |@ 1000 + 20 |@ 1000 + 21 |@ 1000 + 22 |@ 1000 + 23 |@ 1000 + 24 |@ 1000 + 25 |@ 1000 + 26 |@ 1000 + 27 |@ 1000 + 28 |@ 1000 + 29 |@ 1000 + 30 |@ 1000 + 31 | 0 + 32 | 0 + 33 | 0 + 34 | 0 + 35 | 0 + 36 | 0 + 37 | 0 + 38 | 0 + 39 | 0 + >= 40 |@@ 2000 + + + + key min .------------------------------------------. max | count + 1 < 0 : _______________________________ _: >= 40 | 32001 + 2 < 0 : _______________________________ _: >= 40 | 32001 + 3 < 0 : _______________________________ _: >= 40 | 32001 + + + key min .------------------------------------------. max | count + 1 < 0 : _xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx X: >= 40 | 32001 + 2 < 0 : _xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx X: >= 40 | 32001 + 3 < 0 : _xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx X: >= 40 | 32001 + diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggzoom.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggzoom.d new file mode 100644 index 00000000000..f237d26272f --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggzoom.d @@ -0,0 +1,35 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright (c) 2013 Joyent, Inc. All rights reserved. + */ + +#pragma D option encoding=ascii +#pragma D option quiet + +tick-1ms +/i++ < 90/ +{ + @ = lquantize(i, 0, 100, 1, 1000); +} + +tick-1ms +/i == 100/ +{ + @ = lquantize(i++, 0, 100, 1, 2000); + @ = lquantize(i++, 0, 100, 1, 3000); + + printa(@); + setopt("aggzoom"); + printa(@); + exit(0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggzoom.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggzoom.d.out new file mode 100644 index 00000000000..acddf7f731a --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.aggzoom.d.out @@ -0,0 +1,211 @@ + + + value ------------- Distribution ------------- count + 0 | 0 + 1 | 1000 + 2 | 1000 + 3 | 1000 + 4 | 1000 + 5 | 1000 + 6 | 1000 + 7 | 1000 + 8 | 1000 + 9 | 1000 + 10 | 1000 + 11 | 1000 + 12 | 1000 + 13 | 1000 + 14 | 1000 + 15 | 1000 + 16 | 1000 + 17 | 1000 + 18 | 1000 + 19 | 1000 + 20 | 1000 + 21 | 1000 + 22 | 1000 + 23 | 1000 + 24 | 1000 + 25 | 1000 + 26 | 1000 + 27 | 1000 + 28 | 1000 + 29 | 1000 + 30 | 1000 + 31 | 1000 + 32 | 1000 + 33 | 1000 + 34 | 1000 + 35 | 1000 + 36 | 1000 + 37 | 1000 + 38 | 1000 + 39 | 1000 + 40 | 1000 + 41 | 1000 + 42 | 1000 + 43 | 1000 + 44 | 1000 + 45 | 1000 + 46 | 1000 + 47 | 1000 + 48 | 1000 + 49 | 1000 + 50 | 1000 + 51 | 1000 + 52 | 1000 + 53 | 1000 + 54 | 1000 + 55 | 1000 + 56 | 1000 + 57 | 1000 + 58 | 1000 + 59 | 1000 + 60 | 1000 + 61 | 1000 + 62 | 1000 + 63 | 1000 + 64 | 1000 + 65 | 1000 + 66 | 1000 + 67 | 1000 + 68 | 1000 + 69 | 1000 + 70 | 1000 + 71 | 1000 + 72 | 1000 + 73 | 1000 + 74 | 1000 + 75 | 1000 + 76 | 1000 + 77 | 1000 + 78 | 1000 + 79 | 1000 + 80 | 1000 + 81 | 1000 + 82 | 1000 + 83 | 1000 + 84 | 1000 + 85 | 1000 + 86 | 1000 + 87 | 1000 + 88 | 1000 + 89 | 1000 + 90 | 1000 + 91 | 0 + 92 | 0 + 93 | 0 + 94 | 0 + 95 | 0 + 96 | 0 + 97 | 0 + 98 | 0 + 99 | 0 + >= 100 |@@ 5000 + + + + value ------------- Distribution ------------- count + 0 | 0 + 1 |@@@@@@@@ 1000 + 2 |@@@@@@@@ 1000 + 3 |@@@@@@@@ 1000 + 4 |@@@@@@@@ 1000 + 5 |@@@@@@@@ 1000 + 6 |@@@@@@@@ 1000 + 7 |@@@@@@@@ 1000 + 8 |@@@@@@@@ 1000 + 9 |@@@@@@@@ 1000 + 10 |@@@@@@@@ 1000 + 11 |@@@@@@@@ 1000 + 12 |@@@@@@@@ 1000 + 13 |@@@@@@@@ 1000 + 14 |@@@@@@@@ 1000 + 15 |@@@@@@@@ 1000 + 16 |@@@@@@@@ 1000 + 17 |@@@@@@@@ 1000 + 18 |@@@@@@@@ 1000 + 19 |@@@@@@@@ 1000 + 20 |@@@@@@@@ 1000 + 21 |@@@@@@@@ 1000 + 22 |@@@@@@@@ 1000 + 23 |@@@@@@@@ 1000 + 24 |@@@@@@@@ 1000 + 25 |@@@@@@@@ 1000 + 26 |@@@@@@@@ 1000 + 27 |@@@@@@@@ 1000 + 28 |@@@@@@@@ 1000 + 29 |@@@@@@@@ 1000 + 30 |@@@@@@@@ 1000 + 31 |@@@@@@@@ 1000 + 32 |@@@@@@@@ 1000 + 33 |@@@@@@@@ 1000 + 34 |@@@@@@@@ 1000 + 35 |@@@@@@@@ 1000 + 36 |@@@@@@@@ 1000 + 37 |@@@@@@@@ 1000 + 38 |@@@@@@@@ 1000 + 39 |@@@@@@@@ 1000 + 40 |@@@@@@@@ 1000 + 41 |@@@@@@@@ 1000 + 42 |@@@@@@@@ 1000 + 43 |@@@@@@@@ 1000 + 44 |@@@@@@@@ 1000 + 45 |@@@@@@@@ 1000 + 46 |@@@@@@@@ 1000 + 47 |@@@@@@@@ 1000 + 48 |@@@@@@@@ 1000 + 49 |@@@@@@@@ 1000 + 50 |@@@@@@@@ 1000 + 51 |@@@@@@@@ 1000 + 52 |@@@@@@@@ 1000 + 53 |@@@@@@@@ 1000 + 54 |@@@@@@@@ 1000 + 55 |@@@@@@@@ 1000 + 56 |@@@@@@@@ 1000 + 57 |@@@@@@@@ 1000 + 58 |@@@@@@@@ 1000 + 59 |@@@@@@@@ 1000 + 60 |@@@@@@@@ 1000 + 61 |@@@@@@@@ 1000 + 62 |@@@@@@@@ 1000 + 63 |@@@@@@@@ 1000 + 64 |@@@@@@@@ 1000 + 65 |@@@@@@@@ 1000 + 66 |@@@@@@@@ 1000 + 67 |@@@@@@@@ 1000 + 68 |@@@@@@@@ 1000 + 69 |@@@@@@@@ 1000 + 70 |@@@@@@@@ 1000 + 71 |@@@@@@@@ 1000 + 72 |@@@@@@@@ 1000 + 73 |@@@@@@@@ 1000 + 74 |@@@@@@@@ 1000 + 75 |@@@@@@@@ 1000 + 76 |@@@@@@@@ 1000 + 77 |@@@@@@@@ 1000 + 78 |@@@@@@@@ 1000 + 79 |@@@@@@@@ 1000 + 80 |@@@@@@@@ 1000 + 81 |@@@@@@@@ 1000 + 82 |@@@@@@@@ 1000 + 83 |@@@@@@@@ 1000 + 84 |@@@@@@@@ 1000 + 85 |@@@@@@@@ 1000 + 86 |@@@@@@@@ 1000 + 87 |@@@@@@@@ 1000 + 88 |@@@@@@@@ 1000 + 89 |@@@@@@@@ 1000 + 90 |@@@@@@@@ 1000 + 91 | 0 + 92 | 0 + 93 | 0 + 94 | 0 + 95 | 0 + 96 | 0 + 97 | 0 + 98 | 0 + 99 | 0 + >= 100 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5000 + + diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.subr.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.subr.d index d508596a97f..9b02e982fe0 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.subr.d +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.subr.d @@ -22,6 +22,7 @@ /* * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright (c) 2012, Joyent, Inc. All rights reserved. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -97,6 +98,9 @@ INTFUNC(ntohll(0x1234567890abcdefL)) STRFUNC(inet_ntoa((ipaddr_t *)alloca(sizeof (ipaddr_t)))) STRFUNC(inet_ntoa6((in6_addr_t *)alloca(sizeof (in6_addr_t)))) STRFUNC(inet_ntop(AF_INET, (void *)alloca(sizeof (ipaddr_t)))) +INTFUNC(getf(0)) +INTFUNC(strtoll("0x12EE5D5", 16)) +STRFUNC(json("{\"systemtap\": false}", "systemtap")) BEGIN /subr == DIF_SUBR_MAX + 1/ diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroModuleProbes.d.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroModuleProbes.d.ksh index c34a4aabddf..dbea8ef73d9 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroModuleProbes.d.ksh +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroModuleProbes.d.ksh @@ -46,7 +46,7 @@ fi dtrace=$1 $dtrace -qZm wassup'{printf("Iamkool");}' \ --qm BEGIN'{printf("I am done"); exit(0);}' +-qm kernel'{printf("I am done"); exit(0);}' status=$? diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.general.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.general.d new file mode 100644 index 00000000000..4600811d95b --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.general.d @@ -0,0 +1,179 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2012, Joyent, Inc. All rights reserved. + */ + +/* + * General functional tests of JSON parser for json(). + */ + +#pragma D option quiet +#pragma D option strsize=1k + +#define TST(name) \ + printf("\ntst |%s|\n", name) +#define IN2(vala, valb) \ + in = strjoin(vala, valb); \ + printf("in |%s|\n", in) +#define IN(val) \ + in = val; \ + printf("in |%s|\n", in) +#define SEL(ss) \ + out = json(in, ss); \ + printf("sel |%s|\nout |%s|\n", ss, \ + out != NULL ? out : "") + +BEGIN +{ + TST("empty array"); + IN("[]"); + SEL("0"); + + TST("one-element array: integer"); + IN("[1]"); + SEL("0"); + SEL("1"); + SEL("100"); + SEL("-1"); + + TST("one-element array: hex integer (not in spec, not supported)"); + IN("[0x1000]"); + SEL("0"); + + TST("one-element array: float"); + IN("[1.5001]"); + SEL("0"); + + TST("one-element array: float + exponent"); + IN("[16.3e10]"); + SEL("0"); + + TST("one-element array: integer + whitespace"); + IN("[ \t 5\t]"); + SEL("0"); + + TST("one-element array: integer + exponent + whitespace"); + IN("[ \t \t 16E10 \t ]"); + SEL("0"); + + TST("one-element array: string"); + IN("[\"alpha\"]"); + SEL("0"); + + TST("alternative first-element indexing"); + IN("[1,5,10,15,20]"); + SEL("[0]"); + SEL("[3]"); + SEL("[4]"); + SEL("[5]"); + + TST("one-element array: object"); + IN("[ { \"first\": true, \"second\": false }]"); + SEL("0.first"); + SEL("0.second"); + SEL("0.third"); + + TST("many-element array: integers"); + IN("[0,1,1,2,3,5,8,13,21,34,55,89,144,233,377]"); + SEL("10"); /* F(10) = 55 */ + SEL("14"); /* F(14) = 377 */ + SEL("19"); + + TST("many-element array: multiple types"); + IN2("[\"string\",32,true,{\"a\":9,\"b\":false},100.3e10,false,200.5,", + "{\"key\":\"val\"},null]"); + SEL("0"); + SEL("0.notobject"); + SEL("1"); + SEL("2"); + SEL("3"); + SEL("3.a"); + SEL("3.b"); + SEL("3.c"); + SEL("4"); + SEL("5"); + SEL("6"); + SEL("7"); + SEL("7.key"); + SEL("7.key.notobject"); + SEL("7.nonexist"); + SEL("8"); + SEL("9"); + + TST("many-element array: multiple types + whitespace"); + IN2("\n[\t\"string\" ,\t32 , true\t,\t {\"a\": 9,\t\"b\": false},\t\t", + "100.3e10, false, 200.5,{\"key\" \t:\n \"val\"},\t\t null ]\t\t"); + SEL("0"); + SEL("0.notobject"); + SEL("1"); + SEL("2"); + SEL("3"); + SEL("3.a"); + SEL("3.b"); + SEL("3.c"); + SEL("4"); + SEL("5"); + SEL("6"); + SEL("7"); + SEL("7.key"); + SEL("7.key.notobject"); + SEL("7.nonexist"); + SEL("8"); + SEL("9"); + + TST("two-element array: various string escape codes"); + IN2("[\"abcd \\\" \\\\ \\/ \\b \\f \\n \\r \\t \\u0000 \\uf00F \", ", + "\"final\"]"); + SEL("0"); + SEL("1"); + + TST("three-element array: broken escape code"); + IN("[\"fine here\", \"dodgey \\u00AZ\", \"wont get here\"]"); + SEL("0"); + SEL("1"); + SEL("2"); + + TST("nested objects"); + IN2("{ \"top\": { \"mid\" : { \"legs\": \"feet\" }, \"number\": 9, ", + "\"array\":[0,1,{\"a\":true,\"bb\":[1,2,false,{\"x\":\"yz\"}]}]}}"); + SEL("top"); + SEL("fargo"); + SEL("top.mid"); + SEL("top.centre"); + SEL("top.mid.legs"); + SEL("top.mid.number"); + SEL("top.mid.array"); + SEL("top.number"); + SEL("top.array"); + SEL("top.array[0]"); + SEL("top.array[1]"); + SEL("top.array[2]"); + SEL("top.array[2].a"); + SEL("top.array[2].b"); + SEL("top.array[2].bb"); + SEL("top.array[2].bb[0]"); + SEL("top.array[2].bb[1]"); + SEL("top.array[2].bb[2]"); + SEL("top.array[2].bb[3]"); + SEL("top.array[2].bb[3].x"); + SEL("top.array[2].bb[3].x.nofurther"); + SEL("top.array[2].bb[4]"); + SEL("top.array[3]"); + + exit(0); +} + +ERROR +{ + exit(1); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.general.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.general.d.out new file mode 100644 index 00000000000..a857ab91d83 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.general.d.out @@ -0,0 +1,218 @@ + +tst |empty array| +in |[]| +sel |0| +out || + +tst |one-element array: integer| +in |[1]| +sel |0| +out |1| +sel |1| +out || +sel |100| +out || +sel |-1| +out || + +tst |one-element array: hex integer (not in spec, not supported)| +in |[0x1000]| +sel |0| +out || + +tst |one-element array: float| +in |[1.5001]| +sel |0| +out |1.5001| + +tst |one-element array: float + exponent| +in |[16.3e10]| +sel |0| +out |16.3e10| + +tst |one-element array: integer + whitespace| +in |[ 5 ]| +sel |0| +out |5| + +tst |one-element array: integer + exponent + whitespace| +in |[ 16E10 ]| +sel |0| +out |16E10| + +tst |one-element array: string| +in |["alpha"]| +sel |0| +out |alpha| + +tst |alternative first-element indexing| +in |[1,5,10,15,20]| +sel |[0]| +out |1| +sel |[3]| +out |15| +sel |[4]| +out |20| +sel |[5]| +out || + +tst |one-element array: object| +in |[ { "first": true, "second": false }]| +sel |0.first| +out |true| +sel |0.second| +out |false| +sel |0.third| +out || + +tst |many-element array: integers| +in |[0,1,1,2,3,5,8,13,21,34,55,89,144,233,377]| +sel |10| +out |55| +sel |14| +out |377| +sel |19| +out || + +tst |many-element array: multiple types| +in |["string",32,true,{"a":9,"b":false},100.3e10,false,200.5,{"key":"val"},null]| +sel |0| +out |string| +sel |0.notobject| +out || +sel |1| +out |32| +sel |2| +out |true| +sel |3| +out |{"a":9,"b":false}| +sel |3.a| +out |9| +sel |3.b| +out |false| +sel |3.c| +out || +sel |4| +out |100.3e10| +sel |5| +out |false| +sel |6| +out |200.5| +sel |7| +out |{"key":"val"}| +sel |7.key| +out |val| +sel |7.key.notobject| +out || +sel |7.nonexist| +out || +sel |8| +out |null| +sel |9| +out || + +tst |many-element array: multiple types + whitespace| +in | +[ "string" , 32 , true , {"a": 9, "b": false}, 100.3e10, false, 200.5,{"key" : + "val"}, null ] | +sel |0| +out |string| +sel |0.notobject| +out || +sel |1| +out |32| +sel |2| +out |true| +sel |3| +out |{"a": 9, "b": false}| +sel |3.a| +out |9| +sel |3.b| +out |false| +sel |3.c| +out || +sel |4| +out |100.3e10| +sel |5| +out |false| +sel |6| +out |200.5| +sel |7| +out |{"key" : + "val"}| +sel |7.key| +out |val| +sel |7.key.notobject| +out || +sel |7.nonexist| +out || +sel |8| +out |null| +sel |9| +out || + +tst |two-element array: various string escape codes| +in |["abcd \" \\ \/ \b \f \n \r \t \u0000 \uf00F ", "final"]| +sel |0| +out |abcd \" \\ \/ \b \f \n \r \t \u0000 \uf00F | +sel |1| +out |final| + +tst |three-element array: broken escape code| +in |["fine here", "dodgey \u00AZ", "wont get here"]| +sel |0| +out |fine here| +sel |1| +out || +sel |2| +out || + +tst |nested objects| +in |{ "top": { "mid" : { "legs": "feet" }, "number": 9, "array":[0,1,{"a":true,"bb":[1,2,false,{"x":"yz"}]}]}}| +sel |top| +out |{ "mid" : { "legs": "feet" }, "number": 9, "array":[0,1,{"a":true,"bb":[1,2,false,{"x":"yz"}]}]}| +sel |fargo| +out || +sel |top.mid| +out |{ "legs": "feet" }| +sel |top.centre| +out || +sel |top.mid.legs| +out |feet| +sel |top.mid.number| +out || +sel |top.mid.array| +out || +sel |top.number| +out |9| +sel |top.array| +out |[0,1,{"a":true,"bb":[1,2,false,{"x":"yz"}]}]| +sel |top.array[0]| +out |0| +sel |top.array[1]| +out |1| +sel |top.array[2]| +out |{"a":true,"bb":[1,2,false,{"x":"yz"}]}| +sel |top.array[2].a| +out |true| +sel |top.array[2].b| +out || +sel |top.array[2].bb| +out |[1,2,false,{"x":"yz"}]| +sel |top.array[2].bb[0]| +out |1| +sel |top.array[2].bb[1]| +out |2| +sel |top.array[2].bb[2]| +out |false| +sel |top.array[2].bb[3]| +out |{"x":"yz"}| +sel |top.array[2].bb[3].x| +out |yz| +sel |top.array[2].bb[3].x.nofurther| +out || +sel |top.array[2].bb[4]| +out || +sel |top.array[3]| +out || + diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.strsize.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.strsize.d new file mode 100644 index 00000000000..6aa50b9ad02 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.strsize.d @@ -0,0 +1,51 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2012, Joyent, Inc. All rights reserved. + */ + +/* + * ASSERTION: + * json() run time must be bounded above by strsize. This test makes strsize + * small and deliberately overflows it to prove we bail and return NULL in + * the event that we run off the end of the string. + * + */ + +#pragma D option quiet +#pragma D option strsize=18 + +BEGIN +{ + in = "{\"a\": 1024}"; /* length == 19 */ + out = json(in, "a"); + printf("|%s|\n%s\n\n", in, out != NULL ? out : ""); + + in = "{\"a\": 1024}"; /* length == 11 */ + out = json(in, "a"); + printf("|%s|\n%s\n\n", in, out != NULL ? out : ""); + + in = "{\"a\":false,\"b\":true}"; /* length == 20 */ + out = json(in, "b"); + printf("|%s|\n%s\n\n", in, out != NULL ? out : ""); + + in = "{\"a\":false,\"b\":20}"; /* length == 18 */ + out = json(in, "b"); + printf("|%s|\n%s\n\n", in, out != NULL ? out : ""); + + exit(0); +} + +ERROR +{ + exit(1); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.strsize.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.strsize.d.out new file mode 100644 index 00000000000..7f1d79b6fed --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.strsize.d.out @@ -0,0 +1,13 @@ +|{"a": 1024| + + +|{"a": 1024}| +1024 + +|{"a":false,"b":tru| + + +|{"a":false,"b":20}| +20 + + diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.c new file mode 100644 index 00000000000..307106d903b --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.c @@ -0,0 +1,61 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2012 (c), Joyent, Inc. All rights reserved. + */ + +#include +#include "usdt.h" + +#define FMT "{" \ + " \"sizes\": [ \"first\", 2, %f ]," \ + " \"index\": %d," \ + " \"facts\": {" \ + " \"odd\": \"%s\"," \ + " \"even\": \"%s\"" \ + " }," \ + " \"action\": \"%s\"" \ + "}\n" + +int +waiting(volatile int *a) +{ + return (*a); +} + +int +main(int argc, char **argv) +{ + volatile int a = 0; + int idx; + double size = 250.5; + + while (waiting(&a) == 0) + continue; + + for (idx = 0; idx < 10; idx++) { + char *odd, *even, *json, *action; + + size *= 1.78; + odd = idx % 2 == 1 ? "true" : "false"; + even = idx % 2 == 0 ? "true" : "false"; + action = idx == 7 ? "ignore" : "print"; + + asprintf(&json, FMT, size, idx, odd, even, action); + BUNYAN_FAKE_LOG_DEBUG(json); + free(json); + } + + BUNYAN_FAKE_LOG_DEBUG("{\"finished\": true}"); + + return (0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.d new file mode 100644 index 00000000000..f0fbdd5caba --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.d @@ -0,0 +1,65 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright (c) 2012, Joyent, Inc. All rights reserved. + */ + +#pragma D option strsize=4k +#pragma D option quiet +#pragma D option destructive + +/* + * This test reads a JSON string from a USDT probe, roughly simulating the + * primary motivating use case for the json() subroutine: filtering + * JSON-formatted log messages from a logging subsystem like node-bunyan. + */ + +pid$1:a.out:waiting:entry +{ + this->value = (int *)alloca(sizeof (int)); + *this->value = 1; + copyout(this->value, arg0, sizeof (int)); +} + +bunyan*$1:::log-* +{ + this->j = copyinstr(arg0); +} + +bunyan*$1:::log-* +/json(this->j, "finished") == NULL && json(this->j, "action") != "ignore"/ +{ + this->index = strtoll(json(this->j, "index")); + this->size = json(this->j, "sizes[2]"); + this->odd = json(this->j, "facts.odd"); + this->even = json(this->j, "facts.even"); + printf("[%d] sz %s odd %s even %s\n", this->index, this->size, + this->odd, this->even); +} + +bunyan*$1:::log-* +/json(this->j, "finished") != NULL/ +{ + printf("FINISHED!\n"); + exit(0); +} + +tick-10s +{ + printf("ERROR: Timed out before finish message!\n"); + exit(1); +} + +ERROR +{ + exit(1); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.d.out new file mode 100644 index 00000000000..c7f58bb535d --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.d.out @@ -0,0 +1,11 @@ +[0] sz 445.890000 odd false even true +[1] sz 793.684200 odd true even false +[2] sz 1412.757876 odd false even true +[3] sz 2514.709019 odd true even false +[4] sz 4476.182054 odd false even true +[5] sz 7967.604057 odd true even false +[6] sz 14182.335221 odd false even true +[8] sz 44935.310914 odd false even true +[9] sz 79984.853427 odd true even false +FINISHED! + diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/usdt.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/usdt.d new file mode 100644 index 00000000000..1a4fc87f60f --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/usdt.d @@ -0,0 +1,27 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2012, Joyent, Inc. All rights reserved. + */ + +/* + * Sets up a fake node-bunyan-like USDT provider for use from C. + */ + +provider bunyan_fake { + probe log__trace(char *msg); + probe log__debug(char *msg); + probe log__info(char *msg); + probe log__warn(char *msg); + probe log__error(char *msg); + probe log__fatal(char *msg); +}; diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.fds.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.fds.ksh new file mode 100644 index 00000000000..a5aa27137ef --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.fds.ksh @@ -0,0 +1,91 @@ +# +# 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) 2012, Joyent, Inc. All rights reserved. +# + +tmpin=/tmp/tst.fds.$$.d +tmpout1=/tmp/tst.fds.$$.out1 +tmpout2=/tmp/tst.fds.$$.out2 + +cat > $tmpin < $tmpout2 +mv $tmpout2 $tmpout1 + +# +# And now with only dtrace_proc and dtrace_user -- the output should be +# identical. +# +ppriv -s A=basic,dtrace_proc,dtrace_user $$ + +/usr/sbin/dtrace -q -Cs /dev/stdin < $tmpin > $tmpout2 + +echo ">>> $tmpout1" +cat $tmpout1 + +echo ">>> $tmpout2" +cat $tmpout2 + +rval=0 + +if ! cmp $tmpout1 $tmpout2 ; then + rval=1 +fi + +rm $tmpout1 $tmpout2 $tmpin +exit $rval diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.func_access.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.func_access.ksh index ae4934cdeb3..da9bb4c6c6b 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.func_access.ksh +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.func_access.ksh @@ -22,8 +22,8 @@ # # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. +# Copyright (c) 2012, Joyent, Inc. All rights reserved. # -#ident "%Z%%M% %I% %E% SMI" ppriv -s A=basic,dtrace_proc,dtrace_user $$ @@ -31,7 +31,7 @@ ppriv -s A=basic,dtrace_proc,dtrace_user $$ BEGIN { errorcount = 0; - expected_errorcount = 23; + expected_errorcount = 27; } BEGIN { trace(mutex_owned(&`pidlock)); } @@ -55,6 +55,8 @@ BEGIN { trace(strtok(`initname, "/")); } BEGIN { trace(strtok(NULL, "/")); } BEGIN { trace(strtok("foo/bar", `initname)); } BEGIN { trace(strtok(NULL, `initname)); } +BEGIN { trace(strtoll(`initname)); } +BEGIN { trace(strtoll(`initname, 10)); } BEGIN { trace(substr(`initname, 2, 3)); } BEGIN { trace(ddi_pathname(`top_devinfo, 1)); } @@ -63,6 +65,9 @@ BEGIN { trace(strjoin("foo", `initname)); } BEGIN { trace(dirname(`initname)); } BEGIN { trace(cleanpath(`initname)); } +BEGIN { j = "{\"/sbin/init\":\"uh oh\"}"; trace(json(j, `initname)); } +BEGIN { trace(json(`initname, "x")); } + ERROR { errorcount++; } diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.getf.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.getf.ksh new file mode 100644 index 00000000000..7dbb83fba94 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.getf.ksh @@ -0,0 +1,98 @@ +# +# 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) 2012, Joyent, Inc. All rights reserved. +# + +ppriv -s A=basic,dtrace_proc,dtrace_user $$ + +/usr/sbin/dtrace -q -Cs /dev/stdin <fp = getf(0); errmsg = "can't read field"; \ + printf("field: "); trace(this->fp->field); printf("\n"); } + +#define CANTREAD(field) \ + BEGIN { errmsg = ""; this->fp = getf(0); trace(this->fp->field); \ + printf("\nable to successfully read field!"); exit(1); } + +CANREAD(f_flag) +CANREAD(f_flag2) +CANREAD(f_vnode) +CANREAD(f_offset) +CANREAD(f_cred) +CANREAD(f_audit_data) +CANREAD(f_count) + +/* + * We can potentially read parts of our cred, but we can't dereference + * through cr_zone. + */ +CANTREAD(f_cred->cr_zone->zone_id) + +CANREAD(f_vnode->v_path) +CANREAD(f_vnode->v_op) +CANREAD(f_vnode->v_op->vnop_name) + +CANTREAD(f_vnode->v_flag) +CANTREAD(f_vnode->v_count) +CANTREAD(f_vnode->v_pages) +CANTREAD(f_vnode->v_type) +CANTREAD(f_vnode->v_vfsmountedhere) +CANTREAD(f_vnode->v_op->vop_open) + +BEGIN +{ + errmsg = ""; + this->fp = getf(0); + this->fp2 = getf(1); + + trace(this->fp->f_vnode); + printf("\nable to successfully read this->fp!"); + exit(1); +} + +BEGIN +{ + errmsg = ""; + this->fp = getf(0); +} + +BEGIN +{ + trace(this->fp->f_vnode); + printf("\nable to successfully read this->fp from prior clause!"); +} + +BEGIN +{ + exit(0); +} + +ERROR +/errmsg != ""/ +{ + printf("fatal error: %s", errmsg); + exit(1); +} + +EOF diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.procpriv.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.procpriv.ksh new file mode 100644 index 00000000000..7022566391f --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.procpriv.ksh @@ -0,0 +1,138 @@ +# +# 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) 2012, Joyent, Inc. All rights reserved. +# + +ppriv -s A=basic,dtrace_proc,dtrace_user $$ + +# +# When we have dtrace_proc (but lack dtrace_kernel), we expect to be able to +# read certain curpsinfo/curlwpsinfo/curcpu fields even though they require +# reading in-kernel state. However, there are other fields in these translated +# structures that we know we shouldn't be able to read, as they require reading +# in-kernel state that we cannot read with only dtrace_proc. Finally, there +# are a few fields that we may or may not be able to read depending on the +# specifics of context. This test therefore asserts that we can read what we +# think we should be able to, that we can't read what we think we shouldn't be +# able to, and (for purposes of completeness) that we are indifferent about +# what we cannot assert one way or the other. +# +/usr/sbin/dtrace -q -Cs /dev/stdin <field); printf("\n"); } + +#define CANTREAD(what, field) \ + BEGIN { errmsg = ""; trace(what->field); \ + printf("\nable to successfully read field from what!"); exit(1); } + +#define MIGHTREAD(what, field) \ + BEGIN { errmsg = ""; printf("field: "); trace(what->field); printf("\n"); } + +#define CANREADVAR(vname) \ + BEGIN { errmsg = "can't read vname"; printf("vname: "); \ + trace(vname); printf("\n"); } + +#define CANTREADVAR(vname) \ + BEGIN { errmsg = ""; trace(vname); \ + printf("\nable to successfully read vname!"); exit(1); } + +#define MIGHTREADVAR(vname) \ + BEGIN { errmsg = ""; printf("vname: "); trace(vname); printf("\n"); } + +CANREAD(curpsinfo, pr_pid) +CANREAD(curpsinfo, pr_nlwp) +CANREAD(curpsinfo, pr_ppid) +CANREAD(curpsinfo, pr_uid) +CANREAD(curpsinfo, pr_euid) +CANREAD(curpsinfo, pr_gid) +CANREAD(curpsinfo, pr_egid) +CANREAD(curpsinfo, pr_addr) +CANREAD(curpsinfo, pr_start) +CANREAD(curpsinfo, pr_fname) +CANREAD(curpsinfo, pr_psargs) +CANREAD(curpsinfo, pr_argc) +CANREAD(curpsinfo, pr_argv) +CANREAD(curpsinfo, pr_envp) +CANREAD(curpsinfo, pr_dmodel) + +/* + * If our p_pgidp points to the same pid structure as our p_pidp, we will + * be able to read pr_pgid -- but we won't if not. + */ +MIGHTREAD(curpsinfo, pr_pgid) + +CANTREAD(curpsinfo, pr_sid) +CANTREAD(curpsinfo, pr_ttydev) +CANTREAD(curpsinfo, pr_projid) +CANTREAD(curpsinfo, pr_zoneid) +CANTREAD(curpsinfo, pr_contract) + +CANREAD(curlwpsinfo, pr_flag) +CANREAD(curlwpsinfo, pr_lwpid) +CANREAD(curlwpsinfo, pr_addr) +CANREAD(curlwpsinfo, pr_wchan) +CANREAD(curlwpsinfo, pr_stype) +CANREAD(curlwpsinfo, pr_state) +CANREAD(curlwpsinfo, pr_sname) +CANREAD(curlwpsinfo, pr_syscall) +CANREAD(curlwpsinfo, pr_pri) +CANREAD(curlwpsinfo, pr_onpro) +CANREAD(curlwpsinfo, pr_bindpro) +CANREAD(curlwpsinfo, pr_bindpset) + +CANTREAD(curlwpsinfo, pr_clname) +CANTREAD(curlwpsinfo, pr_lgrp) + +CANREAD(curcpu, cpu_id) + +CANTREAD(curcpu, cpu_pset) +CANTREAD(curcpu, cpu_chip) +CANTREAD(curcpu, cpu_lgrp) +CANTREAD(curcpu, cpu_info) + +/* + * We cannot assert one thing or another about the variable "root": for those + * with only dtrace_proc, it will be readable in the global but not readable in + * the non-global. + */ +MIGHTREADVAR(root) + +CANREADVAR(cpu) +CANTREADVAR(pset) +CANTREADVAR(cwd) +CANTREADVAR(chip) +CANTREADVAR(lgrp) + +BEGIN +{ + exit(0); +} + +ERROR +/errmsg != ""/ +{ + printf("fatal error: %s", errmsg); + exit(1); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.providers.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.providers.ksh new file mode 100644 index 00000000000..94c3722f78b --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.providers.ksh @@ -0,0 +1,126 @@ +# +# 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) 2012, Joyent, Inc. All rights reserved. +# + +# +# First, make sure that we can successfully enable the io provider +# +if ! dtrace -P io -n BEGIN'{exit(0)}' > /dev/null 2>&1 ; then + echo failed to enable io provider with full privs + exit 1 +fi + +ppriv -s A=basic,dtrace_proc,dtrace_user $$ + +# +# Now make sure that we cannot enable the io provider with reduced privs +# +if ! dtrace -x errtags -P io -n BEGIN'{exit(1)}' 2>&1 | \ + grep D_PDESC_ZERO > /dev/null 2>&1 ; then + echo successfully enabled the io provider with reduced privs + exit 1 +fi + +# +# Keeping our reduced privs, we want to assure that we can see every provider +# that we think we should be able to see -- and that we can see curpsinfo +# state but can't otherwise see arguments. +# +/usr/sbin/dtrace -wq -Cs /dev/stdin <ignore = stringof(curpsinfo->pr_psargs); \ + errstr = ""; \ +} \ + \ +END \ +/err == 0 && !seen["provider"]/ \ +{ \ + printf("no probes from provider\n"); \ + exit(++err); \ +} \ + \ +END \ +/err == 0/ \ +{ \ + printf("saw %d probes from provider\n", seen["provider"]); \ +} + +CANENABLE(proc) +CANENABLE(sched) +CANENABLE(vminfo) +CANENABLE(sysinfo) + +BEGIN +{ + /* + * We'll kick off a system of a do-nothing command -- which should be + * enough to kick proc, sched, vminfo and sysinfo probes. + */ + system("echo > /dev/null"); +} + +ERROR +/err == 0 && errstr != ""/ +{ + printf("fatal error: couldn't read curpsinfo->pr_psargs in "); + printf("%s-provided probe\n", errstr); + exit(++err); +} + +proc:::exit +/progenyof(\$pid)/ +{ + exit(0); +} + +tick-10ms +/i++ > 500/ +{ + printf("exit probe did not seem to fire\n"); + exit(++err); +} +EOF diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/strtoll/err.BaseTooLarge.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/strtoll/err.BaseTooLarge.d new file mode 100644 index 00000000000..4d6b5af75b5 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/strtoll/err.BaseTooLarge.d @@ -0,0 +1,35 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright (c) 2012, Joyent, Inc. All rights reserved. + */ + +/* + * ASSERTION: + * The largest base we will accept is Base 36 -- i.e. using all of 0-9 and + * A-Z as numerals. + * + * SECTION: Actions and Subroutines/strtoll() + */ + +#pragma D option quiet + +BEGIN +{ + printf("%d\n", strtoll("0", 37)); + exit(0); +} + +ERROR +{ + exit(1); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/strtoll/err.BaseTooSmall.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/strtoll/err.BaseTooSmall.d new file mode 100644 index 00000000000..de56b50e9ed --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/strtoll/err.BaseTooSmall.d @@ -0,0 +1,34 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright (c) 2012, Joyent, Inc. All rights reserved. + */ + +/* + * ASSERTION: + * The smallest base we will accept is Base 2. + * + * SECTION: Actions and Subroutines/strtoll() + */ + +#pragma D option quiet + +BEGIN +{ + printf("%d\n", strtoll("0", 1)); + exit(0); +} + +ERROR +{ + exit(1); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/strtoll/tst.strtoll.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/strtoll/tst.strtoll.d new file mode 100644 index 00000000000..0b1812a53ce --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/strtoll/tst.strtoll.d @@ -0,0 +1,66 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright (c) 2012, Joyent, Inc. All rights reserved. + */ + +/* + * ASSERTION: + * Test the strtoll() subroutine. + * + * SECTION: Actions and Subroutines/strtoll() + */ + +#pragma D option quiet + +BEGIN +{ + + /* minimum base (2) and maximum base (36): */ + printf("%d\n", strtoll("0", 2)); + printf("%d\n", strtoll("1", 36)); + + /* simple tests: */ + printf("%d\n", strtoll("0x20", 16)); + printf("%d\n", strtoll("-32", 10)); + printf("%d\n", strtoll("010", 8)); + printf("%d\n", strtoll("101010", 2)); + + /* INT64_MIN and INT64_MAX: */ + printf("%d\n", strtoll("9223372036854775807")); + printf("%d\n", strtoll("-9223372036854775808")); + printf("%d\n", strtoll("0777777777777777777777", 8)); + printf("%d\n", strtoll("-01000000000000000000000", 8)); + + /* wrapping: */ + printf("%d\n", strtoll("1000000000000000000000", 8)); + printf("%d\n", strtoll("-1000000000000000000001", 8)); + + /* hex without prefix: */ + printf("%d\n", strtoll("baddcafe", 16)); + + /* stopping at first out-of-base character: */ + printf("%d\n", strtoll("12j", 10)); + printf("%d\n", strtoll("102", 2)); + + /* base 36: */ + printf("%d\n", strtoll("-0DTrace4EverZ", 36)); + + /* base 10 is assumed: */ + printf("%d\n", strtoll("1985")); + printf("%d\n", strtoll("-2012")); + + /* empty string: */ + printf("%d\n", strtoll("")); + + exit(0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/strtoll/tst.strtoll.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/strtoll/tst.strtoll.d.out new file mode 100644 index 00000000000..d12eb9c1973 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/strtoll/tst.strtoll.d.out @@ -0,0 +1,20 @@ +0 +1 +32 +-32 +8 +42 +9223372036854775807 +-9223372036854775808 +9223372036854775807 +-9223372036854775808 +-9223372036854775808 +9223372036854775807 +3135097598 +12 +2 +-1819882045752187535 +1985 +-2012 +0 + diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/err.invalidpid.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/err.invalidpid.d new file mode 100644 index 00000000000..4865d81ee1e --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/err.invalidpid.d @@ -0,0 +1,21 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright (c) 2013 Joyent, Inc. All rights reserved. + */ + +#pragma D option quiet + +BEGIN +{ + trace((pidfoo`int)0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/err.invalidpid2.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/err.invalidpid2.d new file mode 100644 index 00000000000..bafed121727 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/err.invalidpid2.d @@ -0,0 +1,21 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright (c) 2013 Joyent, Inc. All rights reserved. + */ + +#pragma D option quiet + +BEGIN +{ + trace((pid8foo`int)0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/err.invalidpid3.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/err.invalidpid3.d new file mode 100644 index 00000000000..fb9443a828e --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/err.invalidpid3.d @@ -0,0 +1,21 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright (c) 2013 Joyent, Inc. All rights reserved. + */ + +#pragma D option quiet + +BEGIN +{ + trace((pid0`int)0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/err.invalidtype.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/err.invalidtype.ksh new file mode 100644 index 00000000000..978cde3cf0e --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/err.invalidtype.ksh @@ -0,0 +1,34 @@ +#! /usr/bin/ksh +# +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2013 Joyent, Inc. All rights reserved. +# + +# +# While it's hard to be completely certain that a type of the name we want +# doesn't exist, we're going to try to pick a name which is rather unique. +# + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +t="season_8_mountain_of_madness_t" +pid=$$ + +rc=`$dtrace -n "BEGIN{ trace(pid$pid`$t)0); }"` + +exit $rc diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/err.invalidtype2.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/err.invalidtype2.ksh new file mode 100644 index 00000000000..e64ed526ed3 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/err.invalidtype2.ksh @@ -0,0 +1,35 @@ +#! /usr/bin/ksh +# +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2013 Joyent, Inc. All rights reserved. +# + +# +# While it's hard to be completely certain that a type of the name we want +# doesn't exist, we're going to try to pick a name which is rather +# unique. This time we're also going to use the pid$target alias. +# + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +t="season_8_mountain_of_madness_t" +pid=$$ + +rc=`$dtrace -n "BEGIN{ trace(pid`$t)0); }"` -p $pid + +exit $rc diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/err.user64mode.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/err.user64mode.ksh new file mode 100644 index 00000000000..d987c8da7a4 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/err.user64mode.ksh @@ -0,0 +1,90 @@ +#! /usr/bin/ksh +# +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2013 Joyent, Inc. All rights reserved. +# + +# +# This test is purposefully using a 64-bit DTrace and thus 64-bit types +# when compared with a 32-bit process. This test uses the userland +# keyword and so the implicit copyin should access illegal memory and +# thus exit. +# + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +t="zelda_info_t" +exe="tst.chasestrings.exe" + +elfdump "./$exe" | grep -q '.SUNW_ctf' +if [[ $? -ne 0 ]]; then + echo "CTF does not exist in $exe, that's a bug" >&2 + exit 1 +fi + +./$exe & +pid=$! + +$dtrace -64 -qs /dev/stdin <t = (userland info_t *)arg0; + printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n", + stringof(this->t->zi_gamename), this->t->zi_ndungeons, + stringof(this->t->zi_villain), this->t->zi_haszelda); + next = 1; +} + +pid$pid::has_dungeons:entry +/next == 1/ +{ + this->t = (userland info_t *)arg0; + printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n", + stringof(this->t->zi_gamename), this->t->zi_ndungeons, + stringof(this->t->zi_villain), this->t->zi_haszelda); + next = 2; +} + +pid$pid::has_villain:entry +/next == 2/ +{ + this->t = (userland info_t *)arg0; + printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n", + stringof(this->t->zi_gamename), this->t->zi_ndungeons, + stringof(this->t->zi_villain), this->t->zi_haszelda); + exit(0); +} + +ERROR +{ + exit(1); +} +EOF +rc=$? + +kill -9 $pid + +exit $rc diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.aouttype.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.aouttype.c new file mode 100644 index 00000000000..a4d25f8ca87 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.aouttype.c @@ -0,0 +1,46 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2013 (c) Joyent, Inc. All rights reserved. + */ + +/* + * This test tries to make sure that we have CTF data for a type that only this + * binary would reasonably have. In this case, the + * season_7_lisa_the_vegetarian_t. + */ +#include + +typedef struct season_7_lisa_the_vegetarian { + int fr_salad; +} season_7_lisa_the_vegetarian_t; + +int +sleeper(season_7_lisa_the_vegetarian_t *lp) +{ + for (;;) { + sleep(lp->fr_salad); + } + /*NOTREACHED*/ + return (0); +} + +int +main(void) +{ + season_7_lisa_the_vegetarian_t l; + l.fr_salad = 100; + + sleeper(&l); + + return (0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.aouttype.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.aouttype.ksh new file mode 100644 index 00000000000..151a93676d6 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.aouttype.ksh @@ -0,0 +1,44 @@ +#! /usr/bin/ksh +# +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2013 Joyent, Inc. All rights reserved. +# + +# +# Lookup a type that is inside a.out. +# + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +t="season_7_lisa_the_vegetrian_t *" +exe="tst.aouttype.exe" + +elfdump "./$exe" | grep -q '.SUNW_ctf' +if [[ $? -ne 0 ]]; then + echo "CTF does not exist in $exe, that's a bug" >&2 + exit 1 +fi + +./$exe & +pid=$! + +rc=`$dtrace -n "BEGIN{ trace((pid$pid\`$t)0); exit(0); }"` + +kill -9 $pid + +exit $rc diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.c new file mode 100644 index 00000000000..595a7cb6c57 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.c @@ -0,0 +1,79 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2013 (c) Joyent, Inc. All rights reserved. + */ + +/* + * This test takes data from the current binary which is basically running in a + * loop between two functions and our goal is to have two unique types that they + * contain which we can print. + */ + +#include + +typedef struct zelda_info { + char *zi_gamename; + int zi_ndungeons; + char *zi_villain; + int zi_haszelda; +} zelda_info_t; + +static int +has_princess(zelda_info_t *z) +{ + return (z->zi_haszelda); +} + +static int +has_dungeons(zelda_info_t *z) +{ + return (z->zi_ndungeons != 0); +} + +static const char * +has_villain(zelda_info_t *z) +{ + return (z->zi_villain); +} + +int +main(void) +{ + zelda_info_t oot; + zelda_info_t la; + zelda_info_t lttp; + + oot.zi_gamename = "Ocarina of Time"; + oot.zi_ndungeons = 10; + oot.zi_villain = "Ganondorf"; + oot.zi_haszelda = 1; + + la.zi_gamename = "Link's Awakening"; + la.zi_ndungeons = 9; + la.zi_villain = "Nightmare"; + la.zi_haszelda = 0; + + lttp.zi_gamename = "A Link to the Past"; + lttp.zi_ndungeons = 12; + lttp.zi_villain = "Ganon"; + lttp.zi_haszelda = 1; + + for (;;) { + (void) has_princess(&oot); + (void) has_dungeons(&la); + (void) has_villain(<tp); + sleep(1); + } + + return (0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.ksh new file mode 100644 index 00000000000..25028460db4 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.ksh @@ -0,0 +1,76 @@ +#! /usr/bin/ksh +# +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2013 Joyent, Inc. All rights reserved. +# + +# +# This test is checking that we can read members and that pointers inside +# members point to valid data that is intelligible, eg. strings. +# + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +t="zelda_info_t" +exe="tst.chasestrings.exe" + +elfdump "./$exe" | grep -q '.SUNW_ctf' +if [[ $? -ne 0 ]]; then + echo "CTF does not exist in $exe, that's a bug" >&2 + exit 1 +fi + +./$exe & +pid=$! + +$dtrace -qs /dev/stdin <t = (pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t))); + printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n", + copyinstr((uintptr_t)this->t->zi_gamename), this->t->zi_ndungeons, + copyinstr((uintptr_t)this->t->zi_villain), this->t->zi_haszelda); + next = 1; +} + +pid$pid::has_dungeons:entry +/next == 1/ +{ + this->t = (pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t))); + printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n", + copyinstr((uintptr_t)this->t->zi_gamename), this->t->zi_ndungeons, + copyinstr((uintptr_t)this->t->zi_villain), this->t->zi_haszelda); + next = 2; +} + +pid$pid::has_villain:entry +/next == 2/ +{ + this->t = (pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t))); + printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n", + copyinstr((uintptr_t)this->t->zi_gamename), this->t->zi_ndungeons, + copyinstr((uintptr_t)this->t->zi_villain), this->t->zi_haszelda); + exit(0); +} +EOF +rc=$? + +kill -9 $pid + +exit $rc diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.ksh.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.ksh.out new file mode 100644 index 00000000000..219e406e61d --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.ksh.out @@ -0,0 +1,4 @@ +game: Ocarina of Time, dungeon: 10, villain: Ganondorf, zelda: 1 +game: Link's Awakening, dungeon: 9, villain: Nightmare, zelda: 0 +game: A Link to the Past, dungeon: 12, villain: Ganon, zelda: 1 + diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.libtype.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.libtype.c new file mode 100644 index 00000000000..916a5b51b94 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.libtype.c @@ -0,0 +1,29 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2013 (c) Joyent, Inc. All rights reserved. + */ + +/* + * We're linked against libc which has types, though we do not. + */ +#include + +int +main(void) +{ + for (;;) { + sleep(1000); + } + /*NOTREACHED*/ + return (0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.libtype.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.libtype.ksh new file mode 100644 index 00000000000..af7c6c8fe13 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.libtype.ksh @@ -0,0 +1,45 @@ +#! /usr/bin/ksh +# +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2013 Joyent, Inc. All rights reserved. +# + +# +# Here we want to make sure that the program in question does not have ctf data +# in its a.out; however, we can get types out of a linked libc. +# + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +t="int" +exe="tst.libtype.exe" + +elfdump "./$exe" | grep -q '.SUNW_ctf' +if [[ $? -eq 0 ]]; then + echo "CTF exists in $exe, that's a bug" >&2 + exit 1 +fi + +./$exe & +pid=$! + +rc=`$dtrace -n "BEGIN{ trace((pid$pid\`$t)0); exit(0); }"` + +kill -9 $pid + +exit $rc diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.linkmap.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.linkmap.ksh new file mode 100644 index 00000000000..f767def53de --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.linkmap.ksh @@ -0,0 +1,44 @@ +#! /usr/bin/ksh +# +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2013 Joyent, Inc. All rights reserved. +# + +# +# We should be able to see both strstr from libc and from ld on an +# alternate linkmap. +# + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 + +$dtrace -q -p $$ -s /dev/stdin <' + exit 2 +fi + +dtrace=$1 +t="final_fantasy_info_t" +exe="tst.printtype.exe" + +elfdump "./$exe" | grep -q '.SUNW_ctf' +if [[ $? -ne 0 ]]; then + echo "CTF does not exist in $exe, that's a bug" >&2 + exit 1 +fi + +./$exe & +pid=$! + +$dtrace -qs /dev/stdin <' + exit 2 +fi + +dtrace=$1 +t="final_fantasy_info_t" +exe="tst.printtype.exe" + +elfdump "./$exe" | grep -q '.SUNW_ctf' +if [[ $? -ne 0 ]]; then + echo "CTF does not exist in $exe, that's a bug" >&2 + exit 1 +fi + +./$exe & +pid=$! + +$dtrace -p $pid -qs /dev/stdin < + +typedef struct final_fantasy_info { + int ff_gameid; + int ff_partysize; + int ff_hassummons; +} final_fantasy_info_t; + +static int +ff_getgameid(final_fantasy_info_t *f) +{ + return (0); +} + +static int +ff_getpartysize(final_fantasy_info_t *f) +{ + return (0); +} + +static int +ff_getsummons(final_fantasy_info_t *f) +{ + return (0); +} + +int +main(void) +{ + final_fantasy_info_t ffiii, ffx, ffi; + + ffi.ff_gameid = 1; + ffi.ff_partysize = 4; + ffi.ff_hassummons = 0; + + ffiii.ff_gameid = 6; + ffiii.ff_partysize = 4; + ffiii.ff_hassummons = 1; + + ffx.ff_gameid = 10; + ffx.ff_partysize = 3; + ffx.ff_hassummons = 1; + + for (;;) { + ff_getgameid(&ffi); + ff_getpartysize(&ffx); + ff_getsummons(&ffiii); + sleep(1); + } + /*NOTREACHED*/ + return (0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.printtype.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.printtype.ksh new file mode 100644 index 00000000000..dfc15358290 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.printtype.ksh @@ -0,0 +1,69 @@ +#! /usr/bin/ksh +# +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2013 Joyent, Inc. All rights reserved. +# + +# +# Use print() on userland CTF types and verify we get the data we expect. +# + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +t="final_fantasy_info_t" +exe="tst.printtype.exe" + +elfdump "./$exe" | grep -q '.SUNW_ctf' +if [[ $? -ne 0 ]]; then + echo "CTF does not exist in $exe, that's a bug" >&2 + exit 1 +fi + +./$exe & +pid=$! + +$dtrace -qs /dev/stdin <' + exit 2 +fi + +dtrace=$1 +t="final_fantasy_info_t" +exe="tst.printtype.exe" + +elfdump "./$exe" | grep -q '.SUNW_ctf' +if [[ $? -ne 0 ]]; then + echo "CTF does not exist in $exe, that's a bug" >&2 + exit 1 +fi + +./$exe & +pid=$! + +$dtrace -p $pid -qs /dev/stdin <' + exit 2 +fi + +dtrace=$1 +t="zelda_info_t" +exe="tst.chasestrings.exe" + +elfdump "./$exe" | grep -q '.SUNW_ctf' +if [[ $? -ne 0 ]]; then + echo "CTF does not exist in $exe, that's a bug" >&2 + exit 1 +fi + +./$exe & +pid=$! + +$dtrace -32 -qs /dev/stdin <t = (userland info_t *)arg0; + printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n", + stringof(this->t->zi_gamename), this->t->zi_ndungeons, + stringof(this->t->zi_villain), this->t->zi_haszelda); + next = 1; +} + +pid$pid::has_dungeons:entry +/next == 1/ +{ + this->t = (userland info_t *)arg0; + printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n", + stringof(this->t->zi_gamename), this->t->zi_ndungeons, + stringof(this->t->zi_villain), this->t->zi_haszelda); + next = 2; +} + +pid$pid::has_villain:entry +/next == 2/ +{ + this->t = (userland info_t *)arg0; + printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n", + stringof(this->t->zi_gamename), this->t->zi_ndungeons, + stringof(this->t->zi_villain), this->t->zi_haszelda); + exit(0); +} +EOF +rc=$? + +kill -9 $pid + +exit $rc diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.userlandkey.ksh.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.userlandkey.ksh.out new file mode 100644 index 00000000000..219e406e61d --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.userlandkey.ksh.out @@ -0,0 +1,4 @@ +game: Ocarina of Time, dungeon: 10, villain: Ganondorf, zelda: 1 +game: Link's Awakening, dungeon: 9, villain: Nightmare, zelda: 0 +game: A Link to the Past, dungeon: 12, villain: Ganon, zelda: 1 + diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.userstrings.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.userstrings.ksh new file mode 100644 index 00000000000..79d79de8aec --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.userstrings.ksh @@ -0,0 +1,72 @@ +#! /usr/bin/ksh +# +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2013 Joyent, Inc. All rights reserved. +# + +# +# This test is checking that we can read members and that pointers inside +# members point to valid data that is intelligible, eg. strings. +# + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +exe="tst.chasestrings.exe" + +elfdump "./$exe" | grep -q '.SUNW_ctf' +if [[ $? -ne 0 ]]; then + echo "CTF does not exist in $exe, that's a bug" >&2 + exit 1 +fi + +./$exe & +pid=$! + +$dtrace -qs /dev/stdin <zi_gamename), args[0]->zi_ndungeons, + stringof(args[0]->zi_villain), args[0]->zi_haszelda); + next = 1; +} + +pid$pid::has_dungeons:entry +/next == 1/ +{ + printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n", + stringof(args[0]->zi_gamename), args[0]->zi_ndungeons, + stringof(args[0]->zi_villain), args[0]->zi_haszelda); + next = 2; +} + +pid$pid::has_villain:entry +/next == 2/ +{ + printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n", + stringof(args[0]->zi_gamename), args[0]->zi_ndungeons, + stringof(args[0]->zi_villain), args[0]->zi_haszelda); + exit(0); +} +EOF +rc=$? + +kill -9 $pid + +exit $rc diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.userstrings.ksh.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.userstrings.ksh.out new file mode 100644 index 00000000000..219e406e61d --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/tst.userstrings.ksh.out @@ -0,0 +1,4 @@ +game: Ocarina of Time, dungeon: 10, villain: Ganondorf, zelda: 1 +game: Link's Awakening, dungeon: 9, villain: Nightmare, zelda: 0 +game: A Link to the Past, dungeon: 12, villain: Ganon, zelda: 1 + diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh new file mode 100644 index 00000000000..7def9ed2abc --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh @@ -0,0 +1,106 @@ +# +# 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) 2013, Joyent, Inc. All rights reserved. +# + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +echo '#pragma D option quiet' > test.d +echo '#pragma D option aggsortkey' >> test.d + +cat > test.c < + +void +main() +{ +EOF + +objs= + +for oogle in doogle bagnoogle; do + cat > $oogle.c < + +void +$oogle() +{ + DTRACE_PROBE($oogle, knows); +} +EOF + + cat > $oogle.d <> test.c + echo $oogle'$target:::{@[probefunc] = count()}' >> test.d +done + +echo "}" >> test.c + +echo 'END{printa("%-10s %@d\\n", @)}' >> test.d + +cc -o test test.c $objs + +if [ $? -ne 0 ]; then + print -u2 "failed to compile test.c" + exit 1 +fi + +$dtrace -s ./test.d -Zc ./test + +if [ $? -ne 0 ]; then + print -u2 "failed to execute test" + exit 1 +fi + +cd / +/usr/bin/rm -rf $DIR +exit 0 diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh.out new file mode 100644 index 00000000000..966b6f67353 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh.out @@ -0,0 +1,3 @@ +bagnoogle 1 +doogle 1 + diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noprobes.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noprobes.ksh new file mode 100644 index 00000000000..a43970f5607 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noprobes.ksh @@ -0,0 +1,59 @@ +# +# 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) 2013, Joyent, Inc. All rights reserved. +# + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +cat > test.c < doogle.d <. -.\" Copyright (c) 2012 by Delphix. All rights reserved. +.\" Copyright (c) 2012, 2014 by Delphix. All rights reserved. .\" All Rights Reserved. .\" .\" $FreeBSD$ .\" -.Dd March 20, 2014 +.Dd July 26, 2014 .Dt ZDB 8 .Os .Sh NAME @@ -27,11 +27,12 @@ .Nd Display zpool debugging and consistency information .Sh SYNOPSIS .Nm -.Op Fl CumdibcsDvhLXFPA +.Op Fl CumdibcsDvhLMXFPA .Op Fl e Op Fl p Ar path... .Op Fl t Ar txg .Op Fl U Ar cache -.Op Fl M Ar inflight I/Os +.Op Fl I Ar inflight I/Os +.Op Fl x Ar dumpdir .Ar poolname .Op Ar object ... .Nm @@ -41,7 +42,7 @@ .Ar dataset .Op Ar object ... .Nm -.Fl m Op Fl LXFPA +.Fl m Op Fl MLXFPA .Op Fl t Ar txg .Op Fl e Op Fl p Ar path... .Op Fl U Ar cache @@ -154,6 +155,13 @@ By default, verifies that all non-free blocks are referenced, which can be very expensive. .It Fl m Display the offset, spacemap, and free space of each metaslab. +When specified twice, also display information about the on-disk free +space histogram associated with each metaslab. When specified three time, +display the maximum contiguous free space, the in-core free space histogram, +and the percentage of free space in each space map. When specified +four times display every spacemap record. +.It Fl M +Display the offset, spacemap, and free space of each metaslab. When specified twice, also display information about the maximum contiguous free space and the percentage of free space in each space map. When specified three times display every spacemap record. @@ -217,10 +225,18 @@ Operate on an exported pool, not present in The .Fl p flag specifies the path under which devices are to be searched. +.It Fl x Ar dumpdir +All blocks accessed will be copied to files in the specified directory. +The blocks will be placed in sparse files whose name is the same as +that of the file or device read. zdb can be then run on the generated files. +Note that the +.Fl bbc +flags are sufficient to access (and thus copy) +all metadata on the pool. .It Fl F Attempt to make an unreadable pool readable by trying progressively older transactions. -.It Fl M Ar inflight I/Os +.It Fl I Ar inflight I/Os Limit the number of outstanding checksum I/Os to the specified value. The default value is 200. This option affects the performance of the .Fl c diff --git a/cddl/contrib/opensolaris/cmd/zdb/zdb.c b/cddl/contrib/opensolaris/cmd/zdb/zdb.c index 61e80714ac2..04970fc70bd 100644 --- a/cddl/contrib/opensolaris/cmd/zdb/zdb.c +++ b/cddl/contrib/opensolaris/cmd/zdb/zdb.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2014 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. */ #include @@ -75,9 +75,9 @@ DMU_OT_ZAP_OTHER : DMU_OT_NUMTYPES)) #ifndef lint -extern int zfs_recover; +extern boolean_t zfs_recover; #else -int zfs_recover; +boolean_t zfs_recover; #endif const char cmdname[] = "zdb"; @@ -111,11 +111,11 @@ static void usage(void) { (void) fprintf(stderr, - "Usage: %s [-CumdibcsDvhLXFPA] [-t txg] [-e [-p path...]] " - "[-U config] [-M inflight I/Os] poolname [object...]\n" + "Usage: %s [-CumMdibcsDvhLXFPA] [-t txg] [-e [-p path...]] " + "[-U config] [-I inflight I/Os] [-x dumpdir] poolname [object...]\n" " %s [-divPA] [-e -p path...] [-U config] dataset " "[object...]\n" - " %s -m [-LXFPA] [-t txg] [-e [-p path...]] [-U config] " + " %s -mM [-LXFPA] [-t txg] [-e [-p path...]] [-U config] " "poolname [vdev [metaslab...]]\n" " %s -R [-A] [-e [-p path...]] poolname " "vdev:offset:size[:flags]\n" @@ -138,6 +138,7 @@ usage(void) (void) fprintf(stderr, " -h pool history\n"); (void) fprintf(stderr, " -b block statistics\n"); (void) fprintf(stderr, " -m metaslabs\n"); + (void) fprintf(stderr, " -M metaslab groups\n"); (void) fprintf(stderr, " -c checksum all metadata (twice for " "all data) blocks\n"); (void) fprintf(stderr, " -s report stats on zdb's I/O\n"); @@ -150,7 +151,7 @@ usage(void) (void) fprintf(stderr, " -R read and display block from a " "device\n\n"); (void) fprintf(stderr, " Below options are intended for use " - "with other options (except -l):\n"); + "with other options:\n"); (void) fprintf(stderr, " -A ignore assertions (-A), enable " "panic recovery (-AA) or both (-AAA)\n"); (void) fprintf(stderr, " -F attempt automatic rewind within " @@ -163,11 +164,14 @@ usage(void) "has altroot/not in a cachefile\n"); (void) fprintf(stderr, " -p -- use one or more with " "-e to specify path to vdev dir\n"); - (void) fprintf(stderr, " -P print numbers in parseable form\n"); + (void) fprintf(stderr, " -x -- " + "dump all read blocks into specified directory\n"); + (void) fprintf(stderr, " -P print numbers in parseable form\n"); (void) fprintf(stderr, " -t -- highest txg to use when " "searching for uberblocks\n"); - (void) fprintf(stderr, " -M -- " - "specify the maximum number of checksumming I/Os [default is 200]"); + (void) fprintf(stderr, " -I -- " + "specify the maximum number of " + "checksumming I/Os [default is 200]\n"); (void) fprintf(stderr, "Specify an option more than once (e.g. -bb) " "to make only that option verbose\n"); (void) fprintf(stderr, "Default is to dump everything non-verbosely\n"); @@ -545,7 +549,7 @@ get_metaslab_refcount(vdev_t *vd) { int refcount = 0; - if (vd->vdev_top == vd) { + if (vd->vdev_top == vd && !vd->vdev_removing) { for (int m = 0; m < vd->vdev_ms_count; m++) { space_map_t *sm = vd->vdev_ms[m]->ms_sm; @@ -683,9 +687,10 @@ dump_metaslab(metaslab_t *msp) * The space map histogram represents free space in chunks * of sm_shift (i.e. bucket 0 refers to 2^sm_shift). */ - (void) printf("\tOn-disk histogram:\n"); + (void) printf("\tOn-disk histogram:\t\tfragmentation %llu\n", + (u_longlong_t)msp->ms_fragmentation); dump_histogram(sm->sm_phys->smp_histogram, - SPACE_MAP_HISTOGRAM_SIZE(sm), sm->sm_shift); + SPACE_MAP_HISTOGRAM_SIZE, sm->sm_shift); } if (dump_opt['d'] > 5 || dump_opt['m'] > 3) { @@ -709,6 +714,47 @@ print_vdev_metaslab_header(vdev_t *vd) "---------------", "-------------"); } +static void +dump_metaslab_groups(spa_t *spa) +{ + vdev_t *rvd = spa->spa_root_vdev; + metaslab_class_t *mc = spa_normal_class(spa); + uint64_t fragmentation; + + metaslab_class_histogram_verify(mc); + + for (int c = 0; c < rvd->vdev_children; c++) { + vdev_t *tvd = rvd->vdev_child[c]; + metaslab_group_t *mg = tvd->vdev_mg; + + if (mg->mg_class != mc) + continue; + + metaslab_group_histogram_verify(mg); + mg->mg_fragmentation = metaslab_group_fragmentation(mg); + + (void) printf("\tvdev %10llu\t\tmetaslabs%5llu\t\t" + "fragmentation", + (u_longlong_t)tvd->vdev_id, + (u_longlong_t)tvd->vdev_ms_count); + if (mg->mg_fragmentation == ZFS_FRAG_INVALID) { + (void) printf("%3s\n", "-"); + } else { + (void) printf("%3llu%%\n", + (u_longlong_t)mg->mg_fragmentation); + } + dump_histogram(mg->mg_histogram, RANGE_TREE_HISTOGRAM_SIZE, 0); + } + + (void) printf("\tpool %s\tfragmentation", spa_name(spa)); + fragmentation = metaslab_class_fragmentation(mc); + if (fragmentation == ZFS_FRAG_INVALID) + (void) printf("\t%3s\n", "-"); + else + (void) printf("\t%3llu%%\n", (u_longlong_t)fragmentation); + dump_histogram(mc->mc_histogram, RANGE_TREE_HISTOGRAM_SIZE, 0); +} + static void dump_metaslabs(spa_t *spa) { @@ -1032,7 +1078,8 @@ dump_dnode(objset_t *os, uint64_t object, void *data, size_t size) } static uint64_t -blkid2offset(const dnode_phys_t *dnp, const blkptr_t *bp, const zbookmark_t *zb) +blkid2offset(const dnode_phys_t *dnp, const blkptr_t *bp, + const zbookmark_phys_t *zb) { if (dnp == NULL) { ASSERT(zb->zb_level < 0); @@ -1059,8 +1106,17 @@ snprintf_blkptr_compact(char *blkbuf, size_t buflen, const blkptr_t *bp) return; } - blkbuf[0] = '\0'; + if (BP_IS_EMBEDDED(bp)) { + (void) sprintf(blkbuf, + "EMBEDDED et=%u %llxL/%llxP B=%llu", + (int)BPE_GET_ETYPE(bp), + (u_longlong_t)BPE_GET_LSIZE(bp), + (u_longlong_t)BPE_GET_PSIZE(bp), + (u_longlong_t)bp->blk_birth); + return; + } + blkbuf[0] = '\0'; for (int i = 0; i < ndvas; i++) (void) snprintf(blkbuf + strlen(blkbuf), buflen - strlen(blkbuf), "%llu:%llx:%llx ", @@ -1078,21 +1134,23 @@ snprintf_blkptr_compact(char *blkbuf, size_t buflen, const blkptr_t *bp) "%llxL/%llxP F=%llu B=%llu/%llu", (u_longlong_t)BP_GET_LSIZE(bp), (u_longlong_t)BP_GET_PSIZE(bp), - (u_longlong_t)bp->blk_fill, + (u_longlong_t)BP_GET_FILL(bp), (u_longlong_t)bp->blk_birth, (u_longlong_t)BP_PHYSICAL_BIRTH(bp)); } } static void -print_indirect(blkptr_t *bp, const zbookmark_t *zb, +print_indirect(blkptr_t *bp, const zbookmark_phys_t *zb, const dnode_phys_t *dnp) { char blkbuf[BP_SPRINTF_LEN]; int l; - ASSERT3U(BP_GET_TYPE(bp), ==, dnp->dn_type); - ASSERT3U(BP_GET_LEVEL(bp), ==, zb->zb_level); + if (!BP_IS_EMBEDDED(bp)) { + ASSERT3U(BP_GET_TYPE(bp), ==, dnp->dn_type); + ASSERT3U(BP_GET_LEVEL(bp), ==, zb->zb_level); + } (void) printf("%16llx ", (u_longlong_t)blkid2offset(dnp, bp, zb)); @@ -1112,7 +1170,7 @@ print_indirect(blkptr_t *bp, const zbookmark_t *zb, static int visit_indirect(spa_t *spa, const dnode_phys_t *dnp, - blkptr_t *bp, const zbookmark_t *zb) + blkptr_t *bp, const zbookmark_phys_t *zb) { int err = 0; @@ -1138,7 +1196,7 @@ visit_indirect(spa_t *spa, const dnode_phys_t *dnp, /* recursively visit blocks below this */ cbp = buf->b_data; for (i = 0; i < epb; i++, cbp++) { - zbookmark_t czb; + zbookmark_phys_t czb; SET_BOOKMARK(&czb, zb->zb_objset, zb->zb_object, zb->zb_level - 1, @@ -1146,10 +1204,10 @@ visit_indirect(spa_t *spa, const dnode_phys_t *dnp, err = visit_indirect(spa, dnp, cbp, &czb); if (err) break; - fill += cbp->blk_fill; + fill += BP_GET_FILL(cbp); } if (!err) - ASSERT3U(fill, ==, bp->blk_fill); + ASSERT3U(fill, ==, BP_GET_FILL(bp)); (void) arc_buf_remove_ref(buf, &buf); } @@ -1162,7 +1220,7 @@ dump_indirect(dnode_t *dn) { dnode_phys_t *dnp = dn->dn_phys; int j; - zbookmark_t czb; + zbookmark_phys_t czb; (void) printf("Indirect blocks:\n"); @@ -1816,14 +1874,14 @@ dump_dir(objset_t *os) if (dds.dds_type == DMU_OST_META) { dds.dds_creation_txg = TXG_INITIAL; - usedobjs = os->os_rootbp->blk_fill; + usedobjs = BP_GET_FILL(os->os_rootbp); refdbytes = os->os_spa->spa_dsl_pool-> dp_mos_dir->dd_phys->dd_used_bytes; } else { dmu_objset_space(os, &refdbytes, &scratch, &usedobjs, &scratch); } - ASSERT3U(usedobjs, ==, os->os_rootbp->blk_fill); + ASSERT3U(usedobjs, ==, BP_GET_FILL(os->os_rootbp)); zdb_nicenum(refdbytes, numbuf); @@ -2108,6 +2166,8 @@ typedef struct zdb_blkstats { uint64_t zb_lsize; uint64_t zb_psize; uint64_t zb_count; + uint64_t zb_gangs; + uint64_t zb_ditto_samevdev; uint64_t zb_psize_histogram[PSIZE_HISTO_SIZE]; } zdb_blkstats_t; @@ -2132,6 +2192,9 @@ typedef struct zdb_cb { zdb_blkstats_t zcb_type[ZB_TOTAL + 1][ZDB_OT_TOTAL + 1]; uint64_t zcb_dedup_asize; uint64_t zcb_dedup_blocks; + uint64_t zcb_embedded_blocks[NUM_BP_EMBEDDED_TYPES]; + uint64_t zcb_embedded_histogram[NUM_BP_EMBEDDED_TYPES] + [BPE_PAYLOAD_SIZE]; uint64_t zcb_start; uint64_t zcb_lastprint; uint64_t zcb_totalasize; @@ -2155,6 +2218,7 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t *zilog, const blkptr_t *bp, for (int i = 0; i < 4; i++) { int l = (i < 2) ? BP_GET_LEVEL(bp) : ZB_TOTAL; int t = (i & 1) ? type : ZDB_OT_TOTAL; + int equal; zdb_blkstats_t *zb = &zcb->zcb_type[l][t]; zb->zb_asize += BP_GET_ASIZE(bp); @@ -2162,6 +2226,34 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t *zilog, const blkptr_t *bp, zb->zb_psize += BP_GET_PSIZE(bp); zb->zb_count++; zb->zb_psize_histogram[BP_GET_PSIZE(bp) >> SPA_MINBLOCKSHIFT]++; + + zb->zb_gangs += BP_COUNT_GANG(bp); + + switch (BP_GET_NDVAS(bp)) { + case 2: + if (DVA_GET_VDEV(&bp->blk_dva[0]) == + DVA_GET_VDEV(&bp->blk_dva[1])) + zb->zb_ditto_samevdev++; + break; + case 3: + equal = (DVA_GET_VDEV(&bp->blk_dva[0]) == + DVA_GET_VDEV(&bp->blk_dva[1])) + + (DVA_GET_VDEV(&bp->blk_dva[0]) == + DVA_GET_VDEV(&bp->blk_dva[2])) + + (DVA_GET_VDEV(&bp->blk_dva[1]) == + DVA_GET_VDEV(&bp->blk_dva[2])); + if (equal != 0) + zb->zb_ditto_samevdev++; + break; + } + + } + + if (BP_IS_EMBEDDED(bp)) { + zcb->zcb_embedded_blocks[BPE_GET_ETYPE(bp)]++; + zcb->zcb_embedded_histogram[BPE_GET_ETYPE(bp)] + [BPE_GET_PSIZE(bp)]++; + return; } if (dump_opt['L']) @@ -2200,7 +2292,7 @@ zdb_blkptr_done(zio_t *zio) blkptr_t *bp = zio->io_bp; int ioerr = zio->io_error; zdb_cb_t *zcb = zio->io_private; - zbookmark_t *zb = &zio->io_bookmark; + zbookmark_phys_t *zb = &zio->io_bookmark; zio_data_buf_free(zio->io_data, zio->io_size); @@ -2235,7 +2327,7 @@ zdb_blkptr_done(zio_t *zio) /* ARGSUSED */ static int zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, - const zbookmark_t *zb, const dnode_phys_t *dnp, void *arg) + const zbookmark_phys_t *zb, const dnode_phys_t *dnp, void *arg) { zdb_cb_t *zcb = arg; dmu_object_type_t type; @@ -2263,7 +2355,8 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, is_metadata = (BP_GET_LEVEL(bp) != 0 || DMU_OT_IS_METADATA(type)); - if (dump_opt['c'] > 1 || (dump_opt['c'] && is_metadata)) { + if (!BP_IS_EMBEDDED(bp) && + (dump_opt['c'] > 1 || (dump_opt['c'] && is_metadata))) { size_t size = BP_GET_PSIZE(bp); void *data = zio_data_buf_alloc(size); int flags = ZIO_FLAG_CANFAIL | ZIO_FLAG_SCRUB | ZIO_FLAG_RAW; @@ -2319,8 +2412,7 @@ zdb_leak(void *arg, uint64_t start, uint64_t size) } static metaslab_ops_t zdb_metaslab_ops = { - NULL, /* alloc */ - NULL /* fragmented */ + NULL /* alloc */ }; static void @@ -2455,7 +2547,7 @@ dump_block_stats(spa_t *spa) zdb_blkstats_t *zb, *tzb; uint64_t norm_alloc, norm_space, total_alloc, total_found; int flags = TRAVERSE_PRE | TRAVERSE_PREFETCH_METADATA | TRAVERSE_HARD; - int leaks = 0; + boolean_t leaks = B_FALSE; (void) printf("\nTraversing all blocks %s%s%s%s%s...\n\n", (dump_opt['c'] || !dump_opt['L']) ? "to verify " : "", @@ -2543,7 +2635,7 @@ dump_block_stats(spa_t *spa) (u_longlong_t)total_alloc, (dump_opt['L']) ? "unreachable" : "leaked", (longlong_t)(total_alloc - total_found)); - leaks = 1; + leaks = B_TRUE; } if (tzb->zb_count == 0) @@ -2552,6 +2644,8 @@ dump_block_stats(spa_t *spa) (void) printf("\n"); (void) printf("\tbp count: %10llu\n", (u_longlong_t)tzb->zb_count); + (void) printf("\tganged count: %10llu\n", + (longlong_t)tzb->zb_gangs); (void) printf("\tbp logical: %10llu avg: %6llu\n", (u_longlong_t)tzb->zb_lsize, (u_longlong_t)(tzb->zb_lsize / tzb->zb_count)); @@ -2573,6 +2667,28 @@ dump_block_stats(spa_t *spa) (void) printf("\tSPA allocated: %10llu used: %5.2f%%\n", (u_longlong_t)norm_alloc, 100.0 * norm_alloc / norm_space); + for (bp_embedded_type_t i = 0; i < NUM_BP_EMBEDDED_TYPES; i++) { + if (zcb.zcb_embedded_blocks[i] == 0) + continue; + (void) printf("\n"); + (void) printf("\tadditional, non-pointer bps of type %u: " + "%10llu\n", + i, (u_longlong_t)zcb.zcb_embedded_blocks[i]); + + if (dump_opt['b'] >= 3) { + (void) printf("\t number of (compressed) bytes: " + "number of bps\n"); + dump_histogram(zcb.zcb_embedded_histogram[i], + sizeof (zcb.zcb_embedded_histogram[i]) / + sizeof (zcb.zcb_embedded_histogram[i][0]), 0); + } + } + + if (tzb->zb_ditto_samevdev != 0) { + (void) printf("\tDittoed blocks on same vdev: %llu\n", + (longlong_t)tzb->zb_ditto_samevdev); + } + if (dump_opt['b'] >= 2) { int l, t, level; (void) printf("\nBlocks\tLSIZE\tPSIZE\tASIZE" @@ -2580,7 +2696,7 @@ dump_block_stats(spa_t *spa) for (t = 0; t <= ZDB_OT_TOTAL; t++) { char csize[32], lsize[32], psize[32], asize[32]; - char avg[32]; + char avg[32], gang[32]; char *typename; if (t < DMU_OT_NUMTYPES) @@ -2621,6 +2737,7 @@ dump_block_stats(spa_t *spa) zdb_nicenum(zb->zb_psize, psize); zdb_nicenum(zb->zb_asize, asize); zdb_nicenum(zb->zb_asize / zb->zb_count, avg); + zdb_nicenum(zb->zb_gangs, gang); (void) printf("%6s\t%5s\t%5s\t%5s\t%5s" "\t%5.2f\t%6.2f\t", @@ -2634,6 +2751,11 @@ dump_block_stats(spa_t *spa) (void) printf(" L%d %s\n", level, typename); + if (dump_opt['b'] >= 3 && zb->zb_gangs > 0) { + (void) printf("\t number of ganged " + "blocks: %s\n", gang); + } + if (dump_opt['b'] >= 4) { (void) printf("psize " "(in 512-byte sectors): " @@ -2668,20 +2790,20 @@ typedef struct zdb_ddt_entry { /* ARGSUSED */ static int zdb_ddt_add_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, - const zbookmark_t *zb, const dnode_phys_t *dnp, void *arg) + const zbookmark_phys_t *zb, const dnode_phys_t *dnp, void *arg) { avl_tree_t *t = arg; avl_index_t where; zdb_ddt_entry_t *zdde, zdde_search; - if (BP_IS_HOLE(bp)) + if (BP_IS_HOLE(bp) || BP_IS_EMBEDDED(bp)) return (0); if (dump_opt['S'] > 1 && zb->zb_level == ZB_ROOT_LEVEL) { (void) printf("traversing objset %llu, %llu objects, " "%lu blocks so far\n", (u_longlong_t)zb->zb_objset, - (u_longlong_t)bp->blk_fill, + (u_longlong_t)BP_GET_FILL(bp), avl_numnodes(t)); } @@ -2785,6 +2907,8 @@ dump_zpool(spa_t *spa) if (dump_opt['d'] > 2 || dump_opt['m']) dump_metaslabs(spa); + if (dump_opt['M']) + dump_metaslab_groups(spa); if (dump_opt['d'] || dump_opt['i']) { dump_dir(dp->dp_meta_objset); @@ -3279,7 +3403,8 @@ main(int argc, char **argv) dprintf_setup(&argc, argv); - while ((c = getopt(argc, argv, "bcdhilmM:suCDRSAFLXevp:t:U:P")) != -1) { + while ((c = getopt(argc, argv, + "bcdhilmMI:suCDRSAFLXx:evp:t:U:P")) != -1) { switch (c) { case 'b': case 'c': @@ -3292,6 +3417,7 @@ main(int argc, char **argv) case 'u': case 'C': case 'D': + case 'M': case 'R': case 'S': dump_opt[c]++; @@ -3305,10 +3431,7 @@ main(int argc, char **argv) case 'P': dump_opt[c]++; break; - case 'v': - verbose++; - break; - case 'M': + case 'I': max_inflight = strtoull(optarg, NULL, 0); if (max_inflight == 0) { (void) fprintf(stderr, "maximum number " @@ -3343,6 +3466,12 @@ main(int argc, char **argv) case 'U': spa_config_path = optarg; break; + case 'v': + verbose++; + break; + case 'x': + vn_dumpdir = optarg; + break; default: usage(); break; diff --git a/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c b/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c index 17f7ad3e8c2..583e4222866 100644 --- a/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c +++ b/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c @@ -24,7 +24,7 @@ */ /* - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013, 2014 by Delphix. All rights reserved. */ /* @@ -122,7 +122,7 @@ zil_prt_rec_write(zilog_t *zilog, int txtype, lr_write_t *lr) { char *data, *dlimit; blkptr_t *bp = &lr->lr_blkptr; - zbookmark_t zb; + zbookmark_phys_t zb; char buf[SPA_MAXBLOCKSIZE]; int verbose = MAX(dump_opt['d'], dump_opt['i']); int error; diff --git a/cddl/contrib/opensolaris/cmd/zfs/zfs.8 b/cddl/contrib/opensolaris/cmd/zfs/zfs.8 index 9eb30823e6f..2315e056aaf 100644 --- a/cddl/contrib/opensolaris/cmd/zfs/zfs.8 +++ b/cddl/contrib/opensolaris/cmd/zfs/zfs.8 @@ -18,7 +18,7 @@ .\" information: Portions Copyright [yyyy] [name of copyright owner] .\" .\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved. -.\" Copyright (c) 2013 by Delphix. All rights reserved. +.\" Copyright (c) 2014 by Delphix. All rights reserved. .\" Copyright (c) 2011, Pawel Jakub Dawidek .\" Copyright (c) 2012, Glen Barber .\" Copyright (c) 2012, Bryan Drewery @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 23, 2014 +.Dd June 30, 2014 .Dt ZFS 8 .Os .Sh NAME @@ -179,11 +179,12 @@ .Ar bookmark .Nm .Cm send -.Op Fl DnPpRv +.Op Fl DnPpRve .Op Fl i Ar snapshot | Fl I Ar snapshot .Ar snapshot .Nm .Cm send +.Op Fl e .Op Fl i Ar snapshot Ns | Ns bookmark .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot .Nm @@ -1193,6 +1194,53 @@ affects only files created afterward; existing files are unaffected. .Pp This property can also be referred to by its shortened column name, .Sy recsize . +.It Sy redundant_metadata Ns = Ns Cm all | most +Controls what types of metadata are stored redundantly. +ZFS stores an extra copy of metadata, so that if a single block is corrupted, +the amount of user data lost is limited. +This extra copy is in addition to any redundancy provided at the pool level +.Pq e.g. by mirroring or RAID-Z , +and is in addition to an extra copy specified by the +.Sy copies +property +.Pq up to a total of 3 copies . +For example if the pool is mirrored, +.Cm copies Ns = Ns Ar 2 , +and +.Cm redundant_metadata Ns = Ns Ar most , +then ZFS +stores 6 copies of most metadata, and 4 copies of data and some +metadata. +.Pp +When set to +.Cm all , +ZFS stores an extra copy of all metadata. +If a +single on-disk block is corrupt, at worst a single block of user data +.Po which is +.Cm recordsize +bytes long +can be lost. +.Pc +.Pp +When set to +.Cm most , +ZFS stores an extra copy of most types of +metadata. +This can improve performance of random writes, because less +metadata must be written. +In practice, at worst about 100 blocks +.Po of +.Cm recordsize +bytes each +.Pc +of user data can be lost if a single +on-disk block is corrupt. +The exact behavior of which metadata blocks +are stored redundantly may change in future releases. +.Pp +The default value is +.Cm all . .It Sy refquota Ns = Ns Ar size | Cm none Limits the amount of space a dataset can consume. This property enforces a hard limit on the amount of space used. This hard limit does not include space used @@ -2429,7 +2477,7 @@ feature. .It Xo .Nm .Cm send -.Op Fl DnPpRv +.Op Fl DnPpRve .Op Fl i Ar snapshot | Fl I Ar snapshot .Ar snapshot .Xc @@ -2501,6 +2549,29 @@ be used regardless of the dataset's property, but performance will be much better if the filesystem uses a dedup-capable checksum (eg. .Sy sha256 ) . +.It Fl e +Generate a more compact stream by using WRITE_EMBEDDED records for blocks +which are stored more compactly on disk by the +.Sy embedded_data +pool +feature. +This flag has no effect if the +.Sy embedded_data +feature is +disabled. +The receiving system must have the +.Sy embedded_data +feature +enabled. +If the +.Sy lz4_compress +feature is active on the sending system, +then the receiving system must have that feature enabled as well. +See +.Xr zpool-features 7 +for details on ZFS feature flags and the +.Sy embedded_data +feature. .It Fl p Include the dataset's properties in the stream. This flag is implicit when .Fl R @@ -2525,6 +2596,7 @@ on future versions of .It Xo .Nm .Cm send +.Op Fl e .Op Fl i Ar snapshot Ns | Ns Ar bookmark .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot .Xc @@ -2550,6 +2622,29 @@ specified as the last component of the name If the incremental target is a clone, the incremental source can be the origin snapshot, or an earlier snapshot in the origin's filesystem, or the origin's origin, etc. +.It Fl e +Generate a more compact stream by using WRITE_EMBEDDED records for blocks +which are stored more compactly on disk by the +.Sy embedded_data +pool +feature. +This flag has no effect if the +.Sy embedded_data +feature is +disabled. +The receiving system must have the +.Sy embedded_data +feature +enabled. +If the +.Sy lz4_compress +feature is active on the sending system, +then the receiving system must have that feature enabled as well. +See +.Xr zpool-features 7 +for details on ZFS feature flags and the +.Sy embedded_data +feature. .El .It Xo .Nm diff --git a/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c b/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c index 4c5f8d44bdc..a3b461e1159 100644 --- a/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c +++ b/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright 2012 Milan Jurik. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright (c) 2011-2012 Pawel Jakub Dawidek . @@ -274,9 +274,9 @@ get_usage(zfs_help_t idx) case HELP_ROLLBACK: return (gettext("\trollback [-rRf] \n")); case HELP_SEND: - return (gettext("\tsend [-DnPpRv] [-[iI] snapshot] " + return (gettext("\tsend [-DnPpRve] [-[iI] snapshot] " "\n" - "\tsend [-i snapshot|bookmark] " + "\tsend [-e] [-i snapshot|bookmark] " "\n")); case HELP_SET: return (gettext("\tset " @@ -590,6 +590,7 @@ finish_progress(char *done) free(pt_header); pt_header = NULL; } + /* * zfs clone [-p] [-o prop=value] ... * @@ -3368,6 +3369,7 @@ rollback_check_dependent(zfs_handle_t *zhp, void *data) zfs_close(zhp); return (0); } + /* * Report any snapshots more recent than the one specified. Used when '-r' is * not specified. We reuse this same callback for the snapshot dependents - if @@ -3707,7 +3709,7 @@ zfs_do_send(int argc, char **argv) boolean_t extraverbose = B_FALSE; /* check options */ - while ((c = getopt(argc, argv, ":i:I:RDpvnP")) != -1) { + while ((c = getopt(argc, argv, ":i:I:RDpvnPe")) != -1) { switch (c) { case 'i': if (fromname) @@ -3742,6 +3744,9 @@ zfs_do_send(int argc, char **argv) case 'n': flags.dryrun = B_TRUE; break; + case 'e': + flags.embed_data = B_TRUE; + break; case ':': (void) fprintf(stderr, gettext("missing argument for " "'%c' option\n"), optopt); @@ -3780,6 +3785,7 @@ zfs_do_send(int argc, char **argv) if (strchr(argv[0], '@') == NULL || (fromname && strchr(fromname, '#') != NULL)) { char frombuf[ZFS_MAXNAMELEN]; + enum lzc_send_flags lzc_flags = 0; if (flags.replicate || flags.doall || flags.props || flags.dedup || flags.dryrun || flags.verbose || @@ -3794,6 +3800,9 @@ zfs_do_send(int argc, char **argv) if (zhp == NULL) return (1); + if (flags.embed_data) + lzc_flags |= LZC_SEND_FLAG_EMBED_DATA; + if (fromname != NULL && (fromname[0] == '#' || fromname[0] == '@')) { /* @@ -3807,7 +3816,7 @@ zfs_do_send(int argc, char **argv) (void) strlcat(frombuf, fromname, sizeof (frombuf)); fromname = frombuf; } - err = zfs_send_one(zhp, fromname, STDOUT_FILENO); + err = zfs_send_one(zhp, fromname, STDOUT_FILENO, lzc_flags); zfs_close(zhp); return (err != 0); } @@ -6847,6 +6856,9 @@ zfs_do_bookmark(int argc, char **argv) case ENOTSUP: err_msg = "bookmark feature not enabled"; break; + case ENOSPC: + err_msg = "out of space"; + break; default: err_msg = "unknown error"; break; @@ -6855,7 +6867,7 @@ zfs_do_bookmark(int argc, char **argv) dgettext(TEXT_DOMAIN, err_msg)); } - return (ret); + return (ret != 0); usage: usage(B_FALSE); diff --git a/cddl/contrib/opensolaris/cmd/zhack/zhack.c b/cddl/contrib/opensolaris/cmd/zhack/zhack.c index ace8c32f1a3..6e3f0294a62 100644 --- a/cddl/contrib/opensolaris/cmd/zhack/zhack.c +++ b/cddl/contrib/opensolaris/cmd/zhack/zhack.c @@ -20,7 +20,7 @@ */ /* - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. */ @@ -362,7 +362,7 @@ zhack_do_feature_enable(int argc, char **argv) feature.fi_guid); VERIFY0(dsl_sync_task(spa_name(spa), NULL, - zhack_feature_enable_sync, &feature, 5)); + zhack_feature_enable_sync, &feature, 5, ZFS_SPACE_CHECK_NORMAL)); spa_close(spa, FTAG); @@ -473,7 +473,8 @@ zhack_do_feature_ref(int argc, char **argv) } VERIFY0(dsl_sync_task(spa_name(spa), NULL, - decr ? feature_decr_sync : feature_incr_sync, &feature, 5)); + decr ? feature_decr_sync : feature_incr_sync, &feature, + 5, ZFS_SPACE_CHECK_NORMAL)); spa_close(spa, FTAG); } diff --git a/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 b/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 index 5560de97fd0..437b37413b9 100644 --- a/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 +++ b/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 23, 2014 +.Dd July 1, 2014 .Dt ZPOOL-FEATURES 7 .Os .Sh NAME @@ -235,14 +235,11 @@ administrator can turn on compression on any dataset on the pool using the .Xr zfs 8 -command. Please note that doing so will -immediately activate the -.Sy lz4_compress -feature on the underlying -pool -.Pq even before any data is written , -and the feature will not be -deactivated. +command. +Also, all newly written metadata +will be compressed with +.Sy lz4 +algorithm. Since this feature is not read-only compatible, this operation will render the pool unimportable on systems without support for the @@ -251,6 +248,12 @@ feature. Booting off of .Sy lz4 -compressed root pools is supported. +.Pp +This feature becomes +.Sy active +as soon as it is enabled and will +never return to being +.Sy enabled . .It Sy multi_vdev_crash_dump .Bl -column "READ\-ONLY COMPATIBLE" "com.joyent:multi_vdev_crash_dump" .It GUID Ta com.joyent:multi_vdev_crash_dump @@ -396,6 +399,34 @@ This feature becomes as soon as it is enabled and will never return to being .Sy enabled . +.It Sy embedded_data +.Bl -column "READ\-ONLY COMPATIBLE" "com.delphix:embedded_data" +.It GUID Ta com.delphix:embedded_data +.It READ\-ONLY COMPATIBLE Ta no +.It DEPENDENCIES Ta none +.El +.Pp +This feature improves the performance and compression ratio of +highly-compressible blocks. +Blocks whose contents can compress to 112 bytes +or smaller can take advantage of this feature. +.Pp +When this feature is enabled, the contents of highly-compressible blocks are +stored in the block "pointer" itself +.Po a misnomer in this case, as it contains +the compresseed data, rather than a pointer to its location on disk +.Pc . +Thus +the space of the block +.Pq one sector, typically 512 bytes or 4KB +is saved, +and no additional i/o is needed to read and write the data block. +.Pp +This feature becomes +.Sy active +as soon as it is enabled and will +never return to being +.Sy enabled . .El .Sh SEE ALSO .Xr zpool 8 diff --git a/cddl/contrib/opensolaris/cmd/zpool/zpool.8 b/cddl/contrib/opensolaris/cmd/zpool/zpool.8 index 1061e452f03..a8463cfc7cc 100644 --- a/cddl/contrib/opensolaris/cmd/zpool/zpool.8 +++ b/cddl/contrib/opensolaris/cmd/zpool/zpool.8 @@ -21,12 +21,12 @@ .\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved. .\" Copyright 2011, Nexenta Systems, Inc. All Rights Reserved. .\" Copyright (c) 2011, Justin T. Gibbs -.\" Copyright (c) 2012 by Delphix. All Rights Reserved. +.\" Copyright (c) 2013 by Delphix. All Rights Reserved. .\" Copyright (c) 2012, Glen Barber .\" .\" $FreeBSD$ .\" -.Dd March 28, 2014 +.Dd July 26, 2014 .Dt ZPOOL 8 .Os .Sh NAME @@ -543,6 +543,15 @@ For example, a value of 1.76 indicates that 1.76 units of data were stored but only 1 unit of disk space was actually consumed. See .Xr zfs 8 for a description of the deduplication feature. +.It Sy expandsize +Amount of uninitialized space within the pool or device that can be used to +increase the total capacity of the pool. +Uninitialized space consists of +any space on an EFI labeled vdev which has not been brought online +.Pq i.e. zpool online -e . +This space occurs when a LUN is dynamically expanded. +.It Sy fragmentation +The amount of fragmentation in the pool. .It Sy free Number of blocks within the pool that are not allocated. .It Sy freeing @@ -555,8 +564,6 @@ Over time will decrease while .Sy free increases. -.It Sy expandsize -This property has currently no value on FreeBSD. .It Sy guid A unique identifier for the pool. .It Sy health @@ -1041,7 +1048,6 @@ the following fields: See the .Qq Sx Properties section for more information on the available pool properties. -.Pp .It Fl H Scripted mode. Do not display headers, and separate fields by a single tab instead of arbitrary space. @@ -1392,7 +1398,10 @@ instead of arbitrary space. .It Fl p Display numbers in parsable (exact) values. .It Fl v -Show more detailed information. +Verbose statistics. Reports usage statistics for individual +.Em vdevs +within +the pool, in addition to the pool-wide statistics. .It Fl o Ar property Ns Op , Ns Ar ... Comma-separated list of properties to display. See the .Qq Sx Properties @@ -1401,6 +1410,8 @@ section for a list of valid properties. The default list is .Sy size , .Sy used , .Sy available , +.Sy fragmentation , +.Sy expandsize , .Sy capacity , .Sy health , .Sy altroot . @@ -1665,7 +1676,8 @@ can change. .It Fl x Only display status for pools that are exhibiting errors or are otherwise unavailable. -Warnings about pools not using the latest on-disk format will not be included. +Warnings about pools not using the latest on-disk format, having non-native +block size or disabled features will not be included. .It Fl v Displays verbose data error information, printing out a complete list of all data errors since the last complete pool scrub. @@ -1785,9 +1797,9 @@ is immediately available to any datasets within the pool. The following command lists all available pools on the system. .Bd -literal -offset 2n .Li # Ic zpool list -NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT -pool 2.70T 473G 2.24T 17% 1.00x ONLINE - -test 1.98G 89.5K 1.98G 0% 1.00x ONLINE - +NAME SIZE ALLOC FREE FRAG EXPANDSZ CAP DEDUP HEALTH ALTROOT +pool 2.70T 473G 2.24T 33% - 17% 1.00x ONLINE - +test 1.98G 89.5K 1.98G 48% - 0% 1.00x ONLINE - .Ed .It Sy Example 7 No Listing All Properties for a Pool .Pp @@ -1915,7 +1927,35 @@ subcommand as follows: .Bd -literal -offset 2n .Li # Ic zpool iostat -v pool 5 .Ed -.It Sy Example 15 No Removing a Mirrored Log Device +.It Xo +.Sy Example 15 +Displaying expanded space on a device +.Xc +.Pp +The following command dipslays the detailed information for the +.Em data +pool. +This pool is comprised of a single +.Em raidz +vdev where one of its +devices increased its capacity by 10GB. +In this example, the pool will not +be able to utilized this extra capacity until all the devices under the +.Em raidz +vdev have been expanded. +.Bd -literal -offset 2n +.Li # Ic zpool list -v data +NAME SIZE ALLOC FREE FRAG EXPANDSZ CAP DEDUP HEALTH ALTROOT +data 23.9G 14.6G 9.30G 48% - 61% 1.00x ONLINE - + raidz1 23.9G 14.6G 9.30G 48% - + ada0 - - - - - + ada1 - - - - 10G + ada2 - - - - - +.Ed +.It Xo +.Sy Example 16 +Removing a Mirrored Log Device +.Xc .Pp The following command removes the mirrored log device .Em mirror-2 . @@ -1947,7 +1987,12 @@ is: .Bd -literal -offset 2n .Li # Ic zpool remove tank mirror-2 .Ed -.It Sy Example 16 No Recovering a Faulted Tn ZFS No Pool +.It Xo +.Sy Example 17 +Recovering a Faulted +.Tn ZFS +Pool +.Xc .Pp If a pool is faulted but recoverable, a message indicating this state is provided by diff --git a/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c b/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c index bec5e705440..fe731691d9e 100644 --- a/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c +++ b/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c @@ -22,7 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2013 by Delphix. 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. @@ -2033,7 +2033,7 @@ zpool_do_import(int argc, char **argv) break; case 'T': errno = 0; - txg = strtoull(optarg, &endptr, 10); + txg = strtoull(optarg, &endptr, 0); if (errno != 0 || *endptr != '\0') { (void) fprintf(stderr, gettext("invalid txg value\n")); @@ -2900,10 +2900,15 @@ print_one_column(zpool_prop_t prop, uint64_t value, boolean_t scripted) boolean_t fixed; size_t width = zprop_width(prop, &fixed, ZFS_TYPE_POOL); - zfs_nicenum(value, propval, sizeof (propval)); if (prop == ZPOOL_PROP_EXPANDSZ && value == 0) (void) strlcpy(propval, "-", sizeof (propval)); + else if (prop == ZPOOL_PROP_FRAGMENTATION && value == ZFS_FRAG_INVALID) + (void) strlcpy(propval, "-", sizeof (propval)); + else if (prop == ZPOOL_PROP_FRAGMENTATION) + (void) snprintf(propval, sizeof (propval), "%llu%%", value); + else + zfs_nicenum(value, propval, sizeof (propval)); if (scripted) (void) printf("\t%s", propval); @@ -2936,9 +2941,9 @@ print_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv, /* only toplevel vdevs have capacity stats */ if (vs->vs_space == 0) { if (scripted) - (void) printf("\t-\t-\t-"); + (void) printf("\t-\t-\t-\t-"); else - (void) printf(" - - -"); + (void) printf(" - - - -"); } else { print_one_column(ZPOOL_PROP_SIZE, vs->vs_space, scripted); @@ -2946,6 +2951,8 @@ print_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv, scripted); print_one_column(ZPOOL_PROP_FREE, vs->vs_space - vs->vs_alloc, scripted); + print_one_column(ZPOOL_PROP_FRAGMENTATION, + vs->vs_fragmentation, scripted); } print_one_column(ZPOOL_PROP_EXPANDSZ, vs->vs_esize, scripted); @@ -3031,8 +3038,8 @@ zpool_do_list(int argc, char **argv) int ret; list_cbdata_t cb = { 0 }; static char default_props[] = - "name,size,allocated,free,capacity,dedupratio," - "health,altroot"; + "name,size,allocated,free,fragmentation,expandsize,capacity," + "dedupratio,health,altroot"; char *props = default_props; unsigned long interval = 0, count = 0; zpool_list_t *list; @@ -3076,17 +3083,10 @@ zpool_do_list(int argc, char **argv) if (zprop_get_list(g_zfs, props, &cb.cb_proplist, ZFS_TYPE_POOL) != 0) usage(B_FALSE); - if ((list = pool_list_get(argc, argv, &cb.cb_proplist, &ret)) == NULL) - return (1); - - if (argc == 0 && !cb.cb_scripted && pool_list_count(list) == 0) { - (void) printf(gettext("no pools available\n")); - zprop_free_list(cb.cb_proplist); - return (0); - } - for (;;) { - pool_list_update(list); + if ((list = pool_list_get(argc, argv, &cb.cb_proplist, + &ret)) == NULL) + return (1); if (pool_list_count(list) == 0) break; @@ -3109,9 +3109,16 @@ zpool_do_list(int argc, char **argv) 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); } @@ -4101,6 +4108,7 @@ status_callback(zpool_handle_t *zhp, void *data) 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"), diff --git a/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c b/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c index 5ffd39ac8fe..374798b5e72 100644 --- a/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c +++ b/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c @@ -512,6 +512,7 @@ make_leaf_vdev(const char *arg, uint64_t is_log) verify(nvlist_add_uint64(vdev, ZPOOL_CONFIG_WHOLE_DISK, (uint64_t)wholedisk) == 0); +#ifdef have_devid /* * For a whole disk, defer getting its devid until after labeling it. */ @@ -546,6 +547,7 @@ make_leaf_vdev(const char *arg, uint64_t is_log) (void) close(fd); } +#endif return (vdev); } diff --git a/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c b/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c index f7a40916253..dce1cb3d765 100644 --- a/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c +++ b/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c @@ -49,7 +49,6 @@ */ #define DUMP_GROUPING 4 -uint64_t drr_record_count[DRR_NUMTYPES]; uint64_t total_write_size = 0; uint64_t total_stream_len = 0; FILE *send_stream = 0; @@ -123,7 +122,7 @@ print_block(char *buf, int length) * Start printing ASCII characters at a constant offset, after * the hex prints. Leave 3 characters per byte on a line (2 digit * hex number plus 1 space) plus spaces between characters and - * groupings + * groupings. */ int ascii_start = BYTES_PER_LINE * 3 + BYTES_PER_LINE / DUMP_GROUPING + 2; @@ -160,6 +159,8 @@ int main(int argc, char *argv[]) { char *buf = malloc(INITIAL_BUFLEN); + uint64_t drr_record_count[DRR_NUMTYPES] = { 0 }; + uint64_t total_records = 0; dmu_replay_record_t thedrr; dmu_replay_record_t *drr = &thedrr; struct drr_begin *drrb = &thedrr.drr_u.drr_begin; @@ -170,6 +171,7 @@ main(int argc, char *argv[]) struct drr_write_byref *drrwbr = &thedrr.drr_u.drr_write_byref; struct drr_free *drrf = &thedrr.drr_u.drr_free; struct drr_spill *drrs = &thedrr.drr_u.drr_spill; + struct drr_write_embedded *drrwe = &thedrr.drr_u.drr_write_embedded; char c; boolean_t verbose = B_FALSE; boolean_t first = B_TRUE; @@ -264,6 +266,7 @@ main(int argc, char *argv[]) } drr_record_count[drr->drr_type]++; + total_records++; switch (drr->drr_type) { case DRR_BEGIN: @@ -376,8 +379,8 @@ main(int argc, char *argv[]) drro->drr_bonuslen); } if (drro->drr_bonuslen > 0) { - (void) ssread(buf, P2ROUNDUP(drro->drr_bonuslen, - 8), &zc); + (void) ssread(buf, + P2ROUNDUP(drro->drr_bonuslen, 8), &zc); if (dump) { print_block(buf, P2ROUNDUP(drro->drr_bonuslen, 8)); @@ -506,6 +509,38 @@ main(int argc, char *argv[]) print_block(buf, drrs->drr_length); } break; + case DRR_WRITE_EMBEDDED: + if (do_byteswap) { + drrwe->drr_object = + BSWAP_64(drrwe->drr_object); + drrwe->drr_offset = + BSWAP_64(drrwe->drr_offset); + drrwe->drr_length = + BSWAP_64(drrwe->drr_length); + drrwe->drr_toguid = + BSWAP_64(drrwe->drr_toguid); + drrwe->drr_lsize = + BSWAP_32(drrwe->drr_lsize); + drrwe->drr_psize = + BSWAP_32(drrwe->drr_psize); + } + if (verbose) { + (void) printf("WRITE_EMBEDDED object = %llu " + "offset = %llu length = %llu\n" + "toguid = %llx comp = %u etype = %u " + "lsize = %u psize = %u\n", + (u_longlong_t)drrwe->drr_object, + (u_longlong_t)drrwe->drr_offset, + (u_longlong_t)drrwe->drr_length, + (u_longlong_t)drrwe->drr_toguid, + drrwe->drr_compression, + drrwe->drr_etype, + drrwe->drr_lsize, + drrwe->drr_psize); + } + (void) ssread(buf, + P2ROUNDUP(drrwe->drr_psize, 8), &zc); + break; } pcksum = zc; } @@ -524,18 +559,16 @@ main(int argc, char *argv[]) (u_longlong_t)drr_record_count[DRR_FREEOBJECTS]); (void) printf("\tTotal DRR_WRITE records = %lld\n", (u_longlong_t)drr_record_count[DRR_WRITE]); + (void) printf("\tTotal DRR_WRITE_BYREF records = %lld\n", + (u_longlong_t)drr_record_count[DRR_WRITE_BYREF]); + (void) printf("\tTotal DRR_WRITE_EMBEDDED records = %lld\n", + (u_longlong_t)drr_record_count[DRR_WRITE_EMBEDDED]); (void) printf("\tTotal DRR_FREE records = %lld\n", (u_longlong_t)drr_record_count[DRR_FREE]); (void) printf("\tTotal DRR_SPILL records = %lld\n", (u_longlong_t)drr_record_count[DRR_SPILL]); (void) printf("\tTotal records = %lld\n", - (u_longlong_t)(drr_record_count[DRR_BEGIN] + - drr_record_count[DRR_OBJECT] + - drr_record_count[DRR_FREEOBJECTS] + - drr_record_count[DRR_WRITE] + - drr_record_count[DRR_FREE] + - drr_record_count[DRR_SPILL] + - drr_record_count[DRR_END])); + (u_longlong_t)total_records); (void) printf("\tTotal write size = %lld (0x%llx)\n", (u_longlong_t)total_write_size, (u_longlong_t)total_write_size); (void) printf("\tTotal stream length = %lld (0x%llx)\n", diff --git a/cddl/contrib/opensolaris/cmd/ztest/ztest.c b/cddl/contrib/opensolaris/cmd/ztest/ztest.c index 6e028c3f5a3..33271619680 100644 --- a/cddl/contrib/opensolaris/cmd/ztest/ztest.c +++ b/cddl/contrib/opensolaris/cmd/ztest/ztest.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2012 Martin Matuska . All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. @@ -53,7 +53,7 @@ * At random times, the child self-immolates with a SIGKILL. * This is the software equivalent of pulling the power cord. * The parent then runs the test again, using the existing - * storage pool, as many times as desired. If backwards compatability + * storage pool, as many times as desired. If backwards compatibility * testing is enabled ztest will sometimes run the "older" version * of ztest after a SIGKILL. * @@ -187,6 +187,7 @@ static const ztest_shared_opts_t ztest_opts_defaults = { extern uint64_t metaslab_gang_bang; extern uint64_t metaslab_df_alloc_threshold; extern uint64_t zfs_deadman_synctime_ms; +extern int metaslab_preload_limit; static ztest_shared_opts_t *ztest_shared_opts; static ztest_shared_opts_t ztest_opts; @@ -809,7 +810,7 @@ static uint64_t ztest_get_ashift(void) { if (ztest_opts.zo_ashift == 0) - return (SPA_MINBLOCKSHIFT + ztest_random(3)); + return (SPA_MINBLOCKSHIFT + ztest_random(5)); return (ztest_opts.zo_ashift); } @@ -968,11 +969,28 @@ ztest_random_spa_version(uint64_t initial_version) return (version); } +/* + * Find the largest ashift used + */ +static uint64_t +ztest_spa_get_ashift() { + uint64_t i; + uint64_t ashift = SPA_MINBLOCKSHIFT; + vdev_t *rvd = ztest_spa->spa_root_vdev; + + for (i = 0; i < rvd->vdev_children; i++) { + ashift = MAX(ashift, rvd->vdev_child[i]->vdev_ashift); + } + return (ashift); +} + static int ztest_random_blocksize(void) { - return (1 << (SPA_MINBLOCKSHIFT + - ztest_random(SPA_MAXBLOCKSHIFT - SPA_MINBLOCKSHIFT + 1))); + // Choose a block size >= the ashift. + uint64_t block_shift = + ztest_random(SPA_MAXBLOCKSHIFT - ztest_spa_get_ashift() + 1); + return (1 << (SPA_MINBLOCKSHIFT + block_shift)); } static int @@ -1267,13 +1285,13 @@ static void ztest_bt_verify(ztest_block_tag_t *bt, objset_t *os, uint64_t object, uint64_t offset, uint64_t gen, uint64_t txg, uint64_t crtxg) { - ASSERT(bt->bt_magic == BT_MAGIC); - ASSERT(bt->bt_objset == dmu_objset_id(os)); - ASSERT(bt->bt_object == object); - ASSERT(bt->bt_offset == offset); - ASSERT(bt->bt_gen <= gen); - ASSERT(bt->bt_txg <= txg); - ASSERT(bt->bt_crtxg == crtxg); + ASSERT3U(bt->bt_magic, ==, BT_MAGIC); + ASSERT3U(bt->bt_objset, ==, dmu_objset_id(os)); + ASSERT3U(bt->bt_object, ==, object); + ASSERT3U(bt->bt_offset, ==, offset); + ASSERT3U(bt->bt_gen, <=, gen); + ASSERT3U(bt->bt_txg, <=, txg); + ASSERT3U(bt->bt_crtxg, ==, crtxg); } static ztest_block_tag_t * @@ -3472,6 +3490,11 @@ ztest_dsl_dataset_promote_busy(ztest_ds_t *zd, uint64_t id) if (error) fatal(0, "dmu_objset_own(%s) = %d", snap2name, error); error = dsl_dataset_promote(clone2name, NULL); + if (error == ENOSPC) { + dmu_objset_disown(os, FTAG); + ztest_record_enospc(FTAG); + goto out; + } if (error != EBUSY) fatal(0, "dsl_dataset_promote(%s), %d, not EBUSY", clone2name, error); @@ -3627,11 +3650,19 @@ ztest_dmu_read_write(ztest_ds_t *zd, uint64_t id) return; } - dmu_object_set_checksum(os, bigobj, - (enum zio_checksum)ztest_random_dsl_prop(ZFS_PROP_CHECKSUM), tx); + enum zio_checksum cksum; + do { + cksum = (enum zio_checksum) + ztest_random_dsl_prop(ZFS_PROP_CHECKSUM); + } while (cksum >= ZIO_CHECKSUM_LEGACY_FUNCTIONS); + dmu_object_set_checksum(os, bigobj, cksum, tx); - dmu_object_set_compress(os, bigobj, - (enum zio_compress)ztest_random_dsl_prop(ZFS_PROP_COMPRESSION), tx); + enum zio_compress comp; + do { + comp = (enum zio_compress) + ztest_random_dsl_prop(ZFS_PROP_COMPRESSION); + } while (comp >= ZIO_COMPRESS_LEGACY_FUNCTIONS); + dmu_object_set_compress(os, bigobj, comp, tx); /* * For each index from n to n + s, verify that the existing bufwad @@ -4711,8 +4742,13 @@ ztest_dmu_snapshot_hold(ztest_ds_t *zd, uint64_t id) error = dsl_dataset_user_hold(holds, 0, NULL); fnvlist_free(holds); - if (error) - fatal(0, "dsl_dataset_user_hold(%s)", fullname, tag); + if (error == ENOSPC) { + ztest_record_enospc("dsl_dataset_user_hold"); + goto out; + } else if (error) { + fatal(0, "dsl_dataset_user_hold(%s, %s) = %u", + fullname, tag, error); + } error = dsl_destroy_snapshot(fullname, B_FALSE); if (error != EBUSY) { @@ -5165,7 +5201,7 @@ ztest_run_zdb(char *pool) isa = strdup(isa); /* LINTED */ (void) sprintf(bin, - "/usr/sbin%.*s/zdb -bcc%s%s -U %s %s", + "/usr/sbin%.*s/zdb -bcc%s%s -d -U %s %s", isalen, isa, ztest_opts.zo_verbose >= 3 ? "s" : "", @@ -5578,6 +5614,7 @@ ztest_run(ztest_shared_t *zs) kernel_init(FREAD | FWRITE); VERIFY0(spa_open(ztest_opts.zo_pool, &spa, FTAG)); spa->spa_debug = B_TRUE; + metaslab_preload_limit = ztest_random(20) + 1; ztest_spa = spa; VERIFY0(dmu_objset_own(ztest_opts.zo_pool, @@ -5747,17 +5784,31 @@ ztest_freeze(void) */ spa_freeze(spa); + /* + * Because it is hard to predict how much space a write will actually + * require beforehand, we leave ourselves some fudge space to write over + * capacity. + */ + uint64_t capacity = metaslab_class_get_space(spa_normal_class(spa)) / 2; + /* * Run tests that generate log records but don't alter the pool config * or depend on DSL sync tasks (snapshots, objset create/destroy, etc). * We do a txg_wait_synced() after each iteration to force the txg * to increase well beyond the last synced value in the uberblock. * The ZIL should be OK with that. + * + * Run a random number of times less than zo_maxloops and ensure we do + * not run out of space on the pool. */ while (ztest_random(10) != 0 && - numloops++ < ztest_opts.zo_maxloops) { - ztest_dmu_write_parallel(zd, 0); - ztest_dmu_object_alloc_free(zd, 0); + numloops++ < ztest_opts.zo_maxloops && + metaslab_class_get_alloc(spa_normal_class(spa)) < capacity) { + ztest_od_t od; + ztest_od_init(&od, 0, FTAG, 0, DMU_OT_UINT64_OTHER, 0, 0); + VERIFY0(ztest_object_init(zd, &od, sizeof (od), B_FALSE)); + ztest_io(zd, od.od_object, + ztest_random(ZTEST_RANGE_LOCKS) << SPA_MAXBLOCKSHIFT); txg_wait_synced(spa_get_dsl(spa), 0); } diff --git a/cddl/contrib/opensolaris/common/ctf/ctf_open.c b/cddl/contrib/opensolaris/common/ctf/ctf_open.c index 2148389fff8..001cf5c5910 100644 --- a/cddl/contrib/opensolaris/common/ctf/ctf_open.c +++ b/cddl/contrib/opensolaris/common/ctf/ctf_open.c @@ -25,7 +25,7 @@ * Use is subject to license terms. */ /* - * Copyright (c) 2012, Joyent, Inc. All rights reserved. + * Copyright (c) 2013, Joyent, Inc. All rights reserved. */ #include @@ -787,6 +787,92 @@ ctf_bufopen(const ctf_sect_t *ctfsect, const ctf_sect_t *symsect, return (NULL); } +/* + * Dupliate a ctf_file_t and its underlying section information into a new + * container. This works by copying the three ctf_sect_t's of the original + * container if they exist and passing those into ctf_bufopen. To copy those, we + * mmap anonymous memory with ctf_data_alloc and bcopy the data across. It's not + * the cheapest thing, but it's what we've got. + */ +ctf_file_t * +ctf_dup(ctf_file_t *ofp) +{ + ctf_file_t *fp; + ctf_sect_t ctfsect, symsect, strsect; + ctf_sect_t *ctp, *symp, *strp; + void *cbuf, *symbuf, *strbuf; + int err; + + cbuf = symbuf = strbuf = NULL; + /* + * The ctfsect isn't allowed to not exist, but the symbol and string + * section might not. We only need to copy the data of the section, not + * the name, as ctf_bufopen will take care of that. + */ + bcopy(&ofp->ctf_data, &ctfsect, sizeof (ctf_sect_t)); + cbuf = ctf_data_alloc(ctfsect.cts_size); + if (cbuf == NULL) { + (void) ctf_set_errno(ofp, ECTF_MMAP); + return (NULL); + } + + bcopy(ctfsect.cts_data, cbuf, ctfsect.cts_size); + ctf_data_protect(cbuf, ctfsect.cts_size); + ctfsect.cts_data = cbuf; + ctfsect.cts_offset = 0; + ctp = &ctfsect; + + if (ofp->ctf_symtab.cts_data != NULL) { + bcopy(&ofp->ctf_symtab, &symsect, sizeof (ctf_sect_t)); + symbuf = ctf_data_alloc(symsect.cts_size); + if (symbuf == NULL) { + (void) ctf_set_errno(ofp, ECTF_MMAP); + goto err; + } + bcopy(symsect.cts_data, symbuf, symsect.cts_size); + ctf_data_protect(symbuf, symsect.cts_size); + symsect.cts_data = symbuf; + symsect.cts_offset = 0; + symp = &symsect; + } else { + symp = NULL; + } + + if (ofp->ctf_strtab.cts_data != NULL) { + bcopy(&ofp->ctf_strtab, &strsect, sizeof (ctf_sect_t)); + strbuf = ctf_data_alloc(strsect.cts_size); + if (strbuf == NULL) { + (void) ctf_set_errno(ofp, ECTF_MMAP); + goto err; + } + bcopy(strsect.cts_data, strbuf, strsect.cts_size); + ctf_data_protect(strbuf, strsect.cts_size); + strsect.cts_data = strbuf; + strsect.cts_offset = 0; + strp = &strsect; + } else { + strp = NULL; + } + + fp = ctf_bufopen(ctp, symp, strp, &err); + if (fp == NULL) { + (void) ctf_set_errno(ofp, err); + goto err; + } + + fp->ctf_flags |= LCTF_MMAP; + + return (fp); + +err: + ctf_data_free(cbuf, ctfsect.cts_size); + if (symbuf != NULL) + ctf_data_free(symbuf, symsect.cts_size); + if (strbuf != NULL) + ctf_data_free(strbuf, strsect.cts_size); + return (NULL); +} + /* * Close the specified CTF container and free associated data structures. Note * that ctf_close() is a reference counted operation: if the specified file is diff --git a/cddl/contrib/opensolaris/common/ctf/ctf_types.c b/cddl/contrib/opensolaris/common/ctf/ctf_types.c index 290c518ae72..ab1b9ff14bd 100644 --- a/cddl/contrib/opensolaris/common/ctf/ctf_types.c +++ b/cddl/contrib/opensolaris/common/ctf/ctf_types.c @@ -25,8 +25,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include ssize_t @@ -199,8 +197,9 @@ ctf_type_resolve(ctf_file_t *fp, ctf_id_t type) * Lookup the given type ID and print a string name for it into buf. Return * the actual number of bytes (not including \0) needed to format the name. */ -ssize_t -ctf_type_lname(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len) +static ssize_t +ctf_type_qlname(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len, + const char *qname) { ctf_decl_t cd; ctf_decl_node_t *cdp; @@ -255,6 +254,8 @@ ctf_type_lname(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len) case CTF_K_INTEGER: case CTF_K_FLOAT: case CTF_K_TYPEDEF: + if (qname != NULL) + ctf_decl_sprintf(&cd, "%s`", qname); ctf_decl_sprintf(&cd, "%s", name); break; case CTF_K_POINTER: @@ -268,13 +269,22 @@ ctf_type_lname(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len) break; case CTF_K_STRUCT: case CTF_K_FORWARD: - ctf_decl_sprintf(&cd, "struct %s", name); + ctf_decl_sprintf(&cd, "struct "); + if (qname != NULL) + ctf_decl_sprintf(&cd, "%s`", qname); + ctf_decl_sprintf(&cd, "%s", name); break; case CTF_K_UNION: - ctf_decl_sprintf(&cd, "union %s", name); + ctf_decl_sprintf(&cd, "union "); + if (qname != NULL) + ctf_decl_sprintf(&cd, "%s`", qname); + ctf_decl_sprintf(&cd, "%s", name); break; case CTF_K_ENUM: - ctf_decl_sprintf(&cd, "enum %s", name); + ctf_decl_sprintf(&cd, "enum "); + if (qname != NULL) + ctf_decl_sprintf(&cd, "%s`", qname); + ctf_decl_sprintf(&cd, "%s", name); break; case CTF_K_VOLATILE: ctf_decl_sprintf(&cd, "volatile"); @@ -301,6 +311,12 @@ ctf_type_lname(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len) return (cd.cd_len); } +ssize_t +ctf_type_lname(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len) +{ + return (ctf_type_qlname(fp, type, buf, len, NULL)); +} + /* * Lookup the given type ID and print a string name for it into buf. If buf * is too small, return NULL: the ECTF_NAMELEN error is set on 'fp' for us. @@ -308,10 +324,19 @@ ctf_type_lname(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len) char * ctf_type_name(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len) { - ssize_t rv = ctf_type_lname(fp, type, buf, len); + ssize_t rv = ctf_type_qlname(fp, type, buf, len, NULL); return (rv >= 0 && rv < len ? buf : NULL); } +char * +ctf_type_qname(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len, + const char *qname) +{ + ssize_t rv = ctf_type_qlname(fp, type, buf, len, qname); + return (rv >= 0 && rv < len ? buf : NULL); +} + + /* * Resolve the type down to a base type node, and then return the size * of the type storage in bytes. diff --git a/cddl/contrib/opensolaris/common/util/strtolctype.h b/cddl/contrib/opensolaris/common/util/strtolctype.h new file mode 100644 index 00000000000..a1d18367d34 --- /dev/null +++ b/cddl/contrib/opensolaris/common/util/strtolctype.h @@ -0,0 +1,79 @@ +/* + * 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 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +#ifndef _COMMON_UTIL_CTYPE_H +#define _COMMON_UTIL_CTYPE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This header file contains a collection of macros that the strtou?ll? + * functions in common/util use to test characters. What we need is a kernel + * version of ctype.h. + * + * NOTE: These macros are used within several DTrace probe context functions. + * They must not be altered to make function calls or perform actions not + * safe in probe context. + */ + +#if defined(sun) && (defined(_KERNEL) || defined(_BOOT)) + +#define isalnum(ch) (isalpha(ch) || isdigit(ch)) +#define isalpha(ch) (isupper(ch) || islower(ch)) +#define isdigit(ch) ((ch) >= '0' && (ch) <= '9') +#define islower(ch) ((ch) >= 'a' && (ch) <= 'z') +#define isspace(ch) (((ch) == ' ') || ((ch) == '\r') || ((ch) == '\n') || \ + ((ch) == '\t') || ((ch) == '\f')) +#define isupper(ch) ((ch) >= 'A' && (ch) <= 'Z') +#define isxdigit(ch) (isdigit(ch) || ((ch) >= 'a' && (ch) <= 'f') || \ + ((ch) >= 'A' && (ch) <= 'F')) + +#endif /* _KERNEL || _BOOT */ + +#define DIGIT(x) \ + (isdigit(x) ? (x) - '0' : islower(x) ? (x) + 10 - 'a' : (x) + 10 - 'A') + +#define MBASE ('z' - 'a' + 1 + 10) + +/* + * The following macro is a version of isalnum() that limits alphabetic + * characters to the ranges a-z and A-Z; locale dependent characters will not + * return 1. The members of a-z and A-Z are assumed to be in ascending order + * and contiguous. + */ +#define lisalnum(x) \ + (isdigit(x) || ((x) >= 'a' && (x) <= 'z') || ((x) >= 'A' && (x) <= 'Z')) + +#ifdef __cplusplus +} +#endif + +#endif /* _COMMON_UTIL_CTYPE_H */ diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c index b0f2b4a1af3..6b571fafdd0 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c @@ -25,7 +25,7 @@ */ /* - * Copyright (c) 2011, Joyent, Inc. All rights reserved. + * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. */ @@ -1300,6 +1300,231 @@ dtrace_aggregate_walk(dtrace_hdl_t *dtp, dtrace_aggregate_f *func, void *arg) return (0); } +static int +dt_aggregate_total(dtrace_hdl_t *dtp, boolean_t clear) +{ + dt_ahashent_t *h; + dtrace_aggdata_t **total; + dtrace_aggid_t max = DTRACE_AGGVARIDNONE, id; + dt_aggregate_t *agp = &dtp->dt_aggregate; + dt_ahash_t *hash = &agp->dtat_hash; + uint32_t tflags; + + tflags = DTRACE_A_TOTAL | DTRACE_A_HASNEGATIVES | DTRACE_A_HASPOSITIVES; + + /* + * If we need to deliver per-aggregation totals, we're going to take + * three passes over the aggregate: one to clear everything out and + * determine our maximum aggregation ID, one to actually total + * everything up, and a final pass to assign the totals to the + * individual elements. + */ + for (h = hash->dtah_all; h != NULL; h = h->dtahe_nextall) { + dtrace_aggdata_t *aggdata = &h->dtahe_data; + + if ((id = dt_aggregate_aggvarid(h)) > max) + max = id; + + aggdata->dtada_total = 0; + aggdata->dtada_flags &= ~tflags; + } + + if (clear || max == DTRACE_AGGVARIDNONE) + return (0); + + total = dt_zalloc(dtp, (max + 1) * sizeof (dtrace_aggdata_t *)); + + if (total == NULL) + return (-1); + + for (h = hash->dtah_all; h != NULL; h = h->dtahe_nextall) { + dtrace_aggdata_t *aggdata = &h->dtahe_data; + dtrace_aggdesc_t *agg = aggdata->dtada_desc; + dtrace_recdesc_t *rec; + caddr_t data; + int64_t val, *addr; + + rec = &agg->dtagd_rec[agg->dtagd_nrecs - 1]; + data = aggdata->dtada_data; + addr = (int64_t *)(uintptr_t)(data + rec->dtrd_offset); + + switch (rec->dtrd_action) { + case DTRACEAGG_STDDEV: + val = dt_stddev((uint64_t *)addr, 1); + break; + + case DTRACEAGG_SUM: + case DTRACEAGG_COUNT: + val = *addr; + break; + + case DTRACEAGG_AVG: + val = addr[0] ? (addr[1] / addr[0]) : 0; + break; + + default: + continue; + } + + if (total[agg->dtagd_varid] == NULL) { + total[agg->dtagd_varid] = aggdata; + aggdata->dtada_flags |= DTRACE_A_TOTAL; + } else { + aggdata = total[agg->dtagd_varid]; + } + + if (val > 0) + aggdata->dtada_flags |= DTRACE_A_HASPOSITIVES; + + if (val < 0) { + aggdata->dtada_flags |= DTRACE_A_HASNEGATIVES; + val = -val; + } + + if (dtp->dt_options[DTRACEOPT_AGGZOOM] != DTRACEOPT_UNSET) { + val = (int64_t)((long double)val * + (1 / DTRACE_AGGZOOM_MAX)); + + if (val > aggdata->dtada_total) + aggdata->dtada_total = val; + } else { + aggdata->dtada_total += val; + } + } + + /* + * And now one final pass to set everyone's total. + */ + for (h = hash->dtah_all; h != NULL; h = h->dtahe_nextall) { + dtrace_aggdata_t *aggdata = &h->dtahe_data, *t; + dtrace_aggdesc_t *agg = aggdata->dtada_desc; + + if ((t = total[agg->dtagd_varid]) == NULL || aggdata == t) + continue; + + aggdata->dtada_total = t->dtada_total; + aggdata->dtada_flags |= (t->dtada_flags & tflags); + } + + dt_free(dtp, total); + + return (0); +} + +static int +dt_aggregate_minmaxbin(dtrace_hdl_t *dtp, boolean_t clear) +{ + dt_ahashent_t *h; + dtrace_aggdata_t **minmax; + dtrace_aggid_t max = DTRACE_AGGVARIDNONE, id; + dt_aggregate_t *agp = &dtp->dt_aggregate; + dt_ahash_t *hash = &agp->dtat_hash; + + for (h = hash->dtah_all; h != NULL; h = h->dtahe_nextall) { + dtrace_aggdata_t *aggdata = &h->dtahe_data; + + if ((id = dt_aggregate_aggvarid(h)) > max) + max = id; + + aggdata->dtada_minbin = 0; + aggdata->dtada_maxbin = 0; + aggdata->dtada_flags &= ~DTRACE_A_MINMAXBIN; + } + + if (clear || max == DTRACE_AGGVARIDNONE) + return (0); + + minmax = dt_zalloc(dtp, (max + 1) * sizeof (dtrace_aggdata_t *)); + + if (minmax == NULL) + return (-1); + + for (h = hash->dtah_all; h != NULL; h = h->dtahe_nextall) { + dtrace_aggdata_t *aggdata = &h->dtahe_data; + dtrace_aggdesc_t *agg = aggdata->dtada_desc; + dtrace_recdesc_t *rec; + caddr_t data; + int64_t *addr; + int minbin = -1, maxbin = -1, i; + int start = 0, size; + + rec = &agg->dtagd_rec[agg->dtagd_nrecs - 1]; + size = rec->dtrd_size / sizeof (int64_t); + data = aggdata->dtada_data; + addr = (int64_t *)(uintptr_t)(data + rec->dtrd_offset); + + switch (rec->dtrd_action) { + case DTRACEAGG_LQUANTIZE: + /* + * For lquantize(), we always display the entire range + * of the aggregation when aggpack is set. + */ + start = 1; + minbin = start; + maxbin = size - 1 - start; + break; + + case DTRACEAGG_QUANTIZE: + for (i = start; i < size; i++) { + if (!addr[i]) + continue; + + if (minbin == -1) + minbin = i - start; + + maxbin = i - start; + } + + if (minbin == -1) { + /* + * If we have no data (e.g., due to a clear() + * or negative increments), we'll use the + * zero bucket as both our min and max. + */ + minbin = maxbin = DTRACE_QUANTIZE_ZEROBUCKET; + } + + break; + + default: + continue; + } + + if (minmax[agg->dtagd_varid] == NULL) { + minmax[agg->dtagd_varid] = aggdata; + aggdata->dtada_flags |= DTRACE_A_MINMAXBIN; + aggdata->dtada_minbin = minbin; + aggdata->dtada_maxbin = maxbin; + continue; + } + + if (minbin < minmax[agg->dtagd_varid]->dtada_minbin) + minmax[agg->dtagd_varid]->dtada_minbin = minbin; + + if (maxbin > minmax[agg->dtagd_varid]->dtada_maxbin) + minmax[agg->dtagd_varid]->dtada_maxbin = maxbin; + } + + /* + * And now one final pass to set everyone's minbin and maxbin. + */ + for (h = hash->dtah_all; h != NULL; h = h->dtahe_nextall) { + dtrace_aggdata_t *aggdata = &h->dtahe_data, *mm; + dtrace_aggdesc_t *agg = aggdata->dtada_desc; + + if ((mm = minmax[agg->dtagd_varid]) == NULL || aggdata == mm) + continue; + + aggdata->dtada_minbin = mm->dtada_minbin; + aggdata->dtada_maxbin = mm->dtada_maxbin; + aggdata->dtada_flags |= DTRACE_A_MINMAXBIN; + } + + dt_free(dtp, minmax); + + return (0); +} + static int dt_aggregate_walk_sorted(dtrace_hdl_t *dtp, dtrace_aggregate_f *func, void *arg, @@ -1309,6 +1534,23 @@ dt_aggregate_walk_sorted(dtrace_hdl_t *dtp, dt_ahashent_t *h, **sorted; dt_ahash_t *hash = &agp->dtat_hash; size_t i, nentries = 0; + int rval = -1; + + agp->dtat_flags &= ~(DTRACE_A_TOTAL | DTRACE_A_MINMAXBIN); + + if (dtp->dt_options[DTRACEOPT_AGGHIST] != DTRACEOPT_UNSET) { + agp->dtat_flags |= DTRACE_A_TOTAL; + + if (dt_aggregate_total(dtp, B_FALSE) != 0) + return (-1); + } + + if (dtp->dt_options[DTRACEOPT_AGGPACK] != DTRACEOPT_UNSET) { + agp->dtat_flags |= DTRACE_A_MINMAXBIN; + + if (dt_aggregate_minmaxbin(dtp, B_FALSE) != 0) + return (-1); + } for (h = hash->dtah_all; h != NULL; h = h->dtahe_nextall) nentries++; @@ -1316,7 +1558,7 @@ dt_aggregate_walk_sorted(dtrace_hdl_t *dtp, sorted = dt_alloc(dtp, nentries * sizeof (dt_ahashent_t *)); if (sorted == NULL) - return (-1); + goto out; for (h = hash->dtah_all, i = 0; h != NULL; h = h->dtahe_nextall) sorted[i++] = h; @@ -1340,14 +1582,20 @@ dt_aggregate_walk_sorted(dtrace_hdl_t *dtp, for (i = 0; i < nentries; i++) { h = sorted[i]; - if (dt_aggwalk_rval(dtp, h, func(&h->dtahe_data, arg)) == -1) { - dt_free(dtp, sorted); - return (-1); - } + if (dt_aggwalk_rval(dtp, h, func(&h->dtahe_data, arg)) == -1) + goto out; } + rval = 0; +out: + if (agp->dtat_flags & DTRACE_A_TOTAL) + (void) dt_aggregate_total(dtp, B_TRUE); + + if (agp->dtat_flags & DTRACE_A_MINMAXBIN) + (void) dt_aggregate_minmaxbin(dtp, B_TRUE); + dt_free(dtp, sorted); - return (0); + return (rval); } int @@ -1870,6 +2118,8 @@ dtrace_aggregate_print(dtrace_hdl_t *dtp, FILE *fp, { dt_print_aggdata_t pd; + bzero(&pd, sizeof (pd)); + pd.dtpa_dtp = dtp; pd.dtpa_fp = fp; pd.dtpa_allunprint = 1; diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_as.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_as.c index 457b8fd7219..f937261c354 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_as.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_as.c @@ -23,8 +23,10 @@ * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ - -#pragma ident "%Z%%M% %I% %E% SMI" +/* + * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013 Joyent, Inc. All rights reserved. + */ #include #include @@ -125,7 +127,7 @@ dt_copyvar(dt_idhash_t *dhp, dt_ident_t *idp, void *data) dvp->dtdv_flags |= DIFV_F_MOD; bzero(&dn, sizeof (dn)); - dt_node_type_assign(&dn, idp->di_ctfp, idp->di_type); + dt_node_type_assign(&dn, idp->di_ctfp, idp->di_type, B_FALSE); dt_node_diftype(pcb->pcb_hdl, &dn, &dvp->dtdv_type); idp->di_flags &= ~(DT_IDFLG_DIFR | DT_IDFLG_DIFW); diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c index 64b98c4527b..35b8f0289b9 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, Joyent Inc. All rights reserved. + * Copyright (c) 2013, Joyent Inc. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. */ @@ -663,6 +663,8 @@ dt_action_printflike(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp, static void dt_action_trace(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp) { + int ctflib; + dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp); boolean_t istrace = (dnp->dn_ident->di_id == DT_ACT_TRACE); const char *act = istrace ? "trace" : "print"; @@ -694,7 +696,10 @@ dt_action_trace(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp) * like arrays and function pointers that can't be resolved by * ctf_type_lookup(). This is later processed by dtrace_dof_create() * and turned into a reference into the string table so that we can - * get the type information when we process the data after the fact. + * get the type information when we process the data after the fact. In + * the case where we are referring to userland CTF data, we also need to + * to identify which ctf container in question we care about and encode + * that within the name. */ if (dnp->dn_ident->di_id == DT_ACT_PRINT) { dt_node_t *dret; @@ -705,11 +710,27 @@ dt_action_trace(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp) dmp = dt_module_lookup_by_ctf(dtp, dret->dn_ctfp); n = snprintf(NULL, 0, "%s`%ld", dmp->dm_name, dret->dn_type) + 1; + if (dmp->dm_pid != 0) { + ctflib = dt_module_getlibid(dtp, dmp, dret->dn_ctfp); + assert(ctflib >= 0); + n = snprintf(NULL, 0, "%s`%d`%ld", dmp->dm_name, + ctflib, dret->dn_type) + 1; + } else { + n = snprintf(NULL, 0, "%s`%ld", dmp->dm_name, + dret->dn_type) + 1; + } sdp->dtsd_strdata = dt_alloc(dtp, n); if (sdp->dtsd_strdata == NULL) longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM); (void) snprintf(sdp->dtsd_strdata, n, "%s`%ld", dmp->dm_name, dret->dn_type); + if (dmp->dm_pid != 0) { + (void) snprintf(sdp->dtsd_strdata, n, "%s`%d`%ld", + dmp->dm_name, ctflib, dret->dn_type); + } else { + (void) snprintf(sdp->dtsd_strdata, n, "%s`%ld", + dmp->dm_name, dret->dn_type); + } } ap->dtad_difo = dt_as(yypcb); @@ -2268,12 +2289,15 @@ dt_load_libs_dir(dtrace_hdl_t *dtp, const char *path) dt_dprintf("skipping library %s, already processed " "library with the same name: %s", dp->d_name, dld->dtld_library); + (void) fclose(fp); continue; } dtp->dt_filetag = fname; - if (dt_lib_depend_add(dtp, &dtp->dt_lib_dep, fname) != 0) + if (dt_lib_depend_add(dtp, &dtp->dt_lib_dep, fname) != 0) { + (void) fclose(fp); return (-1); /* preserve dt_errno */ + } rv = dt_compile(dtp, DT_CTX_DPROG, DTRACE_PROBESPEC_NAME, NULL, @@ -2281,8 +2305,10 @@ dt_load_libs_dir(dtrace_hdl_t *dtp, const char *path) if (rv != NULL && dtp->dt_errno && (dtp->dt_errno != EDT_COMPILER || - dtp->dt_errtag != dt_errtag(D_PRAGMA_DEPEND))) + dtp->dt_errtag != dt_errtag(D_PRAGMA_DEPEND))) { + (void) fclose(fp); return (-1); /* preserve dt_errno */ + } if (dtp->dt_errno) dt_dprintf("error parsing library %s: %s\n", diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c index 8d9e49449ec..ae1ed0018fd 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c @@ -24,7 +24,7 @@ */ /* - * Copyright (c) 2011, Joyent, Inc. All rights reserved. + * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. */ @@ -59,6 +59,25 @@ dt_fabsl(long double x) return (x); } +static int +dt_ndigits(long long val) +{ + int rval = 1; + long long cmp = 10; + + if (val < 0) { + val = val == INT64_MIN ? INT64_MAX : -val; + rval++; + } + + while (val > cmp && cmp > 0) { + rval++; + cmp *= 10; + } + + return (rval < 4 ? 4 : rval); +} + /* * 128-bit arithmetic functions needed to support the stddev() aggregating * action. @@ -487,7 +506,125 @@ dt_nullrec() return (DTRACE_CONSUME_NEXT); } -int +static void +dt_quantize_total(dtrace_hdl_t *dtp, int64_t datum, long double *total) +{ + long double val = dt_fabsl((long double)datum); + + if (dtp->dt_options[DTRACEOPT_AGGZOOM] == DTRACEOPT_UNSET) { + *total += val; + return; + } + + /* + * If we're zooming in on an aggregation, we want the height of the + * highest value to be approximately 95% of total bar height -- so we + * adjust up by the reciprocal of DTRACE_AGGZOOM_MAX when comparing to + * our highest value. + */ + val *= 1 / DTRACE_AGGZOOM_MAX; + + if (*total < val) + *total = val; +} + +static int +dt_print_quanthdr(dtrace_hdl_t *dtp, FILE *fp, int width) +{ + return (dt_printf(dtp, fp, "\n%*s %41s %-9s\n", + width ? width : 16, width ? "key" : "value", + "------------- Distribution -------------", "count")); +} + +static int +dt_print_quanthdr_packed(dtrace_hdl_t *dtp, FILE *fp, int width, + const dtrace_aggdata_t *aggdata, dtrace_actkind_t action) +{ + int min = aggdata->dtada_minbin, max = aggdata->dtada_maxbin; + int minwidth, maxwidth, i; + + assert(action == DTRACEAGG_QUANTIZE || action == DTRACEAGG_LQUANTIZE); + + if (action == DTRACEAGG_QUANTIZE) { + if (min != 0 && min != DTRACE_QUANTIZE_ZEROBUCKET) + min--; + + if (max < DTRACE_QUANTIZE_NBUCKETS - 1) + max++; + + minwidth = dt_ndigits(DTRACE_QUANTIZE_BUCKETVAL(min)); + maxwidth = dt_ndigits(DTRACE_QUANTIZE_BUCKETVAL(max)); + } else { + maxwidth = 8; + minwidth = maxwidth - 1; + max++; + } + + if (dt_printf(dtp, fp, "\n%*s %*s .", + width, width > 0 ? "key" : "", minwidth, "min") < 0) + return (-1); + + for (i = min; i <= max; i++) { + if (dt_printf(dtp, fp, "-") < 0) + return (-1); + } + + return (dt_printf(dtp, fp, ". %*s | count\n", -maxwidth, "max")); +} + +/* + * We use a subset of the Unicode Block Elements (U+2588 through U+258F, + * inclusive) to represent aggregations via UTF-8 -- which are expressed via + * 3-byte UTF-8 sequences. + */ +#define DTRACE_AGGUTF8_FULL 0x2588 +#define DTRACE_AGGUTF8_BASE 0x258f +#define DTRACE_AGGUTF8_LEVELS 8 + +#define DTRACE_AGGUTF8_BYTE0(val) (0xe0 | ((val) >> 12)) +#define DTRACE_AGGUTF8_BYTE1(val) (0x80 | (((val) >> 6) & 0x3f)) +#define DTRACE_AGGUTF8_BYTE2(val) (0x80 | ((val) & 0x3f)) + +static int +dt_print_quantline_utf8(dtrace_hdl_t *dtp, FILE *fp, int64_t val, + uint64_t normal, long double total) +{ + uint_t len = 40, i, whole, partial; + long double f = (dt_fabsl((long double)val) * len) / total; + const char *spaces = " "; + + whole = (uint_t)f; + partial = (uint_t)((f - (long double)(uint_t)f) * + (long double)DTRACE_AGGUTF8_LEVELS); + + if (dt_printf(dtp, fp, "|") < 0) + return (-1); + + for (i = 0; i < whole; i++) { + if (dt_printf(dtp, fp, "%c%c%c", + DTRACE_AGGUTF8_BYTE0(DTRACE_AGGUTF8_FULL), + DTRACE_AGGUTF8_BYTE1(DTRACE_AGGUTF8_FULL), + DTRACE_AGGUTF8_BYTE2(DTRACE_AGGUTF8_FULL)) < 0) + return (-1); + } + + if (partial != 0) { + partial = DTRACE_AGGUTF8_BASE - (partial - 1); + + if (dt_printf(dtp, fp, "%c%c%c", + DTRACE_AGGUTF8_BYTE0(partial), + DTRACE_AGGUTF8_BYTE1(partial), + DTRACE_AGGUTF8_BYTE2(partial)) < 0) + return (-1); + + i++; + } + + return (dt_printf(dtp, fp, "%s %-9lld\n", spaces + i, + (long long)val / normal)); +} + +static int dt_print_quantline(dtrace_hdl_t *dtp, FILE *fp, int64_t val, uint64_t normal, long double total, char positives, char negatives) { @@ -505,6 +642,11 @@ dt_print_quantline(dtrace_hdl_t *dtp, FILE *fp, int64_t val, if (!negatives) { if (positives) { + if (dtp->dt_encoding == DT_ENCODING_UTF8) { + return (dt_print_quantline_utf8(dtp, fp, val, + normal, total)); + } + f = (dt_fabsl((long double)val) * len) / total; depth = (uint_t)(f + 0.5); } else { @@ -547,6 +689,73 @@ dt_print_quantline(dtrace_hdl_t *dtp, FILE *fp, int64_t val, } } +/* + * As with UTF-8 printing of aggregations, we use a subset of the Unicode + * Block Elements (U+2581 through U+2588, inclusive) to represent our packed + * aggregation. + */ +#define DTRACE_AGGPACK_BASE 0x2581 +#define DTRACE_AGGPACK_LEVELS 8 + +static int +dt_print_packed(dtrace_hdl_t *dtp, FILE *fp, + long double datum, long double total) +{ + static boolean_t utf8_checked = B_FALSE; + static boolean_t utf8; + char *ascii = "__xxxxXX"; + char *neg = "vvvvVV"; + unsigned int len; + long double val; + + if (!utf8_checked) { + char *term; + + /* + * We want to determine if we can reasonably emit UTF-8 for our + * packed aggregation. To do this, we will check for terminals + * that are known to be primitive to emit UTF-8 on these. + */ + utf8_checked = B_TRUE; + + if (dtp->dt_encoding == DT_ENCODING_ASCII) { + utf8 = B_FALSE; + } else if (dtp->dt_encoding == DT_ENCODING_UTF8) { + utf8 = B_TRUE; + } else if ((term = getenv("TERM")) != NULL && + (strcmp(term, "sun") == 0 || + strcmp(term, "sun-color") == 0) || + strcmp(term, "dumb") == 0) { + utf8 = B_FALSE; + } else { + utf8 = B_TRUE; + } + } + + if (datum == 0) + return (dt_printf(dtp, fp, " ")); + + if (datum < 0) { + len = strlen(neg); + val = dt_fabsl(datum * (len - 1)) / total; + return (dt_printf(dtp, fp, "%c", neg[(uint_t)(val + 0.5)])); + } + + if (utf8) { + int block = DTRACE_AGGPACK_BASE + (unsigned int)(((datum * + (DTRACE_AGGPACK_LEVELS - 1)) / total) + 0.5); + + return (dt_printf(dtp, fp, "%c%c%c", + DTRACE_AGGUTF8_BYTE0(block), + DTRACE_AGGUTF8_BYTE1(block), + DTRACE_AGGUTF8_BYTE2(block))); + } + + len = strlen(ascii); + val = (datum * (len - 1)) / total; + return (dt_printf(dtp, fp, "%c", ascii[(uint_t)(val + 0.5)])); +} + int dt_print_quantize(dtrace_hdl_t *dtp, FILE *fp, const void *addr, size_t size, uint64_t normal) @@ -564,9 +773,9 @@ dt_print_quantize(dtrace_hdl_t *dtp, FILE *fp, const void *addr, if (first_bin == DTRACE_QUANTIZE_NBUCKETS - 1) { /* - * There isn't any data. This is possible if (and only if) - * negative increment values have been used. In this case, - * we'll print the buckets around 0. + * There isn't any data. This is possible if the aggregation + * has been clear()'d or if negative increment values have been + * used. Regardless, we'll print the buckets around 0. */ first_bin = DTRACE_QUANTIZE_ZEROBUCKET - 1; last_bin = DTRACE_QUANTIZE_ZEROBUCKET + 1; @@ -584,11 +793,10 @@ dt_print_quantize(dtrace_hdl_t *dtp, FILE *fp, const void *addr, for (i = first_bin; i <= last_bin; i++) { positives |= (data[i] > 0); negatives |= (data[i] < 0); - total += dt_fabsl((long double)data[i]); + dt_quantize_total(dtp, data[i], &total); } - if (dt_printf(dtp, fp, "\n%16s %41s %-9s\n", "value", - "------------- Distribution -------------", "count") < 0) + if (dt_print_quanthdr(dtp, fp, 0) < 0) return (-1); for (i = first_bin; i <= last_bin; i++) { @@ -604,6 +812,48 @@ dt_print_quantize(dtrace_hdl_t *dtp, FILE *fp, const void *addr, return (0); } +int +dt_print_quantize_packed(dtrace_hdl_t *dtp, FILE *fp, const void *addr, + size_t size, const dtrace_aggdata_t *aggdata) +{ + const int64_t *data = addr; + long double total = 0, count = 0; + int min = aggdata->dtada_minbin, max = aggdata->dtada_maxbin, i; + int64_t minval, maxval; + + if (size != DTRACE_QUANTIZE_NBUCKETS * sizeof (uint64_t)) + return (dt_set_errno(dtp, EDT_DMISMATCH)); + + if (min != 0 && min != DTRACE_QUANTIZE_ZEROBUCKET) + min--; + + if (max < DTRACE_QUANTIZE_NBUCKETS - 1) + max++; + + minval = DTRACE_QUANTIZE_BUCKETVAL(min); + maxval = DTRACE_QUANTIZE_BUCKETVAL(max); + + if (dt_printf(dtp, fp, " %*lld :", dt_ndigits(minval), + (long long)minval) < 0) + return (-1); + + for (i = min; i <= max; i++) { + dt_quantize_total(dtp, data[i], &total); + count += data[i]; + } + + for (i = min; i <= max; i++) { + if (dt_print_packed(dtp, fp, data[i], total) < 0) + return (-1); + } + + if (dt_printf(dtp, fp, ": %*lld | %lld\n", + -dt_ndigits(maxval), (long long)maxval, (long long)count) < 0) + return (-1); + + return (0); +} + int dt_print_lquantize(dtrace_hdl_t *dtp, FILE *fp, const void *addr, size_t size, uint64_t normal) @@ -651,7 +901,7 @@ dt_print_lquantize(dtrace_hdl_t *dtp, FILE *fp, const void *addr, for (i = first_bin; i <= last_bin; i++) { positives |= (data[i] > 0); negatives |= (data[i] < 0); - total += dt_fabsl((long double)data[i]); + dt_quantize_total(dtp, data[i], &total); } if (dt_printf(dtp, fp, "\n%16s %41s %-9s\n", "value", @@ -663,8 +913,7 @@ dt_print_lquantize(dtrace_hdl_t *dtp, FILE *fp, const void *addr, int err; if (i == 0) { - (void) snprintf(c, sizeof (c), "< %d", - base / (uint32_t)normal); + (void) snprintf(c, sizeof (c), "< %d", base); err = dt_printf(dtp, fp, "%16s ", c); } else if (i == levels + 1) { (void) snprintf(c, sizeof (c), ">= %d", @@ -683,6 +932,59 @@ dt_print_lquantize(dtrace_hdl_t *dtp, FILE *fp, const void *addr, return (0); } +/*ARGSUSED*/ +int +dt_print_lquantize_packed(dtrace_hdl_t *dtp, FILE *fp, const void *addr, + size_t size, const dtrace_aggdata_t *aggdata) +{ + const int64_t *data = addr; + long double total = 0, count = 0; + int min, max, base, err; + uint64_t arg; + uint16_t step, levels; + char c[32]; + unsigned int i; + + if (size < sizeof (uint64_t)) + return (dt_set_errno(dtp, EDT_DMISMATCH)); + + arg = *data++; + size -= sizeof (uint64_t); + + base = DTRACE_LQUANTIZE_BASE(arg); + step = DTRACE_LQUANTIZE_STEP(arg); + levels = DTRACE_LQUANTIZE_LEVELS(arg); + + if (size != sizeof (uint64_t) * (levels + 2)) + return (dt_set_errno(dtp, EDT_DMISMATCH)); + + min = 0; + max = levels + 1; + + if (min == 0) { + (void) snprintf(c, sizeof (c), "< %d", base); + err = dt_printf(dtp, fp, "%8s :", c); + } else { + err = dt_printf(dtp, fp, "%8d :", base + (min - 1) * step); + } + + if (err < 0) + return (-1); + + for (i = min; i <= max; i++) { + dt_quantize_total(dtp, data[i], &total); + count += data[i]; + } + + for (i = min; i <= max; i++) { + if (dt_print_packed(dtp, fp, data[i], total) < 0) + return (-1); + } + + (void) snprintf(c, sizeof (c), ">= %d", base + (levels * step)); + return (dt_printf(dtp, fp, ": %-8s | %lld\n", c, (long long)count)); +} + int dt_print_llquantize(dtrace_hdl_t *dtp, FILE *fp, const void *addr, size_t size, uint64_t normal) @@ -740,7 +1042,7 @@ dt_print_llquantize(dtrace_hdl_t *dtp, FILE *fp, const void *addr, for (i = first_bin; i <= last_bin; i++) { positives |= (data[i] > 0); negatives |= (data[i] < 0); - total += dt_fabsl((long double)data[i]); + dt_quantize_total(dtp, data[i], &total); } if (dt_printf(dtp, fp, "\n%16s %41s %-9s\n", "value", @@ -823,7 +1125,7 @@ dt_print_stddev(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr, } /*ARGSUSED*/ -int +static int dt_print_bytes(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr, size_t nbytes, int width, int quiet, int forceraw) { @@ -876,10 +1178,12 @@ dt_print_bytes(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr, if (j != nbytes) break; - if (quiet) + if (quiet) { return (dt_printf(dtp, fp, "%s", c)); - else - return (dt_printf(dtp, fp, " %-*s", width, c)); + } else { + return (dt_printf(dtp, fp, " %s%*s", + width < 0 ? " " : "", width, c)); + } } break; @@ -1793,10 +2097,83 @@ dt_trunc(dtrace_hdl_t *dtp, caddr_t base, dtrace_recdesc_t *rec) static int dt_print_datum(dtrace_hdl_t *dtp, FILE *fp, dtrace_recdesc_t *rec, - caddr_t addr, size_t size, uint64_t normal) + caddr_t addr, size_t size, const dtrace_aggdata_t *aggdata, + uint64_t normal, dt_print_aggdata_t *pd) { - int err; + int err, width; dtrace_actkind_t act = rec->dtrd_action; + boolean_t packed = pd->dtpa_agghist || pd->dtpa_aggpack; + dtrace_aggdesc_t *agg = aggdata->dtada_desc; + + static struct { + size_t size; + int width; + int packedwidth; + } *fmt, fmttab[] = { + { sizeof (uint8_t), 3, 3 }, + { sizeof (uint16_t), 5, 5 }, + { sizeof (uint32_t), 8, 8 }, + { sizeof (uint64_t), 16, 16 }, + { 0, -50, 16 } + }; + + if (packed && pd->dtpa_agghisthdr != agg->dtagd_varid) { + dtrace_recdesc_t *r; + + width = 0; + + /* + * To print our quantization header for either an agghist or + * aggpack aggregation, we need to iterate through all of our + * of our records to determine their width. + */ + for (r = rec; !DTRACEACT_ISAGG(r->dtrd_action); r++) { + for (fmt = fmttab; fmt->size && + fmt->size != r->dtrd_size; fmt++) + continue; + + width += fmt->packedwidth + 1; + } + + if (pd->dtpa_agghist) { + if (dt_print_quanthdr(dtp, fp, width) < 0) + return (-1); + } else { + if (dt_print_quanthdr_packed(dtp, fp, + width, aggdata, r->dtrd_action) < 0) + return (-1); + } + + pd->dtpa_agghisthdr = agg->dtagd_varid; + } + + if (pd->dtpa_agghist && DTRACEACT_ISAGG(act)) { + char positives = aggdata->dtada_flags & DTRACE_A_HASPOSITIVES; + char negatives = aggdata->dtada_flags & DTRACE_A_HASNEGATIVES; + int64_t val; + + assert(act == DTRACEAGG_SUM || act == DTRACEAGG_COUNT); + val = (long long)*((uint64_t *)addr); + + if (dt_printf(dtp, fp, " ") < 0) + return (-1); + + return (dt_print_quantline(dtp, fp, val, normal, + aggdata->dtada_total, positives, negatives)); + } + + if (pd->dtpa_aggpack && DTRACEACT_ISAGG(act)) { + switch (act) { + case DTRACEAGG_QUANTIZE: + return (dt_print_quantize_packed(dtp, + fp, addr, size, aggdata)); + case DTRACEAGG_LQUANTIZE: + return (dt_print_lquantize_packed(dtp, + fp, addr, size, aggdata)); + default: + break; + } + } switch (act) { case DTRACEACT_STACK: @@ -1839,28 +2216,33 @@ dt_print_datum(dtrace_hdl_t *dtp, FILE *fp, dtrace_recdesc_t *rec, break; } + for (fmt = fmttab; fmt->size && fmt->size != size; fmt++) + continue; + + width = packed ? fmt->packedwidth : fmt->width; + switch (size) { case sizeof (uint64_t): - err = dt_printf(dtp, fp, " %16lld", + err = dt_printf(dtp, fp, " %*lld", width, /* LINTED - alignment */ (long long)*((uint64_t *)addr) / normal); break; case sizeof (uint32_t): /* LINTED - alignment */ - err = dt_printf(dtp, fp, " %8d", *((uint32_t *)addr) / + err = dt_printf(dtp, fp, " %*d", width, *((uint32_t *)addr) / (uint32_t)normal); break; case sizeof (uint16_t): /* LINTED - alignment */ - err = dt_printf(dtp, fp, " %5d", *((uint16_t *)addr) / + err = dt_printf(dtp, fp, " %*d", width, *((uint16_t *)addr) / (uint32_t)normal); break; case sizeof (uint8_t): - err = dt_printf(dtp, fp, " %3d", *((uint8_t *)addr) / + err = dt_printf(dtp, fp, " %*d", width, *((uint8_t *)addr) / (uint32_t)normal); break; default: - err = dt_print_bytes(dtp, fp, addr, size, 50, 0, 0); + err = dt_print_bytes(dtp, fp, addr, size, width, 0, 0); break; } @@ -1881,6 +2263,9 @@ dt_print_aggs(const dtrace_aggdata_t **aggsdata, int naggvars, void *arg) caddr_t addr; size_t size; + pd->dtpa_agghist = (aggdata->dtada_flags & DTRACE_A_TOTAL); + pd->dtpa_aggpack = (aggdata->dtada_flags & DTRACE_A_MINMAXBIN); + /* * Iterate over each record description in the key, printing the traced * data, skipping the first datum (the tuple member created by the @@ -1897,7 +2282,8 @@ dt_print_aggs(const dtrace_aggdata_t **aggsdata, int naggvars, void *arg) break; } - if (dt_print_datum(dtp, fp, rec, addr, size, 1) < 0) + if (dt_print_datum(dtp, fp, rec, addr, + size, aggdata, 1, pd) < 0) return (-1); if (dt_buffered_flush(dtp, NULL, rec, aggdata, @@ -1920,7 +2306,8 @@ dt_print_aggs(const dtrace_aggdata_t **aggsdata, int naggvars, void *arg) assert(DTRACEACT_ISAGG(act)); normal = aggdata->dtada_normal; - if (dt_print_datum(dtp, fp, rec, addr, size, normal) < 0) + if (dt_print_datum(dtp, fp, rec, addr, + size, aggdata, normal, pd) < 0) return (-1); if (dt_buffered_flush(dtp, NULL, rec, aggdata, @@ -1931,8 +2318,10 @@ dt_print_aggs(const dtrace_aggdata_t **aggsdata, int naggvars, void *arg) agg->dtagd_flags |= DTRACE_AGD_PRINTED; } - if (dt_printf(dtp, fp, "\n") < 0) - return (-1); + if (!pd->dtpa_agghist && !pd->dtpa_aggpack) { + if (dt_printf(dtp, fp, "\n") < 0) + return (-1); + } if (dt_buffered_flush(dtp, NULL, NULL, aggdata, DTRACE_BUFDATA_AGGFORMAT | DTRACE_BUFDATA_AGGLAST) < 0) @@ -2401,7 +2790,7 @@ dt_consume_cpu(dtrace_hdl_t *dtp, FILE *fp, int cpu, } n = dt_print_bytes(dtp, fp, addr, - tracememsize, 33, quiet, 1); + tracememsize, -33, quiet, 1); tracememsize = 0; @@ -2434,7 +2823,7 @@ dt_consume_cpu(dtrace_hdl_t *dtp, FILE *fp, int cpu, break; default: n = dt_print_bytes(dtp, fp, addr, - rec->dtrd_size, 33, quiet, 0); + rec->dtrd_size, -33, quiet, 0); break; } diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_decl.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_decl.c index 871fdd53048..d717d569629 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_decl.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_decl.c @@ -21,7 +21,8 @@ */ /* * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013 Joyent, Inc. All rights reserved. * Use is subject to license terms. */ @@ -779,7 +780,7 @@ dt_decl_enumerator(char *s, dt_node_t *dnp) yyintdecimal = 0; dnp = dt_node_int(value); - dt_node_type_assign(dnp, dsp->ds_ctfp, dsp->ds_type); + dt_node_type_assign(dnp, dsp->ds_ctfp, dsp->ds_type, B_FALSE); if ((inp = malloc(sizeof (dt_idnode_t))) == NULL) longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM); @@ -821,6 +822,8 @@ dt_decl_type(dt_decl_t *ddp, dtrace_typeinfo_t *tip) char *name; int rv; + tip->dtt_flags = 0; + /* * Based on our current #include depth and decl stack depth, determine * which dynamic CTF module and scope to use when adding any new types. @@ -828,6 +831,9 @@ dt_decl_type(dt_decl_t *ddp, dtrace_typeinfo_t *tip) dmp = yypcb->pcb_idepth ? dtp->dt_cdefs : dtp->dt_ddefs; flag = yypcb->pcb_dstack.ds_next ? CTF_ADD_NONROOT : CTF_ADD_ROOT; + if (ddp->dd_attr & DT_DA_USER) + tip->dtt_flags = DTT_FL_USER; + /* * If we have already cached a CTF type for this decl, then we just * return the type information for the cached type. diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_decl.h b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_decl.h index 2933155c784..d3228757821 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_decl.h +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_decl.h @@ -23,12 +23,14 @@ * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013 Joyent, Inc. All rights reserved. + */ #ifndef _DT_DECL_H #define _DT_DECL_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include #include @@ -59,6 +61,7 @@ typedef struct dt_decl { #define DT_DA_RESTRICT 0x0040 /* qualify type as restrict */ #define DT_DA_VOLATILE 0x0080 /* qualify type as volatile */ #define DT_DA_PAREN 0x0100 /* parenthesis tag */ +#define DT_DA_USER 0x0200 /* user-land type specifier */ typedef enum dt_dclass { DT_DC_DEFAULT, /* no storage class specified */ diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dis.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dis.c index fff4235a6bc..c0af36420e0 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dis.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dis.c @@ -26,7 +26,8 @@ */ /* - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013 Joyent, Inc. All rights reserved. */ #include @@ -312,9 +313,10 @@ dt_dis_typestr(const dtrace_diftype_t *t, char *buf, size_t len) (void) snprintf(ckind, sizeof (ckind), "0x%x", t->dtdt_ckind); } - if (t->dtdt_flags & DIF_TF_BYREF) { - (void) snprintf(buf, len, "%s (%s) by ref (size %lu)", - kind, ckind, (ulong_t)t->dtdt_size); + if (t->dtdt_flags & (DIF_TF_BYREF | DIF_TF_BYUREF)) { + (void) snprintf(buf, len, "%s (%s) by %sref (size %lu)", + kind, ckind, (t->dtdt_flags & DIF_TF_BYUREF) ? "user " : "", + (ulong_t)t->dtdt_size); } else { (void) snprintf(buf, len, "%s (%s) (size %lu)", kind, ckind, (ulong_t)t->dtdt_size); diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_error.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_error.c index d8dbbabb3b2..2327ff75e4d 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_error.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_error.c @@ -111,7 +111,8 @@ static const struct { { EDT_BADAGGVAR, "Invalid aggregation variable identifier" }, { EDT_OVERSION, "Client requested deprecated version of library" }, { EDT_ENABLING_ERR, "Failed to enable probe" }, - { EDT_NOPROBES, "No probe sites found for declared provider" } + { EDT_NOPROBES, "No probe sites found for declared provider" }, + { EDT_CANTLOAD, "Failed to load module" }, }; static const int _dt_nerr = sizeof (_dt_errlist) / sizeof (_dt_errlist[0]); diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_grammar.y b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_grammar.y index 0c12623bc42..07790f4ebc2 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_grammar.y +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_grammar.y @@ -23,8 +23,10 @@ * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ - -#pragma ident "%Z%%M% %I% %E% SMI" +/* + * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013, Joyent, Inc. All rights reserved. + */ #include @@ -102,6 +104,7 @@ %token DT_KEY_TYPEDEF %token DT_KEY_UNION %token DT_KEY_UNSIGNED +%token DT_KEY_USERLAND %token DT_KEY_VOID %token DT_KEY_VOLATILE %token DT_KEY_WHILE @@ -633,6 +636,7 @@ type_specifier: DT_KEY_VOID { $$ = dt_decl_spec(CTF_K_INTEGER, DUP("void")); } | DT_KEY_DOUBLE { $$ = dt_decl_spec(CTF_K_FLOAT, DUP("double")); } | DT_KEY_SIGNED { $$ = dt_decl_attr(DT_DA_SIGNED); } | DT_KEY_UNSIGNED { $$ = dt_decl_attr(DT_DA_UNSIGNED); } + | DT_KEY_USERLAND { $$ = dt_decl_attr(DT_DA_USER); } | DT_KEY_STRING { $$ = dt_decl_spec(CTF_K_TYPEDEF, DUP("string")); } diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_ident.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_ident.c index 13adbb45e1a..5a2f0e4c1f5 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_ident.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_ident.c @@ -22,6 +22,8 @@ /* * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013 Joyent, Inc. All rights reserved. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -104,7 +106,7 @@ dt_idcook_sign(dt_node_t *dnp, dt_ident_t *idp, } } - dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type); + dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type, B_FALSE); } /* @@ -163,7 +165,7 @@ dt_idcook_assc(dt_node_t *dnp, dt_ident_t *idp, int argc, dt_node_t *args) if (argc != 0) isp->dis_args[argc - 1].dn_list = NULL; - dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type); + dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type, B_FALSE); } else { dt_idcook_sign(dnp, idp, argc, args, @@ -304,7 +306,7 @@ dt_idcook_func(dt_node_t *dnp, dt_ident_t *idp, int argc, dt_node_t *args) } dt_node_type_assign(&isp->dis_args[i], - dtt.dtt_ctfp, dtt.dtt_type); + dtt.dtt_ctfp, dtt.dtt_type, B_FALSE); } } @@ -391,7 +393,9 @@ dt_idcook_args(dt_node_t *dnp, dt_ident_t *idp, int argc, dt_node_t *ap) dt_node_type_assign(dnp, prp->pr_argv[ap->dn_value].dtt_ctfp, - prp->pr_argv[ap->dn_value].dtt_type); + prp->pr_argv[ap->dn_value].dtt_type, + prp->pr_argv[ap->dn_value].dtt_flags & DTT_FL_USER ? + B_TRUE : B_FALSE); } else if ((dxp = dt_xlator_lookup(dtp, nnp, xnp, DT_XLATE_FUZZY)) != NULL || ( @@ -419,7 +423,8 @@ dt_idcook_args(dt_node_t *dnp, dt_ident_t *idp, int argc, dt_node_t *ap) dnp->dn_ident->di_ctfp = xidp->di_ctfp; dnp->dn_ident->di_type = xidp->di_type; - dt_node_type_assign(dnp, DT_DYN_CTFP(dtp), DT_DYN_TYPE(dtp)); + dt_node_type_assign(dnp, DT_DYN_CTFP(dtp), DT_DYN_TYPE(dtp), + B_FALSE); } else { xyerror(D_ARGS_XLATOR, "translator for %s[%lld] from %s to %s " @@ -465,7 +470,7 @@ dt_idcook_regs(dt_node_t *dnp, dt_ident_t *idp, int argc, dt_node_t *ap) idp->di_ctfp = dtt.dtt_ctfp; idp->di_type = dtt.dtt_type; - dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type); + dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type, B_FALSE); } /*ARGSUSED*/ @@ -487,7 +492,7 @@ dt_idcook_type(dt_node_t *dnp, dt_ident_t *idp, int argc, dt_node_t *args) idp->di_type = dtt.dtt_type; } - dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type); + dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type, B_FALSE); } /*ARGSUSED*/ @@ -495,7 +500,7 @@ static void dt_idcook_thaw(dt_node_t *dnp, dt_ident_t *idp, int argc, dt_node_t *args) { if (idp->di_ctfp != NULL && idp->di_type != CTF_ERR) - dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type); + dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type, B_FALSE); } static void diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h index 2bae2208dea..b7abbc2fddc 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h @@ -146,6 +146,10 @@ typedef struct dt_module { caddr_t dm_reloc_offset; /* Symbol relocation offset. */ uintptr_t *dm_sec_offsets; #endif + pid_t dm_pid; /* pid for this module */ + uint_t dm_nctflibs; /* number of ctf children libraries */ + ctf_file_t **dm_libctfp; /* process library ctf pointers */ + char **dm_libctfn; /* names of process ctf containers */ } dt_module_t; #define DT_DM_LOADED 0x1 /* module symbol and type data is loaded */ @@ -189,6 +193,9 @@ typedef struct dt_print_aggdata { dtrace_aggvarid_t dtpa_id; /* aggregation variable of interest */ FILE *dtpa_fp; /* file pointer */ int dtpa_allunprint; /* print only unprinted aggregations */ + int dtpa_agghist; /* print aggregation as histogram */ + int dtpa_agghisthdr; /* aggregation histogram hdr printed */ + int dtpa_aggpack; /* pack quantized aggregations */ } dt_print_aggdata_t; typedef struct dt_dirpath { @@ -283,6 +290,7 @@ struct dtrace_hdl { uint_t dt_linktype; /* dtrace link output file type (see below) */ uint_t dt_xlatemode; /* dtrace translator linking mode (see below) */ uint_t dt_stdcmode; /* dtrace stdc compatibility mode (see below) */ + uint_t dt_encoding; /* dtrace output encoding (see below) */ uint_t dt_treedump; /* dtrace tree debug bitmap (see below) */ uint64_t dt_options[DTRACEOPT_MAX]; /* dtrace run-time options */ int dt_version; /* library version requested by client */ @@ -373,6 +381,14 @@ struct dtrace_hdl { #define DT_STDC_XS 2 /* K&R C: __STDC__ not defined */ #define DT_STDC_XT 3 /* ISO C + K&R C compat with ISO: __STDC__=0 */ +/* + * Values for the dt_encoding property, which is used to force a particular + * character encoding (overriding default behavior and/or automatic detection). + */ +#define DT_ENCODING_UNSET 0 +#define DT_ENCODING_ASCII 1 +#define DT_ENCODING_UTF8 2 + /* * Macro to test whether a given pass bit is set in the dt_treedump bit-vector. * If the bit for pass 'p' is set, the D compiler displays the parse tree for @@ -536,7 +552,8 @@ enum { EDT_BADAGGVAR, /* invalid aggregation variable identifier */ EDT_OVERSION, /* client is requesting deprecated version */ EDT_ENABLING_ERR, /* failed to enable probe */ - EDT_NOPROBES /* no probes sites for declared provider */ + EDT_NOPROBES, /* no probes sites for declared provider */ + EDT_CANTLOAD /* failed to load a module */ }; /* diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l index b31933ea2a6..032d3034d67 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l @@ -23,6 +23,10 @@ /* * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. */ +/* + * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013, Joyent, Inc. All rights reserved. + */ #include #include @@ -93,13 +97,17 @@ static void unput(int); %} %e 1500 /* maximum nodes */ -%p 3700 /* maximum positions */ +%p 4900 /* maximum positions */ %n 600 /* maximum states */ +%a 3000 /* maximum transitions */ %s S0 S1 S2 S3 S4 RGX_AGG "@"[a-zA-Z_][0-9a-zA-Z_]* RGX_PSPEC [-$:a-zA-Z_.?*\\\[\]!][-$:0-9a-zA-Z_.`?*\\\[\]!]* +RGX_ALTIDENT [a-zA-Z_][0-9a-zA-Z_]* +RGX_LMID LM[0-9a-fA-F]+` +RGX_MOD_IDENT [a-zA-Z_`][0-9a-z.A-Z_`]*` RGX_IDENT [a-zA-Z_`][0-9a-zA-Z_`]* RGX_INT ([0-9]+|0[xX][0-9A-Fa-f]+)[uU]?[lL]?[lL]? RGX_FP ([0-9]+("."?)[0-9]*|"."[0-9]+)((e|E)("+"|-)?[0-9]+)?[fFlL]? @@ -169,6 +177,7 @@ if (yypcb->pcb_token != 0) { typedef return (DT_KEY_TYPEDEF); union return (DT_KEY_UNION); unsigned return (DT_KEY_UNSIGNED); +userland return (DT_KEY_USERLAND); void return (DT_KEY_VOID); volatile return (DT_KEY_VOLATILE); while return (DT_KEY_WHILE); @@ -347,7 +356,9 @@ if (yypcb->pcb_token != 0) { return (DT_TOK_INT); } -{RGX_IDENT} { +{RGX_IDENT} | +{RGX_MOD_IDENT}{RGX_IDENT} | +{RGX_MOD_IDENT} { return (id_or_type(yytext)); } diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c index f31c6006990..2a432118c2e 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c @@ -230,9 +230,6 @@ prepare_elf32(dtrace_hdl_t *dtp, const dof_hdr_t *dof, dof_elf32_t *dep) #if defined(__arm__) /* XXX */ printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); -#elif defined(__ia64__) -/* XXX */ -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); #elif defined(__i386) || defined(__amd64) rel->r_offset = s->dofs_offset + dofr[j].dofr_offset; @@ -424,8 +421,6 @@ prepare_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, dof_elf64_t *dep) #ifdef DOODAD #if defined(__arm__) /* XXX */ -#elif defined(__ia64__) -/* XXX */ #elif defined(__mips__) /* XXX */ #elif defined(__powerpc__) @@ -535,8 +530,6 @@ dump_elf32(dtrace_hdl_t *dtp, const dof_hdr_t *dof, int fd) elf_file.ehdr.e_type = ET_REL; #if defined(__arm__) elf_file.ehdr.e_machine = EM_ARM; -#elif defined(__ia64__) - elf_file.ehdr.e_machine = EM_IA_64; #elif defined(__mips__) elf_file.ehdr.e_machine = EM_MIPS; #elif defined(__powerpc__) @@ -683,8 +676,6 @@ dump_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, int fd) elf_file.ehdr.e_type = ET_REL; #if defined(__arm__) elf_file.ehdr.e_machine = EM_ARM; -#elif defined(__ia64__) - elf_file.ehdr.e_machine = EM_IA_64; #elif defined(__mips__) elf_file.ehdr.e_machine = EM_MIPS; #elif defined(__powerpc__) @@ -814,15 +805,6 @@ dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela, printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); return (0); } -#elif defined(__ia64__) -/* XXX */ -static int -dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela, - uint32_t *off) -{ -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); - return (0); -} #elif defined(__mips__) /* XXX */ static int @@ -1235,9 +1217,7 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *eprobesp) if (dtp->dt_oflags & DTRACE_O_LP64) { eclass = ELFCLASS64; -#if defined(__ia64__) - emachine1 = emachine2 = EM_IA_64; -#elif defined(__mips__) +#if defined(__mips__) emachine1 = emachine2 = EM_MIPS; #elif defined(__powerpc__) emachine1 = emachine2 = EM_PPC64; @@ -1258,7 +1238,7 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *eprobesp) #elif defined(__sparc) emachine1 = EM_SPARC; emachine2 = EM_SPARC32PLUS; -#elif defined(__i386) || defined(__amd64) || defined(__ia64__) +#elif defined(__i386) || defined(__amd64) emachine1 = emachine2 = EM_386; #endif symsize = sizeof (Elf32_Sym); diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c index 497faa99587..e3905c1ff45 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c @@ -22,6 +22,9 @@ /* * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. */ +/* + * Copyright (c) 2013, Joyent, Inc. All rights reserved. + */ #include #if defined(sun) @@ -50,6 +53,7 @@ #include #if !defined(sun) #include +#include #endif #include @@ -462,6 +466,9 @@ static const dt_modops_t dt_modops_64 = { dt_module_t * dt_module_create(dtrace_hdl_t *dtp, const char *name) { + long pid; + char *eptr; + dt_ident_t *idp; uint_t h = dt_strtab_hash(name, NULL) % dtp->dt_modbuckets; dt_module_t *dmp; @@ -485,6 +492,32 @@ dt_module_create(dtrace_hdl_t *dtp, const char *name) else dmp->dm_ops = &dt_modops_32; + /* + * Modules for userland processes are special. They always refer to a + * specific process and have a copy of their CTF data from a specific + * instant in time. Any dt_module_t that begins with 'pid' is a module + * for a specific process, much like how any probe description that + * begins with 'pid' is special. pid123 refers to process 123. A module + * that is just 'pid' refers specifically to pid$target. This is + * generally done as D does not currently allow for macros to be + * evaluated when working with types. + */ + if (strncmp(dmp->dm_name, "pid", 3) == 0) { + errno = 0; + if (dmp->dm_name[3] == '\0') { + idp = dt_idhash_lookup(dtp->dt_macros, "target"); + if (idp != NULL && idp->di_id != 0) + dmp->dm_pid = idp->di_id; + } else { + pid = strtol(dmp->dm_name + 3, &eptr, 10); + if (errno == 0 && *eptr == '\0') + dmp->dm_pid = (pid_t)pid; + else + dt_dprintf("encountered malformed pid " + "module: %s\n", dmp->dm_name); + } + } + return (dmp); } @@ -554,12 +587,169 @@ dt_module_load_sect(dtrace_hdl_t *dtp, dt_module_t *dmp, ctf_sect_t *ctsp) return (0); } +typedef struct dt_module_cb_arg { + struct ps_prochandle *dpa_proc; + dtrace_hdl_t *dpa_dtp; + dt_module_t *dpa_dmp; + uint_t dpa_count; +} dt_module_cb_arg_t; + +/* ARGSUSED */ +static int +dt_module_load_proc_count(void *arg, const prmap_t *prmap, const char *obj) +{ + ctf_file_t *fp; + dt_module_cb_arg_t *dcp = arg; + + /* Try to grab a ctf container if it exists */ + fp = Pname_to_ctf(dcp->dpa_proc, obj); + if (fp != NULL) + dcp->dpa_count++; + return (0); +} + +/* ARGSUSED */ +static int +dt_module_load_proc_build(void *arg, const prmap_t *prmap, const char *obj) +{ + ctf_file_t *fp; + char buf[MAXPATHLEN], *p; + dt_module_cb_arg_t *dcp = arg; + int count = dcp->dpa_count; + Lmid_t lmid; + + fp = Pname_to_ctf(dcp->dpa_proc, obj); + if (fp == NULL) + return (0); + fp = ctf_dup(fp); + if (fp == NULL) + return (0); + dcp->dpa_dmp->dm_libctfp[count] = fp; + /* + * While it'd be nice to simply use objname here, because of our prior + * actions we'll always get a resolved object name to its on disk file. + * Like the pid provider, we need to tell a bit of a lie here. The type + * that the user thinks of is in terms of the libraries they requested, + * eg. libc.so.1, they don't care about the fact that it's + * libc_hwcap.so.1. + */ + (void) Pobjname(dcp->dpa_proc, prmap->pr_vaddr, buf, sizeof (buf)); + if ((p = strrchr(buf, '/')) == NULL) + p = buf; + else + p++; + + /* + * If for some reason we can't find a link map id for this module, which + * would be really quite weird. We instead just say the link map id is + * zero. + */ + if (Plmid(dcp->dpa_proc, prmap->pr_vaddr, &lmid) != 0) + lmid = 0; + + if (lmid == 0) + dcp->dpa_dmp->dm_libctfn[count] = strdup(p); + else + (void) asprintf(&dcp->dpa_dmp->dm_libctfn[count], + "LM%x`%s", lmid, p); + if (dcp->dpa_dmp->dm_libctfn[count] == NULL) + return (1); + ctf_setspecific(fp, dcp->dpa_dmp); + dcp->dpa_count++; + return (0); +} + +/* + * We've been asked to load data that belongs to another process. As such we're + * going to pgrab it at this instant, load everything that we might ever care + * about, and then drive on. The reason for this is that the process that we're + * interested in might be changing. As long as we have grabbed it, then this + * can't be a problem for us. + * + * For now, we're actually going to punt on most things and just try to get CTF + * data, nothing else. Basically this is only useful as a source of type + * information, we can't go and do the stacktrace lookups, etc. + */ +static int +dt_module_load_proc(dtrace_hdl_t *dtp, dt_module_t *dmp) +{ + struct ps_prochandle *p; + dt_module_cb_arg_t arg; + + /* + * Note that on success we do not release this hold. We must hold this + * for our life time. + */ + p = dt_proc_grab(dtp, dmp->dm_pid, 0, PGRAB_RDONLY | PGRAB_FORCE); + if (p == NULL) { + dt_dprintf("failed to grab pid: %d\n", (int)dmp->dm_pid); + return (dt_set_errno(dtp, EDT_CANTLOAD)); + } + dt_proc_lock(dtp, p); + + arg.dpa_proc = p; + arg.dpa_dtp = dtp; + arg.dpa_dmp = dmp; + arg.dpa_count = 0; + if (Pobject_iter_resolved(p, dt_module_load_proc_count, &arg) != 0) { + dt_dprintf("failed to iterate objects\n"); + dt_proc_release(dtp, p); + return (dt_set_errno(dtp, EDT_CANTLOAD)); + } + + if (arg.dpa_count == 0) { + dt_dprintf("no ctf data present\n"); + dt_proc_unlock(dtp, p); + dt_proc_release(dtp, p); + return (dt_set_errno(dtp, EDT_CANTLOAD)); + } + + dmp->dm_libctfp = malloc(sizeof (ctf_file_t *) * arg.dpa_count); + if (dmp->dm_libctfp == NULL) { + dt_proc_unlock(dtp, p); + dt_proc_release(dtp, p); + return (dt_set_errno(dtp, EDT_NOMEM)); + } + bzero(dmp->dm_libctfp, sizeof (ctf_file_t *) * arg.dpa_count); + + dmp->dm_libctfn = malloc(sizeof (char *) * arg.dpa_count); + if (dmp->dm_libctfn == NULL) { + free(dmp->dm_libctfp); + dt_proc_unlock(dtp, p); + dt_proc_release(dtp, p); + return (dt_set_errno(dtp, EDT_NOMEM)); + } + bzero(dmp->dm_libctfn, sizeof (char *) * arg.dpa_count); + + dmp->dm_nctflibs = arg.dpa_count; + + arg.dpa_count = 0; + if (Pobject_iter_resolved(p, dt_module_load_proc_build, &arg) != 0) { + dt_proc_unlock(dtp, p); + dt_module_unload(dtp, dmp); + dt_proc_release(dtp, p); + return (dt_set_errno(dtp, EDT_CANTLOAD)); + } + assert(arg.dpa_count == dmp->dm_nctflibs); + dt_dprintf("loaded %d ctf modules for pid %d\n", arg.dpa_count, + (int)dmp->dm_pid); + + dt_proc_unlock(dtp, p); + dt_proc_release(dtp, p); + dmp->dm_flags |= DT_DM_LOADED; + + return (0); +} + int dt_module_load(dtrace_hdl_t *dtp, dt_module_t *dmp) { if (dmp->dm_flags & DT_DM_LOADED) return (0); /* module is already loaded */ + if (dmp->dm_pid != 0) + return (dt_module_load_proc(dtp, dmp)); + dmp->dm_ctdata.cts_name = ".SUNW_ctf"; dmp->dm_ctdata.cts_type = SHT_PROGBITS; dmp->dm_ctdata.cts_flags = 0; @@ -645,6 +835,14 @@ dt_module_load(dtrace_hdl_t *dtp, dt_module_t *dmp) return (0); } +int +dt_module_hasctf(dtrace_hdl_t *dtp, dt_module_t *dmp) +{ + if (dmp->dm_pid != 0 && dmp->dm_nctflibs > 0) + return (1); + return (dt_module_getctf(dtp, dmp) != NULL); +} + ctf_file_t * dt_module_getctf(dtrace_hdl_t *dtp, dt_module_t *dmp) { @@ -718,6 +916,8 @@ dt_module_getctf(dtrace_hdl_t *dtp, dt_module_t *dmp) void dt_module_unload(dtrace_hdl_t *dtp, dt_module_t *dmp) { + int i; + ctf_close(dmp->dm_ctfp); dmp->dm_ctfp = NULL; @@ -733,6 +933,17 @@ dt_module_unload(dtrace_hdl_t *dtp, dt_module_t *dmp) } #endif + if (dmp->dm_libctfp != NULL) { + for (i = 0; i < dmp->dm_nctflibs; i++) { + ctf_close(dmp->dm_libctfp[i]); + free(dmp->dm_libctfn[i]); + } + free(dmp->dm_libctfp); + free(dmp->dm_libctfn); + dmp->dm_libctfp = NULL; + dmp->dm_nctflibs = 0; + } + bzero(&dmp->dm_ctdata, sizeof (ctf_sect_t)); bzero(&dmp->dm_symtab, sizeof (ctf_sect_t)); bzero(&dmp->dm_strtab, sizeof (ctf_sect_t)); @@ -778,6 +989,8 @@ dt_module_unload(dtrace_hdl_t *dtp, dt_module_t *dmp) (void) elf_end(dmp->dm_elf); dmp->dm_elf = NULL; + dmp->dm_pid = 0; + dmp->dm_flags &= ~DT_DM_LOADED; } @@ -866,6 +1079,34 @@ dt_module_modelname(dt_module_t *dmp) return ("32-bit"); } +/* ARGSUSED */ +int +dt_module_getlibid(dtrace_hdl_t *dtp, dt_module_t *dmp, const ctf_file_t *fp) +{ + int i; + + for (i = 0; i < dmp->dm_nctflibs; i++) { + if (dmp->dm_libctfp[i] == fp) + return (i); + } + + return (-1); +} + +/* ARGSUSED */ +ctf_file_t * +dt_module_getctflib(dtrace_hdl_t *dtp, dt_module_t *dmp, const char *name) +{ + int i; + + for (i = 0; i < dmp->dm_nctflibs; i++) { + if (strcmp(dmp->dm_libctfn[i], name) == 0) + return (dmp->dm_libctfp[i]); + } + + return (NULL); +} + /* * Update our module cache by adding an entry for the specified module 'name'. * We create the dt_module_t and populate it using /system/object//. @@ -1294,8 +1535,10 @@ dtrace_lookup_by_type(dtrace_hdl_t *dtp, const char *object, const char *name, dt_module_t *dmp; int found = 0; ctf_id_t id; - uint_t n; + uint_t n, i; int justone; + ctf_file_t *fp; + char *buf, *p, *q; uint_t mask = 0; /* mask of dt_module flags to match */ uint_t bits = 0; /* flag bits that must be present */ @@ -1310,7 +1553,6 @@ dtrace_lookup_by_type(dtrace_hdl_t *dtp, const char *object, const char *name, return (-1); /* dt_errno is set for us */ n = 1; justone = 1; - } else { if (object == DTRACE_OBJ_KMODS) mask = bits = DT_DM_KERNEL; @@ -1334,7 +1576,7 @@ dtrace_lookup_by_type(dtrace_hdl_t *dtp, const char *object, const char *name, * module. If our search was scoped to only one module then * return immediately leaving dt_errno unmodified. */ - if (dt_module_getctf(dtp, dmp) == NULL) { + if (dt_module_hasctf(dtp, dmp) == 0) { if (justone) return (-1); continue; @@ -1346,13 +1588,38 @@ dtrace_lookup_by_type(dtrace_hdl_t *dtp, const char *object, const char *name, * 'tip' and keep going in the hope that we will locate the * underlying structure definition. Otherwise just return. */ - if ((id = ctf_lookup_by_name(dmp->dm_ctfp, name)) != CTF_ERR) { + if (dmp->dm_pid == 0) { + id = ctf_lookup_by_name(dmp->dm_ctfp, name); + fp = dmp->dm_ctfp; + } else { + if ((p = strchr(name, '`')) != NULL) { + buf = strdup(name); + if (buf == NULL) + return (dt_set_errno(dtp, EDT_NOMEM)); + p = strchr(buf, '`'); + if ((q = strchr(p + 1, '`')) != NULL) + p = q; + *p = '\0'; + fp = dt_module_getctflib(dtp, dmp, buf); + if (fp == NULL || (id = ctf_lookup_by_name(fp, + p + 1)) == CTF_ERR) + id = CTF_ERR; + free(buf); + } else { + for (i = 0; i < dmp->dm_nctflibs; i++) { + fp = dmp->dm_libctfp[i]; + id = ctf_lookup_by_name(fp, name); + if (id != CTF_ERR) + break; + } + } + } + if (id != CTF_ERR) { tip->dtt_object = dmp->dm_name; - tip->dtt_ctfp = dmp->dm_ctfp; + tip->dtt_ctfp = fp; tip->dtt_type = id; - - if (ctf_type_kind(dmp->dm_ctfp, ctf_type_resolve( - dmp->dm_ctfp, id)) != CTF_K_FORWARD) + if (ctf_type_kind(fp, ctf_type_resolve(fp, id)) != + CTF_K_FORWARD) return (0); found++; @@ -1374,6 +1641,7 @@ dtrace_symbol_type(dtrace_hdl_t *dtp, const GElf_Sym *symp, tip->dtt_object = NULL; tip->dtt_ctfp = NULL; tip->dtt_type = CTF_ERR; + tip->dtt_flags = 0; if ((dmp = dt_module_lookup_by_name(dtp, sip->dts_object)) == NULL) return (dt_set_errno(dtp, EDT_NOMOD)); diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.h b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.h index 8334a2bb811..d103e028e42 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.h +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.h @@ -23,12 +23,13 @@ * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright (c) 2013, Joyent, Inc. All rights reserved. + */ #ifndef _DT_MODULE_H #define _DT_MODULE_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include #ifdef __cplusplus @@ -43,11 +44,16 @@ extern void dt_module_destroy(dtrace_hdl_t *, dt_module_t *); extern dt_module_t *dt_module_lookup_by_name(dtrace_hdl_t *, const char *); extern dt_module_t *dt_module_lookup_by_ctf(dtrace_hdl_t *, ctf_file_t *); +extern int dt_module_hasctf(dtrace_hdl_t *, dt_module_t *); extern ctf_file_t *dt_module_getctf(dtrace_hdl_t *, dt_module_t *); extern dt_ident_t *dt_module_extern(dtrace_hdl_t *, dt_module_t *, const char *, const dtrace_typeinfo_t *); extern const char *dt_module_modelname(dt_module_t *); +extern int dt_module_getlibid(dtrace_hdl_t *, dt_module_t *, + const ctf_file_t *); +extern ctf_file_t *dt_module_getctflib(dtrace_hdl_t *, dt_module_t *, + const char *); #ifdef __cplusplus } diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c index 92251d5f4f4..f6c140bdeec 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, Joyent, Inc. All rights reserved. + * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. */ @@ -122,8 +122,12 @@ #define DT_VERS_1_8_1 DT_VERSION_NUMBER(1, 8, 1) #define DT_VERS_1_9 DT_VERSION_NUMBER(1, 9, 0) #define DT_VERS_1_9_1 DT_VERSION_NUMBER(1, 9, 1) -#define DT_VERS_LATEST DT_VERS_1_9_1 -#define DT_VERS_STRING "Sun D 1.9.1" +#define DT_VERS_1_10 DT_VERSION_NUMBER(1, 10, 0) +#define DT_VERS_1_11 DT_VERSION_NUMBER(1, 11, 0) +#define DT_VERS_1_12 DT_VERSION_NUMBER(1, 12, 0) +#define DT_VERS_1_12_1 DT_VERSION_NUMBER(1, 12, 1) +#define DT_VERS_LATEST DT_VERS_1_12_1 +#define DT_VERS_STRING "Sun D 1.12.1" const dt_version_t _dtrace_versions[] = { DT_VERS_1_0, /* D API 1.0.0 (PSARC 2001/466) Solaris 10 FCS */ @@ -145,6 +149,10 @@ const dt_version_t _dtrace_versions[] = { DT_VERS_1_8_1, /* D API 1.8.1 */ DT_VERS_1_9, /* D API 1.9 */ DT_VERS_1_9_1, /* D API 1.9.1 */ + DT_VERS_1_10, /* D API 1.10 */ + DT_VERS_1_11, /* D API 1.11 */ + DT_VERS_1_12, /* D API 1.12 */ + DT_VERS_1_12_1, /* D API 1.12.1 */ 0 }; @@ -275,6 +283,8 @@ static const dt_ident_t _dtrace_globals[] = { &dt_idops_func, "uint64_t(uint64_t)" }, { "htons", DT_IDENT_FUNC, 0, DIF_SUBR_HTONS, DT_ATTR_EVOLCMN, DT_VERS_1_3, &dt_idops_func, "uint16_t(uint16_t)" }, +{ "getf", DT_IDENT_FUNC, 0, DIF_SUBR_GETF, DT_ATTR_STABCMN, DT_VERS_1_10, + &dt_idops_func, "file_t *(int)" }, { "gid", DT_IDENT_SCALAR, 0, DIF_VAR_GID, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "gid_t" }, { "id", DT_IDENT_SCALAR, 0, DIF_VAR_ID, DT_ATTR_STABCMN, DT_VERS_1_0, @@ -297,6 +307,8 @@ static const dt_ident_t _dtrace_globals[] = { DT_VERS_1_5, &dt_idops_func, "string(int, void *)" }, { "ipl", DT_IDENT_SCALAR, 0, DIF_VAR_IPL, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "uint_t" }, +{ "json", DT_IDENT_FUNC, 0, DIF_SUBR_JSON, DT_ATTR_STABCMN, DT_VERS_1_11, + &dt_idops_func, "string(const char *, const char *)" }, { "jstack", DT_IDENT_ACTFUNC, 0, DT_ACT_JSTACK, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_func, "stack(...)" }, { "lltostr", DT_IDENT_FUNC, 0, DIF_SUBR_LLTOSTR, DT_ATTR_STABCMN, DT_VERS_1_0, @@ -448,6 +460,8 @@ static const dt_ident_t _dtrace_globals[] = { &dt_idops_func, "string(const char *, const char *)" }, { "strtok", DT_IDENT_FUNC, 0, DIF_SUBR_STRTOK, DT_ATTR_STABCMN, DT_VERS_1_1, &dt_idops_func, "string(const char *, const char *)" }, +{ "strtoll", DT_IDENT_FUNC, 0, DIF_SUBR_STRTOLL, DT_ATTR_STABCMN, DT_VERS_1_11, + &dt_idops_func, "int64_t(const char *, [int])" }, { "substr", DT_IDENT_FUNC, 0, DIF_SUBR_SUBSTR, DT_ATTR_STABCMN, DT_VERS_1_1, &dt_idops_func, "string(const char *, int, [int])" }, { "sum", DT_IDENT_AGGFUNC, 0, DTRACEAGG_SUM, DT_ATTR_STABCMN, DT_VERS_1_0, @@ -1144,6 +1158,7 @@ dt_vopen(int version, int flags, int *errp, dtp->dt_linktype = DT_LTYP_ELF; dtp->dt_xlatemode = DT_XL_STATIC; dtp->dt_stdcmode = DT_STDC_XA; + dtp->dt_encoding = DT_ENCODING_UNSET; dtp->dt_version = version; dtp->dt_fd = dtfd; dtp->dt_ftfd = ftfd; diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c index c20d250d0b8..832af888446 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c @@ -25,6 +25,7 @@ */ /* + * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. */ @@ -336,6 +337,23 @@ dt_opt_linktype(dtrace_hdl_t *dtp, const char *arg, uintptr_t option) return (0); } +/*ARGSUSED*/ +static int +dt_opt_encoding(dtrace_hdl_t *dtp, const char *arg, uintptr_t option) +{ + if (arg == NULL) + return (dt_set_errno(dtp, EDT_BADOPTVAL)); + + if (strcmp(arg, "ascii") == 0) + dtp->dt_encoding = DT_ENCODING_ASCII; + else if (strcmp(arg, "utf8") == 0) + dtp->dt_encoding = DT_ENCODING_UTF8; + else + return (dt_set_errno(dtp, EDT_BADOPTVAL)); + + return (0); +} + /*ARGSUSED*/ static int dt_opt_evaltime(dtrace_hdl_t *dtp, const char *arg, uintptr_t option) @@ -928,6 +946,7 @@ static const dt_option_t _dtrace_ctoptions[] = { { "define", dt_opt_cpp_opts, (uintptr_t)"-D" }, { "droptags", dt_opt_droptags }, { "empty", dt_opt_cflags, DTRACE_C_EMPTY }, + { "encoding", dt_opt_encoding }, { "errtags", dt_opt_cflags, DTRACE_C_ETAGS }, { "evaltime", dt_opt_evaltime }, { "incdir", dt_opt_cpp_opts, (uintptr_t)"-I" }, @@ -988,11 +1007,14 @@ static const dt_option_t _dtrace_rtoptions[] = { * Dynamic run-time options. */ static const dt_option_t _dtrace_drtoptions[] = { + { "agghist", dt_opt_runtime, DTRACEOPT_AGGHIST }, + { "aggpack", dt_opt_runtime, DTRACEOPT_AGGPACK }, { "aggrate", dt_opt_rate, DTRACEOPT_AGGRATE }, { "aggsortkey", dt_opt_runtime, DTRACEOPT_AGGSORTKEY }, { "aggsortkeypos", dt_opt_runtime, DTRACEOPT_AGGSORTKEYPOS }, { "aggsortpos", dt_opt_runtime, DTRACEOPT_AGGSORTPOS }, { "aggsortrev", dt_opt_runtime, DTRACEOPT_AGGSORTREV }, + { "aggzoom", dt_opt_runtime, DTRACEOPT_AGGZOOM }, { "flowindent", dt_opt_runtime, DTRACEOPT_FLOWINDENT }, { "quiet", dt_opt_runtime, DTRACEOPT_QUIET }, { "rawbytes", dt_opt_runtime, DTRACEOPT_RAWBYTES }, diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c index 5b3be7de728..6ce3dadd4e8 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c @@ -22,8 +22,8 @@ /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2011, Joyent Inc. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013, Joyent Inc. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -197,7 +197,7 @@ dt_type_lookup(const char *s, dtrace_typeinfo_t *tip) { static const char delimiters[] = " \t\n\r\v\f*`"; dtrace_hdl_t *dtp = yypcb->pcb_hdl; - const char *p, *q, *end, *obj; + const char *p, *q, *r, *end, *obj; for (p = s, end = s + strlen(s); *p != '\0'; p = q) { while (isspace(*p)) @@ -225,8 +225,23 @@ dt_type_lookup(const char *s, dtrace_typeinfo_t *tip) bcopy(s, type, (size_t)(p - s)); bcopy(q + 1, type + (size_t)(p - s), strlen(q + 1) + 1); - if (strchr(q + 1, '`') != NULL) - return (dt_set_errno(dtp, EDT_BADSCOPE)); + /* + * There may be at most three delimeters. The second + * delimeter is usually used to distinguish the type + * within a given module, however, there could be a link + * map id on the scene in which case that delimeter + * would be the third. We determine presence of the lmid + * if it rouglhly meets the from LM[0-9] + */ + if ((r = strchr(q + 1, '`')) != NULL && + ((r = strchr(r + 1, '`')) != NULL)) { + if (strchr(r + 1, '`') != NULL) + return (dt_set_errno(dtp, + EDT_BADSCOPE)); + if (q[1] != 'L' || q[2] != 'M') + return (dt_set_errno(dtp, + EDT_BADSCOPE)); + } return (dtrace_lookup_by_type(dtp, object, type, tip)); } @@ -256,6 +271,7 @@ dt_type_pointer(dtrace_typeinfo_t *tip) ctf_file_t *ctfp = tip->dtt_ctfp; ctf_id_t type = tip->dtt_type; ctf_id_t base = ctf_type_resolve(ctfp, type); + uint_t bflags = tip->dtt_flags; dt_module_t *dmp; ctf_id_t ptr; @@ -287,6 +303,7 @@ dt_type_pointer(dtrace_typeinfo_t *tip) tip->dtt_object = dmp->dm_name; tip->dtt_ctfp = dmp->dm_ctfp; tip->dtt_type = ptr; + tip->dtt_flags = bflags; return (0); } @@ -390,7 +407,7 @@ void dt_node_promote(dt_node_t *lp, dt_node_t *rp, dt_node_t *dnp) { dt_type_promote(lp, rp, &dnp->dn_ctfp, &dnp->dn_type); - dt_node_type_assign(dnp, dnp->dn_ctfp, dnp->dn_type); + dt_node_type_assign(dnp, dnp->dn_ctfp, dnp->dn_type, B_FALSE); dt_node_attr_assign(dnp, dt_attr_min(lp->dn_attr, rp->dn_attr)); } @@ -659,7 +676,8 @@ dt_node_attr_assign(dt_node_t *dnp, dtrace_attribute_t attr) } void -dt_node_type_assign(dt_node_t *dnp, ctf_file_t *fp, ctf_id_t type) +dt_node_type_assign(dt_node_t *dnp, ctf_file_t *fp, ctf_id_t type, + boolean_t user) { ctf_id_t base = ctf_type_resolve(fp, type); uint_t kind = ctf_type_kind(fp, base); @@ -691,6 +709,9 @@ dt_node_type_assign(dt_node_t *dnp, ctf_file_t *fp, ctf_id_t type) type == DT_DYN_TYPE(yypcb->pcb_hdl)) dnp->dn_flags |= DT_NF_REF; + if (user) + dnp->dn_flags |= DT_NF_USERLAND; + dnp->dn_flags |= DT_NF_COOKED; dnp->dn_ctfp = fp; dnp->dn_type = type; @@ -728,6 +749,7 @@ size_t dt_node_type_size(const dt_node_t *dnp) { ctf_id_t base; + dtrace_hdl_t *dtp = yypcb->pcb_hdl; if (dnp->dn_kind == DT_NODE_STRING) return (strlen(dnp->dn_string) + 1); @@ -740,6 +762,20 @@ dt_node_type_size(const dt_node_t *dnp) if (ctf_type_kind(dnp->dn_ctfp, base) == CTF_K_FORWARD) return (0); + /* + * Here we have a 32-bit user pointer that is being used with a 64-bit + * kernel. When we're using it and its tagged as a userland reference -- + * then we need to keep it as a 32-bit pointer. However, if we are + * referring to it as a kernel address, eg. being used after a copyin() + * then we need to make sure that we actually return the kernel's size + * of a pointer, 8 bytes. + */ + if (ctf_type_kind(dnp->dn_ctfp, base) == CTF_K_POINTER && + ctf_getmodel(dnp->dn_ctfp) == CTF_MODEL_ILP32 && + !(dnp->dn_flags & DT_NF_USERLAND) && + dtp->dt_conf.dtc_ctfmodel == CTF_MODEL_LP64) + return (8); + return (ctf_type_size(dnp->dn_ctfp, dnp->dn_type)); } @@ -1226,7 +1262,7 @@ dt_node_int(uintmax_t value) if (value <= dtp->dt_ints[i].did_limit) { dt_node_type_assign(dnp, dtp->dt_ints[i].did_ctfp, - dtp->dt_ints[i].did_type); + dtp->dt_ints[i].did_type, B_FALSE); /* * If a prefix character is present in macro text, add @@ -1261,7 +1297,7 @@ dt_node_string(char *string) dnp = dt_node_alloc(DT_NODE_STRING); dnp->dn_op = DT_TOK_STRING; dnp->dn_string = string; - dt_node_type_assign(dnp, DT_STR_CTFP(dtp), DT_STR_TYPE(dtp)); + dt_node_type_assign(dnp, DT_STR_CTFP(dtp), DT_STR_TYPE(dtp), B_FALSE); return (dnp); } @@ -1337,7 +1373,8 @@ dt_node_type(dt_decl_t *ddp) dnp = dt_node_alloc(DT_NODE_TYPE); dnp->dn_op = DT_TOK_IDENT; dnp->dn_string = name; - dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type); + + dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type, dtt.dtt_flags); if (dtt.dtt_ctfp == dtp->dt_cdefs->dm_ctfp || dtt.dtt_ctfp == dtp->dt_ddefs->dm_ctfp) @@ -1581,7 +1618,8 @@ dt_node_decl(void) bzero(&idn, sizeof (dt_node_t)); if (idp != NULL && idp->di_type != CTF_ERR) - dt_node_type_assign(&idn, idp->di_ctfp, idp->di_type); + dt_node_type_assign(&idn, idp->di_ctfp, idp->di_type, + B_FALSE); else if (idp != NULL) (void) dt_ident_cook(&idn, idp, NULL); @@ -1791,7 +1829,7 @@ dt_node_offsetof(dt_decl_t *ddp, char *s) } bzero(&dn, sizeof (dn)); - dt_node_type_assign(&dn, dtt.dtt_ctfp, ctm.ctm_type); + dt_node_type_assign(&dn, dtt.dtt_ctfp, ctm.ctm_type, B_FALSE); if (dn.dn_flags & DT_NF_BITFIELD) { xyerror(D_OFFSETOF_BITFIELD, @@ -1847,7 +1885,8 @@ dt_node_op1(int op, dt_node_t *cp) } dt_node_type_assign(cp, dtp->dt_ddefs->dm_ctfp, - ctf_lookup_by_name(dtp->dt_ddefs->dm_ctfp, "size_t")); + ctf_lookup_by_name(dtp->dt_ddefs->dm_ctfp, "size_t"), + B_FALSE); cp->dn_kind = DT_NODE_INT; cp->dn_op = DT_TOK_INT; @@ -1925,17 +1964,17 @@ dt_node_op2(int op, dt_node_t *lp, dt_node_t *rp) case DT_TOK_LOR: dnp->dn_value = l || r; dt_node_type_assign(dnp, - DT_INT_CTFP(dtp), DT_INT_TYPE(dtp)); + DT_INT_CTFP(dtp), DT_INT_TYPE(dtp), B_FALSE); break; case DT_TOK_LXOR: dnp->dn_value = (l != 0) ^ (r != 0); dt_node_type_assign(dnp, - DT_INT_CTFP(dtp), DT_INT_TYPE(dtp)); + DT_INT_CTFP(dtp), DT_INT_TYPE(dtp), B_FALSE); break; case DT_TOK_LAND: dnp->dn_value = l && r; dt_node_type_assign(dnp, - DT_INT_CTFP(dtp), DT_INT_TYPE(dtp)); + DT_INT_CTFP(dtp), DT_INT_TYPE(dtp), B_FALSE); break; case DT_TOK_BOR: dnp->dn_value = l | r; @@ -1952,12 +1991,12 @@ dt_node_op2(int op, dt_node_t *lp, dt_node_t *rp) case DT_TOK_EQU: dnp->dn_value = l == r; dt_node_type_assign(dnp, - DT_INT_CTFP(dtp), DT_INT_TYPE(dtp)); + DT_INT_CTFP(dtp), DT_INT_TYPE(dtp), B_FALSE); break; case DT_TOK_NEQ: dnp->dn_value = l != r; dt_node_type_assign(dnp, - DT_INT_CTFP(dtp), DT_INT_TYPE(dtp)); + DT_INT_CTFP(dtp), DT_INT_TYPE(dtp), B_FALSE); break; case DT_TOK_LT: dt_node_promote(lp, rp, dnp); @@ -1966,7 +2005,7 @@ dt_node_op2(int op, dt_node_t *lp, dt_node_t *rp) else dnp->dn_value = l < r; dt_node_type_assign(dnp, - DT_INT_CTFP(dtp), DT_INT_TYPE(dtp)); + DT_INT_CTFP(dtp), DT_INT_TYPE(dtp), B_FALSE); break; case DT_TOK_LE: dt_node_promote(lp, rp, dnp); @@ -1975,7 +2014,7 @@ dt_node_op2(int op, dt_node_t *lp, dt_node_t *rp) else dnp->dn_value = l <= r; dt_node_type_assign(dnp, - DT_INT_CTFP(dtp), DT_INT_TYPE(dtp)); + DT_INT_CTFP(dtp), DT_INT_TYPE(dtp), B_FALSE); break; case DT_TOK_GT: dt_node_promote(lp, rp, dnp); @@ -1984,7 +2023,7 @@ dt_node_op2(int op, dt_node_t *lp, dt_node_t *rp) else dnp->dn_value = l > r; dt_node_type_assign(dnp, - DT_INT_CTFP(dtp), DT_INT_TYPE(dtp)); + DT_INT_CTFP(dtp), DT_INT_TYPE(dtp), B_FALSE); break; case DT_TOK_GE: dt_node_promote(lp, rp, dnp); @@ -1993,7 +2032,7 @@ dt_node_op2(int op, dt_node_t *lp, dt_node_t *rp) else dnp->dn_value = l >= r; dt_node_type_assign(dnp, - DT_INT_CTFP(dtp), DT_INT_TYPE(dtp)); + DT_INT_CTFP(dtp), DT_INT_TYPE(dtp), B_FALSE); break; case DT_TOK_LSH: dnp->dn_value = l << r; @@ -2234,7 +2273,7 @@ dt_node_inline(dt_node_t *expr) * until we have successfully cooked the right-hand expression, below. */ dnp = dt_node_alloc(DT_NODE_INLINE); - dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type); + dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type, B_FALSE); dt_node_attr_assign(dnp, _dtrace_defattr); if (dt_node_is_void(dnp)) { @@ -2389,7 +2428,8 @@ dt_node_member(dt_decl_t *ddp, char *name, dt_node_t *expr) dnp->dn_membexpr = expr; if (ddp != NULL) - dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type); + dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type, + dtt.dtt_flags); return (dnp); } @@ -2420,10 +2460,10 @@ dt_node_xlator(dt_decl_t *ddp, dt_decl_t *sdp, char *name, dt_node_t *members) } bzero(&sn, sizeof (sn)); - dt_node_type_assign(&sn, src.dtt_ctfp, src.dtt_type); + dt_node_type_assign(&sn, src.dtt_ctfp, src.dtt_type, B_FALSE); bzero(&dn, sizeof (dn)); - dt_node_type_assign(&dn, dst.dtt_ctfp, dst.dtt_type); + dt_node_type_assign(&dn, dst.dtt_ctfp, dst.dtt_type, B_FALSE); if (dt_xlator_lookup(dtp, &sn, &dn, DT_XLATE_EXACT) != NULL) { xyerror(D_XLATE_REDECL, @@ -2669,7 +2709,7 @@ dt_xcook_ident(dt_node_t *dnp, dt_idhash_t *dhp, uint_t idkind, int create) attr = dt_ident_cook(dnp, idp, NULL); else { dt_node_type_assign(dnp, - DT_DYN_CTFP(dtp), DT_DYN_TYPE(dtp)); + DT_DYN_CTFP(dtp), DT_DYN_TYPE(dtp), B_FALSE); attr = idp->di_attr; } @@ -2745,7 +2785,8 @@ dt_xcook_ident(dt_node_t *dnp, dt_idhash_t *dhp, uint_t idkind, int create) dnp->dn_ident = idp; dnp->dn_flags |= DT_NF_LVALUE; - dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type); + dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type, + dtt.dtt_flags); dt_node_attr_assign(dnp, _dtrace_symattr); if (uref) { @@ -2793,7 +2834,7 @@ dt_xcook_ident(dt_node_t *dnp, dt_idhash_t *dhp, uint_t idkind, int create) attr = dt_ident_cook(dnp, idp, NULL); else { dt_node_type_assign(dnp, - DT_DYN_CTFP(dtp), DT_DYN_TYPE(dtp)); + DT_DYN_CTFP(dtp), DT_DYN_TYPE(dtp), B_FALSE); attr = idp->di_attr; } @@ -2896,7 +2937,8 @@ dt_cook_op1(dt_node_t *dnp, uint_t idflags) xyerror(D_TYPE_ERR, "failed to lookup int64_t\n"); dt_ident_type_assign(cp->dn_ident, dtt.dtt_ctfp, dtt.dtt_type); - dt_node_type_assign(cp, dtt.dtt_ctfp, dtt.dtt_type); + dt_node_type_assign(cp, dtt.dtt_ctfp, dtt.dtt_type, + dtt.dtt_flags); } if (cp->dn_kind == DT_NODE_VAR) @@ -2913,7 +2955,8 @@ dt_cook_op1(dt_node_t *dnp, uint_t idflags) dnp->dn_ident = &dxp->dx_souid; dt_node_type_assign(dnp, - dnp->dn_ident->di_ctfp, dnp->dn_ident->di_type); + dnp->dn_ident->di_ctfp, dnp->dn_ident->di_type, + cp->dn_flags & DT_NF_USERLAND); break; } @@ -2933,7 +2976,8 @@ dt_cook_op1(dt_node_t *dnp, uint_t idflags) "cannot dereference non-pointer type\n"); } - dt_node_type_assign(dnp, cp->dn_ctfp, type); + dt_node_type_assign(dnp, cp->dn_ctfp, type, + cp->dn_flags & DT_NF_USERLAND); base = ctf_type_resolve(cp->dn_ctfp, type); kind = ctf_type_kind(cp->dn_ctfp, base); @@ -2990,7 +3034,8 @@ dt_cook_op1(dt_node_t *dnp, uint_t idflags) xyerror(D_OP_SCALAR, "operator %s requires an operand " "of scalar type\n", opstr(dnp->dn_op)); } - dt_node_type_assign(dnp, DT_INT_CTFP(dtp), DT_INT_TYPE(dtp)); + dt_node_type_assign(dnp, DT_INT_CTFP(dtp), DT_INT_TYPE(dtp), + B_FALSE); break; case DT_TOK_ADDROF: @@ -3023,10 +3068,8 @@ dt_cook_op1(dt_node_t *dnp, uint_t idflags) dt_node_type_name(cp, n, sizeof (n))); } - dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type); - - if (cp->dn_flags & DT_NF_USERLAND) - dnp->dn_flags |= DT_NF_USERLAND; + dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type, + cp->dn_flags & DT_NF_USERLAND); break; case DT_TOK_SIZEOF: @@ -3041,7 +3084,8 @@ dt_cook_op1(dt_node_t *dnp, uint_t idflags) } dt_node_type_assign(dnp, dtp->dt_ddefs->dm_ctfp, - ctf_lookup_by_name(dtp->dt_ddefs->dm_ctfp, "size_t")); + ctf_lookup_by_name(dtp->dt_ddefs->dm_ctfp, "size_t"), + B_FALSE); break; case DT_TOK_STRINGOF: @@ -3051,7 +3095,8 @@ dt_cook_op1(dt_node_t *dnp, uint_t idflags) "cannot apply stringof to a value of type %s\n", dt_node_type_name(cp, n, sizeof (n))); } - dt_node_type_assign(dnp, DT_STR_CTFP(dtp), DT_STR_TYPE(dtp)); + dt_node_type_assign(dnp, DT_STR_CTFP(dtp), DT_STR_TYPE(dtp), + cp->dn_flags & DT_NF_USERLAND); break; case DT_TOK_PREINC: @@ -3244,7 +3289,8 @@ dt_cook_op2(dt_node_t *dnp, uint_t idflags) "of scalar type\n", opstr(op)); } - dt_node_type_assign(dnp, DT_INT_CTFP(dtp), DT_INT_TYPE(dtp)); + dt_node_type_assign(dnp, DT_INT_CTFP(dtp), DT_INT_TYPE(dtp), + B_FALSE); dt_node_attr_assign(dnp, dt_attr_min(lp->dn_attr, rp->dn_attr)); break; @@ -3288,7 +3334,8 @@ dt_cook_op2(dt_node_t *dnp, uint_t idflags) rp->dn_op = DT_TOK_INT; rp->dn_value = (intmax_t)val; - dt_node_type_assign(rp, lp->dn_ctfp, lp->dn_type); + dt_node_type_assign(rp, lp->dn_ctfp, lp->dn_type, + B_FALSE); dt_node_attr_assign(rp, _dtrace_symattr); } @@ -3320,7 +3367,8 @@ dt_cook_op2(dt_node_t *dnp, uint_t idflags) dt_node_type_name(rp, n2, sizeof (n2))); } - dt_node_type_assign(dnp, DT_INT_CTFP(dtp), DT_INT_TYPE(dtp)); + dt_node_type_assign(dnp, DT_INT_CTFP(dtp), DT_INT_TYPE(dtp), + B_FALSE); dt_node_attr_assign(dnp, dt_attr_min(lp->dn_attr, rp->dn_attr)); break; @@ -3368,7 +3416,7 @@ dt_cook_op2(dt_node_t *dnp, uint_t idflags) dt_node_type_name(rp, n2, sizeof (n2))); } - dt_node_type_assign(dnp, ctfp, type); + dt_node_type_assign(dnp, ctfp, type, B_FALSE); dt_node_attr_assign(dnp, dt_attr_min(lp->dn_attr, rp->dn_attr)); if (uref) @@ -3509,7 +3557,7 @@ dt_cook_op2(dt_node_t *dnp, uint_t idflags) */ if (lp->dn_kind == DT_NODE_VAR && dt_ident_unref(lp->dn_ident)) { - dt_node_type_assign(lp, ctfp, type); + dt_node_type_assign(lp, ctfp, type, B_FALSE); dt_ident_type_assign(lp->dn_ident, ctfp, type); if (uref) { @@ -3723,7 +3771,7 @@ dt_cook_op2(dt_node_t *dnp, uint_t idflags) type = ctf_type_resolve(ctfp, m.ctm_type); kind = ctf_type_kind(ctfp, type); - dt_node_type_assign(dnp, ctfp, m.ctm_type); + dt_node_type_assign(dnp, ctfp, m.ctm_type, B_FALSE); dt_node_attr_assign(dnp, lp->dn_attr); if (op == DT_TOK_PTR && (kind != CTF_K_ARRAY || @@ -3849,7 +3897,8 @@ dt_cook_op2(dt_node_t *dnp, uint_t idflags) } dnp->dn_ident = dt_xlator_ident(dxp, lp->dn_ctfp, lp->dn_type); - dt_node_type_assign(dnp, DT_DYN_CTFP(dtp), DT_DYN_TYPE(dtp)); + dt_node_type_assign(dnp, DT_DYN_CTFP(dtp), DT_DYN_TYPE(dtp), + B_FALSE); dt_node_attr_assign(dnp, dt_attr_min(rp->dn_attr, dnp->dn_ident->di_attr)); break; @@ -4014,7 +4063,7 @@ dt_cook_op3(dt_node_t *dnp, uint_t idflags) "used in a conditional context\n"); } - dt_node_type_assign(dnp, ctfp, type); + dt_node_type_assign(dnp, ctfp, type, B_FALSE); dt_node_attr_assign(dnp, dt_attr_min(dnp->dn_expr->dn_attr, dt_attr_min(lp->dn_attr, rp->dn_attr))); @@ -4047,7 +4096,8 @@ dt_cook_aggregation(dt_node_t *dnp, uint_t idflags) dt_node_attr_assign(dnp, dt_ident_cook(dnp, dnp->dn_ident, &dnp->dn_aggtup)); } else { - dt_node_type_assign(dnp, DT_DYN_CTFP(dtp), DT_DYN_TYPE(dtp)); + dt_node_type_assign(dnp, DT_DYN_CTFP(dtp), DT_DYN_TYPE(dtp), + B_FALSE); dt_node_attr_assign(dnp, dnp->dn_ident->di_attr); } @@ -4249,7 +4299,8 @@ dt_cook_xlator(dt_node_t *dnp, uint_t idflags) } (void) dt_node_cook(mnp, DT_IDFLG_REF); - dt_node_type_assign(mnp, dxp->dx_dst_ctfp, ctm.ctm_type); + dt_node_type_assign(mnp, dxp->dx_dst_ctfp, ctm.ctm_type, + B_FALSE); attr = dt_attr_min(attr, mnp->dn_attr); if (dt_node_is_argcompat(mnp, mnp->dn_membexpr) == 0) { @@ -4268,7 +4319,7 @@ dt_cook_xlator(dt_node_t *dnp, uint_t idflags) dxp->dx_souid.di_attr = attr; dxp->dx_ptrid.di_attr = attr; - dt_node_type_assign(dnp, DT_DYN_CTFP(dtp), DT_DYN_TYPE(dtp)); + dt_node_type_assign(dnp, DT_DYN_CTFP(dtp), DT_DYN_TYPE(dtp), B_FALSE); dt_node_attr_assign(dnp, _dtrace_defattr); return (dnp); @@ -4561,7 +4612,9 @@ dt_node_diftype(dtrace_hdl_t *dtp, const dt_node_t *dnp, dtrace_diftype_t *tp) ctf_type_resolve(dnp->dn_ctfp, dnp->dn_type)); } - tp->dtdt_flags = (dnp->dn_flags & DT_NF_REF) ? DIF_TF_BYREF : 0; + tp->dtdt_flags = (dnp->dn_flags & DT_NF_REF) ? + (dnp->dn_flags & DT_NF_USERLAND) ? DIF_TF_BYUREF : + DIF_TF_BYREF : 0; tp->dtdt_pad = 0; tp->dtdt_size = ctf_type_size(dnp->dn_ctfp, dnp->dn_type); } diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.h b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.h index 6064efb2e65..38f21c9f2e9 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.h +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.h @@ -22,12 +22,14 @@ * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013 Joyent, Inc. All rights reserved. + */ #ifndef _DT_PARSER_H #define _DT_PARSER_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include @@ -223,7 +225,7 @@ extern void dt_node_list_free(dt_node_t **); extern void dt_node_link_free(dt_node_t **); extern void dt_node_attr_assign(dt_node_t *, dtrace_attribute_t); -extern void dt_node_type_assign(dt_node_t *, ctf_file_t *, ctf_id_t); +extern void dt_node_type_assign(dt_node_t *, ctf_file_t *, ctf_id_t, boolean_t); extern void dt_node_type_propagate(const dt_node_t *, dt_node_t *); extern const char *dt_node_type_name(const dt_node_t *, char *, size_t); extern size_t dt_node_type_size(const dt_node_t *); diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c index b145818db4d..c865a2df770 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c @@ -23,6 +23,9 @@ * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright (c) 2013, Joyent, Inc. All rights reserved. + */ #include #include @@ -35,6 +38,7 @@ #endif #include #include +#include #include #include @@ -43,6 +47,7 @@ #if !defined(sun) #include #endif +#include typedef struct dt_pid_probe { dtrace_hdl_t *dpp_dtp; @@ -827,3 +832,170 @@ dt_pid_create_probes_module(dtrace_hdl_t *dtp, dt_proc_t *dpr) return (ret); } + +/* + * libdtrace has a backroom deal with us to ask us for type information on + * behalf of pid provider probes when fasttrap doesn't return any type + * information. Instead we'll look up the module and see if there is type + * information available. However, if there is no type information available due + * to a lack of CTF data, then we want to make sure that DTrace still carries on + * in face of that. As such we don't have a meaningful exit code about failure. + * We emit information about why we failed to the dtrace debug log so someone + * can figure it out by asking nicely for DTRACE_DEBUG. + */ +void +dt_pid_get_types(dtrace_hdl_t *dtp, const dtrace_probedesc_t *pdp, + dtrace_argdesc_t *adp, int *nargs) +{ + dt_module_t *dmp; + ctf_file_t *fp; + ctf_funcinfo_t f; + ctf_id_t argv[32]; + GElf_Sym sym; +#if defined(sun) + prsyminfo_t si; +#else + void *si; +#endif + struct ps_prochandle *p; + int i, args; + char buf[DTRACE_ARGTYPELEN]; + const char *mptr; + char *eptr; + int ret = 0; + int argc = sizeof (argv) / sizeof (ctf_id_t); + Lmid_t lmid; + + /* Set up a potential outcome */ + args = *nargs; + *nargs = 0; + + /* + * If we don't have an entry or return probe then we can just stop right + * now as we don't have arguments for offset probes. + */ + if (strcmp(pdp->dtpd_name, "entry") != 0 && + strcmp(pdp->dtpd_name, "return") != 0) + return; + + dmp = dt_module_create(dtp, pdp->dtpd_provider); + if (dmp == NULL) { + dt_dprintf("failed to find module for %s\n", + pdp->dtpd_provider); + return; + } + if (dt_module_load(dtp, dmp) != 0) { + dt_dprintf("failed to load module for %s\n", + pdp->dtpd_provider); + return; + } + + /* + * We may be working with a module that doesn't have ctf. If that's the + * case then we just return now and move on with life. + */ + fp = dt_module_getctflib(dtp, dmp, pdp->dtpd_mod); + if (fp == NULL) { + dt_dprintf("no ctf container for %s\n", + pdp->dtpd_mod); + return; + } + p = dt_proc_grab(dtp, dmp->dm_pid, 0, PGRAB_RDONLY | PGRAB_FORCE); + if (p == NULL) { + dt_dprintf("failed to grab pid\n"); + return; + } + dt_proc_lock(dtp, p); + + /* + * Check to see if the D module has a link map ID and separate that out + * for properly interrogating libproc. + */ + if ((mptr = strchr(pdp->dtpd_mod, '`')) != NULL) { + if (strlen(pdp->dtpd_mod) < 3) { + dt_dprintf("found weird modname with linkmap, " + "aborting: %s\n", pdp->dtpd_mod); + goto out; + } + if (pdp->dtpd_mod[0] != 'L' || pdp->dtpd_mod[1] != 'M') { + dt_dprintf("missing leading 'LM', " + "aborting: %s\n", pdp->dtpd_mod); + goto out; + } + errno = 0; + lmid = strtol(pdp->dtpd_mod + 2, &eptr, 16); + if (errno == ERANGE || eptr != mptr) { + dt_dprintf("failed to parse out lmid, aborting: %s\n", + pdp->dtpd_mod); + goto out; + } + mptr++; + } else { + mptr = pdp->dtpd_mod; + lmid = 0; + } + + if (Pxlookup_by_name(p, lmid, mptr, pdp->dtpd_func, + &sym, &si) != 0) { + dt_dprintf("failed to find function %s in %s`%s\n", + pdp->dtpd_func, pdp->dtpd_provider, pdp->dtpd_mod); + goto out; + } +#if defined(sun) + if (ctf_func_info(fp, si.prs_id, &f) == CTF_ERR) { + dt_dprintf("failed to get ctf information for %s in %s`%s\n", + pdp->dtpd_func, pdp->dtpd_provider, pdp->dtpd_mod); + goto out; + } +#endif + + (void) snprintf(buf, sizeof (buf), "%s`%s", pdp->dtpd_provider, + pdp->dtpd_mod); + + if (strcmp(pdp->dtpd_name, "return") == 0) { + if (args < 2) + goto out; + + bzero(adp, sizeof (dtrace_argdesc_t)); + adp->dtargd_ndx = 0; + adp->dtargd_id = pdp->dtpd_id; + adp->dtargd_mapping = adp->dtargd_ndx; + /* + * We explicitly leave out the library here, we only care that + * it is some int. We are assuming that there is no ctf + * container in here that is lying about what an int is. + */ + (void) snprintf(adp->dtargd_native, DTRACE_ARGTYPELEN, + "user %s`%s", pdp->dtpd_provider, "int"); + adp++; + bzero(adp, sizeof (dtrace_argdesc_t)); + adp->dtargd_ndx = 1; + adp->dtargd_id = pdp->dtpd_id; + adp->dtargd_mapping = adp->dtargd_ndx; + ret = snprintf(adp->dtargd_native, DTRACE_ARGTYPELEN, + "userland "); + (void) ctf_type_qname(fp, f.ctc_return, adp->dtargd_native + + ret, DTRACE_ARGTYPELEN - ret, buf); + *nargs = 2; +#if defined(sun) + } else { + if (ctf_func_args(fp, si.prs_id, argc, argv) == CTF_ERR) + goto out; + + *nargs = MIN(args, f.ctc_argc); + for (i = 0; i < *nargs; i++, adp++) { + bzero(adp, sizeof (dtrace_argdesc_t)); + adp->dtargd_ndx = i; + adp->dtargd_id = pdp->dtpd_id; + adp->dtargd_mapping = adp->dtargd_ndx; + ret = snprintf(adp->dtargd_native, DTRACE_ARGTYPELEN, + "userland "); + (void) ctf_type_qname(fp, argv[i], adp->dtargd_native + + ret, DTRACE_ARGTYPELEN - ret, buf); + } +#endif + } +out: + dt_proc_unlock(dtp, p); + dt_proc_release(dtp, p); +} diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.h b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.h index 886e33d8339..4bf39c86458 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.h +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.h @@ -24,12 +24,13 @@ * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright (c) 2013, Joyent, Inc. All rights reserved. + */ #ifndef _DT_PID_H #define _DT_PID_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include #include @@ -57,6 +58,9 @@ extern int dt_pid_create_offset_probe(struct ps_prochandle *, dtrace_hdl_t *, extern int dt_pid_create_glob_offset_probes(struct ps_prochandle *, dtrace_hdl_t *, fasttrap_probe_spec_t *, const GElf_Sym *, const char *); +extern void dt_pid_get_types(dtrace_hdl_t *, const dtrace_probedesc_t *, + dtrace_argdesc_t *, int *); + #ifdef __cplusplus } #endif diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c index ccfa3da39df..fb8ea16289e 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c @@ -647,12 +647,16 @@ dtrace_print(dtrace_hdl_t *dtp, FILE *fp, const char *typename, dt_printarg_t pa; ctf_id_t id; dt_module_t *dmp; + ctf_file_t *ctfp; + int libid; /* * Split the fully-qualified type ID (module`id). This should * always be the format, but if for some reason we don't find the * expected value, return 0 to fall back to the generic trace() - * behavior. + * behavior. In the case of userland CTF modules this will actually be + * of the format (module`lib`id). This is due to the fact that those + * modules have multiple CTF containers which `lib` identifies. */ for (s = typename; *s != '\0' && *s != '`'; s++) ; @@ -663,6 +667,20 @@ dtrace_print(dtrace_hdl_t *dtp, FILE *fp, const char *typename, object = alloca(s - typename + 1); bcopy(typename, object, s - typename); object[s - typename] = '\0'; + dmp = dt_module_lookup_by_name(dtp, object); + if (dmp == NULL) + return (0); + + if (dmp->dm_pid != 0) { + libid = atoi(s + 1); + s = strchr(s + 1, '`'); + if (s == NULL || libid > dmp->dm_nctflibs) + return (0); + ctfp = dmp->dm_libctfp[libid]; + } else { + ctfp = dt_module_getctf(dtp, dmp); + } + id = atoi(s + 1); /* @@ -670,16 +688,13 @@ dtrace_print(dtrace_hdl_t *dtp, FILE *fp, const char *typename, * wrong and we can't resolve the ID, bail out and let trace() do the * work. */ - dmp = dt_module_lookup_by_name(dtp, object); - if (dmp == NULL || ctf_type_kind(dt_module_getctf(dtp, dmp), - id) == CTF_ERR) { + if (ctfp == NULL || ctf_type_kind(ctfp, id) == CTF_ERR) return (0); - } /* setup the print structure and kick off the main print routine */ pa.pa_dtp = dtp; pa.pa_addr = addr; - pa.pa_ctfp = dt_module_getctf(dtp, dmp); + pa.pa_ctfp = ctfp; pa.pa_nest = 0; pa.pa_depth = 0; pa.pa_file = fp; diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c index e4cbd210d4b..eeb8735f6f0 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c @@ -21,8 +21,8 @@ /* * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, Joyent, Inc. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013, Joyent, Inc. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. */ #if defined(sun) @@ -1075,7 +1075,7 @@ dt_printf_validate(dt_pfargv_t *pfv, uint_t flags, xyerror(D_TYPE_ERR, "failed to lookup agg type %s\n", aggtype); bzero(&aggnode, sizeof (aggnode)); - dt_node_type_assign(&aggnode, dtt.dtt_ctfp, dtt.dtt_type); + dt_node_type_assign(&aggnode, dtt.dtt_ctfp, dtt.dtt_type, B_FALSE); for (i = 0, j = 0; i < pfv->pfv_argc; i++, pfd = pfd->pfd_next) { const dt_pfconv_t *pfc = pfd->pfd_conv; diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c index 188ce0e0579..0f1bfe07b7b 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c @@ -23,8 +23,9 @@ * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ - -#pragma ident "%Z%%M% %I% %E% SMI" +/* + * Copyright (c) 2013, Joyent, Inc. All rights reserved. + */ #include #if defined(sun) @@ -45,6 +46,8 @@ #include #include #include +#include +#include static dt_provider_t * dt_provider_insert(dtrace_hdl_t *dtp, dt_provider_t *pvp, uint_t h) @@ -272,6 +275,21 @@ dt_probe_discover(dt_provider_t *pvp, const dtrace_probedesc_t *pdp) xc = i; nc++; + /* + * The pid provider believes in giving the kernel a break. No reason to + * give the kernel all the ctf containers that we're keeping ourselves + * just to get it back from it. So if we're coming from a pid provider + * probe and the kernel gave us no argument information we'll get some + * here. If for some crazy reason the kernel knows about our userland + * types then we just ignore this. + */ + if (xc == 0 && nc == 0 && + strncmp(pvp->pv_desc.dtvd_name, "pid", 3) == 0) { + nc = adc; + dt_pid_get_types(dtp, pdp, adv, &nc); + xc = nc; + } + /* * Now that we have discovered the number of native and translated * arguments from the argument descriptions, allocate a new probe ident @@ -318,7 +336,8 @@ dt_probe_discover(dt_provider_t *pvp, const dtrace_probedesc_t *pdp) dtt.dtt_type = CTF_ERR; } else { dt_node_type_assign(prp->pr_nargv[adp->dtargd_mapping], - dtt.dtt_ctfp, dtt.dtt_type); + dtt.dtt_ctfp, dtt.dtt_type, + dtt.dtt_flags & DTT_FL_USER ? B_TRUE : B_FALSE); } if (dtt.dtt_type != CTF_ERR && (adp->dtargd_xlate[0] == '\0' || @@ -337,7 +356,7 @@ dt_probe_discover(dt_provider_t *pvp, const dtrace_probedesc_t *pdp) dtt.dtt_type = CTF_ERR; } else { dt_node_type_assign(prp->pr_xargv[i], - dtt.dtt_ctfp, dtt.dtt_type); + dtt.dtt_ctfp, dtt.dtt_type, B_FALSE); } prp->pr_mapping[i] = adp->dtargd_mapping; @@ -638,7 +657,7 @@ dt_probe_tag(dt_probe_t *prp, uint_t argn, dt_node_t *dnp) bzero(dnp, sizeof (dt_node_t)); dnp->dn_kind = DT_NODE_TYPE; - dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type); + dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type, B_FALSE); dt_node_attr_assign(dnp, _dtrace_defattr); return (dnp); diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_xlator.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_xlator.c index 7ac0cc42f55..74bd4878613 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_xlator.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_xlator.c @@ -23,8 +23,10 @@ * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ - -#pragma ident "%Z%%M% %I% %E% SMI" +/* + * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013 Joyent, Inc. All rights reserved. + */ #include #include @@ -69,7 +71,7 @@ dt_xlator_create_member(const char *name, ctf_id_t type, ulong_t off, void *arg) enp->dn_op = DT_TOK_XLATE; enp->dn_xlator = dxp; enp->dn_xmember = mnp; - dt_node_type_assign(enp, dxp->dx_dst_ctfp, type); + dt_node_type_assign(enp, dxp->dx_dst_ctfp, type, B_FALSE); /* * For the member itself, we use a DT_NODE_MEMBER as usual with the @@ -83,7 +85,7 @@ dt_xlator_create_member(const char *name, ctf_id_t type, ulong_t off, void *arg) mnp->dn_membname = strdup(name); mnp->dn_membexpr = enp; - dt_node_type_assign(mnp, dxp->dx_dst_ctfp, type); + dt_node_type_assign(mnp, dxp->dx_dst_ctfp, type, B_FALSE); if (mnp->dn_membname == NULL) return (dt_set_errno(dtp, EDT_NOMEM)); @@ -318,7 +320,8 @@ dt_xlator_lookup(dtrace_hdl_t *dtp, dt_node_t *src, dt_node_t *dst, int flags) for (dxp = dt_list_next(&dtp->dt_xlators); dxp != NULL; dxp = dt_list_next(dxp)) { - dt_node_type_assign(&xn, dxp->dx_src_ctfp, dxp->dx_src_type); + dt_node_type_assign(&xn, dxp->dx_src_ctfp, dxp->dx_src_type, + B_FALSE); if (ctf_type_compat(dxp->dx_dst_ctfp, dxp->dx_dst_base, dst_ctfp, dst_base) && dt_node_is_argcompat(src, &xn)) goto out; diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h b/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h index b2e31086cf3..6f88e6d46c4 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h @@ -25,7 +25,8 @@ */ /* - * Copyright (c) 2011, Joyent, Inc. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013, Joyent, Inc. All rights reserved. */ #ifndef _DTRACE_H @@ -356,6 +357,12 @@ extern int dtrace_handle_setopt(dtrace_hdl_t *, #define DTRACE_A_PERCPU 0x0001 #define DTRACE_A_KEEPDELTA 0x0002 #define DTRACE_A_ANONYMOUS 0x0004 +#define DTRACE_A_TOTAL 0x0008 +#define DTRACE_A_MINMAXBIN 0x0010 +#define DTRACE_A_HASNEGATIVES 0x0020 +#define DTRACE_A_HASPOSITIVES 0x0040 + +#define DTRACE_AGGZOOM_MAX 0.95 /* height of max bar */ #define DTRACE_AGGWALK_ERROR -1 /* error while processing */ #define DTRACE_AGGWALK_NEXT 0 /* proceed to next element */ @@ -376,6 +383,10 @@ struct dtrace_aggdata { caddr_t dtada_delta; /* delta data, if available */ caddr_t *dtada_percpu; /* per CPU data, if avail */ caddr_t *dtada_percpu_delta; /* per CPU delta, if avail */ + int64_t dtada_total; /* per agg total, if avail */ + uint16_t dtada_minbin; /* minimum bin, if avail */ + uint16_t dtada_maxbin; /* maximum bin, if avail */ + uint32_t dtada_flags; /* flags */ }; typedef int dtrace_aggregate_f(const dtrace_aggdata_t *, void *); @@ -495,8 +506,11 @@ typedef struct dtrace_typeinfo { const char *dtt_object; /* object containing type */ ctf_file_t *dtt_ctfp; /* CTF container handle */ ctf_id_t dtt_type; /* CTF type identifier */ + uint_t dtt_flags; /* Misc. flags */ } dtrace_typeinfo_t; +#define DTT_FL_USER 0x1 /* user type */ + extern int dtrace_lookup_by_type(dtrace_hdl_t *, const char *, const char *, dtrace_typeinfo_t *); diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h index 24131d68e71..ef18b457e05 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h @@ -42,6 +42,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -607,13 +608,16 @@ typedef struct sendflags { /* show progress (ie. -v) */ boolean_t progress; + + /* WRITE_EMBEDDED records of type DATA are permitted */ + boolean_t embed_data; } sendflags_t; typedef boolean_t (snapfilter_cb_t)(zfs_handle_t *, void *); extern int zfs_send(zfs_handle_t *, const char *, const char *, sendflags_t *, int, snapfilter_cb_t, void *, nvlist_t **); -extern int zfs_send_one(zfs_handle_t *, const char *, int); +extern int zfs_send_one(zfs_handle_t *, const char *, int, enum lzc_send_flags); extern int zfs_promote(zfs_handle_t *); extern int zfs_hold(zfs_handle_t *, const char *, const char *, diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c index 3c8119de533..a3f6129876c 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c @@ -72,16 +72,23 @@ zcmd_ioctl(int fd, int request, zfs_cmd_t *zc) if (zfs_ioctl_version == ZFS_IOCVER_UNDEF) zfs_ioctl_version = get_zfs_ioctl_version(); - if (zfs_ioctl_version == ZFS_IOCVER_LZC) - cflag = ZFS_CMD_COMPAT_LZC; - else if (zfs_ioctl_version == ZFS_IOCVER_DEADMAN) - cflag = ZFS_CMD_COMPAT_DEADMAN; - - /* - * If vfs.zfs.version.ioctl is not defined, assume we have v28 - * compatible binaries and use vfs.zfs.version.spa to test for v15 - */ - if (zfs_ioctl_version < ZFS_IOCVER_DEADMAN) { + if (zfs_ioctl_version >= ZFS_IOCVER_DEADMAN) { + switch (zfs_ioctl_version) { + case ZFS_IOCVER_ZCMD: + cflag = ZFS_CMD_COMPAT_ZCMD; + break; + case ZFS_IOCVER_LZC: + cflag = ZFS_CMD_COMPAT_LZC; + break; + case ZFS_IOCVER_DEADMAN: + cflag = ZFS_CMD_COMPAT_DEADMAN; + break; + } + } else { + /* + * If vfs.zfs.version.ioctl is not defined, assume we have v28 + * compatible binaries and use vfs.zfs.version.spa to test for v15 + */ cflag = ZFS_CMD_COMPAT_V28; if (zfs_spa_version < 0) diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c index 11378a2c2f2..d7126bf77bb 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c @@ -22,7 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright (c) 2012 DEY Storage Systems, Inc. All rights reserved. * Copyright (c) 2011-2012 Pawel Jakub Dawidek . * All rights reserved. @@ -3873,7 +3873,6 @@ zfs_rename(zfs_handle_t *zhp, const char *source, const char *target, strcmp(property, "none") == 0)) { flags.nounmount = B_TRUE; } - if (flags.recurse) { parentname = zfs_strdup(zhp->zfs_hdl, zhp->zfs_name); @@ -3888,8 +3887,7 @@ zfs_rename(zfs_handle_t *zhp, const char *source, const char *target, ret = -1; goto error; } - - } else { + } else if (zhp->zfs_type != ZFS_TYPE_SNAPSHOT) { if ((cl = changelist_gather(zhp, ZFS_PROP_NAME, flags.nounmount ? CL_GATHER_DONT_UNMOUNT : 0, flags.forceunmount ? MS_FORCE : 0)) == NULL) { @@ -3941,23 +3939,23 @@ zfs_rename(zfs_handle_t *zhp, const char *source, const char *target, * On failure, we still want to remount any filesystems that * were previously mounted, so we don't alter the system state. */ - if (!flags.recurse) + if (cl != NULL) (void) changelist_postfix(cl); } else { - if (!flags.recurse) { + if (cl != NULL) { changelist_rename(cl, zfs_get_name(zhp), target); ret = changelist_postfix(cl); } } error: - if (parentname) { + if (parentname != NULL) { free(parentname); } - if (zhrp) { + if (zhrp != NULL) { zfs_close(zhrp); } - if (cl) { + if (cl != NULL) { changelist_free(cl); } return (ret); diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c index e53a8cdf94a..868961d96d6 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c @@ -94,6 +94,7 @@ typedef struct pool_list { static char * get_devid(const char *path) { +#ifdef have_devid int fd; ddi_devid_t devid; char *minor, *ret; @@ -113,6 +114,9 @@ get_devid(const char *path) (void) close(fd); return (ret); +#else + return (NULL); +#endif } diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c index b2959dd1b84..f8596ede3ba 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014 by Delphix. All rights reserved. */ /* @@ -736,16 +737,6 @@ zfs_share_proto(zfs_handle_t *zhp, zfs_share_proto_t *proto) if (!zfs_is_mountable(zhp, mountpoint, sizeof (mountpoint), NULL)) return (0); -#ifdef sun - if ((ret = zfs_init_libshare(hdl, SA_INIT_SHARE_API)) != SA_OK) { - (void) zfs_error_fmt(hdl, EZFS_SHARENFSFAILED, - dgettext(TEXT_DOMAIN, "cannot share '%s': %s"), - zfs_get_name(zhp), _sa_errorstr != NULL ? - _sa_errorstr(ret) : ""); - return (-1); - } -#endif - for (curr_proto = proto; *curr_proto != PROTO_END; curr_proto++) { /* * Return success if there are no share options. @@ -756,6 +747,17 @@ zfs_share_proto(zfs_handle_t *zhp, zfs_share_proto_t *proto) strcmp(shareopts, "off") == 0) continue; +#ifdef illumos + ret = zfs_init_libshare(hdl, SA_INIT_SHARE_API); + if (ret != SA_OK) { + (void) zfs_error_fmt(hdl, EZFS_SHARENFSFAILED, + dgettext(TEXT_DOMAIN, "cannot share '%s': %s"), + zfs_get_name(zhp), _sa_errorstr != NULL ? + _sa_errorstr(ret) : ""); + return (-1); + } +#endif + /* * If the 'zoned' property is set, then zfs_is_mountable() * will have already bailed out if we are in the global zone. diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c index 8dd24a791f1..30b2d87ce66 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c @@ -22,7 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. */ @@ -303,6 +303,7 @@ zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf, size_t len, case ZPOOL_PROP_ALLOCATED: case ZPOOL_PROP_FREE: case ZPOOL_PROP_FREEING: + case ZPOOL_PROP_LEAKED: case ZPOOL_PROP_EXPANDSZ: if (literal) { (void) snprintf(buf, len, "%llu", @@ -321,6 +322,14 @@ zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf, size_t len, (u_longlong_t)intval); } break; + case ZPOOL_PROP_FRAGMENTATION: + if (intval == UINT64_MAX) { + (void) strlcpy(buf, "-", len); + } else { + (void) snprintf(buf, len, "%llu%%", + (u_longlong_t)intval); + } + break; case ZPOOL_PROP_DEDUPRATIO: (void) snprintf(buf, len, "%llu.%02llux", @@ -3324,6 +3333,7 @@ devid_to_path(char *devid_str) static char * path_to_devid(const char *path) { +#ifdef have_devid int fd; ddi_devid_t devid; char *minor, *ret; @@ -3343,6 +3353,9 @@ path_to_devid(const char *path) (void) close(fd); return (ret); +#else + return (NULL); +#endif } /* @@ -3508,7 +3521,7 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv, static int zbookmark_compare(const void *a, const void *b) { - return (memcmp(a, b, sizeof (zbookmark_t))); + return (memcmp(a, b, sizeof (zbookmark_phys_t))); } /* @@ -3520,7 +3533,7 @@ zpool_get_errlog(zpool_handle_t *zhp, nvlist_t **nverrlistp) { zfs_cmd_t zc = { 0 }; uint64_t count; - zbookmark_t *zb = NULL; + zbookmark_phys_t *zb = NULL; int i; /* @@ -3533,7 +3546,7 @@ zpool_get_errlog(zpool_handle_t *zhp, nvlist_t **nverrlistp) if (count == 0) return (0); if ((zc.zc_nvlist_dst = (uintptr_t)zfs_alloc(zhp->zpool_hdl, - count * sizeof (zbookmark_t))) == (uintptr_t)NULL) + count * sizeof (zbookmark_phys_t))) == (uintptr_t)NULL) return (-1); zc.zc_nvlist_dst_size = count; (void) strcpy(zc.zc_name, zhp->zpool_name); @@ -3542,11 +3555,14 @@ zpool_get_errlog(zpool_handle_t *zhp, nvlist_t **nverrlistp) &zc) != 0) { free((void *)(uintptr_t)zc.zc_nvlist_dst); if (errno == ENOMEM) { + void *dst; + count = zc.zc_nvlist_dst_size; - if ((zc.zc_nvlist_dst = (uintptr_t) - zfs_alloc(zhp->zpool_hdl, count * - sizeof (zbookmark_t))) == (uintptr_t)NULL) + dst = zfs_alloc(zhp->zpool_hdl, count * + sizeof (zbookmark_phys_t)); + if (dst == NULL) return (-1); + zc.zc_nvlist_dst = (uintptr_t)dst; } else { return (-1); } @@ -3562,11 +3578,11 @@ zpool_get_errlog(zpool_handle_t *zhp, nvlist_t **nverrlistp) * _not_ copied as part of the process. So we point the start of our * array appropriate and decrement the total number of elements. */ - zb = ((zbookmark_t *)(uintptr_t)zc.zc_nvlist_dst) + + zb = ((zbookmark_phys_t *)(uintptr_t)zc.zc_nvlist_dst) + zc.zc_nvlist_dst_size; count -= zc.zc_nvlist_dst_size; - qsort(zb, count, sizeof (zbookmark_t), zbookmark_compare); + qsort(zb, count, sizeof (zbookmark_phys_t), zbookmark_compare); verify(nvlist_alloc(nverrlistp, 0, KM_SLEEP) == 0); diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c index feddb694c32..97f18d7bb22 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright (c) 2012 Pawel Jakub Dawidek . * All rights reserved. @@ -45,6 +45,7 @@ #include #include +#include #include "zfs_namecheck.h" #include "zfs_prop.h" @@ -222,6 +223,7 @@ cksummer(void *arg) struct drr_object *drro = &thedrr.drr_u.drr_object; struct drr_write *drrw = &thedrr.drr_u.drr_write; struct drr_spill *drrs = &thedrr.drr_u.drr_spill; + struct drr_write_embedded *drrwe = &thedrr.drr_u.drr_write_embedded; FILE *ofp; int outfd; dmu_replay_record_t wbr_drr = {0}; @@ -418,6 +420,20 @@ cksummer(void *arg) break; } + case DRR_WRITE_EMBEDDED: + { + if (cksum_and_write(drr, sizeof (dmu_replay_record_t), + &stream_cksum, outfd) == -1) + goto out; + (void) ssread(buf, + P2ROUNDUP((uint64_t)drrwe->drr_psize, 8), ofp); + if (cksum_and_write(buf, + P2ROUNDUP((uint64_t)drrwe->drr_psize, 8), + &stream_cksum, outfd) == -1) + goto out; + break; + } + case DRR_FREE: { if (cksum_and_write(drr, sizeof (dmu_replay_record_t), @@ -799,7 +815,7 @@ typedef struct send_dump_data { char prevsnap[ZFS_MAXNAMELEN]; uint64_t prevsnap_obj; boolean_t seenfrom, seento, replicate, doall, fromorigin; - boolean_t verbose, dryrun, parsable, progress; + boolean_t verbose, dryrun, parsable, progress, embed_data; int outfd; boolean_t err; nvlist_t *fss; @@ -878,7 +894,8 @@ estimate_ioctl(zfs_handle_t *zhp, uint64_t fromsnap_obj, */ static int dump_ioctl(zfs_handle_t *zhp, const char *fromsnap, uint64_t fromsnap_obj, - boolean_t fromorigin, int outfd, nvlist_t *debugnv) + boolean_t fromorigin, int outfd, enum lzc_send_flags flags, + nvlist_t *debugnv) { zfs_cmd_t zc = { 0 }; libzfs_handle_t *hdl = zhp->zfs_hdl; @@ -892,6 +909,7 @@ dump_ioctl(zfs_handle_t *zhp, const char *fromsnap, uint64_t fromsnap_obj, zc.zc_obj = fromorigin; zc.zc_sendobj = zfs_prop_get_int(zhp, ZFS_PROP_OBJSETID); zc.zc_fromobj = fromsnap_obj; + zc.zc_flags = flags; VERIFY(0 == nvlist_alloc(&thisdbg, NV_UNIQUE_NAME, 0)); if (fromsnap && fromsnap[0] != '\0') { @@ -1144,8 +1162,12 @@ dump_snapshot(zfs_handle_t *zhp, void *arg) } } + enum lzc_send_flags flags = 0; + if (sdd->embed_data) + flags |= LZC_SEND_FLAG_EMBED_DATA; + err = dump_ioctl(zhp, sdd->prevsnap, sdd->prevsnap_obj, - fromorigin, sdd->outfd, sdd->debugnv); + fromorigin, sdd->outfd, flags, sdd->debugnv); if (sdd->progress) { (void) pthread_cancel(tid); @@ -1489,6 +1511,7 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap, sdd.parsable = flags->parsable; sdd.progress = flags->progress; sdd.dryrun = flags->dryrun; + sdd.embed_data = flags->embed_data; sdd.filter_cb = filter_func; sdd.filter_cb_arg = cb_arg; if (debugnvp) @@ -1620,7 +1643,8 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap, } int -zfs_send_one(zfs_handle_t *zhp, const char *from, int fd) +zfs_send_one(zfs_handle_t *zhp, const char *from, int fd, + enum lzc_send_flags flags) { int err; libzfs_handle_t *hdl = zhp->zfs_hdl; @@ -1629,7 +1653,7 @@ zfs_send_one(zfs_handle_t *zhp, const char *from, int fd) (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "warning: cannot send '%s'"), zhp->zfs_name); - err = lzc_send(zhp->zfs_name, from, fd); + err = lzc_send(zhp->zfs_name, from, fd, flags); if (err != 0) { switch (errno) { case EXDEV: @@ -2576,6 +2600,16 @@ recv_skip(libzfs_handle_t *hdl, int fd, boolean_t byteswap) (void) recv_read(hdl, fd, buf, drr->drr_u.drr_spill.drr_length, B_FALSE, NULL); break; + case DRR_WRITE_EMBEDDED: + if (byteswap) { + drr->drr_u.drr_write_embedded.drr_psize = + BSWAP_32(drr->drr_u.drr_write_embedded. + drr_psize); + } + (void) recv_read(hdl, fd, buf, + P2ROUNDUP(drr->drr_u.drr_write_embedded.drr_psize, + 8), B_FALSE, NULL); + break; case DRR_WRITE_BYREF: case DRR_FREEOBJECTS: case DRR_FREE: diff --git a/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c b/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c index 1c87223373b..cb38dc2d128 100644 --- a/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c +++ b/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c @@ -486,6 +486,8 @@ lzc_get_holds(const char *snapname, nvlist_t **holdsp) } /* + * Generate a zfs send stream for the specified snapshot and write it to + * the specified file descriptor. * * "snapname" is the full name of the snapshot to send (e.g. "pool/fs@snap") * @@ -499,9 +501,15 @@ lzc_get_holds(const char *snapname, nvlist_t **holdsp) * snapshot in the origin, etc. * * "fd" is the file descriptor to write the send stream to. + * + * If "flags" contains LZC_SEND_FLAG_EMBED_DATA, the stream is permitted + * to contain DRR_WRITE_EMBEDDED records with drr_etype==BP_EMBEDDED_TYPE_DATA, + * which the receiving system must support (as indicated by support + * for the "embedded_data" feature). */ int -lzc_send(const char *snapname, const char *from, int fd) +lzc_send(const char *snapname, const char *from, int fd, + enum lzc_send_flags flags) { nvlist_t *args; int err; @@ -510,6 +518,8 @@ lzc_send(const char *snapname, const char *from, int fd) fnvlist_add_int32(args, "fd", fd); if (from != NULL) fnvlist_add_string(args, "fromsnap", from); + if (flags & LZC_SEND_FLAG_EMBED_DATA) + fnvlist_add_boolean(args, "embedok"); err = lzc_ioctl(ZFS_IOC_SEND_NEW, snapname, args, NULL); nvlist_free(args); return (err); diff --git a/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h b/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h index 380560ff306..99883fecc13 100644 --- a/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h +++ b/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h @@ -53,7 +53,11 @@ int lzc_hold(nvlist_t *, int, nvlist_t **); int lzc_release(nvlist_t *, nvlist_t **); int lzc_get_holds(const char *, nvlist_t **); -int lzc_send(const char *, const char *, int); +enum lzc_send_flags { + LZC_SEND_FLAG_EMBED_DATA = 1 << 0 +}; + +int lzc_send(const char *, const char *, int, enum lzc_send_flags); int lzc_receive(const char *, nvlist_t *, const char *, boolean_t, int); int lzc_send_space(const char *, const char *, uint64_t *); diff --git a/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c b/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c index 2b174f9bed5..c61c5c2f5f0 100644 --- a/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c +++ b/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -52,6 +53,9 @@ char hw_serial[HW_HOSTID_LEN]; kmutex_t cpu_lock; #endif +/* If set, all blocks read will be copied to the specified directory. */ +char *vn_dumpdir = NULL; + struct utsname utsname = { "userland", "libzpool", "1", "1", "na" }; @@ -415,6 +419,7 @@ int vn_open(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2, int x3) { int fd; + int dump_fd; vnode_t *vp; int old_umask; char realpath[MAXPATHLEN]; @@ -463,6 +468,17 @@ vn_open(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2, int x3) if (flags & FCREAT) (void) umask(old_umask); + if (vn_dumpdir != NULL) { + char dumppath[MAXPATHLEN]; + (void) snprintf(dumppath, sizeof (dumppath), + "%s/%s", vn_dumpdir, basename(realpath)); + dump_fd = open64(dumppath, O_CREAT | O_WRONLY, 0666); + if (dump_fd == -1) + return (errno); + } else { + dump_fd = -1; + } + if (fd == -1) return (errno); @@ -478,6 +494,7 @@ vn_open(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2, int x3) vp->v_fd = fd; vp->v_size = st.st_size; vp->v_path = spa_strdup(path); + vp->v_dump_fd = dump_fd; return (0); } @@ -510,6 +527,11 @@ vn_rdwr(int uio, vnode_t *vp, void *addr, ssize_t len, offset_t offset, if (uio == UIO_READ) { iolen = pread64(vp->v_fd, addr, len, offset); + if (vp->v_dump_fd != -1) { + int status = + pwrite64(vp->v_dump_fd, addr, iolen, offset); + ASSERT(status != -1); + } } else { /* * To simulate partial disk writes, we split writes into two @@ -536,6 +558,8 @@ void vn_close(vnode_t *vp, int openflag, cred_t *cr, kthread_t *td) { close(vp->v_fd); + if (vp->v_dump_fd != -1) + close(vp->v_dump_fd); spa_strfree(vp->v_path); umem_free(vp, sizeof (vnode_t)); } diff --git a/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h b/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h index cc8285d2ea9..03027c35dc0 100644 --- a/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h +++ b/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h @@ -424,8 +424,10 @@ typedef struct vnode { uint64_t v_size; int v_fd; char *v_path; + int v_dump_fd; } vnode_t; +extern char *vn_dumpdir; #define AV_SCANSTAMP_SZ 32 /* length of anti-virus scanstamp */ typedef struct xoptattr { diff --git a/cddl/lib/libdtrace/ip.d b/cddl/lib/libdtrace/ip.d index b886a0ad254..a1a2996362f 100644 --- a/cddl/lib/libdtrace/ip.d +++ b/cddl/lib/libdtrace/ip.d @@ -125,53 +125,53 @@ typedef struct ipv6info { ip6_t *ipv6_hdr; /* pointer to raw header */ } ipv6info_t; -#pragma D binding "1.0" IPPROTO_IP +#pragma D binding "1.5" IPPROTO_IP inline short IPPROTO_IP = 0; -#pragma D binding "1.0" IPPROTO_ICMP +#pragma D binding "1.5" IPPROTO_ICMP inline short IPPROTO_ICMP = 1; -#pragma D binding "1.0" IPPROTO_IGMP +#pragma D binding "1.5" IPPROTO_IGMP inline short IPPROTO_IGMP = 2; -#pragma D binding "1.0" IPPROTO_IPV4 +#pragma D binding "1.5" IPPROTO_IPV4 inline short IPPROTO_IPV4 = 4; -#pragma D binding "1.0" IPPROTO_TCP +#pragma D binding "1.5" IPPROTO_TCP inline short IPPROTO_TCP = 6; -#pragma D binding "1.0" IPPROTO_UDP +#pragma D binding "1.5" IPPROTO_UDP inline short IPPROTO_UDP = 17; -#pragma D binding "1.0" IPPROTO_IPV6 +#pragma D binding "1.5" IPPROTO_IPV6 inline short IPPROTO_IPV6 = 41; -#pragma D binding "1.0" IPPROTO_ROUTING +#pragma D binding "1.5" IPPROTO_ROUTING inline short IPPROTO_ROUTING = 43; -#pragma D binding "1.0" IPPROTO_FRAGMENT +#pragma D binding "1.5" IPPROTO_FRAGMENT inline short IPPROTO_FRAGMENT = 44; -#pragma D binding "1.0" IPPROTO_RSVP +#pragma D binding "1.5" IPPROTO_RSVP inline short IPPROTO_RSVP = 46; -#pragma D binding "1.0" IPPROTO_GRE +#pragma D binding "1.5" IPPROTO_GRE inline short IPPROTO_GRE = 47; -#pragma D binding "1.0" IPPROTO_ESP +#pragma D binding "1.5" IPPROTO_ESP inline short IPPROTO_ESP = 50; -#pragma D binding "1.0" IPPROTO_AH +#pragma D binding "1.5" IPPROTO_AH inline short IPPROTO_AH = 51; -#pragma D binding "1.0" IPPROTO_MOBILE +#pragma D binding "1.5" IPPROTO_MOBILE inline short IPPROTO_MOBILE = 55; -#pragma D binding "1.0" IPPROTO_ICMPV6 +#pragma D binding "1.5" IPPROTO_ICMPV6 inline short IPPROTO_ICMPV6 = 58; -#pragma D binding "1.0" IPPROTO_DSTOPTS +#pragma D binding "1.5" IPPROTO_DSTOPTS inline short IPPROTO_DSTOPTS = 60; -#pragma D binding "1.0" IPPROTO_ETHERIP +#pragma D binding "1.5" IPPROTO_ETHERIP inline short IPPROTO_ETHERIP = 97; -#pragma D binding "1.0" IPPROTO_PIM +#pragma D binding "1.5" IPPROTO_PIM inline short IPPROTO_PIM = 103; -#pragma D binding "1.0" IPPROTO_IPCOMP +#pragma D binding "1.5" IPPROTO_IPCOMP inline short IPPROTO_IPCOMP = 108; -#pragma D binding "1.0" IPPROTO_SCTP +#pragma D binding "1.5" IPPROTO_SCTP inline short IPPROTO_SCTP = 132; -#pragma D binding "1.0" IPPROTO_RAW +#pragma D binding "1.5" IPPROTO_RAW inline short IPPROTO_RAW = 255; inline uint8_t INP_IPV4 = 0x01; inline uint8_t INP_IPV6 = 0x02; -#pragma D binding "1.0" protocols +#pragma D binding "1.5" protocols inline string protocols[int proto] = proto == IPPROTO_IP ? "IP" : proto == IPPROTO_ICMP ? "ICMP" : @@ -200,12 +200,12 @@ inline string protocols[int proto] = * This field is always NULL according to the current definition of the ip * probes. */ -#pragma D binding "1.0" translator +#pragma D binding "1.5" translator translator pktinfo_t < void *p > { pkt_addr = NULL; }; -#pragma D binding "1.0" translator +#pragma D binding "1.5" translator translator csinfo_t < void *p > { cs_addr = NULL; cs_cid = (uint64_t)p; @@ -213,7 +213,7 @@ translator csinfo_t < void *p > { cs_zoneid = 0; }; -#pragma D binding "1.0" translator +#pragma D binding "1.6.3" translator translator csinfo_t < struct inpcb *p > { cs_addr = NULL; cs_cid = (uint64_t)p; @@ -221,7 +221,7 @@ translator csinfo_t < struct inpcb *p > { cs_zoneid = 0; }; -#pragma D binding "1.0" translator +#pragma D binding "1.5" translator translator ipinfo_t < uint8_t *p > { ip_ver = p == NULL ? 0 : ((struct ip *)p)->ip_v; ip_plength = p == NULL ? 0 : @@ -238,17 +238,17 @@ translator ipinfo_t < uint8_t *p > { inet_ntoa6(&((struct ip6_hdr *)p)->ip6_dst); }; -#pragma D binding "1.0" IFF_LOOPBACK +#pragma D binding "1.5" IFF_LOOPBACK inline int IFF_LOOPBACK = 0x8; -#pragma D binding "1.0" translator +#pragma D binding "1.5" translator translator ifinfo_t < struct ifnet *p > { if_name = p->if_xname; if_local = (p->if_flags & IFF_LOOPBACK) == 0 ? 0 : 1; if_addr = (uintptr_t)p; }; -#pragma D binding "1.0" translator +#pragma D binding "1.5" translator translator ipv4info_t < struct ip *p > { ipv4_ver = p == NULL ? 0 : p->ip_v; ipv4_ihl = p == NULL ? 0 : p->ip_hl; @@ -268,7 +268,7 @@ translator ipv4info_t < struct ip *p > { ipv4_hdr = (ipha_t *)p; }; -#pragma D binding "1.0" translator +#pragma D binding "1.5" translator translator ipv6info_t < struct ip6_hdr *p > { ipv6_ver = p == NULL ? 0 : (ntohl(p->ip6_ctlun.ip6_un1.ip6_un1_flow) & 0xf0000000) >> 28; ipv6_tclass = p == NULL ? 0 : (ntohl(p->ip6_ctlun.ip6_un1.ip6_un1_flow) & 0x0ff00000) >> 20; diff --git a/cddl/lib/libdtrace/libproc_compat.h b/cddl/lib/libdtrace/libproc_compat.h index d796f34f48a..7e54ada6bf9 100644 --- a/cddl/lib/libdtrace/libproc_compat.h +++ b/cddl/lib/libdtrace/libproc_compat.h @@ -45,8 +45,10 @@ #define Pgrab_error strerror #define Plmid_to_map(p, l, o) proc_obj2map((p), (o)) #define Plookup_by_addr proc_addr2sym +#define Pname_to_ctf(p, obj) NULL #define Pname_to_map proc_name2map #define Pobject_iter proc_iter_objs +#define Pobject_iter_resolved(p, f, arg) 1 #define Pobjname proc_objname #define Pread proc_read #define Prd_agent proc_rdagent diff --git a/cddl/lib/libdtrace/tcp.d b/cddl/lib/libdtrace/tcp.d index 4204507dc3e..7695e222a08 100644 --- a/cddl/lib/libdtrace/tcp.d +++ b/cddl/lib/libdtrace/tcp.d @@ -31,49 +31,49 @@ /* * Convert a TCP state value to a string. */ -#pragma D binding "1.0" TCPS_CLOSED +#pragma D binding "1.6.3" TCPS_CLOSED inline int TCPS_CLOSED = 0; -#pragma D binding "1.0" TCPS_LISTEN +#pragma D binding "1.6.3" TCPS_LISTEN inline int TCPS_LISTEN = 1; -#pragma D binding "1.0" TCPS_SYN_SENT +#pragma D binding "1.6.3" TCPS_SYN_SENT inline int TCPS_SYN_SENT = 2; -#pragma D binding "1.0" TCPS_SYN_RECEIVED +#pragma D binding "1.6.3" TCPS_SYN_RECEIVED inline int TCPS_SYN_RECEIVED = 3; -#pragma D binding "1.0" TCPS_ESTABLISHED +#pragma D binding "1.6.3" TCPS_ESTABLISHED inline int TCPS_ESTABLISHED = 4; -#pragma D binding "1.0" TCPS_CLOSE_WAIT +#pragma D binding "1.6.3" TCPS_CLOSE_WAIT inline int TCPS_CLOSE_WAIT = 5; -#pragma D binding "1.0" TCPS_FIN_WAIT_1 +#pragma D binding "1.6.3" TCPS_FIN_WAIT_1 inline int TCPS_FIN_WAIT_1 = 6; -#pragma D binding "1.0" TCPS_CLOSING +#pragma D binding "1.6.3" TCPS_CLOSING inline int TCPS_CLOSING = 7; -#pragma D binding "1.0" TCPS_LAST_ACK +#pragma D binding "1.6.3" TCPS_LAST_ACK inline int TCPS_LAST_ACK = 8; -#pragma D binding "1.0" TCPS_FIN_WAIT_2 +#pragma D binding "1.6.3" TCPS_FIN_WAIT_2 inline int TCPS_FIN_WAIT_2 = 9; -#pragma D binding "1.0" TCPS_TIME_WAIT +#pragma D binding "1.6.3" TCPS_TIME_WAIT inline int TCPS_TIME_WAIT = 10; /* TCP segment flags. */ -#pragma D binding "1.0" TH_FIN +#pragma D binding "1.6.3" TH_FIN inline uint8_t TH_FIN = 0x01; -#pragma D binding "1.0" TH_SYN +#pragma D binding "1.6.3" TH_SYN inline uint8_t TH_SYN = 0x02; -#pragma D binding "1.0" TH_RST +#pragma D binding "1.6.3" TH_RST inline uint8_t TH_RST = 0x04; -#pragma D binding "1.0" TH_PUSH +#pragma D binding "1.6.3" TH_PUSH inline uint8_t TH_PUSH = 0x08; -#pragma D binding "1.0" TH_ACK +#pragma D binding "1.6.3" TH_ACK inline uint8_t TH_ACK = 0x10; -#pragma D binding "1.0" TH_URG +#pragma D binding "1.6.3" TH_URG inline uint8_t TH_URG = 0x20; -#pragma D binding "1.0" TH_ECE +#pragma D binding "1.6.3" TH_ECE inline uint8_t TH_ECE = 0x40; -#pragma D binding "1.0" TH_CWR +#pragma D binding "1.6.3" TH_CWR inline uint8_t TH_CWR = 0x80; /* TCP connection state strings. */ -#pragma D binding "1.0" tcp_state_string +#pragma D binding "1.6.3" tcp_state_string inline string tcp_state_string[int32_t state] = state == TCPS_CLOSED ? "state-closed" : state == TCPS_LISTEN ? "state-listen" : @@ -160,7 +160,7 @@ typedef struct tcpinfoh { struct tcphdr *tcp_hdr; /* raw TCP header */ } tcpinfoh_t; -#pragma D binding "1.0" translator +#pragma D binding "1.6.3" translator translator csinfo_t < struct tcpcb *p > { cs_addr = NULL; cs_cid = (uint64_t)(p == NULL ? 0 : p->t_inpcb); @@ -168,7 +168,7 @@ translator csinfo_t < struct tcpcb *p > { cs_zoneid = 0; }; -#pragma D binding "1.0" translator +#pragma D binding "1.6.3" translator translator tcpsinfo_t < struct tcpcb *p > { tcps_addr = (uintptr_t)p; tcps_local = -1; /* XXX */ @@ -202,7 +202,7 @@ translator tcpsinfo_t < struct tcpcb *p > { tcps_retransmit = p == NULL ? -1 : p->t_rxtshift > 0 ? 1 : 0; }; -#pragma D binding "1.0" translator +#pragma D binding "1.6.3" translator translator tcpinfo_t < struct tcphdr *p > { tcp_sport = p == NULL ? 0 : ntohs(p->th_sport); tcp_dport = p == NULL ? 0 : ntohs(p->th_dport); @@ -221,7 +221,7 @@ translator tcpinfo_t < struct tcphdr *p > { * number, acknowledgement number, window size and urgent pointer are already * in host order and thus don't need to be converted. */ -#pragma D binding "1.0" translator +#pragma D binding "1.6.3" translator translator tcpinfoh_t < struct tcphdr *p > { tcp_sport = p == NULL ? 0 : ntohs(p->th_sport); tcp_dport = p == NULL ? 0 : ntohs(p->th_dport); @@ -235,7 +235,7 @@ translator tcpinfoh_t < struct tcphdr *p > { tcp_hdr = (struct tcphdr *)p; }; -#pragma D binding "1.0" translator +#pragma D binding "1.6.3" translator translator tcplsinfo_t < int s > { tcps_state = s; }; diff --git a/cddl/lib/libdtrace/udp.d b/cddl/lib/libdtrace/udp.d index 5ad625de1bc..21538eb0ef3 100644 --- a/cddl/lib/libdtrace/udp.d +++ b/cddl/lib/libdtrace/udp.d @@ -50,7 +50,7 @@ typedef struct udpinfo { struct udphdr *udp_hdr; /* raw UDP header */ } udpinfo_t; -#pragma D binding "1.0" translator +#pragma D binding "1.6.3" translator translator udpsinfo_t < struct inpcb *p > { udps_addr = (uintptr_t)p; udps_lport = p == NULL ? 0 : ntohs(p->inp_inc.inc_ie.ie_lport); @@ -65,7 +65,7 @@ translator udpsinfo_t < struct inpcb *p > { inet_ntoa6(&p->inp_inc.inc_ie.ie_dependfaddr.ie6_foreign); }; -#pragma D binding "1.0" translator +#pragma D binding "1.6.3" translator translator udpinfo_t < struct udphdr *p > { udp_sport = p == NULL ? 0 : ntohs(p->uh_sport); udp_dport = p == NULL ? 0 : ntohs(p->uh_dport); diff --git a/cddl/lib/libzfs/Makefile b/cddl/lib/libzfs/Makefile index 16660aca3ce..4010ac177a5 100644 --- a/cddl/lib/libzfs/Makefile +++ b/cddl/lib/libzfs/Makefile @@ -7,8 +7,8 @@ LIB= zfs DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL} ${LIBM} ${LIBNVPAIR} \ - ${LIBZFS_CORE} -LDADD= -lmd -lpthread -lumem -lutil -lm -lnvpair -lzfs_core + ${LIBAVL} ${LIBZFS_CORE} +LDADD= -lmd -lpthread -lumem -lutil -lm -lnvpair -lavl -lzfs_core SRCS= deviceid.c \ fsshare.c \ diff --git a/cddl/lib/libzfs/Makefile.depend b/cddl/lib/libzfs/Makefile.depend index 79c81b8d577..c5db69640d0 100644 --- a/cddl/lib/libzfs/Makefile.depend +++ b/cddl/lib/libzfs/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + cddl/lib/libavl \ cddl/lib/libnvpair \ cddl/lib/libumem \ cddl/lib/libzfs_core \ diff --git a/cddl/lib/libzpool/Makefile b/cddl/lib/libzpool/Makefile index 7d4528f6aaf..8f60a20a23a 100644 --- a/cddl/lib/libzpool/Makefile +++ b/cddl/lib/libzpool/Makefile @@ -14,7 +14,7 @@ .if exists(${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH}/opensolaris_atomic.S) .PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH} ATOMIC_SRCS= opensolaris_atomic.S -.if ${MACHINE_ARCH} != "ia64" && ${MACHINE_ARCH} != "sparc64" +.if ${MACHINE_ARCH} != "sparc64" ACFLAGS+= -Wa,--noexecstack .endif .else diff --git a/cddl/sbin/zfs/Makefile.depend b/cddl/sbin/zfs/Makefile.depend index c3b3a22bb02..33d8e6d35a6 100644 --- a/cddl/sbin/zfs/Makefile.depend +++ b/cddl/sbin/zfs/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + cddl/lib/libavl \ cddl/lib/libnvpair \ cddl/lib/libumem \ cddl/lib/libuutil \ diff --git a/cddl/sbin/zpool/Makefile b/cddl/sbin/zpool/Makefile index 1884d249d21..bfcb017415b 100644 --- a/cddl/sbin/zpool/Makefile +++ b/cddl/sbin/zpool/Makefile @@ -18,6 +18,7 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libuutil/common CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libumem/common CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common +CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs_core/common CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libnvpair CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common diff --git a/cddl/usr.bin/zinject/Makefile b/cddl/usr.bin/zinject/Makefile index adb5023a6e5..008788bd936 100644 --- a/cddl/usr.bin/zinject/Makefile +++ b/cddl/usr.bin/zinject/Makefile @@ -11,6 +11,7 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris CFLAGS+= -I${.CURDIR}/../../compat/opensolaris/include CFLAGS+= -I${.CURDIR}/../../compat/opensolaris/lib/libumem CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/lib/libzfs/common +CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/lib/libzfs_core/common CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/lib/libzpool/common CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/lib/libnvpair CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs diff --git a/cddl/usr.bin/zinject/Makefile.depend b/cddl/usr.bin/zinject/Makefile.depend index 529f1d7d5dd..2a76b0ebb74 100644 --- a/cddl/usr.bin/zinject/Makefile.depend +++ b/cddl/usr.bin/zinject/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + cddl/lib/libavl \ cddl/lib/libnvpair \ cddl/lib/libumem \ cddl/lib/libuutil \ diff --git a/cddl/usr.sbin/zdb/Makefile b/cddl/usr.sbin/zdb/Makefile index fa9ab98f5b3..0e2ec8f82e1 100644 --- a/cddl/usr.sbin/zdb/Makefile +++ b/cddl/usr.sbin/zdb/Makefile @@ -15,6 +15,7 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/lib/libumem CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libnvpair CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libuutil/common CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common +CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs_core/common CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common diff --git a/cddl/usr.sbin/zdb/Makefile.depend b/cddl/usr.sbin/zdb/Makefile.depend index 529f1d7d5dd..2a76b0ebb74 100644 --- a/cddl/usr.sbin/zdb/Makefile.depend +++ b/cddl/usr.sbin/zdb/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + cddl/lib/libavl \ cddl/lib/libnvpair \ cddl/lib/libumem \ cddl/lib/libuutil \ diff --git a/cddl/usr.sbin/zhack/Makefile b/cddl/usr.sbin/zhack/Makefile index 9ae33951d63..8064cf1ea03 100644 --- a/cddl/usr.sbin/zhack/Makefile +++ b/cddl/usr.sbin/zhack/Makefile @@ -14,6 +14,7 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/lib/libumem CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libnvpair CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libuutil/common CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common +CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs_core/common CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common diff --git a/cddl/usr.sbin/zhack/Makefile.depend b/cddl/usr.sbin/zhack/Makefile.depend index 529f1d7d5dd..2a76b0ebb74 100644 --- a/cddl/usr.sbin/zhack/Makefile.depend +++ b/cddl/usr.sbin/zhack/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + cddl/lib/libavl \ cddl/lib/libnvpair \ cddl/lib/libumem \ cddl/lib/libuutil \ diff --git a/contrib/apr/CHANGES b/contrib/apr/CHANGES index 51d12367195..d04ad11a9b4 100644 --- a/contrib/apr/CHANGES +++ b/contrib/apr/CHANGES @@ -1,235 +1,124 @@ -*- coding: utf-8 -*- -Changes for APR 1.4.8 +Changes for APR 1.5.1 - *) Fix compiltation with FreeBSD on ARM. [Olli Hauer ] + *) apr_os_proc_mutex_get() on Unix: Avoid segfault for cross- + process pthread mutexes. [Yann Ylavic ] - *) Fix 1.4.7 regression in apr_mcast_hops() and apr_mcast_loopback() - for AF_INET (IPv4) sockets on most Unix platforms. [Joe Orton] + *) When using shmget-based shared memory, the ID used for ftok is + now an APR hash of the filename instead of the constant '1'. + We do this to help avoid collisions. PR 53996 [Jim Jagielski] - *) Fix the return value of apr_threadattr_detach_get() on some - platforms like OS X and Solaris. [Rainer Jung, ] + *) apr_socket_atreadeof(): Fix breakage on OS X. [Jim Jagielski] -Changes for APR 1.4.7 + *) Fix POSIX shared memory (shm_open) use for named shared memory. + Includes adding '--enable-posix-shm' to force POSIX shm if + available, and OS X compatibility. PR 55928. + [Jozef Hatala , Jim Jagielski] - *) Fix apr_sockaddr_info_get() not returning an error in some cases. - PR 54779. [Jan Kaluža ] + *) Fix race condition when calling apr_dir_make_recursive from + multiple threads on Windows. + [Bert Huijben] - *) Fix amd64 assembler version of apr_atomic_xchgptr(). PR 51851. [Mattias - Engdegård ] + *) Fix apr_escape.c compilation errors on EBCDIC platforms. + [Eric Covener] - *) Fix PPC atomics to work with gcc 4.0. PR 54840. [Mattias Engdegård - ] + *) FreeBSD 10: Correct a regression in 1.5.0 which affected non- + blocking sockets in some applications, including httpd. [Jeff + Trawick] - *) configure: Fix detection of O_NONBLOCK inheritance on busy - systems. [Rainer Jung] + *) Windows cmake build: Fix incorrect installation of some .pdb + files. Fix incorrect use of some logic intended for Windows 9x, + including legacy filesystem interfaces and dynamic loading of + some Windows APIs. [Jeff Trawick] - *) Remove unused code, fix strict C compliance bug in SHA-256 - implementation. [Jan Kaluza ] - - *) Fix apr_ipsubnet_test() false positives when comparing IPv4 - subnet representation against an IPv6 address. PR 54047. [Joe Orton] - - *) apr_socket_accept_filter: Return success when trying to again set - the filter to the same value as before, avoiding an unhelpful - APR_EINVAL. PR 37863. [Jeff Trawick] - - *) configure: Fix Linux 3.x detection. PR 54001. [Gilles Espinasse - ] - - *) apr_time_exp_*() on Windows: Fix error in the tm_yday field of - apr_time_exp_t for times within leap years. PR 53175. + *) apr_skiplist: Add compatibility with C++ applications. [Jeff Trawick] - *) Improve platform detection by updating config.guess and config.sub. - [Rainer Jung] + *) Correct a regression in 1.5.0 which affected out-of-tree + builds on Unix. [Rainer Jung] - *) Add support for OSX Mountain Lion (10.8) [Jim Jagielski] + *) Improve platform detection for bundled expat by updating + config.guess and config.sub. [Rainer Jung] - *) Add various gcc function attributes. [Stefan Fritsch] +Changes for APR 1.5.0 - *) Fix some problems in apr_sockaddr_info_get() when trying to resolve - the loopback addresses of a protocol family that is not otherwise - configured on the system. PR 52709. [Nirgal Vourgère - , Stefan Fritsch] + *) Fix Linux kernel version check to recognize more versions, + including versions 3.10 and later. PR 55690. [Joe Orton, + Arfrever Frehtes Taifersar Arahesis ] - *) Fix file not being unlocked if truncate call on a file fails. - [Mladen Turk] + *) Add apr_sockaddr_is_wildcard() to check if a socket address + refers to the wildcard address for the protocol family (e.g., + 0.0.0.0/INADDR_ANY for IPv4). [Jeff Trawick] - *) apr_mcast_hops: Fix EINVAL for IPv6 sockets caused by using byte - instead integer for setsockopt. [Mladen Turk] + *) apr_file_dup2() on Windows: Fix debug RTL assertion when + attempting to _commit(stdout) or _commit(stderr). [Mike Rumph + ] - *) Windows: Fix compile-time checks for 64-bit builds, resolving a - crash in httpd's mod_rewrite. PR 49155. [] + *) apr_socket_connect() on Windows: Handle WSAEISCONN. PR 48736. + [, Jeff Trawick] -Changes for APR 1.4.6 + *) z/OS: threadsafe apr_pollset_poll support for sockets [Greg Ames] - *) Flush write buffer before truncate call on a file. - [Mladen Turk] + *) Windows: Don't obtain a mutex for buffered file I/O unless the + file was opened with the APR_FOPEN_XTHREAD flag. [Ivan Zhakov + ] - *) Randomise hashes by providing a seed. - Assigned CVE-2012-0840, oCERT-2011-003, but not known to be exploitable. - [Bojan Smojver, Branko Čibej, Ruediger Pluem et al.] - - *) apr_random: Prevent segfault if pool used to initialize apr_random is - destroyed before forking. [Stefan Fritsch] - - *) testrand: Improve child randomness test case. [Rainer Jung] - - *) apr_proc_fork, apr_random_after_fork: disambiguate what happens to the - proc structure passed in, and ensure that the pid is set correctly in - a newly created child; note that merely mixing a PID into the random - seed of a new child doesn't markedly increase entropy. [Sander Temme] - - *) apr_file_open: Avoid fcntl() calls if support for O_CLOEXEC works. - PR 48557. [Mike Frysinger ] - - *) apr_dir_make_recursive: Fix race condition that could lead to EEXIST - being returned. PR 51254. [William Lee , - Wim Lewis ] - - *) configure: Fix APR_RESTORE_THE_ENVIRONMENT if the original variable was - a single space. PR 50334. [Nathan Phillip Brink ] - - *) apr_proc_create: Don't close any of the new stdin/stdout/stderr in the - child if it already has the correct FD. PR 51995. - [Dan Ports ] - - *) Fix flag character '#' in combination with format character 'x' in - apr snprintf implementations. [Rainer Jung] - - *) Improve platform detection by updating config.guess and config.sub. - [Rainer Jung] - - *) Add libtool2 files to extraclean make target. [Rainer Jung] - - *) Don't overwrite our config.guess and config.sub - when running buildconf. [Rainer Jung] - - *) Silence autoconf 2.68 warnings. [Rainer Jung] - -Changes for APR 1.4.5 - - *) Security: CVE-2011-1928 - apr_fnmatch(): Fix high CPU loop. [William Rowe] - - *) Fix top_builddir in installed apr_rules.mk. [Bojan Smojver] - -Changes for APR 1.4.4 - - *) Windows: Fix command-line builds. [William Rowe] - -Changes for APR 1.4.3 - - *) Security: CVE-2011-0419 - Reimplement apr_fnmatch() from scratch using a non-recursive - algorithm; now has improved compliance with the fnmatch() spec. - [William Rowe] - - *) Fix environment-related crash using some non-standard builds on - Windows 7/Server 2008. [Steve Hay ] - - *) poll, pollset, pollcb on Windows: Handle calls with no file/socket - descriptors. PR 49882. [Stefan Ruppert , Jeff Trawick] - - *) Fix APR_IPV6_V6ONLY issues on Windows related to run-time behavior - on Windows older than Vista and SDK/MinGW levels without IPV6_V6ONLY. - PR 45321. [Sob ] - - *) Fix address handling when accepting an AF_INET socket from a socket - bound as AF_INET6. PR 49678. [Joe Orton] - - *) Fix error return values from apr_sockaddr_info_get() on Windows for - IPv6 builds. [Ivan Zhakov ] - - *) Add new experimental configure option --enable-allocator-uses-mmap to - use mmap instead of malloc in apr_allocator_alloc(). This greatly reduces - memory fragmentation with malloc implementations (e.g. glibc) that - don't handle allocationss of a page-size-multiples in an efficient way. - It also makes apr_allocator_max_free_set() actually have some effect - on such platforms. [Stefan Fritsch] - - *) configure: Support 64 and 32 bit universal builds for Darwin/ - OS X 10.6+. [Jim Jagielski] - - *) apr_sockaddr_info_get() on AIX: Fix a problem which could set - the port field in the native socket address to 1 when 0 was - specified. PR 46964. [Jeff Trawick] - - *) configure: Make definition of apr_ino_t independent of - _FILE_OFFSET_BITS even on platforms where ino_t is 'unsigned int'. - [Stefan Fritsch] - - *) apr_ring: Workaround for aliasing problem that causes gcc 4.5 to - miscompile some brigade related code. PR 50190. [Stefan Fritsch] - - *) apr_file_flush_locked(): Handle short writes. [Stefan Fritsch] - - *) apr_pollset_create_ex(): Trap errors from pollset providers. - PR 49094. [Sami Tolvanen ] - - *) apr_pollset_create*(): Fix memory lifetime problem with the wakeup - pipe when the pollset was created with APR_POLLSET_NOCOPY. - [Neil Conway ] - - *) Fix detection of some Linux variants when configure is built with - recent GNU tools. [Eric Covener] - - *) Avoid a redundant fcntl() call in apr_file_open() where O_CLOEXEC - is supported. PR 46297. [Joe Orton] - - *) Improve platform detection by updating config.guess and config.sub. - [Rainer Jung] - -Changes for APR 1.4.2 - - *) Undo a crash-bug introduced in 1.4.1 affecting some applications of - the apr hash and table structures, reported to affect Subversion - by Bert Huijben . [Graham Leggett] - -Changes for APR 1.4.1 - - *) Win32: Properly handle the ERROR_DIRECTORY system error code. - [Brane Čibej] - -Changes for APR 1.4.0 - - *) Windows: Default build configurations assume NT or higher at run-time. - - *) Add apr_global_mutex_lockfile() for retrieving the file, if any, - associated with the mutex. Add apr_global_mutex_name() for retrieving - the name of the lock mechanism used by the underlying proc mutex. + *) Windows: Create named shared memory segments under the "Local" + namespace if the caller is unprivileged, fixing an inability of + unprivileged callers to use apr_shm_create() with named shared + memory segments under recent Windows. As before, shared memory + segments are created under the "Global" namespace for privileged + callers. Add apr_shm_create_ex() and apr_shm_attach_ex(), which + provide the ability to override the normal namespace selection. [Jeff Trawick] - *) Add apr_socket_atreadeof to determine whether the receive part of the - socket has been closed by the peer. - [Ruediger Pluem, Mladen Turk, Joe Orton] + *) Update compile settings for MINT OS. PR 47181. [Alan Hourihane + ] - *) Make apr_pollset and apr_pollcb implementations using providers. - Added apr_pollset_create_ex and apr_pollcb_create_ex that allows - choosing non-default providers. - [Mladen Turk] + *) Files and pipes on Windows: Don't create an unused pollset when + files and pipes are opened. [Mladen Turk] - *) Win32: Use WSAPoll as default pollset method if supported and found - inside winsock dll. [Mladen Turk] + *) apr_socket_timeout_set() on Windows: If the socket was in a non- + blocking state before, disable that setting so that timeouts work. + [Jeff Trawick] - *) apr_temp_dir_get() now checks the TMPDIR environment variable first, - instead of third. [Jim Jagielski] + *) File info APIs: Fix calculation of atime and mtime on AIX. PR 51146. + [Ruediger Pluem] - *) Add apr_file_sync() and apr_file_datasync() calls. [Bojan Smojver] + *) Add the apr_escape interface. [Graham Leggett] - *) apr_pollset_wakeup() on Windows: Fix core caused by closing the - file_socket_pipe with standard file_close. - [Arsen Chaloyan, Mladen Turk] + *) Cygwin build fixes. PRs 51016 and 55586. [Carlo Bramini + ] - *) Introduce apr_hash_do() for iterating over a hash table. [Mladen Turk] + *) Add apr_skiplist family. [Jim Jagielski] - *) Make sure WIN32 behaves the same as posix for file-backed shared memory - by removing the file on cleanup/remove. [Mladen Turk] + *) Add experimental cmake-based build system for Windows. Refer to + README.cmake for more information. [Jeff Trawick, Tom Donovan] - *) Introduce apr_pollset_wakeup() for interrupting the blocking - apr_pollset_poll() call. [Mladen Turk] + *) Add the apr_table_getm() call, which transparently handles the + merging of keys with multiple values. [Graham Leggett] - *) Add apr_file_link() function. PR 44841. [Mark Heily ] + *) Add apr_hash_this_key(), apr_hash_this_key_len(), and + apr_hash_this_val() for easier access to those attributes from + a hash iterator. [Hyrum K. Wright ] + + *) MinGW/MSYS: Support shared builds of APR, other general improvements + to support of this toolchain. PR 46175. [Carlo Bramini + ] + + *) Improve platform detection by updating config.guess and config.sub. + [Rainer Jung] + + *) apr_socket_opt_set: Add support for APR_SO_BROADCAST. PR 46389. + [Armin Müller ] + + *) Enable platform specific support for the opening of a file or + pipe in non-blocking mode through the APR_FOPEN_NONBLOCK flag. + [Graham Leggett] + +Changes for APR 1.4.x and later: + + *) http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/CHANGES?view=markup Changes for APR 1.3.x and later: diff --git a/contrib/apr/CMakeLists.txt b/contrib/apr/CMakeLists.txt new file mode 100644 index 00000000000..04903f9f9ed --- /dev/null +++ b/contrib/apr/CMakeLists.txt @@ -0,0 +1,434 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Read README.cmake before using this. + +PROJECT(APR C) + +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) + +OPTION(APR_INSTALL_PRIVATE_H "Install selected private .h files (for httpd)" OFF) +OPTION(APR_HAVE_IPV6 "IPv6 support" ON) +OPTION(INSTALL_PDB "Install .pdb files (if generated)" ON) +OPTION(APR_BUILD_TESTAPR "Build the test suite" OFF) +OPTION(TEST_STATIC_LIBS "Test programs use APR static libraries instead of shared libraries?" OFF) +SET(MIN_WINDOWS_VER "Vista" + CACHE STRING "Minimum Windows version") + +# create 1-or-0 representation of feature tests for apr.h + +SET(apr_have_ipv6_10 0) + +IF(APR_HAVE_IPV6) + SET(apr_have_ipv6_10 1) +ENDIF() + +IF("${MIN_WINDOWS_VER}" STREQUAL "") + SET(win32_winnt_str "0x0600") +ELSEIF(${MIN_WINDOWS_VER} STREQUAL "Vista") + SET(win32_winnt_str "0x0600") +ELSEIF(${MIN_WINDOWS_VER} STREQUAL "Windows7") + SET(win32_winnt_str "0x0601") +ELSE() + SET(win32_winnt_str ${MIN_WINDOWS_VER}) +ENDIF() + +CONFIGURE_FILE(include/apr.hwc + ${PROJECT_BINARY_DIR}/apr.h) + +ADD_EXECUTABLE(gen_test_char tools/gen_test_char.c) +GET_TARGET_PROPERTY(GEN_TEST_CHAR_EXE gen_test_char LOCATION) +ADD_CUSTOM_COMMAND( + COMMENT "Generating character tables, apr_escape_test_char.h, for current locale" + DEPENDS gen_test_char + COMMAND ${GEN_TEST_CHAR_EXE} > ${PROJECT_BINARY_DIR}/apr_escape_test_char.h + OUTPUT ${PROJECT_BINARY_DIR}/apr_escape_test_char.h +) +ADD_CUSTOM_TARGET( + test_char_header ALL + DEPENDS ${PROJECT_BINARY_DIR}/apr_escape_test_char.h +) + +# Generated .h files are stored in PROJECT_BINARY_DIR, not the +# source tree. +# +# BROKEN: not searching PROJECT_BINARY_DIR first, so you have to +# manually delete apr.h in PROJECT_SOURCE_DIR/include if +# you've generated apr.h before using a different build + +SET(APR_INCLUDE_DIRECTORIES + ${PROJECT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/include + ${CMAKE_CURRENT_SOURCE_DIR}/include/arch/win32 + ${CMAKE_CURRENT_SOURCE_DIR}/include/arch/unix + ${CMAKE_CURRENT_SOURCE_DIR}/include/private +) + +SET(APR_SYSTEM_LIBS + ws2_32 + mswsock + rpcrt4 +) + +INCLUDE_DIRECTORIES(${APR_INCLUDE_DIRECTORIES}) + +SET(APR_PUBLIC_HEADERS_STATIC + include/apr_allocator.h + include/apr_atomic.h + include/apr_dso.h + include/apr_env.h + include/apr_errno.h + include/apr_escape.h + include/apr_file_info.h + include/apr_file_io.h + include/apr_fnmatch.h + include/apr_general.h + include/apr_getopt.h + include/apr_global_mutex.h + include/apr_hash.h + include/apr_inherit.h + include/apr_lib.h + include/apr_mmap.h + include/apr_network_io.h + include/apr_poll.h + include/apr_pools.h + include/apr_portable.h + include/apr_proc_mutex.h + include/apr_random.h + include/apr_ring.h + include/apr_shm.h + include/apr_signal.h + include/apr_skiplist.h + include/apr_strings.h + include/apr_support.h + include/apr_tables.h + include/apr_thread_cond.h + include/apr_thread_mutex.h + include/apr_thread_proc.h + include/apr_thread_rwlock.h + include/apr_time.h + include/apr_user.h + include/apr_version.h + include/apr_want.h +) +SET(APR_PUBLIC_HEADERS_GENERATED + ${PROJECT_BINARY_DIR}/apr.h +) + +SET(APR_SOURCES + atomic/win32/apr_atomic.c + dso/win32/dso.c + encoding/apr_escape.c + file_io/unix/copy.c + file_io/unix/fileacc.c + file_io/unix/filepath_util.c + file_io/unix/fullrw.c + file_io/unix/mktemp.c + file_io/unix/tempdir.c + file_io/win32/buffer.c + file_io/win32/dir.c + file_io/win32/filedup.c + file_io/win32/filepath.c + file_io/win32/filestat.c + file_io/win32/filesys.c + file_io/win32/flock.c + file_io/win32/open.c + file_io/win32/pipe.c + file_io/win32/readwrite.c + file_io/win32/seek.c + locks/win32/proc_mutex.c + locks/win32/thread_cond.c + locks/win32/thread_mutex.c + locks/win32/thread_rwlock.c + memory/unix/apr_pools.c + misc/unix/errorcodes.c + misc/unix/getopt.c + misc/unix/otherchild.c + misc/unix/version.c + misc/win32/charset.c + misc/win32/env.c + misc/win32/internal.c + misc/win32/misc.c + misc/win32/rand.c + misc/win32/start.c + misc/win32/utf8.c + mmap/unix/common.c + mmap/win32/mmap.c + network_io/unix/inet_ntop.c + network_io/unix/inet_pton.c + network_io/unix/multicast.c + network_io/unix/sockaddr.c + network_io/unix/socket_util.c + network_io/win32/sendrecv.c + network_io/win32/sockets.c + network_io/win32/sockopt.c + passwd/apr_getpass.c + poll/unix/poll.c + poll/unix/pollcb.c + poll/unix/pollset.c + poll/unix/select.c + random/unix/apr_random.c + random/unix/sha2.c + random/unix/sha2_glue.c + shmem/win32/shm.c + strings/apr_cpystrn.c + strings/apr_fnmatch.c + strings/apr_snprintf.c + strings/apr_strings.c + strings/apr_strnatcmp.c + strings/apr_strtok.c + tables/apr_hash.c + tables/apr_skiplist.c + tables/apr_tables.c + threadproc/win32/proc.c + threadproc/win32/signals.c + threadproc/win32/thread.c + threadproc/win32/threadpriv.c + time/win32/time.c + time/win32/timestr.c + user/win32/groupinfo.c + user/win32/userinfo.c +) + +SET(APR_TEST_SOURCES + test/abts.c + test/testargs.c + test/testatomic.c + test/testcond.c + test/testdir.c + test/testdso.c + test/testdup.c + test/testenv.c + test/testescape.c + test/testfile.c + test/testfilecopy.c + test/testfileinfo.c + test/testflock.c + test/testfmt.c + test/testfnmatch.c + test/testglobalmutex.c + test/testhash.c + test/testipsub.c + test/testlfs.c + test/testlock.c + test/testmmap.c + test/testnames.c + test/testoc.c + test/testpath.c + test/testpipe.c + test/testpoll.c + test/testpools.c + test/testproc.c + test/testprocmutex.c + test/testrand.c + test/testshm.c + test/testsleep.c + test/testsock.c + test/testsockets.c + test/testsockopt.c + test/teststr.c + test/teststrnatcmp.c + test/testtable.c + test/testtemp.c + test/testthread.c + test/testtime.c + test/testud.c + test/testuser.c + test/testutil.c + test/testvsn.c +) + +SET(install_targets) +SET(install_bin_pdb) +SET(install_lib_pdb) + +# libapr-1 is shared, apr-1 is static +ADD_LIBRARY(libapr-1 SHARED ${APR_SOURCES} ${APR_PUBLIC_HEADERS_GENERATED} libapr.rc) +SET(install_targets ${install_targets} libapr-1) +SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/libapr-1.pdb) +TARGET_LINK_LIBRARIES(libapr-1 ${APR_SYSTEM_LIBS}) +SET_TARGET_PROPERTIES(libapr-1 PROPERTIES COMPILE_DEFINITIONS "APR_DECLARE_EXPORT;WINNT") +ADD_DEPENDENCIES(libapr-1 test_char_header) + +ADD_LIBRARY(apr-1 STATIC ${APR_SOURCES} ${APR_PUBLIC_HEADERS_GENERATED}) +SET(install_targets ${install_targets} apr-1) +SET(install_lib_pdb ${install_lib_pdb} ${PROJECT_BINARY_DIR}/apr-1.pdb) +TARGET_LINK_LIBRARIES(apr-1 ${APR_SYSTEM_LIBS}) +SET_TARGET_PROPERTIES(apr-1 PROPERTIES COMPILE_DEFINITIONS "APR_DECLARE_STATIC;WINNT") +ADD_DEPENDENCIES(apr-1 test_char_header) + +# libaprapp-1 and aprapp-1 are static +ADD_LIBRARY(libaprapp-1 STATIC misc/win32/apr_app.c misc/win32/internal.c ${APR_PUBLIC_HEADERS_GENERATED}) +SET(install_targets ${install_targets} libaprapp-1) +SET(install_lib_pdb ${install_lib_pdb} ${PROJECT_BINARY_DIR}/libaprapp-1.pdb) +SET_TARGET_PROPERTIES(libaprapp-1 PROPERTIES COMPILE_DEFINITIONS "APR_APP;WINNT") + +ADD_LIBRARY(aprapp-1 STATIC misc/win32/apr_app.c misc/win32/internal.c ${APR_PUBLIC_HEADERS_GENERATED}) +SET(install_targets ${install_targets} aprapp-1) +SET(install_lib_pdb ${install_lib_pdb} ${PROJECT_BINARY_DIR}/aprapp-1.pdb) +SET_TARGET_PROPERTIES(aprapp-1 PROPERTIES COMPILE_DEFINITIONS "APR_DECLARE_STATIC;APR_APP;WINNT") + +IF(APR_BUILD_TESTAPR) + ENABLE_TESTING() + # Create a "check" target that displays test program output to the console. + ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND} --verbose) + + # copy data files to build directory so that we can run programs from there + EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory + ${PROJECT_BINARY_DIR}/data) + EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${PROJECT_SOURCE_DIR}/test/data/file_datafile.txt + ${PROJECT_BINARY_DIR}/data/file_datafile.txt) + EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${PROJECT_SOURCE_DIR}/test/data/mmap_datafile.txt + ${PROJECT_BINARY_DIR}/data/mmap_datafile.txt) + + IF(TEST_STATIC_LIBS) + SET(whichapr apr-1) + SET(whichaprapp aprapp-1) + SET(apiflag -DAPR_DECLARE_STATIC) + ELSE() + SET(whichapr libapr-1) + SET(whichaprapp libaprapp-1) + SET(apiflag) + ENDIF() + + ADD_EXECUTABLE(testapp test/testapp.c) + TARGET_LINK_LIBRARIES(testapp ${whichapr} ${whichaprapp} ${APR_SYSTEM_LIBS}) + SET_TARGET_PROPERTIES(testapp PROPERTIES LINK_FLAGS /entry:wmainCRTStartup) + IF(apiflag) + SET_TARGET_PROPERTIES(testapp PROPERTIES COMPILE_FLAGS ${apiflag}) + ENDIF() + ADD_TEST(NAME testapp COMMAND testapp) + + ADD_EXECUTABLE(testall ${APR_TEST_SOURCES}) + TARGET_LINK_LIBRARIES(testall ${whichapr} ${APR_SYSTEM_LIBS}) + IF(apiflag) + SET_TARGET_PROPERTIES(testall PROPERTIES COMPILE_FLAGS ${apiflag}) + ENDIF() + ADD_TEST(NAME testall COMMAND testall) + + ADD_LIBRARY(mod_test MODULE test/mod_test.c) + TARGET_LINK_LIBRARIES(mod_test ${whichapr} ${APR_SYSTEM_LIBS}) + SET_PROPERTY(TARGET mod_test APPEND PROPERTY LINK_FLAGS /export:print_hello) + # nasty work-around for difficulties adding more than one additional flag + # (they get joined in a bad way behind the scenes) + GET_PROPERTY(link_flags TARGET mod_test PROPERTY LINK_FLAGS) + SET(link_flags "${link_flags} /export:count_reps") + SET_TARGET_PROPERTIES(mod_test PROPERTIES LINK_FLAGS ${link_flags}) + IF(apiflag) + SET_TARGET_PROPERTIES(mod_test PROPERTIES COMPILE_FLAGS ${apiflag}) + ENDIF() + + # Build all the single-source executable files with no special build + # requirements. + SET(single_source_programs + test/echod.c + test/sendfile.c + test/sockperf.c + test/testlockperf.c + test/testmutexscope.c + test/globalmutexchild.c + test/occhild.c + test/proc_child.c + test/readchild.c + test/sockchild.c + test/testshmproducer.c + test/testshmconsumer.c + test/tryread.c + test/internal/testucs.c + ) + + FOREACH(sourcefile ${single_source_programs}) + STRING(REGEX REPLACE ".*/([^\\]+)\\.c" "\\1" proggie ${sourcefile}) + ADD_EXECUTABLE(${proggie} ${sourcefile}) + TARGET_LINK_LIBRARIES(${proggie} ${whichapr} ${APR_SYSTEM_LIBS}) + IF(apiflag) + SET_TARGET_PROPERTIES(${proggie} PROPERTIES COMPILE_FLAGS ${apiflag}) + ENDIF() + ENDFOREACH() + + # Add tests for programs that run by themselves with no arguments. + SET(simple_tests + testmutexscope + testucs + ) + + FOREACH(simple ${simple_tests}) + ADD_TEST(NAME ${simple} COMMAND ${simple}) + ENDFOREACH() + + # testlockperf takes forever on Windows with default counter limit + ADD_TEST(NAME testlockperf COMMAND testlockperf -c 50000) + + # sendfile runs multiple times with different parameters. + FOREACH(sendfile_mode blocking nonblocking timeout) + ADD_TEST(NAME sendfile-${sendfile_mode} COMMAND sendfile client ${sendfile_mode} startserver) + ENDFOREACH() + + # No test is added for echod+sockperf. Those will have to be run manually. + +ENDIF (APR_BUILD_TESTAPR) + +# Installation + +INSTALL(TARGETS ${install_targets} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + ) + +IF(INSTALL_PDB) + INSTALL(FILES ${install_bin_pdb} + DESTINATION bin + CONFIGURATIONS RelWithDebInfo Debug) + + INSTALL(FILES ${install_lib_pdb} + DESTINATION lib + CONFIGURATIONS RelWithDebInfo Debug) +ENDIF() + +INSTALL(FILES ${APR_PUBLIC_HEADERS_STATIC} ${APR_PUBLIC_HEADERS_GENERATED} DESTINATION include) +IF(APR_INSTALL_PRIVATE_H) + # Kludges for unexpected dependencies of httpd 2.x, not installed by default + SET(APR_PRIVATE_H_FOR_HTTPD + include/arch/win32/apr_arch_file_io.h + include/arch/win32/apr_arch_misc.h + include/arch/win32/apr_arch_utf8.h + include/arch/win32/apr_private.h + ) + INSTALL(FILES ${APR_PRIVATE_H_FOR_HTTPD} DESTINATION include/arch/win32) + INSTALL(FILES include/arch/apr_private_common.h DESTINATION include/arch) +ENDIF() + +STRING(TOUPPER "${CMAKE_BUILD_TYPE}" buildtype) +MESSAGE(STATUS "") +MESSAGE(STATUS "") +MESSAGE(STATUS "APR configuration summary:") +MESSAGE(STATUS "") + +MESSAGE(STATUS " Build type ...................... : ${CMAKE_BUILD_TYPE}") +MESSAGE(STATUS " Install .pdb (if available)...... : ${INSTALL_PDB}") +MESSAGE(STATUS " Install prefix .................. : ${CMAKE_INSTALL_PREFIX}") +MESSAGE(STATUS " C compiler ...................... : ${CMAKE_C_COMPILER}") +MESSAGE(STATUS " IPv6 ............................ : ${APR_HAVE_IPV6}") +MESSAGE(STATUS " Minimum Windows version ......... : ${MIN_WINDOWS_VER}") +MESSAGE(STATUS " Build test suite ................ : ${APR_BUILD_TESTAPR}") +IF(TEST_STATIC_LIBS) +MESSAGE(STATUS " (testing static libraries)") +ELSE() +MESSAGE(STATUS " (testing dynamic libraries)") +ENDIF() +MESSAGE(STATUS " Install private .h for httpd .... : ${APR_INSTALL_PRIVATE_H}") diff --git a/contrib/apr/LICENSE b/contrib/apr/LICENSE index 02418e19136..cf0fb63058a 100644 --- a/contrib/apr/LICENSE +++ b/contrib/apr/LICENSE @@ -206,8 +206,8 @@ APACHE PORTABLE RUNTIME SUBCOMPONENTS: The Apache Portable Runtime includes a number of subcomponents with separate copyright notices and license terms. Your use of the source -code for the these subcomponents is subject to the terms and -conditions of the following licenses. +code for these subcomponents is subject to the terms and conditions +of the following licenses. From strings/apr_fnmatch.c, include/apr_fnmatch.h, misc/unix/getopt.c, file_io/unix/mktemp.c, strings/apr_strings.c: diff --git a/contrib/apr/Makefile.in b/contrib/apr/Makefile.in index 6d3b9127eb8..6f99733bdf5 100644 --- a/contrib/apr/Makefile.in +++ b/contrib/apr/Makefile.in @@ -18,7 +18,7 @@ APR_MAJOR_VERSION=@APR_MAJOR_VERSION@ INCDIR=./include OSDIR=$(top_srcdir)/include/arch/@OSDIR@ DEFOSDIR=$(INCDIR)/arch/@DEFAULT_OSDIR@ -INCLUDES=-I$(INCDIR) -I$(OSDIR) -I$(DEFOSDIR) -I$(top_srcdir)/include/arch/@DEFAULT_OSDIR@ -I$(top_srcdir)/include +INCLUDES=-I$(INCDIR) -I$(OSDIR) -I$(DEFOSDIR) -I$(top_srcdir)/include/arch/@DEFAULT_OSDIR@ -I$(top_srcdir)/include -I$(top_srcdir)/include/private -I$(top_blddir)/include/private # # Macros for target determination @@ -36,7 +36,7 @@ INSTALL_DATA = @INSTALL_DATA@ # Rules for building specific targets, starting with 'all' for # building the entire package. # -TARGETS = $(TARGET_LIB) apr.exp apr-config.out build/apr_rules.out +TARGETS = $(TARGET_LIB) include/private/apr_escape_test_char.h apr.exp apr-config.out build/apr_rules.out LT_VERSION = @LT_VERSION@ @@ -45,7 +45,9 @@ LT_VERSION = @LT_VERSION@ @INCLUDE_OUTPUTS@ CLEAN_TARGETS = apr-config.out apr.exp exports.c export_vars.c .make.dirs \ - build/apr_rules.out + build/apr_rules.out tools/gen_test_char@EXEEXT@ \ + tools/gen_test_char.o tools/gen_test_char.lo \ + include/private/apr_escape_test_char.h DISTCLEAN_TARGETS = config.cache config.log config.status \ include/apr.h include/arch/unix/apr_private.h \ libtool $(APR_CONFIG) build/apr_rules.mk apr.pc \ @@ -99,6 +101,8 @@ install: $(TARGETS) $(TARGET_LIB): $(OBJECTS) $(LINK) @lib_target@ $(ALL_LIBS) +encoding/apr_escape.lo: include/private/apr_escape_test_char.h + exports.c: $(HEADERS) $(APR_MKEXPORT) $(HEADERS) > $@ @@ -125,5 +129,20 @@ check: $(TARGET_LIB) etags: etags `find . -name '*.[ch]'` +make_tools_dir: + $(APR_MKDIR) tools + +OBJECTS_gen_test_char = tools/gen_test_char.lo $(LOCAL_LIBS) +tools/gen_test_char.lo: make_tools_dir +tools/gen_test_char@EXEEXT@: $(OBJECTS_gen_test_char) + $(LINK_PROG) $(OBJECTS_gen_test_char) $(ALL_LIBS) + +include/private/apr_escape_test_char.h: tools/gen_test_char@EXEEXT@ + $(APR_MKDIR) include/private + tools/gen_test_char@EXEEXT@ > $@ + +LINK_PROG = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) $(LT_LDFLAGS) \ + @LT_NO_INSTALL@ $(ALL_LDFLAGS) -o $@ + # DO NOT REMOVE docs: $(INCDIR)/*.h diff --git a/contrib/apr/Makefile.win b/contrib/apr/Makefile.win index 5f9c3133f45..a3573eae602 100644 --- a/contrib/apr/Makefile.win +++ b/contrib/apr/Makefile.win @@ -7,7 +7,7 @@ # install - compile everything # clean - mop up everything # -# You can override the build mechansim, choose only one; +# You can override the build mechanism, choose only one; # # USEMAK=1 - compile from exported make files # USEDSW=1 - compile from .dsw / .dsp VC6 projects diff --git a/contrib/apr/NOTICE b/contrib/apr/NOTICE index 6643ee6d75e..b16965be948 100644 --- a/contrib/apr/NOTICE +++ b/contrib/apr/NOTICE @@ -1,7 +1,7 @@ Apache Portable Runtime -Copyright (c) 2011 The Apache Software Foundation. +Copyright (c) 2000-2014 The Apache Software Foundation. -This product includes software developed by +This product includes software developed at The Apache Software Foundation (http://www.apache.org/). Portions of this software were developed at the National Center diff --git a/contrib/apr/README.cmake b/contrib/apr/README.cmake new file mode 100644 index 00000000000..cfff8ca0d05 --- /dev/null +++ b/contrib/apr/README.cmake @@ -0,0 +1,112 @@ +Experimental cmake-based build support for APR on Microsoft Windows + +Status +------ + +This build support is currently intended only for Microsoft Windows. +Only Windows NT-based systems can be targeted. (The traditional +Windows build support for APR can target Windows 9x as well.) + +This build support is experimental. Specifically, + +* It does not support all features of APR. +* Some components may not be built correctly and/or in a manner + compatible with the previous Windows build support. +* Build interfaces, such as the mechanisms which are used to enable + optional functionality or specify prerequisites, may change from + release to release as feedback is received from users and bugs and + limitations are resolved. + +Important: Refer to the "Known Bugs and Limitations" section for further + information. + + It is beyond the scope of this document to document or explain + how to utilize the various cmake features, such as different + build backends or provisions for finding support libraries. + + Please refer to the cmake documentation for additional information + that applies to building any project with cmake. + +Prerequisites +------------- + +The following tools must be in PATH: + +* cmake, version 2.8 or later +* If using a command-line compiler: compiler and linker and related tools + (Refer to the cmake documentation for more information.) + +How to build +------------ + +1. cd to a clean directory for building (i.e., don't build in your + source tree) + +2. Some cmake backends may want your compile tools in PATH. (Hint: "Visual + Studio Command Prompt") + +3. cmake -G "some backend, like 'NMake Makefiles'" + -DCMAKE_INSTALL_PREFIX=d:/path/to/aprinst + -DAPR-specific-flags + d:/path/to/aprsource + + Alternately, use cmake-gui and update settings in the GUI. + + APR feature flags: + + APR_INSTALL_PRIVATE_H Install extra .h files which are required when + building httpd and Subversion but which aren't + intended for use by applications. + Default: OFF + APR_HAVE_IPV6 Enable IPv6 support + Default: ON + APR_BUILD_TESTAPR Build APR test suite + Default: OFF + TEST_STATIC_LIBS Build the test suite to test the APR static + library instead of the APR dynamic library. + Default: OFF + In order to build the test suite against both + static and dynamic libraries, separate builds + will be required, one with TEST_STATIC_LIBS + set to ON. + MIN_WINDOWS_VER Minimum Windows version supported by this build + (This controls the setting of _WIN32_WINNT.) + "Vista" or "Windows7" or a numeric value like + "0x0601" + Default: "Vista" + For desktop/server equivalence or other values, + refer to + http://msdn.microsoft.com/en-us/library/windows/ + desktop/aa383745(v=vs.85).aspx + INSTALL_PDB Install .pdb files if generated. + Default: ON + + CMAKE_C_FLAGS_RELEASE, _DEBUG, _RELWITHDEBINFO, _MINSIZEREL + + CMAKE_BUILD_TYPE + + For NMake Makefiles the choices are at least DEBUG, RELEASE, + RELWITHDEBINFO, and MINSIZEREL + Other backends make have other selections. + +4. build using chosen backend (e.g., "nmake install") + +Known Bugs and Limitations +-------------------------- + +* If include/apr.h or other generated files have been created in the source + directory by another build system, they will be used unexpectedly and + cause the build to fail. +* Options should be provided for remaining features: + + APR_POOL_DEBUG +* APR-CHANGES.txt, APR-LICENSE.txt, and APR-NOTICE.txt are not installed, + though perhaps that is a job for a higher-level script. + +Generally: + +* Many APR features have not been tested with this build. +* Developers need to examine the existing Windows build in great detail and see + what is missing from the cmake-based build, whether a feature or some build + nuance. +* Any feedback you can provide on your experiences with this build will be + helpful. diff --git a/contrib/apr/apr.dep b/contrib/apr/apr.dep index 3abf37def2a..aa2be743240 100644 --- a/contrib/apr/apr.dep +++ b/contrib/apr/apr.dep @@ -1,558 +1,1916 @@ -# Microsoft Developer Studio Generated Dependency File, included by apr.mak - -.\atomic\win32\apr_atomic.c : \ - ".\include\apr_atomic.h"\ - - -.\dso\win32\dso.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - ".\include\arch\win32\apr_arch_dso.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\file_io\win32\buffer.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\file_io\unix\copy.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\file_io\win32\dir.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - ".\include\arch\win32\apr_arch_atime.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\file_io\unix\fileacc.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\file_io\win32\filedup.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_inherit.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\file_io\win32\filepath.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\file_io\unix\filepath_util.c : \ - ".\include\apr_strings.h"\ - - -.\file_io\win32\filestat.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - ".\include\arch\win32\apr_arch_atime.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\file_io\win32\filesys.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\file_io\win32\flock.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\file_io\unix\fullrw.c : \ - - -.\file_io\unix\mktemp.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_inherit.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\file_io\win32\open.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_inherit.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\file_io\win32\pipe.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\file_io\win32\readwrite.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - ".\include\arch\win32\apr_arch_atime.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\file_io\win32\seek.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\file_io\unix\tempdir.c : \ - ".\include\apr_env.h"\ - ".\include\apr_strings.h"\ - - -.\locks\win32\proc_mutex.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_proc_mutex.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\locks\win32\thread_cond.c : \ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - ".\include\apr_thread_cond.h"\ - ".\include\arch\win32\apr_arch_thread_cond.h"\ - ".\include\arch\win32\apr_arch_thread_mutex.h"\ - - -.\locks\win32\thread_mutex.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - ".\include\arch\win32\apr_arch_thread_mutex.h"\ - - -.\locks\win32\thread_rwlock.c : \ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - ".\include\apr_thread_rwlock.h"\ - ".\include\arch\win32\apr_arch_thread_rwlock.h"\ - - -.\memory\unix\apr_pools.c : \ - ".\include\apr_atomic.h"\ - ".\include\apr_env.h"\ - ".\include\apr_hash.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - - -.\misc\win32\charset.c : \ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - - -.\misc\win32\env.c : \ - ".\include\apr_env.h"\ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\misc\unix\errorcodes.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - - -.\misc\unix\getopt.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - - -.\misc\win32\internal.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\misc\win32\misc.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - ".\include\arch\win32\apr_dbg_win32_handles.h"\ - - -.\misc\unix\otherchild.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_threadproc.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\misc\win32\rand.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_portable.h"\ - - -.\misc\win32\start.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_signal.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_threadproc.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\misc\win32\utf8.c : \ - ".\include\apr_lib.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\misc\unix\version.c : \ - ".\include\apr_version.h"\ - - -.\mmap\unix\common.c : \ - ".\include\apr_mmap.h"\ - - -.\mmap\win32\mmap.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_mmap.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\network_io\unix\inet_ntop.c : \ - ".\include\apr_poll.h"\ - ".\include\apr_strings.h"\ - ".\include\arch\win32\apr_arch_networkio.h"\ - - -.\network_io\unix\inet_pton.c : \ - ".\include\apr_poll.h"\ - ".\include\arch\win32\apr_arch_networkio.h"\ - - -.\network_io\unix\multicast.c : \ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_support.h"\ - ".\include\arch\win32\apr_arch_inherit.h"\ - ".\include\arch\win32\apr_arch_networkio.h"\ - - -.\network_io\win32\sendrecv.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_networkio.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\network_io\unix\sockaddr.c : \ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_strings.h"\ - ".\include\arch\win32\apr_arch_networkio.h"\ - - -.\network_io\unix\socket_util.c : \ - ".\include\apr_poll.h"\ - - -.\network_io\win32\sockets.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - ".\include\arch\win32\apr_arch_inherit.h"\ - ".\include\arch\win32\apr_arch_networkio.h"\ - - -.\network_io\win32\sockopt.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - ".\include\arch\win32\apr_arch_networkio.h"\ - - -.\passwd\apr_getpass.c : \ - ".\include\apr_lib.h"\ - ".\include\apr_strings.h"\ - - -.\poll\unix\poll.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\arch\unix\apr_arch_poll_private.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_networkio.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\poll\unix\pollcb.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\arch\unix\apr_arch_poll_private.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_networkio.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\poll\unix\pollset.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\arch\unix\apr_arch_poll_private.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_inherit.h"\ - ".\include\arch\win32\apr_arch_networkio.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\poll\unix\select.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\arch\unix\apr_arch_poll_private.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_networkio.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\random\unix\apr_random.c : \ - ".\include\apr_random.h"\ - - -.\random\unix\sha2.c : \ - ".\random\unix\sha2.h"\ - - -.\random\unix\sha2_glue.c : \ - ".\include\apr_random.h"\ - ".\random\unix\sha2.h"\ - - -.\shmem\win32\shm.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\strings\apr_cpystrn.c : \ - ".\include\apr_lib.h"\ - ".\include\apr_strings.h"\ - - -.\strings\apr_fnmatch.c : \ - ".\include\apr_fnmatch.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_strings.h"\ - - -.\strings\apr_snprintf.c : \ - ".\include\apr_lib.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - - -.\strings\apr_strings.c : \ - ".\include\apr_lib.h"\ - ".\include\apr_strings.h"\ - - -.\strings\apr_strnatcmp.c : \ - ".\include\apr_lib.h"\ - ".\include\apr_strings.h"\ - - -.\strings\apr_strtok.c : \ - ".\include\apr_strings.h"\ - - -.\tables\apr_hash.c : \ - ".\include\apr_hash.h"\ - - -.\tables\apr_tables.c : \ - ".\include\apr_lib.h"\ - ".\include\apr_strings.h"\ - - -.\threadproc\win32\proc.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_threadproc.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\threadproc\win32\signals.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_signal.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_threadproc.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\threadproc\win32\thread.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_portable.h"\ - ".\include\arch\win32\apr_arch_threadproc.h"\ - - -.\threadproc\win32\threadpriv.c : \ - ".\include\apr_lib.h"\ - ".\include\apr_portable.h"\ - ".\include\arch\win32\apr_arch_threadproc.h"\ - - -.\time\win32\time.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_portable.h"\ - ".\include\arch\win32\apr_arch_atime.h"\ - - -.\time\win32\timestr.c : \ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - ".\include\arch\win32\apr_arch_atime.h"\ - - -.\user\win32\groupinfo.c : \ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - - -.\user\win32\userinfo.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -!IF "$(CFG)" == "apr - Win32 Release" - -!ELSEIF "$(CFG)" == "apr - Win32 Debug" - -!ELSEIF "$(CFG)" == "apr - Win32 Release9x" - -!ELSEIF "$(CFG)" == "apr - Win32 Debug9x" - -!ELSEIF "$(CFG)" == "apr - x64 Release" - -!ELSEIF "$(CFG)" == "apr - x64 Debug" - -!ENDIF - +# Microsoft Developer Studio Generated Dependency File, included by apr.mak + +.\atomic\win32\apr_atomic.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_atomic.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_general.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_want.h"\ + + +.\dso\win32\dso.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_dso.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\encoding\apr_escape.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_escape.h"\ + ".\include\apr_escape_test_char.h"\ + ".\include\apr_general.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_want.h"\ + + +.\file_io\win32\buffer.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\file_io\unix\copy.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\file_io\win32\dir.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_atime.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\file_io\unix\fileacc.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\file_io\win32\filedup.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_inherit.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\file_io\win32\filepath.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\file_io\unix\filepath_util.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_general.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\file_io\win32\filestat.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_atime.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\file_io\win32\filesys.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\file_io\win32\flock.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\file_io\unix\fullrw.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + + +.\file_io\unix\mktemp.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_inherit.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\file_io\win32\open.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_inherit.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\file_io\win32\pipe.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\file_io\win32\readwrite.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_atime.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\file_io\win32\seek.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\file_io\unix\tempdir.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_env.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\locks\win32\proc_mutex.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_proc_mutex.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\locks\win32\thread_cond.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_cond.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_thread_cond.h"\ + ".\include\arch\win32\apr_arch_thread_mutex.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\locks\win32\thread_mutex.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_thread_mutex.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\locks\win32\thread_rwlock.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_thread_rwlock.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_thread_rwlock.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\memory\unix\apr_pools.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_atomic.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_env.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_hash.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\misc\win32\charset.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + + +.\misc\win32\env.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_env.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\misc\unix\errorcodes.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\misc\unix\getopt.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\misc\win32\internal.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\misc\win32\misc.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\misc\unix\otherchild.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_threadproc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\misc\win32\rand.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\misc\win32\start.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_signal.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_threadproc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\misc\win32\utf8.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_general.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\misc\unix\version.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_general.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_version.h"\ + ".\include\apr_want.h"\ + + +.\mmap\unix\common.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_mmap.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_ring.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\mmap\win32\mmap.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_mmap.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_ring.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\network_io\unix\inet_ntop.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_networkio.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\network_io\unix\inet_pton.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_networkio.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\network_io\unix\multicast.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_support.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\win32\apr_arch_inherit.h"\ + ".\include\arch\win32\apr_arch_networkio.h"\ + + +.\network_io\win32\sendrecv.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_networkio.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\network_io\unix\sockaddr.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_networkio.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\network_io\unix\socket_util.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + + +.\network_io\win32\sockets.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_inherit.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_networkio.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\network_io\win32\sockopt.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_networkio.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\passwd\apr_getpass.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_general.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\poll\unix\poll.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_ring.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\unix\apr_arch_poll_private.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_networkio.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\poll\unix\pollcb.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_ring.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\unix\apr_arch_poll_private.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_networkio.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\poll\unix\pollset.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_ring.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\unix\apr_arch_poll_private.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_inherit.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_networkio.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\poll\unix\select.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_ring.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\unix\apr_arch_poll_private.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_networkio.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\random\unix\apr_random.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_random.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + + +.\random\unix\sha2.c : \ + ".\include\apr.h"\ + ".\random\unix\sha2.h"\ + + +.\random\unix\sha2_glue.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_random.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\random\unix\sha2.h"\ + + +.\shmem\win32\shm.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\strings\apr_cpystrn.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_general.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\strings\apr_fnmatch.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_fnmatch.h"\ + ".\include\apr_general.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + + +.\strings\apr_snprintf.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\strings\apr_strings.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_general.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\strings\apr_strnatcmp.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_general.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_want.h"\ + + +.\strings\apr_strtok.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_general.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_want.h"\ + + +.\tables\apr_hash.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_general.h"\ + ".\include\apr_hash.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_time.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\tables\apr_skiplist.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_skiplist.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + + +.\tables\apr_tables.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_general.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\threadproc\win32\proc.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_threadproc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\threadproc\win32\signals.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_signal.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_threadproc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\threadproc\win32\thread.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_threadproc.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\threadproc\win32\threadpriv.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_threadproc.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\time\win32\time.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_atime.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\time\win32\timestr.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_atime.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\user\win32\groupinfo.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_private.h"\ + + +.\user\win32\userinfo.c : \ + ".\include\apr.h"\ + ".\include\apr_allocator.h"\ + ".\include\apr_dso.h"\ + ".\include\apr_errno.h"\ + ".\include\apr_file_info.h"\ + ".\include\apr_file_io.h"\ + ".\include\apr_general.h"\ + ".\include\apr_getopt.h"\ + ".\include\apr_global_mutex.h"\ + ".\include\apr_inherit.h"\ + ".\include\apr_lib.h"\ + ".\include\apr_network_io.h"\ + ".\include\apr_poll.h"\ + ".\include\apr_pools.h"\ + ".\include\apr_portable.h"\ + ".\include\apr_proc_mutex.h"\ + ".\include\apr_shm.h"\ + ".\include\apr_strings.h"\ + ".\include\apr_tables.h"\ + ".\include\apr_thread_mutex.h"\ + ".\include\apr_thread_proc.h"\ + ".\include\apr_time.h"\ + ".\include\apr_user.h"\ + ".\include\apr_want.h"\ + ".\include\arch\apr_private_common.h"\ + ".\include\arch\win32\apr_arch_file_io.h"\ + ".\include\arch\win32\apr_arch_misc.h"\ + ".\include\arch\win32\apr_arch_utf8.h"\ + ".\include\arch\win32\apr_private.h"\ + + +!IF "$(CFG)" == "apr - Win32 Release" + +!ELSEIF "$(CFG)" == "apr - Win32 Debug" + +!ELSEIF "$(CFG)" == "apr - Win32 Release9x" + +!ELSEIF "$(CFG)" == "apr - Win32 Debug9x" + +!ELSEIF "$(CFG)" == "apr - x64 Release" + +!ELSEIF "$(CFG)" == "apr - x64 Debug" + +!ENDIF + +!IF "$(CFG)" == "apr - Win32 Release" + +!ELSEIF "$(CFG)" == "apr - Win32 Debug" + +!ELSEIF "$(CFG)" == "apr - Win32 Release9x" + +!ELSEIF "$(CFG)" == "apr - Win32 Debug9x" + +!ELSEIF "$(CFG)" == "apr - x64 Release" + +!ELSEIF "$(CFG)" == "apr - x64 Debug" + +!ENDIF + +!IF "$(CFG)" == "apr - Win32 Release" + +!ELSEIF "$(CFG)" == "apr - Win32 Debug" + +!ELSEIF "$(CFG)" == "apr - Win32 Release9x" + +!ELSEIF "$(CFG)" == "apr - Win32 Debug9x" + +!ELSEIF "$(CFG)" == "apr - x64 Release" + +!ELSEIF "$(CFG)" == "apr - x64 Debug" + +!ENDIF + diff --git a/contrib/apr/apr.dsp b/contrib/apr/apr.dsp index 82eda32c009..bbba9267fcc 100644 --- a/contrib/apr/apr.dsp +++ b/contrib/apr/apr.dsp @@ -200,6 +200,15 @@ SOURCE=.\atomic\win32\apr_atomic.c # Begin Source File SOURCE=.\dso\win32\dso.c +# End Source File +# End Group +# Begin Group "encoding" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\encoding\apr_escape.c + # End Source File # End Group # Begin Group "file_io" @@ -492,6 +501,10 @@ SOURCE=.\tables\apr_hash.c # End Source File # Begin Source File +SOURCE=.\tables\apr_skiplist.c +# End Source File +# Begin Source File + SOURCE=.\tables\apr_tables.c # End Source File # End Group @@ -694,6 +707,85 @@ SOURCE=.\include\apr_errno.h # End Source File # Begin Source File +SOURCE=.\include\apr_escape.h +# End Source File +# Begin Source File + +SOURCE=.\include\apr_escape.h + +!IF "$(CFG)" == "apr - Win32 Release" + +# Begin Custom Build - Creating gen_test_char.exe and apr_escape_test_char.h +InputPath=.\include\apr_escape.h + +".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + cl.exe /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /I ".\include" /Fo.\LibR\gen_test_char /Fe.\LibR\gen_test_char.exe .\tools\gen_test_char.c + .\LibR\gen_test_char.exe > .\include\apr_escape_test_char.h + +# End Custom Build + +!ELSEIF "$(CFG)" == "apr - Win32 Debug" + +# Begin Custom Build - Creating gen_test_char.exe and apr_escape_test_char.h +InputPath=.\include\apr_escape.h + +".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + cl.exe /nologo /W3 /EHsc /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /I ".\include" /Fo.\LibD\gen_test_char /Fe.\LibD\gen_test_char.exe .\tools\gen_test_char.c + .\LibD\gen_test_char.exe > .\include\apr_escape_test_char.h + +# End Custom Build + +!ELSEIF "$(CFG)" == "apr - Win32 Release9x" + +# Begin Custom Build - Creating gen_test_char.exe and apr_escape_test_char.h +InputPath=.\include\apr_escape.h + +".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + cl.exe /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /I ".\include" /Fo.\9x\LibR\gen_test_char /Fe.\9x\LibR\gen_test_char.exe .\tools\gen_test_char.c + .\9x\LibR\gen_test_char.exe > .\include\apr_escape_test_char.h + +# End Custom Build + +!ELSEIF "$(CFG)" == "apr - Win32 Debug9x" + +# Begin Custom Build - Creating gen_test_char.exe and apr_escape_test_char.h +InputPath=.\include\apr_escape.h + +InputPath=.\include\apr_escape.h +".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + cl.exe /nologo /W3 /EHsc /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /I ".\include" /Fo.\9x\LibD\gen_test_char /Fe.\9x\LibD\gen_test_char.exe .\tools\gen_test_char.c + .\9x\LibD\gen_test_char.exe > .\include\apr_escape_test_char.h + +# End Custom Build + +!ELSEIF "$(CFG)" == "apr - x64 Release" + +# Begin Custom Build - Creating gen_test_char.exe and apr_escape_test_char.h +InputPath=.\include\apr_escape.h + +InputPath=.\include\apr_escape.h +".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + cl.exe /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /I ".\include" /Fo.\x64\LibR\gen_test_char /Fe.\x64\LibR\gen_test_char.exe .\tools\gen_test_char.c + .\x64\LibR\gen_test_char.exe > .\include\apr_escape_test_char.h + +# End Custom Build + +!ELSEIF "$(CFG)" == "apr - x64 Debug" + +# Begin Custom Build - Creating gen_test_char.exe and apr_escape_test_char.h +InputPath=.\include\apr_escape.h + +".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + cl.exe /nologo /W3 /EHsc /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /I ".\include" /Fo.\x64\LibD\gen_test_char /Fe.\x64\LibD\gen_test_char.exe .\tools\gen_test_char.c + .\x64\LibD\gen_test_char.exe > .\include\apr_escape_test_char.h + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + SOURCE=.\include\apr_file_info.h # End Source File # Begin Source File @@ -770,6 +862,10 @@ SOURCE=.\include\apr_signal.h # End Source File # Begin Source File +SOURCE=.\include\apr_skiplist.h +# End Source File +# Begin Source File + SOURCE=.\include\apr_strings.h # End Source File # Begin Source File @@ -811,6 +907,69 @@ SOURCE=.\include\apr_version.h # Begin Source File SOURCE=.\include\apr_want.h + +!IF "$(CFG)" == "apr - Win32 Release" + +# Begin Custom Build +InputPath=.\include\apr_want.h + +".\LibR\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + type .\include\apr.hw > .\include\apr.h + +# End Custom Build + +!ELSEIF "$(CFG)" == "apr - Win32 Debug" + +# Begin Custom Build +InputPath=.\include\apr_want.h + +".\LibD\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + type .\include\apr.hw > .\include\apr.h + +# End Custom Build + +!ELSEIF "$(CFG)" == "apr - Win32 Release9x" + +# Begin Custom Build +InputPath=.\include\apr_want.h + +".\9x\LibR\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + type .\include\apr.hw > .\include\apr.h + +# End Custom Build + +!ELSEIF "$(CFG)" == "apr - Win32 Debug9x" + +# Begin Custom Build +InputPath=.\include\apr_want.h + +".\9x\LibD\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + type .\include\apr.hw > .\include\apr.h + +# End Custom Build + +!ELSEIF "$(CFG)" == "apr - x64 Release" + +# Begin Custom Build +InputPath=.\include\apr_want.h + +".\x64\LibR\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + type .\include\apr.hw > .\include\apr.h + +# End Custom Build + +!ELSEIF "$(CFG)" == "apr - x64 Debug" + +# Begin Custom Build +InputPath=.\include\apr_want.h + +".\x64\LibD\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + type .\include\apr.hw > .\include\apr.h + +# End Custom Build + +!ENDIF + # End Source File # End Group # End Target diff --git a/contrib/apr/apr.mak b/contrib/apr/apr.mak index 78bd56a98a2..8248fa13c6d 100644 --- a/contrib/apr/apr.mak +++ b/contrib/apr/apr.mak @@ -1,1779 +1,1980 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on apr.dsp -!IF "$(CFG)" == "" -CFG=apr - Win32 Release -!MESSAGE No configuration specified. Defaulting to apr - Win32 Release. -!ENDIF - -!IF "$(CFG)" != "apr - Win32 Release" && "$(CFG)" != "apr - Win32 Debug" && "$(CFG)" != "apr - Win32 Release9x" && "$(CFG)" != "apr - Win32 Debug9x" && "$(CFG)" != "apr - x64 Release" && "$(CFG)" != "apr - x64 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "apr.mak" CFG="apr - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "apr - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "apr - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE "apr - Win32 Release9x" (based on "Win32 (x86) Static Library") -!MESSAGE "apr - Win32 Debug9x" (based on "Win32 (x86) Static Library") -!MESSAGE "apr - x64 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "apr - x64 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "apr - Win32 Release" - -OUTDIR=.\LibR -INTDIR=.\LibR -# Begin Custom Macros -OutDir=.\LibR -# End Custom Macros - -ALL : "$(OUTDIR)\apr-1.lib" - - -CLEAN : - -@erase "$(INTDIR)\apr-1.idb" - -@erase "$(INTDIR)\apr-1.pdb" - -@erase "$(INTDIR)\apr_atomic.obj" - -@erase "$(INTDIR)\apr_cpystrn.obj" - -@erase "$(INTDIR)\apr_fnmatch.obj" - -@erase "$(INTDIR)\apr_getpass.obj" - -@erase "$(INTDIR)\apr_hash.obj" - -@erase "$(INTDIR)\apr_pools.obj" - -@erase "$(INTDIR)\apr_random.obj" - -@erase "$(INTDIR)\apr_snprintf.obj" - -@erase "$(INTDIR)\apr_strings.obj" - -@erase "$(INTDIR)\apr_strnatcmp.obj" - -@erase "$(INTDIR)\apr_strtok.obj" - -@erase "$(INTDIR)\apr_tables.obj" - -@erase "$(INTDIR)\buffer.obj" - -@erase "$(INTDIR)\charset.obj" - -@erase "$(INTDIR)\common.obj" - -@erase "$(INTDIR)\copy.obj" - -@erase "$(INTDIR)\dir.obj" - -@erase "$(INTDIR)\dso.obj" - -@erase "$(INTDIR)\env.obj" - -@erase "$(INTDIR)\errorcodes.obj" - -@erase "$(INTDIR)\fileacc.obj" - -@erase "$(INTDIR)\filedup.obj" - -@erase "$(INTDIR)\filepath.obj" - -@erase "$(INTDIR)\filepath_util.obj" - -@erase "$(INTDIR)\filestat.obj" - -@erase "$(INTDIR)\filesys.obj" - -@erase "$(INTDIR)\flock.obj" - -@erase "$(INTDIR)\fullrw.obj" - -@erase "$(INTDIR)\getopt.obj" - -@erase "$(INTDIR)\groupinfo.obj" - -@erase "$(INTDIR)\inet_ntop.obj" - -@erase "$(INTDIR)\inet_pton.obj" - -@erase "$(INTDIR)\internal.obj" - -@erase "$(INTDIR)\misc.obj" - -@erase "$(INTDIR)\mktemp.obj" - -@erase "$(INTDIR)\mmap.obj" - -@erase "$(INTDIR)\multicast.obj" - -@erase "$(INTDIR)\open.obj" - -@erase "$(INTDIR)\otherchild.obj" - -@erase "$(INTDIR)\pipe.obj" - -@erase "$(INTDIR)\poll.obj" - -@erase "$(INTDIR)\pollcb.obj" - -@erase "$(INTDIR)\pollset.obj" - -@erase "$(INTDIR)\proc.obj" - -@erase "$(INTDIR)\proc_mutex.obj" - -@erase "$(INTDIR)\rand.obj" - -@erase "$(INTDIR)\readwrite.obj" - -@erase "$(INTDIR)\seek.obj" - -@erase "$(INTDIR)\select.obj" - -@erase "$(INTDIR)\sendrecv.obj" - -@erase "$(INTDIR)\sha2.obj" - -@erase "$(INTDIR)\sha2_glue.obj" - -@erase "$(INTDIR)\shm.obj" - -@erase "$(INTDIR)\signals.obj" - -@erase "$(INTDIR)\sockaddr.obj" - -@erase "$(INTDIR)\socket_util.obj" - -@erase "$(INTDIR)\sockets.obj" - -@erase "$(INTDIR)\sockopt.obj" - -@erase "$(INTDIR)\start.obj" - -@erase "$(INTDIR)\tempdir.obj" - -@erase "$(INTDIR)\thread.obj" - -@erase "$(INTDIR)\thread_cond.obj" - -@erase "$(INTDIR)\thread_mutex.obj" - -@erase "$(INTDIR)\thread_rwlock.obj" - -@erase "$(INTDIR)\threadpriv.obj" - -@erase "$(INTDIR)\time.obj" - -@erase "$(INTDIR)\timestr.obj" - -@erase "$(INTDIR)\userinfo.obj" - -@erase "$(INTDIR)\utf8.obj" - -@erase "$(INTDIR)\version.obj" - -@erase "$(OUTDIR)\apr-1.lib" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(OUTDIR)\apr-1" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\apr.bsc" -BSC32_SBRS= \ - -LIB32=link.exe -lib -LIB32_FLAGS=/nologo /out:"$(OUTDIR)\apr-1.lib" -LIB32_OBJS= \ - "$(INTDIR)\apr_atomic.obj" \ - "$(INTDIR)\dso.obj" \ - "$(INTDIR)\buffer.obj" \ - "$(INTDIR)\copy.obj" \ - "$(INTDIR)\dir.obj" \ - "$(INTDIR)\fileacc.obj" \ - "$(INTDIR)\filedup.obj" \ - "$(INTDIR)\filepath.obj" \ - "$(INTDIR)\filepath_util.obj" \ - "$(INTDIR)\filestat.obj" \ - "$(INTDIR)\filesys.obj" \ - "$(INTDIR)\flock.obj" \ - "$(INTDIR)\fullrw.obj" \ - "$(INTDIR)\mktemp.obj" \ - "$(INTDIR)\open.obj" \ - "$(INTDIR)\pipe.obj" \ - "$(INTDIR)\readwrite.obj" \ - "$(INTDIR)\seek.obj" \ - "$(INTDIR)\tempdir.obj" \ - "$(INTDIR)\proc_mutex.obj" \ - "$(INTDIR)\thread_cond.obj" \ - "$(INTDIR)\thread_mutex.obj" \ - "$(INTDIR)\thread_rwlock.obj" \ - "$(INTDIR)\apr_pools.obj" \ - "$(INTDIR)\charset.obj" \ - "$(INTDIR)\env.obj" \ - "$(INTDIR)\errorcodes.obj" \ - "$(INTDIR)\getopt.obj" \ - "$(INTDIR)\internal.obj" \ - "$(INTDIR)\misc.obj" \ - "$(INTDIR)\otherchild.obj" \ - "$(INTDIR)\rand.obj" \ - "$(INTDIR)\start.obj" \ - "$(INTDIR)\utf8.obj" \ - "$(INTDIR)\version.obj" \ - "$(INTDIR)\common.obj" \ - "$(INTDIR)\mmap.obj" \ - "$(INTDIR)\inet_ntop.obj" \ - "$(INTDIR)\inet_pton.obj" \ - "$(INTDIR)\multicast.obj" \ - "$(INTDIR)\sendrecv.obj" \ - "$(INTDIR)\sockaddr.obj" \ - "$(INTDIR)\sockets.obj" \ - "$(INTDIR)\socket_util.obj" \ - "$(INTDIR)\sockopt.obj" \ - "$(INTDIR)\apr_getpass.obj" \ - "$(INTDIR)\poll.obj" \ - "$(INTDIR)\pollcb.obj" \ - "$(INTDIR)\pollset.obj" \ - "$(INTDIR)\select.obj" \ - "$(INTDIR)\apr_random.obj" \ - "$(INTDIR)\sha2.obj" \ - "$(INTDIR)\sha2_glue.obj" \ - "$(INTDIR)\shm.obj" \ - "$(INTDIR)\apr_cpystrn.obj" \ - "$(INTDIR)\apr_fnmatch.obj" \ - "$(INTDIR)\apr_snprintf.obj" \ - "$(INTDIR)\apr_strings.obj" \ - "$(INTDIR)\apr_strnatcmp.obj" \ - "$(INTDIR)\apr_strtok.obj" \ - "$(INTDIR)\apr_hash.obj" \ - "$(INTDIR)\apr_tables.obj" \ - "$(INTDIR)\proc.obj" \ - "$(INTDIR)\signals.obj" \ - "$(INTDIR)\thread.obj" \ - "$(INTDIR)\threadpriv.obj" \ - "$(INTDIR)\time.obj" \ - "$(INTDIR)\timestr.obj" \ - "$(INTDIR)\groupinfo.obj" \ - "$(INTDIR)\userinfo.obj" - -"$(OUTDIR)\apr-1.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) - $(LIB32) @<< - $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) -<< - -!ELSEIF "$(CFG)" == "apr - Win32 Debug" - -OUTDIR=.\LibD -INTDIR=.\LibD -# Begin Custom Macros -OutDir=.\LibD -# End Custom Macros - -ALL : ".\include\apr.h" "$(OUTDIR)\apr-1.lib" - - -CLEAN : - -@erase "$(INTDIR)\apr-1.idb" - -@erase "$(INTDIR)\apr-1.pdb" - -@erase "$(INTDIR)\apr_atomic.obj" - -@erase "$(INTDIR)\apr_cpystrn.obj" - -@erase "$(INTDIR)\apr_fnmatch.obj" - -@erase "$(INTDIR)\apr_getpass.obj" - -@erase "$(INTDIR)\apr_hash.obj" - -@erase "$(INTDIR)\apr_pools.obj" - -@erase "$(INTDIR)\apr_random.obj" - -@erase "$(INTDIR)\apr_snprintf.obj" - -@erase "$(INTDIR)\apr_strings.obj" - -@erase "$(INTDIR)\apr_strnatcmp.obj" - -@erase "$(INTDIR)\apr_strtok.obj" - -@erase "$(INTDIR)\apr_tables.obj" - -@erase "$(INTDIR)\buffer.obj" - -@erase "$(INTDIR)\charset.obj" - -@erase "$(INTDIR)\common.obj" - -@erase "$(INTDIR)\copy.obj" - -@erase "$(INTDIR)\dir.obj" - -@erase "$(INTDIR)\dso.obj" - -@erase "$(INTDIR)\env.obj" - -@erase "$(INTDIR)\errorcodes.obj" - -@erase "$(INTDIR)\fileacc.obj" - -@erase "$(INTDIR)\filedup.obj" - -@erase "$(INTDIR)\filepath.obj" - -@erase "$(INTDIR)\filepath_util.obj" - -@erase "$(INTDIR)\filestat.obj" - -@erase "$(INTDIR)\filesys.obj" - -@erase "$(INTDIR)\flock.obj" - -@erase "$(INTDIR)\fullrw.obj" - -@erase "$(INTDIR)\getopt.obj" - -@erase "$(INTDIR)\groupinfo.obj" - -@erase "$(INTDIR)\inet_ntop.obj" - -@erase "$(INTDIR)\inet_pton.obj" - -@erase "$(INTDIR)\internal.obj" - -@erase "$(INTDIR)\misc.obj" - -@erase "$(INTDIR)\mktemp.obj" - -@erase "$(INTDIR)\mmap.obj" - -@erase "$(INTDIR)\multicast.obj" - -@erase "$(INTDIR)\open.obj" - -@erase "$(INTDIR)\otherchild.obj" - -@erase "$(INTDIR)\pipe.obj" - -@erase "$(INTDIR)\poll.obj" - -@erase "$(INTDIR)\pollcb.obj" - -@erase "$(INTDIR)\pollset.obj" - -@erase "$(INTDIR)\proc.obj" - -@erase "$(INTDIR)\proc_mutex.obj" - -@erase "$(INTDIR)\rand.obj" - -@erase "$(INTDIR)\readwrite.obj" - -@erase "$(INTDIR)\seek.obj" - -@erase "$(INTDIR)\select.obj" - -@erase "$(INTDIR)\sendrecv.obj" - -@erase "$(INTDIR)\sha2.obj" - -@erase "$(INTDIR)\sha2_glue.obj" - -@erase "$(INTDIR)\shm.obj" - -@erase "$(INTDIR)\signals.obj" - -@erase "$(INTDIR)\sockaddr.obj" - -@erase "$(INTDIR)\socket_util.obj" - -@erase "$(INTDIR)\sockets.obj" - -@erase "$(INTDIR)\sockopt.obj" - -@erase "$(INTDIR)\start.obj" - -@erase "$(INTDIR)\tempdir.obj" - -@erase "$(INTDIR)\thread.obj" - -@erase "$(INTDIR)\thread_cond.obj" - -@erase "$(INTDIR)\thread_mutex.obj" - -@erase "$(INTDIR)\thread_rwlock.obj" - -@erase "$(INTDIR)\threadpriv.obj" - -@erase "$(INTDIR)\time.obj" - -@erase "$(INTDIR)\timestr.obj" - -@erase "$(INTDIR)\userinfo.obj" - -@erase "$(INTDIR)\utf8.obj" - -@erase "$(INTDIR)\version.obj" - -@erase "$(OUTDIR)\apr-1.lib" - -@erase ".\include\apr.h" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(OUTDIR)\apr-1" /FD /EHsc /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\apr.bsc" -BSC32_SBRS= \ - -LIB32=link.exe -lib -LIB32_FLAGS=/nologo /out:"$(OUTDIR)\apr-1.lib" -LIB32_OBJS= \ - "$(INTDIR)\apr_atomic.obj" \ - "$(INTDIR)\dso.obj" \ - "$(INTDIR)\buffer.obj" \ - "$(INTDIR)\copy.obj" \ - "$(INTDIR)\dir.obj" \ - "$(INTDIR)\fileacc.obj" \ - "$(INTDIR)\filedup.obj" \ - "$(INTDIR)\filepath.obj" \ - "$(INTDIR)\filepath_util.obj" \ - "$(INTDIR)\filestat.obj" \ - "$(INTDIR)\filesys.obj" \ - "$(INTDIR)\flock.obj" \ - "$(INTDIR)\fullrw.obj" \ - "$(INTDIR)\mktemp.obj" \ - "$(INTDIR)\open.obj" \ - "$(INTDIR)\pipe.obj" \ - "$(INTDIR)\readwrite.obj" \ - "$(INTDIR)\seek.obj" \ - "$(INTDIR)\tempdir.obj" \ - "$(INTDIR)\proc_mutex.obj" \ - "$(INTDIR)\thread_cond.obj" \ - "$(INTDIR)\thread_mutex.obj" \ - "$(INTDIR)\thread_rwlock.obj" \ - "$(INTDIR)\apr_pools.obj" \ - "$(INTDIR)\charset.obj" \ - "$(INTDIR)\env.obj" \ - "$(INTDIR)\errorcodes.obj" \ - "$(INTDIR)\getopt.obj" \ - "$(INTDIR)\internal.obj" \ - "$(INTDIR)\misc.obj" \ - "$(INTDIR)\otherchild.obj" \ - "$(INTDIR)\rand.obj" \ - "$(INTDIR)\start.obj" \ - "$(INTDIR)\utf8.obj" \ - "$(INTDIR)\version.obj" \ - "$(INTDIR)\common.obj" \ - "$(INTDIR)\mmap.obj" \ - "$(INTDIR)\inet_ntop.obj" \ - "$(INTDIR)\inet_pton.obj" \ - "$(INTDIR)\multicast.obj" \ - "$(INTDIR)\sendrecv.obj" \ - "$(INTDIR)\sockaddr.obj" \ - "$(INTDIR)\sockets.obj" \ - "$(INTDIR)\socket_util.obj" \ - "$(INTDIR)\sockopt.obj" \ - "$(INTDIR)\apr_getpass.obj" \ - "$(INTDIR)\poll.obj" \ - "$(INTDIR)\pollcb.obj" \ - "$(INTDIR)\pollset.obj" \ - "$(INTDIR)\select.obj" \ - "$(INTDIR)\apr_random.obj" \ - "$(INTDIR)\sha2.obj" \ - "$(INTDIR)\sha2_glue.obj" \ - "$(INTDIR)\shm.obj" \ - "$(INTDIR)\apr_cpystrn.obj" \ - "$(INTDIR)\apr_fnmatch.obj" \ - "$(INTDIR)\apr_snprintf.obj" \ - "$(INTDIR)\apr_strings.obj" \ - "$(INTDIR)\apr_strnatcmp.obj" \ - "$(INTDIR)\apr_strtok.obj" \ - "$(INTDIR)\apr_hash.obj" \ - "$(INTDIR)\apr_tables.obj" \ - "$(INTDIR)\proc.obj" \ - "$(INTDIR)\signals.obj" \ - "$(INTDIR)\thread.obj" \ - "$(INTDIR)\threadpriv.obj" \ - "$(INTDIR)\time.obj" \ - "$(INTDIR)\timestr.obj" \ - "$(INTDIR)\groupinfo.obj" \ - "$(INTDIR)\userinfo.obj" - -"$(OUTDIR)\apr-1.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) - $(LIB32) @<< - $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) -<< - -!ELSEIF "$(CFG)" == "apr - Win32 Release9x" - -OUTDIR=.\9x\LibR -INTDIR=.\9x\LibR -# Begin Custom Macros -OutDir=.\9x\LibR -# End Custom Macros - -ALL : ".\include\apr.h" "$(OUTDIR)\apr-1.lib" - - -CLEAN : - -@erase "$(INTDIR)\apr-1.idb" - -@erase "$(INTDIR)\apr-1.pdb" - -@erase "$(INTDIR)\apr_atomic.obj" - -@erase "$(INTDIR)\apr_cpystrn.obj" - -@erase "$(INTDIR)\apr_fnmatch.obj" - -@erase "$(INTDIR)\apr_getpass.obj" - -@erase "$(INTDIR)\apr_hash.obj" - -@erase "$(INTDIR)\apr_pools.obj" - -@erase "$(INTDIR)\apr_random.obj" - -@erase "$(INTDIR)\apr_snprintf.obj" - -@erase "$(INTDIR)\apr_strings.obj" - -@erase "$(INTDIR)\apr_strnatcmp.obj" - -@erase "$(INTDIR)\apr_strtok.obj" - -@erase "$(INTDIR)\apr_tables.obj" - -@erase "$(INTDIR)\buffer.obj" - -@erase "$(INTDIR)\charset.obj" - -@erase "$(INTDIR)\common.obj" - -@erase "$(INTDIR)\copy.obj" - -@erase "$(INTDIR)\dir.obj" - -@erase "$(INTDIR)\dso.obj" - -@erase "$(INTDIR)\env.obj" - -@erase "$(INTDIR)\errorcodes.obj" - -@erase "$(INTDIR)\fileacc.obj" - -@erase "$(INTDIR)\filedup.obj" - -@erase "$(INTDIR)\filepath.obj" - -@erase "$(INTDIR)\filepath_util.obj" - -@erase "$(INTDIR)\filestat.obj" - -@erase "$(INTDIR)\filesys.obj" - -@erase "$(INTDIR)\flock.obj" - -@erase "$(INTDIR)\fullrw.obj" - -@erase "$(INTDIR)\getopt.obj" - -@erase "$(INTDIR)\groupinfo.obj" - -@erase "$(INTDIR)\inet_ntop.obj" - -@erase "$(INTDIR)\inet_pton.obj" - -@erase "$(INTDIR)\internal.obj" - -@erase "$(INTDIR)\misc.obj" - -@erase "$(INTDIR)\mktemp.obj" - -@erase "$(INTDIR)\mmap.obj" - -@erase "$(INTDIR)\multicast.obj" - -@erase "$(INTDIR)\open.obj" - -@erase "$(INTDIR)\otherchild.obj" - -@erase "$(INTDIR)\pipe.obj" - -@erase "$(INTDIR)\poll.obj" - -@erase "$(INTDIR)\pollcb.obj" - -@erase "$(INTDIR)\pollset.obj" - -@erase "$(INTDIR)\proc.obj" - -@erase "$(INTDIR)\proc_mutex.obj" - -@erase "$(INTDIR)\rand.obj" - -@erase "$(INTDIR)\readwrite.obj" - -@erase "$(INTDIR)\seek.obj" - -@erase "$(INTDIR)\select.obj" - -@erase "$(INTDIR)\sendrecv.obj" - -@erase "$(INTDIR)\sha2.obj" - -@erase "$(INTDIR)\sha2_glue.obj" - -@erase "$(INTDIR)\shm.obj" - -@erase "$(INTDIR)\signals.obj" - -@erase "$(INTDIR)\sockaddr.obj" - -@erase "$(INTDIR)\socket_util.obj" - -@erase "$(INTDIR)\sockets.obj" - -@erase "$(INTDIR)\sockopt.obj" - -@erase "$(INTDIR)\start.obj" - -@erase "$(INTDIR)\tempdir.obj" - -@erase "$(INTDIR)\thread.obj" - -@erase "$(INTDIR)\thread_cond.obj" - -@erase "$(INTDIR)\thread_mutex.obj" - -@erase "$(INTDIR)\thread_rwlock.obj" - -@erase "$(INTDIR)\threadpriv.obj" - -@erase "$(INTDIR)\time.obj" - -@erase "$(INTDIR)\timestr.obj" - -@erase "$(INTDIR)\userinfo.obj" - -@erase "$(INTDIR)\utf8.obj" - -@erase "$(INTDIR)\version.obj" - -@erase "$(OUTDIR)\apr-1.lib" - -@erase ".\include\apr.h" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(OUTDIR)\apr-1" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\apr.bsc" -BSC32_SBRS= \ - -LIB32=link.exe -lib -LIB32_FLAGS=/nologo /out:"$(OUTDIR)\apr-1.lib" -LIB32_OBJS= \ - "$(INTDIR)\apr_atomic.obj" \ - "$(INTDIR)\dso.obj" \ - "$(INTDIR)\buffer.obj" \ - "$(INTDIR)\copy.obj" \ - "$(INTDIR)\dir.obj" \ - "$(INTDIR)\fileacc.obj" \ - "$(INTDIR)\filedup.obj" \ - "$(INTDIR)\filepath.obj" \ - "$(INTDIR)\filepath_util.obj" \ - "$(INTDIR)\filestat.obj" \ - "$(INTDIR)\filesys.obj" \ - "$(INTDIR)\flock.obj" \ - "$(INTDIR)\fullrw.obj" \ - "$(INTDIR)\mktemp.obj" \ - "$(INTDIR)\open.obj" \ - "$(INTDIR)\pipe.obj" \ - "$(INTDIR)\readwrite.obj" \ - "$(INTDIR)\seek.obj" \ - "$(INTDIR)\tempdir.obj" \ - "$(INTDIR)\proc_mutex.obj" \ - "$(INTDIR)\thread_cond.obj" \ - "$(INTDIR)\thread_mutex.obj" \ - "$(INTDIR)\thread_rwlock.obj" \ - "$(INTDIR)\apr_pools.obj" \ - "$(INTDIR)\charset.obj" \ - "$(INTDIR)\env.obj" \ - "$(INTDIR)\errorcodes.obj" \ - "$(INTDIR)\getopt.obj" \ - "$(INTDIR)\internal.obj" \ - "$(INTDIR)\misc.obj" \ - "$(INTDIR)\otherchild.obj" \ - "$(INTDIR)\rand.obj" \ - "$(INTDIR)\start.obj" \ - "$(INTDIR)\utf8.obj" \ - "$(INTDIR)\version.obj" \ - "$(INTDIR)\common.obj" \ - "$(INTDIR)\mmap.obj" \ - "$(INTDIR)\inet_ntop.obj" \ - "$(INTDIR)\inet_pton.obj" \ - "$(INTDIR)\multicast.obj" \ - "$(INTDIR)\sendrecv.obj" \ - "$(INTDIR)\sockaddr.obj" \ - "$(INTDIR)\sockets.obj" \ - "$(INTDIR)\socket_util.obj" \ - "$(INTDIR)\sockopt.obj" \ - "$(INTDIR)\apr_getpass.obj" \ - "$(INTDIR)\poll.obj" \ - "$(INTDIR)\pollcb.obj" \ - "$(INTDIR)\pollset.obj" \ - "$(INTDIR)\select.obj" \ - "$(INTDIR)\apr_random.obj" \ - "$(INTDIR)\sha2.obj" \ - "$(INTDIR)\sha2_glue.obj" \ - "$(INTDIR)\shm.obj" \ - "$(INTDIR)\apr_cpystrn.obj" \ - "$(INTDIR)\apr_fnmatch.obj" \ - "$(INTDIR)\apr_snprintf.obj" \ - "$(INTDIR)\apr_strings.obj" \ - "$(INTDIR)\apr_strnatcmp.obj" \ - "$(INTDIR)\apr_strtok.obj" \ - "$(INTDIR)\apr_hash.obj" \ - "$(INTDIR)\apr_tables.obj" \ - "$(INTDIR)\proc.obj" \ - "$(INTDIR)\signals.obj" \ - "$(INTDIR)\thread.obj" \ - "$(INTDIR)\threadpriv.obj" \ - "$(INTDIR)\time.obj" \ - "$(INTDIR)\timestr.obj" \ - "$(INTDIR)\groupinfo.obj" \ - "$(INTDIR)\userinfo.obj" - -"$(OUTDIR)\apr-1.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) - $(LIB32) @<< - $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) -<< - -!ELSEIF "$(CFG)" == "apr - Win32 Debug9x" - -OUTDIR=.\9x\LibD -INTDIR=.\9x\LibD -# Begin Custom Macros -OutDir=.\9x\LibD -# End Custom Macros - -ALL : ".\include\apr.h" "$(OUTDIR)\apr-1.lib" - - -CLEAN : - -@erase "$(INTDIR)\apr-1.idb" - -@erase "$(INTDIR)\apr-1.pdb" - -@erase "$(INTDIR)\apr_atomic.obj" - -@erase "$(INTDIR)\apr_cpystrn.obj" - -@erase "$(INTDIR)\apr_fnmatch.obj" - -@erase "$(INTDIR)\apr_getpass.obj" - -@erase "$(INTDIR)\apr_hash.obj" - -@erase "$(INTDIR)\apr_pools.obj" - -@erase "$(INTDIR)\apr_random.obj" - -@erase "$(INTDIR)\apr_snprintf.obj" - -@erase "$(INTDIR)\apr_strings.obj" - -@erase "$(INTDIR)\apr_strnatcmp.obj" - -@erase "$(INTDIR)\apr_strtok.obj" - -@erase "$(INTDIR)\apr_tables.obj" - -@erase "$(INTDIR)\buffer.obj" - -@erase "$(INTDIR)\charset.obj" - -@erase "$(INTDIR)\common.obj" - -@erase "$(INTDIR)\copy.obj" - -@erase "$(INTDIR)\dir.obj" - -@erase "$(INTDIR)\dso.obj" - -@erase "$(INTDIR)\env.obj" - -@erase "$(INTDIR)\errorcodes.obj" - -@erase "$(INTDIR)\fileacc.obj" - -@erase "$(INTDIR)\filedup.obj" - -@erase "$(INTDIR)\filepath.obj" - -@erase "$(INTDIR)\filepath_util.obj" - -@erase "$(INTDIR)\filestat.obj" - -@erase "$(INTDIR)\filesys.obj" - -@erase "$(INTDIR)\flock.obj" - -@erase "$(INTDIR)\fullrw.obj" - -@erase "$(INTDIR)\getopt.obj" - -@erase "$(INTDIR)\groupinfo.obj" - -@erase "$(INTDIR)\inet_ntop.obj" - -@erase "$(INTDIR)\inet_pton.obj" - -@erase "$(INTDIR)\internal.obj" - -@erase "$(INTDIR)\misc.obj" - -@erase "$(INTDIR)\mktemp.obj" - -@erase "$(INTDIR)\mmap.obj" - -@erase "$(INTDIR)\multicast.obj" - -@erase "$(INTDIR)\open.obj" - -@erase "$(INTDIR)\otherchild.obj" - -@erase "$(INTDIR)\pipe.obj" - -@erase "$(INTDIR)\poll.obj" - -@erase "$(INTDIR)\pollcb.obj" - -@erase "$(INTDIR)\pollset.obj" - -@erase "$(INTDIR)\proc.obj" - -@erase "$(INTDIR)\proc_mutex.obj" - -@erase "$(INTDIR)\rand.obj" - -@erase "$(INTDIR)\readwrite.obj" - -@erase "$(INTDIR)\seek.obj" - -@erase "$(INTDIR)\select.obj" - -@erase "$(INTDIR)\sendrecv.obj" - -@erase "$(INTDIR)\sha2.obj" - -@erase "$(INTDIR)\sha2_glue.obj" - -@erase "$(INTDIR)\shm.obj" - -@erase "$(INTDIR)\signals.obj" - -@erase "$(INTDIR)\sockaddr.obj" - -@erase "$(INTDIR)\socket_util.obj" - -@erase "$(INTDIR)\sockets.obj" - -@erase "$(INTDIR)\sockopt.obj" - -@erase "$(INTDIR)\start.obj" - -@erase "$(INTDIR)\tempdir.obj" - -@erase "$(INTDIR)\thread.obj" - -@erase "$(INTDIR)\thread_cond.obj" - -@erase "$(INTDIR)\thread_mutex.obj" - -@erase "$(INTDIR)\thread_rwlock.obj" - -@erase "$(INTDIR)\threadpriv.obj" - -@erase "$(INTDIR)\time.obj" - -@erase "$(INTDIR)\timestr.obj" - -@erase "$(INTDIR)\userinfo.obj" - -@erase "$(INTDIR)\utf8.obj" - -@erase "$(INTDIR)\version.obj" - -@erase "$(OUTDIR)\apr-1.lib" - -@erase ".\include\apr.h" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(OUTDIR)\apr-1" /FD /EHsc /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\apr.bsc" -BSC32_SBRS= \ - -LIB32=link.exe -lib -LIB32_FLAGS=/nologo /out:"$(OUTDIR)\apr-1.lib" -LIB32_OBJS= \ - "$(INTDIR)\apr_atomic.obj" \ - "$(INTDIR)\dso.obj" \ - "$(INTDIR)\buffer.obj" \ - "$(INTDIR)\copy.obj" \ - "$(INTDIR)\dir.obj" \ - "$(INTDIR)\fileacc.obj" \ - "$(INTDIR)\filedup.obj" \ - "$(INTDIR)\filepath.obj" \ - "$(INTDIR)\filepath_util.obj" \ - "$(INTDIR)\filestat.obj" \ - "$(INTDIR)\filesys.obj" \ - "$(INTDIR)\flock.obj" \ - "$(INTDIR)\fullrw.obj" \ - "$(INTDIR)\mktemp.obj" \ - "$(INTDIR)\open.obj" \ - "$(INTDIR)\pipe.obj" \ - "$(INTDIR)\readwrite.obj" \ - "$(INTDIR)\seek.obj" \ - "$(INTDIR)\tempdir.obj" \ - "$(INTDIR)\proc_mutex.obj" \ - "$(INTDIR)\thread_cond.obj" \ - "$(INTDIR)\thread_mutex.obj" \ - "$(INTDIR)\thread_rwlock.obj" \ - "$(INTDIR)\apr_pools.obj" \ - "$(INTDIR)\charset.obj" \ - "$(INTDIR)\env.obj" \ - "$(INTDIR)\errorcodes.obj" \ - "$(INTDIR)\getopt.obj" \ - "$(INTDIR)\internal.obj" \ - "$(INTDIR)\misc.obj" \ - "$(INTDIR)\otherchild.obj" \ - "$(INTDIR)\rand.obj" \ - "$(INTDIR)\start.obj" \ - "$(INTDIR)\utf8.obj" \ - "$(INTDIR)\version.obj" \ - "$(INTDIR)\common.obj" \ - "$(INTDIR)\mmap.obj" \ - "$(INTDIR)\inet_ntop.obj" \ - "$(INTDIR)\inet_pton.obj" \ - "$(INTDIR)\multicast.obj" \ - "$(INTDIR)\sendrecv.obj" \ - "$(INTDIR)\sockaddr.obj" \ - "$(INTDIR)\sockets.obj" \ - "$(INTDIR)\socket_util.obj" \ - "$(INTDIR)\sockopt.obj" \ - "$(INTDIR)\apr_getpass.obj" \ - "$(INTDIR)\poll.obj" \ - "$(INTDIR)\pollcb.obj" \ - "$(INTDIR)\pollset.obj" \ - "$(INTDIR)\select.obj" \ - "$(INTDIR)\apr_random.obj" \ - "$(INTDIR)\sha2.obj" \ - "$(INTDIR)\sha2_glue.obj" \ - "$(INTDIR)\shm.obj" \ - "$(INTDIR)\apr_cpystrn.obj" \ - "$(INTDIR)\apr_fnmatch.obj" \ - "$(INTDIR)\apr_snprintf.obj" \ - "$(INTDIR)\apr_strings.obj" \ - "$(INTDIR)\apr_strnatcmp.obj" \ - "$(INTDIR)\apr_strtok.obj" \ - "$(INTDIR)\apr_hash.obj" \ - "$(INTDIR)\apr_tables.obj" \ - "$(INTDIR)\proc.obj" \ - "$(INTDIR)\signals.obj" \ - "$(INTDIR)\thread.obj" \ - "$(INTDIR)\threadpriv.obj" \ - "$(INTDIR)\time.obj" \ - "$(INTDIR)\timestr.obj" \ - "$(INTDIR)\groupinfo.obj" \ - "$(INTDIR)\userinfo.obj" - -"$(OUTDIR)\apr-1.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) - $(LIB32) @<< - $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) -<< - -!ELSEIF "$(CFG)" == "apr - x64 Release" - -OUTDIR=.\x64\LibR -INTDIR=.\x64\LibR -# Begin Custom Macros -OutDir=.\x64\LibR -# End Custom Macros - -ALL : ".\include\apr.h" "$(OUTDIR)\apr-1.lib" - - -CLEAN : - -@erase "$(INTDIR)\apr-1.idb" - -@erase "$(INTDIR)\apr-1.pdb" - -@erase "$(INTDIR)\apr_atomic.obj" - -@erase "$(INTDIR)\apr_cpystrn.obj" - -@erase "$(INTDIR)\apr_fnmatch.obj" - -@erase "$(INTDIR)\apr_getpass.obj" - -@erase "$(INTDIR)\apr_hash.obj" - -@erase "$(INTDIR)\apr_pools.obj" - -@erase "$(INTDIR)\apr_random.obj" - -@erase "$(INTDIR)\apr_snprintf.obj" - -@erase "$(INTDIR)\apr_strings.obj" - -@erase "$(INTDIR)\apr_strnatcmp.obj" - -@erase "$(INTDIR)\apr_strtok.obj" - -@erase "$(INTDIR)\apr_tables.obj" - -@erase "$(INTDIR)\buffer.obj" - -@erase "$(INTDIR)\charset.obj" - -@erase "$(INTDIR)\common.obj" - -@erase "$(INTDIR)\copy.obj" - -@erase "$(INTDIR)\dir.obj" - -@erase "$(INTDIR)\dso.obj" - -@erase "$(INTDIR)\env.obj" - -@erase "$(INTDIR)\errorcodes.obj" - -@erase "$(INTDIR)\fileacc.obj" - -@erase "$(INTDIR)\filedup.obj" - -@erase "$(INTDIR)\filepath.obj" - -@erase "$(INTDIR)\filepath_util.obj" - -@erase "$(INTDIR)\filestat.obj" - -@erase "$(INTDIR)\filesys.obj" - -@erase "$(INTDIR)\flock.obj" - -@erase "$(INTDIR)\fullrw.obj" - -@erase "$(INTDIR)\getopt.obj" - -@erase "$(INTDIR)\groupinfo.obj" - -@erase "$(INTDIR)\inet_ntop.obj" - -@erase "$(INTDIR)\inet_pton.obj" - -@erase "$(INTDIR)\internal.obj" - -@erase "$(INTDIR)\misc.obj" - -@erase "$(INTDIR)\mktemp.obj" - -@erase "$(INTDIR)\mmap.obj" - -@erase "$(INTDIR)\multicast.obj" - -@erase "$(INTDIR)\open.obj" - -@erase "$(INTDIR)\otherchild.obj" - -@erase "$(INTDIR)\pipe.obj" - -@erase "$(INTDIR)\poll.obj" - -@erase "$(INTDIR)\pollcb.obj" - -@erase "$(INTDIR)\pollset.obj" - -@erase "$(INTDIR)\proc.obj" - -@erase "$(INTDIR)\proc_mutex.obj" - -@erase "$(INTDIR)\rand.obj" - -@erase "$(INTDIR)\readwrite.obj" - -@erase "$(INTDIR)\seek.obj" - -@erase "$(INTDIR)\select.obj" - -@erase "$(INTDIR)\sendrecv.obj" - -@erase "$(INTDIR)\sha2.obj" - -@erase "$(INTDIR)\sha2_glue.obj" - -@erase "$(INTDIR)\shm.obj" - -@erase "$(INTDIR)\signals.obj" - -@erase "$(INTDIR)\sockaddr.obj" - -@erase "$(INTDIR)\socket_util.obj" - -@erase "$(INTDIR)\sockets.obj" - -@erase "$(INTDIR)\sockopt.obj" - -@erase "$(INTDIR)\start.obj" - -@erase "$(INTDIR)\tempdir.obj" - -@erase "$(INTDIR)\thread.obj" - -@erase "$(INTDIR)\thread_cond.obj" - -@erase "$(INTDIR)\thread_mutex.obj" - -@erase "$(INTDIR)\thread_rwlock.obj" - -@erase "$(INTDIR)\threadpriv.obj" - -@erase "$(INTDIR)\time.obj" - -@erase "$(INTDIR)\timestr.obj" - -@erase "$(INTDIR)\userinfo.obj" - -@erase "$(INTDIR)\utf8.obj" - -@erase "$(INTDIR)\version.obj" - -@erase "$(OUTDIR)\apr-1.lib" - -@erase ".\include\apr.h" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(OUTDIR)\apr-1" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\apr.bsc" -BSC32_SBRS= \ - -LIB32=link.exe -lib -LIB32_FLAGS=/nologo /out:"$(OUTDIR)\apr-1.lib" -LIB32_OBJS= \ - "$(INTDIR)\apr_atomic.obj" \ - "$(INTDIR)\dso.obj" \ - "$(INTDIR)\buffer.obj" \ - "$(INTDIR)\copy.obj" \ - "$(INTDIR)\dir.obj" \ - "$(INTDIR)\fileacc.obj" \ - "$(INTDIR)\filedup.obj" \ - "$(INTDIR)\filepath.obj" \ - "$(INTDIR)\filepath_util.obj" \ - "$(INTDIR)\filestat.obj" \ - "$(INTDIR)\filesys.obj" \ - "$(INTDIR)\flock.obj" \ - "$(INTDIR)\fullrw.obj" \ - "$(INTDIR)\mktemp.obj" \ - "$(INTDIR)\open.obj" \ - "$(INTDIR)\pipe.obj" \ - "$(INTDIR)\readwrite.obj" \ - "$(INTDIR)\seek.obj" \ - "$(INTDIR)\tempdir.obj" \ - "$(INTDIR)\proc_mutex.obj" \ - "$(INTDIR)\thread_cond.obj" \ - "$(INTDIR)\thread_mutex.obj" \ - "$(INTDIR)\thread_rwlock.obj" \ - "$(INTDIR)\apr_pools.obj" \ - "$(INTDIR)\charset.obj" \ - "$(INTDIR)\env.obj" \ - "$(INTDIR)\errorcodes.obj" \ - "$(INTDIR)\getopt.obj" \ - "$(INTDIR)\internal.obj" \ - "$(INTDIR)\misc.obj" \ - "$(INTDIR)\otherchild.obj" \ - "$(INTDIR)\rand.obj" \ - "$(INTDIR)\start.obj" \ - "$(INTDIR)\utf8.obj" \ - "$(INTDIR)\version.obj" \ - "$(INTDIR)\common.obj" \ - "$(INTDIR)\mmap.obj" \ - "$(INTDIR)\inet_ntop.obj" \ - "$(INTDIR)\inet_pton.obj" \ - "$(INTDIR)\multicast.obj" \ - "$(INTDIR)\sendrecv.obj" \ - "$(INTDIR)\sockaddr.obj" \ - "$(INTDIR)\sockets.obj" \ - "$(INTDIR)\socket_util.obj" \ - "$(INTDIR)\sockopt.obj" \ - "$(INTDIR)\apr_getpass.obj" \ - "$(INTDIR)\poll.obj" \ - "$(INTDIR)\pollcb.obj" \ - "$(INTDIR)\pollset.obj" \ - "$(INTDIR)\select.obj" \ - "$(INTDIR)\apr_random.obj" \ - "$(INTDIR)\sha2.obj" \ - "$(INTDIR)\sha2_glue.obj" \ - "$(INTDIR)\shm.obj" \ - "$(INTDIR)\apr_cpystrn.obj" \ - "$(INTDIR)\apr_fnmatch.obj" \ - "$(INTDIR)\apr_snprintf.obj" \ - "$(INTDIR)\apr_strings.obj" \ - "$(INTDIR)\apr_strnatcmp.obj" \ - "$(INTDIR)\apr_strtok.obj" \ - "$(INTDIR)\apr_hash.obj" \ - "$(INTDIR)\apr_tables.obj" \ - "$(INTDIR)\proc.obj" \ - "$(INTDIR)\signals.obj" \ - "$(INTDIR)\thread.obj" \ - "$(INTDIR)\threadpriv.obj" \ - "$(INTDIR)\time.obj" \ - "$(INTDIR)\timestr.obj" \ - "$(INTDIR)\groupinfo.obj" \ - "$(INTDIR)\userinfo.obj" - -"$(OUTDIR)\apr-1.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) - $(LIB32) @<< - $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) -<< - -!ELSEIF "$(CFG)" == "apr - x64 Debug" - -OUTDIR=.\x64\LibD -INTDIR=.\x64\LibD -# Begin Custom Macros -OutDir=.\x64\LibD -# End Custom Macros - -ALL : ".\include\apr.h" "$(OUTDIR)\apr-1.lib" - - -CLEAN : - -@erase "$(INTDIR)\apr-1.idb" - -@erase "$(INTDIR)\apr-1.pdb" - -@erase "$(INTDIR)\apr_atomic.obj" - -@erase "$(INTDIR)\apr_cpystrn.obj" - -@erase "$(INTDIR)\apr_fnmatch.obj" - -@erase "$(INTDIR)\apr_getpass.obj" - -@erase "$(INTDIR)\apr_hash.obj" - -@erase "$(INTDIR)\apr_pools.obj" - -@erase "$(INTDIR)\apr_random.obj" - -@erase "$(INTDIR)\apr_snprintf.obj" - -@erase "$(INTDIR)\apr_strings.obj" - -@erase "$(INTDIR)\apr_strnatcmp.obj" - -@erase "$(INTDIR)\apr_strtok.obj" - -@erase "$(INTDIR)\apr_tables.obj" - -@erase "$(INTDIR)\buffer.obj" - -@erase "$(INTDIR)\charset.obj" - -@erase "$(INTDIR)\common.obj" - -@erase "$(INTDIR)\copy.obj" - -@erase "$(INTDIR)\dir.obj" - -@erase "$(INTDIR)\dso.obj" - -@erase "$(INTDIR)\env.obj" - -@erase "$(INTDIR)\errorcodes.obj" - -@erase "$(INTDIR)\fileacc.obj" - -@erase "$(INTDIR)\filedup.obj" - -@erase "$(INTDIR)\filepath.obj" - -@erase "$(INTDIR)\filepath_util.obj" - -@erase "$(INTDIR)\filestat.obj" - -@erase "$(INTDIR)\filesys.obj" - -@erase "$(INTDIR)\flock.obj" - -@erase "$(INTDIR)\fullrw.obj" - -@erase "$(INTDIR)\getopt.obj" - -@erase "$(INTDIR)\groupinfo.obj" - -@erase "$(INTDIR)\inet_ntop.obj" - -@erase "$(INTDIR)\inet_pton.obj" - -@erase "$(INTDIR)\internal.obj" - -@erase "$(INTDIR)\misc.obj" - -@erase "$(INTDIR)\mktemp.obj" - -@erase "$(INTDIR)\mmap.obj" - -@erase "$(INTDIR)\multicast.obj" - -@erase "$(INTDIR)\open.obj" - -@erase "$(INTDIR)\otherchild.obj" - -@erase "$(INTDIR)\pipe.obj" - -@erase "$(INTDIR)\poll.obj" - -@erase "$(INTDIR)\pollcb.obj" - -@erase "$(INTDIR)\pollset.obj" - -@erase "$(INTDIR)\proc.obj" - -@erase "$(INTDIR)\proc_mutex.obj" - -@erase "$(INTDIR)\rand.obj" - -@erase "$(INTDIR)\readwrite.obj" - -@erase "$(INTDIR)\seek.obj" - -@erase "$(INTDIR)\select.obj" - -@erase "$(INTDIR)\sendrecv.obj" - -@erase "$(INTDIR)\sha2.obj" - -@erase "$(INTDIR)\sha2_glue.obj" - -@erase "$(INTDIR)\shm.obj" - -@erase "$(INTDIR)\signals.obj" - -@erase "$(INTDIR)\sockaddr.obj" - -@erase "$(INTDIR)\socket_util.obj" - -@erase "$(INTDIR)\sockets.obj" - -@erase "$(INTDIR)\sockopt.obj" - -@erase "$(INTDIR)\start.obj" - -@erase "$(INTDIR)\tempdir.obj" - -@erase "$(INTDIR)\thread.obj" - -@erase "$(INTDIR)\thread_cond.obj" - -@erase "$(INTDIR)\thread_mutex.obj" - -@erase "$(INTDIR)\thread_rwlock.obj" - -@erase "$(INTDIR)\threadpriv.obj" - -@erase "$(INTDIR)\time.obj" - -@erase "$(INTDIR)\timestr.obj" - -@erase "$(INTDIR)\userinfo.obj" - -@erase "$(INTDIR)\utf8.obj" - -@erase "$(INTDIR)\version.obj" - -@erase "$(OUTDIR)\apr-1.lib" - -@erase ".\include\apr.h" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(OUTDIR)\apr-1" /FD /EHsc /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\apr.bsc" -BSC32_SBRS= \ - -LIB32=link.exe -lib -LIB32_FLAGS=/nologo /out:"$(OUTDIR)\apr-1.lib" -LIB32_OBJS= \ - "$(INTDIR)\apr_atomic.obj" \ - "$(INTDIR)\dso.obj" \ - "$(INTDIR)\buffer.obj" \ - "$(INTDIR)\copy.obj" \ - "$(INTDIR)\dir.obj" \ - "$(INTDIR)\fileacc.obj" \ - "$(INTDIR)\filedup.obj" \ - "$(INTDIR)\filepath.obj" \ - "$(INTDIR)\filepath_util.obj" \ - "$(INTDIR)\filestat.obj" \ - "$(INTDIR)\filesys.obj" \ - "$(INTDIR)\flock.obj" \ - "$(INTDIR)\fullrw.obj" \ - "$(INTDIR)\mktemp.obj" \ - "$(INTDIR)\open.obj" \ - "$(INTDIR)\pipe.obj" \ - "$(INTDIR)\readwrite.obj" \ - "$(INTDIR)\seek.obj" \ - "$(INTDIR)\tempdir.obj" \ - "$(INTDIR)\proc_mutex.obj" \ - "$(INTDIR)\thread_cond.obj" \ - "$(INTDIR)\thread_mutex.obj" \ - "$(INTDIR)\thread_rwlock.obj" \ - "$(INTDIR)\apr_pools.obj" \ - "$(INTDIR)\charset.obj" \ - "$(INTDIR)\env.obj" \ - "$(INTDIR)\errorcodes.obj" \ - "$(INTDIR)\getopt.obj" \ - "$(INTDIR)\internal.obj" \ - "$(INTDIR)\misc.obj" \ - "$(INTDIR)\otherchild.obj" \ - "$(INTDIR)\rand.obj" \ - "$(INTDIR)\start.obj" \ - "$(INTDIR)\utf8.obj" \ - "$(INTDIR)\version.obj" \ - "$(INTDIR)\common.obj" \ - "$(INTDIR)\mmap.obj" \ - "$(INTDIR)\inet_ntop.obj" \ - "$(INTDIR)\inet_pton.obj" \ - "$(INTDIR)\multicast.obj" \ - "$(INTDIR)\sendrecv.obj" \ - "$(INTDIR)\sockaddr.obj" \ - "$(INTDIR)\sockets.obj" \ - "$(INTDIR)\socket_util.obj" \ - "$(INTDIR)\sockopt.obj" \ - "$(INTDIR)\apr_getpass.obj" \ - "$(INTDIR)\poll.obj" \ - "$(INTDIR)\pollcb.obj" \ - "$(INTDIR)\pollset.obj" \ - "$(INTDIR)\select.obj" \ - "$(INTDIR)\apr_random.obj" \ - "$(INTDIR)\sha2.obj" \ - "$(INTDIR)\sha2_glue.obj" \ - "$(INTDIR)\shm.obj" \ - "$(INTDIR)\apr_cpystrn.obj" \ - "$(INTDIR)\apr_fnmatch.obj" \ - "$(INTDIR)\apr_snprintf.obj" \ - "$(INTDIR)\apr_strings.obj" \ - "$(INTDIR)\apr_strnatcmp.obj" \ - "$(INTDIR)\apr_strtok.obj" \ - "$(INTDIR)\apr_hash.obj" \ - "$(INTDIR)\apr_tables.obj" \ - "$(INTDIR)\proc.obj" \ - "$(INTDIR)\signals.obj" \ - "$(INTDIR)\thread.obj" \ - "$(INTDIR)\threadpriv.obj" \ - "$(INTDIR)\time.obj" \ - "$(INTDIR)\timestr.obj" \ - "$(INTDIR)\groupinfo.obj" \ - "$(INTDIR)\userinfo.obj" - -"$(OUTDIR)\apr-1.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) - $(LIB32) @<< - $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) -<< - -!ENDIF - - -!IF "$(NO_EXTERNAL_DEPS)" != "1" -!IF EXISTS("apr.dep") -!INCLUDE "apr.dep" -!ELSE -!MESSAGE Warning: cannot find "apr.dep" -!ENDIF -!ENDIF - - -!IF "$(CFG)" == "apr - Win32 Release" || "$(CFG)" == "apr - Win32 Debug" || "$(CFG)" == "apr - Win32 Release9x" || "$(CFG)" == "apr - Win32 Debug9x" || "$(CFG)" == "apr - x64 Release" || "$(CFG)" == "apr - x64 Debug" -SOURCE=.\atomic\win32\apr_atomic.c - -"$(INTDIR)\apr_atomic.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\dso\win32\dso.c - -"$(INTDIR)\dso.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\file_io\win32\buffer.c - -"$(INTDIR)\buffer.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\file_io\unix\copy.c - -"$(INTDIR)\copy.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\file_io\win32\dir.c - -"$(INTDIR)\dir.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\file_io\unix\fileacc.c - -"$(INTDIR)\fileacc.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\file_io\win32\filedup.c - -"$(INTDIR)\filedup.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\file_io\win32\filepath.c - -"$(INTDIR)\filepath.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\file_io\unix\filepath_util.c - -"$(INTDIR)\filepath_util.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\file_io\win32\filestat.c - -"$(INTDIR)\filestat.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\file_io\win32\filesys.c - -"$(INTDIR)\filesys.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\file_io\win32\flock.c - -"$(INTDIR)\flock.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\file_io\unix\fullrw.c - -"$(INTDIR)\fullrw.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\file_io\unix\mktemp.c - -"$(INTDIR)\mktemp.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\file_io\win32\open.c - -"$(INTDIR)\open.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\file_io\win32\pipe.c - -"$(INTDIR)\pipe.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\file_io\win32\readwrite.c - -"$(INTDIR)\readwrite.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\file_io\win32\seek.c - -"$(INTDIR)\seek.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\file_io\unix\tempdir.c - -"$(INTDIR)\tempdir.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\locks\win32\proc_mutex.c - -"$(INTDIR)\proc_mutex.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\locks\win32\thread_cond.c - -"$(INTDIR)\thread_cond.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\locks\win32\thread_mutex.c - -"$(INTDIR)\thread_mutex.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\locks\win32\thread_rwlock.c - -"$(INTDIR)\thread_rwlock.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\memory\unix\apr_pools.c - -"$(INTDIR)\apr_pools.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\misc\win32\apr_app.c -SOURCE=.\misc\win32\charset.c - -"$(INTDIR)\charset.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\misc\win32\env.c - -"$(INTDIR)\env.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\misc\unix\errorcodes.c - -"$(INTDIR)\errorcodes.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\misc\unix\getopt.c - -"$(INTDIR)\getopt.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\misc\win32\internal.c - -"$(INTDIR)\internal.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\misc\win32\misc.c - -"$(INTDIR)\misc.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\misc\unix\otherchild.c - -"$(INTDIR)\otherchild.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\misc\win32\rand.c - -"$(INTDIR)\rand.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\misc\win32\start.c - -"$(INTDIR)\start.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\misc\win32\utf8.c - -"$(INTDIR)\utf8.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\misc\unix\version.c - -"$(INTDIR)\version.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\mmap\unix\common.c - -"$(INTDIR)\common.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\mmap\win32\mmap.c - -"$(INTDIR)\mmap.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\network_io\unix\inet_ntop.c - -"$(INTDIR)\inet_ntop.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\network_io\unix\inet_pton.c - -"$(INTDIR)\inet_pton.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\network_io\unix\multicast.c - -"$(INTDIR)\multicast.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\network_io\win32\sendrecv.c - -"$(INTDIR)\sendrecv.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\network_io\unix\sockaddr.c - -"$(INTDIR)\sockaddr.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\network_io\unix\socket_util.c - -"$(INTDIR)\socket_util.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\network_io\win32\sockets.c - -"$(INTDIR)\sockets.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\network_io\win32\sockopt.c - -"$(INTDIR)\sockopt.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\passwd\apr_getpass.c - -"$(INTDIR)\apr_getpass.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\poll\unix\poll.c - -"$(INTDIR)\poll.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\poll\unix\pollcb.c - -"$(INTDIR)\pollcb.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\poll\unix\pollset.c - -"$(INTDIR)\pollset.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\poll\unix\select.c - -"$(INTDIR)\select.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\random\unix\apr_random.c - -"$(INTDIR)\apr_random.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\random\unix\sha2.c - -"$(INTDIR)\sha2.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\random\unix\sha2_glue.c - -"$(INTDIR)\sha2_glue.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\shmem\win32\shm.c - -"$(INTDIR)\shm.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\strings\apr_cpystrn.c - -"$(INTDIR)\apr_cpystrn.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\strings\apr_fnmatch.c - -"$(INTDIR)\apr_fnmatch.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\strings\apr_snprintf.c - -"$(INTDIR)\apr_snprintf.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\strings\apr_strings.c - -"$(INTDIR)\apr_strings.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\strings\apr_strnatcmp.c - -"$(INTDIR)\apr_strnatcmp.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\strings\apr_strtok.c - -"$(INTDIR)\apr_strtok.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\tables\apr_hash.c - -"$(INTDIR)\apr_hash.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\tables\apr_tables.c - -"$(INTDIR)\apr_tables.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\threadproc\win32\proc.c - -"$(INTDIR)\proc.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\threadproc\win32\signals.c - -"$(INTDIR)\signals.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\threadproc\win32\thread.c - -"$(INTDIR)\thread.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\threadproc\win32\threadpriv.c - -"$(INTDIR)\threadpriv.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\time\win32\time.c - -"$(INTDIR)\time.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\time\win32\timestr.c - -"$(INTDIR)\timestr.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\user\win32\groupinfo.c - -"$(INTDIR)\groupinfo.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\user\win32\userinfo.c - -"$(INTDIR)\userinfo.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\include\apr.hw - -!IF "$(CFG)" == "apr - Win32 Release" - -InputPath=.\include\apr.hw - -".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - < .\include\apr.h -<< - - -!ELSEIF "$(CFG)" == "apr - Win32 Debug" - -InputPath=.\include\apr.hw - -".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - < .\include\apr.h -<< - - -!ELSEIF "$(CFG)" == "apr - Win32 Release9x" - -InputPath=.\include\apr.hw - -".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - < .\include\apr.h -<< - - -!ELSEIF "$(CFG)" == "apr - Win32 Debug9x" - -InputPath=.\include\apr.hw - -".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - < .\include\apr.h -<< - - -!ELSEIF "$(CFG)" == "apr - x64 Release" - -InputPath=.\include\apr.hw - -".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - < .\include\apr.h -<< - - -!ELSEIF "$(CFG)" == "apr - x64 Debug" - -InputPath=.\include\apr.hw - -".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - < .\include\apr.h -<< - - -!ENDIF - - -!ENDIF - +<< + + +!ENDIF + +SOURCE=.\include\apr_escape.h + +!IF "$(CFG)" == "apr - Win32 Release" + +InputPath=.\include\apr_escape.h + +".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + < .\include\apr_escape_test_char.h +<< + + +!ELSEIF "$(CFG)" == "apr - Win32 Debug" + +InputPath=.\include\apr_escape.h + +".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + < .\include\apr_escape_test_char.h +<< + + +!ELSEIF "$(CFG)" == "apr - Win32 Release9x" + +InputPath=.\include\apr_escape.h + +".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + < .\include\apr_escape_test_char.h +<< + + +!ELSEIF "$(CFG)" == "apr - Win32 Debug9x" + +InputPath=.\include\apr_escape.h + +".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + < .\include\apr_escape_test_char.h +<< + + +!ELSEIF "$(CFG)" == "apr - x64 Release" + +InputPath=.\include\apr_escape.h + +".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + < .\include\apr_escape_test_char.h +<< + + +!ELSEIF "$(CFG)" == "apr - x64 Debug" + +InputPath=.\include\apr_escape.h + +".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + < .\include\apr_escape_test_char.h +<< + + +!ENDIF + +SOURCE=.\include\apr_want.h + +!IF "$(CFG)" == "apr - Win32 Release" + +InputPath=.\include\apr_want.h + +"$(INTDIR)\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + < .\include\apr.h +<< + + +!ELSEIF "$(CFG)" == "apr - Win32 Debug" + +InputPath=.\include\apr_want.h + +"$(INTDIR)\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + < .\include\apr.h +<< + + +!ELSEIF "$(CFG)" == "apr - Win32 Release9x" + +InputPath=.\include\apr_want.h + +"$(INTDIR)\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + < .\include\apr.h +<< + + +!ELSEIF "$(CFG)" == "apr - Win32 Debug9x" + +InputPath=.\include\apr_want.h + +"$(INTDIR)\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + < .\include\apr.h +<< + + +!ELSEIF "$(CFG)" == "apr - x64 Release" + +InputPath=.\include\apr_want.h + +"$(INTDIR)\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + < .\include\apr.h +<< + + +!ELSEIF "$(CFG)" == "apr - x64 Debug" + +InputPath=.\include\apr_want.h + +"$(INTDIR)\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + < .\include\apr.h +<< + + +!ENDIF + + +!ENDIF + diff --git a/contrib/apr/apr.spec b/contrib/apr/apr.spec index 40204ffa049..b3db1675d56 100644 --- a/contrib/apr/apr.spec +++ b/contrib/apr/apr.spec @@ -3,7 +3,7 @@ Summary: Apache Portable Runtime library Name: apr -Version: 1.4.8 +Version: 1.5.1 Release: 1 License: Apache Software License Group: System Environment/Libraries diff --git a/contrib/apr/build-outputs.mk b/contrib/apr/build-outputs.mk index 9f4876e3eec..526f179a476 100644 --- a/contrib/apr/build-outputs.mk +++ b/contrib/apr/build-outputs.mk @@ -1,5 +1,6 @@ # DO NOT EDIT. AUTOMATICALLY GENERATED. +encoding/apr_escape.lo: encoding/apr_escape.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_escape.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h passwd/apr_getpass.lo: passwd/apr_getpass.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h strings/apr_cpystrn.lo: strings/apr_cpystrn.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h strings/apr_fnmatch.lo: strings/apr_fnmatch.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_fnmatch.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h @@ -8,9 +9,10 @@ strings/apr_strings.lo: strings/apr_strings.c .make.dirs include/apr_allocator.h strings/apr_strnatcmp.lo: strings/apr_strnatcmp.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h strings/apr_strtok.lo: strings/apr_strtok.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h tables/apr_hash.lo: tables/apr_hash.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_hash.h include/apr_pools.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h +tables/apr_skiplist.lo: tables/apr_skiplist.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_skiplist.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h tables/apr_tables.lo: tables/apr_tables.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_want.h -OBJECTS_all = passwd/apr_getpass.lo strings/apr_cpystrn.lo strings/apr_fnmatch.lo strings/apr_snprintf.lo strings/apr_strings.lo strings/apr_strnatcmp.lo strings/apr_strtok.lo tables/apr_hash.lo tables/apr_tables.lo +OBJECTS_all = encoding/apr_escape.lo passwd/apr_getpass.lo strings/apr_cpystrn.lo strings/apr_fnmatch.lo strings/apr_snprintf.lo strings/apr_strings.lo strings/apr_strnatcmp.lo strings/apr_strtok.lo tables/apr_hash.lo tables/apr_skiplist.lo tables/apr_tables.lo dso/unix/dso.lo: dso/unix/dso.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h @@ -81,8 +83,9 @@ poll/unix/pollcb.lo: poll/unix/pollcb.c .make.dirs include/apr_allocator.h inclu poll/unix/pollset.lo: poll/unix/pollset.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_poll.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h poll/unix/port.lo: poll/unix/port.c .make.dirs include/apr_allocator.h include/apr_atomic.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_poll.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h poll/unix/select.lo: poll/unix/select.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_poll.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h +poll/unix/z_asio.lo: poll/unix/z_asio.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_hash.h include/apr_inherit.h include/apr_network_io.h include/apr_poll.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h -OBJECTS_poll_unix = poll/unix/epoll.lo poll/unix/kqueue.lo poll/unix/poll.lo poll/unix/pollcb.lo poll/unix/pollset.lo poll/unix/port.lo poll/unix/select.lo +OBJECTS_poll_unix = poll/unix/epoll.lo poll/unix/kqueue.lo poll/unix/poll.lo poll/unix/pollcb.lo poll/unix/pollset.lo poll/unix/port.lo poll/unix/select.lo poll/unix/z_asio.lo random/unix/apr_random.lo: random/unix/apr_random.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_pools.h include/apr_random.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h random/unix/sha2.lo: random/unix/sha2.c .make.dirs @@ -90,7 +93,7 @@ random/unix/sha2_glue.lo: random/unix/sha2_glue.c .make.dirs include/apr_allocat OBJECTS_random_unix = random/unix/apr_random.lo random/unix/sha2.lo random/unix/sha2_glue.lo -shmem/unix/shm.lo: shmem/unix/shm.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_user.h include/apr_want.h +shmem/unix/shm.lo: shmem/unix/shm.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_hash.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_user.h include/apr_want.h OBJECTS_shmem_unix = shmem/unix/shm.lo @@ -308,11 +311,11 @@ OBJECTS_atomic_win32 = atomic/win32/apr_atomic.lo OBJECTS_win32 = $(OBJECTS_all) $(OBJECTS_atomic_win32) $(OBJECTS_dso_win32) $(OBJECTS_file_io_win32) $(OBJECTS_locks_win32) $(OBJECTS_memory_unix) $(OBJECTS_misc_win32) $(OBJECTS_mmap_win32) $(OBJECTS_network_io_win32) $(OBJECTS_poll_unix) $(OBJECTS_random_unix) $(OBJECTS_shmem_win32) $(OBJECTS_support_unix) $(OBJECTS_threadproc_win32) $(OBJECTS_time_win32) $(OBJECTS_user_win32) -HEADERS = $(top_srcdir)/include/apr_allocator.h $(top_srcdir)/include/apr_atomic.h $(top_srcdir)/include/apr_dso.h $(top_srcdir)/include/apr_env.h $(top_srcdir)/include/apr_errno.h $(top_srcdir)/include/apr_file_info.h $(top_srcdir)/include/apr_file_io.h $(top_srcdir)/include/apr_fnmatch.h $(top_srcdir)/include/apr_general.h $(top_srcdir)/include/apr_getopt.h $(top_srcdir)/include/apr_global_mutex.h $(top_srcdir)/include/apr_hash.h $(top_srcdir)/include/apr_inherit.h $(top_srcdir)/include/apr_lib.h $(top_srcdir)/include/apr_mmap.h $(top_srcdir)/include/apr_network_io.h $(top_srcdir)/include/apr_poll.h $(top_srcdir)/include/apr_pools.h $(top_srcdir)/include/apr_portable.h $(top_srcdir)/include/apr_proc_mutex.h $(top_srcdir)/include/apr_random.h $(top_srcdir)/include/apr_ring.h $(top_srcdir)/include/apr_shm.h $(top_srcdir)/include/apr_signal.h $(top_srcdir)/include/apr_strings.h $(top_srcdir)/include/apr_support.h $(top_srcdir)/include/apr_tables.h $(top_srcdir)/include/apr_thread_cond.h $(top_srcdir)/include/apr_thread_mutex.h $(top_srcdir)/include/apr_thread_proc.h $(top_srcdir)/include/apr_thread_rwlock.h $(top_srcdir)/include/apr_time.h $(top_srcdir)/include/apr_user.h $(top_srcdir)/include/apr_version.h $(top_srcdir)/include/apr_want.h +HEADERS = $(top_srcdir)/include/apr_allocator.h $(top_srcdir)/include/apr_atomic.h $(top_srcdir)/include/apr_dso.h $(top_srcdir)/include/apr_env.h $(top_srcdir)/include/apr_errno.h $(top_srcdir)/include/apr_escape.h $(top_srcdir)/include/apr_file_info.h $(top_srcdir)/include/apr_file_io.h $(top_srcdir)/include/apr_fnmatch.h $(top_srcdir)/include/apr_general.h $(top_srcdir)/include/apr_getopt.h $(top_srcdir)/include/apr_global_mutex.h $(top_srcdir)/include/apr_hash.h $(top_srcdir)/include/apr_inherit.h $(top_srcdir)/include/apr_lib.h $(top_srcdir)/include/apr_mmap.h $(top_srcdir)/include/apr_network_io.h $(top_srcdir)/include/apr_poll.h $(top_srcdir)/include/apr_pools.h $(top_srcdir)/include/apr_portable.h $(top_srcdir)/include/apr_proc_mutex.h $(top_srcdir)/include/apr_random.h $(top_srcdir)/include/apr_ring.h $(top_srcdir)/include/apr_shm.h $(top_srcdir)/include/apr_signal.h $(top_srcdir)/include/apr_skiplist.h $(top_srcdir)/include/apr_strings.h $(top_srcdir)/include/apr_support.h $(top_srcdir)/include/apr_tables.h $(top_srcdir)/include/apr_thread_cond.h $(top_srcdir)/include/apr_thread_mutex.h $(top_srcdir)/include/apr_thread_proc.h $(top_srcdir)/include/apr_thread_rwlock.h $(top_srcdir)/include/apr_time.h $(top_srcdir)/include/apr_user.h $(top_srcdir)/include/apr_version.h $(top_srcdir)/include/apr_want.h -SOURCE_DIRS = random/unix misc/win32 mmap/win32 dso/os2 time/unix network_io/win32 dso/win32 locks/unix user/unix time/win32 locks/beos tables support/unix file_io/unix mmap/unix atomic/unix threadproc/win32 poll/os2 atomic/win32 dso/os390 atomic/os390 dso/beos poll/unix passwd network_io/beos threadproc/os2 network_io/os2 shmem/win32 threadproc/beos shmem/unix network_io/unix file_io/os2 dso/aix file_io/win32 threadproc/unix misc/unix locks/win32 shmem/beos dso/unix locks/os2 user/win32 shmem/os2 memory/unix strings $(EXTRA_SOURCE_DIRS) +SOURCE_DIRS = random/unix misc/win32 encoding dso/os2 time/unix network_io/win32 dso/win32 locks/unix user/unix time/win32 locks/beos tables support/unix file_io/unix mmap/unix atomic/unix threadproc/win32 poll/os2 atomic/win32 dso/os390 atomic/os390 dso/beos poll/unix passwd network_io/beos threadproc/os2 network_io/os2 shmem/win32 threadproc/beos shmem/unix network_io/unix file_io/os2 mmap/win32 dso/aix file_io/win32 threadproc/unix misc/unix locks/win32 shmem/beos dso/unix locks/os2 user/win32 shmem/os2 memory/unix strings $(EXTRA_SOURCE_DIRS) -BUILD_DIRS = atomic atomic/os390 atomic/unix atomic/win32 dso dso/aix dso/beos dso/os2 dso/os390 dso/unix dso/win32 file_io file_io/os2 file_io/unix file_io/win32 locks locks/beos locks/os2 locks/unix locks/win32 memory memory/unix misc misc/unix misc/win32 mmap mmap/unix mmap/win32 network_io network_io/beos network_io/os2 network_io/unix network_io/win32 passwd poll poll/os2 poll/unix random random/unix shmem shmem/beos shmem/os2 shmem/unix shmem/win32 strings support support/unix tables threadproc threadproc/beos threadproc/os2 threadproc/unix threadproc/win32 time time/unix time/win32 user user/unix user/win32 +BUILD_DIRS = atomic atomic/os390 atomic/unix atomic/win32 dso dso/aix dso/beos dso/os2 dso/os390 dso/unix dso/win32 encoding file_io file_io/os2 file_io/unix file_io/win32 locks locks/beos locks/os2 locks/unix locks/win32 memory memory/unix misc misc/unix misc/win32 mmap mmap/unix mmap/win32 network_io network_io/beos network_io/os2 network_io/unix network_io/win32 passwd poll poll/os2 poll/unix random random/unix shmem shmem/beos shmem/os2 shmem/unix shmem/win32 strings support support/unix tables threadproc threadproc/beos threadproc/os2 threadproc/unix threadproc/win32 time time/unix time/win32 user user/unix user/win32 .make.dirs: $(srcdir)/build-outputs.mk @for d in $(BUILD_DIRS); do test -d $$d || mkdir $$d; done diff --git a/contrib/apr/build.conf b/contrib/apr/build.conf index c302b98be03..eecadbae8f7 100644 --- a/contrib/apr/build.conf +++ b/contrib/apr/build.conf @@ -6,6 +6,7 @@ # paths to platform-independent .c files to build paths = + encoding/*.c passwd/*.c strings/*.c tables/*.c diff --git a/contrib/apr/configure b/contrib/apr/configure index 00122df8871..860c65b8f56 100755 --- a/contrib/apr/configure +++ b/contrib/apr/configure @@ -639,6 +639,7 @@ DEFAULT_OSDIR OSDIR INCLUDES LDLIBS +INTERNAL_CPPFLAGS NOTEST_INCLUDES NOTEST_LIBS NOTEST_LDFLAGS @@ -919,6 +920,7 @@ enable_lfs enable_nonportable_atomics enable_threads with_efence +enable_posix_shm with_sendfile enable_allocator_uses_mmap enable_dso @@ -1563,7 +1565,8 @@ Optional Features: --disable-lfs Disable large file support on 32-bit platforms --enable-nonportable-atomics Use optimized atomic code which may produce nonportable binaries --enable-threads Enable threading support in APR. - --enable-allocator-uses-mmap Use mmap in apr_allocator instead of malloc (experimental) + --enable-posix-shm Use POSIX shared memory (shm_open) if available + --enable-allocator-uses-mmap Use mmap in apr_allocator instead of malloc --disable-dso Disable DSO support --enable-other-child Enable reliable child processes --disable-ipv6 Disable IPv6 support in APR. @@ -5933,10 +5936,10 @@ if test "x$apr_preload_done" != "xyes" ; then *mint) if test "x$CPPFLAGS" = "x"; then - test "x$silent" != "xyes" && echo " setting CPPFLAGS to \"-DMINT\"" - CPPFLAGS="-DMINT" + test "x$silent" != "xyes" && echo " setting CPPFLAGS to \"-DMINT -D_GNU_SOURCE\"" + CPPFLAGS="-DMINT -D_GNU_SOURCE" else - apr_addto_bugger="-DMINT" + apr_addto_bugger="-DMINT -D_GNU_SOURCE" for i in $apr_addto_bugger; do apr_addto_duplicate="0" for j in $CPPFLAGS; do @@ -5952,27 +5955,6 @@ if test "x$apr_preload_done" != "xyes" ; then done fi - - if test "x$LIBS" = "x"; then - test "x$silent" != "xyes" && echo " setting LIBS to \"-lportlib\"" - LIBS="-lportlib" - else - apr_addto_bugger="-lportlib" - for i in $apr_addto_bugger; do - apr_addto_duplicate="0" - for j in $LIBS; do - if test "x$i" = "x$j"; then - apr_addto_duplicate="1" - break - fi - done - if test $apr_addto_duplicate = "0"; then - test "x$silent" != "xyes" && echo " adding \"$i\" to LIBS" - LIBS="$LIBS $i" - fi - done - fi - ;; *MPE/iX*) @@ -9059,30 +9041,28 @@ $as_echo "#define HAVE_ZOS_PTHREADS 1" >>confdefs.h fi ;; - *cygwin*) + *mingw*) - if test "x$CPPFLAGS" = "x"; then - test "x$silent" != "xyes" && echo " setting CPPFLAGS to \"-DCYGWIN\"" - CPPFLAGS="-DCYGWIN" + if test "x$INTERNAL_CPPFLAGS" = "x"; then + test "x$silent" != "xyes" && echo " setting INTERNAL_CPPFLAGS to \"-DBINPATH=$apr_builddir/test/.libs\"" + INTERNAL_CPPFLAGS="-DBINPATH=$apr_builddir/test/.libs" else - apr_addto_bugger="-DCYGWIN" + apr_addto_bugger="-DBINPATH=$apr_builddir/test/.libs" for i in $apr_addto_bugger; do apr_addto_duplicate="0" - for j in $CPPFLAGS; do + for j in $INTERNAL_CPPFLAGS; do if test "x$i" = "x$j"; then apr_addto_duplicate="1" break fi done if test $apr_addto_duplicate = "0"; then - test "x$silent" != "xyes" && echo " adding \"$i\" to CPPFLAGS" - CPPFLAGS="$CPPFLAGS $i" + test "x$silent" != "xyes" && echo " adding \"$i\" to INTERNAL_CPPFLAGS" + INTERNAL_CPPFLAGS="$INTERNAL_CPPFLAGS $i" fi done fi - ;; - *mingw*) if test "x$CPPFLAGS" = "x"; then test "x$silent" != "xyes" && echo " setting CPPFLAGS to \"-DWIN32 -D__MSVCRT__\"" @@ -17794,7 +17774,7 @@ fi if test "x$use_libtool" = "xyes"; then lt_compile='$(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE) -o $@ -c $< && touch $@' LT_VERSION="-version-info `$get_version libtool $version_hdr APR`" - link="\$(LIBTOOL) \$(LTFLAGS) --mode=link \$(LT_LDFLAGS) \$(COMPILE) \$(LT_VERSION) \$(ALL_LDFLAGS) -o \$@" + link="\$(LIBTOOL) \$(LTFLAGS) --mode=link \$(COMPILE) \$(LT_LDFLAGS) \$(LT_VERSION) \$(ALL_LDFLAGS) -o \$@" so_ext='lo' lib_target='-rpath $(libdir) $(OBJECTS)' export_lib_target='-rpath \$(libdir) \$(OBJECTS)' @@ -17810,6 +17790,9 @@ case $host in *-solaris2*) apr_platform_runtime_link_flag="-R" ;; + *-mingw* | *-cygwin*) + LT_LDFLAGS="$LT_LDFLAGS -no-undefined" + ;; *) ;; esac @@ -18314,6 +18297,53 @@ case "$host:$CC" in AR="ar" ;; + *-mingw* | *-cygwin*) + if test "$enable_shared" = "yes"; then + + if test "x$INTERNAL_CPPFLAGS" = "x"; then + test "x$silent" != "xyes" && echo " setting INTERNAL_CPPFLAGS to \"-DAPR_DECLARE_EXPORT\"" + INTERNAL_CPPFLAGS="-DAPR_DECLARE_EXPORT" + else + apr_addto_bugger="-DAPR_DECLARE_EXPORT" + for i in $apr_addto_bugger; do + apr_addto_duplicate="0" + for j in $INTERNAL_CPPFLAGS; do + if test "x$i" = "x$j"; then + apr_addto_duplicate="1" + break + fi + done + if test $apr_addto_duplicate = "0"; then + test "x$silent" != "xyes" && echo " adding \"$i\" to INTERNAL_CPPFLAGS" + INTERNAL_CPPFLAGS="$INTERNAL_CPPFLAGS $i" + fi + done + fi + + else + + if test "x$CPPFLAGS" = "x"; then + test "x$silent" != "xyes" && echo " setting CPPFLAGS to \"-DAPR_DECLARE_STATIC\"" + CPPFLAGS="-DAPR_DECLARE_STATIC" + else + apr_addto_bugger="-DAPR_DECLARE_STATIC" + for i in $apr_addto_bugger; do + apr_addto_duplicate="0" + for j in $CPPFLAGS; do + if test "x$i" = "x$j"; then + apr_addto_duplicate="1" + break + fi + done + if test $apr_addto_duplicate = "0"; then + test "x$silent" != "xyes" && echo " adding \"$i\" to CPPFLAGS" + CPPFLAGS="$CPPFLAGS $i" + fi + done + fi + + fi + ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler provides atomic builtins" >&5 @@ -18791,7 +18821,17 @@ case $host in fi ;; *linux*) - os_version=`uname -r | sed -e 's/\(.\)\.\(.\)\.\(.\).*/\1\2\3/'` + os_major=`uname -r | sed -e 's/\([1-9][0-9]*\)\..*/\1/'` + os_minor=`uname -r | sed -e 's/[1-9][0-9]*\.\([0-9]\+\)\..*/\1/'` + if test $os_major -lt 2 -o \( $os_major -eq 2 -a $os_minor -lt 4 \); then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Configured for pre-2.4 Linux $os_major.$os_minor" >&5 +$as_echo "$as_me: WARNING: Configured for pre-2.4 Linux $os_major.$os_minor" >&2;} + os_pre24linux=1 + else + os_pre24linux=0 + { $as_echo "$as_me:${as_lineno-$LINENO}: Configured for Linux $os_major.$os_minor" >&5 +$as_echo "$as_me: Configured for Linux $os_major.$os_minor" >&6;} + fi ;; *os390) os_version=`uname -r | sed -e 's/\.//g'` @@ -20391,7 +20431,10 @@ $as_echo "#define HAVE_DUP3 1" >>confdefs.h fi -# test for accept4 +# Test for accept4(). Create a non-blocking socket, bind it to +# an unspecified port & address (kernel picks), and attempt to +# call accept4() on it. If the syscall is wired up (i.e. the +# kernel is new enough), it should return EAGAIN. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for accept4 support" >&5 $as_echo_n "checking for accept4 support... " >&6; } if ${apr_cv_accept4+:} false; then : @@ -20403,75 +20446,41 @@ else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include #include #include -#include #include -#include +#include +#include #include +#include +#include +#include -#define A4_SOCK "./apr_accept4_test_socket" - -int main() +int main(int argc, char **argv) { - pid_t pid; - int fd; - struct sockaddr_un loc, rem; - socklen_t rem_sz; + int fd, flags; + struct sockaddr_in sin; - if ((pid = fork())) { - int status; - - unlink(A4_SOCK); - - if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) - goto cleanup_failure2; - - loc.sun_family = AF_UNIX; - strncpy(loc.sun_path, A4_SOCK, sizeof(loc.sun_path) - 1); - - if (bind(fd, (struct sockaddr *) &loc, - sizeof(struct sockaddr_un)) == -1) - goto cleanup_failure; - - if (listen(fd, 5) == -1) - goto cleanup_failure; - - rem_sz = sizeof(struct sockaddr_un); - if (accept4(fd, (struct sockaddr *) &rem, &rem_sz, 0) == -1) { - goto cleanup_failure; - } - else { - close(fd); - waitpid(pid, &status, 0); - unlink(A4_SOCK); - return 0; - } - -cleanup_failure: - close(fd); -cleanup_failure2: - kill(pid, SIGKILL); - waitpid(pid, &status, 0); - unlink(A4_SOCK); + if ((fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) return 1; - } - else { - if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) - return 1; /* this will be bad: we'll hang */ + flags = fcntl(fd, F_GETFL); + if (flags == -1 || fcntl(fd, F_SETFL, flags|O_NONBLOCK) == -1) + return 5; - loc.sun_family = AF_UNIX; - strncpy(loc.sun_path, A4_SOCK, sizeof(loc.sun_path) - 1); + memset(&sin, 0, sizeof sin); + sin.sin_family = AF_INET; - while(connect(fd, (struct sockaddr *) &loc, - sizeof(struct sockaddr_un)) == -1 && - (errno==ENOENT || errno==ECONNREFUSED)) - ; + if (bind(fd, (struct sockaddr *) &sin, sizeof sin) == -1) + return 2; - close(fd); + if (listen(fd, 5) == -1) + return 3; + + if (accept4(fd, NULL, 0, SOCK_NONBLOCK) == 0 + || errno == EAGAIN || errno == EWOULDBLOCK) return 0; - } + + return 4; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : @@ -20582,6 +20591,49 @@ $as_echo "#define HAVE_EPOLL_CREATE1 1" >>confdefs.h fi +# Check for z/OS async i/o support. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for asio -> message queue support" >&5 +$as_echo_n "checking for asio -> message queue support... " >&6; } +if ${apr_cv_aio_msgq+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + apr_cv_aio_msgq=no +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _AIO_OS390 +#include + +int main() +{ + struct aiocb a; + + a.aio_notifytype = AIO_MSGQ; /* use IPC message queue for notification */ + + return aio_cancel(2, NULL) == -1; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + apr_cv_aio_msgq=yes +else + apr_cv_aio_msgq=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_aio_msgq" >&5 +$as_echo "$apr_cv_aio_msgq" >&6; } + +if test "$apr_cv_aio_msgq" = "yes"; then + +$as_echo "#define HAVE_AIO_MSGQ 1" >>confdefs.h + +fi + # test for dup3 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dup3 support" >&5 $as_echo_n "checking for dup3 support... " >&6; } @@ -21214,7 +21266,9 @@ case $host in # that it has it. # FIXME - find exact 2.3 version that MMANON was fixed in. It is # confirmed fixed in 2.4 series. - if test $os_version -le "240"; then + if test $os_pre24linux -eq 1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Disabling anon mmap() support for Linux pre-2.4" >&5 +$as_echo "$as_me: WARNING: Disabling anon mmap() support for Linux pre-2.4" >&2;} ac_decision='' for ac_item in USE_SHMEM_MMAP_ZERO USE_SHMEM_SHMGET_ANON; do eval "ac_decision_this=\$ac_decision_${ac_item}" @@ -21520,13 +21574,28 @@ else fi +# Check whether --enable-posix-shm was given. +if test "${enable_posix_shm+set}" = set; then : + enableval=$enable_posix_shm; +if test "$havemmapshm" = "1"; then + ac_decision='' + for ac_item in USE_SHMEM_MMAP_SHM; do + eval "ac_decision_this=\$ac_decision_${ac_item}" + if test ".$ac_decision_this" = .yes; then + ac_decision=$ac_item + eval "ac_decision_msg=\$ac_decision_${ac_item}_msg" + fi + done + +fi + +fi + case $host in *linux* ) - # Linux has problems with MM_SHMT_MMANON even though it reports - # that it has it. - # FIXME - find exact 2.3 version that MMANON was fixed in. It is - # confirmed fixed in 2.4 series. - if test $os_version -le "240"; then + # Linux pre-2.4 had problems with MM_SHMT_MMANON even though + # it reports that it has it. + if test $os_pre24linux -eq 1; then ac_decision='' for ac_item in USE_SHMEM_MMAP_TMP USE_SHMEM_MMAP_SHM USE_SHMEM_SHMGET; do eval "ac_decision_this=\$ac_decision_${ac_item}" @@ -21932,7 +22001,9 @@ else ;; s390-*-linux-gnu) # disable sendfile support for 2.2 on S/390 - if test $os_version -lt 240; then + if test $os_pre24linux -eq 1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Disabled sendfile support for Linux 2.2 on S/390" >&5 +$as_echo "$as_me: WARNING: Disabled sendfile support for Linux 2.2 on S/390" >&2;} sendfile="0" fi ;; @@ -23435,9 +23506,14 @@ else /* end confdefs.h. */ #include #include +#ifdef WIN32 +#define binmode "b" +#else +#define binmode +#endif main() { - FILE *f=fopen("conftestval", "w"); + FILE *f=fopen("conftestval", "w" binmode); if (!f) exit(1); fprintf(f, "%d\n", sizeof(pid_t)); exit(0); @@ -23665,9 +23741,14 @@ else /* end confdefs.h. */ #include #include +#ifdef WIN32 +#define binmode "b" +#else +#define binmode +#endif main() { - FILE *f=fopen("conftestval", "w"); + FILE *f=fopen("conftestval", "w" binmode); if (!f) exit(1); fprintf(f, "%d\n", sizeof(ssize_t)); exit(0); @@ -23723,9 +23804,14 @@ else /* end confdefs.h. */ #include #include +#ifdef WIN32 +#define binmode "b" +#else +#define binmode +#endif main() { - FILE *f=fopen("conftestval", "w"); + FILE *f=fopen("conftestval", "w" binmode); if (!f) exit(1); fprintf(f, "%d\n", sizeof(size_t)); exit(0); @@ -23781,9 +23867,14 @@ else /* end confdefs.h. */ #include #include +#ifdef WIN32 +#define binmode "b" +#else +#define binmode +#endif main() { - FILE *f=fopen("conftestval", "w"); + FILE *f=fopen("conftestval", "w" binmode); if (!f) exit(1); fprintf(f, "%d\n", sizeof(off_t)); exit(0); @@ -23910,9 +24001,14 @@ else /* end confdefs.h. */ #include $ac_includes_default +#ifdef WIN32 +#define binmode "b" +#else +#define binmode +#endif main() { - FILE *f=fopen("conftestval", "w"); + FILE *f=fopen("conftestval", "w" binmode); if (!f) exit(1); fprintf(f, "%d\n", sizeof(ino_t)); exit(0); @@ -24192,9 +24288,14 @@ else #include #include #include +#ifdef WIN32 +#define binmode "b" +#else +#define binmode +#endif main() { - FILE *f=fopen("conftestval", "w"); + FILE *f=fopen("conftestval", "w" binmode); if (!f) exit(1); fprintf(f, "%d\n", sizeof(struct iovec)); exit(0); @@ -27128,6 +27229,9 @@ else #ifdef HAVE_SYS_SOCKET_H #include #endif +#ifdef HAVE_SYS_TIME_H +#include +#endif #ifdef HAVE_SYS_SELECT_H #include #endif @@ -27148,6 +27252,8 @@ int main(void) { int listen_port, rc; struct sockaddr_in sa; socklen_t sa_len; + fd_set fds; + struct timeval tv; listen_s = socket(AF_INET, SOCK_STREAM, 0); if (listen_s < 0) { @@ -27826,7 +27932,7 @@ else #include #endif -void main(void) { +int main(void) { struct addrinfo hints, *ai; int error; @@ -27889,7 +27995,7 @@ else #include #endif -void main(void) { +int main(void) { if (EAI_ADDRFAMILY < 0) { exit(0); } @@ -27950,7 +28056,7 @@ else #include #endif -void main(void) { +int main(void) { struct sockaddr_in sa; char hbuf[256]; int error; @@ -28415,13 +28521,21 @@ fi -# Use -no-install to link the test programs on all platforms -# but Darwin, where it would cause the programs to be linked -# against installed versions of libapr instead of those just -# built. + +# Use -no-install or -no-fast-install to link the test +# programs on all platforms but Darwin, where it would cause +# the programs to be linked against installed versions of +# libapr instead of those just built. case $host in -*-apple-darwin*) LT_NO_INSTALL="" ;; -*) LT_NO_INSTALL="-no-install" ;; + *-apple-darwin*) + LT_NO_INSTALL="" + ;; + *-mingw*) + LT_NO_INSTALL="-no-fast-install" + ;; + *) + LT_NO_INSTALL="-no-install" + ;; esac diff --git a/contrib/apr/configure.in b/contrib/apr/configure.in index 655de8dfe86..2a37a30bd5f 100644 --- a/contrib/apr/configure.in +++ b/contrib/apr/configure.in @@ -35,7 +35,7 @@ AH_TOP([ dnl Hard-coded inclusion at the tail end of apr_private.h: AH_BOTTOM([ /* switch this on if we have a BeOS version below BONE */ -#if BEOS && !HAVE_BONE_VERSION +#if defined(BEOS) && !defined(HAVE_BONE_VERSION) #define BEOS_R5 1 #else #define BEOS_BONE 1 @@ -282,7 +282,7 @@ AC_ARG_WITH(libtool, [ --without-libtool avoid using libtool to link the if test "x$use_libtool" = "xyes"; then lt_compile='$(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE) -o $@ -c $< && touch $@' LT_VERSION="-version-info `$get_version libtool $version_hdr APR`" - link="\$(LIBTOOL) \$(LTFLAGS) --mode=link \$(LT_LDFLAGS) \$(COMPILE) \$(LT_VERSION) \$(ALL_LDFLAGS) -o \$@" + link="\$(LIBTOOL) \$(LTFLAGS) --mode=link \$(COMPILE) \$(LT_LDFLAGS) \$(LT_VERSION) \$(ALL_LDFLAGS) -o \$@" so_ext='lo' lib_target='-rpath $(libdir) $(OBJECTS)' export_lib_target='-rpath \$(libdir) \$(OBJECTS)' @@ -298,6 +298,9 @@ case $host in *-solaris2*) apr_platform_runtime_link_flag="-R" ;; + *-mingw* | *-cygwin*) + LT_LDFLAGS="$LT_LDFLAGS -no-undefined" + ;; *) ;; esac @@ -432,6 +435,18 @@ case "$host:$CC" in APR_SETVAR(CC,mwcc) APR_SETVAR(AR,ar) ;; + dnl If building static APR, both the APR build and the app build + dnl need -DAPR_DECLARE_STATIC to generate the right linkage from + dnl APR_DECLARE et al. + dnl If building dynamic APR, the APR build needs APR_DECLARE_EXPORT + dnl and the app build should have neither define. + *-mingw* | *-cygwin*) + if test "$enable_shared" = "yes"; then + APR_ADDTO(INTERNAL_CPPFLAGS, -DAPR_DECLARE_EXPORT) + else + APR_ADDTO(CPPFLAGS, -DAPR_DECLARE_STATIC) + fi + ;; esac AC_CACHE_CHECK([whether the compiler provides atomic builtins], [ap_cv_atomic_builtins], @@ -649,7 +664,15 @@ case $host in fi ;; *linux*) - os_version=`uname -r | sed -e 's/\(.\)\.\(.\)\.\(.\).*/\1\2\3/'` + os_major=[`uname -r | sed -e 's/\([1-9][0-9]*\)\..*/\1/'`] + os_minor=[`uname -r | sed -e 's/[1-9][0-9]*\.\([0-9]\+\)\..*/\1/'`] + if test $os_major -lt 2 -o \( $os_major -eq 2 -a $os_minor -lt 4 \); then + AC_MSG_WARN([Configured for pre-2.4 Linux $os_major.$os_minor]) + os_pre24linux=1 + else + os_pre24linux=0 + AC_MSG_NOTICE([Configured for Linux $os_major.$os_minor]) + fi ;; *os390) os_version=`uname -r | sed -e 's/\.//g'` @@ -872,78 +895,47 @@ if test "$apr_cv_dup3" = "yes"; then AC_DEFINE([HAVE_DUP3], 1, [Define if dup3 function is supported]) fi -# test for accept4 +# Test for accept4(). Create a non-blocking socket, bind it to +# an unspecified port & address (kernel picks), and attempt to +# call accept4() on it. If the syscall is wired up (i.e. the +# kernel is new enough), it should return EAGAIN. AC_CACHE_CHECK([for accept4 support], [apr_cv_accept4], [AC_TRY_RUN([ -#include #include #include -#include #include -#include +#include +#include #include +#include +#include +#include -#define A4_SOCK "./apr_accept4_test_socket" - -int main() +int main(int argc, char **argv) { - pid_t pid; - int fd; - struct sockaddr_un loc, rem; - socklen_t rem_sz; + int fd, flags; + struct sockaddr_in sin; - if ((pid = fork())) { - int status; - - unlink(A4_SOCK); - - if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) - goto cleanup_failure2; - - loc.sun_family = AF_UNIX; - strncpy(loc.sun_path, A4_SOCK, sizeof(loc.sun_path) - 1); - - if (bind(fd, (struct sockaddr *) &loc, - sizeof(struct sockaddr_un)) == -1) - goto cleanup_failure; - - if (listen(fd, 5) == -1) - goto cleanup_failure; - - rem_sz = sizeof(struct sockaddr_un); - if (accept4(fd, (struct sockaddr *) &rem, &rem_sz, 0) == -1) { - goto cleanup_failure; - } - else { - close(fd); - waitpid(pid, &status, 0); - unlink(A4_SOCK); - return 0; - } - -cleanup_failure: - close(fd); -cleanup_failure2: - kill(pid, SIGKILL); - waitpid(pid, &status, 0); - unlink(A4_SOCK); + if ((fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) return 1; - } - else { - if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) - return 1; /* this will be bad: we'll hang */ + flags = fcntl(fd, F_GETFL); + if (flags == -1 || fcntl(fd, F_SETFL, flags|O_NONBLOCK) == -1) + return 5; - loc.sun_family = AF_UNIX; - strncpy(loc.sun_path, A4_SOCK, sizeof(loc.sun_path) - 1); + memset(&sin, 0, sizeof sin); + sin.sin_family = AF_INET; + + if (bind(fd, (struct sockaddr *) &sin, sizeof sin) == -1) + return 2; + + if (listen(fd, 5) == -1) + return 3; - while(connect(fd, (struct sockaddr *) &loc, - sizeof(struct sockaddr_un)) == -1 && - (errno==ENOENT || errno==ECONNREFUSED)) - ; - - close(fd); + if (accept4(fd, NULL, 0, SOCK_NONBLOCK) == 0 + || errno == EAGAIN || errno == EWOULDBLOCK) return 0; - } + + return 4; }], [apr_cv_accept4=yes], [apr_cv_accept4=no], [apr_cv_accept4=no])]) if test "$apr_cv_accept4" = "yes"; then @@ -983,6 +975,25 @@ if test "$apr_cv_epoll_create1" = "yes"; then AC_DEFINE([HAVE_EPOLL_CREATE1], 1, [Define if epoll_create1 function is supported]) fi +# Check for z/OS async i/o support. +AC_CACHE_CHECK([for asio -> message queue support], [apr_cv_aio_msgq], +[AC_TRY_RUN([ +#define _AIO_OS390 +#include + +int main() +{ + struct aiocb a; + + a.aio_notifytype = AIO_MSGQ; /* use IPC message queue for notification */ + + return aio_cancel(2, NULL) == -1; +}], [apr_cv_aio_msgq=yes], [apr_cv_aio_msgq=no], [apr_cv_aio_msgq=no])]) + +if test "$apr_cv_aio_msgq" = "yes"; then + AC_DEFINE([HAVE_AIO_MSGQ], 1, [Define if async i/o supports message q's]) +fi + # test for dup3 AC_CACHE_CHECK([for dup3 support], [apr_cv_dup3], [AC_TRY_RUN([ @@ -1180,7 +1191,8 @@ case $host in # that it has it. # FIXME - find exact 2.3 version that MMANON was fixed in. It is # confirmed fixed in 2.4 series. - if test $os_version -le "240"; then + if test $os_pre24linux -eq 1; then + AC_MSG_WARN([Disabling anon mmap() support for Linux pre-2.4]) APR_DECISION_OVERRIDE(USE_SHMEM_MMAP_ZERO USE_SHMEM_SHMGET_ANON) fi ;; @@ -1244,13 +1256,18 @@ APR_IFALLYES(header:os2.h, APR_IFALLYES(header:windows.h, [havewin32shm="1" APR_DECIDE(USE_SHMEM_WIN32, [Windows shared memory])]) +AC_ARG_ENABLE(posix-shm, +[ --enable-posix-shm Use POSIX shared memory (shm_open) if available], +[ +if test "$havemmapshm" = "1"; then + APR_DECISION_OVERRIDE(USE_SHMEM_MMAP_SHM) +fi +]) case $host in *linux* ) - # Linux has problems with MM_SHMT_MMANON even though it reports - # that it has it. - # FIXME - find exact 2.3 version that MMANON was fixed in. It is - # confirmed fixed in 2.4 series. - if test $os_version -le "240"; then + # Linux pre-2.4 had problems with MM_SHMT_MMANON even though + # it reports that it has it. + if test $os_pre24linux -eq 1; then APR_DECISION_OVERRIDE(USE_SHMEM_MMAP_TMP USE_SHMEM_MMAP_SHM dnl USE_SHMEM_SHMGET) fi @@ -1347,7 +1364,8 @@ AC_ARG_WITH(sendfile, [ --with-sendfile Override decision to use sendfi ;; s390-*-linux-gnu) # disable sendfile support for 2.2 on S/390 - if test $os_version -lt 240; then + if test $os_pre24linux -eq 1; then + AC_MSG_WARN([Disabled sendfile support for Linux 2.2 on S/390]) sendfile="0" fi ;; @@ -1532,7 +1550,7 @@ if test "$netdbh" = "1"; then fi AC_ARG_ENABLE(allocator-uses-mmap, - [ --enable-allocator-uses-mmap Use mmap in apr_allocator instead of malloc (experimental)], + [ --enable-allocator-uses-mmap Use mmap in apr_allocator instead of malloc ], [ if test "$enableval" = "yes"; then APR_IFALLYES(header:sys/mman.h func:mmap func:munmap define:MAP_ANON, [AC_DEFINE(APR_ALLOCATOR_USES_MMAP, 1, @@ -2726,6 +2744,7 @@ AC_SUBST(NOTEST_INCLUDES) dnl ----------------------------- Construct the files +AC_SUBST(INTERNAL_CPPFLAGS) AC_SUBST(LDLIBS) AC_SUBST(INCLUDES) AC_SUBST(AR) @@ -2735,13 +2754,20 @@ AC_SUBST(DEFAULT_OSDIR) AC_SUBST(EXEEXT) AC_SUBST(LIBTOOL_LIBS) -# Use -no-install to link the test programs on all platforms -# but Darwin, where it would cause the programs to be linked -# against installed versions of libapr instead of those just -# built. +# Use -no-install or -no-fast-install to link the test +# programs on all platforms but Darwin, where it would cause +# the programs to be linked against installed versions of +# libapr instead of those just built. case $host in -*-apple-darwin*) LT_NO_INSTALL="" ;; -*) LT_NO_INSTALL="-no-install" ;; + *-apple-darwin*) + LT_NO_INSTALL="" + ;; + *-mingw*) + LT_NO_INSTALL="-no-fast-install" + ;; + *) + LT_NO_INSTALL="-no-install" + ;; esac AC_SUBST(LT_NO_INSTALL) diff --git a/contrib/apr/docs/canonical_filenames.html b/contrib/apr/docs/canonical_filenames.html index 10867d3796e..2bd9bdba822 100644 --- a/contrib/apr/docs/canonical_filenames.html +++ b/contrib/apr/docs/canonical_filenames.html @@ -104,9 +104,9 @@ used as the parent to create child entries to reduce the number of expensive stat and case canonicalization calls to the OS.

The comparison operation provides that the APR can postpone correction -of case by simply relying upon the device and inode for equivilance. The +of case by simply relying upon the device and inode for equivalence. The stat implementation provides that two files are the same, while their -strings are not equivilant, and eliminates the need for the operating +strings are not equivalent, and eliminates the need for the operating system to return the proper form of the name.

In any case, returning the char* path, with a flag to request the proper @@ -153,4 +153,4 @@ For each of this path Segments - \ No newline at end of file + diff --git a/contrib/apr/encoding/apr_escape.c b/contrib/apr/encoding/apr_escape.c new file mode 100644 index 00000000000..2bcfec418fe --- /dev/null +++ b/contrib/apr/encoding/apr_escape.c @@ -0,0 +1,1181 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* escape/unescape functions. + * + * These functions perform various escaping operations, and are provided in + * pairs, a function to query the length of and escape existing buffers, as + * well as companion functions to perform the same process to memory + * allocated from a pool. + * + * The API is designed to have the smallest possible RAM footprint, and so + * will only allocate the exact amount of RAM needed for each conversion. + */ + +#include "apr_escape.h" +#include "apr_escape_test_char.h" +#include "apr_lib.h" +#include "apr_strings.h" + +#if APR_CHARSET_EBCDIC +static int convert_a2e[256] = { + 0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F, 0x16, 0x05, 0x15, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26, 0x18, 0x19, 0x3F, 0x27, 0x1C, 0x1D, 0x1E, 0x1F, + 0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D, 0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0x7A, 0x5E, 0x4C, 0x7E, 0x6E, 0x6F, + 0x7C, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, + 0xD7, 0xD8, 0xD9, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xAD, 0xE0, 0xBD, 0x5F, 0x6D, + 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, + 0x97, 0x98, 0x99, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xC0, 0x4F, 0xD0, 0xA1, 0x07, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x06, 0x17, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x09, 0x0A, 0x1B, + 0x30, 0x31, 0x1A, 0x33, 0x34, 0x35, 0x36, 0x08, 0x38, 0x39, 0x3A, 0x3B, 0x04, 0x14, 0x3E, 0xFF, + 0x41, 0xAA, 0x4A, 0xB1, 0x9F, 0xB2, 0x6A, 0xB5, 0xBB, 0xB4, 0x9A, 0x8A, 0xB0, 0xCA, 0xAF, 0xBC, + 0x90, 0x8F, 0xEA, 0xFA, 0xBE, 0xA0, 0xB6, 0xB3, 0x9D, 0xDA, 0x9B, 0x8B, 0xB7, 0xB8, 0xB9, 0xAB, + 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9E, 0x68, 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, + 0xAC, 0x69, 0xED, 0xEE, 0xEB, 0xEF, 0xEC, 0xBF, 0x80, 0xFD, 0xFE, 0xFB, 0xFC, 0xBA, 0xAE, 0x59, + 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9C, 0x48, 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, + 0x8C, 0x49, 0xCD, 0xCE, 0xCB, 0xCF, 0xCC, 0xE1, 0x70, 0xDD, 0xDE, 0xDB, 0xDC, 0x8D, 0x8E, 0xDF }; + +static int convert_e2a[256] = { + 0x00, 0x01, 0x02, 0x03, 0x9C, 0x09, 0x86, 0x7F, 0x97, 0x8D, 0x8E, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x10, 0x11, 0x12, 0x13, 0x9D, 0x0A, 0x08, 0x87, 0x18, 0x19, 0x92, 0x8F, 0x1C, 0x1D, 0x1E, 0x1F, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x17, 0x1B, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x05, 0x06, 0x07, + 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, 0x98, 0x99, 0x9A, 0x9B, 0x14, 0x15, 0x9E, 0x1A, + 0x20, 0xA0, 0xE2, 0xE4, 0xE0, 0xE1, 0xE3, 0xE5, 0xE7, 0xF1, 0xA2, 0x2E, 0x3C, 0x28, 0x2B, 0x7C, + 0x26, 0xE9, 0xEA, 0xEB, 0xE8, 0xED, 0xEE, 0xEF, 0xEC, 0xDF, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0x5E, + 0x2D, 0x2F, 0xC2, 0xC4, 0xC0, 0xC1, 0xC3, 0xC5, 0xC7, 0xD1, 0xA6, 0x2C, 0x25, 0x5F, 0x3E, 0x3F, + 0xF8, 0xC9, 0xCA, 0xCB, 0xC8, 0xCD, 0xCE, 0xCF, 0xCC, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22, + 0xD8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0xAB, 0xBB, 0xF0, 0xFD, 0xFE, 0xB1, + 0xB0, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0xAA, 0xBA, 0xE6, 0xB8, 0xC6, 0xA4, + 0xB5, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0xA1, 0xBF, 0xD0, 0x5B, 0xDE, 0xAE, + 0xAC, 0xA3, 0xA5, 0xB7, 0xA9, 0xA7, 0xB6, 0xBC, 0xBD, 0xBE, 0xDD, 0xA8, 0xAF, 0x5D, 0xB4, 0xD7, + 0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0xAD, 0xF4, 0xF6, 0xF2, 0xF3, 0xF5, + 0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0xB9, 0xFB, 0xFC, 0xF9, 0xFA, 0xFF, + 0x5C, 0xF7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0xB2, 0xD4, 0xD6, 0xD2, 0xD3, 0xD5, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0xB3, 0xDB, 0xDC, 0xD9, 0xDA, 0x9F }; +#define RAW_ASCII_CHAR(ch) convert_e2a[(unsigned char)ch] +#else /* APR_CHARSET_EBCDIC */ +#define RAW_ASCII_CHAR(ch) (ch) +#endif /* !APR_CHARSET_EBCDIC */ + +/* we assume the folks using this ensure 0 <= c < 256... which means + * you need a cast to (unsigned char) first, you can't just plug a + * char in here and get it to work, because if char is signed then it + * will first be sign extended. + */ +#define TEST_CHAR(c, f) (test_char_table[(unsigned)(c)] & (f)) + +APR_DECLARE(apr_status_t) apr_escape_shell(char *escaped, const char *str, + apr_ssize_t slen, apr_size_t *len) +{ + unsigned char *d; + const unsigned char *s; + apr_size_t size = 1; + int found = 0; + + d = (unsigned char *) escaped; + s = (const unsigned char *) str; + + if (s) { + if (d) { + for (; *s && slen; ++s, slen--) { +#if defined(OS2) || defined(WIN32) + /* + * Newlines to Win32/OS2 CreateProcess() are ill advised. + * Convert them to spaces since they are effectively white + * space to most applications + */ + if (*s == '\r' || *s == '\n') { + if (d) { + *d++ = ' '; + found = 1; + } + continue; + } +#endif + if (TEST_CHAR(*s, T_ESCAPE_SHELL_CMD)) { + *d++ = '\\'; + size++; + found = 1; + } + *d++ = *s; + size++; + } + *d = '\0'; + } + else { + for (; *s && slen; ++s, slen--) { + if (TEST_CHAR(*s, T_ESCAPE_SHELL_CMD)) { + size++; + found = 1; + } + size++; + } + } + } + + if (len) { + *len = size; + } + if (!found) { + return APR_NOTFOUND; + } + + return APR_SUCCESS; +} + +APR_DECLARE(const char *) apr_pescape_shell(apr_pool_t *p, const char *str) +{ + apr_size_t len; + + switch (apr_escape_shell(NULL, str, APR_ESCAPE_STRING, &len)) { + case APR_SUCCESS: { + char *cmd = apr_palloc(p, len); + apr_escape_shell(cmd, str, APR_ESCAPE_STRING, NULL); + return cmd; + } + case APR_NOTFOUND: { + break; + } + } + + return str; +} + +static char x2c(const char *what) +{ + register char digit; + +#if !APR_CHARSET_EBCDIC + digit = + ((what[0] >= 'A') ? ((what[0] & 0xdf) - 'A') + 10 : (what[0] - '0')); + digit *= 16; + digit += (what[1] >= 'A' ? ((what[1] & 0xdf) - 'A') + 10 : (what[1] - '0')); +#else /*APR_CHARSET_EBCDIC*/ + char xstr[5]; + xstr[0]='0'; + xstr[1]='x'; + xstr[2]=what[0]; + xstr[3]=what[1]; + xstr[4]='\0'; + digit = convert_a2e[0xFF & strtol(xstr, NULL, 16)]; +#endif /*APR_CHARSET_EBCDIC*/ + return (digit); +} + +APR_DECLARE(apr_status_t) apr_unescape_url(char *escaped, const char *url, + apr_ssize_t slen, const char *forbid, const char *reserved, int plus, + apr_size_t *len) +{ + apr_size_t size = 1; + int found = 0; + const char *s = (const char *) url; + char *d = (char *) escaped; + register int badesc, badpath; + + if (!url) { + return APR_NOTFOUND; + } + + badesc = 0; + badpath = 0; + if (s) { + if (d) { + for (; *s && slen; ++s, d++, slen--) { + if (plus && *s == '+') { + *d = ' '; + found = 1; + } + else if (*s != '%') { + *d = *s; + } + else { + if (!apr_isxdigit(*(s + 1)) || !apr_isxdigit(*(s + 2))) { + badesc = 1; + *d = '%'; + } + else { + char decoded; + decoded = x2c(s + 1); + if ((decoded == '\0') + || (forbid && strchr(forbid, decoded))) { + badpath = 1; + *d = decoded; + s += 2; + slen -= 2; + } + else if (reserved && strchr(reserved, decoded)) { + *d++ = *s++; + *d++ = *s++; + *d = *s; + size += 2; + } + else { + *d = decoded; + s += 2; + slen -= 2; + found = 1; + } + } + } + size++; + } + *d = '\0'; + } + else { + for (; *s && slen; ++s, slen--) { + if (plus && *s == '+') { + found = 1; + } + else if (*s != '%') { + /* character unchanged */ + } + else { + if (!apr_isxdigit(*(s + 1)) || !apr_isxdigit(*(s + 2))) { + badesc = 1; + } + else { + char decoded; + decoded = x2c(s + 1); + if ((decoded == '\0') + || (forbid && strchr(forbid, decoded))) { + badpath = 1; + s += 2; + slen -= 2; + } + else if (reserved && strchr(reserved, decoded)) { + s += 2; + slen -= 2; + size += 2; + } + else { + s += 2; + slen -= 2; + found = 1; + } + } + } + size++; + } + } + } + + if (len) { + *len = size; + } + if (badesc) { + return APR_EINVAL; + } + else if (badpath) { + return APR_BADCH; + } + else if (!found) { + return APR_NOTFOUND; + } + + return APR_SUCCESS; +} + +APR_DECLARE(const char *) apr_punescape_url(apr_pool_t *p, const char *url, + const char *forbid, const char *reserved, int plus) +{ + apr_size_t len; + + switch (apr_unescape_url(NULL, url, APR_ESCAPE_STRING, forbid, reserved, + plus, &len)) { + case APR_SUCCESS: { + char *buf = apr_palloc(p, len); + apr_unescape_url(buf, url, APR_ESCAPE_STRING, forbid, reserved, plus, + NULL); + return buf; + } + case APR_EINVAL: + case APR_BADCH: { + return NULL; + } + case APR_NOTFOUND: { + break; + } + } + + return url; +} + +/* c2x takes an unsigned, and expects the caller has guaranteed that + * 0 <= what < 256... which usually means that you have to cast to + * unsigned char first, because (unsigned)(char)(x) first goes through + * signed extension to an int before the unsigned cast. + * + * The reason for this assumption is to assist gcc code generation -- + * the unsigned char -> unsigned extension is already done earlier in + * both uses of this code, so there's no need to waste time doing it + * again. + */ +static const char c2x_table[] = "0123456789abcdef"; + +static APR_INLINE unsigned char *c2x(unsigned what, unsigned char prefix, + unsigned char *where) +{ +#if APR_CHARSET_EBCDIC + what = convert_e2a[(unsigned char)what]; +#endif /*APR_CHARSET_EBCDIC*/ + *where++ = prefix; + *where++ = c2x_table[what >> 4]; + *where++ = c2x_table[what & 0xf]; + return where; +} + +APR_DECLARE(apr_status_t) apr_escape_path_segment(char *escaped, + const char *str, apr_ssize_t slen, apr_size_t *len) +{ + apr_size_t size = 1; + int found = 0; + const unsigned char *s = (const unsigned char *) str; + unsigned char *d = (unsigned char *) escaped; + unsigned c; + + if (s) { + if (d) { + while ((c = *s) && slen) { + if (TEST_CHAR(c, T_ESCAPE_PATH_SEGMENT)) { + d = c2x(c, '%', d); + size += 2; + found = 1; + } + else { + *d++ = c; + } + ++s; + size++; + slen--; + } + *d = '\0'; + } + else { + while ((c = *s) && slen) { + if (TEST_CHAR(c, T_ESCAPE_PATH_SEGMENT)) { + size += 2; + found = 1; + } + ++s; + size++; + slen--; + } + } + } + + if (len) { + *len = size; + } + if (!found) { + return APR_NOTFOUND; + } + + return APR_SUCCESS; +} + +APR_DECLARE(const char *) apr_pescape_path_segment(apr_pool_t *p, + const char *str) +{ + apr_size_t len; + + switch (apr_escape_path_segment(NULL, str, APR_ESCAPE_STRING, &len)) { + case APR_SUCCESS: { + char *cmd = apr_palloc(p, len); + apr_escape_path_segment(cmd, str, APR_ESCAPE_STRING, NULL); + return cmd; + } + case APR_NOTFOUND: { + break; + } + } + + return str; +} + +APR_DECLARE(apr_status_t) apr_escape_path(char *escaped, const char *path, + apr_ssize_t slen, int partial, apr_size_t *len) +{ + apr_size_t size = 1; + int found = 0; + const unsigned char *s = (const unsigned char *) path; + unsigned char *d = (unsigned char *) escaped; + unsigned c; + + if (!path) { + return APR_NOTFOUND; + } + + if (!partial) { + const char *colon = strchr(path, ':'); + const char *slash = strchr(path, '/'); + + if (colon && (!slash || colon < slash)) { + if (d) { + *d++ = '.'; + *d++ = '/'; + } + size += 2; + found = 1; + } + } + if (d) { + while ((c = *s) && slen) { + if (TEST_CHAR(c, T_OS_ESCAPE_PATH)) { + d = c2x(c, '%', d); + } + else { + *d++ = c; + } + ++s; + size++; + slen--; + } + *d = '\0'; + } + else { + while ((c = *s) && slen) { + if (TEST_CHAR(c, T_OS_ESCAPE_PATH)) { + size += 2; + found = 1; + } + ++s; + size++; + slen--; + } + } + + if (len) { + *len = size; + } + if (!found) { + return APR_NOTFOUND; + } + + return APR_SUCCESS; +} + +APR_DECLARE(const char *) apr_pescape_path(apr_pool_t *p, const char *str, + int partial) +{ + apr_size_t len; + + switch (apr_escape_path(NULL, str, APR_ESCAPE_STRING, partial, &len)) { + case APR_SUCCESS: { + char *path = apr_palloc(p, len); + apr_escape_path(path, str, APR_ESCAPE_STRING, partial, NULL); + return path; + } + case APR_NOTFOUND: { + break; + } + } + + return str; +} + +APR_DECLARE(apr_status_t) apr_escape_urlencoded(char *escaped, const char *str, + apr_ssize_t slen, apr_size_t *len) +{ + apr_size_t size = 1; + int found = 0; + const unsigned char *s = (const unsigned char *) str; + unsigned char *d = (unsigned char *) escaped; + unsigned c; + + if (s) { + if (d) { + while ((c = *s) && slen) { + if (TEST_CHAR(c, T_ESCAPE_URLENCODED)) { + d = c2x(c, '%', d); + size += 2; + found = 1; + } + else if (c == ' ') { + *d++ = '+'; + found = 1; + } + else { + *d++ = c; + } + ++s; + size++; + slen--; + } + *d = '\0'; + } + else { + while ((c = *s) && slen) { + if (TEST_CHAR(c, T_ESCAPE_URLENCODED)) { + size += 2; + found = 1; + } + else if (c == ' ') { + found = 1; + } + ++s; + size++; + slen--; + } + } + } + + if (len) { + *len = size; + } + if (!found) { + return APR_NOTFOUND; + } + + return APR_SUCCESS; +} + +APR_DECLARE(const char *) apr_pescape_urlencoded(apr_pool_t *p, const char *str) +{ + apr_size_t len; + + switch (apr_escape_urlencoded(NULL, str, APR_ESCAPE_STRING, &len)) { + case APR_SUCCESS: { + char *encoded = apr_palloc(p, len); + apr_escape_urlencoded(encoded, str, APR_ESCAPE_STRING, NULL); + return encoded; + } + case APR_NOTFOUND: { + break; + } + } + + return str; +} + +APR_DECLARE(apr_status_t) apr_escape_entity(char *escaped, const char *str, + apr_ssize_t slen, int toasc, apr_size_t *len) +{ + apr_size_t size = 1; + int found = 0; + const unsigned char *s = (const unsigned char *) str; + unsigned char *d = (unsigned char *) escaped; + unsigned c; + + if (s) { + if (d) { + while ((c = *s) && slen) { + if (TEST_CHAR(c, T_ESCAPE_XML)) { + switch (c) { + case '>': { + memcpy(d, ">", 4); + size += 4; + d += 4; + break; + } + case '<': { + memcpy(d, "<", 4); + size += 4; + d += 4; + break; + } + case '&': { + memcpy(d, "&", 5); + size += 5; + d += 5; + break; + } + case '\"': { + memcpy(d, """, 6); + size += 6; + d += 6; + break; + } + case '\'': { + memcpy(d, "'", 6); + size += 6; + d += 6; + break; + } + } + found = 1; + } + else if (toasc && !apr_isascii(c)) { + int offset = apr_snprintf((char *) d, 6, "&#%3.3d;", c); + size += offset; + d += offset; + found = 1; + } + else { + *d++ = c; + size++; + } + ++s; + slen--; + } + *d = '\0'; + } + else { + while ((c = *s) && slen) { + if (TEST_CHAR(c, T_ESCAPE_XML)) { + switch (c) { + case '>': { + size += 4; + break; + } + case '<': { + size += 4; + break; + } + case '&': { + size += 5; + break; + } + case '\"': { + size += 6; + break; + } + case '\'': { + size += 6; + break; + } + } + found = 1; + } + else if (toasc && !apr_isascii(c)) { + char buf[8]; + size += apr_snprintf(buf, 6, "&#%3.3d;", c); + found = 1; + } + else { + size++; + } + ++s; + slen--; + } + } + } + + if (len) { + *len = size; + } + if (!found) { + return APR_NOTFOUND; + } + + return APR_SUCCESS; +} + +APR_DECLARE(const char *) apr_pescape_entity(apr_pool_t *p, const char *str, + int toasc) +{ + apr_size_t len; + + switch (apr_escape_entity(NULL, str, APR_ESCAPE_STRING, toasc, &len)) { + case APR_SUCCESS: { + char *cmd = apr_palloc(p, len); + apr_escape_entity(cmd, str, APR_ESCAPE_STRING, toasc, NULL); + return cmd; + } + case APR_NOTFOUND: { + break; + } + } + + return str; +} + +/* maximum length of any ISO-LATIN-1 HTML entity name. */ +#define MAXENTLEN (6) + +APR_DECLARE(apr_status_t) apr_unescape_entity(char *unescaped, const char *str, + apr_ssize_t slen, apr_size_t *len) +{ + int found = 0; + apr_size_t size = 1; + int val, i, j; + char *d = unescaped; + const char *s = str; + const char *ents; + static const char * const entlist[MAXENTLEN + 1] = + { + NULL, /* 0 */ + NULL, /* 1 */ + "lt\074gt\076", /* 2 */ + "amp\046ETH\320eth\360", /* 3 */ + "quot\042Auml\304Euml\313Iuml\317Ouml\326Uuml\334auml\344euml" + "\353iuml\357ouml\366uuml\374yuml\377", /* 4 */ + "Acirc\302Aring\305AElig\306Ecirc\312Icirc\316Ocirc\324Ucirc" + "\333THORN\336szlig\337acirc\342aring\345aelig\346ecirc\352" + "icirc\356ocirc\364ucirc\373thorn\376", /* 5 */ + "Agrave\300Aacute\301Atilde\303Ccedil\307Egrave\310Eacute\311" + "Igrave\314Iacute\315Ntilde\321Ograve\322Oacute\323Otilde" + "\325Oslash\330Ugrave\331Uacute\332Yacute\335agrave\340" + "aacute\341atilde\343ccedil\347egrave\350eacute\351igrave" + "\354iacute\355ntilde\361ograve\362oacute\363otilde\365" + "oslash\370ugrave\371uacute\372yacute\375" /* 6 */ + }; + + if (s) { + if (d) { + for (; *s != '\0' && slen; s++, d++, size++, slen--) { + if (*s != '&') { + *d = *s; + continue; + } + /* find end of entity */ + for (i = 1; s[i] != ';' && s[i] != '\0' && (slen - i) != 0; + i++) { + continue; + } + + if (s[i] == '\0' || (slen - i) == 0) { /* treat as normal data */ + *d = *s; + continue; + } + + /* is it numeric ? */ + if (s[1] == '#') { + for (j = 2, val = 0; j < i && apr_isdigit(s[j]); j++) { + val = val * 10 + s[j] - '0'; + } + s += i; + if (j < i || val <= 8 || (val >= 11 && val <= 31) + || (val >= 127 && val <= 160) || val >= 256) { + d--; /* no data to output */ + size--; + } + else { + *d = RAW_ASCII_CHAR(val); + found = 1; + } + } + else { + j = i - 1; + if (j > MAXENTLEN || entlist[j] == NULL) { + /* wrong length */ + *d = '&'; + continue; /* skip it */ + } + for (ents = entlist[j]; *ents != '\0'; ents += i) { + if (strncmp(s + 1, ents, j) == 0) { + break; + } + } + + if (*ents == '\0') { + *d = '&'; /* unknown */ + } + else { + *d = RAW_ASCII_CHAR(((const unsigned char *) ents)[j]); + s += i; + slen -= i; + found = 1; + } + } + } + *d = '\0'; + } + else { + for (; *s != '\0' && slen; s++, size++, slen--) { + if (*s != '&') { + continue; + } + /* find end of entity */ + for (i = 1; s[i] != ';' && s[i] != '\0' && (slen - i) != 0; + i++) { + continue; + } + + if (s[i] == '\0' || (slen - i) == 0) { /* treat as normal data */ + continue; + } + + /* is it numeric ? */ + if (s[1] == '#') { + for (j = 2, val = 0; j < i && apr_isdigit(s[j]); j++) { + val = val * 10 + s[j] - '0'; + } + s += i; + if (j < i || val <= 8 || (val >= 11 && val <= 31) + || (val >= 127 && val <= 160) || val >= 256) { + /* no data to output */ + size--; + } + else { + found = 1; + } + } + else { + j = i - 1; + if (j > MAXENTLEN || entlist[j] == NULL) { + /* wrong length */ + continue; /* skip it */ + } + for (ents = entlist[j]; *ents != '\0'; ents += i) { + if (strncmp(s + 1, ents, j) == 0) { + break; + } + } + + if (*ents == '\0') { + /* unknown */ + } + else { + s += i; + slen -= i; + found = 1; + } + } + } + } + } + + if (len) { + *len = size; + } + if (!found) { + return APR_NOTFOUND; + } + + return APR_SUCCESS; +} + +APR_DECLARE(const char *) apr_punescape_entity(apr_pool_t *p, const char *str) +{ + apr_size_t len; + + switch (apr_unescape_entity(NULL, str, APR_ESCAPE_STRING, &len)) { + case APR_SUCCESS: { + char *cmd = apr_palloc(p, len); + apr_unescape_entity(cmd, str, APR_ESCAPE_STRING, NULL); + return cmd; + } + case APR_NOTFOUND: { + break; + } + } + + return str; +} + +APR_DECLARE(apr_status_t) apr_escape_echo(char *escaped, const char *str, + apr_ssize_t slen, int quote, apr_size_t *len) +{ + apr_size_t size = 1; + int found = 0; + const unsigned char *s = (const unsigned char *) str; + unsigned char *d = (unsigned char *) escaped; + unsigned c; + + if (s) { + if (d) { + while ((c = *s) && slen) { + if (TEST_CHAR(c, T_ESCAPE_ECHO)) { + *d++ = '\\'; + size++; + switch (c) { + case '\a': + *d++ = 'a'; + size++; + found = 1; + break; + case '\b': + *d++ = 'b'; + size++; + found = 1; + break; + case '\f': + *d++ = 'f'; + size++; + found = 1; + break; + case '\n': + *d++ = 'n'; + size++; + found = 1; + break; + case '\r': + *d++ = 'r'; + size++; + found = 1; + break; + case '\t': + *d++ = 't'; + size++; + found = 1; + break; + case '\v': + *d++ = 'v'; + size++; + found = 1; + break; + case '\\': + *d++ = '\\'; + size++; + found = 1; + break; + case '"': + if (quote) { + *d++ = c; + size++; + found = 1; + } + else { + d[-1] = c; + } + break; + default: + c2x(c, 'x', d); + d += 3; + size += 3; + found = 1; + break; + } + } + else { + *d++ = c; + size++; + } + ++s; + slen--; + } + *d = '\0'; + } + else { + while ((c = *s) && slen) { + if (TEST_CHAR(c, T_ESCAPE_ECHO)) { + size++; + switch (c) { + case '\a': + case '\b': + case '\f': + case '\n': + case '\r': + case '\t': + case '\v': + case '\\': + size++; + found = 1; + break; + case '"': + if (quote) { + size++; + found = 1; + } + break; + default: + size += 3; + found = 1; + break; + } + } + else { + size++; + } + ++s; + slen--; + } + } + } + + if (len) { + *len = size; + } + if (!found) { + return APR_NOTFOUND; + } + + return APR_SUCCESS; +} + +APR_DECLARE(const char *) apr_pescape_echo(apr_pool_t *p, const char *str, + int quote) +{ + apr_size_t len; + + switch (apr_escape_echo(NULL, str, APR_ESCAPE_STRING, quote, &len)) { + case APR_SUCCESS: { + char *cmd = apr_palloc(p, len); + apr_escape_echo(cmd, str, APR_ESCAPE_STRING, quote, NULL); + return cmd; + } + case APR_NOTFOUND: { + break; + } + } + + return str; +} + +APR_DECLARE(apr_status_t) apr_escape_hex(char *dest, const void *src, + apr_size_t srclen, int colon, apr_size_t *len) +{ + const unsigned char *in = src; + apr_size_t size; + + if (!src) { + return APR_NOTFOUND; + } + + if (dest) { + for (size = 0; size < srclen; size++) { + if (colon && size) { + *dest++ = ':'; + } + *dest++ = c2x_table[in[size] >> 4]; + *dest++ = c2x_table[in[size] & 0xf]; + } + *dest = '\0'; + } + + if (len) { + if (colon && srclen) { + *len = srclen * 3; + } + else { + *len = srclen * 2 + 1; + } + } + + return APR_SUCCESS; +} + +APR_DECLARE(const char *) apr_pescape_hex(apr_pool_t *p, const void *src, + apr_size_t srclen, int colon) +{ + apr_size_t len; + + switch (apr_escape_hex(NULL, src, srclen, colon, &len)) { + case APR_SUCCESS: { + char *cmd = apr_palloc(p, len); + apr_escape_hex(cmd, src, srclen, colon, NULL); + return cmd; + } + case APR_NOTFOUND: { + break; + } + } + + return src; +} + +APR_DECLARE(apr_status_t) apr_unescape_hex(void *dest, const char *str, + apr_ssize_t slen, int colon, apr_size_t *len) +{ + apr_size_t size = 0; + int flip = 0; + const unsigned char *s = (const unsigned char *) str; + unsigned char *d = (unsigned char *) dest; + unsigned c; + unsigned char u = 0; + + if (s) { + if (d) { + while ((c = *s) && slen) { + + if (!flip) { + u = 0; + } + + if (colon && c == ':' && !flip) { + ++s; + slen--; + continue; + } + else if (apr_isdigit(c)) { + u |= c - '0'; + } + else if (apr_isupper(c) && c <= 'F') { + u |= c - ('A' - 10); + } + else if (apr_islower(c) && c <= 'f') { + u |= c - ('a' - 10); + } + else { + return APR_BADCH; + } + + if (flip) { + *d++ = u; + size++; + } + else { + u <<= 4; + *d = u; + } + flip = !flip; + + ++s; + slen--; + } + } + else { + while ((c = *s) && slen) { + + if (colon && c == ':' && !flip) { + ++s; + slen--; + continue; + } + else if (apr_isdigit(c)) { + /* valid */ + } + else if (apr_isupper(c) && c <= 'F') { + /* valid */ + } + else if (apr_islower(c) && c <= 'f') { + /* valid */ + } + else { + return APR_BADCH; + } + + if (flip) { + size++; + } + flip = !flip; + + ++s; + slen--; + } + } + } + + if (len) { + *len = size; + } + if (!s) { + return APR_NOTFOUND; + } + + return APR_SUCCESS; +} + +APR_DECLARE(const void *) apr_punescape_hex(apr_pool_t *p, const char *str, + int colon, apr_size_t *len) +{ + apr_size_t size; + + switch (apr_unescape_hex(NULL, str, APR_ESCAPE_STRING, colon, &size)) { + case APR_SUCCESS: { + void *cmd = apr_palloc(p, size); + apr_unescape_hex(cmd, str, APR_ESCAPE_STRING, colon, len); + return cmd; + } + case APR_BADCH: + case APR_NOTFOUND: { + break; + } + } + + return NULL; +} diff --git a/contrib/apr/file_io/unix/filedup.c b/contrib/apr/file_io/unix/filedup.c index eb4fbdc6ba4..41cfec568f5 100644 --- a/contrib/apr/file_io/unix/filedup.c +++ b/contrib/apr/file_io/unix/filedup.c @@ -141,8 +141,7 @@ APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file, apr_file_t *old_file, apr_pool_t *p) { - *new_file = (apr_file_t *)apr_palloc(p, sizeof(apr_file_t)); - memcpy(*new_file, old_file, sizeof(apr_file_t)); + *new_file = (apr_file_t *)apr_pmemdup(p, old_file, sizeof(apr_file_t)); (*new_file)->pool = p; if (old_file->buffered) { (*new_file)->buffer = apr_palloc(p, old_file->bufsize); diff --git a/contrib/apr/file_io/unix/filestat.c b/contrib/apr/file_io/unix/filestat.c index 9bee651120a..220efd08602 100644 --- a/contrib/apr/file_io/unix/filestat.c +++ b/contrib/apr/file_io/unix/filestat.c @@ -95,7 +95,7 @@ static void fill_out_finfo(apr_finfo_t *finfo, struct_stat *info, #elif defined(HAVE_STRUCT_STAT_ST_ATIMENSEC) finfo->atime += info->st_atimensec / APR_TIME_C(1000); #elif defined(HAVE_STRUCT_STAT_ST_ATIME_N) - finfo->ctime += info->st_atime_n / APR_TIME_C(1000); + finfo->atime += info->st_atime_n / APR_TIME_C(1000); #endif apr_time_ansi_put(&finfo->mtime, info->st_mtime); @@ -104,7 +104,7 @@ static void fill_out_finfo(apr_finfo_t *finfo, struct_stat *info, #elif defined(HAVE_STRUCT_STAT_ST_MTIMENSEC) finfo->mtime += info->st_mtimensec / APR_TIME_C(1000); #elif defined(HAVE_STRUCT_STAT_ST_MTIME_N) - finfo->ctime += info->st_mtime_n / APR_TIME_C(1000); + finfo->mtime += info->st_mtime_n / APR_TIME_C(1000); #endif apr_time_ansi_put(&finfo->ctime, info->st_ctime); diff --git a/contrib/apr/file_io/unix/mktemp.c b/contrib/apr/file_io/unix/mktemp.c index 28aaf90e25e..7530a2510ec 100644 --- a/contrib/apr/file_io/unix/mktemp.c +++ b/contrib/apr/file_io/unix/mktemp.c @@ -74,7 +74,7 @@ #if APR_HAVE_SYS_TYPES_H #include #endif -#if APR_HAVE_SYS_STAT_H +#ifdef HAVE_SYS_STAT_H #include #endif #if APR_HAVE_FCNTL_H diff --git a/contrib/apr/file_io/unix/open.c b/contrib/apr/file_io/unix/open.c index 6373ee5ba0f..49eb7274155 100644 --- a/contrib/apr/file_io/unix/open.c +++ b/contrib/apr/file_io/unix/open.c @@ -135,6 +135,14 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, } #endif + if (flag & APR_FOPEN_NONBLOCK) { +#ifdef O_NONBLOCK + oflags |= O_NONBLOCK; +#else + return APR_ENOTIMPL; +#endif + } + #ifdef O_CLOEXEC /* Introduced in Linux 2.6.23. Silently ignored on earlier Linux kernels. */ diff --git a/contrib/apr/file_io/unix/pipe.c b/contrib/apr/file_io/unix/pipe.c index 7b8f01fb92a..571d9bcb8e9 100644 --- a/contrib/apr/file_io/unix/pipe.c +++ b/contrib/apr/file_io/unix/pipe.c @@ -25,8 +25,8 @@ * but now fcntl does, hence we need to do this extra checking. * The joys of beta programs. :-) */ -#if BEOS -#if !BONE7 +#if defined(BEOS) +#if !defined(BONE7) # define BEOS_BLOCKING 1 #else # define BEOS_BLOCKING 0 @@ -35,7 +35,7 @@ static apr_status_t pipeblock(apr_file_t *thepipe) { -#if !BEOS_BLOCKING +#if !defined(BEOS) || !BEOS_BLOCKING int fd_flags; fd_flags = fcntl(thepipe->filedes, F_GETFL, 0); @@ -71,7 +71,7 @@ static apr_status_t pipeblock(apr_file_t *thepipe) static apr_status_t pipenonblock(apr_file_t *thepipe) { -#if !BEOS_BLOCKING +#if !defined(BEOS) || !BEOS_BLOCKING int fd_flags = fcntl(thepipe->filedes, F_GETFL, 0); # if defined(O_NONBLOCK) diff --git a/contrib/apr/file_io/unix/readwrite.c b/contrib/apr/file_io/unix/readwrite.c index 4b3e7368c40..7044300c17c 100644 --- a/contrib/apr/file_io/unix/readwrite.c +++ b/contrib/apr/file_io/unix/readwrite.c @@ -21,7 +21,7 @@ /* The only case where we don't use wait_for_io_or_timeout is on * pre-BONE BeOS, so this check should be sufficient and simpler */ -#if !BEOS_R5 +#if !defined(BEOS_R5) #define USE_WAIT_FOR_IO #endif diff --git a/contrib/apr/include/apr.h.in b/contrib/apr/include/apr.h.in index a411dd029b7..0ad7a91aff3 100644 --- a/contrib/apr/include/apr.h.in +++ b/contrib/apr/include/apr.h.in @@ -116,7 +116,7 @@ * or the extern "C" namespace */ -#if APR_HAVE_WINDOWS_H +#if APR_HAVE_WINDOWS_H && defined(WIN32) /* If windows.h was already included, our preferences don't matter. * If not, include a restricted set of windows headers to our tastes. */ @@ -453,6 +453,8 @@ typedef apr_uint32_t apr_uintptr_t; */ #define APR_THREAD_FUNC @apr_thread_func@ +#if defined(DOXYGEN) || !defined(WIN32) + /** * The public APR functions are declared with APR_DECLARE(), so they may * use the most appropriate calling convention. Public APR functions with @@ -505,6 +507,20 @@ typedef apr_uint32_t apr_uintptr_t; */ #define APR_DECLARE_DATA +#elif defined(APR_DECLARE_STATIC) +#define APR_DECLARE(type) type __stdcall +#define APR_DECLARE_NONSTD(type) type __cdecl +#define APR_DECLARE_DATA +#elif defined(APR_DECLARE_EXPORT) +#define APR_DECLARE(type) __declspec(dllexport) type __stdcall +#define APR_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl +#define APR_DECLARE_DATA __declspec(dllexport) +#else +#define APR_DECLARE(type) __declspec(dllimport) type __stdcall +#define APR_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl +#define APR_DECLARE_DATA __declspec(dllimport) +#endif + /* Define APR_SSIZE_T_FMT. * If ssize_t is an integer we define it to be "d", * if ssize_t is a long int we define it to be "ld", diff --git a/contrib/apr/include/apr.hwc b/contrib/apr/include/apr.hwc new file mode 100644 index 00000000000..05799629508 --- /dev/null +++ b/contrib/apr/include/apr.hwc @@ -0,0 +1,641 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef APR_H +#define APR_H + +/* GENERATED FILE WARNING! DO NOT EDIT apr.h + * + * You must modify apr.hwc instead. + * + * And please, make an effort to stub apr.hnw and apr.h.in in the process. + * + * This is the Win32 specific version of apr.h. It is copied from + * apr.hw by the apr.dsp and libapr.dsp projects. + */ + +/** + * @file apr.h + * @brief APR Platform Definitions + * @remark This is a generated header generated from include/apr.h.in by + * ./configure, or copied from include/apr.hw or include/apr.hnw + * for Win32 or Netware by those build environments, respectively. + */ + +/* Make sure we have our platform identifier macro defined we ask for later. + */ +#if defined(_WIN32) && !defined(WIN32) +#define WIN32 1 +#endif + +#if defined(WIN32) || defined(DOXYGEN) + +/* Ignore most warnings (back down to /W3) for poorly constructed headers + */ +#if defined(_MSC_VER) && _MSC_VER >= 1200 +#pragma warning(push, 3) +#endif + +/* disable or reduce the frequency of... + * C4057: indirection to slightly different base types + * C4075: slight indirection changes (unsigned short* vs short[]) + * C4100: unreferenced formal parameter + * C4127: conditional expression is constant + * C4163: '_rotl64' : not available as an intrinsic function + * C4201: nonstandard extension nameless struct/unions + * C4244: int to char/short - precision loss + * C4514: unreferenced inline function removed + */ +#pragma warning(disable: 4100 4127 4163 4201 4514; once: 4057 4075 4244) + +/* Ignore Microsoft's interpretation of secure development + * and the POSIX string handling API + */ +#if defined(_MSC_VER) && _MSC_VER >= 1400 +#ifndef _CRT_SECURE_NO_DEPRECATE +#define _CRT_SECURE_NO_DEPRECATE +#endif +#pragma warning(disable: 4996) +#endif + +/* Has windows.h already been included? If so, our preferences don't matter, + * but we will still need the winsock things no matter what was included. + * If not, include a restricted set of windows headers to our tastes. + */ +#ifndef _WINDOWS_ +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#ifndef _WIN32_WINNT +#define _WIN32_WINNT @win32_winnt_str@ +#endif +#ifndef NOUSER +#define NOUSER +#endif +#ifndef NOMCX +#define NOMCX +#endif +#ifndef NOIME +#define NOIME +#endif +#include +/* + * Add a _very_few_ declarations missing from the restricted set of headers + * (If this list becomes extensive, re-enable the required headers above!) + * winsock headers were excluded by WIN32_LEAN_AND_MEAN, so include them now + */ +#define SW_HIDE 0 +#ifndef _WIN32_WCE +#include +#include +#include +#else +#include +#endif +#endif /* !_WINDOWS_ */ + +/** + * @defgroup APR Apache Portability Runtime library + * @{ + */ +/** + * @defgroup apr_platform Platform Definitions + * @{ + * @warning + * The actual values of macros and typedefs on this page
+ * are platform specific and should NOT be relied upon!
+ */ + +#define APR_INLINE __inline +#define APR_HAS_INLINE 1 +#if !defined(__GNUC__) && !defined(__attribute__) +#define __attribute__(__x) +#endif + +#ifndef _WIN32_WCE +#define APR_HAVE_ARPA_INET_H 0 +#define APR_HAVE_CONIO_H 1 +#define APR_HAVE_CRYPT_H 0 +#define APR_HAVE_CTYPE_H 1 +#define APR_HAVE_DIRENT_H 0 +#define APR_HAVE_ERRNO_H 1 +#define APR_HAVE_FCNTL_H 1 +#define APR_HAVE_IO_H 1 +#define APR_HAVE_LIMITS_H 1 +#define APR_HAVE_NETDB_H 0 +#define APR_HAVE_NETINET_IN_H 0 +#define APR_HAVE_NETINET_SCTP_H 0 +#define APR_HAVE_NETINET_SCTP_UIO_H 0 +#define APR_HAVE_NETINET_TCP_H 0 +#define APR_HAVE_PTHREAD_H 0 +#define APR_HAVE_SEMAPHORE_H 0 +#define APR_HAVE_SIGNAL_H 1 +#define APR_HAVE_STDARG_H 1 +#define APR_HAVE_STDINT_H 0 +#define APR_HAVE_STDIO_H 1 +#define APR_HAVE_STDLIB_H 1 +#define APR_HAVE_STRING_H 1 +#define APR_HAVE_STRINGS_H 0 +#define APR_HAVE_SYS_IOCTL_H 0 +#define APR_HAVE_SYS_SENDFILE_H 0 +#define APR_HAVE_SYS_SIGNAL_H 0 +#define APR_HAVE_SYS_SOCKET_H 0 +#define APR_HAVE_SYS_SOCKIO_H 0 +#define APR_HAVE_SYS_SYSLIMITS_H 0 +#define APR_HAVE_SYS_TIME_H 0 +#define APR_HAVE_SYS_TYPES_H 1 +#define APR_HAVE_SYS_UIO_H 0 +#define APR_HAVE_SYS_UN_H 0 +#define APR_HAVE_SYS_WAIT_H 0 +#define APR_HAVE_TIME_H 1 +#define APR_HAVE_UNISTD_H 0 +#define APR_HAVE_STDDEF_H 1 +#define APR_HAVE_PROCESS_H 1 +#else +#define APR_HAVE_ARPA_INET_H 0 +#define APR_HAVE_CONIO_H 0 +#define APR_HAVE_CRYPT_H 0 +#define APR_HAVE_CTYPE_H 0 +#define APR_HAVE_DIRENT_H 0 +#define APR_HAVE_ERRNO_H 0 +#define APR_HAVE_FCNTL_H 0 +#define APR_HAVE_IO_H 0 +#define APR_HAVE_LIMITS_H 0 +#define APR_HAVE_NETDB_H 0 +#define APR_HAVE_NETINET_IN_H 0 +#define APR_HAVE_NETINET_SCTP_H 0 +#define APR_HAVE_NETINET_SCTP_UIO_H 0 +#define APR_HAVE_NETINET_TCP_H 0 +#define APR_HAVE_PTHREAD_H 0 +#define APR_HAVE_SEMAPHORE_H 0 +#define APR_HAVE_SIGNAL_H 0 +#define APR_HAVE_STDARG_H 0 +#define APR_HAVE_STDINT_H 0 +#define APR_HAVE_STDIO_H 1 +#define APR_HAVE_STDLIB_H 1 +#define APR_HAVE_STRING_H 1 +#define APR_HAVE_STRINGS_H 0 +#define APR_HAVE_SYS_IOCTL_H 0 +#define APR_HAVE_SYS_SENDFILE_H 0 +#define APR_HAVE_SYS_SIGNAL_H 0 +#define APR_HAVE_SYS_SOCKET_H 0 +#define APR_HAVE_SYS_SOCKIO_H 0 +#define APR_HAVE_SYS_SYSLIMITS_H 0 +#define APR_HAVE_SYS_TIME_H 0 +#define APR_HAVE_SYS_TYPES_H 0 +#define APR_HAVE_SYS_UIO_H 0 +#define APR_HAVE_SYS_UN_H 0 +#define APR_HAVE_SYS_WAIT_H 0 +#define APR_HAVE_TIME_H 0 +#define APR_HAVE_UNISTD_H 0 +#define APR_HAVE_STDDEF_H 0 +#define APR_HAVE_PROCESS_H 0 +#endif + +/** @} */ +/** @} */ + +/* We don't include our conditional headers within the doxyblocks + * or the extern "C" namespace + */ + +#if APR_HAVE_STDLIB_H +#include +#endif +#if APR_HAVE_STDIO_H +#include +#endif +#if APR_HAVE_SYS_TYPES_H +#include +#endif +#if APR_HAVE_STDDEF_H +#include +#endif +#if APR_HAVE_TIME_H +#include +#endif +#if APR_HAVE_PROCESS_H +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup apr_platform + * @ingroup APR + * @{ + */ + +#define APR_HAVE_SHMEM_MMAP_TMP 0 +#define APR_HAVE_SHMEM_MMAP_SHM 0 +#define APR_HAVE_SHMEM_MMAP_ZERO 0 +#define APR_HAVE_SHMEM_SHMGET_ANON 0 +#define APR_HAVE_SHMEM_SHMGET 0 +#define APR_HAVE_SHMEM_MMAP_ANON 0 +#define APR_HAVE_SHMEM_BEOS 0 + +#define APR_USE_SHMEM_MMAP_TMP 0 +#define APR_USE_SHMEM_MMAP_SHM 0 +#define APR_USE_SHMEM_MMAP_ZERO 0 +#define APR_USE_SHMEM_SHMGET_ANON 0 +#define APR_USE_SHMEM_SHMGET 0 +#define APR_USE_SHMEM_MMAP_ANON 0 +#define APR_USE_SHMEM_BEOS 0 + +#define APR_USE_FLOCK_SERIALIZE 0 +#define APR_USE_POSIXSEM_SERIALIZE 0 +#define APR_USE_SYSVSEM_SERIALIZE 0 +#define APR_USE_FCNTL_SERIALIZE 0 +#define APR_USE_PROC_PTHREAD_SERIALIZE 0 +#define APR_USE_PTHREAD_SERIALIZE 0 + +#define APR_HAS_FLOCK_SERIALIZE 0 +#define APR_HAS_SYSVSEM_SERIALIZE 0 +#define APR_HAS_POSIXSEM_SERIALIZE 0 +#define APR_HAS_FCNTL_SERIALIZE 0 +#define APR_HAS_PROC_PTHREAD_SERIALIZE 0 + +#define APR_PROCESS_LOCK_IS_GLOBAL 0 + +#define APR_HAVE_CORKABLE_TCP 0 +#define APR_HAVE_GETRLIMIT 0 +#define APR_HAVE_ICONV 0 +#define APR_HAVE_IN_ADDR 1 +#define APR_HAVE_INET_ADDR 1 +#define APR_HAVE_INET_NETWORK 0 +#define APR_HAVE_IPV6 @apr_have_ipv6_10@ +#define APR_HAVE_MEMMOVE 1 +#define APR_HAVE_SETRLIMIT 0 +#define APR_HAVE_SIGACTION 0 +#define APR_HAVE_SIGSUSPEND 0 +#define APR_HAVE_SIGWAIT 0 +#define APR_HAVE_SA_STORAGE 0 +#define APR_HAVE_STRCASECMP 0 +#define APR_HAVE_STRDUP 1 +#define APR_HAVE_STRNCASECMP 0 +#define APR_HAVE_STRSTR 1 +#define APR_HAVE_MEMCHR 1 +#define APR_HAVE_STRUCT_RLIMIT 0 +#define APR_HAVE_UNION_SEMUN 0 +#define APR_HAVE_SCTP 0 +#define APR_HAVE_IOVEC 0 + +#ifndef _WIN32_WCE +#define APR_HAVE_STRICMP 1 +#define APR_HAVE_STRNICMP 1 +#else +#define APR_HAVE_STRICMP 0 +#define APR_HAVE_STRNICMP 0 +#endif + +/* APR Feature Macros */ +#define APR_HAS_SHARED_MEMORY 1 +#define APR_HAS_THREADS 1 +#define APR_HAS_MMAP 1 +#define APR_HAS_FORK 0 +#define APR_HAS_RANDOM 1 +#define APR_HAS_OTHER_CHILD 1 +#define APR_HAS_DSO 1 +#define APR_HAS_SO_ACCEPTFILTER 0 +#define APR_HAS_UNICODE_FS 1 +#define APR_HAS_PROC_INVOKED 1 +#define APR_HAS_OS_UUID 1 + +#ifndef _WIN32_WCE +#define APR_HAS_SENDFILE 1 +#define APR_HAS_USER 1 +#define APR_HAS_LARGE_FILES 1 +#define APR_HAS_XTHREAD_FILES 1 +#define APR_PROCATTR_USER_SET_REQUIRES_PASSWORD 1 +#else +#define APR_HAS_SENDFILE 0 +#define APR_HAS_USER 0 +#define APR_HAS_LARGE_FILES 0 +#define APR_HAS_XTHREAD_FILES 0 +#define APR_PROCATTR_USER_SET_REQUIRES_PASSWORD 0 +#endif + +/* APR sets APR_FILES_AS_SOCKETS to 1 on systems where it is possible + * to poll on files/pipes. + */ +#define APR_FILES_AS_SOCKETS 0 + +/* This macro indicates whether or not EBCDIC is the native character set. + */ +#define APR_CHARSET_EBCDIC 0 + +/* If we have a TCP implementation that can be "corked", what flag + * do we use? + */ +#define APR_TCP_NOPUSH_FLAG @apr_tcp_nopush_flag@ + +/* Is the TCP_NODELAY socket option inherited from listening sockets? + */ +#define APR_TCP_NODELAY_INHERITED 1 + +/* Is the O_NONBLOCK flag inherited from listening sockets? + */ +#define APR_O_NONBLOCK_INHERITED 1 + +/* Typedefs that APR needs. */ + +typedef unsigned char apr_byte_t; + +typedef short apr_int16_t; +typedef unsigned short apr_uint16_t; + +typedef int apr_int32_t; +typedef unsigned int apr_uint32_t; + +typedef __int64 apr_int64_t; +typedef unsigned __int64 apr_uint64_t; + +typedef size_t apr_size_t; +#if APR_HAVE_STDDEF_H +typedef ptrdiff_t apr_ssize_t; +#else +typedef int apr_ssize_t; +#endif +#if APR_HAS_LARGE_FILES +typedef __int64 apr_off_t; +#else +typedef int apr_off_t; +#endif +typedef int apr_socklen_t; +typedef apr_uint64_t apr_ino_t; + +#ifdef _WIN64 +#define APR_SIZEOF_VOIDP 8 +#else +#define APR_SIZEOF_VOIDP 4 +#endif + +#if APR_SIZEOF_VOIDP == 8 +typedef apr_uint64_t apr_uintptr_t; +#else +typedef apr_uint32_t apr_uintptr_t; +#endif + +/* Are we big endian? */ +/* XXX: Fatal assumption on Alpha platforms */ +#define APR_IS_BIGENDIAN 0 + +/* Mechanisms to properly type numeric literals */ + +#ifndef __GNUC__ +#define APR_INT64_C(val) (val##i64) +#define APR_UINT64_C(val) (val##Ui64) +#else +#define APR_INT64_C(val) (val##LL) +#define APR_UINT64_C(val) (val##ULL) +#endif + +#ifdef INT16_MIN +#define APR_INT16_MIN INT16_MIN +#else +#define APR_INT16_MIN (-0x7fff - 1) +#endif + +#ifdef INT16_MAX +#define APR_INT16_MAX INT16_MAX +#else +#define APR_INT16_MAX (0x7fff) +#endif + +#ifdef UINT16_MAX +#define APR_UINT16_MAX UINT16_MAX +#else +#define APR_UINT16_MAX (0xffff) +#endif + +#ifdef INT32_MIN +#define APR_INT32_MIN INT32_MIN +#else +#define APR_INT32_MIN (-0x7fffffff - 1) +#endif + +#ifdef INT32_MAX +#define APR_INT32_MAX INT32_MAX +#else +#define APR_INT32_MAX 0x7fffffff +#endif + +#ifdef UINT32_MAX +#define APR_UINT32_MAX UINT32_MAX +#else +#define APR_UINT32_MAX (0xffffffffU) +#endif + +#ifdef INT64_MIN +#define APR_INT64_MIN INT64_MIN +#else +#define APR_INT64_MIN (APR_INT64_C(-0x7fffffffffffffff) - 1) +#endif + +#ifdef INT64_MAX +#define APR_INT64_MAX INT64_MAX +#else +#define APR_INT64_MAX APR_INT64_C(0x7fffffffffffffff) +#endif + +#ifdef UINT64_MAX +#define APR_UINT64_MAX UINT64_MAX +#else +#define APR_UINT64_MAX APR_UINT64_C(0xffffffffffffffff) +#endif + +#define APR_SIZE_MAX (~((apr_size_t)0)) + +/* Definitions that APR programs need to work properly. */ + +/** + * APR public API wrap for C++ compilers. + */ +#ifdef __cplusplus +#define APR_BEGIN_DECLS extern "C" { +#define APR_END_DECLS } +#else +#define APR_BEGIN_DECLS +#define APR_END_DECLS +#endif + +/** + * Thread callbacks from APR functions must be declared with APR_THREAD_FUNC, + * so that they follow the platform's calling convention. + *

+ *
+ * void* APR_THREAD_FUNC my_thread_entry_fn(apr_thread_t *thd, void *data);
+ *
+ * 
+ */ +#define APR_THREAD_FUNC __stdcall + + +#if defined(DOXYGEN) || !defined(WIN32) + +/** + * The public APR functions are declared with APR_DECLARE(), so they may + * use the most appropriate calling convention. Public APR functions with + * variable arguments must use APR_DECLARE_NONSTD(). + * + * @remark Both the declaration and implementations must use the same macro. + * + *
+ * APR_DECLARE(rettype) apr_func(args)
+ * 
+ * @see APR_DECLARE_NONSTD @see APR_DECLARE_DATA + * @remark Note that when APR compiles the library itself, it passes the + * symbol -DAPR_DECLARE_EXPORT to the compiler on some platforms (e.g. Win32) + * to export public symbols from the dynamic library build.\n + * The user must define the APR_DECLARE_STATIC when compiling to target + * the static APR library on some platforms (e.g. Win32.) The public symbols + * are neither exported nor imported when APR_DECLARE_STATIC is defined.\n + * By default, compiling an application and including the APR public + * headers, without defining APR_DECLARE_STATIC, will prepare the code to be + * linked to the dynamic library. + */ +#define APR_DECLARE(type) type + +/** + * The public APR functions using variable arguments are declared with + * APR_DECLARE_NONSTD(), as they must follow the C language calling convention. + * @see APR_DECLARE @see APR_DECLARE_DATA + * @remark Both the declaration and implementations must use the same macro. + *
+ *
+ * APR_DECLARE_NONSTD(rettype) apr_func(args, ...);
+ *
+ * 
+ */ +#define APR_DECLARE_NONSTD(type) type + +/** + * The public APR variables are declared with AP_MODULE_DECLARE_DATA. + * This assures the appropriate indirection is invoked at compile time. + * @see APR_DECLARE @see APR_DECLARE_NONSTD + * @remark Note that the declaration and implementations use different forms, + * but both must include the macro. + * + *
+ *
+ * extern APR_DECLARE_DATA type apr_variable;\n
+ * APR_DECLARE_DATA type apr_variable = value;
+ *
+ * 
+ */ +#define APR_DECLARE_DATA + +#elif defined(APR_DECLARE_STATIC) +#define APR_DECLARE(type) type __stdcall +#define APR_DECLARE_NONSTD(type) type __cdecl +#define APR_DECLARE_DATA +#elif defined(APR_DECLARE_EXPORT) +#define APR_DECLARE(type) __declspec(dllexport) type __stdcall +#define APR_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl +#define APR_DECLARE_DATA __declspec(dllexport) +#else +#define APR_DECLARE(type) __declspec(dllimport) type __stdcall +#define APR_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl +#define APR_DECLARE_DATA __declspec(dllimport) +#endif + +#ifdef _WIN64 +#define APR_SSIZE_T_FMT "I64d" +#define APR_SIZE_T_FMT "I64u" +#else +#define APR_SSIZE_T_FMT "d" +#define APR_SIZE_T_FMT "u" +#endif + +#if APR_HAS_LARGE_FILES +#define APR_OFF_T_FMT "I64d" +#else +#define APR_OFF_T_FMT "d" +#endif + +#define APR_PID_T_FMT "d" + +#define APR_INT64_T_FMT "I64d" +#define APR_UINT64_T_FMT "I64u" +#define APR_UINT64_T_HEX_FMT "I64x" + +/* No difference between PROC and GLOBAL mutex */ +#define APR_PROC_MUTEX_IS_GLOBAL 1 + +/* Local machine definition for console and log output. */ +#define APR_EOL_STR "\r\n" + +typedef int apr_wait_t; + +#if APR_HAS_UNICODE_FS +/* An arbitrary size that is digestable. True max is a bit less than 32000 */ +#define APR_PATH_MAX 8192 +#else /* !APR_HAS_UNICODE_FS */ +#define APR_PATH_MAX MAX_PATH +#endif + +#define APR_DSOPATH "PATH" + +/** @} */ + +/* Definitions that only Win32 programs need to compile properly. */ + +/* XXX These simply don't belong here, perhaps in apr_portable.h + * based on some APR_HAVE_PID/GID/UID? + */ +#ifndef __GNUC__ +typedef int pid_t; +#endif +typedef int uid_t; +typedef int gid_t; + +/* Win32 .h ommissions we really need */ +#define STDIN_FILENO 0 +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 + +#if APR_HAVE_IPV6 + +/* Appears in later flavors, not the originals. */ +#ifndef in_addr6 +#define in6_addr in_addr6 +#endif + +#ifndef WS2TCPIP_INLINE +#define IN6_IS_ADDR_V4MAPPED(a) \ + ( (*(const apr_uint64_t *)(const void *)(&(a)->s6_addr[0]) == 0) \ + && (*(const apr_uint32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff))) +#endif + +#endif /* APR_HAS_IPV6 */ + +#ifdef __cplusplus +} +#endif + +/* Done with badly written headers + */ +#if defined(_MSC_VER) && _MSC_VER >= 1200 +#pragma warning(pop) +#pragma warning(disable: 4996) +#endif + +#endif /* WIN32 */ + +#endif /* APR_H */ diff --git a/contrib/apr/include/apr_allocator.h b/contrib/apr/include/apr_allocator.h index 5d6677645db..70d31efa0f5 100644 --- a/contrib/apr/include/apr_allocator.h +++ b/contrib/apr/include/apr_allocator.h @@ -131,7 +131,7 @@ APR_DECLARE(apr_pool_t *) apr_allocator_owner_get(apr_allocator_t *allocator) /** * Set the current threshold at which the allocator should start * giving blocks back to the system. - * @param allocator The allocator the set the threshold on + * @param allocator The allocator to set the threshold on * @param size The threshold. 0 == unlimited. */ APR_DECLARE(void) apr_allocator_max_free_set(apr_allocator_t *allocator, diff --git a/contrib/apr/include/apr_errno.h b/contrib/apr/include/apr_errno.h index d4d44cb1aed..58eaf73cc5a 100644 --- a/contrib/apr/include/apr_errno.h +++ b/contrib/apr/include/apr_errno.h @@ -45,7 +45,7 @@ typedef int apr_status_t; /** * Return a human readable string describing the specified error. - * @param statcode The error code the get a string for. + * @param statcode The error code to get a string for. * @param buf A buffer to hold the error string. * @param bufsize Size of the buffer to hold the string. */ @@ -126,7 +126,7 @@ APR_DECLARE(char *) apr_strerror(apr_status_t statcode, char *buf, * use within apr-util. This space is reserved above that used by APR * internally. * @note This number MUST be smaller than APR_OS_ERRSPACE_SIZE by a - * large enough amount that APR has sufficient room for it's + * large enough amount that APR has sufficient room for its * codes. */ #define APR_UTIL_ERRSPACE_SIZE 20000 @@ -135,7 +135,7 @@ APR_DECLARE(char *) apr_strerror(apr_status_t statcode, char *buf, */ #define APR_OS_START_STATUS (APR_OS_START_ERROR + APR_OS_ERRSPACE_SIZE) /** - * APR_UTIL_START_STATUS is where APR-Util starts defining it's + * APR_UTIL_START_STATUS is where APR-Util starts defining its * status codes. */ #define APR_UTIL_START_STATUS (APR_OS_START_STATUS + \ diff --git a/contrib/apr/include/apr_escape.h b/contrib/apr/include/apr_escape.h new file mode 100644 index 00000000000..5b60ac6eee2 --- /dev/null +++ b/contrib/apr/include/apr_escape.h @@ -0,0 +1,374 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file apr_escape.h + * @brief APR-UTIL Escaping + */ +#ifndef APR_ESCAPE_H +#define APR_ESCAPE_H +#include "apr.h" +#include "apr_general.h" +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @defgroup APR_Util_Escaping Escape functions + * @ingroup APR + * @{ + */ + +/* Simple escape/unescape functions. + * + */ + +/** + * When passing a string to one of the escape functions, this value can be + * passed to indicate a string-valued key, and have the length computed + * automatically. + */ +#define APR_ESCAPE_STRING (-1) + +/** + * Perform shell escaping on the provided string. + * + * Shell escaping causes characters to be prefixed with a '\' character. + * @param escaped Optional buffer to write the encoded string, can be + * NULL + * @param str The original string + * @param slen The length of the original string, or APR_ESCAPE_STRING + * @param len If present, returns the length of the string + * @return APR_SUCCESS, or APR_NOTFOUND if no changes to the string were + * detected or the string was NULL + */ +APR_DECLARE(apr_status_t) apr_escape_shell(char *escaped, const char *str, + apr_ssize_t slen, apr_size_t *len); + +/** + * Perform shell escaping on the provided string, returning the result + * from the pool. + * + * Shell escaping causes characters to be prefixed with a '\' character. + * + * If no characters were escaped, the original string is returned. + * @param p Pool to allocate from + * @param str The original string + * @return the encoded string, allocated from the pool, or the original + * string if no escaping took place or the string was NULL. + */ +APR_DECLARE(const char *) apr_pescape_shell(apr_pool_t *p, const char *str) + __attribute__((nonnull(1))); + +/** + * Unescapes a URL, leaving reserved characters intact. + * @param escaped Optional buffer to write the encoded string, can be + * NULL + * @param url String to be unescaped + * @param slen The length of the original url, or APR_ESCAPE_STRING + * @param forbid Optional list of forbidden characters, in addition to + * 0x00 + * @param reserved Optional list of reserved characters that will be + * left unescaped + * @param plus If non zero, '+' is converted to ' ' as per + * application/x-www-form-urlencoded encoding + * @param len If set, the length of the escaped string will be returned + * @return APR_SUCCESS on success, APR_NOTFOUND if no characters are + * decoded or the string is NULL, APR_EINVAL if a bad escape sequence is + * found, APR_BADCH if a character on the forbid list is found. + */ +APR_DECLARE(apr_status_t) apr_unescape_url(char *escaped, const char *url, + apr_ssize_t slen, const char *forbid, const char *reserved, int plus, + apr_size_t *len); + +/** + * Unescapes a URL, leaving reserved characters intact, returning the + * result from a pool. + * @param p Pool to allocate from + * @param url String to be unescaped in place + * @param forbid Optional list of forbidden characters, in addition to + * 0x00 + * @param reserved Optional list of reserved characters that will be + * left unescaped + * @param plus If non zero, '+' is converted to ' ' as per + * application/x-www-form-urlencoded encoding + * @return A string allocated from the pool on success, the original string + * if no characters are decoded, or NULL if a bad escape sequence is found + * or if a character on the forbid list is found, or if the original string + * was NULL. + */ +APR_DECLARE(const char *) apr_punescape_url(apr_pool_t *p, const char *url, + const char *forbid, const char *reserved, int plus) + __attribute__((nonnull(1))); + +/** + * Escape a path segment, as defined in RFC1808. + * @param escaped Optional buffer to write the encoded string, can be + * NULL + * @param str The original string + * @param slen The length of the original string, or APR_ESCAPE_STRING + * @param len If present, returns the length of the string + * @return APR_SUCCESS, or APR_NOTFOUND if no changes to the string were + * detected or the string was NULL + */ +APR_DECLARE(apr_status_t) apr_escape_path_segment(char *escaped, + const char *str, apr_ssize_t slen, apr_size_t *len); + +/** + * Escape a path segment, as defined in RFC1808, returning the result from a + * pool. + * @param p Pool to allocate from + * @param str String to be escaped + * @return A string allocated from the pool on success, the original string + * if no characters are encoded or the string is NULL. + */ +APR_DECLARE(const char *) apr_pescape_path_segment(apr_pool_t *p, + const char *str) __attribute__((nonnull(1))); + +/** + * Converts an OS path to a URL, in an OS dependent way, as defined in RFC1808. + * In all cases if a ':' occurs before the first '/' in the URL, the URL should + * be prefixed with "./" (or the ':' escaped). In the case of Unix, this means + * leaving '/' alone, but otherwise doing what escape_path_segment() does. For + * efficiency reasons, we don't use escape_path_segment(), which is provided for + * reference. Again, RFC 1808 is where this stuff is defined. + * + * If partial is set, os_escape_path() assumes that the path will be appended to + * something with a '/' in it (and thus does not prefix "./"). + * @param escaped Optional buffer to write the encoded string, can be + * NULL + * @param path The original string + * @param slen The length of the original string, or APR_ESCAPE_STRING + * @param partial If non zero, suppresses the prepending of "./" + * @param len If present, returns the length of the string + * @return APR_SUCCESS, or APR_NOTFOUND if no changes to the string were + * detected or if the string was NULL + */ +APR_DECLARE(apr_status_t) apr_escape_path(char *escaped, const char *path, + apr_ssize_t slen, int partial, apr_size_t *len); + +/** + * Converts an OS path to a URL, in an OS dependent way, as defined in RFC1808, + * returning the result from a pool. + * + * In all cases if a ':' occurs before the first '/' in the URL, the URL should + * be prefixed with "./" (or the ':' escaped). In the case of Unix, this means + * leaving '/' alone, but otherwise doing what escape_path_segment() does. For + * efficiency reasons, we don't use escape_path_segment(), which is provided for + * reference. Again, RFC 1808 is where this stuff is defined. + * + * If partial is set, os_escape_path() assumes that the path will be appended to + * something with a '/' in it (and thus does not prefix "./"). + * @param p Pool to allocate from + * @param str The original string + * @param partial If non zero, suppresses the prepending of "./" + * @return A string allocated from the pool on success, the original string + * if no characters are encoded or if the string was NULL. + */ +APR_DECLARE(const char *) apr_pescape_path(apr_pool_t *p, const char *str, + int partial) __attribute__((nonnull(1))); + +/** + * Urlencode a string, as defined in + * http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1. + * @param escaped Optional buffer to write the encoded string, can be + * NULL + * @param str The original string + * @param slen The length of the original string, or APR_ESCAPE_STRING + * @param len If present, returns the length of the string + * @return APR_SUCCESS, or APR_NOTFOUND if no changes to the string were + * detected or if the stirng was NULL + */ +APR_DECLARE(apr_status_t) apr_escape_urlencoded(char *escaped, const char *str, + apr_ssize_t slen, apr_size_t *len); + +/** + * Urlencode a string, as defined in + * http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1, returning + * the result from a pool. + * @param p Pool to allocate from + * @param str String to be escaped + * @return A string allocated from the pool on success, the original string + * if no characters are encoded or if the string was NULL. + */ +APR_DECLARE(const char *) apr_pescape_urlencoded(apr_pool_t *p, + const char *str) __attribute__((nonnull(1))); + +/** + * Apply entity encoding to a string. Characters are replaced as follows: + * '<' becomes '<', '>' becomes '>', '&' becomes '&', the + * double quote becomes '"" and the single quote becomes '''. + * + * If toasc is not zero, any non ascii character will be encoded as + * '%\#ddd;', where ddd is the decimal code of the character. + * @param escaped Optional buffer to write the encoded string, can be + * NULL + * @param str The original string + * @param slen The length of the original string, or APR_ESCAPE_STRING + * @param toasc If non zero, encode non ascii characters + * @param len If present, returns the length of the string + * @return APR_SUCCESS, or APR_NOTFOUND if no changes to the string were + * detected or the string was NULL + */ +APR_DECLARE(apr_status_t) apr_escape_entity(char *escaped, const char *str, + apr_ssize_t slen, int toasc, apr_size_t *len); + +/** + * Apply entity encoding to a string, returning the result from a pool. + * Characters are replaced as follows: '<' becomes '<', '>' becomes + * '>', '&' becomes '&', the double quote becomes '"" and the + * single quote becomes '''. + * @param p Pool to allocate from + * @param str The original string + * @param toasc If non zero, encode non ascii characters + * @return A string allocated from the pool on success, the original string + * if no characters are encoded or the string is NULL. + */ +APR_DECLARE(const char *) apr_pescape_entity(apr_pool_t *p, const char *str, + int toasc) __attribute__((nonnull(1))); + +/** + * Decodes html entities or numeric character references in a string. If + * the string to be unescaped is syntactically incorrect, then the + * following fixups will be made: + * unknown entities will be left undecoded; + * references to unused numeric characters will be deleted. + * In particular, � will not be decoded, but will be deleted. + * @param unescaped Optional buffer to write the encoded string, can be + * NULL + * @param str The original string + * @param slen The length of the original string, or APR_ESCAPE_STRING + * @param len If present, returns the length of the string + * @return APR_SUCCESS, or APR_NOTFOUND if no changes to the string were + * detected or the string was NULL + */ +APR_DECLARE(apr_status_t) apr_unescape_entity(char *unescaped, const char *str, + apr_ssize_t slen, apr_size_t *len); + +/** + * Decodes html entities or numeric character references in a string. If + * the string to be unescaped is syntactically incorrect, then the + * following fixups will be made: + * unknown entities will be left undecoded; + * references to unused numeric characters will be deleted. + * In particular, � will not be decoded, but will be deleted. + * @param p Pool to allocate from + * @param str The original string + * @return A string allocated from the pool on success, the original string + * if no characters are encoded or the string is NULL. + */ +APR_DECLARE(const char *) apr_punescape_entity(apr_pool_t *p, const char *str) + __attribute__((nonnull(1))); + +/** + * Escape control characters in a string, as performed by the shell's + * 'echo' command. Characters are replaced as follows: + * \\a alert (bell), \\b backspace, \\f form feed, \\n new line, \\r carriage + * return, \\t horizontal tab, \\v vertical tab, \\ backslash. + * + * Any non ascii character will be encoded as '\\xHH', where HH is the hex + * code of the character. + * + * If quote is not zero, the double quote character will also be escaped. + * @param escaped Optional buffer to write the encoded string, can be + * NULL + * @param str The original string + * @param slen The length of the original string, or APR_ESCAPE_STRING + * @param quote If non zero, encode double quotes + * @param len If present, returns the length of the string + * @return APR_SUCCESS, or APR_NOTFOUND if no changes to the string were + * detected or the string was NULL + */ +APR_DECLARE(apr_status_t) apr_escape_echo(char *escaped, const char *str, + apr_ssize_t slen, int quote, apr_size_t *len); + +/** + * Escape control characters in a string, as performed by the shell's + * 'echo' command, and return the results from a pool. Characters are + * replaced as follows: \\a alert (bell), \\b backspace, \\f form feed, + * \\n new line, \\r carriage return, \\t horizontal tab, \\v vertical tab, + * \\ backslash. + * + * Any non ascii character will be encoded as '\\xHH', where HH is the hex + * code of the character. + * + * If quote is not zero, the double quote character will also be escaped. + * @param p Pool to allocate from + * @param str The original string + * @param quote If non zero, encode double quotes + * @return A string allocated from the pool on success, the original string + * if no characters are encoded or the string is NULL. + */ +APR_DECLARE(const char *) apr_pescape_echo(apr_pool_t *p, const char *str, + int quote); + +/** + * Convert binary data to a hex encoding. + * @param dest The destination buffer, can be NULL + * @param src The original buffer + * @param srclen The length of the original buffer + * @param colon If not zero, insert colon characters between hex digits. + * @param len If present, returns the length of the string + * @return APR_SUCCESS, or APR_NOTFOUND if the string was NULL + */ +APR_DECLARE(apr_status_t) apr_escape_hex(char *dest, const void *src, + apr_size_t srclen, int colon, apr_size_t *len); + +/** + * Convert binary data to a hex encoding, and return the results from a + * pool. + * @param p Pool to allocate from + * @param src The original buffer + * @param slen The length of the original buffer + * @param colon If not zero, insert colon characters between hex digits. + * @return A zero padded buffer allocated from the pool on success, or + * NULL if src was NULL. + */ +APR_DECLARE(const char *) apr_pescape_hex(apr_pool_t *p, const void *src, + apr_size_t slen, int colon) __attribute__((nonnull(1))); + +/** + * Convert hex encoded string to binary data. + * @param dest The destination buffer, can be NULL + * @param str The original buffer + * @param slen The length of the original buffer + * @param colon If not zero, ignore colon characters between hex digits. + * @param len If present, returns the length of the string + * @return APR_SUCCESS, or APR_NOTFOUND if the string was NULL, or APR_BADCH + * if a non hex character is present. + */ +APR_DECLARE(apr_status_t) apr_unescape_hex(void *dest, const char *str, + apr_ssize_t slen, int colon, apr_size_t *len); + +/** + * Convert hex encoding to binary data, and return the results from a pool. + * If the colon character appears between pairs of hex digits, it will be + * ignored. + * @param p Pool to allocate from + * @param str The original string + * @param colon If not zero, ignore colon characters between hex digits. + * @param len If present, returns the length of the final buffer + * @return A buffer allocated from the pool on success, or NULL if src was + * NULL, or a bad character was present. + */ +APR_DECLARE(const void *) apr_punescape_hex(apr_pool_t *p, const char *str, + int colon, apr_size_t *len); + +/** @} */ +#ifdef __cplusplus +} +#endif + +#endif /* !APR_ESCAPE_H */ diff --git a/contrib/apr/include/apr_file_info.h b/contrib/apr/include/apr_file_info.h index 94e84e87635..1d19eb6a3f4 100644 --- a/contrib/apr/include/apr_file_info.h +++ b/contrib/apr/include/apr_file_info.h @@ -208,7 +208,7 @@ struct apr_finfo_t { const char *fname; /** The file's name (no path) in filesystem case */ const char *name; - /** The file's handle, if accessed (can be submitted to apr_duphandle) */ + /** Unused */ struct apr_file_t *filehand; }; @@ -316,7 +316,7 @@ APR_DECLARE(apr_status_t) apr_dir_rewind(apr_dir_t *thedir); * @param filepath the pathname to parse for its root component * @param flags the desired rules to apply, from *
- *      APR_FILEPATH_NATIVE    Use native path seperators (e.g. '\' on Win32)
+ *      APR_FILEPATH_NATIVE    Use native path separators (e.g. '\' on Win32)
  *      APR_FILEPATH_TRUENAME  Tests that the root exists, and makes it proper
  * 
* @param p the pool to allocate the new path string from @@ -328,7 +328,7 @@ APR_DECLARE(apr_status_t) apr_dir_rewind(apr_dir_t *thedir); * test for the validity of that root (e.g., that a drive d:/ or network * share //machine/foovol/). * The function returns APR_ERELATIVE if filepath isn't rooted (an - * error), APR_EINCOMPLETE if the root path is ambigious (but potentially + * error), APR_EINCOMPLETE if the root path is ambiguous (but potentially * legitimate, e.g. "/" on Windows is incomplete because it doesn't specify * the drive letter), or APR_EBADPATH if the root is simply invalid. * APR_SUCCESS is returned if filepath is an absolute path. @@ -362,7 +362,7 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, * @param pathelts the returned components of the search path * @param liststr the search path (e.g., getenv("PATH")) * @param p the pool to allocate the array and path components from - * @remark empty path componenta do not become part of @a pathelts. + * @remark empty path components do not become part of @a pathelts. * @remark the path separator in @a liststr is system specific; * e.g., ':' on Unix, ';' on Windows, etc. */ diff --git a/contrib/apr/include/apr_file_io.h b/contrib/apr/include/apr_file_io.h index ca997514608..eb683afa745 100644 --- a/contrib/apr/include/apr_file_io.h +++ b/contrib/apr/include/apr_file_io.h @@ -57,8 +57,10 @@ extern "C" { #define APR_FOPEN_APPEND 0x00008 /**< Append to the end of the file */ #define APR_FOPEN_TRUNCATE 0x00010 /**< Open the file and truncate to 0 length */ -#define APR_FOPEN_BINARY 0x00020 /**< Open the file in binary mode */ -#define APR_FOPEN_EXCL 0x00040 /**< Open should fail if APR_CREATE +#define APR_FOPEN_BINARY 0x00020 /**< Open the file in binary mode + (This flag is ignored on UNIX + because it has no meaning)*/ +#define APR_FOPEN_EXCL 0x00040 /**< Open should fail if #APR_FOPEN_CREATE and file exists. */ #define APR_FOPEN_BUFFERED 0x00080 /**< Open the file for buffered I/O */ #define APR_FOPEN_DELONCLOSE 0x00100 /**< Delete the file after close */ @@ -70,7 +72,10 @@ extern "C" { access to support writes across process/machines */ #define APR_FOPEN_NOCLEANUP 0x00800 /**< Do not register a cleanup - when the file is opened */ + when the file is opened. The + apr_os_file_t handle in apr_file_t + will not be closed when the pool + is destroyed. */ #define APR_FOPEN_SENDFILE_ENABLED 0x01000 /**< Advisory flag that this file should support apr_socket_sendfile operation */ @@ -80,6 +85,9 @@ extern "C" { #define APR_FOPEN_SPARSE 0x08000 /**< Platform dependent flag to enable * sparse file support, see WARNING below */ +#define APR_FOPEN_NONBLOCK 0x40000 /**< Platform dependent flag to enable + * non blocking file io */ + /* backcompat */ #define APR_READ APR_FOPEN_READ /**< @deprecated @see APR_FOPEN_READ */ @@ -97,17 +105,19 @@ extern "C" { #define APR_SENDFILE_ENABLED APR_FOPEN_SENDFILE_ENABLED /**< @deprecated @see APR_FOPEN_SENDFILE_ENABLED */ #define APR_LARGEFILE APR_FOPEN_LARGEFILE /**< @deprecated @see APR_FOPEN_LARGEFILE */ -/** @warning APR_FOPEN_LARGEFILE flag only has effect on some +/** @def APR_FOPEN_LARGEFILE + * @warning APR_FOPEN_LARGEFILE flag only has effect on some * platforms where sizeof(apr_off_t) == 4. Where implemented, it * allows opening and writing to a file which exceeds the size which * can be represented by apr_off_t (2 gigabytes). When a file's size * does exceed 2Gb, apr_file_info_get() will fail with an error on the * descriptor, likewise apr_stat()/apr_lstat() will fail on the - * filename. apr_dir_read() will fail with APR_INCOMPLETE on a + * filename. apr_dir_read() will fail with #APR_INCOMPLETE on a * directory entry for a large file depending on the particular * APR_FINFO_* flags. Generally, it is not recommended to use this * flag. * + * @def APR_FOPEN_SPARSE * @warning APR_FOPEN_SPARSE may, depending on platform, convert a * normal file to a sparse file. Some applications may be unable * to decipher a sparse file, so it's critical that the sparse file @@ -117,6 +127,10 @@ extern "C" { * if it was previously created and written without the sparse flag. * On platforms which do not understand, or on file systems which * cannot handle sparse files, the flag is ignored by apr_file_open(). + * + * @def APR_FOPEN_NONBLOCK + * @warning APR_FOPEN_NONBLOCK is not implemented on all platforms. + * Callers should be prepared for it to fail with #APR_ENOTIMPL. */ /** @} */ @@ -200,33 +214,34 @@ typedef struct apr_file_t apr_file_t; * @param newf The opened file descriptor. * @param fname The full path to the file (using / on all systems) * @param flag Or'ed value of: - *
- *         APR_READ              open for reading
- *         APR_WRITE             open for writing
- *         APR_CREATE            create the file if not there
- *         APR_APPEND            file ptr is set to end prior to all writes
- *         APR_TRUNCATE          set length to zero if file exists
- *         APR_BINARY            not a text file (This flag is ignored on 
- *                               UNIX because it has no meaning)
- *         APR_BUFFERED          buffer the data.  Default is non-buffered
- *         APR_EXCL              return error if APR_CREATE and file exists
- *         APR_DELONCLOSE        delete the file after closing.
- *         APR_XTHREAD           Platform dependent tag to open the file
+ * @li #APR_FOPEN_READ           open for reading
+ * @li #APR_FOPEN_WRITE          open for writing
+ * @li #APR_FOPEN_CREATE         create the file if not there
+ * @li #APR_FOPEN_APPEND         file ptr is set to end prior to all writes
+ * @li #APR_FOPEN_TRUNCATE       set length to zero if file exists
+ * @li #APR_FOPEN_BINARY         not a text file
+ * @li #APR_FOPEN_BUFFERED       buffer the data.  Default is non-buffered
+ * @li #APR_FOPEN_EXCL           return error if #APR_FOPEN_CREATE and file exists
+ * @li #APR_FOPEN_DELONCLOSE     delete the file after closing
+ * @li #APR_FOPEN_XTHREAD        Platform dependent tag to open the file
  *                               for use across multiple threads
- *         APR_SHARELOCK         Platform dependent support for higher
+ * @li #APR_FOPEN_SHARELOCK      Platform dependent support for higher
  *                               level locked read/write access to support
  *                               writes across process/machines
- *         APR_FILE_NOCLEANUP    Do not register a cleanup with the pool 
- *                               passed in on the pool argument (see below).
- *                               The apr_os_file_t handle in apr_file_t will not
- *                               be closed when the pool is destroyed.
- *         APR_SENDFILE_ENABLED  Open with appropriate platform semantics
+ * @li #APR_FOPEN_NOCLEANUP      Do not register a cleanup with the pool 
+ *                               passed in on the @a pool argument (see below)
+ * @li #APR_FOPEN_SENDFILE_ENABLED  Open with appropriate platform semantics
  *                               for sendfile operations.  Advisory only,
- *                               apr_socket_sendfile does not check this flag.
- * 
+ * apr_socket_sendfile does not check this flag + * @li #APR_FOPEN_LARGEFILE Platform dependent flag to enable large file + * support, see WARNING below + * @li #APR_FOPEN_SPARSE Platform dependent flag to enable sparse file + * support, see WARNING below + * @li #APR_FOPEN_NONBLOCK Platform dependent flag to enable + * non blocking file io * @param perm Access permissions for file. * @param pool The pool to use. - * @remark If perm is APR_OS_DEFAULT and the file is being created, + * @remark If perm is #APR_FPROT_OS_DEFAULT and the file is being created, * appropriate default permissions will be used. * @remark By default, the returned file descriptor will not be * inherited by child processes created by apr_proc_create(). This @@ -279,7 +294,7 @@ APR_DECLARE(apr_status_t) apr_file_link(const char *from_path, * @param to_path The full path to the new file (using / on all systems) * @param perms Access permissions for the new file if it is created. * In place of the usual or'd combination of file permissions, the - * value APR_FILE_SOURCE_PERMS may be given, in which case the source + * value #APR_FPROT_FILE_SOURCE_PERMS may be given, in which case the source * file's permissions are copied. * @param pool The pool to use. * @remark The new file does not need to exist, it will be created if required. @@ -296,7 +311,7 @@ APR_DECLARE(apr_status_t) apr_file_copy(const char *from_path, * @param to_path The full path to the destination file (use / on all systems) * @param perms Access permissions for the destination file if it is created. * In place of the usual or'd combination of file permissions, the - * value APR_FILE_SOURCE_PERMS may be given, in which case the source + * value #APR_FPROT_FILE_SOURCE_PERMS may be given, in which case the source * file's permissions are copied. * @param pool The pool to use. * @remark The new file does not need to exist, it will be created if required. @@ -309,7 +324,7 @@ APR_DECLARE(apr_status_t) apr_file_append(const char *from_path, /** * Are we at the end of the file * @param fptr The apr file we are testing. - * @remark Returns APR_EOF if we are at the end of file, APR_SUCCESS otherwise. + * @remark Returns #APR_EOF if we are at the end of file, #APR_SUCCESS otherwise. */ APR_DECLARE(apr_status_t) apr_file_eof(apr_file_t *fptr); @@ -336,7 +351,7 @@ APR_DECLARE(apr_status_t) apr_file_open_stderr(apr_file_t **thefile, * @param thefile The apr file to use as stdout. * @param pool The pool to allocate the file out of. * - * @remark See remarks for apr_file_open_stderr. + * @remark See remarks for apr_file_open_stderr(). */ APR_DECLARE(apr_status_t) apr_file_open_stdout(apr_file_t **thefile, apr_pool_t *pool); @@ -346,7 +361,7 @@ APR_DECLARE(apr_status_t) apr_file_open_stdout(apr_file_t **thefile, * @param thefile The apr file to use as stdin. * @param pool The pool to allocate the file out of. * - * @remark See remarks for apr_file_open_stderr. + * @remark See remarks for apr_file_open_stderr(). */ APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile, apr_pool_t *pool); @@ -354,13 +369,19 @@ APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile, /** * open standard error as an apr file pointer, with flags. * @param thefile The apr file to use as stderr. - * @param flags The flags to open the file with. Only the APR_EXCL, - * APR_BUFFERED, APR_XTHREAD, APR_SHARELOCK, - * APR_SENDFILE_ENABLED and APR_LARGEFILE flags should - * be used. The APR_WRITE flag will be set unconditionally. + * @param flags The flags to open the file with. Only the + * @li #APR_FOPEN_EXCL + * @li #APR_FOPEN_BUFFERED + * @li #APR_FOPEN_XTHREAD + * @li #APR_FOPEN_SHARELOCK + * @li #APR_FOPEN_SENDFILE_ENABLED + * @li #APR_FOPEN_LARGEFILE + * + * flags should be used. The #APR_FOPEN_WRITE flag will + * be set unconditionally. * @param pool The pool to allocate the file out of. * - * @remark See remarks for apr_file_open_stderr. + * @remark See remarks for apr_file_open_stderr(). */ APR_DECLARE(apr_status_t) apr_file_open_flags_stderr(apr_file_t **thefile, apr_int32_t flags, @@ -369,13 +390,19 @@ APR_DECLARE(apr_status_t) apr_file_open_flags_stderr(apr_file_t **thefile, /** * open standard output as an apr file pointer, with flags. * @param thefile The apr file to use as stdout. - * @param flags The flags to open the file with. Only the APR_EXCL, - * APR_BUFFERED, APR_XTHREAD, APR_SHARELOCK, - * APR_SENDFILE_ENABLED and APR_LARGEFILE flags should - * be used. The APR_WRITE flag will be set unconditionally. + * @param flags The flags to open the file with. Only the + * @li #APR_FOPEN_EXCL + * @li #APR_FOPEN_BUFFERED + * @li #APR_FOPEN_XTHREAD + * @li #APR_FOPEN_SHARELOCK + * @li #APR_FOPEN_SENDFILE_ENABLED + * @li #APR_FOPEN_LARGEFILE + * + * flags should be used. The #APR_FOPEN_WRITE flag will + * be set unconditionally. * @param pool The pool to allocate the file out of. * - * @remark See remarks for apr_file_open_stderr. + * @remark See remarks for apr_file_open_stderr(). */ APR_DECLARE(apr_status_t) apr_file_open_flags_stdout(apr_file_t **thefile, apr_int32_t flags, @@ -384,13 +411,19 @@ APR_DECLARE(apr_status_t) apr_file_open_flags_stdout(apr_file_t **thefile, /** * open standard input as an apr file pointer, with flags. * @param thefile The apr file to use as stdin. - * @param flags The flags to open the file with. Only the APR_EXCL, - * APR_BUFFERED, APR_XTHREAD, APR_SHARELOCK, - * APR_SENDFILE_ENABLED and APR_LARGEFILE flags should - * be used. The APR_READ flag will be set unconditionally. + * @param flags The flags to open the file with. Only the + * @li #APR_FOPEN_EXCL + * @li #APR_FOPEN_BUFFERED + * @li #APR_FOPEN_XTHREAD + * @li #APR_FOPEN_SHARELOCK + * @li #APR_FOPEN_SENDFILE_ENABLED + * @li #APR_FOPEN_LARGEFILE + * + * flags should be used. The #APR_FOPEN_WRITE flag will + * be set unconditionally. * @param pool The pool to allocate the file out of. * - * @remark See remarks for apr_file_open_stderr. + * @remark See remarks for apr_file_open_stderr(). */ APR_DECLARE(apr_status_t) apr_file_open_flags_stdin(apr_file_t **thefile, apr_int32_t flags, @@ -403,15 +436,15 @@ APR_DECLARE(apr_status_t) apr_file_open_flags_stdin(apr_file_t **thefile, * @param nbytes On entry, the number of bytes to read; on exit, the number * of bytes read. * - * @remark apr_file_read will read up to the specified number of + * @remark apr_file_read() will read up to the specified number of * bytes, but never more. If there isn't enough data to fill that * number of bytes, all of the available data is read. The third * argument is modified to reflect the number of bytes read. If a * char was put back into the stream via ungetc, it will be the first * character returned. * - * @remark It is not possible for both bytes to be read and an APR_EOF - * or other error to be returned. APR_EINTR is never returned. + * @remark It is not possible for both bytes to be read and an #APR_EOF + * or other error to be returned. #APR_EINTR is never returned. */ APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf, apr_size_t *nbytes); @@ -423,13 +456,13 @@ APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf, * @param nbytes On entry, the number of bytes to write; on exit, the number * of bytes written. * - * @remark apr_file_write will write up to the specified number of + * @remark apr_file_write() will write up to the specified number of * bytes, but never more. If the OS cannot write that many bytes, it * will write as many as it can. The third argument is modified to * reflect the * number of bytes written. * * @remark It is possible for both bytes to be written and an error to - * be returned. APR_EINTR is never returned. + * be returned. #APR_EINTR is never returned. */ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, apr_size_t *nbytes); @@ -439,14 +472,14 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, * @param thefile The file descriptor to write to. * @param vec The array from which to get the data to write to the file. * @param nvec The number of elements in the struct iovec array. This must - * be smaller than APR_MAX_IOVEC_SIZE. If it isn't, the function - * will fail with APR_EINVAL. + * be smaller than #APR_MAX_IOVEC_SIZE. If it isn't, the function + * will fail with #APR_EINVAL. * @param nbytes The number of bytes written. * * @remark It is possible for both bytes to be written and an error to - * be returned. APR_EINTR is never returned. + * be returned. #APR_EINTR is never returned. * - * @remark apr_file_writev is available even if the underlying + * @remark apr_file_writev() is available even if the underlying * operating system doesn't provide writev(). */ APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile, @@ -461,7 +494,7 @@ APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile, * @param nbytes The number of bytes to read. * @param bytes_read If non-NULL, this will contain the number of bytes read. * - * @remark apr_file_read will read up to the specified number of + * @remark apr_file_read_full() will read up to the specified number of * bytes, but never more. If there isn't enough data to fill that * number of bytes, then the process/thread will block until it is * available or EOF is reached. If a char was put back into the @@ -471,7 +504,7 @@ APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile, * returned. And if *bytes_read is less than nbytes, an accompanying * error is _always_ returned. * - * @remark APR_EINTR is never returned. + * @remark #APR_EINTR is never returned. */ APR_DECLARE(apr_status_t) apr_file_read_full(apr_file_t *thefile, void *buf, apr_size_t nbytes, @@ -485,7 +518,7 @@ APR_DECLARE(apr_status_t) apr_file_read_full(apr_file_t *thefile, void *buf, * @param nbytes The number of bytes to write. * @param bytes_written If non-NULL, set to the number of bytes written. * - * @remark apr_file_write will write up to the specified number of + * @remark apr_file_write_full() will write up to the specified number of * bytes, but never more. If the OS cannot write that many bytes, the * process/thread will block until they can be written. Exceptional * error such as "out of space" or "pipe closed" will terminate with @@ -495,7 +528,7 @@ APR_DECLARE(apr_status_t) apr_file_read_full(apr_file_t *thefile, void *buf, * be returned. And if *bytes_written is less than nbytes, an * accompanying error is _always_ returned. * - * @remark APR_EINTR is never returned. + * @remark #APR_EINTR is never returned. */ APR_DECLARE(apr_status_t) apr_file_write_full(apr_file_t *thefile, const void *buf, @@ -509,11 +542,11 @@ APR_DECLARE(apr_status_t) apr_file_write_full(apr_file_t *thefile, * @param thefile The file descriptor to write to. * @param vec The array from which to get the data to write to the file. * @param nvec The number of elements in the struct iovec array. This must - * be smaller than APR_MAX_IOVEC_SIZE. If it isn't, the function - * will fail with APR_EINVAL. + * be smaller than #APR_MAX_IOVEC_SIZE. If it isn't, the function + * will fail with #APR_EINVAL. * @param nbytes The number of bytes written. * - * @remark apr_file_writev_full is available even if the underlying + * @remark apr_file_writev_full() is available even if the underlying * operating system doesn't provide writev(). */ APR_DECLARE(apr_status_t) apr_file_writev_full(apr_file_t *thefile, @@ -621,7 +654,7 @@ APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file, * @param buffer The buffer * @param bufsize The size of the buffer * @remark It is possible to add a buffer to previously unbuffered - * file handles, the APR_BUFFERED flag will be added to + * file handles, the #APR_FOPEN_BUFFERED flag will be added to * the file handle's flags. Likewise, with buffer=NULL and * bufsize=0 arguments it is possible to make a previously * buffered file handle unbuffered. @@ -640,11 +673,9 @@ APR_DECLARE(apr_size_t) apr_file_buffer_size_get(apr_file_t *thefile); * Move the read/write file offset to a specified byte within a file. * @param thefile The file descriptor * @param where How to move the pointer, one of: - *
- *            APR_SET  --  set the offset to offset
- *            APR_CUR  --  add the offset to the current position 
- *            APR_END  --  add the offset to the current file size 
- * 
+ * @li #APR_SET -- set the offset to offset + * @li #APR_CUR -- add the offset to the current position + * @li #APR_END -- add the offset to the current file size * @param offset The offset to move the pointer to. * @remark The third argument is modified to be the offset the pointer was actually moved to. @@ -664,7 +695,7 @@ APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile, * @bug Some platforms cannot toggle between blocking and nonblocking, * and when passing a pipe as a standard handle to an application which * does not expect it, a non-blocking stream will fluxor the client app. - * @deprecated @see apr_file_pipe_create_ex + * @deprecated @see apr_file_pipe_create_ex() */ APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out, @@ -675,20 +706,18 @@ APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, * @param in The newly created pipe's file for reading. * @param out The newly created pipe's file for writing. * @param blocking one of these values defined in apr_thread_proc.h; + * @li #APR_FULL_BLOCK + * @li #APR_READ_BLOCK + * @li #APR_WRITE_BLOCK + * @li #APR_FULL_NONBLOCK * @param pool The pool to operate on. - *
- *       APR_FULL_BLOCK
- *       APR_READ_BLOCK
- *       APR_WRITE_BLOCK
- *       APR_FULL_NONBLOCK
- * 
* @remark By default, the returned file descriptors will be inherited * by child processes created using apr_proc_create(). This can be * changed using apr_file_inherit_unset(). * @remark Some platforms cannot toggle between blocking and nonblocking, * and when passing a pipe as a standard handle to an application which * does not expect it, a non-blocking stream will fluxor the client app. - * Use this function rather than apr_file_pipe_create to create pipes + * Use this function rather than apr_file_pipe_create() to create pipes * where one or both ends require non-blocking semantics. */ APR_DECLARE(apr_status_t) apr_file_pipe_create_ex(apr_file_t **in, @@ -789,11 +818,11 @@ APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr, * @param perms The permission bits to apply to the file. * * @warning Some platforms may not be able to apply all of the - * available permission bits; APR_INCOMPLETE will be returned if some + * available permission bits; #APR_INCOMPLETE will be returned if some * permissions are specified which could not be set. * * @warning Platforms which do not implement this feature will return - * APR_ENOTIMPL. + * #APR_ENOTIMPL. */ APR_DECLARE(apr_status_t) apr_file_perms_set(const char *fname, apr_fileperms_t perms); @@ -802,11 +831,9 @@ APR_DECLARE(apr_status_t) apr_file_perms_set(const char *fname, * Set attributes of the specified file. * @param fname The full path to the file (using / on all systems) * @param attributes Or'd combination of - *
- *            APR_FILE_ATTR_READONLY   - make the file readonly
- *            APR_FILE_ATTR_EXECUTABLE - make the file executable
- *            APR_FILE_ATTR_HIDDEN     - make the file hidden
- * 
+ * @li #APR_FILE_ATTR_READONLY - make the file readonly + * @li #APR_FILE_ATTR_EXECUTABLE - make the file executable + * @li #APR_FILE_ATTR_HIDDEN - make the file hidden * @param attr_mask Mask of valid bits in attributes. * @param pool the pool to use. * @remark This function should be used in preference to explicit manipulation @@ -814,7 +841,7 @@ APR_DECLARE(apr_status_t) apr_file_perms_set(const char *fname, * attributes are platform specific and may involve more than simply * setting permission bits. * @warning Platforms which do not implement this feature will return - * APR_ENOTIMPL. + * #APR_ENOTIMPL. */ APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname, apr_fileattrs_t attributes, @@ -827,7 +854,7 @@ APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname, * @param mtime The mtime to apply to the file. * @param pool The pool to use. * @warning Platforms which do not implement this feature will return - * APR_ENOTIMPL. + * #APR_ENOTIMPL. */ APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname, apr_time_t mtime, @@ -865,7 +892,7 @@ APR_DECLARE(apr_status_t) apr_dir_remove(const char *path, apr_pool_t *pool); /** * get the specified file's stats. * @param finfo Where to store the information about the file. - * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values + * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_* values * @param thefile The file to get information about. */ APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo, @@ -910,7 +937,8 @@ APR_DECLARE_INHERIT_UNSET(file); * @param templ The template to use when creating a temp file. * @param flags The flags to open the file with. If this is zero, * the file is opened with - * APR_CREATE | APR_READ | APR_WRITE | APR_EXCL | APR_DELONCLOSE + * #APR_FOPEN_CREATE | #APR_FOPEN_READ | #APR_FOPEN_WRITE | + * #APR_FOPEN_EXCL | #APR_FOPEN_DELONCLOSE * @param p The pool to allocate the file out of. * @remark * This function generates a unique temporary file name from template. diff --git a/contrib/apr/include/apr_fnmatch.h b/contrib/apr/include/apr_fnmatch.h index ef6d0b25086..e8f6b03cfbc 100644 --- a/contrib/apr/include/apr_fnmatch.h +++ b/contrib/apr/include/apr_fnmatch.h @@ -60,9 +60,7 @@ extern "C" { #define APR_FNM_NOESCAPE 0x01 /**< Disable backslash escaping. */ #define APR_FNM_PATHNAME 0x02 /**< Slash must be matched by slash. */ #define APR_FNM_PERIOD 0x04 /**< Period must be matched by period. */ -#define APR_FNM_CASE_BLIND 0x08 /**< Compare characters case-insensitively. - * @remark This flag is an Apache addition - */ +#define APR_FNM_CASE_BLIND 0x08 /**< Compare characters case-insensitively. */ /** * Try to match the string to the given pattern, return APR_SUCCESS if @@ -130,13 +128,19 @@ APR_DECLARE(apr_status_t) apr_fnmatch(const char *pattern, APR_DECLARE(int) apr_fnmatch_test(const char *pattern); /** - * Find all files that match a specified pattern. - * @param pattern The pattern to use for finding files. + * Find all files that match a specified pattern in a directory. + * @param dir_pattern The pattern to use for finding files, appended + * to the search directory. The pattern is anything following the + * final forward or backward slash in the parameter. If no slash + * is found, the current directory is searched. * @param result Array to use when storing the results * @param p The pool to use. - * @return non-zero if pattern has any glob characters in it + * @return APR_SUCCESS if no processing errors occurred, APR error + * code otherwise + * @remark The returned array may be empty even if APR_SUCCESS was + * returned. */ -APR_DECLARE(apr_status_t) apr_match_glob(const char *pattern, +APR_DECLARE(apr_status_t) apr_match_glob(const char *dir_pattern, apr_array_header_t **result, apr_pool_t *p); diff --git a/contrib/apr/include/apr_hash.h b/contrib/apr/include/apr_hash.h index 8e48c7ecf15..37d972f9dd7 100644 --- a/contrib/apr/include/apr_hash.h +++ b/contrib/apr/include/apr_hash.h @@ -166,6 +166,27 @@ APR_DECLARE(apr_hash_index_t *) apr_hash_next(apr_hash_index_t *hi); APR_DECLARE(void) apr_hash_this(apr_hash_index_t *hi, const void **key, apr_ssize_t *klen, void **val); +/** + * Get the current entry's key from the iteration state. + * @param hi The iteration state + * @return The pointer to the key + */ +APR_DECLARE(const void*) apr_hash_this_key(apr_hash_index_t *hi); + +/** + * Get the current entry's key length from the iteration state. + * @param hi The iteration state + * @return The key length + */ +APR_DECLARE(apr_ssize_t) apr_hash_this_key_len(apr_hash_index_t *hi); + +/** + * Get the current entry's value from the iteration state. + * @param hi The iteration state + * @return The pointer to the value + */ +APR_DECLARE(void*) apr_hash_this_val(apr_hash_index_t *hi); + /** * Get the number of key/value pairs in the hash table. * @param ht The hash table diff --git a/contrib/apr/include/apr_inherit.h b/contrib/apr/include/apr_inherit.h index b7f7480f1ff..b9fe56fe449 100644 --- a/contrib/apr/include/apr_inherit.h +++ b/contrib/apr/include/apr_inherit.h @@ -28,7 +28,7 @@ * Prototype for type-specific declarations of apr_foo_inherit_set * functions. * @remark Doxygen unwraps this macro (via doxygen.conf) to provide - * actual help for each specific occurance of apr_foo_inherit_set. + * actual help for each specific occurrence of apr_foo_inherit_set. * @remark the linkage is specified for APR. It would be possible to expand * the macros to support other linkages. */ @@ -40,7 +40,7 @@ * Prototype for type-specific declarations of apr_foo_inherit_unset * functions. * @remark Doxygen unwraps this macro (via doxygen.conf) to provide - * actual help for each specific occurance of apr_foo_inherit_unset. + * actual help for each specific occurrence of apr_foo_inherit_unset. * @remark the linkage is specified for APR. It would be possible to expand * the macros to support other linkages. */ diff --git a/contrib/apr/include/apr_lib.h b/contrib/apr/include/apr_lib.h index 8c0fea74bd8..466e8185747 100644 --- a/contrib/apr/include/apr_lib.h +++ b/contrib/apr/include/apr_lib.h @@ -111,19 +111,19 @@ APR_DECLARE(const char *) apr_filepath_name_get(const char *pathname); *
  * The extensions are:
  *
- * %%pA	takes a struct in_addr *, and prints it as a.b.c.d
- * %%pI	takes an apr_sockaddr_t * and prints it as a.b.c.d:port or
- *      [ipv6-address]:port
- * %%pT takes an apr_os_thread_t * and prints it in decimal
- *      ('0' is printed if !APR_HAS_THREADS)
- * %%pt takes an apr_os_thread_t * and prints it in hexadecimal
- *      ('0' is printed if !APR_HAS_THREADS)
- * %%pm takes an apr_status_t * and prints the appropriate error
- *      string (from apr_strerror) corresponding to that error code.
- * %%pp takes a void * and outputs it in hex
- * %%pB takes a apr_uint32_t * as bytes and outputs it's apr_strfsize
- * %%pF same as above, but takes a apr_off_t *
- * %%pS same as above, but takes a apr_size_t *
+ * - %%pA takes a struct in_addr *, and prints it as a.b.c.d
+ * - %%pI takes an apr_sockaddr_t * and prints it as a.b.c.d:port or
+ * \[ipv6-address\]:port
+ * - %%pT takes an apr_os_thread_t * and prints it in decimal
+ * ('0' is printed if !APR_HAS_THREADS)
+ * - %%pt takes an apr_os_thread_t * and prints it in hexadecimal
+ * ('0' is printed if !APR_HAS_THREADS)
+ * - %%pm takes an apr_status_t * and prints the appropriate error
+ * string (from apr_strerror) corresponding to that error code.
+ * - %%pp takes a void * and outputs it in hex
+ * - %%pB takes a apr_uint32_t * as bytes and outputs it's apr_strfsize
+ * - %%pF same as above, but takes a apr_off_t *
+ * - %%pS same as above, but takes a apr_size_t *
  *
  * %%pA, %%pI, %%pT, %%pp are available from APR 1.0.0 onwards (and in 0.9.x).
  * %%pt is only available from APR 1.2.0 onwards.
diff --git a/contrib/apr/include/apr_mmap.h b/contrib/apr/include/apr_mmap.h
index 77d697f5b55..c14de1928ae 100644
--- a/contrib/apr/include/apr_mmap.h
+++ b/contrib/apr/include/apr_mmap.h
@@ -120,7 +120,7 @@ struct apr_mmap_t {
 /** 
  * Create a new mmap'ed file out of an existing APR file.
  * @param newmmap The newly created mmap'ed file.
- * @param file The file turn into an mmap.
+ * @param file The file to turn into an mmap.
  * @param offset The offset into the file to start the data pointer at.
  * @param size The size of the file
  * @param flag bit-wise or of:
diff --git a/contrib/apr/include/apr_network_io.h b/contrib/apr/include/apr_network_io.h
index 8b9209efd70..0d34a8458e4 100644
--- a/contrib/apr/include/apr_network_io.h
+++ b/contrib/apr/include/apr_network_io.h
@@ -99,6 +99,8 @@ extern "C" {
                                     * until data is available.
                                     * @see apr_socket_accept_filter
                                     */
+#define APR_SO_BROADCAST     65536 /**< Allow broadcast
+                                    */
 
 /** @} */
 
@@ -278,6 +280,9 @@ struct apr_hdtr_t {
  * @param type The type of the socket (e.g., SOCK_STREAM).
  * @param protocol The protocol of the socket (e.g., APR_PROTO_TCP).
  * @param cont The pool for the apr_socket_t and associated storage.
+ * @note The pool will be used by various functions that operate on the
+ *       socket. The caller must ensure that it is not used by other threads
+ *       at the same time.
  */
 APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new_sock, 
                                             int family, int type,
@@ -333,6 +338,9 @@ APR_DECLARE(apr_status_t) apr_socket_listen(apr_socket_t *sock,
  *                 be used for all future communication.
  * @param sock The socket we are listening on.
  * @param connection_pool The pool for the new socket.
+ * @note The pool will be used by various functions that operate on the
+ *       socket. The caller must ensure that it is not used by other threads
+ *       at the same time.
  */
 APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new_sock, 
                                             apr_socket_t *sock,
@@ -397,6 +405,8 @@ APR_DECLARE(apr_status_t) apr_sockaddr_info_get(apr_sockaddr_t **sa,
  * @param hostname The hostname.
  * @param sa The apr_sockaddr_t.
  * @param flags Special processing flags.
+ * @remark Results can vary significantly between platforms
+ * when processing wildcard socket addresses.
  */
 APR_DECLARE(apr_status_t) apr_getnameinfo(char **hostname,
                                           apr_sockaddr_t *sa,
@@ -489,7 +499,7 @@ APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf,
                                           apr_size_t *len);
 
 /**
- * Send multiple packets of data over a network.
+ * Send multiple buffers over a network.
  * @param sock The socket to send the data over.
  * @param vec The array of iovec structs containing the data to send 
  * @param nvec The number of iovec structs in the array
@@ -499,7 +509,7 @@ APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf,
  * This functions acts like a blocking write by default.  To change 
  * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
  * socket option.
- * The number of bytes actually sent is stored in argument 3.
+ * The number of bytes actually sent is stored in argument 4.
  *
  * It is possible for both bytes to be sent and an error to be returned.
  *
@@ -671,7 +681,7 @@ APR_DECLARE(apr_status_t) apr_socket_atmark(apr_socket_t *sock,
 
 /**
  * Return an address associated with a socket; either the address to
- * which the socket is bound locally or the the address of the peer
+ * which the socket is bound locally or the address of the peer
  * to which the socket is connected.
  * @param sa The returned apr_sockaddr_t.
  * @param which Whether to retrieve the local or remote address
@@ -712,6 +722,16 @@ APR_DECLARE(apr_status_t) apr_sockaddr_ip_getbuf(char *buf, apr_size_t buflen,
 APR_DECLARE(int) apr_sockaddr_equal(const apr_sockaddr_t *addr1,
                                     const apr_sockaddr_t *addr2);
 
+/**
+ * See if the IP address in an APR socket address refers to the wildcard
+ * address for the protocol family (e.g., INADDR_ANY for IPv4).
+ *
+ * @param addr The APR socket address to examine.
+ * @remark The return value will be non-zero if the address is
+ * initialized and is the wildcard address.
+ */
+APR_DECLARE(int) apr_sockaddr_is_wildcard(const apr_sockaddr_t *addr);
+
 /**
 * Return the type of the socket.
 * @param sock The socket to query.
diff --git a/contrib/apr/include/apr_poll.h b/contrib/apr/include/apr_poll.h
index 3e8d092b667..1381ddd1383 100644
--- a/contrib/apr/include/apr_poll.h
+++ b/contrib/apr/include/apr_poll.h
@@ -42,7 +42,9 @@ extern "C" {
  */
 
 /**
- * Poll options
+ * @defgroup pollopts Poll options
+ * @ingroup apr_poll
+ * @{
  */
 #define APR_POLLIN    0x001     /**< Can read without blocking */
 #define APR_POLLPRI   0x002     /**< Priority data available */
@@ -50,9 +52,12 @@ extern "C" {
 #define APR_POLLERR   0x010     /**< Pending error */
 #define APR_POLLHUP   0x020     /**< Hangup occurred */
 #define APR_POLLNVAL  0x040     /**< Descriptor invalid */
+/** @} */
 
 /**
- * Pollset Flags
+ * @defgroup pollflags Pollset Flags
+ * @ingroup apr_poll
+ * @{
  */
 #define APR_POLLSET_THREADSAFE 0x001 /**< Adding or removing a descriptor is
                                       * thread-safe
@@ -67,6 +72,7 @@ extern "C" {
                                       * the specified non-default method cannot be
                                       * used
                                       */
+/** @} */
 
 /**
  * Pollset Methods
@@ -77,7 +83,8 @@ typedef enum {
     APR_POLLSET_KQUEUE,         /**< Poll uses kqueue method */
     APR_POLLSET_PORT,           /**< Poll uses Solaris event port method */
     APR_POLLSET_EPOLL,          /**< Poll uses epoll method */
-    APR_POLLSET_POLL            /**< Poll uses poll method */
+    APR_POLLSET_POLL,           /**< Poll uses poll method */
+    APR_POLLSET_AIO_MSGQ        /**< Poll uses z/OS asio method */
 } apr_pollset_method_e;
 
 /** Used in apr_pollfd_t to determine what the apr_descriptor is */
@@ -131,7 +138,7 @@ typedef struct apr_pollset_t apr_pollset_t;
  * @remark If flags contains APR_POLLSET_WAKEABLE, then a pollset is
  *         created with an additional internal pipe object used for the
  *         apr_pollset_wakeup() call. The actual size of pollset is
- *         in that case size + 1. This feature is only supported on some
+ *         in that case @a size + 1. This feature is only supported on some
  *         platforms; the apr_pollset_create() call will fail with
  *         APR_ENOTIMPL on platforms where it is not supported.
  * @remark If flags contains APR_POLLSET_NOCOPY, then the apr_pollfd_t
@@ -226,6 +233,7 @@ APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset,
  * Remove a descriptor from a pollset
  * @param pollset The pollset from which to remove the descriptor
  * @param descriptor The descriptor to remove
+ * @remark If the descriptor is not found, APR_NOTFOUND is returned.
  * @remark If the pollset has been created with APR_POLLSET_THREADSAFE
  *         and thread T1 is blocked in a call to apr_pollset_poll() for
  *         this same pollset that is being modified via apr_pollset_remove()
@@ -259,8 +267,6 @@ APR_DECLARE(apr_status_t) apr_pollset_remove(apr_pollset_t *pollset,
  * @remark Multiple signalled conditions for the same descriptor may be reported
  *         in one or more returned apr_pollfd_t structures, depending on the
  *         implementation.
- * @bug With versions 1.4.2 and prior on Windows, a call with no descriptors
- *      and timeout will return immediately with the wrong error code.
  */
 APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset,
                                            apr_interval_time_t timeout,
@@ -290,8 +296,6 @@ APR_DECLARE(apr_status_t) apr_pollset_wakeup(apr_pollset_t *pollset);
  *         descriptor has been signalled or the timeout has expired. 
  * @remark The rtnevents field in the apr_pollfd_t array will only be filled-
  *         in if the return value is APR_SUCCESS.
- * @bug With versions 1.4.2 and prior on Windows, a call with no descriptors
- *      and timeout will return immediately with the wrong error code.
  */
 APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t numsock,
                                    apr_int32_t *nsds, 
@@ -309,7 +313,7 @@ APR_DECLARE(const char *) apr_pollset_method_name(apr_pollset_t *pollset);
  */
 APR_DECLARE(const char *) apr_poll_method_defname(void);
 
-/** Opaque structure used for pollset API */
+/** Opaque structure used for pollcb API */
 typedef struct apr_pollcb_t apr_pollcb_t;
 
 /**
@@ -397,8 +401,6 @@ typedef apr_status_t (*apr_pollcb_cb_t)(void *baton, apr_pollfd_t *descriptor);
  * @remark Multiple signalled conditions for the same descriptor may be reported
  *         in one or more calls to the callback function, depending on the
  *         implementation.
- * @bug With versions 1.4.2 and prior on Windows, a call with no descriptors
- *      and timeout will return immediately with the wrong error code.
  */
 APR_DECLARE(apr_status_t) apr_pollcb_poll(apr_pollcb_t *pollcb,
                                           apr_interval_time_t timeout,
diff --git a/contrib/apr/include/apr_pools.h b/contrib/apr/include/apr_pools.h
index 0f0b95e56ad..783c9c422bb 100644
--- a/contrib/apr/include/apr_pools.h
+++ b/contrib/apr/include/apr_pools.h
@@ -71,10 +71,10 @@ typedef struct apr_pool_t apr_pool_t;
  * 
  *    APR_POOL_DECLARE_ACCESSOR(file);
  * becomes:
- *    APR_DECLARE(apr_pool_t *) apr_file_pool_get(apr_file_t *ob);
+ *    APR_DECLARE(apr_pool_t *) apr_file_pool_get(const apr_file_t *thefile);
  * 
* @remark Doxygen unwraps this macro (via doxygen.conf) to provide - * actual help for each specific occurance of apr_foo_pool_get. + * actual help for each specific occurrence of apr_foo_pool_get. * @remark the linkage is specified for APR. It would be possible to expand * the macros to support other linkages. */ @@ -118,15 +118,15 @@ typedef struct apr_pool_t apr_pool_t; * * | | | | | x | | | | Pool owner checking. On each use of a * pool, check if the current thread is the - * pools owner. If not, abort(). In + * pool's owner. If not, abort(). In * combination with the verbose flag above, * it will output OWNER in such an event * prior to aborting. Use the debug * function apr_pool_owner_set() to switch - * a pools ownership. + * a pool's ownership. * * When no debug level was specified, assume general debug mode. - * If level 0 was specified, debugging is switched off + * If level 0 was specified, debugging is switched off. *
*/ #if defined(APR_POOL_DEBUG) @@ -212,12 +212,16 @@ APR_DECLARE(apr_status_t) apr_pool_create_core_ex(apr_pool_t **newpool, * @param newpool The pool we have just created. * @param abort_fn A function to use if the pool cannot allocate more memory. * @param allocator The allocator to use with the new pool. If NULL a - * new allocator will be crated with newpool as owner. + * new allocator will be created with the new pool as owner. * @remark An unmanaged pool is a special pool without a parent; it will * NOT be destroyed upon apr_terminate. It must be explicitly * destroyed by calling apr_pool_destroy, to prevent memory leaks. * Use of this function is discouraged, think twice about whether * you really really need it. + * @warning Any child cleanups registered against the new pool, or + * against sub-pools thereof, will not be executed during an + * invocation of apr_proc_create(), so resources created in an + * "unmanaged" pool hierarchy will leak to child processes. */ APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex(apr_pool_t **newpool, apr_abortfunc_t abort_fn, @@ -233,7 +237,7 @@ APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex(apr_pool_t **newpool, * @param file_line Where the function is called from. * This is usually APR_POOL__FILE_LINE__. * @remark Only available when APR_POOL_DEBUG is defined. - * Call this directly if you have you apr_pool_create_ex + * Call this directly if you have your apr_pool_create_ex * calls in a wrapper function and wish to override * the file_line argument to reflect the caller of * your wrapper function. If you do not have @@ -270,7 +274,7 @@ APR_DECLARE(apr_status_t) apr_pool_create_core_ex_debug(apr_pool_t **newpool, * @param file_line Where the function is called from. * This is usually APR_POOL__FILE_LINE__. * @remark Only available when APR_POOL_DEBUG is defined. - * Call this directly if you have you apr_pool_create_unmanaged_ex + * Call this directly if you have your apr_pool_create_unmanaged_ex * calls in a wrapper function and wish to override * the file_line argument to reflect the caller of * your wrapper function. If you do not have @@ -321,7 +325,7 @@ APR_DECLARE(apr_status_t) apr_pool_create(apr_pool_t **newpool, #endif /** - * Create a new pool. + * Create a new unmanaged pool. * @param newpool The pool we have just created. */ #if defined(DOXYGEN) @@ -366,7 +370,7 @@ APR_DECLARE(void) apr_pool_clear(apr_pool_t *p) __attribute__((nonnull(1))); * @param file_line Where the function is called from. * This is usually APR_POOL__FILE_LINE__. * @remark Only available when APR_POOL_DEBUG is defined. - * Call this directly if you have you apr_pool_clear + * Call this directly if you have your apr_pool_clear * calls in a wrapper function and wish to override * the file_line argument to reflect the caller of * your wrapper function. If you do not have @@ -396,7 +400,7 @@ APR_DECLARE(void) apr_pool_destroy(apr_pool_t *p) __attribute__((nonnull(1))); * @param file_line Where the function is called from. * This is usually APR_POOL__FILE_LINE__. * @remark Only available when APR_POOL_DEBUG is defined. - * Call this directly if you have you apr_pool_destroy + * Call this directly if you have your apr_pool_destroy * calls in a wrapper function and wish to override * the file_line argument to reflect the caller of * your wrapper function. If you do not have @@ -614,7 +618,7 @@ APR_DECLARE(apr_status_t) apr_pool_userdata_get(void **data, const char *key, /** * Register a function to be called when a pool is cleared or destroyed - * @param p The pool register the cleanup with + * @param p The pool to register the cleanup with * @param data The data to pass to the cleanup function. * @param plain_cleanup The function to call when the pool is cleared * or destroyed @@ -630,11 +634,11 @@ APR_DECLARE(void) apr_pool_cleanup_register( /** * Register a function to be called when a pool is cleared or destroyed. * - * Unlike apr_pool_cleanup_register which register a cleanup - * that is called AFTER all subpools are destroyed this function register - * a function that will be called before any of the subpool is destoryed. + * Unlike apr_pool_cleanup_register which registers a cleanup + * that is called AFTER all subpools are destroyed, this function registers + * a function that will be called before any of the subpools are destroyed. * - * @param p The pool register the cleanup with + * @param p The pool to register the cleanup with * @param data The data to pass to the cleanup function. * @param plain_cleanup The function to call when the pool is cleared * or destroyed diff --git a/contrib/apr/include/apr_shm.h b/contrib/apr/include/apr_shm.h index 2b1d50f6d49..49543bb0194 100644 --- a/contrib/apr/include/apr_shm.h +++ b/contrib/apr/include/apr_shm.h @@ -43,7 +43,8 @@ extern "C" { typedef struct apr_shm_t apr_shm_t; /** - * Create and make accessable a shared memory segment. + * Create and make accessible a shared memory segment with default + * properties. * @param m The shared memory structure to create. * @param reqsize The desired size of the segment. * @param filename The file to use for shared memory on platforms that @@ -70,6 +71,52 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, const char *filename, apr_pool_t *pool); +/** + * Special processing flags for apr_shm_create_ex() and apr_shm_attach_ex(). + */ +#define APR_SHM_NS_LOCAL 1 /* Create or attach to named shared memory + * segment in the "Local" namespace on + * Windows. (Ignored on other platforms.) + * By default, the "Global" namespace is + * used for privileged processes and the + * "Local" namespace is used otherwise. + */ +#define APR_SHM_NS_GLOBAL 2 /* Create or attach to named shared memory + * segment in the "Global" namespace on + * Windows. (Ignored on other platforms.) + */ + +/** + * Create and make accessible a shared memory segment with platform- + * specific processing. + * @param m The shared memory structure to create. + * @param reqsize The desired size of the segment. + * @param filename The file to use for shared memory on platforms that + * require it. + * @param pool the pool from which to allocate the shared memory + * structure. + * @param flags mask of APR_SHM_* (defined above) + * @remark A note about Anonymous vs. Named shared memory segments: + * Not all plaforms support anonymous shared memory segments, but in + * some cases it is prefered over other types of shared memory + * implementations. Passing a NULL 'file' parameter to this function + * will cause the subsystem to use anonymous shared memory segments. + * If such a system is not available, APR_ENOTIMPL is returned. + * @remark A note about allocation sizes: + * On some platforms it is necessary to store some metainformation + * about the segment within the actual segment. In order to supply + * the caller with the requested size it may be necessary for the + * implementation to request a slightly greater segment length + * from the subsystem. In all cases, the apr_shm_baseaddr_get() + * function will return the first usable byte of memory. + * + */ +APR_DECLARE(apr_status_t) apr_shm_create_ex(apr_shm_t **m, + apr_size_t reqsize, + const char *filename, + apr_pool_t *pool, + apr_int32_t flags); + /** * Remove named resource associated with a shared memory segment, * preventing attachments to the resource, but not destroying it. @@ -80,7 +127,7 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, * name-based shared memory segments, and will return APR_ENOTIMPL on * platforms without such support. Removing the file while the shm * is in use is not entirely portable, caller may use this to enhance - * obscurity of the resource, but be prepared for the the call to fail, + * obscurity of the resource, but be prepared for the call to fail, * and for concurrent attempts to create a resource of the same name * to also fail. The pool cleanup of apr_shm_create (apr_shm_destroy) * also removes the named resource. @@ -107,6 +154,21 @@ APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m, const char *filename, apr_pool_t *pool); +/** + * Attach to a shared memory segment that was created + * by another process, with platform-specific processing. + * @param m The shared memory structure to create. + * @param filename The file used to create the original segment. + * (This MUST match the original filename.) + * @param pool the pool from which to allocate the shared memory + * structure for this process. + * @param flags mask of APR_SHM_* (defined above) + */ +APR_DECLARE(apr_status_t) apr_shm_attach_ex(apr_shm_t **m, + const char *filename, + apr_pool_t *pool, + apr_int32_t flags); + /** * Detach from a shared memory segment without destroying it. * @param m The shared memory structure representing the segment diff --git a/contrib/apr/include/apr_skiplist.h b/contrib/apr/include/apr_skiplist.h new file mode 100644 index 00000000000..bc17efd95fa --- /dev/null +++ b/contrib/apr/include/apr_skiplist.h @@ -0,0 +1,259 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef APR_SKIPLIST_H +#define APR_SKIPLIST_H +/** + * @file apr_skiplist.h + * @brief APR skip list implementation + */ + +#include "apr.h" +#include "apr_portable.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * @defgroup apr_skiplist Skip list implementation + * Refer to http://en.wikipedia.org/wiki/Skip_list for information + * about the purpose of and ideas behind skip lists. + * @ingroup APR + * @{ + */ + +/** + * apr_skiplist_compare is the function type that must be implemented + * per object type that is used in a skip list for comparisons to maintain + * order + * */ +typedef int (*apr_skiplist_compare) (void *, void *); + +/** + * apr_skiplist_freefunc is the function type that must be implemented + * to handle elements as they are removed from a skip list. + */ +typedef void (*apr_skiplist_freefunc) (void *); + +/** Opaque structure used to represent the skip list */ +struct apr_skiplist; +/** Opaque structure used to represent the skip list */ +typedef struct apr_skiplist apr_skiplist; + +/** + * Opaque structure used to represent abstract nodes in the skip list + * (an abstraction above the raw elements which are collected in the + * skip list). + */ +struct apr_skiplistnode; +/** Opaque structure */ +typedef struct apr_skiplistnode apr_skiplistnode; + +/** + * Allocate memory using the same mechanism as the skip list. + * @param sl The skip list + * @param size The amount to allocate + * @remark If a pool was provided to apr_skiplist_init(), memory will + * be allocated from the pool or from a free list maintained with + * the skip list. Otherwise, memory will be allocated using the + * C standard library heap functions. + */ +APR_DECLARE(void *) apr_skiplist_alloc(apr_skiplist *sl, size_t size); + +/** + * Free memory using the same mechanism as the skip list. + * @param sl The skip list + * @param mem The object to free + * @remark If a pool was provided to apr_skiplist_init(), memory will + * be added to a free list maintained with the skip list and be available + * to operations on the skip list or to other calls to apr_skiplist_alloc(). + * Otherwise, memory will be freed using the C standard library heap + * functions. + */ +APR_DECLARE(void) apr_skiplist_free(apr_skiplist *sl, void *mem); + +/** + * Allocate a new skip list + * @param sl The pointer in which to return the newly created skip list + * @param p The pool from which to allocate the skip list (optional). + * @remark Unlike most APR functions, a pool is optional. If no pool + * is provided, the C standard library heap functions will be used instead. + */ +APR_DECLARE(apr_status_t) apr_skiplist_init(apr_skiplist **sl, apr_pool_t *p); + +/** + * Set the comparison functions to be used for searching the skip list. + * @param sl The skip list + * @param XXX1 FIXME + * @param XXX2 FIXME + * + * @remark If existing comparison functions are being replaced, the index + * will be replaced during this call. That is a potentially expensive + * operation. + */ +APR_DECLARE(void) apr_skiplist_set_compare(apr_skiplist *sl, apr_skiplist_compare XXX1, + apr_skiplist_compare XXX2); + +/** + * Set the indexing functions to the specified comparison functions and + * rebuild the index. + * @param sl The skip list + * @param XXX1 FIXME + * @param XXX2 FIXME + * + * @remark If an index already exists, it will not be replaced and the + * comparison functions will not be changed. + */ +APR_DECLARE(void) apr_skiplist_add_index(apr_skiplist *sl, apr_skiplist_compare XXX1, + apr_skiplist_compare XXX2); + +/** + * Return the list maintained by the skip list abstraction. + * @param sl The skip list + */ +APR_DECLARE(apr_skiplistnode *) apr_skiplist_getlist(apr_skiplist *sl); + +/** + * Return the next matching element in the skip list using the specified + * comparison function. + * @param sl The skip list + * @param data The value to search for + * @param iter A pointer to the returned skip list node representing the element + * found + * @param func The comparison function to use + */ +APR_DECLARE(void *) apr_skiplist_find_compare(apr_skiplist *sl, + void *data, + apr_skiplistnode **iter, + apr_skiplist_compare func); + +/** + * Return the next matching element in the skip list using the current comparison + * function. + * @param sl The skip list + * @param data The value to search for + * @param iter A pointer to the returned skip list node representing the element + * found + */ +APR_DECLARE(void *) apr_skiplist_find(apr_skiplist *sl, void *data, apr_skiplistnode **iter); + +/** + * Return the next element in the skip list. + * @param sl The skip list + * @param iter On entry, a pointer to the skip list node to start with; on return, + * a pointer to the skip list node representing the element returned + * @remark If iter points to a NULL value on entry, NULL will be returned. + */ +APR_DECLARE(void *) apr_skiplist_next(apr_skiplist *sl, apr_skiplistnode **iter); + +/** + * Return the previous element in the skip list. + * @param sl The skip list + * @param iter On entry, a pointer to the skip list node to start with; on return, + * a pointer to the skip list node representing the element returned + * @remark If iter points to a NULL value on entry, NULL will be returned. + */ +APR_DECLARE(void *) apr_skiplist_previous(apr_skiplist *sl, apr_skiplistnode **iter); + +/** + * Insert an element into the skip list using the specified comparison function. + * @param sl The skip list + * @param data The element to insert + * @param comp The comparison function to use for placement into the skip list + */ +APR_DECLARE(apr_skiplistnode *) apr_skiplist_insert_compare(apr_skiplist *sl, + void *data, apr_skiplist_compare comp); + +/** + * Insert an element into the skip list using the existing comparison function. + * @param sl The skip list + * @param data The element to insert + * @remark If no comparison function has been set for the skip list, the element + * will not be inserted and NULL will be returned. + */ +APR_DECLARE(apr_skiplistnode *) apr_skiplist_insert(apr_skiplist* sl, void *data); + +/** + * Remove an element from the skip list using the specified comparison function for + * locating the element. + * @param sl The skip list + * @param data The element to remove + * @param myfree A function to be called for each removed element + * @param comp The comparison function to use for placement into the skip list + * @remark If the element is not found, 0 will be returned. Otherwise, the heightXXX + * will be returned. + */ +APR_DECLARE(int) apr_skiplist_remove_compare(apr_skiplist *sl, void *data, + apr_skiplist_freefunc myfree, apr_skiplist_compare comp); + +/** + * Remove an element from the skip list using the existing comparison function for + * locating the element. + * @param sl The skip list + * @param data The element to remove + * @param myfree A function to be called for each removed element + * @remark If the element is not found, 0 will be returned. Otherwise, the heightXXX + * will be returned. + * @remark If no comparison function has been set for the skip list, the element + * will not be removed and 0 will be returned. + */ +APR_DECLARE(int) apr_skiplist_remove(apr_skiplist *sl, void *data, apr_skiplist_freefunc myfree); + +/** + * Remove all elements from the skip list. + * @param sl The skip list + * @param myfree A function to be called for each removed element + */ +APR_DECLARE(void) apr_skiplist_remove_all(apr_skiplist *sl, apr_skiplist_freefunc myfree); + +/** + * Remove each element from the skip list. + * @param sl The skip list + * @param myfree A function to be called for each removed element + */ +APR_DECLARE(void) apr_skiplist_destroy(apr_skiplist *sl, apr_skiplist_freefunc myfree); + +/** + * Return the first element in the skip list, leaving the element in the skip list. + * @param sl The skip list + * @param myfree A function to be called for the removed element + * @remark NULL will be returned if there are no elements + */ +APR_DECLARE(void *) apr_skiplist_pop(apr_skiplist *sl, apr_skiplist_freefunc myfree); + +/** + * Return the first element in the skip list, leaving the element in the skip list. + * @param sl The skip list + * @remark NULL will be returned if there are no elements + */ +APR_DECLARE(void *) apr_skiplist_peek(apr_skiplist *sl); + +/** + * Merge two skip lists. XXX SEMANTICS + * @param sl1 One of two skip lists to be merged + * @param sl2 The other of two skip lists to be merged + */ +APR_DECLARE(apr_skiplist *) apr_skiplist_merge(apr_skiplist *sl1, apr_skiplist *sl2); + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* ! APR_SKIPLIST_H */ diff --git a/contrib/apr/include/apr_strings.h b/contrib/apr/include/apr_strings.h index 457217358c8..c0642adb211 100644 --- a/contrib/apr/include/apr_strings.h +++ b/contrib/apr/include/apr_strings.h @@ -90,7 +90,7 @@ APR_DECLARE(int) apr_strnatcasecmp(char const *a, char const *b); * duplicate a string into memory allocated out of a pool * @param p The pool to allocate out of * @param s The string to duplicate - * @return The new string + * @return The new string or NULL if s == NULL */ APR_DECLARE(char *) apr_pstrdup(apr_pool_t *p, const char *s); @@ -100,7 +100,7 @@ APR_DECLARE(char *) apr_pstrdup(apr_pool_t *p, const char *s); * @param p The pool to allocate out of * @param s The block of characters to duplicate * @param n The number of characters to duplicate - * @return The new string + * @return The new string or NULL if s == NULL * @remark This is a faster alternative to apr_pstrndup, for use * when you know that the string being duplicated really * has 'n' or more characters. If the string might contain @@ -118,7 +118,7 @@ APR_DECLARE(char *) apr_pstrmemdup(apr_pool_t *p, const char *s, apr_size_t n) * @param p The pool to allocate out of * @param s The string to duplicate * @param n The maximum number of characters to duplicate - * @return The new string + * @return The new string or NULL if s == NULL * @remark The amount of memory allocated from the pool is the length * of the returned string including the NUL terminator */ @@ -130,7 +130,7 @@ APR_DECLARE(char *) apr_pstrndup(apr_pool_t *p, const char *s, apr_size_t n); * @param p The pool to allocate from * @param m The memory to duplicate * @param n The number of bytes to duplicate - * @return The new block of memory + * @return The new block of memory or NULL if m == NULL */ APR_DECLARE(void *) apr_pmemdup(apr_pool_t *p, const void *m, apr_size_t n) #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) @@ -235,8 +235,14 @@ APR_DECLARE(apr_status_t) apr_tokenize_to_argv(const char *arg_str, * first call to apr_strtok() for a given string, and NULL * on subsequent calls. * @param sep The set of delimiters - * @param last Internal state saved by apr_strtok() between calls. + * @param last State saved by apr_strtok() between calls. * @return The next token from the string + * @note the 'last' state points to the trailing NUL char of the final + * token, otherwise it points to the character following the current + * token (all successive or empty occurances of sep are skiped on the + * subsequent call to apr_strtok). Therefore it is possible to avoid + * a strlen() determination, with the following logic; + * toklen = last - retval; if (*last) --toklen; */ APR_DECLARE(char *) apr_strtok(char *str, const char *sep, char **last); diff --git a/contrib/apr/include/apr_tables.h b/contrib/apr/include/apr_tables.h index 1e7a57d1627..194af02f2f0 100644 --- a/contrib/apr/include/apr_tables.h +++ b/contrib/apr/include/apr_tables.h @@ -267,6 +267,18 @@ APR_DECLARE(void) apr_table_clear(apr_table_t *t); */ APR_DECLARE(const char *) apr_table_get(const apr_table_t *t, const char *key); +/** + * Get values associated with a given key from the table. If more than one + * value exists, return a comma separated list of values. After this call, the + * data is still in the table. + * @param p The pool to allocate the combined value from, if necessary + * @param t The table to search for the key + * @param key The key to search for (case does not matter) + * @return The value associated with the key, or NULL if the key does not exist. + */ +APR_DECLARE(const char *) apr_table_getm(apr_pool_t *p, const apr_table_t *t, + const char *key); + /** * Add a key/value pair to a table. If another element already exists with the * same key, this will overwrite the old data. diff --git a/contrib/apr/include/apr_thread_mutex.h b/contrib/apr/include/apr_thread_mutex.h index 4596dce5d22..193a70a3822 100644 --- a/contrib/apr/include/apr_thread_mutex.h +++ b/contrib/apr/include/apr_thread_mutex.h @@ -59,7 +59,7 @@ typedef struct apr_thread_mutex_t apr_thread_mutex_t; * * @param pool the pool from which to allocate the mutex. * @warning Be cautious in using APR_THREAD_MUTEX_DEFAULT. While this is the - * most optimial mutex based on a given platform's performance charateristics, + * most optimal mutex based on a given platform's performance characteristics, * it will behave as either a nested or an unnested lock. */ APR_DECLARE(apr_status_t) apr_thread_mutex_create(apr_thread_mutex_t **mutex, diff --git a/contrib/apr/include/apr_thread_proc.h b/contrib/apr/include/apr_thread_proc.h index 0a97c955c4b..e721ede9e96 100644 --- a/contrib/apr/include/apr_thread_proc.h +++ b/contrib/apr/include/apr_thread_proc.h @@ -114,7 +114,7 @@ typedef enum { #define APR_OC_REASON_DEATH 0 /**< child has died, caller must call * unregister still */ #define APR_OC_REASON_UNWRITABLE 1 /**< write_fd is unwritable */ -#define APR_OC_REASON_RESTART 2 /**< a restart is occuring, perform +#define APR_OC_REASON_RESTART 2 /**< a restart is occurring, perform * any necessary cleanup (including * sending a special signal to child) */ @@ -123,7 +123,7 @@ typedef enum { * kill the child) */ #define APR_OC_REASON_LOST 4 /**< somehow the child exited without * us knowing ... buggy os? */ -#define APR_OC_REASON_RUNNING 5 /**< a health check is occuring, +#define APR_OC_REASON_RUNNING 5 /**< a health check is occurring, * for most maintainence functions * this is a no-op. */ @@ -197,7 +197,9 @@ typedef struct apr_other_child_rec_t apr_other_child_rec_t; typedef void *(APR_THREAD_FUNC *apr_thread_start_t)(apr_thread_t*, void*); typedef enum { - APR_KILL_NEVER, /**< process is never sent any signals */ + APR_KILL_NEVER, /**< process is never killed (i.e., never sent + * any signals), but it will be reaped if it exits + * before the pool is cleaned up */ APR_KILL_ALWAYS, /**< process is sent SIGKILL on apr_pool_t cleanup */ APR_KILL_AFTER_TIMEOUT, /**< SIGTERM, wait 3 seconds, SIGKILL */ APR_JUST_WAIT, /**< wait forever for the process to complete */ @@ -632,7 +634,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new_proc, * APR_NOWAIT -- return immediately regardless of if the * child is dead or not. * - * @remark The childs status is in the return code to this process. It is one of: + * @remark The child's status is in the return code to this process. It is one of: *
  *            APR_CHILD_DONE     -- child is no longer running.
  *            APR_CHILD_NOTDONE  -- child is still running.
diff --git a/contrib/apr/include/apr_time.h b/contrib/apr/include/apr_time.h
index 6dd70cc8d01..15e0b961152 100644
--- a/contrib/apr/include/apr_time.h
+++ b/contrib/apr/include/apr_time.h
@@ -42,7 +42,7 @@ APR_DECLARE_DATA extern const char apr_month_snames[12][4];
 APR_DECLARE_DATA extern const char apr_day_snames[7][4];
 
 
-/** number of microseconds since 00:00:00 january 1, 1970 UTC */
+/** number of microseconds since 00:00:00 January 1, 1970 UTC */
 typedef apr_int64_t apr_time_t;
 
 
@@ -93,7 +93,7 @@ typedef struct apr_time_exp_t apr_time_exp_t;
 /**
  * a structure similar to ANSI struct tm with the following differences:
  *  - tm_usec isn't an ANSI field
- *  - tm_gmtoff isn't an ANSI field (it's a bsdism)
+ *  - tm_gmtoff isn't an ANSI field (it's a BSDism)
  */
 struct apr_time_exp_t {
     /** microseconds past tm_sec */
@@ -110,9 +110,9 @@ struct apr_time_exp_t {
     apr_int32_t tm_mon;
     /** year since 1900 */
     apr_int32_t tm_year;
-    /** (0-6) days since sunday */
+    /** (0-6) days since Sunday */
     apr_int32_t tm_wday;
-    /** (0-365) days since jan 1 */
+    /** (0-365) days since January 1 */
     apr_int32_t tm_yday;
     /** daylight saving time */
     apr_int32_t tm_isdst;
@@ -121,7 +121,7 @@ struct apr_time_exp_t {
 };
 
 /**
- * convert an ansi time_t to an apr_time_t
+ * Convert an ansi time_t to an apr_time_t
  * @param result the resulting apr_time_t
  * @param input the time_t to convert
  */
@@ -129,8 +129,8 @@ APR_DECLARE(apr_status_t) apr_time_ansi_put(apr_time_t *result,
                                                     time_t input);
 
 /**
- * convert a time to its human readable components using an offset
- * from GMT
+ * Convert a time to its human readable components using an offset
+ * from GMT.
  * @param result the exploded time
  * @param input the time to explode
  * @param offs the number of seconds offset to apply
@@ -140,7 +140,7 @@ APR_DECLARE(apr_status_t) apr_time_exp_tz(apr_time_exp_t *result,
                                           apr_int32_t offs);
 
 /**
- * convert a time to its human readable components in GMT timezone
+ * Convert a time to its human readable components (GMT).
  * @param result the exploded time
  * @param input the time to explode
  */
@@ -148,7 +148,7 @@ APR_DECLARE(apr_status_t) apr_time_exp_gmt(apr_time_exp_t *result,
                                            apr_time_t input);
 
 /**
- * convert a time to its human readable components in local timezone
+ * Convert a time to its human readable components in the local timezone.
  * @param result the exploded time
  * @param input the time to explode
  */
@@ -156,8 +156,8 @@ APR_DECLARE(apr_status_t) apr_time_exp_lt(apr_time_exp_t *result,
                                           apr_time_t input);
 
 /**
- * Convert time value from human readable format to a numeric apr_time_t 
- * e.g. elapsed usec since epoch
+ * Convert time value from human readable format to a numeric apr_time_t
+ * (elapsed microseconds since the epoch).
  * @param result the resulting imploded time
  * @param input the input exploded time
  */
@@ -166,7 +166,7 @@ APR_DECLARE(apr_status_t) apr_time_exp_get(apr_time_t *result,
 
 /**
  * Convert time value from human readable format to a numeric apr_time_t that
- * always represents GMT
+ * always represents GMT.
  * @param result the resulting imploded time
  * @param input the input exploded time
  */
@@ -185,7 +185,7 @@ APR_DECLARE(void) apr_sleep(apr_interval_time_t t);
 /**
  * apr_rfc822_date formats dates in the RFC822
  * format in an efficient manner.  It is a fixed length
- * format which requires the indicated amount of storage,
+ * format which requires APR_RFC822_DATA_LEN bytes of storage,
  * including the trailing NUL terminator.
  * @param date_str String to write to.
  * @param t the time to convert 
@@ -196,18 +196,18 @@ APR_DECLARE(apr_status_t) apr_rfc822_date(char *date_str, apr_time_t t);
 #define APR_CTIME_LEN (25)
 /**
  * apr_ctime formats dates in the ctime() format
- * in an efficient manner.  it is a fixed length format
- * and requires the indicated amount of storage including
+ * in an efficient manner.  It is a fixed length format
+ * and requires APR_CTIME_LEN bytes of storage including
  * the trailing NUL terminator.
  * Unlike ANSI/ISO C ctime(), apr_ctime() does not include
- * a \n at the end of the string.
+ * a \\n at the end of the string.
  * @param date_str String to write to.
  * @param t the time to convert 
  */
 APR_DECLARE(apr_status_t) apr_ctime(char *date_str, apr_time_t t);
 
 /**
- * formats the exploded time according to the format specified
+ * Formats the exploded time according to the format specified
  * @param s string to write to
  * @param retsize The length of the returned string
  * @param max The maximum length of the string
@@ -220,7 +220,7 @@ APR_DECLARE(apr_status_t) apr_strftime(char *s, apr_size_t *retsize,
 
 /**
  * Improve the clock resolution for the lifetime of the given pool.
- * Generally this is only desireable on benchmarking and other very
+ * Generally this is only desirable on benchmarking and other very
  * time-sensitive applications, and has no impact on most platforms.
  * @param p The pool to associate the finer clock resolution 
  */
diff --git a/contrib/apr/include/apr_user.h b/contrib/apr/include/apr_user.h
index 0179e22644c..0e0a3ac5ac5 100644
--- a/contrib/apr/include/apr_user.h
+++ b/contrib/apr/include/apr_user.h
@@ -81,7 +81,7 @@ APR_DECLARE(apr_status_t) apr_uid_name_get(char **username, apr_uid_t userid,
  * Get the userid (and groupid) for the specified username
  * @param userid   Returns the user id
  * @param groupid  Returns the user's group id
- * @param username The username to lookup
+ * @param username The username to look up
  * @param p The pool from which to allocate working space
  * @remark This function is available only if APR_HAS_USER is defined.
  */
@@ -103,7 +103,7 @@ APR_DECLARE(apr_status_t) apr_uid_homepath_get(char **dirname,
  * Compare two user identifiers for equality.
  * @param left One uid to test
  * @param right Another uid to test
- * @return APR_SUCCESS if the apr_uid_t strutures identify the same user,
+ * @return APR_SUCCESS if the apr_uid_t structures identify the same user,
  * APR_EMISMATCH if not, APR_BADARG if an apr_uid_t is invalid.
  * @remark This function is available only if APR_HAS_USER is defined.
  */
@@ -137,7 +137,7 @@ APR_DECLARE(apr_status_t) apr_gid_get(apr_gid_t *groupid,
  * Compare two group identifiers for equality.
  * @param left One gid to test
  * @param right Another gid to test
- * @return APR_SUCCESS if the apr_gid_t strutures identify the same group,
+ * @return APR_SUCCESS if the apr_gid_t structures identify the same group,
  * APR_EMISMATCH if not, APR_BADARG if an apr_gid_t is invalid.
  * @remark This function is available only if APR_HAS_USER is defined.
  */
diff --git a/contrib/apr/include/apr_version.h b/contrib/apr/include/apr_version.h
index 4b06508eecb..21110538bf9 100644
--- a/contrib/apr/include/apr_version.h
+++ b/contrib/apr/include/apr_version.h
@@ -38,7 +38,7 @@
  */
 
 
-#define APR_COPYRIGHT "Copyright (c) 2013 The Apache Software " \
+#define APR_COPYRIGHT "Copyright (c) 2000-2014 The Apache Software " \
                       "Foundation or its licensors, as applicable."
 
 /* The numeric compile-time version constants. These constants are the
@@ -56,13 +56,13 @@
  * Minor API changes that do not cause binary compatibility problems.
  * Reset to 0 when upgrading APR_MAJOR_VERSION
  */
-#define APR_MINOR_VERSION       4
+#define APR_MINOR_VERSION       5
 
 /** patch level 
  * The Patch Level never includes API changes, simply bug fixes.
  * Reset to 0 when upgrading APR_MINOR_VERSION
  */
-#define APR_PATCH_VERSION       8
+#define APR_PATCH_VERSION       1
 
 /** 
  * The symbol APR_IS_DEV_VERSION is only defined for internal,
diff --git a/contrib/apr/include/arch/unix/apr_arch_poll_private.h b/contrib/apr/include/arch/unix/apr_arch_poll_private.h
index 1d31f96c6ea..2dd7b1fd6fb 100644
--- a/contrib/apr/include/arch/unix/apr_arch_poll_private.h
+++ b/contrib/apr/include/arch/unix/apr_arch_poll_private.h
@@ -45,6 +45,11 @@
 #define HAS_PIPES(dt) (dt == APR_POLL_FILE) ? 1 : 0
 #endif
 
+#if defined(HAVE_AIO_H) && defined(HAVE_AIO_MSGQ)
+#define _AIO_OS390	/* enable a bunch of z/OS aio.h definitions */
+#include 	/* aiocb	*/
+#endif
+
 /* Choose the best method platform specific to use in apr_pollset */
 #ifdef HAVE_KQUEUE
 #define POLLSET_USES_KQUEUE
@@ -55,6 +60,9 @@
 #elif defined(HAVE_EPOLL)
 #define POLLSET_USES_EPOLL
 #define POLLSET_DEFAULT_METHOD APR_POLLSET_EPOLL
+#elif defined(HAVE_AIO_MSGQ)
+#define POLLSET_USES_AIO_MSGQ
+#define POLLSET_DEFAULT_METHOD APR_POLLSET_AIO_MSGQ
 #elif defined(HAVE_POLL)
 #define POLLSET_USES_POLL
 #define POLLSET_DEFAULT_METHOD APR_POLLSET_POLL
@@ -75,7 +83,7 @@
 #endif
 #endif
 
-#if defined(POLLSET_USES_KQUEUE) || defined(POLLSET_USES_EPOLL) || defined(POLLSET_USES_PORT)
+#if defined(POLLSET_USES_KQUEUE) || defined(POLLSET_USES_EPOLL) || defined(POLLSET_USES_PORT) || defined(POLLSET_USES_AIO_MSGQ)
 
 #include "apr_ring.h"
 
@@ -107,6 +115,7 @@ struct pfd_elem_t {
 typedef struct apr_pollset_private_t apr_pollset_private_t;
 typedef struct apr_pollset_provider_t apr_pollset_provider_t;
 typedef struct apr_pollcb_provider_t apr_pollcb_provider_t;
+
 struct apr_pollset_t
 {
     apr_pool_t *pool;
diff --git a/contrib/apr/include/arch/unix/apr_arch_threadproc.h b/contrib/apr/include/arch/unix/apr_arch_threadproc.h
index b76dc9be131..a61830f6ee8 100644
--- a/contrib/apr/include/arch/unix/apr_arch_threadproc.h
+++ b/contrib/apr/include/arch/unix/apr_arch_threadproc.h
@@ -39,7 +39,7 @@
 #if APR_HAVE_STRING_H
 #include 
 #endif
-#if HAVE_SCHED_H
+#ifdef HAVE_SCHED_H
 #include 
 #endif
 /* End System Headers */
diff --git a/contrib/apr/include/arch/unix/apr_private.h.in b/contrib/apr/include/arch/unix/apr_private.h.in
index f7ea7e9fd83..12af027472e 100644
--- a/contrib/apr/include/arch/unix/apr_private.h.in
+++ b/contrib/apr/include/arch/unix/apr_private.h.in
@@ -83,6 +83,9 @@
 /* Define if accept4 function is supported */
 #undef HAVE_ACCEPT4
 
+/* Define if async i/o supports message q's */
+#undef HAVE_AIO_MSGQ
+
 /* Define to 1 if you have `alloca', as a function or macro. */
 #undef HAVE_ALLOCA
 
@@ -929,7 +932,7 @@
 
 
 /* switch this on if we have a BeOS version below BONE */
-#if BEOS && !HAVE_BONE_VERSION
+#if defined(BEOS) && !defined(HAVE_BONE_VERSION)
 #define BEOS_R5 1
 #else
 #define BEOS_BONE 1
diff --git a/contrib/apr/libapr.dep b/contrib/apr/libapr.dep
index 3efb8ec1dd6..5155c402e71 100644
--- a/contrib/apr/libapr.dep
+++ b/contrib/apr/libapr.dep
@@ -1,561 +1,1920 @@
-# Microsoft Developer Studio Generated Dependency File, included by libapr.mak
-
-.\atomic\win32\apr_atomic.c : \
-	".\include\apr_atomic.h"\
-	
-
-.\dso\win32\dso.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	".\include\arch\win32\apr_arch_dso.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\file_io\win32\buffer.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\file_io\unix\copy.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\file_io\win32\dir.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	".\include\arch\win32\apr_arch_atime.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\file_io\unix\fileacc.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\file_io\win32\filedup.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_inherit.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\file_io\win32\filepath.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\file_io\unix\filepath_util.c : \
-	".\include\apr_strings.h"\
-	
-
-.\file_io\win32\filestat.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	".\include\arch\win32\apr_arch_atime.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\file_io\win32\filesys.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\file_io\win32\flock.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\file_io\unix\fullrw.c : \
-	
-
-.\file_io\unix\mktemp.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_inherit.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\file_io\win32\open.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_inherit.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\file_io\win32\pipe.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\file_io\win32\readwrite.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	".\include\arch\win32\apr_arch_atime.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\file_io\win32\seek.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\file_io\unix\tempdir.c : \
-	".\include\apr_env.h"\
-	".\include\apr_strings.h"\
-	
-
-.\locks\win32\proc_mutex.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_proc_mutex.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\locks\win32\thread_cond.c : \
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	".\include\apr_thread_cond.h"\
-	".\include\arch\win32\apr_arch_thread_cond.h"\
-	".\include\arch\win32\apr_arch_thread_mutex.h"\
-	
-
-.\locks\win32\thread_mutex.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	".\include\arch\win32\apr_arch_thread_mutex.h"\
-	
-
-.\locks\win32\thread_rwlock.c : \
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	".\include\apr_thread_rwlock.h"\
-	".\include\arch\win32\apr_arch_thread_rwlock.h"\
-	
-
-.\memory\unix\apr_pools.c : \
-	".\include\apr_atomic.h"\
-	".\include\apr_env.h"\
-	".\include\apr_hash.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	
-
-.\misc\win32\charset.c : \
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	
-
-.\misc\win32\env.c : \
-	".\include\apr_env.h"\
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\misc\unix\errorcodes.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	
-
-.\misc\unix\getopt.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	
-
-.\misc\win32\internal.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\misc\win32\misc.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	".\include\arch\win32\apr_dbg_win32_handles.h"\
-	
-
-.\misc\unix\otherchild.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_threadproc.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\misc\win32\rand.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_portable.h"\
-	
-
-.\misc\win32\start.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_signal.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_threadproc.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\misc\win32\utf8.c : \
-	".\include\apr_lib.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\misc\unix\version.c : \
-	".\include\apr_version.h"\
-	
-
-.\mmap\unix\common.c : \
-	".\include\apr_mmap.h"\
-	
-
-.\mmap\win32\mmap.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_mmap.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\network_io\unix\inet_ntop.c : \
-	".\include\apr_poll.h"\
-	".\include\apr_strings.h"\
-	".\include\arch\win32\apr_arch_networkio.h"\
-	
-
-.\network_io\unix\inet_pton.c : \
-	".\include\apr_poll.h"\
-	".\include\arch\win32\apr_arch_networkio.h"\
-	
-
-.\network_io\unix\multicast.c : \
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_support.h"\
-	".\include\arch\win32\apr_arch_inherit.h"\
-	".\include\arch\win32\apr_arch_networkio.h"\
-	
-
-.\network_io\win32\sendrecv.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_networkio.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\network_io\unix\sockaddr.c : \
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_strings.h"\
-	".\include\arch\win32\apr_arch_networkio.h"\
-	
-
-.\network_io\unix\socket_util.c : \
-	".\include\apr_poll.h"\
-	
-
-.\network_io\win32\sockets.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	".\include\arch\win32\apr_arch_inherit.h"\
-	".\include\arch\win32\apr_arch_networkio.h"\
-	
-
-.\network_io\win32\sockopt.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	".\include\arch\win32\apr_arch_networkio.h"\
-	
-
-.\passwd\apr_getpass.c : \
-	".\include\apr_lib.h"\
-	".\include\apr_strings.h"\
-	
-
-.\poll\unix\poll.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\arch\unix\apr_arch_poll_private.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_networkio.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\poll\unix\pollcb.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\arch\unix\apr_arch_poll_private.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_networkio.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\poll\unix\pollset.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\arch\unix\apr_arch_poll_private.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_inherit.h"\
-	".\include\arch\win32\apr_arch_networkio.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\poll\unix\select.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\arch\unix\apr_arch_poll_private.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_networkio.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\random\unix\apr_random.c : \
-	".\include\apr_random.h"\
-	
-
-.\random\unix\sha2.c : \
-	".\random\unix\sha2.h"\
-	
-
-.\random\unix\sha2_glue.c : \
-	".\include\apr_random.h"\
-	".\random\unix\sha2.h"\
-	
-
-.\shmem\win32\shm.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\strings\apr_cpystrn.c : \
-	".\include\apr_lib.h"\
-	".\include\apr_strings.h"\
-	
-
-.\strings\apr_fnmatch.c : \
-	".\include\apr_fnmatch.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_strings.h"\
-	
-
-.\strings\apr_snprintf.c : \
-	".\include\apr_lib.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	
-
-.\strings\apr_strings.c : \
-	".\include\apr_lib.h"\
-	".\include\apr_strings.h"\
-	
-
-.\strings\apr_strnatcmp.c : \
-	".\include\apr_lib.h"\
-	".\include\apr_strings.h"\
-	
-
-.\strings\apr_strtok.c : \
-	".\include\apr_strings.h"\
-	
-
-.\tables\apr_hash.c : \
-	".\include\apr_hash.h"\
-	
-
-.\tables\apr_tables.c : \
-	".\include\apr_lib.h"\
-	".\include\apr_strings.h"\
-	
-
-.\threadproc\win32\proc.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_threadproc.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\threadproc\win32\signals.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_signal.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_threadproc.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-.\threadproc\win32\thread.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_portable.h"\
-	".\include\arch\win32\apr_arch_threadproc.h"\
-	
-
-.\threadproc\win32\threadpriv.c : \
-	".\include\apr_lib.h"\
-	".\include\apr_portable.h"\
-	".\include\arch\win32\apr_arch_threadproc.h"\
-	
-
-.\time\win32\time.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_portable.h"\
-	".\include\arch\win32\apr_arch_atime.h"\
-	
-
-.\time\win32\timestr.c : \
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	".\include\arch\win32\apr_arch_atime.h"\
-	
-
-.\user\win32\groupinfo.c : \
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	
-
-.\user\win32\userinfo.c : \
-	".\include\apr_getopt.h"\
-	".\include\apr_lib.h"\
-	".\include\apr_poll.h"\
-	".\include\apr_portable.h"\
-	".\include\apr_strings.h"\
-	".\include\arch\win32\apr_arch_file_io.h"\
-	".\include\arch\win32\apr_arch_utf8.h"\
-	
-
-!IF  "$(CFG)" == "libapr - Win32 Release"
-
-!ELSEIF  "$(CFG)" == "libapr - Win32 Debug"
-
-!ELSEIF  "$(CFG)" == "libapr - Win32 Release9x"
-
-!ELSEIF  "$(CFG)" == "libapr - Win32 Debug9x"
-
-!ELSEIF  "$(CFG)" == "libapr - x64 Release"
-
-!ELSEIF  "$(CFG)" == "libapr - x64 Debug"
-
-!ENDIF 
-
-.\libapr.rc : \
-	".\include\apr_version.h"\
-	
+# Microsoft Developer Studio Generated Dependency File, included by libapr.mak
+
+.\atomic\win32\apr_atomic.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_atomic.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_general.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_want.h"\
+	
+
+.\dso\win32\dso.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_dso.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\encoding\apr_escape.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_escape.h"\
+	".\include\apr_escape_test_char.h"\
+	".\include\apr_general.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_want.h"\
+	
+
+.\file_io\win32\buffer.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\file_io\unix\copy.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\file_io\win32\dir.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_atime.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\file_io\unix\fileacc.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\file_io\win32\filedup.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_inherit.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\file_io\win32\filepath.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\file_io\unix\filepath_util.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_general.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\file_io\win32\filestat.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_atime.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\file_io\win32\filesys.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\file_io\win32\flock.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\file_io\unix\fullrw.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	
+
+.\file_io\unix\mktemp.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_inherit.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\file_io\win32\open.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_inherit.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\file_io\win32\pipe.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\file_io\win32\readwrite.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_atime.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\file_io\win32\seek.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\file_io\unix\tempdir.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_env.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\locks\win32\proc_mutex.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_proc_mutex.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\locks\win32\thread_cond.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_cond.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_thread_cond.h"\
+	".\include\arch\win32\apr_arch_thread_mutex.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\locks\win32\thread_mutex.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_thread_mutex.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\locks\win32\thread_rwlock.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_thread_rwlock.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_thread_rwlock.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\memory\unix\apr_pools.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_atomic.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_env.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_hash.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\misc\win32\charset.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	
+
+.\misc\win32\env.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_env.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\misc\unix\errorcodes.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\misc\unix\getopt.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\misc\win32\internal.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\misc\win32\misc.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\misc\unix\otherchild.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_threadproc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\misc\win32\rand.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\misc\win32\start.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_signal.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_threadproc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\misc\win32\utf8.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_general.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\misc\unix\version.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_general.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_version.h"\
+	".\include\apr_want.h"\
+	
+
+.\mmap\unix\common.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_mmap.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_ring.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\mmap\win32\mmap.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_mmap.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_ring.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\network_io\unix\inet_ntop.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_networkio.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\network_io\unix\inet_pton.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_networkio.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\network_io\unix\multicast.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_support.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\win32\apr_arch_inherit.h"\
+	".\include\arch\win32\apr_arch_networkio.h"\
+	
+
+.\network_io\win32\sendrecv.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_networkio.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\network_io\unix\sockaddr.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_networkio.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\network_io\unix\socket_util.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	
+
+.\network_io\win32\sockets.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_inherit.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_networkio.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\network_io\win32\sockopt.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_networkio.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\passwd\apr_getpass.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_general.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\poll\unix\poll.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_ring.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\unix\apr_arch_poll_private.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_networkio.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\poll\unix\pollcb.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_ring.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\unix\apr_arch_poll_private.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_networkio.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\poll\unix\pollset.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_ring.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\unix\apr_arch_poll_private.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_inherit.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_networkio.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\poll\unix\select.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_ring.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\unix\apr_arch_poll_private.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_networkio.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\random\unix\apr_random.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_random.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	
+
+.\random\unix\sha2.c : \
+	".\include\apr.h"\
+	".\random\unix\sha2.h"\
+	
+
+.\random\unix\sha2_glue.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_random.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\random\unix\sha2.h"\
+	
+
+.\shmem\win32\shm.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\strings\apr_cpystrn.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_general.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\strings\apr_fnmatch.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_fnmatch.h"\
+	".\include\apr_general.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	
+
+.\strings\apr_snprintf.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\strings\apr_strings.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_general.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\strings\apr_strnatcmp.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_general.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_want.h"\
+	
+
+.\strings\apr_strtok.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_general.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_want.h"\
+	
+
+.\tables\apr_hash.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_general.h"\
+	".\include\apr_hash.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_time.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\tables\apr_skiplist.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_skiplist.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	
+
+.\tables\apr_tables.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_general.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\threadproc\win32\proc.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_threadproc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\threadproc\win32\signals.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_signal.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_threadproc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\threadproc\win32\thread.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_threadproc.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\threadproc\win32\threadpriv.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_threadproc.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\time\win32\time.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_atime.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\time\win32\timestr.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_atime.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\user\win32\groupinfo.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+.\user\win32\userinfo.c : \
+	".\include\apr.h"\
+	".\include\apr_allocator.h"\
+	".\include\apr_dso.h"\
+	".\include\apr_errno.h"\
+	".\include\apr_file_info.h"\
+	".\include\apr_file_io.h"\
+	".\include\apr_general.h"\
+	".\include\apr_getopt.h"\
+	".\include\apr_global_mutex.h"\
+	".\include\apr_inherit.h"\
+	".\include\apr_lib.h"\
+	".\include\apr_network_io.h"\
+	".\include\apr_poll.h"\
+	".\include\apr_pools.h"\
+	".\include\apr_portable.h"\
+	".\include\apr_proc_mutex.h"\
+	".\include\apr_shm.h"\
+	".\include\apr_strings.h"\
+	".\include\apr_tables.h"\
+	".\include\apr_thread_mutex.h"\
+	".\include\apr_thread_proc.h"\
+	".\include\apr_time.h"\
+	".\include\apr_user.h"\
+	".\include\apr_want.h"\
+	".\include\arch\apr_private_common.h"\
+	".\include\arch\win32\apr_arch_file_io.h"\
+	".\include\arch\win32\apr_arch_misc.h"\
+	".\include\arch\win32\apr_arch_utf8.h"\
+	".\include\arch\win32\apr_private.h"\
+	
+
+!IF  "$(CFG)" == "libapr - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Release9x"
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Debug9x"
+
+!ELSEIF  "$(CFG)" == "libapr - x64 Release"
+
+!ELSEIF  "$(CFG)" == "libapr - x64 Debug"
+
+!ENDIF 
+
+!IF  "$(CFG)" == "libapr - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Release9x"
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Debug9x"
+
+!ELSEIF  "$(CFG)" == "libapr - x64 Release"
+
+!ELSEIF  "$(CFG)" == "libapr - x64 Debug"
+
+!ENDIF 
+
+!IF  "$(CFG)" == "libapr - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Debug"
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Release9x"
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Debug9x"
+
+!ELSEIF  "$(CFG)" == "libapr - x64 Release"
+
+!ELSEIF  "$(CFG)" == "libapr - x64 Debug"
+
+!ENDIF 
+
+.\libapr.rc : \
+	".\include\apr.h"\
+	".\include\apr_version.h"\
+	
diff --git a/contrib/apr/libapr.dsp b/contrib/apr/libapr.dsp
index b1783bf3f17..f121ef9ff7f 100644
--- a/contrib/apr/libapr.dsp
+++ b/contrib/apr/libapr.dsp
@@ -254,6 +254,14 @@ SOURCE=.\atomic\win32\apr_atomic.c
 SOURCE=.\dso\win32\dso.c
 # End Source File
 # End Group
+# Begin Group "encoding"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\encoding\apr_escape.c
+# End Source File
+# End Group
 # Begin Group "file_io"
 
 # PROP Default_Filter ""
@@ -546,6 +554,10 @@ SOURCE=.\tables\apr_hash.c
 
 SOURCE=.\tables\apr_tables.c
 # End Source File
+# Begin Source File
+
+SOURCE=.\tables\apr_skiplist.c
+# End Source File
 # End Group
 # Begin Group "threadproc"
 
@@ -746,6 +758,79 @@ SOURCE=.\include\apr_errno.h
 # End Source File
 # Begin Source File
 
+SOURCE=.\include\apr_escape.h
+
+!IF  "$(CFG)" == "libapr - Win32 Release"
+
+# Begin Custom Build - Creating gen_test_char.exe and apr_escape_test_char.h
+InputPath=.\include\apr_escape.h
+
+".\Release\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	cl.exe /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /I ".\include" /Fo.\Release\gen_test_char /Fe.\Release\gen_test_char.exe .\tools\gen_test_char.c 
+	.\Release\gen_test_char.exe > .\include\apr_escape_test_char.h
+
+# End Custom Build
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Debug"
+
+# Begin Custom Build - Creating gen_test_char.exe and apr_escape_test_char.h
+InputPath=.\include\apr_escape.h
+
+".\Debug\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	cl.exe /nologo /W3 /EHsc /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /I ".\include" /Fo.\Debug\gen_test_char /Fe.\Debug\gen_test_char.exe .\tools\gen_test_char.c  
+	.\Debug\gen_test_char.exe > .\include\apr_escape_test_char.h
+
+# End Custom Build
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Release9x"
+
+# Begin Custom Build - Creating gen_test_char.exe and apr_escape_test_char.h
+InputPath=.\include\apr_escape.h
+
+".\9x\Release\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	cl.exe /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /I ".\include" /Fo.\9x\Release\gen_test_char /Fe.\9x\Release\gen_test_char.exe .\tools\gen_test_char.c 
+	.\9x\Release\gen_test_char.exe > .\include\apr_escape_test_char.h
+
+# End Custom Build
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Debug9x"
+
+# Begin Custom Build - Creating gen_test_char.exe and apr_escape_test_char.h
+InputPath=.\include\apr_escape.h
+
+".\9x\Debug\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	cl.exe /nologo /W3 /EHsc /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /I ".\include" /Fo.\9x\Debug\gen_test_char /Fe.\9x\Debug\gen_test_char.exe .\tools\gen_test_char.c  
+	.\9x\Debug\gen_test_char.exe > .\include\apr_escape_test_char.h
+
+# End Custom Build
+
+!ELSEIF  "$(CFG)" == "libapr - x64 Release"
+
+# Begin Custom Build - Creating gen_test_char.exe and apr_escape_test_char.h
+InputPath=.\include\apr_escape.h
+
+".\x64\Release\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	cl.exe /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /I ".\include" /Fo.\x64\Release\gen_test_char /Fe.\x64\Release\gen_test_char.exe .\tools\gen_test_char.c 
+	.\x64\Release\gen_test_char.exe > .\include\apr_escape_test_char.h
+
+# End Custom Build
+
+!ELSEIF  "$(CFG)" == "libapr - x64 Debug"
+
+# Begin Custom Build - Creating gen_test_char.exe and apr_escape_test_char.h
+InputPath=.\include\apr_escape.h
+
+".\x64\Debug\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	cl.exe /nologo /W3 /EHsc /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /I ".\include" /Fo.\x64\Debug\gen_test_char /Fe.\x64\Debug\gen_test_char.exe .\tools\gen_test_char.c 
+	.\x64\Debug\gen_test_char.exe > .\include\apr_escape_test_char.h
+
+# End Custom Build
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
 SOURCE=.\include\apr_file_info.h
 # End Source File
 # Begin Source File
@@ -822,6 +907,10 @@ SOURCE=.\include\apr_signal.h
 # End Source File
 # Begin Source File
 
+SOURCE=.\include\apr_skiplist.h
+# End Source File
+# Begin Source File
+
 SOURCE=.\include\apr_strings.h
 # End Source File
 # Begin Source File
@@ -863,6 +952,69 @@ SOURCE=.\include\apr_version.h
 # Begin Source File
 
 SOURCE=.\include\apr_want.h
+
+!IF  "$(CFG)" == "libapr - Win32 Release"
+
+# Begin Custom Build
+InputPath=.\include\apr_want.h
+
+".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	type .\include\apr.hw > .\include\apr.h
+
+# End Custom Build
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Debug"
+
+# Begin Custom Build
+InputPath=.\include\apr_want.h
+
+".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	type .\include\apr.hw > .\include\apr.h
+
+# End Custom Build
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Release9x"
+
+# Begin Custom Build
+InputPath=.\include\apr_want.h
+
+".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	type .\include\apr.hw > .\include\apr.h
+
+# End Custom Build
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Debug9x"
+
+# Begin Custom Build
+InputPath=.\include\apr_want.h
+
+".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	type .\include\apr.hw > .\include\apr.h
+
+# End Custom Build
+
+!ELSEIF  "$(CFG)" == "libapr - x64 Release"
+
+# Begin Custom Build
+InputPath=.\include\apr_want.h
+
+".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	type .\include\apr.hw > .\include\apr.h
+
+# End Custom Build
+
+!ELSEIF  "$(CFG)" == "libapr - x64 Debug"
+
+# Begin Custom Build
+InputPath=.\include\apr_want.h
+
+".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	type .\include\apr.hw > .\include\apr.h
+
+# End Custom Build
+
+!ENDIF 
+
 # End Source File
 # End Group
 # Begin Source File
diff --git a/contrib/apr/libapr.mak b/contrib/apr/libapr.mak
index fef3a482080..8966d18f8ee 100644
--- a/contrib/apr/libapr.mak
+++ b/contrib/apr/libapr.mak
@@ -1,1917 +1,2118 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on libapr.dsp
-!IF "$(CFG)" == ""
-CFG=libapr - Win32 Release
-!MESSAGE No configuration specified. Defaulting to libapr - Win32 Release.
-!ENDIF 
-
-!IF "$(CFG)" != "libapr - Win32 Release" && "$(CFG)" != "libapr - Win32 Debug" && "$(CFG)" != "libapr - Win32 Release9x" && "$(CFG)" != "libapr - Win32 Debug9x" && "$(CFG)" != "libapr - x64 Release" && "$(CFG)" != "libapr - x64 Debug"
-!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "libapr.mak" CFG="libapr - Win32 Release"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "libapr - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libapr - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libapr - Win32 Release9x" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libapr - Win32 Debug9x" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libapr - x64 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libapr - x64 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE 
-!ERROR An invalid configuration is specified.
-!ENDIF 
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE 
-NULL=nul
-!ENDIF 
-
-!IF  "$(CFG)" == "libapr - Win32 Release"
-
-OUTDIR=.\Release
-INTDIR=.\Release
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-ALL : "$(OUTDIR)\libapr-1.dll" "$(DS_POSTBUILD_DEP)"
-
-
-CLEAN :
-	-@erase "$(INTDIR)\apr_atomic.obj"
-	-@erase "$(INTDIR)\apr_cpystrn.obj"
-	-@erase "$(INTDIR)\apr_fnmatch.obj"
-	-@erase "$(INTDIR)\apr_getpass.obj"
-	-@erase "$(INTDIR)\apr_hash.obj"
-	-@erase "$(INTDIR)\apr_pools.obj"
-	-@erase "$(INTDIR)\apr_random.obj"
-	-@erase "$(INTDIR)\apr_snprintf.obj"
-	-@erase "$(INTDIR)\apr_strings.obj"
-	-@erase "$(INTDIR)\apr_strnatcmp.obj"
-	-@erase "$(INTDIR)\apr_strtok.obj"
-	-@erase "$(INTDIR)\apr_tables.obj"
-	-@erase "$(INTDIR)\buffer.obj"
-	-@erase "$(INTDIR)\charset.obj"
-	-@erase "$(INTDIR)\common.obj"
-	-@erase "$(INTDIR)\copy.obj"
-	-@erase "$(INTDIR)\dir.obj"
-	-@erase "$(INTDIR)\dso.obj"
-	-@erase "$(INTDIR)\env.obj"
-	-@erase "$(INTDIR)\errorcodes.obj"
-	-@erase "$(INTDIR)\fileacc.obj"
-	-@erase "$(INTDIR)\filedup.obj"
-	-@erase "$(INTDIR)\filepath.obj"
-	-@erase "$(INTDIR)\filepath_util.obj"
-	-@erase "$(INTDIR)\filestat.obj"
-	-@erase "$(INTDIR)\filesys.obj"
-	-@erase "$(INTDIR)\flock.obj"
-	-@erase "$(INTDIR)\fullrw.obj"
-	-@erase "$(INTDIR)\getopt.obj"
-	-@erase "$(INTDIR)\groupinfo.obj"
-	-@erase "$(INTDIR)\inet_ntop.obj"
-	-@erase "$(INTDIR)\inet_pton.obj"
-	-@erase "$(INTDIR)\internal.obj"
-	-@erase "$(INTDIR)\libapr.res"
-	-@erase "$(INTDIR)\libapr_src.idb"
-	-@erase "$(INTDIR)\libapr_src.pdb"
-	-@erase "$(INTDIR)\misc.obj"
-	-@erase "$(INTDIR)\mktemp.obj"
-	-@erase "$(INTDIR)\mmap.obj"
-	-@erase "$(INTDIR)\multicast.obj"
-	-@erase "$(INTDIR)\open.obj"
-	-@erase "$(INTDIR)\otherchild.obj"
-	-@erase "$(INTDIR)\pipe.obj"
-	-@erase "$(INTDIR)\poll.obj"
-	-@erase "$(INTDIR)\pollcb.obj"
-	-@erase "$(INTDIR)\pollset.obj"
-	-@erase "$(INTDIR)\proc.obj"
-	-@erase "$(INTDIR)\proc_mutex.obj"
-	-@erase "$(INTDIR)\rand.obj"
-	-@erase "$(INTDIR)\readwrite.obj"
-	-@erase "$(INTDIR)\seek.obj"
-	-@erase "$(INTDIR)\select.obj"
-	-@erase "$(INTDIR)\sendrecv.obj"
-	-@erase "$(INTDIR)\sha2.obj"
-	-@erase "$(INTDIR)\sha2_glue.obj"
-	-@erase "$(INTDIR)\shm.obj"
-	-@erase "$(INTDIR)\signals.obj"
-	-@erase "$(INTDIR)\sockaddr.obj"
-	-@erase "$(INTDIR)\socket_util.obj"
-	-@erase "$(INTDIR)\sockets.obj"
-	-@erase "$(INTDIR)\sockopt.obj"
-	-@erase "$(INTDIR)\start.obj"
-	-@erase "$(INTDIR)\tempdir.obj"
-	-@erase "$(INTDIR)\thread.obj"
-	-@erase "$(INTDIR)\thread_cond.obj"
-	-@erase "$(INTDIR)\thread_mutex.obj"
-	-@erase "$(INTDIR)\thread_rwlock.obj"
-	-@erase "$(INTDIR)\threadpriv.obj"
-	-@erase "$(INTDIR)\time.obj"
-	-@erase "$(INTDIR)\timestr.obj"
-	-@erase "$(INTDIR)\userinfo.obj"
-	-@erase "$(INTDIR)\utf8.obj"
-	-@erase "$(INTDIR)\version.obj"
-	-@erase "$(OUTDIR)\libapr-1.dll"
-	-@erase "$(OUTDIR)\libapr-1.exp"
-	-@erase "$(OUTDIR)\libapr-1.lib"
-	-@erase "$(OUTDIR)\libapr-1.pdb"
-
-"$(OUTDIR)" :
-    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\libapr_src" /FD /c 
-
-.c{$(INTDIR)}.obj::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.cpp{$(INTDIR)}.obj::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.cxx{$(INTDIR)}.obj::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.c{$(INTDIR)}.sbr::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.cpp{$(INTDIR)}.sbr::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.cxx{$(INTDIR)}.sbr::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-MTL=midl.exe
-MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" 
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libapr.res" /i "./include" /d "NDEBUG" /d "APR_VERSION_ONLY" 
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\libapr.bsc" 
-BSC32_SBRS= \
-	
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib" /MACHINE:X86 /opt:ref 
-LINK32_OBJS= \
-	"$(INTDIR)\apr_atomic.obj" \
-	"$(INTDIR)\dso.obj" \
-	"$(INTDIR)\buffer.obj" \
-	"$(INTDIR)\copy.obj" \
-	"$(INTDIR)\dir.obj" \
-	"$(INTDIR)\fileacc.obj" \
-	"$(INTDIR)\filedup.obj" \
-	"$(INTDIR)\filepath.obj" \
-	"$(INTDIR)\filepath_util.obj" \
-	"$(INTDIR)\filestat.obj" \
-	"$(INTDIR)\filesys.obj" \
-	"$(INTDIR)\flock.obj" \
-	"$(INTDIR)\fullrw.obj" \
-	"$(INTDIR)\mktemp.obj" \
-	"$(INTDIR)\open.obj" \
-	"$(INTDIR)\pipe.obj" \
-	"$(INTDIR)\readwrite.obj" \
-	"$(INTDIR)\seek.obj" \
-	"$(INTDIR)\tempdir.obj" \
-	"$(INTDIR)\proc_mutex.obj" \
-	"$(INTDIR)\thread_cond.obj" \
-	"$(INTDIR)\thread_mutex.obj" \
-	"$(INTDIR)\thread_rwlock.obj" \
-	"$(INTDIR)\apr_pools.obj" \
-	"$(INTDIR)\charset.obj" \
-	"$(INTDIR)\env.obj" \
-	"$(INTDIR)\errorcodes.obj" \
-	"$(INTDIR)\getopt.obj" \
-	"$(INTDIR)\internal.obj" \
-	"$(INTDIR)\misc.obj" \
-	"$(INTDIR)\otherchild.obj" \
-	"$(INTDIR)\rand.obj" \
-	"$(INTDIR)\start.obj" \
-	"$(INTDIR)\utf8.obj" \
-	"$(INTDIR)\version.obj" \
-	"$(INTDIR)\common.obj" \
-	"$(INTDIR)\mmap.obj" \
-	"$(INTDIR)\inet_ntop.obj" \
-	"$(INTDIR)\inet_pton.obj" \
-	"$(INTDIR)\multicast.obj" \
-	"$(INTDIR)\sendrecv.obj" \
-	"$(INTDIR)\sockaddr.obj" \
-	"$(INTDIR)\sockets.obj" \
-	"$(INTDIR)\socket_util.obj" \
-	"$(INTDIR)\sockopt.obj" \
-	"$(INTDIR)\apr_getpass.obj" \
-	"$(INTDIR)\poll.obj" \
-	"$(INTDIR)\pollcb.obj" \
-	"$(INTDIR)\pollset.obj" \
-	"$(INTDIR)\select.obj" \
-	"$(INTDIR)\apr_random.obj" \
-	"$(INTDIR)\sha2.obj" \
-	"$(INTDIR)\sha2_glue.obj" \
-	"$(INTDIR)\shm.obj" \
-	"$(INTDIR)\apr_cpystrn.obj" \
-	"$(INTDIR)\apr_fnmatch.obj" \
-	"$(INTDIR)\apr_snprintf.obj" \
-	"$(INTDIR)\apr_strings.obj" \
-	"$(INTDIR)\apr_strnatcmp.obj" \
-	"$(INTDIR)\apr_strtok.obj" \
-	"$(INTDIR)\apr_hash.obj" \
-	"$(INTDIR)\apr_tables.obj" \
-	"$(INTDIR)\proc.obj" \
-	"$(INTDIR)\signals.obj" \
-	"$(INTDIR)\thread.obj" \
-	"$(INTDIR)\threadpriv.obj" \
-	"$(INTDIR)\time.obj" \
-	"$(INTDIR)\timestr.obj" \
-	"$(INTDIR)\groupinfo.obj" \
-	"$(INTDIR)\userinfo.obj" \
-	"$(INTDIR)\libapr.res"
-
-"$(OUTDIR)\libapr-1.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
-    $(LINK32) @<<
-  $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\Release\libapr-1.dll
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\libapr-1.dll"
-   if exist .\Release\libapr-1.dll.manifest mt.exe -manifest .\Release\libapr-1.dll.manifest -outputresource:.\Release\libapr-1.dll;2
-	echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ELSEIF  "$(CFG)" == "libapr - Win32 Debug"
-
-OUTDIR=.\Debug
-INTDIR=.\Debug
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-ALL : ".\include\apr.h" "$(OUTDIR)\libapr-1.dll" "$(DS_POSTBUILD_DEP)"
-
-
-CLEAN :
-	-@erase "$(INTDIR)\apr_atomic.obj"
-	-@erase "$(INTDIR)\apr_cpystrn.obj"
-	-@erase "$(INTDIR)\apr_fnmatch.obj"
-	-@erase "$(INTDIR)\apr_getpass.obj"
-	-@erase "$(INTDIR)\apr_hash.obj"
-	-@erase "$(INTDIR)\apr_pools.obj"
-	-@erase "$(INTDIR)\apr_random.obj"
-	-@erase "$(INTDIR)\apr_snprintf.obj"
-	-@erase "$(INTDIR)\apr_strings.obj"
-	-@erase "$(INTDIR)\apr_strnatcmp.obj"
-	-@erase "$(INTDIR)\apr_strtok.obj"
-	-@erase "$(INTDIR)\apr_tables.obj"
-	-@erase "$(INTDIR)\buffer.obj"
-	-@erase "$(INTDIR)\charset.obj"
-	-@erase "$(INTDIR)\common.obj"
-	-@erase "$(INTDIR)\copy.obj"
-	-@erase "$(INTDIR)\dir.obj"
-	-@erase "$(INTDIR)\dso.obj"
-	-@erase "$(INTDIR)\env.obj"
-	-@erase "$(INTDIR)\errorcodes.obj"
-	-@erase "$(INTDIR)\fileacc.obj"
-	-@erase "$(INTDIR)\filedup.obj"
-	-@erase "$(INTDIR)\filepath.obj"
-	-@erase "$(INTDIR)\filepath_util.obj"
-	-@erase "$(INTDIR)\filestat.obj"
-	-@erase "$(INTDIR)\filesys.obj"
-	-@erase "$(INTDIR)\flock.obj"
-	-@erase "$(INTDIR)\fullrw.obj"
-	-@erase "$(INTDIR)\getopt.obj"
-	-@erase "$(INTDIR)\groupinfo.obj"
-	-@erase "$(INTDIR)\inet_ntop.obj"
-	-@erase "$(INTDIR)\inet_pton.obj"
-	-@erase "$(INTDIR)\internal.obj"
-	-@erase "$(INTDIR)\libapr.res"
-	-@erase "$(INTDIR)\libapr_src.idb"
-	-@erase "$(INTDIR)\libapr_src.pdb"
-	-@erase "$(INTDIR)\misc.obj"
-	-@erase "$(INTDIR)\mktemp.obj"
-	-@erase "$(INTDIR)\mmap.obj"
-	-@erase "$(INTDIR)\multicast.obj"
-	-@erase "$(INTDIR)\open.obj"
-	-@erase "$(INTDIR)\otherchild.obj"
-	-@erase "$(INTDIR)\pipe.obj"
-	-@erase "$(INTDIR)\poll.obj"
-	-@erase "$(INTDIR)\pollcb.obj"
-	-@erase "$(INTDIR)\pollset.obj"
-	-@erase "$(INTDIR)\proc.obj"
-	-@erase "$(INTDIR)\proc_mutex.obj"
-	-@erase "$(INTDIR)\rand.obj"
-	-@erase "$(INTDIR)\readwrite.obj"
-	-@erase "$(INTDIR)\seek.obj"
-	-@erase "$(INTDIR)\select.obj"
-	-@erase "$(INTDIR)\sendrecv.obj"
-	-@erase "$(INTDIR)\sha2.obj"
-	-@erase "$(INTDIR)\sha2_glue.obj"
-	-@erase "$(INTDIR)\shm.obj"
-	-@erase "$(INTDIR)\signals.obj"
-	-@erase "$(INTDIR)\sockaddr.obj"
-	-@erase "$(INTDIR)\socket_util.obj"
-	-@erase "$(INTDIR)\sockets.obj"
-	-@erase "$(INTDIR)\sockopt.obj"
-	-@erase "$(INTDIR)\start.obj"
-	-@erase "$(INTDIR)\tempdir.obj"
-	-@erase "$(INTDIR)\thread.obj"
-	-@erase "$(INTDIR)\thread_cond.obj"
-	-@erase "$(INTDIR)\thread_mutex.obj"
-	-@erase "$(INTDIR)\thread_rwlock.obj"
-	-@erase "$(INTDIR)\threadpriv.obj"
-	-@erase "$(INTDIR)\time.obj"
-	-@erase "$(INTDIR)\timestr.obj"
-	-@erase "$(INTDIR)\userinfo.obj"
-	-@erase "$(INTDIR)\utf8.obj"
-	-@erase "$(INTDIR)\version.obj"
-	-@erase "$(OUTDIR)\libapr-1.dll"
-	-@erase "$(OUTDIR)\libapr-1.exp"
-	-@erase "$(OUTDIR)\libapr-1.lib"
-	-@erase "$(OUTDIR)\libapr-1.pdb"
-	-@erase ".\include\apr.h"
-
-"$(OUTDIR)" :
-    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\libapr_src" /FD /EHsc /c 
-
-.c{$(INTDIR)}.obj::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.cpp{$(INTDIR)}.obj::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.cxx{$(INTDIR)}.obj::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.c{$(INTDIR)}.sbr::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.cpp{$(INTDIR)}.sbr::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.cxx{$(INTDIR)}.sbr::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-MTL=midl.exe
-MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" 
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libapr.res" /i "./include" /d "_DEBUG" /d "APR_VERSION_ONLY" 
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\libapr.bsc" 
-BSC32_SBRS= \
-	
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib" /MACHINE:X86 
-LINK32_OBJS= \
-	"$(INTDIR)\apr_atomic.obj" \
-	"$(INTDIR)\dso.obj" \
-	"$(INTDIR)\buffer.obj" \
-	"$(INTDIR)\copy.obj" \
-	"$(INTDIR)\dir.obj" \
-	"$(INTDIR)\fileacc.obj" \
-	"$(INTDIR)\filedup.obj" \
-	"$(INTDIR)\filepath.obj" \
-	"$(INTDIR)\filepath_util.obj" \
-	"$(INTDIR)\filestat.obj" \
-	"$(INTDIR)\filesys.obj" \
-	"$(INTDIR)\flock.obj" \
-	"$(INTDIR)\fullrw.obj" \
-	"$(INTDIR)\mktemp.obj" \
-	"$(INTDIR)\open.obj" \
-	"$(INTDIR)\pipe.obj" \
-	"$(INTDIR)\readwrite.obj" \
-	"$(INTDIR)\seek.obj" \
-	"$(INTDIR)\tempdir.obj" \
-	"$(INTDIR)\proc_mutex.obj" \
-	"$(INTDIR)\thread_cond.obj" \
-	"$(INTDIR)\thread_mutex.obj" \
-	"$(INTDIR)\thread_rwlock.obj" \
-	"$(INTDIR)\apr_pools.obj" \
-	"$(INTDIR)\charset.obj" \
-	"$(INTDIR)\env.obj" \
-	"$(INTDIR)\errorcodes.obj" \
-	"$(INTDIR)\getopt.obj" \
-	"$(INTDIR)\internal.obj" \
-	"$(INTDIR)\misc.obj" \
-	"$(INTDIR)\otherchild.obj" \
-	"$(INTDIR)\rand.obj" \
-	"$(INTDIR)\start.obj" \
-	"$(INTDIR)\utf8.obj" \
-	"$(INTDIR)\version.obj" \
-	"$(INTDIR)\common.obj" \
-	"$(INTDIR)\mmap.obj" \
-	"$(INTDIR)\inet_ntop.obj" \
-	"$(INTDIR)\inet_pton.obj" \
-	"$(INTDIR)\multicast.obj" \
-	"$(INTDIR)\sendrecv.obj" \
-	"$(INTDIR)\sockaddr.obj" \
-	"$(INTDIR)\sockets.obj" \
-	"$(INTDIR)\socket_util.obj" \
-	"$(INTDIR)\sockopt.obj" \
-	"$(INTDIR)\apr_getpass.obj" \
-	"$(INTDIR)\poll.obj" \
-	"$(INTDIR)\pollcb.obj" \
-	"$(INTDIR)\pollset.obj" \
-	"$(INTDIR)\select.obj" \
-	"$(INTDIR)\apr_random.obj" \
-	"$(INTDIR)\sha2.obj" \
-	"$(INTDIR)\sha2_glue.obj" \
-	"$(INTDIR)\shm.obj" \
-	"$(INTDIR)\apr_cpystrn.obj" \
-	"$(INTDIR)\apr_fnmatch.obj" \
-	"$(INTDIR)\apr_snprintf.obj" \
-	"$(INTDIR)\apr_strings.obj" \
-	"$(INTDIR)\apr_strnatcmp.obj" \
-	"$(INTDIR)\apr_strtok.obj" \
-	"$(INTDIR)\apr_hash.obj" \
-	"$(INTDIR)\apr_tables.obj" \
-	"$(INTDIR)\proc.obj" \
-	"$(INTDIR)\signals.obj" \
-	"$(INTDIR)\thread.obj" \
-	"$(INTDIR)\threadpriv.obj" \
-	"$(INTDIR)\time.obj" \
-	"$(INTDIR)\timestr.obj" \
-	"$(INTDIR)\groupinfo.obj" \
-	"$(INTDIR)\userinfo.obj" \
-	"$(INTDIR)\libapr.res"
-
-"$(OUTDIR)\libapr-1.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
-    $(LINK32) @<<
-  $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\Debug\libapr-1.dll
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\libapr-1.dll"
-   if exist .\Debug\libapr-1.dll.manifest mt.exe -manifest .\Debug\libapr-1.dll.manifest -outputresource:.\Debug\libapr-1.dll;2
-	echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ELSEIF  "$(CFG)" == "libapr - Win32 Release9x"
-
-OUTDIR=.\9x\Release
-INTDIR=.\9x\Release
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\9x\Release
-# End Custom Macros
-
-ALL : ".\include\apr.h" "$(OUTDIR)\libapr-1.dll" "$(DS_POSTBUILD_DEP)"
-
-
-CLEAN :
-	-@erase "$(INTDIR)\apr_atomic.obj"
-	-@erase "$(INTDIR)\apr_cpystrn.obj"
-	-@erase "$(INTDIR)\apr_fnmatch.obj"
-	-@erase "$(INTDIR)\apr_getpass.obj"
-	-@erase "$(INTDIR)\apr_hash.obj"
-	-@erase "$(INTDIR)\apr_pools.obj"
-	-@erase "$(INTDIR)\apr_random.obj"
-	-@erase "$(INTDIR)\apr_snprintf.obj"
-	-@erase "$(INTDIR)\apr_strings.obj"
-	-@erase "$(INTDIR)\apr_strnatcmp.obj"
-	-@erase "$(INTDIR)\apr_strtok.obj"
-	-@erase "$(INTDIR)\apr_tables.obj"
-	-@erase "$(INTDIR)\buffer.obj"
-	-@erase "$(INTDIR)\charset.obj"
-	-@erase "$(INTDIR)\common.obj"
-	-@erase "$(INTDIR)\copy.obj"
-	-@erase "$(INTDIR)\dir.obj"
-	-@erase "$(INTDIR)\dso.obj"
-	-@erase "$(INTDIR)\env.obj"
-	-@erase "$(INTDIR)\errorcodes.obj"
-	-@erase "$(INTDIR)\fileacc.obj"
-	-@erase "$(INTDIR)\filedup.obj"
-	-@erase "$(INTDIR)\filepath.obj"
-	-@erase "$(INTDIR)\filepath_util.obj"
-	-@erase "$(INTDIR)\filestat.obj"
-	-@erase "$(INTDIR)\filesys.obj"
-	-@erase "$(INTDIR)\flock.obj"
-	-@erase "$(INTDIR)\fullrw.obj"
-	-@erase "$(INTDIR)\getopt.obj"
-	-@erase "$(INTDIR)\groupinfo.obj"
-	-@erase "$(INTDIR)\inet_ntop.obj"
-	-@erase "$(INTDIR)\inet_pton.obj"
-	-@erase "$(INTDIR)\internal.obj"
-	-@erase "$(INTDIR)\libapr.res"
-	-@erase "$(INTDIR)\libapr_src.idb"
-	-@erase "$(INTDIR)\libapr_src.pdb"
-	-@erase "$(INTDIR)\misc.obj"
-	-@erase "$(INTDIR)\mktemp.obj"
-	-@erase "$(INTDIR)\mmap.obj"
-	-@erase "$(INTDIR)\multicast.obj"
-	-@erase "$(INTDIR)\open.obj"
-	-@erase "$(INTDIR)\otherchild.obj"
-	-@erase "$(INTDIR)\pipe.obj"
-	-@erase "$(INTDIR)\poll.obj"
-	-@erase "$(INTDIR)\pollcb.obj"
-	-@erase "$(INTDIR)\pollset.obj"
-	-@erase "$(INTDIR)\proc.obj"
-	-@erase "$(INTDIR)\proc_mutex.obj"
-	-@erase "$(INTDIR)\rand.obj"
-	-@erase "$(INTDIR)\readwrite.obj"
-	-@erase "$(INTDIR)\seek.obj"
-	-@erase "$(INTDIR)\select.obj"
-	-@erase "$(INTDIR)\sendrecv.obj"
-	-@erase "$(INTDIR)\sha2.obj"
-	-@erase "$(INTDIR)\sha2_glue.obj"
-	-@erase "$(INTDIR)\shm.obj"
-	-@erase "$(INTDIR)\signals.obj"
-	-@erase "$(INTDIR)\sockaddr.obj"
-	-@erase "$(INTDIR)\socket_util.obj"
-	-@erase "$(INTDIR)\sockets.obj"
-	-@erase "$(INTDIR)\sockopt.obj"
-	-@erase "$(INTDIR)\start.obj"
-	-@erase "$(INTDIR)\tempdir.obj"
-	-@erase "$(INTDIR)\thread.obj"
-	-@erase "$(INTDIR)\thread_cond.obj"
-	-@erase "$(INTDIR)\thread_mutex.obj"
-	-@erase "$(INTDIR)\thread_rwlock.obj"
-	-@erase "$(INTDIR)\threadpriv.obj"
-	-@erase "$(INTDIR)\time.obj"
-	-@erase "$(INTDIR)\timestr.obj"
-	-@erase "$(INTDIR)\userinfo.obj"
-	-@erase "$(INTDIR)\utf8.obj"
-	-@erase "$(INTDIR)\version.obj"
-	-@erase "$(OUTDIR)\libapr-1.dll"
-	-@erase "$(OUTDIR)\libapr-1.exp"
-	-@erase "$(OUTDIR)\libapr-1.lib"
-	-@erase "$(OUTDIR)\libapr-1.pdb"
-	-@erase ".\include\apr.h"
-
-"$(OUTDIR)" :
-    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\libapr_src" /FD /c 
-
-.c{$(INTDIR)}.obj::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.cpp{$(INTDIR)}.obj::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.cxx{$(INTDIR)}.obj::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.c{$(INTDIR)}.sbr::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.cpp{$(INTDIR)}.sbr::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.cxx{$(INTDIR)}.sbr::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-MTL=midl.exe
-MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" 
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libapr.res" /i "./include" /d "NDEBUG" /d "APR_VERSION_ONLY" 
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\libapr.bsc" 
-BSC32_SBRS= \
-	
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib" /MACHINE:X86 /opt:ref 
-LINK32_OBJS= \
-	"$(INTDIR)\apr_atomic.obj" \
-	"$(INTDIR)\dso.obj" \
-	"$(INTDIR)\buffer.obj" \
-	"$(INTDIR)\copy.obj" \
-	"$(INTDIR)\dir.obj" \
-	"$(INTDIR)\fileacc.obj" \
-	"$(INTDIR)\filedup.obj" \
-	"$(INTDIR)\filepath.obj" \
-	"$(INTDIR)\filepath_util.obj" \
-	"$(INTDIR)\filestat.obj" \
-	"$(INTDIR)\filesys.obj" \
-	"$(INTDIR)\flock.obj" \
-	"$(INTDIR)\fullrw.obj" \
-	"$(INTDIR)\mktemp.obj" \
-	"$(INTDIR)\open.obj" \
-	"$(INTDIR)\pipe.obj" \
-	"$(INTDIR)\readwrite.obj" \
-	"$(INTDIR)\seek.obj" \
-	"$(INTDIR)\tempdir.obj" \
-	"$(INTDIR)\proc_mutex.obj" \
-	"$(INTDIR)\thread_cond.obj" \
-	"$(INTDIR)\thread_mutex.obj" \
-	"$(INTDIR)\thread_rwlock.obj" \
-	"$(INTDIR)\apr_pools.obj" \
-	"$(INTDIR)\charset.obj" \
-	"$(INTDIR)\env.obj" \
-	"$(INTDIR)\errorcodes.obj" \
-	"$(INTDIR)\getopt.obj" \
-	"$(INTDIR)\internal.obj" \
-	"$(INTDIR)\misc.obj" \
-	"$(INTDIR)\otherchild.obj" \
-	"$(INTDIR)\rand.obj" \
-	"$(INTDIR)\start.obj" \
-	"$(INTDIR)\utf8.obj" \
-	"$(INTDIR)\version.obj" \
-	"$(INTDIR)\common.obj" \
-	"$(INTDIR)\mmap.obj" \
-	"$(INTDIR)\inet_ntop.obj" \
-	"$(INTDIR)\inet_pton.obj" \
-	"$(INTDIR)\multicast.obj" \
-	"$(INTDIR)\sendrecv.obj" \
-	"$(INTDIR)\sockaddr.obj" \
-	"$(INTDIR)\sockets.obj" \
-	"$(INTDIR)\socket_util.obj" \
-	"$(INTDIR)\sockopt.obj" \
-	"$(INTDIR)\apr_getpass.obj" \
-	"$(INTDIR)\poll.obj" \
-	"$(INTDIR)\pollcb.obj" \
-	"$(INTDIR)\pollset.obj" \
-	"$(INTDIR)\select.obj" \
-	"$(INTDIR)\apr_random.obj" \
-	"$(INTDIR)\sha2.obj" \
-	"$(INTDIR)\sha2_glue.obj" \
-	"$(INTDIR)\shm.obj" \
-	"$(INTDIR)\apr_cpystrn.obj" \
-	"$(INTDIR)\apr_fnmatch.obj" \
-	"$(INTDIR)\apr_snprintf.obj" \
-	"$(INTDIR)\apr_strings.obj" \
-	"$(INTDIR)\apr_strnatcmp.obj" \
-	"$(INTDIR)\apr_strtok.obj" \
-	"$(INTDIR)\apr_hash.obj" \
-	"$(INTDIR)\apr_tables.obj" \
-	"$(INTDIR)\proc.obj" \
-	"$(INTDIR)\signals.obj" \
-	"$(INTDIR)\thread.obj" \
-	"$(INTDIR)\threadpriv.obj" \
-	"$(INTDIR)\time.obj" \
-	"$(INTDIR)\timestr.obj" \
-	"$(INTDIR)\groupinfo.obj" \
-	"$(INTDIR)\userinfo.obj" \
-	"$(INTDIR)\libapr.res"
-
-"$(OUTDIR)\libapr-1.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
-    $(LINK32) @<<
-  $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\9x\Release\libapr-1.dll
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\9x\Release
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\libapr-1.dll"
-   if exist .\9x\Release\libapr-1.dll.manifest mt.exe -manifest .\9x\Release\libapr-1.dll.manifest -outputresource:.\9x\Release\libapr-1.dll;2
-	echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ELSEIF  "$(CFG)" == "libapr - Win32 Debug9x"
-
-OUTDIR=.\9x\Debug
-INTDIR=.\9x\Debug
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\9x\Debug
-# End Custom Macros
-
-ALL : ".\include\apr.h" "$(OUTDIR)\libapr-1.dll" "$(DS_POSTBUILD_DEP)"
-
-
-CLEAN :
-	-@erase "$(INTDIR)\apr_atomic.obj"
-	-@erase "$(INTDIR)\apr_cpystrn.obj"
-	-@erase "$(INTDIR)\apr_fnmatch.obj"
-	-@erase "$(INTDIR)\apr_getpass.obj"
-	-@erase "$(INTDIR)\apr_hash.obj"
-	-@erase "$(INTDIR)\apr_pools.obj"
-	-@erase "$(INTDIR)\apr_random.obj"
-	-@erase "$(INTDIR)\apr_snprintf.obj"
-	-@erase "$(INTDIR)\apr_strings.obj"
-	-@erase "$(INTDIR)\apr_strnatcmp.obj"
-	-@erase "$(INTDIR)\apr_strtok.obj"
-	-@erase "$(INTDIR)\apr_tables.obj"
-	-@erase "$(INTDIR)\buffer.obj"
-	-@erase "$(INTDIR)\charset.obj"
-	-@erase "$(INTDIR)\common.obj"
-	-@erase "$(INTDIR)\copy.obj"
-	-@erase "$(INTDIR)\dir.obj"
-	-@erase "$(INTDIR)\dso.obj"
-	-@erase "$(INTDIR)\env.obj"
-	-@erase "$(INTDIR)\errorcodes.obj"
-	-@erase "$(INTDIR)\fileacc.obj"
-	-@erase "$(INTDIR)\filedup.obj"
-	-@erase "$(INTDIR)\filepath.obj"
-	-@erase "$(INTDIR)\filepath_util.obj"
-	-@erase "$(INTDIR)\filestat.obj"
-	-@erase "$(INTDIR)\filesys.obj"
-	-@erase "$(INTDIR)\flock.obj"
-	-@erase "$(INTDIR)\fullrw.obj"
-	-@erase "$(INTDIR)\getopt.obj"
-	-@erase "$(INTDIR)\groupinfo.obj"
-	-@erase "$(INTDIR)\inet_ntop.obj"
-	-@erase "$(INTDIR)\inet_pton.obj"
-	-@erase "$(INTDIR)\internal.obj"
-	-@erase "$(INTDIR)\libapr.res"
-	-@erase "$(INTDIR)\libapr_src.idb"
-	-@erase "$(INTDIR)\libapr_src.pdb"
-	-@erase "$(INTDIR)\misc.obj"
-	-@erase "$(INTDIR)\mktemp.obj"
-	-@erase "$(INTDIR)\mmap.obj"
-	-@erase "$(INTDIR)\multicast.obj"
-	-@erase "$(INTDIR)\open.obj"
-	-@erase "$(INTDIR)\otherchild.obj"
-	-@erase "$(INTDIR)\pipe.obj"
-	-@erase "$(INTDIR)\poll.obj"
-	-@erase "$(INTDIR)\pollcb.obj"
-	-@erase "$(INTDIR)\pollset.obj"
-	-@erase "$(INTDIR)\proc.obj"
-	-@erase "$(INTDIR)\proc_mutex.obj"
-	-@erase "$(INTDIR)\rand.obj"
-	-@erase "$(INTDIR)\readwrite.obj"
-	-@erase "$(INTDIR)\seek.obj"
-	-@erase "$(INTDIR)\select.obj"
-	-@erase "$(INTDIR)\sendrecv.obj"
-	-@erase "$(INTDIR)\sha2.obj"
-	-@erase "$(INTDIR)\sha2_glue.obj"
-	-@erase "$(INTDIR)\shm.obj"
-	-@erase "$(INTDIR)\signals.obj"
-	-@erase "$(INTDIR)\sockaddr.obj"
-	-@erase "$(INTDIR)\socket_util.obj"
-	-@erase "$(INTDIR)\sockets.obj"
-	-@erase "$(INTDIR)\sockopt.obj"
-	-@erase "$(INTDIR)\start.obj"
-	-@erase "$(INTDIR)\tempdir.obj"
-	-@erase "$(INTDIR)\thread.obj"
-	-@erase "$(INTDIR)\thread_cond.obj"
-	-@erase "$(INTDIR)\thread_mutex.obj"
-	-@erase "$(INTDIR)\thread_rwlock.obj"
-	-@erase "$(INTDIR)\threadpriv.obj"
-	-@erase "$(INTDIR)\time.obj"
-	-@erase "$(INTDIR)\timestr.obj"
-	-@erase "$(INTDIR)\userinfo.obj"
-	-@erase "$(INTDIR)\utf8.obj"
-	-@erase "$(INTDIR)\version.obj"
-	-@erase "$(OUTDIR)\libapr-1.dll"
-	-@erase "$(OUTDIR)\libapr-1.exp"
-	-@erase "$(OUTDIR)\libapr-1.lib"
-	-@erase "$(OUTDIR)\libapr-1.pdb"
-	-@erase ".\include\apr.h"
-
-"$(OUTDIR)" :
-    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\libapr_src" /FD /EHsc /c 
-
-.c{$(INTDIR)}.obj::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.cpp{$(INTDIR)}.obj::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.cxx{$(INTDIR)}.obj::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.c{$(INTDIR)}.sbr::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.cpp{$(INTDIR)}.sbr::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.cxx{$(INTDIR)}.sbr::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-MTL=midl.exe
-MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" 
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libapr.res" /i "./include" /d "_DEBUG" /d "APR_VERSION_ONLY" 
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\libapr.bsc" 
-BSC32_SBRS= \
-	
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib" /MACHINE:X86 
-LINK32_OBJS= \
-	"$(INTDIR)\apr_atomic.obj" \
-	"$(INTDIR)\dso.obj" \
-	"$(INTDIR)\buffer.obj" \
-	"$(INTDIR)\copy.obj" \
-	"$(INTDIR)\dir.obj" \
-	"$(INTDIR)\fileacc.obj" \
-	"$(INTDIR)\filedup.obj" \
-	"$(INTDIR)\filepath.obj" \
-	"$(INTDIR)\filepath_util.obj" \
-	"$(INTDIR)\filestat.obj" \
-	"$(INTDIR)\filesys.obj" \
-	"$(INTDIR)\flock.obj" \
-	"$(INTDIR)\fullrw.obj" \
-	"$(INTDIR)\mktemp.obj" \
-	"$(INTDIR)\open.obj" \
-	"$(INTDIR)\pipe.obj" \
-	"$(INTDIR)\readwrite.obj" \
-	"$(INTDIR)\seek.obj" \
-	"$(INTDIR)\tempdir.obj" \
-	"$(INTDIR)\proc_mutex.obj" \
-	"$(INTDIR)\thread_cond.obj" \
-	"$(INTDIR)\thread_mutex.obj" \
-	"$(INTDIR)\thread_rwlock.obj" \
-	"$(INTDIR)\apr_pools.obj" \
-	"$(INTDIR)\charset.obj" \
-	"$(INTDIR)\env.obj" \
-	"$(INTDIR)\errorcodes.obj" \
-	"$(INTDIR)\getopt.obj" \
-	"$(INTDIR)\internal.obj" \
-	"$(INTDIR)\misc.obj" \
-	"$(INTDIR)\otherchild.obj" \
-	"$(INTDIR)\rand.obj" \
-	"$(INTDIR)\start.obj" \
-	"$(INTDIR)\utf8.obj" \
-	"$(INTDIR)\version.obj" \
-	"$(INTDIR)\common.obj" \
-	"$(INTDIR)\mmap.obj" \
-	"$(INTDIR)\inet_ntop.obj" \
-	"$(INTDIR)\inet_pton.obj" \
-	"$(INTDIR)\multicast.obj" \
-	"$(INTDIR)\sendrecv.obj" \
-	"$(INTDIR)\sockaddr.obj" \
-	"$(INTDIR)\sockets.obj" \
-	"$(INTDIR)\socket_util.obj" \
-	"$(INTDIR)\sockopt.obj" \
-	"$(INTDIR)\apr_getpass.obj" \
-	"$(INTDIR)\poll.obj" \
-	"$(INTDIR)\pollcb.obj" \
-	"$(INTDIR)\pollset.obj" \
-	"$(INTDIR)\select.obj" \
-	"$(INTDIR)\apr_random.obj" \
-	"$(INTDIR)\sha2.obj" \
-	"$(INTDIR)\sha2_glue.obj" \
-	"$(INTDIR)\shm.obj" \
-	"$(INTDIR)\apr_cpystrn.obj" \
-	"$(INTDIR)\apr_fnmatch.obj" \
-	"$(INTDIR)\apr_snprintf.obj" \
-	"$(INTDIR)\apr_strings.obj" \
-	"$(INTDIR)\apr_strnatcmp.obj" \
-	"$(INTDIR)\apr_strtok.obj" \
-	"$(INTDIR)\apr_hash.obj" \
-	"$(INTDIR)\apr_tables.obj" \
-	"$(INTDIR)\proc.obj" \
-	"$(INTDIR)\signals.obj" \
-	"$(INTDIR)\thread.obj" \
-	"$(INTDIR)\threadpriv.obj" \
-	"$(INTDIR)\time.obj" \
-	"$(INTDIR)\timestr.obj" \
-	"$(INTDIR)\groupinfo.obj" \
-	"$(INTDIR)\userinfo.obj" \
-	"$(INTDIR)\libapr.res"
-
-"$(OUTDIR)\libapr-1.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
-    $(LINK32) @<<
-  $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\9x\Debug\libapr-1.dll
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\9x\Debug
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\libapr-1.dll"
-   if exist .\9x\Debug\libapr-1.dll.manifest mt.exe -manifest .\9x\Debug\libapr-1.dll.manifest -outputresource:.\9x\Debug\libapr-1.dll;2
-	echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ELSEIF  "$(CFG)" == "libapr - x64 Release"
-
-OUTDIR=.\x64\Release
-INTDIR=.\x64\Release
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\x64\Release
-# End Custom Macros
-
-ALL : ".\include\apr.h" "$(OUTDIR)\libapr-1.dll" "$(DS_POSTBUILD_DEP)"
-
-
-CLEAN :
-	-@erase "$(INTDIR)\apr_atomic.obj"
-	-@erase "$(INTDIR)\apr_cpystrn.obj"
-	-@erase "$(INTDIR)\apr_fnmatch.obj"
-	-@erase "$(INTDIR)\apr_getpass.obj"
-	-@erase "$(INTDIR)\apr_hash.obj"
-	-@erase "$(INTDIR)\apr_pools.obj"
-	-@erase "$(INTDIR)\apr_random.obj"
-	-@erase "$(INTDIR)\apr_snprintf.obj"
-	-@erase "$(INTDIR)\apr_strings.obj"
-	-@erase "$(INTDIR)\apr_strnatcmp.obj"
-	-@erase "$(INTDIR)\apr_strtok.obj"
-	-@erase "$(INTDIR)\apr_tables.obj"
-	-@erase "$(INTDIR)\buffer.obj"
-	-@erase "$(INTDIR)\charset.obj"
-	-@erase "$(INTDIR)\common.obj"
-	-@erase "$(INTDIR)\copy.obj"
-	-@erase "$(INTDIR)\dir.obj"
-	-@erase "$(INTDIR)\dso.obj"
-	-@erase "$(INTDIR)\env.obj"
-	-@erase "$(INTDIR)\errorcodes.obj"
-	-@erase "$(INTDIR)\fileacc.obj"
-	-@erase "$(INTDIR)\filedup.obj"
-	-@erase "$(INTDIR)\filepath.obj"
-	-@erase "$(INTDIR)\filepath_util.obj"
-	-@erase "$(INTDIR)\filestat.obj"
-	-@erase "$(INTDIR)\filesys.obj"
-	-@erase "$(INTDIR)\flock.obj"
-	-@erase "$(INTDIR)\fullrw.obj"
-	-@erase "$(INTDIR)\getopt.obj"
-	-@erase "$(INTDIR)\groupinfo.obj"
-	-@erase "$(INTDIR)\inet_ntop.obj"
-	-@erase "$(INTDIR)\inet_pton.obj"
-	-@erase "$(INTDIR)\internal.obj"
-	-@erase "$(INTDIR)\libapr.res"
-	-@erase "$(INTDIR)\libapr_src.idb"
-	-@erase "$(INTDIR)\libapr_src.pdb"
-	-@erase "$(INTDIR)\misc.obj"
-	-@erase "$(INTDIR)\mktemp.obj"
-	-@erase "$(INTDIR)\mmap.obj"
-	-@erase "$(INTDIR)\multicast.obj"
-	-@erase "$(INTDIR)\open.obj"
-	-@erase "$(INTDIR)\otherchild.obj"
-	-@erase "$(INTDIR)\pipe.obj"
-	-@erase "$(INTDIR)\poll.obj"
-	-@erase "$(INTDIR)\pollcb.obj"
-	-@erase "$(INTDIR)\pollset.obj"
-	-@erase "$(INTDIR)\proc.obj"
-	-@erase "$(INTDIR)\proc_mutex.obj"
-	-@erase "$(INTDIR)\rand.obj"
-	-@erase "$(INTDIR)\readwrite.obj"
-	-@erase "$(INTDIR)\seek.obj"
-	-@erase "$(INTDIR)\select.obj"
-	-@erase "$(INTDIR)\sendrecv.obj"
-	-@erase "$(INTDIR)\sha2.obj"
-	-@erase "$(INTDIR)\sha2_glue.obj"
-	-@erase "$(INTDIR)\shm.obj"
-	-@erase "$(INTDIR)\signals.obj"
-	-@erase "$(INTDIR)\sockaddr.obj"
-	-@erase "$(INTDIR)\socket_util.obj"
-	-@erase "$(INTDIR)\sockets.obj"
-	-@erase "$(INTDIR)\sockopt.obj"
-	-@erase "$(INTDIR)\start.obj"
-	-@erase "$(INTDIR)\tempdir.obj"
-	-@erase "$(INTDIR)\thread.obj"
-	-@erase "$(INTDIR)\thread_cond.obj"
-	-@erase "$(INTDIR)\thread_mutex.obj"
-	-@erase "$(INTDIR)\thread_rwlock.obj"
-	-@erase "$(INTDIR)\threadpriv.obj"
-	-@erase "$(INTDIR)\time.obj"
-	-@erase "$(INTDIR)\timestr.obj"
-	-@erase "$(INTDIR)\userinfo.obj"
-	-@erase "$(INTDIR)\utf8.obj"
-	-@erase "$(INTDIR)\version.obj"
-	-@erase "$(OUTDIR)\libapr-1.dll"
-	-@erase "$(OUTDIR)\libapr-1.exp"
-	-@erase "$(OUTDIR)\libapr-1.lib"
-	-@erase "$(OUTDIR)\libapr-1.pdb"
-	-@erase ".\include\apr.h"
-
-"$(OUTDIR)" :
-    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\libapr_src" /FD /c 
-
-.c{$(INTDIR)}.obj::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.cpp{$(INTDIR)}.obj::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.cxx{$(INTDIR)}.obj::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.c{$(INTDIR)}.sbr::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.cpp{$(INTDIR)}.sbr::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.cxx{$(INTDIR)}.sbr::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-MTL=midl.exe
-MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" 
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libapr.res" /i "./include" /d "NDEBUG" /d "APR_VERSION_ONLY" 
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\libapr.bsc" 
-BSC32_SBRS= \
-	
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib" /MACHINE:X64 /opt:ref 
-LINK32_OBJS= \
-	"$(INTDIR)\apr_atomic.obj" \
-	"$(INTDIR)\dso.obj" \
-	"$(INTDIR)\buffer.obj" \
-	"$(INTDIR)\copy.obj" \
-	"$(INTDIR)\dir.obj" \
-	"$(INTDIR)\fileacc.obj" \
-	"$(INTDIR)\filedup.obj" \
-	"$(INTDIR)\filepath.obj" \
-	"$(INTDIR)\filepath_util.obj" \
-	"$(INTDIR)\filestat.obj" \
-	"$(INTDIR)\filesys.obj" \
-	"$(INTDIR)\flock.obj" \
-	"$(INTDIR)\fullrw.obj" \
-	"$(INTDIR)\mktemp.obj" \
-	"$(INTDIR)\open.obj" \
-	"$(INTDIR)\pipe.obj" \
-	"$(INTDIR)\readwrite.obj" \
-	"$(INTDIR)\seek.obj" \
-	"$(INTDIR)\tempdir.obj" \
-	"$(INTDIR)\proc_mutex.obj" \
-	"$(INTDIR)\thread_cond.obj" \
-	"$(INTDIR)\thread_mutex.obj" \
-	"$(INTDIR)\thread_rwlock.obj" \
-	"$(INTDIR)\apr_pools.obj" \
-	"$(INTDIR)\charset.obj" \
-	"$(INTDIR)\env.obj" \
-	"$(INTDIR)\errorcodes.obj" \
-	"$(INTDIR)\getopt.obj" \
-	"$(INTDIR)\internal.obj" \
-	"$(INTDIR)\misc.obj" \
-	"$(INTDIR)\otherchild.obj" \
-	"$(INTDIR)\rand.obj" \
-	"$(INTDIR)\start.obj" \
-	"$(INTDIR)\utf8.obj" \
-	"$(INTDIR)\version.obj" \
-	"$(INTDIR)\common.obj" \
-	"$(INTDIR)\mmap.obj" \
-	"$(INTDIR)\inet_ntop.obj" \
-	"$(INTDIR)\inet_pton.obj" \
-	"$(INTDIR)\multicast.obj" \
-	"$(INTDIR)\sendrecv.obj" \
-	"$(INTDIR)\sockaddr.obj" \
-	"$(INTDIR)\sockets.obj" \
-	"$(INTDIR)\socket_util.obj" \
-	"$(INTDIR)\sockopt.obj" \
-	"$(INTDIR)\apr_getpass.obj" \
-	"$(INTDIR)\poll.obj" \
-	"$(INTDIR)\pollcb.obj" \
-	"$(INTDIR)\pollset.obj" \
-	"$(INTDIR)\select.obj" \
-	"$(INTDIR)\apr_random.obj" \
-	"$(INTDIR)\sha2.obj" \
-	"$(INTDIR)\sha2_glue.obj" \
-	"$(INTDIR)\shm.obj" \
-	"$(INTDIR)\apr_cpystrn.obj" \
-	"$(INTDIR)\apr_fnmatch.obj" \
-	"$(INTDIR)\apr_snprintf.obj" \
-	"$(INTDIR)\apr_strings.obj" \
-	"$(INTDIR)\apr_strnatcmp.obj" \
-	"$(INTDIR)\apr_strtok.obj" \
-	"$(INTDIR)\apr_hash.obj" \
-	"$(INTDIR)\apr_tables.obj" \
-	"$(INTDIR)\proc.obj" \
-	"$(INTDIR)\signals.obj" \
-	"$(INTDIR)\thread.obj" \
-	"$(INTDIR)\threadpriv.obj" \
-	"$(INTDIR)\time.obj" \
-	"$(INTDIR)\timestr.obj" \
-	"$(INTDIR)\groupinfo.obj" \
-	"$(INTDIR)\userinfo.obj" \
-	"$(INTDIR)\libapr.res"
-
-"$(OUTDIR)\libapr-1.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
-    $(LINK32) @<<
-  $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\x64\Release\libapr-1.dll
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\x64\Release
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\libapr-1.dll"
-   if exist .\x64\Release\libapr-1.dll.manifest mt.exe -manifest .\x64\Release\libapr-1.dll.manifest -outputresource:.\x64\Release\libapr-1.dll;2
-	echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ELSEIF  "$(CFG)" == "libapr - x64 Debug"
-
-OUTDIR=.\x64\Debug
-INTDIR=.\x64\Debug
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\x64\Debug
-# End Custom Macros
-
-ALL : ".\include\apr.h" "$(OUTDIR)\libapr-1.dll" "$(DS_POSTBUILD_DEP)"
-
-
-CLEAN :
-	-@erase "$(INTDIR)\apr_atomic.obj"
-	-@erase "$(INTDIR)\apr_cpystrn.obj"
-	-@erase "$(INTDIR)\apr_fnmatch.obj"
-	-@erase "$(INTDIR)\apr_getpass.obj"
-	-@erase "$(INTDIR)\apr_hash.obj"
-	-@erase "$(INTDIR)\apr_pools.obj"
-	-@erase "$(INTDIR)\apr_random.obj"
-	-@erase "$(INTDIR)\apr_snprintf.obj"
-	-@erase "$(INTDIR)\apr_strings.obj"
-	-@erase "$(INTDIR)\apr_strnatcmp.obj"
-	-@erase "$(INTDIR)\apr_strtok.obj"
-	-@erase "$(INTDIR)\apr_tables.obj"
-	-@erase "$(INTDIR)\buffer.obj"
-	-@erase "$(INTDIR)\charset.obj"
-	-@erase "$(INTDIR)\common.obj"
-	-@erase "$(INTDIR)\copy.obj"
-	-@erase "$(INTDIR)\dir.obj"
-	-@erase "$(INTDIR)\dso.obj"
-	-@erase "$(INTDIR)\env.obj"
-	-@erase "$(INTDIR)\errorcodes.obj"
-	-@erase "$(INTDIR)\fileacc.obj"
-	-@erase "$(INTDIR)\filedup.obj"
-	-@erase "$(INTDIR)\filepath.obj"
-	-@erase "$(INTDIR)\filepath_util.obj"
-	-@erase "$(INTDIR)\filestat.obj"
-	-@erase "$(INTDIR)\filesys.obj"
-	-@erase "$(INTDIR)\flock.obj"
-	-@erase "$(INTDIR)\fullrw.obj"
-	-@erase "$(INTDIR)\getopt.obj"
-	-@erase "$(INTDIR)\groupinfo.obj"
-	-@erase "$(INTDIR)\inet_ntop.obj"
-	-@erase "$(INTDIR)\inet_pton.obj"
-	-@erase "$(INTDIR)\internal.obj"
-	-@erase "$(INTDIR)\libapr.res"
-	-@erase "$(INTDIR)\libapr_src.idb"
-	-@erase "$(INTDIR)\libapr_src.pdb"
-	-@erase "$(INTDIR)\misc.obj"
-	-@erase "$(INTDIR)\mktemp.obj"
-	-@erase "$(INTDIR)\mmap.obj"
-	-@erase "$(INTDIR)\multicast.obj"
-	-@erase "$(INTDIR)\open.obj"
-	-@erase "$(INTDIR)\otherchild.obj"
-	-@erase "$(INTDIR)\pipe.obj"
-	-@erase "$(INTDIR)\poll.obj"
-	-@erase "$(INTDIR)\pollcb.obj"
-	-@erase "$(INTDIR)\pollset.obj"
-	-@erase "$(INTDIR)\proc.obj"
-	-@erase "$(INTDIR)\proc_mutex.obj"
-	-@erase "$(INTDIR)\rand.obj"
-	-@erase "$(INTDIR)\readwrite.obj"
-	-@erase "$(INTDIR)\seek.obj"
-	-@erase "$(INTDIR)\select.obj"
-	-@erase "$(INTDIR)\sendrecv.obj"
-	-@erase "$(INTDIR)\sha2.obj"
-	-@erase "$(INTDIR)\sha2_glue.obj"
-	-@erase "$(INTDIR)\shm.obj"
-	-@erase "$(INTDIR)\signals.obj"
-	-@erase "$(INTDIR)\sockaddr.obj"
-	-@erase "$(INTDIR)\socket_util.obj"
-	-@erase "$(INTDIR)\sockets.obj"
-	-@erase "$(INTDIR)\sockopt.obj"
-	-@erase "$(INTDIR)\start.obj"
-	-@erase "$(INTDIR)\tempdir.obj"
-	-@erase "$(INTDIR)\thread.obj"
-	-@erase "$(INTDIR)\thread_cond.obj"
-	-@erase "$(INTDIR)\thread_mutex.obj"
-	-@erase "$(INTDIR)\thread_rwlock.obj"
-	-@erase "$(INTDIR)\threadpriv.obj"
-	-@erase "$(INTDIR)\time.obj"
-	-@erase "$(INTDIR)\timestr.obj"
-	-@erase "$(INTDIR)\userinfo.obj"
-	-@erase "$(INTDIR)\utf8.obj"
-	-@erase "$(INTDIR)\version.obj"
-	-@erase "$(OUTDIR)\libapr-1.dll"
-	-@erase "$(OUTDIR)\libapr-1.exp"
-	-@erase "$(OUTDIR)\libapr-1.lib"
-	-@erase "$(OUTDIR)\libapr-1.pdb"
-	-@erase ".\include\apr.h"
-
-"$(OUTDIR)" :
-    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\libapr_src" /FD /EHsc /c 
-
-.c{$(INTDIR)}.obj::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.cpp{$(INTDIR)}.obj::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.cxx{$(INTDIR)}.obj::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.c{$(INTDIR)}.sbr::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.cpp{$(INTDIR)}.sbr::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-.cxx{$(INTDIR)}.sbr::
-   $(CPP) @<<
-   $(CPP_PROJ) $< 
-<<
-
-MTL=midl.exe
-MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" 
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libapr.res" /i "./include" /d "_DEBUG" /d "APR_VERSION_ONLY" 
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\libapr.bsc" 
-BSC32_SBRS= \
-	
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib" /MACHINE:X64 
-LINK32_OBJS= \
-	"$(INTDIR)\apr_atomic.obj" \
-	"$(INTDIR)\dso.obj" \
-	"$(INTDIR)\buffer.obj" \
-	"$(INTDIR)\copy.obj" \
-	"$(INTDIR)\dir.obj" \
-	"$(INTDIR)\fileacc.obj" \
-	"$(INTDIR)\filedup.obj" \
-	"$(INTDIR)\filepath.obj" \
-	"$(INTDIR)\filepath_util.obj" \
-	"$(INTDIR)\filestat.obj" \
-	"$(INTDIR)\filesys.obj" \
-	"$(INTDIR)\flock.obj" \
-	"$(INTDIR)\fullrw.obj" \
-	"$(INTDIR)\mktemp.obj" \
-	"$(INTDIR)\open.obj" \
-	"$(INTDIR)\pipe.obj" \
-	"$(INTDIR)\readwrite.obj" \
-	"$(INTDIR)\seek.obj" \
-	"$(INTDIR)\tempdir.obj" \
-	"$(INTDIR)\proc_mutex.obj" \
-	"$(INTDIR)\thread_cond.obj" \
-	"$(INTDIR)\thread_mutex.obj" \
-	"$(INTDIR)\thread_rwlock.obj" \
-	"$(INTDIR)\apr_pools.obj" \
-	"$(INTDIR)\charset.obj" \
-	"$(INTDIR)\env.obj" \
-	"$(INTDIR)\errorcodes.obj" \
-	"$(INTDIR)\getopt.obj" \
-	"$(INTDIR)\internal.obj" \
-	"$(INTDIR)\misc.obj" \
-	"$(INTDIR)\otherchild.obj" \
-	"$(INTDIR)\rand.obj" \
-	"$(INTDIR)\start.obj" \
-	"$(INTDIR)\utf8.obj" \
-	"$(INTDIR)\version.obj" \
-	"$(INTDIR)\common.obj" \
-	"$(INTDIR)\mmap.obj" \
-	"$(INTDIR)\inet_ntop.obj" \
-	"$(INTDIR)\inet_pton.obj" \
-	"$(INTDIR)\multicast.obj" \
-	"$(INTDIR)\sendrecv.obj" \
-	"$(INTDIR)\sockaddr.obj" \
-	"$(INTDIR)\sockets.obj" \
-	"$(INTDIR)\socket_util.obj" \
-	"$(INTDIR)\sockopt.obj" \
-	"$(INTDIR)\apr_getpass.obj" \
-	"$(INTDIR)\poll.obj" \
-	"$(INTDIR)\pollcb.obj" \
-	"$(INTDIR)\pollset.obj" \
-	"$(INTDIR)\select.obj" \
-	"$(INTDIR)\apr_random.obj" \
-	"$(INTDIR)\sha2.obj" \
-	"$(INTDIR)\sha2_glue.obj" \
-	"$(INTDIR)\shm.obj" \
-	"$(INTDIR)\apr_cpystrn.obj" \
-	"$(INTDIR)\apr_fnmatch.obj" \
-	"$(INTDIR)\apr_snprintf.obj" \
-	"$(INTDIR)\apr_strings.obj" \
-	"$(INTDIR)\apr_strnatcmp.obj" \
-	"$(INTDIR)\apr_strtok.obj" \
-	"$(INTDIR)\apr_hash.obj" \
-	"$(INTDIR)\apr_tables.obj" \
-	"$(INTDIR)\proc.obj" \
-	"$(INTDIR)\signals.obj" \
-	"$(INTDIR)\thread.obj" \
-	"$(INTDIR)\threadpriv.obj" \
-	"$(INTDIR)\time.obj" \
-	"$(INTDIR)\timestr.obj" \
-	"$(INTDIR)\groupinfo.obj" \
-	"$(INTDIR)\userinfo.obj" \
-	"$(INTDIR)\libapr.res"
-
-"$(OUTDIR)\libapr-1.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
-    $(LINK32) @<<
-  $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\x64\Debug\libapr-1.dll
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\x64\Debug
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\libapr-1.dll"
-   if exist .\x64\Debug\libapr-1.dll.manifest mt.exe -manifest .\x64\Debug\libapr-1.dll.manifest -outputresource:.\x64\Debug\libapr-1.dll;2
-	echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ENDIF 
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("libapr.dep")
-!INCLUDE "libapr.dep"
-!ELSE 
-!MESSAGE Warning: cannot find "libapr.dep"
-!ENDIF 
-!ENDIF 
-
-
-!IF "$(CFG)" == "libapr - Win32 Release" || "$(CFG)" == "libapr - Win32 Debug" || "$(CFG)" == "libapr - Win32 Release9x" || "$(CFG)" == "libapr - Win32 Debug9x" || "$(CFG)" == "libapr - x64 Release" || "$(CFG)" == "libapr - x64 Debug"
-SOURCE=.\atomic\win32\apr_atomic.c
-
-"$(INTDIR)\apr_atomic.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\dso\win32\dso.c
-
-"$(INTDIR)\dso.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\file_io\win32\buffer.c
-
-"$(INTDIR)\buffer.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\file_io\unix\copy.c
-
-"$(INTDIR)\copy.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\file_io\win32\dir.c
-
-"$(INTDIR)\dir.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\file_io\unix\fileacc.c
-
-"$(INTDIR)\fileacc.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\file_io\win32\filedup.c
-
-"$(INTDIR)\filedup.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\file_io\win32\filepath.c
-
-"$(INTDIR)\filepath.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\file_io\unix\filepath_util.c
-
-"$(INTDIR)\filepath_util.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\file_io\win32\filestat.c
-
-"$(INTDIR)\filestat.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\file_io\win32\filesys.c
-
-"$(INTDIR)\filesys.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\file_io\win32\flock.c
-
-"$(INTDIR)\flock.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\file_io\unix\fullrw.c
-
-"$(INTDIR)\fullrw.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\file_io\unix\mktemp.c
-
-"$(INTDIR)\mktemp.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\file_io\win32\open.c
-
-"$(INTDIR)\open.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\file_io\win32\pipe.c
-
-"$(INTDIR)\pipe.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\file_io\win32\readwrite.c
-
-"$(INTDIR)\readwrite.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\file_io\win32\seek.c
-
-"$(INTDIR)\seek.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\file_io\unix\tempdir.c
-
-"$(INTDIR)\tempdir.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\locks\win32\proc_mutex.c
-
-"$(INTDIR)\proc_mutex.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\locks\win32\thread_cond.c
-
-"$(INTDIR)\thread_cond.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\locks\win32\thread_mutex.c
-
-"$(INTDIR)\thread_mutex.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\locks\win32\thread_rwlock.c
-
-"$(INTDIR)\thread_rwlock.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\memory\unix\apr_pools.c
-
-"$(INTDIR)\apr_pools.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\misc\win32\apr_app.c
-SOURCE=.\misc\win32\charset.c
-
-"$(INTDIR)\charset.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\misc\win32\env.c
-
-"$(INTDIR)\env.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\misc\unix\errorcodes.c
-
-"$(INTDIR)\errorcodes.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\misc\unix\getopt.c
-
-"$(INTDIR)\getopt.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\misc\win32\internal.c
-
-"$(INTDIR)\internal.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\misc\win32\misc.c
-
-"$(INTDIR)\misc.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\misc\unix\otherchild.c
-
-"$(INTDIR)\otherchild.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\misc\win32\rand.c
-
-"$(INTDIR)\rand.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\misc\win32\start.c
-
-"$(INTDIR)\start.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\misc\win32\utf8.c
-
-"$(INTDIR)\utf8.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\misc\unix\version.c
-
-"$(INTDIR)\version.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\mmap\unix\common.c
-
-"$(INTDIR)\common.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\mmap\win32\mmap.c
-
-"$(INTDIR)\mmap.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\network_io\unix\inet_ntop.c
-
-"$(INTDIR)\inet_ntop.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\network_io\unix\inet_pton.c
-
-"$(INTDIR)\inet_pton.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\network_io\unix\multicast.c
-
-"$(INTDIR)\multicast.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\network_io\win32\sendrecv.c
-
-"$(INTDIR)\sendrecv.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\network_io\unix\sockaddr.c
-
-"$(INTDIR)\sockaddr.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\network_io\unix\socket_util.c
-
-"$(INTDIR)\socket_util.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\network_io\win32\sockets.c
-
-"$(INTDIR)\sockets.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\network_io\win32\sockopt.c
-
-"$(INTDIR)\sockopt.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\passwd\apr_getpass.c
-
-"$(INTDIR)\apr_getpass.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\poll\unix\poll.c
-
-"$(INTDIR)\poll.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\poll\unix\pollcb.c
-
-"$(INTDIR)\pollcb.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\poll\unix\pollset.c
-
-"$(INTDIR)\pollset.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\poll\unix\select.c
-
-"$(INTDIR)\select.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\random\unix\apr_random.c
-
-"$(INTDIR)\apr_random.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\random\unix\sha2.c
-
-"$(INTDIR)\sha2.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\random\unix\sha2_glue.c
-
-"$(INTDIR)\sha2_glue.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\shmem\win32\shm.c
-
-"$(INTDIR)\shm.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\strings\apr_cpystrn.c
-
-"$(INTDIR)\apr_cpystrn.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\strings\apr_fnmatch.c
-
-"$(INTDIR)\apr_fnmatch.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\strings\apr_snprintf.c
-
-"$(INTDIR)\apr_snprintf.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\strings\apr_strings.c
-
-"$(INTDIR)\apr_strings.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\strings\apr_strnatcmp.c
-
-"$(INTDIR)\apr_strnatcmp.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\strings\apr_strtok.c
-
-"$(INTDIR)\apr_strtok.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\tables\apr_hash.c
-
-"$(INTDIR)\apr_hash.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\tables\apr_tables.c
-
-"$(INTDIR)\apr_tables.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\threadproc\win32\proc.c
-
-"$(INTDIR)\proc.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\threadproc\win32\signals.c
-
-"$(INTDIR)\signals.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\threadproc\win32\thread.c
-
-"$(INTDIR)\thread.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\threadproc\win32\threadpriv.c
-
-"$(INTDIR)\threadpriv.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\time\win32\time.c
-
-"$(INTDIR)\time.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\time\win32\timestr.c
-
-"$(INTDIR)\timestr.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\user\win32\groupinfo.c
-
-"$(INTDIR)\groupinfo.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\user\win32\userinfo.c
-
-"$(INTDIR)\userinfo.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\include\apr.hw
-
-!IF  "$(CFG)" == "libapr - Win32 Release"
-
-InputPath=.\include\apr.hw
-
-".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-	< .\include\apr.h
-<< 
-	
-
-!ELSEIF  "$(CFG)" == "libapr - Win32 Debug"
-
-InputPath=.\include\apr.hw
-
-".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-	< .\include\apr.h
-<< 
-	
-
-!ELSEIF  "$(CFG)" == "libapr - Win32 Release9x"
-
-InputPath=.\include\apr.hw
-
-".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-	< .\include\apr.h
-<< 
-	
-
-!ELSEIF  "$(CFG)" == "libapr - Win32 Debug9x"
-
-InputPath=.\include\apr.hw
-
-".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-	< .\include\apr.h
-<< 
-	
-
-!ELSEIF  "$(CFG)" == "libapr - x64 Release"
-
-InputPath=.\include\apr.hw
-
-".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-	< .\include\apr.h
-<< 
-	
-
-!ELSEIF  "$(CFG)" == "libapr - x64 Debug"
-
-InputPath=.\include\apr.hw
-
-".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-	< .\include\apr.h
-<< 
-	
-
-!ENDIF 
-
-SOURCE=.\libapr.rc
-
-"$(INTDIR)\libapr.res" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
-	$(RSC) $(RSC_PROJ) $(SOURCE)
-
-
-
-!ENDIF 
-
+# Microsoft Developer Studio Generated NMAKE File, Based on libapr.dsp
+!IF "$(CFG)" == ""
+CFG=libapr - Win32 Release
+!MESSAGE No configuration specified. Defaulting to libapr - Win32 Release.
+!ENDIF 
+
+!IF "$(CFG)" != "libapr - Win32 Release" && "$(CFG)" != "libapr - Win32 Debug" && "$(CFG)" != "libapr - Win32 Release9x" && "$(CFG)" != "libapr - Win32 Debug9x" && "$(CFG)" != "libapr - x64 Release" && "$(CFG)" != "libapr - x64 Debug"
+!MESSAGE Invalid configuration "$(CFG)" specified.
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "libapr.mak" CFG="libapr - Win32 Release"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "libapr - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "libapr - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "libapr - Win32 Release9x" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "libapr - Win32 Debug9x" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "libapr - x64 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "libapr - x64 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+!ERROR An invalid configuration is specified.
+!ENDIF 
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE 
+NULL=nul
+!ENDIF 
+
+!IF  "$(CFG)" == "libapr - Win32 Release"
+
+OUTDIR=.\Release
+INTDIR=.\Release
+DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
+# Begin Custom Macros
+OutDir=.\Release
+# End Custom Macros
+
+ALL : ".\Release\gen_test_char.exe" "$(OUTDIR)\libapr-1.dll" "$(DS_POSTBUILD_DEP)"
+
+
+CLEAN :
+	-@erase "$(INTDIR)\apr_atomic.obj"
+	-@erase "$(INTDIR)\apr_cpystrn.obj"
+	-@erase "$(INTDIR)\apr_escape.obj"
+	-@erase "$(INTDIR)\apr_fnmatch.obj"
+	-@erase "$(INTDIR)\apr_getpass.obj"
+	-@erase "$(INTDIR)\apr_hash.obj"
+	-@erase "$(INTDIR)\apr_pools.obj"
+	-@erase "$(INTDIR)\apr_random.obj"
+	-@erase "$(INTDIR)\apr_skiplist.obj"
+	-@erase "$(INTDIR)\apr_snprintf.obj"
+	-@erase "$(INTDIR)\apr_strings.obj"
+	-@erase "$(INTDIR)\apr_strnatcmp.obj"
+	-@erase "$(INTDIR)\apr_strtok.obj"
+	-@erase "$(INTDIR)\apr_tables.obj"
+	-@erase "$(INTDIR)\buffer.obj"
+	-@erase "$(INTDIR)\charset.obj"
+	-@erase "$(INTDIR)\common.obj"
+	-@erase "$(INTDIR)\copy.obj"
+	-@erase "$(INTDIR)\dir.obj"
+	-@erase "$(INTDIR)\dso.obj"
+	-@erase "$(INTDIR)\env.obj"
+	-@erase "$(INTDIR)\errorcodes.obj"
+	-@erase "$(INTDIR)\fileacc.obj"
+	-@erase "$(INTDIR)\filedup.obj"
+	-@erase "$(INTDIR)\filepath.obj"
+	-@erase "$(INTDIR)\filepath_util.obj"
+	-@erase "$(INTDIR)\filestat.obj"
+	-@erase "$(INTDIR)\filesys.obj"
+	-@erase "$(INTDIR)\flock.obj"
+	-@erase "$(INTDIR)\fullrw.obj"
+	-@erase "$(INTDIR)\getopt.obj"
+	-@erase "$(INTDIR)\groupinfo.obj"
+	-@erase "$(INTDIR)\inet_ntop.obj"
+	-@erase "$(INTDIR)\inet_pton.obj"
+	-@erase "$(INTDIR)\internal.obj"
+	-@erase "$(INTDIR)\libapr.res"
+	-@erase "$(INTDIR)\libapr_src.idb"
+	-@erase "$(INTDIR)\libapr_src.pdb"
+	-@erase "$(INTDIR)\misc.obj"
+	-@erase "$(INTDIR)\mktemp.obj"
+	-@erase "$(INTDIR)\mmap.obj"
+	-@erase "$(INTDIR)\multicast.obj"
+	-@erase "$(INTDIR)\open.obj"
+	-@erase "$(INTDIR)\otherchild.obj"
+	-@erase "$(INTDIR)\pipe.obj"
+	-@erase "$(INTDIR)\poll.obj"
+	-@erase "$(INTDIR)\pollcb.obj"
+	-@erase "$(INTDIR)\pollset.obj"
+	-@erase "$(INTDIR)\proc.obj"
+	-@erase "$(INTDIR)\proc_mutex.obj"
+	-@erase "$(INTDIR)\rand.obj"
+	-@erase "$(INTDIR)\readwrite.obj"
+	-@erase "$(INTDIR)\seek.obj"
+	-@erase "$(INTDIR)\select.obj"
+	-@erase "$(INTDIR)\sendrecv.obj"
+	-@erase "$(INTDIR)\sha2.obj"
+	-@erase "$(INTDIR)\sha2_glue.obj"
+	-@erase "$(INTDIR)\shm.obj"
+	-@erase "$(INTDIR)\signals.obj"
+	-@erase "$(INTDIR)\sockaddr.obj"
+	-@erase "$(INTDIR)\socket_util.obj"
+	-@erase "$(INTDIR)\sockets.obj"
+	-@erase "$(INTDIR)\sockopt.obj"
+	-@erase "$(INTDIR)\start.obj"
+	-@erase "$(INTDIR)\tempdir.obj"
+	-@erase "$(INTDIR)\thread.obj"
+	-@erase "$(INTDIR)\thread_cond.obj"
+	-@erase "$(INTDIR)\thread_mutex.obj"
+	-@erase "$(INTDIR)\thread_rwlock.obj"
+	-@erase "$(INTDIR)\threadpriv.obj"
+	-@erase "$(INTDIR)\time.obj"
+	-@erase "$(INTDIR)\timestr.obj"
+	-@erase "$(INTDIR)\userinfo.obj"
+	-@erase "$(INTDIR)\utf8.obj"
+	-@erase "$(INTDIR)\version.obj"
+	-@erase "$(OUTDIR)\libapr-1.dll"
+	-@erase "$(OUTDIR)\libapr-1.exp"
+	-@erase "$(OUTDIR)\libapr-1.lib"
+	-@erase "$(OUTDIR)\libapr-1.pdb"
+	-@erase ".\include\apr.h"
+	-@erase ".\include\apr_gen_test_char.h"
+	-@erase "$(OUTDIR)\gen_test_char.exe"
+	-@erase "$(OUTDIR)\gen_test_char.obj"
+
+"$(OUTDIR)" :
+    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\libapr_src" /FD /c 
+
+.c{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cpp{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cxx{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.c{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cpp{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cxx{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+MTL=midl.exe
+MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" 
+RSC=rc.exe
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libapr.res" /i "./include" /d "NDEBUG" /d "APR_VERSION_ONLY" 
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\libapr.bsc" 
+BSC32_SBRS= \
+	
+LINK32=link.exe
+LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib" /MACHINE:X86 /opt:ref 
+LINK32_OBJS= \
+	"$(INTDIR)\apr_atomic.obj" \
+	"$(INTDIR)\dso.obj" \
+	"$(INTDIR)\apr_escape.obj" \
+	"$(INTDIR)\buffer.obj" \
+	"$(INTDIR)\copy.obj" \
+	"$(INTDIR)\dir.obj" \
+	"$(INTDIR)\fileacc.obj" \
+	"$(INTDIR)\filedup.obj" \
+	"$(INTDIR)\filepath.obj" \
+	"$(INTDIR)\filepath_util.obj" \
+	"$(INTDIR)\filestat.obj" \
+	"$(INTDIR)\filesys.obj" \
+	"$(INTDIR)\flock.obj" \
+	"$(INTDIR)\fullrw.obj" \
+	"$(INTDIR)\mktemp.obj" \
+	"$(INTDIR)\open.obj" \
+	"$(INTDIR)\pipe.obj" \
+	"$(INTDIR)\readwrite.obj" \
+	"$(INTDIR)\seek.obj" \
+	"$(INTDIR)\tempdir.obj" \
+	"$(INTDIR)\proc_mutex.obj" \
+	"$(INTDIR)\thread_cond.obj" \
+	"$(INTDIR)\thread_mutex.obj" \
+	"$(INTDIR)\thread_rwlock.obj" \
+	"$(INTDIR)\apr_pools.obj" \
+	"$(INTDIR)\charset.obj" \
+	"$(INTDIR)\env.obj" \
+	"$(INTDIR)\errorcodes.obj" \
+	"$(INTDIR)\getopt.obj" \
+	"$(INTDIR)\internal.obj" \
+	"$(INTDIR)\misc.obj" \
+	"$(INTDIR)\otherchild.obj" \
+	"$(INTDIR)\rand.obj" \
+	"$(INTDIR)\start.obj" \
+	"$(INTDIR)\utf8.obj" \
+	"$(INTDIR)\version.obj" \
+	"$(INTDIR)\common.obj" \
+	"$(INTDIR)\mmap.obj" \
+	"$(INTDIR)\inet_ntop.obj" \
+	"$(INTDIR)\inet_pton.obj" \
+	"$(INTDIR)\multicast.obj" \
+	"$(INTDIR)\sendrecv.obj" \
+	"$(INTDIR)\sockaddr.obj" \
+	"$(INTDIR)\sockets.obj" \
+	"$(INTDIR)\socket_util.obj" \
+	"$(INTDIR)\sockopt.obj" \
+	"$(INTDIR)\apr_getpass.obj" \
+	"$(INTDIR)\poll.obj" \
+	"$(INTDIR)\pollcb.obj" \
+	"$(INTDIR)\pollset.obj" \
+	"$(INTDIR)\select.obj" \
+	"$(INTDIR)\apr_random.obj" \
+	"$(INTDIR)\sha2.obj" \
+	"$(INTDIR)\sha2_glue.obj" \
+	"$(INTDIR)\shm.obj" \
+	"$(INTDIR)\apr_cpystrn.obj" \
+	"$(INTDIR)\apr_fnmatch.obj" \
+	"$(INTDIR)\apr_snprintf.obj" \
+	"$(INTDIR)\apr_strings.obj" \
+	"$(INTDIR)\apr_strnatcmp.obj" \
+	"$(INTDIR)\apr_strtok.obj" \
+	"$(INTDIR)\apr_hash.obj" \
+	"$(INTDIR)\apr_tables.obj" \
+	"$(INTDIR)\apr_skiplist.obj" \
+	"$(INTDIR)\proc.obj" \
+	"$(INTDIR)\signals.obj" \
+	"$(INTDIR)\thread.obj" \
+	"$(INTDIR)\threadpriv.obj" \
+	"$(INTDIR)\time.obj" \
+	"$(INTDIR)\timestr.obj" \
+	"$(INTDIR)\groupinfo.obj" \
+	"$(INTDIR)\userinfo.obj" \
+	"$(INTDIR)\libapr.res"
+
+"$(OUTDIR)\libapr-1.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+TargetPath=.\Release\libapr-1.dll
+SOURCE="$(InputPath)"
+PostBuild_Desc=Embed .manifest
+DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
+
+# Begin Custom Macros
+OutDir=.\Release
+# End Custom Macros
+
+"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\libapr-1.dll"
+   if exist .\Release\libapr-1.dll.manifest mt.exe -manifest .\Release\libapr-1.dll.manifest -outputresource:.\Release\libapr-1.dll;2
+	echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Debug"
+
+OUTDIR=.\Debug
+INTDIR=.\Debug
+DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
+# Begin Custom Macros
+OutDir=.\Debug
+# End Custom Macros
+
+ALL : ".\include\apr_escape_test_char.h" ".\Debug\gen_test_char.exe" "$(OUTDIR)\libapr-1.dll" "$(DS_POSTBUILD_DEP)"
+
+
+CLEAN :
+	-@erase "$(INTDIR)\apr_atomic.obj"
+	-@erase "$(INTDIR)\apr_cpystrn.obj"
+	-@erase "$(INTDIR)\apr_escape.obj"
+	-@erase "$(INTDIR)\apr_fnmatch.obj"
+	-@erase "$(INTDIR)\apr_getpass.obj"
+	-@erase "$(INTDIR)\apr_hash.obj"
+	-@erase "$(INTDIR)\apr_pools.obj"
+	-@erase "$(INTDIR)\apr_random.obj"
+	-@erase "$(INTDIR)\apr_skiplist.obj"
+	-@erase "$(INTDIR)\apr_snprintf.obj"
+	-@erase "$(INTDIR)\apr_strings.obj"
+	-@erase "$(INTDIR)\apr_strnatcmp.obj"
+	-@erase "$(INTDIR)\apr_strtok.obj"
+	-@erase "$(INTDIR)\apr_tables.obj"
+	-@erase "$(INTDIR)\buffer.obj"
+	-@erase "$(INTDIR)\charset.obj"
+	-@erase "$(INTDIR)\common.obj"
+	-@erase "$(INTDIR)\copy.obj"
+	-@erase "$(INTDIR)\dir.obj"
+	-@erase "$(INTDIR)\dso.obj"
+	-@erase "$(INTDIR)\env.obj"
+	-@erase "$(INTDIR)\errorcodes.obj"
+	-@erase "$(INTDIR)\fileacc.obj"
+	-@erase "$(INTDIR)\filedup.obj"
+	-@erase "$(INTDIR)\filepath.obj"
+	-@erase "$(INTDIR)\filepath_util.obj"
+	-@erase "$(INTDIR)\filestat.obj"
+	-@erase "$(INTDIR)\filesys.obj"
+	-@erase "$(INTDIR)\flock.obj"
+	-@erase "$(INTDIR)\fullrw.obj"
+	-@erase "$(INTDIR)\getopt.obj"
+	-@erase "$(INTDIR)\groupinfo.obj"
+	-@erase "$(INTDIR)\inet_ntop.obj"
+	-@erase "$(INTDIR)\inet_pton.obj"
+	-@erase "$(INTDIR)\internal.obj"
+	-@erase "$(INTDIR)\libapr.res"
+	-@erase "$(INTDIR)\libapr_src.idb"
+	-@erase "$(INTDIR)\libapr_src.pdb"
+	-@erase "$(INTDIR)\misc.obj"
+	-@erase "$(INTDIR)\mktemp.obj"
+	-@erase "$(INTDIR)\mmap.obj"
+	-@erase "$(INTDIR)\multicast.obj"
+	-@erase "$(INTDIR)\open.obj"
+	-@erase "$(INTDIR)\otherchild.obj"
+	-@erase "$(INTDIR)\pipe.obj"
+	-@erase "$(INTDIR)\poll.obj"
+	-@erase "$(INTDIR)\pollcb.obj"
+	-@erase "$(INTDIR)\pollset.obj"
+	-@erase "$(INTDIR)\proc.obj"
+	-@erase "$(INTDIR)\proc_mutex.obj"
+	-@erase "$(INTDIR)\rand.obj"
+	-@erase "$(INTDIR)\readwrite.obj"
+	-@erase "$(INTDIR)\seek.obj"
+	-@erase "$(INTDIR)\select.obj"
+	-@erase "$(INTDIR)\sendrecv.obj"
+	-@erase "$(INTDIR)\sha2.obj"
+	-@erase "$(INTDIR)\sha2_glue.obj"
+	-@erase "$(INTDIR)\shm.obj"
+	-@erase "$(INTDIR)\signals.obj"
+	-@erase "$(INTDIR)\sockaddr.obj"
+	-@erase "$(INTDIR)\socket_util.obj"
+	-@erase "$(INTDIR)\sockets.obj"
+	-@erase "$(INTDIR)\sockopt.obj"
+	-@erase "$(INTDIR)\start.obj"
+	-@erase "$(INTDIR)\tempdir.obj"
+	-@erase "$(INTDIR)\thread.obj"
+	-@erase "$(INTDIR)\thread_cond.obj"
+	-@erase "$(INTDIR)\thread_mutex.obj"
+	-@erase "$(INTDIR)\thread_rwlock.obj"
+	-@erase "$(INTDIR)\threadpriv.obj"
+	-@erase "$(INTDIR)\time.obj"
+	-@erase "$(INTDIR)\timestr.obj"
+	-@erase "$(INTDIR)\userinfo.obj"
+	-@erase "$(INTDIR)\utf8.obj"
+	-@erase "$(INTDIR)\version.obj"
+	-@erase "$(OUTDIR)\libapr-1.dll"
+	-@erase "$(OUTDIR)\libapr-1.exp"
+	-@erase "$(OUTDIR)\libapr-1.lib"
+	-@erase "$(OUTDIR)\libapr-1.pdb"
+	-@erase ".\include\apr.h"
+	-@erase ".\include\apr_gen_test_char.h"
+	-@erase "$(OUTDIR)\gen_test_char.exe"
+	-@erase "$(OUTDIR)\gen_test_char.obj"
+
+"$(OUTDIR)" :
+    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\libapr_src" /FD /EHsc /c 
+
+.c{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cpp{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cxx{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.c{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cpp{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cxx{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+MTL=midl.exe
+MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" 
+RSC=rc.exe
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libapr.res" /i "./include" /d "_DEBUG" /d "APR_VERSION_ONLY" 
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\libapr.bsc" 
+BSC32_SBRS= \
+	
+LINK32=link.exe
+LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib" /MACHINE:X86 
+LINK32_OBJS= \
+	"$(INTDIR)\apr_atomic.obj" \
+	"$(INTDIR)\dso.obj" \
+	"$(INTDIR)\apr_escape.obj" \
+	"$(INTDIR)\buffer.obj" \
+	"$(INTDIR)\copy.obj" \
+	"$(INTDIR)\dir.obj" \
+	"$(INTDIR)\fileacc.obj" \
+	"$(INTDIR)\filedup.obj" \
+	"$(INTDIR)\filepath.obj" \
+	"$(INTDIR)\filepath_util.obj" \
+	"$(INTDIR)\filestat.obj" \
+	"$(INTDIR)\filesys.obj" \
+	"$(INTDIR)\flock.obj" \
+	"$(INTDIR)\fullrw.obj" \
+	"$(INTDIR)\mktemp.obj" \
+	"$(INTDIR)\open.obj" \
+	"$(INTDIR)\pipe.obj" \
+	"$(INTDIR)\readwrite.obj" \
+	"$(INTDIR)\seek.obj" \
+	"$(INTDIR)\tempdir.obj" \
+	"$(INTDIR)\proc_mutex.obj" \
+	"$(INTDIR)\thread_cond.obj" \
+	"$(INTDIR)\thread_mutex.obj" \
+	"$(INTDIR)\thread_rwlock.obj" \
+	"$(INTDIR)\apr_pools.obj" \
+	"$(INTDIR)\charset.obj" \
+	"$(INTDIR)\env.obj" \
+	"$(INTDIR)\errorcodes.obj" \
+	"$(INTDIR)\getopt.obj" \
+	"$(INTDIR)\internal.obj" \
+	"$(INTDIR)\misc.obj" \
+	"$(INTDIR)\otherchild.obj" \
+	"$(INTDIR)\rand.obj" \
+	"$(INTDIR)\start.obj" \
+	"$(INTDIR)\utf8.obj" \
+	"$(INTDIR)\version.obj" \
+	"$(INTDIR)\common.obj" \
+	"$(INTDIR)\mmap.obj" \
+	"$(INTDIR)\inet_ntop.obj" \
+	"$(INTDIR)\inet_pton.obj" \
+	"$(INTDIR)\multicast.obj" \
+	"$(INTDIR)\sendrecv.obj" \
+	"$(INTDIR)\sockaddr.obj" \
+	"$(INTDIR)\sockets.obj" \
+	"$(INTDIR)\socket_util.obj" \
+	"$(INTDIR)\sockopt.obj" \
+	"$(INTDIR)\apr_getpass.obj" \
+	"$(INTDIR)\poll.obj" \
+	"$(INTDIR)\pollcb.obj" \
+	"$(INTDIR)\pollset.obj" \
+	"$(INTDIR)\select.obj" \
+	"$(INTDIR)\apr_random.obj" \
+	"$(INTDIR)\sha2.obj" \
+	"$(INTDIR)\sha2_glue.obj" \
+	"$(INTDIR)\shm.obj" \
+	"$(INTDIR)\apr_cpystrn.obj" \
+	"$(INTDIR)\apr_fnmatch.obj" \
+	"$(INTDIR)\apr_snprintf.obj" \
+	"$(INTDIR)\apr_strings.obj" \
+	"$(INTDIR)\apr_strnatcmp.obj" \
+	"$(INTDIR)\apr_strtok.obj" \
+	"$(INTDIR)\apr_hash.obj" \
+	"$(INTDIR)\apr_tables.obj" \
+	"$(INTDIR)\apr_skiplist.obj" \
+	"$(INTDIR)\proc.obj" \
+	"$(INTDIR)\signals.obj" \
+	"$(INTDIR)\thread.obj" \
+	"$(INTDIR)\threadpriv.obj" \
+	"$(INTDIR)\time.obj" \
+	"$(INTDIR)\timestr.obj" \
+	"$(INTDIR)\groupinfo.obj" \
+	"$(INTDIR)\userinfo.obj" \
+	"$(INTDIR)\libapr.res"
+
+"$(OUTDIR)\libapr-1.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+TargetPath=.\Debug\libapr-1.dll
+SOURCE="$(InputPath)"
+PostBuild_Desc=Embed .manifest
+DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
+
+# Begin Custom Macros
+OutDir=.\Debug
+# End Custom Macros
+
+"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\libapr-1.dll"
+   if exist .\Debug\libapr-1.dll.manifest mt.exe -manifest .\Debug\libapr-1.dll.manifest -outputresource:.\Debug\libapr-1.dll;2
+	echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Release9x"
+
+OUTDIR=.\9x\Release
+INTDIR=.\9x\Release
+DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
+# Begin Custom Macros
+OutDir=.\9x\Release
+# End Custom Macros
+
+ALL : ".\include\apr_escape_test_char.h" ".\9x\Release\gen_test_char.exe" "$(OUTDIR)\libapr-1.dll" "$(DS_POSTBUILD_DEP)"
+
+
+CLEAN :
+	-@erase "$(INTDIR)\apr_atomic.obj"
+	-@erase "$(INTDIR)\apr_cpystrn.obj"
+	-@erase "$(INTDIR)\apr_escape.obj"
+	-@erase "$(INTDIR)\apr_fnmatch.obj"
+	-@erase "$(INTDIR)\apr_getpass.obj"
+	-@erase "$(INTDIR)\apr_hash.obj"
+	-@erase "$(INTDIR)\apr_pools.obj"
+	-@erase "$(INTDIR)\apr_random.obj"
+	-@erase "$(INTDIR)\apr_skiplist.obj"
+	-@erase "$(INTDIR)\apr_snprintf.obj"
+	-@erase "$(INTDIR)\apr_strings.obj"
+	-@erase "$(INTDIR)\apr_strnatcmp.obj"
+	-@erase "$(INTDIR)\apr_strtok.obj"
+	-@erase "$(INTDIR)\apr_tables.obj"
+	-@erase "$(INTDIR)\buffer.obj"
+	-@erase "$(INTDIR)\charset.obj"
+	-@erase "$(INTDIR)\common.obj"
+	-@erase "$(INTDIR)\copy.obj"
+	-@erase "$(INTDIR)\dir.obj"
+	-@erase "$(INTDIR)\dso.obj"
+	-@erase "$(INTDIR)\env.obj"
+	-@erase "$(INTDIR)\errorcodes.obj"
+	-@erase "$(INTDIR)\fileacc.obj"
+	-@erase "$(INTDIR)\filedup.obj"
+	-@erase "$(INTDIR)\filepath.obj"
+	-@erase "$(INTDIR)\filepath_util.obj"
+	-@erase "$(INTDIR)\filestat.obj"
+	-@erase "$(INTDIR)\filesys.obj"
+	-@erase "$(INTDIR)\flock.obj"
+	-@erase "$(INTDIR)\fullrw.obj"
+	-@erase "$(INTDIR)\getopt.obj"
+	-@erase "$(INTDIR)\groupinfo.obj"
+	-@erase "$(INTDIR)\inet_ntop.obj"
+	-@erase "$(INTDIR)\inet_pton.obj"
+	-@erase "$(INTDIR)\internal.obj"
+	-@erase "$(INTDIR)\libapr.res"
+	-@erase "$(INTDIR)\libapr_src.idb"
+	-@erase "$(INTDIR)\libapr_src.pdb"
+	-@erase "$(INTDIR)\misc.obj"
+	-@erase "$(INTDIR)\mktemp.obj"
+	-@erase "$(INTDIR)\mmap.obj"
+	-@erase "$(INTDIR)\multicast.obj"
+	-@erase "$(INTDIR)\open.obj"
+	-@erase "$(INTDIR)\otherchild.obj"
+	-@erase "$(INTDIR)\pipe.obj"
+	-@erase "$(INTDIR)\poll.obj"
+	-@erase "$(INTDIR)\pollcb.obj"
+	-@erase "$(INTDIR)\pollset.obj"
+	-@erase "$(INTDIR)\proc.obj"
+	-@erase "$(INTDIR)\proc_mutex.obj"
+	-@erase "$(INTDIR)\rand.obj"
+	-@erase "$(INTDIR)\readwrite.obj"
+	-@erase "$(INTDIR)\seek.obj"
+	-@erase "$(INTDIR)\select.obj"
+	-@erase "$(INTDIR)\sendrecv.obj"
+	-@erase "$(INTDIR)\sha2.obj"
+	-@erase "$(INTDIR)\sha2_glue.obj"
+	-@erase "$(INTDIR)\shm.obj"
+	-@erase "$(INTDIR)\signals.obj"
+	-@erase "$(INTDIR)\sockaddr.obj"
+	-@erase "$(INTDIR)\socket_util.obj"
+	-@erase "$(INTDIR)\sockets.obj"
+	-@erase "$(INTDIR)\sockopt.obj"
+	-@erase "$(INTDIR)\start.obj"
+	-@erase "$(INTDIR)\tempdir.obj"
+	-@erase "$(INTDIR)\thread.obj"
+	-@erase "$(INTDIR)\thread_cond.obj"
+	-@erase "$(INTDIR)\thread_mutex.obj"
+	-@erase "$(INTDIR)\thread_rwlock.obj"
+	-@erase "$(INTDIR)\threadpriv.obj"
+	-@erase "$(INTDIR)\time.obj"
+	-@erase "$(INTDIR)\timestr.obj"
+	-@erase "$(INTDIR)\userinfo.obj"
+	-@erase "$(INTDIR)\utf8.obj"
+	-@erase "$(INTDIR)\version.obj"
+	-@erase "$(OUTDIR)\libapr-1.dll"
+	-@erase "$(OUTDIR)\libapr-1.exp"
+	-@erase "$(OUTDIR)\libapr-1.lib"
+	-@erase "$(OUTDIR)\libapr-1.pdb"
+	-@erase ".\include\apr.h"
+	-@erase ".\include\apr_gen_test_char.h"
+	-@erase "$(OUTDIR)\gen_test_char.exe"
+	-@erase "$(OUTDIR)\gen_test_char.obj"
+
+"$(OUTDIR)" :
+    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\libapr_src" /FD /c 
+
+.c{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cpp{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cxx{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.c{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cpp{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cxx{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+MTL=midl.exe
+MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" 
+RSC=rc.exe
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libapr.res" /i "./include" /d "NDEBUG" /d "APR_VERSION_ONLY" 
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\libapr.bsc" 
+BSC32_SBRS= \
+	
+LINK32=link.exe
+LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib" /MACHINE:X86 /opt:ref 
+LINK32_OBJS= \
+	"$(INTDIR)\apr_atomic.obj" \
+	"$(INTDIR)\dso.obj" \
+	"$(INTDIR)\apr_escape.obj" \
+	"$(INTDIR)\buffer.obj" \
+	"$(INTDIR)\copy.obj" \
+	"$(INTDIR)\dir.obj" \
+	"$(INTDIR)\fileacc.obj" \
+	"$(INTDIR)\filedup.obj" \
+	"$(INTDIR)\filepath.obj" \
+	"$(INTDIR)\filepath_util.obj" \
+	"$(INTDIR)\filestat.obj" \
+	"$(INTDIR)\filesys.obj" \
+	"$(INTDIR)\flock.obj" \
+	"$(INTDIR)\fullrw.obj" \
+	"$(INTDIR)\mktemp.obj" \
+	"$(INTDIR)\open.obj" \
+	"$(INTDIR)\pipe.obj" \
+	"$(INTDIR)\readwrite.obj" \
+	"$(INTDIR)\seek.obj" \
+	"$(INTDIR)\tempdir.obj" \
+	"$(INTDIR)\proc_mutex.obj" \
+	"$(INTDIR)\thread_cond.obj" \
+	"$(INTDIR)\thread_mutex.obj" \
+	"$(INTDIR)\thread_rwlock.obj" \
+	"$(INTDIR)\apr_pools.obj" \
+	"$(INTDIR)\charset.obj" \
+	"$(INTDIR)\env.obj" \
+	"$(INTDIR)\errorcodes.obj" \
+	"$(INTDIR)\getopt.obj" \
+	"$(INTDIR)\internal.obj" \
+	"$(INTDIR)\misc.obj" \
+	"$(INTDIR)\otherchild.obj" \
+	"$(INTDIR)\rand.obj" \
+	"$(INTDIR)\start.obj" \
+	"$(INTDIR)\utf8.obj" \
+	"$(INTDIR)\version.obj" \
+	"$(INTDIR)\common.obj" \
+	"$(INTDIR)\mmap.obj" \
+	"$(INTDIR)\inet_ntop.obj" \
+	"$(INTDIR)\inet_pton.obj" \
+	"$(INTDIR)\multicast.obj" \
+	"$(INTDIR)\sendrecv.obj" \
+	"$(INTDIR)\sockaddr.obj" \
+	"$(INTDIR)\sockets.obj" \
+	"$(INTDIR)\socket_util.obj" \
+	"$(INTDIR)\sockopt.obj" \
+	"$(INTDIR)\apr_getpass.obj" \
+	"$(INTDIR)\poll.obj" \
+	"$(INTDIR)\pollcb.obj" \
+	"$(INTDIR)\pollset.obj" \
+	"$(INTDIR)\select.obj" \
+	"$(INTDIR)\apr_random.obj" \
+	"$(INTDIR)\sha2.obj" \
+	"$(INTDIR)\sha2_glue.obj" \
+	"$(INTDIR)\shm.obj" \
+	"$(INTDIR)\apr_cpystrn.obj" \
+	"$(INTDIR)\apr_fnmatch.obj" \
+	"$(INTDIR)\apr_snprintf.obj" \
+	"$(INTDIR)\apr_strings.obj" \
+	"$(INTDIR)\apr_strnatcmp.obj" \
+	"$(INTDIR)\apr_strtok.obj" \
+	"$(INTDIR)\apr_hash.obj" \
+	"$(INTDIR)\apr_tables.obj" \
+	"$(INTDIR)\apr_skiplist.obj" \
+	"$(INTDIR)\proc.obj" \
+	"$(INTDIR)\signals.obj" \
+	"$(INTDIR)\thread.obj" \
+	"$(INTDIR)\threadpriv.obj" \
+	"$(INTDIR)\time.obj" \
+	"$(INTDIR)\timestr.obj" \
+	"$(INTDIR)\groupinfo.obj" \
+	"$(INTDIR)\userinfo.obj" \
+	"$(INTDIR)\libapr.res"
+
+"$(OUTDIR)\libapr-1.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+TargetPath=.\9x\Release\libapr-1.dll
+SOURCE="$(InputPath)"
+PostBuild_Desc=Embed .manifest
+DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
+
+# Begin Custom Macros
+OutDir=.\9x\Release
+# End Custom Macros
+
+"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\libapr-1.dll"
+   if exist .\9x\Release\libapr-1.dll.manifest mt.exe -manifest .\9x\Release\libapr-1.dll.manifest -outputresource:.\9x\Release\libapr-1.dll;2
+	echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Debug9x"
+
+OUTDIR=.\9x\Debug
+INTDIR=.\9x\Debug
+DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
+# Begin Custom Macros
+OutDir=.\9x\Debug
+# End Custom Macros
+
+ALL : ".\include\apr_escape_test_char.h" ".\include\apr.h" ".\9x\Debug\gen_test_char.exe" "$(OUTDIR)\libapr-1.dll" "$(DS_POSTBUILD_DEP)"
+
+
+CLEAN :
+	-@erase "$(INTDIR)\apr_atomic.obj"
+	-@erase "$(INTDIR)\apr_cpystrn.obj"
+	-@erase "$(INTDIR)\apr_escape.obj"
+	-@erase "$(INTDIR)\apr_fnmatch.obj"
+	-@erase "$(INTDIR)\apr_getpass.obj"
+	-@erase "$(INTDIR)\apr_hash.obj"
+	-@erase "$(INTDIR)\apr_pools.obj"
+	-@erase "$(INTDIR)\apr_random.obj"
+	-@erase "$(INTDIR)\apr_skiplist.obj"
+	-@erase "$(INTDIR)\apr_snprintf.obj"
+	-@erase "$(INTDIR)\apr_strings.obj"
+	-@erase "$(INTDIR)\apr_strnatcmp.obj"
+	-@erase "$(INTDIR)\apr_strtok.obj"
+	-@erase "$(INTDIR)\apr_tables.obj"
+	-@erase "$(INTDIR)\buffer.obj"
+	-@erase "$(INTDIR)\charset.obj"
+	-@erase "$(INTDIR)\common.obj"
+	-@erase "$(INTDIR)\copy.obj"
+	-@erase "$(INTDIR)\dir.obj"
+	-@erase "$(INTDIR)\dso.obj"
+	-@erase "$(INTDIR)\env.obj"
+	-@erase "$(INTDIR)\errorcodes.obj"
+	-@erase "$(INTDIR)\fileacc.obj"
+	-@erase "$(INTDIR)\filedup.obj"
+	-@erase "$(INTDIR)\filepath.obj"
+	-@erase "$(INTDIR)\filepath_util.obj"
+	-@erase "$(INTDIR)\filestat.obj"
+	-@erase "$(INTDIR)\filesys.obj"
+	-@erase "$(INTDIR)\flock.obj"
+	-@erase "$(INTDIR)\fullrw.obj"
+	-@erase "$(INTDIR)\getopt.obj"
+	-@erase "$(INTDIR)\groupinfo.obj"
+	-@erase "$(INTDIR)\inet_ntop.obj"
+	-@erase "$(INTDIR)\inet_pton.obj"
+	-@erase "$(INTDIR)\internal.obj"
+	-@erase "$(INTDIR)\libapr.res"
+	-@erase "$(INTDIR)\libapr_src.idb"
+	-@erase "$(INTDIR)\libapr_src.pdb"
+	-@erase "$(INTDIR)\misc.obj"
+	-@erase "$(INTDIR)\mktemp.obj"
+	-@erase "$(INTDIR)\mmap.obj"
+	-@erase "$(INTDIR)\multicast.obj"
+	-@erase "$(INTDIR)\open.obj"
+	-@erase "$(INTDIR)\otherchild.obj"
+	-@erase "$(INTDIR)\pipe.obj"
+	-@erase "$(INTDIR)\poll.obj"
+	-@erase "$(INTDIR)\pollcb.obj"
+	-@erase "$(INTDIR)\pollset.obj"
+	-@erase "$(INTDIR)\proc.obj"
+	-@erase "$(INTDIR)\proc_mutex.obj"
+	-@erase "$(INTDIR)\rand.obj"
+	-@erase "$(INTDIR)\readwrite.obj"
+	-@erase "$(INTDIR)\seek.obj"
+	-@erase "$(INTDIR)\select.obj"
+	-@erase "$(INTDIR)\sendrecv.obj"
+	-@erase "$(INTDIR)\sha2.obj"
+	-@erase "$(INTDIR)\sha2_glue.obj"
+	-@erase "$(INTDIR)\shm.obj"
+	-@erase "$(INTDIR)\signals.obj"
+	-@erase "$(INTDIR)\sockaddr.obj"
+	-@erase "$(INTDIR)\socket_util.obj"
+	-@erase "$(INTDIR)\sockets.obj"
+	-@erase "$(INTDIR)\sockopt.obj"
+	-@erase "$(INTDIR)\start.obj"
+	-@erase "$(INTDIR)\tempdir.obj"
+	-@erase "$(INTDIR)\thread.obj"
+	-@erase "$(INTDIR)\thread_cond.obj"
+	-@erase "$(INTDIR)\thread_mutex.obj"
+	-@erase "$(INTDIR)\thread_rwlock.obj"
+	-@erase "$(INTDIR)\threadpriv.obj"
+	-@erase "$(INTDIR)\time.obj"
+	-@erase "$(INTDIR)\timestr.obj"
+	-@erase "$(INTDIR)\userinfo.obj"
+	-@erase "$(INTDIR)\utf8.obj"
+	-@erase "$(INTDIR)\version.obj"
+	-@erase "$(OUTDIR)\libapr-1.dll"
+	-@erase "$(OUTDIR)\libapr-1.exp"
+	-@erase "$(OUTDIR)\libapr-1.lib"
+	-@erase "$(OUTDIR)\libapr-1.pdb"
+	-@erase ".\include\apr.h"
+	-@erase ".\include\apr_gen_test_char.h"
+	-@erase "$(OUTDIR)\gen_test_char.exe"
+	-@erase "$(OUTDIR)\gen_test_char.obj"
+
+"$(OUTDIR)" :
+    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\libapr_src" /FD /EHsc /c 
+
+.c{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cpp{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cxx{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.c{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cpp{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cxx{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+MTL=midl.exe
+MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" 
+RSC=rc.exe
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libapr.res" /i "./include" /d "_DEBUG" /d "APR_VERSION_ONLY" 
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\libapr.bsc" 
+BSC32_SBRS= \
+	
+LINK32=link.exe
+LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib" /MACHINE:X86 
+LINK32_OBJS= \
+	"$(INTDIR)\apr_atomic.obj" \
+	"$(INTDIR)\dso.obj" \
+	"$(INTDIR)\apr_escape.obj" \
+	"$(INTDIR)\buffer.obj" \
+	"$(INTDIR)\copy.obj" \
+	"$(INTDIR)\dir.obj" \
+	"$(INTDIR)\fileacc.obj" \
+	"$(INTDIR)\filedup.obj" \
+	"$(INTDIR)\filepath.obj" \
+	"$(INTDIR)\filepath_util.obj" \
+	"$(INTDIR)\filestat.obj" \
+	"$(INTDIR)\filesys.obj" \
+	"$(INTDIR)\flock.obj" \
+	"$(INTDIR)\fullrw.obj" \
+	"$(INTDIR)\mktemp.obj" \
+	"$(INTDIR)\open.obj" \
+	"$(INTDIR)\pipe.obj" \
+	"$(INTDIR)\readwrite.obj" \
+	"$(INTDIR)\seek.obj" \
+	"$(INTDIR)\tempdir.obj" \
+	"$(INTDIR)\proc_mutex.obj" \
+	"$(INTDIR)\thread_cond.obj" \
+	"$(INTDIR)\thread_mutex.obj" \
+	"$(INTDIR)\thread_rwlock.obj" \
+	"$(INTDIR)\apr_pools.obj" \
+	"$(INTDIR)\charset.obj" \
+	"$(INTDIR)\env.obj" \
+	"$(INTDIR)\errorcodes.obj" \
+	"$(INTDIR)\getopt.obj" \
+	"$(INTDIR)\internal.obj" \
+	"$(INTDIR)\misc.obj" \
+	"$(INTDIR)\otherchild.obj" \
+	"$(INTDIR)\rand.obj" \
+	"$(INTDIR)\start.obj" \
+	"$(INTDIR)\utf8.obj" \
+	"$(INTDIR)\version.obj" \
+	"$(INTDIR)\common.obj" \
+	"$(INTDIR)\mmap.obj" \
+	"$(INTDIR)\inet_ntop.obj" \
+	"$(INTDIR)\inet_pton.obj" \
+	"$(INTDIR)\multicast.obj" \
+	"$(INTDIR)\sendrecv.obj" \
+	"$(INTDIR)\sockaddr.obj" \
+	"$(INTDIR)\sockets.obj" \
+	"$(INTDIR)\socket_util.obj" \
+	"$(INTDIR)\sockopt.obj" \
+	"$(INTDIR)\apr_getpass.obj" \
+	"$(INTDIR)\poll.obj" \
+	"$(INTDIR)\pollcb.obj" \
+	"$(INTDIR)\pollset.obj" \
+	"$(INTDIR)\select.obj" \
+	"$(INTDIR)\apr_random.obj" \
+	"$(INTDIR)\sha2.obj" \
+	"$(INTDIR)\sha2_glue.obj" \
+	"$(INTDIR)\shm.obj" \
+	"$(INTDIR)\apr_cpystrn.obj" \
+	"$(INTDIR)\apr_fnmatch.obj" \
+	"$(INTDIR)\apr_snprintf.obj" \
+	"$(INTDIR)\apr_strings.obj" \
+	"$(INTDIR)\apr_strnatcmp.obj" \
+	"$(INTDIR)\apr_strtok.obj" \
+	"$(INTDIR)\apr_hash.obj" \
+	"$(INTDIR)\apr_tables.obj" \
+	"$(INTDIR)\apr_skiplist.obj" \
+	"$(INTDIR)\proc.obj" \
+	"$(INTDIR)\signals.obj" \
+	"$(INTDIR)\thread.obj" \
+	"$(INTDIR)\threadpriv.obj" \
+	"$(INTDIR)\time.obj" \
+	"$(INTDIR)\timestr.obj" \
+	"$(INTDIR)\groupinfo.obj" \
+	"$(INTDIR)\userinfo.obj" \
+	"$(INTDIR)\libapr.res"
+
+"$(OUTDIR)\libapr-1.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+TargetPath=.\9x\Debug\libapr-1.dll
+SOURCE="$(InputPath)"
+PostBuild_Desc=Embed .manifest
+DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
+
+# Begin Custom Macros
+OutDir=.\9x\Debug
+# End Custom Macros
+
+"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\libapr-1.dll"
+   if exist .\9x\Debug\libapr-1.dll.manifest mt.exe -manifest .\9x\Debug\libapr-1.dll.manifest -outputresource:.\9x\Debug\libapr-1.dll;2
+	echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
+
+!ELSEIF  "$(CFG)" == "libapr - x64 Release"
+
+OUTDIR=.\x64\Release
+INTDIR=.\x64\Release
+DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
+# Begin Custom Macros
+OutDir=.\x64\Release
+# End Custom Macros
+
+ALL : ".\x64\Release\gen_test_char.exe" ".\include\apr_escape_test_char.h" "$(OUTDIR)\libapr-1.dll" "$(DS_POSTBUILD_DEP)"
+
+
+CLEAN :
+	-@erase "$(INTDIR)\apr_atomic.obj"
+	-@erase "$(INTDIR)\apr_cpystrn.obj"
+	-@erase "$(INTDIR)\apr_escape.obj"
+	-@erase "$(INTDIR)\apr_fnmatch.obj"
+	-@erase "$(INTDIR)\apr_getpass.obj"
+	-@erase "$(INTDIR)\apr_hash.obj"
+	-@erase "$(INTDIR)\apr_pools.obj"
+	-@erase "$(INTDIR)\apr_random.obj"
+	-@erase "$(INTDIR)\apr_skiplist.obj"
+	-@erase "$(INTDIR)\apr_snprintf.obj"
+	-@erase "$(INTDIR)\apr_strings.obj"
+	-@erase "$(INTDIR)\apr_strnatcmp.obj"
+	-@erase "$(INTDIR)\apr_strtok.obj"
+	-@erase "$(INTDIR)\apr_tables.obj"
+	-@erase "$(INTDIR)\buffer.obj"
+	-@erase "$(INTDIR)\charset.obj"
+	-@erase "$(INTDIR)\common.obj"
+	-@erase "$(INTDIR)\copy.obj"
+	-@erase "$(INTDIR)\dir.obj"
+	-@erase "$(INTDIR)\dso.obj"
+	-@erase "$(INTDIR)\env.obj"
+	-@erase "$(INTDIR)\errorcodes.obj"
+	-@erase "$(INTDIR)\fileacc.obj"
+	-@erase "$(INTDIR)\filedup.obj"
+	-@erase "$(INTDIR)\filepath.obj"
+	-@erase "$(INTDIR)\filepath_util.obj"
+	-@erase "$(INTDIR)\filestat.obj"
+	-@erase "$(INTDIR)\filesys.obj"
+	-@erase "$(INTDIR)\flock.obj"
+	-@erase "$(INTDIR)\fullrw.obj"
+	-@erase "$(INTDIR)\getopt.obj"
+	-@erase "$(INTDIR)\groupinfo.obj"
+	-@erase "$(INTDIR)\inet_ntop.obj"
+	-@erase "$(INTDIR)\inet_pton.obj"
+	-@erase "$(INTDIR)\internal.obj"
+	-@erase "$(INTDIR)\libapr.res"
+	-@erase "$(INTDIR)\libapr_src.idb"
+	-@erase "$(INTDIR)\libapr_src.pdb"
+	-@erase "$(INTDIR)\misc.obj"
+	-@erase "$(INTDIR)\mktemp.obj"
+	-@erase "$(INTDIR)\mmap.obj"
+	-@erase "$(INTDIR)\multicast.obj"
+	-@erase "$(INTDIR)\open.obj"
+	-@erase "$(INTDIR)\otherchild.obj"
+	-@erase "$(INTDIR)\pipe.obj"
+	-@erase "$(INTDIR)\poll.obj"
+	-@erase "$(INTDIR)\pollcb.obj"
+	-@erase "$(INTDIR)\pollset.obj"
+	-@erase "$(INTDIR)\proc.obj"
+	-@erase "$(INTDIR)\proc_mutex.obj"
+	-@erase "$(INTDIR)\rand.obj"
+	-@erase "$(INTDIR)\readwrite.obj"
+	-@erase "$(INTDIR)\seek.obj"
+	-@erase "$(INTDIR)\select.obj"
+	-@erase "$(INTDIR)\sendrecv.obj"
+	-@erase "$(INTDIR)\sha2.obj"
+	-@erase "$(INTDIR)\sha2_glue.obj"
+	-@erase "$(INTDIR)\shm.obj"
+	-@erase "$(INTDIR)\signals.obj"
+	-@erase "$(INTDIR)\sockaddr.obj"
+	-@erase "$(INTDIR)\socket_util.obj"
+	-@erase "$(INTDIR)\sockets.obj"
+	-@erase "$(INTDIR)\sockopt.obj"
+	-@erase "$(INTDIR)\start.obj"
+	-@erase "$(INTDIR)\tempdir.obj"
+	-@erase "$(INTDIR)\thread.obj"
+	-@erase "$(INTDIR)\thread_cond.obj"
+	-@erase "$(INTDIR)\thread_mutex.obj"
+	-@erase "$(INTDIR)\thread_rwlock.obj"
+	-@erase "$(INTDIR)\threadpriv.obj"
+	-@erase "$(INTDIR)\time.obj"
+	-@erase "$(INTDIR)\timestr.obj"
+	-@erase "$(INTDIR)\userinfo.obj"
+	-@erase "$(INTDIR)\utf8.obj"
+	-@erase "$(INTDIR)\version.obj"
+	-@erase "$(OUTDIR)\libapr-1.dll"
+	-@erase "$(OUTDIR)\libapr-1.exp"
+	-@erase "$(OUTDIR)\libapr-1.lib"
+	-@erase "$(OUTDIR)\libapr-1.pdb"
+	-@erase ".\include\apr.h"
+	-@erase ".\include\apr_gen_test_char.h"
+	-@erase "$(OUTDIR)\gen_test_char.exe"
+	-@erase "$(OUTDIR)\gen_test_char.obj"
+
+"$(OUTDIR)" :
+    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\libapr_src" /FD /c 
+
+.c{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cpp{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cxx{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.c{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cpp{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cxx{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+MTL=midl.exe
+MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" 
+RSC=rc.exe
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libapr.res" /i "./include" /d "NDEBUG" /d "APR_VERSION_ONLY" 
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\libapr.bsc" 
+BSC32_SBRS= \
+	
+LINK32=link.exe
+LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib" /MACHINE:X64 /opt:ref 
+LINK32_OBJS= \
+	"$(INTDIR)\apr_atomic.obj" \
+	"$(INTDIR)\dso.obj" \
+	"$(INTDIR)\apr_escape.obj" \
+	"$(INTDIR)\buffer.obj" \
+	"$(INTDIR)\copy.obj" \
+	"$(INTDIR)\dir.obj" \
+	"$(INTDIR)\fileacc.obj" \
+	"$(INTDIR)\filedup.obj" \
+	"$(INTDIR)\filepath.obj" \
+	"$(INTDIR)\filepath_util.obj" \
+	"$(INTDIR)\filestat.obj" \
+	"$(INTDIR)\filesys.obj" \
+	"$(INTDIR)\flock.obj" \
+	"$(INTDIR)\fullrw.obj" \
+	"$(INTDIR)\mktemp.obj" \
+	"$(INTDIR)\open.obj" \
+	"$(INTDIR)\pipe.obj" \
+	"$(INTDIR)\readwrite.obj" \
+	"$(INTDIR)\seek.obj" \
+	"$(INTDIR)\tempdir.obj" \
+	"$(INTDIR)\proc_mutex.obj" \
+	"$(INTDIR)\thread_cond.obj" \
+	"$(INTDIR)\thread_mutex.obj" \
+	"$(INTDIR)\thread_rwlock.obj" \
+	"$(INTDIR)\apr_pools.obj" \
+	"$(INTDIR)\charset.obj" \
+	"$(INTDIR)\env.obj" \
+	"$(INTDIR)\errorcodes.obj" \
+	"$(INTDIR)\getopt.obj" \
+	"$(INTDIR)\internal.obj" \
+	"$(INTDIR)\misc.obj" \
+	"$(INTDIR)\otherchild.obj" \
+	"$(INTDIR)\rand.obj" \
+	"$(INTDIR)\start.obj" \
+	"$(INTDIR)\utf8.obj" \
+	"$(INTDIR)\version.obj" \
+	"$(INTDIR)\common.obj" \
+	"$(INTDIR)\mmap.obj" \
+	"$(INTDIR)\inet_ntop.obj" \
+	"$(INTDIR)\inet_pton.obj" \
+	"$(INTDIR)\multicast.obj" \
+	"$(INTDIR)\sendrecv.obj" \
+	"$(INTDIR)\sockaddr.obj" \
+	"$(INTDIR)\sockets.obj" \
+	"$(INTDIR)\socket_util.obj" \
+	"$(INTDIR)\sockopt.obj" \
+	"$(INTDIR)\apr_getpass.obj" \
+	"$(INTDIR)\poll.obj" \
+	"$(INTDIR)\pollcb.obj" \
+	"$(INTDIR)\pollset.obj" \
+	"$(INTDIR)\select.obj" \
+	"$(INTDIR)\apr_random.obj" \
+	"$(INTDIR)\sha2.obj" \
+	"$(INTDIR)\sha2_glue.obj" \
+	"$(INTDIR)\shm.obj" \
+	"$(INTDIR)\apr_cpystrn.obj" \
+	"$(INTDIR)\apr_fnmatch.obj" \
+	"$(INTDIR)\apr_snprintf.obj" \
+	"$(INTDIR)\apr_strings.obj" \
+	"$(INTDIR)\apr_strnatcmp.obj" \
+	"$(INTDIR)\apr_strtok.obj" \
+	"$(INTDIR)\apr_hash.obj" \
+	"$(INTDIR)\apr_tables.obj" \
+	"$(INTDIR)\apr_skiplist.obj" \
+	"$(INTDIR)\proc.obj" \
+	"$(INTDIR)\signals.obj" \
+	"$(INTDIR)\thread.obj" \
+	"$(INTDIR)\threadpriv.obj" \
+	"$(INTDIR)\time.obj" \
+	"$(INTDIR)\timestr.obj" \
+	"$(INTDIR)\groupinfo.obj" \
+	"$(INTDIR)\userinfo.obj" \
+	"$(INTDIR)\libapr.res"
+
+"$(OUTDIR)\libapr-1.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+TargetPath=.\x64\Release\libapr-1.dll
+SOURCE="$(InputPath)"
+PostBuild_Desc=Embed .manifest
+DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
+
+# Begin Custom Macros
+OutDir=.\x64\Release
+# End Custom Macros
+
+"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\libapr-1.dll"
+   if exist .\x64\Release\libapr-1.dll.manifest mt.exe -manifest .\x64\Release\libapr-1.dll.manifest -outputresource:.\x64\Release\libapr-1.dll;2
+	echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
+
+!ELSEIF  "$(CFG)" == "libapr - x64 Debug"
+
+OUTDIR=.\x64\Debug
+INTDIR=.\x64\Debug
+DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
+# Begin Custom Macros
+OutDir=.\x64\Debug
+# End Custom Macros
+
+ALL : ".\x64\Debug\gen_test_char.exe" ".\include\apr_escape_test_char.h" "$(OUTDIR)\libapr-1.dll" "$(DS_POSTBUILD_DEP)"
+
+
+CLEAN :
+	-@erase "$(INTDIR)\apr_atomic.obj"
+	-@erase "$(INTDIR)\apr_cpystrn.obj"
+	-@erase "$(INTDIR)\apr_escape.obj"
+	-@erase "$(INTDIR)\apr_fnmatch.obj"
+	-@erase "$(INTDIR)\apr_getpass.obj"
+	-@erase "$(INTDIR)\apr_hash.obj"
+	-@erase "$(INTDIR)\apr_pools.obj"
+	-@erase "$(INTDIR)\apr_random.obj"
+	-@erase "$(INTDIR)\apr_skiplist.obj"
+	-@erase "$(INTDIR)\apr_snprintf.obj"
+	-@erase "$(INTDIR)\apr_strings.obj"
+	-@erase "$(INTDIR)\apr_strnatcmp.obj"
+	-@erase "$(INTDIR)\apr_strtok.obj"
+	-@erase "$(INTDIR)\apr_tables.obj"
+	-@erase "$(INTDIR)\buffer.obj"
+	-@erase "$(INTDIR)\charset.obj"
+	-@erase "$(INTDIR)\common.obj"
+	-@erase "$(INTDIR)\copy.obj"
+	-@erase "$(INTDIR)\dir.obj"
+	-@erase "$(INTDIR)\dso.obj"
+	-@erase "$(INTDIR)\env.obj"
+	-@erase "$(INTDIR)\errorcodes.obj"
+	-@erase "$(INTDIR)\fileacc.obj"
+	-@erase "$(INTDIR)\filedup.obj"
+	-@erase "$(INTDIR)\filepath.obj"
+	-@erase "$(INTDIR)\filepath_util.obj"
+	-@erase "$(INTDIR)\filestat.obj"
+	-@erase "$(INTDIR)\filesys.obj"
+	-@erase "$(INTDIR)\flock.obj"
+	-@erase "$(INTDIR)\fullrw.obj"
+	-@erase "$(INTDIR)\getopt.obj"
+	-@erase "$(INTDIR)\groupinfo.obj"
+	-@erase "$(INTDIR)\inet_ntop.obj"
+	-@erase "$(INTDIR)\inet_pton.obj"
+	-@erase "$(INTDIR)\internal.obj"
+	-@erase "$(INTDIR)\libapr.res"
+	-@erase "$(INTDIR)\libapr_src.idb"
+	-@erase "$(INTDIR)\libapr_src.pdb"
+	-@erase "$(INTDIR)\misc.obj"
+	-@erase "$(INTDIR)\mktemp.obj"
+	-@erase "$(INTDIR)\mmap.obj"
+	-@erase "$(INTDIR)\multicast.obj"
+	-@erase "$(INTDIR)\open.obj"
+	-@erase "$(INTDIR)\otherchild.obj"
+	-@erase "$(INTDIR)\pipe.obj"
+	-@erase "$(INTDIR)\poll.obj"
+	-@erase "$(INTDIR)\pollcb.obj"
+	-@erase "$(INTDIR)\pollset.obj"
+	-@erase "$(INTDIR)\proc.obj"
+	-@erase "$(INTDIR)\proc_mutex.obj"
+	-@erase "$(INTDIR)\rand.obj"
+	-@erase "$(INTDIR)\readwrite.obj"
+	-@erase "$(INTDIR)\seek.obj"
+	-@erase "$(INTDIR)\select.obj"
+	-@erase "$(INTDIR)\sendrecv.obj"
+	-@erase "$(INTDIR)\sha2.obj"
+	-@erase "$(INTDIR)\sha2_glue.obj"
+	-@erase "$(INTDIR)\shm.obj"
+	-@erase "$(INTDIR)\signals.obj"
+	-@erase "$(INTDIR)\sockaddr.obj"
+	-@erase "$(INTDIR)\socket_util.obj"
+	-@erase "$(INTDIR)\sockets.obj"
+	-@erase "$(INTDIR)\sockopt.obj"
+	-@erase "$(INTDIR)\start.obj"
+	-@erase "$(INTDIR)\tempdir.obj"
+	-@erase "$(INTDIR)\thread.obj"
+	-@erase "$(INTDIR)\thread_cond.obj"
+	-@erase "$(INTDIR)\thread_mutex.obj"
+	-@erase "$(INTDIR)\thread_rwlock.obj"
+	-@erase "$(INTDIR)\threadpriv.obj"
+	-@erase "$(INTDIR)\time.obj"
+	-@erase "$(INTDIR)\timestr.obj"
+	-@erase "$(INTDIR)\userinfo.obj"
+	-@erase "$(INTDIR)\utf8.obj"
+	-@erase "$(INTDIR)\version.obj"
+	-@erase "$(OUTDIR)\libapr-1.dll"
+	-@erase "$(OUTDIR)\libapr-1.exp"
+	-@erase "$(OUTDIR)\libapr-1.lib"
+	-@erase "$(OUTDIR)\libapr-1.pdb"
+	-@erase ".\include\apr.h"
+	-@erase ".\include\apr_gen_test_char.h"
+	-@erase "$(OUTDIR)\gen_test_char.exe"
+	-@erase "$(OUTDIR)\gen_test_char.obj"
+
+"$(OUTDIR)" :
+    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\libapr_src" /FD /EHsc /c 
+
+.c{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cpp{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cxx{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.c{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cpp{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cxx{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+MTL=midl.exe
+MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" 
+RSC=rc.exe
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libapr.res" /i "./include" /d "_DEBUG" /d "APR_VERSION_ONLY" 
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\libapr.bsc" 
+BSC32_SBRS= \
+	
+LINK32=link.exe
+LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib" /MACHINE:X64 
+LINK32_OBJS= \
+	"$(INTDIR)\apr_atomic.obj" \
+	"$(INTDIR)\dso.obj" \
+	"$(INTDIR)\apr_escape.obj" \
+	"$(INTDIR)\buffer.obj" \
+	"$(INTDIR)\copy.obj" \
+	"$(INTDIR)\dir.obj" \
+	"$(INTDIR)\fileacc.obj" \
+	"$(INTDIR)\filedup.obj" \
+	"$(INTDIR)\filepath.obj" \
+	"$(INTDIR)\filepath_util.obj" \
+	"$(INTDIR)\filestat.obj" \
+	"$(INTDIR)\filesys.obj" \
+	"$(INTDIR)\flock.obj" \
+	"$(INTDIR)\fullrw.obj" \
+	"$(INTDIR)\mktemp.obj" \
+	"$(INTDIR)\open.obj" \
+	"$(INTDIR)\pipe.obj" \
+	"$(INTDIR)\readwrite.obj" \
+	"$(INTDIR)\seek.obj" \
+	"$(INTDIR)\tempdir.obj" \
+	"$(INTDIR)\proc_mutex.obj" \
+	"$(INTDIR)\thread_cond.obj" \
+	"$(INTDIR)\thread_mutex.obj" \
+	"$(INTDIR)\thread_rwlock.obj" \
+	"$(INTDIR)\apr_pools.obj" \
+	"$(INTDIR)\charset.obj" \
+	"$(INTDIR)\env.obj" \
+	"$(INTDIR)\errorcodes.obj" \
+	"$(INTDIR)\getopt.obj" \
+	"$(INTDIR)\internal.obj" \
+	"$(INTDIR)\misc.obj" \
+	"$(INTDIR)\otherchild.obj" \
+	"$(INTDIR)\rand.obj" \
+	"$(INTDIR)\start.obj" \
+	"$(INTDIR)\utf8.obj" \
+	"$(INTDIR)\version.obj" \
+	"$(INTDIR)\common.obj" \
+	"$(INTDIR)\mmap.obj" \
+	"$(INTDIR)\inet_ntop.obj" \
+	"$(INTDIR)\inet_pton.obj" \
+	"$(INTDIR)\multicast.obj" \
+	"$(INTDIR)\sendrecv.obj" \
+	"$(INTDIR)\sockaddr.obj" \
+	"$(INTDIR)\sockets.obj" \
+	"$(INTDIR)\socket_util.obj" \
+	"$(INTDIR)\sockopt.obj" \
+	"$(INTDIR)\apr_getpass.obj" \
+	"$(INTDIR)\poll.obj" \
+	"$(INTDIR)\pollcb.obj" \
+	"$(INTDIR)\pollset.obj" \
+	"$(INTDIR)\select.obj" \
+	"$(INTDIR)\apr_random.obj" \
+	"$(INTDIR)\sha2.obj" \
+	"$(INTDIR)\sha2_glue.obj" \
+	"$(INTDIR)\shm.obj" \
+	"$(INTDIR)\apr_cpystrn.obj" \
+	"$(INTDIR)\apr_fnmatch.obj" \
+	"$(INTDIR)\apr_snprintf.obj" \
+	"$(INTDIR)\apr_strings.obj" \
+	"$(INTDIR)\apr_strnatcmp.obj" \
+	"$(INTDIR)\apr_strtok.obj" \
+	"$(INTDIR)\apr_hash.obj" \
+	"$(INTDIR)\apr_tables.obj" \
+	"$(INTDIR)\apr_skiplist.obj" \
+	"$(INTDIR)\proc.obj" \
+	"$(INTDIR)\signals.obj" \
+	"$(INTDIR)\thread.obj" \
+	"$(INTDIR)\threadpriv.obj" \
+	"$(INTDIR)\time.obj" \
+	"$(INTDIR)\timestr.obj" \
+	"$(INTDIR)\groupinfo.obj" \
+	"$(INTDIR)\userinfo.obj" \
+	"$(INTDIR)\libapr.res"
+
+"$(OUTDIR)\libapr-1.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+TargetPath=.\x64\Debug\libapr-1.dll
+SOURCE="$(InputPath)"
+PostBuild_Desc=Embed .manifest
+DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
+
+# Begin Custom Macros
+OutDir=.\x64\Debug
+# End Custom Macros
+
+"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\libapr-1.dll"
+   if exist .\x64\Debug\libapr-1.dll.manifest mt.exe -manifest .\x64\Debug\libapr-1.dll.manifest -outputresource:.\x64\Debug\libapr-1.dll;2
+	echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
+
+!ENDIF 
+
+
+!IF "$(NO_EXTERNAL_DEPS)" != "1"
+!IF EXISTS("libapr.dep")
+!INCLUDE "libapr.dep"
+!ELSE 
+!MESSAGE Warning: cannot find "libapr.dep"
+!ENDIF 
+!ENDIF 
+
+
+!IF "$(CFG)" == "libapr - Win32 Release" || "$(CFG)" == "libapr - Win32 Debug" || "$(CFG)" == "libapr - Win32 Release9x" || "$(CFG)" == "libapr - Win32 Debug9x" || "$(CFG)" == "libapr - x64 Release" || "$(CFG)" == "libapr - x64 Debug"
+SOURCE=.\atomic\win32\apr_atomic.c
+
+"$(INTDIR)\apr_atomic.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\dso\win32\dso.c
+
+"$(INTDIR)\dso.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\encoding\apr_escape.c
+
+"$(INTDIR)\apr_escape.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr_escape.h" ".\include\apr_escape_test_char.h" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\file_io\win32\buffer.c
+
+"$(INTDIR)\buffer.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\file_io\unix\copy.c
+
+"$(INTDIR)\copy.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\file_io\win32\dir.c
+
+"$(INTDIR)\dir.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\file_io\unix\fileacc.c
+
+"$(INTDIR)\fileacc.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\file_io\win32\filedup.c
+
+"$(INTDIR)\filedup.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\file_io\win32\filepath.c
+
+"$(INTDIR)\filepath.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\file_io\unix\filepath_util.c
+
+"$(INTDIR)\filepath_util.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\file_io\win32\filestat.c
+
+"$(INTDIR)\filestat.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\file_io\win32\filesys.c
+
+"$(INTDIR)\filesys.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\file_io\win32\flock.c
+
+"$(INTDIR)\flock.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\file_io\unix\fullrw.c
+
+"$(INTDIR)\fullrw.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\file_io\unix\mktemp.c
+
+"$(INTDIR)\mktemp.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\file_io\win32\open.c
+
+"$(INTDIR)\open.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\file_io\win32\pipe.c
+
+"$(INTDIR)\pipe.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\file_io\win32\readwrite.c
+
+"$(INTDIR)\readwrite.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\file_io\win32\seek.c
+
+"$(INTDIR)\seek.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\file_io\unix\tempdir.c
+
+"$(INTDIR)\tempdir.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\locks\win32\proc_mutex.c
+
+"$(INTDIR)\proc_mutex.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\locks\win32\thread_cond.c
+
+"$(INTDIR)\thread_cond.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\locks\win32\thread_mutex.c
+
+"$(INTDIR)\thread_mutex.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\locks\win32\thread_rwlock.c
+
+"$(INTDIR)\thread_rwlock.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\memory\unix\apr_pools.c
+
+"$(INTDIR)\apr_pools.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\misc\win32\apr_app.c
+SOURCE=.\misc\win32\charset.c
+
+"$(INTDIR)\charset.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\misc\win32\env.c
+
+"$(INTDIR)\env.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\misc\unix\errorcodes.c
+
+"$(INTDIR)\errorcodes.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\misc\unix\getopt.c
+
+"$(INTDIR)\getopt.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\misc\win32\internal.c
+
+"$(INTDIR)\internal.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\misc\win32\misc.c
+
+"$(INTDIR)\misc.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\misc\unix\otherchild.c
+
+"$(INTDIR)\otherchild.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\misc\win32\rand.c
+
+"$(INTDIR)\rand.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\misc\win32\start.c
+
+"$(INTDIR)\start.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\misc\win32\utf8.c
+
+"$(INTDIR)\utf8.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\misc\unix\version.c
+
+"$(INTDIR)\version.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\mmap\unix\common.c
+
+"$(INTDIR)\common.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\mmap\win32\mmap.c
+
+"$(INTDIR)\mmap.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\network_io\unix\inet_ntop.c
+
+"$(INTDIR)\inet_ntop.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\network_io\unix\inet_pton.c
+
+"$(INTDIR)\inet_pton.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\network_io\unix\multicast.c
+
+"$(INTDIR)\multicast.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\network_io\win32\sendrecv.c
+
+"$(INTDIR)\sendrecv.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\network_io\unix\sockaddr.c
+
+"$(INTDIR)\sockaddr.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\network_io\unix\socket_util.c
+
+"$(INTDIR)\socket_util.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\network_io\win32\sockets.c
+
+"$(INTDIR)\sockets.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\network_io\win32\sockopt.c
+
+"$(INTDIR)\sockopt.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\passwd\apr_getpass.c
+
+"$(INTDIR)\apr_getpass.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\poll\unix\poll.c
+
+"$(INTDIR)\poll.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\poll\unix\pollcb.c
+
+"$(INTDIR)\pollcb.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\poll\unix\pollset.c
+
+"$(INTDIR)\pollset.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\poll\unix\select.c
+
+"$(INTDIR)\select.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\random\unix\apr_random.c
+
+"$(INTDIR)\apr_random.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\random\unix\sha2.c
+
+"$(INTDIR)\sha2.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\random\unix\sha2_glue.c
+
+"$(INTDIR)\sha2_glue.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\shmem\win32\shm.c
+
+"$(INTDIR)\shm.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\strings\apr_cpystrn.c
+
+"$(INTDIR)\apr_cpystrn.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\strings\apr_fnmatch.c
+
+"$(INTDIR)\apr_fnmatch.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\strings\apr_snprintf.c
+
+"$(INTDIR)\apr_snprintf.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\strings\apr_strings.c
+
+"$(INTDIR)\apr_strings.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\strings\apr_strnatcmp.c
+
+"$(INTDIR)\apr_strnatcmp.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\strings\apr_strtok.c
+
+"$(INTDIR)\apr_strtok.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\tables\apr_hash.c
+
+"$(INTDIR)\apr_hash.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\tables\apr_skiplist.c
+
+"$(INTDIR)\apr_skiplist.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\tables\apr_tables.c
+
+"$(INTDIR)\apr_tables.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\threadproc\win32\proc.c
+
+"$(INTDIR)\proc.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\threadproc\win32\signals.c
+
+"$(INTDIR)\signals.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\threadproc\win32\thread.c
+
+"$(INTDIR)\thread.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\threadproc\win32\threadpriv.c
+
+"$(INTDIR)\threadpriv.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\time\win32\time.c
+
+"$(INTDIR)\time.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\time\win32\timestr.c
+
+"$(INTDIR)\timestr.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\user\win32\groupinfo.c
+
+"$(INTDIR)\groupinfo.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\user\win32\userinfo.c
+
+"$(INTDIR)\userinfo.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\include\apr.hw
+
+!IF  "$(CFG)" == "libapr - Win32 Release"
+
+InputPath=.\include\apr.hw
+
+".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	< .\include\apr.h
+<< 
+	
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Debug"
+
+InputPath=.\include\apr.hw
+
+".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	< .\include\apr.h
+<< 
+	
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Release9x"
+
+InputPath=.\include\apr.hw
+
+".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	< .\include\apr.h
+<< 
+	
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Debug9x"
+
+InputPath=.\include\apr.hw
+
+".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	< .\include\apr.h
+<< 
+	
+
+!ELSEIF  "$(CFG)" == "libapr - x64 Release"
+
+InputPath=.\include\apr.hw
+
+".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	< .\include\apr.h
+<< 
+	
+
+!ELSEIF  "$(CFG)" == "libapr - x64 Debug"
+
+InputPath=.\include\apr.hw
+
+".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	< .\include\apr.h
+<< 
+	
+
+!ENDIF 
+
+SOURCE=.\include\apr_escape.h
+
+!IF  "$(CFG)" == "libapr - Win32 Release"
+
+InputPath=.\include\apr_escape.h
+
+"$(INTDIR)\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	< .\include\apr_escape_test_char.h
+<< 
+	
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Debug"
+
+InputPath=.\include\apr_escape.h
+
+"$(INTDIR)\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	< .\include\apr_escape_test_char.h
+<< 
+	
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Release9x"
+
+InputPath=.\include\apr_escape.h
+
+"$(INTDIR)\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	< .\include\apr_escape_test_char.h
+<< 
+	
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Debug9x"
+
+InputPath=.\include\apr_escape.h
+
+"$(INTDIR)\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	< .\include\apr_escape_test_char.h
+<< 
+	
+
+!ELSEIF  "$(CFG)" == "libapr - x64 Release"
+
+InputPath=.\include\apr_escape.h
+
+"$(INTDIR)\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	< .\include\apr_escape_test_char.h
+<< 
+	
+
+!ELSEIF  "$(CFG)" == "libapr - x64 Debug"
+
+InputPath=.\include\apr_escape.h
+
+"$(INTDIR)\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	< .\include\apr_escape_test_char.h
+<< 
+	
+
+!ENDIF 
+
+SOURCE=.\include\apr_want.h
+
+!IF  "$(CFG)" == "libapr - Win32 Release"
+
+InputPath=.\include\apr_want.h
+
+".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	< .\include\apr.h
+<< 
+	
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Debug"
+
+InputPath=.\include\apr_want.h
+
+".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	< .\include\apr.h
+<< 
+	
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Release9x"
+
+InputPath=.\include\apr_want.h
+
+".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	< .\include\apr.h
+<< 
+	
+
+!ELSEIF  "$(CFG)" == "libapr - Win32 Debug9x"
+
+InputPath=.\include\apr_want.h
+
+".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	< .\include\apr.h
+<< 
+	
+
+!ELSEIF  "$(CFG)" == "libapr - x64 Release"
+
+InputPath=.\include\apr_want.h
+
+".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	< .\include\apr.h
+<< 
+	
+
+!ELSEIF  "$(CFG)" == "libapr - x64 Debug"
+
+InputPath=.\include\apr_want.h
+
+".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+	< .\include\apr.h
+<< 
+	
+
+!ENDIF 
+
+SOURCE=.\libapr.rc
+
+"$(INTDIR)\libapr.res" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+	$(RSC) $(RSC_PROJ) $(SOURCE)
+
+
+
+!ENDIF 
+
diff --git a/contrib/apr/locks/unix/proc_mutex.c b/contrib/apr/locks/unix/proc_mutex.c
index f9637e03fd9..fa8a872f1f8 100644
--- a/contrib/apr/locks/unix/proc_mutex.c
+++ b/contrib/apr/locks/unix/proc_mutex.c
@@ -102,8 +102,8 @@ static apr_status_t proc_mutex_posix_create(apr_proc_mutex_t *new_mutex,
         apr_ssize_t flen = strlen(fname);
         char *p = apr_pstrndup(new_mutex->pool, fname, strlen(fname));
         unsigned int h1, h2;
-        h1 = apr_hashfunc_default((const char *)p, &flen);
-        h2 = rshash(p);
+        h1 = (apr_hashfunc_default((const char *)p, &flen) & 0xffffffff);
+        h2 = (rshash(p) & 0xffffffff);
         apr_snprintf(semname, sizeof(semname), "/ApR.%xH%x", h1, h2);
     } else {
         apr_time_t now;
@@ -951,7 +951,12 @@ APR_DECLARE(apr_status_t) apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex,
                                                 apr_proc_mutex_t *pmutex)
 {
 #if APR_HAS_SYSVSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE || APR_HAS_POSIXSEM_SERIALIZE
-    ospmutex->crossproc = pmutex->interproc->filedes;
+    if (pmutex->interproc) {
+        ospmutex->crossproc = pmutex->interproc->filedes;
+    }
+    else {
+        ospmutex->crossproc = -1;
+    }
 #endif
 #if APR_HAS_PROC_PTHREAD_SERIALIZE
     ospmutex->pthread_interproc = pmutex->pthread_interproc;
diff --git a/contrib/apr/network_io/unix/sendrecv.c b/contrib/apr/network_io/unix/sendrecv.c
index 6b14643cd58..4c0e0a6fce5 100644
--- a/contrib/apr/network_io/unix/sendrecv.c
+++ b/contrib/apr/network_io/unix/sendrecv.c
@@ -552,7 +552,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file,
 
         /* On early versions of FreeBSD sendfile, the number of bytes to send 
          * must include the length of the headers.  Don't look at the man page 
-         * for this :(  Instead, look at the the logic in 
+         * for this :(  Instead, look at the logic in 
          * src/sys/kern/uipc_syscalls::sendfile().
          *
          * This was fixed in the middle of 4.6-STABLE
diff --git a/contrib/apr/network_io/unix/sockaddr.c b/contrib/apr/network_io/unix/sockaddr.c
index 9253a27461f..0dd1a2d4518 100644
--- a/contrib/apr/network_io/unix/sockaddr.c
+++ b/contrib/apr/network_io/unix/sockaddr.c
@@ -839,6 +839,35 @@ APR_DECLARE(int) apr_sockaddr_equal(const apr_sockaddr_t *addr1,
     return 0; /* not equal */
 }
 
+APR_DECLARE(int) apr_sockaddr_is_wildcard(const apr_sockaddr_t *addr)
+{
+    static const char inaddr_any[
+#if APR_HAVE_IPV6
+        sizeof(struct in6_addr)
+#else
+        sizeof(struct in_addr)
+#endif
+    ] = {0};
+
+    if (addr->ipaddr_ptr /* IP address initialized */
+        && addr->ipaddr_len <= sizeof inaddr_any) { /* else bug elsewhere? */
+        if (!memcmp(inaddr_any, addr->ipaddr_ptr, addr->ipaddr_len)) {
+            return 1;
+        }
+#if APR_HAVE_IPV6
+    if (addr->family == AF_INET6
+        && IN6_IS_ADDR_V4MAPPED((struct in6_addr *)addr->ipaddr_ptr)) {
+        struct in_addr *v4 = (struct in_addr *)&((apr_uint32_t *)addr->ipaddr_ptr)[3];
+
+        if (!memcmp(inaddr_any, v4, sizeof *v4)) {
+            return 1;
+        }
+    }
+#endif
+    }
+    return 0;
+}
+
 static apr_status_t parse_network(apr_ipsubnet_t *ipsub, const char *network)
 {
     /* legacy syntax for ip addrs: a.b.c. ==> a.b.c.0/24 for example */
diff --git a/contrib/apr/network_io/unix/socket_util.c b/contrib/apr/network_io/unix/socket_util.c
index 6cd28a55c43..93fe25976ad 100644
--- a/contrib/apr/network_io/unix/socket_util.c
+++ b/contrib/apr/network_io/unix/socket_util.c
@@ -46,7 +46,8 @@ APR_DECLARE(apr_status_t) apr_socket_atreadeof(apr_socket_t *sock, int *atreadeo
         /* Some other error -> unexpected error. */
         return rv;
     }
-    else if (nfds == 1 && pfds[0].rtnevents == APR_POLLIN) {
+    /* Many platforms return only APR_POLLIN; OS X returns APR_POLLHUP|APR_POLLIN */
+    else if (nfds == 1 && (pfds[0].rtnevents & APR_POLLIN)  == APR_POLLIN) {
         apr_sockaddr_t unused;
         apr_size_t len = 1;
         char buf;
diff --git a/contrib/apr/network_io/unix/sockets.c b/contrib/apr/network_io/unix/sockets.c
index 748dd707d87..514edb1a499 100644
--- a/contrib/apr/network_io/unix/sockets.c
+++ b/contrib/apr/network_io/unix/sockets.c
@@ -207,7 +207,20 @@ apr_status_t apr_socket_accept(apr_socket_t **new, apr_socket_t *sock,
     sa.salen = sizeof(sa.sa);
 
 #ifdef HAVE_ACCEPT4
-    s = accept4(sock->socketdes, (struct sockaddr *)&sa.sa, &sa.salen, SOCK_CLOEXEC);
+    {
+        int flags = SOCK_CLOEXEC;
+
+#if defined(SOCK_NONBLOCK) && APR_O_NONBLOCK_INHERITED
+        /* With FreeBSD accept4() (avail in 10+), O_NONBLOCK is not inherited
+         * (unlike Linux).  Mimic the accept() behavior here in a way that
+         * may help other platforms.
+         */
+        if (apr_is_option_set(sock, APR_SO_NONBLOCK) == 1) {
+            flags |= SOCK_NONBLOCK;
+        }
+#endif
+        s = accept4(sock->socketdes, (struct sockaddr *)&sa.sa, &sa.salen, flags);
+    }
 #else
     s = accept(sock->socketdes, (struct sockaddr *)&sa.sa, &sa.salen);
 #endif
diff --git a/contrib/apr/network_io/unix/sockopt.c b/contrib/apr/network_io/unix/sockopt.c
index 7b67c2ec13a..6ce4b911efc 100644
--- a/contrib/apr/network_io/unix/sockopt.c
+++ b/contrib/apr/network_io/unix/sockopt.c
@@ -141,6 +141,18 @@ apr_status_t apr_socket_opt_set(apr_socket_t *sock,
             apr_set_option(sock, APR_SO_DEBUG, on);
         }
         break;
+    case APR_SO_BROADCAST:
+#ifdef SO_BROADCAST
+        if (on != apr_is_option_set(sock, APR_SO_BROADCAST)) {
+            if (setsockopt(sock->socketdes, SOL_SOCKET, SO_BROADCAST, (void *)&one, sizeof(int)) == -1) {
+                return errno;
+            }
+            apr_set_option(sock, APR_SO_BROADCAST, on);
+        }
+#else
+        return APR_ENOTIMPL;
+#endif
+        break;
     case APR_SO_REUSEADDR:
         if (on != apr_is_option_set(sock, APR_SO_REUSEADDR)) {
             if (setsockopt(sock->socketdes, SOL_SOCKET, SO_REUSEADDR, (void *)&one, sizeof(int)) == -1) {
diff --git a/contrib/apr/passwd/apr_getpass.c b/contrib/apr/passwd/apr_getpass.c
index f31cdafc5c5..6e4cbef3af8 100644
--- a/contrib/apr/passwd/apr_getpass.c
+++ b/contrib/apr/passwd/apr_getpass.c
@@ -51,6 +51,9 @@
 #if APR_HAVE_STRINGS_H
 #include 
 #endif
+#if APR_HAVE_STDIO_H
+#include 
+#endif
 
 /* Disable getpass() support when PASS_MAX is defined and is "small",
  * for an arbitrary definition of "small".
@@ -80,9 +83,9 @@
 
 #if !defined(HAVE_GETPASS) && !defined(HAVE_GETPASSPHRASE) && !defined(HAVE_GETPASS_R)
 
-/* MPE, Win32, NetWare and BeOS all lack a native getpass() */
+/* MPE, Win32, and BeOS all lack a native getpass() */
 
-#if !defined(HAVE_TERMIOS_H) && !defined(WIN32) && !defined(NETWARE)
+#if !defined(HAVE_TERMIOS_H) && !defined(WIN32)
 /*
  * MPE lacks getpass() and a way to suppress stdin echo.  So for now, just
  * issue the prompt and read the results with echo.  (Ugh).
@@ -98,46 +101,7 @@ static char *get_password(const char *prompt)
     return (char *) &password;
 }
 
-#elif defined (HAVE_TERMIOS_H)
-#include 
-
-static char *get_password(const char *prompt)
-{
-    struct termios attr;
-    static char password[MAX_STRING_LEN];
-    int n=0;
-    fputs(prompt, stderr);
-    fflush(stderr);
-
-    if (tcgetattr(STDIN_FILENO, &attr) != 0)
-        return NULL;
-    attr.c_lflag &= ~(ECHO);
-
-    if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &attr) != 0)
-        return NULL;
-    while ((password[n] = getchar()) != '\n') {
-        if (n < sizeof(password) - 1 && password[n] >= ' ' && password[n] <= '~') {
-            n++;
-        } else {
-            fprintf(stderr,"\n");
-            fputs(prompt, stderr);
-            fflush(stderr);
-            n = 0;
-        }
-    }
- 
-    password[n] = '\0';
-    printf("\n");
-    if (n > (MAX_STRING_LEN - 1)) {
-        password[MAX_STRING_LEN - 1] = '\0';
-    }
-
-    attr.c_lflag |= ECHO;
-    tcsetattr(STDIN_FILENO, TCSANOW, &attr);
-    return (char*) &password;
-}
-
-#else
+#elif defined(WIN32)
 
 /*
  * Windows lacks getpass().  So we'll re-implement it here.
@@ -208,6 +172,44 @@ static char *get_password(const char *prompt)
 #endif
 }
 
+#elif defined (HAVE_TERMIOS_H)
+
+static char *get_password(const char *prompt)
+{
+    struct termios attr;
+    static char password[MAX_STRING_LEN];
+    int n=0;
+    fputs(prompt, stderr);
+    fflush(stderr);
+
+    if (tcgetattr(STDIN_FILENO, &attr) != 0)
+        return NULL;
+    attr.c_lflag &= ~(ECHO);
+
+    if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &attr) != 0)
+        return NULL;
+    while ((password[n] = getchar()) != '\n') {
+        if (n < sizeof(password) - 1 && password[n] >= ' ' && password[n] <= '~') {
+            n++;
+        } else {
+            fprintf(stderr,"\n");
+            fputs(prompt, stderr);
+            fflush(stderr);
+            n = 0;
+        }
+    }
+ 
+    password[n] = '\0';
+    printf("\n");
+    if (n > (MAX_STRING_LEN - 1)) {
+        password[MAX_STRING_LEN - 1] = '\0';
+    }
+
+    attr.c_lflag |= ECHO;
+    tcsetattr(STDIN_FILENO, TCSANOW, &attr);
+    return (char*) &password;
+}
+
 #endif /* no getchar or _getch */
 
 #endif /* no getpass or getpassphrase or getpass_r */
diff --git a/contrib/apr/poll/unix/pollcb.c b/contrib/apr/poll/unix/pollcb.c
index 2971b021646..24f80106a44 100644
--- a/contrib/apr/poll/unix/pollcb.c
+++ b/contrib/apr/poll/unix/pollcb.c
@@ -66,6 +66,7 @@ static apr_pollcb_provider_t *pollcb_provider(apr_pollset_method_e method)
 #endif
         break;
         case APR_POLLSET_SELECT:
+        case APR_POLLSET_AIO_MSGQ:
         case APR_POLLSET_DEFAULT:
         break;
     }
diff --git a/contrib/apr/poll/unix/pollset.c b/contrib/apr/poll/unix/pollset.c
index 1a7396b4bc4..852d74597fc 100644
--- a/contrib/apr/poll/unix/pollset.c
+++ b/contrib/apr/poll/unix/pollset.c
@@ -163,6 +163,9 @@ extern apr_pollset_provider_t *apr_pollset_provider_port;
 #if defined(HAVE_EPOLL)
 extern apr_pollset_provider_t *apr_pollset_provider_epoll;
 #endif
+#if defined(HAVE_AIO_MSGQ)
+extern apr_pollset_provider_t *apr_pollset_provider_aio_msgq;
+#endif
 #if defined(HAVE_POLL)
 extern apr_pollset_provider_t *apr_pollset_provider_poll;
 #endif
@@ -185,6 +188,11 @@ static apr_pollset_provider_t *pollset_provider(apr_pollset_method_e method)
         case APR_POLLSET_EPOLL:
 #if defined(HAVE_EPOLL)
             provider = apr_pollset_provider_epoll;
+#endif
+        break;
+        case APR_POLLSET_AIO_MSGQ:
+#if defined(HAVE_AIO_MSGQ)
+            provider = apr_pollset_provider_aio_msgq;
 #endif
         break;
         case APR_POLLSET_POLL:
diff --git a/contrib/apr/poll/unix/z_asio.c b/contrib/apr/poll/unix/z_asio.c
new file mode 100644
index 00000000000..ce158d3169c
--- /dev/null
+++ b/contrib/apr/poll/unix/z_asio.c
@@ -0,0 +1,772 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ ******************************************************************************
+ *
+ * This implementation is based on a design by John Brooks (IBM Pok) which uses
+ * the z/OS sockets async i/o facility.  When a
+ * socket is added to the pollset, an async poll is issued for that individual
+ * socket.  It specifies that the kernel should send an IPC message when the
+ * socket becomes ready.  The IPC messages are sent to a single message queue
+ * that is part of the pollset.  apr_pollset_poll waits on the arrival of IPC
+ * messages or the specified timeout.
+ *
+ * Since z/OS does not support async i/o for pipes or files at present, this
+ * implementation falls back to using ordinary poll() when
+ * APR_POLLSET_THREADSAFE is unset.
+ *
+ * Greg Ames
+ * April 2012
+ */
+
+#include "apr.h"
+#include "apr_hash.h"
+#include "apr_poll.h"
+#include "apr_time.h"
+#include "apr_portable.h"
+#include "apr_arch_inherit.h"
+#include "apr_arch_file_io.h"
+#include "apr_arch_networkio.h"
+#include "apr_arch_poll_private.h"
+
+#ifdef HAVE_AIO_MSGQ
+
+#include   	/* msgget etc   */
+#include      	/* timestruct   */
+#include      	/* pollfd       */
+#include      /* MAX_INT      */
+
+struct apr_pollset_private_t
+{
+    int             msg_q;              /* IPC message queue. The z/OS kernel sends messages
+                                         * to this queue when our async polls on individual
+                                         * file descriptors complete
+                                         */
+    apr_pollfd_t    *result_set;
+    apr_uint32_t    size;
+
+#if APR_HAS_THREADS
+    /* A thread mutex to protect operations on the rings and the hash */
+    apr_thread_mutex_t *ring_lock;
+#endif
+
+    /* A hash of all active elements used for O(1) _remove operations */
+    apr_hash_t      *elems;
+
+    APR_RING_HEAD(ready_ring_t,       asio_elem_t)      ready_ring;
+    APR_RING_HEAD(prior_ready_ring_t, asio_elem_t)      prior_ready_ring;
+    APR_RING_HEAD(free_ring_t,        asio_elem_t)      free_ring;
+
+    /* for pipes etc with no asio */
+    struct pollfd   *pollset;
+    apr_pollfd_t    *query_set;
+};
+
+typedef enum {
+    ASIO_INIT = 0,
+    ASIO_REMOVED,
+    ASIO_COMPLETE
+} asio_state_e;
+
+typedef struct asio_elem_t asio_elem_t;
+
+struct asio_msgbuf_t {
+    long         msg_type;       /* must be > 0 */
+    asio_elem_t *msg_elem;
+};
+
+struct asio_elem_t
+{
+    APR_RING_ENTRY(asio_elem_t) link;
+    apr_pollfd_t                pfd;
+    struct pollfd               os_pfd;
+    struct aiocb                a;
+    asio_state_e                state;
+    struct asio_msgbuf_t        msg;
+};
+
+#define DEBUG 0
+
+/* DEBUG settings: 0 - no debug messages at all,
+ *                 1 - should not occur messages,
+ *                 2 - apr_pollset_* entry and exit messages,
+ *                 3 - state changes, memory usage,
+ *                 4 - z/OS, APR, and internal calls,
+ *                 5 - everything else except the timer pop path,
+ *                 6 - everything, including the Event 1 sec timer pop path
+ *
+ *  each DEBUG level includes all messages produced by lower numbered levels
+ */
+
+#if DEBUG
+
+#include 
+#include 	/* getpid       */
+
+#define DBG_BUFF char dbg_msg_buff[256];
+
+#define DBG_TEST(lvl) if (lvl <= DEBUG) {
+
+#define DBG_CORE(msg)               sprintf(dbg_msg_buff, "% 8d " __FUNCTION__ \
+                                        " "  msg, getpid()),                   \
+                                    fprintf(stderr, "%s", dbg_msg_buff);
+#define DBG_CORE1(msg, var1)        sprintf(dbg_msg_buff, "% 8d " __FUNCTION__ \
+                                        " " msg, getpid(), var1),              \
+                                    fprintf(stderr, "%s", dbg_msg_buff);
+#define DBG_CORE2(msg, var1, var2)  sprintf(dbg_msg_buff, "% 8d " __FUNCTION__ \
+                                        " " msg, getpid(), var1, var2),        \
+                                    fprintf(stderr, "%s", dbg_msg_buff);
+#define DBG_CORE3(msg, var1, var2, var3)                                       \
+                                    sprintf(dbg_msg_buff, "% 8d " __FUNCTION__ \
+                                        " " msg, getpid(), var1, var2, var3),  \
+                                    fprintf(stderr, "%s", dbg_msg_buff);
+#define DBG_CORE4(msg, var1, var2, var3, var4)                                 \
+                                    sprintf(dbg_msg_buff, "% 8d " __FUNCTION__ \
+                                        " " msg, getpid(), var1, var2, var3, var4),\
+                                    fprintf(stderr, "%s", dbg_msg_buff);
+
+#define DBG_END }
+
+#define DBG(lvl, msg)   DBG_TEST(lvl)   \
+                        DBG_CORE(msg)   \
+                        DBG_END
+
+#define DBG1(lvl, msg, var1)    DBG_TEST(lvl)           \
+                                DBG_CORE1(msg, var1)    \
+                                DBG_END
+
+#define DBG2(lvl, msg, var1, var2)      DBG_TEST(lvl)               \
+                                        DBG_CORE2(msg, var1, var2)  \
+                                        DBG_END
+
+#define DBG3(lvl, msg, var1, var2, var3)                        \
+                        DBG_TEST(lvl)                           \
+                        DBG_CORE3(msg, var1, var2, var3)        \
+                        DBG_END
+
+#define DBG4(lvl, msg, var1, var2, var3, var4)                  \
+                        DBG_TEST(lvl)                           \
+                        DBG_CORE4(msg, var1, var2, var3, var4)  \
+                        DBG_END
+
+#else  /* DEBUG is 0 */
+#define DBG_BUFF
+#define DBG(lvl, msg)                            ((void)0)
+#define DBG1(lvl, msg, var1)                     ((void)0)
+#define DBG2(lvl, msg, var1, var2)               ((void)0)
+#define DBG3(lvl, msg, var1, var2, var3)         ((void)0)
+#define DBG4(lvl, msg, var1, var2, var3, var4)   ((void)0)
+
+#endif /* DEBUG */
+
+static int asyncio(struct aiocb *a)
+{
+    DBG_BUFF
+    int rv;
+
+#ifdef _LP64
+#define AIO BPX4AIO
+#else
+#define AIO BPX1AIO
+#endif
+
+    AIO(sizeof(struct aiocb), a, &rv, &errno, __err2ad());
+    DBG2(4, "BPX4AIO aiocb %p rv %d\n",
+             a, rv);
+#ifdef DEBUG
+    if (rv < 0) {
+        DBG2(4, "errno %d errnojr %08x\n",
+                 errno, *__err2ad());
+    }
+#endif
+    return rv;
+}
+
+static apr_int16_t get_event(apr_int16_t event)
+{
+    DBG_BUFF
+    apr_int16_t rv = 0;
+    DBG(4, "entered\n");
+
+    if (event & APR_POLLIN)
+        rv |= POLLIN;
+    if (event & APR_POLLPRI)
+        rv |= POLLPRI;
+    if (event & APR_POLLOUT)
+        rv |= POLLOUT;
+    if (event & APR_POLLERR)
+        rv |= POLLERR;
+    if (event & APR_POLLHUP)
+        rv |= POLLHUP;
+    if (event & APR_POLLNVAL)
+        rv |= POLLNVAL;
+
+    DBG(4, "exiting\n");
+    return rv;
+}
+
+static apr_int16_t get_revent(apr_int16_t event)
+{
+    DBG_BUFF
+    apr_int16_t rv = 0;
+    DBG(4, "entered\n");
+
+    if (event & POLLIN)
+        rv |= APR_POLLIN;
+    if (event & POLLPRI)
+        rv |= APR_POLLPRI;
+    if (event & POLLOUT)
+        rv |= APR_POLLOUT;
+    if (event & POLLERR)
+        rv |= APR_POLLERR;
+    if (event & POLLHUP)
+        rv |= APR_POLLHUP;
+    if (event & POLLNVAL)
+        rv |= APR_POLLNVAL;
+
+    DBG(4, "exiting\n");
+    return rv;
+}
+
+static apr_status_t asio_pollset_cleanup(apr_pollset_t *pollset)
+{
+    DBG_BUFF
+    int rv;
+
+    DBG(4, "entered\n");
+    rv = msgctl(pollset->p->msg_q, IPC_RMID, NULL);
+
+    DBG1(4, "exiting, msgctl(IPC_RMID) returned %d\n", rv);
+    return rv;
+}
+
+static apr_status_t asio_pollset_create(apr_pollset_t *pollset,
+                                        apr_uint32_t size,
+                                        apr_pool_t *p,
+                                        apr_uint32_t flags)
+{
+    DBG_BUFF
+    apr_status_t rv;
+    apr_pollset_private_t *priv;
+
+    DBG1(2, "entered, flags: %x\n", flags);
+
+    priv = pollset->p = apr_palloc(p, sizeof(*priv));
+
+    if (flags & APR_POLLSET_THREADSAFE) {
+#if APR_HAS_THREADS
+        if (rv = apr_thread_mutex_create(&(priv->ring_lock),
+                                           APR_THREAD_MUTEX_DEFAULT,
+                                           p) != APR_SUCCESS) {
+            DBG1(1, "apr_thread_mutex_create returned %d\n", rv);
+            pollset = NULL;
+            return rv;
+        }
+        rv = msgget(IPC_PRIVATE, S_IWUSR+S_IRUSR); /* user r/w perms */
+        if (rv < 0) {
+#if DEBUG
+            perror(__FUNCTION__ " msgget returned < 0 ");
+#endif
+            pollset = NULL;
+            return rv;
+        }
+
+        DBG2(4, "pollset %p msgget was OK, rv=%d\n", pollset, rv);
+        priv->msg_q = rv;
+        priv->elems   = apr_hash_make(p);
+
+        APR_RING_INIT(&priv->free_ring, asio_elem_t, link);
+        APR_RING_INIT(&priv->prior_ready_ring, asio_elem_t, link);
+
+#else  /* APR doesn't have threads but caller wants a threadsafe pollset */
+        pollset = NULL;
+        return APR_ENOTIMPL;
+#endif
+
+    } else {  /* APR_POLLSET_THREADSAFE not set, i.e. no async i/o,
+               * init fields only needed in old style pollset
+               */
+
+        priv->pollset = apr_palloc(p, size * sizeof(struct pollfd));
+        priv->query_set = apr_palloc(p, size * sizeof(apr_pollfd_t));
+
+        if ((!priv->pollset) || (!priv->query_set)) {
+            return APR_ENOMEM;
+        }
+    }
+
+    pollset->nelts   = 0;
+    pollset->flags   = flags;
+    pollset->pool    = p;
+    priv->size    = size;
+    priv->result_set = apr_palloc(p, size * sizeof(apr_pollfd_t));
+    if (!priv->result_set) {
+        return APR_ENOMEM;
+    }
+
+    DBG2(2, "exiting, pollset: %p, type: %s\n",
+             pollset,
+             flags & APR_POLLSET_THREADSAFE ? "async" : "POSIX");
+
+
+    return APR_SUCCESS;
+
+} /* end of asio_pollset_create */
+
+static apr_status_t posix_add(apr_pollset_t      *pollset,
+                              const apr_pollfd_t *descriptor)
+{
+    DBG_BUFF
+    int fd;
+    apr_pool_t  *p = pollset->pool;
+    apr_pollset_private_t *priv = pollset->p;
+
+    DBG(4, "entered\n");
+
+    if (pollset->nelts == priv->size) {
+        return APR_ENOMEM;
+    }
+
+    priv->query_set[pollset->nelts] = *descriptor;
+    if (descriptor->desc_type == APR_POLL_SOCKET) {
+        fd = descriptor->desc.s->socketdes;
+    }
+    else {
+        fd = descriptor->desc.f->filedes;
+    }
+
+    priv->pollset[pollset->nelts].fd = fd;
+
+    priv->pollset[pollset->nelts].events =
+        get_event(descriptor->reqevents);
+
+    pollset->nelts++;
+
+    DBG2(4, "exiting, fd %d added to pollset %p\n", fd, pollset);
+
+    return APR_SUCCESS;
+}   /* end of posix_add */
+
+
+static apr_status_t asio_pollset_add(apr_pollset_t *pollset,
+                                     const apr_pollfd_t *descriptor)
+{
+    DBG_BUFF
+    asio_elem_t *elem;
+    apr_status_t rv = APR_SUCCESS;
+    apr_pollset_private_t *priv = pollset->p;
+
+    pollset_lock_rings();
+    DBG(2, "entered\n");
+
+    if (pollset->flags & APR_POLLSET_THREADSAFE) {
+
+        if (!APR_RING_EMPTY(&(priv->free_ring), asio_elem_t, link)) {
+            elem = APR_RING_FIRST(&(priv->free_ring));
+            APR_RING_REMOVE(elem, link);
+            DBG1(3, "used recycled memory at %08p\n", elem);
+            elem->state = ASIO_INIT;
+        }
+        else {
+            elem = (asio_elem_t *) apr_pcalloc(pollset->pool, sizeof(asio_elem_t));
+            DBG1(3, "alloced new memory at %08p\n", elem);
+
+            elem->a.aio_notifytype = AIO_MSGQ;
+            elem->a.aio_msgev_qid  = priv->msg_q;
+            DBG1(5, "aio_msgev_quid = %d \n", elem->a.aio_msgev_qid);
+            elem->a.aio_msgev_size = sizeof(asio_elem_t *);
+            elem->a.aio_msgev_flag = 0;     /* wait if queue is full */
+            elem->a.aio_msgev_addr = &(elem->msg);
+            elem->a.aio_buf        = &(elem->os_pfd);
+            elem->a.aio_nbytes     = 1;     /* number of pfds to poll */
+            elem->msg.msg_type     = 1;
+            elem->msg.msg_elem     = elem;
+        }
+
+        /* z/OS only supports async I/O for sockets for now */
+        elem->os_pfd.fd = descriptor->desc.s->socketdes;
+
+        APR_RING_ELEM_INIT(elem, link);
+        elem->a.aio_cmd       = AIO_SELPOLL;
+        elem->a.aio_cflags    &= ~AIO_OK2COMPIMD; /* not OK to complete inline*/
+        elem->pfd             = *descriptor;
+        elem->os_pfd.events   = get_event(descriptor->reqevents);
+
+        if (0 != asyncio(&elem->a)) {
+            rv = errno;
+            DBG3(4, "pollset %p asio failed fd %d, errno %p\n",
+                     pollset, elem->os_pfd.fd, rv);
+#if DEBUG
+            perror(__FUNCTION__ " asio failure");
+#endif
+        }
+        else {
+            DBG2(4, "good asio call, adding fd %d to pollset %p\n",
+                     elem->os_pfd.fd, pollset);
+
+            pollset->nelts++;
+            apr_hash_set(priv->elems, &(elem->os_pfd.fd), sizeof(int), elem);
+        }
+    }
+    else {
+        /* APR_POLLSET_THREADSAFE isn't set.  use POSIX poll in case
+         * pipes or files are used with this pollset
+         */
+
+        rv = posix_add(pollset, descriptor);
+    }
+
+    DBG1(2, "exiting, rv = %d\n", rv);
+
+    pollset_unlock_rings();
+    return rv;
+} /* end of asio_pollset_add */
+
+static posix_remove(apr_pollset_t *pollset, const apr_pollfd_t *descriptor)
+{
+    DBG_BUFF
+    apr_uint32_t i;
+    apr_pollset_private_t *priv = pollset->p;
+
+    DBG(4, "entered\n");
+    for (i = 0; i < pollset->nelts; i++) {
+        if (descriptor->desc.s == priv->query_set[i].desc.s) {
+            /* Found an instance of the fd: remove this and any other copies */
+            apr_uint32_t dst = i;
+            apr_uint32_t old_nelts = pollset->nelts;
+            pollset->nelts--;
+            for (i++; i < old_nelts; i++) {
+                if (descriptor->desc.s == priv->query_set[i].desc.s) {
+                    pollset->nelts--;
+                }
+                else {
+                    priv->pollset[dst] = priv->pollset[i];
+                    priv->query_set[dst] = priv->query_set[i];
+                    dst++;
+                }
+            }
+            DBG(4, "returning OK\n");
+            return APR_SUCCESS;
+        }
+    }
+
+    DBG(1, "returning APR_NOTFOUND\n");
+    return APR_NOTFOUND;
+
+}   /* end of posix_remove */
+
+static apr_status_t asio_pollset_remove(apr_pollset_t *pollset,
+                                        const apr_pollfd_t *descriptor)
+{
+    DBG_BUFF
+    asio_elem_t *elem;
+    apr_status_t rv = APR_SUCCESS;
+    apr_pollset_private_t *priv = pollset->p;
+    struct aiocb cancel_a;   /* AIO_CANCEL is synchronous, so autodata works fine */
+
+    int fd;
+
+    DBG(2, "entered\n");
+
+    if (!(pollset->flags & APR_POLLSET_THREADSAFE)) {
+        return posix_remove(pollset, descriptor);
+    }
+
+    pollset_lock_rings();
+
+#if DEBUG
+    assert(descriptor->desc_type == APR_POLL_SOCKET);
+#endif
+    /* zOS 1.12 doesn't support files for async i/o */
+    fd = descriptor->desc.s->socketdes;
+
+    elem = apr_hash_get(priv->elems, &(fd), sizeof(int));
+    if (elem == NULL) {
+        DBG1(1, "couldn't find fd %d\n", fd);
+        rv = APR_NOTFOUND;
+    } else {
+        DBG1(5, "hash found fd %d\n", fd);
+        /* delete this fd from the hash */
+        apr_hash_set(priv->elems, &(fd), sizeof(int), NULL);
+
+        if (elem->state == ASIO_INIT) {
+            /* asyncio call to cancel */
+            cancel_a.aio_cmd = AIO_CANCEL;
+            cancel_a.aio_buf = &elem->a;   /* point to original aiocb */
+
+            cancel_a.aio_cflags  = 0;
+            cancel_a.aio_cflags2 = 0;
+
+            /* we want the original aiocb to show up on the pollset message queue 
+             * before recycling its memory to eliminate race conditions
+             */
+
+            rv = asyncio(&cancel_a);
+            DBG1(4, "asyncio returned %d\n", rv);
+
+#if DEBUG
+            assert(rv == 1);
+#endif
+        }
+        elem->state = ASIO_REMOVED;
+        rv = APR_SUCCESS;
+    }
+
+    DBG1(2, "exiting, rv: %d\n", rv);
+
+    pollset_unlock_rings();
+
+    return rv;
+}   /* end of asio_pollset_remove */
+
+static posix_poll(apr_pollset_t *pollset,
+                  apr_interval_time_t timeout,
+                  apr_int32_t *num,
+                  const apr_pollfd_t **descriptors)
+{
+    DBG_BUFF
+    int rv;
+    apr_uint32_t i, j;
+    apr_pollset_private_t *priv = pollset->p;
+
+    DBG(4, "entered\n");
+
+    if (timeout > 0) {
+        timeout /= 1000;
+    }
+    rv = poll(priv->pollset, pollset->nelts, timeout);
+    (*num) = rv;
+    if (rv < 0) {
+        return apr_get_netos_error();
+    }
+    if (rv == 0) {
+        return APR_TIMEUP;
+    }
+    j = 0;
+    for (i = 0; i < pollset->nelts; i++) {
+        if (priv->pollset[i].revents != 0) {
+            priv->result_set[j] = priv->query_set[i];
+            priv->result_set[j].rtnevents =
+                get_revent(priv->pollset[i].revents);
+            j++;
+        }
+    }
+    if (descriptors)
+        *descriptors = priv->result_set;
+
+    DBG(4, "exiting ok\n");
+    return APR_SUCCESS;
+
+}   /* end of posix_poll */
+
+static process_msg(apr_pollset_t *pollset, struct asio_msgbuf_t *msg)
+{
+    DBG_BUFF
+    asio_elem_t *elem = msg->msg_elem;
+
+    switch(elem->state) {
+    case ASIO_REMOVED:
+        DBG2(5, "for cancelled elem, recycling memory - elem %08p, fd %d\n",
+                elem, elem->os_pfd.fd);
+        APR_RING_INSERT_TAIL(&(pollset->p->free_ring), elem,
+                             asio_elem_t, link);
+        break;
+    case ASIO_INIT:
+        DBG2(4, "adding to ready ring: elem %08p, fd %d\n",
+                elem, elem->os_pfd.fd);
+        elem->state = ASIO_COMPLETE;
+        APR_RING_INSERT_TAIL(&(pollset->p->ready_ring), elem,
+                             asio_elem_t, link);
+        break;
+    default:
+        DBG3(1, "unexpected state: elem %08p, fd %d, state %d\n",
+            elem, elem->os_pfd.fd, elem->state);
+#if DEBUG
+        assert(0);
+#endif
+    }
+}
+
+static apr_status_t asio_pollset_poll(apr_pollset_t *pollset,
+                                      apr_interval_time_t timeout,
+                                      apr_int32_t *num,
+                                      const apr_pollfd_t **descriptors)
+{
+    DBG_BUFF
+    int i, ret;
+    asio_elem_t *elem, *next_elem;
+    struct asio_msgbuf_t msg_buff;
+    struct timespec tv;
+    apr_status_t rv = APR_SUCCESS;
+    apr_pollset_private_t *priv = pollset->p;
+
+    DBG(6, "entered\n"); /* chatty - traces every second w/Event */
+
+    if ((pollset->flags & APR_POLLSET_THREADSAFE) == 0 ) {
+        return posix_poll(pollset, timeout, num, descriptors);
+    }
+
+    pollset_lock_rings();
+    APR_RING_INIT(&(priv->ready_ring), asio_elem_t, link);
+
+    while (!APR_RING_EMPTY(&(priv->prior_ready_ring), asio_elem_t, link)) {
+        elem = APR_RING_FIRST(&(priv->prior_ready_ring));
+        DBG3(5, "pollset %p elem %p fd %d on prior ready ring\n",
+                pollset,
+                elem,
+                elem->os_pfd.fd);
+
+        APR_RING_REMOVE(elem, link);
+
+        /*
+         * since USS does not remember what's in our pollset, we have
+         * to re-add fds which have not been apr_pollset_remove'd
+         *
+         * there may have been too many ready fd's to return in the
+         * result set last time. re-poll inline for both cases
+         */
+
+        if (elem->state == ASIO_REMOVED) {
+
+            /* 
+             * async i/o is done since it was found on prior_ready
+             * the state says the caller is done with it too 
+             * so recycle the elem 
+             */
+             
+            APR_RING_INSERT_TAIL(&(priv->free_ring), elem,
+                                 asio_elem_t, link);
+            continue;  /* do not re-add if it has been _removed */
+        }
+
+        elem->state = ASIO_INIT;
+        elem->a.aio_cflags     = AIO_OK2COMPIMD;
+
+        if (0 != (ret = asyncio(&elem->a))) {
+            if (ret == 1) {
+                DBG(4, "asyncio() completed inline\n");
+                /* it's ready now */
+                APR_RING_INSERT_TAIL(&(priv->ready_ring), elem, asio_elem_t,
+                                     link);
+            }
+            else {
+                DBG2(1, "asyncio() failed, ret: %d, errno: %d\n",
+                        ret, errno);
+                pollset_unlock_rings();
+                return errno;
+            }
+        }
+        DBG1(4, "asyncio() completed rc %d\n", ret);
+    }
+
+    DBG(6, "after prior ready loop\n"); /* chatty w/timeouts, hence 6 */
+
+    /* Gather async poll completions that have occurred since the last call */
+    while (0 < msgrcv(priv->msg_q, &msg_buff, sizeof(asio_elem_t *), 0,
+                      IPC_NOWAIT)) {
+        process_msg(pollset, &msg_buff);
+    }
+
+    /* Suspend if nothing is ready yet. */
+    if (APR_RING_EMPTY(&(priv->ready_ring), asio_elem_t, link)) {
+
+        if (timeout >= 0) {
+            tv.tv_sec  = apr_time_sec(timeout);
+            tv.tv_nsec = apr_time_usec(timeout) * 1000;
+        } else {
+            tv.tv_sec = INT_MAX;  /* block until something is ready */
+        }
+
+        DBG2(6, "nothing on the ready ring "
+                "- blocking for %d seconds %d ns\n",
+                tv.tv_sec, tv.tv_nsec);
+
+        pollset_unlock_rings();   /* allow other apr_pollset_* calls while blocked */
+
+        if (0 >= (ret = __msgrcv_timed(priv->msg_q, &msg_buff,
+                                       sizeof(asio_elem_t *), 0, NULL, &tv))) {
+#if DEBUG
+            if (errno == EAGAIN) {
+                DBG(6, "__msgrcv_timed timed out\n"); /* timeout path, so 6 */
+            }
+            else {
+                DBG(1, "__msgrcv_timed failed!\n");
+            }
+#endif
+            return (errno == EAGAIN) ? APR_TIMEUP : errno;
+        }
+
+        pollset_lock_rings();
+
+        process_msg(pollset, &msg_buff);
+    }
+
+    APR_RING_INIT(&priv->prior_ready_ring, asio_elem_t, link);
+
+    (*num) = 0;
+    elem = APR_RING_FIRST(&(priv->ready_ring));
+
+    for (i = 0;
+
+        i < priv->size
+                && elem != APR_RING_SENTINEL(&(priv->ready_ring), asio_elem_t, link);
+        i++) {
+             DBG2(5, "ready ring: elem %08p, fd %d\n", elem, elem->os_pfd.fd);
+
+             priv->result_set[i] = elem->pfd;
+             priv->result_set[i].rtnevents
+                                    = get_revent(elem->os_pfd.revents);
+             (*num)++;
+
+             elem = APR_RING_NEXT(elem, link);
+
+#if DEBUG
+             if (elem == APR_RING_SENTINEL(&(priv->ready_ring), asio_elem_t, link)) {
+                 DBG(5, "end of ready ring reached\n");
+             }
+#endif
+    }
+
+    if (descriptors) {
+        *descriptors = priv->result_set;
+    }
+
+    /* if the result size is too small, remember which descriptors
+     * haven't had results reported yet.  we will look
+     * at these descriptors on the next apr_pollset_poll call
+     */
+
+    APR_RING_CONCAT(&priv->prior_ready_ring, &(priv->ready_ring), asio_elem_t, link);
+
+    DBG1(2, "exiting, rv = %d\n", rv);
+
+    pollset_unlock_rings();
+
+    return rv;
+}  /* end of asio_pollset_poll */
+
+static apr_pollset_provider_t impl = {
+    asio_pollset_create,
+    asio_pollset_add,
+    asio_pollset_remove,
+    asio_pollset_poll,
+    asio_pollset_cleanup,
+    "asio"
+};
+
+apr_pollset_provider_t *apr_pollset_provider_aio_msgq = &impl;
+
+#endif /* HAVE_AIO_MSGQ */
diff --git a/contrib/apr/shmem/unix/shm.c b/contrib/apr/shmem/unix/shm.c
index 80d56894f06..f102b4b359b 100644
--- a/contrib/apr/shmem/unix/shm.c
+++ b/contrib/apr/shmem/unix/shm.c
@@ -20,6 +20,62 @@
 #include "apr_errno.h"
 #include "apr_user.h"
 #include "apr_strings.h"
+#include "apr_hash.h"
+
+#if APR_USE_SHMEM_MMAP_SHM
+/* 
+ *   For portable use, a shared memory object should be identified by a name of
+ *   the form /somename; that is, a null-terminated string of up to NAME_MAX
+ *   (i.e., 255) characters consisting of an initial slash, followed by one or
+ *   more characters, none of which are slashes.
+ */
+#ifndef NAME_MAX
+#define NAME_MAX 255
+#endif
+
+/* See proc_mutex.c and sem_open for the reason for all this! */
+static unsigned int rshash (const char *p) {
+    /* hash function from Robert Sedgwicks 'Algorithms in C' book */
+    unsigned int b    = 378551;
+    unsigned int a    = 63689;
+    unsigned int retval = 0;
+
+    for( ; *p; p++) {
+        retval = retval * a + (*p);
+        a *= b;
+    }
+
+    return retval;
+}
+
+static const char *make_shm_open_safe_name(const char *filename,
+                                           apr_pool_t *pool)
+{
+    apr_ssize_t flen;
+    unsigned int h1, h2;
+
+    if (filename == NULL) {
+        return NULL;
+    }
+
+    flen = strlen(filename);
+    h1 = (apr_hashfunc_default(filename, &flen) & 0xffffffff);
+    h2 = (rshash(filename) & 0xffffffff);
+    return apr_psprintf(pool, "/ShM.%xH%x", h1, h2);
+
+}
+#endif
+
+#if APR_USE_SHMEM_SHMGET
+static key_t our_ftok(const char *filename)
+{
+    /* to help avoid collisions while still using
+     * an easily recreated proj_id */
+    apr_ssize_t slen = strlen(filename);
+    return ftok(filename,
+                (int)apr_hashfunc_default(filename, &slen));
+}
+#endif
 
 static apr_status_t shm_cleanup_owner(void *m_)
 {
@@ -58,7 +114,7 @@ static apr_status_t shm_cleanup_owner(void *m_)
         if (munmap(m->base, m->realsize) == -1) {
             return errno;
         }
-        if (shm_unlink(m->filename) == -1) {
+        if (shm_unlink(make_shm_open_safe_name(m->filename, m->pool)) == -1 && errno != ENOENT) {
             return errno;
         }
         return APR_SUCCESS;
@@ -220,7 +276,9 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m,
         new_m->pool = pool;
         new_m->reqsize = reqsize;
         new_m->filename = apr_pstrdup(pool, filename);
-
+#if APR_USE_SHMEM_MMAP_SHM
+        const char *shm_name = make_shm_open_safe_name(filename, pool);
+#endif
 #if APR_USE_SHMEM_MMAP_TMP || APR_USE_SHMEM_MMAP_SHM
         new_m->realsize = reqsize + 
             APR_ALIGN_DEFAULT(sizeof(apr_size_t)); /* room for metadata */
@@ -245,7 +303,7 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m,
         }
 
         status = apr_file_trunc(file, new_m->realsize);
-        if (status != APR_SUCCESS) {
+        if (status != APR_SUCCESS && status != APR_ESPIPE) {
             apr_file_close(file); /* ignore errors, we're failing */
             apr_file_remove(new_m->filename, new_m->pool);
             return status;
@@ -261,7 +319,8 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m,
         }
 #endif /* APR_USE_SHMEM_MMAP_TMP */
 #if APR_USE_SHMEM_MMAP_SHM
-        tmpfd = shm_open(filename, O_RDWR | O_CREAT | O_EXCL, 0644);
+        /* FIXME: SysV uses 0600... should we? */
+        tmpfd = shm_open(shm_name, O_RDWR | O_CREAT | O_EXCL, 0644);
         if (tmpfd == -1) {
             return errno;
         }
@@ -274,11 +333,11 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m,
         }
 
         status = apr_file_trunc(file, new_m->realsize);
-        if (status != APR_SUCCESS) {
-            shm_unlink(filename); /* we're failing, remove the object */
+        if (status != APR_SUCCESS && status != APR_ESPIPE) {
+            shm_unlink(shm_name); /* we're failing, remove the object */
             return status;
         }
-        new_m->base = mmap(NULL, reqsize, PROT_READ | PROT_WRITE,
+        new_m->base = mmap(NULL, new_m->realsize, PROT_READ | PROT_WRITE,
                            MAP_SHARED, tmpfd, 0);
 
         /* FIXME: check for errors */
@@ -312,28 +371,33 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m,
 
         /* ftok() (on solaris at least) requires that the file actually
          * exist before calling ftok(). */
-        shmkey = ftok(filename, 1);
+        shmkey = our_ftok(filename);
         if (shmkey == (key_t)-1) {
+            apr_file_close(file);
             return errno;
         }
 
         if ((new_m->shmid = shmget(shmkey, new_m->realsize,
                                    SHM_R | SHM_W | IPC_CREAT | IPC_EXCL)) < 0) {
+            apr_file_close(file);
             return errno;
         }
 
         if ((new_m->base = shmat(new_m->shmid, NULL, 0)) == (void *)-1) {
+            apr_file_close(file);
             return errno;
         }
         new_m->usable = new_m->base;
 
         if (shmctl(new_m->shmid, IPC_STAT, &shmbuf) == -1) {
+            apr_file_close(file);
             return errno;
         }
         apr_uid_current(&uid, &gid, pool);
         shmbuf.shm_perm.uid = uid;
         shmbuf.shm_perm.gid = gid;
         if (shmctl(new_m->shmid, IPC_SET, &shmbuf) == -1) {
+            apr_file_close(file);
             return errno;
         }
 
@@ -341,6 +405,7 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m,
         status = apr_file_write(file, (const void *)&reqsize,
                                 &nbytes);
         if (status != APR_SUCCESS) {
+            apr_file_close(file);
             return status;
         }
         status = apr_file_close(file);
@@ -359,6 +424,15 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m,
     }
 }
 
+APR_DECLARE(apr_status_t) apr_shm_create_ex(apr_shm_t **m, 
+                                            apr_size_t reqsize, 
+                                            const char *filename, 
+                                            apr_pool_t *p,
+                                            apr_int32_t flags)
+{
+    return apr_shm_create(m, reqsize, filename, p);
+}
+
 APR_DECLARE(apr_status_t) apr_shm_remove(const char *filename,
                                          apr_pool_t *pool)
 {
@@ -372,7 +446,8 @@ APR_DECLARE(apr_status_t) apr_shm_remove(const char *filename,
 #if APR_USE_SHMEM_MMAP_TMP
     return apr_file_remove(filename, pool);
 #elif APR_USE_SHMEM_MMAP_SHM
-    if (shm_unlink(filename) == -1) {
+    const char *shm_name = make_shm_open_safe_name(filename, pool);
+    if (shm_unlink(shm_name) == -1) {
         return errno;
     }
     return APR_SUCCESS;
@@ -386,7 +461,7 @@ APR_DECLARE(apr_status_t) apr_shm_remove(const char *filename,
 
     /* ftok() (on solaris at least) requires that the file actually
      * exist before calling ftok(). */
-    shmkey = ftok(filename, 1);
+    shmkey = our_ftok(filename);
     if (shmkey == (key_t)-1) {
         goto shm_remove_failed;
     }
@@ -467,7 +542,23 @@ APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m,
         new_m = apr_palloc(pool, sizeof(apr_shm_t));
         new_m->pool = pool;
         new_m->filename = apr_pstrdup(pool, filename);
+#if APR_USE_SHMEM_MMAP_SHM
+        const char *shm_name = make_shm_open_safe_name(filename, pool);
 
+        /* FIXME: SysV uses 0600... should we? */
+        tmpfd = shm_open(shm_name, O_RDWR, 0644);
+        if (tmpfd == -1) {
+            return errno;
+        }
+
+        status = apr_os_file_put(&file, &tmpfd,
+                                 APR_READ | APR_WRITE,
+                                 pool); 
+        if (status != APR_SUCCESS) {
+            return status;
+        }
+
+#elif APR_USE_SHMEM_MMAP_TMP
         status = apr_file_open(&file, filename, 
                                APR_READ | APR_WRITE,
                                APR_OS_DEFAULT, pool);
@@ -478,6 +569,9 @@ APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m,
         if (status != APR_SUCCESS) {
             return status;
         }
+#else
+        return APR_ENOTIMPL;
+#endif
 
         nbytes = sizeof(new_m->realsize);
         status = apr_file_read(file, (void *)&(new_m->realsize),
@@ -540,7 +634,7 @@ APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m,
 
         new_m->filename = apr_pstrdup(pool, filename);
         new_m->pool = pool;
-        shmkey = ftok(filename, 1);
+        shmkey = our_ftok(filename);
         if (shmkey == (key_t)-1) {
             return errno;
         }
@@ -564,6 +658,14 @@ APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m,
     }
 }
 
+APR_DECLARE(apr_status_t) apr_shm_attach_ex(apr_shm_t **m,
+                                            const char *filename,
+                                            apr_pool_t *pool,
+                                            apr_int32_t flags)
+{
+    return apr_shm_attach(m, filename, pool);
+}
+
 APR_DECLARE(apr_status_t) apr_shm_detach(apr_shm_t *m)
 {
     apr_status_t rv = shm_cleanup_attach(m);
diff --git a/contrib/apr/strings/apr_cpystrn.c b/contrib/apr/strings/apr_cpystrn.c
index 6311c29f3bf..d222d081429 100644
--- a/contrib/apr/strings/apr_cpystrn.c
+++ b/contrib/apr/strings/apr_cpystrn.c
@@ -38,6 +38,7 @@
  *   (3) Instead of returning the pointer to the beginning of
  *       the destination string, we return a pointer to the
  *       terminating '\0' to allow us to "check" for truncation
+ *   (4) If src is NULL, null terminate dst (empty string copy)
  *
  * apr_cpystrn() follows the same call structure as strncpy().
  */
@@ -45,19 +46,20 @@
 APR_DECLARE(char *) apr_cpystrn(char *dst, const char *src, apr_size_t dst_size)
 {
 
-    char *d, *end;
+    char *d = dst, *end;
 
     if (dst_size == 0) {
         return (dst);
     }
 
-    d = dst;
-    end = dst + dst_size - 1;
+    if (src) {
+        end = dst + dst_size - 1;
 
-    for (; d < end; ++d, ++src) {
-	if (!(*d = *src)) {
-	    return (d);
-	}
+        for (; d < end; ++d, ++src) {
+            if (!(*d = *src)) {
+                return (d);
+            }
+        }
     }
 
     *d = '\0';	/* always null terminate */
diff --git a/contrib/apr/strings/apr_strings.c b/contrib/apr/strings/apr_strings.c
index d20004eadae..0ba49c844c6 100644
--- a/contrib/apr/strings/apr_strings.c
+++ b/contrib/apr/strings/apr_strings.c
@@ -75,8 +75,7 @@ APR_DECLARE(char *) apr_pstrdup(apr_pool_t *a, const char *s)
         return NULL;
     }
     len = strlen(s) + 1;
-    res = apr_palloc(a, len);
-    memcpy(res, s, len);
+    res = apr_pmemdup(a, s, len);
     return res;
 }
 
diff --git a/contrib/apr/support/unix/waitio.c b/contrib/apr/support/unix/waitio.c
index 7232cdd9cea..0d762ea6dd6 100644
--- a/contrib/apr/support/unix/waitio.c
+++ b/contrib/apr/support/unix/waitio.c
@@ -22,7 +22,7 @@
 
 /* The only case where we don't use wait_for_io_or_timeout is on
  * pre-BONE BeOS, so this check should be sufficient and simpler */
-#if !BEOS_R5
+#if !defined(BEOS_R5) && !defined(OS2) && APR_FILES_AS_SOCKETS
 #define USE_WAIT_FOR_IO
 #endif
 
diff --git a/contrib/apr/tables/apr_hash.c b/contrib/apr/tables/apr_hash.c
index a6e8a64977b..0bf4d28c294 100644
--- a/contrib/apr/tables/apr_hash.c
+++ b/contrib/apr/tables/apr_hash.c
@@ -162,6 +162,29 @@ APR_DECLARE(void) apr_hash_this(apr_hash_index_t *hi,
     if (val)  *val  = (void *)hi->this->val;
 }
 
+APR_DECLARE(const void *) apr_hash_this_key(apr_hash_index_t *hi)
+{
+    const void *key;
+
+    apr_hash_this(hi, &key, NULL, NULL);
+    return key;
+}
+
+APR_DECLARE(apr_ssize_t) apr_hash_this_key_len(apr_hash_index_t *hi)
+{
+    apr_ssize_t klen;
+
+    apr_hash_this(hi, NULL, &klen, NULL);
+    return klen;
+}
+
+APR_DECLARE(void *) apr_hash_this_val(apr_hash_index_t *hi)
+{
+    void *val;
+
+    apr_hash_this(hi, NULL, NULL, &val);
+    return val;
+}
 
 /*
  * Expanding a hash table
diff --git a/contrib/apr/tables/apr_skiplist.c b/contrib/apr/tables/apr_skiplist.c
new file mode 100644
index 00000000000..effcf603b5f
--- /dev/null
+++ b/contrib/apr/tables/apr_skiplist.c
@@ -0,0 +1,650 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Modified to use APR and APR pools.
+ *  TODO: Is malloc() better? Will long running skiplists grow too much?
+ *  Keep the skiplist_alloc() and skiplist_free() until we know
+ *  Yeah, if using pools it means some bogus cycles for checks
+ *  (and an useless function call for skiplist_free) which we
+ *  can removed if/when needed.
+ */
+
+#include "apr_skiplist.h"
+
+struct apr_skiplist {
+    apr_skiplist_compare compare;
+    apr_skiplist_compare comparek;
+    int height;
+    int preheight;
+    int size;
+    apr_skiplistnode *top;
+    apr_skiplistnode *bottom;
+    /* These two are needed for appending */
+    apr_skiplistnode *topend;
+    apr_skiplistnode *bottomend;
+    apr_skiplist *index;
+    apr_array_header_t *memlist;
+    apr_pool_t *pool;
+};
+
+struct apr_skiplistnode {
+    void *data;
+    apr_skiplistnode *next;
+    apr_skiplistnode *prev;
+    apr_skiplistnode *down;
+    apr_skiplistnode *up;
+    apr_skiplistnode *previndex;
+    apr_skiplistnode *nextindex;
+    apr_skiplist *sl;
+};
+
+#ifndef MIN
+#define MIN(a,b) ((a 31) {              /* Num bits in return of rand() */
+        ph = 0;
+        randseq = (apr_uint32_t) rand();
+    }
+    ph++;
+    return ((randseq & (1 << (ph - 1))) >> (ph - 1));
+}
+
+typedef struct {
+    size_t size;
+    apr_array_header_t *list;
+} memlist_t;
+
+typedef struct {
+    void *ptr;
+    char inuse;
+} chunk_t;
+
+APR_DECLARE(void *) apr_skiplist_alloc(apr_skiplist *sl, size_t size)
+{
+    if (sl->pool) {
+        void *ptr;
+        int found_size = 0;
+        int i;
+        chunk_t *newchunk;
+        memlist_t *memlist = (memlist_t *)sl->memlist->elts;
+        for (i = 0; i < sl->memlist->nelts; i++) {
+            if (memlist->size == size) {
+                int j;
+                chunk_t *chunk = (chunk_t *)memlist->list->elts;
+                found_size = 1;
+                for (j = 0; j < memlist->list->nelts; j++) {
+                    if (!chunk->inuse) {
+                        chunk->inuse = 1;
+                        return chunk->ptr;
+                    }
+                    chunk++;
+                }
+                break; /* no free of this size; punt */
+            }
+            memlist++;
+        }
+        /* no free chunks */
+        ptr = apr_pcalloc(sl->pool, size);
+        if (!ptr) {
+            return ptr;
+        }
+        /*
+         * is this a new sized chunk? If so, we need to create a new
+         * array of them. Otherwise, re-use what we already have.
+         */
+        if (!found_size) {
+            memlist = apr_array_push(sl->memlist);
+            memlist->size = size;
+            memlist->list = apr_array_make(sl->pool, 20, sizeof(chunk_t));
+        }
+        newchunk = apr_array_push(memlist->list);
+        newchunk->ptr = ptr;
+        newchunk->inuse = 1;
+        return ptr;
+    }
+    else {
+        return calloc(1, size);
+    }
+}
+
+APR_DECLARE(void) apr_skiplist_free(apr_skiplist *sl, void *mem)
+{
+    if (!sl->pool) {
+        free(mem);
+    }
+    else {
+        int i;
+        memlist_t *memlist = (memlist_t *)sl->memlist->elts;
+        for (i = 0; i < sl->memlist->nelts; i++) {
+            int j;
+            chunk_t *chunk = (chunk_t *)memlist->list->elts;
+            for (j = 0; j < memlist->list->nelts; j++) {
+                if (chunk->ptr == mem) {
+                    chunk->inuse = 0;
+                    return;
+                }
+                chunk++;
+            }
+            memlist++;
+        }
+    }
+}
+
+static apr_status_t skiplisti_init(apr_skiplist **s, apr_pool_t *p)
+{
+    apr_skiplist *sl;
+    if (p) {
+        sl = apr_pcalloc(p, sizeof(apr_skiplist));
+        sl->memlist = apr_array_make(p, 20, sizeof(memlist_t));
+    }
+    else {
+        sl = calloc(1, sizeof(apr_skiplist));
+    }
+#if 0
+    sl->compare = (apr_skiplist_compare) NULL;
+    sl->comparek = (apr_skiplist_compare) NULL;
+    sl->height = 0;
+    sl->preheight = 0;
+    sl->size = 0;
+    sl->top = NULL;
+    sl->bottom = NULL;
+    sl->index = NULL;
+#endif
+    sl->pool = p;
+    *s = sl;
+    return APR_SUCCESS;
+}
+
+static int indexing_comp(void *a, void *b)
+{
+    void *ac = (void *) (((apr_skiplist *) a)->compare);
+    void *bc = (void *) (((apr_skiplist *) b)->compare);
+    return ((ac < bc) ? -1 : ((ac > bc) ? 1 : 0));
+}
+
+static int indexing_compk(void *ac, void *b)
+{
+    void *bc = (void *) (((apr_skiplist *) b)->compare);
+    return ((ac < bc) ? -1 : ((ac > bc) ? 1 : 0));
+}
+
+APR_DECLARE(apr_status_t) apr_skiplist_init(apr_skiplist **s, apr_pool_t *p)
+{
+    apr_skiplist *sl;
+    skiplisti_init(s, p);
+    sl = *s;
+    skiplisti_init(&(sl->index), p);
+    apr_skiplist_set_compare(sl->index, indexing_comp, indexing_compk);
+    return APR_SUCCESS;
+}
+
+APR_DECLARE(void) apr_skiplist_set_compare(apr_skiplist *sl,
+                          apr_skiplist_compare comp,
+                          apr_skiplist_compare compk)
+{
+    if (sl->compare && sl->comparek) {
+        apr_skiplist_add_index(sl, comp, compk);
+    }
+    else {
+        sl->compare = comp;
+        sl->comparek = compk;
+    }
+}
+
+APR_DECLARE(void) apr_skiplist_add_index(apr_skiplist *sl,
+                        apr_skiplist_compare comp,
+                        apr_skiplist_compare compk)
+{
+    apr_skiplistnode *m;
+    apr_skiplist *ni;
+    int icount = 0;
+    apr_skiplist_find(sl->index, (void *)comp, &m);
+    if (m) {
+        return;                 /* Index already there! */
+    }
+    skiplisti_init(&ni, sl->pool);
+    apr_skiplist_set_compare(ni, comp, compk);
+    /* Build the new index... This can be expensive! */
+    m = apr_skiplist_insert(sl->index, ni);
+    while (m->prev) {
+        m = m->prev;
+        icount++;
+    }
+    for (m = apr_skiplist_getlist(sl); m; apr_skiplist_next(sl, &m)) {
+        int j = icount - 1;
+        apr_skiplistnode *nsln;
+        nsln = apr_skiplist_insert(ni, m->data);
+        /* skip from main index down list */
+        while (j > 0) {
+            m = m->nextindex;
+            j--;
+        }
+        /* insert this node in the indexlist after m */
+        nsln->nextindex = m->nextindex;
+        if (m->nextindex) {
+            m->nextindex->previndex = nsln;
+        }
+        nsln->previndex = m;
+        m->nextindex = nsln;
+    }
+}
+
+APR_DECLARE(apr_skiplistnode *) apr_skiplist_getlist(apr_skiplist *sl)
+{
+    if (!sl->bottom) {
+        return NULL;
+    }
+    return sl->bottom->next;
+}
+
+APR_DECLARE(void *) apr_skiplist_find(apr_skiplist *sl, void *data, apr_skiplistnode **iter)
+{
+    void *ret;
+    apr_skiplistnode *aiter;
+    if (!sl->compare) {
+        return 0;
+    }
+    if (iter) {
+        ret = apr_skiplist_find_compare(sl, data, iter, sl->compare);
+    }
+    else {
+        ret = apr_skiplist_find_compare(sl, data, &aiter, sl->compare);
+    }
+    return ret;
+}
+
+static int skiplisti_find_compare(apr_skiplist *sl, void *data,
+                           apr_skiplistnode **ret,
+                           apr_skiplist_compare comp)
+{
+    apr_skiplistnode *m = NULL;
+    int count = 0;
+    m = sl->top;
+    while (m) {
+        int compared;
+        compared = (m->next) ? comp(data, m->next->data) : -1;
+        if (compared == 0) {
+            m = m->next;
+            while (m->down) {
+                m = m->down;
+            }
+            *ret = m;
+            return count;
+        }
+        if ((m->next == NULL) || (compared < 0)) {
+            m = m->down;
+            count++;
+        }
+        else {
+            m = m->next;
+            count++;
+        }
+    }
+    *ret = NULL;
+    return count;
+}
+
+APR_DECLARE(void *) apr_skiplist_find_compare(apr_skiplist *sli, void *data,
+                               apr_skiplistnode **iter,
+                               apr_skiplist_compare comp)
+{
+    apr_skiplistnode *m = NULL;
+    apr_skiplist *sl;
+    if (comp == sli->compare || !sli->index) {
+        sl = sli;
+    }
+    else {
+        apr_skiplist_find(sli->index, (void *)comp, &m);
+        sl = (apr_skiplist *) m->data;
+    }
+    skiplisti_find_compare(sl, data, iter, sl->comparek);
+    return (iter && *iter) ? ((*iter)->data) : NULL;
+}
+
+
+APR_DECLARE(void *) apr_skiplist_next(apr_skiplist *sl, apr_skiplistnode **iter)
+{
+    if (!*iter) {
+        return NULL;
+    }
+    *iter = (*iter)->next;
+    return (*iter) ? ((*iter)->data) : NULL;
+}
+
+APR_DECLARE(void *) apr_skiplist_previous(apr_skiplist *sl, apr_skiplistnode **iter)
+{
+    if (!*iter) {
+        return NULL;
+    }
+    *iter = (*iter)->prev;
+    return (*iter) ? ((*iter)->data) : NULL;
+}
+
+APR_DECLARE(apr_skiplistnode *) apr_skiplist_insert(apr_skiplist *sl, void *data)
+{
+    if (!sl->compare) {
+        return 0;
+    }
+    return apr_skiplist_insert_compare(sl, data, sl->compare);
+}
+
+APR_DECLARE(apr_skiplistnode *) apr_skiplist_insert_compare(apr_skiplist *sl, void *data,
+                                      apr_skiplist_compare comp)
+{
+    apr_skiplistnode *m, *p, *tmp, *ret = NULL, **stack;
+    int nh = 1, ch, stacki;
+    if (!sl->top) {
+        sl->height = 1;
+        sl->topend = sl->bottomend = sl->top = sl->bottom =
+            (apr_skiplistnode *)apr_skiplist_alloc(sl, sizeof(apr_skiplistnode));
+#if 0
+        sl->top->next = (apr_skiplistnode *)NULL;
+        sl->top->data = (apr_skiplistnode *)NULL;
+        sl->top->prev = (apr_skiplistnode *)NULL;
+        sl->top->up = (apr_skiplistnode *)NULL;
+        sl->top->down = (apr_skiplistnode *)NULL;
+        sl->top->nextindex = (apr_skiplistnode *)NULL;
+        sl->top->previndex = (apr_skiplistnode *)NULL;
+#endif
+        sl->top->sl = sl;
+    }
+    if (sl->preheight) {
+        while (nh < sl->preheight && get_b_rand()) {
+            nh++;
+        }
+    }
+    else {
+        while (nh <= sl->height && get_b_rand()) {
+            nh++;
+        }
+    }
+    /* Now we have the new height at which we wish to insert our new node */
+    /*
+     * Let us make sure that our tree is a least that tall (grow if
+     * necessary)
+     */
+    for (; sl->height < nh; sl->height++) {
+        sl->top->up =
+            (apr_skiplistnode *)apr_skiplist_alloc(sl, sizeof(apr_skiplistnode));
+        sl->top->up->down = sl->top;
+        sl->top = sl->topend = sl->top->up;
+#if 0
+        sl->top->prev = sl->top->next = sl->top->nextindex =
+            sl->top->previndex = sl->top->up = NULL;
+        sl->top->data = NULL;
+#endif
+        sl->top->sl = sl;
+    }
+    ch = sl->height;
+    /* Find the node (or node after which we would insert) */
+    /* Keep a stack to pop back through for insertion */
+    /* malloc() is OK since we free the temp stack */
+    m = sl->top;
+    stack = (apr_skiplistnode **)malloc(sizeof(apr_skiplistnode *) * (nh));
+    stacki = 0;
+    while (m) {
+        int compared = -1;
+        if (m->next) {
+            compared = comp(data, m->next->data);
+        }
+        if (compared == 0) {
+            free(stack);    /* OK. was malloc'ed */
+            return 0;
+        }
+        if ((m->next == NULL) || (compared < 0)) {
+            if (ch <= nh) {
+                /* push on stack */
+                stack[stacki++] = m;
+            }
+            m = m->down;
+            ch--;
+        }
+        else {
+            m = m->next;
+        }
+    }
+    /* Pop the stack and insert nodes */
+    p = NULL;
+    for (; stacki > 0; stacki--) {
+        m = stack[stacki - 1];
+        tmp = (apr_skiplistnode *)apr_skiplist_alloc(sl, sizeof(apr_skiplistnode));
+        tmp->next = m->next;
+        if (m->next) {
+            m->next->prev = tmp;
+        }
+        tmp->prev = m;
+        tmp->up = NULL;
+        tmp->nextindex = tmp->previndex = NULL;
+        tmp->down = p;
+        if (p) {
+            p->up = tmp;
+        }
+        tmp->data = data;
+        tmp->sl = sl;
+        m->next = tmp;
+        /* This sets ret to the bottom-most node we are inserting */
+        if (!p) {
+            ret = tmp;
+            sl->size++; /* this seems to go here got each element to be counted */
+        }
+        p = tmp;
+    }
+    free(stack); /* OK. was malloc'ed */
+    if (sl->index != NULL) {
+        /*
+         * this is a external insertion, we must insert into each index as
+         * well
+         */
+        apr_skiplistnode *ni, *li;
+        li = ret;
+        for (p = apr_skiplist_getlist(sl->index); p; apr_skiplist_next(sl->index, &p)) {
+            ni = apr_skiplist_insert((apr_skiplist *) p->data, ret->data);
+            li->nextindex = ni;
+            ni->previndex = li;
+            li = ni;
+        }
+    }
+    else {
+        /* sl->size++; */
+    }
+    sl->size++;
+    return ret;
+}
+
+APR_DECLARE(int) apr_skiplist_remove(apr_skiplist *sl, void *data, apr_skiplist_freefunc myfree)
+{
+    if (!sl->compare) {
+        return 0;
+    }
+    return apr_skiplist_remove_compare(sl, data, myfree, sl->comparek);
+}
+
+#if 0
+void skiplist_print_struct(apr_skiplist * sl, char *prefix)
+{
+    apr_skiplistnode *p, *q;
+    fprintf(stderr, "Skiplist Structure (height: %d)\n", sl->height);
+    p = sl->bottom;
+    while (p) {
+        q = p;
+        fprintf(stderr, prefix);
+        while (q) {
+            fprintf(stderr, "%p ", q->data);
+            q = q->up;
+        }
+        fprintf(stderr, "\n");
+        p = p->next;
+    }
+}
+#endif
+
+static int skiplisti_remove(apr_skiplist *sl, apr_skiplistnode *m, apr_skiplist_freefunc myfree)
+{
+    apr_skiplistnode *p;
+    if (!m) {
+        return 0;
+    }
+    if (m->nextindex) {
+        skiplisti_remove(m->nextindex->sl, m->nextindex, NULL);
+    }
+    while (m->up) {
+        m = m->up;
+    }
+    while (m) {
+        p = m;
+        p->prev->next = p->next;/* take me out of the list */
+        if (p->next) {
+            p->next->prev = p->prev;    /* take me out of the list */
+        }
+        m = m->down;
+        /* This only frees the actual data in the bottom one */
+        if (!m && myfree && p->data) {
+            myfree(p->data);
+        }
+        apr_skiplist_free(sl, p);
+    }
+    sl->size--;
+    while (sl->top && sl->top->next == NULL) {
+        /* While the row is empty and we are not on the bottom row */
+        p = sl->top;
+        sl->top = sl->top->down;/* Move top down one */
+        if (sl->top) {
+            sl->top->up = NULL; /* Make it think its the top */
+        }
+        apr_skiplist_free(sl, p);
+        sl->height--;
+    }
+    if (!sl->top) {
+        sl->bottom = NULL;
+    }
+    return sl->height;  /* return 1; ?? */
+}
+
+APR_DECLARE(int) apr_skiplist_remove_compare(apr_skiplist *sli,
+                            void *data,
+                            apr_skiplist_freefunc myfree, apr_skiplist_compare comp)
+{
+    apr_skiplistnode *m;
+    apr_skiplist *sl;
+    if (comp == sli->comparek || !sli->index) {
+        sl = sli;
+    }
+    else {
+        apr_skiplist_find(sli->index, (void *)comp, &m);
+        sl = (apr_skiplist *) m->data;
+    }
+    skiplisti_find_compare(sl, data, &m, comp);
+    if (!m) {
+        return 0;
+    }
+    while (m->previndex) {
+        m = m->previndex;
+    }
+    return skiplisti_remove(sl, m, myfree);
+}
+
+APR_DECLARE(void) apr_skiplist_remove_all(apr_skiplist *sl, apr_skiplist_freefunc myfree)
+{
+    /*
+     * This must remove even the place holder nodes (bottom though top)
+     * because we specify in the API that one can free the Skiplist after
+     * making this call without memory leaks
+     */
+    apr_skiplistnode *m, *p, *u;
+    m = sl->bottom;
+    while (m) {
+        p = m->next;
+        if (p && myfree && p->data)
+            myfree(p->data);
+        while (m) {
+            u = m->up;
+            apr_skiplist_free(sl, p);
+            m = u;
+        }
+        m = p;
+    }
+    sl->top = sl->bottom = NULL;
+    sl->height = 0;
+    sl->size = 0;
+}
+
+APR_DECLARE(void *) apr_skiplist_pop(apr_skiplist *a, apr_skiplist_freefunc myfree)
+{
+    apr_skiplistnode *sln;
+    void *data = NULL;
+    sln = apr_skiplist_getlist(a);
+    if (sln) {
+        data = sln->data;
+        skiplisti_remove(a, sln, myfree);
+    }
+    return data;
+}
+
+APR_DECLARE(void *) apr_skiplist_peek(apr_skiplist *a)
+{
+    apr_skiplistnode *sln;
+    sln = apr_skiplist_getlist(a);
+    if (sln) {
+        return sln->data;
+    }
+    return NULL;
+}
+
+static void skiplisti_destroy(void *vsl)
+{
+    apr_skiplist_destroy((apr_skiplist *) vsl, NULL);
+    apr_skiplist_free((apr_skiplist *) vsl, vsl);
+}
+
+APR_DECLARE(void) apr_skiplist_destroy(apr_skiplist *sl, apr_skiplist_freefunc myfree)
+{
+    while (apr_skiplist_pop(sl->index, skiplisti_destroy) != NULL)
+        ;
+    apr_skiplist_remove_all(sl, myfree);
+}
+
+APR_DECLARE(apr_skiplist *) apr_skiplist_merge(apr_skiplist *sl1, apr_skiplist *sl2)
+{
+    /* Check integrity! */
+    apr_skiplist temp;
+    struct apr_skiplistnode *b2;
+    if (sl1->bottomend == NULL || sl1->bottomend->prev == NULL) {
+        apr_skiplist_remove_all(sl1, NULL);
+        temp = *sl1;
+        *sl1 = *sl2;
+        *sl2 = temp;
+        /* swap them so that sl2 can be freed normally upon return. */
+        return sl1;
+    }
+    if(sl2->bottom == NULL || sl2->bottom->next == NULL) {
+        apr_skiplist_remove_all(sl2, NULL);
+        return sl1;
+    }
+    /* This is what makes it brute force... Just insert :/ */
+    b2 = apr_skiplist_getlist(sl2);
+    while (b2) {
+        apr_skiplist_insert(sl1, b2->data);
+        apr_skiplist_next(sl2, &b2);
+    }
+    apr_skiplist_remove_all(sl2, NULL);
+    return sl1;
+}
diff --git a/contrib/apr/tables/apr_tables.c b/contrib/apr/tables/apr_tables.c
index 7479ef47c7a..2f5b4e53745 100644
--- a/contrib/apr/tables/apr_tables.c
+++ b/contrib/apr/tables/apr_tables.c
@@ -357,6 +357,14 @@ struct apr_table_t {
     int index_last[TABLE_HASH_SIZE];
 };
 
+/* keep state for apr_table_getm() */
+typedef struct
+{
+    apr_pool_t *p;
+    const char *first;
+    apr_array_header_t *merged;
+} table_getm_t;
+
 /*
  * NOTICE: if you tweak this you should look at is_empty_table() 
  * and table_elts() in alloc.h
@@ -736,12 +744,14 @@ APR_DECLARE(void) apr_table_mergen(apr_table_t *t, const char *key,
     {
 	apr_pool_t *pool;
 	pool = apr_pool_find(key);
-	if ((pool != key) && (!apr_pool_is_ancestor(pool, t->a.pool))) {
+	if ((pool != (apr_pool_t *)key)
+            && (!apr_pool_is_ancestor(pool, t->a.pool))) {
 	    fprintf(stderr, "apr_table_mergen: key not in ancestor pool of t\n");
 	    abort();
 	}
 	pool = apr_pool_find(val);
-	if ((pool != val) && (!apr_pool_is_ancestor(pool, t->a.pool))) {
+	if ((pool != (apr_pool_t *)val)
+            && (!apr_pool_is_ancestor(pool, t->a.pool))) {
 	    fprintf(stderr, "apr_table_mergen: val not in ancestor pool of t\n");
 	    abort();
 	}
@@ -1236,3 +1246,51 @@ APR_DECLARE(void) apr_table_overlap(apr_table_t *a, const apr_table_t *b,
 
     apr_table_compress(a, flags);
 }
+
+static int table_getm_do(void *v, const char *key, const char *val)
+{
+    table_getm_t *state = (table_getm_t *) v;
+
+    if (!state->first) {
+        /**
+         * The most common case is a single header, and this is covered by
+         * a fast path that doesn't allocate any memory. On the second and
+         * subsequent header, an array is created and the array concatenated
+         * together to form the final value.
+         */
+        state->first = val;
+    }
+    else {
+        const char **elt;
+        if (!state->merged) {
+            state->merged = apr_array_make(state->p, 10, sizeof(const char *));
+            elt = apr_array_push(state->merged);
+            *elt = state->first;
+        }
+        elt = apr_array_push(state->merged);
+        *elt = val;
+    }
+    return 1;
+}
+
+APR_DECLARE(const char *) apr_table_getm(apr_pool_t *p, const apr_table_t *t,
+        const char *key)
+{
+    table_getm_t state;
+
+    state.p = p;
+    state.first = NULL;
+    state.merged = NULL;
+
+    apr_table_do(table_getm_do, &state, t, key, NULL);
+
+    if (!state.first) {
+        return NULL;
+    }
+    else if (!state.merged) {
+        return state.first;
+    }
+    else {
+        return apr_array_pstrcat(p, state.merged, ',');
+    }
+}
diff --git a/contrib/apr/tools/gen_test_char.c b/contrib/apr/tools/gen_test_char.c
new file mode 100644
index 00000000000..811c802f215
--- /dev/null
+++ b/contrib/apr/tools/gen_test_char.c
@@ -0,0 +1,115 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if defined(WIN32) || defined(OS2)
+#define NEED_ENHANCED_ESCAPES
+#endif
+
+#include 
+#include 
+#include 
+#include 
+
+/* A bunch of functions in util.c scan strings looking for certain characters.
+ * To make that more efficient we encode a lookup table.
+ */
+#define T_ESCAPE_SHELL_CMD    (0x01)
+#define T_ESCAPE_PATH_SEGMENT (0x02)
+#define T_OS_ESCAPE_PATH      (0x04)
+#define T_ESCAPE_ECHO         (0x08)
+#define T_ESCAPE_URLENCODED   (0x10)
+#define T_ESCAPE_XML          (0x20)
+
+int main(int argc, char *argv[])
+{
+    unsigned c;
+    unsigned char flags;
+
+    printf("/* this file is automatically generated by gen_test_char, "
+           "do not edit. \"make include/private/apr_escape_test_char.h\" to regenerate. */\n"
+           "#define T_ESCAPE_SHELL_CMD     (%u)\n"
+           "#define T_ESCAPE_PATH_SEGMENT  (%u)\n"
+           "#define T_OS_ESCAPE_PATH       (%u)\n"
+           "#define T_ESCAPE_ECHO          (%u)\n"
+           "#define T_ESCAPE_URLENCODED    (%u)\n"
+           "#define T_ESCAPE_XML           (%u)\n"
+           "\n"
+           "static const unsigned char test_char_table[256] = {",
+           T_ESCAPE_SHELL_CMD,
+           T_ESCAPE_PATH_SEGMENT,
+           T_OS_ESCAPE_PATH,
+           T_ESCAPE_ECHO,
+           T_ESCAPE_URLENCODED,
+           T_ESCAPE_XML);
+
+    for (c = 0; c < 256; ++c) {
+        flags = 0;
+        if (c % 20 == 0)
+            printf("\n    ");
+
+        /* escape_shell_cmd */
+#ifdef NEED_ENHANCED_ESCAPES
+        /* Win32/OS2 have many of the same vulnerable characters
+         * as Unix sh, plus the carriage return and percent char.
+         * The proper escaping of these characters varies from unix
+         * since Win32/OS2 use carets or doubled-double quotes,
+         * and neither lf nor cr can be escaped.  We escape unix
+         * specific as well, to assure that cross-compiled unix
+         * applications behave similiarly when invoked on win32/os2.
+         *
+         * Rem please keep in-sync with apr's list in win32/filesys.c
+         */
+        if (c && strchr("&;`'\"|*?~<>^()[]{}$\\\n\r%", c)) {
+            flags |= T_ESCAPE_SHELL_CMD;
+        }
+#else
+        if (c && strchr("&;`'\"|*?~<>^()[]{}$\\\n", c)) {
+            flags |= T_ESCAPE_SHELL_CMD;
+        }
+#endif
+
+        if (!isalnum(c) && !strchr("$-_.+!*'(),:@&=~", c)) {
+            flags |= T_ESCAPE_PATH_SEGMENT;
+        }
+
+        if (!isalnum(c) && !strchr("$-_.+!*'(),:@&=/~", c)) {
+            flags |= T_OS_ESCAPE_PATH;
+        }
+
+        if (!isalnum(c) && !strchr(".-*_ ", c)) {
+            flags |= T_ESCAPE_URLENCODED;
+        }
+
+        /* For logging, escape all control characters,
+         * double quotes (because they delimit the request in the log file)
+         * backslashes (because we use backslash for escaping)
+         * and 8-bit chars with the high bit set
+         */
+        if (c && (!isprint(c) || c == '"' || c == '\\' || iscntrl(c))) {
+            flags |= T_ESCAPE_ECHO;
+        }
+
+        if (strchr("<>&\"", c)) {
+            flags |= T_ESCAPE_XML;
+        }
+
+        printf("%u%c", flags, (c < 255) ? ',' : ' ');
+    }
+
+    printf("\n};\n");
+
+    return 0;
+}
diff --git a/contrib/atf/FREEBSD-Xlist b/contrib/atf/FREEBSD-Xlist
index bcc8a4bacf2..5af9ed5e9aa 100644
--- a/contrib/atf/FREEBSD-Xlist
+++ b/contrib/atf/FREEBSD-Xlist
@@ -2,6 +2,8 @@
 */*/Makefile*
 */Atffile
 */Makefile*
+*/*.m4
+*/*.pc.in
 Atffile
 INSTALL
 Makefile*
diff --git a/contrib/atf/atf-c++/atf-c++.m4 b/contrib/atf/atf-c++/atf-c++.m4
deleted file mode 100644
index 0763d04865b..00000000000
--- a/contrib/atf/atf-c++/atf-c++.m4
+++ /dev/null
@@ -1,48 +0,0 @@
-dnl
-dnl Automated Testing Framework (atf)
-dnl
-dnl Copyright 2011 Google Inc.
-dnl All rights reserved.
-dnl
-dnl Redistribution and use in source and binary forms, with or without
-dnl modification, are permitted provided that the following conditions are
-dnl met:
-dnl
-dnl * Redistributions of source code must retain the above copyright
-dnl   notice, this list of conditions and the following disclaimer.
-dnl * Redistributions in binary form must reproduce the above copyright
-dnl   notice, this list of conditions and the following disclaimer in the
-dnl   documentation and/or other materials provided with the distribution.
-dnl * Neither the name of Google Inc. nor the names of its contributors
-dnl   may be used to endorse or promote products derived from this software
-dnl   without specific prior written permission.
-dnl
-dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-dnl "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-dnl LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-dnl A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-dnl OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-dnl SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-dnl LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-dnl DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-dnl THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-dnl (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-dnl OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-dnl
-
-dnl ATF_CHECK_CXX([version-spec])
-dnl
-dnl Checks if atf-c++ is present.  If version-spec is provided, ensures that
-dnl the installed version of atf-sh matches the required version.  This
-dnl argument must be something like '>= 0.14' and accepts any version
-dnl specification supported by pkg-config.
-dnl
-dnl Defines and substitutes ATF_CXX_CFLAGS and ATF_CXX_LIBS with the compiler
-dnl and linker flags need to build against atf-c++.
-AC_DEFUN([ATF_CHECK_CXX], [
-    spec="atf-c++[]m4_default_nblank([ $1], [])"
-    _ATF_CHECK_ARG_WITH(
-        [PKG_CHECK_MODULES([ATF_CXX], [${spec}],
-                           [found=yes found_atf_cxx=yes], [found=no])],
-        [required ${spec} not found])
-])
diff --git a/contrib/atf/atf-c++/atf-c++.pc.in b/contrib/atf/atf-c++/atf-c++.pc.in
deleted file mode 100644
index f366bb016d0..00000000000
--- a/contrib/atf/atf-c++/atf-c++.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-# ATF pkg-config file
-
-cxx=__CXX__
-includedir=__INCLUDEDIR__
-libdir=__LIBDIR__
-
-Name: atf-c++
-Description: Automated Testing Framework (C++ binding)
-Version: __ATF_VERSION__
-Cflags: -I${includedir}
-Libs: -L${libdir} -latf-c++ -latf-c
diff --git a/contrib/atf/atf-c/atf-c.m4 b/contrib/atf/atf-c/atf-c.m4
deleted file mode 100644
index d0237b84820..00000000000
--- a/contrib/atf/atf-c/atf-c.m4
+++ /dev/null
@@ -1,48 +0,0 @@
-dnl
-dnl Automated Testing Framework (atf)
-dnl
-dnl Copyright 2011 Google Inc.
-dnl All rights reserved.
-dnl
-dnl Redistribution and use in source and binary forms, with or without
-dnl modification, are permitted provided that the following conditions are
-dnl met:
-dnl
-dnl * Redistributions of source code must retain the above copyright
-dnl   notice, this list of conditions and the following disclaimer.
-dnl * Redistributions in binary form must reproduce the above copyright
-dnl   notice, this list of conditions and the following disclaimer in the
-dnl   documentation and/or other materials provided with the distribution.
-dnl * Neither the name of Google Inc. nor the names of its contributors
-dnl   may be used to endorse or promote products derived from this software
-dnl   without specific prior written permission.
-dnl
-dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-dnl "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-dnl LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-dnl A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-dnl OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-dnl SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-dnl LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-dnl DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-dnl THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-dnl (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-dnl OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-dnl
-
-dnl ATF_CHECK_C([version-spec])
-dnl
-dnl Checks if atf-c is present.  If version-spec is provided, ensures that
-dnl the installed version of atf-sh matches the required version.  This
-dnl argument must be something like '>= 0.14' and accepts any version
-dnl specification supported by pkg-config.
-dnl
-dnl Defines and substitutes ATF_C_CFLAGS and ATF_C_LIBS with the compiler
-dnl and linker flags need to build against atf-c.
-AC_DEFUN([ATF_CHECK_C], [
-    spec="atf-c[]m4_default_nblank([ $1], [])"
-    _ATF_CHECK_ARG_WITH(
-        [PKG_CHECK_MODULES([ATF_C], [${spec}],
-                           [found=yes found_atf_c=yes], [found=no])],
-        [required ${spec} not found])
-])
diff --git a/contrib/atf/atf-c/atf-c.pc.in b/contrib/atf/atf-c/atf-c.pc.in
deleted file mode 100644
index 6fd52740b79..00000000000
--- a/contrib/atf/atf-c/atf-c.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-# ATF pkg-config file
-
-cc=__CC__
-includedir=__INCLUDEDIR__
-libdir=__LIBDIR__
-
-Name: atf-c
-Description: Automated Testing Framework (C binding)
-Version: __ATF_VERSION__
-Cflags: -I${includedir}
-Libs: -L${libdir} -latf-c
diff --git a/contrib/atf/atf-c/atf-common.m4 b/contrib/atf/atf-c/atf-common.m4
deleted file mode 100644
index 464a5a7fa00..00000000000
--- a/contrib/atf/atf-c/atf-common.m4
+++ /dev/null
@@ -1,92 +0,0 @@
-dnl
-dnl Automated Testing Framework (atf)
-dnl
-dnl Copyright 2011 Google Inc.
-dnl All rights reserved.
-dnl
-dnl Redistribution and use in source and binary forms, with or without
-dnl modification, are permitted provided that the following conditions are
-dnl met:
-dnl
-dnl * Redistributions of source code must retain the above copyright
-dnl   notice, this list of conditions and the following disclaimer.
-dnl * Redistributions in binary form must reproduce the above copyright
-dnl   notice, this list of conditions and the following disclaimer in the
-dnl   documentation and/or other materials provided with the distribution.
-dnl * Neither the name of Google Inc. nor the names of its contributors
-dnl   may be used to endorse or promote products derived from this software
-dnl   without specific prior written permission.
-dnl
-dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-dnl "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-dnl LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-dnl A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-dnl OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-dnl SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-dnl LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-dnl DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-dnl THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-dnl (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-dnl OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-dnl
-
-dnl ATF_ARG_WITH
-dnl
-dnl Adds a --with-atf flag to the configure script that allows the user to
-dnl enable or disable atf support.
-dnl
-dnl The ATF_CHECK_{C,CXX,SH} macros honor the flag defined herein if
-dnl instantiated.  If not instantiated, they will request the presence of
-dnl the libraries unconditionally.
-dnl
-dnl Defines the WITH_ATF Automake conditional if ATF has been found by any
-dnl of the ATF_CHECK_{C,CXX,SH} macros.
-AC_DEFUN([ATF_ARG_WITH], [
-    m4_define([atf_arg_with_called], [yes])
-
-    m4_divert_text([DEFAULTS], [with_atf=auto])
-    AC_ARG_WITH([atf],
-                [AS_HELP_STRING([--with-atf=],
-                                [build atf-based test programs])],
-                [with_atf=${withval}], [with_atf=auto])
-
-    m4_divert_text([DEFAULTS], [
-        found_atf_c=no
-        found_atf_cxx=no
-        found_atf_sh=no
-    ])
-    AM_CONDITIONAL([WITH_ATF], [test x"${found_atf_c}" = x"yes" -o \
-                                     x"${found_atf_cxx}" = x"yes" -o \
-                                     x"${found_atf_sh}" = x"yes"])
-])
-
-dnl _ATF_CHECK_ARG_WITH(check, error_message)
-dnl
-dnl Internal macro to execute a check conditional on the --with-atf flag
-dnl and handle the result accordingly.
-dnl
-dnl 'check' specifies the piece of code to be run to detect the feature.
-dnl This code must set the 'found' shell variable to yes or no depending
-dnl on the raw result of the check.
-AC_DEFUN([_ATF_CHECK_ARG_WITH], [
-    m4_ifdef([atf_arg_with_called], [
-        m4_fatal([ATF_ARG_WITH must be called after the ATF_CHECK_* checks])
-    ])
-
-    m4_divert_text([DEFAULTS], [with_atf=yes])
-
-    if test x"${with_atf}" = x"no"; then
-        _found=no
-    else
-        $1
-        if test x"${with_atf}" = x"auto"; then
-            _found="${found}"
-        else
-            if test x"${found}" = x"yes"; then
-                _found=yes
-            else
-                AC_MSG_ERROR([$2])
-            fi
-        fi
-    fi
-])
diff --git a/contrib/atf/atf-sh/atf-sh.m4 b/contrib/atf/atf-sh/atf-sh.m4
deleted file mode 100644
index 7215d1c7fe4..00000000000
--- a/contrib/atf/atf-sh/atf-sh.m4
+++ /dev/null
@@ -1,53 +0,0 @@
-dnl
-dnl Automated Testing Framework (atf)
-dnl
-dnl Copyright 2011 Google Inc.
-dnl All rights reserved.
-dnl
-dnl Redistribution and use in source and binary forms, with or without
-dnl modification, are permitted provided that the following conditions are
-dnl met:
-dnl
-dnl * Redistributions of source code must retain the above copyright
-dnl   notice, this list of conditions and the following disclaimer.
-dnl * Redistributions in binary form must reproduce the above copyright
-dnl   notice, this list of conditions and the following disclaimer in the
-dnl   documentation and/or other materials provided with the distribution.
-dnl * Neither the name of Google Inc. nor the names of its contributors
-dnl   may be used to endorse or promote products derived from this software
-dnl   without specific prior written permission.
-dnl
-dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-dnl "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-dnl LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-dnl A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-dnl OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-dnl SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-dnl LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-dnl DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-dnl THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-dnl (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-dnl OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-dnl
-
-dnl ATF_CHECK_SH([version-spec])
-dnl
-dnl Checks if atf-sh is present.  If version-spec is provided, ensures that
-dnl the installed version of atf-sh matches the required version.  This
-dnl argument must be something like '>= 0.14' and accepts any version
-dnl specification supported by pkg-config.
-dnl
-dnl Defines and substitutes ATF_SH with the full path to the atf-sh interpreter.
-AC_DEFUN([ATF_CHECK_SH], [
-    spec="atf-sh[]m4_default_nblank([ $1], [])"
-    _ATF_CHECK_ARG_WITH(
-        [AC_MSG_CHECKING([for ${spec}])
-         PKG_CHECK_EXISTS([${spec}], [found=yes], [found=no])
-         if test "${found}" = yes; then
-             ATF_SH="$(${PKG_CONFIG} --variable=interpreter atf-sh)"
-             AC_SUBST([ATF_SH], [${ATF_SH}])
-             found_atf_sh=yes
-         fi
-         AC_MSG_RESULT([${ATF_SH}])],
-        [required ${spec} not found])
-])
diff --git a/contrib/atf/atf-sh/atf-sh.pc.in b/contrib/atf/atf-sh/atf-sh.pc.in
deleted file mode 100644
index 930dc4c3d4c..00000000000
--- a/contrib/atf/atf-sh/atf-sh.pc.in
+++ /dev/null
@@ -1,8 +0,0 @@
-# ATF pkg-config file
-
-exec_prefix=__EXEC_PREFIX__
-interpreter=${exec_prefix}/bin/atf-sh
-
-Name: atf-sh
-Description: Automated Testing Framework (POSIX shell binding)
-Version: __ATF_VERSION__
diff --git a/contrib/binutils/opcodes/i386-dis.c b/contrib/binutils/opcodes/i386-dis.c
index 22c4b8053cd..073afa1a836 100644
--- a/contrib/binutils/opcodes/i386-dis.c
+++ b/contrib/binutils/opcodes/i386-dis.c
@@ -85,6 +85,7 @@ static void OP_MS (int, int);
 static void OP_XS (int, int);
 static void OP_M (int, int);
 static void OP_VMX (int, int);
+static void OP_VMX2 (int, int);
 static void OP_0fae (int, int);
 static void OP_0f07 (int, int);
 static void NOP_Fixup1 (int, int);
@@ -318,6 +319,7 @@ fetch_data (struct disassemble_info *info, bfd_byte *addr)
 #define EMC { OP_EMC, v_mode }
 #define MXC { OP_MXC, 0 }
 #define VM { OP_VMX, q_mode }
+#define VM2 { OP_VMX2, q_mode }
 #define OPSUF { OP_3DNowSuffix, 0 }
 #define OPSIMD { OP_SIMD_Suffix, 0 }
 #define XMM0 { XMM_Fixup, 0 }
@@ -1732,7 +1734,7 @@ static const struct dis386 grps[][8] = {
     { "(bad)",	{ XX } },
     { "(bad)",	{ XX } },
     { "",	{ VM } },		/* See OP_VMX.  */
-    { "vmptrst", { Mq } },
+    { "",	{ VM2 } },		/* See OP_VMX2.  */
   },
   /* GRP11_C6 */
   {
@@ -6466,6 +6468,21 @@ OP_VMX (int bytemode, int sizeflag)
     }
 }
 
+static void
+OP_VMX2 (int bytemode, int sizeflag)
+{
+  if (modrm.mod == 3)
+    {
+      strcpy (obuf, "rdseed");
+      OP_E (v_mode, sizeflag);
+    }
+  else
+    {
+      strcpy (obuf, "vmptrst");
+      OP_M (q_mode, sizeflag);
+    }
+}
+
 static void
 REP_Fixup (int bytemode, int sizeflag)
 {
diff --git a/contrib/binutils/opcodes/i386-opc.tbl b/contrib/binutils/opcodes/i386-opc.tbl
index f7f7f0dc74f..9d7c207612b 100644
--- a/contrib/binutils/opcodes/i386-opc.tbl
+++ b/contrib/binutils/opcodes/i386-opc.tbl
@@ -1524,3 +1524,4 @@ pclmulhqhqdq, 2, 0x660f3a44, 0x11, CpuPCLMUL, Modrm|IgnoreSize|No_bSuf|No_wSuf|N
 
 // Intel Random Number Generator extensions
 rdrand, 1, 0x0fc7, 0x6, CpuRdRnd, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf, { Reg16|Reg32|Reg64 }
+rdseed, 1, 0x0fc7, 0x7, CpuRdRnd, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf, { Reg16|Reg32|Reg64 }
diff --git a/contrib/binutils/opcodes/i386-tbl.h b/contrib/binutils/opcodes/i386-tbl.h
index ebd8da92fa3..d769d09f7de 100644
--- a/contrib/binutils/opcodes/i386-tbl.h
+++ b/contrib/binutils/opcodes/i386-tbl.h
@@ -4391,6 +4391,9 @@ const template i386_optab[] =
   {"rdrand", 1, 0x0fc7, 0x6, CpuRdRnd,
     Modrm|NoSuf,
     { Reg16|Reg32|Reg64 } },
+  {"rdseed", 1, 0x0fc7, 0x7, CpuRdRnd,
+    Modrm|NoSuf,
+    { Reg16|Reg32|Reg64 } },
 
   /* Intel Supervisor Mode Access Prevention extensions */
   {"clac", 0, 0x0f01, 0xca, CpuSMAP,
diff --git a/contrib/bmake/ChangeLog b/contrib/bmake/ChangeLog
index ba9cb272a48..1dbf0ef01f2 100644
--- a/contrib/bmake/ChangeLog
+++ b/contrib/bmake/ChangeLog
@@ -1,3 +1,28 @@
+2014-06-20  Simon J. Gerraty  
+
+	* Makefile (MAKE_VERSION): 20140620
+	  Merge with NetBSD make, pick up
+	  o var.c return varNoError rather than var_Error for ::= modidiers.
+
+2014-05-22  Simon J. Gerraty  
+
+	* Makefile (MAKE_VERSION): 20140522
+	  Merge with NetBSD make, pick up
+	  o var.c detect some parse errors.
+
+2014-04-05  Simon J. Gerraty  
+
+	* Fix spelling errors - patch from Pedro Giffuni
+
+2014-02-14  Simon J. Gerraty  
+
+	* Makefile (MAKE_VERSION): 20140214
+	  Merge with NetBSD make, pick up
+	  o .INCLUDEFROM*
+	  o use Var_Value to get MAKEOBJDIR[PREFIX]
+	  o reduced realloc'ign in brk_string.
+	* configure.in: add a check for compiler supporting __func__
+
 2014-01-03  Simon J. Gerraty  
 
 	* boot-strap: ignore mksrc=none
@@ -64,7 +89,7 @@
 
 	* Makefile (MAKE_VERSION): 20130716
 	  Merge with NetBSD make, pick up
-	  o number of gmake compatability tweaks
+	  o number of gmake compatibility tweaks
 	    -w for gmake style entering/leaving messages
 	    if .MAKE.LEVEL > 0 indicate it in progname "make[1]" etc.
 	    handle MAKEFLAGS containing only letters.
diff --git a/contrib/bmake/Makefile b/contrib/bmake/Makefile
index 6e4b8b4d048..42258c4e854 100644
--- a/contrib/bmake/Makefile
+++ b/contrib/bmake/Makefile
@@ -1,7 +1,7 @@
-#	$Id: Makefile,v 1.23 2014/01/02 22:20:52 sjg Exp $
+#	$Id: Makefile,v 1.27 2014/06/20 14:51:54 sjg Exp $
 
 # Base version on src date
-MAKE_VERSION= 20140101
+MAKE_VERSION= 20140620
 
 PROG=	bmake
 
@@ -117,7 +117,7 @@ MANTARGET?= man
 # turn this on by default - ignored if we are root
 WITH_INSTALL_AS_USER=
 
-# supress with -DWITHOUT_*
+# suppress with -DWITHOUT_*
 OPTIONS_DEFAULT_YES+= \
 	AUTOCONF_MK \
 	INSTALL_MK \
diff --git a/contrib/bmake/README b/contrib/bmake/README
index fb688a33bc6..d09e977e48b 100644
--- a/contrib/bmake/README
+++ b/contrib/bmake/README
@@ -18,7 +18,7 @@ interesting changes, so that bmake tracks it very closely.
 
 Building:
 
-The prefered way to bootstrap bmake is:
+The preferred way to bootstrap bmake is:
 
 ./bmake/boot-strap
 
diff --git a/contrib/bmake/bmake.1 b/contrib/bmake/bmake.1
index d6ead4926c9..5363e88b9b8 100644
--- a/contrib/bmake/bmake.1
+++ b/contrib/bmake/bmake.1
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.226 2013/11/07 18:50:46 dholland Exp $
+.\"	$NetBSD: make.1,v 1.229 2014/01/19 10:23:29 apb Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	from: @(#)make.1	8.4 (Berkeley) 3/19/94
 .\"
-.Dd October 25, 2013
+.Dd February 14, 2014
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -706,6 +706,10 @@ was executed.
 Refer to the description of
 .Ql Ev PWD
 for more details.
+.It Va .INCLUDEDFROMDIR
+The directory of the file this Makefile was included from.
+.It Va .INCLUDEDFROMFILE
+The filename of the file this Makefile was included from.
 .It Ev MAKE
 The name that
 .Nm
@@ -1246,6 +1250,15 @@ and
 are orthogonal; the former specifies whether multiple words are
 potentially affected, the latter whether multiple substitutions can
 potentially occur within each affected word.
+.Pp
+As for the
+.Cm \&:S
+modifier, the
+.Ar pattern
+and
+.Ar replacement
+are subjected to variable expansion before being parsed as
+regular expressions.
 .It Cm \&:T
 Replaces each word in the variable with its last component.
 .It Cm \&:u
diff --git a/contrib/bmake/bmake.cat1 b/contrib/bmake/bmake.cat1
index 4a6ad0b63e6..0ce26a5a1cc 100644
--- a/contrib/bmake/bmake.cat1
+++ b/contrib/bmake/bmake.cat1
@@ -450,6 +450,13 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS
      _._C_U_R_D_I_R         A path to the directory where bbmmaakkee was executed.  Refer
                      to the description of `PWD' for more details.
 
+     _._I_N_C_L_U_D_E_D_F_R_O_M_D_I_R
+                     The directory of the file this Makefile was included
+                     from.
+
+     _._I_N_C_L_U_D_E_D_F_R_O_M_F_I_L_E
+                     The filename of the file this Makefile was included from.
+
      MAKE            The name that bbmmaakkee was executed with (_a_r_g_v_[_0_]).  For
                      compatibility bbmmaakkee also sets _._M_A_K_E with the same value.
                      The preferred variable to use is the environment variable
@@ -796,6 +803,9 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS
           multiple words are potentially affected, the latter whether multiple
           substitutions can potentially occur within each affected word.
 
+          As for the ::SS modifier, the _p_a_t_t_e_r_n and _r_e_p_l_a_c_e_m_e_n_t are subjected to
+          variable expansion before being parsed as regular expressions.
+
      ::TT   Replaces each word in the variable with its last component.
 
      ::uu   Remove adjacent duplicate words (like uniq(1)).
@@ -1384,4 +1394,4 @@ BBUUGGSS
 
      There is no way of escaping a space character in a filename.
 
-NetBSD 5.1                     October 25, 2013                     NetBSD 5.1
+NetBSD 5.1                     February 14, 2014                    NetBSD 5.1
diff --git a/contrib/bmake/boot-strap b/contrib/bmake/boot-strap
index 3c25c374d4c..340c46a9af2 100755
--- a/contrib/bmake/boot-strap
+++ b/contrib/bmake/boot-strap
@@ -111,7 +111,7 @@
 #	Simon J. Gerraty 
 
 # RCSid:
-#	$Id: boot-strap,v 1.44 2014/01/08 14:49:10 sjg Exp $
+#	$Id: boot-strap,v 1.45 2014/04/05 22:56:54 sjg Exp $
 #
 #	@(#) Copyright (c) 2001 Simon J. Gerraty
 #
@@ -197,7 +197,7 @@ get_optarg() {
 
 here=`'pwd'`
 if [ $here = $Mydir ]; then
-   # avoid polution
+   # avoid pollution
    OBJROOT=../
 fi
 
@@ -453,7 +453,7 @@ op_all() {
 		echo "Use --install-destdir=/somewhere to set DESTDIR during install"
 		echo "Use --install-host-target to use INSTALL_BIN=$HOST_TARGET/bin"
 		echo "Use -DWITH_PROG_VERSION to install as bmake-$MAKE_VERSION"
-		echo "Use -DWITHOUT_PROG_LINK to supress bmake -> bmake-$MAKE_VERSION symlink"
+		echo "Use -DWITHOUT_PROG_LINK to suppress bmake -> bmake-$MAKE_VERSION symlink"
 		echo "Use -DWITHOUT_INSTALL_MK to skip installing files to $prefix/share/mk"
 	fi
 }
diff --git a/contrib/bmake/bsd.after-import.mk b/contrib/bmake/bsd.after-import.mk
index 85bd2c12599..9a65096a959 100644
--- a/contrib/bmake/bsd.after-import.mk
+++ b/contrib/bmake/bsd.after-import.mk
@@ -1,4 +1,4 @@
-# $Id: bsd.after-import.mk,v 1.11 2012/12/29 19:32:25 sjg Exp $
+# $Id: bsd.after-import.mk,v 1.12 2014/02/14 23:45:49 sjg Exp $
 
 # This makefile is for use when integrating bmake into a BSD build
 # system.  Use this makefile after importing bmake.
@@ -41,15 +41,13 @@ SRCTOP := ${srctop}
 HOST_OS!= uname
 .endif
 
-# .../share/mk will find ${SRCTOP}/share/mk
-# if we are within ${SRCTOP}
-DEFAULT_SYS_PATH= .../share/mk:/usr/share/mk
-
 BOOTSTRAP_ARGS = \
-	--with-default-sys-path='${DEFAULT_SYS_PATH}' \
 	--prefix /usr \
 	--share /usr/share
 
+.if !empty(DEFAULT_SYS_PATH)
+BOOTSTRAP_ARGS += --with-default-sys-path='${DEFAULT_SYS_PATH}'
+.endif
 
 # run boot-strap with minimal influence
 bootstrap:	${BMAKE_SRC}/boot-strap ${MAKEFILE}
diff --git a/contrib/bmake/config.h.in b/contrib/bmake/config.h.in
index 7108dcf2f67..ce30da1e36c 100644
--- a/contrib/bmake/config.h.in
+++ b/contrib/bmake/config.h.in
@@ -144,6 +144,9 @@
    `HAVE_STRUCT_STAT_ST_RDEV' instead. */
 #undef HAVE_ST_RDEV
 
+/* Define to 1 if you have the `sysctl' function. */
+#undef HAVE_SYSCTL
+
 /* Define to 1 if you have the  header file, and it defines `DIR'.
    */
 #undef HAVE_SYS_DIR_H
@@ -164,6 +167,9 @@
 /* Define to 1 if you have the  header file. */
 #undef HAVE_SYS_STAT_H
 
+/* Define to 1 if you have the  header file. */
+#undef HAVE_SYS_SYSCTL_H
+
 /* Define to 1 if you have the  header file. */
 #undef HAVE_SYS_TIME_H
 
@@ -298,6 +304,9 @@
 /* Define to 1 if you need to in order for `stat' and other things to work. */
 #undef _POSIX_SOURCE
 
+/* C99 function name */
+#undef __func__
+
 /* Define to empty if `const' does not conform to ANSI C. */
 #undef const
 
diff --git a/contrib/bmake/configure b/contrib/bmake/configure
index 2aaa5eb2109..e3ff4de5b04 100755
--- a/contrib/bmake/configure
+++ b/contrib/bmake/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.64 for bmake 20140101.
+# Generated by GNU Autoconf 2.64 for bmake 20140214.
 #
 # Report bugs to .
 #
@@ -549,8 +549,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='bmake'
 PACKAGE_TARNAME='bmake'
-PACKAGE_VERSION='20140101'
-PACKAGE_STRING='bmake 20140101'
+PACKAGE_VERSION='20140214'
+PACKAGE_STRING='bmake 20140214'
 PACKAGE_BUGREPORT='sjg@NetBSD.org'
 PACKAGE_URL=''
 
@@ -1221,7 +1221,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures bmake 20140101 to adapt to many kinds of systems.
+\`configure' configures bmake 20140214 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1282,7 +1282,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of bmake 20140101:";;
+     short | recursive ) echo "Configuration of bmake 20140214:";;
    esac
   cat <<\_ACEOF
 
@@ -1387,7 +1387,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-bmake configure 20140101
+bmake configure 20140214
 generated by GNU Autoconf 2.64
 
 Copyright (C) 2009 Free Software Foundation, Inc.
@@ -1908,7 +1908,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by bmake $as_me 20140101, which was
+It was created by bmake $as_me 20140214, which was
 generated by GNU Autoconf 2.64.  Invocation command line was
 
   $ $0 $@
@@ -5708,6 +5708,32 @@ $as_echo "#define HAVE_ST_RDEV 1" >>confdefs.h
 fi
 
 
+echo "checking if compiler supports __func__" >&6
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+const char *func = __func__;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+
+$as_echo "#define __func__ __FUNCTION__" >>confdefs.h
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo $ECHO_N "checking if diff -u works... $ECHO_C" >&6
 if diff -u /dev/null /dev/null > /dev/null 2>&1; then
    diff_u=-u
@@ -6378,7 +6404,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by bmake $as_me 20140101, which was
+This file was extended by bmake $as_me 20140214, which was
 generated by GNU Autoconf 2.64.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -6438,7 +6464,7 @@ Report bugs to ."
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_version="\\
-bmake config.status 20140101
+bmake config.status 20140214
 configured by $0, generated by GNU Autoconf 2.64,
   with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
diff --git a/contrib/bmake/configure.in b/contrib/bmake/configure.in
index 394f397c9c6..ecaa53aa900 100644
--- a/contrib/bmake/configure.in
+++ b/contrib/bmake/configure.in
@@ -1,12 +1,12 @@
 dnl
 dnl RCSid:
-dnl	$Id: configure.in,v 1.51 2014/01/02 22:20:52 sjg Exp $
+dnl	$Id: configure.in,v 1.52 2014/02/15 22:27:59 sjg Exp $
 dnl
 dnl Process this file with autoconf to produce a configure script
 dnl
 AC_PREREQ(2.50)
-AC_INIT([bmake], [20140101], [sjg@NetBSD.org])
-AC_CONFIG_HEADER(config.h)
+AC_INIT([bmake], [20140214], [sjg@NetBSD.org])
+AC_CONFIG_HEADERS(config.h)
 
 dnl make srcdir absolute
 case "$srcdir" in
@@ -203,6 +203,11 @@ dnl
 AC_HEADER_STAT
 AC_STRUCT_ST_RDEV
 dnl
+echo "checking if compiler supports __func__" >&6
+AC_LANG(C)
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[const char *func = __func__;]])],,
+	AC_DEFINE(__func__, __FUNCTION__, C99 function name))
+dnl
 dnl we want this for unit-tests/Makefile
 echo $ECHO_N "checking if diff -u works... $ECHO_C" >&6
 if diff -u /dev/null /dev/null > /dev/null 2>&1; then
diff --git a/contrib/bmake/main.c b/contrib/bmake/main.c
index 78fbf41a07d..f86184c37db 100644
--- a/contrib/bmake/main.c
+++ b/contrib/bmake/main.c
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.225 2013/09/14 15:09:34 matt Exp $	*/
+/*	$NetBSD: main.c,v 1.226 2014/02/07 17:23:35 pooka Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.225 2013/09/14 15:09:34 matt Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.226 2014/02/07 17:23:35 pooka Exp $";
 #else
 #include 
 #ifndef lint
@@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\
 #if 0
 static char sccsid[] = "@(#)main.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.225 2013/09/14 15:09:34 matt Exp $");
+__RCSID("$NetBSD: main.c,v 1.226 2014/02/07 17:23:35 pooka Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1102,11 +1102,12 @@ main(int argc, char **argv)
 	 */
 #ifndef NO_PWD_OVERRIDE
 	if (!ignorePWD) {
-		char *pwd;
+		char *pwd, *ptmp1 = NULL, *ptmp2 = NULL;
 
 		if ((pwd = getenv("PWD")) != NULL &&
-		    getenv("MAKEOBJDIRPREFIX") == NULL) {
-			const char *makeobjdir = getenv("MAKEOBJDIR");
+		    Var_Value("MAKEOBJDIRPREFIX", VAR_CMD, &ptmp1) == NULL) {
+			const char *makeobjdir = Var_Value("MAKEOBJDIR",
+			    VAR_CMD, &ptmp2);
 
 			if (makeobjdir == NULL || !strchr(makeobjdir, '$')) {
 				if (stat(pwd, &sb) == 0 &&
@@ -1115,6 +1116,8 @@ main(int argc, char **argv)
 					(void)strncpy(curdir, pwd, MAXPATHLEN);
 			}
 		}
+		free(ptmp1);
+		free(ptmp2);
 	}
 #endif
 	Var_Set(".CURDIR", curdir, VAR_GLOBAL, 0);
@@ -1131,11 +1134,13 @@ main(int argc, char **argv)
 	Dir_Init(curdir);
 	(void)Main_SetObjdir(curdir);
 
-	if ((path = getenv("MAKEOBJDIRPREFIX")) != NULL) {
+	if ((path = Var_Value("MAKEOBJDIRPREFIX", VAR_CMD, &p1)) != NULL) {
 		(void)snprintf(mdpath, MAXPATHLEN, "%s%s", path, curdir);
 		(void)Main_SetObjdir(mdpath);
-	} else if ((path = getenv("MAKEOBJDIR")) != NULL) {
+		free(p1);
+	} else if ((path = Var_Value("MAKEOBJDIR", VAR_CMD, &p1)) != NULL) {
 		(void)Main_SetObjdir(path);
+		free(p1);
 	} else {
 		(void)snprintf(mdpath, MAXPATHLEN, "%s.%s", _PATH_OBJDIR, machine);
 		if (!Main_SetObjdir(mdpath) && !Main_SetObjdir(_PATH_OBJDIR)) {
diff --git a/contrib/bmake/make.1 b/contrib/bmake/make.1
index 5422c198330..8a841dbb742 100644
--- a/contrib/bmake/make.1
+++ b/contrib/bmake/make.1
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.226 2013/11/07 18:50:46 dholland Exp $
+.\"	$NetBSD: make.1,v 1.230 2014/02/15 18:55:30 sjg Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	from: @(#)make.1	8.4 (Berkeley) 3/19/94
 .\"
-.Dd October 25, 2013
+.Dd February 14, 2014
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -706,6 +706,10 @@ was executed.
 Refer to the description of
 .Ql Ev PWD
 for more details.
+.It Va .INCLUDEDFROMDIR
+The directory of the file this Makefile was included from.
+.It Va .INCLUDEDFROMFILE
+The filename of the file this Makefile was included from.
 .It Ev MAKE
 The name that
 .Nm
@@ -1257,6 +1261,15 @@ and
 are orthogonal; the former specifies whether multiple words are
 potentially affected, the latter whether multiple substitutions can
 potentially occur within each affected word.
+.Pp
+As for the
+.Cm \&:S
+modifier, the
+.Ar pattern
+and
+.Ar replacement
+are subjected to variable expansion before being parsed as
+regular expressions.
 .It Cm \&:T
 Replaces each word in the variable with its last component.
 .It Cm \&:u
diff --git a/contrib/bmake/mk/ChangeLog b/contrib/bmake/mk/ChangeLog
index 973db00b8a3..80671ef13f0 100644
--- a/contrib/bmake/mk/ChangeLog
+++ b/contrib/bmake/mk/ChangeLog
@@ -1,3 +1,60 @@
+2014-05-22  Simon J. Gerraty  
+
+	* install-mk (MK_VERSION): 20140522
+
+	* lib.mk: use CC to link shlib for linux too
+	  patch from Brendan MacDonell
+
+2014-05-05  Simon J. Gerraty  
+
+	* meta.autodep.mk: add _reldir_{finish,failed} for gathering stats
+	  if WITH_META_STATS is defined.
+
+2014-05-02  Simon J. Gerraty  
+
+	* dirdeps.mk: accept -DWITHOUT_DIRDEPS (same a as -DNO_DIRDEPS)
+	  to supress dirdeps outside of .CURDIR.
+
+2014-04-05  Simon J. Gerraty  
+
+	* Fix spelling errors - patch from Pedro Giffuni
+
+2014-03-14  Simon J. Gerraty  
+
+	* install-mk (MK_VERSION): 20140314
+
+	* dirdeps.mk (beforedirdeps): a handy hook
+
+	* dirdeps.mk (DIRDEP_MAKE): allow the actual command we run
+	  to visit leaf dirs to be intercepted (eg. for distributed
+	  build).
+
+	* dirdeps.mk (__depdirs): ensure // don't sneak in
+	
+	* gendirdeps.mk (DIRDEPS): ensure // don't sneak in
+
+
+2014-02-21  Simon J. Gerraty  
+
+	* rst2htm.mk (RST2PDF): add support for rst2pdf
+
+2014-02-14  Simon J. Gerraty  
+
+	* install-mk (MK_VERSION): bump version
+	* dirdeps.mk (_last_dependfile): use .INCLUDEDFROMFILE if
+	  available.
+
+2014-02-10  Simon J. Gerraty  
+
+	* options.mk: avoid :U so this isn't bmake dependent
+
+2014-02-09  Simon J. Gerraty  
+
+	* options.mk: cleanup and simplify semanitcs 
+	  NO_* dominates all, if both WITH_* and WITHOUT_*
+	  are defined then result is DOMINATE_* which defaults to "no".
+	  Ie. WITHOUT_ normally wins.
+
 2013-12-12  Simon J. Gerraty  
 
 	* install-mk (MK_VERSION): bump version
@@ -490,7 +547,7 @@
 	* dep.mk: auto.dep.mk does not do 'make depend' so ignore it if
 	  asked to do that.
 	  fix/simplify the tests for when to run mkdep.
-	* auto.dep.mk: add some explaination of how/what we do.
+	* auto.dep.mk: add some explanation of how/what we do.
 	* autodep.mk: skip the .OPTIONAL frobbing of .depend
 	  bmake's FROM_DEPEND flag makes it redundant.
 	
@@ -640,7 +697,7 @@
 2006-12-30  Simon J. Gerraty  
 
 	* install-mk (MK_VERSION): bump version
-	* added libs.mk - analagous to progs.mk
+	* added libs.mk - analogous to progs.mk
 	  make both of them always inlcude {lib,prog}.mk
 
 2006-12-28  Simon J. Gerraty  
diff --git a/contrib/bmake/mk/autodep.mk b/contrib/bmake/mk/autodep.mk
index 744770fe5a3..818c474e843 100644
--- a/contrib/bmake/mk/autodep.mk
+++ b/contrib/bmake/mk/autodep.mk
@@ -1,6 +1,6 @@
 #
 # RCSid:
-#	$Id: autodep.mk,v 1.32 2010/04/19 17:37:56 sjg Exp $
+#	$Id: autodep.mk,v 1.33 2014/04/05 22:56:54 sjg Exp $
 #
 #	@(#) Copyright (c) 1999-2010, Simon J. Gerraty
 #
@@ -16,7 +16,7 @@
 
 # This module provides automagic dependency generation along the
 # lines suggested in the GNU make.info
-# The depend target is mainly for backwards compatability,
+# The depend target is mainly for backwards compatibility,
 # dependencies are normally updated as part of compilation.
 
 # set MKDEP=autodep and dep.mk will include us
diff --git a/contrib/bmake/mk/dirdeps.mk b/contrib/bmake/mk/dirdeps.mk
index 3335fdb0943..8c342be86fc 100644
--- a/contrib/bmake/mk/dirdeps.mk
+++ b/contrib/bmake/mk/dirdeps.mk
@@ -1,4 +1,4 @@
-# $Id: dirdeps.mk,v 1.29 2013/10/13 18:43:53 sjg Exp $
+# $Id: dirdeps.mk,v 1.35 2014/05/03 06:27:56 sjg Exp $
 
 # Copyright (c) 2010-2013, Juniper Networks, Inc.
 # All rights reserved.
@@ -44,7 +44,7 @@
 #	All unqualified entries end up being qualified with .${TARGET_SPEC}
 #	and partially qualified (if TARGET_SPEC_VARS has multiple
 #	entries) are also expanded to a full ..
-#	The  _DIRDEPS_USE target uses the suffix to set TARGET_SPEC
+#	The  _DIRDEP_USE target uses the suffix to set TARGET_SPEC
 #	correctly when visiting each entry.
 #
 #	The fully qualified directory entries are used to construct a
@@ -71,7 +71,7 @@
 #
 # TARGET_SPEC_VARS
 #	The default value is just MACHINE, and for most environments
-#	this is sufficient.  The _DIRDEPS_USE target actually sets
+#	this is sufficient.  The _DIRDEP_USE target actually sets
 #	both MACHINE and TARGET_SPEC to the suffix of the current
 #	target so that in the general case TARGET_SPEC can be ignored.
 #
@@ -196,7 +196,11 @@ N_notmachine := ${.MAKE.DEPENDFILE_PREFERENCE:E:N*${MACHINE}*:${M_ListToSkip}}
 # if we were included recursively _DEP_TARGET_SPEC should be valid.
 .if empty(_DEP_TARGET_SPEC)
 # we may or may not have included a dependfile yet
+.if defined(.INCLUDEDFROMFILE)
+_last_dependfile := ${.INCLUDEDFROMFILE:M${.MAKE.DEPENDFILE_PREFIX}*}
+.else
 _last_dependfile := ${.MAKE.MAKEFILES:M*/${.MAKE.DEPENDFILE_PREFIX}*:[-1]}
+.endif
 .if !empty(_debug_reldir)
 .info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: _last_dependfile='${_last_dependfile}'
 .endif
@@ -239,7 +243,8 @@ DEP_MACHINE := ${_DEP_TARGET_SPEC}
 # we can use this as a clue to do initialization and other one time things.
 .if !target(_DIRDEP_USE)
 # make sure this target exists
-dirdeps:
+dirdeps: beforedirdeps .WAIT
+beforedirdeps:
 
 # We normally expect to be included by Makefile.depend.*
 # which sets the DEP_* macros below.
@@ -269,12 +274,15 @@ DEP_SKIP_DIR = ${SKIP_DIR} \
 
 NSkipDir = ${DEP_SKIP_DIR:${M_ListToSkip}}
 
-.if defined(NO_DIRDEPS) || defined(NODIRDEPS)
+.if defined(NO_DIRDEPS) || defined(NODIRDEPS) || defined(WITHOUT_DIRDEPS)
 # confine ourselves to the original dir
 DIRDEPS_FILTER += M${_DEP_RELDIR}*
 .endif
 
-# we supress SUBDIR when visiting the leaves
+# this is what we run below
+DIRDEP_MAKE?= ${.MAKE}
+
+# we suppress SUBDIR when visiting the leaves
 # we assume sys.mk will set MACHINE_ARCH
 # you can add extras to DIRDEP_USE_ENV
 # if there is no makefile in the target directory, we skip it.
@@ -285,7 +293,7 @@ _DIRDEP_USE:	.USE .MAKE
 		MACHINE_ARCH= NO_SUBDIR=1 ${DIRDEP_USE_ENV} \
 		TARGET_SPEC=${.TARGET:E} \
 		MACHINE=${.TARGET:E} \
-		${.MAKE} -C ${.TARGET:R} || exit 1; \
+		${DIRDEP_MAKE} -C ${.TARGET:R} || exit 1; \
 		break; \
 	done
 
@@ -397,7 +405,7 @@ DEP_DIRDEPS_FILTER = U
 .endif
 
 # this is what we start with
-__depdirs := ${DIRDEPS:${NSkipDir}:${DEP_DIRDEPS_FILTER:ts:}:O:u:@d@${SRCTOP}/$d@}
+__depdirs := ${DIRDEPS:${NSkipDir}:${DEP_DIRDEPS_FILTER:ts:}:C,//+,/,g:O:u:@d@${SRCTOP}/$d@}
 
 # some entries may be qualified with . 
 # the :M*/*/*.* just tries to limit the dirs we check to likely ones.
diff --git a/contrib/bmake/mk/dpadd.mk b/contrib/bmake/mk/dpadd.mk
index a940b61c144..abc92df761c 100644
--- a/contrib/bmake/mk/dpadd.mk
+++ b/contrib/bmake/mk/dpadd.mk
@@ -1,4 +1,4 @@
-# $Id: dpadd.mk,v 1.18 2011/11/10 05:13:37 sjg Exp $
+# $Id: dpadd.mk,v 1.19 2014/04/05 22:56:54 sjg Exp $
 #
 #	@(#) Copyright (c) 2004, Simon J. Gerraty
 #
@@ -68,7 +68,7 @@ DPLIBS+= ${LIBDMALLOC}
 .endif
 .endif
 
-# Order -L's to seach ours first.
+# Order -L's to search ours first.
 # Avoids picking up old versions already installed.
 __dpadd_libdirs := ${__dpadd_libs:R:H:S/^/-L/g:O:u:N-L}
 LDADD += ${__dpadd_libdirs:M-L${OBJTOP}/*}
@@ -99,9 +99,9 @@ SRC_LIBS+= ${_OBJDIR}/lib${LIB}.a
 # This little bit of magic, assumes that SRC_libfoo will be
 # set if it cannot be correctly derrived from ${LIBFOO}
 # Note that SRC_libfoo and INCLUDES_libfoo should be named for the
-# actual libary name not the variable name that might refer to it.
+# actual library name not the variable name that might refer to it.
 # 99% of the time the two are the same, but the DPADD logic
-# only has the libary name available, so stick to that.
+# only has the library name available, so stick to that.
 # 
 
 SRC_LIBS?=
diff --git a/contrib/bmake/mk/gendirdeps.mk b/contrib/bmake/mk/gendirdeps.mk
index 20e2b152a3f..b313298b3fe 100644
--- a/contrib/bmake/mk/gendirdeps.mk
+++ b/contrib/bmake/mk/gendirdeps.mk
@@ -1,4 +1,4 @@
-# $Id: gendirdeps.mk,v 1.23 2013/09/04 17:49:20 sjg Exp $
+# $Id: gendirdeps.mk,v 1.25 2014/03/14 21:28:37 sjg Exp $
 
 # Copyright (c) 2010-2013, Juniper Networks, Inc.
 # All rights reserved.
@@ -229,7 +229,7 @@ DIRDEPS = \
 	${qualdir_list:N${RELDIR}.*:N${RELDIR}/*}
 
 # We only consider things below $RELDIR/ if they have a makefile.
-# This is the same test that _DIRDEPS_USE applies.
+# This is the same test that _DIRDEP_USE applies.
 # We have do a double test with dirdep_list as it _may_ contain 
 # qualified dirs - if we got anything from a stage dir.
 # qualdir_list we know are all qualified.
@@ -240,7 +240,7 @@ DIRDEPS += \
 	${dirdep_list:M${RELDIR}/*:@d@${.MAKE.MAKEFILE_PREFERENCE:@m@${exists(${SRCTOP}/$d/$m):?$d:${exists(${SRCTOP}/${d:R}/$m):?$d:}}@}@} \
 	${qualdir_list:M${RELDIR}/*:@d@${.MAKE.MAKEFILE_PREFERENCE:@m@${exists(${SRCTOP}/${d:R}/$m):?$d:}@}@}
 
-DIRDEPS := ${DIRDEPS:${GENDIRDEPS_FILTER:UNno:ts:}:O:u}
+DIRDEPS := ${DIRDEPS:${GENDIRDEPS_FILTER:UNno:ts:}:C,//+,/,g:O:u}
 
 .if ${DEBUG_GENDIRDEPS:Uno:@x@${RELDIR:M$x}@} != ""
 .info ${RELDIR}: M2D_OBJROOTS=${M2D_OBJROOTS}
@@ -261,7 +261,7 @@ src_dirdep_list = \
 SRC_DIRDEPS = \
 	${src_dirdep_list:N${RELDIR}:N${RELDIR}/*:C,(/h)/.*,,}
 
-SRC_DIRDEPS := ${SRC_DIRDEPS:${GENDIRDEPS_SRC_FILTER:UN/*:ts:}:O:u}
+SRC_DIRDEPS := ${SRC_DIRDEPS:${GENDIRDEPS_SRC_FILTER:UN/*:ts:}:C,//+,/,g:O:u}
 
 # if you want to capture SRC_DIRDEPS in .MAKE.DEPENDFILE put
 # SRC_DIRDEPS_FILE = ${_DEPENDFILE} 
diff --git a/contrib/bmake/mk/host-target.mk b/contrib/bmake/mk/host-target.mk
index c6d4562bf15..eacdf1d9511 100644
--- a/contrib/bmake/mk/host-target.mk
+++ b/contrib/bmake/mk/host-target.mk
@@ -1,5 +1,5 @@
 # RCSid:
-#	$Id: host-target.mk,v 1.6 2011/03/02 05:05:21 sjg Exp $
+#	$Id: host-target.mk,v 1.7 2014/05/16 17:54:52 sjg Exp $
 
 # Host platform information; may be overridden
 .if !defined(_HOST_OSNAME)
@@ -18,6 +18,10 @@ _HOST_ARCH != uname -m
 .endif
 .export _HOST_ARCH
 .endif
+.if !defined(HOST_MACHINE)
+HOST_MACHINE != uname -m
+.export HOST_MACHINE
+.endif
 
 HOST_OSMAJOR := ${_HOST_OSREL:C/[^0-9].*//}
 HOST_OSTYPE  :=	${_HOST_OSNAME}-${_HOST_OSREL:C/\([^\)]*\)//}-${_HOST_ARCH}
diff --git a/contrib/bmake/mk/install-mk b/contrib/bmake/mk/install-mk
index b91a961410a..7e4ee8bba5e 100644
--- a/contrib/bmake/mk/install-mk
+++ b/contrib/bmake/mk/install-mk
@@ -55,7 +55,7 @@
 #       Simon J. Gerraty 
 
 # RCSid:
-#	$Id: install-mk,v 1.95 2013/12/20 06:08:52 sjg Exp $
+#	$Id: install-mk,v 1.100 2014/05/23 01:30:36 sjg Exp $
 #
 #	@(#) Copyright (c) 1994 Simon J. Gerraty
 #
@@ -70,7 +70,7 @@
 #	sjg@crufty.net
 #
 
-MK_VERSION=20131212
+MK_VERSION=20140522
 OWNER=
 GROUP=
 MODE=444
diff --git a/contrib/bmake/mk/lib.mk b/contrib/bmake/mk/lib.mk
index f219115433e..417aa024ba8 100644
--- a/contrib/bmake/mk/lib.mk
+++ b/contrib/bmake/mk/lib.mk
@@ -1,4 +1,4 @@
-# $Id: lib.mk,v 1.49 2013/07/18 05:46:24 sjg Exp $
+# $Id: lib.mk,v 1.51 2014/05/23 01:30:36 sjg Exp $
 
 .if !target(__${.PARSEFILE}__)
 __${.PARSEFILE}__:
@@ -55,7 +55,7 @@ CFLAGS+=	${COPTS}
 # are built for different platforms and object formats.
 # OBJECT_FMT:		currently either "ELF" or "a.out", from 
 # SHLIB_SOVERSION:	version number to be compiled into a shared library
-#			via -soname. Usualy ${SHLIB_MAJOR} on ELF.
+#			via -soname. Usually ${SHLIB_MAJOR} on ELF.
 #			NetBSD/pmax used to use ${SHLIB_MAJOR}[.${SHLIB_MINOR}
 #			[.${SHLIB_TEENY}]]
 # SHLIB_SHFLAGS:	Flags to tell ${LD} to emit shared library.
@@ -123,7 +123,7 @@ SHLIB_LDSTARTFILE?=	/usr/lib/crtbeginS.o
 SHLIB_LDENDFILE?=	/usr/lib/crtendS.o
 .endif
 
-# for compatability with the following
+# for compatibility with the following
 CC_PIC?= ${CPICFLAGS}
 LD_shared=${SHLIB_SHFLAGS}
 
@@ -175,9 +175,10 @@ AR_cq= -cqs
 .elif ${TARGET_OSNAME} == "FreeBSD"
 LD_solib= lib${LIB}_pic.a
 .elif ${TARGET_OSNAME} == "Linux"
+SHLIB_LD = ${CC}
 # this is ambiguous of course
-LD_shared=-shared -h lib${LIB}.so.${SHLIB_MAJOR}
-LD_solib= --whole-archive lib${LIB}_pic.a
+LD_shared=-shared -Wl,"-h lib${LIB}.so.${SHLIB_MAJOR}"
+LD_solib= -Wl,--whole-archive lib${LIB}_pic.a -Wl,--no-whole-archive
 # Linux uses GNU ld, which is a multi-pass linker
 # so we don't need to use lorder or tsort
 LD_objs = ${OBJS}
@@ -259,7 +260,7 @@ OPTIMIZE_OBJECT_META_FILES ?= yes
 
 
 .if ${MK_LIBTOOL} == "yes"
-# because libtool is so facist about naming the object files,
+# because libtool is so fascist about naming the object files,
 # we cannot (yet) build profiled libs
 MK_PROFILE=no
 _LIBS=lib${LIB}.a
@@ -413,7 +414,7 @@ SHLIB_AGE?=0
 .s.o .S.o .c.o:
 	${LIBTOOL} --mode=compile ${CC} ${LT_STATIC} ${CFLAGS} ${CPPFLAGS} ${IMPFLAGS} -c ${.IMPSRC}
 
-# can't really do profiled libs with libtool - its too facist about
+# can't really do profiled libs with libtool - its too fascist about
 # naming the output...
 lib${LIB}.a:: ${OBJS}
 	@rm -f ${.TARGET}
diff --git a/contrib/bmake/mk/meta.autodep.mk b/contrib/bmake/mk/meta.autodep.mk
index c29c26e85e2..a961bffb464 100644
--- a/contrib/bmake/mk/meta.autodep.mk
+++ b/contrib/bmake/mk/meta.autodep.mk
@@ -1,4 +1,4 @@
-# $Id: meta.autodep.mk,v 1.32 2012/11/13 00:44:26 sjg Exp $
+# $Id: meta.autodep.mk,v 1.35 2014/05/09 00:05:46 sjg Exp $
 
 #
 #	@(#) Copyright (c) 2010, Simon J. Gerraty
@@ -120,7 +120,7 @@ FORCE_DPADD += ${_nonlibs:@x@${DPADD:M*/$x}@}
 # some makefiles and/or targets contain
 # circular dependencies if you dig too deep 
 # (as meta mode is apt to do) 
-# so we provide a means of supressing them.
+# so we provide a means of suppressing them.
 # the input to the loop below is target: dependency
 # with just one dependency per line.
 # Also some targets are not really local, or use random names.
@@ -137,7 +137,7 @@ SUPPRESS_DEPEND += \
 # the double $$ defers initial evaluation
 # if necessary, we fake .po dependencies, just so the result 
 # in Makefile.depend* is stable
-# The current objdir may be refered to in various ways
+# The current objdir may be referred to in various ways
 OBJDIR_REFS += ${.OBJDIR} ${.OBJDIR:tA} ${_OBJDIR} ${RELOBJTOP}/${RELDIR}
 _depend = .depend
 # it would be nice to be able to get .SUFFIXES as ${.SUFFIXES}
@@ -176,7 +176,9 @@ _depend =
 .info ${_DEPENDFILE:S,${SRCTOP}/,,} _depend=${_depend}
 .endif
 
+.if ${UPDATE_DEPENDFILE} == "yes"
 gendirdeps:	${_DEPENDFILE}
+.endif
 
 .if !target(${_DEPENDFILE})
 .if ${_bootstrap_dirdeps} == "yes"
@@ -259,4 +261,28 @@ ${_DEPENDFILE}: .PRECIOUS
 .endif
 
 CLEANFILES += *.meta filemon.* *.db
+
+# these make it easy to gather some stats
+now_utc = ${%s:L:gmtime}
+start_utc := ${now_utc}
+
+meta_stats= meta=${empty(.MAKE.META.FILES):?0:${.MAKE.META.FILES:[#]}} \
+	created=${empty(.MAKE.META.CREATED):?0:${.MAKE.META.CREATED:[#]}}
+
+#.END: _reldir_finish
+.if target(gendirdeps)
+_reldir_finish: gendirdeps
+.endif
+_reldir_finish: .NOMETA
+	@echo "${TIME_STAMP} Finished ${RELDIR}.${TARGET_SPEC} seconds=$$(( ${now_utc} - ${start_utc} )) ${meta_stats}"
+
+#.ERROR: _reldir_failed
+_reldir_failed: .NOMETA
+	@echo "${TIME_STAMP} Failed ${RELDIR}.${TARGET_SPEC} seconds=$$(( ${now_utc} - ${start_utc} )) ${meta_stats}"
+
+.if defined(WITH_META_STATS) && ${.MAKE.LEVEL} > 0
+.END: _reldir_finish
+.ERROR: _reldir_failed
+.endif
+
 .endif
diff --git a/contrib/bmake/mk/meta2deps.py b/contrib/bmake/mk/meta2deps.py
index d4e4bb14cad..8e349e702e5 100755
--- a/contrib/bmake/mk/meta2deps.py
+++ b/contrib/bmake/mk/meta2deps.py
@@ -37,7 +37,7 @@
 
 """
 RCSid:
-	$Id: meta2deps.py,v 1.16 2013/12/20 06:08:52 sjg Exp $
+	$Id: meta2deps.py,v 1.17 2014/04/05 22:56:54 sjg Exp $
 
 	Copyright (c) 2011-2013, Juniper Networks, Inc.
 	All rights reserved.
@@ -166,7 +166,7 @@ def __init__(self, name, conf={}):
         	Sometimes MACHINE isn't enough.
                 
         HOST_TARGET
-		when we build for the psuedo machine 'host'
+		when we build for the pseudo machine 'host'
 		the object tree uses HOST_TARGET rather than MACHINE.
 
         OBJROOTS a list of the common prefix for all obj dirs it might
@@ -296,7 +296,7 @@ def add(self, list, data, clue=''):
                 print("%s: %sAdd: %s" % (self.name, clue, data), file=self.debug_out)
 
     def find_top(self, path, list):
-        """the logical tree may be split accross multiple trees"""
+        """the logical tree may be split across multiple trees"""
         for top in list:
             if path.startswith(top):
                 if self.debug > 2:
diff --git a/contrib/bmake/mk/meta2deps.sh b/contrib/bmake/mk/meta2deps.sh
index f63aee329b6..d96ce07c5af 100755
--- a/contrib/bmake/mk/meta2deps.sh
+++ b/contrib/bmake/mk/meta2deps.sh
@@ -77,7 +77,7 @@
 
 
 # RCSid:
-#	$Id: meta2deps.sh,v 1.6 2013/05/11 05:16:26 sjg Exp $
+#	$Id: meta2deps.sh,v 1.7 2014/04/05 22:56:54 sjg Exp $
 
 # Copyright (c) 2010-2013, Juniper Networks, Inc.
 # All rights reserved.
@@ -348,7 +348,7 @@ meta2deps() {
 	[ -s $f ] || continue
 	case $f in
 	*qual) # a list of .dirdep files
-	    # we can prefix everthing with $OBJTOP to
+	    # we can prefix everything with $OBJTOP to
 	    # tell gendirdeps.mk that these are
 	    # DIRDEP entries, since they are already
 	    # qualified with . as needed.
diff --git a/contrib/bmake/mk/options.mk b/contrib/bmake/mk/options.mk
index aa54754b2ff..c0b4988741f 100644
--- a/contrib/bmake/mk/options.mk
+++ b/contrib/bmake/mk/options.mk
@@ -1,4 +1,4 @@
-# $Id: options.mk,v 1.7 2013/04/17 20:32:38 sjg Exp $
+# $Id: options.mk,v 1.10 2014/02/11 18:34:48 sjg Exp $
 #
 #	@(#) Copyright (c) 2012, Simon J. Gerraty
 #
@@ -30,15 +30,27 @@ OPTIONS_DEFAULT_VALUES += \
 	${OPTIONS_DEFAULT_YES:O:u:S,$,/yes,}
 
 OPTION_PREFIX ?= MK_
+
+# NO_* takes precedence
+# If both WITH_* and WITHOUT_* are defined, WITHOUT_ wins unless
+# DOMINANT_* is set to "yes"
+# Otherwise WITH_* and WITHOUT_* override the default.
 .for o in ${OPTIONS_DEFAULT_VALUES:M*/*}
-.if ${o:T:tl} == "no"
-.if defined(WITH_${o:H}) && !defined(NO_${o:H}) && !defined(NO${o:H})
+.if defined(NO_${o:H}) || defined(NO${o:H})
+# we cannot do it
+${OPTION_PREFIX}${o:H} ?= no
+.elif defined(WITH_${o:H}) && defined(WITHOUT_${o:H})
+# normally WITHOUT_ wins
+DOMINANT_${o:H} ?= no
+${OPTION_PREFIX}${o:H} ?= ${DOMINANT_${o:H}}
+.elif ${o:T:tl} == "no"
+.if defined(WITH_${o:H})
 ${OPTION_PREFIX}${o:H} ?= yes
 .else
 ${OPTION_PREFIX}${o:H} ?= no
 .endif
 .else
-.if defined(WITHOUT_${o:H}) || defined(NO_${o:H}) || defined(NO${o:H})
+.if defined(WITHOUT_${o:H})
 ${OPTION_PREFIX}${o:H} ?= no
 .else
 ${OPTION_PREFIX}${o:H} ?= yes
@@ -47,11 +59,19 @@ ${OPTION_PREFIX}${o:H} ?= yes
 .endfor
 
 # OPTIONS_DEFAULT_DEPENDENT += FOO_UTILS/FOO
-# if neither WITH[OUT]_FOO_UTILS is set, use value of ${OPTION_PREFIX}FOO
+# If neither WITH[OUT]_FOO_UTILS is set, (see rules above)
+# use the value of ${OPTION_PREFIX}FOO
 .for o in ${OPTIONS_DEFAULT_DEPENDENT:M*/*:O:u}
-.if defined(WITH_${o:H}) && !defined(NO_${o:H}) && !defined(NO${o:H})
+.if defined(NO_${o:H}) || defined(NO${o:H})
+# we cannot do it
+${OPTION_PREFIX}${o:H} ?= no
+.elif defined(WITH_${o:H}) && defined(WITHOUT_${o:H})
+# normally WITHOUT_ wins
+DOMINANT_${o:H} ?= no
+${OPTION_PREFIX}${o:H} ?= ${DOMINANT_${o:H}}
+.elif defined(WITH_${o:H})
 ${OPTION_PREFIX}${o:H} ?= yes
-.elif defined(WITHOUT_${o:H}) || defined(NO_${o:H}) || defined(NO${o:H})
+.elif defined(WITHOUT_${o:H})
 ${OPTION_PREFIX}${o:H} ?= no
 .else
 ${OPTION_PREFIX}${o:H} ?= ${${OPTION_PREFIX}${o:T}}
diff --git a/contrib/bmake/mk/rst2htm.mk b/contrib/bmake/mk/rst2htm.mk
index 8bd66dab48d..4d4c940b8bc 100644
--- a/contrib/bmake/mk/rst2htm.mk
+++ b/contrib/bmake/mk/rst2htm.mk
@@ -1,4 +1,4 @@
-# $Id: rst2htm.mk,v 1.8 2011/04/03 21:39:25 sjg Exp $
+# $Id: rst2htm.mk,v 1.9 2014/02/22 01:52:41 sjg Exp $
 #
 #	@(#) Copyright (c) 2009, Simon J. Gerraty
 #
@@ -22,6 +22,7 @@ TXTSRCS != 'ls' -1t ${.CURDIR}/*.txt ${.CURDIR}/*.rst 2>/dev/null; echo
 RSTSRCS ?= ${TXTSRCS}
 HTMFILES ?= ${RSTSRCS:R:T:O:u:%=%.htm}
 RST2HTML ?= rst2html.py
+RST2PDF ?= rst2pdf
 RST2S5 ?= rst2s5.py
 # the following will run RST2S5 if the target name contains the word 'slides'
 # otherwise it uses RST2HTML
@@ -33,11 +34,15 @@ CLEANFILES += ${HTMFILES}
 
 html:	${HTMFILES}
 
-.SUFFIXES: ${RST_SUFFIXES} .htm
+.SUFFIXES: ${RST_SUFFIXES} .htm .pdf
 
 ${RST_SUFFIXES:@s@$s.htm@}:
 	${RST2HTM} ${.IMPSRC} ${.TARGET}
 
+${RST_SUFFIXES:@s@$s.pdf@}:
+	${RST2PDF} ${.IMPSRC} ${.TARGET}
+
 .for s in ${RSTSRCS:O:u}
 ${s:R:T}.htm: $s
+${s:R:T}.pdf: $s
 .endfor
diff --git a/contrib/bmake/mk/sys.mk b/contrib/bmake/mk/sys.mk
index 30eca9b8450..236f62d0ac7 100644
--- a/contrib/bmake/mk/sys.mk
+++ b/contrib/bmake/mk/sys.mk
@@ -1,4 +1,4 @@
-# $Id: sys.mk,v 1.35 2012/11/12 06:27:51 sjg Exp $
+# $Id: sys.mk,v 1.36 2014/05/11 00:30:19 sjg Exp $
 #
 #	@(#) Copyright (c) 2003-2009, Simon J. Gerraty
 #
@@ -77,7 +77,7 @@ M_ListToSkip= O:u:ts::S,:,:N,g:S,^,N,
 # type should be a builtin in any sh since about 1980,
 # AUTOCONF := ${autoconf:L:${M_whence}}
 M_type = @x@(type $$x 2> /dev/null); echo;@:sh:[0]:N* found*:[@]:C,[()],,g
-M_whence = ${M_type}:M/*
+M_whence = ${M_type}:M/*:[1]
 
 # convert a path to a valid shell variable
 M_P2V = tu:C,[./-],_,g
diff --git a/contrib/bmake/mk/sys/SunOS.mk b/contrib/bmake/mk/sys/SunOS.mk
index f164aa282be..73f8062794e 100644
--- a/contrib/bmake/mk/sys/SunOS.mk
+++ b/contrib/bmake/mk/sys/SunOS.mk
@@ -1,4 +1,4 @@
-#	$Id: SunOS.mk,v 1.5 2010/01/11 23:02:05 sjg Exp $
+#	$Id: SunOS.mk,v 1.6 2014/04/05 22:56:54 sjg Exp $
 
 .if ${.PARSEFILE} == "sys.mk"
 .include 
@@ -12,7 +12,7 @@ ROOT_GROUP=	root
 
 SHLIB_FULLVERSION = ${SHLIB_MAJOR}
 
-# supress the dependency
+# suppress the dependency
 LIBCRT0= /dev/null
 
 .ifndef CC
diff --git a/contrib/bmake/mk/target-flags.mk b/contrib/bmake/mk/target-flags.mk
index f8932b2f17b..4525dbd08d7 100644
--- a/contrib/bmake/mk/target-flags.mk
+++ b/contrib/bmake/mk/target-flags.mk
@@ -3,7 +3,7 @@
 #
 # DESCRIPTION:
 #	Include this macro file after all others in a makefile and
-#	follow it with any target specfic flag settings.
+#	follow it with any target specific flag settings.
 #	For each such variable v in TARGET_FLAG_VARS we set:
 #.nf
 #
@@ -37,7 +37,7 @@
 
 
 # RCSid:
-#	$Id: target-flags.mk,v 1.8 2002/05/08 06:01:00 sjg Exp $
+#	$Id: target-flags.mk,v 1.9 2014/04/05 22:56:54 sjg Exp $
 #
 #	@(#) Copyright (c) 1998-2002, Simon J. Gerraty
 #
diff --git a/contrib/bmake/mk/warnings.mk b/contrib/bmake/mk/warnings.mk
index 9143e4289fd..bacbefb2b83 100644
--- a/contrib/bmake/mk/warnings.mk
+++ b/contrib/bmake/mk/warnings.mk
@@ -1,5 +1,5 @@
 # RCSid:
-#	$Id: warnings.mk,v 1.7 2009/12/11 17:06:03 sjg Exp $
+#	$Id: warnings.mk,v 1.8 2014/04/02 19:20:23 sjg Exp $
 #
 #	@(#) Copyright (c) 2002, Simon J. Gerraty
 #
@@ -42,24 +42,30 @@ HIGH_WARNINGS?= ${MEDIUM_WARNINGS} \
 	-Wswitch \
 	-Wwrite-strings
 
+EXTRA_WARNINGS?= ${HIGH_WARNINGS} -Wextra
+
 # The two step default makes it easier to test build with different defaults.
 DEFAULT_WARNINGS_SET?= MIN
 WARNINGS_SET?= ${DEFAULT_WARNINGS_SET}
 
 # If you add sets, besure to list them (you don't have to touch this list).
-ALL_WARNINGS_SETS+= MIN LOW MEDIUM HIGH
+ALL_WARNINGS_SETS+= MIN LOW MEDIUM HIGH EXTRA
 
-.if empty(${WARNINGS_SET}_WARNINGS)
-.if ${MAKE_VERSION:U0:[1]:C/.*-//} >= 20050530
+.if !empty(WARNINGS_SET)
+.for ws in ${WARNINGS_SET}
+.if empty(${ws}_WARNINGS)
+.if ${MAKE_VERSION:[1]:C/.*-//} >= 20050530
 .BEGIN:	_empty_warnings
 _empty_warnings: .PHONY
 .else
 .BEGIN:
 .endif
-	@echo "ERROR: Invalid: WARNINGS_SET=${WARNINGS_SET}"
+	@echo "ERROR: Invalid: WARNINGS_SET=${ws}"
 	@echo "ERROR: Try one of: ${ALL_WARNINGS_SETS:O:u}"; exit 1
 
 .endif
+.endfor
+.endif
 
 # Without -O or if we've set -O0 somewhere - to make debugging more effective,
 # we need to turn off -Wuninitialized as otherwise we get a warning that
@@ -69,40 +75,6 @@ _w_cflags:= ${CFLAGS} ${CPPFLAGS}
 W_uninitialized=
 .endif
 
-.if ${MAKE_VERSION:U0:[1]:C/.*-//} <= 20040118
-# This version uses .for loops to avoid a double free bug in old bmake's
-# but the .for loops are sensitive to when this file is read.
-
-# first, make a list of all the warning flags - doesn't matter if
-# its redundant - we'll sort -u
-_all_sets= ${WARNINGS_SET_${MACHINE_ARCH}} ${WARNINGS_SET} ${ALL_WARNINGS_SETS}
-_all_warnings= ${WARNINGS} ${_all_sets:O:u:@s@${$s_WARNINGS}@}
-
-# we want to set W_* for each warning so they are easy to turn off.
-# :O:u does a sort -u
-# using :C allows us to handle -f* -w* etc as well as -W*
-.for w in ${_all_warnings:O:u}
-${w:C/-(.)/\1_/} ?= $w
-.endfor
-
-# Allow for per-target warnings
-# Warning: the WARNINGS+= line below, 
-# may make your brain hurt - trust me; it works --sjg
-# the idea is that you can set WARNINGS_SET[_${MACHINE_ARCH}]=HIGH 
-# and use one of
-# W_format_mips_foo.o=
-# W_format_foo.o=
-# to turn off -Wformat for foo.o (on mips only in the first case), or
-# W_format_foo.o=-Wformat=2
-# for stricter checking.
-#
-# NOTE: that we force the target extension to be .o
-#
-.for w in ${WARNINGS_SET_${MACHINE_ARCH}:U${WARNINGS_SET}:@s@${$s_WARNINGS}@:O:u}
-WARNINGS+= ${${w:C/-(.)/\1_/}_${MACHINE_ARCH}_${.TARGET:T:R}.o:U${${w:C/-(.)/\1_/}_${.TARGET:T:R}.o:U${${w:C/-(.)/\1_/}_${MACHINE_ARCH}:U${${w:C/-(.)/\1_/}}}}}
-.endfor
-
-.else
 
 # .for loops have the [dis]advantage of being evaluated when read,
 # so adding to WARNINGS_SET[_${MACHINE_ARCH}] after this file is 
@@ -123,9 +95,19 @@ WARNINGS+= ${${w:C/-(.)/\1_/}_${MACHINE_ARCH}_${.TARGET:T:R}.o:U${${w:C/-(.)/\1_
 # 
 # NOTE: that we force the target extension to be .o
 #
-WARNINGS+= ${WARNINGS_SET_${MACHINE_ARCH}:U${WARNINGS_SET}:@s@${$s_WARNINGS}@:O:u:@w@${${w:C/-(.)/\1_/}::?=$w} ${${w:C/-(.)/\1_/}_${MACHINE_ARCH}_${.TARGET:T:R}.o:U${${w:C/-(.)/\1_/}_${.TARGET:T:R}.o:U${${w:C/-(.)/\1_/}_${MACHINE_ARCH}:U${${w:C/-(.)/\1_/}}}}}@}
 
-.endif
+# define this once, we use it a couple of times below (hence the doubled $$).
+M_warnings_list = @s@$${$$s_WARNINGS}@:O:u:@w@$${$${w:C/-(.)/\1_/}::?=$$w} $${$${w:C/-(.)/\1_/}_${MACHINE_ARCH}_${.TARGET:T:R}.o:U$${$${w:C/-(.)/\1_/}_${.TARGET:T:R}.o:U$${$${w:C/-(.)/\1_/}_${MACHINE_ARCH}:U$${$${w:C/-(.)/\1_/}}}}}@
+
+# first a list of warnings from the chosen set
+_warnings = ${WARNINGS_SET_${MACHINE_ARCH}:U${WARNINGS_SET}:${M_warnings_list}}
+# now a list of all -Wno-* overrides not just those defined by WARNINGS_SET
+# since things like -Wall imply lots of others.
+# this should be a super-set of the -Wno-* in _warnings, but 
+# just in case...
+_no_warnings = ${_warnings:M-Wno-*} ${ALL_WARNINGS_SETS:${M_warnings_list}:M-Wno-*}
+# -Wno-* must follow any others
+WARNINGS += ${_warnings:N-Wno-*} ${_no_warnings:O:u}
 
 .ifndef NO_CFLAGS_WARNINGS
 # Just ${WARNINGS} should do, but this is more flexible?
@@ -137,9 +119,10 @@ NO_CXX_WARNINGS+= \
 	missing-declarations \
 	missing-prototypes \
 	nested-externs \
+	shadow \
 	strict-prototypes
 
-.for s in ${SRCS:M*.cc}
+.for s in ${SRCS:M*.c*:N*.c:N*h}
 .for w in ${NO_CXX_WARNINGS}
 W_$w_${s:T:R}.o=
 .endfor
diff --git a/contrib/bmake/os.sh b/contrib/bmake/os.sh
index 9e45f3792f9..b714eb782ce 100755
--- a/contrib/bmake/os.sh
+++ b/contrib/bmake/os.sh
@@ -17,7 +17,7 @@
 #	Simon J. Gerraty 
 
 # RCSid:
-#	$Id: os.sh,v 1.44 2010/06/29 15:37:21 sjg Exp $
+#	$Id: os.sh,v 1.46 2014/05/19 16:38:09 sjg Exp $
 #
 #	@(#) Copyright (c) 1994 Simon J. Gerraty
 #
@@ -128,11 +128,13 @@ SunOS)
 	K=-k
 	MAILER=/usr/bin/Mail
 	LOCAL_FS=local
-	case "$-" in
-	*i*) ;;
+	: $-,$ENV
+	case "$-,$ENV" in
+	*i*,*) ;;
+	*,|*ENVFILE*) ;;
 	*) ENV=;;
 	esac
-	# NetBSD at least has good backward compatability
+	# NetBSD at least has good backward compatibility
 	# so NetBSD/i386 is good enough
 	case $OS in
 	NetBSD) SHARE_ARCH=$OS/${MACHINE_ARCH:-$MACHINE};;
diff --git a/contrib/bmake/parse.c b/contrib/bmake/parse.c
index 7314da66237..20cd5ab866f 100644
--- a/contrib/bmake/parse.c
+++ b/contrib/bmake/parse.c
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.192 2013/10/18 20:47:06 christos Exp $	*/
+/*	$NetBSD: parse.c,v 1.194 2014/02/15 00:17:17 christos Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.192 2013/10/18 20:47:06 christos Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.194 2014/02/15 00:17:17 christos Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)parse.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.192 2013/10/18 20:47:06 christos Exp $");
+__RCSID("$NetBSD: parse.c,v 1.194 2014/02/15 00:17:17 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -366,6 +366,7 @@ static int ParseAddCmd(void *, void *);
 static void ParseHasCommands(void *);
 static void ParseDoInclude(char *);
 static void ParseSetParseFile(const char *);
+static void ParseSetIncludedFile(void);
 #ifdef SYSVINCLUDE
 static void ParseTraditionalInclude(char *);
 #endif
@@ -857,7 +858,8 @@ ParseLinkSrc(void *pgnp, void *cgnp)
 	    (void)Lst_AtEnd(cgn->parents, pgn);
     pgn->unmade += 1;
     if (DEBUG(PARSE)) {
-	fprintf(debug_file, "# ParseLinkSrc: added child %s - %s\n", pgn->name, cgn->name);
+	fprintf(debug_file, "# %s: added child %s - %s\n", __func__,
+	    pgn->name, cgn->name);
 	Targ_PrintNode(pgn, 0);
 	Targ_PrintNode(cgn, 0);
     }
@@ -1032,8 +1034,8 @@ ParseDoSrc(int tOp, const char *src)
 	    (void)Lst_AtEnd(predecessor->order_succ, gn);
 	    (void)Lst_AtEnd(gn->order_pred, predecessor);
 	    if (DEBUG(PARSE)) {
-		fprintf(debug_file, "# ParseDoSrc: added Order dependency %s - %s\n",
-			predecessor->name, gn->name);
+		fprintf(debug_file, "# %s: added Order dependency %s - %s\n",
+		    __func__, predecessor->name, gn->name);
 		Targ_PrintNode(predecessor, 0);
 		Targ_PrintNode(gn, 0);
 	    }
@@ -2176,6 +2178,7 @@ Parse_include_file(char *file, Boolean isSystem, int silent)
     /* load it */
     lf = loadfile(fullname, fd);
 
+    ParseSetIncludedFile();
     /* Start reading from this file next */
     Parse_SetInput(fullname, 0, -1, loadedfile_nextbuf, lf);
     curFile->lf = lf;
@@ -2233,6 +2236,41 @@ ParseDoInclude(char *line)
 }
 
 
+/*-
+ *---------------------------------------------------------------------
+ * ParseSetIncludedFile  --
+ *	Set the .INCLUDEDFROMFILE variable to the contents of .PARSEFILE
+ *	and the .INCLUDEDFROMDIR variable to the contents of .PARSEDIR
+ *
+ * Results:
+ *	None
+ *
+ * Side Effects:
+ *	The .INCLUDEDFROMFILE variable is overwritten by the contents
+ *	of .PARSEFILE and the .INCLUDEDFROMDIR variable is overwriten
+ *	by the contents of .PARSEDIR
+ *---------------------------------------------------------------------
+ */
+static void
+ParseSetIncludedFile(void)
+{
+    char *pf, *fp = NULL;
+    char *pd, *dp = NULL;
+
+    pf = Var_Value(".PARSEFILE", VAR_GLOBAL, &fp);
+    Var_Set(".INCLUDEDFROMFILE", pf, VAR_GLOBAL, 0);
+    pd = Var_Value(".PARSEDIR", VAR_GLOBAL, &dp);
+    Var_Set(".INCLUDEDFROMDIR", pd, VAR_GLOBAL, 0);
+
+    if (DEBUG(PARSE))
+	fprintf(debug_file, "%s: ${.INCLUDEDFROMDIR} = `%s' "
+	    "${.INCLUDEDFROMFILE} = `%s'\n", __func__, pd, pf);
+
+    if (fp)
+	free(fp);
+    if (dp)
+	free(dp);
+}
 /*-
  *---------------------------------------------------------------------
  * ParseSetParseFile  --
@@ -2268,8 +2306,8 @@ ParseSetParseFile(const char *filename)
 	Var_Set(".PARSEFILE", pf = slash + 1, VAR_GLOBAL, 0);
     }
     if (DEBUG(PARSE))
-	fprintf(debug_file, "ParseSetParseFile: ${.PARSEDIR} = `%s' "
-	    "${.PARSEFILE} = `%s'\n", pd, pf);
+	fprintf(debug_file, "%s: ${.PARSEDIR} = `%s' ${.PARSEFILE} = `%s'\n",
+	    __func__, pd, pf);
     free(dirname);
 }
 
@@ -2331,8 +2369,8 @@ Parse_SetInput(const char *name, int line, int fd,
 	ParseTrackInput(name);
 
     if (DEBUG(PARSE))
-	fprintf(debug_file, "Parse_SetInput: file %s, line %d, fd %d, nextbuf %p, arg %p\n",
-		name, line, fd, nextbuf, arg);
+	fprintf(debug_file, "%s: file %s, line %d, fd %d, nextbuf %p, arg %p\n",
+	    __func__, name, line, fd, nextbuf, arg);
 
     if (fd == -1 && nextbuf == NULL)
 	/* sanity */
@@ -2404,7 +2442,7 @@ ParseTraditionalInclude(char *line)
     char	  *all_files;
 
     if (DEBUG(PARSE)) {
-	    fprintf(debug_file, "ParseTraditionalInclude: %s\n", file);
+	    fprintf(debug_file, "%s: %s\n", __func__, file);
     }
 
     /*
@@ -2463,7 +2501,7 @@ ParseGmakeExport(char *line)
     char	  *value;
 
     if (DEBUG(PARSE)) {
-	    fprintf(debug_file, "ParseGmakeExport: %s\n", variable);
+	    fprintf(debug_file, "%s: %s\n", __func__, variable);
     }
 
     /*
@@ -2543,6 +2581,8 @@ ParseEOF(void)
 	/* We've run out of input */
 	Var_Delete(".PARSEDIR", VAR_GLOBAL);
 	Var_Delete(".PARSEFILE", VAR_GLOBAL);
+	Var_Delete(".INCLUDEDFROMDIR", VAR_GLOBAL);
+	Var_Delete(".INCLUDEDFROMFILE", VAR_GLOBAL);
 	return DONE;
     }
 
diff --git a/contrib/bmake/str.c b/contrib/bmake/str.c
index bc324b8c9c2..0260447f817 100644
--- a/contrib/bmake/str.c
+++ b/contrib/bmake/str.c
@@ -1,4 +1,4 @@
-/*	$NetBSD: str.c,v 1.34 2012/03/03 23:16:47 dholland Exp $	*/
+/*	$NetBSD: str.c,v 1.35 2014/02/12 01:35:56 sjg Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: str.c,v 1.34 2012/03/03 23:16:47 dholland Exp $";
+static char rcsid[] = "$NetBSD: str.c,v 1.35 2014/02/12 01:35:56 sjg Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char     sccsid[] = "@(#)str.c	5.8 (Berkeley) 6/1/90";
 #else
-__RCSID("$NetBSD: str.c,v 1.34 2012/03/03 23:16:47 dholland Exp $");
+__RCSID("$NetBSD: str.c,v 1.35 2014/02/12 01:35:56 sjg Exp $");
 #endif
 #endif				/* not lint */
 #endif
@@ -145,7 +145,7 @@ brk_string(const char *str, int *store_argc, Boolean expand, char **buffer)
 	const char *p;
 	int len;
 	int argmax = 50, curlen = 0;
-    	char **argv = bmake_malloc((argmax + 1) * sizeof(char *));
+    	char **argv;
 
 	/* skip leading space chars. */
 	for (; *str == ' ' || *str == '\t'; ++str)
@@ -155,6 +155,12 @@ brk_string(const char *str, int *store_argc, Boolean expand, char **buffer)
 	if ((len = strlen(str) + 1) > curlen)
 		*buffer = bmake_malloc(curlen = len);
 
+	/*
+	 * initial argmax based on len
+	 */
+	argmax = MAX((len / 5), 50);
+	argv = bmake_malloc((argmax + 1) * sizeof(char *));
+
 	/*
 	 * copy the string; at the same time, parse backslashes,
 	 * quotes and build the argument list.
diff --git a/contrib/bmake/var.c b/contrib/bmake/var.c
index 4ee8af1411b..0b7e88eb875 100644
--- a/contrib/bmake/var.c
+++ b/contrib/bmake/var.c
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.184 2013/09/04 15:38:26 sjg Exp $	*/
+/*	$NetBSD: var.c,v 1.186 2014/06/20 06:13:45 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.184 2013/09/04 15:38:26 sjg Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.186 2014/06/20 06:13:45 sjg Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.184 2013/09/04 15:38:26 sjg Exp $");
+__RCSID("$NetBSD: var.c,v 1.186 2014/06/20 06:13:45 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -140,17 +140,6 @@ __RCSID("$NetBSD: var.c,v 1.184 2013/09/04 15:38:26 sjg Exp $");
 #include    "job.h"
 
 extern int makelevel;
-/*
- * XXX transition hack for FreeBSD ports.
- * bsd.port.mk can set .MAKE.FreeBSD_UL=yes
- * to cause us to treat :[LU] as aliases for :t[lu]
- * To be reverted when ports converts to :t[lu] (when 8.3 is EOL)
- */
-#define MAKE_FREEBSD_UL ".MAKE.FreeBSD_UL"
-#ifdef MAKE_FREEBSD_UL
-static int FreeBSD_UL = FALSE;
-#endif
-
 /*
  * This lets us tell if we have replaced the original environ
  * (which we cannot free).
@@ -990,12 +979,6 @@ Var_Set(const char *name, const char *val, GNode *ctxt, int flags)
 
 	Var_Append(MAKEOVERRIDES, name, VAR_GLOBAL);
     }
-	
-#ifdef MAKE_FREEBSD_UL
-    if (strcmp(MAKE_FREEBSD_UL, name) == 0) {
-	FreeBSD_UL = getBoolean(MAKE_FREEBSD_UL, FALSE);
-    }
-#endif
 
 
  out:
@@ -2654,7 +2637,7 @@ ApplyModifiers(char *nstr, const char *tstr,
 			break;
 		    }
 		    free(UNCONST(pattern.rhs));
-		    newStr = var_Error;
+		    newStr = varNoError;
 		    break;
 		}
 		goto default_case; /* "::" */
@@ -2689,24 +2672,8 @@ ApplyModifiers(char *nstr, const char *tstr,
 		free(loop.str);
 		break;
 	    }
-	case 'U':
-#ifdef MAKE_FREEBSD_UL
-	    if (FreeBSD_UL) {
-		int nc = tstr[1];
-
-		/* we have to be careful, since :U is used internally */
-		if (nc == ':' || nc == endc) {
-		    char *dp = bmake_strdup(nstr);
-		    for (newStr = dp; *dp; dp++)
-			*dp = toupper((unsigned char)*dp);
-		    cp = tstr + 1;
-		    termc = *cp;
-		    break;		/* yes inside the conditional */
-		}
-		/* FALLTHROUGH */
-	    }
-#endif
 	case 'D':
+	case 'U':
 	    {
 		Buffer  buf;    	/* Buffer for patterns */
 		int	    wantit;	/* want data in buffer */
@@ -2766,17 +2733,6 @@ ApplyModifiers(char *nstr, const char *tstr,
 		break;
 	    }
 	case 'L':
-#ifdef MAKE_FREEBSD_UL
-	    if (FreeBSD_UL) {
-		char *dp = bmake_strdup(nstr);
-		for (newStr = dp; *dp; dp++)
-		    *dp = tolower((unsigned char)*dp);
-		cp = tstr + 1;
-		termc = *cp;
-		break;
-	    }
-	    /* FALLTHROUGH */
-#endif
 	    {
 		if ((v->flags & VAR_JUNK) != 0)
 		    v->flags |= VAR_KEEP;
diff --git a/contrib/byacc/CHANGES b/contrib/byacc/CHANGES
index 87a0d42398e..c9d73ced986 100644
--- a/contrib/byacc/CHANGES
+++ b/contrib/byacc/CHANGES
@@ -1,3 +1,77 @@
+2014-07-15  Thomas E. Dickey  
+
+	* aclocal.m4: resync with my-autoconf (no change to configure script)
+
+	* VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile:
+	bump
+
+	* test/run_test.sh:
+	make top-level "make check" work again, by adding another step to filtering
+	the test results.
+
+2014-07-14  Thomas E. Dickey  
+
+	* test/run_test.sh: changes from Garrett Cooper's patch:
+		a) ensure that the script returns an error-code if there are differences
+		b) escape "." character in left side of sed expression for $YACC
+		c) ensure that $ifBTYACC has a value
+
+	* test/btyacc/big_b.output, test/btyacc/big_l.output, test/btyacc/help.output, test/btyacc/no_b_opt.output, test/btyacc/no_output2.output, test/btyacc/no_p_opt.output, test/btyacc/nostdin.output:
+	regen (reminder by Garrett Cooper)
+
+2014-07-14  Garrett.Cooper
+
+	* test/btyacc/err_inherit1.error, test/btyacc/err_inherit2.error, test/btyacc/err_inherit3.error, test/btyacc/err_inherit4.error, test/btyacc/err_inherit5.error, test/btyacc/err_syntax1.error, test/btyacc/err_syntax10.error, test/btyacc/err_syntax11.error, test/btyacc/err_syntax12.error, test/btyacc/err_syntax13.error, test/btyacc/err_syntax14.error, test/btyacc/err_syntax15.error, test/btyacc/err_syntax16.error, test/btyacc/err_syntax17.error, test/btyacc/err_syntax18.error, test/btyacc/err_syntax19.error, test/btyacc/err_syntax2.error, test/btyacc/err_syntax21.error, test/btyacc/err_syntax22.error, test/btyacc/err_syntax23.error, test/btyacc/err_syntax24.error, test/btyacc/err_syntax25.error, test/btyacc/err_syntax26.error, test/btyacc/err_syntax27.error, test/btyacc/err_syntax3.error, test/btyacc/err_syntax4.error, test/btyacc/err_syntax5.error, test/btyacc/err_syntax6.error, test/btyacc/err_syntax7.error, test/btyacc/err_syntax7a.error, test/btyacc/err_syntax7b.error, test/btyacc/err_syntax8.error, test/btyacc/err_syntax8a.error, test/btyacc/err_syntax9.error, test/yacc/err_syntax1.error, test/yacc/err_syntax10.error, test/yacc/err_syntax11.error, test/yacc/err_syntax12.error, test/yacc/err_syntax13.error, test/yacc/err_syntax14.error, test/yacc/err_syntax15.error, test/yacc/err_syntax16.error, test/yacc/err_syntax17.error, test/yacc/err_syntax18.error, test/yacc/err_syntax19.error, test/yacc/err_syntax2.error, test/yacc/err_syntax21.error, test/yacc/err_syntax22.error, test/yacc/err_syntax23.error, test/yacc/err_syntax24.error, test/yacc/err_syntax25.error, test/yacc/err_syntax26.error, test/yacc/err_syntax27.error, test/yacc/err_syntax3.error, test/yacc/err_syntax4.error, test/yacc/err_syntax5.error, test/yacc/err_syntax6.error, test/yacc/err_syntax7.error, test/yacc/err_syntax7a.error, test/yacc/err_syntax7b.error, test/yacc/err_syntax8.error, test/yacc/err_syntax8a.error, test/yacc/err_syntax9.error:
+	regen
+
+2014-05-27  Tom.Shields
+
+	* main.c: remove obsolete -D option from usage message
+
+2014-05-27  Thomas E. Dickey  
+
+	* VERSION, package/byacc.spec, package/debian/changelog, test/yacc/big_b.output, test/yacc/big_l.output, test/yacc/help.output, test/yacc/no_b_opt.output, test/yacc/no_output2.output, test/yacc/no_p_opt.output, test/yacc/nostdin.output:
+	bump
+
+2014-04-22  Thomas E. Dickey  
+
+	* mstring.c:
+	use vsnprintf() to ensure that msprintf's buffer is large enough.
+
+	* main.c, defs.h: add mstring_leaks()
+
+	* configure: regen
+
+	* output.c: fix a complementary warning
+
+	* mstring.c: introduce vsnprintf
+
+	* configure.in, config_h.in: add check for vsnprintf
+
+	* output.c: quiet a type-conversion warning
+
+	* mstring.c: fix a potential memory leak on ENOMEM
+	quiet a couple of type-conversion warnings
+
+	* defs.h: add/use GCC_PRINTFLIKE for msprintf()
+
+2014-04-22  Tom.Shields
+
+	* README.BTYACC:
+	drop "NOTES-btyacc-Changes" and "NOTES-btyacc-Disposition", merging relevant
+	content into README.BTYACC
+
+2014-04-22  Thomas E. Dickey  
+
+	* package/pkgsrc/Makefile, VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec:
+	bump
+
+2014-04-19  Thomas E. Dickey  
+
+	* config.sub: 2014-04-03
+
+	* config.guess: 2014-03-23
+
 2014-04-09  Rick.Spates
 
 	* main.c, defs.h: patch to allow DEBUG build with WIN32 system
diff --git a/contrib/byacc/MANIFEST b/contrib/byacc/MANIFEST
index 405dec684a1..8a2b784c347 100644
--- a/contrib/byacc/MANIFEST
+++ b/contrib/byacc/MANIFEST
@@ -1,4 +1,4 @@
-MANIFEST for byacc-20140409, version t20140409
+MANIFEST for byacc-20140715, version t20140715
 --------------------------------------------------------------------------------
 MANIFEST                        this file
 ACKNOWLEDGEMENTS                original version of byacc - 1993
@@ -6,8 +6,6 @@ AUTHORS                         nicknames for some contributors (see CHANGES for
 Makefile.old                    renamed from Makefile
 NEW_FEATURES                    original version of byacc - 1993
 NOTES                           original version of byacc - 1993
-NOTES-btyacc-Changes            byacc-btyacc-20140323
-NOTES-btyacc-Disposition        byacc-btyacc-20140323
 NO_WARRANTY                     original version of byacc - 1993
 README                          original version of byacc - 1993
 README.BTYACC                   byacc-btyacc-20140323
diff --git a/contrib/byacc/NOTES-btyacc-Changes b/contrib/byacc/NOTES-btyacc-Changes
deleted file mode 100644
index f074907ee0c..00000000000
--- a/contrib/byacc/NOTES-btyacc-Changes
+++ /dev/null
@@ -1,385 +0,0 @@
-Tom Shields, March 17, 2014
-
-PARKING LOT ISSUES:
--------------------
-- verify debian packaging still works?
-
-- there are no #line directives in y.tab.i, other than those that come
-  from the input file and the skeleton file; to fix this, would need to
-  count output lines in externs_file and add 'write_externs_lineno()'
-  similar to 'write_code_lineno()'
-- if there are no defined symbols, the .tab.h file isn't empty (weird case,
-  may not be worth fixing)
-- consider: treat []-actions identical to {}-actions if not processing a
-  backtracking parser (avoids test case error)?
-
-
-BTYACC CHANGES CURRENTLY DEFERRED, BY FILE:
--------------------------------------------
-
-push.skel
-- skeleton for a 'push' parser
-- needs to be upgraded match the structure of yaccpar.skel
-
-defs.h
-- adopt '%include' changes
-- adopt '%define'/'%ifdef'/'%endif'
-- adopt -E flag to print preprocessed grammar to stdout
-
-error.c
-- adopt '%include' changes
-- NOTE: there is a btyacc change that might be worth adopting in byacc
-  [FileError() refactoring to eliminate duplicated code in most of the
-  error message functions]
-
-main.c
-- adopt '%define' changes
-- adopt '-DNAME' command line option to define preprocessor variable NAME
-- adopt -E flag to print preprocessed grammar to stdout
-- adopt '-S skeleton_file' command line option to select an alternate parser
-  skeleton file
-- the skeleton file named by the -S flag is used as provided to open the
-  file; consider a change to this behavior to check whether the named file
-  has a path prefix, and if not, look in 'installation' directory if the
-  file is not found in the working directory
-
-output.c
-- adopt '%include' changes
-
-reader.c
-- adopt '%include' changes
-- adopt '%define'/'%ifdef'/'%endif' changes
-- adopt -E flag to print preprocessed grammar to stdout
-- NOTE: there is a btyacc change that might be worth adopting in byacc
-  [copy_string() & copy_comment() refactoring to eliminate duplicated
-  code in copy_text() and copy_union()]
-
-warshall.c
-- NOTE: there is a btyacc change that might be worth adopting in byacc
-  [shifting 'mask' incrementally rather than literal '1' by a variable
-  amount each time thru the loop]
-
-
-================================================================================
-
-
-new files:
-----------
-
-skel2c
-- modified from btyacc distribution: don't generate #include defs.h
-- extended syntax recognized to include '%% insert VERSION here', generating
-  the defines for YYMAJOR, YYMINOR and YYPATCH at that point
-- made generated tables type 'const char *const' to match skelton.c from
-  byacc-20130925 baseline
-- added code to append text for write_section() to end of generated skeleton.c
-- remove conversion of tab to \t in generated skeleton.c
-- extended syntax recognized to include '%%ifdef', '%%ifndef', '%%else' and
-  '%%endif'; used in yaccpar.skel to bracket code that is specific to
-  backtracking
-
-yaccpar.skel.old
-- created from skeleton.c in byacc-20140101 baseline; use of this skeleton
-  will create a version of skeleton.c that is close to that in the
-  byacc-20140101 baseline
-- eliminated 'body_3' and 'trailer_2' skeleton segments - no need to generate
-  yyerror() invocation dynamically; YYERROR_CALL() is already generated
-  earlier, and so can be used in the skeleton to simplify
-- added 'const' to types in '%% tables' section to match what skel2c,
-  start_int_table() and state_str_table() generate
-- added a few cosmetic changes (e.g., added some additional comments,
-  reworded debugging output to match yaccpar.skel, changed yygrowstack()
-  to return YYENOMEM for 'out of memory' error, rather than -1, to match
-  yaccpar.skel; changed yyparse() return value from 1 to 2 for the
-  'out of memory' error to match yaccpar.skel)
-- added '#ifndef'/'#endif' around '#define YYINITSTACKSIZE 200' to allow
-  the value to be changed at compile time
-- changed 'printf(' to 'fprintf(stderr, '; added stack depth (yydepth) to
-  debugging output from yaccpar.skel
-- use 'YYINT' rather than 'short' for integer table types
-
-yaccpar.skel
-- renamed from btyaccpa.ske, merged with btyacc-c.ske
-- modified from btyacc distribution to match the latest byacc-20140101
-  skeleton structure & data structures
-- make local functions static 
-- change "virtual memory exceeded" to "memory exhausted" for bison
-  compatibility
-- change debug output generation from printf/puts/putc onto stdout to use
-  fprintf/fputs/fputc onto stderr; include
-  stack depth and whether or not in trial parsing
-- changed types of generated string tables to be 'const pointer to const char'
-- check all malloc()/realloc() return values, ensure return value of
-  yyparse() = 2 if parsing failed due to memory exhaustion
-- change YYDBPR() macro to YYSTYPE_TOSTRING(); define semantics as delivering
-  a char* value representing a semantic value (e.g., yylval or yyval, or the
-  contents of an entry on the semantic stack); additional parameter passed:
-  grammar symbol # (to assist interpretation of semantic value)
-- change YYPOSN to YYLTYPE and yyposn to yylloc (position corresponding to
-  yylval) for bison compatibility; add yyloc (corresponding to yyval)
-- move default definition of YYLTYPE into output.c, generating a typedef
-- add '#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)'/'#endif' around
-  all lines specific to position processing
-- add '#if defined(YYDESTRUCT_CALL)'/'#endif' around all lines specific to
-  semantic & position stack processing to reclaim memory associated with
-  discarded symbols
-- add '%%ifdef YYBTYACC'/'%%endif' around all lines specific to backtrack
-  parsing; converted by skel2c into '#if defined(YYBTYACC)'/'#endif'
-- distinguish between "yacc stack overflow" and "memory exhausted" situations
-- consolidated termination cleanup code; introduced yyreturn, set to 2 after
-  labels yyoverflow/yyenomem, set to 1 after label yyabort, set to 0 after
-  label yyaccept; all termination cases jump to label yyreturn, which does
-  any cleanup then returns yyreturn value
-- replaced YYDELETEVAL & YYDELETEPOSN user-supplied macro capability by
-  implementation of byacc-generated yydestruct() as defined by bison
-  compatible %destructor mechanism
-- moved invocation of 'YYREDUCEPOSNFUNC' macro to immediately prior to, rather
-  than after, execution of final rule action (so that, at some future
-  date, implementation extensions can be added to enable custom calculation
-  of locations associated with non-terminals within rule actions); deleted
-  unnecessary flag 'reduce_posn'; deleted 'YYCALLREDUCEPOSN' macro; deleted
-  C++ variant of 'YYREDUCEPOSNFUNC' invocation
-- adopt approach similar to bison for default computation of yyloc; change
-  macro 'YYREDUCEPOSNFUNC' name to 'YYLLOC_DEFAULT' for bison compatibility;
-  added 'yyerror_loc_range[2]' to hold start & end locations for error
-  situations that pop the stack
-- use 'YYINT' rather than 'short' for integer table types, and for indexing
-  parser tables
-
-readskel.c
-http://www.verisign.com/index.html- replaced error() with fprintf()
-
-mstring.h
-- moved contents of mstring.h to defs.h - mstring.h is obsolete
-
-mstring.c
-- replaced include of mstring.h with defs.h
-- changed 'START' to 'HEAD' to remove conflict with 'START' used for
-  the start symbol defined in defs.h
-
-modified byacc files:
----------------------
-
-skeleton.c
-- skeleton.c is now generated from the appropriate skeleton file by 'skel2c'
-
-configure.in
-- added configuration for --enable-btyacc option; if 'yes' add '-DYYBTYACC'
-  to DEFINES in makefile.in; --enable-btyacc defaults to 'no'
-- added configuration for --with-max-table-size option; if present,
-  overrides the value of MAXTABLE defined in defs.h
-- regenerate configure using autoconf
-
-makefile.in
-- added mstring.c to C_FILES
-- added mstring$o to OBJS
-- added @DEFINES@ as value of DEFINES make variable
-- added new make variable SKELETON with value 'yaccpar.skel'
-- added rule to generate skeleton.c from $(SKELETON), depending on skel2c
-  and makefile
-- added rm -f skeleton.c distclean rule
-- moved dependency on makefile from only main$o & skeleton$o to $(OBJS),
-  since if ./configure is run changing, for example, from --enable-btyacc
-  to --disable-btyacc, all files must be recompiled to ensure a clean
-  executable
-- add @MAXTABLE@ for optional '-DMAXTABLE=nnn' if configured using
-  --with-max-table-size=nnn
-- changed 'cd test && rn 0f test-*'to 'rm -f $(testdir)/test-*'
-
-test/run_test.sh
-- ???
-
-test/run_make.sh
-- ???
-
-defs.h
-- moved contents of mstring.h to defs.h - mstring.h is obsolete
-- added  to get the various system defined machine limits;
-  changed definitions of MAXCHAR, MAXSHORT, MINSHORT & BITS_PER_WORD to use
-  defines from ; changed definitions of BIT and SETBIT to use
-  value of BITS_PER_WORD
-- added typedef for __compar_fn_t, conditioned on _COMPAR_FN_T being
-  undefined (at least for Mac OSX environment)
-- adopt new symbol class values ACTION and ARGUMENT
-- adopt changes/additions used by inherited attribute processing
-- clean up locations of extern function definitions to match where they
-  actually live in source files
-- adopt error functions from inherited attribute processing; added new error
-  functions
-- added keyword code LOCATIONS for %locations
-- added keyword code DESTRUCTOR for %destructor
-- added extern decl for 'int locations'; true if %locations present
-- added extern decl for 'int backtrack'; initialized to 0 (= false), set to
-  1 (= true) if -B flag is present
-- added extern decl for 'int destructor'; true if at least one %destructor
-  present in grammar spec file
-- define 'YYINT' as the smallest C type that can be used to address a
-  table of size 'MAXTABLE'; define 'YYINT' based on the value of
-  'MAXTABLE' using the standard system type size definitions from ;
-  define 'MAXYYINT' and 'MINYYINT' accordingly
-- change 'Value_t' and 'Index_t' to 'YYINT' from 'short'
-- allow 'MAXTABLE' to be defined by '-DMAXTABLE=nnn' at compile-time
-
-closure.c
-- changed print_closure(), print_EFF() and print_first_derives() to 'static';
-  added fwd declarations
-- changed 'short' to 'Value_t' (in some instances, 'Value_t' was already
-  used for variables/parameters that were related to variables/parameters
-  declared as 'short'
-
-error.c
-- adopt error functions from inherited attribute processing; added a few
-  additional inherited attribute error functions
-
-graph.c
-- changed 'short' to 'Value_t' (in some instances, 'Value_t' was already
-  used for variables/parameters that were related to variables/parameters
-  declared as 'short'
-
-lalr.c
-- changed MAXSHORT to MAXYYINT
-
-lr0.c
-- changed MAXSHORT to MAXYYINT
-- changed 'short' to 'Value_t' (in some instances, 'Value_t' was already
-  used for variables/parameters that were related to variables/parameters
-  declared as 'short'
-
-main.c
-- changed 'short' to 'Value_t' (in some instances, 'Value_t' was already
-  used for variables/parameters that were related to variables/parameters
-  declared as 'short'
-
-mkpar.c
-- backtracking attempts to resolve shift/reduce and reduce/reduce conflicts
-
-output.c
-- generate prefix & YYPREFIX defines into externs file (-i, .tab.i) and
-  code file (-r, .code.c); generate into output file (.tab.c) only if not
-  using -r option; eliminates doubled output of prefix aliases if -r with
-  no -i in y.tab.c and y.code.c or if -r & -i in y.tab.i and y.code.c
-- changed types of generated string tables to be 'const pointer to const char'
-- adopt backtracking as an alternative in cases where otherwise we have a
-  conflict in the parsing actions (3, rather than 2, choices)
-- wrap defines file with (where "yy" is value of 'symbol_prefix')
-    #ifndef __yy_defines_h_
-    #define _yy_defines_h_
-
-    
-
-    #endif
-- avoid writing %%xdecls skeleton section twice if -r used
-- eliminated 'body_3' and 'trailer_2' skeleton segments - no need to generate
-  yyerror() invocation dynamically; YYERROR_CALL() is already generated
-  earlier, and can be used in the pareser skeleton
-- if -P flag (pure_parser), add yylloc as 2nd parameter to yylex()
-  (declaration & call)
-- change YYPOSN to YYLTYPE and yyposn to yylloc (position corresponding to
-  yylval) for bison compatibility; add yyloc (corresponding to yyval)
-- generate yylloc parameters for yylex & yyerror if %locations present
-- add location as 1st parameter to declaraion & invocation of yyerror() if
-  %locations present
-- output backtrack parsing tables if -B flag is present
-- added generation of yystos[] with output_accessing_symbols() to allow
-  translation from a parser internal state number to the corresponding
-  grammar symbol number [0 .. nsyms) of the accessing symbol of that parser
-  state; used in the generated code for YYDESTRUCT_CALL() &
-  YYSTYPE_TOSTRING() to enable the correct semantic value union tag to be
-  determined when executing the implementation of YYDESTRUCT_CALL() or
-  YYSTYPE_TOSTRING() (similar to yystos[] in bison)
-- added to output_prefix(): yystos; yycindex & yyctable if compiling
-  backtracking; yyloc & yylloc if %locations used
-- extended yyname[] to include all grammar symbols, not just the terminal
-  symbols: '$end', 'error', '$accept', all non-terminals, including internally
-  generated non-terminals for embedded actions in rules, and 'illegal-symbol'
-  (which bison spells '$undefined'); '$end' already defined as a symbol 0,
-  rathern than adding 'end-of-file' as the name of symbol 0; added
-  'illegal-symbol' from byacc-20140101 (NOTE: the comment in the code that
-  says byacc does not predefine '$end' and '$error' is incorrect; however,
-  both bison and byacc spell '$error' as 'error')
-- added generation of #define YYTRANSLATE() from byacc-20140101, but changed
-  the definition for the undefined symbol case because it is no longer in
-  yyname[YYMAXTOKEN+1] but rather occurs after the last non-terminal symbol;
-  added #define YYUNDFTOKEN to contain the index in yyname of 'illegal-symbol'
-- generate YYLTYPE in output_ltype() as a struct like for bison rather than
-  using #define in yaccpar.skel
-- added 'write_code_lineno' invocation at start of 'output_prefix'
-- added 'write_code_lineno' invocation at start of 'output_pure_parser'
-- added 'write_code_lineno' invocation prior to generation of #include
-  for externs file
-- added 'write_code_lineno' invocation after 1st 'write_section(fp, xdecls)'
-- added '++outline;' prior to output of '#define YYTRANSLATE' - this was
-  actually causing almost all of the invocations of 'write_code_lineno' to
-  put out the correct #line directive
-- corrected 'write_code_lineno' - the line number in a #line directive is
-  the number of the next line, not the number of the #line line
-- changed MAXSHORT to MAXYYINT; changed 'high' local static from 'int' to
-  'long' so that it can get higher than 'MAXYYINT' without machine-dependent
-  behavior; changed related formats from '%d' to '%ld'
-- generate 'YYINT' rather than 'short' for integer table types
-- generate YYDESTRUCT_DECL & YYDESTRUCT_CALL macros, similar to YYERROR_DECL
-  and YYERROR_CALL macros, that can be redefined by user, if desired, to add
-  additional parameters to yydestruct() (and even change the 'yydestruct'
-  function name)
-- if at least one %destructor present, generate yydestruct(); 1st parameter
-  is a string indicating the context in which yydestruct() is invoked
-  (e.g., discarding input token, discarding state on stack, cleanup when
-  aborting); 2nd parameter is the internal grammar symbol number [0..nsyms)
-  of the accessing symbol of the parser state on the top of the stack; 3rd
-  parameter is a pointer to the semantic value to be reclaimed associated
-  with the grammar symbol in the 2nd parameter; if %locations is defined,
-  the 4th parameter is a pointer to the position value to be reclaimed
-  associated with the grammar symbol in the 2nd parameter
-
-reader.c
-- adopt []-actions, similar to {}-actions; {}-actions are only executed when
-  not in trial mode, but []-actions are executed regardless of mode
-- adopt new symbol class values ACTION and ARGUMENT
-- adopt inherited attributes (syntax resembles arguments to non-terminal
-  symbols)
-- adopt keyword table lookup from btyacc, modified to handle equivalence
-  of '-' and '_' in spelling of keywords
-- adopt refactoring of tag table creation into cache_tag() for use in
-  multiple locations
-- added new error functions in place of btyacc's generic error() function
-- changed '0' to 'NULL' for pointer initialization
-- reworked for-loop at end of get_line (part of DEFERRED '%ifdef/%endif' change)
-- added %locations directive for bison compatibility to enable position
-  processing
-- added decl for 'int locations'; true if %locations present
-- added decl 'int backtrack'; initialized to 0 (= false), set to
-  1 (= true) if -B flag is present
-- process %locations if present, set location = 1
-- only process []-actions and only generate 'if (!yytrial)' prefix for
-  {}-actions if backtracking is enabled
-- add decl for 'int destructor'; true if at least one %destructor is present
-- add %destructor directive to enable semantic & position stack processing to
-  reclaim memory associated with discarded symbols
-- process bison compatible %destructor (set destructor = 1); support @$ in
-  %destructor code to reference the position value if %locations is defined
-- changed 'short' to 'Value_t' (in some instances, 'Value_t' was already
-  used for variables/parameters that were related to variables/parameters
-  declared as 'short'
-- if %locations present, support @N and @$ syntax as for bison to reference
-  the locations associated with the N-th rhs symbol and the lhs symbol,
-  respectively
-
-symtab.c
-- initialize fields added to 'struct bucket' for non-terminal symbol
-  inherited attributes
-
-verbose.c
-- for parse states with conflicts, the contents of the y.output file include
-  the trial shift and/or trial reduce actions
-- added output to the end of the verbose report showing the correspondance
-  between grammar symbol #, internal parser symbol #, and grammar symbol name
-- changed 'short' to 'Value_t' (in some instances, 'Value_t' was already
-  used for variables/parameters that were related to variables/parameters
-  declared as 'short'
-
-yacc.1
-- added options 'P', 'V', 'y' and '-o output_file' to the yacc command
-  synopsis (already covered in the description section)
-- added options 'B', 'D' and 'L' to the yacc command synopsis; added text in
-  the description section
-- added %locations description to the extensions section
diff --git a/contrib/byacc/NOTES-btyacc-Disposition b/contrib/byacc/NOTES-btyacc-Disposition
deleted file mode 100644
index 98e527bccab..00000000000
--- a/contrib/byacc/NOTES-btyacc-Disposition
+++ /dev/null
@@ -1,80 +0,0 @@
-Tom Shields, March 17, 2014
-
-NOTE: README.BTYACC needs to be re-written (or another README file created)
-to explain how the extensions were adopted into the byacc-20140101 baseline.
-
-bytacc changes adopted; see README.BTYACC for details.
-------------------------------------------------------
-
-    Changes to the skeleton to send debugging output to stderr.
-
-    Changes to the types of the grammar tables from 'short' to 'int' if
-MAXTABLE is defined to be > MAXSHORT for generation of large grammar tables
-for large grammars.  This can be set with the invocation of configure
-using the --with-max-table-size=N option
-
-    Changes to add syntactic sugaring for definition and semantic processing
-of inherited attributes associated with non-terminal symbols on the rhs of
-rules.  Inherited attributes are implemented as {}-actions, and as such may
-introduce reduce/reduce conflicts.  The advantage over manual {}-actions is
-that checking is performed on the number and types of inherited attributes,
-and the positions on the semantic stack are automatically calculated.
-Identical actions produced by the inherited attribute syntax are collapsed
-into a single action, reducing reduce/reduce conflicts.
-
-    The %type specification is extended to define the types of inherited
-attributes associated with non-terminal symbols on the lhs of rules, in
-addition to its original purpose in yacc for specifying the type of the
-symbol itself on the parser's value stack.  In order to permit the two
- aspects to be used independently, the  specification following
-%type is optional.
-
-    Added a mechanism to the parser skeleton for computing and propagating
-the text position of grammar symbols if %locations directive is present in
-the grammar specificaion, or if yacc is invoked with the -L flag. Includes
-support for "@$" and "@N" (for N an integer) in actions to refer to symbol
-locations.
-
-    Added a bison compatible %destructor directive to define a memory
-management mechanism to the parser skeleton that enables cleanup of semantic
-values and text positions associated with the parsing stack that are
-automatically discarded during error processing.
-
-The following is only available if configure is invoked with the
---enable-btyacc=yes:
-
-    Changes to enable backtracking with semantic disambiguation, if yacc is
-invoked with the -B flag.  A yacc parser disambiguates shift/reduce conflicts
-by choosing to shift, and reduce/reduce conflicts by reducing using the
-earliest grammar rule (in the grammar specification).  A btyacc parser handles
-a conflict by remembering the current parse point and entering into trial parse
-mode.  In trial parse mode, the parser tries each of the conflicting options
-until the first successs or until all options are exhausted.  If the parser
-runs into an error while in trial parse mode, it backtracks to the most recent
-conflict point and tries the next alternative.  If the parser finds a
-successful parse, it backtracks to the point where it first entered trial parse
-mode and continues with normal parsing, using the action at the start of the
-successful trial path.  Success in trial parse mode is achieved either by
-successfully reducing the start symbol at the end of input or by invocation of
-YYVALID (or YYVALID_NESTED).  Semantic disambiguation is supported within
-[]-actions, which are always executed, with invocation of YYERROR to terminate
-a trial path or YYVALID (and YYVALID_NESTED).  Yacc {}-actions are only
-executed during normal parsing.
-
-
-btyacc changes deferred:
-------------------------
-
-    The -S command line flag to enable use of an alternate parser skeleton,
-read from an external file.
-
-    Preprocessor statements: %define, %ifdef/%endif, %include.
-
-
-btyacc changes rejected:
-------------------------
-
-    The yyerror_detailed() option for error messages is replaced by the
-byacc feature for specifying options paramters to yyerror().
-
-    C++-specific features in the parser skeleton.
diff --git a/contrib/byacc/README.BTYACC b/contrib/byacc/README.BTYACC
index 705481f8268..e617ec2e78f 100644
--- a/contrib/byacc/README.BTYACC
+++ b/contrib/byacc/README.BTYACC
@@ -1,4 +1,4 @@
--- $Id: README.BTYACC,v 1.1 2014/03/25 19:21:31 Tom.Shields Exp $
+-- $Id: README.BTYACC,v 1.2 2014/04/22 08:18:57 Tom.Shields Exp $
 
 The original README from btyacc is below.
 
@@ -8,6 +8,20 @@ byacc baseline.
 The %include and %define/%ifdef enhancements described below are not currently
 incorporated.
 
+The position management functionality ("YYPOSN", "yyposn", "YYREDUCEPOSNFUNC",
+"YYREDUCEPOSNFUNCARG" & "YYCALLREDUCEPOSN") is replaced by a bison-compatible
+"%locations" implementation.
+
+The memory management functionality ("YYDELETEVAL" & "YYDELETEPOSN") is
+replaced by a bison-compatible "%destructor" implementation.
+
+The detailed syntax error processing functionality ("YYERROR_DETAILED"
+& "yyerror_detailed()") is subsumed by the bison-compatible "yyerror()"
+implementation, as modified by the %parse-param and %locations directives.
+
+The debugging macro "YYDBPR()" in the parser skeleton is renamed
+"YYSTYPE_TOSTRING()".
+
 -------------------------------------------------------------------------------
 	     BTYACC -- backtracking yacc
 	     ===========================
diff --git a/contrib/byacc/VERSION b/contrib/byacc/VERSION
index 59a4590ae28..088ee4dd931 100644
--- a/contrib/byacc/VERSION
+++ b/contrib/byacc/VERSION
@@ -1 +1 @@
-20140409
+20140715
diff --git a/contrib/byacc/aclocal.m4 b/contrib/byacc/aclocal.m4
index 5283b2e53cc..0df47aa1331 100644
--- a/contrib/byacc/aclocal.m4
+++ b/contrib/byacc/aclocal.m4
@@ -1,4 +1,4 @@
-dnl $Id: aclocal.m4,v 1.34 2014/04/06 19:16:18 tom Exp $
+dnl $Id: aclocal.m4,v 1.35 2014/07/15 19:38:05 tom Exp $
 dnl Macros for byacc configure script (Thomas E. Dickey)
 dnl ---------------------------------------------------------------------------
 dnl Copyright 2004-2013,2014 Thomas E. Dickey
@@ -28,7 +28,7 @@ dnl sale, use or other dealings in this Software without prior written
 dnl authorization.
 dnl ---------------------------------------------------------------------------
 dnl ---------------------------------------------------------------------------
-dnl CF_ACVERSION_CHECK version: 4 updated: 2013/03/04 19:52:56
+dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49
 dnl ------------------
 dnl Conditionally generate script according to whether we're using a given autoconf.
 dnl
@@ -37,7 +37,7 @@ dnl $2 = code to use if AC_ACVERSION is at least as high as $1.
 dnl $3 = code to use if AC_ACVERSION is older than $1.
 define([CF_ACVERSION_CHECK],
 [
-ifdef([AC_ACVERSION], ,[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])dnl
+ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl
 ifdef([m4_version_compare],
 [m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
 [CF_ACVERSION_COMPARE(
@@ -930,7 +930,7 @@ AC_PROG_AWK
 test -z "$AWK" && AC_MSG_ERROR(No awk program found)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PROG_CC version: 3 updated: 2012/10/06 15:31:55
+dnl CF_PROG_CC version: 4 updated: 2014/07/12 18:57:58
 dnl ----------
 dnl standard check for CC, plus followup sanity checks
 dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name
@@ -940,7 +940,7 @@ CF_GCC_VERSION
 CF_ACVERSION_CHECK(2.52,
 	[AC_PROG_CC_STDC],
 	[CF_ANSI_CC_REQD])
-CF_CC_ENV_FLAGS 
+CF_CC_ENV_FLAGS
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl CF_PROG_LINT version: 2 updated: 2009/08/12 04:43:14
diff --git a/contrib/byacc/config.guess b/contrib/byacc/config.guess
index 9afd6762064..1f5c50c0d15 100755
--- a/contrib/byacc/config.guess
+++ b/contrib/byacc/config.guess
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright 1992-2013 Free Software Foundation, Inc.
+#   Copyright 1992-2014 Free Software Foundation, Inc.
 
-timestamp='2013-11-29'
+timestamp='2014-03-23'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright 1992-2013 Free Software Foundation, Inc.
+Copyright 1992-2014 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -149,7 +149,7 @@ Linux|GNU|GNU/*)
 	LIBC=gnu
 	#endif
 	EOF
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
 	;;
 esac
 
@@ -826,7 +826,7 @@ EOF
     *:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit ;;
-    i*:MSYS*:*)
+    *:MSYS*:*)
 	echo ${UNAME_MACHINE}-pc-msys
 	exit ;;
     i*:windows32*:*)
@@ -969,10 +969,10 @@ EOF
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
 	;;
-    or1k:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+    openrisc*:Linux:*:*)
+	echo or1k-unknown-linux-${LIBC}
 	exit ;;
-    or32:Linux:*:*)
+    or32:Linux:*:* | or1k*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     padre:Linux:*:*)
@@ -1371,154 +1371,6 @@ EOF
 	exit ;;
 esac
 
-eval $set_cc_for_build
-cat >$dummy.c <
-# include 
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
-  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
-     I don't know....  */
-  printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include 
-  printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
-	"4"
-#else
-	""
-#endif
-	); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
-  printf ("arm-acorn-riscix\n"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
-  printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
-  int version;
-  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
-  if (version < 4)
-    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
-  else
-    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
-  exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
-  printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
-  printf ("ns32k-encore-mach\n"); exit (0);
-#else
-  printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
-  printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
-  printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
-  printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
-    struct utsname un;
-
-    uname(&un);
-
-    if (strncmp(un.version, "V2", 2) == 0) {
-	printf ("i386-sequent-ptx2\n"); exit (0);
-    }
-    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
-	printf ("i386-sequent-ptx1\n"); exit (0);
-    }
-    printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-#  include 
-#  if defined (BSD)
-#   if BSD == 43
-      printf ("vax-dec-bsd4.3\n"); exit (0);
-#   else
-#    if BSD == 199006
-      printf ("vax-dec-bsd4.3reno\n"); exit (0);
-#    else
-      printf ("vax-dec-bsd\n"); exit (0);
-#    endif
-#   endif
-#  else
-    printf ("vax-dec-bsd\n"); exit (0);
-#  endif
-# else
-    printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
-  printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
-  exit (1);
-}
-EOF
-
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
-	{ echo "$SYSTEM_NAME"; exit; }
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
-    case `getsysinfo -f cpu_type` in
-    c1*)
-	echo c1-convex-bsd
-	exit ;;
-    c2*)
-	if getsysinfo -f scalar_acc
-	then echo c32-convex-bsd
-	else echo c2-convex-bsd
-	fi
-	exit ;;
-    c34*)
-	echo c34-convex-bsd
-	exit ;;
-    c38*)
-	echo c38-convex-bsd
-	exit ;;
-    c4*)
-	echo c4-convex-bsd
-	exit ;;
-    esac
-fi
-
 cat >&2 <."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright 1992-2013 Free Software Foundation, Inc.
+Copyright 1992-2014 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -296,8 +296,7 @@ case $basic_machine in
 	| nds32 | nds32le | nds32be \
 	| nios | nios2 | nios2eb | nios2el \
 	| ns16k | ns32k \
-	| open8 \
-	| or1k | or32 \
+	| open8 | or1k | or1knd | or32 \
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle \
 	| pyramid \
@@ -415,6 +414,7 @@ case $basic_machine in
 	| nios-* | nios2-* | nios2eb-* | nios2el-* \
 	| none-* | np1-* | ns16k-* | ns32k-* \
 	| open8-* \
+	| or1k*-* \
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
@@ -1376,7 +1376,7 @@ case $os in
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1594,9 +1594,6 @@ case $basic_machine in
 	mips*-*)
 		os=-elf
 		;;
-	or1k-*)
-		os=-elf
-		;;
 	or32-*)
 		os=-coff
 		;;
diff --git a/contrib/byacc/config_h.in b/contrib/byacc/config_h.in
index 6d47167602a..c7d6d910857 100644
--- a/contrib/byacc/config_h.in
+++ b/contrib/byacc/config_h.in
@@ -30,6 +30,9 @@
 /* Define to 1 if mkstemp() is available and working. */
 #undef HAVE_MKSTEMP
 
+/* Define to 1 if vsnprintf() is available and working. */
+#undef HAVE_VSNPRINTF
+
 /* Define to maximum table size (default: 32500) */
 #undef MAXTABLE
 
diff --git a/contrib/byacc/configure b/contrib/byacc/configure
index 361ee7e222f..d2b654f065b 100755
--- a/contrib/byacc/configure
+++ b/contrib/byacc/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 1.18 .
+# From configure.in Revision: 1.19 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by Autoconf 2.52.20121002.
 #
@@ -3930,7 +3930,76 @@ EOF
 
 fi
 
-echo "$as_me:3933: checking for maximum table size" >&5
+for ac_func in vsnprintf
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:3936: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 3942 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.  */
+#include 
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+int
+main ()
+{
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:3973: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:3976: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:3979: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:3982: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:3992: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <&5
 echo $ECHO_N "checking for maximum table size... $ECHO_C" >&6
 
 # Check whether --with-max-table-size or --without-max-table-size was given.
@@ -3940,12 +4009,12 @@ if test "${with_max_table_size+set}" = set; then
 fi;
 if test -n "$with_max_table_size"
 then
-	echo "$as_me:3943: result: $with_max_table_size" >&5
+	echo "$as_me:4012: result: $with_max_table_size" >&5
 echo "${ECHO_T}$with_max_table_size" >&6
 	check=`expr "$with_max_table_size" + 0`
 	if test "x$check" != "x$with_max_table_size"
 	then
-		{ { echo "$as_me:3948: error: invalid value for --with-max-table-size: $with_max_table_size" >&5
+		{ { echo "$as_me:4017: error: invalid value for --with-max-table-size: $with_max_table_size" >&5
 echo "$as_me: error: invalid value for --with-max-table-size: $with_max_table_size" >&2;}
    { (exit 1); exit 1; }; }
 	fi
@@ -3955,11 +4024,11 @@ cat >>confdefs.h <&5
+	echo "$as_me:4027: result: default" >&5
 echo "${ECHO_T}default" >&6
 fi
 
-echo "$as_me:3962: checking if backtracking extension is wanted" >&5
+echo "$as_me:4031: checking if backtracking extension is wanted" >&5
 echo $ECHO_N "checking if backtracking extension is wanted... $ECHO_C" >&6
 
 # Check whether --enable-btyacc or --disable-btyacc was given.
@@ -3967,7 +4036,7 @@ if test "${enable_btyacc+set}" = set; then
   enableval="$enable_btyacc"
 
 fi;
-echo "$as_me:3970: result: $enable_btyacc" >&5
+echo "$as_me:4039: result: $enable_btyacc" >&5
 echo "${ECHO_T}$enable_btyacc" >&6
 if test "$enable_btyacc" = "yes"; then
 
@@ -3982,7 +4051,7 @@ fi
 
 if ( test "$GCC" = yes || test "$GXX" = yes )
 then
-echo "$as_me:3985: checking if you want to check for gcc warnings" >&5
+echo "$as_me:4054: checking if you want to check for gcc warnings" >&5
 echo $ECHO_N "checking if you want to check for gcc warnings... $ECHO_C" >&6
 
 # Check whether --with-warnings or --without-warnings was given.
@@ -3992,7 +4061,7 @@ if test "${with_warnings+set}" = set; then
 else
   cf_opt_with_warnings=no
 fi;
-echo "$as_me:3995: result: $cf_opt_with_warnings" >&5
+echo "$as_me:4064: result: $cf_opt_with_warnings" >&5
 echo "${ECHO_T}$cf_opt_with_warnings" >&6
 if test "$cf_opt_with_warnings" != no ; then
 
@@ -4014,10 +4083,10 @@ cat > conftest.i <&5
+	{ echo "$as_me:4086: checking for $CC __attribute__ directives..." >&5
 echo "$as_me: checking for $CC __attribute__ directives..." >&6;}
 cat > conftest.$ac_ext <&5
+		if { (eval echo "$as_me:4138: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:4072: \$? = $ac_status" >&5
+  echo "$as_me:4141: \$? = $ac_status" >&5
   (exit $ac_status); }; then
-			test -n "$verbose" && echo "$as_me:4074: result: ... $cf_attribute" >&5
+			test -n "$verbose" && echo "$as_me:4143: result: ... $cf_attribute" >&5
 echo "${ECHO_T}... $cf_attribute" >&6
 			cat conftest.h >>confdefs.h
 			case $cf_attribute in #(vi
@@ -4135,12 +4204,12 @@ INTEL_COMPILER=no
 if test "$GCC" = yes ; then
 	case $host_os in
 	linux*|gnu*)
-		echo "$as_me:4138: checking if this is really Intel C compiler" >&5
+		echo "$as_me:4207: checking if this is really Intel C compiler" >&5
 echo $ECHO_N "checking if this is really Intel C compiler... $ECHO_C" >&6
 		cf_save_CFLAGS="$CFLAGS"
 		CFLAGS="$CFLAGS -no-gcc"
 		cat >conftest.$ac_ext <<_ACEOF
-#line 4143 "configure"
+#line 4212 "configure"
 #include "confdefs.h"
 
 int
@@ -4157,16 +4226,16 @@ make an error
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:4160: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:4229: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:4163: \$? = $ac_status" >&5
+  echo "$as_me:4232: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:4166: \"$ac_try\"") >&5
+  { (eval echo "$as_me:4235: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4169: \$? = $ac_status" >&5
+  echo "$as_me:4238: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   INTEL_COMPILER=yes
 cf_save_CFLAGS="$cf_save_CFLAGS -we147"
@@ -4177,7 +4246,7 @@ cat conftest.$ac_ext >&5
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 		CFLAGS="$cf_save_CFLAGS"
-		echo "$as_me:4180: result: $INTEL_COMPILER" >&5
+		echo "$as_me:4249: result: $INTEL_COMPILER" >&5
 echo "${ECHO_T}$INTEL_COMPILER" >&6
 		;;
 	esac
@@ -4186,12 +4255,12 @@ fi
 CLANG_COMPILER=no
 
 if test "$GCC" = yes ; then
-	echo "$as_me:4189: checking if this is really Clang C compiler" >&5
+	echo "$as_me:4258: checking if this is really Clang C compiler" >&5
 echo $ECHO_N "checking if this is really Clang C compiler... $ECHO_C" >&6
 	cf_save_CFLAGS="$CFLAGS"
 	CFLAGS="$CFLAGS -Qunused-arguments"
 	cat >conftest.$ac_ext <<_ACEOF
-#line 4194 "configure"
+#line 4263 "configure"
 #include "confdefs.h"
 
 int
@@ -4208,16 +4277,16 @@ make an error
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:4211: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:4280: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:4214: \$? = $ac_status" >&5
+  echo "$as_me:4283: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:4217: \"$ac_try\"") >&5
+  { (eval echo "$as_me:4286: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4220: \$? = $ac_status" >&5
+  echo "$as_me:4289: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   CLANG_COMPILER=yes
 cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
@@ -4228,12 +4297,12 @@ cat conftest.$ac_ext >&5
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 	CFLAGS="$cf_save_CFLAGS"
-	echo "$as_me:4231: result: $CLANG_COMPILER" >&5
+	echo "$as_me:4300: result: $CLANG_COMPILER" >&5
 echo "${ECHO_T}$CLANG_COMPILER" >&6
 fi
 
 cat > conftest.$ac_ext <&5
+	{ echo "$as_me:4322: checking for $CC warning options..." >&5
 echo "$as_me: checking for $CC warning options..." >&6;}
 	cf_save_CFLAGS="$CFLAGS"
 	EXTRA_CFLAGS="-Wall"
@@ -4266,12 +4335,12 @@ echo "$as_me: checking for $CC warning options..." >&6;}
 		wd981
 	do
 		CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
-		if { (eval echo "$as_me:4269: \"$ac_compile\"") >&5
+		if { (eval echo "$as_me:4338: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:4272: \$? = $ac_status" >&5
+  echo "$as_me:4341: \$? = $ac_status" >&5
   (exit $ac_status); }; then
-			test -n "$verbose" && echo "$as_me:4274: result: ... -$cf_opt" >&5
+			test -n "$verbose" && echo "$as_me:4343: result: ... -$cf_opt" >&5
 echo "${ECHO_T}... -$cf_opt" >&6
 			EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
 		fi
@@ -4280,7 +4349,7 @@ echo "${ECHO_T}... -$cf_opt" >&6
 
 elif test "$GCC" = yes
 then
-	{ echo "$as_me:4283: checking for $CC warning options..." >&5
+	{ echo "$as_me:4352: checking for $CC warning options..." >&5
 echo "$as_me: checking for $CC warning options..." >&6;}
 	cf_save_CFLAGS="$CFLAGS"
 	EXTRA_CFLAGS=
@@ -4304,12 +4373,12 @@ echo "$as_me: checking for $CC warning options..." >&6;}
 		Wundef $cf_gcc_warnings $cf_warn_CONST Wwrite-strings
 	do
 		CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
-		if { (eval echo "$as_me:4307: \"$ac_compile\"") >&5
+		if { (eval echo "$as_me:4376: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:4310: \$? = $ac_status" >&5
+  echo "$as_me:4379: \$? = $ac_status" >&5
   (exit $ac_status); }; then
-			test -n "$verbose" && echo "$as_me:4312: result: ... -$cf_opt" >&5
+			test -n "$verbose" && echo "$as_me:4381: result: ... -$cf_opt" >&5
 echo "${ECHO_T}... -$cf_opt" >&6
 			case $cf_opt in #(vi
 			Wcast-qual) #(vi
@@ -4320,7 +4389,7 @@ echo "${ECHO_T}... -$cf_opt" >&6
 				[34].*)
 					test -n "$verbose" && echo "	feature is broken in gcc $GCC_VERSION" 1>&6
 
-echo "${as_me:-configure}:4323: testing feature is broken in gcc $GCC_VERSION ..." 1>&5
+echo "${as_me:-configure}:4392: testing feature is broken in gcc $GCC_VERSION ..." 1>&5
 
 					continue;;
 				esac
@@ -4330,7 +4399,7 @@ echo "${as_me:-configure}:4323: testing feature is broken in gcc $GCC_VERSION ..
 				[12].*)
 					test -n "$verbose" && echo "	feature is broken in gcc $GCC_VERSION" 1>&6
 
-echo "${as_me:-configure}:4333: testing feature is broken in gcc $GCC_VERSION ..." 1>&5
+echo "${as_me:-configure}:4402: testing feature is broken in gcc $GCC_VERSION ..." 1>&5
 
 					continue;;
 				esac
@@ -4346,7 +4415,7 @@ rm -rf conftest*
 fi
 fi
 
-echo "$as_me:4349: checking if you want to see long compiling messages" >&5
+echo "$as_me:4418: checking if you want to see long compiling messages" >&5
 echo $ECHO_N "checking if you want to see long compiling messages... $ECHO_C" >&6
 
 # Check whether --enable-echo or --disable-echo was given.
@@ -4380,10 +4449,10 @@ else
     ECHO_CC=''
 
 fi;
-echo "$as_me:4383: result: $enableval" >&5
+echo "$as_me:4452: result: $enableval" >&5
 echo "${ECHO_T}$enableval" >&6
 
-echo "$as_me:4386: checking if you want to use dmalloc for testing" >&5
+echo "$as_me:4455: checking if you want to use dmalloc for testing" >&5
 echo $ECHO_N "checking if you want to use dmalloc for testing... $ECHO_C" >&6
 
 # Check whether --with-dmalloc or --without-dmalloc was given.
@@ -4400,7 +4469,7 @@ EOF
 else
   with_dmalloc=
 fi;
-echo "$as_me:4403: result: ${with_dmalloc:-no}" >&5
+echo "$as_me:4472: result: ${with_dmalloc:-no}" >&5
 echo "${ECHO_T}${with_dmalloc:-no}" >&6
 
 case .$with_cflags in #(vi
@@ -4494,23 +4563,23 @@ fi
 esac
 
 if test "$with_dmalloc" = yes ; then
-	echo "$as_me:4497: checking for dmalloc.h" >&5
+	echo "$as_me:4566: checking for dmalloc.h" >&5
 echo $ECHO_N "checking for dmalloc.h... $ECHO_C" >&6
 if test "${ac_cv_header_dmalloc_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 4503 "configure"
+#line 4572 "configure"
 #include "confdefs.h"
 #include 
 _ACEOF
-if { (eval echo "$as_me:4507: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:4576: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:4513: \$? = $ac_status" >&5
+  echo "$as_me:4582: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -4529,11 +4598,11 @@ else
 fi
 rm -f conftest.err conftest.$ac_ext
 fi
-echo "$as_me:4532: result: $ac_cv_header_dmalloc_h" >&5
+echo "$as_me:4601: result: $ac_cv_header_dmalloc_h" >&5
 echo "${ECHO_T}$ac_cv_header_dmalloc_h" >&6
 if test $ac_cv_header_dmalloc_h = yes; then
 
-echo "$as_me:4536: checking for dmalloc_debug in -ldmalloc" >&5
+echo "$as_me:4605: checking for dmalloc_debug in -ldmalloc" >&5
 echo $ECHO_N "checking for dmalloc_debug in -ldmalloc... $ECHO_C" >&6
 if test "${ac_cv_lib_dmalloc_dmalloc_debug+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -4541,7 +4610,7 @@ else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldmalloc  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 4544 "configure"
+#line 4613 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -4560,16 +4629,16 @@ dmalloc_debug ();
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:4563: \"$ac_link\"") >&5
+if { (eval echo "$as_me:4632: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:4566: \$? = $ac_status" >&5
+  echo "$as_me:4635: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:4569: \"$ac_try\"") >&5
+  { (eval echo "$as_me:4638: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4572: \$? = $ac_status" >&5
+  echo "$as_me:4641: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_dmalloc_dmalloc_debug=yes
 else
@@ -4580,7 +4649,7 @@ fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:4583: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5
+echo "$as_me:4652: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5
 echo "${ECHO_T}$ac_cv_lib_dmalloc_dmalloc_debug" >&6
 if test $ac_cv_lib_dmalloc_dmalloc_debug = yes; then
   cat >>confdefs.h <&5
+echo "$as_me:4667: checking if you want to use dbmalloc for testing" >&5
 echo $ECHO_N "checking if you want to use dbmalloc for testing... $ECHO_C" >&6
 
 # Check whether --with-dbmalloc or --without-dbmalloc was given.
@@ -4612,7 +4681,7 @@ EOF
 else
   with_dbmalloc=
 fi;
-echo "$as_me:4615: result: ${with_dbmalloc:-no}" >&5
+echo "$as_me:4684: result: ${with_dbmalloc:-no}" >&5
 echo "${ECHO_T}${with_dbmalloc:-no}" >&6
 
 case .$with_cflags in #(vi
@@ -4706,23 +4775,23 @@ fi
 esac
 
 if test "$with_dbmalloc" = yes ; then
-	echo "$as_me:4709: checking for dbmalloc.h" >&5
+	echo "$as_me:4778: checking for dbmalloc.h" >&5
 echo $ECHO_N "checking for dbmalloc.h... $ECHO_C" >&6
 if test "${ac_cv_header_dbmalloc_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 4715 "configure"
+#line 4784 "configure"
 #include "confdefs.h"
 #include 
 _ACEOF
-if { (eval echo "$as_me:4719: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:4788: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:4725: \$? = $ac_status" >&5
+  echo "$as_me:4794: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -4741,11 +4810,11 @@ else
 fi
 rm -f conftest.err conftest.$ac_ext
 fi
-echo "$as_me:4744: result: $ac_cv_header_dbmalloc_h" >&5
+echo "$as_me:4813: result: $ac_cv_header_dbmalloc_h" >&5
 echo "${ECHO_T}$ac_cv_header_dbmalloc_h" >&6
 if test $ac_cv_header_dbmalloc_h = yes; then
 
-echo "$as_me:4748: checking for debug_malloc in -ldbmalloc" >&5
+echo "$as_me:4817: checking for debug_malloc in -ldbmalloc" >&5
 echo $ECHO_N "checking for debug_malloc in -ldbmalloc... $ECHO_C" >&6
 if test "${ac_cv_lib_dbmalloc_debug_malloc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -4753,7 +4822,7 @@ else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldbmalloc  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 4756 "configure"
+#line 4825 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -4772,16 +4841,16 @@ debug_malloc ();
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:4775: \"$ac_link\"") >&5
+if { (eval echo "$as_me:4844: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:4778: \$? = $ac_status" >&5
+  echo "$as_me:4847: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:4781: \"$ac_try\"") >&5
+  { (eval echo "$as_me:4850: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4784: \$? = $ac_status" >&5
+  echo "$as_me:4853: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_dbmalloc_debug_malloc=yes
 else
@@ -4792,7 +4861,7 @@ fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:4795: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5
+echo "$as_me:4864: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5
 echo "${ECHO_T}$ac_cv_lib_dbmalloc_debug_malloc" >&6
 if test $ac_cv_lib_dbmalloc_debug_malloc = yes; then
   cat >>confdefs.h <&5
+echo "$as_me:4879: checking if you want to use valgrind for testing" >&5
 echo $ECHO_N "checking if you want to use valgrind for testing... $ECHO_C" >&6
 
 # Check whether --with-valgrind or --without-valgrind was given.
@@ -4824,7 +4893,7 @@ EOF
 else
   with_valgrind=
 fi;
-echo "$as_me:4827: result: ${with_valgrind:-no}" >&5
+echo "$as_me:4896: result: ${with_valgrind:-no}" >&5
 echo "${ECHO_T}${with_valgrind:-no}" >&6
 
 case .$with_cflags in #(vi
@@ -4917,7 +4986,7 @@ fi
 	;;
 esac
 
-echo "$as_me:4920: checking if you want to perform memory-leak testing" >&5
+echo "$as_me:4989: checking if you want to perform memory-leak testing" >&5
 echo $ECHO_N "checking if you want to perform memory-leak testing... $ECHO_C" >&6
 
 # Check whether --enable-leaks or --disable-leaks was given.
@@ -4927,7 +4996,7 @@ if test "${enable_leaks+set}" = set; then
 else
   : ${with_no_leaks:=no}
 fi;
-echo "$as_me:4930: result: $with_no_leaks" >&5
+echo "$as_me:4999: result: $with_no_leaks" >&5
 echo "${ECHO_T}$with_no_leaks" >&6
 
 if test "$with_no_leaks" = yes ; then
@@ -5023,7 +5092,7 @@ DEFS=-DHAVE_CONFIG_H
 : ${CONFIG_STATUS=./config.status}
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:5026: creating $CONFIG_STATUS" >&5
+{ echo "$as_me:5095: creating $CONFIG_STATUS" >&5
 echo "$as_me: creating $CONFIG_STATUS" >&6;}
 cat >$CONFIG_STATUS <<_ACEOF
 #! $SHELL
@@ -5196,7 +5265,7 @@ cat >>$CONFIG_STATUS <<\EOF
     echo "$ac_cs_version"; exit 0 ;;
   --he | --h)
     # Conflict between --help and --header
-    { { echo "$as_me:5199: error: ambiguous option: $1
+    { { echo "$as_me:5268: error: ambiguous option: $1
 Try \`$0 --help' for more information." >&5
 echo "$as_me: error: ambiguous option: $1
 Try \`$0 --help' for more information." >&2;}
@@ -5215,7 +5284,7 @@ Try \`$0 --help' for more information." >&2;}
     ac_need_defaults=false;;
 
   # This is an error.
-  -*) { { echo "$as_me:5218: error: unrecognized option: $1
+  -*) { { echo "$as_me:5287: error: unrecognized option: $1
 Try \`$0 --help' for more information." >&5
 echo "$as_me: error: unrecognized option: $1
 Try \`$0 --help' for more information." >&2;}
@@ -5252,7 +5321,7 @@ do
   # Handling of arguments.
   "makefile" ) CONFIG_FILES="$CONFIG_FILES makefile" ;;
   "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config_h.in" ;;
-  *) { { echo "$as_me:5255: error: invalid argument: $ac_config_target" >&5
+  *) { { echo "$as_me:5324: error: invalid argument: $ac_config_target" >&5
 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
    { (exit 1); exit 1; }; };;
   esac
@@ -5487,7 +5556,7 @@ done; }
   esac
 
   if test x"$ac_file" != x-; then
-    { echo "$as_me:5490: creating $ac_file" >&5
+    { echo "$as_me:5559: creating $ac_file" >&5
 echo "$as_me: creating $ac_file" >&6;}
     rm -f "$ac_file"
   fi
@@ -5505,7 +5574,7 @@ echo "$as_me: creating $ac_file" >&6;}
       -) echo $tmp/stdin ;;
       [\\/$]*)
          # Absolute (can't be DOS-style, as IFS=:)
-         test -f "$f" || { { echo "$as_me:5508: error: cannot find input file: $f" >&5
+         test -f "$f" || { { echo "$as_me:5577: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          echo $f;;
@@ -5518,7 +5587,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;}
            echo $srcdir/$f
          else
            # /dev/null tree
-           { { echo "$as_me:5521: error: cannot find input file: $f" >&5
+           { { echo "$as_me:5590: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          fi;;
@@ -5534,7 +5603,7 @@ cat >>$CONFIG_STATUS <<\EOF
       if test -n "$ac_seen"; then
         ac_used=`grep '@datarootdir@' $ac_item`
         if test -z "$ac_used"; then
-          { echo "$as_me:5537: WARNING: datarootdir was used implicitly but not set:
+          { echo "$as_me:5606: WARNING: datarootdir was used implicitly but not set:
 $ac_seen" >&5
 echo "$as_me: WARNING: datarootdir was used implicitly but not set:
 $ac_seen" >&2;}
@@ -5543,7 +5612,7 @@ $ac_seen" >&2;}
       fi
       ac_seen=`grep '${datarootdir}' $ac_item`
       if test -n "$ac_seen"; then
-        { echo "$as_me:5546: WARNING: datarootdir was used explicitly but not set:
+        { echo "$as_me:5615: WARNING: datarootdir was used explicitly but not set:
 $ac_seen" >&5
 echo "$as_me: WARNING: datarootdir was used explicitly but not set:
 $ac_seen" >&2;}
@@ -5580,7 +5649,7 @@ s,@INSTALL@,$ac_INSTALL,;t t
             ac_init=`egrep '[ 	]*'$ac_name'[ 	]*=' $ac_file`
             if test -z "$ac_init"; then
               ac_seen=`echo "$ac_seen" |sed -e 's,^,'$ac_file':,'`
-              { echo "$as_me:5583: WARNING: Variable $ac_name is used but was not set:
+              { echo "$as_me:5652: WARNING: Variable $ac_name is used but was not set:
 $ac_seen" >&5
 echo "$as_me: WARNING: Variable $ac_name is used but was not set:
 $ac_seen" >&2;}
@@ -5591,7 +5660,7 @@ $ac_seen" >&2;}
     egrep -n '@[A-Z_][A-Z_0-9]+@' $ac_file >>$tmp/out
     if test -s $tmp/out; then
       ac_seen=`sed -e 's,^,'$ac_file':,' < $tmp/out`
-      { echo "$as_me:5594: WARNING: Some variables may not be substituted:
+      { echo "$as_me:5663: WARNING: Some variables may not be substituted:
 $ac_seen" >&5
 echo "$as_me: WARNING: Some variables may not be substituted:
 $ac_seen" >&2;}
@@ -5640,7 +5709,7 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
   * )   ac_file_in=$ac_file.in ;;
   esac
 
-  test x"$ac_file" != x- && { echo "$as_me:5643: creating $ac_file" >&5
+  test x"$ac_file" != x- && { echo "$as_me:5712: creating $ac_file" >&5
 echo "$as_me: creating $ac_file" >&6;}
 
   # First look for the input files in the build tree, otherwise in the
@@ -5651,7 +5720,7 @@ echo "$as_me: creating $ac_file" >&6;}
       -) echo $tmp/stdin ;;
       [\\/$]*)
          # Absolute (can't be DOS-style, as IFS=:)
-         test -f "$f" || { { echo "$as_me:5654: error: cannot find input file: $f" >&5
+         test -f "$f" || { { echo "$as_me:5723: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          echo $f;;
@@ -5664,7 +5733,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;}
            echo $srcdir/$f
          else
            # /dev/null tree
-           { { echo "$as_me:5667: error: cannot find input file: $f" >&5
+           { { echo "$as_me:5736: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          fi;;
@@ -5782,7 +5851,7 @@ cat >>$CONFIG_STATUS <<\EOF
   rm -f $tmp/in
   if test x"$ac_file" != x-; then
     if cmp -s $ac_file $tmp/config.h 2>/dev/null; then
-      { echo "$as_me:5785: $ac_file is unchanged" >&5
+      { echo "$as_me:5854: $ac_file is unchanged" >&5
 echo "$as_me: $ac_file is unchanged" >&6;}
     else
       ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
diff --git a/contrib/byacc/configure.in b/contrib/byacc/configure.in
index 0cd7a1996de..92afc35e22b 100644
--- a/contrib/byacc/configure.in
+++ b/contrib/byacc/configure.in
@@ -1,7 +1,7 @@
 dnl Process this file with 'autoconf' to produce a 'configure' script
-dnl $Id: configure.in,v 1.18 2014/04/06 19:11:51 tom Exp $
+dnl $Id: configure.in,v 1.19 2014/04/22 22:56:51 tom Exp $
 AC_PREREQ(2.52.20011201)
-AC_REVISION($Revision: 1.18 $)
+AC_REVISION($Revision: 1.19 $)
 AC_INIT(main.c)
 AC_CONFIG_HEADER(config.h:config_h.in)
 
@@ -18,6 +18,7 @@ CF_PROG_LINT
 CF_XOPEN_SOURCE
 AC_CHECK_HEADERS(fcntl.h)
 CF_MKSTEMP
+AC_HAVE_FUNCS(vsnprintf)
 
 AC_MSG_CHECKING(for maximum table size)
 AC_ARG_WITH([max-table-size],
diff --git a/contrib/byacc/defs.h b/contrib/byacc/defs.h
index 9af3a82a625..58ebc8d66dc 100644
--- a/contrib/byacc/defs.h
+++ b/contrib/byacc/defs.h
@@ -1,4 +1,4 @@
-/* $Id: defs.h,v 1.47 2014/04/09 21:23:45 Rick.Spates Exp $ */
+/* $Id: defs.h,v 1.49 2014/04/22 23:34:34 tom Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include 
@@ -409,6 +409,10 @@ extern param *parse_param;
 #endif
 #endif
 
+#ifndef GCC_PRINTFLIKE
+#define GCC_PRINTFLIKE(fmt,var) /*nothing*/
+#endif
+
 /* closure.c */
 extern void closure(Value_t * nucleus, int n);
 extern void finalize_closure(void);
@@ -488,7 +492,7 @@ struct mstring
     char *base, *ptr, *end;
 };
 
-extern void msprintf(struct mstring *, const char *, ...);
+extern void msprintf(struct mstring *, const char *, ...) GCC_PRINTFLIKE(2,3);
 extern int mputchar(struct mstring *, int);
 extern struct mstring *msnew(void);
 extern char *msdone(struct mstring *);
@@ -535,5 +539,6 @@ extern void lr0_leaks(void);
 extern void lalr_leaks(void);
 extern void mkpar_leaks(void);
 extern void output_leaks(void);
+extern void mstring_leaks(void);
 extern void reader_leaks(void);
 #endif
diff --git a/contrib/byacc/main.c b/contrib/byacc/main.c
index a7df9d69d7d..5de92358a05 100644
--- a/contrib/byacc/main.c
+++ b/contrib/byacc/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.49 2014/04/09 21:25:20 Rick.Spates Exp $ */
+/* $Id: main.c,v 1.51 2014/05/28 02:01:55 Tom.Shields Exp $ */
 
 #include 
 #ifndef _WIN32
@@ -166,6 +166,7 @@ done(int k)
     lr0_leaks();
     lalr_leaks();
     mkpar_leaks();
+    mstring_leaks();
     output_leaks();
     reader_leaks();
 #endif
@@ -207,7 +208,6 @@ usage(void)
 	,"  -b file_prefix        set filename prefix (default \"y.\")"
 	,"  -B                    create a backtracking parser"
 	,"  -d                    write definitions (" DEFINES_SUFFIX ")"
-	,"  -D                    enable value stack memory reclamation"
 	,"  -i                    write interface (y.tab.i)"
 	,"  -g                    write a graphical description"
 	,"  -l                    suppress #line directives"
diff --git a/contrib/byacc/mstring.c b/contrib/byacc/mstring.c
index d3d1f834e4b..dc384e5a385 100644
--- a/contrib/byacc/mstring.c
+++ b/contrib/byacc/mstring.c
@@ -1,4 +1,4 @@
-/* $Id: mstring.c,v 1.3 2014/04/08 20:37:26 tom Exp $ */
+/* $Id: mstring.c,v 1.6 2014/04/22 23:36:31 tom Exp $ */
 
 #include 
 #include 
@@ -13,39 +13,82 @@
 #define TAIL	8
 
 #if defined(YYBTYACC)
+
+static char *buf_ptr;
+static size_t buf_len;
+
 void
 msprintf(struct mstring *s, const char *fmt,...)
 {
-    static char buf[4096];	/* a big static buffer */
     va_list args;
     size_t len;
+#ifdef HAVE_VSNPRINTF
+    int changed;
+#endif
 
     if (!s || !s->base)
 	return;
-    va_start(args, fmt);
-    vsprintf(buf, fmt, args);
-    va_end(args);
 
-    len = strlen(buf);
+    if (buf_len == 0)
+    {
+	buf_ptr = malloc(buf_len = 4096);
+    }
+    if (buf_ptr == 0)
+    {
+	return;
+    }
+
+#ifdef HAVE_VSNPRINTF
+    do
+    {
+	va_start(args, fmt);
+	len = (size_t) vsnprintf(buf_ptr, buf_len, fmt, args);
+	va_end(args);
+	if ((changed = (len > buf_len)) != 0)
+	{
+	    char *new_ptr = realloc(buf_ptr, (buf_len * 3) / 2);
+	    if (new_ptr == 0)
+	    {
+		free(buf_ptr);
+		buf_ptr = 0;
+		return;
+	    }
+	    buf_ptr = new_ptr;
+	}
+    }
+    while (changed);
+#else
+    va_start(args, fmt);
+    len = (size_t) vsprintf(buf_ptr, fmt, args);
+    va_end(args);
+    if (len >= buf_len)
+	return;
+#endif
+
     if (len > (size_t) (s->end - s->ptr))
     {
+	char *new_base;
 	size_t cp = (size_t) (s->ptr - s->base);
 	size_t cl = (size_t) (s->end - s->base);
 	size_t nl = cl;
 	while (len > (nl - cp))
 	    nl = nl + nl + TAIL;
-	if ((s->base = realloc(s->base, nl)))
+	if ((new_base = realloc(s->base, nl)))
 	{
+	    s->base = new_base;
 	    s->ptr = s->base + cp;
 	    s->end = s->base + nl;
 	}
 	else
 	{
-	    s->ptr = s->end = 0;
+	    free(s->base);
+	    s->base = 0;
+	    s->ptr = 0;
+	    s->end = 0;
 	    return;
 	}
     }
-    memcpy(s->ptr, buf, len);
+    memcpy(s->ptr, buf_ptr, len);
     s->ptr += len;
 }
 #endif
@@ -76,11 +119,11 @@ mputchar(struct mstring *s, int ch)
 struct mstring *
 msnew(void)
 {
-    struct mstring *n = malloc(sizeof(struct mstring));
+    struct mstring *n = TMALLOC(struct mstring, 1);
 
     if (n)
     {
-	if ((n->base = n->ptr = malloc(HEAD)) != 0)
+	if ((n->base = n->ptr = MALLOC(HEAD)) != 0)
 	{
 	    n->end = n->base + HEAD;
 	}
@@ -150,3 +193,15 @@ strnshash(const char *s)
     return h;
 }
 #endif
+
+#ifdef NO_LEAKS
+void
+mstring_leaks(void)
+{
+#if defined(YYBTYACC)
+    free(buf_ptr);
+    buf_ptr = 0;
+    buf_len = 0;
+#endif
+}
+#endif
diff --git a/contrib/byacc/output.c b/contrib/byacc/output.c
index c7b7a5546e0..eb4402d3cd5 100644
--- a/contrib/byacc/output.c
+++ b/contrib/byacc/output.c
@@ -1,4 +1,4 @@
-/* $Id: output.c,v 1.65 2014/04/09 21:10:48 tom Exp $ */
+/* $Id: output.c,v 1.67 2014/04/22 23:16:57 tom Exp $ */
 
 #include "defs.h"
 
@@ -315,9 +315,9 @@ output_accessing_symbols(void)
 }
 
 static Value_t
-find_conflict_base(Value_t cbase)
+find_conflict_base(int cbase)
 {
-    Value_t i, j;
+    int i, j;
 
     for (i = 0; i < cbase; i++)
     {
@@ -327,9 +327,9 @@ find_conflict_base(Value_t cbase)
 		break;
 	}
 	if (j + cbase >= nconflicts)
-	    return i;
+	    break;
     }
-    return cbase;
+    return (Value_t) i;
 }
 #endif
 
diff --git a/contrib/byacc/package/byacc.spec b/contrib/byacc/package/byacc.spec
index d4116cb62bf..b2ac30eefa2 100644
--- a/contrib/byacc/package/byacc.spec
+++ b/contrib/byacc/package/byacc.spec
@@ -1,8 +1,8 @@
 Summary: byacc - public domain Berkeley LALR Yacc parser generator
 %define AppProgram byacc
-%define AppVersion 20140409
+%define AppVersion 20140715
 %define UseProgram yacc
-# $XTermId: byacc.spec,v 1.19 2014/04/09 19:53:59 tom Exp $
+# $XTermId: byacc.spec,v 1.22 2014/07/15 19:36:54 tom Exp $
 Name: %{AppProgram}
 Version: %{AppVersion}
 Release: 1
diff --git a/contrib/byacc/package/debian/changelog b/contrib/byacc/package/debian/changelog
index c96c6933512..33f31faa627 100644
--- a/contrib/byacc/package/debian/changelog
+++ b/contrib/byacc/package/debian/changelog
@@ -1,3 +1,21 @@
+byacc (20140715) unstable; urgency=low
+
+  * maintenance updates
+
+ -- Thomas E. Dickey   Tue, 15 Jul 2014 15:36:54 -0400
+
+byacc (20140527) unstable; urgency=low
+
+  * remove obsolete option from usage message
+
+ -- Thomas E. Dickey   Tue, 27 May 2014 22:01:55 -0400
+
+byacc (20140422) unstable; urgency=low
+
+  * maintenance updates
+
+ -- Thomas E. Dickey   Tue, 22 Apr 2014 04:13:20 -0400
+
 byacc (20140409) unstable; urgency=low
 
   * integrate Tom Shield's btyacc-related changes
diff --git a/contrib/byacc/package/mingw-byacc.spec b/contrib/byacc/package/mingw-byacc.spec
index 30813be195d..24230cb5b61 100644
--- a/contrib/byacc/package/mingw-byacc.spec
+++ b/contrib/byacc/package/mingw-byacc.spec
@@ -1,8 +1,8 @@
 Summary: byacc - public domain Berkeley LALR Yacc parser generator
 %define AppProgram byacc
-%define AppVersion 20140409
+%define AppVersion 20140715
 %define UseProgram yacc
-# $XTermId: mingw-byacc.spec,v 1.2 2014/04/09 19:53:59 tom Exp $
+# $XTermId: mingw-byacc.spec,v 1.4 2014/07/15 19:36:54 tom Exp $
 Name: %{AppProgram}
 Version: %{AppVersion}
 Release: 1
diff --git a/contrib/byacc/package/pkgsrc/Makefile b/contrib/byacc/package/pkgsrc/Makefile
index e1947dc8710..750137a6472 100644
--- a/contrib/byacc/package/pkgsrc/Makefile
+++ b/contrib/byacc/package/pkgsrc/Makefile
@@ -1,7 +1,7 @@
 # $NetBSD: Makefile,v 1.9 2008/07/24 17:13:00 tonnerre Exp $
 #
 
-DISTNAME=	byacc-20140409
+DISTNAME=	byacc-20140715
 PKGREVISION=	1
 CATEGORIES=	devel
 MASTER_SITES=	ftp://invisible-island.net/byacc/
diff --git a/contrib/byacc/test/btyacc/big_b.output b/contrib/byacc/test/btyacc/big_b.output
index 28e455543be..112b7c7a41c 100644
--- a/contrib/byacc/test/btyacc/big_b.output
+++ b/contrib/byacc/test/btyacc/big_b.output
@@ -4,7 +4,6 @@ Options:
   -b file_prefix        set filename prefix (default "y.")
   -B                    create a backtracking parser
   -d                    write definitions (.tab.h)
-  -D                    enable value stack memory reclamation
   -i                    write interface (y.tab.i)
   -g                    write a graphical description
   -l                    suppress #line directives
diff --git a/contrib/byacc/test/btyacc/big_l.output b/contrib/byacc/test/btyacc/big_l.output
index 28e455543be..112b7c7a41c 100644
--- a/contrib/byacc/test/btyacc/big_l.output
+++ b/contrib/byacc/test/btyacc/big_l.output
@@ -4,7 +4,6 @@ Options:
   -b file_prefix        set filename prefix (default "y.")
   -B                    create a backtracking parser
   -d                    write definitions (.tab.h)
-  -D                    enable value stack memory reclamation
   -i                    write interface (y.tab.i)
   -g                    write a graphical description
   -l                    suppress #line directives
diff --git a/contrib/byacc/test/btyacc/err_inherit1.error b/contrib/byacc/test/btyacc/err_inherit1.error
index 1d662b64948..203b9063e90 100644
--- a/contrib/byacc/test/btyacc/err_inherit1.error
+++ b/contrib/byacc/test/btyacc/err_inherit1.error
@@ -1,3 +1,3 @@
-YACC: e - line 64 of "./test/err_inherit1.y", unterminated argument list
+YACC: e - line 64 of "./err_inherit1.y", unterminated argument list
 namelist($c, $t
         ^
diff --git a/contrib/byacc/test/btyacc/err_inherit2.error b/contrib/byacc/test/btyacc/err_inherit2.error
index a3fa54a4ff7..c016b63f179 100644
--- a/contrib/byacc/test/btyacc/err_inherit2.error
+++ b/contrib/byacc/test/btyacc/err_inherit2.error
@@ -1,5 +1,5 @@
-YACC: w - line 64 of "./test/err_inherit2.y", number of arguments of namelist doesn't agree with previous declaration
-YACC: w - line 64 of "./test/err_inherit2.y", type of argument 1 to namelist doesn't agree with previous declaration
-YACC: e - line 64 of "./test/err_inherit2.y", bad formal argument list
+YACC: w - line 64 of "./err_inherit2.y", number of arguments of namelist doesn't agree with previous declaration
+YACC: w - line 64 of "./err_inherit2.y", type of argument 1 to namelist doesn't agree with previous declaration
+YACC: e - line 64 of "./err_inherit2.y", bad formal argument list
 namelist($c, $t, extra): namelist NAME
                              ^
diff --git a/contrib/byacc/test/btyacc/err_inherit3.error b/contrib/byacc/test/btyacc/err_inherit3.error
index 6e27dd0504c..e0ab28a9179 100644
--- a/contrib/byacc/test/btyacc/err_inherit3.error
+++ b/contrib/byacc/test/btyacc/err_inherit3.error
@@ -1,23 +1,23 @@
-YACC: w - line 64 of "./test/err_inherit3.y", number of arguments of namelist doesn't agree with previous declaration
-YACC: w - line 64 of "./test/err_inherit3.y", wrong number of arguments for namelist
+YACC: w - line 64 of "./err_inherit3.y", number of arguments of namelist doesn't agree with previous declaration
+YACC: w - line 64 of "./err_inherit3.y", wrong number of arguments for namelist
 namelist: namelist($c) NAME
                        ^
-YACC: w - line 64 of "./test/err_inherit3.y", unknown argument $c
-YACC: w - line 64 of "./test/err_inherit3.y", untyped argument $c
-YACC: w - line 65 of "./test/err_inherit3.y", unknown argument $t
+YACC: w - line 64 of "./err_inherit3.y", unknown argument $c
+YACC: w - line 64 of "./err_inherit3.y", untyped argument $c
+YACC: w - line 65 of "./err_inherit3.y", unknown argument $t
 	    { $$->s = mksymbol($t, $c, $2);
 	                       ^
-YACC: w - line 65 of "./test/err_inherit3.y", unknown argument $c
+YACC: w - line 65 of "./err_inherit3.y", unknown argument $c
 	    { $$->s = mksymbol($t, $c, $2);
 	                                 ^
-YACC: w - line 69 of "./test/err_inherit3.y", unknown argument $t
+YACC: w - line 69 of "./err_inherit3.y", unknown argument $t
 	    { $$->s = mksymbol($t, $c, $1);
 	                         ^
-YACC: w - line 69 of "./test/err_inherit3.y", untyped argument $t
-YACC: w - line 69 of "./test/err_inherit3.y", unknown argument $c
+YACC: w - line 69 of "./err_inherit3.y", untyped argument $t
+YACC: w - line 69 of "./err_inherit3.y", unknown argument $c
 	    { $$->s = mksymbol($t, $c, $1);
 	                             ^
-YACC: w - line 69 of "./test/err_inherit3.y", untyped argument $c
-YACC: w - line 0 of "./test/err_inherit3.y", start symbol declaration requires arguments
+YACC: w - line 69 of "./err_inherit3.y", untyped argument $c
+YACC: w - line 0 of "./err_inherit3.y", start symbol declaration requires arguments
 YACC: 1 rule never reduced
 YACC: 3 shift/reduce conflicts.
diff --git a/contrib/byacc/test/btyacc/err_inherit4.error b/contrib/byacc/test/btyacc/err_inherit4.error
index 00eb9890a53..20aa216ba23 100644
--- a/contrib/byacc/test/btyacc/err_inherit4.error
+++ b/contrib/byacc/test/btyacc/err_inherit4.error
@@ -1,13 +1,13 @@
-YACC: w - line 32 of "./test/err_inherit4.y", destructor redeclared
+YACC: w - line 32 of "./err_inherit4.y", destructor redeclared
 %destructor	{
            	^
-YACC: w - line 77 of "./test/err_inherit4.y", wrong number of default arguments for namelist
+YACC: w - line 77 of "./err_inherit4.y", wrong number of default arguments for namelist
 	{ $$ = $1; @$ = @2; }
 	^
-YACC: w - line 77 of "./test/err_inherit4.y", wrong type for default argument 2 to namelist
+YACC: w - line 77 of "./err_inherit4.y", wrong type for default argument 2 to namelist
 	{ $$ = $1; @$ = @2; }
 	^
-YACC: w - line 77 of "./test/err_inherit4.y", wrong type for default argument 1 to namelist
+YACC: w - line 77 of "./err_inherit4.y", wrong type for default argument 1 to namelist
 	{ $$ = $1; @$ = @2; }
 	^
-YACC: w - line 77 of "./test/err_inherit4.y", @2 references beyond the end of the current rule
+YACC: w - line 77 of "./err_inherit4.y", @2 references beyond the end of the current rule
diff --git a/contrib/byacc/test/btyacc/err_inherit5.error b/contrib/byacc/test/btyacc/err_inherit5.error
index edc58c984c5..ceabc34591b 100644
--- a/contrib/byacc/test/btyacc/err_inherit5.error
+++ b/contrib/byacc/test/btyacc/err_inherit5.error
@@ -1 +1 @@
-YACC: e - line 74 of "./test/err_inherit5.y", illegal @$ or @N reference
+YACC: e - line 74 of "./err_inherit5.y", illegal @$ or @N reference
diff --git a/contrib/byacc/test/btyacc/err_syntax1.error b/contrib/byacc/test/btyacc/err_syntax1.error
index e3a341d4ee3..5df5c22ef17 100644
--- a/contrib/byacc/test/btyacc/err_syntax1.error
+++ b/contrib/byacc/test/btyacc/err_syntax1.error
@@ -1,3 +1,3 @@
-YACC: e - line 1 of "./test/err_syntax1.y", syntax error
+YACC: e - line 1 of "./err_syntax1.y", syntax error
 	?%	{
 	^
diff --git a/contrib/byacc/test/btyacc/err_syntax10.error b/contrib/byacc/test/btyacc/err_syntax10.error
index ceb876ec603..61a72c0408a 100644
--- a/contrib/byacc/test/btyacc/err_syntax10.error
+++ b/contrib/byacc/test/btyacc/err_syntax10.error
@@ -1,3 +1,3 @@
-YACC: w - line 7 of "./test/err_syntax10.y", the type of '(' has been redeclared
-YACC: w - line 7 of "./test/err_syntax10.y", the type of '*' has been redeclared
-YACC: w - line 7 of "./test/err_syntax10.y", the type of '&' has been redeclared
+YACC: w - line 7 of "./err_syntax10.y", the type of '(' has been redeclared
+YACC: w - line 7 of "./err_syntax10.y", the type of '*' has been redeclared
+YACC: w - line 7 of "./err_syntax10.y", the type of '&' has been redeclared
diff --git a/contrib/byacc/test/btyacc/err_syntax11.error b/contrib/byacc/test/btyacc/err_syntax11.error
index df0aee4fb58..b2dd79c5050 100644
--- a/contrib/byacc/test/btyacc/err_syntax11.error
+++ b/contrib/byacc/test/btyacc/err_syntax11.error
@@ -1 +1 @@
-YACC: w - line 7 of "./test/err_syntax11.y", the precedence of '|' has been redeclared
+YACC: w - line 7 of "./err_syntax11.y", the precedence of '|' has been redeclared
diff --git a/contrib/byacc/test/btyacc/err_syntax12.error b/contrib/byacc/test/btyacc/err_syntax12.error
index 9399e82e1d7..358960bdb9e 100644
--- a/contrib/byacc/test/btyacc/err_syntax12.error
+++ b/contrib/byacc/test/btyacc/err_syntax12.error
@@ -1 +1 @@
-YACC: w - line 7 of "./test/err_syntax12.y", the value of text has been redeclared
+YACC: w - line 7 of "./err_syntax12.y", the value of text has been redeclared
diff --git a/contrib/byacc/test/btyacc/err_syntax13.error b/contrib/byacc/test/btyacc/err_syntax13.error
index dd062569c1d..9ffa8b40c27 100644
--- a/contrib/byacc/test/btyacc/err_syntax13.error
+++ b/contrib/byacc/test/btyacc/err_syntax13.error
@@ -1 +1 @@
-YACC: e - line 7 of "./test/err_syntax13.y", the start symbol text is a token
+YACC: e - line 7 of "./err_syntax13.y", the start symbol text is a token
diff --git a/contrib/byacc/test/btyacc/err_syntax14.error b/contrib/byacc/test/btyacc/err_syntax14.error
index 787a21760b3..73e9f7c8319 100644
--- a/contrib/byacc/test/btyacc/err_syntax14.error
+++ b/contrib/byacc/test/btyacc/err_syntax14.error
@@ -1,2 +1,2 @@
-YACC: w - line 7 of "./test/err_syntax14.y", the start symbol has been redeclared
+YACC: w - line 7 of "./err_syntax14.y", the start symbol has been redeclared
 YACC: e - the start symbol text2 is undefined
diff --git a/contrib/byacc/test/btyacc/err_syntax15.error b/contrib/byacc/test/btyacc/err_syntax15.error
index 63600f1bd12..36dc03fef8b 100644
--- a/contrib/byacc/test/btyacc/err_syntax15.error
+++ b/contrib/byacc/test/btyacc/err_syntax15.error
@@ -1 +1 @@
-YACC: e - line 9 of "./test/err_syntax15.y", no grammar has been specified
+YACC: e - line 9 of "./err_syntax15.y", no grammar has been specified
diff --git a/contrib/byacc/test/btyacc/err_syntax16.error b/contrib/byacc/test/btyacc/err_syntax16.error
index b8dd094b940..6ff15897045 100644
--- a/contrib/byacc/test/btyacc/err_syntax16.error
+++ b/contrib/byacc/test/btyacc/err_syntax16.error
@@ -1 +1 @@
-YACC: e - line 14 of "./test/err_syntax16.y", a token appears on the lhs of a production
+YACC: e - line 14 of "./err_syntax16.y", a token appears on the lhs of a production
diff --git a/contrib/byacc/test/btyacc/err_syntax17.error b/contrib/byacc/test/btyacc/err_syntax17.error
index 24032f61320..8a8b64b0712 100644
--- a/contrib/byacc/test/btyacc/err_syntax17.error
+++ b/contrib/byacc/test/btyacc/err_syntax17.error
@@ -1,3 +1,3 @@
-YACC: e - line 8 of "./test/err_syntax17.y", unterminated action
+YACC: e - line 8 of "./err_syntax17.y", unterminated action
 S: { error
    ^
diff --git a/contrib/byacc/test/btyacc/err_syntax18.error b/contrib/byacc/test/btyacc/err_syntax18.error
index 305b4cf45e3..c52fd71a1ec 100644
--- a/contrib/byacc/test/btyacc/err_syntax18.error
+++ b/contrib/byacc/test/btyacc/err_syntax18.error
@@ -1 +1 @@
-YACC: w - line 9 of "./test/err_syntax18.y", $4 references beyond the end of the current rule
+YACC: w - line 9 of "./err_syntax18.y", $4 references beyond the end of the current rule
diff --git a/contrib/byacc/test/btyacc/err_syntax19.error b/contrib/byacc/test/btyacc/err_syntax19.error
index 895c8fe1626..2499b7fc4f1 100644
--- a/contrib/byacc/test/btyacc/err_syntax19.error
+++ b/contrib/byacc/test/btyacc/err_syntax19.error
@@ -1,3 +1,3 @@
-YACC: e - line 9 of "./test/err_syntax19.y", illegal $-name
+YACC: e - line 9 of "./err_syntax19.y", illegal $-name
             {  $$ = $; }
                     ^
diff --git a/contrib/byacc/test/btyacc/err_syntax2.error b/contrib/byacc/test/btyacc/err_syntax2.error
index fefda9fcf44..29fe56c28b4 100644
--- a/contrib/byacc/test/btyacc/err_syntax2.error
+++ b/contrib/byacc/test/btyacc/err_syntax2.error
@@ -1,3 +1,3 @@
-YACC: e - line 1 of "./test/err_syntax2.y", unmatched /*
+YACC: e - line 1 of "./err_syntax2.y", unmatched /*
 %{ /*
    ^
diff --git a/contrib/byacc/test/btyacc/err_syntax21.error b/contrib/byacc/test/btyacc/err_syntax21.error
index 162d82d0c96..9b0dc17b662 100644
--- a/contrib/byacc/test/btyacc/err_syntax21.error
+++ b/contrib/byacc/test/btyacc/err_syntax21.error
@@ -1 +1 @@
-YACC: e - line 12 of "./test/err_syntax21.y", $0 is untyped
+YACC: e - line 12 of "./err_syntax21.y", $0 is untyped
diff --git a/contrib/byacc/test/btyacc/err_syntax22.error b/contrib/byacc/test/btyacc/err_syntax22.error
index 9c71619c4e2..8622aa73f59 100644
--- a/contrib/byacc/test/btyacc/err_syntax22.error
+++ b/contrib/byacc/test/btyacc/err_syntax22.error
@@ -1 +1 @@
-YACC: e - line 17 of "./test/err_syntax22.y", $2 (recur) is untyped
+YACC: e - line 17 of "./err_syntax22.y", $2 (recur) is untyped
diff --git a/contrib/byacc/test/btyacc/err_syntax23.error b/contrib/byacc/test/btyacc/err_syntax23.error
index bcde6e7fac4..3ccbbd1fee8 100644
--- a/contrib/byacc/test/btyacc/err_syntax23.error
+++ b/contrib/byacc/test/btyacc/err_syntax23.error
@@ -1 +1 @@
-YACC: e - line 18 of "./test/err_syntax23.y", $$ is untyped
+YACC: e - line 18 of "./err_syntax23.y", $$ is untyped
diff --git a/contrib/byacc/test/btyacc/err_syntax24.error b/contrib/byacc/test/btyacc/err_syntax24.error
index bdd3aeda0db..c1538898ce0 100644
--- a/contrib/byacc/test/btyacc/err_syntax24.error
+++ b/contrib/byacc/test/btyacc/err_syntax24.error
@@ -1,2 +1,2 @@
-YACC: w - line 21 of "./test/err_syntax24.y", the default action assigns an undefined value to $$
-YACC: e - line 22 of "./test/err_syntax24.y", $$ is untyped
+YACC: w - line 21 of "./err_syntax24.y", the default action assigns an undefined value to $$
+YACC: e - line 22 of "./err_syntax24.y", $$ is untyped
diff --git a/contrib/byacc/test/btyacc/err_syntax25.error b/contrib/byacc/test/btyacc/err_syntax25.error
index ea45a70310d..234a7b9fcd3 100644
--- a/contrib/byacc/test/btyacc/err_syntax25.error
+++ b/contrib/byacc/test/btyacc/err_syntax25.error
@@ -1,3 +1,3 @@
-YACC: e - line 11 of "./test/err_syntax25.y", too many %union declarations
+YACC: e - line 11 of "./err_syntax25.y", too many %union declarations
 %union {
 ^
diff --git a/contrib/byacc/test/btyacc/err_syntax26.error b/contrib/byacc/test/btyacc/err_syntax26.error
index cddd5741bf7..c9a09ad1992 100644
--- a/contrib/byacc/test/btyacc/err_syntax26.error
+++ b/contrib/byacc/test/btyacc/err_syntax26.error
@@ -1 +1 @@
-YACC: e - line 6 of "./test/err_syntax26.y", unexpected end-of-file
+YACC: e - line 6 of "./err_syntax26.y", unexpected end-of-file
diff --git a/contrib/byacc/test/btyacc/err_syntax27.error b/contrib/byacc/test/btyacc/err_syntax27.error
index 4737f99b9a3..2a277087c35 100644
--- a/contrib/byacc/test/btyacc/err_syntax27.error
+++ b/contrib/byacc/test/btyacc/err_syntax27.error
@@ -1 +1 @@
-YACC: e - line 3 of "./test/err_syntax27.y", missing '}'
+YACC: e - line 3 of "./err_syntax27.y", missing '}'
diff --git a/contrib/byacc/test/btyacc/err_syntax3.error b/contrib/byacc/test/btyacc/err_syntax3.error
index 6926214f5e7..7e4871b87ad 100644
--- a/contrib/byacc/test/btyacc/err_syntax3.error
+++ b/contrib/byacc/test/btyacc/err_syntax3.error
@@ -1,3 +1,3 @@
-YACC: e - line 6 of "./test/err_syntax3.y", unterminated string
+YACC: e - line 6 of "./err_syntax3.y", unterminated string
 %token  '(' '*' '&
                       ^
diff --git a/contrib/byacc/test/btyacc/err_syntax4.error b/contrib/byacc/test/btyacc/err_syntax4.error
index 72b683ee7d4..6a10d4040eb 100644
--- a/contrib/byacc/test/btyacc/err_syntax4.error
+++ b/contrib/byacc/test/btyacc/err_syntax4.error
@@ -1,3 +1,3 @@
-YACC: e - line 1 of "./test/err_syntax4.y", unmatched %{
+YACC: e - line 1 of "./err_syntax4.y", unmatched %{
 %{
 ^
diff --git a/contrib/byacc/test/btyacc/err_syntax5.error b/contrib/byacc/test/btyacc/err_syntax5.error
index fd3bf0df6b9..37a8500b053 100644
--- a/contrib/byacc/test/btyacc/err_syntax5.error
+++ b/contrib/byacc/test/btyacc/err_syntax5.error
@@ -1,3 +1,3 @@
-YACC: e - line 6 of "./test/err_syntax5.y", unterminated %union declaration
+YACC: e - line 6 of "./err_syntax5.y", unterminated %union declaration
 %union {
 ^
diff --git a/contrib/byacc/test/btyacc/err_syntax6.error b/contrib/byacc/test/btyacc/err_syntax6.error
index ae83bd2a373..bde624a7159 100644
--- a/contrib/byacc/test/btyacc/err_syntax6.error
+++ b/contrib/byacc/test/btyacc/err_syntax6.error
@@ -1,3 +1,3 @@
-YACC: e - line 6 of "./test/err_syntax6.y", illegal tag
+YACC: e - line 6 of "./err_syntax6.y", illegal tag
 %token  '\777'
                ^
diff --git a/contrib/byacc/test/btyacc/err_syntax7a.error b/contrib/byacc/test/btyacc/err_syntax7a.error
index f6adba64ddc..213711e11ff 100644
--- a/contrib/byacc/test/btyacc/err_syntax7a.error
+++ b/contrib/byacc/test/btyacc/err_syntax7a.error
@@ -1,3 +1,3 @@
-YACC: e - line 6 of "./test/err_syntax7a.y", illegal character
+YACC: e - line 6 of "./err_syntax7a.y", illegal character
 %token  '\xfff'
                ^
diff --git a/contrib/byacc/test/btyacc/err_syntax7b.error b/contrib/byacc/test/btyacc/err_syntax7b.error
index f3e512fd1a7..19b617ccca1 100644
--- a/contrib/byacc/test/btyacc/err_syntax7b.error
+++ b/contrib/byacc/test/btyacc/err_syntax7b.error
@@ -1,3 +1,3 @@
-YACC: e - line 6 of "./test/err_syntax7b.y", illegal character
+YACC: e - line 6 of "./err_syntax7b.y", illegal character
 %token  '\x.'
                ^
diff --git a/contrib/byacc/test/btyacc/err_syntax8.error b/contrib/byacc/test/btyacc/err_syntax8.error
index 53a3a328d05..c6a4cc943fa 100644
--- a/contrib/byacc/test/btyacc/err_syntax8.error
+++ b/contrib/byacc/test/btyacc/err_syntax8.error
@@ -1 +1 @@
-YACC: e - line 6 of "./test/err_syntax8.y", illegal use of reserved symbol .
+YACC: e - line 6 of "./err_syntax8.y", illegal use of reserved symbol .
diff --git a/contrib/byacc/test/btyacc/err_syntax8a.error b/contrib/byacc/test/btyacc/err_syntax8a.error
index 3135551633f..ed503e90451 100644
--- a/contrib/byacc/test/btyacc/err_syntax8a.error
+++ b/contrib/byacc/test/btyacc/err_syntax8a.error
@@ -1 +1 @@
-YACC: e - line 6 of "./test/err_syntax8a.y", illegal use of reserved symbol $$123
+YACC: e - line 6 of "./err_syntax8a.y", illegal use of reserved symbol $$123
diff --git a/contrib/byacc/test/btyacc/err_syntax9.error b/contrib/byacc/test/btyacc/err_syntax9.error
index 43696bd1f4c..1f74b7ea0a2 100644
--- a/contrib/byacc/test/btyacc/err_syntax9.error
+++ b/contrib/byacc/test/btyacc/err_syntax9.error
@@ -1 +1 @@
-YACC: e - line 7 of "./test/err_syntax9.y", the start symbol text cannot be declared to be a token
+YACC: e - line 7 of "./err_syntax9.y", the start symbol text cannot be declared to be a token
diff --git a/contrib/byacc/test/btyacc/help.output b/contrib/byacc/test/btyacc/help.output
index 28e455543be..112b7c7a41c 100644
--- a/contrib/byacc/test/btyacc/help.output
+++ b/contrib/byacc/test/btyacc/help.output
@@ -4,7 +4,6 @@ Options:
   -b file_prefix        set filename prefix (default "y.")
   -B                    create a backtracking parser
   -d                    write definitions (.tab.h)
-  -D                    enable value stack memory reclamation
   -i                    write interface (y.tab.i)
   -g                    write a graphical description
   -l                    suppress #line directives
diff --git a/contrib/byacc/test/btyacc/no_b_opt.output b/contrib/byacc/test/btyacc/no_b_opt.output
index 28e455543be..112b7c7a41c 100644
--- a/contrib/byacc/test/btyacc/no_b_opt.output
+++ b/contrib/byacc/test/btyacc/no_b_opt.output
@@ -4,7 +4,6 @@ Options:
   -b file_prefix        set filename prefix (default "y.")
   -B                    create a backtracking parser
   -d                    write definitions (.tab.h)
-  -D                    enable value stack memory reclamation
   -i                    write interface (y.tab.i)
   -g                    write a graphical description
   -l                    suppress #line directives
diff --git a/contrib/byacc/test/btyacc/no_output2.output b/contrib/byacc/test/btyacc/no_output2.output
index 28e455543be..112b7c7a41c 100644
--- a/contrib/byacc/test/btyacc/no_output2.output
+++ b/contrib/byacc/test/btyacc/no_output2.output
@@ -4,7 +4,6 @@ Options:
   -b file_prefix        set filename prefix (default "y.")
   -B                    create a backtracking parser
   -d                    write definitions (.tab.h)
-  -D                    enable value stack memory reclamation
   -i                    write interface (y.tab.i)
   -g                    write a graphical description
   -l                    suppress #line directives
diff --git a/contrib/byacc/test/btyacc/no_p_opt.output b/contrib/byacc/test/btyacc/no_p_opt.output
index 28e455543be..112b7c7a41c 100644
--- a/contrib/byacc/test/btyacc/no_p_opt.output
+++ b/contrib/byacc/test/btyacc/no_p_opt.output
@@ -4,7 +4,6 @@ Options:
   -b file_prefix        set filename prefix (default "y.")
   -B                    create a backtracking parser
   -d                    write definitions (.tab.h)
-  -D                    enable value stack memory reclamation
   -i                    write interface (y.tab.i)
   -g                    write a graphical description
   -l                    suppress #line directives
diff --git a/contrib/byacc/test/btyacc/nostdin.output b/contrib/byacc/test/btyacc/nostdin.output
index 28e455543be..112b7c7a41c 100644
--- a/contrib/byacc/test/btyacc/nostdin.output
+++ b/contrib/byacc/test/btyacc/nostdin.output
@@ -4,7 +4,6 @@ Options:
   -b file_prefix        set filename prefix (default "y.")
   -B                    create a backtracking parser
   -d                    write definitions (.tab.h)
-  -D                    enable value stack memory reclamation
   -i                    write interface (y.tab.i)
   -g                    write a graphical description
   -l                    suppress #line directives
diff --git a/contrib/byacc/test/run_test.sh b/contrib/byacc/test/run_test.sh
index d9faf0bd76a..22ac61dc9ca 100755
--- a/contrib/byacc/test/run_test.sh
+++ b/contrib/byacc/test/run_test.sh
@@ -1,7 +1,9 @@
 #!/bin/sh
-# $Id: run_test.sh,v 1.22 2014/04/09 11:00:45 tom Exp $
+# $Id: run_test.sh,v 1.24 2014/07/15 19:21:10 tom Exp $
 # vi:ts=4 sw=4:
 
+errors=0
+
 # NEW is the file created by the testcase
 # REF is the reference file against which to compare
 test_diffs() {
@@ -11,13 +13,15 @@ test_diffs() {
 	if test ! -f $CMP
 	then
 		echo "...not found $CMP"
+		errors=1
 	else
 		sed	-e s,$NEW,$REF, \
-			-e "s%$YACC%YACC%" \
+			-e "s%$YACC_escaped%YACC%" \
 			-e '/YYPATCH/s/[0-9][0-9]*/"yyyymmdd"/' \
 			-e '/#define YYPATCH/s/PATCH/CHECK/' \
 			-e 's,#line \([1-9][0-9]*\) "'$REF_DIR'/,#line \1 ",' \
 			-e 's,#line \([1-9][0-9]*\) "'$TEST_DIR'/,#line \1 ",' \
+			-e 's,\(YACC:.* line [0-9][0-9]* of "\)'$TEST_DIR/',\1./,' \
 			< $CMP >$tmpfile \
 			&& mv $tmpfile $CMP
 		if test ! -f $REF
@@ -31,6 +35,7 @@ test_diffs() {
 		else
 			echo "...diff $REF"
 			diff -u $REF $CMP
+			errors=1
 		fi
 	fi
 }
@@ -62,10 +67,11 @@ else
 fi
 
 YACC=$PROG_DIR/yacc
+YACC_escaped=`echo "$PROG_DIR/yacc" | sed -e 's/\./\\\./g'`
 
 tmpfile=temp$$
 
-ifBTYACC=`fgrep -l 'define YYBTYACC' config.h > /dev/null; test $? != 0; echo $?`
+ifBTYACC=`fgrep -l 'define YYBTYACC' $PROG_DIR/config.h > /dev/null; test $? != 0; echo $?`
 
 if test $ifBTYACC = 0; then
 	REF_DIR=${TEST_DIR}/yacc
@@ -236,3 +242,5 @@ do
 		;;
 	esac
 done
+
+exit $errors
diff --git a/contrib/byacc/test/yacc/big_b.output b/contrib/byacc/test/yacc/big_b.output
index 889f0130b12..c98de14b4ad 100644
--- a/contrib/byacc/test/yacc/big_b.output
+++ b/contrib/byacc/test/yacc/big_b.output
@@ -5,7 +5,6 @@ Options:
   -b file_prefix        set filename prefix (default "y.")
   -B                    create a backtracking parser
   -d                    write definitions (.tab.h)
-  -D                    enable value stack memory reclamation
   -i                    write interface (y.tab.i)
   -g                    write a graphical description
   -l                    suppress #line directives
diff --git a/contrib/byacc/test/yacc/big_l.output b/contrib/byacc/test/yacc/big_l.output
index 889f0130b12..c98de14b4ad 100644
--- a/contrib/byacc/test/yacc/big_l.output
+++ b/contrib/byacc/test/yacc/big_l.output
@@ -5,7 +5,6 @@ Options:
   -b file_prefix        set filename prefix (default "y.")
   -B                    create a backtracking parser
   -d                    write definitions (.tab.h)
-  -D                    enable value stack memory reclamation
   -i                    write interface (y.tab.i)
   -g                    write a graphical description
   -l                    suppress #line directives
diff --git a/contrib/byacc/test/yacc/err_syntax1.error b/contrib/byacc/test/yacc/err_syntax1.error
index e3a341d4ee3..5df5c22ef17 100644
--- a/contrib/byacc/test/yacc/err_syntax1.error
+++ b/contrib/byacc/test/yacc/err_syntax1.error
@@ -1,3 +1,3 @@
-YACC: e - line 1 of "./test/err_syntax1.y", syntax error
+YACC: e - line 1 of "./err_syntax1.y", syntax error
 	?%	{
 	^
diff --git a/contrib/byacc/test/yacc/err_syntax10.error b/contrib/byacc/test/yacc/err_syntax10.error
index ceb876ec603..61a72c0408a 100644
--- a/contrib/byacc/test/yacc/err_syntax10.error
+++ b/contrib/byacc/test/yacc/err_syntax10.error
@@ -1,3 +1,3 @@
-YACC: w - line 7 of "./test/err_syntax10.y", the type of '(' has been redeclared
-YACC: w - line 7 of "./test/err_syntax10.y", the type of '*' has been redeclared
-YACC: w - line 7 of "./test/err_syntax10.y", the type of '&' has been redeclared
+YACC: w - line 7 of "./err_syntax10.y", the type of '(' has been redeclared
+YACC: w - line 7 of "./err_syntax10.y", the type of '*' has been redeclared
+YACC: w - line 7 of "./err_syntax10.y", the type of '&' has been redeclared
diff --git a/contrib/byacc/test/yacc/err_syntax11.error b/contrib/byacc/test/yacc/err_syntax11.error
index df0aee4fb58..b2dd79c5050 100644
--- a/contrib/byacc/test/yacc/err_syntax11.error
+++ b/contrib/byacc/test/yacc/err_syntax11.error
@@ -1 +1 @@
-YACC: w - line 7 of "./test/err_syntax11.y", the precedence of '|' has been redeclared
+YACC: w - line 7 of "./err_syntax11.y", the precedence of '|' has been redeclared
diff --git a/contrib/byacc/test/yacc/err_syntax12.error b/contrib/byacc/test/yacc/err_syntax12.error
index 9399e82e1d7..358960bdb9e 100644
--- a/contrib/byacc/test/yacc/err_syntax12.error
+++ b/contrib/byacc/test/yacc/err_syntax12.error
@@ -1 +1 @@
-YACC: w - line 7 of "./test/err_syntax12.y", the value of text has been redeclared
+YACC: w - line 7 of "./err_syntax12.y", the value of text has been redeclared
diff --git a/contrib/byacc/test/yacc/err_syntax13.error b/contrib/byacc/test/yacc/err_syntax13.error
index dd062569c1d..9ffa8b40c27 100644
--- a/contrib/byacc/test/yacc/err_syntax13.error
+++ b/contrib/byacc/test/yacc/err_syntax13.error
@@ -1 +1 @@
-YACC: e - line 7 of "./test/err_syntax13.y", the start symbol text is a token
+YACC: e - line 7 of "./err_syntax13.y", the start symbol text is a token
diff --git a/contrib/byacc/test/yacc/err_syntax14.error b/contrib/byacc/test/yacc/err_syntax14.error
index 787a21760b3..73e9f7c8319 100644
--- a/contrib/byacc/test/yacc/err_syntax14.error
+++ b/contrib/byacc/test/yacc/err_syntax14.error
@@ -1,2 +1,2 @@
-YACC: w - line 7 of "./test/err_syntax14.y", the start symbol has been redeclared
+YACC: w - line 7 of "./err_syntax14.y", the start symbol has been redeclared
 YACC: e - the start symbol text2 is undefined
diff --git a/contrib/byacc/test/yacc/err_syntax15.error b/contrib/byacc/test/yacc/err_syntax15.error
index 63600f1bd12..36dc03fef8b 100644
--- a/contrib/byacc/test/yacc/err_syntax15.error
+++ b/contrib/byacc/test/yacc/err_syntax15.error
@@ -1 +1 @@
-YACC: e - line 9 of "./test/err_syntax15.y", no grammar has been specified
+YACC: e - line 9 of "./err_syntax15.y", no grammar has been specified
diff --git a/contrib/byacc/test/yacc/err_syntax16.error b/contrib/byacc/test/yacc/err_syntax16.error
index b8dd094b940..6ff15897045 100644
--- a/contrib/byacc/test/yacc/err_syntax16.error
+++ b/contrib/byacc/test/yacc/err_syntax16.error
@@ -1 +1 @@
-YACC: e - line 14 of "./test/err_syntax16.y", a token appears on the lhs of a production
+YACC: e - line 14 of "./err_syntax16.y", a token appears on the lhs of a production
diff --git a/contrib/byacc/test/yacc/err_syntax17.error b/contrib/byacc/test/yacc/err_syntax17.error
index 24032f61320..8a8b64b0712 100644
--- a/contrib/byacc/test/yacc/err_syntax17.error
+++ b/contrib/byacc/test/yacc/err_syntax17.error
@@ -1,3 +1,3 @@
-YACC: e - line 8 of "./test/err_syntax17.y", unterminated action
+YACC: e - line 8 of "./err_syntax17.y", unterminated action
 S: { error
    ^
diff --git a/contrib/byacc/test/yacc/err_syntax18.error b/contrib/byacc/test/yacc/err_syntax18.error
index 305b4cf45e3..c52fd71a1ec 100644
--- a/contrib/byacc/test/yacc/err_syntax18.error
+++ b/contrib/byacc/test/yacc/err_syntax18.error
@@ -1 +1 @@
-YACC: w - line 9 of "./test/err_syntax18.y", $4 references beyond the end of the current rule
+YACC: w - line 9 of "./err_syntax18.y", $4 references beyond the end of the current rule
diff --git a/contrib/byacc/test/yacc/err_syntax19.error b/contrib/byacc/test/yacc/err_syntax19.error
index 895c8fe1626..2499b7fc4f1 100644
--- a/contrib/byacc/test/yacc/err_syntax19.error
+++ b/contrib/byacc/test/yacc/err_syntax19.error
@@ -1,3 +1,3 @@
-YACC: e - line 9 of "./test/err_syntax19.y", illegal $-name
+YACC: e - line 9 of "./err_syntax19.y", illegal $-name
             {  $$ = $; }
                     ^
diff --git a/contrib/byacc/test/yacc/err_syntax2.error b/contrib/byacc/test/yacc/err_syntax2.error
index fefda9fcf44..29fe56c28b4 100644
--- a/contrib/byacc/test/yacc/err_syntax2.error
+++ b/contrib/byacc/test/yacc/err_syntax2.error
@@ -1,3 +1,3 @@
-YACC: e - line 1 of "./test/err_syntax2.y", unmatched /*
+YACC: e - line 1 of "./err_syntax2.y", unmatched /*
 %{ /*
    ^
diff --git a/contrib/byacc/test/yacc/err_syntax21.error b/contrib/byacc/test/yacc/err_syntax21.error
index 162d82d0c96..9b0dc17b662 100644
--- a/contrib/byacc/test/yacc/err_syntax21.error
+++ b/contrib/byacc/test/yacc/err_syntax21.error
@@ -1 +1 @@
-YACC: e - line 12 of "./test/err_syntax21.y", $0 is untyped
+YACC: e - line 12 of "./err_syntax21.y", $0 is untyped
diff --git a/contrib/byacc/test/yacc/err_syntax22.error b/contrib/byacc/test/yacc/err_syntax22.error
index 9c71619c4e2..8622aa73f59 100644
--- a/contrib/byacc/test/yacc/err_syntax22.error
+++ b/contrib/byacc/test/yacc/err_syntax22.error
@@ -1 +1 @@
-YACC: e - line 17 of "./test/err_syntax22.y", $2 (recur) is untyped
+YACC: e - line 17 of "./err_syntax22.y", $2 (recur) is untyped
diff --git a/contrib/byacc/test/yacc/err_syntax23.error b/contrib/byacc/test/yacc/err_syntax23.error
index bcde6e7fac4..3ccbbd1fee8 100644
--- a/contrib/byacc/test/yacc/err_syntax23.error
+++ b/contrib/byacc/test/yacc/err_syntax23.error
@@ -1 +1 @@
-YACC: e - line 18 of "./test/err_syntax23.y", $$ is untyped
+YACC: e - line 18 of "./err_syntax23.y", $$ is untyped
diff --git a/contrib/byacc/test/yacc/err_syntax24.error b/contrib/byacc/test/yacc/err_syntax24.error
index bdd3aeda0db..c1538898ce0 100644
--- a/contrib/byacc/test/yacc/err_syntax24.error
+++ b/contrib/byacc/test/yacc/err_syntax24.error
@@ -1,2 +1,2 @@
-YACC: w - line 21 of "./test/err_syntax24.y", the default action assigns an undefined value to $$
-YACC: e - line 22 of "./test/err_syntax24.y", $$ is untyped
+YACC: w - line 21 of "./err_syntax24.y", the default action assigns an undefined value to $$
+YACC: e - line 22 of "./err_syntax24.y", $$ is untyped
diff --git a/contrib/byacc/test/yacc/err_syntax25.error b/contrib/byacc/test/yacc/err_syntax25.error
index ea45a70310d..234a7b9fcd3 100644
--- a/contrib/byacc/test/yacc/err_syntax25.error
+++ b/contrib/byacc/test/yacc/err_syntax25.error
@@ -1,3 +1,3 @@
-YACC: e - line 11 of "./test/err_syntax25.y", too many %union declarations
+YACC: e - line 11 of "./err_syntax25.y", too many %union declarations
 %union {
 ^
diff --git a/contrib/byacc/test/yacc/err_syntax26.error b/contrib/byacc/test/yacc/err_syntax26.error
index cddd5741bf7..c9a09ad1992 100644
--- a/contrib/byacc/test/yacc/err_syntax26.error
+++ b/contrib/byacc/test/yacc/err_syntax26.error
@@ -1 +1 @@
-YACC: e - line 6 of "./test/err_syntax26.y", unexpected end-of-file
+YACC: e - line 6 of "./err_syntax26.y", unexpected end-of-file
diff --git a/contrib/byacc/test/yacc/err_syntax27.error b/contrib/byacc/test/yacc/err_syntax27.error
index 4737f99b9a3..2a277087c35 100644
--- a/contrib/byacc/test/yacc/err_syntax27.error
+++ b/contrib/byacc/test/yacc/err_syntax27.error
@@ -1 +1 @@
-YACC: e - line 3 of "./test/err_syntax27.y", missing '}'
+YACC: e - line 3 of "./err_syntax27.y", missing '}'
diff --git a/contrib/byacc/test/yacc/err_syntax3.error b/contrib/byacc/test/yacc/err_syntax3.error
index 6926214f5e7..7e4871b87ad 100644
--- a/contrib/byacc/test/yacc/err_syntax3.error
+++ b/contrib/byacc/test/yacc/err_syntax3.error
@@ -1,3 +1,3 @@
-YACC: e - line 6 of "./test/err_syntax3.y", unterminated string
+YACC: e - line 6 of "./err_syntax3.y", unterminated string
 %token  '(' '*' '&
                       ^
diff --git a/contrib/byacc/test/yacc/err_syntax4.error b/contrib/byacc/test/yacc/err_syntax4.error
index 72b683ee7d4..6a10d4040eb 100644
--- a/contrib/byacc/test/yacc/err_syntax4.error
+++ b/contrib/byacc/test/yacc/err_syntax4.error
@@ -1,3 +1,3 @@
-YACC: e - line 1 of "./test/err_syntax4.y", unmatched %{
+YACC: e - line 1 of "./err_syntax4.y", unmatched %{
 %{
 ^
diff --git a/contrib/byacc/test/yacc/err_syntax5.error b/contrib/byacc/test/yacc/err_syntax5.error
index fd3bf0df6b9..37a8500b053 100644
--- a/contrib/byacc/test/yacc/err_syntax5.error
+++ b/contrib/byacc/test/yacc/err_syntax5.error
@@ -1,3 +1,3 @@
-YACC: e - line 6 of "./test/err_syntax5.y", unterminated %union declaration
+YACC: e - line 6 of "./err_syntax5.y", unterminated %union declaration
 %union {
 ^
diff --git a/contrib/byacc/test/yacc/err_syntax6.error b/contrib/byacc/test/yacc/err_syntax6.error
index ae83bd2a373..bde624a7159 100644
--- a/contrib/byacc/test/yacc/err_syntax6.error
+++ b/contrib/byacc/test/yacc/err_syntax6.error
@@ -1,3 +1,3 @@
-YACC: e - line 6 of "./test/err_syntax6.y", illegal tag
+YACC: e - line 6 of "./err_syntax6.y", illegal tag
 %token  '\777'
                ^
diff --git a/contrib/byacc/test/yacc/err_syntax7a.error b/contrib/byacc/test/yacc/err_syntax7a.error
index f6adba64ddc..213711e11ff 100644
--- a/contrib/byacc/test/yacc/err_syntax7a.error
+++ b/contrib/byacc/test/yacc/err_syntax7a.error
@@ -1,3 +1,3 @@
-YACC: e - line 6 of "./test/err_syntax7a.y", illegal character
+YACC: e - line 6 of "./err_syntax7a.y", illegal character
 %token  '\xfff'
                ^
diff --git a/contrib/byacc/test/yacc/err_syntax7b.error b/contrib/byacc/test/yacc/err_syntax7b.error
index f3e512fd1a7..19b617ccca1 100644
--- a/contrib/byacc/test/yacc/err_syntax7b.error
+++ b/contrib/byacc/test/yacc/err_syntax7b.error
@@ -1,3 +1,3 @@
-YACC: e - line 6 of "./test/err_syntax7b.y", illegal character
+YACC: e - line 6 of "./err_syntax7b.y", illegal character
 %token  '\x.'
                ^
diff --git a/contrib/byacc/test/yacc/err_syntax8.error b/contrib/byacc/test/yacc/err_syntax8.error
index 53a3a328d05..c6a4cc943fa 100644
--- a/contrib/byacc/test/yacc/err_syntax8.error
+++ b/contrib/byacc/test/yacc/err_syntax8.error
@@ -1 +1 @@
-YACC: e - line 6 of "./test/err_syntax8.y", illegal use of reserved symbol .
+YACC: e - line 6 of "./err_syntax8.y", illegal use of reserved symbol .
diff --git a/contrib/byacc/test/yacc/err_syntax8a.error b/contrib/byacc/test/yacc/err_syntax8a.error
index 3135551633f..ed503e90451 100644
--- a/contrib/byacc/test/yacc/err_syntax8a.error
+++ b/contrib/byacc/test/yacc/err_syntax8a.error
@@ -1 +1 @@
-YACC: e - line 6 of "./test/err_syntax8a.y", illegal use of reserved symbol $$123
+YACC: e - line 6 of "./err_syntax8a.y", illegal use of reserved symbol $$123
diff --git a/contrib/byacc/test/yacc/err_syntax9.error b/contrib/byacc/test/yacc/err_syntax9.error
index 43696bd1f4c..1f74b7ea0a2 100644
--- a/contrib/byacc/test/yacc/err_syntax9.error
+++ b/contrib/byacc/test/yacc/err_syntax9.error
@@ -1 +1 @@
-YACC: e - line 7 of "./test/err_syntax9.y", the start symbol text cannot be declared to be a token
+YACC: e - line 7 of "./err_syntax9.y", the start symbol text cannot be declared to be a token
diff --git a/contrib/byacc/test/yacc/help.output b/contrib/byacc/test/yacc/help.output
index 28e455543be..112b7c7a41c 100644
--- a/contrib/byacc/test/yacc/help.output
+++ b/contrib/byacc/test/yacc/help.output
@@ -4,7 +4,6 @@ Options:
   -b file_prefix        set filename prefix (default "y.")
   -B                    create a backtracking parser
   -d                    write definitions (.tab.h)
-  -D                    enable value stack memory reclamation
   -i                    write interface (y.tab.i)
   -g                    write a graphical description
   -l                    suppress #line directives
diff --git a/contrib/byacc/test/yacc/no_b_opt.output b/contrib/byacc/test/yacc/no_b_opt.output
index 28e455543be..112b7c7a41c 100644
--- a/contrib/byacc/test/yacc/no_b_opt.output
+++ b/contrib/byacc/test/yacc/no_b_opt.output
@@ -4,7 +4,6 @@ Options:
   -b file_prefix        set filename prefix (default "y.")
   -B                    create a backtracking parser
   -d                    write definitions (.tab.h)
-  -D                    enable value stack memory reclamation
   -i                    write interface (y.tab.i)
   -g                    write a graphical description
   -l                    suppress #line directives
diff --git a/contrib/byacc/test/yacc/no_output2.output b/contrib/byacc/test/yacc/no_output2.output
index 28e455543be..112b7c7a41c 100644
--- a/contrib/byacc/test/yacc/no_output2.output
+++ b/contrib/byacc/test/yacc/no_output2.output
@@ -4,7 +4,6 @@ Options:
   -b file_prefix        set filename prefix (default "y.")
   -B                    create a backtracking parser
   -d                    write definitions (.tab.h)
-  -D                    enable value stack memory reclamation
   -i                    write interface (y.tab.i)
   -g                    write a graphical description
   -l                    suppress #line directives
diff --git a/contrib/byacc/test/yacc/no_p_opt.output b/contrib/byacc/test/yacc/no_p_opt.output
index 28e455543be..112b7c7a41c 100644
--- a/contrib/byacc/test/yacc/no_p_opt.output
+++ b/contrib/byacc/test/yacc/no_p_opt.output
@@ -4,7 +4,6 @@ Options:
   -b file_prefix        set filename prefix (default "y.")
   -B                    create a backtracking parser
   -d                    write definitions (.tab.h)
-  -D                    enable value stack memory reclamation
   -i                    write interface (y.tab.i)
   -g                    write a graphical description
   -l                    suppress #line directives
diff --git a/contrib/byacc/test/yacc/nostdin.output b/contrib/byacc/test/yacc/nostdin.output
index 28e455543be..112b7c7a41c 100644
--- a/contrib/byacc/test/yacc/nostdin.output
+++ b/contrib/byacc/test/yacc/nostdin.output
@@ -4,7 +4,6 @@ Options:
   -b file_prefix        set filename prefix (default "y.")
   -B                    create a backtracking parser
   -d                    write definitions (.tab.h)
-  -D                    enable value stack memory reclamation
   -i                    write interface (y.tab.i)
   -g                    write a graphical description
   -l                    suppress #line directives
diff --git a/contrib/file/ChangeLog b/contrib/file/ChangeLog
index 4c19cc6034b..ed3df664c5d 100644
--- a/contrib/file/ChangeLog
+++ b/contrib/file/ChangeLog
@@ -1,3 +1,245 @@
+2014-06-12  12:28  Christos Zoulas 
+
+	* release 5.19
+
+2014-06-09   9:04  Christos Zoulas 
+	
+	* Misc buffer overruns and missing buffer size tests in cdf parsing
+	  (Francisco Alonso, Jan Kaluza)
+
+2014-06-02  14:50  Christos Zoulas 
+
+	* Enforce limit of 8K on regex searches that have no limits
+	* Allow the l modifier for regex to mean line count. Default
+	  to byte count. If line count is specified, assume a max
+	  of 80 characters per line to limit the byte count.
+	* Don't allow conversions to be used for dates, allowing
+	  the mask field to be used as an offset.
+
+2014-05-30  12:51  Christos Zoulas 
+
+	* Make the range operator limit the length of the
+	  regex search.
+
+2014-05-14  19:23  Christos Zoulas 
+
+	* PR/347: Windows fixes
+	* PR/352: Hangul word processor recognition
+	* PR/354: Encoding irregularities in text files
+
+2014-05-06  6:12  Christos Zoulas 
+
+	* Fix uninitialized title in CDF files (Jan Kaluza)
+
+2014-05-04  14:55  Christos Zoulas 
+
+	* PR/351: Fix compilation of empty files 
+
+2014-04-30  17:39  Christos Zoulas 
+
+	* Fix integer formats: We don't specify 'l' or
+	  'h' and 'hh' specifiers anymore, only 'll' for
+	  quads and nothing for the rest. This is so that
+	  magic writing is simpler.
+
+2014-04-01  15:25  Christos Zoulas 
+
+	* PR/341: Jan Kaluza, fix memory leak
+	* PR/342: Jan Kaluza, fix out of bounds read
+
+2014-03-28  15:25  Christos Zoulas 
+
+	* Fix issue with long formats not matching fmtcheck
+
+2014-03-26  11:25  Christos Zoulas 
+
+	* release 5.18
+
+2014-03-15  17:45  Christos Zoulas 
+
+	* add fmtcheck(3) for those who don't have it
+
+2014-03-14  15:12  Christos Zoulas 
+
+	* prevent mime entries from being attached to magic
+	  entries with no descriptions
+
+	* adjust magic strength for regex type
+
+	* remove superfluous ascmagic with encoding test
+
+2014-03-06  12:01  Christos Zoulas 
+
+	* fix regression fix echo -ne "\012\013\014" | file -i -
+	  which printed "binary" instead of "application/octet-stream"
+
+	* add size_t overflow check for magic file size
+
+2014-02-27  16:01  Christos Zoulas 
+
+	* experimental support for matching with CFD CLSID
+
+2014-02-18  13:04  Kimmo Suominen (kimmo@suominen.com)
+
+	* Cache old LC_CTYPE locale before setting it to "C", so
+	  we can use it to restore LC_CTYPE instead of asking
+	  setlocale() to scan the environment variables.
+
+2014-02-12  18:21  Christos Zoulas 
+
+	* Count recursion levels through indirect magic
+
+2014-02-11  10:40  Christos Zoulas 
+
+	* Prevent infinite recursion on files with indirect offsets of 0
+
+2014-01-30  21:00  Christos Zoulas 
+
+	* Add -E flag that makes file print filesystem errors to stderr
+	  and exit.
+
+2014-01-08  17:20  Christos Zoulas 
+
+	* mime printing could print results from multiple magic entries
+	  if there were multiple matches.
+	* in some cases overflow was not detected when computing offsets
+	  in softmagic.
+
+2013-12-05  12:00  Christos Zoulas 
+
+	* use strcasestr() to for cdf strings
+	* reset to the "C" locale while doing regex operations, or case
+	  insensitive comparisons; this is provisional
+
+2013-11-19  20:10  Christos Zoulas 
+
+	* always leave magic file loaded, don't unload for magic_check, etc.
+	* fix default encoding to binary instead of unknown which broke recently
+	* handle empty and one byte files, less specially so that
+	  --mime-encoding does not break completely.
+		`
+2013-11-06  14:40  Christos Zoulas 
+
+	* fix erroneous non-zero exit code from non-existant file and message
+
+2013-10-29  14:25  Christos Zoulas 
+
+	* add CDF MSI file detection (Guy Helmer)
+
+2013-09-03  11:56  Christos Zoulas 
+
+	* Don't mix errors and regular output if there was an error
+	* in magic_descriptor() don't close the file and try to restore
+	  its position
+
+2013-05-30  17:25  Christos Zoulas 
+
+	* Don't treat magic as an error if offset was past EOF (Christoph Biedl)
+
+2013-05-28  17:25  Christos Zoulas 
+	
+	* Fix spacing issues in softmagic and elf (Jan Kaluza)
+
+2013-05-02  18:00  Christos Zoulas 
+
+	* Fix segmentation fault with multiple magic_load commands.
+
+2013-04-22  11:20  Christos Zoulas 
+
+	* The way "default" was implemented was not very useful
+	  because the "if something was printed at that level"
+	  was not easily controlled by the user, and the format
+	  was bound to a string which is too restrictive. Add
+	  a "clear" for that level keyword and make "default"
+	  void. This way one can do:
+
+		>>13	clear	x
+		>>13	lelong	1	foo
+		>>13	lelong	2	bar
+		>>13	default	x
+		>>>13	lelong	x	unknown %x
+
+2013-03-25  13:20  Christos Zoulas 
+
+	* disallow strength setting in "name" entries
+
+2013-03-06  21:24  Christos Zoulas 
+
+	* fix recursive magic separator printing
+
+2013-02-26  19:28  Christos Zoulas 
+
+	* limit recursion level for mget
+	* fix pread() related breakage in cdf
+	* handle offsets properly in recursive "use"
+
+2013-02-18  10:39  Christos Zoulas 
+
+	* add elf reading of debug info to determine if file is stripped
+	  (Jan Kaluza)
+	* use pread()
+
+2013-01-25  18:05  Christos Zoulas 
+
+	* change mime description size from 64 to 80 to accommodate OOXML.
+
+2013-01-11  14:50  Christos Zoulas 
+
+	* Warn about inconsistent continuation levels.
+	* Change fsmagic to add a space after it prints.
+
+2013-01-10  21:00  Christos Zoulas 
+
+	* Make getline public so that file can link against it.
+	  Perhaps it is better to rename it, or hide it differently.
+	  Fixes builds on platforms that do not provide it.
+	  
+2013-01-07  16:30  Christos Zoulas 
+
+	* Add SuS d{,1,2,4,8}, u{,1,2,4,8} and document
+	  what long, int, short, etc is (Guy Harris)
+
+2013-01-06  11:20  Christos Zoulas 
+
+	* add magic_version function and constant
+	* Redo memory allocation and de-allocation.
+	  (prevents double frees on non mmap platforms)
+	* Fix bug with name/use having to do with passing
+	  found state from the parent to the child and back.
+
+2012-12-19   8:47  Christos Zoulas 
+
+	* Only print elf capabilities for archs we know (Jan Kaluza)
+
+2012-10-30  19:14  Christos Zoulas 
+
+	* Add "name" and "use" file types in order to look
+	  inside mach-o files.
+
+2012-09-06  10:40  Christos Zoulas 
+
+	* make --version exit 0 (Matthew Schultz)
+	* add string/T (Jan Kaluza)
+
+2012-08-09  2:15  Christos Zoulas 
+
+	* add z and t modifiers for our own vasprintf
+	* search for $HOME/.magic.mgc if it is there first
+	* fix reads from a pipe, and preserve errno
+
+2012-05-15  13:12  Christos Zoulas 
+
+	* use ctime_r, asctime_r
+
+2012-04-06  17:18  Christos Zoulas 
+
+	* Fixes for indirect offsets to handle apple disk formats
+
+2012-04-03  18:26  Christos Zoulas 
+
+	* Add windows date field types
+	* More info for windows shortcuts (incomplete)
+
 2012-02-20  17:33  Christos Zoulas 
 
 	* Fix CDF parsing issues found by CERT's fuzzing tool (Will Dormann)
@@ -851,7 +1093,7 @@
 
 	* Identify gnu tar vs. posix tar
 
-	* When keep going, don't print spurious newlines (Radek Vokl)
+	* When keep going, don't print spurious newlines (Radek Vokal)
 
 2006-04-01 12:02 Christos Zoulas 
 
@@ -875,7 +1117,7 @@
 2005-10-31 8:54 Christos Zoulas 
 
 	* Fix regression where the core info was not completely processed
-	    (Radek Vokl)
+	    (Radek Vokal)
 
 2005-10-20 11:15 Christos Zoulas 
 
@@ -892,7 +1134,7 @@
 2005-09-20 13:33 Christos Zoulas 
 
 	* Don't print SVR4 Style in core files multiple times
-	    (Radek Vokl)
+	    (Radek Vokal)
 
 2005-08-27 04:09 Christos Zoulas 
 
diff --git a/contrib/file/Magdir/assembler b/contrib/file/Magdir/assembler
deleted file mode 100644
index 90aa4ca65c0..00000000000
--- a/contrib/file/Magdir/assembler
+++ /dev/null
@@ -1,14 +0,0 @@
-#------------------------------------------------------------------------------
-# $File: assembler,v 1.1 2011/12/08 12:12:46 rrt Exp $
-# make:  file(1) magic for assembler source
-#
-0	regex	\^\.asciiz\?	assembler source text
-!:mime	text/x-asm
-0	regex	\^\.byte		assembler source text
-!:mime	text/x-asm
-0	regex	\^\.even		assembler source text
-!:mime	text/x-asm
-0	regex	\^\.globl		assembler source text
-!:mime	text/x-asm
-0	regex	\^\.text		assembler source text
-!:mime	text/x-asm
diff --git a/contrib/file/Magdir/cafebabe b/contrib/file/Magdir/cafebabe
deleted file mode 100644
index 6400e2f3b0e..00000000000
--- a/contrib/file/Magdir/cafebabe
+++ /dev/null
@@ -1,40 +0,0 @@
-
-#------------------------------------------------------------------------------
-# $File: cafebabe,v 1.8 2009/09/19 16:28:08 christos Exp $
-# Cafe Babes unite!
-#
-# Since Java bytecode and Mach-O fat-files have the same magic number, the test
-# must be performed in the same "magic" sequence to get both right.  The long
-# at offset 4 in a mach-O fat file tells the number of architectures; the short at
-# offset 4 in a Java bytecode file is the JVM minor version and the
-# short at offset 6 is the JVM major version.  Since there are only 
-# only 18 labeled Mach-O architectures at current, and the first released 
-# Java class format was version 43.0, we can safely choose any number
-# between 18 and 39 to test the number of architectures against
-# (and use as a hack). Let's not use 18, because the Mach-O people
-# might add another one or two as time goes by...
-#
-0	belong		0xcafebabe
-!:mime	application/x-java-applet
->4	belong		>30		compiled Java class data,
->>6	beshort		x	        version %d.
->>4	beshort		x       	\b%d
-# Which is which?
-#>>4	belong		0x032d		(Java 1.0)
-#>>4	belong		0x032d		(Java 1.1)
->>4	belong		0x002e		(Java 1.2)
->>4	belong		0x002f		(Java 1.3)
->>4	belong		0x0030		(Java 1.4)
->>4	belong		0x0031		(Java 1.5)
->>4	belong		0x0032		(Java 1.6)
-
-
-0	belong		0xcafebabe
->4	belong		1		Mach-O fat file with 1 architecture
->4	belong		>1
->>4	belong		<20		Mach-O fat file with %ld architectures
-
-0	belong		0xcafed00d	JAR compressed with pack200,
->>5	byte		x		version %d.
->>4	byte		x		\b%d
-!:mime	application/x-java-pack200
diff --git a/contrib/file/Magdir/database b/contrib/file/Magdir/database
deleted file mode 100644
index 956a53ba4cf..00000000000
--- a/contrib/file/Magdir/database
+++ /dev/null
@@ -1,295 +0,0 @@
-
-#------------------------------------------------------------------------------
-# $File: database,v 1.28 2011/09/16 19:40:40 christos Exp $
-# database:  file(1) magic for various databases
-#
-# extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk)
-#
-#
-# GDBM magic numbers
-#  Will be maintained as part of the GDBM distribution in the future.
-#  
-0	belong	0x13579ace	GNU dbm 1.x or ndbm database, big endian
-!:mime	application/x-gdbm
-0	lelong	0x13579ace	GNU dbm 1.x or ndbm database, little endian
-!:mime	application/x-gdbm
-0	string	GDBM		GNU dbm 2.x database
-!:mime	application/x-gdbm
-#
-# Berkeley DB
-#
-# Ian Darwin's file /etc/magic files: big/little-endian version.
-#
-# Hash 1.85/1.86 databases store metadata in network byte order.
-# Btree 1.85/1.86 databases store the metadata in host byte order.
-# Hash and Btree 2.X and later databases store the metadata in host byte order.
-
-0	long	0x00061561	Berkeley DB
-!:mime	application/x-dbm
->8	belong	4321
->>4	belong	>2		1.86
->>4	belong	<3		1.85
->>4	belong	>0		(Hash, version %d, native byte-order)
->8	belong	1234
->>4	belong	>2		1.86
->>4	belong	<3		1.85
->>4	belong	>0		(Hash, version %d, little-endian)
-
-0	belong	0x00061561	Berkeley DB
->8	belong	4321
->>4	belong	>2		1.86
->>4	belong	<3		1.85
->>4	belong	>0		(Hash, version %d, big-endian)
->8	belong	1234
->>4	belong	>2		1.86
->>4	belong	<3		1.85
->>4	belong	>0		(Hash, version %d, native byte-order)
-
-0	long	0x00053162	Berkeley DB 1.85/1.86
->4	long	>0		(Btree, version %d, native byte-order)
-0	belong	0x00053162	Berkeley DB 1.85/1.86
->4	belong	>0		(Btree, version %d, big-endian)
-0	lelong	0x00053162	Berkeley DB 1.85/1.86
->4	lelong	>0		(Btree, version %d, little-endian)
-
-12	long	0x00061561	Berkeley DB
->16	long	>0		(Hash, version %d, native byte-order)
-12	belong	0x00061561	Berkeley DB
->16	belong	>0		(Hash, version %d, big-endian)
-12	lelong	0x00061561	Berkeley DB
->16	lelong	>0		(Hash, version %d, little-endian)
-
-12	long	0x00053162	Berkeley DB
->16	long	>0		(Btree, version %d, native byte-order)
-12	belong	0x00053162	Berkeley DB
->16	belong	>0		(Btree, version %d, big-endian)
-12	lelong	0x00053162	Berkeley DB
->16	lelong	>0		(Btree, version %d, little-endian)
-
-12	long	0x00042253	Berkeley DB
->16	long	>0		(Queue, version %d, native byte-order)
-12	belong	0x00042253	Berkeley DB
->16	belong	>0		(Queue, version %d, big-endian)
-12	lelong	0x00042253	Berkeley DB
->16	lelong	>0		(Queue, version %d, little-endian)
-
-# From Max Bowsher.
-12	long	0x00040988	Berkeley DB
->16	long	>0		(Log, version %d, native byte-order)
-12	belong	0x00040988	Berkeley DB 
->16	belong	>0		(Log, version %d, big-endian)
-12	lelong	0x00040988	Berkeley DB
->16	lelong	>0		(Log, version %d, little-endian)
-
-#
-#
-# Round Robin Database Tool by Tobias Oetiker 
-0	string	RRD		RRDTool DB
->4	string	x		version %s
-#----------------------------------------------------------------------
-# ROOT: file(1) magic for ROOT databases
-#
-0       string  root\0  ROOT file
->4      belong  x       Version %d
->33     belong  x       (Compression: %d)
-
-# XXX: Weak magic.
-# Alex Ott 
-## Paradox file formats
-#2	  leshort	0x0800	Paradox 
-#>0x39	  byte		3	v. 3.0 
-#>0x39	  byte		4	v. 3.5 
-#>0x39	  byte		9	v. 4.x 
-#>0x39	  byte		10	v. 5.x 
-#>0x39	  byte		11	v. 5.x 
-#>0x39	  byte		12	v. 7.x 
-#>>0x04	  byte		0	indexed .DB data file 
-#>>0x04	  byte		1	primary index .PX file 
-#>>0x04	  byte		2	non-indexed .DB data file 
-#>>0x04	  byte		3	non-incrementing secondary index .Xnn file 
-#>>0x04	  byte		4	secondary index .Ynn file 
-#>>0x04	  byte		5	incrementing secondary index .Xnn file 
-#>>0x04	  byte		6	non-incrementing secondary index .XGn file 
-#>>0x04	  byte		7	secondary index .YGn file 
-#>>>0x04	  byte		8	incrementing secondary index .XGn file 
-
-## XBase database files
-#0      byte       0x02	
-#>8     leshort	  >0
-#>>12   leshort    0	FoxBase 
-#!:mime	application/x-dbf
-#>>>0x04	lelong		0		(no records)
-#>>>0x04	lelong		>0		(%ld records)
-#
-#0      byte       0x03	
-#!:mime	application/x-dbf
-#>8     leshort	  >0
-#>>12   leshort    0	FoxBase+, FoxPro, dBaseIII+, dBaseIV, no memo 
-#>>>0x04	lelong		0		(no records)
-#>>>0x04	lelong		>0		(%ld records)
-#
-#0      byte       0x04	
-#!:mime	application/x-dbf
-#>8     leshort	  >0
-#>>12   leshort    0	dBASE IV no memo file 
-#>>>0x04	lelong		0		(no records)
-#>>>0x04	lelong		>0		(%ld records)
-#
-#0      byte       0x05	
-#!:mime	application/x-dbf
-#>8     leshort	  >0
-#>>12   leshort    0	dBASE V no memo file 
-#>>>0x04	lelong		0		(no records)
-#>>>0x04	lelong		>0		(%ld records)
-#
-#0      byte       0x30
-#!:mime	application/x-dbf
-#>8     leshort	  >0
-#>>12   leshort    0	Visual FoxPro 
-#>>>0x04	lelong		0		(no records)
-#>>>0x04	lelong		>0		(%ld records)
-#
-#0      byte       0x43
-#!:mime	application/x-dbf
-#>8     leshort	  >0
-#>>12   leshort    0	FlagShip with memo var size 
-#>>>0x04	lelong		0		(no records)
-#>>>0x04	lelong		>0		(%ld records)
-#
-#0      byte       0x7b
-#!:mime	application/x-dbf
-#>8     leshort	  >0
-#>>12   leshort    0	dBASEIV with memo 
-#>>>0x04	lelong		0		(no records)
-#>>>0x04	lelong		>0		(%ld records)
-#
-#0      byte       0x83	
-#!:mime	application/x-dbf
-#>8     leshort	  >0
-#>>12   leshort    0	FoxBase+, dBaseIII+ with memo 
-#>>>0x04	lelong		0		(no records)
-#>>>0x04	lelong		>0		(%ld records)
-#
-#0      byte       0x8b
-#!:mime	application/x-dbf
-#>8     leshort	  >0
-#>>12   leshort    0	dBaseIV with memo 
-#>>>0x04	lelong		0		(no records)
-#>>>0x04	lelong		>0		(%ld records)
-#
-#0      byte       0x8e	
-#!:mime	application/x-dbf
-#>8     leshort	  >0
-#>>12   leshort    0	dBaseIV with SQL Table 
-#>>>0x04	lelong		0		(no records)
-#>>>0x04	lelong		>0		(%ld records)
-#
-#0      byte       0xb3
-#!:mime	application/x-dbf
-#>8     leshort	  >0
-#>>12   leshort    0	FlagShip with .dbt memo 
-#>>>0x04	lelong		0		(no records)
-#>>>0x04	lelong		>0		(%ld records)
-#
-#0      byte       0xf5
-#!:mime	application/x-dbf
-#>8     leshort	  >0
-#>>12   leshort    0	FoxPro with memo 
-#>>>0x04	lelong		0		(no records)
-#>>>0x04	lelong		>0		(%ld records)
-#
-#0	leshort		0x0006		DBase 3 index file
-
-# MS Access database
-4	string	Standard\ Jet\ DB	Microsoft Access Database
-!:mime	application/x-msaccess
-
-# TDB database from Samba et al - Martin Pool 
-0	string	TDB\ file		TDB database
->32	lelong	0x2601196D		version 6, little-endian
->>36	lelong	x			hash size %d bytes
-
-# SE Linux policy database
-0       lelong  0xf97cff8c      SE Linux policy
->16     lelong  x               v%d
->20     lelong  1      MLS
->24     lelong  x       %d symbols
->28     lelong  x       %d ocons
-
-# ICE authority file data (Wolfram Kleff)
-2	string		ICE		ICE authority data
-
-# X11 Xauthority file (Wolfram Kleff)
-10	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
-11	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
-12	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
-13	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
-14	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
-15	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
-16	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
-17	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
-18	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
-
-# From: Maxime Henrion 
-# PostgreSQL's custom dump format, Maxime Henrion 
-0	string		PGDMP		PostgreSQL custom database dump
->5	byte		x		- v%d
->6	byte		x		\b.%d
->5	beshort		<0x101		\b-0
->5	beshort		>0x100
->>7	byte		x		\b-%d
-
-# Type: Advanced Data Format (ADF) database
-# URL:  http://www.grc.nasa.gov/WWW/cgns/adf/
-# From: Nicolas Chauvat 
-0	string	@(#)ADF\ Database	CGNS Advanced Data Format
-
-# Tokyo Cabinet magic data
-# http://tokyocabinet.sourceforge.net/index.html
-0	string		ToKyO\ CaBiNeT\n	Tokyo Cabinet
->14	string		x			\b (%s)
->32	byte		0			\b, Hash
-!:mime	application/x-tokyocabinet-hash
->32	byte		1			\b, B+ tree
-!:mime	application/x-tokyocabinet-btree
->32	byte		2			\b, Fixed-length
-!:mime	application/x-tokyocabinet-fixed
->32	byte		3			\b, Table
-!:mime	application/x-tokyocabinet-table
->33	byte		&1			\b, [open]
->33	byte		&2			\b, [fatal]
->34	byte		x			\b, apow=%d
->35	byte		x			\b, fpow=%d
->36	byte		&0x01			\b, [large]
->36	byte		&0x02			\b, [deflate]
->36	byte		&0x04			\b, [bzip]
->36	byte		&0x08			\b, [tcbs]
->36	byte		&0x10			\b, [excodec]
->40	lequad		x			\b, bnum=%lld
->48	lequad		x			\b, rnum=%lld
->56	lequad		x			\b, fsiz=%lld
-
-# G-IR database made by gobject-introspect toolset,
-# http://live.gnome.org/GObjectIntrospection
-0	string		GOBJ\nMETADATA\r\n\032	G-IR binary database
->16	byte		x			\b, v%d
->17	byte		x			\b.%d
->20	leshort		x			\b, %d entries
->22	leshort		x			\b/%d local
-
-# Type:	QDBM Quick Database Manager
-# From:	Benoit Sibaud 
-0	string		\\[depot\\]\n\f		Quick Database Manager, little endian
-0	string		\\[DEPOT\\]\n\f		Quick Database Manager, big endian
-
-# Type:	TokyoCabinet database
-# URL:	http://tokyocabinet.sourceforge.net/
-# From:	Benoit Sibaud 
-0	string		ToKyO\ CaBiNeT\n	TokyoCabinet database
->14	string		x			(version %s)
-
-# From:  Stéphane Blondon http://www.yaal.fr
-# Database file for Zope (done by FileStorage)
-0	string		FS21	Zope Object Database File Storage (data)
-# Cache file for the database of Zope (done by ClientStorage)
-0	string		ZEC3	Zope Object Database Client Cache File (data)
diff --git a/contrib/file/Magdir/dolby b/contrib/file/Magdir/dolby
deleted file mode 100644
index fee287ccf13..00000000000
--- a/contrib/file/Magdir/dolby
+++ /dev/null
@@ -1,60 +0,0 @@
-
-#------------------------------------------------------------------------------
-# $File: dolby,v 1.5 2009/09/19 16:28:08 christos Exp $
-# ATSC A/53 aka AC-3 aka Dolby Digital 
-# from http://www.atsc.org/standards/a_52a.pdf
-# corrections, additions, etc. are always welcome!
-#
-# syncword
-0       beshort         0x0b77  ATSC A/52 aka AC-3 aka Dolby Digital stream,
-# fscod
->4      byte&0xc0       0x00    48 kHz,
->4      byte&0xc0       0x40    44.1 kHz,
->4      byte&0xc0       0x80    32 kHz,
-# is this one used for 96 kHz?
->4      byte&0xc0       0xc0    reserved frequency,
-#
->5	byte&7 = 0		\b, complete main (CM)
->5	byte&7 = 1		\b, music and effects (ME)
->5	byte&7 = 2		\b, visually impaired (VI)
->5	byte&7 = 3		\b, hearing impaired (HI)
->5	byte&7 = 4		\b, dialogue (D)
->5	byte&7 = 5		\b, commentary (C)
->5	byte&7 = 6		\b, emergency (E)
-# acmod
->6      byte&0xe0       0x00    1+1 front,
->6      byte&0xe0       0x20    1 front/0 rear,
->6      byte&0xe0       0x40    2 front/0 rear,
->6      byte&0xe0       0x60    3 front/0 rear,
->6      byte&0xe0       0x80    2 front/1 rear,
->6      byte&0xe0       0xa0    3 front/1 rear,
->6      byte&0xe0       0xc0    2 front/2 rear,
->6      byte&0xe0       0xe0    3 front/2 rear,
-# lfeon (these may be incorrect)
->7      byte&0x40       0x00    LFE off,
->7      byte&0x40       0x40    LFE on,
-#
->4	byte&0x3e = 0x00	\b, 32 kbit/s
->4	byte&0x3e = 0x02        \b, 40 kbit/s
->4	byte&0x3e = 0x04        \b, 48 kbit/s
->4	byte&0x3e = 0x06        \b, 56 kbit/s
->4	byte&0x3e = 0x08        \b, 64 kbit/s
->4	byte&0x3e = 0x0a        \b, 80 kbit/s
->4	byte&0x3e = 0x0c        \b, 96 kbit/s
->4	byte&0x3e = 0x0e        \b, 112 kbit/s
->4	byte&0x3e = 0x10        \b, 128 kbit/s
->4	byte&0x3e = 0x12        \b, 160 kbit/s
->4	byte&0x3e = 0x14        \b, 192 kbit/s
->4	byte&0x3e = 0x16        \b, 224 kbit/s
->4	byte&0x3e = 0x18        \b, 256 kbit/s
->4	byte&0x3e = 0x1a        \b, 320 kbit/s
->4	byte&0x3e = 0x1c        \b, 384 kbit/s
->4	byte&0x3e = 0x1e        \b, 448 kbit/s
->4	byte&0x3e = 0x20        \b, 512 kbit/s
->4	byte&0x3e = 0x22        \b, 576 kbit/s
->4	byte&0x3e = 0x24        \b, 640 kbit/s
-# dsurmod (these may be incorrect)
->6      beshort&0x0180  0x0000  Dolby Surround not indicated
->6      beshort&0x0180  0x0080  not Dolby Surround encoded
->6      beshort&0x0180  0x0100  Dolby Surround encoded
->6      beshort&0x0180  0x0180  reserved Dolby Surround mode
diff --git a/contrib/file/Magdir/dyadic b/contrib/file/Magdir/dyadic
deleted file mode 100644
index c1a2c3c53e3..00000000000
--- a/contrib/file/Magdir/dyadic
+++ /dev/null
@@ -1,46 +0,0 @@
-
-#------------------------------------------------------------------------------
-# $File: dyadic,v 1.5 2010/09/20 18:55:20 rrt Exp $
-# Dyadic: file(1) magic for Dyalog APL.
-#
-0	byte	0xaa
->1	byte	<4		Dyalog APL
->>1	byte	0x00		incomplete workspace
->>1	byte	0x01		component file
->>1	byte	0x02		external variable
->>1	byte	0x03		workspace
->>2	byte	x		version %d
->>3	byte	x		.%d
-
-0	beshort		0xaa03		Dyalog APL
->2	byte		x		workspace type %d
->3	byte		x		subtype %d
->7	byte&0x28	0x00		32-bit
->7	byte&0x28	0x20		64-bit
->7	byte&0x0c	0x00		classic
->7	byte&0x0c	0x04		unicode
->7	byte&0x88	0x00		big-endian
->7	byte&0x88	0x80		little-endian
-
-0	byte		0xaa		Dyalog APL
->1	byte		0x00		aplcore
->1	byte		0x01		component file 32-bit non-journaled non-checksummed
->1	byte		0x02		external variable exclusive
->1	byte		0x06		external variable shared
->1	byte		0x07		session
->1	byte		0x08		mapped file 32-bit
->1	byte		0x09		component file 64-bit non-journaled non-checksummed
->1	byte		0x0a		mapped file 64-bit
->1	byte		0x0b		component file 32-bit level 1 journaled non-checksummed
->1	byte		0x0c		component file 64-bit level 1 journaled non-checksummed
->1	byte		0x0d		component file 32-bit level 1 journaled checksummed
->1	byte		0x0e		component file 64-bit level 1 journaled checksummed
->1	byte		0x0f		component file 32-bit level 2 journaled checksummed
->1	byte		0x10		component file 64-bit level 2 journaled checksummed
->1	byte		0x11		component file 32-bit level 3 journaled checksummed
->1	byte		0x12		component file 64-bit level 3 journaled checksummed
->1	byte		0x13		component file 32-bit non-journaled checksummed
->1	byte		0x14		component file 64-bit non-journaled checksummed
->1	byte		0x80		DDB
-
-0	short		0x6060		Dyalog APL transfer
diff --git a/contrib/file/Magdir/elf b/contrib/file/Magdir/elf
deleted file mode 100644
index 8e3b7bc7419..00000000000
--- a/contrib/file/Magdir/elf
+++ /dev/null
@@ -1,295 +0,0 @@
-
-#------------------------------------------------------------------------------
-# $File: elf,v 1.54 2011/12/17 17:16:29 christos Exp $
-# elf:  file(1) magic for ELF executables
-#
-# We have to check the byte order flag to see what byte order all the
-# other stuff in the header is in.
-#
-# What're the correct byte orders for the nCUBE and the Fujitsu VPP500?
-#
-# Created by: unknown
-# Modified by (1): Daniel Quinlan 
-# Modified by (2): Peter Tobias  (core support)
-# Modified by (3): Christian 'Dr. Disk' Hechelmann  (fix of core support)
-# Modified by (4):  (VMS Itanium)
-# Modified by (5): Matthias Urlichs  (Listing of many architectures)
-0	string		\177ELF		ELF
->4	byte		0		invalid class
->4	byte		1		32-bit
->4	byte		2		64-bit
->5	byte		0		invalid byte order
->5	byte		1		LSB
->>16	leshort		0		no file type,
-!:strength *2
-!:mime	application/octet-stream
->>16	leshort		1		relocatable,
-!:mime	application/x-object
->>16	leshort		2		executable,
-!:mime	application/x-executable
->>16	leshort		3		shared object,
-!:mime	application/x-sharedlib
->>16	leshort		4		core file
-!:mime	application/x-coredump
-# Core file detection is not reliable.
-#>>>(0x38+0xcc) string	>\0		of '%s'
-#>>>(0x38+0x10) lelong	>0		(signal %d),
->>16	leshort		&0xff00		processor-specific,
->>18	leshort		0		no machine,
->>18	leshort		1		AT&T WE32100 - invalid byte order,
->>18	leshort		2		SPARC - invalid byte order,
->>18	leshort		3		Intel 80386,
->>18	leshort		4		Motorola
->>>36	lelong		&0x01000000	68000 - invalid byte order,
->>>36	lelong		&0x00810000	CPU32 - invalid byte order,
->>>36	lelong		0		68020 - invalid byte order,
->>18	leshort		5		Motorola 88000 - invalid byte order,
->>18	leshort		6		Intel 80486,
->>18	leshort		7		Intel 80860,
-# The official e_machine number for MIPS is now #8, regardless of endianness.
-# The second number (#10) will be deprecated later. For now, we still
-# say something if #10 is encountered, but only gory details for #8.
->>18	leshort		8		MIPS,
->>>36	lelong		&0x20		N32
->>18	leshort		10		MIPS,
->>>36	lelong		&0x20		N32
->>18	leshort		8
-# only for 32-bit
->>>4	byte		1
->>>>36  lelong&0xf0000000	0x00000000	MIPS-I
->>>>36  lelong&0xf0000000	0x10000000	MIPS-II
->>>>36  lelong&0xf0000000	0x20000000	MIPS-III
->>>>36  lelong&0xf0000000	0x30000000	MIPS-IV
->>>>36  lelong&0xf0000000	0x40000000	MIPS-V
->>>>36  lelong&0xf0000000	0x50000000	MIPS32
->>>>36  lelong&0xf0000000	0x60000000	MIPS64
->>>>36  lelong&0xf0000000	0x70000000	MIPS32 rel2
->>>>36  lelong&0xf0000000	0x80000000	MIPS64 rel2
-# only for 64-bit
->>>4	byte		2
->>>>48  lelong&0xf0000000	0x00000000	MIPS-I
->>>>48  lelong&0xf0000000	0x10000000	MIPS-II
->>>>48  lelong&0xf0000000	0x20000000	MIPS-III
->>>>48  lelong&0xf0000000	0x30000000	MIPS-IV
->>>>48  lelong&0xf0000000	0x40000000	MIPS-V
->>>>48  lelong&0xf0000000	0x50000000	MIPS32
->>>>48  lelong&0xf0000000	0x60000000	MIPS64
->>>>48  lelong&0xf0000000	0x70000000	MIPS32 rel2
->>>>48  lelong&0xf0000000	0x80000000	MIPS64 rel2
->>18	leshort		9		Amdahl - invalid byte order,
->>18	leshort		10		MIPS (deprecated),
->>18	leshort		11		RS6000 - invalid byte order,
->>18	leshort		15		PA-RISC - invalid byte order,
->>>50	leshort		0x0214		2.0
->>>48	leshort		&0x0008		(LP64),
->>18	leshort		16		nCUBE,
->>18	leshort		17		Fujitsu VPP500,
->>18	leshort		18		SPARC32PLUS - invalid byte order,
->>18	leshort		20		PowerPC,
->>18	leshort		22		IBM S/390,
->>18	leshort		36		NEC V800,
->>18	leshort		37		Fujitsu FR20,
->>18	leshort		38		TRW RH-32,
->>18	leshort		39		Motorola RCE,
->>18	leshort		40		ARM,
->>18	leshort		41		Alpha,
->>18	leshort		0xa390		IBM S/390 (obsolete),
->>18	leshort		42		Renesas SH,
->>18	leshort		43		SPARC V9 - invalid byte order,
->>18	leshort		44		Siemens Tricore Embedded Processor,
->>18	leshort		45		Argonaut RISC Core, Argonaut Technologies Inc.,
->>18	leshort		46		Renesas H8/300,
->>18	leshort		47		Renesas H8/300H,
->>18	leshort		48		Renesas H8S,
->>18	leshort		49		Renesas H8/500,
->>18	leshort		50		IA-64,
->>18	leshort		51		Stanford MIPS-X,
->>18	leshort		52		Motorola Coldfire,
->>18	leshort		53		Motorola M68HC12,
->>18	leshort		54		Fujitsu MMA,
->>18	leshort		55		Siemens PCP,
->>18	leshort		56		Sony nCPU,
->>18	leshort		57		Denso NDR1,
->>18	leshort		58		Start*Core,
->>18	leshort		59		Toyota ME16,
->>18	leshort		60		ST100,
->>18	leshort		61		Tinyj emb.,
->>18	leshort		62		x86-64,
->>18	leshort		63		Sony DSP,
->>18	leshort		66		FX66,
->>18	leshort		67		ST9+ 8/16 bit,
->>18	leshort		68		ST7 8 bit,
->>18	leshort		69		MC68HC16,
->>18	leshort		70		MC68HC11,
->>18	leshort		71		MC68HC08,
->>18	leshort		72		MC68HC05,
->>18	leshort		73		SGI SVx,
->>18	leshort		74		ST19 8 bit,
->>18	leshort		75		Digital VAX,
->>18	leshort		76		Axis cris,
->>18	leshort		77		Infineon 32-bit embedded,
->>18	leshort		78		Element 14 64-bit DSP,
->>18	leshort		79		LSI Logic 16-bit DSP,
->>18	leshort		80		MMIX,
->>18	leshort		81		Harvard machine-independent,
->>18	leshort		82		SiTera Prism,
->>18	leshort		83		Atmel AVR 8-bit,
->>18	leshort		84		Fujitsu FR30,
->>18	leshort		85		Mitsubishi D10V,
->>18	leshort		86		Mitsubishi D30V,
->>18	leshort		87		NEC v850,
->>18	leshort		88		Renesas M32R,
->>18	leshort		89		Matsushita MN10300,
->>18	leshort		90		Matsushita MN10200,
->>18	leshort		91		picoJava,
->>18	leshort		92		OpenRISC,
->>18	leshort		93		ARC Cores Tangent-A5,
->>18	leshort		94		Tensilica Xtensa,
->>18	leshort		97		NatSemi 32k,
->>18	leshort		106		Analog Devices Blackfin,
->>18	leshort		113		Altera Nios II,
->>18	leshort		0xae		META,
->>18	leshort		187		Tilera TILE64,
->>18	leshort		188		Tilera TILEPro,
->>18	leshort		191		Tilera TILE-Gx,
->>18	leshort		0x3426		OpenRISC (obsolete),
->>18	leshort		0x8472		OpenRISC (obsolete),
->>18	leshort		0x9026		Alpha (unofficial),
->>20	lelong		0		invalid version
->>20	lelong		1		version 1
->>36	lelong		1		MathCoPro/FPU/MAU Required
->5	byte		2		MSB
->>16	beshort		0		no file type,
-!:mime	application/octet-stream
->>16	beshort		1		relocatable,
-!:mime	application/x-object
->>16	beshort		2		executable,
-!:mime	application/x-executable
->>16	beshort		3		shared object,
-!:mime	application/x-sharedlib
->>16	beshort		4		core file,
-!:mime	application/x-coredump
-#>>>(0x38+0xcc) string	>\0		of '%s'
-#>>>(0x38+0x10) belong	>0		(signal %d),
->>16	beshort		&0xff00		processor-specific,
->>18	beshort		0		no machine,
->>18	beshort		1		AT&T WE32100,
->>18	beshort		2		SPARC,
->>18	beshort		3		Intel 80386 - invalid byte order,
->>18	beshort		4		Motorola
->>>36	belong		&0x01000000	68000,
->>>36	belong		&0x00810000	CPU32,
->>>36	belong		0		68020,
->>18	beshort		5		Motorola 88000,
->>18	beshort		6		Intel 80486 - invalid byte order,
->>18	beshort		7		Intel 80860,
-# only for MIPS - see comment in little-endian section above.
->>18	beshort		8		MIPS,
->>>36	belong		&0x20		N32
->>18	beshort		10		MIPS,
->>>36	belong		&0x20		N32
->>18	beshort		8
-# only for 32-bit
->>>4	byte		1
->>>>36  belong&0xf0000000	0x00000000	MIPS-I
->>>>36  belong&0xf0000000	0x10000000	MIPS-II
->>>>36  belong&0xf0000000	0x20000000	MIPS-III
->>>>36  belong&0xf0000000	0x30000000	MIPS-IV
->>>>36  belong&0xf0000000	0x40000000	MIPS-V
->>>>36  belong&0xf0000000	0x50000000	MIPS32
->>>>36  belong&0xf0000000	0x60000000	MIPS64
->>>>36  belong&0xf0000000	0x70000000	MIPS32 rel2
->>>>36  belong&0xf0000000	0x80000000	MIPS64 rel2
-# only for 64-bit
->>>4	byte		2
->>>>48	belong&0xf0000000	0x00000000	MIPS-I
->>>>48	belong&0xf0000000	0x10000000	MIPS-II
->>>>48	belong&0xf0000000	0x20000000	MIPS-III
->>>>48	belong&0xf0000000	0x30000000	MIPS-IV
->>>>48	belong&0xf0000000	0x40000000	MIPS-V
->>>>48	belong&0xf0000000	0x50000000	MIPS32
->>>>48	belong&0xf0000000	0x60000000	MIPS64
->>>>48	belong&0xf0000000	0x70000000	MIPS32 rel2
->>>>48	belong&0xf0000000	0x80000000	MIPS64 rel2
->>18	beshort		9		Amdahl,
->>18	beshort		10		MIPS (deprecated),
->>18	beshort		11		RS6000,
->>18	beshort		15		PA-RISC
->>>50	beshort		0x0214		2.0
->>>48	beshort		&0x0008		(LP64)
->>18	beshort		16		nCUBE,
->>18	beshort		17		Fujitsu VPP500,
->>18	beshort		18		SPARC32PLUS,
->>>36	belong&0xffff00	0x000100	V8+ Required,
->>>36	belong&0xffff00	0x000200	Sun UltraSPARC1 Extensions Required,
->>>36	belong&0xffff00	0x000400	HaL R1 Extensions Required,
->>>36	belong&0xffff00	0x000800	Sun UltraSPARC3 Extensions Required,
->>18	beshort		20		PowerPC or cisco 4500,
->>18	beshort		21		64-bit PowerPC or cisco 7500,
->>18	beshort		22		IBM S/390,
->>18	beshort		23		Cell SPU,
->>18	beshort		24		cisco SVIP,
->>18	beshort		25		cisco 7200,
->>18	beshort		36		NEC V800 or cisco 12000,
->>18	beshort		37		Fujitsu FR20,
->>18	beshort		38		TRW RH-32,
->>18	beshort		39		Motorola RCE,
->>18	beshort		40		ARM,
->>18	beshort		41		Alpha,
->>18	beshort		42		Renesas SH,
->>18	beshort		43		SPARC V9,
->>>48	belong&0xffff00	0x000200	Sun UltraSPARC1 Extensions Required,
->>>48	belong&0xffff00	0x000400	HaL R1 Extensions Required,
->>>48	belong&0xffff00	0x000800	Sun UltraSPARC3 Extensions Required,
->>>48	belong&0x3	0		total store ordering,
->>>48	belong&0x3	1		partial store ordering,
->>>48	belong&0x3	2		relaxed memory ordering,
->>18	beshort		44		Siemens Tricore Embedded Processor,
->>18	beshort		45		Argonaut RISC Core, Argonaut Technologies Inc.,
->>18	beshort		46		Renesas H8/300,
->>18	beshort		47		Renesas H8/300H,
->>18	beshort		48		Renesas H8S,
->>18	beshort		49		Renesas H8/500,
->>18	beshort		50		IA-64,
->>18	beshort		51		Stanford MIPS-X,
->>18	beshort		52		Motorola Coldfire,
->>18	beshort		53		Motorola M68HC12,
->>18	beshort		73		Cray NV1,
->>18	beshort		75		Digital VAX,
->>18	beshort		88		Renesas M32R,
->>18	leshort		92		OpenRISC,
->>18	leshort		0x3426		OpenRISC (obsolete),
->>18	leshort		0x8472		OpenRISC (obsolete),
->>18	beshort		94		Tensilica Xtensa,
->>18	beshort		97		NatSemi 32k,
->>18	beshort		187		Tilera TILE64,
->>18	beshort		188		Tilera TILEPro,
->>18	beshort		191		Tilera TILE-Gx,
->>18	beshort		0x18ad		AVR32 (unofficial),
->>18	beshort		0x9026		Alpha (unofficial),
->>18	beshort		0xa390		IBM S/390 (obsolete),
->>20	belong		0		invalid version
->>20	belong		1		version 1
->>36	belong		1		MathCoPro/FPU/MAU Required
-# Up to now only 0, 1 and 2 are defined; I've seen a file with 0x83, it seemed
-# like proper ELF, but extracting the string had bad results.
->4      byte            <0x80
->>8	string		>\0		(%s)
->8	string		\0
->>7	byte		0		(SYSV)
->>7	byte		1		(HP-UX)
->>7	byte		2		(NetBSD)
->>7	byte		3		(GNU/Linux)
->>7	byte		4		(GNU/Hurd)
->>7	byte		5		(86Open)
->>7	byte		6		(Solaris)
->>7	byte		7		(Monterey)
->>7	byte		8		(IRIX)
->>7	byte		9		(FreeBSD)
->>7	byte		10		(Tru64)
->>7	byte		11		(Novell Modesto)
->>7	byte		12		(OpenBSD)
->8      string          \2
->>7     byte            13              (OpenVMS)
->>7	byte		97		(ARM)
->>7	byte		255		(embedded)
diff --git a/contrib/file/Magdir/flash b/contrib/file/Magdir/flash
deleted file mode 100644
index dea35aed0bd..00000000000
--- a/contrib/file/Magdir/flash
+++ /dev/null
@@ -1,25 +0,0 @@
-
-#------------------------------------------------------------------------------
-# $File: flash,v 1.9 2009/11/08 01:30:01 christos Exp $
-# flash:	file(1) magic for Macromedia Flash file format
-#
-# See
-#
-#	http://www.macromedia.com/software/flash/open/
-#
-0	string		FWS		Macromedia Flash data,
->3	byte		x		version %d
-!:mime	application/x-shockwave-flash
-0	string		CWS		Macromedia Flash data (compressed),
-!:mime	application/x-shockwave-flash
->3	byte		x		version %d
-# From: Cal Peake 
-0	string		FLV		Macromedia Flash Video
-!:mime	video/x-flv
-
-#
-# Yosu Gomez
-0       string AGD2\xbe\xb8\xbb\xcd\x00 Macromedia Freehand 7 Document
-0       string AGD3\xbe\xb8\xbb\xcc\x00 Macromedia Freehand 8 Document
-# From Dave Wilson
-0	string AGD4\xbe\xb8\xbb\xcb\x00	Macromedia Freehand 9 Document
diff --git a/contrib/file/Magdir/gnome-keyring b/contrib/file/Magdir/gnome-keyring
deleted file mode 100644
index 463688fe7dc..00000000000
--- a/contrib/file/Magdir/gnome-keyring
+++ /dev/null
@@ -1,26 +0,0 @@
-
-#------------------------------------------------------------------------------
-# $File: gnome-keyring,v 1.2 2009/09/19 16:28:09 christos Exp $
-# GNOME keyring
-# Contributed by Josh Triplett
-# FIXME: Could be simplified if pstring supported two-byte counts
-0         string   GnomeKeyring\n\r\0\n GNOME keyring
->&0       ubyte    0                    \b, major version 0
->>&0      ubyte    0                    \b, minor version 0
->>>&0     ubyte    0                    \b, crypto type 0 (AEL)
->>>&0     ubyte    >0                   \b, crypto type %hhu (unknown)
->>>&1     ubyte    0                    \b, hash type 0 (MD5)
->>>&1     ubyte    >0                   \b, hash type %hhu (unknown)
->>>&2     ubelong  0xFFFFFFFF           \b, name NULL
->>>&2     ubelong  !0xFFFFFFFF
->>>>&-4   ubelong  >255                 \b, name too long for file's pstring type
->>>>&-4   ubelong  <256
->>>>>&-1  pstring  x                    \b, name "%s"
->>>>>>&0  ubeqdate x                    \b, last modified %s
->>>>>>&8  ubeqdate x                    \b, created %s
->>>>>>&16 ubelong  &1
->>>>>>>&0 ubelong  x                    \b, locked if idle for %u seconds
->>>>>>&16 ubelong  ^1                   \b, not locked if idle
->>>>>>&24 ubelong  x                    \b, hash iterations %u
->>>>>>&28 ubequad  x                    \b, salt %llu
->>>>>>&52 ubelong  x                    \b, %u item(s)
diff --git a/contrib/file/Magdir/mach b/contrib/file/Magdir/mach
deleted file mode 100644
index 8d03f1ae4a2..00000000000
--- a/contrib/file/Magdir/mach
+++ /dev/null
@@ -1,86 +0,0 @@
-
-#------------------------------------------------------------
-# $File: mach,v 1.9 2009/09/19 16:28:10 christos Exp $
-# Mach has two magic numbers, 0xcafebabe and 0xfeedface.
-# Unfortunately the first, cafebabe, is shared with
-# Java ByteCode, so they are both handled in the file "cafebabe".
-# The "feedface" ones are handled herein.
-#------------------------------------------------------------
-0	lelong&0xfffffffe	0xfeedface	Mach-O
->0	byte		0xcf		64-bit
->12	lelong		1		object
->12	lelong		2		executable
->12	lelong		3		fixed virtual memory shared library
->12	lelong		4		core
->12	lelong		5		preload executable
->12	lelong		6		dynamically linked shared library
->12	lelong		7		dynamic linker
->12	lelong		8		bundle
->12	lelong		9		dynamically linked shared library stub
->12	lelong		>9
->>12	lelong		x		filetype=%ld
->4	lelong		<0
->>4	lelong		x		architecture=%ld
->4	lelong		1		vax
->4	lelong		2		romp
->4	lelong		3		architecture=3
->4	lelong		4		ns32032
->4	lelong		5		ns32332
->4	lelong		6		m68k
->4	lelong		7		i386
->4	lelong		8		mips
->4	lelong		9		ns32532
->4	lelong		10		architecture=10
->4	lelong		11		hppa
->4	lelong		12		acorn
->4	lelong		13		m88k
->4	lelong		14		sparc
->4	lelong		15		i860-big
->4	lelong		16		i860
->4	lelong		17		rs6000
->4	lelong		18		ppc
->4	lelong		16777234	ppc64
->4	lelong		>16777234
->>4	lelong		x		architecture=%ld
-#
-0	belong&0xfffffffe	0xfeedface	Mach-O
->3	byte		0xcf		64-bit
->12	belong		1		object
->12	belong		2		executable
->12	belong		3		fixed virtual memory shared library
->12	belong		4		core
->12	belong		5		preload executable
->12	belong		6               dynamically linked shared library
->12	belong		7               dynamic linker
->12	belong		8		bundle
->12	belong		9		dynamically linked shared library stub
->12	belong		>9
->>12	belong		x		filetype=%ld
->4	belong		<0
->>4	belong		x		architecture=%ld
->4	belong		1		vax
->4	belong		2		romp
->4	belong		3		architecture=3
->4	belong		4		ns32032
->4	belong		5		ns32332
->4	belong		6		for m68k architecture
-# from NeXTstep 3.0 
-# i.e. mc680x0_all, ignore
-# >>8	belong		1		(mc68030)
->>8	belong		2		(mc68040)
->>8	belong		3		(mc68030 only)
->4	belong		7		i386
->4	belong		8		mips
->4	belong		9		ns32532
->4	belong		10		architecture=10
->4	belong		11		hppa
->4	belong		12		acorn
->4	belong		13		m88k
->4	belong		14		sparc
->4	belong		15		i860-big
->4	belong		16		i860
->4	belong		17		rs6000
->4	belong		18		ppc
->4	belong		16777234	ppc64
->4	belong		>16777234
->>4	belong		x		architecture=%ld
diff --git a/contrib/file/Magdir/mips b/contrib/file/Magdir/mips
deleted file mode 100644
index b49fecd24e9..00000000000
--- a/contrib/file/Magdir/mips
+++ /dev/null
@@ -1,182 +0,0 @@
-
-#------------------------------------------------------------------------------
-# $File: mips,v 1.7 2011/05/03 01:44:17 christos Exp $
-# mips:  file(1) magic for Silicon Graphics (MIPS, IRIS, IRIX, etc.)
-#                         Dec Ultrix (MIPS)
-# all of SGI's *current* machines and OSes run in big-endian mode on the
-# MIPS machines, as far as I know.
-#
-# XXX - what is the blank "-" line?
-#
-# kbd file definitions
-0	string	kbd!map		kbd map file
->8	byte	>0		Ver %d:
->10	short	>0		with %d table(s)
-0	belong	0407		old SGI 68020 executable
-0	belong	0410		old SGI 68020 pure executable
-0	beshort	0x8765		disk quotas file
-0	beshort	0x0506		IRIS Showcase file
->2	byte	0x49		-
->3	byte	x		- version %ld
-0	beshort	0x0226		IRIS Showcase template
->2	byte	0x63		-
->3	byte	x		- version %ld
-0	belong	0x5343464d	IRIS Showcase file
->4	byte	x		- version %ld
-0	belong	0x5443464d	IRIS Showcase template
->4	byte	x		- version %ld
-0	belong	0xdeadbabe	IRIX Parallel Arena
->8	belong	>0		- version %ld
-#
-0	beshort	0x0160		MIPSEB ECOFF executable
->20	beshort	0407		(impure)
->20	beshort	0410		(swapped)
->20	beshort	0413		(paged)
->8	belong	>0		not stripped
->8	belong	0		stripped
->22	byte	x		- version %ld
->23	byte	x		\b.%ld
-#
-0	beshort	0x0162		MIPSEL-BE ECOFF executable
->20	beshort	0407		(impure)
->20	beshort	0410		(swapped)
->20	beshort	0413		(paged)
->8	belong	>0		not stripped
->8	belong	0		stripped
->23	byte	x		- version %d
->22	byte	x		\b.%ld
-#
-0	beshort	0x6001		MIPSEB-LE ECOFF executable
->20	beshort	03401		(impure)
->20	beshort	04001		(swapped)
->20	beshort	05401		(paged)
->8	belong	>0		not stripped
->8	belong	0		stripped
->23	byte	x		- version %d
->22	byte	x		\b.%ld
-#
-0	beshort	0x6201		MIPSEL ECOFF executable
->20	beshort	03401		(impure)
->20	beshort	04001		(swapped)
->20	beshort	05401		(paged)
->8	belong	>0		not stripped
->8	belong	0		stripped
->23	byte	x		- version %ld
->22	byte	x		\b.%ld
-#
-# MIPS 2 additions
-#
-0	beshort	0x0163		MIPSEB MIPS-II ECOFF executable
->20	beshort	0407		(impure)
->20	beshort	0410		(swapped)
->20	beshort	0413		(paged)
->8	belong	>0		not stripped
->8	belong	0		stripped
->22	byte	x		- version %ld
->23	byte	x		\b.%ld
-#
-0	beshort	0x0166		MIPSEL-BE MIPS-II ECOFF executable
->20	beshort	0407		(impure)
->20	beshort	0410		(swapped)
->20	beshort	0413		(paged)
->8	belong	>0		not stripped
->8	belong	0		stripped
->22	byte	x		- version %ld
->23	byte	x		\b.%ld
-#
-0	beshort	0x6301		MIPSEB-LE MIPS-II ECOFF executable
->20	beshort	03401		(impure)
->20	beshort	04001		(swapped)
->20	beshort	05401		(paged)
->8	belong	>0		not stripped
->8	belong	0		stripped
->23	byte	x		- version %ld
->22	byte	x		\b.%ld
-#
-0	beshort	0x6601		MIPSEL MIPS-II ECOFF executable
->20	beshort	03401		(impure)
->20	beshort	04001		(swapped)
->20	beshort	05401		(paged)
->8	belong	>0		not stripped
->8	belong	0		stripped
->23	byte	x		- version %ld
->22	byte	x		\b.%ld
-#
-# MIPS 3 additions
-#
-0	beshort	0x0140		MIPSEB MIPS-III ECOFF executable
->20	beshort	0407		(impure)
->20	beshort	0410		(swapped)
->20	beshort	0413		(paged)
->8	belong	>0		not stripped
->8	belong	0		stripped
->22	byte	x		- version %ld
->23	byte	x		\b.%ld
-#
-0	beshort	0x0142		MIPSEL-BE MIPS-III ECOFF executable
->20	beshort	0407		(impure)
->20	beshort	0410		(swapped)
->20	beshort	0413		(paged)
->8	belong	>0		not stripped
->8	belong	0		stripped
->22	byte	x		- version %ld
->23	byte	x		\b.%ld
-#
-0	beshort	0x4001		MIPSEB-LE MIPS-III ECOFF executable
->20	beshort	03401		(impure)
->20	beshort	04001		(swapped)
->20	beshort	05401		(paged)
->8	belong	>0		not stripped
->8	belong	0		stripped
->23	byte	x		- version %ld
->22	byte	x		\b.%ld
-#
-0	beshort	0x4201		MIPSEL MIPS-III ECOFF executable
->20	beshort	03401		(impure)
->20	beshort	04001		(swapped)
->20	beshort	05401		(paged)
->8	belong	>0		not stripped
->8	belong	0		stripped
->23	byte	x		- version %ld
->22	byte	x		\b.%ld
-#
-0	beshort	0x180		MIPSEB Ucode
-0	beshort	0x182		MIPSEL-BE Ucode
-# 32bit core file
-0	belong	0xdeadadb0	IRIX core dump
->4	belong	1		of
->16	string	>\0		'%s'
-# 64bit core file
-0	belong	0xdeadad40	IRIX 64-bit core dump
->4	belong	1		of
->16	string	>\0		'%s'
-# N32bit core file
-0       belong	0xbabec0bb	IRIX N32 core dump
->4      belong	1               of
->16     string	>\0             '%s'
-# New style crash dump file
-0	string	\x43\x72\x73\x68\x44\x75\x6d\x70	IRIX vmcore dump of
->36	string	>\0					'%s'
-# Trusted IRIX info
-0	string	SGIAUDIT	SGI Audit file
->8	byte	x		- version %d
->9	byte	x		\b.%ld
-#
-0	string	WNGZWZSC	Wingz compiled script
-0	string	WNGZWZSS	Wingz spreadsheet
-0	string	WNGZWZHP	Wingz help file
-#
-0	string	#Inventor V	IRIS Inventor 1.0 file
-0	string	#Inventor V2	Open Inventor 2.0 file
-# GLF is OpenGL stream encoding
-0	string	glfHeadMagic();		GLF_TEXT
-4	belong	0x7d000000		GLF_BINARY_LSB_FIRST
-!:strength -30
-4	belong	0x0000007d		GLF_BINARY_MSB_FIRST
-!:strength -30
-# GLS is OpenGL stream encoding; GLS is the successor of GLF
-0	string	glsBeginGLS(		GLS_TEXT
-4	belong	0x10000000		GLS_BINARY_LSB_FIRST
-!:strength -30
-4	belong	0x00000010		GLS_BINARY_MSB_FIRST
-!:strength -30
diff --git a/contrib/file/Magdir/msooxml b/contrib/file/Magdir/msooxml
deleted file mode 100644
index 6ccebf641bf..00000000000
--- a/contrib/file/Magdir/msooxml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-#------------------------------------------------------------------------------
-# $File: msooxml,v 1.1 2011/01/25 18:36:19 christos Exp $
-# msooxml:  file(1) magic for Microsoft Office XML
-# From: Ralf Brown 
-
-# .docx, .pptx, and .xlsx are XML plus other files inside a ZIP
-#   archive.  The first member file is normally "[Content_Types].xml".
-# Since MSOOXML doesn't have anything like the uncompressed "mimetype"
-#   file of ePub or OpenDocument, we'll have to scan for a filename
-#   which can distinguish between the three types
-
-# start by checking for ZIP local file header signature
-0               string          PK\003\004
-# make sure the first file is correct
->0x1E           string          [Content_Types].xml
-# skip to the second local file header
-#   since some documents include a 520-byte extra field following the file
-#   header,  we need to scan for the next header
->>(18.l+49)     search/2000     PK\003\004
-# now skip to the *third* local file header; again, we need to scan due to a
-#   520-byte extra field following the file header
->>>&26          search/1000     PK\003\004
-# and check the subdirectory name to determine which type of OOXML
-#   file we have
->>>>&26         string          word/           Microsoft Word 2007+
-!:mime application/msword
->>>>&26         string          ppt/            Microsoft PowerPoint 2007+
-!:mime application/vnd.ms-powerpoint
->>>>&26         string          xl/             Microsoft Excel 2007+
-!:mime application/vnd.ms-excel
->>>>&26         default         x               Microsoft OOXML
-!:strength +10
diff --git a/contrib/file/Magdir/sgi b/contrib/file/Magdir/sgi
deleted file mode 100644
index 2a8af1faf14..00000000000
--- a/contrib/file/Magdir/sgi
+++ /dev/null
@@ -1,71 +0,0 @@
-
-#------------------------------------------------------------------------------
-# $File: sgi,v 1.18 2010/11/25 15:00:12 christos Exp $
-# sgi:  file(1) magic for Silicon Graphics applications
-
-#
-#
-# Performance Co-Pilot file types
-0	string	PmNs				PCP compiled namespace (V.0)
-0	string	PmN				PCP compiled namespace
->3	string	>\0				(V.%1.1s)
-#3	lelong	0x84500526			PCP archive
-3	belong	0x84500526			PCP archive
->7	byte	x				(V.%d)
-#>20	lelong	-2				temporal index
-#>20	lelong	-1				metadata
-#>20	lelong	0				log volume #0
-#>20	lelong	>0				log volume #%ld
->20	belong	-2				temporal index
->20	belong	-1				metadata
->20	belong	0				log volume #0
->20	belong	>0				log volume #%ld
->24	string	>\0				host: %s
-0	string	PCPFolio			PCP
->9	string	Version:			Archive Folio
->18	string	>\0				(V.%s)
-0	string	#pmchart			PCP pmchart view
->9	string	Version
->17	string	>\0				(V%-3.3s)
-0	string	#kmchart			PCP kmchart view
->9	string	Version
->17	string	>\0				(V.%s)
-0	string	pmview				PCP pmview config
->7	string	Version
->15	string	>\0				(V%-3.3s)
-0	string	#pmlogger			PCP pmlogger config
->10	string	Version
->18	string	>\0				(V%1.1s)
-0	string	#pmdahotproc			PCP pmdahotproc config
->13	string	Version
->21	string	>\0				(V%-3.3s)
-0	string	PcPh				PCP Help
->4	string	1				Index
->4	string	2				Text
->5	string	>\0				(V.%1.1s)
-0	string	#pmieconf-rules			PCP pmieconf rules
->16	string	>\0				(V.%1.1s)
-3	string	pmieconf-pmie			PCP pmie config
->17	string	>\0				(V.%1.1s)
-
-# SpeedShop data files
-0	lelong	0x13130303			SpeedShop data file
-
-# mdbm files
-0	lelong	0x01023962			mdbm file, version 0 (obsolete)
-0	string	mdbm				mdbm file,
->5	byte	x				version %d,
->6	byte	x				2^%d pages,
->7	byte	x				pagesize 2^%d,
->17	byte	x				hash %d,
->11	byte	x				dataformat %d
-
-# Alias Maya files
-0	string/t	//Maya ASCII	Alias Maya Ascii File,
->13	string	>\0	version %s
-8	string	MAYAFOR4	Alias Maya Binary File,
->32	string	>\0	version %s scene
-8	string	MayaFOR4	Alias Maya Binary File,
->32	string	>\0	version %s scene
-8	string	CIMG		Alias Maya Image File
-8	string	DEEP		Alias Maya Image File
diff --git a/contrib/file/Magdir/sql b/contrib/file/Magdir/sql
deleted file mode 100644
index cce5550fef4..00000000000
--- a/contrib/file/Magdir/sql
+++ /dev/null
@@ -1,46 +0,0 @@
-
-#------------------------------------------------------------------------------
-# $File: sql,v 1.6 2009/09/19 16:28:12 christos Exp $
-# sql:  file(1) magic for SQL files
-#
-# From: "Marty Leisner" 
-# Recognize some MySQL files.
-#
-0	beshort			0xfe01		MySQL table definition file
->2	byte			x		Version %d
-0	belong&0xffffff00	0xfefe0300	MySQL MISAM index file
->3	byte			x		Version %d
-0	belong&0xffffff00	0xfefe0700	MySQL MISAM compressed data file
->3	byte			x		Version %d
-0	belong&0xffffff00	0xfefe0500	MySQL ISAM index file
->3	byte			x		Version %d
-0	belong&0xffffff00	0xfefe0600	MySQL ISAM compressed data file
->3	byte			x		Version %d
-0	string		 	\376bin		MySQL replication log
-
-#------------------------------------------------------------------------------
-# iRiver H Series database file 
-# From Ken Guest 
-# As observed from iRivNavi.iDB and unencoded firmware
-#
-0   string		iRivDB	iRiver Database file
->11  string	>\0	Version %s
->39  string		iHP-100	[H Series]
-
-#------------------------------------------------------------------------------
-# SQLite database files
-# Ken Guest , Ty Sarna, Zack Weinberg
-#
-# Version 1 used GDBM internally; its files cannot be distinguished
-# from other GDBM files.
-#
-# Version 2 used this format:
-0	string	**\ This\ file\ contains\ an\ SQLite  SQLite 2.x database
-
-# Version 3 of SQLite allows applications to embed their own "user version"
-# number in the database.  Detect this and distinguish those files.
-
-0   string  SQLite\ format\ 3
->60 string  _MTN               Monotone source repository
->60 belong  !0                 SQLite 3.x database, user version %u
->60 belong  0                  SQLite 3.x database
diff --git a/contrib/file/Magdir/unknown b/contrib/file/Magdir/unknown
deleted file mode 100644
index 82ac2ad164f..00000000000
--- a/contrib/file/Magdir/unknown
+++ /dev/null
@@ -1,35 +0,0 @@
-
-#------------------------------------------------------------------------------
-# $File: unknown,v 1.7 2009/09/19 16:28:13 christos Exp $
-# unknown:  file(1) magic for unknown machines
-#
-# XXX - this probably should be pruned, as it'll match PDP-11 and
-# VAX image formats.
-#
-# 0x107 is 0407; 0x108 is 0410; both are PDP-11 (executable and pure,
-# respectively).
-#
-# 0x109 is 0411; that's PDP-11 split I&D, but the PDP-11 version doesn't
-# have the "version %ld", which may be a bogus COFFism (I don't think
-# there ever was COFF for the PDP-11).
-#
-# 0x10B is 0413; that's VAX demand-paged, but this is a short, not a
-# long, as it would be on a VAX.
-#
-# 0x10C is 0414 and 0x10E is 416; those *are* unknown.
-#
-0	short		0x107		unknown machine executable
->8	short		>0		not stripped
->15	byte		>0		- version %ld
-0	short		0x108		unknown pure executable
->8	short		>0		not stripped
->15	byte		>0		- version %ld
-0	short		0x109		PDP-11 separate I&D
->8	short		>0		not stripped
->15	byte		>0		- version %ld
-0	short		0x10b		unknown pure executable
->8	short		>0		not stripped
->15	byte		>0		- version %ld
-0	long		0x10c		unknown demand paged pure executable
->16	long		>0		not stripped
-0	long		0x10e		unknown readable demand paged pure executable
diff --git a/contrib/file/Magdir/virtual b/contrib/file/Magdir/virtual
deleted file mode 100644
index 7b729d40350..00000000000
--- a/contrib/file/Magdir/virtual
+++ /dev/null
@@ -1,17 +0,0 @@
-
-#------------------------------------------------------------------------------
-# $File: virtual,v 1.2 2011/11/22 13:30:05 christos Exp $
-# From: James Nobis 
-# Microsoft hard disk images for:
-# Virtual Server
-# Virtual PC
-# http://technet.microsoft.com/en-us/virtualserver/bb676673.aspx
-# .vhd
-0	string	conectix	Microsoft Disk Image, Virtual Server or Virtual PC
-
-# Sun xVM VirtualBox Disk Image
-# From: Richard W.M. Jones 
-# VirtualBox Disk Image
-0x40	ulelong		0xbeda107f	VirtualBox Disk Image
->0x44	uleshort	>0		\b, major %u
->0x46	uleshort	>0		\b, minor %u
diff --git a/contrib/file/Magdir/windows b/contrib/file/Magdir/windows
deleted file mode 100644
index cd760ec767e..00000000000
--- a/contrib/file/Magdir/windows
+++ /dev/null
@@ -1,122 +0,0 @@
-
-#------------------------------------------------------------------------------
-# $File: windows,v 1.4 2009/09/19 16:28:13 christos Exp $
-# windows:  file(1) magic for Microsoft Windows
-#
-# This file is mainly reserved for files where programs
-# using them are run almost always on MS Windows 3.x or
-# above, or files only used exclusively in Windows OS,
-# where there is no better category to allocate for.
-# For example, even though WinZIP almost run on Windows
-# only, it is better to treat them as "archive" instead.
-# For format usable in DOS, such as generic executable
-# format, please specify under "msdos" file.
-#
-
-
-# Summary: Outlook Express DBX file
-# Extension: .dbx
-# Created by: Christophe Monniez
-0	string	\xCF\xAD\x12\xFE	MS Outlook Express DBX file
->4	byte	=0xC5			\b, message database
->4	byte	=0xC6			\b, folder database
->4	byte	=0xC7			\b, account information
->4	byte	=0x30			\b, offline database
-
-
-# Summary: Windows crash dump
-# Extension: .dmp
-# Created by: Andreas Schuster (http://computer.forensikblog.de/)
-# Reference (1): http://computer.forensikblog.de/en/2008/02/64bit_magic.html
-# Modified by (1): Abel Cheung (Avoid match with first 4 bytes only)
-0	string		PAGE		
->4	string		DUMP		MS Windows 32bit crash dump
->>0x05c	byte            0		\b, no PAE
->>0x05c	byte            1		\b, PAE
->>0xf88	lelong		1		\b, full dump
->>0xf88	lelong		2		\b, kernel dump
->>0xf88	lelong		3		\b, small dump
->>0x068	lelong		x		\b, %ld pages
->4	string		DU64		MS Windows 64bit crash dump
->>0xf98	lelong		1		\b, full dump
->>0xf98	lelong		2		\b, kernel dump
->>0xf98	lelong		3		\b, small dump
->>0x090	lequad		x		\b, %lld pages
-
-
-# Summary: Vista Event Log
-# Extension: .evtx
-# Created by: Andreas Schuster (http://computer.forensikblog.de/)
-# Reference (1): http://computer.forensikblog.de/en/2007/05/some_magic.html
-0	string		ElfFile\0	MS Windows Vista Event Log
->0x2a	leshort		x		\b, %d chunks
->>0x10	lelong		x		\b (no. %d in use)
->0x18	lelong		>1		\b, next record no. %d
->0x18	lelong		=1		\b, empty
->0x78	lelong		&1		\b, DIRTY
->0x78	lelong		&2		\b, FULL
-
-
-# Summary: Windows 3.1 group files
-# Extension: .grp
-# Created by: unknown
-0	string		\120\115\103\103	MS Windows 3.1 group files
-
-
-# Summary: Old format help files
-# Extension: .hlp
-# Created by: Dirk Jagdmann 
-0	lelong		0x00035f3f		MS Windows 3.x help file
-
-
-# Summary: Hyper terminal
-# Extension: .ht
-# Created by: unknown
-0	string		HyperTerminal\ 
->15	string		1.0\ --\ HyperTerminal\ data\ file	MS Windows HyperTerminal profile
-
-
-# Summary: Windows shortcut
-# Extension: .lnk
-# Created by: unknown
-0	string		\114\0\0\0\001\024\002\0\0\0\0\0\300\0\0\0\0\0\0\106	MS Windows shortcut
-
-
-# Summary: Outlook Personal Folders
-# Created by: unknown
-0	lelong		0x4E444221	Microsoft Outlook email folder
->10	leshort		0x0e		(<=2002)
->10	leshort		0x17		(>=2003)
-
-
-# Summary: Windows help cache
-# Created by: unknown
-0	string		\164\146\115\122\012\000\000\000\001\000\000\000	MS Windows help cache
-
-
-# Summary: IE cache file
-# Created by: Christophe Monniez
-0	string	Client\ UrlCache\ MMF 	Internet Explorer cache file
->20	string	>\0			version %s
-
-
-# Summary: Registry files
-# Created by: unknown
-# Modified by (1): Joerg Jenderek
-0	string		regf		MS Windows registry file, NT/2000 or above
-0	string		CREG		MS Windows 95/98/ME registry file
-0	string		SHCC3		MS Windows 3.1 registry file
-
-
-# Summary: Windows Registry text
-# Extension: .reg
-# Submitted by: Abel Cheung 
-0	string		REGEDIT4\r\n\r\n	Windows Registry text (Win95 or above)
-0	string		Windows\ Registry\ Editor\ 
->&0	string		Version\ 5.00\r\n\r\n	Windows Registry text (Win2K or above)
-
-
-# From: Pal Tamas 
-# Autorun File
-0       string/c          [autorun]\r\n   Microsoft Windows Autorun file.
-!:mime	application/x-setupscript. 
diff --git a/contrib/file/Magdir/xilinx b/contrib/file/Magdir/xilinx
deleted file mode 100644
index 26efb1baebf..00000000000
--- a/contrib/file/Magdir/xilinx
+++ /dev/null
@@ -1,35 +0,0 @@
-
-#------------------------------------------------------------------------------
-# $File: xilinx,v 1.4 2009/09/19 16:28:13 christos Exp $
-# This is Aaron's attempt at a MAGIC file for Xilinx .bit files.
-# Xilinx-Magic@RevRagnarok.com
-# Got the info from FPGA-FAQ 0026
-#
-# First there is the sync header and its length
-0	beshort 0x0009
->2 	belong	=0x0ff00ff0
->>&0	belong  =0x0ff00ff0
->>>&0	beshort =0x0000	
->>>>&0	pstring	a	Xilinx BIT data
-# Next is a Pascal-style string with the NCD name. We want to capture that.
->>>>0x0F	pstring	x	- from %s
-# It is followed by a NUL
->>>>>&1	byte	0x00
-# And then 'b'
->>>>>&2	string b
-# With the part number:
-#>>>>>&5 string	4v	(Virtex4)
-#>>>>>&5 string  2v	(Virtex II
-#>>>>>>&0	string	!p	\b)
-#>>>>>>&0	string	p	Pro)
->>>>>&4	pstring x	- for %s
-# And then NUL / 'c' / Build Data / NUL / 'd' / Date / NUL / 'e' / Data Length
->>>>>>&1	byte	0x00
->>>>>>&2	string	c
->>>>>>&4	pstring	x	- built %s
->>>>>>>&1	byte	0x00
->>>>>>>&2	string	d
->>>>>>>&4	pstring	x	\b(%s)
->>>>>>>>&1	byte	0x00
->>>>>>>>&2	string	e
->>>>>>>>&4	belong	x	- data length 0x%lx
diff --git a/contrib/file/Makefile.am b/contrib/file/Makefile.am
index 2aa32fcc249..8bd927d943a 100644
--- a/contrib/file/Makefile.am
+++ b/contrib/file/Makefile.am
@@ -1,280 +1,5 @@
-#
-# $File: Makefile.am,v 1.78 2012/01/27 01:41:26 christos Exp $
-#
-MAGIC_FRAGMENT_BASE = Magdir
-MAGIC_DIR = $(top_srcdir)/magic
-MAGIC_FRAGMENT_DIR = $(MAGIC_DIR)/$(MAGIC_FRAGMENT_BASE)
+ACLOCAL_AMFLAGS = -I m4
 
-pkgdata_DATA = magic.mgc
+EXTRA_DIST = MAINT
 
-EXTRA_DIST = \
-$(MAGIC_DIR)/Header \
-$(MAGIC_DIR)/Localstuff \
-$(MAGIC_FRAGMENT_DIR)/acorn \
-$(MAGIC_FRAGMENT_DIR)/adi \
-$(MAGIC_FRAGMENT_DIR)/adventure \
-$(MAGIC_FRAGMENT_DIR)/allegro \
-$(MAGIC_FRAGMENT_DIR)/alliant \
-$(MAGIC_FRAGMENT_DIR)/amanda \
-$(MAGIC_FRAGMENT_DIR)/amigaos \
-$(MAGIC_FRAGMENT_DIR)/animation \
-$(MAGIC_FRAGMENT_DIR)/apl \
-$(MAGIC_FRAGMENT_DIR)/apple \
-$(MAGIC_FRAGMENT_DIR)/applix \
-$(MAGIC_FRAGMENT_DIR)/archive \
-$(MAGIC_FRAGMENT_DIR)/assembler \
-$(MAGIC_FRAGMENT_DIR)/asterix \
-$(MAGIC_FRAGMENT_DIR)/att3b \
-$(MAGIC_FRAGMENT_DIR)/audio \
-$(MAGIC_FRAGMENT_DIR)/basis \
-$(MAGIC_FRAGMENT_DIR)/bflt \
-$(MAGIC_FRAGMENT_DIR)/blcr \
-$(MAGIC_FRAGMENT_DIR)/blender \
-$(MAGIC_FRAGMENT_DIR)/blit \
-$(MAGIC_FRAGMENT_DIR)/bout \
-$(MAGIC_FRAGMENT_DIR)/bsdi \
-$(MAGIC_FRAGMENT_DIR)/bsi \
-$(MAGIC_FRAGMENT_DIR)/btsnoop \
-$(MAGIC_FRAGMENT_DIR)/c-lang \
-$(MAGIC_FRAGMENT_DIR)/c64 \
-$(MAGIC_FRAGMENT_DIR)/cad \
-$(MAGIC_FRAGMENT_DIR)/cafebabe \
-$(MAGIC_FRAGMENT_DIR)/cddb \
-$(MAGIC_FRAGMENT_DIR)/chord \
-$(MAGIC_FRAGMENT_DIR)/cisco \
-$(MAGIC_FRAGMENT_DIR)/citrus \
-$(MAGIC_FRAGMENT_DIR)/clarion \
-$(MAGIC_FRAGMENT_DIR)/claris \
-$(MAGIC_FRAGMENT_DIR)/clipper \
-$(MAGIC_FRAGMENT_DIR)/commands \
-$(MAGIC_FRAGMENT_DIR)/communications \
-$(MAGIC_FRAGMENT_DIR)/compress \
-$(MAGIC_FRAGMENT_DIR)/console \
-$(MAGIC_FRAGMENT_DIR)/convex \
-$(MAGIC_FRAGMENT_DIR)/cracklib \
-$(MAGIC_FRAGMENT_DIR)/ctags \
-$(MAGIC_FRAGMENT_DIR)/cups \
-$(MAGIC_FRAGMENT_DIR)/dact \
-$(MAGIC_FRAGMENT_DIR)/database \
-$(MAGIC_FRAGMENT_DIR)/diamond \
-$(MAGIC_FRAGMENT_DIR)/diff \
-$(MAGIC_FRAGMENT_DIR)/digital \
-$(MAGIC_FRAGMENT_DIR)/dolby \
-$(MAGIC_FRAGMENT_DIR)/dump \
-$(MAGIC_FRAGMENT_DIR)/dyadic \
-$(MAGIC_FRAGMENT_DIR)/ebml \
-$(MAGIC_FRAGMENT_DIR)/editors \
-$(MAGIC_FRAGMENT_DIR)/efi \
-$(MAGIC_FRAGMENT_DIR)/elf \
-$(MAGIC_FRAGMENT_DIR)/encore \
-$(MAGIC_FRAGMENT_DIR)/epoc \
-$(MAGIC_FRAGMENT_DIR)/erlang \
-$(MAGIC_FRAGMENT_DIR)/esri \
-$(MAGIC_FRAGMENT_DIR)/fcs \
-$(MAGIC_FRAGMENT_DIR)/filesystems \
-$(MAGIC_FRAGMENT_DIR)/flash \
-$(MAGIC_FRAGMENT_DIR)/fonts \
-$(MAGIC_FRAGMENT_DIR)/fortran \
-$(MAGIC_FRAGMENT_DIR)/frame \
-$(MAGIC_FRAGMENT_DIR)/freebsd \
-$(MAGIC_FRAGMENT_DIR)/fsav \
-$(MAGIC_FRAGMENT_DIR)/fusecompress \
-$(MAGIC_FRAGMENT_DIR)/games \
-$(MAGIC_FRAGMENT_DIR)/gcc \
-$(MAGIC_FRAGMENT_DIR)/geo \
-$(MAGIC_FRAGMENT_DIR)/geos \
-$(MAGIC_FRAGMENT_DIR)/gimp \
-$(MAGIC_FRAGMENT_DIR)/gnome-keyring \
-$(MAGIC_FRAGMENT_DIR)/gnu \
-$(MAGIC_FRAGMENT_DIR)/gnumeric \
-$(MAGIC_FRAGMENT_DIR)/grace \
-$(MAGIC_FRAGMENT_DIR)/graphviz \
-$(MAGIC_FRAGMENT_DIR)/gringotts \
-$(MAGIC_FRAGMENT_DIR)/guile \
-$(MAGIC_FRAGMENT_DIR)/hitachi-sh \
-$(MAGIC_FRAGMENT_DIR)/hp \
-$(MAGIC_FRAGMENT_DIR)/human68k \
-$(MAGIC_FRAGMENT_DIR)/ibm370 \
-$(MAGIC_FRAGMENT_DIR)/ibm6000 \
-$(MAGIC_FRAGMENT_DIR)/iff \
-$(MAGIC_FRAGMENT_DIR)/images \
-$(MAGIC_FRAGMENT_DIR)/inform \
-$(MAGIC_FRAGMENT_DIR)/intel \
-$(MAGIC_FRAGMENT_DIR)/interleaf \
-$(MAGIC_FRAGMENT_DIR)/island \
-$(MAGIC_FRAGMENT_DIR)/ispell \
-$(MAGIC_FRAGMENT_DIR)/isz \
-$(MAGIC_FRAGMENT_DIR)/java \
-$(MAGIC_FRAGMENT_DIR)/jpeg \
-$(MAGIC_FRAGMENT_DIR)/karma \
-$(MAGIC_FRAGMENT_DIR)/kde \
-$(MAGIC_FRAGMENT_DIR)/kml \
-$(MAGIC_FRAGMENT_DIR)/lecter \
-$(MAGIC_FRAGMENT_DIR)/lex \
-$(MAGIC_FRAGMENT_DIR)/lif \
-$(MAGIC_FRAGMENT_DIR)/linux \
-$(MAGIC_FRAGMENT_DIR)/lisp \
-$(MAGIC_FRAGMENT_DIR)/llvm \
-$(MAGIC_FRAGMENT_DIR)/lua \
-$(MAGIC_FRAGMENT_DIR)/luks \
-$(MAGIC_FRAGMENT_DIR)/m4 \
-$(MAGIC_FRAGMENT_DIR)/mach \
-$(MAGIC_FRAGMENT_DIR)/macintosh \
-$(MAGIC_FRAGMENT_DIR)/magic \
-$(MAGIC_FRAGMENT_DIR)/mail.news \
-$(MAGIC_FRAGMENT_DIR)/make \
-$(MAGIC_FRAGMENT_DIR)/maple \
-$(MAGIC_FRAGMENT_DIR)/marc21 \
-$(MAGIC_FRAGMENT_DIR)/mathcad \
-$(MAGIC_FRAGMENT_DIR)/mathematica \
-$(MAGIC_FRAGMENT_DIR)/matroska \
-$(MAGIC_FRAGMENT_DIR)/mcrypt \
-$(MAGIC_FRAGMENT_DIR)/mercurial \
-$(MAGIC_FRAGMENT_DIR)/metastore \
-$(MAGIC_FRAGMENT_DIR)/mime \
-$(MAGIC_FRAGMENT_DIR)/mips \
-$(MAGIC_FRAGMENT_DIR)/mirage \
-$(MAGIC_FRAGMENT_DIR)/misctools \
-$(MAGIC_FRAGMENT_DIR)/mkid \
-$(MAGIC_FRAGMENT_DIR)/mlssa \
-$(MAGIC_FRAGMENT_DIR)/mmdf \
-$(MAGIC_FRAGMENT_DIR)/modem \
-$(MAGIC_FRAGMENT_DIR)/motorola \
-$(MAGIC_FRAGMENT_DIR)/mozilla \
-$(MAGIC_FRAGMENT_DIR)/msdos \
-$(MAGIC_FRAGMENT_DIR)/msooxml \
-$(MAGIC_FRAGMENT_DIR)/msvc \
-$(MAGIC_FRAGMENT_DIR)/mup \
-$(MAGIC_FRAGMENT_DIR)/music \
-$(MAGIC_FRAGMENT_DIR)/natinst \
-$(MAGIC_FRAGMENT_DIR)/ncr \
-$(MAGIC_FRAGMENT_DIR)/netbsd \
-$(MAGIC_FRAGMENT_DIR)/netscape \
-$(MAGIC_FRAGMENT_DIR)/netware \
-$(MAGIC_FRAGMENT_DIR)/news \
-$(MAGIC_FRAGMENT_DIR)/nitpicker \
-$(MAGIC_FRAGMENT_DIR)/oasis \
-$(MAGIC_FRAGMENT_DIR)/ocaml \
-$(MAGIC_FRAGMENT_DIR)/octave \
-$(MAGIC_FRAGMENT_DIR)/ole2compounddocs \
-$(MAGIC_FRAGMENT_DIR)/olf \
-$(MAGIC_FRAGMENT_DIR)/os2 \
-$(MAGIC_FRAGMENT_DIR)/os400 \
-$(MAGIC_FRAGMENT_DIR)/os9 \
-$(MAGIC_FRAGMENT_DIR)/osf1 \
-$(MAGIC_FRAGMENT_DIR)/palm \
-$(MAGIC_FRAGMENT_DIR)/parix \
-$(MAGIC_FRAGMENT_DIR)/parrot \
-$(MAGIC_FRAGMENT_DIR)/pascal \
-$(MAGIC_FRAGMENT_DIR)/pbm \
-$(MAGIC_FRAGMENT_DIR)/pdf \
-$(MAGIC_FRAGMENT_DIR)/pdp \
-$(MAGIC_FRAGMENT_DIR)/perl \
-$(MAGIC_FRAGMENT_DIR)/pgp \
-$(MAGIC_FRAGMENT_DIR)/pkgadd \
-$(MAGIC_FRAGMENT_DIR)/plan9 \
-$(MAGIC_FRAGMENT_DIR)/plus5 \
-$(MAGIC_FRAGMENT_DIR)/printer \
-$(MAGIC_FRAGMENT_DIR)/project \
-$(MAGIC_FRAGMENT_DIR)/psdbms \
-$(MAGIC_FRAGMENT_DIR)/pulsar \
-$(MAGIC_FRAGMENT_DIR)/pyramid \
-$(MAGIC_FRAGMENT_DIR)/python \
-$(MAGIC_FRAGMENT_DIR)/revision \
-$(MAGIC_FRAGMENT_DIR)/riff \
-$(MAGIC_FRAGMENT_DIR)/rinex \
-$(MAGIC_FRAGMENT_DIR)/rpm \
-$(MAGIC_FRAGMENT_DIR)/rtf \
-$(MAGIC_FRAGMENT_DIR)/ruby \
-$(MAGIC_FRAGMENT_DIR)/sc \
-$(MAGIC_FRAGMENT_DIR)/sccs \
-$(MAGIC_FRAGMENT_DIR)/scientific \
-$(MAGIC_FRAGMENT_DIR)/securitycerts \
-$(MAGIC_FRAGMENT_DIR)/selinux \
-$(MAGIC_FRAGMENT_DIR)/sendmail \
-$(MAGIC_FRAGMENT_DIR)/sequent \
-$(MAGIC_FRAGMENT_DIR)/sgi \
-$(MAGIC_FRAGMENT_DIR)/sgml \
-$(MAGIC_FRAGMENT_DIR)/sharc \
-$(MAGIC_FRAGMENT_DIR)/sinclair \
-$(MAGIC_FRAGMENT_DIR)/sisu \
-$(MAGIC_FRAGMENT_DIR)/sketch \
-$(MAGIC_FRAGMENT_DIR)/smalltalk \
-$(MAGIC_FRAGMENT_DIR)/smile \
-$(MAGIC_FRAGMENT_DIR)/sniffer \
-$(MAGIC_FRAGMENT_DIR)/softquad \
-$(MAGIC_FRAGMENT_DIR)/spec \
-$(MAGIC_FRAGMENT_DIR)/spectrum \
-$(MAGIC_FRAGMENT_DIR)/sql \
-$(MAGIC_FRAGMENT_DIR)/ssh \
-$(MAGIC_FRAGMENT_DIR)/ssl \
-$(MAGIC_FRAGMENT_DIR)/sun \
-$(MAGIC_FRAGMENT_DIR)/sysex \
-$(MAGIC_FRAGMENT_DIR)/tcl \
-$(MAGIC_FRAGMENT_DIR)/teapot \
-$(MAGIC_FRAGMENT_DIR)/terminfo \
-$(MAGIC_FRAGMENT_DIR)/tex \
-$(MAGIC_FRAGMENT_DIR)/tgif \
-$(MAGIC_FRAGMENT_DIR)/ti-8x \
-$(MAGIC_FRAGMENT_DIR)/timezone \
-$(MAGIC_FRAGMENT_DIR)/troff \
-$(MAGIC_FRAGMENT_DIR)/tuxedo \
-$(MAGIC_FRAGMENT_DIR)/typeset \
-$(MAGIC_FRAGMENT_DIR)/unicode \
-$(MAGIC_FRAGMENT_DIR)/unknown \
-$(MAGIC_FRAGMENT_DIR)/uuencode \
-$(MAGIC_FRAGMENT_DIR)/varied.out \
-$(MAGIC_FRAGMENT_DIR)/varied.script \
-$(MAGIC_FRAGMENT_DIR)/vax \
-$(MAGIC_FRAGMENT_DIR)/vicar \
-$(MAGIC_FRAGMENT_DIR)/virtual \
-$(MAGIC_FRAGMENT_DIR)/virtutech \
-$(MAGIC_FRAGMENT_DIR)/visx \
-$(MAGIC_FRAGMENT_DIR)/vms \
-$(MAGIC_FRAGMENT_DIR)/vmware \
-$(MAGIC_FRAGMENT_DIR)/vorbis \
-$(MAGIC_FRAGMENT_DIR)/vxl \
-$(MAGIC_FRAGMENT_DIR)/warc \
-$(MAGIC_FRAGMENT_DIR)/weak \
-$(MAGIC_FRAGMENT_DIR)/windows \
-$(MAGIC_FRAGMENT_DIR)/wireless \
-$(MAGIC_FRAGMENT_DIR)/wordprocessors \
-$(MAGIC_FRAGMENT_DIR)/wsdl \
-$(MAGIC_FRAGMENT_DIR)/xdelta \
-$(MAGIC_FRAGMENT_DIR)/xenix \
-$(MAGIC_FRAGMENT_DIR)/xilinx \
-$(MAGIC_FRAGMENT_DIR)/xo65 \
-$(MAGIC_FRAGMENT_DIR)/xwindows \
-$(MAGIC_FRAGMENT_DIR)/zfs \
-$(MAGIC_FRAGMENT_DIR)/zilog \
-$(MAGIC_FRAGMENT_DIR)/zyxel 
-
-MAGIC = magic.mgc
-CLEANFILES = ${MAGIC} $(MAGIC_FRAGMENT_DIR)/Localstuff
-
-# FIXME: Build file natively as well so that it can be used to compile
-# the target's magic file; for now we bail if the local version does not match
-if IS_CROSS_COMPILE
-FILE_COMPILE = file
-FILE_COMPILE_DEP =
-else
-FILE_COMPILE = $(top_builddir)/src/file
-FILE_COMPILE_DEP = $(FILE_COMPILE)
-endif
-
-${MAGIC}: $(EXTRA_DIST) $(FILE_COMPILE_DEP)
-	@rm -fr magic
-	@mkdir magic && cp -p $(EXTRA_DIST) magic
-	@(if expr "${FILE_COMPILE}" : '.*/.*' > /dev/null; then \
-	    echo "Using ${FILE_COMPILE} to generate ${MAGIC}" > /dev/null; \
-	  else \
-	    v=$$(file --version | sed -e s/file-// -e q); \
-	    if [ "$$v" != "${PACKAGE_VERSION}" ]; then \
-		echo "Cannot use the installed version of file ($$v) to"; \
-		echo "cross-compile file ${PACKAGE_VERSION}"; \
-		echo "Please install file ${PACKAGE_VERSION} locally first"; \
-		exit 1; \
-	    fi; \
-	  fi)
-	$(FILE_COMPILE) -C -m magic
-	@rm -fr magic
+SUBDIRS = src magic tests doc python
diff --git a/contrib/file/Makefile.in b/contrib/file/Makefile.in
index 11bafdc8bed..eed031897ff 100644
--- a/contrib/file/Makefile.in
+++ b/contrib/file/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.14 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -14,8 +13,52 @@
 # PARTICULAR PURPOSE.
 
 @SET_MAKE@
-
 VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkglibexecdir = $(libexecdir)/@PACKAGE@
@@ -33,8 +76,12 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-subdir = magic
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+subdir = .
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+	$(top_srcdir)/configure $(am__configure_deps) \
+	$(srcdir)/config.h.in AUTHORS COPYING ChangeLog INSTALL NEWS \
+	README TODO compile config.guess config.sub depcomp install-sh \
+	missing ltmain.sh
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -42,42 +89,111 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_HEADER = config.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
-am__v_GEN_0 = @echo "  GEN   " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
 am__v_at_0 = @
+am__v_at_1 = 
 SOURCES =
 DIST_SOURCES =
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
-    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
-    *) f=$$p;; \
-  esac;
-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
-am__install_max = 40
-am__nobase_strip_setup = \
-  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
-am__nobase_strip = \
-  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
-am__nobase_list = $(am__nobase_strip_setup); \
-  for p in $$list; do echo "$$p $$p"; done | \
-  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
-  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
-    if (++n[$$2] == $(am__install_max)) \
-      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
-    END { for (dir in files) print dir, files[dir] }'
-am__base_list = \
-  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
-  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__installdirs = "$(DESTDIR)$(pkgdatadir)"
-DATA = $(pkgdata_DATA)
+RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+	ctags-recursive dvi-recursive html-recursive info-recursive \
+	install-data-recursive install-dvi-recursive \
+	install-exec-recursive install-html-recursive \
+	install-info-recursive install-pdf-recursive \
+	install-ps-recursive install-recursive installcheck-recursive \
+	installdirs-recursive pdf-recursive ps-recursive \
+	tags-recursive uninstall-recursive
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+am__recursive_targets = \
+  $(RECURSIVE_TARGETS) \
+  $(RECURSIVE_CLEAN_TARGETS) \
+  $(am__extra_recursive_targets)
+AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
+	cscope distdir dist dist-all distcheck
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
+	$(LISP)config.h.in
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates.  Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+  BEGIN { nonempty = 0; } \
+  { items[$$0] = 1; nonempty = 1; } \
+  END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique.  This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+  list='$(am__tagged_files)'; \
+  unique=`for i in $$list; do \
+    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+  done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+CSCOPE = cscope
+DIST_SUBDIRS = $(SUBDIRS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+  if test -d "$(distdir)"; then \
+    find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+      && rm -rf "$(distdir)" \
+      || { sleep 5 && rm -rf "$(distdir)"; }; \
+  else :; fi
+am__post_remove_distdir = $(am__remove_distdir)
+am__relativize = \
+  dir0=`pwd`; \
+  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+  sed_rest='s,^[^/]*/*,,'; \
+  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+  sed_butlast='s,/*[^/]*$$,,'; \
+  while test -n "$$dir1"; do \
+    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+    if test "$$first" != "."; then \
+      if test "$$first" = ".."; then \
+        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+      else \
+        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+        if test "$$first2" = "$$first"; then \
+          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+        else \
+          dir2="../$$dir2"; \
+        fi; \
+        dir0="$$dir0"/"$$first"; \
+      fi; \
+    fi; \
+    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+  done; \
+  reldir="$$dir2"
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+DIST_TARGETS = dist-gzip
+distuninstallcheck_listfiles = find . -type f -print
+am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
+  | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
+distcleancheck_listfiles = find . -type f -print
 pkgdatadir = @pkgdatadir@
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -90,11 +206,13 @@ AWK = @AWK@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
+CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -104,6 +222,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
+HAVE_VISIBILITY = @HAVE_VISIBILITY@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -118,6 +237,7 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MINGW = @MINGW@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -145,6 +265,7 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
@@ -178,7 +299,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -194,332 +314,181 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-
-#
-# $File: Makefile.am,v 1.78 2012/01/27 01:41:26 christos Exp $
-#
-MAGIC_FRAGMENT_BASE = Magdir
-MAGIC_DIR = $(top_srcdir)/magic
-MAGIC_FRAGMENT_DIR = $(MAGIC_DIR)/$(MAGIC_FRAGMENT_BASE)
-pkgdata_DATA = magic.mgc
-EXTRA_DIST = \
-$(MAGIC_DIR)/Header \
-$(MAGIC_DIR)/Localstuff \
-$(MAGIC_FRAGMENT_DIR)/acorn \
-$(MAGIC_FRAGMENT_DIR)/adi \
-$(MAGIC_FRAGMENT_DIR)/adventure \
-$(MAGIC_FRAGMENT_DIR)/allegro \
-$(MAGIC_FRAGMENT_DIR)/alliant \
-$(MAGIC_FRAGMENT_DIR)/amanda \
-$(MAGIC_FRAGMENT_DIR)/amigaos \
-$(MAGIC_FRAGMENT_DIR)/animation \
-$(MAGIC_FRAGMENT_DIR)/apl \
-$(MAGIC_FRAGMENT_DIR)/apple \
-$(MAGIC_FRAGMENT_DIR)/applix \
-$(MAGIC_FRAGMENT_DIR)/archive \
-$(MAGIC_FRAGMENT_DIR)/assembler \
-$(MAGIC_FRAGMENT_DIR)/asterix \
-$(MAGIC_FRAGMENT_DIR)/att3b \
-$(MAGIC_FRAGMENT_DIR)/audio \
-$(MAGIC_FRAGMENT_DIR)/basis \
-$(MAGIC_FRAGMENT_DIR)/bflt \
-$(MAGIC_FRAGMENT_DIR)/blcr \
-$(MAGIC_FRAGMENT_DIR)/blender \
-$(MAGIC_FRAGMENT_DIR)/blit \
-$(MAGIC_FRAGMENT_DIR)/bout \
-$(MAGIC_FRAGMENT_DIR)/bsdi \
-$(MAGIC_FRAGMENT_DIR)/bsi \
-$(MAGIC_FRAGMENT_DIR)/btsnoop \
-$(MAGIC_FRAGMENT_DIR)/c-lang \
-$(MAGIC_FRAGMENT_DIR)/c64 \
-$(MAGIC_FRAGMENT_DIR)/cad \
-$(MAGIC_FRAGMENT_DIR)/cafebabe \
-$(MAGIC_FRAGMENT_DIR)/cddb \
-$(MAGIC_FRAGMENT_DIR)/chord \
-$(MAGIC_FRAGMENT_DIR)/cisco \
-$(MAGIC_FRAGMENT_DIR)/citrus \
-$(MAGIC_FRAGMENT_DIR)/clarion \
-$(MAGIC_FRAGMENT_DIR)/claris \
-$(MAGIC_FRAGMENT_DIR)/clipper \
-$(MAGIC_FRAGMENT_DIR)/commands \
-$(MAGIC_FRAGMENT_DIR)/communications \
-$(MAGIC_FRAGMENT_DIR)/compress \
-$(MAGIC_FRAGMENT_DIR)/console \
-$(MAGIC_FRAGMENT_DIR)/convex \
-$(MAGIC_FRAGMENT_DIR)/cracklib \
-$(MAGIC_FRAGMENT_DIR)/ctags \
-$(MAGIC_FRAGMENT_DIR)/cups \
-$(MAGIC_FRAGMENT_DIR)/dact \
-$(MAGIC_FRAGMENT_DIR)/database \
-$(MAGIC_FRAGMENT_DIR)/diamond \
-$(MAGIC_FRAGMENT_DIR)/diff \
-$(MAGIC_FRAGMENT_DIR)/digital \
-$(MAGIC_FRAGMENT_DIR)/dolby \
-$(MAGIC_FRAGMENT_DIR)/dump \
-$(MAGIC_FRAGMENT_DIR)/dyadic \
-$(MAGIC_FRAGMENT_DIR)/ebml \
-$(MAGIC_FRAGMENT_DIR)/editors \
-$(MAGIC_FRAGMENT_DIR)/efi \
-$(MAGIC_FRAGMENT_DIR)/elf \
-$(MAGIC_FRAGMENT_DIR)/encore \
-$(MAGIC_FRAGMENT_DIR)/epoc \
-$(MAGIC_FRAGMENT_DIR)/erlang \
-$(MAGIC_FRAGMENT_DIR)/esri \
-$(MAGIC_FRAGMENT_DIR)/fcs \
-$(MAGIC_FRAGMENT_DIR)/filesystems \
-$(MAGIC_FRAGMENT_DIR)/flash \
-$(MAGIC_FRAGMENT_DIR)/fonts \
-$(MAGIC_FRAGMENT_DIR)/fortran \
-$(MAGIC_FRAGMENT_DIR)/frame \
-$(MAGIC_FRAGMENT_DIR)/freebsd \
-$(MAGIC_FRAGMENT_DIR)/fsav \
-$(MAGIC_FRAGMENT_DIR)/fusecompress \
-$(MAGIC_FRAGMENT_DIR)/games \
-$(MAGIC_FRAGMENT_DIR)/gcc \
-$(MAGIC_FRAGMENT_DIR)/geo \
-$(MAGIC_FRAGMENT_DIR)/geos \
-$(MAGIC_FRAGMENT_DIR)/gimp \
-$(MAGIC_FRAGMENT_DIR)/gnome-keyring \
-$(MAGIC_FRAGMENT_DIR)/gnu \
-$(MAGIC_FRAGMENT_DIR)/gnumeric \
-$(MAGIC_FRAGMENT_DIR)/grace \
-$(MAGIC_FRAGMENT_DIR)/graphviz \
-$(MAGIC_FRAGMENT_DIR)/gringotts \
-$(MAGIC_FRAGMENT_DIR)/guile \
-$(MAGIC_FRAGMENT_DIR)/hitachi-sh \
-$(MAGIC_FRAGMENT_DIR)/hp \
-$(MAGIC_FRAGMENT_DIR)/human68k \
-$(MAGIC_FRAGMENT_DIR)/ibm370 \
-$(MAGIC_FRAGMENT_DIR)/ibm6000 \
-$(MAGIC_FRAGMENT_DIR)/iff \
-$(MAGIC_FRAGMENT_DIR)/images \
-$(MAGIC_FRAGMENT_DIR)/inform \
-$(MAGIC_FRAGMENT_DIR)/intel \
-$(MAGIC_FRAGMENT_DIR)/interleaf \
-$(MAGIC_FRAGMENT_DIR)/island \
-$(MAGIC_FRAGMENT_DIR)/ispell \
-$(MAGIC_FRAGMENT_DIR)/isz \
-$(MAGIC_FRAGMENT_DIR)/java \
-$(MAGIC_FRAGMENT_DIR)/jpeg \
-$(MAGIC_FRAGMENT_DIR)/karma \
-$(MAGIC_FRAGMENT_DIR)/kde \
-$(MAGIC_FRAGMENT_DIR)/kml \
-$(MAGIC_FRAGMENT_DIR)/lecter \
-$(MAGIC_FRAGMENT_DIR)/lex \
-$(MAGIC_FRAGMENT_DIR)/lif \
-$(MAGIC_FRAGMENT_DIR)/linux \
-$(MAGIC_FRAGMENT_DIR)/lisp \
-$(MAGIC_FRAGMENT_DIR)/llvm \
-$(MAGIC_FRAGMENT_DIR)/lua \
-$(MAGIC_FRAGMENT_DIR)/luks \
-$(MAGIC_FRAGMENT_DIR)/m4 \
-$(MAGIC_FRAGMENT_DIR)/mach \
-$(MAGIC_FRAGMENT_DIR)/macintosh \
-$(MAGIC_FRAGMENT_DIR)/magic \
-$(MAGIC_FRAGMENT_DIR)/mail.news \
-$(MAGIC_FRAGMENT_DIR)/make \
-$(MAGIC_FRAGMENT_DIR)/maple \
-$(MAGIC_FRAGMENT_DIR)/marc21 \
-$(MAGIC_FRAGMENT_DIR)/mathcad \
-$(MAGIC_FRAGMENT_DIR)/mathematica \
-$(MAGIC_FRAGMENT_DIR)/matroska \
-$(MAGIC_FRAGMENT_DIR)/mcrypt \
-$(MAGIC_FRAGMENT_DIR)/mercurial \
-$(MAGIC_FRAGMENT_DIR)/metastore \
-$(MAGIC_FRAGMENT_DIR)/mime \
-$(MAGIC_FRAGMENT_DIR)/mips \
-$(MAGIC_FRAGMENT_DIR)/mirage \
-$(MAGIC_FRAGMENT_DIR)/misctools \
-$(MAGIC_FRAGMENT_DIR)/mkid \
-$(MAGIC_FRAGMENT_DIR)/mlssa \
-$(MAGIC_FRAGMENT_DIR)/mmdf \
-$(MAGIC_FRAGMENT_DIR)/modem \
-$(MAGIC_FRAGMENT_DIR)/motorola \
-$(MAGIC_FRAGMENT_DIR)/mozilla \
-$(MAGIC_FRAGMENT_DIR)/msdos \
-$(MAGIC_FRAGMENT_DIR)/msooxml \
-$(MAGIC_FRAGMENT_DIR)/msvc \
-$(MAGIC_FRAGMENT_DIR)/mup \
-$(MAGIC_FRAGMENT_DIR)/music \
-$(MAGIC_FRAGMENT_DIR)/natinst \
-$(MAGIC_FRAGMENT_DIR)/ncr \
-$(MAGIC_FRAGMENT_DIR)/netbsd \
-$(MAGIC_FRAGMENT_DIR)/netscape \
-$(MAGIC_FRAGMENT_DIR)/netware \
-$(MAGIC_FRAGMENT_DIR)/news \
-$(MAGIC_FRAGMENT_DIR)/nitpicker \
-$(MAGIC_FRAGMENT_DIR)/oasis \
-$(MAGIC_FRAGMENT_DIR)/ocaml \
-$(MAGIC_FRAGMENT_DIR)/octave \
-$(MAGIC_FRAGMENT_DIR)/ole2compounddocs \
-$(MAGIC_FRAGMENT_DIR)/olf \
-$(MAGIC_FRAGMENT_DIR)/os2 \
-$(MAGIC_FRAGMENT_DIR)/os400 \
-$(MAGIC_FRAGMENT_DIR)/os9 \
-$(MAGIC_FRAGMENT_DIR)/osf1 \
-$(MAGIC_FRAGMENT_DIR)/palm \
-$(MAGIC_FRAGMENT_DIR)/parix \
-$(MAGIC_FRAGMENT_DIR)/parrot \
-$(MAGIC_FRAGMENT_DIR)/pascal \
-$(MAGIC_FRAGMENT_DIR)/pbm \
-$(MAGIC_FRAGMENT_DIR)/pdf \
-$(MAGIC_FRAGMENT_DIR)/pdp \
-$(MAGIC_FRAGMENT_DIR)/perl \
-$(MAGIC_FRAGMENT_DIR)/pgp \
-$(MAGIC_FRAGMENT_DIR)/pkgadd \
-$(MAGIC_FRAGMENT_DIR)/plan9 \
-$(MAGIC_FRAGMENT_DIR)/plus5 \
-$(MAGIC_FRAGMENT_DIR)/printer \
-$(MAGIC_FRAGMENT_DIR)/project \
-$(MAGIC_FRAGMENT_DIR)/psdbms \
-$(MAGIC_FRAGMENT_DIR)/pulsar \
-$(MAGIC_FRAGMENT_DIR)/pyramid \
-$(MAGIC_FRAGMENT_DIR)/python \
-$(MAGIC_FRAGMENT_DIR)/revision \
-$(MAGIC_FRAGMENT_DIR)/riff \
-$(MAGIC_FRAGMENT_DIR)/rinex \
-$(MAGIC_FRAGMENT_DIR)/rpm \
-$(MAGIC_FRAGMENT_DIR)/rtf \
-$(MAGIC_FRAGMENT_DIR)/ruby \
-$(MAGIC_FRAGMENT_DIR)/sc \
-$(MAGIC_FRAGMENT_DIR)/sccs \
-$(MAGIC_FRAGMENT_DIR)/scientific \
-$(MAGIC_FRAGMENT_DIR)/securitycerts \
-$(MAGIC_FRAGMENT_DIR)/selinux \
-$(MAGIC_FRAGMENT_DIR)/sendmail \
-$(MAGIC_FRAGMENT_DIR)/sequent \
-$(MAGIC_FRAGMENT_DIR)/sgi \
-$(MAGIC_FRAGMENT_DIR)/sgml \
-$(MAGIC_FRAGMENT_DIR)/sharc \
-$(MAGIC_FRAGMENT_DIR)/sinclair \
-$(MAGIC_FRAGMENT_DIR)/sisu \
-$(MAGIC_FRAGMENT_DIR)/sketch \
-$(MAGIC_FRAGMENT_DIR)/smalltalk \
-$(MAGIC_FRAGMENT_DIR)/smile \
-$(MAGIC_FRAGMENT_DIR)/sniffer \
-$(MAGIC_FRAGMENT_DIR)/softquad \
-$(MAGIC_FRAGMENT_DIR)/spec \
-$(MAGIC_FRAGMENT_DIR)/spectrum \
-$(MAGIC_FRAGMENT_DIR)/sql \
-$(MAGIC_FRAGMENT_DIR)/ssh \
-$(MAGIC_FRAGMENT_DIR)/ssl \
-$(MAGIC_FRAGMENT_DIR)/sun \
-$(MAGIC_FRAGMENT_DIR)/sysex \
-$(MAGIC_FRAGMENT_DIR)/tcl \
-$(MAGIC_FRAGMENT_DIR)/teapot \
-$(MAGIC_FRAGMENT_DIR)/terminfo \
-$(MAGIC_FRAGMENT_DIR)/tex \
-$(MAGIC_FRAGMENT_DIR)/tgif \
-$(MAGIC_FRAGMENT_DIR)/ti-8x \
-$(MAGIC_FRAGMENT_DIR)/timezone \
-$(MAGIC_FRAGMENT_DIR)/troff \
-$(MAGIC_FRAGMENT_DIR)/tuxedo \
-$(MAGIC_FRAGMENT_DIR)/typeset \
-$(MAGIC_FRAGMENT_DIR)/unicode \
-$(MAGIC_FRAGMENT_DIR)/unknown \
-$(MAGIC_FRAGMENT_DIR)/uuencode \
-$(MAGIC_FRAGMENT_DIR)/varied.out \
-$(MAGIC_FRAGMENT_DIR)/varied.script \
-$(MAGIC_FRAGMENT_DIR)/vax \
-$(MAGIC_FRAGMENT_DIR)/vicar \
-$(MAGIC_FRAGMENT_DIR)/virtual \
-$(MAGIC_FRAGMENT_DIR)/virtutech \
-$(MAGIC_FRAGMENT_DIR)/visx \
-$(MAGIC_FRAGMENT_DIR)/vms \
-$(MAGIC_FRAGMENT_DIR)/vmware \
-$(MAGIC_FRAGMENT_DIR)/vorbis \
-$(MAGIC_FRAGMENT_DIR)/vxl \
-$(MAGIC_FRAGMENT_DIR)/warc \
-$(MAGIC_FRAGMENT_DIR)/weak \
-$(MAGIC_FRAGMENT_DIR)/windows \
-$(MAGIC_FRAGMENT_DIR)/wireless \
-$(MAGIC_FRAGMENT_DIR)/wordprocessors \
-$(MAGIC_FRAGMENT_DIR)/wsdl \
-$(MAGIC_FRAGMENT_DIR)/xdelta \
-$(MAGIC_FRAGMENT_DIR)/xenix \
-$(MAGIC_FRAGMENT_DIR)/xilinx \
-$(MAGIC_FRAGMENT_DIR)/xo65 \
-$(MAGIC_FRAGMENT_DIR)/xwindows \
-$(MAGIC_FRAGMENT_DIR)/zfs \
-$(MAGIC_FRAGMENT_DIR)/zilog \
-$(MAGIC_FRAGMENT_DIR)/zyxel 
-
-MAGIC = magic.mgc
-CLEANFILES = ${MAGIC} $(MAGIC_FRAGMENT_DIR)/Localstuff
-@IS_CROSS_COMPILE_FALSE@FILE_COMPILE = $(top_builddir)/src/file
-
-# FIXME: Build file natively as well so that it can be used to compile
-# the target's magic file; for now we bail if the local version does not match
-@IS_CROSS_COMPILE_TRUE@FILE_COMPILE = file
-@IS_CROSS_COMPILE_FALSE@FILE_COMPILE_DEP = $(FILE_COMPILE)
-@IS_CROSS_COMPILE_TRUE@FILE_COMPILE_DEP = 
-all: all-am
+ACLOCAL_AMFLAGS = -I m4
+EXTRA_DIST = MAINT
+SUBDIRS = src magic tests doc python
+all: config.h
+	$(MAKE) $(AM_MAKEFLAGS) all-recursive
 
 .SUFFIXES:
+am--refresh: Makefile
+	@:
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
+	      $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
+		&& exit 0; \
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu magic/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu magic/Makefile
+	  $(AUTOMAKE) --foreign Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
-	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	    echo ' $(SHELL) ./config.status'; \
+	    $(SHELL) ./config.status;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
 	esac;
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+	$(SHELL) ./config.status --recheck
 
 $(top_srcdir)/configure:  $(am__configure_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+	$(am__cd) $(srcdir) && $(AUTOCONF)
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+	$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
 $(am__aclocal_m4_deps):
 
+config.h: stamp-h1
+	@test -f $@ || rm -f stamp-h1
+	@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+	@rm -f stamp-h1
+	cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in:  $(am__configure_deps) 
+	($(am__cd) $(top_srcdir) && $(AUTOHEADER))
+	rm -f stamp-h1
+	touch $@
+
+distclean-hdr:
+	-rm -f config.h stamp-h1
+
 mostlyclean-libtool:
 	-rm -f *.lo
 
 clean-libtool:
 	-rm -rf .libs _libs
-install-pkgdataDATA: $(pkgdata_DATA)
-	@$(NORMAL_INSTALL)
-	test -z "$(pkgdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)"
-	@list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
-	for p in $$list; do \
-	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  echo "$$d$$p"; \
-	done | $(am__base_list) | \
-	while read files; do \
-	  echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgdatadir)'"; \
-	  $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgdatadir)" || exit $$?; \
-	done
 
-uninstall-pkgdataDATA:
-	@$(NORMAL_UNINSTALL)
-	@list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
-	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	test -n "$$files" || exit 0; \
-	echo " ( cd '$(DESTDIR)$(pkgdatadir)' && rm -f" $$files ")"; \
-	cd "$(DESTDIR)$(pkgdatadir)" && rm -f $$files
-tags: TAGS
-TAGS:
+distclean-libtool:
+	-rm -f libtool config.lt
 
-ctags: CTAGS
-CTAGS:
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+#     (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(am__recursive_targets):
+	@fail=; \
+	if $(am__make_keepgoing); then \
+	  failcom='fail=yes'; \
+	else \
+	  failcom='exit 1'; \
+	fi; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
 
+ID: $(am__tagged_files)
+	$(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-recursive
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	set x; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	$(am__define_uniq_tagged_files); \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: ctags-recursive
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	$(am__define_uniq_tagged_files); \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+cscope: cscope.files
+	test ! -s cscope.files \
+	  || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
+clean-cscope:
+	-rm -f cscope.files
+cscope.files: clean-cscope cscopelist
+cscopelist: cscopelist-recursive
+
+cscopelist-am: $(am__tagged_files)
+	list='$(am__tagged_files)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+	-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
 
 distdir: $(DISTFILES)
+	$(am__remove_distdir)
+	test -d "$(distdir)" || mkdir "$(distdir)"
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -549,31 +518,188 @@ distdir: $(DISTFILES)
 	    || exit 1; \
 	  fi; \
 	done
-check-am: all-am
-check: check-am
-all-am: Makefile $(DATA)
-installdirs:
-	for dir in "$(DESTDIR)$(pkgdatadir)"; do \
-	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    $(am__make_dryrun) \
+	      || test -d "$(distdir)/$$subdir" \
+	      || $(MKDIR_P) "$(distdir)/$$subdir" \
+	      || exit 1; \
+	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+	    $(am__relativize); \
+	    new_distdir=$$reldir; \
+	    dir1=$$subdir; dir2="$(top_distdir)"; \
+	    $(am__relativize); \
+	    new_top_distdir=$$reldir; \
+	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+	    ($(am__cd) $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$new_top_distdir" \
+	        distdir="$$new_distdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+		am__skip_mode_fix=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
 	done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
+	-test -n "$(am__skip_mode_fix)" \
+	|| find "$(distdir)" -type d ! -perm -755 \
+		-exec chmod u+rwx,go+rx {} \; -o \
+	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+	  ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+	|| chmod -R a+r "$(distdir)"
+dist-gzip: distdir
+	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	$(am__post_remove_distdir)
+
+dist-bzip2: distdir
+	tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
+	$(am__post_remove_distdir)
+
+dist-lzip: distdir
+	tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
+	$(am__post_remove_distdir)
+
+dist-xz: distdir
+	tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
+	$(am__post_remove_distdir)
+
+dist-tarZ: distdir
+	@echo WARNING: "Support for shar distribution archives is" \
+	               "deprecated." >&2
+	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
+	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+	$(am__post_remove_distdir)
+
+dist-shar: distdir
+	@echo WARNING: "Support for distribution archives compressed with" \
+		       "legacy program 'compress' is deprecated." >&2
+	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
+	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+	$(am__post_remove_distdir)
+
+dist-zip: distdir
+	-rm -f $(distdir).zip
+	zip -rq $(distdir).zip $(distdir)
+	$(am__post_remove_distdir)
+
+dist dist-all:
+	$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
+	$(am__post_remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration.  Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+	case '$(DIST_ARCHIVES)' in \
+	*.tar.gz*) \
+	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+	*.tar.bz2*) \
+	  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
+	*.tar.lz*) \
+	  lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
+	*.tar.xz*) \
+	  xz -dc $(distdir).tar.xz | $(am__untar) ;;\
+	*.tar.Z*) \
+	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+	*.shar.gz*) \
+	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+	*.zip*) \
+	  unzip $(distdir).zip ;;\
+	esac
+	chmod -R a-w $(distdir)
+	chmod u+w $(distdir)
+	mkdir $(distdir)/_build $(distdir)/_inst
+	chmod a-w $(distdir)
+	test -d $(distdir)/_build || exit 0; \
+	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+	  && am__cwd=`pwd` \
+	  && $(am__cd) $(distdir)/_build \
+	  && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+	    $(AM_DISTCHECK_CONFIGURE_FLAGS) \
+	    $(DISTCHECK_CONFIGURE_FLAGS) \
+	  && $(MAKE) $(AM_MAKEFLAGS) \
+	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
+	  && $(MAKE) $(AM_MAKEFLAGS) check \
+	  && $(MAKE) $(AM_MAKEFLAGS) install \
+	  && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+	  && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+	  && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+	        distuninstallcheck \
+	  && chmod -R a-w "$$dc_install_base" \
+	  && ({ \
+	       (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+	            distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+	      } || { rm -rf "$$dc_destdir"; exit 1; }) \
+	  && rm -rf "$$dc_destdir" \
+	  && $(MAKE) $(AM_MAKEFLAGS) dist \
+	  && rm -rf $(DIST_ARCHIVES) \
+	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+	  && cd "$$am__cwd" \
+	  || exit 1
+	$(am__post_remove_distdir)
+	@(echo "$(distdir) archives ready for distribution: "; \
+	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+	  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+	@test -n '$(distuninstallcheck_dir)' || { \
+	  echo 'ERROR: trying to run $@ with an empty' \
+	       '$$(distuninstallcheck_dir)' >&2; \
+	  exit 1; \
+	}; \
+	$(am__cd) '$(distuninstallcheck_dir)' || { \
+	  echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
+	  exit 1; \
+	}; \
+	test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
+	   || { echo "ERROR: files left after uninstall:" ; \
+	        if test -n "$(DESTDIR)"; then \
+	          echo "  (check DESTDIR support)"; \
+	        fi ; \
+	        $(distuninstallcheck_listfiles) ; \
+	        exit 1; } >&2
+distcleancheck: distclean
+	@if test '$(srcdir)' = . ; then \
+	  echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+	  exit 1 ; \
+	fi
+	@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+	  || { echo "ERROR: files left in build directory after distclean:" ; \
+	       $(distcleancheck_listfiles) ; \
+	       exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile config.h
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
 
 install-am: all-am
 	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
 
-installcheck: installcheck-am
+installcheck: installcheck-recursive
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
-	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -582,104 +708,96 @@ distclean-generic:
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
+clean: clean-recursive
 
 clean-am: clean-generic clean-libtool mostlyclean-am
 
-distclean: distclean-am
+distclean: distclean-recursive
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
 	-rm -f Makefile
-distclean-am: clean-am distclean-generic
+distclean-am: clean-am distclean-generic distclean-hdr \
+	distclean-libtool distclean-tags
 
-dvi: dvi-am
+dvi: dvi-recursive
 
 dvi-am:
 
-html: html-am
+html: html-recursive
 
 html-am:
 
-info: info-am
+info: info-recursive
 
 info-am:
 
-install-data-am: install-pkgdataDATA
+install-data-am:
 
-install-dvi: install-dvi-am
+install-dvi: install-dvi-recursive
 
 install-dvi-am:
 
 install-exec-am:
 
-install-html: install-html-am
+install-html: install-html-recursive
 
 install-html-am:
 
-install-info: install-info-am
+install-info: install-info-recursive
 
 install-info-am:
 
 install-man:
 
-install-pdf: install-pdf-am
+install-pdf: install-pdf-recursive
 
 install-pdf-am:
 
-install-ps: install-ps-am
+install-ps: install-ps-recursive
 
 install-ps-am:
 
 installcheck-am:
 
-maintainer-clean: maintainer-clean-am
+maintainer-clean: maintainer-clean-recursive
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
+	-rm -rf $(top_srcdir)/autom4te.cache
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
-mostlyclean: mostlyclean-am
+mostlyclean: mostlyclean-recursive
 
 mostlyclean-am: mostlyclean-generic mostlyclean-libtool
 
-pdf: pdf-am
+pdf: pdf-recursive
 
 pdf-am:
 
-ps: ps-am
+ps: ps-recursive
 
 ps-am:
 
-uninstall-am: uninstall-pkgdataDATA
+uninstall-am:
 
-.MAKE: install-am install-strip
+.MAKE: $(am__recursive_targets) all install-am install-strip
 
-.PHONY: all all-am check check-am clean clean-generic clean-libtool \
-	distclean distclean-generic distclean-libtool distdir dvi \
-	dvi-am html html-am info info-am install install-am \
-	install-data install-data-am install-dvi install-dvi-am \
-	install-exec install-exec-am install-html install-html-am \
-	install-info install-info-am install-man install-pdf \
-	install-pdf-am install-pkgdataDATA install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	uninstall uninstall-am uninstall-pkgdataDATA
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
+	am--refresh check check-am clean clean-cscope clean-generic \
+	clean-libtool cscope cscopelist-am ctags ctags-am dist \
+	dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \
+	dist-xz dist-zip distcheck distclean distclean-generic \
+	distclean-hdr distclean-libtool distclean-tags distcleancheck \
+	distdir distuninstallcheck dvi dvi-am html html-am info \
+	info-am install install-am install-data install-data-am \
+	install-dvi install-dvi-am install-exec install-exec-am \
+	install-html install-html-am install-info install-info-am \
+	install-man install-pdf install-pdf-am install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
+	installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
+	uninstall-am
 
 
-${MAGIC}: $(EXTRA_DIST) $(FILE_COMPILE_DEP)
-	@rm -fr magic
-	@mkdir magic && cp -p $(EXTRA_DIST) magic
-	@(if expr "${FILE_COMPILE}" : '.*/.*' > /dev/null; then \
-	    echo "Using ${FILE_COMPILE} to generate ${MAGIC}" > /dev/null; \
-	  else \
-	    v=$$(file --version | sed -e s/file-// -e q); \
-	    if [ "$$v" != "${PACKAGE_VERSION}" ]; then \
-		echo "Cannot use the installed version of file ($$v) to"; \
-		echo "cross-compile file ${PACKAGE_VERSION}"; \
-		echo "Please install file ${PACKAGE_VERSION} locally first"; \
-		exit 1; \
-	    fi; \
-	  fi)
-	$(FILE_COMPILE) -C -m magic
-	@rm -fr magic
-
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/contrib/file/README b/contrib/file/README
index 2b57a70624f..cfc530f520e 100644
--- a/contrib/file/README
+++ b/contrib/file/README
@@ -1,10 +1,14 @@
-** README for file(1) Command **
-@(#) $File: README,v 1.44 2011/03/24 13:03:39 rrt Exp $
+## README for file(1) Command ##
 
-Mailing List: file@mx.gw.com
-Bug tracker: http://bugs.gw.com/
+    @(#) $File: README,v 1.48 2014/03/07 13:55:30 christos Exp $
+
+Mailing List: file@mx.gw.com  
+Mailing List archives: http://mx.gw.com/pipermail/file/  
+Bug tracker: http://bugs.gw.com/  
 E-mail: christos@astron.com
 
+[![Build Status](https://travis-ci.org/file/file.png?branch=master)](https://travis-ci.org/file/file)
+
 Phone: Do not even think of telephoning me about this program. Send cash first!
 
 This is Release 5.x of Ian Darwin's (copyright but distributable)
@@ -13,13 +17,13 @@ It knows the 'magic number' of several thousands of file types.
 This version is the standard "file" command for Linux,
 *BSD, and other systems. (See "patchlevel.h" for the exact release number).
 
-You can download the latest version of file from:
+You can download the latest version of the original sources for file from:
 
 	ftp://ftp.astron.com/pub/file/
 
-A public read-only git repository is available at:
+A public read-only git repository of the same sources is available at:
 
-	https://github.com/glensc/file
+	https://github.com/file/file
 
 The major changes for 5.x are CDF file parsing, indirect magic, and
 overhaul in mime and ascii encoding handling.
@@ -28,7 +32,7 @@ The major feature of 4.x is the refactoring of the code into a library,
 and the re-write of the file command in terms of that library. The library
 itself, libmagic can be used by 3rd party programs that wish to identify
 file types without having to fork() and exec() file. The prime contributor
-for 4.0 was M\xe5ns Rullg\xe5rd.
+for 4.0 was Mans Rullgard.
 
 UNIX is a trademark of UNIX System Laboratories.
 
@@ -60,38 +64,42 @@ magic numbers assigned to all sorts of data files that
 are in reasonable circulation. Send your magic numbers,
 in magic(5) format please, to the maintainer, Christos Zoulas.
 
-COPYING - read this first.
-README - read this second (you are currently reading this file).
+COPYING - read this first.  
+README - read this second (you are currently reading this file).  
 INSTALL - read on how to install
 
-src/apprentice.c - parses /etc/magic to learn magic
-src/apptype.c - used for OS/2 specific application type magic
-src/asprintf.c - replacement for OS's that don't have it.
-src/ascmagic.c - third & last set of tests, based on hardwired assumptions.
-src/cdf.c - parser for Microsoft Compound Document Files
-src/cdf_time.c - time converter for CDF.
-src/compress.c - handles decompressing files to look inside.
-src/encoding.c - handles unicode encodings
-src/file.c - the main program
-src/file.h - header file
-src/fsmagic.c - first set of tests the program runs, based on filesystem info
-src/funcs.c - utilility functions
-src/getopt_long.c - used for OS/2 specific application type magic
-src/is_tar.c, tar.h - knows about tarchives (courtesy John Gilmore).
-src/names.h - header file for ascmagic.c
-src/magic.c - the libmagic api
-src/print.c - print results, errors, warnings.
-src/readcdf.c - CDF wrapper.
-src/readelf.[ch] - Stand-alone elf parsing code.
-src/softmagic.c - 2nd set of tests, based on /etc/magic
-src/strlcat.c - used for OS/2 specific application type magic
-src/strlcpy.c - used for OS/2 specific application type magic
-src/vasprintf.c - used for OS/2 specific application type magic
-doc/file.1 - man page for the command
-doc/magic.4 - man page for the magic file, courtesy Guy Harris.
+src/apprentice.c - parses /etc/magic to learn magic  
+src/apptype.c - used for OS/2 specific application type magic  
+src/asprintf.c - replacement for OS's that don't have it.  
+src/ascmagic.c - third & last set of tests, based on hardwired assumptions.  
+src/asctime_r.c - for systems that don't have it.  
+src/asprintf.c - for systems that don't have it.  
+src/cdf.c - parser for Microsoft Compound Document Files  
+src/cdf_time.c - time converter for CDF.  
+src/compress.c - handles decompressing files to look inside.  
+src/ctime_r.c - for systems that don't have it.  
+src/encoding.c - handles unicode encodings  
+src/file.c - the main program  
+src/file.h - header file  
+src/fsmagic.c - first set of tests the program runs, based on filesystem info  
+src/funcs.c - utilility functions  
+src/getopt_long.c - for systems that don't have it.  
+src/getline.c - for systems that don't have it.  
+src/is_tar.c, tar.h - knows about tarchives (courtesy John Gilmore).  
+src/names.h - header file for ascmagic.c  
+src/magic.c - the libmagic api  
+src/print.c - print results, errors, warnings.  
+src/readcdf.c - CDF wrapper.  
+src/readelf.[ch] - Stand-alone elf parsing code.  
+src/softmagic.c - 2nd set of tests, based on /etc/magic  
+src/strlcat.c - for systems that don't have it.  
+src/strlcpy.c - for systems that don't have it.  
+src/vasprintf.c - for systems that don't have it.  
+doc/file.man - man page for the command  
+doc/magic.man - man page for the magic file, courtesy Guy Harris.
 	Install as magic.4 on USG and magic.5 on V7 or Berkeley; cf Makefile.
-Magdir - directory of /etc/magic pieces
 
+Magdir - directory of /etc/magic pieces
 ------------------------------------------------------------------------------
 
 If you submit a new magic entry please make sure you read the following
diff --git a/contrib/file/TODO b/contrib/file/TODO
index bdfbdc4146d..f78893f4939 100644
--- a/contrib/file/TODO
+++ b/contrib/file/TODO
@@ -1,6 +1,17 @@
-TODOs live in the TODO section of doc/file.man (i.e. file(1)). They
-are more visible there, so please add any further TODOs to that file,
-not here.
+Most TODOs live in the TODO section of doc/file.man (i.e. file(1)).
+They are more visible there, so please add any further TODOs to that
+file, not here. More speculative material can live here.
 
 (This change was made when Reuben Thomas noticed that all the bugs
 listed in the BUGS section of the man page had been fixed!)
+
+---
+
+It would be nice to simplify file considerably. For example,
+reimplement the apprentice and non-pattern magic methods in Python,
+and compile the magic patterns to a giant regex (or something similar;
+maybe using Ragel (http://www.complang.org/ragel/)) so that only a
+small amount of C is needed (because fast execution is typically only
+required for soft magic, not the more detailed information given by
+hard-wired routines). In this regard, note that hplip, which is
+BSD-licensed, has a magic reimplementation in Python.
diff --git a/contrib/file/aclocal.m4 b/contrib/file/aclocal.m4
index 3a7e27a80ab..a9ddc4b1f9d 100644
--- a/contrib/file/aclocal.m4
+++ b/contrib/file/aclocal.m4
@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
+# generated automatically by aclocal 1.14 -*- Autoconf -*-
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -11,15 +11,94 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
+m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
-[m4_warning([this file was generated for autoconf 2.68.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
+[m4_warning([this file was generated for autoconf 2.69.
 You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
-To do so, use the procedure documented by the package, typically `autoreconf'.])])
+To do so, use the procedure documented by the package, typically 'autoreconf'.])])
 
-# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# visibility.m4 serial 5 (gettext-0.18.2)
+dnl Copyright (C) 2005, 2008, 2010-2013 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+dnl Tests whether the compiler supports the command-line option
+dnl -fvisibility=hidden and the function and variable attributes
+dnl __attribute__((__visibility__("hidden"))) and
+dnl __attribute__((__visibility__("default"))).
+dnl Does *not* test for __visibility__("protected") - which has tricky
+dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on
+dnl Mac OS X.
+dnl Does *not* test for __visibility__("internal") - which has processor
+dnl dependent semantics.
+dnl Does *not* test for #pragma GCC visibility push(hidden) - which is
+dnl "really only recommended for legacy code".
+dnl Set the variable CFLAG_VISIBILITY.
+dnl Defines and sets the variable HAVE_VISIBILITY.
+
+AC_DEFUN([gl_VISIBILITY],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  CFLAG_VISIBILITY=
+  HAVE_VISIBILITY=0
+  if test -n "$GCC"; then
+    dnl First, check whether -Werror can be added to the command line, or
+    dnl whether it leads to an error because of some other option that the
+    dnl user has put into $CC $CFLAGS $CPPFLAGS.
+    AC_MSG_CHECKING([whether the -Werror option is usable])
+    AC_CACHE_VAL([gl_cv_cc_vis_werror], [
+      gl_save_CFLAGS="$CFLAGS"
+      CFLAGS="$CFLAGS -Werror"
+      AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM([[]], [[]])],
+        [gl_cv_cc_vis_werror=yes],
+        [gl_cv_cc_vis_werror=no])
+      CFLAGS="$gl_save_CFLAGS"])
+    AC_MSG_RESULT([$gl_cv_cc_vis_werror])
+    dnl Now check whether visibility declarations are supported.
+    AC_MSG_CHECKING([for simple visibility declarations])
+    AC_CACHE_VAL([gl_cv_cc_visibility], [
+      gl_save_CFLAGS="$CFLAGS"
+      CFLAGS="$CFLAGS -fvisibility=hidden"
+      dnl We use the option -Werror and a function dummyfunc, because on some
+      dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning
+      dnl "visibility attribute not supported in this configuration; ignored"
+      dnl at the first function definition in every compilation unit, and we
+      dnl don't want to use the option in this case.
+      if test $gl_cv_cc_vis_werror = yes; then
+        CFLAGS="$CFLAGS -Werror"
+      fi
+      AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[extern __attribute__((__visibility__("hidden"))) int hiddenvar;
+             extern __attribute__((__visibility__("default"))) int exportedvar;
+             extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
+             extern __attribute__((__visibility__("default"))) int exportedfunc (void);
+             void dummyfunc (void) {}
+           ]],
+           [[]])],
+        [gl_cv_cc_visibility=yes],
+        [gl_cv_cc_visibility=no])
+      CFLAGS="$gl_save_CFLAGS"])
+    AC_MSG_RESULT([$gl_cv_cc_visibility])
+    if test $gl_cv_cc_visibility = yes; then
+      CFLAG_VISIBILITY="-fvisibility=hidden"
+      HAVE_VISIBILITY=1
+    fi
+  fi
+  AC_SUBST([CFLAG_VISIBILITY])
+  AC_SUBST([HAVE_VISIBILITY])
+  AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY],
+    [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.])
+])
+
+# Copyright (C) 2002-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -31,10 +110,10 @@ To do so, use the procedure documented by the package, typically `autoreconf'.])
 # generated from the m4 files accompanying Automake X.Y.
 # (This private macro should not be called outside this file.)
 AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.11'
+[am__api_version='1.14'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.11.1], [],
+m4_if([$1], [1.14], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -50,22 +129,22 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11.1])dnl
+[AM_AUTOMAKE_VERSION([1.14])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
-# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
-# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
+# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
 #
 # Of course, Automake must honor this variable whenever it calls a
 # tool from the auxiliary directory.  The problem is that $srcdir (and
@@ -84,7 +163,7 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 #
 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
 # are both prefixed by $srcdir.  In an in-source build this is usually
-# harmless because $srcdir is `.', but things will broke when you
+# harmless because $srcdir is '.', but things will broke when you
 # start a VPATH build or use an absolute $srcdir.
 #
 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
@@ -110,22 +189,19 @@ am_aux_dir=`cd $ac_aux_dir && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1997-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 9
-
 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
 # -------------------------------------
 # Define a conditional.
 AC_DEFUN([AM_CONDITIONAL],
-[AC_PREREQ(2.52)dnl
- ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
-	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+[AC_PREREQ([2.52])dnl
+ m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
 AC_SUBST([$1_TRUE])dnl
 AC_SUBST([$1_FALSE])dnl
 _AM_SUBST_NOTMAKE([$1_TRUE])dnl
@@ -144,16 +220,14 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
-# Free Software Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 10
 
-# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
 # written in clear, in which case automake, when reading aclocal.m4,
 # will think it sees a *use*, and therefore will trigger all it's
 # C support machinery.  Also note that it means that autoscan, seeing
@@ -163,7 +237,7 @@ fi])])
 # _AM_DEPENDENCIES(NAME)
 # ----------------------
 # See how the compiler implements dependency checking.
-# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
 # We try a few techniques and use that to set a single cache variable.
 #
 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
@@ -176,12 +250,13 @@ AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
 AC_REQUIRE([AM_MAKE_INCLUDE])dnl
 AC_REQUIRE([AM_DEP_TRACK])dnl
 
-ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
-       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
-       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
-       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
-       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
-                   [depcc="$$1"   am_compiler_list=])
+m4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
+      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
+      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
+      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
+      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                    [depcc="$$1"   am_compiler_list=])
 
 AC_CACHE_CHECK([dependency style of $depcc],
                [am_cv_$1_dependencies_compiler_type],
@@ -189,8 +264,9 @@ AC_CACHE_CHECK([dependency style of $depcc],
   # We make a subdir and do the tests there.  Otherwise we can end up
   # making bogus files that we don't know about and never remove.  For
   # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named `D' -- because `-MD' means `put the output
-  # in D'.
+  # making a dummy file named 'D' -- because '-MD' means "put the output
+  # in D".
+  rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
   # using a relative directory.
@@ -229,16 +305,16 @@ AC_CACHE_CHECK([dependency style of $depcc],
     : > sub/conftest.c
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
+      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+      # Solaris 10 /bin/sh.
+      echo '/* dummy */' > sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # We check with '-c' and '-o' for the sake of the "dashmstdout"
     # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.  Also, some Intel
-    # versions had trouble with output in subdirs
+    # handle '-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs.
     am__obj=sub/conftest.${OBJEXT-o}
     am__minus_obj="-o $am__obj"
     case $depmode in
@@ -247,16 +323,16 @@ AC_CACHE_CHECK([dependency style of $depcc],
       test "$am__universal" = false || continue
       ;;
     nosideeffect)
-      # after this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested
+      # After this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested.
       if test "x$enable_dependency_tracking" = xyes; then
 	continue
       else
 	break
       fi
       ;;
-    msvisualcpp | msvcmsys)
-      # This compiler won't grok `-c -o', but also, the minuso test has
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+      # This compiler won't grok '-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
       am__obj=conftest.${OBJEXT-o}
@@ -304,7 +380,7 @@ AM_CONDITIONAL([am__fastdep$1], [
 # AM_SET_DEPDIR
 # -------------
 # Choose a directory name for dependency files.
-# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
 AC_DEFUN([AM_SET_DEPDIR],
 [AC_REQUIRE([AM_SET_LEADING_DOT])dnl
 AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
@@ -314,34 +390,39 @@ AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
 # AM_DEP_TRACK
 # ------------
 AC_DEFUN([AM_DEP_TRACK],
-[AC_ARG_ENABLE(dependency-tracking,
-[  --disable-dependency-tracking  speeds up one-time build
-  --enable-dependency-tracking   do not reject slow dependency extractors])
+[AC_ARG_ENABLE([dependency-tracking], [dnl
+AS_HELP_STRING(
+  [--enable-dependency-tracking],
+  [do not reject slow dependency extractors])
+AS_HELP_STRING(
+  [--disable-dependency-tracking],
+  [speeds up one-time build])])
 if test "x$enable_dependency_tracking" != xno; then
   am_depcomp="$ac_aux_dir/depcomp"
   AMDEPBACKSLASH='\'
+  am__nodep='_no'
 fi
 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
 AC_SUBST([AMDEPBACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+AC_SUBST([am__nodep])dnl
+_AM_SUBST_NOTMAKE([am__nodep])dnl
 ])
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-#serial 5
 
 # _AM_OUTPUT_DEPENDENCY_COMMANDS
 # ------------------------------
 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
 [{
-  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # Older Autoconf quotes --file arguments for eval, but not when files
   # are listed without --file.  Let's play safe and only enable the eval
   # if we detect the quoting.
   case $CONFIG_FILES in
@@ -354,7 +435,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
     # Strip MF so we end up with the name of the file.
     mf=`echo "$mf" | sed -e 's/:.*$//'`
     # Check whether this is an Automake generated Makefile or not.
-    # We used to match only the files named `Makefile.in', but
+    # We used to match only the files named 'Makefile.in', but
     # some people rename them; so instead we look at the file content.
     # Grep'ing the first line is not enough: some people post-process
     # each Makefile.in and add a new line on top of each file to say so.
@@ -366,21 +447,19 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
       continue
     fi
     # Extract the definition of DEPDIR, am__include, and am__quote
-    # from the Makefile without running `make'.
+    # from the Makefile without running 'make'.
     DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
     test -z "$DEPDIR" && continue
     am__include=`sed -n 's/^am__include = //p' < "$mf"`
-    test -z "am__include" && continue
+    test -z "$am__include" && continue
     am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-    # When using ansi2knr, U may be empty or an underscore; expand it
-    U=`sed -n 's/^U = //p' < "$mf"`
     # Find all dependency output files, they are included files with
     # $(DEPDIR) in their names.  We invoke sed twice because it is the
     # simplest approach to changing $(DEPDIR) to its actual value in the
     # expansion.
     for file in `sed -n "
       s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
       # Make sure the directory exists.
       test -f "$dirpart/$file" && continue
       fdir=`AS_DIRNAME(["$file"])`
@@ -398,7 +477,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
 # This macro should only be invoked once -- use via AC_REQUIRE.
 #
 # This code is only required when automatic dependency tracking
-# is enabled.  FIXME.  This creates each `.P' file that we will
+# is enabled.  FIXME.  This creates each '.P' file that we will
 # need in order to bootstrap the dependency handling code.
 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 [AC_CONFIG_COMMANDS([depfiles],
@@ -406,32 +485,23 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
      [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
 ])
 
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 8
-
-# AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
-AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
-
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 16
-
 # This macro actually does too much.  Some checks are only needed if
 # your package does certain things.  But this isn't really a big deal.
 
+dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
+m4_define([AC_PROG_CC],
+m4_defn([AC_PROG_CC])
+[_AM_PROG_CC_C_O
+])
+
 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
 # AM_INIT_AUTOMAKE([OPTIONS])
 # -----------------------------------------------
@@ -444,7 +514,7 @@ AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
 # arguments mandatory, and then we can depend on a new Autoconf
 # release and drop the old call support.
 AC_DEFUN([AM_INIT_AUTOMAKE],
-[AC_PREREQ([2.62])dnl
+[AC_PREREQ([2.65])dnl
 dnl Autoconf wants to disallow AM_ names.  We explicitly allow
 dnl the ones we care about.
 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
@@ -473,31 +543,40 @@ AC_SUBST([CYGPATH_W])
 # Define the identity of the package.
 dnl Distinguish between old-style and new-style calls.
 m4_ifval([$2],
-[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+[AC_DIAGNOSE([obsolete],
+             [$0: two- and three-arguments forms are deprecated.])
+m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
  AC_SUBST([PACKAGE], [$1])dnl
  AC_SUBST([VERSION], [$2])],
 [_AM_SET_OPTIONS([$1])dnl
 dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
-m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+m4_if(
+  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
+  [ok:ok],,
   [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
  AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
  AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
 
 _AM_IF_OPTION([no-define],,
-[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
- AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
+ AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
 
 # Some tools Automake needs.
 AC_REQUIRE([AM_SANITY_CHECK])dnl
 AC_REQUIRE([AC_ARG_PROGRAM])dnl
-AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
-AM_MISSING_PROG(AUTOCONF, autoconf)
-AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
-AM_MISSING_PROG(AUTOHEADER, autoheader)
-AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
+AM_MISSING_PROG([AUTOCONF], [autoconf])
+AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
+AM_MISSING_PROG([AUTOHEADER], [autoheader])
+AM_MISSING_PROG([MAKEINFO], [makeinfo])
 AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
 AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
-AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+# For better backward compatibility.  To be removed once Automake 1.9.x
+# dies out for good.  For more background, see:
+# 
+# 
+AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
 # We need awk for the "check" target.  The system "awk" is bad on
 # some platforms.
 AC_REQUIRE([AC_PROG_AWK])dnl
@@ -508,34 +587,78 @@ _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
 			     [_AM_PROG_TAR([v7])])])
 _AM_IF_OPTION([no-dependencies],,
 [AC_PROVIDE_IFELSE([AC_PROG_CC],
-		  [_AM_DEPENDENCIES(CC)],
-		  [define([AC_PROG_CC],
-			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+		  [_AM_DEPENDENCIES([CC])],
+		  [m4_define([AC_PROG_CC],
+			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
 AC_PROVIDE_IFELSE([AC_PROG_CXX],
-		  [_AM_DEPENDENCIES(CXX)],
-		  [define([AC_PROG_CXX],
-			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+		  [_AM_DEPENDENCIES([CXX])],
+		  [m4_define([AC_PROG_CXX],
+			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
 AC_PROVIDE_IFELSE([AC_PROG_OBJC],
-		  [_AM_DEPENDENCIES(OBJC)],
-		  [define([AC_PROG_OBJC],
-			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+		  [_AM_DEPENDENCIES([OBJC])],
+		  [m4_define([AC_PROG_OBJC],
+			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
+		  [_AM_DEPENDENCIES([OBJCXX])],
+		  [m4_define([AC_PROG_OBJCXX],
+			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
 ])
-_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
-dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
-dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
-dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_REQUIRE([AM_SILENT_RULES])dnl
+dnl The testsuite driver may need to know about EXEEXT, so add the
+dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
+dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
 AC_CONFIG_COMMANDS_PRE(dnl
 [m4_provide_if([_AM_COMPILER_EXEEXT],
   [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
-])
 
-dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
+# POSIX will say in a future version that running "rm -f" with no argument
+# is OK; and we want to be able to make that assumption in our Makefile
+# recipes.  So use an aggressive probe to check that the usage we want is
+# actually supported "in the wild" to an acceptable degree.
+# See automake bug#10828.
+# To make any issue more visible, cause the running configure to be aborted
+# by default if the 'rm' program in use doesn't match our expectations; the
+# user can still override this though.
+if rm -f && rm -fr && rm -rf; then : OK; else
+  cat >&2 <<'END'
+Oops!
+
+Your 'rm' program seems unable to run without file operands specified
+on the command line, even when the '-f' option is present.  This is contrary
+to the behaviour of most rm programs out there, and not conforming with
+the upcoming POSIX standard: 
+
+Please tell bug-automake@gnu.org about your system, including the value
+of your $PATH and any error possibly output before this message.  This
+can help us improve future automake versions.
+
+END
+  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
+    echo 'Configuration will proceed anyway, since you have set the' >&2
+    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
+    echo >&2
+  else
+    cat >&2 <<'END'
+Aborting the configuration process, to ensure you take notice of the issue.
+
+You can download and install GNU coreutils to get an 'rm' implementation
+that behaves properly: .
+
+If you want to complete the configuration process using your problematic
+'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
+to "yes", and re-run configure.
+
+END
+    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
+  fi
+fi])
+
+dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
 dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
 dnl mangled by Autoconf and run in a shell conditional statement.
 m4_define([_AC_COMPILER_EXEEXT],
 m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
 
-
 # When config.status generates a header, we must update the stamp-h file.
 # This file resides in the same directory as the config header
 # that is generated.  The stamp files are numbered to have different names.
@@ -557,7 +680,7 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -576,16 +699,14 @@ if test x"${install_sh}" != xset; then
     install_sh="\${SHELL} $am_aux_dir/install-sh"
   esac
 fi
-AC_SUBST(install_sh)])
+AC_SUBST([install_sh])])
 
-# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2003-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 2
-
 # Check whether the underlying file-system supports filenames
 # with a leading dot.  For instance MS-DOS doesn't.
 AC_DEFUN([AM_SET_LEADING_DOT],
@@ -601,14 +722,12 @@ AC_SUBST([am__leading_dot])])
 
 # Check to see how 'make' treats includes.	            -*- Autoconf -*-
 
-# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 4
-
 # AM_MAKE_INCLUDE()
 # -----------------
 # Check to see how make treats includes.
@@ -626,7 +745,7 @@ am__quote=
 _am_result=none
 # First try GNU make style include.
 echo "include confinc" > confmf
-# Ignore all kinds of additional output from `make'.
+# Ignore all kinds of additional output from 'make'.
 case `$am_make -s -f confmf 2> /dev/null` in #(
 *the\ am__doit\ target*)
   am__include=include
@@ -651,52 +770,14 @@ AC_MSG_RESULT([$_am_result])
 rm -f confinc confmf
 ])
 
-# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 6
-
-# AM_PROG_CC_C_O
-# --------------
-# Like AC_PROG_CC_C_O, but changed for automake.
-AC_DEFUN([AM_PROG_CC_C_O],
-[AC_REQUIRE([AC_PROG_CC_C_O])dnl
-AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-AC_REQUIRE_AUX_FILE([compile])dnl
-# FIXME: we rely on the cache variable name because
-# there is no other way.
-set dummy $CC
-am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
-eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
-if test "$am_t" != yes; then
-   # Losing compiler, so override with the script.
-   # FIXME: It is wrong to rewrite CC.
-   # But if we don't then we get into trouble of one sort or another.
-   # A longer-term fix would be to have automake use am__CC in this case,
-   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
-   CC="$am_aux_dir/compile $CC"
-fi
-dnl Make sure AC_PROG_CC is never called again, or it will override our
-dnl setting of CC.
-m4_define([AC_PROG_CC],
-          [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
-])
-
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1997-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 6
-
 # AM_MISSING_PROG(NAME, PROGRAM)
 # ------------------------------
 AC_DEFUN([AM_MISSING_PROG],
@@ -704,11 +785,10 @@ AC_DEFUN([AM_MISSING_PROG],
 $1=${$1-"${am_missing_run}$2"}
 AC_SUBST($1)])
 
-
 # AM_MISSING_HAS_RUN
 # ------------------
-# Define MISSING if not defined so far and test if it supports --run.
-# If it does, set am_missing_run to use it, otherwise, to nothing.
+# Define MISSING if not defined so far and test if it is modern enough.
+# If it is, set am_missing_run to use it, otherwise, to nothing.
 AC_DEFUN([AM_MISSING_HAS_RUN],
 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
 AC_REQUIRE_AUX_FILE([missing])dnl
@@ -721,63 +801,35 @@ if test x"${MISSING+set}" != xset; then
   esac
 fi
 # Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
-  am_missing_run="$MISSING --run "
+if eval "$MISSING --is-lightweight"; then
+  am_missing_run="$MISSING "
 else
   am_missing_run=
-  AC_MSG_WARN([`missing' script is too old or missing])
+  AC_MSG_WARN(['missing' script is too old or missing])
 fi
 ])
 
-# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# AM_PROG_MKDIR_P
-# ---------------
-# Check for `mkdir -p'.
-AC_DEFUN([AM_PROG_MKDIR_P],
-[AC_PREREQ([2.60])dnl
-AC_REQUIRE([AC_PROG_MKDIR_P])dnl
-dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
-dnl while keeping a definition of mkdir_p for backward compatibility.
-dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
-dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
-dnl Makefile.ins that do not define MKDIR_P, so we do our own
-dnl adjustment using top_builddir (which is defined more often than
-dnl MKDIR_P).
-AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
-case $mkdir_p in
-  [[\\/$]]* | ?:[[\\/]]*) ;;
-  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
-])
-
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 4
-
 # _AM_MANGLE_OPTION(NAME)
 # -----------------------
 AC_DEFUN([_AM_MANGLE_OPTION],
 [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
 
 # _AM_SET_OPTION(NAME)
-# ------------------------------
+# --------------------
 # Set option NAME.  Presently that only means defining a flag for this option.
 AC_DEFUN([_AM_SET_OPTION],
-[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
 
 # _AM_SET_OPTIONS(OPTIONS)
-# ----------------------------------
+# ------------------------
 # OPTIONS is a space-separated list of Automake options.
 AC_DEFUN([_AM_SET_OPTIONS],
 [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
@@ -788,24 +840,82 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Check to make sure that the build environment is sane.    -*- Autoconf -*-
-
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 5
+# _AM_PROG_CC_C_O
+# ---------------
+# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
+# to automatically call this.
+AC_DEFUN([_AM_PROG_CC_C_O],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([compile])dnl
+AC_LANG_PUSH([C])dnl
+AC_CACHE_CHECK(
+  [whether $CC understands -c and -o together],
+  [am_cv_prog_cc_c_o],
+  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+  # Make sure it works both with $CC and with simple cc.
+  # Following AC_PROG_CC_C_O, we do the test twice because some
+  # compilers refuse to overwrite an existing .o file with -o,
+  # though they will create one.
+  am_cv_prog_cc_c_o=yes
+  for am_i in 1 2; do
+    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
+         && test -f conftest2.$ac_objext; then
+      : OK
+    else
+      am_cv_prog_cc_c_o=no
+      break
+    fi
+  done
+  rm -f core conftest*
+  unset am_i])
+if test "$am_cv_prog_cc_c_o" != yes; then
+   # Losing compiler, so override with the script.
+   # FIXME: It is wrong to rewrite CC.
+   # But if we don't then we get into trouble of one sort or another.
+   # A longer-term fix would be to have automake use am__CC in this case,
+   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+   CC="$am_aux_dir/compile $CC"
+fi
+AC_LANG_POP([C])])
+
+# For backward compatibility.
+AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_RUN_LOG(COMMAND)
+# -------------------
+# Run COMMAND, save the exit status in ac_status, and log it.
+# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
+AC_DEFUN([AM_RUN_LOG],
+[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
+   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   (exit $ac_status); }])
+
+# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
 # AM_SANITY_CHECK
 # ---------------
 AC_DEFUN([AM_SANITY_CHECK],
 [AC_MSG_CHECKING([whether build environment is sane])
-# Just in case
-sleep 1
-echo timestamp > conftest.file
 # Reject unsafe characters in $srcdir or the absolute working directory
 # name.  Accept space and tab only in the latter.
 am_lf='
@@ -816,32 +926,40 @@ case `pwd` in
 esac
 case $srcdir in
   *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
-    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
 esac
 
-# Do `set' in a subshell so we don't clobber the current shell's
+# Do 'set' in a subshell so we don't clobber the current shell's
 # arguments.  Must try -L first in case configure is actually a
 # symlink; some systems play weird games with the mod time of symlinks
 # (eg FreeBSD returns the mod time of the symlink's containing
 # directory).
 if (
-   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
-   if test "$[*]" = "X"; then
-      # -L didn't work.
-      set X `ls -t "$srcdir/configure" conftest.file`
-   fi
-   rm -f conftest.file
-   if test "$[*]" != "X $srcdir/configure conftest.file" \
-      && test "$[*]" != "X conftest.file $srcdir/configure"; then
-
-      # If neither matched, then we have a broken ls.  This can happen
-      # if, for instance, CONFIG_SHELL is bash and it inherits a
-      # broken ls alias from the environment.  This has actually
-      # happened.  Such a system could not be considered "sane".
-      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
-alias in your environment])
-   fi
+   am_has_slept=no
+   for am_try in 1 2; do
+     echo "timestamp, slept: $am_has_slept" > conftest.file
+     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+     if test "$[*]" = "X"; then
+	# -L didn't work.
+	set X `ls -t "$srcdir/configure" conftest.file`
+     fi
+     if test "$[*]" != "X $srcdir/configure conftest.file" \
+	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
 
+	# If neither matched, then we have a broken ls.  This can happen
+	# if, for instance, CONFIG_SHELL is bash and it inherits a
+	# broken ls alias from the environment.  This has actually
+	# happened.  Such a system could not be considered "sane".
+	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+  alias in your environment])
+     fi
+     if test "$[2]" = conftest.file || test $am_try -eq 2; then
+       break
+     fi
+     # Just in case.
+     sleep 1
+     am_has_slept=yes
+   done
    test "$[2]" = conftest.file
    )
 then
@@ -851,36 +969,85 @@ else
    AC_MSG_ERROR([newly created file is older than distributed files!
 Check your system clock])
 fi
-AC_MSG_RESULT(yes)])
+AC_MSG_RESULT([yes])
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+  ( sleep 1 ) &
+  am_sleep_pid=$!
+fi
+AC_CONFIG_COMMANDS_PRE(
+  [AC_MSG_CHECKING([that generated files are newer than configure])
+   if test -n "$am_sleep_pid"; then
+     # Hide warnings about reused PIDs.
+     wait $am_sleep_pid 2>/dev/null
+   fi
+   AC_MSG_RESULT([done])])
+rm -f conftest.file
+])
 
-# Copyright (C) 2009  Free Software Foundation, Inc.
+# Copyright (C) 2009-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
-
 # AM_SILENT_RULES([DEFAULT])
 # --------------------------
 # Enable less verbose build rules; with the default set to DEFAULT
-# (`yes' being less verbose, `no' or empty being verbose).
+# ("yes" being less verbose, "no" or empty being verbose).
 AC_DEFUN([AM_SILENT_RULES],
-[AC_ARG_ENABLE([silent-rules],
-[  --enable-silent-rules          less verbose build output (undo: `make V=1')
-  --disable-silent-rules         verbose build output (undo: `make V=0')])
-case $enable_silent_rules in
-yes) AM_DEFAULT_VERBOSITY=0;;
-no)  AM_DEFAULT_VERBOSITY=1;;
-*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
+[AC_ARG_ENABLE([silent-rules], [dnl
+AS_HELP_STRING(
+  [--enable-silent-rules],
+  [less verbose build output (undo: "make V=1")])
+AS_HELP_STRING(
+  [--disable-silent-rules],
+  [verbose build output (undo: "make V=0")])dnl
+])
+case $enable_silent_rules in @%:@ (((
+  yes) AM_DEFAULT_VERBOSITY=0;;
+   no) AM_DEFAULT_VERBOSITY=1;;
+    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
 esac
+dnl
+dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
+dnl do not support nested variable expansions.
+dnl See automake bug#9928 and bug#10237.
+am_make=${MAKE-make}
+AC_CACHE_CHECK([whether $am_make supports nested variables],
+   [am_cv_make_support_nested_variables],
+   [if AS_ECHO([['TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+	@$(TRUE)
+.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
+  am_cv_make_support_nested_variables=yes
+else
+  am_cv_make_support_nested_variables=no
+fi])
+if test $am_cv_make_support_nested_variables = yes; then
+  dnl Using '$V' instead of '$(V)' breaks IRIX make.
+  AM_V='$(V)'
+  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+  AM_V=$AM_DEFAULT_VERBOSITY
+  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AC_SUBST([AM_V])dnl
+AM_SUBST_NOTMAKE([AM_V])dnl
+AC_SUBST([AM_DEFAULT_V])dnl
+AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
 AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
 AM_BACKSLASH='\'
 AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -888,34 +1055,32 @@ _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 
 # AM_PROG_INSTALL_STRIP
 # ---------------------
-# One issue with vendor `install' (even GNU) is that you can't
+# One issue with vendor 'install' (even GNU) is that you can't
 # specify the program used to strip binaries.  This is especially
 # annoying in cross-compiling environments, where the build's strip
 # is unlikely to handle the host's binaries.
 # Fortunately install-sh will honor a STRIPPROG variable, so we
-# always use install-sh in `make install-strip', and initialize
+# always use install-sh in "make install-strip", and initialize
 # STRIPPROG with the value of the STRIP variable (set by the user).
 AC_DEFUN([AM_PROG_INSTALL_STRIP],
 [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'.  However `strip' might not be the right
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip".  However 'strip' might not be the right
 # tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
-dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+# will honor the 'STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
 if test "$cross_compiling" != no; then
   AC_CHECK_TOOL([STRIP], [strip], :)
 fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2006-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 2
-
 # _AM_SUBST_NOTMAKE(VARIABLE)
 # ---------------------------
 # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
@@ -923,24 +1088,22 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])])
 AC_DEFUN([_AM_SUBST_NOTMAKE])
 
 # AM_SUBST_NOTMAKE(VARIABLE)
-# ---------------------------
+# --------------------------
 # Public sister of _AM_SUBST_NOTMAKE.
 AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2004-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 2
-
 # _AM_PROG_TAR(FORMAT)
 # --------------------
 # Check how to create a tarball in format FORMAT.
-# FORMAT should be one of `v7', `ustar', or `pax'.
+# FORMAT should be one of 'v7', 'ustar', or 'pax'.
 #
 # Substitute a variable $(am__tar) that is a command
 # writing to stdout a FORMAT-tarball containing the directory
@@ -950,75 +1113,114 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 # Substitute a variable $(am__untar) that extract such
 # a tarball read from stdin.
 #     $(am__untar) < result.tar
+#
 AC_DEFUN([_AM_PROG_TAR],
-[# Always define AMTAR for backward compatibility.
-AM_MISSING_PROG([AMTAR], [tar])
-m4_if([$1], [v7],
-     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
-     [m4_case([$1], [ustar],, [pax],,
-              [m4_fatal([Unknown tar format])])
-AC_MSG_CHECKING([how to create a $1 tar archive])
-# Loop over all known methods to create a tar archive until one works.
+[# Always define AMTAR for backward compatibility.  Yes, it's still used
+# in the wild :-(  We should find a proper way to deprecate it ...
+AC_SUBST([AMTAR], ['$${TAR-tar}'])
+
+# We'll loop over all known methods to create a tar archive until one works.
 _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
-_am_tools=${am_cv_prog_tar_$1-$_am_tools}
-# Do not fold the above two line into one, because Tru64 sh and
-# Solaris sh will not grok spaces in the rhs of `-'.
-for _am_tool in $_am_tools
-do
-  case $_am_tool in
-  gnutar)
-    for _am_tar in tar gnutar gtar;
-    do
-      AM_RUN_LOG([$_am_tar --version]) && break
-    done
-    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
-    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
-    am__untar="$_am_tar -xf -"
-    ;;
-  plaintar)
-    # Must skip GNU tar: if it does not support --format= it doesn't create
-    # ustar tarball either.
-    (tar --version) >/dev/null 2>&1 && continue
-    am__tar='tar chf - "$$tardir"'
-    am__tar_='tar chf - "$tardir"'
-    am__untar='tar xf -'
-    ;;
-  pax)
-    am__tar='pax -L -x $1 -w "$$tardir"'
-    am__tar_='pax -L -x $1 -w "$tardir"'
-    am__untar='pax -r'
-    ;;
-  cpio)
-    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
-    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
-    am__untar='cpio -i -H $1 -d'
-    ;;
-  none)
-    am__tar=false
-    am__tar_=false
-    am__untar=false
-    ;;
-  esac
 
-  # If the value was cached, stop now.  We just wanted to have am__tar
-  # and am__untar set.
-  test -n "${am_cv_prog_tar_$1}" && break
+m4_if([$1], [v7],
+  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
 
-  # tar/untar a dummy directory, and stop if the command works
+  [m4_case([$1],
+    [ustar],
+     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
+      # There is notably a 21 bits limit for the UID and the GID.  In fact,
+      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
+      # and bug#13588).
+      am_max_uid=2097151 # 2^21 - 1
+      am_max_gid=$am_max_uid
+      # The $UID and $GID variables are not portable, so we need to resort
+      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
+      # below are definitely unexpected, so allow the users to see them
+      # (that is, avoid stderr redirection).
+      am_uid=`id -u || echo unknown`
+      am_gid=`id -g || echo unknown`
+      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
+      if test $am_uid -le $am_max_uid; then
+         AC_MSG_RESULT([yes])
+      else
+         AC_MSG_RESULT([no])
+         _am_tools=none
+      fi
+      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
+      if test $am_gid -le $am_max_gid; then
+         AC_MSG_RESULT([yes])
+      else
+        AC_MSG_RESULT([no])
+        _am_tools=none
+      fi],
+
+  [pax],
+    [],
+
+  [m4_fatal([Unknown tar format])])
+
+  AC_MSG_CHECKING([how to create a $1 tar archive])
+
+  # Go ahead even if we have the value already cached.  We do so because we
+  # need to set the values for the 'am__tar' and 'am__untar' variables.
+  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
+
+  for _am_tool in $_am_tools; do
+    case $_am_tool in
+    gnutar)
+      for _am_tar in tar gnutar gtar; do
+        AM_RUN_LOG([$_am_tar --version]) && break
+      done
+      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+      am__untar="$_am_tar -xf -"
+      ;;
+    plaintar)
+      # Must skip GNU tar: if it does not support --format= it doesn't create
+      # ustar tarball either.
+      (tar --version) >/dev/null 2>&1 && continue
+      am__tar='tar chf - "$$tardir"'
+      am__tar_='tar chf - "$tardir"'
+      am__untar='tar xf -'
+      ;;
+    pax)
+      am__tar='pax -L -x $1 -w "$$tardir"'
+      am__tar_='pax -L -x $1 -w "$tardir"'
+      am__untar='pax -r'
+      ;;
+    cpio)
+      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+      am__untar='cpio -i -H $1 -d'
+      ;;
+    none)
+      am__tar=false
+      am__tar_=false
+      am__untar=false
+      ;;
+    esac
+
+    # If the value was cached, stop now.  We just wanted to have am__tar
+    # and am__untar set.
+    test -n "${am_cv_prog_tar_$1}" && break
+
+    # tar/untar a dummy directory, and stop if the command works.
+    rm -rf conftest.dir
+    mkdir conftest.dir
+    echo GrepMe > conftest.dir/file
+    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+    rm -rf conftest.dir
+    if test -s conftest.tar; then
+      AM_RUN_LOG([$am__untar /dev/null 2>&1 && break
+    fi
+  done
   rm -rf conftest.dir
-  mkdir conftest.dir
-  echo GrepMe > conftest.dir/file
-  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
-  rm -rf conftest.dir
-  if test -s conftest.tar; then
-    AM_RUN_LOG([$am__untar /dev/null 2>&1 && break
-  fi
-done
-rm -rf conftest.dir
 
-AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
-AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+
 AC_SUBST([am__tar])
 AC_SUBST([am__untar])
 ]) # _AM_PROG_TAR
diff --git a/contrib/file/compile b/contrib/file/compile
index c0096a7b563..531136b068e 100755
--- a/contrib/file/compile
+++ b/contrib/file/compile
@@ -1,10 +1,9 @@
 #! /bin/sh
-# Wrapper for compilers which do not understand `-c -o'.
+# Wrapper for compilers which do not understand '-c -o'.
 
-scriptversion=2009-10-06.20; # UTC
+scriptversion=2012-10-14.11; # UTC
 
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009  Free Software
-# Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
 # Written by Tom Tromey .
 #
 # This program is free software; you can redistribute it and/or modify
@@ -29,21 +28,224 @@ scriptversion=2009-10-06.20; # UTC
 # bugs to  or send patches to
 # .
 
+nl='
+'
+
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent tools from complaining about whitespace usage.
+IFS=" ""	$nl"
+
+file_conv=
+
+# func_file_conv build_file lazy
+# Convert a $build file to $host form and store it in $file
+# Currently only supports Windows hosts. If the determined conversion
+# type is listed in (the comma separated) LAZY, no conversion will
+# take place.
+func_file_conv ()
+{
+  file=$1
+  case $file in
+    / | /[!/]*) # absolute file, and not a UNC file
+      if test -z "$file_conv"; then
+	# lazily determine how to convert abs files
+	case `uname -s` in
+	  MINGW*)
+	    file_conv=mingw
+	    ;;
+	  CYGWIN*)
+	    file_conv=cygwin
+	    ;;
+	  *)
+	    file_conv=wine
+	    ;;
+	esac
+      fi
+      case $file_conv/,$2, in
+	*,$file_conv,*)
+	  ;;
+	mingw/*)
+	  file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
+	  ;;
+	cygwin/*)
+	  file=`cygpath -m "$file" || echo "$file"`
+	  ;;
+	wine/*)
+	  file=`winepath -w "$file" || echo "$file"`
+	  ;;
+      esac
+      ;;
+  esac
+}
+
+# func_cl_dashL linkdir
+# Make cl look for libraries in LINKDIR
+func_cl_dashL ()
+{
+  func_file_conv "$1"
+  if test -z "$lib_path"; then
+    lib_path=$file
+  else
+    lib_path="$lib_path;$file"
+  fi
+  linker_opts="$linker_opts -LIBPATH:$file"
+}
+
+# func_cl_dashl library
+# Do a library search-path lookup for cl
+func_cl_dashl ()
+{
+  lib=$1
+  found=no
+  save_IFS=$IFS
+  IFS=';'
+  for dir in $lib_path $LIB
+  do
+    IFS=$save_IFS
+    if $shared && test -f "$dir/$lib.dll.lib"; then
+      found=yes
+      lib=$dir/$lib.dll.lib
+      break
+    fi
+    if test -f "$dir/$lib.lib"; then
+      found=yes
+      lib=$dir/$lib.lib
+      break
+    fi
+    if test -f "$dir/lib$lib.a"; then
+      found=yes
+      lib=$dir/lib$lib.a
+      break
+    fi
+  done
+  IFS=$save_IFS
+
+  if test "$found" != yes; then
+    lib=$lib.lib
+  fi
+}
+
+# func_cl_wrapper cl arg...
+# Adjust compile command to suit cl
+func_cl_wrapper ()
+{
+  # Assume a capable shell
+  lib_path=
+  shared=:
+  linker_opts=
+  for arg
+  do
+    if test -n "$eat"; then
+      eat=
+    else
+      case $1 in
+	-o)
+	  # configure might choose to run compile as 'compile cc -o foo foo.c'.
+	  eat=1
+	  case $2 in
+	    *.o | *.[oO][bB][jJ])
+	      func_file_conv "$2"
+	      set x "$@" -Fo"$file"
+	      shift
+	      ;;
+	    *)
+	      func_file_conv "$2"
+	      set x "$@" -Fe"$file"
+	      shift
+	      ;;
+	  esac
+	  ;;
+	-I)
+	  eat=1
+	  func_file_conv "$2" mingw
+	  set x "$@" -I"$file"
+	  shift
+	  ;;
+	-I*)
+	  func_file_conv "${1#-I}" mingw
+	  set x "$@" -I"$file"
+	  shift
+	  ;;
+	-l)
+	  eat=1
+	  func_cl_dashl "$2"
+	  set x "$@" "$lib"
+	  shift
+	  ;;
+	-l*)
+	  func_cl_dashl "${1#-l}"
+	  set x "$@" "$lib"
+	  shift
+	  ;;
+	-L)
+	  eat=1
+	  func_cl_dashL "$2"
+	  ;;
+	-L*)
+	  func_cl_dashL "${1#-L}"
+	  ;;
+	-static)
+	  shared=false
+	  ;;
+	-Wl,*)
+	  arg=${1#-Wl,}
+	  save_ifs="$IFS"; IFS=','
+	  for flag in $arg; do
+	    IFS="$save_ifs"
+	    linker_opts="$linker_opts $flag"
+	  done
+	  IFS="$save_ifs"
+	  ;;
+	-Xlinker)
+	  eat=1
+	  linker_opts="$linker_opts $2"
+	  ;;
+	-*)
+	  set x "$@" "$1"
+	  shift
+	  ;;
+	*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
+	  func_file_conv "$1"
+	  set x "$@" -Tp"$file"
+	  shift
+	  ;;
+	*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
+	  func_file_conv "$1" mingw
+	  set x "$@" "$file"
+	  shift
+	  ;;
+	*)
+	  set x "$@" "$1"
+	  shift
+	  ;;
+      esac
+    fi
+    shift
+  done
+  if test -n "$linker_opts"; then
+    linker_opts="-link$linker_opts"
+  fi
+  exec "$@" $linker_opts
+  exit 1
+}
+
+eat=
+
 case $1 in
   '')
-     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     echo "$0: No command.  Try '$0 --help' for more information." 1>&2
      exit 1;
      ;;
   -h | --h*)
     cat <<\EOF
 Usage: compile [--help] [--version] PROGRAM [ARGS]
 
-Wrapper for compilers which do not understand `-c -o'.
-Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
+Wrapper for compilers which do not understand '-c -o'.
+Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
 arguments, and rename the output as expected.
 
 If you are trying to build a whole package this is not the
-right script to run: please start by reading the file `INSTALL'.
+right script to run: please start by reading the file 'INSTALL'.
 
 Report bugs to .
 EOF
@@ -53,11 +255,13 @@ EOF
     echo "compile $scriptversion"
     exit $?
     ;;
+  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
+    func_cl_wrapper "$@"      # Doesn't return...
+    ;;
 esac
 
 ofile=
 cfile=
-eat=
 
 for arg
 do
@@ -66,8 +270,8 @@ do
   else
     case $1 in
       -o)
-	# configure might choose to run compile as `compile cc -o foo foo.c'.
-	# So we strip `-o arg' only if arg is an object.
+	# configure might choose to run compile as 'compile cc -o foo foo.c'.
+	# So we strip '-o arg' only if arg is an object.
 	eat=1
 	case $2 in
 	  *.o | *.obj)
@@ -94,10 +298,10 @@ do
 done
 
 if test -z "$ofile" || test -z "$cfile"; then
-  # If no `-o' option was seen then we might have been invoked from a
+  # If no '-o' option was seen then we might have been invoked from a
   # pattern rule where we don't need one.  That is ok -- this is a
   # normal compilation that the losing compiler can handle.  If no
-  # `.c' file was seen then we are probably linking.  That is also
+  # '.c' file was seen then we are probably linking.  That is also
   # ok.
   exec "$@"
 fi
@@ -106,7 +310,7 @@ fi
 cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
 
 # Create the lock directory.
-# Note: use `[/\\:.-]' here to ensure that we don't use the same name
+# Note: use '[/\\:.-]' here to ensure that we don't use the same name
 # that we are using for the .o file.  Also, base the name on the expected
 # object file name, since that is what matters with a parallel build.
 lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
diff --git a/contrib/file/config.guess b/contrib/file/config.guess
new file mode 100755
index 00000000000..d622a44e551
--- /dev/null
+++ b/contrib/file/config.guess
@@ -0,0 +1,1530 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+#   2011, 2012 Free Software Foundation, Inc.
+
+timestamp='2012-02-10'
+
+# This file 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 of the License, or
+# (at your option) any later version.
+#
+# This program 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 this program; if not, see .
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner.  Please send patches (context
+# diff format) to  and include a ChangeLog
+# entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to ."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+	PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# NetBSD (nbsd) targets should (where applicable) match one or
+	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    sh5el) machine=sh5le-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep -q __ELF__
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+		os=netbsd
+		;;
+	esac
+	# The OS release
+	# Debian GNU/NetBSD machines have a different userland, and
+	# thus, need a distinct triplet. However, they do not need
+	# kernel version information, so it can be replaced with a
+	# suitable tag, in the style of linux-gnu.
+	case "${UNAME_VERSION}" in
+	    Debian*)
+		release='-gnu'
+		;;
+	    *)
+		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		;;
+	esac
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit ;;
+    *:OpenBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	exit ;;
+    *:ekkoBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	exit ;;
+    *:SolidBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	exit ;;
+    macppc:MirBSD:*:*)
+	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    *:MirBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    alpha:OSF1:*:*)
+	case $UNAME_RELEASE in
+	*4.0)
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+		;;
+	*5.*)
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		;;
+	esac
+	# According to Compaq, /usr/sbin/psrinfo has been available on
+	# OSF/1 and Tru64 systems produced since 1995.  I hope that
+	# covers most systems running today.  This code pipes the CPU
+	# types through head -n 1, so we only detect the type of CPU 0.
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case "$ALPHA_CPU_TYPE" in
+	    "EV4 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV4.5 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "LCA4 (21066/21068)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV5 (21164)")
+		UNAME_MACHINE="alphaev5" ;;
+	    "EV5.6 (21164A)")
+		UNAME_MACHINE="alphaev56" ;;
+	    "EV5.6 (21164PC)")
+		UNAME_MACHINE="alphapca56" ;;
+	    "EV5.7 (21164PC)")
+		UNAME_MACHINE="alphapca57" ;;
+	    "EV6 (21264)")
+		UNAME_MACHINE="alphaev6" ;;
+	    "EV6.7 (21264A)")
+		UNAME_MACHINE="alphaev67" ;;
+	    "EV6.8CB (21264C)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8AL (21264B)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8CX (21264D)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.9A (21264/EV69A)")
+		UNAME_MACHINE="alphaev69" ;;
+	    "EV7 (21364)")
+		UNAME_MACHINE="alphaev7" ;;
+	    "EV7.9 (21364A)")
+		UNAME_MACHINE="alphaev79" ;;
+	esac
+	# A Pn.n version is a patched version.
+	# A Vn.n version is a released version.
+	# A Tn.n version is a released field test version.
+	# A Xn.n version is an unreleased experimental baselevel.
+	# 1.2 uses "1.2" for uname -r.
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+	exitcode=$?
+	trap '' 0
+	exit $exitcode ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
+	exit ;;
+    21064:Windows_NT:50:3)
+	echo alpha-dec-winnt3.5
+	exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+	echo m68k-unknown-sysv4
+	exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-amigaos
+	exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit ;;
+    *:z/VM:*:*)
+	echo s390-ibm-zvmoe
+	exit ;;
+    *:OS400:*:*)
+	echo powerpc-ibm-os400
+	exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+	echo arm-unknown-riscos
+	exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+	echo hppa1.1-hitachi-hiuxmpp
+	exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit ;;
+    NILE*:*:*:dcosx)
+	echo pyramid-pyramid-svr4
+	exit ;;
+    DRS?6000:unix:4.0:6*)
+	echo sparc-icl-nx6
+	exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7; exit ;;
+	esac ;;
+    s390x:SunOS:*:*)
+	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4H:SunOS:5.*:*)
+	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+	echo i386-pc-auroraux${UNAME_RELEASE}
+	exit ;;
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+	eval $set_cc_for_build
+	SUN_ARCH="i386"
+	# If there is a compiler, see if it is configured for 64-bit objects.
+	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+	# This test works for both compilers.
+	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		grep IS_64BIT_ARCH >/dev/null
+	    then
+		SUN_ARCH="x86_64"
+	    fi
+	fi
+	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:6*:*)
+	# According to config.sub, this is the proper way to canonicalize
+	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+	# it's likely to be more like Solaris than SunOS4.
+	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:*:*)
+	case "`/usr/bin/arch -k`" in
+	    Series*|S4*)
+		UNAME_RELEASE=`uname -v`
+		;;
+	esac
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit ;;
+    sun*:*:4.2BSD:*)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	case "`/bin/arch`" in
+	    sun3)
+		echo m68k-sun-sunos${UNAME_RELEASE}
+		;;
+	    sun4)
+		echo sparc-sun-sunos${UNAME_RELEASE}
+		;;
+	esac
+	exit ;;
+    aushp:SunOS:*:*)
+	echo sparc-auspex-sunos${UNAME_RELEASE}
+	exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+	echo m68k-milan-mint${UNAME_RELEASE}
+	exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+	echo m68k-hades-mint${UNAME_RELEASE}
+	exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+	echo m68k-unknown-mint${UNAME_RELEASE}
+	exit ;;
+    m68k:machten:*:*)
+	echo m68k-apple-machten${UNAME_RELEASE}
+	exit ;;
+    powerpc:machten:*:*)
+	echo powerpc-apple-machten${UNAME_RELEASE}
+	exit ;;
+    RISC*:Mach:*:*)
+	echo mips-dec-mach_bsd4.3
+	exit ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+#include   /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
+	#if defined (host_mips) && defined (MIPSEB)
+	#if defined (SYSTYPE_SYSV)
+	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_SVR4)
+	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	#endif
+	#endif
+	  exit (-1);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c &&
+	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+	  SYSTEM_NAME=`$dummy $dummyarg` &&
+	    { echo "$SYSTEM_NAME"; exit; }
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+	echo powerpc-harris-powerunix
+	exit ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit ;;
+    AViiON:dgux:*:*)
+	# DG/UX returns AViiON for all architectures
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	    else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
+	fi
+	exit ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	exit ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+	echo i386-ibm-aix
+	exit ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
+		sed 's/^		//' << EOF >$dummy.c
+		#include 
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+		then
+			echo "$SYSTEM_NAME"
+		else
+			echo rs6000-ibm-aix3.2.5
+		fi
+	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+		echo rs6000-ibm-aix3.2.4
+	else
+		echo rs6000-ibm-aix3.2
+	fi
+	exit ;;
+    *:AIX:*:[4567])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+	echo romp-ibm-bsd4.4
+	exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit ;;
+    9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+		    case "${sc_cpu_version}" in
+		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+		      532)                      # CPU_PA_RISC2_0
+			case "${sc_kernel_bits}" in
+			  32) HP_ARCH="hppa2.0n" ;;
+			  64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+			esac ;;
+		    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^		//' << EOF >$dummy.c
+
+		#define _HPUX_SOURCE
+		#include 
+		#include 
+
+		int main ()
+		{
+		#if defined(_SC_KERNEL_BITS)
+		    long bits = sysconf(_SC_KERNEL_BITS);
+		#endif
+		    long cpu  = sysconf (_SC_CPU_VERSION);
+
+		    switch (cpu)
+			{
+			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+			case CPU_PA_RISC2_0:
+		#if defined(_SC_KERNEL_BITS)
+			    switch (bits)
+				{
+				case 64: puts ("hppa2.0w"); break;
+				case 32: puts ("hppa2.0n"); break;
+				default: puts ("hppa2.0"); break;
+				} break;
+		#else  /* !defined(_SC_KERNEL_BITS) */
+			    puts ("hppa2.0"); break;
+		#endif
+			default: puts ("hppa1.0"); break;
+			}
+		    exit (0);
+		}
+EOF
+		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    test -z "$HP_ARCH" && HP_ARCH=hppa
+		fi ;;
+	esac
+	if [ ${HP_ARCH} = "hppa2.0w" ]
+	then
+	    eval $set_cc_for_build
+
+	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+	    # generating 64-bit code.  GNU and HP use different nomenclature:
+	    #
+	    # $ CC_FOR_BUILD=cc ./config.guess
+	    # => hppa2.0w-hp-hpux11.23
+	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+	    # => hppa64-hp-hpux11.23
+
+	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+		grep -q __LP64__
+	    then
+		HP_ARCH="hppa2.0w"
+	    else
+		HP_ARCH="hppa64"
+	    fi
+	fi
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit ;;
+    ia64:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux${HPUX_REV}
+	exit ;;
+    3050*:HI-UX:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include 
+	int
+	main ()
+	{
+	  long cpu = sysconf (_SC_CPU_VERSION);
+	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+	     results, however.  */
+	  if (CPU_IS_PA_RISC (cpu))
+	    {
+	      switch (cpu)
+		{
+		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+		  default: puts ("hppa-hitachi-hiuxwe2"); break;
+		}
+	    }
+	  else if (CPU_IS_HP_MC68K (cpu))
+	    puts ("m68k-hitachi-hiuxwe2");
+	  else puts ("unknown-hitachi-hiuxwe2");
+	  exit (0);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+		{ echo "$SYSTEM_NAME"; exit; }
+	echo unknown-hitachi-hiuxwe2
+	exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit ;;
+    i*86:OSF1:*:*)
+	if [ -x /usr/sbin/sysversion ] ; then
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	else
+	    echo ${UNAME_MACHINE}-unknown-osf1
+	fi
+	exit ;;
+    parisc*:Lites*:*:*)
+	echo hppa1.1-hp-lites
+	exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+	exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+	exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+	exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+	exit ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*[A-Z]90:*:*:*)
+	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*T3E:*:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    *:UNICOS/mp:*:*)
+	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    5000:UNIX_System_V:4.*:*)
+	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit ;;
+    sparc*:BSD/OS:*:*)
+	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:FreeBSD:*:*)
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
+	case ${UNAME_PROCESSOR} in
+	    amd64)
+		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    *)
+		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	esac
+	exit ;;
+    i*:CYGWIN*:*)
+	echo ${UNAME_MACHINE}-pc-cygwin
+	exit ;;
+    *:MINGW*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit ;;
+    i*:MSYS*:*)
+	echo ${UNAME_MACHINE}-pc-msys
+	exit ;;
+    i*:windows32*:*)
+	# uname -m includes "-pc" on this system.
+	echo ${UNAME_MACHINE}-mingw32
+	exit ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit ;;
+    *:Interix*:*)
+	case ${UNAME_MACHINE} in
+	    x86)
+		echo i586-pc-interix${UNAME_RELEASE}
+		exit ;;
+	    authenticamd | genuineintel | EM64T)
+		echo x86_64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	    IA64)
+		echo ia64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	esac ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+	echo i${UNAME_MACHINE}-pc-mks
+	exit ;;
+    8664:Windows_NT:*)
+	echo x86_64-pc-mks
+	exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i586-pc-interix
+	exit ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+	echo x86_64-unknown-cygwin
+	exit ;;
+    p*:CYGWIN*:*)
+	echo powerpcle-unknown-cygwin
+	exit ;;
+    prep*:SunOS:5.*:*)
+	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    *:GNU:*:*)
+	# the GNU system
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit ;;
+    *:GNU/*:*:*)
+	# other systems with GNU libc and userland
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	exit ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit ;;
+    aarch64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    aarch64_be:Linux:*:*)
+	UNAME_MACHINE=aarch64_be
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+	esac
+	objdump --private-headers /bin/sh | grep -q ld.so.1
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit ;;
+    arm*:Linux:*:*)
+	eval $set_cc_for_build
+	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+	    | grep -q __ARM_EABI__
+	then
+	    echo ${UNAME_MACHINE}-unknown-linux-gnu
+	else
+	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+		| grep -q __ARM_PCS_VFP
+	    then
+		echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+	    else
+		echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+	    fi
+	fi
+	exit ;;
+    avr32*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    cris:Linux:*:*)
+	echo ${UNAME_MACHINE}-axis-linux-gnu
+	exit ;;
+    crisv32:Linux:*:*)
+	echo ${UNAME_MACHINE}-axis-linux-gnu
+	exit ;;
+    frv:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    hexagon:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    i*86:Linux:*:*)
+	LIBC=gnu
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+	exit ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m32r*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    mips:Linux:*:* | mips64:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef ${UNAME_MACHINE}
+	#undef ${UNAME_MACHINE}el
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=${UNAME_MACHINE}el
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=${UNAME_MACHINE}
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    or32:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    padre:Linux:*:*)
+	echo sparc-unknown-linux-gnu
+	exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
+	esac
+	exit ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
+	exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit ;;
+    sh64*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    tile*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    vax:Linux:*:*)
+	echo ${UNAME_MACHINE}-dec-linux-gnu
+	exit ;;
+    x86_64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    xtensa*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
+	echo i386-sequent-sysv4
+	exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+	# Unixware is an offshoot of SVR4, but it has its own version
+	# number series starting with 2...
+	# I am not positive that other SVR4 systems won't match this,
+	# I just have to hope.  -- rms.
+	# Use sysv4.2uw... so that sysv4* matches it.
+	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	exit ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit ;;
+    i*86:syllable:*:*)
+	echo ${UNAME_MACHINE}-pc-syllable
+	exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+	else
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+	fi
+	exit ;;
+    i*86:*:5:[678]*)
+	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit ;;
+    i*86:*:3.2:*)
+	if test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+			&& UNAME_MACHINE=i586
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-pc-sysv32
+	fi
+	exit ;;
+    pc:*:*:*)
+	# Left here for compatibility:
+	# uname -m prints for DJGPP always 'pc', but it prints nothing about
+	# the processor, so we play safe by assuming i586.
+	# Note: whatever this is, it MUST be the same as what config.sub
+	# prints for the "djgpp" host, or else GDB configury will decide that
+	# this is a cross-build.
+	echo i586-pc-msdosdjgpp
+	exit ;;
+    Intel:Mach:3*:*)
+	echo i386-pc-mach3
+	exit ;;
+    paragon:*:*:*)
+	echo i860-intel-osf1
+	exit ;;
+    i860:*:4.*:*) # i860-SVR4
+	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	else # Add other i860-SVR4 vendors below as they are discovered.
+	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	fi
+	exit ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit ;;
+    M680?0:D-NIX:5.3:*)
+	echo m68k-diab-dnix
+	exit ;;
+    M68*:*:R3V[5678]*:*)
+	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+	OS_REL=''
+	test -r /etc/.relid \
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4; exit; } ;;
+    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+	OS_REL='.3'
+	test -r /etc/.relid \
+	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    rs6000:LynxOS:2.*:*)
+	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+	echo mips-dde-sysv${UNAME_RELEASE}
+	exit ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    *:SINIX-*:*:*)
+	if uname -p 2>/dev/null >/dev/null ; then
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		echo ${UNAME_MACHINE}-sni-sysv4
+	else
+		echo ns32k-sni-sysv
+	fi
+	exit ;;
+    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+			# says 
+	echo i586-unisys-sysv4
+	exit ;;
+    *:UNIX_System_V:4*:FTX*)
+	# From Gerald Hewes .
+	# How about differentiating between stratus architectures? -djm
+	echo hppa1.1-stratus-sysv4
+	exit ;;
+    *:*:*:FTX*)
+	# From seanf@swdc.stratus.com.
+	echo i860-stratus-sysv4
+	exit ;;
+    i*86:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo ${UNAME_MACHINE}-stratus-vos
+	exit ;;
+    *:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo hppa1.1-stratus-vos
+	exit ;;
+    mc68*:A/UX:*:*)
+	echo m68k-apple-aux${UNAME_RELEASE}
+	exit ;;
+    news*:NEWS-OS:6*:*)
+	echo mips-sony-newsos6
+	exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+	if [ -d /usr/nec ]; then
+		echo mips-nec-sysv${UNAME_RELEASE}
+	else
+		echo mips-unknown-sysv${UNAME_RELEASE}
+	fi
+	exit ;;
+    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
+	echo powerpc-be-beos
+	exit ;;
+    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
+	echo powerpc-apple-beos
+	exit ;;
+    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
+	echo i586-pc-beos
+	exit ;;
+    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
+	echo i586-pc-haiku
+	exit ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-7:SUPER-UX:*:*)
+	echo sx7-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8:SUPER-UX:*:*)
+	echo sx8-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8R:SUPER-UX:*:*)
+	echo sx8r-nec-superux${UNAME_RELEASE}
+	exit ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Darwin:*:*)
+	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+	case $UNAME_PROCESSOR in
+	    i386)
+		eval $set_cc_for_build
+		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		      grep IS_64BIT_ARCH >/dev/null
+		  then
+		      UNAME_PROCESSOR="x86_64"
+		  fi
+		fi ;;
+	    unknown) UNAME_PROCESSOR=powerpc ;;
+	esac
+	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit ;;
+    NEO-?:NONSTOP_KERNEL:*:*)
+	echo neo-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+	echo nse-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit ;;
+    SEI:*:*:SEIUX)
+	echo mips-sei-seiux${UNAME_RELEASE}
+	exit ;;
+    *:DragonFly:*:*)
+	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit ;;
+    *:*VMS:*:*)
+	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	case "${UNAME_MACHINE}" in
+	    A*) echo alpha-dec-vms ; exit ;;
+	    I*) echo ia64-dec-vms ; exit ;;
+	    V*) echo vax-dec-vms ; exit ;;
+	esac ;;
+    *:XENIX:*:SysV)
+	echo i386-pc-xenix
+	exit ;;
+    i*86:skyos:*:*)
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	exit ;;
+    i*86:rdos:*:*)
+	echo ${UNAME_MACHINE}-pc-rdos
+	exit ;;
+    i*86:AROS:*:*)
+	echo ${UNAME_MACHINE}-pc-aros
+	exit ;;
+    x86_64:VMkernel:*:*)
+	echo ${UNAME_MACHINE}-unknown-esx
+	exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <
+# include 
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include 
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+	"4"
+#else
+	""
+#endif
+	); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+	printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+	printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include 
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+	{ echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+	echo c1-convex-bsd
+	exit ;;
+    c2*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit ;;
+    c34*)
+	echo c34-convex-bsd
+	exit ;;
+    c38*)
+	echo c38-convex-bsd
+	exit ;;
+    c4*)
+	echo c4-convex-bsd
+	exit ;;
+    esac
+fi
+
+cat >&2 < in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/contrib/file/config.h.in b/contrib/file/config.h.in
index ae147aeae56..7f22fa8e363 100644
--- a/contrib/file/config.h.in
+++ b/contrib/file/config.h.in
@@ -1,14 +1,23 @@
 /* config.h.in.  Generated from configure.ac by autoheader.  */
 
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
+
 /* Define in built-in ELF support is used */
 #undef BUILTIN_ELF
 
 /* Define for ELF core file support */
 #undef ELFCORE
 
+/* Define to 1 if you have the `asctime_r' function. */
+#undef HAVE_ASCTIME_R
+
 /* Define to 1 if you have the `asprintf' function. */
 #undef HAVE_ASPRINTF
 
+/* Define to 1 if you have the `ctime_r' function. */
+#undef HAVE_CTIME_R
+
 /* HAVE_DAYLIGHT */
 #undef HAVE_DAYLIGHT
 
@@ -29,6 +38,9 @@
 /* Define to 1 if you have the  header file. */
 #undef HAVE_FCNTL_H
 
+/* Define to 1 if you have the `fmtcheck' function. */
+#undef HAVE_FMTCHECK
+
 /* Define to 1 if you have the `fork' function. */
 #undef HAVE_FORK
 
@@ -44,11 +56,11 @@
 /* Define to 1 if you have the `getopt_long' function. */
 #undef HAVE_GETOPT_LONG
 
-/* Define to 1 if the system has the type `int32_t'. */
-#undef HAVE_INT32_T
+/* Define to 1 if you have the `getpagesize' function. */
+#undef HAVE_GETPAGESIZE
 
-/* Define to 1 if the system has the type `int64_t'. */
-#undef HAVE_INT64_T
+/* Define to 1 if the system has the type `intptr_t'. */
+#undef HAVE_INTPTR_T
 
 /* Define to 1 if you have the  header file. */
 #undef HAVE_INTTYPES_H
@@ -65,7 +77,7 @@
 /* Define to 1 if you have the  header file. */
 #undef HAVE_LOCALE_H
 
-/* Define to 1 if you have the `mbrtowc' function. */
+/* Define to 1 if mbrtowc and mbstate_t are properly declared. */
 #undef HAVE_MBRTOWC
 
 /* Define to 1 if  declares mbstate_t. */
@@ -74,14 +86,20 @@
 /* Define to 1 if you have the  header file. */
 #undef HAVE_MEMORY_H
 
+/* Define to 1 if you have the `mkostemp' function. */
+#undef HAVE_MKOSTEMP
+
 /* Define to 1 if you have the `mkstemp' function. */
 #undef HAVE_MKSTEMP
 
-/* Define to 1 if you have the `mmap' function. */
+/* Define to 1 if you have a working `mmap' system call. */
 #undef HAVE_MMAP
 
-/* Define to 1 if the system has the type `pid_t'. */
-#undef HAVE_PID_T
+/* Define to 1 if you have the `pread' function. */
+#undef HAVE_PREAD
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_STDDEF_H
 
 /* Define to 1 if you have the  header file. */
 #undef HAVE_STDINT_H
@@ -89,6 +107,9 @@
 /* Define to 1 if you have the  header file. */
 #undef HAVE_STDLIB_H
 
+/* Define to 1 if you have the `strcasestr' function. */
+#undef HAVE_STRCASESTR
+
 /* Define to 1 if you have the `strerror' function. */
 #undef HAVE_STRERROR
 
@@ -128,6 +149,9 @@
 /* Define to 1 if you have the  header file. */
 #undef HAVE_SYS_MMAN_H
 
+/* Define to 1 if you have the  header file. */
+#undef HAVE_SYS_PARAM_H
+
 /* Define to 1 if you have the  header file. */
 #undef HAVE_SYS_STAT_H
 
@@ -152,17 +176,8 @@
 /* HAVE_TZNAME */
 #undef HAVE_TZNAME
 
-/* Define to 1 if the system has the type `uint16_t'. */
-#undef HAVE_UINT16_T
-
-/* Define to 1 if the system has the type `uint32_t'. */
-#undef HAVE_UINT32_T
-
-/* Define to 1 if the system has the type `uint64_t'. */
-#undef HAVE_UINT64_T
-
-/* Define to 1 if the system has the type `uint8_t'. */
-#undef HAVE_UINT8_T
+/* Define to 1 if the system has the type `uintptr_t'. */
+#undef HAVE_UINTPTR_T
 
 /* Define to 1 if you have the  header file. */
 #undef HAVE_UNISTD_H
@@ -179,6 +194,16 @@
 /* Define to 1 if you have the `vasprintf' function. */
 #undef HAVE_VASPRINTF
 
+/* Define to 1 if you have the `vfork' function. */
+#undef HAVE_VFORK
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_VFORK_H
+
+/* Define to 1 or 0, depending whether the compiler supports simple visibility
+   declarations. */
+#undef HAVE_VISIBILITY
+
 /* Define to 1 if you have the  header file. */
 #undef HAVE_WCHAR_H
 
@@ -188,6 +213,12 @@
 /* Define to 1 if you have the `wcwidth' function. */
 #undef HAVE_WCWIDTH
 
+/* Define to 1 if `fork' works. */
+#undef HAVE_WORKING_FORK
+
+/* Define to 1 if `vfork' works. */
+#undef HAVE_WORKING_VFORK
+
 /* Define to 1 if you have the  header file. */
 #undef HAVE_ZLIB_H
 
@@ -203,9 +234,6 @@
    . */
 #undef MAJOR_IN_SYSMACROS
 
-/* Define to 1 if your C compiler doesn't accept -c and -o together. */
-#undef NO_MINUS_C_MINUS_O
-
 /* Name of package */
 #undef PACKAGE
 
@@ -227,9 +255,6 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
-/* The size of `long long', as computed by sizeof. */
-#undef SIZEOF_LONG_LONG
-
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
 
@@ -261,6 +286,23 @@
 /* Version number of package */
 #undef VERSION
 
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+#  define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+#  undef WORDS_BIGENDIAN
+# endif
+#endif
+
+/* Enable large inode numbers on Mac OS X 10.5.  */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
 /* Number of bits in a file offset, on hosts where this is settable. */
 #undef _FILE_OFFSET_BITS
 
@@ -280,43 +322,67 @@
 /* Define to 1 if you need to in order for `stat' and other things to work. */
 #undef _POSIX_SOURCE
 
+/* Define for Solaris 2.5.1 so the uint32_t typedef from ,
+   , or  is not used. If the typedef were allowed, the
+   #define below would cause a syntax error. */
+#undef _UINT32_T
+
+/* Define for Solaris 2.5.1 so the uint64_t typedef from ,
+   , or  is not used. If the typedef were allowed, the
+   #define below would cause a syntax error. */
+#undef _UINT64_T
+
+/* Define for Solaris 2.5.1 so the uint8_t typedef from ,
+   , or  is not used. If the typedef were allowed, the
+   #define below would cause a syntax error. */
+#undef _UINT8_T
+
 /* Define to empty if `const' does not conform to ANSI C. */
 #undef const
 
+/* Define to the type of a signed integer type of width exactly 32 bits if
+   such a type exists and the standard includes do not define it. */
+#undef int32_t
+
+/* Define to the type of a signed integer type of width exactly 64 bits if
+   such a type exists and the standard includes do not define it. */
+#undef int64_t
+
+/* Define to the type of a signed integer type wide enough to hold a pointer,
+   if such a type exists, and if the system does not define it. */
+#undef intptr_t
+
 /* Define to a type if  does not define. */
 #undef mbstate_t
 
 /* Define to `long int' if  does not define. */
 #undef off_t
 
+/* Define to `int' if  does not define. */
+#undef pid_t
+
 /* Define to `unsigned int' if  does not define. */
 #undef size_t
 
+/* Define to the type of an unsigned integer type of width exactly 16 bits if
+   such a type exists and the standard includes do not define it. */
+#undef uint16_t
 
-#ifndef HAVE_UINT8_T
-typedef unsigned char uint8_t;
-#endif
-#ifndef HAVE_UINT16_T
-typedef unsigned short uint16_t;
-#endif
-#ifndef HAVE_UINT32_T
-typedef unsigned int uint32_t;
-#endif
-#ifndef HAVE_INT32_T
-typedef int int32_t;
-#endif
-#ifndef HAVE_UINT64_T
-#if SIZEOF_LONG_LONG == 8
-typedef unsigned long long uint64_t;
-#else
-typedef unsigned long uint64_t;
-#endif
-#endif
-#ifndef HAVE_INT64_T
-#if SIZEOF_LONG_LONG == 8
-typedef long long int64_t;
-#else
-typedef long int64_t;
-#endif
-#endif
+/* Define to the type of an unsigned integer type of width exactly 32 bits if
+   such a type exists and the standard includes do not define it. */
+#undef uint32_t
 
+/* Define to the type of an unsigned integer type of width exactly 64 bits if
+   such a type exists and the standard includes do not define it. */
+#undef uint64_t
+
+/* Define to the type of an unsigned integer type of width exactly 8 bits if
+   such a type exists and the standard includes do not define it. */
+#undef uint8_t
+
+/* Define to the type of an unsigned integer type wide enough to hold a
+   pointer, if such a type exists, and if the system does not define it. */
+#undef uintptr_t
+
+/* Define as `fork' if `vfork' does not work. */
+#undef vfork
diff --git a/contrib/file/config.sub b/contrib/file/config.sub
new file mode 100755
index 00000000000..59bb593f109
--- /dev/null
+++ b/contrib/file/config.sub
@@ -0,0 +1,1779 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+#   2011, 2012 Free Software Foundation, Inc.
+
+timestamp='2012-04-18'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file 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 of the License, or
+# (at your option) any later version.
+#
+# This program 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 this program; if not, see .
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to .  Submit a context
+# diff and a properly formatted GNU ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to ."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+  knetbsd*-gnu* | netbsd*-gnu* | \
+  kopensolaris*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  android-linux)
+    os=-linux-android
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+	-sun*os*)
+		# Prevent following clause from handling this invalid input.
+		;;
+	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+	-apple | -axis | -knuth | -cray | -microblaze)
+		os=
+		basic_machine=$1
+		;;
+	-bluegene*)
+		os=-cnk
+		;;
+	-sim | -cisco | -oki | -wec | -winbond)
+		os=
+		basic_machine=$1
+		;;
+	-scout)
+		;;
+	-wrs)
+		os=-vxworks
+		basic_machine=$1
+		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+	-chorusrdb)
+		os=-chorusrdb
+		basic_machine=$1
+		;;
+	-hiux*)
+		os=-hiuxwe2
+		;;
+	-sco6)
+		os=-sco5v6
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5)
+		os=-sco3.2v5
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco4)
+		os=-sco3.2v4
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2.[4-9]*)
+		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2v[4-9]*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5v6*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco*)
+		os=-sco3.2v2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-udk*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-isc)
+		os=-isc2.2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-clix*)
+		basic_machine=clipper-intergraph
+		;;
+	-isc*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-lynx*178)
+		os=-lynxos178
+		;;
+	-lynx*5)
+		os=-lynxos5
+		;;
+	-lynx*)
+		os=-lynxos
+		;;
+	-ptx*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+		;;
+	-windowsnt*)
+		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		;;
+	-psos*)
+		os=-psos
+		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+	# Recognize the basic CPU types without company name.
+	# Some are omitted here because they have special meanings below.
+	1750a | 580 \
+	| a29k \
+	| aarch64 | aarch64_be \
+	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+	| am33_2.0 \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+        | be32 | be64 \
+	| bfin \
+	| c4x | clipper \
+	| d10v | d30v | dlx | dsp16xx \
+	| epiphany \
+	| fido | fr30 | frv \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| hexagon \
+	| i370 | i860 | i960 | ia64 \
+	| ip2k | iq2000 \
+	| le32 | le64 \
+	| lm32 \
+	| m32c | m32r | m32rle | m68000 | m68k | m88k \
+	| maxq | mb | microblaze | mcore | mep | metag \
+	| mips | mipsbe | mipseb | mipsel | mipsle \
+	| mips16 \
+	| mips64 | mips64el \
+	| mips64octeon | mips64octeonel \
+	| mips64orion | mips64orionel \
+	| mips64r5900 | mips64r5900el \
+	| mips64vr | mips64vrel \
+	| mips64vr4100 | mips64vr4100el \
+	| mips64vr4300 | mips64vr4300el \
+	| mips64vr5000 | mips64vr5000el \
+	| mips64vr5900 | mips64vr5900el \
+	| mipsisa32 | mipsisa32el \
+	| mipsisa32r2 | mipsisa32r2el \
+	| mipsisa64 | mipsisa64el \
+	| mipsisa64r2 | mipsisa64r2el \
+	| mipsisa64sb1 | mipsisa64sb1el \
+	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipstx39 | mipstx39el \
+	| mn10200 | mn10300 \
+	| moxie \
+	| mt \
+	| msp430 \
+	| nds32 | nds32le | nds32be \
+	| nios | nios2 \
+	| ns16k | ns32k \
+	| open8 \
+	| or32 \
+	| pdp10 | pdp11 | pj | pjl \
+	| powerpc | powerpc64 | powerpc64le | powerpcle \
+	| pyramid \
+	| rl78 | rx \
+	| score \
+	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh64 | sh64le \
+	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+	| spu \
+	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
+	| ubicom32 \
+	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+	| we32k \
+	| x86 | xc16x | xstormy16 | xtensa \
+	| z8k | z80)
+		basic_machine=$basic_machine-unknown
+		;;
+	c54x)
+		basic_machine=tic54x-unknown
+		;;
+	c55x)
+		basic_machine=tic55x-unknown
+		;;
+	c6x)
+		basic_machine=tic6x-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+		;;
+	ms1)
+		basic_machine=mt-unknown
+		;;
+
+	strongarm | thumb | xscale)
+		basic_machine=arm-unknown
+		;;
+	xgate)
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	xscaleeb)
+		basic_machine=armeb-unknown
+		;;
+
+	xscaleel)
+		basic_machine=armel-unknown
+		;;
+
+	# We use `pc' rather than `unknown'
+	# because (1) that's what they normally are, and
+	# (2) the word "unknown" tends to confuse beginning users.
+	i*86 | x86_64)
+	  basic_machine=$basic_machine-pc
+	  ;;
+	# Object if more than one company name word.
+	*-*-*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+	# Recognize the basic CPU types with company name.
+	580-* \
+	| a29k-* \
+	| aarch64-* | aarch64_be-* \
+	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+	| avr-* | avr32-* \
+	| be32-* | be64-* \
+	| bfin-* | bs2000-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* \
+	| clipper-* | craynv-* | cydra-* \
+	| d10v-* | d30v-* | dlx-* \
+	| elxsi-* \
+	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+	| h8300-* | h8500-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| hexagon-* \
+	| i*86-* | i860-* | i960-* | ia64-* \
+	| ip2k-* | iq2000-* \
+	| le32-* | le64-* \
+	| lm32-* \
+	| m32c-* | m32r-* | m32rle-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	| mips16-* \
+	| mips64-* | mips64el-* \
+	| mips64octeon-* | mips64octeonel-* \
+	| mips64orion-* | mips64orionel-* \
+	| mips64r5900-* | mips64r5900el-* \
+	| mips64vr-* | mips64vrel-* \
+	| mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* \
+	| mips64vr5000-* | mips64vr5000el-* \
+	| mips64vr5900-* | mips64vr5900el-* \
+	| mipsisa32-* | mipsisa32el-* \
+	| mipsisa32r2-* | mipsisa32r2el-* \
+	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64r2-* | mipsisa64r2el-* \
+	| mipsisa64sb1-* | mipsisa64sb1el-* \
+	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipstx39-* | mipstx39el-* \
+	| mmix-* \
+	| mt-* \
+	| msp430-* \
+	| nds32-* | nds32le-* | nds32be-* \
+	| nios-* | nios2-* \
+	| none-* | np1-* | ns16k-* | ns32k-* \
+	| open8-* \
+	| orion-* \
+	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+	| pyramid-* \
+	| rl78-* | romp-* | rs6000-* | rx-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+	| sparclite-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+	| tahoe-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tile*-* \
+	| tron-* \
+	| ubicom32-* \
+	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+	| vax-* \
+	| we32k-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* \
+	| xstormy16-* | xtensa*-* \
+	| ymp-* \
+	| z8k-* | z80-*)
+		;;
+	# Recognize the basic CPU types without company name, with glob match.
+	xtensa*)
+		basic_machine=$basic_machine-unknown
+		;;
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	386bsd)
+		basic_machine=i386-unknown
+		os=-bsd
+		;;
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-att
+		;;
+	a29khif)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	abacus)
+		basic_machine=abacus-unknown
+		;;
+	adobe68k)
+		basic_machine=m68010-adobe
+		os=-scout
+		;;
+	alliant | fx80)
+		basic_machine=fx80-alliant
+		;;
+	altos | altos3068)
+		basic_machine=m68k-altos
+		;;
+	am29k)
+		basic_machine=a29k-none
+		os=-bsd
+		;;
+	amd64)
+		basic_machine=x86_64-pc
+		;;
+	amd64-*)
+		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	amdahl)
+		basic_machine=580-amdahl
+		os=-sysv
+		;;
+	amiga | amiga-*)
+		basic_machine=m68k-unknown
+		;;
+	amigaos | amigados)
+		basic_machine=m68k-unknown
+		os=-amigaos
+		;;
+	amigaunix | amix)
+		basic_machine=m68k-unknown
+		os=-sysv4
+		;;
+	apollo68)
+		basic_machine=m68k-apollo
+		os=-sysv
+		;;
+	apollo68bsd)
+		basic_machine=m68k-apollo
+		os=-bsd
+		;;
+	aros)
+		basic_machine=i386-pc
+		os=-aros
+		;;
+	aux)
+		basic_machine=m68k-apple
+		os=-aux
+		;;
+	balance)
+		basic_machine=ns32k-sequent
+		os=-dynix
+		;;
+	blackfin)
+		basic_machine=bfin-unknown
+		os=-linux
+		;;
+	blackfin-*)
+		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	bluegene*)
+		basic_machine=powerpc-ibm
+		os=-cnk
+		;;
+	c54x-*)
+		basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c55x-*)
+		basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c6x-*)
+		basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+	cegcc)
+		basic_machine=arm-unknown
+		os=-cegcc
+		;;
+	convex-c1)
+		basic_machine=c1-convex
+		os=-bsd
+		;;
+	convex-c2)
+		basic_machine=c2-convex
+		os=-bsd
+		;;
+	convex-c32)
+		basic_machine=c32-convex
+		os=-bsd
+		;;
+	convex-c34)
+		basic_machine=c34-convex
+		os=-bsd
+		;;
+	convex-c38)
+		basic_machine=c38-convex
+		os=-bsd
+		;;
+	cray | j90)
+		basic_machine=j90-cray
+		os=-unicos
+		;;
+	craynv)
+		basic_machine=craynv-cray
+		os=-unicosmp
+		;;
+	cr16 | cr16-*)
+		basic_machine=cr16-unknown
+		os=-elf
+		;;
+	crds | unos)
+		basic_machine=m68k-crds
+		;;
+	crisv32 | crisv32-* | etraxfs*)
+		basic_machine=crisv32-axis
+		;;
+	cris | cris-* | etrax*)
+		basic_machine=cris-axis
+		;;
+	crx)
+		basic_machine=crx-unknown
+		os=-elf
+		;;
+	da30 | da30-*)
+		basic_machine=m68k-da30
+		;;
+	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+		basic_machine=mips-dec
+		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	dicos)
+		basic_machine=i686-pc
+		os=-dicos
+		;;
+	djgpp)
+		basic_machine=i586-pc
+		os=-msdosdjgpp
+		;;
+	dpx20 | dpx20-*)
+		basic_machine=rs6000-bull
+		os=-bosx
+		;;
+	dpx2* | dpx2*-bull)
+		basic_machine=m68k-bull
+		os=-sysv3
+		;;
+	ebmon29k)
+		basic_machine=a29k-amd
+		os=-ebmon
+		;;
+	elxsi)
+		basic_machine=elxsi-elxsi
+		os=-bsd
+		;;
+	encore | umax | mmax)
+		basic_machine=ns32k-encore
+		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	h8300hms)
+		basic_machine=h8300-hitachi
+		os=-hms
+		;;
+	h8300xray)
+		basic_machine=h8300-hitachi
+		os=-xray
+		;;
+	h8500hms)
+		basic_machine=h8500-hitachi
+		os=-hms
+		;;
+	harris)
+		basic_machine=m88k-harris
+		os=-sysv3
+		;;
+	hp300-*)
+		basic_machine=m68k-hp
+		;;
+	hp300bsd)
+		basic_machine=m68k-hp
+		os=-bsd
+		;;
+	hp300hpux)
+		basic_machine=m68k-hp
+		os=-hpux
+		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hppa-next)
+		os=-nextstep3
+		;;
+	hppaosf)
+		basic_machine=hppa1.1-hp
+		os=-osf
+		;;
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
+		;;
+	i370-ibm* | ibm*)
+		basic_machine=i370-ibm
+		;;
+	i*86v32)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv32
+		;;
+	i*86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv4
+		;;
+	i*86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv
+		;;
+	i*86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-solaris2
+		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		esac
+		;;
+	isi68 | isi)
+		basic_machine=m68k-isi
+		os=-sysv
+		;;
+	m68knommu)
+		basic_machine=m68k-unknown
+		os=-linux
+		;;
+	m68knommu-*)
+		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	m88k-omron*)
+		basic_machine=m88k-omron
+		;;
+	magnum | m3230)
+		basic_machine=mips-mips
+		os=-sysv
+		;;
+	merlin)
+		basic_machine=ns32k-utek
+		os=-sysv
+		;;
+	microblaze)
+		basic_machine=microblaze-xilinx
+		;;
+	mingw32)
+		basic_machine=i386-pc
+		os=-mingw32
+		;;
+	mingw32ce)
+		basic_machine=arm-unknown
+		os=-mingw32ce
+		;;
+	miniframe)
+		basic_machine=m68000-convergent
+		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+	mips3*-*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		;;
+	mips3*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		;;
+	monitor)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
+	msdos)
+		basic_machine=i386-pc
+		os=-msdos
+		;;
+	ms1-*)
+		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+		;;
+	msys)
+		basic_machine=i386-pc
+		os=-msys
+		;;
+	mvs)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
+	nacl)
+		basic_machine=le32-unknown
+		os=-nacl
+		;;
+	ncr3000)
+		basic_machine=i486-ncr
+		os=-sysv4
+		;;
+	netbsd386)
+		basic_machine=i386-unknown
+		os=-netbsd
+		;;
+	netwinder)
+		basic_machine=armv4l-rebel
+		os=-linux
+		;;
+	news | news700 | news800 | news900)
+		basic_machine=m68k-sony
+		os=-newsos
+		;;
+	news1000)
+		basic_machine=m68030-sony
+		os=-newsos
+		;;
+	news-3600 | risc-news)
+		basic_machine=mips-sony
+		os=-newsos
+		;;
+	necv70)
+		basic_machine=v70-nec
+		os=-sysv
+		;;
+	next | m*-next )
+		basic_machine=m68k-next
+		case $os in
+		    -nextstep* )
+			;;
+		    -ns2*)
+		      os=-nextstep2
+			;;
+		    *)
+		      os=-nextstep3
+			;;
+		esac
+		;;
+	nh3000)
+		basic_machine=m68k-harris
+		os=-cxux
+		;;
+	nh[45]000)
+		basic_machine=m88k-harris
+		os=-cxux
+		;;
+	nindy960)
+		basic_machine=i960-intel
+		os=-nindy
+		;;
+	mon960)
+		basic_machine=i960-intel
+		os=-mon960
+		;;
+	nonstopux)
+		basic_machine=mips-compaq
+		os=-nonstopux
+		;;
+	np1)
+		basic_machine=np1-gould
+		;;
+	neo-tandem)
+		basic_machine=neo-tandem
+		;;
+	nse-tandem)
+		basic_machine=nse-tandem
+		;;
+	nsr-tandem)
+		basic_machine=nsr-tandem
+		;;
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		os=-proelf
+		;;
+	openrisc | openrisc-*)
+		basic_machine=or32-unknown
+		;;
+	os400)
+		basic_machine=powerpc-ibm
+		os=-os400
+		;;
+	OSE68000 | ose68000)
+		basic_machine=m68000-ericsson
+		os=-ose
+		;;
+	os68k)
+		basic_machine=m68k-none
+		os=-os68k
+		;;
+	pa-hitachi)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	paragon)
+		basic_machine=i860-intel
+		os=-osf
+		;;
+	parisc)
+		basic_machine=hppa-unknown
+		os=-linux
+		;;
+	parisc-*)
+		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	pbd)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-tti
+		;;
+	pc532 | pc532-*)
+		basic_machine=ns32k-pc532
+		;;
+	pc98)
+		basic_machine=i386-pc
+		;;
+	pc98-*)
+		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium | p5 | k5 | k6 | nexgen | viac3)
+		basic_machine=i586-pc
+		;;
+	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+		basic_machine=i686-pc
+		;;
+	pentiumii | pentium2 | pentiumiii | pentium3)
+		basic_machine=i686-pc
+		;;
+	pentium4)
+		basic_machine=i786-pc
+		;;
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium4-*)
+		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pn)
+		basic_machine=pn-gould
+		;;
+	power)	basic_machine=power-ibm
+		;;
+	ppc | ppcbe)	basic_machine=powerpc-unknown
+		;;
+	ppc-* | ppcbe-*)
+		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppcle | powerpclittle | ppc-le | powerpc-little)
+		basic_machine=powerpcle-unknown
+		;;
+	ppcle-* | powerpclittle-*)
+		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64)	basic_machine=powerpc64-unknown
+		;;
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+		basic_machine=powerpc64le-unknown
+		;;
+	ppc64le-* | powerpc64little-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ps2)
+		basic_machine=i386-ibm
+		;;
+	pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
+	rdos)
+		basic_machine=i386-pc
+		os=-rdos
+		;;
+	rom68k)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	rm[46]00)
+		basic_machine=mips-siemens
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
+	sa29200)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
+	sde)
+		basic_machine=mipsisa32-sde
+		os=-elf
+		;;
+	sei)
+		basic_machine=mips-sei
+		os=-seiux
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sh5el)
+		basic_machine=sh5le-unknown
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparclite-wrs | simso-wrs)
+		basic_machine=sparclite-wrs
+		os=-vxworks
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	st2000)
+		basic_machine=m68k-tandem
+		;;
+	stratus)
+		basic_machine=i860-stratus
+		os=-sysv4
+		;;
+	strongarm-* | thumb-*)
+		basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	sun2)
+		basic_machine=m68000-sun
+		;;
+	sun2os3)
+		basic_machine=m68000-sun
+		os=-sunos3
+		;;
+	sun2os4)
+		basic_machine=m68000-sun
+		os=-sunos4
+		;;
+	sun3os3)
+		basic_machine=m68k-sun
+		os=-sunos3
+		;;
+	sun3os4)
+		basic_machine=m68k-sun
+		os=-sunos4
+		;;
+	sun4os3)
+		basic_machine=sparc-sun
+		os=-sunos3
+		;;
+	sun4os4)
+		basic_machine=sparc-sun
+		os=-sunos4
+		;;
+	sun4sol2)
+		basic_machine=sparc-sun
+		os=-solaris2
+		;;
+	sun3 | sun3-*)
+		basic_machine=m68k-sun
+		;;
+	sun4)
+		basic_machine=sparc-sun
+		;;
+	sun386 | sun386i | roadrunner)
+		basic_machine=i386-sun
+		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+	t3e)
+		basic_machine=alphaev5-cray
+		os=-unicos
+		;;
+	t90)
+		basic_machine=t90-cray
+		os=-unicos
+		;;
+	tile*)
+		basic_machine=$basic_machine-unknown
+		os=-linux-gnu
+		;;
+	tx39)
+		basic_machine=mipstx39-unknown
+		;;
+	tx39el)
+		basic_machine=mipstx39el-unknown
+		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	tpf)
+		basic_machine=s390x-ibm
+		os=-tpf
+		;;
+	udi29k)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	v810 | necv810)
+		basic_machine=v810-nec
+		os=-none
+		;;
+	vaxv)
+		basic_machine=vax-dec
+		os=-sysv
+		;;
+	vms)
+		basic_machine=vax-dec
+		os=-vms
+		;;
+	vpp*|vx|vx-*)
+		basic_machine=f301-fujitsu
+		;;
+	vxworks960)
+		basic_machine=i960-wrs
+		os=-vxworks
+		;;
+	vxworks68)
+		basic_machine=m68k-wrs
+		os=-vxworks
+		;;
+	vxworks29k)
+		basic_machine=a29k-wrs
+		os=-vxworks
+		;;
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
+		;;
+	xbox)
+		basic_machine=i686-pc
+		os=-mingw32
+		;;
+	xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	xscale-* | xscalee[bl]-*)
+		basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	z8k-*-coff)
+		basic_machine=z8k-unknown
+		os=-sim
+		;;
+	z80-*-coff)
+		basic_machine=z80-unknown
+		os=-sim
+		;;
+	none)
+		basic_machine=none-none
+		os=-none
+		;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		basic_machine=hppa1.1-winbond
+		;;
+	op50n)
+		basic_machine=hppa1.1-oki
+		;;
+	op60c)
+		basic_machine=hppa1.1-oki
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	mmix)
+		basic_machine=mmix-knuth
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+		basic_machine=sh-unknown
+		;;
+	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+		basic_machine=sparc-sun
+		;;
+	cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	mac | mpw | mac-mpw)
+		basic_machine=m68k-apple
+		;;
+	pmac | pmac-mpw)
+		basic_machine=powerpc-apple
+		;;
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
+		;;
+	*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+	*-digital*)
+		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+		;;
+	*-commodore*)
+		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+		;;
+	*)
+		;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+	# First match some system type aliases
+	# that might get confused with valid system types.
+	# -solaris* is a basic system type, with this one exception.
+	-auroraux)
+		os=-auroraux
+		;;
+	-solaris1 | -solaris1.*)
+		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+		;;
+	-solaris)
+		os=-solaris2
+		;;
+	-svr4*)
+		os=-sysv4
+		;;
+	-unixware*)
+		os=-sysv4.2uw
+		;;
+	-gnu/linux*)
+		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+		;;
+	# First accept the basic system types.
+	# The portable systems comes first.
+	# Each alternative MUST END IN A *, to match a version number.
+	# -sysv* is not here because it comes later, after sysvr4.
+	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+	      | -sym* | -kopensolaris* \
+	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+	      | -aos* | -aros* \
+	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+	      | -openbsd* | -solidbsd* \
+	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* | -cegcc* \
+	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -linux-gnu* | -linux-android* \
+	      | -linux-newlib* | -linux-uclibc* \
+	      | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
+	# Remember, each alternative MUST END IN *, to match a version number.
+		;;
+	-qnx*)
+		case $basic_machine in
+		    x86-* | i*86-*)
+			;;
+		    *)
+			os=-nto$os
+			;;
+		esac
+		;;
+	-nto-qnx*)
+		;;
+	-nto*)
+		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+		;;
+	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+		;;
+	-mac*)
+		os=`echo $os | sed -e 's|mac|macos|'`
+		;;
+	-linux-dietlibc)
+		os=-linux-dietlibc
+		;;
+	-linux*)
+		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+		;;
+	-sunos5*)
+		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		;;
+	-sunos6*)
+		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		;;
+	-opened*)
+		os=-openedition
+		;;
+	-os400*)
+		os=-os400
+		;;
+	-wince*)
+		os=-wince
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-atheos*)
+		os=-atheos
+		;;
+	-syllable*)
+		os=-syllable
+		;;
+	-386bsd)
+		os=-bsd
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
+	-ns2 )
+		os=-nextstep2
+		;;
+	-nsk*)
+		os=-nsk
+		;;
+	# Preserve the version number of sinix5.
+	-sinix5.*)
+		os=`echo $os | sed -e 's|sinix|sysv|'`
+		;;
+	-sinix*)
+		os=-sysv4
+		;;
+	-tpf*)
+		os=-tpf
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-ose*)
+		os=-ose
+		;;
+	-es1800*)
+		os=-ose
+		;;
+	-xenix)
+		os=-xenix
+		;;
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+		os=-mint
+		;;
+	-aros*)
+		os=-aros
+		;;
+	-kaos*)
+		os=-kaos
+		;;
+	-zvmoe)
+		os=-zvmoe
+		;;
+	-dicos*)
+		os=-dicos
+		;;
+	-nacl*)
+		;;
+	-none)
+		;;
+	*)
+		# Get rid of the `-' at the beginning of $os.
+		os=`echo $os | sed 's/[^-]*-//'`
+		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+		exit 1
+		;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+	score-*)
+		os=-elf
+		;;
+	spu-*)
+		os=-elf
+		;;
+	*-acorn)
+		os=-riscix1.2
+		;;
+	arm*-rebel)
+		os=-linux
+		;;
+	arm*-semi)
+		os=-aout
+		;;
+	c4x-* | tic4x-*)
+		os=-coff
+		;;
+	tic54x-*)
+		os=-coff
+		;;
+	tic55x-*)
+		os=-coff
+		;;
+	tic6x-*)
+		os=-coff
+		;;
+	# This must come before the *-dec entry.
+	pdp10-*)
+		os=-tops20
+		;;
+	pdp11-*)
+		os=-none
+		;;
+	*-dec | vax-*)
+		os=-ultrix4.2
+		;;
+	m68*-apollo)
+		os=-domain
+		;;
+	i386-sun)
+		os=-sunos4.0.2
+		;;
+	m68000-sun)
+		os=-sunos3
+		;;
+	m68*-cisco)
+		os=-aout
+		;;
+	mep-*)
+		os=-elf
+		;;
+	mips*-cisco)
+		os=-elf
+		;;
+	mips*-*)
+		os=-elf
+		;;
+	or32-*)
+		os=-coff
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-be)
+		os=-beos
+		;;
+	*-haiku)
+		os=-haiku
+		;;
+	*-ibm)
+		os=-aix
+		;;
+	*-knuth)
+		os=-mmixware
+		;;
+	*-wec)
+		os=-proelf
+		;;
+	*-winbond)
+		os=-proelf
+		;;
+	*-oki)
+		os=-proelf
+		;;
+	*-hp)
+		os=-hpux
+		;;
+	*-hitachi)
+		os=-hiux
+		;;
+	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+		os=-sysv
+		;;
+	*-cbm)
+		os=-amigaos
+		;;
+	*-dg)
+		os=-dgux
+		;;
+	*-dolphin)
+		os=-sysv3
+		;;
+	m68k-ccur)
+		os=-rtu
+		;;
+	m88k-omron*)
+		os=-luna
+		;;
+	*-next )
+		os=-nextstep
+		;;
+	*-sequent)
+		os=-ptx
+		;;
+	*-crds)
+		os=-unos
+		;;
+	*-ns)
+		os=-genix
+		;;
+	i370-*)
+		os=-mvs
+		;;
+	*-next)
+		os=-nextstep3
+		;;
+	*-gould)
+		os=-sysv
+		;;
+	*-highlevel)
+		os=-bsd
+		;;
+	*-encore)
+		os=-bsd
+		;;
+	*-sgi)
+		os=-irix
+		;;
+	*-siemens)
+		os=-sysv4
+		;;
+	*-masscomp)
+		os=-rtu
+		;;
+	f30[01]-fujitsu | f700-fujitsu)
+		os=-uxpv
+		;;
+	*-rom68k)
+		os=-coff
+		;;
+	*-*bug)
+		os=-coff
+		;;
+	*-apple)
+		os=-macos
+		;;
+	*-atari*)
+		os=-mint
+		;;
+	*)
+		os=-none
+		;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+	*-unknown)
+		case $os in
+			-riscix*)
+				vendor=acorn
+				;;
+			-sunos*)
+				vendor=sun
+				;;
+			-cnk*|-aix*)
+				vendor=ibm
+				;;
+			-beos*)
+				vendor=be
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-mpeix*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs* | -opened*)
+				vendor=ibm
+				;;
+			-os400*)
+				vendor=ibm
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+			-tpf*)
+				vendor=ibm
+				;;
+			-vxsim* | -vxworks* | -windiss*)
+				vendor=wrs
+				;;
+			-aux*)
+				vendor=apple
+				;;
+			-hms*)
+				vendor=hitachi
+				;;
+			-mpw* | -macos*)
+				vendor=apple
+				;;
+			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+				vendor=atari
+				;;
+			-vos*)
+				vendor=stratus
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/contrib/file/configure b/contrib/file/configure
index 7d234a19950..757d1431040 100755
--- a/contrib/file/configure
+++ b/contrib/file/configure
@@ -1,13 +1,11 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for file 5.11.
+# Generated by GNU Autoconf 2.69 for file 5.19.
 #
 # Report bugs to .
 #
 #
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
 #
 #
 # This configure script is free software; the Free Software Foundation
@@ -136,6 +134,31 @@ export LANGUAGE
 # CDPATH.
 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
+# Use a proper internal environment variable to ensure we don't fall
+  # into an infinite loop, continuously re-executing ourselves.
+  if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+    _as_can_reexec=no; export _as_can_reexec;
+    # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+  fi
+  # We don't want this to propagate to other subprocesses.
+          { _as_can_reexec=; unset _as_can_reexec;}
 if test "x$CONFIG_SHELL" = x; then
   as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
@@ -169,12 +192,21 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
 else
   exitcode=1; echo positional parameters were not saved.
 fi
-test x\$exitcode = x0 || exit 1"
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
   as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
   as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
   eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
   test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
-test \$(( 1 + 1 )) = 2 || exit 1"
+test \$(( 1 + 1 )) = 2 || exit 1
+
+  test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
+    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+    PATH=/empty FPATH=/empty; export PATH FPATH
+    test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
+      || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1"
   if (eval "$as_required") 2>/dev/null; then :
   as_have_required=yes
 else
@@ -214,21 +246,25 @@ IFS=$as_save_IFS
 
 
       if test "x$CONFIG_SHELL" != x; then :
-  # We cannot yet assume a decent shell, so we have to provide a
-	# neutralization value for shells without unset; and this also
-	# works around shells that cannot unset nonexistent variables.
-	# Preserve -v and -x to the replacement shell.
-	BASH_ENV=/dev/null
-	ENV=/dev/null
-	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
-	export CONFIG_SHELL
-	case $- in # ((((
-	  *v*x* | *x*v* ) as_opts=-vx ;;
-	  *v* ) as_opts=-v ;;
-	  *x* ) as_opts=-x ;;
-	  * ) as_opts= ;;
-	esac
-	exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
+  export CONFIG_SHELL
+             # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
 fi
 
     if test x$as_have_required = xno; then :
@@ -331,6 +367,14 @@ $as_echo X"$as_dir" |
 
 
 } # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
 # as_fn_append VAR VALUE
 # ----------------------
 # Append the text in VALUE to the end of the definition contained in VAR. Take
@@ -452,6 +496,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
   chmod +x "$as_me.lineno" ||
     { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
 
+  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+  # already done that, so ensure we don't try to do so again and fall
+  # in an infinite loop.  This has already happened in practice.
+  _as_can_reexec=no; export _as_can_reexec
   # Don't try to exec as it changes $[0], causing all sort of problems
   # (the dirname of $[0] is not the place where we might find the
   # original and so on.  Autoconf is especially sensitive to this).
@@ -486,16 +534,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
+    # In both cases, we have to default to `cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -507,28 +555,8 @@ else
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-	test -d "$1/.";
-      else
-	case $1 in #(
-	-*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -536,155 +564,8 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
 # Sed expression to map a string onto a valid variable name.
 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
-
-
-# Check that we are running under the correct shell.
 SHELL=${CONFIG_SHELL-/bin/sh}
 
-case X$lt_ECHO in
-X*--fallback-echo)
-  # Remove one level of quotation (which was required for Make).
-  ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','`
-  ;;
-esac
-
-ECHO=${lt_ECHO-echo}
-if test "X$1" = X--no-reexec; then
-  # Discard the --no-reexec flag, and continue.
-  shift
-elif test "X$1" = X--fallback-echo; then
-  # Avoid inline document here, it may be left over
-  :
-elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
-  # Yippee, $ECHO works!
-  :
-else
-  # Restart under the correct shell.
-  exec $SHELL "$0" --no-reexec ${1+"$@"}
-fi
-
-if test "X$1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<_LT_EOF
-$*
-_LT_EOF
-  exit 0
-fi
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-if test -z "$lt_ECHO"; then
-  if test "X${echo_test_string+set}" != Xset; then
-    # find a string as large as possible, as long as the shell can cope with it
-    for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
-      # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
-      if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
-	 { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
-      then
-        break
-      fi
-    done
-  fi
-
-  if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
-     echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
-     test "X$echo_testing_string" = "X$echo_test_string"; then
-    :
-  else
-    # The Solaris, AIX, and Digital Unix default echo programs unquote
-    # backslashes.  This makes it impossible to quote backslashes using
-    #   echo "$something" | sed 's/\\/\\\\/g'
-    #
-    # So, first we look for a working echo in the user's PATH.
-
-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-    for dir in $PATH /usr/ucb; do
-      IFS="$lt_save_ifs"
-      if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
-         test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
-         echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
-         test "X$echo_testing_string" = "X$echo_test_string"; then
-        ECHO="$dir/echo"
-        break
-      fi
-    done
-    IFS="$lt_save_ifs"
-
-    if test "X$ECHO" = Xecho; then
-      # We didn't find a better echo, so look for alternatives.
-      if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
-         echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
-         test "X$echo_testing_string" = "X$echo_test_string"; then
-        # This shell has a builtin print -r that does the trick.
-        ECHO='print -r'
-      elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
-	   test "X$CONFIG_SHELL" != X/bin/ksh; then
-        # If we have ksh, try running configure again with it.
-        ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-        export ORIGINAL_CONFIG_SHELL
-        CONFIG_SHELL=/bin/ksh
-        export CONFIG_SHELL
-        exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
-      else
-        # Try using printf.
-        ECHO='printf %s\n'
-        if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
-	   echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
-	   test "X$echo_testing_string" = "X$echo_test_string"; then
-	  # Cool, printf works
-	  :
-        elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
-	     test "X$echo_testing_string" = 'X\t' &&
-	     echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	     test "X$echo_testing_string" = "X$echo_test_string"; then
-	  CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
-	  export CONFIG_SHELL
-	  SHELL="$CONFIG_SHELL"
-	  export SHELL
-	  ECHO="$CONFIG_SHELL $0 --fallback-echo"
-        elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
-	     test "X$echo_testing_string" = 'X\t' &&
-	     echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	     test "X$echo_testing_string" = "X$echo_test_string"; then
-	  ECHO="$CONFIG_SHELL $0 --fallback-echo"
-        else
-	  # maybe with a smaller string...
-	  prev=:
-
-	  for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
-	    if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
-	    then
-	      break
-	    fi
-	    prev="$cmd"
-	  done
-
-	  if test "$prev" != 'sed 50q "$0"'; then
-	    echo_test_string=`eval $prev`
-	    export echo_test_string
-	    exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
-	  else
-	    # Oops.  We lost completely, so just stick with echo.
-	    ECHO=echo
-	  fi
-        fi
-      fi
-    fi
-  fi
-fi
-
-# Copy echo and quote the copy suitably for passing to libtool from
-# the Makefile, instead of quoting the original, which is used later.
-lt_ECHO=$ECHO
-if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
-   lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
-fi
-
-
-
 
 test -n "$DJDIR" || exec 7<&0 &1
@@ -709,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='file'
 PACKAGE_TARNAME='file'
-PACKAGE_VERSION='5.11'
-PACKAGE_STRING='file 5.11'
+PACKAGE_VERSION='5.19'
+PACKAGE_STRING='file 5.19'
 PACKAGE_BUGREPORT='christos@astron.com'
 PACKAGE_URL=''
 
@@ -750,20 +631,25 @@ ac_includes_default="\
 # include 
 #endif"
 
+ac_header_list=
 ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 IS_CROSS_COMPILE_FALSE
 IS_CROSS_COMPILE_TRUE
 LIBOBJS
+HAVE_VISIBILITY
+CFLAG_VISIBILITY
 OTOOL64
 OTOOL
 LIPO
 NMEDIT
 DSYMUTIL
-lt_ECHO
+MANIFEST_TOOL
 RANLIB
+ac_ct_AR
 AR
+DLLTOOL
 OBJDUMP
 NM
 ac_ct_DUMPBIN
@@ -779,6 +665,7 @@ CPP
 am__fastdepCC_FALSE
 am__fastdepCC_TRUE
 CCDEPMODE
+am__nodep
 AMDEPBACKSLASH
 AMDEP_FALSE
 AMDEP_TRUE
@@ -810,6 +697,8 @@ build_cpu
 build
 AM_BACKSLASH
 AM_DEFAULT_VERBOSITY
+AM_DEFAULT_V
+AM_V
 am__untar
 am__tar
 AMTAR
@@ -879,11 +768,12 @@ enable_elf
 enable_elf_core
 enable_fsect_man5
 enable_dependency_tracking
-enable_shared
 enable_static
 with_pic
+enable_shared
 enable_fast_install
 with_gnu_ld
+with_sysroot
 enable_libtool_lock
 enable_largefile
 enable_warnings
@@ -1352,8 +1242,6 @@ target=$target_alias
 if test "x$host_alias" != x; then
   if test "x$build_alias" = x; then
     cross_compiling=maybe
-    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
-    If a cross compiler is detected then cross compile mode will be used" >&2
   elif test "x$build_alias" != "x$host_alias"; then
     cross_compiling=yes
   fi
@@ -1439,7 +1327,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures file 5.11 to adapt to many kinds of systems.
+\`configure' configures file 5.19 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1509,7 +1397,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of file 5.11:";;
+     short | recursive ) echo "Configuration of file 5.19:";;
    esac
   cat <<\_ACEOF
 
@@ -1517,15 +1405,17 @@ Optional Features:
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --enable-silent-rules          less verbose build output (undo: `make V=1')
-  --disable-silent-rules         verbose build output (undo: `make V=0')
+  --enable-silent-rules   less verbose build output (undo: "make V=1")
+  --disable-silent-rules  verbose build output (undo: "make V=0")
   --disable-elf            disable builtin ELF support
   --disable-elf-core       disable ELF core file support
   --enable-fsect-man5      enable file formats in man section 5
-  --disable-dependency-tracking  speeds up one-time build
-  --enable-dependency-tracking   do not reject slow dependency extractors
+  --enable-dependency-tracking
+                          do not reject slow dependency extractors
+  --disable-dependency-tracking
+                          speeds up one-time build
+  --enable-static[=PKGS]  build static libraries [default=no]
   --enable-shared[=PKGS]  build shared libraries [default=yes]
-  --enable-static[=PKGS]  build static libraries [default=yes]
   --enable-fast-install[=PKGS]
                           optimize for fast installation [default=yes]
   --disable-libtool-lock  avoid locking (might break parallel builds)
@@ -1535,9 +1425,11 @@ Optional Features:
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --with-pic              try to use only PIC/non-PIC objects [default=use
+  --with-pic[=PKGS]       try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-sysroot=DIR Search for dependent libraries within DIR
+                        (or the compiler's sysroot if not specified).
 
 Some influential environment variables:
   CC          C compiler command
@@ -1615,10 +1507,10 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-file configure 5.11
-generated by GNU Autoconf 2.68
+file configure 5.19
+generated by GNU Autoconf 2.69
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
@@ -1895,7 +1787,7 @@ $as_echo "$ac_try_echo"; } >&5
 	 test ! -s conftest.err
        } && test -s conftest$ac_exeext && {
 	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
+	 test -x conftest$ac_exeext
        }; then :
   ac_retval=0
 else
@@ -2138,189 +2030,141 @@ $as_echo "$ac_res" >&6; }
 
 } # ac_fn_c_check_decl
 
-# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
-# --------------------------------------------
-# Tries to find the compile-time value of EXPR in a program that includes
-# INCLUDES, setting VAR accordingly. Returns whether the value could be
-# computed
-ac_fn_c_compute_int ()
+# ac_fn_c_find_uintX_t LINENO BITS VAR
+# ------------------------------------
+# Finds an unsigned integer type with width BITS, setting cache variable VAR
+# accordingly.
+ac_fn_c_find_uintX_t ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if test "$cross_compiling" = yes; then
-    # Depending upon the size, compute the lo and hi bounds.
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5
+$as_echo_n "checking for uint$2_t... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+     # Order is important - never check a type that is potentially smaller
+     # than half of the expected target width.
+     for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \
+	 'unsigned long long int' 'unsigned short int' 'unsigned char'; do
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$4
+$ac_includes_default
 int
 main ()
 {
-static int test_array [1 - 2 * !(($2) >= 0)];
-test_array [0] = 0
+static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)];
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_hi=$ac_mid; break
-else
-  as_fn_arith $ac_mid + 1 && ac_lo=$as_val
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) < 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) >= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_lo=$ac_mid; break
-else
-  as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  ac_lo= ac_hi=
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_hi=$ac_mid
-else
-  as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in #((
-?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
-'') ac_retval=1 ;;
+  case $ac_type in #(
+  uint$2_t) :
+    eval "$3=yes" ;; #(
+  *) :
+    eval "$3=\$ac_type" ;;
 esac
-  else
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       if eval test \"x\$"$3"\" = x"no"; then :
+
+else
+  break
+fi
+     done
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_find_uintX_t
+
+# ac_fn_c_find_intX_t LINENO BITS VAR
+# -----------------------------------
+# Finds a signed integer type with width BITS, setting cache variable VAR
+# accordingly.
+ac_fn_c_find_intX_t ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5
+$as_echo_n "checking for int$2_t... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+     # Order is important - never check a type that is potentially smaller
+     # than half of the expected target width.
+     for ac_type in int$2_t 'int' 'long int' \
+	 'long long int' 'short int' 'signed char'; do
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$4
-static long int longval () { return $2; }
-static unsigned long int ulongval () { return $2; }
-#include 
-#include 
+$ac_includes_default
+	     enum { N = $2 / 2 - 1 };
 int
 main ()
 {
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (($2) < 0)
-    {
-      long int i = longval ();
-      if (i != ($2))
-	return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ($2))
-	return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
+static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))];
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  echo >>conftest.val; read $3 conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+	        enum { N = $2 / 2 - 1 };
+int
+main ()
+{
+static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)
+		 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
 else
-  ac_retval=1
+  case $ac_type in #(
+  int$2_t) :
+    eval "$3=yes" ;; #(
+  *) :
+    eval "$3=\$ac_type" ;;
+esac
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-rm -f conftest.val
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       if eval test \"x\$"$3"\" = x"no"; then :
 
-  fi
+else
+  break
+fi
+     done
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
 
-} # ac_fn_c_compute_int
+} # ac_fn_c_find_intX_t
 cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by file $as_me 5.11, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+It was created by file $as_me 5.19, which was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
 
@@ -2599,6 +2443,9 @@ $as_echo "$as_me: creating cache $cache_file" >&6;}
   >$cache_file
 fi
 
+as_fn_append ac_header_list " stdlib.h"
+as_fn_append ac_header_list " unistd.h"
+as_fn_append ac_header_list " sys/param.h"
 # Check that the precious variables saved in the cache have kept the same
 # value.
 ac_cache_corrupted=false
@@ -2667,7 +2514,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-am__api_version='1.11'
+am__api_version='1.14'
 
 ac_aux_dir=
 for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
@@ -2735,7 +2582,7 @@ case $as_dir/ in #((
     # by default.
     for ac_prog in ginstall scoinst install; do
       for ac_exec_ext in '' $ac_executable_extensions; do
-	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
 	  if test $ac_prog = install &&
 	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
 	    # AIX install.  It has an incompatible calling convention.
@@ -2793,9 +2640,6 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
 $as_echo_n "checking whether build environment is sane... " >&6; }
-# Just in case
-sleep 1
-echo timestamp > conftest.file
 # Reject unsafe characters in $srcdir or the absolute working directory
 # name.  Accept space and tab only in the latter.
 am_lf='
@@ -2806,32 +2650,40 @@ case `pwd` in
 esac
 case $srcdir in
   *[\\\"\#\$\&\'\`$am_lf\ \	]*)
-    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
+    as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
 esac
 
-# Do `set' in a subshell so we don't clobber the current shell's
+# Do 'set' in a subshell so we don't clobber the current shell's
 # arguments.  Must try -L first in case configure is actually a
 # symlink; some systems play weird games with the mod time of symlinks
 # (eg FreeBSD returns the mod time of the symlink's containing
 # directory).
 if (
-   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
-   if test "$*" = "X"; then
-      # -L didn't work.
-      set X `ls -t "$srcdir/configure" conftest.file`
-   fi
-   rm -f conftest.file
-   if test "$*" != "X $srcdir/configure conftest.file" \
-      && test "$*" != "X conftest.file $srcdir/configure"; then
-
-      # If neither matched, then we have a broken ls.  This can happen
-      # if, for instance, CONFIG_SHELL is bash and it inherits a
-      # broken ls alias from the environment.  This has actually
-      # happened.  Such a system could not be considered "sane".
-      as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
-alias in your environment" "$LINENO" 5
-   fi
+   am_has_slept=no
+   for am_try in 1 2; do
+     echo "timestamp, slept: $am_has_slept" > conftest.file
+     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+     if test "$*" = "X"; then
+	# -L didn't work.
+	set X `ls -t "$srcdir/configure" conftest.file`
+     fi
+     if test "$*" != "X $srcdir/configure conftest.file" \
+	&& test "$*" != "X conftest.file $srcdir/configure"; then
 
+	# If neither matched, then we have a broken ls.  This can happen
+	# if, for instance, CONFIG_SHELL is bash and it inherits a
+	# broken ls alias from the environment.  This has actually
+	# happened.  Such a system could not be considered "sane".
+	as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
+  alias in your environment" "$LINENO" 5
+     fi
+     if test "$2" = conftest.file || test $am_try -eq 2; then
+       break
+     fi
+     # Just in case.
+     sleep 1
+     am_has_slept=yes
+   done
    test "$2" = conftest.file
    )
 then
@@ -2843,6 +2695,16 @@ Check your system clock" "$LINENO" 5
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+  ( sleep 1 ) &
+  am_sleep_pid=$!
+fi
+
+rm -f conftest.file
+
 test "$program_prefix" != NONE &&
   program_transform_name="s&^&$program_prefix&;$program_transform_name"
 # Use a double $ so make ignores it.
@@ -2865,12 +2727,12 @@ if test x"${MISSING+set}" != xset; then
   esac
 fi
 # Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
-  am_missing_run="$MISSING --run "
+if eval "$MISSING --is-lightweight"; then
+  am_missing_run="$MISSING "
 else
   am_missing_run=
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
-$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
 fi
 
 if test x"${install_sh}" != xset; then
@@ -2882,10 +2744,10 @@ if test x"${install_sh}" != xset; then
   esac
 fi
 
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'.  However `strip' might not be the right
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip".  However 'strip' might not be the right
 # tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
+# will honor the 'STRIP' environment variable to overrule this program.
 if test "$cross_compiling" != no; then
   if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
@@ -2904,7 +2766,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_STRIP="${ac_tool_prefix}strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2944,7 +2806,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_STRIP="strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2995,7 +2857,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_prog in mkdir gmkdir; do
 	 for ac_exec_ext in '' $ac_executable_extensions; do
-	   { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+	   as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
 	   case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
 	     'mkdir (GNU coreutils) '* | \
 	     'mkdir (coreutils) '* | \
@@ -3024,12 +2886,6 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
 $as_echo "$MKDIR_P" >&6; }
 
-mkdir_p="$MKDIR_P"
-case $mkdir_p in
-  [\\/$]* | ?:[\\/]*) ;;
-  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
-
 for ac_prog in gawk mawk nawk awk
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -3048,7 +2904,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_AWK="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3112,6 +2968,45 @@ else
 fi
 rmdir .tst 2>/dev/null
 
+# Check whether --enable-silent-rules was given.
+if test "${enable_silent_rules+set}" = set; then :
+  enableval=$enable_silent_rules;
+fi
+
+case $enable_silent_rules in # (((
+  yes) AM_DEFAULT_VERBOSITY=0;;
+   no) AM_DEFAULT_VERBOSITY=1;;
+    *) AM_DEFAULT_VERBOSITY=1;;
+esac
+am_make=${MAKE-make}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
+$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
+if ${am_cv_make_support_nested_variables+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if $as_echo 'TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+	@$(TRUE)
+.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
+  am_cv_make_support_nested_variables=yes
+else
+  am_cv_make_support_nested_variables=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
+$as_echo "$am_cv_make_support_nested_variables" >&6; }
+if test $am_cv_make_support_nested_variables = yes; then
+    AM_V='$(V)'
+  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+  AM_V=$AM_DEFAULT_VERBOSITY
+  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AM_BACKSLASH='\'
+
 if test "`cd $srcdir && pwd`" != "`pwd`"; then
   # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
   # is not polluted with repeated "-I."
@@ -3134,7 +3029,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='file'
- VERSION='5.11'
+ VERSION='5.19'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -3162,28 +3057,107 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
 
 MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
 
+# For better backward compatibility.  To be removed once Automake 1.9.x
+# dies out for good.  For more background, see:
+# 
+# 
+mkdir_p='$(MKDIR_P)'
+
 # We need awk for the "check" target.  The system "awk" is bad on
 # some platforms.
-# Always define AMTAR for backward compatibility.
+# Always define AMTAR for backward compatibility.  Yes, it's still used
+# in the wild :-(  We should find a proper way to deprecate it ...
+AMTAR='$${TAR-tar}'
 
-AMTAR=${AMTAR-"${am_missing_run}tar"}
 
-am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+# We'll loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar  pax cpio none'
+
+am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
 
 
 
 
 
+
+# POSIX will say in a future version that running "rm -f" with no argument
+# is OK; and we want to be able to make that assumption in our Makefile
+# recipes.  So use an aggressive probe to check that the usage we want is
+# actually supported "in the wild" to an acceptable degree.
+# See automake bug#10828.
+# To make any issue more visible, cause the running configure to be aborted
+# by default if the 'rm' program in use doesn't match our expectations; the
+# user can still override this though.
+if rm -f && rm -fr && rm -rf; then : OK; else
+  cat >&2 <<'END'
+Oops!
+
+Your 'rm' program seems unable to run without file operands specified
+on the command line, even when the '-f' option is present.  This is contrary
+to the behaviour of most rm programs out there, and not conforming with
+the upcoming POSIX standard: 
+
+Please tell bug-automake@gnu.org about your system, including the value
+of your $PATH and any error possibly output before this message.  This
+can help us improve future automake versions.
+
+END
+  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
+    echo 'Configuration will proceed anyway, since you have set the' >&2
+    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
+    echo >&2
+  else
+    cat >&2 <<'END'
+Aborting the configuration process, to ensure you take notice of the issue.
+
+You can download and install GNU coreutils to get an 'rm' implementation
+that behaves properly: .
+
+If you want to complete the configuration process using your problematic
+'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
+to "yes", and re-run configure.
+
+END
+    as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
+  fi
+fi
 # Check whether --enable-silent-rules was given.
 if test "${enable_silent_rules+set}" = set; then :
   enableval=$enable_silent_rules;
 fi
 
-case $enable_silent_rules in
-yes) AM_DEFAULT_VERBOSITY=0;;
-no)  AM_DEFAULT_VERBOSITY=1;;
-*)   AM_DEFAULT_VERBOSITY=0;;
+case $enable_silent_rules in # (((
+  yes) AM_DEFAULT_VERBOSITY=0;;
+   no) AM_DEFAULT_VERBOSITY=1;;
+    *) AM_DEFAULT_VERBOSITY=0;;
 esac
+am_make=${MAKE-make}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
+$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
+if ${am_cv_make_support_nested_variables+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if $as_echo 'TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+	@$(TRUE)
+.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
+  am_cv_make_support_nested_variables=yes
+else
+  am_cv_make_support_nested_variables=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
+$as_echo "$am_cv_make_support_nested_variables" >&6; }
+if test $am_cv_make_support_nested_variables = yes; then
+    AM_V='$(V)'
+  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+  AM_V=$AM_DEFAULT_VERBOSITY
+  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
 AM_BACKSLASH='\'
 
 
@@ -3368,6 +3342,7 @@ fi
 
 
 
+
 DEPDIR="${am__leading_dot}deps"
 
 ac_config_commands="$ac_config_commands depfiles"
@@ -3387,7 +3362,7 @@ am__quote=
 _am_result=none
 # First try GNU make style include.
 echo "include confinc" > confmf
-# Ignore all kinds of additional output from `make'.
+# Ignore all kinds of additional output from 'make'.
 case `$am_make -s -f confmf 2> /dev/null` in #(
 *the\ am__doit\ target*)
   am__include=include
@@ -3420,6 +3395,7 @@ fi
 if test "x$enable_dependency_tracking" != xno; then
   am_depcomp="$ac_aux_dir/depcomp"
   AMDEPBACKSLASH='\'
+  am__nodep='_no'
 fi
  if test "x$enable_dependency_tracking" != xno; then
   AMDEP_TRUE=
@@ -3452,7 +3428,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3492,7 +3468,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3545,7 +3521,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}cc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3586,7 +3562,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
        ac_prog_rejected=yes
        continue
@@ -3644,7 +3620,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3688,7 +3664,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4134,8 +4110,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include 
 #include 
-#include 
-#include 
+struct stat;
 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
 struct buf { int x; };
 FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -4220,6 +4195,65 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5
+$as_echo_n "checking whether $CC understands -c and -o together... " >&6; }
+if ${am_cv_prog_cc_c_o+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+  # Make sure it works both with $CC and with simple cc.
+  # Following AC_PROG_CC_C_O, we do the test twice because some
+  # compilers refuse to overwrite an existing .o file with -o,
+  # though they will create one.
+  am_cv_prog_cc_c_o=yes
+  for am_i in 1 2; do
+    if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5
+   ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); } \
+         && test -f conftest2.$ac_objext; then
+      : OK
+    else
+      am_cv_prog_cc_c_o=no
+      break
+    fi
+  done
+  rm -f core conftest*
+  unset am_i
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
+$as_echo "$am_cv_prog_cc_c_o" >&6; }
+if test "$am_cv_prog_cc_c_o" != yes; then
+   # Losing compiler, so override with the script.
+   # FIXME: It is wrong to rewrite CC.
+   # But if we don't then we get into trouble of one sort or another.
+   # A longer-term fix would be to have automake use am__CC in this case,
+   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+   CC="$am_aux_dir/compile $CC"
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
 depcc="$CC"   am_compiler_list=
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
@@ -4231,8 +4265,9 @@ else
   # We make a subdir and do the tests there.  Otherwise we can end up
   # making bogus files that we don't know about and never remove.  For
   # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named `D' -- because `-MD' means `put the output
-  # in D'.
+  # making a dummy file named 'D' -- because '-MD' means "put the output
+  # in D".
+  rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
   # using a relative directory.
@@ -4266,16 +4301,16 @@ else
     : > sub/conftest.c
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
+      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+      # Solaris 10 /bin/sh.
+      echo '/* dummy */' > sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # We check with '-c' and '-o' for the sake of the "dashmstdout"
     # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.  Also, some Intel
-    # versions had trouble with output in subdirs
+    # handle '-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs.
     am__obj=sub/conftest.${OBJEXT-o}
     am__minus_obj="-o $am__obj"
     case $depmode in
@@ -4284,16 +4319,16 @@ else
       test "$am__universal" = false || continue
       ;;
     nosideeffect)
-      # after this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested
+      # After this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested.
       if test "x$enable_dependency_tracking" = xyes; then
 	continue
       else
 	break
       fi
       ;;
-    msvisualcpp | msvcmsys)
-      # This compiler won't grok `-c -o', but also, the minuso test has
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+      # This compiler won't grok '-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
       am__obj=conftest.${OBJEXT-o}
@@ -4347,6 +4382,298 @@ else
 fi
 
 
+   case $ac_cv_prog_cc_stdc in #(
+  no) :
+    ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; #(
+  *) :
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5
+$as_echo_n "checking for $CC option to accept ISO C99... " >&6; }
+if ${ac_cv_prog_cc_c99+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_prog_cc_c99=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include 
+#include 
+#include 
+#include 
+#include 
+
+// Check varargs macros.  These examples are taken from C99 6.10.3.5.
+#define debug(...) fprintf (stderr, __VA_ARGS__)
+#define showlist(...) puts (#__VA_ARGS__)
+#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
+static void
+test_varargs_macros (void)
+{
+  int x = 1234;
+  int y = 5678;
+  debug ("Flag");
+  debug ("X = %d\n", x);
+  showlist (The first, second, and third items.);
+  report (x>y, "x is %d but y is %d", x, y);
+}
+
+// Check long long types.
+#define BIG64 18446744073709551615ull
+#define BIG32 4294967295ul
+#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
+#if !BIG_OK
+  your preprocessor is broken;
+#endif
+#if BIG_OK
+#else
+  your preprocessor is broken;
+#endif
+static long long int bignum = -9223372036854775807LL;
+static unsigned long long int ubignum = BIG64;
+
+struct incomplete_array
+{
+  int datasize;
+  double data[];
+};
+
+struct named_init {
+  int number;
+  const wchar_t *name;
+  double average;
+};
+
+typedef const char *ccp;
+
+static inline int
+test_restrict (ccp restrict text)
+{
+  // See if C++-style comments work.
+  // Iterate through items via the restricted pointer.
+  // Also check for declarations in for loops.
+  for (unsigned int i = 0; *(text+i) != '\0'; ++i)
+    continue;
+  return 0;
+}
+
+// Check varargs and va_copy.
+static void
+test_varargs (const char *format, ...)
+{
+  va_list args;
+  va_start (args, format);
+  va_list args_copy;
+  va_copy (args_copy, args);
+
+  const char *str;
+  int number;
+  float fnumber;
+
+  while (*format)
+    {
+      switch (*format++)
+	{
+	case 's': // string
+	  str = va_arg (args_copy, const char *);
+	  break;
+	case 'd': // int
+	  number = va_arg (args_copy, int);
+	  break;
+	case 'f': // float
+	  fnumber = va_arg (args_copy, double);
+	  break;
+	default:
+	  break;
+	}
+    }
+  va_end (args_copy);
+  va_end (args);
+}
+
+int
+main ()
+{
+
+  // Check bool.
+  _Bool success = false;
+
+  // Check restrict.
+  if (test_restrict ("String literal") == 0)
+    success = true;
+  char *restrict newvar = "Another string";
+
+  // Check varargs.
+  test_varargs ("s, d' f .", "string", 65, 34.234);
+  test_varargs_macros ();
+
+  // Check flexible array members.
+  struct incomplete_array *ia =
+    malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
+  ia->datasize = 10;
+  for (int i = 0; i < ia->datasize; ++i)
+    ia->data[i] = i * 1.234;
+
+  // Check named initializers.
+  struct named_init ni = {
+    .number = 34,
+    .name = L"Test wide string",
+    .average = 543.34343,
+  };
+
+  ni.number = 58;
+
+  int dynamic_array[ni.number];
+  dynamic_array[ni.number - 1] = 543;
+
+  // work around unused variable warnings
+  return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
+	  || dynamic_array[ni.number - 1] != 543);
+
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_c99=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c99" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c99" in
+  x)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+  xno)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c99"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5
+$as_echo "$ac_cv_prog_cc_c99" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c99" != xno; then :
+  ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include 
+#include 
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+  xno)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+  ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89
+else
+  ac_cv_prog_cc_stdc=no
+fi
+
+fi
+ ;;
+esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO Standard C" >&5
+$as_echo_n "checking for $CC option to accept ISO Standard C... " >&6; }
+  if ${ac_cv_prog_cc_stdc+:} false; then :
+  $as_echo_n "(cached) " >&6
+fi
+
+  case $ac_cv_prog_cc_stdc in #(
+  no) :
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;; #(
+  '') :
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;; #(
+  *) :
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_stdc" >&5
+$as_echo "$ac_cv_prog_cc_stdc" >&6; } ;;
+esac
+
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -4502,7 +4829,7 @@ do
     for ac_prog in grep ggrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+      as_fn_executable_p "$ac_path_GREP" || continue
 # Check for GNU ac_path_GREP and select it if it is found.
   # Check for GNU $ac_path_GREP
 case `"$ac_path_GREP" --version 2>&1` in
@@ -4568,7 +4895,7 @@ do
     for ac_prog in egrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+      as_fn_executable_p "$ac_path_EGREP" || continue
 # Check for GNU ac_path_EGREP and select it if it is found.
   # Check for GNU $ac_path_EGREP
 case `"$ac_path_EGREP" --version 2>&1` in
@@ -4775,8 +5102,8 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-#	  define __EXTENSIONS__ 1
-	  $ac_includes_default
+#         define __EXTENSIONS__ 1
+          $ac_includes_default
 int
 main ()
 {
@@ -4807,799 +5134,229 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
 
 
 
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
+$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
+if ${ac_cv_c_bigendian+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_CC="${ac_tool_prefix}gcc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_CC"; then
-  ac_ct_CC=$CC
-  # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_CC="gcc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_CC" = x; then
-    CC=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
-  fi
-else
-  CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
-          if test -n "$ac_tool_prefix"; then
-    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_CC="${ac_tool_prefix}cc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  fi
-fi
-if test -z "$CC"; then
-  # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-  ac_prog_rejected=no
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
-       ac_prog_rejected=yes
-       continue
-     fi
-    ac_cv_prog_CC="cc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-if test $ac_prog_rejected = yes; then
-  # We found a bogon in the path, so make sure we never use it.
-  set dummy $ac_cv_prog_CC
-  shift
-  if test $# != 0; then
-    # We chose a different compiler from the bogus one.
-    # However, it has the same basename, so the bogon will be chosen
-    # first if we set CC to just the basename; use the full file name.
-    shift
-    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
-  fi
-fi
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$CC"; then
-  if test -n "$ac_tool_prefix"; then
-  for ac_prog in cl.exe
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-    test -n "$CC" && break
-  done
-fi
-if test -z "$CC"; then
-  ac_ct_CC=$CC
-  for ac_prog in cl.exe
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_CC="$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$ac_ct_CC" && break
-done
-
-  if test "x$ac_ct_CC" = x; then
-    CC=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
-  fi
-fi
-
-fi
-
-
-test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5; }
-
-# Provide some information about the compiler.
-$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
-set X $ac_compile
-ac_compiler=$2
-for ac_option in --version -v -V -qversion; do
-  { { ac_try="$ac_compiler $ac_option >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    sed '10a\
-... rest of stderr output deleted ...
-         10q' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-  fi
-  rm -f conftest.er1 conftest.err
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }
-done
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
-$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if ${ac_cv_c_compiler_gnu+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  ac_cv_c_bigendian=unknown
+    # See if we're dealing with a universal compiler.
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+#ifndef __APPLE_CC__
+	       not a universal capable compiler
+	     #endif
+	     typedef int dummy;
 
-int
-main ()
-{
-#ifndef __GNUC__
-       choke me
-#endif
-
-  ;
-  return 0;
-}
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  ac_compiler_gnu=yes
-else
-  ac_compiler_gnu=no
+
+	# Check for potential -arch flags.  It is not universal unless
+	# there are at least two -arch flags with different values.
+	ac_arch=
+	ac_prev=
+	for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
+	 if test -n "$ac_prev"; then
+	   case $ac_word in
+	     i?86 | x86_64 | ppc | ppc64)
+	       if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
+		 ac_arch=$ac_word
+	       else
+		 ac_cv_c_bigendian=universal
+		 break
+	       fi
+	       ;;
+	   esac
+	   ac_prev=
+	 elif test "x$ac_word" = "x-arch"; then
+	   ac_prev=arch
+	 fi
+       done
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_c_compiler_gnu=$ac_compiler_gnu
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
-$as_echo "$ac_cv_c_compiler_gnu" >&6; }
-if test $ac_compiler_gnu = yes; then
-  GCC=yes
-else
-  GCC=
-fi
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
-$as_echo_n "checking whether $CC accepts -g... " >&6; }
-if ${ac_cv_prog_cc_g+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_save_c_werror_flag=$ac_c_werror_flag
-   ac_c_werror_flag=yes
-   ac_cv_prog_cc_g=no
-   CFLAGS="-g"
-   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_prog_cc_g=yes
-else
-  CFLAGS=""
+    if test $ac_cv_c_bigendian = unknown; then
+      # See if sys/param.h defines the BYTE_ORDER macro.
       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+#include 
+	     #include 
 
 int
 main ()
 {
+#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
+		     && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
+		     && LITTLE_ENDIAN)
+	      bogus endian macros
+	     #endif
 
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-
-else
-  ac_c_werror_flag=$ac_save_c_werror_flag
-	 CFLAGS="-g"
+  # It does; now see whether it defined to BIG_ENDIAN or not.
 	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+#include 
+		#include 
 
 int
 main ()
 {
+#if BYTE_ORDER != BIG_ENDIAN
+		 not big endian
+		#endif
 
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_prog_cc_g=yes
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-   ac_c_werror_flag=$ac_save_c_werror_flag
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
-$as_echo "$ac_cv_prog_cc_g" >&6; }
-if test "$ac_test_CFLAGS" = set; then
-  CFLAGS=$ac_save_CFLAGS
-elif test $ac_cv_prog_cc_g = yes; then
-  if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
-  else
-    CFLAGS="-g"
-  fi
+  ac_cv_c_bigendian=yes
 else
-  if test "$GCC" = yes; then
-    CFLAGS="-O2"
-  else
-    CFLAGS=
-  fi
+  ac_cv_c_bigendian=no
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
-$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if ${ac_cv_prog_cc_c89+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_prog_cc_c89=no
-ac_save_CC=$CC
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    fi
+    if test $ac_cv_c_bigendian = unknown; then
+      # See if  defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include 
-#include 
-#include 
-#include 
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
-     char **p;
-     int i;
-{
-  return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
-  char *s;
-  va_list v;
-  va_start (v,p);
-  s = g (p, va_arg (v,int));
-  va_end (v);
-  return s;
-}
+#include 
 
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
-   function prototypes and stuff, but not '\xHH' hex character constants.
-   These don't provoke an error unfortunately, instead are silently treated
-   as 'x'.  The following induces an error, until -std is added to get
-   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
-   array size at least.  It's necessary to write '\x00'==0 to get something
-   that's true only with -std.  */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
-   inside strings and character constants.  */
-#define FOO(x) 'x'
-int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
 int
 main ()
 {
-return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
+	      bogus endian macros
+	     #endif
+
   ;
   return 0;
 }
 _ACEOF
-for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
-  CC="$ac_save_CC $ac_arg"
-  if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_prog_cc_c89=$ac_arg
-fi
-rm -f core conftest.err conftest.$ac_objext
-  test "x$ac_cv_prog_cc_c89" != "xno" && break
-done
-rm -f conftest.$ac_ext
-CC=$ac_save_CC
+if ac_fn_c_try_compile "$LINENO"; then :
+  # It does; now see whether it defined to _BIG_ENDIAN or not.
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include 
 
-fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c89" in
-  x)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
-$as_echo "none needed" >&6; } ;;
-  xno)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;;
-  *)
-    CC="$CC $ac_cv_prog_cc_c89"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
-$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
-esac
-if test "x$ac_cv_prog_cc_c89" != xno; then :
+int
+main ()
+{
+#ifndef _BIG_ENDIAN
+		 not big endian
+		#endif
 
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-depcc="$CC"   am_compiler_list=
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
-$as_echo_n "checking dependency style of $depcc... " >&6; }
-if ${am_cv_CC_dependencies_compiler_type+:} false; then :
-  $as_echo_n "(cached) " >&6
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_bigendian=yes
 else
-  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
-  # We make a subdir and do the tests there.  Otherwise we can end up
-  # making bogus files that we don't know about and never remove.  For
-  # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named `D' -- because `-MD' means `put the output
-  # in D'.
-  mkdir conftest.dir
-  # Copy depcomp to subdir because otherwise we won't find it if we're
-  # using a relative directory.
-  cp "$am_depcomp" conftest.dir
-  cd conftest.dir
-  # We will build objects and dependencies in a subdirectory because
-  # it helps to detect inapplicable dependency modes.  For instance
-  # both Tru64's cc and ICC support -MD to output dependencies as a
-  # side effect of compilation, but ICC will put the dependencies in
-  # the current directory while Tru64 will put them in the object
-  # directory.
-  mkdir sub
-
-  am_cv_CC_dependencies_compiler_type=none
-  if test "$am_compiler_list" = ""; then
-     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
-  fi
-  am__universal=false
-  case " $depcc " in #(
-     *\ -arch\ *\ -arch\ *) am__universal=true ;;
-     esac
-
-  for depmode in $am_compiler_list; do
-    # Setup a source with many dependencies, because some compilers
-    # like to wrap large dependency lists on column 80 (with \), and
-    # we should not choose a depcomp mode which is confused by this.
-    #
-    # We need to recreate these files for each test, as the compiler may
-    # overwrite some of them when testing with obscure command lines.
-    # This happens at least with the AIX C compiler.
-    : > sub/conftest.c
-    for i in 1 2 3 4 5 6; do
-      echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
-    done
-    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
-
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
-    # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.  Also, some Intel
-    # versions had trouble with output in subdirs
-    am__obj=sub/conftest.${OBJEXT-o}
-    am__minus_obj="-o $am__obj"
-    case $depmode in
-    gcc)
-      # This depmode causes a compiler race in universal mode.
-      test "$am__universal" = false || continue
-      ;;
-    nosideeffect)
-      # after this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested
-      if test "x$enable_dependency_tracking" = xyes; then
-	continue
-      else
-	break
-      fi
-      ;;
-    msvisualcpp | msvcmsys)
-      # This compiler won't grok `-c -o', but also, the minuso test has
-      # not run yet.  These depmodes are late enough in the game, and
-      # so weak that their functioning should not be impacted.
-      am__obj=conftest.${OBJEXT-o}
-      am__minus_obj=
-      ;;
-    none) break ;;
-    esac
-    if depmode=$depmode \
-       source=sub/conftest.c object=$am__obj \
-       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
-       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
-         >/dev/null 2>conftest.err &&
-       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
-       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
-       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
-       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
-      # icc doesn't choke on unknown options, it will just issue warnings
-      # or remarks (even with -Werror).  So we grep stderr for any message
-      # that says an option was ignored or not supported.
-      # When given -MP, icc 7.0 and 7.1 complain thusly:
-      #   icc: Command line warning: ignoring option '-M'; no argument required
-      # The diagnosis changed in icc 8.0:
-      #   icc: Command line remark: option '-MP' not supported
-      if (grep 'ignoring option' conftest.err ||
-          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
-        am_cv_CC_dependencies_compiler_type=$depmode
-        break
-      fi
+  ac_cv_c_bigendian=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     fi
-  done
+    if test $ac_cv_c_bigendian = unknown; then
+      # Compile a test program.
+      if test "$cross_compiling" = yes; then :
+  # Try to guess by grepping values from an object file.
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+short int ascii_mm[] =
+		  { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+		short int ascii_ii[] =
+		  { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+		int use_ascii (int i) {
+		  return ascii_mm[i] + ascii_ii[i];
+		}
+		short int ebcdic_ii[] =
+		  { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+		short int ebcdic_mm[] =
+		  { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+		int use_ebcdic (int i) {
+		  return ebcdic_mm[i] + ebcdic_ii[i];
+		}
+		extern int foo;
 
-  cd ..
-  rm -rf conftest.dir
-else
-  am_cv_CC_dependencies_compiler_type=none
+int
+main ()
+{
+return use_ascii (foo) == use_ebcdic (foo);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
+	      ac_cv_c_bigendian=yes
+	    fi
+	    if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+	      if test "$ac_cv_c_bigendian" = unknown; then
+		ac_cv_c_bigendian=no
+	      else
+		# finding both strings is unlikely to happen, but who knows?
+		ac_cv_c_bigendian=unknown
+	      fi
+	    fi
 fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
-$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
-CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
-
- if
-  test "x$enable_dependency_tracking" != xno \
-  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
-  am__fastdepCC_TRUE=
-  am__fastdepCC_FALSE='#'
-else
-  am__fastdepCC_TRUE='#'
-  am__fastdepCC_FALSE=
-fi
-
-
-if test "x$CC" != xcc; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5
-$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5
-$as_echo_n "checking whether cc understands -c and -o together... " >&6; }
-fi
-set dummy $CC; ac_cc=`$as_echo "$2" |
-		      sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
-if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then :
-  $as_echo_n "(cached) " >&6
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
+$ac_includes_default
 int
 main ()
 {
 
+	     /* Are we little or big endian?  From Harbison&Steele.  */
+	     union
+	     {
+	       long int l;
+	       char c[sizeof (long int)];
+	     } u;
+	     u.l = 1;
+	     return u.c[sizeof (long int) - 1] == 1;
+
   ;
   return 0;
 }
 _ACEOF
-# Make sure it works both with $CC and with simple cc.
-# We do the test twice because some compilers refuse to overwrite an
-# existing .o file with -o, though they will create one.
-ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
-rm -f conftest2.*
-if { { case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } &&
-   test -f conftest2.$ac_objext && { { case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; };
-then
-  eval ac_cv_prog_cc_${ac_cc}_c_o=yes
-  if test "x$CC" != xcc; then
-    # Test first that cc exists at all.
-    if { ac_try='cc -c conftest.$ac_ext >&5'
-  { { case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }; then
-      ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
-      rm -f conftest2.*
-      if { { case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } &&
-	 test -f conftest2.$ac_objext && { { case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; };
-      then
-	# cc works too.
-	:
-      else
-	# cc exists but doesn't like -o.
-	eval ac_cv_prog_cc_${ac_cc}_c_o=no
-      fi
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_c_bigendian=no
+else
+  ac_cv_c_bigendian=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
     fi
-  fi
-else
-  eval ac_cv_prog_cc_${ac_cc}_c_o=no
 fi
-rm -f core conftest*
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5
+$as_echo "$ac_cv_c_bigendian" >&6; }
+ case $ac_cv_c_bigendian in #(
+   yes)
+     $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h
+;; #(
+   no)
+      ;; #(
+   universal)
 
-fi
-if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h
-
-fi
-
-# FIXME: we rely on the cache variable name because
-# there is no other way.
-set dummy $CC
-am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
-eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
-if test "$am_t" != yes; then
-   # Losing compiler, so override with the script.
-   # FIXME: It is wrong to rewrite CC.
-   # But if we don't then we get into trouble of one sort or another.
-   # A longer-term fix would be to have automake use am__CC in this case,
-   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
-   CC="$am_aux_dir/compile $CC"
-fi
+$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
 
+     ;; #(
+   *)
+     as_fn_error $? "unknown endianness
+ presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
+ esac
 
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
@@ -5621,8 +5378,8 @@ esac
 
 
 
-macro_version='2.2.6b'
-macro_revision='1.3017'
+macro_version='2.4.2'
+macro_revision='1.3337'
 
 
 
@@ -5638,6 +5395,75 @@ macro_revision='1.3017'
 
 ltmain="$ac_aux_dir/ltmain.sh"
 
+# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
+$as_echo_n "checking how to print strings... " >&6; }
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
+else
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO ""
+}
+
+case "$ECHO" in
+  printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
+$as_echo "printf" >&6; } ;;
+  print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
+$as_echo "print -r" >&6; } ;;
+  *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
+$as_echo "cat" >&6; } ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
 $as_echo_n "checking for a sed that does not truncate output... " >&6; }
 if ${ac_cv_path_SED+:} false; then :
@@ -5660,7 +5486,7 @@ do
     for ac_prog in sed gsed; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+      as_fn_executable_p "$ac_path_SED" || continue
 # Check for GNU ac_path_SED and select it if it is found.
   # Check for GNU $ac_path_SED
 case `"$ac_path_SED" --version 2>&1` in
@@ -5739,7 +5565,7 @@ do
     for ac_prog in fgrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
+      as_fn_executable_p "$ac_path_FGREP" || continue
 # Check for GNU ac_path_FGREP and select it if it is found.
   # Check for GNU $ac_path_FGREP
 case `"$ac_path_FGREP" --version 2>&1` in
@@ -5973,8 +5799,11 @@ if test "$lt_cv_path_NM" != "no"; then
   NM="$lt_cv_path_NM"
 else
   # Didn't find any BSD compatible name lister, look for dumpbin.
-  if test -n "$ac_tool_prefix"; then
-  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in dumpbin "link -dump"
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
@@ -5992,7 +5821,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6018,7 +5847,7 @@ fi
 fi
 if test -z "$DUMPBIN"; then
   ac_ct_DUMPBIN=$DUMPBIN
-  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+  for ac_prog in dumpbin "link -dump"
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -6036,7 +5865,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6073,6 +5902,15 @@ esac
   fi
 fi
 
+    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
 
   if test "$DUMPBIN" != ":"; then
     NM="$DUMPBIN"
@@ -6092,13 +5930,13 @@ if ${lt_cv_nm_interface+:} false; then :
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:6095: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:6098: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:6101: output\"" >&5)
+  (eval echo "\"\$as_me:$LINENO: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -6144,6 +5982,11 @@ else
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
   amigaos*)
     # On AmigaOS with pdksh, this test takes hours, literally.
     # So we just punt and use a minimum line length of 8192.
@@ -6169,6 +6012,11 @@ else
     lt_cv_sys_max_cmd_len=196608
     ;;
 
+  os2*)
+    # The test takes a long time on OS/2.
+    lt_cv_sys_max_cmd_len=8192
+    ;;
+
   osf*)
     # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
     # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
@@ -6208,8 +6056,8 @@ else
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
-	         = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
+      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
+	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
 	      test $i != 17 # 1/2 MB should be enough
       do
         i=`expr $i + 1`
@@ -6251,8 +6099,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6;
 # Try some XSI features
 xsi_shell=no
 ( _lt_dummy="a/b/c"
-  test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
-      = c,a/b,, \
+  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,b/c, \
     && eval 'test $(( 1 + 1 )) -eq 2 \
     && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
   && xsi_shell=yes
@@ -6301,6 +6149,80 @@ esac
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
+$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
+if ${lt_cv_to_host_file_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+        ;;
+    esac
+    ;;
+  *-*-cygwin* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_noop
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+        ;;
+    esac
+    ;;
+  * ) # unhandled hosts (and "normal" native builds)
+    lt_cv_to_host_file_cmd=func_convert_file_noop
+    ;;
+esac
+
+fi
+
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
+$as_echo "$lt_cv_to_host_file_cmd" >&6; }
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
+$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
+if ${lt_cv_to_tool_file_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  #assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+        ;;
+    esac
+    ;;
+esac
+
+fi
+
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
+$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
+
+
+
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
 $as_echo_n "checking for $LD option to reload object files... " >&6; }
 if ${lt_cv_ld_reload_flag+:} false; then :
@@ -6317,6 +6239,11 @@ case $reload_flag in
 esac
 reload_cmds='$LD$reload_flag -o $output$reload_objs'
 case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    if test "$GCC" != yes; then
+      reload_cmds=false
+    fi
+    ;;
   darwin*)
     if test "$GCC" = yes; then
       reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
@@ -6351,7 +6278,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6391,7 +6318,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_OBJDUMP="objdump"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6480,16 +6407,18 @@ mingw* | pw32*)
   # Base MSYS/MinGW do not provide the 'file' command needed by
   # func_win32_libid shell function, so use a weaker test based on 'objdump',
   # unless we find 'file', for example because we are cross-compiling.
-  if ( file / ) >/dev/null 2>&1; then
+  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
     lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
     lt_cv_file_magic_cmd='func_win32_libid'
   else
-    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+    # Keep this pattern in sync with the one in func_win32_libid.
+    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
     lt_cv_file_magic_cmd='$OBJDUMP -f'
   fi
   ;;
 
-cegcc)
+cegcc*)
   # use the weaker test based on 'objdump'. See mingw*.
   lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
   lt_cv_file_magic_cmd='$OBJDUMP -f'
@@ -6519,6 +6448,10 @@ gnu*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
+haiku*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
 hpux10.20* | hpux11*)
   lt_cv_file_magic_cmd=/usr/bin/file
   case $host_cpu in
@@ -6527,11 +6460,11 @@ hpux10.20* | hpux11*)
     lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
     ;;
   hppa*64*)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'
     lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
     ;;
   *)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library'
     lt_cv_file_magic_test_file=/usr/lib/libc.sl
     ;;
   esac
@@ -6552,8 +6485,8 @@ irix5* | irix6* | nonstopux*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-# This must be Linux ELF.
-linux* | k*bsd*-gnu)
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
@@ -6634,6 +6567,21 @@ esac
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
 $as_echo "$lt_cv_deplibs_check_method" >&6; }
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+  case $host_os in
+  mingw* | pw32*)
+    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+      want_nocaseglob=yes
+    else
+      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
+    fi
+    ;;
+  esac
+fi
+
 file_magic_cmd=$lt_cv_file_magic_cmd
 deplibs_check_method=$lt_cv_deplibs_check_method
 test -z "$deplibs_check_method" && deplibs_check_method=unknown
@@ -6647,11 +6595,164 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown
 
 
 
+
+
+
+
+
+
+
+
+
+
 
 
 if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ar; ac_word=$2
+  # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DLLTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DLLTOOL"; then
+  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+DLLTOOL=$ac_cv_prog_DLLTOOL
+if test -n "$DLLTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
+$as_echo "$DLLTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DLLTOOL"; then
+  ac_ct_DLLTOOL=$DLLTOOL
+  # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DLLTOOL"; then
+  ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_DLLTOOL="dlltool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
+if test -n "$ac_ct_DLLTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
+$as_echo "$ac_ct_DLLTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_DLLTOOL" = x; then
+    DLLTOOL="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DLLTOOL=$ac_ct_DLLTOOL
+  fi
+else
+  DLLTOOL="$ac_cv_prog_DLLTOOL"
+fi
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
+$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
+if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+  # two different shell functions defined in ltmain.sh
+  # decide which to use based on capabilities of $DLLTOOL
+  case `$DLLTOOL --help 2>&1` in
+  *--identify-strict*)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+    ;;
+  *)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+    ;;
+  esac
+  ;;
+*)
+  # fallback: assume linklib IS sharedlib
+  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+  ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
+$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in ar
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
 if ${ac_cv_prog_AR+:} false; then :
@@ -6666,8 +6767,8 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_AR="${ac_tool_prefix}ar"
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -6687,11 +6788,15 @@ $as_echo "no" >&6; }
 fi
 
 
+    test -n "$AR" && break
+  done
 fi
-if test -z "$ac_cv_prog_AR"; then
+if test -z "$AR"; then
   ac_ct_AR=$AR
-  # Extract the first word of "ar", so it can be a program name with args.
-set dummy ar; ac_word=$2
+  for ac_prog in ar
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
 if ${ac_cv_prog_ac_ct_AR+:} false; then :
@@ -6706,8 +6811,8 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_AR="ar"
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_AR="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -6726,6 +6831,10 @@ else
 $as_echo "no" >&6; }
 fi
 
+
+  test -n "$ac_ct_AR" && break
+done
+
   if test "x$ac_ct_AR" = x; then
     AR="false"
   else
@@ -6737,12 +6846,10 @@ ac_tool_warned=yes ;;
 esac
     AR=$ac_ct_AR
   fi
-else
-  AR="$ac_cv_prog_AR"
 fi
 
-test -z "$AR" && AR=ar
-test -z "$AR_FLAGS" && AR_FLAGS=cru
+: ${AR=ar}
+: ${AR_FLAGS=cru}
 
 
 
@@ -6754,6 +6861,64 @@ test -z "$AR_FLAGS" && AR_FLAGS=cru
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
+$as_echo_n "checking for archiver @FILE support... " >&6; }
+if ${lt_cv_ar_at_file+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ar_at_file=no
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  echo conftest.$ac_objext > conftest.lst
+      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
+      { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+  (eval $lt_ar_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+      if test "$ac_status" -eq 0; then
+	# Ensure the archiver fails upon bogus file names.
+	rm -f conftest.$ac_objext libconftest.a
+	{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+  (eval $lt_ar_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+	if test "$ac_status" -ne 0; then
+          lt_cv_ar_at_file=@
+        fi
+      fi
+      rm -f conftest.* libconftest.a
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
+$as_echo "$lt_cv_ar_at_file" >&6; }
+
+if test "x$lt_cv_ar_at_file" = xno; then
+  archiver_list_spec=
+else
+  archiver_list_spec=$lt_cv_ar_at_file
+fi
+
+
+
+
+
+
+
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
 set dummy ${ac_tool_prefix}strip; ac_word=$2
@@ -6771,7 +6936,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_STRIP="${ac_tool_prefix}strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6811,7 +6976,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_STRIP="strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6870,7 +7035,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6910,7 +7075,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_RANLIB="ranlib"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6960,15 +7125,27 @@ old_postuninstall_cmds=
 if test -n "$RANLIB"; then
   case $host_os in
   openbsd*)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
     ;;
   *)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
     ;;
   esac
-  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
 fi
 
+case $host_os in
+  darwin*)
+    lock_old_archive_extraction=yes ;;
+  *)
+    lock_old_archive_extraction=no ;;
+esac
+
+
+
+
+
+
 
 
 
@@ -7076,8 +7253,8 @@ esac
 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
 
 # Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
 
 # Handle CRLF in mingw tool chain
 opt_cr=
@@ -7101,6 +7278,7 @@ for ac_symprfx in "" "_"; do
     # which start with @ or ?.
     lt_cv_sys_global_symbol_pipe="$AWK '"\
 "     {last_section=section; section=\$ 3};"\
+"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
 "     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
 "     \$ 0!~/External *\|/{next};"\
 "     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
@@ -7113,6 +7291,7 @@ for ac_symprfx in "" "_"; do
   else
     lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[	 ]\($symcode$symcode*\)[	 ][	 ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
   fi
+  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
 
   # Check to see that the pipe works correctly.
   pipe_works=no
@@ -7138,8 +7317,8 @@ _LT_EOF
   test $ac_status = 0; }; then
     # Now try to grab the symbols.
     nlist=conftest.nm
-    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5
-  (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
+    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
+  (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; } && test -s "$nlist"; then
@@ -7154,6 +7333,18 @@ _LT_EOF
       if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
 	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
 	  cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -7165,7 +7356,7 @@ _LT_EOF
 	  cat <<_LT_EOF >> conftest.$ac_ext
 
 /* The mapping between symbol names and symbols.  */
-const struct {
+LT_DLSYM_CONST struct {
   const char *name;
   void       *address;
 }
@@ -7191,8 +7382,8 @@ static const void *lt_preloaded_setup() {
 _LT_EOF
 	  # Now try linking the two files.
 	  mv conftest.$ac_objext conftstm.$ac_objext
-	  lt_save_LIBS="$LIBS"
-	  lt_save_CFLAGS="$CFLAGS"
+	  lt_globsym_save_LIBS=$LIBS
+	  lt_globsym_save_CFLAGS=$CFLAGS
 	  LIBS="conftstm.$ac_objext"
 	  CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
 	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
@@ -7202,8 +7393,8 @@ _LT_EOF
   test $ac_status = 0; } && test -s conftest${ac_exeext}; then
 	    pipe_works=yes
 	  fi
-	  LIBS="$lt_save_LIBS"
-	  CFLAGS="$lt_save_CFLAGS"
+	  LIBS=$lt_globsym_save_LIBS
+	  CFLAGS=$lt_globsym_save_CFLAGS
 	else
 	  echo "cannot find nm_test_func in $nlist" >&5
 	fi
@@ -7240,6 +7431,12 @@ else
 $as_echo "ok" >&6; }
 fi
 
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
+  nm_file_list_spec='@'
+fi
 
 
 
@@ -7260,6 +7457,49 @@ fi
 
 
 
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
+$as_echo_n "checking for sysroot... " >&6; }
+
+# Check whether --with-sysroot was given.
+if test "${with_sysroot+set}" = set; then :
+  withval=$with_sysroot;
+else
+  with_sysroot=no
+fi
+
+
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+   if test "$GCC" = yes; then
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
+$as_echo "${with_sysroot}" >&6; }
+   as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
+   ;;
+esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
+$as_echo "${lt_sysroot:-no}" >&6; }
+
+
+
+
 
 # Check whether --enable-libtool-lock was given.
 if test "${enable_libtool_lock+set}" = set; then :
@@ -7292,7 +7532,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 7295 "configure"' > conftest.$ac_ext
+  echo '#line '$LINENO' "configure"' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -7427,7 +7667,7 @@ $as_echo "$lt_cv_cc_needs_belf" >&6; }
     CFLAGS="$SAVE_CFLAGS"
   fi
   ;;
-sparc*-*solaris*)
+*-*solaris*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
@@ -7438,7 +7678,20 @@ sparc*-*solaris*)
     case `/usr/bin/file conftest.o` in
     *64-bit*)
       case $lt_cv_prog_gnu_ld in
-      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      yes*)
+        case $host in
+        i?86-*-solaris*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        sparc*-*-solaris*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+        esac
+        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
+        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+          LD="${LD-ld}_sol2"
+        fi
+        ;;
       *)
 	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
 	  LD="${LD-ld} -64"
@@ -7454,6 +7707,123 @@ esac
 
 need_locks="$enable_libtool_lock"
 
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_MANIFEST_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$MANIFEST_TOOL"; then
+  ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
+if test -n "$MANIFEST_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
+$as_echo "$MANIFEST_TOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
+  ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
+  # Extract the first word of "mt", so it can be a program name with args.
+set dummy mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_MANIFEST_TOOL"; then
+  ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
+if test -n "$ac_ct_MANIFEST_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
+$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_MANIFEST_TOOL" = x; then
+    MANIFEST_TOOL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
+  fi
+else
+  MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
+fi
+
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
+$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
+if ${lt_cv_path_mainfest_tool+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_path_mainfest_tool=no
+  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
+  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+  cat conftest.err >&5
+  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+    lt_cv_path_mainfest_tool=yes
+  fi
+  rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
+$as_echo "$lt_cv_path_mainfest_tool" >&6; }
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+  MANIFEST_TOOL=:
+fi
+
+
+
+
+
 
   case $host_os in
     rhapsody* | darwin*)
@@ -7474,7 +7844,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7514,7 +7884,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7566,7 +7936,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7606,7 +7976,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_NMEDIT="nmedit"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7658,7 +8028,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7698,7 +8068,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_LIPO="lipo"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7750,7 +8120,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7790,7 +8160,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_OTOOL="otool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7842,7 +8212,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7882,7 +8252,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_OTOOL64="otool64"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7961,7 +8331,13 @@ else
 	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
 	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
         _lt_result=$?
-	if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+	# If there is a non-empty error log, and "single_module"
+	# appears in it, assume the flag caused a linker warning
+        if test -s conftest.err && $GREP single_module conftest.err; then
+	  cat conftest.err >&5
+	# Otherwise, if the output was created with a 0 exit code from
+	# the compiler, it worked.
+	elif test -f libconftest.dylib && test $_lt_result -eq 0; then
 	  lt_cv_apple_cc_single_mod=yes
 	else
 	  cat conftest.err >&5
@@ -7972,6 +8348,7 @@ else
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
 $as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
 if ${lt_cv_ld_exported_symbols_list+:} false; then :
@@ -8004,6 +8381,41 @@ rm -f core conftest.err conftest.$ac_objext \
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
+$as_echo_n "checking for -force_load linker flag... " >&6; }
+if ${lt_cv_ld_force_load+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
+      echo "$AR cru libconftest.a conftest.o" >&5
+      $AR cru libconftest.a conftest.o 2>&5
+      echo "$RANLIB libconftest.a" >&5
+      $RANLIB libconftest.a 2>&5
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -s conftest.err && $GREP force_load conftest.err; then
+	cat conftest.err >&5
+      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
+	lt_cv_ld_force_load=yes
+      else
+	cat conftest.err >&5
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
+$as_echo "$lt_cv_ld_force_load" >&6; }
     case $host_os in
     rhapsody* | darwin1.[012])
       _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
@@ -8031,7 +8443,7 @@ $as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
     else
       _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
     fi
-    if test "$DSYMUTIL" != ":"; then
+    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
       _lt_dsymutil='~$DSYMUTIL $lib || :'
     else
       _lt_dsymutil=
@@ -8054,7 +8466,68 @@ done
 
 
 
+
+
 # Set options
+# Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then :
+  enableval=$enable_static; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_static=no
+fi
+
+
+
+
+
+
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then :
+  withval=$with_pic; lt_p=${PACKAGE-default}
+    case $withval in
+    yes|no) pic_mode=$withval ;;
+    *)
+      pic_mode=default
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for lt_pkg in $withval; do
+	IFS="$lt_save_ifs"
+	if test "X$lt_pkg" = "X$lt_p"; then
+	  pic_mode=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  pic_mode=default
+fi
+
+
+test -z "$pic_mode" && pic_mode=yes
+
+
+
+
+
 
 
 
@@ -8095,52 +8568,6 @@ fi
 
 
 
-  # Check whether --enable-static was given.
-if test "${enable_static+set}" = set; then :
-  enableval=$enable_static; p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_static=yes ;;
-    no) enable_static=no ;;
-    *)
-     enable_static=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_static=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac
-else
-  enable_static=yes
-fi
-
-
-
-
-
-
-
-
-
-
-# Check whether --with-pic was given.
-if test "${with_pic+set}" = set; then :
-  withval=$with_pic; pic_mode="$withval"
-else
-  pic_mode=default
-fi
-
-
-test -z "$pic_mode" && pic_mode=default
-
-
-
-
-
 
 
   # Check whether --enable-fast-install was given.
@@ -8200,6 +8627,11 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool'
 
 
 
+
+
+
+
+
 
 
 
@@ -8255,19 +8687,6 @@ _ACEOF
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
 case $host_os in
 aix3*)
   # AIX sometimes has problems with the GCC collect2 program.  For some
@@ -8280,23 +8699,6 @@ aix3*)
   ;;
 esac
 
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\(["`\\]\)/\\\1/g'
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-
-# Sed substitution to delay expansion of an escaped single quote.
-delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-
 # Global variables:
 ofile=libtool
 can_build_shared=yes
@@ -8325,7 +8727,7 @@ for cc_temp in $compiler""; do
     *) break;;
   esac
 done
-cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
 
 
 # Only perform the check for file, if the check method requires it
@@ -8534,7 +8936,12 @@ if test -n "$compiler"; then
 lt_prog_compiler_no_builtin_flag=
 
 if test "$GCC" = yes; then
-  lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+  case $cc_basename in
+  nvcc*)
+    lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
+  *)
+    lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
+  esac
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
@@ -8554,15 +8961,15 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8557: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:8561: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_rtti_exceptions=yes
@@ -8591,8 +8998,6 @@ fi
 lt_prog_compiler_pic=
 lt_prog_compiler_static=
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
-$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 
   if test "$GCC" = yes; then
     lt_prog_compiler_wl='-Wl,'
@@ -8640,6 +9045,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
       lt_prog_compiler_pic='-fno-common'
       ;;
 
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      lt_prog_compiler_static=
+      ;;
+
     hpux*)
       # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
       # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
@@ -8682,6 +9093,15 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
       lt_prog_compiler_pic='-fPIC'
       ;;
     esac
+
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      lt_prog_compiler_wl='-Xlinker '
+      if test -n "$lt_prog_compiler_pic"; then
+        lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic"
+      fi
+      ;;
+    esac
   else
     # PORTME Check for flag to pass linker flags through the system compiler.
     case $host_os in
@@ -8723,7 +9143,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
       lt_prog_compiler_static='-non_shared'
       ;;
 
-    linux* | k*bsd*-gnu)
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
       case $cc_basename in
       # old Intel for x86_64 which still supported -KPIC.
       ecc*)
@@ -8744,7 +9164,13 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 	lt_prog_compiler_pic='--shared'
 	lt_prog_compiler_static='--static'
 	;;
-      pgcc* | pgf77* | pgf90* | pgf95*)
+      nagfor*)
+	# NAG Fortran compiler
+	lt_prog_compiler_wl='-Wl,-Wl,,'
+	lt_prog_compiler_pic='-PIC'
+	lt_prog_compiler_static='-Bstatic'
+	;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
         # Portland Group compilers (*not* the Pentium gcc compiler,
 	# which looks to be a dead project)
 	lt_prog_compiler_wl='-Wl,'
@@ -8756,25 +9182,40 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
         # All Alpha code is PIC.
         lt_prog_compiler_static='-non_shared'
         ;;
-      xl*)
-	# IBM XL C 8.0/Fortran 10.1 on PPC
+      xl* | bgxl* | bgf* | mpixl*)
+	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
 	lt_prog_compiler_wl='-Wl,'
 	lt_prog_compiler_pic='-qpic'
 	lt_prog_compiler_static='-qstaticlink'
 	;;
       *)
 	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl=''
+	  ;;
+	*Sun\ F* | *Sun*Fortran*)
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl='-Qoption ld '
+	  ;;
 	*Sun\ C*)
 	  # Sun C 5.9
 	  lt_prog_compiler_pic='-KPIC'
 	  lt_prog_compiler_static='-Bstatic'
 	  lt_prog_compiler_wl='-Wl,'
 	  ;;
-	*Sun\ F*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
-	  lt_prog_compiler_pic='-KPIC'
+        *Intel*\ [CF]*Compiler*)
+	  lt_prog_compiler_wl='-Wl,'
+	  lt_prog_compiler_pic='-fPIC'
+	  lt_prog_compiler_static='-static'
+	  ;;
+	*Portland\ Group*)
+	  lt_prog_compiler_wl='-Wl,'
+	  lt_prog_compiler_pic='-fpic'
 	  lt_prog_compiler_static='-Bstatic'
-	  lt_prog_compiler_wl=''
 	  ;;
 	esac
 	;;
@@ -8806,7 +9247,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
       lt_prog_compiler_pic='-KPIC'
       lt_prog_compiler_static='-Bstatic'
       case $cc_basename in
-      f77* | f90* | f95*)
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
 	lt_prog_compiler_wl='-Qoption ld ';;
       *)
 	lt_prog_compiler_wl='-Wl,';;
@@ -8863,13 +9304,17 @@ case $host_os in
     lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
     ;;
 esac
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5
-$as_echo "$lt_prog_compiler_pic" >&6; }
-
-
-
-
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+if ${lt_cv_prog_compiler_pic+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
+$as_echo "$lt_cv_prog_compiler_pic" >&6; }
+lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
 
 #
 # Check to make sure the PIC flag actually works.
@@ -8893,15 +9338,15 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8896: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:8900: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_pic_works=yes
@@ -8930,6 +9375,11 @@ fi
 
 
 
+
+
+
+
+
 #
 # Check to make sure the static flag actually works.
 #
@@ -8949,7 +9399,7 @@ else
      if test -s conftest.err; then
        # Append any errors to the config.log.
        cat conftest.err 1>&5
-       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
        if diff conftest.exp conftest.er2 >/dev/null; then
          lt_cv_prog_compiler_static_works=yes
@@ -8998,16 +9448,16 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:9001: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:9005: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_c_o=yes
@@ -9053,16 +9503,16 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:9056: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:9060: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_c_o=yes
@@ -9128,7 +9578,6 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
   hardcode_direct=no
   hardcode_direct_absolute=no
   hardcode_libdir_flag_spec=
-  hardcode_libdir_flag_spec_ld=
   hardcode_libdir_separator=
   hardcode_minus_L=no
   hardcode_shlibpath_var=unsupported
@@ -9175,7 +9624,33 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
   esac
 
   ld_shlibs=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
   if test "$with_gnu_ld" = yes; then
+    case $host_os in
+      aix*)
+	# The AIX port of GNU ld has always aspired to compatibility
+	# with the native linker.  However, as the warning in the GNU ld
+	# block says, versions before 2.19.5* couldn't really create working
+	# shared libraries, regardless of the interface used.
+	case `$LD -v 2>&1` in
+	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+	  *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
+	  *\ \(GNU\ Binutils\)\ [3-9]*) ;;
+	  *)
+	    lt_use_gnu_ld_interface=yes
+	    ;;
+	esac
+	;;
+      *)
+	lt_use_gnu_ld_interface=yes
+	;;
+    esac
+  fi
+
+  if test "$lt_use_gnu_ld_interface" = yes; then
     # If archive_cmds runs LD, not CC, wlarc should be empty
     wlarc='${wl}'
 
@@ -9193,6 +9668,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
     fi
     supports_anon_versioning=no
     case `$LD -v 2>&1` in
+      *GNU\ gold*) supports_anon_versioning=yes ;;
       *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
       *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
       *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
@@ -9208,11 +9684,12 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
 	ld_shlibs=no
 	cat <<_LT_EOF 1>&2
 
-*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** Warning: the GNU linker, at least up to release 2.19, is reported
 *** to be unable to reliably create shared libraries on AIX.
 *** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to modify your PATH
-*** so that a non-GNU linker is found, and then restart.
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
 
 _LT_EOF
       fi
@@ -9248,10 +9725,12 @@ _LT_EOF
       # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
       # as there is no search path for DLLs.
       hardcode_libdir_flag_spec='-L$libdir'
+      export_dynamic_flag_spec='${wl}--export-all-symbols'
       allow_undefined_flag=unsupported
       always_export_symbols=no
       enable_shared_with_static_runtimes=yes
-      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+      exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
 
       if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
         archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
@@ -9269,6 +9748,11 @@ _LT_EOF
       fi
       ;;
 
+    haiku*)
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      link_all_deplibs=yes
+      ;;
+
     interix[3-9]*)
       hardcode_direct=no
       hardcode_shlibpath_var=no
@@ -9284,7 +9768,7 @@ _LT_EOF
       archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
       ;;
 
-    gnu* | linux* | tpf* | k*bsd*-gnu)
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
       tmp_diet=no
       if test "$host_os" = linux-dietlibc; then
 	case $cc_basename in
@@ -9294,15 +9778,16 @@ _LT_EOF
       if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
 	 && test "$tmp_diet" = no
       then
-	tmp_addflag=
+	tmp_addflag=' $pic_flag'
 	tmp_sharedflag='-shared'
 	case $cc_basename,$host_cpu in
         pgcc*)				# Portland Group C compiler
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag'
 	  ;;
-	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	pgf77* | pgf90* | pgf95* | pgfortran*)
+					# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag -Mnomain' ;;
 	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
 	  tmp_addflag=' -i_dynamic' ;;
@@ -9313,13 +9798,17 @@ _LT_EOF
 	lf95*)				# Lahey Fortran 8.1
 	  whole_archive_flag_spec=
 	  tmp_sharedflag='--shared' ;;
-	xl[cC]*)			# IBM XL C 8.0 on PPC (deal with xlf below)
+	xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
 	  tmp_sharedflag='-qmkshrobj'
 	  tmp_addflag= ;;
+	nvcc*)	# Cuda Compiler Driver 2.2
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  compiler_needs_object=yes
+	  ;;
 	esac
 	case `$CC -V 2>&1 | sed 5q` in
 	*Sun\ C*)			# Sun C 5.9
-	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  compiler_needs_object=yes
 	  tmp_sharedflag='-G' ;;
 	*Sun\ F*)			# Sun Fortran 8.3
@@ -9335,17 +9824,16 @@ _LT_EOF
         fi
 
 	case $cc_basename in
-	xlf*)
+	xlf* | bgf* | bgxlf* | mpixlf*)
 	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
 	  whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
-	  hardcode_libdir_flag_spec=
-	  hardcode_libdir_flag_spec_ld='-rpath $libdir'
-	  archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
+	  hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+	  archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
 	  if test "x$supports_anon_versioning" = xyes; then
 	    archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
 	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
 	      echo "local: *; };" >> $output_objdir/$libname.ver~
-	      $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
 	  fi
 	  ;;
 	esac
@@ -9359,8 +9847,8 @@ _LT_EOF
 	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
       else
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       fi
       ;;
 
@@ -9378,8 +9866,8 @@ _LT_EOF
 
 _LT_EOF
       elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	ld_shlibs=no
       fi
@@ -9425,8 +9913,8 @@ _LT_EOF
 
     *)
       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	ld_shlibs=no
       fi
@@ -9466,8 +9954,10 @@ _LT_EOF
       else
 	# If we're using GNU nm, then we don't want the "-C" option.
 	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	# Also, AIX nm treats weak defined symbols like other global
+	# defined symbols, whereas GNU nm marks them as "W".
 	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	else
 	  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	fi
@@ -9554,7 +10044,13 @@ _LT_EOF
 	allow_undefined_flag='-berok'
         # Determine the default libpath from the value encoded in an
         # empty executable.
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+        if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath_+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -9567,25 +10063,32 @@ main ()
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
 
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_="/usr/lib:/lib"
+  fi
+
+fi
+
+  aix_libpath=$lt_cv_aix_libpath_
+fi
 
         hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
-        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
       else
 	if test "$host_cpu" = ia64; then
 	  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
@@ -9594,7 +10097,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 	else
 	 # Determine the default libpath from the value encoded in an
 	 # empty executable.
-	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+	 if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath_+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -9607,30 +10116,42 @@ main ()
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
 
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_="/usr/lib:/lib"
+  fi
+
+fi
+
+  aix_libpath=$lt_cv_aix_libpath_
+fi
 
 	 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
 	  # Warning - without using the other run time loading flags,
 	  # -berok will link without error, but may produce a broken library.
 	  no_undefined_flag=' ${wl}-bernotok'
 	  allow_undefined_flag=' ${wl}-berok'
-	  # Exported symbols can be pulled into shared objects from archives
-	  whole_archive_flag_spec='$convenience'
+	  if test "$with_gnu_ld" = yes; then
+	    # We only use this code for GNU lds that support --whole-archive.
+	    whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	  else
+	    # Exported symbols can be pulled into shared objects from archives
+	    whole_archive_flag_spec='$convenience'
+	  fi
 	  archive_cmds_need_lc=yes
 	  # This is similar to how AIX traditionally builds its shared libraries.
 	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
@@ -9662,20 +10183,64 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       # Microsoft Visual C++.
       # hardcode_libdir_flag_spec is actually meaningless, as there is
       # no search path for DLLs.
-      hardcode_libdir_flag_spec=' '
-      allow_undefined_flag=unsupported
-      # Tell ltmain to make .lib files, not .a files.
-      libext=lib
-      # Tell ltmain to make .dll files, not .so files.
-      shrext_cmds=".dll"
-      # FIXME: Setting linknames here is a bad hack.
-      archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
-      # The linker will automatically build a .lib file if we build a DLL.
-      old_archive_from_new_cmds='true'
-      # FIXME: Should let the user specify the lib program.
-      old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
-      fix_srcfile_path='`cygpath -w "$srcfile"`'
-      enable_shared_with_static_runtimes=yes
+      case $cc_basename in
+      cl*)
+	# Native MSVC
+	hardcode_libdir_flag_spec=' '
+	allow_undefined_flag=unsupported
+	always_export_symbols=yes
+	file_list_spec='@'
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	  else
+	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	  fi~
+	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	  linknames='
+	# The linker will not automatically build a static lib if we build a DLL.
+	# _LT_TAGVAR(old_archive_from_new_cmds, )='true'
+	enable_shared_with_static_runtimes=yes
+	exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+	export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+	# Don't use ranlib
+	old_postinstall_cmds='chmod 644 $oldlib'
+	postlink_cmds='lt_outputfile="@OUTPUT@"~
+	  lt_tool_outputfile="@TOOL_OUTPUT@"~
+	  case $lt_outputfile in
+	    *.exe|*.EXE) ;;
+	    *)
+	      lt_outputfile="$lt_outputfile.exe"
+	      lt_tool_outputfile="$lt_tool_outputfile.exe"
+	      ;;
+	  esac~
+	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	    $RM "$lt_outputfile.manifest";
+	  fi'
+	;;
+      *)
+	# Assume MSVC wrapper
+	hardcode_libdir_flag_spec=' '
+	allow_undefined_flag=unsupported
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+	# The linker will automatically build a .lib file if we build a DLL.
+	old_archive_from_new_cmds='true'
+	# FIXME: Should let the user specify the lib program.
+	old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+	enable_shared_with_static_runtimes=yes
+	;;
+      esac
       ;;
 
     darwin* | rhapsody*)
@@ -9685,7 +10250,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
   hardcode_direct=no
   hardcode_automatic=yes
   hardcode_shlibpath_var=unsupported
-  whole_archive_flag_spec=''
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    whole_archive_flag_spec='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+
+  else
+    whole_archive_flag_spec=''
+  fi
   link_all_deplibs=yes
   allow_undefined_flag="$_lt_dar_allow_undefined"
   case $cc_basename in
@@ -9693,7 +10263,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
      *) _lt_dar_can_shared=$GCC ;;
   esac
   if test "$_lt_dar_can_shared" = "yes"; then
-    output_verbose_link_cmd=echo
+    output_verbose_link_cmd=func_echo_all
     archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
     module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
     archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
@@ -9711,10 +10281,6 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       hardcode_shlibpath_var=no
       ;;
 
-    freebsd1*)
-      ld_shlibs=no
-      ;;
-
     # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
     # support.  Future versions do this automatically, but an explicit c++rt0.o
     # does not break anything, and helps significantly (at the cost of a little
@@ -9727,7 +10293,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       ;;
 
     # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2*)
+    freebsd2.*)
       archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
       hardcode_direct=yes
       hardcode_minus_L=yes
@@ -9736,7 +10302,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
     freebsd* | dragonfly*)
-      archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
       hardcode_libdir_flag_spec='-R$libdir'
       hardcode_direct=yes
       hardcode_shlibpath_var=no
@@ -9744,7 +10310,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
     hpux9*)
       if test "$GCC" = yes; then
-	archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+	archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       else
 	archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       fi
@@ -9759,14 +10325,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       ;;
 
     hpux10*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
       else
 	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
       fi
       if test "$with_gnu_ld" = no; then
 	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
-	hardcode_libdir_flag_spec_ld='+b $libdir'
 	hardcode_libdir_separator=:
 	hardcode_direct=yes
 	hardcode_direct_absolute=yes
@@ -9778,16 +10343,16 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       ;;
 
     hpux11*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
 	case $host_cpu in
 	hppa*64*)
 	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	ia64*)
-	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	esac
       else
@@ -9799,7 +10364,46 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+
+	  # Older versions of the 11.00 compiler do not understand -b yet
+	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
+$as_echo_n "checking if $CC understands -b... " >&6; }
+if ${lt_cv_prog_compiler__b+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler__b=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS -b"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler__b=yes
+       fi
+     else
+       lt_cv_prog_compiler__b=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
+$as_echo "$lt_cv_prog_compiler__b" >&6; }
+
+if test x"$lt_cv_prog_compiler__b" = xyes; then
+    archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+else
+    archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+fi
+
 	  ;;
 	esac
       fi
@@ -9827,26 +10431,39 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
     irix5* | irix6* | nonstopux*)
       if test "$GCC" = yes; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	# Try to use the -exported_symbol ld option, if it does not
 	# work, assume that -exports_file does not work either and
 	# implicitly export all symbols.
-        save_LDFLAGS="$LDFLAGS"
-        LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+	# This should be the same for all languages, so no per-tag cache variable.
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
+if ${lt_cv_irix_exported_symbol+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  save_LDFLAGS="$LDFLAGS"
+	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+	   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-int foo(void) {}
+int foo (void) { return 0; }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
-
+  lt_cv_irix_exported_symbol=yes
+else
+  lt_cv_irix_exported_symbol=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-        LDFLAGS="$save_LDFLAGS"
+           LDFLAGS="$save_LDFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
+	if test "$lt_cv_irix_exported_symbol" = yes; then
+          archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+	fi
       else
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
       fi
       archive_cmds_need_lc='no'
       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
@@ -9908,17 +10525,17 @@ rm -f core conftest.err conftest.$ac_objext \
       hardcode_libdir_flag_spec='-L$libdir'
       hardcode_minus_L=yes
       allow_undefined_flag=unsupported
-      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
       old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
       ;;
 
     osf3*)
       if test "$GCC" = yes; then
 	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
       else
 	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
       fi
       archive_cmds_need_lc='no'
       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
@@ -9928,13 +10545,13 @@ rm -f core conftest.err conftest.$ac_objext \
     osf4* | osf5*)	# as osf3* with the addition of -msym flag
       if test "$GCC" = yes; then
 	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
       else
 	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
 	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
 
 	# Both c and cxx compiler support -rpath directly
 	hardcode_libdir_flag_spec='-rpath $libdir'
@@ -9947,9 +10564,9 @@ rm -f core conftest.err conftest.$ac_objext \
       no_undefined_flag=' -z defs'
       if test "$GCC" = yes; then
 	wlarc='${wl}'
-	archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
       else
 	case `$CC -V 2>&1` in
 	*"Compilers 5.0"*)
@@ -10137,44 +10754,50 @@ x|xyes)
       # to ld, don't add -lc before -lgcc.
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
-      $RM conftest*
-      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+if ${lt_cv_archive_cmds_need_lc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  $RM conftest*
+	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-      if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+	if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; } 2>conftest.err; then
-        soname=conftest
-        lib=conftest
-        libobjs=conftest.$ac_objext
-        deplibs=
-        wl=$lt_prog_compiler_wl
-	pic_flag=$lt_prog_compiler_pic
-        compiler_flags=-v
-        linker_flags=-v
-        verstring=
-        output_objdir=.
-        libname=conftest
-        lt_save_allow_undefined_flag=$allow_undefined_flag
-        allow_undefined_flag=
-        if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+	  soname=conftest
+	  lib=conftest
+	  libobjs=conftest.$ac_objext
+	  deplibs=
+	  wl=$lt_prog_compiler_wl
+	  pic_flag=$lt_prog_compiler_pic
+	  compiler_flags=-v
+	  linker_flags=-v
+	  verstring=
+	  output_objdir=.
+	  libname=conftest
+	  lt_save_allow_undefined_flag=$allow_undefined_flag
+	  allow_undefined_flag=
+	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
   (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }
-        then
-	  archive_cmds_need_lc=no
-        else
-	  archive_cmds_need_lc=yes
-        fi
-        allow_undefined_flag=$lt_save_allow_undefined_flag
-      else
-        cat conftest.err 1>&5
-      fi
-      $RM conftest*
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5
-$as_echo "$archive_cmds_need_lc" >&6; }
+	  then
+	    lt_cv_archive_cmds_need_lc=no
+	  else
+	    lt_cv_archive_cmds_need_lc=yes
+	  fi
+	  allow_undefined_flag=$lt_save_allow_undefined_flag
+	else
+	  cat conftest.err 1>&5
+	fi
+	$RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
+      archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
       ;;
     esac
   fi
@@ -10326,11 +10949,6 @@ esac
 
 
 
-
-
-
-
-
 
 
 
@@ -10345,16 +10963,23 @@ if test "$GCC" = yes; then
     darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
     *) lt_awk_arg="/^libraries:/" ;;
   esac
-  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-  if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
+  case $host_os in
+    mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
+    *) lt_sed_strip_eq="s,=/,/,g" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+  case $lt_search_path_spec in
+  *\;*)
     # if the path contains ";" then we assume it to be the separator
     # otherwise default to the standard path separator (i.e. ":") - it is
     # assumed that no part of a normal pathname contains ";" but that should
     # okay in the real world where ";" in dirpaths is itself problematic.
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
-  else
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-  fi
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+    ;;
+  *)
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+    ;;
+  esac
   # Ok, now we have the path, separated by spaces, we can step through it
   # and add multilib dir if necessary.
   lt_tmp_lt_search_path_spec=
@@ -10367,7 +10992,7 @@ if test "$GCC" = yes; then
 	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
     fi
   done
-  lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
+  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
 BEGIN {RS=" "; FS="/|\n";} {
   lt_foo="";
   lt_count=0;
@@ -10387,7 +11012,13 @@ BEGIN {RS=" "; FS="/|\n";} {
   if (lt_foo != "") { lt_freq[lt_foo]++; }
   if (lt_freq[lt_foo] == 1) { print lt_foo; }
 }'`
-  sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
+  # AWK program above erroneously prepends '/' to C:/dos/paths
+  # for these hosts.
+  case $host_os in
+    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+      $SED 's,/\([A-Za-z]:\),\1,g'` ;;
+  esac
+  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
 else
   sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
 fi
@@ -10413,7 +11044,7 @@ need_version=unknown
 
 case $host_os in
 aix3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
   shlibpath_var=LIBPATH
 
@@ -10422,7 +11053,7 @@ aix3*)
   ;;
 
 aix[4-9]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   hardcode_into_libs=yes
@@ -10475,7 +11106,7 @@ amigaos*)
   m68k)
     library_names_spec='$libname.ixlibrary $libname.a'
     # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
     ;;
   esac
   ;;
@@ -10487,7 +11118,7 @@ beos*)
   ;;
 
 bsdi[45]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
@@ -10506,8 +11137,9 @@ cygwin* | mingw* | pw32* | cegcc*)
   need_version=no
   need_lib_prefix=no
 
-  case $GCC,$host_os in
-  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
     postinstall_cmds='base_file=`basename \${file}`~
@@ -10528,36 +11160,83 @@ cygwin* | mingw* | pw32* | cegcc*)
     cygwin*)
       # Cygwin DLLs use 'cyg' prefix rather than 'lib'
       soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
       ;;
     mingw* | cegcc*)
       # MinGW DLLs use traditional 'lib' prefix
       soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
-        # It is most probably a Windows format PATH printed by
-        # mingw gcc, but we are running on Cygwin. Gcc prints its search
-        # path with ; separators, and with drive letters. We can handle the
-        # drive letters (cygwin fileutils understands them), so leave them,
-        # especially as we might pass files found there to a mingw objdump,
-        # which wouldn't understand a cygwinified path. Ahh.
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-      else
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-      fi
       ;;
     pw32*)
       # pw32 DLLs use 'pw' prefix rather than 'lib'
       library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
       ;;
     esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
     ;;
 
   *)
+    # Assume MSVC wrapper
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
     ;;
   esac
-  dynamic_linker='Win32 ld.exe'
   # FIXME: first we should search . and the directory the executable is in
   shlibpath_var=PATH
   ;;
@@ -10578,7 +11257,7 @@ darwin* | rhapsody*)
   ;;
 
 dgux*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
@@ -10586,10 +11265,6 @@ dgux*)
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
-freebsd1*)
-  dynamic_linker=no
-  ;;
-
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -10597,7 +11272,7 @@ freebsd* | dragonfly*)
     objformat=`/usr/bin/objformat`
   else
     case $host_os in
-    freebsd[123]*) objformat=aout ;;
+    freebsd[23].*) objformat=aout ;;
     *) objformat=elf ;;
     esac
   fi
@@ -10615,7 +11290,7 @@ freebsd* | dragonfly*)
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
-  freebsd2*)
+  freebsd2.*)
     shlibpath_overrides_runpath=yes
     ;;
   freebsd3.[01]* | freebsdelf3.[01]*)
@@ -10635,12 +11310,26 @@ freebsd* | dragonfly*)
   ;;
 
 gnu*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+haiku*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
@@ -10686,12 +11375,14 @@ hpux9* | hpux10* | hpux11*)
     soname_spec='${libname}${release}${shared_ext}$major'
     ;;
   esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
   postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
   ;;
 
 interix[3-9]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
@@ -10707,7 +11398,7 @@ irix5* | irix6* | nonstopux*)
     nonstopux*) version_type=nonstopux ;;
     *)
 	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux
+		version_type=linux # correct to gnu/linux during the next big refactor
 	else
 		version_type=irix
 	fi ;;
@@ -10744,9 +11435,9 @@ linux*oldld* | linux*aout* | linux*coff*)
   dynamic_linker=no
   ;;
 
-# This must be Linux ELF.
-linux* | k*bsd*-gnu)
-  version_type=linux
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -10754,12 +11445,17 @@ linux* | k*bsd*-gnu)
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
+
   # Some binutils ld are patched to set DT_RUNPATH
-  save_LDFLAGS=$LDFLAGS
-  save_libdir=$libdir
-  eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
-       LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+	 LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -10772,13 +11468,17 @@ main ()
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
   if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
-  shlibpath_overrides_runpath=yes
+  lt_cv_shlibpath_overrides_runpath=yes
 fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-  LDFLAGS=$save_LDFLAGS
-  libdir=$save_libdir
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+
+fi
+
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
 
   # This implies no fast_install, which is unacceptable.
   # Some rework will be needed to allow for fast_install
@@ -10787,7 +11487,7 @@ rm -f core conftest.err conftest.$ac_objext \
 
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
     sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
@@ -10819,7 +11519,7 @@ netbsd*)
   ;;
 
 newsos6)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
@@ -10888,7 +11588,7 @@ rdos*)
   ;;
 
 solaris*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -10913,7 +11613,7 @@ sunos4*)
   ;;
 
 sysv4 | sysv4.3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -10937,7 +11637,7 @@ sysv4 | sysv4.3*)
 
 sysv4*MP*)
   if test -d /usr/nec ;then
-    version_type=linux
+    version_type=linux # correct to gnu/linux during the next big refactor
     library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
     soname_spec='$libname${shared_ext}.$major'
     shlibpath_var=LD_LIBRARY_PATH
@@ -10968,7 +11668,7 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
 
 tpf*)
   # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -10978,7 +11678,7 @@ tpf*)
   ;;
 
 uts4*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -11084,6 +11784,11 @@ fi
 
 
 
+
+
+
+
+
 
 
 
@@ -11420,7 +12125,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11423 "configure"
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11461,7 +12166,13 @@ else
 #  endif
 #endif
 
-void fnord() { int i=42;}
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
 int main ()
 {
   void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
@@ -11470,7 +12181,11 @@ int main ()
   if (self)
     {
       if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
       /* dlclose (self); */
     }
   else
@@ -11516,7 +12231,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11519 "configure"
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11557,7 +12272,13 @@ else
 #  endif
 #endif
 
-void fnord() { int i=42;}
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
 int main ()
 {
   void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
@@ -11566,7 +12287,11 @@ int main ()
   if (self)
     {
       if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
       /* dlclose (self); */
     }
   else
@@ -11735,6 +12460,8 @@ CC="$lt_save_CC"
 
 
 
+
+
         ac_config_commands="$ac_config_commands libtool"
 
 
@@ -11744,6 +12471,91 @@ CC="$lt_save_CC"
 
 
 
+
+  CFLAG_VISIBILITY=
+  HAVE_VISIBILITY=0
+  if test -n "$GCC"; then
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the -Werror option is usable" >&5
+$as_echo_n "checking whether the -Werror option is usable... " >&6; }
+    if ${gl_cv_cc_vis_werror+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+      gl_save_CFLAGS="$CFLAGS"
+      CFLAGS="$CFLAGS -Werror"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_cc_vis_werror=yes
+else
+  gl_cv_cc_vis_werror=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+      CFLAGS="$gl_save_CFLAGS"
+fi
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_vis_werror" >&5
+$as_echo "$gl_cv_cc_vis_werror" >&6; }
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for simple visibility declarations" >&5
+$as_echo_n "checking for simple visibility declarations... " >&6; }
+    if ${gl_cv_cc_visibility+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+      gl_save_CFLAGS="$CFLAGS"
+      CFLAGS="$CFLAGS -fvisibility=hidden"
+                                    if test $gl_cv_cc_vis_werror = yes; then
+        CFLAGS="$CFLAGS -Werror"
+      fi
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+extern __attribute__((__visibility__("hidden"))) int hiddenvar;
+             extern __attribute__((__visibility__("default"))) int exportedvar;
+             extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
+             extern __attribute__((__visibility__("default"))) int exportedfunc (void);
+             void dummyfunc (void) {}
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_cc_visibility=yes
+else
+  gl_cv_cc_visibility=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+      CFLAGS="$gl_save_CFLAGS"
+fi
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_visibility" >&5
+$as_echo "$gl_cv_cc_visibility" >&6; }
+    if test $gl_cv_cc_visibility = yes; then
+      CFLAG_VISIBILITY="-fvisibility=hidden"
+      HAVE_VISIBILITY=1
+    fi
+  fi
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_VISIBILITY $HAVE_VISIBILITY
+_ACEOF
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
 if ${ac_cv_header_stdc+:} false; then :
@@ -11960,7 +12772,7 @@ fi
 
 done
 
-for ac_header in utime.h wchar.h wctype.h limits.h
+for ac_header in stddef.h utime.h wchar.h wctype.h limits.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -12023,11 +12835,11 @@ else
 int
 main ()
 {
-/* FIXME: Include the comments suggested by Paul. */
+
 #ifndef __cplusplus
-  /* Ultrix mips cc rejects this.  */
+  /* Ultrix mips cc rejects this sort of thing.  */
   typedef int charset[2];
-  const charset cs;
+  const charset cs = { 0, 0 };
   /* SunOS 4.1.1 cc rejects this.  */
   char const *const *pcpcc;
   char **ppc;
@@ -12044,8 +12856,9 @@ main ()
   ++pcpcc;
   ppc = (char**) pcpcc;
   pcpcc = (char const *const *) ppc;
-  { /* SCO 3.2v4 cc rejects this.  */
-    char *t;
+  { /* SCO 3.2v4 cc rejects this sort of thing.  */
+    char tx;
+    char *t = &tx;
     char const *s = 0 ? (char *) 0 : (char const *) 0;
 
     *t++ = 0;
@@ -12061,10 +12874,10 @@ main ()
     iptr p = 0;
     ++p;
   }
-  { /* AIX XL C 1.02.0.0 rejects this saying
+  { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
        "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
-    struct s { int j; const int *ap[3]; };
-    struct s *b; b->j = 5;
+    struct s { int j; const int *ap[3]; } bx;
+    struct s *b = &bx; b->j = 5;
   }
   { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
     const int foo = 10;
@@ -12125,6 +12938,16 @@ _ACEOF
 fi
 
 
+ac_fn_c_check_member "$LINENO" "struct tm" "tm_gmtoff" "ac_cv_member_struct_tm_tm_gmtoff" "$ac_includes_default"
+if test "x$ac_cv_member_struct_tm_tm_gmtoff" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_TM_TM_GMTOFF 1
+_ACEOF
+
+
+fi
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5
 $as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; }
 if ${ac_cv_struct_tm+:} false; then :
@@ -12160,16 +12983,10 @@ $as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h
 
 fi
 
-ac_fn_c_check_member "$LINENO" "struct tm" "tm_gmtoff" "ac_cv_member_struct_tm_tm_gmtoff" "$ac_includes_default"
-if test "x$ac_cv_member_struct_tm_tm_gmtoff" = xyes; then :
+ac_fn_c_check_member "$LINENO" "struct tm" "tm_zone" "ac_cv_member_struct_tm_tm_zone" "#include 
+#include <$ac_cv_struct_tm>
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_TM_TM_GMTOFF 1
-_ACEOF
-
-
-fi
-ac_fn_c_check_member "$LINENO" "struct tm" "tm_zone" "ac_cv_member_struct_tm_tm_zone" "$ac_includes_default"
+"
 if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then :
 
 cat >>confdefs.h <<_ACEOF
@@ -12179,6 +12996,60 @@ _ACEOF
 
 fi
 
+if test "$ac_cv_member_struct_tm_tm_zone" = yes; then
+
+$as_echo "#define HAVE_TM_ZONE 1" >>confdefs.h
+
+else
+  ac_fn_c_check_decl "$LINENO" "tzname" "ac_cv_have_decl_tzname" "#include 
+"
+if test "x$ac_cv_have_decl_tzname" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_TZNAME $ac_have_decl
+_ACEOF
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tzname" >&5
+$as_echo_n "checking for tzname... " >&6; }
+if ${ac_cv_var_tzname+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include 
+#if !HAVE_DECL_TZNAME
+extern char *tzname[];
+#endif
+
+int
+main ()
+{
+return tzname[0][0];
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_var_tzname=yes
+else
+  ac_cv_var_tzname=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_var_tzname" >&5
+$as_echo "$ac_cv_var_tzname" >&6; }
+  if test $ac_cv_var_tzname = yes; then
+
+$as_echo "#define HAVE_TZNAME 1" >>confdefs.h
+
+  fi
+fi
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tm_zone in struct tm" >&5
 $as_echo_n "checking for tm_zone in struct tm... " >&6; }
 if ${ac_cv_struct_tm_zone+:} false; then :
@@ -12536,6 +13407,8 @@ _ACEOF
 esac
 rm -rf conftest*
   fi
+
+
 fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5
@@ -12673,104 +13546,616 @@ $as_echo "#define HAVE_STRUCT_OPTION 1" >>confdefs.h
 
 fi
 
-
 ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default"
 if test "x$ac_cv_type_pid_t" = xyes; then :
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_PID_T 1
-_ACEOF
-
-
-fi
-ac_fn_c_check_type "$LINENO" "uint8_t" "ac_cv_type_uint8_t" "$ac_includes_default"
-if test "x$ac_cv_type_uint8_t" = xyes; then :
+else
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_UINT8_T 1
+#define pid_t int
 _ACEOF
 
-
-fi
-ac_fn_c_check_type "$LINENO" "uint16_t" "ac_cv_type_uint16_t" "$ac_includes_default"
-if test "x$ac_cv_type_uint16_t" = xyes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_UINT16_T 1
-_ACEOF
-
-
-fi
-ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "$ac_includes_default"
-if test "x$ac_cv_type_uint32_t" = xyes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_UINT32_T 1
-_ACEOF
-
-
-fi
-ac_fn_c_check_type "$LINENO" "int32_t" "ac_cv_type_int32_t" "$ac_includes_default"
-if test "x$ac_cv_type_int32_t" = xyes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_INT32_T 1
-_ACEOF
-
-
-fi
-ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "$ac_includes_default"
-if test "x$ac_cv_type_uint64_t" = xyes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_UINT64_T 1
-_ACEOF
-
-
-fi
-ac_fn_c_check_type "$LINENO" "int64_t" "ac_cv_type_int64_t" "$ac_includes_default"
-if test "x$ac_cv_type_int64_t" = xyes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_INT64_T 1
-_ACEOF
-
-
 fi
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
-$as_echo_n "checking size of long long... " >&6; }
-if ${ac_cv_sizeof_long_long+:} false; then :
+ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t"
+case $ac_cv_c_uint8_t in #(
+  no|yes) ;; #(
+  *)
+
+$as_echo "#define _UINT8_T 1" >>confdefs.h
+
+
+cat >>confdefs.h <<_ACEOF
+#define uint8_t $ac_cv_c_uint8_t
+_ACEOF
+;;
+  esac
+
+ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t"
+case $ac_cv_c_uint16_t in #(
+  no|yes) ;; #(
+  *)
+
+
+cat >>confdefs.h <<_ACEOF
+#define uint16_t $ac_cv_c_uint16_t
+_ACEOF
+;;
+  esac
+
+ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t"
+case $ac_cv_c_uint32_t in #(
+  no|yes) ;; #(
+  *)
+
+$as_echo "#define _UINT32_T 1" >>confdefs.h
+
+
+cat >>confdefs.h <<_ACEOF
+#define uint32_t $ac_cv_c_uint32_t
+_ACEOF
+;;
+  esac
+
+ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t"
+case $ac_cv_c_int32_t in #(
+  no|yes) ;; #(
+  *)
+
+cat >>confdefs.h <<_ACEOF
+#define int32_t $ac_cv_c_int32_t
+_ACEOF
+;;
+esac
+
+ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t"
+case $ac_cv_c_uint64_t in #(
+  no|yes) ;; #(
+  *)
+
+$as_echo "#define _UINT64_T 1" >>confdefs.h
+
+
+cat >>confdefs.h <<_ACEOF
+#define uint64_t $ac_cv_c_uint64_t
+_ACEOF
+;;
+  esac
+
+ac_fn_c_find_intX_t "$LINENO" "64" "ac_cv_c_int64_t"
+case $ac_cv_c_int64_t in #(
+  no|yes) ;; #(
+  *)
+
+cat >>confdefs.h <<_ACEOF
+#define int64_t $ac_cv_c_int64_t
+_ACEOF
+;;
+esac
+
+
+  ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "$ac_includes_default"
+if test "x$ac_cv_type_intptr_t" = xyes; then :
+
+$as_echo "#define HAVE_INTPTR_T 1" >>confdefs.h
+
+else
+  for ac_type in 'int' 'long int' 'long long int'; do
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($ac_type))];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+cat >>confdefs.h <<_ACEOF
+#define intptr_t $ac_type
+_ACEOF
+
+	  ac_type=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       test -z "$ac_type" && break
+     done
+fi
+
+
+
+  ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "$ac_includes_default"
+if test "x$ac_cv_type_uintptr_t" = xyes; then :
+
+$as_echo "#define HAVE_UINTPTR_T 1" >>confdefs.h
+
+else
+  for ac_type in 'unsigned int' 'unsigned long int' \
+	'unsigned long long int'; do
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($ac_type))];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+cat >>confdefs.h <<_ACEOF
+#define uintptr_t $ac_type
+_ACEOF
+
+	  ac_type=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       test -z "$ac_type" && break
+     done
+fi
+
+
+
+
+
+  for ac_header in $ac_header_list
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+
+
+
+for ac_func in getpagesize
+do :
+  ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize"
+if test "x$ac_cv_func_getpagesize" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_GETPAGESIZE 1
+_ACEOF
+
+fi
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5
+$as_echo_n "checking for working mmap... " >&6; }
+if ${ac_cv_func_mmap_fixed_mapped+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long"        "$ac_includes_default"; then :
-
+  if test "$cross_compiling" = yes; then :
+  ac_cv_func_mmap_fixed_mapped=no
 else
-  if test "$ac_cv_type_long_long" = yes; then
-     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (long long)
-See \`config.log' for more details" "$LINENO" 5; }
-   else
-     ac_cv_sizeof_long_long=0
-   fi
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+/* malloc might have been renamed as rpl_malloc. */
+#undef malloc
+
+/* Thanks to Mike Haertel and Jim Avera for this test.
+   Here is a matrix of mmap possibilities:
+	mmap private not fixed
+	mmap private fixed at somewhere currently unmapped
+	mmap private fixed at somewhere already mapped
+	mmap shared not fixed
+	mmap shared fixed at somewhere currently unmapped
+	mmap shared fixed at somewhere already mapped
+   For private mappings, we should verify that changes cannot be read()
+   back from the file, nor mmap's back from the file at a different
+   address.  (There have been systems where private was not correctly
+   implemented like the infamous i386 svr4.0, and systems where the
+   VM page cache was not coherent with the file system buffer cache
+   like early versions of FreeBSD and possibly contemporary NetBSD.)
+   For shared mappings, we should conversely verify that changes get
+   propagated back to all the places they're supposed to be.
+
+   Grep wants private fixed already mapped.
+   The main things grep needs to know about mmap are:
+   * does it exist and is it safe to write into the mmap'd area
+   * how to use it (BSD variants)  */
+
+#include 
+#include 
+
+#if !defined STDC_HEADERS && !defined HAVE_STDLIB_H
+char *malloc ();
+#endif
+
+/* This mess was copied from the GNU getpagesize.h.  */
+#ifndef HAVE_GETPAGESIZE
+# ifdef _SC_PAGESIZE
+#  define getpagesize() sysconf(_SC_PAGESIZE)
+# else /* no _SC_PAGESIZE */
+#  ifdef HAVE_SYS_PARAM_H
+#   include 
+#   ifdef EXEC_PAGESIZE
+#    define getpagesize() EXEC_PAGESIZE
+#   else /* no EXEC_PAGESIZE */
+#    ifdef NBPG
+#     define getpagesize() NBPG * CLSIZE
+#     ifndef CLSIZE
+#      define CLSIZE 1
+#     endif /* no CLSIZE */
+#    else /* no NBPG */
+#     ifdef NBPC
+#      define getpagesize() NBPC
+#     else /* no NBPC */
+#      ifdef PAGESIZE
+#       define getpagesize() PAGESIZE
+#      endif /* PAGESIZE */
+#     endif /* no NBPC */
+#    endif /* no NBPG */
+#   endif /* no EXEC_PAGESIZE */
+#  else /* no HAVE_SYS_PARAM_H */
+#   define getpagesize() 8192	/* punt totally */
+#  endif /* no HAVE_SYS_PARAM_H */
+# endif /* no _SC_PAGESIZE */
+
+#endif /* no HAVE_GETPAGESIZE */
+
+int
+main ()
+{
+  char *data, *data2, *data3;
+  const char *cdata2;
+  int i, pagesize;
+  int fd, fd2;
+
+  pagesize = getpagesize ();
+
+  /* First, make a file with some known garbage in it. */
+  data = (char *) malloc (pagesize);
+  if (!data)
+    return 1;
+  for (i = 0; i < pagesize; ++i)
+    *(data + i) = rand ();
+  umask (0);
+  fd = creat ("conftest.mmap", 0600);
+  if (fd < 0)
+    return 2;
+  if (write (fd, data, pagesize) != pagesize)
+    return 3;
+  close (fd);
+
+  /* Next, check that the tail of a page is zero-filled.  File must have
+     non-zero length, otherwise we risk SIGBUS for entire page.  */
+  fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600);
+  if (fd2 < 0)
+    return 4;
+  cdata2 = "";
+  if (write (fd2, cdata2, 1) != 1)
+    return 5;
+  data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L);
+  if (data2 == MAP_FAILED)
+    return 6;
+  for (i = 0; i < pagesize; ++i)
+    if (*(data2 + i))
+      return 7;
+  close (fd2);
+  if (munmap (data2, pagesize))
+    return 8;
+
+  /* Next, try to mmap the file at a fixed address which already has
+     something else allocated at it.  If we can, also make sure that
+     we see the same garbage.  */
+  fd = open ("conftest.mmap", O_RDWR);
+  if (fd < 0)
+    return 9;
+  if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
+		     MAP_PRIVATE | MAP_FIXED, fd, 0L))
+    return 10;
+  for (i = 0; i < pagesize; ++i)
+    if (*(data + i) != *(data2 + i))
+      return 11;
+
+  /* Finally, make sure that changes to the mapped area do not
+     percolate back to the file as seen by read().  (This is a bug on
+     some variants of i386 svr4.0.)  */
+  for (i = 0; i < pagesize; ++i)
+    *(data2 + i) = *(data2 + i) + 1;
+  data3 = (char *) malloc (pagesize);
+  if (!data3)
+    return 12;
+  if (read (fd, data3, pagesize) != pagesize)
+    return 13;
+  for (i = 0; i < pagesize; ++i)
+    if (*(data + i) != *(data3 + i))
+      return 14;
+  close (fd);
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_mmap_fixed_mapped=yes
+else
+  ac_cv_func_mmap_fixed_mapped=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
-$as_echo "$ac_cv_sizeof_long_long" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_fixed_mapped" >&5
+$as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; }
+if test $ac_cv_func_mmap_fixed_mapped = yes; then
 
+$as_echo "#define HAVE_MMAP 1" >>confdefs.h
 
+fi
+rm -f conftest.mmap conftest.txt
 
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
+for ac_header in vfork.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default"
+if test "x$ac_cv_header_vfork_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_VFORK_H 1
 _ACEOF
 
+fi
 
+done
+
+for ac_func in fork vfork
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+if test "x$ac_cv_func_fork" = xyes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5
+$as_echo_n "checking for working fork... " >&6; }
+if ${ac_cv_func_fork_works+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  ac_cv_func_fork_works=cross
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+
+	  /* By Ruediger Kuhlmann. */
+	  return fork () < 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_fork_works=yes
+else
+  ac_cv_func_fork_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5
+$as_echo "$ac_cv_func_fork_works" >&6; }
+
+else
+  ac_cv_func_fork_works=$ac_cv_func_fork
+fi
+if test "x$ac_cv_func_fork_works" = xcross; then
+  case $host in
+    *-*-amigaos* | *-*-msdosdjgpp*)
+      # Override, as these systems have only a dummy fork() stub
+      ac_cv_func_fork_works=no
+      ;;
+    *)
+      ac_cv_func_fork_works=yes
+      ;;
+  esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;}
+fi
+ac_cv_func_vfork_works=$ac_cv_func_vfork
+if test "x$ac_cv_func_vfork" = xyes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5
+$as_echo_n "checking for working vfork... " >&6; }
+if ${ac_cv_func_vfork_works+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  ac_cv_func_vfork_works=cross
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Thanks to Paul Eggert for this test.  */
+$ac_includes_default
+#include 
+#ifdef HAVE_VFORK_H
+# include 
+#endif
+/* On some sparc systems, changes by the child to local and incoming
+   argument registers are propagated back to the parent.  The compiler
+   is told about this with #include , but some compilers
+   (e.g. gcc -O) don't grok .  Test for this by using a
+   static variable whose address is put into a register that is
+   clobbered by the vfork.  */
+static void
+#ifdef __cplusplus
+sparc_address_test (int arg)
+# else
+sparc_address_test (arg) int arg;
+#endif
+{
+  static pid_t child;
+  if (!child) {
+    child = vfork ();
+    if (child < 0) {
+      perror ("vfork");
+      _exit(2);
+    }
+    if (!child) {
+      arg = getpid();
+      write(-1, "", 0);
+      _exit (arg);
+    }
+  }
+}
+
+int
+main ()
+{
+  pid_t parent = getpid ();
+  pid_t child;
+
+  sparc_address_test (0);
+
+  child = vfork ();
+
+  if (child == 0) {
+    /* Here is another test for sparc vfork register problems.  This
+       test uses lots of local variables, at least as many local
+       variables as main has allocated so far including compiler
+       temporaries.  4 locals are enough for gcc 1.40.3 on a Solaris
+       4.1.3 sparc, but we use 8 to be safe.  A buggy compiler should
+       reuse the register of parent for one of the local variables,
+       since it will think that parent can't possibly be used any more
+       in this routine.  Assigning to the local variable will thus
+       munge parent in the parent process.  */
+    pid_t
+      p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
+      p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
+    /* Convince the compiler that p..p7 are live; otherwise, it might
+       use the same hardware register for all 8 local variables.  */
+    if (p != p1 || p != p2 || p != p3 || p != p4
+	|| p != p5 || p != p6 || p != p7)
+      _exit(1);
+
+    /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent
+       from child file descriptors.  If the child closes a descriptor
+       before it execs or exits, this munges the parent's descriptor
+       as well.  Test for this by closing stdout in the child.  */
+    _exit(close(fileno(stdout)) != 0);
+  } else {
+    int status;
+    struct stat st;
+
+    while (wait(&status) != child)
+      ;
+    return (
+	 /* Was there some problem with vforking?  */
+	 child < 0
+
+	 /* Did the child fail?  (This shouldn't happen.)  */
+	 || status
+
+	 /* Did the vfork/compiler bug occur?  */
+	 || parent != getpid()
+
+	 /* Did the file descriptor bug occur?  */
+	 || fstat(fileno(stdout), &st) != 0
+	 );
+  }
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_vfork_works=yes
+else
+  ac_cv_func_vfork_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5
+$as_echo "$ac_cv_func_vfork_works" >&6; }
+
+fi;
+if test "x$ac_cv_func_fork_works" = xcross; then
+  ac_cv_func_vfork_works=$ac_cv_func_vfork
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;}
+fi
+
+if test "x$ac_cv_func_vfork_works" = xyes; then
+
+$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h
+
+else
+
+$as_echo "#define vfork fork" >>confdefs.h
+
+fi
+if test "x$ac_cv_func_fork_works" = xyes; then
+
+$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h
+
+fi
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc and mbstate_t are properly declared" >&5
+$as_echo_n "checking whether mbrtowc and mbstate_t are properly declared... " >&6; }
+if ${ac_cv_func_mbrtowc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include 
+int
+main ()
+{
+wchar_t wc;
+	      char const s[] = "";
+	      size_t n = 1;
+	      mbstate_t state;
+	      return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_func_mbrtowc=yes
+else
+  ac_cv_func_mbrtowc=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mbrtowc" >&5
+$as_echo "$ac_cv_func_mbrtowc" >&6; }
+  if test $ac_cv_func_mbrtowc = yes; then
+
+$as_echo "#define HAVE_MBRTOWC 1" >>confdefs.h
+
+  fi
 
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc compiler warnings" >&5
@@ -12806,7 +14191,7 @@ fi
 fi
 
 
-for ac_func in mmap strerror strndup strtoul mbrtowc mkstemp utimes utime wcwidth strtof fork
+for ac_func in strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -12897,6 +14282,71 @@ esac
 
 fi
 
+ac_fn_c_check_func "$LINENO" "ctime_r" "ac_cv_func_ctime_r"
+if test "x$ac_cv_func_ctime_r" = xyes; then :
+  $as_echo "#define HAVE_CTIME_R 1" >>confdefs.h
+
+else
+  case " $LIBOBJS " in
+  *" ctime_r.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS ctime_r.$ac_objext"
+ ;;
+esac
+
+fi
+
+ac_fn_c_check_func "$LINENO" "asctime_r" "ac_cv_func_asctime_r"
+if test "x$ac_cv_func_asctime_r" = xyes; then :
+  $as_echo "#define HAVE_ASCTIME_R 1" >>confdefs.h
+
+else
+  case " $LIBOBJS " in
+  *" asctime_r.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS asctime_r.$ac_objext"
+ ;;
+esac
+
+fi
+
+ac_fn_c_check_func "$LINENO" "pread" "ac_cv_func_pread"
+if test "x$ac_cv_func_pread" = xyes; then :
+  $as_echo "#define HAVE_PREAD 1" >>confdefs.h
+
+else
+  case " $LIBOBJS " in
+  *" pread.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS pread.$ac_objext"
+ ;;
+esac
+
+fi
+
+ac_fn_c_check_func "$LINENO" "strcasestr" "ac_cv_func_strcasestr"
+if test "x$ac_cv_func_strcasestr" = xyes; then :
+  $as_echo "#define HAVE_STRCASESTR 1" >>confdefs.h
+
+else
+  case " $LIBOBJS " in
+  *" strcasestr.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS strcasestr.$ac_objext"
+ ;;
+esac
+
+fi
+
+ac_fn_c_check_func "$LINENO" "fmtcheck" "ac_cv_func_fmtcheck"
+if test "x$ac_cv_func_fmtcheck" = xyes; then :
+  $as_echo "#define HAVE_FMTCHECK 1" >>confdefs.h
+
+else
+  case " $LIBOBJS " in
+  *" fmtcheck.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS fmtcheck.$ac_objext"
+ ;;
+esac
+
+fi
+
 
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gzopen in -lz" >&5
@@ -13114,6 +14564,14 @@ LIBOBJS=$ac_libobjs
 LTLIBOBJS=$ac_ltlibobjs
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
+$as_echo_n "checking that generated files are newer than configure... " >&6; }
+   if test -n "$am_sleep_pid"; then
+     # Hide warnings about reused PIDs.
+     wait $am_sleep_pid 2>/dev/null
+   fi
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
+$as_echo "done" >&6; }
  if test -n "$EXEEXT"; then
   am__EXEEXT_TRUE=
   am__EXEEXT_FALSE='#'
@@ -13138,10 +14596,7 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
   as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
-  as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
+
 if test -z "${IS_CROSS_COMPILE_TRUE}" && test -z "${IS_CROSS_COMPILE_FALSE}"; then
   as_fn_error $? "conditional \"IS_CROSS_COMPILE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -13444,16 +14899,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
+    # In both cases, we have to default to `cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -13513,28 +14968,16 @@ else
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-	test -d "$1/.";
-      else
-	case $1 in #(
-	-*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -13555,8 +14998,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by file $as_me 5.11, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+This file was extended by file $as_me 5.19, which was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -13621,11 +15064,11 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-file config.status 5.11
-configured by $0, generated by GNU Autoconf 2.68,
+file config.status 5.19
+configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -13716,7 +15159,7 @@ fi
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 if \$ac_cs_recheck; then
-  set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
   shift
   \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
   CONFIG_SHELL='$SHELL'
@@ -13750,131 +15193,154 @@ AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
 sed_quote_subst='$sed_quote_subst'
 double_quote_subst='$double_quote_subst'
 delay_variable_subst='$delay_variable_subst'
-macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`'
-macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`'
-enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`'
-enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`'
-pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`'
-enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`'
-host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`'
-host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`'
-host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`'
-build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`'
-build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`'
-build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`'
-SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`'
-Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`'
-GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`'
-EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`'
-FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`'
-LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`'
-NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`'
-LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`'
-max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`'
-ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`'
-exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`'
-lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`'
-lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`'
-lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`'
-reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`'
-reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`'
-deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`'
-file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`'
-AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`'
-AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`'
-STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`'
-RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`'
-old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`'
-CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`'
-compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`'
-GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
-objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`'
-SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`'
-ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`'
-MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`'
-need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`'
-DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`'
-NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`'
-LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`'
-OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`'
-OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`'
-libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`'
-shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`'
-enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`'
-export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
-whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
-compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`'
-allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
-no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`'
-inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`'
-link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`'
-fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`'
-always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`'
-export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
-include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
-prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`'
-variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`'
-need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
-need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`'
-version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`'
-runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`'
-shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
-shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`'
-libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`'
-library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`'
-soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`'
-postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`'
-sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
-sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`'
-enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`'
-enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`'
-enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`'
-old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`'
-striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`'
+macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
+enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
+SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
+ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`'
+host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
+host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
+host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
+build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
+build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
+build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
+SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
+Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
+GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
+EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
+FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
+LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
+NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
+LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
+exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
+file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
+want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
+DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
+sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
+AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
+archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
+STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
+lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
+CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
+compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
+GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
+nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
+lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
+objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
+need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
+MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
+LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
+libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
+postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
+need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
+version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
+install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
+striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
 
 LTCC='$LTCC'
 LTCFLAGS='$LTCFLAGS'
 compiler='$compiler_DEFAULT'
 
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+
 # Quote evaled strings.
-for var in SED \
+for var in SHELL \
+ECHO \
+PATH_SEPARATOR \
+SED \
 GREP \
 EGREP \
 FGREP \
@@ -13887,8 +15353,13 @@ reload_flag \
 OBJDUMP \
 deplibs_check_method \
 file_magic_cmd \
+file_magic_glob \
+want_nocaseglob \
+DLLTOOL \
+sharedlib_from_linklib_cmd \
 AR \
 AR_FLAGS \
+archiver_list_spec \
 STRIP \
 RANLIB \
 CC \
@@ -13898,14 +15369,14 @@ lt_cv_sys_global_symbol_pipe \
 lt_cv_sys_global_symbol_to_cdecl \
 lt_cv_sys_global_symbol_to_c_name_address \
 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
-SHELL \
-ECHO \
+nm_file_list_spec \
 lt_prog_compiler_no_builtin_flag \
-lt_prog_compiler_wl \
 lt_prog_compiler_pic \
+lt_prog_compiler_wl \
 lt_prog_compiler_static \
 lt_cv_prog_compiler_c_o \
 need_locks \
+MANIFEST_TOOL \
 DSYMUTIL \
 NMEDIT \
 LIPO \
@@ -13919,9 +15390,7 @@ with_gnu_ld \
 allow_undefined_flag \
 no_undefined_flag \
 hardcode_libdir_flag_spec \
-hardcode_libdir_flag_spec_ld \
 hardcode_libdir_separator \
-fix_srcfile_path \
 exclude_expsyms \
 include_expsyms \
 file_list_spec \
@@ -13929,12 +15398,13 @@ variables_saved_for_relink \
 libname_spec \
 library_names_spec \
 soname_spec \
+install_override_mode \
 finish_eval \
 old_striplib \
 striplib; do
-    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[\\\\\\\`\\"\\\$]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -13956,14 +15426,15 @@ module_cmds \
 module_expsym_cmds \
 export_symbols_cmds \
 prelink_cmds \
+postlink_cmds \
 postinstall_cmds \
 postuninstall_cmds \
 finish_cmds \
 sys_lib_search_path_spec \
 sys_lib_dlsearch_path_spec; do
-    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[\\\\\\\`\\"\\\$]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -13971,12 +15442,6 @@ sys_lib_dlsearch_path_spec; do
     esac
 done
 
-# Fix-up fallback echo if it was mangled by the above quoting rules.
-case \$lt_ECHO in
-*'\\\$0 --fallback-echo"')  lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\`
-  ;;
-esac
-
 ac_aux_dir='$ac_aux_dir'
 xsi_shell='$xsi_shell'
 lt_shell_append='$lt_shell_append'
@@ -14610,7 +16075,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
 
   case $ac_file$ac_mode in
     "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
-  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # Older Autoconf quotes --file arguments for eval, but not when files
   # are listed without --file.  Let's play safe and only enable the eval
   # if we detect the quoting.
   case $CONFIG_FILES in
@@ -14623,7 +16088,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
     # Strip MF so we end up with the name of the file.
     mf=`echo "$mf" | sed -e 's/:.*$//'`
     # Check whether this is an Automake generated Makefile or not.
-    # We used to match only the files named `Makefile.in', but
+    # We used to match only the files named 'Makefile.in', but
     # some people rename them; so instead we look at the file content.
     # Grep'ing the first line is not enough: some people post-process
     # each Makefile.in and add a new line on top of each file to say so.
@@ -14657,21 +16122,19 @@ $as_echo X"$mf" |
       continue
     fi
     # Extract the definition of DEPDIR, am__include, and am__quote
-    # from the Makefile without running `make'.
+    # from the Makefile without running 'make'.
     DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
     test -z "$DEPDIR" && continue
     am__include=`sed -n 's/^am__include = //p' < "$mf"`
-    test -z "am__include" && continue
+    test -z "$am__include" && continue
     am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-    # When using ansi2knr, U may be empty or an underscore; expand it
-    U=`sed -n 's/^U = //p' < "$mf"`
     # Find all dependency output files, they are included files with
     # $(DEPDIR) in their names.  We invoke sed twice because it is the
     # simplest approach to changing $(DEPDIR) to its actual value in the
     # expansion.
     for file in `sed -n "
       s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
       # Make sure the directory exists.
       test -f "$dirpart/$file" && continue
       fdir=`$as_dirname -- "$file" ||
@@ -14725,7 +16188,8 @@ $as_echo X"$file" |
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
 #
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008 Free Software Foundation, Inc.
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 #   This file is part of GNU Libtool.
@@ -14761,18 +16225,27 @@ available_tags=""
 macro_version=$macro_version
 macro_revision=$macro_revision
 
-# Whether or not to build shared libraries.
-build_libtool_libs=$enable_shared
-
 # Whether or not to build static libraries.
 build_old_libs=$enable_static
 
 # What type of objects to build.
 pic_mode=$pic_mode
 
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
 # Whether or not to optimize for fast installation.
 fast_install=$enable_fast_install
 
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that protects backslashes.
+ECHO=$lt_ECHO
+
+# The PATH separator for the build system.
+PATH_SEPARATOR=$lt_PATH_SEPARATOR
+
 # The host system.
 host_alias=$host_alias
 host=$host
@@ -14822,9 +16295,11 @@ SP2NL=$lt_lt_SP2NL
 # turn newlines into spaces.
 NL2SP=$lt_lt_NL2SP
 
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag
-reload_cmds=$lt_reload_cmds
+# convert \$build file names to \$host format.
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+
+# convert \$build files to toolchain format.
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
 
 # An object symbol dumper.
 OBJDUMP=$lt_OBJDUMP
@@ -14832,13 +16307,30 @@ OBJDUMP=$lt_OBJDUMP
 # Method to check whether dependent libraries are shared objects.
 deplibs_check_method=$lt_deplibs_check_method
 
-# Command to use when deplibs_check_method == "file_magic".
+# Command to use when deplibs_check_method = "file_magic".
 file_magic_cmd=$lt_file_magic_cmd
 
+# How to find potential files when deplibs_check_method = "file_magic".
+file_magic_glob=$lt_file_magic_glob
+
+# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
+want_nocaseglob=$lt_want_nocaseglob
+
+# DLL creation program.
+DLLTOOL=$lt_DLLTOOL
+
+# Command to associate shared and link libraries.
+sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
+
 # The archiver.
 AR=$lt_AR
+
+# Flags to create an archive.
 AR_FLAGS=$lt_AR_FLAGS
 
+# How to feed a file listing to the archiver.
+archiver_list_spec=$lt_archiver_list_spec
+
 # A symbol stripping program.
 STRIP=$lt_STRIP
 
@@ -14847,6 +16339,9 @@ RANLIB=$lt_RANLIB
 old_postinstall_cmds=$lt_old_postinstall_cmds
 old_postuninstall_cmds=$lt_old_postuninstall_cmds
 
+# Whether to use a lock for old archive extraction.
+lock_old_archive_extraction=$lock_old_archive_extraction
+
 # A C compiler.
 LTCC=$lt_CC
 
@@ -14865,21 +16360,24 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
 # Transform the output of nm in a C name address pair when lib prefix is needed.
 global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
 
+# Specify filename containing input files for \$NM.
+nm_file_list_spec=$lt_nm_file_list_spec
+
+# The root where to search for dependent libraries,and in which our libraries should be installed.
+lt_sysroot=$lt_sysroot
+
 # The name of the directory that contains temporary libtool files.
 objdir=$objdir
 
-# Shell to use when invoking shell scripts.
-SHELL=$lt_SHELL
-
-# An echo program that does not interpret backslashes.
-ECHO=$lt_ECHO
-
 # Used to examine libraries when file_magic_cmd begins with "file".
 MAGIC_CMD=$MAGIC_CMD
 
 # Must we lock files when doing compilation?
 need_locks=$lt_need_locks
 
+# Manifest tool.
+MANIFEST_TOOL=$lt_MANIFEST_TOOL
+
 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
 DSYMUTIL=$lt_DSYMUTIL
 
@@ -14936,6 +16434,9 @@ library_names_spec=$lt_library_names_spec
 # The coded name of the library, if different from the real name.
 soname_spec=$lt_soname_spec
 
+# Permission mode override for installation of shared libraries.
+install_override_mode=$lt_install_override_mode
+
 # Command to use after installation of a shared archive.
 postinstall_cmds=$lt_postinstall_cmds
 
@@ -14975,6 +16476,10 @@ striplib=$lt_striplib
 # The linker used to build libraries.
 LD=$lt_LD
 
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
 # Commands used to build an old-style archive.
 old_archive_cmds=$lt_old_archive_cmds
 
@@ -14987,12 +16492,12 @@ with_gcc=$GCC
 # Compiler flag to turn off builtin functions.
 no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
 
-# How to pass a linker flag through the compiler.
-wl=$lt_lt_prog_compiler_wl
-
 # Additional compiler flags for building library objects.
 pic_flag=$lt_lt_prog_compiler_pic
 
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
 # Compiler flag to prevent dynamic linking.
 link_static_flag=$lt_lt_prog_compiler_static
 
@@ -15042,10 +16547,6 @@ no_undefined_flag=$lt_no_undefined_flag
 # This must work even if \$libdir does not exist
 hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
 
-# If ld is used when linking, flag to hardcode \$libdir into a binary
-# during linking.  This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
-
 # Whether we need a single "-rpath" flag with a separated argument.
 hardcode_libdir_separator=$lt_hardcode_libdir_separator
 
@@ -15079,9 +16580,6 @@ inherit_rpath=$inherit_rpath
 # Whether libtool must link a program against all its dependency libraries.
 link_all_deplibs=$link_all_deplibs
 
-# Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path=$lt_fix_srcfile_path
-
 # Set to "yes" if exported symbols are required.
 always_export_symbols=$always_export_symbols
 
@@ -15097,6 +16595,9 @@ include_expsyms=$lt_include_expsyms
 # Commands necessary for linking programs (against libraries) with templates.
 prelink_cmds=$lt_prelink_cmds
 
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds
+
 # Specify filename containing input files.
 file_list_spec=$lt_file_list_spec
 
@@ -15129,212 +16630,169 @@ ltmain="$ac_aux_dir/ltmain.sh"
   # if finds mixed CR/LF and LF-only lines.  Since sed operates in
   # text mode, it properly converts lines to CR/LF.  This bash problem
   # is reportedly fixed, but why not run on old versions too?
-  sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
-    || (rm -f "$cfgfile"; exit 1)
+  sed '$q' "$ltmain" >> "$cfgfile" \
+     || (rm -f "$cfgfile"; exit 1)
 
-  case $xsi_shell in
-  yes)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-  case ${1} in
-    */*) func_dirname_result="${1%/*}${2}" ;;
-    *  ) func_dirname_result="${3}" ;;
-  esac
-}
-
-# func_basename file
-func_basename ()
-{
-  func_basename_result="${1##*/}"
-}
-
-# func_dirname_and_basename file append nondir_replacement
-# perform func_basename and func_dirname in a single function
-# call:
-#   dirname:  Compute the dirname of FILE.  If nonempty,
-#             add APPEND to the result, otherwise set result
-#             to NONDIR_REPLACEMENT.
-#             value returned in "$func_dirname_result"
-#   basename: Compute filename of FILE.
-#             value retuned in "$func_basename_result"
-# Implementation must be kept synchronized with func_dirname
-# and func_basename. For efficiency, we do not delegate to
-# those functions but instead duplicate the functionality here.
-func_dirname_and_basename ()
-{
-  case ${1} in
-    */*) func_dirname_result="${1%/*}${2}" ;;
-    *  ) func_dirname_result="${3}" ;;
-  esac
-  func_basename_result="${1##*/}"
-}
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-func_stripname ()
-{
-  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
-  # positional parameters, so assign one to ordinary parameter first.
-  func_stripname_result=${3}
-  func_stripname_result=${func_stripname_result#"${1}"}
-  func_stripname_result=${func_stripname_result%"${2}"}
-}
-
-# func_opt_split
-func_opt_split ()
-{
-  func_opt_split_opt=${1%%=*}
-  func_opt_split_arg=${1#*=}
-}
-
-# func_lo2o object
-func_lo2o ()
-{
-  case ${1} in
-    *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
-    *)    func_lo2o_result=${1} ;;
-  esac
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
-  func_xform_result=${1%.*}.lo
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
-  func_arith_result=$(( $* ))
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-  func_len_result=${#1}
-}
-
-_LT_EOF
-    ;;
-  *) # Bourne compatible functions.
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-  # Extract subdirectory from the argument.
-  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
-  if test "X$func_dirname_result" = "X${1}"; then
-    func_dirname_result="${3}"
-  else
-    func_dirname_result="$func_dirname_result${2}"
-  fi
-}
-
-# func_basename file
-func_basename ()
-{
-  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
-}
+  if test x"$xsi_shell" = xyes; then
+  sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
+func_dirname ()\
+{\
+\    case ${1} in\
+\      */*) func_dirname_result="${1%/*}${2}" ;;\
+\      *  ) func_dirname_result="${3}" ;;\
+\    esac\
+} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
 
 
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-# func_strip_suffix prefix name
-func_stripname ()
-{
-  case ${2} in
-    .*) func_stripname_result=`$ECHO "X${3}" \
-           | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
-    *)  func_stripname_result=`$ECHO "X${3}" \
-           | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
-  esac
-}
-
-# sed scripts:
-my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
-my_sed_long_arg='1s/^-[^=]*=//'
-
-# func_opt_split
-func_opt_split ()
-{
-  func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
-  func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
-}
-
-# func_lo2o object
-func_lo2o ()
-{
-  func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
-  func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'`
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
-  func_arith_result=`expr "$@"`
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-  func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
-}
-
-_LT_EOF
-esac
-
-case $lt_shell_append in
-  yes)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-  eval "$1+=\$2"
-}
-_LT_EOF
-    ;;
-  *)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-  eval "$1=\$$1\$2"
-}
-
-_LT_EOF
-    ;;
-  esac
+  sed -e '/^func_basename ()$/,/^} # func_basename /c\
+func_basename ()\
+{\
+\    func_basename_result="${1##*/}"\
+} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
 
 
-  sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
-    || (rm -f "$cfgfile"; exit 1)
+  sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
+func_dirname_and_basename ()\
+{\
+\    case ${1} in\
+\      */*) func_dirname_result="${1%/*}${2}" ;;\
+\      *  ) func_dirname_result="${3}" ;;\
+\    esac\
+\    func_basename_result="${1##*/}"\
+} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
 
-  mv -f "$cfgfile" "$ofile" ||
+
+  sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
+func_stripname ()\
+{\
+\    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
+\    # positional parameters, so assign one to ordinary parameter first.\
+\    func_stripname_result=${3}\
+\    func_stripname_result=${func_stripname_result#"${1}"}\
+\    func_stripname_result=${func_stripname_result%"${2}"}\
+} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
+func_split_long_opt ()\
+{\
+\    func_split_long_opt_name=${1%%=*}\
+\    func_split_long_opt_arg=${1#*=}\
+} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
+func_split_short_opt ()\
+{\
+\    func_split_short_opt_arg=${1#??}\
+\    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
+} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
+func_lo2o ()\
+{\
+\    case ${1} in\
+\      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
+\      *)    func_lo2o_result=${1} ;;\
+\    esac\
+} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_xform ()$/,/^} # func_xform /c\
+func_xform ()\
+{\
+    func_xform_result=${1%.*}.lo\
+} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_arith ()$/,/^} # func_arith /c\
+func_arith ()\
+{\
+    func_arith_result=$(( $* ))\
+} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_len ()$/,/^} # func_len /c\
+func_len ()\
+{\
+    func_len_result=${#1}\
+} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+fi
+
+if test x"$lt_shell_append" = xyes; then
+  sed -e '/^func_append ()$/,/^} # func_append /c\
+func_append ()\
+{\
+    eval "${1}+=\\${2}"\
+} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
+func_append_quoted ()\
+{\
+\    func_quote_for_eval "${2}"\
+\    eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
+} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  # Save a `func_append' function call where possible by direct use of '+='
+  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+else
+  # Save a `func_append' function call even when '+=' is not available
+  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
+$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
+fi
+
+
+   mv -f "$cfgfile" "$ofile" ||
     (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
   chmod +x "$ofile"
 
diff --git a/contrib/file/configure.ac b/contrib/file/configure.ac
index 1511c9ac33c..3d55c38c22d 100644
--- a/contrib/file/configure.ac
+++ b/contrib/file/configure.ac
@@ -1,9 +1,9 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT(file, 5.11, christos@astron.com)
-AM_INIT_AUTOMAKE()
+AC_INIT([file],[5.19],[christos@astron.com])
+AM_INIT_AUTOMAKE([subdir-objects foreign])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
-AM_CONFIG_HEADER(config.h)
+AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_MACRO_DIR([m4])
 
 AC_MSG_CHECKING(for builtin ELF support)
@@ -66,21 +66,22 @@ AC_SUBST(fsect)
 AM_CONDITIONAL(FSECT5, test x$fsect = x5)
 
 AC_SUBST(WARNINGS)
-AC_GNU_SOURCE
 
 dnl Checks for programs.
-AC_PROG_CC
+AC_PROG_CC_STDC
+AC_USE_SYSTEM_EXTENSIONS
 AM_PROG_CC_C_O
+AC_C_BIGENDIAN
 AC_PROG_INSTALL
 AC_PROG_LN_S
-AC_PROG_LIBTOOL
-
+LT_INIT([disable-static pic-only])
+gl_VISIBILITY
 dnl Checks for headers
 AC_HEADER_STDC
 AC_HEADER_MAJOR
 AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h)
-AC_CHECK_HEADERS(utime.h wchar.h wctype.h limits.h)
+AC_CHECK_HEADERS(stddef.h utime.h wchar.h wctype.h limits.h)
 AC_CHECK_HEADERS(getopt.h err.h)
 AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h)
 AC_CHECK_HEADERS(zlib.h)
@@ -91,45 +92,26 @@ AC_TYPE_OFF_T
 AC_TYPE_SIZE_T
 AC_CHECK_MEMBERS([struct stat.st_rdev])
 
-AC_STRUCT_TM
-AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.tm_zone])
+AC_CHECK_MEMBERS([struct tm.tm_gmtoff])
+AC_STRUCT_TIMEZONE
 AC_STRUCT_TIMEZONE_DAYLIGHT
 AC_SYS_LARGEFILE
 AC_FUNC_FSEEKO
 AC_TYPE_MBSTATE_T
 
 AC_STRUCT_OPTION_GETOPT_H
-
-AC_CHECK_TYPES([pid_t, uint8_t, uint16_t, uint32_t, int32_t, uint64_t, int64_t])
-AC_CHECK_SIZEOF(long long)
-AH_BOTTOM([
-#ifndef HAVE_UINT8_T
-typedef unsigned char uint8_t;
-#endif
-#ifndef HAVE_UINT16_T
-typedef unsigned short uint16_t;
-#endif
-#ifndef HAVE_UINT32_T
-typedef unsigned int uint32_t;
-#endif
-#ifndef HAVE_INT32_T
-typedef int int32_t;
-#endif
-#ifndef HAVE_UINT64_T
-#if SIZEOF_LONG_LONG == 8
-typedef unsigned long long uint64_t;
-#else
-typedef unsigned long uint64_t;
-#endif
-#endif
-#ifndef HAVE_INT64_T
-#if SIZEOF_LONG_LONG == 8
-typedef long long int64_t;
-#else
-typedef long int64_t;
-#endif
-#endif
-])
+AC_TYPE_PID_T
+AC_TYPE_UINT8_T
+AC_TYPE_UINT16_T
+AC_TYPE_UINT32_T
+AC_TYPE_INT32_T
+AC_TYPE_UINT64_T
+AC_TYPE_INT64_T
+AC_TYPE_INTPTR_T
+AC_TYPE_UINTPTR_T
+AC_FUNC_MMAP
+AC_FUNC_FORK
+AC_FUNC_MBRTOWC
 
 AC_MSG_CHECKING(for gcc compiler warnings)
 AC_ARG_ENABLE(warnings,
@@ -156,10 +138,10 @@ else
 fi])
 
 dnl Checks for functions
-AC_CHECK_FUNCS(mmap strerror strndup strtoul mbrtowc mkstemp utimes utime wcwidth strtof fork)
+AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof)
 
 dnl Provide implementation of some required functions if necessary
-AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline)
+AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r pread strcasestr fmtcheck)
 
 dnl Checks for libraries
 AC_CHECK_LIB(z,gzopen)
diff --git a/contrib/file/depcomp b/contrib/file/depcomp
new file mode 100755
index 00000000000..4ebd5b3a2f2
--- /dev/null
+++ b/contrib/file/depcomp
@@ -0,0 +1,791 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2013-05-30.07; # UTC
+
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+
+# This program 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.
+
+# This program 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 this program.  If not, see .
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva .
+
+case $1 in
+  '')
+    echo "$0: No command.  Try '$0 --help' for more information." 1>&2
+    exit 1;
+    ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+  depmode     Dependency tracking mode.
+  source      Source file read by 'PROGRAMS ARGS'.
+  object      Object file output by 'PROGRAMS ARGS'.
+  DEPDIR      directory where to store dependencies.
+  depfile     Dependency file to output.
+  tmpdepfile  Temporary file to use when outputting dependencies.
+  libtool     Whether libtool is used (yes/no).
+
+Report bugs to .
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "depcomp $scriptversion"
+    exit $?
+    ;;
+esac
+
+# Get the directory component of the given path, and save it in the
+# global variables '$dir'.  Note that this directory component will
+# be either empty or ending with a '/' character.  This is deliberate.
+set_dir_from ()
+{
+  case $1 in
+    */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
+      *) dir=;;
+  esac
+}
+
+# Get the suffix-stripped basename of the given path, and save it the
+# global variable '$base'.
+set_base_from ()
+{
+  base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
+}
+
+# If no dependency file was actually created by the compiler invocation,
+# we still have to create a dummy depfile, to avoid errors with the
+# Makefile "include basename.Plo" scheme.
+make_dummy_depfile ()
+{
+  echo "#dummy" > "$depfile"
+}
+
+# Factor out some common post-processing of the generated depfile.
+# Requires the auxiliary global variable '$tmpdepfile' to be set.
+aix_post_process_depfile ()
+{
+  # If the compiler actually managed to produce a dependency file,
+  # post-process it.
+  if test -f "$tmpdepfile"; then
+    # Each line is of the form 'foo.o: dependency.h'.
+    # Do two passes, one to just change these to
+    #   $object: dependency.h
+    # and one to simply output
+    #   dependency.h:
+    # which is needed to avoid the deleted-header problem.
+    { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
+      sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
+    } > "$depfile"
+    rm -f "$tmpdepfile"
+  else
+    make_dummy_depfile
+  fi
+}
+
+# A tabulation character.
+tab='	'
+# A newline character.
+nl='
+'
+# Character ranges might be problematic outside the C locale.
+# These definitions help.
+upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
+lower=abcdefghijklmnopqrstuvwxyz
+digits=0123456789
+alpha=${upper}${lower}
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Avoid interferences from the environment.
+gccflag= dashmflag=
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+  # This is just like dashmstdout with a different argument.
+  dashmflag=-xM
+  depmode=dashmstdout
+fi
+
+cygpath_u="cygpath -u -f -"
+if test "$depmode" = msvcmsys; then
+  # This is just like msvisualcpp but w/o cygpath translation.
+  # Just convert the backslash-escaped backslashes to single forward
+  # slashes to satisfy depend.m4
+  cygpath_u='sed s,\\\\,/,g'
+  depmode=msvisualcpp
+fi
+
+if test "$depmode" = msvc7msys; then
+  # This is just like msvc7 but w/o cygpath translation.
+  # Just convert the backslash-escaped backslashes to single forward
+  # slashes to satisfy depend.m4
+  cygpath_u='sed s,\\\\,/,g'
+  depmode=msvc7
+fi
+
+if test "$depmode" = xlc; then
+  # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
+  gccflag=-qmakedep=gcc,-MF
+  depmode=gcc
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+## Unfortunately, FreeBSD c89 acceptance of flags depends upon
+## the command line argument order; so add the flags where they
+## appear in depend2.am.  Note that the slowdown incurred here
+## affects only configure: in makefiles, %FASTDEP% shortcuts this.
+  for arg
+  do
+    case $arg in
+    -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
+    *)  set fnord "$@" "$arg" ;;
+    esac
+    shift # fnord
+    shift # $arg
+  done
+  "$@"
+  stat=$?
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
+## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
+## (see the conditional assignment to $gccflag above).
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).  Also, it might not be
+##   supported by the other compilers which use the 'gcc' depmode.
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  # The second -e expression handles DOS-style file names with drive
+  # letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the "deleted header file" problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+## Some versions of gcc put a space before the ':'.  On the theory
+## that the space means something, we add a space to the output as
+## well.  hp depmode also adds that space, but also prefixes the VPATH
+## to the object.  Take care to not repeat it in the output.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+  tr ' ' "$nl" < "$tmpdepfile" \
+    | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
+    | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like '#:fec' to the end of the
+    # dependency line.
+    tr ' ' "$nl" < "$tmpdepfile" \
+      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
+      | tr "$nl" ' ' >> "$depfile"
+    echo >> "$depfile"
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' "$nl" < "$tmpdepfile" \
+      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+      >> "$depfile"
+  else
+    make_dummy_depfile
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+xlc)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  In older versions, this file always lives in the
+  # current directory.  Also, the AIX compiler puts '$object:' at the
+  # start of each line; $object doesn't have directory information.
+  # Version 6 uses the directory in both cases.
+  set_dir_from "$object"
+  set_base_from "$object"
+  if test "$libtool" = yes; then
+    tmpdepfile1=$dir$base.u
+    tmpdepfile2=$base.u
+    tmpdepfile3=$dir.libs/$base.u
+    "$@" -Wc,-M
+  else
+    tmpdepfile1=$dir$base.u
+    tmpdepfile2=$dir$base.u
+    tmpdepfile3=$dir$base.u
+    "$@" -M
+  fi
+  stat=$?
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+    exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  aix_post_process_depfile
+  ;;
+
+tcc)
+  # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
+  # FIXME: That version still under development at the moment of writing.
+  #        Make that this statement remains true also for stable, released
+  #        versions.
+  # It will wrap lines (doesn't matter whether long or short) with a
+  # trailing '\', as in:
+  #
+  #   foo.o : \
+  #    foo.c \
+  #    foo.h \
+  #
+  # It will put a trailing '\' even on the last line, and will use leading
+  # spaces rather than leading tabs (at least since its commit 0394caf7
+  # "Emit spaces for -MD").
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
+  # We have to change lines of the first kind to '$object: \'.
+  sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
+  # And for each line of the second kind, we have to emit a 'dep.h:'
+  # dummy dependency, to avoid the deleted-header problem.
+  sed -n -e 's|^  *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+## The order of this option in the case statement is important, since the
+## shell code in configure will try each of these formats in the order
+## listed in this file.  A plain '-MD' option would be understood by many
+## compilers, so we must ensure this comes after the gcc and icc options.
+pgcc)
+  # Portland's C compiler understands '-MD'.
+  # Will always output deps to 'file.d' where file is the root name of the
+  # source file under compilation, even if file resides in a subdirectory.
+  # The object file name does not affect the name of the '.d' file.
+  # pgcc 10.2 will output
+  #    foo.o: sub/foo.c sub/foo.h
+  # and will wrap long lines using '\' :
+  #    foo.o: sub/foo.c ... \
+  #     sub/foo.h ... \
+  #     ...
+  set_dir_from "$object"
+  # Use the source, not the object, to determine the base name, since
+  # that's sadly what pgcc will do too.
+  set_base_from "$source"
+  tmpdepfile=$base.d
+
+  # For projects that build the same source file twice into different object
+  # files, the pgcc approach of using the *source* file root name can cause
+  # problems in parallel builds.  Use a locking strategy to avoid stomping on
+  # the same $tmpdepfile.
+  lockdir=$base.d-lock
+  trap "
+    echo '$0: caught signal, cleaning up...' >&2
+    rmdir '$lockdir'
+    exit 1
+  " 1 2 13 15
+  numtries=100
+  i=$numtries
+  while test $i -gt 0; do
+    # mkdir is a portable test-and-set.
+    if mkdir "$lockdir" 2>/dev/null; then
+      # This process acquired the lock.
+      "$@" -MD
+      stat=$?
+      # Release the lock.
+      rmdir "$lockdir"
+      break
+    else
+      # If the lock is being held by a different process, wait
+      # until the winning process is done or we timeout.
+      while test -d "$lockdir" && test $i -gt 0; do
+        sleep 1
+        i=`expr $i - 1`
+      done
+    fi
+    i=`expr $i - 1`
+  done
+  trap - 1 2 13 15
+  if test $i -le 0; then
+    echo "$0: failed to acquire lock after $numtries attempts" >&2
+    echo "$0: check lockdir '$lockdir'" >&2
+    exit 1
+  fi
+
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  # Each line is of the form `foo.o: dependent.h',
+  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+  # Do two passes, one to just change these to
+  # `$object: dependent.h' and one to simply `dependent.h:'.
+  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
+    | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp2)
+  # The "hp" stanza above does not work with aCC (C++) and HP's ia64
+  # compilers, which have integrated preprocessors.  The correct option
+  # to use with these is +Maked; it writes dependencies to a file named
+  # 'foo.d', which lands next to the object file, wherever that
+  # happens to be.
+  # Much of this is similar to the tru64 case; see comments there.
+  set_dir_from  "$object"
+  set_base_from "$object"
+  if test "$libtool" = yes; then
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir.libs/$base.d
+    "$@" -Wc,+Maked
+  else
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir$base.d
+    "$@" +Maked
+  fi
+  stat=$?
+  if test $stat -ne 0; then
+     rm -f "$tmpdepfile1" "$tmpdepfile2"
+     exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  if test -f "$tmpdepfile"; then
+    sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
+    # Add 'dependent.h:' lines.
+    sed -ne '2,${
+               s/^ *//
+               s/ \\*$//
+               s/$/:/
+               p
+             }' "$tmpdepfile" >> "$depfile"
+  else
+    make_dummy_depfile
+  fi
+  rm -f "$tmpdepfile" "$tmpdepfile2"
+  ;;
+
+tru64)
+  # The Tru64 compiler uses -MD to generate dependencies as a side
+  # effect.  'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
+  # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+  # dependencies in 'foo.d' instead, so we check for that too.
+  # Subdirectories are respected.
+  set_dir_from  "$object"
+  set_base_from "$object"
+
+  if test "$libtool" = yes; then
+    # Libtool generates 2 separate objects for the 2 libraries.  These
+    # two compilations output dependencies in $dir.libs/$base.o.d and
+    # in $dir$base.o.d.  We have to check for both files, because
+    # one of the two compilations can be disabled.  We should prefer
+    # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+    # automatically cleaned when .libs/ is deleted, while ignoring
+    # the former would cause a distcleancheck panic.
+    tmpdepfile1=$dir$base.o.d          # libtool 1.5
+    tmpdepfile2=$dir.libs/$base.o.d    # Likewise.
+    tmpdepfile3=$dir.libs/$base.d      # Compaq CCC V6.2-504
+    "$@" -Wc,-MD
+  else
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir$base.d
+    tmpdepfile3=$dir$base.d
+    "$@" -MD
+  fi
+
+  stat=$?
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+    exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  # Same post-processing that is required for AIX mode.
+  aix_post_process_depfile
+  ;;
+
+msvc7)
+  if test "$libtool" = yes; then
+    showIncludes=-Wc,-showIncludes
+  else
+    showIncludes=-showIncludes
+  fi
+  "$@" $showIncludes > "$tmpdepfile"
+  stat=$?
+  grep -v '^Note: including file: ' "$tmpdepfile"
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  # The first sed program below extracts the file names and escapes
+  # backslashes for cygpath.  The second sed program outputs the file
+  # name when reading, but also accumulates all include files in the
+  # hold buffer in order to output them again at the end.  This only
+  # works with sed implementations that can handle large buffers.
+  sed < "$tmpdepfile" -n '
+/^Note: including file:  *\(.*\)/ {
+  s//\1/
+  s/\\/\\\\/g
+  p
+}' | $cygpath_u | sort -u | sed -n '
+s/ /\\ /g
+s/\(.*\)/'"$tab"'\1 \\/p
+s/.\(.*\) \\/\1:/
+H
+$ {
+  s/.*/'"$tab"'/
+  G
+  p
+}' >> "$depfile"
+  echo >> "$depfile" # make sure the fragment doesn't end with a backslash
+  rm -f "$tmpdepfile"
+  ;;
+
+msvc7msys)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test "X$1" != 'X--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove '-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  test -z "$dashmflag" && dashmflag=-M
+  # Require at least two characters before searching for ':'
+  # in the target name.  This is to cope with DOS-style filenames:
+  # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
+  "$@" $dashmflag |
+    sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this sed invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  tr ' ' "$nl" < "$tmpdepfile" \
+    | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
+    | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  "$@" || exit $?
+  # Remove any Libtool call
+  if test "$libtool" = yes; then
+    while test "X$1" != 'X--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+  # X makedepend
+  shift
+  cleared=no eat=no
+  for arg
+  do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    if test $eat = yes; then
+      eat=no
+      continue
+    fi
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    # Strip any option that makedepend may not understand.  Remove
+    # the object too, otherwise makedepend will parse it as a source file.
+    -arch)
+      eat=yes ;;
+    -*|$object)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix=`echo "$object" | sed 's/^.*\././'`
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  rm -f "$depfile"
+  # makedepend may prepend the VPATH from the source file name to the object.
+  # No need to regex-escape $object, excess matching of '.' is harmless.
+  sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process the last invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed '1,2d' "$tmpdepfile" \
+    | tr ' ' "$nl" \
+    | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
+    | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test "X$1" != 'X--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove '-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  "$@" -E \
+    | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+             -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+    | sed '$ s: \\$::' > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test "X$1" != 'X--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+        set fnord "$@"
+        shift
+        shift
+        ;;
+    *)
+        set fnord "$@" "$arg"
+        shift
+        shift
+        ;;
+    esac
+  done
+  "$@" -E 2>/dev/null |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
+  echo "$tab" >> "$depfile"
+  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvcmsys)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/contrib/file/doc/Makefile.am b/contrib/file/doc/Makefile.am
new file mode 100644
index 00000000000..4a78589cede
--- /dev/null
+++ b/contrib/file/doc/Makefile.am
@@ -0,0 +1,32 @@
+MAGIC	 = $(pkgdatadir)/magic
+if FSECT5
+man_MAGIC = magic.5
+else
+man_MAGIC = magic.4
+endif
+fsect = @fsect@
+man_MANS = file.1 $(man_MAGIC) libmagic.3
+
+EXTRA_DIST = file.man magic.man libmagic.man
+CLEANFILES = $(man_MANS)
+
+file.1:	Makefile file.man
+	@rm -f $@
+	sed -e s@__CSECTION__@1@g \
+	    -e s@__FSECTION__@${fsect}@g \
+	    -e s@__VERSION__@${VERSION}@g \
+	    -e s@__MAGIC__@${MAGIC}@g $(srcdir)/file.man > $@
+
+magic.${fsect}: Makefile magic.man
+	@rm -f $@
+	sed -e s@__CSECTION__@1@g \
+	    -e s@__FSECTION__@${fsect}@g \
+	    -e s@__VERSION__@${VERSION}@g \
+	    -e s@__MAGIC__@${MAGIC}@g $(srcdir)/magic.man > $@
+
+libmagic.3: Makefile libmagic.man
+	@rm -f $@
+	sed -e s@__CSECTION__@1@g \
+	    -e s@__FSECTION__@${fsect}@g \
+	    -e s@__VERSION__@${VERSION}@g \
+	    -e s@__MAGIC__@${MAGIC}@g $(srcdir)/libmagic.man > $@
diff --git a/contrib/file/doc/Makefile.in b/contrib/file/doc/Makefile.in
new file mode 100644
index 00000000000..8d0fa7b8df6
--- /dev/null
+++ b/contrib/file/doc/Makefile.in
@@ -0,0 +1,669 @@
+# Makefile.in generated by automake 1.14 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = doc
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+man1dir = $(mandir)/man1
+am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" \
+	"$(DESTDIR)$(man4dir)" "$(DESTDIR)$(man5dir)"
+man3dir = $(mandir)/man3
+man4dir = $(mandir)/man4
+man5dir = $(mandir)/man5
+NROFF = nroff
+MANS = $(man_MANS)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+pkgdatadir = @pkgdatadir@
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+HAVE_VISIBILITY = @HAVE_VISIBILITY@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MINGW = @MINGW@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+WARNINGS = @WARNINGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+fsect = @fsect@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+MAGIC = $(pkgdatadir)/magic
+@FSECT5_FALSE@man_MAGIC = magic.4
+@FSECT5_TRUE@man_MAGIC = magic.5
+man_MANS = file.1 $(man_MAGIC) libmagic.3
+EXTRA_DIST = file.man magic.man libmagic.man
+CLEANFILES = $(man_MANS)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign doc/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+install-man1: $(man_MANS)
+	@$(NORMAL_INSTALL)
+	@list1=''; \
+	list2='$(man_MANS)'; \
+	test -n "$(man1dir)" \
+	  && test -n "`echo $$list1$$list2`" \
+	  || exit 0; \
+	echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
+	$(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
+	{ for i in $$list1; do echo "$$i"; done;  \
+	if test -n "$$list2"; then \
+	  for i in $$list2; do echo "$$i"; done \
+	    | sed -n '/\.1[a-z]*$$/p'; \
+	fi; \
+	} | while read p; do \
+	  if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; echo "$$p"; \
+	done | \
+	sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+	sed 'N;N;s,\n, ,g' | { \
+	list=; while read file base inst; do \
+	  if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+	    echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+	    $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
+	  fi; \
+	done; \
+	for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+	while read files; do \
+	  test -z "$$files" || { \
+	    echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
+	    $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
+	done; }
+
+uninstall-man1:
+	@$(NORMAL_UNINSTALL)
+	@list=''; test -n "$(man1dir)" || exit 0; \
+	files=`{ for i in $$list; do echo "$$i"; done; \
+	l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+	  sed -n '/\.1[a-z]*$$/p'; \
+	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+	dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
+install-man3: $(man_MANS)
+	@$(NORMAL_INSTALL)
+	@list1=''; \
+	list2='$(man_MANS)'; \
+	test -n "$(man3dir)" \
+	  && test -n "`echo $$list1$$list2`" \
+	  || exit 0; \
+	echo " $(MKDIR_P) '$(DESTDIR)$(man3dir)'"; \
+	$(MKDIR_P) "$(DESTDIR)$(man3dir)" || exit 1; \
+	{ for i in $$list1; do echo "$$i"; done;  \
+	if test -n "$$list2"; then \
+	  for i in $$list2; do echo "$$i"; done \
+	    | sed -n '/\.3[a-z]*$$/p'; \
+	fi; \
+	} | while read p; do \
+	  if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; echo "$$p"; \
+	done | \
+	sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+	sed 'N;N;s,\n, ,g' | { \
+	list=; while read file base inst; do \
+	  if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+	    echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \
+	    $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \
+	  fi; \
+	done; \
+	for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+	while read files; do \
+	  test -z "$$files" || { \
+	    echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \
+	    $(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \
+	done; }
+
+uninstall-man3:
+	@$(NORMAL_UNINSTALL)
+	@list=''; test -n "$(man3dir)" || exit 0; \
+	files=`{ for i in $$list; do echo "$$i"; done; \
+	l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+	  sed -n '/\.3[a-z]*$$/p'; \
+	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+	dir='$(DESTDIR)$(man3dir)'; $(am__uninstall_files_from_dir)
+install-man4: $(man_MANS)
+	@$(NORMAL_INSTALL)
+	@list1=''; \
+	list2='$(man_MANS)'; \
+	test -n "$(man4dir)" \
+	  && test -n "`echo $$list1$$list2`" \
+	  || exit 0; \
+	echo " $(MKDIR_P) '$(DESTDIR)$(man4dir)'"; \
+	$(MKDIR_P) "$(DESTDIR)$(man4dir)" || exit 1; \
+	{ for i in $$list1; do echo "$$i"; done;  \
+	if test -n "$$list2"; then \
+	  for i in $$list2; do echo "$$i"; done \
+	    | sed -n '/\.4[a-z]*$$/p'; \
+	fi; \
+	} | while read p; do \
+	  if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; echo "$$p"; \
+	done | \
+	sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^4][0-9a-z]*$$,4,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+	sed 'N;N;s,\n, ,g' | { \
+	list=; while read file base inst; do \
+	  if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+	    echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man4dir)/$$inst'"; \
+	    $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man4dir)/$$inst" || exit $$?; \
+	  fi; \
+	done; \
+	for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+	while read files; do \
+	  test -z "$$files" || { \
+	    echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man4dir)'"; \
+	    $(INSTALL_DATA) $$files "$(DESTDIR)$(man4dir)" || exit $$?; }; \
+	done; }
+
+uninstall-man4:
+	@$(NORMAL_UNINSTALL)
+	@list=''; test -n "$(man4dir)" || exit 0; \
+	files=`{ for i in $$list; do echo "$$i"; done; \
+	l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+	  sed -n '/\.4[a-z]*$$/p'; \
+	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^4][0-9a-z]*$$,4,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+	dir='$(DESTDIR)$(man4dir)'; $(am__uninstall_files_from_dir)
+install-man5: $(man_MANS)
+	@$(NORMAL_INSTALL)
+	@list1=''; \
+	list2='$(man_MANS)'; \
+	test -n "$(man5dir)" \
+	  && test -n "`echo $$list1$$list2`" \
+	  || exit 0; \
+	echo " $(MKDIR_P) '$(DESTDIR)$(man5dir)'"; \
+	$(MKDIR_P) "$(DESTDIR)$(man5dir)" || exit 1; \
+	{ for i in $$list1; do echo "$$i"; done;  \
+	if test -n "$$list2"; then \
+	  for i in $$list2; do echo "$$i"; done \
+	    | sed -n '/\.5[a-z]*$$/p'; \
+	fi; \
+	} | while read p; do \
+	  if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; echo "$$p"; \
+	done | \
+	sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+	sed 'N;N;s,\n, ,g' | { \
+	list=; while read file base inst; do \
+	  if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+	    echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \
+	    $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst" || exit $$?; \
+	  fi; \
+	done; \
+	for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+	while read files; do \
+	  test -z "$$files" || { \
+	    echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man5dir)'"; \
+	    $(INSTALL_DATA) $$files "$(DESTDIR)$(man5dir)" || exit $$?; }; \
+	done; }
+
+uninstall-man5:
+	@$(NORMAL_UNINSTALL)
+	@list=''; test -n "$(man5dir)" || exit 0; \
+	files=`{ for i in $$list; do echo "$$i"; done; \
+	l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+	  sed -n '/\.5[a-z]*$$/p'; \
+	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+	dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir)
+tags TAGS:
+
+ctags CTAGS:
+
+cscope cscopelist:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(MANS)
+installdirs:
+	for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(man4dir)" "$(DESTDIR)$(man5dir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man: install-man1 install-man3 install-man4 install-man5
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-man
+
+uninstall-man: uninstall-man1 uninstall-man3 uninstall-man4 \
+	uninstall-man5
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	cscopelist-am ctags-am distclean distclean-generic \
+	distclean-libtool distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-man1 install-man3 install-man4 install-man5 \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags-am uninstall uninstall-am uninstall-man uninstall-man1 \
+	uninstall-man3 uninstall-man4 uninstall-man5
+
+
+file.1:	Makefile file.man
+	@rm -f $@
+	sed -e s@__CSECTION__@1@g \
+	    -e s@__FSECTION__@${fsect}@g \
+	    -e s@__VERSION__@${VERSION}@g \
+	    -e s@__MAGIC__@${MAGIC}@g $(srcdir)/file.man > $@
+
+magic.${fsect}: Makefile magic.man
+	@rm -f $@
+	sed -e s@__CSECTION__@1@g \
+	    -e s@__FSECTION__@${fsect}@g \
+	    -e s@__VERSION__@${VERSION}@g \
+	    -e s@__MAGIC__@${MAGIC}@g $(srcdir)/magic.man > $@
+
+libmagic.3: Makefile libmagic.man
+	@rm -f $@
+	sed -e s@__CSECTION__@1@g \
+	    -e s@__FSECTION__@${fsect}@g \
+	    -e s@__VERSION__@${VERSION}@g \
+	    -e s@__MAGIC__@${MAGIC}@g $(srcdir)/libmagic.man > $@
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/contrib/file/file.man b/contrib/file/doc/file.man
similarity index 89%
rename from contrib/file/file.man
rename to contrib/file/doc/file.man
index fff77308976..361188e1399 100644
--- a/contrib/file/file.man
+++ b/contrib/file/doc/file.man
@@ -1,5 +1,5 @@
-.\" $File: file.man,v 1.98 2011/12/08 12:12:46 rrt Exp $
-.Dd October 17, 2011
+.\" $File: file.man,v 1.106 2014/03/07 23:11:51 christos Exp $
+.Dd January 30, 2014
 .Dt FILE __CSECTION__
 .Os
 .Sh NAME
@@ -8,7 +8,7 @@
 .Sh SYNOPSIS
 .Nm
 .Bk -words
-.Op Fl bchiklLNnprsvz0
+.Op Fl bcEhiklLNnprsvz0
 .Op Fl Fl apple
 .Op Fl Fl mime-encoding
 .Op Fl Fl mime-type
@@ -164,6 +164,10 @@ in any of the character sets listed above is simply said to be
 .Dq data .
 .Sh OPTIONS
 .Bl -tag -width indent
+.It Fl Fl apple
+Causes the file command to output the file type and creator code as
+used by older MacOS versions. The code consists of eight letters,
+the first describing the file type, the latter the creator.
 .It Fl b , Fl Fl brief
 Do not prepend filenames to output lines (brief mode).
 .It Fl C , Fl Fl compile
@@ -175,6 +179,10 @@ Cause a checking printout of the parsed form of the magic file.
 This is usually used in conjunction with the
 .Fl m
 flag to debug a new magic file before installing it.
+.It Fl E
+On filesystem errors (file not found etc), instead of handling the error
+as regular output as POSIX mandates and keep going, issue an error message
+and exit.
 .It Fl e , Fl Fl exclude Ar testname
 Exclude the test named in
 .Ar testname
@@ -259,8 +267,16 @@ prepended.
 (If you want a newline, see the
 .Fl r
 option.)
+The magic pattern with the highest strength (see the
+.Fl l
+option) comes first.
 .It Fl l , Fl Fl list
-Print information about the strength of each magic pattern.
+Shows a list of patterns and their strength sorted descending by
+.Xr magic 4
+strength
+which is used for the matching (see also the
+.Fl k
+option).
 .It Fl L , Fl Fl dereference
 option causes symlinks to be followed, as the like-named option in
 .Xr ls 1
@@ -268,8 +284,6 @@ option causes symlinks to be followed, as the like-named option in
 This is the default if the environment variable
 .Ev POSIXLY_CORRECT
 is defined.
-.It Fl l
-Shows sorted patterns list in the order which is used for the matching.
 .It Fl m , Fl Fl magic-file Ar magicfiles
 Specify an alternate list of files and directories containing magic.
 This can be a single item, or a colon-separated list.
@@ -325,7 +339,7 @@ after the end of the filename.
 Nice to
 .Xr cut 1
 the output.
-This does not affect the separator which is still printed.
+This does not affect the separator, which is still printed.
 .It Fl -help
 Print a help message and exit.
 .El
@@ -547,20 +561,27 @@ returns 0 on success, and non-zero on error.
 Please report bugs and send patches to the bug tracker at
 .Pa http://bugs.gw.com/
 or the mailing list at
-.Aq file@mx.gw.com .
+.Aq file@mx.gw.com
+(visit
+.Pa http://mx.gw.com/mailman/listinfo/file
+first to subscribe).
 .Sh TODO
 .Pp
 Fix output so that tests for MIME and APPLE flags are not needed all
-over the place, and actual output is only done in one place. This
-needs a design. Suggestion: push possible outputs on to a list, then
-pick the last-pushed (most specific, one hopes) value at the end, or
-use a default if the list is empty. This should not slow down evaluation.
+over the place, and actual output is only done in one place.
+This needs a design.
+Suggestion: push possible outputs on to a list, then pick the
+last-pushed (most specific, one hopes) value at the end, or
+use a default if the list is empty.
+This should not slow down evaluation.
 .Pp
-Continue to squash all magic bugs. See Debian BTS for a good source.
+Continue to squash all magic bugs.
+See Debian BTS for a good source.
 .Pp
 Store arbitrarily long strings, for example for %s patterns, so that
-they can be printed out. Fixes Debian bug #271672. Would require more
-complex store/load code in apprentice.
+they can be printed out.
+Fixes Debian bug #271672.
+Would require more complex store/load code in apprentice.
 .Pp
 Add syntax for relative offsets after current level (Debian bug #466037).
 .Pp
@@ -570,6 +591,30 @@ Add a zip library so we can peek inside Office2007 documents to
 figure out what they are.
 .Pp
 Add an option to print URLs for the sources of the file descriptions.
+.Pp
+Combine script searches and add a way to map executable names to MIME
+types (e.g. have a magic value for !:mime which causes the resulting
+string to be looked up in a table).
+This would avoid adding the same magic repeatedly for each new
+hash-bang interpreter.
+.Pp
+Fix
+.Dq name
+and
+.Dq use
+to check for consistency at compile time (duplicate 
+.Dq name ,
+.Dq use
+pointing to undefined
+.Dq name
+).
+Make 
+.Dq name
+/
+.Dq use 
+more efficient by keeping a sorted list of names.
+Special-case ^ to flip endianness in the parser so that it does not
+have to be escaped, and document it.
 .Sh AVAILABILITY
 You can obtain the original author's latest version by anonymous FTP
 on
diff --git a/contrib/file/libmagic.man b/contrib/file/doc/libmagic.man
similarity index 93%
rename from contrib/file/libmagic.man
rename to contrib/file/doc/libmagic.man
index 272b8386a30..ee9cdb284ef 100644
--- a/contrib/file/libmagic.man
+++ b/contrib/file/doc/libmagic.man
@@ -1,4 +1,4 @@
-.\" $File: libmagic.man,v 1.26 2011/12/19 17:49:31 christos Exp $
+.\" $File: libmagic.man,v 1.28 2014/03/02 14:47:16 christos Exp $
 .\"
 .\" Copyright (c) Christos Zoulas 2003.
 .\" All Rights Reserved.
@@ -25,19 +25,22 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd December 19, 2011
+.Dd January 6, 2012
 .Dt LIBMAGIC 3
 .Os
 .Sh NAME
 .Nm magic_open ,
 .Nm magic_close ,
 .Nm magic_error ,
+.Nm magic_errno ,
 .Nm magic_descriptor ,
 .Nm magic_buffer ,
 .Nm magic_setflags ,
 .Nm magic_check ,
 .Nm magic_compile ,
-.Nm magic_load
+.Nm magic_list ,
+.Nm magic_load ,
+.Nm magic_version
 .Nd Magic number recognition library
 .Sh LIBRARY
 .Lb libmagic
@@ -67,6 +70,8 @@
 .Fn magic_list "magic_t cookie" "const char *filename"
 .Ft int
 .Fn magic_load "magic_t cookie" "const char *filename"
+.Ft int
+.Fn magic_version "void"
 .Sh DESCRIPTION
 These functions
 operate on the magic database file
@@ -246,6 +251,16 @@ If that variable is not set, the default database file name is __MAGIC__.
 adds
 .Dq .mgc
 to the database filename as appropriate.
+.Pp
+The
+.Fn magic_version
+command returns the version number of this library which is compiled into
+the shared library using the constant
+.Dv MAGIC_VERSION
+from
+.In magic.h .
+This can be used by client programs to verify that the version they compile
+against is the same as the version that they run against.
 .Sh RETURN VALUES
 The function
 .Fn magic_open
@@ -276,6 +291,9 @@ function returns a textual description of the errors of the above
 functions, or
 .Dv NULL
 if there was no error.
+The
+.Fn magic_version
+always returns the version number of the library.
 Finally,
 .Fn magic_setflags
 returns \-1 on systems that don't support
diff --git a/contrib/file/magic.man b/contrib/file/doc/magic.man
similarity index 79%
rename from contrib/file/magic.man
rename to contrib/file/doc/magic.man
index 12045682aa1..762da481231 100644
--- a/contrib/file/magic.man
+++ b/contrib/file/doc/magic.man
@@ -1,5 +1,5 @@
-.\" $File: magic.man,v 1.71 2011/12/07 11:58:24 rrt Exp $
-.Dd April 20, 2011
+.\" $File: magic.man,v 1.84 2014/06/03 19:01:34 christos Exp $
+.Dd June 3, 2014
 .Dt MAGIC __FSECTION__
 .Os
 .\" install as magic.4 on USG, magic.5 on V7, Berkeley and Linux systems.
@@ -51,7 +51,7 @@ A 64-bit double precision IEEE floating point number in this machine's native by
 .It Dv string
 A string of bytes.
 The string type specification can be optionally followed
-by /[WwcCtb]*.
+by /[WwcCtbT]*.
 The
 .Dq W
 flag compacts whitespace in the target, which must
@@ -85,8 +85,12 @@ The
 flag forces the test to be done for text files, while the
 .Dq b
 flag forces the test to be done for binary files.
+The
+.Dq T
+flag causes the string to be trimmed, i.e. leading and trailing whitespace
+is deleted before the string is printed.
 .It Dv pstring
-A Pascal-style string where the first byte/short/int is interpreted as the an
+A Pascal-style string where the first byte/short/int is interpreted as the
 unsigned length.
 The length defaults to byte and can be specified as a modifier.
 The following modifiers are supported:
@@ -121,6 +125,8 @@ local time rather than UTC.
 .It Dv qldate
 An eight-byte value interpreted as a UNIX-style date, but interpreted as
 local time rather than UTC.
+.It Dv qwdate
+An eight-byte value interpreted as a Windows-style date.
 .It Dv beid3
 A 32-bit ID3 length in big-endian byte order.
 .It Dv beshort
@@ -147,6 +153,9 @@ than UTC.
 An eight-byte value in big-endian byte order,
 interpreted as a UNIX-style date, but interpreted as local time rather
 than UTC.
+.It Dv beqwdate
+An eight-byte value in big-endian byte order,
+interpreted as a Windows-style date.
 .It Dv bestring16
 A two-byte unicode (UCS16) string in big-endian byte order.
 .It Dv leid3
@@ -175,6 +184,9 @@ than UTC.
 An eight-byte value in little-endian byte order,
 interpreted as a UNIX-style date, but interpreted as local time rather
 than UTC.
+.It Dv leqwdate
+An eight-byte value in little-endian byte order,
+interpreted as a Windows-style date.
 .It Dv lestring16
 A two-byte unicode (UCS16) string in little-endian byte order.
 .It Dv melong
@@ -188,6 +200,27 @@ interpreted as a UNIX-style date, but interpreted as local time rather
 than UTC.
 .It Dv indirect
 Starting at the given offset, consult the magic database again.
+.It Dv name
+Define a
+.Dq named
+magic instance that can be called from another
+.Dv use
+magic entry, like a subroutine call.
+Named instance direct magic offsets are relative to the offset of the
+previous matched entry, but indirect offsets are relative to the beginning
+of the file as usual.
+Named magic entries always match.
+.It Dv use
+Recursively call the named magic starting from the current offset.
+If the name of the referenced begins with a
+.Dv ^
+then the endianness of the magic is switched; if the magic mentioned
+.Dv leshort
+for example,
+it is treated as
+.Dv beshort
+and vice versa.
+This is useful to avoid duplicating the rules for different endianness.
 .It Dv regex
 A regular expression match in extended POSIX regular expression syntax
 (like egrep).
@@ -195,19 +228,25 @@ Regular expressions can take exponential time to process, and their
 performance is hard to predict, so their use is discouraged.
 When used in production environments, their performance
 should be carefully checked.
-The type specification can be optionally followed by
-.Dv /[c][s] .
+The size of the string to search should also be limited by specifying
+.Dv / ,
+to avoid performance issues scanning long files.
+The type specification can also be optionally followed by
+.Dv /[c][s][l] .
 The
 .Dq c
 flag makes the match case insensitive, while the
 .Dq s
 flag update the offset to the start offset of the match, rather than the end.
-The regular expression is tested against line
-.Dv N + 1
-onwards, where
-.Dv N
-is the given offset.
-Line endings are assumed to be in the machine's native format.
+The
+.Dq l
+modifier, changes the limit of length to mean number of lines instead of a
+byte count.
+Lines are delimited by the platforms native line delimiter.
+When a line count is specified, an implicit byte count also computed assuming
+each line is 80 characters long.
+If neither a byte or line count is specified, the search is limited automatically
+to 8KiB.
 .Dv ^
 and
 .Dv $
@@ -216,22 +255,91 @@ not beginning and end of file.
 .It Dv search
 A literal string search starting at the given offset.
 The same modifier flags can be used as for string patterns.
-The modifier flags (if any) must be followed by
-.Dv /number
-the range, that is, the number of positions at which the match will be
+The search expression must contain the range in the form
+.Dv /number,
+that is the number of positions at which the match will be
 attempted, starting from the start offset.
 This is suitable for
 searching larger binary expressions with variable offsets, using
 .Dv \e
 escapes for special characters.
-The offset works as for regex.
+The order of modifier and number is not relevant.
 .It Dv default
 This is intended to be used with the test
 .Em x
-(which is always true) and a message that is to be used if there are
-no other matches.
+(which is always true) and it has no type.
+It matches when no other test at that continuation level has matched before.
+Clearing that matched tests for a continuation level, can be done using the
+.Dv clear
+test.
+.It Dv clear
+This test is always true and clears the match flag for that continuation level.
+It is intended to be used with the
+.Dv default
+test.
 .El
 .Pp
+For compatibility with the Single
+.Ux
+Standard, the type specifiers
+.Dv dC
+and
+.Dv d1
+are equivalent to
+.Dv byte ,
+the type specifiers
+.Dv uC
+and
+.Dv u1
+are equivalent to
+.Dv ubyte ,
+the type specifiers
+.Dv dS
+and
+.Dv d2
+are equivalent to
+.Dv short ,
+the type specifiers
+.Dv uS
+and
+.Dv u2
+are equivalent to
+.Dv ushort ,
+the type specifiers
+.Dv dI ,
+.Dv dL ,
+and
+.Dv d4
+are equivalent to
+.Dv long ,
+the type specifiers
+.Dv uI ,
+.Dv uL ,
+and
+.Dv u4
+are equivalent to
+.Dv ulong ,
+the type specifier
+.Dv d8
+is equivalent to
+.Dv quad ,
+the type specifier
+.Dv u8
+is equivalent to
+.Dv uquad ,
+and the type specifier
+.Dv s
+is equivalent to
+.Dv string .
+In addition, the type specifier
+.Dv dQ
+is equivalent to
+.Dv quad
+and the type specifier
+.Dv uQ
+is equivalent to
+.Dv uquad .
+.Pp
 Each top-level magic pattern (see below for an explanation of levels)
 is classified as text or binary according to the types used.
 Types
@@ -307,6 +415,9 @@ is octal, and
 .Dv 0x13
 is hexadecimal.
 .Pp
+Numeric operations are not performed on date types, instead the numeric
+value is interpreted as an offset.
+.Pp
 For string values, the string from the
 file must match the specified string.
 The operators
@@ -324,6 +435,9 @@ then print the string), with
 .Em \*[Gt]\e0
 (because all non-empty strings are greater than the empty string).
 .Pp
+Dates are treated as numerical values in the respective internal
+representation.
+.Pp
 The special test
 .Em x
 always evaluates to true.
@@ -511,7 +625,7 @@ Or even both!
 \*[Gt]\*[Gt]\*[Gt]\*[Am](\*[Am]0x54.l-3)  string  UNACE  \eb, ACE self-extracting archive
 .Ed
 .Pp
-Finally, if you have to deal with offset/length pairs in your file, even the
+If you have to deal with offset/length pairs in your file, even the
 second value in a parenthesized expression can be taken from the file itself,
 using another set of parentheses.
 Note that this additional indirect offset is always relative to the
@@ -526,6 +640,18 @@ start of the main indirect offset.
 # these are located 14 and 10 bytes after the section name
 \*[Gt]\*[Gt]\*[Gt]\*[Gt](\*[Am]0xe.l+(-4)) string       PK\e3\e4 \eb, ZIP self-extracting archive
 .Ed
+.Pp
+If you have a list of known avalues at a particular continuation level,
+and you want to provide a switch-like default case:
+.Bd -literal -offset indent
+# clear that continuation level match
+\*[Gt]18	clear
+\*[Gt]18	lelong	1	one
+\*[Gt]18	lelong	2	two
+\*[Gt]18	default	x
+# print default match
+\*[Gt]\*[Gt]18	lelong	x	unmatched 0x%x
+.Ed
 .Sh SEE ALSO
 .Xr file __CSECTION__
 \- the command that reads this file.
@@ -537,19 +663,41 @@ The formats
 .Dv melong ,
 .Dv short ,
 .Dv beshort ,
-.Dv leshort ,
-.Dv date ,
-.Dv bedate ,
-.Dv medate ,
-.Dv ledate ,
-.Dv beldate ,
-.Dv leldate ,
 and
-.Dv meldate
-are system-dependent; perhaps they should be specified as a number
-of bytes (2B, 4B, etc),
-since the files being recognized typically come from
-a system on which the lengths are invariant.
+.Dv leshort
+do not depend on the length of the C data types
+.Dv short
+and
+.Dv long
+on the platform, even though the Single
+.Ux
+Specification implies that they do.  However, as OS X Mountain Lion has
+passed the Single
+.Ux
+Specification validation suite, and supplies a version of
+.Xr file __CSECTION__
+in which they do not depend on the sizes of the C data types and that is
+built for a 64-bit environment in which
+.Dv long
+is 8 bytes rather than 4 bytes, presumably the validation suite does not
+test whether, for example
+.Dv long
+refers to an item with the same size as the C data type
+.Dv long .
+There should probably be
+.Dv type
+names
+.Dv int8 ,
+.Dv uint8 ,
+.Dv int16 ,
+.Dv uint16 ,
+.Dv int32 ,
+.Dv uint32 ,
+.Dv int64 ,
+and
+.Dv uint64 ,
+and specified-byte-order variants of them,
+to make it clearer that those types have specified widths.
 .\"
 .\" From: guy@sun.uucp (Guy Harris)
 .\" Newsgroups: net.bugs.usg
diff --git a/contrib/file/install-sh b/contrib/file/install-sh
index 68b81002eae..b12c0f71892 100755
--- a/contrib/file/install-sh
+++ b/contrib/file/install-sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: install-sh.in,v 1.5 2010/10/08 19:57:05 tez Exp $
+# $NetBSD: install-sh.in,v 1.6 2012/01/11 13:07:31 hans Exp $
 # This script now also installs multiple files, but might choke on installing
 # multiple files with spaces in the file names.
 #
@@ -45,6 +45,7 @@ rmprog="${RMPROG-rm}"
 mkdirprog="${MKDIRPROG-mkdir}"
 
 instcmd="$cpprog"
+instflags=""
 pathcompchmodcmd="$chmodprog 755"
 chmodcmd="$chmodprog 755"
 chowncmd=""
@@ -84,6 +85,11 @@ while [ x"$1" != x ]; do
 	    shift
 	    continue;;
 
+	-m*)
+	    chmodcmd="$chmodprog ${1#-m}"
+	    shift
+	    continue;;
+
 	-o) chowncmd="$chownprog $2"
 	    shift
 	    shift
@@ -104,6 +110,10 @@ while [ x"$1" != x ]; do
 	    shift
 	    continue;;
 
+	-p) instflags="-p"
+	    shift
+	    continue;;
+
 	*)  if [ x"$msrc" = x ]
 	    then
 		msrc="$dst"
@@ -154,7 +164,7 @@ else
 
 	if [ -f "$srcarg" ]
 	then
-		doinst="$instcmd"
+		doinst="$instcmd $instflags"
 	elif [ -d "$srcarg" ]
 	then
 		echo "install: $srcarg: not a regular file"
diff --git a/contrib/file/ltmain.sh b/contrib/file/ltmain.sh
new file mode 100755
index 00000000000..f53abfd976e
--- /dev/null
+++ b/contrib/file/ltmain.sh
@@ -0,0 +1,9664 @@
+
+# libtool (GNU libtool) 2.4.2
+# Written by Gordon Matzigkeit , 1996
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
+# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# GNU Libtool 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 of the License, or
+# (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool 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 GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html,
+# or obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# Usage: $progname [OPTION]... [MODE-ARG]...
+#
+# Provide generalized library-building support services.
+#
+#       --config             show all configuration variables
+#       --debug              enable verbose shell tracing
+#   -n, --dry-run            display commands without modifying any files
+#       --features           display basic configuration information and exit
+#       --mode=MODE          use operation mode MODE
+#       --preserve-dup-deps  don't remove duplicate dependency libraries
+#       --quiet, --silent    don't print informational messages
+#       --no-quiet, --no-silent
+#                            print informational messages (default)
+#       --no-warn            don't display warning messages
+#       --tag=TAG            use configuration variables from tag TAG
+#   -v, --verbose            print more informational messages than default
+#       --no-verbose         don't print the extra informational messages
+#       --version            print version information
+#   -h, --help, --help-all   print short, long, or detailed help message
+#
+# MODE must be one of the following:
+#
+#         clean              remove files from the build directory
+#         compile            compile a source file into a libtool object
+#         execute            automatically set library path, then run a program
+#         finish             complete the installation of libtool libraries
+#         install            install libraries or executables
+#         link               create a library or an executable
+#         uninstall          remove libraries from an installed directory
+#
+# MODE-ARGS vary depending on the MODE.  When passed as first option,
+# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
+# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
+#
+# When reporting a bug, please describe a test case to reproduce it and
+# include the following information:
+#
+#         host-triplet:	$host
+#         shell:		$SHELL
+#         compiler:		$LTCC
+#         compiler flags:		$LTCFLAGS
+#         linker:		$LD (gnu? $with_gnu_ld)
+#         $progname:	(GNU libtool) 2.4.2
+#         automake:	$automake_version
+#         autoconf:	$autoconf_version
+#
+# Report bugs to .
+# GNU libtool home page: .
+# General help using GNU software: .
+
+PROGRAM=libtool
+PACKAGE=libtool
+VERSION=2.4.2
+TIMESTAMP=""
+package_revision=1.3337
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+}
+
+# NLS nuisances: We save the old values to restore during execute mode.
+lt_user_locale=
+lt_safe_locale=
+for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+do
+  eval "if test \"\${$lt_var+set}\" = set; then
+          save_$lt_var=\$$lt_var
+          $lt_var=C
+	  export $lt_var
+	  lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
+	  lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
+	fi"
+done
+LC_ALL=C
+LANGUAGE=C
+export LANGUAGE LC_ALL
+
+$lt_unset CDPATH
+
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+unset CP
+unset MV
+unset RM
+: ${CP="cp -f"}
+test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
+: ${MAKE="make"}
+: ${MKDIR="mkdir"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
+: ${Xsed="$SED -e 1s/^X//"}
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
+EXIT_SKIP=77	  # $? = 77 is used to indicate a skipped test to automake.
+
+exit_status=$EXIT_SUCCESS
+
+# Make sure IFS has a sensible default
+lt_nl='
+'
+IFS=" 	$lt_nl"
+
+dirname="s,/[^/]*$,,"
+basename="s,^.*/,,"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+    func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
+    if test "X$func_dirname_result" = "X${1}"; then
+      func_dirname_result="${3}"
+    else
+      func_dirname_result="$func_dirname_result${2}"
+    fi
+} # func_dirname may be replaced by extended shell implementation
+
+
+# func_basename file
+func_basename ()
+{
+    func_basename_result=`$ECHO "${1}" | $SED "$basename"`
+} # func_basename may be replaced by extended shell implementation
+
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+#   dirname:  Compute the dirname of FILE.  If nonempty,
+#             add APPEND to the result, otherwise set result
+#             to NONDIR_REPLACEMENT.
+#             value returned in "$func_dirname_result"
+#   basename: Compute filename of FILE.
+#             value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+    # Extract subdirectory from the argument.
+    func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
+    if test "X$func_dirname_result" = "X${1}"; then
+      func_dirname_result="${3}"
+    else
+      func_dirname_result="$func_dirname_result${2}"
+    fi
+    func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
+} # func_dirname_and_basename may be replaced by extended shell implementation
+
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+    case ${2} in
+      .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+      *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+    esac
+} # func_stripname may be replaced by extended shell implementation
+
+
+# These SED scripts presuppose an absolute path with a trailing slash.
+pathcar='s,^/\([^/]*\).*$,\1,'
+pathcdr='s,^/[^/]*,,'
+removedotparts=':dotsl
+		s@/\./@/@g
+		t dotsl
+		s,/\.$,/,'
+collapseslashes='s@/\{1,\}@/@g'
+finalslash='s,/*$,/,'
+
+# func_normal_abspath PATH
+# Remove doubled-up and trailing slashes, "." path components,
+# and cancel out any ".." path components in PATH after making
+# it an absolute path.
+#             value returned in "$func_normal_abspath_result"
+func_normal_abspath ()
+{
+  # Start from root dir and reassemble the path.
+  func_normal_abspath_result=
+  func_normal_abspath_tpath=$1
+  func_normal_abspath_altnamespace=
+  case $func_normal_abspath_tpath in
+    "")
+      # Empty path, that just means $cwd.
+      func_stripname '' '/' "`pwd`"
+      func_normal_abspath_result=$func_stripname_result
+      return
+    ;;
+    # The next three entries are used to spot a run of precisely
+    # two leading slashes without using negated character classes;
+    # we take advantage of case's first-match behaviour.
+    ///*)
+      # Unusual form of absolute path, do nothing.
+    ;;
+    //*)
+      # Not necessarily an ordinary path; POSIX reserves leading '//'
+      # and for example Cygwin uses it to access remote file shares
+      # over CIFS/SMB, so we conserve a leading double slash if found.
+      func_normal_abspath_altnamespace=/
+    ;;
+    /*)
+      # Absolute path, do nothing.
+    ;;
+    *)
+      # Relative path, prepend $cwd.
+      func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
+    ;;
+  esac
+  # Cancel out all the simple stuff to save iterations.  We also want
+  # the path to end with a slash for ease of parsing, so make sure
+  # there is one (and only one) here.
+  func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
+  while :; do
+    # Processed it all yet?
+    if test "$func_normal_abspath_tpath" = / ; then
+      # If we ascended to the root using ".." the result may be empty now.
+      if test -z "$func_normal_abspath_result" ; then
+        func_normal_abspath_result=/
+      fi
+      break
+    fi
+    func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$pathcar"`
+    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$pathcdr"`
+    # Figure out what to do with it
+    case $func_normal_abspath_tcomponent in
+      "")
+        # Trailing empty path component, ignore it.
+      ;;
+      ..)
+        # Parent dir; strip last assembled component from result.
+        func_dirname "$func_normal_abspath_result"
+        func_normal_abspath_result=$func_dirname_result
+      ;;
+      *)
+        # Actual path component, append it.
+        func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
+      ;;
+    esac
+  done
+  # Restore leading double-slash if one was found on entry.
+  func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
+}
+
+# func_relative_path SRCDIR DSTDIR
+# generates a relative path from SRCDIR to DSTDIR, with a trailing
+# slash if non-empty, suitable for immediately appending a filename
+# without needing to append a separator.
+#             value returned in "$func_relative_path_result"
+func_relative_path ()
+{
+  func_relative_path_result=
+  func_normal_abspath "$1"
+  func_relative_path_tlibdir=$func_normal_abspath_result
+  func_normal_abspath "$2"
+  func_relative_path_tbindir=$func_normal_abspath_result
+
+  # Ascend the tree starting from libdir
+  while :; do
+    # check if we have found a prefix of bindir
+    case $func_relative_path_tbindir in
+      $func_relative_path_tlibdir)
+        # found an exact match
+        func_relative_path_tcancelled=
+        break
+        ;;
+      $func_relative_path_tlibdir*)
+        # found a matching prefix
+        func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
+        func_relative_path_tcancelled=$func_stripname_result
+        if test -z "$func_relative_path_result"; then
+          func_relative_path_result=.
+        fi
+        break
+        ;;
+      *)
+        func_dirname $func_relative_path_tlibdir
+        func_relative_path_tlibdir=${func_dirname_result}
+        if test "x$func_relative_path_tlibdir" = x ; then
+          # Have to descend all the way to the root!
+          func_relative_path_result=../$func_relative_path_result
+          func_relative_path_tcancelled=$func_relative_path_tbindir
+          break
+        fi
+        func_relative_path_result=../$func_relative_path_result
+        ;;
+    esac
+  done
+
+  # Now calculate path; take care to avoid doubling-up slashes.
+  func_stripname '' '/' "$func_relative_path_result"
+  func_relative_path_result=$func_stripname_result
+  func_stripname '/' '/' "$func_relative_path_tcancelled"
+  if test "x$func_stripname_result" != x ; then
+    func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
+  fi
+
+  # Normalisation. If bindir is libdir, return empty string,
+  # else relative path ending with a slash; either way, target
+  # file name can be directly appended.
+  if test ! -z "$func_relative_path_result"; then
+    func_stripname './' '' "$func_relative_path_result/"
+    func_relative_path_result=$func_stripname_result
+  fi
+}
+
+# The name of this program:
+func_dirname_and_basename "$progpath"
+progname=$func_basename_result
+
+# Make sure we have an absolute path for reexecution:
+case $progpath in
+  [\\/]*|[A-Za-z]:\\*) ;;
+  *[\\/]*)
+     progdir=$func_dirname_result
+     progdir=`cd "$progdir" && pwd`
+     progpath="$progdir/$progname"
+     ;;
+  *)
+     save_IFS="$IFS"
+     IFS=${PATH_SEPARATOR-:}
+     for progdir in $PATH; do
+       IFS="$save_IFS"
+       test -x "$progdir/$progname" && break
+     done
+     IFS="$save_IFS"
+     test -n "$progdir" || progdir=`pwd`
+     progpath="$progdir/$progname"
+     ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution that turns a string into a regex matching for the
+# string literally.
+sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
+
+# Sed substitution that converts a w32 file name or path
+# which contains forward slashes, into one that contains
+# (escaped) backslashes.  A very naive implementation.
+lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+
+# Re-`\' parameter expansions in output of double_quote_subst that were
+# `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
+# in input to double_quote_subst, that '$' was protected from expansion.
+# Since each input `\' is now two `\'s, look for any number of runs of
+# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
+bs='\\'
+bs2='\\\\'
+bs4='\\\\\\\\'
+dollar='\$'
+sed_double_backslash="\
+  s/$bs4/&\\
+/g
+  s/^$bs2$dollar/$bs&/
+  s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
+  s/\n//g"
+
+# Standard options:
+opt_dry_run=false
+opt_help=false
+opt_quiet=false
+opt_verbose=false
+opt_warning=:
+
+# func_echo arg...
+# Echo program name prefixed message, along with the current mode
+# name if it has been set yet.
+func_echo ()
+{
+    $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
+}
+
+# func_verbose arg...
+# Echo program name prefixed message in verbose mode only.
+func_verbose ()
+{
+    $opt_verbose && func_echo ${1+"$@"}
+
+    # A bug in bash halts the script if the last line of a function
+    # fails when set -e is in force, so we need another command to
+    # work around that:
+    :
+}
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "$*"
+}
+
+# func_error arg...
+# Echo program name prefixed message to standard error.
+func_error ()
+{
+    $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
+}
+
+# func_warning arg...
+# Echo program name prefixed warning message to standard error.
+func_warning ()
+{
+    $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
+
+    # bash bug again:
+    :
+}
+
+# func_fatal_error arg...
+# Echo program name prefixed message to standard error, and exit.
+func_fatal_error ()
+{
+    func_error ${1+"$@"}
+    exit $EXIT_FAILURE
+}
+
+# func_fatal_help arg...
+# Echo program name prefixed message to standard error, followed by
+# a help hint, and exit.
+func_fatal_help ()
+{
+    func_error ${1+"$@"}
+    func_fatal_error "$help"
+}
+help="Try \`$progname --help' for more information."  ## default
+
+
+# func_grep expression filename
+# Check whether EXPRESSION matches any line of FILENAME, without output.
+func_grep ()
+{
+    $GREP "$1" "$2" >/dev/null 2>&1
+}
+
+
+# func_mkdir_p directory-path
+# Make sure the entire path to DIRECTORY-PATH is available.
+func_mkdir_p ()
+{
+    my_directory_path="$1"
+    my_dir_list=
+
+    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
+
+      # Protect directory names starting with `-'
+      case $my_directory_path in
+        -*) my_directory_path="./$my_directory_path" ;;
+      esac
+
+      # While some portion of DIR does not yet exist...
+      while test ! -d "$my_directory_path"; do
+        # ...make a list in topmost first order.  Use a colon delimited
+	# list incase some portion of path contains whitespace.
+        my_dir_list="$my_directory_path:$my_dir_list"
+
+        # If the last portion added has no slash in it, the list is done
+        case $my_directory_path in */*) ;; *) break ;; esac
+
+        # ...otherwise throw away the child directory and loop
+        my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
+      done
+      my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
+
+      save_mkdir_p_IFS="$IFS"; IFS=':'
+      for my_dir in $my_dir_list; do
+	IFS="$save_mkdir_p_IFS"
+        # mkdir can fail with a `File exist' error if two processes
+        # try to create one of the directories concurrently.  Don't
+        # stop in that case!
+        $MKDIR "$my_dir" 2>/dev/null || :
+      done
+      IFS="$save_mkdir_p_IFS"
+
+      # Bail out if we (or some other process) failed to create a directory.
+      test -d "$my_directory_path" || \
+        func_fatal_error "Failed to create \`$1'"
+    fi
+}
+
+
+# func_mktempdir [string]
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible.  If
+# given, STRING is the basename for that directory.
+func_mktempdir ()
+{
+    my_template="${TMPDIR-/tmp}/${1-$progname}"
+
+    if test "$opt_dry_run" = ":"; then
+      # Return a directory name, but don't create it in dry-run mode
+      my_tmpdir="${my_template}-$$"
+    else
+
+      # If mktemp works, use that first and foremost
+      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+      if test ! -d "$my_tmpdir"; then
+        # Failing that, at least try and use $RANDOM to avoid a race
+        my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+        save_mktempdir_umask=`umask`
+        umask 0077
+        $MKDIR "$my_tmpdir"
+        umask $save_mktempdir_umask
+      fi
+
+      # If we're not in dry-run mode, bomb out on failure
+      test -d "$my_tmpdir" || \
+        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
+    fi
+
+    $ECHO "$my_tmpdir"
+}
+
+
+# func_quote_for_eval arg
+# Aesthetically quote ARG to be evaled later.
+# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
+# is double-quoted, suitable for a subsequent eval, whereas
+# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
+# which are still active within double quotes backslashified.
+func_quote_for_eval ()
+{
+    case $1 in
+      *[\\\`\"\$]*)
+	func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
+      *)
+        func_quote_for_eval_unquoted_result="$1" ;;
+    esac
+
+    case $func_quote_for_eval_unquoted_result in
+      # Double-quote args containing shell metacharacters to delay
+      # word splitting, command substitution and and variable
+      # expansion for a subsequent eval.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+        func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
+        ;;
+      *)
+        func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
+    esac
+}
+
+
+# func_quote_for_expand arg
+# Aesthetically quote ARG to be evaled later; same as above,
+# but do not quote variable references.
+func_quote_for_expand ()
+{
+    case $1 in
+      *[\\\`\"]*)
+	my_arg=`$ECHO "$1" | $SED \
+	    -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
+      *)
+        my_arg="$1" ;;
+    esac
+
+    case $my_arg in
+      # Double-quote args containing shell metacharacters to delay
+      # word splitting and command substitution for a subsequent eval.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+        my_arg="\"$my_arg\""
+        ;;
+    esac
+
+    func_quote_for_expand_result="$my_arg"
+}
+
+
+# func_show_eval cmd [fail_exp]
+# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
+# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.
+func_show_eval ()
+{
+    my_cmd="$1"
+    my_fail_exp="${2-:}"
+
+    ${opt_silent-false} || {
+      func_quote_for_expand "$my_cmd"
+      eval "func_echo $func_quote_for_expand_result"
+    }
+
+    if ${opt_dry_run-false}; then :; else
+      eval "$my_cmd"
+      my_status=$?
+      if test "$my_status" -eq 0; then :; else
+	eval "(exit $my_status); $my_fail_exp"
+      fi
+    fi
+}
+
+
+# func_show_eval_locale cmd [fail_exp]
+# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
+# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.  Use the saved locale for evaluation.
+func_show_eval_locale ()
+{
+    my_cmd="$1"
+    my_fail_exp="${2-:}"
+
+    ${opt_silent-false} || {
+      func_quote_for_expand "$my_cmd"
+      eval "func_echo $func_quote_for_expand_result"
+    }
+
+    if ${opt_dry_run-false}; then :; else
+      eval "$lt_user_locale
+	    $my_cmd"
+      my_status=$?
+      eval "$lt_safe_locale"
+      if test "$my_status" -eq 0; then :; else
+	eval "(exit $my_status); $my_fail_exp"
+      fi
+    fi
+}
+
+# func_tr_sh
+# Turn $1 into a string suitable for a shell variable name.
+# Result is stored in $func_tr_sh_result.  All characters
+# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
+# if $1 begins with a digit, a '_' is prepended as well.
+func_tr_sh ()
+{
+  case $1 in
+  [0-9]* | *[!a-zA-Z0-9_]*)
+    func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
+    ;;
+  * )
+    func_tr_sh_result=$1
+    ;;
+  esac
+}
+
+
+# func_version
+# Echo version message to standard output and exit.
+func_version ()
+{
+    $opt_debug
+
+    $SED -n '/(C)/!b go
+	:more
+	/\./!{
+	  N
+	  s/\n# / /
+	  b more
+	}
+	:go
+	/^# '$PROGRAM' (GNU /,/# warranty; / {
+        s/^# //
+	s/^# *$//
+        s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
+        p
+     }' < "$progpath"
+     exit $?
+}
+
+# func_usage
+# Echo short help message to standard output and exit.
+func_usage ()
+{
+    $opt_debug
+
+    $SED -n '/^# Usage:/,/^#  *.*--help/ {
+        s/^# //
+	s/^# *$//
+	s/\$progname/'$progname'/
+	p
+    }' < "$progpath"
+    echo
+    $ECHO "run \`$progname --help | more' for full usage"
+    exit $?
+}
+
+# func_help [NOEXIT]
+# Echo long help message to standard output and exit,
+# unless 'noexit' is passed as argument.
+func_help ()
+{
+    $opt_debug
+
+    $SED -n '/^# Usage:/,/# Report bugs to/ {
+	:print
+        s/^# //
+	s/^# *$//
+	s*\$progname*'$progname'*
+	s*\$host*'"$host"'*
+	s*\$SHELL*'"$SHELL"'*
+	s*\$LTCC*'"$LTCC"'*
+	s*\$LTCFLAGS*'"$LTCFLAGS"'*
+	s*\$LD*'"$LD"'*
+	s/\$with_gnu_ld/'"$with_gnu_ld"'/
+	s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
+	s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
+	p
+	d
+     }
+     /^# .* home page:/b print
+     /^# General help using/b print
+     ' < "$progpath"
+    ret=$?
+    if test -z "$1"; then
+      exit $ret
+    fi
+}
+
+# func_missing_arg argname
+# Echo program name prefixed message to standard error and set global
+# exit_cmd.
+func_missing_arg ()
+{
+    $opt_debug
+
+    func_error "missing argument for $1."
+    exit_cmd=exit
+}
+
+
+# func_split_short_opt shortopt
+# Set func_split_short_opt_name and func_split_short_opt_arg shell
+# variables after splitting SHORTOPT after the 2nd character.
+func_split_short_opt ()
+{
+    my_sed_short_opt='1s/^\(..\).*$/\1/;q'
+    my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
+
+    func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
+    func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
+} # func_split_short_opt may be replaced by extended shell implementation
+
+
+# func_split_long_opt longopt
+# Set func_split_long_opt_name and func_split_long_opt_arg shell
+# variables after splitting LONGOPT at the `=' sign.
+func_split_long_opt ()
+{
+    my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
+    my_sed_long_arg='1s/^--[^=]*=//'
+
+    func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
+    func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
+} # func_split_long_opt may be replaced by extended shell implementation
+
+exit_cmd=:
+
+
+
+
+
+magic="%%%MAGIC variable%%%"
+magic_exe="%%%MAGIC EXE variable%%%"
+
+# Global variables.
+nonopt=
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end.  This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+    eval "${1}=\$${1}\${2}"
+} # func_append may be replaced by extended shell implementation
+
+# func_append_quoted var value
+# Quote VALUE and append to the end of shell variable VAR, separated
+# by a space.
+func_append_quoted ()
+{
+    func_quote_for_eval "${2}"
+    eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
+} # func_append_quoted may be replaced by extended shell implementation
+
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+    func_arith_result=`expr "${@}"`
+} # func_arith may be replaced by extended shell implementation
+
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+    func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
+} # func_len may be replaced by extended shell implementation
+
+
+# func_lo2o object
+func_lo2o ()
+{
+    func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
+} # func_lo2o may be replaced by extended shell implementation
+
+
+# func_xform libobj-or-source
+func_xform ()
+{
+    func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
+} # func_xform may be replaced by extended shell implementation
+
+
+# func_fatal_configuration arg...
+# Echo program name prefixed message to standard error, followed by
+# a configuration failure hint, and exit.
+func_fatal_configuration ()
+{
+    func_error ${1+"$@"}
+    func_error "See the $PACKAGE documentation for more information."
+    func_fatal_error "Fatal configuration error."
+}
+
+
+# func_config
+# Display the configuration for all the tags in this script.
+func_config ()
+{
+    re_begincf='^# ### BEGIN LIBTOOL'
+    re_endcf='^# ### END LIBTOOL'
+
+    # Default configuration.
+    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
+
+    # Now print the configurations for the tags.
+    for tagname in $taglist; do
+      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
+    done
+
+    exit $?
+}
+
+# func_features
+# Display the features supported by this script.
+func_features ()
+{
+    echo "host: $host"
+    if test "$build_libtool_libs" = yes; then
+      echo "enable shared libraries"
+    else
+      echo "disable shared libraries"
+    fi
+    if test "$build_old_libs" = yes; then
+      echo "enable static libraries"
+    else
+      echo "disable static libraries"
+    fi
+
+    exit $?
+}
+
+# func_enable_tag tagname
+# Verify that TAGNAME is valid, and either flag an error and exit, or
+# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
+# variable here.
+func_enable_tag ()
+{
+  # Global variable:
+  tagname="$1"
+
+  re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
+  re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
+  sed_extractcf="/$re_begincf/,/$re_endcf/p"
+
+  # Validate tagname.
+  case $tagname in
+    *[!-_A-Za-z0-9,/]*)
+      func_fatal_error "invalid tag name: $tagname"
+      ;;
+  esac
+
+  # Don't test for the "default" C tag, as we know it's
+  # there but not specially marked.
+  case $tagname in
+    CC) ;;
+    *)
+      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
+	taglist="$taglist $tagname"
+
+	# Evaluate the configuration.  Be careful to quote the path
+	# and the sed script, to avoid splitting on whitespace, but
+	# also don't use non-portable quotes within backquotes within
+	# quotes we have to do it in 2 steps:
+	extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
+	eval "$extractedcf"
+      else
+	func_error "ignoring unknown tag $tagname"
+      fi
+      ;;
+  esac
+}
+
+# func_check_version_match
+# Ensure that we are using m4 macros, and libtool script from the same
+# release of libtool.
+func_check_version_match ()
+{
+  if test "$package_revision" != "$macro_revision"; then
+    if test "$VERSION" != "$macro_version"; then
+      if test -z "$macro_version"; then
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from an older release.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+      else
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+      fi
+    else
+      cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
+$progname: but the definition of this LT_INIT comes from revision $macro_revision.
+$progname: You should recreate aclocal.m4 with macros from revision $package_revision
+$progname: of $PACKAGE $VERSION and run autoconf again.
+_LT_EOF
+    fi
+
+    exit $EXIT_MISMATCH
+  fi
+}
+
+
+# Shorthand for --mode=foo, only valid as the first argument
+case $1 in
+clean|clea|cle|cl)
+  shift; set dummy --mode clean ${1+"$@"}; shift
+  ;;
+compile|compil|compi|comp|com|co|c)
+  shift; set dummy --mode compile ${1+"$@"}; shift
+  ;;
+execute|execut|execu|exec|exe|ex|e)
+  shift; set dummy --mode execute ${1+"$@"}; shift
+  ;;
+finish|finis|fini|fin|fi|f)
+  shift; set dummy --mode finish ${1+"$@"}; shift
+  ;;
+install|instal|insta|inst|ins|in|i)
+  shift; set dummy --mode install ${1+"$@"}; shift
+  ;;
+link|lin|li|l)
+  shift; set dummy --mode link ${1+"$@"}; shift
+  ;;
+uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
+  shift; set dummy --mode uninstall ${1+"$@"}; shift
+  ;;
+esac
+
+
+
+# Option defaults:
+opt_debug=:
+opt_dry_run=false
+opt_config=false
+opt_preserve_dup_deps=false
+opt_features=false
+opt_finish=false
+opt_help=false
+opt_help_all=false
+opt_silent=:
+opt_warning=:
+opt_verbose=:
+opt_silent=false
+opt_verbose=false
+
+
+# Parse options once, thoroughly.  This comes as soon as possible in the
+# script to make things like `--version' happen as quickly as we can.
+{
+  # this just eases exit handling
+  while test $# -gt 0; do
+    opt="$1"
+    shift
+    case $opt in
+      --debug|-x)	opt_debug='set -x'
+			func_echo "enabling shell trace mode"
+			$opt_debug
+			;;
+      --dry-run|--dryrun|-n)
+			opt_dry_run=:
+			;;
+      --config)
+			opt_config=:
+func_config
+			;;
+      --dlopen|-dlopen)
+			optarg="$1"
+			opt_dlopen="${opt_dlopen+$opt_dlopen
+}$optarg"
+			shift
+			;;
+      --preserve-dup-deps)
+			opt_preserve_dup_deps=:
+			;;
+      --features)
+			opt_features=:
+func_features
+			;;
+      --finish)
+			opt_finish=:
+set dummy --mode finish ${1+"$@"}; shift
+			;;
+      --help)
+			opt_help=:
+			;;
+      --help-all)
+			opt_help_all=:
+opt_help=': help-all'
+			;;
+      --mode)
+			test $# = 0 && func_missing_arg $opt && break
+			optarg="$1"
+			opt_mode="$optarg"
+case $optarg in
+  # Valid mode arguments:
+  clean|compile|execute|finish|install|link|relink|uninstall) ;;
+
+  # Catch anything else as an error
+  *) func_error "invalid argument for $opt"
+     exit_cmd=exit
+     break
+     ;;
+esac
+			shift
+			;;
+      --no-silent|--no-quiet)
+			opt_silent=false
+func_append preserve_args " $opt"
+			;;
+      --no-warning|--no-warn)
+			opt_warning=false
+func_append preserve_args " $opt"
+			;;
+      --no-verbose)
+			opt_verbose=false
+func_append preserve_args " $opt"
+			;;
+      --silent|--quiet)
+			opt_silent=:
+func_append preserve_args " $opt"
+        opt_verbose=false
+			;;
+      --verbose|-v)
+			opt_verbose=:
+func_append preserve_args " $opt"
+opt_silent=false
+			;;
+      --tag)
+			test $# = 0 && func_missing_arg $opt && break
+			optarg="$1"
+			opt_tag="$optarg"
+func_append preserve_args " $opt $optarg"
+func_enable_tag "$optarg"
+			shift
+			;;
+
+      -\?|-h)		func_usage				;;
+      --help)		func_help				;;
+      --version)	func_version				;;
+
+      # Separate optargs to long options:
+      --*=*)
+			func_split_long_opt "$opt"
+			set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
+			shift
+			;;
+
+      # Separate non-argument short options:
+      -\?*|-h*|-n*|-v*)
+			func_split_short_opt "$opt"
+			set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
+			shift
+			;;
+
+      --)		break					;;
+      -*)		func_fatal_help "unrecognized option \`$opt'" ;;
+      *)		set dummy "$opt" ${1+"$@"};	shift; break  ;;
+    esac
+  done
+
+  # Validate options:
+
+  # save first non-option argument
+  if test "$#" -gt 0; then
+    nonopt="$opt"
+    shift
+  fi
+
+  # preserve --debug
+  test "$opt_debug" = : || func_append preserve_args " --debug"
+
+  case $host in
+    *cygwin* | *mingw* | *pw32* | *cegcc*)
+      # don't eliminate duplications in $postdeps and $predeps
+      opt_duplicate_compiler_generated_deps=:
+      ;;
+    *)
+      opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
+      ;;
+  esac
+
+  $opt_help || {
+    # Sanity checks first:
+    func_check_version_match
+
+    if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+      func_fatal_configuration "not configured to build any kind of library"
+    fi
+
+    # Darwin sucks
+    eval std_shrext=\"$shrext_cmds\"
+
+    # Only execute mode is allowed to have -dlopen flags.
+    if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
+      func_error "unrecognized option \`-dlopen'"
+      $ECHO "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    # Change the help message to a mode-specific one.
+    generic_help="$help"
+    help="Try \`$progname --help --mode=$opt_mode' for more information."
+  }
+
+
+  # Bail if the options were screwed
+  $exit_cmd $EXIT_FAILURE
+}
+
+
+
+
+## ----------- ##
+##    Main.    ##
+## ----------- ##
+
+# func_lalib_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_lalib_p ()
+{
+    test -f "$1" &&
+      $SED -e 4q "$1" 2>/dev/null \
+        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
+}
+
+# func_lalib_unsafe_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function implements the same check as func_lalib_p without
+# resorting to external programs.  To this end, it redirects stdin and
+# closes it afterwards, without saving the original file descriptor.
+# As a safety measure, use it only where a negative result would be
+# fatal anyway.  Works if `file' does not exist.
+func_lalib_unsafe_p ()
+{
+    lalib_p=no
+    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
+	for lalib_p_l in 1 2 3 4
+	do
+	    read lalib_p_line
+	    case "$lalib_p_line" in
+		\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
+	    esac
+	done
+	exec 0<&5 5<&-
+    fi
+    test "$lalib_p" = yes
+}
+
+# func_ltwrapper_script_p file
+# True iff FILE is a libtool wrapper script
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_script_p ()
+{
+    func_lalib_p "$1"
+}
+
+# func_ltwrapper_executable_p file
+# True iff FILE is a libtool wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_executable_p ()
+{
+    func_ltwrapper_exec_suffix=
+    case $1 in
+    *.exe) ;;
+    *) func_ltwrapper_exec_suffix=.exe ;;
+    esac
+    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
+}
+
+# func_ltwrapper_scriptname file
+# Assumes file is an ltwrapper_executable
+# uses $file to determine the appropriate filename for a
+# temporary ltwrapper_script.
+func_ltwrapper_scriptname ()
+{
+    func_dirname_and_basename "$1" "" "."
+    func_stripname '' '.exe' "$func_basename_result"
+    func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
+}
+
+# func_ltwrapper_p file
+# True iff FILE is a libtool wrapper script or wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_p ()
+{
+    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
+}
+
+
+# func_execute_cmds commands fail_cmd
+# Execute tilde-delimited COMMANDS.
+# If FAIL_CMD is given, eval that upon failure.
+# FAIL_CMD may read-access the current command in variable CMD!
+func_execute_cmds ()
+{
+    $opt_debug
+    save_ifs=$IFS; IFS='~'
+    for cmd in $1; do
+      IFS=$save_ifs
+      eval cmd=\"$cmd\"
+      func_show_eval "$cmd" "${2-:}"
+    done
+    IFS=$save_ifs
+}
+
+
+# func_source file
+# Source FILE, adding directory component if necessary.
+# Note that it is not necessary on cygwin/mingw to append a dot to
+# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
+# behavior happens only for exec(3), not for open(2)!  Also, sourcing
+# `FILE.' does not work on cygwin managed mounts.
+func_source ()
+{
+    $opt_debug
+    case $1 in
+    */* | *\\*)	. "$1" ;;
+    *)		. "./$1" ;;
+    esac
+}
+
+
+# func_resolve_sysroot PATH
+# Replace a leading = in PATH with a sysroot.  Store the result into
+# func_resolve_sysroot_result
+func_resolve_sysroot ()
+{
+  func_resolve_sysroot_result=$1
+  case $func_resolve_sysroot_result in
+  =*)
+    func_stripname '=' '' "$func_resolve_sysroot_result"
+    func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
+    ;;
+  esac
+}
+
+# func_replace_sysroot PATH
+# If PATH begins with the sysroot, replace it with = and
+# store the result into func_replace_sysroot_result.
+func_replace_sysroot ()
+{
+  case "$lt_sysroot:$1" in
+  ?*:"$lt_sysroot"*)
+    func_stripname "$lt_sysroot" '' "$1"
+    func_replace_sysroot_result="=$func_stripname_result"
+    ;;
+  *)
+    # Including no sysroot.
+    func_replace_sysroot_result=$1
+    ;;
+  esac
+}
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag ()
+{
+    $opt_debug
+    if test -n "$available_tags" && test -z "$tagname"; then
+      CC_quoted=
+      for arg in $CC; do
+	func_append_quoted CC_quoted "$arg"
+      done
+      CC_expanded=`func_echo_all $CC`
+      CC_quoted_expanded=`func_echo_all $CC_quoted`
+      case $@ in
+      # Blanks in the command may have been stripped by the calling shell,
+      # but not from the CC environment variable when configure was run.
+      " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+      " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
+      # Blanks at the start of $base_compile will cause this to fail
+      # if we don't check for them as well.
+      *)
+	for z in $available_tags; do
+	  if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+	    # Evaluate the configuration.
+	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+	    CC_quoted=
+	    for arg in $CC; do
+	      # Double-quote args containing other shell metacharacters.
+	      func_append_quoted CC_quoted "$arg"
+	    done
+	    CC_expanded=`func_echo_all $CC`
+	    CC_quoted_expanded=`func_echo_all $CC_quoted`
+	    case "$@ " in
+	    " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+	    " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
+	      # The compiler in the base compile command matches
+	      # the one in the tagged configuration.
+	      # Assume this is the tagged configuration we want.
+	      tagname=$z
+	      break
+	      ;;
+	    esac
+	  fi
+	done
+	# If $tagname still isn't set, then no tagged configuration
+	# was found and let the user know that the "--tag" command
+	# line option must be used.
+	if test -z "$tagname"; then
+	  func_echo "unable to infer tagged configuration"
+	  func_fatal_error "specify a tag with \`--tag'"
+#	else
+#	  func_verbose "using $tagname tagged configuration"
+	fi
+	;;
+      esac
+    fi
+}
+
+
+
+# func_write_libtool_object output_name pic_name nonpic_name
+# Create a libtool object file (analogous to a ".la" file),
+# but don't create it if we're doing a dry run.
+func_write_libtool_object ()
+{
+    write_libobj=${1}
+    if test "$build_libtool_libs" = yes; then
+      write_lobj=\'${2}\'
+    else
+      write_lobj=none
+    fi
+
+    if test "$build_old_libs" = yes; then
+      write_oldobj=\'${3}\'
+    else
+      write_oldobj=none
+    fi
+
+    $opt_dry_run || {
+      cat >${write_libobj}T </dev/null`
+    if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
+      func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
+        $SED -e "$lt_sed_naive_backslashify"`
+    else
+      func_convert_core_file_wine_to_w32_result=
+    fi
+  fi
+}
+# end: func_convert_core_file_wine_to_w32
+
+
+# func_convert_core_path_wine_to_w32 ARG
+# Helper function used by path conversion functions when $build is *nix, and
+# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
+# configured wine environment available, with the winepath program in $build's
+# $PATH. Assumes ARG has no leading or trailing path separator characters.
+#
+# ARG is path to be converted from $build format to win32.
+# Result is available in $func_convert_core_path_wine_to_w32_result.
+# Unconvertible file (directory) names in ARG are skipped; if no directory names
+# are convertible, then the result may be empty.
+func_convert_core_path_wine_to_w32 ()
+{
+  $opt_debug
+  # unfortunately, winepath doesn't convert paths, only file names
+  func_convert_core_path_wine_to_w32_result=""
+  if test -n "$1"; then
+    oldIFS=$IFS
+    IFS=:
+    for func_convert_core_path_wine_to_w32_f in $1; do
+      IFS=$oldIFS
+      func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
+      if test -n "$func_convert_core_file_wine_to_w32_result" ; then
+        if test -z "$func_convert_core_path_wine_to_w32_result"; then
+          func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
+        else
+          func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
+        fi
+      fi
+    done
+    IFS=$oldIFS
+  fi
+}
+# end: func_convert_core_path_wine_to_w32
+
+
+# func_cygpath ARGS...
+# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
+# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
+# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
+# (2), returns the Cygwin file name or path in func_cygpath_result (input
+# file name or path is assumed to be in w32 format, as previously converted
+# from $build's *nix or MSYS format). In case (3), returns the w32 file name
+# or path in func_cygpath_result (input file name or path is assumed to be in
+# Cygwin format). Returns an empty string on error.
+#
+# ARGS are passed to cygpath, with the last one being the file name or path to
+# be converted.
+#
+# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
+# environment variable; do not put it in $PATH.
+func_cygpath ()
+{
+  $opt_debug
+  if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
+    func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
+    if test "$?" -ne 0; then
+      # on failure, ensure result is empty
+      func_cygpath_result=
+    fi
+  else
+    func_cygpath_result=
+    func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
+  fi
+}
+#end: func_cygpath
+
+
+# func_convert_core_msys_to_w32 ARG
+# Convert file name or path ARG from MSYS format to w32 format.  Return
+# result in func_convert_core_msys_to_w32_result.
+func_convert_core_msys_to_w32 ()
+{
+  $opt_debug
+  # awkward: cmd appends spaces to result
+  func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
+    $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
+}
+#end: func_convert_core_msys_to_w32
+
+
+# func_convert_file_check ARG1 ARG2
+# Verify that ARG1 (a file name in $build format) was converted to $host
+# format in ARG2. Otherwise, emit an error message, but continue (resetting
+# func_to_host_file_result to ARG1).
+func_convert_file_check ()
+{
+  $opt_debug
+  if test -z "$2" && test -n "$1" ; then
+    func_error "Could not determine host file name corresponding to"
+    func_error "  \`$1'"
+    func_error "Continuing, but uninstalled executables may not work."
+    # Fallback:
+    func_to_host_file_result="$1"
+  fi
+}
+# end func_convert_file_check
+
+
+# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
+# Verify that FROM_PATH (a path in $build format) was converted to $host
+# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
+# func_to_host_file_result to a simplistic fallback value (see below).
+func_convert_path_check ()
+{
+  $opt_debug
+  if test -z "$4" && test -n "$3"; then
+    func_error "Could not determine the host path corresponding to"
+    func_error "  \`$3'"
+    func_error "Continuing, but uninstalled executables may not work."
+    # Fallback.  This is a deliberately simplistic "conversion" and
+    # should not be "improved".  See libtool.info.
+    if test "x$1" != "x$2"; then
+      lt_replace_pathsep_chars="s|$1|$2|g"
+      func_to_host_path_result=`echo "$3" |
+        $SED -e "$lt_replace_pathsep_chars"`
+    else
+      func_to_host_path_result="$3"
+    fi
+  fi
+}
+# end func_convert_path_check
+
+
+# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
+# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
+# and appending REPL if ORIG matches BACKPAT.
+func_convert_path_front_back_pathsep ()
+{
+  $opt_debug
+  case $4 in
+  $1 ) func_to_host_path_result="$3$func_to_host_path_result"
+    ;;
+  esac
+  case $4 in
+  $2 ) func_append func_to_host_path_result "$3"
+    ;;
+  esac
+}
+# end func_convert_path_front_back_pathsep
+
+
+##################################################
+# $build to $host FILE NAME CONVERSION FUNCTIONS #
+##################################################
+# invoked via `$to_host_file_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# Result will be available in $func_to_host_file_result.
+
+
+# func_to_host_file ARG
+# Converts the file name ARG from $build format to $host format. Return result
+# in func_to_host_file_result.
+func_to_host_file ()
+{
+  $opt_debug
+  $to_host_file_cmd "$1"
+}
+# end func_to_host_file
+
+
+# func_to_tool_file ARG LAZY
+# converts the file name ARG from $build format to toolchain format. Return
+# result in func_to_tool_file_result.  If the conversion in use is listed
+# in (the comma separated) LAZY, no conversion takes place.
+func_to_tool_file ()
+{
+  $opt_debug
+  case ,$2, in
+    *,"$to_tool_file_cmd",*)
+      func_to_tool_file_result=$1
+      ;;
+    *)
+      $to_tool_file_cmd "$1"
+      func_to_tool_file_result=$func_to_host_file_result
+      ;;
+  esac
+}
+# end func_to_tool_file
+
+
+# func_convert_file_noop ARG
+# Copy ARG to func_to_host_file_result.
+func_convert_file_noop ()
+{
+  func_to_host_file_result="$1"
+}
+# end func_convert_file_noop
+
+
+# func_convert_file_msys_to_w32 ARG
+# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper.  Returns result in
+# func_to_host_file_result.
+func_convert_file_msys_to_w32 ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    func_convert_core_msys_to_w32 "$1"
+    func_to_host_file_result="$func_convert_core_msys_to_w32_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_w32
+
+
+# func_convert_file_cygwin_to_w32 ARG
+# Convert file name ARG from Cygwin to w32 format.  Returns result in
+# func_to_host_file_result.
+func_convert_file_cygwin_to_w32 ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
+    # LT_CYGPATH in this case.
+    func_to_host_file_result=`cygpath -m "$1"`
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_cygwin_to_w32
+
+
+# func_convert_file_nix_to_w32 ARG
+# Convert file name ARG from *nix to w32 format.  Requires a wine environment
+# and a working winepath. Returns result in func_to_host_file_result.
+func_convert_file_nix_to_w32 ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    func_convert_core_file_wine_to_w32 "$1"
+    func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_w32
+
+
+# func_convert_file_msys_to_cygwin ARG
+# Convert file name ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_file_msys_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    func_convert_core_msys_to_w32 "$1"
+    func_cygpath -u "$func_convert_core_msys_to_w32_result"
+    func_to_host_file_result="$func_cygpath_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_cygwin
+
+
+# func_convert_file_nix_to_cygwin ARG
+# Convert file name ARG from *nix to Cygwin format.  Requires Cygwin installed
+# in a wine environment, working winepath, and LT_CYGPATH set.  Returns result
+# in func_to_host_file_result.
+func_convert_file_nix_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
+    func_convert_core_file_wine_to_w32 "$1"
+    func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
+    func_to_host_file_result="$func_cygpath_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_cygwin
+
+
+#############################################
+# $build to $host PATH CONVERSION FUNCTIONS #
+#############################################
+# invoked via `$to_host_path_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# The result will be available in $func_to_host_path_result.
+#
+# Path separators are also converted from $build format to $host format.  If
+# ARG begins or ends with a path separator character, it is preserved (but
+# converted to $host format) on output.
+#
+# All path conversion functions are named using the following convention:
+#   file name conversion function    : func_convert_file_X_to_Y ()
+#   path conversion function         : func_convert_path_X_to_Y ()
+# where, for any given $build/$host combination the 'X_to_Y' value is the
+# same.  If conversion functions are added for new $build/$host combinations,
+# the two new functions must follow this pattern, or func_init_to_host_path_cmd
+# will break.
+
+
+# func_init_to_host_path_cmd
+# Ensures that function "pointer" variable $to_host_path_cmd is set to the
+# appropriate value, based on the value of $to_host_file_cmd.
+to_host_path_cmd=
+func_init_to_host_path_cmd ()
+{
+  $opt_debug
+  if test -z "$to_host_path_cmd"; then
+    func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
+    to_host_path_cmd="func_convert_path_${func_stripname_result}"
+  fi
+}
+
+
+# func_to_host_path ARG
+# Converts the path ARG from $build format to $host format. Return result
+# in func_to_host_path_result.
+func_to_host_path ()
+{
+  $opt_debug
+  func_init_to_host_path_cmd
+  $to_host_path_cmd "$1"
+}
+# end func_to_host_path
+
+
+# func_convert_path_noop ARG
+# Copy ARG to func_to_host_path_result.
+func_convert_path_noop ()
+{
+  func_to_host_path_result="$1"
+}
+# end func_convert_path_noop
+
+
+# func_convert_path_msys_to_w32 ARG
+# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper.  Returns result in
+# func_to_host_path_result.
+func_convert_path_msys_to_w32 ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # Remove leading and trailing path separator characters from ARG.  MSYS
+    # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
+    # and winepath ignores them completely.
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+    func_to_host_path_result="$func_convert_core_msys_to_w32_result"
+    func_convert_path_check : ";" \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+  fi
+}
+# end func_convert_path_msys_to_w32
+
+
+# func_convert_path_cygwin_to_w32 ARG
+# Convert path ARG from Cygwin to w32 format.  Returns result in
+# func_to_host_file_result.
+func_convert_path_cygwin_to_w32 ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # See func_convert_path_msys_to_w32:
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
+    func_convert_path_check : ";" \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+  fi
+}
+# end func_convert_path_cygwin_to_w32
+
+
+# func_convert_path_nix_to_w32 ARG
+# Convert path ARG from *nix to w32 format.  Requires a wine environment and
+# a working winepath.  Returns result in func_to_host_file_result.
+func_convert_path_nix_to_w32 ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # See func_convert_path_msys_to_w32:
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+    func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
+    func_convert_path_check : ";" \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+  fi
+}
+# end func_convert_path_nix_to_w32
+
+
+# func_convert_path_msys_to_cygwin ARG
+# Convert path ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_path_msys_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # See func_convert_path_msys_to_w32:
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+    func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
+    func_to_host_path_result="$func_cygpath_result"
+    func_convert_path_check : : \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+  fi
+}
+# end func_convert_path_msys_to_cygwin
+
+
+# func_convert_path_nix_to_cygwin ARG
+# Convert path ARG from *nix to Cygwin format.  Requires Cygwin installed in a
+# a wine environment, working winepath, and LT_CYGPATH set.  Returns result in
+# func_to_host_file_result.
+func_convert_path_nix_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # Remove leading and trailing path separator characters from
+    # ARG. msys behavior is inconsistent here, cygpath turns them
+    # into '.;' and ';.', and winepath ignores them completely.
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+    func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
+    func_to_host_path_result="$func_cygpath_result"
+    func_convert_path_check : : \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+  fi
+}
+# end func_convert_path_nix_to_cygwin
+
+
+# func_mode_compile arg...
+func_mode_compile ()
+{
+    $opt_debug
+    # Get the compilation command and the source file.
+    base_compile=
+    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
+    suppress_opt=yes
+    suppress_output=
+    arg_mode=normal
+    libobj=
+    later=
+    pie_flag=
+
+    for arg
+    do
+      case $arg_mode in
+      arg  )
+	# do not "continue".  Instead, add this to base_compile
+	lastarg="$arg"
+	arg_mode=normal
+	;;
+
+      target )
+	libobj="$arg"
+	arg_mode=normal
+	continue
+	;;
+
+      normal )
+	# Accept any command-line options.
+	case $arg in
+	-o)
+	  test -n "$libobj" && \
+	    func_fatal_error "you cannot specify \`-o' more than once"
+	  arg_mode=target
+	  continue
+	  ;;
+
+	-pie | -fpie | -fPIE)
+          func_append pie_flag " $arg"
+	  continue
+	  ;;
+
+	-shared | -static | -prefer-pic | -prefer-non-pic)
+	  func_append later " $arg"
+	  continue
+	  ;;
+
+	-no-suppress)
+	  suppress_opt=no
+	  continue
+	  ;;
+
+	-Xcompiler)
+	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
+	  continue      #  The current "srcfile" will either be retained or
+	  ;;            #  replaced later.  I would guess that would be a bug.
+
+	-Wc,*)
+	  func_stripname '-Wc,' '' "$arg"
+	  args=$func_stripname_result
+	  lastarg=
+	  save_ifs="$IFS"; IFS=','
+	  for arg in $args; do
+	    IFS="$save_ifs"
+	    func_append_quoted lastarg "$arg"
+	  done
+	  IFS="$save_ifs"
+	  func_stripname ' ' '' "$lastarg"
+	  lastarg=$func_stripname_result
+
+	  # Add the arguments to base_compile.
+	  func_append base_compile " $lastarg"
+	  continue
+	  ;;
+
+	*)
+	  # Accept the current argument as the source file.
+	  # The previous "srcfile" becomes the current argument.
+	  #
+	  lastarg="$srcfile"
+	  srcfile="$arg"
+	  ;;
+	esac  #  case $arg
+	;;
+      esac    #  case $arg_mode
+
+      # Aesthetically quote the previous argument.
+      func_append_quoted base_compile "$lastarg"
+    done # for arg
+
+    case $arg_mode in
+    arg)
+      func_fatal_error "you must specify an argument for -Xcompile"
+      ;;
+    target)
+      func_fatal_error "you must specify a target with \`-o'"
+      ;;
+    *)
+      # Get the name of the library object.
+      test -z "$libobj" && {
+	func_basename "$srcfile"
+	libobj="$func_basename_result"
+      }
+      ;;
+    esac
+
+    # Recognize several different file suffixes.
+    # If the user specifies -o file.o, it is replaced with file.lo
+    case $libobj in
+    *.[cCFSifmso] | \
+    *.ada | *.adb | *.ads | *.asm | \
+    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
+    *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
+      func_xform "$libobj"
+      libobj=$func_xform_result
+      ;;
+    esac
+
+    case $libobj in
+    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
+    *)
+      func_fatal_error "cannot determine name of library object from \`$libobj'"
+      ;;
+    esac
+
+    func_infer_tag $base_compile
+
+    for arg in $later; do
+      case $arg in
+      -shared)
+	test "$build_libtool_libs" != yes && \
+	  func_fatal_configuration "can not build a shared library"
+	build_old_libs=no
+	continue
+	;;
+
+      -static)
+	build_libtool_libs=no
+	build_old_libs=yes
+	continue
+	;;
+
+      -prefer-pic)
+	pic_mode=yes
+	continue
+	;;
+
+      -prefer-non-pic)
+	pic_mode=no
+	continue
+	;;
+      esac
+    done
+
+    func_quote_for_eval "$libobj"
+    test "X$libobj" != "X$func_quote_for_eval_result" \
+      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'	 &()|`$[]' \
+      && func_warning "libobj name \`$libobj' may not contain shell special characters."
+    func_dirname_and_basename "$obj" "/" ""
+    objname="$func_basename_result"
+    xdir="$func_dirname_result"
+    lobj=${xdir}$objdir/$objname
+
+    test -z "$base_compile" && \
+      func_fatal_help "you must specify a compilation command"
+
+    # Delete any leftover library objects.
+    if test "$build_old_libs" = yes; then
+      removelist="$obj $lobj $libobj ${libobj}T"
+    else
+      removelist="$lobj $libobj ${libobj}T"
+    fi
+
+    # On Cygwin there's no "real" PIC flag so we must build both object types
+    case $host_os in
+    cygwin* | mingw* | pw32* | os2* | cegcc*)
+      pic_mode=default
+      ;;
+    esac
+    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+      # non-PIC code in shared libraries is not supported
+      pic_mode=default
+    fi
+
+    # Calculate the filename of the output object if compiler does
+    # not support -o with -c
+    if test "$compiler_c_o" = no; then
+      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
+      lockfile="$output_obj.lock"
+    else
+      output_obj=
+      need_locks=no
+      lockfile=
+    fi
+
+    # Lock this critical section if it is needed
+    # We use this script file to make the link, it avoids creating a new file
+    if test "$need_locks" = yes; then
+      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+	func_echo "Waiting for $lockfile to be removed"
+	sleep 2
+      done
+    elif test "$need_locks" = warn; then
+      if test -f "$lockfile"; then
+	$ECHO "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$opt_dry_run || $RM $removelist
+	exit $EXIT_FAILURE
+      fi
+      func_append removelist " $output_obj"
+      $ECHO "$srcfile" > "$lockfile"
+    fi
+
+    $opt_dry_run || $RM $removelist
+    func_append removelist " $lockfile"
+    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
+
+    func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
+    srcfile=$func_to_tool_file_result
+    func_quote_for_eval "$srcfile"
+    qsrcfile=$func_quote_for_eval_result
+
+    # Only build a PIC object if we are building libtool libraries.
+    if test "$build_libtool_libs" = yes; then
+      # Without this assignment, base_compile gets emptied.
+      fbsd_hideous_sh_bug=$base_compile
+
+      if test "$pic_mode" != no; then
+	command="$base_compile $qsrcfile $pic_flag"
+      else
+	# Don't build PIC code
+	command="$base_compile $qsrcfile"
+      fi
+
+      func_mkdir_p "$xdir$objdir"
+
+      if test -z "$output_obj"; then
+	# Place PIC objects in $objdir
+	func_append command " -o $lobj"
+      fi
+
+      func_show_eval_locale "$command"	\
+          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
+
+      if test "$need_locks" = warn &&
+	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+	$ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$opt_dry_run || $RM $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed, then go on to compile the next one
+      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+	func_show_eval '$MV "$output_obj" "$lobj"' \
+	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+      fi
+
+      # Allow error messages only from the first compilation.
+      if test "$suppress_opt" = yes; then
+	suppress_output=' >/dev/null 2>&1'
+      fi
+    fi
+
+    # Only build a position-dependent object if we build old libraries.
+    if test "$build_old_libs" = yes; then
+      if test "$pic_mode" != yes; then
+	# Don't build PIC code
+	command="$base_compile $qsrcfile$pie_flag"
+      else
+	command="$base_compile $qsrcfile $pic_flag"
+      fi
+      if test "$compiler_c_o" = yes; then
+	func_append command " -o $obj"
+      fi
+
+      # Suppress compiler output if we already did a PIC compilation.
+      func_append command "$suppress_output"
+      func_show_eval_locale "$command" \
+        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
+
+      if test "$need_locks" = warn &&
+	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+	$ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$opt_dry_run || $RM $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed
+      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+	func_show_eval '$MV "$output_obj" "$obj"' \
+	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+      fi
+    fi
+
+    $opt_dry_run || {
+      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
+
+      # Unlock the critical section if it was locked
+      if test "$need_locks" != no; then
+	removelist=$lockfile
+        $RM "$lockfile"
+      fi
+    }
+
+    exit $EXIT_SUCCESS
+}
+
+$opt_help || {
+  test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
+}
+
+func_mode_help ()
+{
+    # We need to display help for each of the modes.
+    case $opt_mode in
+      "")
+        # Generic help is extracted from the usage comments
+        # at the start of this file.
+        func_help
+        ;;
+
+      clean)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+        ;;
+
+      compile)
+      $ECHO \
+"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
+  -no-suppress      do not suppress compiler output for multiple passes
+  -prefer-pic       try to build PIC objects only
+  -prefer-non-pic   try to build non-PIC objects only
+  -shared           do not build a \`.o' file suitable for static linking
+  -static           only build a \`.o' file suitable for static linking
+  -Wc,FLAG          pass FLAG directly to the compiler
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+        ;;
+
+      execute)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+  -dlopen FILE      add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+        ;;
+
+      finish)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges.  Use
+the \`--dry-run' option if you just want to see what would be executed."
+        ;;
+
+      install)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command.  The first component should be
+either the \`install' or \`cp' program.
+
+The following components of INSTALL-COMMAND are treated specially:
+
+  -inst-prefix-dir PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+        ;;
+
+      link)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+  -all-static       do not do any dynamic linking at all
+  -avoid-version    do not add a version suffix if possible
+  -bindir BINDIR    specify path to binaries directory (for systems where
+                    libraries must be found in the PATH setting at runtime)
+  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
+  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
+  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+  -export-symbols SYMFILE
+                    try to export only the symbols listed in SYMFILE
+  -export-symbols-regex REGEX
+                    try to export only the symbols matching REGEX
+  -LLIBDIR          search LIBDIR for required installed libraries
+  -lNAME            OUTPUT-FILE requires the installed library libNAME
+  -module           build a library that can dlopened
+  -no-fast-install  disable the fast-install mode
+  -no-install       link a not-installable executable
+  -no-undefined     declare that a library does not refer to external symbols
+  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
+  -objectlist FILE  Use a list of object files found in FILE to specify objects
+  -precious-files-regex REGEX
+                    don't remove output files matching REGEX
+  -release RELEASE  specify package release information
+  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
+  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
+  -shared           only do dynamic linking of libtool libraries
+  -shrext SUFFIX    override the standard shared library file extension
+  -static           do not do any dynamic linking of uninstalled libtool libraries
+  -static-libtool-libs
+                    do not do any dynamic linking of libtool libraries
+  -version-info CURRENT[:REVISION[:AGE]]
+                    specify library version info [each variable defaults to 0]
+  -weak LIBNAME     declare that the target provides the LIBNAME interface
+  -Wc,FLAG
+  -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler
+  -Wl,FLAG
+  -Xlinker FLAG     pass linker-specific FLAG directly to the linker
+  -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename.  Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+        ;;
+
+      uninstall)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+        ;;
+
+      *)
+        func_fatal_help "invalid operation mode \`$opt_mode'"
+        ;;
+    esac
+
+    echo
+    $ECHO "Try \`$progname --help' for more information about other modes."
+}
+
+# Now that we've collected a possible --mode arg, show help if necessary
+if $opt_help; then
+  if test "$opt_help" = :; then
+    func_mode_help
+  else
+    {
+      func_help noexit
+      for opt_mode in compile link execute install finish uninstall clean; do
+	func_mode_help
+      done
+    } | sed -n '1p; 2,$s/^Usage:/  or: /p'
+    {
+      func_help noexit
+      for opt_mode in compile link execute install finish uninstall clean; do
+	echo
+	func_mode_help
+      done
+    } |
+    sed '1d
+      /^When reporting/,/^Report/{
+	H
+	d
+      }
+      $x
+      /information about other modes/d
+      /more detailed .*MODE/d
+      s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
+  fi
+  exit $?
+fi
+
+
+# func_mode_execute arg...
+func_mode_execute ()
+{
+    $opt_debug
+    # The first argument is the command name.
+    cmd="$nonopt"
+    test -z "$cmd" && \
+      func_fatal_help "you must specify a COMMAND"
+
+    # Handle -dlopen flags immediately.
+    for file in $opt_dlopen; do
+      test -f "$file" \
+	|| func_fatal_help "\`$file' is not a file"
+
+      dir=
+      case $file in
+      *.la)
+	func_resolve_sysroot "$file"
+	file=$func_resolve_sysroot_result
+
+	# Check to see that this really is a libtool archive.
+	func_lalib_unsafe_p "$file" \
+	  || func_fatal_help "\`$lib' is not a valid libtool archive"
+
+	# Read the libtool library.
+	dlname=
+	library_names=
+	func_source "$file"
+
+	# Skip this library if it cannot be dlopened.
+	if test -z "$dlname"; then
+	  # Warn if it was a shared library.
+	  test -n "$library_names" && \
+	    func_warning "\`$file' was not linked with \`-export-dynamic'"
+	  continue
+	fi
+
+	func_dirname "$file" "" "."
+	dir="$func_dirname_result"
+
+	if test -f "$dir/$objdir/$dlname"; then
+	  func_append dir "/$objdir"
+	else
+	  if test ! -f "$dir/$dlname"; then
+	    func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
+	  fi
+	fi
+	;;
+
+      *.lo)
+	# Just add the directory containing the .lo file.
+	func_dirname "$file" "" "."
+	dir="$func_dirname_result"
+	;;
+
+      *)
+	func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
+	continue
+	;;
+      esac
+
+      # Get the absolute pathname.
+      absdir=`cd "$dir" && pwd`
+      test -n "$absdir" && dir="$absdir"
+
+      # Now add the directory to shlibpath_var.
+      if eval "test -z \"\$$shlibpath_var\""; then
+	eval "$shlibpath_var=\"\$dir\""
+      else
+	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+      fi
+    done
+
+    # This variable tells wrapper scripts just to set shlibpath_var
+    # rather than running their programs.
+    libtool_execute_magic="$magic"
+
+    # Check if any of the arguments is a wrapper script.
+    args=
+    for file
+    do
+      case $file in
+      -* | *.la | *.lo ) ;;
+      *)
+	# Do a test to see if this is really a libtool program.
+	if func_ltwrapper_script_p "$file"; then
+	  func_source "$file"
+	  # Transform arg to wrapped name.
+	  file="$progdir/$program"
+	elif func_ltwrapper_executable_p "$file"; then
+	  func_ltwrapper_scriptname "$file"
+	  func_source "$func_ltwrapper_scriptname_result"
+	  # Transform arg to wrapped name.
+	  file="$progdir/$program"
+	fi
+	;;
+      esac
+      # Quote arguments (to preserve shell metacharacters).
+      func_append_quoted args "$file"
+    done
+
+    if test "X$opt_dry_run" = Xfalse; then
+      if test -n "$shlibpath_var"; then
+	# Export the shlibpath_var.
+	eval "export $shlibpath_var"
+      fi
+
+      # Restore saved environment variables
+      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+      do
+	eval "if test \"\${save_$lt_var+set}\" = set; then
+                $lt_var=\$save_$lt_var; export $lt_var
+	      else
+		$lt_unset $lt_var
+	      fi"
+      done
+
+      # Now prepare to actually exec the command.
+      exec_cmd="\$cmd$args"
+    else
+      # Display what would be done.
+      if test -n "$shlibpath_var"; then
+	eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
+	echo "export $shlibpath_var"
+      fi
+      $ECHO "$cmd$args"
+      exit $EXIT_SUCCESS
+    fi
+}
+
+test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
+
+
+# func_mode_finish arg...
+func_mode_finish ()
+{
+    $opt_debug
+    libs=
+    libdirs=
+    admincmds=
+
+    for opt in "$nonopt" ${1+"$@"}
+    do
+      if test -d "$opt"; then
+	func_append libdirs " $opt"
+
+      elif test -f "$opt"; then
+	if func_lalib_unsafe_p "$opt"; then
+	  func_append libs " $opt"
+	else
+	  func_warning "\`$opt' is not a valid libtool archive"
+	fi
+
+      else
+	func_fatal_error "invalid argument \`$opt'"
+      fi
+    done
+
+    if test -n "$libs"; then
+      if test -n "$lt_sysroot"; then
+        sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
+        sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
+      else
+        sysroot_cmd=
+      fi
+
+      # Remove sysroot references
+      if $opt_dry_run; then
+        for lib in $libs; do
+          echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
+        done
+      else
+        tmpdir=`func_mktempdir`
+        for lib in $libs; do
+	  sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
+	    > $tmpdir/tmp-la
+	  mv -f $tmpdir/tmp-la $lib
+	done
+        ${RM}r "$tmpdir"
+      fi
+    fi
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      for libdir in $libdirs; do
+	if test -n "$finish_cmds"; then
+	  # Do each command in the finish commands.
+	  func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
+'"$cmd"'"'
+	fi
+	if test -n "$finish_eval"; then
+	  # Do the single finish_eval.
+	  eval cmds=\"$finish_eval\"
+	  $opt_dry_run || eval "$cmds" || func_append admincmds "
+       $cmds"
+	fi
+      done
+    fi
+
+    # Exit here if they wanted silent mode.
+    $opt_silent && exit $EXIT_SUCCESS
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      echo "----------------------------------------------------------------------"
+      echo "Libraries have been installed in:"
+      for libdir in $libdirs; do
+	$ECHO "   $libdir"
+      done
+      echo
+      echo "If you ever happen to want to link against installed libraries"
+      echo "in a given directory, LIBDIR, you must either use libtool, and"
+      echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+      echo "flag during linking and do at least one of the following:"
+      if test -n "$shlibpath_var"; then
+	echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+	echo "     during execution"
+      fi
+      if test -n "$runpath_var"; then
+	echo "   - add LIBDIR to the \`$runpath_var' environment variable"
+	echo "     during linking"
+      fi
+      if test -n "$hardcode_libdir_flag_spec"; then
+	libdir=LIBDIR
+	eval flag=\"$hardcode_libdir_flag_spec\"
+
+	$ECHO "   - use the \`$flag' linker flag"
+      fi
+      if test -n "$admincmds"; then
+	$ECHO "   - have your system administrator run these commands:$admincmds"
+      fi
+      if test -f /etc/ld.so.conf; then
+	echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+      fi
+      echo
+
+      echo "See any operating system documentation about shared libraries for"
+      case $host in
+	solaris2.[6789]|solaris2.1[0-9])
+	  echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
+	  echo "pages."
+	  ;;
+	*)
+	  echo "more information, such as the ld(1) and ld.so(8) manual pages."
+	  ;;
+      esac
+      echo "----------------------------------------------------------------------"
+    fi
+    exit $EXIT_SUCCESS
+}
+
+test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
+
+
+# func_mode_install arg...
+func_mode_install ()
+{
+    $opt_debug
+    # There may be an optional sh(1) argument at the beginning of
+    # install_prog (especially on Windows NT).
+    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+       # Allow the use of GNU shtool's install command.
+       case $nonopt in *shtool*) :;; *) false;; esac; then
+      # Aesthetically quote it.
+      func_quote_for_eval "$nonopt"
+      install_prog="$func_quote_for_eval_result "
+      arg=$1
+      shift
+    else
+      install_prog=
+      arg=$nonopt
+    fi
+
+    # The real first argument should be the name of the installation program.
+    # Aesthetically quote it.
+    func_quote_for_eval "$arg"
+    func_append install_prog "$func_quote_for_eval_result"
+    install_shared_prog=$install_prog
+    case " $install_prog " in
+      *[\\\ /]cp\ *) install_cp=: ;;
+      *) install_cp=false ;;
+    esac
+
+    # We need to accept at least all the BSD install flags.
+    dest=
+    files=
+    opts=
+    prev=
+    install_type=
+    isdir=no
+    stripme=
+    no_mode=:
+    for arg
+    do
+      arg2=
+      if test -n "$dest"; then
+	func_append files " $dest"
+	dest=$arg
+	continue
+      fi
+
+      case $arg in
+      -d) isdir=yes ;;
+      -f)
+	if $install_cp; then :; else
+	  prev=$arg
+	fi
+	;;
+      -g | -m | -o)
+	prev=$arg
+	;;
+      -s)
+	stripme=" -s"
+	continue
+	;;
+      -*)
+	;;
+      *)
+	# If the previous option needed an argument, then skip it.
+	if test -n "$prev"; then
+	  if test "x$prev" = x-m && test -n "$install_override_mode"; then
+	    arg2=$install_override_mode
+	    no_mode=false
+	  fi
+	  prev=
+	else
+	  dest=$arg
+	  continue
+	fi
+	;;
+      esac
+
+      # Aesthetically quote the argument.
+      func_quote_for_eval "$arg"
+      func_append install_prog " $func_quote_for_eval_result"
+      if test -n "$arg2"; then
+	func_quote_for_eval "$arg2"
+      fi
+      func_append install_shared_prog " $func_quote_for_eval_result"
+    done
+
+    test -z "$install_prog" && \
+      func_fatal_help "you must specify an install program"
+
+    test -n "$prev" && \
+      func_fatal_help "the \`$prev' option requires an argument"
+
+    if test -n "$install_override_mode" && $no_mode; then
+      if $install_cp; then :; else
+	func_quote_for_eval "$install_override_mode"
+	func_append install_shared_prog " -m $func_quote_for_eval_result"
+      fi
+    fi
+
+    if test -z "$files"; then
+      if test -z "$dest"; then
+	func_fatal_help "no file or destination specified"
+      else
+	func_fatal_help "you must specify a destination"
+      fi
+    fi
+
+    # Strip any trailing slash from the destination.
+    func_stripname '' '/' "$dest"
+    dest=$func_stripname_result
+
+    # Check to see that the destination is a directory.
+    test -d "$dest" && isdir=yes
+    if test "$isdir" = yes; then
+      destdir="$dest"
+      destname=
+    else
+      func_dirname_and_basename "$dest" "" "."
+      destdir="$func_dirname_result"
+      destname="$func_basename_result"
+
+      # Not a directory, so check to see that there is only one file specified.
+      set dummy $files; shift
+      test "$#" -gt 1 && \
+	func_fatal_help "\`$dest' is not a directory"
+    fi
+    case $destdir in
+    [\\/]* | [A-Za-z]:[\\/]*) ;;
+    *)
+      for file in $files; do
+	case $file in
+	*.lo) ;;
+	*)
+	  func_fatal_help "\`$destdir' must be an absolute directory name"
+	  ;;
+	esac
+      done
+      ;;
+    esac
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    staticlibs=
+    future_libdirs=
+    current_libdirs=
+    for file in $files; do
+
+      # Do each installation.
+      case $file in
+      *.$libext)
+	# Do the static libraries later.
+	func_append staticlibs " $file"
+	;;
+
+      *.la)
+	func_resolve_sysroot "$file"
+	file=$func_resolve_sysroot_result
+
+	# Check to see that this really is a libtool archive.
+	func_lalib_unsafe_p "$file" \
+	  || func_fatal_help "\`$file' is not a valid libtool archive"
+
+	library_names=
+	old_library=
+	relink_command=
+	func_source "$file"
+
+	# Add the libdir to current_libdirs if it is the destination.
+	if test "X$destdir" = "X$libdir"; then
+	  case "$current_libdirs " in
+	  *" $libdir "*) ;;
+	  *) func_append current_libdirs " $libdir" ;;
+	  esac
+	else
+	  # Note the libdir as a future libdir.
+	  case "$future_libdirs " in
+	  *" $libdir "*) ;;
+	  *) func_append future_libdirs " $libdir" ;;
+	  esac
+	fi
+
+	func_dirname "$file" "/" ""
+	dir="$func_dirname_result"
+	func_append dir "$objdir"
+
+	if test -n "$relink_command"; then
+	  # Determine the prefix the user has applied to our future dir.
+	  inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
+
+	  # Don't allow the user to place us outside of our expected
+	  # location b/c this prevents finding dependent libraries that
+	  # are installed to the same prefix.
+	  # At present, this check doesn't affect windows .dll's that
+	  # are installed into $libdir/../bin (currently, that works fine)
+	  # but it's something to keep an eye on.
+	  test "$inst_prefix_dir" = "$destdir" && \
+	    func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
+
+	  if test -n "$inst_prefix_dir"; then
+	    # Stick the inst_prefix_dir data into the link command.
+	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+	  else
+	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+	  fi
+
+	  func_warning "relinking \`$file'"
+	  func_show_eval "$relink_command" \
+	    'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
+	fi
+
+	# See the names of the shared library.
+	set dummy $library_names; shift
+	if test -n "$1"; then
+	  realname="$1"
+	  shift
+
+	  srcname="$realname"
+	  test -n "$relink_command" && srcname="$realname"T
+
+	  # Install the shared library and build the symlinks.
+	  func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
+	      'exit $?'
+	  tstripme="$stripme"
+	  case $host_os in
+	  cygwin* | mingw* | pw32* | cegcc*)
+	    case $realname in
+	    *.dll.a)
+	      tstripme=""
+	      ;;
+	    esac
+	    ;;
+	  esac
+	  if test -n "$tstripme" && test -n "$striplib"; then
+	    func_show_eval "$striplib $destdir/$realname" 'exit $?'
+	  fi
+
+	  if test "$#" -gt 0; then
+	    # Delete the old symlinks, and create new ones.
+	    # Try `ln -sf' first, because the `ln' binary might depend on
+	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
+	    # so we also need to try rm && ln -s.
+	    for linkname
+	    do
+	      test "$linkname" != "$realname" \
+		&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
+	    done
+	  fi
+
+	  # Do each command in the postinstall commands.
+	  lib="$destdir/$realname"
+	  func_execute_cmds "$postinstall_cmds" 'exit $?'
+	fi
+
+	# Install the pseudo-library for information purposes.
+	func_basename "$file"
+	name="$func_basename_result"
+	instname="$dir/$name"i
+	func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
+
+	# Maybe install the static library, too.
+	test -n "$old_library" && func_append staticlibs " $dir/$old_library"
+	;;
+
+      *.lo)
+	# Install (i.e. copy) a libtool object.
+
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  func_basename "$file"
+	  destfile="$func_basename_result"
+	  destfile="$destdir/$destfile"
+	fi
+
+	# Deduce the name of the destination old-style object file.
+	case $destfile in
+	*.lo)
+	  func_lo2o "$destfile"
+	  staticdest=$func_lo2o_result
+	  ;;
+	*.$objext)
+	  staticdest="$destfile"
+	  destfile=
+	  ;;
+	*)
+	  func_fatal_help "cannot copy a libtool object to \`$destfile'"
+	  ;;
+	esac
+
+	# Install the libtool object if requested.
+	test -n "$destfile" && \
+	  func_show_eval "$install_prog $file $destfile" 'exit $?'
+
+	# Install the old object if enabled.
+	if test "$build_old_libs" = yes; then
+	  # Deduce the name of the old-style object file.
+	  func_lo2o "$file"
+	  staticobj=$func_lo2o_result
+	  func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
+	fi
+	exit $EXIT_SUCCESS
+	;;
+
+      *)
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  func_basename "$file"
+	  destfile="$func_basename_result"
+	  destfile="$destdir/$destfile"
+	fi
+
+	# If the file is missing, and there is a .exe on the end, strip it
+	# because it is most likely a libtool script we actually want to
+	# install
+	stripped_ext=""
+	case $file in
+	  *.exe)
+	    if test ! -f "$file"; then
+	      func_stripname '' '.exe' "$file"
+	      file=$func_stripname_result
+	      stripped_ext=".exe"
+	    fi
+	    ;;
+	esac
+
+	# Do a test to see if this is really a libtool program.
+	case $host in
+	*cygwin* | *mingw*)
+	    if func_ltwrapper_executable_p "$file"; then
+	      func_ltwrapper_scriptname "$file"
+	      wrapper=$func_ltwrapper_scriptname_result
+	    else
+	      func_stripname '' '.exe' "$file"
+	      wrapper=$func_stripname_result
+	    fi
+	    ;;
+	*)
+	    wrapper=$file
+	    ;;
+	esac
+	if func_ltwrapper_script_p "$wrapper"; then
+	  notinst_deplibs=
+	  relink_command=
+
+	  func_source "$wrapper"
+
+	  # Check the variables that should have been set.
+	  test -z "$generated_by_libtool_version" && \
+	    func_fatal_error "invalid libtool wrapper script \`$wrapper'"
+
+	  finalize=yes
+	  for lib in $notinst_deplibs; do
+	    # Check to see that each library is installed.
+	    libdir=
+	    if test -f "$lib"; then
+	      func_source "$lib"
+	    fi
+	    libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
+	    if test -n "$libdir" && test ! -f "$libfile"; then
+	      func_warning "\`$lib' has not been installed in \`$libdir'"
+	      finalize=no
+	    fi
+	  done
+
+	  relink_command=
+	  func_source "$wrapper"
+
+	  outputname=
+	  if test "$fast_install" = no && test -n "$relink_command"; then
+	    $opt_dry_run || {
+	      if test "$finalize" = yes; then
+	        tmpdir=`func_mktempdir`
+		func_basename "$file$stripped_ext"
+		file="$func_basename_result"
+	        outputname="$tmpdir/$file"
+	        # Replace the output file specification.
+	        relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
+
+	        $opt_silent || {
+	          func_quote_for_expand "$relink_command"
+		  eval "func_echo $func_quote_for_expand_result"
+	        }
+	        if eval "$relink_command"; then :
+	          else
+		  func_error "error: relink \`$file' with the above command before installing it"
+		  $opt_dry_run || ${RM}r "$tmpdir"
+		  continue
+	        fi
+	        file="$outputname"
+	      else
+	        func_warning "cannot relink \`$file'"
+	      fi
+	    }
+	  else
+	    # Install the binary that we compiled earlier.
+	    file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
+	  fi
+	fi
+
+	# remove .exe since cygwin /usr/bin/install will append another
+	# one anyway
+	case $install_prog,$host in
+	*/usr/bin/install*,*cygwin*)
+	  case $file:$destfile in
+	  *.exe:*.exe)
+	    # this is ok
+	    ;;
+	  *.exe:*)
+	    destfile=$destfile.exe
+	    ;;
+	  *:*.exe)
+	    func_stripname '' '.exe' "$destfile"
+	    destfile=$func_stripname_result
+	    ;;
+	  esac
+	  ;;
+	esac
+	func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
+	$opt_dry_run || if test -n "$outputname"; then
+	  ${RM}r "$tmpdir"
+	fi
+	;;
+      esac
+    done
+
+    for file in $staticlibs; do
+      func_basename "$file"
+      name="$func_basename_result"
+
+      # Set up the ranlib parameters.
+      oldlib="$destdir/$name"
+      func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
+      tool_oldlib=$func_to_tool_file_result
+
+      func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
+
+      if test -n "$stripme" && test -n "$old_striplib"; then
+	func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
+      fi
+
+      # Do each command in the postinstall commands.
+      func_execute_cmds "$old_postinstall_cmds" 'exit $?'
+    done
+
+    test -n "$future_libdirs" && \
+      func_warning "remember to run \`$progname --finish$future_libdirs'"
+
+    if test -n "$current_libdirs"; then
+      # Maybe just do a dry run.
+      $opt_dry_run && current_libdirs=" -n$current_libdirs"
+      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+    else
+      exit $EXIT_SUCCESS
+    fi
+}
+
+test "$opt_mode" = install && func_mode_install ${1+"$@"}
+
+
+# func_generate_dlsyms outputname originator pic_p
+# Extract symbols from dlprefiles and create ${outputname}S.o with
+# a dlpreopen symbol table.
+func_generate_dlsyms ()
+{
+    $opt_debug
+    my_outputname="$1"
+    my_originator="$2"
+    my_pic_p="${3-no}"
+    my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
+    my_dlsyms=
+
+    if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+      if test -n "$NM" && test -n "$global_symbol_pipe"; then
+	my_dlsyms="${my_outputname}S.c"
+      else
+	func_error "not configured to extract global symbols from dlpreopened files"
+      fi
+    fi
+
+    if test -n "$my_dlsyms"; then
+      case $my_dlsyms in
+      "") ;;
+      *.c)
+	# Discover the nlist of each of the dlfiles.
+	nlist="$output_objdir/${my_outputname}.nm"
+
+	func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
+
+	# Parse the name list into a source file.
+	func_verbose "creating $output_objdir/$my_dlsyms"
+
+	$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
+/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
+/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
+#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
+#endif
+
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
+/* External symbol declarations for the compiler. */\
+"
+
+	if test "$dlself" = yes; then
+	  func_verbose "generating symbol list for \`$output'"
+
+	  $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
+
+	  # Add our own program objects to the symbol list.
+	  progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+	  for progfile in $progfiles; do
+	    func_to_tool_file "$progfile" func_convert_file_msys_to_w32
+	    func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
+	    $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
+	  done
+
+	  if test -n "$exclude_expsyms"; then
+	    $opt_dry_run || {
+	      eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+	      eval '$MV "$nlist"T "$nlist"'
+	    }
+	  fi
+
+	  if test -n "$export_symbols_regex"; then
+	    $opt_dry_run || {
+	      eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+	      eval '$MV "$nlist"T "$nlist"'
+	    }
+	  fi
+
+	  # Prepare the list of exported symbols
+	  if test -z "$export_symbols"; then
+	    export_symbols="$output_objdir/$outputname.exp"
+	    $opt_dry_run || {
+	      $RM $export_symbols
+	      eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+	      case $host in
+	      *cygwin* | *mingw* | *cegcc* )
+                eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+                eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+	        ;;
+	      esac
+	    }
+	  else
+	    $opt_dry_run || {
+	      eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+	      eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+	      eval '$MV "$nlist"T "$nlist"'
+	      case $host in
+	        *cygwin* | *mingw* | *cegcc* )
+	          eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+	          eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+	          ;;
+	      esac
+	    }
+	  fi
+	fi
+
+	for dlprefile in $dlprefiles; do
+	  func_verbose "extracting global C symbols from \`$dlprefile'"
+	  func_basename "$dlprefile"
+	  name="$func_basename_result"
+          case $host in
+	    *cygwin* | *mingw* | *cegcc* )
+	      # if an import library, we need to obtain dlname
+	      if func_win32_import_lib_p "$dlprefile"; then
+	        func_tr_sh "$dlprefile"
+	        eval "curr_lafile=\$libfile_$func_tr_sh_result"
+	        dlprefile_dlbasename=""
+	        if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
+	          # Use subshell, to avoid clobbering current variable values
+	          dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
+	          if test -n "$dlprefile_dlname" ; then
+	            func_basename "$dlprefile_dlname"
+	            dlprefile_dlbasename="$func_basename_result"
+	          else
+	            # no lafile. user explicitly requested -dlpreopen .
+	            $sharedlib_from_linklib_cmd "$dlprefile"
+	            dlprefile_dlbasename=$sharedlib_from_linklib_result
+	          fi
+	        fi
+	        $opt_dry_run || {
+	          if test -n "$dlprefile_dlbasename" ; then
+	            eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
+	          else
+	            func_warning "Could not compute DLL name from $name"
+	            eval '$ECHO ": $name " >> "$nlist"'
+	          fi
+	          func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+	          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
+	            $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
+	        }
+	      else # not an import lib
+	        $opt_dry_run || {
+	          eval '$ECHO ": $name " >> "$nlist"'
+	          func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+	          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+	        }
+	      fi
+	    ;;
+	    *)
+	      $opt_dry_run || {
+	        eval '$ECHO ": $name " >> "$nlist"'
+	        func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+	        eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+	      }
+	    ;;
+          esac
+	done
+
+	$opt_dry_run || {
+	  # Make sure we have at least an empty file.
+	  test -f "$nlist" || : > "$nlist"
+
+	  if test -n "$exclude_expsyms"; then
+	    $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+	    $MV "$nlist"T "$nlist"
+	  fi
+
+	  # Try sorting and uniquifying the output.
+	  if $GREP -v "^: " < "$nlist" |
+	      if sort -k 3 /dev/null 2>&1; then
+		sort -k 3
+	      else
+		sort +2
+	      fi |
+	      uniq > "$nlist"S; then
+	    :
+	  else
+	    $GREP -v "^: " < "$nlist" > "$nlist"S
+	  fi
+
+	  if test -f "$nlist"S; then
+	    eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
+	  else
+	    echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
+	  fi
+
+	  echo >> "$output_objdir/$my_dlsyms" "\
+
+/* The mapping between symbol names and symbols.  */
+typedef struct {
+  const char *name;
+  void *address;
+} lt_dlsymlist;
+extern LT_DLSYM_CONST lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[];
+LT_DLSYM_CONST lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[] =
+{\
+  { \"$my_originator\", (void *) 0 },"
+
+	  case $need_lib_prefix in
+	  no)
+	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
+	    ;;
+	  *)
+	    eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
+	    ;;
+	  esac
+	  echo >> "$output_objdir/$my_dlsyms" "\
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt_${my_prefix}_LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+	} # !$opt_dry_run
+
+	pic_flag_for_symtable=
+	case "$compile_command " in
+	*" -static "*) ;;
+	*)
+	  case $host in
+	  # compiling the symbol table file with pic_flag works around
+	  # a FreeBSD bug that causes programs to crash when -lm is
+	  # linked before any other PIC object.  But we must not use
+	  # pic_flag when linking with -static.  The problem exists in
+	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+	  *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+	    pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
+	  *-*-hpux*)
+	    pic_flag_for_symtable=" $pic_flag"  ;;
+	  *)
+	    if test "X$my_pic_p" != Xno; then
+	      pic_flag_for_symtable=" $pic_flag"
+	    fi
+	    ;;
+	  esac
+	  ;;
+	esac
+	symtab_cflags=
+	for arg in $LTCFLAGS; do
+	  case $arg in
+	  -pie | -fpie | -fPIE) ;;
+	  *) func_append symtab_cflags " $arg" ;;
+	  esac
+	done
+
+	# Now compile the dynamic symbol file.
+	func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
+
+	# Clean up the generated files.
+	func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
+
+	# Transform the symbol file into the correct name.
+	symfileobj="$output_objdir/${my_outputname}S.$objext"
+	case $host in
+	*cygwin* | *mingw* | *cegcc* )
+	  if test -f "$output_objdir/$my_outputname.def"; then
+	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+	  else
+	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	  fi
+	  ;;
+	*)
+	  compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	  finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	  ;;
+	esac
+	;;
+      *)
+	func_fatal_error "unknown suffix for \`$my_dlsyms'"
+	;;
+      esac
+    else
+      # We keep going just in case the user didn't refer to
+      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
+      # really was required.
+
+      # Nullify the symbol file.
+      compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
+      finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
+    fi
+}
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+# Despite the name, also deal with 64 bit binaries.
+func_win32_libid ()
+{
+  $opt_debug
+  win32_libid_type="unknown"
+  win32_fileres=`file -L $1 2>/dev/null`
+  case $win32_fileres in
+  *ar\ archive\ import\ library*) # definitely import
+    win32_libid_type="x86 archive import"
+    ;;
+  *ar\ archive*) # could be an import, or static
+    # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
+    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
+       $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
+      func_to_tool_file "$1" func_convert_file_msys_to_w32
+      win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
+	$SED -n -e '
+	    1,100{
+		/ I /{
+		    s,.*,import,
+		    p
+		    q
+		}
+	    }'`
+      case $win32_nmres in
+      import*)  win32_libid_type="x86 archive import";;
+      *)        win32_libid_type="x86 archive static";;
+      esac
+    fi
+    ;;
+  *DLL*)
+    win32_libid_type="x86 DLL"
+    ;;
+  *executable*) # but shell scripts are "executable" too...
+    case $win32_fileres in
+    *MS\ Windows\ PE\ Intel*)
+      win32_libid_type="x86 DLL"
+      ;;
+    esac
+    ;;
+  esac
+  $ECHO "$win32_libid_type"
+}
+
+# func_cygming_dll_for_implib ARG
+#
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+# Invoked by eval'ing the libtool variable
+#    $sharedlib_from_linklib_cmd
+# Result is available in the variable
+#    $sharedlib_from_linklib_result
+func_cygming_dll_for_implib ()
+{
+  $opt_debug
+  sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
+}
+
+# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
+#
+# The is the core of a fallback implementation of a
+# platform-specific function to extract the name of the
+# DLL associated with the specified import library LIBNAME.
+#
+# SECTION_NAME is either .idata$6 or .idata$7, depending
+# on the platform and compiler that created the implib.
+#
+# Echos the name of the DLL associated with the
+# specified import library.
+func_cygming_dll_for_implib_fallback_core ()
+{
+  $opt_debug
+  match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
+  $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
+    $SED '/^Contents of section '"$match_literal"':/{
+      # Place marker at beginning of archive member dllname section
+      s/.*/====MARK====/
+      p
+      d
+    }
+    # These lines can sometimes be longer than 43 characters, but
+    # are always uninteresting
+    /:[	 ]*file format pe[i]\{,1\}-/d
+    /^In archive [^:]*:/d
+    # Ensure marker is printed
+    /^====MARK====/p
+    # Remove all lines with less than 43 characters
+    /^.\{43\}/!d
+    # From remaining lines, remove first 43 characters
+    s/^.\{43\}//' |
+    $SED -n '
+      # Join marker and all lines until next marker into a single line
+      /^====MARK====/ b para
+      H
+      $ b para
+      b
+      :para
+      x
+      s/\n//g
+      # Remove the marker
+      s/^====MARK====//
+      # Remove trailing dots and whitespace
+      s/[\. \t]*$//
+      # Print
+      /./p' |
+    # we now have a list, one entry per line, of the stringified
+    # contents of the appropriate section of all members of the
+    # archive which possess that section. Heuristic: eliminate
+    # all those which have a first or second character that is
+    # a '.' (that is, objdump's representation of an unprintable
+    # character.) This should work for all archives with less than
+    # 0x302f exports -- but will fail for DLLs whose name actually
+    # begins with a literal '.' or a single character followed by
+    # a '.'.
+    #
+    # Of those that remain, print the first one.
+    $SED -e '/^\./d;/^.\./d;q'
+}
+
+# func_cygming_gnu_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is a GNU/binutils-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_gnu_implib_p ()
+{
+  $opt_debug
+  func_to_tool_file "$1" func_convert_file_msys_to_w32
+  func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
+  test -n "$func_cygming_gnu_implib_tmp"
+}
+
+# func_cygming_ms_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is an MS-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_ms_implib_p ()
+{
+  $opt_debug
+  func_to_tool_file "$1" func_convert_file_msys_to_w32
+  func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
+  test -n "$func_cygming_ms_implib_tmp"
+}
+
+# func_cygming_dll_for_implib_fallback ARG
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+#
+# This fallback implementation is for use when $DLLTOOL
+# does not support the --identify-strict option.
+# Invoked by eval'ing the libtool variable
+#    $sharedlib_from_linklib_cmd
+# Result is available in the variable
+#    $sharedlib_from_linklib_result
+func_cygming_dll_for_implib_fallback ()
+{
+  $opt_debug
+  if func_cygming_gnu_implib_p "$1" ; then
+    # binutils import library
+    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
+  elif func_cygming_ms_implib_p "$1" ; then
+    # ms-generated import library
+    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
+  else
+    # unknown
+    sharedlib_from_linklib_result=""
+  fi
+}
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+    $opt_debug
+    f_ex_an_ar_dir="$1"; shift
+    f_ex_an_ar_oldlib="$1"
+    if test "$lock_old_archive_extraction" = yes; then
+      lockfile=$f_ex_an_ar_oldlib.lock
+      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+	func_echo "Waiting for $lockfile to be removed"
+	sleep 2
+      done
+    fi
+    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
+		   'stat=$?; rm -f "$lockfile"; exit $stat'
+    if test "$lock_old_archive_extraction" = yes; then
+      $opt_dry_run || rm -f "$lockfile"
+    fi
+    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+     :
+    else
+      func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
+    fi
+}
+
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+    $opt_debug
+    my_gentop="$1"; shift
+    my_oldlibs=${1+"$@"}
+    my_oldobjs=""
+    my_xlib=""
+    my_xabs=""
+    my_xdir=""
+
+    for my_xlib in $my_oldlibs; do
+      # Extract the objects.
+      case $my_xlib in
+	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+	*) my_xabs=`pwd`"/$my_xlib" ;;
+      esac
+      func_basename "$my_xlib"
+      my_xlib="$func_basename_result"
+      my_xlib_u=$my_xlib
+      while :; do
+        case " $extracted_archives " in
+	*" $my_xlib_u "*)
+	  func_arith $extracted_serial + 1
+	  extracted_serial=$func_arith_result
+	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
+	*) break ;;
+	esac
+      done
+      extracted_archives="$extracted_archives $my_xlib_u"
+      my_xdir="$my_gentop/$my_xlib_u"
+
+      func_mkdir_p "$my_xdir"
+
+      case $host in
+      *-darwin*)
+	func_verbose "Extracting $my_xabs"
+	# Do not bother doing anything if just a dry run
+	$opt_dry_run || {
+	  darwin_orig_dir=`pwd`
+	  cd $my_xdir || exit $?
+	  darwin_archive=$my_xabs
+	  darwin_curdir=`pwd`
+	  darwin_base_archive=`basename "$darwin_archive"`
+	  darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
+	  if test -n "$darwin_arches"; then
+	    darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
+	    darwin_arch=
+	    func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
+	    for darwin_arch in  $darwin_arches ; do
+	      func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+	      $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+	      cd "$darwin_curdir"
+	      $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+	    done # $darwin_arches
+            ## Okay now we've a bunch of thin objects, gotta fatten them up :)
+	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
+	    darwin_file=
+	    darwin_files=
+	    for darwin_file in $darwin_filelist; do
+	      darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
+	      $LIPO -create -output "$darwin_file" $darwin_files
+	    done # $darwin_filelist
+	    $RM -rf unfat-$$
+	    cd "$darwin_orig_dir"
+	  else
+	    cd $darwin_orig_dir
+	    func_extract_an_archive "$my_xdir" "$my_xabs"
+	  fi # $darwin_arches
+	} # !$opt_dry_run
+	;;
+      *)
+        func_extract_an_archive "$my_xdir" "$my_xabs"
+	;;
+      esac
+      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
+    done
+
+    func_extract_archives_result="$my_oldobjs"
+}
+
+
+# func_emit_wrapper [arg=no]
+#
+# Emit a libtool wrapper script on stdout.
+# Don't directly open a file because we may want to
+# incorporate the script contents within a cygwin/mingw
+# wrapper executable.  Must ONLY be called from within
+# func_mode_link because it depends on a number of variables
+# set therein.
+#
+# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
+# variable will take.  If 'yes', then the emitted script
+# will assume that the directory in which it is stored is
+# the $objdir directory.  This is a cygwin/mingw-specific
+# behavior.
+func_emit_wrapper ()
+{
+	func_emit_wrapper_arg1=${1-no}
+
+	$ECHO "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='$sed_quote_subst'
+
+# Be Bourne compatible
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+  # install mode needs the following variables:
+  generated_by_libtool_version='$macro_version'
+  notinst_deplibs='$notinst_deplibs'
+else
+  # When we are sourced in execute mode, \$file and \$ECHO are already set.
+  if test \"\$libtool_execute_magic\" != \"$magic\"; then
+    file=\"\$0\""
+
+    qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
+    $ECHO "\
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+    ECHO=\"$qECHO\"
+  fi
+
+# Very basic option parsing. These options are (a) specific to
+# the libtool wrapper, (b) are identical between the wrapper
+# /script/ and the wrapper /executable/ which is used only on
+# windows platforms, and (c) all begin with the string "--lt-"
+# (application programs are unlikely to have options which match
+# this pattern).
+#
+# There are only two supported options: --lt-debug and
+# --lt-dump-script. There is, deliberately, no --lt-help.
+#
+# The first argument to this parsing function should be the
+# script's $0 value, followed by "$@".
+lt_option_debug=
+func_parse_lt_options ()
+{
+  lt_script_arg0=\$0
+  shift
+  for lt_opt
+  do
+    case \"\$lt_opt\" in
+    --lt-debug) lt_option_debug=1 ;;
+    --lt-dump-script)
+        lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
+        test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
+        lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
+        cat \"\$lt_dump_D/\$lt_dump_F\"
+        exit 0
+      ;;
+    --lt-*)
+        \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
+        exit 1
+      ;;
+    esac
+  done
+
+  # Print the debug banner immediately:
+  if test -n \"\$lt_option_debug\"; then
+    echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
+  fi
+}
+
+# Used when --lt-debug. Prints its arguments to stdout
+# (redirection is the responsibility of the caller)
+func_lt_dump_args ()
+{
+  lt_dump_args_N=1;
+  for lt_arg
+  do
+    \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
+    lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
+  done
+}
+
+# Core function for launching the target application
+func_exec_program_core ()
+{
+"
+  case $host in
+  # Backslashes separate directories on plain windows
+  *-*-mingw | *-*-os2* | *-cegcc*)
+    $ECHO "\
+      if test -n \"\$lt_option_debug\"; then
+        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
+        func_lt_dump_args \${1+\"\$@\"} 1>&2
+      fi
+      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+    ;;
+
+  *)
+    $ECHO "\
+      if test -n \"\$lt_option_debug\"; then
+        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
+        func_lt_dump_args \${1+\"\$@\"} 1>&2
+      fi
+      exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+    ;;
+  esac
+  $ECHO "\
+      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
+      exit 1
+}
+
+# A function to encapsulate launching the target application
+# Strips options in the --lt-* namespace from \$@ and
+# launches target application with the remaining arguments.
+func_exec_program ()
+{
+  case \" \$* \" in
+  *\\ --lt-*)
+    for lt_wr_arg
+    do
+      case \$lt_wr_arg in
+      --lt-*) ;;
+      *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
+      esac
+      shift
+    done ;;
+  esac
+  func_exec_program_core \${1+\"\$@\"}
+}
+
+  # Parse options
+  func_parse_lt_options \"\$0\" \${1+\"\$@\"}
+
+  # Find the directory that this script lives in.
+  thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
+  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+  # Follow symbolic links until we get to the real thisdir.
+  file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
+  while test -n \"\$file\"; do
+    destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
+
+    # If there was a directory component, then change thisdir.
+    if test \"x\$destdir\" != \"x\$file\"; then
+      case \"\$destdir\" in
+      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+      *) thisdir=\"\$thisdir/\$destdir\" ;;
+      esac
+    fi
+
+    file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
+  done
+
+  # Usually 'no', except on cygwin/mingw when embedded into
+  # the cwrapper.
+  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
+  if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
+    # special case for '.'
+    if test \"\$thisdir\" = \".\"; then
+      thisdir=\`pwd\`
+    fi
+    # remove .libs from thisdir
+    case \"\$thisdir\" in
+    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
+    $objdir )   thisdir=. ;;
+    esac
+  fi
+
+  # Try to get the absolute directory name.
+  absdir=\`cd \"\$thisdir\" && pwd\`
+  test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+	if test "$fast_install" = yes; then
+	  $ECHO "\
+  program=lt-'$outputname'$exeext
+  progdir=\"\$thisdir/$objdir\"
+
+  if test ! -f \"\$progdir/\$program\" ||
+     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+    file=\"\$\$-\$program\"
+
+    if test ! -d \"\$progdir\"; then
+      $MKDIR \"\$progdir\"
+    else
+      $RM \"\$progdir/\$file\"
+    fi"
+
+	  $ECHO "\
+
+    # relink executable if necessary
+    if test -n \"\$relink_command\"; then
+      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+      else
+	$ECHO \"\$relink_command_output\" >&2
+	$RM \"\$progdir/\$file\"
+	exit 1
+      fi
+    fi
+
+    $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+    { $RM \"\$progdir/\$program\";
+      $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+    $RM \"\$progdir/\$file\"
+  fi"
+	else
+	  $ECHO "\
+  program='$outputname'
+  progdir=\"\$thisdir/$objdir\"
+"
+	fi
+
+	$ECHO "\
+
+  if test -f \"\$progdir/\$program\"; then"
+
+	# fixup the dll searchpath if we need to.
+	#
+	# Fix the DLL searchpath if we need to.  Do this before prepending
+	# to shlibpath, because on Windows, both are PATH and uninstalled
+	# libraries must come first.
+	if test -n "$dllsearchpath"; then
+	  $ECHO "\
+    # Add the dll search path components to the executable PATH
+    PATH=$dllsearchpath:\$PATH
+"
+	fi
+
+	# Export our shlibpath_var if we have one.
+	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+	  $ECHO "\
+    # Add our own library path to $shlibpath_var
+    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+    # Some systems cannot cope with colon-terminated $shlibpath_var
+    # The second colon is a workaround for a bug in BeOS R4 sed
+    $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
+
+    export $shlibpath_var
+"
+	fi
+
+	$ECHO "\
+    if test \"\$libtool_execute_magic\" != \"$magic\"; then
+      # Run the actual program with our arguments.
+      func_exec_program \${1+\"\$@\"}
+    fi
+  else
+    # The program doesn't exist.
+    \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+    \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
+    \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
+    exit 1
+  fi
+fi\
+"
+}
+
+
+# func_emit_cwrapperexe_src
+# emit the source code for a wrapper executable on stdout
+# Must ONLY be called from within func_mode_link because
+# it depends on a number of variable set therein.
+func_emit_cwrapperexe_src ()
+{
+	cat <
+#include 
+#ifdef _MSC_VER
+# include 
+# include 
+# include 
+#else
+# include 
+# include 
+# ifdef __CYGWIN__
+#  include 
+# endif
+#endif
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* declarations of non-ANSI functions */
+#if defined(__MINGW32__)
+# ifdef __STRICT_ANSI__
+int _putenv (const char *);
+# endif
+#elif defined(__CYGWIN__)
+# ifdef __STRICT_ANSI__
+char *realpath (const char *, char *);
+int putenv (char *);
+int setenv (const char *, const char *, int);
+# endif
+/* #elif defined (other platforms) ... */
+#endif
+
+/* portability defines, excluding path handling macros */
+#if defined(_MSC_VER)
+# define setmode _setmode
+# define stat    _stat
+# define chmod   _chmod
+# define getcwd  _getcwd
+# define putenv  _putenv
+# define S_IXUSR _S_IEXEC
+# ifndef _INTPTR_T_DEFINED
+#  define _INTPTR_T_DEFINED
+#  define intptr_t int
+# endif
+#elif defined(__MINGW32__)
+# define setmode _setmode
+# define stat    _stat
+# define chmod   _chmod
+# define getcwd  _getcwd
+# define putenv  _putenv
+#elif defined(__CYGWIN__)
+# define HAVE_SETENV
+# define FOPEN_WB "wb"
+/* #elif defined (other platforms) ... */
+#endif
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef S_IXOTH
+# define S_IXOTH 0
+#endif
+#ifndef S_IXGRP
+# define S_IXGRP 0
+#endif
+
+/* path handling portability macros */
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+  defined (__OS2__)
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# define FOPEN_WB "wb"
+# ifndef DIR_SEPARATOR_2
+#  define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+#  define PATH_SEPARATOR_2 ';'
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+	(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
+#ifndef FOPEN_WB
+# define FOPEN_WB "w"
+#endif
+#ifndef _O_BINARY
+# define _O_BINARY 0
+#endif
+
+#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+  if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+#if defined(LT_DEBUGWRAPPER)
+static int lt_debug = 1;
+#else
+static int lt_debug = 0;
+#endif
+
+const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
+
+void *xmalloc (size_t num);
+char *xstrdup (const char *string);
+const char *base_name (const char *name);
+char *find_executable (const char *wrapper);
+char *chase_symlinks (const char *pathspec);
+int make_executable (const char *path);
+int check_executable (const char *path);
+char *strendzap (char *str, const char *pat);
+void lt_debugprintf (const char *file, int line, const char *fmt, ...);
+void lt_fatal (const char *file, int line, const char *message, ...);
+static const char *nonnull (const char *s);
+static const char *nonempty (const char *s);
+void lt_setenv (const char *name, const char *value);
+char *lt_extend_str (const char *orig_value, const char *add, int to_end);
+void lt_update_exe_path (const char *name, const char *value);
+void lt_update_lib_path (const char *name, const char *value);
+char **prepare_spawn (char **argv);
+void lt_dump_script (FILE *f);
+EOF
+
+	    cat <= 0)
+      && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
+    return 1;
+  else
+    return 0;
+}
+
+int
+make_executable (const char *path)
+{
+  int rval = 0;
+  struct stat st;
+
+  lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
+                  nonempty (path));
+  if ((!path) || (!*path))
+    return 0;
+
+  if (stat (path, &st) >= 0)
+    {
+      rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
+    }
+  return rval;
+}
+
+/* Searches for the full path of the wrapper.  Returns
+   newly allocated full path name if found, NULL otherwise
+   Does not chase symlinks, even on platforms that support them.
+*/
+char *
+find_executable (const char *wrapper)
+{
+  int has_slash = 0;
+  const char *p;
+  const char *p_next;
+  /* static buffer for getcwd */
+  char tmp[LT_PATHMAX + 1];
+  int tmp_len;
+  char *concat_name;
+
+  lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
+                  nonempty (wrapper));
+
+  if ((wrapper == NULL) || (*wrapper == '\0'))
+    return NULL;
+
+  /* Absolute path? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
+    {
+      concat_name = xstrdup (wrapper);
+      if (check_executable (concat_name))
+	return concat_name;
+      XFREE (concat_name);
+    }
+  else
+    {
+#endif
+      if (IS_DIR_SEPARATOR (wrapper[0]))
+	{
+	  concat_name = xstrdup (wrapper);
+	  if (check_executable (concat_name))
+	    return concat_name;
+	  XFREE (concat_name);
+	}
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+    }
+#endif
+
+  for (p = wrapper; *p; p++)
+    if (*p == '/')
+      {
+	has_slash = 1;
+	break;
+      }
+  if (!has_slash)
+    {
+      /* no slashes; search PATH */
+      const char *path = getenv ("PATH");
+      if (path != NULL)
+	{
+	  for (p = path; *p; p = p_next)
+	    {
+	      const char *q;
+	      size_t p_len;
+	      for (q = p; *q; q++)
+		if (IS_PATH_SEPARATOR (*q))
+		  break;
+	      p_len = q - p;
+	      p_next = (*q == '\0' ? q : q + 1);
+	      if (p_len == 0)
+		{
+		  /* empty path: current directory */
+		  if (getcwd (tmp, LT_PATHMAX) == NULL)
+		    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+                              nonnull (strerror (errno)));
+		  tmp_len = strlen (tmp);
+		  concat_name =
+		    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+		  memcpy (concat_name, tmp, tmp_len);
+		  concat_name[tmp_len] = '/';
+		  strcpy (concat_name + tmp_len + 1, wrapper);
+		}
+	      else
+		{
+		  concat_name =
+		    XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
+		  memcpy (concat_name, p, p_len);
+		  concat_name[p_len] = '/';
+		  strcpy (concat_name + p_len + 1, wrapper);
+		}
+	      if (check_executable (concat_name))
+		return concat_name;
+	      XFREE (concat_name);
+	    }
+	}
+      /* not found in PATH; assume curdir */
+    }
+  /* Relative path | not found in path: prepend cwd */
+  if (getcwd (tmp, LT_PATHMAX) == NULL)
+    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+              nonnull (strerror (errno)));
+  tmp_len = strlen (tmp);
+  concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+  memcpy (concat_name, tmp, tmp_len);
+  concat_name[tmp_len] = '/';
+  strcpy (concat_name + tmp_len + 1, wrapper);
+
+  if (check_executable (concat_name))
+    return concat_name;
+  XFREE (concat_name);
+  return NULL;
+}
+
+char *
+chase_symlinks (const char *pathspec)
+{
+#ifndef S_ISLNK
+  return xstrdup (pathspec);
+#else
+  char buf[LT_PATHMAX];
+  struct stat s;
+  char *tmp_pathspec = xstrdup (pathspec);
+  char *p;
+  int has_symlinks = 0;
+  while (strlen (tmp_pathspec) && !has_symlinks)
+    {
+      lt_debugprintf (__FILE__, __LINE__,
+		      "checking path component for symlinks: %s\n",
+		      tmp_pathspec);
+      if (lstat (tmp_pathspec, &s) == 0)
+	{
+	  if (S_ISLNK (s.st_mode) != 0)
+	    {
+	      has_symlinks = 1;
+	      break;
+	    }
+
+	  /* search backwards for last DIR_SEPARATOR */
+	  p = tmp_pathspec + strlen (tmp_pathspec) - 1;
+	  while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+	    p--;
+	  if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+	    {
+	      /* no more DIR_SEPARATORS left */
+	      break;
+	    }
+	  *p = '\0';
+	}
+      else
+	{
+	  lt_fatal (__FILE__, __LINE__,
+		    "error accessing file \"%s\": %s",
+		    tmp_pathspec, nonnull (strerror (errno)));
+	}
+    }
+  XFREE (tmp_pathspec);
+
+  if (!has_symlinks)
+    {
+      return xstrdup (pathspec);
+    }
+
+  tmp_pathspec = realpath (pathspec, buf);
+  if (tmp_pathspec == 0)
+    {
+      lt_fatal (__FILE__, __LINE__,
+		"could not follow symlinks for %s", pathspec);
+    }
+  return xstrdup (tmp_pathspec);
+#endif
+}
+
+char *
+strendzap (char *str, const char *pat)
+{
+  size_t len, patlen;
+
+  assert (str != NULL);
+  assert (pat != NULL);
+
+  len = strlen (str);
+  patlen = strlen (pat);
+
+  if (patlen <= len)
+    {
+      str += len - patlen;
+      if (strcmp (str, pat) == 0)
+	*str = '\0';
+    }
+  return str;
+}
+
+void
+lt_debugprintf (const char *file, int line, const char *fmt, ...)
+{
+  va_list args;
+  if (lt_debug)
+    {
+      (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
+      va_start (args, fmt);
+      (void) vfprintf (stderr, fmt, args);
+      va_end (args);
+    }
+}
+
+static void
+lt_error_core (int exit_status, const char *file,
+	       int line, const char *mode,
+	       const char *message, va_list ap)
+{
+  fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
+  vfprintf (stderr, message, ap);
+  fprintf (stderr, ".\n");
+
+  if (exit_status >= 0)
+    exit (exit_status);
+}
+
+void
+lt_fatal (const char *file, int line, const char *message, ...)
+{
+  va_list ap;
+  va_start (ap, message);
+  lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
+  va_end (ap);
+}
+
+static const char *
+nonnull (const char *s)
+{
+  return s ? s : "(null)";
+}
+
+static const char *
+nonempty (const char *s)
+{
+  return (s && !*s) ? "(empty)" : nonnull (s);
+}
+
+void
+lt_setenv (const char *name, const char *value)
+{
+  lt_debugprintf (__FILE__, __LINE__,
+		  "(lt_setenv) setting '%s' to '%s'\n",
+                  nonnull (name), nonnull (value));
+  {
+#ifdef HAVE_SETENV
+    /* always make a copy, for consistency with !HAVE_SETENV */
+    char *str = xstrdup (value);
+    setenv (name, str, 1);
+#else
+    int len = strlen (name) + 1 + strlen (value) + 1;
+    char *str = XMALLOC (char, len);
+    sprintf (str, "%s=%s", name, value);
+    if (putenv (str) != EXIT_SUCCESS)
+      {
+        XFREE (str);
+      }
+#endif
+  }
+}
+
+char *
+lt_extend_str (const char *orig_value, const char *add, int to_end)
+{
+  char *new_value;
+  if (orig_value && *orig_value)
+    {
+      int orig_value_len = strlen (orig_value);
+      int add_len = strlen (add);
+      new_value = XMALLOC (char, add_len + orig_value_len + 1);
+      if (to_end)
+        {
+          strcpy (new_value, orig_value);
+          strcpy (new_value + orig_value_len, add);
+        }
+      else
+        {
+          strcpy (new_value, add);
+          strcpy (new_value + add_len, orig_value);
+        }
+    }
+  else
+    {
+      new_value = xstrdup (add);
+    }
+  return new_value;
+}
+
+void
+lt_update_exe_path (const char *name, const char *value)
+{
+  lt_debugprintf (__FILE__, __LINE__,
+		  "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
+                  nonnull (name), nonnull (value));
+
+  if (name && *name && value && *value)
+    {
+      char *new_value = lt_extend_str (getenv (name), value, 0);
+      /* some systems can't cope with a ':'-terminated path #' */
+      int len = strlen (new_value);
+      while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
+        {
+          new_value[len-1] = '\0';
+        }
+      lt_setenv (name, new_value);
+      XFREE (new_value);
+    }
+}
+
+void
+lt_update_lib_path (const char *name, const char *value)
+{
+  lt_debugprintf (__FILE__, __LINE__,
+		  "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
+                  nonnull (name), nonnull (value));
+
+  if (name && *name && value && *value)
+    {
+      char *new_value = lt_extend_str (getenv (name), value, 0);
+      lt_setenv (name, new_value);
+      XFREE (new_value);
+    }
+}
+
+EOF
+	    case $host_os in
+	      mingw*)
+		cat <<"EOF"
+
+/* Prepares an argument vector before calling spawn().
+   Note that spawn() does not by itself call the command interpreter
+     (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
+      ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+         GetVersionEx(&v);
+         v.dwPlatformId == VER_PLATFORM_WIN32_NT;
+      }) ? "cmd.exe" : "command.com").
+   Instead it simply concatenates the arguments, separated by ' ', and calls
+   CreateProcess().  We must quote the arguments since Win32 CreateProcess()
+   interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
+   special way:
+   - Space and tab are interpreted as delimiters. They are not treated as
+     delimiters if they are surrounded by double quotes: "...".
+   - Unescaped double quotes are removed from the input. Their only effect is
+     that within double quotes, space and tab are treated like normal
+     characters.
+   - Backslashes not followed by double quotes are not special.
+   - But 2*n+1 backslashes followed by a double quote become
+     n backslashes followed by a double quote (n >= 0):
+       \" -> "
+       \\\" -> \"
+       \\\\\" -> \\"
+ */
+#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+char **
+prepare_spawn (char **argv)
+{
+  size_t argc;
+  char **new_argv;
+  size_t i;
+
+  /* Count number of arguments.  */
+  for (argc = 0; argv[argc] != NULL; argc++)
+    ;
+
+  /* Allocate new argument vector.  */
+  new_argv = XMALLOC (char *, argc + 1);
+
+  /* Put quoted arguments into the new argument vector.  */
+  for (i = 0; i < argc; i++)
+    {
+      const char *string = argv[i];
+
+      if (string[0] == '\0')
+	new_argv[i] = xstrdup ("\"\"");
+      else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
+	{
+	  int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
+	  size_t length;
+	  unsigned int backslashes;
+	  const char *s;
+	  char *quoted_string;
+	  char *p;
+
+	  length = 0;
+	  backslashes = 0;
+	  if (quote_around)
+	    length++;
+	  for (s = string; *s != '\0'; s++)
+	    {
+	      char c = *s;
+	      if (c == '"')
+		length += backslashes + 1;
+	      length++;
+	      if (c == '\\')
+		backslashes++;
+	      else
+		backslashes = 0;
+	    }
+	  if (quote_around)
+	    length += backslashes + 1;
+
+	  quoted_string = XMALLOC (char, length + 1);
+
+	  p = quoted_string;
+	  backslashes = 0;
+	  if (quote_around)
+	    *p++ = '"';
+	  for (s = string; *s != '\0'; s++)
+	    {
+	      char c = *s;
+	      if (c == '"')
+		{
+		  unsigned int j;
+		  for (j = backslashes + 1; j > 0; j--)
+		    *p++ = '\\';
+		}
+	      *p++ = c;
+	      if (c == '\\')
+		backslashes++;
+	      else
+		backslashes = 0;
+	    }
+	  if (quote_around)
+	    {
+	      unsigned int j;
+	      for (j = backslashes; j > 0; j--)
+		*p++ = '\\';
+	      *p++ = '"';
+	    }
+	  *p = '\0';
+
+	  new_argv[i] = quoted_string;
+	}
+      else
+	new_argv[i] = (char *) string;
+    }
+  new_argv[argc] = NULL;
+
+  return new_argv;
+}
+EOF
+		;;
+	    esac
+
+            cat <<"EOF"
+void lt_dump_script (FILE* f)
+{
+EOF
+	    func_emit_wrapper yes |
+	      $SED -n -e '
+s/^\(.\{79\}\)\(..*\)/\1\
+\2/
+h
+s/\([\\"]\)/\\\1/g
+s/$/\\n/
+s/\([^\n]*\).*/  fputs ("\1", f);/p
+g
+D'
+            cat <<"EOF"
+}
+EOF
+}
+# end: func_emit_cwrapperexe_src
+
+# func_win32_import_lib_p ARG
+# True if ARG is an import lib, as indicated by $file_magic_cmd
+func_win32_import_lib_p ()
+{
+    $opt_debug
+    case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
+    *import*) : ;;
+    *) false ;;
+    esac
+}
+
+# func_mode_link arg...
+func_mode_link ()
+{
+    $opt_debug
+    case $host in
+    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+      # It is impossible to link a dll without this setting, and
+      # we shouldn't force the makefile maintainer to figure out
+      # which system we are compiling for in order to pass an extra
+      # flag for every libtool invocation.
+      # allow_undefined=no
+
+      # FIXME: Unfortunately, there are problems with the above when trying
+      # to make a dll which has undefined symbols, in which case not
+      # even a static library is built.  For now, we need to specify
+      # -no-undefined on the libtool link line when we can be certain
+      # that all symbols are satisfied, otherwise we get a static library.
+      allow_undefined=yes
+      ;;
+    *)
+      allow_undefined=yes
+      ;;
+    esac
+    libtool_args=$nonopt
+    base_compile="$nonopt $@"
+    compile_command=$nonopt
+    finalize_command=$nonopt
+
+    compile_rpath=
+    finalize_rpath=
+    compile_shlibpath=
+    finalize_shlibpath=
+    convenience=
+    old_convenience=
+    deplibs=
+    old_deplibs=
+    compiler_flags=
+    linker_flags=
+    dllsearchpath=
+    lib_search_path=`pwd`
+    inst_prefix_dir=
+    new_inherited_linker_flags=
+
+    avoid_version=no
+    bindir=
+    dlfiles=
+    dlprefiles=
+    dlself=no
+    export_dynamic=no
+    export_symbols=
+    export_symbols_regex=
+    generated=
+    libobjs=
+    ltlibs=
+    module=no
+    no_install=no
+    objs=
+    non_pic_objects=
+    precious_files_regex=
+    prefer_static_libs=no
+    preload=no
+    prev=
+    prevarg=
+    release=
+    rpath=
+    xrpath=
+    perm_rpath=
+    temp_rpath=
+    thread_safe=no
+    vinfo=
+    vinfo_number=no
+    weak_libs=
+    single_module="${wl}-single_module"
+    func_infer_tag $base_compile
+
+    # We need to know -static, to get the right output filenames.
+    for arg
+    do
+      case $arg in
+      -shared)
+	test "$build_libtool_libs" != yes && \
+	  func_fatal_configuration "can not build a shared library"
+	build_old_libs=no
+	break
+	;;
+      -all-static | -static | -static-libtool-libs)
+	case $arg in
+	-all-static)
+	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+	    func_warning "complete static linking is impossible in this configuration"
+	  fi
+	  if test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=yes
+	  ;;
+	-static)
+	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=built
+	  ;;
+	-static-libtool-libs)
+	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=yes
+	  ;;
+	esac
+	build_libtool_libs=no
+	build_old_libs=yes
+	break
+	;;
+      esac
+    done
+
+    # See if our shared archives depend on static archives.
+    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+    # Go through the arguments, transforming them on the way.
+    while test "$#" -gt 0; do
+      arg="$1"
+      shift
+      func_quote_for_eval "$arg"
+      qarg=$func_quote_for_eval_unquoted_result
+      func_append libtool_args " $func_quote_for_eval_result"
+
+      # If the previous option needs an argument, assign it.
+      if test -n "$prev"; then
+	case $prev in
+	output)
+	  func_append compile_command " @OUTPUT@"
+	  func_append finalize_command " @OUTPUT@"
+	  ;;
+	esac
+
+	case $prev in
+	bindir)
+	  bindir="$arg"
+	  prev=
+	  continue
+	  ;;
+	dlfiles|dlprefiles)
+	  if test "$preload" = no; then
+	    # Add the symbol object into the linking commands.
+	    func_append compile_command " @SYMFILE@"
+	    func_append finalize_command " @SYMFILE@"
+	    preload=yes
+	  fi
+	  case $arg in
+	  *.la | *.lo) ;;  # We handle these cases below.
+	  force)
+	    if test "$dlself" = no; then
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  self)
+	    if test "$prev" = dlprefiles; then
+	      dlself=yes
+	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+	      dlself=yes
+	    else
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  *)
+	    if test "$prev" = dlfiles; then
+	      func_append dlfiles " $arg"
+	    else
+	      func_append dlprefiles " $arg"
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  esac
+	  ;;
+	expsyms)
+	  export_symbols="$arg"
+	  test -f "$arg" \
+	    || func_fatal_error "symbol file \`$arg' does not exist"
+	  prev=
+	  continue
+	  ;;
+	expsyms_regex)
+	  export_symbols_regex="$arg"
+	  prev=
+	  continue
+	  ;;
+	framework)
+	  case $host in
+	    *-*-darwin*)
+	      case "$deplibs " in
+		*" $qarg.ltframework "*) ;;
+		*) func_append deplibs " $qarg.ltframework" # this is fixed later
+		   ;;
+	      esac
+	      ;;
+	  esac
+	  prev=
+	  continue
+	  ;;
+	inst_prefix)
+	  inst_prefix_dir="$arg"
+	  prev=
+	  continue
+	  ;;
+	objectlist)
+	  if test -f "$arg"; then
+	    save_arg=$arg
+	    moreargs=
+	    for fil in `cat "$save_arg"`
+	    do
+#	      func_append moreargs " $fil"
+	      arg=$fil
+	      # A libtool-controlled object.
+
+	      # Check to see that this really is a libtool object.
+	      if func_lalib_unsafe_p "$arg"; then
+		pic_object=
+		non_pic_object=
+
+		# Read the .lo file
+		func_source "$arg"
+
+		if test -z "$pic_object" ||
+		   test -z "$non_pic_object" ||
+		   test "$pic_object" = none &&
+		   test "$non_pic_object" = none; then
+		  func_fatal_error "cannot find name of object for \`$arg'"
+		fi
+
+		# Extract subdirectory from the argument.
+		func_dirname "$arg" "/" ""
+		xdir="$func_dirname_result"
+
+		if test "$pic_object" != none; then
+		  # Prepend the subdirectory the object is found in.
+		  pic_object="$xdir$pic_object"
+
+		  if test "$prev" = dlfiles; then
+		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+		      func_append dlfiles " $pic_object"
+		      prev=
+		      continue
+		    else
+		      # If libtool objects are unsupported, then we need to preload.
+		      prev=dlprefiles
+		    fi
+		  fi
+
+		  # CHECK ME:  I think I busted this.  -Ossama
+		  if test "$prev" = dlprefiles; then
+		    # Preload the old-style object.
+		    func_append dlprefiles " $pic_object"
+		    prev=
+		  fi
+
+		  # A PIC object.
+		  func_append libobjs " $pic_object"
+		  arg="$pic_object"
+		fi
+
+		# Non-PIC object.
+		if test "$non_pic_object" != none; then
+		  # Prepend the subdirectory the object is found in.
+		  non_pic_object="$xdir$non_pic_object"
+
+		  # A standard non-PIC object
+		  func_append non_pic_objects " $non_pic_object"
+		  if test -z "$pic_object" || test "$pic_object" = none ; then
+		    arg="$non_pic_object"
+		  fi
+		else
+		  # If the PIC object exists, use it instead.
+		  # $xdir was prepended to $pic_object above.
+		  non_pic_object="$pic_object"
+		  func_append non_pic_objects " $non_pic_object"
+		fi
+	      else
+		# Only an error if not doing a dry-run.
+		if $opt_dry_run; then
+		  # Extract subdirectory from the argument.
+		  func_dirname "$arg" "/" ""
+		  xdir="$func_dirname_result"
+
+		  func_lo2o "$arg"
+		  pic_object=$xdir$objdir/$func_lo2o_result
+		  non_pic_object=$xdir$func_lo2o_result
+		  func_append libobjs " $pic_object"
+		  func_append non_pic_objects " $non_pic_object"
+	        else
+		  func_fatal_error "\`$arg' is not a valid libtool object"
+		fi
+	      fi
+	    done
+	  else
+	    func_fatal_error "link input file \`$arg' does not exist"
+	  fi
+	  arg=$save_arg
+	  prev=
+	  continue
+	  ;;
+	precious_regex)
+	  precious_files_regex="$arg"
+	  prev=
+	  continue
+	  ;;
+	release)
+	  release="-$arg"
+	  prev=
+	  continue
+	  ;;
+	rpath | xrpath)
+	  # We need an absolute path.
+	  case $arg in
+	  [\\/]* | [A-Za-z]:[\\/]*) ;;
+	  *)
+	    func_fatal_error "only absolute run-paths are allowed"
+	    ;;
+	  esac
+	  if test "$prev" = rpath; then
+	    case "$rpath " in
+	    *" $arg "*) ;;
+	    *) func_append rpath " $arg" ;;
+	    esac
+	  else
+	    case "$xrpath " in
+	    *" $arg "*) ;;
+	    *) func_append xrpath " $arg" ;;
+	    esac
+	  fi
+	  prev=
+	  continue
+	  ;;
+	shrext)
+	  shrext_cmds="$arg"
+	  prev=
+	  continue
+	  ;;
+	weak)
+	  func_append weak_libs " $arg"
+	  prev=
+	  continue
+	  ;;
+	xcclinker)
+	  func_append linker_flags " $qarg"
+	  func_append compiler_flags " $qarg"
+	  prev=
+	  func_append compile_command " $qarg"
+	  func_append finalize_command " $qarg"
+	  continue
+	  ;;
+	xcompiler)
+	  func_append compiler_flags " $qarg"
+	  prev=
+	  func_append compile_command " $qarg"
+	  func_append finalize_command " $qarg"
+	  continue
+	  ;;
+	xlinker)
+	  func_append linker_flags " $qarg"
+	  func_append compiler_flags " $wl$qarg"
+	  prev=
+	  func_append compile_command " $wl$qarg"
+	  func_append finalize_command " $wl$qarg"
+	  continue
+	  ;;
+	*)
+	  eval "$prev=\"\$arg\""
+	  prev=
+	  continue
+	  ;;
+	esac
+      fi # test -n "$prev"
+
+      prevarg="$arg"
+
+      case $arg in
+      -all-static)
+	if test -n "$link_static_flag"; then
+	  # See comment for -static flag below, for more details.
+	  func_append compile_command " $link_static_flag"
+	  func_append finalize_command " $link_static_flag"
+	fi
+	continue
+	;;
+
+      -allow-undefined)
+	# FIXME: remove this flag sometime in the future.
+	func_fatal_error "\`-allow-undefined' must not be used because it is the default"
+	;;
+
+      -avoid-version)
+	avoid_version=yes
+	continue
+	;;
+
+      -bindir)
+	prev=bindir
+	continue
+	;;
+
+      -dlopen)
+	prev=dlfiles
+	continue
+	;;
+
+      -dlpreopen)
+	prev=dlprefiles
+	continue
+	;;
+
+      -export-dynamic)
+	export_dynamic=yes
+	continue
+	;;
+
+      -export-symbols | -export-symbols-regex)
+	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+	  func_fatal_error "more than one -exported-symbols argument is not allowed"
+	fi
+	if test "X$arg" = "X-export-symbols"; then
+	  prev=expsyms
+	else
+	  prev=expsyms_regex
+	fi
+	continue
+	;;
+
+      -framework)
+	prev=framework
+	continue
+	;;
+
+      -inst-prefix-dir)
+	prev=inst_prefix
+	continue
+	;;
+
+      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+      # so, if we see these flags be careful not to treat them like -L
+      -L[A-Z][A-Z]*:*)
+	case $with_gcc/$host in
+	no/*-*-irix* | /*-*-irix*)
+	  func_append compile_command " $arg"
+	  func_append finalize_command " $arg"
+	  ;;
+	esac
+	continue
+	;;
+
+      -L*)
+	func_stripname "-L" '' "$arg"
+	if test -z "$func_stripname_result"; then
+	  if test "$#" -gt 0; then
+	    func_fatal_error "require no space between \`-L' and \`$1'"
+	  else
+	    func_fatal_error "need path for \`-L' option"
+	  fi
+	fi
+	func_resolve_sysroot "$func_stripname_result"
+	dir=$func_resolve_sysroot_result
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	*)
+	  absdir=`cd "$dir" && pwd`
+	  test -z "$absdir" && \
+	    func_fatal_error "cannot determine absolute directory name of \`$dir'"
+	  dir="$absdir"
+	  ;;
+	esac
+	case "$deplibs " in
+	*" -L$dir "* | *" $arg "*)
+	  # Will only happen for absolute or sysroot arguments
+	  ;;
+	*)
+	  # Preserve sysroot, but never include relative directories
+	  case $dir in
+	    [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
+	    *) func_append deplibs " -L$dir" ;;
+	  esac
+	  func_append lib_search_path " $dir"
+	  ;;
+	esac
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+	  testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
+	  case :$dllsearchpath: in
+	  *":$dir:"*) ;;
+	  ::) dllsearchpath=$dir;;
+	  *) func_append dllsearchpath ":$dir";;
+	  esac
+	  case :$dllsearchpath: in
+	  *":$testbindir:"*) ;;
+	  ::) dllsearchpath=$testbindir;;
+	  *) func_append dllsearchpath ":$testbindir";;
+	  esac
+	  ;;
+	esac
+	continue
+	;;
+
+      -l*)
+	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+	  case $host in
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
+	    # These systems don't actually have a C or math library (as such)
+	    continue
+	    ;;
+	  *-*-os2*)
+	    # These systems don't actually have a C library (as such)
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	    # Do not include libc due to us having libc/libc_r.
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-rhapsody* | *-*-darwin1.[012])
+	    # Rhapsody C and math libraries are in the System framework
+	    func_append deplibs " System.ltframework"
+	    continue
+	    ;;
+	  *-*-sco3.2v5* | *-*-sco5v6*)
+	    # Causes problems with __ctype
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+	    # Compiler inserts libc in the correct place for threads to work
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  esac
+	elif test "X$arg" = "X-lc_r"; then
+	 case $host in
+	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	   # Do not include libc_r directly, use -pthread flag.
+	   continue
+	   ;;
+	 esac
+	fi
+	func_append deplibs " $arg"
+	continue
+	;;
+
+      -module)
+	module=yes
+	continue
+	;;
+
+      # Tru64 UNIX uses -model [arg] to determine the layout of C++
+      # classes, name mangling, and exception handling.
+      # Darwin uses the -arch flag to determine output architecture.
+      -model|-arch|-isysroot|--sysroot)
+	func_append compiler_flags " $arg"
+	func_append compile_command " $arg"
+	func_append finalize_command " $arg"
+	prev=xcompiler
+	continue
+	;;
+
+      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+      |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+	func_append compiler_flags " $arg"
+	func_append compile_command " $arg"
+	func_append finalize_command " $arg"
+	case "$new_inherited_linker_flags " in
+	    *" $arg "*) ;;
+	    * ) func_append new_inherited_linker_flags " $arg" ;;
+	esac
+	continue
+	;;
+
+      -multi_module)
+	single_module="${wl}-multi_module"
+	continue
+	;;
+
+      -no-fast-install)
+	fast_install=no
+	continue
+	;;
+
+      -no-install)
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
+	  # The PATH hackery in wrapper scripts is required on Windows
+	  # and Darwin in order for the loader to find any dlls it needs.
+	  func_warning "\`-no-install' is ignored for $host"
+	  func_warning "assuming \`-no-fast-install' instead"
+	  fast_install=no
+	  ;;
+	*) no_install=yes ;;
+	esac
+	continue
+	;;
+
+      -no-undefined)
+	allow_undefined=no
+	continue
+	;;
+
+      -objectlist)
+	prev=objectlist
+	continue
+	;;
+
+      -o) prev=output ;;
+
+      -precious-files-regex)
+	prev=precious_regex
+	continue
+	;;
+
+      -release)
+	prev=release
+	continue
+	;;
+
+      -rpath)
+	prev=rpath
+	continue
+	;;
+
+      -R)
+	prev=xrpath
+	continue
+	;;
+
+      -R*)
+	func_stripname '-R' '' "$arg"
+	dir=$func_stripname_result
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	=*)
+	  func_stripname '=' '' "$dir"
+	  dir=$lt_sysroot$func_stripname_result
+	  ;;
+	*)
+	  func_fatal_error "only absolute run-paths are allowed"
+	  ;;
+	esac
+	case "$xrpath " in
+	*" $dir "*) ;;
+	*) func_append xrpath " $dir" ;;
+	esac
+	continue
+	;;
+
+      -shared)
+	# The effects of -shared are defined in a previous loop.
+	continue
+	;;
+
+      -shrext)
+	prev=shrext
+	continue
+	;;
+
+      -static | -static-libtool-libs)
+	# The effects of -static are defined in a previous loop.
+	# We used to do the same as -all-static on platforms that
+	# didn't have a PIC flag, but the assumption that the effects
+	# would be equivalent was wrong.  It would break on at least
+	# Digital Unix and AIX.
+	continue
+	;;
+
+      -thread-safe)
+	thread_safe=yes
+	continue
+	;;
+
+      -version-info)
+	prev=vinfo
+	continue
+	;;
+
+      -version-number)
+	prev=vinfo
+	vinfo_number=yes
+	continue
+	;;
+
+      -weak)
+        prev=weak
+	continue
+	;;
+
+      -Wc,*)
+	func_stripname '-Wc,' '' "$arg"
+	args=$func_stripname_result
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+          func_quote_for_eval "$flag"
+	  func_append arg " $func_quote_for_eval_result"
+	  func_append compiler_flags " $func_quote_for_eval_result"
+	done
+	IFS="$save_ifs"
+	func_stripname ' ' '' "$arg"
+	arg=$func_stripname_result
+	;;
+
+      -Wl,*)
+	func_stripname '-Wl,' '' "$arg"
+	args=$func_stripname_result
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+          func_quote_for_eval "$flag"
+	  func_append arg " $wl$func_quote_for_eval_result"
+	  func_append compiler_flags " $wl$func_quote_for_eval_result"
+	  func_append linker_flags " $func_quote_for_eval_result"
+	done
+	IFS="$save_ifs"
+	func_stripname ' ' '' "$arg"
+	arg=$func_stripname_result
+	;;
+
+      -Xcompiler)
+	prev=xcompiler
+	continue
+	;;
+
+      -Xlinker)
+	prev=xlinker
+	continue
+	;;
+
+      -XCClinker)
+	prev=xcclinker
+	continue
+	;;
+
+      # -msg_* for osf cc
+      -msg_*)
+	func_quote_for_eval "$arg"
+	arg="$func_quote_for_eval_result"
+	;;
+
+      # Flags to be passed through unchanged, with rationale:
+      # -64, -mips[0-9]      enable 64-bit mode for the SGI compiler
+      # -r[0-9][0-9]*        specify processor for the SGI compiler
+      # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
+      # +DA*, +DD*           enable 64-bit mode for the HP compiler
+      # -q*                  compiler args for the IBM compiler
+      # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
+      # -F/path              path to uninstalled frameworks, gcc on darwin
+      # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
+      # @file                GCC response files
+      # -tp=*                Portland pgcc target processor selection
+      # --sysroot=*          for sysroot support
+      # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
+      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+      -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
+        func_quote_for_eval "$arg"
+	arg="$func_quote_for_eval_result"
+        func_append compile_command " $arg"
+        func_append finalize_command " $arg"
+        func_append compiler_flags " $arg"
+        continue
+        ;;
+
+      # Some other compiler flag.
+      -* | +*)
+        func_quote_for_eval "$arg"
+	arg="$func_quote_for_eval_result"
+	;;
+
+      *.$objext)
+	# A standard object.
+	func_append objs " $arg"
+	;;
+
+      *.lo)
+	# A libtool-controlled object.
+
+	# Check to see that this really is a libtool object.
+	if func_lalib_unsafe_p "$arg"; then
+	  pic_object=
+	  non_pic_object=
+
+	  # Read the .lo file
+	  func_source "$arg"
+
+	  if test -z "$pic_object" ||
+	     test -z "$non_pic_object" ||
+	     test "$pic_object" = none &&
+	     test "$non_pic_object" = none; then
+	    func_fatal_error "cannot find name of object for \`$arg'"
+	  fi
+
+	  # Extract subdirectory from the argument.
+	  func_dirname "$arg" "/" ""
+	  xdir="$func_dirname_result"
+
+	  if test "$pic_object" != none; then
+	    # Prepend the subdirectory the object is found in.
+	    pic_object="$xdir$pic_object"
+
+	    if test "$prev" = dlfiles; then
+	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+		func_append dlfiles " $pic_object"
+		prev=
+		continue
+	      else
+		# If libtool objects are unsupported, then we need to preload.
+		prev=dlprefiles
+	      fi
+	    fi
+
+	    # CHECK ME:  I think I busted this.  -Ossama
+	    if test "$prev" = dlprefiles; then
+	      # Preload the old-style object.
+	      func_append dlprefiles " $pic_object"
+	      prev=
+	    fi
+
+	    # A PIC object.
+	    func_append libobjs " $pic_object"
+	    arg="$pic_object"
+	  fi
+
+	  # Non-PIC object.
+	  if test "$non_pic_object" != none; then
+	    # Prepend the subdirectory the object is found in.
+	    non_pic_object="$xdir$non_pic_object"
+
+	    # A standard non-PIC object
+	    func_append non_pic_objects " $non_pic_object"
+	    if test -z "$pic_object" || test "$pic_object" = none ; then
+	      arg="$non_pic_object"
+	    fi
+	  else
+	    # If the PIC object exists, use it instead.
+	    # $xdir was prepended to $pic_object above.
+	    non_pic_object="$pic_object"
+	    func_append non_pic_objects " $non_pic_object"
+	  fi
+	else
+	  # Only an error if not doing a dry-run.
+	  if $opt_dry_run; then
+	    # Extract subdirectory from the argument.
+	    func_dirname "$arg" "/" ""
+	    xdir="$func_dirname_result"
+
+	    func_lo2o "$arg"
+	    pic_object=$xdir$objdir/$func_lo2o_result
+	    non_pic_object=$xdir$func_lo2o_result
+	    func_append libobjs " $pic_object"
+	    func_append non_pic_objects " $non_pic_object"
+	  else
+	    func_fatal_error "\`$arg' is not a valid libtool object"
+	  fi
+	fi
+	;;
+
+      *.$libext)
+	# An archive.
+	func_append deplibs " $arg"
+	func_append old_deplibs " $arg"
+	continue
+	;;
+
+      *.la)
+	# A libtool-controlled library.
+
+	func_resolve_sysroot "$arg"
+	if test "$prev" = dlfiles; then
+	  # This library was specified with -dlopen.
+	  func_append dlfiles " $func_resolve_sysroot_result"
+	  prev=
+	elif test "$prev" = dlprefiles; then
+	  # The library was specified with -dlpreopen.
+	  func_append dlprefiles " $func_resolve_sysroot_result"
+	  prev=
+	else
+	  func_append deplibs " $func_resolve_sysroot_result"
+	fi
+	continue
+	;;
+
+      # Some other compiler argument.
+      *)
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	func_quote_for_eval "$arg"
+	arg="$func_quote_for_eval_result"
+	;;
+      esac # arg
+
+      # Now actually substitute the argument into the commands.
+      if test -n "$arg"; then
+	func_append compile_command " $arg"
+	func_append finalize_command " $arg"
+      fi
+    done # argument parsing loop
+
+    test -n "$prev" && \
+      func_fatal_help "the \`$prevarg' option requires an argument"
+
+    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+      eval arg=\"$export_dynamic_flag_spec\"
+      func_append compile_command " $arg"
+      func_append finalize_command " $arg"
+    fi
+
+    oldlibs=
+    # calculate the name of the file, without its directory
+    func_basename "$output"
+    outputname="$func_basename_result"
+    libobjs_save="$libobjs"
+
+    if test -n "$shlibpath_var"; then
+      # get the directories listed in $shlibpath_var
+      eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
+    else
+      shlib_search_path=
+    fi
+    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+    func_dirname "$output" "/" ""
+    output_objdir="$func_dirname_result$objdir"
+    func_to_tool_file "$output_objdir/"
+    tool_output_objdir=$func_to_tool_file_result
+    # Create the object directory.
+    func_mkdir_p "$output_objdir"
+
+    # Determine the type of output
+    case $output in
+    "")
+      func_fatal_help "you must specify an output file"
+      ;;
+    *.$libext) linkmode=oldlib ;;
+    *.lo | *.$objext) linkmode=obj ;;
+    *.la) linkmode=lib ;;
+    *) linkmode=prog ;; # Anything else should be a program.
+    esac
+
+    specialdeplibs=
+
+    libs=
+    # Find all interdependent deplibs by searching for libraries
+    # that are linked more than once (e.g. -la -lb -la)
+    for deplib in $deplibs; do
+      if $opt_preserve_dup_deps ; then
+	case "$libs " in
+	*" $deplib "*) func_append specialdeplibs " $deplib" ;;
+	esac
+      fi
+      func_append libs " $deplib"
+    done
+
+    if test "$linkmode" = lib; then
+      libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+      # Compute libraries that are listed more than once in $predeps
+      # $postdeps and mark them as special (i.e., whose duplicates are
+      # not to be eliminated).
+      pre_post_deps=
+      if $opt_duplicate_compiler_generated_deps; then
+	for pre_post_dep in $predeps $postdeps; do
+	  case "$pre_post_deps " in
+	  *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
+	  esac
+	  func_append pre_post_deps " $pre_post_dep"
+	done
+      fi
+      pre_post_deps=
+    fi
+
+    deplibs=
+    newdependency_libs=
+    newlib_search_path=
+    need_relink=no # whether we're linking any uninstalled libtool libraries
+    notinst_deplibs= # not-installed libtool libraries
+    notinst_path= # paths that contain not-installed libtool libraries
+
+    case $linkmode in
+    lib)
+	passes="conv dlpreopen link"
+	for file in $dlfiles $dlprefiles; do
+	  case $file in
+	  *.la) ;;
+	  *)
+	    func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
+	    ;;
+	  esac
+	done
+	;;
+    prog)
+	compile_deplibs=
+	finalize_deplibs=
+	alldeplibs=no
+	newdlfiles=
+	newdlprefiles=
+	passes="conv scan dlopen dlpreopen link"
+	;;
+    *)  passes="conv"
+	;;
+    esac
+
+    for pass in $passes; do
+      # The preopen pass in lib mode reverses $deplibs; put it back here
+      # so that -L comes before libs that need it for instance...
+      if test "$linkmode,$pass" = "lib,link"; then
+	## FIXME: Find the place where the list is rebuilt in the wrong
+	##        order, and fix it there properly
+        tmp_deplibs=
+	for deplib in $deplibs; do
+	  tmp_deplibs="$deplib $tmp_deplibs"
+	done
+	deplibs="$tmp_deplibs"
+      fi
+
+      if test "$linkmode,$pass" = "lib,link" ||
+	 test "$linkmode,$pass" = "prog,scan"; then
+	libs="$deplibs"
+	deplibs=
+      fi
+      if test "$linkmode" = prog; then
+	case $pass in
+	dlopen) libs="$dlfiles" ;;
+	dlpreopen) libs="$dlprefiles" ;;
+	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+	esac
+      fi
+      if test "$linkmode,$pass" = "lib,dlpreopen"; then
+	# Collect and forward deplibs of preopened libtool libs
+	for lib in $dlprefiles; do
+	  # Ignore non-libtool-libs
+	  dependency_libs=
+	  func_resolve_sysroot "$lib"
+	  case $lib in
+	  *.la)	func_source "$func_resolve_sysroot_result" ;;
+	  esac
+
+	  # Collect preopened libtool deplibs, except any this library
+	  # has declared as weak libs
+	  for deplib in $dependency_libs; do
+	    func_basename "$deplib"
+            deplib_base=$func_basename_result
+	    case " $weak_libs " in
+	    *" $deplib_base "*) ;;
+	    *) func_append deplibs " $deplib" ;;
+	    esac
+	  done
+	done
+	libs="$dlprefiles"
+      fi
+      if test "$pass" = dlopen; then
+	# Collect dlpreopened libraries
+	save_deplibs="$deplibs"
+	deplibs=
+      fi
+
+      for deplib in $libs; do
+	lib=
+	found=no
+	case $deplib in
+	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+        |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+	  if test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$deplib $compile_deplibs"
+	    finalize_deplibs="$deplib $finalize_deplibs"
+	  else
+	    func_append compiler_flags " $deplib"
+	    if test "$linkmode" = lib ; then
+		case "$new_inherited_linker_flags " in
+		    *" $deplib "*) ;;
+		    * ) func_append new_inherited_linker_flags " $deplib" ;;
+		esac
+	    fi
+	  fi
+	  continue
+	  ;;
+	-l*)
+	  if test "$linkmode" != lib && test "$linkmode" != prog; then
+	    func_warning "\`-l' is ignored for archives/objects"
+	    continue
+	  fi
+	  func_stripname '-l' '' "$deplib"
+	  name=$func_stripname_result
+	  if test "$linkmode" = lib; then
+	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
+	  else
+	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
+	  fi
+	  for searchdir in $searchdirs; do
+	    for search_ext in .la $std_shrext .so .a; do
+	      # Search the libtool library
+	      lib="$searchdir/lib${name}${search_ext}"
+	      if test -f "$lib"; then
+		if test "$search_ext" = ".la"; then
+		  found=yes
+		else
+		  found=no
+		fi
+		break 2
+	      fi
+	    done
+	  done
+	  if test "$found" != yes; then
+	    # deplib doesn't seem to be a libtool library
+	    if test "$linkmode,$pass" = "prog,link"; then
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      deplibs="$deplib $deplibs"
+	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    continue
+	  else # deplib is a libtool library
+	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+	    # We need to do some special things here, and not later.
+	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	      case " $predeps $postdeps " in
+	      *" $deplib "*)
+		if func_lalib_p "$lib"; then
+		  library_names=
+		  old_library=
+		  func_source "$lib"
+		  for l in $old_library $library_names; do
+		    ll="$l"
+		  done
+		  if test "X$ll" = "X$old_library" ; then # only static version available
+		    found=no
+		    func_dirname "$lib" "" "."
+		    ladir="$func_dirname_result"
+		    lib=$ladir/$old_library
+		    if test "$linkmode,$pass" = "prog,link"; then
+		      compile_deplibs="$deplib $compile_deplibs"
+		      finalize_deplibs="$deplib $finalize_deplibs"
+		    else
+		      deplibs="$deplib $deplibs"
+		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+		    fi
+		    continue
+		  fi
+		fi
+		;;
+	      *) ;;
+	      esac
+	    fi
+	  fi
+	  ;; # -l
+	*.ltframework)
+	  if test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$deplib $compile_deplibs"
+	    finalize_deplibs="$deplib $finalize_deplibs"
+	  else
+	    deplibs="$deplib $deplibs"
+	    if test "$linkmode" = lib ; then
+		case "$new_inherited_linker_flags " in
+		    *" $deplib "*) ;;
+		    * ) func_append new_inherited_linker_flags " $deplib" ;;
+		esac
+	    fi
+	  fi
+	  continue
+	  ;;
+	-L*)
+	  case $linkmode in
+	  lib)
+	    deplibs="$deplib $deplibs"
+	    test "$pass" = conv && continue
+	    newdependency_libs="$deplib $newdependency_libs"
+	    func_stripname '-L' '' "$deplib"
+	    func_resolve_sysroot "$func_stripname_result"
+	    func_append newlib_search_path " $func_resolve_sysroot_result"
+	    ;;
+	  prog)
+	    if test "$pass" = conv; then
+	      deplibs="$deplib $deplibs"
+	      continue
+	    fi
+	    if test "$pass" = scan; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    func_stripname '-L' '' "$deplib"
+	    func_resolve_sysroot "$func_stripname_result"
+	    func_append newlib_search_path " $func_resolve_sysroot_result"
+	    ;;
+	  *)
+	    func_warning "\`-L' is ignored for archives/objects"
+	    ;;
+	  esac # linkmode
+	  continue
+	  ;; # -L
+	-R*)
+	  if test "$pass" = link; then
+	    func_stripname '-R' '' "$deplib"
+	    func_resolve_sysroot "$func_stripname_result"
+	    dir=$func_resolve_sysroot_result
+	    # Make sure the xrpath contains only unique directories.
+	    case "$xrpath " in
+	    *" $dir "*) ;;
+	    *) func_append xrpath " $dir" ;;
+	    esac
+	  fi
+	  deplibs="$deplib $deplibs"
+	  continue
+	  ;;
+	*.la)
+	  func_resolve_sysroot "$deplib"
+	  lib=$func_resolve_sysroot_result
+	  ;;
+	*.$libext)
+	  if test "$pass" = conv; then
+	    deplibs="$deplib $deplibs"
+	    continue
+	  fi
+	  case $linkmode in
+	  lib)
+	    # Linking convenience modules into shared libraries is allowed,
+	    # but linking other static libraries is non-portable.
+	    case " $dlpreconveniencelibs " in
+	    *" $deplib "*) ;;
+	    *)
+	      valid_a_lib=no
+	      case $deplibs_check_method in
+		match_pattern*)
+		  set dummy $deplibs_check_method; shift
+		  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+		  if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
+		    | $EGREP "$match_pattern_regex" > /dev/null; then
+		    valid_a_lib=yes
+		  fi
+		;;
+		pass_all)
+		  valid_a_lib=yes
+		;;
+	      esac
+	      if test "$valid_a_lib" != yes; then
+		echo
+		$ECHO "*** Warning: Trying to link with static lib archive $deplib."
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because the file extensions .$libext of this argument makes me believe"
+		echo "*** that it is just a static archive that I should not use here."
+	      else
+		echo
+		$ECHO "*** Warning: Linking the shared library $output against the"
+		$ECHO "*** static library $deplib is not portable!"
+		deplibs="$deplib $deplibs"
+	      fi
+	      ;;
+	    esac
+	    continue
+	    ;;
+	  prog)
+	    if test "$pass" != link; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    continue
+	    ;;
+	  esac # linkmode
+	  ;; # *.$libext
+	*.lo | *.$objext)
+	  if test "$pass" = conv; then
+	    deplibs="$deplib $deplibs"
+	  elif test "$linkmode" = prog; then
+	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+	      # If there is no dlopen support or we're linking statically,
+	      # we need to preload.
+	      func_append newdlprefiles " $deplib"
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      func_append newdlfiles " $deplib"
+	    fi
+	  fi
+	  continue
+	  ;;
+	%DEPLIBS%)
+	  alldeplibs=yes
+	  continue
+	  ;;
+	esac # case $deplib
+
+	if test "$found" = yes || test -f "$lib"; then :
+	else
+	  func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
+	fi
+
+	# Check to see that this really is a libtool archive.
+	func_lalib_unsafe_p "$lib" \
+	  || func_fatal_error "\`$lib' is not a valid libtool archive"
+
+	func_dirname "$lib" "" "."
+	ladir="$func_dirname_result"
+
+	dlname=
+	dlopen=
+	dlpreopen=
+	libdir=
+	library_names=
+	old_library=
+	inherited_linker_flags=
+	# If the library was installed with an old release of libtool,
+	# it will not redefine variables installed, or shouldnotlink
+	installed=yes
+	shouldnotlink=no
+	avoidtemprpath=
+
+
+	# Read the .la file
+	func_source "$lib"
+
+	# Convert "-framework foo" to "foo.ltframework"
+	if test -n "$inherited_linker_flags"; then
+	  tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
+	  for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
+	    case " $new_inherited_linker_flags " in
+	      *" $tmp_inherited_linker_flag "*) ;;
+	      *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
+	    esac
+	  done
+	fi
+	dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	if test "$linkmode,$pass" = "lib,link" ||
+	   test "$linkmode,$pass" = "prog,scan" ||
+	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+	  test -n "$dlopen" && func_append dlfiles " $dlopen"
+	  test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
+	fi
+
+	if test "$pass" = conv; then
+	  # Only check for convenience libraries
+	  deplibs="$lib $deplibs"
+	  if test -z "$libdir"; then
+	    if test -z "$old_library"; then
+	      func_fatal_error "cannot find name of link library for \`$lib'"
+	    fi
+	    # It is a libtool convenience library, so add in its objects.
+	    func_append convenience " $ladir/$objdir/$old_library"
+	    func_append old_convenience " $ladir/$objdir/$old_library"
+	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
+	    func_fatal_error "\`$lib' is not a convenience library"
+	  fi
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    deplibs="$deplib $deplibs"
+	    if $opt_preserve_dup_deps ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+	      esac
+	    fi
+	    func_append tmp_libs " $deplib"
+	  done
+	  continue
+	fi # $pass = conv
+
+
+	# Get the name of the library we link against.
+	linklib=
+	if test -n "$old_library" &&
+	   { test "$prefer_static_libs" = yes ||
+	     test "$prefer_static_libs,$installed" = "built,no"; }; then
+	  linklib=$old_library
+	else
+	  for l in $old_library $library_names; do
+	    linklib="$l"
+	  done
+	fi
+	if test -z "$linklib"; then
+	  func_fatal_error "cannot find name of link library for \`$lib'"
+	fi
+
+	# This library was specified with -dlopen.
+	if test "$pass" = dlopen; then
+	  if test -z "$libdir"; then
+	    func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
+	  fi
+	  if test -z "$dlname" ||
+	     test "$dlopen_support" != yes ||
+	     test "$build_libtool_libs" = no; then
+	    # If there is no dlname, no dlopen support or we're linking
+	    # statically, we need to preload.  We also need to preload any
+	    # dependent libraries so libltdl's deplib preloader doesn't
+	    # bomb out in the load deplibs phase.
+	    func_append dlprefiles " $lib $dependency_libs"
+	  else
+	    func_append newdlfiles " $lib"
+	  fi
+	  continue
+	fi # $pass = dlopen
+
+	# We need an absolute path.
+	case $ladir in
+	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+	*)
+	  abs_ladir=`cd "$ladir" && pwd`
+	  if test -z "$abs_ladir"; then
+	    func_warning "cannot determine absolute directory name of \`$ladir'"
+	    func_warning "passing it literally to the linker, although it might fail"
+	    abs_ladir="$ladir"
+	  fi
+	  ;;
+	esac
+	func_basename "$lib"
+	laname="$func_basename_result"
+
+	# Find the relevant object directory and library name.
+	if test "X$installed" = Xyes; then
+	  if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    func_warning "library \`$lib' was moved."
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    libdir="$abs_ladir"
+	  else
+	    dir="$lt_sysroot$libdir"
+	    absdir="$lt_sysroot$libdir"
+	  fi
+	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+	else
+	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    # Remove this search path later
+	    func_append notinst_path " $abs_ladir"
+	  else
+	    dir="$ladir/$objdir"
+	    absdir="$abs_ladir/$objdir"
+	    # Remove this search path later
+	    func_append notinst_path " $abs_ladir"
+	  fi
+	fi # $installed = yes
+	func_stripname 'lib' '.la' "$laname"
+	name=$func_stripname_result
+
+	# This library was specified with -dlpreopen.
+	if test "$pass" = dlpreopen; then
+	  if test -z "$libdir" && test "$linkmode" = prog; then
+	    func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
+	  fi
+	  case "$host" in
+	    # special handling for platforms with PE-DLLs.
+	    *cygwin* | *mingw* | *cegcc* )
+	      # Linker will automatically link against shared library if both
+	      # static and shared are present.  Therefore, ensure we extract
+	      # symbols from the import library if a shared library is present
+	      # (otherwise, the dlopen module name will be incorrect).  We do
+	      # this by putting the import library name into $newdlprefiles.
+	      # We recover the dlopen module name by 'saving' the la file
+	      # name in a special purpose variable, and (later) extracting the
+	      # dlname from the la file.
+	      if test -n "$dlname"; then
+	        func_tr_sh "$dir/$linklib"
+	        eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
+	        func_append newdlprefiles " $dir/$linklib"
+	      else
+	        func_append newdlprefiles " $dir/$old_library"
+	        # Keep a list of preopened convenience libraries to check
+	        # that they are being used correctly in the link pass.
+	        test -z "$libdir" && \
+	          func_append dlpreconveniencelibs " $dir/$old_library"
+	      fi
+	    ;;
+	    * )
+	      # Prefer using a static library (so that no silly _DYNAMIC symbols
+	      # are required to link).
+	      if test -n "$old_library"; then
+	        func_append newdlprefiles " $dir/$old_library"
+	        # Keep a list of preopened convenience libraries to check
+	        # that they are being used correctly in the link pass.
+	        test -z "$libdir" && \
+	          func_append dlpreconveniencelibs " $dir/$old_library"
+	      # Otherwise, use the dlname, so that lt_dlopen finds it.
+	      elif test -n "$dlname"; then
+	        func_append newdlprefiles " $dir/$dlname"
+	      else
+	        func_append newdlprefiles " $dir/$linklib"
+	      fi
+	    ;;
+	  esac
+	fi # $pass = dlpreopen
+
+	if test -z "$libdir"; then
+	  # Link the convenience library
+	  if test "$linkmode" = lib; then
+	    deplibs="$dir/$old_library $deplibs"
+	  elif test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$dir/$old_library $compile_deplibs"
+	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
+	  else
+	    deplibs="$lib $deplibs" # used for prog,scan pass
+	  fi
+	  continue
+	fi
+
+
+	if test "$linkmode" = prog && test "$pass" != link; then
+	  func_append newlib_search_path " $ladir"
+	  deplibs="$lib $deplibs"
+
+	  linkalldeplibs=no
+	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
+	     test "$build_libtool_libs" = no; then
+	    linkalldeplibs=yes
+	  fi
+
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    case $deplib in
+	    -L*) func_stripname '-L' '' "$deplib"
+	         func_resolve_sysroot "$func_stripname_result"
+	         func_append newlib_search_path " $func_resolve_sysroot_result"
+		 ;;
+	    esac
+	    # Need to link against all dependency_libs?
+	    if test "$linkalldeplibs" = yes; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      # Need to hardcode shared library paths
+	      # or/and link against static libraries
+	      newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    if $opt_preserve_dup_deps ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+	      esac
+	    fi
+	    func_append tmp_libs " $deplib"
+	  done # for deplib
+	  continue
+	fi # $linkmode = prog...
+
+	if test "$linkmode,$pass" = "prog,link"; then
+	  if test -n "$library_names" &&
+	     { { test "$prefer_static_libs" = no ||
+	         test "$prefer_static_libs,$installed" = "built,yes"; } ||
+	       test -z "$old_library"; }; then
+	    # We need to hardcode the library path
+	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+	      # Make sure the rpath contains only unique directories.
+	      case "$temp_rpath:" in
+	      *"$absdir:"*) ;;
+	      *) func_append temp_rpath "$absdir:" ;;
+	      esac
+	    fi
+
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) func_append compile_rpath " $absdir" ;;
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) func_append finalize_rpath " $libdir" ;;
+	      esac
+	      ;;
+	    esac
+	  fi # $linkmode,$pass = prog,link...
+
+	  if test "$alldeplibs" = yes &&
+	     { test "$deplibs_check_method" = pass_all ||
+	       { test "$build_libtool_libs" = yes &&
+		 test -n "$library_names"; }; }; then
+	    # We only need to search for static libraries
+	    continue
+	  fi
+	fi
+
+	link_static=no # Whether the deplib will be linked statically
+	use_static_libs=$prefer_static_libs
+	if test "$use_static_libs" = built && test "$installed" = yes; then
+	  use_static_libs=no
+	fi
+	if test -n "$library_names" &&
+	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
+	  case $host in
+	  *cygwin* | *mingw* | *cegcc*)
+	      # No point in relinking DLLs because paths are not encoded
+	      func_append notinst_deplibs " $lib"
+	      need_relink=no
+	    ;;
+	  *)
+	    if test "$installed" = no; then
+	      func_append notinst_deplibs " $lib"
+	      need_relink=yes
+	    fi
+	    ;;
+	  esac
+	  # This is a shared library
+
+	  # Warn about portability, can't link against -module's on some
+	  # systems (darwin).  Don't bleat about dlopened modules though!
+	  dlopenmodule=""
+	  for dlpremoduletest in $dlprefiles; do
+	    if test "X$dlpremoduletest" = "X$lib"; then
+	      dlopenmodule="$dlpremoduletest"
+	      break
+	    fi
+	  done
+	  if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
+	    echo
+	    if test "$linkmode" = prog; then
+	      $ECHO "*** Warning: Linking the executable $output against the loadable module"
+	    else
+	      $ECHO "*** Warning: Linking the shared library $output against the loadable module"
+	    fi
+	    $ECHO "*** $linklib is not portable!"
+	  fi
+	  if test "$linkmode" = lib &&
+	     test "$hardcode_into_libs" = yes; then
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) func_append compile_rpath " $absdir" ;;
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) func_append finalize_rpath " $libdir" ;;
+	      esac
+	      ;;
+	    esac
+	  fi
+
+	  if test -n "$old_archive_from_expsyms_cmds"; then
+	    # figure out the soname
+	    set dummy $library_names
+	    shift
+	    realname="$1"
+	    shift
+	    libname=`eval "\\$ECHO \"$libname_spec\""`
+	    # use dlname if we got it. it's perfectly good, no?
+	    if test -n "$dlname"; then
+	      soname="$dlname"
+	    elif test -n "$soname_spec"; then
+	      # bleh windows
+	      case $host in
+	      *cygwin* | mingw* | *cegcc*)
+	        func_arith $current - $age
+		major=$func_arith_result
+		versuffix="-$major"
+		;;
+	      esac
+	      eval soname=\"$soname_spec\"
+	    else
+	      soname="$realname"
+	    fi
+
+	    # Make a new name for the extract_expsyms_cmds to use
+	    soroot="$soname"
+	    func_basename "$soroot"
+	    soname="$func_basename_result"
+	    func_stripname 'lib' '.dll' "$soname"
+	    newlib=libimp-$func_stripname_result.a
+
+	    # If the library has no export list, then create one now
+	    if test -f "$output_objdir/$soname-def"; then :
+	    else
+	      func_verbose "extracting exported symbol list from \`$soname'"
+	      func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
+	    fi
+
+	    # Create $newlib
+	    if test -f "$output_objdir/$newlib"; then :; else
+	      func_verbose "generating import library for \`$soname'"
+	      func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
+	    fi
+	    # make sure the library variables are pointing to the new library
+	    dir=$output_objdir
+	    linklib=$newlib
+	  fi # test -n "$old_archive_from_expsyms_cmds"
+
+	  if test "$linkmode" = prog || test "$opt_mode" != relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    lib_linked=yes
+	    case $hardcode_action in
+	    immediate | unsupported)
+	      if test "$hardcode_direct" = no; then
+		add="$dir/$linklib"
+		case $host in
+		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
+		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
+		    *-*-unixware7*) add_dir="-L$dir" ;;
+		  *-*-darwin* )
+		    # if the lib is a (non-dlopened) module then we can not
+		    # link against it, someone is ignoring the earlier warnings
+		    if /usr/bin/file -L $add 2> /dev/null |
+			 $GREP ": [^:]* bundle" >/dev/null ; then
+		      if test "X$dlopenmodule" != "X$lib"; then
+			$ECHO "*** Warning: lib $linklib is a module, not a shared library"
+			if test -z "$old_library" ; then
+			  echo
+			  echo "*** And there doesn't seem to be a static archive available"
+			  echo "*** The link will probably fail, sorry"
+			else
+			  add="$dir/$old_library"
+			fi
+		      elif test -n "$old_library"; then
+			add="$dir/$old_library"
+		      fi
+		    fi
+		esac
+	      elif test "$hardcode_minus_L" = no; then
+		case $host in
+		*-*-sunos*) add_shlibpath="$dir" ;;
+		esac
+		add_dir="-L$dir"
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = no; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    relink)
+	      if test "$hardcode_direct" = yes &&
+	         test "$hardcode_direct_absolute" = no; then
+		add="$dir/$linklib"
+	      elif test "$hardcode_minus_L" = yes; then
+		add_dir="-L$absdir"
+		# Try looking first in the location we're being installed to.
+		if test -n "$inst_prefix_dir"; then
+		  case $libdir in
+		    [\\/]*)
+		      func_append add_dir " -L$inst_prefix_dir$libdir"
+		      ;;
+		  esac
+		fi
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = yes; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    *) lib_linked=no ;;
+	    esac
+
+	    if test "$lib_linked" != yes; then
+	      func_fatal_configuration "unsupported hardcode properties"
+	    fi
+
+	    if test -n "$add_shlibpath"; then
+	      case :$compile_shlibpath: in
+	      *":$add_shlibpath:"*) ;;
+	      *) func_append compile_shlibpath "$add_shlibpath:" ;;
+	      esac
+	    fi
+	    if test "$linkmode" = prog; then
+	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	      if test "$hardcode_direct" != yes &&
+		 test "$hardcode_minus_L" != yes &&
+		 test "$hardcode_shlibpath_var" = yes; then
+		case :$finalize_shlibpath: in
+		*":$libdir:"*) ;;
+		*) func_append finalize_shlibpath "$libdir:" ;;
+		esac
+	      fi
+	    fi
+	  fi
+
+	  if test "$linkmode" = prog || test "$opt_mode" = relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    # Finalize command for both is simple: just hardcode it.
+	    if test "$hardcode_direct" = yes &&
+	       test "$hardcode_direct_absolute" = no; then
+	      add="$libdir/$linklib"
+	    elif test "$hardcode_minus_L" = yes; then
+	      add_dir="-L$libdir"
+	      add="-l$name"
+	    elif test "$hardcode_shlibpath_var" = yes; then
+	      case :$finalize_shlibpath: in
+	      *":$libdir:"*) ;;
+	      *) func_append finalize_shlibpath "$libdir:" ;;
+	      esac
+	      add="-l$name"
+	    elif test "$hardcode_automatic" = yes; then
+	      if test -n "$inst_prefix_dir" &&
+		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
+		add="$inst_prefix_dir$libdir/$linklib"
+	      else
+		add="$libdir/$linklib"
+	      fi
+	    else
+	      # We cannot seem to hardcode it, guess we'll fake it.
+	      add_dir="-L$libdir"
+	      # Try looking first in the location we're being installed to.
+	      if test -n "$inst_prefix_dir"; then
+		case $libdir in
+		  [\\/]*)
+		    func_append add_dir " -L$inst_prefix_dir$libdir"
+		    ;;
+		esac
+	      fi
+	      add="-l$name"
+	    fi
+
+	    if test "$linkmode" = prog; then
+	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	    fi
+	  fi
+	elif test "$linkmode" = prog; then
+	  # Here we assume that one of hardcode_direct or hardcode_minus_L
+	  # is not unsupported.  This is valid on all known static and
+	  # shared platforms.
+	  if test "$hardcode_direct" != unsupported; then
+	    test -n "$old_library" && linklib="$old_library"
+	    compile_deplibs="$dir/$linklib $compile_deplibs"
+	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
+	  else
+	    compile_deplibs="-l$name -L$dir $compile_deplibs"
+	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+	  fi
+	elif test "$build_libtool_libs" = yes; then
+	  # Not a shared library
+	  if test "$deplibs_check_method" != pass_all; then
+	    # We're trying link a shared library against a static one
+	    # but the system doesn't support it.
+
+	    # Just print a warning and add the library to dependency_libs so
+	    # that the program can be linked against the static library.
+	    echo
+	    $ECHO "*** Warning: This system can not link to static lib archive $lib."
+	    echo "*** I have the capability to make that library automatically link in when"
+	    echo "*** you link to this library.  But I can only do this if you have a"
+	    echo "*** shared version of the library, which you do not appear to have."
+	    if test "$module" = yes; then
+	      echo "*** But as you try to build a module library, libtool will still create "
+	      echo "*** a static module, that should work as long as the dlopening application"
+	      echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+	      if test -z "$global_symbol_pipe"; then
+		echo
+		echo "*** However, this would only work if libtool was able to extract symbol"
+		echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+		echo "*** not find such a program.  So, this module is probably useless."
+		echo "*** \`nm' from GNU binutils and a full rebuild may help."
+	      fi
+	      if test "$build_old_libs" = no; then
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  else
+	    deplibs="$dir/$old_library $deplibs"
+	    link_static=yes
+	  fi
+	fi # link shared/static library?
+
+	if test "$linkmode" = lib; then
+	  if test -n "$dependency_libs" &&
+	     { test "$hardcode_into_libs" != yes ||
+	       test "$build_old_libs" = yes ||
+	       test "$link_static" = yes; }; then
+	    # Extract -R from dependency_libs
+	    temp_deplibs=
+	    for libdir in $dependency_libs; do
+	      case $libdir in
+	      -R*) func_stripname '-R' '' "$libdir"
+	           temp_xrpath=$func_stripname_result
+		   case " $xrpath " in
+		   *" $temp_xrpath "*) ;;
+		   *) func_append xrpath " $temp_xrpath";;
+		   esac;;
+	      *) func_append temp_deplibs " $libdir";;
+	      esac
+	    done
+	    dependency_libs="$temp_deplibs"
+	  fi
+
+	  func_append newlib_search_path " $absdir"
+	  # Link against this library
+	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+	  # ... and its dependency_libs
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    newdependency_libs="$deplib $newdependency_libs"
+	    case $deplib in
+              -L*) func_stripname '-L' '' "$deplib"
+                   func_resolve_sysroot "$func_stripname_result";;
+              *) func_resolve_sysroot "$deplib" ;;
+            esac
+	    if $opt_preserve_dup_deps ; then
+	      case "$tmp_libs " in
+	      *" $func_resolve_sysroot_result "*)
+                func_append specialdeplibs " $func_resolve_sysroot_result" ;;
+	      esac
+	    fi
+	    func_append tmp_libs " $func_resolve_sysroot_result"
+	  done
+
+	  if test "$link_all_deplibs" != no; then
+	    # Add the search paths of all dependency libraries
+	    for deplib in $dependency_libs; do
+	      path=
+	      case $deplib in
+	      -L*) path="$deplib" ;;
+	      *.la)
+	        func_resolve_sysroot "$deplib"
+	        deplib=$func_resolve_sysroot_result
+	        func_dirname "$deplib" "" "."
+		dir=$func_dirname_result
+		# We need an absolute path.
+		case $dir in
+		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+		*)
+		  absdir=`cd "$dir" && pwd`
+		  if test -z "$absdir"; then
+		    func_warning "cannot determine absolute directory name of \`$dir'"
+		    absdir="$dir"
+		  fi
+		  ;;
+		esac
+		if $GREP "^installed=no" $deplib > /dev/null; then
+		case $host in
+		*-*-darwin*)
+		  depdepl=
+		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+		  if test -n "$deplibrary_names" ; then
+		    for tmp in $deplibrary_names ; do
+		      depdepl=$tmp
+		    done
+		    if test -f "$absdir/$objdir/$depdepl" ; then
+		      depdepl="$absdir/$objdir/$depdepl"
+		      darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
+                      if test -z "$darwin_install_name"; then
+                          darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
+                      fi
+		      func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
+		      func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
+		      path=
+		    fi
+		  fi
+		  ;;
+		*)
+		  path="-L$absdir/$objdir"
+		  ;;
+		esac
+		else
+		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		  test -z "$libdir" && \
+		    func_fatal_error "\`$deplib' is not a valid libtool archive"
+		  test "$absdir" != "$libdir" && \
+		    func_warning "\`$deplib' seems to be moved"
+
+		  path="-L$absdir"
+		fi
+		;;
+	      esac
+	      case " $deplibs " in
+	      *" $path "*) ;;
+	      *) deplibs="$path $deplibs" ;;
+	      esac
+	    done
+	  fi # link_all_deplibs != no
+	fi # linkmode = lib
+      done # for deplib in $libs
+      if test "$pass" = link; then
+	if test "$linkmode" = "prog"; then
+	  compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
+	  finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
+	else
+	  compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	fi
+      fi
+      dependency_libs="$newdependency_libs"
+      if test "$pass" = dlpreopen; then
+	# Link the dlpreopened libraries before other libraries
+	for deplib in $save_deplibs; do
+	  deplibs="$deplib $deplibs"
+	done
+      fi
+      if test "$pass" != dlopen; then
+	if test "$pass" != conv; then
+	  # Make sure lib_search_path contains only unique directories.
+	  lib_search_path=
+	  for dir in $newlib_search_path; do
+	    case "$lib_search_path " in
+	    *" $dir "*) ;;
+	    *) func_append lib_search_path " $dir" ;;
+	    esac
+	  done
+	  newlib_search_path=
+	fi
+
+	if test "$linkmode,$pass" != "prog,link"; then
+	  vars="deplibs"
+	else
+	  vars="compile_deplibs finalize_deplibs"
+	fi
+	for var in $vars dependency_libs; do
+	  # Add libraries to $var in reverse order
+	  eval tmp_libs=\"\$$var\"
+	  new_libs=
+	  for deplib in $tmp_libs; do
+	    # FIXME: Pedantically, this is the right thing to do, so
+	    #        that some nasty dependency loop isn't accidentally
+	    #        broken:
+	    #new_libs="$deplib $new_libs"
+	    # Pragmatically, this seems to cause very few problems in
+	    # practice:
+	    case $deplib in
+	    -L*) new_libs="$deplib $new_libs" ;;
+	    -R*) ;;
+	    *)
+	      # And here is the reason: when a library appears more
+	      # than once as an explicit dependence of a library, or
+	      # is implicitly linked in more than once by the
+	      # compiler, it is considered special, and multiple
+	      # occurrences thereof are not removed.  Compare this
+	      # with having the same library being listed as a
+	      # dependency of multiple other libraries: in this case,
+	      # we know (pedantically, we assume) the library does not
+	      # need to be listed more than once, so we keep only the
+	      # last copy.  This is not always right, but it is rare
+	      # enough that we require users that really mean to play
+	      # such unportable linking tricks to link the library
+	      # using -Wl,-lname, so that libtool does not consider it
+	      # for duplicate removal.
+	      case " $specialdeplibs " in
+	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
+	      *)
+		case " $new_libs " in
+		*" $deplib "*) ;;
+		*) new_libs="$deplib $new_libs" ;;
+		esac
+		;;
+	      esac
+	      ;;
+	    esac
+	  done
+	  tmp_libs=
+	  for deplib in $new_libs; do
+	    case $deplib in
+	    -L*)
+	      case " $tmp_libs " in
+	      *" $deplib "*) ;;
+	      *) func_append tmp_libs " $deplib" ;;
+	      esac
+	      ;;
+	    *) func_append tmp_libs " $deplib" ;;
+	    esac
+	  done
+	  eval $var=\"$tmp_libs\"
+	done # for var
+      fi
+      # Last step: remove runtime libs from dependency_libs
+      # (they stay in deplibs)
+      tmp_libs=
+      for i in $dependency_libs ; do
+	case " $predeps $postdeps $compiler_lib_search_path " in
+	*" $i "*)
+	  i=""
+	  ;;
+	esac
+	if test -n "$i" ; then
+	  func_append tmp_libs " $i"
+	fi
+      done
+      dependency_libs=$tmp_libs
+    done # for pass
+    if test "$linkmode" = prog; then
+      dlfiles="$newdlfiles"
+    fi
+    if test "$linkmode" = prog || test "$linkmode" = lib; then
+      dlprefiles="$newdlprefiles"
+    fi
+
+    case $linkmode in
+    oldlib)
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	func_warning "\`-dlopen' is ignored for archives"
+      fi
+
+      case " $deplibs" in
+      *\ -l* | *\ -L*)
+	func_warning "\`-l' and \`-L' are ignored for archives" ;;
+      esac
+
+      test -n "$rpath" && \
+	func_warning "\`-rpath' is ignored for archives"
+
+      test -n "$xrpath" && \
+	func_warning "\`-R' is ignored for archives"
+
+      test -n "$vinfo" && \
+	func_warning "\`-version-info/-version-number' is ignored for archives"
+
+      test -n "$release" && \
+	func_warning "\`-release' is ignored for archives"
+
+      test -n "$export_symbols$export_symbols_regex" && \
+	func_warning "\`-export-symbols' is ignored for archives"
+
+      # Now set the variables for building old libraries.
+      build_libtool_libs=no
+      oldlibs="$output"
+      func_append objs "$old_deplibs"
+      ;;
+
+    lib)
+      # Make sure we only generate libraries of the form `libNAME.la'.
+      case $outputname in
+      lib*)
+	func_stripname 'lib' '.la' "$outputname"
+	name=$func_stripname_result
+	eval shared_ext=\"$shrext_cmds\"
+	eval libname=\"$libname_spec\"
+	;;
+      *)
+	test "$module" = no && \
+	  func_fatal_help "libtool library \`$output' must begin with \`lib'"
+
+	if test "$need_lib_prefix" != no; then
+	  # Add the "lib" prefix for modules if required
+	  func_stripname '' '.la' "$outputname"
+	  name=$func_stripname_result
+	  eval shared_ext=\"$shrext_cmds\"
+	  eval libname=\"$libname_spec\"
+	else
+	  func_stripname '' '.la' "$outputname"
+	  libname=$func_stripname_result
+	fi
+	;;
+      esac
+
+      if test -n "$objs"; then
+	if test "$deplibs_check_method" != pass_all; then
+	  func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
+	else
+	  echo
+	  $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
+	  $ECHO "*** objects $objs is not portable!"
+	  func_append libobjs " $objs"
+	fi
+      fi
+
+      test "$dlself" != no && \
+	func_warning "\`-dlopen self' is ignored for libtool libraries"
+
+      set dummy $rpath
+      shift
+      test "$#" -gt 1 && \
+	func_warning "ignoring multiple \`-rpath's for a libtool library"
+
+      install_libdir="$1"
+
+      oldlibs=
+      if test -z "$rpath"; then
+	if test "$build_libtool_libs" = yes; then
+	  # Building a libtool convenience library.
+	  # Some compilers have problems with a `.al' extension so
+	  # convenience libraries should have the same extension an
+	  # archive normally would.
+	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
+	  build_libtool_libs=convenience
+	  build_old_libs=yes
+	fi
+
+	test -n "$vinfo" && \
+	  func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
+
+	test -n "$release" && \
+	  func_warning "\`-release' is ignored for convenience libraries"
+      else
+
+	# Parse the version information argument.
+	save_ifs="$IFS"; IFS=':'
+	set dummy $vinfo 0 0 0
+	shift
+	IFS="$save_ifs"
+
+	test -n "$7" && \
+	  func_fatal_help "too many parameters to \`-version-info'"
+
+	# convert absolute version numbers to libtool ages
+	# this retains compatibility with .la files and attempts
+	# to make the code below a bit more comprehensible
+
+	case $vinfo_number in
+	yes)
+	  number_major="$1"
+	  number_minor="$2"
+	  number_revision="$3"
+	  #
+	  # There are really only two kinds -- those that
+	  # use the current revision as the major version
+	  # and those that subtract age and use age as
+	  # a minor version.  But, then there is irix
+	  # which has an extra 1 added just for fun
+	  #
+	  case $version_type in
+	  # correct linux to gnu/linux during the next big refactor
+	  darwin|linux|osf|windows|none)
+	    func_arith $number_major + $number_minor
+	    current=$func_arith_result
+	    age="$number_minor"
+	    revision="$number_revision"
+	    ;;
+	  freebsd-aout|freebsd-elf|qnx|sunos)
+	    current="$number_major"
+	    revision="$number_minor"
+	    age="0"
+	    ;;
+	  irix|nonstopux)
+	    func_arith $number_major + $number_minor
+	    current=$func_arith_result
+	    age="$number_minor"
+	    revision="$number_minor"
+	    lt_irix_increment=no
+	    ;;
+	  esac
+	  ;;
+	no)
+	  current="$1"
+	  revision="$2"
+	  age="$3"
+	  ;;
+	esac
+
+	# Check that each of the things are valid numbers.
+	case $current in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  func_error "CURRENT \`$current' must be a nonnegative integer"
+	  func_fatal_error "\`$vinfo' is not valid version information"
+	  ;;
+	esac
+
+	case $revision in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  func_error "REVISION \`$revision' must be a nonnegative integer"
+	  func_fatal_error "\`$vinfo' is not valid version information"
+	  ;;
+	esac
+
+	case $age in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  func_error "AGE \`$age' must be a nonnegative integer"
+	  func_fatal_error "\`$vinfo' is not valid version information"
+	  ;;
+	esac
+
+	if test "$age" -gt "$current"; then
+	  func_error "AGE \`$age' is greater than the current interface number \`$current'"
+	  func_fatal_error "\`$vinfo' is not valid version information"
+	fi
+
+	# Calculate the version variables.
+	major=
+	versuffix=
+	versuffix2=
+	verstring=
+	case $version_type in
+	none) ;;
+
+	darwin)
+	  # Like Linux, but with the current version available in
+	  # verstring for coding it into the library header
+	  func_arith $current - $age
+	  major=.$func_arith_result
+	  versuffix="$major.$age.$revision"
+	  # Darwin ld doesn't like 0 for these options...
+	  func_arith $current + 1
+	  minor_current=$func_arith_result
+	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+	  ;;
+
+	freebsd-aout)
+	  major=".$current"
+	  versuffix=".$current.$revision";
+	  ;;
+
+	freebsd-elf)
+	  major=".$current"
+	  versuffix=".$current"
+	  ;;
+
+	irix | nonstopux)
+	  if test "X$lt_irix_increment" = "Xno"; then
+	    func_arith $current - $age
+	  else
+	    func_arith $current - $age + 1
+	  fi
+	  major=$func_arith_result
+
+	  case $version_type in
+	    nonstopux) verstring_prefix=nonstopux ;;
+	    *)         verstring_prefix=sgi ;;
+	  esac
+	  verstring="$verstring_prefix$major.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$revision
+	  while test "$loop" -ne 0; do
+	    func_arith $revision - $loop
+	    iface=$func_arith_result
+	    func_arith $loop - 1
+	    loop=$func_arith_result
+	    verstring="$verstring_prefix$major.$iface:$verstring"
+	  done
+
+	  # Before this point, $major must not contain `.'.
+	  major=.$major
+	  versuffix="$major.$revision"
+	  ;;
+
+	linux) # correct to gnu/linux during the next big refactor
+	  func_arith $current - $age
+	  major=.$func_arith_result
+	  versuffix="$major.$age.$revision"
+	  versuffix2="$major.$age"
+	  ;;
+
+	osf)
+	  func_arith $current - $age
+	  major=.$func_arith_result
+	  versuffix=".$current.$age.$revision"
+	  verstring="$current.$age.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$age
+	  while test "$loop" -ne 0; do
+	    func_arith $current - $loop
+	    iface=$func_arith_result
+	    func_arith $loop - 1
+	    loop=$func_arith_result
+	    verstring="$verstring:${iface}.0"
+	  done
+
+	  # Make executables depend on our current version.
+	  func_append verstring ":${current}.0"
+	  ;;
+
+	qnx)
+	  major=".$current"
+	  versuffix=".$current"
+	  ;;
+
+	sunos)
+	  major=".$current"
+	  versuffix=".$current.$revision"
+	  ;;
+
+	windows)
+	  # Use '-' rather than '.', since we only want one
+	  # extension on DOS 8.3 filesystems.
+	  func_arith $current - $age
+	  major=$func_arith_result
+	  versuffix="-$major"
+	  ;;
+
+	*)
+	  func_fatal_configuration "unknown library version type \`$version_type'"
+	  ;;
+	esac
+
+	# Clear the version info if we defaulted, and they specified a release.
+	if test -z "$vinfo" && test -n "$release"; then
+	  major=
+	  case $version_type in
+	  darwin)
+	    # we can't check for "0.0" in archive_cmds due to quoting
+	    # problems, so we reset it completely
+	    verstring=
+	    ;;
+	  *)
+	    verstring="0.0"
+	    ;;
+	  esac
+	  if test "$need_version" = no; then
+	    versuffix=
+	    versuffix2=
+	  else
+	    versuffix=".0.0"
+	    versuffix2=".0.0"
+	  fi
+	fi
+
+	# Remove version info from name if versioning should be avoided
+	if test "$avoid_version" = yes && test "$need_version" = no; then
+	  major=
+	  versuffix=
+	  versuffix2=
+	  verstring=""
+	fi
+
+	# Check to see if the archive will have undefined symbols.
+	if test "$allow_undefined" = yes; then
+	  if test "$allow_undefined_flag" = unsupported; then
+	    func_warning "undefined symbols not allowed in $host shared libraries"
+	    build_libtool_libs=no
+	    build_old_libs=yes
+	  fi
+	else
+	  # Don't allow undefined symbols.
+	  allow_undefined_flag="$no_undefined_flag"
+	fi
+
+      fi
+
+      func_generate_dlsyms "$libname" "$libname" "yes"
+      func_append libobjs " $symfileobj"
+      test "X$libobjs" = "X " && libobjs=
+
+      if test "$opt_mode" != relink; then
+	# Remove our outputs, but don't remove object files since they
+	# may have been created when compiling PIC objects.
+	removelist=
+	tempremovelist=`$ECHO "$output_objdir/*"`
+	for p in $tempremovelist; do
+	  case $p in
+	    *.$objext | *.gcno)
+	       ;;
+	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+	       if test "X$precious_files_regex" != "X"; then
+		 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+		 then
+		   continue
+		 fi
+	       fi
+	       func_append removelist " $p"
+	       ;;
+	    *) ;;
+	  esac
+	done
+	test -n "$removelist" && \
+	  func_show_eval "${RM}r \$removelist"
+      fi
+
+      # Now set the variables for building old libraries.
+      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+	func_append oldlibs " $output_objdir/$libname.$libext"
+
+	# Transform .lo files to .o files.
+	oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
+      fi
+
+      # Eliminate all temporary directories.
+      #for path in $notinst_path; do
+      #	lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
+      #	deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
+      #	dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
+      #done
+
+      if test -n "$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	temp_xrpath=
+	for libdir in $xrpath; do
+	  func_replace_sysroot "$libdir"
+	  func_append temp_xrpath " -R$func_replace_sysroot_result"
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) func_append finalize_rpath " $libdir" ;;
+	  esac
+	done
+	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+	  dependency_libs="$temp_xrpath $dependency_libs"
+	fi
+      fi
+
+      # Make sure dlfiles contains only unique files that won't be dlpreopened
+      old_dlfiles="$dlfiles"
+      dlfiles=
+      for lib in $old_dlfiles; do
+	case " $dlprefiles $dlfiles " in
+	*" $lib "*) ;;
+	*) func_append dlfiles " $lib" ;;
+	esac
+      done
+
+      # Make sure dlprefiles contains only unique files
+      old_dlprefiles="$dlprefiles"
+      dlprefiles=
+      for lib in $old_dlprefiles; do
+	case "$dlprefiles " in
+	*" $lib "*) ;;
+	*) func_append dlprefiles " $lib" ;;
+	esac
+      done
+
+      if test "$build_libtool_libs" = yes; then
+	if test -n "$rpath"; then
+	  case $host in
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
+	    # these systems don't actually have a c library (as such)!
+	    ;;
+	  *-*-rhapsody* | *-*-darwin1.[012])
+	    # Rhapsody C library is in the System framework
+	    func_append deplibs " System.ltframework"
+	    ;;
+	  *-*-netbsd*)
+	    # Don't link with libc until the a.out ld.so is fixed.
+	    ;;
+	  *-*-openbsd* | *-*-mirbsd* | *-*-freebsd* | *-*-dragonfly*)
+	    # Do not include libc due to us having libc/libc_r.
+	    ;;
+	  *-*-sco3.2v5* | *-*-sco5v6*)
+	    # Causes problems with __ctype
+	    ;;
+	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+	    # Compiler inserts libc in the correct place for threads to work
+	    ;;
+	  *)
+	    # Add libc to deplibs on all other systems if necessary.
+	    if test "$build_libtool_need_lc" = "yes"; then
+	      func_append deplibs " -lc"
+	    fi
+	    ;;
+	  esac
+	fi
+
+	# Transform deplibs into only deplibs that can be linked in shared.
+	name_save=$name
+	libname_save=$libname
+	release_save=$release
+	versuffix_save=$versuffix
+	versuffix2_save=$versuffix2
+	major_save=$major
+	# I'm not sure if I'm treating the release correctly.  I think
+	# release should show up in the -l (ie -lgmp5) so we don't want to
+	# add it in twice.  Is that correct?
+	release=""
+	versuffix=""
+	versuffix2=""
+	major=""
+	newdeplibs=
+	droppeddeps=no
+	case $deplibs_check_method in
+	pass_all)
+	  # Don't check for shared/static.  Everything works.
+	  # This might be a little naive.  We might want to check
+	  # whether the library exists or not.  But this is on
+	  # osf3 & osf4 and I'm not really sure... Just
+	  # implementing what was already the behavior.
+	  newdeplibs=$deplibs
+	  ;;
+	test_compile)
+	  # This code stresses the "libraries are programs" paradigm to its
+	  # limits. Maybe even breaks it.  We compile a program, linking it
+	  # against the deplibs as a proxy for the library.  Then we can check
+	  # whether they linked in statically or dynamically with ldd.
+	  $opt_dry_run || $RM conftest.c
+	  cat > conftest.c </dev/null`
+		    $nocaseglob
+		  else
+		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+		  fi
+		  for potent_lib in $potential_libs; do
+		      # Follow soft links.
+		      if ls -lLd "$potent_lib" 2>/dev/null |
+			 $GREP " -> " >/dev/null; then
+			continue
+		      fi
+		      # The statement above tries to avoid entering an
+		      # endless loop below, in case of cyclic links.
+		      # We might still enter an endless loop, since a link
+		      # loop can be closed while we follow links,
+		      # but so what?
+		      potlib="$potent_lib"
+		      while test -h "$potlib" 2>/dev/null; do
+			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+			case $potliblink in
+			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+			*) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
+			esac
+		      done
+		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
+			 $SED -e 10q |
+			 $EGREP "$file_magic_regex" > /dev/null; then
+			func_append newdeplibs " $a_deplib"
+			a_deplib=""
+			break 2
+		      fi
+		  done
+		done
+	      fi
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		echo
+		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
+		else
+		  $ECHO "*** with $libname and none of the candidates passed a file format test"
+		  $ECHO "*** using a file magic. Last file checked: $potlib"
+		fi
+	      fi
+	      ;;
+	    *)
+	      # Add a -L argument.
+	      func_append newdeplibs " $a_deplib"
+	      ;;
+	    esac
+	  done # Gone through all deplibs.
+	  ;;
+	match_pattern*)
+	  set dummy $deplibs_check_method; shift
+	  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    case $a_deplib in
+	    -l*)
+	      func_stripname -l '' "$a_deplib"
+	      name=$func_stripname_result
+	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		case " $predeps $postdeps " in
+		*" $a_deplib "*)
+		  func_append newdeplibs " $a_deplib"
+		  a_deplib=""
+		  ;;
+		esac
+	      fi
+	      if test -n "$a_deplib" ; then
+		libname=`eval "\\$ECHO \"$libname_spec\""`
+		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		  for potent_lib in $potential_libs; do
+		    potlib="$potent_lib" # see symlink-check above in file_magic test
+		    if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
+		       $EGREP "$match_pattern_regex" > /dev/null; then
+		      func_append newdeplibs " $a_deplib"
+		      a_deplib=""
+		      break 2
+		    fi
+		  done
+		done
+	      fi
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		echo
+		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
+		else
+		  $ECHO "*** with $libname and none of the candidates passed a file format test"
+		  $ECHO "*** using a regex pattern. Last file checked: $potlib"
+		fi
+	      fi
+	      ;;
+	    *)
+	      # Add a -L argument.
+	      func_append newdeplibs " $a_deplib"
+	      ;;
+	    esac
+	  done # Gone through all deplibs.
+	  ;;
+	none | unknown | *)
+	  newdeplibs=""
+	  tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
+	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	    for i in $predeps $postdeps ; do
+	      # can't use Xsed below, because $i might contain '/'
+	      tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
+	    done
+	  fi
+	  case $tmp_deplibs in
+	  *[!\	\ ]*)
+	    echo
+	    if test "X$deplibs_check_method" = "Xnone"; then
+	      echo "*** Warning: inter-library dependencies are not supported in this platform."
+	    else
+	      echo "*** Warning: inter-library dependencies are not known to be supported."
+	    fi
+	    echo "*** All declared inter-library dependencies are being dropped."
+	    droppeddeps=yes
+	    ;;
+	  esac
+	  ;;
+	esac
+	versuffix=$versuffix_save
+	versuffix2=$versuffix2_save
+	major=$major_save
+	release=$release_save
+	libname=$libname_save
+	name=$name_save
+
+	case $host in
+	*-*-rhapsody* | *-*-darwin1.[012])
+	  # On Rhapsody replace the C library with the System framework
+	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
+	  ;;
+	esac
+
+	if test "$droppeddeps" = yes; then
+	  if test "$module" = yes; then
+	    echo
+	    echo "*** Warning: libtool could not satisfy all declared inter-library"
+	    $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
+	    echo "*** a static module, that should work as long as the dlopening"
+	    echo "*** application is linked with the -dlopen flag."
+	    if test -z "$global_symbol_pipe"; then
+	      echo
+	      echo "*** However, this would only work if libtool was able to extract symbol"
+	      echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+	      echo "*** not find such a program.  So, this module is probably useless."
+	      echo "*** \`nm' from GNU binutils and a full rebuild may help."
+	    fi
+	    if test "$build_old_libs" = no; then
+	      oldlibs="$output_objdir/$libname.$libext"
+	      build_libtool_libs=module
+	      build_old_libs=yes
+	    else
+	      build_libtool_libs=no
+	    fi
+	  else
+	    echo "*** The inter-library dependencies that have been dropped here will be"
+	    echo "*** automatically added whenever a program is linked with this library"
+	    echo "*** or is declared to -dlopen it."
+
+	    if test "$allow_undefined" = no; then
+	      echo
+	      echo "*** Since this library must not contain undefined symbols,"
+	      echo "*** because either the platform does not support them or"
+	      echo "*** it was explicitly requested with -no-undefined,"
+	      echo "*** libtool will only create a static version of it."
+	      if test "$build_old_libs" = no; then
+		oldlibs="$output_objdir/$libname.$libext"
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  fi
+	fi
+	# Done checking deplibs!
+	deplibs=$newdeplibs
+      fi
+      # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+      case $host in
+	*-*-darwin*)
+	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  ;;
+      esac
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+	case " $new_libs " in
+	*" -L$path/$objdir "*) ;;
+	*)
+	  case " $deplibs " in
+	  *" -L$path/$objdir "*)
+	    func_append new_libs " -L$path/$objdir" ;;
+	  esac
+	  ;;
+	esac
+      done
+      for deplib in $deplibs; do
+	case $deplib in
+	-L*)
+	  case " $new_libs " in
+	  *" $deplib "*) ;;
+	  *) func_append new_libs " $deplib" ;;
+	  esac
+	  ;;
+	*) func_append new_libs " $deplib" ;;
+	esac
+      done
+      deplibs="$new_libs"
+
+      # All the library-specific variables (install_libdir is set above).
+      library_names=
+      old_library=
+      dlname=
+
+      # Test again, we may have decided not to build it any more
+      if test "$build_libtool_libs" = yes; then
+	# Remove ${wl} instances when linking with ld.
+	# FIXME: should test the right _cmds variable.
+	case $archive_cmds in
+	  *\$LD\ *) wl= ;;
+        esac
+	if test "$hardcode_into_libs" = yes; then
+	  # Hardcode the library paths
+	  hardcode_libdirs=
+	  dep_rpath=
+	  rpath="$finalize_rpath"
+	  test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
+	  for libdir in $rpath; do
+	    if test -n "$hardcode_libdir_flag_spec"; then
+	      if test -n "$hardcode_libdir_separator"; then
+		func_replace_sysroot "$libdir"
+		libdir=$func_replace_sysroot_result
+		if test -z "$hardcode_libdirs"; then
+		  hardcode_libdirs="$libdir"
+		else
+		  # Just accumulate the unique libdirs.
+		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		    ;;
+		  *)
+		    func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+		    ;;
+		  esac
+		fi
+	      else
+		eval flag=\"$hardcode_libdir_flag_spec\"
+		func_append dep_rpath " $flag"
+	      fi
+	    elif test -n "$runpath_var"; then
+	      case "$perm_rpath " in
+	      *" $libdir "*) ;;
+	      *) func_append perm_rpath " $libdir" ;;
+	      esac
+	    fi
+	  done
+	  # Substitute the hardcoded libdirs into the rpath.
+	  if test -n "$hardcode_libdir_separator" &&
+	     test -n "$hardcode_libdirs"; then
+	    libdir="$hardcode_libdirs"
+	    eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
+	  fi
+	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
+	    # We should set the runpath_var.
+	    rpath=
+	    for dir in $perm_rpath; do
+	      func_append rpath "$dir:"
+	    done
+	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+	  fi
+	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+	fi
+
+	shlibpath="$finalize_shlibpath"
+	test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+	if test -n "$shlibpath"; then
+	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+	fi
+
+	# Get the real and link names of the library.
+	eval shared_ext=\"$shrext_cmds\"
+	eval library_names=\"$library_names_spec\"
+	set dummy $library_names
+	shift
+	realname="$1"
+	shift
+
+	if test -n "$soname_spec"; then
+	  eval soname=\"$soname_spec\"
+	else
+	  soname="$realname"
+	fi
+	if test -z "$dlname"; then
+	  dlname=$soname
+	fi
+
+	lib="$output_objdir/$realname"
+	linknames=
+	for link
+	do
+	  func_append linknames " $link"
+	done
+
+	# Use standard objects if they are pic
+	test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+	test "X$libobjs" = "X " && libobjs=
+
+	delfiles=
+	if test -n "$export_symbols" && test -n "$include_expsyms"; then
+	  $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
+	  export_symbols="$output_objdir/$libname.uexp"
+	  func_append delfiles " $export_symbols"
+	fi
+
+	orig_export_symbols=
+	case $host_os in
+	cygwin* | mingw* | cegcc*)
+	  if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
+	    # exporting using user supplied symfile
+	    if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
+	      # and it's NOT already a .def file. Must figure out
+	      # which of the given symbols are data symbols and tag
+	      # them as such. So, trigger use of export_symbols_cmds.
+	      # export_symbols gets reassigned inside the "prepare
+	      # the list of exported symbols" if statement, so the
+	      # include_expsyms logic still works.
+	      orig_export_symbols="$export_symbols"
+	      export_symbols=
+	      always_export_symbols=yes
+	    fi
+	  fi
+	  ;;
+	esac
+
+	# Prepare the list of exported symbols
+	if test -z "$export_symbols"; then
+	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+	    func_verbose "generating symbol list for \`$libname.la'"
+	    export_symbols="$output_objdir/$libname.exp"
+	    $opt_dry_run || $RM $export_symbols
+	    cmds=$export_symbols_cmds
+	    save_ifs="$IFS"; IFS='~'
+	    for cmd1 in $cmds; do
+	      IFS="$save_ifs"
+	      # Take the normal branch if the nm_file_list_spec branch
+	      # doesn't work or if tool conversion is not needed.
+	      case $nm_file_list_spec~$to_tool_file_cmd in
+		*~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
+		  try_normal_branch=yes
+		  eval cmd=\"$cmd1\"
+		  func_len " $cmd"
+		  len=$func_len_result
+		  ;;
+		*)
+		  try_normal_branch=no
+		  ;;
+	      esac
+	      if test "$try_normal_branch" = yes \
+		 && { test "$len" -lt "$max_cmd_len" \
+		      || test "$max_cmd_len" -le -1; }
+	      then
+		func_show_eval "$cmd" 'exit $?'
+		skipped_export=false
+	      elif test -n "$nm_file_list_spec"; then
+		func_basename "$output"
+		output_la=$func_basename_result
+		save_libobjs=$libobjs
+		save_output=$output
+		output=${output_objdir}/${output_la}.nm
+		func_to_tool_file "$output"
+		libobjs=$nm_file_list_spec$func_to_tool_file_result
+		func_append delfiles " $output"
+		func_verbose "creating $NM input file list: $output"
+		for obj in $save_libobjs; do
+		  func_to_tool_file "$obj"
+		  $ECHO "$func_to_tool_file_result"
+		done > "$output"
+		eval cmd=\"$cmd1\"
+		func_show_eval "$cmd" 'exit $?'
+		output=$save_output
+		libobjs=$save_libobjs
+		skipped_export=false
+	      else
+		# The command line is too long to execute in one step.
+		func_verbose "using reloadable object file for export list..."
+		skipped_export=:
+		# Break out early, otherwise skipped_export may be
+		# set to false by a later but shorter cmd.
+		break
+	      fi
+	    done
+	    IFS="$save_ifs"
+	    if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
+	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+	    fi
+	  fi
+	fi
+
+	if test -n "$export_symbols" && test -n "$include_expsyms"; then
+	  tmp_export_symbols="$export_symbols"
+	  test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+	  $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+	fi
+
+	if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
+	  # The given exports_symbols file has to be filtered, so filter it.
+	  func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+	  # FIXME: $output_objdir/$libname.filter potentially contains lots of
+	  # 's' commands which not all seds can handle. GNU sed should be fine
+	  # though. Also, the filter scales superlinearly with the number of
+	  # global variables. join(1) would be nice here, but unfortunately
+	  # isn't a blessed tool.
+	  $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+	  func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+	  export_symbols=$output_objdir/$libname.def
+	  $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+	fi
+
+	tmp_deplibs=
+	for test_deplib in $deplibs; do
+	  case " $convenience " in
+	  *" $test_deplib "*) ;;
+	  *)
+	    func_append tmp_deplibs " $test_deplib"
+	    ;;
+	  esac
+	done
+	deplibs="$tmp_deplibs"
+
+	if test -n "$convenience"; then
+	  if test -n "$whole_archive_flag_spec" &&
+	    test "$compiler_needs_object" = yes &&
+	    test -z "$libobjs"; then
+	    # extract the archives, so we have objects to list.
+	    # TODO: could optimize this to just extract one archive.
+	    whole_archive_flag_spec=
+	  fi
+	  if test -n "$whole_archive_flag_spec"; then
+	    save_libobjs=$libobjs
+	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+	    test "X$libobjs" = "X " && libobjs=
+	  else
+	    gentop="$output_objdir/${outputname}x"
+	    func_append generated " $gentop"
+
+	    func_extract_archives $gentop $convenience
+	    func_append libobjs " $func_extract_archives_result"
+	    test "X$libobjs" = "X " && libobjs=
+	  fi
+	fi
+
+	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+	  eval flag=\"$thread_safe_flag_spec\"
+	  func_append linker_flags " $flag"
+	fi
+
+	# Make a backup of the uninstalled library when relinking
+	if test "$opt_mode" = relink; then
+	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
+	fi
+
+	# Do each of the archive commands.
+	if test "$module" = yes && test -n "$module_cmds" ; then
+	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+	    eval test_cmds=\"$module_expsym_cmds\"
+	    cmds=$module_expsym_cmds
+	  else
+	    eval test_cmds=\"$module_cmds\"
+	    cmds=$module_cmds
+	  fi
+	else
+	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	    eval test_cmds=\"$archive_expsym_cmds\"
+	    cmds=$archive_expsym_cmds
+	  else
+	    eval test_cmds=\"$archive_cmds\"
+	    cmds=$archive_cmds
+	  fi
+	fi
+
+	if test "X$skipped_export" != "X:" &&
+	   func_len " $test_cmds" &&
+	   len=$func_len_result &&
+	   test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	  :
+	else
+	  # The command line is too long to link in one step, link piecewise
+	  # or, if using GNU ld and skipped_export is not :, use a linker
+	  # script.
+
+	  # Save the value of $output and $libobjs because we want to
+	  # use them later.  If we have whole_archive_flag_spec, we
+	  # want to use save_libobjs as it was before
+	  # whole_archive_flag_spec was expanded, because we can't
+	  # assume the linker understands whole_archive_flag_spec.
+	  # This may have to be revisited, in case too many
+	  # convenience libraries get linked in and end up exceeding
+	  # the spec.
+	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+	    save_libobjs=$libobjs
+	  fi
+	  save_output=$output
+	  func_basename "$output"
+	  output_la=$func_basename_result
+
+	  # Clear the reloadable object creation command queue and
+	  # initialize k to one.
+	  test_cmds=
+	  concat_cmds=
+	  objlist=
+	  last_robj=
+	  k=1
+
+	  if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
+	    output=${output_objdir}/${output_la}.lnkscript
+	    func_verbose "creating GNU ld script: $output"
+	    echo 'INPUT (' > $output
+	    for obj in $save_libobjs
+	    do
+	      func_to_tool_file "$obj"
+	      $ECHO "$func_to_tool_file_result" >> $output
+	    done
+	    echo ')' >> $output
+	    func_append delfiles " $output"
+	    func_to_tool_file "$output"
+	    output=$func_to_tool_file_result
+	  elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
+	    output=${output_objdir}/${output_la}.lnk
+	    func_verbose "creating linker input file list: $output"
+	    : > $output
+	    set x $save_libobjs
+	    shift
+	    firstobj=
+	    if test "$compiler_needs_object" = yes; then
+	      firstobj="$1 "
+	      shift
+	    fi
+	    for obj
+	    do
+	      func_to_tool_file "$obj"
+	      $ECHO "$func_to_tool_file_result" >> $output
+	    done
+	    func_append delfiles " $output"
+	    func_to_tool_file "$output"
+	    output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
+	  else
+	    if test -n "$save_libobjs"; then
+	      func_verbose "creating reloadable object files..."
+	      output=$output_objdir/$output_la-${k}.$objext
+	      eval test_cmds=\"$reload_cmds\"
+	      func_len " $test_cmds"
+	      len0=$func_len_result
+	      len=$len0
+
+	      # Loop over the list of objects to be linked.
+	      for obj in $save_libobjs
+	      do
+		func_len " $obj"
+		func_arith $len + $func_len_result
+		len=$func_arith_result
+		if test "X$objlist" = X ||
+		   test "$len" -lt "$max_cmd_len"; then
+		  func_append objlist " $obj"
+		else
+		  # The command $test_cmds is almost too long, add a
+		  # command to the queue.
+		  if test "$k" -eq 1 ; then
+		    # The first file doesn't have a previous command to add.
+		    reload_objs=$objlist
+		    eval concat_cmds=\"$reload_cmds\"
+		  else
+		    # All subsequent reloadable object files will link in
+		    # the last one created.
+		    reload_objs="$objlist $last_robj"
+		    eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
+		  fi
+		  last_robj=$output_objdir/$output_la-${k}.$objext
+		  func_arith $k + 1
+		  k=$func_arith_result
+		  output=$output_objdir/$output_la-${k}.$objext
+		  objlist=" $obj"
+		  func_len " $last_robj"
+		  func_arith $len0 + $func_len_result
+		  len=$func_arith_result
+		fi
+	      done
+	      # Handle the remaining objects by creating one last
+	      # reloadable object file.  All subsequent reloadable object
+	      # files will link in the last one created.
+	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	      reload_objs="$objlist $last_robj"
+	      eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
+	      if test -n "$last_robj"; then
+	        eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
+	      fi
+	      func_append delfiles " $output"
+
+	    else
+	      output=
+	    fi
+
+	    if ${skipped_export-false}; then
+	      func_verbose "generating symbol list for \`$libname.la'"
+	      export_symbols="$output_objdir/$libname.exp"
+	      $opt_dry_run || $RM $export_symbols
+	      libobjs=$output
+	      # Append the command to create the export file.
+	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	      eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
+	      if test -n "$last_robj"; then
+		eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
+	      fi
+	    fi
+
+	    test -n "$save_libobjs" &&
+	      func_verbose "creating a temporary reloadable object file: $output"
+
+	    # Loop through the commands generated above and execute them.
+	    save_ifs="$IFS"; IFS='~'
+	    for cmd in $concat_cmds; do
+	      IFS="$save_ifs"
+	      $opt_silent || {
+		  func_quote_for_expand "$cmd"
+		  eval "func_echo $func_quote_for_expand_result"
+	      }
+	      $opt_dry_run || eval "$cmd" || {
+		lt_exit=$?
+
+		# Restore the uninstalled library and exit
+		if test "$opt_mode" = relink; then
+		  ( cd "$output_objdir" && \
+		    $RM "${realname}T" && \
+		    $MV "${realname}U" "$realname" )
+		fi
+
+		exit $lt_exit
+	      }
+	    done
+	    IFS="$save_ifs"
+
+	    if test -n "$export_symbols_regex" && ${skipped_export-false}; then
+	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+	    fi
+	  fi
+
+          if ${skipped_export-false}; then
+	    if test -n "$export_symbols" && test -n "$include_expsyms"; then
+	      tmp_export_symbols="$export_symbols"
+	      test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+	      $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+	    fi
+
+	    if test -n "$orig_export_symbols"; then
+	      # The given exports_symbols file has to be filtered, so filter it.
+	      func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+	      # FIXME: $output_objdir/$libname.filter potentially contains lots of
+	      # 's' commands which not all seds can handle. GNU sed should be fine
+	      # though. Also, the filter scales superlinearly with the number of
+	      # global variables. join(1) would be nice here, but unfortunately
+	      # isn't a blessed tool.
+	      $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+	      func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+	      export_symbols=$output_objdir/$libname.def
+	      $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+	    fi
+	  fi
+
+	  libobjs=$output
+	  # Restore the value of output.
+	  output=$save_output
+
+	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+	    test "X$libobjs" = "X " && libobjs=
+	  fi
+	  # Expand the library linking commands again to reset the
+	  # value of $libobjs for piecewise linking.
+
+	  # Do each of the archive commands.
+	  if test "$module" = yes && test -n "$module_cmds" ; then
+	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+	      cmds=$module_expsym_cmds
+	    else
+	      cmds=$module_cmds
+	    fi
+	  else
+	    if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	      cmds=$archive_expsym_cmds
+	    else
+	      cmds=$archive_cmds
+	    fi
+	  fi
+	fi
+
+	if test -n "$delfiles"; then
+	  # Append the command to remove temporary files to $cmds.
+	  eval cmds=\"\$cmds~\$RM $delfiles\"
+	fi
+
+	# Add any objects from preloaded convenience libraries
+	if test -n "$dlprefiles"; then
+	  gentop="$output_objdir/${outputname}x"
+	  func_append generated " $gentop"
+
+	  func_extract_archives $gentop $dlprefiles
+	  func_append libobjs " $func_extract_archives_result"
+	  test "X$libobjs" = "X " && libobjs=
+	fi
+
+	save_ifs="$IFS"; IFS='~'
+	for cmd in $cmds; do
+	  IFS="$save_ifs"
+	  eval cmd=\"$cmd\"
+	  $opt_silent || {
+	    func_quote_for_expand "$cmd"
+	    eval "func_echo $func_quote_for_expand_result"
+	  }
+	  $opt_dry_run || eval "$cmd" || {
+	    lt_exit=$?
+
+	    # Restore the uninstalled library and exit
+	    if test "$opt_mode" = relink; then
+	      ( cd "$output_objdir" && \
+	        $RM "${realname}T" && \
+		$MV "${realname}U" "$realname" )
+	    fi
+
+	    exit $lt_exit
+	  }
+	done
+	IFS="$save_ifs"
+
+	# Restore the uninstalled library and exit
+	if test "$opt_mode" = relink; then
+	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
+
+	  if test -n "$convenience"; then
+	    if test -z "$whole_archive_flag_spec"; then
+	      func_show_eval '${RM}r "$gentop"'
+	    fi
+	  fi
+
+	  exit $EXIT_SUCCESS
+	fi
+
+	# Create links to the real library.
+	for linkname in $linknames; do
+	  if test "$realname" != "$linkname"; then
+	    func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
+	  fi
+	done
+
+	# If -module or -export-dynamic was specified, set the dlname.
+	if test "$module" = yes || test "$export_dynamic" = yes; then
+	  # On all known operating systems, these are identical.
+	  dlname="$soname"
+	fi
+      fi
+      ;;
+
+    obj)
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	func_warning "\`-dlopen' is ignored for objects"
+      fi
+
+      case " $deplibs" in
+      *\ -l* | *\ -L*)
+	func_warning "\`-l' and \`-L' are ignored for objects" ;;
+      esac
+
+      test -n "$rpath" && \
+	func_warning "\`-rpath' is ignored for objects"
+
+      test -n "$xrpath" && \
+	func_warning "\`-R' is ignored for objects"
+
+      test -n "$vinfo" && \
+	func_warning "\`-version-info' is ignored for objects"
+
+      test -n "$release" && \
+	func_warning "\`-release' is ignored for objects"
+
+      case $output in
+      *.lo)
+	test -n "$objs$old_deplibs" && \
+	  func_fatal_error "cannot build library object \`$output' from non-libtool objects"
+
+	libobj=$output
+	func_lo2o "$libobj"
+	obj=$func_lo2o_result
+	;;
+      *)
+	libobj=
+	obj="$output"
+	;;
+      esac
+
+      # Delete the old objects.
+      $opt_dry_run || $RM $obj $libobj
+
+      # Objects from convenience libraries.  This assumes
+      # single-version convenience libraries.  Whenever we create
+      # different ones for PIC/non-PIC, this we'll have to duplicate
+      # the extraction.
+      reload_conv_objs=
+      gentop=
+      # reload_cmds runs $LD directly, so let us get rid of
+      # -Wl from whole_archive_flag_spec and hope we can get by with
+      # turning comma into space..
+      wl=
+
+      if test -n "$convenience"; then
+	if test -n "$whole_archive_flag_spec"; then
+	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
+	  reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
+	else
+	  gentop="$output_objdir/${obj}x"
+	  func_append generated " $gentop"
+
+	  func_extract_archives $gentop $convenience
+	  reload_conv_objs="$reload_objs $func_extract_archives_result"
+	fi
+      fi
+
+      # If we're not building shared, we need to use non_pic_objs
+      test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
+
+      # Create the old-style object.
+      reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+      output="$obj"
+      func_execute_cmds "$reload_cmds" 'exit $?'
+
+      # Exit if we aren't doing a library object file.
+      if test -z "$libobj"; then
+	if test -n "$gentop"; then
+	  func_show_eval '${RM}r "$gentop"'
+	fi
+
+	exit $EXIT_SUCCESS
+      fi
+
+      if test "$build_libtool_libs" != yes; then
+	if test -n "$gentop"; then
+	  func_show_eval '${RM}r "$gentop"'
+	fi
+
+	# Create an invalid libtool object if no PIC, so that we don't
+	# accidentally link it into a program.
+	# $show "echo timestamp > $libobj"
+	# $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
+	exit $EXIT_SUCCESS
+      fi
+
+      if test -n "$pic_flag" || test "$pic_mode" != default; then
+	# Only do commands if we really have different PIC objects.
+	reload_objs="$libobjs $reload_conv_objs"
+	output="$libobj"
+	func_execute_cmds "$reload_cmds" 'exit $?'
+      fi
+
+      if test -n "$gentop"; then
+	func_show_eval '${RM}r "$gentop"'
+      fi
+
+      exit $EXIT_SUCCESS
+      ;;
+
+    prog)
+      case $host in
+	*cygwin*) func_stripname '' '.exe' "$output"
+	          output=$func_stripname_result.exe;;
+      esac
+      test -n "$vinfo" && \
+	func_warning "\`-version-info' is ignored for programs"
+
+      test -n "$release" && \
+	func_warning "\`-release' is ignored for programs"
+
+      test "$preload" = yes \
+        && test "$dlopen_support" = unknown \
+	&& test "$dlopen_self" = unknown \
+	&& test "$dlopen_self_static" = unknown && \
+	  func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
+
+      case $host in
+      *-*-rhapsody* | *-*-darwin1.[012])
+	# On Rhapsody replace the C library is the System framework
+	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
+	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
+	;;
+      esac
+
+      case $host in
+      *-*-darwin*)
+	# Don't allow lazy linking, it breaks C++ global constructors
+	# But is supposedly fixed on 10.4 or later (yay!).
+	if test "$tagname" = CXX ; then
+	  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
+	    10.[0123])
+	      func_append compile_command " ${wl}-bind_at_load"
+	      func_append finalize_command " ${wl}-bind_at_load"
+	    ;;
+	  esac
+	fi
+	# Time to change all our "foo.ltframework" stuff back to "-framework foo"
+	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	;;
+      esac
+
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+	case " $new_libs " in
+	*" -L$path/$objdir "*) ;;
+	*)
+	  case " $compile_deplibs " in
+	  *" -L$path/$objdir "*)
+	    func_append new_libs " -L$path/$objdir" ;;
+	  esac
+	  ;;
+	esac
+      done
+      for deplib in $compile_deplibs; do
+	case $deplib in
+	-L*)
+	  case " $new_libs " in
+	  *" $deplib "*) ;;
+	  *) func_append new_libs " $deplib" ;;
+	  esac
+	  ;;
+	*) func_append new_libs " $deplib" ;;
+	esac
+      done
+      compile_deplibs="$new_libs"
+
+
+      func_append compile_command " $compile_deplibs"
+      func_append finalize_command " $finalize_deplibs"
+
+      if test -n "$rpath$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	for libdir in $rpath $xrpath; do
+	  # This is the magic to use -rpath.
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) func_append finalize_rpath " $libdir" ;;
+	  esac
+	done
+      fi
+
+      # Now hardcode the library paths
+      rpath=
+      hardcode_libdirs=
+      for libdir in $compile_rpath $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval flag=\"$hardcode_libdir_flag_spec\"
+	    func_append rpath " $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) func_append perm_rpath " $libdir" ;;
+	  esac
+	fi
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+	  testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
+	  case :$dllsearchpath: in
+	  *":$libdir:"*) ;;
+	  ::) dllsearchpath=$libdir;;
+	  *) func_append dllsearchpath ":$libdir";;
+	  esac
+	  case :$dllsearchpath: in
+	  *":$testbindir:"*) ;;
+	  ::) dllsearchpath=$testbindir;;
+	  *) func_append dllsearchpath ":$testbindir";;
+	  esac
+	  ;;
+	esac
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      compile_rpath="$rpath"
+
+      rpath=
+      hardcode_libdirs=
+      for libdir in $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval flag=\"$hardcode_libdir_flag_spec\"
+	    func_append rpath " $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$finalize_perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) func_append finalize_perm_rpath " $libdir" ;;
+	  esac
+	fi
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      finalize_rpath="$rpath"
+
+      if test -n "$libobjs" && test "$build_old_libs" = yes; then
+	# Transform all the library objects into standard objects.
+	compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+	finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+      fi
+
+      func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
+
+      # template prelinking step
+      if test -n "$prelink_cmds"; then
+	func_execute_cmds "$prelink_cmds" 'exit $?'
+      fi
+
+      wrappers_required=yes
+      case $host in
+      *cegcc* | *mingw32ce*)
+        # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
+        wrappers_required=no
+        ;;
+      *cygwin* | *mingw* )
+        if test "$build_libtool_libs" != yes; then
+          wrappers_required=no
+        fi
+        ;;
+      *)
+        if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+          wrappers_required=no
+        fi
+        ;;
+      esac
+      if test "$wrappers_required" = no; then
+	# Replace the output file specification.
+	compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+	link_command="$compile_command$compile_rpath"
+
+	# We have no uninstalled library dependencies, so finalize right now.
+	exit_status=0
+	func_show_eval "$link_command" 'exit_status=$?'
+
+	if test -n "$postlink_cmds"; then
+	  func_to_tool_file "$output"
+	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+	  func_execute_cmds "$postlink_cmds" 'exit $?'
+	fi
+
+	# Delete the generated files.
+	if test -f "$output_objdir/${outputname}S.${objext}"; then
+	  func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
+	fi
+
+	exit $exit_status
+      fi
+
+      if test -n "$compile_shlibpath$finalize_shlibpath"; then
+	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+      fi
+      if test -n "$finalize_shlibpath"; then
+	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+      fi
+
+      compile_var=
+      finalize_var=
+      if test -n "$runpath_var"; then
+	if test -n "$perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $perm_rpath; do
+	    func_append rpath "$dir:"
+	  done
+	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+	if test -n "$finalize_perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $finalize_perm_rpath; do
+	    func_append rpath "$dir:"
+	  done
+	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+      fi
+
+      if test "$no_install" = yes; then
+	# We don't need to create a wrapper script.
+	link_command="$compile_var$compile_command$compile_rpath"
+	# Replace the output file specification.
+	link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+	# Delete the old output file.
+	$opt_dry_run || $RM $output
+	# Link the executable and exit
+	func_show_eval "$link_command" 'exit $?'
+
+	if test -n "$postlink_cmds"; then
+	  func_to_tool_file "$output"
+	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+	  func_execute_cmds "$postlink_cmds" 'exit $?'
+	fi
+
+	exit $EXIT_SUCCESS
+      fi
+
+      if test "$hardcode_action" = relink; then
+	# Fast installation is not supported
+	link_command="$compile_var$compile_command$compile_rpath"
+	relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+	func_warning "this platform does not like uninstalled shared libraries"
+	func_warning "\`$output' will be relinked during installation"
+      else
+	if test "$fast_install" != no; then
+	  link_command="$finalize_var$compile_command$finalize_rpath"
+	  if test "$fast_install" = yes; then
+	    relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
+	  else
+	    # fast_install is set to needless
+	    relink_command=
+	  fi
+	else
+	  link_command="$compile_var$compile_command$compile_rpath"
+	  relink_command="$finalize_var$finalize_command$finalize_rpath"
+	fi
+      fi
+
+      # Replace the output file specification.
+      link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+      # Delete the old output files.
+      $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+      func_show_eval "$link_command" 'exit $?'
+
+      if test -n "$postlink_cmds"; then
+	func_to_tool_file "$output_objdir/$outputname"
+	postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+	func_execute_cmds "$postlink_cmds" 'exit $?'
+      fi
+
+      # Now create the wrapper script.
+      func_verbose "creating $output"
+
+      # Quote the relink command for shipping.
+      if test -n "$relink_command"; then
+	# Preserve any variables that may affect compiler behavior
+	for var in $variables_saved_for_relink; do
+	  if eval test -z \"\${$var+set}\"; then
+	    relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+	  elif eval var_value=\$$var; test -z "$var_value"; then
+	    relink_command="$var=; export $var; $relink_command"
+	  else
+	    func_quote_for_eval "$var_value"
+	    relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+	  fi
+	done
+	relink_command="(cd `pwd`; $relink_command)"
+	relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+      fi
+
+      # Only actually do things if not in dry run mode.
+      $opt_dry_run || {
+	# win32 will think the script is a binary if it has
+	# a .exe suffix, so we strip it off here.
+	case $output in
+	  *.exe) func_stripname '' '.exe' "$output"
+	         output=$func_stripname_result ;;
+	esac
+	# test for cygwin because mv fails w/o .exe extensions
+	case $host in
+	  *cygwin*)
+	    exeext=.exe
+	    func_stripname '' '.exe' "$outputname"
+	    outputname=$func_stripname_result ;;
+	  *) exeext= ;;
+	esac
+	case $host in
+	  *cygwin* | *mingw* )
+	    func_dirname_and_basename "$output" "" "."
+	    output_name=$func_basename_result
+	    output_path=$func_dirname_result
+	    cwrappersource="$output_path/$objdir/lt-$output_name.c"
+	    cwrapper="$output_path/$output_name.exe"
+	    $RM $cwrappersource $cwrapper
+	    trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+	    func_emit_cwrapperexe_src > $cwrappersource
+
+	    # The wrapper executable is built using the $host compiler,
+	    # because it contains $host paths and files. If cross-
+	    # compiling, it, like the target executable, must be
+	    # executed on the $host or under an emulation environment.
+	    $opt_dry_run || {
+	      $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
+	      $STRIP $cwrapper
+	    }
+
+	    # Now, create the wrapper script for func_source use:
+	    func_ltwrapper_scriptname $cwrapper
+	    $RM $func_ltwrapper_scriptname_result
+	    trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
+	    $opt_dry_run || {
+	      # note: this script will not be executed, so do not chmod.
+	      if test "x$build" = "x$host" ; then
+		$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
+	      else
+		func_emit_wrapper no > $func_ltwrapper_scriptname_result
+	      fi
+	    }
+	  ;;
+	  * )
+	    $RM $output
+	    trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
+
+	    func_emit_wrapper no > $output
+	    chmod +x $output
+	  ;;
+	esac
+      }
+      exit $EXIT_SUCCESS
+      ;;
+    esac
+
+    # See if we need to build an old-fashioned archive.
+    for oldlib in $oldlibs; do
+
+      if test "$build_libtool_libs" = convenience; then
+	oldobjs="$libobjs_save $symfileobj"
+	addlibs="$convenience"
+	build_libtool_libs=no
+      else
+	if test "$build_libtool_libs" = module; then
+	  oldobjs="$libobjs_save"
+	  build_libtool_libs=no
+	else
+	  oldobjs="$old_deplibs $non_pic_objects"
+	  if test "$preload" = yes && test -f "$symfileobj"; then
+	    func_append oldobjs " $symfileobj"
+	  fi
+	fi
+	addlibs="$old_convenience"
+      fi
+
+      if test -n "$addlibs"; then
+	gentop="$output_objdir/${outputname}x"
+	func_append generated " $gentop"
+
+	func_extract_archives $gentop $addlibs
+	func_append oldobjs " $func_extract_archives_result"
+      fi
+
+      # Do each command in the archive commands.
+      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+	cmds=$old_archive_from_new_cmds
+      else
+
+	# Add any objects from preloaded convenience libraries
+	if test -n "$dlprefiles"; then
+	  gentop="$output_objdir/${outputname}x"
+	  func_append generated " $gentop"
+
+	  func_extract_archives $gentop $dlprefiles
+	  func_append oldobjs " $func_extract_archives_result"
+	fi
+
+	# POSIX demands no paths to be encoded in archives.  We have
+	# to avoid creating archives with duplicate basenames if we
+	# might have to extract them afterwards, e.g., when creating a
+	# static archive out of a convenience library, or when linking
+	# the entirety of a libtool archive into another (currently
+	# not supported by libtool).
+	if (for obj in $oldobjs
+	    do
+	      func_basename "$obj"
+	      $ECHO "$func_basename_result"
+	    done | sort | sort -uc >/dev/null 2>&1); then
+	  :
+	else
+	  echo "copying selected object files to avoid basename conflicts..."
+	  gentop="$output_objdir/${outputname}x"
+	  func_append generated " $gentop"
+	  func_mkdir_p "$gentop"
+	  save_oldobjs=$oldobjs
+	  oldobjs=
+	  counter=1
+	  for obj in $save_oldobjs
+	  do
+	    func_basename "$obj"
+	    objbase="$func_basename_result"
+	    case " $oldobjs " in
+	    " ") oldobjs=$obj ;;
+	    *[\ /]"$objbase "*)
+	      while :; do
+		# Make sure we don't pick an alternate name that also
+		# overlaps.
+		newobj=lt$counter-$objbase
+		func_arith $counter + 1
+		counter=$func_arith_result
+		case " $oldobjs " in
+		*[\ /]"$newobj "*) ;;
+		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
+		esac
+	      done
+	      func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+	      func_append oldobjs " $gentop/$newobj"
+	      ;;
+	    *) func_append oldobjs " $obj" ;;
+	    esac
+	  done
+	fi
+	func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
+	tool_oldlib=$func_to_tool_file_result
+	eval cmds=\"$old_archive_cmds\"
+
+	func_len " $cmds"
+	len=$func_len_result
+	if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	  cmds=$old_archive_cmds
+	elif test -n "$archiver_list_spec"; then
+	  func_verbose "using command file archive linking..."
+	  for obj in $oldobjs
+	  do
+	    func_to_tool_file "$obj"
+	    $ECHO "$func_to_tool_file_result"
+	  done > $output_objdir/$libname.libcmd
+	  func_to_tool_file "$output_objdir/$libname.libcmd"
+	  oldobjs=" $archiver_list_spec$func_to_tool_file_result"
+	  cmds=$old_archive_cmds
+	else
+	  # the command line is too long to link in one step, link in parts
+	  func_verbose "using piecewise archive linking..."
+	  save_RANLIB=$RANLIB
+	  RANLIB=:
+	  objlist=
+	  concat_cmds=
+	  save_oldobjs=$oldobjs
+	  oldobjs=
+	  # Is there a better way of finding the last object in the list?
+	  for obj in $save_oldobjs
+	  do
+	    last_oldobj=$obj
+	  done
+	  eval test_cmds=\"$old_archive_cmds\"
+	  func_len " $test_cmds"
+	  len0=$func_len_result
+	  len=$len0
+	  for obj in $save_oldobjs
+	  do
+	    func_len " $obj"
+	    func_arith $len + $func_len_result
+	    len=$func_arith_result
+	    func_append objlist " $obj"
+	    if test "$len" -lt "$max_cmd_len"; then
+	      :
+	    else
+	      # the above command should be used before it gets too long
+	      oldobjs=$objlist
+	      if test "$obj" = "$last_oldobj" ; then
+		RANLIB=$save_RANLIB
+	      fi
+	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+	      objlist=
+	      len=$len0
+	    fi
+	  done
+	  RANLIB=$save_RANLIB
+	  oldobjs=$objlist
+	  if test "X$oldobjs" = "X" ; then
+	    eval cmds=\"\$concat_cmds\"
+	  else
+	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+	  fi
+	fi
+      fi
+      func_execute_cmds "$cmds" 'exit $?'
+    done
+
+    test -n "$generated" && \
+      func_show_eval "${RM}r$generated"
+
+    # Now create the libtool archive.
+    case $output in
+    *.la)
+      old_library=
+      test "$build_old_libs" = yes && old_library="$libname.$libext"
+      func_verbose "creating $output"
+
+      # Preserve any variables that may affect compiler behavior
+      for var in $variables_saved_for_relink; do
+	if eval test -z \"\${$var+set}\"; then
+	  relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+	elif eval var_value=\$$var; test -z "$var_value"; then
+	  relink_command="$var=; export $var; $relink_command"
+	else
+	  func_quote_for_eval "$var_value"
+	  relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+	fi
+      done
+      # Quote the link command for shipping.
+      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+      relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+      if test "$hardcode_automatic" = yes ; then
+	relink_command=
+      fi
+
+      # Only create the output if not a dry run.
+      $opt_dry_run || {
+	for installed in no yes; do
+	  if test "$installed" = yes; then
+	    if test -z "$install_libdir"; then
+	      break
+	    fi
+	    output="$output_objdir/$outputname"i
+	    # Replace all uninstalled libtool libraries with the installed ones
+	    newdependency_libs=
+	    for deplib in $dependency_libs; do
+	      case $deplib in
+	      *.la)
+		func_basename "$deplib"
+		name="$func_basename_result"
+		func_resolve_sysroot "$deplib"
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
+		test -z "$libdir" && \
+		  func_fatal_error "\`$deplib' is not a valid libtool archive"
+		func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
+		;;
+	      -L*)
+		func_stripname -L '' "$deplib"
+		func_replace_sysroot "$func_stripname_result"
+		func_append newdependency_libs " -L$func_replace_sysroot_result"
+		;;
+	      -R*)
+		func_stripname -R '' "$deplib"
+		func_replace_sysroot "$func_stripname_result"
+		func_append newdependency_libs " -R$func_replace_sysroot_result"
+		;;
+	      *) func_append newdependency_libs " $deplib" ;;
+	      esac
+	    done
+	    dependency_libs="$newdependency_libs"
+	    newdlfiles=
+
+	    for lib in $dlfiles; do
+	      case $lib in
+	      *.la)
+	        func_basename "$lib"
+		name="$func_basename_result"
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+		test -z "$libdir" && \
+		  func_fatal_error "\`$lib' is not a valid libtool archive"
+		func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
+		;;
+	      *) func_append newdlfiles " $lib" ;;
+	      esac
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      case $lib in
+	      *.la)
+		# Only pass preopened files to the pseudo-archive (for
+		# eventual linking with the app. that links it) if we
+		# didn't already link the preopened objects directly into
+		# the library:
+		func_basename "$lib"
+		name="$func_basename_result"
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+		test -z "$libdir" && \
+		  func_fatal_error "\`$lib' is not a valid libtool archive"
+		func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
+		;;
+	      esac
+	    done
+	    dlprefiles="$newdlprefiles"
+	  else
+	    newdlfiles=
+	    for lib in $dlfiles; do
+	      case $lib in
+		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+		*) abs=`pwd`"/$lib" ;;
+	      esac
+	      func_append newdlfiles " $abs"
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      case $lib in
+		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+		*) abs=`pwd`"/$lib" ;;
+	      esac
+	      func_append newdlprefiles " $abs"
+	    done
+	    dlprefiles="$newdlprefiles"
+	  fi
+	  $RM $output
+	  # place dlname in correct position for cygwin
+	  # In fact, it would be nice if we could use this code for all target
+	  # systems that can't hard-code library paths into their executables
+	  # and that have no shared library path variable independent of PATH,
+	  # but it turns out we can't easily determine that from inspecting
+	  # libtool variables, so we have to hard-code the OSs to which it
+	  # applies here; at the moment, that means platforms that use the PE
+	  # object format with DLL files.  See the long comment at the top of
+	  # tests/bindir.at for full details.
+	  tdlname=$dlname
+	  case $host,$output,$installed,$module,$dlname in
+	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
+	      # If a -bindir argument was supplied, place the dll there.
+	      if test "x$bindir" != x ;
+	      then
+		func_relative_path "$install_libdir" "$bindir"
+		tdlname=$func_relative_path_result$dlname
+	      else
+		# Otherwise fall back on heuristic.
+		tdlname=../bin/$dlname
+	      fi
+	      ;;
+	  esac
+	  $ECHO > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Linker flags that can not go in dependency_libs.
+inherited_linker_flags='$new_inherited_linker_flags'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Names of additional weak libraries provided by this library
+weak_library_names='$weak_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+	  if test "$installed" = no && test "$need_relink" = yes; then
+	    $ECHO >> $output "\
+relink_command=\"$relink_command\""
+	  fi
+	done
+      }
+
+      # Do a symbolic link so that the libtool archive can be found in
+      # LD_LIBRARY_PATH before the program is installed.
+      func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
+      ;;
+    esac
+    exit $EXIT_SUCCESS
+}
+
+{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
+    func_mode_link ${1+"$@"}
+
+
+# func_mode_uninstall arg...
+func_mode_uninstall ()
+{
+    $opt_debug
+    RM="$nonopt"
+    files=
+    rmforce=
+    exit_status=0
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    for arg
+    do
+      case $arg in
+      -f) func_append RM " $arg"; rmforce=yes ;;
+      -*) func_append RM " $arg" ;;
+      *) func_append files " $arg" ;;
+      esac
+    done
+
+    test -z "$RM" && \
+      func_fatal_help "you must specify an RM program"
+
+    rmdirs=
+
+    for file in $files; do
+      func_dirname "$file" "" "."
+      dir="$func_dirname_result"
+      if test "X$dir" = X.; then
+	odir="$objdir"
+      else
+	odir="$dir/$objdir"
+      fi
+      func_basename "$file"
+      name="$func_basename_result"
+      test "$opt_mode" = uninstall && odir="$dir"
+
+      # Remember odir for removal later, being careful to avoid duplicates
+      if test "$opt_mode" = clean; then
+	case " $rmdirs " in
+	  *" $odir "*) ;;
+	  *) func_append rmdirs " $odir" ;;
+	esac
+      fi
+
+      # Don't error if the file doesn't exist and rm -f was used.
+      if { test -L "$file"; } >/dev/null 2>&1 ||
+	 { test -h "$file"; } >/dev/null 2>&1 ||
+	 test -f "$file"; then
+	:
+      elif test -d "$file"; then
+	exit_status=1
+	continue
+      elif test "$rmforce" = yes; then
+	continue
+      fi
+
+      rmfiles="$file"
+
+      case $name in
+      *.la)
+	# Possibly a libtool archive, so verify it.
+	if func_lalib_p "$file"; then
+	  func_source $dir/$name
+
+	  # Delete the libtool libraries and symlinks.
+	  for n in $library_names; do
+	    func_append rmfiles " $odir/$n"
+	  done
+	  test -n "$old_library" && func_append rmfiles " $odir/$old_library"
+
+	  case "$opt_mode" in
+	  clean)
+	    case " $library_names " in
+	    *" $dlname "*) ;;
+	    *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
+	    esac
+	    test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
+	    ;;
+	  uninstall)
+	    if test -n "$library_names"; then
+	      # Do each command in the postuninstall commands.
+	      func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+	    fi
+
+	    if test -n "$old_library"; then
+	      # Do each command in the old_postuninstall commands.
+	      func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+	    fi
+	    # FIXME: should reinstall the best remaining shared library.
+	    ;;
+	  esac
+	fi
+	;;
+
+      *.lo)
+	# Possibly a libtool object, so verify it.
+	if func_lalib_p "$file"; then
+
+	  # Read the .lo file
+	  func_source $dir/$name
+
+	  # Add PIC object to the list of files to remove.
+	  if test -n "$pic_object" &&
+	     test "$pic_object" != none; then
+	    func_append rmfiles " $dir/$pic_object"
+	  fi
+
+	  # Add non-PIC object to the list of files to remove.
+	  if test -n "$non_pic_object" &&
+	     test "$non_pic_object" != none; then
+	    func_append rmfiles " $dir/$non_pic_object"
+	  fi
+	fi
+	;;
+
+      *)
+	if test "$opt_mode" = clean ; then
+	  noexename=$name
+	  case $file in
+	  *.exe)
+	    func_stripname '' '.exe' "$file"
+	    file=$func_stripname_result
+	    func_stripname '' '.exe' "$name"
+	    noexename=$func_stripname_result
+	    # $file with .exe has already been added to rmfiles,
+	    # add $file without .exe
+	    func_append rmfiles " $file"
+	    ;;
+	  esac
+	  # Do a test to see if this is a libtool program.
+	  if func_ltwrapper_p "$file"; then
+	    if func_ltwrapper_executable_p "$file"; then
+	      func_ltwrapper_scriptname "$file"
+	      relink_command=
+	      func_source $func_ltwrapper_scriptname_result
+	      func_append rmfiles " $func_ltwrapper_scriptname_result"
+	    else
+	      relink_command=
+	      func_source $dir/$noexename
+	    fi
+
+	    # note $name still contains .exe if it was in $file originally
+	    # as does the version of $file that was added into $rmfiles
+	    func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
+	    if test "$fast_install" = yes && test -n "$relink_command"; then
+	      func_append rmfiles " $odir/lt-$name"
+	    fi
+	    if test "X$noexename" != "X$name" ; then
+	      func_append rmfiles " $odir/lt-${noexename}.c"
+	    fi
+	  fi
+	fi
+	;;
+      esac
+      func_show_eval "$RM $rmfiles" 'exit_status=1'
+    done
+
+    # Try to remove the ${objdir}s in the directories where we deleted files
+    for dir in $rmdirs; do
+      if test -d "$dir"; then
+	func_show_eval "rmdir $dir >/dev/null 2>&1"
+      fi
+    done
+
+    exit $exit_status
+}
+
+{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
+    func_mode_uninstall ${1+"$@"}
+
+test -z "$opt_mode" && {
+  help="$generic_help"
+  func_fatal_help "you must specify a MODE"
+}
+
+test -z "$exec_cmd" && \
+  func_fatal_help "invalid operation mode \`$opt_mode'"
+
+if test -n "$exec_cmd"; then
+  eval exec "$exec_cmd"
+  exit $EXIT_FAILURE
+fi
+
+exit $exit_status
+
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries.  Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them.  This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration.  But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+build_libtool_libs=no
+build_old_libs=yes
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
+# vi:sw=2
+
diff --git a/contrib/file/m4/libtool.m4 b/contrib/file/m4/libtool.m4
new file mode 100644
index 00000000000..44e0ecff11e
--- /dev/null
+++ b/contrib/file/m4/libtool.m4
@@ -0,0 +1,7982 @@
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+#
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+m4_define([_LT_COPYING], [dnl
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool 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 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool 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 GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+])
+
+# serial 57 LT_INIT
+
+
+# LT_PREREQ(VERSION)
+# ------------------
+# Complain and exit if this libtool version is less that VERSION.
+m4_defun([LT_PREREQ],
+[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
+       [m4_default([$3],
+		   [m4_fatal([Libtool version $1 or higher is required],
+		             63)])],
+       [$2])])
+
+
+# _LT_CHECK_BUILDDIR
+# ------------------
+# Complain if the absolute build directory name contains unusual characters
+m4_defun([_LT_CHECK_BUILDDIR],
+[case `pwd` in
+  *\ * | *\	*)
+    AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
+esac
+])
+
+
+# LT_INIT([OPTIONS])
+# ------------------
+AC_DEFUN([LT_INIT],
+[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+AC_BEFORE([$0], [LT_LANG])dnl
+AC_BEFORE([$0], [LT_OUTPUT])dnl
+AC_BEFORE([$0], [LTDL_INIT])dnl
+m4_require([_LT_CHECK_BUILDDIR])dnl
+
+dnl Autoconf doesn't catch unexpanded LT_ macros by default:
+m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
+m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
+dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
+dnl unless we require an AC_DEFUNed macro:
+AC_REQUIRE([LTOPTIONS_VERSION])dnl
+AC_REQUIRE([LTSUGAR_VERSION])dnl
+AC_REQUIRE([LTVERSION_VERSION])dnl
+AC_REQUIRE([LTOBSOLETE_VERSION])dnl
+m4_require([_LT_PROG_LTMAIN])dnl
+
+_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
+
+dnl Parse OPTIONS
+_LT_SET_OPTIONS([$0], [$1])
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+_LT_SETUP
+
+# Only expand once:
+m4_define([LT_INIT])
+])# LT_INIT
+
+# Old names:
+AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
+AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
+dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+m4_defun([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+  case $cc_temp in
+    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+])
+
+
+# _LT_FILEUTILS_DEFAULTS
+# ----------------------
+# It is okay to use these file commands and assume they have been set
+# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
+m4_defun([_LT_FILEUTILS_DEFAULTS],
+[: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+])# _LT_FILEUTILS_DEFAULTS
+
+
+# _LT_SETUP
+# ---------
+m4_defun([_LT_SETUP],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
+
+_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl
+dnl
+_LT_DECL([], [host_alias], [0], [The host system])dnl
+_LT_DECL([], [host], [0])dnl
+_LT_DECL([], [host_os], [0])dnl
+dnl
+_LT_DECL([], [build_alias], [0], [The build system])dnl
+_LT_DECL([], [build], [0])dnl
+_LT_DECL([], [build_os], [0])dnl
+dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+test -z "$LN_S" && LN_S="ln -s"
+_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
+dnl
+AC_REQUIRE([LT_CMD_MAX_LEN])dnl
+_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
+_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
+dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
+m4_require([_LT_CMD_RELOAD])dnl
+m4_require([_LT_CHECK_MAGIC_METHOD])dnl
+m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
+m4_require([_LT_CMD_OLD_ARCHIVE])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_WITH_SYSROOT])dnl
+
+_LT_CONFIG_LIBTOOL_INIT([
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+])
+if test -n "${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+
+_LT_CHECK_OBJDIR
+
+m4_require([_LT_TAG_COMPILER])dnl
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    _LT_PATH_MAGIC
+  fi
+  ;;
+esac
+
+# Use C for the default configuration in the libtool script
+LT_SUPPORTED_TAG([CC])
+_LT_LANG_C_CONFIG
+_LT_LANG_DEFAULT_CONFIG
+_LT_CONFIG_COMMANDS
+])# _LT_SETUP
+
+
+# _LT_PREPARE_SED_QUOTE_VARS
+# --------------------------
+# Define a few sed substitution that help us do robust quoting.
+m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
+[# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+])
+
+# _LT_PROG_LTMAIN
+# ---------------
+# Note that this code is called both from `configure', and `config.status'
+# now that we use AC_CONFIG_COMMANDS to generate libtool.  Notably,
+# `config.status' has no value for ac_aux_dir unless we are using Automake,
+# so we pass a copy along to make sure it has a sensible value anyway.
+m4_defun([_LT_PROG_LTMAIN],
+[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
+_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
+ltmain="$ac_aux_dir/ltmain.sh"
+])# _LT_PROG_LTMAIN
+
+
+## ------------------------------------- ##
+## Accumulate code for creating libtool. ##
+## ------------------------------------- ##
+
+# So that we can recreate a full libtool script including additional
+# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
+# in macros and then make a single call at the end using the `libtool'
+# label.
+
+
+# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
+# ----------------------------------------
+# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL_INIT],
+[m4_ifval([$1],
+          [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
+                     [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_INIT])
+
+
+# _LT_CONFIG_LIBTOOL([COMMANDS])
+# ------------------------------
+# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL],
+[m4_ifval([$1],
+          [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
+                     [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
+
+
+# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
+# -----------------------------------------------------
+m4_defun([_LT_CONFIG_SAVE_COMMANDS],
+[_LT_CONFIG_LIBTOOL([$1])
+_LT_CONFIG_LIBTOOL_INIT([$2])
+])
+
+
+# _LT_FORMAT_COMMENT([COMMENT])
+# -----------------------------
+# Add leading comment marks to the start of each line, and a trailing
+# full-stop to the whole comment if one is not present already.
+m4_define([_LT_FORMAT_COMMENT],
+[m4_ifval([$1], [
+m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
+              [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
+)])
+
+
+
+## ------------------------ ##
+## FIXME: Eliminate VARNAME ##
+## ------------------------ ##
+
+
+# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
+# -------------------------------------------------------------------
+# CONFIGNAME is the name given to the value in the libtool script.
+# VARNAME is the (base) name used in the configure script.
+# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
+# VARNAME.  Any other value will be used directly.
+m4_define([_LT_DECL],
+[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
+    [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
+	[m4_ifval([$1], [$1], [$2])])
+    lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
+    m4_ifval([$4],
+	[lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
+    lt_dict_add_subkey([lt_decl_dict], [$2],
+	[tagged?], [m4_ifval([$5], [yes], [no])])])
+])
+
+
+# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
+# --------------------------------------------------------
+m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
+
+
+# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_tag_varnames],
+[_lt_decl_filter([tagged?], [yes], $@)])
+
+
+# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
+# ---------------------------------------------------------
+m4_define([_lt_decl_filter],
+[m4_case([$#],
+  [0], [m4_fatal([$0: too few arguments: $#])],
+  [1], [m4_fatal([$0: too few arguments: $#: $1])],
+  [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
+  [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
+  [lt_dict_filter([lt_decl_dict], $@)])[]dnl
+])
+
+
+# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
+# --------------------------------------------------
+m4_define([lt_decl_quote_varnames],
+[_lt_decl_filter([value], [1], $@)])
+
+
+# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_dquote_varnames],
+[_lt_decl_filter([value], [2], $@)])
+
+
+# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_varnames_tagged],
+[m4_assert([$# <= 2])dnl
+_$0(m4_quote(m4_default([$1], [[, ]])),
+    m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
+    m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
+m4_define([_lt_decl_varnames_tagged],
+[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
+
+
+# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_all_varnames],
+[_$0(m4_quote(m4_default([$1], [[, ]])),
+     m4_if([$2], [],
+	   m4_quote(lt_decl_varnames),
+	m4_quote(m4_shift($@))))[]dnl
+])
+m4_define([_lt_decl_all_varnames],
+[lt_join($@, lt_decl_varnames_tagged([$1],
+			lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
+])
+
+
+# _LT_CONFIG_STATUS_DECLARE([VARNAME])
+# ------------------------------------
+# Quote a variable value, and forward it to `config.status' so that its
+# declaration there will have the same value as in `configure'.  VARNAME
+# must have a single quote delimited value for this to work.
+m4_define([_LT_CONFIG_STATUS_DECLARE],
+[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
+
+
+# _LT_CONFIG_STATUS_DECLARATIONS
+# ------------------------------
+# We delimit libtool config variables with single quotes, so when
+# we write them to config.status, we have to be sure to quote all
+# embedded single quotes properly.  In configure, this macro expands
+# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
+#
+#    ='`$ECHO "$" | $SED "$delay_single_quote_subst"`'
+m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
+    [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAGS
+# ----------------
+# Output comment and list of tags supported by the script
+m4_defun([_LT_LIBTOOL_TAGS],
+[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
+available_tags="_LT_TAGS"dnl
+])
+
+
+# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
+# -----------------------------------
+# Extract the dictionary values for VARNAME (optionally with TAG) and
+# expand to a commented shell variable setting:
+#
+#    # Some comment about what VAR is for.
+#    visible_name=$lt_internal_name
+m4_define([_LT_LIBTOOL_DECLARE],
+[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
+					   [description])))[]dnl
+m4_pushdef([_libtool_name],
+    m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
+m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
+    [0], [_libtool_name=[$]$1],
+    [1], [_libtool_name=$lt_[]$1],
+    [2], [_libtool_name=$lt_[]$1],
+    [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
+m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
+])
+
+
+# _LT_LIBTOOL_CONFIG_VARS
+# -----------------------
+# Produce commented declarations of non-tagged libtool config variables
+# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
+# script.  Tagged libtool config variables (even for the LIBTOOL CONFIG
+# section) are produced by _LT_LIBTOOL_TAG_VARS.
+m4_defun([_LT_LIBTOOL_CONFIG_VARS],
+[m4_foreach([_lt_var],
+    m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
+    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAG_VARS(TAG)
+# -------------------------
+m4_define([_LT_LIBTOOL_TAG_VARS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
+    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
+
+
+# _LT_TAGVAR(VARNAME, [TAGNAME])
+# ------------------------------
+m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
+
+
+# _LT_CONFIG_COMMANDS
+# -------------------
+# Send accumulated output to $CONFIG_STATUS.  Thanks to the lists of
+# variables for single and double quote escaping we saved from calls
+# to _LT_DECL, we can put quote escaped variables declarations
+# into `config.status', and then the shell code to quote escape them in
+# for loops in `config.status'.  Finally, any additional code accumulated
+# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
+m4_defun([_LT_CONFIG_COMMANDS],
+[AC_PROVIDE_IFELSE([LT_OUTPUT],
+	dnl If the libtool generation code has been placed in $CONFIG_LT,
+	dnl instead of duplicating it all over again into config.status,
+	dnl then we will have config.status run $CONFIG_LT later, so it
+	dnl needs to know what name is stored there:
+        [AC_CONFIG_COMMANDS([libtool],
+            [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
+    dnl If the libtool generation code is destined for config.status,
+    dnl expand the accumulated commands and init code now:
+    [AC_CONFIG_COMMANDS([libtool],
+        [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
+])#_LT_CONFIG_COMMANDS
+
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
+[
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+_LT_CONFIG_STATUS_DECLARATIONS
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$[]1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_quote_varnames); do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[[\\\\\\\`\\"\\\$]]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+# Double-quote double-evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_dquote_varnames); do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[[\\\\\\\`\\"\\\$]]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+_LT_OUTPUT_LIBTOOL_INIT
+])
+
+# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
+# ------------------------------------
+# Generate a child script FILE with all initialization necessary to
+# reuse the environment learned by the parent script, and make the
+# file executable.  If COMMENT is supplied, it is inserted after the
+# `#!' sequence but before initialization text begins.  After this
+# macro, additional text can be appended to FILE to form the body of
+# the child script.  The macro ends with non-zero status if the
+# file could not be fully written (such as if the disk is full).
+m4_ifdef([AS_INIT_GENERATED],
+[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
+[m4_defun([_LT_GENERATED_FILE_INIT],
+[m4_require([AS_PREPARE])]dnl
+[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
+[lt_write_fail=0
+cat >$1 <<_ASEOF || lt_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+$2
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$1 <<\_ASEOF || lt_write_fail=1
+AS_SHELL_SANITIZE
+_AS_PREPARE
+exec AS_MESSAGE_FD>&1
+_ASEOF
+test $lt_write_fail = 0 && chmod +x $1[]dnl
+m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
+
+# LT_OUTPUT
+# ---------
+# This macro allows early generation of the libtool script (before
+# AC_OUTPUT is called), incase it is used in configure for compilation
+# tests.
+AC_DEFUN([LT_OUTPUT],
+[: ${CONFIG_LT=./config.lt}
+AC_MSG_NOTICE([creating $CONFIG_LT])
+_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
+[# Run this file to recreate a libtool stub with the current configuration.])
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+lt_cl_silent=false
+exec AS_MESSAGE_LOG_FD>>config.log
+{
+  echo
+  AS_BOX([Running $as_me.])
+} >&AS_MESSAGE_LOG_FD
+
+lt_cl_help="\
+\`$as_me' creates a local libtool stub from the current configuration,
+for use in further configure time tests before the real libtool is
+generated.
+
+Usage: $[0] [[OPTIONS]]
+
+  -h, --help      print this help, then exit
+  -V, --version   print version number, then exit
+  -q, --quiet     do not print progress messages
+  -d, --debug     don't remove temporary files
+
+Report bugs to ."
+
+lt_cl_version="\
+m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
+m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
+configured by $[0], generated by m4_PACKAGE_STRING.
+
+Copyright (C) 2011 Free Software Foundation, Inc.
+This config.lt script is free software; the Free Software Foundation
+gives unlimited permision to copy, distribute and modify it."
+
+while test $[#] != 0
+do
+  case $[1] in
+    --version | --v* | -V )
+      echo "$lt_cl_version"; exit 0 ;;
+    --help | --h* | -h )
+      echo "$lt_cl_help"; exit 0 ;;
+    --debug | --d* | -d )
+      debug=: ;;
+    --quiet | --q* | --silent | --s* | -q )
+      lt_cl_silent=: ;;
+
+    -*) AC_MSG_ERROR([unrecognized option: $[1]
+Try \`$[0] --help' for more information.]) ;;
+
+    *) AC_MSG_ERROR([unrecognized argument: $[1]
+Try \`$[0] --help' for more information.]) ;;
+  esac
+  shift
+done
+
+if $lt_cl_silent; then
+  exec AS_MESSAGE_FD>/dev/null
+fi
+_LTEOF
+
+cat >>"$CONFIG_LT" <<_LTEOF
+_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AC_MSG_NOTICE([creating $ofile])
+_LT_OUTPUT_LIBTOOL_COMMANDS
+AS_EXIT(0)
+_LTEOF
+chmod +x "$CONFIG_LT"
+
+# configure is writing to config.log, but config.lt does its own redirection,
+# appending to config.log, which fails on DOS, as config.log is still kept
+# open by configure.  Here we exec the FD to /dev/null, effectively closing
+# config.log, so it can be properly (re)opened and appended to by config.lt.
+lt_cl_success=:
+test "$silent" = yes &&
+  lt_config_lt_args="$lt_config_lt_args --quiet"
+exec AS_MESSAGE_LOG_FD>/dev/null
+$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+exec AS_MESSAGE_LOG_FD>>config.log
+$lt_cl_success || AS_EXIT(1)
+])# LT_OUTPUT
+
+
+# _LT_CONFIG(TAG)
+# ---------------
+# If TAG is the built-in tag, create an initial libtool script with a
+# default configuration from the untagged config vars.  Otherwise add code
+# to config.status for appending the configuration named by TAG from the
+# matching tagged config vars.
+m4_defun([_LT_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_CONFIG_SAVE_COMMANDS([
+  m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
+  m4_if(_LT_TAG, [C], [
+    # See if we are running on zsh, and set the options which allow our
+    # commands through without removal of \ escapes.
+    if test -n "${ZSH_VERSION+set}" ; then
+      setopt NO_GLOB_SUBST
+    fi
+
+    cfgfile="${ofile}T"
+    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+    $RM "$cfgfile"
+
+    cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+_LT_COPYING
+_LT_LIBTOOL_TAGS
+
+# ### BEGIN LIBTOOL CONFIG
+_LT_LIBTOOL_CONFIG_VARS
+_LT_LIBTOOL_TAG_VARS
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+  case $host_os in
+  aix3*)
+    cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+_LT_EOF
+    ;;
+  esac
+
+  _LT_PROG_LTMAIN
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" \
+     || (rm -f "$cfgfile"; exit 1)
+
+  _LT_PROG_REPLACE_SHELLFNS
+
+   mv -f "$cfgfile" "$ofile" ||
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+],
+[cat <<_LT_EOF >> "$ofile"
+
+dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
+dnl in a comment (ie after a #).
+# ### BEGIN LIBTOOL TAG CONFIG: $1
+_LT_LIBTOOL_TAG_VARS(_LT_TAG)
+# ### END LIBTOOL TAG CONFIG: $1
+_LT_EOF
+])dnl /m4_if
+],
+[m4_if([$1], [], [
+    PACKAGE='$PACKAGE'
+    VERSION='$VERSION'
+    TIMESTAMP='$TIMESTAMP'
+    RM='$RM'
+    ofile='$ofile'], [])
+])dnl /_LT_CONFIG_SAVE_COMMANDS
+])# _LT_CONFIG
+
+
+# LT_SUPPORTED_TAG(TAG)
+# ---------------------
+# Trace this macro to discover what tags are supported by the libtool
+# --tag option, using:
+#    autoconf --trace 'LT_SUPPORTED_TAG:$1'
+AC_DEFUN([LT_SUPPORTED_TAG], [])
+
+
+# C support is built-in for now
+m4_define([_LT_LANG_C_enabled], [])
+m4_define([_LT_TAGS], [])
+
+
+# LT_LANG(LANG)
+# -------------
+# Enable libtool support for the given language if not already enabled.
+AC_DEFUN([LT_LANG],
+[AC_BEFORE([$0], [LT_OUTPUT])dnl
+m4_case([$1],
+  [C],			[_LT_LANG(C)],
+  [C++],		[_LT_LANG(CXX)],
+  [Go],			[_LT_LANG(GO)],
+  [Java],		[_LT_LANG(GCJ)],
+  [Fortran 77],		[_LT_LANG(F77)],
+  [Fortran],		[_LT_LANG(FC)],
+  [Windows Resource],	[_LT_LANG(RC)],
+  [m4_ifdef([_LT_LANG_]$1[_CONFIG],
+    [_LT_LANG($1)],
+    [m4_fatal([$0: unsupported language: "$1"])])])dnl
+])# LT_LANG
+
+
+# _LT_LANG(LANGNAME)
+# ------------------
+m4_defun([_LT_LANG],
+[m4_ifdef([_LT_LANG_]$1[_enabled], [],
+  [LT_SUPPORTED_TAG([$1])dnl
+  m4_append([_LT_TAGS], [$1 ])dnl
+  m4_define([_LT_LANG_]$1[_enabled], [])dnl
+  _LT_LANG_$1_CONFIG($1)])dnl
+])# _LT_LANG
+
+
+m4_ifndef([AC_PROG_GO], [
+############################################################
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_GO.  When it is available in    #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+############################################################
+m4_defun([AC_PROG_GO],
+[AC_LANG_PUSH(Go)dnl
+AC_ARG_VAR([GOC],     [Go compiler command])dnl
+AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl
+_AC_ARG_VAR_LDFLAGS()dnl
+AC_CHECK_TOOL(GOC, gccgo)
+if test -z "$GOC"; then
+  if test -n "$ac_tool_prefix"; then
+    AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])
+  fi
+fi
+if test -z "$GOC"; then
+  AC_CHECK_PROG(GOC, gccgo, gccgo, false)
+fi
+])#m4_defun
+])#m4_ifndef
+
+
+# _LT_LANG_DEFAULT_CONFIG
+# -----------------------
+m4_defun([_LT_LANG_DEFAULT_CONFIG],
+[AC_PROVIDE_IFELSE([AC_PROG_CXX],
+  [LT_LANG(CXX)],
+  [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_F77],
+  [LT_LANG(F77)],
+  [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_FC],
+  [LT_LANG(FC)],
+  [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
+
+dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
+dnl pulling things in needlessly.
+AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+  [LT_LANG(GCJ)],
+  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+    [LT_LANG(GCJ)],
+    [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
+      [LT_LANG(GCJ)],
+      [m4_ifdef([AC_PROG_GCJ],
+	[m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
+       m4_ifdef([A][M_PROG_GCJ],
+	[m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
+       m4_ifdef([LT_PROG_GCJ],
+	[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
+
+AC_PROVIDE_IFELSE([AC_PROG_GO],
+  [LT_LANG(GO)],
+  [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])
+
+AC_PROVIDE_IFELSE([LT_PROG_RC],
+  [LT_LANG(RC)],
+  [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
+])# _LT_LANG_DEFAULT_CONFIG
+
+# Obsolete macros:
+AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
+AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
+AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
+AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
+AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
+dnl AC_DEFUN([AC_LIBTOOL_F77], [])
+dnl AC_DEFUN([AC_LIBTOOL_FC], [])
+dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
+dnl AC_DEFUN([AC_LIBTOOL_RC], [])
+
+
+# _LT_TAG_COMPILER
+# ----------------
+m4_defun([_LT_TAG_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
+_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
+_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
+_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_TAG_COMPILER
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+m4_defun([_LT_COMPILER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+m4_defun([_LT_LINKER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+])# _LT_LINKER_BOILERPLATE
+
+# _LT_REQUIRED_DARWIN_CHECKS
+# -------------------------
+m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
+  case $host_os in
+    rhapsody* | darwin*)
+    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
+    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
+    AC_CHECK_TOOL([LIPO], [lipo], [:])
+    AC_CHECK_TOOL([OTOOL], [otool], [:])
+    AC_CHECK_TOOL([OTOOL64], [otool64], [:])
+    _LT_DECL([], [DSYMUTIL], [1],
+      [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
+    _LT_DECL([], [NMEDIT], [1],
+      [Tool to change global to local symbols on Mac OS X])
+    _LT_DECL([], [LIPO], [1],
+      [Tool to manipulate fat objects and archives on Mac OS X])
+    _LT_DECL([], [OTOOL], [1],
+      [ldd/readelf like tool for Mach-O binaries on Mac OS X])
+    _LT_DECL([], [OTOOL64], [1],
+      [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
+
+    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
+      [lt_cv_apple_cc_single_mod=no
+      if test -z "${LT_MULTI_MODULE}"; then
+	# By default we will add the -single_module flag. You can override
+	# by either setting the environment variable LT_MULTI_MODULE
+	# non-empty at configure time, or by adding -multi_module to the
+	# link flags.
+	rm -rf libconftest.dylib*
+	echo "int foo(void){return 1;}" > conftest.c
+	echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
+	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+        _lt_result=$?
+	# If there is a non-empty error log, and "single_module"
+	# appears in it, assume the flag caused a linker warning
+        if test -s conftest.err && $GREP single_module conftest.err; then
+	  cat conftest.err >&AS_MESSAGE_LOG_FD
+	# Otherwise, if the output was created with a 0 exit code from
+	# the compiler, it worked.
+	elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+	  lt_cv_apple_cc_single_mod=yes
+	else
+	  cat conftest.err >&AS_MESSAGE_LOG_FD
+	fi
+	rm -rf libconftest.dylib*
+	rm -f conftest.*
+      fi])
+
+    AC_CACHE_CHECK([for -exported_symbols_list linker flag],
+      [lt_cv_ld_exported_symbols_list],
+      [lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+	[lt_cv_ld_exported_symbols_list=yes],
+	[lt_cv_ld_exported_symbols_list=no])
+	LDFLAGS="$save_LDFLAGS"
+    ])
+
+    AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
+      [lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
+      echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
+      $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
+      echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
+      $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -s conftest.err && $GREP force_load conftest.err; then
+	cat conftest.err >&AS_MESSAGE_LOG_FD
+      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
+	lt_cv_ld_force_load=yes
+      else
+	cat conftest.err >&AS_MESSAGE_LOG_FD
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
+    ])
+    case $host_os in
+    rhapsody* | darwin1.[[012]])
+      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+    darwin1.*)
+      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+    darwin*) # darwin 5.x on
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+	10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+	10.[[012]]*)
+	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+	10.*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+      esac
+    ;;
+  esac
+    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+      _lt_dar_single_mod='$single_module'
+    fi
+    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    else
+      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    fi
+    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+      _lt_dsymutil='~$DSYMUTIL $lib || :'
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
+])
+
+
+# _LT_DARWIN_LINKER_FEATURES([TAG])
+# ---------------------------------
+# Checks for linker and compiler features on darwin
+m4_defun([_LT_DARWIN_LINKER_FEATURES],
+[
+  m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+  _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+  _LT_TAGVAR(hardcode_direct, $1)=no
+  _LT_TAGVAR(hardcode_automatic, $1)=yes
+  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+    m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
+                  [FC],  [_LT_TAGVAR(compiler_needs_object, $1)=yes])
+  else
+    _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+  fi
+  _LT_TAGVAR(link_all_deplibs, $1)=yes
+  _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
+    output_verbose_link_cmd=func_echo_all
+    _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+    m4_if([$1], [CXX],
+[   if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+      _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+      _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+    fi
+],[])
+  else
+  _LT_TAGVAR(ld_shlibs, $1)=no
+  fi
+])
+
+# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
+# ----------------------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+# Store the results from the different compilers for each TAGNAME.
+# Allow to override them for all tags through lt_cv_aix_libpath.
+m4_defun([_LT_SYS_MODULE_PATH_AIX],
+[m4_require([_LT_DECL_SED])dnl
+if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
+  [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
+  lt_aix_libpath_sed='[
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }]'
+  _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi],[])
+  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
+  fi
+  ])
+  aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
+fi
+])# _LT_SYS_MODULE_PATH_AIX
+
+
+# _LT_SHELL_INIT(ARG)
+# -------------------
+m4_define([_LT_SHELL_INIT],
+[m4_divert_text([M4SH-INIT], [$1
+])])# _LT_SHELL_INIT
+
+
+
+# _LT_PROG_ECHO_BACKSLASH
+# -----------------------
+# Find how we can fake an echo command that does not interpret backslash.
+# In particular, with Autoconf 2.60 or later we add some code to the start
+# of the generated configure script which will find a shell with a builtin
+# printf (which we can use as an echo command).
+m4_defun([_LT_PROG_ECHO_BACKSLASH],
+[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+AC_MSG_CHECKING([how to print strings])
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
+else
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$[]1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "$*" 
+}
+
+case "$ECHO" in
+  printf*) AC_MSG_RESULT([printf]) ;;
+  print*) AC_MSG_RESULT([print -r]) ;;
+  *) AC_MSG_RESULT([cat]) ;;
+esac
+
+m4_ifdef([_AS_DETECT_SUGGESTED],
+[_AS_DETECT_SUGGESTED([
+  test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
+    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+    PATH=/empty FPATH=/empty; export PATH FPATH
+    test "X`printf %s $ECHO`" = "X$ECHO" \
+      || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
+
+_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
+_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
+])# _LT_PROG_ECHO_BACKSLASH
+
+
+# _LT_WITH_SYSROOT
+# ----------------
+AC_DEFUN([_LT_WITH_SYSROOT],
+[AC_MSG_CHECKING([for sysroot])
+AC_ARG_WITH([sysroot],
+[  --with-sysroot[=DIR] Search for dependent libraries within DIR
+                        (or the compiler's sysroot if not specified).],
+[], [with_sysroot=no])
+
+dnl lt_sysroot will always be passed unquoted.  We quote it here
+dnl in case the user passed a directory name.
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+   if test "$GCC" = yes; then
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   AC_MSG_RESULT([${with_sysroot}])
+   AC_MSG_ERROR([The sysroot must be an absolute path.])
+   ;;
+esac
+
+ AC_MSG_RESULT([${lt_sysroot:-no}])
+_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
+[dependent libraries, and in which our libraries should be installed.])])
+
+# _LT_ENABLE_LOCK
+# ---------------
+m4_defun([_LT_ENABLE_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+  [AS_HELP_STRING([--disable-libtool-lock],
+    [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+      *ELF-32*)
+	HPUX_IA64_MODE="32"
+	;;
+      *ELF-64*)
+	HPUX_IA64_MODE="64"
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    if test "$lt_cv_prog_gnu_ld" = yes; then
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -melf32bsmip"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -melf32bmipn32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -melf64bmip"
+	;;
+      esac
+    else
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -32"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -n32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -64"
+	  ;;
+      esac
+    fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+      *32-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_i386_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_i386"
+	    ;;
+	  ppc64-*linux*|powerpc64-*linux*)
+	    LD="${LD-ld} -m elf32ppclinux"
+	    ;;
+	  s390x-*linux*)
+	    LD="${LD-ld} -m elf_s390"
+	    ;;
+	  sparc64-*linux*)
+	    LD="${LD-ld} -m elf32_sparc"
+	    ;;
+	esac
+	;;
+      *64-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_x86_64_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_x86_64"
+	    ;;
+	  ppc*-*linux*|powerpc*-*linux*)
+	    LD="${LD-ld} -m elf64ppc"
+	    ;;
+	  s390*-*linux*|s390*-*tpf*)
+	    LD="${LD-ld} -m elf64_s390"
+	    ;;
+	  sparc*-*linux*)
+	    LD="${LD-ld} -m elf64_sparc"
+	    ;;
+	esac
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_PUSH(C)
+     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_POP])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*)
+        case $host in
+        i?86-*-solaris*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        sparc*-*-solaris*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+        esac
+        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
+        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+          LD="${LD-ld}_sol2"
+        fi
+        ;;
+      *)
+	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+	  LD="${LD-ld} -64"
+	fi
+	;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+esac
+
+need_locks="$enable_libtool_lock"
+])# _LT_ENABLE_LOCK
+
+
+# _LT_PROG_AR
+# -----------
+m4_defun([_LT_PROG_AR],
+[AC_CHECK_TOOLS(AR, [ar], false)
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+_LT_DECL([], [AR], [1], [The archiver])
+_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
+
+AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
+  [lt_cv_ar_at_file=no
+   AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
+     [echo conftest.$ac_objext > conftest.lst
+      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
+      AC_TRY_EVAL([lt_ar_try])
+      if test "$ac_status" -eq 0; then
+	# Ensure the archiver fails upon bogus file names.
+	rm -f conftest.$ac_objext libconftest.a
+	AC_TRY_EVAL([lt_ar_try])
+	if test "$ac_status" -ne 0; then
+          lt_cv_ar_at_file=@
+        fi
+      fi
+      rm -f conftest.* libconftest.a
+     ])
+  ])
+
+if test "x$lt_cv_ar_at_file" = xno; then
+  archiver_list_spec=
+else
+  archiver_list_spec=$lt_cv_ar_at_file
+fi
+_LT_DECL([], [archiver_list_spec], [1],
+  [How to feed a file listing to the archiver])
+])# _LT_PROG_AR
+
+
+# _LT_CMD_OLD_ARCHIVE
+# -------------------
+m4_defun([_LT_CMD_OLD_ARCHIVE],
+[_LT_PROG_AR
+
+AC_CHECK_TOOL(STRIP, strip, :)
+test -z "$STRIP" && STRIP=:
+_LT_DECL([], [STRIP], [1], [A symbol stripping program])
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+test -z "$RANLIB" && RANLIB=:
+_LT_DECL([], [RANLIB], [1],
+    [Commands used to install an old-style archive])
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
+fi
+
+case $host_os in
+  darwin*)
+    lock_old_archive_extraction=yes ;;
+  *)
+    lock_old_archive_extraction=no ;;
+esac
+_LT_DECL([], [old_postinstall_cmds], [2])
+_LT_DECL([], [old_postuninstall_cmds], [2])
+_LT_TAGDECL([], [old_archive_cmds], [2],
+    [Commands used to build an old-style archive])
+_LT_DECL([], [lock_old_archive_extraction], [0],
+    [Whether to use a lock for old archive extraction])
+])# _LT_CMD_OLD_ARCHIVE
+
+
+# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#		[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([_LT_COMPILER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$3"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       $2=yes
+     fi
+   fi
+   $RM conftest*
+])
+
+if test x"[$]$2" = xyes; then
+    m4_if([$5], , :, [$5])
+else
+    m4_if([$6], , :, [$6])
+fi
+])# _LT_COMPILER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
+
+
+# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#                  [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------
+# Check whether the given linker option works
+AC_DEFUN([_LT_LINKER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $3"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&AS_MESSAGE_LOG_FD
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         $2=yes
+       fi
+     else
+       $2=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+    m4_if([$4], , :, [$4])
+else
+    m4_if([$5], , :, [$5])
+fi
+])# _LT_LINKER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
+
+
+# LT_CMD_MAX_LEN
+#---------------
+AC_DEFUN([LT_CMD_MAX_LEN],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+  i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw* | cegcc*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  os2*)
+    # The test takes a long time on OS/2.
+    lt_cv_sys_max_cmd_len=8192
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[	 ]]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      # Make teststring a little bigger before we do anything with it.
+      # a 1K string should be a reasonable start.
+      for i in 1 2 3 4 5 6 7 8 ; do
+        teststring=$teststring$teststring
+      done
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      # If test is not a shell built-in, we'll probably end up computing a
+      # maximum length that is only half of the actual maximum length, but
+      # we can't tell.
+      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
+	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+	      test $i != 17 # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      # Only check the string length outside the loop.
+      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on
+      # massive amounts of additional arguments before passing them to the
+      # linker.  It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
+    ;;
+  esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+  AC_MSG_RESULT(none)
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+_LT_DECL([], [max_cmd_len], [0],
+    [What is the maximum length of a command?])
+])# LT_CMD_MAX_LEN
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
+
+
+# _LT_HEADER_DLFCN
+# ----------------
+m4_defun([_LT_HEADER_DLFCN],
+[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
+])# _LT_HEADER_DLFCN
+
+
+# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+#                      ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ----------------------------------------------------------------
+m4_defun([_LT_TRY_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+  [$4]
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+[#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include 
+#endif
+
+#include 
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+  return status;
+}]
+_LT_EOF
+  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) $1 ;;
+      x$lt_dlneed_uscore) $2 ;;
+      x$lt_dlunknown|x*) $3 ;;
+    esac
+  else :
+    # compilation failed
+    $3
+  fi
+fi
+rm -fr conftest*
+])# _LT_TRY_DLOPEN_SELF
+
+
+# LT_SYS_DLOPEN_SELF
+# ------------------
+AC_DEFUN([LT_SYS_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32* | cegcc*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+    ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+    ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ])
+    ;;
+
+  *)
+    AC_CHECK_FUNC([shl_load],
+	  [lt_cv_dlopen="shl_load"],
+      [AC_CHECK_LIB([dld], [shl_load],
+	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
+	[AC_CHECK_FUNC([dlopen],
+	      [lt_cv_dlopen="dlopen"],
+	  [AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+	    [AC_CHECK_LIB([svld], [dlopen],
+		  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+	      [AC_CHECK_LIB([dld], [dld_link],
+		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
+	      ])
+	    ])
+	  ])
+	])
+      ])
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    AC_CACHE_CHECK([whether a program can dlopen itself],
+	  lt_cv_dlopen_self, [dnl
+	  _LT_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+	    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+    ])
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+	  lt_cv_dlopen_self_static, [dnl
+	  _LT_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+	    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
+      ])
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+_LT_DECL([dlopen_support], [enable_dlopen], [0],
+	 [Whether dlopen is supported])
+_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
+	 [Whether dlopen of programs is supported])
+_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
+	 [Whether dlopen of statically linked programs is supported])
+])# LT_SYS_DLOPEN_SELF
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
+
+
+# _LT_COMPILER_C_O([TAGNAME])
+# ---------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler.
+# This macro does not hard code the compiler like AC_PROG_CC_C_O.
+m4_defun([_LT_COMPILER_C_O],
+[m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+     fi
+   fi
+   chmod u+w . 2>&AS_MESSAGE_LOG_FD
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+])
+_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
+	[Does compiler simultaneously support -c and -o options?])
+])# _LT_COMPILER_C_O
+
+
+# _LT_COMPILER_FILE_LOCKS([TAGNAME])
+# ----------------------------------
+# Check to see if we can do hard links to lock some files if needed
+m4_defun([_LT_COMPILER_FILE_LOCKS],
+[m4_require([_LT_ENABLE_LOCK])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_COMPILER_C_O([$1])
+
+hard_links="nottested"
+if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  AC_MSG_CHECKING([if we can lock with hard links])
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  AC_MSG_RESULT([$hard_links])
+  if test "$hard_links" = no; then
+    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
+])# _LT_COMPILER_FILE_LOCKS
+
+
+# _LT_CHECK_OBJDIR
+# ----------------
+m4_defun([_LT_CHECK_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+_LT_DECL([], [objdir], [0],
+         [The name of the directory that contains temporary libtool files])dnl
+m4_pattern_allow([LT_OBJDIR])dnl
+AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
+  [Define to the sub-directory in which libtool stores uninstalled libraries.])
+])# _LT_CHECK_OBJDIR
+
+
+# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
+# --------------------------------------
+# Check hardcoding attributes.
+m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
+   test -n "$_LT_TAGVAR(runpath_var, $1)" ||
+   test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+     test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
+    # Linking always hardcodes the temporary library directory.
+    _LT_TAGVAR(hardcode_action, $1)=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    _LT_TAGVAR(hardcode_action, $1)=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  _LT_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
+   test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+_LT_TAGDECL([], [hardcode_action], [0],
+    [How to hardcode a shared library path into an executable])
+])# _LT_LINKER_HARDCODE_LIBPATH
+
+
+# _LT_CMD_STRIPLIB
+# ----------------
+m4_defun([_LT_CMD_STRIPLIB],
+[m4_require([_LT_DECL_EGREP])
+striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+  darwin*)
+    if test -n "$STRIP" ; then
+      striplib="$STRIP -x"
+      old_striplib="$STRIP -S"
+      AC_MSG_RESULT([yes])
+    else
+      AC_MSG_RESULT([no])
+    fi
+    ;;
+  *)
+    AC_MSG_RESULT([no])
+    ;;
+  esac
+fi
+_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
+_LT_DECL([], [striplib], [1])
+])# _LT_CMD_STRIPLIB
+
+
+# _LT_SYS_DYNAMIC_LINKER([TAG])
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+m4_defun([_LT_SYS_DYNAMIC_LINKER],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_OBJDUMP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+AC_MSG_CHECKING([dynamic linker characteristics])
+m4_if([$1],
+	[], [
+if test "$GCC" = yes; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  case $host_os in
+    mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
+    *) lt_sed_strip_eq="s,=/,/,g" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+  case $lt_search_path_spec in
+  *\;*)
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+    ;;
+  *)
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+    ;;
+  esac
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary.
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+    else
+      test -d "$lt_sys_path" && \
+	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+  lt_foo="";
+  lt_count=0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo="/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[[lt_foo]]++; }
+  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
+}'`
+  # AWK program above erroneously prepends '/' to C:/dos/paths
+  # for these hosts.
+  case $host_os in
+    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+      $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
+  esac
+  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix[[4-9]]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[[01]] | aix4.[[01]].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib.so
+      # instead of lib.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  case $host_cpu in
+  powerpc)
+    # Since July 2007 AmigaOS4 officially supports .so libraries.
+    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    ;;
+  m68k)
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[[45]]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+m4_if([$1], [],[
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
+      ;;
+    mingw* | cegcc*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
+    ;;
+
+  *)
+    # Assume MSVC wrapper
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
+    ;;
+  esac
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+m4_if([$1], [],[
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[[23]].*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2.*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+haiku*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
+  ;;
+
+interix[[3-9]]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux # correct to gnu/linux during the next big refactor
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+
+  # Some binutils ld are patched to set DT_RUNPATH
+  AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
+    [lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+	 LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+      [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+	 [lt_cv_shlibpath_overrides_runpath=yes])])
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+    ])
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
+    *)				need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[[89]] | openbsd2.[[89]].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux # correct to gnu/linux during the next big refactor
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+uts4*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+_LT_DECL([], [variables_saved_for_relink], [1],
+    [Variables whose values should be saved in libtool wrapper scripts and
+    restored at link time])
+_LT_DECL([], [need_lib_prefix], [0],
+    [Do we need the "lib" prefix for modules?])
+_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
+_LT_DECL([], [version_type], [0], [Library versioning type])
+_LT_DECL([], [runpath_var], [0],  [Shared library runtime path variable])
+_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
+_LT_DECL([], [shlibpath_overrides_runpath], [0],
+    [Is shlibpath searched before the hard-coded library search path?])
+_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
+_LT_DECL([], [library_names_spec], [1],
+    [[List of archive names.  First name is the real one, the rest are links.
+    The last name is the one that the linker finds with -lNAME]])
+_LT_DECL([], [soname_spec], [1],
+    [[The coded name of the library, if different from the real name]])
+_LT_DECL([], [install_override_mode], [1],
+    [Permission mode override for installation of shared libraries])
+_LT_DECL([], [postinstall_cmds], [2],
+    [Command to use after installation of a shared archive])
+_LT_DECL([], [postuninstall_cmds], [2],
+    [Command to use after uninstallation of a shared archive])
+_LT_DECL([], [finish_cmds], [2],
+    [Commands used to finish a libtool library installation in a directory])
+_LT_DECL([], [finish_eval], [1],
+    [[As "finish_cmds", except a single script fragment to be evaled but
+    not shown]])
+_LT_DECL([], [hardcode_into_libs], [0],
+    [Whether we should hardcode library paths into libraries])
+_LT_DECL([], [sys_lib_search_path_spec], [2],
+    [Compile-time system search path for libraries])
+_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
+    [Run-time system search path for libraries])
+])# _LT_SYS_DYNAMIC_LINKER
+
+
+# _LT_PATH_TOOL_PREFIX(TOOL)
+# --------------------------
+# find a file program which can recognize shared library
+AC_DEFUN([_LT_PATH_TOOL_PREFIX],
+[m4_require([_LT_DECL_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] |  ?:[\\/]*])
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="m4_if([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$1; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+_LT_DECL([], [MAGIC_CMD], [0],
+	 [Used to examine libraries when file_magic_cmd begins with "file"])dnl
+])# _LT_PATH_TOOL_PREFIX
+
+# Old name:
+AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
+
+
+# _LT_PATH_MAGIC
+# --------------
+# find a file program which can recognize a shared library
+m4_defun([_LT_PATH_MAGIC],
+[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])# _LT_PATH_MAGIC
+
+
+# LT_PATH_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([LT_PATH_LD],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
+
+AC_ARG_WITH([gnu-ld],
+    [AS_HELP_STRING([--with-gnu-ld],
+	[assume the C compiler uses GNU ld @<:@default=no@:>@])],
+    [test "$withval" = no || with_gnu_ld=yes],
+    [with_gnu_ld=no])dnl
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by $CC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]]* | ?:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    # Keep this pattern in sync with the one in func_win32_libid.
+    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
+  ;;
+
+cegcc*)
+  # use the weaker test based on 'objdump'. See mingw*.
+  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+haiku*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix[[3-9]]*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+*nto* | *qnx*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+tpf*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+])
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+  case $host_os in
+  mingw* | pw32*)
+    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+      want_nocaseglob=yes
+    else
+      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
+    fi
+    ;;
+  esac
+fi
+
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+_LT_DECL([], [deplibs_check_method], [1],
+    [Method to check whether dependent libraries are shared objects])
+_LT_DECL([], [file_magic_cmd], [1],
+    [Command to use when deplibs_check_method = "file_magic"])
+_LT_DECL([], [file_magic_glob], [1],
+    [How to find potential files when deplibs_check_method = "file_magic"])
+_LT_DECL([], [want_nocaseglob], [1],
+    [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
+])# _LT_CHECK_MAGIC_METHOD
+
+
+# LT_PATH_NM
+# ----------
+# find the pathname to a BSD- or MS-compatible name lister
+AC_DEFUN([LT_PATH_NM],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+	# Check to see if the nm accepts a BSD-compat flag.
+	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	#   nm: unknown option "B" ignored
+	# Tru64's nm complains that /dev/null is an invalid object file
+	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+	*/dev/null* | *'Invalid file or object type'*)
+	  lt_cv_path_NM="$tmp_nm -B"
+	  break
+	  ;;
+	*)
+	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	  */dev/null*)
+	    lt_cv_path_NM="$tmp_nm -p"
+	    break
+	    ;;
+	  *)
+	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	    continue # so that we can try to find one that supports BSD flags
+	    ;;
+	  esac
+	  ;;
+	esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  : ${lt_cv_path_NM=no}
+fi])
+if test "$lt_cv_path_NM" != "no"; then
+  NM="$lt_cv_path_NM"
+else
+  # Didn't find any BSD compatible name lister, look for dumpbin.
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
+    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
+  AC_SUBST([DUMPBIN])
+  if test "$DUMPBIN" != ":"; then
+    NM="$DUMPBIN"
+  fi
+fi
+test -z "$NM" && NM=nm
+AC_SUBST([NM])
+_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
+
+AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
+  [lt_cv_nm_interface="BSD nm"
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$ac_compile" 2>conftest.err)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
+  cat conftest.out >&AS_MESSAGE_LOG_FD
+  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+    lt_cv_nm_interface="MS dumpbin"
+  fi
+  rm -f conftest*])
+])# LT_PATH_NM
+
+# Old names:
+AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
+AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_NM], [])
+dnl AC_DEFUN([AC_PROG_NM], [])
+
+# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+# --------------------------------
+# how to determine the name of the shared library
+# associated with a specific link library.
+#  -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+m4_require([_LT_DECL_DLLTOOL])
+AC_CACHE_CHECK([how to associate runtime and link libraries],
+lt_cv_sharedlib_from_linklib_cmd,
+[lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+  # two different shell functions defined in ltmain.sh
+  # decide which to use based on capabilities of $DLLTOOL
+  case `$DLLTOOL --help 2>&1` in
+  *--identify-strict*)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+    ;;
+  *)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+    ;;
+  esac
+  ;;
+*)
+  # fallback: assume linklib IS sharedlib
+  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+  ;;
+esac
+])
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
+    [Command to associate shared and link libraries])
+])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+
+
+# _LT_PATH_MANIFEST_TOOL
+# ----------------------
+# locate the manifest tool
+m4_defun([_LT_PATH_MANIFEST_TOOL],
+[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
+  [lt_cv_path_mainfest_tool=no
+  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
+  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+    lt_cv_path_mainfest_tool=yes
+  fi
+  rm -f conftest*])
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+  MANIFEST_TOOL=:
+fi
+_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
+])# _LT_PATH_MANIFEST_TOOL
+
+
+# LT_LIB_M
+# --------
+# check for math library
+AC_DEFUN([LT_LIB_M],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+  # These system don't have libm, or don't need it
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, cos, LIBM="-lm")
+  ;;
+esac
+AC_SUBST([LIBM])
+])# LT_LIB_M
+
+# Old name:
+AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_CHECK_LIBM], [])
+
+
+# _LT_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------
+m4_defun([_LT_COMPILER_NO_RTTI],
+[m4_require([_LT_TAG_COMPILER])dnl
+
+_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+  case $cc_basename in
+  nvcc*)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
+  esac
+
+  _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+    lt_cv_prog_compiler_rtti_exceptions,
+    [-fno-rtti -fno-exceptions], [],
+    [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
+	[Compiler flag to turn off builtin functions])
+])# _LT_COMPILER_NO_RTTI
+
+
+# _LT_CMD_GLOBAL_SYMBOLS
+# ----------------------
+m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[[BCDT]]'
+  ;;
+cygwin* | mingw* | pw32* | cegcc*)
+  symcode='[[ABCDGISTW]]'
+  ;;
+hpux*)
+  if test "$host_cpu" = ia64; then
+    symcode='[[ABCDEGRST]]'
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[[BCDEGRST]]'
+  ;;
+osf*)
+  symcode='[[BCDEGQRST]]'
+  ;;
+solaris*)
+  symcode='[[BDRT]]'
+  ;;
+sco3.2v5*)
+  symcode='[[DT]]'
+  ;;
+sysv4.2uw2*)
+  symcode='[[DT]]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[[ABDT]]'
+  ;;
+sysv4)
+  symcode='[[DFNSTU]]'
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+    # Fake it for dumpbin and say T for any non-static function
+    # and D for any global variable.
+    # Also find C++ and __fastcall symbols from MSVC++,
+    # which start with @ or ?.
+    lt_cv_sys_global_symbol_pipe="$AWK ['"\
+"     {last_section=section; section=\$ 3};"\
+"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
+"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+"     \$ 0!~/External *\|/{next};"\
+"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+"     {if(hide[section]) next};"\
+"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
+"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+"     ' prfx=^$ac_symprfx]"
+  else
+    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[	 ]]\($symcode$symcode*\)[[	 ]][[	 ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+  fi
+  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+  if AC_TRY_EVAL(ac_compile); then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT@&t@_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT@&t@_DLSYM_CONST
+#else
+# define LT@&t@_DLSYM_CONST const
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+	  cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols.  */
+LT@&t@_DLSYM_CONST struct {
+  const char *name;
+  void       *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[[]] =
+{
+  { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+	  cat <<\_LT_EOF >> conftest.$ac_ext
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_globsym_save_LIBS=$LIBS
+	  lt_globsym_save_CFLAGS=$CFLAGS
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+	  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS=$lt_globsym_save_LIBS
+	  CFLAGS=$lt_globsym_save_CFLAGS
+	else
+	  echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+    fi
+  else
+    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+    cat conftest.$ac_ext >&5
+  fi
+  rm -rf conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  AC_MSG_RESULT(failed)
+else
+  AC_MSG_RESULT(ok)
+fi
+
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
+  nm_file_list_spec='@'
+fi
+
+_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
+    [Take the output of nm and produce a listing of raw symbols and C names])
+_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
+    [Transform the output of nm in a proper C declaration])
+_LT_DECL([global_symbol_to_c_name_address],
+    [lt_cv_sys_global_symbol_to_c_name_address], [1],
+    [Transform the output of nm in a C name address pair])
+_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
+    [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
+    [Transform the output of nm in a C name address pair when lib prefix is needed])
+_LT_DECL([], [nm_file_list_spec], [1],
+    [Specify filename containing input files for $NM])
+]) # _LT_CMD_GLOBAL_SYMBOLS
+
+
+# _LT_COMPILER_PIC([TAGNAME])
+# ---------------------------
+m4_defun([_LT_COMPILER_PIC],
+[m4_require([_LT_TAG_COMPILER])dnl
+_LT_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_TAGVAR(lt_prog_compiler_static, $1)=
+
+m4_if([$1], [CXX], [
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | cygwin* | os2* | pw32* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+      ;;
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=
+      ;;
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+    *qnx* | *nto*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+    *)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix[[4-9]]*)
+	# All AIX code is PIC.
+	if test "$host_cpu" = ia64; then
+	  # AIX 5 now supports IA64 processor
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	else
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+	fi
+	;;
+      chorus*)
+	case $cc_basename in
+	cxch68*)
+	  # Green Hills C++ Compiler
+	  # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+	  ;;
+	esac
+	;;
+      mingw* | cygwin* | os2* | pw32* | cegcc*)
+	# This hack is so that the source file can tell whether it is being
+	# built for inclusion in a dll (and should export symbols for example).
+	m4_if([$1], [GCJ], [],
+	  [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+	;;
+      dgux*)
+	case $cc_basename in
+	  ec++*)
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  ghcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      freebsd* | dragonfly*)
+	# FreeBSD uses GNU C++
+	;;
+      hpux9* | hpux10* | hpux11*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    if test "$host_cpu" != ia64; then
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	    fi
+	    ;;
+	  aCC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    case $host_cpu in
+	    hppa*64*|ia64*)
+	      # +Z the default
+	      ;;
+	    *)
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	      ;;
+	    esac
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      interix*)
+	# This is c89, which is MS Visual C++ (no shared libs)
+	# Anyone wants to do a port?
+	;;
+      irix5* | irix6* | nonstopux*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    # CC pic flag -KPIC is the default.
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+	case $cc_basename in
+	  KCC*)
+	    # KAI C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	    ;;
+	  ecpc* )
+	    # old Intel C++ for x86_64 which still supported -KPIC.
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	    ;;
+	  icpc* )
+	    # Intel C++, used to be incompatible with GCC.
+	    # ICC 10 doesn't accept -KPIC any more.
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	    ;;
+	  pgCC* | pgcpp*)
+	    # Portland Group C++ compiler
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  cxx*)
+	    # Compaq C++
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
+	    # IBM XL 8.0, 9.0 on PPC and BlueGene
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+      lynxos*)
+	;;
+      m88k*)
+	;;
+      mvs*)
+	case $cc_basename in
+	  cxx*)
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      netbsd*)
+	;;
+      *qnx* | *nto*)
+        # QNX uses GNU C++, but need to define -shared option too, otherwise
+        # it will coredump.
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+        ;;
+      osf3* | osf4* | osf5*)
+	case $cc_basename in
+	  KCC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    ;;
+	  RCC*)
+	    # Rational C++ 2.4.1
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  cxx*)
+	    # Digital/Compaq C++
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      psos*)
+	;;
+      solaris*)
+	case $cc_basename in
+	  CC* | sunCC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	    ;;
+	  gcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sunos4*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.x
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  lcc*)
+	    # Lucid
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	esac
+	;;
+      tandem*)
+	case $cc_basename in
+	  NCC*)
+	    # NonStop-UX NCC 3.20
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      vxworks*)
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+	;;
+    esac
+  fi
+],
+[
+  if test "$GCC" = yes; then
+    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=
+      ;;
+
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	# +Z the default
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      enable_shared=no
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+
+    *)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
+      if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
+      fi
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      else
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      m4_if([$1], [GCJ], [],
+	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC (with -KPIC) is the default.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      case $cc_basename in
+      # old Intel for x86_64 which still supported -KPIC.
+      ecc*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      # Lahey Fortran 8.1.
+      lf95*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
+	;;
+      nagfor*)
+	# NAG Fortran compiler
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+        ;;
+      ccc*)
+        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+        # All Alpha code is PIC.
+        _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+        ;;
+      xl* | bgxl* | bgf* | mpixl*)
+	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+	;;
+      *)
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
+	  ;;
+	*Sun\ F* | *Sun*Fortran*)
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	  ;;
+	*Sun\ C*)
+	  # Sun C 5.9
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  ;;
+        *Intel*\ [[CF]]*Compiler*)
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	  ;;
+	*Portland\ Group*)
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  ;;
+	esac
+	;;
+      esac
+      ;;
+
+    newsos6)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # All OSF/1 code is PIC.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    rdos*)
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    solaris*)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    unicos*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+
+    uts4*)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *)
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+    esac
+  fi
+])
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+    ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
+    ;;
+esac
+
+AC_CACHE_CHECK([for $compiler option to produce PIC],
+  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
+  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+  _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
+    [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
+    [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
+    [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
+     "" | " "*) ;;
+     *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+     esac],
+    [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+     _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
+	[Additional compiler flags for building library objects])
+
+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
+	[How to pass a linker flag through the compiler])
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
+_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+  _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
+  $lt_tmp_static_flag,
+  [],
+  [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
+_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
+	[Compiler flag to prevent dynamic linking])
+])# _LT_COMPILER_PIC
+
+
+# _LT_LINKER_SHLIBS([TAGNAME])
+# ----------------------------
+# See if the linker supports building shared libraries.
+m4_defun([_LT_LINKER_SHLIBS],
+[AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+m4_if([$1], [CXX], [
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+  case $host_os in
+  aix[[4-9]]*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    # Also, AIX nm treats weak defined symbols like other global defined
+    # symbols, whereas GNU nm marks them as "W".
+    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    else
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+    ;;
+  cygwin* | mingw* | cegcc*)
+    case $cc_basename in
+    cl*)
+      _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+      ;;
+    *)
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+      ;;
+    esac
+    ;;
+  *)
+    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+    ;;
+  esac
+], [
+  runpath_var=
+  _LT_TAGVAR(allow_undefined_flag, $1)=
+  _LT_TAGVAR(always_export_symbols, $1)=no
+  _LT_TAGVAR(archive_cmds, $1)=
+  _LT_TAGVAR(archive_expsym_cmds, $1)=
+  _LT_TAGVAR(compiler_needs_object, $1)=no
+  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+  _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  _LT_TAGVAR(hardcode_automatic, $1)=no
+  _LT_TAGVAR(hardcode_direct, $1)=no
+  _LT_TAGVAR(hardcode_direct_absolute, $1)=no
+  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+  _LT_TAGVAR(hardcode_libdir_separator, $1)=
+  _LT_TAGVAR(hardcode_minus_L, $1)=no
+  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  _LT_TAGVAR(inherit_rpath, $1)=no
+  _LT_TAGVAR(link_all_deplibs, $1)=unknown
+  _LT_TAGVAR(module_cmds, $1)=
+  _LT_TAGVAR(module_expsym_cmds, $1)=
+  _LT_TAGVAR(old_archive_from_new_cmds, $1)=
+  _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+  _LT_TAGVAR(thread_safe_flag_spec, $1)=
+  _LT_TAGVAR(whole_archive_flag_spec, $1)=
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  _LT_TAGVAR(include_expsyms, $1)=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+dnl Note also adjust exclude_expsyms for C++ above.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  _LT_TAGVAR(ld_shlibs, $1)=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
+  if test "$with_gnu_ld" = yes; then
+    case $host_os in
+      aix*)
+	# The AIX port of GNU ld has always aspired to compatibility
+	# with the native linker.  However, as the warning in the GNU ld
+	# block says, versions before 2.19.5* couldn't really create working
+	# shared libraries, regardless of the interface used.
+	case `$LD -v 2>&1` in
+	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+	  *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
+	  *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
+	  *)
+	    lt_use_gnu_ld_interface=yes
+	    ;;
+	esac
+	;;
+      *)
+	lt_use_gnu_ld_interface=yes
+	;;
+    esac
+  fi
+
+  if test "$lt_use_gnu_ld_interface" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+      _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>&1` in
+      *GNU\ gold*) supports_anon_versioning=yes ;;
+      *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix[[3-9]]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_expsym_cmds, $1)=''
+        ;;
+      m68k)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes
+        ;;
+      esac
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	# Joseph Beckenbach  says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+      # as there is no search path for DLLs.
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=no
+      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+
+      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    haiku*)
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    interix[[3-9]]*)
+      _LT_TAGVAR(hardcode_direct, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+      tmp_diet=no
+      if test "$host_os" = linux-dietlibc; then
+	case $cc_basename in
+	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
+	esac
+      fi
+      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+	 && test "$tmp_diet" = no
+      then
+	tmp_addflag=' $pic_flag'
+	tmp_sharedflag='-shared'
+	case $cc_basename,$host_cpu in
+        pgcc*)				# Portland Group C compiler
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95* | pgfortran*)
+					# Portland Group f77 and f90 compilers
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	lf95*)				# Lahey Fortran 8.1
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)=
+	  tmp_sharedflag='--shared' ;;
+	xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+	  tmp_sharedflag='-qmkshrobj'
+	  tmp_addflag= ;;
+	nvcc*)	# Cuda Compiler Driver 2.2
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(compiler_needs_object, $1)=yes
+	  ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(compiler_needs_object, $1)=yes
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	esac
+	_LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+        if test "x$supports_anon_versioning" = xyes; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	    echo "local: *; };" >> $output_objdir/$libname.ver~
+	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+        fi
+
+	case $cc_basename in
+	xlf* | bgf* | bgxlf* | mpixlf*)
+	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+	  if test "x$supports_anon_versioning" = xyes; then
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	      echo "local: *; };" >> $output_objdir/$libname.ver~
+	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	  fi
+	  ;;
+	esac
+      else
+        _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  # For security reasons, it is highly recommended that you always
+	  # use absolute paths for naming shared libraries, and exclude the
+	  # DT_RUNPATH tag from executables and libraries.  But doing so
+	  # requires that you compile everything twice, which is a pain.
+	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  else
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+
+    if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
+      runpath_var=
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=yes
+      _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	_LT_TAGVAR(hardcode_direct, $1)=unsupported
+      fi
+      ;;
+
+    aix[[4-9]]*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	# Also, AIX nm treats weak defined symbols like other global
+	# defined symbols, whereas GNU nm marks them as "W".
+	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	else
+	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+	  for ld_flag in $LDFLAGS; do
+	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+	    aix_use_runtimelinking=yes
+	    break
+	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      _LT_TAGVAR(archive_cmds, $1)=''
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[[012]]|aix4.[[012]].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	  # We have reworked collect2
+	  :
+	  else
+	  # We have old collect2
+	  _LT_TAGVAR(hardcode_direct, $1)=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	  _LT_TAGVAR(hardcode_libdir_separator, $1)=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      _LT_TAGVAR(always_export_symbols, $1)=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	_LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        _LT_SYS_MODULE_PATH_AIX([$1])
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+      else
+	if test "$host_cpu" = ia64; then
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	  _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an
+	 # empty executable.
+	 _LT_SYS_MODULE_PATH_AIX([$1])
+	 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	  _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	  if test "$with_gnu_ld" = yes; then
+	    # We only use this code for GNU lds that support --whole-archive.
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	  else
+	    # Exported symbols can be pulled into shared objects from archives
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	  fi
+	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_expsym_cmds, $1)=''
+        ;;
+      m68k)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes
+        ;;
+      esac
+      ;;
+
+    bsdi[[45]]*)
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      case $cc_basename in
+      cl*)
+	# Native MSVC
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	_LT_TAGVAR(always_export_symbols, $1)=yes
+	_LT_TAGVAR(file_list_spec, $1)='@'
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	  else
+	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	  fi~
+	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	  linknames='
+	# The linker will not automatically build a static lib if we build a DLL.
+	# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	_LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+	_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+	# Don't use ranlib
+	_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+	_LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+	  lt_tool_outputfile="@TOOL_OUTPUT@"~
+	  case $lt_outputfile in
+	    *.exe|*.EXE) ;;
+	    *)
+	      lt_outputfile="$lt_outputfile.exe"
+	      lt_tool_outputfile="$lt_tool_outputfile.exe"
+	      ;;
+	  esac~
+	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	    $RM "$lt_outputfile.manifest";
+	  fi'
+	;;
+      *)
+	# Assume MSVC wrapper
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+	# The linker will automatically build a .lib file if we build a DLL.
+	_LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	# FIXME: Should let the user specify the lib program.
+	_LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	;;
+      esac
+      ;;
+
+    darwin* | rhapsody*)
+      _LT_DARWIN_LINKER_FEATURES($1)
+      ;;
+
+    dgux*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2.*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
+	_LT_TAGVAR(hardcode_direct, $1)=yes
+	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	_LT_TAGVAR(hardcode_minus_L, $1)=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	m4_if($1, [], [
+	  # Older versions of the 11.00 compiler do not understand -b yet
+	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+	  _LT_LINKER_OPTION([if $CC understands -b],
+	    _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
+	    [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
+	    [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
+	  [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  _LT_TAGVAR(hardcode_direct, $1)=no
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	  ;;
+	*)
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	# Try to use the -exported_symbol ld option, if it does not
+	# work, assume that -exports_file does not work either and
+	# implicitly export all symbols.
+	# This should be the same for all languages, so no per-tag cache variable.
+	AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
+	  [lt_cv_irix_exported_symbol],
+	  [save_LDFLAGS="$LDFLAGS"
+	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+	   AC_LINK_IFELSE(
+	     [AC_LANG_SOURCE(
+	        [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
+			      [C++], [[int foo (void) { return 0; }]],
+			      [Fortran 77], [[
+      subroutine foo
+      end]],
+			      [Fortran], [[
+      subroutine foo
+      end]])])],
+	      [lt_cv_irix_exported_symbol=yes],
+	      [lt_cv_irix_exported_symbol=no])
+           LDFLAGS="$save_LDFLAGS"])
+	if test "$lt_cv_irix_exported_symbol" = yes; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+	fi
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(inherit_rpath, $1)=yes
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    newsos6)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *nto* | *qnx*)
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	_LT_TAGVAR(hardcode_direct, $1)=yes
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+	     _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	     ;;
+	   *)
+	     _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+	fi
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    os2*)
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      else
+	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    solaris*)
+      _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+      else
+	case `$CC -V 2>&1` in
+	*"Compilers 5.0"*)
+	  wlarc=''
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+	  ;;
+	*)
+	  wlarc='${wl}'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  ;;
+	esac
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      case $host_os in
+      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+	  _LT_TAGVAR(hardcode_direct, $1)=no
+        ;;
+	motorola)
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4.3*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	_LT_TAGVAR(ld_shlibs, $1)=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      _LT_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    esac
+
+    if test x$host_vendor = xsni; then
+      case $host in
+      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
+	;;
+      esac
+    fi
+  fi
+])
+AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
+
+_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
+_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
+_LT_DECL([], [extract_expsyms_cmds], [2],
+    [The commands to extract the exported symbol list from a shared archive])
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+  # Assume -lc should be added
+  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $_LT_TAGVAR(archive_cmds, $1) in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      AC_CACHE_CHECK([whether -lc should be explicitly linked in],
+	[lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
+	[$RM conftest*
+	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+	if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+	  soname=conftest
+	  lib=conftest
+	  libobjs=conftest.$ac_objext
+	  deplibs=
+	  wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
+	  pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+	  compiler_flags=-v
+	  linker_flags=-v
+	  verstring=
+	  output_objdir=.
+	  libname=conftest
+	  lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+	  _LT_TAGVAR(allow_undefined_flag, $1)=
+	  if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+	  then
+	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	  else
+	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	  fi
+	  _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+	else
+	  cat conftest.err 1>&5
+	fi
+	$RM conftest*
+	])
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
+    [Whether or not to add -lc for building shared libraries])
+_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
+    [enable_shared_with_static_runtimes], [0],
+    [Whether or not to disallow shared libs when runtime libs are static])
+_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
+    [Compiler flag to allow reflexive dlopens])
+_LT_TAGDECL([], [whole_archive_flag_spec], [1],
+    [Compiler flag to generate shared objects directly from archives])
+_LT_TAGDECL([], [compiler_needs_object], [1],
+    [Whether the compiler copes with passing no objects directly])
+_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
+    [Create an old-style archive from a shared archive])
+_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
+    [Create a temporary old-style archive to link instead of a shared archive])
+_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
+_LT_TAGDECL([], [archive_expsym_cmds], [2])
+_LT_TAGDECL([], [module_cmds], [2],
+    [Commands used to build a loadable module if different from building
+    a shared archive.])
+_LT_TAGDECL([], [module_expsym_cmds], [2])
+_LT_TAGDECL([], [with_gnu_ld], [1],
+    [Whether we are building with GNU ld or not])
+_LT_TAGDECL([], [allow_undefined_flag], [1],
+    [Flag that allows shared libraries with undefined symbols to be built])
+_LT_TAGDECL([], [no_undefined_flag], [1],
+    [Flag that enforces no undefined symbols])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
+    [Flag to hardcode $libdir into a binary during linking.
+    This must work even if $libdir does not exist])
+_LT_TAGDECL([], [hardcode_libdir_separator], [1],
+    [Whether we need a single "-rpath" flag with a separated argument])
+_LT_TAGDECL([], [hardcode_direct], [0],
+    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    DIR into the resulting binary])
+_LT_TAGDECL([], [hardcode_direct_absolute], [0],
+    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    DIR into the resulting binary and the resulting library dependency is
+    "absolute", i.e impossible to change by setting ${shlibpath_var} if the
+    library is relocated])
+_LT_TAGDECL([], [hardcode_minus_L], [0],
+    [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+    into the resulting binary])
+_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
+    [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+    into the resulting binary])
+_LT_TAGDECL([], [hardcode_automatic], [0],
+    [Set to "yes" if building a shared library automatically hardcodes DIR
+    into the library and all subsequent libraries and executables linked
+    against it])
+_LT_TAGDECL([], [inherit_rpath], [0],
+    [Set to yes if linker adds runtime paths of dependent libraries
+    to runtime path list])
+_LT_TAGDECL([], [link_all_deplibs], [0],
+    [Whether libtool must link a program against all its dependency libraries])
+_LT_TAGDECL([], [always_export_symbols], [0],
+    [Set to "yes" if exported symbols are required])
+_LT_TAGDECL([], [export_symbols_cmds], [2],
+    [The commands to list exported symbols])
+_LT_TAGDECL([], [exclude_expsyms], [1],
+    [Symbols that should not be listed in the preloaded symbols])
+_LT_TAGDECL([], [include_expsyms], [1],
+    [Symbols that must always be exported])
+_LT_TAGDECL([], [prelink_cmds], [2],
+    [Commands necessary for linking programs (against libraries) with templates])
+_LT_TAGDECL([], [postlink_cmds], [2],
+    [Commands necessary for finishing linking programs])
+_LT_TAGDECL([], [file_list_spec], [1],
+    [Specify filename containing input files])
+dnl FIXME: Not yet implemented
+dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
+dnl    [Compiler flag to generate thread safe objects])
+])# _LT_LINKER_SHLIBS
+
+
+# _LT_LANG_C_CONFIG([TAG])
+# ------------------------
+# Ensure that the configuration variables for a C compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_C_CONFIG],
+[m4_require([_LT_DECL_EGREP])dnl
+lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+_LT_TAG_COMPILER
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_SYS_DYNAMIC_LINKER($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+  LT_SYS_DLOPEN_SELF
+  _LT_CMD_STRIPLIB
+
+  # Report which library types will actually be built
+  AC_MSG_CHECKING([if libtool supports shared libraries])
+  AC_MSG_RESULT([$can_build_shared])
+
+  AC_MSG_CHECKING([whether to build shared libraries])
+  test "$can_build_shared" = "no" && enable_shared=no
+
+  # On AIX, shared libraries and static libraries use the same namespace, and
+  # are all built from PIC.
+  case $host_os in
+  aix3*)
+    test "$enable_shared" = yes && enable_static=no
+    if test -n "$RANLIB"; then
+      archive_cmds="$archive_cmds~\$RANLIB \$lib"
+      postinstall_cmds='$RANLIB $lib'
+    fi
+    ;;
+
+  aix[[4-9]]*)
+    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+      test "$enable_shared" = yes && enable_static=no
+    fi
+    ;;
+  esac
+  AC_MSG_RESULT([$enable_shared])
+
+  AC_MSG_CHECKING([whether to build static libraries])
+  # Make sure either enable_shared or enable_static is yes.
+  test "$enable_shared" = yes || enable_static=yes
+  AC_MSG_RESULT([$enable_static])
+
+  _LT_CONFIG($1)
+fi
+AC_LANG_POP
+CC="$lt_save_CC"
+])# _LT_LANG_C_CONFIG
+
+
+# _LT_LANG_CXX_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a C++ compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_CXX_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  AC_PROG_CXXCPP
+else
+  _lt_caught_CXX_error=yes
+fi
+
+AC_LANG_PUSH(C++)
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(compiler_needs_object, $1)=no
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="int some_variable = 0;"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC=$CC
+  lt_save_CFLAGS=$CFLAGS
+  lt_save_LD=$LD
+  lt_save_GCC=$GCC
+  GCC=$GXX
+  lt_save_with_gnu_ld=$with_gnu_ld
+  lt_save_path_LD=$lt_cv_path_LD
+  if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+  else
+    $as_unset lt_cv_prog_gnu_ld
+  fi
+  if test -n "${lt_cv_path_LDCXX+set}"; then
+    lt_cv_path_LD=$lt_cv_path_LDCXX
+  else
+    $as_unset lt_cv_path_LD
+  fi
+  test -z "${LDCXX+set}" || LD=$LDCXX
+  CC=${CXX-"c++"}
+  CFLAGS=$CXXFLAGS
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    # We don't want -fno-exception when compiling C++ code, so set the
+    # no_builtin_flag separately
+    if test "$GXX" = yes; then
+      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+    else
+      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+    fi
+
+    if test "$GXX" = yes; then
+      # Set up default GNU C++ configuration
+
+      LT_PATH_LD
+
+      # Check if GNU C++ uses GNU ld as the underlying linker, since the
+      # archiving commands below assume that GNU ld is being used.
+      if test "$with_gnu_ld" = yes; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+        # If archive_cmds runs LD, not CC, wlarc should be empty
+        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+        #     investigate it a little bit more. (MM)
+        wlarc='${wl}'
+
+        # ancient GNU ld didn't support --whole-archive et. al.
+        if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+	  $GREP 'no-whole-archive' > /dev/null; then
+          _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+        else
+          _LT_TAGVAR(whole_archive_flag_spec, $1)=
+        fi
+      else
+        with_gnu_ld=no
+        wlarc=
+
+        # A generic and very simple default shared library creation
+        # command for GNU C++ for the case where it uses the native
+        # linker, instead of GNU ld.  If possible, this setting should
+        # overridden to take advantage of the native linker features on
+        # the platform it is being used on.
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      fi
+
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+    else
+      GXX=no
+      with_gnu_ld=no
+      wlarc=
+    fi
+
+    # PORTME: fill in a description of your system's C++ link characteristics
+    AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+    _LT_TAGVAR(ld_shlibs, $1)=yes
+    case $host_os in
+      aix3*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+      aix[[4-9]]*)
+        if test "$host_cpu" = ia64; then
+          # On IA64, the linker does run time linking by default, so we don't
+          # have to do anything special.
+          aix_use_runtimelinking=no
+          exp_sym_flag='-Bexport'
+          no_entry_flag=""
+        else
+          aix_use_runtimelinking=no
+
+          # Test if we are trying to use run time linking or normal
+          # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+          # need to do runtime linking.
+          case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+	    for ld_flag in $LDFLAGS; do
+	      case $ld_flag in
+	      *-brtl*)
+	        aix_use_runtimelinking=yes
+	        break
+	        ;;
+	      esac
+	    done
+	    ;;
+          esac
+
+          exp_sym_flag='-bexport'
+          no_entry_flag='-bnoentry'
+        fi
+
+        # When large executables or shared objects are built, AIX ld can
+        # have problems creating the table of contents.  If linking a library
+        # or program results in "error TOC overflow" add -mminimal-toc to
+        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+        _LT_TAGVAR(archive_cmds, $1)=''
+        _LT_TAGVAR(hardcode_direct, $1)=yes
+        _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+        _LT_TAGVAR(link_all_deplibs, $1)=yes
+        _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+        if test "$GXX" = yes; then
+          case $host_os in aix4.[[012]]|aix4.[[012]].*)
+          # We only want to do this on AIX 4.2 and lower, the check
+          # below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	     strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	    # We have reworked collect2
+	    :
+	  else
+	    # We have old collect2
+	    _LT_TAGVAR(hardcode_direct, $1)=unsupported
+	    # It fails to find uninstalled libraries when the uninstalled
+	    # path is not listed in the libpath.  Setting hardcode_minus_L
+	    # to unsupported forces relinking
+	    _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=
+	  fi
+          esac
+          shared_flag='-shared'
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag="$shared_flag "'${wl}-G'
+	  fi
+        else
+          # not using gcc
+          if test "$host_cpu" = ia64; then
+	  # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	  # chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+          else
+	    if test "$aix_use_runtimelinking" = yes; then
+	      shared_flag='${wl}-G'
+	    else
+	      shared_flag='${wl}-bM:SRE'
+	    fi
+          fi
+        fi
+
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+        # It seems that -bexpall does not export symbols beginning with
+        # underscore (_), so it is better to generate a list of symbols to
+	# export.
+        _LT_TAGVAR(always_export_symbols, $1)=yes
+        if test "$aix_use_runtimelinking" = yes; then
+          # Warning - without using the other runtime loading flags (-brtl),
+          # -berok will link without error, but may produce a broken library.
+          _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+          # Determine the default libpath from the value encoded in an empty
+          # executable.
+          _LT_SYS_MODULE_PATH_AIX([$1])
+          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        else
+          if test "$host_cpu" = ia64; then
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	    _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+          else
+	    # Determine the default libpath from the value encoded in an
+	    # empty executable.
+	    _LT_SYS_MODULE_PATH_AIX([$1])
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	    # Warning - without using the other run time loading flags,
+	    # -berok will link without error, but may produce a broken library.
+	    _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	    _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	    if test "$with_gnu_ld" = yes; then
+	      # We only use this code for GNU lds that support --whole-archive.
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    else
+	      # Exported symbols can be pulled into shared objects from archives
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	    fi
+	    _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	    # This is similar to how AIX traditionally builds its shared
+	    # libraries.
+	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+          fi
+        fi
+        ;;
+
+      beos*)
+	if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  # Joseph Beckenbach  says some releases of gcc
+	  # support --undefined.  This deserves some investigation.  FIXME
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	else
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+
+      chorus*)
+        case $cc_basename in
+          *)
+	  # FIXME: insert proper C++ library support
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	  ;;
+        esac
+        ;;
+
+      cygwin* | mingw* | pw32* | cegcc*)
+	case $GXX,$cc_basename in
+	,cl* | no,cl*)
+	  # Native MSVC
+	  # hardcode_libdir_flag_spec is actually meaningless, as there is
+	  # no search path for DLLs.
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  _LT_TAGVAR(always_export_symbols, $1)=yes
+	  _LT_TAGVAR(file_list_spec, $1)='@'
+	  # Tell ltmain to make .lib files, not .a files.
+	  libext=lib
+	  # Tell ltmain to make .dll files, not .so files.
+	  shrext_cmds=".dll"
+	  # FIXME: Setting linknames here is a bad hack.
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	      $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	    else
+	      $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	    fi~
+	    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	    linknames='
+	  # The linker will not automatically build a static lib if we build a DLL.
+	  # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	  # Don't use ranlib
+	  _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+	  _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+	    lt_tool_outputfile="@TOOL_OUTPUT@"~
+	    case $lt_outputfile in
+	      *.exe|*.EXE) ;;
+	      *)
+		lt_outputfile="$lt_outputfile.exe"
+		lt_tool_outputfile="$lt_tool_outputfile.exe"
+		;;
+	    esac~
+	    func_to_tool_file "$lt_outputfile"~
+	    if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	      $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	      $RM "$lt_outputfile.manifest";
+	    fi'
+	  ;;
+	*)
+	  # g++
+	  # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+	  # as there is no search path for DLLs.
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  _LT_TAGVAR(always_export_symbols, $1)=no
+	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+	  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	    # If the export-symbols file already is a .def file (1st line
+	    # is EXPORTS), use it as is; otherwise, prepend...
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	      cp $export_symbols $output_objdir/$soname.def;
+	    else
+	      echo EXPORTS > $output_objdir/$soname.def;
+	      cat $export_symbols >> $output_objdir/$soname.def;
+	    fi~
+	    $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	  else
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	  fi
+	  ;;
+	esac
+	;;
+      darwin* | rhapsody*)
+        _LT_DARWIN_LINKER_FEATURES($1)
+	;;
+
+      dgux*)
+        case $cc_basename in
+          ec++*)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          ghcx*)
+	    # Green Hills C++ Compiler
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+        esac
+        ;;
+
+      freebsd2.*)
+        # C++ shared libraries reported to be fairly broken before
+	# switch to ELF
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      freebsd-elf*)
+        _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+        ;;
+
+      freebsd* | dragonfly*)
+        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+        # conventions
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+        ;;
+
+      gnu*)
+        ;;
+
+      haiku*)
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(link_all_deplibs, $1)=yes
+        ;;
+
+      hpux9*)
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+        _LT_TAGVAR(hardcode_direct, $1)=yes
+        _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+				             # but as the default
+				             # location of the library.
+
+        case $cc_basename in
+          CC*)
+            # FIXME: insert proper C++ library support
+            _LT_TAGVAR(ld_shlibs, $1)=no
+            ;;
+          aCC*)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            # Commands to make compiler produce verbose output that lists
+            # what "hidden" libraries, object files and flags are used when
+            # linking a shared library.
+            #
+            # There doesn't appear to be a way to prevent this compiler from
+            # explicitly linking system object files so we need to strip them
+            # from the output so that they don't get included in the library
+            # dependencies.
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+            ;;
+          *)
+            if test "$GXX" = yes; then
+              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            else
+              # FIXME: insert proper C++ library support
+              _LT_TAGVAR(ld_shlibs, $1)=no
+            fi
+            ;;
+        esac
+        ;;
+
+      hpux10*|hpux11*)
+        if test $with_gnu_ld = no; then
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	  _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+          case $host_cpu in
+            hppa*64*|ia64*)
+              ;;
+            *)
+	      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+              ;;
+          esac
+        fi
+        case $host_cpu in
+          hppa*64*|ia64*)
+            _LT_TAGVAR(hardcode_direct, $1)=no
+            _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+            ;;
+          *)
+            _LT_TAGVAR(hardcode_direct, $1)=yes
+            _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+					         # but as the default
+					         # location of the library.
+            ;;
+        esac
+
+        case $cc_basename in
+          CC*)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          aCC*)
+	    case $host_cpu in
+	      hppa*64*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	      ia64*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	      *)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	    esac
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    ;;
+          *)
+	    if test "$GXX" = yes; then
+	      if test $with_gnu_ld = no; then
+	        case $host_cpu in
+	          hppa*64*)
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	          ia64*)
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	          *)
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	        esac
+	      fi
+	    else
+	      # FIXME: insert proper C++ library support
+	      _LT_TAGVAR(ld_shlibs, $1)=no
+	    fi
+	    ;;
+        esac
+        ;;
+
+      interix[[3-9]]*)
+	_LT_TAGVAR(hardcode_direct, $1)=no
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+	# Instead, shared libraries are loaded at an image base (0x10000000 by
+	# default) and relocated if they conflict, which is a slow very memory
+	# consuming and fragmenting process.  To avoid this, we pick a random,
+	# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+	# time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	;;
+      irix5* | irix6*)
+        case $cc_basename in
+          CC*)
+	    # SGI C++
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+	    # necessary to make sure instantiated templates are included
+	    # in the archive.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+	    ;;
+          *)
+	    if test "$GXX" = yes; then
+	      if test "$with_gnu_ld" = no; then
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	      else
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+	      fi
+	    fi
+	    _LT_TAGVAR(link_all_deplibs, $1)=yes
+	    ;;
+        esac
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+        _LT_TAGVAR(inherit_rpath, $1)=yes
+        ;;
+
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+        case $cc_basename in
+          KCC*)
+	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	    # KCC will only create a shared library if the output file
+	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+	    # to its proper name (with version) after linking.
+	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+	    ;;
+	  icpc* | ecpc* )
+	    # Intel C++
+	    with_gnu_ld=yes
+	    # version 8.0 and above of icpc choke on multiply defined symbols
+	    # if we add $predep_objects and $postdep_objects, however 7.1 and
+	    # earlier do not add the objects themselves.
+	    case `$CC -V 2>&1` in
+	      *"Version 7."*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	      *)  # Version 8.0 or newer
+	        tmp_idyn=
+	        case $host_cpu in
+		  ia64*) tmp_idyn=' -i_dynamic';;
+		esac
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	    esac
+	    _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    ;;
+          pgCC* | pgcpp*)
+            # Portland Group C++ compiler
+	    case `$CC -V` in
+	    *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
+	      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+	      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+		$RANLIB $oldlib'
+	      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+	      ;;
+	    *) # Version 6 and above use weak symbols
+	      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+	      ;;
+	    esac
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+            ;;
+	  cxx*)
+	    # Compaq C++
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+	    runpath_var=LD_RUN_PATH
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+	    ;;
+	  xl* | mpixl* | bgxl*)
+	    # IBM XL 8.0 on PPC, with GNU ld
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    if test "x$supports_anon_versioning" = xyes; then
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+		cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+		echo "local: *; };" >> $output_objdir/$libname.ver~
+		$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	    fi
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	      _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	      _LT_TAGVAR(compiler_needs_object, $1)=yes
+
+	      # Not sure whether something based on
+	      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+	      # would be better.
+	      output_verbose_link_cmd='func_echo_all'
+
+	      # Archives containing C++ object files must be created using
+	      # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	      # necessary to make sure instantiated templates are included
+	      # in the archive.
+	      _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+
+      lynxos*)
+        # FIXME: insert proper C++ library support
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      m88k*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      mvs*)
+        case $cc_basename in
+          cxx*)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+	  *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+	esac
+	;;
+
+      netbsd*)
+        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+	  wlarc=
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	fi
+	# Workaround some broken pre-1.5 toolchains
+	output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+	;;
+
+      *nto* | *qnx*)
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+	;;
+
+      openbsd2*)
+        # C++ shared libraries are fairly broken
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      openbsd*)
+	if test -f /usr/libexec/ld.so; then
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+	  fi
+	  output_verbose_link_cmd=func_echo_all
+	else
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+
+      osf3* | osf4* | osf5*)
+        case $cc_basename in
+          KCC*)
+	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	    # KCC will only create a shared library if the output file
+	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+	    # to its proper name (with version) after linking.
+	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Archives containing C++ object files must be created using
+	    # the KAI C++ compiler.
+	    case $host in
+	      osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
+	      *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
+	    esac
+	    ;;
+          RCC*)
+	    # Rational C++ 2.4.1
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          cxx*)
+	    case $host in
+	      osf3*)
+	        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+		;;
+	      *)
+	        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+	          echo "-hidden">> $lib.exp~
+	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
+	          $RM $lib.exp'
+	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+		;;
+	    esac
+
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    ;;
+	  *)
+	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	      _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	      case $host in
+	        osf3*)
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	        *)
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	      esac
+
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	      # Commands to make compiler produce verbose output that lists
+	      # what "hidden" libraries, object files and flags are used when
+	      # linking a shared library.
+	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+	    else
+	      # FIXME: insert proper C++ library support
+	      _LT_TAGVAR(ld_shlibs, $1)=no
+	    fi
+	    ;;
+        esac
+        ;;
+
+      psos*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      sunos4*)
+        case $cc_basename in
+          CC*)
+	    # Sun C++ 4.x
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          lcc*)
+	    # Lucid
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+        esac
+        ;;
+
+      solaris*)
+        case $cc_basename in
+          CC* | sunCC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+            _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
+	    _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	      $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	    _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	    case $host_os in
+	      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+	      *)
+		# The compiler driver will combine and reorder linker options,
+		# but understands `-z linker_flag'.
+	        # Supported since Solaris 2.6 (maybe 2.5.1?)
+		_LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+	        ;;
+	    esac
+	    _LT_TAGVAR(link_all_deplibs, $1)=yes
+
+	    output_verbose_link_cmd='func_echo_all'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	    # necessary to make sure instantiated templates are included
+	    # in the archive.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	    ;;
+          gcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+	    # The C++ compiler must be used to create the archive.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+	    ;;
+          *)
+	    # GNU C++ compiler with Solaris linker
+	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	      _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+	      if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+		  $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	        # Commands to make compiler produce verbose output that lists
+	        # what "hidden" libraries, object files and flags are used when
+	        # linking a shared library.
+	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	      else
+	        # g++ 2.7 appears to require `-G' NOT `-shared' on this
+	        # platform.
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+		  $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	        # Commands to make compiler produce verbose output that lists
+	        # what "hidden" libraries, object files and flags are used when
+	        # linking a shared library.
+	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	      fi
+
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+	      case $host_os in
+		solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+		*)
+		  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+		  ;;
+	      esac
+	    fi
+	    ;;
+        esac
+        ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      case $cc_basename in
+        CC*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+      esac
+      ;;
+
+      sysv5* | sco3.2v5* | sco5v6*)
+	# Note: We can NOT use -z defs as we might desire, because we do not
+	# link with -lc, and that would cause any symbols used from libc to
+	# always be unresolved, which means just about no library would
+	# ever link correctly.  If we're not using GNU ld we use -z text
+	# though, which does catch some bad symbols but isn't as heavy-handed
+	# as -z defs.
+	_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+	_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+	_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+	_LT_TAGVAR(link_all_deplibs, $1)=yes
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+	runpath_var='LD_RUN_PATH'
+
+	case $cc_basename in
+          CC*)
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
+	      '"$_LT_TAGVAR(old_archive_cmds, $1)"
+	    _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
+	      '"$_LT_TAGVAR(reload_cmds, $1)"
+	    ;;
+	  *)
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    ;;
+	esac
+      ;;
+
+      tandem*)
+        case $cc_basename in
+          NCC*)
+	    # NonStop-UX NCC 3.20
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+        esac
+        ;;
+
+      vxworks*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      *)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+    esac
+
+    AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+    test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+    _LT_TAGVAR(GCC, $1)="$GXX"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_SYS_HIDDEN_LIBDEPS($1)
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+  LDCXX=$LD
+  LD=$lt_save_LD
+  GCC=$lt_save_GCC
+  with_gnu_ld=$lt_save_with_gnu_ld
+  lt_cv_path_LDCXX=$lt_cv_path_LD
+  lt_cv_path_LD=$lt_save_path_LD
+  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test "$_lt_caught_CXX_error" != yes
+
+AC_LANG_POP
+])# _LT_LANG_CXX_CONFIG
+
+
+# _LT_FUNC_STRIPNAME_CNF
+# ----------------------
+# func_stripname_cnf prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+#
+# This function is identical to the (non-XSI) version of func_stripname,
+# except this one can be used by m4 code that may be executed by configure,
+# rather than the libtool script.
+m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
+AC_REQUIRE([_LT_DECL_SED])
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
+func_stripname_cnf ()
+{
+  case ${2} in
+  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+  esac
+} # func_stripname_cnf
+])# _LT_FUNC_STRIPNAME_CNF
+
+# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
+# ---------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
+# Dependencies to place before and after the object being linked:
+_LT_TAGVAR(predep_objects, $1)=
+_LT_TAGVAR(postdep_objects, $1)=
+_LT_TAGVAR(predeps, $1)=
+_LT_TAGVAR(postdeps, $1)=
+_LT_TAGVAR(compiler_lib_search_path, $1)=
+
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library.  It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
+int a;
+void foo (void) { a = 0; }
+_LT_EOF
+], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+_LT_EOF
+], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer*4 a
+      a=0
+      return
+      end
+_LT_EOF
+], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer a
+      a=0
+      return
+      end
+_LT_EOF
+], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
+public class foo {
+  private int a;
+  public void bar (void) {
+    a = 0;
+  }
+};
+_LT_EOF
+], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
+package foo
+func foo() {
+}
+_LT_EOF
+])
+
+_lt_libdeps_save_CFLAGS=$CFLAGS
+case "$CC $CFLAGS " in #(
+*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
+*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
+esac
+
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  for p in `eval "$output_verbose_link_cmd"`; do
+    case ${prev}${p} in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" ||
+          test $p = "-R"; then
+	 prev=$p
+	 continue
+       fi
+
+       # Expand the sysroot to ease extracting the directories later.
+       if test -z "$prev"; then
+         case $p in
+         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
+         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
+         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
+         esac
+       fi
+       case $p in
+       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
+       esac
+       if test "$pre_test_object_deps_done" = no; then
+	 case ${prev} in
+	 -L | -R)
+	   # Internal compiler library paths should come after those
+	   # provided the user.  The postdeps already come after the
+	   # user supplied libs so there is no need to process them.
+	   if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
+	     _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+	   else
+	     _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+	   fi
+	   ;;
+	 # The "-l" case would never come before the object being
+	 # linked, so don't bother handling this case.
+	 esac
+       else
+	 if test -z "$_LT_TAGVAR(postdeps, $1)"; then
+	   _LT_TAGVAR(postdeps, $1)="${prev}${p}"
+	 else
+	   _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
+	 fi
+       fi
+       prev=
+       ;;
+
+    *.lto.$objext) ;; # Ignore GCC LTO objects
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+	 pre_test_object_deps_done=yes
+	 continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
+	   _LT_TAGVAR(predep_objects, $1)="$p"
+	 else
+	   _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
+	 fi
+       else
+	 if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
+	   _LT_TAGVAR(postdep_objects, $1)="$p"
+	 else
+	   _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
+	 fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$RM -f confest.$objext
+CFLAGS=$_lt_libdeps_save_CFLAGS
+
+# PORTME: override above test on systems where it is broken
+m4_if([$1], [CXX],
+[case $host_os in
+interix[[3-9]]*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  _LT_TAGVAR(predep_objects,$1)=
+  _LT_TAGVAR(postdep_objects,$1)=
+  _LT_TAGVAR(postdeps,$1)=
+  ;;
+
+linux*)
+  case `$CC -V 2>&1 | sed 5q` in
+  *Sun\ C*)
+    # Sun C++ 5.9
+
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC* | sunCC*)
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+esac
+])
+
+case " $_LT_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=
+if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
+    [The directories searched by this compiler when creating a shared library])
+_LT_TAGDECL([], [predep_objects], [1],
+    [Dependencies to place before and after the objects being linked to
+    create a shared library])
+_LT_TAGDECL([], [postdep_objects], [1])
+_LT_TAGDECL([], [predeps], [1])
+_LT_TAGDECL([], [postdeps], [1])
+_LT_TAGDECL([], [compiler_lib_search_path], [1],
+    [The library search path used internally by the compiler when linking
+    a shared library])
+])# _LT_SYS_HIDDEN_LIBDEPS
+
+
+# _LT_LANG_F77_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a Fortran 77 compiler are
+# suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_F77_CONFIG],
+[AC_LANG_PUSH(Fortran 77)
+if test -z "$F77" || test "X$F77" = "Xno"; then
+  _lt_disable_F77=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the F77 compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_F77" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="\
+      program t
+      end
+"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC="$CC"
+  lt_save_GCC=$GCC
+  lt_save_CFLAGS=$CFLAGS
+  CC=${F77-"f77"}
+  CFLAGS=$FFLAGS
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+  GCC=$G77
+  if test -n "$compiler"; then
+    AC_MSG_CHECKING([if libtool supports shared libraries])
+    AC_MSG_RESULT([$can_build_shared])
+
+    AC_MSG_CHECKING([whether to build shared libraries])
+    test "$can_build_shared" = "no" && enable_shared=no
+
+    # On AIX, shared libraries and static libraries use the same namespace, and
+    # are all built from PIC.
+    case $host_os in
+      aix3*)
+        test "$enable_shared" = yes && enable_static=no
+        if test -n "$RANLIB"; then
+          archive_cmds="$archive_cmds~\$RANLIB \$lib"
+          postinstall_cmds='$RANLIB $lib'
+        fi
+        ;;
+      aix[[4-9]]*)
+	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+	  test "$enable_shared" = yes && enable_static=no
+	fi
+        ;;
+    esac
+    AC_MSG_RESULT([$enable_shared])
+
+    AC_MSG_CHECKING([whether to build static libraries])
+    # Make sure either enable_shared or enable_static is yes.
+    test "$enable_shared" = yes || enable_static=yes
+    AC_MSG_RESULT([$enable_static])
+
+    _LT_TAGVAR(GCC, $1)="$G77"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  GCC=$lt_save_GCC
+  CC="$lt_save_CC"
+  CFLAGS="$lt_save_CFLAGS"
+fi # test "$_lt_disable_F77" != yes
+
+AC_LANG_POP
+])# _LT_LANG_F77_CONFIG
+
+
+# _LT_LANG_FC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for a Fortran compiler are
+# suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_FC_CONFIG],
+[AC_LANG_PUSH(Fortran)
+
+if test -z "$FC" || test "X$FC" = "Xno"; then
+  _lt_disable_FC=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for fc test sources.
+ac_ext=${ac_fc_srcext-f}
+
+# Object file extension for compiled fc test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the FC compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_FC" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="\
+      program t
+      end
+"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC="$CC"
+  lt_save_GCC=$GCC
+  lt_save_CFLAGS=$CFLAGS
+  CC=${FC-"f95"}
+  CFLAGS=$FCFLAGS
+  compiler=$CC
+  GCC=$ac_cv_fc_compiler_gnu
+
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    AC_MSG_CHECKING([if libtool supports shared libraries])
+    AC_MSG_RESULT([$can_build_shared])
+
+    AC_MSG_CHECKING([whether to build shared libraries])
+    test "$can_build_shared" = "no" && enable_shared=no
+
+    # On AIX, shared libraries and static libraries use the same namespace, and
+    # are all built from PIC.
+    case $host_os in
+      aix3*)
+        test "$enable_shared" = yes && enable_static=no
+        if test -n "$RANLIB"; then
+          archive_cmds="$archive_cmds~\$RANLIB \$lib"
+          postinstall_cmds='$RANLIB $lib'
+        fi
+        ;;
+      aix[[4-9]]*)
+	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+	  test "$enable_shared" = yes && enable_static=no
+	fi
+        ;;
+    esac
+    AC_MSG_RESULT([$enable_shared])
+
+    AC_MSG_CHECKING([whether to build static libraries])
+    # Make sure either enable_shared or enable_static is yes.
+    test "$enable_shared" = yes || enable_static=yes
+    AC_MSG_RESULT([$enable_static])
+
+    _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_SYS_HIDDEN_LIBDEPS($1)
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  GCC=$lt_save_GCC
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+fi # test "$_lt_disable_FC" != yes
+
+AC_LANG_POP
+])# _LT_LANG_FC_CONFIG
+
+
+# _LT_LANG_GCJ_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Java Compiler compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GCJ_CONFIG],
+[AC_REQUIRE([LT_PROG_GCJ])dnl
+AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GCJ-"gcj"}
+CFLAGS=$GCJFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+
+  _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GCJ_CONFIG
+
+
+# _LT_LANG_GO_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Go compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GO_CONFIG],
+[AC_REQUIRE([LT_PROG_GO])dnl
+AC_LANG_SAVE
+
+# Source file extension for Go test sources.
+ac_ext=go
+
+# Object file extension for compiled Go test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="package main; func main() { }"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='package main; func main() { }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GOC-"gccgo"}
+CFLAGS=$GOFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# Go did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+
+  _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GO_CONFIG
+
+
+# _LT_LANG_RC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for the Windows resource compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_RC_CONFIG],
+[AC_REQUIRE([LT_PROG_RC])dnl
+AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=
+CC=${RC-"windres"}
+CFLAGS=
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+if test -n "$compiler"; then
+  :
+  _LT_CONFIG($1)
+fi
+
+GCC=$lt_save_GCC
+AC_LANG_RESTORE
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_RC_CONFIG
+
+
+# LT_PROG_GCJ
+# -----------
+AC_DEFUN([LT_PROG_GCJ],
+[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
+  [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
+    [AC_CHECK_TOOL(GCJ, gcj,)
+      test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+      AC_SUBST(GCJFLAGS)])])[]dnl
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
+
+
+# LT_PROG_GO
+# ----------
+AC_DEFUN([LT_PROG_GO],
+[AC_CHECK_TOOL(GOC, gccgo,)
+])
+
+
+# LT_PROG_RC
+# ----------
+AC_DEFUN([LT_PROG_RC],
+[AC_CHECK_TOOL(RC, windres,)
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_RC], [])
+
+
+# _LT_DECL_EGREP
+# --------------
+# If we don't have a new enough Autoconf to choose the best grep
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_EGREP],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_REQUIRE([AC_PROG_FGREP])dnl
+test -z "$GREP" && GREP=grep
+_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
+_LT_DECL([], [EGREP], [1], [An ERE matcher])
+_LT_DECL([], [FGREP], [1], [A literal string matcher])
+dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
+AC_SUBST([GREP])
+])
+
+
+# _LT_DECL_OBJDUMP
+# --------------
+# If we don't have a new enough Autoconf to choose the best objdump
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_OBJDUMP],
+[AC_CHECK_TOOL(OBJDUMP, objdump, false)
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
+AC_SUBST([OBJDUMP])
+])
+
+# _LT_DECL_DLLTOOL
+# ----------------
+# Ensure DLLTOOL variable is set.
+m4_defun([_LT_DECL_DLLTOOL],
+[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
+AC_SUBST([DLLTOOL])
+])
+
+# _LT_DECL_SED
+# ------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+m4_defun([_LT_DECL_SED],
+[AC_PROG_SED
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
+_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
+    [Sed that helps us avoid accidentally triggering echo(1) options like -n])
+])# _LT_DECL_SED
+
+m4_ifndef([AC_PROG_SED], [
+############################################################
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+############################################################
+
+m4_defun([AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && continue
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+])
+SED=$lt_cv_path_SED
+AC_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])#AC_PROG_SED
+])#m4_ifndef
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_SED], [])
+
+
+# _LT_CHECK_SHELL_FEATURES
+# ------------------------
+# Find out whether the shell is Bourne or XSI compatible,
+# or has some other useful features.
+m4_defun([_LT_CHECK_SHELL_FEATURES],
+[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,b/c, \
+    && eval 'test $(( 1 + 1 )) -eq 2 \
+    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+  && xsi_shell=yes
+AC_MSG_RESULT([$xsi_shell])
+_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
+
+AC_MSG_CHECKING([whether the shell understands "+="])
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
+    >/dev/null 2>&1 \
+  && lt_shell_append=yes
+AC_MSG_RESULT([$lt_shell_append])
+_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  lt_unset=unset
+else
+  lt_unset=false
+fi
+_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  lt_SP2NL='tr \040 \012'
+  lt_NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  lt_SP2NL='tr \100 \n'
+  lt_NL2SP='tr \r\n \100\100'
+  ;;
+esac
+_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
+_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
+])# _LT_CHECK_SHELL_FEATURES
+
+
+# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
+# ------------------------------------------------------
+# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
+# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
+m4_defun([_LT_PROG_FUNCTION_REPLACE],
+[dnl {
+sed -e '/^$1 ()$/,/^} # $1 /c\
+$1 ()\
+{\
+m4_bpatsubsts([$2], [$], [\\], [^\([	 ]\)], [\\\1])
+} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+])
+
+
+# _LT_PROG_REPLACE_SHELLFNS
+# -------------------------
+# Replace existing portable implementations of several shell functions with
+# equivalent extended shell implementations where those features are available..
+m4_defun([_LT_PROG_REPLACE_SHELLFNS],
+[if test x"$xsi_shell" = xyes; then
+  _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
+    case ${1} in
+      */*) func_dirname_result="${1%/*}${2}" ;;
+      *  ) func_dirname_result="${3}" ;;
+    esac])
+
+  _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
+    func_basename_result="${1##*/}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
+    case ${1} in
+      */*) func_dirname_result="${1%/*}${2}" ;;
+      *  ) func_dirname_result="${3}" ;;
+    esac
+    func_basename_result="${1##*/}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
+    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+    # positional parameters, so assign one to ordinary parameter first.
+    func_stripname_result=${3}
+    func_stripname_result=${func_stripname_result#"${1}"}
+    func_stripname_result=${func_stripname_result%"${2}"}])
+
+  _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
+    func_split_long_opt_name=${1%%=*}
+    func_split_long_opt_arg=${1#*=}])
+
+  _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
+    func_split_short_opt_arg=${1#??}
+    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
+
+  _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
+    case ${1} in
+      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+      *)    func_lo2o_result=${1} ;;
+    esac])
+
+  _LT_PROG_FUNCTION_REPLACE([func_xform], [    func_xform_result=${1%.*}.lo])
+
+  _LT_PROG_FUNCTION_REPLACE([func_arith], [    func_arith_result=$(( $[*] ))])
+
+  _LT_PROG_FUNCTION_REPLACE([func_len], [    func_len_result=${#1}])
+fi
+
+if test x"$lt_shell_append" = xyes; then
+  _LT_PROG_FUNCTION_REPLACE([func_append], [    eval "${1}+=\\${2}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
+    func_quote_for_eval "${2}"
+dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
+    eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
+
+  # Save a `func_append' function call where possible by direct use of '+='
+  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+else
+  # Save a `func_append' function call even when '+=' is not available
+  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+  AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
+fi
+])
+
+# _LT_PATH_CONVERSION_FUNCTIONS
+# -----------------------------
+# Determine which file name conversion functions should be used by
+# func_to_host_file (and, implicitly, by func_to_host_path).  These are needed
+# for certain cross-compile configurations and native mingw.
+m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_MSG_CHECKING([how to convert $build file names to $host format])
+AC_CACHE_VAL(lt_cv_to_host_file_cmd,
+[case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+        ;;
+    esac
+    ;;
+  *-*-cygwin* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_noop
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+        ;;
+    esac
+    ;;
+  * ) # unhandled hosts (and "normal" native builds)
+    lt_cv_to_host_file_cmd=func_convert_file_noop
+    ;;
+esac
+])
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
+_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
+         [0], [convert $build file names to $host format])dnl
+
+AC_MSG_CHECKING([how to convert $build file names to toolchain format])
+AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
+[#assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+        ;;
+    esac
+    ;;
+esac
+])
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
+_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
+         [0], [convert $build files to toolchain format])dnl
+])# _LT_PATH_CONVERSION_FUNCTIONS
diff --git a/contrib/file/m4/ltoptions.m4 b/contrib/file/m4/ltoptions.m4
new file mode 100644
index 00000000000..5d9acd8e23b
--- /dev/null
+++ b/contrib/file/m4/ltoptions.m4
@@ -0,0 +1,384 @@
+# Helper functions for option handling.                    -*- Autoconf -*-
+#
+#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
+#   Inc.
+#   Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 7 ltoptions.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+
+
+# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
+# ------------------------------------------
+m4_define([_LT_MANGLE_OPTION],
+[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
+
+
+# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
+# ---------------------------------------
+# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
+# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
+# saved as a flag.
+m4_define([_LT_SET_OPTION],
+[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
+m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
+        _LT_MANGLE_DEFUN([$1], [$2]),
+    [m4_warning([Unknown $1 option `$2'])])[]dnl
+])
+
+
+# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
+# ------------------------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+m4_define([_LT_IF_OPTION],
+[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
+
+
+# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
+# -------------------------------------------------------
+# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
+# are set.
+m4_define([_LT_UNLESS_OPTIONS],
+[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+	    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
+		      [m4_define([$0_found])])])[]dnl
+m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
+])[]dnl
+])
+
+
+# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
+# ----------------------------------------
+# OPTION-LIST is a space-separated list of Libtool options associated
+# with MACRO-NAME.  If any OPTION has a matching handler declared with
+# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
+# the unknown option and exit.
+m4_defun([_LT_SET_OPTIONS],
+[# Set options
+m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+    [_LT_SET_OPTION([$1], _LT_Option)])
+
+m4_if([$1],[LT_INIT],[
+  dnl
+  dnl Simply set some default values (i.e off) if boolean options were not
+  dnl specified:
+  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
+  ])
+  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
+  ])
+  dnl
+  dnl If no reference was made to various pairs of opposing options, then
+  dnl we run the default mode handler for the pair.  For example, if neither
+  dnl `shared' nor `disable-shared' was passed, we enable building of shared
+  dnl archives by default:
+  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
+  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
+  		   [_LT_ENABLE_FAST_INSTALL])
+  ])
+])# _LT_SET_OPTIONS
+
+
+## --------------------------------- ##
+## Macros to handle LT_INIT options. ##
+## --------------------------------- ##
+
+# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
+# -----------------------------------------
+m4_define([_LT_MANGLE_DEFUN],
+[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
+
+
+# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
+# -----------------------------------------------
+m4_define([LT_OPTION_DEFINE],
+[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
+])# LT_OPTION_DEFINE
+
+
+# dlopen
+# ------
+LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
+])
+
+AU_DEFUN([AC_LIBTOOL_DLOPEN],
+[_LT_SET_OPTION([LT_INIT], [dlopen])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `dlopen' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
+
+
+# win32-dll
+# ---------
+# Declare package support for building win32 dll's.
+LT_OPTION_DEFINE([LT_INIT], [win32-dll],
+[enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+esac
+
+test -z "$AS" && AS=as
+_LT_DECL([], [AS],      [1], [Assembler program])dnl
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
+])# win32-dll
+
+AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+_LT_SET_OPTION([LT_INIT], [win32-dll])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `win32-dll' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
+
+
+# _LT_ENABLE_SHARED([DEFAULT])
+# ----------------------------
+# implement the --enable-shared flag, and supports the `shared' and
+# `disable-shared' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_SHARED],
+[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([shared],
+    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+	[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
+
+    _LT_DECL([build_libtool_libs], [enable_shared], [0],
+	[Whether or not to build shared libraries])
+])# _LT_ENABLE_SHARED
+
+LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
+])
+
+AC_DEFUN([AC_DISABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], [disable-shared])
+])
+
+AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_SHARED], [])
+dnl AC_DEFUN([AM_DISABLE_SHARED], [])
+
+
+
+# _LT_ENABLE_STATIC([DEFAULT])
+# ----------------------------
+# implement the --enable-static flag, and support the `static' and
+# `disable-static' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_STATIC],
+[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([static],
+    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+	[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
+
+    _LT_DECL([build_old_libs], [enable_static], [0],
+	[Whether or not to build static libraries])
+])# _LT_ENABLE_STATIC
+
+LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
+])
+
+AC_DEFUN([AC_DISABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], [disable-static])
+])
+
+AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_STATIC], [])
+dnl AC_DEFUN([AM_DISABLE_STATIC], [])
+
+
+
+# _LT_ENABLE_FAST_INSTALL([DEFAULT])
+# ----------------------------------
+# implement the --enable-fast-install flag, and support the `fast-install'
+# and `disable-fast-install' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_FAST_INSTALL],
+[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([fast-install],
+    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
+
+_LT_DECL([fast_install], [enable_fast_install], [0],
+	 [Whether or not to optimize for fast installation])dnl
+])# _LT_ENABLE_FAST_INSTALL
+
+LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `fast-install' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-fast-install' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
+dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
+
+
+# _LT_WITH_PIC([MODE])
+# --------------------
+# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# LT_INIT options.
+# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+m4_define([_LT_WITH_PIC],
+[AC_ARG_WITH([pic],
+    [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
+	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [lt_p=${PACKAGE-default}
+    case $withval in
+    yes|no) pic_mode=$withval ;;
+    *)
+      pic_mode=default
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for lt_pkg in $withval; do
+	IFS="$lt_save_ifs"
+	if test "X$lt_pkg" = "X$lt_p"; then
+	  pic_mode=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [pic_mode=default])
+
+test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+
+_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
+])# _LT_WITH_PIC
+
+LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
+
+# Old name:
+AU_DEFUN([AC_LIBTOOL_PICMODE],
+[_LT_SET_OPTION([LT_INIT], [pic-only])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `pic-only' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
+
+## ----------------- ##
+## LTDL_INIT Options ##
+## ----------------- ##
+
+m4_define([_LTDL_MODE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
+		 [m4_define([_LTDL_MODE], [nonrecursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [recursive],
+		 [m4_define([_LTDL_MODE], [recursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [subproject],
+		 [m4_define([_LTDL_MODE], [subproject])])
+
+m4_define([_LTDL_TYPE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [installable],
+		 [m4_define([_LTDL_TYPE], [installable])])
+LT_OPTION_DEFINE([LTDL_INIT], [convenience],
+		 [m4_define([_LTDL_TYPE], [convenience])])
diff --git a/contrib/file/m4/ltsugar.m4 b/contrib/file/m4/ltsugar.m4
new file mode 100644
index 00000000000..9000a057d31
--- /dev/null
+++ b/contrib/file/m4/ltsugar.m4
@@ -0,0 +1,123 @@
+# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 6 ltsugar.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+
+
+# lt_join(SEP, ARG1, [ARG2...])
+# -----------------------------
+# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
+# associated separator.
+# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
+# versions in m4sugar had bugs.
+m4_define([lt_join],
+[m4_if([$#], [1], [],
+       [$#], [2], [[$2]],
+       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
+m4_define([_lt_join],
+[m4_if([$#$2], [2], [],
+       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
+
+
+# lt_car(LIST)
+# lt_cdr(LIST)
+# ------------
+# Manipulate m4 lists.
+# These macros are necessary as long as will still need to support
+# Autoconf-2.59 which quotes differently.
+m4_define([lt_car], [[$1]])
+m4_define([lt_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+       [$#], 1, [],
+       [m4_dquote(m4_shift($@))])])
+m4_define([lt_unquote], $1)
+
+
+# lt_append(MACRO-NAME, STRING, [SEPARATOR])
+# ------------------------------------------
+# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Note that neither SEPARATOR nor STRING are expanded; they are appended
+# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
+# No SEPARATOR is output if MACRO-NAME was previously undefined (different
+# than defined and empty).
+#
+# This macro is needed until we can rely on Autoconf 2.62, since earlier
+# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
+m4_define([lt_append],
+[m4_define([$1],
+	   m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
+
+
+
+# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
+# ----------------------------------------------------------
+# Produce a SEP delimited list of all paired combinations of elements of
+# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
+# has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
+m4_define([lt_combine],
+[m4_if(m4_eval([$# > 3]), [1],
+       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+	     [m4_foreach([_Lt_suffix],
+		]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+	[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
+
+
+# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+# -----------------------------------------------------------------------
+# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
+# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
+m4_define([lt_if_append_uniq],
+[m4_ifdef([$1],
+	  [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
+		 [lt_append([$1], [$2], [$3])$4],
+		 [$5])],
+	  [lt_append([$1], [$2], [$3])$4])])
+
+
+# lt_dict_add(DICT, KEY, VALUE)
+# -----------------------------
+m4_define([lt_dict_add],
+[m4_define([$1($2)], [$3])])
+
+
+# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
+# --------------------------------------------
+m4_define([lt_dict_add_subkey],
+[m4_define([$1($2:$3)], [$4])])
+
+
+# lt_dict_fetch(DICT, KEY, [SUBKEY])
+# ----------------------------------
+m4_define([lt_dict_fetch],
+[m4_ifval([$3],
+	m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
+    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
+
+
+# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------------------
+m4_define([lt_if_dict_fetch],
+[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
+	[$5],
+    [$6])])
+
+
+# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
+# --------------------------------------------------------------
+m4_define([lt_dict_filter],
+[m4_if([$5], [], [],
+  [lt_join(m4_quote(m4_default([$4], [[, ]])),
+           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
+		      [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
+])
diff --git a/contrib/file/m4/ltversion.m4 b/contrib/file/m4/ltversion.m4
new file mode 100644
index 00000000000..07a8602d48d
--- /dev/null
+++ b/contrib/file/m4/ltversion.m4
@@ -0,0 +1,23 @@
+# ltversion.m4 -- version numbers			-*- Autoconf -*-
+#
+#   Copyright (C) 2004 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# @configure_input@
+
+# serial 3337 ltversion.m4
+# This file is part of GNU Libtool
+
+m4_define([LT_PACKAGE_VERSION], [2.4.2])
+m4_define([LT_PACKAGE_REVISION], [1.3337])
+
+AC_DEFUN([LTVERSION_VERSION],
+[macro_version='2.4.2'
+macro_revision='1.3337'
+_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+_LT_DECL(, macro_revision, 0)
+])
diff --git a/contrib/file/m4/lt~obsolete.m4 b/contrib/file/m4/lt~obsolete.m4
new file mode 100644
index 00000000000..c573da90c5c
--- /dev/null
+++ b/contrib/file/m4/lt~obsolete.m4
@@ -0,0 +1,98 @@
+# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
+#
+#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004.
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 5 lt~obsolete.m4
+
+# These exist entirely to fool aclocal when bootstrapping libtool.
+#
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# which have later been changed to m4_define as they aren't part of the
+# exported API, or moved to Autoconf or Automake where they belong.
+#
+# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN
+# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
+# using a macro with the same name in our local m4/libtool.m4 it'll
+# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
+# and doesn't know about Autoconf macros at all.)
+#
+# So we provide this file, which has a silly filename so it's always
+# included after everything else.  This provides aclocal with the
+# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
+# because those macros already exist, or will be overwritten later.
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 
+#
+# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
+# Yes, that means every name once taken will need to remain here until
+# we give up compatibility with versions before 1.7, at which point
+# we need to keep only those names which we still refer to.
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
+
+m4_ifndef([AC_LIBTOOL_LINKER_OPTION],	[AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
+m4_ifndef([AC_PROG_EGREP],		[AC_DEFUN([AC_PROG_EGREP])])
+m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_AC_SHELL_INIT],		[AC_DEFUN([_LT_AC_SHELL_INIT])])
+m4_ifndef([_LT_AC_SYS_LIBPATH_AIX],	[AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
+m4_ifndef([_LT_PROG_LTMAIN],		[AC_DEFUN([_LT_PROG_LTMAIN])])
+m4_ifndef([_LT_AC_TAGVAR],		[AC_DEFUN([_LT_AC_TAGVAR])])
+m4_ifndef([AC_LTDL_ENABLE_INSTALL],	[AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
+m4_ifndef([AC_LTDL_PREOPEN],		[AC_DEFUN([AC_LTDL_PREOPEN])])
+m4_ifndef([_LT_AC_SYS_COMPILER],	[AC_DEFUN([_LT_AC_SYS_COMPILER])])
+m4_ifndef([_LT_AC_LOCK],		[AC_DEFUN([_LT_AC_LOCK])])
+m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],	[AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
+m4_ifndef([_LT_AC_TRY_DLOPEN_SELF],	[AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
+m4_ifndef([AC_LIBTOOL_PROG_CC_C_O],	[AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
+m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
+m4_ifndef([AC_LIBTOOL_OBJDIR],		[AC_DEFUN([AC_LIBTOOL_OBJDIR])])
+m4_ifndef([AC_LTDL_OBJDIR],		[AC_DEFUN([AC_LTDL_OBJDIR])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
+m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],	[AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
+m4_ifndef([AC_PATH_MAGIC],		[AC_DEFUN([AC_PATH_MAGIC])])
+m4_ifndef([AC_PROG_LD_GNU],		[AC_DEFUN([AC_PROG_LD_GNU])])
+m4_ifndef([AC_PROG_LD_RELOAD_FLAG],	[AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
+m4_ifndef([AC_DEPLIBS_CHECK_METHOD],	[AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
+m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS],	[AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
+m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP],	[AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
+m4_ifndef([LT_AC_PROG_EGREP],		[AC_DEFUN([LT_AC_PROG_EGREP])])
+m4_ifndef([LT_AC_PROG_SED],		[AC_DEFUN([LT_AC_PROG_SED])])
+m4_ifndef([_LT_CC_BASENAME],		[AC_DEFUN([_LT_CC_BASENAME])])
+m4_ifndef([_LT_COMPILER_BOILERPLATE],	[AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
+m4_ifndef([_LT_LINKER_BOILERPLATE],	[AC_DEFUN([_LT_LINKER_BOILERPLATE])])
+m4_ifndef([_AC_PROG_LIBTOOL],		[AC_DEFUN([_AC_PROG_LIBTOOL])])
+m4_ifndef([AC_LIBTOOL_SETUP],		[AC_DEFUN([AC_LIBTOOL_SETUP])])
+m4_ifndef([_LT_AC_CHECK_DLFCN],		[AC_DEFUN([_LT_AC_CHECK_DLFCN])])
+m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],	[AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
+m4_ifndef([_LT_AC_TAGCONFIG],		[AC_DEFUN([_LT_AC_TAGCONFIG])])
+m4_ifndef([AC_DISABLE_FAST_INSTALL],	[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
+m4_ifndef([_LT_AC_LANG_CXX],		[AC_DEFUN([_LT_AC_LANG_CXX])])
+m4_ifndef([_LT_AC_LANG_F77],		[AC_DEFUN([_LT_AC_LANG_F77])])
+m4_ifndef([_LT_AC_LANG_GCJ],		[AC_DEFUN([_LT_AC_LANG_GCJ])])
+m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
+m4_ifndef([_LT_AC_LANG_C_CONFIG],	[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
+m4_ifndef([_LT_AC_LANG_CXX_CONFIG],	[AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
+m4_ifndef([_LT_AC_LANG_F77_CONFIG],	[AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
+m4_ifndef([_LT_AC_LANG_GCJ_CONFIG],	[AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
+m4_ifndef([_LT_AC_LANG_RC_CONFIG],	[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
+m4_ifndef([AC_LIBTOOL_CONFIG],		[AC_DEFUN([AC_LIBTOOL_CONFIG])])
+m4_ifndef([_LT_AC_FILE_LTDLL_C],	[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
+m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS],	[AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
+m4_ifndef([_LT_AC_PROG_CXXCPP],		[AC_DEFUN([_LT_AC_PROG_CXXCPP])])
+m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS],	[AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
+m4_ifndef([_LT_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_PROG_F77],		[AC_DEFUN([_LT_PROG_F77])])
+m4_ifndef([_LT_PROG_FC],		[AC_DEFUN([_LT_PROG_FC])])
+m4_ifndef([_LT_PROG_CXX],		[AC_DEFUN([_LT_PROG_CXX])])
diff --git a/contrib/file/Header b/contrib/file/magic/Header
similarity index 100%
rename from contrib/file/Header
rename to contrib/file/magic/Header
diff --git a/contrib/file/Localstuff b/contrib/file/magic/Localstuff
similarity index 100%
rename from contrib/file/Localstuff
rename to contrib/file/magic/Localstuff
diff --git a/contrib/file/Magdir/acorn b/contrib/file/magic/Magdir/acorn
similarity index 100%
rename from contrib/file/Magdir/acorn
rename to contrib/file/magic/Magdir/acorn
diff --git a/contrib/file/Magdir/adi b/contrib/file/magic/Magdir/adi
similarity index 100%
rename from contrib/file/Magdir/adi
rename to contrib/file/magic/Magdir/adi
diff --git a/contrib/file/Magdir/adventure b/contrib/file/magic/Magdir/adventure
similarity index 92%
rename from contrib/file/Magdir/adventure
rename to contrib/file/magic/Magdir/adventure
index febc2077f12..37b4cb3de2e 100644
--- a/contrib/file/Magdir/adventure
+++ b/contrib/file/magic/Magdir/adventure
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: adventure,v 1.13 2010/12/31 16:32:54 christos Exp $
+# $File: adventure,v 1.14 2012/06/21 01:32:26 christos Exp $
 # adventure: file(1) magic for Adventure game files
 #
 # from Allen Garvin 
@@ -33,10 +33,14 @@
 #
 0	ubyte			>0
 >0	ubyte			<9
->>16	belong&0xfe00f0f0	0x3030	Infocom game data
->>>0	ubyte			x	(Z-machine %d,
->>>>2	ubeshort		x	Release %d /
->>>>18	string			>\0	Serial %.6s)
+>>16	belong&0xfe00f0f0	0x3030
+>>>0	ubyte			< 10
+>>>>2	ubeshort		< 10
+>>>>>18	regex			[0-9][0-9][0-9][0-9][0-9][0-9]
+>>>>>>0	ubyte			< 10	Infocom (Z-machine %d,
+>>>>>>>2	ubeshort	< 10 	Release %d /
+>>>>>>>>18	string		>\0	Serial %.6s)
+!:strength + 40
 
 #------------------------------------------------------------------------------
 # Glulx:  file(1) magic for Glulx binaries.
diff --git a/contrib/file/Magdir/allegro b/contrib/file/magic/Magdir/allegro
similarity index 100%
rename from contrib/file/Magdir/allegro
rename to contrib/file/magic/Magdir/allegro
diff --git a/contrib/file/Magdir/alliant b/contrib/file/magic/Magdir/alliant
similarity index 100%
rename from contrib/file/Magdir/alliant
rename to contrib/file/magic/Magdir/alliant
diff --git a/contrib/file/Magdir/amanda b/contrib/file/magic/Magdir/amanda
similarity index 100%
rename from contrib/file/Magdir/amanda
rename to contrib/file/magic/Magdir/amanda
diff --git a/contrib/file/Magdir/amigaos b/contrib/file/magic/Magdir/amigaos
similarity index 92%
rename from contrib/file/Magdir/amigaos
rename to contrib/file/magic/Magdir/amigaos
index f4c9cf26531..8fdf37662c5 100644
--- a/contrib/file/Magdir/amigaos
+++ b/contrib/file/magic/Magdir/amigaos
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: amigaos,v 1.14 2009/09/19 16:28:07 christos Exp $
+# $File: amigaos,v 1.15 2012/06/21 01:13:59 christos Exp $
 # amigaos:  file(1) magic for AmigaOS binary formats:
 
 #
@@ -63,3 +63,6 @@
 # From: Alex Beregszaszi 
 0	string		LZX		LZX compressed archive (Amiga)
 
+# From: Przemek Kramarczyk 
+0	string 		.KEY		AmigaDOS script
+0	string 		.key		AmigaDOS script
diff --git a/contrib/file/magic/Magdir/android b/contrib/file/magic/Magdir/android
new file mode 100644
index 00000000000..4a4c3feb892
--- /dev/null
+++ b/contrib/file/magic/Magdir/android
@@ -0,0 +1,100 @@
+
+#------------------------------------------------------------
+# $File: android,v 1.4 2014/06/03 19:01:34 christos Exp $
+# Various android related magic entries
+#------------------------------------------------------------
+
+# Dalvik .dex format. http://retrodev.com/android/dexformat.html
+# From  "Mike Fleming"
+# Fixed to avoid regexec 17 errors on some dex files
+# From  "Tim Strazzere"
+0	string	dex\n
+>0	regex	dex\n[0-9]{2}\0	Dalvik dex file
+>4	string	>000			version %s
+0	string	dey\n
+>0	regex	dey\n[0-9]{2}\0	Dalvik dex file (optimized for host)
+>4	string	>000			version %s
+
+# http://android.stackexchange.com/questions/23357/\
+# is-there-a-way-to-look-inside-and-modify-an-adb-backup-created-file/\
+# 23608#23608
+0	string	ANDROID\040BACKUP\n	Android Backup
+>15	string	1\n			\b, version 1
+>17	string	0\n			\b, uncompressed
+>17	string	1\n			\b, compressed
+>19	string	none\n			\b, unencrypted
+>19	string	AES-256\n		\b, encrypted AES-256
+
+# Android bootimg format
+# From https://android.googlesource.com/\
+# platform/system/core/+/master/mkbootimg/bootimg.h
+0		string	ANDROID!	Android bootimg
+>8		lelong	>0			\b, kernel
+>>12	lelong	>0			\b (0x%x)
+>16		lelong	>0			\b, ramdisk
+>>20	lelong	>0			\b (0x%x)
+>24		lelong	>0			\b, second stage
+>>28	lelong	>0			\b (0x%x)
+>36		lelong	>0			\b, page size: %d
+>38		string	>0			\b, name: %s
+>64		string	>0		 	\b, cmdline (%s)
+# Dalvik .dex format. http://retrodev.com/android/dexformat.html
+# From  "Mike Fleming"
+# Fixed to avoid regexec 17 errors on some dex files
+# From  "Tim Strazzere"
+0	string	dex\n
+>0	regex	dex\n[0-9]{2}\0	Dalvik dex file
+>4	string	>000			version %s
+0	string	dey\n
+>0	regex	dey\n[0-9]{2}\0	Dalvik dex file (optimized for host)
+>4	string	>000			version %s
+
+# http://android.stackexchange.com/questions/23357/\
+# is-there-a-way-to-look-inside-and-modify-an-adb-backup-created-file/\
+# 23608#23608
+0	string	ANDROID\040BACKUP\n	Android Backup
+>15	string	1\n			\b, version 1
+>17	string	0\n			\b, uncompressed
+>17	string	1\n			\b, compressed
+>19	string	none\n			\b, unencrypted
+>19	string	AES-256\n		\b, encrypted AES-256
+
+# Android bootimg format
+# From https://android.googlesource.com/\
+# platform/system/core/+/master/mkbootimg/bootimg.h
+0		string	ANDROID!	Android bootimg
+>8		lelong	>0			\b, kernel
+>>12	lelong	>0			\b (0x%x)
+>16		lelong	>0			\b, ramdisk
+>>20	lelong	>0			\b (0x%x)
+>24		lelong	>0			\b, second stage
+>>28	lelong	>0			\b (0x%x)
+>36		lelong	>0			\b, page size: %d
+>38		string	>0			\b, name: %s
+>64		string	>0		 	\b, cmdline (%s)
+
+# Android Backup archive
+# From: Ariel Shkedi
+# File extension: .ab
+# No mime-type defined
+# URL: https://github.com/android/platform_frameworks_base/blob/\
+# 0bacfd2ba68d21a68a3df345b830bc2a1e515b5a/services/java/com/\
+# android/server/BackupManagerService.java#L2367
+# After the header comes a tar file
+# If compressed, the entire tar file is compressed with JAVA deflate
+#
+# Include the version number hardcoded with the magic string to avoid
+# false positives
+0	string/b	ANDROID\ BACKUP\n1\n	Android Backup
+>17	string		0\n			\b, Not-Compressed
+>17	string		1\n			\b, Compressed
+# any string as long as it's not the word none (which is matched below)
+>>19    regex/1l	\^([^n\n]|n[^o]|no[^n]|non[^e]|none.+).*	\b, Encrypted (%s)
+>>19	string		none\n			\b, Not-Encrypted
+# Commented out because they don't seem useful to print
+# (but they are part of the header - the tar file comes after them):
+#>>>&1		regex/1l .*	\b, Password salt: %s
+#>>>>&1		regex/1l .*	\b, Master salt: %s
+#>>>>>&1	regex/1l .*	\b, PBKDF2 rounds: %s
+#>>>>>>&1	regex/1l .*	\b, IV: %s
+#>>>>>>>&1	regex/1l .*	\b, Key: %s
diff --git a/contrib/file/Magdir/animation b/contrib/file/magic/Magdir/animation
similarity index 96%
rename from contrib/file/Magdir/animation
rename to contrib/file/magic/Magdir/animation
index c09a26ac85e..561fe79e512 100644
--- a/contrib/file/Magdir/animation
+++ b/contrib/file/magic/Magdir/animation
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: animation,v 1.45 2011/09/06 11:00:06 christos Exp $
+# $File: animation,v 1.53 2014/04/30 21:41:02 christos Exp $
 # animation:  file(1) magic for animation/movie formats
 #
 # animation formats
@@ -89,7 +89,10 @@
 >>4      byte               77             \b, main
 >>4      byte               88             \b, extended
 >>6      byte               x              \b @ L %u
+# GRR too general as it catches also FoxPro Memo example NG.FPT
 >3       byte               0xB0           MPEG sequence, v4
+# TODO: maybe this extra line exclude FoxPro Memo example NG.FPT starting with 000001b0 00000100 00000000
+#>>4      byte               !0             MPEG sequence, v4
 !:mime  video/mpeg4-generic
 >>5      belong             0x000001B5
 >>>9     byte               &0x80
@@ -448,6 +451,7 @@
 
 # MP2, M2A
 0       beshort&0xFFFE  0xFFF4         MPEG ADTS, layer II, v2
+!:mime	audio/mpeg
 # rate 
 >2      byte&0xF0       0x10           \b,   8 kbps
 >2      byte&0xF0       0x20           \b,  16 kbps 
@@ -617,7 +621,7 @@
 # Live MPEG-4 audio streams (instead of RTP FlexMux)
 0       beshort&0xFFE0  0x56E0         MPEG-4 LOAS
 !:mime	audio/x-mp4a-latm
-#>1     beshort&0x1FFF  x              \b, %u byte packet
+#>1     beshort&0x1FFF  x              \b, %hu byte packet
 >3      byte&0xE0       0x40
 >>4     byte&0x3C       0x04           \b, single stream
 >>4     byte&0x3C       0x08           \b, 2 streams
@@ -688,10 +692,6 @@
 # iso 13818 transport stream
 #
 # from Oskar Schirmer  Feb 3, 2001 (ISO 13818.1)
-# (the following is a little bit restrictive and works fine for a stream
-#  that starts with PAT properly. it won't work for stream data, that is
-#  cut from an input device data right in the middle, but this shouldn't
-#  disturb)
 # syncbyte      8 bit	0x47
 # error_ind     1 bit	-
 # payload_start 1 bit	1
@@ -699,9 +699,9 @@
 # PID          13 bit	0x0000
 # scrambling    2 bit	-
 # adaptfld_ctrl 2 bit	1 or 3
-# conti_count   4 bit	0
-0	belong&0xFF5FFF1F	0x47400010	MPEG transport stream data
->188	byte			!0x47		CORRUPTED
+# conti_count   4 bit	-
+0	belong&0xFF5FFF10	0x47400010
+>188	byte			0x47		MPEG transport stream data
 
 # DIF digital video file format 
 0	belong&0xffffff00	0x1f070000      DIF
@@ -719,16 +719,16 @@
 !:mime	video/x-mng
 >4	belong			!0x0d0a1a0a	CORRUPTED,
 >4	belong			0x0d0a1a0a
->>16    belong	x				%ld x
->>20    belong	x				%ld
+>>16    belong	x				%d x
+>>20    belong	x				%d
 
 # JNG Video Format, 
 0	string			\x8bJNG		JNG video data,
 !:mime	video/x-jng
 >4	belong			!0x0d0a1a0a	CORRUPTED,
 >4	belong			0x0d0a1a0a
->>16    belong	x				%ld x
->>20    belong	x				%ld
+>>16    belong	x				%d x
+>>20    belong	x				%d
 
 # Vivo video (Wolfram Kleff)
 3	string		\x0D\x0AVersion:Vivo	Vivo video data
@@ -755,7 +755,7 @@
 >0	byte		x		GameCube movie,
 >0x34	ubeshort	x		%d x
 >0x36	ubeshort	x		%d,
->0x26	ubeshort	x		%dµs,
+>0x26	ubeshort	x		%dus,
 >0x42	ubeshort	0		no audio
 >0x42	ubeshort	>0		%dHz audio
 
@@ -789,25 +789,26 @@
 
 #						MPEG file
 # MPEG sequences
-# FIXME: This section is from the old magic.mime file and needs integrating with the rest
-0       belong             0x000001BA
->4      byte               &0x40
-!:mime	video/mp2p
->4      byte               ^0x40
-!:mime	video/mpeg
-0       belong             0x000001BB
-!:mime	video/mpeg
-0       belong             0x000001B0
-!:mime	video/mp4v-es
-0       belong             0x000001B5
-!:mime	video/mp4v-es
-0       belong             0x000001B3
-!:mime	video/mpv
-0       belong&0xFF5FFF1F  0x47400010
-!:mime	video/mp2t
-0       belong             0x00000001
->4      byte&0x1F	   0x07
-!:mime	video/h264
+# FIXME: This section is from the old magic.mime file and needs
+# integrating with the rest
+#0       belong             0x000001BA
+#>4      byte               &0x40
+#!:mime	video/mp2p
+#>4      byte               ^0x40
+#!:mime	video/mpeg
+#0       belong             0x000001BB
+#!:mime	video/mpeg
+#0       belong             0x000001B0
+#!:mime	video/mp4v-es
+#0       belong             0x000001B5
+#!:mime	video/mp4v-es
+#0       belong             0x000001B3
+#!:mime	video/mpv
+#0       belong&0xFF5FFF10  0x47400010
+#!:mime	video/mp2t
+#0       belong             0x00000001
+#>4      byte&0x1F	   0x07
+#!:mime	video/h264
 
 # Type: Bink Video
 # Extension: .bik
diff --git a/contrib/file/magic/Magdir/aout b/contrib/file/magic/Magdir/aout
new file mode 100644
index 00000000000..69b6ec60d86
--- /dev/null
+++ b/contrib/file/magic/Magdir/aout
@@ -0,0 +1,46 @@
+
+#------------------------------------------------------------------------------
+# $File: aout,v 1.1 2013/01/09 22:37:23 christos Exp $
+# aout:  file(1) magic for a.out executable/object/etc entries that
+# handle executables on multiple platforms.
+#
+
+#
+# Little-endian 32-bit-int a.out, merged from bsdi (for BSD/OS, from
+# BSDI), netbsd, and vax (for UNIX/32V and BSD)
+#
+# XXX - is there anything we can look at to distinguish BSD/OS 386 from
+# NetBSD 386 from various VAX binaries?  The BSD/OS shared library flag
+# works only for binaries using shared libraries.  Grabbing the entry
+# point from the a.out header, using it to find the first code executed
+# in the program, and looking at that might help.
+#
+0	lelong		0407		a.out little-endian 32-bit executable
+>16	lelong		>0		not stripped
+>32	byte		0x6a		(uses BSD/OS shared libs)
+
+0	lelong		0410		a.out little-endian 32-bit pure executable
+>16	lelong		>0		not stripped
+>32	byte		0x6a		(uses BSD/OS shared libs)
+
+0	lelong		0413		a.out little-endian 32-bit demand paged pure executable
+>16	lelong		>0		not stripped
+>32	byte		0x6a		(uses BSD/OS shared libs)
+
+#
+# Big-endian 32-bit-int a.out, merged from sun (for old 68010 SunOS a.out),
+# mips (for old 68020(!) SGI a.out), and netbsd (for old big-endian a.out).
+#
+# XXX - is there anything we can look at to distinguish old SunOS 68010
+# from old 68020 IRIX from old NetBSD?  Again, I guess we could look at
+# the first instruction or instructions in the program.
+#
+0	belong		0407		a.out big-endian 32-bit executable
+>16	belong		>0		not stripped
+
+0	belong		0410		a.out big-endian 32-bit pure executable
+>16	belong		>0		not stripped
+
+0	belong		0413		a.out big-endian 32-bit demand paged executable
+>16	belong		>0		not stripped
+
diff --git a/contrib/file/Magdir/apl b/contrib/file/magic/Magdir/apl
similarity index 100%
rename from contrib/file/Magdir/apl
rename to contrib/file/magic/Magdir/apl
diff --git a/contrib/file/Magdir/apple b/contrib/file/magic/Magdir/apple
similarity index 80%
rename from contrib/file/Magdir/apple
rename to contrib/file/magic/Magdir/apple
index dad3eee9258..e3dd059f8aa 100644
--- a/contrib/file/Magdir/apple
+++ b/contrib/file/magic/Magdir/apple
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: apple,v 1.24 2010/11/25 15:00:12 christos Exp $
+# $File: apple,v 1.29 2014/04/30 21:41:02 christos Exp $
 # apple:  file(1) magic for Apple file formats
 #
 0	search/1/t	FiLeStArTfIlEsTaRt	binscii (apple ][) text
@@ -106,8 +106,13 @@
 # This is incredibly sloppy, but will be true if the program was
 # written at its usual memory location of 2048 and its first line
 # number is less than 256.  Yuck.
+# update by Joerg Jenderek at Feb 2013
 
-0       belong&0xff00ff 0x80000 Applesoft BASIC program data
+# GRR: this test is still too general as it catches also Gujin BOOT144.SYS (0xfa080000)
+#0       belong&0xff00ff 0x80000 Applesoft BASIC program data
+0	belong&0x00ff00ff	0x00080000	
+# assuming that line number must be positive
+>2	leshort			>0		Applesoft BASIC program data, first line number %d
 #>2     leshort         x       \b, first line number %d
 
 # ORCA/EZ assembler:
@@ -199,15 +204,15 @@
 #  purposes in YellowStep/Cocoa, including some nib files.
 # From: David Remahl 
 2		string		typedstream	NeXT/Apple typedstream data, big endian
->0		byte		x		\b, version %hhd
+>0		byte		x		\b, version %d
 >0		byte		<5		\b
 >>13	byte		0x81	\b
->>>14	ubeshort	x		\b, system %hd
+>>>14	ubeshort	x		\b, system %d
 2		string		streamtyped NeXT/Apple typedstream data, little endian
->0		byte		x		\b, version %hhd
+>0		byte		x		\b, version %d
 >0		byte		<5		\b
 >>13	byte		0x81	\b
->>>14	uleshort	x		\b, system %hd
+>>>14	uleshort	x		\b, system %d
 
 #------------------------------------------------------------------------------
 # CAF: Apple CoreAudio File Format
@@ -249,3 +254,49 @@
 # From: "Nelson A. de Oliveira" 
 # .vdi
 4	string innotek\ VirtualBox\ Disk\ Image %s
+
+# Apple disk partition stuff, strengthen the magic using byte 4
+0	beshort	0x4552
+>4	byte	0			Apple Driver Map
+>>2	beshort	x			\b, blocksize %d
+>>4	belong	x			\b, blockcount %d
+>>10	beshort	x			\b, devtype %d
+>>12	beshort	x			\b, devid %d
+>>20	beshort x			\b, descriptors %d
+# Assume 	8 partitions each at a multiple of the sector size.
+# We could glean this from the partition descriptors, but they are empty!?!?
+>>(2.S*1)	indirect		\b, contains[@0x%x]: 
+>>(2.S*2)	indirect		\b, contains[@0x%x]: 
+>>(2.S*3)	indirect		\b, contains[@0x%x]: 
+>>(2.S*4)	indirect		\b, contains[@0x%x]: 
+>>(2.S*5)	indirect		\b, contains[@0x%x]: 
+>>(2.S*6)	indirect		\b, contains[@0x%x]: 
+>>(2.S*7)	indirect		\b, contains[@0x%x]: 
+>>(2.S*8)	indirect		\b, contains[@0x%x]: 
+
+# Yes, the 3rd and 4th bytes are reserved, but we use them to make the
+# magic stronger.
+0	belong	0x504d0000		Apple Partition Map
+>4	belong	x			\b, map block count %d
+>8	belong	x			\b, start block %d
+>12	belong	x			\b, block count %d
+>16	string >0			\b, name %s
+>48	string >0			\b, type %s
+>124	string >0			\b, processor %s
+>140	string >0			\b, boot arguments %s
+>92	belong	& 1			\b, valid
+>92	belong	& 2			\b, allocated
+>92	belong	& 4			\b, in use
+>92	belong	& 8			\b, has boot info
+>92	belong	& 16			\b, readable
+>92	belong	& 32			\b, writable
+>92	belong	& 64			\b, pic boot code
+>92	belong	& 128			\b, chain compatible driver
+>92	belong	& 256			\b, real driver
+>92	belong	& 512			\b, chain driver
+>92	belong	& 1024			\b, mount at startup
+>92	belong	& 2048			\b, is the startup partition
+
+#http://wiki.mozilla.org/DS_Store_File_Format`
+#http://en.wikipedia.org/wiki/.DS_Store
+0	string	\0\0\0\1Bud1\0		Apple Desktop Services Store
diff --git a/contrib/file/Magdir/applix b/contrib/file/magic/Magdir/applix
similarity index 100%
rename from contrib/file/Magdir/applix
rename to contrib/file/magic/Magdir/applix
diff --git a/contrib/file/Magdir/archive b/contrib/file/magic/Magdir/archive
similarity index 81%
rename from contrib/file/Magdir/archive
rename to contrib/file/magic/Magdir/archive
index 2ff3323c40e..91fbadd183f 100644
--- a/contrib/file/Magdir/archive
+++ b/contrib/file/magic/Magdir/archive
@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: archive,v 1.70 2011/10/26 15:44:47 christos Exp $
+# $File: archive,v 1.87 2014/06/03 19:15:58 christos Exp $
 # archive:  file(1) magic for archive formats (see also "msdos" for self-
 #           extracting compressed archives)
 #
@@ -36,12 +36,66 @@
 0	string		070701		ASCII cpio archive (SVR4 with no CRC)
 0	string		070702		ASCII cpio archive (SVR4 with CRC)
 
-# Debian package (needs to go before regular portable archives)
+#
+# Various archive formats used by various versions of the "ar"
+# command.
+#
+
+#
+# Original UNIX archive formats.
+# They were written with binary values in host byte order, and
+# the magic number was a host "int", which might have been 16 bits
+# or 32 bits.  We don't say "PDP-11" or "VAX", as there might have
+# been ports to little-endian 16-bit-int or 32-bit-int platforms
+# (x86?) using some of those formats; if none existed, feel free
+# to use "PDP-11" for little-endian 16-bit and "VAX" for little-endian
+# 32-bit.  There might have been big-endian ports of that sort as
+# well.
+#
+0	leshort		0177555		very old 16-bit-int little-endian archive
+0	beshort		0177555		very old 16-bit-int big-endian archive
+0	lelong		0177555		very old 32-bit-int little-endian archive
+0	belong		0177555		very old 32-bit-int big-endian archive
+
+0	leshort		0177545		old 16-bit-int little-endian archive
+>2	string		__.SYMDEF	random library
+0	beshort		0177545		old 16-bit-int big-endian archive
+>2	string		__.SYMDEF	random library
+0	lelong		0177545		old 32-bit-int little-endian archive
+>4	string		__.SYMDEF	random library
+0	belong		0177545		old 32-bit-int big-endian archive
+>4	string		__.SYMDEF	random library
+
+#
+# From "pdp" (but why a 4-byte quantity?)
+#
+0	lelong		0x39bed		PDP-11 old archive
+0	lelong		0x39bee		PDP-11 4.0 archive
+
+#
+# XXX - what flavor of APL used this, and was it a variant of
+# some ar archive format?  It's similar to, but not the same
+# as, the APL workspace magic numbers in pdp.
+#
+0	long		0100554		apl workspace
+
+#
+# System V Release 1 portable(?) archive format.
+#
+0	string		=		System V Release 1 ar archive
+!:mime	application/x-archive
+
+#
+# Debian package; it's in the portable archive format, and needs to go
+# before the entry for regular portable archives, as it's recognized as
+# a portable archive whose first member has a name beginning with
+# "debian".
 #
 0	string		=!\ndebian
-!:mime	application/x-debian-package
 >8	string		debian-split	part of multipart Debian package
+!:mime	application/vnd.debian.binary-package
 >8	string		debian-binary	Debian binary package
+!:mime	application/vnd.debian.binary-package
 >8	string		!debian
 >68	string		>\0		(format %s)
 # These next two lines do not work, because a bzip2 Debian archive
@@ -53,18 +107,14 @@
 #>84	string		gz		\b, uses gzip compression
 #>136	ledate		x		created: %s
 
-# other archives
-0	long		0177555		very old archive
-0	short		0177555		very old PDP-11 archive
-0	long		0177545		old archive
-0	short		0177545		old PDP-11 archive
-0	long		0100554		apl workspace
-0	string		=		archive
-!:mime	application/x-archive
-
-# MIPS archive (needs to go before regular portable archives)
+#
+# MIPS archive; they're in the portable archive format, and need to go
+# before the entry for regular portable archives, as it's recognized as
+# a portable archive whose first member has a name beginning with
+# "__________E".
 #
 0	string	=!\n__________E	MIPS archive
+!:mime	application/x-archive
 >20	string	U			with MIPS Ucode members
 >21	string	L			with MIPSEL members
 >21	string	B			with MIPSEB members
@@ -75,56 +125,20 @@
 0	search/1	-h-		Software Tools format archive text
 
 #
-# XXX - why are there multiple  thingies?  Note that 0x213c6172 is
-# "!		current ar archive
-# 0	long		0x213c6172	archive file
-#
-# and for SVR1 archives, we have:
-#
-# 0	string		\		System V Release 1 ar archive
-# 0	string		=		archive
-#
-# XXX - did Aegis really store shared libraries, breakpointed modules,
-# and absolute code program modules in the same format as new-style
-# "ar" archives?
+# BSD/SVR2-and-later portable archive formats.
 #
 0	string		=!		current ar archive
 !:mime	application/x-archive
 >8	string		__.SYMDEF	random library
->0	belong		=65538		- pre SR9.5
->0	belong		=65539		- post SR9.5
->0	beshort		2		- object archive
->0	beshort		3		- shared library module
->0	beshort		4		- debug break-pointed module
->0	beshort		5		- absolute code program module
-0	string		\		System V Release 1 ar archive
-0	string		=		archive
+>68	string		__.SYMDEF\ SORTED	random library
+
 #
-# XXX - from "vax", which appears to collect a bunch of byte-swapped
-# thingies, to help you recognize VAX files on big-endian machines;
-# with "leshort", "lelong", and "string", that's no longer necessary....
+# "Thin" archive, as can be produced by GNU ar.
 #
-0	belong		0x65ff0000	VAX 3.0 archive
-0	belong		0x3c61723e	VAX 5.0 archive
-#
-0	long		0x213c6172	archive file
-0	lelong		0177555		very old VAX archive
-0	leshort		0177555		very old PDP-11 archive
-#
-# XXX - "pdp" claims that 0177545 can have an __.SYMDEF member and thus
-# be a random library (it said 0xff65 rather than 0177545).
-#
-0	lelong		0177545		old VAX archive
->8	string		__.SYMDEF	random library
-0	leshort		0177545		old PDP-11 archive
->8	string		__.SYMDEF	random library
-#
-# From "pdp" (but why a 4-byte quantity?)
-#
-0	lelong		0x39bed		PDP-11 old archive
-0	lelong		0x39bee		PDP-11 4.0 archive
+0	string		=!\n	thin archive with
+>68	belong		0		no symbol entries
+>68	belong		1		%d symbol entry
+>68	belong		>1		%d symbol entries
 
 # ARC archiver, from Daniel Quinlan (quinlan@yggdrasil.com)
 #
@@ -184,7 +198,10 @@
 # SAR
 3	string	LH5 SAR archive data
 # BSArc/BS2
-0	string	\212\3SB \0 BSArc/BS2 archive data
+0	string	\212\3SB\020\0	BSArc/BS2 archive data
+# Bethesda Softworks Archive (Oblivion)
+0	string	BSA\0 		BSArc archive data
+>4	lelong	x		version %d
 # MAR
 2	string	=-ah MAR archive data
 # ACB
@@ -209,7 +226,7 @@
 # AMGC
 0	string	\xad6" AMGC archive data
 # NuLIB
-0	string	NõFélå NuLIB archive data
+0	string	N\xc3\xb5F\xc3\xa9lx\xc3\xa5 NuLIB archive data
 # PakLeo
 0	string	LEOLZW PAKLeo archive data
 # ChArc
@@ -221,7 +238,7 @@
 # Freeze
 0	string	\x1f\x9f\x4a\x10\x0a Freeze archive data
 # KBoom
-0	string	¨MP¨ KBoom archive data
+0	string	\xc2\xa8MP\xc2\xa8 KBoom archive data
 # NSQ, must go after CDC Codec
 0	string	\x76\xff NSQ archive data
 # DPA
@@ -252,14 +269,14 @@
 >9	string	\0
 >>0	string	KWAJ
 >>>7	string	\321\003	MS Compress archive data
->>>>14	ulong	>0		\b, original size: %ld bytes
+>>>>14	ulong	>0		\b, original size: %d bytes
 >>>>18		ubyte	>0x65
 >>>>>18		string	x       \b, was %.8s
 >>>>>(10.b-4)	string	x       \b.%.3s
 # MP3 (archiver, not lossy audio compression)
 0	string	MP3\x1a MP3-Archiver archive data
 # ZET
-0	string	OZÝ ZET archive data
+0	string	OZ\xc3\x9d ZET archive data
 # TSComp
 0	string	\x65\x5d\x13\x8c\x08\x01\x03\x00 TSComp archive data
 # ARQ
@@ -290,7 +307,7 @@
 # Xtreme
 0	string	ULEB\0 Xtreme archive data
 # Pack Magic
-0	string	@â\1\0 Pack Magic archive data
+0	string	@\xc3\xa2\1\0 Pack Magic archive data
 # BTS
 0	belong&0xfeffffff	0x1a034465 BTS archive data
 # ELI 5750
@@ -426,7 +443,7 @@
 # XPack Data
 0	string	xpa XPack archive data
 # XPack Single Data
-0	string	Í\ jm XPack single archive data
+0	string	\xc3\x8d\ jm XPack single archive data
 
 # TODO: missing due to unknown magic/magic at end of file:
 #DWC
@@ -481,7 +498,7 @@
 # This is a really bad format. A file containing HAWAII will match this...
 #0	string		HA		HA archive data,
 #>2	leshort		=1		1 file,
-#>2	leshort		>1		%u files,
+#>2	leshort		>1		%hu files,
 #>4	byte&0x0f	=0		first is type CPY
 #>4	byte&0x0f	=1		first is type ASC
 #>4	byte&0x0f	=2		first is type HSC
@@ -571,6 +588,7 @@
 !:mime	application/zip
 
 # Zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
+0	string		PK\005\006	Zip archive data (empty)
 0	string		PK\003\004
 
 # Specialised zip formats which start with a member named 'mimetype'
@@ -660,11 +678,10 @@
 !:mime	application/vnd.oasis.opendocument.image-template
 
 #  EPUB (OEBPS) books using OCF (OEBPS Container Format)
-#    From: Adam Buchbinder 
 #    http://www.idpf.org/ocf/ocf1.0/download/ocf10.htm, section 4.
-#    (mimetype contains "application/epub+zip")
->>50	string	epub+zip		EPUB ebook data
-!:mime	application/epub+zip
+#    From: Ralf Brown 
+>>50	string	epub+zip	EPUB document
+!:mime application/epub+zip
 
 #  Catch other ZIP-with-mimetype formats
 #	In a ZIP file, the bytes immediately after a member's contents are
@@ -684,16 +701,21 @@
 >>>38		regex	[!-OQ-~]+		Zip data (MIME type "%s"?)
 !:mime	application/zip
 
+# Java Jar files
+>(26.s+30)	leshort	0xcafe		Java archive data (JAR)
+!:mime	application/java-archive
+
 # Generic zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
 #   Next line excludes specialized formats:
->26    string          !\x8\0\0\0mimetype	Zip archive data
+>(26.s+30)	leshort	!0xcafe
+>>26    string          !\x8\0\0\0mimetype	Zip archive data
 !:mime	application/zip
->>4	byte		0x09		\b, at least v0.9 to extract
->>4	byte		0x0a		\b, at least v1.0 to extract
->>4	byte		0x0b		\b, at least v1.1 to extract
->>4	byte		0x14		\b, at least v2.0 to extract
->>4	byte		0x2d		\b, at least v3.0 to extract
->>0x161	string		WINZIP		\b, WinZIP self-extracting
+>>>4	byte		0x09		\b, at least v0.9 to extract
+>>>4	byte		0x0a		\b, at least v1.0 to extract
+>>>4	byte		0x0b		\b, at least v1.1 to extract
+>>>4	byte		0x14		\b, at least v2.0 to extract
+>>>4	byte		0x2d		\b, at least v3.0 to extract
+>>>0x161	string		WINZIP		\b, WinZIP self-extracting
 
 # StarView Metafile
 # From Pierre Ducroquet 
@@ -852,7 +874,7 @@
 # From: Dirk Jagdmann 
 # xar archive format: http://code.google.com/p/xar/
 0	string	xar!		xar archive
->6	beshort	x		- version %ld
+>6	beshort	x		- version %d
 
 # From: "Nelson A. de Oliveira" 
 # .kgb
@@ -884,14 +906,8 @@
 #   archive must be an uncompressed file called 'mimetype' with contents
 #   'application/epub+zip'
 
-# start by checking that this is a ZIP archive, then check for the
-#   proper mimetype file
-# From: Ralf Brown 
-0	string	PK\003\004
->0x1E	string	mimetypeapplication/epub+zip	EPUB document
-!:mime application/epub+zip
 
-# From: "Michał Górny" 
+# From: "Michael Gorny" 
 # ZPAQ: http://mattmahoney.net/dc/zpaq.html
 0	string	zPQ	ZPAQ stream
 >3	byte	x	\b, level %d
@@ -905,3 +921,67 @@
 >36	byte	16		\b, back-to-front
 >42	beshort	x		\b, (%dx,
 >44	beshort	x		%d)
+
+# Symantec GHOST image by Joerg Jenderek at May 2014
+# http://us.norton.com/ghost/
+# http://www.garykessler.net/library/file_sigs.html
+0		ubelong&0xFFFFf7f0	0xFEEF0100	Norton GHost image
+# *.GHO
+>2		ubyte&0x08		0x00		\b, first file
+# *.GHS or *.[0-9] with cns program option
+>2		ubyte&0x08		0x08		\b, split file
+# part of split index interesting for *.ghs
+>>4		ubyte			x		id=0x%x
+# compression tag minus one equals numeric compression command line switch z[1-9]
+>3		ubyte			0		\b, no compression
+>3		ubyte			2		\b, fast compression (Z1)
+>3		ubyte			3		\b, medium compression (Z2)
+>3		ubyte			>3		
+>>3		ubyte			<11		\b, compression (Z%d-1)
+>2		ubyte&0x08		0x00		
+# ~ 30 byte password field only for *.gho
+>>12		ubequad			!0		\b, password protected
+>>44		ubyte			!1		
+# 1~Image All, sector-by-sector only for *.gho
+>>>10		ubyte			1		\b, sector copy
+# 1~Image Boot track only for *.gho
+>>>43		ubyte			1		\b, boot track
+# 1~Image Disc only for *.gho implies Image Boot track and sector copy
+>>44		ubyte			1		\b, disc sector copy
+# optional image description only *.gho
+>>0xff		string			>\0		"%-.254s"
+# look for DOS sector end sequence
+>0xE08	search/7776		\x55\xAA	
+>>&-512	indirect		x		\b; contains 
+
+# Symantec GHOST image by Joerg Jenderek at May 2014
+# http://us.norton.com/ghost/
+# http://www.garykessler.net/library/file_sigs.html
+0		ubelong&0xFFFFf7f0	0xFEEF0100	Norton GHost image
+# *.GHO
+>2		ubyte&0x08		0x00		\b, first file
+# *.GHS or *.[0-9] with cns program option
+>2		ubyte&0x08		0x08		\b, split file
+# part of split index interesting for *.ghs
+>>4		ubyte			x		id=0x%x
+# compression tag minus one equals numeric compression command line switch z[1-9]
+>3		ubyte			0		\b, no compression
+>3		ubyte			2		\b, fast compression (Z1)
+>3		ubyte			3		\b, medium compression (Z2)
+>3		ubyte			>3		
+>>3		ubyte			<11		\b, compression (Z%d-1)
+>2		ubyte&0x08		0x00		
+# ~ 30 byte password field only for *.gho
+>>12		ubequad			!0		\b, password protected
+>>44		ubyte			!1		
+# 1~Image All, sector-by-sector only for *.gho
+>>>10		ubyte			1		\b, sector copy
+# 1~Image Boot track only for *.gho
+>>>43		ubyte			1		\b, boot track
+# 1~Image Disc only for *.gho implies Image Boot track and sector copy
+>>44		ubyte			1		\b, disc sector copy
+# optional image description only *.gho
+>>0xff		string			>\0		"%-.254s"
+# look for DOS sector end sequence
+>0xE08	search/7776		\x55\xAA	
+>>&-512	indirect		x		\b; contains 
diff --git a/contrib/file/magic/Magdir/assembler b/contrib/file/magic/Magdir/assembler
new file mode 100644
index 00000000000..805a326bebc
--- /dev/null
+++ b/contrib/file/magic/Magdir/assembler
@@ -0,0 +1,18 @@
+#------------------------------------------------------------------------------
+# $File: assembler,v 1.6 2013/12/11 14:14:20 christos Exp $
+# make:  file(1) magic for assembler source
+#
+0	regex	\^[\040\t]{0,50}\\.asciiz		assembler source text
+!:mime	text/x-asm
+0	regex	\^[\040\t]{0,50}\\.byte		assembler source text
+!:mime	text/x-asm
+0	regex	\^[\040\t]{0,50}\\.even		assembler source text
+!:mime	text/x-asm
+0	regex	\^[\040\t]{0,50}\\.globl		assembler source text
+!:mime	text/x-asm
+0	regex	\^[\040\t]{0,50}\\.text		assembler source text
+!:mime	text/x-asm
+0	regex	\^[\040\t]{0,50}\\.file		assembler source text
+!:mime	text/x-asm
+0	regex	\^[\040\t]{0,50}\\.type		assembler source text
+!:mime	text/x-asm
diff --git a/contrib/file/Magdir/asterix b/contrib/file/magic/Magdir/asterix
similarity index 100%
rename from contrib/file/Magdir/asterix
rename to contrib/file/magic/Magdir/asterix
diff --git a/contrib/file/Magdir/att3b b/contrib/file/magic/Magdir/att3b
similarity index 85%
rename from contrib/file/Magdir/att3b
rename to contrib/file/magic/Magdir/att3b
index 96880111e05..a3ed9c0037a 100644
--- a/contrib/file/Magdir/att3b
+++ b/contrib/file/magic/Magdir/att3b
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: att3b,v 1.8 2009/09/19 16:28:08 christos Exp $
+# $File: att3b,v 1.9 2014/04/30 21:41:02 christos Exp $
 # att3b:  file(1) magic for AT&T 3B machines
 #
 # The `versions' should be un-commented if they work for you.
@@ -11,10 +11,10 @@
 # The 3B20 conflicts with SCCS.
 #0	beshort		0550		3b20 COFF executable
 #>12	belong		>0		not stripped
-#>22	beshort		>0		- version %ld
+#>22	beshort		>0		- version %d
 #0	beshort		0551		3b20 COFF executable (TV)
 #>12	belong		>0		not stripped
-#>22	beshort		>0		- version %ld
+#>22	beshort		>0		- version %d
 #
 # WE32K
 #
@@ -29,12 +29,12 @@
 >20	beshort		0410		(pure)
 >20	beshort		0413		(demand paged)
 >20	beshort		0443		(target shared library)
->22	beshort		>0		- version %ld
+>22	beshort		>0		- version %d
 0	beshort		0561		WE32000 COFF executable (TV)
 >12	belong		>0		not stripped
 #>18	beshort		&00020000	- 32100 required
 #>18	beshort		&00040000	and MAU hardware required
-#>22	beshort		>0		- version %ld
+#>22	beshort		>0		- version %d
 #
 # core file for 3b2 
 0	string		\000\004\036\212\200	3b2 core file
diff --git a/contrib/file/Magdir/audio b/contrib/file/magic/Magdir/audio
similarity index 92%
rename from contrib/file/Magdir/audio
rename to contrib/file/magic/Magdir/audio
index 0cbe2590328..338d8aebda6 100644
--- a/contrib/file/Magdir/audio
+++ b/contrib/file/magic/Magdir/audio
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: audio,v 1.64 2012/02/20 16:37:34 christos Exp $
+# $File: audio,v 1.71 2014/05/14 23:30:28 christos Exp $
 # audio:  file(1) magic for sound formats (see also "iff")
 #
 # Jan Nicolai Langfeldt (janl@ifi.uio.no), Dan Quinlan (quinlan@yggdrasil.com),
@@ -104,7 +104,7 @@
 
 # first entry is also the string "NTRK"
 0	belong		0x4e54524b	MultiTrack sound data
->4	belong		x		- version %ld
+>4	belong		x		- version %d
 
 # Extended MOD format (*.emd) (Greg Roelofs, newt@uchicago.edu); NOT TESTED
 # [based on posting 940824 by "Dirk/Elastik", husberg@lehtori.cc.tut.fi]
@@ -512,7 +512,7 @@
 >>12		ulelong		x		\b, sample rate %d
 
 # adlib sound files
-# From Gürkan Sengün , http://www.linuks.mine.nu
+# From Gurkan Sengun , http://www.linuks.mine.nu
 0    	string		RAWADATA	RdosPlay RAW
 
 1068	string		RoR		AMUSIC Adlib Tracker
@@ -571,6 +571,7 @@
 
 # musepak support From: "Jiri Pejchal" 
 0       string          MP+     Musepack audio
+!:mime	audio/x-musepack
 >3      byte            255     \b, SV pre8
 >3      byte&0xF        0x6     \b, SV 6
 >3      byte&0xF        0x8     \b, SV 8
@@ -636,3 +637,66 @@
 # URL:  http://wiki.multimedia.cx/index.php?title=WavPack
 # From: Mike Melanson 
 0	string	wvpk	WavPack Lossless Audio
+
+# From Fabio R. Schmidlin 
+# VGM music file
+0	string		Vgm\ 
+>9	ubyte		>0	VGM Video Game Music dump v
+>>9	ubyte/16	>0	\b%d
+>>9	ubyte&0x0F	x	\b%d
+>>8	ubyte/16	x	\b.%d
+>>8	ubyte&0x0F	>0	\b%d
+#Get soundchips
+>>8	ubyte		x	\b, soundchip(s)=
+>>0x0C	ulelong		>0	SN76489,
+>>0x10	ulelong		>0	YM2413,
+>>0x2C	ulelong		>0	YM2612,
+>>0x30	ulelong		>0	YM2151,
+>>0x38	ulelong		>0	Sega PCM,
+>>0x34	ulelong		>0xC
+>>>0x40	ulelong		>0	RF5C68,
+>>0x34	ulelong		>0x10
+>>>0x44	ulelong		>0	YM2203,
+>>0x34	ulelong		>0x14
+>>>0x48	ulelong		>0	YM2608,
+>>0x34	ulelong		>0x18
+>>>0x4C	lelong		>0	YM2610,
+>>>0x4C	lelong		<0	YM2610B,
+>>0x34	ulelong		>0x1C
+>>>0x50	ulelong		>0	YM3812,
+>>0x34	ulelong		>0x20
+>>>0x54	ulelong		>0	YM3526,
+>>0x34	ulelong		>0x24
+>>>0x58	ulelong		>0	Y8950,
+>>0x34	ulelong		>0x28
+>>>0x5C	ulelong		>0	YMF262,
+>>0x34	ulelong		>0x2C
+>>>0x60	ulelong		>0	YMF278B,
+>>0x34	ulelong		>0x30
+>>>0x64	ulelong		>0	YMF271,
+>>0x34	ulelong		>0x34
+>>>0x68	ulelong		>0	YMZ280B,
+>>0x34	ulelong		>0x38
+>>>0x6C	ulelong		>0	RF5C164,
+>>0x34	ulelong		>0x3C
+>>>0x70	ulelong		>0	PWM,
+>>0x34	ulelong		>0x40
+>>>0x74	ulelong		>0
+>>>>0x78 ubyte		0x00	AY-3-8910,
+>>>>0x78 ubyte		0x01	AY-3-8912,
+>>>>0x78 ubyte		0x02	AY-3-8913,
+>>>>0x78 ubyte		0x03	AY-3-8930,
+>>>>0x78 ubyte		0x10	YM2149,
+>>>>0x78 ubyte		0x11	YM3439,
+
+# GVOX Encore file format
+# Since this is a proprietary file format and there is no publicly available
+# format specification, this is just based on induction
+#
+0	string	SCOW
+>4	byte	0xc4	GVOX Encore music, version 5.0 or above
+>4	byte	0xc2	GVOX Encore music, version < 5.0
+
+0	string	ZBOT
+>4	byte	0xc5	GVOX Encore music, version < 5.0
+
diff --git a/contrib/file/Magdir/basis b/contrib/file/magic/Magdir/basis
similarity index 100%
rename from contrib/file/Magdir/basis
rename to contrib/file/magic/Magdir/basis
diff --git a/contrib/file/Magdir/bflt b/contrib/file/magic/Magdir/bflt
similarity index 80%
rename from contrib/file/Magdir/bflt
rename to contrib/file/magic/Magdir/bflt
index 03eb59d34ae..c46b4dbb4be 100644
--- a/contrib/file/Magdir/bflt
+++ b/contrib/file/magic/Magdir/bflt
@@ -1,12 +1,12 @@
 
 #------------------------------------------------------------------------------
-# $File: bflt,v 1.4 2009/09/19 16:28:08 christos Exp $
+# $File: bflt,v 1.5 2014/04/30 21:41:02 christos Exp $
 # bFLT: file(1) magic for BFLT uclinux binary files
 #
 # From Philippe De Muyter 
 #
 0	string		bFLT		BFLT executable
->4	belong		x		- version %ld
+>4	belong		x		- version %d
 >4	belong		4
 >>36	belong&0x1	0x1		ram
 >>36	belong&0x2	0x2		gotpic
diff --git a/contrib/file/magic/Magdir/blackberry b/contrib/file/magic/Magdir/blackberry
new file mode 100644
index 00000000000..4a61d4e98cf
--- /dev/null
+++ b/contrib/file/magic/Magdir/blackberry
@@ -0,0 +1,8 @@
+
+#------------------------------------------------------------------------------
+# $File: blackberry,v 1.1 2014/01/31 01:51:32 christos Exp $
+# blackberry:  file(1) magic for BlackBerry file formats
+#
+5	belong	0		
+>8	belong  010010010	BlackBerry RIM ETP file
+>>22	string	x		\b for %s
diff --git a/contrib/file/Magdir/blcr b/contrib/file/magic/Magdir/blcr
similarity index 100%
rename from contrib/file/Magdir/blcr
rename to contrib/file/magic/Magdir/blcr
diff --git a/contrib/file/Magdir/blender b/contrib/file/magic/Magdir/blender
similarity index 100%
rename from contrib/file/Magdir/blender
rename to contrib/file/magic/Magdir/blender
diff --git a/contrib/file/Magdir/blit b/contrib/file/magic/Magdir/blit
similarity index 100%
rename from contrib/file/Magdir/blit
rename to contrib/file/magic/Magdir/blit
diff --git a/contrib/file/Magdir/bout b/contrib/file/magic/Magdir/bout
similarity index 100%
rename from contrib/file/Magdir/bout
rename to contrib/file/magic/Magdir/bout
diff --git a/contrib/file/Magdir/bsdi b/contrib/file/magic/Magdir/bsdi
similarity index 63%
rename from contrib/file/Magdir/bsdi
rename to contrib/file/magic/Magdir/bsdi
index be16e3a1a23..8499b0c9036 100644
--- a/contrib/file/Magdir/bsdi
+++ b/contrib/file/magic/Magdir/bsdi
@@ -1,27 +1,17 @@
 
 #------------------------------------------------------------------------------
-# $File: bsdi,v 1.5 2009/09/19 16:28:08 christos Exp $
+# $File: bsdi,v 1.7 2014/03/29 15:40:34 christos Exp $
 # bsdi:  file(1) magic for BSD/OS (from BSDI) objects
+# Some object/executable formats use the same magic numbers as are used
+# in other OSes; those are handled by entries in aout.
 #
 
 0	lelong		0314		386 compact demand paged pure executable
 >16	lelong		>0		not stripped
 >32	byte		0x6a		(uses shared libs)
 
-0	lelong		0407		386 executable
->16	lelong		>0		not stripped
->32	byte		0x6a		(uses shared libs)
-
-0	lelong		0410		386 pure executable
->16	lelong		>0		not stripped
->32	byte		0x6a		(uses shared libs)
-
-0	lelong		0413		386 demand paged pure executable
->16	lelong		>0		not stripped
->32	byte		0x6a		(uses shared libs)
-
 # same as in SunOS 4.x, except for static shared libraries
-0	belong&077777777	0600413		sparc demand paged
+0	belong&077777777	0600413		SPARC demand paged
 >0	byte		&0x80
 >>20	belong		<4096		shared library
 >>20	belong		=4096		dynamically linked executable
@@ -30,13 +20,13 @@
 >16	belong		>0		not stripped
 >36	belong		0xb4100001	(uses shared libs)
 
-0	belong&077777777	0600410		sparc pure
+0	belong&077777777	0600410		SPARC pure
 >0	byte		&0x80		dynamically linked executable
 >0	byte		^0x80		executable
 >16	belong		>0		not stripped
 >36	belong		0xb4100001	(uses shared libs)
 
-0	belong&077777777	0600407		sparc
+0	belong&077777777	0600407		SPARC
 >0	byte		&0x80		dynamically linked executable
 >0	byte		^0x80		executable
 >16	belong		>0		not stripped
diff --git a/contrib/file/Magdir/bsi b/contrib/file/magic/Magdir/bsi
similarity index 100%
rename from contrib/file/Magdir/bsi
rename to contrib/file/magic/Magdir/bsi
diff --git a/contrib/file/Magdir/btsnoop b/contrib/file/magic/Magdir/btsnoop
similarity index 100%
rename from contrib/file/Magdir/btsnoop
rename to contrib/file/magic/Magdir/btsnoop
diff --git a/contrib/file/Magdir/c-lang b/contrib/file/magic/Magdir/c-lang
similarity index 65%
rename from contrib/file/Magdir/c-lang
rename to contrib/file/magic/Magdir/c-lang
index 066562760a5..39889ec1cf3 100644
--- a/contrib/file/Magdir/c-lang
+++ b/contrib/file/magic/Magdir/c-lang
@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: c-lang,v 1.16 2011/12/09 08:02:16 rrt Exp $
+# $File: c-lang,v 1.19 2014/06/03 19:17:27 christos Exp $
 # c-lang:  file(1) magic for C and related languages programs
 #
 
@@ -12,37 +12,37 @@
 # C
 0	regex	\^#include	C source text
 !:mime	text/x-c
-0	regex	\^char		C source text
+0	regex	\^char[\ \t\n]+	C source text
 !:mime	text/x-c
-0	regex	\^double		C source text
+0	regex	\^double[\ \t\n]+		C source text
 !:mime	text/x-c
-0	regex	\^extern		C source text
+0	regex	\^extern[\ \t\n]+		C source text
 !:mime	text/x-c
-0	regex	\^float		C source text
+0	regex	\^float[\ \t\n]+		C source text
 !:mime	text/x-c
-0	regex	\^struct		C source text
+0	regex	\^struct[\ \t\n]+		C source text
 !:mime	text/x-c
-0	regex	\^union		C source text
+0	regex	\^union[\ \t\n]+		C source text
 !:mime	text/x-c
 0	search/8192	main(		C source text
 !:mime	text/x-c
 
 # C++
 # The strength of these rules is increased so they beat the C rules above
-0	regex	\^template	C++ source text
-!:strength + 10
+0	regex	\^template[\ \t\n]+	C++ source text
+!:strength + 5
 !:mime	text/x-c++
-0	regex	\^virtual		C++ source text
-!:strength + 10
+0	regex	\^virtual[\ \t\n]+		C++ source text
+!:strength + 5
 !:mime	text/x-c++
-0	regex	\^class		C++ source text
-!:strength + 10
+0	regex	\^class[\ \t\n]+		C++ source text
+!:strength + 5
 !:mime	text/x-c++
 0	regex	\^public:		C++ source text
-!:strength + 10
+!:strength + 5
 !:mime	text/x-c++
 0	regex	\^private:		C++ source text
-!:strength + 10
+!:strength + 5
 !:mime	text/x-c++
 
 # From: Mikhail Teterin  
@@ -50,7 +50,7 @@
 >7	string		x		version %.2s
 # We skip the path here, because it is often long (so file will
 # truncate it) and mostly redundant.
-# The inverted index functionality was added some time betwen
+# The inverted index functionality was added some time between
 # versions 11 and 15, so look for -q if version is above 14:
 >7	string		>14
 >>10	search/100	\ -q\ 		with inverted index
diff --git a/contrib/file/Magdir/c64 b/contrib/file/magic/Magdir/c64
similarity index 100%
rename from contrib/file/Magdir/c64
rename to contrib/file/magic/Magdir/c64
diff --git a/contrib/file/Magdir/cad b/contrib/file/magic/Magdir/cad
similarity index 69%
rename from contrib/file/Magdir/cad
rename to contrib/file/magic/Magdir/cad
index cc4ef343d82..9b09fd7a191 100644
--- a/contrib/file/Magdir/cad
+++ b/contrib/file/magic/Magdir/cad
@@ -1,16 +1,9 @@
 
 #------------------------------------------------------------------------------
-# $File: cad,v 1.11 2011/12/08 12:12:46 rrt Exp $
+# $File: cad,v 1.13 2014/03/23 18:05:38 christos Exp $
 # autocad:  file(1) magic for cad files
 #
 
-# AutoCAD DWG versions R13/R14 (www.autodesk.com)
-# Written December 01, 2003 by Lester Hightower
-# Based on the DWG File Format Specifications at http://www.opendwg.org/
-0	string	       \101\103\061\060\061		   AutoCAD
->5	string	       \062\000\000\000\000		   DWG ver. R13
->5	string	       \064\000\000\000\000		   DWG ver. R14
-
 # Microstation DGN/CIT Files (www.bentley.com)
 # Last updated July 29, 2005 by Lester Hightower
 # DGN is the default file extension of Microstation/Intergraph CAD files.
@@ -49,19 +42,62 @@
 >4	string	\030\000\000			CITFile
 >4	string	\030\000\003			CITFile
 
+# AutoCAD 
+# Merge of the different contributions and updates from http://en.wikipedia.org/wiki/Dwg
+# and http://www.iana.org/assignments/media-types/image/vnd.dwg
+0	string	MC0.0	DWG AutoDesk AutoCAD Release 1.0
+!:mime image/vnd.dwg
+0	string	AC1.2	DWG AutoDesk AutoCAD Release 1.2
+!:mime image/vnd.dwg
+0	string	AC1.3	DWG AutoDesk AutoCAD Release 1.3
+!:mime image/vnd.dwg
+0	string	AC1.40	DWG AutoDesk AutoCAD Release 1.40
+!:mime image/vnd.dwg
+0	string	AC1.50	DWG AutoDesk AutoCAD Release 2.05
+!:mime image/vnd.dwg
+0	string	AC2.10	DWG AutoDesk AutoCAD Release 2.10
+!:mime image/vnd.dwg
+0	string	AC2.21	DWG AutoDesk AutoCAD Release 2.21
+!:mime image/vnd.dwg
+0	string	AC2.22	DWG AutoDesk AutoCAD Release 2.22
+!:mime image/vnd.dwg
+0	string	AC1001	DWG AutoDesk AutoCAD Release 2.22
+!:mime image/vnd.dwg
+0	string	AC1002	DWG AutoDesk AutoCAD Release 2.50
+!:mime image/vnd.dwg
+0	string	AC1003	DWG AutoDesk AutoCAD Release 2.60
+!:mime image/vnd.dwg
+0	string	AC1004	DWG AutoDesk AutoCAD Release 9
+!:mime image/vnd.dwg
+0	string	AC1006	DWG AutoDesk AutoCAD Release 10
+!:mime image/vnd.dwg
+0	string	AC1009	DWG AutoDesk AutoCAD Release 11/12
+!:mime image/vnd.dwg
+# AutoCAD DWG versions R13/R14 (www.autodesk.com)
+# Written December 01, 2003 by Lester Hightower
+# Based on the DWG File Format Specifications at http://www.opendwg.org/
 # AutoCad, from Nahuel Greco
 # AutoCAD DWG versions R12/R13/R14 (www.autodesk.com)
-0	string	AC1012		DWG AutoDesk AutoCad (release 12)
-0	string	AC1013		DWG AutoDesk AutoCad (release 13)
-0	string	AC1014		DWG AutoDesk AutoCad (release 14)
+0	string	AC1012	DWG AutoDesk AutoCAD Release 13
+!:mime image/vnd.dwg
+0	string	AC1014	DWG AutoDesk AutoCAD Release 14
+!:mime image/vnd.dwg
+0	string	AC1015	DWG AutoDesk AutoCAD 2000/2002
+!:mime image/vnd.dwg
+
 # A new version of AutoCAD DWG
 # Sergey Zaykov (mail_of_sergey@mail.ru, sergey_zaikov@rambler.ru,
 # ICQ 358572321)
 # From various sources like:
 # http://autodesk.blogs.com/between_the_lines/autocad-release-history.html
-0	string	AC1018 		DWG AutoDesk AutoCAD 2004/2005/2006
-0	string	AC1021 		DWG AutoDesk AutoCAD 2007/2008/2009
-0	string	AC1024 		DWG AutoDesk AutoCAD 2010/2011
+0	string	AC1018	DWG AutoDesk AutoCAD 2004/2005/2006
+!:mime image/vnd.dwg
+0	string	AC1021	DWG AutoDesk AutoCAD 2007/2008/2009
+!:mime image/vnd.dwg
+0	string	AC1024	DWG AutoDesk AutoCAD 2010/2011/2012
+!:mime image/vnd.dwg
+0	string	AC1027	DWG AutoDesk AutoCAD 2013/2014
+!:mime image/vnd.dwg
 
 # KOMPAS 2D drawing from ASCON 
 # This is KOMPAS 2D drawing or fragment of drawing but is not detailed nor
@@ -110,9 +146,11 @@
 0	beshort	0x0809		Bentley/Intergraph MicroStation
 >0x02	byte	0xfe
 >>0x04	beshort	0x1800		CIT raster CAD
-0	string	AC1012		AutoDesk AutoCAD R13
-0	string	AC1014		AutoDesk AutoCAD R14 
-0	string	AC1015		AutoDesk AutoCAD R2000
 
 # 3DS (3d Studio files) Conflicts with diff output 0x3d '='
 #16	beshort		0x3d3d		image/x-3ds
+
+# MegaCAD 2D/3D drawing (.prt)
+# http://megacad.de/
+# From: Markus Heidelberg 
+0	string	MegaCad23\0	MegaCAD 2D/3D drawing
diff --git a/contrib/file/magic/Magdir/cafebabe b/contrib/file/magic/Magdir/cafebabe
new file mode 100644
index 00000000000..b3206e71e49
--- /dev/null
+++ b/contrib/file/magic/Magdir/cafebabe
@@ -0,0 +1,63 @@
+
+#------------------------------------------------------------------------------
+# $File: cafebabe,v 1.16 2014/04/30 21:41:02 christos Exp $
+# Cafe Babes unite!
+#
+# Since Java bytecode and Mach-O universal binaries have the same magic number,
+# the test must be performed in the same "magic" sequence to get both right.
+# The long at offset 4 in a Mach-O universal binary tells the number of
+# architectures; the short at offset 4 in a Java bytecode file is the JVM minor
+# version and the short at offset 6 is the JVM major version.  Since there are only 
+# only 18 labeled Mach-O architectures at current, and the first released 
+# Java class format was version 43.0, we can safely choose any number
+# between 18 and 39 to test the number of architectures against
+# (and use as a hack). Let's not use 18, because the Mach-O people
+# might add another one or two as time goes by...
+#
+### JAVA START ###
+0	belong		0xcafebabe
+>4	belong		>30		compiled Java class data,
+!:mime	application/x-java-applet
+>>6	beshort		x	        version %d.
+>>4	beshort		x       	\b%d
+# Which is which?
+#>>4	belong		0x032d		(Java 1.0)
+#>>4	belong		0x032d		(Java 1.1)
+>>4	belong		0x002e		(Java 1.2)
+>>4	belong		0x002f		(Java 1.3)
+>>4	belong		0x0030		(Java 1.4)
+>>4	belong		0x0031		(Java 1.5)
+>>4	belong		0x0032		(Java 1.6)
+
+0	belong		0xcafed00d	JAR compressed with pack200,
+>5	byte		x		version %d.
+>4	byte		x		\b%d
+!:mime	application/x-java-pack200
+
+
+0	belong		0xcafed00d	JAR compressed with pack200,
+>5	byte		x		version %d.
+>4	byte		x		\b%d
+!:mime	application/x-java-pack200
+
+### JAVA END ###
+### MACH-O START ###
+
+0	name		mach-o		\b [
+>0	use		mach-o-cpu	\b
+>&(8.L)	indirect			\b: 
+>0	belong		x		\b]
+
+0	belong		0xcafebabe
+>4	belong		1		Mach-O universal binary with 1 architecture:
+>>8	use		mach-o		\b
+>4	belong		>1
+>>4	belong		<20		Mach-O universal binary with %d architectures:
+>>>8	use		mach-o		\b
+>>>28	use		mach-o		\b
+>>4	belong		>2
+>>>48	use		mach-o		\b
+>>4	belong		>3
+>>>68	use		mach-o		\b
+
+### MACH-O END ###
diff --git a/contrib/file/Magdir/cddb b/contrib/file/magic/Magdir/cddb
similarity index 100%
rename from contrib/file/Magdir/cddb
rename to contrib/file/magic/Magdir/cddb
diff --git a/contrib/file/Magdir/chord b/contrib/file/magic/Magdir/chord
similarity index 100%
rename from contrib/file/Magdir/chord
rename to contrib/file/magic/Magdir/chord
diff --git a/contrib/file/Magdir/cisco b/contrib/file/magic/Magdir/cisco
similarity index 100%
rename from contrib/file/Magdir/cisco
rename to contrib/file/magic/Magdir/cisco
diff --git a/contrib/file/Magdir/citrus b/contrib/file/magic/Magdir/citrus
similarity index 100%
rename from contrib/file/Magdir/citrus
rename to contrib/file/magic/Magdir/citrus
diff --git a/contrib/file/Magdir/clarion b/contrib/file/magic/Magdir/clarion
similarity index 88%
rename from contrib/file/Magdir/clarion
rename to contrib/file/magic/Magdir/clarion
index cff7a3bdd0e..9fa0049dab1 100644
--- a/contrib/file/Magdir/clarion
+++ b/contrib/file/magic/Magdir/clarion
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: clarion,v 1.4 2009/09/19 16:28:08 christos Exp $
+# $File: clarion,v 1.5 2014/04/30 21:41:02 christos Exp $
 # clarion:  file(1) magic for # Clarion Personal/Professional Developer
 # (v2 and above)
 # From: Julien Blache 
@@ -15,7 +15,7 @@
 >2	leshort	&0x0010	\b, compressed
 >2	leshort	&0x0040	\b, read only
 # number of records
->5	lelong	x	\b, %ld records
+>5	lelong	x	\b, %d records
 
 # Memo files
 0	leshort	0x334d	Clarion Developer (v2 and above) memo data
diff --git a/contrib/file/Magdir/claris b/contrib/file/magic/Magdir/claris
similarity index 82%
rename from contrib/file/Magdir/claris
rename to contrib/file/magic/Magdir/claris
index a2b120a834c..0f7b591b77f 100644
--- a/contrib/file/Magdir/claris
+++ b/contrib/file/magic/Magdir/claris
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: claris,v 1.5 2009/09/19 16:28:08 christos Exp $
+# $File: claris,v 1.7 2014/06/03 19:17:27 christos Exp $
 # claris:  file(1) magic for claris
 # "H. Nanosecond" 
 # Claris Works a word processor, etc.
@@ -11,16 +11,16 @@
 #*
 #0001000 #010 250 377 377 377 377 000 213 000 230 000 021 002 377 014 000
 #null to byte 1000 octal
-514	string	\377\377\377\377\000	Claris clip art?
->0	string	\0\0\0\0\0\0\0\0\0\0\0\0\0	yes.
-514	string	\377\377\377\377\001	Claris clip art?
->0	string	\0\0\0\0\0\0\0\0\0\0\0\0\0	yes.
+514	string	\377\377\377\377\000
+>0	string	\0\0\0\0\0\0\0\0\0\0\0\0\0	Claris clip art
+514	string	\377\377\377\377\001
+>0	string	\0\0\0\0\0\0\0\0\0\0\0\0\0	Claris clip art
 
 # Claris works files
 # .cwk
 0	string	\002\000\210\003\102\117\102\117\000\001\206 Claris works document
 # .plt
-0	string	\020\341\000\000\010\010	Claris Works pallete files .plt
+0	string	\020\341\000\000\010\010	Claris Works palette files .plt
 
 # .msp a dictionary file I am not sure about this I have only one .msp file
 0	string	\002\271\262\000\040\002\000\164	Claris works dictionary
diff --git a/contrib/file/Magdir/clipper b/contrib/file/magic/Magdir/clipper
similarity index 94%
rename from contrib/file/Magdir/clipper
rename to contrib/file/magic/Magdir/clipper
index 9f475340590..98278ebf061 100644
--- a/contrib/file/Magdir/clipper
+++ b/contrib/file/magic/Magdir/clipper
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: clipper,v 1.6 2009/09/19 16:28:08 christos Exp $
+# $File: clipper,v 1.7 2014/04/30 21:41:02 christos Exp $
 # clipper:  file(1) magic for Intergraph (formerly Fairchild) Clipper.
 #
 # XXX - what byte order does the Clipper use?
@@ -35,7 +35,7 @@
 >20	short		0413		(demand paged)
 >20	short		0443		(target shared library)
 >12	long		>0		not stripped
->22	short		>0		- version %ld
+>22	short		>0		- version %d
 0	short		0577		CLIPPER COFF executable
 >18	short&074000	000000		C1 R1 
 >18	short&074000	004000		C2 R1
@@ -47,7 +47,7 @@
 >20	short		0413		(paged)
 >20	short		0443		(target shared library)
 >12	long		>0		not stripped
->22	short		>0		- version %ld
+>22	short		>0		- version %d
 >48	long&01		01		alignment trap enabled
 >52	byte		1		-Ctnc
 >52	byte		2		-Ctsw
diff --git a/contrib/file/Magdir/commands b/contrib/file/magic/Magdir/commands
similarity index 80%
rename from contrib/file/Magdir/commands
rename to contrib/file/magic/Magdir/commands
index 4fb151f3292..20c1058c04f 100644
--- a/contrib/file/Magdir/commands
+++ b/contrib/file/magic/Magdir/commands
@@ -1,16 +1,23 @@
 
 #------------------------------------------------------------------------------
-# $File: commands,v 1.42 2011/12/05 23:14:02 rrt Exp $
+# $File: commands,v 1.50 2014/05/30 16:48:44 christos Exp $
 # commands:  file(1) magic for various shells and interpreters
 #
 #0	string/w	:			shell archive or script for antique kernel text
 0	string/wt	#!\ /bin/sh		POSIX shell script text executable
 !:mime	text/x-shellscript
+0	string/wb	#!\ /bin/sh		POSIX shell script executable (binary data)
+!:mime	text/x-shellscript
+
 0	string/wt	#!\ /bin/csh		C shell script text executable
 !:mime	text/x-shellscript
+
 # korn shell magic, sent by George Wu, gwu@clyde.att.com
 0	string/wt	#!\ /bin/ksh		Korn shell script text executable
 !:mime	text/x-shellscript
+0	string/wb	#!\ /bin/ksh		Korn shell script executable (binary data)
+!:mime	text/x-shellscript
+
 0	string/wt 	#!\ /bin/tcsh		Tenex C shell script text executable
 !:mime	text/x-shellscript
 0	string/wt	#!\ /usr/bin/tcsh	Tenex C shell script text executable
@@ -49,7 +56,7 @@
 !:mime	text/x-awk
 0	string/wt	#!\ /usr/bin/awk	awk script text executable
 !:mime	text/x-awk
-0	regex		=^\\s*BEGIN\\s*[{]	awk script text
+0	regex/4096	=^\\s{0,100}BEGIN\\s{0,100}[{]	awk script text
 
 # AT&T Bell Labs' Plan 9 shell
 0	string/wt	#!\ /bin/rc	Plan 9 rc shell script text executable
@@ -57,27 +64,38 @@
 # bash shell magic, from Peter Tobias (tobias@server.et-inf.fho-emden.de)
 0	string/wt	#!\ /bin/bash	Bourne-Again shell script text executable
 !:mime	text/x-shellscript
+0	string/wb	#!\ /bin/bash	Bourne-Again shell script executable (binary data)
+!:mime	text/x-shellscript
 0	string/wt	#!\ /usr/bin/bash	Bourne-Again shell script text executable
 !:mime	text/x-shellscript
+0	string/wb	#!\ /usr/bin/bash	Bourne-Again shell script executable (binary data)
+!:mime	text/x-shellscript
 0	string/wt	#!\ /usr/local/bash	Bourne-Again shell script text executable
 !:mime	text/x-shellscript
+0	string/wb	#!\ /usr/local/bash	Bourne-Again shell script executable (binary data)
+!:mime	text/x-shellscript
 0	string/wt	#!\ /usr/local/bin/bash	Bourne-Again shell script text executable
 !:mime	text/x-shellscript
+0	string/wb	#!\ /usr/local/bin/bash	Bourne-Again shell script executable (binary data)
+!:mime	text/x-shellscript
 
 # PHP scripts
 # Ulf Harnhammar 
 0	search/1/c	=
+# Elan Ruusamae 
 0	string	=24	regex	[0-9.]+				\b, version %s
 !:mime	text/x-php
diff --git a/contrib/file/Magdir/communications b/contrib/file/magic/Magdir/communications
similarity index 100%
rename from contrib/file/Magdir/communications
rename to contrib/file/magic/Magdir/communications
diff --git a/contrib/file/Magdir/compress b/contrib/file/magic/Magdir/compress
similarity index 89%
rename from contrib/file/Magdir/compress
rename to contrib/file/magic/Magdir/compress
index 94c209d7611..9dc9489771b 100644
--- a/contrib/file/Magdir/compress
+++ b/contrib/file/magic/Magdir/compress
@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: compress,v 1.49 2011/12/07 22:04:27 christos Exp $
+# $File: compress,v 1.58 2014/05/07 19:36:59 christos Exp $
 # compress:  file(1) magic for pure-compression formats (no archives)
 #
 # compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc.
@@ -22,6 +22,7 @@
 #         other than 8 ("deflate", the only method defined in RFC 1952).
 0       string          \037\213        gzip compressed data
 !:mime	application/x-gzip
+!:strength * 2
 >2	byte		<8		\b, reserved method
 >2	byte		>8		\b, unknown method
 >3	byte		&0x01		\b, ASCII
@@ -30,6 +31,10 @@
 >3	byte&0xC	=0x08
 >>10	string		x		\b, was "%s"
 >3	byte		&0x10		\b, has comment
+>3	byte		&0x20		\b, encrypted
+>4	ledate		>0		\b, last modified: %s
+>8	byte		2		\b, max compression
+>8	byte		4		\b, max speed
 >9	byte		=0x00		\b, from FAT filesystem (MS-DOS, OS/2, NT)
 >9	byte		=0x01		\b, from Amiga
 >9	byte		=0x02		\b, from VMS
@@ -44,11 +49,6 @@
 >9	byte		=0x0B		\b, from NTFS filesystem (NT)
 >9	byte		=0x0C		\b, from QDOS
 >9	byte		=0x0D		\b, from Acorn RISCOS
->3	byte		&0x10		\b, comment
->3	byte		&0x20		\b, encrypted
->4	ledate		>0		\b, last modified: %s
->8	byte		2		\b, max compression
->8	byte		4		\b, max speed
 
 # packed data, Huffman (minimum redundancy) codes on a byte-by-byte basis
 0	string		\037\036	packed data
@@ -191,10 +191,13 @@
 
 # Type: LZMA
 0	lelong&0xffffff	=0x5d
->12	leshort		=0xff			LZMA compressed data,
+>12	leshort		0xff			LZMA compressed data,
+!:mime	application/x-lzma
+>>5	lequad		=0xffffffffffffffff	streamed
+>>5	lequad		!0xffffffffffffffff	non-streamed, size %lld
+>12	leshort		0			LZMA compressed data,
 >>5	lequad		=0xffffffffffffffff	streamed
 >>5	lequad		!0xffffffffffffffff	non-streamed, size %lld
-!:mime	application/x-lzma
 
 # http://tukaani.org/xz/xz-file-format.txt
 0	ustring		\xFD7zXZ\x00		XZ compressed data
@@ -206,6 +209,15 @@
 >5	byte		x			\b.%d
 !:mime	application/x-lrzip
 
+# http://fastcompression.blogspot.fi/2013/04/lz4-streaming-format-final.html
+0	lelong		0x184d2204	LZ4 compressed data (v1.4+)
+!:mime	application/x-lz4
+# Added by osm0sis@xda-developers.com
+0 	lelong		0x184c2103	LZ4 compressed data (v1.0-v1.3)
+!:mime	application/x-lz4
+0	lelong		0x184c2102	LZ4 compressed data (v0.1-v0.9)
+!:mime	application/x-lz4
+
 # AFX compressed files (Wolfram Kleff)
 2	string		-afx-		AFX compressed file data
 
@@ -229,3 +241,13 @@
 >6	byte	>-1		%i)
 >7	long	>0		, original size: %i bytes
 >15	long	>30		, block size: %i bytes
+
+# Valve Pack (VPK) files
+0	lelong	0x55aa1234	Valve Pak file
+>0x4	lelong	x		\b, version %u
+>0x8	lelong	x		\b, %u entries
+
+# Snappy framing format
+# http://code.google.com/p/snappy/source/browse/trunk/framing_format.txt
+0	string	\377\006\0\0sNaPpY	snappy framed data
+!:mime	application/x-snappy-framed
diff --git a/contrib/file/Magdir/console b/contrib/file/magic/Magdir/console
similarity index 97%
rename from contrib/file/Magdir/console
rename to contrib/file/magic/Magdir/console
index 573dd15fd58..27227a4126b 100644
--- a/contrib/file/Magdir/console
+++ b/contrib/file/magic/Magdir/console
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: console,v 1.18 2010/09/20 19:19:17 rrt Exp $
+# $File: console,v 1.19 2013/02/06 14:18:52 christos Exp $
 # Console game magic
 # Toby Deshane 
 #    ines:  file(1) magic for Marat's iNES Nintendo Entertainment System
@@ -137,7 +137,7 @@
 >113	string	x		(%s)
 
 #------------------------------------------------------------------------------
-# Microsoft Xbox executables .xbe (Esa Hyytiä )
+# Microsoft Xbox executables .xbe (Esa Hyytia )
 0       string          XBEH            XBE, Microsoft Xbox executable
 # probabilistic checks whether signed or not
 >0x0004 ulelong =0x0
@@ -177,7 +177,7 @@
 # From: Serge van den Boom 
 0	string		\x01ZZZZZ\x01	3DO "Opera" file system
 
-# From Gürkan Sengün , www.linuks.mine.nu
+# From Gurkan Sengun , www.linuks.mine.nu
 0	string		GBS		Nintendo Gameboy Music/Audio Data
 12	string		GameBoy\ Music\ Module	Nintendo Gameboy Music Module
 
diff --git a/contrib/file/Magdir/convex b/contrib/file/magic/Magdir/convex
similarity index 94%
rename from contrib/file/Magdir/convex
rename to contrib/file/magic/Magdir/convex
index 6141a82bba0..6b28f768cc4 100644
--- a/contrib/file/Magdir/convex
+++ b/contrib/file/magic/Magdir/convex
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: convex,v 1.7 2009/09/19 16:28:08 christos Exp $
+# $File: convex,v 1.8 2012/10/03 23:44:43 christos Exp $
 # convex:  file(1) magic for Convex boxes
 #
 # Convexes are big-endian.
@@ -30,8 +30,6 @@
 # The restore program uses these number to determine how the data is
 # to be extracted.
 #
-24	belong	=60011	dump format, 4.1 BSD or earlier
-24	belong	=60012	dump format, 4.2 or 4.3 BSD without IDC
 24	belong	=60013	dump format, 4.2 or 4.3 BSD (IDC compatible)
 24	belong	=60014	dump format, Convex Storage Manager by-reference dump
 #
diff --git a/contrib/file/Magdir/cracklib b/contrib/file/magic/Magdir/cracklib
similarity index 100%
rename from contrib/file/Magdir/cracklib
rename to contrib/file/magic/Magdir/cracklib
diff --git a/contrib/file/Magdir/ctags b/contrib/file/magic/Magdir/ctags
similarity index 100%
rename from contrib/file/Magdir/ctags
rename to contrib/file/magic/Magdir/ctags
diff --git a/contrib/file/magic/Magdir/ctf b/contrib/file/magic/Magdir/ctf
new file mode 100644
index 00000000000..37fdd1b60d2
--- /dev/null
+++ b/contrib/file/magic/Magdir/ctf
@@ -0,0 +1,23 @@
+
+#--------------------------------------------------------------
+# ctf:  file(1) magic for CTF (Common Trace Format) trace files
+#
+# Specs. available here: 
+#--------------------------------------------------------------
+
+# CTF trace data
+0	lelong	0xc1fc1fc1	Common Trace Format (CTF) trace data (LE)
+0	belong	0xc1fc1fc1	Common Trace Format (CTF) trace data (BE)
+
+# CTF metadata (packetized)
+0	lelong	0x75d11d57	Common Trace Format (CTF) packetized metadata (LE)
+>35	byte	x		\b, v%d
+>36	byte	x		\b.%d
+0	belong	0x75d11d57	Common Trace Format (CTF) packetized metadata (BE)
+>35	byte	x		\b, v%d
+>36	byte	x		\b.%d
+
+# CTF metadata (plain text)
+0	string	/*\x20CTF\x20   Common Trace Format (CTF) plain text metadata
+!:strength + 5			# this is to make sure we beat C
+>&0	regex	[0-9]+\.[0-9]+	\b, v%s
diff --git a/contrib/file/magic/Magdir/cubemap b/contrib/file/magic/Magdir/cubemap
new file mode 100644
index 00000000000..e2f87d85422
--- /dev/null
+++ b/contrib/file/magic/Magdir/cubemap
@@ -0,0 +1,8 @@
+
+#------------------------------------------------------------------------------
+# $File: cubemap,v 1.1 2012/06/06 13:03:20 christos Exp $
+# file(1) magic(5) data for cubemaps  Martin Erik Werner 
+#
+0	string	ACMP	Map file for the AssaultCube FPS game
+0	string	CUBE	Map file for cube and cube2 engine games
+0	string	MAPZ)	Map file for the Blood Frontier/Red Eclipse FPS games
diff --git a/contrib/file/Magdir/cups b/contrib/file/magic/Magdir/cups
similarity index 62%
rename from contrib/file/Magdir/cups
rename to contrib/file/magic/Magdir/cups
index da2cc4cce01..005a134586e 100644
--- a/contrib/file/Magdir/cups
+++ b/contrib/file/magic/Magdir/cups
@@ -1,55 +1,12 @@
 
 #------------------------------------------------------------------------------
-# $File: cups,v 1.1 2011/11/10 18:59:54 christos Exp $
+# $File: cups,v 1.3 2014/05/28 19:50:41 christos Exp $
 # Cups: file(1) magic for the cups raster file format
 # From: Laurent Martelli 
 # http://www.cups.org/documentation.php/spec-raster.html
 #
 
-# Cups Raster image format, Big Endian
-0	string		RaS		
-!:mime	application/vnd.cups-raster
->3	string		t		Cups Raster version 1, Big Endian
->3	string		2		Cups Raster version 2, Big Endian
->3	string		3		Cups Raster version 3, Big Endian
->280	belong		x		\b, %d
->284	belong		x		\bx%d dpi
->376	belong		x		\b, %dx
->380	belong		x		\b%d pixels
->388	belong		x		%d bits/color
->392	belong		x		%d bits/pixel
->400	belong		0		ColorOrder=Chunky
->400	belong		1		ColorOrder=Banded
->400	belong		2		ColorOrder=Planar
->404	belong		0		ColorSpace=gray
->404	belong		1		ColorSpace=RGB
->404	belong		2		ColorSpace=RGBA
->404	belong		3		ColorSpace=black
->404	belong		4		ColorSpace=CMY
->404	belong		5		ColorSpace=YMC
->404	belong		6		ColorSpace=CMYK
->404	belong		7		ColorSpace=YMCK
->404	belong		8		ColorSpace=KCMY
->404	belong		9		ColorSpace=KCMYcm
->404	belong		10		ColorSpace=GMCK
->404	belong		11		ColorSpace=GMCS
->404	belong		12		ColorSpace=WHITE
->404	belong		13		ColorSpace=GOLD
->404	belong		14		ColorSpace=SILVER
->404	belong		15		ColorSpace=CIE XYZ
->404	belong		16		ColorSpace=CIE Lab
->404	belong		17		ColorSpace=RGBW
->404	belong		18		ColorSpace=sGray
->404	belong		19		ColorSpace=sRGB
->404	belong		20		ColorSpace=AdobeRGB
-
-
-# Cups Raster image format, Little Endian
-1	string		SaR		
->0	string		t		Cups Raster version 1, Little Endian
->0	string		2		Cups Raster version 2, Little Endian
->0	string		3		Cups Raster version 3, Little Endian
-!:mime	application/vnd.cups-raster
+0	name		cups-le
 >280	lelong		x		\b, %d
 >284	lelong		x		\bx%d dpi
 >376	lelong		x		\b, %dx
@@ -80,3 +37,20 @@
 >404	lelong		18		ColorSpace=sGray
 >404	lelong		19		ColorSpace=sRGB
 >404	lelong		20		ColorSpace=AdobeRGB
+
+# Cups Raster image format, Big Endian
+0	string		RaS		
+>3	string		t		Cups Raster version 1, Big Endian
+>3	string		2		Cups Raster version 2, Big Endian
+>3	string		3		Cups Raster version 3, Big Endian
+!:mime	application/vnd.cups-raster
+>0	use		^cups-le
+
+
+# Cups Raster image format, Little Endian
+1	string		SaR		
+>0	string		t		Cups Raster version 1, Little Endian
+>0	string		2		Cups Raster version 2, Little Endian
+>0	string		3		Cups Raster version 3, Little Endian
+!:mime	application/vnd.cups-raster
+>0	use		cups-le
diff --git a/contrib/file/Magdir/dact b/contrib/file/magic/Magdir/dact
similarity index 100%
rename from contrib/file/Magdir/dact
rename to contrib/file/magic/Magdir/dact
diff --git a/contrib/file/magic/Magdir/database b/contrib/file/magic/Magdir/database
new file mode 100644
index 00000000000..b18e2562112
--- /dev/null
+++ b/contrib/file/magic/Magdir/database
@@ -0,0 +1,490 @@
+
+#------------------------------------------------------------------------------
+# $File: database,v 1.41 2014/06/03 19:17:27 christos Exp $
+# database:  file(1) magic for various databases
+#
+# extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk)
+#
+#
+# GDBM magic numbers
+#  Will be maintained as part of the GDBM distribution in the future.
+#  
+0	belong	0x13579ace	GNU dbm 1.x or ndbm database, big endian
+!:mime	application/x-gdbm
+0	lelong	0x13579ace	GNU dbm 1.x or ndbm database, little endian
+!:mime	application/x-gdbm
+0	string	GDBM		GNU dbm 2.x database
+!:mime	application/x-gdbm
+#
+# Berkeley DB
+#
+# Ian Darwin's file /etc/magic files: big/little-endian version.
+#
+# Hash 1.85/1.86 databases store metadata in network byte order.
+# Btree 1.85/1.86 databases store the metadata in host byte order.
+# Hash and Btree 2.X and later databases store the metadata in host byte order.
+
+0	long	0x00061561	Berkeley DB
+!:mime	application/x-dbm
+>8	belong	4321
+>>4	belong	>2		1.86
+>>4	belong	<3		1.85
+>>4	belong	>0		(Hash, version %d, native byte-order)
+>8	belong	1234
+>>4	belong	>2		1.86
+>>4	belong	<3		1.85
+>>4	belong	>0		(Hash, version %d, little-endian)
+
+0	belong	0x00061561	Berkeley DB
+>8	belong	4321
+>>4	belong	>2		1.86
+>>4	belong	<3		1.85
+>>4	belong	>0		(Hash, version %d, big-endian)
+>8	belong	1234
+>>4	belong	>2		1.86
+>>4	belong	<3		1.85
+>>4	belong	>0		(Hash, version %d, native byte-order)
+
+0	long	0x00053162	Berkeley DB 1.85/1.86
+>4	long	>0		(Btree, version %d, native byte-order)
+0	belong	0x00053162	Berkeley DB 1.85/1.86
+>4	belong	>0		(Btree, version %d, big-endian)
+0	lelong	0x00053162	Berkeley DB 1.85/1.86
+>4	lelong	>0		(Btree, version %d, little-endian)
+
+12	long	0x00061561	Berkeley DB
+>16	long	>0		(Hash, version %d, native byte-order)
+12	belong	0x00061561	Berkeley DB
+>16	belong	>0		(Hash, version %d, big-endian)
+12	lelong	0x00061561	Berkeley DB
+>16	lelong	>0		(Hash, version %d, little-endian)
+
+12	long	0x00053162	Berkeley DB
+>16	long	>0		(Btree, version %d, native byte-order)
+12	belong	0x00053162	Berkeley DB
+>16	belong	>0		(Btree, version %d, big-endian)
+12	lelong	0x00053162	Berkeley DB
+>16	lelong	>0		(Btree, version %d, little-endian)
+
+12	long	0x00042253	Berkeley DB
+>16	long	>0		(Queue, version %d, native byte-order)
+12	belong	0x00042253	Berkeley DB
+>16	belong	>0		(Queue, version %d, big-endian)
+12	lelong	0x00042253	Berkeley DB
+>16	lelong	>0		(Queue, version %d, little-endian)
+
+# From Max Bowsher.
+12	long	0x00040988	Berkeley DB
+>16	long	>0		(Log, version %d, native byte-order)
+12	belong	0x00040988	Berkeley DB 
+>16	belong	>0		(Log, version %d, big-endian)
+12	lelong	0x00040988	Berkeley DB
+>16	lelong	>0		(Log, version %d, little-endian)
+
+#
+#
+# Round Robin Database Tool by Tobias Oetiker 
+0	string/b	RRD\0		RRDTool DB
+>4	string/b	x		version %s
+
+>>10	short		!0		16bit aligned
+>>>10	bedouble	8.642135e+130	big-endian
+>>>>18	short		x		32bit long (m68k)
+
+>>10	short		0
+>>>12	long		!0		32bit aligned
+>>>>12	bedouble	8.642135e+130	big-endian
+>>>>>20 long		0		64bit long
+>>>>>20 long		!0		32bit long  
+>>>>12	ledouble	8.642135e+130	little-endian
+>>>>>24 long		0		64bit long
+>>>>>24 long		!0		32bit long (i386)
+>>>>12	string		\x43\x2b\x1f\x5b\x2f\x25\xc0\xc7	middle-endian
+>>>>>24 short		!0		32bit long (arm)
+
+>>8	quad		0		64bit aligned
+>>>16	bedouble	8.642135e+130	big-endian
+>>>>24	long		0		64bit long (s390x)
+>>>>24	long		!0		32bit long (hppa/mips/ppc/s390/SPARC)
+>>>16	ledouble	8.642135e+130	little-endian
+>>>>28	long		0		64bit long (alpha/amd64/ia64)
+>>>>28	long		!0		32bit long (armel/mipsel)
+
+#----------------------------------------------------------------------
+# ROOT: file(1) magic for ROOT databases
+#
+0       string  root\0  ROOT file
+>4      belong  x       Version %d
+>33     belong  x       (Compression: %d)
+
+# XXX: Weak magic.
+# Alex Ott 
+## Paradox file formats
+#2	  leshort	0x0800	Paradox 
+#>0x39	  byte		3	v. 3.0 
+#>0x39	  byte		4	v. 3.5 
+#>0x39	  byte		9	v. 4.x 
+#>0x39	  byte		10	v. 5.x 
+#>0x39	  byte		11	v. 5.x 
+#>0x39	  byte		12	v. 7.x 
+#>>0x04	  byte		0	indexed .DB data file 
+#>>0x04	  byte		1	primary index .PX file 
+#>>0x04	  byte		2	non-indexed .DB data file 
+#>>0x04	  byte		3	non-incrementing secondary index .Xnn file 
+#>>0x04	  byte		4	secondary index .Ynn file 
+#>>0x04	  byte		5	incrementing secondary index .Xnn file 
+#>>0x04	  byte		6	non-incrementing secondary index .XGn file 
+#>>0x04	  byte		7	secondary index .YGn file 
+#>>>0x04	  byte		8	incrementing secondary index .XGn file 
+
+## XBase database files
+# updated by Joerg Jenderek at Feb 2013
+# http://www.dbase.com/Knowledgebase/INT/db7_file_fmt.htm
+# http://www.clicketyclick.dk/databases/xbase/format/dbf.html
+# http://home.f1.htw-berlin.de/scheibl/db/intern/dBase.htm
+# inspect VVYYMMDD , where 1<= MM <= 12 and 1<= DD <= 31
+0	ubelong&0x0000FFFF		<0x00000C20	
+# skip Infocom game Z-machine
+>2		ubyte			>0		
+# skip Androids *.xml
+>>3		ubyte			>0		
+>>>3		ubyte			<32		
+# 1 < version VV
+>>>>0		ubyte			>1		
+# skip HELP.CA3 by test for reserved byte ( NULL )
+>>>>>27		ubyte			0		
+# reserved bytes not always 0 ; also found 0x3901 (T4.DBF) ,0x7101 (T5.DBF,T6.DBF)
+#>>>>>30		ubeshort     		x		30NULL?%x
+# possible production flag,tag numbers(<=0x30),tag length(<=0x20), reserved (NULL) 
+>>>>>>24	ubelong&0xffFFFFff	>0x01302000	
+# .DBF or .MDX
+>>>>>>24	ubelong&0xffFFFFff	<0x01302001	
+# for Xbase Database file (*.DBF) reserved (NULL) for multi-user
+>>>>>>>24	ubelong&0xffFFFFff	=0		
+# test for 2 reserved NULL bytes,transaction and encryption byte flag
+>>>>>>>>12	ubelong&0xFFFFfEfE	0		
+# test for MDX flag
+>>>>>>>>>28	ubyte			x		
+>>>>>>>>>28	ubyte&0xf8		0		
+# header size >= 32
+>>>>>>>>>>8	uleshort		>31		
+# skip PIC15736.PCX by test for language driver name or field name
+>>>>>>>>>>>32	ubyte			>0		
+#!:mime	application/x-dbf; charset=unknown-8bit ??
+#!:mime	application/x-dbase
+>>>>>>>>>>>>0	use			xbase-type
+# database file
+>>>>>>>>>>>>0	ubyte			x		\b DBF
+>>>>>>>>>>>>4	lelong			0		\b, no records
+>>>>>>>>>>>>4	lelong			>0		\b, %d record
+# plural s appended
+>>>>>>>>>>>>>4	lelong			>1		\bs
+# http://www.clicketyclick.dk/databases/xbase/format/dbf_check.html#CHECK_DBF
+# 1 <= record size <= 4000 (dBase 3,4) or 32 * KB (=0x8000)
+>>>>>>>>>>>>10	uleshort		x		* %d
+# file size = records * record size + header size
+>>>>>>>>>>>>1	ubyte			x		\b, update-date
+>>>>>>>>>>>>1	use			xbase-date
+# http://msdn.microsoft.com/de-de/library/cc483186(v=vs.71).aspx
+#>>>>>>>>>>>>29	ubyte			=0		\b, codepage ID=0x%x
+# 2~cp850 , 3~cp1252 , 0x1b~?? ; what code page is 0x1b ?
+>>>>>>>>>>>>29	ubyte			>0		\b, codepage ID=0x%x
+#>>>>>>>>>>>>28	ubyte&0x01		0		\b, no index file
+>>>>>>>>>>>>28	ubyte&0x01		1		\b, with index file .MDX
+>>>>>>>>>>>>28	ubyte&0x02		2		\b, with memo .FPT
+>>>>>>>>>>>>28	ubyte&0x04		4		\b, DataBaseContainer
+# 1st record offset + 1 = header size
+>>>>>>>>>>>>8	uleshort		>0		
+>>>>>>>>>>>>(8.s+1)	ubyte		>0		
+>>>>>>>>>>>>>8		uleshort	>0		\b, at offset %d
+>>>>>>>>>>>>>(8.s+1)	ubyte		>0		
+>>>>>>>>>>>>>>&-1	string		>\0		1st record "%s"
+# for multiple index files (*.MDX) Production flag,tag numbers(<=0x30),tag length(<=0x20), reserverd (NULL) 
+>>>>>>>24	ubelong&0x0133f7ff	>0		
+# test for reserved NULL byte
+>>>>>>>>47	ubyte			x		
+# test for valid TAG key format (0x10 or 0)
+>>>>>>>>>559	ubyte&0xeF		0		
+# test MM <= 12
+>>>>>>>>>45	ubeshort		<0x0C20		
+>>>>>>>>>>45	ubyte			>0		
+>>>>>>>>>>>46	ubyte			<32		
+>>>>>>>>>>>>46	ubyte			>0		
+#!:mime	application/x-mdx
+>>>>>>>>>>>>>0	use			xbase-type
+>>>>>>>>>>>>>0	ubyte			x		\b MDX
+>>>>>>>>>>>>>1	ubyte			x		\b, creation-date
+>>>>>>>>>>>>>1	use			xbase-date
+>>>>>>>>>>>>>44	ubyte			x		\b, update-date
+>>>>>>>>>>>>>44	use			xbase-date
+# No.of tags in use (1,2,5,12)
+>>>>>>>>>>>>>28	uleshort		x		\b, %d
+# No. of entries in tag (0x30)
+>>>>>>>>>>>>>25	ubyte			x		\b/%d tags
+#  Length of tag
+>>>>>>>>>>>>>26	ubyte			x		* %d
+# 1st tag name_
+>>>>>>>>>>>>>548	string		x		\b, 1st tag "%.11s"
+# 2nd tag name
+#>>>>>>>>>>>>(26.b+548)	string		x		\b, 2nd tag "%.11s"
+#
+#		Print the xBase names of different version variants 
+0	name				xbase-type
+>0	ubyte		<2		
+# 1 < version
+>0	ubyte		>1		
+>>0	ubyte		0x02		FoxBase
+# FoxBase+/dBaseIII+, no memo
+>>0	ubyte		0x03		FoxBase+/dBase III
+!:mime	application/x-dbf
+# dBASE IV no memo file
+>>0	ubyte		0x04		dBase IV
+!:mime	application/x-dbf
+# dBASE V no memo file
+>>0	ubyte		0x05		dBase V
+!:mime	application/x-dbf
+>>0	ubyte		0x30		Visual FoxPro
+!:mime	application/x-dbf
+>>0	ubyte		0x31		Visual FoxPro, autoincrement
+!:mime	application/x-dbf
+# Visual FoxPro, with field type Varchar or Varbinary
+>>0	ubyte		0x32		Visual FoxPro, with field type Varchar
+!:mime	application/x-dbf
+# dBASE IV SQL, no memo;dbv memo var size (Flagship)
+>>0	ubyte		0x43		dBase IV, with SQL table
+!:mime	application/x-dbf
+# http://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
+#>>0	ubyte		0x62		dBase IV, with SQL table
+#!:mime	application/x-dbf
+# dBASE IV, with memo!!
+>>0	ubyte		0x7b		dBase IV, with memo
+!:mime	application/x-dbf
+# http://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
+#>>0	ubyte		0x82		dBase IV, with SQL system
+#!:mime	application/x-dbf
+# FoxBase+/dBaseIII+ with memo .DBT!
+>>0	ubyte		0x83		FoxBase+/dBase III, with memo .DBT
+!:mime	application/x-dbf
+# VISUAL OBJECTS (first 1.0 versions) for the Dbase III files (NTX clipper driver); memo file
+>>0	ubyte		0x87		VISUAL OBJECTS, with memo file
+!:mime	application/x-dbf
+# http://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
+#>>0	ubyte		0x8A		FoxBase+/dBase III, with memo .DBT
+#!:mime	application/x-dbf
+# dBASE IV with memo!
+>>0	ubyte		0x8B		dBase IV, with memo .DBT
+!:mime	application/x-dbf
+# dBase IV with SQL Table,no memo?
+>>0	ubyte		0x8E		dBase IV, with SQL table
+!:mime	application/x-dbf
+# .dbv and .dbt memo (Flagship)?
+>>0	ubyte		0xB3		Flagship
+# http://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
+#>>0	ubyte		0xCA		dBase IV with memo .DBT
+#!:mime	application/x-dbf
+# dBASE IV with SQL table, with memo .DBT
+>>0	ubyte		0xCB		dBase IV with SQL table, with memo .DBT
+!:mime	application/x-dbf
+# HiPer-Six format;Clipper SIX, with SMT memo file		
+>>0	ubyte		0xE5		Clipper SIX with memo
+!:mime	application/x-dbf
+# http://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
+#>>0	ubyte		0xF4		dBase IV, with SQL table, with memo
+#!:mime	application/x-dbf
+>>0	ubyte		0xF5		FoxPro with memo
+!:mime	application/x-dbf
+# http://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
+#>>0	ubyte		0xFA		FoxPro 2.x, with memo
+#!:mime	application/x-dbf
+# unknown version (should not happen)
+>>0	default		x		xBase
+!:mime	application/x-dbf
+>>>0	ubyte		x		(0x%x)
+# flags in version byte
+# DBT flag (with dBASE III memo .DBT)!!
+# >>0	ubyte&0x80	>0		DBT_FLAG=%x
+# memo flag ??
+# >>0	ubyte&0x08	>0		MEMO_FLAG=%x
+# SQL flag ??
+# >>0	ubyte&0x70	>0		SQL_FLAG=%x
+#		test and print the date of xBase .DBF .MDX
+0	name				xbase-date
+# inspect YYMMDD , where 1<= MM <= 12 and 1<= DD <= 31
+>0	ubelong		x		
+>1	ubyte		<13		
+>>1	ubyte		>0		
+>>>2	ubyte		>0		
+>>>>2	ubyte		<32		
+>>>>>0	ubyte		x		
+# YY is interpreted as 20YY or 19YY
+>>>>>>0	ubyte		<100		\b %.2d
+# YY is interpreted 1900+YY; TODO: display yy or 20yy instead 1YY
+>>>>>>0	ubyte		>99		\b %d
+>>>>>1	ubyte		x		\b-%d
+>>>>>2	ubyte		x		\b-%d
+
+#	dBase memo files .DBT or .FPT
+# http://msdn.microsoft.com/en-us/library/8599s21w(v=vs.80).aspx
+16		ubyte		<4		
+>16		ubyte		!2		
+>>16		ubyte		!1		
+# next free block index is positive
+>>>0		ulelong		>0		
+# skip many JPG. ZIP, BZ2 by test for reserved bytes NULL , 0|2 , 0|1 , low byte of block size
+>>>>17		ubelong&0xFFfdFE00	0x00000000	
+# skip many RAR by test for low byte 0 ,high byte 0|2|even of block size, 0|a|e|d7 , 0|64h
+>>>>>20		ubelong&0xFF01209B	0x00000000	
+# dBASE III
+>>>>>>16	ubyte		3		
+# dBASE III DBT
+>>>>>>>0	use		xbase-memo-print
+# dBASE IV DBT , FoxPro FPT or many PNG , ZIP , DBF garbage
+>>>>>>16	ubyte		0		
+# dBASE IV DBT with DBF name or DBF garbage
+>>>>>>>8	ubelong		>0x40000000	
+# skip DBF and catch dBASE IV DBT with DBF name and with non big index of next free block
+>>>>>>>>0	ulelong		<0x01010002	
+>>>>>>>>>0	use		xbase-memo-print
+>>>>>>>8	ubelong		0		
+# skip MM*DD*.bin by test for for reserved NULL byte
+>>>>>>>>508	ubelong		0		
+# real memo files should contain text here
+>>>>>>>>>520	ubelong		>0x20202019	
+>>>>>>>>>>520	ubelong		<0xFEFEFEFF	
+>>>>>>>>>>>0	use		xbase-memo-print
+# garbage PCX , ZIP , JAR , XPI 
+>>>>>>>8	default		x		
+
+#		Print the information of dBase DBT or FoxPro FPT memo files 
+0	name				xbase-memo-print
+>0	ubyte			x		
+# test version
+# memo file
+>>16	ubyte			3		dBase III DBT
+>>16	ubyte			0		
+>>>512	ubelong			<0x00000003	FoxPro FPT
+# Size of blocks for FoxPro
+>>>>6	ubeshort		x		\b, blocks size %u
+# Number of next available block for appending data for FoxPro
+>>>>0	ubelong			=0		\b, next free block index %u
+>>>>0	ubelong			!0		\b, next free block index %u
+>>>512	default			x		dBase IV DBT
+# DBF file name without extension
+>>>>8	string			>\0		\b of %-.8s.DBF
+# size of blocks  ; not reliable 0x2020204C
+#>>>>4	ulelong			=0		\b, blocks size %u
+>>>>4	ulelong			!0		\b, blocks size %u
+# Block length found 0 , 512
+#>>>>20	uleshort		=0		\b, block length %u
+>>>>20	uleshort		!0		\b, block length %u
+# Number of next available block for appending data
+>>>>0	ulelong			=0		\b, next free block index %u
+>>>>0	ulelong			!0		\b, next free block index %u
+>>512	ubelong			x		
+>>>512	ubelong			=0xFFFF0800	
+>>>>520	string			>\0		\b, 1st used item "%s"
+# FoxPro
+>>>512	ubelong			<3		
+# FoxPro memo
+>>>>512	ubelong			=1		
+>>>>520	string			>\0		\b, 1st used item "%s"
+>>>512	default			x		
+# may be deleted memo field
+>>>>512	string			>\0		\b, 1st item "%s"
+
+# TODO: 
+# DBASE index file *.NDX
+# DBASE Compound Index file *.CDX
+# dBASE IV Printer Driver *.PRF
+## End of XBase database stuff
+
+# MS Access database
+4	string	Standard\ Jet\ DB	Microsoft Access Database
+!:mime	application/x-msaccess
+4	string	Standard\ ACE\ DB	Microsoft Access Database
+!:mime	application/x-msaccess
+
+# TDB database from Samba et al - Martin Pool 
+0	string	TDB\ file		TDB database
+>32	lelong	0x2601196D		version 6, little-endian
+>>36	lelong	x			hash size %d bytes
+
+# SE Linux policy database
+0       lelong  0xf97cff8c      SE Linux policy
+>16     lelong  x               v%d
+>20     lelong  1      MLS
+>24     lelong  x       %d symbols
+>28     lelong  x       %d ocons
+
+# ICE authority file data (Wolfram Kleff)
+2	string		ICE		ICE authority data
+
+# X11 Xauthority file (Wolfram Kleff)
+10	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
+11	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
+12	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
+13	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
+14	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
+15	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
+16	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
+17	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
+18	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
+
+# From: Maxime Henrion 
+# PostgreSQL's custom dump format, Maxime Henrion 
+0	string		PGDMP		PostgreSQL custom database dump
+>5	byte		x		- v%d
+>6	byte		x		\b.%d
+>5	beshort		<0x101		\b-0
+>5	beshort		>0x100
+>>7	byte		x		\b-%d
+
+# Type: Advanced Data Format (ADF) database
+# URL:  http://www.grc.nasa.gov/WWW/cgns/adf/
+# From: Nicolas Chauvat 
+0	string	@(#)ADF\ Database	CGNS Advanced Data Format
+
+# Tokyo Cabinet magic data
+# http://tokyocabinet.sourceforge.net/index.html
+0	string		ToKyO\ CaBiNeT\n	Tokyo Cabinet
+>14	string		x			\b (%s)
+>32	byte		0			\b, Hash
+!:mime	application/x-tokyocabinet-hash
+>32	byte		1			\b, B+ tree
+!:mime	application/x-tokyocabinet-btree
+>32	byte		2			\b, Fixed-length
+!:mime	application/x-tokyocabinet-fixed
+>32	byte		3			\b, Table
+!:mime	application/x-tokyocabinet-table
+>33	byte		&1			\b, [open]
+>33	byte		&2			\b, [fatal]
+>34	byte		x			\b, apow=%d
+>35	byte		x			\b, fpow=%d
+>36	byte		&0x01			\b, [large]
+>36	byte		&0x02			\b, [deflate]
+>36	byte		&0x04			\b, [bzip]
+>36	byte		&0x08			\b, [tcbs]
+>36	byte		&0x10			\b, [excodec]
+>40	lequad		x			\b, bnum=%lld
+>48	lequad		x			\b, rnum=%lld
+>56	lequad		x			\b, fsiz=%lld
+
+# Type:	QDBM Quick Database Manager
+# From:	Benoit Sibaud 
+0	string		\\[depot\\]\n\f		Quick Database Manager, little endian
+0	string		\\[DEPOT\\]\n\f		Quick Database Manager, big endian
+
+# Type:	TokyoCabinet database
+# URL:	http://tokyocabinet.sourceforge.net/
+# From:	Benoit Sibaud 
+0	string		ToKyO\ CaBiNeT\n	TokyoCabinet database
+>14	string		x			(version %s)
+
+# From:  Stephane Blondon http://www.yaal.fr
+# Database file for Zope (done by FileStorage)
+0	string		FS21	Zope Object Database File Storage (data)
+# Cache file for the database of Zope (done by ClientStorage)
+0	string		ZEC3	Zope Object Database Client Cache File (data)
+
+# IDA (Interactive Disassembler) database
+0	string		IDA1	IDA (Interactive Disassembler) database
diff --git a/contrib/file/Magdir/diamond b/contrib/file/magic/Magdir/diamond
similarity index 100%
rename from contrib/file/Magdir/diamond
rename to contrib/file/magic/Magdir/diamond
diff --git a/contrib/file/Magdir/diff b/contrib/file/magic/Magdir/diff
similarity index 61%
rename from contrib/file/Magdir/diff
rename to contrib/file/magic/Magdir/diff
index 73f0135df86..59243801eb5 100644
--- a/contrib/file/Magdir/diff
+++ b/contrib/file/magic/Magdir/diff
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: diff,v 1.12 2010/12/07 16:52:52 christos Exp $
+# $File: diff,v 1.14 2012/09/16 23:08:54 christos Exp $
 # diff:  file(1) magic for diff(1) output
 #
 0	search/1	diff\ 		diff output text
@@ -16,7 +16,7 @@
 !:mime	text/x-diff
 
 # bsdiff:  file(1) magic for bsdiff(1) output
-0	string/t		BSDIFF40	bsdiff(1) patch file
+0	string/b		BSDIFF40	bsdiff(1) patch file
 
 
 # unified diff
@@ -27,3 +27,14 @@
 >>>>&0	search/1 @@	unified diff output text
 !:mime	text/x-diff
 !:strength + 90
+
+# librsync -- the library for network deltas
+#
+# Copyright (C) 2001 by Martin Pool.  You may do whatever you want with
+# this file.
+#
+0	belong		0x72730236	rdiff network-delta data
+
+0	belong		0x72730136	rdiff network-delta signature data
+>4	belong		x		(block length=%d,
+>8	belong		x		signature strength=%d)
diff --git a/contrib/file/Magdir/digital b/contrib/file/magic/Magdir/digital
similarity index 71%
rename from contrib/file/Magdir/digital
rename to contrib/file/magic/Magdir/digital
index b1b77dd8c75..f66e0bc5591 100644
--- a/contrib/file/Magdir/digital
+++ b/contrib/file/magic/Magdir/digital
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: digital,v 1.10 2011/05/03 01:44:17 christos Exp $
+# $File: digital,v 1.11 2013/01/11 16:45:23 christos Exp $
 #  Digital UNIX - Info
 #
 0	string	=!\n________64E	Alpha archive
@@ -8,20 +8,20 @@
 #
 
 0	leshort		0603
->>24	leshort		0410		COFF format alpha pure
->>24	leshort		0413		COFF format alpha demand paged
->>>22	leshort&030000	!020000		executable
->>>22	leshort&020000	!0		dynamically linked
->>>16	lelong		!0		not stripped
->>>16	lelong		0		stripped
->>>27	byte		x		- version %d
->>>26	byte		x		\b.%d
->>>28	byte		x		\b-%d
->>24	leshort		0407		COFF format alpha object
->>>22	leshort&030000	020000		shared library
->>>27	byte		x		- version %d
->>>26	byte		x		\b.%d
->>>28	byte		x		\b-%d
+>24	leshort		0410		COFF format alpha pure
+>24	leshort		0413		COFF format alpha demand paged
+>>22	leshort&030000	!020000		executable
+>>22	leshort&020000	!0		dynamically linked
+>>16	lelong		!0		not stripped
+>>16	lelong		0		stripped
+>>27	byte		x		- version %d
+>>26	byte		x		\b.%d
+>>28	byte		x		\b-%d
+>24	leshort		0407		COFF format alpha object
+>>22	leshort&030000	020000		shared library
+>>27	byte		x		- version %d
+>>26	byte		x		\b.%d
+>>28	byte		x		\b-%d
 
 # Basic recognition of Digital UNIX core dumps - Mike Bremford 
 #
diff --git a/contrib/file/magic/Magdir/dolby b/contrib/file/magic/Magdir/dolby
new file mode 100644
index 00000000000..573398f347c
--- /dev/null
+++ b/contrib/file/magic/Magdir/dolby
@@ -0,0 +1,69 @@
+
+#------------------------------------------------------------------------------
+# $File: dolby,v 1.7 2014/01/08 22:37:23 christos Exp $
+# ATSC A/53 aka AC-3 aka Dolby Digital 
+# from http://www.atsc.org/standards/a_52a.pdf
+# corrections, additions, etc. are always welcome!
+#
+# syncword
+0	beshort		0x0b77	ATSC A/52 aka AC-3 aka Dolby Digital stream,
+# Proposed audio/ac3 RFC/4184
+!:mime	audio/vnd.dolby.dd-raw
+# fscod
+>4	byte&0xc0 = 0x00	48 kHz,
+>4	byte&0xc0 = 0x40	44.1 kHz,
+>4	byte&0xc0 = 0x80	32 kHz,
+# is this one used for 96 kHz?
+>4	byte&0xc0 = 0xc0	reserved frequency,
+#
+>5	byte&0x07 = 0x00	\b, complete main (CM)
+>5	byte&0x07 = 0x01	\b, music and effects (ME)
+>5	byte&0x07 = 0x02	\b, visually impaired (VI)
+>5	byte&0x07 = 0x03	\b, hearing impaired (HI)
+>5	byte&0x07 = 0x04	\b, dialogue (D)
+>5	byte&0x07 = 0x05	\b, commentary (C)
+>5	byte&0x07 = 0x06	\b, emergency (E)
+>5	beshort&0x07e0  0x0720	\b, voiceover (VO) 
+>5	beshort&0x07e0 >0x0720	\b, karaoke
+# acmod
+>6	byte&0xe0 = 0x00	1+1 front,
+>>6	byte&0x10 = 0x10	LFE on,
+>6	byte&0xe0 = 0x20	1 front/0 rear,
+>>6	byte&0x10 = 0x10	LFE on,
+>6	byte&0xe0 = 0x40	2 front/0 rear,
+# dsurmod (for stereo only)
+>>6	byte&0x18 = 0x00	Dolby Surround not indicated
+>>6	byte&0x18 = 0x08	not Dolby Surround encoded
+>>6	byte&0x18 = 0x10	Dolby Surround encoded
+>>6	byte&0x18 = 0x18	reserved Dolby Surround mode
+>>6	byte&0x04 = 0x04	LFE on,
+>6	byte&0xe0 = 0x60	3 front/0 rear,
+>>6	byte&0x04 = 0x04	LFE on,
+>6	byte&0xe0 = 0x80	2 front/1 rear,
+>>6	byte&0x04 = 0x04	LFE on,
+>6	byte&0xe0 = 0xa0	3 front/1 rear,
+>>6	byte&0x01 = 0x01	LFE on,
+>6	byte&0xe0 = 0xc0	2 front/2 rear,
+>>6	byte&0x04 = 0x04	LFE on,
+>6	byte&0xe0 = 0xe0	3 front/2 rear,
+>>6	byte&0x01 = 0x01	LFE on,
+#
+>4	byte&0x3e = 0x00	\b, 32 kbit/s
+>4	byte&0x3e = 0x02	\b, 40 kbit/s
+>4	byte&0x3e = 0x04	\b, 48 kbit/s
+>4	byte&0x3e = 0x06	\b, 56 kbit/s
+>4	byte&0x3e = 0x08	\b, 64 kbit/s
+>4	byte&0x3e = 0x0a	\b, 80 kbit/s
+>4	byte&0x3e = 0x0c	\b, 96 kbit/s
+>4	byte&0x3e = 0x0e	\b, 112 kbit/s
+>4	byte&0x3e = 0x10	\b, 128 kbit/s
+>4	byte&0x3e = 0x12	\b, 160 kbit/s
+>4	byte&0x3e = 0x14	\b, 192 kbit/s
+>4	byte&0x3e = 0x16	\b, 224 kbit/s
+>4	byte&0x3e = 0x18	\b, 256 kbit/s
+>4	byte&0x3e = 0x1a	\b, 320 kbit/s
+>4	byte&0x3e = 0x1c	\b, 384 kbit/s
+>4	byte&0x3e = 0x1e	\b, 448 kbit/s
+>4	byte&0x3e = 0x20	\b, 512 kbit/s
+>4	byte&0x3e = 0x22	\b, 576 kbit/s
+>4	byte&0x3e = 0x24	\b, 640 kbit/s
diff --git a/contrib/file/Magdir/dump b/contrib/file/magic/Magdir/dump
similarity index 50%
rename from contrib/file/Magdir/dump
rename to contrib/file/magic/Magdir/dump
index 1ac91e22010..1a20ace29c4 100644
--- a/contrib/file/Magdir/dump
+++ b/contrib/file/magic/Magdir/dump
@@ -1,14 +1,14 @@
 
 #------------------------------------------------------------------------------
-# $File: dump,v 1.11 2009/09/19 16:28:09 christos Exp $
+# $File: dump,v 1.13 2014/04/30 21:41:02 christos Exp $
 # dump:  file(1) magic for dump file format--for new and old dump filesystems
 #
 # We specify both byte orders in order to recognize byte-swapped dumps.
 #
-24	belong	60012		new-fs dump file (big endian),
+0	name	new-dump-be
 >4	bedate	x		Previous dump %s,
 >8	bedate	x		This dump %s,
->12	belong	>0		Volume %ld,
+>12	belong	>0		Volume %d,
 >692	belong	0		Level zero, type:
 >692	belong	>0		Level %d, type:
 >0	belong	1		tape header,
@@ -24,10 +24,10 @@
 >824	string	>\0		Host %s,
 >888	belong	>0		Flags %x
 
-24	belong	60011		old-fs dump file (big endian),
+0	name	old-dump-be
 #>4	bedate	x		Previous dump %s,
 #>8	bedate	x		This dump %s,
->12	belong	>0		Volume %ld,
+>12	belong	>0		Volume %d,
 >692	belong	0		Level zero, type:
 >692	belong	>0		Level %d, type:
 >0	belong	1		tape header,
@@ -43,48 +43,48 @@
 >824	string	>\0		Host %s,
 >888	belong	>0		Flags %x
 
-24	lelong	60012		new-fs dump file (little endian),
->4	ledate	x		This dump %s,
->8	ledate	x		Previous dump %s,
->12	lelong	>0		Volume %ld,
->692	lelong	0		Level zero, type:
->692	lelong	>0		Level %d, type:
->0	lelong	1		tape header,
->0	lelong	2		beginning of file record,
->0	lelong	3		map of inodes on tape,
->0	lelong	4		continuation of file record,
->0	lelong	5		end of volume,
->0	lelong	6		map of inodes deleted,
->0	lelong	7		end of medium (for floppy),
+0	name	ufs2-dump-be
+>896	beqdate	x		Previous dump %s,
+>904	beqdate	x		This dump %s,
+>12	belong	>0		Volume %d,
+>692	belong	0		Level zero, type:
+>692	belong	>0		Level %d, type:
+>0	belong	1		tape header,
+>0	belong	2		beginning of file record,
+>0	belong	3		map of inodes on tape,
+>0	belong	4		continuation of file record,
+>0	belong	5		end of volume,
+>0	belong	6		map of inodes deleted,
+>0	belong	7		end of medium (for floppy),
 >676	string	>\0		Label %s,
 >696	string	>\0		Filesystem %s,
 >760	string	>\0		Device %s,
 >824	string	>\0		Host %s,
->888	lelong	>0		Flags %x
+>888	belong	>0		Flags %x
 
-24	lelong	60011		old-fs dump file (little endian),
-#>4	ledate	x		Previous dump %s,
-#>8	ledate	x		This dump %s,
->12	lelong	>0		Volume %ld,
->692	lelong	0		Level zero, type:
->692	lelong	>0		Level %d, type:
->0	lelong	1		tape header,
->0	lelong	2		beginning of file record,
->0	lelong	3		map of inodes on tape,
->0	lelong	4		continuation of file record,
->0	lelong	5		end of volume,
->0	lelong	6		map of inodes deleted,
->0	lelong	7		end of medium (for floppy),
->676	string	>\0		Label %s,
->696	string	>\0		Filesystem %s,
->760	string	>\0		Device %s,
->824	string	>\0		Host %s,
->888	lelong	>0		Flags %x
+24	belong	60012		new-fs dump file (big endian), 
+>0	use	new-dump-be
+
+24	belong	60011		old-fs dump file (big endian), 
+>0	use	old-dump-be
+
+24	lelong	60012		new-fs dump file (little endian), 
+>0	use	\^new-dump-be
+
+24	lelong	60011		old-fs dump file (little endian), 
+>0	use	\^old-dump-be
+
+
+24	belong	0x19540119	new-fs dump file (ufs2, big endian), 
+>0	use	ufs2-dump-be
+
+24	lelong	0x19540119	new-fs dump file (ufs2, little endian), 
+>0	use	\^ufs2-dump-be
 
 18	leshort	60011		old-fs dump file (16-bit, assuming PDP-11 endianness),
 >2	medate	x		Previous dump %s,
 >6	medate	x		This dump %s,
->10	leshort	>0		Volume %ld,
+>10	leshort	>0		Volume %d,
 >0	leshort	1		tape header.
 >0	leshort	2		beginning of file record.
 >0	leshort	3		map of inodes on tape.
@@ -92,41 +92,3 @@
 >0	leshort	5		end of volume.
 >0	leshort	6		map of inodes deleted.
 >0	leshort	7		end of medium (for floppy).
-
-24	belong	0x19540119	new-fs dump file (ufs2, big endian),
->896	beqdate	x		Previous dump %s,
->904	beqdate	x		This dump %s,
->12	belong	>0		Volume %ld,
->692	belong	0		Level zero, type:
->692	belong	>0		Level %d, type:
->0	belong	1		tape header,
->0	belong	2		beginning of file record,
->0	belong	3		map of inodes on tape,
->0	belong	4		continuation of file record,
->0	belong	5		end of volume,
->0	belong	6		map of inodes deleted,
->0	belong	7		end of medium (for floppy),
->676	string	>\0		Label %s,
->696	string	>\0		Filesystem %s,
->760	string	>\0		Device %s,
->824	string	>\0		Host %s,
->888	belong	>0		Flags %x
-
-24	lelong	0x19540119	new-fs dump file (ufs2, little endian),
->896	leqdate	x		This dump %s,
->904	leqdate	x		Previous dump %s,
->12	lelong	>0		Volume %ld,
->692	lelong	0		Level zero, type:
->692	lelong	>0		Level %d, type:
->0	lelong	1		tape header,
->0	lelong	2		beginning of file record,
->0	lelong	3		map of inodes on tape,
->0	lelong	4		continuation of file record,
->0	lelong	5		end of volume,
->0	lelong	6		map of inodes deleted,
->0	lelong	7		end of medium (for floppy),
->676	string	>\0		Label %s,
->696	string	>\0		Filesystem %s,
->760	string	>\0		Device %s,
->824	string	>\0		Host %s,
->888	lelong	>0		Flags %x
diff --git a/contrib/file/magic/Magdir/dyadic b/contrib/file/magic/Magdir/dyadic
new file mode 100644
index 00000000000..18f18bcf178
--- /dev/null
+++ b/contrib/file/magic/Magdir/dyadic
@@ -0,0 +1,56 @@
+
+#------------------------------------------------------------------------------
+# $File: dyadic,v 1.6 2014/06/01 19:14:42 christos Exp $
+# Dyadic: file(1) magic for Dyalog APL.
+#
+# updated by Joerg Jenderek at Oct 2013
+# http://en.wikipedia.org/wiki/Dyalog_APL
+# http://www.dyalog.com/
+# .DXV Dyalog APL External Variable
+# .DIN Dyalog APL Input Table
+# .DOT Dyalog APL Output Table
+# .DFT Dyalog APL Format File
+0	ubeshort&0xFF60	0xaa00		
+# skip biblio.dbt
+>1	byte		!4		
+# real Dyalog APL have non zero version numbers like 7.3 or 13.4
+>>2	ubeshort	>0x0000		Dyalog APL
+>>>1	byte		0x00		aplcore
+#>>>1	byte		0x00		incomplete workspace
+# *.DCF Dyalog APL Component File
+>>>1	byte		0x01		component file 32-bit non-journaled non-checksummed
+#>>>1	byte		0x01		component file
+>>>1	byte		0x02		external variable exclusive
+#>>>1	byte		0x02		external variable
+# *.DWS Dyalog APL Workspace
+>>>1	byte		0x03		workspace
+>>>>7	byte&0x28	0x00		32-bit
+>>>>7	byte&0x28	0x20		64-bit
+>>>>7	byte&0x0c	0x00		classic
+>>>>7	byte&0x0c	0x04		unicode
+>>>>7	byte&0x88	0x00		big-endian
+>>>>7	byte&0x88	0x80		little-endian
+>>>1	byte		0x06		external variable shared
+# *.DSE Dyalog APL Session , *.DLF Dyalog APL Session Log File
+>>>1	byte		0x07		session
+>>>1	byte		0x08		mapped file 32-bit
+>>>1	byte		0x09		component file 64-bit non-journaled non-checksummed
+>>>1	byte		0x0a		mapped file 64-bit
+>>>1	byte		0x0b		component file 32-bit level 1 journaled non-checksummed
+>>>1	byte		0x0c		component file 64-bit level 1 journaled non-checksummed
+>>>1	byte		0x0d		component file 32-bit level 1 journaled checksummed
+>>>1	byte		0x0e		component file 64-bit level 1 journaled checksummed
+>>>1	byte		0x0f		component file 32-bit level 2 journaled checksummed
+>>>1	byte		0x10		component file 64-bit level 2 journaled checksummed
+>>>1	byte		0x11		component file 32-bit level 3 journaled checksummed
+>>>1	byte		0x12		component file 64-bit level 3 journaled checksummed
+>>>1	byte		0x13		component file 32-bit non-journaled checksummed
+>>>1	byte		0x14		component file 64-bit non-journaled checksummed
+>>>1	byte		0x80		DDB
+>>>2	byte		x		version %d
+>>>3	byte		x		\b.%d
+#>>>2	byte		x		type %d
+#>>>3	byte		x		subtype %d
+
+# *.DXF Dyalog APL Transfer File
+0	short		0x6060		Dyalog APL transfer
diff --git a/contrib/file/Magdir/ebml b/contrib/file/magic/Magdir/ebml
similarity index 100%
rename from contrib/file/Magdir/ebml
rename to contrib/file/magic/Magdir/ebml
diff --git a/contrib/file/Magdir/editors b/contrib/file/magic/Magdir/editors
similarity index 100%
rename from contrib/file/Magdir/editors
rename to contrib/file/magic/Magdir/editors
diff --git a/contrib/file/Magdir/efi b/contrib/file/magic/Magdir/efi
similarity index 79%
rename from contrib/file/Magdir/efi
rename to contrib/file/magic/Magdir/efi
index 7335c5cefd5..7760100b198 100644
--- a/contrib/file/Magdir/efi
+++ b/contrib/file/magic/Magdir/efi
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: efi,v 1.4 2009/09/19 16:28:09 christos Exp $
+# $File: efi,v 1.5 2014/04/30 21:41:02 christos Exp $
 # efi:  file(1) magic for Universal EFI binaries
 
 0	lelong	0x0ef1fab9
@@ -12,4 +12,4 @@
 >>&0	lelong	0x01000007	\b, x86_64
 >>&20	lelong	7		\b, i386
 >>&20	lelong	0x01000007	\b, x86_64
->4	lelong	>2		Universal EFI binary with %ld architectures
+>4	lelong	>2		Universal EFI binary with %d architectures
diff --git a/contrib/file/magic/Magdir/elf b/contrib/file/magic/Magdir/elf
new file mode 100644
index 00000000000..b007f88fecf
--- /dev/null
+++ b/contrib/file/magic/Magdir/elf
@@ -0,0 +1,324 @@
+
+#------------------------------------------------------------------------------
+# $File: elf,v 1.67 2014/06/12 13:52:48 christos Exp $
+# elf:  file(1) magic for ELF executables
+#
+# We have to check the byte order flag to see what byte order all the
+# other stuff in the header is in.
+#
+# What're the correct byte orders for the nCUBE and the Fujitsu VPP500?
+#
+# Created by: unknown
+# Modified by (1): Daniel Quinlan 
+# Modified by (2): Peter Tobias  (core support)
+# Modified by (3): Christian 'Dr. Disk' Hechelmann  (fix of core support)
+# Modified by (4):  (VMS Itanium)
+# Modified by (5): Matthias Urlichs  (Listing of many architectures)
+
+0	name		elf-le
+>16	leshort		0		no file type,
+!:mime	application/octet-stream
+>16	leshort		1		relocatable,
+!:mime	application/x-object
+>16	leshort		2		executable,
+!:mime	application/x-executable
+>16	leshort		3		shared object,
+!:mime	application/x-sharedlib
+>16	leshort		4		core file
+!:mime	application/x-coredump
+# Core file detection is not reliable.
+#>>>(0x38+0xcc) string	>\0		of '%s'
+#>>>(0x38+0x10) lelong	>0		(signal %d),
+>16	leshort		&0xff00		processor-specific,
+>18	clear		x
+>18	leshort		0		no machine,
+>18	leshort		1		AT&T WE32100,
+>18	leshort		2		SPARC,
+>18	leshort		3		Intel 80386,
+>18	leshort		4		Motorola m68k,
+>>4	byte		1
+>>>36	lelong		&0x01000000	68000,
+>>>36	lelong		&0x00810000	CPU32,
+>>>36	lelong		0		68020,
+>18	leshort		5		Motorola m88k,
+>18	leshort		6		Intel 80486,
+>18	leshort		7		Intel 80860,
+# The official e_machine number for MIPS is now #8, regardless of endianness.
+# The second number (#10) will be deprecated later. For now, we still
+# say something if #10 is encountered, but only gory details for #8.
+>18	leshort		8		MIPS,
+>>4	byte		1
+>>>36	lelong		&0x20		N32
+>18	leshort		10		MIPS,
+>>4	byte		1
+>>>36	lelong		&0x20		N32
+>18	leshort		8
+# only for 32-bit
+>>4	byte		1
+>>>36  lelong&0xf0000000	0x00000000	MIPS-I
+>>>36  lelong&0xf0000000	0x10000000	MIPS-II
+>>>36  lelong&0xf0000000	0x20000000	MIPS-III
+>>>36  lelong&0xf0000000	0x30000000	MIPS-IV
+>>>36  lelong&0xf0000000	0x40000000	MIPS-V
+>>>36  lelong&0xf0000000	0x50000000	MIPS32
+>>>36  lelong&0xf0000000	0x60000000	MIPS64
+>>>36  lelong&0xf0000000	0x70000000	MIPS32 rel2
+>>>36  lelong&0xf0000000	0x80000000	MIPS64 rel2
+# only for 64-bit
+>>4	byte		2
+>>>48  lelong&0xf0000000	0x00000000	MIPS-I
+>>>48  lelong&0xf0000000	0x10000000	MIPS-II
+>>>48  lelong&0xf0000000	0x20000000	MIPS-III
+>>>48  lelong&0xf0000000	0x30000000	MIPS-IV
+>>>48  lelong&0xf0000000	0x40000000	MIPS-V
+>>>48  lelong&0xf0000000	0x50000000	MIPS32
+>>>48  lelong&0xf0000000	0x60000000	MIPS64
+>>>48  lelong&0xf0000000	0x70000000	MIPS32 rel2
+>>>48  lelong&0xf0000000	0x80000000	MIPS64 rel2
+>18	leshort		9		Amdahl,
+>18	leshort		10		MIPS (deprecated),
+>18	leshort		11		RS6000,
+>18	leshort		15		PA-RISC,
+# only for 32-bit
+>>4	byte		1
+>>>38	leshort		0x0214		2.0
+>>>36	leshort		&0x0008		(LP64)
+# only for 64-bit
+>>4	byte		2
+>>>50	leshort		0x0214		2.0
+>>>48	leshort		&0x0008		(LP64)
+>18	leshort		16		nCUBE,
+>18	leshort		17		Fujitsu VPP500,
+>18	leshort		18		SPARC32PLUS,
+# only for 32-bit
+>>4	byte		1
+>>>36	lelong&0xffff00	0x000100	V8+ Required,
+>>>36	lelong&0xffff00	0x000200	Sun UltraSPARC1 Extensions Required,
+>>>36	lelong&0xffff00	0x000400	HaL R1 Extensions Required,
+>>>36	lelong&0xffff00	0x000800	Sun UltraSPARC3 Extensions Required,
+>18	leshort		19		Intel 80960,
+>18	leshort		20		PowerPC or cisco 4500,
+>18	leshort		21		64-bit PowerPC or cisco 7500,
+>18	leshort		22		IBM S/390,
+>18	leshort		23		Cell SPU,
+>18	leshort		24		cisco SVIP,
+>18	leshort		25		cisco 7200,
+>18	leshort		36		NEC V800 or cisco 12000,
+>18	leshort		37		Fujitsu FR20,
+>18	leshort		38		TRW RH-32,
+>18	leshort		39		Motorola RCE,
+>18	leshort		40		ARM,
+>>4	byte		1
+>>>36	lelong&0xff000000	0x04000000	EABI4
+>>>36	lelong&0xff000000	0x05000000	EABI5
+>>>36	lelong		&0x00800000	BE8
+>>>36	lelong		&0x00400000	LE8
+>18	leshort		41		Alpha,
+>18	leshort		42		Renesas SH,
+>18	leshort		43		SPARC V9,
+>>4	byte		2
+>>>48	lelong&0xffff00	0x000200	Sun UltraSPARC1 Extensions Required,
+>>>48	lelong&0xffff00	0x000400	HaL R1 Extensions Required,
+>>>48	lelong&0xffff00	0x000800	Sun UltraSPARC3 Extensions Required,
+>>>48	lelong&0x3	0		total store ordering,
+>>>48	lelong&0x3	1		partial store ordering,
+>>>48	lelong&0x3	2		relaxed memory ordering,
+>18	leshort		44		Siemens Tricore Embedded Processor,
+>18	leshort		45		Argonaut RISC Core, Argonaut Technologies Inc.,
+>18	leshort		46		Renesas H8/300,
+>18	leshort		47		Renesas H8/300H,
+>18	leshort		48		Renesas H8S,
+>18	leshort		49		Renesas H8/500,
+>18	leshort		50		IA-64,
+>18	leshort		51		Stanford MIPS-X,
+>18	leshort		52		Motorola Coldfire,
+>18	leshort		53		Motorola M68HC12,
+>18	leshort		54		Fujitsu MMA,
+>18	leshort		55		Siemens PCP,
+>18	leshort		56		Sony nCPU,
+>18	leshort		57		Denso NDR1,
+>18	leshort		58		Start*Core,
+>18	leshort		59		Toyota ME16,
+>18	leshort		60		ST100,
+>18	leshort		61		Tinyj emb.,
+>18	leshort		62		x86-64,
+>18	leshort		63		Sony DSP,
+>18	leshort		64		DEC PDP-10,
+>18	leshort		65		DEC PDP-11,
+>18	leshort		66		FX66,
+>18	leshort		67		ST9+ 8/16 bit,
+>18	leshort		68		ST7 8 bit,
+>18	leshort		69		MC68HC16,
+>18	leshort		70		MC68HC11,
+>18	leshort		71		MC68HC08,
+>18	leshort		72		MC68HC05,
+>18	leshort		73		SGI SVx or Cray NV1,
+>18	leshort		74		ST19 8 bit,
+>18	leshort		75		Digital VAX,
+>18	leshort		76		Axis cris,
+>18	leshort		77		Infineon 32-bit embedded,
+>18	leshort		78		Element 14 64-bit DSP,
+>18	leshort		79		LSI Logic 16-bit DSP,
+>18	leshort		80		MMIX,
+>18	leshort		81		Harvard machine-independent,
+>18	leshort		82		SiTera Prism,
+>18	leshort		83		Atmel AVR 8-bit,
+>18	leshort		84		Fujitsu FR30,
+>18	leshort		85		Mitsubishi D10V,
+>18	leshort		86		Mitsubishi D30V,
+>18	leshort		87		NEC v850,
+>18	leshort		88		Renesas M32R,
+>18	leshort		89		Matsushita MN10300,
+>18	leshort		90		Matsushita MN10200,
+>18	leshort		91		picoJava,
+>18	leshort		92		OpenRISC,
+>18	leshort		93		ARC Cores Tangent-A5,
+>18	leshort		94		Tensilica Xtensa,
+>18	leshort		95		Alphamosaic VideoCore,
+>18	leshort		96		Thompson Multimedia,
+>18	leshort		97		NatSemi 32k,
+>18	leshort		98		Tenor Network TPC,
+>18	leshort		99		Trebia SNP 1000,
+>18	leshort		100		STMicroelectronics ST200,
+>18	leshort		101		Ubicom IP2022,
+>18	leshort		102		MAX Processor,
+>18	leshort		103		NatSemi CompactRISC,
+>18	leshort		104		Fujitsu F2MC16,
+>18	leshort		105		TI msp430,
+>18	leshort		106		Analog Devices Blackfin,
+>18	leshort		107		S1C33 Family of Seiko Epson,
+>18	leshort		108		Sharp embedded,
+>18	leshort		109		Arca RISC,
+>18	leshort		110		PKU-Unity Ltd.,
+>18	leshort		111		eXcess: 16/32/64-bit,
+>18	leshort		112		Icera Deep Execution Processor,
+>18	leshort		113		Altera Nios II,
+>18	leshort		114		NatSemi CRX,
+>18	leshort		115		Motorola XGATE,
+>18	leshort		116		Infineon C16x/XC16x,
+>18	leshort		117		Renesas M16C series,
+>18	leshort		118		Microchip dsPIC30F,
+>18	leshort		119		Freescale RISC core,
+>18	leshort		120		Renesas M32C series,
+>18	leshort		131		Altium TSK3000 core,
+>18	leshort		132		Freescale RS08,
+>18	leshort		134		Cyan Technology eCOG2,
+>18	leshort		135		Sunplus S+core7 RISC,
+>18	leshort		136		New Japan Radio (NJR) 24-bit DSP,
+>18	leshort		137		Broadcom VideoCore III,
+>18	leshort		138		LatticeMico32,
+>18	leshort		139		Seiko Epson C17 family,
+>18	leshort		140		TI TMS320C6000 DSP family,
+>18	leshort		141		TI TMS320C2000 DSP family,
+>18	leshort		142		TI TMS320C55x DSP family,
+>18	leshort		160		STMicroelectronics 64bit VLIW DSP,
+>18	leshort		161		Cypress M8C,
+>18	leshort		162		Renesas R32C series,
+>18	leshort		163		NXP TriMedia family,
+>18	leshort		164		QUALCOMM DSP6,
+>18	leshort		165		Intel 8051 and variants,
+>18	leshort		166		STMicroelectronics STxP7x family,
+>18	leshort		167		Andes embedded RISC,
+>18	leshort		168		Cyan eCOG1X family,
+>18	leshort		169		Dallas MAXQ30,
+>18	leshort		170		New Japan Radio (NJR) 16-bit DSP,
+>18	leshort		171		M2000 Reconfigurable RISC,
+>18	leshort		172		Cray NV2 vector architecture,
+>18	leshort		173		Renesas RX family,
+>18	leshort		174		META,
+>18	leshort		175		MCST Elbrus,
+>18	leshort		176		Cyan Technology eCOG16 family,
+>18	leshort		177		NatSemi CompactRISC,
+>18	leshort		178		Freescale Extended Time Processing Unit,
+>18	leshort		179		Infineon SLE9X,
+>18	leshort		180		Intel L1OM,
+>18	leshort		181		Intel K1OM,
+>18	leshort		183		ARM aarch64,
+>18	leshort		185		Atmel 32-bit family,
+>18	leshort		186		STMicroeletronics STM8 8-bit,
+>18	leshort		187		Tilera TILE64,
+>18	leshort		188		Tilera TILEPro,
+>18	leshort		189		Xilinx MicroBlaze 32-bit RISC,
+>18	leshort		190		NVIDIA CUDA architecture,
+>18	leshort		191		Tilera TILE-Gx,
+>18	leshort		197		Renesas RL78 family,
+>18	leshort		199		Renesas 78K0R,
+>18	leshort		200		Freescale 56800EX,
+>18	leshort		201		Beyond BA1,
+>18	leshort		202		Beyond BA2,
+>18	leshort		203		XMOS xCORE,
+>18	leshort		204		Microchip 8-bit PIC(r),
+>18	leshort		210		KM211 KM32,
+>18	leshort		211		KM211 KMX32,
+>18	leshort		212		KM211 KMX16,
+>18	leshort		213		KM211 KMX8,
+>18	leshort		214		KM211 KVARC,
+>18	leshort		215		Paneve CDP,
+>18	leshort		216		Cognitive Smart Memory,
+>18	leshort		217		iCelero CoolEngine,
+>18	leshort		218		Nanoradio Optimized RISC,
+>18	leshort		0x1057		AVR (unofficial),
+>18	leshort		0x1059		MSP430 (unofficial),
+>18	leshort		0x1223		Adapteva Epiphany (unofficial),
+>18	leshort		0x2530		Morpho MT (unofficial),
+>18	leshort		0x3330		FR30 (unofficial),
+>18	leshort		0x3426		OpenRISC (obsolete),
+>18	leshort		0x4688		Infineon C166 (unofficial),
+>18	leshort		0x5441		Cygnus FRV (unofficial),
+>18	leshort		0x5aa5		DLX (unofficial),
+>18	leshort		0x7650		Cygnus D10V (unofficial),
+>18	leshort		0x7676		Cygnus D30V (unofficial),
+>18	leshort		0x8217		Ubicom IP2xxx (unofficial),
+>18	leshort		0x8472		OpenRISC (obsolete),
+>18	leshort		0x9025		Cygnus PowerPC (unofficial),
+>18	leshort		0x9026		Alpha (unofficial),
+>18	leshort		0x9041		Cygnus M32R (unofficial),
+>18	leshort		0x9080		Cygnus V850 (unofficial),
+>18	leshort		0xa390		IBM S/390 (obsolete),
+>18	leshort		0xabc7		Old Xtensa (unofficial),
+>18	leshort		0xad45		xstormy16 (unofficial),
+>18	leshort		0xbaab		Old MicroBlaze (unofficial),,
+>18	leshort		0xbeef		Cygnus MN10300 (unofficial),
+>18	leshort		0xdead		Cygnus MN10200 (unofficial),
+>18	leshort		0xf00d		Toshiba MeP (unofficial),
+>18	leshort		0xfeb0		Renesas M32C (unofficial),
+>18	leshort		0xfeba		Vitesse IQ2000 (unofficial),
+>18	leshort		0xfebb		NIOS (unofficial),
+>18	leshort		0xfeed		Moxie (unofficial),
+>18	default		x
+>>18	leshort		x		*unknown arch 0x%x*
+>20	lelong		0		invalid version
+>20	lelong		1		version 1
+
+0	string		\177ELF		ELF
+!:strength *2
+>4	byte		0		invalid class
+>4	byte		1		32-bit
+>4	byte		2		64-bit
+>5	byte		0		invalid byte order
+>5	byte		1		LSB
+>>0	use		elf-le
+>5	byte		2		MSB
+>>0	use		\^elf-le
+# Up to now only 0, 1 and 2 are defined; I've seen a file with 0x83, it seemed
+# like proper ELF, but extracting the string had bad results.
+>4      byte            <0x80
+>>8	string		>\0		(%s)
+>8	string		\0
+>>7	byte		0		(SYSV)
+>>7	byte		1		(HP-UX)
+>>7	byte		2		(NetBSD)
+>>7	byte		3		(GNU/Linux)
+>>7	byte		4		(GNU/Hurd)
+>>7	byte		5		(86Open)
+>>7	byte		6		(Solaris)
+>>7	byte		7		(Monterey)
+>>7	byte		8		(IRIX)
+>>7	byte		9		(FreeBSD)
+>>7	byte		10		(Tru64)
+>>7	byte		11		(Novell Modesto)
+>>7	byte		12		(OpenBSD)
+>8      string          \2
+>>7     byte            13              (OpenVMS)
+>>7	byte		97		(ARM)
+>>7	byte		255		(embedded)
diff --git a/contrib/file/Magdir/encore b/contrib/file/magic/Magdir/encore
similarity index 84%
rename from contrib/file/Magdir/encore
rename to contrib/file/magic/Magdir/encore
index ef82eed64b0..287b388dbaa 100644
--- a/contrib/file/Magdir/encore
+++ b/contrib/file/magic/Magdir/encore
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: encore,v 1.6 2009/09/19 16:28:09 christos Exp $
+# $File: encore,v 1.7 2014/04/30 21:41:02 christos Exp $
 # encore:  file(1) magic for Encore machines
 #
 # XXX - needs to have the byte order specified (NS32K was little-endian,
@@ -12,11 +12,11 @@
 >20	short		0x10b		demand-paged executable
 >20	short		0x10f		unsupported executable
 >12	long		>0		not stripped
->22	short		>0		- version %ld
+>22	short		>0		- version %d
 >22	short		0		-
 #>4	date		x		stamp %s
 0	short		0x155		Encore unsupported executable
 >12	long		>0		not stripped
->22	short		>0		- version %ld
+>22	short		>0		- version %d
 >22	short		0		-
 #>4	date		x		stamp %s
diff --git a/contrib/file/Magdir/epoc b/contrib/file/magic/Magdir/epoc
similarity index 84%
rename from contrib/file/Magdir/epoc
rename to contrib/file/magic/Magdir/epoc
index c67a8b66e7b..6f4ab5fc38e 100644
--- a/contrib/file/Magdir/epoc
+++ b/contrib/file/magic/Magdir/epoc
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: epoc,v 1.7 2009/09/19 16:28:09 christos Exp $
+# $File: epoc,v 1.9 2013/12/21 14:28:15 christos Exp $
 # EPOC : file(1) magic for EPOC documents [Psion Series 5/Osaris/Geofox 1]
 # Stefan Praszalowicz  and Peter Breitenlohner 
 # Useful information for improving this file can be found at:
@@ -21,6 +21,7 @@
 !:mime application/x-epoc-word
 >>8	lelong		0x10000085	OPL program (TextEd)
 !:mime application/x-epoc-opl
+>>8	lelong		0x10000087	Comms settings
 >>8	lelong		0x10000088	Sheet file
 !:mime application/x-epoc-sheet
 >>8	lelong		0x100001C4	EasyFax initialisation file
@@ -29,11 +30,19 @@
 >4	lelong		0x10000074	OPL application
 !:mime application/x-epoc-app
 >4	lelong		0x1000008A	exported multi-bitmap image
+>4	lelong		0x1000016D
+>>8	lelong		0x10000087	Comms names
 
 0	lelong		0x10000041	Psion Series 5 ROM multi-bitmap image
 
 0	lelong		0x10000050	Psion Series 5
 >4	lelong		0x1000006D	database
+>>8	lelong		0x10000084	Agenda file
+!:mime application/x-epoc-agenda
+>>8	lelong		0x10000086	Data file
+!:mime application/x-epoc-data
+>>8	lelong		0x10000CEA	Jotter file
+!:mime application/x-epoc-jotter
 >4	lelong		0x100000E4	ini file
 
 0	lelong		0x10000079	Psion Series 5 binary:
diff --git a/contrib/file/Magdir/erlang b/contrib/file/magic/Magdir/erlang
similarity index 100%
rename from contrib/file/Magdir/erlang
rename to contrib/file/magic/Magdir/erlang
diff --git a/contrib/file/Magdir/esri b/contrib/file/magic/Magdir/esri
similarity index 100%
rename from contrib/file/Magdir/esri
rename to contrib/file/magic/Magdir/esri
diff --git a/contrib/file/Magdir/fcs b/contrib/file/magic/Magdir/fcs
similarity index 100%
rename from contrib/file/Magdir/fcs
rename to contrib/file/magic/Magdir/fcs
diff --git a/contrib/file/Magdir/filesystems b/contrib/file/magic/Magdir/filesystems
similarity index 50%
rename from contrib/file/Magdir/filesystems
rename to contrib/file/magic/Magdir/filesystems
index af9695b9a42..7225d759965 100644
--- a/contrib/file/Magdir/filesystems
+++ b/contrib/file/magic/Magdir/filesystems
@@ -1,8 +1,189 @@
-
 #------------------------------------------------------------------------------
-# $File: filesystems,v 1.61 2011/01/10 14:01:10 christos Exp $
+# $File: filesystems,v 1.95 2014/06/03 19:17:27 christos Exp $
 # filesystems:  file(1) magic for different filesystems
 #
+0	name	partid  
+>0	ubyte	0x00	Unused
+>0	ubyte	0x01	12-bit FAT
+>0	ubyte	0x02	XENIX /
+>0	ubyte	0x03	XENIX /usr
+>0	ubyte	0x04	16-bit FAT, less than 32M
+>0	ubyte	0x05	extended partition
+>0	ubyte	0x06	16-bit FAT, more than 32M
+>0	ubyte	0x07	OS/2 HPFS, NTFS, QNX2, Adv. UNIX
+>0	ubyte	0x08	AIX or os, or etc.
+>0	ubyte	0x09	AIX boot partition or Coherent
+>0	ubyte	0x0a	O/2 boot manager or Coherent swap
+>0	ubyte	0x0b	32-bit FAT
+>0	ubyte	0x0c	32-bit FAT, LBA-mapped
+>0	ubyte	0x0d	7XXX, LBA-mapped
+>0	ubyte	0x0e	16-bit FAT, LBA-mapped
+>0	ubyte	0x0f	extended partition, LBA-mapped
+>0	ubyte	0x10	OPUS
+>0	ubyte	0x11 	OS/2 DOS 12-bit FAT
+>0	ubyte	0x12 	Compaq diagnostics
+>0	ubyte	0x14 	OS/2 DOS 16-bit FAT <32M
+>0	ubyte	0x16 	OS/2 DOS 16-bit FAT >=32M
+>0	ubyte	0x17 	OS/2 hidden IFS
+>0	ubyte	0x18 	AST Windows swapfile
+>0	ubyte	0x19 	Willowtech Photon coS
+>0	ubyte	0x1b 	hidden win95 fat 32
+>0	ubyte	0x1c 	hidden win95 fat 32 lba
+>0	ubyte	0x1d	hidden win95 fat 16 lba
+>0	ubyte	0x20 	Willowsoft OFS1
+>0	ubyte	0x21 	reserved
+>0	ubyte	0x23 	reserved
+>0	ubyte	0x24	NEC DOS
+>0	ubyte	0x26 	reserved
+>0	ubyte	0x31 	reserved
+>0	ubyte	0x32	Alien Internet Services NOS
+>0	ubyte	0x33 	reserved
+>0	ubyte	0x34 	reserved
+>0	ubyte	0x35 	JFS on OS2
+>0	ubyte	0x36 	reserved
+>0	ubyte	0x38 	Theos
+>0	ubyte	0x39 	Plan 9, or Theos spanned
+>0	ubyte	0x3a 	Theos ver 4 4gb partition
+>0	ubyte	0x3b 	Theos ve 4 extended partition
+>0	ubyte	0x3c 	PartitionMagic recovery
+>0	ubyte	0x3d 	Hidden Netware
+>0	ubyte	0x40 	VENIX 286 or LynxOS
+>0	ubyte	0x41	PReP
+>0	ubyte	0x42	linux swap sharing DRDOS disk
+>0	ubyte	0x43	linux sharing DRDOS disk
+>0	ubyte	0x44	GoBack change utility
+>0	ubyte	0x45	Boot US Boot manager
+>0	ubyte	0x46	EUMEL/Elan or Ergos 3
+>0	ubyte	0x47	EUMEL/Elan or Ergos 3
+>0	ubyte	0x48	EUMEL/Elan or Ergos 3
+>0	ubyte	0x4a	ALFX/THIN filesystem for DOS
+>0	ubyte	0x4c	Oberon partition
+>0	ubyte	0x4d 	QNX4.x
+>0	ubyte	0x4e 	QNX4.x 2nd part
+>0	ubyte	0x4f 	QNX4.x 3rd part
+>0	ubyte	0x50 	DM (disk manager)
+>0	ubyte	0x51 	DM6 Aux1 (or Novell)
+>0	ubyte	0x52 	CP/M or Microport SysV/AT
+>0	ubyte	0x53 	DM6 Aux3
+>0	ubyte	0x54	DM6 DDO
+>0	ubyte	0x55	EZ-Drive (disk manager)
+>0	ubyte	0x56	Golden Bow (disk manager)
+>0	ubyte	0x57	Drive PRO
+>0	ubyte	0x5c	Priam Edisk (disk manager)
+>0	ubyte	0x61	SpeedStor
+>0	ubyte	0x63	GNU HURD or Mach or Sys V/386
+>0	ubyte	0x64	Novell Netware 2.xx or Speedstore
+>0	ubyte	0x65	Novell Netware 3.xx
+>0	ubyte	0x66	Novell 386 Netware
+>0	ubyte	0x67	Novell
+>0	ubyte	0x68	Novell
+>0	ubyte	0x69	Novell
+>0	ubyte	0x70	DiskSecure Multi-Boot
+>0	ubyte	0x71	reserved
+>0	ubyte	0x73	reserved
+>0	ubyte	0x74	reserved
+>0	ubyte	0x75	PC/IX
+>0	ubyte	0x76	reserved
+>0	ubyte	0x77	M2FS/M2CS partition
+>0	ubyte	0x78	XOSL boot loader filesystem
+>0	ubyte	0x80	MINIX until 1.4a
+>0	ubyte	0x81	MINIX since 1.4b
+>0	ubyte	0x82	Linux swap or Solaris
+>0	ubyte	0x83	Linux native
+>0	ubyte	0x84	OS/2 hidden C: drive
+>0	ubyte	0x85	Linux extended partition
+>0	ubyte	0x86	NT FAT volume set
+>0	ubyte	0x87	NTFS volume set or HPFS mirrored
+>0	ubyte	0x8a	Linux Kernel AiR-BOOT partition
+>0	ubyte	0x8b	Legacy Fault tolerant FAT32
+>0	ubyte	0x8c	Legacy Fault tolerant FAT32 ext
+>0	ubyte	0x8d	Hidden free FDISK FAT12
+>0	ubyte	0x8e	Linux Logical Volume Manager
+>0	ubyte	0x90	Hidden free FDISK FAT16
+>0	ubyte	0x91	Hidden free FDISK DOS EXT
+>0	ubyte	0x92	Hidden free FDISK FAT16 Big
+>0	ubyte	0x93	Amoeba filesystem
+>0	ubyte	0x94	Amoeba bad block table
+>0	ubyte	0x95	MIT EXOPC native partitions
+>0	ubyte	0x97	Hidden free FDISK FAT32
+>0	ubyte	0x98	Datalight ROM-DOS Super-Boot
+>0	ubyte	0x99	Mylex EISA SCSI
+>0	ubyte	0x9a	Hidden free FDISK FAT16 LBA
+>0	ubyte	0x9b	Hidden free FDISK EXT LBA
+>0	ubyte	0x9f	BSDI?
+>0	ubyte	0xa0	IBM Thinkpad hibernation
+>0	ubyte	0xa1	HP Volume expansion (SpeedStor)
+>0	ubyte	0xa3	HP Volume expansion (SpeedStor)
+>0	ubyte	0xa4	HP Volume expansion (SpeedStor)
+>0	ubyte	0xa5	386BSD partition type
+>0	ubyte	0xa6	OpenBSD partition type
+>0	ubyte	0xa7	NeXTSTEP 486
+>0	ubyte	0xa8	Apple UFS
+>0	ubyte	0xa9	NetBSD partition type
+>0	ubyte	0xaa	Olivetty Fat12 1.44MB Service part
+>0	ubyte	0xab	Apple Boot
+>0	ubyte	0xae	SHAG OS filesystem
+>0	ubyte	0xaf	Apple HFS
+>0	ubyte	0xb0	BootStar Dummy
+>0	ubyte	0xb1	reserved
+>0	ubyte	0xb3	reserved
+>0	ubyte	0xb4	reserved
+>0	ubyte	0xb6	reserved
+>0	ubyte	0xb7	BSDI BSD/386 filesystem
+>0	ubyte	0xb8	BSDI BSD/386 swap
+>0	ubyte	0xbb	Boot Wizard Hidden
+>0	ubyte	0xbe	Solaris 8 partition type
+>0	ubyte	0xbf	Solaris partition type
+>0	ubyte	0xc0 	CTOS
+>0	ubyte	0xc1 	DRDOS/sec (FAT-12)
+>0	ubyte	0xc2 	Hidden Linux
+>0	ubyte	0xc3 	Hidden Linux swap
+>0	ubyte	0xc4 	DRDOS/sec (FAT-16, < 32M)
+>0	ubyte	0xc5 	DRDOS/sec (EXT)
+>0	ubyte	0xc6 	DRDOS/sec (FAT-16, >= 32M)
+>0	ubyte	0xc7 	Syrinx (Cyrnix?) or HPFS disabled
+>0	ubyte	0xc8 	Reserved for DR-DOS 8.0+
+>0	ubyte	0xc9 	Reserved for DR-DOS 8.0+
+>0	ubyte	0xca 	Reserved for DR-DOS 8.0+
+>0	ubyte	0xcb 	DR-DOS 7.04+ Secured FAT32 CHS
+>0	ubyte	0xcc 	DR-DOS 7.04+ Secured FAT32 LBA
+>0	ubyte	0xcd	CTOS Memdump
+>0	ubyte	0xce 	DR-DOS 7.04+ FAT16X LBA
+>0	ubyte	0xcf 	DR-DOS 7.04+ EXT LBA
+>0	ubyte	0xd0 	REAL/32 secure big partition
+>0	ubyte	0xd1 	Old Multiuser DOS FAT12
+>0	ubyte	0xd4 	Old Multiuser DOS FAT16 Small
+>0	ubyte	0xd5 	Old Multiuser DOS Extended
+>0	ubyte	0xd6 	Old Multiuser DOS FAT16 Big
+>0	ubyte	0xd8 	CP/M 86
+>0	ubyte	0xdb 	CP/M or Concurrent CP/M
+>0	ubyte	0xdd 	Hidden CTOS Memdump
+>0	ubyte	0xde 	Dell PowerEdge Server utilities
+>0	ubyte	0xdf 	DG/UX virtual disk manager
+>0	ubyte	0xe0 	STMicroelectronics ST AVFS
+>0	ubyte	0xe1 	DOS access or SpeedStor 12-bit
+>0	ubyte	0xe3 	DOS R/O or Storage Dimensions
+>0	ubyte	0xe4 	SpeedStor 16-bit FAT < 1024 cyl.
+>0	ubyte	0xe5	reserved
+>0	ubyte	0xe6	reserved
+>0	ubyte	0xeb 	BeOS
+>0	ubyte	0xee	GPT Protective MBR
+>0	ubyte	0xef	EFI system partition
+>0	ubyte	0xf0 	Linux PA-RISC boot loader
+>0	ubyte	0xf1 	SpeedStor or Storage Dimensions
+>0	ubyte	0xf2 	DOS 3.3+ Secondary
+>0	ubyte	0xf3	reserved
+>0	ubyte	0xf4	SpeedStor large partition
+>0	ubyte	0xf5	Prologue multi-volumen partition
+>0	ubyte	0xf6 	reserved
+>0	ubyte	0xf9 	pCache: ext2/ext3 persistent cache
+>0	ubyte	0xfa 	Bochs x86 emulator
+>0	ubyte	0xfb 	VMware File System
+>0	ubyte	0xfc 	VMware Swap
+>0	ubyte	0xfd 	Linux RAID partition persistent sb
+>0	ubyte	0xfe	LANstep or IBM PS/2 IML
+>0	ubyte	0xff 	Xenix Bad Block Table
+
 0	string	\366\366\366\366	PC formatted floppy with no filesystem
 # Sun disk labels
 # From /usr/include/sun/dklabel.h:
@@ -23,11 +204,12 @@
 >>0752	short		>0		%d alt cyls,
 >>0754	short		>0		%d heads/partition,
 >>0756	short		>0		%d sectors/track,
->>0764	long		>0		start cyl %ld,
->>0770	long		x		%ld blocks
+>>0764	long		>0		start cyl %d,
+>>0770	long		x		%d blocks
 # Is there a boot block written 1 sector in?
 >512    belong&077777777	0600407	\b, boot block present
-# Joerg Jenderek: Smart Boot Manager backup file is 41 byte header + first sectors of disc
+
+# Joerg Jenderek: Smart Boot Manager backup file is 25 (MSDOS) or 41 (LINUX) byte header + first sectors of disk
 # (http://btmgr.sourceforge.net/docs/user-guide-3.html)
 0		string	SBMBAKUP_	Smart Boot Manager backup file
 >9		string	x		\b, version %-5.5s
@@ -41,8 +223,10 @@
 >>>>21		ubyte	x		\b, from drive 0x%x
 >>>22		ubyte	>0		
 >>>>21		string	x		\b, from drive %s
+>>>535		search/17	\x55\xAA	
+>>>>&-512	indirect	x	\b; contains 
 
-# Joerg Jenderek
+# updated by Joerg Jenderek at Nov 2012
 # DOS Emulator image is 128 byte, null right padded header + harddisc image
 0	string	DOSEMU\0			
 >0x27E	leshort	0xAA55			
@@ -52,17 +236,186 @@
 >>>>7	ulelong	>0		\b, %u heads
 >>>>11	ulelong	>0		\b, %d sectors/track
 >>>>15	ulelong	>0		\b, %d cylinders
+>>>>128	indirect	x	\b; contains 
 
-# updated by Joerg Jenderek at Sep 2007
+# added by Joerg Jenderek at Nov 2012
+# http://www.thenakedpc.com/articles/v04/08/0408-05.html
+# Symantec (Peter Norton) Image.dat file consists of variable header, bootrecord, part of FAT and root directory data
+0	string	PNCIHISK\0		Norton Utilities disc image data
+# real x86 boot sector with jump instruction
+>509	search/1026	\x55\xAA\xeb	
+>>&-1	indirect	x		\b; contains 
+# http://file-extension.net/seeker/file_extension_dat
+0	string	PNCIUNDO		Norton Disk Doctor UnDo file
+#
+
+# DOS/MBR boot sector updated by Joerg Jenderek at Sep 2007,May 2011,2013
+# for any allowed sector sizes
+30		search/481	\x55\xAA	
+# to display DOS/MBR boot sector (40) before old one (strength=50+21),Syslinux bootloader (71),SYSLINUX MBR (37+36),NetBSD mbr (110),AdvanceMAME mbr (111)
+# DOS BPB information (70) and after DOS floppy (120) like in previous file version
+!:strength +72
+# for sector sizes < 512 Bytes
+>11		uleshort	<512		
+>>(11.s-2)	uleshort	0xAA55		DOS/MBR boot sector
+# for sector sizes with 512 or more Bytes
+>0x1FE		leshort		0xAA55		DOS/MBR boot sector
+# keep old DOS/MBR boot sector as dummy for mbr and bootloader displaying
 # only for sector sizes with 512 or more Bytes
-0x1FE	leshort	0xAA55			x86 boot sector
-# to do also for sectors < than 512 Bytes and some other files, GRR
-#30	search/481	\x55\xAA	x86 boot sector
-# not for BeOS floppy 1440k, MBRs
-#(11.s-2) uleshort	0xAA55		x86 boot sector
+0x1FE		leshort		0xAA55		
+#
+# to display information (50) before DOS BPB (strength=70) and after DOS floppy (120) like in old file version
+!:strength +21
 >2	string	OSBS			\b, OS/BS MBR
-# J\xf6rg Jenderek 
->0x8C	string	Invalid\ partition\ table	\b, MS-DOS MBR
+# added by Joerg Jenderek at Feb 2013 according to http://thestarman.pcministry.com/asm/mbr/
+# and http://en.wikipedia.org/wiki/Master_Boot_Record
+# test for nearly all MS-DOS Master Boot Record initial program loader (IPL) is now done by 
+# characteristic assembler instructions: xor ax,ax;mov ss,ax;mov sp,7c00
+>0	search/2	\x33\xc0\x8e\xd0\xbc\x00\x7c	MS-MBR
+# Microsoft Windows 95A and early ( http://thestarman.pcministry.com/asm/mbr/STDMBR.htm )
+# assembler instructions: mov si,sp;push ax;pop es;push ax;pop ds;sti;cld
+>>8	ubequad		0x8bf45007501ffbfc		
+# http://thestarman.pcministry.com/asm/mbr/200MBR.htm
+>>>0x16	ubyte		0xF3				\b,DOS 2
+>>>>219	regex		Author\ -\ 			Author:
+# found "David Litton" , "A Pehrsson  "
+>>>>>&0	string		x				"%s"
+>>>0x16	ubyte		0xF2				
+# NEC MS-DOS 3.30 Rev. 3 . See http://thestarman.pcministry.com/asm/mbr/DOS33MBR.htm
+# assembler instructions: mov di,077c;cmp word ptrl[di],a55a;jnz
+>>>>0x22	ubequad	0xbf7c07813d5aa575		\b,NEC 3.3
+# version MS-DOS 3.30 til MS-Windows 95A (WinVer=4.00.1111)
+>>>>0x22	default	x				\b,D0S version 3.3-7.0
+# error messages are printed by assembler instructions: mov si,06nn;...;int 10 (0xBEnn06;...)
+# where nn is string offset varying for different languages
+# "Invalid partition table"				nn=0x8b for english version
+>>>>>(0x49.b)	string		Invalid\ partition\ table		english
+>>>>>(0x49.b)	string		Ung\201ltige\ Partitionstabelle		german
+>>>>>(0x49.b)	string		Table\ de\ partition\ invalide		french
+>>>>>(0x49.b)	string		Tabela\ de\ parti\207ao\ inv\240lida	portuguese
+>>>>>(0x49.b)	string		Tabla\ de\ partici\242n\ no\ v\240lida	spanish
+>>>>>(0x49.b)	string		Tavola\ delle\ partizioni\ non\ valida	italian
+>>>>>0x49	ubyte		>0			at offset 0x%x
+>>>>>>(0x49.b)	string		>\0			"%s"
+# "Error loading operating system"			nn=0xa3 for english version
+# "Fehler beim Laden des Betriebssystems"		nn=0xa7 for german version
+# "Erreur en chargeant syst\212me d'exploitation"	nn=0xa7 for french version
+# "Erro na inicializa\207ao do sistema operacional"	nn=0xa7 for portuguese Brazilian version
+# "Error al cargar sistema operativo"			nn=0xa8 for spanish version
+# "Errore durante il caricamento del sistema operativo"	nn=0xae for italian version
+>>>>>0x74	ubyte		>0			at offset 0x%x
+>>>>>>(0x74.b)	string		>\0			"%s"
+# "Missing operating system"				nn=0xc2 for english version
+# "Betriebssystem fehlt"				nn=0xcd for german version
+# "Syst\212me d'exploitation absent"			nn=0xd2 for french version
+# "Sistema operacional nao encontrado"			nn=0xd4 for portuguese Brazilian version
+# "Falta sistema operativo"				nn=0xca for spanish version
+# "Sistema operativo mancante"				nn=0xe2 for italian version
+>>>>>0x79	ubyte		>0			at offset 0x%x
+>>>>>>(0x79.b)	string		>\0			"%s"
+# Microsoft Windows 95B to XP (http://thestarman.pcministry.com/asm/mbr/95BMEMBR.htm)
+# assembler instructions: push ax;pop es;push  ax;pop ds;cld;mov si,7c1b
+>>8	ubequad		0x5007501ffcbe1b7c		
+# assembler instructions: rep;movsb;retf;mov si,07be;mov cl,04
+>>>24		ubequad	0xf3a4cbbebe07b104		9M
+# "Invalid partition table"				nn=0x10F for english version
+# "Ung\201ltige Partitionstabelle"				nn=0x10F for german version
+# "Table de partition erron\202e"				nn=0x10F for french version
+# "\216\257\245\340\240\346\250\256\255\255\240\357 \341\250\341\342\245\254\240 \255\245 \255\240\251\244\245\255\240"	nn=0x10F for russian version
+>>>>(0x3C.b+0x0FF)	string	Invalid\ partition\ table		english
+>>>>(0x3C.b+0x0FF)	string	Ung\201ltige\ Partitionstabelle		german
+>>>>(0x3C.b+0x0FF)	string	Table\ de\ partition\ erron\202e	french
+>>>>(0x3C.b+0x0FF)	string	\215\245\257\340\240\242\250\253\354\255\240\357\ \342\240\241\253\250\346\240	russian
+>>>>0x3C		ubyte	x			at offset 0x%x+0xFF
+>>>>(0x3C.b+0x0FF)	string	>\0			"%s"
+# "Error loading operating system"			nn=0x127 for english version
+# "Fehler beim Laden des Betriebssystems"		nn=0x12b for german version
+# "Erreur lors du chargement du syst\212me d'exploitation"	nn=0x12a for french version
+# "\216\350\250\241\252\240 \257\340\250 \247\240\243\340\343\247\252\245 \256\257\245\340\240\346\250\256\255\255\256\251 \341\250\341\342\245\254\353"	nn=0x12d for russian version
+>>>>0xBD		ubyte	x			at offset 0x1%x
+>>>>(0xBD.b+0x100)	string	>\0			"%s"
+# "Missing operating system"				nn=0x146 for english version
+# "Betriebssystem fehlt"				nn=0x151 for german version
+# "Syst\212me d'exploitation manquant"			nn=0x15e for french version
+# "\216\257\245\340\240\346\250\256\255\255\240\357 \341\250\341\342\245\254\240 \255\245 \255\240\251\244\245\255\240"	nn=0x156 for russian version
+>>>>0xA9		ubyte	x			at offset 0x1%x
+>>>>(0xA9.b+0x100)	string	>\0			"%s"
+# http://thestarman.pcministry.com/asm/mbr/Win2kmbr.htm
+# assembler instructions: rep;movsb;retf;mov BP,07be;mov cl,04
+>>>24		ubequad	0xf3a4cbbdbe07b104		XP
+# where xxyyzz are lower bits from offsets of error messages varying for different languages
+>>>>0x1B4	ubelong&0x00FFFFFF	0x002c4463	english
+>>>>0x1B4	ubelong&0x00FFFFFF	0x002c486e	german
+# "Invalid partition table"				xx=0x12C for english version
+# "Ung\201ltige Partitionstabelle"				xx=0x12C for german version
+>>>>0x1b5	ubyte		>0			at offset 0x1%x
+>>>>(0x1b5.b+0x100)	string	>\0			"%s"
+# "Error loading operating system"			yy=0x144 for english version
+# "Fehler beim Laden des Betriebssystems"		yy=0x148 for german version
+>>>>0x1b6	ubyte		>0			at offset 0x1%x
+>>>>(0x1b6.b+0x100)	string	>\0			"%s"
+# "Missing operating system"				zz=0x163 for english version
+# "Betriebssystem nicht vorhanden"			zz=0x16e for german version
+>>>>0x1b7	ubyte		>0			at offset 0x1%x
+>>>>(0x1b7.b+0x100)	string	>\0			"%s"
+# Microsoft Windows Vista or 7
+# assembler instructions: ..;mov ds,ax;mov si,7c00;mov di,..00
+>>8	ubequad		0xc08ed8be007cbf00		
+# Microsoft Windows Vista (http://thestarman.pcministry.com/asm/mbr/VistaMBR.htm)
+# assembler instructions: jnz 0729;cmp ebx,"TCPA"
+>>>0xEC		ubequad	0x753b6681fb544350		Vista
+# where xxyyzz are lower bits from offsets of error messages varying for different languages
+>>>>0x1B4	ubelong&0x00FFFFFF	0x00627a99	english
+#>>>>0x1B4	ubelong&0x00FFFFFF	?		german
+# "Invalid partition table"				xx=0x162 for english version
+# "Ung\201ltige Partitionstabelle"				xx=0x1?? for german version
+>>>>0x1b5	ubyte		>0			at offset 0x1%x
+>>>>(0x1b5.b+0x100)	string	>\0			"%s"
+# "Error loading operating system"			yy=0x17a for english version
+# "Fehler beim Laden des Betriebssystems"		yy= 0x1?? for german version
+>>>>0x1b6	ubyte		>0			at offset 0x1%x
+>>>>(0x1b6.b+0x100)	string	>\0			"%s"
+# "Missing operating system"				zz=0x199 for english version
+# "Betriebssystem nicht vorhanden"			zz=0x1?? for german version
+>>>>0x1b7	ubyte		>0			at offset 0x1%x
+>>>>(0x1b7.b+0x100)	string	>\0			"%s"
+# Microsoft Windows 7 (http://thestarman.pcministry.com/asm/mbr/W7MBR.htm)
+# assembler instructions: cmp ebx,"TCPA";cmp
+>>>0xEC		ubequad	0x6681fb5443504175		Windows 7
+# where xxyyzz are lower bits from offsets of error messages varying for different languages
+>>>>0x1B4	ubelong&0x00FFFFFF	0x00637b9a	english
+#>>>>0x1B4	ubelong&0x00FFFFFF	?		german
+# "Invalid partition table"				xx=0x163 for english version
+# "Ung\201ltige Partitionstabelle"				xx=0x1?? for german version
+>>>>0x1b5	ubyte		>0			at offset 0x1%x
+>>>>(0x1b5.b+0x100)	string	>\0			"%s"
+# "Error loading operating system"			yy=0x17b for english version
+# "Fehler beim Laden des Betriebssystems"		yy=0x1?? for german version
+>>>>0x1b6	ubyte		>0			at offset 0x1%x
+>>>>(0x1b6.b+0x100)	string	>\0			"%s"
+# "Missing operating system"				zz=0x19a for english version
+# "Betriebssystem nicht vorhanden"			zz=0x1?? for german version
+>>>>0x1b7	ubyte		>0			at offset 0x1%x
+>>>>(0x1b7.b+0x100)	string	>\0			"%s"
+# http://thestarman.pcministry.com/asm/mbr/Win2kmbr.htm#DiskSigs
+# http://en.wikipedia.org/wiki/MBR_disk_signature#ID
+>>0x1b8	ulelong		>0				\b, disk signature 0x%-.4x
+# driveID/timestamp for Win 95B,98,98SE and ME. See http://thestarman.pcministry.com/asm/mbr/mystery.htm
+>>0xDA	uleshort		0			
+>>>0xDC 	ulelong		>0			\b, created
+# physical drive number (0x80-0xFF) when the Windows wrote that byte to the drive
+>>>>0xDC	ubyte		x			with driveID 0x%x
+# hours, minutes and seconds 
+>>>>0xDf	ubyte		x			at %x
+>>>>0xDe	ubyte		x			\b:%x
+>>>>0xDd	ubyte		x			\b:%x
+# special case for Microsoft MS-DOS 3.21 spanish
+# assembler instructions: cli;mov $0x30,%ax;mov %ax,%ss;mov 
+>0	ubequad		0xfab830008ed0bc00		
+# assembler instructions: $0x1f00,%sp;mov $0x80cb,%di;add %cl,(%bx,%si);in (%dx),%ax;mov 
+>>8	ubequad		0x1fbfcb800008ed8		MS-MBR,D0S version 3.21 spanish
+# Microsoft MBR IPL end
+
 # dr-dos with some upper-, lowercase variants
 >0x9D	string	Invalid\ partition\ table$	
 >>181	string	No\ Operating\ System$		
@@ -81,30 +434,9 @@
 >>>>>>358	string	Press\ any\ key\ to\ continue.\n\r$	
 >>>>>>>387	string	Copyright\ (c)\ 1984,1998	
 >>>>>>>>411	string	Caldera\ Inc.\0		\b, DR-DOS MBR (IBMBIO.LDR)
->0x10F	string	Ung\201ltige\ Partitionstabelle	\b, MS-DOS MBR, german version 4.10.1998, 4.10.2222
->>0x1B8	ubelong	>0				\b, Serial 0x%-.4x
->0x8B	string	Ung\201ltige\ Partitionstabelle	\b, MS-DOS MBR, german version 5.00 to 4.00.950
->271	string	Invalid\ partition\ table\0		
->>295	string	Error\ loading\ operating\ system\0	
->>>326	string	Missing\ operating\ system\0		\b, mbr
 #
->139	string	Invalid\ partition\ table\0		
->>163	string	Error\ loading\ operating\ system\0	
->>>194	string	Missing\ operating\ system\0		\b, Microsoft Windows XP mbr
-# http://www.heise.de/ct/05/09/006/ page 184
-#HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices\DosDevices\?:=Serial4Bytes+8Bytes
->>>>0x1B8	ulelong	>0				\b,Serial 0x%-.4x
->300	string	Invalid\ partition\ table\0	
->>324	string	Error\ loading\ operating\ system\0
->>>355	string	Missing\ operating\ system\0		\b, Microsoft Windows XP MBR
-#??>>>389	string	Invalid\ system\ disk		
->>>>0x1B8	ulelong	>0				\b, Serial 0x%-.4x
->300	string	Ung\201ltige\ Partitionstabelle
-#split string to avoid error: String too long
->>328	string	Fehler\ beim\ Laden\ 	
->>>346	string	des\ Betriebssystems	
->>>>366	string	Betriebssystem\ nicht\ vorhanden	\b, Microsoft Windows XP MBR (german)
->>>>>0x1B8	ulelong	>0				\b, Serial 0x%-.4x
+# tests for different MS-DOS Master Boot Records (MBR) moved and merged
+#
 #>0x145	string	Default:\ F				\b, FREE-DOS MBR
 #>0x14B	string	Default:\ F				\b, FREE-DOS 1.0 MBR
 >0x145	search/7	Default:\ F			\b, FREE-DOS MBR
@@ -131,8 +463,7 @@
 >>>>>>>420	ubyte&0x0F	0Xf			\b ask
 >>>>>420	ubyte		x			\b)
 #
->271	string	Operating\ system\ loading 		
->>296	string	error\r					\b, SYSLINUX MBR (2.10)
+# SYSLINUX MBR moved
 # http://www.acronis.de/
 >362	string	MBR\ Error\ \0\r			
 >>376	string	ress\ any\ key\ to\ 			
@@ -188,88 +519,58 @@
 >>>>>379	string	GRUB\ \0		\b, GRUB version 0.95 or 0.96
 >>>>391		string	Geom\0Hard\ Disk\0Read\0\ Error\0
 >>>>>385	string	GRUB\ \0		\b, GRUB version 0.97
-#unkown version
+# unknown version
 >>>343		string	Geom\0Read\0\ Error\0	
 >>>>321		string	Loading\ stage1.5	\b, GRUB version x.y
 >>>380		string	Geom\0Hard\ Disk\0Read\0\ Error\0
 >>>>374		string	GRUB\ \0		\b, GRUB version n.m
-# http://syslinux.zytor.com/
->478	string	Boot\ failed\r			
->>495	string	LDLINUX\ SYS			\b, SYSLINUX bootloader (1.62)
->480	string	Boot\ failed\r			
->>495	string	LDLINUX\ SYS			\b, SYSLINUX bootloader (2.06 or 2.11)
->484	string	Boot\ error\r			\b, SYSLINUX bootloader (3.11)
+# SYSLINUX bootloader moved
 >395	string	chksum\0\ ERROR!\0		\b, Gujin bootloader
 # http://www.bcdwb.de/bcdw/index_e.htm
 >3	string	BCDL				
 >>498	string	BCDL\ \ \ \ BIN			\b, Bootable CD Loader (1.50Z)
-# mbr partition table entries
-# OEM-ID does not contain MicroSoft,NEWLDR,DOS,SYSLINUX,or MTOOLs
->3			string		!MS
->>3			string		!SYSLINUX
->>>3			string		!MTOOL
->>>>3			string		!NEWLDR
->>>>>5			string		!DOS
-# not FAT (32 bit)
->>>>>>82		string		!FAT32
-#not Linux kernel
->>>>>>>514		string		!HdrS
-#not BeOS
->>>>>>>>422		string		!Be\ Boot\ Loader
-# active flag 0 or 0x80 and type > 0
->>>>>>>>>446		ubyte		<0x81	
->>>>>>>>>>446		ubyte&0x7F	0	
->>>>>>>>>>>450		ubyte		>0	\b; partition 1: ID=0x%x
->>>>>>>>>>>>446		ubyte		0x80	\b, active
->>>>>>>>>>>>447		ubyte		x	\b, starthead %u
-#>>>>>>>>>>>>448		ubyte		x	\b, start C_S: 0x%x
-#>>>>>>>>>>>>448		ubeshort&1023	x	\b, startcylinder? %d
->>>>>>>>>>>>454		ulelong		x	\b, startsector %u
->>>>>>>>>>>>458		ulelong		x	\b, %u sectors
-#
->>>>>>>>>462		ubyte		<0x81	
->>>>>>>>>>462		ubyte&0x7F	0		
->>>>>>>>>>>466		ubyte		>0	\b; partition 2: ID=0x%x
->>>>>>>>>>>>462		ubyte		0x80	\b, active
->>>>>>>>>>>>463		ubyte		x	\b, starthead %u
-#>>>>>>>>>>>>464		ubyte		x	\b, start C_S: 0x%x
-#>>>>>>>>>>>>464		ubeshort&1023	x	\b, startcylinder? %d
->>>>>>>>>>>>470		ulelong		x	\b, startsector %u
->>>>>>>>>>>>474		ulelong		x	\b, %u sectors
-#
->>>>>>>>>478		ubyte		<0x81		
->>>>>>>>>>478		ubyte&0x7F	0		
->>>>>>>>>>>482		ubyte		>0	\b; partition 3: ID=0x%x
->>>>>>>>>>>>478		ubyte		0x80	\b, active
->>>>>>>>>>>>479		ubyte		x	\b, starthead %u
-#>>>>>>>>>>>>480		ubyte		x	\b, start C_S: 0x%x
-#>>>>>>>>>>>>481		ubyte		x	\b, start C2S: 0x%x
-#>>>>>>>>>>>>480		ubeshort&1023	x	\b, startcylinder? %d
->>>>>>>>>>>>486		ulelong		x	\b, startsector %u
->>>>>>>>>>>>490		ulelong		x	\b, %u sectors
-#
->>>>>>>>>494		ubyte		<0x81	
->>>>>>>>>>494		ubyte&0x7F	0		
->>>>>>>>>>>498		ubyte		>0	\b; partition 4: ID=0x%x
->>>>>>>>>>>>494		ubyte		0x80	\b, active
->>>>>>>>>>>>495		ubyte		x	\b, starthead %u
-#>>>>>>>>>>>>496		ubyte		x	\b, start C_S: 0x%x
-#>>>>>>>>>>>>496		ubeshort&1023	x	\b, startcylinder? %d
->>>>>>>>>>>>502		ulelong		x	\b, startsector %u
->>>>>>>>>>>>506		ulelong		x	\b, %u sectors
+# mbr partition table entries updated by Joerg Jenderek at Sep 2013
+# skip Norton Utilities disc image data
+>3		string		!IHISK		
+# skip Linux style boot sector starting with assember instructions mov 0x7c0,ax;
+>>0		belong		!0xb8c0078e		
+# not Linux kernel 
+>>>514		string		!HdrS			
+# not BeOS
+>>>>422		string		!Be\ Boot\ Loader	
+# jump over BPB instruction implies DOS bootsector or AdvanceMAME mbr 
+>>>>>0		ubelong&0xFD000000	=0xE9000000	
+# AdvanceMAME mbr
+>>>>>>(1.b+2)	ubequad		0xfa31c08ed88ec08e	
+>>>>>>>446	use		partition-table
+# mbr, Norton Utilities disc image data, or 2nd,etc. sector of x86 bootloader
+>>>>>0		ubelong&0xFD000000	!0xE9000000	
+# skip FSInfosector
+>>>>>>0		string		!RRaA		
+# skip 3rd sector of MS x86 bootloader with assember instructions cli;MOVZX EAX,BYTE PTR [BP+10];MOV ECX,
+# http://thestarman.pcministry.com/asm/mbr/MSWIN41.htm
+>>>>>>>0	ubequad		!0xfa660fb64610668b	
+# skip 13rd sector of MS x86 bootloader
+>>>>>>>>0	ubequad		!0x660fb64610668b4e	
+# skip sector starting with DOS new line
+>>>>>>>>>0	string		!\r\n			
+# allowed active flag 0,80h-FFh
+>>>>>>>>>>446	ubyte		0			
+>>>>>>>>>>>446	use		partition-table
+>>>>>>>>>>446	ubyte		>0x7F			
+>>>>>>>>>>>446	use		partition-table
+# TODO: test for extended bootrecord (ebr) moved and merged with mbr partition table entries
 # mbr partition table entries end
 # http://www.acronis.de/
 #FAT label=ACRONIS\ SZ
 #OEM-ID=BOOTWIZ0
 >442	string	Non-system\ disk,\ 	
 >>459	string	press\ any\ key...\x7\0		\b, Acronis Startup Recovery Loader
-# DOS names like F11.SYS are 8 right space padded bytes+3 bytes
->>>477		ubyte&0xDF	>0		
->>>>477		string		x 		\b %-.3s
->>>>>480	ubyte&0xDF	>0		
->>>>>>480	string		x 		\b%-.5s
->>>>485		ubyte&0xDF	>0		
->>>>>485	string		x 		\b.%-.3s
+# updated by Joerg Jenderek at Nov 2012, Sep 2013
+# DOS names like F11.SYS or BOOTWIZ.SYS are 8 right space padded bytes+3 bytes
+# display 1 space
+>>>447	ubyte	x		\b 
+>>>477	use	DOS-filename
 #
 >185	string	FDBOOT\ Version\ 			
 >>204	string	\rNo\ Systemdisk.\ 			
@@ -279,24 +580,39 @@
 >>>>>291 string and\ press\ any\ key.\n\r		\b, FDBOOT harddisk Bootloader
 >>>>>>200 string	>\0                             \b, version %-3s
 >242	string	Bootsector\ from\ C.H.\ Hochst\204	
->>278	string	No\ Systemdisk.\ 			
->>>293	string	Booting\ from\ harddisk.\n\r		
->>>441	string	Cannot\ load\ from\ harddisk.\n\r	
->>>>469 string	Insert\ Systemdisk\ 			
->>>>>487 string and\ press\ any\ key.\n\r		\b, WinImage harddisk Bootloader
->>>>>>209 string	>\0                             \b, version %-4.4s
+# http://freecode.com/projects/dosfstools	dosfstools-n.m/src/mkdosfs.c
+# updated by Joerg Jenderek at Nov 2012. Use search directive with offset instead of string
+# skip name "C.H. Hochstaetter" partly because it is sometimes written without umlaut
+>242	search/127	Bootsector\ from\ C.H.\ Hochst			
+>>278	search/127	No\ Systemdisk.\ Booting\ from\ harddisk	
+# followed by variants with point,CR-NL or NL-CR
+>>>208	search/261	Cannot\ load\ from\ harddisk.			
+# followed by variants CR-NL or NL-CR
+>>>>236	search/235	Insert\ Systemdisk\ and\ press\ any\ key.	
+# followed by variants with point,CR-NL or NL-CR
+>>>>>180	search/96	Disk\ formatted\ with\ WinImage\ 	\b, WinImage harddisk Bootloader
+# followed by string like "6.50 (c) 1993-2004 Gilles Vollant"
+>>>>>>&0	string		x 					\b, version %-4.4s
 >(1.b+2)	ubyte		0xe			
 >>(1.b+3)	ubyte		0x1f			
 >>>(1.b+4)	ubyte		0xbe			
->>>>(1.b+5)	ubyte		0x77			
->>>>(1.b+6)	ubyte		0x7c			
->>>>>(1.b+7)	ubyte		0xac			
->>>>>>(1.b+8)	ubyte		0x22			
->>>>>>>(1.b+9)	ubyte		0xc0			
->>>>>>>>(1.b+10)	ubyte	0x74			
->>>>>>>>>(1.b+11)	ubyte	0xb			
->>>>>>>>>>(1.b+12)	ubyte	0x56			
->>>>>>>>>>(1.b+13)	ubyte	0xb4			\b, mkdosfs boot message display
+# message offset found at (1.b+5) is 0x77 for FAT32 or 0x5b for others
+>>>>(1.b+5)	ubyte&0xd3	0x53			
+>>>>>(1.b+6)	ubyte		0x7c			
+# assembler instructions: lodsb;and al,al;jz 0xb;push si;mov ah,
+>>>>>>(1.b+7)	ubyte		0xac			
+>>>>>>>(1.b+8)	ubyte		0x22			
+>>>>>>>>(1.b+9)	ubyte		0xc0			
+>>>>>>>>>(1.b+10)	ubyte	0x74			
+>>>>>>>>>>(1.b+11)	ubyte	0x0b			
+>>>>>>>>>>>(1.b+12)	ubyte	0x56			
+>>>>>>>>>>>>(1.b+13)	ubyte	0xb4			\b, mkdosfs boot message display
+# FAT1X version
+>>>>>>>>>>>>>(1.b+5)	ubyte	0x5b			
+>>>>>>>>>>>>>>0x5b	string	>\0			"%-s"
+# FAT32 version
+>>>>>>>>>>>>>(1.b+5)	ubyte	0x77			
+>>>>>>>>>>>>>>0x77	string	>\0			"%-s"
 >214	string	Please\ try\ to\ install\ FreeDOS\ 	\b, DOS Emulator boot message display
 #>>244	string	from\ dosemu-freedos-*-bin.tgz\r	
 #>>>170	string	Sorry,\ could\ not\ load\ an\ 		
@@ -694,74 +1010,26 @@
 # It just looks for a program file name at the root directory
 # and loads corresponding file with following execution.
 # DOS names like STARTUP.BIN,STARTUPC.COM,STARTUPE.EXE are 8 right space padded bytes+3 bytes
->>>>499			ubyte&0xDF	>0		\b, COM/EXE Bootloader
->>>>>499		string		x 		\b %-.1s
->>>>>>500		ubyte&0xDF	>0		
->>>>>>>500		string		x 		\b%-.1s
->>>>>>>>501		ubyte&0xDF	>0		
->>>>>>>>>501		string		x 		\b%-.1s
->>>>>>>>>>502		ubyte&0xDF	>0		
->>>>>>>>>>>502		string		x 		\b%-.1s
->>>>>>>>>>>>503		ubyte&0xDF	>0		
->>>>>>>>>>>>>503	string		x 		\b%-.1s
->>>>>>>>>>>>>>504	ubyte&0xDF	>0		
->>>>>>>>>>>>>>>504	string		x 		\b%-.1s
->>>>>>>>>>>>>>>>505	ubyte&0xDF	>0		
->>>>>>>>>>>>>>>>>505	string		x 		\b%-.1s
->>>>>>>>>>>>>>>>>>506	ubyte&0xDF	>0		
->>>>>>>>>>>>>>>>>>>506	string		x 		\b%-.1s
-#name extension
->>>>>507		ubyte&0xDF	>0		\b.
->>>>>>507		string		x 		\b%-.1s
->>>>>>>508		ubyte&0xDF	>0		
->>>>>>>>508		string		x 		\b%-.1s
->>>>>>>>>509		ubyte&0xDF	>0		
->>>>>>>>>>509		string		x 		\b%-.1s
+>>>>499			ubyte&0xDF	>0		\b, COM/EXE Bootloader 
+>>>>>499		use		DOS-filename
 #If the boot sector fails to read any other sector,
 #it prints a very short message ("RE") to the screen and hangs the computer.
 #If the boot sector fails to find needed program in the root directory,
 #it also hangs with another message ("NF").
 >>>>>492		string		RENF		\b, FAT (12 bit)
 >>>>>495		string		RENF		\b, FAT (16 bit)
-# http://alexfru.chat.ru/epm.html#bootprog
->494	ubyte	>0x4D					
->>495	string	>E					
->>>495	string	>>>3	string	BootProg				
-# It just looks for a program file name at the root directory
-# and loads corresponding file with following execution.
-# DOS names like STARTUP.BIN,STARTUPC.COM,STARTUPE.EXE are 8 right space padded bytes+3 bytes
->>>>499			ubyte&0xDF	>0		\b, COM/EXE Bootloader
->>>>>499		string		x 		\b %-.1s
->>>>>>500		ubyte&0xDF	>0		
->>>>>>>500		string		x 		\b%-.1s
->>>>>>>>501		ubyte&0xDF	>0		
->>>>>>>>>501		string		x 		\b%-.1s
->>>>>>>>>>502		ubyte&0xDF	>0		
->>>>>>>>>>>502		string		x 		\b%-.1s
->>>>>>>>>>>>503		ubyte&0xDF	>0		
->>>>>>>>>>>>>503	string		x 		\b%-.1s
->>>>>>>>>>>>>>504	ubyte&0xDF	>0		
->>>>>>>>>>>>>>>504	string		x 		\b%-.1s
->>>>>>>>>>>>>>>>505	ubyte&0xDF	>0		
->>>>>>>>>>>>>>>>>505	string		x 		\b%-.1s
->>>>>>>>>>>>>>>>>>506	ubyte&0xDF	>0		
->>>>>>>>>>>>>>>>>>>506	string		x 		\b%-.1s
-#name extension
->>>>>507		ubyte&0xDF	>0		\b.
->>>>>>507		string		x 		\b%-.1s
->>>>>>>508		ubyte&0xDF	>0		
->>>>>>>>508		string		x 		\b%-.1s
->>>>>>>>>509		ubyte&0xDF	>0		
->>>>>>>>>>509		string		x 		\b%-.1s
 #If the boot sector fails to read any other sector,
 #it prints a very short message ("RE") to the screen and hangs the computer.
-#If the boot sector fails to find needed program in the root directory,
-#it also hangs with another message ("NF").
->>>>>492		string		RENF		\b, FAT (12 bit)
->>>>>495		string		RENF		\b, FAT (16 bit)
 # x86 bootloader end
+
+# added by Joerg Jenderek at Feb 2013 according to http://thestarman.pcministry.com/asm/mbr/MSWIN41.htm#FSINFO
+# and http://en.wikipedia.org/wiki/File_Allocation_Table#FS_Information_Sector
+>0		string		RRaA		
+>>0x1E4		string		rrAa		\b, FSInfosector
+#>>0x1FC	uleshort	=0		SHOULD BE ZERO
+>>>0x1E8	ulelong		<0xffffffff	\b, %u free clusters
+>>>0x1EC	ulelong		<0xffffffff	\b, last allocated cluster %u
+
 # updated by Joerg Jenderek at Sep 2007
 >3	ubyte	0			
 #no active flag
@@ -776,149 +1044,100 @@
 >>>>>>>466	ubyte	0x05			\b, extended partition table
 >>>>>>>466	ubyte	0x0F			\b, extended partition table (LBA)
 >>>>>>>466	ubyte	0x0			\b, extended partition table (last)	
-# JuMP short     bootcodeoffset NOP assembler instructions will usually be EB xx 90
-# http://mirror.href.com/thestarman/asm/2bytejumps.htmm#FWD
-# older drives may use Near JuMP instruction E9 xx xx
->0		lelong&0x009000EB	0x009000EB 
->0		lelong&0x000000E9	0x000000E9 
-# minimal short forward jump found 03cx??
-# maximal short forward jump is 07fx
->1		ubyte			<0xff	\b, code offset 0x%x
-# mtools-3.9.8/msdos.h
-# usual values are marked with comments to get only informations of strange FAT systems
-# valid sectorsize must be a power of 2 from 32 to 32768
->>11		uleshort&0x000f	x		
->>>11		uleshort	<32769		
->>>>11		uleshort	>31		
->>>>>21		ubyte&0xf0	0xF0		
->>>>>>3		string		>\0		\b, OEM-ID "%8.8s"
-#http://mirror.href.com/thestarman/asm/debug/debug2.htm#IHC
->>>>>>>8	string		IHC		\b cached by Windows 9M
->>>>>>11	uleshort	>512		\b, Bytes/sector %u
-#>>>>>>11	uleshort	=512		\b, Bytes/sector %u=512 (usual)
->>>>>>11	uleshort	<512		\b, Bytes/sector %u
->>>>>>13	ubyte		>1		\b, sectors/cluster %u
-#>>>>>>13	ubyte		=1		\b, sectors/cluster %u (usual on Floppies)
->>>>>>14	uleshort	>32		\b, reserved sectors %u
-#>>>>>>14	uleshort	=32		\b, reserved sectors %u (usual Fat32)
-#>>>>>>14	uleshort	>1		\b, reserved sectors %u
-#>>>>>>14	uleshort	=1		\b, reserved sectors %u (usual FAT12,FAT16)
->>>>>>14	uleshort	<1		\b, reserved sectors %u
->>>>>>16	ubyte		>2		\b, FATs %u
-#>>>>>>16	ubyte		=2		\b, FATs %u (usual)
->>>>>>16	ubyte		=1		\b, FAT  %u
->>>>>>16	ubyte		>0
->>>>>>17	uleshort	>0		\b, root entries %u
-#>>>>>>17	uleshort	=0		\b, root entries %u=0 (usual Fat32)
->>>>>>19	uleshort	>0		\b, sectors %u (volumes <=32 MB) 
-#>>>>>>19	uleshort	=0		\b, sectors %u=0 (usual Fat32)
->>>>>>21	ubyte		>0xF0		\b, Media descriptor 0x%x
-#>>>>>>21	ubyte		=0xF0		\b, Media descriptor 0x%x (usual floppy)
->>>>>>21	ubyte		<0xF0		\b, Media descriptor 0x%x
->>>>>>22	uleshort	>0		\b, sectors/FAT %u
-#>>>>>>22	uleshort	=0		\b, sectors/FAT %u=0 (usual Fat32)
->>>>>>26	ubyte		>2		\b, heads %u
-#>>>>>>26	ubyte		=2		\b, heads %u (usual floppy)
->>>>>>26	ubyte		=1		\b, heads %u
-#skip for Digital Research DOS (version 3.41) 1440 kB Bootdisk
->>>>>>38	ubyte		!0x70		
->>>>>>>28	ulelong		>0		\b, hidden sectors %u
-#>>>>>>>28	ulelong		=0		\b, hidden sectors %u (usual floppy)
->>>>>>>32	ulelong		>0		\b, sectors %u (volumes > 32 MB) 
-#>>>>>>>32	ulelong		=0		\b, sectors %u (volumes > 32 MB)
-# FAT<32 specific 
->>>>>>82	string		!FAT32
-#>>>>>>>36	ubyte		0x80		\b, physical drive 0x%x=0x80 (usual harddisk)
-#>>>>>>>36	ubyte		0		\b, physical drive 0x%x=0 (usual floppy)
->>>>>>>36	ubyte		!0x80		
->>>>>>>>36	ubyte		!0		\b, physical drive 0x%x
->>>>>>>37	ubyte		>0		\b, reserved 0x%x
-#>>>>>>>37	ubyte		=0		\b, reserved 0x%x
->>>>>>>38	ubyte		>0x29		\b, dos < 4.0 BootSector (0x%x)
->>>>>>>38	ubyte		<0x29		\b, dos < 4.0 BootSector (0x%x)
->>>>>>>38	ubyte		=0x29
->>>>>>>>39	ulelong		x		\b, serial number 0x%x
->>>>>>>>43	string		>>>>>>>43	string		>NO\ NAME	\b, label: "%11.11s"
->>>>>>>>43	string		=NO\ NAME	\b, unlabeled
->>>>>>>54	string		FAT		\b, FAT
->>>>>>>>54	string		FAT12		\b (12 bit)
->>>>>>>>54	string		FAT16		\b (16 bit)
-# FAT32 specific
->>>>>>82	string		FAT32		\b, FAT (32 bit)
->>>>>>>36	ulelong		x		\b, sectors/FAT %u
->>>>>>>40	uleshort	>0		\b, extension flags %u
-#>>>>>>>40	uleshort	=0		\b, extension flags %u
->>>>>>>42	uleshort	>0		\b, fsVersion %u
-#>>>>>>>42	uleshort	=0		\b, fsVersion %u (usual)
->>>>>>>44	ulelong		>2		\b, rootdir cluster %u
-#>>>>>>>44	ulelong		=2		\b, rootdir cluster %u
-#>>>>>>>44	ulelong		=1		\b, rootdir cluster %u
->>>>>>>48	uleshort	>1		\b, infoSector %u
-#>>>>>>>48	uleshort	=1		\b, infoSector %u (usual)
->>>>>>>48	uleshort	<1		\b, infoSector %u
->>>>>>>50	uleshort	>6		\b, Backup boot sector %u
-#>>>>>>>50	uleshort	=6		\b, Backup boot sector %u (usual) 
->>>>>>>50	uleshort	<6		\b, Backup boot sector %u
->>>>>>>54	ulelong		>0		\b, reserved1 0x%x
->>>>>>>58	ulelong		>0		\b, reserved2 0x%x
->>>>>>>62	ulelong		>0		\b, reserved3 0x%x
-# same structure as FAT1X 
->>>>>>>64	ubyte		>0x80		\b, physical drive 0x%x
-#>>>>>>>64	ubyte		=0x80		\b, physical drive 0x%x=80 (usual harddisk)
->>>>>>>64	ubyte&0x7F	>0		\b, physical drive 0x%x
-#>>>>>>>64	ubyte		=0		\b, physical drive 0x%x=0 (usual floppy)
->>>>>>>65	ubyte		>0		\b, reserved 0x%x
->>>>>>>66	ubyte		>0x29		\b, dos < 4.0 BootSector (0x%x)
->>>>>>>66	ubyte		<0x29		\b, dos < 4.0 BootSector (0x%x)
->>>>>>>66	ubyte		=0x29
->>>>>>>>67	ulelong		x		\b, serial number 0x%x
->>>>>>>>71	string		>>>>>>71	string		>NO\ NAME	\b, label: "%11.11s"
->>>>>>>71	string		=NO\ NAME	\b, unlabeled
-### FATs end
+
+# DOS x86 sector separated and moved from "DOS/MBR boot sector" by Joerg Jenderek at May 2011
+
 >0x200	lelong	0x82564557		\b, BSD disklabel
+
+# by Joerg Jenderek at Apr 2013
+#	Print the DOS filenames from directory entry form with 8 right space padded bytes + 3 bytes for extension
+#	like IO.SYS. MSDOS.SYS , KERNEL.SYS , DRBIO.SYS
+0	name			DOS-filename
+# space=0x20 (00100000b) means empty 
+>0			ubyte&0xDF	>0		
+>>0			ubyte		x 		\b%c
+>>>1			ubyte&0xDF	>0		
+>>>>1			ubyte		x 		\b%c
+>>>>>2			ubyte&0xDF	>0		
+>>>>>>2			ubyte		x 		\b%c
+>>>>>>>3		ubyte&0xDF	>0		
+>>>>>>>>3		ubyte		x 		\b%c
+>>>>>>>>>4		ubyte&0xDF	>0		
+>>>>>>>>>>4		ubyte		x 		\b%c
+>>>>>>>>>>>5		ubyte&0xDF	>0		
+>>>>>>>>>>>>5		ubyte		x 		\b%c
+>>>>>>>>>>>>>6		ubyte&0xDF	>0		
+>>>>>>>>>>>>>>6		ubyte		x 		\b%c
+>>>>>>>>>>>>>>>7	ubyte&0xDF	>0		
+>>>>>>>>>>>>>>>>7	ubyte		x 		\b%c
+# DOS filename extension
+>>8			ubyte&0xDF	>0		\b.
+>>>8			ubyte		x 		\b%c
+>>>>9			ubyte&0xDF	>0		
+>>>>>9			ubyte		x 		\b%c
+>>>>>>10		ubyte&0xDF	>0		
+>>>>>>>10		ubyte		x 		\b%c
+#	Print 2 following DOS filenames from directory entry form
+#	like IO.SYS+MSDOS.SYS or ibmbio.com+ibmdos.com
+0	name			2xDOS-filename
+# display 1 space
+>0			ubyte		x		\b 
+>0			use		DOS-filename
+>11			ubyte		x		\b+
+>11			use		DOS-filename
+
+# http://en.wikipedia.org/wiki/Master_boot_record#PTE
+# display standard partition table
+0	name				partition-table
+#>0		ubyte		x	PARTITION-TABLE
+# test and display 1st til 4th partition table entry
+>0		use			partition-entry-test
+>16		use			partition-entry-test
+>32		use			partition-entry-test
+>48		use			partition-entry-test
+#		test for entry of partition table
+0	name				partition-entry-test
+# partition type ID > 0
+>4		ubyte		>0
+# active flag 0
+>>0		ubyte		0	
+>>>0		use		partition-entry
+# active flag 0x80, 0x81, ... 
+>>0		ubyte		>0x7F	
+>>>0		use		partition-entry
+#		Print entry of partition table
+0	name				partition-entry
+# partition type ID > 0
+>4		ubyte		>0	\b; partition
+>>64		leshort		0xAA55	1
+>>48		leshort		0xAA55	2
+>>32		leshort		0xAA55	3
+>>16		leshort		0xAA55	4
+>>4		ubyte		x	: ID=0x%x
+>>0		ubyte&0x80	0x80	\b, active
+>>0		ubyte		>0x80	0x%x
+>>1		ubyte		x	\b, start-CHS (
+>>1		use		partition-chs
+>>5		ubyte		x	\b), end-CHS (
+>>5		use		partition-chs
+>>8		ulelong		x	\b), startsector %u
+>>12		ulelong		x	\b, %u sectors
+#		Print cylinder,head,sector (CHS) of partition entry
+0	name				partition-chs
+# cylinder
+>1		ubyte		x	\b0x
+>1		ubyte&0xC0	0x40	\b1
+>1		ubyte&0xC0	0x80	\b2
+>1		ubyte&0xC0	0xC0	\b3
+>2		ubyte		x	\b%x
+# head
+>0		ubyte		x	\b,%u
+# sector
+>1		ubyte&0x3F	x	\b,%u
+
 # FATX 
 0		string		FATX		FATX filesystem data
 
-
-# Minix filesystems - Juan Cespedes 
-0x410	leshort		0x137f
-!:strength / 2
->0x402	beshort		< 100		Minix filesystem, V1, %d zones
->0x1e	string		minix		\b, bootable
-0x410	beshort		0x137f
-!:strength / 2
->0x402	beshort		< 100		Minix filesystem, V1 (big endian), %d zones
->0x1e	string		minix		\b, bootable
-0x410	leshort		0x138f
-!:strength / 2
->0x402	beshort		< 100		Minix filesystem, V1, 30 char names, %d zones
->0x1e	string		minix		\b, bootable
-0x410	beshort		0x138f
-!:strength / 2
->0x402	beshort		< 100		Minix filesystem, V1, 30 char names (big endian), %d zones
->0x1e	string		minix		\b, bootable
-0x410	leshort		0x2468
->0x402	beshort		< 100		Minix filesystem, V2, %d zones
->0x1e	string		minix		\b, bootable
-0x410	beshort		0x2468
->0x402	beshort		< 100		Minix filesystem, V2 (big endian), %d zones
->0x1e	string		minix		\b, bootable
-
-0x410	leshort		0x2478
->0x402	beshort		< 100		Minix filesystem, V2, 30 char names, %d zones
->0x1e	string		minix		\b, bootable
-0x410	leshort		0x2478
->0x402	beshort		< 100		Minix filesystem, V2, 30 char names, %d zones
->0x1e	string		minix		\b, bootable
-0x410	beshort		0x2478
->0x402	beshort		!0		Minix filesystem, V2, 30 char names (big endian), %d zones
->0x1e	string		minix		\b, bootable
-0x410	leshort		0x4d5a
->0x402	beshort		!0		Minix filesystem, V3, %d zones
->0x1e	string		minix		\b, bootable
-
 # romfs filesystems - Juan Cespedes 
 0	string		-rom1fs-	romfs filesystem, version 1
 >8	belong	x			%d bytes,
@@ -933,12 +1152,143 @@
 
 0x18b	string	OS/2	OS/2 Boot Manager
 
-# updated by Joerg Jenderek at Oct 2008!!
+# updated by Joerg Jenderek at Oct 2008 and Sep 2012
 # http://syslinux.zytor.com/iso.php
-0	ulelong	0x7c40eafa		isolinux Loader
+# tested with versions 1.47,1.48,1.49,1.50,1.62,1.76,2.00,2.10;3.00,3.11,3.31,;3.70,3.71,3.73,3.75,3.80,3.82,3.84,3.86,4.01,4.03 and 4.05
+# assembler instructions: cli;jmp 0:7Cyy (yy=0x40,0x5e,0x6c,0x6e,0x77);nop;nop
+0	ulequad&0x909000007cc0eafa	0x909000007c40eafa	
+>631	search/689	ISOLINUX\ 	isolinux Loader
+>>&0	string		x		(version %-4.4s)
 # http://syslinux.zytor.com/pxe.php
-0	ulelong	0x007c05ea		pxelinux Loader
-0	ulelong	0x60669c66		pxelinux Loader
+# assembler instructions: jmp 7C05
+0	ulelong	0x007c05ea		pxelinux loader (version 2.13 or older)
+# assembler instructions: pushfd;pushad
+0	ulelong	0x60669c66		pxelinux loader
+# assembler instructions: jmp 05
+0	ulelong	0xc00005ea		pxelinux loader (version 3.70 or newer)
+# http://syslinux.zytor.com/wiki/index.php/SYSLINUX
+0	string	LDLINUX\ SYS\ 		SYSLINUX loader
+>12	string	x			(older version %-4.4s)
+0	string	\r\nSYSLINUX\ 		SYSLINUX loader
+>11	string	x			(version %-4.4s)
+# syslinux updated and separated from "DOS/MBR boot sector" by Joerg Jenderek at Sep 2012
+# assembler instructions: jmp yy (yy=0x3c,0x58);nop;"SYSLINUX"
+0	ulelong&0x80909bEB	0x009018EB	
+# OEM-ID not always "SYSLINUX"
+>434	search/47	Boot\ failed		
+# followed by \r\n\0 or :\ 
+>>482	search/132	\0LDLINUX\ SYS		Syslinux bootloader (version 2.13 or older)
+>>1	ubyte		0x58			Syslinux bootloader (version 3.0-3.9)
+>459	search/30	Boot\ error\r\n\0	
+>>1	ubyte		0x58			Syslinux bootloader (version 3.10 or newer)
+# SYSLINUX MBR updated and separated from "DOS/MBR boot sector" by Joerg Jenderek at Sep 2012
+# assembler instructions: mov di,0600h;mov cx,0100h
+16	search/4	\xbf\x00\x06\xb9\x00\x01		
+# to display SYSLINUX MBR (36) before old DOS/MBR boot sector one with partition table (strength=50+21)
+!:strength +36
+>94	search/249	Missing\ operating\ system		
+# followed by \r for versions older 3.35 , .\r for versions newer 3.52 and point for other
+# skip Ranish MBR
+>>408	search/4	HD1/\0	 				
+>>408	default		x					
+>>>250	search/118	\0Operating\ system\ load		SYSLINUX MBR
+# followed by "ing " or space
+>>>>292	search/98	error   				
+>>>>>&0	string		\r		    			(version 3.35 or older)
+>>>>>&0	string		.\r					(version 3.52 or newer)
+>>>>>&0	default		x					(version 3.36-3.51 )
+>368	search/106	\0Disk\ error\ on\ boot\r\n		SYSLINUX GPT-MBR
+>>156	search/10	\0Boot\ partition\ not\ found\r\n	
+>>>270	search/10	\0OS\ not\ bootable\r\n			(version 3.86 or older)
+>>174	search/10	\0Missing\ OS\r\n			
+>>>189	search/10	\0Multiple\ active\ partitions\r\n	(version 4.00 or newer)
+# SYSLINUX END
+
+# NetBSD mbr variants (master-boot-code version 1.22) added by Joerg Jenderek at Nov 2012
+# assembler instructions: xor ax,ax;mov	ax,ss;mov sp,0x7c00;mov	ax,
+0	ubequad		0x31c08ed0bc007c8e			
+# mbr_bootsel magic before partition table not reliable with small ipl fragments
+#>444	uleshort	0xb5e1					
+>0004	uleshort	x					
+# ERRorTeXT
+>>181	search/166		Error\ \0\r\n				NetBSD mbr
+# NT Drive Serial Number http://thestarman.pcministry.com/asm/mbr/Win2kmbr.htm#DS
+>>>0x1B8	ubelong		>0					\b,Serial 0x%-.8x
+# BOOTSEL definitions contains assembler instructions: int 0x13;pop dx;push dx;push dx
+>>>0xbb		search/71	\xcd\x13\x5a\x52\x52			\b,bootselector
+# BOOT_EXTENDED definitions contains assembler instructions: 
+# xchg ecx,edx;addl ecx,edx;movw lba_info,si;movb 0x42,ah;pop dx;push dx;int 0x13
+>>>0x96	search/1	\x66\x87\xca\x66\x01\xca\x66\x89\x16\x3a\x07\xbe\x32\x07\xb4\x42\x5a\x52\xcd\x13	\b,boot extended
+# COM_PORT_VAL definitions contains assembler instructions: outb al,dx;add 5,dl;inb %dx;test 0x40,al
+>>>0x130	search/55	\xee\x80\xc2\x05\xec\xa8\x40		\b,serial IO
+# not TERSE_ERROR
+>>>196		search/106	No\ active\ partition\0			
+>>>>&0		string		Disk\ read\ error\0			
+>>>>>&0		string		No\ operating\ system\0			\b,verbose
+# not NO_CHS definitions contains assembler instructions: pop dx;push dx;movb $8,ah;int0x13
+>>>0x7d		search/7	\x5a\x52\xb4\x08\xcd\x13		\b,CHS
+# not NO_LBA_CHECK definitions contains assembler instructions: movw 0x55aa,bx;movb 0x41,ah;pop	dx;push	dx;int 0x13
+>>>0xa4		search/84	\xbb\xaa\x55\xb4\x41\x5a\x52\xcd\x13	\b,LBA-check
+# assembler instructions: movw nametab,bx
+>>>0x26	    search/21	\xBB\x94\x07					
+# not NO_BANNER definitions contains assembler instructions: mov banner,si;call message_crlf
+>>>>&-9	ubequad&0xBE00f0E800febb94	0xBE0000E80000bb94		
+>>>>>181	search/166		Error\ \0			
+# "a: disk" , "Fn: diskn" or "NetBSD MBR boot"
+>>>>>>&3	string			x				\b,"%s"
+# Andrea Mazzoleni AdvanceCD mbr loader of http://advancemame.sourceforge.net/boot-readme.html
+# added by Joerg Jenderek at Nov 2012 for versions 1.3 - 1.4
+# assembler instructions: jmp short 0x58;nop;ASCII
+0	ubequad&0xeb58908000000000	0xeb58900000000000	
+# assembler instructions: cli;xor ax,ax;mov ds,ax;mov es,ax;mov ss,
+>(1.b+2)	ubequad			0xfa31c08ed88ec08e	
+# Error messages at end of code
+>>376		string	No\ operating\ system\r\n\0		
+>>>398		string	Disk\ error\r\n\0FDD\0HDD\0		
+>>>>419		string	\ EBIOS\r\n\0				AdvanceMAME mbr
+
+# Neil Turton mbr loader variant of http://www.chiark.greenend.org.uk/~neilt/mbr/ 
+# added by Joerg Jenderek at Mar 2011 for versions 1.0.0 - 1.1.11
+# for 1st version assembler instructions:	cld;xor ax,ax;mov DS,ax;MOV ES,AX;mov SI,
+# or  	  	  	    			cld;xor ax,ax;mov SS,ax;XOR SP,SP;mov DS,
+0	ulequad&0xcE1b40D48EC031FC	0x8E0000D08EC031FC	
+# pointer to the data starting with Neil Turton signature string
+>(0x1BC.s)		string		NDTmbr			
+>>&-14			string		1234F\0			Turton mbr (
+# parameters also viewed by install-mbr --list
+>>>(0x1BC.s+7)		ubyte		x			\b%u<=
+>>>(0x1BC.s+9)		ubyte		x			\bVersion<=%u
+#>>>(0x1BC.s+8)		ubyte		x			asm_flag_%x
+>>>(0x1BC.s+8)		ubyte&1		1			\b,Y2K-Fix
+# variant used by testdisk of http://www.cgsecurity.org/wiki/Menu_MBRCode
+>>>(0x1BC.s+8)		ubyte&2		2			\b,TestDisk
+#0x1~1,..,0x8~4,0x10~F,0x80~A enabled
+#>>>(0x1BC.s+10)		ubyte		x			\b,flags 0x%x
+#0x0~1,0x1~2,...,0x3~4,0x4~F,0x7~D default boot
+#>>>(0x1BC.s+11)		ubyte		x			\b,cfg_def 0x%x
+# for older versions
+>>>(0x1BC.s+9)		ubyte		<2			
+#>>>>(0x1BC.s+12)	ubyte		18			\b,%hhu/18 seconds
+>>>>(0x1BC.s+12)	ubyte		!18			\b,%u/18 seconds
+# floppy A: or B:
+>>>>(0x1BC.s+13)	ubyte		<2			\b,floppy 0x%x
+>>>>(0x1BC.s+13)	ubyte		>1			
+# 1st hard disc
+#>>>>>(0x1BC.s+13)	ubyte		0x80			\b,drive 0x%x
+# not 1st hard disc
+>>>>>(0x1BC.s+13)	ubyte		!0x80			\b,drive 0x%x
+# for version >= 2 maximal timeout can be 65534
+>>>(0x1BC.s+9)		ubyte		>1			
+#>>>>(0x1BC.s+12)	uleshort	18			\b,%u/18 seconds
+>>>>(0x1BC.s+12)	uleshort	!18			\b,%u/18 seconds
+# floppy A: or B:
+>>>>(0x1BC.s+14)	ubyte		<2			\b,floppy 0x%x
+>>>>(0x1BC.s+14)	ubyte		>1			
+# 1st hard disc
+#>>>>>(0x1BC.s+14)	ubyte		0x80			\b,drive 0x%x
+# not 1st hard disc
+>>>>>(0x1BC.s+14)	ubyte		!0x80			\b,drive 0x%x
+>>>0	ubyte		x					\b)
 
 # added by Joerg Jenderek
 # In the second sector (+0x200) are variables according to grub-0.97/stage2/asm.S or
@@ -961,7 +1311,7 @@
 >>>>0x207	ubyte		x		\b.%u
 # module_size for 1.94
 >>>>0x208	ulelong		<0xffffff	\b, installed partition %u
-#>>>>0x208	ulelong		=0xffffff	\b, %u (default)
+#>>>>0x208	ulelong		=0xffffff	\b, %lu (default)
 >>>>0x208	ulelong		>0xffffff	\b, installed partition %u
 # GRUB 0.5.95 unofficial
 >>>>0x20C	ulelong&0x2E300000 0x2E300000	
@@ -995,6 +1345,178 @@
 >>>>>0x217 	ulong		!0xffffffff	
 >>>>>>0x217 	string		>\0		\b, configuration file %-s
 
+# DOS x86 sector updated and separated from "DOS/MBR boot sector" by Joerg Jenderek at May 2011
+# JuMP short     bootcodeoffset NOP assembler instructions will usually be EB xx 90
+# over BIOS parameter block (BPB)
+# http://thestarman.pcministry.com/asm/2bytejumps.htm#FWD
+# older drives may use Near JuMP instruction E9 xx xx
+# minimal short forward jump found 0x29 for bootloaders or 0x0
+# maximal short forward jump is 0x7f
+# OEM-ID is empty or contain readable bytes
+0		ulelong&0x804000E9	0x000000E9	
+# mtools-3.9.8/msdos.h
+# usual values are marked with comments to get only informations of strange FAT systems
+# valid sectorsize must be a power of 2 from 32 to 32768
+>11		uleshort&0xf001f	0	
+>>11		uleshort	<32769		
+>>>11		uleshort	>31		
+>>>>21		ubyte&0xf0	0xF0		
+>>>>>0		ubyte		0xEB		
+>>>>>>1		ubyte		x		\b, code offset 0x%x+2
+>>>>>0		ubyte		0xE9		
+>>>>>>1		uleshort	x		\b, code offset 0x%x+2
+>>>>>3		string		>\0		\b, OEM-ID "%-.8s"
+#http://mirror.href.com/thestarman/asm/debug/debug2.htm#IHC
+>>>>>>8		string		IHC		\b cached by Windows 9M
+>>>>>11		uleshort	>512		\b, Bytes/sector %u
+#>>>>>11	uleshort	=512		\b, Bytes/sector %u=512 (usual)
+>>>>>11		uleshort	<512		\b, Bytes/sector %u
+>>>>>13		ubyte		>1		\b, sectors/cluster %u
+#>>>>>13	ubyte		=1		\b, sectors/cluster %u (usual on Floppies)
+>>>>>82		string		FAT32		
+>>>>>>14	uleshort	!32		\b, reserved sectors %u
+#>>>>>>14	uleshort	=32		\b, reserved sectors %u (usual Fat32)
+>>>>>82		string		!FAT32		
+>>>>>>14	uleshort	>1		\b, reserved sectors %u
+#>>>>>>14	uleshort	=1		\b, reserved sectors %u (usual FAT12,FAT16)
+#>>>>>>14	uleshort	0		\b, reserved sectors %u (usual NTFS)
+>>>>>16		ubyte		>2		\b, FATs %u
+#>>>>>16	ubyte		=2		\b, FATs %u (usual)
+>>>>>16		ubyte		=1		\b, FAT  %u
+>>>>>16		ubyte		>0
+>>>>>17		uleshort	>0		\b, root entries %u
+#>>>>>17	uleshort	=0		\b, root entries %hu=0 (usual Fat32)
+>>>>>19		uleshort	>0		\b, sectors %u (volumes <=32 MB) 
+#>>>>>19	uleshort	=0		\b, sectors %hu=0 (usual Fat32)
+>>>>>21		ubyte		>0xF0		\b, Media descriptor 0x%x
+#>>>>>21	ubyte		=0xF0		\b, Media descriptor 0x%x (usual floppy)
+>>>>>21		ubyte		<0xF0		\b, Media descriptor 0x%x
+>>>>>22		uleshort	>0		\b, sectors/FAT %u
+#>>>>>22	uleshort	=0		\b, sectors/FAT %hu=0 (usual Fat32)
+>>>>>24		uleshort	x		\b, sectors/track %u
+>>>>>26		ubyte		>2		\b, heads %u
+#>>>>>26	ubyte		=2		\b, heads %u (usual floppy)
+>>>>>26		ubyte		=1		\b, heads %u
+# valid only for sector sizes with more then 32 Bytes
+>>>>>11		uleshort	>32		
+# skip for Digital Research DOS (version 3.41) 1440 kB Bootdisk
+>>>>>>38	ubyte		!0x70		
+>>>>>>>28	ulelong		>0		\b, hidden sectors %u
+#>>>>>>>28	ulelong		=0		\b, hidden sectors %u (usual floppy)
+>>>>>>>32	ulelong		>0		\b, sectors %u (volumes > 32 MB) 
+#>>>>>>>32	ulelong		=0		\b, sectors %u (volumes > 32 MB)
+# FAT<32 bit specific 
+>>>>>>>82	string		!FAT32
+#>>>>>>>>36	ubyte		0x80		\b, physical drive 0x%x=0x80 (usual harddisk)
+#>>>>>>>>36	ubyte		0		\b, physical drive 0x%x=0 (usual floppy)
+>>>>>>>>36	ubyte		!0x80		
+>>>>>>>>>36	ubyte		!0		\b, physical drive 0x%x
+>>>>>>>>37	ubyte		>0		\b, reserved 0x%x
+#>>>>>>>>37	ubyte		=0		\b, reserved 0x%x
+# value is 0x80 for NTFS
+>>>>>>>>38	ubyte		!0x29		\b, dos < 4.0 BootSector (0x%x)
+>>>>>>>>38	ubyte		=0x29
+>>>>>>>>>39	ulelong		x		\b, serial number 0x%x
+>>>>>>>>>43	string		>>>>>>>>43	string		>NO\ NAME	\b, label: "%11.11s"
+>>>>>>>>>43	string		=NO\ NAME	\b, unlabeled
+# there exist some old floppies without word FAT at offset 54
+# a word like "FATnm   " is only a hint for a FAT size on nm-bits
+# Normally the number of clusters is calculated by the values of BPP.
+# if it is small enough FAT is 12 bit, if it is too big enough FAT is 32 bit,
+# otherwise FAT is 16 bit.
+# http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-fat-widths.html
+>>>>>>54	string		FAT		\b, FAT
+>>>>>>>54	string		FAT12		\b (12 bit)
+>>>>>>>54	string		FAT16		\b (16 bit)
+# FAT32 bit specific
+>>>>>82		string		FAT32		\b, FAT (32 bit)
+>>>>>>36	ulelong		x		\b, sectors/FAT %u
+# http://technet.microsoft.com/en-us/library/cc977221.aspx
+>>>>>>40	uleshort	>0		\b, extension flags 0x%x
+#>>>>>>40	uleshort	=0		\b, extension flags %hu
+>>>>>>42	uleshort	>0		\b, fsVersion %u
+#>>>>>>42	uleshort	=0		\b, fsVersion %u (usual)
+>>>>>>44	ulelong		>2		\b, rootdir cluster %u
+#>>>>>>44	ulelong		=2		\b, rootdir cluster %u
+#>>>>>>44	ulelong		=1		\b, rootdir cluster %u
+>>>>>>48	uleshort	>1		\b, infoSector %u
+#>>>>>>48	uleshort	=1		\b, infoSector %u (usual)
+>>>>>>48	uleshort	<1		\b, infoSector %u
+>>>>>>50	uleshort	>6		\b, Backup boot sector %u
+#>>>>>>50	uleshort	=6		\b, Backup boot sector %u (usual) 
+>>>>>>50	uleshort	<6		\b, Backup boot sector %u
+# corrected by Joerg Jenderek at Feb 2011 according to http://thestarman.pcministry.com/asm/mbr/MSWIN41.htm#FSINFO
+>>>>>>52	ulelong		>0		\b, reserved1 0x%x
+>>>>>>56	ulelong		>0		\b, reserved2 0x%x
+>>>>>>60	ulelong		>0		\b, reserved3 0x%x
+# same structure as FAT1X 
+#>>>>>>64	ubyte		=0x80		\b, physical drive 0x%x=80 (usual harddisk)
+#>>>>>>64	ubyte		=0		\b, physical drive 0x%x=0 (usual floppy)
+>>>>>>64	ubyte		!0x80		
+>>>>>>>64	ubyte		>0		\b, physical drive 0x%x
+# in Windows NT bit 0 is a dirty flag to request chkdsk at boot time. bit 1 requests surface scan too
+>>>>>>65	ubyte		>0		\b, reserved 0x%x
+>>>>>>66	ubyte		!0x29		\b, dos < 4.0 BootSector (0x%x)
+>>>>>>66	ubyte		=0x29
+>>>>>>>67	ulelong		x		\b, serial number 0x%x
+>>>>>>>71	string		>>>>>>71	string		>NO\ NAME	\b, label: "%11.11s"
+>>>>>>>71	string		=NO\ NAME	\b, unlabeled
+# additional tests for floppy image added by Joerg Jenderek
+# no fixed disk 
+>>>>>21		ubyte		!0xF8		
+# floppy media with 12 bit FAT
+>>>>>>54	string		!FAT16		
+# test for FAT after bootsector
+>>>>>>>(11.s)	ulelong&0x00ffffF0	0x00ffffF0	\b, followed by FAT
+# floppy image
+!:mime application/x-ima
+# NTFS specific added by Joerg Jenderek at Mar 2011 according to http://thestarman.pcministry.com/asm/mbr/NTFSBR.htm
+# and http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/bios-parameter-block.html
+# 0 FATs
+>>>>>16	ubyte		=0		
+# 0 root entries
+>>>>>>17	uleshort	=0		
+# 0 DOS sectors
+>>>>>>>19	uleshort	=0		
+# 0 sectors/FAT
+# dos < 4.0 BootSector value found is 0x80
+#38	ubyte		=0x80			\b, dos < 4.0 BootSector (0x%x)
+>>>>>>>>22	uleshort	=0		\b; NTFS
+>>>>>>>>>24	uleshort	>0		\b, sectors/track %u
+>>>>>>>>>36	ulelong		!0x800080	\b, physical drive 0x%x
+>>>>>>>>>40	ulequad		>0		\b, sectors %lld
+>>>>>>>>>48	ulequad		>0		\b, $MFT start cluster %lld
+>>>>>>>>>56	ulequad		>0		\b, $MFTMirror start cluster %lld
+# Values 0 to 127 represent MFT record sizes of 0 to 127 clusters.
+# Values 128 to 255 represent MFT record sizes of 2^(256-N) bytes. 
+>>>>>>>>>64	lelong		<256		
+>>>>>>>>>>64	lelong		<128		\b, clusters/RecordSegment %d
+>>>>>>>>>>64	ubyte		>127		\b, bytes/RecordSegment 2^(-1*%i)
+# Values 0 to 127 represent index block sizes of 0 to 127 clusters.
+# Values 128 to 255 represent index block sizes of 2^(256-N) byte
+>>>>>>>>>68	ulelong		<256		
+>>>>>>>>>>68	ulelong		<128		\b, clusters/index block %d
+#>>>>>>>>>>68	ulelong		>127		\b, bytes/index block 2^(256-%d)
+>>>>>>>>>>68	ubyte		>127		\b, bytes/index block 2^(-1*%i)
+>>>>>>>>>72	ulequad		x		\b, serial number 0%llx
+>>>>>>>>>80	ulelong		>0		\b, checksum 0x%x
+#>>>>>>>>>80	ulelong		=0		\b, checksum 0x%x=0 (usual)
+>>>>>>>>>0x258	ulelong&0x00009090	=0x00009090	
+>>>>>>>>>>&-92		indirect	x	\b; contains 
+# For 2nd NTFS sector added by Joerg Jenderek at Jan 2013
+# http://thestarman.pcministry.com/asm/mbr/NTFSbrHexEd.htm
+# unused assembler instructions JMP y2;NOP;NOP
+0x056		ulelong&0xFFFF0FFF	0x909002EB	
+# unicode loadername terminated by CTRL-D
+>(0.s*2)	ulelong&0xFFFFFF00	0x00040000		
+# loadernames are NTLDR,CMLDR,PELDR,$LDR$ or BOOTMGR
+>>0x002		lestring16	x	Microsoft Windows XP/VISTA bootloader %-5.5s
+>>0x12		string		$	
+>>>0x0c		lestring16	x	\b%-2.2s
+### DOS,NTFS boot sectors end
+
 9564	lelong		0x00011954	Unix Fast File system [v1] (little-endian),
 >8404	string		x		last mounted on %s,
 #>9504	ledate		x		last checked at %s,
@@ -1025,7 +1547,7 @@
 >&-180	lelong		x		average file size %d,
 >&-176	lelong		x		average number of files in dir %d,
 >&-272	lequad		x		pending blocks to free %lld,
->&-264	lelong		x		pending inodes to free %ld,
+>&-264	lelong		x		pending inodes to free %d,
 >&-664	lequad		x		system-wide uuid %0llx,
 >&-1316	lelong		x		minimum percentage of free blocks %d,
 >&-1248	lelong		0		TIME optimization
@@ -1045,7 +1567,7 @@
 >&-180	lelong		x		average file size %d,
 >&-176	lelong		x		average number of files in dir %d,
 >&-272	lequad		x		pending blocks to free %lld,
->&-264	lelong		x		pending inodes to free %ld,
+>&-264	lelong		x		pending inodes to free %d,
 >&-664	lequad		x		system-wide uuid %0llx,
 >&-1316	lelong		x		minimum percentage of free blocks %d,
 >&-1248	lelong		0		TIME optimization
@@ -1085,7 +1607,7 @@
 >&-180	belong		x		average file size %d,
 >&-176	belong		x		average number of files in dir %d,
 >&-272	bequad		x		pending blocks to free %lld,
->&-264	belong		x		pending inodes to free %ld,
+>&-264	belong		x		pending inodes to free %d,
 >&-664	bequad		x		system-wide uuid %0llx,
 >&-1316	belong		x		minimum percentage of free blocks %d,
 >&-1248	belong		0		TIME optimization
@@ -1105,7 +1627,7 @@
 >&-180	belong		x		average file size %d,
 >&-176	belong		x		average number of files in dir %d,
 >&-272	bequad		x		pending blocks to free %lld,
->&-264	belong		x		pending inodes to free %ld,
+>&-264	belong		x		pending inodes to free %d,
 >&-664	bequad		x		system-wide uuid %0llx,
 >&-1316	belong		x		minimum percentage of free blocks %d,
 >&-1248	belong		0		TIME optimization
@@ -1157,6 +1679,51 @@
 #>0x464	lelong          &0x0000020      (many subdirs)
 #>0x463	lelong          &0x0000040      (extra isize)
 
+# Minix filesystems - Juan Cespedes 
+0x410	leshort		0x137f
+!:strength / 2
+>0x402	beshort		< 100
+>0x402	beshort		> -1		Minix filesystem, V1, %d zones
+>0x1e	string		minix		\b, bootable
+0x410	beshort		0x137f
+!:strength / 2
+>0x402	beshort		< 100
+>0x402	beshort		> -1		Minix filesystem, V1 (big endian), %d zones
+>0x1e	string		minix		\b, bootable
+0x410	leshort		0x138f
+!:strength / 2
+>0x402	beshort		< 100
+>0x402	beshort		> -1		Minix filesystem, V1, 30 char names, %d zones
+>0x1e	string		minix		\b, bootable
+0x410	beshort		0x138f
+!:strength / 2
+>0x402	beshort		< 100
+>0x402	beshort		> -1		Minix filesystem, V1, 30 char names (big endian), %d zones
+>0x1e	string		minix		\b, bootable
+0x410	leshort		0x2468
+>0x402	beshort		< 100
+>>0x402	beshort		> -1		Minix filesystem, V2, %d zones
+>0x1e	string		minix		\b, bootable
+0x410	beshort		0x2468
+>0x402	beshort		< 100
+>0x402	beshort		> -1		Minix filesystem, V2 (big endian), %d zones
+>0x1e	string		minix		\b, bootable
+
+0x410	leshort		0x2478
+>0x402	beshort		< 100
+>0x402	beshort		> -1		Minix filesystem, V2, 30 char names, %d zones
+>0x1e	string		minix		\b, bootable
+0x410	leshort		0x2478
+>0x402	beshort		< 100
+>0x402	beshort		> -1		Minix filesystem, V2, 30 char names, %d zones
+>0x1e	string		minix		\b, bootable
+0x410	beshort		0x2478
+>0x402	beshort		!0		Minix filesystem, V2, 30 char names (big endian), %d zones
+>0x1e	string		minix		\b, bootable
+0x410	leshort		0x4d5a
+>0x402	beshort		!0		Minix filesystem, V3, %d zones
+>0x1e	string		minix		\b, bootable
+
 # SGI disk labels - Nathan Scott 
 0	belong		0x0BE5A941	SGI disk label (volume header)
 
@@ -1170,25 +1737,33 @@
 ############################################################################
 # Minix-ST kernel floppy
 0x800	belong		0x46fc2700	Atari-ST Minix kernel image
->19	string		\240\5\371\5\0\011\0\2\0	\b, 720k floppy
->19	string		\320\2\370\5\0\011\0\1\0	\b, 360k floppy
+# http://en.wikipedia.org/wiki/BIOS_parameter_block
+# floppies with valid BPB and any instruction at beginning
+>19	string		\240\005\371\005\0\011\0\2\0	\b, 720k floppy
+>19	string		\320\002\370\005\0\011\0\1\0	\b, 360k floppy
 
 ############################################################################
 # Hmmm, is this a better way of detecting _standard_ floppy images ?
-19	string		\320\2\360\3\0\011\0\1\0	DOS floppy 360k
->0x1FE	leshort		0xAA55		\b, x86 hard disk boot sector
-19	string		\240\5\371\3\0\011\0\2\0	DOS floppy 720k
->0x1FE	leshort		0xAA55		\b, x86 hard disk boot sector
+19	string		\320\002\360\003\0\011\0\1\0	DOS floppy 360k
+>0x1FE	leshort		0xAA55		\b, DOS/MBR hard disk boot sector
+19	string		\240\005\371\003\0\011\0\2\0	DOS floppy 720k
+>0x1FE	leshort		0xAA55		\b, DOS/MBR hard disk boot sector
 19	string		\100\013\360\011\0\022\0\2\0	DOS floppy 1440k
->0x1FE	leshort		0xAA55		\b, x86 hard disk boot sector
+>0x1FE	leshort		0xAA55		\b, DOS/MBR hard disk boot sector
 
-19	string		\240\5\371\5\0\011\0\2\0	DOS floppy 720k, IBM
->0x1FE	leshort		0xAA55		\b, x86 hard disk boot sector
-19	string		\100\013\371\5\0\011\0\2\0	DOS floppy 1440k, mkdosfs
->0x1FE	leshort		0xAA55		\b, x86 hard disk boot sector
+19	string		\240\005\371\005\0\011\0\2\0	DOS floppy 720k, IBM
+>0x1FE	leshort		0xAA55		\b, DOS/MBR hard disk boot sector
+19	string		\100\013\371\005\0\011\0\2\0	DOS floppy 1440k, mkdosfs
+>0x1FE	leshort		0xAA55		\b, DOS/MBR hard disk boot sector
 
-19	string		\320\2\370\5\0\011\0\1\0	Atari-ST floppy 360k
-19	string		\240\5\371\5\0\011\0\2\0	Atari-ST floppy 720k
+19	string		\320\002\370\005\0\011\0\1\0	Atari-ST floppy 360k
+19	string		\240\005\371\005\0\011\0\2\0	Atari-ST floppy 720k
+#			|       |   |     |     |
+#			|       |   |     |     heads
+#			|       |   |     sectors/track
+#			|       |   sectors/FAT
+#			|       media descriptor
+#		BPB:	sectors
 
 #  Valid media descriptor bytes for MS-DOS:
 #
@@ -1226,11 +1801,85 @@
 #        10	SS, 8 SPT
 #        11	DS, 8 SPT
 #
-#  11111001	Double density 3 floppy disk, high density 5
-#  11110000	High density 3 floppy disk
+#  11111001	Double density 3 1/2 floppy disk, high density 5 1/4
+#  11110000	High density 3 1/2 floppy disk
 #  11111000	Hard disk any format
 #
 
+# all FAT12 (strength=70) floppies with sectorsize 512 added by Joerg Jenderek at Jun 2013
+# http://en.wikipedia.org/wiki/File_Allocation_Table#Exceptions
+# Too Weak.
+#512		ubelong&0xE0ffff00	0xE0ffff00		
+# without valid Media descriptor in place of BPB, cases with are done at other places
+#>21		ubyte			<0xE5			floppy with old FAT filesystem
+# but valid Media descriptor at begin of FAT
+#>>512		ubyte			=0xed			720k
+#>>512		ubyte			=0xf0			1440k
+#>>512		ubyte			=0xf8			720k
+#>>512		ubyte			=0xf9			1220k
+#>>512		ubyte			=0xfa			320k
+#>>512		ubyte			=0xfb			640k
+#>>512		ubyte			=0xfc			180k
+# look like an an old DOS directory entry
+#>>>0xA0E	ubequad			0			
+#>>>>0xA00	ubequad			!0			
+#!:mime application/x-ima
+#>>512		ubyte			=0xfd			
+# look for 2nd FAT at different location to distinguish between 360k and 500k
+#>>>0x600	ubelong&0xE0ffff00	0xE0ffff00		360k
+#>>>0x500	ubelong&0xE0ffff00	0xE0ffff00		500k
+#>>>0xA0E	ubequad			0			
+#!:mime application/x-ima
+#>>512		ubyte			=0xfe			
+#>>>0x400	ubelong&0xE0ffff00	0xE0ffff00		160k
+#>>>>0x60E	ubequad			0			
+#>>>>>0x600	ubequad			!0			
+#!:mime application/x-ima
+#>>>0xC00	ubelong&0xE0ffff00	0xE0ffff00		1200k
+#>>512		ubyte			=0xff			320k
+#>>>0x60E	ubequad			0			
+#>>>>0x600	ubequad			!0			
+#!:mime application/x-ima
+#>>512		ubyte			x			\b, Media descriptor 0x%x
+# without x86 jump instruction
+#>>0		ulelong&0x804000E9	!0x000000E9		
+# assembler instructions: CLI;MOV SP,1E7;MOV AX;07c0;MOV 	
+#>>>0	ubequad				0xfabce701b8c0078e	\b, MS-DOS 1.12 bootloader
+# IOSYS.COM+MSDOS.COM
+#>>>>0xc4	use			2xDOS-filename
+#>>0		ulelong&0x804000E9	=0x000000E9	
+# only x86 short jump instruction found
+#>>>0		ubyte			=0xEB
+#>>>>1		ubyte			x			\b, code offset 0x%x+2
+# http://thestarman.pcministry.com/DOS/ibm100/Boot.htm
+# assembler instructions: CLI;MOV AX,CS;MOV DS,AX;MOV DX,0		
+#>>>>(1.b+2)	ubequad			0xfa8cc88ed8ba0000	\b, PC-DOS 1.0 bootloader 
+# ibmbio.com+ibmdos.com
+#>>>>>0x176	use			DOS-filename
+#>>>>>0x181	ubyte			x			\b+
+#>>>>>0x182	use			DOS-filename
+# http://thestarman.pcministry.com/DOS/ibm110/Boot.htm
+# assembler instructions: CLI;MOV AX,CS;MOV DS,AX;XOR DX,DX;MOV		
+#>>>>(1.b+2)	ubequad			0xfa8cc88ed833d28e	\b, PC-DOS 1.1 bootloader 
+# ibmbio.com+ibmdos.com
+#>>>>>0x18b	use			DOS-filename
+#>>>>>0x196	ubyte			x			\b+
+#>>>>>0x197	use			DOS-filename
+# http://en.wikipedia.org/wiki/Zenith_Data_Systems
+# assembler instructions: MOV BX,07c0;MOV SS,BX;MOV SP,01c6		
+#>>>>(1.b+2)	ubequad			0xbbc0078ed3bcc601	\b, Zenith Data Systems MS-DOS 1.25 bootloader
+# IO.SYS+MSDOS.SYS
+#>>>>>0x20	use			2xDOS-filename
+# http://en.wikipedia.org/wiki/Corona_Data_Systems
+# assembler instructions: MOV AX,CS;MOV DS,AX;CLI;MOV SS,AX;		
+#>>>>(1.b+2)	ubequad			0x8cc88ed8fa8ed0bc	\b, MS-DOS 1.25 bootloader
+# IO.SYS+MSDOS.SYS
+#>>>>>0x69	use			2xDOS-filename
+# assembler instructions: CLI;PUSH CS;POP SS;MOV SP,7c00;		
+#>>>>(1.b+2)	ubequad			0xfa0e17bc007cb860	\b, MS-DOS 2.11 bootloader
+# defect IO.SYS+MSDOS.SYS ?
+#>>>>>0x162	use			2xDOS-filename
+
 # CDROM Filesystems
 # Modified for UDF by gerardo.cacciari@gmail.com
 32769	string    CD001     #
@@ -1243,35 +1892,35 @@
 >>38917	byte     >0x33      (unknown version, ID 0x%X)
 >>38917	byte     <0x31      (unknown version, ID 0x%X)
 # "application id" which appears to be used as a volume label
->32808	string    >\0       '%s'
+>32808	string/T  >\0       '%s'
 >34816	string    \000CD001\001EL\ TORITO\ SPECIFICATION    (bootable)
 37633	string    CD001     ISO 9660 CD-ROM filesystem data (raw 2352 byte sectors)
 !:mime	application/x-iso9660-image
-32776	string    CDROM     High Sierra CD-ROM filesystem data
+32777	string    CDROM     High Sierra CD-ROM filesystem data
 
 # .cso files
 0    string    CISO	Compressed ISO CD image
 
 # cramfs filesystem - russell@coker.com.au
 0       lelong    0x28cd3d45      Linux Compressed ROM File System data, little endian
->4      lelong  x size %lu
+>4      lelong  x size %u
 >8      lelong  &1 version #2
 >8      lelong  &2 sorted_dirs
 >8      lelong  &4 hole_support
 >32     lelong  x CRC 0x%x,
->36     lelong  x edition %lu,
->40     lelong  x %lu blocks,
->44     lelong  x %lu files
+>36     lelong  x edition %u,
+>40     lelong  x %u blocks,
+>44     lelong  x %u files
 
 0       belong    0x28cd3d45      Linux Compressed ROM File System data, big endian
->4      belong  x size %lu
+>4      belong  x size %u
 >8      belong  &1 version #2
 >8      belong  &2 sorted_dirs
 >8      belong  &4 hole_support
 >32     belong  x CRC 0x%x,
->36     belong  x edition %lu,
->40     belong  x %lu blocks,
->44     belong  x %lu files
+>36     belong  x edition %u,
+>40     belong  x %u blocks,
+>44     belong  x %u files
 
 # reiserfs - russell@coker.com.au
 0x10034		string	ReIsErFs	ReiserFS V3.5
@@ -1414,8 +2063,6 @@
 >28 leshort >3
 >>8	ledate	x	created: %s
 
-0	string		td\000		floppy image data (TeleDisk)
-
 # AFS Dump Magic
 # From: Ty Sarna  
 0       string                  \x01\xb3\xa1\x13\x22    AFS Dump
@@ -1538,8 +2185,8 @@
 >16	ulequad	>0	\b fblock table at %lld,
 >24	ulequad	>0	\b inode table at %lld,
 >32	ulequad	>0	\b root at %lld,
->40	ulelong	>0	\b fblock size = %ld,
->44	ulelong	>0	\b block size = %ld,
+>40	ulelong	>0	\b fblock size = %d,
+>44	ulelong	>0	\b block size = %d,
 >48	ulequad	>0	\b bytes = %lld
 
 # Type:	xfs metadump image
@@ -1569,3 +2216,64 @@
 >>&8	lelong	x	\b, blocksize %d
 >>&32	lelong&0x00000006	>0	(dirty)
 >>&36	lelong	>0	(compressed)
+
+# LFS
+0	lelong	0x070162	LFS filesystem image
+>4	lelong	1		version 1,
+>>8	lelong	x		\b blocks %u,
+>>12	lelong	x		\b blocks per segment %u,
+>4	lelong	2		version 2,
+>>8	lelong	x		\b fragments %u,
+>>12	lelong	x		\b bytes per segment %u,
+>16	lelong	x		\b disk blocks %u,
+>20	lelong	x		\b block size %u,
+>24	lelong	x		\b fragment size %u,
+>28	lelong	x		\b fragments per block %u,
+>32	lelong	x		\b start for free list %u,
+>36	lelong	x		\b number of free blocks %d,
+>40	lelong	x		\b number of files %u,
+>44	lelong	x		\b blocks available for writing %d,
+>48	lelong	x		\b inodes in cache %d,
+>52	lelong	x		\b inode file disk address 0x%x,
+>56	lelong	x		\b inode file inode number %u,
+>60	lelong	x		\b address of last segment written 0x%x,
+>64	lelong	x		\b address of next segment to write 0x%x,
+>68	lelong	x		\b address of current segment written 0x%x
+
+0	string	td\000		floppy image data (TeleDisk, compressed)
+0	string	TD\000		floppy image data (TeleDisk)
+
+0	string	CQ\024		floppy image data (CopyQM, 
+>16	leshort	x		%d sectors, 
+>18	leshort	x		%d heads.)
+
+0	string	ACT\020Apricot\020disk\020image\032\004	floppy image data (ApriDisk)
+
+0	beshort	0xAA58		floppy image data (IBM SaveDskF, old)
+0	beshort	0xAA59		floppy image data (IBM SaveDskF)
+0	beshort	0xAA5A		floppy image data (IBM SaveDskF, compressed)
+
+0	string	\074CPM_Disk\076	disk image data (YAZE)
+
+# ReFS
+# Richard W.M. Jones 
+0	string	\0\0\0ReFS\0	ReFS filesystem image
+
+# EFW encase image file format:
+# Gregoire Passault
+# http://www.forensicswiki.org/wiki/Encase_image_file_format
+0	string	EVF\x09\x0d\x0a\xff\x00	EWF/Expert Witness/EnCase image file format
+
+# UBIfs
+# Linux kernel sources: fs/ubifs/ubifs-media.h
+0       belong  0x31181006
+>0x16   short   0               UBIfs image
+>0x08   lequad  x               \b, sequence number %llu
+>0x10   leshort x               \b, length %u
+>0x04   lelong  x               \b, CRC 0x%08x
+
+0       belong  0x55424923
+>0x04   short   <2
+>0x05   string  \0\0\0
+>0x1c   string  \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
+>0x04   short   x       UBI image, version %u
diff --git a/contrib/file/magic/Magdir/flash b/contrib/file/magic/Magdir/flash
new file mode 100644
index 00000000000..b06f879efcd
--- /dev/null
+++ b/contrib/file/magic/Magdir/flash
@@ -0,0 +1,40 @@
+
+#------------------------------------------------------------------------------
+# $File: flash,v 1.11 2014/05/02 00:26:49 christos Exp $
+# flash:	file(1) magic for Macromedia Flash file format
+#
+# See
+#
+#	http://www.macromedia.com/software/flash/open/
+#	http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/\
+#	en/devnet/swf/pdf/swf-file-format-spec.pdf page 27
+#
+
+0   name        swf-details
+>0	string		F		Macromedia Flash data
+!:mime	application/x-shockwave-flash
+>0	string		C		Macromedia Flash data (compressed)
+!:mime	application/x-shockwave-flash
+>0	string		Z		Macromedia Flash data (lzma compressed)
+!:mime	application/x-shockwave-flash
+>3   byte        x      \b, version %d
+
+1   string      WS
+>4  lelong      !0
+>>3 byte        255 Suspicious
+>>>0    use     swf-details
+
+>>3 ubyte       <32
+>>>3 ubyte      !0
+>>>>0   use     swf-details
+
+# From: Cal Peake 
+0	string		FLV\x01		Macromedia Flash Video
+!:mime	video/x-flv
+
+#
+# Yosu Gomez
+0       string AGD2\xbe\xb8\xbb\xcd\x00 Macromedia Freehand 7 Document
+0       string AGD3\xbe\xb8\xbb\xcc\x00 Macromedia Freehand 8 Document
+# From Dave Wilson
+0	string AGD4\xbe\xb8\xbb\xcb\x00	Macromedia Freehand 9 Document
diff --git a/contrib/file/Magdir/fonts b/contrib/file/magic/Magdir/fonts
similarity index 81%
rename from contrib/file/Magdir/fonts
rename to contrib/file/magic/Magdir/fonts
index 917d372e6ef..4b3173cd2af 100644
--- a/contrib/file/Magdir/fonts
+++ b/contrib/file/magic/Magdir/fonts
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: fonts,v 1.23 2010/09/20 18:55:20 rrt Exp $
+# $File: fonts,v 1.27 2014/04/30 21:41:02 christos Exp $
 # fonts:  file(1) magic for font data
 #
 0	search/1	FONT		ASCII vfont text
@@ -16,8 +16,15 @@
 0	string		%!PS-Adobe-3.0\ Resource-Font	PostScript Type 1 font text
 
 # X11 font files in SNF (Server Natural Format) format
+# updated by Joerg Jenderek at Feb 2013
+# http://computer-programming-forum.com/51-perl/8f22fb96d2e34bab.htm
 0	belong		00000004		X11 SNF font data, MSB first
-0	lelong		00000004		X11 SNF font data, LSB first
+#>104	belong		00000004		X11 SNF font data, MSB first
+!:mime	application/x-font-sfn
+# GRR: line below too general as it catches also Xbase index file t3-CHAR.NDX
+0	lelong		00000004		
+>104	lelong		00000004		X11 SNF font data, LSB first
+!:mime	application/x-font-sfn
 
 # X11 Bitmap Distribution Format, from Daniel Quinlan (quinlan@yggdrasil.com)
 0	search/1	STARTFONT\ 		X11 BDF font text
@@ -75,7 +82,7 @@
 0	string		OTTO		OpenType font data
 !:mime application/vnd.ms-opentype
 
-# Gürkan Sengün , www.linuks.mine.nu 
+# Gurkan Sengun , www.linuks.mine.nu 
 0	string		SplineFontDB:	Spline Font Database 
 !:mime application/vnd.font-fontforge-sfd
 >14	string		x		version %s
@@ -83,3 +90,11 @@
 # EOT
 34	string		LP		Embedded OpenType (EOT)
 !:mime application/vnd.ms-fontobject
+
+# Web Open Font Format (.woff)
+# http://www.w3.org/TR/WOFF/
+0	string		wOFF	Web Open Font Format
+>4	belong		x	\b, flavor %d
+>8	belong		x	\b, length %d
+>20	beshort		x	\b, version %d
+>22	beshort		x	\b.%d
diff --git a/contrib/file/Magdir/fortran b/contrib/file/magic/Magdir/fortran
similarity index 51%
rename from contrib/file/Magdir/fortran
rename to contrib/file/magic/Magdir/fortran
index e2ef0cdb754..921beec3968 100644
--- a/contrib/file/Magdir/fortran
+++ b/contrib/file/magic/Magdir/fortran
@@ -1,6 +1,7 @@
 
 #------------------------------------------------------------------------------
-# $File: fortran,v 1.6 2009/09/19 16:28:09 christos Exp $
+# $File: fortran,v 1.8 2014/06/03 19:01:34 christos Exp $
 # FORTRAN source
-0	regex/100	\^[Cc][\ \t]	FORTRAN program
+0	regex/100l	\^[Cc][\ \t]	FORTRAN program
 !:mime	text/x-fortran
+!:strength - 5
diff --git a/contrib/file/Magdir/frame b/contrib/file/magic/Magdir/frame
similarity index 100%
rename from contrib/file/Magdir/frame
rename to contrib/file/magic/Magdir/frame
diff --git a/contrib/file/Magdir/freebsd b/contrib/file/magic/Magdir/freebsd
similarity index 100%
rename from contrib/file/Magdir/freebsd
rename to contrib/file/magic/Magdir/freebsd
diff --git a/contrib/file/Magdir/fsav b/contrib/file/magic/Magdir/fsav
similarity index 91%
rename from contrib/file/Magdir/fsav
rename to contrib/file/magic/Magdir/fsav
index 0a7a7f80205..ecdc4f654b7 100644
--- a/contrib/file/Magdir/fsav
+++ b/contrib/file/magic/Magdir/fsav
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: fsav,v 1.11 2009/09/19 16:28:09 christos Exp $
+# $File: fsav,v 1.13 2013/03/25 17:18:47 christos Exp $
 # fsav:  file(1) magic for datafellows fsav virus definition files
 # Anthon van der Neut (anthon@mnt.org)
 
@@ -61,3 +61,6 @@
 # Type: Grisoft AVG AntiVirus
 # From: David Newgas 
 0	string	AVG7_ANTIVIRUS_VAULT_FILE	AVG 7 Antivirus vault file data
+
+0	string	X5O!P%@AP[4\\PZX54(P^)7CC)7}$EICAR
+>33	string	-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*	EICAR virus test files
diff --git a/contrib/file/Magdir/fusecompress b/contrib/file/magic/Magdir/fusecompress
similarity index 100%
rename from contrib/file/Magdir/fusecompress
rename to contrib/file/magic/Magdir/fusecompress
diff --git a/contrib/file/Magdir/games b/contrib/file/magic/Magdir/games
similarity index 96%
rename from contrib/file/Magdir/games
rename to contrib/file/magic/Magdir/games
index e8116289cb5..779bc6cfd64 100644
--- a/contrib/file/Magdir/games
+++ b/contrib/file/magic/Magdir/games
@@ -1,19 +1,19 @@
 
 #------------------------------------------------------------------------------
-# $File: games,v 1.13 2012/02/13 22:50:50 christos Exp $
+# $File: games,v 1.14 2014/04/30 21:41:02 christos Exp $
 # games:  file(1) for games
 
 # Fabio Bonelli 
 # Quake II - III data files
 0       string  IDP2        	Quake II 3D Model file,
->20     long    x               %lu skin(s),
->8      long    x               (%lu x
->12     long    x 		%lu),
->40     long    x               %lu frame(s),
->16     long    x               Frame size %lu bytes,
->24     long  	x               %lu vertices/frame,
->28     long    x            	%lu texture coordinates,
->32     long    x               %lu triangles/frame
+>20     long    x               %u skin(s),
+>8      long    x               (%u x
+>12     long    x 		%u),
+>40     long    x               %u frame(s),
+>16     long    x               Frame size %u bytes,
+>24     long  	x               %u vertices/frame,
+>28     long    x            	%u texture coordinates,
+>32     long    x               %u triangles/frame
 
 0       string  IBSP            Quake
 >4      long    0x26            II Map file (BSP)
@@ -146,7 +146,7 @@
 
 
 0	string	MComprHD	MAME CHD compressed hard disk image,
->12	belong	x		version %lu
+>12	belong	x		version %u
 
 # doom - submitted by Jon Dowland
 
diff --git a/contrib/file/Magdir/gcc b/contrib/file/magic/Magdir/gcc
similarity index 100%
rename from contrib/file/Magdir/gcc
rename to contrib/file/magic/Magdir/gcc
diff --git a/contrib/file/Magdir/geo b/contrib/file/magic/Magdir/geo
similarity index 89%
rename from contrib/file/Magdir/geo
rename to contrib/file/magic/Magdir/geo
index 924c71e9356..9a765fed0c1 100644
--- a/contrib/file/Magdir/geo
+++ b/contrib/file/magic/Magdir/geo
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: geo,v 1.1 2010/02/23 23:40:07 christos Exp $
+# $File: geo,v 1.3 2013/01/04 00:47:02 christos Exp $
 # Geo- files from Kurt Schwehr 
 
 ######################################################################
@@ -103,3 +103,15 @@
 
 # https://midas.psi.ch/elog/
 0	string	$@MID@$	elog journal entry
+
+# Geospatial Designs http://www.geospatialdesigns.com/surfer6_format.htm
+0	string		DSBB	Surfer 6 binary grid file
+>4	leshort		x	\b, %d
+>6	leshort		x	\bx%d
+>8	ledouble	x	\b, minx=%g
+>16	ledouble	x	\b, maxx=%g
+>24	ledouble	x	\b, miny=%g
+>32	ledouble	x	\b, maxy=%g
+>40	ledouble	x	\b, minz=%g
+>48	ledouble	x	\b, maxz=%g
+
diff --git a/contrib/file/Magdir/geos b/contrib/file/magic/Magdir/geos
similarity index 100%
rename from contrib/file/Magdir/geos
rename to contrib/file/magic/Magdir/geos
diff --git a/contrib/file/Magdir/gimp b/contrib/file/magic/Magdir/gimp
similarity index 75%
rename from contrib/file/Magdir/gimp
rename to contrib/file/magic/Magdir/gimp
index a360bd8e124..516abb25a1f 100644
--- a/contrib/file/Magdir/gimp
+++ b/contrib/file/magic/Magdir/gimp
@@ -1,13 +1,17 @@
 
 #------------------------------------------------------------------------------
-# $File: gimp,v 1.7 2010/09/20 18:55:20 rrt Exp $
-# GIMP Gradient: file(1) magic for the GIMP's gradient data files
+# $File: gimp,v 1.9 2014/04/30 21:41:02 christos Exp $
+# GIMP Gradient: file(1) magic for the GIMP's gradient data files (.ggr)
 # by Federico Mena 
 
-0       string          GIMP\ Gradient  GIMP gradient data
+0       string/t        GIMP\ Gradient  GIMP gradient data
+
+# GIMP palette (.gpl)
+# From: Markus Heidelberg 
+0       string/t        GIMP\ Palette   GIMP palette data
 
 #------------------------------------------------------------------------------
-# XCF:  file(1) magic for the XCF image format used in the GIMP developed
+# XCF:  file(1) magic for the XCF image format used in the GIMP (.xcf) developed
 #       by Spencer Kimball and Peter Mattis
 #       ('Bucky' LaDieu, nega@vt.edu)
 
@@ -16,15 +20,15 @@
 >9	string		file		version 0,
 >9	string		v		version
 >>10	string		>\0		%s,
->14	belong		x		%lu x
->18	belong		x		%lu,
+>14	belong		x		%u x
+>18	belong		x		%u,
 >22     belong          0               RGB Color
 >22     belong          1               Greyscale
 >22     belong          2               Indexed Color
 >22	belong		>2		Unknown Image Type.
 
 #------------------------------------------------------------------------------
-# XCF:  file(1) magic for the patterns used in the GIMP, developed
+# XCF:  file(1) magic for the patterns used in the GIMP (.pat), developed
 #       by Spencer Kimball and Peter Mattis
 #       ('Bucky' LaDieu, nega@vt.edu)
 
@@ -32,7 +36,7 @@
 >24     string          x               %s
 
 #------------------------------------------------------------------------------
-# XCF:  file(1) magic for the brushes used in the GIMP, developed
+# XCF:  file(1) magic for the brushes used in the GIMP (.gbr), developed
 #       by Spencer Kimball and Peter Mattis
 #       ('Bucky' LaDieu, nega@vt.edu)
 
diff --git a/contrib/file/magic/Magdir/gnome b/contrib/file/magic/Magdir/gnome
new file mode 100644
index 00000000000..32c9ae93881
--- /dev/null
+++ b/contrib/file/magic/Magdir/gnome
@@ -0,0 +1,59 @@
+
+#------------------------------------------------------------------------------
+# $File: gnome,v 1.5 2014/04/30 21:41:02 christos Exp $
+# GNOME related files
+
+# Contributed by Josh Triplett
+# FIXME: Could be simplified if pstring supported two-byte counts
+0         string   GnomeKeyring\n\r\0\n GNOME keyring
+>&0       ubyte    0                    \b, major version 0
+>>&0      ubyte    0                    \b, minor version 0
+>>>&0     ubyte    0                    \b, crypto type 0 (AES)
+>>>&0     ubyte    >0                   \b, crypto type %u (unknown)
+>>>&1     ubyte    0                    \b, hash type 0 (MD5)
+>>>&1     ubyte    >0                   \b, hash type %u (unknown)
+>>>&2     ubelong  0xFFFFFFFF           \b, name NULL
+>>>&2     ubelong  !0xFFFFFFFF
+>>>>&-4   ubelong  >255                 \b, name too long for file's pstring type
+>>>>&-4   ubelong  <256
+>>>>>&-1  pstring  x                    \b, name "%s"
+>>>>>>&0  ubeqdate x                    \b, last modified %s
+>>>>>>&8  ubeqdate x                    \b, created %s
+>>>>>>&16 ubelong  &1
+>>>>>>>&0 ubelong  x                    \b, locked if idle for %u seconds
+>>>>>>&16 ubelong  ^1                   \b, not locked if idle
+>>>>>>&24 ubelong  x                    \b, hash iterations %u
+>>>>>>&28 ubequad  x                    \b, salt %llu
+>>>>>>&52 ubelong  x                    \b, %u item(s)
+
+# From: Alex Beregszaszi 
+4	string	gtktalog		GNOME Catalogue (gtktalog)
+>13	string	>\0			version %s
+
+# Summary: GStreamer binary registry
+# Extension: .bin
+# Submitted by: Josh Triplett 
+0	belong	0xc0def00d		GStreamer binary registry
+>4	string	x			\b, version %s
+
+# GVariant Database file
+# By Elan Ruusamae 
+# https://github.com/GNOME/gvdb/blob/master/gvdb-format.h
+# It's always "GVariant", it's byte swapped on incompatible archs
+# See https://github.com/GNOME/gvdb/blob/master/gvdb-builder.c
+# file_builder_serialise()
+# http://developer.gnome.org/glib/2.34/glib-GVariant.html#GVariant
+0	string	GVariant	GVariant Database file,
+# version is never filled. probably future extension
+>8	lelong	x		version %d
+# not sure are these usable, so commented out
+#>>16	lelong	x		start %d,
+#>>>20	lelong	x		end %d
+
+# G-IR database made by gobject-introspect toolset,
+# http://live.gnome.org/GObjectIntrospection
+0	string		GOBJ\nMETADATA\r\n\032	G-IR binary database
+>16	byte		x			\b, v%d
+>17	byte		x			\b.%d
+>20	leshort		x			\b, %d entries
+>22	leshort		x			\b/%d local
diff --git a/contrib/file/Magdir/gnu b/contrib/file/magic/Magdir/gnu
similarity index 61%
rename from contrib/file/Magdir/gnu
rename to contrib/file/magic/Magdir/gnu
index 4789c0a2a66..e4a0a16aa43 100644
--- a/contrib/file/Magdir/gnu
+++ b/contrib/file/magic/Magdir/gnu
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: gnu,v 1.13 2012/01/03 17:16:54 christos Exp $
+# $File: gnu,v 1.15 2014/02/06 14:21:02 christos Exp $
 # gnu:  file(1) magic for various GNU tools
 #
 # GNU nlsutils message catalog file format
@@ -37,6 +37,32 @@
 0       beshort         0x9901                  GPG key public ring
 !:mime	application/x-gnupg-keyring
 
+# Symmetric encryption
+0	leshort		0x0d8c
+>4	leshort		0x0203
+>>2	leshort		0x0204		GPG symmetrically encrypted data (3DES cipher)
+>>2	leshort		0x0304		GPG symmetrically encrypted data (CAST5 cipher)
+>>2	leshort		0x0404		GPG symmetrically encrypted data (BLOWFISH cipher)
+>>2	leshort		0x0704		GPG symmetrically encrypted data (AES cipher)
+>>2	leshort		0x0804		GPG symmetrically encrypted data (AES192 cipher)
+>>2	leshort		0x0904		GPG symmetrically encrypted data (AES256 cipher)
+>>2	leshort		0x0a04		GPG symmetrically encrypted data (TWOFISH cipher)
+>>2	leshort		0x0b04		GPG symmetrically encrypted data (CAMELLIA128 cipher)
+>>2	leshort		0x0c04		GPG symmetrically encrypted data (CAMELLIA192 cipher)
+>>2	leshort		0x0d04		GPG symmetrically encrypted data (CAMELLIA256 cipher)
+
+
+# GnuPG Keybox file
+# 
+# From: Philipp Hahn 
+0	belong	32
+>4	byte	1
+>>8	string	KBXf	GPG keybox database
+>>>5	byte	1	version %d
+>>>16	bedate	x	\b, created-at %s
+>>>20	bedate	x	\b, last-maintained %s
+
+
 # Gnumeric spreadsheet
 # This entry is only semi-helpful, as Gnumeric compresses its files, so
 # they will ordinarily reported as "compressed", but at least -z helps
diff --git a/contrib/file/Magdir/gnumeric b/contrib/file/magic/Magdir/gnumeric
similarity index 100%
rename from contrib/file/Magdir/gnumeric
rename to contrib/file/magic/Magdir/gnumeric
diff --git a/contrib/file/magic/Magdir/gpt b/contrib/file/magic/Magdir/gpt
new file mode 100644
index 00000000000..c48a58f7fe6
--- /dev/null
+++ b/contrib/file/magic/Magdir/gpt
@@ -0,0 +1,240 @@
+
+#------------------------------------------------------------------------------
+# $File: gpt,v 1.3 2014/04/30 21:41:02 christos Exp $
+#
+# GPT Partition table patterns.
+# Author: Rogier Goossens (goossens.rogier@gmail.com)
+# Note that a GPT-formatted disk must contain an MBR as well.
+#
+
+# The initial segment (up to >>>>>>>>422) was copied from the X86
+# partition table code (aka MBR).
+# This is kept separate, so that MBR partitions are not reported as well.
+# (use -k if you do want them as well)
+
+# First, detect the MBR partiton table
+# If more than one GPT protective MBR partition exists, don't print anything
+# (the other MBR detection code will then just print the MBR partition table)
+0x1FE			leshort		0xAA55
+>3			string		!MS
+>>3			string		!SYSLINUX
+>>>3			string		!MTOOL
+>>>>3			string		!NEWLDR
+>>>>>5			string		!DOS
+# not FAT (32 bit)
+>>>>>>82		string		!FAT32
+#not Linux kernel
+>>>>>>>514		string		!HdrS
+#not BeOS
+>>>>>>>>422		string		!Be\ Boot\ Loader
+# GPT with protective MBR entry in partition 1 (only)
+>>>>>>>>>450		ubyte		0xee
+>>>>>>>>>>466		ubyte		!0xee
+>>>>>>>>>>>482		ubyte		!0xee
+>>>>>>>>>>>>498		ubyte		!0xee
+#>>>>>>>>>>>>>446	use		gpt-mbr-partition
+>>>>>>>>>>>>>(454.l*8192)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>0			use		gpt-mbr-type
+>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>0			ubyte		x		of 8192 bytes		
+>>>>>>>>>>>>>(454.l*8192)	string		!EFI\ PART
+>>>>>>>>>>>>>>(454.l*4096)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>0		ubyte		x		of 4096 bytes
+>>>>>>>>>>>>>>(454.l*4096)	string		!EFI\ PART
+>>>>>>>>>>>>>>>(454.l*2048)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>>0		ubyte		x		of 2048 bytes
+>>>>>>>>>>>>>>>(454.l*2048)	string		!EFI\ PART
+>>>>>>>>>>>>>>>>(454.l*1024)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>>>0		ubyte		x		of 1024 bytes
+>>>>>>>>>>>>>>>>(454.l*1024)	string		!EFI\ PART
+>>>>>>>>>>>>>>>>>(454.l*512)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>>>>0		ubyte		x		of 512 bytes
+# GPT with protective MBR entry in partition 2 (only)
+>>>>>>>>>450		ubyte		!0xee
+>>>>>>>>>>466		ubyte		0xee
+>>>>>>>>>>>482		ubyte		!0xee
+>>>>>>>>>>>>498		ubyte		!0xee
+#>>>>>>>>>>>>>462	use		gpt-mbr-partition
+>>>>>>>>>>>>>(470.l*8192)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>0			use		gpt-mbr-type
+>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>0			ubyte		x		of 8192 bytes		
+>>>>>>>>>>>>>(470.l*8192)	string		!EFI\ PART
+>>>>>>>>>>>>>>(470.l*4096)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>0		ubyte		x		of 4096 bytes
+>>>>>>>>>>>>>>(470.l*4096)	string		!EFI\ PART
+>>>>>>>>>>>>>>>(470.l*2048)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>>0		ubyte		x		of 2048 bytes
+>>>>>>>>>>>>>>>(470.l*2048)	string		!EFI\ PART
+>>>>>>>>>>>>>>>>(470.l*1024)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>>>0		ubyte		x		of 1024 bytes
+>>>>>>>>>>>>>>>>(470.l*1024)	string		!EFI\ PART
+>>>>>>>>>>>>>>>>>(470.l*512)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>>>>0		ubyte		x		of 512 bytes
+# GPT with protective MBR entry in partition 3 (only)
+>>>>>>>>>450		ubyte		!0xee
+>>>>>>>>>>466		ubyte		!0xee
+>>>>>>>>>>>482		ubyte		0xee
+>>>>>>>>>>>>498		ubyte		!0xee
+#>>>>>>>>>>>>>478	use		gpt-mbr-partition
+>>>>>>>>>>>>>(486.l*8192)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>0			use		gpt-mbr-type
+>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>0			ubyte		x		of 8192 bytes		
+>>>>>>>>>>>>>(486.l*8192)	string		!EFI\ PART
+>>>>>>>>>>>>>>(486.l*4096)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>0		ubyte		x		of 4096 bytes
+>>>>>>>>>>>>>>(486.l*4096)	string		!EFI\ PART
+>>>>>>>>>>>>>>>(486.l*2048)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>>0		ubyte		x		of 2048 bytes
+>>>>>>>>>>>>>>>(486.l*2048)	string		!EFI\ PART
+>>>>>>>>>>>>>>>>(486.l*1024)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>>>0		ubyte		x		of 1024 bytes
+>>>>>>>>>>>>>>>>(486.l*1024)	string		!EFI\ PART
+>>>>>>>>>>>>>>>>>(486.l*512)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>>>>0		ubyte		x		of 512 bytes
+# GPT with protective MBR entry in partition 4 (only)
+>>>>>>>>>450		ubyte		!0xee
+>>>>>>>>>>466		ubyte		!0xee
+>>>>>>>>>>>482		ubyte		!0xee
+>>>>>>>>>>>>498		ubyte		0xee
+#>>>>>>>>>>>>>494	use		gpt-mbr-partition
+>>>>>>>>>>>>>(502.l*8192)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>0			use		gpt-mbr-type
+>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>0			ubyte		x		of 8192 bytes		
+>>>>>>>>>>>>>(502.l*8192)	string		!EFI\ PART
+>>>>>>>>>>>>>>(502.l*4096)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>0		ubyte		x		of 4096 bytes
+>>>>>>>>>>>>>>(502.l*4096)	string		!EFI\ PART
+>>>>>>>>>>>>>>>(502.l*2048)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>>0		ubyte		x		of 2048 bytes
+>>>>>>>>>>>>>>>(502.l*2048)	string		!EFI\ PART
+>>>>>>>>>>>>>>>>(502.l*1024)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>>>0		ubyte		x		of 1024 bytes
+>>>>>>>>>>>>>>>>(502.l*1024)	string		!EFI\ PART
+>>>>>>>>>>>>>>>>>(502.l*512)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>>>>0		ubyte		x		of 512 bytes
+
+# The following code does GPT detection and processing, including
+# sector size detection.
+# It has to be duplicated above because the top-level pattern
+# (i.e. not called using 'use') must print *something* for file
+# to count it as a match. Text only printed in named patterns is
+# not counted, and causes file to continue, and try and match
+# other patterns.
+#
+# Unfortunately, when assuming sector sizes >=16k, if the sector size
+# happens to be 512 instead, we may find confusing data after the GPT
+# table...  If the GPT table has less than 128 entries, this may even
+# happen for assumed sector sizes as small as 4k
+# This could be solved by checking for the presence of the backup GPT
+# header as well, but that makes the logic extremely complex
+##0		name		gpt-mbr-partition
+##>(8.l*8192)	string		EFI\ PART
+##>>(8.l*8192)	use		gpt-mbr-type
+##>>&-8		use		gpt-table
+##>>0		ubyte		x		of 8192 bytes		
+##>(8.l*8192)	string		!EFI\ PART
+##>>(8.l*4096)	string		EFI\ PART	GPT partition table
+##>>>0		use		gpt-mbr-type
+##>>>&-8		use		gpt-table
+##>>>0		ubyte		x		of 4096 bytes
+##>>(8.l*4096)	string		!EFI\ PART
+##>>>(8.l*2048)	string		EFI\ PART	GPT partition table
+##>>>>0		use		gpt-mbr-type
+##>>>>&-8		use		gpt-table
+##>>>>0		ubyte		x		of 2048 bytes
+##>>>(8.l*2048)	string		!EFI\ PART
+##>>>>(8.l*1024)	string		EFI\ PART	GPT partition table
+##>>>>>0		use		gpt-mbr-type
+##>>>>>&-8	use		gpt-table
+##>>>>>0		ubyte		x		of 1024 bytes
+##>>>>(8.l*1024)	string		!EFI\ PART
+##>>>>>(8.l*512)	string		EFI\ PART	GPT partition table
+##>>>>>>0		use		gpt-mbr-type
+##>>>>>>&-8	use		gpt-table
+##>>>>>>0		ubyte		x		of 512 bytes
+
+# Print details of MBR type for a GPT-disk
+# Calling code ensures that there is only one 0xee partition.
+0		name		gpt-mbr-type
+# GPT with protective MBR entry in partition 1
+>450		ubyte		0xee
+>>454		ulelong		1
+>>>462		string		!\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	\b (with hybrid MBR)
+>>454		ulelong		!1													\b (nonstandard: not at LBA 1)
+# GPT with protective MBR entry in partition 2
+>466		ubyte		0xee
+>>470		ulelong		1
+>>>478		string		\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
+>>>>446		string		!\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0					\b (with hybrid MBR)
+>>>478		string		!\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	\b (with hybrid MBR)
+>>470		ulelong		!1									\b (nonstandard: not at LBA 1)
+# GPT with protective MBR entry in partition 3
+>482		ubyte		0xee
+>>486		ulelong		1
+>>>494		string		\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
+>>>>446		string		!\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	\b (with hybrid MBR)
+>>>494		string		!\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0					\b (with hybrid MBR)
+>>486		ulelong		!1									\b (nonstandard: not at LBA 1)
+# GPT with protective MBR entry in partition 4
+>498		ubyte		0xee
+>>502		ulelong		1		
+>>>446		string		!\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	\b (with hybrid MBR)
+>>502		ulelong		!1													\b (nonstandard: not at LBA 1)
+
+# Print the information from a GPT partition table structure
+0		name		gpt-table
+>10		uleshort	x		\b, version %u
+>8		uleshort	x		\b.%u
+>56		ulelong		x		\b, GUID: %08x
+>60		uleshort	x		\b-%04x
+>62		uleshort	x		\b-%04x
+>64		ubeshort	x		\b-%04x
+>66		ubeshort	x		\b-%04x
+>68		ubelong		x		\b%08x
+#>80		uleshort	x		\b, %d partition entries
+>32		ulequad+1	x		\b, disk size: %lld sectors
+
+# In case a GPT data-structure is at LBA 0, report it as well
+# This covers systems which are not GPT-aware, and which show
+# and allow access to the protective partition. This code will
+# detect the contents of such a partition.
+0		string		EFI\ PART	GPT data structure (nonstandard: at LBA 0)
+>0		use		gpt-table
+>0		ubyte		x		(sector size unknown)
+
+
diff --git a/contrib/file/Magdir/grace b/contrib/file/magic/Magdir/grace
similarity index 100%
rename from contrib/file/Magdir/grace
rename to contrib/file/magic/Magdir/grace
diff --git a/contrib/file/Magdir/graphviz b/contrib/file/magic/Magdir/graphviz
similarity index 65%
rename from contrib/file/Magdir/graphviz
rename to contrib/file/magic/Magdir/graphviz
index b944d4637c6..cddc1164005 100644
--- a/contrib/file/Magdir/graphviz
+++ b/contrib/file/magic/Magdir/graphviz
@@ -1,12 +1,12 @@
 
 #------------------------------------------------------------------------------
-# $File: graphviz,v 1.7 2009/09/19 16:28:09 christos Exp $
+# $File: graphviz,v 1.8 2014/06/03 19:01:34 christos Exp $
 # graphviz:  file(1) magic for http://www.graphviz.org/
 
 # FIXME: These patterns match too generally. For example, the first
 # line matches a LaTeX file containing the word "graph" (with a {
 # following later) and the second line matches this file.
-#0	regex/100	[\r\n\t\ ]*graph[\r\n\t\ ]+.*\\{	graphviz graph text
+#0	regex/100l	[\r\n\t\ ]*graph[\r\n\t\ ]+.*\\{	graphviz graph text
 #!:mime	text/vnd.graphviz
-#0	regex/100	[\r\n\t\ ]*digraph[\r\n\t\ ]+.*\\{	graphviz digraph text
+#0	regex/100l	[\r\n\t\ ]*digraph[\r\n\t\ ]+.*\\{	graphviz digraph text
 #!:mime	text/vnd.graphviz
diff --git a/contrib/file/Magdir/gringotts b/contrib/file/magic/Magdir/gringotts
similarity index 100%
rename from contrib/file/Magdir/gringotts
rename to contrib/file/magic/Magdir/gringotts
diff --git a/contrib/file/Magdir/guile b/contrib/file/magic/Magdir/guile
similarity index 100%
rename from contrib/file/Magdir/guile
rename to contrib/file/magic/Magdir/guile
diff --git a/contrib/file/Magdir/hitachi-sh b/contrib/file/magic/Magdir/hitachi-sh
similarity index 67%
rename from contrib/file/Magdir/hitachi-sh
rename to contrib/file/magic/Magdir/hitachi-sh
index 96067e9ba52..213d2d69c4f 100644
--- a/contrib/file/Magdir/hitachi-sh
+++ b/contrib/file/magic/Magdir/hitachi-sh
@@ -1,11 +1,14 @@
 
 #------------------------------------------------------------------------------
-# $File: hitachi-sh,v 1.5 2009/09/19 16:28:09 christos Exp $
+# $File: hitachi-sh,v 1.6 2013/01/29 19:31:33 christos Exp $
 # hitach-sh: file(1) magic for Hitachi Super-H
 #
 # Super-H COFF
 #
+# below test line conflicts with 2nd NTFS filesystem sector 
 0	beshort		0x0500		Hitachi SH big-endian COFF
+# 2nd NTFS filesystem sector often starts with 0x05004e00 for unicode string 5 NTLDR
+#0	ubelong&0xFFFFNMPQ	0x0500NMPQ     Hitachi SH big-endian COFF
 >18	beshort&0x0002	=0x0000		object
 >18	beshort&0x0002	=0x0002		executable
 >18	beshort&0x0008	=0x0008		\b, stripped
diff --git a/contrib/file/Magdir/hp b/contrib/file/magic/Magdir/hp
similarity index 96%
rename from contrib/file/Magdir/hp
rename to contrib/file/magic/Magdir/hp
index 3201c1567c8..b01c3a40b0a 100644
--- a/contrib/file/Magdir/hp
+++ b/contrib/file/magic/Magdir/hp
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: hp,v 1.23 2009/09/19 16:28:09 christos Exp $
+# $File: hp,v 1.24 2014/04/30 21:41:02 christos Exp $
 # hp:  file(1) magic for Hewlett Packard machines (see also "printer")
 #
 # XXX - somebody should figure out whether any byte order needs to be
@@ -41,10 +41,10 @@
 #### Old Apollo stuff
 0	beshort		0627		Apollo m68k COFF executable
 >18	beshort		^040000		not stripped
->22	beshort		>0		- version %ld
+>22	beshort		>0		- version %d
 0	beshort		0624		apollo a88k COFF executable
 >18	beshort		^040000		not stripped
->22	beshort		>0		- version %ld
+>22	beshort		>0		- version %d
 0       long            01203604016     TML 0123 byte-order format
 0       long            01702407010     TML 1032 byte-order format
 0       long            01003405017     TML 2301 byte-order format
@@ -128,58 +128,58 @@
 
 #### 500
 0	long		0x02080106	HP s500 relocatable executable
->16	long		>0		- version %ld
+>16	long		>0		- version %d
 
 0	long		0x02080107	HP s500 executable
->16	long		>0		- version %ld
+>16	long		>0		- version %d
 
 0	long		0x02080108	HP s500 pure executable
->16	long		>0		- version %ld
+>16	long		>0		- version %d
 
 #### 200
 0	belong 		0x020c0108	HP s200 pure executable
->4	beshort		>0		- version %ld
+>4	beshort		>0		- version %d
 >8	belong		&0x80000000	save fp regs
 >8	belong		&0x40000000	dynamically linked
 >8	belong		&0x20000000	debuggable
 >36	belong		>0		not stripped
 
 0	belong		0x020c0107	HP s200 executable
->4	beshort		>0		- version %ld
+>4	beshort		>0		- version %d
 >8	belong		&0x80000000	save fp regs
 >8	belong		&0x40000000	dynamically linked
 >8	belong		&0x20000000	debuggable
 >36	belong		>0		not stripped
 
 0	belong		0x020c010b	HP s200 demand-load executable
->4	beshort		>0		- version %ld
+>4	beshort		>0		- version %d
 >8	belong		&0x80000000	save fp regs
 >8	belong		&0x40000000	dynamically linked
 >8	belong		&0x20000000	debuggable
 >36	belong		>0		not stripped
 
 0	belong		0x020c0106	HP s200 relocatable executable
->4	beshort		>0		- version %ld
+>4	beshort		>0		- version %d
 >6	beshort		>0		- highwater %d
 >8	belong		&0x80000000	save fp regs
 >8	belong		&0x20000000	debuggable
 >8	belong		&0x10000000	PIC
 
 0	belong 		0x020a0108	HP s200 (2.x release) pure executable
->4	beshort		>0		- version %ld
+>4	beshort		>0		- version %d
 >36	belong		>0		not stripped
 
 0	belong		0x020a0107	HP s200 (2.x release) executable
->4	beshort		>0		- version %ld
+>4	beshort		>0		- version %d
 >36	belong		>0		not stripped
 
 0	belong		0x020c010e	HP s200 shared library
->4	beshort		>0		- version %ld
+>4	beshort		>0		- version %d
 >6	beshort		>0		- highwater %d
 >36	belong		>0		not stripped
 
 0	belong		0x020c010d	HP s200 dynamic load library
->4	beshort		>0		- version %ld
+>4	beshort		>0		- version %d
 >6	beshort		>0		- highwater %d
 >36	belong		>0		not stripped
 
@@ -192,7 +192,7 @@
 0	long		0x015821a6	HP core file
 
 0	long		0x4da7eee8	HP-WINDOWS font
->8	byte		>0		- version %ld
+>8	byte		>0		- version %d
 0	string		Bitmapfile	HP Bitmapfile
 
 0	string		IMGfile	CIS 	compimg HP Bitmapfile
diff --git a/contrib/file/Magdir/human68k b/contrib/file/magic/Magdir/human68k
similarity index 100%
rename from contrib/file/Magdir/human68k
rename to contrib/file/magic/Magdir/human68k
diff --git a/contrib/file/Magdir/ibm370 b/contrib/file/magic/Magdir/ibm370
similarity index 88%
rename from contrib/file/Magdir/ibm370
rename to contrib/file/magic/Magdir/ibm370
index 37d17bd8a54..7887dc3c5c7 100644
--- a/contrib/file/Magdir/ibm370
+++ b/contrib/file/magic/Magdir/ibm370
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: ibm370,v 1.8 2009/09/19 16:28:09 christos Exp $
+# $File: ibm370,v 1.9 2014/04/30 21:41:02 christos Exp $
 # ibm370:  file(1) magic for IBM 370 and compatibles.
 #
 # "ibm370" said that 0x15d == 0535 was "ibm 370 pure executable".
@@ -36,13 +36,13 @@
 >12	belong		>0		not stripped
 0       beshort		0531		SVR2 executable (Amdahl-UTS)
 >12	belong		>0		not stripped
->24     belong		>0		- version %ld
+>24     belong		>0		- version %d
 0	beshort		0534		SVR2 pure executable (Amdahl-UTS)
 >12	belong		>0		not stripped
->24	belong		>0		- version %ld
+>24	belong		>0		- version %d
 0	beshort		0530		SVR2 pure executable (USS/370)
 >12	belong		>0		not stripped
->24	belong		>0		- version %ld
+>24	belong		>0		- version %d
 0	beshort		0535		SVR2 executable (USS/370)
 >12	belong		>0		not stripped
->24	belong		>0		- version %ld
+>24	belong		>0		- version %d
diff --git a/contrib/file/Magdir/ibm6000 b/contrib/file/magic/Magdir/ibm6000
similarity index 58%
rename from contrib/file/Magdir/ibm6000
rename to contrib/file/magic/Magdir/ibm6000
index 72755fafc49..7f45072a187 100644
--- a/contrib/file/Magdir/ibm6000
+++ b/contrib/file/magic/Magdir/ibm6000
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: ibm6000,v 1.9 2009/09/19 16:28:09 christos Exp $
+# $File: ibm6000,v 1.12 2013/09/16 15:12:42 christos Exp $
 # ibm6000:  file(1) magic for RS/6000 and the RT PC.
 #
 0	beshort		0x01df		executable (RISC System/6000 V3.1) or obj module
@@ -18,3 +18,14 @@
 0	string		\	archive
 0	string		\	archive (big format)
 
+0	beshort		0x01f7		64-bit XCOFF executable or object module
+>20	belong		0		not stripped
+# GRR: this test is still too general as it catches also many FATs of DOS filesystems
+4	belong		&0x0feeddb0	
+# real core dump could not be 32-bit and 64-bit together
+>7	byte&0x03	!3		AIX core file
+>>1	byte		&0x01		fulldump
+>>7	byte		&0x01		32-bit
+>>>0x6e0	string	>\0		\b, %s
+>>7	byte		&0x02		64-bit
+>>>0x524	string	>\0		\b, %s
diff --git a/contrib/file/magic/Magdir/icc b/contrib/file/magic/Magdir/icc
new file mode 100644
index 00000000000..37fa30e8cb8
--- /dev/null
+++ b/contrib/file/magic/Magdir/icc
@@ -0,0 +1,51 @@
+
+#------------------------------------------------------------------------------
+# $File: icc,v 1.1 2013/01/08 01:43:18 christos Exp $
+# icc:  file(1) magic for International Color Consortium file formats
+
+#
+# Color profiles as per the ICC's "Image technology colour management -
+# Architecture, profile format, and data structure" specification.
+# See
+#
+#	http://www.color.org/specification/ICC1v43_2010-12.pdf
+#
+# for Specification ICC.1:2010 (Profile version 4.3.0.0).
+#
+# Bytes 36 to 39 contain a generic profile file signature of "acsp";
+# bytes 40 to 43 "may be used to identify the primary platform/operating
+# system framework for which the profile was created".
+#
+# There are other fields that might be worth dumping as well.
+#
+
+# This appears to be what's used for Apple ColorSync profiles.
+# Instead of adding that, Apple just changed the generic "acsp" entry
+# to be for "ColorSync ICC Color Profile" rather than "Kodak Color
+# Management System, ICC Profile".
+# Yes, it's "APPL", not "AAPL"; see the spec.
+36	string		acspAPPL	ColorSync ICC Profile
+!:mime	application/vnd.iccprofile
+
+# Microsoft ICM color profile
+36	string		acspMSFT	Microsoft ICM Color Profile
+!:mime	application/vnd.iccprofile
+
+# Yes, that's a blank after "SGI".
+36	string		acspSGI\ 	SGI ICC Profile
+!:mime	application/vnd.iccprofile
+
+# XXX - is this what's used for the Sun KCMS or not?  The standard file
+# uses just "acsp" for that, but Apple's file uses it for "ColorSync",
+# and there *is* an identified "primary platform" value of SUNW.
+36	string		acspSUNW	Sun KCMS ICC Profile
+!:mime	application/vnd.iccprofile
+
+# Any other profile.
+# XXX - should we use "acsp\0\0\0\0" for "no primary platform" profiles,
+# and use "acsp" for everything else and dump the "primary platform"
+# string in those cases?
+36	string		acsp		ICC Profile
+!:mime	application/vnd.iccprofile
+
+
diff --git a/contrib/file/Magdir/iff b/contrib/file/magic/Magdir/iff
similarity index 100%
rename from contrib/file/Magdir/iff
rename to contrib/file/magic/Magdir/iff
diff --git a/contrib/file/Magdir/images b/contrib/file/magic/Magdir/images
similarity index 75%
rename from contrib/file/Magdir/images
rename to contrib/file/magic/Magdir/images
index 1d4a0232a90..fe04b49be96 100644
--- a/contrib/file/Magdir/images
+++ b/contrib/file/magic/Magdir/images
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: images,v 1.72 2011/12/08 12:12:46 rrt Exp $
+# $File: images,v 1.91 2014/04/30 21:41:02 christos Exp $
 # images:  file(1) magic for image formats (see also "iff", and "c-lang" for
 # XPM bitmaps)
 #
@@ -18,31 +18,59 @@
 # `xv' recognizes only a subset of the following (RGB with pixelsize = 24)
 # `tgatoppm' recognizes a superset (Index may be anything)
 1	belong&0xfff7ffff	0x01010000	Targa image data - Map
+!:strength + 2
 >2	byte&8			8		- RLE
->12	leshort			>0		%hd x
->14	leshort			>0		%hd
+>12	leshort			>0		%d x
+>14	leshort			>0		%d
 1	belong&0xfff7ffff	0x00020000	Targa image data - RGB
+!:strength + 2
 >2	byte&8			8		- RLE
->12	leshort			>0		%hd x
->14	leshort			>0		%hd
+>12	leshort			>0		%d x
+>14	leshort			>0		%d
 1	belong&0xfff7ffff	0x00030000	Targa image data - Mono
+!:strength + 2
 >2	byte&8			8		- RLE
->12	leshort			>0		%hd x
->14	leshort			>0		%hd
+>12	leshort			>0		%d x
+>14	leshort			>0		%d
 
 # PBMPLUS images
 # The next byte following the magic is always whitespace.
-0	search/1	P1		Netpbm PBM image text
+# strength is changed to try these patterns before "x86 boot sector"
+0	search/1	P1		
+>3	regex		=[0-9]{0,50}\ [0-9]{0,50}		Netpbm PBM image text
+>3	regex		=[0-9]{1,50}\ 		\b, size = %sx
+>>3	regex		=\ [0-9]{1,50}	\b%s
+!:strength + 45
 !:mime	image/x-portable-bitmap
-0	search/1b	P2		Netpbm PGM image text
+0	search/1	P2		
+>3	regex		=[0-9]{0,50}\ [0-9]{0,50}		Netpbm PGM image text
+>3	regex		=[0-9]{1,50}\ 		\b, size = %sx
+>>3	regex		=\ [0-9]{1,50}	\b%s
+!:strength + 45
 !:mime	image/x-portable-greymap
-0	search/1	P3		Netpbm PPM image text
+0	search/1	P3
+>3	regex		=[0-9]{0,50}\ [0-9]{0,50}		Netpbm PPM image text
+>3	regex		=[0-9]{1,50}\ 		\b, size = %sx
+>>3	regex		=\ [0-9]{1,50}	\b%s
+!:strength + 45
 !:mime	image/x-portable-pixmap
-0	string		P4		Netpbm PBM "rawbits" image data
+0	string		P4		
+>3	regex		=[0-9]{0,50}\ [0-9]{0,50}		Netpbm PBM "rawbits" image data
+>3	regex		=[0-9]{1,50}\ 		\b, size = %sx
+>>3	regex		=\ [0-9]{1,50}	\b%s
+!:strength + 45
 !:mime	image/x-portable-bitmap
-0	string		P5		Netpbm PGM "rawbits" image data
+0	string		P5		
+>3	regex		=[0-9]{0,50}\ [0-9]{0,50}		Netpbm PGM "rawbits" image data
+>3	regex		=[0-9]{1,50}\ 		\b, size = %sx
+>>3	regex		=\ [0-9]{1,50}	\b%s
+!:strength + 45
 !:mime	image/x-portable-greymap
-0	string		P6		Netpbm PPM "rawbits" image data
+0	string		P6		
+>3	regex		=[0-9]{0,50}\ [0-9]{0,50}		Netpbm PPM "rawbits" image data
+>3	regex		=[0-9]{1,50}\ 		\b, size = %sx
+>>3	regex		=\ [0-9]{1,50}	\b%s
+!:strength + 45
 !:mime	image/x-portable-pixmap
 0	string		P7		Netpbm PAM image file
 !:mime	image/x-portable-pixmap
@@ -103,8 +131,8 @@
 #
 0	string		\x89PNG\x0d\x0a\x1a\x0a		PNG image data
 !:mime	image/png
->16	belong		x		\b, %ld x
->20	belong		x		%ld,
+>16	belong		x		\b, %d x
+>20	belong		x		%d,
 >24	byte		x		%d-bit
 >25	byte		0		grayscale,
 >25	byte		2		\b/color RGB,
@@ -139,8 +167,8 @@
 !:apple	8BIMGIFf
 >4	string		7a		\b, version 8%s,
 >4	string		9a		\b, version 8%s,
->6	leshort		>0		%hd x
->8	leshort		>0		%hd
+>6	leshort		>0		%d x
+>8	leshort		>0		%d
 #>10	byte		&0x80		color mapped,
 #>10	byte&0x07	=0x00		2 colors
 #>10	byte&0x07	=0x01		4 colors
@@ -203,8 +231,36 @@
 # From: Herbert Rosmanith 
 0	string		Sfff		structured fax file
 
+# From: Joerg Jenderek 
+# most files with the extension .EPA and some with .BMP
+0	string		\x11\x06	Award BIOS Logo, 136 x 84
+!:mime	image/x-award-bioslogo
+0	string		\x11\x09	Award BIOS Logo, 136 x 126
+!:mime	image/x-award-bioslogo
+#0	string		\x07\x1f	BIOS Logo corrupted?
+# http://www.blackfiveservices.co.uk/awbmtools.shtml
+# http://biosgfx.narod.ru/v3/
+# http://biosgfx.narod.ru/abr-2/
+0	string		AWBM		
+>4	leshort		<1981		Award BIOS bitmap
+!:mime	image/x-award-bmp
+# image width is a multiple of 4
+>>4	leshort&0x0003	0		
+>>>4		leshort	x		\b, %d
+>>>6		leshort	x		x %d
+>>4	leshort&0x0003	>0		\b,
+>>>4	leshort&0x0003	=1		
+>>>>4		leshort	x		%d+3
+>>>4	leshort&0x0003	=2		
+>>>>4		leshort	x		%d+2
+>>>4	leshort&0x0003	=3		
+>>>>4		leshort	x		%d+1
+>>>6		leshort	x		x %d
+# at offset 8 starts imagedata followed by "RGB " marker
 
 # PC bitmaps (OS/2, Windows BMP files)  (Greg Roelofs, newt@uchicago.edu)
+# http://en.wikipedia.org/wiki/BMP_file_format#DIB_header_.\
+# 28bitmap_information_header.29
 0	string		BM
 >14	leshort		12		PC bitmap, OS/2 1.x format
 !:mime	image/x-ms-bmp
@@ -219,6 +275,16 @@
 >>18	lelong		x		\b, %d x
 >>22	lelong		x		%d x
 >>28	leshort		x		%d
+>14	leshort		124		PC bitmap, Windows 98/2000 and newer format
+!:mime	image/x-ms-bmp
+>>18	lelong		x		\b, %d x
+>>22	lelong		x		%d x
+>>28	leshort		x		%d
+>14	leshort		108		PC bitmap, Windows 95/NT4 and newer format
+!:mime	image/x-ms-bmp
+>>18	lelong		x		\b, %d x
+>>22	lelong		x		%d x
+>>28	leshort		x		%d
 >14	leshort		128		PC bitmap, Windows NT/2000 format
 !:mime	image/x-ms-bmp
 >>18	lelong		x		\b, %d x
@@ -376,7 +442,7 @@
 >5	byte	0x00		(white background)
 >5	byte	0xFF		(black background)
 
-# Gürkan Sengün , www.linuks.mine.nu
+# Gurkan Sengun , www.linuks.mine.nu
 # http://www.atarimax.com/jindroush.atari.org/afmtatr.html
 0	leshort	0x0296		Atari ATR image
 
@@ -401,38 +467,39 @@
 #>12	beshort	3		RP175
 #>12	beshort	4		YUV
 
-#------------------------------------------------------------------------------
-#
-# Marco Schmidt (marcoschmidt@users.sourceforge.net) -- an image  file format
-# for the EPOC operating system, which is used with PDAs like those from Psion
-#
-# see http://huizen.dds.nl/~frodol/psiconv/html/Index.html for a description
-# of various EPOC file formats
-
-0	string \x37\x00\x00\x10\x42\x00\x00\x10\x00\x00\x00\x00\x39\x64\x39\x47 EPOC MBM image file
-
 # PCX image files
 # From: Dan Fandrich 
-0	beshort		0x0a00	PCX ver. 2.5 image data
-0	beshort		0x0a02	PCX ver. 2.8 image data, with palette
-0	beshort		0x0a03	PCX ver. 2.8 image data, without palette
-0	beshort		0x0a04	PCX for Windows image data
-0	beshort		0x0a05	PCX ver. 3.0 image data
->4	leshort		x      bounding box [%hd,
->6	leshort		x      %hd] -
->8	leshort		x      [%hd,
->10	leshort		x      %hd],
->65	byte		>1	%d planes each of
->3	byte		x	%hhd-bit
->68	byte		0	image,
->68	byte		1	colour,
->68	byte		2	grayscale,
->68	byte		>2	image,
->68	byte		<0	image,
->12	leshort		>0	%hd x
->>14	leshort		x      %hd dpi,
->2	byte		0	uncompressed
->2	byte		1	RLE compressed
+# updated by Joerg Jenderek at Feb 2013 by http://de.wikipedia.org/wiki/PCX
+# http://web.archive.org/web/20100206055706/http://www.qzx.com/pc-gpe/pcx.txt
+# GRR: original test was still too general as it catches xbase examples T5.DBT,T6.DBT with 0xa000000
+# test for bytes 0x0a,version byte (0,2,3,4,5),compression byte flag(0,1), bit depth (>0) of PCX or T5.DBT,T6.DBT
+0	ubelong&0xffF8fe00	0x0a000000	
+# for PCX bit depth > 0 
+>3	ubyte		>0	
+# test for valid versions
+>>1	ubyte		<6	
+>>>1	ubyte		!1	PCX
+!:mime	image/x-pcx
+#!:mime	image/pcx
+>>>>1	ubyte		0	ver. 2.5 image data
+>>>>1	ubyte		2	ver. 2.8 image data, with palette
+>>>>1	ubyte		3	ver. 2.8 image data, without palette
+>>>>1	ubyte		4	for Windows image data
+>>>>1	ubyte		5	ver. 3.0 image data
+>>>>4	uleshort	x	bounding box [%d,
+>>>>6	uleshort	x	%d] -
+>>>>8	uleshort	x	[%d,
+>>>>10	uleshort	x	%d],
+>>>>65	ubyte		>1	%d planes each of
+>>>>3	ubyte		x	%d-bit
+>>>>68	byte		1	colour,
+>>>>68	byte		2	grayscale,
+# this should not happen
+>>>>68	default		x	image,
+>>>>12	leshort		>0	%d x
+>>>>>14	uleshort	x	%d dpi,
+>>>>2	byte		0	uncompressed
+>>>>2	byte		1	RLE compressed
 
 # Adobe Photoshop
 # From: Asbjoern Sloth Toennesen 
@@ -554,7 +621,7 @@
 # Author: Hans-Joachim Baader 
 0		string	PaRtImAgE-VoLuMe	PartImage
 >0x0020		string	0.6.1		file version %s
->>0x0060	lelong	>-1		volume %ld
+>>0x0060	lelong	>-1		volume %d
 #>>0x0064 8 byte identifier
 #>>0x007c reserved
 >>0x0200	string	>\0		type %s
@@ -577,8 +644,8 @@
 # Kodak Cineon format for scanned negatives
 # http://www.kodak.com/US/en/motion/support/dlad/
 0	lelong  0xd75f2a80	Cineon image data
->200	belong  >0		\b, %ld x
->204	belong  >0		%ld
+>200	belong  >0		\b, %d x
+>204	belong  >0		%d
 
 
 # Bio-Rad .PIC is an image format used by microscope control systems
@@ -590,10 +657,10 @@
 14	leshort <2
 >62	leshort <2
 >>54	leshort 12345		Bio-Rad .PIC Image File
->>>0	leshort >0		%hd x
->>>2	leshort >0		%hd,
+>>>0	leshort >0		%d x
+>>>2	leshort >0		%d,
 >>>4	leshort =1		1 image in file
->>>4	leshort >1		%hd images in file
+>>>4	leshort >1		%d images in file
 
 # From Jan "Yenya" Kasprzak 
 # The description of *.mrw format can be found at
@@ -615,9 +682,61 @@
 >12	string	THUM		DjVu page thumbnails
 !:mime	image/vnd.djvu
 
+# Originally by Marc Espie
+# Modified by Robert Minsk 
+# http://www.openexr.com/openexrfilelayout.pdf
+0	lelong		20000630	OpenEXR image data,
+!:mime image/x-exr
+>4	lelong&0x000000ff x		version %d,
+>4	lelong		^0x00000200	storage: scanline
+>4	lelong		&0x00000200	storage: tiled
+>8	search/0x1000	compression\0	\b, compression:
+>>&16	byte		0		none
+>>&16	byte		1		rle
+>>&16	byte		2		zips
+>>&16	byte		3		zip
+>>&16	byte		4		piz
+>>&16	byte		5		pxr24
+>>&16	byte		6		b44
+>>&16	byte		7		b44a
+>>&16	byte		>7		unknown
+>8	 search/0x1000	dataWindow\0	\b, dataWindow:
+>>&10	lelong		x		(%d
+>>&14	lelong		x		%d)-
+>>&18	lelong		x		\b(%d
+>>&22	lelong		x		%d)
+>8	search/0x1000	displayWindow\0	\b, displayWindow:
+>>&10	lelong		x		(%d
+>>&14	lelong		x		%d)-
+>>&18	lelong		x		\b(%d
+>>&22	lelong		x		%d)
+>8	search/0x1000	lineOrder\0	 \b, lineOrder:
+>>&14	byte		0		increasing y
+>>&14	byte		1		decreasing y
+>>&14	byte		2		random y
+>>&14	byte		>2		unknown
 
-# From Marc Espie
-0	lelong	20000630		OpenEXR image data
+# SMPTE Digital Picture Exchange Format, SMPTE DPX
+#
+# ANSI/SMPTE 268M-1994, SMPTE Standard for File Format for Digital
+# Moving-Picture Exchange (DPX), v1.0, 18 February 1994
+# Robert Minsk 
+0	string		SDPX	DPX image data, big-endian,
+!:mime image/x-dpx
+>768	beshort		<4
+>>772	belong		x	%dx
+>>776	belong		x	\b%d,
+>768	beshort		>3
+>>776	belong		x	%dx
+>>772	belong		x	\b%d,
+>768	beshort		0	left to right/top to bottom
+>768	beshort		1	right to left/top to bottom
+>768	beshort		2	left to right/bottom to top
+>768	beshort		3	right to left/bottom to top
+>768	beshort		4	top to bottom/left to right
+>768	beshort		5	top to bottom/right to left
+>768	leshort		6	bottom to top/left to right
+>768	leshort		7	bottom to top/right to left
 
 # From: Tom Hilinski 
 # http://www.unidata.ucar.edu/packages/netcdf/
@@ -630,6 +749,15 @@
 !:mime	application/x-hdf
 0	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) data
 !:mime	application/x-hdf
+512	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 512 bytes user block
+!:mime	application/x-hdf
+1024	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 1k user block
+!:mime	application/x-hdf
+2048	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 2k user block
+!:mime	application/x-hdf
+4096	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 4k user block
+!:mime	application/x-hdf
+
 
 # From: Tobias Burnus 
 # Xara (for a while: Corel Xara) is a graphic package, see
@@ -665,11 +793,40 @@
 # From Tano M Fotang 
 0	string	\xff\xa0\xff\xa8\x00	Wavelet Scalar Quantization image data
 
-# JPEG 2000 Code Stream Bitmap
-# From Petr Splichal 
-0	string	\xFF\x4F\xFF\x51\x00	JPEG-2000 Code Stream Bitmap data
+# Type:		PCO B16 image files
+# URL:		http://www.pco.de/fileadmin/user_upload/db/download/MA_CWDCOPIE_0412b.pdf
+# From:		Florian Philipp 
+# Extension:	.b16
+# Description:	Pixel image format produced by PCO Camware, typically used
+#		together with PCO cameras.
+# Note:		Different versions exist for e.g. 8 bit and 16 bit images.
+#		Documentation is incomplete.
+0	string/b	PCO-	PCO B16 image data
+>12	lelong		x	\b, %dx
+>16	lelong		x	\b%d
+>20	lelong		0	\b, short header
+>20	lelong		-1	\b, extended header
+>>24	lelong		0	\b, grayscale
+>>>36	lelong		0	linear LUT
+>>>36	lelong		1	logarithmic LUT
+>>>28	lelong		x	[%d
+>>>32	lelong		x	\b,%d]
+>>24	lelong		1	\b, color
+>>>64	lelong		0	linear LUT
+>>>64	lelong		1	logarithmic LUT
+>>>40	lelong		x	r[%d
+>>>44	lelong		x	\b,%d]
+>>>48	lelong		x	g[%d
+>>>52	lelong		x	\b,%d]
+>>>56	lelong		x	b[%d
+>>>60	lelong		x	\b,%d]
 
-# From: Rick Richardson 
+# Polar Monitor Bitmap (.pmb) used as logo for Polar Electro watches
+# From: Markus Heidelberg 
+0	string/t	[BitmapInfo2]	Polar Monitor Bitmap text
+!:mime	image/x-polar-monitor-bitmap
+
+# From: Rick Richardson 
 0	string	GARMIN\ BITMAP\ 01	Garmin Bitmap file
 
 # Type:	Ulead Photo Explorer5 (.pe5)
@@ -733,3 +890,8 @@
 # Not really an image.
 # From: "Tano M. Fotang" 
 0	string	\x46\x4d\x52\x00	ISO/IEC 19794-2 Format Minutiae Record (FMR)
+
+# WEBP https://developers.google.com/speed/webp/docs/riff_container
+0	string	RIFF
+>8	string	WEBP	Web/P image data
+>>4	lelong	x	\b, %d bytes
diff --git a/contrib/file/Magdir/inform b/contrib/file/magic/Magdir/inform
similarity index 100%
rename from contrib/file/Magdir/inform
rename to contrib/file/magic/Magdir/inform
diff --git a/contrib/file/Magdir/intel b/contrib/file/magic/Magdir/intel
similarity index 86%
rename from contrib/file/Magdir/intel
rename to contrib/file/magic/Magdir/intel
index 47812a0ea35..9fa90f47844 100644
--- a/contrib/file/Magdir/intel
+++ b/contrib/file/magic/Magdir/intel
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: intel,v 1.10 2011/03/30 19:51:00 christos Exp $
+# $File: intel,v 1.12 2014/04/30 21:41:02 christos Exp $
 # intel:  file(1) magic for x86 Unix
 #
 # Various flavors of x86 UNIX executable/object (other than Xenix, which
@@ -16,28 +16,28 @@
 #
 0	leshort		0502		basic-16 executable
 >12	lelong		>0		not stripped
-#>22	leshort		>0		- version %ld
+#>22	leshort		>0		- version %d
 0	leshort		0503		basic-16 executable (TV)
 >12	lelong		>0		not stripped
-#>22	leshort		>0		- version %ld
+#>22	leshort		>0		- version %d
 0	leshort		0510		x86 executable
 >12	lelong		>0		not stripped
 0	leshort		0511		x86 executable (TV)
 >12	lelong		>0		not stripped
 0	leshort		=0512		iAPX 286 executable small model (COFF)
 >12	lelong		>0		not stripped
-#>22	leshort		>0		- version %ld
+#>22	leshort		>0		- version %d
 0	leshort		=0522		iAPX 286 executable large model (COFF)
 >12	lelong		>0		not stripped
-#>22	leshort		>0		- version %ld
+#>22	leshort		>0		- version %d
 # SGI labeled the next entry as "iAPX 386 executable" --Dan Quinlan
 0	leshort		=0514		80386 COFF executable
 >12	lelong		>0		not stripped
->22	leshort		>0		- version %ld
+>22	leshort		>0		- version %d
 
 # rom: file(1) magic for BIOS ROM Extensions found in intel machines
 #      mapped into memory between 0xC0000 and 0xFFFFF
-# From Gürkan Sengün , www.linuks.mine.nu
+# From Gurkan Sengun , www.linuks.mine.nu
 0        beshort         0x55AA       BIOS (ia32) ROM Ext.
 >5       string          USB          USB
 >7       string          LDR          UNDI image
diff --git a/contrib/file/Magdir/interleaf b/contrib/file/magic/Magdir/interleaf
similarity index 100%
rename from contrib/file/Magdir/interleaf
rename to contrib/file/magic/Magdir/interleaf
diff --git a/contrib/file/Magdir/island b/contrib/file/magic/Magdir/island
similarity index 100%
rename from contrib/file/Magdir/island
rename to contrib/file/magic/Magdir/island
diff --git a/contrib/file/Magdir/ispell b/contrib/file/magic/Magdir/ispell
similarity index 100%
rename from contrib/file/Magdir/ispell
rename to contrib/file/magic/Magdir/ispell
diff --git a/contrib/file/Magdir/isz b/contrib/file/magic/Magdir/isz
similarity index 89%
rename from contrib/file/Magdir/isz
rename to contrib/file/magic/Magdir/isz
index 316bbd4acf6..3388a82a5b9 100644
--- a/contrib/file/Magdir/isz
+++ b/contrib/file/magic/Magdir/isz
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: isz,v 1.1 2010/03/27 16:17:09 christos Exp $
+# $File: isz,v 1.3 2014/04/30 21:41:02 christos Exp $
 # ISO Zipped file format 
 # http://www.ezbsystems.com/isz/iszspec.txt
 0	string	IsZ!	ISO Zipped file
diff --git a/contrib/file/Magdir/java b/contrib/file/magic/Magdir/java
similarity index 63%
rename from contrib/file/Magdir/java
rename to contrib/file/magic/Magdir/java
index 0aca86a5e19..b09302ee65d 100644
--- a/contrib/file/Magdir/java
+++ b/contrib/file/magic/Magdir/java
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------
-# $File: java,v 1.13 2011/12/08 12:12:46 rrt Exp $
+# $File: java,v 1.16 2013/09/24 20:22:03 christos Exp $
 # Java ByteCode and Mach-O binaries (e.g., Mac OS X) use the
 # same magic number, 0xcafebabe, so they are both handled
 # in the entry called "cafebabe".
@@ -15,15 +15,6 @@
 0	belong		0xcececece	Java JCE KeyStore
 !:mime	application/x-java-jce-keystore
 
-# Dalvik .dex format. http://retrodev.com/android/dexformat.html
-# From  "Mike Fleming"
-0	string	dex\n
->0	regex	dex\n[0-9][0-9][0-9]\0	Dalvik dex file
->4	string	>000			version %s
-0	string	dey\n
->0	regex	dey\n[0-9][0-9][0-9]\0	Dalvik dex file (optimized for host)
->4	string	>000			version %s
-
 # Java source
 0	regex	^import.*;$	Java source
 !:mime	text/x-java
diff --git a/contrib/file/magic/Magdir/javascript b/contrib/file/magic/Magdir/javascript
new file mode 100644
index 00000000000..8f664533a1f
--- /dev/null
+++ b/contrib/file/magic/Magdir/javascript
@@ -0,0 +1,17 @@
+
+#------------------------------------------------------------------------------
+# $File: javascript,v 1.1 2012/06/16 13:30:36 christos Exp $
+# javascript:  magic for javascript and node.js scripts.
+#
+0	search/1/w	#!/bin/node		Node.js script text executable
+!:mime application/javascript
+0	search/1/w	#!/usr/bin/node		Node.js script text executable
+!:mime application/javascript
+0	search/1/w	#!/bin/nodejs		Node.js script text executable
+!:mime application/javascript
+0	search/1/w	#!/usr/bin/nodejs	Node.js script text executable
+!:mime application/javascript
+0	search/1	#!/usr/bin/env\ node	Node.js script text executable
+!:mime application/javascript
+0	search/1	#!/usr/bin/env\ nodejs	Node.js script text executable
+!:mime application/javascript
diff --git a/contrib/file/Magdir/jpeg b/contrib/file/magic/Magdir/jpeg
similarity index 90%
rename from contrib/file/Magdir/jpeg
rename to contrib/file/magic/Magdir/jpeg
index 7814245add3..bc8b3426643 100644
--- a/contrib/file/Magdir/jpeg
+++ b/contrib/file/magic/Magdir/jpeg
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: jpeg,v 1.16 2011/01/04 19:29:32 rrt Exp $
+# $File: jpeg,v 1.19 2013/02/04 15:50:03 christos Exp $
 # JPEG images
 # SunOS 5.5.1 had
 #
@@ -12,7 +12,7 @@
 0	beshort		0xffd8		JPEG image data
 !:mime	image/jpeg
 !:apple	8BIMJPEG
-!:strength +1
+!:strength +2
 >6	string		JFIF		\b, JFIF standard
 # The following added by Erik Rossen  1999-09-06
 # in a vain attempt to add image size reporting for JFIF.  Note that these
@@ -153,7 +153,20 @@
 0	string		hsi1		JPEG image data, HSI proprietary
 
 # From: David Santinoli 
-0	string		\x00\x00\x00\x0C\x6A\x50\x20\x20\x0D\x0A\x87\x0A	JPEG 2000 image data
+0	string		\x00\x00\x00\x0C\x6A\x50\x20\x20\x0D\x0A\x87\x0A	JPEG 2000
+# From: Johan van der Knijff 
+# Added sub-entries for JP2, JPX, JPM and MJ2 formats; added mimetypes
+# https://github.com/bitsgalore/jp2kMagic
+#
+# Now read value of 'Brand' field, which yields a few possibilities:
+>20	string		\x6a\x70\x32\x20	Part 1 (JP2)
+!:mime	image/jp2
+>20	string		\x6a\x70\x78\x20	Part 2 (JPX)
+!:mime	image/jpx
+>20	string		\x6a\x70\x6d\x20	Part 6 (JPM)
+!:mime	image/jpm
+>20	string		\x6d\x6a\x70\x32	Part 3 (MJ2)
+!:mime	video/mj2
 
 # Type: JPEG 2000 codesream
 # From: Mathieu Malaterre 
diff --git a/contrib/file/Magdir/karma b/contrib/file/magic/Magdir/karma
similarity index 74%
rename from contrib/file/Magdir/karma
rename to contrib/file/magic/Magdir/karma
index 007a4b74b22..47d5d97304a 100644
--- a/contrib/file/Magdir/karma
+++ b/contrib/file/magic/Magdir/karma
@@ -1,9 +1,9 @@
 
 #------------------------------------------------------------------------------
-# $File: karma,v 1.6 2009/09/19 16:28:10 christos Exp $
+# $File: karma,v 1.7 2014/04/30 21:41:02 christos Exp $
 # karma:  file(1) magic for Karma data files
 #
 # From 
 
 0	string		KarmaRHD Version	Karma Data Structure Version
->16	belong		x		%lu
+>16	belong		x		%u
diff --git a/contrib/file/Magdir/kde b/contrib/file/magic/Magdir/kde
similarity index 100%
rename from contrib/file/Magdir/kde
rename to contrib/file/magic/Magdir/kde
diff --git a/contrib/file/magic/Magdir/keepass b/contrib/file/magic/Magdir/keepass
new file mode 100644
index 00000000000..ba132d57de8
--- /dev/null
+++ b/contrib/file/magic/Magdir/keepass
@@ -0,0 +1,20 @@
+
+#------------------------------------------------------------------------------
+# $File: keepass,v 1.1 2012/12/24 22:14:56 christos Exp $
+# keepass: file(1) magic for KeePass file
+#
+# Keepass Password Safe:
+#  * original one: http://keepass.info/
+#  * *nix port:    http://www.keepassx.org/
+#  * android port: http://code.google.com/p/keepassdroid/
+
+0	lelong		0x9AA2D903	Keepass password database
+>4	lelong		0xB54BFB65	1.x KDB
+>>48	lelong		>0		\b, %d groups
+>>52	lelong		>0		\b, %d entries
+>>8	lelong&0x0f	1		\b, SHA-256
+>>8	lelong&0x0f	2		\b, AES
+>>8	lelong&0x0f	4		\b, RC4
+>>8	lelong&0x0f	8		\b, Twofish
+>>120	lelong		>0		\b, %d key transformation rounds
+>4	lelong		0xB54BFB67	2.x KDBX
diff --git a/contrib/file/Magdir/kml b/contrib/file/magic/Magdir/kml
similarity index 100%
rename from contrib/file/Magdir/kml
rename to contrib/file/magic/Magdir/kml
diff --git a/contrib/file/Magdir/lecter b/contrib/file/magic/Magdir/lecter
similarity index 100%
rename from contrib/file/Magdir/lecter
rename to contrib/file/magic/Magdir/lecter
diff --git a/contrib/file/Magdir/lex b/contrib/file/magic/Magdir/lex
similarity index 100%
rename from contrib/file/Magdir/lex
rename to contrib/file/magic/Magdir/lex
diff --git a/contrib/file/Magdir/lif b/contrib/file/magic/Magdir/lif
similarity index 100%
rename from contrib/file/Magdir/lif
rename to contrib/file/magic/Magdir/lif
diff --git a/contrib/file/Magdir/linux b/contrib/file/magic/Magdir/linux
similarity index 82%
rename from contrib/file/Magdir/linux
rename to contrib/file/magic/Magdir/linux
index 8d4c60adfd9..c2b17627b4e 100644
--- a/contrib/file/Magdir/linux
+++ b/contrib/file/magic/Magdir/linux
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: linux,v 1.42 2012/02/07 21:35:03 christos Exp $
+# $File: linux,v 1.57 2014/05/20 20:10:17 christos Exp $
 # linux:  file(1) magic for Linux files
 #
 # Values for Linux/i386 binaries, from Daniel Quinlan 
@@ -36,8 +36,11 @@
 >28	long		!0		not stripped
 0	string		\01\03\040\20	Minix-386 executable
 >28	long		!0		not stripped
+0	string		\01\03\04\20	Minix-386 NSYM/GNU executable
+>28	long		!0		not stripped
 # core dump file, from Bill Reynolds 
 216	lelong		0421		Linux/i386 core file
+!:strength / 2
 >220	string		>\0		of '%s'
 >200	lelong		>0		(signal %d)
 #
@@ -46,7 +49,10 @@
 2	string		LILO		Linux/i386 LILO boot/chain loader
 #
 # Linux make config build file, from Ole Aamot 
-28 	string		make\ config	Linux make config build file
+# Updated by Ken Sharp
+28	string		make\ config		Linux make config build file (old)
+49	search/70	Kernel\ Configuration	Linux make config build file
+
 #
 # PSF fonts, from H. Peter Anvin 
 # Updated by Adam Buchbinder 
@@ -88,18 +94,21 @@
 # From Daniel Novotny 
 # swap file for PowerPC
 65526	string		SWAPSPACE2	Linux/ppc swap file
+16374	string		SWAPSPACE2	Linux/ia64 swap file
 #
 # Linux kernel boot images, from Albert Cahalan 
 # and others such as Axel Kohlmeyer 
-# and Nicols Lichtmaier 
+# and Nicolas Lichtmaier 
 # All known start with: b8 c0 07 8e d8 b8 00 90 8e c0 b9 00 01 29 f6 29
 # Linux kernel boot images (i386 arch) (Wolfram Kleff)
 514	string		HdrS		Linux kernel
+!:strength + 55
 >510	leshort		0xAA55		x86 boot executable
 >>518	leshort		>0x1ff
 >>>529	byte		0		zImage,
 >>>529	byte		1		bzImage,
->>>(526.s+0x200) string	>\0		version %s,
+>>>526	lelong		>0
+>>>>(526.s+0x200) string	>\0	version %s,
 >>498	leshort		1		RO-rootFS,
 >>498	leshort		0		RW-rootFS,
 >>508	leshort		>0		root_dev 0x%X,
@@ -114,10 +123,10 @@
 >0x1e3		string	Loading		version 1.3.79 or older
 >0x1e9		string	Loading		from prehistoric times
 
-# System.map files - Nicols Lichtmaier 
+# System.map files - Nicolas Lichtmaier 
 8	search/1	\ A\ _text	Linux kernel symbol map text
 
-# LSM entries - Nicols Lichtmaier 
+# LSM entries - Nicolas Lichtmaier 
 0	search/1	Begin3	Linux Software Map entry text
 0	search/1	Begin4	Linux Software Map entry text (new format)
 
@@ -213,9 +222,11 @@
 # 0	lelong&0xFF00FFFF 0x17000301	ld86 SPARC executable
 
 # SYSLINUX boot logo files (from 'ppmtolss16' sources)
-# http://syslinux.zytor.com/
-#
+# http://www.syslinux.org/wiki/index.php/SYSLINUX#Display_graphic_from_filename:
+# file extension .lss .16
 0	lelong	=0x1413f33d		SYSLINUX' LSS16 image data
+# syslinux-4.05/mime/image/x-lss16.xml
+!:mime image/x-lss16
 >4	leshort	x			\b, width %d
 >6	leshort	x			\b, height %d
 
@@ -338,3 +349,67 @@
 #>2	regex		\(name\ [^)]*\)		%s
 >20	search/256	(name			(name
 >>&1	string		x			%s...)
+
+# Systemd journald files
+# See http://www.freedesktop.org/wiki/Software/systemd/journal-files/.
+# From: Zbigniew Jedrzejewski-Szmek 
+
+# check magic
+0	string	LPKSHHRH
+# check that state is one of known values
+>16		ubyte&252	0
+# check that each half of three unique id128s is non-zero
+>>24		ubequad		>0
+>>>32		ubequad		>0
+>>>>40		ubequad		>0
+>>>>>48		ubequad		>0
+>>>>>>56	ubequad		>0
+>>>>>>>64	ubequad		>0	Journal file
+!:mime application/octet-stream
+# provide more info
+>>>>>>>>184	leqdate		0	empty
+>>>>>>>>16	ubyte		0	\b, offline
+>>>>>>>>16	ubyte		1	\b, online
+>>>>>>>>16	ubyte		2	\b, archived
+>>>>>>>>8	ulelong&1	1	\b, sealed
+>>>>>>>>12	ulelong&1	1	\b, compressed
+
+# BCache backing and cache devices
+# From: Gabriel de Perthuis 
+0x1008		lequad		8
+>0x1018		string		\xc6\x85\x73\xf6\x4e\x1a\x45\xca\x82\x65\xf5\x7f\x48\xba\x6d\x81	BCache
+>>0x1010	ulequad		0	cache device
+>>0x1010	ulequad		1	backing device
+>>0x1010	ulequad		3	cache device
+>>0x1010	ulequad		4	backing device
+>>0x1048	string		>0	\b, label "%.32s"
+>>0x1028	ubelong		x	\b, uuid %08x
+>>0x102c	ubeshort	x	\b-%04x
+>>0x102e	ubeshort	x	\b-%04x
+>>0x1030	ubeshort	x	\b-%04x
+>>0x1032	ubelong		x	\b-%08x
+>>0x1036	ubeshort	x	\b%04x
+>>0x1038	ubelong		x	\b, set uuid %08x
+>>0x103c	ubeshort	x	\b-%04x
+>>0x103e	ubeshort	x	\b-%04x
+>>0x1040	ubeshort	x	\b-%04x
+>>0x1042	ubelong		x	\b-%08x
+>>0x1046	ubeshort	x	\b%04x
+
+# Linux device tree:
+# File format description can be found in the Linux kernel sources at 
+# Documentation/devicetree/booting-without-of.txt
+# From Christoph Biedl
+0		belong		0xd00dfeed
+# structure and strings must be within blob
+>&(8.L)		byte		x
+>>&(12.L)	byte		x
+>>>20		belong		>1	Device Tree Blob version %d
+>>>>4		belong		x	\b, size=%d
+>>>>20		belong		>1
+>>>>>28		belong		x	\b, boot CPU=%d
+>>>>20		belong		>2
+>>>>>32		belong		x	\b, string block size=%d
+>>>>20		belong		>16
+>>>>>36		belong		x	\b, DT structure block size=%d
+
diff --git a/contrib/file/Magdir/lisp b/contrib/file/magic/Magdir/lisp
similarity index 100%
rename from contrib/file/Magdir/lisp
rename to contrib/file/magic/Magdir/lisp
diff --git a/contrib/file/Magdir/llvm b/contrib/file/magic/Magdir/llvm
similarity index 55%
rename from contrib/file/Magdir/llvm
rename to contrib/file/magic/Magdir/llvm
index 44a40094036..1f15eac7b52 100644
--- a/contrib/file/Magdir/llvm
+++ b/contrib/file/magic/Magdir/llvm
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: llvm,v 1.5 2010/09/20 18:55:20 rrt Exp $
+# $File: llvm,v 1.8 2013/01/12 03:09:51 christos Exp $
 # llvm:  file(1) magic for LLVM byte-codes
 # URL:  http://llvm.org/docs/BitCodeFormat.html
 # From: Al Stone 
@@ -9,5 +9,13 @@
 0	string	llvc0	LLVM byte-codes, null compression
 0	string	llvc1	LLVM byte-codes, gzip compression
 0	string	llvc2	LLVM byte-codes, bzip2 compression
-0	string	\xde\xc0\x17\x0b	LLVM bitcode, wrapper
-0       string	BC\xc0\xde	LLVM bitcode
+
+0	lelong	0x0b17c0de	LLVM bitcode, wrapper
+# Are these Mach-O ABI values?  They appear to be.
+>16	lelong	0x01000007	x86_64
+>16	lelong	0x00000007	i386
+>16	lelong	0x00000012	ppc
+>16	lelong	0x01000012	ppc64
+>16	lelong 	0x0000000c	arm
+
+0	string	BC\xc0\xde	LLVM IR bitcode
diff --git a/contrib/file/Magdir/lua b/contrib/file/magic/Magdir/lua
similarity index 92%
rename from contrib/file/Magdir/lua
rename to contrib/file/magic/Magdir/lua
index fbb9f09dabf..4c578be60ff 100644
--- a/contrib/file/Magdir/lua
+++ b/contrib/file/magic/Magdir/lua
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: lua,v 1.5 2009/09/19 16:28:10 christos Exp $
+# $File: lua,v 1.6 2013/01/09 16:23:17 christos Exp $
 # lua:  file(1) magic for Lua scripting language
 # URL:  http://www.lua.org/
 # From: Reuben Thomas , Seo Sanghyeon 
diff --git a/contrib/file/Magdir/luks b/contrib/file/magic/Magdir/luks
similarity index 100%
rename from contrib/file/Magdir/luks
rename to contrib/file/magic/Magdir/luks
diff --git a/contrib/file/Magdir/m4 b/contrib/file/magic/Magdir/m4
similarity index 100%
rename from contrib/file/Magdir/m4
rename to contrib/file/magic/Magdir/m4
diff --git a/contrib/file/magic/Magdir/mach b/contrib/file/magic/Magdir/mach
new file mode 100644
index 00000000000..23b9f8a1260
--- /dev/null
+++ b/contrib/file/magic/Magdir/mach
@@ -0,0 +1,214 @@
+
+#------------------------------------------------------------
+# $File: mach,v 1.19 2014/04/30 21:41:02 christos Exp $
+# Mach has two magic numbers, 0xcafebabe and 0xfeedface.
+# Unfortunately the first, cafebabe, is shared with
+# Java ByteCode, so they are both handled in the file "cafebabe".
+# The "feedface" ones are handled herein.
+#------------------------------------------------------------
+# if set, it's for the 64-bit version of the architecture
+# yes, this is separate from the low-order magic number bit
+# it's also separate from the "64-bit libraries" bit in the
+# upper 8 bits of the CPU subtype
+
+0	name	mach-o-cpu
+>0	belong&0x01000000	0
+#
+# 32-bit ABIs.
+#
+#				1	vax
+>>0	belong&0x00ffffff	1
+>>>4		belong&0x00ffffff	0	vax
+>>>4		belong&0x00ffffff	1	vax11/780
+>>>4		belong&0x00ffffff	2	vax11/785
+>>>4		belong&0x00ffffff	3	vax11/750
+>>>4		belong&0x00ffffff	4	vax11/730
+>>>4		belong&0x00ffffff	5	uvaxI
+>>>4		belong&0x00ffffff	6	uvaxII
+>>>4		belong&0x00ffffff	7	vax8200
+>>>4		belong&0x00ffffff	8	vax8500
+>>>4		belong&0x00ffffff	9	vax8600
+>>>4		belong&0x00ffffff	10	vax8650
+>>>4		belong&0x00ffffff	11	vax8800
+>>>4		belong&0x00ffffff	12	uvaxIII
+>>>4		belong&0x00ffffff	>12	vax subarchitecture=%d
+>>0	belong&0x00ffffff	2	romp
+>>0	belong&0x00ffffff	3	architecture=3
+>>0	belong&0x00ffffff	4	ns32032
+>>0	belong&0x00ffffff	5	ns32332
+>>0	belong&0x00ffffff	6	m68k
+#				7	x86
+>>0	belong&0x00ffffff	7
+>>>4	belong&0x0000000f	3		i386
+>>>4	belong&0x0000000f	4		i486
+>>>>4	belong&0x00fffff0	0
+>>>>4	belong&0x00fffff0	0x80		\bsx
+>>>4	belong&0x0000000f	5		i586
+>>>4	belong&0x0000000f	6
+>>>>4	belong&0x00fffff0	0		p6
+>>>>4	belong&0x00fffff0	0x10		pentium_pro
+>>>>4	belong&0x00fffff0	0x20		pentium_2_m0x20
+>>>>4	belong&0x00fffff0	0x30		pentium_2_m3
+>>>>4	belong&0x00fffff0	0x40		pentium_2_m0x40
+>>>>4	belong&0x00fffff0	0x50		pentium_2_m5
+>>>>4	belong&0x00fffff0	>0x50		pentium_2_m0x%x
+>>>4	belong&0x0000000f	7		celeron
+>>>>4	belong&0x00fffff0	0x00		\b_m0x%x
+>>>>4	belong&0x00fffff0	0x10		\b_m0x%x
+>>>>4	belong&0x00fffff0	0x20		\b_m0x%x
+>>>>4	belong&0x00fffff0	0x30		\b_m0x%x
+>>>>4	belong&0x00fffff0	0x40		\b_m0x%x
+>>>>4	belong&0x00fffff0	0x50		\b_m0x%x
+>>>>4	belong&0x00fffff0	0x60
+>>>>4	belong&0x00fffff0	0x70		\b_mobile
+>>>>4	belong&0x00fffff0	>0x70		\b_m0x%x
+>>>4	belong&0x0000000f	8		pentium_3
+>>>>4	belong&0x00fffff0	0x00
+>>>>4	belong&0x00fffff0	0x10		\b_m
+>>>>4	belong&0x00fffff0	0x20		\b_xeon
+>>>>4	belong&0x00fffff0	>0x20		\b_m0x%x
+>>>4	belong&0x0000000f	9		pentiumM
+>>>>4	belong&0x00fffff0	0x00
+>>>>4	belong&0x00fffff0	>0x00		\b_m0x%x
+>>>4	belong&0x0000000f	10		pentium_4
+>>>>4	belong&0x00fffff0	0x00
+>>>>4	belong&0x00fffff0	0x10		\b_m
+>>>>4	belong&0x00fffff0	>0x10		\b_m0x%x
+>>>4	belong&0x0000000f	11		itanium
+>>>>4	belong&0x00fffff0	0x00
+>>>>4	belong&0x00fffff0	0x10		\b_2
+>>>>4	belong&0x00fffff0	>0x10		\b_m0x%x
+>>>4	belong&0x0000000f	12		xeon
+>>>>4	belong&0x00fffff0	0x00
+>>>>4	belong&0x00fffff0	0x10		\b_mp
+>>>>4	belong&0x00fffff0	>0x10		\b_m0x%x
+>>>4	belong&0x0000000f	>12		ia32 family=%d
+>>>>4	belong&0x00fffff0	0x00
+>>>>4	belong&0x00fffff0	>0x00		model=%x
+>>0	belong&0x00ffffff	8	mips
+>>>4		belong&0x00ffffff	1	R2300
+>>>4		belong&0x00ffffff	2	R2600
+>>>4		belong&0x00ffffff	3	R2800
+>>>4		belong&0x00ffffff	4	R2000a
+>>>4		belong&0x00ffffff	5	R2000
+>>>4		belong&0x00ffffff	6	R3000a
+>>>4		belong&0x00ffffff	7	R3000
+>>>4		belong&0x00ffffff	>7	subarchitecture=%d
+>>0	belong&0x00ffffff	9	ns32532
+>>0	belong&0x00ffffff	10	mc98000
+>>0	belong&0x00ffffff	11	hppa
+>>>4		belong&0x00ffffff	0	7100
+>>>4		belong&0x00ffffff	1	7100LC
+>>>4		belong&0x00ffffff	>1	subarchitecture=%d
+>>0	belong&0x00ffffff	12	arm
+>>>4		belong&0x00ffffff	0
+>>>4		belong&0x00ffffff	1	subarchitecture=%d
+>>>4		belong&0x00ffffff	2	subarchitecture=%d
+>>>4		belong&0x00ffffff	3	subarchitecture=%d
+>>>4		belong&0x00ffffff	4	subarchitecture=%d
+>>>4		belong&0x00ffffff	5	\b_v4t
+>>>4		belong&0x00ffffff	6	\b_v6
+>>>4		belong&0x00ffffff	7	\b_v5tej
+>>>4		belong&0x00ffffff	8	\b_xscale
+>>>4		belong&0x00ffffff	9	\b_v7
+>>>4		belong&0x00ffffff	10	\b_v7f
+>>>4		belong&0x00ffffff	11	subarchitecture=%d
+>>>4		belong&0x00ffffff	12	\b_v7k
+>>>4		belong&0x00ffffff	>12	subarchitecture=%d
+#				13	m88k
+>>0	belong&0x00ffffff	13
+>>>4		belong&0x00ffffff	0	mc88000
+>>>4		belong&0x00ffffff	1	mc88100
+>>>4		belong&0x00ffffff	2	mc88110
+>>>4		belong&0x00ffffff	>2	mc88000 subarchitecture=%d
+>>0	belong&0x00ffffff	14	SPARC
+>>0	belong&0x00ffffff	15	i860g
+>>0	belong&0x00ffffff	16	alpha
+>>0	belong&0x00ffffff	17	rs6000
+>>0	belong&0x00ffffff	18	ppc
+>>>4		belong&0x00ffffff	0
+>>>4		belong&0x00ffffff	1	\b_601
+>>>4		belong&0x00ffffff	2	\b_602
+>>>4		belong&0x00ffffff	3	\b_603
+>>>4		belong&0x00ffffff	4	\b_603e
+>>>4		belong&0x00ffffff	5	\b_603ev
+>>>4		belong&0x00ffffff	6	\b_604
+>>>4		belong&0x00ffffff	7	\b_604e
+>>>4		belong&0x00ffffff	8	\b_620
+>>>4		belong&0x00ffffff	9	\b_650
+>>>4		belong&0x00ffffff	10	\b_7400
+>>>4		belong&0x00ffffff	11	\b_7450
+>>>4		belong&0x00ffffff	100	\b_970
+>>>4		belong&0x00ffffff	>100	subarchitecture=%d
+>>0	belong&0x00ffffff	>18	architecture=%d
+>0	belong&0x01000000	0x01000000
+#
+# 64-bit ABIs.
+#
+>>0	belong&0x00ffffff	0	64-bit architecture=%d
+>>0	belong&0x00ffffff	1	64-bit architecture=%d
+>>0	belong&0x00ffffff	2	64-bit architecture=%d
+>>0	belong&0x00ffffff	3	64-bit architecture=%d
+>>0	belong&0x00ffffff	4	64-bit architecture=%d
+>>0	belong&0x00ffffff	5	64-bit architecture=%d
+>>0	belong&0x00ffffff	6	64-bit architecture=%d
+>>0	belong&0x00ffffff	7	x86_64
+>>>4		belong&0x00ffffff	0	subarchitecture=%d
+>>>4		belong&0x00ffffff	1	subarchitecture=%d
+>>>4		belong&0x00ffffff	2	subarchitecture=%d
+>>>4		belong&0x00ffffff	3
+>>>4		belong&0x00ffffff	4	\b_arch1
+>>>4		belong&0x00ffffff	>4	subarchitecture=%d
+>>0	belong&0x00ffffff	8	64-bit architecture=%d
+>>0	belong&0x00ffffff	9	64-bit architecture=%d
+>>0	belong&0x00ffffff	10	64-bit architecture=%d
+>>0	belong&0x00ffffff	11	64-bit architecture=%d
+>>0	belong&0x00ffffff	12	64-bit architecture=%d
+>>0	belong&0x00ffffff	13	64-bit architecture=%d
+>>0	belong&0x00ffffff	14	64-bit architecture=%d
+>>0	belong&0x00ffffff	15	64-bit architecture=%d
+>>0	belong&0x00ffffff	16	64-bit architecture=%d
+>>0	belong&0x00ffffff	17	64-bit architecture=%d
+>>0	belong&0x00ffffff	18	ppc64
+>>>4		belong&0x00ffffff	0
+>>>4		belong&0x00ffffff	1		\b_601
+>>>4		belong&0x00ffffff	2		\b_602
+>>>4		belong&0x00ffffff	3		\b_603
+>>>4		belong&0x00ffffff	4		\b_603e
+>>>4		belong&0x00ffffff	5		\b_603ev
+>>>4		belong&0x00ffffff	6		\b_604
+>>>4		belong&0x00ffffff	7		\b_604e
+>>>4		belong&0x00ffffff	8		\b_620
+>>>4		belong&0x00ffffff	9		\b_650
+>>>4		belong&0x00ffffff	10		\b_7400
+>>>4		belong&0x00ffffff	11		\b_7450
+>>>4		belong&0x00ffffff	100		\b_970
+>>>4		belong&0x00ffffff	>100		subarchitecture=%d
+>>0	belong&0x00ffffff	>18	64-bit architecture=%d
+
+
+0	name		mach-o-be
+>0	byte		0xcf		64-bit
+>4	use		mach-o-cpu
+>12	belong		1		object
+>12	belong		2		executable
+>12	belong		3		fixed virtual memory shared library
+>12	belong		4		core
+>12	belong		5		preload executable
+>12	belong		6		dynamically linked shared library
+>12	belong		7		dynamic linker
+>12	belong		8		bundle
+>12	belong		9		dynamically linked shared library stub
+>12	belong		10		dSYM companion file
+>12	belong		11		kext bundle
+>12	belong		>11
+>>12	belong		x		filetype=%d
+
+#
+0	lelong&0xfffffffe	0xfeedface	Mach-O
+!:strength +1
+>0	use	\^mach-o-be
+
+0	belong&0xfffffffe	0xfeedface	Mach-O
+!:strength +1
+>0	use	mach-o-be
diff --git a/contrib/file/Magdir/macintosh b/contrib/file/magic/Magdir/macintosh
similarity index 99%
rename from contrib/file/Magdir/macintosh
rename to contrib/file/magic/Magdir/macintosh
index b9933b1b497..d86fd8f4fdc 100644
--- a/contrib/file/Magdir/macintosh
+++ b/contrib/file/magic/Magdir/macintosh
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: macintosh,v 1.22 2011/05/17 17:40:31 rrt Exp $
+# $File: macintosh,v 1.23 2013/11/19 18:47:58 christos Exp $
 # macintosh description
 #
 # BinHex is the Macintosh ASCII-encoded file format (see also "apple")
@@ -263,6 +263,9 @@
 0	string		$FL2		SPSS System File
 >24	string		x		%s
 
+0	string		$FL3		SPSS System File
+>24	string		x		%s
+
 # Macintosh filesystem data
 # From "Tom N Harris" 
 # Fixed HFS+ and Partition map magic: Ethan Benson 
diff --git a/contrib/file/magic/Magdir/macos b/contrib/file/magic/Magdir/macos
new file mode 100644
index 00000000000..0bacc13a487
--- /dev/null
+++ b/contrib/file/magic/Magdir/macos
@@ -0,0 +1,7 @@
+
+#------------------------------------------------------------------------------
+# $File: macos,v 1.1 2012/12/21 16:41:07 christos Exp $
+# MacOS files
+#
+
+0	string		book\0\0\0\0mark\0\0\0\0	MacOS Alias file
diff --git a/contrib/file/Magdir/magic b/contrib/file/magic/Magdir/magic
similarity index 100%
rename from contrib/file/Magdir/magic
rename to contrib/file/magic/Magdir/magic
diff --git a/contrib/file/Magdir/mail.news b/contrib/file/magic/Magdir/mail.news
similarity index 92%
rename from contrib/file/Magdir/mail.news
rename to contrib/file/magic/Magdir/mail.news
index f4bb1f55e90..7a8123af149 100644
--- a/contrib/file/Magdir/mail.news
+++ b/contrib/file/magic/Magdir/mail.news
@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: mail.news,v 1.20 2011/12/08 12:12:46 rrt Exp $
+# $File: mail.news,v 1.22 2013/01/04 14:22:07 christos Exp $
 # mail.news:  file(1) magic for mail and news
 #
 # Unfortunately, saved netnews also has From line added in some news software.
@@ -14,9 +14,9 @@
 !:mime	message/rfc822
 0	string/t		Pipe\ to 	mail piping text
 !:mime	message/rfc822
-0	string/t		Delivered-To:	SMTP mail text
+0	string/tc		delivered-to:	SMTP mail text
 !:mime	message/rfc822
-0	string/t		Return-Path:	SMTP mail text
+0	string/tc		return-path:	SMTP mail text
 !:mime	message/rfc822
 0	string/t		Path:		news text
 !:mime	message/news
@@ -34,6 +34,7 @@
 
 # TNEF files...
 0	lelong		0x223E9F78	Transport Neutral Encapsulation Format
+!:mime	application/vnd.ms-tnef
 
 # From: Kevin Sullivan 
 0	string		*mbx*		MBX mail folder
diff --git a/contrib/file/Magdir/make b/contrib/file/magic/Magdir/make
similarity index 100%
rename from contrib/file/Magdir/make
rename to contrib/file/magic/Magdir/make
diff --git a/contrib/file/magic/Magdir/map b/contrib/file/magic/Magdir/map
new file mode 100644
index 00000000000..d9471fe51b6
--- /dev/null
+++ b/contrib/file/magic/Magdir/map
@@ -0,0 +1,25 @@
+
+
+#------------------------------------------------------------------------------
+# $File: map,v 1.1 2014/06/03 18:22:25 christos Exp $
+# map:  file(1) magic for Map data
+#
+
+# Garmin .FIT files http://pub.ks-and-ks.ne.jp/cycling/edge500_fit.shtml
+8	string	.FIT		FIT Map data
+>15	byte	0
+>>35	belong	x		\b, unit id %d
+# 20 years after unix epoch
+>>39	lelong	x		\b, serial %u
+>>43	ledate/631152000 x	\b, %s
+
+>>47	leshort x		\b, manufacturer %d
+>>47	leshort	1		\b (garmin)
+>>49	leshort x		\b, product %d
+>>53	byte	x		\b, type %d
+>>53	byte	1		\b (Device)
+>>53	byte	2		\b (Settings)
+>>53	byte	3		\b (Sports/Cycling)
+>>53	byte	4		\b (Activity)
+>>53	byte	8		\b (Elevations)
+>>53	byte	10		\b (Totals)
diff --git a/contrib/file/Magdir/maple b/contrib/file/magic/Magdir/maple
similarity index 95%
rename from contrib/file/Magdir/maple
rename to contrib/file/magic/Magdir/maple
index 4a263e08469..05a8eaf298b 100644
--- a/contrib/file/Magdir/maple
+++ b/contrib/file/magic/Magdir/maple
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: maple,v 1.6 2009/09/19 16:28:10 christos Exp $
+# $File: maple,v 1.7 2013/01/11 16:45:23 christos Exp $
 # maple:  file(1) magic for maple files
 # "H. Nanosecond" 
 # Maple V release 4, a multi-purpose math program
@@ -33,7 +33,7 @@
 # that is {VERSION major_version miunor_version computer_type version_string}
 0	string	{VERSION\ 	Maple worksheet
 >9	string	>\0	version %.1s.
->>>11	string	>\0	%.1s
+>>11	string	>\0	%.1s
 
 # .mps
 0	string	\0\0\001$	Maple something
diff --git a/contrib/file/Magdir/marc21 b/contrib/file/magic/Magdir/marc21
similarity index 66%
rename from contrib/file/Magdir/marc21
rename to contrib/file/magic/Magdir/marc21
index 83f7959e058..7e859a3893b 100644
--- a/contrib/file/Magdir/marc21
+++ b/contrib/file/magic/Magdir/marc21
@@ -12,17 +12,17 @@
 20	string	45	
 
 # leader starts with 5 digits, followed by codes specific to MARC format
->0	regex/1	(^[0-9]{5})[acdnp][^bhlnqsu-z]	MARC21 Bibliographic
+>0	regex/1l	(^[0-9]{5})[acdnp][^bhlnqsu-z]	MARC21 Bibliographic
 !:mime	application/marc
->0	regex/1	(^[0-9]{5})[acdnosx][z]	MARC21 Authority
+>0	regex/1l	(^[0-9]{5})[acdnosx][z]	MARC21 Authority
 !:mime	application/marc
->0	regex/1	(^[0-9]{5})[cdn][uvxy]	MARC21 Holdings
+>0	regex/1l	(^[0-9]{5})[cdn][uvxy]	MARC21 Holdings
 !:mime	application/marc
-0	regex/1	(^[0-9]{5})[acdn][w]	MARC21 Classification
+0	regex/1l	(^[0-9]{5})[acdn][w]	MARC21 Classification
 !:mime	application/marc
->0	regex/1	(^[0-9]{5})[cdn][q]	MARC21 Community
+>0	regex/1l	(^[0-9]{5})[cdn][q]	MARC21 Community
 !:mime	application/marc
 
 # leader position 22-23, should be "00" but is it?
->0	regex/1	(^.{21})([^0]{2})	(non-conforming)
+>0	regex/1l	(^.{21})([^0]{2})	(non-conforming)
 !:mime	application/marc
diff --git a/contrib/file/Magdir/mathcad b/contrib/file/magic/Magdir/mathcad
similarity index 100%
rename from contrib/file/Magdir/mathcad
rename to contrib/file/magic/Magdir/mathcad
diff --git a/contrib/file/Magdir/mathematica b/contrib/file/magic/Magdir/mathematica
similarity index 100%
rename from contrib/file/Magdir/mathematica
rename to contrib/file/magic/Magdir/mathematica
diff --git a/contrib/file/Magdir/matroska b/contrib/file/magic/Magdir/matroska
similarity index 54%
rename from contrib/file/Magdir/matroska
rename to contrib/file/magic/Magdir/matroska
index 62299d21f9b..0c0e29985f4 100644
--- a/contrib/file/Magdir/matroska
+++ b/contrib/file/magic/Magdir/matroska
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: matroska,v 1.6 2010/09/20 21:11:35 rrt Exp $
+# $File: matroska,v 1.8 2013/02/08 17:25:16 christos Exp $
 # matroska:  file(1) magic for Matroska files
 #
 # See http://www.matroska.org/
@@ -9,15 +9,9 @@
 # EBML id:
 0		belong		0x1a45dfa3
 # DocType id:
->5		beshort		0x4282
+>4		search/4096 	\x42\x82
 # DocType contents:
->>8		string		matroska	Matroska data
-!:mime  video/x-matroska
-
-# EBML id:
-0		belong		0x1a45dfa3
-# DocType id:
->0		search/4096 	\x42\x82
-# DocType contents:
->>&1		string		webm	WebM
+>>&1		string		webm		WebM
 !:mime  video/webm
+>>&1		string		matroska	Matroska data
+!:mime  video/x-matroska
diff --git a/contrib/file/Magdir/mcrypt b/contrib/file/magic/Magdir/mcrypt
similarity index 100%
rename from contrib/file/Magdir/mcrypt
rename to contrib/file/magic/Magdir/mcrypt
diff --git a/contrib/file/Magdir/mercurial b/contrib/file/magic/Magdir/mercurial
similarity index 100%
rename from contrib/file/Magdir/mercurial
rename to contrib/file/magic/Magdir/mercurial
diff --git a/contrib/file/Magdir/metastore b/contrib/file/magic/Magdir/metastore
similarity index 100%
rename from contrib/file/Magdir/metastore
rename to contrib/file/magic/Magdir/metastore
diff --git a/contrib/file/Magdir/mime b/contrib/file/magic/Magdir/mime
similarity index 100%
rename from contrib/file/Magdir/mime
rename to contrib/file/magic/Magdir/mime
diff --git a/contrib/file/magic/Magdir/mips b/contrib/file/magic/Magdir/mips
new file mode 100644
index 00000000000..fe83614703a
--- /dev/null
+++ b/contrib/file/magic/Magdir/mips
@@ -0,0 +1,120 @@
+
+#------------------------------------------------------------------------------
+# $File: mips,v 1.10 2014/04/30 21:41:02 christos Exp $
+# mips:  file(1) magic for MIPS ECOFF and Ucode, as used in SGI IRIX
+# and DEC Ultrix
+#
+0	beshort	0x0160		MIPSEB ECOFF executable
+>20	beshort	0407		(impure)
+>20	beshort	0410		(swapped)
+>20	beshort	0413		(paged)
+>8	belong	>0		not stripped
+>8	belong	0		stripped
+>22	byte	x		- version %d
+>23	byte	x		\b.%d
+#
+0	beshort	0x0162		MIPSEL-BE ECOFF executable
+>20	beshort	0407		(impure)
+>20	beshort	0410		(swapped)
+>20	beshort	0413		(paged)
+>8	belong	>0		not stripped
+>8	belong	0		stripped
+>23	byte	x		- version %d
+>22	byte	x		\b.%d
+#
+0	beshort	0x6001		MIPSEB-LE ECOFF executable
+>20	beshort	03401		(impure)
+>20	beshort	04001		(swapped)
+>20	beshort	05401		(paged)
+>8	belong	>0		not stripped
+>8	belong	0		stripped
+>23	byte	x		- version %d
+>22	byte	x		\b.%d
+#
+0	beshort	0x6201		MIPSEL ECOFF executable
+>20	beshort	03401		(impure)
+>20	beshort	04001		(swapped)
+>20	beshort	05401		(paged)
+>8	belong	>0		not stripped
+>8	belong	0		stripped
+>23	byte	x		- version %d
+>22	byte	x		\b.%d
+#
+# MIPS 2 additions
+#
+0	beshort	0x0163		MIPSEB MIPS-II ECOFF executable
+>20	beshort	0407		(impure)
+>20	beshort	0410		(swapped)
+>20	beshort	0413		(paged)
+>8	belong	>0		not stripped
+>8	belong	0		stripped
+>22	byte	x		- version %d
+>23	byte	x		\b.%d
+#
+0	beshort	0x0166		MIPSEL-BE MIPS-II ECOFF executable
+>20	beshort	0407		(impure)
+>20	beshort	0410		(swapped)
+>20	beshort	0413		(paged)
+>8	belong	>0		not stripped
+>8	belong	0		stripped
+>22	byte	x		- version %d
+>23	byte	x		\b.%d
+#
+0	beshort	0x6301		MIPSEB-LE MIPS-II ECOFF executable
+>20	beshort	03401		(impure)
+>20	beshort	04001		(swapped)
+>20	beshort	05401		(paged)
+>8	belong	>0		not stripped
+>8	belong	0		stripped
+>23	byte	x		- version %d
+>22	byte	x		\b.%d
+#
+0	beshort	0x6601		MIPSEL MIPS-II ECOFF executable
+>20	beshort	03401		(impure)
+>20	beshort	04001		(swapped)
+>20	beshort	05401		(paged)
+>8	belong	>0		not stripped
+>8	belong	0		stripped
+>23	byte	x		- version %d
+>22	byte	x		\b.%d
+#
+# MIPS 3 additions
+#
+0	beshort	0x0140		MIPSEB MIPS-III ECOFF executable
+>20	beshort	0407		(impure)
+>20	beshort	0410		(swapped)
+>20	beshort	0413		(paged)
+>8	belong	>0		not stripped
+>8	belong	0		stripped
+>22	byte	x		- version %d
+>23	byte	x		\b.%d
+#
+0	beshort	0x0142		MIPSEL-BE MIPS-III ECOFF executable
+>20	beshort	0407		(impure)
+>20	beshort	0410		(swapped)
+>20	beshort	0413		(paged)
+>8	belong	>0		not stripped
+>8	belong	0		stripped
+>22	byte	x		- version %d
+>23	byte	x		\b.%d
+#
+0	beshort	0x4001		MIPSEB-LE MIPS-III ECOFF executable
+>20	beshort	03401		(impure)
+>20	beshort	04001		(swapped)
+>20	beshort	05401		(paged)
+>8	belong	>0		not stripped
+>8	belong	0		stripped
+>23	byte	x		- version %d
+>22	byte	x		\b.%d
+#
+0	beshort	0x4201		MIPSEL MIPS-III ECOFF executable
+>20	beshort	03401		(impure)
+>20	beshort	04001		(swapped)
+>20	beshort	05401		(paged)
+>8	belong	>0		not stripped
+>8	belong	0		stripped
+>23	byte	x		- version %d
+>22	byte	x		\b.%d
+#
+0	beshort	0x180		MIPSEB Ucode
+0	beshort	0x182		MIPSEL-BE Ucode
diff --git a/contrib/file/Magdir/mirage b/contrib/file/magic/Magdir/mirage
similarity index 100%
rename from contrib/file/Magdir/mirage
rename to contrib/file/magic/Magdir/mirage
diff --git a/contrib/file/Magdir/misctools b/contrib/file/magic/Magdir/misctools
similarity index 67%
rename from contrib/file/Magdir/misctools
rename to contrib/file/magic/Magdir/misctools
index 394706564ed..0367ec06f25 100644
--- a/contrib/file/Magdir/misctools
+++ b/contrib/file/magic/Magdir/misctools
@@ -1,6 +1,6 @@
 
 #-----------------------------------------------------------------------------
-# $File: misctools,v 1.12 2010/09/29 18:36:49 rrt Exp $
+# $File: misctools,v 1.14 2014/03/06 16:08:58 christos Exp $
 # misctools:  file(1) magic for miscellaneous UNIX tools.
 #
 0	search/1	%%!!			X-Post-It-Note text
@@ -9,16 +9,6 @@
 0	string/c	BEGIN:VCARD		vCard visiting card
 !:mime	text/x-vcard
 
-# From: Alex Beregszaszi 
-4	string	gtktalog		GNOME Catalogue (gtktalog)
->13	string	>\0			version %s
-
-# Summary: GStreamer binary registry
-# Extension: .bin
-# Submitted by: Josh Triplett 
-0	belong	0xc0def00d		GStreamer binary registry
->4	string	x			\b, version %s
-
 # Summary: Libtool library file
 # Extension: .la
 # Submitted by: Tomasz Trojanowski 
@@ -31,3 +21,8 @@
 
 # From: Daniel Novotny 
 0	string		MDMP\x93\xA7				MDMP crash report data
+
+# Summary: abook addressbook file
+# Submitted by: Mark Schreiber 
+0	string	#\x20abook\x20addressbook\x20file abook address book
+!:mime application/x-abook-addressbook
diff --git a/contrib/file/Magdir/mkid b/contrib/file/magic/Magdir/mkid
similarity index 100%
rename from contrib/file/Magdir/mkid
rename to contrib/file/magic/Magdir/mkid
diff --git a/contrib/file/Magdir/mlssa b/contrib/file/magic/Magdir/mlssa
similarity index 100%
rename from contrib/file/Magdir/mlssa
rename to contrib/file/magic/Magdir/mlssa
diff --git a/contrib/file/Magdir/mmdf b/contrib/file/magic/Magdir/mmdf
similarity index 100%
rename from contrib/file/Magdir/mmdf
rename to contrib/file/magic/Magdir/mmdf
diff --git a/contrib/file/Magdir/modem b/contrib/file/magic/Magdir/modem
similarity index 100%
rename from contrib/file/Magdir/modem
rename to contrib/file/magic/Magdir/modem
diff --git a/contrib/file/Magdir/motorola b/contrib/file/magic/Magdir/motorola
similarity index 78%
rename from contrib/file/Magdir/motorola
rename to contrib/file/magic/Magdir/motorola
index b56e5e483a4..e19a9075621 100644
--- a/contrib/file/Magdir/motorola
+++ b/contrib/file/magic/Magdir/motorola
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: motorola,v 1.10 2009/09/19 16:28:11 christos Exp $
+# $File: motorola,v 1.11 2014/04/30 21:41:02 christos Exp $
 # motorola:  file(1) magic for Motorola 68K and 88K binaries
 #
 # 68K
@@ -40,27 +40,27 @@
 # not larger than 1 MB (which is a lot on ST).
 # The additional 0x601b distinction I took from Doug Lee's magic.
 0	belong&0xFFFFFFF0	0x601A0000	Atari ST M68K contiguous executable
->2	belong			x		(txt=%ld,
->6	belong			x		dat=%ld,
->10	belong			x		bss=%ld,
->14	belong			x		sym=%ld)
+>2	belong			x		(txt=%d,
+>6	belong			x		dat=%d,
+>10	belong			x		bss=%d,
+>14	belong			x		sym=%d)
 0	belong&0xFFFFFFF0	0x601B0000	Atari ST M68K non-contig executable
->2	belong			x		(txt=%ld,
->6	belong			x		dat=%ld,
->10	belong			x		bss=%ld,
->14	belong			x		sym=%ld)
+>2	belong			x		(txt=%d,
+>6	belong			x		dat=%d,
+>10	belong			x		bss=%d,
+>14	belong			x		sym=%d)
 
 # Atari ST/TT... program format (sent by Wolfram Kleff )
 0       beshort         0x601A          Atari 68xxx executable,
->2      belong          x               text len %lu,
->6      belong          x               data len %lu,
->10     belong          x               BSS len %lu,
->14     belong          x               symboltab len %lu,
+>2      belong          x               text len %u,
+>6      belong          x               data len %u,
+>10     belong          x               BSS len %u,
+>14     belong          x               symboltab len %u,
 >18     belong          0
 >22     belong          &0x01           fastload flag,
 >22     belong          &0x02           may be loaded to alternate RAM,
 >22     belong          &0x04           malloc may be from alternate RAM,
->22     belong          x               flags: 0x%lX,
+>22     belong          x               flags: 0x%X,
 >26     beshort         0               no relocation tab
 >26     beshort         !0              + relocation tab
 >30     string          SFX             [Self-Extracting LZH SFX archive]
@@ -68,4 +68,4 @@
 >44     string          ZIP!            [Self-Extracting ZIP SFX archive]
 
 0       beshort         0x0064          Atari 68xxx CPX file
->8      beshort         x               (version %04lx)
+>8      beshort         x               (version %04x)
diff --git a/contrib/file/Magdir/mozilla b/contrib/file/magic/Magdir/mozilla
similarity index 100%
rename from contrib/file/Magdir/mozilla
rename to contrib/file/magic/Magdir/mozilla
diff --git a/contrib/file/Magdir/msdos b/contrib/file/magic/Magdir/msdos
similarity index 89%
rename from contrib/file/Magdir/msdos
rename to contrib/file/magic/Magdir/msdos
index fe505e83f83..64d48622369 100644
--- a/contrib/file/Magdir/msdos
+++ b/contrib/file/magic/Magdir/msdos
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: msdos,v 1.77 2011/12/07 22:05:05 christos Exp $
+# $File: msdos,v 1.100 2014/06/03 19:17:27 christos Exp $
 # msdos:  file(1) magic for MS-DOS files
 #
 
@@ -42,9 +42,9 @@
 # Many of the compressed formats were extraced from IDARC 1.23 source code.
 #
 0	string/b	MZ
-!:mime	application/x-dosexec
 # All non-DOS EXE extensions have the relocation table more than 0x40 bytes into the file.
 >0x18	leshort <0x40 MS-DOS executable
+!:mime	application/x-dosexec
 # These traditional tests usually work but not always.  When test quality support is
 # implemented these can be turned on.
 #>>0x18	leshort	0x1c	(Borland compiler)
@@ -56,6 +56,7 @@
 
 # Maybe it's a PE?
 >>(0x3c.l) string PE\0\0 PE
+!:mime	application/x-dosexec
 >>>(0x3c.l+24)	leshort		0x010b	\b32 executable
 >>>(0x3c.l+24)	leshort		0x020b	\b32+ executable
 >>>(0x3c.l+24)	leshort		0x0107	ROM image
@@ -83,6 +84,7 @@
 >>>(0x3c.l+4)	leshort		0x1a6	Hitachi SH4
 >>>(0x3c.l+4)	leshort		0x1c0	ARM
 >>>(0x3c.l+4)	leshort		0x1c2	ARM Thumb
+>>>(0x3c.l+4)	leshort		0x1c4	ARMv7 Thumb
 >>>(0x3c.l+4)	leshort		0x1f0	PowerPC
 >>>(0x3c.l+4)	leshort		0x200	Intel Itanium
 >>>(0x3c.l+4)	leshort		0x266	MIPS16
@@ -133,8 +135,10 @@
 # Hmm, not a PE but the relocation table is too high for a traditional DOS exe,
 # must be one of the unusual subformats.
 >>(0x3c.l) string !PE\0\0 MS-DOS executable
+!:mime	application/x-dosexec
 
 >>(0x3c.l)		string		NE \b, NE
+!:mime	application/x-dosexec
 >>>(0x3c.l+0x36)	byte		1 for OS/2 1.x
 >>>(0x3c.l+0x36)	byte		2 for MS Windows 3.x
 >>>(0x3c.l+0x36)	byte		3 for MS-DOS
@@ -149,6 +153,7 @@
 >>>(0x3c.l+0x70)	search/0x80	WinZip(R)\ Self-Extractor \b, ZIP self-extracting archive (WinZip)
 
 >>(0x3c.l)		string		LX\0\0 \b, LX
+!:mime	application/x-dosexec
 >>>(0x3c.l+0x0a)	leshort		<1 (unknown OS)
 >>>(0x3c.l+0x0a)	leshort		1 for OS/2
 >>>(0x3c.l+0x0a)	leshort		2 for MS Windows
@@ -167,8 +172,10 @@
 
 # MS Windows system file, supposedly a collection of LE executables
 >>(0x3c.l)		string		W3 \b, W3 for MS Windows
+!:mime	application/x-dosexec
 
 >>(0x3c.l)		string		LE\0\0 \b, LE executable
+!:mime	application/x-dosexec
 >>>(0x3c.l+0x0a)	leshort		1
 # some DOS extenders use LE files with OS/2 header
 >>>>0x240		search/0x100	DOS/4G for MS-DOS, DOS4GW DOS extender
@@ -195,6 +202,7 @@
 # and definitely not NE/LE/LX/PE
 >>0x3c		lelong	>0x20000000
 >>>(4.s*512)	leshort !0x014c \b, MZ for MS-DOS
+!:mime	application/x-dosexec
 # header data too small for extended executable
 >2		long	!0
 >>0x18		leshort <0x40
@@ -202,17 +210,19 @@
 
 >>>>&(2.s-514)	string	!LE
 >>>>>&-2	string	!BW \b, MZ for MS-DOS
+!:mime	application/x-dosexec
 >>>>&(2.s-514)	string	LE \b, LE
 >>>>>0x240	search/0x100	DOS/4G for MS-DOS, DOS4GW DOS extender
 # educated guess since indirection is still not capable enough for complex offset
 # calculations (next embedded executable would be at &(&2*512+&0-2)
 # I suspect there are only LE executables in these multi-exe files
 >>>>&(2.s-514)	string	BW
->>>>>0x240	search/0x100	DOS/4G ,\b LE for MS-DOS, DOS4GW DOS extender (embedded)
->>>>>0x240	search/0x100	!DOS/4G ,\b BW collection for MS-DOS
+>>>>>0x240	search/0x100	DOS/4G	\b, LE for MS-DOS, DOS4GW DOS extender (embedded)
+>>>>>0x240	search/0x100	!DOS/4G	\b, BW collection for MS-DOS
 
 # This sequence skips to the first COFF segment, usually .text
 >(4.s*512)	leshort		0x014c \b, COFF
+!:mime	application/x-dosexec
 >>(8.s*16)	string		go32stub for MS-DOS, DJGPP go32 DOS extender
 >>(8.s*16)	string		emx
 >>>&1		string		x for DOS, Win or OS/2, emx %s
@@ -312,7 +322,7 @@
 >5	ubyte		>0		
 >>8	string		x		\b, name=%-.2s
 0	string	\xffKEYB\ \ \ \0\0\0\0	
->12	string	\0\0\0\0`\360		MS-DOS KEYBoard Layout file
+>12	string	\0\0\0\0`\004\360	MS-DOS KEYBoard Layout file
 
 # .COM formats (Daniel Quinlan, quinlan@yggdrasil.com)
 # Uncommenting only the first two lines will cover about 2/3 of COM files,
@@ -372,7 +382,7 @@
 # they have their real name at offset 22
 >>>>>22		string			>\0			\b%-.5s
 >4	uleshort&0x8000			0x0000			
-# 32 bit sector adressing ( > 32 MB) for block devices
+# 32 bit sector addressing ( > 32 MB) for block devices
 >>4	uleshort&0x0002			0x0002			\b,32-bit sector-
 # support by driver functions 13h, 17h, 18h
 >4	uleshort&0x0040			0x0040			\b,IOCTL-
@@ -498,11 +508,18 @@
 !:mime	application/msword
 0	string/b	\333\245-\0\0\0			Microsoft Office Document
 !:mime	application/msword
-512	string/b		\354\245\301		Microsoft Word Document
+512	string/b	\354\245\301			Microsoft Word Document
 !:mime	application/msword
+
+#
+0	string/b	\xDB\xA5\x2D\x00		Microsoft WinWord 2.0 Document
+!:mime application/msword
 #
 2080	string	Microsoft\ Excel\ 5.0\ Worksheet	%s
 !:mime	application/vnd.ms-excel
+#
+0	string/b	\xDB\xA5\x2D\x00		Microsoft WinWord 2.0 Document
+!:mime application/msword
 
 2080	string	Foglio\ di\ lavoro\ Microsoft\ Exce	%s
 !:mime	application/vnd.ms-excel
@@ -570,16 +587,48 @@
 #ico files
 0	string/b	\102\101\050\000\000\000\056\000\000\000\000\000\000\000	Icon for MS Windows
 
-# Windows icons (Ian Springer )
-0	string/b	\000\000\001\000	MS Windows icon resource
-!:mime	image/x-icon
->4	byte	1			- 1 icon
->4	byte	>1			- %d icons
->>6	byte	>0			\b, %dx
->>>7	byte	>0			\b%d
->>8	byte	0			\b, 256-colors
->>8	byte	>0			\b, %d-colors
+# Windows icons
+0   name    ico-dir
+# not entirely accurate, the number of icons is part of the header
+>0  byte    1   - 1 icon
+>0  ubyte   >1  - %d icons
+>2  byte    0   \b, 256x
+>2  byte    !0  \b, %dx
+>3  byte    0   \b256
+>3  byte    !0  \b%d
+>4  ubyte   !0  \b, %d colors
 
+0   belong  0x00000100
+>9  byte    0
+>>0 byte    x           MS Windows icon resource
+!:mime	image/x-icon
+>>4 use     ico-dir
+>9  ubyte   0xff
+>>0 byte    x           MS Windows icon resource
+!:mime	image/x-icon
+>>4 use     ico-dir
+
+# Windows non-animated cursors
+0   name    cur-dir
+# not entirely accurate, the number of icons is part of the header
+>0  byte        1   - 1 icon
+>0  ubyte       >1  - %d icons
+>2  byte        0   \b, 256x
+>2  byte        !0  \b, %dx
+>3  byte        0   \b256
+>3  byte        !0  \b%d
+>6  uleshort    x   \b, hotspot @%dx
+>8  uleshort    x   \b%d
+
+0   belong  0x00000200
+>9  byte    0
+>>0 byte    x           MS Windows cursor resource
+!:mime image/x-cur
+>>4 use     cur-dir
+>9  ubyte   0xff
+>>0 byte    x           MS Windows cursor resource
+!:mime image/x-cur
+>>4 use     cur-dir
 
 # .chr files
 0	string/b	PK\010\010BGI	Borland font 
@@ -637,16 +686,14 @@
 0	lelong		0x08086b70	TurboC BGI file
 0	lelong		0x08084b50	TurboC Font file
 
-# WARNING: below line conflicts with Infocom game data Z-machine 3
-0	byte		0x03
->0x02	byte		<0x13		DBase 3 data file
->>0x04	lelong		0		(no records)
->>0x04	lelong		>0		(%ld records)
-0	byte		0x83
->0x02	byte		<0x13		DBase 3 data file with memo(s)
->>0x04	lelong		0		(no records)
->>0x04	lelong		>0		(%ld records)
-0	leshort		0x0006		DBase 3 index file
+# Debian#712046: The magic below identifies "Delphi compiled form data". 
+# An additional source of information is available at:
+# http://www.woodmann.com/fravia/dafix_t1.htm
+0	string		TPF0
+>4	pstring		>\0		Delphi compiled form '%s'
+
+# tests for DBase files moved, updated and merged to database
+
 0	string		PMCC		Windows 3.x .GRP file
 1	string		RDC-meg		MegaDots 
 >8	byte		>0x2F		version %c
@@ -702,6 +749,28 @@
 0	leshort		0x223e9f78	TNEF
 !:mime	application/vnd.ms-tnef
 
+# Norton Guide (.NG , .HLP) files added by Joerg Jenderek from source NG2HTML.C
+# of http://www.davep.org/norton-guides/ng2h-105.tgz
+# http://en.wikipedia.org/wiki/Norton_Guides
+0	string		NG\0\001	
+# only value 0x100 found at offset 2
+>2	ulelong		0x00000100	Norton Guide
+# Title[40]
+>>8	string		>\0		"%-.40s"
+#>>6	uleshort	x		\b, MenuCount=%u
+# szCredits[5][66]
+>>48	string		>\0		\b, %-.66s
+>>114	string		>\0		%-.66s
+
+# 4DOS help (.HLP) files added by Joerg Jenderek from source TPHELP.PAS 
+# of http://www.4dos.info/
+# pointer,HelpID[8]=4DHnnnmm
+0	ulelong	0x48443408		4DOS help file
+>4	string	x			\b, version %-4.4s
+
+# old binary Microsoft (.HLP) files added by Joerg Jenderek from http://file-extension.net/seeker/file_extension_hlp
+0	ulequad	0x3a000000024e4c	MS Advisor help file
+
 # HtmlHelp files (.chm)
 0	string/b	ITSF\003\000\000\000\x60\000\000\000\001\000\000\000	MS Windows HtmlHelp Data
 
@@ -747,80 +816,6 @@
 >40	string	\ EMF		Windows Enhanced Metafile (EMF) image data
 >>44	ulelong x		version 0x%x
 
-# From: Alex Beregszaszi 
-0	string/b	COWD		VMWare3
->4	byte	3		disk image
->>32	lelong	x		(%d/
->>36	lelong	x		\b%d/
->>40	lelong	x		\b%d)
->4	byte	2		undoable disk image
->>32	string	>\0		(%s)
-
-0	string/b	VMDK		 VMware4 disk image
-0	string/b	KDMV		 VMware4 disk image
-
-#--------------------------------------------------------------------
-# Qemu Emulator Images
-# Lines written by Friedrich Schwittay (f.schwittay@yousable.de)
-# Updated by Adam Buchbinder (adam.buchbinder@gmail.com)
-# Made by reading sources, reading documentation, and doing trial and error
-# on existing QCOW files
-0	string/b	QFI\xFB	QEMU QCOW Image
-
-# Uncomment the following line to display Magic (only used for debugging
-# this magic number)
-#>0	string/b	x	, Magic: %s
-
-# There are currently 2 Versions: "1" and "2".
-# http://www.gnome.org/~markmc/qcow-image-format-version-1.html
->4	belong	1	(v1)
-
-# Using the existence of the Backing File Offset to determine whether
-# to read Backing File Information
->>12	belong	 >0	 \b, has backing file (
-# Note that this isn't a null-terminated string; the length is actually
-# (16.L). Assuming a null-terminated string happens to work usually, but it
-# may spew junk until it reaches a \0 in some cases.
->>>(12.L)	 string >\0	\bpath %s
-
-# Modification time of the Backing File
-# Really useful if you want to know if your backing
-# file is still usable together with this image
->>>>20	bedate >0	\b, mtime %s)
->>>>20	default x	\b)
-
-# Size is stored in bytes in a big-endian u64.
->>24	bequad	x	 \b, %lld bytes
-
-# 1 for AES encryption, 0 for none.
->>36	belong	1	\b, AES-encrypted
-
-# http://www.gnome.org/~markmc/qcow-image-format.html
->4	belong	2	(v2)
-# Using the existence of the Backing File Offset to determine whether
-# to read Backing File Information
->>8	bequad  >0	 \b, has backing file
-# Note that this isn't a null-terminated string; the length is actually
-# (16.L). Assuming a null-terminated string happens to work usually, but it
-# may spew junk until it reaches a \0 in some cases. Also, since there's no
-# .Q modifier, we just use the bottom four bytes as an offset. Note that if
-# the file is over 4G, and the backing file path is stored after the first 4G,
-# the wrong filename will be printed. (This should be (8.Q), when that syntax
-# is introduced.)
->>>(12.L)	 string >\0	(path %s)
->>24	bequad	x	\b, %lld bytes
->>32	belong	1	\b, AES-encrypted
-
->4	default x	(unknown version)
-
-0	string/b	QEVM		QEMU suspend to disk image
-
-0	string/b	Bochs\ Virtual\ HD\ Image	Bochs disk image,
->32	string	x				type %s,
->48	string	x				subtype %s
-
-0	lelong	0x02468ace			Bochs Sparse disk image
-
 # from http://filext.com by Derek M Jones 
 # False positive with PPT (also currently this string is too long)
 #0	string/b	\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3E\x00\x03\x00\xFE\xFF\x09\x00\x06	Microsoft Installer
@@ -854,8 +849,8 @@
 # URL:	http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/DDSFileReference/ddsfileformat.asp
 # From: Morten Hustveit 
 0	string/b	DDS\040\174\000\000\000 Microsoft DirectDraw Surface (DDS),
->16	lelong	>0			%hd x
->12	lelong	>0			%hd,
+>16	lelong	>0			%d x
+>12	lelong	>0			%d,
 >84	string	x			%.4s
 
 # Type: Microsoft Document Imaging Format (.mdi)
@@ -874,3 +869,15 @@
 
 # Windows Imaging (WIM) Image
 0	string/b	MSWIM\000\000\000	Windows imaging (WIM) image
+
+# The second byte of these signatures is a file version; I don't know what, 
+# if anything, produced files with version numbers 0-2.
+# From: John Elliott 
+0	string	\xfc\x03\x00	Mallard BASIC program data (v1.11)
+0	string	\xfc\x04\x00	Mallard BASIC program data (v1.29+)
+0	string	\xfc\x03\x01	Mallard BASIC protected program data (v1.11)
+0	string	\xfc\x04\x01	Mallard BASIC protected program data (v1.29+)
+
+0	string	MIOPEN		Mallard BASIC Jetsam data
+0	string	Jetsam0		Mallard BASIC Jetsam index data
+
diff --git a/contrib/file/magic/Magdir/msooxml b/contrib/file/magic/Magdir/msooxml
new file mode 100644
index 00000000000..e5be5b37db3
--- /dev/null
+++ b/contrib/file/magic/Magdir/msooxml
@@ -0,0 +1,36 @@
+
+#------------------------------------------------------------------------------
+# $File: msooxml,v 1.4 2014/01/06 18:16:24 rrt Exp $
+# msooxml:  file(1) magic for Microsoft Office XML
+# From: Ralf Brown 
+
+# .docx, .pptx, and .xlsx are XML plus other files inside a ZIP
+#   archive.  The first member file is normally "[Content_Types].xml".
+#   but some libreoffice generated files put this later. Perhaps skip
+#   the "[Content_Types].xml" test?
+# Since MSOOXML doesn't have anything like the uncompressed "mimetype"
+#   file of ePub or OpenDocument, we'll have to scan for a filename
+#   which can distinguish between the three types
+
+# start by checking for ZIP local file header signature
+0		string		PK\003\004
+!:strength +10
+# make sure the first file is correct
+>0x1E		regex		\[Content_Types\]\.xml|_rels/\.rels
+# skip to the second local file header
+# since some documents include a 520-byte extra field following the file
+# header, we need to scan for the next header
+>>(18.l+49)	search/2000	PK\003\004
+# now skip to the *third* local file header; again, we need to scan due to a
+# 520-byte extra field following the file header
+>>>&26		search/1000	PK\003\004
+# and check the subdirectory name to determine which type of OOXML
+# file we have.  Correct the mimetype with the registered ones:
+# http://technet.microsoft.com/en-us/library/cc179224.aspx
+>>>>&26		string		word/		Microsoft Word 2007+
+!:mime application/vnd.openxmlformats-officedocument.wordprocessingml.document
+>>>>&26		string		ppt/		Microsoft PowerPoint 2007+
+!:mime application/vnd.openxmlformats-officedocument.presentationml.presentation
+>>>>&26		string		xl/		Microsoft Excel 2007+
+!:mime application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
+>>>>&26		default		x		Microsoft OOXML
diff --git a/contrib/file/Magdir/msvc b/contrib/file/magic/Magdir/msvc
similarity index 100%
rename from contrib/file/Magdir/msvc
rename to contrib/file/magic/Magdir/msvc
diff --git a/contrib/file/magic/Magdir/msx b/contrib/file/magic/Magdir/msx
new file mode 100644
index 00000000000..0eacbe52081
--- /dev/null
+++ b/contrib/file/magic/Magdir/msx
@@ -0,0 +1,255 @@
+
+#------------------------------------------------------------------------------
+# msx:  file(1) magic for the MSX Home Computer
+# v1.1
+# Fabio R. Schmidlin 
+
+############## MSX Music file formats ##############
+
+# Gigamix MGSDRV music file
+0	string		MGS	MSX Gigamix MGSDRV3 music file, 
+>6	ubeshort	0x0D0A
+>>3	byte		x	\bv%c
+>>4	byte		x	\b.%c
+>>5	byte		x	\b%c
+>>8	string		>\0	\b, title: %s
+
+1	string		mgs2\ 	MSX Gigamix MGSDRV2 music file
+>6	uleshort	0x80
+>>0x2E	uleshort	0
+>>>0x30	string		>\0	\b, title: %s
+
+# KSS music file
+0	string		KSCC	KSS music file v1.03
+>0xE	byte		0
+>>0xF	byte&0x02	0	\b, soundchips: AY-3-8910, SCC(+)
+>>0xF	byte&0x02	2	\b, soundchip(s): SN76489
+>>>0xF	byte&0x04	4	stereo
+>>0xF	byte&0x01	1	\b, YM2413
+>>0xF	byte&0x08	8	\b, Y8950
+
+0	string		KSSX	KSS music file v1.20
+>0xE	byte&0xEF	0
+>>0xF	byte&0x40	0x00	\b, 60Hz
+>>0xF	byte&0x40	0x40	\b, 50Hz
+>>0xF	byte&0x02	0	\b, soundchips: AY-3-8910, SCC(+)
+>>0xF	byte&0x02	0x02	\b, soundchips: SN76489
+>>>0xF	byte&0x04	0x04	stereo
+>>0xF	byte&0x01	0x01	\b, 
+>>>0xF	byte&0x18	0x00	\bYM2413
+>>>0xF	byte&0x18	0x08	\bYM2413, Y8950
+>>>0xF	byte&0x18	0x18	\bYM2413+Y8950 pseudostereo
+>>0xF	byte&0x18	0x10	\b, Majyutsushi DAC
+
+# Moonblaster for Moonsound
+0	string		MBMS
+>4	byte		0x10	MSX Moonblaster for MoonSound music
+
+# Music Player K-kaz
+0	string		MPK	MSX Music Player K-kaz song
+>6	ubeshort	0x0D0A
+>>3	byte		x	v%c
+>>4	byte		x	\b.%c
+>>5	byte		x	\b%c
+
+# I don't know why these don't work
+#0	search/0xFFFF	\r\n.FM9
+#>0	search/0xFFFF	\r\n#FORMAT	MSX Music Player K-kaz source MML file
+#0	search/0xFFFF	\r\nFM1\ \=
+#>0	search/0xFFFF	\r\nPSG1\=
+#>>0	search/0xFFFF	\r\nSCC1\=		MSX MuSiCa MML source file
+
+# OPX Music file
+0x35	beshort		0x0d0a
+>0x7B	beshort		0x0d0a
+>>0x7D	byte		0x1a
+>>>0x87	uleshort	0		MSX OPX Music file
+>>>>0x86	byte		0		v1.5
+>>>>>0	string		>\32		\b, title: %s
+>>>>0x86	byte		1		v2.4
+>>>>>0	string		>\32		\b, title: %s
+
+# SCMD music file
+0x8B	string		SCMD
+>0xCE	uleshort	0	MSX SCMD Music file
+#>>-2	uleshort	0x6a71	; The file must end with this value. How to code this here?
+>>0x8F	string		>\0		\b, title: %s
+
+0	search/0xFFFF	\r\n@title
+>&0	search/0xFFFF	\r\n@m=[	MSX SCMD source MML file
+
+
+############## MSX image file formats ##############
+
+# MSX raw VRAM dump
+0	ubyte		0xFE
+>1	uleshort	0
+>>5	uleshort	0
+>>>3	uleshort	0x37FF		MSX SC2/GRP raw image
+>>>3	uleshort	0x6A00		MSX Graph Saurus SR5 raw image
+>>>3	uleshort	>0x769E
+>>>>3	uleshort	<0x8000		MSX GE5/GE6 raw image
+>>>>>3	uleshort	0x7FFF		\b, with sprite patterns
+>>>3	uleshort	0xD3FF		MSX screen 7-12 raw image
+>>>3	uleshort	0xD400		MSX Graph Saurus SR7/SR8/SRS raw image
+
+# Graph Saurus compressed images
+0	ubyte		0xFD
+>1	uleshort	0
+>>5	uleshort	0
+>>>3	uleshort	>0x013D		MSX Graph Saurus compressed image
+
+# Maki-chan Graphic format
+0	string		MAKI02\ \ 	Maki-chan image,
+>8	byte		x		system ID: %c
+>9	byte		x		\b%c
+>10	byte		x		\b%c
+>11	byte		x		\b%c,
+>13	search/0x200	\x1A
+# >>&3	ubyte		0		, video mode: PC-98 400 lines, 16 analog colors
+# >>&3	ubyte		1		, video mode: MSX SC7, 16 analog colors
+# >>&3	ubyte		2		, video mode: VM-98 400 lines, 8 analog colors
+# >>&3	ubyte		3		, video mode: PC-88 analog, 200 lines, 8 analog colors
+# >>&3	ubyte		4		, video mode: 400 lines, 16 digital colors
+# >>&3	ubyte		5		, video mode: 200 lines, 16 digital colors
+# >>&3	ubyte		6		, video mode: old PC-98 digital 400 lines, 8 colors
+# >>&3	ubyte		7		, video mode: PC-88 400 lines, 8 digital colors
+>>&8	uleshort+1	x		%dx
+>>&10	uleshort+1	x		\b%d,
+>>&3	ubyte&0x82	0x80		256 colors
+>>&3	ubyte&0x82	0x00		16 colors
+>>&3	ubyte&0x82	0x01		8 colors
+>>&3	ubyte&0x04	4		digital
+>>&3	ubyte&0x04	0		analog
+>>&3	ubyte&0x01	1		\b, 2:1 dot aspect ratio
+
+# Japanese PIC file
+0	string		PIC\x1A
+>4	lelong		0		Japanese PIC image file
+
+# MSX G9B image file
+0	string		G9B
+>1	uleshort	11
+>>3	uleshort	>10
+>>>5	ubyte		>0		MSX G9B image, depth=%d
+>>>>8	uleshort	x		\b, %dx
+>>>>10	uleshort	x		\b%d
+>>>>5	ubyte		<9
+>>>>>6	ubyte		0
+>>>>>>7	ubyte		x		\b, codec=%d RGB color palettes
+>>>>>6	ubyte		64		\b, codec=RGB fixed color
+>>>>>6	ubyte		128		\b, codec=YJK
+>>>>>6	ubyte		192		\b, codec=YUV
+>>>>5	ubyte		>8		codec=RGB fixed color
+>>>>12	ubyte		0		\b, raw
+>>>>12	ubyte		1		\b, bitbuster compression
+
+############## Other MSX file formats ##############
+
+# MSX ROMs
+0	string		AB
+>2	uleshort	0x0010			MSX ROM
+>>2	uleshort	x			\b, init=0x%4x
+>>4	uleshort	>0			\b, stat=0x%4x
+>>6	uleshort	>0			\b, dev=0x%4x
+>>8	uleshort	>0			\b, bas=0x%4x
+>2	uleshort	0x4010			MSX ROM
+>>2	uleshort	x			\b, init=0x%04x
+>>4	uleshort	>0			\b, stat=0x%04x
+>>6	uleshort	>0			\b, dev=0x%04x
+>>8	uleshort	>0			\b, bas=0x%04x
+>2	uleshort	0x8010			MSX ROM
+>>2	uleshort	x			\b, init=0x%04x
+>>4	uleshort	>0			\b, stat=0x%04x
+>>6	uleshort	>0			\b, dev=0x%04x
+>>8	uleshort	>0			\b, bas=0x%04x
+
+0	string		AB
+#>2	string		5JSuperLAYDOCK		MSX Super Laydock ROM
+#>3	string		@HYDLIDE3MSX		MSX Hydlide-3 ROM
+#>3	string		@3\x80IA862		Golvellius MSX1 ROM
+>2	uleshort	>10
+>>10	string		\0\0\0\0\0\0		MSX ROM
+>>>0x10	string		YZ\0\0\0\0		Konami Game Master 2 MSX ROM
+>>>0x10	string		CD			\b, Konami RC-
+>>>>0x12	ubyte		x			\b%d
+>>>>0x13	ubyte/16	x			\b%d
+>>>>0x13	ubyte&0xF	x			\b%d
+>>>0x10	string		EF			\b, Konami RC-
+>>>>0x12	ubyte		x			\b%d
+>>>>0x13	ubyte/16	x			\b%d
+>>>>0x13	ubyte&0xF	x			\b%d
+>>>2	uleshort	x			\b, init=0x%04x
+>>>4	uleshort	>0			\b, stat=0x%04x
+>>>6	uleshort	>0			\b, dev=0x%04x
+>>>8	uleshort	>0			\b, bas=0x%04x
+>2	uleshort	0
+>>4	uleshort	0
+>>>6	uleshort	0
+>>>>8	uleshort	>0			MSX BASIC program in ROM, bas=0x%04x
+
+0x4000	string		AB
+>0x4002	uleshort	>0x4010
+>>0x400A	string		\0\0\0\0\0\0	MSX MegaROM with nonstandard page order
+>>0x4002	uleshort	x			\b, init=0x%04x
+>>0x4004	uleshort	>0			\b, stat=0x%04x
+>>0x4006	uleshort	>0			\b, dev=0x%04x
+>>0x4008	uleshort	>0			\b, bas=0x%04x
+
+0x8000	string		AB
+>0x8002	uleshort	>0x4010
+>>0x800A	string		\0\0\0\0\0\0	MSX MegaROM with nonstandard page order
+>>0x8002	uleshort	x			\b, init=0x%04x
+>>0x8004	uleshort	>0			\b, stat=0x%04x
+>>0x8006	uleshort	>0			\b, dev=0x%04x
+>>0x8008	uleshort	>0			\b, bas=0x%04x
+
+
+0x3C000	string		AB
+>0x3C008	string		\0\0\0\0\0\0\0\0	MSX MegaROM with nonstandard page order
+>>0x3C002	uleshort	x			\b, init=0x%04x
+>>0x3C004	uleshort	>0			\b, stat=0x%04x
+>>0x3C006	uleshort	>0			\b, dev=0x%04x
+>>0x3C008	uleshort	>0			\b, bas=0x%04x
+
+# MSX BIN file
+#0	byte		0xFE
+#>1	uleshort	>0x8000
+#>>3	uleshort	>0x8004
+#>>>5	uleshort	>0x8000			MSX BIN file
+
+# MSX-BASIC file
+0	byte		0xFF
+>3	uleshort	0x000A
+>>1	uleshort	>0x8000			MSX-BASIC program
+
+# MSX .CAS file
+0	string	\x1F\xA6\xDE\xBA\xCC\x13\x7D\x74	MSX cassette archive
+
+# Mega-Assembler file
+0	byte		0xFE
+>1	uleshort	0x0001
+>>5	uleshort	0xffff
+>>>6	byte		0x0A		MSX Mega-Assembler source
+
+# Execrom Patchfile
+0	string		ExecROM\ patchfile\x1A	MSX ExecROM patchfile
+>0x12	ubyte/16	x		v%d
+>0x12	ubyte&0xF	x		\b.%d
+>0x13	ubyte		x		\b, contains %d patches
+
+# Konami's King's Valley-2 custom stage (ELG file)
+4	uleshort	0x0900
+>0xF	byte		1
+>>0x14	byte		0
+>>>0x1E	string		\ \ \ 
+>>>>0x23	byte	1
+>>>>>0x25	byte	0
+>>>>>>0x15	string	>\x30
+>>>>>>>0x15	string	<\x5A		Konami King's Valley-2 custom stage, title: "%-8.8s"
+>>>>>>>>0x1D	byte	<32	\b, theme: %d
+
+# Metal Gear 1 savegame
+#0x4F	string	\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF
+#>>0x60	string	\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF
+#>>>0x7B	string	\0x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00	Metal Gear 1 savegame
diff --git a/contrib/file/Magdir/mup b/contrib/file/magic/Magdir/mup
similarity index 100%
rename from contrib/file/Magdir/mup
rename to contrib/file/magic/Magdir/mup
diff --git a/contrib/file/Magdir/music b/contrib/file/magic/Magdir/music
similarity index 100%
rename from contrib/file/Magdir/music
rename to contrib/file/magic/Magdir/music
diff --git a/contrib/file/Magdir/natinst b/contrib/file/magic/Magdir/natinst
similarity index 86%
rename from contrib/file/Magdir/natinst
rename to contrib/file/magic/Magdir/natinst
index 7c319801260..7a55ddecdf9 100644
--- a/contrib/file/Magdir/natinst
+++ b/contrib/file/magic/Magdir/natinst
@@ -1,10 +1,10 @@
 
 #-----------------------------------------------------------------------------
-# $File: natinst,v 1.4 2009/09/19 16:28:11 christos Exp $
+# $File: natinst,v 1.6 2014/06/03 19:17:27 christos Exp $
 # natinst:  file(1) magic for National Instruments Code Files
 
 #
-# From  Enrique Gmez-Flores
+# From  Enrique Gamez-Flores
 # version 1
 # Many formats still missing, we use, for the moment LabVIEW
 # We guess VXI format file. VISA, LabWindowsCVI, BridgeVIEW, etc, are missing
@@ -12,7 +12,7 @@
 0       string          RSRC            National Instruments,
 # Check if it's a LabVIEW File
 >8      string          LV              LabVIEW File,
-# Check wich kind of file is
+# Check which kind of file it is
 >>10    string          SB              Code Resource File, data
 >>10    string          IN              Virtual Instrument Program, data
 >>10    string          AR              VI Library, data
diff --git a/contrib/file/Magdir/ncr b/contrib/file/magic/Magdir/ncr
similarity index 83%
rename from contrib/file/Magdir/ncr
rename to contrib/file/magic/Magdir/ncr
index 4067596f592..21b09aba5c5 100644
--- a/contrib/file/Magdir/ncr
+++ b/contrib/file/magic/Magdir/ncr
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: ncr,v 1.7 2009/09/19 16:28:11 christos Exp $
+# $File: ncr,v 1.8 2014/04/30 21:41:02 christos Exp $
 # ncr:  file(1) magic for NCR Tower objects
 #
 # contributed by
@@ -11,27 +11,27 @@
 >12	   belong		>0	not stripped
 >20	   beshort		0407	executable
 >20	   beshort		0410	pure executable
->22	   beshort		>0	- version %ld
+>22	   beshort		>0	- version %d
 0	beshort		000615	Tower/XP rel 2 object
 >12	   belong		>0	not stripped
 >20	   beshort		0407	executable
 >20	   beshort		0410	pure executable
->22	   beshort		>0	- version %ld
+>22	   beshort		>0	- version %d
 0	beshort		000620	Tower/XP rel 3 object
 >12	   belong		>0	not stripped
 >20	   beshort		0407	executable
 >20	   beshort		0410	pure executable
->22	   beshort		>0	- version %ld
+>22	   beshort		>0	- version %d
 0	beshort		000625	Tower/XP rel 3 object
 >12	   belong		>0	not stripped
 >20	   beshort		0407	executable
 >20	   beshort		0410	pure executable
->22	   beshort		>0	- version %ld
+>22	   beshort		>0	- version %d
 0	beshort		000630	Tower32/600/400 68020 object
 >12	   belong		>0	not stripped
 >20	   beshort		0407	executable
 >20	   beshort		0410	pure executable
->22	   beshort		>0	- version %ld
+>22	   beshort		>0	- version %d
 0	beshort		000640	Tower32/800 68020
 >18	   beshort		&020000	w/68881 object
 >18	   beshort		&040000	compatible object
@@ -39,11 +39,11 @@
 >20	   beshort		0407	executable
 >20	   beshort		0413	pure executable
 >12	   belong		>0	not stripped
->22	   beshort		>0	- version %ld
+>22	   beshort		>0	- version %d
 0	beshort		000645	Tower32/800 68010
 >18	   beshort		&040000	compatible object
 >18	   beshort		&060000 object
 >20	   beshort		0407	executable
 >20	   beshort		0413	pure executable
 >12	   belong		>0	not stripped
->22	   beshort		>0	- version %ld
+>22	   beshort		>0	- version %d
diff --git a/contrib/file/magic/Magdir/neko b/contrib/file/magic/Magdir/neko
new file mode 100644
index 00000000000..ac5ff354ec1
--- /dev/null
+++ b/contrib/file/magic/Magdir/neko
@@ -0,0 +1,12 @@
+
+#------------------------------------------------------------
+# $File: neko,v 1.1 2009/11/10 20:36:10 christos Exp $
+
+# From: Mikhail Gusarov 
+# NekoVM (http://nekovm.org/) bytecode
+0	string		NEKO	NekoVM bytecode
+>4	lelong		x	(%d global symbols,
+>8	lelong		x	%d global fields,
+>12	lelong		x	%d bytecode ops)
+!:mime	application/x-nekovm-bytecode
+
diff --git a/contrib/file/Magdir/netbsd b/contrib/file/magic/Magdir/netbsd
similarity index 94%
rename from contrib/file/Magdir/netbsd
rename to contrib/file/magic/Magdir/netbsd
index 927acedf315..3234610af13 100644
--- a/contrib/file/Magdir/netbsd
+++ b/contrib/file/magic/Magdir/netbsd
@@ -1,16 +1,14 @@
 
 #------------------------------------------------------------------------------
-# $File: netbsd,v 1.19 2011/10/31 17:23:34 christos Exp $
+# $File: netbsd,v 1.21 2014/03/29 15:40:34 christos Exp $
 # netbsd:  file(1) magic for NetBSD objects
 #
 # All new-style magic numbers are in network byte order.
+# The old-style magic numbers are indistinguishable from the same magic
+# numbers used in other systems, and are handled, for all those systems,
+# in aout.
 #
 
-0	lelong			000000407	a.out NetBSD little-endian object file
->16	lelong			>0		not stripped
-0	belong			000000407	a.out NetBSD big-endian object file
->16	belong			>0		not stripped
-
 0	belong&0377777777	041400413	a.out NetBSD/i386 demand paged
 >0	byte			&0x80		
 >>20	lelong			<4096		shared library
@@ -102,25 +100,25 @@
 0	belong&0377777777	045200507	a.out NetBSD/powerpc core
 >12	string			>\0		from '%s'
 
-0	belong&0377777777	042400413	a.out NetBSD/sparc demand paged
+0	belong&0377777777	042400413	a.out NetBSD/SPARC demand paged
 >0	byte			&0x80		
 >>20	belong			<8192		shared library
 >>20	belong			=8192		dynamically linked executable
 >>20	belong			>8192		dynamically linked executable
 >0	byte			^0x80		executable
 >16	belong			>0		not stripped
-0	belong&0377777777	042400410	a.out NetBSD/sparc pure
+0	belong&0377777777	042400410	a.out NetBSD/SPARC pure
 >0	byte			&0x80		dynamically linked executable
 >0	byte			^0x80		executable
 >16	belong			>0		not stripped
-0	belong&0377777777	042400407	a.out NetBSD/sparc
+0	belong&0377777777	042400407	a.out NetBSD/SPARC
 >0	byte			&0x80		dynamically linked executable
 >0	byte			^0x80
 >>0	byte			&0x40		position independent
 >>20	belong			!0		executable
 >>20	belong			=0		object file
 >16	belong			>0		not stripped
-0	belong&0377777777	042400507	a.out NetBSD/sparc core
+0	belong&0377777777	042400507	a.out NetBSD/SPARC core
 >12	string			>\0		from '%s'
 >32	belong			!0		(signal %d)
 
@@ -256,7 +254,7 @@
 >0	belong&0x03ff0000 0x00870000	\b, m68k BSD (8K pages)
 >0	belong&0x03ff0000 0x00880000	\b, m68k BSD (4K pages)
 >0	belong&0x03ff0000 0x00890000	\b, ns32532 BSD
->0	belong&0x03ff0000 0x008a0000	\b, sparc/32 BSD
+>0	belong&0x03ff0000 0x008a0000	\b, SPARC/32 BSD
 >0	belong&0x03ff0000 0x008b0000	\b, pmax BSD
 >0	belong&0x03ff0000 0x008c0000	\b, vax BSD (1K pages)
 >0	belong&0x03ff0000 0x008d0000	\b, alpha BSD
@@ -270,7 +268,7 @@
 >0	belong&0x03ff0000 0x00950000	\b, mips2 BSD
 >0	belong&0x03ff0000 0x00960000	\b, parisc BSD
 >0	belong&0x03ff0000 0x00970000	\b, sh5/64 BSD
->0	belong&0x03ff0000 0x00980000	\b, sparc/64 BSD
+>0	belong&0x03ff0000 0x00980000	\b, SPARC/64 BSD
 >0	belong&0x03ff0000 0x00990000	\b, amd64 BSD
 >0	belong&0x03ff0000 0x009a0000	\b, hp200 (68010) BSD
 >0	belong&0x03ff0000 0x009b0000	\b, hp300 (68020+68881) BSD
diff --git a/contrib/file/Magdir/netscape b/contrib/file/magic/Magdir/netscape
similarity index 100%
rename from contrib/file/Magdir/netscape
rename to contrib/file/magic/Magdir/netscape
diff --git a/contrib/file/Magdir/netware b/contrib/file/magic/Magdir/netware
similarity index 100%
rename from contrib/file/Magdir/netware
rename to contrib/file/magic/Magdir/netware
diff --git a/contrib/file/Magdir/news b/contrib/file/magic/Magdir/news
similarity index 100%
rename from contrib/file/Magdir/news
rename to contrib/file/magic/Magdir/news
diff --git a/contrib/file/Magdir/nitpicker b/contrib/file/magic/Magdir/nitpicker
similarity index 86%
rename from contrib/file/Magdir/nitpicker
rename to contrib/file/magic/Magdir/nitpicker
index d1a66287fd5..2486dee037f 100644
--- a/contrib/file/Magdir/nitpicker
+++ b/contrib/file/magic/Magdir/nitpicker
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: nitpicker,v 1.4 2009/09/19 16:28:11 christos Exp $
+# $File: nitpicker,v 1.6 2014/04/30 21:41:02 christos Exp $
 # nitpicker:  file(1) magic for Flowfiles.
 # From: Christian Jachmann  http://www.nitpicker.de
 0	string	NPFF	NItpicker Flow File 
diff --git a/contrib/file/Magdir/oasis b/contrib/file/magic/Magdir/oasis
similarity index 75%
rename from contrib/file/Magdir/oasis
rename to contrib/file/magic/Magdir/oasis
index e527185fd1c..45ad6d137d2 100644
--- a/contrib/file/Magdir/oasis
+++ b/contrib/file/magic/Magdir/oasis
@@ -1,9 +1,9 @@
 
 #------------------------------------------------------------------------------
-# $File: oasis,v 1.1 2011/03/15 02:09:38 christos Exp $
+# $File: oasis,v 1.2 2014/06/03 19:17:27 christos Exp $
 # OASIS
 # Summary: OASIS stream file
-# Long descripton: Open Artwork System Interchange Standard
+# Long description: Open Artwork System Interchange Standard
 # File extension: .oas
 # Full name:	Ben Cowley (bcowley@broadcom.com)
 #		Philip Dixon (pdixon@broadcom.com)
diff --git a/contrib/file/Magdir/ocaml b/contrib/file/magic/Magdir/ocaml
similarity index 100%
rename from contrib/file/Magdir/ocaml
rename to contrib/file/magic/Magdir/ocaml
diff --git a/contrib/file/Magdir/octave b/contrib/file/magic/Magdir/octave
similarity index 100%
rename from contrib/file/Magdir/octave
rename to contrib/file/magic/Magdir/octave
diff --git a/contrib/file/Magdir/ole2compounddocs b/contrib/file/magic/Magdir/ole2compounddocs
similarity index 100%
rename from contrib/file/Magdir/ole2compounddocs
rename to contrib/file/magic/Magdir/ole2compounddocs
diff --git a/contrib/file/Magdir/olf b/contrib/file/magic/Magdir/olf
similarity index 100%
rename from contrib/file/Magdir/olf
rename to contrib/file/magic/Magdir/olf
diff --git a/contrib/file/Magdir/os2 b/contrib/file/magic/Magdir/os2
similarity index 100%
rename from contrib/file/Magdir/os2
rename to contrib/file/magic/Magdir/os2
diff --git a/contrib/file/Magdir/os400 b/contrib/file/magic/Magdir/os400
similarity index 100%
rename from contrib/file/Magdir/os400
rename to contrib/file/magic/Magdir/os400
diff --git a/contrib/file/Magdir/os9 b/contrib/file/magic/Magdir/os9
similarity index 100%
rename from contrib/file/Magdir/os9
rename to contrib/file/magic/Magdir/os9
diff --git a/contrib/file/Magdir/osf1 b/contrib/file/magic/Magdir/osf1
similarity index 100%
rename from contrib/file/Magdir/osf1
rename to contrib/file/magic/Magdir/osf1
diff --git a/contrib/file/Magdir/palm b/contrib/file/magic/Magdir/palm
similarity index 54%
rename from contrib/file/Magdir/palm
rename to contrib/file/magic/Magdir/palm
index 536f384a294..e852cc71810 100644
--- a/contrib/file/Magdir/palm
+++ b/contrib/file/magic/Magdir/palm
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: palm,v 1.9 2012/01/16 15:16:43 christos Exp $
+# $File: palm,v 1.13 2014/03/30 21:40:08 christos Exp $
 # palm:	 file(1) magic for PalmOS {.prc,.pdb}: applications, docfiles, and hacks
 #
 # Brian Lalor 
@@ -9,18 +9,70 @@
 # 8 character identifiers at byte 60, one I found for appl is BIGb.
 # What are the possibilities and where is this documented?
 
+# The common header format for PalmOS .pdb/.prc files is
+# {
+#         char            name[ 32 ];
+#         Word            attributes;
+#         Word            version;
+#         DWord           creationDate;
+#         DWord           modificationDate;
+#         DWord           lastBackupDate;
+#         DWord           modificationNumber;
+#         DWord           appInfoID;
+#         DWord           sortInfoID;
+#         char            type[4];
+#         char            creator[4];
+#         DWord           uniqueIDSeed;
+#         RecordListType  recordList;
+# };
+#
+# Datestamps are unsigned seconds since the MacOS epoch (Jan 1, 1904),
+# or Unix/POSIX time + 2082844800.
+
+0		name		aportisdoc
+# date is supposed to be big-endian seconds since 1 Jan 1904, but many
+# files contain the timestamp in little-endian or a completely
+# nonsensical value...
+#>36		bedate-2082844800	>0	\b, created %s
+# compression: 1=uncomp, 2=orig, 0x4448=HuffDic
+>(78.L)		beshort		=1		\b, uncompressed
+# compressed
+>(78.L)		beshort		>1
+>>(78.L+4)	belong		x		\b, %d bytes uncompressed
+
 # appl
-#59	byte			\0
-#>60	string			appl		PalmOS application
-#>0	string			>\0		"%s"
-# TEXt
-#59	byte			\0
-#>60	belong			TEXt		AportisDoc file
-#>0	string			>\0		"%s"
+#60		string		appl		PalmOS application
+#>0		string		>\0		"%s"
+
 # HACK
-#59	byte			\0
-#>60	string			HACK		HackMaster hack
-#>0	string			>\0		"%s"
+#60		string		HACK		HackMaster hack
+#>0		string		>\0		"%s"
+
+# iSiloX e-book
+60		string		SDocSilX	iSiloX E-book
+>0		string		>\0		"%s"
+
+# Mobipocket (www.mobipocket.com), donated by Carl Witty
+# expanded by Ralf Brown
+60		string	 	BOOKMOBI	Mobipocket E-book
+# MobiPocket stores a full title, pointed at by the belong at offset
+# 0x54 in its header at (78.L), with length given by the belong at
+# offset 0x58.
+# there's no guarantee that the title string is null-terminated, but
+# we currently can't specify a variable-length string where the length
+# field is not at the start of the string; in practice, the data
+# following the string always seems to start with a zero byte
+>(78.L)		belong		x
+>>&(&0x50.L-4)	string		>\0		"%s"
+>0		use		aportisdoc
+>>(78.L+0x68)	belong		>0		\b, version %d
+>>(78.L+0x1C)	belong		!0		\b, codepage %d
+>>(78.L+0x0C)	beshort	 	>0		\b, encrypted (type %d)
+
+# AportisDoc/PalmDOC
+60		string		TEXtREAd	AportisDoc/PalmDOC E-book
+>0		string		>\0		"%s"
+>0		use		aportisdoc
 
 # Variety of PalmOS document types
 # Michael-John Turner 
@@ -89,8 +141,12 @@
 >>(0x4E.L+1)	byte		x		%02d)
 
 # Palm OS .prc file types
-60		string		libr		Palm OS dynamic library data
->0		string		>\0		"%s"
+60		string		libr
+# flags, only bit 0 or bit 6
+# http://en.wikipedia.org/wiki/PRC_%28Palm_OS%29
+# http://web.mit.edu/tytso/www/pilot/prc-format.html
+>0x20		beshort&0xffbe	0
+>>0		string		>\0		Palm OS dynamic library data "%s"
 60		string		ptch		Palm OS operating system patch data
 >0		string		>\0		"%s"
 
diff --git a/contrib/file/Magdir/parix b/contrib/file/magic/Magdir/parix
similarity index 100%
rename from contrib/file/Magdir/parix
rename to contrib/file/magic/Magdir/parix
diff --git a/contrib/file/Magdir/parrot b/contrib/file/magic/Magdir/parrot
similarity index 100%
rename from contrib/file/Magdir/parrot
rename to contrib/file/magic/Magdir/parrot
diff --git a/contrib/file/Magdir/pascal b/contrib/file/magic/Magdir/pascal
similarity index 100%
rename from contrib/file/Magdir/pascal
rename to contrib/file/magic/Magdir/pascal
diff --git a/contrib/file/magic/Magdir/pbf b/contrib/file/magic/Magdir/pbf
new file mode 100644
index 00000000000..d133d12bf62
--- /dev/null
+++ b/contrib/file/magic/Magdir/pbf
@@ -0,0 +1,11 @@
+
+#------------------------------------------------------------------------------
+# $File: pbf,v 1.1 2013/12/21 14:27:24 christos Exp $
+# file(1) magic(5) data for OpenStreetMap
+
+# OpenStreetMap Protocolbuffer Binary Format (.osm.pbf)
+# http://wiki.openstreetmap.org/wiki/PBF_Format
+# From: Markus Heidelberg 
+0	belong		0x0000000D
+>4	beshort		0x0A09
+>>6	string		OSMHeader	OpenStreetMap Protocolbuffer Binary Format
diff --git a/contrib/file/Magdir/pbm b/contrib/file/magic/Magdir/pbm
similarity index 100%
rename from contrib/file/Magdir/pbm
rename to contrib/file/magic/Magdir/pbm
diff --git a/contrib/file/Magdir/pdf b/contrib/file/magic/Magdir/pdf
similarity index 85%
rename from contrib/file/Magdir/pdf
rename to contrib/file/magic/Magdir/pdf
index ccde22f2c15..dc2f7992d12 100644
--- a/contrib/file/Magdir/pdf
+++ b/contrib/file/magic/Magdir/pdf
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: pdf,v 1.6 2009/09/19 16:28:11 christos Exp $
+# $File: pdf,v 1.7 2013/08/22 07:47:26 christos Exp $
 # pdf:  file(1) magic for Portable Document Format
 #
 
@@ -12,5 +12,6 @@
 # From: Nick Schmalenberger 
 # Forms Data Format
 0       string          %FDF-           FDF document
+!:mime application/vnd.fdf
 >5      byte            x               \b, version %c
 >7      byte            x               \b.%c
diff --git a/contrib/file/Magdir/pdp b/contrib/file/magic/Magdir/pdp
similarity index 65%
rename from contrib/file/Magdir/pdp
rename to contrib/file/magic/Magdir/pdp
index fa4b82b6a89..0afee0c9ba5 100644
--- a/contrib/file/Magdir/pdp
+++ b/contrib/file/magic/Magdir/pdp
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: pdp,v 1.8 2009/09/19 16:28:11 christos Exp $
+# $File: pdp,v 1.10 2014/04/30 21:41:02 christos Exp $
 # pdp:  file(1) magic for PDP-11 executable/object and APL workspace
 #
 0	lelong		0101555		PDP-11 single precision APL workspace
@@ -10,18 +10,24 @@
 #
 0	leshort		0407		PDP-11 executable
 >8	leshort		>0		not stripped
->15	byte		>0		- version %ld
+>15	byte		>0		- version %d
 
-0	leshort		0401		PDP-11 UNIX/RT ldp
+# updated by Joerg Jenderek at Mar 2013
+# GRR: line below too general as it catches also Windows precompiled setup information *.PNF
+0	leshort		0401		
+# skip *.PNF with WinDirPathOffset 58h 
+>68	ulelong		!0x00000058	PDP-11 UNIX/RT ldp
+# skip *.PNF with high byte of InfVersionDatumCount zero
+#>>15	byte		!0		PDP-11 UNIX/RT ldp
 0	leshort		0405		PDP-11 old overlay
 
 0	leshort		0410		PDP-11 pure executable
 >8	leshort		>0		not stripped
->15	byte		>0		- version %ld
+>15	byte		>0		- version %d
 
 0	leshort		0411		PDP-11 separate I&D executable
 >8	leshort		>0		not stripped
->15	byte		>0		- version %ld
+>15	byte		>0		- version %d
 
 0	leshort		0437		PDP-11 kernel overlay
 
diff --git a/contrib/file/Magdir/perl b/contrib/file/magic/Magdir/perl
similarity index 55%
rename from contrib/file/Magdir/perl
rename to contrib/file/magic/Magdir/perl
index e11f2ab5874..b5b54fbc820 100644
--- a/contrib/file/Magdir/perl
+++ b/contrib/file/magic/Magdir/perl
@@ -1,20 +1,14 @@
 #------------------------------------------------------------------------------
-# $File: perl,v 1.17 2011/12/16 16:24:40 rrt Exp $
+# $File: perl,v 1.22 2014/04/28 12:04:35 christos Exp $
 # perl:  file(1) magic for Larry Wall's perl language.
 #
 # The `eval' lines recognizes an outrageously clever hack.
 # Keith Waclena 
 # Send additions to 
-0	search/1/w	#!\ /bin/perl			Perl script text executable
-!:mime	text/x-perl
 0	search/1	eval\ "exec\ /bin/perl		Perl script text
 !:mime	text/x-perl
-0	search/1/w	#!\ /usr/bin/perl		Perl script text executable
-!:mime	text/x-perl
 0	search/1	eval\ "exec\ /usr/bin/perl	Perl script text
 !:mime	text/x-perl
-0	search/1/w	#!\ /usr/local/bin/perl		Perl script text executable
-!:mime	text/x-perl
 0	search/1	eval\ "exec\ /usr/local/bin/perl	Perl script text
 !:mime	text/x-perl
 0	search/1	eval\ '(exit\ $?0)'\ &&\ eval\ 'exec	Perl script text
@@ -23,17 +17,20 @@
 !:mime	text/x-perl
 0	search/1	#!\ /usr/bin/env\ perl	Perl script text executable
 !:mime	text/x-perl
+0	search/1	#!
+>0	regex	\^#!.*/bin/perl$	Perl script text executable
+!:mime	text/x-perl
 
 # by Dmitry V. Levin and Alexey Tourbin
 # check the first line
 0	search/1	package
 >0	regex		\^package[\ \t]+[0-9A-Za-z_:]+\ *;	Perl5 module source text
+!:strength + 10
 # not 'p', check other lines
 0	search/1	!p
 >0	regex		\^package[\ \t]+[0-9A-Za-z_:]+\ *;
 >>0	regex		\^1\ *;|\^(use|sub|my)\ .*[(;{=]	Perl5 module source text
-
-
+!:strength + 10
 
 # Perl POD documents
 # From: Tom Hukins 
@@ -43,6 +40,9 @@
 0	search/1/W	\n\=head1\ 	Perl POD document text
 0	search/1/W	\=head2\ 	Perl POD document text
 0	search/1/W	\n\=head2\ 	Perl POD document text
+0	search/1/W	\=encoding\ 	Perl POD document text
+0	search/1/W	\n\=encoding\ 	Perl POD document text
+
 
 # Perl Storable data files.
 0	string	perl-store	perl Storable (v0.6) data
@@ -57,3 +57,34 @@
 >>4	byte	=5	(major 2)
 >>4	byte	=4	(major 2)
 >>5	byte	>0	(minor %d)
+
+# This is Debian #742949 by Zefram :
+# -----------------------------------------------------------
+# The Perl module Hash::SharedMem
+#  defines a file format
+# for a key/value store.  Details of the file format are in the "DESIGN"
+# file in the module distribution.  Magic:
+0	bequad	=0xa58afd185cbf5af7	Hash::SharedMem master file, big-endian
+>8	bequad	<0x1000000
+>>15	byte	>2	\b, line size 2^%d byte
+>>14	byte	>2	\b, page size 2^%d byte
+>>13	byte	&1
+>>>13	byte	>1	\b, max fanout %d
+0	lequad	=0xa58afd185cbf5af7	Hash::SharedMem master file, little-endian
+>8	lequad	<0x1000000
+>>8	byte	>2	\b, line size 2^%d byte
+>>9	byte	>2	\b, page size 2^%d byte
+>>10	byte	&1
+>>>10	byte	>1	\b, max fanout %d
+0	bequad	=0xc693dac5ed5e47c2	Hash::SharedMem data file, big-endian
+>8	bequad	<0x1000000
+>>15	byte	>2	\b, line size 2^%d byte
+>>14	byte	>2	\b, page size 2^%d byte
+>>13	byte	&1
+>>>13	byte	>1	\b, max fanout %d
+0	lequad	=0xc693dac5ed5e47c2	Hash::SharedMem data file, little-endian
+>8	lequad	<0x1000000
+>>8	byte	>2	\b, line size 2^%d byte
+>>9	byte	>2	\b, page size 2^%d byte
+>>10	byte	&1
+>>>10	byte	>1	\b, max fanout %d
diff --git a/contrib/file/magic/Magdir/pgf b/contrib/file/magic/Magdir/pgf
new file mode 100644
index 00000000000..825f5f68569
--- /dev/null
+++ b/contrib/file/magic/Magdir/pgf
@@ -0,0 +1,52 @@
+
+#------------------------------------------------------------------------------
+# $File: pgf,v 1.1 2013/04/22 15:19:49 christos Exp $
+# pgf: file(1) magic for Progressive Graphics File (PGF)
+#
+# 
+# 2013 by Philipp Hahn 
+0 string PGF Progressive Graphics image data,
+!:mime image/x-pgf
+>3	string	2	version %s,
+>3	string	4	version %s,
+>3	string	5	version %s,
+>3	string	6	version %s,
+#	PGFPreHeader
+#>>4	lelong	x	header size %d,
+#	PGFHeader
+>>8	lelong	x	%d x
+>>12	lelong	x	%d,
+>>16	byte	x	%d levels,
+>>17	byte	x	compression level %d,
+>>18	byte	x	%d bpp,
+>>19	byte	x	%d channels,
+>>20	clear	x
+>>20	byte	0	bitmap,
+>>20	byte	1	gray scale,
+>>20	byte	2	indexed color,
+>>20	byte	3	RGB color,
+>>20	byte	4	CYMK color,
+>>20	byte	5	HSL color,
+>>20	byte	6	HSB color,
+>>20	byte	7	multi-channel,
+>>20	byte	8	duo tone,
+>>20	byte	9	LAB color,
+>>20	byte	10	gray scale 16,
+>>20	byte	11	RGB color 48,
+>>20	byte	12	LAB color 48,
+>>20	byte	13	CYMK color 64,
+>>20	byte	14	deep multi-channel,
+>>20	byte	15	duo tone 16,
+>>20	byte	17	RGBA color,
+>>20	byte	18	gray scale 32,
+>>20	byte	19	RGB color 12,
+>>20	byte	20	RGB color 16,
+>>20	byte	255	unknown format,
+>>20	default	x	format 
+>>>20	byte	x	\b %d,
+>>21	byte	x	%d bpc
+#	PGFPostHeader
+#	Level-Sizes
+#>>(4.l+4)	lelong x level 0 size: %d
+#>>(4.l+8)	lelong x level 1 size: %d
+#>>(4.l+12)	lelong x level 2 size: %d
diff --git a/contrib/file/Magdir/pgp b/contrib/file/magic/Magdir/pgp
similarity index 100%
rename from contrib/file/Magdir/pgp
rename to contrib/file/magic/Magdir/pgp
diff --git a/contrib/file/Magdir/pkgadd b/contrib/file/magic/Magdir/pkgadd
similarity index 100%
rename from contrib/file/Magdir/pkgadd
rename to contrib/file/magic/Magdir/pkgadd
diff --git a/contrib/file/Magdir/plan9 b/contrib/file/magic/Magdir/plan9
similarity index 100%
rename from contrib/file/Magdir/plan9
rename to contrib/file/magic/Magdir/plan9
diff --git a/contrib/file/Magdir/plus5 b/contrib/file/magic/Magdir/plus5
similarity index 100%
rename from contrib/file/Magdir/plus5
rename to contrib/file/magic/Magdir/plus5
diff --git a/contrib/file/Magdir/printer b/contrib/file/magic/Magdir/printer
similarity index 86%
rename from contrib/file/Magdir/printer
rename to contrib/file/magic/Magdir/printer
index d9d39eefc83..10168266c92 100644
--- a/contrib/file/Magdir/printer
+++ b/contrib/file/magic/Magdir/printer
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: printer,v 1.25 2011/05/20 23:31:46 christos Exp $
+# $File: printer,v 1.26 2014/04/12 14:51:52 christos Exp $
 # printer:  file(1) magic for printer-formatted files
 #
 
@@ -68,6 +68,22 @@
 0	string		\033%-12345X@PJL
 >&0	search/10000	%!			PJL encapsulated PostScript document text
 
+# Rick Richardson 
+
+# For Fuji-Xerox Printers - HBPL stands for Host Based Printer Language
+# For Oki Data Printers - HIPERC
+# For Konica Minolta Printers - LAVAFLOW
+# For Samsung Printers - QPDL
+# For HP Printers - ZJS stands for Zenographics ZJStream
+0	string		\033%-12345X@PJL	HP Printer Job Language data
+>0	search/10000	@PJL\ ENTER\ LANGUAGE=HBPL	- HBPL
+>0	search/10000	@PJL\ ENTER\ LANGUAGE=HIPERC	- Oki Data HIPERC
+>0	search/10000	@PJL\ ENTER\ LANGUAGE=LAVAFLOW	- Konica Minolta LAVAFLOW
+>0	search/10000	@PJL\ ENTER\ LANGUAGE=QPDL	- Samsung QPDL
+>0	search/10000	@PJL\ ENTER\ LANGUAGE\ =\ QPDL	- Samsung QPDL
+>0	search/10000	@PJL\ ENTER\ LANGUAGE=ZJS	- HP ZJS
+
+
 # HP Printer Control Language, Daniel Quinlan (quinlan@yggdrasil.com)
 0	string		\033E\033	HP PCL printer data
 >3	string		\&l0A		- default page size
@@ -108,7 +124,7 @@
 
 #------------------------------------------------------------------------------
 # zenographics:  file(1) magic for Zenographics ZjStream printer data
-# Rick Richardson  rickr@mn.rr.com
+# Rick Richardson 
 0	string		JZJZ
 >0x12	string		ZZ		Zenographics ZjStream printer data (big-endian)
 0	string		ZJZJ
@@ -117,7 +133,7 @@
 
 #------------------------------------------------------------------------------
 # Oak Technologies printer stream
-# Rick Richardson 
+# Rick Richardson 
 0       string          OAK
 >0x07	byte		0
 >0x0b	byte		0	Oak Technologies printer stream
diff --git a/contrib/file/Magdir/project b/contrib/file/magic/Magdir/project
similarity index 100%
rename from contrib/file/Magdir/project
rename to contrib/file/magic/Magdir/project
diff --git a/contrib/file/Magdir/psdbms b/contrib/file/magic/Magdir/psdbms
similarity index 100%
rename from contrib/file/Magdir/psdbms
rename to contrib/file/magic/Magdir/psdbms
diff --git a/contrib/file/Magdir/pulsar b/contrib/file/magic/Magdir/pulsar
similarity index 100%
rename from contrib/file/Magdir/pulsar
rename to contrib/file/magic/Magdir/pulsar
diff --git a/contrib/file/magic/Magdir/pwsafe b/contrib/file/magic/Magdir/pwsafe
new file mode 100644
index 00000000000..93dcfb12346
--- /dev/null
+++ b/contrib/file/magic/Magdir/pwsafe
@@ -0,0 +1,14 @@
+
+#------------------------------------------------------------------------------
+# $File: pwsafe,v 1.1 2012/10/25 00:12:19 christos Exp $
+# pwsafe: file(1) magic for passwordsafe file
+#
+# Password Safe
+# http://passwordsafe.sourceforge.net/
+# file format specs
+# http://passwordsafe.svn.sourceforge.net/viewvc/passwordsafe/trunk/pwsafe/pwsafe/docs/formatV3.txt
+# V2 http://passwordsafe.svn.sourceforge.net/viewvc/passwordsafe/trunk/pwsafe/pwsafe/docs/formatV2.txt
+# V1 http://passwordsafe.svn.sourceforge.net/viewvc/passwordsafe/trunk/pwsafe/pwsafe/docs/notes.txt
+# V2 and V1 have no easy identifier that I can find
+# .psafe3
+0	string	PWS3	Password Safe V3 database
diff --git a/contrib/file/Magdir/pyramid b/contrib/file/magic/Magdir/pyramid
similarity index 100%
rename from contrib/file/Magdir/pyramid
rename to contrib/file/magic/Magdir/pyramid
diff --git a/contrib/file/Magdir/python b/contrib/file/magic/Magdir/python
similarity index 81%
rename from contrib/file/Magdir/python
rename to contrib/file/magic/Magdir/python
index e339014e9cf..d954ee63f57 100644
--- a/contrib/file/Magdir/python
+++ b/contrib/file/magic/Magdir/python
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: python,v 1.20 2011/12/13 13:53:14 christos Exp $
+# $File: python,v 1.25 2014/05/06 16:08:32 christos Exp $
 # python:  file(1) magic for python
 #
 # Outlook puts """ too for urgent messages
@@ -22,6 +22,7 @@
 0	belong		0x3b0c0d0a	python 3.0 byte-compiled
 0	belong		0x4f0c0d0a	python 3.1 byte-compiled
 0	belong		0x6c0c0d0a	python 3.2 byte-compiled
+0	belong		0x9e0c0d0a	python 3.3 byte-compiled
 
 0	search/1/w	#!\ /usr/bin/python	Python script text executable
 !:mime text/x-python
@@ -43,13 +44,13 @@
 !:mime text/x-python
 
 # comments
-0	search/4096	'''
->&0	regex	.*'''$	Python script text executable
-!:mime text/x-python
+#0	search/4096	'''
+#>&0	regex	.*'''$	Python script text executable
+#!:mime text/x-python
 
-0	search/4096	"""
->&0	regex	.*"""$	Python script text executable
-!:mime text/x-python
+#0	search/4096	"""
+#>&0	regex	.*"""$	Python script text executable
+#!:mime text/x-python
 
 # try:
 # except: or finally:
@@ -59,3 +60,8 @@
 !:mime text/x-python
 >&0	search/4096	finally:	Python script text executable
 !:mime text/x-python
+
+# def name(args, args):
+0	regex	 \^(\ |\\t){0,50}def\ {1,50}[a-zA-Z]{1,100}
+>&0	regex	\ {0,50}\\(([a-zA-Z]|,|\ ){1,255}\\):$ Python script text executable
+!:mime text/x-python
diff --git a/contrib/file/Magdir/revision b/contrib/file/magic/Magdir/revision
similarity index 94%
rename from contrib/file/Magdir/revision
rename to contrib/file/magic/Magdir/revision
index b337ee3b2d7..e4e4de10596 100644
--- a/contrib/file/Magdir/revision
+++ b/contrib/file/magic/Magdir/revision
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: revision,v 1.8 2010/11/25 15:00:12 christos Exp $
+# $File: revision,v 1.9 2013/02/06 14:18:52 christos Exp $
 # file(1) magic for revision control files
 # From Hendrik Scholz 
 0	string/t	/1\ :pserver:	cvs password text file
@@ -29,7 +29,7 @@
 >4	belong	=2		\b, version 2
 
 # Type: Git index file
-# From: Frédéric Brière 
+# From: Frederic Briare 
 0	string	DIRC		Git index
 >4	belong	>0		\b, version %d
 >>8	belong	>0		\b, %d entries
diff --git a/contrib/file/Magdir/riff b/contrib/file/magic/Magdir/riff
similarity index 85%
rename from contrib/file/Magdir/riff
rename to contrib/file/magic/Magdir/riff
index 4fffafacf31..d63ba4bbbef 100644
--- a/contrib/file/Magdir/riff
+++ b/contrib/file/magic/Magdir/riff
@@ -1,12 +1,52 @@
 
 #------------------------------------------------------------------------------
-# $File: riff,v 1.22 2011/09/06 11:00:06 christos Exp $
+# $File: riff,v 1.27 2014/04/30 21:41:02 christos Exp $
 # riff:  file(1) magic for RIFF format
 # See
 #
 #	http://www.seanet.com/users/matts/riffmci/riffmci.htm
 #
-# AVI section extended by Patrik Rdman 
+
+# audio format tag. Assume limits: max 1024 bit, 128 channels, 1 MHz
+0   name    riff-wave
+>0	leshort		1		\b, Microsoft PCM
+>>14	leshort		>0
+>>>14	leshort		<1024	\b, %d bit
+>0	leshort		2		\b, Microsoft ADPCM
+>0	leshort		6		\b, ITU G.711 A-law
+>0	leshort		7		\b, ITU G.711 mu-law
+>0	leshort		8		\b, Microsoft DTS
+>0	leshort		17		\b, IMA ADPCM
+>0	leshort		20		\b, ITU G.723 ADPCM (Yamaha)
+>0	leshort		49		\b, GSM 6.10
+>0	leshort		64		\b, ITU G.721 ADPCM
+>0	leshort		80		\b, MPEG
+>0	leshort		85		\b, MPEG Layer 3
+>0	leshort		0x2001		\b, DTS
+>2	leshort		=1		\b, mono
+>2	leshort		=2		\b, stereo
+>2	leshort		>2
+>>2	leshort		<128	\b, %d channels
+>4	lelong		>0
+>>4	lelong		<1000000	%d Hz
+
+# try to find "fmt "
+0   name    riff-walk
+>0  string  fmt\x20
+>>4 lelong  <0x80
+>>>8 use    riff-wave
+>0  string  LIST
+>>&(4.l+4)  use riff-walk
+>0  string  DISP
+>>&(4.l+4)  use riff-walk
+>0  string  bext
+>>&(4.l+4)  use riff-walk
+>0  string  Fake
+>>&(4.l+4)  use riff-walk
+>0  string  fact
+>>&(4.l+4)  use riff-walk
+
+# AVI section extended by Patrik Radman 
 #
 0	string		RIFF		RIFF (little-endian) data
 # RIFF Palette format
@@ -35,33 +75,21 @@
 # Microsoft WAVE format (*.wav)
 >8	string		WAVE		\b, WAVE audio
 !:mime	audio/x-wav
->>20	leshort		1		\b, Microsoft PCM
->>>34	leshort		>0		\b, %d bit
->>20	leshort		2		\b, Microsoft ADPCM
->>20	leshort		6		\b, ITU G.711 A-law
->>20	leshort		7		\b, ITU G.711 mu-law
->>20	leshort		8		\b, Microsoft DTS
->>20	leshort		17		\b, IMA ADPCM
->>20	leshort		20		\b, ITU G.723 ADPCM (Yamaha)
->>20	leshort		49		\b, GSM 6.10
->>20	leshort		64		\b, ITU G.721 ADPCM
->>20	leshort		80		\b, MPEG
->>20	leshort		85		\b, MPEG Layer 3
->>20	leshort		0x2001		\b, DTS
->>22	leshort		=1		\b, mono
->>22	leshort		=2		\b, stereo
->>22	leshort		>2		\b, %d channels
->>24	lelong		>0		%d Hz
+>>12    string  >\0
+>>>12   use     riff-walk
 # Corel Draw Picture
 >8	string		CDRA		\b, Corel Draw Picture
 !:mime	image/x-coreldraw
+>8	string		CDR6		\b, Corel Draw Picture, version 6
+!:mime	image/x-coreldraw
+>8	string		NUNDROOT	\b, Steinberg CuBase
 # AVI == Audio Video Interleave
 >8	string		AVI\040		\b, AVI
 !:mime	video/x-msvideo
 >>12    string          LIST
 >>>20   string          hdrlavih
->>>>&36 lelong          x               \b, %lu x
->>>>&40 lelong          x               %lu,
+>>>>&36 lelong          x               \b, %u x
+>>>>&40 lelong          x               %u,
 >>>>&4  lelong          >1000000        <1 fps,
 >>>>&4  lelong          1000000         1.00 fps,
 >>>>&4  lelong          500000          2.00 fps,
@@ -220,6 +248,7 @@
 >>24	belong		>0		%d Hz
 # Corel Draw Picture
 >8	string		CDRA		\b, Corel Draw Picture
+>8	string		CDR6		\b, Corel Draw Picture, version 6
 # AVI == Audio Video Interleave
 >8	string		AVI\040		\b, AVI
 # Animated Cursor format
@@ -247,7 +276,7 @@
 
 #------------------------------------------------------------------------------
 # MBWF/RF64
-# see EBU  TECH 3306 http://tech.ebu.ch/docs/tech/tech3306-2009.pdf
+# see EBU TECH 3306 http://tech.ebu.ch/docs/tech/tech3306-2009.pdf
 0	string	RF64\xff\xff\xff\xffWAVEds64		MBWF/RF64 audio
 !:mime	audio/x-wav
 >40	search/256	fmt\x20		\b
diff --git a/contrib/file/Magdir/rinex b/contrib/file/magic/Magdir/rinex
similarity index 100%
rename from contrib/file/Magdir/rinex
rename to contrib/file/magic/Magdir/rinex
diff --git a/contrib/file/Magdir/rpm b/contrib/file/magic/Magdir/rpm
similarity index 69%
rename from contrib/file/Magdir/rpm
rename to contrib/file/magic/Magdir/rpm
index 85232c6cd16..9a795f841ad 100644
--- a/contrib/file/Magdir/rpm
+++ b/contrib/file/magic/Magdir/rpm
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: rpm,v 1.11 2011/06/14 12:47:41 christos Exp $
+# $File: rpm,v 1.12 2013/01/11 16:45:23 christos Exp $
 #
 # RPM: file(1) magic for Red Hat Packages   Erik Troan (ewt@redhat.com)
 #
@@ -31,22 +31,15 @@
 >>8	beshort		255		noarch
 
 #delta RPM    Daniel Novotny (dnovotny@redhat.com)
-0	string	drpm	Delta RPM
+0	string		drpm		Delta RPM
 !:mime  application/x-rpm
 >12	string 	x	%s
-
->>>8	beshort		11		MIPSel
->>>8	beshort		12		ARM
->>>8	beshort		13		MiNT
->>>8	beshort		14		S/390
->>>8	beshort		15		S/390x
->>>8	beshort		16		PowerPC64
->>>8	beshort		17		SuperH
->>>8	beshort		18		Xtensa
+>>8	beshort		11		MIPSel
+>>8	beshort		12		ARM
+>>8	beshort		13		MiNT
+>>8	beshort		14		S/390
+>>8	beshort		15		S/390x
+>>8	beshort		16		PowerPC64
+>>8	beshort		17		SuperH
+>>8	beshort		18		Xtensa
 >>10	string		x		%s
-
-# Type:	Delta RPM
-# From:	Daniel Novotny (dnovotny@redhat.com)
-0	string		drpm		Delta RPM
-!:mime application/x-rpm
->12	string		x		%s
diff --git a/contrib/file/Magdir/rtf b/contrib/file/magic/Magdir/rtf
similarity index 100%
rename from contrib/file/Magdir/rtf
rename to contrib/file/magic/Magdir/rtf
diff --git a/contrib/file/Magdir/ruby b/contrib/file/magic/Magdir/ruby
similarity index 100%
rename from contrib/file/Magdir/ruby
rename to contrib/file/magic/Magdir/ruby
diff --git a/contrib/file/Magdir/sc b/contrib/file/magic/Magdir/sc
similarity index 100%
rename from contrib/file/Magdir/sc
rename to contrib/file/magic/Magdir/sc
diff --git a/contrib/file/Magdir/sccs b/contrib/file/magic/Magdir/sccs
similarity index 100%
rename from contrib/file/Magdir/sccs
rename to contrib/file/magic/Magdir/sccs
diff --git a/contrib/file/Magdir/scientific b/contrib/file/magic/Magdir/scientific
similarity index 91%
rename from contrib/file/Magdir/scientific
rename to contrib/file/magic/Magdir/scientific
index 7418f1ba54a..f780743ca49 100644
--- a/contrib/file/Magdir/scientific
+++ b/contrib/file/magic/Magdir/scientific
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: scientific,v 1.7 2010/09/20 19:19:17 rrt Exp $
+# $File: scientific,v 1.9 2014/06/03 19:01:34 christos Exp $
 # scientific:  file(1) magic for scientific formats 
 #
 # From: Joe Krahn 
@@ -65,7 +65,7 @@
 0       search/1/c	0\ HEAD         GEDCOM genealogy text
 >&0     search		1\ GEDC
 >>&0    search		2\ VERS         version
->>>&1   search/1	>\0		%s
+>>>&1   string		>\0		%s
 # From: Phil Endecott 
 0	string	\000\060\000\040\000\110\000\105\000\101\000\104		GEDCOM data
 0	string	\060\000\040\000\110\000\105\000\101\000\104\000		GEDCOM data
@@ -91,12 +91,12 @@
 # uppercase letters. However, examples have been seen without the date string,
 # e.g., the example on the chemime site.
 0	string	HEADER\ \ \ \ 
->&0	regex/1	\^.{40}
->>&0	regex/1	[0-9]{2}-[A-Z]{3}-[0-9]{2}\ {3}
->>>&0	regex/1s	[A-Z0-9]{4}.{14}$
->>>>&0	regex/1	[A-Z0-9]{4}	Protein Data Bank data, ID Code %s
+>&0	regex/1l	\^.{40}
+>>&0	regex/1l	[0-9]{2}-[A-Z]{3}-[0-9]{2}\ {3}
+>>>&0	regex/1ls	[A-Z0-9]{4}.{14}$
+>>>>&0	regex/1l	[A-Z0-9]{4}	Protein Data Bank data, ID Code %s
 !:mime	chemical/x-pdb
->>>>0	regex/1	[0-9]{2}-[A-Z]{3}-[0-9]{2}	\b, %s
+>>>>0	regex/1l	[0-9]{2}-[A-Z]{3}-[0-9]{2}	\b, %s
 
 # Type:	GDSII Stream file
 0	belong	0x00060002	GDSII Stream file
diff --git a/contrib/file/Magdir/securitycerts b/contrib/file/magic/Magdir/securitycerts
similarity index 100%
rename from contrib/file/Magdir/securitycerts
rename to contrib/file/magic/Magdir/securitycerts
diff --git a/contrib/file/Magdir/selinux b/contrib/file/magic/Magdir/selinux
similarity index 100%
rename from contrib/file/Magdir/selinux
rename to contrib/file/magic/Magdir/selinux
diff --git a/contrib/file/Magdir/sendmail b/contrib/file/magic/Magdir/sendmail
similarity index 100%
rename from contrib/file/Magdir/sendmail
rename to contrib/file/magic/Magdir/sendmail
diff --git a/contrib/file/Magdir/sequent b/contrib/file/magic/Magdir/sequent
similarity index 61%
rename from contrib/file/Magdir/sequent
rename to contrib/file/magic/Magdir/sequent
index 0ce6bf2c796..9ef2aa9e67d 100644
--- a/contrib/file/Magdir/sequent
+++ b/contrib/file/magic/Magdir/sequent
@@ -1,35 +1,45 @@
 
 #------------------------------------------------------------------------------
-# $File: sequent,v 1.8 2009/09/19 16:28:12 christos Exp $
+# $File: sequent,v 1.11 2014/06/02 19:27:54 christos Exp $
 # sequent:  file(1) magic for Sequent machines
 #
 # Sequent information updated by Don Dwiggins .
 # For Sequent's multiprocessor systems (incomplete).
 0	lelong	0x00ea        	BALANCE NS32000 .o
 >16	lelong	>0		not stripped
->124	lelong	>0		version %ld
+>124	lelong	>0		version %d
 0	lelong	0x10ea        	BALANCE NS32000 executable (0 @ 0)
 >16	lelong  >0            	not stripped
->124	lelong	>0		version %ld
+>124	lelong	>0		version %d
 0	lelong	0x20ea        	BALANCE NS32000 executable (invalid @ 0)
 >16	lelong  >0            	not stripped
->124	lelong	>0		version %ld
+>124	lelong	>0		version %d
 0	lelong	0x30ea        	BALANCE NS32000 standalone executable
 >16	lelong  >0          	not stripped
->124	lelong	>0		version %ld
+>124	lelong	>0		version %d
 #
 # Symmetry information added by Jason Merrill .
 # Symmetry magic nums will not be reached if DOS COM comes before them;
 # byte 0xeb is matched before these get a chance.
 0	leshort	0x12eb		SYMMETRY i386 .o
 >16	lelong	>0		not stripped
->124	lelong	>0		version %ld
+>124	lelong	>0		version %d
 0	leshort	0x22eb		SYMMETRY i386 executable (0 @ 0)
 >16	lelong	>0		not stripped
->124	lelong	>0		version %ld
+>124	lelong	>0		version %d
 0	leshort	0x32eb		SYMMETRY i386 executable (invalid @ 0)
 >16	lelong	>0		not stripped
->124	lelong	>0		version %ld
+>124	lelong	>0		version %d
 0	leshort	0x42eb		SYMMETRY i386 standalone executable
 >16	lelong	>0		not stripped
->124	lelong	>0		version %ld
+>124	lelong	>0		version %d
+# http://en.wikipedia.org/wiki/Sequent_Computer_Systems
+# below test line conflicts with MS-DOS 2.11 floppies and Acronis loader
+#0	leshort	0x42eb		SYMMETRY i386 standalone executable
+0	leshort	0x42eb		
+# skip unlike negative version
+>124	lelong	>-1		
+# assuming version 28867614 is very low probable
+>>124	lelong	!28867614	SYMMETRY i386 standalone executable
+>>>16	lelong	>0		not stripped
+>>>124	lelong	>0		version %d
diff --git a/contrib/file/magic/Magdir/sereal b/contrib/file/magic/Magdir/sereal
new file mode 100644
index 00000000000..e40f9e2f4f0
--- /dev/null
+++ b/contrib/file/magic/Magdir/sereal
@@ -0,0 +1,24 @@
+#------------------------------------------------------------------------------
+# $File: sereal,v 1.1 2014/05/14 23:04:59 christos Exp $
+# sereal: file(1) magic the Sereal binary serialization format
+#
+# From: Ævar Arnfjörð Bjarmason 
+#
+# See the specification of the format at
+# https://github.com/Sereal/Sereal/blob/master/sereal_spec.pod#document-header-format
+#
+# I'd have liked to do the byte&0xF0 matching against 0, 1, 2 ... by
+# doing (byte&0xF0)>>4 here, but unfortunately that's not
+# supported. So when we print out a message about an unknown format
+# we'll print out e.g. 0x30 instead of the more human-readable
+# 0x30>>4.
+#
+# See https://github.com/Sereal/Sereal/commit/35372ae01d in the
+# Sereal.git repository for test Sereal data.
+0      string             \=srl   Sereal data
+!:mime application/sereal
+>4     byte&0x0F          x       (version %d,
+>4     byte&0xF0          0x00    uncompressed)
+>4     byte&0xF0          0x10    compressed with non-incremental Snappy)
+>4     byte&0xF0          0x20    compressed with incremental Snappy)
+>4     byte&0xF0          >0x20   unknown subformat, flag: %d>>4)
diff --git a/contrib/file/magic/Magdir/sgi b/contrib/file/magic/Magdir/sgi
new file mode 100644
index 00000000000..a6223d78d11
--- /dev/null
+++ b/contrib/file/magic/Magdir/sgi
@@ -0,0 +1,138 @@
+
+#------------------------------------------------------------------------------
+# $File: sgi,v 1.21 2014/04/30 21:41:02 christos Exp $
+# sgi:  file(1) magic for Silicon Graphics operating systems and applications
+#
+# Executable images are handled either in aout (for old-style a.out
+# files for 68K; they are indistinguishable from other big-endian 32-bit
+# a.out files) or in mips (for MIPS ECOFF and Ucode files)
+#
+
+# kbd file definitions
+0	string	kbd!map		kbd map file
+>8	byte	>0		Ver %d:
+>10	short	>0		with %d table(s)
+
+0	beshort	0x8765		disk quotas file
+
+0	beshort	0x0506		IRIS Showcase file
+>2	byte	0x49		-
+>3	byte	x		- version %d
+0	beshort	0x0226		IRIS Showcase template
+>2	byte	0x63		-
+>3	byte	x		- version %d
+0	belong	0x5343464d	IRIS Showcase file
+>4	byte	x		- version %d
+0	belong	0x5443464d	IRIS Showcase template
+>4	byte	x		- version %d
+0	belong	0xdeadbabe	IRIX Parallel Arena
+>8	belong	>0		- version %d
+
+# core files
+#
+# 32bit core file
+0	belong	0xdeadadb0	IRIX core dump
+>4	belong	1		of
+>16	string	>\0		'%s'
+# 64bit core file
+0	belong	0xdeadad40	IRIX 64-bit core dump
+>4	belong	1		of
+>16	string	>\0		'%s'
+# N32bit core file
+0       belong	0xbabec0bb	IRIX N32 core dump
+>4      belong	1               of
+>16     string	>\0             '%s'
+# New style crash dump file
+0	string	\x43\x72\x73\x68\x44\x75\x6d\x70	IRIX vmcore dump of
+>36	string	>\0					'%s'
+
+# Trusted IRIX info
+0	string	SGIAUDIT	SGI Audit file
+>8	byte	x		- version %d
+>9	byte	x		\b.%d
+#
+0	string	WNGZWZSC	Wingz compiled script
+0	string	WNGZWZSS	Wingz spreadsheet
+0	string	WNGZWZHP	Wingz help file
+#
+0	string	#Inventor V	IRIS Inventor 1.0 file
+0	string	#Inventor V2	Open Inventor 2.0 file
+# GLF is OpenGL stream encoding
+0	string	glfHeadMagic();		GLF_TEXT
+4	belong	0x7d000000		GLF_BINARY_LSB_FIRST
+!:strength -30
+4	belong	0x0000007d		GLF_BINARY_MSB_FIRST
+!:strength -30
+# GLS is OpenGL stream encoding; GLS is the successor of GLF
+0	string	glsBeginGLS(		GLS_TEXT
+4	belong	0x10000000		GLS_BINARY_LSB_FIRST
+!:strength -30
+4	belong	0x00000010		GLS_BINARY_MSB_FIRST
+!:strength -30
+
+#
+#
+# Performance Co-Pilot file types
+0	string	PmNs				PCP compiled namespace (V.0)
+0	string	PmN				PCP compiled namespace
+>3	string	>\0				(V.%1.1s)
+#3	lelong	0x84500526			PCP archive
+3	belong	0x84500526			PCP archive
+>7	byte	x				(V.%d)
+#>20	lelong	-2				temporal index
+#>20	lelong	-1				metadata
+#>20	lelong	0				log volume #0
+#>20	lelong	>0				log volume #%d
+>20	belong	-2				temporal index
+>20	belong	-1				metadata
+>20	belong	0				log volume #0
+>20	belong	>0				log volume #%d
+>24	string	>\0				host: %s
+0	string	PCPFolio			PCP
+>9	string	Version:			Archive Folio
+>18	string	>\0				(V.%s)
+0	string	#pmchart			PCP pmchart view
+>9	string	Version
+>17	string	>\0				(V%-3.3s)
+0	string	#kmchart			PCP kmchart view
+>9	string	Version
+>17	string	>\0				(V.%s)
+0	string	pmview				PCP pmview config
+>7	string	Version
+>15	string	>\0				(V%-3.3s)
+0	string	#pmlogger			PCP pmlogger config
+>10	string	Version
+>18	string	>\0				(V%1.1s)
+0	string	#pmdahotproc			PCP pmdahotproc config
+>13	string	Version
+>21	string	>\0				(V%-3.3s)
+0	string	PcPh				PCP Help
+>4	string	1				Index
+>4	string	2				Text
+>5	string	>\0				(V.%1.1s)
+0	string	#pmieconf-rules			PCP pmieconf rules
+>16	string	>\0				(V.%1.1s)
+3	string	pmieconf-pmie			PCP pmie config
+>17	string	>\0				(V.%1.1s)
+
+# SpeedShop data files
+0	lelong	0x13130303			SpeedShop data file
+
+# mdbm files
+0	lelong	0x01023962			mdbm file, version 0 (obsolete)
+0	string	mdbm				mdbm file,
+>5	byte	x				version %d,
+>6	byte	x				2^%d pages,
+>7	byte	x				pagesize 2^%d,
+>17	byte	x				hash %d,
+>11	byte	x				dataformat %d
+
+# Alias Maya files
+0	string/t	//Maya\040ASCII	Alias Maya Ascii File,
+>13	string	>\0	version %s
+8	string	MAYAFOR4	Alias Maya Binary File,
+>32	string	>\0	version %s scene
+8	string	MayaFOR4	Alias Maya Binary File,
+>32	string	>\0	version %s scene
+8	string	CIMG		Alias Maya Image File
+8	string	DEEP		Alias Maya Image File
diff --git a/contrib/file/Magdir/sgml b/contrib/file/magic/Magdir/sgml
similarity index 84%
rename from contrib/file/Magdir/sgml
rename to contrib/file/magic/Magdir/sgml
index 3f78c2f4d5c..f9cab081653 100644
--- a/contrib/file/Magdir/sgml
+++ b/contrib/file/magic/Magdir/sgml
@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: sgml,v 1.27 2011/12/07 12:01:24 rrt Exp $
+# $File: sgml,v 1.30 2013/12/21 14:27:24 christos Exp $
 # Type:	SVG Vectorial Graphics
 # From:	Noel Torres 
 0	string		\>19	search/4096	\
+0	string		\15	string		>\0
+>>19	search/4096	\4	string		>\0		- version %s
@@ -73,8 +81,7 @@
 # the main program that uses that format, but there are other programs
 # that use "libpcap", or that use the same capture file format.)
 #
-0	ubelong		0xa1b2c3d4	tcpdump capture file (big-endian)
-!:mime	application/vnd.tcpdump.pcap
+0	name		pcap-be
 >4	beshort		x		- version %d
 >6	beshort		x		\b.%d
 >20	belong		0		(No link-layer encapsulation
@@ -116,8 +123,10 @@
 >20	belong		127		(802.11 with radiotap header
 >20	belong		129		(Linux ARCNET
 >20	belong		138		(Apple IP over IEEE 1394
+>20	belong		139		(MTP2 with pseudo-header
 >20	belong		140		(MTP2
 >20	belong		141		(MTP3
+>20	belong		142		(SCCP
 >20	belong		143		(DOCSIS
 >20	belong		144		(IrDA
 >20	belong		147		(Private use 0
@@ -137,72 +146,53 @@
 >20	belong		161		(Private use 14
 >20	belong		162		(Private use 15
 >20	belong		163		(802.11 with AVS header
+>20	belong		165		(BACnet MS/TP
+>20	belong		166		(PPPD
+>20	belong		169		(GPRS LLC
+>20	belong		177		(Linux LAPD
+>20	belong		187		(Bluetooth HCI H4
+>20	belong		189		(Linux USB
+>20	belong		192		(PPI
+>20	belong		195		(802.15.4
+>20	belong		196		(SITA
+>20	belong		197		(Endace ERF
+>20	belong		201		(Bluetooth HCI H4 with pseudo-header
+>20	belong		202		(AX.25 with KISS header
+>20	belong		203		(LAPD
+>20	belong		204		(PPP with direction pseudo-header
+>20	belong		205		(Cisco HDLC with direction pseudo-header
+>20	belong		206		(Frame Relay with direction pseudo-header
+>20	belong		209		(Linux IPMB
+>20	belong		215		(802.15.4 with non-ASK PHY header
+>20	belong		220		(Memory-mapped Linux USB
+>20	belong		224		(Fibre Channel FC-2
+>20	belong		225		(Fibre Channel FC-2 with frame delimiters
+>20	belong		226		(Solaris IPNET
+>20	belong		227		(SocketCAN
+>20	belong		228		(Raw IPv4
+>20	belong		229		(Raw IPv6
+>20	belong		230		(802.15.4 without FCS
+>20	belong		231		(D-Bus messages
+>20	belong		235		(DVB-CI
+>20	belong		236		(MUX27010
+>20	belong		237		(STANAG 5066 D_PDUs
+>20	belong		239		(Linux netlink NFLOG messages
+>20	belong		240		(Hilscher netAnalyzer
+>20	belong		241		(Hilscher netAnalyzer with delimiters
+>20	belong		242		(IP-over-Infiniband
+>20	belong		243		(MPEG-2 Transport Stream packets
+>20	belong		244		(ng4t ng40
+>20	belong		245		(NFC LLCP
+>20	belong		247		(Infiniband
+>20	belong		248		(SCTP
 >16	belong		x		\b, capture length %d)
+
+0	ubelong		0xa1b2c3d4	tcpdump capture file (big-endian)
+!:mime	application/vnd.tcpdump.pcap
+>0	use	pcap-be
 0	ulelong		0xa1b2c3d4	tcpdump capture file (little-endian)
 !:mime	application/vnd.tcpdump.pcap
->4	leshort		x		- version %d
->6	leshort		x		\b.%d
->20	lelong		0		(No link-layer encapsulation
->20	lelong		1		(Ethernet
->20	lelong		2		(3Mb Ethernet
->20	lelong		3		(AX.25
->20	lelong		4		(ProNET
->20	lelong		5		(CHAOS
->20	lelong		6		(Token Ring
->20	lelong		7		(ARCNET
->20	lelong		8		(SLIP
->20	lelong		9		(PPP
->20	lelong		10		(FDDI
->20	lelong		11		(RFC 1483 ATM
->20	lelong		12		(raw IP
->20	lelong		13		(BSD/OS SLIP
->20	lelong		14		(BSD/OS PPP
->20	lelong		19		(Linux ATM Classical IP
->20	lelong		50		(PPP or Cisco HDLC
->20	lelong		51		(PPP-over-Ethernet
->20	lelong		99		(Symantec Enterprise Firewall
->20	lelong		100		(RFC 1483 ATM
->20	lelong		101		(raw IP
->20	lelong		102		(BSD/OS SLIP
->20	lelong		103		(BSD/OS PPP
->20	lelong		104		(BSD/OS Cisco HDLC
->20	lelong		105		(802.11
->20	lelong		106		(Linux Classical IP over ATM
->20	lelong		107		(Frame Relay
->20	lelong		108		(OpenBSD loopback
->20	lelong		109		(OpenBSD IPsec encrypted
->20	lelong		112		(Cisco HDLC
->20	lelong		113		(Linux "cooked"
->20	lelong		114		(LocalTalk
->20	lelong		117		(OpenBSD PFLOG
->20	lelong		119		(802.11 with Prism header
->20	lelong		122		(RFC 2625 IP over Fibre Channel
->20	lelong		123		(SunATM
->20	lelong		127		(802.11 with radiotap header
->20	lelong		129		(Linux ARCNET
->20	lelong		138		(Apple IP over IEEE 1394
->20	lelong		140		(MTP2
->20	lelong		141		(MTP3
->20	lelong		143		(DOCSIS
->20	lelong		144		(IrDA
->20	lelong		147		(Private use 0
->20	lelong		148		(Private use 1
->20	lelong		149		(Private use 2
->20	lelong		150		(Private use 3
->20	lelong		151		(Private use 4
->20	lelong		152		(Private use 5
->20	lelong		153		(Private use 6
->20	lelong		154		(Private use 7
->20	lelong		155		(Private use 8
->20	lelong		156		(Private use 9
->20	lelong		157		(Private use 10
->20	lelong		158		(Private use 11
->20	lelong		159		(Private use 12
->20	lelong		160		(Private use 13
->20	lelong		161		(Private use 14
->20	lelong		162		(Private use 15
->20	lelong		163		(802.11 with AVS header
->16	lelong		x		\b, capture length %d)
+>0	use	\^pcap-be
 
 #
 # "libpcap"-with-Alexey-Kuznetsov's-patches capture files.
@@ -211,43 +201,9 @@
 # that use "libpcap", or that use the same capture file format.)
 #
 0	ubelong		0xa1b2cd34	extended tcpdump capture file (big-endian)
->4	beshort		x		- version %d
->6	beshort		x		\b.%d
->20	belong		0		(No link-layer encapsulation
->20	belong		1		(Ethernet
->20	belong		2		(3Mb Ethernet
->20	belong		3		(AX.25
->20	belong		4		(ProNET
->20	belong		5		(CHAOS
->20	belong		6		(Token Ring
->20	belong		7		(ARCNET
->20	belong		8		(SLIP
->20	belong		9		(PPP
->20	belong		10		(FDDI
->20	belong		11		(RFC 1483 ATM
->20	belong		12		(raw IP
->20	belong		13		(BSD/OS SLIP
->20	belong		14		(BSD/OS PPP
->16	belong		x		\b, capture length %d)
+>0	use	pcap-be
 0	ulelong		0xa1b2cd34	extended tcpdump capture file (little-endian)
->4	leshort		x		- version %d
->6	leshort		x		\b.%d
->20	lelong		0		(No link-layer encapsulation
->20	lelong		1		(Ethernet
->20	lelong		2		(3Mb Ethernet
->20	lelong		3		(AX.25
->20	lelong		4		(ProNET
->20	lelong		5		(CHAOS
->20	lelong		6		(Token Ring
->20	lelong		7		(ARCNET
->20	lelong		8		(SLIP
->20	lelong		9		(PPP
->20	lelong		10		(FDDI
->20	lelong		11		(RFC 1483 ATM
->20	lelong		12		(raw IP
->20	lelong		13		(BSD/OS SLIP
->20	lelong		14		(BSD/OS PPP
->16	lelong		x		\b, capture length %d)
+>0	use	\^pcap-be
 
 #
 # "pcap-ng" capture files.
@@ -295,9 +251,9 @@
 >8	lelong		x		\b, %d stations found
 
 #
-# EtherPeek/AiroPeek "version 9" capture files.
+# *Peek tagged capture files.
 #
-0	string		\177ver		EtherPeek/AiroPeek capture file
+0	string		\177ver		EtherPeek/AiroPeek/OmniPeek capture file
 
 #
 # Visual Networks traffic capture files.
diff --git a/contrib/file/Magdir/softquad b/contrib/file/magic/Magdir/softquad
similarity index 100%
rename from contrib/file/Magdir/softquad
rename to contrib/file/magic/Magdir/softquad
diff --git a/contrib/file/Magdir/spec b/contrib/file/magic/Magdir/spec
similarity index 100%
rename from contrib/file/Magdir/spec
rename to contrib/file/magic/Magdir/spec
diff --git a/contrib/file/Magdir/spectrum b/contrib/file/magic/Magdir/spectrum
similarity index 100%
rename from contrib/file/Magdir/spectrum
rename to contrib/file/magic/Magdir/spectrum
diff --git a/contrib/file/magic/Magdir/sql b/contrib/file/magic/Magdir/sql
new file mode 100644
index 00000000000..c69f44f0bb5
--- /dev/null
+++ b/contrib/file/magic/Magdir/sql
@@ -0,0 +1,83 @@
+
+#------------------------------------------------------------------------------
+# $File: sql,v 1.15 2014/04/30 21:41:02 christos Exp $
+# sql:  file(1) magic for SQL files
+#
+# From: "Marty Leisner" 
+# Recognize some MySQL files.
+# Elan Ruusamae , added MariaDB signatures
+# from https://bazaar.launchpad.net/~maria-captains/maria/5.5/view/head:/support-files/magic
+#
+0	beshort			0xfe01		MySQL table definition file
+>2	byte			x		Version %d
+0	belong&0xffffff00	0xfefe0700	MySQL MyISAM index file
+>3	byte			x		Version %d
+0	belong&0xffffff00	0xfefe0800	MySQL MyISAM compressed data file
+>3	byte			x		Version %d
+0	belong&0xffffff00	0xfefe0900	MySQL Maria index file
+>3	byte			x		Version %d
+0	belong&0xffffff00	0xfefe0A00	MySQL Maria compressed data file
+>3	byte			x		Version %d
+0	belong&0xffffff00	0xfefe0500	MySQL ISAM index file
+>3	byte			x		Version %d
+0	belong&0xffffff00	0xfefe0600	MySQL ISAM compressed data file
+>3	byte			x		Version %d
+0	string			\376bin		MySQL replication log
+0	belong&0xffffff00	0xfefe0b00
+>4	string			MARIALOG	MySQL Maria transaction log file
+>>3	byte			x		Version %d
+0	belong&0xffffff00	0xfefe0c00
+>4	string			MACF		MySQL Maria control file
+>>3	byte			x		Version %d
+
+#------------------------------------------------------------------------------
+# iRiver H Series database file 
+# From Ken Guest 
+# As observed from iRivNavi.iDB and unencoded firmware
+#
+0   string		iRivDB	iRiver Database file
+>11  string	>\0	Version %s
+>39  string		iHP-100	[H Series]
+
+#------------------------------------------------------------------------------
+# SQLite database files
+# Ken Guest , Ty Sarna, Zack Weinberg
+#
+# Version 1 used GDBM internally; its files cannot be distinguished
+# from other GDBM files.
+#
+# Version 2 used this format:
+0	string	**\ This\ file\ contains\ an\ SQLite  SQLite 2.x database
+
+# Version 3 of SQLite allows applications to embed their own "user version"
+# number in the database at offset 60.  Later, SQLite added an "application id"
+# at offset 68 that is preferred over "user version" for indicating the
+# associated application.
+#
+0   string  SQLite\ format\ 3
+>60 belong  =0x5f4d544e  Monotone source repository - SQLite3 database
+>68 belong  =0x0f055112  Fossil checkout - SQLite3 database
+>68 belong  =0x0f055113  Fossil global configuration - SQLite3 database
+>68 belong  =0x0f055111  Fossil repository - SQLite3 database
+>68 belong  =0x42654462  Bentley Systems BeSQLite Database - SQLite3 database
+>68 belong  =0x42654c6e  Bentley Systems Localization File - SQLite3 database
+>68 belong  =0x47504b47  OGC GeoPackage file - SQLite3 database
+>68 default x            SQLite 3.x database
+>>68 belong  !0          \b, application id %u
+>>60 belong  !0          \b, user version %d
+
+# SQLite Write-Ahead Log from SQLite version >= 3.7.0
+# http://www.sqlite.org/fileformat.html#walformat
+0	belong&0xfffffffe	0x377f0682	SQLite Write-Ahead Log,
+>4	belong	x	version %d
+
+# SQLite Rollback Journal
+# http://www.sqlite.org/fileformat.html#rollbackjournal
+0	string	\xd9\xd5\x05\xf9\x20\xa1\x63\xd7	SQLite Rollback Journal
+
+# Panasonic channel list database svl.bin or svl.db added by Joerg Jenderek
+# http://www.ullrich.es/job/service-menue/panasonic/panasonic-sendersortierung-sat-am-pc/
+# pceditor_V2003.jar
+0	string		PSDB\0			Panasonic channel list database
+>126	string		SQLite\ format\ 3	
+>>&-15	indirect	x			\b; contains 
diff --git a/contrib/file/Magdir/ssh b/contrib/file/magic/Magdir/ssh
similarity index 60%
rename from contrib/file/Magdir/ssh
rename to contrib/file/magic/Magdir/ssh
index c87f388303d..d867af0d7a4 100644
--- a/contrib/file/Magdir/ssh
+++ b/contrib/file/magic/Magdir/ssh
@@ -6,3 +6,6 @@
 
 0	string	ssh-dss\ 		OpenSSH DSA public key
 0	string	ssh-rsa\ 		OpenSSH RSA public key
+0	string	ecdsa-sha2-nistp256	OpenSSH ECDSA public key
+0	string	ecdsa-sha2-nistp384	OpenSSH ECDSA public key
+0	string	ecdsa-sha2-nistp521	OpenSSH ECDSA public key
diff --git a/contrib/file/Magdir/ssl b/contrib/file/magic/Magdir/ssl
similarity index 85%
rename from contrib/file/Magdir/ssl
rename to contrib/file/magic/Magdir/ssl
index 4d8706e2b8c..5d5daeeaf30 100644
--- a/contrib/file/Magdir/ssl
+++ b/contrib/file/magic/Magdir/ssl
@@ -5,3 +5,4 @@
 0	string	-----BEGIN\ CERTIFICATE\ REQ	PEM certificate request
 0	string	-----BEGIN\ RSA\ PRIVATE	PEM RSA private key
 0	string	-----BEGIN\ DSA\ PRIVATE	PEM DSA private key
+0	string	-----BEGIN\ EC\ PRIVATE	PEM EC private key
diff --git a/contrib/file/Magdir/sun b/contrib/file/magic/Magdir/sun
similarity index 68%
rename from contrib/file/Magdir/sun
rename to contrib/file/magic/Magdir/sun
index 1fd37ede65b..802a9eb8896 100644
--- a/contrib/file/Magdir/sun
+++ b/contrib/file/magic/Magdir/sun
@@ -1,12 +1,15 @@
 
 #------------------------------------------------------------------------------
-# $File: sun,v 1.22 2011/02/10 01:52:51 christos Exp $
+# $File: sun,v 1.27 2014/04/30 21:41:02 christos Exp $
 # sun:  file(1) magic for Sun machines
 #
 # Values for big-endian Sun (MC680x0, SPARC) binaries on pre-5.x
-# releases.  (5.x uses ELF.)
+# releases.  (5.x uses ELF.)  Entries for executables without an
+# architecture type, used before the 68020-based Sun-3's came out,
+# are in aout, as they're indistinguishable from other big-endian
+# 32-bit a.out files.
 #
-0	belong&077777777	0600413		sparc demand paged
+0	belong&077777777	0600413		a.out SunOS SPARC demand paged
 >0	byte		&0x80
 >>20	belong		<4096		shared library
 >>20	belong		=4096		dynamically linked executable
@@ -14,17 +17,17 @@
 >0	byte		^0x80		executable
 >16	belong		>0		not stripped
 
-0	belong&077777777	0600410		sparc pure
+0	belong&077777777	0600410		a.out SunOS SPARC pure
 >0	byte		&0x80		dynamically linked executable
 >0	byte		^0x80		executable
 >16	belong		>0		not stripped
 
-0	belong&077777777	0600407		sparc
+0	belong&077777777	0600407		a.out SunOS SPARC
 >0	byte		&0x80		dynamically linked executable
 >0	byte		^0x80		executable
 >16	belong		>0		not stripped
 
-0	belong&077777777	0400413		mc68020 demand paged
+0	belong&077777777	0400413		a.out SunOS mc68020 demand paged
 >0	byte		&0x80
 >>20	belong		<4096		shared library
 >>20	belong		=4096		dynamically linked executable
@@ -32,17 +35,17 @@
 >0	byte		^0x80		executable
 >16	belong		>0		not stripped
 
-0	belong&077777777	0400410		mc68020 pure
+0	belong&077777777	0400410		a.out SunOS mc68020 pure
 >0	byte		&0x80		dynamically linked executable
 >0	byte		^0x80		executable
 >16	belong		>0		not stripped
 
-0	belong&077777777	0400407		mc68020
+0	belong&077777777	0400407		a.out SunOS mc68020
 >0	byte		&0x80		dynamically linked executable
 >0	byte		^0x80		executable
 >16	belong		>0		not stripped
 
-0	belong&077777777	0200413		mc68010 demand paged
+0	belong&077777777	0200413		a.out SunOS mc68010 demand paged
 >0	byte		&0x80
 >>20	belong		<4096		shared library
 >>20	belong		=4096		dynamically linked executable
@@ -50,24 +53,16 @@
 >0	byte		^0x80		executable
 >16	belong		>0		not stripped
 
-0	belong&077777777	0200410		mc68010 pure
+0	belong&077777777	0200410		a.out SunOS mc68010 pure
 >0	byte		&0x80		dynamically linked executable
 >0	byte		^0x80		executable
 >16	belong		>0		not stripped
 
-0	belong&077777777	0200407		mc68010
+0	belong&077777777	0200407		a.out SunOS mc68010
 >0	byte		&0x80		dynamically linked executable
 >0	byte		^0x80		executable
 >16	belong		>0		not stripped
 
-# reworked these to avoid anything beginning with zero becoming "old sun-2"
-0	belong		0407		old sun-2 executable
->16	belong		>0		not stripped
-0	belong		0410		old sun-2 pure executable
->16	belong		>0		not stripped
-0	belong		0413		old sun-2 demand paged executable
->16	belong		>0		not stripped
-
 #
 # Core files.  "SPARC 4.x BCP" means "core file from a SunOS 4.x SPARC
 # binary executed in compatibility mode under SunOS 5.x".
@@ -96,10 +91,13 @@
 # Sun SunPC
 0	long		0xfa33c08e	SunPC 4.0 Hard Disk
 0	string		#SUNPC_CONFIG	SunPC 4.0 Properties Values
-# Sun snoop (see RFC 1761, which describes the capture file format).
+# Sun snoop (see RFC 1761, which describes the capture file format,
+# RFC 3827, which describes some additional datalink types, and
+# http://www.iana.org/assignments/snoop-datalink-types/snoop-datalink-types.xml,
+# which is the IANA registry of Snoop datalink types)
 #
 0	string		snoop		Snoop capture file
->8	belong		>0		- version %ld
+>8	belong		>0		- version %d
 >12	belong		0		(IEEE 802.3)
 >12	belong		1		(IEEE 802.4)
 >12	belong		2		(IEEE 802.5)
@@ -109,14 +107,25 @@
 >12	belong		6		(Character synchronous)
 >12	belong		7		(IBM channel-to-channel adapter)
 >12	belong		8		(FDDI)
->12	belong		9		(Unknown)
-
-# Microsoft ICM color profile
-36	string		acspMSFT	Microsoft ICM Color Profile
-!:mime	application/vnd.iccprofile
-# Sun KCMS
-36	string		acsp		Kodak Color Management System, ICC Profile
-!:mime	application/vnd.iccprofile
+>12	belong		9		(Other)
+>12	belong		10		(type %d)
+>12	belong		11		(type %d)
+>12	belong		12		(type %d)
+>12	belong		13		(type %d)
+>12	belong		14		(type %d)
+>12	belong		15		(type %d)
+>12	belong		16		(Fibre Channel)
+>12	belong		17		(ATM)
+>12	belong		18		(ATM Classical IP)
+>12	belong		19		(type %d)
+>12	belong		20		(type %d)
+>12	belong		21		(type %d)
+>12	belong		22		(type %d)
+>12	belong		23		(type %d)
+>12	belong		24		(type %d)
+>12	belong		25		(type %d)
+>12	belong		26		(IP over Infiniband)
+>12	belong		>26		(type %d)
 
 #---------------------------------------------------------------------------
 # The following entries have been tested by Duncan Laurie  (a
@@ -130,5 +139,3 @@
 # New format for Sun/Cobalt boot ROMs is annoying, it stores the version code
 # at the very end where file(1) can't get it.
 0       string CRfs     COBALT boot rom data (Flat boot rom or file system)
-
-
diff --git a/contrib/file/magic/Magdir/symbos b/contrib/file/magic/Magdir/symbos
new file mode 100644
index 00000000000..c97a42e0c74
--- /dev/null
+++ b/contrib/file/magic/Magdir/symbos
@@ -0,0 +1,42 @@
+
+#------------------------------------------------------------------------------
+# msx:  file(1) magic for the SymbOS operating system
+# http://www.symbos.de
+# Fabio R. Schmidlin 
+
+# SymbOS EXE file
+0x30	string		SymExe		SymbOS executable
+>0x36	ubyte		x		v%c
+>0x37	ubyte		x		\b.%c
+>0xF	string		x		\b, name: %s
+
+# SymbOS DOX document
+0	string		INFOq\0		SymbOS DOX document
+
+# Symbos driver
+0	string		SMD1		SymbOS driver
+>19	byte		x		\b, name: %c
+>20	byte		x		\b%c
+>21	byte		x		\b%c
+>22	byte		x		\b%c
+>23	byte		x		\b%c
+>24	byte		x		\b%c
+>25	byte		x		\b%c
+>26	byte		x		\b%c
+>27	byte		x		\b%c
+>28	byte		x		\b%c
+>29	byte		x		\b%c
+>30	byte		x		\b%c
+>31	byte		x		\b%c
+
+# Symbos video
+0	string		SymVid		SymbOS video
+>6	ubyte		x		v%c
+>7	ubyte		x		\b.%c
+
+# Soundtrakker 128 ST2 music
+0	byte		0
+>0xC	string		\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x40\x00	Soundtrakker 128 ST2 music,
+>>1	string		x		name: %s
+
+
diff --git a/contrib/file/Magdir/sysex b/contrib/file/magic/Magdir/sysex
similarity index 97%
rename from contrib/file/Magdir/sysex
rename to contrib/file/magic/Magdir/sysex
index 70b5b1cf24a..97472e27554 100644
--- a/contrib/file/Magdir/sysex
+++ b/contrib/file/magic/Magdir/sysex
@@ -1,10 +1,12 @@
 
 #------------------------------------------------------------------------
-# $File: sysex,v 1.6 2009/09/19 16:28:12 christos Exp $
+# $File: sysex,v 1.8 2014/06/03 19:17:27 christos Exp $
 # sysex: file(1) magic for MIDI sysex files
 #
-# 
-0	byte			0xF0		SysEx File -
+# GRR: original 1 byte test at offset was too general as it catches also many FATs of DOS filesystems
+# where real SYStem EXclusive messages at offset 1 are limited to seven bits
+# http://en.wikipedia.org/wiki/MIDI
+0	ubeshort&0xFF80		0xF000		SysEx File -
 
 # North American Group
 >1	byte			0x01		Sequential
@@ -210,7 +212,7 @@
 >1	byte			0x52		Zoom
 >1	byte			0x54		Matsushita
 >1	byte			0x57		Acoustic tech. lab.
-
+# http://www.midi.org/techspecs/manid.php
 >1	belong&0xffffff00	0x00007400	Ta Horng
 >1	belong&0xffffff00	0x00007500	e-Tek
 >1	belong&0xffffff00	0x00007600	E-Voice
diff --git a/contrib/file/Magdir/tcl b/contrib/file/magic/Magdir/tcl
similarity index 98%
rename from contrib/file/Magdir/tcl
rename to contrib/file/magic/Magdir/tcl
index 223f93b58c1..515fa8dbb9b 100644
--- a/contrib/file/Magdir/tcl
+++ b/contrib/file/magic/Magdir/tcl
@@ -5,7 +5,7 @@
 
 # Tcl scripts
 0	search/1/w	#!\ /usr/bin/tcl	Tcl script text executable
-!:mime	text/x-lua
+!:mime	text/x-tcl
 0	search/1/w	#!\ /usr/local/bin/tcl	Tcl script text executable
 !:mime	text/x-tcl
 0	search/1	#!/usr/bin/env\ tcl	Tcl script text executable
diff --git a/contrib/file/Magdir/teapot b/contrib/file/magic/Magdir/teapot
similarity index 100%
rename from contrib/file/Magdir/teapot
rename to contrib/file/magic/Magdir/teapot
diff --git a/contrib/file/Magdir/terminfo b/contrib/file/magic/Magdir/terminfo
similarity index 100%
rename from contrib/file/Magdir/terminfo
rename to contrib/file/magic/Magdir/terminfo
diff --git a/contrib/file/Magdir/tex b/contrib/file/magic/Magdir/tex
similarity index 75%
rename from contrib/file/Magdir/tex
rename to contrib/file/magic/Magdir/tex
index e8d2e8762a8..1737ea95c1d 100644
--- a/contrib/file/Magdir/tex
+++ b/contrib/file/magic/Magdir/tex
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: tex,v 1.18 2011/02/08 13:45:15 christos Exp $
+# $File: tex,v 1.20 2014/03/16 02:53:03 christos Exp $
 # tex:  file(1) magic for TeX files
 #
 # XXX - needs byte-endian stuff (big-endian and little-endian DVI?)
@@ -40,6 +40,9 @@
 0	search/4096	\\input		TeX document text
 !:mime	text/x-tex
 !:strength + 15
+0	search/4096	\\begin		LaTeX document text
+!:mime	text/x-tex
+!:strength + 15
 0	search/4096	\\section	LaTeX document text
 !:mime	text/x-tex
 !:strength + 18
@@ -103,3 +106,34 @@
 0	search/1	@c\ @mapfile{	TeX font aliases text file
 
 0	string		#LyX		LyX document text
+
+# ConTeXt documents
+#	http://wiki.contextgarden.net/
+0	search/4096	\\setupcolors[		ConTeXt document text
+!:strength + 15
+0	search/4096	\\definecolor[		ConTeXt document text
+!:strength + 15
+0	search/4096	\\setupinteraction[	ConTeXt document text
+!:strength + 15
+0	search/4096	\\useURL[		ConTeXt document text
+!:strength + 15
+0	search/4096	\\setuppapersize[	ConTeXt document text
+!:strength + 15
+0	search/4096	\\setuplayout[		ConTeXt document text
+!:strength + 15
+0	search/4096	\\setupfooter[		ConTeXt document text
+!:strength + 15
+0	search/4096	\\setupfootertexts[	ConTeXt document text
+!:strength + 15
+0	search/4096	\\setuppagenumbering[	ConTeXt document text
+!:strength + 15
+0	search/4096	\\setupbodyfont[	ConTeXt document text
+!:strength + 15
+0	search/4096	\\setuphead[		ConTeXt document text
+!:strength + 15
+0	search/4096	\\setupitemize[		ConTeXt document text
+!:strength + 15
+0	search/4096	\\setupwhitespace[	ConTeXt document text
+!:strength + 15
+0	search/4096	\\setupindenting[	ConTeXt document text
+!:strength + 15
diff --git a/contrib/file/Magdir/tgif b/contrib/file/magic/Magdir/tgif
similarity index 100%
rename from contrib/file/Magdir/tgif
rename to contrib/file/magic/Magdir/tgif
diff --git a/contrib/file/Magdir/ti-8x b/contrib/file/magic/Magdir/ti-8x
similarity index 98%
rename from contrib/file/Magdir/ti-8x
rename to contrib/file/magic/Magdir/ti-8x
index d7903febcb0..205f982d2d9 100644
--- a/contrib/file/Magdir/ti-8x
+++ b/contrib/file/magic/Magdir/ti-8x
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: ti-8x,v 1.6 2009/09/19 16:28:12 christos Exp $
+# $File: ti-8x,v 1.7 2014/04/30 21:41:02 christos Exp $
 # ti-8x: file(1) magic for the TI-8x and TI-9x Graphing Calculators.
 #
 # From: Ryan McGuire (rmcguire@freenet.columbus.oh.us).
@@ -222,7 +222,7 @@
 >49		byte		0x24		type: application,
 >49		byte		0x25		type: certificate,
 >49		byte		0x3e		type: license,
->74		lelong		>0		size: %ld bytes
+>74		lelong		>0		size: %d bytes
 
 # VTi & TiEmu skins (TI Graphing Calculators).
 # From: Romain Lievin (roms@lpg.ticalc.org).
diff --git a/contrib/file/Magdir/timezone b/contrib/file/magic/Magdir/timezone
similarity index 100%
rename from contrib/file/Magdir/timezone
rename to contrib/file/magic/Magdir/timezone
diff --git a/contrib/file/Magdir/troff b/contrib/file/magic/Magdir/troff
similarity index 83%
rename from contrib/file/Magdir/troff
rename to contrib/file/magic/Magdir/troff
index b24ea0a4986..cb6bc00eb8e 100644
--- a/contrib/file/Magdir/troff
+++ b/contrib/file/magic/Magdir/troff
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: troff,v 1.10 2009/09/19 16:28:12 christos Exp $
+# $File: troff,v 1.11 2014/06/03 19:01:34 christos Exp $
 # troff:  file(1) magic for *roff
 #
 # updated by Daniel Quinlan (quinlan@yggdrasil.com)
@@ -16,9 +16,9 @@
 !:mime	text/troff
 0	search/1	'''		troff or preprocessor input text
 !:mime	text/troff
-0	regex/20	\^\\.[A-Za-z0-9][A-Za-z0-9][\ \t]	troff or preprocessor input text
+0	regex/20l	\^\\.[A-Za-z0-9][A-Za-z0-9][\ \t]	troff or preprocessor input text
 !:mime	text/troff
-0	regex/20	\^\\.[A-Za-z0-9][A-Za-z0-9]$	troff or preprocessor input text
+0	regex/20l	\^\\.[A-Za-z0-9][A-Za-z0-9]$	troff or preprocessor input text
 !:mime	text/troff
 
 # ditroff intermediate output text
diff --git a/contrib/file/Magdir/tuxedo b/contrib/file/magic/Magdir/tuxedo
similarity index 100%
rename from contrib/file/Magdir/tuxedo
rename to contrib/file/magic/Magdir/tuxedo
diff --git a/contrib/file/Magdir/typeset b/contrib/file/magic/Magdir/typeset
similarity index 100%
rename from contrib/file/Magdir/typeset
rename to contrib/file/magic/Magdir/typeset
diff --git a/contrib/file/Magdir/unicode b/contrib/file/magic/Magdir/unicode
similarity index 100%
rename from contrib/file/Magdir/unicode
rename to contrib/file/magic/Magdir/unicode
diff --git a/contrib/file/magic/Magdir/unknown b/contrib/file/magic/Magdir/unknown
new file mode 100644
index 00000000000..578a8ea06d7
--- /dev/null
+++ b/contrib/file/magic/Magdir/unknown
@@ -0,0 +1,34 @@
+
+#------------------------------------------------------------------------------
+# $File: unknown,v 1.8 2013/01/09 22:37:24 christos Exp $
+# unknown:  file(1) magic for unknown machines
+#
+# 0x107 is 0407, 0x108 is 0410, and 0x109 is 0411; those are all PDP-11
+# (executable, pure, and split I&D, respectively), but the PDP-11 version
+# doesn't have the "version %ld", which may be a bogus COFFism (I don't
+# think there was ever COFF for the PDP-11).
+#
+# 0x10B is 0413; that's VAX demand-paged, but this is a short, not a
+# long, as it would be on a VAX.  In any case, that could collide with
+# VAX demand-paged files, as the magic number is little-endian on those
+# binaries, so the first 16 bits of the file would contain 0x10B.
+#
+# Therefore, those entries are commented out.
+#
+# 0x10C is 0414 and 0x10E is 0416; those *are* unknown.
+#
+#0	short		0x107		unknown machine executable
+#>8	short		>0		not stripped
+#>15	byte		>0		- version %ld
+#0	short		0x108		unknown pure executable
+#>8	short		>0		not stripped
+#>15	byte		>0		- version %ld
+#0	short		0x109		PDP-11 separate I&D
+#>8	short		>0		not stripped
+#>15	byte		>0		- version %ld
+#0	short		0x10b		unknown pure executable
+#>8	short		>0		not stripped
+#>15	byte		>0		- version %ld
+0	long		0x10c		unknown demand paged pure executable
+>16	long		>0		not stripped
+0	long		0x10e		unknown readable demand paged pure executable
diff --git a/contrib/file/magic/Magdir/uterus b/contrib/file/magic/Magdir/uterus
new file mode 100644
index 00000000000..a8be8a880d2
--- /dev/null
+++ b/contrib/file/magic/Magdir/uterus
@@ -0,0 +1,16 @@
+
+#------------------------------------------------------------------------------
+# $File: uterus,v 1.3 2014/04/30 21:41:02 christos Exp $
+# file(1) magic for uterus files
+# http://freecode.com/projects/uterus
+#
+0	string		UTE+	uterus file
+>4	string		v	\b, version
+>5	byte		x	%c
+>6	string		.	\b.
+>7	byte		x	\b%c
+>8	string		\<\>	\b, big-endian
+>>16	belong		>0	\b, slut size %u
+>8	string		\>\<	\b, litte-endian
+>>16	lelong		>0	\b, slut size %u
+>10	byte		&8	\b, compressed
diff --git a/contrib/file/Magdir/uuencode b/contrib/file/magic/Magdir/uuencode
similarity index 100%
rename from contrib/file/Magdir/uuencode
rename to contrib/file/magic/Magdir/uuencode
diff --git a/contrib/file/Magdir/varied.out b/contrib/file/magic/Magdir/varied.out
similarity index 94%
rename from contrib/file/Magdir/varied.out
rename to contrib/file/magic/Magdir/varied.out
index 3d8aa9219a4..01caf07fafa 100644
--- a/contrib/file/Magdir/varied.out
+++ b/contrib/file/magic/Magdir/varied.out
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: varied.out,v 1.22 2010/07/02 00:06:27 christos Exp $
+# $File: varied.out,v 1.23 2014/04/30 21:41:02 christos Exp $
 # varied.out:  file(1) magic for various USG systems
 #
 #	Herewith many of the object file formats used by USG systems.
@@ -26,7 +26,7 @@
 >7      string          >\0     version '%s'
 # gnu gmon magic From: Eugen Dedu 
 0	string		gmon		GNU prof performance data
->4	long		x		- version %ld
+>4	long		x		- version %d
 # From: Dave Pearson 
 # Harbour  HRB files.
 0	string		\xc0HRB		Harbour HRB file
diff --git a/contrib/file/Magdir/varied.script b/contrib/file/magic/Magdir/varied.script
similarity index 58%
rename from contrib/file/Magdir/varied.script
rename to contrib/file/magic/Magdir/varied.script
index 50259d3ed92..eb71b2f5772 100644
--- a/contrib/file/Magdir/varied.script
+++ b/contrib/file/magic/Magdir/varied.script
@@ -1,28 +1,56 @@
 #------------------------------------------------------------------------------
-# $File: varied.script,v 1.9 2011/12/16 16:32:48 rrt Exp $
+# $File: varied.script,v 1.10 2014/03/01 22:32:39 christos Exp $
 # varied.script:  file(1) magic for various interpreter scripts
 
 0	string/t		#!\ /			a
 >3	string		>\0			%s script text executable
 !:strength / 2
+
+0	string/b		#!\ /			a
+>3	string		>\0			%s script executable (binary data)
+!:strength / 2
+
 0	string/t		#!\t/			a
 >3	string		>\0			%s script text executable
 !:strength / 2
+
+0	string/b		#!\t/			a
+>3	string		>\0			%s script executable (binary data)
+!:strength / 2
+
 0	string/t		#!/			a
 >2	string		>\0			%s script text executable
 !:strength / 2
+
+0	string/b		#!/			a
+>2	string		>\0			%s script executable (binary data)
+!:strength / 2
+
 0	string/t		#!\ 			script text executable
 >3	string		>\0			for %s
 !:strength / 3
 
+0	string/b		#!\ 			script executable
+>3	string		>\0			for %s (binary data)
+!:strength / 3
+
 # using env
 0	string/t	#!/usr/bin/env		a
 >15	string/t	>\0			%s script text executable
 !:strength / 10
+
+0	string/b	#!/usr/bin/env		a
+>15	string/b	>\0			%s script executable (binary data)
+!:strength / 10
+
 0	string/t	#!\ /usr/bin/env	a
 >16	string/t	>\0			%s script text executable
 !:strength / 10
 
+0	string/b	#!\ /usr/bin/env	a
+>16	string/b	>\0			%s script executable (binary data)
+!:strength / 10
+
 # From: arno 
 # mozilla xpconnect typelib
 # see http://www.mozilla.org/scriptable/typelib_file.html
diff --git a/contrib/file/Magdir/vax b/contrib/file/magic/Magdir/vax
similarity index 50%
rename from contrib/file/Magdir/vax
rename to contrib/file/magic/Magdir/vax
index 31a35123dd4..11de6cef005 100644
--- a/contrib/file/Magdir/vax
+++ b/contrib/file/magic/Magdir/vax
@@ -1,35 +1,27 @@
 
 #------------------------------------------------------------------------------
-# $File: vax,v 1.7 2009/09/19 16:28:13 christos Exp $
+# $File: vax,v 1.9 2014/04/30 21:41:02 christos Exp $
 # vax:  file(1) magic for VAX executable/object and APL workspace
 #
 0	lelong		0101557		VAX single precision APL workspace
 0	lelong		0101556		VAX double precision APL workspace
 
 #
-# VAX a.out (32V, BSD)
+# VAX a.out (BSD; others collide with 386 and other 32-bit little-endian
+# executables, and are handled in aout)
 #
-0	lelong		0407		VAX executable
->16	lelong		>0		not stripped
-
-0	lelong		0410		VAX pure executable
->16	lelong		>0		not stripped
-
-0	lelong		0413		VAX demand paged pure executable
->16	lelong		>0		not stripped
-
-0	lelong		0420		VAX demand paged (first page unmapped) pure executable
+0	lelong		0420		a.out VAX demand paged (first page unmapped) pure executable
 >16	lelong		>0		not stripped
 
 #
 # VAX COFF
 #
-# The `versions' should be un-commented if they work for you.
+# The `versions' were commented out, but have been un-commented out.
 # (Was the problem just one of endianness?)
 #
 0	leshort		0570		VAX COFF executable
 >12	lelong		>0		not stripped
->22	leshort		>0		- version %ld
+>22	leshort		>0		- version %d
 0	leshort		0575		VAX COFF pure executable
 >12	lelong		>0		not stripped
->22	leshort		>0		- version %ld
+>22	leshort		>0		- version %d
diff --git a/contrib/file/Magdir/vicar b/contrib/file/magic/Magdir/vicar
similarity index 100%
rename from contrib/file/Magdir/vicar
rename to contrib/file/magic/Magdir/vicar
diff --git a/contrib/file/magic/Magdir/virtual b/contrib/file/magic/Magdir/virtual
new file mode 100644
index 00000000000..26442bf94b9
--- /dev/null
+++ b/contrib/file/magic/Magdir/virtual
@@ -0,0 +1,123 @@
+
+#------------------------------------------------------------------------------
+# $File: virtual,v 1.6 2014/05/07 21:25:41 christos Exp $
+# From: James Nobis 
+# Microsoft hard disk images for:
+# Virtual Server
+# Virtual PC
+# http://technet.microsoft.com/en-us/virtualserver/bb676673.aspx
+# .vhd
+0	string	conectix	Microsoft Disk Image, Virtual Server or Virtual PC
+
+# libvirt
+# From: Philipp Hahn 
+0	string	LibvirtQemudSave	Libvirt QEMU Suspend Image
+>0x10	lelong	x	\b, version %u
+>0x14	lelong	x	\b, XML length %u
+>0x18	lelong	1	\b, running
+>0x1c	lelong	1	\b, compressed
+
+0	string	LibvirtQemudPart	Libvirt QEMU partial Suspend Image
+# From: Alex Beregszaszi 
+0	string/b	COWD		VMWare3
+>4	byte	3		disk image
+>>32	lelong	x		(%d/
+>>36	lelong	x		\b%d/
+>>40	lelong	x		\b%d)
+>4	byte	2		undoable disk image
+>>32	string	>\0		(%s)
+
+0	string/b	VMDK		 VMware4 disk image
+0	string/b	KDMV		 VMware4 disk image
+
+#--------------------------------------------------------------------
+# Qemu Emulator Images
+# Lines written by Friedrich Schwittay (f.schwittay@yousable.de)
+# Updated by Adam Buchbinder (adam.buchbinder@gmail.com)
+# Made by reading sources, reading documentation, and doing trial and error
+# on existing QCOW files
+0	string/b	QFI\xFB	QEMU QCOW Image
+
+# Uncomment the following line to display Magic (only used for debugging
+# this magic number)
+#>0	string/b	x	, Magic: %s
+
+# There are currently 2 Versions: "1" and "2".
+# http://www.gnome.org/~markmc/qcow-image-format-version-1.html
+>4	belong	1	(v1)
+
+# Using the existence of the Backing File Offset to determine whether
+# to read Backing File Information
+>>12	belong	 >0	 \b, has backing file (
+# Note that this isn't a null-terminated string; the length is actually
+# (16.L). Assuming a null-terminated string happens to work usually, but it
+# may spew junk until it reaches a \0 in some cases.
+>>>(12.L)	 string >\0	\bpath %s
+
+# Modification time of the Backing File
+# Really useful if you want to know if your backing
+# file is still usable together with this image
+>>>>20	bedate >0	\b, mtime %s)
+>>>>20	default x	\b)
+
+# Size is stored in bytes in a big-endian u64.
+>>24	bequad	x	 \b, %lld bytes
+
+# 1 for AES encryption, 0 for none.
+>>36	belong	1	\b, AES-encrypted
+
+# http://www.gnome.org/~markmc/qcow-image-format.html
+>4	belong	2	(v2)
+# Using the existence of the Backing File Offset to determine whether
+# to read Backing File Information
+>>8	bequad  >0	 \b, has backing file
+# Note that this isn't a null-terminated string; the length is actually
+# (16.L). Assuming a null-terminated string happens to work usually, but it
+# may spew junk until it reaches a \0 in some cases. Also, since there's no
+# .Q modifier, we just use the bottom four bytes as an offset. Note that if
+# the file is over 4G, and the backing file path is stored after the first 4G,
+# the wrong filename will be printed. (This should be (8.Q), when that syntax
+# is introduced.)
+>>>(12.L)	 string >\0	(path %s)
+>>24	bequad	x	\b, %lld bytes
+>>32	belong	1	\b, AES-encrypted
+
+>4	belong	3	(v3)
+# Using the existence of the Backing File Offset to determine whether
+# to read Backing File Information
+>>8	bequad  >0	 \b, has backing file
+# Note that this isn't a null-terminated string; the length is actually
+# (16.L). Assuming a null-terminated string happens to work usually, but it
+# may spew junk until it reaches a \0 in some cases. Also, since there's no
+# .Q modifier, we just use the bottom four bytes as an offset. Note that if
+# the file is over 4G, and the backing file path is stored after the first 4G,
+# the wrong filename will be printed. (This should be (8.Q), when that syntax
+# is introduced.)
+>>>(12.L)	 string >\0	(path %s)
+>>24	bequad	x	\b, %lld bytes
+>>32	belong	1	\b, AES-encrypted
+
+>4	default x	(unknown version)
+
+0	string/b	QEVM		QEMU suspend to disk image
+
+# QEMU QED Image
+# http://wiki.qemu.org/Features/QED/Specification
+0	string/b	QED\0		QEMU QED Image
+
+# VDI Image
+# Sun xVM VirtualBox Disk Image
+# From: Richard W.M. Jones 
+# VirtualBox Disk Image
+0x40	ulelong		0xbeda107f	VirtualBox Disk Image
+>0x44	uleshort	>0		\b, major %u
+>0x46	uleshort	>0		\b, minor %u
+>0	string		>\0		(%s)
+>368	lequad		x		 \b, %lld bytes
+
+0	string/b	Bochs\ Virtual\ HD\ Image	Bochs disk image,
+>32	string	x				type %s,
+>48	string	x				subtype %s
+
+0	lelong	0x02468ace			Bochs Sparse disk image
+
diff --git a/contrib/file/Magdir/virtutech b/contrib/file/magic/Magdir/virtutech
similarity index 100%
rename from contrib/file/Magdir/virtutech
rename to contrib/file/magic/Magdir/virtutech
diff --git a/contrib/file/Magdir/visx b/contrib/file/magic/Magdir/visx
similarity index 100%
rename from contrib/file/Magdir/visx
rename to contrib/file/magic/Magdir/visx
diff --git a/contrib/file/Magdir/vms b/contrib/file/magic/Magdir/vms
similarity index 81%
rename from contrib/file/Magdir/vms
rename to contrib/file/magic/Magdir/vms
index d114dfd79e5..be716b38e3c 100644
--- a/contrib/file/Magdir/vms
+++ b/contrib/file/magic/Magdir/vms
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: vms,v 1.6 2009/09/19 16:28:13 christos Exp $
+# $File: vms,v 1.7 2013/03/09 22:36:00 christos Exp $
 # vms:  file(1) magic for VMS executables (experimental)
 #
 # VMS .exe formats, both VAX and AXP (Greg Roelofs, newt@uchicago.edu)
@@ -24,5 +24,7 @@
 #   00030  00 00 00 00 01 00 00 00  00 00 00 00 00 00 00 00  ................
 #   00040  00 00 00 00 ff ff ff ff  ff ff ff ff 02 00 00 00  ................
 #
-0	belong	0x03000000	VMS Alpha executable
->75264	string	PK\003\004	\b, Info-ZIP SFX archive v5.12 w/decryption
+# GRR this test is still too general as it catches example adressen.dbt
+0	belong	0x03000000	
+>8	ubelong	0xec020000	VMS Alpha executable
+>>75264	string	PK\003\004	\b, Info-ZIP SFX archive v5.12 w/decryption
diff --git a/contrib/file/Magdir/vmware b/contrib/file/magic/Magdir/vmware
similarity index 100%
rename from contrib/file/Magdir/vmware
rename to contrib/file/magic/Magdir/vmware
diff --git a/contrib/file/Magdir/vorbis b/contrib/file/magic/Magdir/vorbis
similarity index 95%
rename from contrib/file/Magdir/vorbis
rename to contrib/file/magic/Magdir/vorbis
index ed6c040c309..4406512cef2 100644
--- a/contrib/file/Magdir/vorbis
+++ b/contrib/file/magic/Magdir/vorbis
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: vorbis,v 1.16 2009/09/19 16:28:13 christos Exp $
+# $File: vorbis,v 1.18 2014/04/30 21:41:02 christos Exp $
 # vorbis:  file(1) magic for Ogg/Vorbis files
 #
 # From Felix von Leitner 
@@ -56,13 +56,13 @@
 >>>37		string/c	xvid		(XviD)
 # --- First vorbis packet - general header ---
 >>28		string		\x01vorbis	\b, Vorbis audio,
->>>35		lelong		!0		UNKNOWN VERSION %lu,
+>>>35		lelong		!0		UNKNOWN VERSION %u,
 ##>>>35		lelong		0		version 0,
 >>>35		lelong		0
 >>>>39		ubyte		1		mono,
 >>>>39		ubyte		2		stereo,
 >>>>39		ubyte		>2		%u channels,
->>>>40		lelong		x		%lu Hz
+>>>>40		lelong		x		%u Hz
 # Minimal, nominal and maximal bitrates specified when encoding
 >>>>48		string		<\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff	\b,
 # The above tests if at least one of these is specified:
@@ -72,13 +72,13 @@
 # Vorbis 1.0 uses 0 instead of -1.
 >>>>>>52	lelong		!0
 >>>>>>>52	lelong		!-1000
->>>>>>>>52	lelong		x		<%lu
+>>>>>>>>52	lelong		x		<%u
 >>>>>48		lelong		!-1
->>>>>>48	lelong		x		~%lu
+>>>>>>48	lelong		x		~%u
 >>>>>44		lelong		!-1
 >>>>>>44	lelong		!-1000
 >>>>>>>44	lelong		!0
->>>>>>>>44	lelong		x		>%lu
+>>>>>>>>44	lelong		x		>%u
 >>>>>48		string		<\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff	bps
 # -- Second vorbis header packet - the comments
 # A kludge to read the vendor string.  It's a counted string, not a
diff --git a/contrib/file/Magdir/vxl b/contrib/file/magic/Magdir/vxl
similarity index 100%
rename from contrib/file/Magdir/vxl
rename to contrib/file/magic/Magdir/vxl
diff --git a/contrib/file/Magdir/warc b/contrib/file/magic/Magdir/warc
similarity index 100%
rename from contrib/file/Magdir/warc
rename to contrib/file/magic/Magdir/warc
diff --git a/contrib/file/Magdir/weak b/contrib/file/magic/Magdir/weak
similarity index 100%
rename from contrib/file/Magdir/weak
rename to contrib/file/magic/Magdir/weak
diff --git a/contrib/file/magic/Magdir/windows b/contrib/file/magic/Magdir/windows
new file mode 100644
index 00000000000..1879f292d09
--- /dev/null
+++ b/contrib/file/magic/Magdir/windows
@@ -0,0 +1,336 @@
+
+#------------------------------------------------------------------------------
+# $File: windows,v 1.8 2014/04/30 21:41:02 christos Exp $
+# windows:  file(1) magic for Microsoft Windows
+#
+# This file is mainly reserved for files where programs
+# using them are run almost always on MS Windows 3.x or
+# above, or files only used exclusively in Windows OS,
+# where there is no better category to allocate for.
+# For example, even though WinZIP almost run on Windows
+# only, it is better to treat them as "archive" instead.
+# For format usable in DOS, such as generic executable
+# format, please specify under "msdos" file.
+#
+
+
+# Summary: Outlook Express DBX file
+# Extension: .dbx
+# Created by: Christophe Monniez
+0	string	\xCF\xAD\x12\xFE	MS Outlook Express DBX file
+>4	byte	=0xC5			\b, message database
+>4	byte	=0xC6			\b, folder database
+>4	byte	=0xC7			\b, account information
+>4	byte	=0x30			\b, offline database
+
+
+# Summary: Windows crash dump
+# Extension: .dmp
+# Created by: Andreas Schuster (http://computer.forensikblog.de/)
+# Reference (1): http://computer.forensikblog.de/en/2008/02/64bit_magic.html
+# Modified by (1): Abel Cheung (Avoid match with first 4 bytes only)
+0	string		PAGE		
+>4	string		DUMP		MS Windows 32bit crash dump
+>>0x05c	byte            0		\b, no PAE
+>>0x05c	byte            1		\b, PAE
+>>0xf88	lelong		1		\b, full dump
+>>0xf88	lelong		2		\b, kernel dump
+>>0xf88	lelong		3		\b, small dump
+>>0x068	lelong		x		\b, %d pages
+>4	string		DU64		MS Windows 64bit crash dump
+>>0xf98	lelong		1		\b, full dump
+>>0xf98	lelong		2		\b, kernel dump
+>>0xf98	lelong		3		\b, small dump
+>>0x090	lequad		x		\b, %lld pages
+
+
+# Summary: Vista Event Log
+# Extension: .evtx
+# Created by: Andreas Schuster (http://computer.forensikblog.de/)
+# Reference (1): http://computer.forensikblog.de/en/2007/05/some_magic.html
+0	string		ElfFile\0	MS Windows Vista Event Log
+>0x2a	leshort		x		\b, %d chunks
+>>0x10	lelong		x		\b (no. %d in use)
+>0x18	lelong		>1		\b, next record no. %d
+>0x18	lelong		=1		\b, empty
+>0x78	lelong		&1		\b, DIRTY
+>0x78	lelong		&2		\b, FULL
+
+
+# Summary: Windows 3.1 group files
+# Extension: .grp
+# Created by: unknown
+0	string		\120\115\103\103	MS Windows 3.1 group files
+
+
+# Summary: Old format help files
+# Extension: .hlp
+# Created by: Dirk Jagdmann 
+0	lelong		0x00035f3f		MS Windows 3.x help file
+
+
+# Summary: Hyper terminal
+# Extension: .ht
+# Created by: unknown
+0	string		HyperTerminal\ 
+>15	string		1.0\ --\ HyperTerminal\ data\ file	MS Windows HyperTerminal profile
+
+# http://ithreats.files.wordpress.com/2009/05/\
+# lnk_the_windows_shortcut_file_format.pdf
+# Summary: Windows shortcut
+# Extension: .lnk
+# Created by: unknown
+# 'L' + GUUID
+0	string		\114\0\0\0\001\024\002\0\0\0\0\0\300\0\0\0\0\0\0\106	MS Windows shortcut
+>20	lelong&1	1	\b, Item id list present
+>20	lelong&2	2	\b, Points to a file or directory
+>20	lelong&4	4	\b, Has Description string
+>20	lelong&8	8	\b, Has Relative path
+>20	lelong&16	16	\b, Has Working directory
+>20	lelong&32	32	\b, Has command line arguments
+>20	lelong&64	64	\b, Icon
+>>56	lelong			\b number=%d
+>24	lelong&1	1	\b, Read-Only
+>24	lelong&2	2	\b, Hidden
+>24	lelong&4	4	\b, System
+>24	lelong&8	8	\b, Volume Label
+>24	lelong&16	16	\b, Directory
+>24	lelong&32	32	\b, Archive
+>24	lelong&64	64	\b, Encrypted
+>24	lelong&128	128	\b, Normal
+>24	lelong&256	256	\b, Temporary
+>24	lelong&512	512	\b, Sparse
+>24	lelong&1024	1024	\b, Reparse point
+>24	lelong&2048	2048	\b, Compressed
+>24	lelong&4096	4096	\b, Offline
+>28	leqwdate	x	\b, ctime=%s
+>36	leqwdate	x	\b, mtime=%s
+>44	leqwdate	x	\b, atime=%s
+>52	lelong		x	\b, length=%u, window=
+>60	lelong&1	1	\bhide
+>60	lelong&2	2	\bnormal
+>60	lelong&4	4	\bshowminimized
+>60	lelong&8	8	\bshowmaximized
+>60	lelong&16	16	\bshownoactivate
+>60	lelong&32	32	\bminimize
+>60	lelong&64	64	\bshowminnoactive
+>60	lelong&128	128	\bshowna
+>60	lelong&256	256	\brestore
+>60	lelong&512	512	\bshowdefault
+#>20	lelong&1	0
+#>>20	lelong&2	2
+#>>>(72.l-64)	pstring/h	x	\b [%s]
+#>20	lelong&1	1
+#>>20	lelong&2	2
+#>>>(72.s)	leshort	x
+#>>>&75	pstring/h	x	\b [%s]
+
+# Summary: Outlook Personal Folders
+# Created by: unknown
+0	lelong		0x4E444221	Microsoft Outlook email folder
+>10	leshort		0x0e		(<=2002)
+>10	leshort		0x17		(>=2003)
+
+
+# Summary: Windows help cache
+# Created by: unknown
+0	string		\164\146\115\122\012\000\000\000\001\000\000\000	MS Windows help cache
+
+
+# Summary: IE cache file
+# Created by: Christophe Monniez
+0	string	Client\ UrlCache\ MMF 	Internet Explorer cache file
+>20	string	>\0			version %s
+
+
+# Summary: Registry files
+# Created by: unknown
+# Modified by (1): Joerg Jenderek
+0	string		regf		MS Windows registry file, NT/2000 or above
+0	string		CREG		MS Windows 95/98/ME registry file
+0	string		SHCC3		MS Windows 3.1 registry file
+
+
+# Summary: Windows Registry text
+# Extension: .reg
+# Submitted by: Abel Cheung 
+0	string		REGEDIT4\r\n\r\n	Windows Registry text (Win95 or above)
+0	string		Windows\ Registry\ Editor\ 
+>&0	string		Version\ 5.00\r\n\r\n	Windows Registry text (Win2K or above)
+
+# Windows *.INF *.INI files updated by Joerg Jenderek at Apr 2013
+# emtpy ,comment , section , unicode line
+0	regex/s		\\`(\r\n|;|[[]|\xFF\xFE)			
+# left bracket in section line
+>&0	search/8192	[						
+# http://en.wikipedia.org/wiki/Autorun.inf
+# http://msdn.microsoft.com/en-us/library/windows/desktop/cc144200.aspx
+>>&0	regex/c		\^(autorun)]\r\n				
+>>>&0	ubyte		=0x5b						INItialization configuration
+!:mime application/x-wine-extension-ini
+# From: Pal Tamas 
+# Autorun File
+>>>&0	ubyte		!0x5b						Microsoft Windows Autorun file
+!:mime application/x-setupscript
+# http://msdn.microsoft.com/en-us/library/windows/hardware/ff549520(v=vs.85).aspx
+# version strings ASCII coded case-independent for Windows setup information script file
+>>&0	regex/c		\^(version|strings)]				Windows setup INFormation
+!:mime	application/x-setupscript
+#!:mime application/inf
+#!:mime application/x-wine-extension-inf
+>>&0	regex/c		\^(WinsockCRCList|OEMCPL)]			Windows setup INFormation
+!:mime	text/inf
+# http://www.winfaq.de/faq_html/Content/tip2500/onlinefaq.php?h=tip2653.htm
+# http://msdn.microsoft.com/en-us/library/windows/desktop/cc144102.aspx
+# .ShellClassInfo DeleteOnCopy LocalizedFileNames ASCII coded case-independent
+>>&0	regex/c	\^(\.ShellClassInfo|DeleteOnCopy|LocalizedFileNames)]	Windows desktop.ini
+!:mime application/x-wine-extension-ini
+#!:mime text/plain
+# http://support.microsoft.com/kb/84709/
+>>&0	regex/c		\^(don't\ load)]				Windows CONTROL.INI
+!:mime application/x-wine-extension-ini
+>>&0	regex/c		\^(ndishlp\\$|protman\\$|NETBEUI\\$)]		Windows PROTOCOL.INI
+!:mime application/x-wine-extension-ini
+# http://technet.microsoft.com/en-us/library/cc722567.aspx
+# http://www.winfaq.de/faq_html/Content/tip0000/onlinefaq.php?h=tip0137.htm
+>>&0	regex/c		\^(windows|Compatibility|embedding)]		Windows WIN.INI
+!:mime application/x-wine-extension-ini
+# http://en.wikipedia.org/wiki/SYSTEM.INI
+>>&0	regex/c		\^(boot|386enh|drivers)]			Windows SYSTEM.INI
+!:mime application/x-wine-extension-ini
+# http://www.mdgx.com/newtip6.htm
+>>&0	regex/c		\^(SafeList)]					Windows IOS.INI
+!:mime application/x-wine-extension-ini
+# http://en.wikipedia.org/wiki/NTLDR	Windows Boot Loader information
+>>&0	regex/c		\^(boot\x20loader)]				Windows boot.ini
+!:mime application/x-wine-extension-ini
+>>>&0	ubyte		x						
+# http://en.wikipedia.org/wiki/CONFIG.SYS
+>>&0	regex/c		\^(menu)]\r\n					MS-DOS CONFIG.SYS
+# http://support.microsoft.com/kb/118579/
+>>&0	regex/c		\^(Paths)]\r\n					MS-DOS MSDOS.SYS
+# VERS string unicoded case-independent
+>>&0	ubequad&0xFFdfFFdfFFdfFFdf	0x0056004500520053		
+# ION] string unicoded case-independent
+>>>&0	ubequad&0xFFdfFFdfFFdfFFff	0x0049004f004e005d		Windows setup INFormation 
+!:mime application/x-setupscript
+# STRI string unicoded case-independent
+>>&0	ubequad&0xFFdfFFdfFFdfFFdf	0x0053005400520049		
+# NGS] string unicoded case-independent
+>>>&0	ubequad&0xFFdfFFdfFFdfFFff	0x004e00470053005D		Windows setup INFormation 
+!:mime application/x-setupscript
+# unknown keyword after opening bracket
+>>&0	default				x				
+>>>&0	search/8192			[				
+# version Strings FileIdentification
+>>>>&0	string/c			version				Windows setup INFormation 
+!:mime application/x-setupscript
+# VERS string unicoded case-independent
+>>>>&0	ubequad&0xFFdfFFdfFFdfFFdf	0x0056004500520053		
+# ION] string unicoded case-independent
+>>>>>&0	ubequad&0xFFdfFFdfFFdfFFff	0x0049004f004e005d		Windows setup INFormation 
+!:mime application/x-setupscript
+# http://en.wikipedia.org/wiki/Initialization_file	Windows Initialization File or other
+#>>>>&0	default				x				Generic INItialization configuration
+#!:mime application/x-wine-extension-ini
+
+# Windows Precompiled INF files *.PNF added by Joerg Jenderek at Mar 2013 of _PNF_HEADER inf.h
+# http://read.pudn.com/downloads3/sourcecode/windows/248345/win2k/private/windows/setup/setupapi/inf.h__.htm
+# GRR: line below too general as it catches also PDP-11 UNIX/RT ldp
+0		leshort&0xFeFe	0x0000		
+# test for unused null bits in PNF_FLAGs
+>4	ulelong&0xFCffFe00	0x00000000	
+# only found 58h for Offset of WinDirPath immediately after _PNF_HEADER structure
+>>68		ulelong		>0x57		
+# test for zero high byte of InfValueBlockSize, followed by WinDirPath like
+# C:\WINDOWS (ASCII 0x433a5c.. , unicode 0x43003a005c..) or X:\MININT
+>>>(68.l-1)	ubelong&0xffE0C519	=0x00400018	Windows Precompiled iNF
+!:mime	application/x-pnf
+# currently only found Major Version=1 and Minor Version=1
+#>>>>0		uleshort	=0x0101		
+#>>>>>1		ubyte		x		\b, version %u
+#>>>>>0		ubyte		x		\b.%u
+>>>>0		uleshort	!0x0101		
+>>>>>1		ubyte		x		\b, version %u
+>>>>>0		ubyte		x		\b.%u
+# 1 ,2 (windows 98 SE)
+#>>>>2		uleshort	=2		\b, InfStyle %u
+>>>>2		uleshort	!2		\b, InfStyle %u
+#	PNF_FLAG_IS_UNICODE		0x00000001
+#	PNF_FLAG_HAS_STRINGS		0x00000002
+#	PNF_FLAG_SRCPATH_IS_URL		0x00000004
+#	PNF_FLAG_HAS_VOLATILE_DIRIDS	0x00000008
+#	PNF_FLAG_INF_VERIFIED		0x00000010
+#	PNF_FLAG_INF_DIGITALLY_SIGNED	0x00000020
+#	??				0x00000100
+#	??				0x01000000
+#	??				0x02000000
+>>>>4	ulelong&0x00000001	0x00000001	\b, unicoded
+>>>>4	ulelong&0x00000020	0x00000020	\b, digitally signed
+#>>>>8		ulelong		x		\b, InfSubstValueListOffset 0x%x
+# many 0, 1 lmouusb.PNF, 2 linkfx10.PNF , f webfdr16.PNF
+#>>>>12		uleshort	x		\b, InfSubstValueCount 0x%x
+# only < 9 found
+#>>>>14		uleshort	x		\b, InfVersionDatumCount 0x%x
+# only found values lower 0x0000ffff
+#>>>>16		ulelong		x		\b, InfVersionDataSize 0x%x
+# only found positive values lower 0x00ffFFff for InfVersionDataOffset
+>>>>20		ulelong		x		\b, at 0x%x
+>>>>4	ulelong&0x00000001	=0x00000001	
+# case independent: CatalogFile Class DriverVer layoutfile LayoutFile SetupClass signature Signature    
+>>>>>(20.l)	lestring16	x		"%s"
+>>>>4	ulelong&0x00000001	!0x00000001	
+>>>>>(20.l)	string		x		"%s"
+# FILETIME is number of 100-nanosecond intervals since 1 January 1601
+#>>>>24		ulequad		x		\b, InfVersionLastWriteTime %16.16llx
+# only found values lower 0x00ffFFff
+#>>>>32		ulelong		x		\b, StringTableBlockOffset 0x%x
+#>>>>36		ulelong		x		\b, StringTableBlockSize 0x%x
+#>>>>40		ulelong		x		\b, InfSectionCount 0x%x
+#>>>>44		ulelong		x		\b, InfSectionBlockOffset 0x%x
+#>>>>48		ulelong		x		\b, InfSectionBlockSize 0x%x
+#>>>>52		ulelong		x		\b, InfLineBlockOffset 0x%x
+#>>>>56		ulelong		x		\b, InfLineBlockSize 0x%x
+#>>>>60		ulelong		x		\b, InfValueBlockOffset 0x%x
+#>>>>64		ulelong		x		\b, InfValueBlockSize 0x%x
+# WinDirPathOffset
+#>>>>68		ulelong		x		\b, at 0x%x
+>>>>68		ulelong		>0x57		
+>>>>>4	ulelong&0x00000001	=0x00000001	
+>>>>>>(68.l)	ubequad		=0x43003a005c005700			
+# normally unicoded C:\Windows
+#>>>>>>>(68.l)	lestring16	x		\b, WinDirPath "%s"
+>>>>>>(68.l)	ubequad		!0x43003a005c005700			
+>>>>>>>(68.l)	lestring16	x		\b, WinDirPath "%s"
+>>>>>4	ulelong&0x00000001	!0x00000001	
+# normally ASCII C:\WINDOWS
+#>>>>>>(68.l)	string		=C:\\WINDOWS	\b, WinDirPath "%s"
+>>>>>>(68.l)	string		!C:\\WINDOWS	\b, WinDirPath "%s"
+# found OsLoaderPathOffset values often 0 , once 70h corelist.PNF, once 68h ASCII machine.PNF 
+#>>>>72		ulelong		>0		\b, at 0x%x
+>>>>72		ulelong		>0		\b,
+>>>>>4	ulelong&0x00000001	=0x00000001	
+>>>>>>(72.l)	lestring16	x		OsLoaderPath "%s"
+>>>>>4	ulelong&0x00000001	!0x00000001	
+# seldom C:\ instead empty
+>>>>>>(72.l)	string		x		OsLoaderPath "%s"
+# 1fdh
+#>>>>76		uleshort	x		\b, StringTableHashBucketCount 0x%x
+>>>>78		uleshort	!0x407		\b, LanguageId %x
+# only 407h found
+#>>>>78		uleshort	=0x407		\b, LanguageId %x
+# InfSourcePathOffset often 0
+#>>>>80		ulelong		>0		\b, at 0x%x
+>>>>80		ulelong		>0		\b,
+>>>>>4	ulelong&0x00000001	=0x00000001	
+>>>>>>(80.l)	lestring16	x		SourcePath "%s"
+>>>>>4	ulelong&0x00000001	!0x00000001	
+>>>>>>(80.l)	string		>\0		SourcePath "%s"
+# OriginalInfNameOffset often 0
+#>>>>84		ulelong		>0		\b, at 0x%x
+>>>>84		ulelong		>0		\b,
+>>>>>4	ulelong&0x00000001	=0x00000001	
+>>>>>>(84.l)	lestring16	x		InfName "%s"
+>>>>>4	ulelong&0x00000001	!0x00000001	
+>>>>>>(84.l)	string		>\0		InfName "%s"
+
diff --git a/contrib/file/Magdir/wireless b/contrib/file/magic/Magdir/wireless
similarity index 100%
rename from contrib/file/Magdir/wireless
rename to contrib/file/magic/Magdir/wireless
diff --git a/contrib/file/Magdir/wordprocessors b/contrib/file/magic/Magdir/wordprocessors
similarity index 91%
rename from contrib/file/Magdir/wordprocessors
rename to contrib/file/magic/Magdir/wordprocessors
index 0ee4723a429..951f6035d92 100644
--- a/contrib/file/Magdir/wordprocessors
+++ b/contrib/file/magic/Magdir/wordprocessors
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: wordprocessors,v 1.15 2010/09/20 19:19:17 rrt Exp $
+# $File: wordprocessors,v 1.18 2013/06/03 19:07:29 christos Exp $
 # wordprocessors:  file(1) magic fo word processors.
 #
 ####### PWP file format used on Smith Corona Personal Word Processors:
@@ -110,7 +110,7 @@
 512	string		R\0o\0o\0t\0	Hangul (Korean) Word Processor File 2000
 !:mime	application/x-hwp
 
-# CosmicBook, from Benot Rouits
+# CosmicBook, from Benoit Rouits
 0       string  CSBK    Ted Neslson's CosmicBook hypertext file
 
 2       string  EYWR    AmigaWriter file
@@ -156,8 +156,17 @@
 0	string/w	\
+0       string/w        \= 5.05, see http://mx.gw.com/pipermail/file/2010/000683.html
-# By Elan Ruusamäe , Patryk Zawadzki , 2010-2011
+# By Elan Ruusamae , Patryk Zawadzki , 2010-2011
 0		string		wsdl		PHP WSDL cache,
 >4		byte		x		version 0x%02x
 >6		ledate		x		\b, created %s
diff --git a/contrib/file/Magdir/xdelta b/contrib/file/magic/Magdir/xdelta
similarity index 100%
rename from contrib/file/Magdir/xdelta
rename to contrib/file/magic/Magdir/xdelta
diff --git a/contrib/file/Magdir/xenix b/contrib/file/magic/Magdir/xenix
similarity index 100%
rename from contrib/file/Magdir/xenix
rename to contrib/file/magic/Magdir/xenix
diff --git a/contrib/file/magic/Magdir/xilinx b/contrib/file/magic/Magdir/xilinx
new file mode 100644
index 00000000000..91e84d91d0e
--- /dev/null
+++ b/contrib/file/magic/Magdir/xilinx
@@ -0,0 +1,40 @@
+
+#------------------------------------------------------------------------------
+# $File: xilinx,v 1.7 2014/04/30 21:41:02 christos Exp $
+# This is Aaron's attempt at a MAGIC file for Xilinx .bit files.
+# Xilinx-Magic@RevRagnarok.com
+# Got the info from FPGA-FAQ 0026
+#
+# Rewritten to use pstring/H instead of hardcoded lengths by O. Freyermuth, 
+# fixes at least reading of bitfiles from Spartan 2, 3, 6. 
+# http://www.fpga-faq.com/FAQ_Pages/0026_Tell_me_about_bit_files.htm
+#
+# First there is the sync header and its length
+0	beshort 0x0009
+>2 	belong	=0x0ff00ff0
+>>&0	belong  =0x0ff00ff0
+>>>&0	byte    =0x00
+>>>&1   beshort =0x0001
+>>>&3	string	a	Xilinx BIT data
+# Next is a Pascal-style string with the NCD name. We want to capture that.
+>>>>&0	   pstring/H	x	- from %s
+# And then 'b'
+>>>>>&1    string b
+# Then the model / part number: 
+>>>>>>&0   pstring/H    x       - for %s
+# Then 'c'
+>>>>>>>&1 string c
+# Then the build-date
+>>>>>>>>&0 pstring/H    x       - built %s
+# Then 'd'
+>>>>>>>>>&1   string d
+# Then the build-time
+>>>>>>>>>>&0  pstring/H x        \b(%s)
+# Then 'e'
+>>>>>>>>>>>&1  string e
+# And length of data
+>>>>>>>>>>>>&0 belong x          - data length 0x%x
+
+# Raw bitstream files
+0      long    0xffffffff      
+>&0    belong  0xaa995566      Xilinx RAW bitstream (.BIN)
diff --git a/contrib/file/Magdir/xo65 b/contrib/file/magic/Magdir/xo65
similarity index 100%
rename from contrib/file/Magdir/xo65
rename to contrib/file/magic/Magdir/xo65
diff --git a/contrib/file/Magdir/xwindows b/contrib/file/magic/Magdir/xwindows
similarity index 79%
rename from contrib/file/Magdir/xwindows
rename to contrib/file/magic/Magdir/xwindows
index 93126fbaa88..eb208927f01 100644
--- a/contrib/file/Magdir/xwindows
+++ b/contrib/file/magic/Magdir/xwindows
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: xwindows,v 1.7 2011/05/03 01:44:17 christos Exp $
+# $File: xwindows,v 1.9 2014/04/30 21:41:02 christos Exp $
 # xwindows:  file(1) magic for various X/Window system file formats.
 
 # Compiled X Keymap 
@@ -10,7 +10,7 @@
 >0	byte	=0				obsolete
 0	string	xkm				Compiled XKB Keymap: msb,
 >3	byte	>0				version %d
->0	byte	=0				obsolete
+>3	byte	=0				obsolete
 
 # xfsdump archive
 0	string	xFSdump0			xfsdump archive
@@ -18,10 +18,10 @@
 
 # Jaleo XFS files
 0	long	395726				Jaleo XFS file
->4	long	x				- version %ld
->8	long	x				- [%ld -
->20	long	x				\b%ldx
->24	long	x				\b%ldx
+>4	long	x				- version %d
+>8	long	x				- [%d -
+>20	long	x				\b%dx
+>24	long	x				\b%dx
 >28	long	1008				\bYUV422]
 >28	long	1000				\bRGB24]
 
@@ -31,5 +31,5 @@
 # http://cgit.freedesktop.org/xorg/lib/libXcursor/tree/include/X11/Xcursor/Xcursor.h
 0	string		Xcur		Xcursor data
 !:mime	image/x-xcursor
->10	leshort		x		version %hd
->>8	leshort		x		\b.%hd
+>10	leshort		x		version %d
+>>8	leshort		x		\b.%d
diff --git a/contrib/file/Magdir/zfs b/contrib/file/magic/Magdir/zfs
similarity index 94%
rename from contrib/file/Magdir/zfs
rename to contrib/file/magic/Magdir/zfs
index 1f74409a8c7..77675ed7196 100644
--- a/contrib/file/Magdir/zfs
+++ b/contrib/file/magic/Magdir/zfs
@@ -37,14 +37,14 @@
 
 # Big-endian values
 8	string	\000\000\000\002\365\272\313\254 ZFS shapshot (big-endian machine),
->20	belong	x	version %lu,
+>20	belong	x	version %u,
 >32	belong	0	type: NONE,
 >32	belong	1	type: META,
 >32	belong	2	type: ZFS,
 >32	belong	3	type: ZVOL,
 >32	belong	4	type: OTHER,
 >32	belong	5	type: ANY,
->32	belong	>5	type: UNKNOWN (%lu),
+>32	belong	>5	type: UNKNOWN (%u),
 >40	byte	x	destination GUID: %02X
 >41	byte	x	%02X
 >42	byte	x	%02X
@@ -67,14 +67,14 @@
 
 # Little-endian values
 8	string	\254\313\272\365\002\000\000\000	ZFS shapshot (little-endian machine),
->16	lelong	x	version %lu,
+>16	lelong	x	version %u,
 >32	lelong	0	type: NONE,
 >32	lelong	1	type: META,
 >32	lelong	2	type: ZFS,
 >32	lelong	3	type: ZVOL,
 >32	lelong	4	type: OTHER,
 >32	lelong	5	type: ANY,
->32	lelong	>5	type: UNKNOWN (%lu),
+>32	lelong	>5	type: UNKNOWN (%u),
 >47	byte	x	destination GUID: %02X
 >46	byte	x	%02X
 >45	byte	x	%02X
diff --git a/contrib/file/Magdir/zilog b/contrib/file/magic/Magdir/zilog
similarity index 100%
rename from contrib/file/Magdir/zilog
rename to contrib/file/magic/Magdir/zilog
diff --git a/contrib/file/Magdir/zyxel b/contrib/file/magic/Magdir/zyxel
similarity index 100%
rename from contrib/file/Magdir/zyxel
rename to contrib/file/magic/Magdir/zyxel
diff --git a/contrib/file/magic/Makefile.am b/contrib/file/magic/Makefile.am
new file mode 100644
index 00000000000..27e11811c63
--- /dev/null
+++ b/contrib/file/magic/Makefile.am
@@ -0,0 +1,299 @@
+#
+# $File: Makefile.am,v 1.98 2014/06/03 18:22:34 christos Exp $
+#
+MAGIC_FRAGMENT_BASE = Magdir
+MAGIC_DIR = $(top_srcdir)/magic
+MAGIC_FRAGMENT_DIR = $(MAGIC_DIR)/$(MAGIC_FRAGMENT_BASE)
+
+pkgdata_DATA = magic.mgc
+
+EXTRA_DIST = \
+$(MAGIC_DIR)/Header \
+$(MAGIC_DIR)/Localstuff \
+$(MAGIC_FRAGMENT_DIR)/acorn \
+$(MAGIC_FRAGMENT_DIR)/adi \
+$(MAGIC_FRAGMENT_DIR)/adventure \
+$(MAGIC_FRAGMENT_DIR)/allegro \
+$(MAGIC_FRAGMENT_DIR)/alliant \
+$(MAGIC_FRAGMENT_DIR)/amanda \
+$(MAGIC_FRAGMENT_DIR)/amigaos \
+$(MAGIC_FRAGMENT_DIR)/android \
+$(MAGIC_FRAGMENT_DIR)/animation \
+$(MAGIC_FRAGMENT_DIR)/aout \
+$(MAGIC_FRAGMENT_DIR)/apl \
+$(MAGIC_FRAGMENT_DIR)/apple \
+$(MAGIC_FRAGMENT_DIR)/applix \
+$(MAGIC_FRAGMENT_DIR)/archive \
+$(MAGIC_FRAGMENT_DIR)/assembler \
+$(MAGIC_FRAGMENT_DIR)/asterix \
+$(MAGIC_FRAGMENT_DIR)/att3b \
+$(MAGIC_FRAGMENT_DIR)/audio \
+$(MAGIC_FRAGMENT_DIR)/basis \
+$(MAGIC_FRAGMENT_DIR)/bflt \
+$(MAGIC_FRAGMENT_DIR)/blackberry \
+$(MAGIC_FRAGMENT_DIR)/blcr \
+$(MAGIC_FRAGMENT_DIR)/blender \
+$(MAGIC_FRAGMENT_DIR)/blit \
+$(MAGIC_FRAGMENT_DIR)/bout \
+$(MAGIC_FRAGMENT_DIR)/bsdi \
+$(MAGIC_FRAGMENT_DIR)/bsi \
+$(MAGIC_FRAGMENT_DIR)/btsnoop \
+$(MAGIC_FRAGMENT_DIR)/c-lang \
+$(MAGIC_FRAGMENT_DIR)/c64 \
+$(MAGIC_FRAGMENT_DIR)/cad \
+$(MAGIC_FRAGMENT_DIR)/cafebabe \
+$(MAGIC_FRAGMENT_DIR)/cddb \
+$(MAGIC_FRAGMENT_DIR)/chord \
+$(MAGIC_FRAGMENT_DIR)/cisco \
+$(MAGIC_FRAGMENT_DIR)/citrus \
+$(MAGIC_FRAGMENT_DIR)/clarion \
+$(MAGIC_FRAGMENT_DIR)/claris \
+$(MAGIC_FRAGMENT_DIR)/clipper \
+$(MAGIC_FRAGMENT_DIR)/commands \
+$(MAGIC_FRAGMENT_DIR)/communications \
+$(MAGIC_FRAGMENT_DIR)/compress \
+$(MAGIC_FRAGMENT_DIR)/console \
+$(MAGIC_FRAGMENT_DIR)/convex \
+$(MAGIC_FRAGMENT_DIR)/cracklib \
+$(MAGIC_FRAGMENT_DIR)/ctags \
+$(MAGIC_FRAGMENT_DIR)/ctf \
+$(MAGIC_FRAGMENT_DIR)/cubemap \
+$(MAGIC_FRAGMENT_DIR)/cups \
+$(MAGIC_FRAGMENT_DIR)/dact \
+$(MAGIC_FRAGMENT_DIR)/database \
+$(MAGIC_FRAGMENT_DIR)/diamond \
+$(MAGIC_FRAGMENT_DIR)/diff \
+$(MAGIC_FRAGMENT_DIR)/digital \
+$(MAGIC_FRAGMENT_DIR)/dolby \
+$(MAGIC_FRAGMENT_DIR)/dump \
+$(MAGIC_FRAGMENT_DIR)/dyadic \
+$(MAGIC_FRAGMENT_DIR)/ebml \
+$(MAGIC_FRAGMENT_DIR)/editors \
+$(MAGIC_FRAGMENT_DIR)/efi \
+$(MAGIC_FRAGMENT_DIR)/elf \
+$(MAGIC_FRAGMENT_DIR)/encore \
+$(MAGIC_FRAGMENT_DIR)/epoc \
+$(MAGIC_FRAGMENT_DIR)/erlang \
+$(MAGIC_FRAGMENT_DIR)/esri \
+$(MAGIC_FRAGMENT_DIR)/fcs \
+$(MAGIC_FRAGMENT_DIR)/filesystems \
+$(MAGIC_FRAGMENT_DIR)/flash \
+$(MAGIC_FRAGMENT_DIR)/fonts \
+$(MAGIC_FRAGMENT_DIR)/fortran \
+$(MAGIC_FRAGMENT_DIR)/frame \
+$(MAGIC_FRAGMENT_DIR)/freebsd \
+$(MAGIC_FRAGMENT_DIR)/fsav \
+$(MAGIC_FRAGMENT_DIR)/fusecompress \
+$(MAGIC_FRAGMENT_DIR)/games \
+$(MAGIC_FRAGMENT_DIR)/gcc \
+$(MAGIC_FRAGMENT_DIR)/geo \
+$(MAGIC_FRAGMENT_DIR)/geos \
+$(MAGIC_FRAGMENT_DIR)/gimp \
+$(MAGIC_FRAGMENT_DIR)/gnome \
+$(MAGIC_FRAGMENT_DIR)/gnu \
+$(MAGIC_FRAGMENT_DIR)/gnumeric \
+$(MAGIC_FRAGMENT_DIR)/gpt \
+$(MAGIC_FRAGMENT_DIR)/grace \
+$(MAGIC_FRAGMENT_DIR)/graphviz \
+$(MAGIC_FRAGMENT_DIR)/gringotts \
+$(MAGIC_FRAGMENT_DIR)/guile \
+$(MAGIC_FRAGMENT_DIR)/hitachi-sh \
+$(MAGIC_FRAGMENT_DIR)/hp \
+$(MAGIC_FRAGMENT_DIR)/human68k \
+$(MAGIC_FRAGMENT_DIR)/ibm370 \
+$(MAGIC_FRAGMENT_DIR)/ibm6000 \
+$(MAGIC_FRAGMENT_DIR)/icc \
+$(MAGIC_FRAGMENT_DIR)/iff \
+$(MAGIC_FRAGMENT_DIR)/images \
+$(MAGIC_FRAGMENT_DIR)/inform \
+$(MAGIC_FRAGMENT_DIR)/intel \
+$(MAGIC_FRAGMENT_DIR)/interleaf \
+$(MAGIC_FRAGMENT_DIR)/island \
+$(MAGIC_FRAGMENT_DIR)/ispell \
+$(MAGIC_FRAGMENT_DIR)/isz \
+$(MAGIC_FRAGMENT_DIR)/java \
+$(MAGIC_FRAGMENT_DIR)/javascript \
+$(MAGIC_FRAGMENT_DIR)/jpeg \
+$(MAGIC_FRAGMENT_DIR)/karma \
+$(MAGIC_FRAGMENT_DIR)/kde \
+$(MAGIC_FRAGMENT_DIR)/keepass \
+$(MAGIC_FRAGMENT_DIR)/kml \
+$(MAGIC_FRAGMENT_DIR)/lecter \
+$(MAGIC_FRAGMENT_DIR)/lex \
+$(MAGIC_FRAGMENT_DIR)/lif \
+$(MAGIC_FRAGMENT_DIR)/linux \
+$(MAGIC_FRAGMENT_DIR)/lisp \
+$(MAGIC_FRAGMENT_DIR)/llvm \
+$(MAGIC_FRAGMENT_DIR)/lua \
+$(MAGIC_FRAGMENT_DIR)/luks \
+$(MAGIC_FRAGMENT_DIR)/m4 \
+$(MAGIC_FRAGMENT_DIR)/mach \
+$(MAGIC_FRAGMENT_DIR)/macos \
+$(MAGIC_FRAGMENT_DIR)/macintosh \
+$(MAGIC_FRAGMENT_DIR)/magic \
+$(MAGIC_FRAGMENT_DIR)/mail.news \
+$(MAGIC_FRAGMENT_DIR)/make \
+$(MAGIC_FRAGMENT_DIR)/map \
+$(MAGIC_FRAGMENT_DIR)/maple \
+$(MAGIC_FRAGMENT_DIR)/marc21 \
+$(MAGIC_FRAGMENT_DIR)/mathcad \
+$(MAGIC_FRAGMENT_DIR)/mathematica \
+$(MAGIC_FRAGMENT_DIR)/matroska \
+$(MAGIC_FRAGMENT_DIR)/mcrypt \
+$(MAGIC_FRAGMENT_DIR)/mercurial \
+$(MAGIC_FRAGMENT_DIR)/metastore \
+$(MAGIC_FRAGMENT_DIR)/mime \
+$(MAGIC_FRAGMENT_DIR)/mips \
+$(MAGIC_FRAGMENT_DIR)/mirage \
+$(MAGIC_FRAGMENT_DIR)/misctools \
+$(MAGIC_FRAGMENT_DIR)/mkid \
+$(MAGIC_FRAGMENT_DIR)/mlssa \
+$(MAGIC_FRAGMENT_DIR)/mmdf \
+$(MAGIC_FRAGMENT_DIR)/modem \
+$(MAGIC_FRAGMENT_DIR)/motorola \
+$(MAGIC_FRAGMENT_DIR)/mozilla \
+$(MAGIC_FRAGMENT_DIR)/msdos \
+$(MAGIC_FRAGMENT_DIR)/msooxml \
+$(MAGIC_FRAGMENT_DIR)/msx \
+$(MAGIC_FRAGMENT_DIR)/msvc \
+$(MAGIC_FRAGMENT_DIR)/mup \
+$(MAGIC_FRAGMENT_DIR)/music \
+$(MAGIC_FRAGMENT_DIR)/natinst \
+$(MAGIC_FRAGMENT_DIR)/ncr \
+$(MAGIC_FRAGMENT_DIR)/neko \
+$(MAGIC_FRAGMENT_DIR)/netbsd \
+$(MAGIC_FRAGMENT_DIR)/netscape \
+$(MAGIC_FRAGMENT_DIR)/netware \
+$(MAGIC_FRAGMENT_DIR)/news \
+$(MAGIC_FRAGMENT_DIR)/nitpicker \
+$(MAGIC_FRAGMENT_DIR)/oasis \
+$(MAGIC_FRAGMENT_DIR)/ocaml \
+$(MAGIC_FRAGMENT_DIR)/octave \
+$(MAGIC_FRAGMENT_DIR)/ole2compounddocs \
+$(MAGIC_FRAGMENT_DIR)/olf \
+$(MAGIC_FRAGMENT_DIR)/os2 \
+$(MAGIC_FRAGMENT_DIR)/os400 \
+$(MAGIC_FRAGMENT_DIR)/os9 \
+$(MAGIC_FRAGMENT_DIR)/osf1 \
+$(MAGIC_FRAGMENT_DIR)/palm \
+$(MAGIC_FRAGMENT_DIR)/parix \
+$(MAGIC_FRAGMENT_DIR)/parrot \
+$(MAGIC_FRAGMENT_DIR)/pascal \
+$(MAGIC_FRAGMENT_DIR)/pbf \
+$(MAGIC_FRAGMENT_DIR)/pbm \
+$(MAGIC_FRAGMENT_DIR)/pdf \
+$(MAGIC_FRAGMENT_DIR)/pdp \
+$(MAGIC_FRAGMENT_DIR)/perl \
+$(MAGIC_FRAGMENT_DIR)/pgf \
+$(MAGIC_FRAGMENT_DIR)/pgp \
+$(MAGIC_FRAGMENT_DIR)/pkgadd \
+$(MAGIC_FRAGMENT_DIR)/plan9 \
+$(MAGIC_FRAGMENT_DIR)/plus5 \
+$(MAGIC_FRAGMENT_DIR)/printer \
+$(MAGIC_FRAGMENT_DIR)/project \
+$(MAGIC_FRAGMENT_DIR)/psdbms \
+$(MAGIC_FRAGMENT_DIR)/pulsar \
+$(MAGIC_FRAGMENT_DIR)/pwsafe \
+$(MAGIC_FRAGMENT_DIR)/pyramid \
+$(MAGIC_FRAGMENT_DIR)/python \
+$(MAGIC_FRAGMENT_DIR)/revision \
+$(MAGIC_FRAGMENT_DIR)/riff \
+$(MAGIC_FRAGMENT_DIR)/rinex \
+$(MAGIC_FRAGMENT_DIR)/rpm \
+$(MAGIC_FRAGMENT_DIR)/rtf \
+$(MAGIC_FRAGMENT_DIR)/ruby \
+$(MAGIC_FRAGMENT_DIR)/sc \
+$(MAGIC_FRAGMENT_DIR)/sccs \
+$(MAGIC_FRAGMENT_DIR)/scientific \
+$(MAGIC_FRAGMENT_DIR)/securitycerts \
+$(MAGIC_FRAGMENT_DIR)/selinux \
+$(MAGIC_FRAGMENT_DIR)/sendmail \
+$(MAGIC_FRAGMENT_DIR)/sequent \
+$(MAGIC_FRAGMENT_DIR)/sereal \
+$(MAGIC_FRAGMENT_DIR)/sgi \
+$(MAGIC_FRAGMENT_DIR)/sgml \
+$(MAGIC_FRAGMENT_DIR)/sharc \
+$(MAGIC_FRAGMENT_DIR)/sinclair \
+$(MAGIC_FRAGMENT_DIR)/sisu \
+$(MAGIC_FRAGMENT_DIR)/sketch \
+$(MAGIC_FRAGMENT_DIR)/smalltalk \
+$(MAGIC_FRAGMENT_DIR)/smile \
+$(MAGIC_FRAGMENT_DIR)/sniffer \
+$(MAGIC_FRAGMENT_DIR)/softquad \
+$(MAGIC_FRAGMENT_DIR)/spec \
+$(MAGIC_FRAGMENT_DIR)/spectrum \
+$(MAGIC_FRAGMENT_DIR)/sql \
+$(MAGIC_FRAGMENT_DIR)/ssh \
+$(MAGIC_FRAGMENT_DIR)/ssl \
+$(MAGIC_FRAGMENT_DIR)/sun \
+$(MAGIC_FRAGMENT_DIR)/symbos \
+$(MAGIC_FRAGMENT_DIR)/sysex \
+$(MAGIC_FRAGMENT_DIR)/tcl \
+$(MAGIC_FRAGMENT_DIR)/teapot \
+$(MAGIC_FRAGMENT_DIR)/terminfo \
+$(MAGIC_FRAGMENT_DIR)/tex \
+$(MAGIC_FRAGMENT_DIR)/tgif \
+$(MAGIC_FRAGMENT_DIR)/ti-8x \
+$(MAGIC_FRAGMENT_DIR)/timezone \
+$(MAGIC_FRAGMENT_DIR)/troff \
+$(MAGIC_FRAGMENT_DIR)/tuxedo \
+$(MAGIC_FRAGMENT_DIR)/typeset \
+$(MAGIC_FRAGMENT_DIR)/unicode \
+$(MAGIC_FRAGMENT_DIR)/unknown \
+$(MAGIC_FRAGMENT_DIR)/uterus \
+$(MAGIC_FRAGMENT_DIR)/uuencode \
+$(MAGIC_FRAGMENT_DIR)/varied.out \
+$(MAGIC_FRAGMENT_DIR)/varied.script \
+$(MAGIC_FRAGMENT_DIR)/vax \
+$(MAGIC_FRAGMENT_DIR)/vicar \
+$(MAGIC_FRAGMENT_DIR)/virtual \
+$(MAGIC_FRAGMENT_DIR)/virtutech \
+$(MAGIC_FRAGMENT_DIR)/visx \
+$(MAGIC_FRAGMENT_DIR)/vms \
+$(MAGIC_FRAGMENT_DIR)/vmware \
+$(MAGIC_FRAGMENT_DIR)/vorbis \
+$(MAGIC_FRAGMENT_DIR)/vxl \
+$(MAGIC_FRAGMENT_DIR)/warc \
+$(MAGIC_FRAGMENT_DIR)/weak \
+$(MAGIC_FRAGMENT_DIR)/windows \
+$(MAGIC_FRAGMENT_DIR)/wireless \
+$(MAGIC_FRAGMENT_DIR)/wordprocessors \
+$(MAGIC_FRAGMENT_DIR)/wsdl \
+$(MAGIC_FRAGMENT_DIR)/xdelta \
+$(MAGIC_FRAGMENT_DIR)/xenix \
+$(MAGIC_FRAGMENT_DIR)/xilinx \
+$(MAGIC_FRAGMENT_DIR)/xo65 \
+$(MAGIC_FRAGMENT_DIR)/xwindows \
+$(MAGIC_FRAGMENT_DIR)/zfs \
+$(MAGIC_FRAGMENT_DIR)/zilog \
+$(MAGIC_FRAGMENT_DIR)/zyxel 
+
+MAGIC = magic.mgc
+CLEANFILES = ${MAGIC} $(MAGIC_FRAGMENT_DIR)/Localstuff
+
+# FIXME: Build file natively as well so that it can be used to compile
+# the target's magic file; for now we bail if the local version does not match
+if IS_CROSS_COMPILE
+FILE_COMPILE = file${EXEEXT}
+FILE_COMPILE_DEP =
+else
+FILE_COMPILE = $(top_builddir)/src/file${EXEEXT}
+FILE_COMPILE_DEP = $(FILE_COMPILE)
+endif
+
+${MAGIC}: $(EXTRA_DIST) $(FILE_COMPILE_DEP)
+	@rm -fr magic
+	@mkdir magic && cp -p $(EXTRA_DIST) magic
+	@(if expr "${FILE_COMPILE}" : '.*/.*' > /dev/null; then \
+	    echo "Using ${FILE_COMPILE} to generate ${MAGIC}" > /dev/null; \
+	  else \
+	    v=$$(file --version | sed -e s/file-// -e q); \
+	    if [ "$$v" != "${PACKAGE_VERSION}" ]; then \
+		echo "Cannot use the installed version of file ($$v) to"; \
+		echo "cross-compile file ${PACKAGE_VERSION}"; \
+		echo "Please install file ${PACKAGE_VERSION} locally first"; \
+		exit 1; \
+	    fi; \
+	  fi)
+	$(FILE_COMPILE) -C -m magic
+	@rm -fr magic
diff --git a/contrib/file/magic/Makefile.in b/contrib/file/magic/Makefile.in
new file mode 100644
index 00000000000..e86cdbf960b
--- /dev/null
+++ b/contrib/file/magic/Makefile.in
@@ -0,0 +1,776 @@
+# Makefile.in generated by automake 1.14 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = magic
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+am__installdirs = "$(DESTDIR)$(pkgdatadir)"
+DATA = $(pkgdata_DATA)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+pkgdatadir = @pkgdatadir@
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+HAVE_VISIBILITY = @HAVE_VISIBILITY@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MINGW = @MINGW@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+WARNINGS = @WARNINGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+fsect = @fsect@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+#
+# $File: Makefile.am,v 1.98 2014/06/03 18:22:34 christos Exp $
+#
+MAGIC_FRAGMENT_BASE = Magdir
+MAGIC_DIR = $(top_srcdir)/magic
+MAGIC_FRAGMENT_DIR = $(MAGIC_DIR)/$(MAGIC_FRAGMENT_BASE)
+pkgdata_DATA = magic.mgc
+EXTRA_DIST = \
+$(MAGIC_DIR)/Header \
+$(MAGIC_DIR)/Localstuff \
+$(MAGIC_FRAGMENT_DIR)/acorn \
+$(MAGIC_FRAGMENT_DIR)/adi \
+$(MAGIC_FRAGMENT_DIR)/adventure \
+$(MAGIC_FRAGMENT_DIR)/allegro \
+$(MAGIC_FRAGMENT_DIR)/alliant \
+$(MAGIC_FRAGMENT_DIR)/amanda \
+$(MAGIC_FRAGMENT_DIR)/amigaos \
+$(MAGIC_FRAGMENT_DIR)/android \
+$(MAGIC_FRAGMENT_DIR)/animation \
+$(MAGIC_FRAGMENT_DIR)/aout \
+$(MAGIC_FRAGMENT_DIR)/apl \
+$(MAGIC_FRAGMENT_DIR)/apple \
+$(MAGIC_FRAGMENT_DIR)/applix \
+$(MAGIC_FRAGMENT_DIR)/archive \
+$(MAGIC_FRAGMENT_DIR)/assembler \
+$(MAGIC_FRAGMENT_DIR)/asterix \
+$(MAGIC_FRAGMENT_DIR)/att3b \
+$(MAGIC_FRAGMENT_DIR)/audio \
+$(MAGIC_FRAGMENT_DIR)/basis \
+$(MAGIC_FRAGMENT_DIR)/bflt \
+$(MAGIC_FRAGMENT_DIR)/blackberry \
+$(MAGIC_FRAGMENT_DIR)/blcr \
+$(MAGIC_FRAGMENT_DIR)/blender \
+$(MAGIC_FRAGMENT_DIR)/blit \
+$(MAGIC_FRAGMENT_DIR)/bout \
+$(MAGIC_FRAGMENT_DIR)/bsdi \
+$(MAGIC_FRAGMENT_DIR)/bsi \
+$(MAGIC_FRAGMENT_DIR)/btsnoop \
+$(MAGIC_FRAGMENT_DIR)/c-lang \
+$(MAGIC_FRAGMENT_DIR)/c64 \
+$(MAGIC_FRAGMENT_DIR)/cad \
+$(MAGIC_FRAGMENT_DIR)/cafebabe \
+$(MAGIC_FRAGMENT_DIR)/cddb \
+$(MAGIC_FRAGMENT_DIR)/chord \
+$(MAGIC_FRAGMENT_DIR)/cisco \
+$(MAGIC_FRAGMENT_DIR)/citrus \
+$(MAGIC_FRAGMENT_DIR)/clarion \
+$(MAGIC_FRAGMENT_DIR)/claris \
+$(MAGIC_FRAGMENT_DIR)/clipper \
+$(MAGIC_FRAGMENT_DIR)/commands \
+$(MAGIC_FRAGMENT_DIR)/communications \
+$(MAGIC_FRAGMENT_DIR)/compress \
+$(MAGIC_FRAGMENT_DIR)/console \
+$(MAGIC_FRAGMENT_DIR)/convex \
+$(MAGIC_FRAGMENT_DIR)/cracklib \
+$(MAGIC_FRAGMENT_DIR)/ctags \
+$(MAGIC_FRAGMENT_DIR)/ctf \
+$(MAGIC_FRAGMENT_DIR)/cubemap \
+$(MAGIC_FRAGMENT_DIR)/cups \
+$(MAGIC_FRAGMENT_DIR)/dact \
+$(MAGIC_FRAGMENT_DIR)/database \
+$(MAGIC_FRAGMENT_DIR)/diamond \
+$(MAGIC_FRAGMENT_DIR)/diff \
+$(MAGIC_FRAGMENT_DIR)/digital \
+$(MAGIC_FRAGMENT_DIR)/dolby \
+$(MAGIC_FRAGMENT_DIR)/dump \
+$(MAGIC_FRAGMENT_DIR)/dyadic \
+$(MAGIC_FRAGMENT_DIR)/ebml \
+$(MAGIC_FRAGMENT_DIR)/editors \
+$(MAGIC_FRAGMENT_DIR)/efi \
+$(MAGIC_FRAGMENT_DIR)/elf \
+$(MAGIC_FRAGMENT_DIR)/encore \
+$(MAGIC_FRAGMENT_DIR)/epoc \
+$(MAGIC_FRAGMENT_DIR)/erlang \
+$(MAGIC_FRAGMENT_DIR)/esri \
+$(MAGIC_FRAGMENT_DIR)/fcs \
+$(MAGIC_FRAGMENT_DIR)/filesystems \
+$(MAGIC_FRAGMENT_DIR)/flash \
+$(MAGIC_FRAGMENT_DIR)/fonts \
+$(MAGIC_FRAGMENT_DIR)/fortran \
+$(MAGIC_FRAGMENT_DIR)/frame \
+$(MAGIC_FRAGMENT_DIR)/freebsd \
+$(MAGIC_FRAGMENT_DIR)/fsav \
+$(MAGIC_FRAGMENT_DIR)/fusecompress \
+$(MAGIC_FRAGMENT_DIR)/games \
+$(MAGIC_FRAGMENT_DIR)/gcc \
+$(MAGIC_FRAGMENT_DIR)/geo \
+$(MAGIC_FRAGMENT_DIR)/geos \
+$(MAGIC_FRAGMENT_DIR)/gimp \
+$(MAGIC_FRAGMENT_DIR)/gnome \
+$(MAGIC_FRAGMENT_DIR)/gnu \
+$(MAGIC_FRAGMENT_DIR)/gnumeric \
+$(MAGIC_FRAGMENT_DIR)/gpt \
+$(MAGIC_FRAGMENT_DIR)/grace \
+$(MAGIC_FRAGMENT_DIR)/graphviz \
+$(MAGIC_FRAGMENT_DIR)/gringotts \
+$(MAGIC_FRAGMENT_DIR)/guile \
+$(MAGIC_FRAGMENT_DIR)/hitachi-sh \
+$(MAGIC_FRAGMENT_DIR)/hp \
+$(MAGIC_FRAGMENT_DIR)/human68k \
+$(MAGIC_FRAGMENT_DIR)/ibm370 \
+$(MAGIC_FRAGMENT_DIR)/ibm6000 \
+$(MAGIC_FRAGMENT_DIR)/icc \
+$(MAGIC_FRAGMENT_DIR)/iff \
+$(MAGIC_FRAGMENT_DIR)/images \
+$(MAGIC_FRAGMENT_DIR)/inform \
+$(MAGIC_FRAGMENT_DIR)/intel \
+$(MAGIC_FRAGMENT_DIR)/interleaf \
+$(MAGIC_FRAGMENT_DIR)/island \
+$(MAGIC_FRAGMENT_DIR)/ispell \
+$(MAGIC_FRAGMENT_DIR)/isz \
+$(MAGIC_FRAGMENT_DIR)/java \
+$(MAGIC_FRAGMENT_DIR)/javascript \
+$(MAGIC_FRAGMENT_DIR)/jpeg \
+$(MAGIC_FRAGMENT_DIR)/karma \
+$(MAGIC_FRAGMENT_DIR)/kde \
+$(MAGIC_FRAGMENT_DIR)/keepass \
+$(MAGIC_FRAGMENT_DIR)/kml \
+$(MAGIC_FRAGMENT_DIR)/lecter \
+$(MAGIC_FRAGMENT_DIR)/lex \
+$(MAGIC_FRAGMENT_DIR)/lif \
+$(MAGIC_FRAGMENT_DIR)/linux \
+$(MAGIC_FRAGMENT_DIR)/lisp \
+$(MAGIC_FRAGMENT_DIR)/llvm \
+$(MAGIC_FRAGMENT_DIR)/lua \
+$(MAGIC_FRAGMENT_DIR)/luks \
+$(MAGIC_FRAGMENT_DIR)/m4 \
+$(MAGIC_FRAGMENT_DIR)/mach \
+$(MAGIC_FRAGMENT_DIR)/macos \
+$(MAGIC_FRAGMENT_DIR)/macintosh \
+$(MAGIC_FRAGMENT_DIR)/magic \
+$(MAGIC_FRAGMENT_DIR)/mail.news \
+$(MAGIC_FRAGMENT_DIR)/make \
+$(MAGIC_FRAGMENT_DIR)/map \
+$(MAGIC_FRAGMENT_DIR)/maple \
+$(MAGIC_FRAGMENT_DIR)/marc21 \
+$(MAGIC_FRAGMENT_DIR)/mathcad \
+$(MAGIC_FRAGMENT_DIR)/mathematica \
+$(MAGIC_FRAGMENT_DIR)/matroska \
+$(MAGIC_FRAGMENT_DIR)/mcrypt \
+$(MAGIC_FRAGMENT_DIR)/mercurial \
+$(MAGIC_FRAGMENT_DIR)/metastore \
+$(MAGIC_FRAGMENT_DIR)/mime \
+$(MAGIC_FRAGMENT_DIR)/mips \
+$(MAGIC_FRAGMENT_DIR)/mirage \
+$(MAGIC_FRAGMENT_DIR)/misctools \
+$(MAGIC_FRAGMENT_DIR)/mkid \
+$(MAGIC_FRAGMENT_DIR)/mlssa \
+$(MAGIC_FRAGMENT_DIR)/mmdf \
+$(MAGIC_FRAGMENT_DIR)/modem \
+$(MAGIC_FRAGMENT_DIR)/motorola \
+$(MAGIC_FRAGMENT_DIR)/mozilla \
+$(MAGIC_FRAGMENT_DIR)/msdos \
+$(MAGIC_FRAGMENT_DIR)/msooxml \
+$(MAGIC_FRAGMENT_DIR)/msx \
+$(MAGIC_FRAGMENT_DIR)/msvc \
+$(MAGIC_FRAGMENT_DIR)/mup \
+$(MAGIC_FRAGMENT_DIR)/music \
+$(MAGIC_FRAGMENT_DIR)/natinst \
+$(MAGIC_FRAGMENT_DIR)/ncr \
+$(MAGIC_FRAGMENT_DIR)/neko \
+$(MAGIC_FRAGMENT_DIR)/netbsd \
+$(MAGIC_FRAGMENT_DIR)/netscape \
+$(MAGIC_FRAGMENT_DIR)/netware \
+$(MAGIC_FRAGMENT_DIR)/news \
+$(MAGIC_FRAGMENT_DIR)/nitpicker \
+$(MAGIC_FRAGMENT_DIR)/oasis \
+$(MAGIC_FRAGMENT_DIR)/ocaml \
+$(MAGIC_FRAGMENT_DIR)/octave \
+$(MAGIC_FRAGMENT_DIR)/ole2compounddocs \
+$(MAGIC_FRAGMENT_DIR)/olf \
+$(MAGIC_FRAGMENT_DIR)/os2 \
+$(MAGIC_FRAGMENT_DIR)/os400 \
+$(MAGIC_FRAGMENT_DIR)/os9 \
+$(MAGIC_FRAGMENT_DIR)/osf1 \
+$(MAGIC_FRAGMENT_DIR)/palm \
+$(MAGIC_FRAGMENT_DIR)/parix \
+$(MAGIC_FRAGMENT_DIR)/parrot \
+$(MAGIC_FRAGMENT_DIR)/pascal \
+$(MAGIC_FRAGMENT_DIR)/pbf \
+$(MAGIC_FRAGMENT_DIR)/pbm \
+$(MAGIC_FRAGMENT_DIR)/pdf \
+$(MAGIC_FRAGMENT_DIR)/pdp \
+$(MAGIC_FRAGMENT_DIR)/perl \
+$(MAGIC_FRAGMENT_DIR)/pgf \
+$(MAGIC_FRAGMENT_DIR)/pgp \
+$(MAGIC_FRAGMENT_DIR)/pkgadd \
+$(MAGIC_FRAGMENT_DIR)/plan9 \
+$(MAGIC_FRAGMENT_DIR)/plus5 \
+$(MAGIC_FRAGMENT_DIR)/printer \
+$(MAGIC_FRAGMENT_DIR)/project \
+$(MAGIC_FRAGMENT_DIR)/psdbms \
+$(MAGIC_FRAGMENT_DIR)/pulsar \
+$(MAGIC_FRAGMENT_DIR)/pwsafe \
+$(MAGIC_FRAGMENT_DIR)/pyramid \
+$(MAGIC_FRAGMENT_DIR)/python \
+$(MAGIC_FRAGMENT_DIR)/revision \
+$(MAGIC_FRAGMENT_DIR)/riff \
+$(MAGIC_FRAGMENT_DIR)/rinex \
+$(MAGIC_FRAGMENT_DIR)/rpm \
+$(MAGIC_FRAGMENT_DIR)/rtf \
+$(MAGIC_FRAGMENT_DIR)/ruby \
+$(MAGIC_FRAGMENT_DIR)/sc \
+$(MAGIC_FRAGMENT_DIR)/sccs \
+$(MAGIC_FRAGMENT_DIR)/scientific \
+$(MAGIC_FRAGMENT_DIR)/securitycerts \
+$(MAGIC_FRAGMENT_DIR)/selinux \
+$(MAGIC_FRAGMENT_DIR)/sendmail \
+$(MAGIC_FRAGMENT_DIR)/sequent \
+$(MAGIC_FRAGMENT_DIR)/sereal \
+$(MAGIC_FRAGMENT_DIR)/sgi \
+$(MAGIC_FRAGMENT_DIR)/sgml \
+$(MAGIC_FRAGMENT_DIR)/sharc \
+$(MAGIC_FRAGMENT_DIR)/sinclair \
+$(MAGIC_FRAGMENT_DIR)/sisu \
+$(MAGIC_FRAGMENT_DIR)/sketch \
+$(MAGIC_FRAGMENT_DIR)/smalltalk \
+$(MAGIC_FRAGMENT_DIR)/smile \
+$(MAGIC_FRAGMENT_DIR)/sniffer \
+$(MAGIC_FRAGMENT_DIR)/softquad \
+$(MAGIC_FRAGMENT_DIR)/spec \
+$(MAGIC_FRAGMENT_DIR)/spectrum \
+$(MAGIC_FRAGMENT_DIR)/sql \
+$(MAGIC_FRAGMENT_DIR)/ssh \
+$(MAGIC_FRAGMENT_DIR)/ssl \
+$(MAGIC_FRAGMENT_DIR)/sun \
+$(MAGIC_FRAGMENT_DIR)/symbos \
+$(MAGIC_FRAGMENT_DIR)/sysex \
+$(MAGIC_FRAGMENT_DIR)/tcl \
+$(MAGIC_FRAGMENT_DIR)/teapot \
+$(MAGIC_FRAGMENT_DIR)/terminfo \
+$(MAGIC_FRAGMENT_DIR)/tex \
+$(MAGIC_FRAGMENT_DIR)/tgif \
+$(MAGIC_FRAGMENT_DIR)/ti-8x \
+$(MAGIC_FRAGMENT_DIR)/timezone \
+$(MAGIC_FRAGMENT_DIR)/troff \
+$(MAGIC_FRAGMENT_DIR)/tuxedo \
+$(MAGIC_FRAGMENT_DIR)/typeset \
+$(MAGIC_FRAGMENT_DIR)/unicode \
+$(MAGIC_FRAGMENT_DIR)/unknown \
+$(MAGIC_FRAGMENT_DIR)/uterus \
+$(MAGIC_FRAGMENT_DIR)/uuencode \
+$(MAGIC_FRAGMENT_DIR)/varied.out \
+$(MAGIC_FRAGMENT_DIR)/varied.script \
+$(MAGIC_FRAGMENT_DIR)/vax \
+$(MAGIC_FRAGMENT_DIR)/vicar \
+$(MAGIC_FRAGMENT_DIR)/virtual \
+$(MAGIC_FRAGMENT_DIR)/virtutech \
+$(MAGIC_FRAGMENT_DIR)/visx \
+$(MAGIC_FRAGMENT_DIR)/vms \
+$(MAGIC_FRAGMENT_DIR)/vmware \
+$(MAGIC_FRAGMENT_DIR)/vorbis \
+$(MAGIC_FRAGMENT_DIR)/vxl \
+$(MAGIC_FRAGMENT_DIR)/warc \
+$(MAGIC_FRAGMENT_DIR)/weak \
+$(MAGIC_FRAGMENT_DIR)/windows \
+$(MAGIC_FRAGMENT_DIR)/wireless \
+$(MAGIC_FRAGMENT_DIR)/wordprocessors \
+$(MAGIC_FRAGMENT_DIR)/wsdl \
+$(MAGIC_FRAGMENT_DIR)/xdelta \
+$(MAGIC_FRAGMENT_DIR)/xenix \
+$(MAGIC_FRAGMENT_DIR)/xilinx \
+$(MAGIC_FRAGMENT_DIR)/xo65 \
+$(MAGIC_FRAGMENT_DIR)/xwindows \
+$(MAGIC_FRAGMENT_DIR)/zfs \
+$(MAGIC_FRAGMENT_DIR)/zilog \
+$(MAGIC_FRAGMENT_DIR)/zyxel 
+
+MAGIC = magic.mgc
+CLEANFILES = ${MAGIC} $(MAGIC_FRAGMENT_DIR)/Localstuff
+@IS_CROSS_COMPILE_FALSE@FILE_COMPILE = $(top_builddir)/src/file${EXEEXT}
+
+# FIXME: Build file natively as well so that it can be used to compile
+# the target's magic file; for now we bail if the local version does not match
+@IS_CROSS_COMPILE_TRUE@FILE_COMPILE = file${EXEEXT}
+@IS_CROSS_COMPILE_FALSE@FILE_COMPILE_DEP = $(FILE_COMPILE)
+@IS_CROSS_COMPILE_TRUE@FILE_COMPILE_DEP = 
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign magic/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign magic/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+install-pkgdataDATA: $(pkgdata_DATA)
+	@$(NORMAL_INSTALL)
+	@list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(pkgdatadir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgdatadir)'"; \
+	  $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgdatadir)" || exit $$?; \
+	done
+
+uninstall-pkgdataDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(pkgdatadir)'; $(am__uninstall_files_from_dir)
+tags TAGS:
+
+ctags CTAGS:
+
+cscope cscopelist:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+	for dir in "$(DESTDIR)$(pkgdatadir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-pkgdataDATA
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-pkgdataDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	cscopelist-am ctags-am distclean distclean-generic \
+	distclean-libtool distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-pkgdataDATA install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+	ps ps-am tags-am uninstall uninstall-am uninstall-pkgdataDATA
+
+
+${MAGIC}: $(EXTRA_DIST) $(FILE_COMPILE_DEP)
+	@rm -fr magic
+	@mkdir magic && cp -p $(EXTRA_DIST) magic
+	@(if expr "${FILE_COMPILE}" : '.*/.*' > /dev/null; then \
+	    echo "Using ${FILE_COMPILE} to generate ${MAGIC}" > /dev/null; \
+	  else \
+	    v=$$(file --version | sed -e s/file-// -e q); \
+	    if [ "$$v" != "${PACKAGE_VERSION}" ]; then \
+		echo "Cannot use the installed version of file ($$v) to"; \
+		echo "cross-compile file ${PACKAGE_VERSION}"; \
+		echo "Please install file ${PACKAGE_VERSION} locally first"; \
+		exit 1; \
+	    fi; \
+	  fi)
+	$(FILE_COMPILE) -C -m magic
+	@rm -fr magic
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/contrib/file/magic2mime b/contrib/file/magic2mime
deleted file mode 100644
index 26f84d28a16..00000000000
--- a/contrib/file/magic2mime
+++ /dev/null
@@ -1,69 +0,0 @@
-#! /usr/bin/env perl
-# -*- PERL -*-
-# $File: magic2mime,v 1.4 2006/11/25 18:36:10 christos Exp $
-# Copyright (c) 1996, 1997 vax@linkdead.paranoia.com (VaX#n8)
-#
-# Usage: echo 'your-file-output-here' | file_to_ctype.pl
-#        file -b files... | file_to_ctype.pl
-# It acts like a filter, reading from STDIN and any files on the command
-# line, printing to STDOUT.
-
-## refs
-# http://www.faqs.org/faqs/mail/mime-faq/part1/index.html
-#  comp.mail.mime FAQ
-# ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/media-types
-#  assigned content-types
-# ftp://ftp.uu.net/inet/rfc/rfc-index
-#  RFC index; search for MIME
-
-@mapping =
-(
-	# defaults
-    'data', 'application/octet-stream',
-    'text', 'text/plain',
-	# more specific
-	'^Rich Text Format data', 'text/richtext',
-	'^HTML document text', 'text/html',
-	'^exported SGML document text', 'text/sgml',
-	'mail text', 'message/rfc822',
-	'news text', 'message/news',
-	'^PostScript document text', 'application/postscript',
-	'^BinHex binary text', 'application/mac-binhex40',
-	'^Zip archive data', 'application/zip',
-	'^Microsoft Word', 'application/msword',
-	'^PGP key', 'application/pgp-keys',
-	'^PGP encrypted', 'application/pgp-encrypted',
-	'^PGP armored data signature', 'application/pgp-signature',
-    '^JPEG image', 'image/jpeg',
-    '^GIF image', 'image/gif',
-	'^PNG image', 'image/png',
-    '^TIFF image', 'image/tiff',
-	'Computer Graphics Metafile', 'image/cgf',
-	'^Sun/NeXT audio data', 'audio/basic',
-    '^MPEG', 'video/mpeg',
-    '^Apple QuickTime movie', 'video/quicktime',
-    '^DICOM medical imaging data', 'application/dicom',
-	# made up by me
-    '^bitmap', 'image/x-bitmap',
-    '^PC bitmap data, Windows 3.x format', 'image/x-msw3bmp',
-    '^FLI', 'video/x-fli',
-    '^FLC', 'video/x-flc',
-    'AVI data', 'video/x-avi',
-    'WAVE', 'audio/x-wav',
-    'VOC', 'audio/x-voc',
-);
-
-local($mimetype,$index,$regexp);
-while (<>)
-  {
-    chop;
-    $index = $#mapping - 1;
-    while ($index > -1 && !defined($mimetype))
-      {
-         $mimetype = $mapping[$index + 1] if (/$mapping[$index]/);
-         $index -= 2;
-      }
-    print "$mimetype\n";
-	undef $mimetype; # hack
-  }
-0;
diff --git a/contrib/file/missing b/contrib/file/missing
new file mode 100755
index 00000000000..cdea514931f
--- /dev/null
+++ b/contrib/file/missing
@@ -0,0 +1,215 @@
+#! /bin/sh
+# Common wrapper for a few potentially missing GNU programs.
+
+scriptversion=2012-06-26.16; # UTC
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Originally written by Fran,cois Pinard , 1996.
+
+# This program 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.
+
+# This program 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 this program.  If not, see .
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try '$0 --help' for more information"
+  exit 1
+fi
+
+case $1 in
+
+  --is-lightweight)
+    # Used by our autoconf macros to check whether the available missing
+    # script is modern enough.
+    exit 0
+    ;;
+
+  --run)
+    # Back-compat with the calling convention used by older automake.
+    shift
+    ;;
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
+to PROGRAM being missing or too old.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+
+Supported PROGRAM values:
+  aclocal   autoconf  autoheader   autom4te  automake  makeinfo
+  bison     yacc      flex         lex       help2man
+
+Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
+'g' are ignored when checking the name.
+
+Send bug reports to ."
+    exit $?
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing $scriptversion (GNU Automake)"
+    exit $?
+    ;;
+
+  -*)
+    echo 1>&2 "$0: unknown '$1' option"
+    echo 1>&2 "Try '$0 --help' for more information"
+    exit 1
+    ;;
+
+esac
+
+# Run the given program, remember its exit status.
+"$@"; st=$?
+
+# If it succeeded, we are done.
+test $st -eq 0 && exit 0
+
+# Also exit now if we it failed (or wasn't found), and '--version' was
+# passed; such an option is passed most likely to detect whether the
+# program is present and works.
+case $2 in --version|--help) exit $st;; esac
+
+# Exit code 63 means version mismatch.  This often happens when the user
+# tries to use an ancient version of a tool on a file that requires a
+# minimum version.
+if test $st -eq 63; then
+  msg="probably too old"
+elif test $st -eq 127; then
+  # Program was missing.
+  msg="missing on your system"
+else
+  # Program was found and executed, but failed.  Give up.
+  exit $st
+fi
+
+perl_URL=http://www.perl.org/
+flex_URL=http://flex.sourceforge.net/
+gnu_software_URL=http://www.gnu.org/software
+
+program_details ()
+{
+  case $1 in
+    aclocal|automake)
+      echo "The '$1' program is part of the GNU Automake package:"
+      echo "<$gnu_software_URL/automake>"
+      echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
+      echo "<$gnu_software_URL/autoconf>"
+      echo "<$gnu_software_URL/m4/>"
+      echo "<$perl_URL>"
+      ;;
+    autoconf|autom4te|autoheader)
+      echo "The '$1' program is part of the GNU Autoconf package:"
+      echo "<$gnu_software_URL/autoconf/>"
+      echo "It also requires GNU m4 and Perl in order to run:"
+      echo "<$gnu_software_URL/m4/>"
+      echo "<$perl_URL>"
+      ;;
+  esac
+}
+
+give_advice ()
+{
+  # Normalize program name to check for.
+  normalized_program=`echo "$1" | sed '
+    s/^gnu-//; t
+    s/^gnu//; t
+    s/^g//; t'`
+
+  printf '%s\n' "'$1' is $msg."
+
+  configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
+  case $normalized_program in
+    autoconf*)
+      echo "You should only need it if you modified 'configure.ac',"
+      echo "or m4 files included by it."
+      program_details 'autoconf'
+      ;;
+    autoheader*)
+      echo "You should only need it if you modified 'acconfig.h' or"
+      echo "$configure_deps."
+      program_details 'autoheader'
+      ;;
+    automake*)
+      echo "You should only need it if you modified 'Makefile.am' or"
+      echo "$configure_deps."
+      program_details 'automake'
+      ;;
+    aclocal*)
+      echo "You should only need it if you modified 'acinclude.m4' or"
+      echo "$configure_deps."
+      program_details 'aclocal'
+      ;;
+   autom4te*)
+      echo "You might have modified some maintainer files that require"
+      echo "the 'automa4te' program to be rebuilt."
+      program_details 'autom4te'
+      ;;
+    bison*|yacc*)
+      echo "You should only need it if you modified a '.y' file."
+      echo "You may want to install the GNU Bison package:"
+      echo "<$gnu_software_URL/bison/>"
+      ;;
+    lex*|flex*)
+      echo "You should only need it if you modified a '.l' file."
+      echo "You may want to install the Fast Lexical Analyzer package:"
+      echo "<$flex_URL>"
+      ;;
+    help2man*)
+      echo "You should only need it if you modified a dependency" \
+           "of a man page."
+      echo "You may want to install the GNU Help2man package:"
+      echo "<$gnu_software_URL/help2man/>"
+    ;;
+    makeinfo*)
+      echo "You should only need it if you modified a '.texi' file, or"
+      echo "any other file indirectly affecting the aspect of the manual."
+      echo "You might want to install the Texinfo package:"
+      echo "<$gnu_software_URL/texinfo/>"
+      echo "The spurious makeinfo call might also be the consequence of"
+      echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
+      echo "want to install GNU make:"
+      echo "<$gnu_software_URL/make/>"
+      ;;
+    *)
+      echo "You might have modified some files without having the proper"
+      echo "tools for further handling them.  Check the 'README' file, it"
+      echo "often tells you about the needed prerequisites for installing"
+      echo "this package.  You may also peek at any GNU archive site, in"
+      echo "case some other package contains this missing '$1' program."
+      ;;
+  esac
+}
+
+give_advice "$1" | sed -e '1s/^/WARNING: /' \
+                       -e '2,$s/^/         /' >&2
+
+# Propagate the correct exit status (expected to be 127 for a program
+# not found, 63 for a program that failed due to version mismatch).
+exit $st
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/contrib/file/names.h b/contrib/file/names.h
deleted file mode 100644
index 2682edcc3a0..00000000000
--- a/contrib/file/names.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright (c) Ian F. Darwin 1986-1995.
- * Software written by Ian F. Darwin and others;
- * maintained 1995-present by Christos Zoulas and others.
- * 
- * 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 immediately at the beginning of the file, without modification,
- *    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.
- */
-/*
- * Names.h - names and types used by ascmagic in file(1).
- * These tokens are here because they can appear anywhere in
- * the first HOWMANY bytes, while tokens in MAGIC must
- * appear at fixed offsets into the file. Don't make HOWMANY
- * too high unless you have a very fast CPU.
- *
- * $File: names.h,v 1.32 2008/02/11 00:19:29 rrt Exp $
- */
-
-/*
-	modified by Chris Lowth - 9 April 2000
-	to add mime type strings to the types table.
-*/
-
-/* these types are used to index the table 'types': keep em in sync! */
-#define	L_C	0		/* first and foremost on UNIX */
-#define	L_CC	1		/* Bjarne's postincrement */
-#define	L_MAKE	2		/* Makefiles */
-#define	L_PLI	3		/* PL/1 */
-#define	L_MACH	4		/* some kinda assembler */
-#define	L_ENG	5		/* English */
-#define	L_PAS	6		/* Pascal */
-#define	L_MAIL	7		/* Electronic mail */
-#define	L_NEWS	8		/* Usenet Netnews */
-#define	L_JAVA	9		/* Java code */
-#define	L_HTML	10		/* HTML */
-#define	L_BCPL	11		/* BCPL */
-#define	L_M4	12		/* M4 */
-#define	L_PO	13		/* PO */
-
-static const struct {
-	char human[48];
-	char mime[16];
-} types[] = {
-	{ "C program",					"text/x-c", },
-	{ "C++ program",				"text/x-c++" },
-	{ "make commands",				"text/x-makefile" },
-	{ "PL/1 program",				"text/x-pl1" },
-	{ "assembler program",				"text/x-asm" },
-	{ "English",					"text/plain" },
-	{ "Pascal program",				"text/x-pascal" },
-	{ "mail",					"text/x-mail" },
-	{ "news",					"text/x-news" },
-	{ "Java program",				"text/x-java" },
-	{ "HTML document",				"text/html", },
-	{ "BCPL program",				"text/x-bcpl" },
-	{ "M4 macro language pre-processor",		"text/x-m4" },
-	{ "PO (gettext message catalogue)",             "text/x-po" },
-	{ "cannot happen error on names.h/types",	"error/x-error" }
-};
-
-/*
- * XXX - how should we distinguish Java from C++?
- * The trick used in a Debian snapshot, of having "extends" or "implements"
- * as tags for Java, doesn't work very well, given that those keywords
- * are often preceded by "class", which flags it as C++.
- *
- * Perhaps we need to be able to say
- *
- *	If "class" then
- *
- *		if "extends" or "implements" then
- *			Java
- *		else
- *			C++
- *	endif
- *
- * Or should we use other keywords, such as "package" or "import"?
- * Unfortunately, Ada95 uses "package", and Modula-3 uses "import",
- * although I infer from the language spec at
- *
- *	http://www.research.digital.com/SRC/m3defn/html/m3.html
- *
- * that Modula-3 uses "IMPORT" rather than "import", i.e. it must be
- * in all caps.
- *
- * So, for now, we go with "import".  We must put it before the C++
- * stuff, so that we don't misidentify Java as C++.  Not using "package"
- * means we won't identify stuff that defines a package but imports
- * nothing; hopefully, very little Java code imports nothing (one of the
- * reasons for doing OO programming is to import as much as possible
- * and write only what you need to, right?).
- *
- * Unfortunately, "import" may cause us to misidentify English text
- * as Java, as it comes after "the" and "The".  Perhaps we need a fancier
- * heuristic to identify Java?
- */
-static const struct names {
-	char name[14];
-	short type;
-} names[] = {
-	/* These must be sorted by eye for optimal hit rate */
-	/* Add to this list only after substantial meditation */
-	{"msgid",	L_PO},
-	{"dnl",		L_M4},
-	{"import",	L_JAVA},
-	{"\"libhdr\"",	L_BCPL},
-	{"\"LIBHDR\"",	L_BCPL},
-	{"//",		L_CC},
-	{"template",	L_CC},
-	{"virtual",	L_CC},
-	{"class",	L_CC},
-	{"public:",	L_CC},
-	{"private:",	L_CC},
-	{"/*",		L_C},	/* must precede "The", "the", etc. */
-	{"#include",	L_C},
-	{"char",	L_C},
-	{"The",		L_ENG},
-	{"the",		L_ENG},
-	{"double",	L_C},
-	{"extern",	L_C},
-	{"float",	L_C},
-	{"struct",	L_C},
-	{"union",	L_C},
-	{"CFLAGS",	L_MAKE},
-	{"LDFLAGS",	L_MAKE},
-	{"all:",	L_MAKE},
-	{".PRECIOUS",	L_MAKE},
-	{".ascii",	L_MACH},
-	{".asciiz",	L_MACH},
-	{".byte",	L_MACH},
-	{".even",	L_MACH},
-	{".globl",	L_MACH},
-	{".text",	L_MACH},
-	{"clr",		L_MACH},
-	{"(input,",	L_PAS},
-	{"program",	L_PAS},
-	{"record",	L_PAS},
-	{"dcl",		L_PLI},
-	{"Received:",	L_MAIL},
-	{">From",	L_MAIL},
-	{"Return-Path:",L_MAIL},
-	{"Cc:",		L_MAIL},
-	{"Newsgroups:",	L_NEWS},
-	{"Path:",	L_NEWS},
-	{"Organization:",L_NEWS},
-	{"href=",	L_HTML},
-	{"HREF=",	L_HTML},
-	{"&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = python
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am README
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+pkgdatadir = @pkgdatadir@
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+HAVE_VISIBILITY = @HAVE_VISIBILITY@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MINGW = @MINGW@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+WARNINGS = @WARNINGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+fsect = @fsect@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = README example.py magic.py setup.py
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign python/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign python/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+tags TAGS:
+
+ctags CTAGS:
+
+cscope cscopelist:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	cscopelist-am ctags-am distclean distclean-generic \
+	distclean-libtool distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags-am uninstall uninstall-am
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/contrib/file/python/README b/contrib/file/python/README
new file mode 100644
index 00000000000..8b9a2a7e407
--- /dev/null
+++ b/contrib/file/python/README
@@ -0,0 +1,13 @@
+This directory contains Python bindings to allow you to access the
+libmagic api. At the moment their status is "experimental".
+
+You can install the modules either with:
+
+$ python setup.py build
+$ python setup.py install
+
+or, if you have easy_install:
+
+$ easy_install .
+
+magic-python should work now!
diff --git a/contrib/file/python/example.py b/contrib/file/python/example.py
new file mode 100644
index 00000000000..0cd0b5e7ec2
--- /dev/null
+++ b/contrib/file/python/example.py
@@ -0,0 +1,17 @@
+#! /usr/bin/python
+
+import magic
+
+ms = magic.open(magic.NONE)
+ms.load()
+tp = ms.file("/bin/ls")
+print (tp)
+
+f = open("/bin/ls", "rb")
+buf = f.read(4096)
+f.close()
+
+tp = ms.buffer(buf)
+print (tp)
+
+ms.close()
diff --git a/contrib/file/python/magic.py b/contrib/file/python/magic.py
new file mode 100644
index 00000000000..a17e8dad169
--- /dev/null
+++ b/contrib/file/python/magic.py
@@ -0,0 +1,221 @@
+#!/usr/bin/env python
+'''
+Python bindings for libmagic
+'''
+
+import ctypes
+
+from ctypes import *
+from ctypes.util import find_library
+
+
+def _init():
+    """
+    Loads the shared library through ctypes and returns a library
+    L{ctypes.CDLL} instance
+    """
+    return ctypes.cdll.LoadLibrary(find_library('magic'))
+
+_libraries = {}
+_libraries['magic'] = _init()
+
+# Flag constants for open and setflags
+MAGIC_NONE = NONE = 0
+MAGIC_DEBUG = DEBUG = 1
+MAGIC_SYMLINK = SYMLINK = 2
+MAGIC_COMPRESS = COMPRESS = 4
+MAGIC_DEVICES = DEVICES = 8
+MAGIC_MIME_TYPE = MIME_TYPE = 16
+MAGIC_CONTINUE = CONTINUE = 32
+MAGIC_CHECK = CHECK = 64
+MAGIC_PRESERVE_ATIME = PRESERVE_ATIME = 128
+MAGIC_RAW = RAW = 256
+MAGIC_ERROR = ERROR = 512
+MAGIC_MIME_ENCODING = MIME_ENCODING = 1024
+MAGIC_MIME = MIME = 1040
+MAGIC_APPLE = APPLE = 2048
+
+MAGIC_NO_CHECK_COMPRESS = NO_CHECK_COMPRESS = 4096
+MAGIC_NO_CHECK_TAR = NO_CHECK_TAR = 8192
+MAGIC_NO_CHECK_SOFT = NO_CHECK_SOFT = 16384
+MAGIC_NO_CHECK_APPTYPE = NO_CHECK_APPTYPE = 32768
+MAGIC_NO_CHECK_ELF = NO_CHECK_ELF = 65536
+MAGIC_NO_CHECK_TEXT = NO_CHECK_TEXT = 131072
+MAGIC_NO_CHECK_CDF = NO_CHECK_CDF = 262144
+MAGIC_NO_CHECK_TOKENS = NO_CHECK_TOKENS = 1048576
+MAGIC_NO_CHECK_ENCODING = NO_CHECK_ENCODING = 2097152
+
+MAGIC_NO_CHECK_BUILTIN = NO_CHECK_BUILTIN = 4173824
+
+
+class magic_set(Structure):
+    pass
+magic_set._fields_ = []
+magic_t = POINTER(magic_set)
+
+_open = _libraries['magic'].magic_open
+_open.restype = magic_t
+_open.argtypes = [c_int]
+
+_close = _libraries['magic'].magic_close
+_close.restype = None
+_close.argtypes = [magic_t]
+
+_file = _libraries['magic'].magic_file
+_file.restype = c_char_p
+_file.argtypes = [magic_t, c_char_p]
+
+_descriptor = _libraries['magic'].magic_descriptor
+_descriptor.restype = c_char_p
+_descriptor.argtypes = [magic_t, c_int]
+
+_buffer = _libraries['magic'].magic_buffer
+_buffer.restype = c_char_p
+_buffer.argtypes = [magic_t, c_void_p, c_size_t]
+
+_error = _libraries['magic'].magic_error
+_error.restype = c_char_p
+_error.argtypes = [magic_t]
+
+_setflags = _libraries['magic'].magic_setflags
+_setflags.restype = c_int
+_setflags.argtypes = [magic_t, c_int]
+
+_load = _libraries['magic'].magic_load
+_load.restype = c_int
+_load.argtypes = [magic_t, c_char_p]
+
+_compile = _libraries['magic'].magic_compile
+_compile.restype = c_int
+_compile.argtypes = [magic_t, c_char_p]
+
+_check = _libraries['magic'].magic_check
+_check.restype = c_int
+_check.argtypes = [magic_t, c_char_p]
+
+_list = _libraries['magic'].magic_list
+_list.restype = c_int
+_list.argtypes = [magic_t, c_char_p]
+
+_errno = _libraries['magic'].magic_errno
+_errno.restype = c_int
+_errno.argtypes = [magic_t]
+
+
+class Magic(object):
+    def __init__(self, ms):
+        self._magic_t = ms
+
+    def close(self):
+        """
+        Closes the magic database and deallocates any resources used.
+        """
+        _close(self._magic_t)
+
+    def file(self, filename):
+        """
+        Returns a textual description of the contents of the argument passed
+        as a filename or None if an error occurred and the MAGIC_ERROR flag
+        is set.  A call to errno() will return the numeric error code.
+        """
+        try:  # attempt python3 approach first
+            if isinstance(filename, bytes):
+                bi = filename
+            else:
+                bi = bytes(filename, 'utf-8')
+            return str(_file(self._magic_t, bi), 'utf-8')
+        except:
+            return _file(self._magic_t, filename.encode('utf-8'))
+
+    def descriptor(self, fd):
+        """
+        Like the file method, but the argument is a file descriptor.
+        """
+        return _descriptor(self._magic_t, fd)
+
+    def buffer(self, buf):
+        """
+        Returns a textual description of the contents of the argument passed
+        as a buffer or None if an error occurred and the MAGIC_ERROR flag
+        is set. A call to errno() will return the numeric error code.
+        """
+        try:  # attempt python3 approach first
+            return str(_buffer(self._magic_t, buf, len(buf)), 'utf-8')
+        except:
+            return _buffer(self._magic_t, buf, len(buf))
+
+    def error(self):
+        """
+        Returns a textual explanation of the last error or None
+        if there was no error.
+        """
+        try:  # attempt python3 approach first
+            return str(_error(self._magic_t), 'utf-8')
+        except:
+            return _error(self._magic_t)
+
+    def setflags(self, flags):
+        """
+        Set flags on the magic object which determine how magic checking
+        behaves; a bitwise OR of the flags described in libmagic(3), but
+        without the MAGIC_ prefix.
+
+        Returns -1 on systems that don't support utime(2) or utimes(2)
+        when PRESERVE_ATIME is set.
+        """
+        return _setflags(self._magic_t, flags)
+
+    def load(self, filename=None):
+        """
+        Must be called to load entries in the colon separated list of database
+        files passed as argument or the default database file if no argument
+        before any magic queries can be performed.
+
+        Returns 0 on success and -1 on failure.
+        """
+        return _load(self._magic_t, filename)
+
+    def compile(self, dbs):
+        """
+        Compile entries in the colon separated list of database files
+        passed as argument or the default database file if no argument.
+        Returns 0 on success and -1 on failure.
+        The compiled files created are named from the basename(1) of each file
+        argument with ".mgc" appended to it.
+        """
+        return _compile(self._magic_t, dbs)
+
+    def check(self, dbs):
+        """
+        Check the validity of entries in the colon separated list of
+        database files passed as argument or the default database file
+        if no argument.
+        Returns 0 on success and -1 on failure.
+        """
+        return _check(self._magic_t, dbs)
+
+    def list(self, dbs):
+        """
+        Check the validity of entries in the colon separated list of
+        database files passed as argument or the default database file
+        if no argument.
+        Returns 0 on success and -1 on failure.
+        """
+        return _list(self._magic_t, dbs)
+
+    def errno(self):
+        """
+        Returns a numeric error code. If return value is 0, an internal
+        magic error occurred. If return value is non-zero, the value is
+        an OS error code. Use the errno module or os.strerror() can be used
+        to provide detailed error information.
+        """
+        return _errno(self._magic_t)
+
+
+def open(flags):
+    """
+    Returns a magic object on success and None on failure.
+    Flags argument as for setflags.
+    """
+    return Magic(_open(flags))
diff --git a/contrib/file/python/setup.py b/contrib/file/python/setup.py
new file mode 100644
index 00000000000..2c3b527bb89
--- /dev/null
+++ b/contrib/file/python/setup.py
@@ -0,0 +1,10 @@
+# Python distutils build script for magic extension
+from distutils.core import setup
+
+setup(name = 'Magic file extensions',
+    version = '0.2',
+    author = 'Reuben Thomas',
+    author_email = 'rrt@sc3d.org',
+    license = 'BSD',
+    description = 'libmagic Python bindings',
+    py_modules = ['magic'])
diff --git a/contrib/file/Makefile.am-src b/contrib/file/src/Makefile.am
similarity index 72%
rename from contrib/file/Makefile.am-src
rename to contrib/file/src/Makefile.am
index 968e5849c17..e3196ce562b 100644
--- a/contrib/file/Makefile.am-src
+++ b/contrib/file/src/Makefile.am
@@ -5,7 +5,7 @@ include_HEADERS = magic.h
 bin_PROGRAMS = file
 
 AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
-AM_CFLAGS = @WARNINGS@
+AM_CFLAGS = $(CFLAG_VISIBILITY) @WARNINGS@
 
 libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \
 	encoding.c compress.c is_tar.c readelf.c print.c fsmagic.c \
@@ -21,3 +21,10 @@ libmagic_la_LIBADD = $(LTLIBOBJS) $(MINGWLIBS)
 
 file_SOURCES = file.c
 file_LDADD = libmagic.la
+CLEANFILES = magic.h
+EXTRA_DIST = magic.h.in
+HDR= $(top_srcdir)/src/magic.h.in
+BUILT_SOURCES = magic.h
+
+magic.h:	${HDR}
+	sed -e "s/X.YY/$$(echo @VERSION@ | tr -d .)/" < ${HDR} > $@
diff --git a/contrib/file/src/Makefile.in b/contrib/file/src/Makefile.in
new file mode 100644
index 00000000000..970ff0b6501
--- /dev/null
+++ b/contrib/file/src/Makefile.in
@@ -0,0 +1,783 @@
+# Makefile.in generated by automake 1.14 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = file$(EXEEXT)
+subdir = src
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am pread.c \
+	ctime_r.c getline.c vasprintf.c asprintf.c asctime_r.c \
+	fmtcheck.c strlcpy.c getopt_long.c strcasestr.c strlcat.c \
+	$(top_srcdir)/depcomp $(include_HEADERS)
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
+	"$(DESTDIR)$(includedir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libmagic_la_DEPENDENCIES = $(LTLIBOBJS) $(am__DEPENDENCIES_1)
+am_libmagic_la_OBJECTS = magic.lo apprentice.lo softmagic.lo \
+	ascmagic.lo encoding.lo compress.lo is_tar.lo readelf.lo \
+	print.lo fsmagic.lo funcs.lo apptype.lo cdf.lo cdf_time.lo \
+	readcdf.lo
+libmagic_la_OBJECTS = $(am_libmagic_la_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 = 
+libmagic_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libmagic_la_LDFLAGS) $(LDFLAGS) -o $@
+PROGRAMS = $(bin_PROGRAMS)
+am_file_OBJECTS = file.$(OBJEXT)
+file_OBJECTS = $(am_file_OBJECTS)
+file_DEPENDENCIES = libmagic.la
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo "  CC      " $@;
+am__v_CC_1 = 
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo "  CCLD    " $@;
+am__v_CCLD_1 = 
+SOURCES = $(libmagic_la_SOURCES) $(file_SOURCES)
+DIST_SOURCES = $(libmagic_la_SOURCES) $(file_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+HEADERS = $(include_HEADERS)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates.  Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+  BEGIN { nonempty = 0; } \
+  { items[$$0] = 1; nonempty = 1; } \
+  END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique.  This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+  list='$(am__tagged_files)'; \
+  unique=`for i in $$list; do \
+    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+  done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+pkgdatadir = @pkgdatadir@
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+HAVE_VISIBILITY = @HAVE_VISIBILITY@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MINGW = @MINGW@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+WARNINGS = @WARNINGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+fsect = @fsect@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+MAGIC = $(pkgdatadir)/magic
+lib_LTLIBRARIES = libmagic.la
+include_HEADERS = magic.h
+AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
+AM_CFLAGS = $(CFLAG_VISIBILITY) @WARNINGS@
+libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \
+	encoding.c compress.c is_tar.c readelf.c print.c fsmagic.c \
+	funcs.c file.h readelf.h tar.h apptype.c \
+	file_opts.h elfclass.h mygetopt.h cdf.c cdf_time.c readcdf.c cdf.h
+
+libmagic_la_LDFLAGS = -no-undefined -version-info 1:0:0
+@MINGW_FALSE@MINGWLIBS = 
+@MINGW_TRUE@MINGWLIBS = -lgnurx -lshlwapi
+libmagic_la_LIBADD = $(LTLIBOBJS) $(MINGWLIBS)
+file_SOURCES = file.c
+file_LDADD = libmagic.la
+CLEANFILES = magic.h
+EXTRA_DIST = magic.h.in
+HDR = $(top_srcdir)/src/magic.h.in
+BUILT_SOURCES = magic.h
+all: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	list2=; for p in $$list; do \
+	  if test -f $$p; then \
+	    list2="$$list2 $$p"; \
+	  else :; fi; \
+	done; \
+	test -z "$$list2" || { \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+	}
+
+uninstall-libLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	for p in $$list; do \
+	  $(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+	done
+
+clean-libLTLIBRARIES:
+	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+	@list='$(lib_LTLIBRARIES)'; \
+	locs=`for p in $$list; do echo $$p; done | \
+	      sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+	      sort -u`; \
+	test -z "$$locs" || { \
+	  echo rm -f $${locs}; \
+	  rm -f $${locs}; \
+	}
+
+libmagic.la: $(libmagic_la_OBJECTS) $(libmagic_la_DEPENDENCIES) $(EXTRA_libmagic_la_DEPENDENCIES) 
+	$(AM_V_CCLD)$(libmagic_la_LINK) -rpath $(libdir) $(libmagic_la_OBJECTS) $(libmagic_la_LIBADD) $(LIBS)
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+	fi; \
+	for p in $$list; do echo "$$p $$p"; done | \
+	sed 's/$(EXEEXT)$$//' | \
+	while read p p1; do if test -f $$p \
+	 || test -f $$p1 \
+	  ; then echo "$$p"; echo "$$p"; else :; fi; \
+	done | \
+	sed -e 'p;s,.*/,,;n;h' \
+	    -e 's|.*|.|' \
+	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+	sed 'N;N;N;s,\n, ,g' | \
+	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+	    if ($$2 == $$4) files[d] = files[d] " " $$1; \
+	    else { print "f", $$3 "/" $$4, $$1; } } \
+	  END { for (d in files) print "f", d, files[d] }' | \
+	while read type dir files; do \
+	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+	    test -z "$$files" || { \
+	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+	    } \
+	; done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+	files=`for p in $$list; do echo "$$p"; done | \
+	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+	      -e 's/$$/$(EXEEXT)/' \
+	`; \
+	test -n "$$list" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+	@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+
+file$(EXEEXT): $(file_OBJECTS) $(file_DEPENDENCIES) $(EXTRA_file_DEPENDENCIES) 
+	@rm -f file$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(file_OBJECTS) $(file_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/asctime_r.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/asprintf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ctime_r.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/fmtcheck.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getline.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt_long.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pread.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strcasestr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strlcat.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strlcpy.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/vasprintf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apprentice.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apptype.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ascmagic.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdf_time.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compress.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoding.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsmagic.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/funcs.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/is_tar.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/magic.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readcdf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readelf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/softmagic.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+install-includeHEADERS: $(include_HEADERS)
+	@$(NORMAL_INSTALL)
+	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
+	done
+
+uninstall-includeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
+
+ID: $(am__tagged_files)
+	$(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	set x; \
+	here=`pwd`; \
+	$(am__define_uniq_tagged_files); \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	$(am__define_uniq_tagged_files); \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+	list='$(am__tagged_files)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
+install-binPROGRAMS: install-libLTLIBRARIES
+
+installdirs:
+	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(includedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
+	clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf $(DEPDIR) ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-includeHEADERS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf $(DEPDIR) ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \
+	uninstall-libLTLIBRARIES
+
+.MAKE: all check install install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
+	clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
+	clean-libtool cscopelist-am ctags ctags-am distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-binPROGRAMS install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am \
+	install-includeHEADERS install-info install-info-am \
+	install-libLTLIBRARIES install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \
+	uninstall-includeHEADERS uninstall-libLTLIBRARIES
+
+
+magic.h:	${HDR}
+	sed -e "s/X.YY/$$(echo @VERSION@ | tr -d .)/" < ${HDR} > $@
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/contrib/file/apprentice.c b/contrib/file/src/apprentice.c
similarity index 68%
rename from contrib/file/apprentice.c
rename to contrib/file/src/apprentice.c
index 8e0f2cf5e7b..71e9af65e68 100644
--- a/contrib/file/apprentice.c
+++ b/contrib/file/src/apprentice.c
@@ -32,7 +32,7 @@
 #include "file.h"
 
 #ifndef	lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.173 2011/12/08 12:38:24 rrt Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.211 2014/06/03 19:01:34 christos Exp $")
 #endif	/* lint */
 
 #include "magic.h"
@@ -40,6 +40,9 @@ FILE_RCSID("@(#)$File: apprentice.c,v 1.173 2011/12/08 12:38:24 rrt Exp $")
 #ifdef HAVE_UNISTD_H
 #include 
 #endif
+#ifdef HAVE_STDDEF_H
+#include 
+#endif
 #include 
 #include 
 #include 
@@ -48,6 +51,15 @@ FILE_RCSID("@(#)$File: apprentice.c,v 1.173 2011/12/08 12:38:24 rrt Exp $")
 #include 
 #endif
 #include 
+#if defined(HAVE_LIMITS_H)
+#include 
+#endif
+
+#ifndef SSIZE_MAX
+#define MAXMAGIC_SIZE        ((ssize_t)0x7fffffff)
+#else
+#define MAXMAGIC_SIZE        SSIZE_MAX
+#endif
 
 #define	EATAB {while (isascii((unsigned char) *l) && \
 		      isspace((unsigned char) *l))  ++l;}
@@ -71,12 +83,28 @@ FILE_RCSID("@(#)$File: apprentice.c,v 1.173 2011/12/08 12:38:24 rrt Exp $")
 #define MAP_FILE 0
 #endif
 
+#define ALLOC_CHUNK	(size_t)10
+#define ALLOC_INCR	(size_t)200
+
 struct magic_entry {
 	struct magic *mp;	
 	uint32_t cont_count;
 	uint32_t max_count;
 };
 
+struct magic_entry_set {
+	struct magic_entry *me;
+	uint32_t count;
+	uint32_t max;
+};
+
+struct magic_map {
+	void *p;
+	size_t len;
+	struct magic *magic[MAGIC_SETS];
+	uint32_t nmagic[MAGIC_SETS];
+};
+
 int file_formats[FILE_NAMES_SIZE];
 const size_t file_nformats = FILE_NAMES_SIZE;
 const char *file_names[FILE_NAMES_SIZE];
@@ -86,30 +114,26 @@ private int getvalue(struct magic_set *ms, struct magic *, const char **, int);
 private int hextoint(int);
 private const char *getstr(struct magic_set *, struct magic *, const char *,
     int);
-private int parse(struct magic_set *, struct magic_entry **, uint32_t *,
-    const char *, size_t, int);
+private int parse(struct magic_set *, struct magic_entry *, const char *,
+    size_t, int);
 private void eatsize(const char **);
-private int apprentice_1(struct magic_set *, const char *, int, struct mlist *);
+private int apprentice_1(struct magic_set *, const char *, int);
 private size_t apprentice_magic_strength(const struct magic *);
 private int apprentice_sort(const void *, const void *);
-#ifndef COMPILE_ONLY
 private void apprentice_list(struct mlist *, int );
-#endif
-private int apprentice_load(struct magic_set *, struct magic **, uint32_t *,
+private struct magic_map *apprentice_load(struct magic_set *, 
     const char *, int);
-#ifndef COMPILE_ONLY
+private struct mlist *mlist_alloc(void);
+private void mlist_free(struct mlist *);
 private void byteswap(struct magic *, uint32_t);
 private void bs1(struct magic *);
 private uint16_t swap2(uint16_t);
 private uint32_t swap4(uint32_t);
 private uint64_t swap8(uint64_t);
-#endif
 private char *mkdbname(struct magic_set *, const char *, int);
-#ifndef COMPILE_ONLY
-private int apprentice_map(struct magic_set *, struct magic **, uint32_t *,
-    const char *);
-#endif
-private int apprentice_compile(struct magic_set *, struct magic **, uint32_t *,
+private struct magic_map *apprentice_map(struct magic_set *, const char *);
+private void apprentice_unmap(struct magic_map *);
+private int apprentice_compile(struct magic_set *, struct magic_map *,
     const char *);
 private int check_format_type(const char *, int);
 private int check_format(struct magic_set *, struct magic *);
@@ -119,7 +143,6 @@ private int parse_strength(struct magic_set *, struct magic_entry *, const char
 private int parse_apple(struct magic_set *, struct magic_entry *, const char *);
 
 
-private size_t maxmagic = 0;
 private size_t magicsize = sizeof(struct magic);
 
 private const char usg_hdr[] = "cont\toffset\ttype\topcode\tmask\tvalue\tdesc";
@@ -170,17 +193,27 @@ main(int argc, char *argv[])
 }
 #endif /* COMPILE_ONLY */
 
-static const struct type_tbl_s {
+struct type_tbl_s {
 	const char name[16];
 	const size_t len;
 	const int type;
 	const int format;
-} type_tbl[] = {
+};
+
+/*
+ * XXX - the actual Single UNIX Specification says that "long" means "long",
+ * as in the C data type, but we treat it as meaning "4-byte integer".
+ * Given that the OS X version of file 5.04 did the same, I guess that passes
+ * the actual test; having "long" be dependent on how big a "long" is on
+ * the machine running "file" is silly.
+ */
+static const struct type_tbl_s type_tbl[] = {
 # define XX(s)		s, (sizeof(s) - 1)
 # define XX_NULL	"", 0
+	{ XX("invalid"),	FILE_INVALID,		FILE_FMT_NONE },
 	{ XX("byte"),		FILE_BYTE,		FILE_FMT_NUM },
 	{ XX("short"),		FILE_SHORT,		FILE_FMT_NUM },
-	{ XX("default"),	FILE_DEFAULT,		FILE_FMT_STR },
+	{ XX("default"),	FILE_DEFAULT,		FILE_FMT_NONE },
 	{ XX("long"),		FILE_LONG,		FILE_FMT_NUM },
 	{ XX("string"),		FILE_STRING,		FILE_FMT_STR },
 	{ XX("date"),		FILE_DATE,		FILE_FMT_STR },
@@ -218,18 +251,34 @@ static const struct type_tbl_s {
 	{ XX("ledouble"),	FILE_LEDOUBLE,		FILE_FMT_DOUBLE },
 	{ XX("leid3"),		FILE_LEID3,		FILE_FMT_NUM },
 	{ XX("beid3"),		FILE_BEID3,		FILE_FMT_NUM },
-	{ XX("indirect"),	FILE_INDIRECT,		FILE_FMT_NONE },
+	{ XX("indirect"),	FILE_INDIRECT,		FILE_FMT_NUM },
+	{ XX("qwdate"),		FILE_QWDATE,		FILE_FMT_STR },
+	{ XX("leqwdate"),	FILE_LEQWDATE,		FILE_FMT_STR },
+	{ XX("beqwdate"),	FILE_BEQWDATE,		FILE_FMT_STR },
+	{ XX("name"),		FILE_NAME,		FILE_FMT_NONE },
+	{ XX("use"),		FILE_USE,		FILE_FMT_NONE },
+	{ XX("clear"),		FILE_CLEAR,		FILE_FMT_NONE },
 	{ XX_NULL,		FILE_INVALID,		FILE_FMT_NONE },
-# undef XX
-# undef XX_NULL
 };
 
+/*
+ * These are not types, and cannot be preceded by "u" to make them
+ * unsigned.
+ */
+static const struct type_tbl_s special_tbl[] = {
+	{ XX("name"),		FILE_NAME,		FILE_FMT_STR },
+	{ XX("use"),		FILE_USE,		FILE_FMT_STR },
+	{ XX_NULL,		FILE_INVALID,		FILE_FMT_NONE },
+};
+# undef XX
+# undef XX_NULL
+
 private int
-get_type(const char *l, const char **t)
+get_type(const struct type_tbl_s *tbl, const char *l, const char **t)
 {
 	const struct type_tbl_s *p;
 
-	for (p = type_tbl; p->len; p++) {
+	for (p = tbl; p->len; p++) {
 		if (strncmp(l, p->name, p->len) == 0) {
 			if (t)
 				*t = l + p->len;
@@ -239,6 +288,91 @@ get_type(const char *l, const char **t)
 	return p->type;
 }
 
+private int
+get_standard_integer_type(const char *l, const char **t)
+{
+	int type;
+
+	if (isalpha((unsigned char)l[1])) {
+		switch (l[1]) {
+		case 'C':
+			/* "dC" and "uC" */
+			type = FILE_BYTE;
+			break;
+		case 'S':
+			/* "dS" and "uS" */
+			type = FILE_SHORT;
+			break;
+		case 'I':
+		case 'L':
+			/*
+			 * "dI", "dL", "uI", and "uL".
+			 *
+			 * XXX - the actual Single UNIX Specification says
+			 * that "L" means "long", as in the C data type,
+			 * but we treat it as meaning "4-byte integer".
+			 * Given that the OS X version of file 5.04 did
+			 * the same, I guess that passes the actual SUS
+			 * validation suite; having "dL" be dependent on
+			 * how big a "long" is on the machine running
+			 * "file" is silly.
+			 */
+			type = FILE_LONG;
+			break;
+		case 'Q':
+			/* "dQ" and "uQ" */
+			type = FILE_QUAD;
+			break;
+		default:
+			/* "d{anything else}", "u{anything else}" */
+			return FILE_INVALID;
+		}
+		l += 2;
+	} else if (isdigit((unsigned char)l[1])) {
+		/*
+		 * "d{num}" and "u{num}"; we only support {num} values
+		 * of 1, 2, 4, and 8 - the Single UNIX Specification
+		 * doesn't say anything about whether arbitrary
+		 * values should be supported, but both the Solaris 10
+		 * and OS X Mountain Lion versions of file passed the
+		 * Single UNIX Specification validation suite, and
+		 * neither of them support values bigger than 8 or
+		 * non-power-of-2 values.
+		 */
+		if (isdigit((unsigned char)l[2])) {
+			/* Multi-digit, so > 9 */
+			return FILE_INVALID;
+		}
+		switch (l[1]) {
+		case '1':
+			type = FILE_BYTE;
+			break;
+		case '2':
+			type = FILE_SHORT;
+			break;
+		case '4':
+			type = FILE_LONG;
+			break;
+		case '8':
+			type = FILE_QUAD;
+			break;
+		default:
+			/* XXX - what about 3, 5, 6, or 7? */
+			return FILE_INVALID;
+		}
+		l += 2;
+	} else {
+		/*
+		 * "d" or "u" by itself.
+		 */
+		type = FILE_LONG;
+		++l;
+	}
+	if (t)
+		*t = l;
+	return type;
+}
+
 private void
 init_file_tables(void)
 {
@@ -254,154 +388,314 @@ init_file_tables(void)
 		file_names[p->type] = p->name;
 		file_formats[p->type] = p->format;
 	}
+	assert(p - type_tbl == FILE_NAMES_SIZE);
+}
+
+private int
+add_mlist(struct mlist *mlp, struct magic_map *map, size_t idx)
+{
+	struct mlist *ml;
+
+	if ((ml = CAST(struct mlist *, malloc(sizeof(*ml)))) == NULL)
+		return -1;
+
+	ml->map = idx == 0 ? map : NULL;
+	ml->magic = map->magic[idx];
+	ml->nmagic = map->nmagic[idx];
+
+	mlp->prev->next = ml;
+	ml->prev = mlp->prev;
+	ml->next = mlp;
+	mlp->prev = ml;
+	return 0;
 }
 
 /*
  * Handle one file or directory.
  */
 private int
-apprentice_1(struct magic_set *ms, const char *fn, int action,
-    struct mlist *mlist)
+apprentice_1(struct magic_set *ms, const char *fn, int action)
 {
-	struct magic *magic = NULL;
-	uint32_t nmagic = 0;
 #ifndef COMPILE_ONLY
 	struct mlist *ml;
-#endif
-	int rv = -1;
+#endif /* COMPILE_ONLY */
+	struct magic_map *map;
 #ifndef COMPILE_ONLY
-	int mapped;
-#endif
+	size_t i;
+#endif /* COMPILE_ONLY */
 
 	if (magicsize != FILE_MAGICSIZE) {
 		file_error(ms, 0, "magic element size %lu != %lu",
-		    (unsigned long)sizeof(*magic),
+		    (unsigned long)sizeof(*map->magic[0]),
 		    (unsigned long)FILE_MAGICSIZE);
 		return -1;
 	}
 
 	if (action == FILE_COMPILE) {
-		rv = apprentice_load(ms, &magic, &nmagic, fn, action);
-		if (rv != 0)
+		map = apprentice_load(ms, fn, action);
+		if (map == NULL)
 			return -1;
-		rv = apprentice_compile(ms, &magic, &nmagic, fn);
-		free(magic);
-		return rv;
+		return apprentice_compile(ms, map, fn);
 	}
 
 #ifndef COMPILE_ONLY
-	if ((rv = apprentice_map(ms, &magic, &nmagic, fn)) == -1) {
+	map = apprentice_map(ms, fn);
+	if (map == NULL) {
 		if (ms->flags & MAGIC_CHECK)
 			file_magwarn(ms, "using regular magic file `%s'", fn);
-		rv = apprentice_load(ms, &magic, &nmagic, fn, action);
-		if (rv != 0)
+		map = apprentice_load(ms, fn, action);
+		if (map == NULL)
 			return -1;
 	}
 
-	mapped = rv;
-	     
-	if (magic == NULL) {
-		file_delmagic(magic, mapped, nmagic);
-		return -1;
+	for (i = 0; i < MAGIC_SETS; i++) {
+		if (add_mlist(ms->mlist[i], map, i) == -1) {
+			file_oomem(ms, sizeof(*ml));
+			apprentice_unmap(map);
+			return -1;
+		}
 	}
 
-	if ((ml = CAST(struct mlist *, malloc(sizeof(*ml)))) == NULL) {
-		file_delmagic(magic, mapped, nmagic);
-		file_oomem(ms, sizeof(*ml));
-		return -1;
-	}
-
-	ml->magic = magic;
-	ml->nmagic = nmagic;
-	ml->mapped = mapped;
-
-	mlist->prev->next = ml;
-	ml->prev = mlist->prev;
-	ml->next = mlist;
-	mlist->prev = ml;
-
 	if (action == FILE_LIST) {
-		printf("Binary patterns:\n");
-		apprentice_list(mlist, BINTEST);
-		printf("Text patterns:\n");
-		apprentice_list(mlist, TEXTTEST);
+		for (i = 0; i < MAGIC_SETS; i++) {
+			printf("Set %zu:\nBinary patterns:\n", i);
+			apprentice_list(ms->mlist[i], BINTEST);
+			printf("Text patterns:\n");
+			apprentice_list(ms->mlist[i], TEXTTEST);
+		}
 	}
 #endif /* COMPILE_ONLY */
+	
 	return 0;
 }
 
 protected void
-file_delmagic(struct magic *p, int type, size_t entries)
+file_ms_free(struct magic_set *ms)
 {
-	if (p == NULL)
+	size_t i;
+	if (ms == NULL)
 		return;
-	switch (type) {
-	case 2:
-#ifdef QUICK
-		p--;
-		(void)munmap((void *)p, sizeof(*p) * (entries + 1));
-		break;
-#else
-		(void)&entries;
-		abort();
-		/*NOTREACHED*/
-#endif
-	case 1:
-		p--;
-		/*FALLTHROUGH*/
-	case 0:
-		free(p);
-		break;
-	default:
-		abort();
+	for (i = 0; i < MAGIC_SETS; i++)
+		mlist_free(ms->mlist[i]);
+	free(ms->o.pbuf);
+	free(ms->o.buf);
+	free(ms->c.li);
+	free(ms);
+}
+
+protected struct magic_set *
+file_ms_alloc(int flags)
+{
+	struct magic_set *ms;
+	size_t i, len;
+
+	if ((ms = CAST(struct magic_set *, calloc((size_t)1,
+	    sizeof(struct magic_set)))) == NULL)
+		return NULL;
+
+	if (magic_setflags(ms, flags) == -1) {
+		errno = EINVAL;
+		goto free;
 	}
+
+	ms->o.buf = ms->o.pbuf = NULL;
+	len = (ms->c.len = 10) * sizeof(*ms->c.li);
+
+	if ((ms->c.li = CAST(struct level_info *, malloc(len))) == NULL)
+		goto free;
+
+	ms->event_flags = 0;
+	ms->error = -1;
+	for (i = 0; i < MAGIC_SETS; i++)
+		ms->mlist[i] = NULL;
+	ms->file = "unknown";
+	ms->line = 0;
+	return ms;
+free:
+	free(ms);
+	return NULL;
+}
+
+private void
+apprentice_unmap(struct magic_map *map)
+{
+	if (map == NULL)
+		return;
+	if (map->p != NULL) {
+#ifdef QUICK
+		if (map->len)
+			(void)munmap(map->p, map->len);
+		else
+#endif
+		free(map->p);
+	} else {
+		uint32_t j;
+		for (j = 0; j < MAGIC_SETS; j++)
+			free(map->magic[j]);
+	}
+	free(map);
+}
+
+private struct mlist *
+mlist_alloc(void)
+{
+	struct mlist *mlist;
+	if ((mlist = CAST(struct mlist *, calloc(1, sizeof(*mlist)))) == NULL) {
+		return NULL;
+	}
+	mlist->next = mlist->prev = mlist;
+	return mlist;
+}
+
+private void
+mlist_free(struct mlist *mlist)
+{
+	struct mlist *ml;
+
+	if (mlist == NULL)
+		return;
+
+	for (ml = mlist->next; ml != mlist;) {
+		struct mlist *next = ml->next;
+		if (ml->map)
+			apprentice_unmap(ml->map);
+		free(ml);
+		ml = next;
+	}
+	free(ml);
 }
 
 /* const char *fn: list of magic files and directories */
-protected struct mlist *
+protected int
 file_apprentice(struct magic_set *ms, const char *fn, int action)
 {
 	char *p, *mfn;
 	int file_err, errs = -1;
-	struct mlist *mlist;
+	size_t i;
+
+	if (ms->mlist[0] != NULL)
+		file_reset(ms);
 
 	if ((fn = magic_getpath(fn, action)) == NULL)
-		return NULL;
+		return -1;
 
 	init_file_tables();
 
 	if ((mfn = strdup(fn)) == NULL) {
 		file_oomem(ms, strlen(fn));
-		return NULL;
+		return -1;
+	}
+
+	for (i = 0; i < MAGIC_SETS; i++) {
+		mlist_free(ms->mlist[i]);
+		if ((ms->mlist[i] = mlist_alloc()) == NULL) {
+			file_oomem(ms, sizeof(*ms->mlist[i]));
+			if (i != 0) {
+				--i;
+				do
+					mlist_free(ms->mlist[i]);
+				while (i != 0);
+			}
+			free(mfn);
+			return -1;
+		}
 	}
 	fn = mfn;
 
-	if ((mlist = CAST(struct mlist *, malloc(sizeof(*mlist)))) == NULL) {
-		free(mfn);
-		file_oomem(ms, sizeof(*mlist));
-		return NULL;
-	}
-	mlist->next = mlist->prev = mlist;
-
 	while (fn) {
 		p = strchr(fn, PATHSEP);
 		if (p)
 			*p++ = '\0';
 		if (*fn == '\0')
 			break;
-		file_err = apprentice_1(ms, fn, action, mlist);
+		file_err = apprentice_1(ms, fn, action);
 		errs = MAX(errs, file_err);
 		fn = p;
 	}
-	if (errs == -1) {
-		free(mfn);
-		free(mlist);
-		mlist = NULL;
-		file_error(ms, 0, "could not find any magic files!");
-		return NULL;
-	}
+
 	free(mfn);
-	return mlist;
+
+	if (errs == -1) {
+		for (i = 0; i < MAGIC_SETS; i++) {
+			mlist_free(ms->mlist[i]);
+			ms->mlist[i] = NULL;
+		}
+		file_error(ms, 0, "could not find any valid magic files!");
+		return -1;
+	}
+
+#if 0
+	/*
+	 * Always leave the database loaded
+	 */
+	if (action == FILE_LOAD)
+		return 0;
+
+	for (i = 0; i < MAGIC_SETS; i++) {
+		mlist_free(ms->mlist[i]);
+		ms->mlist[i] = NULL;
+	}
+#endif
+
+	switch (action) {
+	case FILE_LOAD:
+	case FILE_COMPILE:
+	case FILE_CHECK:
+	case FILE_LIST:
+		return 0;
+	default:
+		file_error(ms, 0, "Invalid action %d", action);
+		return -1;
+	}
+}
+
+/*
+ * Compute the real length of a magic expression, for the purposes
+ * of determining how "strong" a magic expression is (approximating
+ * how specific its matches are):
+ *	- magic characters count 0 unless escaped.
+ *	- [] expressions count 1
+ *	- {} expressions count 0
+ *	- regular characters or escaped magic characters count 1
+ *	- 0 length expressions count as one
+ */
+private size_t
+nonmagic(const char *str)
+{
+	const char *p;
+	size_t rv = 0;
+
+	for (p = str; *p; p++)
+		switch (*p) {
+		case '\\':	/* Escaped anything counts 1 */
+			if (!*++p)
+				p--;
+			rv++;
+			continue;
+		case '?':	/* Magic characters count 0 */
+		case '*':
+		case '.':
+		case '+':
+		case '^':
+		case '$':
+			continue;
+		case '[':	/* Bracketed expressions count 1 the ']' */
+			while (*p && *p != ']')
+				p++;
+			p--;
+			continue;
+		case '{':	/* Braced expressions count 0 */
+			while (*p && *p != '}')
+				p++;
+			if (!*p)
+				p--;
+			continue;
+		default:	/* Anything else counts 1 */
+			rv++;
+			continue;
+		}
+
+	return rv == 0 ? 1 : rv;	/* Return at least 1 */
 }
 
 /*
@@ -411,7 +705,7 @@ private size_t
 apprentice_magic_strength(const struct magic *m)
 {
 #define MULT 10
-	size_t val = 2 * MULT;	/* baseline strength */
+	size_t v, val = 2 * MULT;	/* baseline strength */
 
 	switch (m->type) {
 	case FILE_DEFAULT:	/* make sure this sorts last */
@@ -447,10 +741,14 @@ apprentice_magic_strength(const struct magic *m)
 		break;
 
 	case FILE_SEARCH:
-	case FILE_REGEX:
 		val += m->vallen * MAX(MULT / m->vallen, 1);
 		break;
 
+	case FILE_REGEX:
+		v = nonmagic(m->value.s);
+		val += v * MAX(MULT / v, 1);
+		break;
+
 	case FILE_DATE:
 	case FILE_LEDATE:
 	case FILE_BEDATE:
@@ -474,14 +772,21 @@ apprentice_magic_strength(const struct magic *m)
 	case FILE_QLDATE:
 	case FILE_LEQLDATE:
 	case FILE_BEQLDATE:
+	case FILE_QWDATE:
+	case FILE_LEQWDATE:
+	case FILE_BEQWDATE:
 	case FILE_DOUBLE:
 	case FILE_BEDOUBLE:
 	case FILE_LEDOUBLE:
 		val += 8 * MULT;
 		break;
 
+	case FILE_INDIRECT:
+	case FILE_NAME:
+	case FILE_USE:
+		break;
+
 	default:
-		val = 0;
 		(void)fprintf(stderr, "Bad type %d\n", m->type);
 		abort();
 	}
@@ -563,7 +868,6 @@ apprentice_sort(const void *a, const void *b)
 /*  
  * Shows sorted patterns list in the order which is used for the matching
  */
-#ifndef COMPILE_ONLY
 private void
 apprentice_list(struct mlist *mlist, int mode)
 {
@@ -597,7 +901,6 @@ apprentice_list(struct mlist *mlist, int mode)
 		}
 	}
 }
-#endif /* COMPILE_ONLY */
 
 private void
 set_test_type(struct magic *mstart, struct magic *m)
@@ -628,6 +931,9 @@ set_test_type(struct magic *mstart, struct magic *m)
 	case FILE_QLDATE:
 	case FILE_LEQLDATE:
 	case FILE_BEQLDATE:
+	case FILE_QWDATE:
+	case FILE_LEQWDATE:
+	case FILE_BEQWDATE:
 	case FILE_FLOAT:
 	case FILE_BEFLOAT:
 	case FILE_LEFLOAT:
@@ -675,16 +981,41 @@ set_test_type(struct magic *mstart, struct magic *m)
 	}
 }
 
+private int
+addentry(struct magic_set *ms, struct magic_entry *me,
+   struct magic_entry_set *mset)
+{
+	size_t i = me->mp->type == FILE_NAME ? 1 : 0;
+	if (mset[i].count == mset[i].max) {
+		struct magic_entry *mp;
+
+		mset[i].max += ALLOC_INCR;
+		if ((mp = CAST(struct magic_entry *,
+		    realloc(mset[i].me, sizeof(*mp) * mset[i].max))) ==
+		    NULL) {
+			file_oomem(ms, sizeof(*mp) * mset[i].max);
+			return -1;
+		}
+		(void)memset(&mp[mset[i].count], 0, sizeof(*mp) *
+		    ALLOC_INCR);
+		mset[i].me = mp;
+	}
+	mset[i].me[mset[i].count++] = *me;
+	memset(me, 0, sizeof(*me));
+	return 0;
+}
+
 /*
  * Load and parse one file.
  */
 private void
 load_1(struct magic_set *ms, int action, const char *fn, int *errs,
-   struct magic_entry **marray, uint32_t *marraycount)
+   struct magic_entry_set *mset)
 {
 	size_t lineno = 0, llen = 0;
 	char *line = NULL;
 	ssize_t len;
+	struct magic_entry me;
 
 	FILE *f = fopen(ms->file = fn, "r");
 	if (f == NULL) {
@@ -695,6 +1026,7 @@ load_1(struct magic_set *ms, int action, const char *fn, int *errs,
 		return;
 	}
 
+	memset(&me, 0, sizeof(me));
 	/* read and parse this file */
 	for (ms->line = 1; (len = getline(&line, &llen, f)) != -1;
 	    ms->line++) {
@@ -724,15 +1056,14 @@ load_1(struct magic_set *ms, int action, const char *fn, int *errs,
 					(*errs)++;
 					continue;
 				}
-				if (*marraycount == 0) {
+				if (me.mp == NULL) {
 					file_error(ms, 0,
 					    "No current entry for :!%s type",
 						bang[i].name);
 					(*errs)++;
 					continue;
 				}
-				if ((*bang[i].fun)(ms, 
-				    &(*marray)[*marraycount - 1],
+				if ((*bang[i].fun)(ms, &me,
 				    line + bang[i].len + 2) != 0) {
 					(*errs)++;
 					continue;
@@ -741,12 +1072,21 @@ load_1(struct magic_set *ms, int action, const char *fn, int *errs,
 			}
 			/*FALLTHROUGH*/
 		default:
-			if (parse(ms, marray, marraycount, line, lineno,
-			    action) != 0)
+		again:
+			switch (parse(ms, &me, line, lineno, action)) {
+			case 0:
+				continue;
+			case 1:
+				(void)addentry(ms, &me, mset);
+				goto again;
+			default:
 				(*errs)++;
-			break;
+				break;
+			}
 		}
 	}
+	if (me.mp)
+		(void)addentry(ms, &me, mset);
 	free(line);
 	(void)fclose(f);
 }
@@ -761,28 +1101,120 @@ cmpstrp(const void *p1, const void *p2)
         return strcmp(*(char *const *)p1, *(char *const *)p2);
 }
 
+
+private uint32_t
+set_text_binary(struct magic_set *ms, struct magic_entry *me, uint32_t nme,
+    uint32_t starttest)
+{
+	static const char text[] = "text";
+	static const char binary[] = "binary";
+	static const size_t len = sizeof(text);
+
+	uint32_t i = starttest;
+
+	do {
+		set_test_type(me[starttest].mp, me[i].mp);
+		if ((ms->flags & MAGIC_DEBUG) == 0)
+			continue;
+		(void)fprintf(stderr, "%s%s%s: %s\n",
+		    me[i].mp->mimetype,
+		    me[i].mp->mimetype[0] == '\0' ? "" : "; ",
+		    me[i].mp->desc[0] ? me[i].mp->desc : "(no description)",
+		    me[i].mp->flag & BINTEST ? binary : text);
+		if (me[i].mp->flag & BINTEST) {
+			char *p = strstr(me[i].mp->desc, text);
+			if (p && (p == me[i].mp->desc ||
+			    isspace((unsigned char)p[-1])) &&
+			    (p + len - me[i].mp->desc == MAXstring
+			    || (p[len] == '\0' ||
+			    isspace((unsigned char)p[len]))))
+				(void)fprintf(stderr, "*** Possible "
+				    "binary test for text type\n");
+		}
+	} while (++i < nme && me[i].mp->cont_level != 0);
+	return i;
+}
+
+private void
+set_last_default(struct magic_set *ms, struct magic_entry *me, uint32_t nme)
+{
+	uint32_t i;
+	for (i = 0; i < nme; i++) {
+		if (me[i].mp->cont_level == 0 &&
+		    me[i].mp->type == FILE_DEFAULT) {
+			while (++i < nme)
+				if (me[i].mp->cont_level == 0)
+					break;
+			if (i != nme) {
+				/* XXX - Ugh! */
+				ms->line = me[i].mp->lineno;
+				file_magwarn(ms,
+				    "level 0 \"default\" did not sort last");
+			}
+			return;					    
+		}
+	}
+}
+
 private int
-apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
-    const char *fn, int action)
+coalesce_entries(struct magic_set *ms, struct magic_entry *me, uint32_t nme,
+    struct magic **ma, uint32_t *nma)
+{
+	uint32_t i, mentrycount = 0;
+	size_t slen;
+
+	for (i = 0; i < nme; i++)
+		mentrycount += me[i].cont_count;
+
+	slen = sizeof(**ma) * mentrycount;
+	if ((*ma = CAST(struct magic *, malloc(slen))) == NULL) {
+		file_oomem(ms, slen);
+		return -1;
+	}
+
+	mentrycount = 0;
+	for (i = 0; i < nme; i++) {
+		(void)memcpy(*ma + mentrycount, me[i].mp,
+		    me[i].cont_count * sizeof(**ma));
+		mentrycount += me[i].cont_count;
+	}
+	*nma = mentrycount;
+	return 0;
+}
+
+private void
+magic_entry_free(struct magic_entry *me, uint32_t nme)
+{
+	uint32_t i;
+	if (me == NULL)
+		return;
+	for (i = 0; i < nme; i++)
+		free(me[i].mp);
+	free(me);
+}
+
+private struct magic_map *
+apprentice_load(struct magic_set *ms, const char *fn, int action)
 {
 	int errs = 0;
-	struct magic_entry *marray;
-	uint32_t marraycount, i, mentrycount = 0, starttest;
-	size_t slen, files = 0, maxfiles = 0;
+	uint32_t i, j;
+	size_t files = 0, maxfiles = 0;
 	char **filearr = NULL, *mfn;
 	struct stat st;
+	struct magic_map *map;
+	struct magic_entry_set mset[MAGIC_SETS];
 	DIR *dir;
 	struct dirent *d;
 
+	memset(mset, 0, sizeof(mset));
 	ms->flags |= MAGIC_CHECK;	/* Enable checks for parsed files */
 
-        maxmagic = MAXMAGIS;
-	if ((marray = CAST(struct magic_entry *, calloc(maxmagic,
-	    sizeof(*marray)))) == NULL) {
-		file_oomem(ms, maxmagic * sizeof(*marray));
-		return -1;
+
+	if ((map = CAST(struct magic_map *, calloc(1, sizeof(*map)))) == NULL)
+	{
+		file_oomem(ms, sizeof(*map));
+		return NULL;
 	}
-	marraycount = 0;
 
 	/* print silly verbose header for USG compat. */
 	if (action == FILE_CHECK)
@@ -825,100 +1257,50 @@ apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
 		closedir(dir);
 		qsort(filearr, files, sizeof(*filearr), cmpstrp);
 		for (i = 0; i < files; i++) {
-			load_1(ms, action, filearr[i], &errs, &marray,
-			    &marraycount);
+			load_1(ms, action, filearr[i], &errs, mset);
 			free(filearr[i]);
 		}
 		free(filearr);
 	} else
-		load_1(ms, action, fn, &errs, &marray, &marraycount);
+		load_1(ms, action, fn, &errs, mset);
 	if (errs)
 		goto out;
 
-	/* Set types of tests */
-	for (i = 0; i < marraycount; ) {
-		if (marray[i].mp->cont_level != 0) {
-			i++;
-			continue;
-		}
-
-		starttest = i;
-		do {
-			static const char text[] = "text";
-			static const char binary[] = "binary";
-			static const size_t len = sizeof(text);
-			set_test_type(marray[starttest].mp, marray[i].mp);
-			if ((ms->flags & MAGIC_DEBUG) == 0)
+	for (j = 0; j < MAGIC_SETS; j++) {
+		/* Set types of tests */
+		for (i = 0; i < mset[j].count; ) {
+			if (mset[j].me[i].mp->cont_level != 0) {
+				i++;
 				continue;
-			(void)fprintf(stderr, "%s%s%s: %s\n",
-			    marray[i].mp->mimetype,
-			    marray[i].mp->mimetype[0] == '\0' ? "" : "; ",
-			    marray[i].mp->desc[0] ? marray[i].mp->desc :
-			    "(no description)",
-			    marray[i].mp->flag & BINTEST ? binary : text);
-			if (marray[i].mp->flag & BINTEST) {
-				char *p = strstr(marray[i].mp->desc, text);
-				if (p && (p == marray[i].mp->desc ||
-				    isspace((unsigned char)p[-1])) &&
-				    (p + len - marray[i].mp->desc == 
-				    MAXstring || (p[len] == '\0' ||
-				    isspace((unsigned char)p[len]))))
-					(void)fprintf(stderr, "*** Possible "
-					    "binary test for text type\n");
 			}
-		} while (++i < marraycount && marray[i].mp->cont_level != 0);
-	}
+			i = set_text_binary(ms, mset[j].me, mset[j].count, i);
+		}
+		qsort(mset[j].me, mset[j].count, sizeof(*mset[j].me),
+		    apprentice_sort);
 
-	qsort(marray, marraycount, sizeof(*marray), apprentice_sort);
+		/*
+		 * Make sure that any level 0 "default" line is last
+		 * (if one exists).
+		 */
+		set_last_default(ms, mset[j].me, mset[j].count);
 
-	/*
-	 * Make sure that any level 0 "default" line is last (if one exists).
-	 */
-	for (i = 0; i < marraycount; i++) {
-		if (marray[i].mp->cont_level == 0 &&
-		    marray[i].mp->type == FILE_DEFAULT) {
-			while (++i < marraycount)
-				if (marray[i].mp->cont_level == 0)
-					break;
-			if (i != marraycount) {
-				/* XXX - Ugh! */
-				ms->line = marray[i].mp->lineno;
-				file_magwarn(ms,
-				    "level 0 \"default\" did not sort last");
-			}
-			break;					    
+		/* coalesce per file arrays into a single one */
+		if (coalesce_entries(ms, mset[j].me, mset[j].count,
+		    &map->magic[j], &map->nmagic[j]) == -1) {
+			errs++;
+			goto out;
 		}
 	}
 
-	for (i = 0; i < marraycount; i++)
-		mentrycount += marray[i].cont_count;
-
-	slen = sizeof(**magicp) * mentrycount;
-	if ((*magicp = CAST(struct magic *, malloc(slen))) == NULL) {
-		file_oomem(ms, slen);
-		errs++;
-		goto out;
-	}
-
-	mentrycount = 0;
-	for (i = 0; i < marraycount; i++) {
-		(void)memcpy(*magicp + mentrycount, marray[i].mp,
-		    marray[i].cont_count * sizeof(**magicp));
-		mentrycount += marray[i].cont_count;
-	}
 out:
-	for (i = 0; i < marraycount; i++)
-		free(marray[i].mp);
-	free(marray);
-	if (errs) {
-		*magicp = NULL;
-		*nmagicp = 0;
-		return errs;
-	} else {
-		*nmagicp = mentrycount;
-		return 0;
-	}
+	for (j = 0; j < MAGIC_SETS; j++)
+		magic_entry_free(mset[j].me, mset[j].count);
 
+	if (errs) {
+		apprentice_unmap(map);
+		return NULL;
+	}
+	return map;
 }
 
 /*
@@ -964,10 +1346,13 @@ file_signextend(struct magic_set *ms, struct magic *m, uint64_t v)
 		case FILE_LEQUAD:
 		case FILE_QDATE:
 		case FILE_QLDATE:
+		case FILE_QWDATE:
 		case FILE_BEQDATE:
 		case FILE_BEQLDATE:
+		case FILE_BEQWDATE:
 		case FILE_LEQDATE:
 		case FILE_LEQLDATE:
+		case FILE_LEQWDATE:
 		case FILE_DOUBLE:
 		case FILE_BEDOUBLE:
 		case FILE_LEDOUBLE:
@@ -981,6 +1366,9 @@ file_signextend(struct magic_set *ms, struct magic *m, uint64_t v)
 		case FILE_SEARCH:
 		case FILE_DEFAULT:
 		case FILE_INDIRECT:
+		case FILE_NAME:
+		case FILE_USE:
+		case FILE_CLEAR:
 			break;
 		default:
 			if (ms->flags & MAGIC_CHECK)
@@ -998,7 +1386,8 @@ string_modifier_check(struct magic_set *ms, struct magic *m)
 	if ((ms->flags & MAGIC_CHECK) == 0)
 		return 0;
 
-	if (m->type != FILE_PSTRING && (m->str_flags & PSTRING_LEN) != 0) {
+	if ((m->type != FILE_REGEX || (m->str_flags & REGEX_LINE_COUNT) == 0) &&
+	    (m->type != FILE_PSTRING && (m->str_flags & PSTRING_LEN) != 0)) {
 		file_magwarn(ms,
 		    "'/BHhLl' modifiers are only allowed for pascal strings\n");
 		return -1;
@@ -1150,22 +1539,25 @@ check_cond(struct magic_set *ms, int cond, uint32_t cont_level)
  * parse one line from magic file, put into magic[index++] if valid
  */
 private int
-parse(struct magic_set *ms, struct magic_entry **mentryp, uint32_t *nmentryp, 
-    const char *line, size_t lineno, int action)
+parse(struct magic_set *ms, struct magic_entry *me, const char *line,
+    size_t lineno, int action)
 {
 #ifdef ENABLE_CONDITIONALS
 	static uint32_t last_cont_level = 0;
 #endif
 	size_t i;
-	struct magic_entry *me;
 	struct magic *m;
 	const char *l = line;
 	char *t;
 	int op;
 	uint32_t cont_level;
+	int32_t diff;
 
 	cont_level = 0;
 
+	/*
+	 * Parse the offset.
+	 */
 	while (*l == '>') {
 		++l;		/* step over */
 		cont_level++; 
@@ -1176,16 +1568,21 @@ parse(struct magic_set *ms, struct magic_entry **mentryp, uint32_t *nmentryp,
 			return -1;
 	last_cont_level = cont_level;
 #endif
-
-#define ALLOC_CHUNK	(size_t)10
-#define ALLOC_INCR	(size_t)200
-
 	if (cont_level != 0) {
-		if (*nmentryp == 0) {
-			file_error(ms, 0, "No current entry for continuation");
+		if (me->mp == NULL) {
+			file_magerror(ms, "No current entry for continuation");
 			return -1;
 		}
-		me = &(*mentryp)[*nmentryp - 1];
+		if (me->cont_count == 0) {
+			file_magerror(ms, "Continuations present with 0 count");
+			return -1;
+		}
+		m = &me->mp[me->cont_count - 1];
+		diff = (int32_t)cont_level - (int32_t)m->cont_level;
+		if (diff > 1)
+			file_magwarn(ms, "New continuation level %u is more "
+			    "than one larger than current level %u", cont_level,
+			    m->cont_level);
 		if (me->cont_count == me->max_count) {
 			struct magic *nm;
 			size_t cnt = me->max_count + ALLOC_CHUNK;
@@ -1201,31 +1598,15 @@ parse(struct magic_set *ms, struct magic_entry **mentryp, uint32_t *nmentryp,
 		(void)memset(m, 0, sizeof(*m));
 		m->cont_level = cont_level;
 	} else {
-		if (*nmentryp == maxmagic) {
-			struct magic_entry *mp;
-
-			maxmagic += ALLOC_INCR;
-			if ((mp = CAST(struct magic_entry *,
-			    realloc(*mentryp, sizeof(*mp) * maxmagic))) ==
-			    NULL) {
-				file_oomem(ms, sizeof(*mp) * maxmagic);
-				return -1;
-			}
-			(void)memset(&mp[*nmentryp], 0, sizeof(*mp) *
-			    ALLOC_INCR);
-			*mentryp = mp;
+		static const size_t len = sizeof(*m) * ALLOC_CHUNK;
+		if (me->mp != NULL)
+			return 1;
+		if ((m = CAST(struct magic *, malloc(len))) == NULL) {
+			file_oomem(ms, len);
+			return -1;
 		}
-		me = &(*mentryp)[*nmentryp];
-		if (me->mp == NULL) {
-			size_t len = sizeof(*m) * ALLOC_CHUNK;
-			if ((m = CAST(struct magic *, malloc(len))) == NULL) {
-				file_oomem(ms, len);
-				return -1;
-			}
-			me->mp = m;
-			me->max_count = ALLOC_CHUNK;
-		} else
-			m = me->mp;
+		me->mp = m;
+		me->max_count = ALLOC_CHUNK;
 		(void)memset(m, 0, sizeof(*m));
 		m->factor_op = FILE_FACTOR_OP_NONE;
 		m->cont_level = 0;
@@ -1355,12 +1736,54 @@ parse(struct magic_set *ms, struct magic_entry **mentryp, uint32_t *nmentryp,
 	EATAB;
 #endif
 
+	/*
+	 * Parse the type.
+	 */
 	if (*l == 'u') {
-		++l;
-		m->flag |= UNSIGNED;
+		/*
+		 * Try it as a keyword type prefixed by "u"; match what
+		 * follows the "u".  If that fails, try it as an SUS
+		 * integer type. 
+		 */
+		m->type = get_type(type_tbl, l + 1, &l);
+		if (m->type == FILE_INVALID) {
+			/*
+			 * Not a keyword type; parse it as an SUS type,
+			 * 'u' possibly followed by a number or C/S/L.
+			 */
+			m->type = get_standard_integer_type(l, &l);
+		}
+		/* It's unsigned. */
+		if (m->type != FILE_INVALID)
+			m->flag |= UNSIGNED;
+	} else {
+		/*
+		 * Try it as a keyword type.  If that fails, try it as
+		 * an SUS integer type if it begins with "d" or as an
+		 * SUS string type if it begins with "s".  In any case,
+		 * it's not unsigned.
+		 */
+		m->type = get_type(type_tbl, l, &l);
+		if (m->type == FILE_INVALID) {
+			/*
+			 * Not a keyword type; parse it as an SUS type,
+			 * either 'd' possibly followed by a number or
+			 * C/S/L, or just 's'.
+			 */
+			if (*l == 'd')
+				m->type = get_standard_integer_type(l, &l);
+			else if (*l == 's' && !isalpha((unsigned char)l[1])) {
+				m->type = FILE_STRING;
+				++l;
+			}
+		}
 	}
 
-	m->type = get_type(l, &l);
+	if (m->type == FILE_INVALID) {
+		/* Not found - try it as a special keyword. */
+		m->type = get_type(special_tbl, l, &l);
+	}
+			
 	if (m->type == FILE_INVALID) {
 		if (ms->flags & MAGIC_CHECK)
 			file_magwarn(ms, "type `%s' invalid", l);
@@ -1433,6 +1856,9 @@ parse(struct magic_set *ms, struct magic_entry **mentryp, uint32_t *nmentryp,
 				case CHAR_TEXTTEST:
 					m->str_flags |= STRING_TEXTTEST;
 					break;
+				case CHAR_TRIM:
+					m->str_flags |= STRING_TRIM;
+					break;
 				case CHAR_PSTRING_1_LE:
 					if (m->type != FILE_PSTRING)
 						goto bad;
@@ -1454,8 +1880,13 @@ parse(struct magic_set *ms, struct magic_entry **mentryp, uint32_t *nmentryp,
 					m->str_flags = (m->str_flags & ~PSTRING_LEN) | PSTRING_4_BE;
 					break;
 				case CHAR_PSTRING_4_LE:
-					if (m->type != FILE_PSTRING)
+					switch (m->type) {
+					case FILE_PSTRING:
+					case FILE_REGEX:
+						break;
+					default:
 						goto bad;
+					}
 					m->str_flags = (m->str_flags & ~PSTRING_LEN) | PSTRING_4_LE;
 					break;
 				case CHAR_PSTRING_LENGTH_INCLUDES_ITSELF:
@@ -1575,8 +2006,6 @@ parse(struct magic_set *ms, struct magic_entry **mentryp, uint32_t *nmentryp,
 	}
 #endif
 	m->mimetype[0] = '\0';		/* initialise MIME type to none */
-	if (m->cont_level == 0)
-		++(*nmentryp);		/* make room for next */
 	return 0;
 }
 
@@ -1598,6 +2027,11 @@ parse_strength(struct magic_set *ms, struct magic_entry *me, const char *line)
 		    m->factor_op, m->factor);
 		return -1;
 	}
+	if (m->type == FILE_NAME) {
+		file_magwarn(ms, "%s: Strength setting is not supported in "
+		    "\"name\" magic entries", m->value.s);
+		return -1;
+	}
 	EATAB;
 	switch (*l) {
 	case FILE_FACTOR_OP_NONE:
@@ -1634,6 +2068,51 @@ parse_strength(struct magic_set *ms, struct magic_entry *me, const char *line)
 	return -1;
 }
 
+private int
+parse_extra(struct magic_set *ms, struct magic_entry *me, const char *line,
+    off_t off, size_t len, const char *name, int nt)
+{
+	size_t i;
+	const char *l = line;
+	struct magic *m = &me->mp[me->cont_count == 0 ? 0 : me->cont_count - 1];
+	char *buf = (char *)m + off;
+
+	if (buf[0] != '\0') {
+		len = nt ? strlen(buf) : len;
+		file_magwarn(ms, "Current entry already has a %s type "
+		    "`%.*s', new type `%s'", name, (int)len, buf, l);
+		return -1;
+	}	
+
+	if (*m->desc == '\0') {
+		file_magwarn(ms, "Current entry does not yet have a "
+		    "description for adding a %s type", name);
+		return -1;
+	}
+
+	EATAB;
+	for (i = 0; *l && ((isascii((unsigned char)*l) &&
+	    isalnum((unsigned char)*l)) || strchr("-+/.", *l)) &&
+	    i < len; buf[i++] = *l++)
+		continue;
+
+	if (i == len && *l) {
+		if (nt)
+			buf[len - 1] = '\0';
+		if (ms->flags & MAGIC_CHECK)
+			file_magwarn(ms, "%s type `%s' truncated %"
+			    SIZE_T_FORMAT "u", name, line, i);
+	} else {
+		if (nt)
+			buf[i] = '\0';
+	}
+
+	if (i > 0)
+		return 0;
+	else
+		return -1;
+}
+
 /*
  * Parse an Apple CREATOR/TYPE annotation from magic file and put it into
  * magic[index - 1]
@@ -1641,32 +2120,10 @@ parse_strength(struct magic_set *ms, struct magic_entry *me, const char *line)
 private int
 parse_apple(struct magic_set *ms, struct magic_entry *me, const char *line)
 {
-	size_t i;
-	const char *l = line;
-	struct magic *m = &me->mp[me->cont_count == 0 ? 0 : me->cont_count - 1];
+	struct magic *m = &me->mp[0];
 
-	if (m->apple[0] != '\0') {
-		file_magwarn(ms, "Current entry already has a APPLE type "
-		    "`%.8s', new type `%s'", m->mimetype, l);
-		return -1;
-	}	
-
-	EATAB;
-	for (i = 0; *l && ((isascii((unsigned char)*l) &&
-	    isalnum((unsigned char)*l)) || strchr("-+/.", *l)) &&
-	    i < sizeof(m->apple); m->apple[i++] = *l++)
-		continue;
-	if (i == sizeof(m->apple) && *l) {
-		/* We don't need to NUL terminate here, printing handles it */
-		if (ms->flags & MAGIC_CHECK)
-			file_magwarn(ms, "APPLE type `%s' truncated %"
-			    SIZE_T_FORMAT "u", line, i);
-	}
-
-	if (i > 0)
-		return 0;
-	else
-		return -1;
+	return parse_extra(ms, me, line, offsetof(struct magic, apple),
+	    sizeof(m->apple), "APPLE", 0);
 }
 
 /*
@@ -1676,49 +2133,50 @@ parse_apple(struct magic_set *ms, struct magic_entry *me, const char *line)
 private int
 parse_mime(struct magic_set *ms, struct magic_entry *me, const char *line)
 {
-	size_t i;
-	const char *l = line;
-	struct magic *m = &me->mp[me->cont_count == 0 ? 0 : me->cont_count - 1];
+	struct magic *m = &me->mp[0];
 
-	if (m->mimetype[0] != '\0') {
-		file_magwarn(ms, "Current entry already has a MIME type `%s',"
-		    " new type `%s'", m->mimetype, l);
-		return -1;
-	}	
-
-	EATAB;
-	for (i = 0; *l && ((isascii((unsigned char)*l) &&
-	    isalnum((unsigned char)*l)) || strchr("-+/.", *l)) &&
-	    i < sizeof(m->mimetype); m->mimetype[i++] = *l++)
-		continue;
-	if (i == sizeof(m->mimetype)) {
-		m->mimetype[sizeof(m->mimetype) - 1] = '\0';
-		if (ms->flags & MAGIC_CHECK)
-			file_magwarn(ms, "MIME type `%s' truncated %"
-			    SIZE_T_FORMAT "u", m->mimetype, i);
-	} else
-		m->mimetype[i] = '\0';
-
-	if (i > 0)
-		return 0;
-	else
-		return -1;
+	return parse_extra(ms, me, line, offsetof(struct magic, mimetype),
+	    sizeof(m->mimetype), "MIME", 1);
 }
 
 private int
 check_format_type(const char *ptr, int type)
 {
-	int quad = 0;
+	int quad = 0, h;
 	if (*ptr == '\0') {
 		/* Missing format string; bad */
 		return -1;
 	}
 
-	switch (type) {
+	switch (file_formats[type]) {
 	case FILE_FMT_QUAD:
 		quad = 1;
 		/*FALLTHROUGH*/
 	case FILE_FMT_NUM:
+		if (quad == 0) {
+			switch (type) {
+			case FILE_BYTE:
+				h = 2;
+				break;
+			case FILE_SHORT:
+			case FILE_BESHORT:
+			case FILE_LESHORT:
+				h = 1;
+				break;
+			case FILE_LONG:
+			case FILE_BELONG:
+			case FILE_LELONG:
+			case FILE_MELONG:
+			case FILE_LEID3:
+			case FILE_BEID3:
+			case FILE_INDIRECT:
+				h = 0;
+				break;
+			default:
+				abort();
+			}
+		} else
+			h = 0;
 		if (*ptr == '-')
 			ptr++;
 		if (*ptr == '.')
@@ -1735,45 +2193,67 @@ check_format_type(const char *ptr, int type)
 		}
 	
 		switch (*ptr++) {
+#ifdef STRICT_FORMAT 	/* "long" formats are int formats for us */
+		/* so don't accept the 'l' modifier */
 		case 'l':
 			switch (*ptr++) {
 			case 'i':
 			case 'd':
 			case 'u':
+			case 'o':
 			case 'x':
 			case 'X':
-				return 0;
+				return h != 0 ? -1 : 0;
 			default:
 				return -1;
 			}
 		
+		/*
+		 * Don't accept h and hh modifiers. They make writing
+		 * magic entries more complicated, for very little benefit
+		 */
 		case 'h':
+			if (h-- <= 0)
+				return -1;
 			switch (*ptr++) {
 			case 'h':
+				if (h-- <= 0)
+					return -1;
 				switch (*ptr++) {
 				case 'i':
 				case 'd':
 				case 'u':
+				case 'o':
 				case 'x':
 				case 'X':
 					return 0;
 				default:
 					return -1;
 				}
+			case 'i':
 			case 'd':
-				return 0;
+			case 'u':
+			case 'o':
+			case 'x':
+			case 'X':
+				return h != 0 ? -1 : 0;
 			default:
 				return -1;
 			}
-
-		case 'i':
+#endif
 		case 'c':
+			return h != 2 ? -1 : 0;
+		case 'i':
 		case 'd':
 		case 'u':
+		case 'o':
 		case 'x':
 		case 'X':
+#ifdef STRICT_FORMAT
+			return h != 0 ? -1 : 0;
+#else
 			return 0;
-			
+#endif
 		default:
 			return -1;
 		}
@@ -1860,7 +2340,7 @@ check_format(struct magic_set *ms, struct magic *m)
 	}
 
 	ptr++;
-	if (check_format_type(ptr, file_formats[m->type]) == -1) {
+	if (check_format_type(ptr, m->type) == -1) {
 		/*
 		 * TODO: this error message is unhelpful if the format
 		 * string is not one character long
@@ -1898,6 +2378,8 @@ getvalue(struct magic_set *ms, struct magic *m, const char **p, int action)
 	case FILE_PSTRING:
 	case FILE_REGEX:
 	case FILE_SEARCH:
+	case FILE_NAME:
+	case FILE_USE:
 		*p = getstr(ms, m, *p, action == FILE_COMPILE);
 		if (*p == NULL) {
 			if (ms->flags & MAGIC_CHECK)
@@ -1905,6 +2387,16 @@ getvalue(struct magic_set *ms, struct magic *m, const char **p, int action)
 				    m->value.s);
 			return -1;
 		}
+		if (m->type == FILE_REGEX) {
+			file_regex_t rx;
+			int rc = file_regcomp(&rx, m->value.s, REG_EXTENDED);
+			if (rc) {
+				if (ms->flags & MAGIC_CHECK)
+					file_regerror(&rx, rc, ms);
+			}
+			file_regfree(&rx);
+			return rc ? -1 : 0;
+		}
 		return 0;
 	case FILE_FLOAT:
 	case FILE_BEFLOAT:
@@ -2204,64 +2696,71 @@ eatsize(const char **p)
 	*p = l;
 }
 
-#ifndef COMPILE_ONLY
 /*
  * handle a compiled file.
  */
-private int
-apprentice_map(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
-    const char *fn)
+
+private struct magic_map *
+apprentice_map(struct magic_set *ms, const char *fn)
 {
 	int fd;
 	struct stat st;
 	uint32_t *ptr;
-	uint32_t version;
+	uint32_t version, entries, nentries;
 	int needsbyteswap;
 	char *dbname = NULL;
-	void *mm = NULL;
+	struct magic_map *map;
+	size_t i;
+
+	fd = -1;
+	if ((map = CAST(struct magic_map *, calloc(1, sizeof(*map)))) == NULL) {
+		file_oomem(ms, sizeof(*map));
+		goto error;
+	}
 
 	dbname = mkdbname(ms, fn, 0);
 	if (dbname == NULL)
-		goto error2;
+		goto error;
 
 	if ((fd = open(dbname, O_RDONLY|O_BINARY)) == -1)
-		goto error2;
+		goto error;
 
 	if (fstat(fd, &st) == -1) {
 		file_error(ms, errno, "cannot stat `%s'", dbname);
-		goto error1;
+		goto error;
 	}
-	if (st.st_size < 8) {
-		file_error(ms, 0, "file `%s' is too small", dbname);
-		goto error1;
+	if (st.st_size < 8 || st.st_size > MAXMAGIC_SIZE) {
+		file_error(ms, 0, "file `%s' is too %s", dbname,
+		    st.st_size < 8 ? "small" : "large");
+		goto error;
 	}
 
+	map->len = (size_t)st.st_size;
 #ifdef QUICK
-	if ((mm = mmap(0, (size_t)st.st_size, PROT_READ|PROT_WRITE,
+	if ((map->p = mmap(0, (size_t)st.st_size, PROT_READ|PROT_WRITE,
 	    MAP_PRIVATE|MAP_FILE, fd, (off_t)0)) == MAP_FAILED) {
 		file_error(ms, errno, "cannot map `%s'", dbname);
-		goto error1;
+		goto error;
 	}
-#define RET	2
 #else
-	if ((mm = CAST(void *, malloc((size_t)st.st_size))) == NULL) {
-		file_oomem(ms, (size_t)st.st_size);
-		goto error1;
+	if ((map->p = CAST(void *, malloc(map->len))) == NULL) {
+		file_oomem(ms, map->len);
+		goto error;
 	}
-	if (read(fd, mm, (size_t)st.st_size) != (ssize_t)st.st_size) {
+	if (read(fd, map->p, map->len) != (ssize_t)map->len) {
 		file_badread(ms);
-		goto error1;
+		goto error;
 	}
+	map->len = 0;
 #define RET	1
 #endif
-	*magicp = CAST(struct magic *, mm);
 	(void)close(fd);
 	fd = -1;
-	ptr = (uint32_t *)(void *)*magicp;
+	ptr = CAST(uint32_t *, map->p);
 	if (*ptr != MAGICNO) {
 		if (swap4(*ptr) != MAGICNO) {
 			file_error(ms, 0, "bad magic in `%s'", dbname);
-			goto error1;
+			goto error;
 		}
 		needsbyteswap = 1;
 	} else
@@ -2274,75 +2773,90 @@ apprentice_map(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
 		file_error(ms, 0, "File %s supports only version %d magic "
 		    "files. `%s' is version %d", VERSION,
 		    VERSIONNO, dbname, version);
-		goto error1;
+		goto error;
+	}
+	entries = (uint32_t)(st.st_size / sizeof(struct magic));
+	if ((off_t)(entries * sizeof(struct magic)) != st.st_size) {
+		file_error(ms, 0, "Size of `%s' %" INT64_T_FORMAT "u is not "
+		    "a multiple of %" SIZE_T_FORMAT "u",
+		    dbname, (unsigned long long)st.st_size,
+		    sizeof(struct magic));
+		goto error;
+	}
+	map->magic[0] = CAST(struct magic *, map->p) + 1;
+	nentries = 0;
+	for (i = 0; i < MAGIC_SETS; i++) {
+		if (needsbyteswap)
+			map->nmagic[i] = swap4(ptr[i + 2]);
+		else
+			map->nmagic[i] = ptr[i + 2];
+		if (i != MAGIC_SETS - 1)
+			map->magic[i + 1] = map->magic[i] + map->nmagic[i];
+		nentries += map->nmagic[i];
+	}
+	if (entries != nentries + 1) {
+		file_error(ms, 0, "Inconsistent entries in `%s' %u != %u",
+		    dbname, entries, nentries + 1);
+		goto error;
 	}
-	*nmagicp = (uint32_t)(st.st_size / sizeof(struct magic));
-	if (*nmagicp > 0)
-		(*nmagicp)--;
-	(*magicp)++;
 	if (needsbyteswap)
-		byteswap(*magicp, *nmagicp);
+		for (i = 0; i < MAGIC_SETS; i++)
+			byteswap(map->magic[i], map->nmagic[i]);
 	free(dbname);
-	return RET;
+	return map;
 
-error1:
+error:
 	if (fd != -1)
 		(void)close(fd);
-	if (mm) {
-#ifdef QUICK
-		(void)munmap((void *)mm, (size_t)st.st_size);
-#else
-		free(mm);
-#endif
-	} else {
-		*magicp = NULL;
-		*nmagicp = 0;
-	}
-error2:
+	apprentice_unmap(map);
 	free(dbname);
-	return -1;
+	return NULL;
 }
-#endif /* COMPILE_ONLY */
 
-private const uint32_t ar[] = {
-    MAGICNO, VERSIONNO
-};
 /*
  * handle an mmaped file.
  */
 private int
-apprentice_compile(struct magic_set *ms, struct magic **magicp,
-    uint32_t *nmagicp, const char *fn)
+apprentice_compile(struct magic_set *ms, struct magic_map *map, const char *fn)
 {
+	static const size_t nm = sizeof(*map->nmagic) * MAGIC_SETS;
+	static const size_t m = sizeof(**map->magic);
 	int fd = -1;
+	size_t len;
 	char *dbname;
 	int rv = -1;
+	uint32_t i;
+	union {
+		struct magic m;
+		uint32_t h[2 + MAGIC_SETS];
+	} hdr;
 
 	dbname = mkdbname(ms, fn, 1);
 
 	if (dbname == NULL) 
 		goto out;
 
-	if ((fd = open(dbname, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0644)) == -1) {
+	if ((fd = open(dbname, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0644)) == -1) 
+	{
 		file_error(ms, errno, "cannot open `%s'", dbname);
 		goto out;
 	}
+	memset(&hdr, 0, sizeof(hdr));
+	hdr.h[0] = MAGICNO;
+	hdr.h[1] = VERSIONNO;
+	memcpy(hdr.h + 2, map->nmagic, nm);
 
-	if (write(fd, ar, sizeof(ar)) != (ssize_t)sizeof(ar)) {
+	if (write(fd, &hdr, sizeof(hdr)) != (ssize_t)sizeof(hdr)) {
 		file_error(ms, errno, "error writing `%s'", dbname);
 		goto out;
 	}
 
-	if (lseek(fd, (off_t)sizeof(struct magic), SEEK_SET)
-	    != sizeof(struct magic)) {
-		file_error(ms, errno, "error seeking `%s'", dbname);
-		goto out;
-	}
-
-	if (write(fd, *magicp, (sizeof(struct magic) * *nmagicp)) 
-	    != (ssize_t)(sizeof(struct magic) * *nmagicp)) {
-		file_error(ms, errno, "error writing `%s'", dbname);
-		goto out;
+	for (i = 0; i < MAGIC_SETS; i++) {
+		len = m * map->nmagic[i];
+		if (write(fd, map->magic[i], len) != (ssize_t)len) {
+			file_error(ms, errno, "error writing `%s'", dbname);
+			goto out;
+		}
 	}
 
 	if (fd != -1)
@@ -2383,14 +2897,16 @@ mkdbname(struct magic_set *ms, const char *fn, int strip)
 	q++;
 	/* Compatibility with old code that looked in .mime */
 	if (ms->flags & MAGIC_MIME) {
-		asprintf(&buf, "%.*s.mime%s", (int)(q - fn), fn, ext);
+		if (asprintf(&buf, "%.*s.mime%s", (int)(q - fn), fn, ext) < 0)
+			return NULL;
 		if (access(buf, R_OK) != -1) {
 			ms->flags &= MAGIC_MIME_TYPE;
 			return buf;
 		}
 		free(buf);
 	}
-	asprintf(&buf, "%.*s%s", (int)(q - fn), fn, ext);
+	if (asprintf(&buf, "%.*s%s", (int)(q - fn), fn, ext) < 0)
+		return NULL;
 
 	/* Compatibility with old code that looked in .mime */
 	if (strstr(p, ".mime") != NULL)
@@ -2398,7 +2914,6 @@ mkdbname(struct magic_set *ms, const char *fn, int strip)
 	return buf;
 }
 
-#ifndef COMPILE_ONLY
 /*
  * Byteswap an mmap'ed file if needed
  */
@@ -2490,7 +3005,6 @@ bs1(struct magic *m)
 		m->num_mask = swap8(m->num_mask);
 	}
 }
-#endif /* COMPILE_ONLY */
 
 protected size_t 
 file_pstring_length_size(const struct magic *m)
@@ -2539,3 +3053,30 @@ file_pstring_get_length(const struct magic *m, const char *s)
 
 	return len;
 }
+
+protected int
+file_magicfind(struct magic_set *ms, const char *name, struct mlist *v)
+{
+	uint32_t i, j;
+	struct mlist *mlist, *ml;
+
+	mlist = ms->mlist[1];
+
+	for (ml = mlist->next; ml != mlist; ml = ml->next) {
+		struct magic *ma = ml->magic;
+		uint32_t nma = ml->nmagic;
+		for (i = 0; i < nma; i++) {
+			if (ma[i].type != FILE_NAME)
+				continue;
+			if (strcmp(ma[i].value.s, name) == 0) {
+				v->magic = &ma[i];
+				for (j = i + 1; j < nma; j++)
+				    if (ma[j].cont_level == 0)
+					    break;
+				v->nmagic = j - i;
+				return 0;
+			}
+		}
+	}
+	return -1;
+}
diff --git a/contrib/file/apptype.c b/contrib/file/src/apptype.c
similarity index 100%
rename from contrib/file/apptype.c
rename to contrib/file/src/apptype.c
diff --git a/contrib/file/ascmagic.c b/contrib/file/src/ascmagic.c
similarity index 97%
rename from contrib/file/ascmagic.c
rename to contrib/file/src/ascmagic.c
index 5a1caacb5a7..ca266655687 100644
--- a/contrib/file/ascmagic.c
+++ b/contrib/file/src/ascmagic.c
@@ -35,7 +35,7 @@
 #include "file.h"
 
 #ifndef	lint
-FILE_RCSID("@(#)$File: ascmagic.c,v 1.84 2011/12/08 12:38:24 rrt Exp $")
+FILE_RCSID("@(#)$File: ascmagic.c,v 1.88 2014/02/12 23:20:53 christos Exp $")
 #endif	/* lint */
 
 #include "magic.h"
@@ -72,7 +72,7 @@ file_ascmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
 	int text)
 {
 	unichar *ubuf = NULL;
-	size_t ulen;
+	size_t ulen = 0;
 	int rv = 1;
 
 	const char *code = NULL;
@@ -134,7 +134,7 @@ file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf,
 		goto done;
 	}
 
-	if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0) {
+	if (ulen > 0 && (ms->flags & MAGIC_NO_CHECK_SOFT) == 0) {
 		/* Convert ubuf to UTF-8 and try text soft magic */
 		/* malloc size is a conservative overestimate; could be
 		   improved, or at least realloced after conversion. */
@@ -147,7 +147,7 @@ file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf,
 		    == NULL)
 			goto done;
 		if ((rv = file_softmagic(ms, utf8_buf,
-		    (size_t)(utf8_end - utf8_buf), TEXTTEST, text)) == 0)
+		    (size_t)(utf8_end - utf8_buf), 0, TEXTTEST, text)) == 0)
 			rv = -1;
 	}
 
@@ -211,6 +211,7 @@ file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf,
 				case 0:
 					if (file_printf(ms, ", ") == -1)
 						goto done;
+					break;
 				case -1:
 					goto done;
 				default:
diff --git a/contrib/file/src/asctime_r.c b/contrib/file/src/asctime_r.c
new file mode 100644
index 00000000000..3a0ec0447b9
--- /dev/null
+++ b/contrib/file/src/asctime_r.c
@@ -0,0 +1,19 @@
+/*	$File: asctime_r.c,v 1.1 2012/05/15 17:14:36 christos Exp $	*/
+
+#include "file.h"
+#ifndef	lint
+FILE_RCSID("@(#)$File: asctime_r.c,v 1.1 2012/05/15 17:14:36 christos Exp $")
+#endif	/* lint */
+#include 
+#include 
+
+/* asctime_r is not thread-safe anyway */
+char *
+asctime_r(const struct tm *t, char *dst)
+{
+	char *p = asctime(t);
+	if (p == NULL)
+		return NULL;
+	memcpy(dst, p, 26);
+	return dst;
+}
diff --git a/contrib/file/asprintf.c b/contrib/file/src/asprintf.c
similarity index 100%
rename from contrib/file/asprintf.c
rename to contrib/file/src/asprintf.c
diff --git a/contrib/file/cdf.c b/contrib/file/src/cdf.c
similarity index 94%
rename from contrib/file/cdf.c
rename to contrib/file/src/cdf.c
index d05d279e53c..106fc7ac02f 100644
--- a/contrib/file/cdf.c
+++ b/contrib/file/src/cdf.c
@@ -35,7 +35,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: cdf.c,v 1.50 2012/02/20 22:35:29 christos Exp $")
+FILE_RCSID("@(#)$File: cdf.c,v 1.63 2014/06/09 13:04:37 christos Exp $")
 #endif
 
 #include 
@@ -267,13 +267,15 @@ cdf_check_stream_offset(const cdf_stream_t *sst, const cdf_header_t *h,
 {
 	const char *b = (const char *)sst->sst_tab;
 	const char *e = ((const char *)p) + tail;
+	size_t ss = sst->sst_dirlen < h->h_min_size_standard_stream ?
+	    CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);
 	(void)&line;
-	if (e >= b && (size_t)(e - b) < CDF_SEC_SIZE(h) * sst->sst_len)
+	if (e >= b && (size_t)(e - b) <= ss * sst->sst_len)
 		return 0;
-	DPRINTF(("%d: offset begin %p end %p %" SIZE_T_FORMAT "u"
-	    " >= %" SIZE_T_FORMAT "u [%" SIZE_T_FORMAT "u %"
+	DPRINTF(("%d: offset begin %p < end %p || %" SIZE_T_FORMAT "u"
+	    " > %" SIZE_T_FORMAT "u [%" SIZE_T_FORMAT "u %"
 	    SIZE_T_FORMAT "u]\n", line, b, e, (size_t)(e - b),
-	    CDF_SEC_SIZE(h) * sst->sst_len, CDF_SEC_SIZE(h), sst->sst_len));
+	    ss * sst->sst_len, ss, sst->sst_len));
 	errno = EFTYPE;
 	return -1;
 }
@@ -296,10 +298,7 @@ cdf_read(const cdf_info_t *info, off_t off, void *buf, size_t len)
 	if (info->i_fd == -1)
 		return -1;
 
-	if (lseek(info->i_fd, off, SEEK_SET) == (off_t)-1)
-		return -1;
-
-	if (read(info->i_fd, buf, len) != (ssize_t)len)
+	if (pread(info->i_fd, buf, len, off) != (ssize_t)len)
 		return -1;
 
 	return (ssize_t)len;
@@ -355,10 +354,10 @@ cdf_read_short_sector(const cdf_stream_t *sst, void *buf, size_t offs,
 	size_t ss = CDF_SHORT_SEC_SIZE(h);
 	size_t pos = CDF_SHORT_SEC_POS(h, id);
 	assert(ss == len);
-	if (pos > CDF_SEC_SIZE(h) * sst->sst_len) {
+	if (pos + len > CDF_SEC_SIZE(h) * sst->sst_len) {
 		DPRINTF(("Out of bounds read %" SIZE_T_FORMAT "u > %"
 		    SIZE_T_FORMAT "u\n",
-		    pos, CDF_SEC_SIZE(h) * sst->sst_len));
+		    pos + len, CDF_SEC_SIZE(h) * sst->sst_len));
 		return -1;
 	}
 	(void)memcpy(((char *)buf) + offs,
@@ -458,7 +457,8 @@ size_t
 cdf_count_chain(const cdf_sat_t *sat, cdf_secid_t sid, size_t size)
 {
 	size_t i, j;
-	cdf_secid_t maxsector = (cdf_secid_t)(sat->sat_len * size);
+	cdf_secid_t maxsector = (cdf_secid_t)((sat->sat_len * size)
+	    / sizeof(maxsector));
 
 	DPRINTF(("Chain:"));
 	for (j = i = 0; sid >= 0; i++, j++) {
@@ -468,13 +468,18 @@ cdf_count_chain(const cdf_sat_t *sat, cdf_secid_t sid, size_t size)
 			errno = EFTYPE;
 			return (size_t)-1;
 		}
-		if (sid > maxsector) {
-			DPRINTF(("Sector %d > %d\n", sid, maxsector));
+		if (sid >= maxsector) {
+			DPRINTF(("Sector %d >= %d\n", sid, maxsector));
 			errno = EFTYPE;
 			return (size_t)-1;
 		}
 		sid = CDF_TOLE4((uint32_t)sat->sat_tab[sid]);
 	}
+	if (i == 0) {
+		DPRINTF((" none, sid: %d\n", sid));
+		return (size_t)-1;
+
+	}
 	DPRINTF(("\n"));
 	return i;
 }
@@ -678,11 +683,13 @@ cdf_read_ssat(const cdf_info_t *info, const cdf_header_t *h,
 
 int
 cdf_read_short_stream(const cdf_info_t *info, const cdf_header_t *h,
-    const cdf_sat_t *sat, const cdf_dir_t *dir, cdf_stream_t *scn)
+    const cdf_sat_t *sat, const cdf_dir_t *dir, cdf_stream_t *scn,
+    const cdf_directory_t **root)
 {
 	size_t i;
 	const cdf_directory_t *d;
 
+	*root = NULL;
 	for (i = 0; i < dir->dir_len; i++)
 		if (dir->dir_tab[i].d_type == CDF_DIR_TYPE_ROOT_STORAGE)
 			break;
@@ -691,6 +698,7 @@ cdf_read_short_stream(const cdf_info_t *info, const cdf_header_t *h,
 	if (i == dir->dir_len)
 		goto out;
 	d = &dir->dir_tab[i];
+	*root = d;
 
 	/* If the it is not there, just fake it; some docs don't have it */
 	if (d->d_stream_first_sector < 0)
@@ -718,19 +726,28 @@ int
 cdf_read_summary_info(const cdf_info_t *info, const cdf_header_t *h,
     const cdf_sat_t *sat, const cdf_sat_t *ssat, const cdf_stream_t *sst,
     const cdf_dir_t *dir, cdf_stream_t *scn)
+{
+	return cdf_read_user_stream(info, h, sat, ssat, sst, dir,
+	    "\05SummaryInformation", scn);
+}
+
+int
+cdf_read_user_stream(const cdf_info_t *info, const cdf_header_t *h,
+    const cdf_sat_t *sat, const cdf_sat_t *ssat, const cdf_stream_t *sst,
+    const cdf_dir_t *dir, const char *name, cdf_stream_t *scn)
 {
 	size_t i;
 	const cdf_directory_t *d;
-	static const char name[] = "\05SummaryInformation";
+	size_t name_len = strlen(name) + 1;
 
 	for (i = dir->dir_len; i > 0; i--)
 		if (dir->dir_tab[i - 1].d_type == CDF_DIR_TYPE_USER_STREAM &&
-		    cdf_namecmp(name, dir->dir_tab[i - 1].d_name, sizeof(name))
+		    cdf_namecmp(name, dir->dir_tab[i - 1].d_name, name_len)
 		    == 0)
 			break;
 
 	if (i == 0) {
-		DPRINTF(("Cannot find summary information section\n"));
+		DPRINTF(("Cannot find user stream `%s'\n", name));
 		errno = ESRCH;
 		return -1;
 	}
@@ -799,7 +816,11 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
 	if (cdf_check_stream_offset(sst, h, e, 0, __LINE__) == -1)
 		goto out;
 	for (i = 0; i < sh.sh_properties; i++) {
-		size_t ofs = CDF_GETUINT32(p, (i << 1) + 1);
+		size_t tail = (i << 1) + 1;
+		if (cdf_check_stream_offset(sst, h, p, tail * sizeof(uint32_t),
+		    __LINE__) == -1)
+			goto out;
+		size_t ofs = CDF_GETUINT32(p, tail);
 		q = (const uint8_t *)(const void *)
 		    ((const char *)(const void *)p + ofs
 		    - 2 * sizeof(uint32_t));
@@ -813,6 +834,10 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
 		    i, inp[i].pi_id, inp[i].pi_type, q - p, offs));
 		if (inp[i].pi_type & CDF_VECTOR) {
 			nelements = CDF_GETUINT32(q, 1);
+			if (nelements == 0) {
+				DPRINTF(("CDF_VECTOR with nelements == 0\n"));
+				goto out;
+			}
 			o = 2;
 		} else {
 			nelements = 1;
@@ -887,7 +912,9 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
 			}
 			DPRINTF(("nelements = %" SIZE_T_FORMAT "u\n",
 			    nelements));
-			for (j = 0; j < nelements; j++, i++) {
+			for (j = 0; j < nelements && i < sh.sh_properties;
+			    j++, i++)
+			{
 				uint32_t l = CDF_GETUINT32(q, o);
 				inp[i].pi_str.s_len = l;
 				inp[i].pi_str.s_buf = (const char *)
@@ -932,7 +959,7 @@ int
 cdf_unpack_summary_info(const cdf_stream_t *sst, const cdf_header_t *h,
     cdf_summary_info_header_t *ssi, cdf_property_info_t **info, size_t *count)
 {
-	size_t i, maxcount;
+	size_t maxcount;
 	const cdf_summary_info_header_t *si =
 	    CAST(const cdf_summary_info_header_t *, sst->sst_tab);
 	const cdf_section_declaration_t *sd =
@@ -947,21 +974,13 @@ cdf_unpack_summary_info(const cdf_stream_t *sst, const cdf_header_t *h,
 	ssi->si_os = CDF_TOLE2(si->si_os);
 	ssi->si_class = si->si_class;
 	cdf_swap_class(&ssi->si_class);
-	ssi->si_count = CDF_TOLE2(si->si_count);
+	ssi->si_count = CDF_TOLE4(si->si_count);
 	*count = 0;
 	maxcount = 0;
 	*info = NULL;
-	for (i = 0; i < CDF_TOLE4(si->si_count); i++) {
-		if (i >= CDF_LOOP_LIMIT) {
-			DPRINTF(("Unpack summary info loop limit"));
-			errno = EFTYPE;
-			return -1;
-		}
-		if (cdf_read_property_info(sst, h, CDF_TOLE4(sd->sd_offset),
-		    info, count, &maxcount) == -1) {
-			return -1;
-		}
-	}
+	if (cdf_read_property_info(sst, h, CDF_TOLE4(sd->sd_offset), info,
+	    count, &maxcount) == -1)
+		return -1;
 	return 0;
 }
 
@@ -1141,6 +1160,7 @@ cdf_dump_dir(const cdf_info_t *info, const cdf_header_t *h,
 	    "user stream", "lockbytes", "property", "root storage" };
 
 	for (i = 0; i < dir->dir_len; i++) {
+		char buf[26];
 		d = &dir->dir_tab[i];
 		for (j = 0; j < sizeof(name); j++)
 			name[j] = (char)CDF_TOLE2(d->d_name[j]);
@@ -1156,9 +1176,10 @@ cdf_dump_dir(const cdf_info_t *info, const cdf_header_t *h,
 		(void)fprintf(stderr, "Right child: %d\n", d->d_right_child);
 		(void)fprintf(stderr, "Flags: 0x%x\n", d->d_flags);
 		cdf_timestamp_to_timespec(&ts, d->d_created);
-		(void)fprintf(stderr, "Created %s", cdf_ctime(&ts.tv_sec));
+		(void)fprintf(stderr, "Created %s", cdf_ctime(&ts.tv_sec, buf));
 		cdf_timestamp_to_timespec(&ts, d->d_modified);
-		(void)fprintf(stderr, "Modified %s", cdf_ctime(&ts.tv_sec));
+		(void)fprintf(stderr, "Modified %s",
+		    cdf_ctime(&ts.tv_sec, buf));
 		(void)fprintf(stderr, "Stream %d\n", d->d_stream_first_sector);
 		(void)fprintf(stderr, "Size %d\n", d->d_size);
 		switch (d->d_type) {
@@ -1236,9 +1257,10 @@ cdf_dump_property_info(const cdf_property_info_t *info, size_t count)
 				cdf_print_elapsed_time(buf, sizeof(buf), tp);
 				(void)fprintf(stderr, "timestamp %s\n", buf);
 			} else {
+				char buf[26];
 				cdf_timestamp_to_timespec(&ts, tp);
 				(void)fprintf(stderr, "timestamp %s",
-				    cdf_ctime(&ts.tv_sec));
+				    cdf_ctime(&ts.tv_sec, buf));
 			}
 			break;
 		case CDF_CLIPBOARD:
diff --git a/contrib/file/cdf.h b/contrib/file/src/cdf.h
similarity index 97%
rename from contrib/file/cdf.h
rename to contrib/file/src/cdf.h
index 6fe2646e935..910fb95fc34 100644
--- a/contrib/file/cdf.h
+++ b/contrib/file/src/cdf.h
@@ -294,9 +294,13 @@ int cdf_read_dir(const cdf_info_t *, const cdf_header_t *, const cdf_sat_t *,
 int cdf_read_ssat(const cdf_info_t *, const cdf_header_t *, const cdf_sat_t *,
     cdf_sat_t *);
 int cdf_read_short_stream(const cdf_info_t *, const cdf_header_t *,
-    const cdf_sat_t *, const cdf_dir_t *, cdf_stream_t *);
+    const cdf_sat_t *, const cdf_dir_t *, cdf_stream_t *,
+    const cdf_directory_t **);
 int cdf_read_property_info(const cdf_stream_t *, const cdf_header_t *, uint32_t,
     cdf_property_info_t **, size_t *, size_t *);
+int cdf_read_user_stream(const cdf_info_t *, const cdf_header_t *,
+    const cdf_sat_t *, const cdf_sat_t *, const cdf_stream_t *,
+    const cdf_dir_t *, const char *, cdf_stream_t *);
 int cdf_read_summary_info(const cdf_info_t *, const cdf_header_t *,
     const cdf_sat_t *, const cdf_sat_t *, const cdf_stream_t *,
     const cdf_dir_t *, cdf_stream_t *);
@@ -308,7 +312,7 @@ int cdf_print_elapsed_time(char *, size_t, cdf_timestamp_t);
 uint16_t cdf_tole2(uint16_t);
 uint32_t cdf_tole4(uint32_t);
 uint64_t cdf_tole8(uint64_t);
-char *cdf_ctime(const time_t *);
+char *cdf_ctime(const time_t *, char *);
 
 #ifdef CDF_DEBUG
 void cdf_dump_header(const cdf_header_t *);
diff --git a/contrib/file/cdf_time.c b/contrib/file/src/cdf_time.c
similarity index 93%
rename from contrib/file/cdf_time.c
rename to contrib/file/src/cdf_time.c
index 5061b46cd31..1e572de539f 100644
--- a/contrib/file/cdf_time.c
+++ b/contrib/file/src/cdf_time.c
@@ -27,7 +27,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: cdf_time.c,v 1.11 2011/12/13 13:48:41 christos Exp $")
+FILE_RCSID("@(#)$File: cdf_time.c,v 1.15 2014/05/14 23:15:42 christos Exp $")
 #endif
 
 #include 
@@ -117,7 +117,7 @@ cdf_timestamp_to_timespec(struct timespec *ts, cdf_timestamp_t t)
 	tm.tm_hour = (int)(t % 24);
 	t /= 24;
 
-	// XXX: Approx
+	/* XXX: Approx */
 	tm.tm_year = (int)(CDF_BASE_YEAR + (t / 365));
 
 	rdays = cdf_getdays(tm.tm_year);
@@ -166,29 +166,29 @@ cdf_timespec_to_timestamp(cdf_timestamp_t *t, const struct timespec *ts)
 }
 
 char *
-cdf_ctime(const time_t *sec)
+cdf_ctime(const time_t *sec, char *buf)
 {
-	static char ctbuf[26];
-	char *ptr = ctime(sec);
+	char *ptr = ctime_r(sec, buf);
 	if (ptr != NULL)
-		return ptr;
-	(void)snprintf(ctbuf, sizeof(ctbuf), "*Bad* 0x%16.16llx\n",
+		return buf;
+	(void)snprintf(buf, 26, "*Bad* 0x%16.16" INT64_T_FORMAT "x\n",
 	    (long long)*sec);
-	return ctbuf;
+	return buf;
 }
 
 
-#ifdef TEST
+#ifdef TEST_TIME
 int
 main(int argc, char *argv[])
 {
 	struct timespec ts;
+	char buf[25];
 	static const cdf_timestamp_t tst = 0x01A5E403C2D59C00ULL;
 	static const char *ref = "Sat Apr 23 01:30:00 1977";
 	char *p, *q;
 
 	cdf_timestamp_to_timespec(&ts, tst);
-	p = cdf_ctime(&ts.tv_sec);
+	p = cdf_ctime(&ts.tv_sec, buf);
 	if ((q = strchr(p, '\n')) != NULL)
 		*q = '\0';
 	if (strcmp(ref, p) != 0)
diff --git a/contrib/file/compress.c b/contrib/file/src/compress.c
similarity index 94%
rename from contrib/file/compress.c
rename to contrib/file/src/compress.c
index 2d8d77f2cb3..45251b1d40c 100644
--- a/contrib/file/compress.c
+++ b/contrib/file/src/compress.c
@@ -35,7 +35,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: compress.c,v 1.68 2011/12/08 12:38:24 rrt Exp $")
+FILE_RCSID("@(#)$File: compress.c,v 1.73 2014/01/05 15:55:21 christos Exp $")
 #endif
 
 #include "magic.h"
@@ -80,6 +80,7 @@ private const struct {
 	{ "LZIP",     4, { "lzip", "-cdq", NULL }, 1 },
  	{ "\3757zXZ\0",6,{ "xz", "-cd", NULL }, 1 },		/* XZ Utils */
  	{ "LRZI",     4, { "lrzip", "-dqo-", NULL }, 1 },	/* LRZIP */
+ 	{ "\004\"M\030", 4, { "lz4", "-cd", NULL }, 1 },	/* LZ4 */
 };
 
 #define NODATA ((size_t)~0)
@@ -121,14 +122,12 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
 				if (file_printf(ms, mime ?
 				    " compressed-encoding=" : " (") == -1)
 					goto error;
+				if (file_buffer(ms, -1, NULL, buf, nbytes) == -1)
+					goto error;
+				if (!mime && file_printf(ms, ")") == -1)
+					goto error;
 			}
 
-			if ((mime == 0 || mime & MAGIC_MIME_ENCODING) &&
-			    file_buffer(ms, -1, NULL, buf, nbytes) == -1)
-				goto error;
-
-			if (!mime && file_printf(ms, ")") == -1)
-				goto error;
 			rv = 1;
 			break;
 		}
@@ -168,12 +167,9 @@ swrite(int fd, const void *buf, size_t n)
  * `safe' read for sockets and pipes.
  */
 protected ssize_t
-sread(int fd, void *buf, size_t n, int canbepipe __attribute__ ((unused)))
+sread(int fd, void *buf, size_t n, int canbepipe __attribute__((__unused__)))
 {
 	ssize_t rv;
-#ifdef FD_ZERO
-	ssize_t cnt;
-#endif
 #ifdef FIONREAD
 	int t = 0;
 #endif
@@ -183,8 +179,9 @@ sread(int fd, void *buf, size_t n, int canbepipe __attribute__ ((unused)))
 		goto nocheck;
 
 #ifdef FIONREAD
-	if ((canbepipe && (ioctl(fd, FIONREAD, &t) == -1)) || (t == 0)) {
+	if (canbepipe && (ioctl(fd, FIONREAD, &t) == -1 || t == 0)) {
 #ifdef FD_ZERO
+		ssize_t cnt;
 		for (cnt = 0;; cnt++) {
 			fd_set check;
 			struct timeval tout = {0, 100 * 1000};
@@ -241,9 +238,6 @@ file_pipe2file(struct magic_set *ms, int fd, const void *startbuf,
 	char buf[4096];
 	ssize_t r;
 	int tfd;
-#ifdef HAVE_MKSTEMP
-	int te;
-#endif
 
 	(void)strlcpy(buf, "/tmp/file.XXXXXX", sizeof buf);
 #ifndef HAVE_MKSTEMP
@@ -255,10 +249,13 @@ file_pipe2file(struct magic_set *ms, int fd, const void *startbuf,
 		errno = r;
 	}
 #else
-	tfd = mkstemp(buf);
-	te = errno;
-	(void)unlink(buf);
-	errno = te;
+	{
+		int te;
+		tfd = mkstemp(buf);
+		te = errno;
+		(void)unlink(buf);
+		errno = te;
+	}
 #endif
 	if (tfd == -1) {
 		file_error(ms, errno,
@@ -399,16 +396,19 @@ uncompressbuf(struct magic_set *ms, int fd, size_t method,
 	case 0:	/* child */
 		(void) close(0);
 		if (fd != -1) {
-		    (void) dup(fd);
+		    if (dup(fd) == -1)
+			_exit(1);
 		    (void) lseek(0, (off_t)0, SEEK_SET);
 		} else {
-		    (void) dup(fdin[0]);
+		    if (dup(fdin[0]) == -1)
+			_exit(1);
 		    (void) close(fdin[0]);
 		    (void) close(fdin[1]);
 		}
 
 		(void) close(1);
-		(void) dup(fdout[1]);
+		if (dup(fdout[1]) == -1)
+			_exit(1);
 		(void) close(fdout[0]);
 		(void) close(fdout[1]);
 #ifndef DEBUG
diff --git a/contrib/file/src/ctime_r.c b/contrib/file/src/ctime_r.c
new file mode 100644
index 00000000000..ca7ad2fc913
--- /dev/null
+++ b/contrib/file/src/ctime_r.c
@@ -0,0 +1,19 @@
+/*	$File: ctime_r.c,v 1.1 2012/05/15 17:14:36 christos Exp $	*/
+
+#include "file.h"
+#ifndef	lint
+FILE_RCSID("@(#)$File: ctime_r.c,v 1.1 2012/05/15 17:14:36 christos Exp $")
+#endif	/* lint */
+#include 
+#include 
+
+/* ctime_r is not thread-safe anyway */
+char *
+ctime_r(const time_t *t, char *dst)
+{
+	char *p = ctime(t);
+	if (p == NULL)
+		return NULL;
+	memcpy(dst, p, 26);
+	return dst;
+}
diff --git a/contrib/file/elfclass.h b/contrib/file/src/elfclass.h
similarity index 95%
rename from contrib/file/elfclass.h
rename to contrib/file/src/elfclass.h
index 2e7741b3fc0..010958a4296 100644
--- a/contrib/file/elfclass.h
+++ b/contrib/file/src/elfclass.h
@@ -59,7 +59,8 @@
 		    (off_t)elf_getu(swap, elfhdr.e_shoff),
 		    elf_getu16(swap, elfhdr.e_shnum),
 		    (size_t)elf_getu16(swap, elfhdr.e_shentsize),
-		    fsize, &flags, elf_getu16(swap, elfhdr.e_machine)) == -1)
+		    fsize, &flags, elf_getu16(swap, elfhdr.e_machine),
+		    (int)elf_getu16(swap, elfhdr.e_shstrndx)) == -1)
 			return -1;
 		break;
 
diff --git a/contrib/file/encoding.c b/contrib/file/src/encoding.c
similarity index 99%
rename from contrib/file/encoding.c
rename to contrib/file/src/encoding.c
index dee57a6e8f5..b75e0ccb7ff 100644
--- a/contrib/file/encoding.c
+++ b/contrib/file/src/encoding.c
@@ -35,7 +35,7 @@
 #include "file.h"
 
 #ifndef	lint
-FILE_RCSID("@(#)$File: encoding.c,v 1.7 2012/01/24 19:02:02 christos Exp $")
+FILE_RCSID("@(#)$File: encoding.c,v 1.9 2013/11/19 20:45:50 christos Exp $")
 #endif	/* lint */
 
 #include "magic.h"
@@ -72,13 +72,17 @@ file_encoding(struct magic_set *ms, const unsigned char *buf, size_t nbytes, uni
 	unsigned char *nbuf = NULL;
 
 	*type = "text";
-	mlen = (nbytes + 1) * sizeof(nbuf[0]);
-	if ((nbuf = CAST(unsigned char *, calloc((size_t)1, mlen))) == NULL) {
+	*ulen = 0;
+	*code = "unknown";
+	*code_mime = "binary";
+
+	mlen = (nbytes + 1) * sizeof((*ubuf)[0]);
+	if ((*ubuf = CAST(unichar *, calloc((size_t)1, mlen))) == NULL) {
 		file_oomem(ms, mlen);
 		goto done;
 	}
-	mlen = (nbytes + 1) * sizeof((*ubuf)[0]);
-	if ((*ubuf = CAST(unichar *, calloc((size_t)1, mlen))) == NULL) {
+	mlen = (nbytes + 1) * sizeof(nbuf[0]);
+	if ((nbuf = CAST(unsigned char *, calloc((size_t)1, mlen))) == NULL) {
 		file_oomem(ms, mlen);
 		goto done;
 	}
diff --git a/contrib/file/file.c b/contrib/file/src/file.c
similarity index 89%
rename from contrib/file/file.c
rename to contrib/file/src/file.c
index 408ec6389ab..370da91462e 100644
--- a/contrib/file/file.c
+++ b/contrib/file/src/file.c
@@ -32,7 +32,7 @@
 #include "file.h"
 
 #ifndef	lint
-FILE_RCSID("@(#)$File: file.c,v 1.145 2011/12/08 12:12:46 rrt Exp $")
+FILE_RCSID("@(#)$File: file.c,v 1.153 2014/02/11 15:41:04 christos Exp $")
 #endif	/* lint */
 
 #include "magic.h"
@@ -71,9 +71,9 @@ int getopt_long(int argc, char * const *argv, const char *optstring, const struc
 #endif
 
 #ifdef S_IFLNK
-#define FILE_FLAGS "-bchikLlNnprsvz0"
+#define FILE_FLAGS "-bcEhikLlNnprsvz0"
 #else
-#define FILE_FLAGS "-bciklNnprsvz0"
+#define FILE_FLAGS "-bcEiklNnprsvz0"
 #endif
 
 # define USAGE  \
@@ -101,7 +101,7 @@ private const struct option long_options[] = {
 #undef OPT_LONGONLY
     {0, 0, NULL, 0}
 };
-#define OPTSTRING	"bcCde:f:F:hiklLm:nNprsvz0"
+#define OPTSTRING	"bcCde:Ef:F:hiklLm:nNprsvz0"
 
 private const struct {
 	const char *name;
@@ -122,8 +122,8 @@ private const struct {
 private char *progname;		/* used throughout 		*/
 
 private void usage(void);
+private void docprint(const char *);
 private void help(void);
-int main(int, char *[]);
 
 private int unwrap(struct magic_set *, const char *);
 private int process(struct magic_set *ms, const char *, int);
@@ -194,6 +194,9 @@ main(int argc, char *argv[])
 		case 'd':
 			flags |= MAGIC_DEBUG|MAGIC_CHECK;
 			break;
+		case 'E':
+			flags |= MAGIC_ERROR;
+			break;
 		case 'e':
 			for (i = 0; i < sizeof(nv) / sizeof(nv[0]); i++)
 				if (strcmp(nv[i].name, optarg) == 0)
@@ -252,7 +255,7 @@ main(int argc, char *argv[])
 			(void)fprintf(stdout, "%s-%s\n", progname, VERSION);
 			(void)fprintf(stdout, "magic file from %s\n",
 				       magicfile);
-			return 1;
+			return 0;
 		case 'z':
 			flags |= MAGIC_COMPRESS;
 			break;
@@ -276,6 +279,11 @@ main(int argc, char *argv[])
 	if (e)
 		return e;
 
+	if (MAGIC_VERSION != magic_version())
+		(void)fprintf(stderr, "%s: compiled magic version [%d] "
+		    "does not match with shared library magic version [%d]\n",
+		    progname, MAGIC_VERSION, magic_version());
+
 	switch(action) {
 	case FILE_CHECK:
 	case FILE_COMPILE:
@@ -437,7 +445,7 @@ process(struct magic_set *ms, const char *inname, int wid)
 	}
 }
 
-size_t
+protected size_t
 file_mbswidth(const char *s)
 {
 #if defined(HAVE_WCHAR_H) && defined(HAVE_MBRTOWC) && defined(HAVE_WCWIDTH)
@@ -460,8 +468,11 @@ file_mbswidth(const char *s)
 			 * is always right
 			 */
 			width++;
-		} else
-			width += wcwidth(nextchar);
+		} else {
+			int w = wcwidth(nextchar);
+			if (w > 0)
+				width += w;
+		}
 
 		s += bytesconsumed, n -= bytesconsumed;
 	}
@@ -478,6 +489,36 @@ usage(void)
 	exit(1);
 }
 
+private void
+docprint(const char *opts)
+{
+	size_t i;
+	int comma;
+	char *sp, *p;
+
+	p = strstr(opts, "%o");
+	if (p == NULL) {
+		fprintf(stdout, "%s", opts);
+		return;
+	}
+
+	for (sp = p - 1; sp > opts && *sp == ' '; sp--)
+		continue;
+
+	fprintf(stdout, "%.*s", (int)(p - opts), opts);
+
+	comma = 0;
+	for (i = 0; i < __arraycount(nv); i++) {
+		fprintf(stdout, "%s%s", comma++ ? ", " : "", nv[i].name);
+		if (i && i % 5 == 0) {
+			fprintf(stdout, ",\n%*s", (int)(p - sp - 1), "");
+			comma = 0;
+		}
+	}
+
+	fprintf(stdout, "%s", opts + (p - opts) + 2);
+}
+
 private void
 help(void)
 {
@@ -486,9 +527,11 @@ help(void)
 "Determine type of FILEs.\n"
 "\n", stdout);
 #define OPT(shortname, longname, opt, doc)      \
-	fprintf(stdout, "  -%c, --" longname doc, shortname);
+	fprintf(stdout, "  -%c, --" longname, shortname), \
+	docprint(doc);
 #define OPT_LONGONLY(longname, opt, doc)        \
-	fprintf(stdout, "      --" longname doc);
+	fprintf(stdout, "      --" longname),	\
+	docprint(doc);
 #include "file_opts.h"
 #undef OPT
 #undef OPT_LONGONLY
diff --git a/contrib/file/file.h b/contrib/file/src/file.h
similarity index 84%
rename from contrib/file/file.h
rename to contrib/file/src/file.h
index 175f6596646..67a25680cd2 100644
--- a/contrib/file/file.h
+++ b/contrib/file/src/file.h
@@ -27,7 +27,7 @@
  */
 /*
  * file.h - definitions for file(1) program
- * @(#)$File: file.h,v 1.135 2011/09/20 15:30:14 christos Exp $
+ * @(#)$File: file.h,v 1.152 2014/06/03 19:01:34 christos Exp $
  */
 
 #ifndef __file_h__
@@ -62,6 +62,7 @@
 #include 
 #endif
 #include 
+#include 
 #include 
 #include 
 /* Do this here and now, because struct stat gets re-defined on solaris */
@@ -81,10 +82,18 @@
 #endif
 
 #define private static
+
+#if HAVE_VISIBILITY && !defined(WIN32)
+#define public  __attribute__ ((__visibility__("default")))
+#ifndef protected
+#define protected __attribute__ ((__visibility__("hidden")))
+#endif
+#else
+#define public
 #ifndef protected
 #define protected
 #endif
-#define public
+#endif
 
 #ifndef __arraycount
 #define __arraycount(a) (sizeof(a) / sizeof(a[0]))
@@ -119,12 +128,13 @@
 #endif
 #define MAXMAGIS 8192		/* max entries in any one magic file
 				   or directory */
-#define MAXDESC	64		/* max leng of text description/MIME type */
-#define MAXstring 64		/* max leng of "string" types */
+#define MAXDESC	64		/* max len of text description/MIME type */
+#define MAXMIME	80		/* max len of text MIME type */
+#define MAXstring 64		/* max len of "string" types */
 
 #define MAGICNO		0xF11E041C
-#define VERSIONNO	8
-#define FILE_MAGICSIZE	232
+#define VERSIONNO	12
+#define FILE_MAGICSIZE	248
 
 #define	FILE_LOAD	0
 #define FILE_CHECK	1
@@ -207,7 +217,13 @@ struct magic {
 #define				FILE_BEID3	39
 #define				FILE_LEID3	40
 #define				FILE_INDIRECT	41
-#define				FILE_NAMES_SIZE	42/* size of array to contain all names */
+#define				FILE_QWDATE	42
+#define				FILE_LEQWDATE	43
+#define				FILE_BEQWDATE	44
+#define				FILE_NAME	45
+#define				FILE_USE	46
+#define				FILE_CLEAR	47
+#define				FILE_NAMES_SIZE	48 /* size of array to contain all names */
 
 #define IS_STRING(t) \
 	((t) == FILE_STRING || \
@@ -216,7 +232,8 @@ struct magic {
 	 (t) == FILE_LESTRING16 || \
 	 (t) == FILE_REGEX || \
 	 (t) == FILE_SEARCH || \
-	 (t) == FILE_DEFAULT)
+	 (t) == FILE_NAME || \
+	 (t) == FILE_USE)
 
 #define FILE_FMT_NONE 0
 #define FILE_FMT_NUM  1 /* "cduxXi" */
@@ -284,9 +301,9 @@ struct magic {
 	union VALUETYPE value;	/* either number or string */
 	/* Words 17-32 */
 	char desc[MAXDESC];	/* description */
-	/* Words 33-48 */
-	char mimetype[MAXDESC]; /* MIME type */
-	/* Words 49-50 */
+	/* Words 33-52 */
+	char mimetype[MAXMIME]; /* MIME type */
+	/* Words 53-54 */
 	char apple[8];
 };
 
@@ -304,15 +321,18 @@ struct magic {
 #define PSTRING_2_LE				BIT(9)
 #define PSTRING_4_BE				BIT(10)
 #define PSTRING_4_LE				BIT(11)
+#define REGEX_LINE_COUNT			BIT(11)
 #define PSTRING_LEN	\
     (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
 #define PSTRING_LENGTH_INCLUDES_ITSELF		BIT(12)
+#define	STRING_TRIM				BIT(13)
 #define CHAR_COMPACT_WHITESPACE			'W'
 #define CHAR_COMPACT_OPTIONAL_WHITESPACE	'w'
 #define CHAR_IGNORE_LOWERCASE			'c'
 #define CHAR_IGNORE_UPPERCASE			'C'
 #define CHAR_REGEX_OFFSET_START			's'
 #define CHAR_TEXTTEST				't'
+#define	CHAR_TRIM				'T'
 #define CHAR_BINTEST				'b'
 #define CHAR_PSTRING_1_BE			'B'
 #define CHAR_PSTRING_1_LE			'B'
@@ -328,10 +348,8 @@ struct magic {
 /* list of magic entries */
 struct mlist {
 	struct magic *magic;		/* array of magic entries */
-	uint32_t nmagic;			/* number of entries in array */
-	int mapped;  /* allocation type: 0 => apprentice_file
-		      *                  1 => apprentice_map + malloc
-		      *                  2 => apprentice_map + mmap */
+	uint32_t nmagic;		/* number of entries in array */
+	void *map;			/* internal resources used by entry */
 	struct mlist *next, *prev;
 };
 
@@ -351,8 +369,11 @@ struct level_info {
 	int last_cond;	/* used for error checking by parse() */
 #endif
 };
+
+#define MAGIC_SETS	2
+
 struct magic_set {
-	struct mlist *mlist;
+	struct mlist *mlist[MAGIC_SETS];	/* list of regular entries */
 	struct cont {
 		size_t len;
 		struct level_info *li;
@@ -386,12 +407,17 @@ struct magic_set {
 typedef unsigned long unichar;
 
 struct stat;
-protected const char *file_fmttime(uint32_t, int);
+#define FILE_T_LOCAL	1
+#define FILE_T_WINDOWS	2
+protected const char *file_fmttime(uint64_t, int, char *);
+protected struct magic_set *file_ms_alloc(int);
+protected void file_ms_free(struct magic_set *);
 protected int file_buffer(struct magic_set *, int, const char *, const void *,
     size_t);
 protected int file_fsmagic(struct magic_set *, const char *, struct stat *);
 protected int file_pipe2file(struct magic_set *, int, const void *, size_t);
-protected int file_vprintf(struct magic_set *, const char *, va_list);
+protected int file_vprintf(struct magic_set *, const char *, va_list)
+    __attribute__((__format__(__printf__, 2, 0)));
 protected size_t file_printedlen(const struct magic_set *);
 protected int file_replace(struct magic_set *, const char *, const char *);
 protected int file_printf(struct magic_set *, const char *, ...)
@@ -414,11 +440,11 @@ protected int file_encoding(struct magic_set *, const unsigned char *, size_t,
     unichar **, size_t *, const char **, const char **, const char **);
 protected int file_is_tar(struct magic_set *, const unsigned char *, size_t);
 protected int file_softmagic(struct magic_set *, const unsigned char *, size_t,
-    int, int);
-protected struct mlist *file_apprentice(struct magic_set *, const char *, int);
+    size_t, int, int);
+protected int file_apprentice(struct magic_set *, const char *, int);
+protected int file_magicfind(struct magic_set *, const char *, struct mlist *);
 protected uint64_t file_signextend(struct magic_set *, struct magic *,
     uint64_t);
-protected void file_delmagic(struct magic *, int type, size_t entries);
 protected void file_badread(struct magic_set *);
 protected void file_badseek(struct magic_set *);
 protected void file_oomem(struct magic_set *, size_t);
@@ -443,6 +469,18 @@ protected int file_os2_apptype(struct magic_set *, const char *, const void *,
     size_t);
 #endif /* __EMX__ */
 
+typedef struct {
+	const char *pat;
+	char *old_lc_ctype;
+	int rc;
+	regex_t rx;
+} file_regex_t;
+
+protected int file_regcomp(file_regex_t *, const char *, int);
+protected int file_regexec(file_regex_t *, const char *, size_t, regmatch_t *,
+    int);
+protected void file_regfree(file_regex_t *);
+protected void file_regerror(file_regex_t *, int, struct magic_set *);
 
 #ifndef COMPILE_ONLY
 extern const char *file_names[];
@@ -460,22 +498,38 @@ extern char *sys_errlist[];
 #define strtoul(a, b, c)	strtol(a, b, c)
 #endif
 
+#ifndef HAVE_PREAD
+ssize_t pread(int, void *, size_t, off_t);
+#endif
 #ifndef HAVE_VASPRINTF
 int vasprintf(char **, const char *, va_list);
 #endif
 #ifndef HAVE_ASPRINTF
-int asprintf(char **ptr, const char *format_string, ...);
+int asprintf(char **, const char *, ...);
 #endif
 
 #ifndef HAVE_STRLCPY
-size_t strlcpy(char *dst, const char *src, size_t siz);
+size_t strlcpy(char *, const char *, size_t);
 #endif
 #ifndef HAVE_STRLCAT
-size_t strlcat(char *dst, const char *src, size_t siz);
+size_t strlcat(char *, const char *, size_t);
+#endif
+#ifndef HAVE_STRCASESTR
+char *strcasestr(const char *, const char *);
 #endif
 #ifndef HAVE_GETLINE
-ssize_t getline(char **dst, size_t *len, FILE *fp);
-ssize_t getdelim(char **dst, size_t *len, int delimiter, FILE *fp);
+ssize_t getline(char **, size_t *, FILE *);
+ssize_t getdelim(char **, size_t *, int, FILE *);
+#endif
+#ifndef HAVE_CTIME_R
+char   *ctime_r(const time_t *, char *);
+#endif
+#ifndef HAVE_ASCTIME_R
+char   *asctime_r(const struct tm *, char *);
+#endif
+#ifndef HAVE_FMTCHECK
+const char *fmtcheck(const char *, const char *) 
+     __attribute__((__format_arg__(2)));
 #endif
 
 #if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H) && !defined(QUICK)
diff --git a/contrib/file/file_opts.h b/contrib/file/src/file_opts.h
similarity index 96%
rename from contrib/file/file_opts.h
rename to contrib/file/src/file_opts.h
index 8a176721f63..db34eb732b0 100644
--- a/contrib/file/file_opts.h
+++ b/contrib/file/src/file_opts.h
@@ -23,7 +23,7 @@ OPT('c', "checking-printout", 0, "    print the parsed form of the magic file, u
     "                               before installing it\n")
 OPT('e', "exclude", 1, " TEST         exclude TEST from the list of test to be\n"
     "                               performed for file. Valid tests are:\n"
-    "                               ascii, apptype, compress, elf, soft, tar, tokens, troff\n")
+    "                               %o\n")
 OPT('f', "files-from", 1, " FILE      read the filenames to be examined from FILE\n")
 OPT('F', "separator", 1, " STRING     use string as separator instead of `:'\n")
 OPT('i', "mime", 0, "                 output MIME type strings (--mime-type and\n"
@@ -32,8 +32,8 @@ OPT_LONGONLY("apple", 0, "                output the Apple CREATOR/TYPE\n")
 OPT_LONGONLY("mime-type", 0, "            output the MIME type\n")
 OPT_LONGONLY("mime-encoding", 0, "        output the MIME encoding\n")
 OPT('k', "keep-going", 0, "           don't stop at the first match\n")
-#ifdef S_IFLNK
 OPT('l', "list", 0, "                 list magic strength\n")
+#ifdef S_IFLNK
 OPT('L', "dereference", 0, "          follow symlinks (default)\n")
 OPT('h', "no-dereference", 0, "       don't follow symlinks\n")
 #endif
diff --git a/contrib/file/src/fmtcheck.c b/contrib/file/src/fmtcheck.c
new file mode 100644
index 00000000000..0fc70387199
--- /dev/null
+++ b/contrib/file/src/fmtcheck.c
@@ -0,0 +1,234 @@
+/*	$NetBSD: fmtcheck.c,v 1.8 2008/04/28 20:22:59 martin Exp $	*/
+
+/*-
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code was contributed to The NetBSD Foundation by Allen Briggs.
+ *
+ * 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.
+ */
+
+#include "file.h"
+
+#include 
+#include 
+#include 
+
+enum __e_fmtcheck_types {
+	FMTCHECK_START,
+	FMTCHECK_SHORT,
+	FMTCHECK_INT,
+	FMTCHECK_LONG,
+	FMTCHECK_QUAD,
+	FMTCHECK_SHORTPOINTER,
+	FMTCHECK_INTPOINTER,
+	FMTCHECK_LONGPOINTER,
+	FMTCHECK_QUADPOINTER,
+	FMTCHECK_DOUBLE,
+	FMTCHECK_LONGDOUBLE,
+	FMTCHECK_STRING,
+	FMTCHECK_WIDTH,
+	FMTCHECK_PRECISION,
+	FMTCHECK_DONE,
+	FMTCHECK_UNKNOWN
+};
+typedef enum __e_fmtcheck_types EFT;
+
+#define RETURN(pf,f,r) do { \
+			*(pf) = (f); \
+			return r; \
+		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
+
+static EFT
+get_next_format_from_precision(const char **pf)
+{
+	int		sh, lg, quad, longdouble;
+	const char	*f;
+
+	sh = lg = quad = longdouble = 0;
+
+	f = *pf;
+	switch (*f) {
+	case 'h':
+		f++;
+		sh = 1;
+		break;
+	case 'l':
+		f++;
+		if (!*f) RETURN(pf,f,FMTCHECK_UNKNOWN);
+		if (*f == 'l') {
+			f++;
+			quad = 1;
+		} else {
+			lg = 1;
+		}
+		break;
+	case 'q':
+		f++;
+		quad = 1;
+		break;
+	case 'L':
+		f++;
+		longdouble = 1;
+		break;
+	default:
+		break;
+	}
+	if (!*f) RETURN(pf,f,FMTCHECK_UNKNOWN);
+	if (strchr("diouxX", *f)) {
+		if (longdouble)
+			RETURN(pf,f,FMTCHECK_UNKNOWN);
+		if (lg)
+			RETURN(pf,f,FMTCHECK_LONG);
+		if (quad)
+			RETURN(pf,f,FMTCHECK_QUAD);
+		RETURN(pf,f,FMTCHECK_INT);
+	}
+	if (*f == 'n') {
+		if (longdouble)
+			RETURN(pf,f,FMTCHECK_UNKNOWN);
+		if (sh)
+			RETURN(pf,f,FMTCHECK_SHORTPOINTER);
+		if (lg)
+			RETURN(pf,f,FMTCHECK_LONGPOINTER);
+		if (quad)
+			RETURN(pf,f,FMTCHECK_QUADPOINTER);
+		RETURN(pf,f,FMTCHECK_INTPOINTER);
+	}
+	if (strchr("DOU", *f)) {
+		if (sh + lg + quad + longdouble)
+			RETURN(pf,f,FMTCHECK_UNKNOWN);
+		RETURN(pf,f,FMTCHECK_LONG);
+	}
+	if (strchr("eEfg", *f)) {
+		if (longdouble)
+			RETURN(pf,f,FMTCHECK_LONGDOUBLE);
+		if (sh + lg + quad)
+			RETURN(pf,f,FMTCHECK_UNKNOWN);
+		RETURN(pf,f,FMTCHECK_DOUBLE);
+	}
+	if (*f == 'c') {
+		if (sh + lg + quad + longdouble)
+			RETURN(pf,f,FMTCHECK_UNKNOWN);
+		RETURN(pf,f,FMTCHECK_INT);
+	}
+	if (*f == 's') {
+		if (sh + lg + quad + longdouble)
+			RETURN(pf,f,FMTCHECK_UNKNOWN);
+		RETURN(pf,f,FMTCHECK_STRING);
+	}
+	if (*f == 'p') {
+		if (sh + lg + quad + longdouble)
+			RETURN(pf,f,FMTCHECK_UNKNOWN);
+		RETURN(pf,f,FMTCHECK_LONG);
+	}
+	RETURN(pf,f,FMTCHECK_UNKNOWN);
+	/*NOTREACHED*/
+}
+
+static EFT
+get_next_format_from_width(const char **pf)
+{
+	const char	*f;
+
+	f = *pf;
+	if (*f == '.') {
+		f++;
+		if (*f == '*') {
+			RETURN(pf,f,FMTCHECK_PRECISION);
+		}
+		/* eat any precision (empty is allowed) */
+		while (isdigit((unsigned char)*f)) f++;
+		if (!*f) RETURN(pf,f,FMTCHECK_UNKNOWN);
+	}
+	RETURN(pf,f,get_next_format_from_precision(pf));
+	/*NOTREACHED*/
+}
+
+static EFT
+get_next_format(const char **pf, EFT eft)
+{
+	int		infmt;
+	const char	*f;
+
+	if (eft == FMTCHECK_WIDTH) {
+		(*pf)++;
+		return get_next_format_from_width(pf);
+	} else if (eft == FMTCHECK_PRECISION) {
+		(*pf)++;
+		return get_next_format_from_precision(pf);
+	}
+
+	f = *pf;
+	infmt = 0;
+	while (!infmt) {
+		f = strchr(f, '%');
+		if (f == NULL)
+			RETURN(pf,f,FMTCHECK_DONE);
+		f++;
+		if (!*f)
+			RETURN(pf,f,FMTCHECK_UNKNOWN);
+		if (*f != '%')
+			infmt = 1;
+		else
+			f++;
+	}
+
+	/* Eat any of the flags */
+	while (*f && (strchr("#0- +", *f)))
+		f++;
+
+	if (*f == '*') {
+		RETURN(pf,f,FMTCHECK_WIDTH);
+	}
+	/* eat any width */
+	while (isdigit((unsigned char)*f)) f++;
+	if (!*f) {
+		RETURN(pf,f,FMTCHECK_UNKNOWN);
+	}
+
+	RETURN(pf,f,get_next_format_from_width(pf));
+	/*NOTREACHED*/
+}
+
+const char *
+fmtcheck(const char *f1, const char *f2)
+{
+	const char	*f1p, *f2p;
+	EFT		f1t, f2t;
+
+	if (!f1) return f2;
+	
+	f1p = f1;
+	f1t = FMTCHECK_START;
+	f2p = f2;
+	f2t = FMTCHECK_START;
+	while ((f1t = get_next_format(&f1p, f1t)) != FMTCHECK_DONE) {
+		if (f1t == FMTCHECK_UNKNOWN)
+			return f2;
+		f2t = get_next_format(&f2p, f2t);
+		if (f1t != f2t)
+			return f2;
+	}
+	return f1;
+}
diff --git a/contrib/file/fsmagic.c b/contrib/file/src/fsmagic.c
similarity index 69%
rename from contrib/file/fsmagic.c
rename to contrib/file/src/fsmagic.c
index 7200271fc69..ef5492f2a10 100644
--- a/contrib/file/fsmagic.c
+++ b/contrib/file/src/fsmagic.c
@@ -32,7 +32,7 @@
 #include "file.h"
 
 #ifndef	lint
-FILE_RCSID("@(#)$File: fsmagic.c,v 1.64 2011/08/14 09:03:12 christos Exp $")
+FILE_RCSID("@(#)$File: fsmagic.c,v 1.73 2014/05/14 23:15:42 christos Exp $")
 #endif	/* lint */
 
 #include "magic.h"
@@ -53,7 +53,11 @@ FILE_RCSID("@(#)$File: fsmagic.c,v 1.64 2011/08/14 09:03:12 christos Exp $")
 #ifdef major			/* Might be defined in sys/types.h.  */
 # define HAVE_MAJOR
 #endif
-  
+#ifdef WIN32
+# define WIN32_LEAN_AND_MEAN
+# include 
+#endif
+
 #ifndef HAVE_MAJOR
 # define major(dev)  (((dev) >> 8) & 0xff)
 # define minor(dev)  ((dev) & 0xff)
@@ -98,7 +102,7 @@ handle_mime(struct magic_set *ms, int mime, const char *str)
 protected int
 file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
 {
-	int ret = 0;
+	int ret, did = 0;
 	int mime = ms->flags & MAGIC_MIME;
 #ifdef	S_IFLNK
 	char buf[BUFSIZ+4];
@@ -111,6 +115,7 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
 	if (fn == NULL)
 		return 0;
 
+#define COMMA	(did++ ? ", " : "")
 	/*
 	 * Fstat is cheaper but fails for files you don't have read perms on.
 	 * On 4.2BSD and similar systems, use lstat() to identify symlinks.
@@ -122,6 +127,35 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
 #endif
 	ret = stat(fn, sb);	/* don't merge into if; see "ret =" above */
 
+#ifdef WIN32
+	{
+		HANDLE hFile = CreateFile(fn, 0, FILE_SHARE_DELETE |
+		    FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0,
+		    NULL);
+		if (hFile != INVALID_HANDLE_VALUE) {
+			/*
+			 * Stat failed, but we can still open it - assume it's
+			 * a block device, if nothing else.
+			 */
+			if (ret) {
+				sb->st_mode = S_IFBLK;
+				ret = 0;
+			}
+			switch (GetFileType(hFile)) {
+			case FILE_TYPE_CHAR:
+				sb->st_mode |= S_IFCHR;
+				sb->st_mode &= ~S_IFREG;
+				break;
+			case FILE_TYPE_PIPE:
+				sb->st_mode |= S_IFIFO;
+				sb->st_mode &= ~S_IFREG;
+				break;
+			}
+			CloseHandle(hFile);
+		}
+	}
+#endif
+
 	if (ret) {
 		if (ms->flags & MAGIC_ERROR) {
 			file_error(ms, errno, "cannot stat `%s'", fn);
@@ -130,24 +164,24 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
 		if (file_printf(ms, "cannot open `%s' (%s)",
 		    fn, strerror(errno)) == -1)
 			return -1;
-		ms->event_flags |= EVENT_HAD_ERR;
-		return -1;
+		return 0;
 	}
 
+	ret = 1;
 	if (!mime) {
 #ifdef S_ISUID
-		if (sb->st_mode & S_ISUID) 
-			if (file_printf(ms, "setuid ") == -1)
+		if (sb->st_mode & S_ISUID)
+			if (file_printf(ms, "%ssetuid", COMMA) == -1)
 				return -1;
 #endif
 #ifdef S_ISGID
 		if (sb->st_mode & S_ISGID) 
-			if (file_printf(ms, "setgid ") == -1)
+			if (file_printf(ms, "%ssetgid", COMMA) == -1)
 				return -1;
 #endif
 #ifdef S_ISVTX
 		if (sb->st_mode & S_ISVTX) 
-			if (file_printf(ms, "sticky ") == -1)
+			if (file_printf(ms, "%ssticky", COMMA) == -1)
 				return -1;
 #endif
 	}
@@ -157,9 +191,9 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
 		if (mime) {
 			if (handle_mime(ms, mime, "directory") == -1)
 				return -1;
-		} else if (file_printf(ms, "directory") == -1)
+		} else if (file_printf(ms, "%sdirectory", COMMA) == -1)
 			return -1;
-		return 1;
+		break;
 #ifdef S_IFCHR
 	case S_IFCHR:
 		/* 
@@ -167,30 +201,32 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
 		 * like ordinary files.  Otherwise, just report that they
 		 * are block special files and go on to the next file.
 		 */
-		if ((ms->flags & MAGIC_DEVICES) != 0)
+		if ((ms->flags & MAGIC_DEVICES) != 0) {
+			ret = 0;
 			break;
+		}
 		if (mime) {
 			if (handle_mime(ms, mime, "chardevice") == -1)
 				return -1;
 		} else {
-#ifdef HAVE_STAT_ST_RDEV
+#ifdef HAVE_STRUCT_STAT_ST_RDEV
 # ifdef dv_unit
-			if (file_printf(ms, "character special (%d/%d/%d)",
-			    major(sb->st_rdev), dv_unit(sb->st_rdev),
+			if (file_printf(ms, "%scharacter special (%d/%d/%d)",
+			    COMMA, major(sb->st_rdev), dv_unit(sb->st_rdev),
 					dv_subunit(sb->st_rdev)) == -1)
 				return -1;
 # else
-			if (file_printf(ms, "character special (%ld/%ld)",
-			    (long)major(sb->st_rdev), (long)minor(sb->st_rdev))
-			    == -1)
+			if (file_printf(ms, "%scharacter special (%ld/%ld)",
+			    COMMA, (long)major(sb->st_rdev),
+			    (long)minor(sb->st_rdev)) == -1)
 				return -1;
 # endif
 #else
-			if (file_printf(ms, "character special") == -1)
+			if (file_printf(ms, "%scharacter special", COMMA) == -1)
 				return -1;
 #endif
 		}
-		return 1;
+		break;
 #endif
 #ifdef S_IFBLK
 	case S_IFBLK:
@@ -199,29 +235,32 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
 		 * like ordinary files.  Otherwise, just report that they
 		 * are block special files and go on to the next file.
 		 */
-		if ((ms->flags & MAGIC_DEVICES) != 0)
+		if ((ms->flags & MAGIC_DEVICES) != 0) {
+			ret = 0;
 			break;
+		}
 		if (mime) {
 			if (handle_mime(ms, mime, "blockdevice") == -1)
 				return -1;
 		} else {
-#ifdef HAVE_STAT_ST_RDEV
+#ifdef HAVE_STRUCT_STAT_ST_RDEV
 # ifdef dv_unit
-			if (file_printf(ms, "block special (%d/%d/%d)",
-					major(sb->st_rdev), dv_unit(sb->st_rdev),
-					dv_subunit(sb->st_rdev)) == -1)
+			if (file_printf(ms, "%sblock special (%d/%d/%d)",
+			    COMMA, major(sb->st_rdev), dv_unit(sb->st_rdev),
+			    dv_subunit(sb->st_rdev)) == -1)
 				return -1;
 # else
-			if (file_printf(ms, "block special (%ld/%ld)",
-					(long)major(sb->st_rdev), (long)minor(sb->st_rdev)) == -1)
+			if (file_printf(ms, "%sblock special (%ld/%ld)",
+			    COMMA, (long)major(sb->st_rdev),
+			    (long)minor(sb->st_rdev)) == -1)
 				return -1;
 # endif
 #else
-			if (file_printf(ms, "block special") == -1)
+			if (file_printf(ms, "%sblock special", COMMA) == -1)
 				return -1;
 #endif
 		}
-		return 1;
+		break;
 #endif
 	/* TODO add code to handle V7 MUX and Blit MUX files */
 #ifdef	S_IFIFO
@@ -231,18 +270,18 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
 		if (mime) {
 			if (handle_mime(ms, mime, "fifo") == -1)
 				return -1;
-		} else if (file_printf(ms, "fifo (named pipe)") == -1)
+		} else if (file_printf(ms, "%sfifo (named pipe)", COMMA) == -1)
 			return -1;
-		return 1;
+		break;
 #endif
 #ifdef	S_IFDOOR
 	case S_IFDOOR:
 		if (mime) {
 			if (handle_mime(ms, mime, "door") == -1)
 				return -1;
-		} else if (file_printf(ms, "door") == -1)
+		} else if (file_printf(ms, "%sdoor", COMMA) == -1)
 			return -1;
-		return 1;
+		break;
 #endif
 #ifdef	S_IFLNK
 	case S_IFLNK:
@@ -256,10 +295,10 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
 				if (handle_mime(ms, mime, "symlink") == -1)
 					return -1;
 			} else if (file_printf(ms,
-			    "unreadable symlink `%s' (%s)", fn,
+			    "%sunreadable symlink `%s' (%s)", COMMA, fn,
 			    strerror(errno)) == -1)
 				return -1;
-			return 1;
+			break;
 		}
 		buf[nch] = '\0';	/* readlink(2) does not do this */
 
@@ -285,9 +324,10 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
 						    "x-path-too-long") == -1)
 							return -1;
 					} else if (file_printf(ms,
-					    "path too long: `%s'", fn) == -1)
+					    "%spath too long: `%s'", COMMA,
+					    fn) == -1)
 						return -1;
-					return 1;
+					break;
 				}
 				/* take dir part */
 				(void)strlcpy(buf2, fn, sizeof buf2);
@@ -306,16 +346,17 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
 			ms->flags &= MAGIC_SYMLINK;
 			p = magic_file(ms, buf);
 			ms->flags |= MAGIC_SYMLINK;
-			return p != NULL ? 1 : -1;
+			if (p == NULL)
+				return -1;
 		} else { /* just print what it points to */
 			if (mime) {
 				if (handle_mime(ms, mime, "symlink") == -1)
 					return -1;
-			} else if (file_printf(ms, "symbolic link to `%s'",
-			    buf) == -1)
+			} else if (file_printf(ms, "%ssymbolic link to `%s'",
+			    COMMA, buf) == -1)
 				return -1;
 		}
-		return 1;
+		break;
 #endif
 #ifdef	S_IFSOCK
 #ifndef __COHERENT__
@@ -323,38 +364,44 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
 		if (mime) {
 			if (handle_mime(ms, mime, "socket") == -1)
 				return -1;
-		} else if (file_printf(ms, "socket") == -1)
+		} else if (file_printf(ms, "%ssocket", COMMA) == -1)
 			return -1;
-		return 1;
+		break;
 #endif
 #endif
 	case S_IFREG:
+		/*
+		 * regular file, check next possibility
+		 *
+		 * If stat() tells us the file has zero length, report here that
+		 * the file is empty, so we can skip all the work of opening and
+		 * reading the file.
+		 * But if the -s option has been given, we skip this
+		 * optimization, since on some systems, stat() reports zero
+		 * size for raw disk partitions. (If the block special device
+		 * really has zero length, the fact that it is empty will be
+		 * detected and reported correctly when we read the file.)
+		 */
+		if ((ms->flags & MAGIC_DEVICES) == 0 && sb->st_size == 0) {
+			if (mime) {
+				if (handle_mime(ms, mime, "x-empty") == -1)
+					return -1;
+			} else if (file_printf(ms, "%sempty", COMMA) == -1)
+				return -1;
+			break;
+		}
+		ret = 0;
 		break;
+
 	default:
 		file_error(ms, 0, "invalid mode 0%o", sb->st_mode);
 		return -1;
 		/*NOTREACHED*/
 	}
 
-	/*
-	 * regular file, check next possibility
-	 *
-	 * If stat() tells us the file has zero length, report here that
-	 * the file is empty, so we can skip all the work of opening and 
-	 * reading the file.
-	 * But if the -s option has been given, we skip this optimization,
-	 * since on some systems, stat() reports zero size for raw disk
-	 * partitions.  (If the block special device really has zero length,
-	 * the fact that it is empty will be detected and reported correctly
-	 * when we read the file.)
-	 */
-	if ((ms->flags & MAGIC_DEVICES) == 0 && sb->st_size == 0) {
-		if (mime) {
-			if (handle_mime(ms, mime, "x-empty") == -1)
-				return -1;
-		} else if (file_printf(ms, "empty") == -1)
-			return -1;
-		return 1;
+	if (!mime && did && ret == 0) {
+	    if (file_printf(ms, " ") == -1)
+		    return -1;
 	}
-	return 0;
+	return ret;
 }
diff --git a/contrib/file/funcs.c b/contrib/file/src/funcs.c
similarity index 83%
rename from contrib/file/funcs.c
rename to contrib/file/src/funcs.c
index 0b2a3d0ca37..3a2f67c4dab 100644
--- a/contrib/file/funcs.c
+++ b/contrib/file/src/funcs.c
@@ -27,10 +27,11 @@
 #include "file.h"
 
 #ifndef	lint
-FILE_RCSID("@(#)$File: funcs.c,v 1.60 2011/12/08 12:38:24 rrt Exp $")
+FILE_RCSID("@(#)$File: funcs.c,v 1.72 2014/05/14 23:15:42 christos Exp $")
 #endif	/* lint */
 
 #include "magic.h"
+#include 
 #include 
 #include 
 #include 
@@ -44,6 +45,9 @@ FILE_RCSID("@(#)$File: funcs.c,v 1.60 2011/12/08 12:38:24 rrt Exp $")
 #if defined(HAVE_LIMITS_H)
 #include 
 #endif
+#if defined(HAVE_LOCALE_H)
+#include 
+#endif
 
 #ifndef SIZE_MAX
 #define SIZE_MAX	((size_t)~0)
@@ -58,6 +62,8 @@ file_vprintf(struct magic_set *ms, const char *fmt, va_list ap)
 	int len;
 	char *buf, *newstr;
 
+	if (ms->event_flags & EVENT_HAD_ERR)
+		return 0;
 	len = vasprintf(&buf, fmt, ap);
 	if (len < 0)
 		goto out;
@@ -93,6 +99,7 @@ file_printf(struct magic_set *ms, const char *fmt, ...)
  * error - print best error message possible
  */
 /*VARARGS*/
+__attribute__((__format__(__printf__, 3, 0)))
 private void
 file_error_core(struct magic_set *ms, int error, const char *f, va_list va,
     size_t lineno)
@@ -166,27 +173,22 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((unu
 	size_t ulen;
 	const char *code = NULL;
 	const char *code_mime = "binary";
-	const char *type = NULL;
-
-
+	const char *type = "application/octet-stream";
+	const char *def = "data";
+	const char *ftype = NULL;
 
 	if (nb == 0) {
-		if ((!mime || (mime & MAGIC_MIME_TYPE)) &&
-		    file_printf(ms, mime ? "application/x-empty" :
-		    "empty") == -1)
-			return -1;
-		return 1;
+		def = "empty";
+		type = "application/x-empty";
+		goto simple;
 	} else if (nb == 1) {
-		if ((!mime || (mime & MAGIC_MIME_TYPE)) &&
-		    file_printf(ms, mime ? "application/octet-stream" :
-		    "very short file (no magic)") == -1)
-			return -1;
-		return 1;
+		def = "very short file (no magic)";
+		goto simple;
 	}
 
 	if ((ms->flags & MAGIC_NO_CHECK_ENCODING) == 0) {
 		looks_text = file_encoding(ms, ubuf, nb, &u8buf, &ulen,
-		    &code, &code_mime, &type);
+		    &code, &code_mime, &ftype);
 	}
 
 #ifdef __EMX__
@@ -207,7 +209,7 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((unu
 		if ((m = file_zmagic(ms, fd, inname, ubuf, nb)) != 0) {
 			if ((ms->flags & MAGIC_DEBUG) != 0)
 				(void)fprintf(stderr, "zmagic %d\n", m);
-			goto done;
+			goto done_encoding;
 		}
 #endif
 	/* Check if we have a tar file */
@@ -228,7 +230,7 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((unu
 
 	/* try soft magic tests */
 	if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0)
-		if ((m = file_softmagic(ms, ubuf, nb, BINTEST,
+		if ((m = file_softmagic(ms, ubuf, nb, 0, BINTEST,
 		    looks_text)) != 0) {
 			if ((ms->flags & MAGIC_DEBUG) != 0)
 				(void)fprintf(stderr, "softmagic %d\n", m);
@@ -261,25 +263,13 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((unu
 				(void)fprintf(stderr, "ascmagic %d\n", m);
 			goto done;
 		}
-
-		/* try to discover text encoding */
-		if ((ms->flags & MAGIC_NO_CHECK_ENCODING) == 0) {
-			if (looks_text == 0)
-				if ((m = file_ascmagic_with_encoding( ms, ubuf,
-				    nb, u8buf, ulen, code, type, looks_text))
-				    != 0) {
-					if ((ms->flags & MAGIC_DEBUG) != 0)
-						(void)fprintf(stderr,
-						    "ascmagic/enc %d\n", m);
-					goto done;
-				}
-		}
 	}
 
+simple:
 	/* give up */
 	m = 1;
 	if ((!mime || (mime & MAGIC_MIME_TYPE)) &&
-	    file_printf(ms, mime ? "application/octet-stream" : "data") == -1) {
+	    file_printf(ms, "%s", mime ? type : def) == -1) {
 	    rv = -1;
 	}
  done:
@@ -290,6 +280,9 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((unu
 		if (file_printf(ms, "%s", code_mime) == -1)
 			rv = -1;
 	}
+#if HAVE_FORK
+ done_encoding:
+#endif
 	free(u8buf);
 	if (rv)
 		return rv;
@@ -301,7 +294,7 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((unu
 protected int
 file_reset(struct magic_set *ms)
 {
-	if (ms->mlist == NULL) {
+	if (ms->mlist[0] == NULL) {
 		file_error(ms, 0, "no magic files loaded");
 		return -1;
 	}
@@ -436,26 +429,65 @@ file_printedlen(const struct magic_set *ms)
 protected int
 file_replace(struct magic_set *ms, const char *pat, const char *rep)
 {
-	regex_t rx;
-	int rc;
+	file_regex_t rx;
+	int rc, rv = -1;
 
-	rc = regcomp(&rx, pat, REG_EXTENDED);
+	rc = file_regcomp(&rx, pat, REG_EXTENDED);
 	if (rc) {
-		char errmsg[512];
-		(void)regerror(rc, &rx, errmsg, sizeof(errmsg));
-		file_magerror(ms, "regex error %d, (%s)", rc, errmsg);
-		return -1;
+		file_regerror(&rx, rc, ms);
 	} else {
 		regmatch_t rm;
 		int nm = 0;
-		while (regexec(&rx, ms->o.buf, 1, &rm, 0) == 0) {
+		while (file_regexec(&rx, ms->o.buf, 1, &rm, 0) == 0) {
 			ms->o.buf[rm.rm_so] = '\0';
 			if (file_printf(ms, "%s%s", rep,
 			    rm.rm_eo != 0 ? ms->o.buf + rm.rm_eo : "") == -1)
-				return -1;
+				goto out;
 			nm++;
 		}
-		regfree(&rx);
-		return nm;
+		rv = nm;
 	}
+out:
+	file_regfree(&rx);
+	return rv;
+}
+
+protected int
+file_regcomp(file_regex_t *rx, const char *pat, int flags)
+{
+	rx->old_lc_ctype = setlocale(LC_CTYPE, NULL);
+	assert(rx->old_lc_ctype != NULL);
+	rx->old_lc_ctype = strdup(rx->old_lc_ctype);
+	assert(rx->old_lc_ctype != NULL);
+	rx->pat = pat;
+
+	(void)setlocale(LC_CTYPE, "C");
+	return rx->rc = regcomp(&rx->rx, pat, flags);
+}
+
+protected int
+file_regexec(file_regex_t *rx, const char *str, size_t nmatch,
+    regmatch_t* pmatch, int eflags)
+{
+	assert(rx->rc == 0);
+	return regexec(&rx->rx, str, nmatch, pmatch, eflags);
+}
+
+protected void
+file_regfree(file_regex_t *rx)
+{
+	if (rx->rc == 0)
+		regfree(&rx->rx);
+	(void)setlocale(LC_CTYPE, rx->old_lc_ctype);
+	free(rx->old_lc_ctype);
+}
+
+protected void
+file_regerror(file_regex_t *rx, int rc, struct magic_set *ms)
+{
+	char errmsg[512];
+
+	(void)regerror(rc, &rx->rx, errmsg, sizeof(errmsg));
+	file_magerror(ms, "regex error %d for `%s', (%s)", rc, rx->pat,
+	    errmsg);
 }
diff --git a/contrib/file/getline.c b/contrib/file/src/getline.c
similarity index 99%
rename from contrib/file/getline.c
rename to contrib/file/src/getline.c
index e3c41c4af83..99cd15075ca 100644
--- a/contrib/file/getline.c
+++ b/contrib/file/src/getline.c
@@ -37,7 +37,7 @@
 #include 
 #include 
 
-ssize_t
+public ssize_t
 getdelim(char **buf, size_t *bufsiz, int delimiter, FILE *fp)
 {
 	char *ptr, *eptr;
diff --git a/contrib/file/getopt_long.c b/contrib/file/src/getopt_long.c
similarity index 100%
rename from contrib/file/getopt_long.c
rename to contrib/file/src/getopt_long.c
diff --git a/contrib/file/is_tar.c b/contrib/file/src/is_tar.c
similarity index 100%
rename from contrib/file/is_tar.c
rename to contrib/file/src/is_tar.c
diff --git a/contrib/file/magic.c b/contrib/file/src/magic.c
similarity index 79%
rename from contrib/file/magic.c
rename to contrib/file/src/magic.c
index 22e5c9b3855..e4bd12ba229 100644
--- a/contrib/file/magic.c
+++ b/contrib/file/src/magic.c
@@ -33,7 +33,7 @@
 #include "file.h"
 
 #ifndef	lint
-FILE_RCSID("@(#)$File: magic.c,v 1.74 2011/05/26 01:27:59 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.84 2014/05/14 23:15:42 christos Exp $")
 #endif	/* lint */
 
 #include "magic.h"
@@ -71,12 +71,11 @@ FILE_RCSID("@(#)$File: magic.c,v 1.74 2011/05/26 01:27:59 christos Exp $")
 #endif
 #endif
 
-private void free_mlist(struct mlist *);
-#ifndef COMPILE_ONLY
 private void close_and_restore(const struct magic_set *, const char *, int,
     const struct stat *);
 private int unreadable_info(struct magic_set *, mode_t, const char *);
 private const char* get_default_magic(void);
+#ifndef COMPILE_ONLY
 private const char *file_or_fd(struct magic_set *, const char *, int);
 #endif
 
@@ -101,16 +100,21 @@ get_default_magic(void)
 	if ((home = getenv("HOME")) == NULL)
 		return MAGIC;
 
-	if (asprintf(&hmagicpath, "%s/.magic", home) < 0)
+	if (asprintf(&hmagicpath, "%s/.magic.mgc", home) < 0)
 		return MAGIC;
-	if (stat(hmagicpath, &st) == -1)
-		goto out;
-	if (S_ISDIR(st.st_mode)) {
+	if (stat(hmagicpath, &st) == -1) {
 		free(hmagicpath);
-		if (asprintf(&hmagicpath, "%s/%s", home, hmagic) < 0)
+		if (asprintf(&hmagicpath, "%s/.magic", home) < 0)
 			return MAGIC;
-		if (access(hmagicpath, R_OK) == -1)
+		if (stat(hmagicpath, &st) == -1)
 			goto out;
+		if (S_ISDIR(st.st_mode)) {
+			free(hmagicpath);
+			if (asprintf(&hmagicpath, "%s/%s", home, hmagic) < 0)
+				return MAGIC;
+			if (access(hmagicpath, R_OK) == -1)
+				goto out;
+		}
 	}
 
 	if (asprintf(&default_magic, "%s:%s", hmagicpath, MAGIC) < 0)
@@ -122,8 +126,9 @@ get_default_magic(void)
 	free(hmagicpath);
 	return MAGIC;
 #else
-	char *hmagicp = hmagicpath;
+	char *hmagicp;
 	char *tmppath = NULL;
+	hmagicpath = NULL;
 
 #define APPENDPATH() \
 	do { \
@@ -210,64 +215,21 @@ magic_getpath(const char *magicfile, int action)
 public struct magic_set *
 magic_open(int flags)
 {
-	struct magic_set *ms;
-	size_t len;
-
-	if ((ms = CAST(struct magic_set *, calloc((size_t)1,
-	    sizeof(struct magic_set)))) == NULL)
-		return NULL;
-
-	if (magic_setflags(ms, flags) == -1) {
-		errno = EINVAL;
-		goto free;
-	}
-
-	ms->o.buf = ms->o.pbuf = NULL;
-	len = (ms->c.len = 10) * sizeof(*ms->c.li);
-
-	if ((ms->c.li = CAST(struct level_info *, malloc(len))) == NULL)
-		goto free;
-
-	ms->event_flags = 0;
-	ms->error = -1;
-	ms->mlist = NULL;
-	ms->file = "unknown";
-	ms->line = 0;
-	return ms;
-free:
-	free(ms);
-	return NULL;
+	return file_ms_alloc(flags);
 }
 
-private void
-free_mlist(struct mlist *mlist)
-{
-	struct mlist *ml;
-
-	if (mlist == NULL)
-		return;
-
-	for (ml = mlist->next; ml != mlist;) {
-		struct mlist *next = ml->next;
-		struct magic *mg = ml->magic;
-		file_delmagic(mg, ml->mapped, ml->nmagic);
-		free(ml);
-		ml = next;
-	}
-	free(ml);
-}
-
-#ifndef COMPILE_ONLY
 private int
 unreadable_info(struct magic_set *ms, mode_t md, const char *file)
 {
-	/* We cannot open it, but we were able to stat it. */
-	if (access(file, W_OK) == 0)
-		if (file_printf(ms, "writable, ") == -1)
-			return -1;
-	if (access(file, X_OK) == 0)
-		if (file_printf(ms, "executable, ") == -1)
-			return -1;
+	if (file) {
+		/* We cannot open it, but we were able to stat it. */
+		if (access(file, W_OK) == 0)
+			if (file_printf(ms, "writable, ") == -1)
+				return -1;
+		if (access(file, X_OK) == 0)
+			if (file_printf(ms, "executable, ") == -1)
+				return -1;
+	}
 	if (S_ISREG(md))
 		if (file_printf(ms, "regular file, ") == -1)
 			return -1;
@@ -275,16 +237,13 @@ unreadable_info(struct magic_set *ms, mode_t md, const char *file)
 		return -1;
 	return 0;
 }
-#endif
 
 public void
 magic_close(struct magic_set *ms)
 {
-	free_mlist(ms->mlist);
-	free(ms->o.pbuf);
-	free(ms->o.buf);
-	free(ms->c.li);
-	free(ms);
+	if (ms == NULL)
+		return;
+	file_ms_free(ms);
 }
 
 /*
@@ -293,45 +252,40 @@ magic_close(struct magic_set *ms)
 public int
 magic_load(struct magic_set *ms, const char *magicfile)
 {
-	struct mlist *ml = file_apprentice(ms, magicfile, FILE_LOAD);
-	if (ml) {
-		free_mlist(ms->mlist);
-		ms->mlist = ml;
-		return 0;
-	}
-	return -1;
+	if (ms == NULL)
+		return -1;
+	return file_apprentice(ms, magicfile, FILE_LOAD);
 }
 
 public int
 magic_compile(struct magic_set *ms, const char *magicfile)
 {
-	struct mlist *ml = file_apprentice(ms, magicfile, FILE_COMPILE);
-	free_mlist(ml);
-	return ml ? 0 : -1;
+	if (ms == NULL)
+		return -1;
+	return file_apprentice(ms, magicfile, FILE_COMPILE);
 }
 
 public int
 magic_check(struct magic_set *ms, const char *magicfile)
 {
-	struct mlist *ml = file_apprentice(ms, magicfile, FILE_CHECK);
-	free_mlist(ml);
-	return ml ? 0 : -1;
+	if (ms == NULL)
+		return -1;
+	return file_apprentice(ms, magicfile, FILE_CHECK);
 }
 
 public int
 magic_list(struct magic_set *ms, const char *magicfile)
 {
-	struct mlist *ml = file_apprentice(ms, magicfile, FILE_LIST);
-	free_mlist(ml);
-	return ml ? 0 : -1;
+	if (ms == NULL)
+		return -1;
+	return file_apprentice(ms, magicfile, FILE_LIST);
 }
 
-#ifndef COMPILE_ONLY
 private void
 close_and_restore(const struct magic_set *ms, const char *name, int fd,
     const struct stat *sb)
 {
-	if (fd == STDIN_FILENO)
+	if (fd == STDIN_FILENO || name == NULL)
 		return;
 	(void) close(fd);
 
@@ -360,6 +314,7 @@ close_and_restore(const struct magic_set *ms, const char *name, int fd,
 	}
 }
 
+#ifndef COMPILE_ONLY
 
 /*
  * find type of descriptor
@@ -367,6 +322,8 @@ close_and_restore(const struct magic_set *ms, const char *name, int fd,
 public const char *
 magic_descriptor(struct magic_set *ms, int fd)
 {
+	if (ms == NULL)
+		return NULL;
 	return file_or_fd(ms, NULL, fd);
 }
 
@@ -376,6 +333,8 @@ magic_descriptor(struct magic_set *ms, int fd)
 public const char *
 magic_file(struct magic_set *ms, const char *inname)
 {
+	if (ms == NULL)
+		return NULL;
 	return file_or_fd(ms, inname, STDIN_FILENO);
 }
 
@@ -387,6 +346,10 @@ file_or_fd(struct magic_set *ms, const char *inname, int fd)
 	struct stat	sb;
 	ssize_t nbytes = 0;	/* number of bytes read from a datafile */
 	int	ispipe = 0;
+	off_t	pos = (off_t)-1;
+
+	if (file_reset(ms) == -1)
+		goto out;
 
 	/*
 	 * one extra for terminating '\0', and
@@ -396,9 +359,6 @@ file_or_fd(struct magic_set *ms, const char *inname, int fd)
 	if ((buf = CAST(unsigned char *, malloc(HOWMANY + SLOP))) == NULL)
 		return NULL;
 
-	if (file_reset(ms) == -1)
-		goto done;
-
 	switch (file_fsmagic(ms, inname, &sb)) {
 	case -1:		/* error */
 		goto done;
@@ -409,13 +369,22 @@ file_or_fd(struct magic_set *ms, const char *inname, int fd)
 		goto done;
 	}
 
+#ifdef WIN32
+	/* Place stdin in binary mode, so EOF (Ctrl+Z) doesn't stop early. */
+	if (fd == STDIN_FILENO)
+		_setmode(STDIN_FILENO, O_BINARY);
+#endif
+
 	if (inname == NULL) {
 		if (fstat(fd, &sb) == 0 && S_ISFIFO(sb.st_mode))
 			ispipe = 1;
+		else
+			pos = lseek(fd, (off_t)0, SEEK_CUR);
 	} else {
 		int flags = O_RDONLY|O_BINARY;
+		int okstat = stat(inname, &sb) == 0;
 
-		if (stat(inname, &sb) == 0 && S_ISFIFO(sb.st_mode)) {
+		if (okstat && S_ISFIFO(sb.st_mode)) {
 #ifdef O_NONBLOCK
 			flags |= O_NONBLOCK;
 #endif
@@ -424,7 +393,20 @@ file_or_fd(struct magic_set *ms, const char *inname, int fd)
 
 		errno = 0;
 		if ((fd = open(inname, flags)) < 0) {
-			if (unreadable_info(ms, sb.st_mode, inname) == -1)
+#ifdef WIN32
+			/*
+			 * Can't stat, can't open.  It may have been opened in
+			 * fsmagic, so if the user doesn't have read permission,
+			 * allow it to say so; otherwise an error was probably
+			 * displayed in fsmagic.
+			 */
+			if (!okstat && errno == EACCES) {
+				sb.st_mode = S_IFBLK;
+				okstat = 1;
+			}
+#endif
+			if (okstat &&
+			    unreadable_info(ms, sb.st_mode, inname) == -1)
 				goto done;
 			rv = 0;
 			goto done;
@@ -458,8 +440,18 @@ file_or_fd(struct magic_set *ms, const char *inname, int fd)
 		}
 
 	} else {
-		if ((nbytes = read(fd, (char *)buf, HOWMANY)) == -1) {
-			file_error(ms, errno, "cannot read `%s'", inname);
+		/* Windows refuses to read from a big console buffer. */
+		size_t howmany =
+#if defined(WIN32) && HOWMANY > 8 * 1024
+				_isatty(fd) ? 8 * 1024 :
+#endif
+				HOWMANY;
+		if ((nbytes = read(fd, (char *)buf, howmany)) == -1) {
+			if (inname == NULL && fd != STDIN_FILENO)
+				file_error(ms, errno, "cannot read fd %d", fd);
+			else
+				file_error(ms, errno, "cannot read `%s'",
+				    inname == NULL ? "/dev/stdin" : inname);
 			goto done;
 		}
 	}
@@ -470,7 +462,10 @@ file_or_fd(struct magic_set *ms, const char *inname, int fd)
 	rv = 0;
 done:
 	free(buf);
+	if (pos != (off_t)-1)
+		(void)lseek(fd, pos, SEEK_SET);
 	close_and_restore(ms, inname, fd, &sb);
+out:
 	return rv == 0 ? file_getbuffer(ms) : NULL;
 }
 
@@ -478,6 +473,8 @@ file_or_fd(struct magic_set *ms, const char *inname, int fd)
 public const char *
 magic_buffer(struct magic_set *ms, const void *buf, size_t nb)
 {
+	if (ms == NULL)
+		return NULL;
 	if (file_reset(ms) == -1)
 		return NULL;
 	/*
@@ -489,23 +486,29 @@ magic_buffer(struct magic_set *ms, const void *buf, size_t nb)
 	}
 	return file_getbuffer(ms);
 }
-#endif /* COMPILE_ONLY */
+#endif
 
 public const char *
 magic_error(struct magic_set *ms)
 {
+	if (ms == NULL)
+		return "Magic database is not open";
 	return (ms->event_flags & EVENT_HAD_ERR) ? ms->o.buf : NULL;
 }
 
 public int
 magic_errno(struct magic_set *ms)
 {
+	if (ms == NULL)
+		return EINVAL;
 	return (ms->event_flags & EVENT_HAD_ERR) ? ms->error : 0;
 }
 
 public int
 magic_setflags(struct magic_set *ms, int flags)
 {
+	if (ms == NULL)
+		return -1;
 #if !defined(HAVE_UTIME) && !defined(HAVE_UTIMES)
 	if (flags & MAGIC_PRESERVE_ATIME)
 		return -1;
@@ -513,3 +516,9 @@ magic_setflags(struct magic_set *ms, int flags)
 	ms->flags = flags;
 	return 0;
 }
+
+public int
+magic_version(void)
+{
+	return MAGIC_VERSION;
+}
diff --git a/contrib/file/magic.h b/contrib/file/src/magic.h
similarity index 97%
rename from contrib/file/magic.h
rename to contrib/file/src/magic.h
index 2bbed764d26..38e59d70881 100644
--- a/contrib/file/magic.h
+++ b/contrib/file/src/magic.h
@@ -65,6 +65,7 @@
 	MAGIC_NO_CHECK_CDF	| \
 	MAGIC_NO_CHECK_TOKENS	| \
 	MAGIC_NO_CHECK_ENCODING	| \
+	0			  \
 )
 
 /* Defined for backwards compatibility (renamed) */
@@ -74,6 +75,8 @@
 #define	MAGIC_NO_CHECK_FORTRAN	0x000000 /* Don't check ascii/fortran */
 #define	MAGIC_NO_CHECK_TROFF	0x000000 /* Don't check ascii/troff */
 
+#define MAGIC_VERSION		518	/* This implementation */
+
 
 #ifdef __cplusplus
 extern "C" {
@@ -91,6 +94,7 @@ const char *magic_buffer(magic_t, const void *, size_t);
 const char *magic_error(magic_t);
 int magic_setflags(magic_t, int);
 
+int magic_version(void);
 int magic_load(magic_t, const char *);
 int magic_compile(magic_t, const char *);
 int magic_check(magic_t, const char *);
diff --git a/contrib/file/src/magic.h.in b/contrib/file/src/magic.h.in
new file mode 100644
index 00000000000..86fc41b77f0
--- /dev/null
+++ b/contrib/file/src/magic.h.in
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) Christos Zoulas 2003.
+ * 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 immediately at the beginning of the file, without modification,
+ *    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.
+ */
+#ifndef _MAGIC_H
+#define _MAGIC_H
+
+#include 
+
+#define	MAGIC_NONE		0x000000 /* No flags */
+#define	MAGIC_DEBUG		0x000001 /* Turn on debugging */
+#define	MAGIC_SYMLINK		0x000002 /* Follow symlinks */
+#define	MAGIC_COMPRESS		0x000004 /* Check inside compressed files */
+#define	MAGIC_DEVICES		0x000008 /* Look at the contents of devices */
+#define	MAGIC_MIME_TYPE		0x000010 /* Return the MIME type */
+#define	MAGIC_CONTINUE		0x000020 /* Return all matches */
+#define	MAGIC_CHECK		0x000040 /* Print warnings to stderr */
+#define	MAGIC_PRESERVE_ATIME	0x000080 /* Restore access time on exit */
+#define	MAGIC_RAW		0x000100 /* Don't translate unprintable chars */
+#define	MAGIC_ERROR		0x000200 /* Handle ENOENT etc as real errors */
+#define	MAGIC_MIME_ENCODING	0x000400 /* Return the MIME encoding */
+#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
+#define	MAGIC_APPLE		0x000800 /* Return the Apple creator and type */
+
+#define	MAGIC_NO_CHECK_COMPRESS	0x001000 /* Don't check for compressed files */
+#define	MAGIC_NO_CHECK_TAR	0x002000 /* Don't check for tar files */
+#define	MAGIC_NO_CHECK_SOFT	0x004000 /* Don't check magic entries */
+#define	MAGIC_NO_CHECK_APPTYPE	0x008000 /* Don't check application type */
+#define	MAGIC_NO_CHECK_ELF	0x010000 /* Don't check for elf details */
+#define	MAGIC_NO_CHECK_TEXT	0x020000 /* Don't check for text files */
+#define	MAGIC_NO_CHECK_CDF	0x040000 /* Don't check for cdf files */
+#define	MAGIC_NO_CHECK_TOKENS	0x100000 /* Don't check tokens */
+#define MAGIC_NO_CHECK_ENCODING 0x200000 /* Don't check text encodings */
+
+/* No built-in tests; only consult the magic file */
+#define MAGIC_NO_CHECK_BUILTIN	( \
+	MAGIC_NO_CHECK_COMPRESS	| \
+	MAGIC_NO_CHECK_TAR	| \
+/*	MAGIC_NO_CHECK_SOFT	| */ \
+	MAGIC_NO_CHECK_APPTYPE	| \
+	MAGIC_NO_CHECK_ELF	| \
+	MAGIC_NO_CHECK_TEXT	| \
+	MAGIC_NO_CHECK_CDF	| \
+	MAGIC_NO_CHECK_TOKENS	| \
+	MAGIC_NO_CHECK_ENCODING	| \
+	0			  \
+)
+
+/* Defined for backwards compatibility (renamed) */
+#define	MAGIC_NO_CHECK_ASCII	MAGIC_NO_CHECK_TEXT
+
+/* Defined for backwards compatibility; do nothing */
+#define	MAGIC_NO_CHECK_FORTRAN	0x000000 /* Don't check ascii/fortran */
+#define	MAGIC_NO_CHECK_TROFF	0x000000 /* Don't check ascii/troff */
+
+#define MAGIC_VERSION		X.YY	/* This implementation */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct magic_set *magic_t;
+magic_t magic_open(int);
+void magic_close(magic_t);
+
+const char *magic_getpath(const char *, int);
+const char *magic_file(magic_t, const char *);
+const char *magic_descriptor(magic_t, int);
+const char *magic_buffer(magic_t, const void *, size_t);
+
+const char *magic_error(magic_t);
+int magic_setflags(magic_t, int);
+
+int magic_version(void);
+int magic_load(magic_t, const char *);
+int magic_compile(magic_t, const char *);
+int magic_check(magic_t, const char *);
+int magic_list(magic_t, const char *);
+int magic_errno(magic_t);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* _MAGIC_H */
diff --git a/contrib/file/mygetopt.h b/contrib/file/src/mygetopt.h
similarity index 83%
rename from contrib/file/mygetopt.h
rename to contrib/file/src/mygetopt.h
index 4cb879fe75d..ef87525eaf5 100644
--- a/contrib/file/mygetopt.h
+++ b/contrib/file/src/mygetopt.h
@@ -15,6 +15,13 @@
  * 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 NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
diff --git a/contrib/file/src/pread.c b/contrib/file/src/pread.c
new file mode 100644
index 00000000000..649f60953ff
--- /dev/null
+++ b/contrib/file/src/pread.c
@@ -0,0 +1,14 @@
+#include "file.h"
+#ifndef lint
+FILE_RCSID("@(#)$File: pread.c,v 1.2 2013/04/02 16:23:07 christos Exp $")
+#endif  /* lint */
+#include 
+#include 
+
+ssize_t
+pread(int fd, void *buf, size_t len, off_t off) {
+	if (lseek(fd, off, SEEK_SET) == (off_t)-1)
+		return -1;
+
+	return read(fd, buf, len);
+}
diff --git a/contrib/file/print.c b/contrib/file/src/print.c
similarity index 83%
rename from contrib/file/print.c
rename to contrib/file/src/print.c
index 4187a2ee0d2..fa817986740 100644
--- a/contrib/file/print.c
+++ b/contrib/file/src/print.c
@@ -32,7 +32,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: print.c,v 1.71 2011/09/20 15:28:09 christos Exp $")
+FILE_RCSID("@(#)$File: print.c,v 1.76 2013/02/26 18:25:00 christos Exp $")
 #endif  /* lint */
 
 #include 
@@ -45,31 +45,33 @@ FILE_RCSID("@(#)$File: print.c,v 1.71 2011/09/20 15:28:09 christos Exp $")
 
 #define SZOF(a)	(sizeof(a) / sizeof(a[0]))
 
+#include "cdf.h"
+
 #ifndef COMPILE_ONLY
 protected void
 file_mdump(struct magic *m)
 {
-	private const char optyp[] = { FILE_OPS };
+	static const char optyp[] = { FILE_OPS };
+	char tbuf[26];
 
 	(void) fprintf(stderr, "%u: %.*s %u", m->lineno,
 	    (m->cont_level & 7) + 1, ">>>>>>>>", m->offset);
 
 	if (m->flag & INDIR) {
 		(void) fprintf(stderr, "(%s,",
-			       /* Note: type is unsigned */
-			       (m->in_type < file_nnames) ? 
-					file_names[m->in_type] : "*bad*");
+		    /* Note: type is unsigned */
+		    (m->in_type < file_nnames) ? file_names[m->in_type] :
+		    "*bad in_type*");
 		if (m->in_op & FILE_OPINVERSE)
 			(void) fputc('~', stderr);
 		(void) fprintf(stderr, "%c%u),",
-			       ((size_t)(m->in_op & FILE_OPS_MASK) <
-			       SZOF(optyp)) ? 
-					optyp[m->in_op & FILE_OPS_MASK] : '?',
-				m->in_offset);
+		    ((size_t)(m->in_op & FILE_OPS_MASK) <
+		    SZOF(optyp)) ? optyp[m->in_op & FILE_OPS_MASK] : '?',
+		    m->in_offset);
 	}
 	(void) fprintf(stderr, " %s%s", (m->flag & UNSIGNED) ? "u" : "",
-		       /* Note: type is unsigned */
-		       (m->type < file_nnames) ? file_names[m->type] : "*bad*");
+	    /* Note: type is unsigned */
+	    (m->type < file_nnames) ? file_names[m->type] : "*bad type");
 	if (m->mask_op & FILE_OPINVERSE)
 		(void) fputc('~', stderr);
 
@@ -132,6 +134,7 @@ file_mdump(struct magic *m)
 		case FILE_MELONG:
 		case FILE_BESHORT:
 		case FILE_BELONG:
+		case FILE_INDIRECT:
 			(void) fprintf(stderr, "%d", m->value.l);
 			break;
 		case FILE_BEQUAD:
@@ -153,26 +156,31 @@ file_mdump(struct magic *m)
 		case FILE_BEDATE:
 		case FILE_MEDATE:
 			(void)fprintf(stderr, "%s,",
-			    file_fmttime(m->value.l, 1));
+			    file_fmttime(m->value.l, FILE_T_LOCAL, tbuf));
 			break;
 		case FILE_LDATE:
 		case FILE_LELDATE:
 		case FILE_BELDATE:
 		case FILE_MELDATE:
 			(void)fprintf(stderr, "%s,",
-			    file_fmttime(m->value.l, 0));
-			break;
+			    file_fmttime(m->value.l, 0, tbuf));
 		case FILE_QDATE:
 		case FILE_LEQDATE:
 		case FILE_BEQDATE:
 			(void)fprintf(stderr, "%s,",
-			    file_fmttime((uint32_t)m->value.q, 1));
+			    file_fmttime(m->value.q, FILE_T_LOCAL, tbuf));
 			break;
 		case FILE_QLDATE:
 		case FILE_LEQLDATE:
 		case FILE_BEQLDATE:
 			(void)fprintf(stderr, "%s,",
-			    file_fmttime((uint32_t)m->value.q, 0));
+			    file_fmttime(m->value.q, 0, tbuf));
+			break;
+		case FILE_QWDATE:
+		case FILE_LEQWDATE:
+		case FILE_BEQWDATE:
+			(void)fprintf(stderr, "%s,",
+			    file_fmttime(m->value.q, FILE_T_WINDOWS, tbuf));
 			break;
 		case FILE_FLOAT:
 		case FILE_BEFLOAT:
@@ -187,8 +195,12 @@ file_mdump(struct magic *m)
 		case FILE_DEFAULT:
 			/* XXX - do anything here? */
 			break;
+		case FILE_USE:
+		case FILE_NAME:
+			(void) fprintf(stderr, "'%s'", m->value.s);
+			break;
 		default:
-			(void) fputs("*bad*", stderr);
+			(void) fprintf(stderr, "*bad type %d*", m->type);
 			break;
 		}
 	}
@@ -216,14 +228,20 @@ file_magwarn(struct magic_set *ms, const char *f, ...)
 }
 
 protected const char *
-file_fmttime(uint32_t v, int local)
+file_fmttime(uint64_t v, int flags, char *buf)
 {
 	char *pp;
 	time_t t = (time_t)v;
 	struct tm *tm;
 
-	if (local) {
-		pp = ctime(&t);
+	if (flags & FILE_T_WINDOWS) {
+		struct timespec ts;
+		cdf_timestamp_to_timespec(&ts, t);
+		t = ts.tv_sec;
+	}
+
+	if (flags & FILE_T_LOCAL) {
+		pp = ctime_r(&t, buf);
 	} else {
 #ifndef HAVE_DAYLIGHT
 		private int daylight = 0;
@@ -245,7 +263,7 @@ file_fmttime(uint32_t v, int local)
 		tm = gmtime(&t);
 		if (tm == NULL)
 			goto out;
-		pp = asctime(tm);
+		pp = asctime_r(tm, buf);
 	}
 
 	if (pp == NULL)
@@ -253,5 +271,5 @@ file_fmttime(uint32_t v, int local)
 	pp[strcspn(pp, "\n")] = '\0';
 	return pp;
 out:
-	return "*Invalid time*";
+	return strcpy(buf, "*Invalid time*");
 }
diff --git a/contrib/file/readcdf.c b/contrib/file/src/readcdf.c
similarity index 64%
rename from contrib/file/readcdf.c
rename to contrib/file/src/readcdf.c
index 9cd0ceb0de6..7ced9ea6892 100644
--- a/contrib/file/readcdf.c
+++ b/contrib/file/src/readcdf.c
@@ -26,23 +26,107 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: readcdf.c,v 1.29 2012/02/20 20:04:58 christos Exp $")
+FILE_RCSID("@(#)$File: readcdf.c,v 1.44 2014/05/14 23:22:48 christos Exp $")
 #endif
 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#if defined(HAVE_LOCALE_H)
+#include 
+#endif
 
 #include "cdf.h"
 #include "magic.h"
 
 #define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
 
+static const struct nv {
+	const char *pattern;
+	const char *mime;
+} app2mime[] =  {
+	{ "Word",			"msword",		},
+	{ "Excel",			"vnd.ms-excel",		},
+	{ "Powerpoint",			"vnd.ms-powerpoint",	},
+	{ "Crystal Reports",		"x-rpt",		},
+	{ "Advanced Installer",		"vnd.ms-msi",		},
+	{ "InstallShield",		"vnd.ms-msi",		},
+	{ "Microsoft Patch Compiler",	"vnd.ms-msi",		},
+	{ "NAnt",			"vnd.ms-msi",		},
+	{ "Windows Installer",		"vnd.ms-msi",		},
+	{ NULL,				NULL,			},
+}, name2mime[] = {
+	{ "WordDocument",		"msword",		},
+	{ "PowerPoint",			"vnd.ms-powerpoint",	},
+	{ "DigitalSignature",		"vnd.ms-msi",		},
+	{ NULL,				NULL,			},
+}, name2desc[] = {
+	{ "WordDocument",		"Microsoft Office Word",},
+	{ "PowerPoint",			"Microsoft PowerPoint",	},
+	{ "DigitalSignature",		"Microsoft Installer",	},
+	{ NULL,				NULL,			},
+};
+
+static const struct cv {
+	uint64_t clsid[2];
+	const char *mime;
+} clsid2mime[] = {
+	{
+		{ 0x00000000000c1084LLU, 0x46000000000000c0LLU  },
+		"x-msi",
+	},
+	{	{ 0,			 0			},
+		NULL,
+	},
+}, clsid2desc[] = {
+	{
+		{ 0x00000000000c1084LLU, 0x46000000000000c0LLU  },
+		"MSI Installer",
+	},
+	{	{ 0,			 0			},
+		NULL,
+	},
+};
+
+private const char *
+cdf_clsid_to_mime(const uint64_t clsid[2], const struct cv *cv)
+{
+	size_t i;
+	for (i = 0; cv[i].mime != NULL; i++) {
+		if (clsid[0] == cv[i].clsid[0] && clsid[1] == cv[i].clsid[1])
+			return cv[i].mime;
+	}
+	return NULL;
+}
+
+private const char *
+cdf_app_to_mime(const char *vbuf, const struct nv *nv)
+{
+	size_t i;
+	const char *rv = NULL;
+	char *old_lc_ctype;
+
+	old_lc_ctype = setlocale(LC_CTYPE, NULL);
+	assert(old_lc_ctype != NULL);
+	old_lc_ctype = strdup(old_lc_ctype);
+	assert(old_lc_ctype != NULL);
+	(void)setlocale(LC_CTYPE, "C");
+	for (i = 0; nv[i].pattern != NULL; i++)
+		if (strcasestr(vbuf, nv[i].pattern) != NULL) {
+			rv = nv[i].mime;
+			break;
+		}
+	(void)setlocale(LC_CTYPE, old_lc_ctype);
+	free(old_lc_ctype);
+	return rv;
+}
+
 private int
 cdf_file_property_info(struct magic_set *ms, const cdf_property_info_t *info,
-    size_t count)
+    size_t count, const cdf_directory_t *root_storage)
 {
         size_t i;
         cdf_timestamp_t tp;
@@ -52,6 +136,10 @@ cdf_file_property_info(struct magic_set *ms, const cdf_property_info_t *info,
         const char *s;
         int len;
 
+        if (!NOTMIME(ms) && root_storage)
+		str = cdf_clsid_to_mime(root_storage->d_storage_uuid,
+		    clsid2mime);
+
         for (i = 0; i < count; i++) {
                 cdf_print_property_name(buf, sizeof(buf), info[i].pi_id);
                 switch (info[i].pi_type) {
@@ -92,12 +180,11 @@ cdf_file_property_info(struct magic_set *ms, const cdf_property_info_t *info,
                                 if (info[i].pi_type == CDF_LENGTH32_WSTRING)
                                     k++;
                                 s = info[i].pi_str.s_buf;
-                                for (j = 0; j < sizeof(vbuf) && len--;
-                                    j++, s += k) {
+                                for (j = 0; j < sizeof(vbuf) && len--; s += k) {
                                         if (*s == '\0')
                                                 break;
                                         if (isprint((unsigned char)*s))
-                                                vbuf[j] = *s;
+                                                vbuf[j++] = *s;
                                 }
                                 if (j == sizeof(vbuf))
                                         --j;
@@ -108,25 +195,17 @@ cdf_file_property_info(struct magic_set *ms, const cdf_property_info_t *info,
                                                     buf, vbuf) == -1)
                                                         return -1;
                                         }
-                                } else if (info[i].pi_id ==
-                                        CDF_PROPERTY_NAME_OF_APPLICATION) {
-                                        if (strstr(vbuf, "Word"))
-                                                str = "msword";
-                                        else if (strstr(vbuf, "Excel"))
-                                                str = "vnd.ms-excel";
-                                        else if (strstr(vbuf, "Powerpoint"))
-                                                str = "vnd.ms-powerpoint";
-                                        else if (strstr(vbuf,
-                                            "Crystal Reports"))
-                                                str = "x-rpt";
-                                }
-                        }
+                                } else if (str == NULL && info[i].pi_id ==
+				    CDF_PROPERTY_NAME_OF_APPLICATION) {
+					str = cdf_app_to_mime(vbuf, app2mime);
+				}
+			}
                         break;
                 case CDF_FILETIME:
                         tp = info[i].pi_tp;
                         if (tp != 0) {
+				char tbuf[64];
                                 if (tp < 1000000000000000LL) {
-                                        char tbuf[64];
                                         cdf_print_elapsed_time(tbuf,
                                             sizeof(tbuf), tp);
                                         if (NOTMIME(ms) && file_printf(ms,
@@ -135,9 +214,10 @@ cdf_file_property_info(struct magic_set *ms, const cdf_property_info_t *info,
                                 } else {
                                         char *c, *ec;
                                         cdf_timestamp_to_timespec(&ts, tp);
-                                        c = cdf_ctime(&ts.tv_sec);
-                                        if ((ec = strchr(c, '\n')) != NULL)
-                                                *ec = '\0';
+                                        c = cdf_ctime(&ts.tv_sec, tbuf);
+                                        if (c != NULL &&
+					    (ec = strchr(c, '\n')) != NULL)
+						*ec = '\0';
 
                                         if (NOTMIME(ms) && file_printf(ms,
                                             ", %s: %s", buf, c) == -1)
@@ -162,7 +242,7 @@ cdf_file_property_info(struct magic_set *ms, const cdf_property_info_t *info,
 
 private int
 cdf_file_summary_info(struct magic_set *ms, const cdf_header_t *h,
-    const cdf_stream_t *sst)
+    const cdf_stream_t *sst, const cdf_directory_t *root_storage)
 {
         cdf_summary_info_header_t si;
         cdf_property_info_t *info;
@@ -173,6 +253,8 @@ cdf_file_summary_info(struct magic_set *ms, const cdf_header_t *h,
                 return -1;
 
         if (NOTMIME(ms)) {
+		const char *str;
+
                 if (file_printf(ms, "Composite Document File V2 Document")
 		    == -1)
                         return -1;
@@ -200,14 +282,35 @@ cdf_file_summary_info(struct magic_set *ms, const cdf_header_t *h,
                                 return -2;
                         break;
                 }
-        }
+		if (root_storage) {
+			str = cdf_clsid_to_mime(root_storage->d_storage_uuid,
+			    clsid2desc);
+			if (str)
+				if (file_printf(ms, ", %s", str) == -1)
+					return -2;
+			}
+		}
 
-        m = cdf_file_property_info(ms, info, count);
+        m = cdf_file_property_info(ms, info, count, root_storage);
         free(info);
 
         return m == -1 ? -2 : m;
 }
 
+#ifdef notdef
+private char *
+format_clsid(char *buf, size_t len, const uint64_t uuid[2]) {
+	snprintf(buf, len, "%.8" PRIx64 "-%.4" PRIx64 "-%.4" PRIx64 "-%.4" 
+	    PRIx64 "-%.12" PRIx64,
+	    (uuid[0] >> 32) & (uint64_t)0x000000000ffffffffLLU,
+	    (uuid[0] >> 16) & (uint64_t)0x0000000000000ffffLLU,
+	    (uuid[0] >>  0) & (uint64_t)0x0000000000000ffffLLU, 
+	    (uuid[1] >> 48) & (uint64_t)0x0000000000000ffffLLU,
+	    (uuid[1] >>  0) & (uint64_t)0x0000fffffffffffffLLU);
+	return buf;
+}
+#endif
+
 protected int
 file_trycdf(struct magic_set *ms, int fd, const unsigned char *buf,
     size_t nbytes)
@@ -253,13 +356,50 @@ file_trycdf(struct magic_set *ms, int fd, const unsigned char *buf,
                 goto out2;
         }
 
-        if ((i = cdf_read_short_stream(&info, &h, &sat, &dir, &sst)) == -1) {
+        const cdf_directory_t *root_storage;
+        if ((i = cdf_read_short_stream(&info, &h, &sat, &dir, &sst,
+	    &root_storage)) == -1) {
                 expn = "Cannot read short stream";
                 goto out3;
         }
 #ifdef CDF_DEBUG
         cdf_dump_dir(&info, &h, &sat, &ssat, &sst, &dir);
 #endif
+#ifdef notdef
+	if (root_storage) {
+		if (NOTMIME(ms)) {
+			char clsbuf[128];
+			if (file_printf(ms, "CLSID %s, ",
+			    format_clsid(clsbuf, sizeof(clsbuf),
+			    root_storage->d_storage_uuid)) == -1)
+				return -1;
+		}
+	}
+#endif
+
+	if ((i = cdf_read_user_stream(&info, &h, &sat, &ssat, &sst, &dir,
+	    "FileHeader", &scn)) != -1) {
+#define HWP5_SIGNATURE "HWP Document File"
+		if (scn.sst_dirlen >= sizeof(HWP5_SIGNATURE) - 1
+		    && memcmp(scn.sst_tab, HWP5_SIGNATURE,
+		    sizeof(HWP5_SIGNATURE) - 1) == 0) {
+		    if (NOTMIME(ms)) {
+			if (file_printf(ms,
+			    "Hangul (Korean) Word Processor File 5.x") == -1)
+			    return -1;
+		    } else {
+			if (file_printf(ms, "application/x-hwp") == -1)
+			    return -1;
+		    }
+		    i = 1;
+		    goto out5;
+		} else {
+		    free(scn.sst_tab);
+		    scn.sst_tab = NULL;
+		    scn.sst_len = 0;
+		    scn.sst_dirlen = 0;
+		}
+	}
 
         if ((i = cdf_read_summary_info(&info, &h, &sat, &ssat, &sst, &dir,
             &scn)) == -1) {
@@ -274,26 +414,37 @@ file_trycdf(struct magic_set *ms, int fd, const unsigned char *buf,
 #ifdef CDF_DEBUG
         cdf_dump_summary_info(&h, &scn);
 #endif
-        if ((i = cdf_file_summary_info(ms, &h, &scn)) < 0)
-                expn = "Can't expand summary_info";
+        if ((i = cdf_file_summary_info(ms, &h, &scn, root_storage)) < 0)
+            expn = "Can't expand summary_info";
+
 	if (i == 0) {
-		const char *str = "vnd.ms-office";
+		const char *str = NULL;
 		cdf_directory_t *d;
 		char name[__arraycount(d->d_name)];
 		size_t j, k;
-		for (j = 0; j < dir.dir_len; j++) {
-		    d = &dir.dir_tab[j];
-		    for (k = 0; k < sizeof(name); k++)
-			name[k] = (char)cdf_tole2(d->d_name[k]);
-		    if (strstr(name, "WordDocument") == 0) {
-			str = "msword";
-			break;
-		    }
+
+		for (j = 0; str == NULL && j < dir.dir_len; j++) {
+			d = &dir.dir_tab[j];
+			for (k = 0; k < sizeof(name); k++)
+				name[k] = (char)cdf_tole2(d->d_name[k]);
+			str = cdf_app_to_mime(name,
+			    NOTMIME(ms) ? name2desc : name2mime);
+		}
+		if (NOTMIME(ms)) {
+			if (str != NULL) {
+				if (file_printf(ms, "%s", str) == -1)
+					return -1;
+				i = 1;
+			}
+		} else {
+			if (str == NULL)
+				str = "vnd.ms-office";
+			if (file_printf(ms, "application/%s", str) == -1)
+				return -1;
+			i = 1;
 		}
-                if (file_printf(ms, "application/%s", str) == -1)
-                        return -1;
-		i = 1;
 	}
+out5:
         free(scn.sst_tab);
 out4:
         free(sst.sst_tab);
@@ -304,15 +455,19 @@ file_trycdf(struct magic_set *ms, int fd, const unsigned char *buf,
 out1:
         free(sat.sat_tab);
 out0:
-        if (i != 1) {
-		if (i == -1)
-		    if (file_printf(ms, "Composite Document File V2 Document")
-			== -1)
-			    return -1;
-                if (*expn)
-                        if (file_printf(ms, ", %s%s", corrupt, expn) == -1)
-                                return -1;
-                i = 1;
-        }
+	if (i == -1) {
+	    if (NOTMIME(ms)) {
+		if (file_printf(ms,
+		    "Composite Document File V2 Document") == -1)
+		    return -1;
+		if (*expn)
+		    if (file_printf(ms, ", %s%s", corrupt, expn) == -1)
+			return -1;
+	    } else {
+		if (file_printf(ms, "application/CDFV2-corrupt") == -1)
+		    return -1;
+	    }
+	    i = 1;
+	}
         return i;
 }
diff --git a/contrib/file/readelf.c b/contrib/file/src/readelf.c
similarity index 77%
rename from contrib/file/readelf.c
rename to contrib/file/src/readelf.c
index 8b141e12d40..ede7e0c751c 100644
--- a/contrib/file/readelf.c
+++ b/contrib/file/src/readelf.c
@@ -27,7 +27,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: readelf.c,v 1.90 2011/08/23 08:01:12 christos Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.103 2014/05/02 02:25:10 christos Exp $")
 #endif
 
 #ifdef BUILTIN_ELF
@@ -48,7 +48,7 @@ private int dophn_core(struct magic_set *, int, int, int, off_t, int, size_t,
 private int dophn_exec(struct magic_set *, int, int, int, off_t, int, size_t,
     off_t, int *, int);
 private int doshn(struct magic_set *, int, int, int, off_t, int, size_t,
-    off_t, int *, int);
+    off_t, int *, int, int);
 private size_t donote(struct magic_set *, void *, size_t, size_t, int,
     int, size_t, int *);
 
@@ -127,21 +127,15 @@ getu64(int swap, uint64_t value)
 
 #define elf_getu16(swap, value) getu16(swap, value)
 #define elf_getu32(swap, value) getu32(swap, value)
-#ifdef USE_ARRAY_FOR_64BIT_TYPES
-# define elf_getu64(swap, array) \
-	((swap ? ((uint64_t)elf_getu32(swap, array[0])) << 32 : elf_getu32(swap, array[0])) + \
-	 (swap ? elf_getu32(swap, array[1]) : ((uint64_t)elf_getu32(swap, array[1]) << 32)))
-#else
-# define elf_getu64(swap, value) getu64(swap, value)
-#endif
+#define elf_getu64(swap, value) getu64(swap, value)
 
 #define xsh_addr	(clazz == ELFCLASS32			\
-			 ? (void *) &sh32			\
-			 : (void *) &sh64)
+			 ? (void *)&sh32			\
+			 : (void *)&sh64)
 #define xsh_sizeof	(clazz == ELFCLASS32			\
-			 ? sizeof sh32				\
-			 : sizeof sh64)
-#define xsh_size	(clazz == ELFCLASS32			\
+			 ? sizeof(sh32)				\
+			 : sizeof(sh64))
+#define xsh_size	(size_t)(clazz == ELFCLASS32		\
 			 ? elf_getu32(swap, sh32.sh_size)	\
 			 : elf_getu64(swap, sh64.sh_size))
 #define xsh_offset	(off_t)(clazz == ELFCLASS32		\
@@ -150,12 +144,15 @@ getu64(int swap, uint64_t value)
 #define xsh_type	(clazz == ELFCLASS32			\
 			 ? elf_getu32(swap, sh32.sh_type)	\
 			 : elf_getu32(swap, sh64.sh_type))
+#define xsh_name    	(clazz == ELFCLASS32			\
+			 ? elf_getu32(swap, sh32.sh_name)	\
+			 : elf_getu32(swap, sh64.sh_name))
 #define xph_addr	(clazz == ELFCLASS32			\
 			 ? (void *) &ph32			\
 			 : (void *) &ph64)
 #define xph_sizeof	(clazz == ELFCLASS32			\
-			 ? sizeof ph32				\
-			 : sizeof ph64)
+			 ? sizeof(ph32)				\
+			 : sizeof(ph64))
 #define xph_type	(clazz == ELFCLASS32			\
 			 ? elf_getu32(swap, ph32.p_type)	\
 			 : elf_getu32(swap, ph64.p_type))
@@ -171,8 +168,8 @@ getu64(int swap, uint64_t value)
 			 ? elf_getu32(swap, ph32.p_filesz)	\
 			 : elf_getu64(swap, ph64.p_filesz)))
 #define xnh_addr	(clazz == ELFCLASS32			\
-			 ? (void *) &nh32			\
-			 : (void *) &nh64)
+			 ? (void *)&nh32			\
+			 : (void *)&nh64)
 #define xph_memsz	(size_t)((clazz == ELFCLASS32		\
 			 ? elf_getu32(swap, ph32.p_memsz)	\
 			 : elf_getu64(swap, ph64.p_memsz)))
@@ -192,8 +189,8 @@ getu64(int swap, uint64_t value)
 			 ? prpsoffsets32[i]			\
 			 : prpsoffsets64[i])
 #define xcap_addr	(clazz == ELFCLASS32			\
-			 ? (void *) &cap32			\
-			 : (void *) &cap64)
+			 ? (void *)&cap32			\
+			 : (void *)&cap64)
 #define xcap_sizeof	(clazz == ELFCLASS32			\
 			 ? sizeof cap32				\
 			 : sizeof cap64)
@@ -295,7 +292,7 @@ dophn_core(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
 {
 	Elf32_Phdr ph32;
 	Elf64_Phdr ph64;
-	size_t offset;
+	size_t offset, len;
 	unsigned char nbuf[BUFSIZ];
 	ssize_t bufsize;
 
@@ -309,11 +306,7 @@ dophn_core(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
 	 * Loop through all the program headers.
 	 */
 	for ( ; num; num--) {
-		if (lseek(fd, off, SEEK_SET) == (off_t)-1) {
-			file_badseek(ms);
-			return -1;
-		}
-		if (read(fd, xph_addr, xph_sizeof) == -1) {
+		if (pread(fd, xph_addr, xph_sizeof, off) == -1) {
 			file_badread(ms);
 			return -1;
 		}
@@ -331,13 +324,8 @@ dophn_core(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
 		 * This is a PT_NOTE section; loop through all the notes
 		 * in the section.
 		 */
-		if (lseek(fd, xph_offset, SEEK_SET) == (off_t)-1) {
-			file_badseek(ms);
-			return -1;
-		}
-		bufsize = read(fd, nbuf,
-		    ((xph_filesz < sizeof(nbuf)) ? xph_filesz : sizeof(nbuf)));
-		if (bufsize == -1) {
+		len = xph_filesz < sizeof(nbuf) ? xph_filesz : sizeof(nbuf);
+		if ((bufsize = pread(fd, nbuf, len, xph_offset)) == -1) {
 			file_badread(ms);
 			return -1;
 		}
@@ -356,6 +344,126 @@ dophn_core(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
 }
 #endif
 
+static void
+do_note_netbsd_version(struct magic_set *ms, int swap, void *v)
+{
+	uint32_t desc;
+	(void)memcpy(&desc, v, sizeof(desc));
+	desc = elf_getu32(swap, desc);
+
+	if (file_printf(ms, ", for NetBSD") == -1)
+		return;
+	/*
+	 * The version number used to be stuck as 199905, and was thus
+	 * basically content-free.  Newer versions of NetBSD have fixed
+	 * this and now use the encoding of __NetBSD_Version__:
+	 *
+	 *	MMmmrrpp00
+	 *
+	 * M = major version
+	 * m = minor version
+	 * r = release ["",A-Z,Z[A-Z] but numeric]
+	 * p = patchlevel
+	 */
+	if (desc > 100000000U) {
+		uint32_t ver_patch = (desc / 100) % 100;
+		uint32_t ver_rel = (desc / 10000) % 100;
+		uint32_t ver_min = (desc / 1000000) % 100;
+		uint32_t ver_maj = desc / 100000000;
+
+		if (file_printf(ms, " %u.%u", ver_maj, ver_min) == -1)
+			return;
+		if (ver_rel == 0 && ver_patch != 0) {
+			if (file_printf(ms, ".%u", ver_patch) == -1)
+				return;
+		} else if (ver_rel != 0) {
+			while (ver_rel > 26) {
+				if (file_printf(ms, "Z") == -1)
+					return;
+				ver_rel -= 26;
+			}
+			if (file_printf(ms, "%c", 'A' + ver_rel - 1)
+			    == -1)
+				return;
+		}
+	}
+}
+
+static void
+do_note_freebsd_version(struct magic_set *ms, int swap, void *v)
+{
+	uint32_t desc;
+
+	(void)memcpy(&desc, v, sizeof(desc));
+	desc = elf_getu32(swap, desc);
+	if (file_printf(ms, ", for FreeBSD") == -1)
+		return;
+
+	/*
+	 * Contents is __FreeBSD_version, whose relation to OS
+	 * versions is defined by a huge table in the Porter's
+	 * Handbook.  This is the general scheme:
+	 * 
+	 * Releases:
+	 * 	Mmp000 (before 4.10)
+	 * 	Mmi0p0 (before 5.0)
+	 * 	Mmm0p0
+	 * 
+	 * Development branches:
+	 * 	Mmpxxx (before 4.6)
+	 * 	Mmp1xx (before 4.10)
+	 * 	Mmi1xx (before 5.0)
+	 * 	M000xx (pre-M.0)
+	 * 	Mmm1xx
+	 * 
+	 * M = major version
+	 * m = minor version
+	 * i = minor version increment (491000 -> 4.10)
+	 * p = patchlevel
+	 * x = revision
+	 * 
+	 * The first release of FreeBSD to use ELF by default
+	 * was version 3.0.
+	 */
+	if (desc == 460002) {
+		if (file_printf(ms, " 4.6.2") == -1)
+			return;
+	} else if (desc < 460100) {
+		if (file_printf(ms, " %d.%d", desc / 100000,
+		    desc / 10000 % 10) == -1)
+			return;
+		if (desc / 1000 % 10 > 0)
+			if (file_printf(ms, ".%d", desc / 1000 % 10) == -1)
+				return;
+		if ((desc % 1000 > 0) || (desc % 100000 == 0))
+			if (file_printf(ms, " (%d)", desc) == -1)
+				return;
+	} else if (desc < 500000) {
+		if (file_printf(ms, " %d.%d", desc / 100000,
+		    desc / 10000 % 10 + desc / 1000 % 10) == -1)
+			return;
+		if (desc / 100 % 10 > 0) {
+			if (file_printf(ms, " (%d)", desc) == -1)
+				return;
+		} else if (desc / 10 % 10 > 0) {
+			if (file_printf(ms, ".%d", desc / 10 % 10) == -1)
+				return;
+		}
+	} else {
+		if (file_printf(ms, " %d.%d", desc / 100000,
+		    desc / 1000 % 100) == -1)
+			return;
+		if ((desc / 100 % 10 > 0) ||
+		    (desc % 100000 / 100 == 0)) {
+			if (file_printf(ms, " (%d)", desc) == -1)
+				return;
+		} else if (desc / 10 % 10 > 0) {
+			if (file_printf(ms, ".%d", desc / 10 % 10) == -1)
+				return;
+		}
+	}
+}
+
 private size_t
 donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
     int clazz, int swap, size_t align, int *flags)
@@ -416,6 +524,10 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
 	    (FLAGS_DID_NOTE|FLAGS_DID_BUILD_ID))
 		goto core;
 
+	if (namesz == 5 && strcmp((char *)&nbuf[noff], "SuSE") == 0 &&
+	    xnh_type == NT_GNU_VERSION && descsz == 2) {
+	    file_printf(ms, ", for SuSE %d.%d", nbuf[doff], nbuf[doff + 1]);
+	}
 	if (namesz == 4 && strcmp((char *)&nbuf[noff], "GNU") == 0 &&
 	    xnh_type == NT_GNU_VERSION && descsz == 16) {
 		uint32_t desc[4];
@@ -457,139 +569,80 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
 
 	if (namesz == 4 && strcmp((char *)&nbuf[noff], "GNU") == 0 &&
 	    xnh_type == NT_GNU_BUILD_ID && (descsz == 16 || descsz == 20)) {
-	    uint32_t desc[5], i;
-	    if (file_printf(ms, ", BuildID[%s]=0x", descsz == 16 ? "md5/uuid" :
+	    uint8_t desc[20];
+	    uint32_t i;
+	    if (file_printf(ms, ", BuildID[%s]=", descsz == 16 ? "md5/uuid" :
 		"sha1") == -1)
 		    return size;
 	    (void)memcpy(desc, &nbuf[doff], descsz);
-	    for (i = 0; i < descsz >> 2; i++)
-		if (file_printf(ms, "%.8x", desc[i]) == -1)
+	    for (i = 0; i < descsz; i++)
+		if (file_printf(ms, "%02x", desc[i]) == -1)
 		    return size;
 	    *flags |= FLAGS_DID_BUILD_ID;
 	}
 
-	if (namesz == 7 && strcmp((char *)&nbuf[noff], "NetBSD") == 0 &&
-	    xnh_type == NT_NETBSD_VERSION && descsz == 4) {
+	if (namesz == 4 && strcmp((char *)&nbuf[noff], "PaX") == 0 &&
+	    xnh_type == NT_NETBSD_PAX && descsz == 4) {
+		static const char *pax[] = {
+		    "+mprotect",
+		    "-mprotect",
+		    "+segvguard",
+		    "-segvguard",
+		    "+ASLR",
+		    "-ASLR",
+		};
 		uint32_t desc;
+		size_t i;
+		int did = 0;
+
 		(void)memcpy(&desc, &nbuf[doff], sizeof(desc));
 		desc = elf_getu32(swap, desc);
 
-		if (file_printf(ms, ", for NetBSD") == -1)
+		if (desc && file_printf(ms, ", PaX: ") == -1)
 			return size;
-		/*
-		 * The version number used to be stuck as 199905, and was thus
-		 * basically content-free.  Newer versions of NetBSD have fixed
-		 * this and now use the encoding of __NetBSD_Version__:
-		 *
-		 *	MMmmrrpp00
-		 *
-		 * M = major version
-		 * m = minor version
-		 * r = release ["",A-Z,Z[A-Z] but numeric]
-		 * p = patchlevel
-		 */
-		if (desc > 100000000U) {
-			uint32_t ver_patch = (desc / 100) % 100;
-			uint32_t ver_rel = (desc / 10000) % 100;
-			uint32_t ver_min = (desc / 1000000) % 100;
-			uint32_t ver_maj = desc / 100000000;
 
-			if (file_printf(ms, " %u.%u", ver_maj, ver_min) == -1)
+		for (i = 0; i < __arraycount(pax); i++) {
+			if (((1 << i) & desc) == 0)
+				continue;
+			if (file_printf(ms, "%s%s", did++ ? "," : "",
+			    pax[i]) == -1)
 				return size;
-			if (ver_rel == 0 && ver_patch != 0) {
-				if (file_printf(ms, ".%u", ver_patch) == -1)
-					return size;
-			} else if (ver_rel != 0) {
-				while (ver_rel > 26) {
-					if (file_printf(ms, "Z") == -1)
-						return size;
-					ver_rel -= 26;
-				}
-				if (file_printf(ms, "%c", 'A' + ver_rel - 1)
-				    == -1)
-					return size;
-			}
 		}
-		*flags |= FLAGS_DID_NOTE;
+	}
+
+	if (namesz == 7 && strcmp((char *)&nbuf[noff], "NetBSD") == 0) {
+		switch (xnh_type) {
+		case NT_NETBSD_VERSION:
+			if (descsz == 4) {
+				do_note_netbsd_version(ms, swap, &nbuf[doff]);
+				*flags |= FLAGS_DID_NOTE;
+				return size;
+			}
+			break;
+		case NT_NETBSD_MARCH:
+			if (file_printf(ms, ", compiled for: %.*s", (int)descsz,
+			    (const char *)&nbuf[doff]) == -1)
+				return size;
+			break;
+		case NT_NETBSD_CMODEL:
+			if (file_printf(ms, ", compiler model: %.*s",
+			    (int)descsz, (const char *)&nbuf[doff]) == -1)
+				return size;
+			break;
+		default:
+			if (file_printf(ms, ", note=%u", xnh_type) == -1)
+				return size;
+			break;
+		}
 		return size;
 	}
 
-	if (namesz == 8 && strcmp((char *)&nbuf[noff], "FreeBSD") == 0 &&
-	    xnh_type == NT_FREEBSD_VERSION && descsz == 4) {
-		uint32_t desc;
-		(void)memcpy(&desc, &nbuf[doff], sizeof(desc));
-		desc = elf_getu32(swap, desc);
-		if (file_printf(ms, ", for FreeBSD") == -1)
+	if (namesz == 8 && strcmp((char *)&nbuf[noff], "FreeBSD") == 0) {
+	    	if (xnh_type == NT_FREEBSD_VERSION && descsz == 4) {
+			do_note_freebsd_version(ms, swap, &nbuf[doff]);
+			*flags |= FLAGS_DID_NOTE;
 			return size;
-
-		/*
-		 * Contents is __FreeBSD_version, whose relation to OS
-		 * versions is defined by a huge table in the Porter's
-		 * Handbook.  This is the general scheme:
-		 * 
-		 * Releases:
-		 * 	Mmp000 (before 4.10)
-		 * 	Mmi0p0 (before 5.0)
-		 * 	Mmm0p0
-		 * 
-		 * Development branches:
-		 * 	Mmpxxx (before 4.6)
-		 * 	Mmp1xx (before 4.10)
-		 * 	Mmi1xx (before 5.0)
-		 * 	M000xx (pre-M.0)
-		 * 	Mmm1xx
-		 * 
-		 * M = major version
-		 * m = minor version
-		 * i = minor version increment (491000 -> 4.10)
-		 * p = patchlevel
-		 * x = revision
-		 * 
-		 * The first release of FreeBSD to use ELF by default
-		 * was version 3.0.
-		 */
-		if (desc == 460002) {
-			if (file_printf(ms, " 4.6.2") == -1)
-				return size;
-		} else if (desc < 460100) {
-			if (file_printf(ms, " %d.%d", desc / 100000,
-			    desc / 10000 % 10) == -1)
-				return size;
-			if (desc / 1000 % 10 > 0)
-				if (file_printf(ms, ".%d", desc / 1000 % 10)
-				    == -1)
-					return size;
-			if ((desc % 1000 > 0) || (desc % 100000 == 0))
-				if (file_printf(ms, " (%d)", desc) == -1)
-					return size;
-		} else if (desc < 500000) {
-			if (file_printf(ms, " %d.%d", desc / 100000,
-			    desc / 10000 % 10 + desc / 1000 % 10) == -1)
-				return size;
-			if (desc / 100 % 10 > 0) {
-				if (file_printf(ms, " (%d)", desc) == -1)
-					return size;
-			} else if (desc / 10 % 10 > 0) {
-				if (file_printf(ms, ".%d", desc / 10 % 10)
-				    == -1)
-					return size;
-			}
-		} else {
-			if (file_printf(ms, " %d.%d", desc / 100000,
-			    desc / 1000 % 100) == -1)
-				return size;
-			if ((desc / 100 % 10 > 0) ||
-			    (desc % 100000 / 100 == 0)) {
-				if (file_printf(ms, " (%d)", desc) == -1)
-					return size;
-			} else if (desc / 10 % 10 > 0) {
-				if (file_printf(ms, ".%d", desc / 10 % 10)
-				    == -1)
-					return size;
-			}
 		}
-		*flags |= FLAGS_DID_NOTE;
-		return size;
 	}
 
 	if (namesz == 8 && strcmp((char *)&nbuf[noff], "OpenBSD") == 0 &&
@@ -842,15 +895,16 @@ static const cap_desc_t cap_desc_386[] = {
 
 private int
 doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
-    size_t size, off_t fsize, int *flags, int mach)
+    size_t size, off_t fsize, int *flags, int mach, int strtab)
 {
 	Elf32_Shdr sh32;
 	Elf64_Shdr sh64;
 	int stripped = 1;
 	void *nbuf;
-	off_t noff, coff;
+	off_t noff, coff, name_off;
 	uint64_t cap_hw1 = 0;	/* SunOS 5.x hardware capabilites */
 	uint64_t cap_sf1 = 0;	/* SunOS 5.x software capabilites */
+	char name[50];
 
 	if (size != xsh_sizeof) {
 		if (file_printf(ms, ", corrupted section header size") == -1)
@@ -858,12 +912,24 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
 		return 0;
 	}
 
+	/* Read offset of name section to be able to read section names later */
+	if (pread(fd, xsh_addr, xsh_sizeof, off + size * strtab) == -1) {
+		file_badread(ms);
+		return -1;
+	}
+	name_off = xsh_offset;
+
 	for ( ; num; num--) {
-		if (lseek(fd, off, SEEK_SET) == (off_t)-1) {
-			file_badseek(ms);
+		/* Read the name of this section. */
+		if (pread(fd, name, sizeof(name), name_off + xsh_name) == -1) {
+			file_badread(ms);
 			return -1;
 		}
-		if (read(fd, xsh_addr, xsh_sizeof) == -1) {
+		name[sizeof(name) - 1] = '\0';
+		if (strcmp(name, ".debug_info") == 0)
+			stripped = 0;
+
+		if (pread(fd, xsh_addr, xsh_sizeof, off) == -1) {
 			file_badread(ms);
 			return -1;
 		}
@@ -888,39 +954,41 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
 		/* Things we can determine when we seek */
 		switch (xsh_type) {
 		case SHT_NOTE:
-			if ((nbuf = malloc((size_t)xsh_size)) == NULL) {
+			if ((nbuf = malloc(xsh_size)) == NULL) {
 				file_error(ms, errno, "Cannot allocate memory"
 				    " for note");
 				return -1;
 			}
-			if ((noff = lseek(fd, (off_t)xsh_offset, SEEK_SET)) ==
-			    (off_t)-1) {
+			if (pread(fd, nbuf, xsh_size, xsh_offset) == -1) {
 				file_badread(ms);
 				free(nbuf);
 				return -1;
 			}
-			if (read(fd, nbuf, (size_t)xsh_size) !=
-			    (ssize_t)xsh_size) {
-				free(nbuf);
-				file_badread(ms);
-				return -1;
-			}
 
 			noff = 0;
 			for (;;) {
 				if (noff >= (off_t)xsh_size)
 					break;
 				noff = donote(ms, nbuf, (size_t)noff,
-				    (size_t)xsh_size, clazz, swap, 4,
-				    flags);
+				    xsh_size, clazz, swap, 4, flags);
 				if (noff == 0)
 					break;
 			}
 			free(nbuf);
 			break;
 		case SHT_SUNW_cap:
-			if (lseek(fd, (off_t)xsh_offset, SEEK_SET) ==
-			    (off_t)-1) {
+			switch (mach) {
+			case EM_SPARC:
+			case EM_SPARCV9:
+			case EM_IA_64:
+			case EM_386:
+			case EM_AMD64:
+				break;
+			default:
+				goto skip;
+			}
+
+			if (lseek(fd, xsh_offset, SEEK_SET) == (off_t)-1) {
 				file_badseek(ms);
 				return -1;
 			}
@@ -937,6 +1005,36 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
 					file_badread(ms);
 					return -1;
 				}
+				if (cbuf[0] == 'A') {
+#ifdef notyet
+					char *p = cbuf + 1;
+					uint32_t len, tag;
+					memcpy(&len, p, sizeof(len));
+					p += 4;
+					len = getu32(swap, len);
+					if (memcmp("gnu", p, 3) != 0) {
+					    if (file_printf(ms,
+						", unknown capability %.3s", p)
+						== -1)
+						return -1;
+					    break;
+					}
+					p += strlen(p) + 1;
+					tag = *p++;
+					memcpy(&len, p, sizeof(len));
+					p += 4;
+					len = getu32(swap, len);
+					if (tag != 1) {
+					    if (file_printf(ms, ", unknown gnu"
+						" capability tag %d", tag)
+						== -1)
+						return -1;
+					    break;
+					}
+					// gnu attributes 
+#endif
+					break;
+				}
 				(void)memcpy(xcap_addr, cbuf, xcap_sizeof);
 				switch (xcap_tag) {
 				case CA_SUNW_NULL:
@@ -958,12 +1056,13 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
 					break;
 				}
 			}
-			break;
-
+			/*FALLTHROUGH*/
+		skip:
 		default:
 			break;
 		}
 	}
+
 	if (file_printf(ms, ", %sstripped", stripped ? "" : "not ") == -1)
 		return -1;
 	if (cap_hw1) {
@@ -1042,7 +1141,7 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
 	const char *shared_libraries = "";
 	unsigned char nbuf[BUFSIZ];
 	ssize_t bufsize;
-	size_t offset, align;
+	size_t offset, align, len;
 	
 	if (size != xph_sizeof) {
 		if (file_printf(ms, ", corrupted program header size") == -1)
@@ -1051,13 +1150,8 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
 	}
 
   	for ( ; num; num--) {
-		if (lseek(fd, off, SEEK_SET) == (off_t)-1) {
-			file_badseek(ms);
-			return -1;
-		}
-
-  		if (read(fd, xph_addr, xph_sizeof) == -1) {
-  			file_badread(ms);
+		if (pread(fd, xph_addr, xph_sizeof, off) == -1) {
+			file_badread(ms);
 			return -1;
 		}
 
@@ -1095,12 +1189,9 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
 			 * This is a PT_NOTE section; loop through all the notes
 			 * in the section.
 			 */
-			if (lseek(fd, xph_offset, SEEK_SET) == (off_t)-1) {
-				file_badseek(ms);
-				return -1;
-			}
-			bufsize = read(fd, nbuf, ((xph_filesz < sizeof(nbuf)) ?
-			    xph_filesz : sizeof(nbuf)));
+			len = xph_filesz < sizeof(nbuf) ? xph_filesz
+			    : sizeof(nbuf);
+			bufsize = pread(fd, nbuf, len, xph_offset);
 			if (bufsize == -1) {
 				file_badread(ms);
 				return -1;
diff --git a/contrib/file/readelf.h b/contrib/file/src/readelf.h
similarity index 89%
rename from contrib/file/readelf.h
rename to contrib/file/src/readelf.h
index c79e84447b6..732b20c88e7 100644
--- a/contrib/file/readelf.h
+++ b/contrib/file/src/readelf.h
@@ -44,17 +44,9 @@ typedef uint16_t	Elf32_Half;
 typedef uint32_t	Elf32_Word;
 typedef uint8_t		Elf32_Char;
 
-#if SIZEOF_LONG_LONG != 8
-#define	USE_ARRAY_FOR_64BIT_TYPES
-typedef	uint32_t 	Elf64_Addr[2];
-typedef	uint32_t 	Elf64_Off[2];
-typedef uint32_t 	Elf64_Xword[2];
-#else
-#undef USE_ARRAY_FOR_64BIT_TYPES
 typedef	uint64_t 	Elf64_Addr;
 typedef	uint64_t 	Elf64_Off;
 typedef uint64_t 	Elf64_Xword;
-#endif
 typedef uint16_t	Elf64_Half;
 typedef uint32_t	Elf64_Word;
 typedef uint8_t		Elf64_Char;
@@ -224,7 +216,6 @@ typedef struct {
 #define	NT_TASKSTRUCT	4
 #define	NT_PLATFORM	5
 #define	NT_AUXV		6
-#define	NT_THRMISC	7
 
 /* Note types used in executables */
 /* NetBSD executables (name = "NetBSD") */
@@ -264,6 +255,46 @@ typedef struct {
  */
 #define	NT_GNU_BUILD_ID		3
 
+/*
+ * NetBSD-specific note type: PaX.
+ * There should be 1 NOTE per executable.
+ * name: PaX\0
+ * namesz: 4
+ * desc:
+ *	word[0]: capability bitmask
+ * descsz: 4
+ */
+#define NT_NETBSD_PAX		3
+#define NT_NETBSD_PAX_MPROTECT		0x01	/* Force enable Mprotect */
+#define NT_NETBSD_PAX_NOMPROTECT	0x02	/* Force disable Mprotect */
+#define NT_NETBSD_PAX_GUARD		0x04	/* Force enable Segvguard */
+#define NT_NETBSD_PAX_NOGUARD		0x08	/* Force disable Servguard */
+#define NT_NETBSD_PAX_ASLR		0x10	/* Force enable ASLR */
+#define NT_NETBSD_PAX_NOASLR		0x20	/* Force disable ASLR */
+
+/*
+ * NetBSD-specific note type: MACHINE_ARCH.
+ * There should be 1 NOTE per executable.
+ * name:	NetBSD\0
+ * namesz:	7
+ * desc:	string
+ * descsz:	variable
+ */
+#define NT_NETBSD_MARCH		5
+
+/*
+ * NetBSD-specific note type: COMPILER MODEL.
+ * There should be 1 NOTE per executable.
+ * name:	NetBSD\0
+ * namesz:	7
+ * desc:	string
+ * descsz:	variable
+ */
+#define NT_NETBSD_CMODEL	6
+
+#if !defined(ELFSIZE) && defined(ARCH_ELFSIZE)
+#define ELFSIZE ARCH_ELFSIZE
+#endif
 /* SunOS 5.x hardware/software capabilities */
 typedef struct {
 	Elf32_Word	c_tag;
diff --git a/contrib/file/softmagic.c b/contrib/file/src/softmagic.c
similarity index 72%
rename from contrib/file/softmagic.c
rename to contrib/file/src/softmagic.c
index 22e1190af8a..ed97aa79d65 100644
--- a/contrib/file/softmagic.c
+++ b/contrib/file/src/softmagic.c
@@ -32,27 +32,33 @@
 #include "file.h"
 
 #ifndef	lint
-FILE_RCSID("@(#)$File: softmagic.c,v 1.147 2011/11/05 15:44:22 rrt Exp $")
+FILE_RCSID("@(#)$File: softmagic.c,v 1.191 2014/06/04 17:36:34 christos Exp $")
 #endif	/* lint */
 
 #include "magic.h"
+#include 
 #include 
 #include 
 #include 
 #include 
+#if defined(HAVE_LOCALE_H)
+#include 
+#endif
 
 
 private int match(struct magic_set *, struct magic *, uint32_t,
-    const unsigned char *, size_t, int, int);
+    const unsigned char *, size_t, size_t, int, int, int, int, int *, int *,
+    int *);
 private int mget(struct magic_set *, const unsigned char *,
-    struct magic *, size_t, unsigned int, int);
+    struct magic *, size_t, size_t, unsigned int, int, int, int, int, int *,
+    int *, int *);
 private int magiccheck(struct magic_set *, struct magic *);
 private int32_t mprint(struct magic_set *, struct magic *);
 private int32_t moffset(struct magic_set *, struct magic *);
 private void mdebug(uint32_t, const char *, size_t);
 private int mcopy(struct magic_set *, union VALUETYPE *, int, int,
-    const unsigned char *, uint32_t, size_t, size_t);
-private int mconvert(struct magic_set *, struct magic *);
+    const unsigned char *, uint32_t, size_t, struct magic *);
+private int mconvert(struct magic_set *, struct magic *, int);
 private int print_sep(struct magic_set *, int);
 private int handle_annotation(struct magic_set *, struct magic *);
 private void cvt_8(union VALUETYPE *, const struct magic *);
@@ -60,6 +66,7 @@ private void cvt_16(union VALUETYPE *, const struct magic *);
 private void cvt_32(union VALUETYPE *, const struct magic *);
 private void cvt_64(union VALUETYPE *, const struct magic *);
 
+#define OFFSET_OOB(n, o, i)	((n) < (o) || (i) > ((n) - (o)))
 /*
  * softmagic - lookup one file in parsed, in-memory copy of database
  * Passed the name and FILE * of one file to be typed.
@@ -67,18 +74,38 @@ private void cvt_64(union VALUETYPE *, const struct magic *);
 /*ARGSUSED1*/		/* nbytes passed for regularity, maybe need later */
 protected int
 file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
-    int mode, int text)
+    size_t level, int mode, int text)
 {
 	struct mlist *ml;
-	int rv;
-	for (ml = ms->mlist->next; ml != ms->mlist; ml = ml->next)
-		if ((rv = match(ms, ml->magic, ml->nmagic, buf, nbytes, mode,
-		    text)) != 0)
+	int rv, printed_something = 0, need_separator = 0;
+	for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next)
+		if ((rv = match(ms, ml->magic, ml->nmagic, buf, nbytes, 0, mode,
+		    text, 0, level, &printed_something, &need_separator,
+		    NULL)) != 0)
 			return rv;
 
 	return 0;
 }
 
+#define FILE_FMTDEBUG
+#ifdef FILE_FMTDEBUG
+#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
+
+private const char * __attribute__((__format_arg__(3)))
+file_fmtcheck(struct magic_set *ms, const struct magic *m, const char *def,
+	const char *file, size_t line)
+{
+	const char *ptr = fmtcheck(m->desc, def);
+	if (ptr == def)
+		file_magerror(ms,
+		    "%s, %zu: format `%s' does not match with `%s'",
+		    file, line, m->desc, def);
+	return ptr;
+}
+#else
+#define F(a, b, c) fmtcheck((b)->desc, (c))
+#endif
+
 /*
  * Go through the whole list, stopping if you find a match.  Process all
  * the continuations of that match before returning.
@@ -108,16 +135,19 @@ file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
  */
 private int
 match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
-    const unsigned char *s, size_t nbytes, int mode, int text)
+    const unsigned char *s, size_t nbytes, size_t offset, int mode, int text,
+    int flip, int recursion_level, int *printed_something, int *need_separator,
+    int *returnval)
 {
 	uint32_t magindex = 0;
 	unsigned int cont_level = 0;
-	int need_separator = 0;
-	int returnval = 0, e; /* if a match is found it is set to 1*/
+	int returnvalv = 0, e; /* if a match is found it is set to 1*/
 	int firstline = 1; /* a flag to print X\n  X\n- X */
-	int printed_something = 0;
 	int print = (ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0;
 
+	if (returnval == NULL)
+		returnval = &returnvalv;
+
 	if (file_check_mem(ms, cont_level) == -1)
 		return -1;
 
@@ -125,13 +155,16 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
 		int flush = 0;
 		struct magic *m = &magic[magindex];
 
+		if (m->type != FILE_NAME)
 		if ((IS_STRING(m->type) &&
-		     ((text && (m->str_flags & (STRING_BINTEST | STRING_TEXTTEST)) == STRING_BINTEST) ||
-		      (!text && (m->str_flags & (STRING_TEXTTEST | STRING_BINTEST)) == STRING_TEXTTEST))) ||
+#define FLT (STRING_BINTEST | STRING_TEXTTEST)
+		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
+		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
 		    (m->flag & mode) != mode) {
 			/* Skip sub-tests */
-			while (magic[magindex + 1].cont_level != 0 &&
-			       ++magindex < nmagic)
+			while (magindex + 1 < nmagic &&
+                               magic[magindex + 1].cont_level != 0 &&
+			       ++magindex)
 				continue;
 			continue; /* Skip to next top-level test*/
 		}
@@ -140,7 +173,9 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
 		ms->line = m->lineno;
 
 		/* if main entry matches, print it... */
-		switch (mget(ms, s, m, nbytes, cont_level, text)) {
+		switch (mget(ms, s, m, nbytes, offset, cont_level, mode, text,
+		    flip, recursion_level + 1, printed_something,
+		    need_separator, returnval)) {
 		case -1:
 			return -1;
 		case 0:
@@ -148,7 +183,7 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
 			break;
 		default:
 			if (m->type == FILE_INDIRECT)
-				returnval = 1;
+				*returnval = 1;
 
 			switch (magiccheck(ms, m)) {
 			case -1:
@@ -173,15 +208,19 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
 			continue;
 		}
 
-		if ((e = handle_annotation(ms, m)) != 0)
+		if ((e = handle_annotation(ms, m)) != 0) {
+			*need_separator = 1;
+			*printed_something = 1;
+			*returnval = 1;
 			return e;
+		}
 		/*
 		 * If we are going to print something, we'll need to print
 		 * a blank before we print something else.
 		 */
 		if (*m->desc) {
-			need_separator = 1;
-			printed_something = 1;
+			*need_separator = 1;
+			*printed_something = 1;
 			if (print_sep(ms, firstline) == -1)
 				return -1;
 		}
@@ -196,8 +235,8 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
 		if (file_check_mem(ms, ++cont_level) == -1)
 			return -1;
 
-		while (magic[magindex+1].cont_level != 0 &&
-		    ++magindex < nmagic) {
+		while (++magindex < nmagic &&
+		    magic[magindex].cont_level != 0) {
 			m = &magic[magindex];
 			ms->line = m->lineno; /* for messages */
 
@@ -223,7 +262,9 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
 					continue;
 			}
 #endif
-			switch (mget(ms, s, m, nbytes, cont_level, text)) {
+			switch (mget(ms, s, m, nbytes, offset, cont_level, mode,
+			    text, flip, recursion_level + 1, printed_something,
+			    need_separator, returnval)) {
 			case -1:
 				return -1;
 			case 0:
@@ -233,7 +274,7 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
 				break;
 			default:
 				if (m->type == FILE_INDIRECT)
-					returnval = 1;
+					*returnval = 1;
 				flush = 0;
 				break;
 			}
@@ -250,21 +291,26 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
 #ifdef ENABLE_CONDITIONALS
 				ms->c.li[cont_level].last_match = 1;
 #endif
-				if (m->type != FILE_DEFAULT)
-					ms->c.li[cont_level].got_match = 1;
-				else if (ms->c.li[cont_level].got_match) {
+				if (m->type == FILE_CLEAR)
 					ms->c.li[cont_level].got_match = 0;
-					break;
-				}
-				if ((e = handle_annotation(ms, m)) != 0)
+				else if (ms->c.li[cont_level].got_match) {
+					if (m->type == FILE_DEFAULT)
+						break;
+				} else
+					ms->c.li[cont_level].got_match = 1;
+				if ((e = handle_annotation(ms, m)) != 0) {
+					*need_separator = 1;
+					*printed_something = 1;
+					*returnval = 1;
 					return e;
+				}
 				/*
 				 * If we are going to print something,
 				 * make sure that we have a separator first.
 				 */
 				if (*m->desc) {
-					if (!printed_something) {
-						printed_something = 1;
+					if (!*printed_something) {
+						*printed_something = 1;
 						if (print_sep(ms, firstline)
 						    == -1)
 							return -1;
@@ -277,13 +323,13 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
 				 * this item isn't empty.
 				 */
 				/* space if previous printed */
-				if (need_separator
+				if (*need_separator
 				    && ((m->flag & NOSPACE) == 0)
 				    && *m->desc) {
 					if (print &&
 					    file_printf(ms, " ") == -1)
 						return -1;
-					need_separator = 0;
+					*need_separator = 0;
 				}
 				if (print && mprint(ms, m) == -1)
 					return -1;
@@ -291,7 +337,7 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
 				ms->c.li[cont_level].off = moffset(ms, m);
 
 				if (*m->desc)
-					need_separator = 1;
+					*need_separator = 1;
 
 				/*
 				 * If we see any continuations
@@ -303,38 +349,36 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
 				break;
 			}
 		}
-		if (printed_something) {
+		if (*printed_something) {
 			firstline = 0;
 			if (print)
-				returnval = 1;
+				*returnval = 1;
 		}
-		if ((ms->flags & MAGIC_CONTINUE) == 0 && printed_something) {
-			return returnval; /* don't keep searching */
+		if ((ms->flags & MAGIC_CONTINUE) == 0 && *printed_something) {
+			return *returnval; /* don't keep searching */
 		}
 	}
-	return returnval;  /* This is hit if -k is set or there is no match */
+	return *returnval;  /* This is hit if -k is set or there is no match */
 }
 
 private int
 check_fmt(struct magic_set *ms, struct magic *m)
 {
-	regex_t rx;
-	int rc;
+	file_regex_t rx;
+	int rc, rv = -1;
 
 	if (strchr(m->desc, '%') == NULL)
 		return 0;
 
-	rc = regcomp(&rx, "%[-0-9\\.]*s", REG_EXTENDED|REG_NOSUB);
+	rc = file_regcomp(&rx, "%[-0-9\\.]*s", REG_EXTENDED|REG_NOSUB);
 	if (rc) {
-		char errmsg[512];
-		(void)regerror(rc, &rx, errmsg, sizeof(errmsg));
-		file_magerror(ms, "regex error %d, (%s)", rc, errmsg);
-		return -1;
+		file_regerror(&rx, rc, ms);
 	} else {
-		rc = regexec(&rx, m->desc, 0, 0, 0);
-		regfree(&rx);
-		return !rc;
+		rc = file_regexec(&rx, m->desc, 0, 0, 0);
+		rv = !rc;
 	}
+	file_regfree(&rx);
+	return rv;
 }
 
 #ifndef HAVE_STRNDUP
@@ -363,7 +407,7 @@ mprint(struct magic_set *ms, struct magic *m)
 	float vf;
 	double vd;
 	int64_t t = 0;
- 	char buf[128];
+ 	char buf[128], tbuf[26];
 	union VALUETYPE *p = &ms->ms_value;
 
   	switch (m->type) {
@@ -373,13 +417,14 @@ mprint(struct magic_set *ms, struct magic *m)
 		case -1:
 			return -1;
 		case 1:
-			(void)snprintf(buf, sizeof(buf), "%c",
+			(void)snprintf(buf, sizeof(buf), "%d",
 			    (unsigned char)v);
-			if (file_printf(ms, m->desc, buf) == -1)
+			if (file_printf(ms, F(ms, m, "%s"), buf) == -1)
 				return -1;
 			break;
 		default:
-			if (file_printf(ms, m->desc, (unsigned char) v) == -1)
+			if (file_printf(ms, F(ms, m, "%d"),
+			    (unsigned char) v) == -1)
 				return -1;
 			break;
 		}
@@ -394,14 +439,14 @@ mprint(struct magic_set *ms, struct magic *m)
 		case -1:
 			return -1;
 		case 1:
-			(void)snprintf(buf, sizeof(buf), "%hu",
+			(void)snprintf(buf, sizeof(buf), "%u",
 			    (unsigned short)v);
-			if (file_printf(ms, m->desc, buf) == -1)
+			if (file_printf(ms, F(ms, m, "%s"), buf) == -1)
 				return -1;
 			break;
 		default:
-			if (
-			    file_printf(ms, m->desc, (unsigned short) v) == -1)
+			if (file_printf(ms, F(ms, m, "%u"),
+			    (unsigned short) v) == -1)
 				return -1;
 			break;
 		}
@@ -417,12 +462,12 @@ mprint(struct magic_set *ms, struct magic *m)
 		case -1:
 			return -1;
 		case 1:
-			(void)snprintf(buf, sizeof(buf), "%u", (uint32_t)v);
-			if (file_printf(ms, m->desc, buf) == -1)
+			(void)snprintf(buf, sizeof(buf), "%u", (uint32_t) v);
+			if (file_printf(ms, F(ms, m, "%s"), buf) == -1)
 				return -1;
 			break;
 		default:
-			if (file_printf(ms, m->desc, (uint32_t) v) == -1)
+			if (file_printf(ms, F(ms, m, "%u"), (uint32_t) v) == -1)
 				return -1;
 			break;
 		}
@@ -433,8 +478,21 @@ mprint(struct magic_set *ms, struct magic *m)
   	case FILE_BEQUAD:
   	case FILE_LEQUAD:
 		v = file_signextend(ms, m, p->q);
-		if (file_printf(ms, m->desc, (uint64_t) v) == -1)
+		switch (check_fmt(ms, m)) {
+		case -1:
 			return -1;
+		case 1:
+			(void)snprintf(buf, sizeof(buf), "%" INT64_T_FORMAT "u",
+			    (unsigned long long)v);
+			if (file_printf(ms, F(ms, m, "%s"), buf) == -1)
+				return -1;
+			break;
+		default:
+			if (file_printf(ms, F(ms, m, "%" INT64_T_FORMAT "u"),
+			    (unsigned long long) v) == -1)
+				return -1;
+			break;
+		}
 		t = ms->offset + sizeof(int64_t);
   		break;
 
@@ -443,16 +501,35 @@ mprint(struct magic_set *ms, struct magic *m)
   	case FILE_BESTRING16:
   	case FILE_LESTRING16:
 		if (m->reln == '=' || m->reln == '!') {
-			if (file_printf(ms, m->desc, m->value.s) == -1)
+			if (file_printf(ms, F(ms, m, "%s"), m->value.s) == -1)
 				return -1;
 			t = ms->offset + m->vallen;
 		}
 		else {
+			char *str = p->s;
+
+			/* compute t before we mangle the string? */
+			t = ms->offset + strlen(str);
+
 			if (*m->value.s == '\0')
-				p->s[strcspn(p->s, "\n")] = '\0';
-			if (file_printf(ms, m->desc, p->s) == -1)
+				str[strcspn(str, "\n")] = '\0';
+
+			if (m->str_flags & STRING_TRIM) {
+				char *last;
+				while (isspace((unsigned char)*str))
+					str++;
+				last = str;
+				while (*last)
+					last++;
+				--last;
+				while (isspace((unsigned char)*last))
+					last--;
+				*++last = '\0';
+			}
+
+			if (file_printf(ms, F(ms, m, "%s"), str) == -1)
 				return -1;
-			t = ms->offset + strlen(p->s);
+
 			if (m->type == FILE_PSTRING)
 				t += file_pstring_length_size(m);
 		}
@@ -462,25 +539,27 @@ mprint(struct magic_set *ms, struct magic *m)
 	case FILE_BEDATE:
 	case FILE_LEDATE:
 	case FILE_MEDATE:
-		if (file_printf(ms, m->desc, file_fmttime(p->l, 1)) == -1)
+		if (file_printf(ms, F(ms, m, "%s"),
+		    file_fmttime(p->l + m->num_mask, FILE_T_LOCAL, tbuf)) == -1)
 			return -1;
-		t = ms->offset + sizeof(time_t);
+		t = ms->offset + sizeof(uint32_t);
 		break;
 
 	case FILE_LDATE:
 	case FILE_BELDATE:
 	case FILE_LELDATE:
 	case FILE_MELDATE:
-		if (file_printf(ms, m->desc, file_fmttime(p->l, 0)) == -1)
+		if (file_printf(ms, F(ms, m, "%s"),
+		    file_fmttime(p->l + m->num_mask, 0, tbuf)) == -1)
 			return -1;
-		t = ms->offset + sizeof(time_t);
+		t = ms->offset + sizeof(uint32_t);
 		break;
 
 	case FILE_QDATE:
 	case FILE_BEQDATE:
 	case FILE_LEQDATE:
-		if (file_printf(ms, m->desc, file_fmttime((uint32_t)p->q,
-		    1)) == -1)
+		if (file_printf(ms, F(ms, m, "%s"),
+		    file_fmttime(p->q + m->num_mask, FILE_T_LOCAL, tbuf)) == -1)
 			return -1;
 		t = ms->offset + sizeof(uint64_t);
 		break;
@@ -488,8 +567,17 @@ mprint(struct magic_set *ms, struct magic *m)
 	case FILE_QLDATE:
 	case FILE_BEQLDATE:
 	case FILE_LEQLDATE:
-		if (file_printf(ms, m->desc, file_fmttime((uint32_t)p->q,
-		    0)) == -1)
+		if (file_printf(ms, F(ms, m, "%s"),
+		    file_fmttime(p->q + m->num_mask, 0, tbuf)) == -1)
+			return -1;
+		t = ms->offset + sizeof(uint64_t);
+		break;
+
+	case FILE_QWDATE:
+	case FILE_BEQWDATE:
+	case FILE_LEQWDATE:
+		if (file_printf(ms, F(ms, m, "%s"),
+		    file_fmttime(p->q + m->num_mask, FILE_T_WINDOWS, tbuf)) == -1)
 			return -1;
 		t = ms->offset + sizeof(uint64_t);
 		break;
@@ -503,11 +591,11 @@ mprint(struct magic_set *ms, struct magic *m)
 			return -1;
 		case 1:
 			(void)snprintf(buf, sizeof(buf), "%g", vf);
-			if (file_printf(ms, m->desc, buf) == -1)
+			if (file_printf(ms, F(ms, m, "%s"), buf) == -1)
 				return -1;
 			break;
 		default:
-			if (file_printf(ms, m->desc, vf) == -1)
+			if (file_printf(ms, F(ms, m, "%g"), vf) == -1)
 				return -1;
 			break;
 		}
@@ -523,11 +611,11 @@ mprint(struct magic_set *ms, struct magic *m)
 			return -1;
 		case 1:
 			(void)snprintf(buf, sizeof(buf), "%g", vd);
-			if (file_printf(ms, m->desc, buf) == -1)
+			if (file_printf(ms, F(ms, m, "%s"), buf) == -1)
 				return -1;
 			break;
 		default:
-			if (file_printf(ms, m->desc, vd) == -1)
+			if (file_printf(ms, F(ms, m, "%g"), vd) == -1)
 				return -1;
 			break;
 		}
@@ -543,7 +631,7 @@ mprint(struct magic_set *ms, struct magic *m)
 			file_oomem(ms, ms->search.rm_len);
 			return -1;
 		}
-		rval = file_printf(ms, m->desc, cp);
+		rval = file_printf(ms, F(ms, m, "%s"), cp);
 		free(cp);
 
 		if (rval == -1)
@@ -557,7 +645,7 @@ mprint(struct magic_set *ms, struct magic *m)
 	}
 
 	case FILE_SEARCH:
-	  	if (file_printf(ms, m->desc, m->value.s) == -1)
+	  	if (file_printf(ms, F(ms, m, "%s"), m->value.s) == -1)
 			return -1;
 		if ((m->str_flags & REGEX_OFFSET_START))
 			t = ms->search.offset;
@@ -566,12 +654,15 @@ mprint(struct magic_set *ms, struct magic *m)
 		break;
 
 	case FILE_DEFAULT:
-	  	if (file_printf(ms, m->desc, m->value.s) == -1)
+	case FILE_CLEAR:
+	  	if (file_printf(ms, "%s", m->desc) == -1)
 			return -1;
 		t = ms->offset;
 		break;
 
 	case FILE_INDIRECT:
+	case FILE_USE:
+	case FILE_NAME:
 		t = ms->offset;
 		break;
 
@@ -619,7 +710,7 @@ moffset(struct magic_set *ms, struct magic *m)
 				p->s[strcspn(p->s, "\n")] = '\0';
 			t = CAST(uint32_t, (ms->offset + strlen(p->s)));
 			if (m->type == FILE_PSTRING)
-				t += file_pstring_length_size(m);
+				t += (uint32_t)file_pstring_length_size(m);
 			return t;
 		}
 
@@ -627,13 +718,13 @@ moffset(struct magic_set *ms, struct magic *m)
 	case FILE_BEDATE:
 	case FILE_LEDATE:
 	case FILE_MEDATE:
-		return CAST(int32_t, (ms->offset + sizeof(time_t)));
+		return CAST(int32_t, (ms->offset + sizeof(uint32_t)));
 
 	case FILE_LDATE:
 	case FILE_BELDATE:
 	case FILE_LELDATE:
 	case FILE_MELDATE:
-		return CAST(int32_t, (ms->offset + sizeof(time_t)));
+		return CAST(int32_t, (ms->offset + sizeof(uint32_t)));
 
 	case FILE_QDATE:
 	case FILE_BEQDATE:
@@ -668,9 +759,8 @@ moffset(struct magic_set *ms, struct magic *m)
 		else
 			return CAST(int32_t, (ms->search.offset + m->vallen));
 
+	case FILE_CLEAR:
 	case FILE_DEFAULT:
-		return ms->offset;
-
 	case FILE_INDIRECT:
 		return ms->offset;
 
@@ -679,6 +769,56 @@ moffset(struct magic_set *ms, struct magic *m)
 	}
 }
 
+private int
+cvt_flip(int type, int flip)
+{
+	if (flip == 0)
+		return type;
+	switch (type) {
+	case FILE_BESHORT:
+		return FILE_LESHORT;
+	case FILE_BELONG:
+		return FILE_LELONG;
+	case FILE_BEDATE:
+		return FILE_LEDATE;
+	case FILE_BELDATE:
+		return FILE_LELDATE;
+	case FILE_BEQUAD:
+		return FILE_LEQUAD;
+	case FILE_BEQDATE:
+		return FILE_LEQDATE;
+	case FILE_BEQLDATE:
+		return FILE_LEQLDATE;
+	case FILE_BEQWDATE:
+		return FILE_LEQWDATE;
+	case FILE_LESHORT:
+		return FILE_BESHORT;
+	case FILE_LELONG:
+		return FILE_BELONG;
+	case FILE_LEDATE:
+		return FILE_BEDATE;
+	case FILE_LELDATE:
+		return FILE_BELDATE;
+	case FILE_LEQUAD:
+		return FILE_BEQUAD;
+	case FILE_LEQDATE:
+		return FILE_BEQDATE;
+	case FILE_LEQLDATE:
+		return FILE_BEQLDATE;
+	case FILE_LEQWDATE:
+		return FILE_BEQWDATE;
+	case FILE_BEFLOAT:
+		return FILE_LEFLOAT;
+	case FILE_LEFLOAT:
+		return FILE_BEFLOAT;
+	case FILE_BEDOUBLE:
+		return FILE_LEDOUBLE;
+	case FILE_LEDOUBLE:
+		return FILE_BEDOUBLE;
+	default:
+		return type;
+	}
+}
 #define DO_CVT(fld, cast) \
 	if (m->num_mask) \
 		switch (m->mask_op & FILE_OPS_MASK) { \
@@ -769,11 +909,12 @@ cvt_double(union VALUETYPE *p, const struct magic *m)
  * (unless you have a better idea)
  */
 private int
-mconvert(struct magic_set *ms, struct magic *m)
+mconvert(struct magic_set *ms, struct magic *m, int flip)
 {
 	union VALUETYPE *p = &ms->ms_value;
+	uint8_t type;
 
-	switch (m->type) {
+	switch (type = cvt_flip(m->type, flip)) {
 	case FILE_BYTE:
 		cvt_8(p, m);
 		return 1;
@@ -788,6 +929,7 @@ mconvert(struct magic_set *ms, struct magic *m)
 	case FILE_QUAD:
 	case FILE_QDATE:
 	case FILE_QLDATE:
+	case FILE_QWDATE:
 		cvt_64(p, m);
 		return 1;
 	case FILE_STRING:
@@ -798,10 +940,18 @@ mconvert(struct magic_set *ms, struct magic *m)
 		return 1;
 	}
 	case FILE_PSTRING: {
-		char *ptr1 = p->s, *ptr2 = ptr1 + file_pstring_length_size(m);
+		size_t sz = file_pstring_length_size(m);
+		char *ptr1 = p->s, *ptr2 = ptr1 + sz;
 		size_t len = file_pstring_get_length(m, ptr1);
-		if (len >= sizeof(p->s))
-			len = sizeof(p->s) - 1;
+		if (len >= sizeof(p->s)) {
+			/*
+			 * The size of the pascal string length (sz)
+			 * is 1, 2, or 4. We need at least 1 byte for NUL
+			 * termination, but we've already truncated the
+			 * string by p->s, so we need to deduct sz.
+			 */ 
+			len = sizeof(p->s) - sz;
+		}
 		while (len--)
 			*ptr1++ = *ptr2++;
 		*ptr1 = '\0';
@@ -816,17 +966,20 @@ mconvert(struct magic_set *ms, struct magic *m)
 	case FILE_BELDATE:
 		p->l = (int32_t)
 		    ((p->hl[0]<<24)|(p->hl[1]<<16)|(p->hl[2]<<8)|(p->hl[3]));
-		cvt_32(p, m);
+		if (type == FILE_BELONG)
+			cvt_32(p, m);
 		return 1;
 	case FILE_BEQUAD:
 	case FILE_BEQDATE:
 	case FILE_BEQLDATE:
+	case FILE_BEQWDATE:
 		p->q = (uint64_t)
 		    (((uint64_t)p->hq[0]<<56)|((uint64_t)p->hq[1]<<48)|
 		     ((uint64_t)p->hq[2]<<40)|((uint64_t)p->hq[3]<<32)|
 		     ((uint64_t)p->hq[4]<<24)|((uint64_t)p->hq[5]<<16)|
 		     ((uint64_t)p->hq[6]<<8)|((uint64_t)p->hq[7]));
-		cvt_64(p, m);
+		if (type == FILE_BEQUAD)
+			cvt_64(p, m);
 		return 1;
 	case FILE_LESHORT:
 		p->h = (short)((p->hs[1]<<8)|(p->hs[0]));
@@ -837,24 +990,28 @@ mconvert(struct magic_set *ms, struct magic *m)
 	case FILE_LELDATE:
 		p->l = (int32_t)
 		    ((p->hl[3]<<24)|(p->hl[2]<<16)|(p->hl[1]<<8)|(p->hl[0]));
-		cvt_32(p, m);
+		if (type == FILE_LELONG)
+			cvt_32(p, m);
 		return 1;
 	case FILE_LEQUAD:
 	case FILE_LEQDATE:
 	case FILE_LEQLDATE:
+	case FILE_LEQWDATE:
 		p->q = (uint64_t)
 		    (((uint64_t)p->hq[7]<<56)|((uint64_t)p->hq[6]<<48)|
 		     ((uint64_t)p->hq[5]<<40)|((uint64_t)p->hq[4]<<32)|
 		     ((uint64_t)p->hq[3]<<24)|((uint64_t)p->hq[2]<<16)|
 		     ((uint64_t)p->hq[1]<<8)|((uint64_t)p->hq[0]));
-		cvt_64(p, m);
+		if (type == FILE_LEQUAD)
+			cvt_64(p, m);
 		return 1;
 	case FILE_MELONG:
 	case FILE_MEDATE:
 	case FILE_MELDATE:
 		p->l = (int32_t)
 		    ((p->hl[1]<<24)|(p->hl[0]<<16)|(p->hl[3]<<8)|(p->hl[2]));
-		cvt_32(p, m);
+		if (type == FILE_MELONG)
+			cvt_32(p, m);
 		return 1;
 	case FILE_FLOAT:
 		cvt_float(p, m);
@@ -889,6 +1046,9 @@ mconvert(struct magic_set *ms, struct magic *m)
 	case FILE_REGEX:
 	case FILE_SEARCH:
 	case FILE_DEFAULT:
+	case FILE_CLEAR:
+	case FILE_NAME:
+	case FILE_USE:
 		return 1;
 	default:
 		file_magerror(ms, "invalid type %d in mconvert()", m->type);
@@ -900,7 +1060,7 @@ mconvert(struct magic_set *ms, struct magic *m)
 private void
 mdebug(uint32_t offset, const char *str, size_t len)
 {
-	(void) fprintf(stderr, "mget @%d: ", offset);
+	(void) fprintf(stderr, "mget/%zu @%d: ", len, offset);
 	file_showstr(stderr, str, len);
 	(void) fputc('\n', stderr);
 	(void) fputc('\n', stderr);
@@ -908,7 +1068,7 @@ mdebug(uint32_t offset, const char *str, size_t len)
 
 private int
 mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
-    const unsigned char *s, uint32_t offset, size_t nbytes, size_t linecnt)
+    const unsigned char *s, uint32_t offset, size_t nbytes, struct magic *m)
 {
 	/*
 	 * Note: FILE_SEARCH and FILE_REGEX do not actually copy
@@ -928,15 +1088,29 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
 			const char *last;	/* end of search region */
 			const char *buf;	/* start of search region */
 			const char *end;
-			size_t lines;
+			size_t lines, linecnt, bytecnt;
 
 			if (s == NULL) {
 				ms->search.s_len = 0;
 				ms->search.s = NULL;
 				return 0;
 			}
+
+			if (m->str_flags & REGEX_LINE_COUNT) {
+				linecnt = m->str_range;
+				bytecnt = linecnt * 80;
+			} else {
+				linecnt = 0;
+				bytecnt = m->str_range;
+			}
+
+			if (bytecnt == 0)
+				bytecnt = 8192;
+			if (bytecnt > nbytes)
+				bytecnt = nbytes;
+
 			buf = RCAST(const char *, s) + offset;
-			end = last = RCAST(const char *, s) + nbytes;
+			end = last = RCAST(const char *, s) + bytecnt;
 			/* mget() guarantees buf <= last */
 			for (lines = linecnt, b = buf; lines && b < end &&
 			     ((b = CAST(const char *,
@@ -949,7 +1123,7 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
 					b++;
 			}
 			if (lines)
-				last = RCAST(const char *, s) + nbytes;
+				last = RCAST(const char *, s) + bytecnt;
 
 			ms->search.s = buf;
 			ms->search.s_len = last - buf;
@@ -967,12 +1141,9 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
 			if (type == FILE_BESTRING16)
 				src++;
 
-			/* check for pointer overflow */
-			if (src < s) {
-				file_magerror(ms, "invalid offset %u in mcopy()",
-				    offset);
-				return -1;
-			}
+			/* check that offset is within range */
+			if (offset >= nbytes)
+				break;
 			for (/*EMPTY*/; src < esrc; src += 2, dst++) {
 				if (dst < edst)
 					*dst = *src;
@@ -1017,17 +1188,30 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
 }
 
 private int
-mget(struct magic_set *ms, const unsigned char *s,
-    struct magic *m, size_t nbytes, unsigned int cont_level, int text)
+mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
+    size_t nbytes, size_t o, unsigned int cont_level, int mode, int text,
+    int flip, int recursion_level, int *printed_something,
+    int *need_separator, int *returnval)
 {
-	uint32_t offset = ms->offset;
-	uint32_t count = m->str_range;
+	uint32_t soffset, offset = ms->offset;
+	uint32_t lhs;
+	int rv, oneed_separator, in_type;
+	char *sbuf, *rbuf;
 	union VALUETYPE *p = &ms->ms_value;
+	struct mlist ml;
 
-	if (mcopy(ms, p, m->type, m->flag & INDIR, s, offset, nbytes, count) == -1)
+	if (recursion_level >= 20) {
+		file_error(ms, 0, "recursion nesting exceeded");
+		return -1;
+	}
+
+	if (mcopy(ms, p, m->type, m->flag & INDIR, s, (uint32_t)(offset + o),
+	    (uint32_t)nbytes, m) == -1)
 		return -1;
 
 	if ((ms->flags & MAGIC_DEBUG) != 0) {
+		fprintf(stderr, "mget(type=%d, flag=%x, offset=%u, o=%zu, "
+		    "nbytes=%zu)\n", m->type, m->flag, offset, o, nbytes);
 		mdebug(offset, (char *)(void *)p, sizeof(union VALUETYPE));
 #ifndef COMPILE_ONLY
 		file_mdump(m);
@@ -1039,7 +1223,7 @@ mget(struct magic_set *ms, const unsigned char *s,
 		if (m->in_op & FILE_OPINDIRECT) {
 			const union VALUETYPE *q = CAST(const union VALUETYPE *,
 			    ((const void *)(s + offset + off)));
-			switch (m->in_type) {
+			switch (cvt_flip(m->in_type, flip)) {
 			case FILE_BYTE:
 				off = q->b;
 				break;
@@ -1070,10 +1254,12 @@ mget(struct magic_set *ms, const unsigned char *s,
 						 (q->hl[3]<<8)|(q->hl[2]));
 				break;
 			}
+			if ((ms->flags & MAGIC_DEBUG) != 0)
+				fprintf(stderr, "indirect offs=%u\n", off);
 		}
-		switch (m->in_type) {
+		switch (in_type = cvt_flip(m->in_type, flip)) {
 		case FILE_BYTE:
-			if (nbytes < (offset + 1))
+			if (OFFSET_OOB(nbytes, offset, 1))
 				return 0;
 			if (off) {
 				switch (m->in_op & FILE_OPS_MASK) {
@@ -1108,111 +1294,79 @@ mget(struct magic_set *ms, const unsigned char *s,
 				offset = ~offset;
 			break;
 		case FILE_BESHORT:
-			if (nbytes < (offset + 2))
+			if (OFFSET_OOB(nbytes, offset, 2))
 				return 0;
+			lhs = (p->hs[0] << 8) | p->hs[1];
 			if (off) {
 				switch (m->in_op & FILE_OPS_MASK) {
 				case FILE_OPAND:
-					offset = (short)((p->hs[0]<<8)|
-							 (p->hs[1])) &
-						 off;
+					offset = lhs & off;
 					break;
 				case FILE_OPOR:
-					offset = (short)((p->hs[0]<<8)|
-							 (p->hs[1])) |
-						 off;
+					offset = lhs | off;
 					break;
 				case FILE_OPXOR:
-					offset = (short)((p->hs[0]<<8)|
-							 (p->hs[1])) ^
-						 off;
+					offset = lhs ^ off;
 					break;
 				case FILE_OPADD:
-					offset = (short)((p->hs[0]<<8)|
-							 (p->hs[1])) +
-						 off;
+					offset = lhs + off;
 					break;
 				case FILE_OPMINUS:
-					offset = (short)((p->hs[0]<<8)|
-							 (p->hs[1])) -
-						 off;
+					offset = lhs - off;
 					break;
 				case FILE_OPMULTIPLY:
-					offset = (short)((p->hs[0]<<8)|
-							 (p->hs[1])) *
-						 off;
+					offset = lhs * off;
 					break;
 				case FILE_OPDIVIDE:
-					offset = (short)((p->hs[0]<<8)|
-							 (p->hs[1])) /
-						 off;
+					offset = lhs / off;
 					break;
 				case FILE_OPMODULO:
-					offset = (short)((p->hs[0]<<8)|
-							 (p->hs[1])) %
-						 off;
+					offset = lhs % off;
 					break;
 				}
 			} else
-				offset = (short)((p->hs[0]<<8)|
-						 (p->hs[1]));
+				offset = lhs;
 			if (m->in_op & FILE_OPINVERSE)
 				offset = ~offset;
 			break;
 		case FILE_LESHORT:
-			if (nbytes < (offset + 2))
+			if (OFFSET_OOB(nbytes, offset, 2))
 				return 0;
+			lhs = (p->hs[1] << 8) | p->hs[0];
 			if (off) {
 				switch (m->in_op & FILE_OPS_MASK) {
 				case FILE_OPAND:
-					offset = (short)((p->hs[1]<<8)|
-							 (p->hs[0])) &
-						 off;
+					offset = lhs & off;
 					break;
 				case FILE_OPOR:
-					offset = (short)((p->hs[1]<<8)|
-							 (p->hs[0])) |
-						 off;
+					offset = lhs | off;
 					break;
 				case FILE_OPXOR:
-					offset = (short)((p->hs[1]<<8)|
-							 (p->hs[0])) ^
-						 off;
+					offset = lhs ^ off;
 					break;
 				case FILE_OPADD:
-					offset = (short)((p->hs[1]<<8)|
-							 (p->hs[0])) +
-						 off;
+					offset = lhs + off;
 					break;
 				case FILE_OPMINUS:
-					offset = (short)((p->hs[1]<<8)|
-							 (p->hs[0])) -
-						 off;
+					offset = lhs - off;
 					break;
 				case FILE_OPMULTIPLY:
-					offset = (short)((p->hs[1]<<8)|
-							 (p->hs[0])) *
-						 off;
+					offset = lhs * off;
 					break;
 				case FILE_OPDIVIDE:
-					offset = (short)((p->hs[1]<<8)|
-							 (p->hs[0])) /
-						 off;
+					offset = lhs / off;
 					break;
 				case FILE_OPMODULO:
-					offset = (short)((p->hs[1]<<8)|
-							 (p->hs[0])) %
-						 off;
+					offset = lhs % off;
 					break;
 				}
 			} else
-				offset = (short)((p->hs[1]<<8)|
-						 (p->hs[0]));
+				offset = lhs;
 			if (m->in_op & FILE_OPINVERSE)
 				offset = ~offset;
 			break;
 		case FILE_SHORT:
-			if (nbytes < (offset + 2))
+			if (OFFSET_OOB(nbytes, offset, 2))
 				return 0;
 			if (off) {
 				switch (m->in_op & FILE_OPS_MASK) {
@@ -1249,218 +1403,119 @@ mget(struct magic_set *ms, const unsigned char *s,
 			break;
 		case FILE_BELONG:
 		case FILE_BEID3:
-			if (nbytes < (offset + 4))
+			if (OFFSET_OOB(nbytes, offset, 4))
 				return 0;
+			lhs = (p->hl[0] << 24) | (p->hl[1] << 16) |
+			    (p->hl[2] << 8) | p->hl[3];
 			if (off) {
 				switch (m->in_op & FILE_OPS_MASK) {
 				case FILE_OPAND:
-					offset = (int32_t)((p->hl[0]<<24)|
-							 (p->hl[1]<<16)|
-							 (p->hl[2]<<8)|
-							 (p->hl[3])) &
-						 off;
+					offset = lhs & off;
 					break;
 				case FILE_OPOR:
-					offset = (int32_t)((p->hl[0]<<24)|
-							 (p->hl[1]<<16)|
-							 (p->hl[2]<<8)|
-							 (p->hl[3])) |
-						 off;
+					offset = lhs | off;
 					break;
 				case FILE_OPXOR:
-					offset = (int32_t)((p->hl[0]<<24)|
-							 (p->hl[1]<<16)|
-							 (p->hl[2]<<8)|
-							 (p->hl[3])) ^
-						 off;
+					offset = lhs ^ off;
 					break;
 				case FILE_OPADD:
-					offset = (int32_t)((p->hl[0]<<24)|
-							 (p->hl[1]<<16)|
-							 (p->hl[2]<<8)|
-							 (p->hl[3])) +
-						 off;
+					offset = lhs + off;
 					break;
 				case FILE_OPMINUS:
-					offset = (int32_t)((p->hl[0]<<24)|
-							 (p->hl[1]<<16)|
-							 (p->hl[2]<<8)|
-							 (p->hl[3])) -
-						 off;
+					offset = lhs - off;
 					break;
 				case FILE_OPMULTIPLY:
-					offset = (int32_t)((p->hl[0]<<24)|
-							 (p->hl[1]<<16)|
-							 (p->hl[2]<<8)|
-							 (p->hl[3])) *
-						 off;
+					offset = lhs * off;
 					break;
 				case FILE_OPDIVIDE:
-					offset = (int32_t)((p->hl[0]<<24)|
-							 (p->hl[1]<<16)|
-							 (p->hl[2]<<8)|
-							 (p->hl[3])) /
-						 off;
+					offset = lhs / off;
 					break;
 				case FILE_OPMODULO:
-					offset = (int32_t)((p->hl[0]<<24)|
-							 (p->hl[1]<<16)|
-							 (p->hl[2]<<8)|
-							 (p->hl[3])) %
-						 off;
+					offset = lhs % off;
 					break;
 				}
 			} else
-				offset = (int32_t)((p->hl[0]<<24)|
-						 (p->hl[1]<<16)|
-						 (p->hl[2]<<8)|
-						 (p->hl[3]));
+				offset = lhs;
 			if (m->in_op & FILE_OPINVERSE)
 				offset = ~offset;
 			break;
 		case FILE_LELONG:
 		case FILE_LEID3:
-			if (nbytes < (offset + 4))
+			if (OFFSET_OOB(nbytes, offset, 4))
 				return 0;
+			lhs = (p->hl[3] << 24) | (p->hl[2] << 16) |
+			    (p->hl[1] << 8) | p->hl[0];
 			if (off) {
 				switch (m->in_op & FILE_OPS_MASK) {
 				case FILE_OPAND:
-					offset = (int32_t)((p->hl[3]<<24)|
-							 (p->hl[2]<<16)|
-							 (p->hl[1]<<8)|
-							 (p->hl[0])) &
-						 off;
+					offset = lhs & off;
 					break;
 				case FILE_OPOR:
-					offset = (int32_t)((p->hl[3]<<24)|
-							 (p->hl[2]<<16)|
-							 (p->hl[1]<<8)|
-							 (p->hl[0])) |
-						 off;
+					offset = lhs | off;
 					break;
 				case FILE_OPXOR:
-					offset = (int32_t)((p->hl[3]<<24)|
-							 (p->hl[2]<<16)|
-							 (p->hl[1]<<8)|
-							 (p->hl[0])) ^
-						 off;
+					offset = lhs ^ off;
 					break;
 				case FILE_OPADD:
-					offset = (int32_t)((p->hl[3]<<24)|
-							 (p->hl[2]<<16)|
-							 (p->hl[1]<<8)|
-							 (p->hl[0])) +
-						 off;
+					offset = lhs + off;
 					break;
 				case FILE_OPMINUS:
-					offset = (int32_t)((p->hl[3]<<24)|
-							 (p->hl[2]<<16)|
-							 (p->hl[1]<<8)|
-							 (p->hl[0])) -
-						 off;
+					offset = lhs - off;
 					break;
 				case FILE_OPMULTIPLY:
-					offset = (int32_t)((p->hl[3]<<24)|
-							 (p->hl[2]<<16)|
-							 (p->hl[1]<<8)|
-							 (p->hl[0])) *
-						 off;
+					offset = lhs * off;
 					break;
 				case FILE_OPDIVIDE:
-					offset = (int32_t)((p->hl[3]<<24)|
-							 (p->hl[2]<<16)|
-							 (p->hl[1]<<8)|
-							 (p->hl[0])) /
-						 off;
+					offset = lhs / off;
 					break;
 				case FILE_OPMODULO:
-					offset = (int32_t)((p->hl[3]<<24)|
-							 (p->hl[2]<<16)|
-							 (p->hl[1]<<8)|
-							 (p->hl[0])) %
-						 off;
+					offset = lhs % off;
 					break;
 				}
 			} else
-				offset = (int32_t)((p->hl[3]<<24)|
-						 (p->hl[2]<<16)|
-						 (p->hl[1]<<8)|
-						 (p->hl[0]));
+				offset = lhs;
 			if (m->in_op & FILE_OPINVERSE)
 				offset = ~offset;
 			break;
 		case FILE_MELONG:
-			if (nbytes < (offset + 4))
+			if (OFFSET_OOB(nbytes, offset, 4))
 				return 0;
+			lhs = (p->hl[1] << 24) | (p->hl[0] << 16) |
+			    (p->hl[3] << 8) | p->hl[2];
 			if (off) {
 				switch (m->in_op & FILE_OPS_MASK) {
 				case FILE_OPAND:
-					offset = (int32_t)((p->hl[1]<<24)|
-							 (p->hl[0]<<16)|
-							 (p->hl[3]<<8)|
-							 (p->hl[2])) &
-						 off;
+					offset = lhs & off;
 					break;
 				case FILE_OPOR:
-					offset = (int32_t)((p->hl[1]<<24)|
-							 (p->hl[0]<<16)|
-							 (p->hl[3]<<8)|
-							 (p->hl[2])) |
-						 off;
+					offset = lhs | off;
 					break;
 				case FILE_OPXOR:
-					offset = (int32_t)((p->hl[1]<<24)|
-							 (p->hl[0]<<16)|
-							 (p->hl[3]<<8)|
-							 (p->hl[2])) ^
-						 off;
+					offset = lhs ^ off;
 					break;
 				case FILE_OPADD:
-					offset = (int32_t)((p->hl[1]<<24)|
-							 (p->hl[0]<<16)|
-							 (p->hl[3]<<8)|
-							 (p->hl[2])) +
-						 off;
+					offset = lhs + off;
 					break;
 				case FILE_OPMINUS:
-					offset = (int32_t)((p->hl[1]<<24)|
-							 (p->hl[0]<<16)|
-							 (p->hl[3]<<8)|
-							 (p->hl[2])) -
-						 off;
+					offset = lhs - off;
 					break;
 				case FILE_OPMULTIPLY:
-					offset = (int32_t)((p->hl[1]<<24)|
-							 (p->hl[0]<<16)|
-							 (p->hl[3]<<8)|
-							 (p->hl[2])) *
-						 off;
+					offset = lhs * off;
 					break;
 				case FILE_OPDIVIDE:
-					offset = (int32_t)((p->hl[1]<<24)|
-							 (p->hl[0]<<16)|
-							 (p->hl[3]<<8)|
-							 (p->hl[2])) /
-						 off;
+					offset = lhs / off;
 					break;
 				case FILE_OPMODULO:
-					offset = (int32_t)((p->hl[1]<<24)|
-							 (p->hl[0]<<16)|
-							 (p->hl[3]<<8)|
-							 (p->hl[2])) %
-						 off;
+					offset = lhs % off;
 					break;
 				}
 			} else
-				offset = (int32_t)((p->hl[1]<<24)|
-						 (p->hl[0]<<16)|
-						 (p->hl[3]<<8)|
-						 (p->hl[2]));
+				offset = lhs;
 			if (m->in_op & FILE_OPINVERSE)
 				offset = ~offset;
 			break;
 		case FILE_LONG:
-			if (nbytes < (offset + 4))
+			if (OFFSET_OOB(nbytes, offset, 4))
 				return 0;
 			if (off) {
 				switch (m->in_op & FILE_OPS_MASK) {
@@ -1494,9 +1549,11 @@ mget(struct magic_set *ms, const unsigned char *s,
 			if (m->in_op & FILE_OPINVERSE)
 				offset = ~offset;
 			break;
+		default:
+			break;
 		}
 
-		switch (m->in_type) {
+		switch (in_type) {
 		case FILE_LEID3:
 		case FILE_BEID3:
 			offset = ((((offset >>  0) & 0x7f) <<  0) |
@@ -1510,8 +1567,16 @@ mget(struct magic_set *ms, const unsigned char *s,
 
 		if (m->flag & INDIROFFADD) {
 			offset += ms->c.li[cont_level-1].off;
+			if (offset == 0) {
+				if ((ms->flags & MAGIC_DEBUG) != 0)
+					fprintf(stderr,
+					    "indirect *zero* offset\n");
+				return 0;
+			}
+			if ((ms->flags & MAGIC_DEBUG) != 0)
+				fprintf(stderr, "indirect +offs=%u\n", offset);
 		}
-		if (mcopy(ms, p, m->type, 0, s, offset, nbytes, count) == -1)
+		if (mcopy(ms, p, m->type, 0, s, offset, nbytes, m) == -1)
 			return -1;
 		ms->offset = offset;
 
@@ -1527,14 +1592,14 @@ mget(struct magic_set *ms, const unsigned char *s,
 	/* Verify we have enough data to match magic type */
 	switch (m->type) {
 	case FILE_BYTE:
-		if (nbytes < (offset + 1)) /* should alway be true */
+		if (OFFSET_OOB(nbytes, offset, 1))
 			return 0;
 		break;
 
 	case FILE_SHORT:
 	case FILE_BESHORT:
 	case FILE_LESHORT:
-		if (nbytes < (offset + 2))
+		if (OFFSET_OOB(nbytes, offset, 2))
 			return 0;
 		break;
 
@@ -1553,21 +1618,21 @@ mget(struct magic_set *ms, const unsigned char *s,
 	case FILE_FLOAT:
 	case FILE_BEFLOAT:
 	case FILE_LEFLOAT:
-		if (nbytes < (offset + 4))
+		if (OFFSET_OOB(nbytes, offset, 4))
 			return 0;
 		break;
 
 	case FILE_DOUBLE:
 	case FILE_BEDOUBLE:
 	case FILE_LEDOUBLE:
-		if (nbytes < (offset + 8))
+		if (OFFSET_OOB(nbytes, offset, 8))
 			return 0;
 		break;
 
 	case FILE_STRING:
 	case FILE_PSTRING:
 	case FILE_SEARCH:
-		if (nbytes < (offset + m->vallen))
+		if (OFFSET_OOB(nbytes, offset, m->vallen))
 			return 0;
 		break;
 
@@ -1577,19 +1642,68 @@ mget(struct magic_set *ms, const unsigned char *s,
 		break;
 
 	case FILE_INDIRECT:
-	  	if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
-		    file_printf(ms, "%s", m->desc) == -1)
-			return -1;
+		if (offset == 0)
+			return 0;
 		if (nbytes < offset)
 			return 0;
-		return file_softmagic(ms, s + offset, nbytes - offset,
-		    BINTEST, text);
+		sbuf = ms->o.buf;
+		soffset = ms->offset;
+		ms->o.buf = NULL;
+		ms->offset = 0;
+		rv = file_softmagic(ms, s + offset, nbytes - offset,
+		    recursion_level, BINTEST, text);
+		if ((ms->flags & MAGIC_DEBUG) != 0)
+			fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
+		rbuf = ms->o.buf;
+		ms->o.buf = sbuf;
+		ms->offset = soffset;
+		if (rv == 1) {
+			if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
+			    file_printf(ms, F(ms, m, "%u"), offset) == -1) {
+				free(rbuf);
+				return -1;
+			}
+			if (file_printf(ms, "%s", rbuf) == -1) {
+				free(rbuf);
+				return -1;
+			}
+		}
+		free(rbuf);
+		return rv;
 
+	case FILE_USE:
+		if (nbytes < offset)
+			return 0;
+		sbuf = m->value.s;
+		if (*sbuf == '^') {
+			sbuf++;
+			flip = !flip;
+		}
+		if (file_magicfind(ms, sbuf, &ml) == -1) {
+			file_error(ms, 0, "cannot find entry `%s'", sbuf);
+			return -1;
+		}
+
+		oneed_separator = *need_separator;
+		if (m->flag & NOSPACE)
+			*need_separator = 0;
+		rv = match(ms, ml.magic, ml.nmagic, s, nbytes, offset + o,
+		    mode, text, flip, recursion_level, printed_something,
+		    need_separator, returnval);
+		if (rv != 1)
+		    *need_separator = oneed_separator;
+		return rv;
+
+	case FILE_NAME:
+		if (file_printf(ms, "%s", m->desc) == -1)
+			return -1;
+		return 1;
 	case FILE_DEFAULT:	/* nothing to check */
+	case FILE_CLEAR:
 	default:
 		break;
 	}
-	if (!mconvert(ms, m))
+	if (!mconvert(ms, m, flip))
 		return 0;
 	return 1;
 }
@@ -1714,6 +1828,9 @@ magiccheck(struct magic_set *ms, struct magic *m)
 	case FILE_QLDATE:
 	case FILE_BEQLDATE:
 	case FILE_LEQLDATE:
+	case FILE_QWDATE:
+	case FILE_BEQWDATE:
+	case FILE_LEQWDATE:
 		v = p->q;
 		break;
 
@@ -1744,7 +1861,6 @@ magiccheck(struct magic_set *ms, struct magic *m)
 			break;
 
 		default:
-			matched = 0;
 			file_magerror(ms, "cannot happen with float: invalid relation `%c'",
 			    m->reln);
 			return -1;
@@ -1778,13 +1894,13 @@ magiccheck(struct magic_set *ms, struct magic *m)
 			break;
 
 		default:
-			matched = 0;
 			file_magerror(ms, "cannot happen with double: invalid relation `%c'", m->reln);
 			return -1;
 		}
 		return matched;
 
 	case FILE_DEFAULT:
+	case FILE_CLEAR:
 		l = 0;
 		v = 0;
 		break;
@@ -1816,7 +1932,8 @@ magiccheck(struct magic_set *ms, struct magic *m)
 			if (slen + idx > ms->search.s_len)
 				break;
 
-			v = file_strncmp(m->value.s, ms->search.s + idx, slen, m->str_flags);
+			v = file_strncmp(m->value.s, ms->search.s + idx, slen,
+			    m->str_flags);
 			if (v == 0) {	/* found match */
 				ms->search.offset += idx;
 				break;
@@ -1826,34 +1943,33 @@ magiccheck(struct magic_set *ms, struct magic *m)
 	}
 	case FILE_REGEX: {
 		int rc;
-		regex_t rx;
-		char errmsg[512];
+		file_regex_t rx;
 
 		if (ms->search.s == NULL)
 			return 0;
 
 		l = 0;
-		rc = regcomp(&rx, m->value.s,
+		rc = file_regcomp(&rx, m->value.s,
 		    REG_EXTENDED|REG_NEWLINE|
 		    ((m->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0));
 		if (rc) {
-			(void)regerror(rc, &rx, errmsg, sizeof(errmsg));
-			file_magerror(ms, "regex error %d, (%s)",
-			    rc, errmsg);
+			file_regerror(&rx, rc, ms);
 			v = (uint64_t)-1;
-		}
-		else {
+		} else {
 			regmatch_t pmatch[1];
+			size_t slen = ms->search.s_len;
 #ifndef REG_STARTEND
 #define	REG_STARTEND	0
-			size_t l = ms->search.s_len - 1;
-			char c = ms->search.s[l];
-			((char *)(intptr_t)ms->search.s)[l] = '\0';
+			char c;
+			if (slen != 0)
+				slen--;
+			c = ms->search.s[slen];
+			((char *)(intptr_t)ms->search.s)[slen] = '\0';
 #else
 			pmatch[0].rm_so = 0;
-			pmatch[0].rm_eo = ms->search.s_len;
+			pmatch[0].rm_eo = slen;
 #endif
-			rc = regexec(&rx, (const char *)ms->search.s,
+			rc = file_regexec(&rx, (const char *)ms->search.s,
 			    1, pmatch, REG_STARTEND);
 #if REG_STARTEND == 0
 			((char *)(intptr_t)ms->search.s)[l] = c;
@@ -1872,19 +1988,19 @@ magiccheck(struct magic_set *ms, struct magic *m)
 				break;
 
 			default:
-				(void)regerror(rc, &rx, errmsg, sizeof(errmsg));
-				file_magerror(ms, "regexec error %d, (%s)",
-				    rc, errmsg);
+				file_regerror(&rx, rc, ms);
 				v = (uint64_t)-1;
 				break;
 			}
-			regfree(&rx);
 		}
+		file_regfree(&rx);
 		if (v == (uint64_t)-1)
 			return -1;
 		break;
 	}
 	case FILE_INDIRECT:
+	case FILE_USE:
+	case FILE_NAME:
 		return 1;
 	default:
 		file_magerror(ms, "invalid type %d in magiccheck()", m->type);
@@ -1974,7 +2090,6 @@ magiccheck(struct magic_set *ms, struct magic *m)
 		break;
 
 	default:
-		matched = 0;
 		file_magerror(ms, "cannot happen: invalid relation `%c'",
 		    m->reln);
 		return -1;
diff --git a/sys/ia64/include/cpu.h b/contrib/file/src/strcasestr.c
similarity index 56%
rename from sys/ia64/include/cpu.h
rename to contrib/file/src/strcasestr.c
index 9d7a936097a..3db407f3d8b 100644
--- a/sys/ia64/include/cpu.h
+++ b/contrib/file/src/strcasestr.c
@@ -1,14 +1,11 @@
-/* $FreeBSD$ */
-/* From: NetBSD: cpu.h,v 1.18 1997/09/23 23:17:49 mjacob Exp */
+/*	$NetBSD: strcasestr.c,v 1.3 2005/11/29 03:12:00 christos Exp $	*/
 
 /*-
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990, 1993
+ * Copyright (c) 1990, 1993
  *	The Regents of the University of California.  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.
+ * Chris Torek.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -18,7 +15,7 @@
  * 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
+ * 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.
  *
@@ -33,43 +30,55 @@
  * 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: Utah $Hdr: cpu.h 1.16 91/03/25$
- *
- *	@(#)cpu.h	8.4 (Berkeley) 1/5/94
  */
 
-#ifndef _MACHINE_CPU_H_
-#define _MACHINE_CPU_H_
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: strcasestr.c,v 1.3 2005/11/29 03:12:00 christos Exp $");
+__RCSID("$NetBSD: strncasecmp.c,v 1.2 2007/06/04 18:19:27 christos Exp $");
+#endif /* LIBC_SCCS and not lint */
 
-#include 
+#include "file.h"
 
-#define	TRAPF_PC(tf)		((tf)->tf_special.iip)
-#define	TRAPF_CPL(tf)		((tf)->tf_special.psr & IA64_PSR_CPL)
-#define	TRAPF_USERMODE(tf)	(TRAPF_CPL(tf) != IA64_PSR_CPL_KERN)
+#include 
+#include 
+#include 
 
-#ifdef _KERNEL
+static int
+_strncasecmp(const char *s1, const char *s2, size_t n)
+{
+	if (n != 0) {
+		const unsigned char *us1 = (const unsigned char *)s1,
+				*us2 = (const unsigned char *)s2;
 
-#ifdef GPROF
-extern char btext[];
-extern char etext[];
-#endif
+		do {
+			if (tolower(*us1) != tolower(*us2++))
+				return tolower(*us1) - tolower(*--us2);
+			if (*us1++ == '\0')
+				break;
+		} while (--n != 0);
+	}
+	return 0;
+}
 
 /*
- * Return contents of in-cpu fast counter as a sort of "bogo-time"
- * for non-critical timing.
+ * Find the first occurrence of find in s, ignore case.
  */
-#define	get_cyclecount		ia64_get_itc
+char *
+strcasestr(const char *s, const char *find)
+{
+	char c, sc;
+	size_t len;
 
-/* Used by signaling code. */
-#define	cpu_getstack(td)	((td)->td_frame->tf_special.sp)
-#define	cpu_spinwait()		/* nothing */
-
-void	cpu_halt(void);
-void	cpu_reset(void);
-void	fork_trampoline(void);				/* MAGIC */
-void	swi_vm(void *);
-
-#endif /* _KERNEL */
-
-#endif /* _MACHINE_CPU_H_ */
+	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 (char *)(intptr_t)(s);
+}
diff --git a/contrib/file/strlcat.c b/contrib/file/src/strlcat.c
similarity index 100%
rename from contrib/file/strlcat.c
rename to contrib/file/src/strlcat.c
diff --git a/contrib/file/strlcpy.c b/contrib/file/src/strlcpy.c
similarity index 100%
rename from contrib/file/strlcpy.c
rename to contrib/file/src/strlcpy.c
diff --git a/contrib/file/tar.h b/contrib/file/src/tar.h
similarity index 100%
rename from contrib/file/tar.h
rename to contrib/file/src/tar.h
diff --git a/contrib/file/vasprintf.c b/contrib/file/src/vasprintf.c
similarity index 96%
rename from contrib/file/vasprintf.c
rename to contrib/file/src/vasprintf.c
index 80bd58e7198..cc43ae3bf9b 100644
--- a/contrib/file/vasprintf.c
+++ b/contrib/file/src/vasprintf.c
@@ -83,7 +83,7 @@ trying to do any interpretation
 flag:   none   +     -     #     (blank)
 width:  n    0n    *
 prec:   none   .0    .n     .*
-modifier:    F N L h l ll    ('F' and 'N' are ms-dos/16-bit specific)
+modifier:    F N L h l ll z t    ('F' and 'N' are ms-dos/16-bit specific)
 type:  d i o u x X f e g E G c s p n
 
 
@@ -108,7 +108,7 @@ you use strange formats.
 #include "file.h"
 
 #ifndef	lint
-FILE_RCSID("@(#)$File: vasprintf.c,v 1.8 2011/12/08 12:38:24 rrt Exp $")
+FILE_RCSID("@(#)$File: vasprintf.c,v 1.12 2014/05/14 23:09:21 christos Exp $")
 #endif	/* lint */
 
 #include 
@@ -119,6 +119,9 @@ FILE_RCSID("@(#)$File: vasprintf.c,v 1.8 2011/12/08 12:38:24 rrt Exp $")
 #ifdef HAVE_LIMITS_H
 #include 
 #endif
+#ifdef HAVE_STDDEF_H
+#include 
+#endif
 
 #define ALLOC_CHUNK 2048
 #define ALLOC_SECURITY_MARGIN 1024   /* big value because some platforms have very big 'G' exponent */
@@ -385,7 +388,12 @@ static int dispatch(xprintf_struct *s)
     prec = -1;                  /* no .prec specified */
 
   /* modifier */
-  if (*SRCTXT == 'L' || *SRCTXT == 'h' || *SRCTXT == 'l') {
+  switch (*SRCTXT) {
+  case 'L':
+  case 'h':
+  case 'l':
+  case 'z':
+  case 't':
     modifier = *SRCTXT;
     SRCTXT++;
     if (modifier=='l' && *SRCTXT=='l') {
@@ -393,8 +401,11 @@ static int dispatch(xprintf_struct *s)
       modifier = 'L';  /* 'll' == 'L'      long long == long double */
     } /* only for compatibility ; not portable */
     INCOHERENT_TEST();
-  } else
+    break;
+  default:
     modifier = -1;              /* no modifier specified */
+    break;
+  }
 
   /* type */
   type = *SRCTXT;
@@ -477,6 +488,10 @@ static int dispatch(xprintf_struct *s)
       return print_it(s, (size_t)approx_width, format_string, va_arg(s->vargs, long int));
     case 'h':
       return print_it(s, (size_t)approx_width, format_string, va_arg(s->vargs, int));
+    case 'z':
+      return print_it(s, (size_t)approx_width, format_string, va_arg(s->vargs, size_t));
+    case 't':
+      return print_it(s, (size_t)approx_width, format_string, va_arg(s->vargs, ptrdiff_t));
       /* 'int' instead of 'short int' because default promotion is 'int' */
     default:
       INCOHERENT();
@@ -544,7 +559,7 @@ static int dispatch(xprintf_struct *s)
  */
 static int core(xprintf_struct *s)
 {
-  size_t len, save_len;
+  size_t save_len;
   char *dummy_base;
 
   /* basic checks */
@@ -569,8 +584,7 @@ static int core(xprintf_struct *s)
   for (;;) {
     /* up to end of source string */
     if (*(s->src_string) == 0) {
-      *(s->dest_string) = 0;    /* final 0 */
-      len = s->real_len + 1;
+      *(s->dest_string) = '\0';    /* final NUL */
       break;
     }
 
@@ -579,15 +593,13 @@ static int core(xprintf_struct *s)
 
     /* up to end of dest string */
     if (s->real_len >= s->maxlen) {
-      (s->buffer_base)[s->maxlen] = 0; /* final 0 */
-      len = s->maxlen + 1;
+      (s->buffer_base)[s->maxlen] = '\0'; /* final NUL */
       break;
     }
   }
 
   /* for (v)asnprintf */
   dummy_base = s->buffer_base;
-  save_len = 0;                 /* just to avoid a compiler warning */
 
   dummy_base = s->buffer_base + s->real_len;
   save_len = s->real_len;
@@ -624,7 +636,7 @@ int vasprintf(char **ptr, const char *format_string, va_list vargs)
 #ifdef __va_copy
   __va_copy (s.vargs, vargs);
 #else
-  memcpy (&s.vargs, vargs, sizeof (va_list));
+  memcpy (&s.vargs, &vargs, sizeof (s.va_args));
 #endif /* __va_copy */
 #endif /* va_copy */
   s.maxlen = (size_t)INT_MAX;
diff --git a/contrib/file/tests/Makefile.am b/contrib/file/tests/Makefile.am
index 0665c7b4b4f..c2cb5eee68d 100644
--- a/contrib/file/tests/Makefile.am
+++ b/contrib/file/tests/Makefile.am
@@ -3,9 +3,14 @@ test_LDADD = $(top_builddir)/src/libmagic.la
 test_CPPFLAGS = -I$(top_srcdir)/src
 
 EXTRA_DIST = \
-	gedcom.magic gedcom.testfile gedcom.result
+escapevel.result \
+escapevel.testfile \
+gedcom.result \
+gedcom.testfile \
+issue311docx.result \
+issue311docx.testfile
 
 T = $(top_srcdir)/tests
 check-local:
 	MAGIC=$(top_builddir)/magic/magic ./test
-	for i in $T/*.testfile; do MAGIC=$T/$${i%%.testfile}.magic $(top_builddir)/tests/test $T/$$i $T/$${i%%.testfile}.result; done
+	for i in $T/*.testfile; do echo Running test: $$i; MAGIC=$(top_builddir)/magic/magic ./test $$i $${i%%.testfile}.result; done
diff --git a/contrib/file/tests/Makefile.in b/contrib/file/tests/Makefile.in
index bc428e471ea..691692b0f88 100644
--- a/contrib/file/tests/Makefile.in
+++ b/contrib/file/tests/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.14 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,6 +14,51 @@
 
 @SET_MAKE@
 VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkglibexecdir = $(libexecdir)/@PACKAGE@
@@ -34,7 +78,8 @@ build_triplet = @build@
 host_triplet = @host@
 check_PROGRAMS = test$(EXEEXT)
 subdir = tests
-DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+	$(top_srcdir)/depcomp README
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -49,9 +94,22 @@ CONFIG_CLEAN_VPATH_FILES =
 test_SOURCES = test.c
 test_OBJECTS = test-test.$(OBJEXT)
 test_DEPENDENCIES = $(top_builddir)/src/libmagic.la
-AM_V_lt = $(am__v_lt_$(V))
-am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
 am__v_lt_0 = --silent
+am__v_lt_1 = 
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -62,24 +120,42 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
 	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
 	$(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_$(V))
-am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
-am__v_CC_0 = @echo "  CC    " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
-am__v_at_0 = @
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo "  CC      " $@;
+am__v_CC_1 = 
 CCLD = $(CC)
 LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_$(V))
-am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
-am__v_CCLD_0 = @echo "  CCLD  " $@;
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
-am__v_GEN_0 = @echo "  GEN   " $@;
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo "  CCLD    " $@;
+am__v_CCLD_1 = 
 SOURCES = test.c
 DIST_SOURCES = test.c
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates.  Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+  BEGIN { nonempty = 0; } \
+  { items[$$0] = 1; nonempty = 1; } \
+  END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique.  This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+  list='$(am__tagged_files)'; \
+  unique=`for i in $$list; do \
+    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+  done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -95,11 +171,13 @@ AWK = @AWK@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
+CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -109,6 +187,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
+HAVE_VISIBILITY = @HAVE_VISIBILITY@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -123,6 +202,7 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MINGW = @MINGW@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -150,6 +230,7 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
@@ -183,7 +264,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -202,7 +282,12 @@ top_srcdir = @top_srcdir@
 test_LDADD = $(top_builddir)/src/libmagic.la
 test_CPPFLAGS = -I$(top_srcdir)/src
 EXTRA_DIST = \
-	gedcom.magic gedcom.testfile gedcom.result
+escapevel.result \
+escapevel.testfile \
+gedcom.result \
+gedcom.testfile \
+issue311docx.result \
+issue311docx.testfile
 
 T = $(top_srcdir)/tests
 all: all-am
@@ -218,9 +303,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu tests/Makefile
+	  $(AUTOMAKE) --foreign tests/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -248,7 +333,8 @@ clean-checkPROGRAMS:
 	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
 	echo " rm -f" $$list; \
 	rm -f $$list
-test$(EXEEXT): $(test_OBJECTS) $(test_DEPENDENCIES) 
+
+test$(EXEEXT): $(test_OBJECTS) $(test_DEPENDENCIES) $(EXTRA_test_DEPENDENCIES) 
 	@rm -f test$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(test_OBJECTS) $(test_LDADD) $(LIBS)
 
@@ -261,44 +347,42 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-test.Po@am__quote@
 
 .c.o:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(COMPILE) -c $<
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
 
 .c.obj:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .c.lo:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
 
 test-test.o: test.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test-test.o -MD -MP -MF $(DEPDIR)/test-test.Tpo -c -o test-test.o `test -f 'test.c' || echo '$(srcdir)/'`test.c
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/test-test.Tpo $(DEPDIR)/test-test.Po
-@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='test.c' object='test-test.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='test.c' object='test-test.o' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test-test.o `test -f 'test.c' || echo '$(srcdir)/'`test.c
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test-test.o `test -f 'test.c' || echo '$(srcdir)/'`test.c
 
 test-test.obj: test.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test-test.obj -MD -MP -MF $(DEPDIR)/test-test.Tpo -c -o test-test.obj `if test -f 'test.c'; then $(CYGPATH_W) 'test.c'; else $(CYGPATH_W) '$(srcdir)/test.c'; fi`
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/test-test.Tpo $(DEPDIR)/test-test.Po
-@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='test.c' object='test-test.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='test.c' object='test-test.obj' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test-test.obj `if test -f 'test.c'; then $(CYGPATH_W) 'test.c'; else $(CYGPATH_W) '$(srcdir)/test.c'; fi`
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test-test.obj `if test -f 'test.c'; then $(CYGPATH_W) 'test.c'; else $(CYGPATH_W) '$(srcdir)/test.c'; fi`
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -306,26 +390,15 @@ mostlyclean-libtool:
 clean-libtool:
 	-rm -rf .libs _libs
 
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
+ID: $(am__tagged_files)
+	$(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
 
-TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
 	set x; \
 	here=`pwd`; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	$(am__define_uniq_tagged_files); \
 	shift; \
 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
@@ -337,15 +410,11 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	      $$unique; \
 	  fi; \
 	fi
-ctags: CTAGS
-CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	$(am__define_uniq_tagged_files); \
 	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$unique
@@ -354,6 +423,21 @@ GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
 	  && $(am__cd) $(top_srcdir) \
 	  && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+	list='$(am__tagged_files)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -404,10 +488,15 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
@@ -492,9 +581,9 @@ uninstall-am:
 
 .MAKE: check-am install-am install-strip
 
-.PHONY: CTAGS GTAGS all all-am check check-am check-local clean \
-	clean-checkPROGRAMS clean-generic clean-libtool ctags \
-	distclean distclean-compile distclean-generic \
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am check-local clean \
+	clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \
+	ctags ctags-am distclean distclean-compile distclean-generic \
 	distclean-libtool distclean-tags distdir dvi dvi-am html \
 	html-am info info-am install install-am install-data \
 	install-data-am install-dvi install-dvi-am install-exec \
@@ -504,11 +593,11 @@ uninstall-am:
 	installcheck-am installdirs maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-compile \
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	tags uninstall uninstall-am
+	tags tags-am uninstall uninstall-am
 
 check-local:
 	MAGIC=$(top_builddir)/magic/magic ./test
-	for i in $T/*.testfile; do MAGIC=$T/$${i%%.testfile}.magic $(top_builddir)/tests/test $T/$$i $T/$${i%%.testfile}.result; done
+	for i in $T/*.testfile; do echo Running test: $$i; MAGIC=$(top_builddir)/magic/magic ./test $$i $${i%%.testfile}.result; done
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/contrib/file/tests/README b/contrib/file/tests/README
index 31f9b14e02e..5826773a977 100644
--- a/contrib/file/tests/README
+++ b/contrib/file/tests/README
@@ -3,15 +3,12 @@ file tests
 
 This directory contains tests for file. It is highly encouraged to add
 one each time a bug is found, and each time new magic is added. Each
-test consists of three files:
+test consists of two files:
 
-  TEST.magic
   TEST.testfile
   TEST.result
 
-where TEST is the base name of the test, TEST.magic contains the magic
-used, TEST.testfile is the input, and TEST.result is the desired
-output from file.
+where TEST is the base name of the test, TEST.testfile is the input,
+and TEST.result is the desired output from file.
 
-It suffices to add a triplet of test files to the directory to have
-them included in "make check".
+To add a new test just add the test files to the directory.
diff --git a/contrib/file/tests/escapevel.result b/contrib/file/tests/escapevel.result
new file mode 100644
index 00000000000..c0a265c77af
--- /dev/null
+++ b/contrib/file/tests/escapevel.result
@@ -0,0 +1 @@
+Zip data (MIME type "application/vnd.nz.gen.geek_central.ti5x"?)
\ No newline at end of file
diff --git a/contrib/file/tests/escapevel.testfile b/contrib/file/tests/escapevel.testfile
new file mode 100644
index 00000000000..28572603422
Binary files /dev/null and b/contrib/file/tests/escapevel.testfile differ
diff --git a/contrib/file/tests/gedcom.magic b/contrib/file/tests/gedcom.magic
deleted file mode 100644
index 616fd56b695..00000000000
--- a/contrib/file/tests/gedcom.magic
+++ /dev/null
@@ -1,6 +0,0 @@
-# GEDCOM Genealogy file
-
-0       string/c        0\ HEAD         GEDCOM genealogy data
->&0     search          1\ GEDC
->>&0    search          2\ VERS         version
->>>&1   string          >\0             %s
diff --git a/contrib/file/tests/gedcom.result b/contrib/file/tests/gedcom.result
index bbb0eb86c7a..1fd81618d8f 100644
--- a/contrib/file/tests/gedcom.result
+++ b/contrib/file/tests/gedcom.result
@@ -1 +1 @@
-GEDCOM genealogy data version 5.5
\ No newline at end of file
+GEDCOM genealogy text version 5.5, ASCII text
\ No newline at end of file
diff --git a/contrib/file/tests/issue311docx.result b/contrib/file/tests/issue311docx.result
new file mode 100644
index 00000000000..646ee85609f
--- /dev/null
+++ b/contrib/file/tests/issue311docx.result
@@ -0,0 +1 @@
+Microsoft Word 2007+
\ No newline at end of file
diff --git a/contrib/file/tests/issue311docx.testfile b/contrib/file/tests/issue311docx.testfile
new file mode 100644
index 00000000000..e4328ec3ae9
Binary files /dev/null and b/contrib/file/tests/issue311docx.testfile differ
diff --git a/contrib/gcc/config/arm/unwind-arm.h b/contrib/gcc/config/arm/unwind-arm.h
index 8a5c5ce35d2..ab8531d14fe 100644
--- a/contrib/gcc/config/arm/unwind-arm.h
+++ b/contrib/gcc/config/arm/unwind-arm.h
@@ -232,7 +232,7 @@ extern "C" {
       if (!tmp)
 	return 0;
 
-#if defined(linux) || defined(__NetBSD__)
+#if defined(linux) || defined(__NetBSD__) || defined(__FreeBSD__)
       /* Pc-relative indirect.  */
       tmp += ptr;
       tmp = *(_Unwind_Word *) tmp;
diff --git a/contrib/gcc/version.c b/contrib/gcc/version.c
index dd972acf127..549b413ab6f 100644
--- a/contrib/gcc/version.c
+++ b/contrib/gcc/version.c
@@ -18,7 +18,7 @@
    forward us bugs reported to you, if you determine that they are
    not bugs in your modifications.)  */
 
-const char bug_report_url[] = "";
+const char bug_report_url[] = "";
 
 /* The complete version string, assembled from several pieces.
    BASEVER, DATESTAMP, and DEVPHASE are defined by the Makefile.  */
diff --git a/contrib/ipfilter/lib/printhost.c b/contrib/ipfilter/lib/printhost.c
index eaf3fda4584..009a9bb1803 100644
--- a/contrib/ipfilter/lib/printhost.c
+++ b/contrib/ipfilter/lib/printhost.c
@@ -23,9 +23,9 @@ printhost(family, addr)
 	if ((family == -1) || !*addr)
 		PRINTF("any");
 	else {
+#ifdef  USE_INET6
 		void *ptr = addr;
 
-#ifdef  USE_INET6
 		PRINTF("%s", inet_ntop(family, ptr, ipbuf, sizeof(ipbuf)));
 #else
 		ipa.s_addr = *addr;
diff --git a/contrib/ipfilter/lib/printhostmask.c b/contrib/ipfilter/lib/printhostmask.c
index 10d90b2df96..b1e41f9c0a8 100644
--- a/contrib/ipfilter/lib/printhostmask.c
+++ b/contrib/ipfilter/lib/printhostmask.c
@@ -25,9 +25,9 @@ printhostmask(family, addr, mask)
 	if ((family == -1) || ((!addr || !*addr) && (!mask || !*mask)))
 		PRINTF("any");
 	else {
+#ifdef  USE_INET6
 		void *ptr = addr;
 
-#ifdef  USE_INET6
 		PRINTF("%s", inet_ntop(family, ptr, ipbuf, sizeof(ipbuf)));
 #else
 		ipa.s_addr = *addr;
diff --git a/contrib/ipfilter/lib/printipfexpr.c b/contrib/ipfilter/lib/printipfexpr.c
index 64c2f1c1a7e..06b987e0757 100644
--- a/contrib/ipfilter/lib/printipfexpr.c
+++ b/contrib/ipfilter/lib/printipfexpr.c
@@ -3,7 +3,9 @@
 static void printport __P((int *));
 static void printhosts __P((int *));
 static void printsingle __P((int *));
+#ifdef USE_INET6
 static void printhostsv6 __P((int *));
+#endif
 
 void
 printipfexpr(array)
diff --git a/contrib/ipfilter/lib/save_v1trap.c b/contrib/ipfilter/lib/save_v1trap.c
index b17f62c722c..78671c79c76 100644
--- a/contrib/ipfilter/lib/save_v1trap.c
+++ b/contrib/ipfilter/lib/save_v1trap.c
@@ -178,7 +178,7 @@ snmpv1_parse(char **strings)
 		if (ctx->fd >= 0) {
 			ctx->sin.sin_family = AF_INET;
 			ctx->sin.sin_port = htons(162);
-			if (connect(ctx->fd, &ctx->sin,
+			if (connect(ctx->fd, (struct sockaddr *)&ctx->sin,
 				    sizeof(ctx->sin)) != 0) {
 					snmpv1_destroy(ctx);
 					return NULL;
diff --git a/contrib/ipfilter/lib/save_v2trap.c b/contrib/ipfilter/lib/save_v2trap.c
index 24349bb4058..78e76f6646f 100644
--- a/contrib/ipfilter/lib/save_v2trap.c
+++ b/contrib/ipfilter/lib/save_v2trap.c
@@ -181,7 +181,7 @@ snmpv2_parse(char **strings)
 		if (ctx->fd >= 0) {
 			ctx->sin.sin_family = AF_INET;
 			ctx->sin.sin_port = htons(162);
-			if (connect(ctx->fd, &ctx->sin,
+			if (connect(ctx->fd, (struct sockaddr *)&ctx->sin,
 				    sizeof(ctx->sin)) != 0) {
 					snmpv2_destroy(ctx);
 					return NULL;
diff --git a/contrib/ldns/Changelog b/contrib/ldns/Changelog
index 845d5b8a738..48ea9bbda3a 100644
--- a/contrib/ldns/Changelog
+++ b/contrib/ldns/Changelog
@@ -1,3 +1,61 @@
+1.6.17	2014-01-10
+	* Fix ldns_dnssec_zone_new_frm_fp_l to allow the last parsed line of a
+	  zone to be an NSEC3 (or its RRSIG) covering an empty non terminal.
+	* Add --disable-dane option to configure and check availability of the
+	  for dane needed X509_check_ca function in openssl.
+	* bugfix #490: Get rid of type-punned pointer warnings.
+	  Thanks Adam Tkac.
+	* Make sure executables are linked against libcrypto with the 
+	  LIBSSL_LDFLAGS. Thanks Leo Baltus.
+	* Miscellaneous prototype fixes. Thanks Dag-Erling Smørgrav.
+	* README now shows preferred way to configure for examples and drill.
+	* Bind to source address for resolvers. drill binds to source with -I.
+	  Thanks Bryan Duff.
+	* -T option for ldns-dane that has specific exit status for PKIX
+	  validated connections without (secure) TLSA records.
+	* Fix b{32,64}_{ntop,pton} detection and handling.
+	* New RR type TKEY, but without operational practice.
+	* New RR types HIP, NINFO, RKEY, CDS, EUI48, EUI64, URI, CAA and TA.
+	* New output format flag (and accompanying functions) to print certain
+	  RR's as unknown type
+	* -u and -U parameter for ldns-read-zone to mark/unmark a RR type
+	  for printing as unknown type
+	* bugfix #504: GPOS RR has three rdata fields. Thanks Jelte Jansen.
+	* bugfix #497: Properly test for EOF when reading key files with drill.
+	* New functions: ldns_pkt_ixfr_request_new and
+	  ldns_pkt_ixfr_request_new_frm_str.
+	* Use SNI with ldns-dane
+	* bugfix #507: ldnsx Fix use of non-existent variables and not
+	  properly referring to instance variable.  Patch from shussain.
+	* bugfix #508: ldnsx Adding NSEC3PARAM to known/allowable RR type
+	  dictionary.  Patch from shussain.
+	* bugfix #517: ldns_resolver_new_frm_fp error when invoked using a NULL
+	  file pointer.
+	* Fix memory leak in contrib/python: ldns_pkt.new_query.
+	* Fix buffer overflow in fget_token and bget_token.
+	* ldns-verify-zone NSEC3 checking from quadratic to linear performance.
+	  Thanks NIC MX (nicmexico.mx)
+	* ldns-dane setup new ssl session for each new connect to prevent hangs
+	* bugfix #521: drill trace continue on empty non-terminals with NSEC3
+	* bugfix #525: Fix documentation of ldns_resolver_set_retry
+	* Remove unused LDNS_RDF_TYPE_TSIG and associated functions.
+	* Fix ldns_nsec_covers_name for zones with an apex only. Thanks Miek.
+	* Configure option to build perl bindings: --with-p5-dns-ldns
+	  (DNS::LDNS is a contribution from Erik Ostlyngen)
+	* bugfix #527: Move -lssl before -lcrypto when linking
+	* Optimize TSIG digest function name comparison (Thanks Marc Buijsman)
+	* Compare names case insensitive with ldns_pkt_rr_list_by_name and
+	  ldns_pkt_rr_list_by_name_and_type (thanks Johannes Naab)
+	* A separate --enable for each draft RR type: --enable-rrtype-ninfo,
+	  --enable-rrtype-rkey, --enable-rrtype-cds, --enable-rrtype-uri and
+	  --enable-rrtype-ta
+	* bugfix #530: Don't sign and verify duplicate RRs (Thanks Jelte Jansen)
+	* bugfix #505: Manpage and usage output fixes (Thanks Tomas Hozza)
+	* Adjust ldns_sha1() so that the input data is not modified (Thanks
+	  Marc Buijsman)
+	* Messages to stderr are now off by default and can be reenabled with
+	  the --enable-stderr-msgs configure option.
+
 1.6.16	2012-11-13
 	* Fix Makefile to build pyldns with BSD make
 	* Fix typo in exporting b32_* symbols to make pyldns load again
diff --git a/contrib/ldns/Makefile.in b/contrib/ldns/Makefile.in
index 68ee644b927..7a1c2414a38 100644
--- a/contrib/ldns/Makefile.in
+++ b/contrib/ldns/Makefile.in
@@ -2,7 +2,7 @@
 # See the file LICENSE for the license
 SHELL 		= @SHELL@
 VERSION         = @PACKAGE_VERSION@
-version_info	= @LIBTOOL_VERSION_INFO@
+version_info	= @VERSION_INFO@
 srcdir 		= @srcdir@
 prefix  	= @prefix@
 exec_prefix 	= @exec_prefix@
@@ -13,8 +13,10 @@ datadir		= @datadir@
 libdir		= @libdir@
 includedir	= @includedir@
 doxygen		= @doxygen@
-pywrapdir       = ${srcdir}/contrib/python
-pyldnsxwrapdir  = ${srcdir}/contrib/ldnsx
+pywrapdir       = $(srcdir)/contrib/python
+pyldnsxwrapdir  = $(srcdir)/contrib/ldnsx
+p5_dns_ldns_dir = $(srcdir)/contrib/DNS-LDNS
+PERL		= @PERL@
 swig		= @swig@
 swigpy_flags	= -python @SWIGPY3@
 python_site	= @PYTHON_SITE_PKG@
@@ -57,17 +59,19 @@ LINTFLAGS	+= "-Dsigset_t=long"
 LINTFLAGS	+= "-D__uint16_t=uint16_t" -D"__pure2=" -D"__wchar_t=wchar_t" -D"__packed=" -D"__aligned(x)="
 # Ubuntu oneiric"
 LINTFLAGS       += -D"__BEGIN_DECLS=" -D"__ssize_t=ssize_t" -D"__intptr_t=intptr_t" -D"__nonnull(x)=" -D"__THROW=" -D"__wur=" -D"__off_t=unsigned" -D"__off64_t=unsigned" -D"__useconds_t=unsigned" -D"__uid_t=unsigned" -D"__gid_t=unsigned" -D"__attribute_deprecated__=" -D"__pid_t=unsigned" -D"__restrict=" -D"__END_DECLS=" -D"__BEGIN_NAMESPACE_STD=" -D"__END_NAMESPACE_STD=" -D"__BEGIN_NAMESPACE_C99=" -D"__END_NAMESPACE_C99="  -D"__socklen_t=unsigned" -D"sa_family_t=unsigned " -D"__mode_t=unsigned" -D"u_int16_t=uint16_t" -D"u_int32_t=uint32_t" -D"u_int8_t=uint8_t" -D"u_short=unsigned short" -D"__u16=uint16_t" -D"__u32=uint32_t" -D"__u64=uint64_t"
+# FreeBSD 9
+LINTFLAGS       += -D"_RuneLocale=int"
 DEPFLAG		= @DEPFLAG@
 
 INSTALL		= $(srcdir)/install-sh 
 
 LIBLOBJS	= $(LIBOBJS:.o=.lo)
-LDNS_LOBJS	= buffer.lo dane.lo dname.lo dnssec.lo dnssec_sign.lo dnssec_verify.lo dnssec_zone.lo duration.lo error.lo higher.lo host2str.lo host2wire.lo keys.lo net.lo packet.lo parse.lo rbtree.lo rdata.lo resolver.lo rr.lo rr_functions.lo sha1.lo sha2.lo str2host.lo tsig.lo update.lo util.lo wire2host.lo zone.lo 
+LDNS_LOBJS	= buffer.lo dane.lo dname.lo dnssec.lo dnssec_sign.lo dnssec_verify.lo dnssec_zone.lo duration.lo error.lo higher.lo host2str.lo host2wire.lo keys.lo net.lo packet.lo parse.lo radix.lo rbtree.lo rdata.lo resolver.lo rr.lo rr_functions.lo sha1.lo sha2.lo str2host.lo tsig.lo update.lo util.lo wire2host.lo zone.lo 
 LDNS_LOBJS_EX	= ^linktest\.c$$
 LDNS_ALL_LOBJS	= $(LDNS_LOBJS) $(LIBLOBJS)
 LIB		= libldns.la
 
-LDNS_HEADERS	= buffer.h dane.h dname.h dnssec.h dnssec_sign.h dnssec_verify.h dnssec_zone.h duration.h error.h higher.h host2str.h host2wire.h keys.h ldns.h packet.h parse.h rbtree.h rdata.h resolver.h rr_functions.h rr.h sha1.h sha2.h str2host.h tsig.h update.h wire2host.h zone.h 
+LDNS_HEADERS	= buffer.h dane.h dname.h dnssec.h dnssec_sign.h dnssec_verify.h dnssec_zone.h duration.h error.h higher.h host2str.h host2wire.h keys.h ldns.h packet.h parse.h radix.h rbtree.h rdata.h resolver.h rr_functions.h rr.h sha1.h sha2.h str2host.h tsig.h update.h wire2host.h zone.h 
 LDNS_HEADERS_EX	= ^config\.h|common\.h|util\.h|net\.h$$
 LDNS_HEADERS_GEN= common.h util.h net.h
 
@@ -92,16 +96,14 @@ EX_SSL_LOBJS	= examples/ldns-nsec3-hash.lo examples/ldns-revoke.lo examples/ldns
 COMPILE		= $(CC) $(CPPFLAGS) $(CFLAGS)
 COMP_LIB	= $(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS)
 LINK		= $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS)
-LINK_LIB	= $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) \
-		  $(LIBS) -version-number $(version_info) -no-undefined
-LINK_EXE	= $(LIBTOOL) --mode=link $(CC) $(CPPFLAGS) \
-			    $(LIBSSL_CPPFLAGS) $(CFLAGS) $(LDFLAGS)
+LINK_LIB	= $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -version-number $(version_info) -no-undefined
+LINK_EXE	= $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LIBSSL_LDFLAGS)
 
 .PHONY:	clean realclean docclean manpages doc lint all lib pyldns test
 .PHONY: install uninstall install-doc uninstall-doc uninstall-pyldns
 .PHONY: install-h uninstall-h install-lib uninstall-lib install-pyldns
 
-all:	setup-builddir lib linktest manpages @PYLDNS@ @DRILL@ @EXAMPLES@
+all:	setup-builddir lib linktest manpages @P5_DNS_LDNS@ @PYLDNS@ @DRILL@ @EXAMPLES@
 
 .SUFFIXES: .c .o .a .lo .h .i
 
@@ -205,7 +207,8 @@ clean-examples:
 	$(LIBTOOL) --mode clean rm -f $(EXAMPLE_LOBJS)
 
 linktest: $(srcdir)/linktest.c libldns.la
-	$(LIBTOOL) --mode=link $(CC) $(srcdir)/linktest.c $(CPPFLAGS) $(LIBSSL_CPPFLAGS) $(CFLAGS) -lldns $(LIBS) -o linktest
+	$(COMP_LIB) $(LIBSSL_CPPFLAGS) -c $(srcdir)/linktest.c -o linktest.lo
+	$(LINK_EXE) linktest.lo $(LIBS) $(LIBSSL_LIBS) -lldns -o linktest
 
 lib: libldns.la
 
@@ -247,9 +250,29 @@ ldns_wrapper.lo: $(pywrapdir)/ldns_wrapper.c ldns/config.h
 _ldns.la: ldns_wrapper.lo libldns.la 
 	$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(PYTHON_CFLAGS) $(LDFLAGS) $(PYTHON_LDFLAGS) -module -version-number $(version_info) -no-undefined -o $@ ldns_wrapper.lo -rpath $(python_site) -L. -L.libs -lldns $(LIBS)
 
-install: install-h install-lib @INSTALL_CONFIG@ install-manpages $(pyldns_inst) $(pyldnsx_inst) @INSTALL_DRILL@ @INSTALL_EXAMPLES@
+$(p5_dns_ldns_dir)/Makefile: $(p5_dns_ldns_dir)/Makefile.PL
+	BUILDDIR=`pwd`; cd $(p5_dns_ldns_dir); $(PERL) Makefile.PL PREFIX="$(prefix)" LIBS="-L$$BUILDDIR/.libs -lldns" INC="-I$$BUILDDIR"
 
-uninstall: uninstall-manpages @UNINSTALL_CONFIG@ uninstall-h uninstall-lib $(pyldns_uninst) $(pyldnsx_uninst) @UNINSTALL_DRILL@ @UNINSTALL_EXAMPLES@
+$(p5_dns_ldns_dir)/blib/arch/auto/DNS/LDNS/LDNS.so: $(p5_dns_ldns_dir)/Makefile
+	cd $(p5_dns_ldns_dir); $(MAKE)
+
+p5-dns-ldns: $(p5_dns_ldns_dir)/blib/arch/auto/DNS/LDNS/LDNS.so
+
+install-p5-dns-ldns: $(p5_dns_ldns_dir)/Makefile
+	cd $(p5_dns_ldns_dir); $(MAKE) install
+
+uninstall-p5-dns-ldns: $(p5_dns_ldns_dir)/Makefile
+	cd $(p5_dns_ldns_dir); $(MAKE) uninstall
+
+clean-p5-dns-ldns: $(p5_dns_ldns_dir)/Makefile
+	cd $(p5_dns_ldns_dir); $(MAKE) clean
+
+test-p5-dns-ldns: $(p5_dns_ldns_dir)/Makefile
+	cd $(p5_dns_ldns_dir); $(MAKE) test
+
+install: install-h install-lib @INSTALL_CONFIG@ install-manpages $(pyldns_inst) $(pyldnsx_inst) @INSTALL_P5_DNS_LDNS@ @INSTALL_DRILL@ @INSTALL_EXAMPLES@
+
+uninstall: uninstall-manpages @UNINSTALL_CONFIG@ uninstall-h uninstall-lib $(pyldns_uninst) $(pyldnsx_uninst) @UNINSTALL_P5_DNS_LDNS@ @UNINSTALL_DRILL@ @UNINSTALL_EXAMPLES@
 
 destclean: uninstall
 
@@ -331,7 +354,7 @@ clean-lib:
 	$(LIBTOOL) --mode clean rm -f $(pywrapdir)/ldns_wrapper.c
 	$(LIBTOOL) --mode clean rm -f $(pywrapdir)/ldns.py
 
-clean: @CLEAN_DRILL@ @CLEAN_EXAMPLES@ clean-manpages clean-lib  putdown-builddir
+clean: @CLEAN_DRILL@ @CLEAN_EXAMPLES@ @CLEAN_P5_DNS_LDNS@ clean-manpages clean-lib  putdown-builddir
 
 realclean: clean docclean
 	rm -f config.status
@@ -396,7 +419,7 @@ allclean: test-clean clean
 test-clean:
 	tpkg -b test clean
 
-test:
+test: @TEST_P5_DNS_LDNS@
 	if test -x "`which bash`"; then bash test/test_all.sh; else sh test/test_all.sh; fi
 
 
@@ -481,56 +504,56 @@ buffer.lo buffer.o: $(srcdir)/buffer.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/
  $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 dane.lo dane.o: $(srcdir)/dane.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \
  $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \
  $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \
  $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 dname.lo dname.o: $(srcdir)/dname.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \
  $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \
  $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \
  $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 dnssec.lo dnssec.o: $(srcdir)/dnssec.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \
  $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \
  $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \
  $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 dnssec_sign.lo dnssec_sign.o: $(srcdir)/dnssec_sign.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \
  ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \
  $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 dnssec_verify.lo dnssec_verify.o: $(srcdir)/dnssec_verify.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \
  ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \
  $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 dnssec_zone.lo dnssec_zone.o: $(srcdir)/dnssec_zone.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \
  ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \
  $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 duration.lo duration.o: $(srcdir)/duration.c ldns/config.h $(srcdir)/ldns/duration.h
 error.lo error.o: $(srcdir)/error.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \
  $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \
@@ -538,72 +561,74 @@ error.lo error.o: $(srcdir)/error.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/uti
  $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 higher.lo higher.o: $(srcdir)/higher.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \
  $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \
  $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \
  $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 host2str.lo host2str.o: $(srcdir)/host2str.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \
  ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \
  $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 host2wire.lo host2wire.o: $(srcdir)/host2wire.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \
  ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \
  $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 keys.lo keys.o: $(srcdir)/keys.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \
  $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \
  $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \
  $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 linktest.lo linktest.o: $(srcdir)/linktest.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \
  ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \
  $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 net.lo net.o: $(srcdir)/net.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \
  $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \
  $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \
  $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 packet.lo packet.o: $(srcdir)/packet.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \
  $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \
  $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \
  $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 parse.lo parse.o: $(srcdir)/parse.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \
  $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \
  $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \
  $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
+radix.lo radix.o: $(srcdir)/radix.c ldns/config.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/error.h ldns/util.h \
+ ldns/common.h
 rbtree.lo rbtree.o: $(srcdir)/rbtree.c ldns/config.h $(srcdir)/ldns/rbtree.h ldns/util.h ldns/common.h
 rdata.lo rdata.o: $(srcdir)/rdata.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \
  $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \
@@ -611,40 +636,40 @@ rdata.lo rdata.o: $(srcdir)/rdata.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/uti
  $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 resolver.lo resolver.o: $(srcdir)/resolver.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \
  ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \
  $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 rr.lo rr.o: $(srcdir)/rr.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \
  $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \
  $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \
  $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 rr_functions.lo rr_functions.o: $(srcdir)/rr_functions.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \
  ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \
  $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 sha1.lo sha1.o: $(srcdir)/sha1.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \
  $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \
  $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \
  $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 sha2.lo sha2.o: $(srcdir)/sha2.c ldns/config.h $(srcdir)/ldns/sha2.h
 str2host.lo str2host.o: $(srcdir)/str2host.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \
  ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \
@@ -652,24 +677,24 @@ str2host.lo str2host.o: $(srcdir)/str2host.c ldns/config.h $(srcdir)/ldns/ldns.h
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 tsig.lo tsig.o: $(srcdir)/tsig.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \
  $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \
  $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \
  $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 update.lo update.o: $(srcdir)/update.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \
  $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \
  $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \
  $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 util.lo util.o: $(srcdir)/util.c ldns/config.h $(srcdir)/ldns/rdata.h ldns/common.h $(srcdir)/ldns/error.h \
  ldns/util.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/buffer.h
 wire2host.lo wire2host.o: $(srcdir)/wire2host.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \
@@ -678,18 +703,16 @@ wire2host.lo wire2host.o: $(srcdir)/wire2host.c ldns/config.h $(srcdir)/ldns/ldn
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 zone.lo zone.o: $(srcdir)/zone.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \
  $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \
  $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \
  $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
-compat/b32_ntop.lo compat/b32_ntop.o: $(srcdir)/compat/b32_ntop.c ldns/config.h
-compat/b32_pton.lo compat/b32_pton.o: $(srcdir)/compat/b32_pton.c ldns/config.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 compat/b64_ntop.lo compat/b64_ntop.o: $(srcdir)/compat/b64_ntop.c ldns/config.h
 compat/b64_pton.lo compat/b64_pton.o: $(srcdir)/compat/b64_pton.c ldns/config.h
 compat/calloc.lo compat/calloc.o: $(srcdir)/compat/calloc.c ldns/config.h
@@ -715,8 +738,8 @@ examples/ldns-chaos.lo examples/ldns-chaos.o: $(srcdir)/examples/ldns-chaos.c ld
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 examples/ldns-compare-zones.lo examples/ldns-compare-zones.o: $(srcdir)/examples/ldns-compare-zones.c ldns/config.h $(srcdir)/ldns/ldns.h \
  ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h \
  $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h \
@@ -724,31 +747,31 @@ examples/ldns-compare-zones.lo examples/ldns-compare-zones.o: $(srcdir)/examples
  $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h \
  $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h \
  $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h \
- $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 examples/ldns-dane.lo examples/ldns-dane.o: $(srcdir)/examples/ldns-dane.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \
  ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \
  $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 examples/ldnsd.lo examples/ldnsd.o: $(srcdir)/examples/ldnsd.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \
  $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \
  $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \
  $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 examples/ldns-dpa.lo examples/ldns-dpa.o: $(srcdir)/examples/ldns-dpa.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \
  ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \
  $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h $(srcdir)/examples/ldns-dpa.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h $(srcdir)/examples/ldns-dpa.h
 examples/ldns-gen-zone.lo examples/ldns-gen-zone.o: $(srcdir)/examples/ldns-gen-zone.c ldns/config.h $(srcdir)/ldns/ldns.h \
  ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h \
  $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h \
@@ -756,15 +779,15 @@ examples/ldns-gen-zone.lo examples/ldns-gen-zone.o: $(srcdir)/examples/ldns-gen-
  $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h \
  $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h \
  $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h \
- $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 examples/ldns-key2ds.lo examples/ldns-key2ds.o: $(srcdir)/examples/ldns-key2ds.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \
  ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \
  $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 examples/ldns-keyfetcher.lo examples/ldns-keyfetcher.o: $(srcdir)/examples/ldns-keyfetcher.c ldns/config.h $(srcdir)/ldns/ldns.h \
  ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h \
  $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h \
@@ -772,31 +795,31 @@ examples/ldns-keyfetcher.lo examples/ldns-keyfetcher.o: $(srcdir)/examples/ldns-
  $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h \
  $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h \
  $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h \
- $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 examples/ldns-keygen.lo examples/ldns-keygen.o: $(srcdir)/examples/ldns-keygen.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \
  ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \
  $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 examples/ldns-mx.lo examples/ldns-mx.o: $(srcdir)/examples/ldns-mx.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \
  ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \
  $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 examples/ldns-notify.lo examples/ldns-notify.o: $(srcdir)/examples/ldns-notify.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \
  ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \
  $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 examples/ldns-nsec3-hash.lo examples/ldns-nsec3-hash.o: $(srcdir)/examples/ldns-nsec3-hash.c ldns/config.h $(srcdir)/ldns/ldns.h \
  ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h \
  $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h \
@@ -804,7 +827,7 @@ examples/ldns-nsec3-hash.lo examples/ldns-nsec3-hash.o: $(srcdir)/examples/ldns-
  $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h \
  $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h \
  $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h \
- $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 examples/ldns-read-zone.lo examples/ldns-read-zone.o: $(srcdir)/examples/ldns-read-zone.c ldns/config.h $(srcdir)/ldns/ldns.h \
  ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h \
  $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h \
@@ -812,7 +835,7 @@ examples/ldns-read-zone.lo examples/ldns-read-zone.o: $(srcdir)/examples/ldns-re
  $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h \
  $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h \
  $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h \
- $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 examples/ldns-resolver.lo examples/ldns-resolver.o: $(srcdir)/examples/ldns-resolver.c ldns/config.h $(srcdir)/ldns/ldns.h \
  ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h \
  $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h \
@@ -820,23 +843,23 @@ examples/ldns-resolver.lo examples/ldns-resolver.o: $(srcdir)/examples/ldns-reso
  $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h \
  $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h \
  $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h \
- $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 examples/ldns-revoke.lo examples/ldns-revoke.o: $(srcdir)/examples/ldns-revoke.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \
  ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \
  $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 examples/ldns-rrsig.lo examples/ldns-rrsig.o: $(srcdir)/examples/ldns-rrsig.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \
  ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \
  $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 examples/ldns-signzone.lo examples/ldns-signzone.o: $(srcdir)/examples/ldns-signzone.c ldns/config.h $(srcdir)/ldns/ldns.h \
  ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h \
  $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h \
@@ -844,7 +867,7 @@ examples/ldns-signzone.lo examples/ldns-signzone.o: $(srcdir)/examples/ldns-sign
  $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h \
  $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h \
  $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h \
- $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 examples/ldns-test-edns.lo examples/ldns-test-edns.o: $(srcdir)/examples/ldns-test-edns.c ldns/config.h $(srcdir)/ldns/ldns.h \
  ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h \
  $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h \
@@ -852,15 +875,15 @@ examples/ldns-test-edns.lo examples/ldns-test-edns.o: $(srcdir)/examples/ldns-te
  $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h \
  $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h \
  $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h \
- $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 examples/ldns-testns.lo examples/ldns-testns.o: $(srcdir)/examples/ldns-testns.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \
  ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \
  $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h $(srcdir)/examples/ldns-testpkts.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h $(srcdir)/examples/ldns-testpkts.h
 examples/ldns-testpkts.lo examples/ldns-testpkts.o: $(srcdir)/examples/ldns-testpkts.c ldns/config.h $(srcdir)/ldns/ldns.h \
  ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h \
  $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h \
@@ -868,15 +891,16 @@ examples/ldns-testpkts.lo examples/ldns-testpkts.o: $(srcdir)/examples/ldns-test
  $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h \
  $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h \
  $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h \
- $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h $(srcdir)/examples/ldns-testpkts.h
+ $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h \
+ $(srcdir)/examples/ldns-testpkts.h
 examples/ldns-update.lo examples/ldns-update.o: $(srcdir)/examples/ldns-update.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \
  ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \
  $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 examples/ldns-verify-zone.lo examples/ldns-verify-zone.o: $(srcdir)/examples/ldns-verify-zone.c ldns/config.h $(srcdir)/ldns/ldns.h \
  ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h \
  $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h \
@@ -884,39 +908,39 @@ examples/ldns-verify-zone.lo examples/ldns-verify-zone.o: $(srcdir)/examples/ldn
  $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h \
  $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h \
  $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h \
- $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 examples/ldns-version.lo examples/ldns-version.o: $(srcdir)/examples/ldns-version.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \
  ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \
  $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 examples/ldns-walk.lo examples/ldns-walk.o: $(srcdir)/examples/ldns-walk.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \
  ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \
  $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 examples/ldns-zcat.lo examples/ldns-zcat.o: $(srcdir)/examples/ldns-zcat.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \
  ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \
  $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 examples/ldns-zsplit.lo examples/ldns-zsplit.o: $(srcdir)/examples/ldns-zsplit.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \
  ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \
  $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \
  $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \
  $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \
  $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 drill/chasetrace.lo drill/chasetrace.o: $(srcdir)/drill/chasetrace.c $(srcdir)/drill/drill.h ldns/config.h \
  $(srcdir)/drill/drill_util.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h \
  $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h \
@@ -924,8 +948,8 @@ drill/chasetrace.lo drill/chasetrace.o: $(srcdir)/drill/chasetrace.c $(srcdir)/d
  $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h \
  $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h \
  $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 drill/dnssec.lo drill/dnssec.o: $(srcdir)/drill/dnssec.c $(srcdir)/drill/drill.h ldns/config.h $(srcdir)/drill/drill_util.h \
  $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h \
  $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h \
@@ -933,7 +957,7 @@ drill/dnssec.lo drill/dnssec.o: $(srcdir)/drill/dnssec.c $(srcdir)/drill/drill.h
  $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h \
  $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h \
  ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h \
- $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 drill/drill.lo drill/drill.o: $(srcdir)/drill/drill.c $(srcdir)/drill/drill.h ldns/config.h $(srcdir)/drill/drill_util.h \
  $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h \
  $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h \
@@ -941,7 +965,7 @@ drill/drill.lo drill/drill.o: $(srcdir)/drill/drill.c $(srcdir)/drill/drill.h ld
  $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h \
  $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h \
  ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h \
- $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 drill/drill_util.lo drill/drill_util.o: $(srcdir)/drill/drill_util.c $(srcdir)/drill/drill.h ldns/config.h \
  $(srcdir)/drill/drill_util.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h \
  $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h \
@@ -949,8 +973,8 @@ drill/drill_util.lo drill/drill_util.o: $(srcdir)/drill/drill_util.c $(srcdir)/d
  $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h \
  $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h \
  $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 drill/error.lo drill/error.o: $(srcdir)/drill/error.c $(srcdir)/drill/drill.h ldns/config.h $(srcdir)/drill/drill_util.h \
  $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h \
  $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h \
@@ -958,7 +982,7 @@ drill/error.lo drill/error.o: $(srcdir)/drill/error.c $(srcdir)/drill/drill.h ld
  $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h \
  $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h \
  ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h \
- $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 drill/root.lo drill/root.o: $(srcdir)/drill/root.c $(srcdir)/drill/drill.h ldns/config.h $(srcdir)/drill/drill_util.h \
  $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h \
  $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h \
@@ -966,7 +990,7 @@ drill/root.lo drill/root.o: $(srcdir)/drill/root.c $(srcdir)/drill/drill.h ldns/
  $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h \
  $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h \
  ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h \
- $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 drill/securetrace.lo drill/securetrace.o: $(srcdir)/drill/securetrace.c $(srcdir)/drill/drill.h ldns/config.h \
  $(srcdir)/drill/drill_util.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h \
  $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h \
@@ -974,8 +998,8 @@ drill/securetrace.lo drill/securetrace.o: $(srcdir)/drill/securetrace.c $(srcdir
  $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h \
  $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h \
  $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \
+ $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 drill/work.lo drill/work.o: $(srcdir)/drill/work.c $(srcdir)/drill/drill.h ldns/config.h $(srcdir)/drill/drill_util.h \
  $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h \
  $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h \
@@ -983,7 +1007,7 @@ drill/work.lo drill/work.o: $(srcdir)/drill/work.c $(srcdir)/drill/drill.h ldns/
  $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h \
  $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h \
  ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h \
- $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
+ $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h
 examples/ldns-chaos: examples/ldns-chaos.lo examples/ldns-chaos.o $(LIB)
 examples/ldns-compare-zones: examples/ldns-compare-zones.lo examples/ldns-compare-zones.o $(LIB)
 examples/ldnsd: examples/ldnsd.lo examples/ldnsd.o $(LIB)
diff --git a/contrib/ldns/README b/contrib/ldns/README
index 0c21e6551cd..6319c6f5255 100644
--- a/contrib/ldns/README
+++ b/contrib/ldns/README
@@ -37,11 +37,11 @@ INSTALLATION
 5. make install
 
 
-* Building from subversion repository
+* Building from repository
 
 If you are building from the repository you will need to have (gnu)
 autotools like libtool and autoreconf installed. A list of all the commands
-needed to build everything can be found in README.svn. Note that the actual
+needed to build everything can be found in README.git. Note that the actual
 commands may be a little bit different on your machine. Most notable, you'll need to run libtoolize (or glibtoolize), if you skip this step, you'll get an error about missing config.sub.
 
 * Developers
diff --git a/contrib/ldns/README.svn b/contrib/ldns/README.git
similarity index 83%
rename from contrib/ldns/README.svn
rename to contrib/ldns/README.git
index cd402d49c1b..34c9ae54f5e 100644
--- a/contrib/ldns/README.svn
+++ b/contrib/ldns/README.git
@@ -1,6 +1,5 @@
-
-# The ldns subversion repository can found at:
-# www.nlnetlabs.nl/ldns/svn/
+# The ldns git repository can found at:
+# git.nlnetlabs.nl/ldns/
 
 # small list of commands to build all on a linux system
 # libtoolize is needed for most other targets
@@ -16,7 +15,7 @@
 # it is needed)
 libtoolize -c --install
 autoreconf --install
-./configure --with-examples --with-drill # --with-pyldns
+./configure --with-examples --with-drill # --with-pyldns --with-p5-dns-ldns
 make
 make doc  # needs doxygen for the html pages
 (cd pcat && autoreconf && ./configure && make)
diff --git a/contrib/ldns/acx_nlnetlabs.m4 b/contrib/ldns/acx_nlnetlabs.m4
index e90c81ea02a..a4047332ff2 100644
--- a/contrib/ldns/acx_nlnetlabs.m4
+++ b/contrib/ldns/acx_nlnetlabs.m4
@@ -2,7 +2,12 @@
 # Copyright 2009, Wouter Wijngaards, NLnet Labs.   
 # BSD licensed.
 #
-# Version 21
+# Version 26
+# 2013-09-19 FLTO help text improved.
+# 2013-07-18 Enable ACX_CHECK_COMPILER_FLAG to test for -Wstrict-prototypes
+# 2013-06-25 FLTO has --disable-flto option.
+# 2013-05-03 Update W32_SLEEP for newer mingw that links but not defines it.
+# 2013-03-22 Fix ACX_RSRC_VERSION for long version numbers.
 # 2012-02-09 Fix AHX_MEMCMP_BROKEN with undef in compat/memcmp.h.
 # 2012-01-20 Fix COMPILER_FLAGS_UNBOUND for gcc 4.6.2 assigned-not-used-warns.
 # 2011-12-05 Fix getaddrinfowithincludes on windows with fedora16 mingw32-gcc.
@@ -17,7 +22,7 @@
 # 2010-07-02 Add check for ss_family (for minix).
 # 2010-04-26 Fix to use CPPFLAGS for CHECK_COMPILER_FLAGS.
 # 2010-03-01 Fix RPATH using CONFIG_COMMANDS to run at the very end.
-# 2010-02-18 WITH_SSL outputs the LIBSSL_LDFLAGS, LIBS, CPPFLAGS seperate, -ldl
+# 2010-02-18 WITH_SSL outputs the LIBSSL_LDFLAGS, LIBS, CPPFLAGS separate, -ldl
 # 2010-02-01 added ACX_CHECK_MEMCMP_SIGNED, AHX_MEMCMP_BROKEN
 # 2010-01-20 added AHX_COONFIG_STRLCAT
 # 2009-07-14 U_CHAR detection improved for windows crosscompile.
@@ -101,7 +106,7 @@ dnl Calculate comma separated windows-resource numbers from package version.
 dnl Picks the first three(,0) or four numbers out of the name.
 dnl $1: variable for the result
 AC_DEFUN([ACX_RSRC_VERSION], 
-[$1=[`echo $PACKAGE_VERSION | sed -e 's/^[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\).*$/\1,\2,\3,\4/' -e 's/^[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*$/\1,\2,\3,0/' `]
+[$1=[`echo $PACKAGE_VERSION | sed -e 's/^[^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\).*$/\1,\2,\3,\4/' -e 's/^[^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9]*$/\1,\2,\3,0/' `]
 ])
 
 dnl Routine to help check for compiler flags.
@@ -116,7 +121,7 @@ AC_MSG_CHECKING(whether $CC supports -$1)
 cache=`echo $1 | sed 'y%.=/+-%___p_%'`
 AC_CACHE_VAL(cv_prog_cc_flag_$cache,
 [
-echo 'void f(){}' >conftest.c
+echo 'void f(void){}' >conftest.c
 if test -z "`$CC $CPPFLAGS $CFLAGS -$1 -c conftest.c 2>&1`"; then
 eval "cv_prog_cc_flag_$cache=yes"
 else
@@ -405,19 +410,22 @@ int test() {
 dnl Check if CC supports -flto.
 dnl in a way that supports clang and suncc (that flag does something else,
 dnl but fails to link).  It sets it in CFLAGS if it works.
-AC_DEFUN([ACX_CHECK_FLTO],
-[AC_MSG_CHECKING([if $CC supports -flto])
-BAKCFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -flto"
-AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [
-    if $CC $CFLAGS -o conftest conftest.c 2>&1 | grep "warning: no debug symbols in executable" >/dev/null; then
-	CFLAGS="$BAKCFLAGS"
-	AC_MSG_RESULT(no)
-    else
-	AC_MSG_RESULT(yes)
-    fi
-    rm -f conftest conftest.c conftest.o
-], [CFLAGS="$BAKCFLAGS" ; AC_MSG_RESULT(no)])
+AC_DEFUN([ACX_CHECK_FLTO], [
+    AC_ARG_ENABLE([flto], AS_HELP_STRING([--disable-flto], [Disable link-time optimization (gcc specific option)]))
+    AS_IF([test "x$enable_flto" != "xno"], [
+        AC_MSG_CHECKING([if $CC supports -flto])
+        BAKCFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS -flto"
+        AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [
+            if $CC $CFLAGS -o conftest conftest.c 2>&1 | grep "warning: no debug symbols in executable" >/dev/null; then
+                CFLAGS="$BAKCFLAGS"
+                AC_MSG_RESULT(no)
+            else
+                AC_MSG_RESULT(yes)
+            fi
+            rm -f conftest conftest.c conftest.o
+        ], [CFLAGS="$BAKCFLAGS" ; AC_MSG_RESULT(no)])
+    ])
 ])
 
 dnl Check the printf-format attribute (if any)
@@ -1208,7 +1216,7 @@ struct tm *gmtime_r(const time_t *timep, struct tm *result);
 dnl provide w32 compat definition for sleep
 AC_DEFUN([AHX_CONFIG_W32_SLEEP],
 [
-#ifndef HAVE_SLEEP
+#if !defined(HAVE_SLEEP) || defined(HAVE_WINDOWS_H)
 #define sleep(x) Sleep((x)*1000) /* on win32 */
 #endif /* HAVE_SLEEP */
 ])
diff --git a/contrib/ldns/ax_python_devel.m4 b/contrib/ldns/ax_python_devel.m4
index 2ce6afe8350..87e7c8c253b 100644
--- a/contrib/ldns/ax_python_devel.m4
+++ b/contrib/ldns/ax_python_devel.m4
@@ -34,11 +34,12 @@
 # LICENSE
 #
 #   Copyright (c) 2009 Sebastian Huber 
-#   Copyright (c) 2009 Alan W. Irwin 
+#   Copyright (c) 2009 Alan W. Irwin
 #   Copyright (c) 2009 Rafael Laboissiere 
-#   Copyright (c) 2009 Andrew Collier 
+#   Copyright (c) 2009 Andrew Collier
 #   Copyright (c) 2009 Matteo Settenvini 
 #   Copyright (c) 2009 Horst Knorr 
+#   Copyright (c) 2013 Daniel Mullner 
 #
 #   This program is free software: you can redistribute it and/or modify it
 #   under the terms of the GNU General Public License as published by the
@@ -66,7 +67,7 @@
 #   modified version of the Autoconf Macro, you may extend this special
 #   exception to the GPL to apply to your modified version as well.
 
-#serial 8
+#serial 16
 
 AU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL])
 AC_DEFUN([AX_PYTHON_DEVEL],[
@@ -153,8 +154,14 @@ $ac_distutils_result])
 	if test -z "$PYTHON_CPPFLAGS"; then
 		python_path=`$PYTHON -c "import distutils.sysconfig; \
 			print (distutils.sysconfig.get_python_inc ());"`
+		plat_python_path=`$PYTHON -c "import distutils.sysconfig; \
+			print (distutils.sysconfig.get_python_inc (plat_specific=1));"`
 		if test -n "${python_path}"; then
-			python_path="-I$python_path"
+			if test "${plat_python_path}" != "${python_path}"; then
+				python_path="-I$python_path -I$plat_python_path"
+			else
+				python_path="-I$python_path"
+			fi
 		fi
 		PYTHON_CPPFLAGS=$python_path
 	fi
@@ -173,13 +180,10 @@ $ac_distutils_result])
 # join all versioning strings, on some systems
 # major/minor numbers could be in different list elements
 from distutils.sysconfig import *
-ret = ''
-for e in get_config_vars ('VERSION'):
-	if (e != None):
-		ret += e
-print (ret)
-EOD
-`
+e = get_config_var('VERSION')
+if e is not None:
+	print(e)
+EOD`
 
 		if test -z "$ac_python_version"; then
 			if test -n "$PYTHON_VERSION"; then
@@ -199,34 +203,27 @@ EOD
 
 # There should be only one
 import distutils.sysconfig
-for e in distutils.sysconfig.get_config_vars ('LIBDIR'):
-	if e != None:
-		print (e)
-		break
-EOD
-`
-
-		# Before checking for libpythonX.Y, we need to know
-		# the extension the OS we're on uses for libraries
-		# (we take the first one, if there's more than one fix me!):
-		ac_python_soext=`$PYTHON -c \
-		  "import distutils.sysconfig; \
-		  print (distutils.sysconfig.get_config_vars('SO')[[0]])"`
+e = distutils.sysconfig.get_config_var('LIBDIR')
+if e is not None:
+	print (e)
+EOD`
 
 		# Now, for the library:
-		ac_python_soname=`$PYTHON -c \
-		  "import distutils.sysconfig; \
-		  print (distutils.sysconfig.get_config_vars('LDLIBRARY')[[0]])"`
+		ac_python_library=`cat<
-#ifndef HAVE_B32_NTOP
-
-#include 
-#include 
-#ifdef HAVE_SYS_SOCKET_H
-#include 
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-#include 
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include 
-#endif
-
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-#include 
-
-static const char Base32[] =
-	"abcdefghijklmnopqrstuvwxyz234567";
-/*	"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";*/
-/*       00000000001111111111222222222233
-         01234567890123456789012345678901*/
-static const char Base32_extended_hex[] =
-/*	"0123456789ABCDEFGHIJKLMNOPQRSTUV";*/
-	"0123456789abcdefghijklmnopqrstuv";
-static const char Pad32 = '=';
-
-/* (From RFC3548 and draft-josefsson-rfc3548bis-00.txt)
-5.  Base 32 Encoding
-
-   The Base 32 encoding is designed to represent arbitrary sequences of
-   octets in a form that needs to be case insensitive but need not be
-   humanly readable.
-
-   A 33-character subset of US-ASCII is used, enabling 5 bits to be
-   represented per printable character.  (The extra 33rd character, "=",
-   is used to signify a special processing function.)
-
-   The encoding process represents 40-bit groups of input bits as output
-   strings of 8 encoded characters.  Proceeding from left to right, a
-   40-bit input group is formed by concatenating 5 8bit input groups.
-   These 40 bits are then treated as 8 concatenated 5-bit groups, each
-   of which is translated into a single digit in the base 32 alphabet.
-   When encoding a bit stream via the base 32 encoding, the bit stream
-   must be presumed to be ordered with the most-significant-bit first.
-   That is, the first bit in the stream will be the high-order bit in
-   the first 8bit byte, and the eighth bit will be the low-order bit in
-   the first 8bit byte, and so on.
-
-   Each 5-bit group is used as an index into an array of 32 printable
-   characters.  The character referenced by the index is placed in the
-   output string.  These characters, identified in Table 3, below, are
-   selected from US-ASCII digits and uppercase letters.
-
-                      Table 3: The Base 32 Alphabet
-
-         Value Encoding  Value Encoding  Value Encoding  Value Encoding
-             0 A             9 J            18 S            27 3
-             1 B            10 K            19 T            28 4
-             2 C            11 L            20 U            29 5
-             3 D            12 M            21 V            30 6
-             4 E            13 N            22 W            31 7
-             5 F            14 O            23 X
-             6 G            15 P            24 Y         (pad) =
-             7 H            16 Q            25 Z
-             8 I            17 R            26 2
-
-
-   Special processing is performed if fewer than 40 bits are available
-   at the end of the data being encoded.  A full encoding quantum is
-   always completed at the end of a body.  When fewer than 40 input bits
-   are available in an input group, zero bits are added (on the right)
-   to form an integral number of 5-bit groups.  Padding at the end of
-   the data is performed using the "=" character.  Since all base 32
-   input is an integral number of octets, only the following cases can
-   arise:
-
-   (1) the final quantum of encoding input is an integral multiple of 40
-   bits; here, the final unit of encoded output will be an integral
-   multiple of 8 characters with no "=" padding,
-
-   (2) the final quantum of encoding input is exactly 8 bits; here, the
-   final unit of encoded output will be two characters followed by six
-   "=" padding characters,
-
-   (3) the final quantum of encoding input is exactly 16 bits; here, the
-   final unit of encoded output will be four characters followed by four
-   "=" padding characters,
-
-   (4) the final quantum of encoding input is exactly 24 bits; here, the
-   final unit of encoded output will be five characters followed by
-   three "=" padding characters, or
-
-   (5) the final quantum of encoding input is exactly 32 bits; here, the
-   final unit of encoded output will be seven characters followed by one
-   "=" padding character.
-
-
-6.  Base 32 Encoding with Extended Hex Alphabet
-
-   The following description of base 32 is due to [7].  This encoding
-   should not be regarded as the same as the "base32" encoding, and
-   should not be referred to as only "base32".
-
-   One property with this alphabet, that the base64 and base32 alphabet
-   lack, is that encoded data maintain its sort order when the encoded
-   data is compared bit-wise.
-
-   This encoding is identical to the previous one, except for the
-   alphabet.  The new alphabet is found in table 4.
-
-                     Table 4: The "Extended Hex" Base 32 Alphabet
-
-         Value Encoding  Value Encoding  Value Encoding  Value Encoding
-             0 0             9 9            18 I            27 R
-             1 1            10 A            19 J            28 S
-             2 2            11 B            20 K            29 T
-             3 3            12 C            21 L            30 U
-             4 4            13 D            22 M            31 V
-             5 5            14 E            23 N
-             6 6            15 F            24 O         (pad) =
-             7 7            16 G            25 P
-             8 8            17 H            26 Q
-
-*/
-
-
-static int
-ldns_b32_ntop_ar(uint8_t const *src, size_t srclength, char *target, size_t targsize, const char B32_ar[]) {
-	size_t datalength = 0;
-	uint8_t input[5];
-	uint8_t output[8];
-	size_t i;
-        memset(output, 0, 8);
-
-	while (4 < srclength) {
-		input[0] = *src++;
-		input[1] = *src++;
-		input[2] = *src++;
-		input[3] = *src++;
-		input[4] = *src++;
-		srclength -= 5;
-
-		output[0] = (input[0] & 0xf8) >> 3;
-		output[1] = ((input[0] & 0x07) << 2) + ((input[1] & 0xc0) >> 6);
-		output[2] = (input[1] & 0x3e) >> 1;
-		output[3] = ((input[1] & 0x01) << 4) + ((input[2] & 0xf0) >> 4);
-		output[4] = ((input[2] & 0x0f) << 1) + ((input[3] & 0x80) >> 7);
-		output[5] = (input[3] & 0x7c) >> 2;
-		output[6] = ((input[3] & 0x03) << 3) + ((input[4] & 0xe0) >> 5);
-		output[7] = (input[4] & 0x1f);
-
-		assert(output[0] < 32);
-		assert(output[1] < 32);
-		assert(output[2] < 32);
-		assert(output[3] < 32);
-		assert(output[4] < 32);
-		assert(output[5] < 32);
-		assert(output[6] < 32);
-		assert(output[7] < 32);
-
-		if (datalength + 8 > targsize) {
-			return (-1);
-		}
-		target[datalength++] = B32_ar[output[0]];
-		target[datalength++] = B32_ar[output[1]];
-		target[datalength++] = B32_ar[output[2]];
-		target[datalength++] = B32_ar[output[3]];
-		target[datalength++] = B32_ar[output[4]];
-		target[datalength++] = B32_ar[output[5]];
-		target[datalength++] = B32_ar[output[6]];
-		target[datalength++] = B32_ar[output[7]];
-	}
-    
-	/* Now we worry about padding. */
-	if (0 != srclength) {
-		/* Get what's left. */
-		input[0] = input[1] = input[2] = input[3] = input[4] = (uint8_t) '\0';
-		for (i = 0; i < srclength; i++)
-			input[i] = *src++;
-	
-		output[0] = (input[0] & 0xf8) >> 3;
-		assert(output[0] < 32);
-		if (srclength >= 1) {
-			output[1] = ((input[0] & 0x07) << 2) + ((input[1] & 0xc0) >> 6);
-			assert(output[1] < 32);
-			output[2] = (input[1] & 0x3e) >> 1;
-			assert(output[2] < 32);
-		}
-		if (srclength >= 2) {
-			output[3] = ((input[1] & 0x01) << 4) + ((input[2] & 0xf0) >> 4);
-			assert(output[3] < 32);
-		}
-		if (srclength >= 3) {
-			output[4] = ((input[2] & 0x0f) << 1) + ((input[3] & 0x80) >> 7);
-			assert(output[4] < 32);
-			output[5] = (input[3] & 0x7c) >> 2;
-			assert(output[5] < 32);
-		}
-		if (srclength >= 4) {
-			output[6] = ((input[3] & 0x03) << 3) + ((input[4] & 0xe0) >> 5);
-			assert(output[6] < 32);
-		}
-
-
-		if (datalength + 1 > targsize) {
-			return (-2);
-		}
-		target[datalength++] = B32_ar[output[0]];
-		if (srclength >= 1) {
-			if (datalength + 1 > targsize) { return (-2); }
-			target[datalength++] = B32_ar[output[1]];
-			if (srclength == 1 && output[2] == 0) {
-				if (datalength + 1 > targsize) { return (-2); }
-				target[datalength++] = Pad32;
-			} else {
-				if (datalength + 1 > targsize) { return (-2); }
-				target[datalength++] = B32_ar[output[2]];
-			}
-		} else {
-			if (datalength + 1 > targsize) { return (-2); }
-			target[datalength++] = Pad32;
-			if (datalength + 1 > targsize) { return (-2); }
-			target[datalength++] = Pad32;
-		}
-		if (srclength >= 2) {
-			if (datalength + 1 > targsize) { return (-2); }
-			target[datalength++] = B32_ar[output[3]];
-		} else {
-			if (datalength + 1 > targsize) { return (-2); }
-			target[datalength++] = Pad32;
-		}
-		if (srclength >= 3) {
-			if (datalength + 1 > targsize) { return (-2); }
-			target[datalength++] = B32_ar[output[4]];
-			if (srclength == 3 && output[5] == 0) {
-				if (datalength + 1 > targsize) { return (-2); }
-				target[datalength++] = Pad32;
-			} else {
-				if (datalength + 1 > targsize) { return (-2); }
-				target[datalength++] = B32_ar[output[5]];
-			}
-		} else {
-			if (datalength + 1 > targsize) { return (-2); }
-			target[datalength++] = Pad32;
-			if (datalength + 1 > targsize) { return (-2); }
-			target[datalength++] = Pad32;
-		}
-		if (srclength >= 4) {
-			if (datalength + 1 > targsize) { return (-2); }
-			target[datalength++] = B32_ar[output[6]];
-		} else {
-			if (datalength + 1 > targsize) { return (-2); }
-			target[datalength++] = Pad32;
-		}
-		if (datalength + 1 > targsize) { return (-2); }
-		target[datalength++] = Pad32;
-	}
-	if (datalength+1 > targsize) {
-		return (int) (datalength);
-	}
-	target[datalength] = '\0';	/* Returned value doesn't count \0. */
-	return (int) (datalength);
-}
-
-int
-ldns_b32_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsize) {
-	return ldns_b32_ntop_ar(src, srclength, target, targsize, Base32);
-}
-
-/* deprecated, here for backwards compatibility */
-int
-b32_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsize) {
-	return ldns_b32_ntop_ar(src, srclength, target, targsize, Base32);
-}
-
-int
-ldns_b32_ntop_extended_hex(uint8_t const *src, size_t srclength, char *target, size_t targsize) {
-	return ldns_b32_ntop_ar(src, srclength, target, targsize, Base32_extended_hex);
-}
-
-/* deprecated, here for backwards compatibility */
-int
-b32_ntop_extended_hex(uint8_t const *src, size_t srclength, char *target, size_t targsize) {
-	return ldns_b32_ntop_ar(src, srclength, target, targsize, Base32_extended_hex);
-}
-
-#endif /* !HAVE_B32_NTOP */
diff --git a/contrib/ldns/compat/b32_pton.c b/contrib/ldns/compat/b32_pton.c
deleted file mode 100644
index 28accb8dd16..00000000000
--- a/contrib/ldns/compat/b32_pton.c
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
- * Copyright (c) 1996, 1998 by Internet Software Consortium.
- *
- * 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 INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM 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.
- */
-
-/*
- * Portions Copyright (c) 1995 by International Business Machines, Inc.
- *
- * International Business Machines, Inc. (hereinafter called IBM) grants
- * permission under its copyrights to use, copy, modify, and distribute this
- * Software with or without fee, provided that the above copyright notice and
- * all paragraphs of this notice appear in all copies, and that the name of IBM
- * not be used in connection with the marketing of any product incorporating
- * the Software or modifications thereof, without specific, written prior
- * permission.
- *
- * To the extent it has a right to do so, IBM grants an immunity from suit
- * under its patents, if any, for the use, sale or manufacture of products to
- * the extent that such products are used for performing Domain Name System
- * dynamic updates in TCP/IP networks by means of the Software.  No immunity is
- * granted for any product per se or for any other function of any product.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE.  IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
- * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
- * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
- */
-#include 
-#ifndef HAVE_B32_PTON
-
-#include 
-#include 
-#ifdef HAVE_SYS_SOCKET_H
-#include 
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-#include 
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include 
-#endif
-
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-/*	"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";*/
-static const char Base32[] =
-	"abcdefghijklmnopqrstuvwxyz234567";
-/*	"0123456789ABCDEFGHIJKLMNOPQRSTUV";*/
-static const char Base32_extended_hex[] =
-	"0123456789abcdefghijklmnopqrstuv";
-static const char Pad32 = '=';
-
-/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt)
-5.  Base 32 Encoding
-
-   The Base 32 encoding is designed to represent arbitrary sequences of
-   octets in a form that needs to be case insensitive but need not be
-   humanly readable.
-
-   A 33-character subset of US-ASCII is used, enabling 5 bits to be
-   represented per printable character.  (The extra 33rd character, "=",
-   is used to signify a special processing function.)
-
-   The encoding process represents 40-bit groups of input bits as output
-   strings of 8 encoded characters.  Proceeding from left to right, a
-   40-bit input group is formed by concatenating 5 8bit input groups.
-   These 40 bits are then treated as 8 concatenated 5-bit groups, each
-   of which is translated into a single digit in the base 32 alphabet.
-   When encoding a bit stream via the base 32 encoding, the bit stream
-   must be presumed to be ordered with the most-significant-bit first.
-   That is, the first bit in the stream will be the high-order bit in
-   the first 8bit byte, and the eighth bit will be the low-order bit in
-   the first 8bit byte, and so on.
-
-   Each 5-bit group is used as an index into an array of 32 printable
-   characters.  The character referenced by the index is placed in the
-   output string.  These characters, identified in Table 3, below, are
-   selected from US-ASCII digits and uppercase letters.
-
-                      Table 3: The Base 32 Alphabet
-
-         Value Encoding  Value Encoding  Value Encoding  Value Encoding
-             0 A             9 J            18 S            27 3
-             1 B            10 K            19 T            28 4
-             2 C            11 L            20 U            29 5
-             3 D            12 M            21 V            30 6
-             4 E            13 N            22 W            31 7
-             5 F            14 O            23 X
-             6 G            15 P            24 Y         (pad) =
-             7 H            16 Q            25 Z
-             8 I            17 R            26 2
-
-
-   Special processing is performed if fewer than 40 bits are available
-   at the end of the data being encoded.  A full encoding quantum is
-   always completed at the end of a body.  When fewer than 40 input bits
-   are available in an input group, zero bits are added (on the right)
-   to form an integral number of 5-bit groups.  Padding at the end of
-   the data is performed using the "=" character.  Since all base 32
-   input is an integral number of octets, only the following cases can
-   arise:
-
-   (1) the final quantum of encoding input is an integral multiple of 40
-   bits; here, the final unit of encoded output will be an integral
-   multiple of 8 characters with no "=" padding,
-
-   (2) the final quantum of encoding input is exactly 8 bits; here, the
-   final unit of encoded output will be two characters followed by six
-   "=" padding characters,
-
-   (3) the final quantum of encoding input is exactly 16 bits; here, the
-   final unit of encoded output will be four characters followed by four
-   "=" padding characters,
-
-   (4) the final quantum of encoding input is exactly 24 bits; here, the
-   final unit of encoded output will be five characters followed by
-   three "=" padding characters, or
-
-   (5) the final quantum of encoding input is exactly 32 bits; here, the
-   final unit of encoded output will be seven characters followed by one
-   "=" padding character.
-
-
-6.  Base 32 Encoding with Extended Hex Alphabet
-
-   The following description of base 32 is due to [7].  This encoding
-   should not be regarded as the same as the "base32" encoding, and
-   should not be referred to as only "base32".
-
-   One property with this alphabet, that the base32 and base32 alphabet
-   lack, is that encoded data maintain its sort order when the encoded
-   data is compared bit-wise.
-
-   This encoding is identical to the previous one, except for the
-   alphabet.  The new alphabet is found in table 4.
-
-                     Table 4: The "Extended Hex" Base 32 Alphabet
-
-         Value Encoding  Value Encoding  Value Encoding  Value Encoding
-             0 0             9 9            18 I            27 R
-             1 1            10 A            19 J            28 S
-             2 2            11 B            20 K            29 T
-             3 3            12 C            21 L            30 U
-             4 4            13 D            22 M            31 V
-             5 5            14 E            23 N
-             6 6            15 F            24 O         (pad) =
-             7 7            16 G            25 P
-             8 8            17 H            26 Q
-
-
-
-
-*/
-/* skips all whitespace anywhere.
-   converts characters, four at a time, starting at (or after)
-   src from base - 32 numbers into three 8 bit bytes in the target area.
-   it returns the number of data bytes stored at the target, or -1 on error.
- */
-
-static int
-ldns_b32_pton_ar(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize, const char B32_ar[])
-{
-	int tarindex, state, ch;
-	char *pos;
-	int i = 0;
-
-	state = 0;
-	tarindex = 0;
-	
-	while ((ch = *src++) != '\0' && (i == 0 || i < (int) hashed_owner_str_len)) {
-		i++;
-		ch = tolower(ch);
-		if (isspace((unsigned char)ch))        /* Skip whitespace anywhere. */
-			continue;
-
-		if (ch == Pad32)
-			break;
-
-		pos = strchr(B32_ar, ch);
-		if (pos == 0) {
-			/* A non-base32 character. */
-			return (-ch);
-		}
-
-		switch (state) {
-		case 0:
-			if (target) {
-				if ((size_t)tarindex >= targsize) {
-					return (-2);
-				}
-				target[tarindex] = (pos - B32_ar) << 3;
-			}
-			state = 1;
-			break;
-		case 1:
-			if (target) {
-				if ((size_t)tarindex + 1 >= targsize) {
-					return (-3);
-				}
-				target[tarindex]   |=  (pos - B32_ar) >> 2;
-				target[tarindex+1]  = ((pos - B32_ar) & 0x03)
-							<< 6 ;
-			}
-			tarindex++;
-			state = 2;
-			break;
-		case 2:
-			if (target) {
-				if ((size_t)tarindex + 1 >= targsize) {
-					return (-4);
-				}
-				target[tarindex]   |=  (pos - B32_ar) << 1;
-			}
-			/*tarindex++;*/
-			state = 3;
-			break;
-		case 3:
-			if (target) {
-				if ((size_t)tarindex + 1 >= targsize) {
-					return (-5);
-				}
-				target[tarindex]   |=  (pos - B32_ar) >> 4;
-				target[tarindex+1]  = ((pos - B32_ar) & 0x0f) << 4 ;
-			}
-			tarindex++;
-			state = 4;
-			break;
-		case 4:
-			if (target) {
-				if ((size_t)tarindex + 1 >= targsize) {
-					return (-6);
-				}
-				target[tarindex]   |=  (pos - B32_ar) >> 1;
-				target[tarindex+1]  = ((pos - B32_ar) & 0x01)
-							<< 7 ;
-			}
-			tarindex++;
-			state = 5;
-			break;
-		case 5:
-			if (target) {
-				if ((size_t)tarindex + 1 >= targsize) {
-					return (-7);
-				}
-				target[tarindex]   |=  (pos - B32_ar) << 2;
-			}
-			state = 6;
-			break;
-		case 6:
-			if (target) {
-				if ((size_t)tarindex + 1 >= targsize) {
-					return (-8);
-				}
-				target[tarindex]   |=  (pos - B32_ar) >> 3;
-				target[tarindex+1]  = ((pos - B32_ar) & 0x07)
-							<< 5 ;
-			}
-			tarindex++;
-			state = 7;
-			break;
-		case 7:
-			if (target) {
-				if ((size_t)tarindex + 1 >= targsize) {
-					return (-9);
-				}
-				target[tarindex]   |=  (pos - B32_ar);
-			}
-			tarindex++;
-			state = 0;
-			break;
-		default:
-			abort();
-		}
-	}
-
-	/*
-	 * We are done decoding Base-32 chars.  Let's see if we ended
-	 * on a byte boundary, and/or with erroneous trailing characters.
-	 */
-
-	if (ch == Pad32) {		/* We got a pad char. */
-		ch = *src++;		/* Skip it, get next. */
-		switch (state) {
-		case 0:		/* Invalid = in first position */
-		case 1:		/* Invalid = in second position */
-			return (-10);
-
-		case 2:		/* Valid, means one byte of info */
-		case 3:
-			/* Skip any number of spaces. */
-			for ((void)NULL; ch != '\0'; ch = *src++)
-				if (!isspace((unsigned char)ch))
-					break;
-			/* Make sure there is another trailing = sign. */
-			if (ch != Pad32) {
-				return (-11);
-			}
-			ch = *src++;		/* Skip the = */
-			/* Fall through to "single trailing =" case. */
-			/* FALLTHROUGH */
-
-		case 4:		/* Valid, means two bytes of info */
-		case 5:
-		case 6:
-			/*
-			 * We know this char is an =.  Is there anything but
-			 * whitespace after it?
-			 */
-			for ((void)NULL; ch != '\0'; ch = *src++)
-				if (!(isspace((unsigned char)ch) || ch == '=')) {
-					return (-12);
-				}
-
-		case 7:		/* Valid, means three bytes of info */
-			/*
-			 * We know this char is an =.  Is there anything but
-			 * whitespace after it?
-			 */
-			for ((void)NULL; ch != '\0'; ch = *src++)
-				if (!isspace((unsigned char)ch)) {
-					return (-13);
-				}
-
-			/*
-			 * Now make sure for cases 2 and 3 that the "extra"
-			 * bits that slopped past the last full byte were
-			 * zeros.  If we don't check them, they become a
-			 * subliminal channel.
-			 */
-			if (target && target[tarindex] != 0) {
-				return (-14);
-			}
-		}
-	} else {
-		/*
-		 * We ended by seeing the end of the string.  Make sure we
-		 * have no partial bytes lying around.
-		 */
-		if (state != 0)
-			return (-15);
-	}
-
-	return (tarindex);
-}
-
-int
-ldns_b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize)
-{
-	return ldns_b32_pton_ar(src, hashed_owner_str_len, target, targsize, Base32);
-}
-
-/* deprecated, here for backwards compatibility */
-int
-b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize)
-{
-	return ldns_b32_pton_ar(src, hashed_owner_str_len, target, targsize, Base32);
-}
-
-int
-ldns_b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize)
-{
-	return ldns_b32_pton_ar(src, hashed_owner_str_len, target, targsize, Base32_extended_hex);
-}
-
-/* deprecated, here for backwards compatibility */
-int
-b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize)
-{
-	return ldns_b32_pton_ar(src, hashed_owner_str_len, target, targsize, Base32_extended_hex);
-}
-
-#endif /* !HAVE_B32_PTON */
diff --git a/contrib/ldns/compat/b64_ntop.c b/contrib/ldns/compat/b64_ntop.c
index a40bad6d344..6895acafd37 100644
--- a/contrib/ldns/compat/b64_ntop.c
+++ b/contrib/ldns/compat/b64_ntop.c
@@ -40,30 +40,10 @@
  * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
  */
 #include 
-#ifndef HAVE_B64_NTOP
-
-#include 
-#include 
-#ifdef HAVE_SYS_SOCKET_H
-#include 
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-#include 
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include 
-#endif
-
 #include 
-#include 
 #include 
 #include 
 
-#include 
-
-#define Assert(Cond) if (!(Cond)) abort()
-
 static const char Base64[] =
 	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 static const char Pad64 = '=';
@@ -157,10 +137,10 @@ ldns_b64_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsiz
 		output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
 		output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
 		output[3] = input[2] & 0x3f;
-		Assert(output[0] < 64);
-		Assert(output[1] < 64);
-		Assert(output[2] < 64);
-		Assert(output[3] < 64);
+		assert(output[0] < 64);
+		assert(output[1] < 64);
+		assert(output[2] < 64);
+		assert(output[3] < 64);
 
 		if (datalength + 4 > targsize) {
 			return (-1);
@@ -181,9 +161,9 @@ ldns_b64_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsiz
 		output[0] = input[0] >> 2;
 		output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
 		output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
-		Assert(output[0] < 64);
-		Assert(output[1] < 64);
-		Assert(output[2] < 64);
+		assert(output[0] < 64);
+		assert(output[1] < 64);
+		assert(output[2] < 64);
 
 		if (datalength + 4 > targsize) {
 			return (-2);
@@ -203,5 +183,3 @@ ldns_b64_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsiz
 	target[datalength] = '\0';	/* Returned value doesn't count \0. */
 	return (int) (datalength);
 }
-
-#endif /* !HAVE_B64_NTOP */
diff --git a/contrib/ldns/compat/b64_pton.c b/contrib/ldns/compat/b64_pton.c
index 5b128e9ba29..abe32819e92 100644
--- a/contrib/ldns/compat/b64_pton.c
+++ b/contrib/ldns/compat/b64_pton.c
@@ -40,28 +40,10 @@
  * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
  */
 #include 
-#ifndef HAVE_B64_PTON
-
-#include 
-#include 
-#ifdef HAVE_SYS_SOCKET_H
-#include 
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-#include 
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include 
-#endif
-
 #include 
-#include 
 #include 
 #include 
 
-#include 
-
 static const char Base64[] =
 	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 static const char Pad64 = '=';
@@ -259,5 +241,3 @@ ldns_b64_pton(char const *src, uint8_t *target, size_t targsize)
 
 	return (tarindex);
 }
-
-#endif /* !HAVE_B64_PTON */
diff --git a/contrib/ldns/compat/snprintf.c b/contrib/ldns/compat/snprintf.c
index b7445111cb3..d869ba5e7d0 100644
--- a/contrib/ldns/compat/snprintf.c
+++ b/contrib/ldns/compat/snprintf.c
@@ -1,770 +1,1036 @@
-#include 
-
-#ifndef HAVE_SNPRINTF
-
-#include 
-#include 
-
-/* Define this as a fall through, HAVE_STDARG_H is probably already set */
-
-#define HAVE_VARARGS_H
-
-/**************************************************************
- * Original:
- * Patrick Powell Tue Apr 11 09:48:21 PDT 1995
- * A bombproof version of doprnt (dopr) included.
- * Sigh.  This sort of thing is always nasty do deal with.  Note that
- * the version here does not include floating point...
+/* snprintf - compatibility implementation of snprintf, vsnprintf
  *
- * snprintf() is used instead of sprintf() as it does limit checks
- * for string length.  This covers a nasty loophole.
+ * Copyright (c) 2013, NLnet Labs. All rights reserved.
  *
- * The other functions are there to prevent NULL pointers from
- * causing nast effects.
- *
- * More Recently:
- *  Brandon Long (blong@fiction.net) 9/15/96 for mutt 0.43
- *  This was ugly.  It is still ugly.  I opted out of floating point
- *  numbers, but the formatter understands just about everything
- *  from the normal C string format, at least as far as I can tell from
- *  the Solaris 2.5 printf(3S) man page.
- *
- *  Brandon Long (blong@fiction.net) 10/22/97 for mutt 0.87.1
- *    Ok, added some minimal floating point support, which means this
- *    probably requires libm on most operating systems.  Don't yet
- *    support the exponent (e,E) and sigfig (g,G).  Also, fmtint()
- *    was pretty badly broken, it just wasn't being exercised in ways
- *    which showed it, so that's been fixed.  Also, formated the code
- *    to mutt conventions, and removed dead code left over from the
- *    original.  Also, there is now a builtin-test, just compile with:
- *           gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm
- *    and run snprintf for results.
- *
- **************************************************************/
-
-
-/* varargs declarations: */
-
-#if defined(HAVE_STDARG_H)
-# include 
-# define HAVE_STDARGS    /* let's hope that works everywhere (mj) */
-# define VA_LOCAL_DECL   va_list ap
-# define VA_START(f)     va_start(ap, f)
-# define VA_SHIFT(v,t)  ;   /* no-op for ANSI */
-# define VA_END          va_end(ap)
-#else
-# if defined(HAVE_VARARGS_H)
-#  include 
-#  undef HAVE_STDARGS
-#  define VA_LOCAL_DECL   va_list ap
-#  define VA_START(f)     va_start(ap)      /* f is ignored! */
-#  define VA_SHIFT(v,t) v = va_arg(ap,t)
-#  define VA_END        va_end(ap)
-# else
-/*XX ** NO VARARGS ** XX*/
-# endif
-#endif
-
-int snprintf (char *str, size_t count, const char *fmt, ...);
-int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
-
-static void dopr (char *buffer, size_t maxlen, const char *format, 
-                  va_list args);
-static void fmtstr (char *buffer, size_t *currlen, size_t maxlen,
-		    char *value, int flags, int min, int max);
-static void fmtint (char *buffer, size_t *currlen, size_t maxlen,
-		    long value, int base, int min, int max, int flags);
-static void fmtfp (char *buffer, size_t *currlen, size_t maxlen,
-		   long double fvalue, int min, int max, int flags);
-static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c );
-
-int vsnprintf (char *str, size_t count, const char *fmt, va_list args)
-{
-  str[0] = 0;
-  dopr(str, count, fmt, args);
-  return(strlen(str));
-}
-
-/* VARARGS3 */
-#ifdef HAVE_STDARGS
-int snprintf (char *str,size_t count,const char *fmt,...)
-#else
-int snprintf (va_alist) va_dcl
-#endif
-{
-#ifndef HAVE_STDARGS
-  char *str;
-  size_t count;
-  char *fmt;
-#endif
-  VA_LOCAL_DECL;
-    
-  VA_START (fmt);
-  VA_SHIFT (str, char *);
-  VA_SHIFT (count, size_t );
-  VA_SHIFT (fmt, char *);
-  (void) vsnprintf(str, count, fmt, ap);
-  VA_END;
-  return(strlen(str));
-}
-
-/*
- * dopr(): poor man's version of doprintf
+ * This software is open source.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 
+ * 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.
+ * 
+ * Neither the name of the NLNET LABS 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 COPYRIGHT HOLDERS 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.
  */
 
-/* format read states */
-#define DP_S_DEFAULT 0
-#define DP_S_FLAGS   1
-#define DP_S_MIN     2
-#define DP_S_DOT     3
-#define DP_S_MAX     4
-#define DP_S_MOD     5
-#define DP_S_CONV    6
-#define DP_S_DONE    7
-
-/* format flags - Bits */
-#define DP_F_MINUS 1
-#define DP_F_PLUS  2
-#define DP_F_SPACE 4
-#define DP_F_NUM   8
-#define DP_F_ZERO  16
-#define DP_F_UP    32
-
-/* Conversion Flags */
-#define DP_C_SHORT   1
-#define DP_C_LONG    2
-#define DP_C_LDOUBLE 3
-
-#define char_to_int(p) (p - '0')
-#define MAX(p,q) ((p >= q) ? p : q)
-
-static void dopr (char *buffer, size_t maxlen, const char *format, va_list args)
-{
-  char ch;
-  long value;
-  long double fvalue;
-  char *strvalue;
-  int min;
-  int max;
-  int state;
-  int flags;
-  int cflags;
-  size_t currlen;
-  
-  state = DP_S_DEFAULT;
-  currlen = flags = cflags = min = 0;
-  max = -1;
-  ch = *format++;
-
-  while (state != DP_S_DONE)
-  {
-    if ((ch == '\0') || (currlen >= maxlen)) 
-      state = DP_S_DONE;
-
-    switch(state) 
-    {
-    case DP_S_DEFAULT:
-      if (ch == '%') 
-	state = DP_S_FLAGS;
-      else 
-	dopr_outch (buffer, &currlen, maxlen, ch);
-      ch = *format++;
-      break;
-    case DP_S_FLAGS:
-      switch (ch) 
-      {
-      case '-':
-	flags |= DP_F_MINUS;
-        ch = *format++;
-	break;
-      case '+':
-	flags |= DP_F_PLUS;
-        ch = *format++;
-	break;
-      case ' ':
-	flags |= DP_F_SPACE;
-        ch = *format++;
-	break;
-      case '#':
-	flags |= DP_F_NUM;
-        ch = *format++;
-	break;
-      case '0':
-	flags |= DP_F_ZERO;
-        ch = *format++;
-	break;
-      default:
-	state = DP_S_MIN;
-	break;
-      }
-      break;
-    case DP_S_MIN:
-      if (isdigit((int) ch)) 
-      {
-	min = 10*min + char_to_int (ch);
-	ch = *format++;
-      } 
-      else if (ch == '*') 
-      {
-	min = va_arg (args, int);
-	ch = *format++;
-	state = DP_S_DOT;
-      } 
-      else 
-	state = DP_S_DOT;
-      break;
-    case DP_S_DOT:
-      if (ch == '.') 
-      {
-	state = DP_S_MAX;
-	ch = *format++;
-      } 
-      else 
-	state = DP_S_MOD;
-      break;
-    case DP_S_MAX:
-      if (isdigit((int) ch)) 
-      {
-	if (max < 0)
-	  max = 0;
-	max = 10*max + char_to_int (ch);
-	ch = *format++;
-      } 
-      else if (ch == '*') 
-      {
-	max = va_arg (args, int);
-	ch = *format++;
-	state = DP_S_MOD;
-      } 
-      else 
-	state = DP_S_MOD;
-      break;
-    case DP_S_MOD:
-      /* Currently, we don't support Long Long, bummer */
-      switch (ch) 
-      {
-      case 'h':
-	cflags = DP_C_SHORT;
-	ch = *format++;
-	break;
-      case 'l':
-	cflags = DP_C_LONG;
-	ch = *format++;
-	break;
-      case 'L':
-	cflags = DP_C_LDOUBLE;
-	ch = *format++;
-	break;
-      default:
-	break;
-      }
-      state = DP_S_CONV;
-      break;
-    case DP_S_CONV:
-      switch (ch) 
-      {
-      case 'd':
-      case 'i':
-	if (cflags == DP_C_SHORT) 
-	  value = va_arg (args, int);
-	else if (cflags == DP_C_LONG)
-	  value = va_arg (args, long int);
-	else
-	  value = va_arg (args, int);
-	fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags);
-	break;
-      case 'o':
-	flags &= ~DP_F_PLUS;
-	if (cflags == DP_C_SHORT)
-	  value = va_arg (args, unsigned int);
-	else if (cflags == DP_C_LONG)
-	  value = va_arg (args, unsigned long int);
-	else
-	  value = va_arg (args, unsigned int);
-	fmtint (buffer, &currlen, maxlen, value, 8, min, max, flags);
-	break;
-      case 'u':
-	flags &= ~DP_F_PLUS;
-	if (cflags == DP_C_SHORT)
-	  value = va_arg (args, unsigned int);
-	else if (cflags == DP_C_LONG)
-	  value = va_arg (args, unsigned long int);
-	else
-	  value = va_arg (args, unsigned int);
-	fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags);
-	break;
-      case 'X':
-	flags |= DP_F_UP;
-      case 'x':
-	flags &= ~DP_F_PLUS;
-	if (cflags == DP_C_SHORT)
-	  value = va_arg (args, unsigned int);
-	else if (cflags == DP_C_LONG)
-	  value = va_arg (args, unsigned long int);
-	else
-	  value = va_arg (args, unsigned int);
-	fmtint (buffer, &currlen, maxlen, value, 16, min, max, flags);
-	break;
-      case 'f':
-	if (cflags == DP_C_LDOUBLE)
-	  fvalue = va_arg (args, long double);
-	else
-	  fvalue = va_arg (args, double);
-	/* um, floating point? */
-	fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags);
-	break;
-      case 'E':
-	flags |= DP_F_UP;
-      case 'e':
-	if (cflags == DP_C_LDOUBLE)
-	  fvalue = va_arg (args, long double);
-	else
-	  fvalue = va_arg (args, double);
-	break;
-      case 'G':
-	flags |= DP_F_UP;
-      case 'g':
-	if (cflags == DP_C_LDOUBLE)
-	  fvalue = va_arg (args, long double);
-	else
-	  fvalue = va_arg (args, double);
-	break;
-      case 'c':
-	dopr_outch (buffer, &currlen, maxlen, va_arg (args, int));
-	break;
-      case 's':
-	strvalue = va_arg (args, char *);
-	if (max < 0) 
-	  max = maxlen; /* ie, no max */
-	fmtstr (buffer, &currlen, maxlen, strvalue, flags, min, max);
-	break;
-      case 'p':
-	strvalue = va_arg (args, void *);
-	fmtint (buffer, &currlen, maxlen, (long) strvalue, 16, min, max, flags);
-	break;
-      case 'n':
-	if (cflags == DP_C_SHORT) 
-	{
-	  short int *num;
-	  num = va_arg (args, short int *);
-	  *num = currlen;
-        } 
-	else if (cflags == DP_C_LONG) 
-	{
-	  long int *num;
-	  num = va_arg (args, long int *);
-	  *num = currlen;
-        } 
-	else 
-	{
-	  int *num;
-	  num = va_arg (args, int *);
-	  *num = currlen;
-        }
-	break;
-      case '%':
-	dopr_outch (buffer, &currlen, maxlen, ch);
-	break;
-      case 'w':
-	/* not supported yet, treat as next char */
-	ch = *format++;
-	break;
-      default:
-	/* Unknown, skip */
-	break;
-      }
-      ch = *format++;
-      state = DP_S_DEFAULT;
-      flags = cflags = min = 0;
-      max = -1;
-      break;
-    case DP_S_DONE:
-      break;
-    default:
-      /* hmm? */
-      break; /* some picky compilers need this */
-    }
-  }
-  if (currlen < maxlen - 1) 
-    buffer[currlen] = '\0';
-  else 
-    buffer[maxlen - 1] = '\0';
-}
-
-static void fmtstr (char *buffer, size_t *currlen, size_t maxlen,
-		    char *value, int flags, int min, int max)
-{
-  int padlen, strln;     /* amount to pad */
-  int cnt = 0;
-  
-  if (value == 0)
-  {
-    value = (char *) "";
-  }
-
-  for (strln = 0; value[strln]; ++strln); /* strlen */
-  padlen = min - strln;
-  if (padlen < 0) 
-    padlen = 0;
-  if (flags & DP_F_MINUS) 
-    padlen = -padlen; /* Left Justify */
-
-  while ((padlen > 0) && (cnt < max)) 
-  {
-    dopr_outch (buffer, currlen, maxlen, ' ');
-    --padlen;
-    ++cnt;
-  }
-  while (*value && (cnt < max)) 
-  {
-    dopr_outch (buffer, currlen, maxlen, *value++);
-    ++cnt;
-  }
-  while ((padlen < 0) && (cnt < max)) 
-  {
-    dopr_outch (buffer, currlen, maxlen, ' ');
-    ++padlen;
-    ++cnt;
-  }
-}
-
-/* Have to handle DP_F_NUM (ie 0x and 0 alternates) */
-
-static void fmtint (char *buffer, size_t *currlen, size_t maxlen,
-		    long value, int base, int min, int max, int flags)
-{
-  int signvalue = 0;
-  unsigned long uvalue;
-  char convert[20];
-  int place = 0;
-  int spadlen = 0; /* amount to space pad */
-  int zpadlen = 0; /* amount to zero pad */
-  int caps = 0;
-  
-  if (max < 0)
-    max = 0;
-
-  uvalue = value;
-  if( value < 0 ) {
-    signvalue = '-';
-    uvalue = -value;
-  }
-  else
-    if (flags & DP_F_PLUS)  /* Do a sign (+/i) */
-      signvalue = '+';
-    else
-      if (flags & DP_F_SPACE)
-	signvalue = ' ';
-
-  if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */
-
-  do {
-    convert[place++] =
-      (caps? "0123456789ABCDEF":"0123456789abcdef")
-      [uvalue % (unsigned)base  ];
-    uvalue = (uvalue / (unsigned)base );
-  } while(uvalue && (place < 20));
-  if (place == 20) place--;
-  convert[place] = 0;
-
-  zpadlen = max - place;
-  spadlen = min - MAX (max, place) - (signvalue ? 1 : 0); 
-  if (zpadlen < 0) zpadlen = 0;
-  if (spadlen < 0) spadlen = 0;
-  if (flags & DP_F_ZERO)
-  {
-    zpadlen = MAX(zpadlen, spadlen);
-    spadlen = 0;
-  }
-  if (flags & DP_F_MINUS) 
-    spadlen = -spadlen; /* Left Justifty */
-
-#ifdef DEBUG_SNPRINTF
-  dprint (1, (debugfile, "zpad: %d, spad: %d, min: %d, max: %d, place: %d\n",
-      zpadlen, spadlen, min, max, place));
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#ifdef HAVE_STDINT_H
+#include 
 #endif
 
-  /* Spaces */
-  while (spadlen > 0) 
-  {
-    dopr_outch (buffer, currlen, maxlen, ' ');
-    --spadlen;
-  }
-
-  /* Sign */
-  if (signvalue) 
-    dopr_outch (buffer, currlen, maxlen, signvalue);
-
-  /* Zeros */
-  if (zpadlen > 0) 
-  {
-    while (zpadlen > 0)
-    {
-      dopr_outch (buffer, currlen, maxlen, '0');
-      --zpadlen;
-    }
-  }
-
-  /* Digits */
-  while (place > 0) 
-    dopr_outch (buffer, currlen, maxlen, convert[--place]);
-  
-  /* Left Justified spaces */
-  while (spadlen < 0) {
-    dopr_outch (buffer, currlen, maxlen, ' ');
-    ++spadlen;
-  }
-}
-
-static long double abs_val (long double value)
-{
-  long double result = value;
-
-  if (value < 0)
-    result = -value;
-
-  return result;
-}
-
-static double pow10 (double exp)
-{
-  long double result = 1;
-
-  while (exp)
-  {
-    result *= 10;
-    exp--;
-  }
-  
-  return result;
-}
-
-static double round (double value)
-{
-  long intpart;
-
-  intpart = value;
-  value = value - intpart;
-  if (value >= 0.5)
-    intpart++;
-
-  return intpart;
-}
-
-static void fmtfp (char *buffer, size_t *currlen, size_t maxlen,
-		   long double fvalue, int min, int max, int flags)
-{
-  int signvalue = 0;
-  long double ufvalue;
-  char iconvert[20];
-  char fconvert[20];
-  int iplace = 0;
-  int fplace = 0;
-  int padlen = 0; /* amount to pad */
-  int zpadlen = 0; 
-  int caps = 0;
-  long intpart;
-  long fracpart;
-  
-  /* 
-   * AIX manpage says the default is 0, but Solaris says the default
-   * is 6, and sprintf on AIX defaults to 6
-   */
-  if (max < 0)
-    max = 6;
-
-  ufvalue = abs_val (fvalue);
-
-  if (fvalue < 0)
-    signvalue = '-';
-  else
-    if (flags & DP_F_PLUS)  /* Do a sign (+/i) */
-      signvalue = '+';
-    else
-      if (flags & DP_F_SPACE)
-	signvalue = ' ';
-
-#if 0
-  if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */
-#endif
-
-  intpart = ufvalue;
-
-  /* 
-   * Sorry, we only support 9 digits past the decimal because of our 
-   * conversion method
-   */
-  if (max > 9)
-    max = 9;
-
-  /* We "cheat" by converting the fractional part to integer by
-   * multiplying by a factor of 10
-   */
-  fracpart = round ((pow10 (max)) * (ufvalue - intpart));
-
-  if (fracpart >= pow10 (max))
-  {
-    intpart++;
-    fracpart -= pow10 (max);
-  }
-
-#ifdef DEBUG_SNPRINTF
-  dprint (1, (debugfile, "fmtfp: %f =? %d.%d\n", fvalue, intpart, fracpart));
-#endif
-
-  /* Convert integer part */
-  do {
-    iconvert[iplace++] =
-      (caps? "0123456789ABCDEF":"0123456789abcdef")[intpart % 10];
-    intpart = (intpart / 10);
-  } while(intpart && (iplace < 20));
-  if (iplace == 20) iplace--;
-  iconvert[iplace] = 0;
-
-  /* Convert fractional part */
-  do {
-    fconvert[fplace++] =
-      (caps? "0123456789ABCDEF":"0123456789abcdef")[fracpart % 10];
-    fracpart = (fracpart / 10);
-  } while(fracpart && (fplace < 20));
-  if (fplace == 20) fplace--;
-  fconvert[fplace] = 0;
-
-  /* -1 for decimal point, another -1 if we are printing a sign */
-  padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0); 
-  zpadlen = max - fplace;
-  if (zpadlen < 0)
-    zpadlen = 0;
-  if (padlen < 0) 
-    padlen = 0;
-  if (flags & DP_F_MINUS) 
-    padlen = -padlen; /* Left Justifty */
-
-  if ((flags & DP_F_ZERO) && (padlen > 0)) 
-  {
-    if (signvalue) 
-    {
-      dopr_outch (buffer, currlen, maxlen, signvalue);
-      --padlen;
-      signvalue = 0;
-    }
-    while (padlen > 0)
-    {
-      dopr_outch (buffer, currlen, maxlen, '0');
-      --padlen;
-    }
-  }
-  while (padlen > 0)
-  {
-    dopr_outch (buffer, currlen, maxlen, ' ');
-    --padlen;
-  }
-  if (signvalue) 
-    dopr_outch (buffer, currlen, maxlen, signvalue);
-
-  while (iplace > 0) 
-    dopr_outch (buffer, currlen, maxlen, iconvert[--iplace]);
-
-  /*
-   * Decimal point.  This should probably use locale to find the correct
-   * char to print out.
-   */
-  dopr_outch (buffer, currlen, maxlen, '.');
-
-  while (zpadlen > 0)
-  {
-    dopr_outch (buffer, currlen, maxlen, '0');
-    --zpadlen;
-  }
-
-  while (fplace > 0) 
-    dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]);
-
-  while (padlen < 0) 
-  {
-    dopr_outch (buffer, currlen, maxlen, ' ');
-    ++padlen;
-  }
-}
-
-static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c)
-{
-  if (*currlen < maxlen)
-    buffer[(*currlen)++] = c;
-}
-
-#ifdef TEST_SNPRINTF
-#ifndef LONG_STRING
-#define LONG_STRING 1024
-#endif
-int main (void)
-{
-  char buf1[LONG_STRING];
-  char buf2[LONG_STRING];
-  char *fp_fmt[] = {
-    "%-1.5f",
-    "%1.5f",
-    "%123.9f",
-    "%10.5f",
-    "% 10.5f",
-    "%+22.9f",
-    "%+4.9f",
-    "%01.3f",
-    "%4f",
-    "%3.1f",
-    "%3.2f",
-    NULL
-  };
-  double fp_nums[] = { -1.5, 134.21, 91340.2, 341.1234, 0203.9, 0.96, 0.996, 
-    0.9996, 1.996, 4.136, 0};
-  char *int_fmt[] = {
-    "%-1.5d",
-    "%1.5d",
-    "%123.9d",
-    "%5.5d",
-    "%10.5d",
-    "% 10.5d",
-    "%+22.33d",
-    "%01.3d",
-    "%4d",
-    NULL
-  };
-  long int_nums[] = { -1, 134, 91340, 341, 0203, 0};
-  int x, y;
-  int fail = 0;
-  int num = 0;
-
-  printf ("Testing snprintf format codes against system sprintf...\n");
-
-  for (x = 0; fp_fmt[x] != NULL ; x++)
-    for (y = 0; fp_nums[y] != 0 ; y++)
-    {
-      snprintf (buf1, sizeof (buf1), fp_fmt[x], fp_nums[y]);
-      sprintf (buf2, fp_fmt[x], fp_nums[y]);
-      if (strcmp (buf1, buf2))
-      {
-	printf("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf  = %s\n", 
-	    fp_fmt[x], buf1, buf2);
-	fail++;
-      }
-      num++;
-    }
-
-  for (x = 0; int_fmt[x] != NULL ; x++)
-    for (y = 0; int_nums[y] != 0 ; y++)
-    {
-      snprintf (buf1, sizeof (buf1), int_fmt[x], int_nums[y]);
-      sprintf (buf2, int_fmt[x], int_nums[y]);
-      if (strcmp (buf1, buf2))
-      {
-	printf("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf  = %s\n", 
-	    int_fmt[x], buf1, buf2);
-	fail++;
-      }
-      num++;
-    }
-  printf ("%d tests failed out of %d.\n", fail, num);
-}
+/* for test */
+/* #define SNPRINTF_TEST 1 */
+#ifdef SNPRINTF_TEST
+#define snprintf my_snprintf
+#define vsnprintf my_vsnprintf
 #endif /* SNPRINTF_TEST */
 
-#endif /* !HAVE_SNPRINTF */
+int snprintf(char* str, size_t size, const char* format, ...);
+int vsnprintf(char* str, size_t size, const char* format, va_list arg);
+
+/**
+ * Very portable snprintf implementation, limited in functionality,
+ * esp. for %[capital] %[nonportable] and so on.  Reduced float functionality,
+ * mostly in formatting and range (e+-16), for %f and %g.
+ *
+ * %s, %d, %u, %i, %x, %c, %n and %% are fully supported.
+ *   This includes width, precision, flags 0- +, and *(arg for wid,prec).
+ * %f, %g, %m, %p have reduced support, support for wid,prec,flags,*, but
+ *   less floating point range, no %e formatting for %g.
+ */
+int snprintf(char* str, size_t size, const char* format, ...)
+{
+	int r;
+	va_list args;
+	va_start(args, format);
+	r = vsnprintf(str, size, format, args);
+	va_end(args);
+	return r;
+}
+
+/** add padding to string */
+static void
+print_pad(char** at, size_t* left, int* ret, char p, int num)
+{
+	while(num--) {
+		if(*left > 1) {
+			*(*at)++ = p;
+			(*left)--;
+		}
+		(*ret)++;
+	}
+}
+
+/** get negative symbol, 0 if none */
+static char
+get_negsign(int negative, int plus, int space)
+{
+	if(negative)
+		return '-';
+	if(plus)
+		return '+';
+	if(space)
+		return ' ';
+	return 0;
+}
+
+#define PRINT_DEC_BUFSZ 32 /* 20 is enough for 64 bit decimals */
+/** print decimal into buffer, returns length */
+static int
+print_dec(char* buf, int max, unsigned int value)
+{
+	int i = 0;
+	if(value == 0) {
+		if(max > 0) {
+			buf[0] = '0';
+			i = 1;
+		}
+	} else while(value && i < max) {
+		buf[i++] = '0' + value % 10;
+		value /= 10;
+	}
+	return i;
+}
+
+/** print long decimal into buffer, returns length */
+static int
+print_dec_l(char* buf, int max, unsigned long value)
+{
+	int i = 0;
+	if(value == 0) {
+		if(max > 0) {
+			buf[0] = '0';
+			i = 1;
+		}
+	} else while(value && i < max) {
+		buf[i++] = '0' + value % 10;
+		value /= 10;
+	}
+	return i;
+}
+
+/** print long decimal into buffer, returns length */
+static int
+print_dec_ll(char* buf, int max, unsigned long long value)
+{
+	int i = 0;
+	if(value == 0) {
+		if(max > 0) {
+			buf[0] = '0';
+			i = 1;
+		}
+	} else while(value && i < max) {
+		buf[i++] = '0' + value % 10;
+		value /= 10;
+	}
+	return i;
+}
+
+/** print hex into buffer, returns length */
+static int
+print_hex(char* buf, int max, unsigned int value)
+{
+	const char* h = "0123456789abcdef";
+	int i = 0;
+	if(value == 0) {
+		if(max > 0) {
+			buf[0] = '0';
+			i = 1;
+		}
+	} else while(value && i < max) {
+		buf[i++] = h[value & 0x0f];
+		value >>= 4;
+	}
+	return i;
+}
+
+/** print long hex into buffer, returns length */
+static int
+print_hex_l(char* buf, int max, unsigned long value)
+{
+	const char* h = "0123456789abcdef";
+	int i = 0;
+	if(value == 0) {
+		if(max > 0) {
+			buf[0] = '0';
+			i = 1;
+		}
+	} else while(value && i < max) {
+		buf[i++] = h[value & 0x0f];
+		value >>= 4;
+	}
+	return i;
+}
+
+/** print long long hex into buffer, returns length */
+static int
+print_hex_ll(char* buf, int max, unsigned long long value)
+{
+	const char* h = "0123456789abcdef";
+	int i = 0;
+	if(value == 0) {
+		if(max > 0) {
+			buf[0] = '0';
+			i = 1;
+		}
+	} else while(value && i < max) {
+		buf[i++] = h[value & 0x0f];
+		value >>= 4;
+	}
+	return i;
+}
+
+/** copy string into result, reversed */
+static void
+spool_str_rev(char** at, size_t* left, int* ret, const char* buf, int len)
+{
+	int i = len;
+	while(i) {
+		if(*left > 1) {
+			*(*at)++ = buf[--i];
+			(*left)--;
+		} else --i;
+		(*ret)++;
+	}
+}
+
+/** copy string into result */
+static void
+spool_str(char** at, size_t* left, int* ret, const char* buf, int len)
+{
+	int i;
+	for(i=0; i 1) {
+			*(*at)++ = buf[i];
+			(*left)--;
+		}
+		(*ret)++;
+	}
+}
+
+/** print number formatted */
+static void
+print_num(char** at, size_t* left, int* ret, int minw, int precision,
+	int prgiven, int zeropad, int minus, int plus, int space,
+	int zero, int negative, char* buf, int len)
+{
+	int w = len; /* excludes minus sign */
+	char s = get_negsign(negative, plus, space);
+	if(minus) {
+		/* left adjust the number into the field, space padding */
+		/* calc numw = [sign][zeroes][number] */
+		int numw = w;
+		if(precision == 0 && zero) numw = 0;
+		if(numw < precision) numw = precision;
+		if(s) numw++;
+
+		/* sign */
+		if(s) print_pad(at, left, ret, s, 1);
+
+		/* number */
+		if(precision == 0 && zero) {
+			/* "" for the number */
+		} else {
+			if(w < precision)
+				print_pad(at, left, ret, '0', precision - w);
+			spool_str_rev(at, left, ret, buf, len);
+		}
+		/* spaces */
+		if(numw < minw)
+			print_pad(at, left, ret, ' ', minw - numw);
+	} else {
+		/* pad on the left of the number */
+		/* calculate numw has width of [sign][zeroes][number] */
+		int numw = w;
+		if(precision == 0 && zero) numw = 0;
+		if(numw < precision) numw = precision;
+		if(!prgiven && zeropad && numw < minw) numw = minw;
+		else if(s) numw++;
+
+		/* pad with spaces */
+		if(numw < minw)
+			print_pad(at, left, ret, ' ', minw - numw);
+		/* print sign (and one less zeropad if so) */
+		if(s) {
+			print_pad(at, left, ret, s, 1);
+			numw--;
+		}
+		/* pad with zeroes */
+		if(w < numw)
+			print_pad(at, left, ret, '0', numw - w);
+		if(precision == 0 && zero)
+			return;
+		/* print the characters for the value */
+		spool_str_rev(at, left, ret, buf, len);
+	}
+}
+
+/** print %d and %i */
+static void
+print_num_d(char** at, size_t* left, int* ret, int value,
+	int minw, int precision, int prgiven, int zeropad, int minus,
+	int plus, int space)
+{
+	char buf[PRINT_DEC_BUFSZ];
+	int negative = (value < 0);
+	int zero = (value == 0);
+	int len = print_dec(buf, (int)sizeof(buf),
+		(unsigned int)(negative?-value:value));
+	print_num(at, left, ret, minw, precision, prgiven, zeropad, minus,
+		plus, space, zero, negative, buf, len);
+}
+
+/** print %ld and %li */
+static void
+print_num_ld(char** at, size_t* left, int* ret, long value,
+	int minw, int precision, int prgiven, int zeropad, int minus,
+	int plus, int space)
+{
+	char buf[PRINT_DEC_BUFSZ];
+	int negative = (value < 0);
+	int zero = (value == 0);
+	int len = print_dec_l(buf, (int)sizeof(buf),
+		(unsigned long)(negative?-value:value));
+	print_num(at, left, ret, minw, precision, prgiven, zeropad, minus,
+		plus, space, zero, negative, buf, len);
+}
+
+/** print %lld and %lli */
+static void
+print_num_lld(char** at, size_t* left, int* ret, long long value,
+	int minw, int precision, int prgiven, int zeropad, int minus,
+	int plus, int space)
+{
+	char buf[PRINT_DEC_BUFSZ];
+	int negative = (value < 0);
+	int zero = (value == 0);
+	int len = print_dec_ll(buf, (int)sizeof(buf),
+		(unsigned long long)(negative?-value:value));
+	print_num(at, left, ret, minw, precision, prgiven, zeropad, minus,
+		plus, space, zero, negative, buf, len);
+}
+
+/** print %u */
+static void
+print_num_u(char** at, size_t* left, int* ret, unsigned int value,
+	int minw, int precision, int prgiven, int zeropad, int minus,
+	int plus, int space)
+{
+	char buf[PRINT_DEC_BUFSZ];
+	int negative = 0;
+	int zero = (value == 0);
+	int len = print_dec(buf, (int)sizeof(buf), value);
+	print_num(at, left, ret, minw, precision, prgiven, zeropad, minus,
+		plus, space, zero, negative, buf, len);
+}
+
+/** print %lu */
+static void
+print_num_lu(char** at, size_t* left, int* ret, unsigned long value,
+	int minw, int precision, int prgiven, int zeropad, int minus,
+	int plus, int space)
+{
+	char buf[PRINT_DEC_BUFSZ];
+	int negative = 0;
+	int zero = (value == 0);
+	int len = print_dec_l(buf, (int)sizeof(buf), value);
+	print_num(at, left, ret, minw, precision, prgiven, zeropad, minus,
+		plus, space, zero, negative, buf, len);
+}
+
+/** print %llu */
+static void
+print_num_llu(char** at, size_t* left, int* ret, unsigned long long value,
+	int minw, int precision, int prgiven, int zeropad, int minus,
+	int plus, int space)
+{
+	char buf[PRINT_DEC_BUFSZ];
+	int negative = 0;
+	int zero = (value == 0);
+	int len = print_dec_ll(buf, (int)sizeof(buf), value);
+	print_num(at, left, ret, minw, precision, prgiven, zeropad, minus,
+		plus, space, zero, negative, buf, len);
+}
+
+/** print %x */
+static void
+print_num_x(char** at, size_t* left, int* ret, unsigned int value,
+	int minw, int precision, int prgiven, int zeropad, int minus,
+	int plus, int space)
+{
+	char buf[PRINT_DEC_BUFSZ];
+	int negative = 0;
+	int zero = (value == 0);
+	int len = print_hex(buf, (int)sizeof(buf), value);
+	print_num(at, left, ret, minw, precision, prgiven, zeropad, minus,
+		plus, space, zero, negative, buf, len);
+}
+
+/** print %lx */
+static void
+print_num_lx(char** at, size_t* left, int* ret, unsigned long value,
+	int minw, int precision, int prgiven, int zeropad, int minus,
+	int plus, int space)
+{
+	char buf[PRINT_DEC_BUFSZ];
+	int negative = 0;
+	int zero = (value == 0);
+	int len = print_hex_l(buf, (int)sizeof(buf), value);
+	print_num(at, left, ret, minw, precision, prgiven, zeropad, minus,
+		plus, space, zero, negative, buf, len);
+}
+
+/** print %llx */
+static void
+print_num_llx(char** at, size_t* left, int* ret, unsigned long long value,
+	int minw, int precision, int prgiven, int zeropad, int minus,
+	int plus, int space)
+{
+	char buf[PRINT_DEC_BUFSZ];
+	int negative = 0;
+	int zero = (value == 0);
+	int len = print_hex_ll(buf, (int)sizeof(buf), value);
+	print_num(at, left, ret, minw, precision, prgiven, zeropad, minus,
+		plus, space, zero, negative, buf, len);
+}
+
+/** print %llp */
+static void
+print_num_llp(char** at, size_t* left, int* ret, void* value,
+	int minw, int precision, int prgiven, int zeropad, int minus,
+	int plus, int space)
+{
+	char buf[PRINT_DEC_BUFSZ];
+	int negative = 0;
+	int zero = (value == 0);
+#if defined(UINTPTR_MAX) && defined(UINT32_MAX) && (UINTPTR_MAX == UINT32_MAX)
+	/* avoid warning about upcast on 32bit systems */
+	unsigned long long llvalue = (unsigned long)value;
+#else
+	unsigned long long llvalue = (unsigned long long)value;
+#endif
+	int len = print_hex_ll(buf, (int)sizeof(buf), llvalue);
+	if(zero) {
+		buf[0]=')';
+		buf[1]='l';
+		buf[2]='i';
+		buf[3]='n';
+		buf[4]='(';
+		len = 5;
+	} else {
+		/* put '0x' in front of the (reversed) buffer result */
+		if(len < PRINT_DEC_BUFSZ)
+			buf[len++] = 'x';
+		if(len < PRINT_DEC_BUFSZ)
+			buf[len++] = '0';
+	}
+	print_num(at, left, ret, minw, precision, prgiven, zeropad, minus,
+		plus, space, zero, negative, buf, len);
+}
+
+#define PRINT_FLOAT_BUFSZ 64 /* xx.yy with 20.20 about the max */
+/** spool remainder after the decimal point to buffer, in reverse */
+static int
+print_remainder(char* buf, int max, double r, int prec)
+{
+	unsigned long long cap = 1;
+	unsigned long long value;
+	int len, i;
+	if(prec > 19) prec = 19; /* max we can do */
+	if(max < prec) return 0;
+	for(i=0; i= 5) {
+		value++;
+		/* that might carry to numbers before the comma, if so,
+		 * just ignore that rounding. failure because 64bitprintout */
+		if(value >= cap)
+			value = cap-1;
+	}
+	len = print_dec_ll(buf, max, value);
+	while(len < prec) { /* pad with zeroes, e.g. if 0.0012 */
+		buf[len++] = '0';
+	}
+	if(len < max)
+		buf[len++] = '.';
+	return len;
+}
+
+/** spool floating point to buffer */
+static int
+print_float(char* buf, int max, double value, int prec)
+{
+	/* as xxx.xxx  if prec==0, no '.', with prec decimals after . */
+	/* no conversion for NAN and INF, because we do not want to require
+	   linking with -lm. */
+	/* Thus, the conversions use 64bit integers to convert the numbers,
+	 * which makes 19 digits before and after the decimal point the max */
+	unsigned long long whole = (unsigned long long)value;
+	double remain = value - (double)whole;
+	int len = 0;
+	if(prec != 0)
+		len = print_remainder(buf, max, remain, prec);
+	len += print_dec_ll(buf+len, max-len, whole);
+	return len;
+}
+
+/** print %f */
+static void
+print_num_f(char** at, size_t* left, int* ret, double value,
+	int minw, int precision, int prgiven, int zeropad, int minus,
+	int plus, int space)
+{
+	char buf[PRINT_FLOAT_BUFSZ];
+	int negative = (value < 0);
+	int zero = 0;
+	int len;
+	if(!prgiven) precision = 6;
+	len = print_float(buf, (int)sizeof(buf), negative?-value:value,
+		precision);
+	print_num(at, left, ret, minw, 1, 0, zeropad, minus,
+		plus, space, zero, negative, buf, len);
+}
+
+/* rudimentary %g support */
+static int
+print_float_g(char* buf, int max, double value, int prec)
+{
+	unsigned long long whole = (unsigned long long)value;
+	double remain = value - (double)whole;
+	int before = 0;
+	int len = 0;
+
+	/* number of digits before the decimal point */
+	while(whole > 0) {
+		before++;
+		whole /= 10;
+	}
+	whole = (unsigned long long)value;
+
+	if(prec > before && remain != 0.0) {
+		/* see if the last decimals are zero, if so, skip them */
+		len = print_remainder(buf, max, remain, prec-before);
+		while(len > 0 && buf[0]=='0') {
+			memmove(buf, buf+1, --len);
+		}
+	}
+	len += print_dec_ll(buf+len, max-len, whole);
+	return len;
+}
+
+
+/** print %g */
+static void
+print_num_g(char** at, size_t* left, int* ret, double value,
+	int minw, int precision, int prgiven, int zeropad, int minus,
+	int plus, int space)
+{
+	char buf[PRINT_FLOAT_BUFSZ];
+	int negative = (value < 0);
+	int zero = 0;
+	int len;
+	if(!prgiven) precision = 6;
+	if(precision == 0) precision = 1;
+	len = print_float_g(buf, (int)sizeof(buf), negative?-value:value,
+		precision);
+	print_num(at, left, ret, minw, 1, 0, zeropad, minus,
+		plus, space, zero, negative, buf, len);
+}
+
+
+/** strnlen (compat implementation) */
+static int
+my_strnlen(const char* s, int max)
+{
+	int i;
+	for(i=0; i 1) {
+				*at++ = *fmt++;
+				left--;
+			} else fmt++;
+			ret++;
+		}
+		
+		/* see if we are at end */
+		if(!*fmt) break;
+
+		/* fetch next argument % designation from format string */
+		fmt++; /* skip the '%' */
+
+		/********************************/
+		/* get the argument designation */
+		/********************************/
+		/* we must do this vararg stuff inside this function for
+		 * portability.  Hence, get_designation, and print_designation
+		 * are not their own functions. */
+
+		/* printout designation:
+		 * conversion specifier: x, d, u, s, c, n, m, p
+		 * flags: # not supported
+		 *        0 zeropad (on the left)
+		 *	  - left adjust (right by default)
+		 *	  ' ' printspace for positive number (in - position).
+		 *	  + alwayssign
+		 * fieldwidth: [1-9][0-9]* minimum field width.
+		 * 	if this is * then type int next argument specifies the minwidth.
+		 * 	if this is negative, the - flag is set (with positive width).
+		 * precision: period[digits]*, %.2x.
+		 * 	if this is * then type int next argument specifies the precision.
+		 *	just '.' or negative value means precision=0.
+		 *		this is mindigits to print for d, i, u, x
+		 *		this is aftercomma digits for f
+		 *		this is max number significant digits for g
+		 *		maxnumber characters to be printed for s
+		 * length: 0-none (int), 1-l (long), 2-ll (long long)
+		 * 	notsupported: hh (char), h (short), L (long double), q, j, z, t
+		 * Does not support %m$ and *m$ argument designation as array indices.
+		 * Does not support %#x
+		 *
+		 */
+		minw = 0;
+		precision = 1;
+		prgiven = 0;
+		zeropad = 0;
+		minus = 0;
+		plus = 0;
+		space = 0;
+		length = 0;
+
+		/* get flags in any order */
+		for(;;) {
+			if(*fmt == '0')
+				zeropad = 1;
+			else if(*fmt == '-')
+				minus = 1;
+			else if(*fmt == '+')
+				plus = 1;
+			else if(*fmt == ' ')
+				space = 1;
+			else break;
+			fmt++;
+		}
+
+		/* field width */
+		if(*fmt == '*') {
+			fmt++; /* skip char */
+			minw = va_arg(arg, int);
+			if(minw < 0) {
+				minus = 1;
+				minw = -minw;
+			}
+		} else while(*fmt >= '0' && *fmt <= '9') {
+			minw = minw*10 + (*fmt++)-'0';
+		}
+
+		/* precision */
+		if(*fmt == '.') {
+			fmt++; /* skip period */
+			prgiven = 1;
+			precision = 0;
+			if(*fmt == '*') {
+				fmt++; /* skip char */
+				precision = va_arg(arg, int);
+				if(precision < 0)
+					precision = 0;
+			} else while(*fmt >= '0' && *fmt <= '9') {
+				precision = precision*10 + (*fmt++)-'0';
+			}
+		}
+
+		/* length */
+		if(*fmt == 'l') {
+			fmt++; /* skip char */
+			length = 1;
+			if(*fmt == 'l') {
+				fmt++; /* skip char */
+				length = 2;
+			}
+		}
+
+		/* get the conversion */
+		if(!*fmt) conv = 0;
+		else	conv = *fmt++;
+
+		/***********************************/
+		/* print that argument designation */
+		/***********************************/
+		switch(conv) {
+		case 'i':
+		case 'd':
+			if(length == 0)
+			    print_num_d(&at, &left, &ret, va_arg(arg, int),
+				minw, precision, prgiven, zeropad, minus, plus, space);
+			else if(length == 1)
+			    print_num_ld(&at, &left, &ret, va_arg(arg, long),
+				minw, precision, prgiven, zeropad, minus, plus, space);
+			else if(length == 2)
+			    print_num_lld(&at, &left, &ret,
+				va_arg(arg, long long),
+				minw, precision, prgiven, zeropad, minus, plus, space);
+			break;
+		case 'u':
+			if(length == 0)
+			    print_num_u(&at, &left, &ret,
+				va_arg(arg, unsigned int),
+				minw, precision, prgiven, zeropad, minus, plus, space);
+			else if(length == 1)
+			    print_num_lu(&at, &left, &ret,
+				va_arg(arg, unsigned long),
+				minw, precision, prgiven, zeropad, minus, plus, space);
+			else if(length == 2)
+			    print_num_llu(&at, &left, &ret,
+				va_arg(arg, unsigned long long),
+				minw, precision, prgiven, zeropad, minus, plus, space);
+			break;
+		case 'x':
+			if(length == 0)
+			    print_num_x(&at, &left, &ret,
+				va_arg(arg, unsigned int),
+				minw, precision, prgiven, zeropad, minus, plus, space);
+			else if(length == 1)
+			    print_num_lx(&at, &left, &ret,
+				va_arg(arg, unsigned long),
+				minw, precision, prgiven, zeropad, minus, plus, space);
+			else if(length == 2)
+			    print_num_llx(&at, &left, &ret,
+				va_arg(arg, unsigned long long),
+				minw, precision, prgiven, zeropad, minus, plus, space);
+			break;
+		case 's':
+			print_str(&at, &left, &ret, va_arg(arg, char*),
+				minw, precision, prgiven, minus);
+			break;
+		case 'c':
+			print_char(&at, &left, &ret, va_arg(arg, int),
+				minw, minus);
+			break;
+		case 'n':
+			*va_arg(arg, int*) = ret;
+			break;
+		case 'm':
+			print_str(&at, &left, &ret, strerror(errno),
+				minw, precision, prgiven, minus);
+			break;
+		case 'p':
+			print_num_llp(&at, &left, &ret, va_arg(arg, void*),
+				minw, precision, prgiven, zeropad, minus, plus, space);
+			break;
+		case '%':
+			print_pad(&at, &left, &ret, '%', 1);
+			break;
+		case 'f':
+			print_num_f(&at, &left, &ret, va_arg(arg, double),
+				minw, precision, prgiven, zeropad, minus, plus, space);
+			break;
+		case 'g':
+			print_num_g(&at, &left, &ret, va_arg(arg, double),
+				minw, precision, prgiven, zeropad, minus, plus, space);
+			break;
+		/* unknown */
+		default:
+		case 0: break;
+		}
+	}
+
+	/* zero terminate */
+	if(left > 0)
+		*at = 0;
+	return ret;
+}
+
+#ifdef SNPRINTF_TEST
+
+/** do tests */
+#undef snprintf
+#define DOTEST(bufsz, result, retval, ...) do { \
+	char buf[bufsz]; \
+	printf("now test %s\n", #__VA_ARGS__); \
+	int r=my_snprintf(buf, sizeof(buf), __VA_ARGS__); \
+	if(r != retval || strcmp(buf, result) != 0) { \
+		printf("error test(%s) was \"%s\":%d\n", \
+			""#bufsz", "#result", "#retval", "#__VA_ARGS__, \
+			buf, r); \
+		exit(1); \
+		} \
+	r=snprintf(buf, sizeof(buf), __VA_ARGS__); \
+	if(r != retval || strcmp(buf, result) != 0) { \
+		printf("error test(%s) differs with system, \"%s\":%d\n", \
+			""#bufsz", "#result", "#retval", "#__VA_ARGS__, \
+			buf, r); \
+		exit(1); \
+		} \
+	printf("test(\"%s\":%d) passed\n", buf, r); \
+	} while(0);
+
+/** test program */
+int main(void)
+{
+	int x = 0;
+
+	/* bufsize, expectedstring, expectedretval, snprintf arguments */
+	DOTEST(1024, "hello", 5, "hello");
+	DOTEST(1024, "h", 1, "h");
+	/* warning from gcc for format string, but it does work
+	 * DOTEST(1024, "", 0, ""); */
+
+	DOTEST(3, "he", 5, "hello");
+	DOTEST(1, "", 7, "%d", 7823089);
+
+	/* test positive numbers */
+	DOTEST(1024, "0", 1, "%d", 0);
+	DOTEST(1024, "1", 1, "%d", 1);
+	DOTEST(1024, "9", 1, "%d", 9);
+	DOTEST(1024, "15", 2, "%d", 15);
+	DOTEST(1024, "ab15cd", 6, "ab%dcd", 15);
+	DOTEST(1024, "167", 3, "%d", 167);
+	DOTEST(1024, "7823089", 7, "%d", 7823089);
+	DOTEST(1024, " 12", 3, "%3d", 12);
+	DOTEST(1024, "012", 3, "%.3d", 12);
+	DOTEST(1024, "012", 3, "%3.3d", 12);
+	DOTEST(1024, "012", 3, "%03d", 12);
+	DOTEST(1024, " 012", 4, "%4.3d", 12);
+	DOTEST(1024, "", 0, "%.0d", 0);
+
+	/* test negative numbers */
+	DOTEST(1024, "-1", 2, "%d", -1);
+	DOTEST(1024, "-12", 3, "%3d", -12);
+	DOTEST(1024, " -2", 3, "%3d", -2);
+	DOTEST(1024, "-012", 4, "%.3d", -12);
+	DOTEST(1024, "-012", 4, "%3.3d", -12);
+	DOTEST(1024, "-012", 4, "%4.3d", -12);
+	DOTEST(1024, " -012", 5, "%5.3d", -12);
+	DOTEST(1024, "-12", 3, "%03d", -12);
+	DOTEST(1024, "-02", 3, "%03d", -2);
+	DOTEST(1024, "-15", 3, "%d", -15);
+	DOTEST(1024, "-7307", 5, "%d", -7307);
+	DOTEST(1024, "-12  ", 5, "%-5d", -12);
+	DOTEST(1024, "-00012", 6, "%-.5d", -12);
+
+	/* test + and space flags */
+	DOTEST(1024, "+12", 3, "%+d", 12);
+	DOTEST(1024, " 12", 3, "% d", 12);
+
+	/* test %u */
+	DOTEST(1024, "12", 2, "%u", 12);
+	DOTEST(1024, "0", 1, "%u", 0);
+	DOTEST(1024, "4294967295", 10, "%u", 0xffffffff);
+
+	/* test %x */
+	DOTEST(1024, "0", 1, "%x", 0);
+	DOTEST(1024, "c", 1, "%x", 12);
+	DOTEST(1024, "12ab34cd", 8, "%x", 0x12ab34cd);
+
+	/* test %llu, %lld */
+	DOTEST(1024, "18446744073709551615", 20, "%llu",
+		(long long)0xffffffffffffffff);
+	DOTEST(1024, "-9223372036854775808", 20, "%lld",
+		(long long)0x8000000000000000);
+	DOTEST(1024, "9223372036854775808", 19, "%llu",
+		(long long)0x8000000000000000);
+
+	/* test %s */
+	DOTEST(1024, "hello", 5, "%s", "hello");
+	DOTEST(1024, "     hello", 10, "%10s", "hello");
+	DOTEST(1024, "hello     ", 10, "%-10s", "hello");
+	DOTEST(1024, "he", 2, "%.2s", "hello");
+	DOTEST(1024, "  he", 4, "%4.2s", "hello");
+	DOTEST(1024, "   h", 4, "%4.2s", "h");
+
+	/* test %c */
+	DOTEST(1024, "a", 1, "%c", 'a');
+	/* warning from gcc for format string, but it does work
+	   DOTEST(1024, "    a", 5, "%5c", 'a');
+	   DOTEST(1024, "a", 1, "%.0c", 'a'); */
+
+	/* test %n */
+	DOTEST(1024, "hello", 5, "hello%n", &x);
+	if(x != 5) { printf("the %%n failed\n"); exit(1); }
+
+	/* test %m */
+	errno = 0;
+	DOTEST(1024, "Success", 7, "%m");
+
+	/* test %p */
+	DOTEST(1024, "0x10", 4, "%p", (void*)0x10);
+	DOTEST(1024, "(nil)", 5, "%p", (void*)0x0);
+
+	/* test %% */
+	DOTEST(1024, "%", 1, "%%");
+
+	/* test %f */
+	DOTEST(1024, "0.000000", 8, "%f", 0.0);
+	DOTEST(1024, "0.00", 4, "%.2f", 0.0);
+	/* differs, "-0.00" DOTEST(1024, "0.00", 4, "%.2f", -0.0); */
+	DOTEST(1024, "234.00", 6, "%.2f", 234.005);
+	DOTEST(1024, "8973497.1246", 12, "%.4f", 8973497.12456);
+	DOTEST(1024, "-12.000000", 10, "%f", -12.0);
+	DOTEST(1024, "6", 1, "%.0f", 6.0);
+
+	DOTEST(1024, "6", 1, "%g", 6.0);
+	DOTEST(1024, "6.1", 3, "%g", 6.1);
+	DOTEST(1024, "6.15", 4, "%g", 6.15);
+
+	/* These format strings are from the code of NSD, Unbound, ldns */
+
+	DOTEST(1024, "abcdef", 6, "%s", "abcdef");
+	DOTEST(1024, "005", 3, "%03u", 5);
+	DOTEST(1024, "12345", 5, "%03u", 12345);
+	DOTEST(1024, "5", 1, "%d", 5);
+	DOTEST(1024, "(nil)", 5, "%p", NULL);
+	DOTEST(1024, "12345", 5, "%ld", (long)12345);
+	DOTEST(1024, "12345", 5, "%lu", (long)12345);
+	DOTEST(1024, "       12345", 12, "%12u", (unsigned)12345);
+	DOTEST(1024, "12345", 5, "%u", (unsigned)12345);
+	DOTEST(1024, "12345", 5, "%llu", (unsigned long long)12345);
+	DOTEST(1024, "12345", 5, "%x", 0x12345);
+	DOTEST(1024, "12345", 5, "%llx", (long long)0x12345);
+	DOTEST(1024, "012345", 6, "%6.6d", 12345);
+	DOTEST(1024, "012345", 6, "%6.6u", 12345);
+	DOTEST(1024, "1234.54", 7, "%g", 1234.54);
+	DOTEST(1024, "123456789.54", 12, "%.12g", 123456789.54);
+	DOTEST(1024, "3456789123456.54", 16, "%.16g", 3456789123456.54);
+	/* %24g does not work with 24 digits, not enough accuracy,
+	 * the first 16 digits are correct */
+	DOTEST(1024, "12345", 5, "%3.3d", 12345);
+	DOTEST(1024, "000", 3, "%3.3d", 0);
+	DOTEST(1024, "001", 3, "%3.3d", 1);
+	DOTEST(1024, "012", 3, "%3.3d", 12);
+	DOTEST(1024, "-012", 4, "%3.3d", -12);
+	DOTEST(1024, "he", 2, "%.2s", "hello");
+	DOTEST(1024, "helloworld", 10, "%s%s", "hello", "world");
+	DOTEST(1024, "he", 2, "%.*s", 2, "hello");
+	DOTEST(1024, "  hello", 7, "%*s", 7, "hello");
+	DOTEST(1024, "hello  ", 7, "%*s", -7, "hello");
+	DOTEST(1024, "0", 1, "%c", '0'); 
+	DOTEST(1024, "A", 1, "%c", 'A'); 
+	DOTEST(1024, "", 1, "%c", 0); 
+	DOTEST(1024, "\010", 1, "%c", 8); 
+	DOTEST(1024, "%", 1, "%%"); 
+	DOTEST(1024, "0a", 2, "%02x", 0x0a); 
+	DOTEST(1024, "bd", 2, "%02x", 0xbd); 
+	DOTEST(1024, "12", 2, "%02ld", (long)12); 
+	DOTEST(1024, "02", 2, "%02ld", (long)2); 
+	DOTEST(1024, "02", 2, "%02u", (unsigned)2); 
+	DOTEST(1024, "765432", 6, "%05u", (unsigned)765432); 
+	DOTEST(1024, "10.234", 6, "%0.3f", 10.23421); 
+	DOTEST(1024, "123456.234", 10, "%0.3f", 123456.23421); 
+	DOTEST(1024, "123456789.234", 13, "%0.3f", 123456789.23421); 
+	DOTEST(1024, "123456.23", 9, "%.2f", 123456.23421); 
+	DOTEST(1024, "123456", 6, "%.0f", 123456.23421); 
+	DOTEST(1024, "0123", 4, "%.4x", 0x0123); 
+	DOTEST(1024, "00000123", 8, "%.8x", 0x0123); 
+	DOTEST(1024, "ffeb0cde", 8, "%.8x", 0xffeb0cde); 
+	DOTEST(1024, " 987654321", 10, "%10lu", (unsigned long)987654321); 
+	DOTEST(1024, "   987654321", 12, "%12lu", (unsigned long)987654321); 
+	DOTEST(1024, "987654321", 9, "%i", 987654321); 
+	DOTEST(1024, "-87654321", 9, "%i", -87654321); 
+	DOTEST(1024, "hello           ", 16, "%-16s", "hello"); 
+	DOTEST(1024, "                ", 16, "%-16s", ""); 
+	DOTEST(1024, "a               ", 16, "%-16s", "a"); 
+	DOTEST(1024, "foobarfoobar    ", 16, "%-16s", "foobarfoobar"); 
+	DOTEST(1024, "foobarfoobarfoobar", 18, "%-16s", "foobarfoobarfoobar"); 
+
+	/* combined expressions */
+	DOTEST(1024, "foo 1.0 size 512 edns", 21,
+		"foo %s size %d %s%s", "1.0", 512, "", "edns");
+	DOTEST(15, "foo 1.0 size 5", 21,
+		"foo %s size %d %s%s", "1.0", 512, "", "edns");
+	DOTEST(1024, "packet 1203ceff id", 18,
+		"packet %2.2x%2.2x%2.2x%2.2x id", 0x12, 0x03, 0xce, 0xff);
+	DOTEST(1024, "/tmp/testbound_123abcd.tmp", 26, "/tmp/testbound_%u%s%s.tmp", 123, "ab", "cd");
+ 
+	return 0;
+}
+#endif /* SNPRINTF_TEST */
diff --git a/contrib/ldns/configure b/contrib/ldns/configure
index be312d1e3f1..8bc7462cf02 100755
--- a/contrib/ldns/configure
+++ b/contrib/ldns/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for ldns 1.6.16.
+# Generated by GNU Autoconf 2.68 for ldns 1.6.17.
 #
 # Report bugs to .
 #
@@ -570,8 +570,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='ldns'
 PACKAGE_TARNAME='libdns'
-PACKAGE_VERSION='1.6.16'
-PACKAGE_STRING='ldns 1.6.16'
+PACKAGE_VERSION='1.6.17'
+PACKAGE_STRING='ldns 1.6.17'
 PACKAGE_BUGREPORT='libdns@nlnetlabs.nl'
 PACKAGE_URL=''
 
@@ -621,6 +621,8 @@ DEFAULT_CAPATH
 DEFAULT_CAFILE
 LDNS_TRUST_ANCHOR_FILE
 WINDRES
+ldns_build_config_have_b32_pton
+ldns_build_config_have_b32_ntop
 LIBOBJS
 ldns_build_config_have_socklen_t
 LIBPCAP_LIBS
@@ -633,30 +635,16 @@ LIBSSL_SSL_LIBS
 LIBSSL_LIBS
 LIBSSL_LDFLAGS
 LIBSSL_CPPFLAGS
+ldns_build_config_use_dane
 RUNTIME_PATH
 HAVE_SSL
-OTOOL64
-OTOOL
-LIPO
-NMEDIT
-DSYMUTIL
-MANIFEST_TOOL
-AWK
-RANLIB
-STRIP
-ac_ct_AR
-DLLTOOL
-OBJDUMP
-LN_S
-NM
-ac_ct_DUMPBIN
-DUMPBIN
-LD
-FGREP
-SED
-LIBTOOL
-AR
 libtool
+CLEAN_P5_DNS_LDNS
+UNINSTALL_P5_DNS_LDNS
+INSTALL_P5_DNS_LDNS
+TEST_P5_DNS_LDNS
+P5_DNS_LDNS
+PERL
 PYLDNSXUNINST
 PYLDNSXINST
 PYLDNSUNINST
@@ -691,6 +679,28 @@ INSTALL_DRILL
 DRILL
 doxygen
 LINTFLAGS
+SET_MAKE
+DEPFLAG
+OTOOL64
+OTOOL
+LIPO
+NMEDIT
+DSYMUTIL
+MANIFEST_TOOL
+AWK
+RANLIB
+STRIP
+ac_ct_AR
+AR
+DLLTOOL
+OBJDUMP
+LN_S
+NM
+ac_ct_DUMPBIN
+DUMPBIN
+LD
+FGREP
+SED
 host_os
 host_vendor
 host_cpu
@@ -699,8 +709,7 @@ build_os
 build_vendor
 build_cpu
 build
-SET_MAKE
-DEPFLAG
+LIBTOOL
 EGREP
 GREP
 CPP
@@ -711,10 +720,10 @@ CPPFLAGS
 LDFLAGS
 CFLAGS
 CC
+VERSION_INFO
 LDNS_VERSION_MICRO
 LDNS_VERSION_MINOR
 LDNS_VERSION_MAJOR
-LIBTOOL_VERSION_INFO
 target_alias
 host_alias
 build_alias
@@ -756,11 +765,6 @@ SHELL'
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
-with_drill
-with_examples
-enable_ldns_config
-with_pyldns
-with_pyldnsx
 enable_shared
 enable_static
 with_pic
@@ -768,10 +772,23 @@ enable_fast_install
 with_gnu_ld
 with_sysroot
 enable_libtool_lock
+with_drill
+with_examples
+enable_ldns_config
+enable_stderr_msgs
+with_pyldns
+with_pyldnsx
+with_p5_dns_ldns
 with_ssl
 enable_sha2
 enable_gost
 enable_ecdsa
+enable_dane
+enable_rrtype_ninfo
+enable_rrtype_rkey
+enable_rrtype_cds
+enable_rrtype_uri
+enable_rrtype_ta
 enable_rpath
 with_trust_anchor
 with_ca_file
@@ -1329,7 +1346,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures ldns 1.6.16 to adapt to many kinds of systems.
+\`configure' configures ldns 1.6.17 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1394,7 +1411,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of ldns 1.6.16:";;
+     short | recursive ) echo "Configuration of ldns 1.6.17:";;
    esac
   cat <<\_ACEOF
 
@@ -1402,31 +1419,40 @@ Optional Features:
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
- --disable-ldns-config	disable installation of ldns-config (default=enabled)
   --enable-shared[=PKGS]  build shared libraries [default=yes]
   --enable-static[=PKGS]  build static libraries [default=yes]
   --enable-fast-install[=PKGS]
                           optimize for fast installation [default=yes]
   --disable-libtool-lock  avoid locking (might break parallel builds)
+  --disable-ldns-config   disable installation of ldns-config
+                          (default=enabled)
+  --enable-stderr-msgs    Enable printing to stderr (default=disabled)
   --disable-sha2          Disable SHA256 and SHA512 RRSIG support
   --disable-gost          Disable GOST support
   --disable-ecdsa         Disable ECDSA support
+  --disable-dane          Disable DANE support
+  --enable-rrtype-ninfo   Enable draft RR type ninfo.
+  --enable-rrtype-rkey    Enable draft RR type rkey.
+  --enable-rrtype-cds     Enable draft RR type cds.
+  --enable-rrtype-uri     Enable draft RR type uri.
+  --enable-rrtype-ta      Enable draft RR type ta.
   --disable-rpath         disable hardcoded rpath (default=enabled)
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-pic[=PKGS]       try to use only PIC/non-PIC objects [default=use
+                          both]
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-sysroot=DIR Search for dependent libraries within DIR
+                        (or the compiler's sysroot if not specified).
   --with-drill            Also build drill.
   --with-examples         Also build examples.
   --with-pyldns           generate python library, or --without-pyldns to
                           disable Python support.
   --without-pyldnsx       Do not install the ldnsx python module, or
                           --with-pyldnsx to install it.
-  --with-pic[=PKGS]       try to use only PIC/non-PIC objects [default=use
-                          both]
-  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
-  --with-sysroot=DIR Search for dependent libraries within DIR
-                        (or the compiler's sysroot if not specified).
+  --with-p5-dns-ldns      generate DNS::LDNS perl bindings
   --with-ssl=pathname     enable SSL (will check /usr/local/ssl /usr/lib/ssl
                           /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw
                           /usr)
@@ -1517,7 +1543,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-ldns configure 1.6.16
+ldns configure 1.6.17
 generated by GNU Autoconf 2.68
 
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -1770,60 +1796,6 @@ $as_echo "$ac_res" >&6; }
 
 } # ac_fn_c_check_header_compile
 
-# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
-# -------------------------------------------
-# Tests whether TYPE exists after having included INCLUDES, setting cache
-# variable VAR accordingly.
-ac_fn_c_check_type ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  eval "$3=no"
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-if (sizeof ($2))
-	 return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-if (sizeof (($2)))
-	    return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-else
-  eval "$3=yes"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_type
-
 # ac_fn_c_try_link LINENO
 # -----------------------
 # Try to link conftest.$ac_ext, and return whether this succeeded.
@@ -1937,6 +1909,60 @@ $as_echo "$ac_res" >&6; }
 
 } # ac_fn_c_check_func
 
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof ($2))
+	 return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+	    return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  eval "$3=yes"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_type
+
 # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
 # ---------------------------------------------
 # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
@@ -2221,7 +2247,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by ldns $as_me 1.6.16, which was
+It was created by ldns $as_me 1.6.17, which was
 generated by GNU Autoconf 2.68.  Invocation command line was
 
   $ $0 $@
@@ -2571,18 +2597,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 # needed to build correct soname
-LIBTOOL_VERSION_INFO=1:6:16
-
 LDNS_VERSION_MAJOR=1
 
 LDNS_VERSION_MINOR=6
 
-LDNS_VERSION_MICRO=16
+LDNS_VERSION_MICRO=17
 
+VERSION_INFO=1:6:17
 
-OURCPPFLAGS=''
-CPPFLAGS=${CPPFLAGS:-${OURCPPFLAGS}}
-CFLAGS="$CFLAGS"
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -3834,598 +3856,6 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
 
 
 
-# Checks for programs.
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_CC="${ac_tool_prefix}gcc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_CC"; then
-  ac_ct_CC=$CC
-  # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_CC="gcc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_CC" = x; then
-    CC=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
-  fi
-else
-  CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
-          if test -n "$ac_tool_prefix"; then
-    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_CC="${ac_tool_prefix}cc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  fi
-fi
-if test -z "$CC"; then
-  # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-  ac_prog_rejected=no
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
-       ac_prog_rejected=yes
-       continue
-     fi
-    ac_cv_prog_CC="cc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-if test $ac_prog_rejected = yes; then
-  # We found a bogon in the path, so make sure we never use it.
-  set dummy $ac_cv_prog_CC
-  shift
-  if test $# != 0; then
-    # We chose a different compiler from the bogus one.
-    # However, it has the same basename, so the bogon will be chosen
-    # first if we set CC to just the basename; use the full file name.
-    shift
-    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
-  fi
-fi
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$CC"; then
-  if test -n "$ac_tool_prefix"; then
-  for ac_prog in cl.exe
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-    test -n "$CC" && break
-  done
-fi
-if test -z "$CC"; then
-  ac_ct_CC=$CC
-  for ac_prog in cl.exe
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_CC="$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$ac_ct_CC" && break
-done
-
-  if test "x$ac_ct_CC" = x; then
-    CC=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
-  fi
-fi
-
-fi
-
-
-test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5; }
-
-# Provide some information about the compiler.
-$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
-set X $ac_compile
-ac_compiler=$2
-for ac_option in --version -v -V -qversion; do
-  { { ac_try="$ac_compiler $ac_option >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    sed '10a\
-... rest of stderr output deleted ...
-         10q' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-  fi
-  rm -f conftest.er1 conftest.err
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }
-done
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
-$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if ${ac_cv_c_compiler_gnu+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-#ifndef __GNUC__
-       choke me
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_compiler_gnu=yes
-else
-  ac_compiler_gnu=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_c_compiler_gnu=$ac_compiler_gnu
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
-$as_echo "$ac_cv_c_compiler_gnu" >&6; }
-if test $ac_compiler_gnu = yes; then
-  GCC=yes
-else
-  GCC=
-fi
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
-$as_echo_n "checking whether $CC accepts -g... " >&6; }
-if ${ac_cv_prog_cc_g+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_save_c_werror_flag=$ac_c_werror_flag
-   ac_c_werror_flag=yes
-   ac_cv_prog_cc_g=no
-   CFLAGS="-g"
-   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_prog_cc_g=yes
-else
-  CFLAGS=""
-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-else
-  ac_c_werror_flag=$ac_save_c_werror_flag
-	 CFLAGS="-g"
-	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_prog_cc_g=yes
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-   ac_c_werror_flag=$ac_save_c_werror_flag
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
-$as_echo "$ac_cv_prog_cc_g" >&6; }
-if test "$ac_test_CFLAGS" = set; then
-  CFLAGS=$ac_save_CFLAGS
-elif test $ac_cv_prog_cc_g = yes; then
-  if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
-  else
-    CFLAGS="-g"
-  fi
-else
-  if test "$GCC" = yes; then
-    CFLAGS="-O2"
-  else
-    CFLAGS=
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
-$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if ${ac_cv_prog_cc_c89+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_prog_cc_c89=no
-ac_save_CC=$CC
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include 
-#include 
-#include 
-#include 
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
-     char **p;
-     int i;
-{
-  return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
-  char *s;
-  va_list v;
-  va_start (v,p);
-  s = g (p, va_arg (v,int));
-  va_end (v);
-  return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
-   function prototypes and stuff, but not '\xHH' hex character constants.
-   These don't provoke an error unfortunately, instead are silently treated
-   as 'x'.  The following induces an error, until -std is added to get
-   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
-   array size at least.  It's necessary to write '\x00'==0 to get something
-   that's true only with -std.  */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
-   inside strings and character constants.  */
-#define FOO(x) 'x'
-int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
-  ;
-  return 0;
-}
-_ACEOF
-for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
-  CC="$ac_save_CC $ac_arg"
-  if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_prog_cc_c89=$ac_arg
-fi
-rm -f core conftest.err conftest.$ac_objext
-  test "x$ac_cv_prog_cc_c89" != "xno" && break
-done
-rm -f conftest.$ac_ext
-CC=$ac_save_CC
-
-fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c89" in
-  x)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
-$as_echo "none needed" >&6; } ;;
-  xno)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;;
-  *)
-    CC="$CC $ac_cv_prog_cc_c89"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
-$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
-esac
-if test "x$ac_cv_prog_cc_c89" != xno; then :
-
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $CC dependency flag" >&5
-$as_echo_n "checking $CC dependency flag... " >&6; }
-echo 'void f(){}' >conftest.c
-if test "`$CC -MM conftest.c 2>&1`" = "conftest.o: conftest.c"; then
-	DEPFLAG="-MM"
-else
-  if test "`$CC -xM1 conftest.c 2>&1`" = "conftest.o: conftest.c"; then
-	DEPFLAG="-xM1"
-  else
-	DEPFLAG="-MM"  # dunno do something
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEPFLAG" >&5
-$as_echo "$DEPFLAG" >&6; }
-rm -f conftest.c
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
-$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
-set x ${MAKE-make}
-ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.make <<\_ACEOF
-SHELL = /bin/sh
-all:
-	@echo '@@@%%%=$(MAKE)=@@@%%%'
-_ACEOF
-# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
-case `${MAKE-make} -f conftest.make 2>/dev/null` in
-  *@@@%%%=?*=@@@%%%*)
-    eval ac_cv_prog_make_${ac_make}_set=yes;;
-  *)
-    eval ac_cv_prog_make_${ac_make}_set=no;;
-esac
-rm -f conftest.make
-fi
-if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-  SET_MAKE=
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-  SET_MAKE="MAKE=${MAKE-make}"
-fi
-
-
-# Extra (sp)lint flags for NetBSD
 ac_aux_dir=
 for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
   if test -f "$ac_dir/install-sh"; then
@@ -4455,6 +3885,31 @@ ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
 ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
 
 
+case `pwd` in
+  *\ * | *\	*)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
+esac
+
+
+
+macro_version='2.4.2'
+macro_revision='1.3337'
+
+
+
+
+
+
+
+
+
+
+
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
 # Make sure we can run config.sub.
 $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
   as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
@@ -4526,2630 +3981,6 @@ IFS=$ac_save_IFS
 case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 
 
-case "$host_os" in
-	netbsd*) LINTFLAGS="'-D__RENAME(x)=' -D_NETINET_IN_H_ $LINTFLAGS"
-		 ;;
-	*)       LINTFLAGS="$LINTFLAGS"
-		 ;;
-esac
-
-
-
-$as_echo "#define WINVER 0x0502" >>confdefs.h
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -std=c99" >&5
-$as_echo_n "checking whether $CC supports -std=c99... " >&6; }
-cache=`echo std=c99 | sed 'y%.=/+-%___p_%'`
-if eval \${cv_prog_cc_flag_$cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-echo 'void f(){}' >conftest.c
-if test -z "`$CC $CPPFLAGS $CFLAGS -std=c99 -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_$cache=yes"
-else
-eval "cv_prog_cc_flag_$cache=no"
-fi
-rm -f conftest conftest.o conftest.c
-
-fi
-
-if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-:
-C99FLAG="-std=c99"
-else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-:
-
-fi
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -xc99" >&5
-$as_echo_n "checking whether $CC supports -xc99... " >&6; }
-cache=`echo xc99 | sed 'y%.=/+-%___p_%'`
-if eval \${cv_prog_cc_flag_$cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-echo 'void f(){}' >conftest.c
-if test -z "`$CC $CPPFLAGS $CFLAGS -xc99 -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_$cache=yes"
-else
-eval "cv_prog_cc_flag_$cache=no"
-fi
-rm -f conftest conftest.o conftest.c
-
-fi
-
-if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-:
-C99FLAG="-xc99"
-else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-:
-
-fi
-
-
-# routine to copy files
-# argument 1 is a list of files (relative to the source dir)
-# argument 2 is a destination directory (relative to the current
-# working directory
-
-
-# copy all .h files in the dir at argument 1
-# (relative to source) to the dir at argument 2
-# (relative to current dir)
-
-
-# Checks for typedefs, structures, and compiler characteristics.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
-$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
-if ${ac_cv_c_const+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-/* FIXME: Include the comments suggested by Paul. */
-#ifndef __cplusplus
-  /* Ultrix mips cc rejects this.  */
-  typedef int charset[2];
-  const charset cs;
-  /* SunOS 4.1.1 cc rejects this.  */
-  char const *const *pcpcc;
-  char **ppc;
-  /* NEC SVR4.0.2 mips cc rejects this.  */
-  struct point {int x, y;};
-  static struct point const zero = {0,0};
-  /* AIX XL C 1.02.0.0 rejects this.
-     It does not let you subtract one const X* pointer from another in
-     an arm of an if-expression whose if-part is not a constant
-     expression */
-  const char *g = "string";
-  pcpcc = &g + (g ? g-g : 0);
-  /* HPUX 7.0 cc rejects these. */
-  ++pcpcc;
-  ppc = (char**) pcpcc;
-  pcpcc = (char const *const *) ppc;
-  { /* SCO 3.2v4 cc rejects this.  */
-    char *t;
-    char const *s = 0 ? (char *) 0 : (char const *) 0;
-
-    *t++ = 0;
-    if (s) return 0;
-  }
-  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
-    int x[] = {25, 17};
-    const int *foo = &x[0];
-    ++foo;
-  }
-  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
-    typedef const int *iptr;
-    iptr p = 0;
-    ++p;
-  }
-  { /* AIX XL C 1.02.0.0 rejects this saying
-       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
-    struct s { int j; const int *ap[3]; };
-    struct s *b; b->j = 5;
-  }
-  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
-    const int foo = 10;
-    if (!foo) return 0;
-  }
-  return !cs[0] && !zero.x;
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_c_const=yes
-else
-  ac_cv_c_const=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
-$as_echo "$ac_cv_c_const" >&6; }
-if test $ac_cv_c_const = no; then
-
-$as_echo "#define const /**/" >>confdefs.h
-
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-if test "x$CFLAGS" = "x" ; then
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -g" >&5
-$as_echo_n "checking whether $CC supports -g... " >&6; }
-cache=`echo g | sed 'y%.=/+-%___p_%'`
-if eval \${cv_prog_cc_flag_$cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-echo 'void f(){}' >conftest.c
-if test -z "`$CC $CPPFLAGS $CFLAGS -g -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_$cache=yes"
-else
-eval "cv_prog_cc_flag_$cache=no"
-fi
-rm -f conftest conftest.o conftest.c
-
-fi
-
-if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-:
-CFLAGS="-g"
-else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-:
-
-fi
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -O2" >&5
-$as_echo_n "checking whether $CC supports -O2... " >&6; }
-cache=`echo O2 | sed 'y%.=/+-%___p_%'`
-if eval \${cv_prog_cc_flag_$cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-echo 'void f(){}' >conftest.c
-if test -z "`$CC $CPPFLAGS $CFLAGS -O2 -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_$cache=yes"
-else
-eval "cv_prog_cc_flag_$cache=no"
-fi
-rm -f conftest conftest.o conftest.c
-
-fi
-
-if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-:
-CFLAGS="-O2 $CFLAGS"
-else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-:
-
-fi
-
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wall" >&5
-$as_echo_n "checking whether $CC supports -Wall... " >&6; }
-cache=`echo Wall | sed 'y%.=/+-%___p_%'`
-if eval \${cv_prog_cc_flag_$cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-echo 'void f(){}' >conftest.c
-if test -z "`$CC $CPPFLAGS $CFLAGS -Wall -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_$cache=yes"
-else
-eval "cv_prog_cc_flag_$cache=no"
-fi
-rm -f conftest conftest.o conftest.c
-
-fi
-
-if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-:
-CFLAGS="-Wall $CFLAGS"
-else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-:
-
-fi
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -W" >&5
-$as_echo_n "checking whether $CC supports -W... " >&6; }
-cache=`echo W | sed 'y%.=/+-%___p_%'`
-if eval \${cv_prog_cc_flag_$cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-echo 'void f(){}' >conftest.c
-if test -z "`$CC $CPPFLAGS $CFLAGS -W -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_$cache=yes"
-else
-eval "cv_prog_cc_flag_$cache=no"
-fi
-rm -f conftest conftest.o conftest.c
-
-fi
-
-if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-:
-CFLAGS="-W $CFLAGS"
-else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-:
-
-fi
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wwrite-strings" >&5
-$as_echo_n "checking whether $CC supports -Wwrite-strings... " >&6; }
-cache=`echo Wwrite-strings | sed 'y%.=/+-%___p_%'`
-if eval \${cv_prog_cc_flag_$cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-echo 'void f(){}' >conftest.c
-if test -z "`$CC $CPPFLAGS $CFLAGS -Wwrite-strings -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_$cache=yes"
-else
-eval "cv_prog_cc_flag_$cache=no"
-fi
-rm -f conftest conftest.o conftest.c
-
-fi
-
-if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-:
-CFLAGS="-Wwrite-strings $CFLAGS"
-else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-:
-
-fi
-
-
-
-for ac_header in getopt.h time.h
-do :
-  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
-"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-# MinGW32 tests
-for ac_header in winsock2.h ws2tcpip.h
-do :
-  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
-"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-# end mingw32 tests
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Werror" >&5
-$as_echo_n "checking whether $CC supports -Werror... " >&6; }
-cache=`echo Werror | sed 'y%.=/+-%___p_%'`
-if eval \${cv_prog_cc_flag_$cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-echo 'void f(){}' >conftest.c
-if test -z "`$CC $CPPFLAGS $CFLAGS -Werror -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_$cache=yes"
-else
-eval "cv_prog_cc_flag_$cache=no"
-fi
-rm -f conftest conftest.o conftest.c
-
-fi
-
-if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-:
-ERRFLAG="-Werror"
-else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-:
-ERRFLAG="-errwarn"
-fi
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wall" >&5
-$as_echo_n "checking whether $CC supports -Wall... " >&6; }
-cache=`echo Wall | sed 'y%.=/+-%___p_%'`
-if eval \${cv_prog_cc_flag_$cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-echo 'void f(){}' >conftest.c
-if test -z "`$CC $CPPFLAGS $CFLAGS -Wall -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_$cache=yes"
-else
-eval "cv_prog_cc_flag_$cache=no"
-fi
-rm -f conftest conftest.o conftest.c
-
-fi
-
-if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-:
-ERRFLAG="$ERRFLAG -Wall"
-else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-:
-ERRFLAG="$ERRFLAG -errfmt"
-fi
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -std=c99" >&5
-$as_echo_n "checking whether $CC supports -std=c99... " >&6; }
-cache=`echo std=c99 | sed 'y%.=/+-%___p_%'`
-if eval \${cv_prog_cc_flag_$cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-echo 'void f(){}' >conftest.c
-if test -z "`$CC $CPPFLAGS $CFLAGS -std=c99 -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_$cache=yes"
-else
-eval "cv_prog_cc_flag_$cache=no"
-fi
-rm -f conftest conftest.o conftest.c
-
-fi
-
-if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-:
-C99FLAG="-std=c99"
-else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-:
-
-fi
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -xc99" >&5
-$as_echo_n "checking whether $CC supports -xc99... " >&6; }
-cache=`echo xc99 | sed 'y%.=/+-%___p_%'`
-if eval \${cv_prog_cc_flag_$cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-echo 'void f(){}' >conftest.c
-if test -z "`$CC $CPPFLAGS $CFLAGS -xc99 -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_$cache=yes"
-else
-eval "cv_prog_cc_flag_$cache=no"
-fi
-rm -f conftest conftest.o conftest.c
-
-fi
-
-if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-:
-C99FLAG="-xc99"
-else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-:
-
-fi
-
-
-for ac_header in getopt.h time.h
-do :
-  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
-"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE as a flag for $CC" >&5
-$as_echo_n "checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE as a flag for $CC... " >&6; }
-cache=`$as_echo "$C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE" | $as_tr_sh`
-if eval \${cv_prog_cc_flag_needed_$cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-echo '
-#include "confdefs.h"
-#include 
-#include 
-#include 
-#ifdef HAVE_TIME_H
-#include 
-#endif
-#include 
-#include 
-#ifdef HAVE_GETOPT_H
-#include 
-#endif
-
-int test() {
-	int a;
-	char **opts = NULL;
-	struct timeval tv;
-	char *t;
-	time_t time = 0;
-	char *buf = NULL;
-	const char* str = NULL;
-	struct msghdr msg;
-	msg.msg_control = 0;
-	t = ctime_r(&time, buf);
-	tv.tv_usec = 10;
-	srandom(32);
-	a = getopt(2, opts, "a");
-	a = isascii(32);
-	str = gai_strerror(0);
-	if(str && t && tv.tv_usec && msg.msg_control)
-		a = 0;
-	return a;
-}
-' > conftest.c
-echo 'void f(){}' >>conftest.c
-if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_needed_$cache=no"
-else
-
-if test -z "`$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_needed_$cache=yes"
-else
-eval "cv_prog_cc_flag_needed_$cache=fail"
-#echo 'Test with flag fails too!'
-#cat conftest.c
-#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1"
-#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1`
-#exit 1
-fi
-
-fi
-rm -f conftest conftest.c conftest.o
-
-fi
-
-if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-:
-CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE"
-else
-if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-#echo 'Test with flag is no!'
-#cat conftest.c
-#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1"
-#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1`
-#exit 1
-:
-
-else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
-$as_echo "failed" >&6; }
-:
-
-fi
-fi
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE as a flag for $CC" >&5
-$as_echo_n "checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE as a flag for $CC... " >&6; }
-cache=`$as_echo "$C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE" | $as_tr_sh`
-if eval \${cv_prog_cc_flag_needed_$cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-echo '
-#include "confdefs.h"
-#include 
-#include 
-#include 
-#ifdef HAVE_TIME_H
-#include 
-#endif
-#include 
-#include 
-#ifdef HAVE_GETOPT_H
-#include 
-#endif
-
-int test() {
-	int a;
-	char **opts = NULL;
-	struct timeval tv;
-	char *t;
-	time_t time = 0;
-	char *buf = NULL;
-	const char* str = NULL;
-	struct msghdr msg;
-	msg.msg_control = 0;
-	t = ctime_r(&time, buf);
-	tv.tv_usec = 10;
-	srandom(32);
-	a = getopt(2, opts, "a");
-	a = isascii(32);
-	str = gai_strerror(0);
-	if(str && t && tv.tv_usec && msg.msg_control)
-		a = 0;
-	return a;
-}
-' > conftest.c
-echo 'void f(){}' >>conftest.c
-if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_needed_$cache=no"
-else
-
-if test -z "`$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_needed_$cache=yes"
-else
-eval "cv_prog_cc_flag_needed_$cache=fail"
-#echo 'Test with flag fails too!'
-#cat conftest.c
-#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1"
-#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1`
-#exit 1
-fi
-
-fi
-rm -f conftest conftest.c conftest.o
-
-fi
-
-if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-:
-CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE"
-else
-if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-#echo 'Test with flag is no!'
-#cat conftest.c
-#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1"
-#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1`
-#exit 1
-:
-
-else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
-$as_echo "failed" >&6; }
-:
-
-fi
-fi
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need $C99FLAG as a flag for $CC" >&5
-$as_echo_n "checking whether we need $C99FLAG as a flag for $CC... " >&6; }
-cache=`$as_echo "$C99FLAG" | $as_tr_sh`
-if eval \${cv_prog_cc_flag_needed_$cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-echo '
-#include 
-#include 
-int test() {
-        int a = 0;
-        return a;
-}
-' > conftest.c
-echo 'void f(){}' >>conftest.c
-if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_needed_$cache=no"
-else
-
-if test -z "`$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_needed_$cache=yes"
-else
-eval "cv_prog_cc_flag_needed_$cache=fail"
-#echo 'Test with flag fails too!'
-#cat conftest.c
-#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1"
-#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1`
-#exit 1
-fi
-
-fi
-rm -f conftest conftest.c conftest.o
-
-fi
-
-if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-:
-CFLAGS="$CFLAGS $C99FLAG"
-else
-if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-#echo 'Test with flag is no!'
-#cat conftest.c
-#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1"
-#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1`
-#exit 1
-:
-
-else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
-$as_echo "failed" >&6; }
-:
-
-fi
-fi
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -D_BSD_SOURCE as a flag for $CC" >&5
-$as_echo_n "checking whether we need -D_BSD_SOURCE as a flag for $CC... " >&6; }
-cache=_D_BSD_SOURCE
-if eval \${cv_prog_cc_flag_needed_$cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-echo '
-#include 
-
-int test() {
-        int a;
-        a = isascii(32);
-        return a;
-}
-' > conftest.c
-echo 'void f(){}' >>conftest.c
-if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_needed_$cache=no"
-else
-
-if test -z "`$CC $CPPFLAGS $CFLAGS -D_BSD_SOURCE $ERRFLAG -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_needed_$cache=yes"
-else
-eval "cv_prog_cc_flag_needed_$cache=fail"
-#echo 'Test with flag fails too!'
-#cat conftest.c
-#echo "$CC $CPPFLAGS $CFLAGS -D_BSD_SOURCE $ERRFLAG -c conftest.c 2>&1"
-#echo `$CC $CPPFLAGS $CFLAGS -D_BSD_SOURCE $ERRFLAG -c conftest.c 2>&1`
-#exit 1
-fi
-
-fi
-rm -f conftest conftest.c conftest.o
-
-fi
-
-if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-:
-CFLAGS="$CFLAGS -D_BSD_SOURCE"
-else
-if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-#echo 'Test with flag is no!'
-#cat conftest.c
-#echo "$CC $CPPFLAGS $CFLAGS -D_BSD_SOURCE $ERRFLAG -c conftest.c 2>&1"
-#echo `$CC $CPPFLAGS $CFLAGS -D_BSD_SOURCE $ERRFLAG -c conftest.c 2>&1`
-#exit 1
-:
-
-else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
-$as_echo "failed" >&6; }
-:
-
-fi
-fi
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -D_GNU_SOURCE as a flag for $CC" >&5
-$as_echo_n "checking whether we need -D_GNU_SOURCE as a flag for $CC... " >&6; }
-cache=_D_GNU_SOURCE
-if eval \${cv_prog_cc_flag_needed_$cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-echo '
-#include 
-
-int test() {
-        struct in6_pktinfo inf;
-	int a = (int)sizeof(inf);
-        return a;
-}
-' > conftest.c
-echo 'void f(){}' >>conftest.c
-if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_needed_$cache=no"
-else
-
-if test -z "`$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE $ERRFLAG -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_needed_$cache=yes"
-else
-eval "cv_prog_cc_flag_needed_$cache=fail"
-#echo 'Test with flag fails too!'
-#cat conftest.c
-#echo "$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE $ERRFLAG -c conftest.c 2>&1"
-#echo `$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE $ERRFLAG -c conftest.c 2>&1`
-#exit 1
-fi
-
-fi
-rm -f conftest conftest.c conftest.o
-
-fi
-
-if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-:
-CFLAGS="$CFLAGS -D_GNU_SOURCE"
-else
-if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-#echo 'Test with flag is no!'
-#cat conftest.c
-#echo "$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE $ERRFLAG -c conftest.c 2>&1"
-#echo `$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE $ERRFLAG -c conftest.c 2>&1`
-#exit 1
-:
-
-else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
-$as_echo "failed" >&6; }
-:
-
-fi
-fi
-
-
-# check again for GNU_SOURCE for setresgid. May fail if setresgid
-# is not available at all. -D_FRSRESGID is to make this check unique.
-# otherwise we would get the previous cached result.
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -D_GNU_SOURCE -D_FRSRESGID as a flag for $CC" >&5
-$as_echo_n "checking whether we need -D_GNU_SOURCE -D_FRSRESGID as a flag for $CC... " >&6; }
-cache=_D_GNU_SOURCE__D_FRSRESGID
-if eval \${cv_prog_cc_flag_needed_$cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-echo '
-#include 
-
-int test() {
-	int a = setresgid(0,0,0);
-	a = setresuid(0,0,0);
-        return a;
-}
-' > conftest.c
-echo 'void f(){}' >>conftest.c
-if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_needed_$cache=no"
-else
-
-if test -z "`$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE -D_FRSRESGID $ERRFLAG -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_needed_$cache=yes"
-else
-eval "cv_prog_cc_flag_needed_$cache=fail"
-#echo 'Test with flag fails too!'
-#cat conftest.c
-#echo "$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE -D_FRSRESGID $ERRFLAG -c conftest.c 2>&1"
-#echo `$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE -D_FRSRESGID $ERRFLAG -c conftest.c 2>&1`
-#exit 1
-fi
-
-fi
-rm -f conftest conftest.c conftest.o
-
-fi
-
-if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-:
-CFLAGS="$CFLAGS -D_GNU_SOURCE"
-else
-if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-#echo 'Test with flag is no!'
-#cat conftest.c
-#echo "$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE -D_FRSRESGID $ERRFLAG -c conftest.c 2>&1"
-#echo `$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE -D_FRSRESGID $ERRFLAG -c conftest.c 2>&1`
-#exit 1
-:
-
-else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
-$as_echo "failed" >&6; }
-:
-
-fi
-fi
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -D_POSIX_C_SOURCE=200112 as a flag for $CC" >&5
-$as_echo_n "checking whether we need -D_POSIX_C_SOURCE=200112 as a flag for $CC... " >&6; }
-cache=`$as_echo "-D_POSIX_C_SOURCE=200112" | $as_tr_sh`
-if eval \${cv_prog_cc_flag_needed_$cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-echo '
-#include "confdefs.h"
-#ifdef HAVE_TIME_H
-#include 
-#endif
-#include 
-
-int test() {
-        int a = 0;
-        char *t;
-        time_t time = 0;
-        char *buf = NULL;
-	const char* str = NULL;
-        t = ctime_r(&time, buf);
-	str = gai_strerror(0);
-	if(t && str)
-		a = 0;
-        return a;
-}
-' > conftest.c
-echo 'void f(){}' >>conftest.c
-if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_needed_$cache=no"
-else
-
-if test -z "`$CC $CPPFLAGS $CFLAGS -D_POSIX_C_SOURCE=200112 $ERRFLAG -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_needed_$cache=yes"
-else
-eval "cv_prog_cc_flag_needed_$cache=fail"
-#echo 'Test with flag fails too!'
-#cat conftest.c
-#echo "$CC $CPPFLAGS $CFLAGS -D_POSIX_C_SOURCE=200112 $ERRFLAG -c conftest.c 2>&1"
-#echo `$CC $CPPFLAGS $CFLAGS -D_POSIX_C_SOURCE=200112 $ERRFLAG -c conftest.c 2>&1`
-#exit 1
-fi
-
-fi
-rm -f conftest conftest.c conftest.o
-
-fi
-
-if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-:
-CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=200112"
-else
-if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-#echo 'Test with flag is no!'
-#cat conftest.c
-#echo "$CC $CPPFLAGS $CFLAGS -D_POSIX_C_SOURCE=200112 $ERRFLAG -c conftest.c 2>&1"
-#echo `$CC $CPPFLAGS $CFLAGS -D_POSIX_C_SOURCE=200112 $ERRFLAG -c conftest.c 2>&1`
-#exit 1
-:
-
-else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
-$as_echo "failed" >&6; }
-:
-
-fi
-fi
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -D__EXTENSIONS__ as a flag for $CC" >&5
-$as_echo_n "checking whether we need -D__EXTENSIONS__ as a flag for $CC... " >&6; }
-cache=_D__EXTENSIONS__
-if eval \${cv_prog_cc_flag_needed_$cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-echo '
-#include "confdefs.h"
-#include 
-#include 
-#include 
-#ifdef HAVE_TIME_H
-#include 
-#endif
-#include 
-#ifdef HAVE_GETOPT_H
-#include 
-#endif
-
-int test() {
-        int a;
-        char **opts = NULL;
-        struct timeval tv;
-        tv.tv_usec = 10;
-        srandom(32);
-        a = getopt(2, opts, "a");
-        a = isascii(32);
-	if(tv.tv_usec)
-		a = 0;
-        return a;
-}
-' > conftest.c
-echo 'void f(){}' >>conftest.c
-if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_needed_$cache=no"
-else
-
-if test -z "`$CC $CPPFLAGS $CFLAGS -D__EXTENSIONS__ $ERRFLAG -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_needed_$cache=yes"
-else
-eval "cv_prog_cc_flag_needed_$cache=fail"
-#echo 'Test with flag fails too!'
-#cat conftest.c
-#echo "$CC $CPPFLAGS $CFLAGS -D__EXTENSIONS__ $ERRFLAG -c conftest.c 2>&1"
-#echo `$CC $CPPFLAGS $CFLAGS -D__EXTENSIONS__ $ERRFLAG -c conftest.c 2>&1`
-#exit 1
-fi
-
-fi
-rm -f conftest conftest.c conftest.o
-
-fi
-
-if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-:
-CFLAGS="$CFLAGS -D__EXTENSIONS__"
-else
-if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-#echo 'Test with flag is no!'
-#cat conftest.c
-#echo "$CC $CPPFLAGS $CFLAGS -D__EXTENSIONS__ $ERRFLAG -c conftest.c 2>&1"
-#echo `$CC $CPPFLAGS $CFLAGS -D__EXTENSIONS__ $ERRFLAG -c conftest.c 2>&1`
-#exit 1
-:
-
-else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
-$as_echo "failed" >&6; }
-:
-
-fi
-fi
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
-$as_echo_n "checking for inline... " >&6; }
-if ${ac_cv_c_inline+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_c_inline=no
-for ac_kw in inline __inline__ __inline; do
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifndef __cplusplus
-typedef int foo_t;
-static $ac_kw foo_t static_foo () {return 0; }
-$ac_kw foo_t foo () {return 0; }
-#endif
-
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_c_inline=$ac_kw
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  test "$ac_cv_c_inline" != no && break
-done
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
-$as_echo "$ac_cv_c_inline" >&6; }
-
-case $ac_cv_c_inline in
-  inline | yes) ;;
-  *)
-    case $ac_cv_c_inline in
-      no) ac_val=;;
-      *) ac_val=$ac_cv_c_inline;;
-    esac
-    cat >>confdefs.h <<_ACEOF
-#ifndef __cplusplus
-#define inline $ac_val
-#endif
-_ACEOF
-    ;;
-esac
-
-ac_fn_c_check_type "$LINENO" "int8_t" "ac_cv_type_int8_t" "$ac_includes_default"
-if test "x$ac_cv_type_int8_t" = xyes; then :
-
-else
-
-cat >>confdefs.h <<_ACEOF
-#define int8_t char
-_ACEOF
-
-fi
-
-ac_fn_c_check_type "$LINENO" "int16_t" "ac_cv_type_int16_t" "$ac_includes_default"
-if test "x$ac_cv_type_int16_t" = xyes; then :
-
-else
-
-cat >>confdefs.h <<_ACEOF
-#define int16_t short
-_ACEOF
-
-fi
-
-ac_fn_c_check_type "$LINENO" "int32_t" "ac_cv_type_int32_t" "$ac_includes_default"
-if test "x$ac_cv_type_int32_t" = xyes; then :
-
-else
-
-cat >>confdefs.h <<_ACEOF
-#define int32_t int
-_ACEOF
-
-fi
-
-ac_fn_c_check_type "$LINENO" "int64_t" "ac_cv_type_int64_t" "$ac_includes_default"
-if test "x$ac_cv_type_int64_t" = xyes; then :
-
-else
-
-cat >>confdefs.h <<_ACEOF
-#define int64_t long long
-_ACEOF
-
-fi
-
-ac_fn_c_check_type "$LINENO" "uint8_t" "ac_cv_type_uint8_t" "$ac_includes_default"
-if test "x$ac_cv_type_uint8_t" = xyes; then :
-
-else
-
-cat >>confdefs.h <<_ACEOF
-#define uint8_t unsigned char
-_ACEOF
-
-fi
-
-ac_fn_c_check_type "$LINENO" "uint16_t" "ac_cv_type_uint16_t" "$ac_includes_default"
-if test "x$ac_cv_type_uint16_t" = xyes; then :
-
-else
-
-cat >>confdefs.h <<_ACEOF
-#define uint16_t unsigned short
-_ACEOF
-
-fi
-
-ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "$ac_includes_default"
-if test "x$ac_cv_type_uint32_t" = xyes; then :
-
-else
-
-cat >>confdefs.h <<_ACEOF
-#define uint32_t unsigned int
-_ACEOF
-
-fi
-
-ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "$ac_includes_default"
-if test "x$ac_cv_type_uint64_t" = xyes; then :
-
-else
-
-cat >>confdefs.h <<_ACEOF
-#define uint64_t unsigned long long
-_ACEOF
-
-fi
-
-
-# my own checks
-# Extract the first word of "doxygen", so it can be a program name with args.
-set dummy doxygen; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_doxygen+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$doxygen"; then
-  ac_cv_prog_doxygen="$doxygen" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_doxygen="doxygen"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-doxygen=$ac_cv_prog_doxygen
-if test -n "$doxygen"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $doxygen" >&5
-$as_echo "$doxygen" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-# check to see if libraries are needed for these functions.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5
-$as_echo_n "checking for library containing socket... " >&6; }
-if ${ac_cv_search_socket+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char socket ();
-int
-main ()
-{
-return socket ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' socket; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_socket=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_socket+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_socket+:} false; then :
-
-else
-  ac_cv_search_socket=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5
-$as_echo "$ac_cv_search_socket" >&6; }
-ac_res=$ac_cv_search_socket
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_pton" >&5
-$as_echo_n "checking for library containing inet_pton... " >&6; }
-if ${ac_cv_search_inet_pton+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char inet_pton ();
-int
-main ()
-{
-return inet_pton ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' nsl; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_inet_pton=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_inet_pton+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_inet_pton+:} false; then :
-
-else
-  ac_cv_search_inet_pton=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inet_pton" >&5
-$as_echo "$ac_cv_search_inet_pton" >&6; }
-ac_res=$ac_cv_search_inet_pton
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-fi
-
-
-
-
-# Check whether --with-drill was given.
-if test "${with_drill+set}" = set; then :
-  withval=$with_drill;
-else
-  with_drill="no"
-fi
-
-if test x_$with_drill != x_no ; then
-	DRILL=drill
-
-	INSTALL_DRILL=install-drill
-
-	UNINSTALL_DRILL=uninstall-drill
-
-	CLEAN_DRILL=clean-drill
-
-	LINT_DRILL=lint-drill
-
-	if test -e $srcdir/drill/config.h -o -e drill/config.h ; then
-		as_fn_error $? "
-A config.h was detected in the drill subdirectory.
-This does not work with the --with-drill option.
-Please remove the config.h from the drill subdirectory
-or do not use the --with-drill option." "$LINENO" 5
-	fi
-	DRILL_CONFIG=" drill/drill.1"
-else
-	DRILL=""
-
-	INSTALL_DRILL=""
-
-	UNINSTALL_DRILL=""
-
-	CLEAN_DRILL=""
-
-	LINT_DRILL=""
-
-	DRILL_CONFIG=""
-fi
-
-
-
-# Check whether --with-examples was given.
-if test "${with_examples+set}" = set; then :
-  withval=$with_examples;
-else
-  with_examples="no"
-fi
-
-if test x_$with_examples != x_no ; then
-	EXAMPLES=examples
-
-	INSTALL_EXAMPLES=install-examples
-
-	UNINSTALL_EXAMPLES=uninstall-examples
-
-	CLEAN_EXAMPLES=clean-examples
-
-	LINT_EXAMPLES=lint-examples
-
-	if test -e $srcdir/examples/config.h -o -e examples/config.h ; then
-		as_fn_error $? "
-A config.h was detected in the examples subdirectory.
-This does not work with the --with-examples option.
-Please remove the config.h from the examples subdirectory
-or do not use the --with-examples option." "$LINENO" 5
-	fi
-	EXAMPLES_CONFIG=" examples/ldns-dane.1 examples/ldns-verify-zone.1"
-else
-	EXAMPLES=""
-
-	INSTALL_EXAMPLES=""
-
-	UNINSTALL_EXAMPLES=""
-
-	CLEAN_EXAMPLES=""
-
-	LINT_EXAMPLES=""
-
-	EXAMPLES_CONFIG=""
-fi
-
-# add option to disable installation of ldns-config script
-# Check whether --enable-ldns-config was given.
-if test "${enable_ldns_config+set}" = set; then :
-  enableval=$enable_ldns_config; enable_ldns_config=$enableval
-else
-  enable_ldns_config=yes
-fi
-
-if test "x$enable_ldns_config" = xyes; then
-	INSTALL_CONFIG=install-config
-
-	INSTALL_CONFIG_MANPAGE=install-config-manpage
-
-	UNINSTALL_CONFIG=uninstall-config
-
-	UNINSTALL_CONFIG_MANPAGE=uninstall-config-manpage
-
-else
-	INSTALL_CONFIG=""
-
-	INSTALL_CONFIG_MANPAGE=""
-
-	UNINSTALL_CONFIG=""
-
-	UNINSTALL_CONFIG_MANPAGE=""
-
-fi
-
-# check for python
-PYTHON_X_CFLAGS=""
-ldns_with_pyldns=no
-ldns_with_pyldnsx=no
-
-# Check whether --with-pyldns was given.
-if test "${with_pyldns+set}" = set; then :
-  withval=$with_pyldns;
-else
-   withval="no"
-fi
-
-ldns_have_python=no
-if test x_$withval != x_no; then
-   # ===========================================================================
-#      http://www.gnu.org/software/autoconf-archive/ax_python_devel.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-#   AX_PYTHON_DEVEL([version])
-#
-# DESCRIPTION
-#
-#   Note: Defines as a precious variable "PYTHON_VERSION". Don't override it
-#   in your configure.ac.
-#
-#   This macro checks for Python and tries to get the include path to
-#   'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS)
-#   output variables. It also exports $(PYTHON_EXTRA_LIBS) and
-#   $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code.
-#
-#   You can search for some particular version of Python by passing a
-#   parameter to this macro, for example ">= '2.3.1'", or "== '2.4'". Please
-#   note that you *have* to pass also an operator along with the version to
-#   match, and pay special attention to the single quotes surrounding the
-#   version number. Don't use "PYTHON_VERSION" for this: that environment
-#   variable is declared as precious and thus reserved for the end-user.
-#
-#   This macro should work for all versions of Python >= 2.1.0. As an end
-#   user, you can disable the check for the python version by setting the
-#   PYTHON_NOVERSIONCHECK environment variable to something else than the
-#   empty string.
-#
-#   If you need to use this macro for an older Python version, please
-#   contact the authors. We're always open for feedback.
-#
-# LICENSE
-#
-#   Copyright (c) 2009 Sebastian Huber 
-#   Copyright (c) 2009 Alan W. Irwin 
-#   Copyright (c) 2009 Rafael Laboissiere 
-#   Copyright (c) 2009 Andrew Collier 
-#   Copyright (c) 2009 Matteo Settenvini 
-#   Copyright (c) 2009 Horst Knorr 
-#
-#   This program 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 3 of the License, or (at your
-#   option) any later version.
-#
-#   This program 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 this program. If not, see .
-#
-#   As a special exception, the respective Autoconf Macro's copyright owner
-#   gives unlimited permission to copy, distribute and modify the configure
-#   scripts that are the output of Autoconf when processing the Macro. You
-#   need not follow the terms of the GNU General Public License when using
-#   or distributing such scripts, even though portions of the text of the
-#   Macro appear in them. The GNU General Public License (GPL) does govern
-#   all other use of the material that constitutes the Autoconf Macro.
-#
-#   This special exception to the GPL applies to versions of the Autoconf
-#   Macro released by the Autoconf Archive. When you make and distribute a
-#   modified version of the Autoconf Macro, you may extend this special
-#   exception to the GPL to apply to your modified version as well.
-
-#serial 8
-
-# This is what autoupdate's m4 run will expand.  It fires
-# the warning (with _au_warn_XXX), outputs it into the
-# updated configure.ac (with AC_DIAGNOSE), and then outputs
-# the replacement expansion.
-
-
-# This is an auxiliary macro that is also run when
-# autoupdate runs m4.  It simply calls m4_warning, but
-# we need a wrapper so that each warning is emitted only
-# once.  We break the quoting in m4_warning's argument in
-# order to expand this macro's arguments, not AU_DEFUN's.
-
-
-# Finally, this is the expansion that is picked up by
-# autoconf.  It tells the user to run autoupdate, and
-# then outputs the replacement expansion.  We do not care
-# about autoupdate's warning because that contains
-# information on what to do *after* running autoupdate.
-
-
-
-   ac_save_LIBS="$LIBS"
-
-	#
-	# Allow the use of a (user set) custom python version
-	#
-
-
-	# Extract the first word of "python[$PYTHON_VERSION]", so it can be a program name with args.
-set dummy python$PYTHON_VERSION; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_PYTHON+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $PYTHON in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-PYTHON=$ac_cv_path_PYTHON
-if test -n "$PYTHON"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5
-$as_echo "$PYTHON" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-	if test -z "$PYTHON"; then
-	   as_fn_error $? "Cannot find python$PYTHON_VERSION in your system path" "$LINENO" 5
-	   PYTHON_VERSION=""
-	fi
-
-	#
-	# Check for a version of Python >= 2.1.0
-	#
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a version of Python >= '2.1.0'" >&5
-$as_echo_n "checking for a version of Python >= '2.1.0'... " >&6; }
-	ac_supports_python_ver=`$PYTHON -c "import sys; \
-		ver = sys.version.split ()[0]; \
-		print (ver >= '2.1.0')"`
-	if test "$ac_supports_python_ver" != "True"; then
-		if test -z "$PYTHON_NOVERSIONCHECK"; then
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-			{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "
-This version of the AC_PYTHON_DEVEL macro
-doesn't work properly with versions of Python before
-2.1.0. You may need to re-run configure, setting the
-variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG,
-PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
-Moreover, to disable this check, set PYTHON_NOVERSIONCHECK
-to something else than an empty string.
-
-See \`config.log' for more details" "$LINENO" 5; }
-		else
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: skip at user request" >&5
-$as_echo "skip at user request" >&6; }
-		fi
-	else
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-	fi
-
-	#
-	# if the macro parameter ``version'' is set, honour it
-	#
-	if test -n ">= '2.4.0'"; then
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a version of Python >= '2.4.0'" >&5
-$as_echo_n "checking for a version of Python >= '2.4.0'... " >&6; }
-		ac_supports_python_ver=`$PYTHON -c "import sys; \
-			ver = sys.version.split ()[0]; \
-			print (ver >= '2.4.0')"`
-		if test "$ac_supports_python_ver" = "True"; then
-		   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-		else
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-			as_fn_error $? "this package requires Python >= '2.4.0'.
-If you have it installed, but it isn't the default Python
-interpreter in your system path, please pass the PYTHON_VERSION
-variable to configure. See \`\`configure --help'' for reference.
-" "$LINENO" 5
-			PYTHON_VERSION=""
-		fi
-	fi
-
-	#
-	# Check if you have distutils, else fail
-	#
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the distutils Python package" >&5
-$as_echo_n "checking for the distutils Python package... " >&6; }
-	ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
-	if test -z "$ac_distutils_result"; then
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-	else
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-		as_fn_error $? "cannot import Python module \"distutils\".
-Please check your Python installation. The error was:
-$ac_distutils_result" "$LINENO" 5
-		PYTHON_VERSION=""
-	fi
-
-	#
-	# Check for Python include path
-	#
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python include path" >&5
-$as_echo_n "checking for Python include path... " >&6; }
-	if test -z "$PYTHON_CPPFLAGS"; then
-		python_path=`$PYTHON -c "import distutils.sysconfig; \
-			print (distutils.sysconfig.get_python_inc ());"`
-		if test -n "${python_path}"; then
-			python_path="-I$python_path"
-		fi
-		PYTHON_CPPFLAGS=$python_path
-	fi
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_CPPFLAGS" >&5
-$as_echo "$PYTHON_CPPFLAGS" >&6; }
-
-
-	#
-	# Check for Python library path
-	#
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python library path" >&5
-$as_echo_n "checking for Python library path... " >&6; }
-	if test -z "$PYTHON_LDFLAGS"; then
-		# (makes two attempts to ensure we've got a version number
-		# from the interpreter)
-		ac_python_version=`cat<>confdefs.h <<_ACEOF
-#define HAVE_PYTHON "$ac_python_version"
-_ACEOF
-
-
-		# First, the library directory:
-		ac_python_libdir=`cat<&5
-$as_echo "$PYTHON_LDFLAGS" >&6; }
-
-
-	#
-	# Check for site packages
-	#
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python site-packages path" >&5
-$as_echo_n "checking for Python site-packages path... " >&6; }
-	if test -z "$PYTHON_SITE_PKG"; then
-		PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
-			print (distutils.sysconfig.get_python_lib(1,0));"`
-	fi
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_SITE_PKG" >&5
-$as_echo "$PYTHON_SITE_PKG" >&6; }
-
-
-	#
-	# libraries which must be linked in when embedding
-	#
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra libraries" >&5
-$as_echo_n "checking python extra libraries... " >&6; }
-	if test -z "$PYTHON_EXTRA_LIBS"; then
-	   PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
-                conf = distutils.sysconfig.get_config_var; \
-                print (conf('LOCALMODLIBS') + ' ' + conf('LIBS'))"`
-	fi
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LIBS" >&5
-$as_echo "$PYTHON_EXTRA_LIBS" >&6; }
-
-
-	#
-	# linking flags needed when embedding
-	#
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra linking flags" >&5
-$as_echo_n "checking python extra linking flags... " >&6; }
-	if test -z "$PYTHON_EXTRA_LDFLAGS"; then
-		PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
-			conf = distutils.sysconfig.get_config_var; \
-			print (conf('LINKFORSHARED'))"`
-	fi
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LDFLAGS" >&5
-$as_echo "$PYTHON_EXTRA_LDFLAGS" >&6; }
-
-
-	#
-	# final check to see if everything compiles alright
-	#
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking consistency of all components of python development environment" >&5
-$as_echo_n "checking consistency of all components of python development environment... " >&6; }
-	# save current global flags
-	ac_save_LIBS="$LIBS"
-	ac_save_CPPFLAGS="$CPPFLAGS"
-	LIBS="$ac_save_LIBS $PYTHON_LDFLAGS $PYTHON_EXTRA_LDFLAGS $PYTHON_EXTRA_LIBS"
-	CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
-	ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-		#include 
-int
-main ()
-{
-Py_Initialize();
-  ;
-  return 0;
-}
-
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  pythonexists=yes
-else
-  pythonexists=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-	ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-	# turn back to default flags
-	CPPFLAGS="$ac_save_CPPFLAGS"
-	LIBS="$ac_save_LIBS"
-
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pythonexists" >&5
-$as_echo "$pythonexists" >&6; }
-
-        if test ! "x$pythonexists" = "xyes"; then
-	   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "
-  Could not link test program to Python. Maybe the main Python library has been
-  installed in some non-standard library path. If so, pass it to configure,
-  via the LDFLAGS environment variable.
-  Example: ./configure LDFLAGS=\"-L/usr/non-standard-path/python/lib\"
-  ============================================================================
-   ERROR!
-   You probably have to install the development version of the Python package
-   for your distribution.  The exact name of this package varies among them.
-  ============================================================================
-
-See \`config.log' for more details" "$LINENO" 5; }
-	  PYTHON_VERSION=""
-	fi
-
-	#
-	# all done!
-	#
-
-   if test ! -z "$ac_python_version"; then
-	ldns_have_python=yes
-   fi
-
-   # pass additional Python 3 option to SWIG
-   if test `$PYTHON -c "import sys; \
-       ver = sys.version.split()[0]; \
-       print(ver >= '3')"` = "True"; then
-       SWIGPY3="-py3 -DPY3"
-
-   fi
-
-   # check for SWIG
-   if test x_$ldns_have_python != x_no; then
-        # ===========================================================================
-#        http://www.gnu.org/software/autoconf-archive/ax_pkg_swig.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-#   AX_PKG_SWIG([major.minor.micro], [action-if-found], [action-if-not-found])
-#
-# DESCRIPTION
-#
-#   This macro searches for a SWIG installation on your system. If found,
-#   then SWIG is AC_SUBST'd; if not found, then $SWIG is empty.  If SWIG is
-#   found, then SWIG_LIB is set to the SWIG library path, and AC_SUBST'd.
-#
-#   You can use the optional first argument to check if the version of the
-#   available SWIG is greater than or equal to the value of the argument. It
-#   should have the format: N[.N[.N]] (N is a number between 0 and 999. Only
-#   the first N is mandatory.) If the version argument is given (e.g.
-#   1.3.17), AX_PKG_SWIG checks that the swig package is this version number
-#   or higher.
-#
-#   As usual, action-if-found is executed if SWIG is found, otherwise
-#   action-if-not-found is executed.
-#
-#   In configure.in, use as:
-#
-#     AX_PKG_SWIG(1.3.17, [], [ AC_MSG_ERROR([SWIG is required to build..]) ])
-#     AX_SWIG_ENABLE_CXX
-#     AX_SWIG_MULTI_MODULE_SUPPORT
-#     AX_SWIG_PYTHON
-#
-# LICENSE
-#
-#   Copyright (c) 2008 Sebastian Huber 
-#   Copyright (c) 2008 Alan W. Irwin 
-#   Copyright (c) 2008 Rafael Laboissiere 
-#   Copyright (c) 2008 Andrew Collier 
-#   Copyright (c) 2011 Murray Cumming 
-#
-#   This program 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 of the License, or (at your
-#   option) any later version.
-#
-#   This program 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 this program. If not, see .
-#
-#   As a special exception, the respective Autoconf Macro's copyright owner
-#   gives unlimited permission to copy, distribute and modify the configure
-#   scripts that are the output of Autoconf when processing the Macro. You
-#   need not follow the terms of the GNU General Public License when using
-#   or distributing such scripts, even though portions of the text of the
-#   Macro appear in them. The GNU General Public License (GPL) does govern
-#   all other use of the material that constitutes the Autoconf Macro.
-#
-#   This special exception to the GPL applies to versions of the Autoconf
-#   Macro released by the Autoconf Archive. When you make and distribute a
-#   modified version of the Autoconf Macro, you may extend this special
-#   exception to the GPL to apply to your modified version as well.
-
-#serial 8
-
-
-
-
-        # check for >=SWIG-2.0.4 if Python 3.2 used
-        if test `$PYTHON -c "import sys; \
-            ver = sys.version.split()[0]; \
-            print(ver >= '3.2')"` = "True"; then
-
-        # Ubuntu has swig 2.0 as /usr/bin/swig2.0
-        for ac_prog in swig2.0 swig
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_SWIG+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $SWIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_SWIG="$SWIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_SWIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-SWIG=$ac_cv_path_SWIG
-if test -n "$SWIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG" >&5
-$as_echo "$SWIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$SWIG" && break
-done
-
-        if test -z "$SWIG" ; then
-                as_fn_error $? "SWIG-2.0.4 is required to build pyldns for Python 3.2 and greater." "$LINENO" 5
-        elif test -n "2.0.4" ; then
-                { $as_echo "$as_me:${as_lineno-$LINENO}: checking SWIG version" >&5
-$as_echo_n "checking SWIG version... " >&6; }
-                swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`
-                { $as_echo "$as_me:${as_lineno-$LINENO}: result: $swig_version" >&5
-$as_echo "$swig_version" >&6; }
-                if test -n "$swig_version" ; then
-                        # Calculate the required version number components
-                        required=2.0.4
-                        required_major=`echo $required | sed 's/[^0-9].*//'`
-                        if test -z "$required_major" ; then
-                                required_major=0
-                        fi
-                        required=`echo $required | sed 's/[0-9]*[^0-9]//'`
-                        required_minor=`echo $required | sed 's/[^0-9].*//'`
-                        if test -z "$required_minor" ; then
-                                required_minor=0
-                        fi
-                        required=`echo $required | sed 's/[0-9]*[^0-9]//'`
-                        required_patch=`echo $required | sed 's/[^0-9].*//'`
-                        if test -z "$required_patch" ; then
-                                required_patch=0
-                        fi
-                        # Calculate the available version number components
-                        available=$swig_version
-                        available_major=`echo $available | sed 's/[^0-9].*//'`
-                        if test -z "$available_major" ; then
-                                available_major=0
-                        fi
-                        available=`echo $available | sed 's/[0-9]*[^0-9]//'`
-                        available_minor=`echo $available | sed 's/[^0-9].*//'`
-                        if test -z "$available_minor" ; then
-                                available_minor=0
-                        fi
-                        available=`echo $available | sed 's/[0-9]*[^0-9]//'`
-                        available_patch=`echo $available | sed 's/[^0-9].*//'`
-                        if test -z "$available_patch" ; then
-                                available_patch=0
-                        fi
-                        # Convert the version tuple into a single number for easier comparison.
-                        # Using base 100 should be safe since SWIG internally uses BCD values
-                        # to encode its version number.
-                        required_swig_vernum=`expr $required_major \* 10000 \
-                            \+ $required_minor \* 100 \+ $required_patch`
-                        available_swig_vernum=`expr $available_major \* 10000 \
-                            \+ $available_minor \* 100 \+ $available_patch`
-
-                        if test $available_swig_vernum -lt $required_swig_vernum; then
-                                { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: SWIG version >= 2.0.4 is required.  You have $swig_version." >&5
-$as_echo "$as_me: WARNING: SWIG version >= 2.0.4 is required.  You have $swig_version." >&2;}
-                                SWIG=''
-                                as_fn_error $? "SWIG-2.0.4 is required to build pyldns for Python 3.2 and greater." "$LINENO" 5
-                        else
-                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SWIG library" >&5
-$as_echo_n "checking for SWIG library... " >&6; }
-                                SWIG_LIB=`$SWIG -swiglib`
-                                { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG_LIB" >&5
-$as_echo "$SWIG_LIB" >&6; }
-
-                        fi
-                else
-                        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot determine SWIG version" >&5
-$as_echo "$as_me: WARNING: cannot determine SWIG version" >&2;}
-                        SWIG=''
-                        as_fn_error $? "SWIG-2.0.4 is required to build pyldns for Python 3.2 and greater." "$LINENO" 5
-                fi
-        fi
-
-
-        else
-
-        # Ubuntu has swig 2.0 as /usr/bin/swig2.0
-        for ac_prog in swig2.0 swig
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_SWIG+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $SWIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_SWIG="$SWIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_SWIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-SWIG=$ac_cv_path_SWIG
-if test -n "$SWIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG" >&5
-$as_echo "$SWIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$SWIG" && break
-done
-
-        if test -z "$SWIG" ; then
-                :
-        elif test -n "" ; then
-                { $as_echo "$as_me:${as_lineno-$LINENO}: checking SWIG version" >&5
-$as_echo_n "checking SWIG version... " >&6; }
-                swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`
-                { $as_echo "$as_me:${as_lineno-$LINENO}: result: $swig_version" >&5
-$as_echo "$swig_version" >&6; }
-                if test -n "$swig_version" ; then
-                        # Calculate the required version number components
-                        required=
-                        required_major=`echo $required | sed 's/[^0-9].*//'`
-                        if test -z "$required_major" ; then
-                                required_major=0
-                        fi
-                        required=`echo $required | sed 's/[0-9]*[^0-9]//'`
-                        required_minor=`echo $required | sed 's/[^0-9].*//'`
-                        if test -z "$required_minor" ; then
-                                required_minor=0
-                        fi
-                        required=`echo $required | sed 's/[0-9]*[^0-9]//'`
-                        required_patch=`echo $required | sed 's/[^0-9].*//'`
-                        if test -z "$required_patch" ; then
-                                required_patch=0
-                        fi
-                        # Calculate the available version number components
-                        available=$swig_version
-                        available_major=`echo $available | sed 's/[^0-9].*//'`
-                        if test -z "$available_major" ; then
-                                available_major=0
-                        fi
-                        available=`echo $available | sed 's/[0-9]*[^0-9]//'`
-                        available_minor=`echo $available | sed 's/[^0-9].*//'`
-                        if test -z "$available_minor" ; then
-                                available_minor=0
-                        fi
-                        available=`echo $available | sed 's/[0-9]*[^0-9]//'`
-                        available_patch=`echo $available | sed 's/[^0-9].*//'`
-                        if test -z "$available_patch" ; then
-                                available_patch=0
-                        fi
-                        # Convert the version tuple into a single number for easier comparison.
-                        # Using base 100 should be safe since SWIG internally uses BCD values
-                        # to encode its version number.
-                        required_swig_vernum=`expr $required_major \* 10000 \
-                            \+ $required_minor \* 100 \+ $required_patch`
-                        available_swig_vernum=`expr $available_major \* 10000 \
-                            \+ $available_minor \* 100 \+ $available_patch`
-
-                        if test $available_swig_vernum -lt $required_swig_vernum; then
-                                { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: SWIG version >=  is required.  You have $swig_version." >&5
-$as_echo "$as_me: WARNING: SWIG version >=  is required.  You have $swig_version." >&2;}
-                                SWIG=''
-
-                        else
-                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SWIG library" >&5
-$as_echo_n "checking for SWIG library... " >&6; }
-                                SWIG_LIB=`$SWIG -swiglib`
-                                { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG_LIB" >&5
-$as_echo "$SWIG_LIB" >&6; }
-
-                        fi
-                else
-                        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot determine SWIG version" >&5
-$as_echo "$as_me: WARNING: cannot determine SWIG version" >&2;}
-                        SWIG=''
-
-                fi
-        fi
-
-
-        fi
-
-	if test ! -x "$SWIG"; then
-		as_fn_error $? "failed to find SWIG tool, install it, or do not build pyldns" "$LINENO" 5
-	else
-
-$as_echo "#define HAVE_SWIG 1" >>confdefs.h
-
-		PYLDNS="pyldns"
-
-		swig="$SWIG"
-
-		ldns_with_pyldns=yes
-	fi
-   else
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: *** don't have Python, skipping SWIG, no pyldns ***" >&5
-$as_echo "*** don't have Python, skipping SWIG, no pyldns ***" >&6; } # '
-   fi
-
-   # xtra cflags for pyldns
-   if test x_$ldns_have_python != x_no; then
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fno-strict-aliasing" >&5
-$as_echo_n "checking whether $CC supports -fno-strict-aliasing... " >&6; }
-cache=`echo fno-strict-aliasing | sed 'y%.=/+-%___p_%'`
-if eval \${cv_prog_cc_flag_$cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-echo 'void f(){}' >conftest.c
-if test -z "`$CC $CPPFLAGS $CFLAGS -fno-strict-aliasing -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_$cache=yes"
-else
-eval "cv_prog_cc_flag_$cache=no"
-fi
-rm -f conftest conftest.o conftest.c
-
-fi
-
-if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-:
-PYTHON_X_CFLAGS="-fno-strict-aliasing"
-else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-:
-
-fi
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-missing-field-initializers" >&5
-$as_echo_n "checking whether $CC supports -Wno-missing-field-initializers... " >&6; }
-cache=`echo Wno-missing-field-initializers | sed 'y%.=/+-%___p_%'`
-if eval \${cv_prog_cc_flag_$cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-echo 'void f(){}' >conftest.c
-if test -z "`$CC $CPPFLAGS $CFLAGS -Wno-missing-field-initializers -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_$cache=yes"
-else
-eval "cv_prog_cc_flag_$cache=no"
-fi
-rm -f conftest conftest.o conftest.c
-
-fi
-
-if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-:
-PYTHON_X_CFLAGS="-Wno-missing-field-initializers $PYTHON_X_CFLAGS"
-else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-:
-
-fi
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-unused-parameter" >&5
-$as_echo_n "checking whether $CC supports -Wno-unused-parameter... " >&6; }
-cache=`echo Wno-unused-parameter | sed 'y%.=/+-%___p_%'`
-if eval \${cv_prog_cc_flag_$cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-echo 'void f(){}' >conftest.c
-if test -z "`$CC $CPPFLAGS $CFLAGS -Wno-unused-parameter -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_$cache=yes"
-else
-eval "cv_prog_cc_flag_$cache=no"
-fi
-rm -f conftest conftest.o conftest.c
-
-fi
-
-if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-:
-PYTHON_X_CFLAGS="-Wno-unused-parameter $PYTHON_X_CFLAGS"
-else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-:
-
-fi
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-unused-variable" >&5
-$as_echo_n "checking whether $CC supports -Wno-unused-variable... " >&6; }
-cache=`echo Wno-unused-variable | sed 'y%.=/+-%___p_%'`
-if eval \${cv_prog_cc_flag_$cache+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-echo 'void f(){}' >conftest.c
-if test -z "`$CC $CPPFLAGS $CFLAGS -Wno-unused-variable -c conftest.c 2>&1`"; then
-eval "cv_prog_cc_flag_$cache=yes"
-else
-eval "cv_prog_cc_flag_$cache=no"
-fi
-rm -f conftest conftest.o conftest.c
-
-fi
-
-if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-:
-PYTHON_X_CFLAGS="-Wno-unused-variable $PYTHON_X_CFLAGS"
-else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-:
-
-fi
-
-   fi
-fi
-
-
-# Check for pyldnsx
-
-# Check whether --with-pyldnsx was given.
-if test "${with_pyldnsx+set}" = set; then :
-  withval=$with_pyldnsx;
-else
-   withval="with_pyldns"
-fi
-
-if test x_$withval != x_no; then
-  if test x_$ldns_with_pyldns != x_no; then
-    PYLDNSX="pyldnsx"
-
-    ldns_with_pyldnsx=yes
-  else
-    if test x_$withval != x_with_pyldns; then
-      as_fn_error $? "--with-pyldns is needed for the ldnsx python module" "$LINENO" 5
-    fi
-  fi
-fi
-
-if test x_$ldns_with_pyldns != x_no; then
-  PYLDNSINST="install-pyldns"
-  PYLDNSUNINST="uninstall-pyldns"
-
-else
-  PYLDNSINST=""
-  PYLDNSUNINST=""
-
-fi
-if test x_$ldns_with_pyldnsx != x_no; then
-  PYLDNSXINST="install-pyldnsx"
-  PYLDNSXUNINST="uninstall-pyldnsx"
-
-else
-  PYLDNSXINST=""
-  PYLDNSXUNINST=""
-
-fi
-
-# Use libtool
-
-# skip these tests, we do not need them.
-
-
-
-
-
-
-
-
-# always use ./libtool unless override from commandline (libtool=mylibtool)
-if test -z "$libtool"; then
-	libtool="./libtool"
-fi
-
-# avoid libtool max commandline length test on systems that fork slowly.
-
-if echo "$host_os" | grep "sunos4" >/dev/null; then
-	lt_cv_sys_max_cmd_len=32750;
-fi
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ar; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_AR+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $AR in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_AR="$AR" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-AR=$ac_cv_path_AR
-if test -n "$AR"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
-$as_echo "$AR" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_path_AR"; then
-  ac_pt_AR=$AR
-  # Extract the first word of "ar", so it can be a program name with args.
-set dummy ar; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_ac_pt_AR+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $ac_pt_AR in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_ac_pt_AR="$ac_pt_AR" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_ac_pt_AR="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-ac_pt_AR=$ac_cv_path_ac_pt_AR
-if test -n "$ac_pt_AR"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_AR" >&5
-$as_echo "$ac_pt_AR" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_pt_AR" = x; then
-    AR="false"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    AR=$ac_pt_AR
-  fi
-else
-  AR="$ac_cv_path_AR"
-fi
-
-if test $AR = false; then
-	as_fn_error $? "Cannot find 'ar', please extend PATH to include it" "$LINENO" 5
-fi
-
-case `pwd` in
-  *\ * | *\	*)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
-$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
-esac
-
-
-
-macro_version='2.4.2'
-macro_revision='1.3337'
-
-
-
-
-
-
-
-
-
-
-
-
-
-ltmain="$ac_aux_dir/ltmain.sh"
-
 # Backslashify metacharacters that are still active within
 # double-quoted strings.
 sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
@@ -10276,8 +7107,6 @@ done
 
 
 
-
-
 # Set options
 
 
@@ -14296,6 +11125,3324 @@ CC="$lt_save_CC"
 
 
 
+OURCPPFLAGS=''
+CPPFLAGS=${CPPFLAGS:-${OURCPPFLAGS}}
+CFLAGS="$CFLAGS"
+
+# Checks for programs.
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+else
+  CFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  ac_c_werror_flag=$ac_save_c_werror_flag
+	 CFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include 
+#include 
+#include 
+#include 
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+  xno)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $CC dependency flag" >&5
+$as_echo_n "checking $CC dependency flag... " >&6; }
+echo 'void f(){}' >conftest.c
+if test "`$CC -MM conftest.c 2>&1`" = "conftest.o: conftest.c"; then
+	DEPFLAG="-MM"
+else
+  if test "`$CC -xM1 conftest.c 2>&1`" = "conftest.o: conftest.c"; then
+	DEPFLAG="-xM1"
+  else
+	DEPFLAG="-MM"  # dunno do something
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEPFLAG" >&5
+$as_echo "$DEPFLAG" >&6; }
+rm -f conftest.c
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+	@echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+  *@@@%%%=?*=@@@%%%*)
+    eval ac_cv_prog_make_${ac_make}_set=yes;;
+  *)
+    eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+  SET_MAKE=
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+
+# Extra (sp)lint flags for NetBSD
+
+case "$host_os" in
+	netbsd*) LINTFLAGS="'-D__RENAME(x)=' -D_NETINET_IN_H_ $LINTFLAGS"
+		 ;;
+	*)       LINTFLAGS="$LINTFLAGS"
+		 ;;
+esac
+
+
+
+$as_echo "#define WINVER 0x0502" >>confdefs.h
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -std=c99" >&5
+$as_echo_n "checking whether $CC supports -std=c99... " >&6; }
+cache=`echo std=c99 | sed 'y%.=/+-%___p_%'`
+if eval \${cv_prog_cc_flag_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo 'void f(void){}' >conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS -std=c99 -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_$cache=yes"
+else
+eval "cv_prog_cc_flag_$cache=no"
+fi
+rm -f conftest conftest.o conftest.c
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+C99FLAG="-std=c99"
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+:
+
+fi
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -xc99" >&5
+$as_echo_n "checking whether $CC supports -xc99... " >&6; }
+cache=`echo xc99 | sed 'y%.=/+-%___p_%'`
+if eval \${cv_prog_cc_flag_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo 'void f(void){}' >conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS -xc99 -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_$cache=yes"
+else
+eval "cv_prog_cc_flag_$cache=no"
+fi
+rm -f conftest conftest.o conftest.c
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+C99FLAG="-xc99"
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+:
+
+fi
+
+
+# routine to copy files
+# argument 1 is a list of files (relative to the source dir)
+# argument 2 is a destination directory (relative to the current
+# working directory
+
+
+# copy all .h files in the dir at argument 1
+# (relative to source) to the dir at argument 2
+# (relative to current dir)
+
+
+# Checks for typedefs, structures, and compiler characteristics.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
+$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
+if ${ac_cv_c_const+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+  /* Ultrix mips cc rejects this.  */
+  typedef int charset[2];
+  const charset cs;
+  /* SunOS 4.1.1 cc rejects this.  */
+  char const *const *pcpcc;
+  char **ppc;
+  /* NEC SVR4.0.2 mips cc rejects this.  */
+  struct point {int x, y;};
+  static struct point const zero = {0,0};
+  /* AIX XL C 1.02.0.0 rejects this.
+     It does not let you subtract one const X* pointer from another in
+     an arm of an if-expression whose if-part is not a constant
+     expression */
+  const char *g = "string";
+  pcpcc = &g + (g ? g-g : 0);
+  /* HPUX 7.0 cc rejects these. */
+  ++pcpcc;
+  ppc = (char**) pcpcc;
+  pcpcc = (char const *const *) ppc;
+  { /* SCO 3.2v4 cc rejects this.  */
+    char *t;
+    char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+    *t++ = 0;
+    if (s) return 0;
+  }
+  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+    int x[] = {25, 17};
+    const int *foo = &x[0];
+    ++foo;
+  }
+  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+    typedef const int *iptr;
+    iptr p = 0;
+    ++p;
+  }
+  { /* AIX XL C 1.02.0.0 rejects this saying
+       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+    struct s { int j; const int *ap[3]; };
+    struct s *b; b->j = 5;
+  }
+  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+    const int foo = 10;
+    if (!foo) return 0;
+  }
+  return !cs[0] && !zero.x;
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_const=yes
+else
+  ac_cv_c_const=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
+$as_echo "$ac_cv_c_const" >&6; }
+if test $ac_cv_c_const = no; then
+
+$as_echo "#define const /**/" >>confdefs.h
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+if test "x$CFLAGS" = "x" ; then
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -g" >&5
+$as_echo_n "checking whether $CC supports -g... " >&6; }
+cache=`echo g | sed 'y%.=/+-%___p_%'`
+if eval \${cv_prog_cc_flag_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo 'void f(void){}' >conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS -g -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_$cache=yes"
+else
+eval "cv_prog_cc_flag_$cache=no"
+fi
+rm -f conftest conftest.o conftest.c
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+CFLAGS="-g"
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+:
+
+fi
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -O2" >&5
+$as_echo_n "checking whether $CC supports -O2... " >&6; }
+cache=`echo O2 | sed 'y%.=/+-%___p_%'`
+if eval \${cv_prog_cc_flag_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo 'void f(void){}' >conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS -O2 -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_$cache=yes"
+else
+eval "cv_prog_cc_flag_$cache=no"
+fi
+rm -f conftest conftest.o conftest.c
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+CFLAGS="-O2 $CFLAGS"
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+:
+
+fi
+
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wall" >&5
+$as_echo_n "checking whether $CC supports -Wall... " >&6; }
+cache=`echo Wall | sed 'y%.=/+-%___p_%'`
+if eval \${cv_prog_cc_flag_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo 'void f(void){}' >conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS -Wall -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_$cache=yes"
+else
+eval "cv_prog_cc_flag_$cache=no"
+fi
+rm -f conftest conftest.o conftest.c
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+CFLAGS="-Wall $CFLAGS"
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+:
+
+fi
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -W" >&5
+$as_echo_n "checking whether $CC supports -W... " >&6; }
+cache=`echo W | sed 'y%.=/+-%___p_%'`
+if eval \${cv_prog_cc_flag_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo 'void f(void){}' >conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS -W -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_$cache=yes"
+else
+eval "cv_prog_cc_flag_$cache=no"
+fi
+rm -f conftest conftest.o conftest.c
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+CFLAGS="-W $CFLAGS"
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+:
+
+fi
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wwrite-strings" >&5
+$as_echo_n "checking whether $CC supports -Wwrite-strings... " >&6; }
+cache=`echo Wwrite-strings | sed 'y%.=/+-%___p_%'`
+if eval \${cv_prog_cc_flag_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo 'void f(void){}' >conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS -Wwrite-strings -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_$cache=yes"
+else
+eval "cv_prog_cc_flag_$cache=no"
+fi
+rm -f conftest conftest.o conftest.c
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+CFLAGS="-Wwrite-strings $CFLAGS"
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+:
+
+fi
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wstrict-prototypes" >&5
+$as_echo_n "checking whether $CC supports -Wstrict-prototypes... " >&6; }
+cache=`echo Wstrict-prototypes | sed 'y%.=/+-%___p_%'`
+if eval \${cv_prog_cc_flag_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo 'void f(void){}' >conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS -Wstrict-prototypes -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_$cache=yes"
+else
+eval "cv_prog_cc_flag_$cache=no"
+fi
+rm -f conftest conftest.o conftest.c
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+CFLAGS="-Wstrict-prototypes $CFLAGS"
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+:
+
+fi
+
+
+
+for ac_header in getopt.h time.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+# MinGW32 tests
+for ac_header in winsock2.h ws2tcpip.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+# end mingw32 tests
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Werror" >&5
+$as_echo_n "checking whether $CC supports -Werror... " >&6; }
+cache=`echo Werror | sed 'y%.=/+-%___p_%'`
+if eval \${cv_prog_cc_flag_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo 'void f(void){}' >conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS -Werror -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_$cache=yes"
+else
+eval "cv_prog_cc_flag_$cache=no"
+fi
+rm -f conftest conftest.o conftest.c
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+ERRFLAG="-Werror"
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+:
+ERRFLAG="-errwarn"
+fi
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wall" >&5
+$as_echo_n "checking whether $CC supports -Wall... " >&6; }
+cache=`echo Wall | sed 'y%.=/+-%___p_%'`
+if eval \${cv_prog_cc_flag_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo 'void f(void){}' >conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS -Wall -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_$cache=yes"
+else
+eval "cv_prog_cc_flag_$cache=no"
+fi
+rm -f conftest conftest.o conftest.c
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+ERRFLAG="$ERRFLAG -Wall"
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+:
+ERRFLAG="$ERRFLAG -errfmt"
+fi
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -std=c99" >&5
+$as_echo_n "checking whether $CC supports -std=c99... " >&6; }
+cache=`echo std=c99 | sed 'y%.=/+-%___p_%'`
+if eval \${cv_prog_cc_flag_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo 'void f(void){}' >conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS -std=c99 -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_$cache=yes"
+else
+eval "cv_prog_cc_flag_$cache=no"
+fi
+rm -f conftest conftest.o conftest.c
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+C99FLAG="-std=c99"
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+:
+
+fi
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -xc99" >&5
+$as_echo_n "checking whether $CC supports -xc99... " >&6; }
+cache=`echo xc99 | sed 'y%.=/+-%___p_%'`
+if eval \${cv_prog_cc_flag_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo 'void f(void){}' >conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS -xc99 -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_$cache=yes"
+else
+eval "cv_prog_cc_flag_$cache=no"
+fi
+rm -f conftest conftest.o conftest.c
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+C99FLAG="-xc99"
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+:
+
+fi
+
+
+for ac_header in getopt.h time.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE as a flag for $CC" >&5
+$as_echo_n "checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE as a flag for $CC... " >&6; }
+cache=`$as_echo "$C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE" | $as_tr_sh`
+if eval \${cv_prog_cc_flag_needed_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo '
+#include "confdefs.h"
+#include 
+#include 
+#include 
+#ifdef HAVE_TIME_H
+#include 
+#endif
+#include 
+#include 
+#ifdef HAVE_GETOPT_H
+#include 
+#endif
+
+int test() {
+	int a;
+	char **opts = NULL;
+	struct timeval tv;
+	char *t;
+	time_t time = 0;
+	char *buf = NULL;
+	const char* str = NULL;
+	struct msghdr msg;
+	msg.msg_control = 0;
+	t = ctime_r(&time, buf);
+	tv.tv_usec = 10;
+	srandom(32);
+	a = getopt(2, opts, "a");
+	a = isascii(32);
+	str = gai_strerror(0);
+	if(str && t && tv.tv_usec && msg.msg_control)
+		a = 0;
+	return a;
+}
+' > conftest.c
+echo 'void f(){}' >>conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_needed_$cache=no"
+else
+
+if test -z "`$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_needed_$cache=yes"
+else
+eval "cv_prog_cc_flag_needed_$cache=fail"
+#echo 'Test with flag fails too!'
+#cat conftest.c
+#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1"
+#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1`
+#exit 1
+fi
+
+fi
+rm -f conftest conftest.c conftest.o
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE"
+else
+if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+#echo 'Test with flag is no!'
+#cat conftest.c
+#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1"
+#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1`
+#exit 1
+:
+
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+:
+
+fi
+fi
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE as a flag for $CC" >&5
+$as_echo_n "checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE as a flag for $CC... " >&6; }
+cache=`$as_echo "$C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE" | $as_tr_sh`
+if eval \${cv_prog_cc_flag_needed_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo '
+#include "confdefs.h"
+#include 
+#include 
+#include 
+#ifdef HAVE_TIME_H
+#include 
+#endif
+#include 
+#include 
+#ifdef HAVE_GETOPT_H
+#include 
+#endif
+
+int test() {
+	int a;
+	char **opts = NULL;
+	struct timeval tv;
+	char *t;
+	time_t time = 0;
+	char *buf = NULL;
+	const char* str = NULL;
+	struct msghdr msg;
+	msg.msg_control = 0;
+	t = ctime_r(&time, buf);
+	tv.tv_usec = 10;
+	srandom(32);
+	a = getopt(2, opts, "a");
+	a = isascii(32);
+	str = gai_strerror(0);
+	if(str && t && tv.tv_usec && msg.msg_control)
+		a = 0;
+	return a;
+}
+' > conftest.c
+echo 'void f(){}' >>conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_needed_$cache=no"
+else
+
+if test -z "`$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_needed_$cache=yes"
+else
+eval "cv_prog_cc_flag_needed_$cache=fail"
+#echo 'Test with flag fails too!'
+#cat conftest.c
+#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1"
+#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1`
+#exit 1
+fi
+
+fi
+rm -f conftest conftest.c conftest.o
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE"
+else
+if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+#echo 'Test with flag is no!'
+#cat conftest.c
+#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1"
+#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1`
+#exit 1
+:
+
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+:
+
+fi
+fi
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need $C99FLAG as a flag for $CC" >&5
+$as_echo_n "checking whether we need $C99FLAG as a flag for $CC... " >&6; }
+cache=`$as_echo "$C99FLAG" | $as_tr_sh`
+if eval \${cv_prog_cc_flag_needed_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo '
+#include 
+#include 
+int test() {
+        int a = 0;
+        return a;
+}
+' > conftest.c
+echo 'void f(){}' >>conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_needed_$cache=no"
+else
+
+if test -z "`$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_needed_$cache=yes"
+else
+eval "cv_prog_cc_flag_needed_$cache=fail"
+#echo 'Test with flag fails too!'
+#cat conftest.c
+#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1"
+#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1`
+#exit 1
+fi
+
+fi
+rm -f conftest conftest.c conftest.o
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+CFLAGS="$CFLAGS $C99FLAG"
+else
+if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+#echo 'Test with flag is no!'
+#cat conftest.c
+#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1"
+#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1`
+#exit 1
+:
+
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+:
+
+fi
+fi
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -D_BSD_SOURCE as a flag for $CC" >&5
+$as_echo_n "checking whether we need -D_BSD_SOURCE as a flag for $CC... " >&6; }
+cache=_D_BSD_SOURCE
+if eval \${cv_prog_cc_flag_needed_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo '
+#include 
+
+int test() {
+        int a;
+        a = isascii(32);
+        return a;
+}
+' > conftest.c
+echo 'void f(){}' >>conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_needed_$cache=no"
+else
+
+if test -z "`$CC $CPPFLAGS $CFLAGS -D_BSD_SOURCE $ERRFLAG -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_needed_$cache=yes"
+else
+eval "cv_prog_cc_flag_needed_$cache=fail"
+#echo 'Test with flag fails too!'
+#cat conftest.c
+#echo "$CC $CPPFLAGS $CFLAGS -D_BSD_SOURCE $ERRFLAG -c conftest.c 2>&1"
+#echo `$CC $CPPFLAGS $CFLAGS -D_BSD_SOURCE $ERRFLAG -c conftest.c 2>&1`
+#exit 1
+fi
+
+fi
+rm -f conftest conftest.c conftest.o
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+CFLAGS="$CFLAGS -D_BSD_SOURCE"
+else
+if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+#echo 'Test with flag is no!'
+#cat conftest.c
+#echo "$CC $CPPFLAGS $CFLAGS -D_BSD_SOURCE $ERRFLAG -c conftest.c 2>&1"
+#echo `$CC $CPPFLAGS $CFLAGS -D_BSD_SOURCE $ERRFLAG -c conftest.c 2>&1`
+#exit 1
+:
+
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+:
+
+fi
+fi
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -D_GNU_SOURCE as a flag for $CC" >&5
+$as_echo_n "checking whether we need -D_GNU_SOURCE as a flag for $CC... " >&6; }
+cache=_D_GNU_SOURCE
+if eval \${cv_prog_cc_flag_needed_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo '
+#include 
+
+int test() {
+        struct in6_pktinfo inf;
+	int a = (int)sizeof(inf);
+        return a;
+}
+' > conftest.c
+echo 'void f(){}' >>conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_needed_$cache=no"
+else
+
+if test -z "`$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE $ERRFLAG -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_needed_$cache=yes"
+else
+eval "cv_prog_cc_flag_needed_$cache=fail"
+#echo 'Test with flag fails too!'
+#cat conftest.c
+#echo "$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE $ERRFLAG -c conftest.c 2>&1"
+#echo `$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE $ERRFLAG -c conftest.c 2>&1`
+#exit 1
+fi
+
+fi
+rm -f conftest conftest.c conftest.o
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+CFLAGS="$CFLAGS -D_GNU_SOURCE"
+else
+if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+#echo 'Test with flag is no!'
+#cat conftest.c
+#echo "$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE $ERRFLAG -c conftest.c 2>&1"
+#echo `$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE $ERRFLAG -c conftest.c 2>&1`
+#exit 1
+:
+
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+:
+
+fi
+fi
+
+
+# check again for GNU_SOURCE for setresgid. May fail if setresgid
+# is not available at all. -D_FRSRESGID is to make this check unique.
+# otherwise we would get the previous cached result.
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -D_GNU_SOURCE -D_FRSRESGID as a flag for $CC" >&5
+$as_echo_n "checking whether we need -D_GNU_SOURCE -D_FRSRESGID as a flag for $CC... " >&6; }
+cache=_D_GNU_SOURCE__D_FRSRESGID
+if eval \${cv_prog_cc_flag_needed_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo '
+#include 
+
+int test() {
+	int a = setresgid(0,0,0);
+	a = setresuid(0,0,0);
+        return a;
+}
+' > conftest.c
+echo 'void f(){}' >>conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_needed_$cache=no"
+else
+
+if test -z "`$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE -D_FRSRESGID $ERRFLAG -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_needed_$cache=yes"
+else
+eval "cv_prog_cc_flag_needed_$cache=fail"
+#echo 'Test with flag fails too!'
+#cat conftest.c
+#echo "$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE -D_FRSRESGID $ERRFLAG -c conftest.c 2>&1"
+#echo `$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE -D_FRSRESGID $ERRFLAG -c conftest.c 2>&1`
+#exit 1
+fi
+
+fi
+rm -f conftest conftest.c conftest.o
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+CFLAGS="$CFLAGS -D_GNU_SOURCE"
+else
+if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+#echo 'Test with flag is no!'
+#cat conftest.c
+#echo "$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE -D_FRSRESGID $ERRFLAG -c conftest.c 2>&1"
+#echo `$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE -D_FRSRESGID $ERRFLAG -c conftest.c 2>&1`
+#exit 1
+:
+
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+:
+
+fi
+fi
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -D_POSIX_C_SOURCE=200112 as a flag for $CC" >&5
+$as_echo_n "checking whether we need -D_POSIX_C_SOURCE=200112 as a flag for $CC... " >&6; }
+cache=`$as_echo "-D_POSIX_C_SOURCE=200112" | $as_tr_sh`
+if eval \${cv_prog_cc_flag_needed_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo '
+#include "confdefs.h"
+#ifdef HAVE_TIME_H
+#include 
+#endif
+#include 
+
+int test() {
+        int a = 0;
+        char *t;
+        time_t time = 0;
+        char *buf = NULL;
+	const char* str = NULL;
+        t = ctime_r(&time, buf);
+	str = gai_strerror(0);
+	if(t && str)
+		a = 0;
+        return a;
+}
+' > conftest.c
+echo 'void f(){}' >>conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_needed_$cache=no"
+else
+
+if test -z "`$CC $CPPFLAGS $CFLAGS -D_POSIX_C_SOURCE=200112 $ERRFLAG -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_needed_$cache=yes"
+else
+eval "cv_prog_cc_flag_needed_$cache=fail"
+#echo 'Test with flag fails too!'
+#cat conftest.c
+#echo "$CC $CPPFLAGS $CFLAGS -D_POSIX_C_SOURCE=200112 $ERRFLAG -c conftest.c 2>&1"
+#echo `$CC $CPPFLAGS $CFLAGS -D_POSIX_C_SOURCE=200112 $ERRFLAG -c conftest.c 2>&1`
+#exit 1
+fi
+
+fi
+rm -f conftest conftest.c conftest.o
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=200112"
+else
+if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+#echo 'Test with flag is no!'
+#cat conftest.c
+#echo "$CC $CPPFLAGS $CFLAGS -D_POSIX_C_SOURCE=200112 $ERRFLAG -c conftest.c 2>&1"
+#echo `$CC $CPPFLAGS $CFLAGS -D_POSIX_C_SOURCE=200112 $ERRFLAG -c conftest.c 2>&1`
+#exit 1
+:
+
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+:
+
+fi
+fi
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -D__EXTENSIONS__ as a flag for $CC" >&5
+$as_echo_n "checking whether we need -D__EXTENSIONS__ as a flag for $CC... " >&6; }
+cache=_D__EXTENSIONS__
+if eval \${cv_prog_cc_flag_needed_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo '
+#include "confdefs.h"
+#include 
+#include 
+#include 
+#ifdef HAVE_TIME_H
+#include 
+#endif
+#include 
+#ifdef HAVE_GETOPT_H
+#include 
+#endif
+
+int test() {
+        int a;
+        char **opts = NULL;
+        struct timeval tv;
+        tv.tv_usec = 10;
+        srandom(32);
+        a = getopt(2, opts, "a");
+        a = isascii(32);
+	if(tv.tv_usec)
+		a = 0;
+        return a;
+}
+' > conftest.c
+echo 'void f(){}' >>conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_needed_$cache=no"
+else
+
+if test -z "`$CC $CPPFLAGS $CFLAGS -D__EXTENSIONS__ $ERRFLAG -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_needed_$cache=yes"
+else
+eval "cv_prog_cc_flag_needed_$cache=fail"
+#echo 'Test with flag fails too!'
+#cat conftest.c
+#echo "$CC $CPPFLAGS $CFLAGS -D__EXTENSIONS__ $ERRFLAG -c conftest.c 2>&1"
+#echo `$CC $CPPFLAGS $CFLAGS -D__EXTENSIONS__ $ERRFLAG -c conftest.c 2>&1`
+#exit 1
+fi
+
+fi
+rm -f conftest conftest.c conftest.o
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+CFLAGS="$CFLAGS -D__EXTENSIONS__"
+else
+if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+#echo 'Test with flag is no!'
+#cat conftest.c
+#echo "$CC $CPPFLAGS $CFLAGS -D__EXTENSIONS__ $ERRFLAG -c conftest.c 2>&1"
+#echo `$CC $CPPFLAGS $CFLAGS -D__EXTENSIONS__ $ERRFLAG -c conftest.c 2>&1`
+#exit 1
+:
+
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+:
+
+fi
+fi
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
+$as_echo_n "checking for inline... " >&6; }
+if ${ac_cv_c_inline+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_inline=$ac_kw
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  test "$ac_cv_c_inline" != no && break
+done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
+$as_echo "$ac_cv_c_inline" >&6; }
+
+case $ac_cv_c_inline in
+  inline | yes) ;;
+  *)
+    case $ac_cv_c_inline in
+      no) ac_val=;;
+      *) ac_val=$ac_cv_c_inline;;
+    esac
+    cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+    ;;
+esac
+
+ac_fn_c_check_type "$LINENO" "int8_t" "ac_cv_type_int8_t" "$ac_includes_default"
+if test "x$ac_cv_type_int8_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define int8_t char
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "int16_t" "ac_cv_type_int16_t" "$ac_includes_default"
+if test "x$ac_cv_type_int16_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define int16_t short
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "int32_t" "ac_cv_type_int32_t" "$ac_includes_default"
+if test "x$ac_cv_type_int32_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define int32_t int
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "int64_t" "ac_cv_type_int64_t" "$ac_includes_default"
+if test "x$ac_cv_type_int64_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define int64_t long long
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "uint8_t" "ac_cv_type_uint8_t" "$ac_includes_default"
+if test "x$ac_cv_type_uint8_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define uint8_t unsigned char
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "uint16_t" "ac_cv_type_uint16_t" "$ac_includes_default"
+if test "x$ac_cv_type_uint16_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define uint16_t unsigned short
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "$ac_includes_default"
+if test "x$ac_cv_type_uint32_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define uint32_t unsigned int
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "$ac_includes_default"
+if test "x$ac_cv_type_uint64_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define uint64_t unsigned long long
+_ACEOF
+
+fi
+
+
+# my own checks
+# Extract the first word of "doxygen", so it can be a program name with args.
+set dummy doxygen; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_doxygen+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$doxygen"; then
+  ac_cv_prog_doxygen="$doxygen" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_doxygen="doxygen"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+doxygen=$ac_cv_prog_doxygen
+if test -n "$doxygen"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $doxygen" >&5
+$as_echo "$doxygen" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+# check to see if libraries are needed for these functions.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5
+$as_echo_n "checking for library containing socket... " >&6; }
+if ${ac_cv_search_socket+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char socket ();
+int
+main ()
+{
+return socket ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' socket; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_socket=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_socket+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_socket+:} false; then :
+
+else
+  ac_cv_search_socket=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5
+$as_echo "$ac_cv_search_socket" >&6; }
+ac_res=$ac_cv_search_socket
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_pton" >&5
+$as_echo_n "checking for library containing inet_pton... " >&6; }
+if ${ac_cv_search_inet_pton+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char inet_pton ();
+int
+main ()
+{
+return inet_pton ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' nsl; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_inet_pton=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_inet_pton+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_inet_pton+:} false; then :
+
+else
+  ac_cv_search_inet_pton=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inet_pton" >&5
+$as_echo "$ac_cv_search_inet_pton" >&6; }
+ac_res=$ac_cv_search_inet_pton
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+
+
+
+# Check whether --with-drill was given.
+if test "${with_drill+set}" = set; then :
+  withval=$with_drill;
+else
+  with_drill="no"
+fi
+
+if test x_$with_drill != x_no ; then
+	DRILL=drill
+
+	INSTALL_DRILL=install-drill
+
+	UNINSTALL_DRILL=uninstall-drill
+
+	CLEAN_DRILL=clean-drill
+
+	LINT_DRILL=lint-drill
+
+	if test -e $srcdir/drill/config.h -o -e drill/config.h ; then
+		as_fn_error $? "
+A config.h was detected in the drill subdirectory.
+This does not work with the --with-drill option.
+Please remove the config.h from the drill subdirectory
+or do not use the --with-drill option." "$LINENO" 5
+	fi
+	DRILL_CONFIG=" drill/drill.1"
+else
+	DRILL=""
+
+	INSTALL_DRILL=""
+
+	UNINSTALL_DRILL=""
+
+	CLEAN_DRILL=""
+
+	LINT_DRILL=""
+
+	DRILL_CONFIG=""
+fi
+
+
+
+# Check whether --with-examples was given.
+if test "${with_examples+set}" = set; then :
+  withval=$with_examples;
+else
+  with_examples="no"
+fi
+
+if test x_$with_examples != x_no ; then
+	EXAMPLES=examples
+
+	INSTALL_EXAMPLES=install-examples
+
+	UNINSTALL_EXAMPLES=uninstall-examples
+
+	CLEAN_EXAMPLES=clean-examples
+
+	LINT_EXAMPLES=lint-examples
+
+	if test -e $srcdir/examples/config.h -o -e examples/config.h ; then
+		as_fn_error $? "
+A config.h was detected in the examples subdirectory.
+This does not work with the --with-examples option.
+Please remove the config.h from the examples subdirectory
+or do not use the --with-examples option." "$LINENO" 5
+	fi
+	EXAMPLES_CONFIG=" examples/ldns-dane.1 examples/ldns-verify-zone.1"
+else
+	EXAMPLES=""
+
+	INSTALL_EXAMPLES=""
+
+	UNINSTALL_EXAMPLES=""
+
+	CLEAN_EXAMPLES=""
+
+	LINT_EXAMPLES=""
+
+	EXAMPLES_CONFIG=""
+fi
+
+# add option to disable installation of ldns-config script
+# Check whether --enable-ldns-config was given.
+if test "${enable_ldns_config+set}" = set; then :
+  enableval=$enable_ldns_config; enable_ldns_config=$enableval
+else
+  enable_ldns_config=yes
+fi
+
+if test "x$enable_ldns_config" = xyes; then
+	INSTALL_CONFIG=install-config
+
+	INSTALL_CONFIG_MANPAGE=install-config-manpage
+
+	UNINSTALL_CONFIG=uninstall-config
+
+	UNINSTALL_CONFIG_MANPAGE=uninstall-config-manpage
+
+else
+	INSTALL_CONFIG=""
+
+	INSTALL_CONFIG_MANPAGE=""
+
+	UNINSTALL_CONFIG=""
+
+	UNINSTALL_CONFIG_MANPAGE=""
+
+fi
+
+# add option to disable library printing to stderr
+# Check whether --enable-stderr-msgs was given.
+if test "${enable_stderr_msgs+set}" = set; then :
+  enableval=$enable_stderr_msgs; enable_stderr_msgs=$enableval
+else
+  enable_stderr_msgs=no
+fi
+
+case "$enable_stderr_msgs" in
+    no)         ;;
+    *)
+
+cat >>confdefs.h <<_ACEOF
+#define STDERR_MSGS 1
+_ACEOF
+
+        ;;
+esac
+
+# check for python
+PYTHON_X_CFLAGS=""
+ldns_with_pyldns=no
+ldns_with_pyldnsx=no
+
+# Check whether --with-pyldns was given.
+if test "${with_pyldns+set}" = set; then :
+  withval=$with_pyldns;
+else
+   withval="no"
+fi
+
+ldns_have_python=no
+if test x_$withval != x_no; then
+   # ===========================================================================
+#      http://www.gnu.org/software/autoconf-archive/ax_python_devel.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_PYTHON_DEVEL([version])
+#
+# DESCRIPTION
+#
+#   Note: Defines as a precious variable "PYTHON_VERSION". Don't override it
+#   in your configure.ac.
+#
+#   This macro checks for Python and tries to get the include path to
+#   'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS)
+#   output variables. It also exports $(PYTHON_EXTRA_LIBS) and
+#   $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code.
+#
+#   You can search for some particular version of Python by passing a
+#   parameter to this macro, for example ">= '2.3.1'", or "== '2.4'". Please
+#   note that you *have* to pass also an operator along with the version to
+#   match, and pay special attention to the single quotes surrounding the
+#   version number. Don't use "PYTHON_VERSION" for this: that environment
+#   variable is declared as precious and thus reserved for the end-user.
+#
+#   This macro should work for all versions of Python >= 2.1.0. As an end
+#   user, you can disable the check for the python version by setting the
+#   PYTHON_NOVERSIONCHECK environment variable to something else than the
+#   empty string.
+#
+#   If you need to use this macro for an older Python version, please
+#   contact the authors. We're always open for feedback.
+#
+# LICENSE
+#
+#   Copyright (c) 2009 Sebastian Huber 
+#   Copyright (c) 2009 Alan W. Irwin
+#   Copyright (c) 2009 Rafael Laboissiere 
+#   Copyright (c) 2009 Andrew Collier
+#   Copyright (c) 2009 Matteo Settenvini 
+#   Copyright (c) 2009 Horst Knorr 
+#   Copyright (c) 2013 Daniel Mullner 
+#
+#   This program 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 3 of the License, or (at your
+#   option) any later version.
+#
+#   This program 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 this program. If not, see .
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
+
+#serial 16
+
+# This is what autoupdate's m4 run will expand.  It fires
+# the warning (with _au_warn_XXX), outputs it into the
+# updated configure.ac (with AC_DIAGNOSE), and then outputs
+# the replacement expansion.
+
+
+# This is an auxiliary macro that is also run when
+# autoupdate runs m4.  It simply calls m4_warning, but
+# we need a wrapper so that each warning is emitted only
+# once.  We break the quoting in m4_warning's argument in
+# order to expand this macro's arguments, not AU_DEFUN's.
+
+
+# Finally, this is the expansion that is picked up by
+# autoconf.  It tells the user to run autoupdate, and
+# then outputs the replacement expansion.  We do not care
+# about autoupdate's warning because that contains
+# information on what to do *after* running autoupdate.
+
+
+
+   ac_save_LIBS="$LIBS"
+
+	#
+	# Allow the use of a (user set) custom python version
+	#
+
+
+	# Extract the first word of "python[$PYTHON_VERSION]", so it can be a program name with args.
+set dummy python$PYTHON_VERSION; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PYTHON+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PYTHON in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+PYTHON=$ac_cv_path_PYTHON
+if test -n "$PYTHON"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5
+$as_echo "$PYTHON" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+	if test -z "$PYTHON"; then
+	   as_fn_error $? "Cannot find python$PYTHON_VERSION in your system path" "$LINENO" 5
+	   PYTHON_VERSION=""
+	fi
+
+	#
+	# Check for a version of Python >= 2.1.0
+	#
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a version of Python >= '2.1.0'" >&5
+$as_echo_n "checking for a version of Python >= '2.1.0'... " >&6; }
+	ac_supports_python_ver=`$PYTHON -c "import sys; \
+		ver = sys.version.split ()[0]; \
+		print (ver >= '2.1.0')"`
+	if test "$ac_supports_python_ver" != "True"; then
+		if test -z "$PYTHON_NOVERSIONCHECK"; then
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+			{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "
+This version of the AC_PYTHON_DEVEL macro
+doesn't work properly with versions of Python before
+2.1.0. You may need to re-run configure, setting the
+variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG,
+PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
+Moreover, to disable this check, set PYTHON_NOVERSIONCHECK
+to something else than an empty string.
+
+See \`config.log' for more details" "$LINENO" 5; }
+		else
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: skip at user request" >&5
+$as_echo "skip at user request" >&6; }
+		fi
+	else
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	fi
+
+	#
+	# if the macro parameter ``version'' is set, honour it
+	#
+	if test -n ">= '2.4.0'"; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a version of Python >= '2.4.0'" >&5
+$as_echo_n "checking for a version of Python >= '2.4.0'... " >&6; }
+		ac_supports_python_ver=`$PYTHON -c "import sys; \
+			ver = sys.version.split ()[0]; \
+			print (ver >= '2.4.0')"`
+		if test "$ac_supports_python_ver" = "True"; then
+		   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+		else
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+			as_fn_error $? "this package requires Python >= '2.4.0'.
+If you have it installed, but it isn't the default Python
+interpreter in your system path, please pass the PYTHON_VERSION
+variable to configure. See \`\`configure --help'' for reference.
+" "$LINENO" 5
+			PYTHON_VERSION=""
+		fi
+	fi
+
+	#
+	# Check if you have distutils, else fail
+	#
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the distutils Python package" >&5
+$as_echo_n "checking for the distutils Python package... " >&6; }
+	ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
+	if test -z "$ac_distutils_result"; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	else
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+		as_fn_error $? "cannot import Python module \"distutils\".
+Please check your Python installation. The error was:
+$ac_distutils_result" "$LINENO" 5
+		PYTHON_VERSION=""
+	fi
+
+	#
+	# Check for Python include path
+	#
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python include path" >&5
+$as_echo_n "checking for Python include path... " >&6; }
+	if test -z "$PYTHON_CPPFLAGS"; then
+		python_path=`$PYTHON -c "import distutils.sysconfig; \
+			print (distutils.sysconfig.get_python_inc ());"`
+		plat_python_path=`$PYTHON -c "import distutils.sysconfig; \
+			print (distutils.sysconfig.get_python_inc (plat_specific=1));"`
+		if test -n "${python_path}"; then
+			if test "${plat_python_path}" != "${python_path}"; then
+				python_path="-I$python_path -I$plat_python_path"
+			else
+				python_path="-I$python_path"
+			fi
+		fi
+		PYTHON_CPPFLAGS=$python_path
+	fi
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_CPPFLAGS" >&5
+$as_echo "$PYTHON_CPPFLAGS" >&6; }
+
+
+	#
+	# Check for Python library path
+	#
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python library path" >&5
+$as_echo_n "checking for Python library path... " >&6; }
+	if test -z "$PYTHON_LDFLAGS"; then
+		# (makes two attempts to ensure we've got a version number
+		# from the interpreter)
+		ac_python_version=`cat<>confdefs.h <<_ACEOF
+#define HAVE_PYTHON "$ac_python_version"
+_ACEOF
+
+
+		# First, the library directory:
+		ac_python_libdir=`cat<&5
+$as_echo "$PYTHON_LDFLAGS" >&6; }
+
+
+	#
+	# Check for site packages
+	#
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python site-packages path" >&5
+$as_echo_n "checking for Python site-packages path... " >&6; }
+	if test -z "$PYTHON_SITE_PKG"; then
+		PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
+			print (distutils.sysconfig.get_python_lib(1,0));"`
+	fi
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_SITE_PKG" >&5
+$as_echo "$PYTHON_SITE_PKG" >&6; }
+
+
+	#
+	# libraries which must be linked in when embedding
+	#
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra libraries" >&5
+$as_echo_n "checking python extra libraries... " >&6; }
+	if test -z "$PYTHON_EXTRA_LIBS"; then
+	   PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
+                conf = distutils.sysconfig.get_config_var; \
+                print (conf('LIBS'))"`
+	fi
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LIBS" >&5
+$as_echo "$PYTHON_EXTRA_LIBS" >&6; }
+
+
+	#
+	# linking flags needed when embedding
+	#
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra linking flags" >&5
+$as_echo_n "checking python extra linking flags... " >&6; }
+	if test -z "$PYTHON_EXTRA_LDFLAGS"; then
+		PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
+			conf = distutils.sysconfig.get_config_var; \
+			print (conf('LINKFORSHARED'))"`
+	fi
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LDFLAGS" >&5
+$as_echo "$PYTHON_EXTRA_LDFLAGS" >&6; }
+
+
+	#
+	# final check to see if everything compiles alright
+	#
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking consistency of all components of python development environment" >&5
+$as_echo_n "checking consistency of all components of python development environment... " >&6; }
+	# save current global flags
+	ac_save_LIBS="$LIBS"
+	ac_save_CPPFLAGS="$CPPFLAGS"
+	LIBS="$ac_save_LIBS $PYTHON_LDFLAGS $PYTHON_EXTRA_LDFLAGS $PYTHON_EXTRA_LIBS"
+	CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
+	ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+		#include 
+int
+main ()
+{
+Py_Initialize();
+  ;
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  pythonexists=yes
+else
+  pythonexists=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+	ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+	# turn back to default flags
+	CPPFLAGS="$ac_save_CPPFLAGS"
+	LIBS="$ac_save_LIBS"
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pythonexists" >&5
+$as_echo "$pythonexists" >&6; }
+
+        if test ! "x$pythonexists" = "xyes"; then
+	   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "
+  Could not link test program to Python. Maybe the main Python library has been
+  installed in some non-standard library path. If so, pass it to configure,
+  via the LDFLAGS environment variable.
+  Example: ./configure LDFLAGS=\"-L/usr/non-standard-path/python/lib\"
+  ============================================================================
+   ERROR!
+   You probably have to install the development version of the Python package
+   for your distribution.  The exact name of this package varies among them.
+  ============================================================================
+
+See \`config.log' for more details" "$LINENO" 5; }
+	  PYTHON_VERSION=""
+	fi
+
+	#
+	# all done!
+	#
+
+   if test ! -z "$ac_python_version"; then
+	ldns_have_python=yes
+   fi
+
+   # pass additional Python 3 option to SWIG
+   if test `$PYTHON -c "import sys; \
+       ver = sys.version.split()[0]; \
+       print(ver >= '3')"` = "True"; then
+       SWIGPY3="-py3 -DPY3"
+
+   fi
+
+   # check for SWIG
+   if test x_$ldns_have_python != x_no; then
+        # ===========================================================================
+#        http://www.gnu.org/software/autoconf-archive/ax_pkg_swig.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_PKG_SWIG([major.minor.micro], [action-if-found], [action-if-not-found])
+#
+# DESCRIPTION
+#
+#   This macro searches for a SWIG installation on your system. If found,
+#   then SWIG is AC_SUBST'd; if not found, then $SWIG is empty.  If SWIG is
+#   found, then SWIG_LIB is set to the SWIG library path, and AC_SUBST'd.
+#
+#   You can use the optional first argument to check if the version of the
+#   available SWIG is greater than or equal to the value of the argument. It
+#   should have the format: N[.N[.N]] (N is a number between 0 and 999. Only
+#   the first N is mandatory.) If the version argument is given (e.g.
+#   1.3.17), AX_PKG_SWIG checks that the swig package is this version number
+#   or higher.
+#
+#   As usual, action-if-found is executed if SWIG is found, otherwise
+#   action-if-not-found is executed.
+#
+#   In configure.in, use as:
+#
+#     AX_PKG_SWIG(1.3.17, [], [ AC_MSG_ERROR([SWIG is required to build..]) ])
+#     AX_SWIG_ENABLE_CXX
+#     AX_SWIG_MULTI_MODULE_SUPPORT
+#     AX_SWIG_PYTHON
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Sebastian Huber 
+#   Copyright (c) 2008 Alan W. Irwin 
+#   Copyright (c) 2008 Rafael Laboissiere 
+#   Copyright (c) 2008 Andrew Collier 
+#   Copyright (c) 2011 Murray Cumming 
+#
+#   This program 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 of the License, or (at your
+#   option) any later version.
+#
+#   This program 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 this program. If not, see .
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
+
+#serial 8
+
+
+
+
+        # check for >=SWIG-2.0.4 if Python 3.2 used
+        if test `$PYTHON -c "import sys; \
+            ver = sys.version.split()[0]; \
+            print(ver >= '3.2')"` = "True"; then
+
+        # Ubuntu has swig 2.0 as /usr/bin/swig2.0
+        for ac_prog in swig2.0 swig
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_SWIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $SWIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_SWIG="$SWIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_SWIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+SWIG=$ac_cv_path_SWIG
+if test -n "$SWIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG" >&5
+$as_echo "$SWIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$SWIG" && break
+done
+
+        if test -z "$SWIG" ; then
+                as_fn_error $? "SWIG-2.0.4 is required to build pyldns for Python 3.2 and greater." "$LINENO" 5
+        elif test -n "2.0.4" ; then
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking SWIG version" >&5
+$as_echo_n "checking SWIG version... " >&6; }
+                swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`
+                { $as_echo "$as_me:${as_lineno-$LINENO}: result: $swig_version" >&5
+$as_echo "$swig_version" >&6; }
+                if test -n "$swig_version" ; then
+                        # Calculate the required version number components
+                        required=2.0.4
+                        required_major=`echo $required | sed 's/[^0-9].*//'`
+                        if test -z "$required_major" ; then
+                                required_major=0
+                        fi
+                        required=`echo $required | sed 's/[0-9]*[^0-9]//'`
+                        required_minor=`echo $required | sed 's/[^0-9].*//'`
+                        if test -z "$required_minor" ; then
+                                required_minor=0
+                        fi
+                        required=`echo $required | sed 's/[0-9]*[^0-9]//'`
+                        required_patch=`echo $required | sed 's/[^0-9].*//'`
+                        if test -z "$required_patch" ; then
+                                required_patch=0
+                        fi
+                        # Calculate the available version number components
+                        available=$swig_version
+                        available_major=`echo $available | sed 's/[^0-9].*//'`
+                        if test -z "$available_major" ; then
+                                available_major=0
+                        fi
+                        available=`echo $available | sed 's/[0-9]*[^0-9]//'`
+                        available_minor=`echo $available | sed 's/[^0-9].*//'`
+                        if test -z "$available_minor" ; then
+                                available_minor=0
+                        fi
+                        available=`echo $available | sed 's/[0-9]*[^0-9]//'`
+                        available_patch=`echo $available | sed 's/[^0-9].*//'`
+                        if test -z "$available_patch" ; then
+                                available_patch=0
+                        fi
+                        # Convert the version tuple into a single number for easier comparison.
+                        # Using base 100 should be safe since SWIG internally uses BCD values
+                        # to encode its version number.
+                        required_swig_vernum=`expr $required_major \* 10000 \
+                            \+ $required_minor \* 100 \+ $required_patch`
+                        available_swig_vernum=`expr $available_major \* 10000 \
+                            \+ $available_minor \* 100 \+ $available_patch`
+
+                        if test $available_swig_vernum -lt $required_swig_vernum; then
+                                { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: SWIG version >= 2.0.4 is required.  You have $swig_version." >&5
+$as_echo "$as_me: WARNING: SWIG version >= 2.0.4 is required.  You have $swig_version." >&2;}
+                                SWIG=''
+                                as_fn_error $? "SWIG-2.0.4 is required to build pyldns for Python 3.2 and greater." "$LINENO" 5
+                        else
+                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SWIG library" >&5
+$as_echo_n "checking for SWIG library... " >&6; }
+                                SWIG_LIB=`$SWIG -swiglib`
+                                { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG_LIB" >&5
+$as_echo "$SWIG_LIB" >&6; }
+
+                        fi
+                else
+                        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot determine SWIG version" >&5
+$as_echo "$as_me: WARNING: cannot determine SWIG version" >&2;}
+                        SWIG=''
+                        as_fn_error $? "SWIG-2.0.4 is required to build pyldns for Python 3.2 and greater." "$LINENO" 5
+                fi
+        fi
+
+
+        else
+
+        # Ubuntu has swig 2.0 as /usr/bin/swig2.0
+        for ac_prog in swig2.0 swig
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_SWIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $SWIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_SWIG="$SWIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_SWIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+SWIG=$ac_cv_path_SWIG
+if test -n "$SWIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG" >&5
+$as_echo "$SWIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$SWIG" && break
+done
+
+        if test -z "$SWIG" ; then
+                :
+        elif test -n "" ; then
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking SWIG version" >&5
+$as_echo_n "checking SWIG version... " >&6; }
+                swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`
+                { $as_echo "$as_me:${as_lineno-$LINENO}: result: $swig_version" >&5
+$as_echo "$swig_version" >&6; }
+                if test -n "$swig_version" ; then
+                        # Calculate the required version number components
+                        required=
+                        required_major=`echo $required | sed 's/[^0-9].*//'`
+                        if test -z "$required_major" ; then
+                                required_major=0
+                        fi
+                        required=`echo $required | sed 's/[0-9]*[^0-9]//'`
+                        required_minor=`echo $required | sed 's/[^0-9].*//'`
+                        if test -z "$required_minor" ; then
+                                required_minor=0
+                        fi
+                        required=`echo $required | sed 's/[0-9]*[^0-9]//'`
+                        required_patch=`echo $required | sed 's/[^0-9].*//'`
+                        if test -z "$required_patch" ; then
+                                required_patch=0
+                        fi
+                        # Calculate the available version number components
+                        available=$swig_version
+                        available_major=`echo $available | sed 's/[^0-9].*//'`
+                        if test -z "$available_major" ; then
+                                available_major=0
+                        fi
+                        available=`echo $available | sed 's/[0-9]*[^0-9]//'`
+                        available_minor=`echo $available | sed 's/[^0-9].*//'`
+                        if test -z "$available_minor" ; then
+                                available_minor=0
+                        fi
+                        available=`echo $available | sed 's/[0-9]*[^0-9]//'`
+                        available_patch=`echo $available | sed 's/[^0-9].*//'`
+                        if test -z "$available_patch" ; then
+                                available_patch=0
+                        fi
+                        # Convert the version tuple into a single number for easier comparison.
+                        # Using base 100 should be safe since SWIG internally uses BCD values
+                        # to encode its version number.
+                        required_swig_vernum=`expr $required_major \* 10000 \
+                            \+ $required_minor \* 100 \+ $required_patch`
+                        available_swig_vernum=`expr $available_major \* 10000 \
+                            \+ $available_minor \* 100 \+ $available_patch`
+
+                        if test $available_swig_vernum -lt $required_swig_vernum; then
+                                { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: SWIG version >=  is required.  You have $swig_version." >&5
+$as_echo "$as_me: WARNING: SWIG version >=  is required.  You have $swig_version." >&2;}
+                                SWIG=''
+
+                        else
+                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SWIG library" >&5
+$as_echo_n "checking for SWIG library... " >&6; }
+                                SWIG_LIB=`$SWIG -swiglib`
+                                { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG_LIB" >&5
+$as_echo "$SWIG_LIB" >&6; }
+
+                        fi
+                else
+                        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot determine SWIG version" >&5
+$as_echo "$as_me: WARNING: cannot determine SWIG version" >&2;}
+                        SWIG=''
+
+                fi
+        fi
+
+
+        fi
+
+	if test ! -x "$SWIG"; then
+		as_fn_error $? "failed to find SWIG tool, install it, or do not build pyldns" "$LINENO" 5
+	else
+
+$as_echo "#define HAVE_SWIG 1" >>confdefs.h
+
+		PYLDNS="pyldns"
+
+		swig="$SWIG"
+
+		ldns_with_pyldns=yes
+	fi
+   else
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: *** don't have Python, skipping SWIG, no pyldns ***" >&5
+$as_echo "*** don't have Python, skipping SWIG, no pyldns ***" >&6; } # '
+   fi
+
+   # xtra cflags for pyldns
+   if test x_$ldns_have_python != x_no; then
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fno-strict-aliasing" >&5
+$as_echo_n "checking whether $CC supports -fno-strict-aliasing... " >&6; }
+cache=`echo fno-strict-aliasing | sed 'y%.=/+-%___p_%'`
+if eval \${cv_prog_cc_flag_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo 'void f(void){}' >conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS -fno-strict-aliasing -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_$cache=yes"
+else
+eval "cv_prog_cc_flag_$cache=no"
+fi
+rm -f conftest conftest.o conftest.c
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+PYTHON_X_CFLAGS="-fno-strict-aliasing"
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+:
+
+fi
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-missing-field-initializers" >&5
+$as_echo_n "checking whether $CC supports -Wno-missing-field-initializers... " >&6; }
+cache=`echo Wno-missing-field-initializers | sed 'y%.=/+-%___p_%'`
+if eval \${cv_prog_cc_flag_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo 'void f(void){}' >conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS -Wno-missing-field-initializers -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_$cache=yes"
+else
+eval "cv_prog_cc_flag_$cache=no"
+fi
+rm -f conftest conftest.o conftest.c
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+PYTHON_X_CFLAGS="-Wno-missing-field-initializers $PYTHON_X_CFLAGS"
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+:
+
+fi
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-unused-parameter" >&5
+$as_echo_n "checking whether $CC supports -Wno-unused-parameter... " >&6; }
+cache=`echo Wno-unused-parameter | sed 'y%.=/+-%___p_%'`
+if eval \${cv_prog_cc_flag_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo 'void f(void){}' >conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS -Wno-unused-parameter -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_$cache=yes"
+else
+eval "cv_prog_cc_flag_$cache=no"
+fi
+rm -f conftest conftest.o conftest.c
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+PYTHON_X_CFLAGS="-Wno-unused-parameter $PYTHON_X_CFLAGS"
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+:
+
+fi
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-unused-variable" >&5
+$as_echo_n "checking whether $CC supports -Wno-unused-variable... " >&6; }
+cache=`echo Wno-unused-variable | sed 'y%.=/+-%___p_%'`
+if eval \${cv_prog_cc_flag_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo 'void f(void){}' >conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS -Wno-unused-variable -c conftest.c 2>&1`"; then
+eval "cv_prog_cc_flag_$cache=yes"
+else
+eval "cv_prog_cc_flag_$cache=no"
+fi
+rm -f conftest conftest.o conftest.c
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+PYTHON_X_CFLAGS="-Wno-unused-variable $PYTHON_X_CFLAGS"
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+:
+
+fi
+
+   fi
+fi
+
+
+# Check for pyldnsx
+
+# Check whether --with-pyldnsx was given.
+if test "${with_pyldnsx+set}" = set; then :
+  withval=$with_pyldnsx;
+else
+   withval="with_pyldns"
+fi
+
+if test x_$withval != x_no; then
+  if test x_$ldns_with_pyldns != x_no; then
+    PYLDNSX="pyldnsx"
+
+    ldns_with_pyldnsx=yes
+  else
+    if test x_$withval != x_with_pyldns; then
+      as_fn_error $? "--with-pyldns is needed for the ldnsx python module" "$LINENO" 5
+    fi
+  fi
+fi
+
+if test x_$ldns_with_pyldns != x_no; then
+  PYLDNSINST="install-pyldns"
+  PYLDNSUNINST="uninstall-pyldns"
+
+else
+  PYLDNSINST=""
+  PYLDNSUNINST=""
+
+fi
+if test x_$ldns_with_pyldnsx != x_no; then
+  PYLDNSXINST="install-pyldnsx"
+  PYLDNSXUNINST="uninstall-pyldnsx"
+
+else
+  PYLDNSXINST=""
+  PYLDNSXUNINST=""
+
+fi
+
+# check for perl
+ldns_with_p5_dns_ldns=no
+
+# Check whether --with-p5-dns-ldns was given.
+if test "${with_p5_dns_ldns+set}" = set; then :
+  withval=$with_p5_dns_ldns;
+else
+   withval="no"
+fi
+
+ldns_have_perl=no
+if test x_$withval != x_no; then
+   # Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PERL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PERL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PERL="$PERL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+PERL=$ac_cv_path_PERL
+if test -n "$PERL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5
+$as_echo "$PERL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+   if test -z "$PERL"; then
+      as_fn_error $? "Cannot find perl in your system path" "$LINENO" 5
+   fi
+   P5_DNS_LDNS="p5-dns-ldns"
+   TEST_P5_DNS_LDNS="test-p5-dns-ldns"
+   INSTALL_P5_DNS_LDNS="install-p5-dns-ldns"
+   UNINSTALL_P5_DNS_LDNS="uninstall-p5-dns-ldns"
+   CLEAN_P5_DNS_LDNS="clean-p5-dns-ldns"
+
+else
+   P5_DNS_LDNS=""
+   TEST_P5_DNS_LDNS=""
+   INSTALL_P5_DNS_LDNS=""
+   UNINSTALL_P5_DNS_LDNS=""
+   CLEAN_P5_DNS_LDNS=""
+
+fi
+
+# Use libtool
+
+# skip these tests, we do not need them.
+
+
+
+
+
+
+
+
+# always use ./libtool unless override from commandline (libtool=mylibtool)
+if test -z "$libtool"; then
+	libtool="./libtool"
+fi
+
+# avoid libtool max commandline length test on systems that fork slowly.
+
+if echo "$host_os" | grep "sunos4" >/dev/null; then
+	lt_cv_sys_max_cmd_len=32750;
+fi
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_AR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $AR in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_AR="$AR" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+AR=$ac_cv_path_AR
+if test -n "$AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_AR"; then
+  ac_pt_AR=$AR
+  # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_AR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ac_pt_AR in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_AR="$ac_pt_AR" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_AR="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_AR=$ac_cv_path_ac_pt_AR
+if test -n "$ac_pt_AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_AR" >&5
+$as_echo "$ac_pt_AR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_pt_AR" = x; then
+    AR="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    AR=$ac_pt_AR
+  fi
+else
+  AR="$ac_cv_path_AR"
+fi
+
+if test $AR = false; then
+	as_fn_error $? "Cannot find 'ar', please extend PATH to include it" "$LINENO" 5
+fi
+
+
+
+
+
+
 tmp_CPPFLAGS=$CPPFLAGS
 tmp_LDFLAGS=$LDFLAGS
 tmp_LIBS=$LIBS
@@ -14723,11 +14870,122 @@ _ACEOF
       ;;
 esac
 
+# Check whether --enable-dane was given.
+if test "${enable_dane+set}" = set; then :
+  enableval=$enable_dane;
+fi
+
+case "$enable_dane" in
+    no)
+      ldns_build_config_use_dane=0
+
+      ;;
+    *)       if test "x$HAVE_SSL" != "xyes"; then
+        as_fn_error $? "DANE enabled, but no SSL support" "$LINENO" 5
+      fi
+      ac_fn_c_check_func "$LINENO" "X509_check_ca" "ac_cv_func_X509_check_ca"
+if test "x$ac_cv_func_X509_check_ca" = xyes; then :
+
+else
+  as_fn_error $? "OpenSSL does not support DANE: please upgrade OpenSSL or rerun with --disable-dane" "$LINENO" 5
+fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define USE_DANE 1
+_ACEOF
+
+      ldns_build_config_use_dane=1
+
+      ;;
+esac
+
+# Check whether --enable-rrtype-ninfo was given.
+if test "${enable_rrtype_ninfo+set}" = set; then :
+  enableval=$enable_rrtype_ninfo;
+fi
+
+case "$enable_rrtype_ninfo" in
+	yes)
+
+cat >>confdefs.h <<_ACEOF
+#define RRTYPE_NINFO /**/
+_ACEOF
+
+		;;
+	no|*)
+		;;
+esac
+# Check whether --enable-rrtype-rkey was given.
+if test "${enable_rrtype_rkey+set}" = set; then :
+  enableval=$enable_rrtype_rkey;
+fi
+
+case "$enable_rrtype_rkey" in
+	yes)
+
+cat >>confdefs.h <<_ACEOF
+#define RRTYPE_RKEY /**/
+_ACEOF
+
+		;;
+	no|*)
+		;;
+esac
+# Check whether --enable-rrtype-cds was given.
+if test "${enable_rrtype_cds+set}" = set; then :
+  enableval=$enable_rrtype_cds;
+fi
+
+case "$enable_rrtype_cds" in
+	yes)
+
+cat >>confdefs.h <<_ACEOF
+#define RRTYPE_CDS /**/
+_ACEOF
+
+		;;
+	no|*)
+		;;
+esac
+# Check whether --enable-rrtype-uri was given.
+if test "${enable_rrtype_uri+set}" = set; then :
+  enableval=$enable_rrtype_uri;
+fi
+
+case "$enable_rrtype_uri" in
+	yes)
+
+cat >>confdefs.h <<_ACEOF
+#define RRTYPE_URI /**/
+_ACEOF
+
+		;;
+	no|*)
+		;;
+esac
+# Check whether --enable-rrtype-ta was given.
+if test "${enable_rrtype_ta+set}" = set; then :
+  enableval=$enable_rrtype_ta;
+fi
+
+case "$enable_rrtype_ta" in
+	yes)
+
+cat >>confdefs.h <<_ACEOF
+#define RRTYPE_TA /**/
+_ACEOF
+
+		;;
+	no|*)
+		;;
+esac
+
 
 
 
 if test "x$HAVE_SSL" = "xyes"; then
-LIBSSL_SSL_LIBS="$LIBSSL_LIBS -lssl"
+LIBSSL_SSL_LIBS="-lssl $LIBSSL_LIBS"
 
 fi
 CPPFLAGS=$tmp_CPPFLAGS
@@ -15365,14 +15623,13 @@ _ACEOF
 if test x_$with_examples != x_no; then
 for ac_header in pcap.h
 do :
-  ac_fn_c_check_header_mongrel "$LINENO" "pcap.h" "ac_cv_header_pcap_h" "$ac_includes_default"
+  ac_fn_c_check_header_compile "$LINENO" "pcap.h" "ac_cv_header_pcap_h" "$ac_includes_default
+"
 if test "x$ac_cv_header_pcap_h" = xyes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_PCAP_H 1
 _ACEOF
 
-else
-  $ac_includes_default
 fi
 
 done
@@ -15505,40 +15762,16 @@ _ACEOF
 
 fi
 
-
-  ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "$ac_includes_default"
+ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "$ac_includes_default"
 if test "x$ac_cv_type_intptr_t" = xyes; then :
 
-$as_echo "#define HAVE_INTPTR_T 1" >>confdefs.h
-
 else
-  for ac_type in 'int' 'long int' 'long long int'; do
-       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($ac_type))];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
 
 cat >>confdefs.h <<_ACEOF
-#define intptr_t $ac_type
+#define intptr_t size_t
 _ACEOF
 
-	  ac_type=
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-       test -z "$ac_type" && break
-     done
-fi
-
 
 ac_fn_c_check_type "$LINENO" "in_addr_t" "ac_cv_type_in_addr_t" "
 #if HAVE_SYS_TYPES_H
@@ -15781,34 +16014,6 @@ esac
 fi
 
 
-ac_fn_c_check_func "$LINENO" "b32_pton" "ac_cv_func_b32_pton"
-if test "x$ac_cv_func_b32_pton" = xyes; then :
-  $as_echo "#define HAVE_B32_PTON 1" >>confdefs.h
-
-else
-  case " $LIBOBJS " in
-  *" b32_pton.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS b32_pton.$ac_objext"
- ;;
-esac
-
-fi
-
-
-ac_fn_c_check_func "$LINENO" "b32_ntop" "ac_cv_func_b32_ntop"
-if test "x$ac_cv_func_b32_ntop" = xyes; then :
-  $as_echo "#define HAVE_B32_NTOP 1" >>confdefs.h
-
-else
-  case " $LIBOBJS " in
-  *" b32_ntop.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS b32_ntop.$ac_objext"
- ;;
-esac
-
-fi
-
-
 ac_fn_c_check_func "$LINENO" "calloc" "ac_cv_func_calloc"
 if test "x$ac_cv_func_calloc" = xyes; then :
   $as_echo "#define HAVE_CALLOC 1" >>confdefs.h
@@ -16215,7 +16420,7 @@ $as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h
 
 fi
 
-for ac_func in endprotoent endservent sleep random fcntl strtoul bzero memset
+for ac_func in endprotoent endservent sleep random fcntl strtoul bzero memset b32_ntop b32_pton
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -16227,6 +16432,20 @@ _ACEOF
 fi
 done
 
+if test "x$HAVE_B32_NTOP" = "xyes"; then
+	ldns_build_config_have_b32_ntop=1
+
+else
+	ldns_build_config_have_b32_ntop=0
+
+fi
+if test "x$HAVE_B32_PTON" = "xyes"; then
+	ldns_build_config_have_b32_pton=1
+
+else
+	ldns_build_config_have_b32_pton=0
+
+fi
 
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo" >&5
@@ -17181,7 +17400,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by ldns $as_me 1.6.16, which was
+This file was extended by ldns $as_me 1.6.17, which was
 generated by GNU Autoconf 2.68.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -17247,7 +17466,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-ldns config.status 1.6.16
+ldns config.status 1.6.17
 configured by $0, generated by GNU Autoconf 2.68,
   with options \\"\$ac_cs_config\\"
 
diff --git a/contrib/ldns/configure.ac b/contrib/ldns/configure.ac
index fae43271960..5f25c7dc423 100644
--- a/contrib/ldns/configure.ac
+++ b/contrib/ldns/configure.ac
@@ -6,20 +6,23 @@ sinclude(acx_nlnetlabs.m4)
 # must be numbers. ac_defun because of later processing.
 m4_define([VERSION_MAJOR],[1])
 m4_define([VERSION_MINOR],[6])
-m4_define([VERSION_MICRO],[16])
+m4_define([VERSION_MICRO],[17])
 AC_INIT(ldns, m4_defn([VERSION_MAJOR]).m4_defn([VERSION_MINOR]).m4_defn([VERSION_MICRO]), libdns@nlnetlabs.nl, libdns)
 AC_CONFIG_SRCDIR([packet.c])
 # needed to build correct soname
-AC_SUBST(LIBTOOL_VERSION_INFO, VERSION_MAJOR:VERSION_MINOR:VERSION_MICRO)
 AC_SUBST(LDNS_VERSION_MAJOR, [VERSION_MAJOR])
 AC_SUBST(LDNS_VERSION_MINOR, [VERSION_MINOR])
 AC_SUBST(LDNS_VERSION_MICRO, [VERSION_MICRO])
+AC_SUBST(VERSION_INFO, [VERSION_MAJOR:VERSION_MINOR:VERSION_MICRO])
+
+AC_AIX
+LT_INIT
+AC_CONFIG_MACRO_DIR([m4])
 
 OURCPPFLAGS=''
 CPPFLAGS=${CPPFLAGS:-${OURCPPFLAGS}}
 CFLAGS="$CFLAGS"
 
-AC_AIX
 # Checks for programs.
 AC_PROG_CC
 ACX_DEPFLAG
@@ -70,6 +73,7 @@ fi
 ACX_CHECK_COMPILER_FLAG(Wall, [CFLAGS="-Wall $CFLAGS"])
 ACX_CHECK_COMPILER_FLAG(W, [CFLAGS="-W $CFLAGS"])
 ACX_CHECK_COMPILER_FLAG(Wwrite-strings, [CFLAGS="-Wwrite-strings $CFLAGS"])
+ACX_CHECK_COMPILER_FLAG(Wstrict-prototypes, [CFLAGS="-Wstrict-prototypes $CFLAGS"])
 
 
 AC_CHECK_HEADERS([getopt.h time.h],,, [AC_INCLUDES_DEFAULT])
@@ -152,7 +156,7 @@ else
 fi
 
 # add option to disable installation of ldns-config script
-AC_ARG_ENABLE(ldns-config, [ --disable-ldns-config	disable installation of ldns-config (default=enabled)],
+AC_ARG_ENABLE(ldns-config, AC_HELP_STRING([--disable-ldns-config], [disable installation of ldns-config (default=enabled)]),
 	enable_ldns_config=$enableval, enable_ldns_config=yes)
 if test "x$enable_ldns_config" = xyes; then
 	AC_SUBST(INSTALL_CONFIG, [install-config])
@@ -166,6 +170,16 @@ else
 	AC_SUBST(UNINSTALL_CONFIG_MANPAGE, [""])
 fi
 
+# add option to disable library printing to stderr
+AC_ARG_ENABLE(stderr-msgs, AC_HELP_STRING([--enable-stderr-msgs], [Enable printing to stderr (default=disabled)]), enable_stderr_msgs=$enableval, enable_stderr_msgs=no)
+case "$enable_stderr_msgs" in
+    no) dnl default
+        ;;
+    *)  
+        AC_DEFINE_UNQUOTED([STDERR_MSGS], [1], [Define this to enable messages to stderr.])
+        ;;
+esac
+
 # check for python
 PYTHON_X_CFLAGS=""
 ldns_with_pyldns=no
@@ -255,6 +269,30 @@ else
   AC_SUBST(PYLDNSXUNINST, "")
 fi
 
+# check for perl
+ldns_with_p5_dns_ldns=no
+AC_ARG_WITH(p5-dns-ldns, AC_HELP_STRING([--with-p5-dns-ldns], 
+ [generate DNS::LDNS perl bindings]), 
+ [],[ withval="no" ])
+ldns_have_perl=no
+if test x_$withval != x_no; then
+   AC_PATH_PROG([PERL], [perl])
+   if test -z "$PERL"; then
+      AC_MSG_ERROR([Cannot find perl in your system path])
+   fi
+   AC_SUBST(P5_DNS_LDNS, "p5-dns-ldns")dnl
+   AC_SUBST(TEST_P5_DNS_LDNS, "test-p5-dns-ldns")dnl
+   AC_SUBST(INSTALL_P5_DNS_LDNS, "install-p5-dns-ldns")dnl
+   AC_SUBST(UNINSTALL_P5_DNS_LDNS, "uninstall-p5-dns-ldns")dnl
+   AC_SUBST(CLEAN_P5_DNS_LDNS, "clean-p5-dns-ldns")
+else
+   AC_SUBST(P5_DNS_LDNS, "")dnl
+   AC_SUBST(TEST_P5_DNS_LDNS, "")dnl
+   AC_SUBST(INSTALL_P5_DNS_LDNS, "")dnl
+   AC_SUBST(UNINSTALL_P5_DNS_LDNS, "")dnl
+   AC_SUBST(CLEAN_P5_DNS_LDNS, "")
+fi
+
 # Use libtool
 ACX_LIBTOOL_C_ONLY
 
@@ -320,11 +358,67 @@ case "$enable_ecdsa" in
       ;;
 esac
 
+AC_ARG_ENABLE(dane, AC_HELP_STRING([--disable-dane], [Disable DANE support]))
+case "$enable_dane" in
+    no)
+      AC_SUBST(ldns_build_config_use_dane, 0)
+      ;;
+    *) dnl default
+      if test "x$HAVE_SSL" != "xyes"; then
+        AC_MSG_ERROR([DANE enabled, but no SSL support])
+      fi
+      AC_CHECK_FUNC(X509_check_ca, [], [AC_MSG_ERROR([OpenSSL does not support DANE: please upgrade OpenSSL or rerun with --disable-dane])])
+      AC_DEFINE_UNQUOTED([USE_DANE], [1], [Define this to enable DANE support.])
+      AC_SUBST(ldns_build_config_use_dane, 1)
+      ;;
+esac
+
+AC_ARG_ENABLE(rrtype-ninfo, AC_HELP_STRING([--enable-rrtype-ninfo], [Enable draft RR type ninfo.]))
+case "$enable_rrtype_ninfo" in
+	yes)
+		AC_DEFINE_UNQUOTED([RRTYPE_NINFO], [], [Define this to enable RR type NINFO.])
+		;;
+	no|*)
+		;;
+esac
+AC_ARG_ENABLE(rrtype-rkey, AC_HELP_STRING([--enable-rrtype-rkey], [Enable draft RR type rkey.]))
+case "$enable_rrtype_rkey" in
+	yes)
+		AC_DEFINE_UNQUOTED([RRTYPE_RKEY], [], [Define this to enable RR type RKEY.])
+		;;
+	no|*)
+		;;
+esac
+AC_ARG_ENABLE(rrtype-cds, AC_HELP_STRING([--enable-rrtype-cds], [Enable draft RR type cds.]))
+case "$enable_rrtype_cds" in
+	yes)
+		AC_DEFINE_UNQUOTED([RRTYPE_CDS], [], [Define this to enable RR type CDS.])
+		;;
+	no|*)
+		;;
+esac
+AC_ARG_ENABLE(rrtype-uri, AC_HELP_STRING([--enable-rrtype-uri], [Enable draft RR type uri.]))
+case "$enable_rrtype_uri" in
+	yes)
+		AC_DEFINE_UNQUOTED([RRTYPE_URI], [], [Define this to enable RR type URI.])
+		;;
+	no|*)
+		;;
+esac
+AC_ARG_ENABLE(rrtype-ta, AC_HELP_STRING([--enable-rrtype-ta], [Enable draft RR type ta.]))
+case "$enable_rrtype_ta" in
+	yes)
+		AC_DEFINE_UNQUOTED([RRTYPE_TA], [], [Define this to enable RR type TA.])
+		;;
+	no|*)
+		;;
+esac
+
 AC_SUBST(LIBSSL_CPPFLAGS)
 AC_SUBST(LIBSSL_LDFLAGS)
 AC_SUBST(LIBSSL_LIBS)
 if test "x$HAVE_SSL" = "xyes"; then
-AC_SUBST(LIBSSL_SSL_LIBS, ["$LIBSSL_LIBS -lssl"])
+AC_SUBST(LIBSSL_SSL_LIBS, ["-lssl $LIBSSL_LIBS"])
 fi
 CPPFLAGS=$tmp_CPPFLAGS
 LDFLAGS=$tmp_LDFLAGS
@@ -426,7 +520,7 @@ AC_INCLUDES_DEFAULT
 ])
 
 if test x_$with_examples != x_no; then
-AC_CHECK_HEADERS([pcap.h],, [AC_INCLUDES_DEFAULT])
+AC_CHECK_HEADERS([pcap.h],,, [AC_INCLUDES_DEFAULT])
 AC_CHECK_LIB(pcap, pcap_open_offline, [
 	AC_DEFINE([HAVE_LIBPCAP], [1], [Define to 1 if you have the `pcap' library (-lpcap).])dnl`
 	AC_SUBST([LIBPCAP_LIBS], [-lpcap])
@@ -458,8 +552,9 @@ else
   AC_SUBST(ldns_build_config_have_socklen_t, 0)
 fi
 AC_TYPE_SIZE_T
-AC_TYPE_SSIZE_T
-AC_TYPE_INTPTR_T
+AC_CHECK_TYPE(ssize_t, int)
+dnl AC_TYPE_INTPTR_T does not work on all platforms (autoconf)
+AC_CHECK_TYPE(intptr_t, size_t)
 AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t], [uint32_t], [in_addr_t])], [
 #if HAVE_SYS_TYPES_H
 # include 
@@ -481,8 +576,6 @@ AC_FUNC_REALLOC
 
 AC_REPLACE_FUNCS(b64_pton)
 AC_REPLACE_FUNCS(b64_ntop)
-AC_REPLACE_FUNCS(b32_pton)
-AC_REPLACE_FUNCS(b32_ntop)
 AC_REPLACE_FUNCS(calloc)
 AC_REPLACE_FUNCS(timegm)
 AC_REPLACE_FUNCS(gmtime_r)
@@ -497,7 +590,17 @@ AC_REPLACE_FUNCS(snprintf)
 AC_REPLACE_FUNCS(strlcpy)
 AC_REPLACE_FUNCS(memmove)
 AC_FUNC_FORK
-AC_CHECK_FUNCS([endprotoent endservent sleep random fcntl strtoul bzero memset])
+AC_CHECK_FUNCS([endprotoent endservent sleep random fcntl strtoul bzero memset b32_ntop b32_pton])
+if test "x$HAVE_B32_NTOP" = "xyes"; then
+	AC_SUBST(ldns_build_config_have_b32_ntop, 1)
+else
+	AC_SUBST(ldns_build_config_have_b32_ntop, 0)
+fi
+if test "x$HAVE_B32_PTON" = "xyes"; then
+	AC_SUBST(ldns_build_config_have_b32_pton, 1)
+else
+	AC_SUBST(ldns_build_config_have_b32_pton, 0)
+fi
 
 ACX_CHECK_GETADDRINFO_WITH_INCLUDES
 if test $ac_cv_func_getaddrinfo = no; then
@@ -618,7 +721,6 @@ AH_BOTTOM([
 extern "C" {
 #endif
 
-#ifndef B64_PTON
 int ldns_b64_ntop(uint8_t const *src, size_t srclength,
 	 	  char *target, size_t targsize);
 /**
@@ -629,8 +731,6 @@ static inline size_t ldns_b64_ntop_calculate_size(size_t srcsize)
 {
 	return ((((srcsize + 2) / 3) * 4) + 1);
 }
-#endif /* !B64_PTON */
-#ifndef B64_NTOP
 int ldns_b64_pton(char const *src, uint8_t *target, size_t targsize);
 /**
  * calculates the size needed to store the result of ldns_b64_pton
@@ -640,7 +740,12 @@ static inline size_t ldns_b64_pton_calculate_size(size_t srcsize)
 {
 	return (((((srcsize + 3) / 4) * 3)) + 1);
 }
-#endif /* !B64_NTOP */
+
+/**
+ * Given in dnssec_zone.c, also used in dnssec_sign.c:w
+
+ */
+int ldns_dname_compare_v(const void *a, const void *b);
 
 #ifndef HAVE_SLEEP
 /* use windows sleep, in millisecs, instead */
diff --git a/contrib/ldns/dane.c b/contrib/ldns/dane.c
index 793005ddcb3..675dfa8bf33 100644
--- a/contrib/ldns/dane.c
+++ b/contrib/ldns/dane.c
@@ -8,6 +8,7 @@
  */
 
 #include 
+#ifdef USE_DANE
 
 #include 
 #include 
@@ -15,8 +16,12 @@
 #include 
 #include 
 #include 
+#ifdef HAVE_SYS_SOCKET_H
 #include 
+#endif
+#ifdef HAVE_NETDB_H
 #include 
+#endif
 
 #ifdef HAVE_SSL
 #include 
@@ -119,13 +124,13 @@ ldns_dane_cert2rdf(ldns_rdf** rdf, X509* cert,
 	
 	case LDNS_TLSA_MATCHING_TYPE_SHA256:
 
-		digest = LDNS_XMALLOC(unsigned char, SHA256_DIGEST_LENGTH);
+		digest = LDNS_XMALLOC(unsigned char, LDNS_SHA256_DIGEST_LENGTH);
 		if (digest == NULL) {
 			LDNS_FREE(buf);
 			return LDNS_STATUS_MEM_ERR;
 		}
 		(void) ldns_sha256(buf, (unsigned int)len, digest);
-		*rdf = ldns_rdf_new(LDNS_RDF_TYPE_HEX, SHA256_DIGEST_LENGTH,
+		*rdf = ldns_rdf_new(LDNS_RDF_TYPE_HEX, LDNS_SHA256_DIGEST_LENGTH,
 				digest);
 		LDNS_FREE(buf);
 
@@ -134,13 +139,13 @@ ldns_dane_cert2rdf(ldns_rdf** rdf, X509* cert,
 
 	case LDNS_TLSA_MATCHING_TYPE_SHA512:
 
-		digest = LDNS_XMALLOC(unsigned char, SHA512_DIGEST_LENGTH);
+		digest = LDNS_XMALLOC(unsigned char, LDNS_SHA512_DIGEST_LENGTH);
 		if (digest == NULL) {
 			LDNS_FREE(buf);
 			return LDNS_STATUS_MEM_ERR;
 		}
 		(void) ldns_sha512(buf, (unsigned int)len, digest);
-		*rdf = ldns_rdf_new(LDNS_RDF_TYPE_HEX, SHA512_DIGEST_LENGTH,
+		*rdf = ldns_rdf_new(LDNS_RDF_TYPE_HEX, LDNS_SHA512_DIGEST_LENGTH,
 				digest);
 		LDNS_FREE(buf);
 
@@ -740,3 +745,4 @@ ldns_dane_verify(ldns_rr_list* tlsas,
 	return s;
 }
 #endif /* HAVE_SSL */
+#endif /* USE_DANE */
diff --git a/contrib/ldns/dnssec.c b/contrib/ldns/dnssec.c
index 684d17169e2..a41a9f633c4 100644
--- a/contrib/ldns/dnssec.c
+++ b/contrib/ldns/dnssec.c
@@ -654,103 +654,113 @@ ldns_key_rr2ds(const ldns_rr *key, ldns_hash h)
 	return ds;
 }
 
+/* From RFC3845:
+ *
+ * 2.1.2.  The List of Type Bit Map(s) Field
+ * 
+ *    The RR type space is split into 256 window blocks, each representing
+ *    the low-order 8 bits of the 16-bit RR type space.  Each block that
+ *    has at least one active RR type is encoded using a single octet
+ *    window number (from 0 to 255), a single octet bitmap length (from 1
+ *    to 32) indicating the number of octets used for the window block's
+ *    bitmap, and up to 32 octets (256 bits) of bitmap.
+ * 
+ *    Window blocks are present in the NSEC RR RDATA in increasing
+ *    numerical order.
+ * 
+ *    "|" denotes concatenation
+ * 
+ *    Type Bit Map(s) Field = ( Window Block # | Bitmap Length | Bitmap ) +
+ * 
+ *    
+ * 
+ *    Blocks with no types present MUST NOT be included.  Trailing zero
+ *    octets in the bitmap MUST be omitted.  The length of each block's
+ *    bitmap is determined by the type code with the largest numerical
+ *    value within that block, among the set of RR types present at the
+ *    NSEC RR's owner name.  Trailing zero octets not specified MUST be
+ *    interpreted as zero octets.
+ */
 ldns_rdf *
 ldns_dnssec_create_nsec_bitmap(ldns_rr_type rr_type_list[],
                                size_t size,
                                ldns_rr_type nsec_type)
 {
-	size_t i;
-	uint8_t *bitmap;
-	uint16_t bm_len = 0;
-	uint16_t i_type;
-	ldns_rdf *bitmap_rdf;
+	uint8_t  window;		/*  most significant octet of type */
+	uint8_t  subtype;		/* least significant octet of type */
+	uint16_t windows[256]		/* Max subtype per window */
+#ifndef S_SPLINT_S
+	                      = { 0 }	/* Initialize ALL elements with 0 */
+#endif
+	                             ;
+	ldns_rr_type* d;	/* used to traverse rr_type_list*/
+	size_t i;		/* used to traverse windows array */
 
-	uint8_t *data = NULL;
-	uint8_t cur_data[32];
-	uint8_t cur_window = 0;
-	uint8_t cur_window_max = 0;
-	uint16_t cur_data_size = 0;
+	size_t sz;			/* size needed for type bitmap rdf */
+	uint8_t* data = NULL;		/* rdf data */
+	uint8_t* dptr;			/* used to itraverse rdf data */
+	ldns_rdf* rdf;			/* bitmap rdf to return */
 
 	if (nsec_type != LDNS_RR_TYPE_NSEC &&
 	    nsec_type != LDNS_RR_TYPE_NSEC3) {
 		return NULL;
 	}
 
-	i_type = 0;
-	for (i = 0; i < size; i++) {
-		if (i_type < rr_type_list[i])
-			i_type = rr_type_list[i];
-	}
-	if (i_type < nsec_type) {
-		i_type = nsec_type;
+	/* Which other windows need to be in the bitmap rdf?
+	 */
+	for (d = rr_type_list; d < rr_type_list + size; d++) {
+		window  = *d >> 8;
+		subtype = *d & 0xff;
+		if (windows[window] < subtype) {
+			windows[window] = subtype;
+		}
 	}
 
-	bm_len = i_type / 8 + 2;
-	bitmap = LDNS_XMALLOC(uint8_t, bm_len);
-        if(!bitmap) return NULL;
-	for (i = 0; i < bm_len; i++) {
-		bitmap[i] = 0;
+	/* How much space do we need in the rdf for those windows?
+	 */
+	sz = 0;
+	for (i = 0; i < 256; i++) {
+		if (windows[i]) {
+			sz += windows[i] / 8 + 3;
+		}
 	}
+	if (sz > 0) {
+		/* Format rdf data according RFC3845 Section 2.1.2 (see above)
+		 */
+		dptr = data = LDNS_CALLOC(uint8_t, sz);
+		if (!data) {
+			return NULL;
+		}
+		for (i = 0; i < 256; i++) {
+			if (windows[i]) {
+				*dptr++ = (uint8_t)i;
+				*dptr++ = (uint8_t)(windows[i] / 8 + 1);
 
-	for (i = 0; i < size; i++) {
-		i_type = rr_type_list[i];
-		ldns_set_bit(bitmap + (int) i_type / 8,
-				   (int) (7 - (i_type % 8)),
-				   true);
-	}
+				/* Now let windows[i] index the bitmap
+				 * within data
+				 */
+				windows[i] = (uint16_t)(dptr - data);
 
-	/* fold it into windows TODO: can this be done directly? */
-	memset(cur_data, 0, 32);
-	for (i = 0; i < bm_len; i++) {
-		if (i / 32 > cur_window) {
-			/* check, copy, new */
-			if (cur_window_max > 0) {
-				/* this window has stuff, add it */
-				data = LDNS_XREALLOC(data,
-								 uint8_t,
-								 cur_data_size + cur_window_max + 3);
-                                if(!data) {
-                                        LDNS_FREE(bitmap);
-                                        return NULL;
-                                }
-				data[cur_data_size] = cur_window;
-				data[cur_data_size + 1] = cur_window_max + 1;
-				memcpy(data + cur_data_size + 2,
-					  cur_data,
-					  cur_window_max+1);
-				cur_data_size += cur_window_max + 3;
+				dptr += dptr[-1];
 			}
-			cur_window++;
-			cur_window_max = 0;
-			memset(cur_data, 0, 32);
-		}
-		cur_data[i%32] = bitmap[i];
-		if (bitmap[i] > 0) {
-			cur_window_max = i%32;
 		}
 	}
-	if (cur_window_max > 0 || cur_data[0] != 0) {
-		/* this window has stuff, add it */
-		data = LDNS_XREALLOC(data,
-						 uint8_t,
-						 cur_data_size + cur_window_max + 3);
-                if(!data) {
-                        LDNS_FREE(bitmap);
-                        return NULL;
-                }
-		data[cur_data_size] = cur_window;
-		data[cur_data_size + 1] = cur_window_max + 1;
-		memcpy(data + cur_data_size + 2, cur_data, cur_window_max+1);
-		cur_data_size += cur_window_max + 3;
+
+	/* Set the bits?
+	 */
+	for (d = rr_type_list; d < rr_type_list + size; d++) {
+		subtype = *d & 0xff;
+		data[windows[*d >> 8] + subtype/8] |= (0x80 >> (subtype % 8));
 	}
-	bitmap_rdf = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_NSEC,
-								cur_data_size,
-								data);
 
-	LDNS_FREE(bitmap);
-	LDNS_FREE(data);
-
-	return bitmap_rdf;
+	/* Allocate and return rdf structure for the data
+	 */
+	rdf = ldns_rdf_new(LDNS_RDF_TYPE_BITMAP, sz, data);
+	if (!rdf) {
+		LDNS_FREE(data);
+		return NULL;
+	}
+	return rdf;
 }
 
 int
@@ -987,7 +997,9 @@ ldns_nsec3_hash_name(ldns_rdf *name,
 	/* prepare the owner name according to the draft section bla */
 	cann = ldns_rdf_clone(name);
 	if(!cann) {
+#ifdef STDERR_MSGS
 		fprintf(stderr, "Memory error\n");
+#endif
 		return NULL;
 	}
 	ldns_dname2canonical(cann);
@@ -1032,11 +1044,13 @@ ldns_nsec3_hash_name(ldns_rdf *name,
                 hashed_owner_b32,
                 ldns_b32_ntop_calculate_size(hashed_owner_str_len)+1);
 	if (hashed_owner_b32_len < 1) {
+#ifdef STDERR_MSGS
 		fprintf(stderr, "Error in base32 extended hex encoding ");
 		fprintf(stderr, "of hashed owner name (name: ");
 		ldns_rdf_print(stderr, name);
 		fprintf(stderr, ", return code: %u)\n",
 		        (unsigned int) hashed_owner_b32_len);
+#endif
 		LDNS_FREE(hashed_owner_b32);
 		return NULL;
 	}
@@ -1044,7 +1058,9 @@ ldns_nsec3_hash_name(ldns_rdf *name,
 
 	status = ldns_str2rdf_dname(&hashed_owner, hashed_owner_b32);
 	if (status != LDNS_STATUS_OK) {
+#ifdef STDERR_MSGS
 		fprintf(stderr, "Error creating rdf from %s\n", hashed_owner_b32);
+#endif
 		LDNS_FREE(hashed_owner_b32);
 		return NULL;
 	}
@@ -1338,38 +1354,120 @@ ldns_nsec3_hash_name_frm_nsec3(const ldns_rr *nsec, ldns_rdf *name)
 }
 
 bool
-ldns_nsec_bitmap_covers_type(const ldns_rdf *nsec_bitmap, ldns_rr_type type)
+ldns_nsec_bitmap_covers_type(const  ldns_rdf* bitmap, ldns_rr_type type)
 {
-	uint8_t window_block_nr;
-	uint8_t bitmap_length;
-	uint16_t cur_type;
-	uint16_t pos = 0;
-	uint16_t bit_pos;
-	uint8_t *data;
+	uint8_t* dptr;
+	uint8_t* dend;
 
-	if (nsec_bitmap == NULL) {
+	/* From RFC3845 Section 2.1.2:
+	 *
+	 *	"The RR type space is split into 256 window blocks, each re-
+	 *	 presenting the low-order 8 bits of the 16-bit RR type space."
+	 */
+	uint8_t  window = type >> 8;
+	uint8_t subtype = type & 0xff;
+
+	if (! bitmap) {
 		return false;
 	}
-	data = ldns_rdf_data(nsec_bitmap);
-	while(pos < ldns_rdf_size(nsec_bitmap)) {
-		window_block_nr = data[pos];
-		bitmap_length = data[pos + 1];
-		pos += 2;
+	assert(ldns_rdf_get_type(bitmap) == LDNS_RDF_TYPE_BITMAP);
 
-		for (bit_pos = 0; bit_pos < (bitmap_length) * 8; bit_pos++) {
-			if (ldns_get_bit(&data[pos], bit_pos)) {
-				cur_type = 256 * (uint16_t) window_block_nr + bit_pos;
-				if (cur_type == type) {
-					return true;
-				}
-			}
+	dptr = ldns_rdf_data(bitmap);
+	dend = ldns_rdf_data(bitmap) + ldns_rdf_size(bitmap);
+
+	/* Type Bitmap = ( Window Block # | Bitmap Length | Bitmap ) +
+	 *                 dptr[0]          dptr[1]         dptr[2:]
+	 */
+	while (dptr < dend && dptr[0] <= window) {
+
+		if (dptr[0] == window && subtype / 8 < dptr[1] &&
+				dptr + dptr[1] + 2 <= dend) {
+
+			return dptr[2 + subtype / 8] & (0x80 >> (subtype % 8));
 		}
-
-		pos += (uint16_t) bitmap_length;
+		dptr += dptr[1] + 2; /* next window */
 	}
 	return false;
 }
 
+ldns_status
+ldns_nsec_bitmap_set_type(ldns_rdf* bitmap, ldns_rr_type type)
+{
+	uint8_t* dptr;
+	uint8_t* dend;
+
+	/* From RFC3845 Section 2.1.2:
+	 *
+	 *	"The RR type space is split into 256 window blocks, each re-
+	 *	 presenting the low-order 8 bits of the 16-bit RR type space."
+	 */
+	uint8_t  window = type >> 8;
+	uint8_t subtype = type & 0xff;
+
+	if (! bitmap) {
+		return false;
+	}
+	assert(ldns_rdf_get_type(bitmap) == LDNS_RDF_TYPE_BITMAP);
+
+	dptr = ldns_rdf_data(bitmap);
+	dend = ldns_rdf_data(bitmap) + ldns_rdf_size(bitmap);
+
+	/* Type Bitmap = ( Window Block # | Bitmap Length | Bitmap ) +
+	 *                 dptr[0]          dptr[1]         dptr[2:]
+	 */
+	while (dptr < dend && dptr[0] <= window) {
+
+		if (dptr[0] == window && subtype / 8 < dptr[1] &&
+				dptr + dptr[1] + 2 <= dend) {
+
+			dptr[2 + subtype / 8] |= (0x80 >> (subtype % 8));
+			return LDNS_STATUS_OK;
+		}
+		dptr += dptr[1] + 2; /* next window */
+	}
+	return LDNS_STATUS_TYPE_NOT_IN_BITMAP;
+}
+
+ldns_status
+ldns_nsec_bitmap_clear_type(ldns_rdf* bitmap, ldns_rr_type type)
+{
+	uint8_t* dptr;
+	uint8_t* dend;
+
+	/* From RFC3845 Section 2.1.2:
+	 *
+	 *	"The RR type space is split into 256 window blocks, each re-
+	 *	 presenting the low-order 8 bits of the 16-bit RR type space."
+	 */
+	uint8_t  window = type >> 8;
+	uint8_t subtype = type & 0xff;
+
+	if (! bitmap) {
+		return false;
+	}
+
+	assert(ldns_rdf_get_type(bitmap) == LDNS_RDF_TYPE_BITMAP);
+
+	dptr = ldns_rdf_data(bitmap);
+	dend = ldns_rdf_data(bitmap) + ldns_rdf_size(bitmap);
+
+	/* Type Bitmap = ( Window Block # | Bitmap Length | Bitmap ) +
+	 *                 dptr[0]          dptr[1]         dptr[2:]
+	 */
+	while (dptr < dend && dptr[0] <= window) {
+
+		if (dptr[0] == window && subtype / 8 < dptr[1] &&
+				dptr + dptr[1] + 2 <= dend) {
+
+			dptr[2 + subtype / 8] &= ~(0x80 >> (subtype % 8));
+			return LDNS_STATUS_OK;
+		}
+		dptr += dptr[1] + 2; /* next window */
+	}
+	return LDNS_STATUS_TYPE_NOT_IN_BITMAP;
+}
+
+
 bool
 ldns_nsec_covers_name(const ldns_rr *nsec, const ldns_rdf *name)
 {
@@ -1407,9 +1505,11 @@ ldns_nsec_covers_name(const ldns_rr *nsec, const ldns_rdf *name)
 	if(ldns_dname_compare(nsec_owner, nsec_next) > 0) {
 		result = (ldns_dname_compare(nsec_owner, name) <= 0 ||
 				ldns_dname_compare(name, nsec_next) < 0);
-	} else {
+	} else if(ldns_dname_compare(nsec_owner, nsec_next) < 0) {
 		result = (ldns_dname_compare(nsec_owner, name) <= 0 &&
 		          ldns_dname_compare(name, nsec_next) < 0);
+	} else {
+		result = true;
 	}
 
 	ldns_rdf_deep_free(nsec_next);
diff --git a/contrib/ldns/dnssec_sign.c b/contrib/ldns/dnssec_sign.c
index abce4852d3f..4af882a2845 100644
--- a/contrib/ldns/dnssec_sign.c
+++ b/contrib/ldns/dnssec_sign.c
@@ -566,7 +566,7 @@ ldns_dnssec_addresses_on_glue_list(
  * when walking the tree with the ldns_dnssec_name_node_next_nonglue()
  * function. But watch out! Names that are partially occluded (like glue with
  * the same name as the delegation) will not be marked and should specifically 
- * be taken into account seperately.
+ * be taken into account separately.
  *
  * When glue_list is given (not NULL), in the process of marking the names, all
  * glue resource records will be pushed to that list, even glue at delegation names.
@@ -659,7 +659,7 @@ ldns_dnssec_zone_mark_and_get_glue(ldns_dnssec_zone *zone,
  * when walking the tree with the ldns_dnssec_name_node_next_nonglue()
  * function. But watch out! Names that are partially occluded (like glue with
  * the same name as the delegation) will not be marked and should specifically 
- * be taken into account seperately.
+ * be taken into account separately.
  *
  * \param[in] zone the zone in which to mark the names
  * \return LDNS_STATUS_OK on success, an error code otherwise
@@ -771,6 +771,12 @@ ldns_dnssec_zone_create_nsecs(ldns_dnssec_zone *zone,
 }
 
 #ifdef HAVE_SSL
+static void
+ldns_hashed_names_node_free(ldns_rbnode_t *node, void *arg) {
+	(void) arg;
+	LDNS_FREE(node);
+}
+
 static ldns_status
 ldns_dnssec_zone_create_nsec3s_mkmap(ldns_dnssec_zone *zone,
 		ldns_rr_list *new_rrs,
@@ -810,21 +816,24 @@ ldns_dnssec_zone_create_nsec3s_mkmap(ldns_dnssec_zone *zone,
 		nsec_ttl = LDNS_DEFAULT_TTL;
 	}
 
-	if (map) {
-		if ((*map = ldns_rbtree_create(ldns_dname_compare_v)) 
-				== NULL) {
-			map = NULL;
-		};
+	if (zone->hashed_names) {
+		ldns_traverse_postorder(zone->hashed_names,
+				ldns_hashed_names_node_free, NULL);
+		LDNS_FREE(zone->hashed_names);
+	}
+	zone->hashed_names = ldns_rbtree_create(ldns_dname_compare_v);
+	if (zone->hashed_names && map) {
+		*map = zone->hashed_names;
 	}
-	nsec3_list = ldns_rr_list_new();
 
 	first_name_node = ldns_dnssec_name_node_next_nonglue(
 					  ldns_rbtree_first(zone->names));
 
 	current_name_node = first_name_node;
 
-	while (current_name_node &&
-	       current_name_node != LDNS_RBTREE_NULL) {
+	while (current_name_node && current_name_node != LDNS_RBTREE_NULL &&
+			result == LDNS_STATUS_OK) {
+
 		current_name = (ldns_dnssec_name *) current_name_node->data;
 		nsec_rr = ldns_dnssec_create_nsec3(current_name,
 		                                   NULL,
@@ -842,28 +851,49 @@ ldns_dnssec_zone_create_nsec3s_mkmap(ldns_dnssec_zone *zone,
 		ldns_rr_set_ttl(nsec_rr, nsec_ttl);
 		result = ldns_dnssec_name_add_rr(current_name, nsec_rr);
 		ldns_rr_list_push_rr(new_rrs, nsec_rr);
-		ldns_rr_list_push_rr(nsec3_list, nsec_rr);
-		if (map) {
+		if (ldns_rr_owner(nsec_rr)) {
 			hashmap_node = LDNS_MALLOC(ldns_rbnode_t);
-			if (hashmap_node && ldns_rr_owner(nsec_rr)) {
-				hashmap_node->key = ldns_dname_label(
-					ldns_rr_owner(nsec_rr), 0);
-				if (hashmap_node->key) {
-					hashmap_node->data = current_name->name;
-					(void) ldns_rbtree_insert(
-							*map, hashmap_node);
-				}
+			if (hashmap_node == NULL) {
+				return LDNS_STATUS_MEM_ERR;
+			}
+			current_name->hashed_name = 
+				ldns_dname_label(ldns_rr_owner(nsec_rr), 0);
+
+			if (current_name->hashed_name == NULL) {
+				LDNS_FREE(hashmap_node);
+				return LDNS_STATUS_MEM_ERR;
+			}
+			hashmap_node->key  = current_name->hashed_name;
+			hashmap_node->data = current_name;
+
+			if (! ldns_rbtree_insert(zone->hashed_names
+						, hashmap_node)) {
+				LDNS_FREE(hashmap_node);
 			}
 		}
 		current_name_node = ldns_dnssec_name_node_next_nonglue(
 		                   ldns_rbtree_next(current_name_node));
 	}
 	if (result != LDNS_STATUS_OK) {
-		ldns_rr_list_free(nsec3_list);
 		return result;
 	}
 
-	ldns_rr_list_sort_nsec3(nsec3_list);
+	/* Make sorted list of nsec3s (via zone->hashed_names)
+	 */
+	nsec3_list = ldns_rr_list_new();
+	if (nsec3_list == NULL) {
+		return LDNS_STATUS_MEM_ERR;
+	}
+	for ( hashmap_node  = ldns_rbtree_first(zone->hashed_names)
+	    ; hashmap_node != LDNS_RBTREE_NULL
+	    ; hashmap_node  = ldns_rbtree_next(hashmap_node)
+	    ) {
+		current_name = (ldns_dnssec_name *) hashmap_node->data;
+		nsec_rr = ((ldns_dnssec_name *) hashmap_node->data)->nsec;
+		if (nsec_rr) {
+			ldns_rr_list_push_rr(nsec3_list, nsec_rr);
+		}
+	}
 	result = ldns_dnssec_chain_nsec3_list(nsec3_list);
 	ldns_rr_list_free(nsec3_list);
 
@@ -910,7 +940,9 @@ ldns_dnssec_remove_signatures( ldns_dnssec_rrs *signatures
 		ldns_key_list_set_use(key_list, false);
 		break;
 		default:
+#ifdef STDERR_MSGS
 			fprintf(stderr, "[XX] unknown return value from callback\n");
+#endif
 			break;
 		}
 		return NULL;
@@ -962,7 +994,9 @@ ldns_dnssec_remove_signatures( ldns_dnssec_rrs *signatures
 			LDNS_FREE(cur_rr);
 			break;
 		default:
+#ifdef STDERR_MSGS
 			fprintf(stderr, "[XX] unknown return value from callback\n");
+#endif
 			break;
 		}
 		cur_rr = next_rr;
diff --git a/contrib/ldns/dnssec_zone.c b/contrib/ldns/dnssec_zone.c
index 57b62c69363..60d62eae09f 100644
--- a/contrib/ldns/dnssec_zone.c
+++ b/contrib/ldns/dnssec_zone.c
@@ -54,10 +54,8 @@ ldns_dnssec_rrs_add_rr(ldns_dnssec_rrs *rrs, ldns_rr *rr)
 
 	/* this could be done more efficiently; name and type should already
 	   be equal */
-	cmp = ldns_rr_compare(rrs->rr,
-					  rr);
-	/* should we error on equal? */
-	if (cmp <= 0) {
+	cmp = ldns_rr_compare(rrs->rr, rr);
+	if (cmp < 0) {
 		if (rrs->next) {
 			return ldns_dnssec_rrs_add_rr(rrs->next, rr);
 		} else {
@@ -74,6 +72,7 @@ ldns_dnssec_rrs_add_rr(ldns_dnssec_rrs *rrs, ldns_rr *rr)
 		rrs->rr = rr;
 		rrs->next = new_rrs;
 	}
+	/* Silently ignore equal rr's */
 	return LDNS_STATUS_OK;
 }
 
@@ -450,8 +449,6 @@ ldns_dnssec_name_add_rr(ldns_dnssec_name *name,
 				    ldns_rr *rr)
 {
 	ldns_status result = LDNS_STATUS_OK;
-	ldns_rdf *name_name;
-	bool hashed_name = false;
 	ldns_rr_type rr_type;
 	ldns_rr_type typecovered = 0;
 
@@ -467,19 +464,6 @@ ldns_dnssec_name_add_rr(ldns_dnssec_name *name,
 		typecovered = ldns_rdf2rr_type(ldns_rr_rrsig_typecovered(rr));
 	}
 
-#ifdef HAVE_SSL
-	if (rr_type == LDNS_RR_TYPE_NSEC3 ||
-	    typecovered == LDNS_RR_TYPE_NSEC3) {
-		name_name = ldns_nsec3_hash_name_frm_nsec3(rr,
-										   ldns_dnssec_name_name(name));
-		hashed_name = true;
-	} else {
-		name_name = ldns_dnssec_name_name(name);
-	}
-#else
-	name_name = ldns_dnssec_name_name(name);
-#endif /* HAVE_SSL */
-
 	if (rr_type == LDNS_RR_TYPE_NSEC ||
 	    rr_type == LDNS_RR_TYPE_NSEC3) {
 		/* XX check if is already set (and error?) */
@@ -501,11 +485,6 @@ ldns_dnssec_name_add_rr(ldns_dnssec_name *name,
 			result = ldns_dnssec_rrsets_add_rr(name->rrsets, rr);
 		}
 	}
-
-	if (hashed_name) {
-		ldns_rdf_deep_free(name_name);
-	}
-
 	return result;
 }
 
@@ -593,6 +572,8 @@ ldns_dnssec_zone_new(void)
         if(!zone) return NULL;
 	zone->soa = NULL;
 	zone->names = NULL;
+	zone->hashed_names = NULL;
+	zone->_nsec3params = NULL;
 
 	return zone;
 }
@@ -675,6 +656,8 @@ ldns_dnssec_zone_new_frm_fp_l(ldns_dnssec_zone** z, FILE* fp, ldns_rdf* origin,
 					ldns_rr_list_push_rr(todo_nsec3s,
 						       	cur_rr);
 				}
+				status = LDNS_STATUS_OK;
+
 			} else if (status != LDNS_STATUS_OK)
 				goto error;
 
@@ -698,18 +681,13 @@ ldns_dnssec_zone_new_frm_fp_l(ldns_dnssec_zone** z, FILE* fp, ldns_rdf* origin,
 
 	if (ldns_rr_list_rr_count(todo_nsec3s) > 0) {
 		(void) ldns_dnssec_zone_add_empty_nonterminals(newzone);
-		for (i = 0; status == LDNS_STATUS_OK && 
+		for (i = 0; status == LDNS_STATUS_OK &&
 				i < ldns_rr_list_rr_count(todo_nsec3s); i++) {
 			cur_rr = ldns_rr_list_rr(todo_nsec3s, i);
 			status = ldns_dnssec_zone_add_rr(newzone, cur_rr);
 		}
-		for (i = 0; status == LDNS_STATUS_OK &&
-				i < ldns_rr_list_rr_count(todo_nsec3_rrsigs);
-			       	i++){
-			cur_rr = ldns_rr_list_rr(todo_nsec3_rrsigs, i);
-			status = ldns_dnssec_zone_add_rr(newzone, cur_rr);
-		}
-	} else if (ldns_rr_list_rr_count(todo_nsec3_rrsigs) > 0) {
+	} 
+	if (ldns_rr_list_rr_count(todo_nsec3_rrsigs) > 0) {
 		for (i = 0; status == LDNS_STATUS_OK &&
 				i < ldns_rr_list_rr_count(todo_nsec3_rrsigs);
 				i++){
@@ -803,31 +781,99 @@ ldns_dname_compare_v(const void *a, const void *b) {
 	return ldns_dname_compare((ldns_rdf *)a, (ldns_rdf *)b);
 }
 
+static void
+ldns_dnssec_name_make_hashed_name(ldns_dnssec_zone *zone,
+		ldns_dnssec_name* name, ldns_rr* nsec3rr);
+
+static void
+ldns_hashed_names_node_free(ldns_rbnode_t *node, void *arg) {
+	(void) arg;
+	LDNS_FREE(node);
+}
+
+static void
+ldns_dnssec_zone_hashed_names_from_nsec3(
+		ldns_dnssec_zone* zone, ldns_rr* nsec3rr)
+{
+	ldns_rbnode_t* current_node;
+	ldns_dnssec_name* current_name;
+
+	assert(zone != NULL);
+	assert(nsec3rr != NULL);
+
+	if (zone->hashed_names) {
+		ldns_traverse_postorder(zone->hashed_names,
+				ldns_hashed_names_node_free, NULL);
+		LDNS_FREE(zone->hashed_names);
+	}
+	zone->_nsec3params = nsec3rr;
+
+	/* So this is a NSEC3 zone.
+	* Calculate hashes for all names already in the zone
+	*/
+	zone->hashed_names = ldns_rbtree_create(ldns_dname_compare_v);
+	if (zone->hashed_names == NULL) {
+		return;
+	}
+	for ( current_node  = ldns_rbtree_first(zone->names)
+	    ; current_node != LDNS_RBTREE_NULL
+	    ; current_node  = ldns_rbtree_next(current_node)
+	    ) {
+		current_name = (ldns_dnssec_name *) current_node->data;
+		ldns_dnssec_name_make_hashed_name(zone, current_name, nsec3rr);
+
+	}
+}
+
+static void
+ldns_dnssec_name_make_hashed_name(ldns_dnssec_zone *zone,
+		ldns_dnssec_name* name, ldns_rr* nsec3rr)
+{
+	ldns_rbnode_t* new_node;
+
+	assert(name != NULL);
+	if (! zone->_nsec3params) {
+		if (! nsec3rr) {
+			return;
+		}
+		ldns_dnssec_zone_hashed_names_from_nsec3(zone, nsec3rr);
+
+	} else if (! nsec3rr) {
+		nsec3rr = zone->_nsec3params;
+	}
+	name->hashed_name = ldns_nsec3_hash_name_frm_nsec3(nsec3rr, name->name);
+
+	/* Also store in zone->hashed_names */
+	if ((new_node = LDNS_MALLOC(ldns_rbnode_t))) {
+
+		new_node->key  = name->hashed_name;
+		new_node->data = name;
+
+		if (ldns_rbtree_insert(zone->hashed_names, new_node) == NULL) {
+
+				LDNS_FREE(new_node);
+		}
+	}
+}
+
+
 static ldns_rbnode_t *
-ldns_dnssec_zone_find_nsec3_original(ldns_dnssec_zone *zone,
-                                     ldns_rr *rr) {
-	ldns_rbnode_t *current_node = ldns_rbtree_first(zone->names);
-	ldns_dnssec_name *current_name;
+ldns_dnssec_zone_find_nsec3_original(ldns_dnssec_zone *zone, ldns_rr *rr) {
 	ldns_rdf *hashed_name;
 
 	hashed_name = ldns_dname_label(ldns_rr_owner(rr), 0);
-
-	while (current_node != LDNS_RBTREE_NULL) {
-		current_name = (ldns_dnssec_name *) current_node->data;
-		if (!current_name->hashed_name) {
-			current_name->hashed_name =
-				ldns_nsec3_hash_name_frm_nsec3(rr, current_name->name);
-		}
-		if (ldns_dname_compare(hashed_name,
-						   current_name->hashed_name)
-		    == 0) {
-			ldns_rdf_deep_free(hashed_name);
-			return current_node;
-		}
-		current_node = ldns_rbtree_next(current_node);
+	if (hashed_name == NULL) {
+		return NULL;
 	}
-	ldns_rdf_deep_free(hashed_name);
-	return NULL;
+	if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_NSEC3 && ! zone->_nsec3params){
+
+		ldns_dnssec_zone_hashed_names_from_nsec3(zone, rr);
+	}
+	if (zone->hashed_names == NULL) {
+		ldns_rdf_deep_free(hashed_name);
+		return NULL;
+	}
+	return  ldns_rbtree_search(zone->hashed_names, hashed_name);
 }
 
 ldns_status
@@ -854,15 +900,13 @@ ldns_dnssec_zone_add_rr(ldns_dnssec_zone *zone, ldns_rr *rr)
 	}
 	if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_NSEC3 ||
 	    type_covered == LDNS_RR_TYPE_NSEC3) {
-		cur_node = ldns_dnssec_zone_find_nsec3_original(zone,
-					 						   rr);
+		cur_node = ldns_dnssec_zone_find_nsec3_original(zone, rr);
 		if (!cur_node) {
 			return LDNS_STATUS_DNSSEC_NSEC3_ORIGINAL_NOT_FOUND;
 		}
 	} else {
 		cur_node = ldns_rbtree_search(zone->names, ldns_rr_owner(rr));
 	}
-
 	if (!cur_node) {
 		/* add */
 		cur_name = ldns_dnssec_name_new_frm_rr(rr);
@@ -875,21 +919,14 @@ ldns_dnssec_zone_add_rr(ldns_dnssec_zone *zone, ldns_rr *rr)
 		cur_node->key = ldns_rr_owner(rr);
 		cur_node->data = cur_name;
 		(void)ldns_rbtree_insert(zone->names, cur_node);
+		ldns_dnssec_name_make_hashed_name(zone, cur_name, NULL);
 	} else {
 		cur_name = (ldns_dnssec_name *) cur_node->data;
 		result = ldns_dnssec_name_add_rr(cur_name, rr);
 	}
-
-	if (result != LDNS_STATUS_OK) {
-		fprintf(stderr, "error adding rr: ");
-		ldns_rr_print(stderr, rr);
-	}
-
-	/*TODO ldns_dnssec_name_print_names(stdout, zone->names, 0);*/
 	if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_SOA) {
 		zone->soa = cur_name;
 	}
-
 	return result;
 }
 
@@ -1035,6 +1072,8 @@ ldns_dnssec_zone_add_empty_nonterminals(ldns_dnssec_zone *zone)
 				new_node->key = new_name->name;
 				new_node->data = new_name;
 				(void)ldns_rbtree_insert(zone->names, new_node);
+				ldns_dnssec_name_make_hashed_name(
+						zone, new_name, NULL);
 			}
 			ldns_rdf_deep_free(l1);
 			ldns_rdf_deep_free(l2);
diff --git a/contrib/ldns/drill/chasetrace.c b/contrib/ldns/drill/chasetrace.c
index 0a37ff3017e..370f627673e 100644
--- a/contrib/ldns/drill/chasetrace.c
+++ b/contrib/ldns/drill/chasetrace.c
@@ -74,6 +74,8 @@ do_trace(ldns_resolver *local_res, ldns_rdf *name, ldns_rr_type t,
 			ldns_resolver_usevc(local_res));
 	ldns_resolver_set_random(res, 
 			ldns_resolver_random(local_res));
+	ldns_resolver_set_source(res,
+			ldns_resolver_source(local_res));
 	ldns_resolver_set_recursive(res, false);
 
 	/* setup the root nameserver in the new resolver */
diff --git a/contrib/ldns/drill/configure b/contrib/ldns/drill/configure
index 6a4487d9a97..0937a1b288a 100755
--- a/contrib/ldns/drill/configure
+++ b/contrib/ldns/drill/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for ldns 1.6.16.
+# Generated by GNU Autoconf 2.68 for ldns 1.6.17.
 #
 # Report bugs to .
 #
@@ -560,8 +560,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='ldns'
 PACKAGE_TARNAME='libdns'
-PACKAGE_VERSION='1.6.16'
-PACKAGE_STRING='ldns 1.6.16'
+PACKAGE_VERSION='1.6.17'
+PACKAGE_STRING='ldns 1.6.17'
 PACKAGE_BUGREPORT='libdns@nlnetlabs.nl'
 PACKAGE_URL=''
 
@@ -1218,7 +1218,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures ldns 1.6.16 to adapt to many kinds of systems.
+\`configure' configures ldns 1.6.17 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1279,7 +1279,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of ldns 1.6.16:";;
+     short | recursive ) echo "Configuration of ldns 1.6.17:";;
    esac
   cat <<\_ACEOF
 
@@ -1378,7 +1378,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-ldns configure 1.6.16
+ldns configure 1.6.17
 generated by GNU Autoconf 2.68
 
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -1801,7 +1801,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by ldns $as_me 1.6.16, which was
+It was created by ldns $as_me 1.6.17, which was
 generated by GNU Autoconf 2.68.  Invocation command line was
 
   $ $0 $@
@@ -2154,7 +2154,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 # Copyright 2009, Wouter Wijngaards, NLnet Labs.
 # BSD licensed.
 #
-# Version 21
+# Version 26
+# 2013-09-19 FLTO help text improved.
+# 2013-07-18 Enable ACX_CHECK_COMPILER_FLAG to test for -Wstrict-prototypes
+# 2013-06-25 FLTO has --disable-flto option.
+# 2013-05-03 Update W32_SLEEP for newer mingw that links but not defines it.
+# 2013-03-22 Fix ACX_RSRC_VERSION for long version numbers.
 # 2012-02-09 Fix AHX_MEMCMP_BROKEN with undef in compat/memcmp.h.
 # 2012-01-20 Fix COMPILER_FLAGS_UNBOUND for gcc 4.6.2 assigned-not-used-warns.
 # 2011-12-05 Fix getaddrinfowithincludes on windows with fedora16 mingw32-gcc.
@@ -2169,7 +2174,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 # 2010-07-02 Add check for ss_family (for minix).
 # 2010-04-26 Fix to use CPPFLAGS for CHECK_COMPILER_FLAGS.
 # 2010-03-01 Fix RPATH using CONFIG_COMMANDS to run at the very end.
-# 2010-02-18 WITH_SSL outputs the LIBSSL_LDFLAGS, LIBS, CPPFLAGS seperate, -ldl
+# 2010-02-18 WITH_SSL outputs the LIBSSL_LDFLAGS, LIBS, CPPFLAGS separate, -ldl
 # 2010-02-01 added ACX_CHECK_MEMCMP_SIGNED, AHX_MEMCMP_BROKEN
 # 2010-01-20 added AHX_COONFIG_STRLCAT
 # 2009-07-14 U_CHAR detection improved for windows crosscompile.
@@ -4240,7 +4245,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
-echo 'void f(){}' >conftest.c
+echo 'void f(void){}' >conftest.c
 if test -z "`$CC $CPPFLAGS $CFLAGS -std=c99 -c conftest.c 2>&1`"; then
 eval "cv_prog_cc_flag_$cache=yes"
 else
@@ -4271,7 +4276,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
-echo 'void f(){}' >conftest.c
+echo 'void f(void){}' >conftest.c
 if test -z "`$CC $CPPFLAGS $CFLAGS -xc99 -c conftest.c 2>&1`"; then
 eval "cv_prog_cc_flag_$cache=yes"
 else
@@ -4314,7 +4319,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
-echo 'void f(){}' >conftest.c
+echo 'void f(void){}' >conftest.c
 if test -z "`$CC $CPPFLAGS $CFLAGS -O2 -c conftest.c 2>&1`"; then
 eval "cv_prog_cc_flag_$cache=yes"
 else
@@ -4347,7 +4352,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
-echo 'void f(){}' >conftest.c
+echo 'void f(void){}' >conftest.c
 if test -z "`$CC $CPPFLAGS $CFLAGS -Werror -c conftest.c 2>&1`"; then
 eval "cv_prog_cc_flag_$cache=yes"
 else
@@ -4378,7 +4383,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
-echo 'void f(){}' >conftest.c
+echo 'void f(void){}' >conftest.c
 if test -z "`$CC $CPPFLAGS $CFLAGS -Wall -c conftest.c 2>&1`"; then
 eval "cv_prog_cc_flag_$cache=yes"
 else
@@ -5945,7 +5950,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by ldns $as_me 1.6.16, which was
+This file was extended by ldns $as_me 1.6.17, which was
 generated by GNU Autoconf 2.68.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -6007,7 +6012,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-ldns config.status 1.6.16
+ldns config.status 1.6.17
 configured by $0, generated by GNU Autoconf 2.68,
   with options \\"\$ac_cs_config\\"
 
diff --git a/contrib/ldns/drill/configure.ac b/contrib/ldns/drill/configure.ac
index 17d7541c027..b7fe2aee07a 100644
--- a/contrib/ldns/drill/configure.ac
+++ b/contrib/ldns/drill/configure.ac
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.56)
-AC_INIT(ldns, 1.6.16, libdns@nlnetlabs.nl,libdns)
+AC_INIT(ldns, 1.6.17, libdns@nlnetlabs.nl,libdns)
 AC_CONFIG_SRCDIR([drill.c])
 sinclude(../acx_nlnetlabs.m4)
 
diff --git a/contrib/ldns/drill/drill.1.in b/contrib/ldns/drill/drill.1.in
index 15b15a42533..b6d74f6554d 100644
--- a/contrib/ldns/drill/drill.1.in
+++ b/contrib/ldns/drill/drill.1.in
@@ -82,6 +82,11 @@ the type arguments are not used.
 Chase the signature(s) of 'name' to a known key or as high up in
 the tree as possible.
 
+.TP
+\fB\-I  \fIIPv4 or IPv6 address\fR
+Source address to query from.  The source address has to be present
+on an interface of the host running drill.
+
 .TP
 \fB\-V \fIlevel\fR
 Be more verbose. Set level to 5 to see the actual query that is sent.
@@ -217,6 +222,12 @@ specify named base64 tsig key, and optional an algorithm (defaults to hmac-md5.s
 \fB\-z \fR
 don't randomize the nameserver list before sending queries.
 
+.SH "EXIT STATUS"
+The exit status is 0 if the looked up answer is secure and trusted,
+or insecure.
+The exit status is not 0 if the looked up answer is untrusted or bogus,
+or an error occurred while performing the lookup.
+
 .SH "FILES"
 .TP
 @LDNS_TRUST_ANCHOR_FILE@
diff --git a/contrib/ldns/drill/drill.c b/contrib/ldns/drill/drill.c
index 574c8b98c85..b967ad949c8 100644
--- a/contrib/ldns/drill/drill.c
+++ b/contrib/ldns/drill/drill.c
@@ -33,6 +33,7 @@ usage(FILE *stream, const char *progname)
 	fprintf(stream, "\t-T\t\ttrace from the root down to \n");
 	fprintf(stream, "\t-S\t\tchase signature(s) from  to a know key [*]\n");
 #endif /*HAVE_SSL*/
+	fprintf(stream, "\t-I 
\tsource address to query from\n"); fprintf(stream, "\t-V \tverbosity (0-5)\n"); fprintf(stream, "\t-Q\t\tquiet mode (overrules -V)\n"); fprintf(stream, "\n"); @@ -103,6 +104,7 @@ main(int argc, char *argv[]) ldns_pkt *pkt; ldns_pkt *qpkt; char *serv; + char *src = NULL; const char *name; char *name2; char *progname; @@ -110,6 +112,7 @@ main(int argc, char *argv[]) char *answer_file = NULL; ldns_buffer *query_buffer = NULL; ldns_rdf *serv_rdf; + ldns_rdf *src_rdf = NULL; ldns_rr_type type; ldns_rr_class clas; #if 0 @@ -157,7 +160,7 @@ main(int argc, char *argv[]) int_type = -1; serv = NULL; type = 0; int_clas = -1; name = NULL; clas = 0; - qname = NULL; + qname = NULL; src = NULL; progname = strdup(argv[0]); #ifdef USE_WINSOCK @@ -195,7 +198,7 @@ main(int argc, char *argv[]) /* global first, query opt next, option with parm's last * and sorted */ /* "46DITSVQf:i:w:q:achuvxzy:so:p:b:k:" */ - while ((c = getopt(argc, argv, "46ab:c:d:Df:hi:Ik:o:p:q:Qr:sStTuvV:w:xy:z")) != -1) { + while ((c = getopt(argc, argv, "46ab:c:d:Df:hi:I:k:o:p:q:Qr:sStTuvV:w:xy:z")) != -1) { switch(c) { /* global options */ case '4': @@ -208,7 +211,7 @@ main(int argc, char *argv[]) qdnssec = true; break; case 'I': - /* reserved for backward compatibility */ + src = optarg; break; case 'T': if (PURPOSE == DRILL_CHASE) { @@ -482,6 +485,14 @@ main(int argc, char *argv[]) } } + if (src) { + src_rdf = ldns_rdf_new_addr_frm_str(src); + if(!src_rdf) { + fprintf(stderr, "-I must be (or resolve) to a valid IP[v6] address.\n"); + exit(EXIT_FAILURE); + } + } + /* set the nameserver to use */ if (!serv) { /* no server given make a resolver from /etc/resolv.conf */ @@ -513,6 +524,7 @@ main(int argc, char *argv[]) ldns_resolver_set_ip6(cmdline_res, qfamily); ldns_resolver_set_fallback(cmdline_res, qfallback); ldns_resolver_set_usevc(cmdline_res, qusevc); + ldns_resolver_set_source(cmdline_res, src_rdf); cmdline_dname = ldns_dname_new_frm_str(serv); @@ -543,6 +555,7 @@ main(int argc, char *argv[]) } /* set the resolver options */ ldns_resolver_set_port(res, qport); + ldns_resolver_set_source(res, src_rdf); if (verbosity >= 5) { ldns_resolver_set_debug(res, true); } else { @@ -613,10 +626,17 @@ main(int argc, char *argv[]) ldns_resolver_set_dnssec_cd(res, true); /* set dnssec implies udp_size of 4096 */ ldns_resolver_set_edns_udp_size(res, 4096); - pkt = ldns_resolver_query(res, qname, type, clas, qflags); - + pkt = NULL; + status = ldns_resolver_query_status( + &pkt, res, qname, type, clas, qflags); + if (status != LDNS_STATUS_OK) { + error("error sending query: %s", + ldns_get_errorstr_by_id(status)); + } if (!pkt) { - error("%s", "error pkt sending"); + if (status == LDNS_STATUS_OK) { + error("%s", "error pkt sending"); + } result = EXIT_FAILURE; } else { if (verbosity >= 3) { @@ -742,9 +762,17 @@ main(int argc, char *argv[]) } /* create a packet and set the RD flag on it */ - pkt = ldns_resolver_query(res, qname, type, clas, qflags); + pkt = NULL; + status = ldns_resolver_query_status( + &pkt, res, qname, type, clas, qflags); + if (status != LDNS_STATUS_OK) { + error("error sending query: %s", + ldns_get_errorstr_by_id(status)); + } if (!pkt) { - error("%s", "pkt sending"); + if (status == LDNS_STATUS_OK) { + error("%s", "pkt sending"); + } result = EXIT_FAILURE; } else { if (verbosity != -1) { @@ -815,7 +843,15 @@ main(int argc, char *argv[]) goto exit; } else { /* create a packet and set the RD flag on it */ - pkt = ldns_resolver_query(res, qname, type, clas, qflags); + pkt = NULL; + status = ldns_resolver_query_status( + &pkt, res, qname, + type, clas, qflags); + if (status != LDNS_STATUS_OK) { + error("error sending query: %s" + , ldns_get_errorstr_by_id( + status)); + } } } @@ -926,6 +962,7 @@ main(int argc, char *argv[]) exit: ldns_rdf_deep_free(qname); + ldns_rdf_deep_free(src_rdf); ldns_resolver_deep_free(res); ldns_resolver_deep_free(cmdline_res); ldns_rr_list_deep_free(key_list); diff --git a/contrib/ldns/drill/drill_util.c b/contrib/ldns/drill/drill_util.c index db0433e77e1..9cf90a50ff0 100644 --- a/contrib/ldns/drill/drill_util.c +++ b/contrib/ldns/drill/drill_util.c @@ -17,10 +17,10 @@ static int read_line(FILE *input, char *line, size_t len) { int i; - - char c; + int c; + for (i = 0; i < (int)len-1; i++) { - c = (char)getc(input); + c = getc(input); if (c == EOF) { return -1; } else if (c != '\n') { diff --git a/contrib/ldns/drill/securetrace.c b/contrib/ldns/drill/securetrace.c index c6e7e588409..5fc493a7275 100644 --- a/contrib/ldns/drill/securetrace.c +++ b/contrib/ldns/drill/securetrace.c @@ -138,7 +138,7 @@ do_secure_trace(ldns_resolver *local_res, ldns_rdf *name, ldns_rr_type t, size_t j; size_t k; size_t l; - uint8_t labels_count; + uint8_t labels_count = 0; /* dnssec */ ldns_rr_list *key_list; @@ -156,6 +156,9 @@ do_secure_trace(ldns_resolver *local_res, ldns_rdf *name, ldns_rr_type t, /* empty non-terminal check */ bool ent; + ldns_rr *nsecrr; /* The nsec that proofs the non-terminal */ + ldns_rdf *hashed_name; /* The query hashed with nsec3 params */ + ldns_rdf *label0; /* The first label of an nsec3 owner name */ /* glue handling */ ldns_rr_list *new_ns_addr; @@ -220,6 +223,8 @@ do_secure_trace(ldns_resolver *local_res, ldns_rdf *name, ldns_rr_type t, ldns_resolver_usevc(local_res)); ldns_resolver_set_random(res, ldns_resolver_random(local_res)); + ldns_resolver_set_source(res, + ldns_resolver_source(local_res)); ldns_resolver_set_recursive(local_res, true); ldns_resolver_set_recursive(res, false); @@ -380,8 +385,27 @@ do_secure_trace(ldns_resolver *local_res, ldns_rdf *name, ldns_rr_type t, /* there might be an empty non-terminal, in which case we need to continue */ ent = false; for (j = 0; j < ldns_rr_list_rr_count(nsec_rrs); j++) { - if (ldns_dname_is_subdomain(ldns_rr_rdf(ldns_rr_list_rr(nsec_rrs, j), 0), labels[i])) { + nsecrr = ldns_rr_list_rr(nsec_rrs, j); + /* For NSEC when the next name is a subdomain of the question */ + if (ldns_rr_get_type(nsecrr) == LDNS_RR_TYPE_NSEC && + ldns_dname_is_subdomain(ldns_rr_rdf(nsecrr, 0), labels[i])) { ent = true; + + /* For NSEC3, the hash matches the name and the type bitmap is empty*/ + } else if (ldns_rr_get_type(nsecrr) == LDNS_RR_TYPE_NSEC3) { + hashed_name = ldns_nsec3_hash_name_frm_nsec3(nsecrr, labels[i]); + label0 = ldns_dname_label(ldns_rr_owner(nsecrr), 0); + if (hashed_name && label0 && + ldns_dname_compare(hashed_name, label0) == 0 && + ldns_nsec3_bitmap(nsecrr) == NULL) { + ent = true; + } + if (label0) { + LDNS_FREE(label0); + } + if (hashed_name) { + LDNS_FREE(hashed_name); + } } } if (!ent) { diff --git a/contrib/ldns/drill/work.c b/contrib/ldns/drill/work.c index 653145fe522..370d48b01b3 100644 --- a/contrib/ldns/drill/work.c +++ b/contrib/ldns/drill/work.c @@ -235,6 +235,7 @@ dump_hex(const ldns_pkt *pkt, const char *filename) if (status != LDNS_STATUS_OK) { error("Unable to convert packet: error code %u", status); LDNS_FREE(wire); + fclose(fp); return; } diff --git a/contrib/ldns/error.c b/contrib/ldns/error.c index 2fc63e9b099..82ea61a1dcc 100644 --- a/contrib/ldns/error.c +++ b/contrib/ldns/error.c @@ -65,6 +65,7 @@ ldns_lookup_table ldns_error_str[] = { { LDNS_STATUS_WIRE_INCOMPLETE_AUTHORITY, "authority section incomplete" }, { LDNS_STATUS_WIRE_INCOMPLETE_ADDITIONAL, "additional section incomplete" }, { LDNS_STATUS_NO_DATA, "No data" }, + { LDNS_STATUS_EXISTS_ERR, "Element already exists" }, { LDNS_STATUS_CERT_BAD_ALGORITHM, "Bad algorithm type for CERT record" }, { LDNS_STATUS_SYNTAX_TYPE_ERR, "Syntax error, could not parse the RR's type" }, { LDNS_STATUS_SYNTAX_CLASS_ERR, "Syntax error, could not parse the RR's class" }, @@ -124,6 +125,24 @@ ldns_lookup_table ldns_error_str[] = { { LDNS_STATUS_DANE_PKIX_NO_SELF_SIGNED_TRUST_ANCHOR, "The validation path " "did not end in a self-signed certificate" }, + { LDNS_STATUS_INVALID_ILNP64, + "Conversion error, 4 colon separated hex numbers expected" }, + { LDNS_STATUS_INVALID_EUI48, + "Conversion error, 6 two character hex numbers " + "separated by dashes expected (i.e. xx-xx-xx-xx-xx-xx" }, + { LDNS_STATUS_INVALID_EUI64, + "Conversion error, 8 two character hex numbers " + "separated by dashes expected (i.e. xx-xx-xx-xx-xx-xx-xx-xx" }, + { LDNS_STATUS_WIRE_RDATA_ERR, "invalid rdata in wire format" }, + { LDNS_STATUS_INVALID_TAG, + "Conversion error, a non-zero sequence of US-ASCII letters " + "and numbers in lower case expected" }, + { LDNS_STATUS_TYPE_NOT_IN_BITMAP, + "The RR type bitmap rdata field did not have " + "a bit reserved for the specific RR type" }, + { LDNS_STATUS_INVALID_RDF_TYPE, + "The rdata field was not of the expected type" }, + { LDNS_STATUS_RDATA_OVERFLOW, "Rdata size overflow" }, { 0, NULL } }; diff --git a/contrib/ldns/higher.c b/contrib/ldns/higher.c index 990fb6afb25..8ce86a41d56 100644 --- a/contrib/ldns/higher.c +++ b/contrib/ldns/higher.c @@ -131,6 +131,7 @@ ldns_get_rr_list_name_by_addr(ldns_resolver *res, ldns_rdf *addr, ldns_rr_class /* extract the data we need */ names = ldns_pkt_rr_list_by_type(pkt, LDNS_RR_TYPE_PTR, LDNS_SECTION_ANSWER); + ldns_pkt_free(pkt); } return names; } @@ -303,39 +304,21 @@ ldns_getaddrinfo(ldns_resolver *res, ldns_rdf *node, ldns_rr_class c, bool ldns_nsec_type_check(ldns_rr *nsec, ldns_rr_type t) { - /* does the nsec cover the t given? */ - /* copied from host2str.c line 465: ldns_rdf2buffer_str_nsec */ - uint8_t window_block_nr; - uint8_t bitmap_length; - uint16_t type; - uint16_t pos = 0; - uint16_t bit_pos; - ldns_rdf *nsec_type_list = ldns_rr_rdf(nsec, 1); - uint8_t *data; - - if (nsec_type_list == NULL) { - return false; + switch (ldns_rr_get_type(nsec)) { + case LDNS_RR_TYPE_NSEC : if (ldns_rr_rd_count(nsec) < 2) { + return false; + } + return ldns_nsec_bitmap_covers_type( + ldns_rr_rdf(nsec, 1), t); + + case LDNS_RR_TYPE_NSEC3 : if (ldns_rr_rd_count(nsec) < 6) { + return false; + } + return ldns_nsec_bitmap_covers_type( + ldns_rr_rdf(nsec, 5), t); + + default : return false; } - data = ldns_rdf_data(nsec_type_list); - - while(pos < ldns_rdf_size(nsec_type_list)) { - window_block_nr = data[pos]; - bitmap_length = data[pos + 1]; - pos += 2; - - for (bit_pos = 0; bit_pos < (bitmap_length) * 8; bit_pos++) { - if (ldns_get_bit(&data[pos], bit_pos)) { - type = 256 * (uint16_t) window_block_nr + bit_pos; - - if ((ldns_rr_type)type == t) { - /* we have a winner */ - return true; - } - } - } - pos += (uint16_t) bitmap_length; - } - return false; } void @@ -358,3 +341,4 @@ ldns_print_rr_rdf(FILE *fp, ldns_rr *r, int rdfnum, ...) } va_end(va_rdf); } + diff --git a/contrib/ldns/host2str.c b/contrib/ldns/host2str.c index cddf6da2e7a..0b65cb4c892 100644 --- a/contrib/ldns/host2str.c +++ b/contrib/ldns/host2str.c @@ -130,6 +130,55 @@ const ldns_output_format ldns_output_format_bubblebabble_record = { const ldns_output_format *ldns_output_format_bubblebabble = &ldns_output_format_bubblebabble_record; +static bool +ldns_output_format_covers_type(const ldns_output_format* fmt, ldns_rr_type t) +{ + return fmt && (fmt->flags & LDNS_FMT_RFC3597) && + ((ldns_output_format_storage*)fmt)->bitmap && + ldns_nsec_bitmap_covers_type( + ((ldns_output_format_storage*)fmt)->bitmap, t); +} + +ldns_status +ldns_output_format_set_type(ldns_output_format* fmt, ldns_rr_type t) +{ + ldns_output_format_storage* fmt_st = (ldns_output_format_storage*)fmt; + ldns_status s; + + assert(fmt != NULL); + + if (!(fmt_st->flags & LDNS_FMT_RFC3597)) { + ldns_output_format_set(fmt, LDNS_FMT_RFC3597); + } + if (! fmt_st->bitmap) { + s = ldns_rdf_bitmap_known_rr_types_space(&fmt_st->bitmap); + if (s != LDNS_STATUS_OK) { + return s; + } + } + return ldns_nsec_bitmap_set_type(fmt_st->bitmap, t); +} + +ldns_status +ldns_output_format_clear_type(ldns_output_format* fmt, ldns_rr_type t) +{ + ldns_output_format_storage* fmt_st = (ldns_output_format_storage*)fmt; + ldns_status s; + + assert(fmt != NULL); + + if (!(fmt_st->flags & LDNS_FMT_RFC3597)) { + ldns_output_format_set(fmt, LDNS_FMT_RFC3597); + } + if (! fmt_st->bitmap) { + s = ldns_rdf_bitmap_known_rr_types(&fmt_st->bitmap); + if (s != LDNS_STATUS_OK) { + return s; + } + } + return ldns_nsec_bitmap_clear_type(fmt_st->bitmap, t); +} + ldns_status ldns_pkt_opcode2buffer_str(ldns_buffer *output, ldns_pkt_opcode opcode) { @@ -381,18 +430,15 @@ ldns_rdf2buffer_str_aaaa(ldns_buffer *output, const ldns_rdf *rdf) return ldns_buffer_status(output); } -ldns_status -ldns_rdf2buffer_str_str(ldns_buffer *output, const ldns_rdf *rdf) +static void +ldns_characters2buffer_str(ldns_buffer* output, + size_t amount, const uint8_t* characters) { - const uint8_t *data = ldns_rdf_data(rdf); - uint8_t length = data[0]; - size_t i; - - ldns_buffer_printf(output, "\""); - for (i = 1; i <= length; ++i) { - char ch = (char) data[i]; - if (isprint((int)ch) || ch=='\t') { - if (ch=='\"'||ch=='\\') + uint8_t ch; + while (amount > 0) { + ch = *characters++; + if (isprint((int)ch) || ch == '\t') { + if (ch == '\"' || ch == '\\') ldns_buffer_printf(output, "\\%c", ch); else ldns_buffer_printf(output, "%c", ch); @@ -400,7 +446,22 @@ ldns_rdf2buffer_str_str(ldns_buffer *output, const ldns_rdf *rdf) ldns_buffer_printf(output, "\\%03u", (unsigned)(uint8_t) ch); } + amount--; } +} + +ldns_status +ldns_rdf2buffer_str_str(ldns_buffer *output, const ldns_rdf *rdf) +{ + if(ldns_rdf_size(rdf) < 1) { + return LDNS_STATUS_WIRE_RDATA_ERR; + } + if((int)ldns_rdf_size(rdf) < (int)ldns_rdf_data(rdf)[0] + 1) { + return LDNS_STATUS_WIRE_RDATA_ERR; + } + ldns_buffer_printf(output, "\""); + ldns_characters2buffer_str(output, + ldns_rdf_data(rdf)[0], ldns_rdf_data(rdf) + 1); ldns_buffer_printf(output, "\""); return ldns_buffer_status(output); } @@ -450,19 +511,28 @@ ldns_rdf2buffer_str_hex(ldns_buffer *output, const ldns_rdf *rdf) return ldns_buffer_status(output); } -ldns_status -ldns_rdf2buffer_str_type(ldns_buffer *output, const ldns_rdf *rdf) +static ldns_status +ldns_rdf2buffer_str_type_fmt(ldns_buffer *output, + const ldns_output_format* fmt, const ldns_rdf *rdf) { uint16_t data = ldns_read_uint16(ldns_rdf_data(rdf)); - const ldns_rr_descriptor *descriptor; - descriptor = ldns_rr_descript(data); - if (descriptor && descriptor->_name) { - ldns_buffer_printf(output, "%s", descriptor->_name); + if (! ldns_output_format_covers_type(fmt, data) && + ldns_rr_descript(data) && + ldns_rr_descript(data)->_name) { + + ldns_buffer_printf(output, "%s",ldns_rr_descript(data)->_name); } else { ldns_buffer_printf(output, "TYPE%u", data); } - return ldns_buffer_status(output); + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_type(ldns_buffer *output, const ldns_rdf *rdf) +{ + return ldns_rdf2buffer_str_type_fmt(output, + ldns_output_format_default, rdf); } ldns_status @@ -614,7 +684,7 @@ ldns_status ldns_rdf2buffer_str_loc(ldns_buffer *output, const ldns_rdf *rdf) { /* we could do checking (ie degrees < 90 etc)? */ - uint8_t version = ldns_rdf_data(rdf)[0]; + uint8_t version; uint8_t size; uint8_t horizontal_precision; uint8_t vertical_precision; @@ -629,7 +699,14 @@ ldns_rdf2buffer_str_loc(ldns_buffer *output, const ldns_rdf *rdf) uint32_t equator = (uint32_t) ldns_power(2, 31); + if(ldns_rdf_size(rdf) < 1) { + return LDNS_STATUS_WIRE_RDATA_ERR; + } + version = ldns_rdf_data(rdf)[0]; if (version == 0) { + if(ldns_rdf_size(rdf) < 16) { + return LDNS_STATUS_WIRE_RDATA_ERR; + } size = ldns_rdf_data(rdf)[1]; horizontal_precision = ldns_rdf_data(rdf)[2]; vertical_precision = ldns_rdf_data(rdf)[3]; @@ -669,12 +746,12 @@ ldns_rdf2buffer_str_loc(ldns_buffer *output, const ldns_rdf *rdf) h, m, s, easterness); - s = ((double) altitude) / 100; - s -= 100000; + s = ((double) altitude) / 100; + s -= 100000; if(altitude%100 != 0) ldns_buffer_printf(output, "%.2f", s); - else + else ldns_buffer_printf(output, "%.0f", s); ldns_buffer_printf(output, "m "); @@ -726,6 +803,9 @@ ldns_rdf2buffer_str_wks(ldns_buffer *output, const ldns_rdf *rdf) struct servent *service; uint16_t current_service; + if(ldns_rdf_size(rdf) < 1) { + return LDNS_STATUS_WIRE_RDATA_ERR; + } protocol_nr = ldns_rdf_data(rdf)[0]; protocol = getprotobynumber((int) protocol_nr); if (protocol && (protocol->p_name != NULL)) { @@ -757,8 +837,9 @@ ldns_rdf2buffer_str_wks(ldns_buffer *output, const ldns_rdf *rdf) return ldns_buffer_status(output); } -ldns_status -ldns_rdf2buffer_str_nsec(ldns_buffer *output, const ldns_rdf *rdf) +static ldns_status +ldns_rdf2buffer_str_nsec_fmt(ldns_buffer *output, + const ldns_output_format* fmt, const ldns_rdf *rdf) { /* Note: this code is duplicated in higher.c in * ldns_nsec_type_check() function @@ -769,33 +850,42 @@ ldns_rdf2buffer_str_nsec(ldns_buffer *output, const ldns_rdf *rdf) uint16_t pos = 0; uint16_t bit_pos; uint8_t *data = ldns_rdf_data(rdf); - const ldns_rr_descriptor *descriptor; - while(pos < ldns_rdf_size(rdf)) { + while((size_t)(pos + 2) < ldns_rdf_size(rdf)) { window_block_nr = data[pos]; bitmap_length = data[pos + 1]; pos += 2; - + if (ldns_rdf_size(rdf) < pos + bitmap_length) { + return LDNS_STATUS_WIRE_RDATA_ERR; + } for (bit_pos = 0; bit_pos < (bitmap_length) * 8; bit_pos++) { - if (ldns_get_bit(&data[pos], bit_pos)) { - type = 256 * (uint16_t) window_block_nr + bit_pos; - descriptor = ldns_rr_descript(type); + if (! ldns_get_bit(&data[pos], bit_pos)) { + continue; + } + type = 256 * (uint16_t) window_block_nr + bit_pos; - if (descriptor && descriptor->_name) { - ldns_buffer_printf(output, "%s ", - descriptor->_name); - } else { - ldns_buffer_printf(output, "TYPE%u ", type); - } + if (! ldns_output_format_covers_type(fmt, type) && + ldns_rr_descript(type) && + ldns_rr_descript(type)->_name){ + + ldns_buffer_printf(output, "%s ", + ldns_rr_descript(type)->_name); + } else { + ldns_buffer_printf(output, "TYPE%u ", type); } } - pos += (uint16_t) bitmap_length; } - return ldns_buffer_status(output); } +ldns_status +ldns_rdf2buffer_str_nsec(ldns_buffer *output, const ldns_rdf *rdf) +{ + return ldns_rdf2buffer_str_nsec_fmt(output, + ldns_output_format_default, rdf); +} + ldns_status ldns_rdf2buffer_str_nsec3_salt(ldns_buffer *output, const ldns_rdf *rdf) { @@ -804,9 +894,8 @@ ldns_rdf2buffer_str_nsec3_salt(ldns_buffer *output, const ldns_rdf *rdf) uint8_t *data = ldns_rdf_data(rdf); - if(ldns_rdf_size(rdf) == 0) { - output->_status = LDNS_STATUS_ERR; - return ldns_buffer_status(output); + if(ldns_rdf_size(rdf) < 1) { + return LDNS_STATUS_WIRE_RDATA_ERR; } salt_length = data[0]; /* from now there are variable length entries so remember pos */ @@ -826,8 +915,10 @@ ldns_status ldns_rdf2buffer_str_period(ldns_buffer *output, const ldns_rdf *rdf) { /* period is the number of seconds */ - uint32_t p = ldns_read_uint32(ldns_rdf_data(rdf)); - ldns_buffer_printf(output, "%u", p); + if (ldns_rdf_size(rdf) != 4) { + return LDNS_STATUS_WIRE_RDATA_ERR; + } + ldns_buffer_printf(output, "%u", ldns_read_uint32(ldns_rdf_data(rdf))); return ldns_buffer_status(output); } @@ -837,17 +928,20 @@ ldns_rdf2buffer_str_tsigtime(ldns_buffer *output,const ldns_rdf *rdf) /* tsigtime is 48 bits network order unsigned integer */ uint64_t tsigtime = 0; uint8_t *data = ldns_rdf_data(rdf); + uint64_t d0, d1, d2, d3, d4, d5; - if (ldns_rdf_size(rdf) != 6) { - return LDNS_STATUS_ERR; + if (ldns_rdf_size(rdf) < 6) { + return LDNS_STATUS_WIRE_RDATA_ERR; } + d0 = data[0]; /* cast to uint64 for shift operations */ + d1 = data[1]; + d2 = data[2]; + d3 = data[3]; + d4 = data[4]; + d5 = data[5]; + tsigtime = (d0<<40) | (d1<<32) | (d2<<24) | (d3<<16) | (d4<<8) | d5; - tsigtime = ldns_read_uint16(data); - tsigtime *= 65536; - tsigtime += ldns_read_uint16(data+2); - tsigtime *= 65536; - - ldns_buffer_printf(output, "%llu ", tsigtime); + ldns_buffer_printf(output, "%llu ", (long long)tsigtime); return ldns_buffer_status(output); } @@ -865,7 +959,7 @@ ldns_rdf2buffer_str_apl(ldns_buffer *output, const ldns_rdf *rdf) while (pos < (unsigned int) ldns_rdf_size(rdf)) { if(pos + 3 >= (unsigned)ldns_rdf_size(rdf)) - return LDNS_STATUS_SYNTAX_RDATA_ERR; + return LDNS_STATUS_WIRE_RDATA_ERR; address_family = ldns_read_uint16(&data[pos]); prefix = data[pos + 2]; negation = data[pos + 3] & LDNS_APL_NEGATION; @@ -883,7 +977,7 @@ ldns_rdf2buffer_str_apl(ldns_buffer *output, const ldns_rdf *rdf) } if (i < (unsigned short) adf_length) { if(pos+i+4 >= ldns_rdf_size(rdf)) - return LDNS_STATUS_SYNTAX_RDATA_ERR; + return LDNS_STATUS_WIRE_RDATA_ERR; ldns_buffer_printf(output, "%d", data[pos + i + 4]); } else { @@ -904,7 +998,7 @@ ldns_rdf2buffer_str_apl(ldns_buffer *output, const ldns_rdf *rdf) } if (i < (unsigned short) adf_length) { if(pos+i+4 >= ldns_rdf_size(rdf)) - return LDNS_STATUS_SYNTAX_RDATA_ERR; + return LDNS_STATUS_WIRE_RDATA_ERR; ldns_buffer_printf(output, "%02x", data[pos + i + 4]); } else { @@ -915,11 +1009,12 @@ ldns_rdf2buffer_str_apl(ldns_buffer *output, const ldns_rdf *rdf) } else { /* unknown address family */ - ldns_buffer_printf(output, "Unknown address family: %u data: ", + ldns_buffer_printf(output, + "Unknown address family: %u data: ", address_family); for (i = 1; i < (unsigned short) (4 + adf_length); i++) { if(pos+i >= ldns_rdf_size(rdf)) - return LDNS_STATUS_SYNTAX_RDATA_ERR; + return LDNS_STATUS_WIRE_RDATA_ERR; ldns_buffer_printf(output, "%02x", data[i]); } } @@ -931,21 +1026,27 @@ ldns_rdf2buffer_str_apl(ldns_buffer *output, const ldns_rdf *rdf) ldns_status ldns_rdf2buffer_str_int16_data(ldns_buffer *output, const ldns_rdf *rdf) { - /* Subtract the size (2) of the number that specifies the length */ - size_t size = ldns_b64_ntop_calculate_size(ldns_rdf_size(rdf) - 2); - char *b64 = LDNS_XMALLOC(char, size); - if(!b64) - return LDNS_STATUS_MEM_ERR; - - ldns_buffer_printf(output, "%u ", ldns_rdf_size(rdf) - 2); - - if (ldns_rdf_size(rdf) > 2 && - ldns_b64_ntop(ldns_rdf_data(rdf) + 2, - ldns_rdf_size(rdf) - 2, - b64, size)) { - ldns_buffer_printf(output, "%s", b64); + size_t size; + char *b64; + if (ldns_rdf_size(rdf) < 2) { + return LDNS_STATUS_WIRE_RDATA_ERR; + } + /* Subtract the size (2) of the number that specifies the length */ + size = ldns_b64_ntop_calculate_size(ldns_rdf_size(rdf) - 2); + ldns_buffer_printf(output, "%u ", ldns_rdf_size(rdf) - 2); + if (ldns_rdf_size(rdf) > 2) { + b64 = LDNS_XMALLOC(char, size); + if(!b64) + return LDNS_STATUS_MEM_ERR; + + if (ldns_rdf_size(rdf) > 2 && + ldns_b64_ntop(ldns_rdf_data(rdf) + 2, + ldns_rdf_size(rdf) - 2, + b64, size)) { + ldns_buffer_printf(output, "%s", b64); + } + LDNS_FREE(b64); } - LDNS_FREE(b64); return ldns_buffer_status(output); } @@ -970,6 +1071,9 @@ ldns_rdf2buffer_str_ipseckey(ldns_buffer *output, const ldns_rdf *rdf) size_t offset = 0; ldns_status status; + if (ldns_rdf_size(rdf) < 3) { + return LDNS_STATUS_WIRE_RDATA_ERR; + } precedence = data[0]; gateway_type = data[1]; algorithm = data[2]; @@ -983,8 +1087,12 @@ ldns_rdf2buffer_str_ipseckey(ldns_buffer *output, const ldns_rdf *rdf) gateway_data = LDNS_XMALLOC(uint8_t, LDNS_IP4ADDRLEN); if(!gateway_data) return LDNS_STATUS_MEM_ERR; + if (ldns_rdf_size(rdf) < offset + LDNS_IP4ADDRLEN) { + return LDNS_STATUS_ERR; + } memcpy(gateway_data, &data[offset], LDNS_IP4ADDRLEN); - gateway = ldns_rdf_new(LDNS_RDF_TYPE_A, LDNS_IP4ADDRLEN , gateway_data); + gateway = ldns_rdf_new(LDNS_RDF_TYPE_A, + LDNS_IP4ADDRLEN , gateway_data); offset += LDNS_IP4ADDRLEN; if(!gateway) { LDNS_FREE(gateway_data); @@ -995,17 +1103,22 @@ ldns_rdf2buffer_str_ipseckey(ldns_buffer *output, const ldns_rdf *rdf) gateway_data = LDNS_XMALLOC(uint8_t, LDNS_IP6ADDRLEN); if(!gateway_data) return LDNS_STATUS_MEM_ERR; + if (ldns_rdf_size(rdf) < offset + LDNS_IP6ADDRLEN) { + return LDNS_STATUS_ERR; + } memcpy(gateway_data, &data[offset], LDNS_IP6ADDRLEN); offset += LDNS_IP6ADDRLEN; gateway = - ldns_rdf_new(LDNS_RDF_TYPE_AAAA, LDNS_IP6ADDRLEN, gateway_data); + ldns_rdf_new(LDNS_RDF_TYPE_AAAA, + LDNS_IP6ADDRLEN, gateway_data); if(!gateway) { LDNS_FREE(gateway_data); return LDNS_STATUS_MEM_ERR; } break; case 3: - status = ldns_wire2dname(&gateway, data, ldns_rdf_size(rdf), &offset); + status = ldns_wire2dname(&gateway, data, + ldns_rdf_size(rdf), &offset); if(status != LDNS_STATUS_OK) return status; break; @@ -1014,6 +1127,9 @@ ldns_rdf2buffer_str_ipseckey(ldns_buffer *output, const ldns_rdf *rdf) break; } + if (ldns_rdf_size(rdf) <= offset) { + return LDNS_STATUS_ERR; + } public_key_size = ldns_rdf_size(rdf) - offset; public_key_data = LDNS_XMALLOC(uint8_t, public_key_size); if(!public_key_data) { @@ -1021,7 +1137,8 @@ ldns_rdf2buffer_str_ipseckey(ldns_buffer *output, const ldns_rdf *rdf) return LDNS_STATUS_MEM_ERR; } memcpy(public_key_data, &data[offset], public_key_size); - public_key = ldns_rdf_new(LDNS_RDF_TYPE_B64, public_key_size, public_key_data); + public_key = ldns_rdf_new(LDNS_RDF_TYPE_B64, + public_key_size, public_key_data); if(!public_key) { LDNS_FREE(public_key_data); ldns_rdf_free(gateway); @@ -1029,7 +1146,7 @@ ldns_rdf2buffer_str_ipseckey(ldns_buffer *output, const ldns_rdf *rdf) } ldns_buffer_printf(output, "%u %u %u ", precedence, gateway_type, algorithm); - if (gateway) + if (gateway) (void) ldns_rdf2buffer_str(output, gateway); else ldns_buffer_printf(output, "."); @@ -1043,15 +1160,129 @@ ldns_rdf2buffer_str_ipseckey(ldns_buffer *output, const ldns_rdf *rdf) } ldns_status -ldns_rdf2buffer_str_tsig(ldns_buffer *output, const ldns_rdf *rdf) +ldns_rdf2buffer_str_ilnp64(ldns_buffer *output, const ldns_rdf *rdf) { - /* TSIG RRs have no presentation format, make them #size */ - return ldns_rdf2buffer_str_unknown(output, rdf); + if (ldns_rdf_size(rdf) != 8) { + return LDNS_STATUS_WIRE_RDATA_ERR; + } + ldns_buffer_printf(output,"%.4x:%.4x:%.4x:%.4x", + ldns_read_uint16(ldns_rdf_data(rdf)), + ldns_read_uint16(ldns_rdf_data(rdf)+2), + ldns_read_uint16(ldns_rdf_data(rdf)+4), + ldns_read_uint16(ldns_rdf_data(rdf)+6)); + return ldns_buffer_status(output); } +ldns_status +ldns_rdf2buffer_str_eui48(ldns_buffer *output, const ldns_rdf *rdf) +{ + if (ldns_rdf_size(rdf) != 6) { + return LDNS_STATUS_WIRE_RDATA_ERR; + } + ldns_buffer_printf(output,"%.2x-%.2x-%.2x-%.2x-%.2x-%.2x", + ldns_rdf_data(rdf)[0], ldns_rdf_data(rdf)[1], + ldns_rdf_data(rdf)[2], ldns_rdf_data(rdf)[3], + ldns_rdf_data(rdf)[4], ldns_rdf_data(rdf)[5]); + return ldns_buffer_status(output); +} ldns_status -ldns_rdf2buffer_str(ldns_buffer *buffer, const ldns_rdf *rdf) +ldns_rdf2buffer_str_eui64(ldns_buffer *output, const ldns_rdf *rdf) +{ + if (ldns_rdf_size(rdf) != 8) { + return LDNS_STATUS_WIRE_RDATA_ERR; + } + ldns_buffer_printf(output,"%.2x-%.2x-%.2x-%.2x-%.2x-%.2x-%.2x-%.2x", + ldns_rdf_data(rdf)[0], ldns_rdf_data(rdf)[1], + ldns_rdf_data(rdf)[2], ldns_rdf_data(rdf)[3], + ldns_rdf_data(rdf)[4], ldns_rdf_data(rdf)[5], + ldns_rdf_data(rdf)[6], ldns_rdf_data(rdf)[7]); + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_tag(ldns_buffer *output, const ldns_rdf *rdf) +{ + size_t nchars; + const uint8_t* chars; + char ch; + if (ldns_rdf_size(rdf) < 2) { + return LDNS_STATUS_WIRE_RDATA_ERR; + } + nchars = ldns_rdf_data(rdf)[0]; + if (nchars >= ldns_rdf_size(rdf) || /* should be rdf_size - 1 */ + nchars < 1) { + return LDNS_STATUS_WIRE_RDATA_ERR; + } + chars = ldns_rdf_data(rdf) + 1; + while (nchars > 0) { + ch = (char)*chars++; + if (! isalnum(ch)) { + return LDNS_STATUS_WIRE_RDATA_ERR; + } + ldns_buffer_printf(output, "%c", ch); + nchars--; + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_long_str(ldns_buffer *output, const ldns_rdf *rdf) +{ + + ldns_buffer_printf(output, "\""); + ldns_characters2buffer_str(output, + ldns_rdf_size(rdf), ldns_rdf_data(rdf)); + ldns_buffer_printf(output, "\""); + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_hip(ldns_buffer *output, const ldns_rdf *rdf) +{ + uint8_t *data = ldns_rdf_data(rdf); + size_t rdf_size = ldns_rdf_size(rdf); + uint8_t hit_size; + uint16_t pk_size; + int written; + + if (rdf_size < 6) { + return LDNS_STATUS_WIRE_RDATA_ERR; + } + if ((hit_size = data[0]) == 0 || + (pk_size = ldns_read_uint16(data + 2)) == 0 || + rdf_size < (size_t) hit_size + pk_size + 4) { + + return LDNS_STATUS_WIRE_RDATA_ERR; + } + + ldns_buffer_printf(output, "%d ", (int) data[1]); + + for (data += 4; hit_size > 0; hit_size--, data++) { + + ldns_buffer_printf(output, "%02x", (int) *data); + } + ldns_buffer_write_u8(output, (uint8_t) ' '); + + if (ldns_buffer_reserve(output, + ldns_b64_ntop_calculate_size(pk_size))) { + + written = ldns_b64_ntop(data, pk_size, + (char *) ldns_buffer_current(output), + ldns_buffer_remaining(output)); + + if (written > 0 && + written < (int) ldns_buffer_remaining(output)) { + + output->_position += written; + } + } + return ldns_buffer_status(output); +} + +static ldns_status +ldns_rdf2buffer_str_fmt(ldns_buffer *buffer, + const ldns_output_format* fmt, const ldns_rdf *rdf) { ldns_status res = LDNS_STATUS_OK; @@ -1100,13 +1331,13 @@ ldns_rdf2buffer_str(ldns_buffer *buffer, const ldns_rdf *rdf) res = ldns_rdf2buffer_str_hex(buffer, rdf); break; case LDNS_RDF_TYPE_NSEC: - res = ldns_rdf2buffer_str_nsec(buffer, rdf); + res = ldns_rdf2buffer_str_nsec_fmt(buffer, fmt, rdf); break; case LDNS_RDF_TYPE_NSEC3_SALT: res = ldns_rdf2buffer_str_nsec3_salt(buffer, rdf); break; case LDNS_RDF_TYPE_TYPE: - res = ldns_rdf2buffer_str_type(buffer, rdf); + res = ldns_rdf2buffer_str_type_fmt(buffer, fmt, rdf); break; case LDNS_RDF_TYPE_CLASS: res = ldns_rdf2buffer_str_class(buffer, rdf); @@ -1123,6 +1354,9 @@ ldns_rdf2buffer_str(ldns_buffer *buffer, const ldns_rdf *rdf) case LDNS_RDF_TYPE_TIME: res = ldns_rdf2buffer_str_time(buffer, rdf); break; + case LDNS_RDF_TYPE_HIP: + res = ldns_rdf2buffer_str_hip(buffer, rdf); + break; case LDNS_RDF_TYPE_LOC: res = ldns_rdf2buffer_str_loc(buffer, rdf); break; @@ -1139,15 +1373,27 @@ ldns_rdf2buffer_str(ldns_buffer *buffer, const ldns_rdf *rdf) case LDNS_RDF_TYPE_IPSECKEY: res = ldns_rdf2buffer_str_ipseckey(buffer, rdf); break; - case LDNS_RDF_TYPE_TSIG: - res = ldns_rdf2buffer_str_tsig(buffer, rdf); - break; case LDNS_RDF_TYPE_INT16_DATA: res = ldns_rdf2buffer_str_int16_data(buffer, rdf); break; case LDNS_RDF_TYPE_NSEC3_NEXT_OWNER: res = ldns_rdf2buffer_str_b32_ext(buffer, rdf); break; + case LDNS_RDF_TYPE_ILNP64: + res = ldns_rdf2buffer_str_ilnp64(buffer, rdf); + break; + case LDNS_RDF_TYPE_EUI48: + res = ldns_rdf2buffer_str_eui48(buffer, rdf); + break; + case LDNS_RDF_TYPE_EUI64: + res = ldns_rdf2buffer_str_eui64(buffer, rdf); + break; + case LDNS_RDF_TYPE_TAG: + res = ldns_rdf2buffer_str_tag(buffer, rdf); + break; + case LDNS_RDF_TYPE_LONG_STR: + res = ldns_rdf2buffer_str_long_str(buffer, rdf); + break; } } else { /** This will write mangled RRs */ @@ -1157,6 +1403,12 @@ ldns_rdf2buffer_str(ldns_buffer *buffer, const ldns_rdf *rdf) return res; } +ldns_status +ldns_rdf2buffer_str(ldns_buffer *buffer, const ldns_rdf *rdf) +{ + return ldns_rdf2buffer_str_fmt(buffer,ldns_output_format_default,rdf); +} + static ldns_rdf * ldns_b32_ext2dname(const ldns_rdf *rdf) { @@ -1184,18 +1436,45 @@ ldns_b32_ext2dname(const ldns_rdf *rdf) return NULL; } +static ldns_status +ldns_rr2buffer_str_rfc3597(ldns_buffer *output, const ldns_rr *rr) +{ + size_t total_rdfsize = 0; + size_t i, j; + + ldns_buffer_printf(output, "TYPE%u\t", ldns_rr_get_type(rr)); + for (i = 0; i < ldns_rr_rd_count(rr); i++) { + total_rdfsize += ldns_rdf_size(ldns_rr_rdf(rr, i)); + } + if (total_rdfsize == 0) { + ldns_buffer_printf(output, "\\# 0\n"); + return ldns_buffer_status(output); + } + ldns_buffer_printf(output, "\\# %d ", total_rdfsize); + for (i = 0; i < ldns_rr_rd_count(rr); i++) { + for (j = 0; j < ldns_rdf_size(ldns_rr_rdf(rr, i)); j++) { + ldns_buffer_printf(output, "%.2x", + ldns_rdf_data(ldns_rr_rdf(rr, i))[j]); + } + } + ldns_buffer_printf(output, "\n"); + return ldns_buffer_status(output); +} + ldns_status ldns_rr2buffer_str_fmt(ldns_buffer *output, const ldns_output_format *fmt, const ldns_rr *rr) { uint16_t i, flags; ldns_status status = LDNS_STATUS_OK; + ldns_output_format_storage* fmt_st = (ldns_output_format_storage*)fmt; - if (fmt == NULL) { - fmt = ldns_output_format_default; + if (fmt_st == NULL) { + fmt_st = (ldns_output_format_storage*) + ldns_output_format_default; } if (!rr) { - if (LDNS_COMMENT_NULLS & fmt->flags) { + if (LDNS_COMMENT_NULLS & fmt_st->flags) { ldns_buffer_printf(output, "; (null)\n"); } return ldns_buffer_status(output); @@ -1219,6 +1498,9 @@ ldns_rr2buffer_str_fmt(ldns_buffer *output, } ldns_buffer_printf(output, "\t"); + if (ldns_output_format_covers_type(fmt, ldns_rr_get_type(rr))) { + return ldns_rr2buffer_str_rfc3597(output, rr); + } status = ldns_rr_type2buffer_str(output, ldns_rr_get_type(rr)); if (status != LDNS_STATUS_OK) { return status; @@ -1232,7 +1514,7 @@ ldns_rr2buffer_str_fmt(ldns_buffer *output, for (i = 0; i < ldns_rr_rd_count(rr); i++) { /* ldns_rdf2buffer_str handles NULL input fine! */ - if ((fmt->flags & LDNS_FMT_ZEROIZE_RRSIGS) && + if ((fmt_st->flags & LDNS_FMT_ZEROIZE_RRSIGS) && (ldns_rr_get_type(rr) == LDNS_RR_TYPE_RRSIG) && ((/* inception */ i == 4 && ldns_rdf_get_type(ldns_rr_rdf(rr, 4)) == @@ -1246,7 +1528,7 @@ ldns_rr2buffer_str_fmt(ldns_buffer *output, ldns_buffer_printf(output, "(null)"); status = ldns_buffer_status(output); - } else if ((fmt->flags & LDNS_FMT_PAD_SOA_SERIAL) && + } else if ((fmt_st->flags & LDNS_FMT_PAD_SOA_SERIAL) && (ldns_rr_get_type(rr) == LDNS_RR_TYPE_SOA) && /* serial */ i == 2 && ldns_rdf_get_type(ldns_rr_rdf(rr, 2)) == @@ -1256,8 +1538,8 @@ ldns_rr2buffer_str_fmt(ldns_buffer *output, ldns_rdf_data(ldns_rr_rdf(rr, 2)))); status = ldns_buffer_status(output); } else { - status = ldns_rdf2buffer_str(output, - ldns_rr_rdf(rr, i)); + status = ldns_rdf2buffer_str_fmt(output, + fmt, ldns_rr_rdf(rr, i)); } if(status != LDNS_STATUS_OK) return status; @@ -1270,137 +1552,126 @@ ldns_rr2buffer_str_fmt(ldns_buffer *output, * getting here */ if (ldns_rr_rd_count(rr) > 0) { switch (ldns_rr_get_type(rr)) { - case LDNS_RR_TYPE_DNSKEY: - /* if ldns_rr_rd_count(rr) > 0 - then ldns_rr_rdf(rr, 0) exists! */ - if (! (fmt->flags & LDNS_COMMENT_KEY)) { - break; - } - flags = ldns_rdf2native_int16( - ldns_rr_rdf(rr, 0)); - ldns_buffer_printf(output, " ;{"); - if (fmt->flags & LDNS_COMMENT_KEY_ID) { - ldns_buffer_printf(output, "id = %u", - (unsigned int) - ldns_calc_keytag(rr)); - } - if ((fmt->flags & LDNS_COMMENT_KEY_TYPE) - && (flags & LDNS_KEY_ZONE_KEY)){ - if (flags & LDNS_KEY_SEP_KEY) { - ldns_buffer_printf( - output, " (ksk)"); - } - else { - ldns_buffer_printf( - output, " (zsk)"); - } - if (fmt->flags & LDNS_COMMENT_KEY_SIZE){ - ldns_buffer_printf( - output, ", "); - } - } else if (fmt->flags - & (LDNS_COMMENT_KEY_ID - |LDNS_COMMENT_KEY_SIZE)) { - ldns_buffer_printf( output, ", "); - } - if (fmt->flags & LDNS_COMMENT_KEY_SIZE) { - ldns_buffer_printf(output, "size = %db", - ldns_rr_dnskey_key_size(rr)); - } - ldns_buffer_printf(output, "}"); + case LDNS_RR_TYPE_DNSKEY: + /* if ldns_rr_rd_count(rr) > 0 + then ldns_rr_rdf(rr, 0) exists! */ + if (! (fmt_st->flags & LDNS_COMMENT_KEY)) { break; - case LDNS_RR_TYPE_RRSIG: - if ((fmt->flags & LDNS_COMMENT_KEY) - && (fmt->flags - & LDNS_COMMENT_RRSIGS) - && ldns_rr_rdf(rr, 6) != NULL) { - ldns_buffer_printf(output - , " ;{id = %d}" - , ldns_rdf2native_int16( + } + flags = ldns_rdf2native_int16(ldns_rr_rdf(rr, 0)); + ldns_buffer_printf(output, " ;{"); + if (fmt_st->flags & LDNS_COMMENT_KEY_ID) { + ldns_buffer_printf(output, "id = %u", + (unsigned int) ldns_calc_keytag(rr)); + } + if ((fmt_st->flags & LDNS_COMMENT_KEY_TYPE) && + (flags & LDNS_KEY_ZONE_KEY)){ + + if (flags & LDNS_KEY_SEP_KEY) { + ldns_buffer_printf(output, " (ksk)"); + } else { + ldns_buffer_printf(output, " (zsk)"); + } + if (fmt_st->flags & LDNS_COMMENT_KEY_SIZE){ + ldns_buffer_printf(output, ", "); + } + } else if (fmt_st->flags + & (LDNS_COMMENT_KEY_ID + |LDNS_COMMENT_KEY_SIZE)) { + ldns_buffer_printf( output, ", "); + } + if (fmt_st->flags & LDNS_COMMENT_KEY_SIZE) { + ldns_buffer_printf(output, "size = %db", + ldns_rr_dnskey_key_size(rr)); + } + ldns_buffer_printf(output, "}"); + break; + case LDNS_RR_TYPE_RRSIG: + if ((fmt_st->flags & LDNS_COMMENT_KEY) + && (fmt_st->flags& LDNS_COMMENT_RRSIGS) + && ldns_rr_rdf(rr, 6) != NULL) { + ldns_buffer_printf(output, " ;{id = %d}", + ldns_rdf2native_int16( ldns_rr_rdf(rr, 6))); + } + break; + case LDNS_RR_TYPE_DS: + if ((fmt_st->flags & LDNS_COMMENT_BUBBLEBABBLE) && + ldns_rr_rdf(rr, 3) != NULL) { + + uint8_t *data = ldns_rdf_data( + ldns_rr_rdf(rr, 3)); + size_t len = ldns_rdf_size(ldns_rr_rdf(rr, 3)); + char *babble = ldns_bubblebabble(data, len); + if(babble) { + ldns_buffer_printf(output, + " ;{%s}", babble); } + LDNS_FREE(babble); + } + break; + case LDNS_RR_TYPE_NSEC3: + if (! (fmt_st->flags & LDNS_COMMENT_FLAGS) && + ! (fmt_st->flags & LDNS_COMMENT_NSEC3_CHAIN)) { break; - case LDNS_RR_TYPE_DS: - if ((fmt->flags & LDNS_COMMENT_BUBBLEBABBLE) - && ldns_rr_rdf(rr, 3) != NULL) { - uint8_t *data = ldns_rdf_data( - ldns_rr_rdf(rr, 3)); - size_t len = ldns_rdf_size( - ldns_rr_rdf(rr, 3)); - char *babble = ldns_bubblebabble( - data, len); - if(babble) { - ldns_buffer_printf(output - , " ;{%s}", babble); - } - LDNS_FREE(babble); + } + ldns_buffer_printf(output, " ;{"); + if ((fmt_st->flags & LDNS_COMMENT_FLAGS)) { + if (ldns_nsec3_optout(rr)) { + ldns_buffer_printf(output, + " flags: optout"); + } else { + ldns_buffer_printf(output," flags: -"); } - break; - case LDNS_RR_TYPE_NSEC3: - if (! (fmt->flags & LDNS_COMMENT_FLAGS) && - ! (fmt->flags & LDNS_COMMENT_NSEC3_CHAIN)) { - break; + if (fmt_st->flags & LDNS_COMMENT_NSEC3_CHAIN && + fmt_st->hashmap != NULL) { + ldns_buffer_printf(output, ", "); } - ldns_buffer_printf(output, " ;{"); - if ((fmt->flags & LDNS_COMMENT_FLAGS)) { - if (ldns_nsec3_optout(rr)) { + } + if (fmt_st->flags & LDNS_COMMENT_NSEC3_CHAIN && + fmt_st->hashmap != NULL) { + ldns_rbnode_t *node; + ldns_rdf *key = ldns_dname_label( + ldns_rr_owner(rr), 0); + if (key) { + node = ldns_rbtree_search( + fmt_st->hashmap, + (void *) key); + if (node->data) { ldns_buffer_printf(output, - " flags: optout"); - } else { - ldns_buffer_printf(output, - " flags: -"); - } - if (fmt->flags & LDNS_COMMENT_NSEC3_CHAIN - && fmt->data != NULL) { - ldns_buffer_printf(output, ", "); + "from: "); + (void) ldns_rdf2buffer_str( + output, + ldns_dnssec_name_name( + (ldns_dnssec_name*) + node->data + )); } + ldns_rdf_free(key); } - if (fmt->flags & LDNS_COMMENT_NSEC3_CHAIN - && fmt->data != NULL) { - ldns_rbnode_t *node; - ldns_rdf *key = ldns_dname_label( - ldns_rr_owner(rr), 0); - if (key) { - node = ldns_rbtree_search( - (ldns_rbtree_t *) - fmt->data, - (void *) key); - if (node->data) { - ldns_buffer_printf( - output, - "from: "); - (void) - ldns_rdf2buffer_str( - output, - (ldns_rdf *) - node->data); - } - ldns_rdf_free(key); - } - key = ldns_b32_ext2dname( + key = ldns_b32_ext2dname( ldns_nsec3_next_owner(rr)); - if (key) { - node = ldns_rbtree_search( - (ldns_rbtree_t *) - fmt->data, - (void *) key); - if (node->data) { - ldns_buffer_printf( - output, - " to: "); - (void) - ldns_rdf2buffer_str( - output, - (ldns_rdf *) - node->data); - } - ldns_rdf_free(key); + if (key) { + node = ldns_rbtree_search( + fmt_st->hashmap, + (void *) key); + if (node->data) { + ldns_buffer_printf(output, + " to: "); + (void) ldns_rdf2buffer_str( + output, + ldns_dnssec_name_name( + (ldns_dnssec_name*) + node->data + )); } + ldns_rdf_free(key); } - ldns_buffer_printf(output, "}"); - break; - default: - break; + } + ldns_buffer_printf(output, "}"); + break; + default: + break; } } @@ -1724,10 +1995,12 @@ ldns_key2buffer_str(ldns_buffer *output, const ldns_key *k) break; #endif default: +#ifdef STDERR_MSGS fprintf(stderr, "Warning: unknown signature "); fprintf(stderr, "algorithm type %u\n", ldns_key_algorithm(k)); +#endif ldns_buffer_printf(output, "Algorithm: %u (Unknown)\n", ldns_key_algorithm(k)); diff --git a/contrib/ldns/host2wire.c b/contrib/ldns/host2wire.c index de1e01e9ba3..8fb5c3a2ba5 100644 --- a/contrib/ldns/host2wire.c +++ b/contrib/ldns/host2wire.c @@ -81,6 +81,7 @@ ldns_rr_list2buffer_wire(ldns_buffer *buffer,const ldns_rr_list *rr_list) return ldns_buffer_status(buffer); } + ldns_status ldns_rr2buffer_wire_canonical(ldns_buffer *buffer, const ldns_rr *rr, @@ -136,17 +137,15 @@ ldns_rr2buffer_wire_canonical(ldns_buffer *buffer, rdl_pos = ldns_buffer_position(buffer); ldns_buffer_write_u16(buffer, 0); } - for (i = 0; i < ldns_rr_rd_count(rr); i++) { if (pre_rfc3597) { (void) ldns_rdf2buffer_wire_canonical( - buffer, ldns_rr_rdf(rr, i)); + buffer, ldns_rr_rdf(rr, i)); } else { (void) ldns_rdf2buffer_wire( - buffer, ldns_rr_rdf(rr, i)); + buffer, ldns_rr_rdf(rr, i)); } } - if (rdl_pos != 0) { ldns_buffer_write_u16_at(buffer, rdl_pos, ldns_buffer_position(buffer) @@ -177,13 +176,11 @@ ldns_rr2buffer_wire(ldns_buffer *buffer, const ldns_rr *rr, int section) /* remember pos for later */ rdl_pos = ldns_buffer_position(buffer); ldns_buffer_write_u16(buffer, 0); - } - + } for (i = 0; i < ldns_rr_rd_count(rr); i++) { (void) ldns_rdf2buffer_wire( buffer, ldns_rr_rdf(rr, i)); } - if (rdl_pos != 0) { ldns_buffer_write_u16_at(buffer, rdl_pos, ldns_buffer_position(buffer) @@ -206,7 +203,8 @@ ldns_rrsig2buffer_wire(ldns_buffer *buffer, const ldns_rr *rr) /* Convert all the rdfs, except the actual signature data * rdf number 8 - the last, hence: -1 */ for (i = 0; i < ldns_rr_rd_count(rr) - 1; i++) { - (void) ldns_rdf2buffer_wire_canonical(buffer, ldns_rr_rdf(rr, i)); + (void) ldns_rdf2buffer_wire_canonical(buffer, + ldns_rr_rdf(rr, i)); } return ldns_buffer_status(buffer); @@ -218,9 +216,8 @@ ldns_rr_rdata2buffer_wire(ldns_buffer *buffer, const ldns_rr *rr) uint16_t i; /* convert all the rdf's */ for (i = 0; i < ldns_rr_rd_count(rr); i++) { - (void) ldns_rdf2buffer_wire(buffer, ldns_rr_rdf(rr, i)); + (void) ldns_rdf2buffer_wire(buffer, ldns_rr_rdf(rr,i)); } - return ldns_buffer_status(buffer); } @@ -245,7 +242,8 @@ ldns_hdr2buffer_wire(ldns_buffer *buffer, const ldns_pkt *packet) flags = ldns_pkt_ra(packet) << 7 /*| ldns_pkt_z(packet) << 6*/ | ldns_pkt_ad(packet) << 5 - | ldns_pkt_cd(packet) << 4 | ldns_pkt_get_rcode(packet); + | ldns_pkt_cd(packet) << 4 + | ldns_pkt_get_rcode(packet); ldns_buffer_write_u8(buffer, flags); ldns_buffer_write_u16(buffer, ldns_pkt_qdcount(packet)); diff --git a/contrib/ldns/install-sh b/contrib/ldns/install-sh index a9244eb0786..377bb8687ff 100755 --- a/contrib/ldns/install-sh +++ b/contrib/ldns/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2011-01-19.21; # UTC +scriptversion=2011-11-20.07; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -35,7 +35,7 @@ scriptversion=2011-01-19.21; # UTC # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it +# 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written @@ -156,7 +156,7 @@ while test $# -ne 0; do -s) stripcmd=$stripprog;; -t) dst_arg=$2 - # Protect names problematic for `test' and other utilities. + # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac @@ -190,7 +190,7 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then fi shift # arg dst_arg=$arg - # Protect names problematic for `test' and other utilities. + # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac @@ -202,7 +202,7 @@ if test $# -eq 0; then echo "$0: no input file specified." >&2 exit 1 fi - # It's OK to call `install-sh -d' without argument. + # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi @@ -240,7 +240,7 @@ fi for src do - # Protect names problematic for `test' and other utilities. + # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac @@ -354,7 +354,7 @@ do if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writeable bit of parent directory when it shouldn't. + # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in diff --git a/contrib/ldns/keys.c b/contrib/ldns/keys.c index e16ac915319..46f6a3d0cb6 100644 --- a/contrib/ldns/keys.c +++ b/contrib/ldns/keys.c @@ -368,40 +368,50 @@ ldns_key_new_frm_fp_l(ldns_key **key, FILE *fp, int *line_nr) #ifdef USE_SHA2 alg = LDNS_SIGN_RSASHA256; #else +# ifdef STDERR_MSGS fprintf(stderr, "Warning: SHA256 not compiled into this "); fprintf(stderr, "version of ldns\n"); +# endif #endif } if (strncmp(d, "10 RSASHA512", 3) == 0) { #ifdef USE_SHA2 alg = LDNS_SIGN_RSASHA512; #else +# ifdef STDERR_MSGS fprintf(stderr, "Warning: SHA512 not compiled into this "); fprintf(stderr, "version of ldns\n"); +# endif #endif } if (strncmp(d, "12 ECC-GOST", 3) == 0) { #ifdef USE_GOST alg = LDNS_SIGN_ECC_GOST; #else +# ifdef STDERR_MSGS fprintf(stderr, "Warning: ECC-GOST not compiled into this "); fprintf(stderr, "version of ldns, use --enable-gost\n"); +# endif #endif } if (strncmp(d, "13 ECDSAP256SHA256", 3) == 0) { #ifdef USE_ECDSA alg = LDNS_SIGN_ECDSAP256SHA256; #else +# ifdef STDERR_MSGS fprintf(stderr, "Warning: ECDSA not compiled into this "); fprintf(stderr, "version of ldns, use --enable-ecdsa\n"); +# endif #endif } if (strncmp(d, "14 ECDSAP384SHA384", 3) == 0) { #ifdef USE_ECDSA alg = LDNS_SIGN_ECDSAP384SHA384; #else +# ifdef STDERR_MSGS fprintf(stderr, "Warning: ECDSA not compiled into this "); fprintf(stderr, "version of ldns, use --enable-ecdsa\n"); +# endif #endif } if (strncmp(d, "157 HMAC-MD5", 4) == 0) { @@ -1317,8 +1327,10 @@ ldns_key_dsa2bin(unsigned char *data, DSA *k, uint16_t *size) memcpy(data, &T, 1); if (T > 8) { +#ifdef STDERR_MSGS fprintf(stderr, "DSA key with T > 8 (ie. > 1024 bits)"); fprintf(stderr, " not implemented\n"); +#endif return false; } @@ -1605,7 +1617,9 @@ ldns_read_anchor_file(const char *filename) fp = fopen(filename, "r"); if (!fp) { +#ifdef STDERR_MSGS fprintf(stderr, "Unable to open %s: %s\n", filename, strerror(errno)); +#endif LDNS_FREE(line); return NULL; } @@ -1619,7 +1633,9 @@ ldns_read_anchor_file(const char *filename) fclose(fp); if (i <= 0) { +#ifdef STDERR_MSGS fprintf(stderr, "nothing read from %s", filename); +#endif LDNS_FREE(line); return NULL; } else { @@ -1628,7 +1644,9 @@ ldns_read_anchor_file(const char *filename) LDNS_FREE(line); return r; } else { +#ifdef STDERR_MSGS fprintf(stderr, "Error creating DNSKEY or DS rr from %s: %s\n", filename, ldns_get_errorstr_by_id(status)); +#endif LDNS_FREE(line); return NULL; } diff --git a/contrib/ldns/ldns/common.h b/contrib/ldns/ldns/common.h index 0767bc6b45e..82b46a03c44 100644 --- a/contrib/ldns/ldns/common.h +++ b/contrib/ldns/ldns/common.h @@ -24,6 +24,9 @@ #define LDNS_BUILD_CONFIG_HAVE_ATTR_FORMAT 1 #define LDNS_BUILD_CONFIG_HAVE_ATTR_UNUSED 1 #define LDNS_BUILD_CONFIG_HAVE_SOCKLEN_T 1 +#define LDNS_BUILD_CONFIG_USE_DANE 1 +#define LDNS_BUILD_CONFIG_HAVE_B32_PTON 0 +#define LDNS_BUILD_CONFIG_HAVE_B32_NTOP 0 /* * HAVE_STDBOOL_H is not available when distributed as a library, but no build diff --git a/contrib/ldns/ldns/common.h.in b/contrib/ldns/ldns/common.h.in index aedfc96da7f..8bf9654b4ff 100644 --- a/contrib/ldns/ldns/common.h.in +++ b/contrib/ldns/ldns/common.h.in @@ -24,6 +24,9 @@ #define LDNS_BUILD_CONFIG_HAVE_ATTR_FORMAT @ldns_build_config_have_attr_format@ #define LDNS_BUILD_CONFIG_HAVE_ATTR_UNUSED @ldns_build_config_have_attr_unused@ #define LDNS_BUILD_CONFIG_HAVE_SOCKLEN_T @ldns_build_config_have_socklen_t@ +#define LDNS_BUILD_CONFIG_USE_DANE @ldns_build_config_use_dane@ +#define LDNS_BUILD_CONFIG_HAVE_B32_PTON @ldns_build_config_have_b32_pton@ +#define LDNS_BUILD_CONFIG_HAVE_B32_NTOP @ldns_build_config_have_b32_ntop@ /* * HAVE_STDBOOL_H is not available when distributed as a library, but no build diff --git a/contrib/ldns/ldns/config.h b/contrib/ldns/ldns/config.h index aef1ee6c038..1eb094d3a79 100644 --- a/contrib/ldns/ldns/config.h +++ b/contrib/ldns/ldns/config.h @@ -87,9 +87,6 @@ /* Define to 1 if you have the `inet_pton' function. */ #define HAVE_INET_PTON 1 -/* Define to 1 if the system has the type `intptr_t'. */ -#define HAVE_INTPTR_T 1 - /* define if you have inttypes.h */ #define HAVE_INTTYPES_H 1 @@ -277,7 +274,7 @@ #define PACKAGE_NAME "ldns" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "ldns 1.6.16" +#define PACKAGE_STRING "ldns 1.6.17" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "libdns" @@ -286,7 +283,22 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.6.16" +#define PACKAGE_VERSION "1.6.17" + +/* Define this to enable RR type CDS. */ +/* #undef RRTYPE_CDS */ + +/* Define this to enable RR type NINFO. */ +/* #undef RRTYPE_NINFO */ + +/* Define this to enable RR type RKEY. */ +/* #undef RRTYPE_RKEY */ + +/* Define this to enable RR type TA. */ +/* #undef RRTYPE_TA */ + +/* Define this to enable RR type URI. */ +/* #undef RRTYPE_URI */ /* The size of `time_t', as computed by sizeof. */ #define SIZEOF_TIME_T 8 @@ -294,9 +306,15 @@ /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 +/* Define this to enable messages to stderr. */ +/* #undef STDERR_MSGS */ + /* System configuration dir */ #define SYSCONFDIR sysconfdir +/* Define this to enable DANE support. */ +#define USE_DANE 1 + /* Define this to enable ECDSA support. */ #define USE_ECDSA 1 @@ -383,8 +401,7 @@ /* Define to `char' if does not define. */ /* #undef int8_t */ -/* Define to the type of a signed integer type wide enough to hold a pointer, - if such a type exists, and if the system does not define it. */ +/* Define to `size_t' if does not define. */ /* #undef intptr_t */ /* Define to rpl_malloc if the replacement function should be used. */ @@ -489,6 +506,32 @@ extern "C" { #endif +int ldns_b64_ntop(uint8_t const *src, size_t srclength, + char *target, size_t targsize); +/** + * calculates the size needed to store the result of b64_ntop + */ +/*@unused@*/ +static inline size_t ldns_b64_ntop_calculate_size(size_t srcsize) +{ + return ((((srcsize + 2) / 3) * 4) + 1); +} +int ldns_b64_pton(char const *src, uint8_t *target, size_t targsize); +/** + * calculates the size needed to store the result of ldns_b64_pton + */ +/*@unused@*/ +static inline size_t ldns_b64_pton_calculate_size(size_t srcsize) +{ + return (((((srcsize + 3) / 4) * 3)) + 1); +} + +/** + * Given in dnssec_zone.c, also used in dnssec_sign.c:w + + */ +int ldns_dname_compare_v(const void *a, const void *b); + #ifndef HAVE_SLEEP /* use windows sleep, in millisecs, instead */ #define sleep(x) Sleep((x)*1000) diff --git a/contrib/ldns/ldns/config.h.in b/contrib/ldns/ldns/config.h.in index 98cf357074b..b41af233c3b 100644 --- a/contrib/ldns/ldns/config.h.in +++ b/contrib/ldns/ldns/config.h.in @@ -86,9 +86,6 @@ /* Define to 1 if you have the `inet_pton' function. */ #undef HAVE_INET_PTON -/* Define to 1 if the system has the type `intptr_t'. */ -#undef HAVE_INTPTR_T - /* define if you have inttypes.h */ #undef HAVE_INTTYPES_H @@ -287,15 +284,36 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* Define this to enable RR type CDS. */ +#undef RRTYPE_CDS + +/* Define this to enable RR type NINFO. */ +#undef RRTYPE_NINFO + +/* Define this to enable RR type RKEY. */ +#undef RRTYPE_RKEY + +/* Define this to enable RR type TA. */ +#undef RRTYPE_TA + +/* Define this to enable RR type URI. */ +#undef RRTYPE_URI + /* The size of `time_t', as computed by sizeof. */ #undef SIZEOF_TIME_T /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS +/* Define this to enable messages to stderr. */ +#undef STDERR_MSGS + /* System configuration dir */ #undef SYSCONFDIR +/* Define this to enable DANE support. */ +#undef USE_DANE + /* Define this to enable ECDSA support. */ #undef USE_ECDSA @@ -382,8 +400,7 @@ /* Define to `char' if does not define. */ #undef int8_t -/* Define to the type of a signed integer type wide enough to hold a pointer, - if such a type exists, and if the system does not define it. */ +/* Define to `size_t' if does not define. */ #undef intptr_t /* Define to rpl_malloc if the replacement function should be used. */ @@ -488,7 +505,6 @@ extern "C" { #endif -#ifndef B64_PTON int ldns_b64_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsize); /** @@ -499,8 +515,6 @@ static inline size_t ldns_b64_ntop_calculate_size(size_t srcsize) { return ((((srcsize + 2) / 3) * 4) + 1); } -#endif /* !B64_PTON */ -#ifndef B64_NTOP int ldns_b64_pton(char const *src, uint8_t *target, size_t targsize); /** * calculates the size needed to store the result of ldns_b64_pton @@ -510,7 +524,12 @@ static inline size_t ldns_b64_pton_calculate_size(size_t srcsize) { return (((((srcsize + 3) / 4) * 3)) + 1); } -#endif /* !B64_NTOP */ + +/** + * Given in dnssec_zone.c, also used in dnssec_sign.c:w + + */ +int ldns_dname_compare_v(const void *a, const void *b); #ifndef HAVE_SLEEP /* use windows sleep, in millisecs, instead */ diff --git a/contrib/ldns/ldns/dane.h b/contrib/ldns/ldns/dane.h index c1c4e2d75ca..6adecd575c5 100644 --- a/contrib/ldns/ldns/dane.h +++ b/contrib/ldns/ldns/dane.h @@ -22,6 +22,7 @@ #ifndef LDNS_DANE_H #define LDNS_DANE_H +#if LDNS_BUILD_CONFIG_USE_DANE #include #include @@ -240,5 +241,6 @@ ldns_status ldns_dane_verify(ldns_rr_list* tlsas, } #endif +#endif /* LDNS_BUILD_CONFIG_USE_DANE */ #endif /* LDNS_DANE_H */ diff --git a/contrib/ldns/ldns/dnssec.h b/contrib/ldns/ldns/dnssec.h index 34f63714c34..f4cdafbe9de 100644 --- a/contrib/ldns/ldns/dnssec.h +++ b/contrib/ldns/ldns/dnssec.h @@ -364,12 +364,30 @@ ldns_rdf *ldns_nsec3_bitmap(const ldns_rr *nsec3_rr); ldns_rdf *ldns_nsec3_hash_name_frm_nsec3(const ldns_rr *nsec, ldns_rdf *name); /** - * Checks coverage of NSEC RR type bitmap - * \param[in] nsec_bitmap The NSEC bitmap rdata field to check - * \param[in] type The type to check - * \return true if the NSEC RR covers the type + * Check if RR type t is enumerated and set in the RR type bitmap rdf. + * \param[in] bitmap the RR type bitmap rdf to look in + * \param[in] type the type to check for + * \return true when t is found and set, otherwise return false */ -bool ldns_nsec_bitmap_covers_type(const ldns_rdf *nsec_bitmap, ldns_rr_type type); +bool ldns_nsec_bitmap_covers_type(const ldns_rdf* bitmap, ldns_rr_type type); + +/** + * Checks if RR type t is enumerated in the type bitmap rdf and sets the bit. + * \param[in] bitmap the RR type bitmap rdf to look in + * \param[in] type the type to for which the bit to set + * \return LDNS_STATUS_OK on success. LDNS_STATUS_TYPE_NOT_IN_BITMAP is + * returned when the bitmap does not contain the bit to set. + */ +ldns_status ldns_nsec_bitmap_set_type(ldns_rdf* bitmap, ldns_rr_type type); + +/** + * Checks if RR type t is enumerated in the type bitmap rdf and clears the bit. + * \param[in] bitmap the RR type bitmap rdf to look in + * \param[in] type the type to for which the bit to clear + * \return LDNS_STATUS_OK on success. LDNS_STATUS_TYPE_NOT_IN_BITMAP is + * returned when the bitmap does not contain the bit to clear. + */ +ldns_status ldns_nsec_bitmap_clear_type(ldns_rdf* bitmap, ldns_rr_type type); /** * Checks coverage of NSEC(3) RR name span diff --git a/contrib/ldns/ldns/dnssec_sign.h b/contrib/ldns/ldns/dnssec_sign.h index e77cb6959df..f51c7fb3812 100644 --- a/contrib/ldns/ldns/dnssec_sign.h +++ b/contrib/ldns/ldns/dnssec_sign.h @@ -87,7 +87,7 @@ ldns_rdf *ldns_sign_public_rsamd5(ldns_buffer *to_sign, RSA *key); * when walking the tree with the ldns_dnssec_name_node_next_nonglue() * function. But watch out! Names that are partially occluded (like glue with * the same name as the delegation) will not be marked and should specifically - * be taken into account seperately. + * be taken into account separately. * * When glue_list is given (not NULL), in the process of marking the names, all * glue resource records will be pushed to that list, even glue at the delegation name. @@ -105,7 +105,7 @@ ldns_dnssec_zone_mark_and_get_glue( * when walking the tree with the ldns_dnssec_name_node_next_nonglue() * function. But watch out! Names that are partially occluded (like glue with * the same name as the delegation) will not be marked and should specifically - * be taken into account seperately. + * be taken into account separately. * * \param[in] zone the zone in which to mark the names * \return LDNS_STATUS_OK on succesful completion diff --git a/contrib/ldns/ldns/dnssec_zone.h b/contrib/ldns/ldns/dnssec_zone.h index 257bfba23cd..b794f942f47 100644 --- a/contrib/ldns/ldns/dnssec_zone.h +++ b/contrib/ldns/ldns/dnssec_zone.h @@ -93,6 +93,13 @@ struct ldns_struct_dnssec_zone { ldns_dnssec_name *soa; /** tree of ldns_dnssec_names */ ldns_rbtree_t *names; + /** tree of ldns_dnssec_names by nsec3 hashes (when applicible) */ + ldns_rbtree_t *hashed_names; + /** points to the first added NSEC3 rr whose parameters will be + * assumed for all subsequent NSEC3 rr's and which will be used + * to calculate hashed names + */ + ldns_rr *_nsec3params; }; typedef struct ldns_struct_dnssec_zone ldns_dnssec_zone; @@ -119,7 +126,8 @@ void ldns_dnssec_rrs_free(ldns_dnssec_rrs *rrs); void ldns_dnssec_rrs_deep_free(ldns_dnssec_rrs *rrs); /** - * Adds an RR to the list of RRs. The list will remain ordered + * Adds an RR to the list of RRs. The list will remain ordered. + * If an equal RR already exists, this RR will not be added. * * \param[in] rrs the list to add to * \param[in] rr the RR to add diff --git a/contrib/ldns/ldns/error.h b/contrib/ldns/ldns/error.h index bac38ff8714..41b99ad146d 100644 --- a/contrib/ldns/ldns/error.h +++ b/contrib/ldns/ldns/error.h @@ -117,7 +117,16 @@ enum ldns_enum_status { LDNS_STATUS_DANE_TLSA_DID_NOT_MATCH, LDNS_STATUS_DANE_NON_CA_CERTIFICATE, LDNS_STATUS_DANE_PKIX_DID_NOT_VALIDATE, - LDNS_STATUS_DANE_PKIX_NO_SELF_SIGNED_TRUST_ANCHOR + LDNS_STATUS_DANE_PKIX_NO_SELF_SIGNED_TRUST_ANCHOR, + LDNS_STATUS_EXISTS_ERR, + LDNS_STATUS_INVALID_ILNP64, + LDNS_STATUS_INVALID_EUI48, + LDNS_STATUS_INVALID_EUI64, + LDNS_STATUS_WIRE_RDATA_ERR, + LDNS_STATUS_INVALID_TAG, + LDNS_STATUS_TYPE_NOT_IN_BITMAP, + LDNS_STATUS_INVALID_RDF_TYPE, + LDNS_STATUS_RDATA_OVERFLOW, }; typedef enum ldns_enum_status ldns_status; diff --git a/contrib/ldns/ldns/host2str.h b/contrib/ldns/ldns/host2str.h index bbf932767b3..e69389e90ae 100644 --- a/contrib/ldns/ldns/host2str.h +++ b/contrib/ldns/ldns/host2str.h @@ -40,32 +40,38 @@ extern "C" { #define LDNS_APL_NEGATION 0x80 /** - * Represent a NULL pointer (in stead of a pointer to a ldns_rr as "; (null)" + * Represent a NULL pointer (instead of a pointer to a ldns_rr as "; (null)" * as opposed to outputting nothing at all in such a case. */ -#define LDNS_COMMENT_NULLS 0x0001 +/* Flag Name Flag Nr. Has data associated + ---------------------------------------------------------------------*/ +#define LDNS_COMMENT_NULLS (1 << 0) /** Show key id with DNSKEY RR's as comment */ -#define LDNS_COMMENT_KEY_ID 0x0002 +#define LDNS_COMMENT_KEY_ID (1 << 1) /** Show if a DNSKEY is a ZSK or KSK as comment */ -#define LDNS_COMMENT_KEY_TYPE 0x0004 +#define LDNS_COMMENT_KEY_TYPE (1 << 2) /** Show DNSKEY key size as comment */ -#define LDNS_COMMENT_KEY_SIZE 0x0008 +#define LDNS_COMMENT_KEY_SIZE (1 << 3) +/** Provide bubblebabble representation for DS RR's as comment */ +#define LDNS_COMMENT_BUBBLEBABBLE (1 << 4) +/** Show when a NSEC3 RR has the optout flag set as comment */ +#define LDNS_COMMENT_FLAGS (1 << 5) +/** Show the unhashed owner and next owner names for NSEC3 RR's as comment */ +#define LDNS_COMMENT_NSEC3_CHAIN (1 << 6) /* yes */ +/** Print mark up */ +#define LDNS_COMMENT_LAYOUT (1 << 7) +/** Also comment KEY_ID with RRSIGS **/ +#define LDNS_COMMENT_RRSIGS (1 << 8) +#define LDNS_FMT_ZEROIZE_RRSIGS (1 << 9) +#define LDNS_FMT_PAD_SOA_SERIAL (1 << 10) +#define LDNS_FMT_RFC3597 (1 << 11) /* yes */ + +#define LDNS_FMT_FLAGS_WITH_DATA 2 + /** Show key id, type and size as comment for DNSKEY RR's */ #define LDNS_COMMENT_KEY (LDNS_COMMENT_KEY_ID \ |LDNS_COMMENT_KEY_TYPE\ |LDNS_COMMENT_KEY_SIZE) -/** Provide bubblebabble representation for DS RR's as comment */ -#define LDNS_COMMENT_BUBBLEBABBLE 0x0010 -/** Show when a NSEC3 RR has the optout flag set as comment */ -#define LDNS_COMMENT_FLAGS 0x0020 -/** Show the unhashed owner and next owner names for NSEC3 RR's as comment */ -#define LDNS_COMMENT_NSEC3_CHAIN 0x0040 -/** Print mark up */ -#define LDNS_COMMENT_LAYOUT 0x0080 -/** Also comment KEY_ID with RRSIGS **/ -#define LDNS_COMMENT_RRSIGS 0x0100 -#define LDNS_FMT_ZEROIZE_RRSIGS 0x0200 -#define LDNS_FMT_PAD_SOA_SERIAL 0x0400 /** * Output format specifier @@ -86,6 +92,18 @@ struct ldns_struct_output_format }; typedef struct ldns_struct_output_format ldns_output_format; +/** + * Output format struct with additional data for flags that use them. + * This struct may not be initialized directly. Use ldns_output_format_init + * to initialize. + */ +struct ldns_struct_output_format_storage +{ int flags; + ldns_rbtree_t* hashmap; /* for LDNS_COMMENT_NSEC3_CHAIN */ + ldns_rdf* bitmap; /* for LDNS_FMT_RFC3597 */ +}; +typedef struct ldns_struct_output_format_storage ldns_output_format_storage; + /** * Standard output format record that disables commenting in the textual * representation of Resource Records completely. @@ -107,6 +125,55 @@ extern const ldns_output_format *ldns_output_format_default; */ extern const ldns_output_format *ldns_output_format_bubblebabble; +/** + * Initialize output format storage to the default value. + * \param[in] fmt A reference to an output_format_ storage struct + * \return The initialized storage struct typecasted to ldns_output_format + */ +INLINE +ldns_output_format* ldns_output_format_init(ldns_output_format_storage* fmt) { + fmt->flags = ldns_output_format_default->flags; + fmt->hashmap = NULL; + fmt->bitmap = NULL; + return (ldns_output_format*)fmt; +} + +/** + * Set an ouput format flag. + */ +INLINE void ldns_output_format_set(ldns_output_format* fmt, int flag) { + fmt->flags |= flag; +} + +/** + * Clear an ouput format flag. + */ +INLINE void ldns_output_format_clear(ldns_output_format* fmt, int flag) { + fmt->flags &= !flag; +} + +/** + * Makes sure the LDNS_FMT_RFC3597 is set in the output format. + * Marks the type to be printed in RFC3597 format. + * /param[in] fmt the output format to update + * /param[in] the type to be printed in RFC3597 format + * /return LDNS_STATUS_OK on success + */ +ldns_status +ldns_output_format_set_type(ldns_output_format* fmt, ldns_rr_type type); + +/** + * Makes sure the LDNS_FMT_RFC3597 is set in the output format. + * Marks the type to not be printed in RFC3597 format. When no other types + * have been marked before, all known types (except the given one) will be + * marked for printing in RFC3597 format. + * /param[in] fmt the output format to update + * /param[in] the type not to be printed in RFC3597 format + * /return LDNS_STATUS_OK on success + */ +ldns_status +ldns_output_format_clear_type(ldns_output_format* fmt, ldns_rr_type type); + /** * Converts an ldns packet opcode value to its mnemonic, and adds that * to the output buffer @@ -399,15 +466,6 @@ ldns_status ldns_rdf2buffer_str_int16_data(ldns_buffer *output, const ldns_rdf * */ ldns_status ldns_rdf2buffer_str_ipseckey(ldns_buffer *output, const ldns_rdf *rdf); -/** - * Converts an LDNS_RDF_TYPE_TSIG rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_tsig(ldns_buffer *output, const ldns_rdf *rdf); - - /** * Converts the data in the rdata field to presentation * format (as char *) and appends it to the given buffer @@ -518,6 +576,66 @@ ldns_status ldns_rdf2buffer_str_int32(ldns_buffer *output, const ldns_rdf *rdf); */ ldns_status ldns_rdf2buffer_str_time(ldns_buffer *output, const ldns_rdf *rdf); +/** + * Converts an LDNS_RDF_TYPE_ILNP64 rdata element to 4 hexadecimal numbers + * separated by colons and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_ilnp64(ldns_buffer *output, + const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_EUI48 rdata element to 6 hexadecimal numbers + * separated by dashes and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_eui48(ldns_buffer *output, + const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_EUI64 rdata element to 8 hexadecimal numbers + * separated by dashes and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_eui64(ldns_buffer *output, + const ldns_rdf *rdf); + +/** + * Adds the LDNS_RDF_TYPE_TAG rdata to the output buffer, + * provided it contains only alphanumeric characters. + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_tag(ldns_buffer *output, + const ldns_rdf *rdf); + +/** + * Adds the LDNS_RDF_TYPE_LONG_STR rdata to the output buffer, in-between + * double quotes and all non printable characters properly escaped. + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_long_str(ldns_buffer *output, + const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_HIP rdata element to presentation format for + * the algorithm, HIT and Public Key and adds it the output buffer . + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_hip(ldns_buffer *output, + const ldns_rdf *rdf); + /** * Converts the data in the rdata field to presentation format and * returns that as a char *. diff --git a/contrib/ldns/ldns/ldns.h b/contrib/ldns/ldns/ldns.h index a41e0325d67..60663ef95c7 100644 --- a/contrib/ldns/ldns/ldns.h +++ b/contrib/ldns/ldns/ldns.h @@ -26,7 +26,7 @@ faster than Perl. The first main tool to use ldns is Drill, from which part of the library was derived. From version 1.0.0 on, drill is included in the ldns release -and will not be distributed seperately anymore. The library also includes some +and will not be distributed separately anymore. The library also includes some other examples and tools to show how it can be used. These can be found in the examples/ directory in the tarball. @@ -37,9 +37,9 @@ Feature list - TSIG support, - DNSSEC support; signing and verification, - small size, - - online documentation as well as manual pages. + - online documentation as well as manual pages. -If you want to send us patches please use the code from subversion (trunk). +If you want to send us patches please use the code from git. \section using_ldns Using ldns @@ -119,6 +119,7 @@ Or you can just use the menu above to browse through the API docs. #include #include #include +#include #include #include #include diff --git a/contrib/ldns/ldns/net.h b/contrib/ldns/ldns/net.h index cd7bc4beb75..692a9fbfe05 100644 --- a/contrib/ldns/ldns/net.h +++ b/contrib/ldns/ldns/net.h @@ -50,7 +50,6 @@ ldns_status ldns_udp_send(uint8_t **result, ldns_buffer *qbin, const struct sock * \param[in] timeout *unused*, was the timeout value for the network * \return the socket used */ - int ldns_udp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout); /** diff --git a/contrib/ldns/ldns/net.h.in b/contrib/ldns/ldns/net.h.in index cd4cfdec9c6..e6b3618f20f 100644 --- a/contrib/ldns/ldns/net.h.in +++ b/contrib/ldns/ldns/net.h.in @@ -50,7 +50,6 @@ ldns_status ldns_udp_send(uint8_t **result, ldns_buffer *qbin, const struct sock * \param[in] timeout *unused*, was the timeout value for the network * \return the socket used */ - int ldns_udp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout); /** diff --git a/contrib/ldns/ldns/packet.h b/contrib/ldns/ldns/packet.h index ed7c3274636..9dca06f5627 100644 --- a/contrib/ldns/ldns/packet.h +++ b/contrib/ldns/ldns/packet.h @@ -410,6 +410,17 @@ uint32_t ldns_pkt_querytime(const ldns_pkt *p); */ size_t ldns_pkt_size(const ldns_pkt *p); +/** + * Return the number of RRs in the given section. + * Returns the sum of all RRs when LDNS_SECTION_ANY is given. + * Returns the sum of all non-question RRs when LDNS_SECTION_ANY_NOQUESTION + * is given. + * \param[in] p the packet + * \param[in] s the section + * \return the number of RRs in the given section + */ +uint16_t ldns_pkt_section_count(const ldns_pkt *p, ldns_pkt_section s); + /** * Return the packet's tsig pseudo rr's * \param[in] p the packet @@ -759,6 +770,18 @@ void ldns_pkt_free(ldns_pkt *packet); */ ldns_status ldns_pkt_query_new_frm_str(ldns_pkt **p, const char *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_class , uint16_t flags); +/** + * creates an IXFR request packet for the given name, class. + * adds the SOA record to the authority section. + * \param[out] p the packet to be returned + * \param[in] rr_name the name to query for (as string) + * \param[in] rr_class the class to query for + * \param[in] flags packet flags + * \param[in] soa soa record to be added to the authority section + * \return LDNS_STATUS_OK or a ldns_status mesg with the error + */ +ldns_status ldns_pkt_ixfr_request_new_frm_str(ldns_pkt **p, const char *rr_name, ldns_rr_class rr_class, uint16_t flags, ldns_rr* soa); + /** * creates a packet with a query in it for the given name, type and class. * \param[in] rr_name the name to query for @@ -769,6 +792,17 @@ ldns_status ldns_pkt_query_new_frm_str(ldns_pkt **p, const char *rr_name, ldns_r */ ldns_pkt *ldns_pkt_query_new(ldns_rdf *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_class, uint16_t flags); +/** + * creates an IXFR request packet for the given name, type and class. + * adds the SOA record to the authority section. + * \param[in] rr_name the name to query for + * \param[in] rr_class the class to query for + * \param[in] flags packet flags + * \param[in] soa soa record to be added to the authority section + * \return ldns_pkt* a pointer to the new pkt + */ +ldns_pkt *ldns_pkt_ixfr_request_new(ldns_rdf *rr_name, ldns_rr_class rr_class, uint16_t flags, ldns_rr* soa); + /** * clones the given packet, creating a fully allocated copy * diff --git a/contrib/ldns/ldns/radix.h b/contrib/ldns/ldns/radix.h new file mode 100644 index 00000000000..f8833eb2cec --- /dev/null +++ b/contrib/ldns/ldns/radix.h @@ -0,0 +1,240 @@ +/* + * radix.h -- generic radix tree + * + * Copyright (c) 2012, NLnet Labs. All rights reserved. + * + * This software is open source. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 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. + * + * Neither the name of the NLNET LABS 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 COPYRIGHT HOLDERS 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. + * + */ + +/** + * \file + * Radix tree. Implementation taken from NSD 4, adjusted for use in ldns. + * + */ + +#ifndef LDNS_RADIX_H_ +#define LDNS_RADIX_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef uint16_t radix_strlen_t; +typedef struct ldns_radix_array_t ldns_radix_array_t; +typedef struct ldns_radix_node_t ldns_radix_node_t; +typedef struct ldns_radix_t ldns_radix_t; + +/** Radix node select edge array */ +struct ldns_radix_array_t { + /** Additional string after the selection byte for this edge. */ + uint8_t* str; + /** Length of additional string for this edge. */ + radix_strlen_t len; + /** Node that deals with byte+str. */ + ldns_radix_node_t* edge; +}; + +/** A node in a radix tree */ +struct ldns_radix_node_t { + /** Key corresponding to this node. */ + uint8_t* key; + /** Key length corresponding to this node. */ + radix_strlen_t klen; + /** Data corresponding to this node. */ + void* data; + /** Parent node. */ + ldns_radix_node_t* parent; + /** Index in the the parent node select edge array. */ + uint8_t parent_index; + /** Length of the array. */ + uint16_t len; + /** Offset of the array. */ + uint16_t offset; + /** Capacity of the array. */ + uint16_t capacity; + /** Select edge array. */ + ldns_radix_array_t* array; +}; + +/** An entire radix tree */ +struct ldns_radix_t { + /** Root. */ + ldns_radix_node_t* root; + /** Number of nodes in tree. */ + size_t count; +}; + +/** + * Create a new radix tree. + * @return: new radix tree. + * + */ +ldns_radix_t* ldns_radix_create(void); + +/** + * Initialize radix tree. + * @param tree: uninitialized radix tree. + * + */ +void ldns_radix_init(ldns_radix_t* tree); + +/** + * Free the radix tree. + * @param tree: radix tree. + * + */ +void ldns_radix_free(ldns_radix_t* tree); + +/** + * Insert data into the tree. + * @param tree: tree to insert to. + * @param key: key. + * @param len: length of key. + * @param data: data. + * @return: status. + * + */ +ldns_status ldns_radix_insert(ldns_radix_t* tree, uint8_t* key, + radix_strlen_t len, void* data); + +/** + * Delete data from the tree. + * @param tree: tree to insert to. + * @param key: key. + * @param len: length of key. + * @return: unlinked data or NULL if not present. + * + */ +void* ldns_radix_delete(ldns_radix_t* tree, uint8_t* key, radix_strlen_t len); + +/** + * Search data in the tree. + * @param tree: tree to insert to. + * @param key: key. + * @param len: length of key. + * @return: the radix node or NULL if not found. + * + */ +ldns_radix_node_t* ldns_radix_search(ldns_radix_t* tree, uint8_t* key, + radix_strlen_t len); + +/** + * Search data in the tree, and if not found, find the closest smaller + * element in the tree. + * @param tree: tree to insert to. + * @param key: key. + * @param len: length of key. + * @param result: the radix node with the exact or closest match. NULL if + * the key is smaller than the smallest key in the tree. + * @return 1 if exact match, 0 otherwise. + * + */ +int ldns_radix_find_less_equal(ldns_radix_t* tree, uint8_t* key, + radix_strlen_t len, ldns_radix_node_t** result); + +/** + * Get the first element in the tree. + * @param tree: tree. + * @return: the radix node with the first element. + * + */ +ldns_radix_node_t* ldns_radix_first(ldns_radix_t* tree); + +/** + * Get the last element in the tree. + * @param tree: tree. + * @return: the radix node with the last element. + * + */ +ldns_radix_node_t* ldns_radix_last(ldns_radix_t* tree); + +/** + * Next element. + * @param node: node. + * @return: node with next element. + * + */ +ldns_radix_node_t* ldns_radix_next(ldns_radix_node_t* node); + +/** + * Previous element. + * @param node: node. + * @return: node with previous element. + * + */ +ldns_radix_node_t* ldns_radix_prev(ldns_radix_node_t* node); + +/** + * Split radix tree intwo. + * @param tree1: one tree. + * @param num: number of elements to split off. + * @param tree2: another tree. + * @return: status. + * + */ +ldns_status ldns_radix_split(ldns_radix_t* tree1, size_t num, + ldns_radix_t** tree2); + +/** + * Join two radix trees. + * @param tree1: one tree. + * @param tree2: another tree. + * @return: status. + * + */ +ldns_status ldns_radix_join(ldns_radix_t* tree1, ldns_radix_t* tree2); + +/** + * Call function for all nodes in the tree, such that leaf nodes are + * called before parent nodes. + * @param node: start node. + * @param func: function. + * @param arg: user argument. + * + */ +void ldns_radix_traverse_postorder(ldns_radix_node_t* node, + void (*func)(ldns_radix_node_t*, void*), void* arg); + +/** + * Print radix tree (for debugging purposes). + * @param fd: file descriptor. + * @param tree: tree. + * + */ +void ldns_radix_printf(FILE* fd, ldns_radix_t* tree); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_RADIX_H_ */ diff --git a/contrib/ldns/ldns/rdata.h b/contrib/ldns/ldns/rdata.h index 229a4d4c5b5..1866e8fc066 100644 --- a/contrib/ldns/ldns/rdata.h +++ b/contrib/ldns/ldns/rdata.h @@ -28,12 +28,13 @@ extern "C" { #endif -#define LDNS_MAX_RDFLEN 8192 +#define LDNS_MAX_RDFLEN 65535 #define LDNS_RDF_SIZE_BYTE 1 #define LDNS_RDF_SIZE_WORD 2 #define LDNS_RDF_SIZE_DOUBLEWORD 4 #define LDNS_RDF_SIZE_6BYTES 6 +#define LDNS_RDF_SIZE_8BYTES 8 #define LDNS_RDF_SIZE_16BYTES 16 #define LDNS_NSEC3_VARS_OPTOUT_MASK 0x01 @@ -85,7 +86,10 @@ enum ldns_enum_rdf_type LDNS_RDF_TYPE_PERIOD, /** tsig time 48 bits */ LDNS_RDF_TYPE_TSIGTIME, - LDNS_RDF_TYPE_TSIG, + /** Represents the Public Key Algorithm, HIT and Public Key fields + for the HIP RR types. A HIP specific rdf type is used because of + the unusual layout in wireformat (see RFC 5205 Section 5) */ + LDNS_RDF_TYPE_HIP, /** variable length any type rdata where the length is specified by the first 2 bytes */ LDNS_RDF_TYPE_INT16_DATA, @@ -104,7 +108,31 @@ enum ldns_enum_rdf_type /** nsec3 hash salt */ LDNS_RDF_TYPE_NSEC3_SALT, /** nsec3 base32 string (with length byte on wire */ - LDNS_RDF_TYPE_NSEC3_NEXT_OWNER + LDNS_RDF_TYPE_NSEC3_NEXT_OWNER, + + /** 4 shorts represented as 4 * 16 bit hex numbers + * separated by colons. For NID and L64. + */ + LDNS_RDF_TYPE_ILNP64, + + /** 6 * 8 bit hex numbers separated by dashes. For EUI48. */ + LDNS_RDF_TYPE_EUI48, + /** 8 * 8 bit hex numbers separated by dashes. For EUI64. */ + LDNS_RDF_TYPE_EUI64, + + /** A non-zero sequence of US-ASCII letters and numbers in lower case. + * For CAA. + */ + LDNS_RDF_TYPE_TAG, + + /** A encoding of the value field as specified + * [RFC1035], Section 5.1., encoded as remaining rdata. + * For CAA. + */ + LDNS_RDF_TYPE_LONG_STR, + + /* Aliases */ + LDNS_RDF_TYPE_BITMAP = LDNS_RDF_TYPE_NSEC }; typedef enum ldns_enum_rdf_type ldns_rdf_type; @@ -380,6 +408,34 @@ ldns_rdf *ldns_rdf_clone(const ldns_rdf *rd); */ int ldns_rdf_compare(const ldns_rdf *rd1, const ldns_rdf *rd2); +/** + * Gets the algorithm value, the HIT and Public Key data from the rdf with + * type LDNS_RDF_TYPE_HIP. + * \param[in] rdf the rdf with type LDNS_RDF_TYPE_HIP + * \param[out] alg the algorithm + * \param[out] hit_size the size of the HIT data + * \param[out] hit the hit data + * \param[out] pk_size the size of the Public Key data + * \param[out] pk the Public Key data + * \return LDNS_STATUS_OK on success, and the error otherwise + */ +ldns_status ldns_rdf_hip_get_alg_hit_pk(ldns_rdf *rdf, uint8_t* alg, + uint8_t *hit_size, uint8_t** hit, + uint16_t *pk_size, uint8_t** pk); + +/** + * Creates a new LDNS_RDF_TYPE_HIP rdf from given data. + * \param[out] rdf the newly created LDNS_RDF_TYPE_HIP rdf + * \param[in] alg the algorithm + * \param[in] hit_size the size of the HIT data + * \param[in] hit the hit data + * \param[in] pk_size the size of the Public Key data + * \param[in] pk the Public Key data + * \return LDNS_STATUS_OK on success, and the error otherwise + */ +ldns_status ldns_rdf_hip_new_frm_alg_hit_pk(ldns_rdf** rdf, uint8_t alg, + uint8_t hit_size, uint8_t *hit, uint16_t pk_size, uint8_t *pk); + #ifdef __cplusplus } #endif diff --git a/contrib/ldns/ldns/resolver.h b/contrib/ldns/ldns/resolver.h index 7af5d401e65..f3f1371a6e9 100644 --- a/contrib/ldns/ldns/resolver.h +++ b/contrib/ldns/ldns/resolver.h @@ -138,6 +138,9 @@ struct ldns_struct_resolver char *_tsig_keydata; /** TSIG signing algorithm */ char *_tsig_algorithm; + + /** Source address to query from */ + ldns_rdf *_source; }; typedef struct ldns_struct_resolver ldns_resolver; @@ -151,6 +154,13 @@ typedef struct ldns_struct_resolver ldns_resolver; */ uint16_t ldns_resolver_port(const ldns_resolver *r); +/** + * Get the source address the resolver should use + * \param[in] r the resolver + * \return the source rdf + */ +ldns_rdf *ldns_resolver_source(const ldns_resolver *r); + /** * Is the resolver set to recurse * \param[in] r the resolver @@ -337,6 +347,13 @@ size_t ldns_resolver_searchlist_count(const ldns_resolver *r); */ void ldns_resolver_set_port(ldns_resolver *r, uint16_t p); +/** + * Set the source rdf (address) the resolver should use + * \param[in] r the resolver + * \param[in] s the source address + */ +void ldns_resolver_set_source(ldns_resolver *r, ldns_rdf *s); + /** * Set the resolver recursion * \param[in] r the resolver @@ -464,9 +481,10 @@ void ldns_resolver_set_retrans(ldns_resolver *r, uint8_t re); void ldns_resolver_set_fallback(ldns_resolver *r, bool fallback); /** - * Set the resolver retry interval (in seconds) + * Set the number of times a resolver should retry a nameserver before the + * next one is tried. * \param[in] r the resolver - * \param[in] re the retry interval + * \param[in] re the number of retries */ void ldns_resolver_set_retry(ldns_resolver *r, uint8_t re); @@ -583,6 +601,22 @@ ldns_status ldns_resolver_push_nameserver_rr_list(ldns_resolver *r, ldns_rr_list */ ldns_pkt* ldns_resolver_search(const ldns_resolver *r, const ldns_rdf *rdf, ldns_rr_type t, ldns_rr_class c, uint16_t flags); + +/** + * Send the query for using the resolver and take the search list into account + * The search algorithm is as follows: + * If the name is absolute, try it as-is, otherwise apply the search list + * \param[out] pkt a packet with the reply from the nameserver + * \param[in] *r operate using this resolver + * \param[in] *rdf query for this name + * \param[in] t query for this type (may be 0, defaults to A) + * \param[in] c query for this class (may be 0, default to IN) + * \param[in] flags the query flags + * + * \return ldns_status LDNS_STATUS_OK on success + */ +ldns_status ldns_resolver_search_status(ldns_pkt** pkt, ldns_resolver *r, const ldns_rdf *rdf, ldns_rr_type t, ldns_rr_class c, uint16_t flags); + /** * Form a query packet from a resolver and name/type/class combo * \param[out] **q a pointer to a ldns_pkt pointer (initialized by this function) @@ -619,12 +653,29 @@ ldns_status ldns_resolver_send_pkt(ldns_pkt **answer, ldns_resolver *r, ldns_pkt /** * Send a query to a nameserver + * \param[out] pkt a packet with the reply from the nameserver * \param[in] *r operate using this resolver * \param[in] *name query for this name * \param[in] *t query for this type (may be 0, defaults to A) * \param[in] *c query for this class (may be 0, default to IN) * \param[in] flags the query flags * + * \return ldns_status LDNS_STATUS_OK on success + * if _defnames is true the default domain will be added + */ +ldns_status ldns_resolver_query_status(ldns_pkt** pkt, ldns_resolver *r, const ldns_rdf *name, ldns_rr_type t, ldns_rr_class c, uint16_t flags); + + +/** + * Send a query to a nameserver + * \param[in] *r operate using this resolver + * (despite the const in the declaration, + * the struct is altered as a side-effect) + * \param[in] *name query for this name + * \param[in] *t query for this type (may be 0, defaults to A) + * \param[in] *c query for this class (may be 0, default to IN) + * \param[in] flags the query flags + * * \return ldns_pkt* a packet with the reply from the nameserver * if _defnames is true the default domain will be added */ @@ -688,6 +739,12 @@ void ldns_resolver_deep_free(ldns_resolver *res); */ ldns_rr* ldns_axfr_next(ldns_resolver *resolver); +/** + * Abort a transfer that is in progress + * \param[in] resolver the resolver that is used + */ +void ldns_axfr_abort(ldns_resolver *resolver); + /** * Returns true if the axfr transfer has completed (i.e. 2 SOA RRs and no errors were encountered * \param[in] resolver the resolver that is used diff --git a/contrib/ldns/ldns/rr.h b/contrib/ldns/ldns/rr.h index e42fda6a45a..ff499395c00 100644 --- a/contrib/ldns/ldns/rr.h +++ b/contrib/ldns/ldns/rr.h @@ -36,8 +36,8 @@ extern "C" { /** The bytes TTL, CLASS and length use up in an rr */ #define LDNS_RR_OVERHEAD 10 -/* The first fields are 'common' and can be referenced instantly */ -#define LDNS_RDATA_FIELD_DESCRIPTORS_COMMON 53 +/* The first fields are contiguous and can be referenced instantly */ +#define LDNS_RDATA_FIELD_DESCRIPTORS_COMMON 258 @@ -163,7 +163,7 @@ enum ldns_enum_rr_type LDNS_RR_TYPE_OPT = 41, /** RFC3123 */ LDNS_RR_TYPE_APL = 42, - /** draft-ietf-dnsext-delegation */ + /** RFC4034, RFC3658 */ LDNS_RR_TYPE_DS = 43, /** SSH Key Fingerprint */ LDNS_RR_TYPE_SSHFP = 44, /* RFC 4255 */ @@ -179,19 +179,35 @@ enum ldns_enum_rr_type LDNS_RR_TYPE_NSEC3 = 50, /* RFC 5155 */ LDNS_RR_TYPE_NSEC3PARAM = 51, /* RFC 5155 */ LDNS_RR_TYPE_NSEC3PARAMS = 51, - /** draft-ietf-dane-protocol */ - LDNS_RR_TYPE_TLSA = 52, + LDNS_RR_TYPE_TLSA = 52, /* RFC 6698 */ + LDNS_RR_TYPE_HIP = 55, /* RFC 5205 */ + + /** draft-reid-dnsext-zs */ + LDNS_RR_TYPE_NINFO = 56, + /** draft-reid-dnsext-rkey */ + LDNS_RR_TYPE_RKEY = 57, /** draft-ietf-dnsop-trust-history */ LDNS_RR_TYPE_TALINK = 58, + /** draft-barwood-dnsop-ds-publis */ + LDNS_RR_TYPE_CDS = 59, - LDNS_RR_TYPE_SPF = 99, + LDNS_RR_TYPE_SPF = 99, /* RFC 4408 */ LDNS_RR_TYPE_UINFO = 100, LDNS_RR_TYPE_UID = 101, LDNS_RR_TYPE_GID = 102, LDNS_RR_TYPE_UNSPEC = 103, + LDNS_RR_TYPE_NID = 104, /* RFC 6742 */ + LDNS_RR_TYPE_L32 = 105, /* RFC 6742 */ + LDNS_RR_TYPE_L64 = 106, /* RFC 6742 */ + LDNS_RR_TYPE_LP = 107, /* RFC 6742 */ + + LDNS_RR_TYPE_EUI48 = 108, /* RFC 7043 */ + LDNS_RR_TYPE_EUI64 = 109, /* RFC 7043 */ + + LDNS_RR_TYPE_TKEY = 249, /* RFC 2930 */ LDNS_RR_TYPE_TSIG = 250, LDNS_RR_TYPE_IXFR = 251, LDNS_RR_TYPE_AXFR = 252, @@ -201,7 +217,12 @@ enum ldns_enum_rr_type LDNS_RR_TYPE_MAILA = 254, /** any type (wildcard) */ LDNS_RR_TYPE_ANY = 255, + /** draft-faltstrom-uri-06 */ + LDNS_RR_TYPE_URI = 256, + LDNS_RR_TYPE_CAA = 257, /* RFC 6844 */ + /** DNSSEC Trust Authorities */ + LDNS_RR_TYPE_TA = 32768, /* RFC 4431, 5074, DNSSEC Lookaside Validation */ LDNS_RR_TYPE_DLV = 32769, @@ -337,6 +358,23 @@ struct ldns_struct_rr_descriptor }; typedef struct ldns_struct_rr_descriptor ldns_rr_descriptor; + +/** + * Create a rr type bitmap rdf providing enough space to set all + * known (to ldns) rr types. + * \param[out] rdf the constructed rdf + * \return LDNS_STATUS_OK if all went well. + */ +ldns_status ldns_rdf_bitmap_known_rr_types_space(ldns_rdf** rdf); + +/** + * Create a rr type bitmap rdf with at least all known (to ldns) rr types set. + * \param[out] rdf the constructed rdf + * \return LDNS_STATUS_OK if all went well. + */ +ldns_status ldns_rdf_bitmap_known_rr_types(ldns_rdf** rdf); + + /** * creates a new rr structure. * \return ldns_rr * diff --git a/contrib/ldns/ldns/str2host.h b/contrib/ldns/ldns/str2host.h index 09416cd2252..341aa248195 100644 --- a/contrib/ldns/ldns/str2host.h +++ b/contrib/ldns/ldns/str2host.h @@ -180,14 +180,6 @@ ldns_status ldns_str2rdf_alg(ldns_rdf **rd, const char *str); */ ldns_status ldns_str2rdf_unknown(ldns_rdf **rd, const char *str); -/** - * convert string with a tsig? RR into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_tsig(ldns_rdf **rd, const char *str); - /** * convert string with a protocol service into wireformat * \param[in] rd the rdf where to put the data @@ -244,6 +236,58 @@ ldns_status ldns_str2rdf_ipseckey(ldns_rdf **rd, const char *str); */ ldns_status ldns_str2rdf_dname(ldns_rdf **rd, const char *str); +/** + * convert 4 * 16bit hex separated by colons into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_ilnp64(ldns_rdf **rd, const char *str); + +/** + * convert 6 hex bytes separated by dashes into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_eui48(ldns_rdf **rd, const char *str); + +/** + * convert 8 hex bytes separated by dashes into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_eui64(ldns_rdf **rd, const char *str); + +/** + * Convert a non-zero sequence of US-ASCII letters and numbers into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_tag(ldns_rdf **rd, const char *str); + +/** + * Convert a encoding of the value field as specified + * [RFC1035], Section 5.1., encoded as one bug chunk of data. + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_long_str(ldns_rdf **rd, const char *str); + +/** + * Convert a " " encoding of the value field as specified + * in Section 6. of [RFC5205], encoded as wireformat as specified in Section 5. + * of [RFC5205]. + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_hip(ldns_rdf **rd, const char *str); + + #ifdef __cplusplus } #endif diff --git a/contrib/ldns/ldns/util.h b/contrib/ldns/ldns/util.h index b30fc374c76..cb3806a4a4b 100644 --- a/contrib/ldns/ldns/util.h +++ b/contrib/ldns/ldns/util.h @@ -27,8 +27,8 @@ extern "C" { #define dprintf(X,Y) fprintf(stderr, (X), (Y)) /* #define dprintf(X, Y) */ -#define LDNS_VERSION "1.6.16" -#define LDNS_REVISION ((1<<16)|(6<<8)|(16)) +#define LDNS_VERSION "1.6.17" +#define LDNS_REVISION ((1<<16)|(6<<8)|(17)) /** * splint static inline workaround @@ -70,7 +70,7 @@ INLINE uint16_t ldns_read_uint16(const void *src) { #ifdef ALLOW_UNALIGNED_ACCESSES - return ntohs(*(uint16_t *) src); + return ntohs(*(const uint16_t *) src); #else const uint8_t *p = (const uint8_t *) src; return ((uint16_t) p[0] << 8) | (uint16_t) p[1]; @@ -81,7 +81,7 @@ INLINE uint32_t ldns_read_uint32(const void *src) { #ifdef ALLOW_UNALIGNED_ACCESSES - return ntohl(*(uint32_t *) src); + return ntohl(*(const uint32_t *) src); #else const uint8_t *p = (const uint8_t *) src; return ( ((uint32_t) p[0] << 24) @@ -325,65 +325,66 @@ uint16_t ldns_get_random(void); */ char *ldns_bubblebabble(uint8_t *data, size_t len); -#ifndef HAVE_B32_NTOP -int ldns_b32_ntop(uint8_t const *src, size_t srclength, - char *target, size_t targsize); -int b32_ntop(uint8_t const *src, size_t srclength, - char *target, size_t targsize); -int ldns_b32_ntop_extended_hex(uint8_t const *src, size_t srclength, - char *target, size_t targsize); -int b32_ntop_extended_hex(uint8_t const *src, size_t srclength, - char *target, size_t targsize); + +INLINE time_t ldns_time(time_t *t) { return time(t); } + + /** * calculates the size needed to store the result of b32_ntop */ /*@unused@*/ -INLINE size_t ldns_b32_ntop_calculate_size(size_t srcsize) +INLINE size_t ldns_b32_ntop_calculate_size(size_t src_data_length) { - size_t result = ((((srcsize / 5) * 8) - 2) + 2); - return result; + return src_data_length == 0 ? 0 : ((src_data_length - 1) / 5 + 1) * 8; } -#endif /* !HAVE_B32_NTOP */ -#ifndef HAVE_B32_PTON -int ldns_b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); -int b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); -int ldns_b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); -int b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); + +INLINE size_t ldns_b32_ntop_calculate_size_no_padding(size_t src_data_length) +{ + return ((src_data_length + 3) * 8 / 5) - 4; +} + +int ldns_b32_ntop(const uint8_t* src_data, size_t src_data_length, + char* target_text_buffer, size_t target_text_buffer_size); + +int ldns_b32_ntop_extended_hex(const uint8_t* src_data, size_t src_data_length, + char* target_text_buffer, size_t target_text_buffer_size); + +#if ! LDNS_BUILD_CONFIG_HAVE_B32_NTOP + +int b32_ntop(const uint8_t* src_data, size_t src_data_length, + char* target_text_buffer, size_t target_text_buffer_size); + +int b32_ntop_extended_hex(const uint8_t* src_data, size_t src_data_length, + char* target_text_buffer, size_t target_text_buffer_size); + +#endif /* ! LDNS_BUILD_CONFIG_HAVE_B32_NTOP */ + + /** * calculates the size needed to store the result of b32_pton */ /*@unused@*/ -INLINE size_t ldns_b32_pton_calculate_size(size_t srcsize) +INLINE size_t ldns_b32_pton_calculate_size(size_t src_text_length) { - size_t result = ((((srcsize) / 8) * 5)); - return result; + return src_text_length * 5 / 8; } -#endif /* !HAVE_B32_PTON */ -#ifndef HAVE_B64_NTOP -int ldns_b64_ntop(uint8_t const *src, size_t srclength, - char *target, size_t targsize); -/** - * calculates the size needed to store the result of b64_ntop - */ -/*@unused@*/ -static inline size_t ldns_b64_ntop_calculate_size(size_t srcsize) -{ - return ((((srcsize + 2) / 3) * 4) + 1); -} -#endif /* !HAVE_B64_NTOP */ -#ifndef HAVE_B64_PTON -int ldns_b64_pton(char const *src, uint8_t *target, size_t targsize); -/** - * calculates the size needed to store the result of ldns_b64_pton - */ -/*@unused@*/ -static inline size_t ldns_b64_pton_calculate_size(size_t srcsize) -{ - return (((((srcsize + 3) / 4) * 3)) + 1); -} -#endif /* !HAVE_B64_PTON */ -INLINE time_t ldns_time(time_t *t) { return time(t); } +int ldns_b32_pton(const char* src_text, size_t src_text_length, + uint8_t* target_data_buffer, size_t target_data_buffer_size); + +int ldns_b32_pton_extended_hex(const char* src_text, size_t src_text_length, + uint8_t* target_data_buffer, size_t target_data_buffer_size); + +#if ! LDNS_BUILD_CONFIG_HAVE_B32_PTON + +int b32_pton(const char* src_text, size_t src_text_length, + uint8_t* target_data_buffer, size_t target_data_buffer_size); + +int b32_pton_extended_hex(const char* src_text, size_t src_text_length, + uint8_t* target_data_buffer, size_t target_data_buffer_size); + +#endif /* ! LDNS_BUILD_CONFIG_HAVE_B32_PTON */ + #ifdef __cplusplus } diff --git a/contrib/ldns/ldns/util.h.in b/contrib/ldns/ldns/util.h.in index fe4ff3720b0..0fbc4e638e7 100644 --- a/contrib/ldns/ldns/util.h.in +++ b/contrib/ldns/ldns/util.h.in @@ -70,9 +70,9 @@ INLINE uint16_t ldns_read_uint16(const void *src) { #ifdef ALLOW_UNALIGNED_ACCESSES - return ntohs(*(uint16_t *) src); + return ntohs(*(const uint16_t *) src); #else - uint8_t *p = (uint8_t *) src; + const uint8_t *p = (const uint8_t *) src; return ((uint16_t) p[0] << 8) | (uint16_t) p[1]; #endif } @@ -81,9 +81,9 @@ INLINE uint32_t ldns_read_uint32(const void *src) { #ifdef ALLOW_UNALIGNED_ACCESSES - return ntohl(*(uint32_t *) src); + return ntohl(*(const uint32_t *) src); #else - uint8_t *p = (uint8_t *) src; + const uint8_t *p = (const uint8_t *) src; return ( ((uint32_t) p[0] << 24) | ((uint32_t) p[1] << 16) | ((uint32_t) p[2] << 8) @@ -325,42 +325,66 @@ uint16_t ldns_get_random(void); */ char *ldns_bubblebabble(uint8_t *data, size_t len); -#ifndef B32_NTOP -int ldns_b32_ntop(uint8_t const *src, size_t srclength, - char *target, size_t targsize); -int b32_ntop(uint8_t const *src, size_t srclength, - char *target, size_t targsize); -int ldns_b32_ntop_extended_hex(uint8_t const *src, size_t srclength, - char *target, size_t targsize); -int b32_ntop_extended_hex(uint8_t const *src, size_t srclength, - char *target, size_t targsize); + +INLINE time_t ldns_time(time_t *t) { return time(t); } + + /** * calculates the size needed to store the result of b32_ntop */ /*@unused@*/ -INLINE size_t ldns_b32_ntop_calculate_size(size_t srcsize) +INLINE size_t ldns_b32_ntop_calculate_size(size_t src_data_length) { - size_t result = ((((srcsize / 5) * 8) - 2) + 2); - return result; + return src_data_length == 0 ? 0 : ((src_data_length - 1) / 5 + 1) * 8; } -#endif /* !B32_NTOP */ -#ifndef B32_PTON -int ldns_b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); -int b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); -int ldns_b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); -int b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); + +INLINE size_t ldns_b32_ntop_calculate_size_no_padding(size_t src_data_length) +{ + return ((src_data_length + 3) * 8 / 5) - 4; +} + +int ldns_b32_ntop(const uint8_t* src_data, size_t src_data_length, + char* target_text_buffer, size_t target_text_buffer_size); + +int ldns_b32_ntop_extended_hex(const uint8_t* src_data, size_t src_data_length, + char* target_text_buffer, size_t target_text_buffer_size); + +#if ! LDNS_BUILD_CONFIG_HAVE_B32_NTOP + +int b32_ntop(const uint8_t* src_data, size_t src_data_length, + char* target_text_buffer, size_t target_text_buffer_size); + +int b32_ntop_extended_hex(const uint8_t* src_data, size_t src_data_length, + char* target_text_buffer, size_t target_text_buffer_size); + +#endif /* ! LDNS_BUILD_CONFIG_HAVE_B32_NTOP */ + + /** * calculates the size needed to store the result of b32_pton */ /*@unused@*/ -INLINE size_t ldns_b32_pton_calculate_size(size_t srcsize) +INLINE size_t ldns_b32_pton_calculate_size(size_t src_text_length) { - size_t result = ((((srcsize) / 8) * 5)); - return result; + return src_text_length * 5 / 8; } -#endif /* !B32_PTON */ -INLINE time_t ldns_time(time_t *t) { return time(t); } +int ldns_b32_pton(const char* src_text, size_t src_text_length, + uint8_t* target_data_buffer, size_t target_data_buffer_size); + +int ldns_b32_pton_extended_hex(const char* src_text, size_t src_text_length, + uint8_t* target_data_buffer, size_t target_data_buffer_size); + +#if ! LDNS_BUILD_CONFIG_HAVE_B32_PTON + +int b32_pton(const char* src_text, size_t src_text_length, + uint8_t* target_data_buffer, size_t target_data_buffer_size); + +int b32_pton_extended_hex(const char* src_text, size_t src_text_length, + uint8_t* target_data_buffer, size_t target_data_buffer_size); + +#endif /* ! LDNS_BUILD_CONFIG_HAVE_B32_PTON */ + #ifdef __cplusplus } diff --git a/contrib/ldns/m4/libtool.m4 b/contrib/ldns/m4/libtool.m4 new file mode 100644 index 00000000000..828104cfde2 --- /dev/null +++ b/contrib/ldns/m4/libtool.m4 @@ -0,0 +1,8001 @@ +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +m4_define([_LT_COPYING], [dnl +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool 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 of +# the License, or (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +]) + +# serial 57 LT_INIT + + +# LT_PREREQ(VERSION) +# ------------------ +# Complain and exit if this libtool version is less that VERSION. +m4_defun([LT_PREREQ], +[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, + [m4_default([$3], + [m4_fatal([Libtool version $1 or higher is required], + 63)])], + [$2])]) + + +# _LT_CHECK_BUILDDIR +# ------------------ +# Complain if the absolute build directory name contains unusual characters +m4_defun([_LT_CHECK_BUILDDIR], +[case `pwd` in + *\ * | *\ *) + AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; +esac +]) + + +# LT_INIT([OPTIONS]) +# ------------------ +AC_DEFUN([LT_INIT], +[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT +AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +AC_BEFORE([$0], [LT_LANG])dnl +AC_BEFORE([$0], [LT_OUTPUT])dnl +AC_BEFORE([$0], [LTDL_INIT])dnl +m4_require([_LT_CHECK_BUILDDIR])dnl + +dnl Autoconf doesn't catch unexpanded LT_ macros by default: +m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl +m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl +dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 +dnl unless we require an AC_DEFUNed macro: +AC_REQUIRE([LTOPTIONS_VERSION])dnl +AC_REQUIRE([LTSUGAR_VERSION])dnl +AC_REQUIRE([LTVERSION_VERSION])dnl +AC_REQUIRE([LTOBSOLETE_VERSION])dnl +m4_require([_LT_PROG_LTMAIN])dnl + +_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) + +dnl Parse OPTIONS +_LT_SET_OPTIONS([$0], [$1]) + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +_LT_SETUP + +# Only expand once: +m4_define([LT_INIT]) +])# LT_INIT + +# Old names: +AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) +AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PROG_LIBTOOL], []) +dnl AC_DEFUN([AM_PROG_LIBTOOL], []) + + +# _LT_CC_BASENAME(CC) +# ------------------- +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +m4_defun([_LT_CC_BASENAME], +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +]) + + +# _LT_FILEUTILS_DEFAULTS +# ---------------------- +# It is okay to use these file commands and assume they have been set +# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. +m4_defun([_LT_FILEUTILS_DEFAULTS], +[: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} +])# _LT_FILEUTILS_DEFAULTS + + +# _LT_SETUP +# --------- +m4_defun([_LT_SETUP], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl + +_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl +dnl +_LT_DECL([], [host_alias], [0], [The host system])dnl +_LT_DECL([], [host], [0])dnl +_LT_DECL([], [host_os], [0])dnl +dnl +_LT_DECL([], [build_alias], [0], [The build system])dnl +_LT_DECL([], [build], [0])dnl +_LT_DECL([], [build_os], [0])dnl +dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +test -z "$LN_S" && LN_S="ln -s" +_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl +dnl +AC_REQUIRE([LT_CMD_MAX_LEN])dnl +_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl +_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl +dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl +m4_require([_LT_CMD_RELOAD])dnl +m4_require([_LT_CHECK_MAGIC_METHOD])dnl +m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl +m4_require([_LT_CMD_OLD_ARCHIVE])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_WITH_SYSROOT])dnl + +_LT_CONFIG_LIBTOOL_INIT([ +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi +]) +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +_LT_CHECK_OBJDIR + +m4_require([_LT_TAG_COMPILER])dnl + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + _LT_PATH_MAGIC + fi + ;; +esac + +# Use C for the default configuration in the libtool script +LT_SUPPORTED_TAG([CC]) +_LT_LANG_C_CONFIG +_LT_LANG_DEFAULT_CONFIG +_LT_CONFIG_COMMANDS +])# _LT_SETUP + + +# _LT_PREPARE_SED_QUOTE_VARS +# -------------------------- +# Define a few sed substitution that help us do robust quoting. +m4_defun([_LT_PREPARE_SED_QUOTE_VARS], +[# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([["`\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' +]) + +# _LT_PROG_LTMAIN +# --------------- +# Note that this code is called both from `configure', and `config.status' +# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, +# `config.status' has no value for ac_aux_dir unless we are using Automake, +# so we pass a copy along to make sure it has a sensible value anyway. +m4_defun([_LT_PROG_LTMAIN], +[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl +_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) +ltmain="$ac_aux_dir/ltmain.sh" +])# _LT_PROG_LTMAIN + + +## ------------------------------------- ## +## Accumulate code for creating libtool. ## +## ------------------------------------- ## + +# So that we can recreate a full libtool script including additional +# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS +# in macros and then make a single call at the end using the `libtool' +# label. + + +# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) +# ---------------------------------------- +# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL_INIT], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_INIT], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_INIT]) + + +# _LT_CONFIG_LIBTOOL([COMMANDS]) +# ------------------------------ +# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) + + +# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) +# ----------------------------------------------------- +m4_defun([_LT_CONFIG_SAVE_COMMANDS], +[_LT_CONFIG_LIBTOOL([$1]) +_LT_CONFIG_LIBTOOL_INIT([$2]) +]) + + +# _LT_FORMAT_COMMENT([COMMENT]) +# ----------------------------- +# Add leading comment marks to the start of each line, and a trailing +# full-stop to the whole comment if one is not present already. +m4_define([_LT_FORMAT_COMMENT], +[m4_ifval([$1], [ +m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], + [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) +)]) + + + +## ------------------------ ## +## FIXME: Eliminate VARNAME ## +## ------------------------ ## + + +# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) +# ------------------------------------------------------------------- +# CONFIGNAME is the name given to the value in the libtool script. +# VARNAME is the (base) name used in the configure script. +# VALUE may be 0, 1 or 2 for a computed quote escaped value based on +# VARNAME. Any other value will be used directly. +m4_define([_LT_DECL], +[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], + [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], + [m4_ifval([$1], [$1], [$2])]) + lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) + m4_ifval([$4], + [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) + lt_dict_add_subkey([lt_decl_dict], [$2], + [tagged?], [m4_ifval([$5], [yes], [no])])]) +]) + + +# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) +# -------------------------------------------------------- +m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) + + +# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_tag_varnames], +[_lt_decl_filter([tagged?], [yes], $@)]) + + +# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) +# --------------------------------------------------------- +m4_define([_lt_decl_filter], +[m4_case([$#], + [0], [m4_fatal([$0: too few arguments: $#])], + [1], [m4_fatal([$0: too few arguments: $#: $1])], + [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], + [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], + [lt_dict_filter([lt_decl_dict], $@)])[]dnl +]) + + +# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) +# -------------------------------------------------- +m4_define([lt_decl_quote_varnames], +[_lt_decl_filter([value], [1], $@)]) + + +# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_dquote_varnames], +[_lt_decl_filter([value], [2], $@)]) + + +# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_varnames_tagged], +[m4_assert([$# <= 2])dnl +_$0(m4_quote(m4_default([$1], [[, ]])), + m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), + m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) +m4_define([_lt_decl_varnames_tagged], +[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) + + +# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_all_varnames], +[_$0(m4_quote(m4_default([$1], [[, ]])), + m4_if([$2], [], + m4_quote(lt_decl_varnames), + m4_quote(m4_shift($@))))[]dnl +]) +m4_define([_lt_decl_all_varnames], +[lt_join($@, lt_decl_varnames_tagged([$1], + lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl +]) + + +# _LT_CONFIG_STATUS_DECLARE([VARNAME]) +# ------------------------------------ +# Quote a variable value, and forward it to `config.status' so that its +# declaration there will have the same value as in `configure'. VARNAME +# must have a single quote delimited value for this to work. +m4_define([_LT_CONFIG_STATUS_DECLARE], +[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) + + +# _LT_CONFIG_STATUS_DECLARATIONS +# ------------------------------ +# We delimit libtool config variables with single quotes, so when +# we write them to config.status, we have to be sure to quote all +# embedded single quotes properly. In configure, this macro expands +# each variable declared with _LT_DECL (and _LT_TAGDECL) into: +# +# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' +m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], +[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), + [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAGS +# ---------------- +# Output comment and list of tags supported by the script +m4_defun([_LT_LIBTOOL_TAGS], +[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl +available_tags="_LT_TAGS"dnl +]) + + +# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) +# ----------------------------------- +# Extract the dictionary values for VARNAME (optionally with TAG) and +# expand to a commented shell variable setting: +# +# # Some comment about what VAR is for. +# visible_name=$lt_internal_name +m4_define([_LT_LIBTOOL_DECLARE], +[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], + [description])))[]dnl +m4_pushdef([_libtool_name], + m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl +m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), + [0], [_libtool_name=[$]$1], + [1], [_libtool_name=$lt_[]$1], + [2], [_libtool_name=$lt_[]$1], + [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl +m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl +]) + + +# _LT_LIBTOOL_CONFIG_VARS +# ----------------------- +# Produce commented declarations of non-tagged libtool config variables +# suitable for insertion in the LIBTOOL CONFIG section of the `libtool' +# script. Tagged libtool config variables (even for the LIBTOOL CONFIG +# section) are produced by _LT_LIBTOOL_TAG_VARS. +m4_defun([_LT_LIBTOOL_CONFIG_VARS], +[m4_foreach([_lt_var], + m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAG_VARS(TAG) +# ------------------------- +m4_define([_LT_LIBTOOL_TAG_VARS], +[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) + + +# _LT_TAGVAR(VARNAME, [TAGNAME]) +# ------------------------------ +m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) + + +# _LT_CONFIG_COMMANDS +# ------------------- +# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of +# variables for single and double quote escaping we saved from calls +# to _LT_DECL, we can put quote escaped variables declarations +# into `config.status', and then the shell code to quote escape them in +# for loops in `config.status'. Finally, any additional code accumulated +# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. +m4_defun([_LT_CONFIG_COMMANDS], +[AC_PROVIDE_IFELSE([LT_OUTPUT], + dnl If the libtool generation code has been placed in $CONFIG_LT, + dnl instead of duplicating it all over again into config.status, + dnl then we will have config.status run $CONFIG_LT later, so it + dnl needs to know what name is stored there: + [AC_CONFIG_COMMANDS([libtool], + [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], + dnl If the libtool generation code is destined for config.status, + dnl expand the accumulated commands and init code now: + [AC_CONFIG_COMMANDS([libtool], + [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) +])#_LT_CONFIG_COMMANDS + + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], +[ + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +_LT_CONFIG_STATUS_DECLARATIONS +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$[]1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_quote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_dquote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +_LT_OUTPUT_LIBTOOL_INIT +]) + +# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) +# ------------------------------------ +# Generate a child script FILE with all initialization necessary to +# reuse the environment learned by the parent script, and make the +# file executable. If COMMENT is supplied, it is inserted after the +# `#!' sequence but before initialization text begins. After this +# macro, additional text can be appended to FILE to form the body of +# the child script. The macro ends with non-zero status if the +# file could not be fully written (such as if the disk is full). +m4_ifdef([AS_INIT_GENERATED], +[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], +[m4_defun([_LT_GENERATED_FILE_INIT], +[m4_require([AS_PREPARE])]dnl +[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl +[lt_write_fail=0 +cat >$1 <<_ASEOF || lt_write_fail=1 +#! $SHELL +# Generated by $as_me. +$2 +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$1 <<\_ASEOF || lt_write_fail=1 +AS_SHELL_SANITIZE +_AS_PREPARE +exec AS_MESSAGE_FD>&1 +_ASEOF +test $lt_write_fail = 0 && chmod +x $1[]dnl +m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT + +# LT_OUTPUT +# --------- +# This macro allows early generation of the libtool script (before +# AC_OUTPUT is called), incase it is used in configure for compilation +# tests. +AC_DEFUN([LT_OUTPUT], +[: ${CONFIG_LT=./config.lt} +AC_MSG_NOTICE([creating $CONFIG_LT]) +_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], +[# Run this file to recreate a libtool stub with the current configuration.]) + +cat >>"$CONFIG_LT" <<\_LTEOF +lt_cl_silent=false +exec AS_MESSAGE_LOG_FD>>config.log +{ + echo + AS_BOX([Running $as_me.]) +} >&AS_MESSAGE_LOG_FD + +lt_cl_help="\ +\`$as_me' creates a local libtool stub from the current configuration, +for use in further configure time tests before the real libtool is +generated. + +Usage: $[0] [[OPTIONS]] + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + +Report bugs to ." + +lt_cl_version="\ +m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl +m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) +configured by $[0], generated by m4_PACKAGE_STRING. + +Copyright (C) 2011 Free Software Foundation, Inc. +This config.lt script is free software; the Free Software Foundation +gives unlimited permision to copy, distribute and modify it." + +while test $[#] != 0 +do + case $[1] in + --version | --v* | -V ) + echo "$lt_cl_version"; exit 0 ;; + --help | --h* | -h ) + echo "$lt_cl_help"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --quiet | --q* | --silent | --s* | -q ) + lt_cl_silent=: ;; + + -*) AC_MSG_ERROR([unrecognized option: $[1] +Try \`$[0] --help' for more information.]) ;; + + *) AC_MSG_ERROR([unrecognized argument: $[1] +Try \`$[0] --help' for more information.]) ;; + esac + shift +done + +if $lt_cl_silent; then + exec AS_MESSAGE_FD>/dev/null +fi +_LTEOF + +cat >>"$CONFIG_LT" <<_LTEOF +_LT_OUTPUT_LIBTOOL_COMMANDS_INIT +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +AC_MSG_NOTICE([creating $ofile]) +_LT_OUTPUT_LIBTOOL_COMMANDS +AS_EXIT(0) +_LTEOF +chmod +x "$CONFIG_LT" + +# configure is writing to config.log, but config.lt does its own redirection, +# appending to config.log, which fails on DOS, as config.log is still kept +# open by configure. Here we exec the FD to /dev/null, effectively closing +# config.log, so it can be properly (re)opened and appended to by config.lt. +lt_cl_success=: +test "$silent" = yes && + lt_config_lt_args="$lt_config_lt_args --quiet" +exec AS_MESSAGE_LOG_FD>/dev/null +$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false +exec AS_MESSAGE_LOG_FD>>config.log +$lt_cl_success || AS_EXIT(1) +])# LT_OUTPUT + + +# _LT_CONFIG(TAG) +# --------------- +# If TAG is the built-in tag, create an initial libtool script with a +# default configuration from the untagged config vars. Otherwise add code +# to config.status for appending the configuration named by TAG from the +# matching tagged config vars. +m4_defun([_LT_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_CONFIG_SAVE_COMMANDS([ + m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl + m4_if(_LT_TAG, [C], [ + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +_LT_COPYING +_LT_LIBTOOL_TAGS + +# ### BEGIN LIBTOOL CONFIG +_LT_LIBTOOL_CONFIG_VARS +_LT_LIBTOOL_TAG_VARS +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + _LT_PROG_LTMAIN + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + _LT_PROG_REPLACE_SHELLFNS + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +], +[cat <<_LT_EOF >> "$ofile" + +dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded +dnl in a comment (ie after a #). +# ### BEGIN LIBTOOL TAG CONFIG: $1 +_LT_LIBTOOL_TAG_VARS(_LT_TAG) +# ### END LIBTOOL TAG CONFIG: $1 +_LT_EOF +])dnl /m4_if +], +[m4_if([$1], [], [ + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile'], []) +])dnl /_LT_CONFIG_SAVE_COMMANDS +])# _LT_CONFIG + + +# LT_SUPPORTED_TAG(TAG) +# --------------------- +# Trace this macro to discover what tags are supported by the libtool +# --tag option, using: +# autoconf --trace 'LT_SUPPORTED_TAG:$1' +AC_DEFUN([LT_SUPPORTED_TAG], []) + + +# C support is built-in for now +m4_define([_LT_LANG_C_enabled], []) +m4_define([_LT_TAGS], []) + + +# LT_LANG(LANG) +# ------------- +# Enable libtool support for the given language if not already enabled. +AC_DEFUN([LT_LANG], +[AC_BEFORE([$0], [LT_OUTPUT])dnl +m4_case([$1], + [C], [_LT_LANG(C)], + [C++], [_LT_LANG(CXX)], + [Go], [_LT_LANG(GO)], + [Java], [_LT_LANG(GCJ)], + [Fortran 77], [_LT_LANG(F77)], + [Fortran], [_LT_LANG(FC)], + [Windows Resource], [_LT_LANG(RC)], + [m4_ifdef([_LT_LANG_]$1[_CONFIG], + [_LT_LANG($1)], + [m4_fatal([$0: unsupported language: "$1"])])])dnl +])# LT_LANG + + +# _LT_LANG(LANGNAME) +# ------------------ +m4_defun([_LT_LANG], +[m4_ifdef([_LT_LANG_]$1[_enabled], [], + [LT_SUPPORTED_TAG([$1])dnl + m4_append([_LT_TAGS], [$1 ])dnl + m4_define([_LT_LANG_]$1[_enabled], [])dnl + _LT_LANG_$1_CONFIG($1)])dnl +])# _LT_LANG + + +m4_ifndef([AC_PROG_GO], [ +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_GO. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ +m4_defun([AC_PROG_GO], +[AC_LANG_PUSH(Go)dnl +AC_ARG_VAR([GOC], [Go compiler command])dnl +AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +AC_CHECK_TOOL(GOC, gccgo) +if test -z "$GOC"; then + if test -n "$ac_tool_prefix"; then + AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) + fi +fi +if test -z "$GOC"; then + AC_CHECK_PROG(GOC, gccgo, gccgo, false) +fi +])#m4_defun +])#m4_ifndef + + +# _LT_LANG_DEFAULT_CONFIG +# ----------------------- +m4_defun([_LT_LANG_DEFAULT_CONFIG], +[AC_PROVIDE_IFELSE([AC_PROG_CXX], + [LT_LANG(CXX)], + [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) + +AC_PROVIDE_IFELSE([AC_PROG_F77], + [LT_LANG(F77)], + [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) + +AC_PROVIDE_IFELSE([AC_PROG_FC], + [LT_LANG(FC)], + [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) + +dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal +dnl pulling things in needlessly. +AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([LT_PROG_GCJ], + [LT_LANG(GCJ)], + [m4_ifdef([AC_PROG_GCJ], + [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([A][M_PROG_GCJ], + [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([LT_PROG_GCJ], + [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) + +AC_PROVIDE_IFELSE([AC_PROG_GO], + [LT_LANG(GO)], + [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) + +AC_PROVIDE_IFELSE([LT_PROG_RC], + [LT_LANG(RC)], + [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) +])# _LT_LANG_DEFAULT_CONFIG + +# Obsolete macros: +AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) +AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) +AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) +AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) +AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_CXX], []) +dnl AC_DEFUN([AC_LIBTOOL_F77], []) +dnl AC_DEFUN([AC_LIBTOOL_FC], []) +dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) +dnl AC_DEFUN([AC_LIBTOOL_RC], []) + + +# _LT_TAG_COMPILER +# ---------------- +m4_defun([_LT_TAG_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl +_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl +_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl +_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_TAG_COMPILER + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +m4_defun([_LT_COMPILER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +m4_defun([_LT_LINKER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* +])# _LT_LINKER_BOILERPLATE + +# _LT_REQUIRED_DARWIN_CHECKS +# ------------------------- +m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ + case $host_os in + rhapsody* | darwin*) + AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) + AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) + AC_CHECK_TOOL([LIPO], [lipo], [:]) + AC_CHECK_TOOL([OTOOL], [otool], [:]) + AC_CHECK_TOOL([OTOOL64], [otool64], [:]) + _LT_DECL([], [DSYMUTIL], [1], + [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) + _LT_DECL([], [NMEDIT], [1], + [Tool to change global to local symbols on Mac OS X]) + _LT_DECL([], [LIPO], [1], + [Tool to manipulate fat objects and archives on Mac OS X]) + _LT_DECL([], [OTOOL], [1], + [ldd/readelf like tool for Mach-O binaries on Mac OS X]) + _LT_DECL([], [OTOOL64], [1], + [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) + + AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], + [lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test $_lt_result -eq 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi]) + + AC_CACHE_CHECK([for -exported_symbols_list linker flag], + [lt_cv_ld_exported_symbols_list], + [lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [lt_cv_ld_exported_symbols_list=yes], + [lt_cv_ld_exported_symbols_list=no]) + LDFLAGS="$save_LDFLAGS" + ]) + + AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], + [lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD + echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD + $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD + echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD + $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + ]) + case $host_os in + rhapsody* | darwin1.[[012]]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[[012]]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac +]) + + +# _LT_DARWIN_LINKER_FEATURES([TAG]) +# --------------------------------- +# Checks for linker and compiler features on darwin +m4_defun([_LT_DARWIN_LINKER_FEATURES], +[ + m4_require([_LT_REQUIRED_DARWIN_CHECKS]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_automatic, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + if test "$lt_cv_ld_force_load" = "yes"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], + [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='' + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=func_echo_all + _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + m4_if([$1], [CXX], +[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then + _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" + fi +],[]) + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi +]) + +# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) +# ---------------------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +# Store the results from the different compilers for each TAGNAME. +# Allow to override them for all tags through lt_cv_aix_libpath. +m4_defun([_LT_SYS_MODULE_PATH_AIX], +[m4_require([_LT_DECL_SED])dnl +if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], + [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ + lt_aix_libpath_sed='[ + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }]' + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi],[]) + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" + fi + ]) + aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) +fi +])# _LT_SYS_MODULE_PATH_AIX + + +# _LT_SHELL_INIT(ARG) +# ------------------- +m4_define([_LT_SHELL_INIT], +[m4_divert_text([M4SH-INIT], [$1 +])])# _LT_SHELL_INIT + + + +# _LT_PROG_ECHO_BACKSLASH +# ----------------------- +# Find how we can fake an echo command that does not interpret backslash. +# In particular, with Autoconf 2.60 or later we add some code to the start +# of the generated configure script which will find a shell with a builtin +# printf (which we can use as an echo command). +m4_defun([_LT_PROG_ECHO_BACKSLASH], +[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +AC_MSG_CHECKING([how to print strings]) +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$[]1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + +case "$ECHO" in + printf*) AC_MSG_RESULT([printf]) ;; + print*) AC_MSG_RESULT([print -r]) ;; + *) AC_MSG_RESULT([cat]) ;; +esac + +m4_ifdef([_AS_DETECT_SUGGESTED], +[_AS_DETECT_SUGGESTED([ + test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test "X`printf %s $ECHO`" = "X$ECHO" \ + || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) + +_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) +_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) +])# _LT_PROG_ECHO_BACKSLASH + + +# _LT_WITH_SYSROOT +# ---------------- +AC_DEFUN([_LT_WITH_SYSROOT], +[AC_MSG_CHECKING([for sysroot]) +AC_ARG_WITH([sysroot], +[ --with-sysroot[=DIR] Search for dependent libraries within DIR + (or the compiler's sysroot if not specified).], +[], [with_sysroot=no]) + +dnl lt_sysroot will always be passed unquoted. We quote it here +dnl in case the user passed a directory name. +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + AC_MSG_RESULT([${with_sysroot}]) + AC_MSG_ERROR([The sysroot must be an absolute path.]) + ;; +esac + + AC_MSG_RESULT([${lt_sysroot:-no}]) +_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl +[dependent libraries, and in which our libraries should be installed.])]) + +# _LT_ENABLE_LOCK +# --------------- +m4_defun([_LT_ENABLE_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AS_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD="${LD-ld}_sol2" + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" +])# _LT_ENABLE_LOCK + + +# _LT_PROG_AR +# ----------- +m4_defun([_LT_PROG_AR], +[AC_CHECK_TOOLS(AR, [ar], false) +: ${AR=ar} +: ${AR_FLAGS=cru} +_LT_DECL([], [AR], [1], [The archiver]) +_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) + +AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], + [lt_cv_ar_at_file=no + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([lt_ar_try]) + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + AC_TRY_EVAL([lt_ar_try]) + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + ]) + ]) + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi +_LT_DECL([], [archiver_list_spec], [1], + [How to feed a file listing to the archiver]) +])# _LT_PROG_AR + + +# _LT_CMD_OLD_ARCHIVE +# ------------------- +m4_defun([_LT_CMD_OLD_ARCHIVE], +[_LT_PROG_AR + +AC_CHECK_TOOL(STRIP, strip, :) +test -z "$STRIP" && STRIP=: +_LT_DECL([], [STRIP], [1], [A symbol stripping program]) + +AC_CHECK_TOOL(RANLIB, ranlib, :) +test -z "$RANLIB" && RANLIB=: +_LT_DECL([], [RANLIB], [1], + [Commands used to install an old-style archive]) + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac +_LT_DECL([], [old_postinstall_cmds], [2]) +_LT_DECL([], [old_postuninstall_cmds], [2]) +_LT_TAGDECL([], [old_archive_cmds], [2], + [Commands used to build an old-style archive]) +_LT_DECL([], [lock_old_archive_extraction], [0], + [Whether to use a lock for old archive extraction]) +])# _LT_CMD_OLD_ARCHIVE + + +# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([_LT_COMPILER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $RM conftest* +]) + +if test x"[$]$2" = xyes; then + m4_if([$5], , :, [$5]) +else + m4_if([$6], , :, [$6]) +fi +])# _LT_COMPILER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) + + +# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------- +# Check whether the given linker option works +AC_DEFUN([_LT_LINKER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + m4_if([$4], , :, [$4]) +else + m4_if([$5], , :, [$5]) +fi +])# _LT_LINKER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) + + +# LT_CMD_MAX_LEN +#--------------- +AC_DEFUN([LT_CMD_MAX_LEN], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +max_cmd_len=$lt_cv_sys_max_cmd_len +_LT_DECL([], [max_cmd_len], [0], + [What is the maximum length of a command?]) +])# LT_CMD_MAX_LEN + +# Old name: +AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) + + +# _LT_HEADER_DLFCN +# ---------------- +m4_defun([_LT_HEADER_DLFCN], +[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl +])# _LT_HEADER_DLFCN + + +# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ---------------------------------------------------------------- +m4_defun([_LT_TRY_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +[#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +}] +_LT_EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_dlunknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_TRY_DLOPEN_SELF + + +# LT_SYS_DLOPEN_SELF +# ------------------ +AC_DEFUN([LT_SYS_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +_LT_DECL([dlopen_support], [enable_dlopen], [0], + [Whether dlopen is supported]) +_LT_DECL([dlopen_self], [enable_dlopen_self], [0], + [Whether dlopen of programs is supported]) +_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], + [Whether dlopen of statically linked programs is supported]) +])# LT_SYS_DLOPEN_SELF + +# Old name: +AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) + + +# _LT_COMPILER_C_O([TAGNAME]) +# --------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler. +# This macro does not hard code the compiler like AC_PROG_CC_C_O. +m4_defun([_LT_COMPILER_C_O], +[m4_require([_LT_DECL_SED])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . 2>&AS_MESSAGE_LOG_FD + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* +]) +_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], + [Does compiler simultaneously support -c and -o options?]) +])# _LT_COMPILER_C_O + + +# _LT_COMPILER_FILE_LOCKS([TAGNAME]) +# ---------------------------------- +# Check to see if we can do hard links to lock some files if needed +m4_defun([_LT_COMPILER_FILE_LOCKS], +[m4_require([_LT_ENABLE_LOCK])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_COMPILER_C_O([$1]) + +hard_links="nottested" +if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) +])# _LT_COMPILER_FILE_LOCKS + + +# _LT_CHECK_OBJDIR +# ---------------- +m4_defun([_LT_CHECK_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +_LT_DECL([], [objdir], [0], + [The name of the directory that contains temporary libtool files])dnl +m4_pattern_allow([LT_OBJDIR])dnl +AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", + [Define to the sub-directory in which libtool stores uninstalled libraries.]) +])# _LT_CHECK_OBJDIR + + +# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) +# -------------------------------------- +# Check hardcoding attributes. +m4_defun([_LT_LINKER_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || + test -n "$_LT_TAGVAR(runpath_var, $1)" || + test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || + test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +_LT_TAGDECL([], [hardcode_action], [0], + [How to hardcode a shared library path into an executable]) +])# _LT_LINKER_HARDCODE_LIBPATH + + +# _LT_CMD_STRIPLIB +# ---------------- +m4_defun([_LT_CMD_STRIPLIB], +[m4_require([_LT_DECL_EGREP]) +striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) +_LT_DECL([], [striplib], [1]) +])# _LT_CMD_STRIPLIB + + +# _LT_SYS_DYNAMIC_LINKER([TAG]) +# ----------------------------- +# PORTME Fill in your ld.so characteristics +m4_defun([_LT_SYS_DYNAMIC_LINKER], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_OBJDUMP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +AC_MSG_CHECKING([dynamic linker characteristics]) +m4_if([$1], + [], [ +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[[lt_foo]]++; } + if (lt_freq[[lt_foo]] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[[4-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[[45]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[23]].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ + freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[[3-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], + [lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ + LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], + [lt_cv_shlibpath_overrides_runpath=yes])]) + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + ]) + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + +_LT_DECL([], [variables_saved_for_relink], [1], + [Variables whose values should be saved in libtool wrapper scripts and + restored at link time]) +_LT_DECL([], [need_lib_prefix], [0], + [Do we need the "lib" prefix for modules?]) +_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) +_LT_DECL([], [version_type], [0], [Library versioning type]) +_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) +_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) +_LT_DECL([], [shlibpath_overrides_runpath], [0], + [Is shlibpath searched before the hard-coded library search path?]) +_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) +_LT_DECL([], [library_names_spec], [1], + [[List of archive names. First name is the real one, the rest are links. + The last name is the one that the linker finds with -lNAME]]) +_LT_DECL([], [soname_spec], [1], + [[The coded name of the library, if different from the real name]]) +_LT_DECL([], [install_override_mode], [1], + [Permission mode override for installation of shared libraries]) +_LT_DECL([], [postinstall_cmds], [2], + [Command to use after installation of a shared archive]) +_LT_DECL([], [postuninstall_cmds], [2], + [Command to use after uninstallation of a shared archive]) +_LT_DECL([], [finish_cmds], [2], + [Commands used to finish a libtool library installation in a directory]) +_LT_DECL([], [finish_eval], [1], + [[As "finish_cmds", except a single script fragment to be evaled but + not shown]]) +_LT_DECL([], [hardcode_into_libs], [0], + [Whether we should hardcode library paths into libraries]) +_LT_DECL([], [sys_lib_search_path_spec], [2], + [Compile-time system search path for libraries]) +_LT_DECL([], [sys_lib_dlsearch_path_spec], [2], + [Run-time system search path for libraries]) +])# _LT_SYS_DYNAMIC_LINKER + + +# _LT_PATH_TOOL_PREFIX(TOOL) +# -------------------------- +# find a file program which can recognize shared library +AC_DEFUN([_LT_PATH_TOOL_PREFIX], +[m4_require([_LT_DECL_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="m4_if([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +_LT_DECL([], [MAGIC_CMD], [0], + [Used to examine libraries when file_magic_cmd begins with "file"])dnl +])# _LT_PATH_TOOL_PREFIX + +# Old name: +AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) + + +# _LT_PATH_MAGIC +# -------------- +# find a file program which can recognize a shared library +m4_defun([_LT_PATH_MAGIC], +[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# _LT_PATH_MAGIC + + +# LT_PATH_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([LT_PATH_LD], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PROG_ECHO_BACKSLASH])dnl + +AC_ARG_WITH([gnu-ld], + [AS_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test "$withval" = no || with_gnu_ld=yes], + [with_gnu_ld=no])dnl + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[[3-9]]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +_LT_DECL([], [deplibs_check_method], [1], + [Method to check whether dependent libraries are shared objects]) +_LT_DECL([], [file_magic_cmd], [1], + [Command to use when deplibs_check_method = "file_magic"]) +_LT_DECL([], [file_magic_glob], [1], + [How to find potential files when deplibs_check_method = "file_magic"]) +_LT_DECL([], [want_nocaseglob], [1], + [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) +])# _LT_CHECK_MAGIC_METHOD + + +# LT_PATH_NM +# ---------- +# find the pathname to a BSD- or MS-compatible name lister +AC_DEFUN([LT_PATH_NM], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi]) +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi + AC_SUBST([DUMPBIN]) + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm +AC_SUBST([NM]) +_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl + +AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], + [lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) + cat conftest.out >&AS_MESSAGE_LOG_FD + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest*]) +])# LT_PATH_NM + +# Old names: +AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) +AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_PROG_NM], []) +dnl AC_DEFUN([AC_PROG_NM], []) + +# _LT_CHECK_SHAREDLIB_FROM_LINKLIB +# -------------------------------- +# how to determine the name of the shared library +# associated with a specific link library. +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +m4_require([_LT_DECL_DLLTOOL]) +AC_CACHE_CHECK([how to associate runtime and link libraries], +lt_cv_sharedlib_from_linklib_cmd, +[lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac +]) +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + +_LT_DECL([], [sharedlib_from_linklib_cmd], [1], + [Command to associate shared and link libraries]) +])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB + + +# _LT_PATH_MANIFEST_TOOL +# ---------------------- +# locate the manifest tool +m4_defun([_LT_PATH_MANIFEST_TOOL], +[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], + [lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&AS_MESSAGE_LOG_FD + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest*]) +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi +_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl +])# _LT_PATH_MANIFEST_TOOL + + +# LT_LIB_M +# -------- +# check for math library +AC_DEFUN([LT_LIB_M], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +AC_SUBST([LIBM]) +])# LT_LIB_M + +# Old name: +AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_CHECK_LIBM], []) + + +# _LT_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------- +m4_defun([_LT_COMPILER_NO_RTTI], +[m4_require([_LT_TAG_COMPILER])dnl + +_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + case $cc_basename in + nvcc*) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; + *) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; + esac + + _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], + [Compiler flag to turn off builtin functions]) +])# _LT_COMPILER_NO_RTTI + + +# _LT_CMD_GLOBAL_SYMBOLS +# ---------------------- +m4_defun([_LT_CMD_GLOBAL_SYMBOLS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([LT_PATH_NM])dnl +AC_REQUIRE([LT_PATH_LD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_TAG_COMPILER])dnl + +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris*) + symcode='[[BDRT]]' + ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK ['"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx]" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT@&t@_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT@&t@_DLSYM_CONST +#else +# define LT@&t@_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT@&t@_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[[]] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + +_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], + [Take the output of nm and produce a listing of raw symbols and C names]) +_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], + [Transform the output of nm in a proper C declaration]) +_LT_DECL([global_symbol_to_c_name_address], + [lt_cv_sys_global_symbol_to_c_name_address], [1], + [Transform the output of nm in a C name address pair]) +_LT_DECL([global_symbol_to_c_name_address_lib_prefix], + [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], + [Transform the output of nm in a C name address pair when lib prefix is needed]) +_LT_DECL([], [nm_file_list_spec], [1], + [Specify filename containing input files for $NM]) +]) # _LT_CMD_GLOBAL_SYMBOLS + + +# _LT_COMPILER_PIC([TAGNAME]) +# --------------------------- +m4_defun([_LT_COMPILER_PIC], +[m4_require([_LT_TAG_COMPILER])dnl +_LT_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_TAGVAR(lt_prog_compiler_static, $1)= + +m4_if([$1], [CXX], [ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix[[4-9]]*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64 which still supported -KPIC. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd* | netbsdelf*-gnu) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' + if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + hpux9* | hpux10* | hpux11*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' + _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' + ;; + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + ccc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + *Sun\ F* | *Sun*Fortran*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + *Intel*\ [[CF]]*Compiler*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + *Portland\ Group*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + rdos*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + solaris*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + unicos*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" + ;; +esac + +AC_CACHE_CHECK([for $compiler option to produce PIC], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) +_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], + [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], + [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], + [Additional compiler flags for building library objects]) + +_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], + [How to pass a linker flag through the compiler]) +# +# Check to make sure the static flag actually works. +# +wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" +_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], + _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) +_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], + [Compiler flag to prevent dynamic linking]) +])# _LT_COMPILER_PIC + + +# _LT_LINKER_SHLIBS([TAGNAME]) +# ---------------------------- +# See if the linker supports building shared libraries. +m4_defun([_LT_LINKER_SHLIBS], +[AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +m4_if([$1], [CXX], [ + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + case $host_os in + aix[[4-9]]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global defined + # symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw* | cegcc*) + case $cc_basename in + cl*) + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + ;; + esac + ;; + linux* | k*bsd*-gnu | gnu*) + _LT_TAGVAR(link_all_deplibs, $1)=no + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +], [ + runpath_var= + _LT_TAGVAR(allow_undefined_flag, $1)= + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(archive_cmds, $1)= + _LT_TAGVAR(archive_expsym_cmds, $1)= + _LT_TAGVAR(compiler_needs_object, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(hardcode_automatic, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(hardcode_libdir_separator, $1)= + _LT_TAGVAR(hardcode_minus_L, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_TAGVAR(inherit_rpath, $1)=no + _LT_TAGVAR(link_all_deplibs, $1)=unknown + _LT_TAGVAR(module_cmds, $1)= + _LT_TAGVAR(module_expsym_cmds, $1)= + _LT_TAGVAR(old_archive_from_new_cmds, $1)= + _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_TAGVAR(thread_safe_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. +dnl Note also adjust exclude_expsyms for C++ above. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + linux* | k*bsd*-gnu | gnu*) + _LT_TAGVAR(link_all_deplibs, $1)=no + ;; + esac + + _LT_TAGVAR(ld_shlibs, $1)=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; + *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[[3-9]]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + _LT_TAGVAR(whole_archive_flag_spec, $1)= + tmp_sharedflag='--shared' ;; + xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + sunos4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then + runpath_var= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + _LT_TAGVAR(link_all_deplibs, $1)=no + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + bsdi[[45]]*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + esac + ;; + + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + m4_if($1, [], [ + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + _LT_LINKER_OPTION([if $CC understands -b], + _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], + [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) + ;; + esac + fi + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], + [lt_cv_irix_exported_symbol], + [save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + AC_LINK_IFELSE( + [AC_LANG_SOURCE( + [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], + [C++], [[int foo (void) { return 0; }]], + [Fortran 77], [[ + subroutine foo + end]], + [Fortran], [[ + subroutine foo + end]])])], + [lt_cv_irix_exported_symbol=yes], + [lt_cv_irix_exported_symbol=no]) + LDFLAGS="$save_LDFLAGS"]) + if test "$lt_cv_irix_exported_symbol" = yes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + solaris*) + _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + fi + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' + ;; + esac + fi + fi +]) +AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) +test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld + +_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl +_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl +_LT_DECL([], [extract_expsyms_cmds], [2], + [The commands to extract the exported symbol list from a shared archive]) + +# +# Do we need to explicitly link libc? +# +case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_CACHE_CHECK([whether -lc should be explicitly linked in], + [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), + [$RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) + _LT_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no + else + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + ]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) + ;; + esac + fi + ;; +esac + +_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], + [Whether or not to add -lc for building shared libraries]) +_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], + [enable_shared_with_static_runtimes], [0], + [Whether or not to disallow shared libs when runtime libs are static]) +_LT_TAGDECL([], [export_dynamic_flag_spec], [1], + [Compiler flag to allow reflexive dlopens]) +_LT_TAGDECL([], [whole_archive_flag_spec], [1], + [Compiler flag to generate shared objects directly from archives]) +_LT_TAGDECL([], [compiler_needs_object], [1], + [Whether the compiler copes with passing no objects directly]) +_LT_TAGDECL([], [old_archive_from_new_cmds], [2], + [Create an old-style archive from a shared archive]) +_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], + [Create a temporary old-style archive to link instead of a shared archive]) +_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) +_LT_TAGDECL([], [archive_expsym_cmds], [2]) +_LT_TAGDECL([], [module_cmds], [2], + [Commands used to build a loadable module if different from building + a shared archive.]) +_LT_TAGDECL([], [module_expsym_cmds], [2]) +_LT_TAGDECL([], [with_gnu_ld], [1], + [Whether we are building with GNU ld or not]) +_LT_TAGDECL([], [allow_undefined_flag], [1], + [Flag that allows shared libraries with undefined symbols to be built]) +_LT_TAGDECL([], [no_undefined_flag], [1], + [Flag that enforces no undefined symbols]) +_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], + [Flag to hardcode $libdir into a binary during linking. + This must work even if $libdir does not exist]) +_LT_TAGDECL([], [hardcode_libdir_separator], [1], + [Whether we need a single "-rpath" flag with a separated argument]) +_LT_TAGDECL([], [hardcode_direct], [0], + [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes + DIR into the resulting binary]) +_LT_TAGDECL([], [hardcode_direct_absolute], [0], + [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes + DIR into the resulting binary and the resulting library dependency is + "absolute", i.e impossible to change by setting ${shlibpath_var} if the + library is relocated]) +_LT_TAGDECL([], [hardcode_minus_L], [0], + [Set to "yes" if using the -LDIR flag during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_shlibpath_var], [0], + [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_automatic], [0], + [Set to "yes" if building a shared library automatically hardcodes DIR + into the library and all subsequent libraries and executables linked + against it]) +_LT_TAGDECL([], [inherit_rpath], [0], + [Set to yes if linker adds runtime paths of dependent libraries + to runtime path list]) +_LT_TAGDECL([], [link_all_deplibs], [0], + [Whether libtool must link a program against all its dependency libraries]) +_LT_TAGDECL([], [always_export_symbols], [0], + [Set to "yes" if exported symbols are required]) +_LT_TAGDECL([], [export_symbols_cmds], [2], + [The commands to list exported symbols]) +_LT_TAGDECL([], [exclude_expsyms], [1], + [Symbols that should not be listed in the preloaded symbols]) +_LT_TAGDECL([], [include_expsyms], [1], + [Symbols that must always be exported]) +_LT_TAGDECL([], [prelink_cmds], [2], + [Commands necessary for linking programs (against libraries) with templates]) +_LT_TAGDECL([], [postlink_cmds], [2], + [Commands necessary for finishing linking programs]) +_LT_TAGDECL([], [file_list_spec], [1], + [Specify filename containing input files]) +dnl FIXME: Not yet implemented +dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], +dnl [Compiler flag to generate thread safe objects]) +])# _LT_LINKER_SHLIBS + + +# _LT_LANG_C_CONFIG([TAG]) +# ------------------------ +# Ensure that the configuration variables for a C compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to `libtool'. +m4_defun([_LT_LANG_C_CONFIG], +[m4_require([_LT_DECL_EGREP])dnl +lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + +_LT_TAG_COMPILER +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + LT_SYS_DLOPEN_SELF + _LT_CMD_STRIPLIB + + # Report which library types will actually be built + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_CONFIG($1) +fi +AC_LANG_POP +CC="$lt_save_CC" +])# _LT_LANG_C_CONFIG + + +# _LT_LANG_CXX_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a C++ compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to `libtool'. +m4_defun([_LT_LANG_CXX_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_PROG_CXXCPP +else + _lt_caught_CXX_error=yes +fi + +AC_LANG_PUSH(C++) +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(compiler_needs_object, $1)=no +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the CXX compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_caught_CXX_error" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="int some_variable = 0;" + + # Code to be used in simple link tests + lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS + lt_save_LD=$LD + lt_save_GCC=$GCC + GCC=$GXX + lt_save_with_gnu_ld=$with_gnu_ld + lt_save_path_LD=$lt_cv_path_LD + if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else + $as_unset lt_cv_prog_gnu_ld + fi + if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX + else + $as_unset lt_cv_path_LD + fi + test -z "${LDCXX+set}" || LD=$LDCXX + CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test "$GXX" = yes; then + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + else + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + fi + + if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + LT_PATH_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | + $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) + _LT_TAGVAR(ld_shlibs, $1)=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' + + if test "$GXX" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to + # export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty + # executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared + # libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + freebsd2.*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + freebsd-elf*) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + gnu*) + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + hpux9*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' + fi + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc* | ecpc* ) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) + _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $RANLIB $oldlib' + _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + *) # Version 6 and above use weak symbols + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + ;; + xl* | mpixl* | bgxl*) + # IBM XL 8.0 on PPC, with GNU ld + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + + *nto* | *qnx*) + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + openbsd2*) + # C++ shared libraries are fairly broken + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd=func_echo_all + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + case $host in + osf3*) + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + ;; + *) + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ + $RM $lib.exp' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + case $host in + osf3*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(archive_cmds_need_lc,$1)=yes + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + fi + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ + '"$_LT_TAGVAR(old_archive_cmds, $1)" + _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ + '"$_LT_TAGVAR(reload_cmds, $1)" + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) + test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + + _LT_TAGVAR(GCC, $1)="$GXX" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS + LDCXX=$LD + LD=$lt_save_LD + GCC=$lt_save_GCC + with_gnu_ld=$lt_save_with_gnu_ld + lt_cv_path_LDCXX=$lt_cv_path_LD + lt_cv_path_LD=$lt_save_path_LD + lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld + lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +fi # test "$_lt_caught_CXX_error" != yes + +AC_LANG_POP +])# _LT_LANG_CXX_CONFIG + + +# _LT_FUNC_STRIPNAME_CNF +# ---------------------- +# func_stripname_cnf prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# +# This function is identical to the (non-XSI) version of func_stripname, +# except this one can be used by m4 code that may be executed by configure, +# rather than the libtool script. +m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl +AC_REQUIRE([_LT_DECL_SED]) +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) +func_stripname_cnf () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname_cnf +])# _LT_FUNC_STRIPNAME_CNF + +# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) +# --------------------------------- +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +m4_defun([_LT_SYS_HIDDEN_LIBDEPS], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl +# Dependencies to place before and after the object being linked: +_LT_TAGVAR(predep_objects, $1)= +_LT_TAGVAR(postdep_objects, $1)= +_LT_TAGVAR(predeps, $1)= +_LT_TAGVAR(postdeps, $1)= +_LT_TAGVAR(compiler_lib_search_path, $1)= + +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF +int a; +void foo (void) { a = 0; } +_LT_EOF +], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF +], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer*4 a + a=0 + return + end +_LT_EOF +], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer a + a=0 + return + end +_LT_EOF +], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF +public class foo { + private int a; + public void bar (void) { + a = 0; + } +}; +_LT_EOF +], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF +package foo +func foo() { +} +_LT_EOF +]) + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; +esac + +dnl Parse the compiler output and extract the necessary +dnl objects, libraries and library flags. +if AC_TRY_EVAL(ac_compile); then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + for p in `eval "$output_verbose_link_cmd"`; do + case ${prev}${p} in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" || + test $p = "-R"; then + prev=$p + continue + fi + + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac + if test "$pre_test_object_deps_done" = no; then + case ${prev} in + -L | -R) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" + else + _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$_LT_TAGVAR(postdeps, $1)"; then + _LT_TAGVAR(postdeps, $1)="${prev}${p}" + else + _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" + fi + fi + prev= + ;; + + *.lto.$objext) ;; # Ignore GCC LTO objects + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$_LT_TAGVAR(predep_objects, $1)"; then + _LT_TAGVAR(predep_objects, $1)="$p" + else + _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" + fi + else + if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then + _LT_TAGVAR(postdep_objects, $1)="$p" + else + _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling $1 test program" +fi + +$RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS + +# PORTME: override above test on systems where it is broken +m4_if([$1], [CXX], +[case $host_os in +interix[[3-9]]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + _LT_TAGVAR(predep_objects,$1)= + _LT_TAGVAR(postdep_objects,$1)= + _LT_TAGVAR(postdeps,$1)= + ;; + +linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + if test "$solaris_use_stlport4" != yes; then + _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + +solaris*) + case $cc_basename in + CC* | sunCC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + if test "$solaris_use_stlport4" != yes; then + _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; +esac +]) + +case " $_LT_TAGVAR(postdeps, $1) " in +*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; +esac + _LT_TAGVAR(compiler_lib_search_dirs, $1)= +if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then + _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` +fi +_LT_TAGDECL([], [compiler_lib_search_dirs], [1], + [The directories searched by this compiler when creating a shared library]) +_LT_TAGDECL([], [predep_objects], [1], + [Dependencies to place before and after the objects being linked to + create a shared library]) +_LT_TAGDECL([], [postdep_objects], [1]) +_LT_TAGDECL([], [predeps], [1]) +_LT_TAGDECL([], [postdeps], [1]) +_LT_TAGDECL([], [compiler_lib_search_path], [1], + [The library search path used internally by the compiler when linking + a shared library]) +])# _LT_SYS_HIDDEN_LIBDEPS + + +# _LT_LANG_F77_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a Fortran 77 compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_F77_CONFIG], +[AC_LANG_PUSH(Fortran 77) +if test -z "$F77" || test "X$F77" = "Xno"; then + _lt_disable_F77=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the F77 compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_disable_F77" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC="$CC" + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${F77-"f77"} + CFLAGS=$FFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + GCC=$G77 + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)="$G77" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC="$lt_save_CC" + CFLAGS="$lt_save_CFLAGS" +fi # test "$_lt_disable_F77" != yes + +AC_LANG_POP +])# _LT_LANG_F77_CONFIG + + +# _LT_LANG_FC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for a Fortran compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_FC_CONFIG], +[AC_LANG_PUSH(Fortran) + +if test -z "$FC" || test "X$FC" = "Xno"; then + _lt_disable_FC=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for fc test sources. +ac_ext=${ac_fc_srcext-f} + +# Object file extension for compiled fc test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the FC compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_disable_FC" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC="$CC" + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${FC-"f95"} + CFLAGS=$FCFLAGS + compiler=$CC + GCC=$ac_cv_fc_compiler_gnu + + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS +fi # test "$_lt_disable_FC" != yes + +AC_LANG_POP +])# _LT_LANG_FC_CONFIG + + +# _LT_LANG_GCJ_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Java Compiler compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_GCJ_CONFIG], +[AC_REQUIRE([LT_PROG_GCJ])dnl +AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GCJ-"gcj"} +CFLAGS=$GCJFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)="$LD" +_LT_CC_BASENAME([$compiler]) + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GCJ_CONFIG + + +# _LT_LANG_GO_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Go compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_GO_CONFIG], +[AC_REQUIRE([LT_PROG_GO])dnl +AC_LANG_SAVE + +# Source file extension for Go test sources. +ac_ext=go + +# Object file extension for compiled Go test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="package main; func main() { }" + +# Code to be used in simple link tests +lt_simple_link_test_code='package main; func main() { }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GOC-"gccgo"} +CFLAGS=$GOFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)="$LD" +_LT_CC_BASENAME([$compiler]) + +# Go did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GO_CONFIG + + +# _LT_LANG_RC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for the Windows resource compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_RC_CONFIG], +[AC_REQUIRE([LT_PROG_RC])dnl +AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC= +CC=${RC-"windres"} +CFLAGS= +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) +_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +if test -n "$compiler"; then + : + _LT_CONFIG($1) +fi + +GCC=$lt_save_GCC +AC_LANG_RESTORE +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_RC_CONFIG + + +# LT_PROG_GCJ +# ----------- +AC_DEFUN([LT_PROG_GCJ], +[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], + [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], + [AC_CHECK_TOOL(GCJ, gcj,) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS)])])[]dnl +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_GCJ], []) + + +# LT_PROG_GO +# ---------- +AC_DEFUN([LT_PROG_GO], +[AC_CHECK_TOOL(GOC, gccgo,) +]) + + +# LT_PROG_RC +# ---------- +AC_DEFUN([LT_PROG_RC], +[AC_CHECK_TOOL(RC, windres,) +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_RC], []) + + +# _LT_DECL_EGREP +# -------------- +# If we don't have a new enough Autoconf to choose the best grep +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_EGREP], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_REQUIRE([AC_PROG_FGREP])dnl +test -z "$GREP" && GREP=grep +_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) +_LT_DECL([], [EGREP], [1], [An ERE matcher]) +_LT_DECL([], [FGREP], [1], [A literal string matcher]) +dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too +AC_SUBST([GREP]) +]) + + +# _LT_DECL_OBJDUMP +# -------------- +# If we don't have a new enough Autoconf to choose the best objdump +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_OBJDUMP], +[AC_CHECK_TOOL(OBJDUMP, objdump, false) +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) +AC_SUBST([OBJDUMP]) +]) + +# _LT_DECL_DLLTOOL +# ---------------- +# Ensure DLLTOOL variable is set. +m4_defun([_LT_DECL_DLLTOOL], +[AC_CHECK_TOOL(DLLTOOL, dlltool, false) +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) +AC_SUBST([DLLTOOL]) +]) + +# _LT_DECL_SED +# ------------ +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +m4_defun([_LT_DECL_SED], +[AC_PROG_SED +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" +_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) +_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], + [Sed that helps us avoid accidentally triggering echo(1) options like -n]) +])# _LT_DECL_SED + +m4_ifndef([AC_PROG_SED], [ +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ + +m4_defun([AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_SUBST([SED]) +AC_MSG_RESULT([$SED]) +])#AC_PROG_SED +])#m4_ifndef + +# Old name: +AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_SED], []) + + +# _LT_CHECK_SHELL_FEATURES +# ------------------------ +# Find out whether the shell is Bourne or XSI compatible, +# or has some other useful features. +m4_defun([_LT_CHECK_SHELL_FEATURES], +[AC_MSG_CHECKING([whether the shell understands some XSI constructs]) +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +AC_MSG_RESULT([$xsi_shell]) +_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) + +AC_MSG_CHECKING([whether the shell understands "+="]) +lt_shell_append=no +( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +AC_MSG_RESULT([$lt_shell_append]) +_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi +_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac +_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl +_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl +])# _LT_CHECK_SHELL_FEATURES + + +# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) +# ------------------------------------------------------ +# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and +# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. +m4_defun([_LT_PROG_FUNCTION_REPLACE], +[dnl { +sed -e '/^$1 ()$/,/^} # $1 /c\ +$1 ()\ +{\ +m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) +} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: +]) + + +# _LT_PROG_REPLACE_SHELLFNS +# ------------------------- +# Replace existing portable implementations of several shell functions with +# equivalent extended shell implementations where those features are available.. +m4_defun([_LT_PROG_REPLACE_SHELLFNS], +[if test x"$xsi_shell" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac]) + + _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl + func_basename_result="${1##*/}"]) + + _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}"]) + + _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"}]) + + _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl + func_split_long_opt_name=${1%%=*} + func_split_long_opt_arg=${1#*=}]) + + _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl + func_split_short_opt_arg=${1#??} + func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) + + _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac]) + + _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) + + _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) + + _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) +fi + +if test x"$lt_shell_append" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) + + _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl + func_quote_for_eval "${2}" +dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ + eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) +fi +]) + +# _LT_PATH_CONVERSION_FUNCTIONS +# ----------------------------- +# Determine which file name conversion functions should be used by +# func_to_host_file (and, implicitly, by func_to_host_path). These are needed +# for certain cross-compile configurations and native mingw. +m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_MSG_CHECKING([how to convert $build file names to $host format]) +AC_CACHE_VAL(lt_cv_to_host_file_cmd, +[case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac +]) +to_host_file_cmd=$lt_cv_to_host_file_cmd +AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) +_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], + [0], [convert $build file names to $host format])dnl + +AC_MSG_CHECKING([how to convert $build file names to toolchain format]) +AC_CACHE_VAL(lt_cv_to_tool_file_cmd, +[#assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac +]) +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) +_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], + [0], [convert $build files to toolchain format])dnl +])# _LT_PATH_CONVERSION_FUNCTIONS diff --git a/contrib/ldns/m4/ltoptions.m4 b/contrib/ldns/m4/ltoptions.m4 new file mode 100644 index 00000000000..5d9acd8e23b --- /dev/null +++ b/contrib/ldns/m4/ltoptions.m4 @@ -0,0 +1,384 @@ +# Helper functions for option handling. -*- Autoconf -*- +# +# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 7 ltoptions.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) + + +# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) +# ------------------------------------------ +m4_define([_LT_MANGLE_OPTION], +[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) + + +# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) +# --------------------------------------- +# Set option OPTION-NAME for macro MACRO-NAME, and if there is a +# matching handler defined, dispatch to it. Other OPTION-NAMEs are +# saved as a flag. +m4_define([_LT_SET_OPTION], +[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl +m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), + _LT_MANGLE_DEFUN([$1], [$2]), + [m4_warning([Unknown $1 option `$2'])])[]dnl +]) + + +# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) +# ------------------------------------------------------------ +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +m4_define([_LT_IF_OPTION], +[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) + + +# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) +# ------------------------------------------------------- +# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME +# are set. +m4_define([_LT_UNLESS_OPTIONS], +[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), + [m4_define([$0_found])])])[]dnl +m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 +])[]dnl +]) + + +# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) +# ---------------------------------------- +# OPTION-LIST is a space-separated list of Libtool options associated +# with MACRO-NAME. If any OPTION has a matching handler declared with +# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about +# the unknown option and exit. +m4_defun([_LT_SET_OPTIONS], +[# Set options +m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [_LT_SET_OPTION([$1], _LT_Option)]) + +m4_if([$1],[LT_INIT],[ + dnl + dnl Simply set some default values (i.e off) if boolean options were not + dnl specified: + _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no + ]) + _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no + ]) + dnl + dnl If no reference was made to various pairs of opposing options, then + dnl we run the default mode handler for the pair. For example, if neither + dnl `shared' nor `disable-shared' was passed, we enable building of shared + dnl archives by default: + _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) + _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], + [_LT_ENABLE_FAST_INSTALL]) + ]) +])# _LT_SET_OPTIONS + + +## --------------------------------- ## +## Macros to handle LT_INIT options. ## +## --------------------------------- ## + +# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) +# ----------------------------------------- +m4_define([_LT_MANGLE_DEFUN], +[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) + + +# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) +# ----------------------------------------------- +m4_define([LT_OPTION_DEFINE], +[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl +])# LT_OPTION_DEFINE + + +# dlopen +# ------ +LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes +]) + +AU_DEFUN([AC_LIBTOOL_DLOPEN], +[_LT_SET_OPTION([LT_INIT], [dlopen]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `dlopen' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) + + +# win32-dll +# --------- +# Declare package support for building win32 dll's. +LT_OPTION_DEFINE([LT_INIT], [win32-dll], +[enable_win32_dll=yes + +case $host in +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; +esac + +test -z "$AS" && AS=as +_LT_DECL([], [AS], [1], [Assembler program])dnl + +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl + +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl +])# win32-dll + +AU_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +_LT_SET_OPTION([LT_INIT], [win32-dll]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `win32-dll' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) + + +# _LT_ENABLE_SHARED([DEFAULT]) +# ---------------------------- +# implement the --enable-shared flag, and supports the `shared' and +# `disable-shared' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_SHARED], +[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([shared], + [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) + + _LT_DECL([build_libtool_libs], [enable_shared], [0], + [Whether or not to build shared libraries]) +])# _LT_ENABLE_SHARED + +LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) +]) + +AC_DEFUN([AC_DISABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], [disable-shared]) +]) + +AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_SHARED], []) +dnl AC_DEFUN([AM_DISABLE_SHARED], []) + + + +# _LT_ENABLE_STATIC([DEFAULT]) +# ---------------------------- +# implement the --enable-static flag, and support the `static' and +# `disable-static' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_STATIC], +[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([static], + [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]_LT_ENABLE_STATIC_DEFAULT) + + _LT_DECL([build_old_libs], [enable_static], [0], + [Whether or not to build static libraries]) +])# _LT_ENABLE_STATIC + +LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) +]) + +AC_DEFUN([AC_DISABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], [disable-static]) +]) + +AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_STATIC], []) +dnl AC_DEFUN([AM_DISABLE_STATIC], []) + + + +# _LT_ENABLE_FAST_INSTALL([DEFAULT]) +# ---------------------------------- +# implement the --enable-fast-install flag, and support the `fast-install' +# and `disable-fast-install' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_FAST_INSTALL], +[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([fast-install], + [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) + +_LT_DECL([fast_install], [enable_fast_install], [0], + [Whether or not to optimize for fast installation])dnl +])# _LT_ENABLE_FAST_INSTALL + +LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) + +# Old names: +AU_DEFUN([AC_ENABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the `fast-install' option into LT_INIT's first parameter.]) +]) + +AU_DEFUN([AC_DISABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the `disable-fast-install' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) +dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) + + +# _LT_WITH_PIC([MODE]) +# -------------------- +# implement the --with-pic flag, and support the `pic-only' and `no-pic' +# LT_INIT options. +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +m4_define([_LT_WITH_PIC], +[AC_ARG_WITH([pic], + [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for lt_pkg in $withval; do + IFS="$lt_save_ifs" + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [pic_mode=default]) + +test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) + +_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl +])# _LT_WITH_PIC + +LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) + +# Old name: +AU_DEFUN([AC_LIBTOOL_PICMODE], +[_LT_SET_OPTION([LT_INIT], [pic-only]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `pic-only' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) + +## ----------------- ## +## LTDL_INIT Options ## +## ----------------- ## + +m4_define([_LTDL_MODE], []) +LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], + [m4_define([_LTDL_MODE], [nonrecursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [recursive], + [m4_define([_LTDL_MODE], [recursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [subproject], + [m4_define([_LTDL_MODE], [subproject])]) + +m4_define([_LTDL_TYPE], []) +LT_OPTION_DEFINE([LTDL_INIT], [installable], + [m4_define([_LTDL_TYPE], [installable])]) +LT_OPTION_DEFINE([LTDL_INIT], [convenience], + [m4_define([_LTDL_TYPE], [convenience])]) diff --git a/contrib/ldns/m4/ltsugar.m4 b/contrib/ldns/m4/ltsugar.m4 new file mode 100644 index 00000000000..9000a057d31 --- /dev/null +++ b/contrib/ldns/m4/ltsugar.m4 @@ -0,0 +1,123 @@ +# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- +# +# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 6 ltsugar.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) + + +# lt_join(SEP, ARG1, [ARG2...]) +# ----------------------------- +# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their +# associated separator. +# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier +# versions in m4sugar had bugs. +m4_define([lt_join], +[m4_if([$#], [1], [], + [$#], [2], [[$2]], + [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) +m4_define([_lt_join], +[m4_if([$#$2], [2], [], + [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) + + +# lt_car(LIST) +# lt_cdr(LIST) +# ------------ +# Manipulate m4 lists. +# These macros are necessary as long as will still need to support +# Autoconf-2.59 which quotes differently. +m4_define([lt_car], [[$1]]) +m4_define([lt_cdr], +[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], + [$#], 1, [], + [m4_dquote(m4_shift($@))])]) +m4_define([lt_unquote], $1) + + +# lt_append(MACRO-NAME, STRING, [SEPARATOR]) +# ------------------------------------------ +# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. +# Note that neither SEPARATOR nor STRING are expanded; they are appended +# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). +# No SEPARATOR is output if MACRO-NAME was previously undefined (different +# than defined and empty). +# +# This macro is needed until we can rely on Autoconf 2.62, since earlier +# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. +m4_define([lt_append], +[m4_define([$1], + m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) + + + +# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) +# ---------------------------------------------------------- +# Produce a SEP delimited list of all paired combinations of elements of +# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list +# has the form PREFIXmINFIXSUFFIXn. +# Needed until we can rely on m4_combine added in Autoconf 2.62. +m4_define([lt_combine], +[m4_if(m4_eval([$# > 3]), [1], + [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl +[[m4_foreach([_Lt_prefix], [$2], + [m4_foreach([_Lt_suffix], + ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, + [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) + + +# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) +# ----------------------------------------------------------------------- +# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited +# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. +m4_define([lt_if_append_uniq], +[m4_ifdef([$1], + [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], + [lt_append([$1], [$2], [$3])$4], + [$5])], + [lt_append([$1], [$2], [$3])$4])]) + + +# lt_dict_add(DICT, KEY, VALUE) +# ----------------------------- +m4_define([lt_dict_add], +[m4_define([$1($2)], [$3])]) + + +# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) +# -------------------------------------------- +m4_define([lt_dict_add_subkey], +[m4_define([$1($2:$3)], [$4])]) + + +# lt_dict_fetch(DICT, KEY, [SUBKEY]) +# ---------------------------------- +m4_define([lt_dict_fetch], +[m4_ifval([$3], + m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), + m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) + + +# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) +# ----------------------------------------------------------------- +m4_define([lt_if_dict_fetch], +[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], + [$5], + [$6])]) + + +# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) +# -------------------------------------------------------------- +m4_define([lt_dict_filter], +[m4_if([$5], [], [], + [lt_join(m4_quote(m4_default([$4], [[, ]])), + lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), + [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl +]) diff --git a/contrib/ldns/m4/ltversion.m4 b/contrib/ldns/m4/ltversion.m4 new file mode 100644 index 00000000000..07a8602d48d --- /dev/null +++ b/contrib/ldns/m4/ltversion.m4 @@ -0,0 +1,23 @@ +# ltversion.m4 -- version numbers -*- Autoconf -*- +# +# Copyright (C) 2004 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# @configure_input@ + +# serial 3337 ltversion.m4 +# This file is part of GNU Libtool + +m4_define([LT_PACKAGE_VERSION], [2.4.2]) +m4_define([LT_PACKAGE_REVISION], [1.3337]) + +AC_DEFUN([LTVERSION_VERSION], +[macro_version='2.4.2' +macro_revision='1.3337' +_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) +_LT_DECL(, macro_revision, 0) +]) diff --git a/contrib/ldns/m4/lt~obsolete.m4 b/contrib/ldns/m4/lt~obsolete.m4 new file mode 100644 index 00000000000..c573da90c5c --- /dev/null +++ b/contrib/ldns/m4/lt~obsolete.m4 @@ -0,0 +1,98 @@ +# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- +# +# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004. +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 5 lt~obsolete.m4 + +# These exist entirely to fool aclocal when bootstrapping libtool. +# +# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) +# which have later been changed to m4_define as they aren't part of the +# exported API, or moved to Autoconf or Automake where they belong. +# +# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN +# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us +# using a macro with the same name in our local m4/libtool.m4 it'll +# pull the old libtool.m4 in (it doesn't see our shiny new m4_define +# and doesn't know about Autoconf macros at all.) +# +# So we provide this file, which has a silly filename so it's always +# included after everything else. This provides aclocal with the +# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything +# because those macros already exist, or will be overwritten later. +# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. +# +# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. +# Yes, that means every name once taken will need to remain here until +# we give up compatibility with versions before 1.7, at which point +# we need to keep only those names which we still refer to. + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) + +m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) +m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) +m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) +m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) +m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) +m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) +m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) +m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) +m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) +m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) +m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) +m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) +m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) +m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) +m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) +m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) +m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) +m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) +m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) +m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) +m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) +m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) +m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) +m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) +m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) +m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) +m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) +m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) +m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) +m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) +m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) +m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) +m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) +m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) +m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) +m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) +m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) +m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) +m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) +m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) +m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) +m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) +m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) +m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) +m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) +m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) +m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) +m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) +m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) +m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) diff --git a/contrib/ldns/net.c b/contrib/ldns/net.c index 6b444da677b..b8a5385e1c2 100644 --- a/contrib/ldns/net.c +++ b/contrib/ldns/net.c @@ -56,175 +56,53 @@ ldns_send(ldns_pkt **result_packet, ldns_resolver *r, const ldns_pkt *query_pkt) return result; } -ldns_status -ldns_send_buffer(ldns_pkt **result, ldns_resolver *r, ldns_buffer *qb, ldns_rdf *tsig_mac) +/* code from rdata.c */ +static struct sockaddr_storage * +ldns_rdf2native_sockaddr_storage_port( + const ldns_rdf *rd, uint16_t port, size_t *size) { - uint8_t i; - - struct sockaddr_storage *ns; - size_t ns_len; - struct timeval tv_s; - struct timeval tv_e; - - ldns_rdf **ns_array; - size_t *rtt; - ldns_pkt *reply; - bool all_servers_rtt_inf; - uint8_t retries; - - uint8_t *reply_bytes = NULL; - size_t reply_size = 0; - ldns_status status, send_status; - - assert(r != NULL); - - status = LDNS_STATUS_OK; - rtt = ldns_resolver_rtt(r); - ns_array = ldns_resolver_nameservers(r); - reply = NULL; - ns_len = 0; - - all_servers_rtt_inf = true; - - if (ldns_resolver_random(r)) { - ldns_resolver_nameservers_randomize(r); - } - - /* loop through all defined nameservers */ - for (i = 0; i < ldns_resolver_nameserver_count(r); i++) { - if (rtt[i] == LDNS_RESOLV_RTT_INF) { - /* not reachable nameserver! */ - continue; - } - - /* maybe verbosity setting? - printf("Sending to "); - ldns_rdf_print(stdout, ns_array[i]); - printf("\n"); - */ - ns = ldns_rdf2native_sockaddr_storage(ns_array[i], - ldns_resolver_port(r), &ns_len); + struct sockaddr_storage *data; + struct sockaddr_in *data_in; + struct sockaddr_in6 *data_in6; + data = LDNS_MALLOC(struct sockaddr_storage); + if (!data) { + return NULL; + } + /* zero the structure for portability */ + memset(data, 0, sizeof(struct sockaddr_storage)); + switch(ldns_rdf_get_type(rd)) { + case LDNS_RDF_TYPE_A: #ifndef S_SPLINT_S - if ((ns->ss_family == AF_INET) && - (ldns_resolver_ip6(r) == LDNS_RESOLV_INET6)) { - /* not reachable */ - LDNS_FREE(ns); - continue; - } - - if ((ns->ss_family == AF_INET6) && - (ldns_resolver_ip6(r) == LDNS_RESOLV_INET)) { - /* not reachable */ - LDNS_FREE(ns); - continue; - } + data->ss_family = AF_INET; #endif + data_in = (struct sockaddr_in*) data; + data_in->sin_port = (in_port_t)htons(port); + memcpy(&(data_in->sin_addr), ldns_rdf_data(rd), ldns_rdf_size(rd)); + *size = sizeof(struct sockaddr_in); + return data; + case LDNS_RDF_TYPE_AAAA: +#ifndef S_SPLINT_S + data->ss_family = AF_INET6; +#endif + data_in6 = (struct sockaddr_in6*) data; + data_in6->sin6_port = (in_port_t)htons(port); + memcpy(&data_in6->sin6_addr, ldns_rdf_data(rd), ldns_rdf_size(rd)); + *size = sizeof(struct sockaddr_in6); + return data; + default: + LDNS_FREE(data); + return NULL; + } +} - all_servers_rtt_inf = false; - - gettimeofday(&tv_s, NULL); - - send_status = LDNS_STATUS_ERR; - - /* reply_bytes implicitly handles our error */ - if (1 == ldns_resolver_usevc(r)) { - for (retries = ldns_resolver_retry(r); retries > 0; retries--) { - send_status = - ldns_tcp_send(&reply_bytes, qb, ns, - (socklen_t)ns_len, ldns_resolver_timeout(r), - &reply_size); - if (send_status == LDNS_STATUS_OK) { - break; - } - } - } else { - for (retries = ldns_resolver_retry(r); retries > 0; retries--) { - /* ldns_rdf_print(stdout, ns_array[i]); */ - send_status = - ldns_udp_send(&reply_bytes, qb, ns, - (socklen_t)ns_len, ldns_resolver_timeout(r), - &reply_size); - - if (send_status == LDNS_STATUS_OK) { - break; - } - } - } - - if (send_status != LDNS_STATUS_OK) { - ldns_resolver_set_nameserver_rtt(r, i, LDNS_RESOLV_RTT_INF); - status = send_status; - } - - /* obey the fail directive */ - if (!reply_bytes) { - /* the current nameserver seems to have a problem, blacklist it */ - if (ldns_resolver_fail(r)) { - LDNS_FREE(ns); - return LDNS_STATUS_ERR; - } else { - LDNS_FREE(ns); - continue; - } - } - - status = ldns_wire2pkt(&reply, reply_bytes, reply_size); - if (status != LDNS_STATUS_OK) { - LDNS_FREE(reply_bytes); - LDNS_FREE(ns); - return status; - } - - LDNS_FREE(ns); - gettimeofday(&tv_e, NULL); - - if (reply) { - ldns_pkt_set_querytime(reply, (uint32_t) - ((tv_e.tv_sec - tv_s.tv_sec) * 1000) + - (tv_e.tv_usec - tv_s.tv_usec) / 1000); - ldns_pkt_set_answerfrom(reply, - ldns_rdf_clone(ns_array[i])); - ldns_pkt_set_timestamp(reply, tv_s); - ldns_pkt_set_size(reply, reply_size); - break; - } else { - if (ldns_resolver_fail(r)) { - /* if fail is set bail out, after the first - * one */ - break; - } - } - - /* wait retrans seconds... */ - sleep((unsigned int) ldns_resolver_retrans(r)); - } - - if (all_servers_rtt_inf) { - LDNS_FREE(reply_bytes); - return LDNS_STATUS_RES_NO_NS; - } -#ifdef HAVE_SSL - if (tsig_mac && reply && reply_bytes) { - if (!ldns_pkt_tsig_verify(reply, - reply_bytes, - reply_size, - ldns_resolver_tsig_keyname(r), - ldns_resolver_tsig_keydata(r), tsig_mac)) { - status = LDNS_STATUS_CRYPTO_TSIG_BOGUS; - } - } -#else - (void)tsig_mac; -#endif /* HAVE_SSL */ - - LDNS_FREE(reply_bytes); - if (result) { - *result = reply; - } - - return status; +struct sockaddr_storage * +ldns_rdf2native_sockaddr_storage( + const ldns_rdf *rd, uint16_t port, size_t *size) +{ + return ldns_rdf2native_sockaddr_storage_port( + rd, (port == 0 ? (uint16_t)LDNS_PORT : port), size); } /** best effort to set nonblocking */ @@ -290,90 +168,10 @@ ldns_sock_wait(int sockfd, struct timeval timeout, int write) return 1; } -ldns_status -ldns_udp_send(uint8_t **result, ldns_buffer *qbin, const struct sockaddr_storage *to, - socklen_t tolen, struct timeval timeout, size_t *answer_size) -{ - int sockfd; - uint8_t *answer; - sockfd = ldns_udp_bgsend(qbin, to, tolen, timeout); - - if (sockfd == 0) { - return LDNS_STATUS_SOCKET_ERROR; - } - - /* wait for an response*/ - if(!ldns_sock_wait(sockfd, timeout, 0)) { -#ifndef USE_WINSOCK - close(sockfd); -#else - closesocket(sockfd); -#endif - return LDNS_STATUS_NETWORK_ERR; - } - - /* set to nonblocking, so if the checksum is bad, it becomes - * an EGAIN error and the ldns_udp_send function does not block, - * but returns a 'NETWORK_ERROR' much like a timeout. */ - ldns_sock_nonblock(sockfd); - - answer = ldns_udp_read_wire(sockfd, answer_size, NULL, NULL); -#ifndef USE_WINSOCK - close(sockfd); -#else - closesocket(sockfd); -#endif - - if (*answer_size == 0) { - /* oops */ - return LDNS_STATUS_NETWORK_ERR; - } - - *result = answer; - return LDNS_STATUS_OK; -} - -int -ldns_udp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, - struct timeval timeout) -{ - int sockfd; - - sockfd = ldns_udp_connect(to, timeout); - - if (sockfd == 0) { - return 0; - } - - if (ldns_udp_send_query(qbin, sockfd, to, tolen) == 0) { -#ifndef USE_WINSOCK - close(sockfd); -#else - closesocket(sockfd); -#endif - return 0; - } - return sockfd; -} - -int -ldns_udp_connect(const struct sockaddr_storage *to, struct timeval ATTR_UNUSED(timeout)) -{ - int sockfd; - -#ifndef S_SPLINT_S - if ((sockfd = socket((int)((struct sockaddr*)to)->sa_family, SOCK_DGRAM, - IPPROTO_UDP)) - == -1) { - return 0; - } -#endif - return sockfd; -} - -int -ldns_tcp_connect(const struct sockaddr_storage *to, socklen_t tolen, +static int +ldns_tcp_connect_from(const struct sockaddr_storage *to, socklen_t tolen, + const struct sockaddr_storage *from, socklen_t fromlen, struct timeval timeout) { int sockfd; @@ -384,6 +182,9 @@ ldns_tcp_connect(const struct sockaddr_storage *to, socklen_t tolen, return 0; } #endif + if (from && bind(sockfd, (const struct sockaddr*)from, fromlen) == -1){ + return 0; + } /* perform nonblocking connect, to be able to wait with select() */ ldns_sock_nonblock(sockfd); @@ -462,6 +263,387 @@ ldns_tcp_connect(const struct sockaddr_storage *to, socklen_t tolen, return sockfd; } +int +ldns_tcp_connect(const struct sockaddr_storage *to, socklen_t tolen, + struct timeval timeout) +{ + return ldns_tcp_connect_from(to, tolen, NULL, 0, timeout); +} + +static int +ldns_tcp_bgsend_from(ldns_buffer *qbin, + const struct sockaddr_storage *to, socklen_t tolen, + const struct sockaddr_storage *from, socklen_t fromlen, + struct timeval timeout) +{ + int sockfd; + + sockfd = ldns_tcp_connect_from(to, tolen, from, fromlen, timeout); + + if (sockfd == 0) { + return 0; + } + + if (ldns_tcp_send_query(qbin, sockfd, to, tolen) == 0) { +#ifndef USE_WINSOCK + close(sockfd); +#else + closesocket(sockfd); +#endif + return 0; + } + + return sockfd; +} + +int +ldns_tcp_bgsend(ldns_buffer *qbin, + const struct sockaddr_storage *to, socklen_t tolen, + struct timeval timeout) +{ + return ldns_tcp_bgsend_from(qbin, to, tolen, NULL, 0, timeout); +} + + +/* keep in mind that in DNS tcp messages the first 2 bytes signal the + * amount data to expect + */ +static ldns_status +ldns_tcp_send_from(uint8_t **result, ldns_buffer *qbin, + const struct sockaddr_storage *to, socklen_t tolen, + const struct sockaddr_storage *from, socklen_t fromlen, + struct timeval timeout, size_t *answer_size) +{ + int sockfd; + uint8_t *answer; + + sockfd = ldns_tcp_bgsend_from(qbin, to, tolen, from, fromlen, timeout); + + if (sockfd == 0) { + return LDNS_STATUS_ERR; + } + + answer = ldns_tcp_read_wire_timeout(sockfd, answer_size, timeout); +#ifndef USE_WINSOCK + close(sockfd); +#else + closesocket(sockfd); +#endif + + if (*answer_size == 0) { + /* oops */ + return LDNS_STATUS_NETWORK_ERR; + } + + /* resize accordingly */ + *result = LDNS_XREALLOC(answer, uint8_t, (size_t)*answer_size); + if(!*result) { + LDNS_FREE(answer); + return LDNS_STATUS_MEM_ERR; + } + return LDNS_STATUS_OK; +} + +ldns_status +ldns_tcp_send(uint8_t **result, ldns_buffer *qbin, + const struct sockaddr_storage *to, socklen_t tolen, + struct timeval timeout, size_t *answer_size) +{ + return ldns_tcp_send_from(result, qbin, + to, tolen, NULL, 0, timeout, answer_size); +} + +int +ldns_udp_connect(const struct sockaddr_storage *to, struct timeval ATTR_UNUSED(timeout)) +{ + int sockfd; + +#ifndef S_SPLINT_S + if ((sockfd = socket((int)((struct sockaddr*)to)->sa_family, SOCK_DGRAM, + IPPROTO_UDP)) + == -1) { + return 0; + } +#endif + return sockfd; +} + +static int +ldns_udp_bgsend_from(ldns_buffer *qbin, + const struct sockaddr_storage *to , socklen_t tolen, + const struct sockaddr_storage *from, socklen_t fromlen, + struct timeval timeout) +{ + int sockfd; + + sockfd = ldns_udp_connect(to, timeout); + + if (sockfd == 0) { + return 0; + } + + if (from && bind(sockfd, (const struct sockaddr*)from, fromlen) == -1){ + return 0; + } + + if (ldns_udp_send_query(qbin, sockfd, to, tolen) == 0) { +#ifndef USE_WINSOCK + close(sockfd); +#else + closesocket(sockfd); +#endif + return 0; + } + return sockfd; +} + +int +ldns_udp_bgsend(ldns_buffer *qbin, + const struct sockaddr_storage *to , socklen_t tolen, + struct timeval timeout) +{ + return ldns_udp_bgsend_from(qbin, to, tolen, NULL, 0, timeout); +} + +static ldns_status +ldns_udp_send_from(uint8_t **result, ldns_buffer *qbin, + const struct sockaddr_storage *to , socklen_t tolen, + const struct sockaddr_storage *from, socklen_t fromlen, + struct timeval timeout, size_t *answer_size) +{ + int sockfd; + uint8_t *answer; + + sockfd = ldns_udp_bgsend_from(qbin, to, tolen, from, fromlen, timeout); + + if (sockfd == 0) { + return LDNS_STATUS_SOCKET_ERROR; + } + + /* wait for an response*/ + if(!ldns_sock_wait(sockfd, timeout, 0)) { +#ifndef USE_WINSOCK + close(sockfd); +#else + closesocket(sockfd); +#endif + return LDNS_STATUS_NETWORK_ERR; + } + + /* set to nonblocking, so if the checksum is bad, it becomes + * an EGAIN error and the ldns_udp_send function does not block, + * but returns a 'NETWORK_ERROR' much like a timeout. */ + ldns_sock_nonblock(sockfd); + + answer = ldns_udp_read_wire(sockfd, answer_size, NULL, NULL); +#ifndef USE_WINSOCK + close(sockfd); +#else + closesocket(sockfd); +#endif + + if (*answer_size == 0) { + /* oops */ + return LDNS_STATUS_NETWORK_ERR; + } + + *result = answer; + return LDNS_STATUS_OK; +} + +ldns_status +ldns_udp_send(uint8_t **result, ldns_buffer *qbin, + const struct sockaddr_storage *to , socklen_t tolen, + struct timeval timeout, size_t *answer_size) +{ + return ldns_udp_send_from(result, qbin, to, tolen, NULL, 0, + timeout, answer_size); +} + +ldns_status +ldns_send_buffer(ldns_pkt **result, ldns_resolver *r, ldns_buffer *qb, ldns_rdf *tsig_mac) +{ + uint8_t i; + + struct sockaddr_storage *src = NULL; + size_t src_len; + struct sockaddr_storage *ns; + size_t ns_len; + struct timeval tv_s; + struct timeval tv_e; + + ldns_rdf **ns_array; + size_t *rtt; + ldns_pkt *reply; + bool all_servers_rtt_inf; + uint8_t retries; + + uint8_t *reply_bytes = NULL; + size_t reply_size = 0; + ldns_status status, send_status; + + assert(r != NULL); + + status = LDNS_STATUS_OK; + rtt = ldns_resolver_rtt(r); + ns_array = ldns_resolver_nameservers(r); + reply = NULL; + ns_len = 0; + + all_servers_rtt_inf = true; + + if (ldns_resolver_random(r)) { + ldns_resolver_nameservers_randomize(r); + } + + if(ldns_resolver_source(r)) { + src = ldns_rdf2native_sockaddr_storage_port( + ldns_resolver_source(r), 0, &src_len); + } + + /* loop through all defined nameservers */ + for (i = 0; i < ldns_resolver_nameserver_count(r); i++) { + if (rtt[i] == LDNS_RESOLV_RTT_INF) { + /* not reachable nameserver! */ + continue; + } + + /* maybe verbosity setting? + printf("Sending to "); + ldns_rdf_print(stdout, ns_array[i]); + printf("\n"); + */ + ns = ldns_rdf2native_sockaddr_storage(ns_array[i], + ldns_resolver_port(r), &ns_len); + + +#ifndef S_SPLINT_S + if ((ns->ss_family == AF_INET) && + (ldns_resolver_ip6(r) == LDNS_RESOLV_INET6)) { + /* not reachable */ + LDNS_FREE(ns); + continue; + } + + if ((ns->ss_family == AF_INET6) && + (ldns_resolver_ip6(r) == LDNS_RESOLV_INET)) { + /* not reachable */ + LDNS_FREE(ns); + continue; + } +#endif + + all_servers_rtt_inf = false; + + gettimeofday(&tv_s, NULL); + + send_status = LDNS_STATUS_ERR; + + /* reply_bytes implicitly handles our error */ + if (ldns_resolver_usevc(r)) { + for (retries = ldns_resolver_retry(r); retries > 0; retries--) { + send_status = + ldns_tcp_send_from(&reply_bytes, qb, + ns, (socklen_t)ns_len, + src, (socklen_t)src_len, + ldns_resolver_timeout(r), + &reply_size); + if (send_status == LDNS_STATUS_OK) { + break; + } + } + } else { + for (retries = ldns_resolver_retry(r); retries > 0; retries--) { + /* ldns_rdf_print(stdout, ns_array[i]); */ + send_status = + ldns_udp_send_from(&reply_bytes, qb, + ns, (socklen_t)ns_len, + src, (socklen_t)src_len, + ldns_resolver_timeout(r), + &reply_size); + if (send_status == LDNS_STATUS_OK) { + break; + } + } + } + + if (send_status != LDNS_STATUS_OK) { + ldns_resolver_set_nameserver_rtt(r, i, LDNS_RESOLV_RTT_INF); + status = send_status; + } + + /* obey the fail directive */ + if (!reply_bytes) { + /* the current nameserver seems to have a problem, blacklist it */ + if (ldns_resolver_fail(r)) { + LDNS_FREE(ns); + return LDNS_STATUS_ERR; + } else { + LDNS_FREE(ns); + continue; + } + } + + status = ldns_wire2pkt(&reply, reply_bytes, reply_size); + if (status != LDNS_STATUS_OK) { + LDNS_FREE(reply_bytes); + LDNS_FREE(ns); + return status; + } + + LDNS_FREE(ns); + gettimeofday(&tv_e, NULL); + + if (reply) { + ldns_pkt_set_querytime(reply, (uint32_t) + ((tv_e.tv_sec - tv_s.tv_sec) * 1000) + + (tv_e.tv_usec - tv_s.tv_usec) / 1000); + ldns_pkt_set_answerfrom(reply, + ldns_rdf_clone(ns_array[i])); + ldns_pkt_set_timestamp(reply, tv_s); + ldns_pkt_set_size(reply, reply_size); + break; + } else { + if (ldns_resolver_fail(r)) { + /* if fail is set bail out, after the first + * one */ + break; + } + } + + /* wait retrans seconds... */ + sleep((unsigned int) ldns_resolver_retrans(r)); + } + + if(src) { + LDNS_FREE(src); + } + if (all_servers_rtt_inf) { + LDNS_FREE(reply_bytes); + return LDNS_STATUS_RES_NO_NS; + } +#ifdef HAVE_SSL + if (tsig_mac && reply && reply_bytes) { + if (!ldns_pkt_tsig_verify(reply, + reply_bytes, + reply_size, + ldns_resolver_tsig_keyname(r), + ldns_resolver_tsig_keydata(r), tsig_mac)) { + status = LDNS_STATUS_CRYPTO_TSIG_BOGUS; + } + } +#else + (void)tsig_mac; +#endif /* HAVE_SSL */ + + LDNS_FREE(reply_bytes); + if (result) { + *result = reply; + } + + return status; +} + ssize_t ldns_tcp_send_query(ldns_buffer *qbin, int sockfd, const struct sockaddr_storage *to, socklen_t tolen) @@ -643,110 +825,6 @@ ldns_tcp_read_wire(int sockfd, size_t *size) return wire; } -/* keep in mind that in DNS tcp messages the first 2 bytes signal the - * amount data to expect - */ -ldns_status -ldns_tcp_send(uint8_t **result, ldns_buffer *qbin, const struct sockaddr_storage *to, - socklen_t tolen, struct timeval timeout, size_t *answer_size) -{ - int sockfd; - uint8_t *answer; - - sockfd = ldns_tcp_bgsend(qbin, to, tolen, timeout); - - if (sockfd == 0) { - return LDNS_STATUS_ERR; - } - - answer = ldns_tcp_read_wire_timeout(sockfd, answer_size, timeout); -#ifndef USE_WINSOCK - close(sockfd); -#else - closesocket(sockfd); -#endif - - if (*answer_size == 0) { - /* oops */ - return LDNS_STATUS_NETWORK_ERR; - } - - /* resize accordingly */ - *result = LDNS_XREALLOC(answer, uint8_t, (size_t)*answer_size); - if(!*result) { - LDNS_FREE(answer); - return LDNS_STATUS_MEM_ERR; - } - return LDNS_STATUS_OK; -} - -int -ldns_tcp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, - struct timeval timeout) -{ - int sockfd; - - sockfd = ldns_tcp_connect(to, tolen, timeout); - - if (sockfd == 0) { - return 0; - } - - if (ldns_tcp_send_query(qbin, sockfd, to, tolen) == 0) { -#ifndef USE_WINSOCK - close(sockfd); -#else - closesocket(sockfd); -#endif - return 0; - } - - return sockfd; -} - -/* code from rdata.c */ -struct sockaddr_storage * -ldns_rdf2native_sockaddr_storage(const ldns_rdf *rd, uint16_t port, size_t *size) -{ - struct sockaddr_storage *data; - struct sockaddr_in *data_in; - struct sockaddr_in6 *data_in6; - - data = LDNS_MALLOC(struct sockaddr_storage); - if (!data) { - return NULL; - } - /* zero the structure for portability */ - memset(data, 0, sizeof(struct sockaddr_storage)); - if (port == 0) { - port = LDNS_PORT; - } - - switch(ldns_rdf_get_type(rd)) { - case LDNS_RDF_TYPE_A: -#ifndef S_SPLINT_S - data->ss_family = AF_INET; -#endif - data_in = (struct sockaddr_in*) data; - data_in->sin_port = (in_port_t)htons(port); - memcpy(&(data_in->sin_addr), ldns_rdf_data(rd), ldns_rdf_size(rd)); - *size = sizeof(struct sockaddr_in); - return data; - case LDNS_RDF_TYPE_AAAA: -#ifndef S_SPLINT_S - data->ss_family = AF_INET6; -#endif - data_in6 = (struct sockaddr_in6*) data; - data_in6->sin6_port = (in_port_t)htons(port); - memcpy(&data_in6->sin6_addr, ldns_rdf_data(rd), ldns_rdf_size(rd)); - *size = sizeof(struct sockaddr_in6); - return data; - default: - LDNS_FREE(data); - return NULL; - } -} - #ifndef S_SPLINT_S ldns_rdf * ldns_sockaddr_storage2rdf(struct sockaddr_storage *sock, uint16_t *port) @@ -789,6 +867,8 @@ ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class class) ldns_pkt *query; ldns_buffer *query_wire; + struct sockaddr_storage *src = NULL; + size_t src_len = 0; struct sockaddr_storage *ns = NULL; size_t ns_len = 0; size_t ns_i; @@ -803,6 +883,10 @@ ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class class) if (!query) { return LDNS_STATUS_ADDRESS_ERR; } + if(ldns_resolver_source(resolver)) { + src = ldns_rdf2native_sockaddr_storage_port( + ldns_resolver_source(resolver), 0, &src_len); + } /* For AXFR, we have to make the connection ourselves */ /* try all nameservers (which usually would mean v4 fallback if * @hostname is used */ @@ -817,7 +901,9 @@ ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class class) resolver->_nameservers[ns_i], ldns_resolver_port(resolver), &ns_len); - resolver->_socket = ldns_tcp_connect(ns, (socklen_t)ns_len, + resolver->_socket = ldns_tcp_connect_from( + ns, (socklen_t)ns_len, + src, (socklen_t)src_len, ldns_resolver_timeout(resolver)); } @@ -834,8 +920,8 @@ ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class class) ldns_resolver_tsig_keydata(resolver), 300, ldns_resolver_tsig_algorithm(resolver), NULL); if (status != LDNS_STATUS_OK) { - /* RoRi: to prevent problems on subsequent calls to ldns_axfr_start - we have to close the socket here! */ + /* to prevent problems on subsequent calls to + * ldns_axfr_start we have to close the socket here! */ #ifndef USE_WINSOCK close(resolver->_socket); #else @@ -873,8 +959,8 @@ ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class class) ldns_buffer_free(query_wire); LDNS_FREE(ns); - /* RoRi: to prevent problems on subsequent calls to ldns_axfr_start - we have to close the socket here! */ + /* to prevent problems on subsequent calls to ldns_axfr_start + * we have to close the socket here! */ #ifndef USE_WINSOCK close(resolver->_socket); #else @@ -891,8 +977,8 @@ ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class class) ldns_buffer_free(query_wire); LDNS_FREE(ns); - /* RoRi: to prevent problems on subsequent calls to ldns_axfr_start - we have to close the socket here! */ + /* to prevent problems on subsequent calls to ldns_axfr_start + * we have to close the socket here! */ #ifndef USE_WINSOCK close(resolver->_socket); diff --git a/contrib/ldns/packet.c b/contrib/ldns/packet.c index d57e9e275ed..0ac64c52fc4 100644 --- a/contrib/ldns/packet.c +++ b/contrib/ldns/packet.c @@ -266,7 +266,7 @@ ldns_pkt_rr_list_by_name(ldns_pkt *packet, ret = NULL; for(i = 0; i < ldns_rr_list_rr_count(rrs); i++) { - if (ldns_rdf_compare(ldns_rr_owner( + if (ldns_dname_compare(ldns_rr_owner( ldns_rr_list_rr(rrs, i)), ownername) == 0) { /* owner names match */ @@ -337,7 +337,7 @@ ldns_pkt_rr_list_by_name_and_type(const ldns_pkt *packet, for(i = 0; i < ldns_rr_list_rr_count(rrs); i++) { if (type == ldns_rr_get_type(ldns_rr_list_rr(rrs, i)) && - ldns_rdf_compare(ldns_rr_owner(ldns_rr_list_rr(rrs, i)), + ldns_dname_compare(ldns_rr_owner(ldns_rr_list_rr(rrs, i)), ownername ) == 0 ) { @@ -379,7 +379,7 @@ ldns_pkt_rr(ldns_pkt *pkt, ldns_pkt_section sec, ldns_rr *rr) return result; } -static uint16_t +uint16_t ldns_pkt_section_count(const ldns_pkt *packet, ldns_pkt_section s) { switch(s) { @@ -827,8 +827,8 @@ ldns_pkt_set_flags(ldns_pkt *packet, uint16_t flags) } -static ldns_status -ldns_pkt_add_authsoa(ldns_pkt* packet, ldns_rdf* rr_name, ldns_rr_class rr_class) +static ldns_rr* +ldns_pkt_authsoa(ldns_rdf* rr_name, ldns_rr_class rr_class) { ldns_rr* soa_rr = ldns_rr_new(); ldns_rdf *owner_rdf; @@ -841,12 +841,12 @@ ldns_pkt_add_authsoa(ldns_pkt* packet, ldns_rdf* rr_name, ldns_rr_class rr_class ldns_rdf *minimum_rdf; if (!soa_rr) { - return LDNS_STATUS_MEM_ERR; + return NULL; } owner_rdf = ldns_rdf_clone(rr_name); if (!owner_rdf) { ldns_rr_free(soa_rr); - return LDNS_STATUS_MEM_ERR; + return NULL; } ldns_rr_set_owner(soa_rr, owner_rdf); @@ -856,59 +856,59 @@ ldns_pkt_add_authsoa(ldns_pkt* packet, ldns_rdf* rr_name, ldns_rr_class rr_class if (ldns_str2rdf_dname(&mname_rdf, ".") != LDNS_STATUS_OK) { ldns_rr_free(soa_rr); - return LDNS_STATUS_MEM_ERR; + return NULL; } else { ldns_rr_push_rdf(soa_rr, mname_rdf); } if (ldns_str2rdf_dname(&rname_rdf, ".") != LDNS_STATUS_OK) { ldns_rr_free(soa_rr); - return LDNS_STATUS_MEM_ERR; + return NULL; } else { ldns_rr_push_rdf(soa_rr, rname_rdf); } serial_rdf = ldns_native2rdf_int32(LDNS_RDF_TYPE_INT32, 0); if (!serial_rdf) { ldns_rr_free(soa_rr); - return LDNS_STATUS_MEM_ERR; + return NULL; } else { ldns_rr_push_rdf(soa_rr, serial_rdf); } refresh_rdf = ldns_native2rdf_int32(LDNS_RDF_TYPE_INT32, 0); if (!refresh_rdf) { ldns_rr_free(soa_rr); - return LDNS_STATUS_MEM_ERR; + return NULL; } else { ldns_rr_push_rdf(soa_rr, refresh_rdf); } retry_rdf = ldns_native2rdf_int32(LDNS_RDF_TYPE_INT32, 0); if (!retry_rdf) { ldns_rr_free(soa_rr); - return LDNS_STATUS_MEM_ERR; + return NULL; } else { ldns_rr_push_rdf(soa_rr, retry_rdf); } expire_rdf = ldns_native2rdf_int32(LDNS_RDF_TYPE_INT32, 0); if (!expire_rdf) { ldns_rr_free(soa_rr); - return LDNS_STATUS_MEM_ERR; + return NULL; } else { ldns_rr_push_rdf(soa_rr, expire_rdf); } minimum_rdf = ldns_native2rdf_int32(LDNS_RDF_TYPE_INT32, 0); if (!minimum_rdf) { ldns_rr_free(soa_rr); - return LDNS_STATUS_MEM_ERR; + return NULL; } else { ldns_rr_push_rdf(soa_rr, minimum_rdf); } - ldns_pkt_push_rr(packet, LDNS_SECTION_AUTHORITY, soa_rr); - return LDNS_STATUS_OK; + return soa_rr; } -ldns_status -ldns_pkt_query_new_frm_str(ldns_pkt **p, const char *name, ldns_rr_type rr_type, - ldns_rr_class rr_class, uint16_t flags) +static ldns_status +ldns_pkt_query_new_frm_str_internal(ldns_pkt **p, const char *name, + ldns_rr_type rr_type, ldns_rr_class rr_class, uint16_t flags, + ldns_rr* authsoa_rr) { ldns_pkt *packet; ldns_rr *question_rr; @@ -918,11 +918,11 @@ ldns_pkt_query_new_frm_str(ldns_pkt **p, const char *name, ldns_rr_type rr_type, if (!packet) { return LDNS_STATUS_MEM_ERR; } - + if (!ldns_pkt_set_flags(packet, flags)) { return LDNS_STATUS_ERR; } - + question_rr = ldns_rr_new(); if (!question_rr) { return LDNS_STATUS_MEM_ERR; @@ -948,12 +948,8 @@ ldns_pkt_query_new_frm_str(ldns_pkt **p, const char *name, ldns_rr_type rr_type, return LDNS_STATUS_ERR; } - /** IXFR? */ - if (rr_type == LDNS_RR_TYPE_IXFR) { - if (ldns_pkt_add_authsoa(packet, name_rdf, rr_class) != LDNS_STATUS_OK) { - ldns_pkt_free(packet); - return LDNS_STATUS_ERR; - } + if (authsoa_rr) { + ldns_pkt_push_rr(packet, LDNS_SECTION_AUTHORITY, authsoa_rr); } packet->_tsig_rr = NULL; @@ -967,9 +963,33 @@ ldns_pkt_query_new_frm_str(ldns_pkt **p, const char *name, ldns_rr_type rr_type, } } -ldns_pkt * -ldns_pkt_query_new(ldns_rdf *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_class, - uint16_t flags) +ldns_status +ldns_pkt_query_new_frm_str(ldns_pkt **p, const char *name, + ldns_rr_type rr_type, ldns_rr_class rr_class, uint16_t flags) +{ + return ldns_pkt_query_new_frm_str_internal(p, name, rr_type, + rr_class, flags, NULL); +} + +ldns_status +ldns_pkt_ixfr_request_new_frm_str(ldns_pkt **p, const char *name, + ldns_rr_class rr_class, uint16_t flags, ldns_rr *soa) +{ + ldns_rr* authsoa_rr = soa; + if (!authsoa_rr) { + ldns_rdf *name_rdf; + if (ldns_str2rdf_dname(&name_rdf, name) == LDNS_STATUS_OK) { + authsoa_rr = ldns_pkt_authsoa(name_rdf, rr_class); + } + ldns_rdf_free(name_rdf); + } + return ldns_pkt_query_new_frm_str_internal(p, name, LDNS_RR_TYPE_IXFR, + rr_class, flags, authsoa_rr); +} + +static ldns_pkt * +ldns_pkt_query_new_internal(ldns_rdf *rr_name, ldns_rr_type rr_type, + ldns_rr_class rr_class, uint16_t flags, ldns_rr* authsoa_rr) { ldns_pkt *packet; ldns_rr *question_rr; @@ -982,7 +1002,7 @@ ldns_pkt_query_new(ldns_rdf *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_cla if (!ldns_pkt_set_flags(packet, flags)) { return NULL; } - + question_rr = ldns_rr_new(); if (!question_rr) { ldns_pkt_free(packet); @@ -1002,18 +1022,34 @@ ldns_pkt_query_new(ldns_rdf *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_cla ldns_rr_set_question(question_rr, true); ldns_pkt_push_rr(packet, LDNS_SECTION_QUESTION, question_rr); - /** IXFR? */ - if (rr_type == LDNS_RR_TYPE_IXFR) { - if (ldns_pkt_add_authsoa(packet, rr_name, rr_class) != LDNS_STATUS_OK) { - ldns_pkt_free(packet); - return NULL; - } + if (authsoa_rr) { + ldns_pkt_push_rr(packet, LDNS_SECTION_AUTHORITY, authsoa_rr); } packet->_tsig_rr = NULL; return packet; } +ldns_pkt * +ldns_pkt_query_new(ldns_rdf *rr_name, ldns_rr_type rr_type, + ldns_rr_class rr_class, uint16_t flags) +{ + return ldns_pkt_query_new_internal(rr_name, rr_type, + rr_class, flags, NULL); +} + +ldns_pkt * +ldns_pkt_ixfr_request_new(ldns_rdf *rr_name, ldns_rr_class rr_class, + uint16_t flags, ldns_rr* soa) +{ + ldns_rr* authsoa_rr = soa; + if (!authsoa_rr) { + authsoa_rr = ldns_pkt_authsoa(rr_name, rr_class); + } + return ldns_pkt_query_new_internal(rr_name, LDNS_RR_TYPE_IXFR, + rr_class, flags, authsoa_rr); +} + ldns_pkt_type ldns_pkt_reply_type(ldns_pkt *p) { diff --git a/contrib/ldns/parse.c b/contrib/ldns/parse.c index 8849effad6f..710c4e70b84 100644 --- a/contrib/ldns/parse.c +++ b/contrib/ldns/parse.c @@ -135,7 +135,7 @@ ldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit, int *li if (c != '\0' && c != '\n') { i++; } - if (limit > 0 && i >= limit) { + if (limit > 0 && (i >= limit || (size_t)(t-token) >= limit)) { *t = '\0'; return -1; } @@ -308,7 +308,7 @@ ldns_bget_token(ldns_buffer *b, char *token, const char *delim, size_t limit) } i++; - if (limit > 0 && i >= limit) { + if (limit > 0 && (i >= limit || (size_t)(t-token) >= limit)) { *t = '\0'; return -1; } diff --git a/contrib/ldns/radix.c b/contrib/ldns/radix.c new file mode 100644 index 00000000000..69797567213 --- /dev/null +++ b/contrib/ldns/radix.c @@ -0,0 +1,1590 @@ +/* + * radix.c -- generic radix tree + * + * Taken from NSD4, modified for ldns + * + * Copyright (c) 2012, NLnet Labs. All rights reserved. + * + * This software is open source. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 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. + * + * Neither the name of the NLNET LABS 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 COPYRIGHT HOLDERS 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. + * + */ + +/** + * \file + * Implementation of a radix tree. + */ + +#include +#include +#include +#include + +/** Helper functions */ +static ldns_radix_node_t* ldns_radix_new_node(void* data, uint8_t* key, + radix_strlen_t len); +static int ldns_radix_find_prefix(ldns_radix_t* tree, uint8_t* key, + radix_strlen_t len, ldns_radix_node_t** result, radix_strlen_t* pos); +static int ldns_radix_array_space(ldns_radix_node_t* node, uint8_t byte); +static int ldns_radix_array_grow(ldns_radix_node_t* node, unsigned need); +static int ldns_radix_str_create(ldns_radix_array_t* array, uint8_t* key, + radix_strlen_t pos, radix_strlen_t len); +static int ldns_radix_prefix_remainder(radix_strlen_t prefix_len, + uint8_t* longer_str, radix_strlen_t longer_len, uint8_t** split_str, + radix_strlen_t* split_len); +static int ldns_radix_array_split(ldns_radix_array_t* array, uint8_t* key, + radix_strlen_t pos, radix_strlen_t len, ldns_radix_node_t* add); +static int ldns_radix_str_is_prefix(uint8_t* str1, radix_strlen_t len1, + uint8_t* str2, radix_strlen_t len2); +static radix_strlen_t ldns_radix_str_common(uint8_t* str1, radix_strlen_t len1, + uint8_t* str2, radix_strlen_t len2); +static ldns_radix_node_t* ldns_radix_next_in_subtree(ldns_radix_node_t* node); +static ldns_radix_node_t* ldns_radix_prev_from_index(ldns_radix_node_t* node, + uint8_t index); +static ldns_radix_node_t* ldns_radix_last_in_subtree_incl_self( + ldns_radix_node_t* node); +static ldns_radix_node_t* ldns_radix_last_in_subtree(ldns_radix_node_t* node); +static void ldns_radix_del_fix(ldns_radix_t* tree, ldns_radix_node_t* node); +static void ldns_radix_cleanup_onechild(ldns_radix_node_t* node); +static void ldns_radix_cleanup_leaf(ldns_radix_node_t* node); +static void ldns_radix_node_free(ldns_radix_node_t* node, void* arg); +static void ldns_radix_node_array_free(ldns_radix_node_t* node); +static void ldns_radix_node_array_free_front(ldns_radix_node_t* node); +static void ldns_radix_node_array_free_end(ldns_radix_node_t* node); +static void ldns_radix_array_reduce(ldns_radix_node_t* node); +static void ldns_radix_self_or_prev(ldns_radix_node_t* node, + ldns_radix_node_t** result); + + +/** + * Create a new radix node. + * + */ +static ldns_radix_node_t* +ldns_radix_new_node(void* data, uint8_t* key, radix_strlen_t len) +{ + ldns_radix_node_t* node = LDNS_MALLOC(ldns_radix_node_t); + if (!node) { + return NULL; + } + node->data = data; + node->key = key; + node->klen = len; + node->parent = NULL; + node->parent_index = 0; + node->len = 0; + node->offset = 0; + node->capacity = 0; + node->array = NULL; + return node; +} + + +/** + * Create a new radix tree. + * + */ +ldns_radix_t * +ldns_radix_create(void) +{ + ldns_radix_t* tree; + + /** Allocate memory for it */ + tree = (ldns_radix_t *) LDNS_MALLOC(ldns_radix_t); + if (!tree) { + return NULL; + } + /** Initialize it */ + ldns_radix_init(tree); + return tree; +} + + +/** + * Initialize radix tree. + * + */ +void +ldns_radix_init(ldns_radix_t* tree) +{ + /** Initialize it */ + if (tree) { + tree->root = NULL; + tree->count = 0; + } + return; +} + + +/** + * Free radix tree. + * + */ +void +ldns_radix_free(ldns_radix_t* tree) +{ + if (tree) { + if (tree->root) { + ldns_radix_traverse_postorder(tree->root, + ldns_radix_node_free, NULL); + } + LDNS_FREE(tree); + } + return; +} + + +/** + * Insert data into the tree. + * + */ +ldns_status +ldns_radix_insert(ldns_radix_t* tree, uint8_t* key, radix_strlen_t len, + void* data) +{ + radix_strlen_t pos = 0; + ldns_radix_node_t* add = NULL; + ldns_radix_node_t* prefix = NULL; + + if (!tree || !key || !data) { + return LDNS_STATUS_NULL; + } + add = ldns_radix_new_node(data, key, len); + if (!add) { + return LDNS_STATUS_MEM_ERR; + } + /** Search the trie until we can make no further process. */ + if (!ldns_radix_find_prefix(tree, key, len, &prefix, &pos)) { + /** No prefix found */ + assert(tree->root == NULL); + if (len == 0) { + /** + * Example 1: The root: + * | [0] + **/ + tree->root = add; + } else { + /** Example 2: 'dns': + * | [0] + * --| [d+ns] dns + **/ + prefix = ldns_radix_new_node(NULL, (uint8_t*)"", 0); + if (!prefix) { + LDNS_FREE(add); + return LDNS_STATUS_MEM_ERR; + } + /** Find some space in the array for the first byte */ + if (!ldns_radix_array_space(prefix, key[0])) { + LDNS_FREE(add); + LDNS_FREE(prefix->array); + LDNS_FREE(prefix); + return LDNS_STATUS_MEM_ERR; + } + /** Set relational pointers */ + add->parent = prefix; + add->parent_index = 0; + prefix->array[0].edge = add; + if (len > 1) { + /** Store the remainder of the prefix */ + if (!ldns_radix_prefix_remainder(1, key, + len, &prefix->array[0].str, + &prefix->array[0].len)) { + LDNS_FREE(add); + LDNS_FREE(prefix->array); + LDNS_FREE(prefix); + return LDNS_STATUS_MEM_ERR; + } + } + tree->root = prefix; + } + } else if (pos == len) { + /** Exact match found */ + if (prefix->data) { + /* Element already exists */ + LDNS_FREE(add); + return LDNS_STATUS_EXISTS_ERR; + } + prefix->data = data; + prefix->key = key; + prefix->klen = len; /* redundant */ + } else { + /** Prefix found */ + uint8_t byte = key[pos]; + assert(pos < len); + if (byte < prefix->offset || + (byte - prefix->offset) >= prefix->len) { + /** Find some space in the array for the byte. */ + /** + * Example 3: 'ldns' + * | [0] + * --| [d+ns] dns + * --| [l+dns] ldns + **/ + if (!ldns_radix_array_space(prefix, byte)) { + LDNS_FREE(add); + return LDNS_STATUS_MEM_ERR; + } + assert(byte >= prefix->offset); + assert((byte - prefix->offset) <= prefix->len); + byte -= prefix->offset; + if (pos+1 < len) { + /** Create remainder of the string. */ + if (!ldns_radix_str_create( + &prefix->array[byte], key, pos+1, + len)) { + LDNS_FREE(add); + return LDNS_STATUS_MEM_ERR; + } + } + /** Add new node. */ + add->parent = prefix; + add->parent_index = byte; + prefix->array[byte].edge = add; + } else if (prefix->array[byte-prefix->offset].edge == NULL) { + /** Use existing element. */ + /** + * Example 4: 'edns' + * | [0] + * --| [d+ns] dns + * --| [e+dns] edns + * --| [l+dns] ldns + **/ + byte -= prefix->offset; + if (pos+1 < len) { + /** Create remainder of the string. */ + if (!ldns_radix_str_create( + &prefix->array[byte], key, pos+1, + len)) { + LDNS_FREE(add); + return LDNS_STATUS_MEM_ERR; + } + } + /** Add new node. */ + add->parent = prefix; + add->parent_index = byte; + prefix->array[byte].edge = add; + } else { + /** + * Use existing element, but it has a shared prefix, + * we need a split. + */ + if (!ldns_radix_array_split(&prefix->array[byte-(prefix->offset)], + key, pos+1, len, add)) { + LDNS_FREE(add); + return LDNS_STATUS_MEM_ERR; + } + } + } + + tree->count ++; + return LDNS_STATUS_OK; +} + + +/** + * Delete data from the tree. + * + */ +void* ldns_radix_delete(ldns_radix_t* tree, uint8_t* key, radix_strlen_t len) +{ + ldns_radix_node_t* del = ldns_radix_search(tree, key, len); + void* data = NULL; + if (del) { + tree->count--; + data = del->data; + del->data = NULL; + ldns_radix_del_fix(tree, del); + return data; + } + return NULL; +} + + +/** + * Search data in the tree. + * + */ +ldns_radix_node_t* +ldns_radix_search(ldns_radix_t* tree, uint8_t* key, radix_strlen_t len) +{ + ldns_radix_node_t* node = NULL; + radix_strlen_t pos = 0; + uint8_t byte = 0; + + if (!tree || !key) { + return NULL; + } + node = tree->root; + while (node) { + if (pos == len) { + return node->data?node:NULL; + } + byte = key[pos]; + if (byte < node->offset) { + return NULL; + } + byte -= node->offset; + if (byte >= node->len) { + return NULL; + } + pos++; + if (node->array[byte].len > 0) { + /** Must match additional string. */ + if (pos + node->array[byte].len > len) { + return NULL; + } + if (memcmp(&key[pos], node->array[byte].str, + node->array[byte].len) != 0) { + return NULL; + } + pos += node->array[byte].len; + } + node = node->array[byte].edge; + } + return NULL; +} + + +/** + * Search data in the tree, and if not found, find the closest smaller + * element in the tree. + * + */ +int +ldns_radix_find_less_equal(ldns_radix_t* tree, uint8_t* key, + radix_strlen_t len, ldns_radix_node_t** result) +{ + ldns_radix_node_t* node = NULL; + radix_strlen_t pos = 0; + uint8_t byte; + int memcmp_res = 0; + + if (!tree || !tree->root || !key) { + *result = NULL; + return 0; + } + + node = tree->root; + while (pos < len) { + byte = key[pos]; + if (byte < node->offset) { + /** + * No exact match. The lesser is in this or the + * previous node. + */ + ldns_radix_self_or_prev(node, result); + return 0; + } + byte -= node->offset; + if (byte >= node->len) { + /** + * No exact match. The lesser is in this node or the + * last of this array, or something before this node. + */ + *result = ldns_radix_last_in_subtree_incl_self(node); + if (*result == NULL) { + *result = ldns_radix_prev(node); + } + return 0; + } + pos++; + if (!node->array[byte].edge) { + /** + * No exact match. Find the previous in the array + * from this index. + */ + *result = ldns_radix_prev_from_index(node, byte); + if (*result == NULL) { + ldns_radix_self_or_prev(node, result); + } + return 0; + } + if (node->array[byte].len != 0) { + /** Must match additional string. */ + if (pos + node->array[byte].len > len) { + /** Additional string is longer than key. */ + if (memcmp(&key[pos], node->array[byte].str, + len-pos) <= 0) { + /** Key is before this node. */ + *result = ldns_radix_prev( + node->array[byte].edge); + } else { + /** Key is after additional string. */ + *result = ldns_radix_last_in_subtree_incl_self(node->array[byte].edge); + if (*result == NULL) { + *result = ldns_radix_prev(node->array[byte].edge); + } + } + return 0; + } + memcmp_res = memcmp(&key[pos], node->array[byte].str, + node->array[byte].len); + if (memcmp_res < 0) { + *result = ldns_radix_prev( + node->array[byte].edge); + return 0; + } else if (memcmp_res > 0) { + *result = ldns_radix_last_in_subtree_incl_self(node->array[byte].edge); + if (*result == NULL) { + *result = ldns_radix_prev(node->array[byte].edge); + } + return 0; + } + + pos += node->array[byte].len; + } + node = node->array[byte].edge; + } + if (node->data) { + /** Exact match. */ + *result = node; + return 1; + } + /** There is a node which is an exact match, but has no element. */ + *result = ldns_radix_prev(node); + return 0; +} + + +/** + * Get the first element in the tree. + * + */ +ldns_radix_node_t* +ldns_radix_first(ldns_radix_t* tree) +{ + ldns_radix_node_t* first = NULL; + if (!tree || !tree->root) { + return NULL; + } + first = tree->root; + if (first->data) { + return first; + } + return ldns_radix_next(first); +} + + +/** + * Get the last element in the tree. + * + */ +ldns_radix_node_t* +ldns_radix_last(ldns_radix_t* tree) +{ + if (!tree || !tree->root) { + return NULL; + } + return ldns_radix_last_in_subtree_incl_self(tree->root); +} + + +/** + * Next element. + * + */ +ldns_radix_node_t* +ldns_radix_next(ldns_radix_node_t* node) +{ + if (!node) { + return NULL; + } + if (node->len) { + /** Go down: most-left child is the next. */ + ldns_radix_node_t* next = ldns_radix_next_in_subtree(node); + if (next) { + return next; + } + } + /** No elements in subtree, get to parent and go down next branch. */ + while (node->parent) { + uint8_t index = node->parent_index; + node = node->parent; + index++; + for (; index < node->len; index++) { + if (node->array[index].edge) { + ldns_radix_node_t* next; + /** Node itself. */ + if (node->array[index].edge->data) { + return node->array[index].edge; + } + /** Dive into subtree. */ + next = ldns_radix_next_in_subtree(node); + if (next) { + return next; + } + } + } + } + return NULL; +} + + +/** + * Previous element. + * + */ +ldns_radix_node_t* +ldns_radix_prev(ldns_radix_node_t* node) +{ + if (!node) { + return NULL; + } + + /** Get to parent and go down previous branch. */ + while (node->parent) { + uint8_t index = node->parent_index; + ldns_radix_node_t* prev; + node = node->parent; + assert(node->len > 0); + prev = ldns_radix_prev_from_index(node, index); + if (prev) { + return prev; + } + if (node->data) { + return node; + } + } + return NULL; +} + + +/** + * Print node. + * + */ +static void +ldns_radix_node_print(FILE* fd, ldns_radix_node_t* node, + uint8_t i, uint8_t* str, radix_strlen_t len, unsigned d) +{ + uint8_t j; + if (!node) { + return; + } + for (j = 0; j < d; j++) { + fprintf(fd, "--"); + } + if (str) { + radix_strlen_t l; + fprintf(fd, "| [%u+", (unsigned) i); + for (l=0; l < len; l++) { + fprintf(fd, "%c", (char) str[l]); + } + fprintf(fd, "]%u", (unsigned) len); + } else { + fprintf(fd, "| [%u]", (unsigned) i); + } + + if (node->data) { + fprintf(fd, " %s", (char*) node->data); + } + fprintf(fd, "\n"); + + for (j = 0; j < node->len; j++) { + if (node->array[j].edge) { + ldns_radix_node_print(fd, node->array[j].edge, j, + node->array[j].str, node->array[j].len, d+1); + } + } + return; +} + + +/** + * Print radix tree. + * + */ +void +ldns_radix_printf(FILE* fd, ldns_radix_t* tree) +{ + if (!fd || !tree) { + return; + } + if (!tree->root) { + fprintf(fd, "; empty radix tree\n"); + return; + } + ldns_radix_node_print(fd, tree->root, 0, NULL, 0, 0); + return; +} + + +/** + * Join two radix trees. + * + */ +ldns_status +ldns_radix_join(ldns_radix_t* tree1, ldns_radix_t* tree2) +{ + ldns_radix_node_t* cur_node, *next_node; + ldns_status status; + if (!tree2 || !tree2->root) { + return LDNS_STATUS_OK; + } + /** Add all elements from tree2 into tree1. */ + + cur_node = ldns_radix_first(tree2); + while (cur_node) { + status = LDNS_STATUS_NO_DATA; + /** Insert current node into tree1 */ + if (cur_node->data) { + status = ldns_radix_insert(tree1, cur_node->key, + cur_node->klen, cur_node->data); + /** Exist errors may occur */ + if (status != LDNS_STATUS_OK && + status != LDNS_STATUS_EXISTS_ERR) { + return status; + } + } + next_node = ldns_radix_next(cur_node); + if (status == LDNS_STATUS_OK) { + (void) ldns_radix_delete(tree2, cur_node->key, + cur_node->klen); + } + cur_node = next_node; + } + + return LDNS_STATUS_OK; +} + + +/** + * Split a radix tree intwo. + * + */ +ldns_status +ldns_radix_split(ldns_radix_t* tree1, size_t num, ldns_radix_t** tree2) +{ + size_t count = 0; + ldns_radix_node_t* cur_node; + ldns_status status = LDNS_STATUS_OK; + if (!tree1 || !tree1->root || num == 0) { + return LDNS_STATUS_OK; + } + if (!tree2) { + return LDNS_STATUS_NULL; + } + if (!*tree2) { + *tree2 = ldns_radix_create(); + if (!*tree2) { + return LDNS_STATUS_MEM_ERR; + } + } + cur_node = ldns_radix_first(tree1); + while (count < num && cur_node) { + if (cur_node->data) { + /** Delete current node from tree1. */ + uint8_t* cur_key = cur_node->key; + radix_strlen_t cur_len = cur_node->klen; + void* cur_data = ldns_radix_delete(tree1, cur_key, + cur_len); + /** Insert current node into tree2/ */ + if (!cur_data) { + return LDNS_STATUS_NO_DATA; + } + status = ldns_radix_insert(*tree2, cur_key, cur_len, + cur_data); + if (status != LDNS_STATUS_OK && + status != LDNS_STATUS_EXISTS_ERR) { + return status; + } +/* + if (status == LDNS_STATUS_OK) { + cur_node->key = NULL; + cur_node->klen = 0; + } +*/ + /** Update count; get first element from tree1 again. */ + count++; + cur_node = ldns_radix_first(tree1); + } else { + cur_node = ldns_radix_next(cur_node); + } + } + return LDNS_STATUS_OK; +} + + +/** + * Call function for all nodes in the tree, such that leaf nodes are + * called before parent nodes. + * + */ +void +ldns_radix_traverse_postorder(ldns_radix_node_t* node, + void (*func)(ldns_radix_node_t*, void*), void* arg) +{ + uint8_t i; + if (!node) { + return; + } + for (i=0; i < node->len; i++) { + ldns_radix_traverse_postorder(node->array[i].edge, + func, arg); + } + /** Call user function */ + (*func)(node, arg); + return; +} + + +/** Static helper functions */ + +/** + * Find a prefix of the key. + * @param tree: tree. + * @param key: key. + * @param len: length of key. + * @param result: the longest prefix, the entry itself if *pos==len, + * otherwise an array entry. + * @param pos: position in string where next unmatched byte is. + * If *pos==len, an exact match is found. + * If *pos== 0, a "" match was found. + * @return 0 (false) if no prefix found. + * + */ +static int +ldns_radix_find_prefix(ldns_radix_t* tree, uint8_t* key, + radix_strlen_t len, ldns_radix_node_t** result, radix_strlen_t* respos) +{ + /** Start searching at the root node */ + ldns_radix_node_t* n = tree->root; + radix_strlen_t pos = 0; + uint8_t byte; + *respos = 0; + *result = n; + if (!n) { + /** No root, no prefix found */ + return 0; + } + /** For each node, look if we can make further progress */ + while (n) { + if (pos == len) { + /** Exact match */ + return 1; + } + byte = key[pos]; + if (byte < n->offset) { + /** key < node */ + return 1; + } + byte -= n->offset; + if (byte >= n->len) { + /** key > node */ + return 1; + } + /** So far, the trie matches */ + pos++; + if (n->array[byte].len != 0) { + /** Must match additional string */ + if (pos + n->array[byte].len > len) { + return 1; /* no match at child node */ + } + if (memcmp(&key[pos], n->array[byte].str, + n->array[byte].len) != 0) { + return 1; /* no match at child node */ + } + pos += n->array[byte].len; + } + /** Continue searching prefix at this child node */ + n = n->array[byte].edge; + if (!n) { + return 1; + } + /** Update the prefix node */ + *respos = pos; + *result = n; + } + /** Done */ + return 1; +} + + +/** + * Make space in the node's array for another byte. + * @param node: node. + * @param byte: byte. + * @return 1 if successful, 0 otherwise. + * + */ +static int +ldns_radix_array_space(ldns_radix_node_t* node, uint8_t byte) +{ + /** Is there an array? */ + if (!node->array) { + assert(node->capacity == 0); + /** No array, create new array */ + node->array = LDNS_MALLOC(ldns_radix_array_t); + if (!node->array) { + return 0; + } + memset(&node->array[0], 0, sizeof(ldns_radix_array_t)); + node->len = 1; + node->capacity = 1; + node->offset = byte; + return 1; + } + /** Array exist */ + assert(node->array != NULL); + assert(node->capacity > 0); + + if (node->len == 0) { + /** Unused array */ + node->len = 1; + node->offset = byte; + } else if (byte < node->offset) { + /** Byte is below the offset */ + uint8_t index; + uint16_t need = node->offset - byte; + /** Is there enough capacity? */ + if (node->len + need > node->capacity) { + /** Not enough capacity, grow array */ + if (!ldns_radix_array_grow(node, + (unsigned) (node->len + need))) { + return 0; /* failed to grow array */ + } + } + /** Move items to the end */ + memmove(&node->array[need], &node->array[0], + node->len*sizeof(ldns_radix_array_t)); + /** Fix parent index */ + for (index = 0; index < node->len; index++) { + if (node->array[index+need].edge) { + node->array[index+need].edge->parent_index = + index + need; + } + } + /** Zero the first */ + memset(&node->array[0], 0, need*sizeof(ldns_radix_array_t)); + node->len += need; + node->offset = byte; + } else if (byte - node->offset >= node->len) { + /** Byte does not fit in array */ + uint16_t need = (byte - node->offset) - node->len + 1; + /** Is there enough capacity? */ + if (node->len + need > node->capacity) { + /** Not enough capacity, grow array */ + if (!ldns_radix_array_grow(node, + (unsigned) (node->len + need))) { + return 0; /* failed to grow array */ + } + } + /** Zero the added items */ + memset(&node->array[node->len], 0, + need*sizeof(ldns_radix_array_t)); + node->len += need; + } + return 1; +} + + +/** + * Grow the array. + * @param node: node. + * @param need: number of elements the array at least need to grow. + * Can't be bigger than 256. + * @return: 0 if failed, 1 if was successful. + * + */ +static int +ldns_radix_array_grow(ldns_radix_node_t* node, unsigned need) +{ + unsigned size = ((unsigned)node->capacity)*2; + ldns_radix_array_t* a = NULL; + if (need > size) { + size = need; + } + if (size > 256) { + size = 256; + } + a = LDNS_XMALLOC(ldns_radix_array_t, size); + if (!a) { + return 0; + } + assert(node->len <= node->capacity); + assert(node->capacity < size); + memcpy(&a[0], &node->array[0], node->len*sizeof(ldns_radix_array_t)); + LDNS_FREE(node->array); + node->array = a; + node->capacity = size; + return 1; +} + + +/** + * Create a prefix in the array string. + * @param array: array. + * @param key: key. + * @param pos: start position in key. + * @param len: length of key. + * @return 0 if failed, 1 if was successful. + * + */ +static int +ldns_radix_str_create(ldns_radix_array_t* array, uint8_t* key, + radix_strlen_t pos, radix_strlen_t len) +{ + array->str = LDNS_XMALLOC(uint8_t, (len-pos)); + if (!array->str) { + return 0; + } + memmove(array->str, key+pos, len-pos); + array->len = (len-pos); + return 1; +} + + +/** + * Allocate remainder from prefixes for a split. + * @param prefixlen: length of prefix. + * @param longer_str: the longer string. + * @param longer_len: the longer string length. + * @param split_str: the split string. + * @param split_len: the split string length. + * @return 0 if failed, 1 if successful. + * + */ +static int +ldns_radix_prefix_remainder(radix_strlen_t prefix_len, + uint8_t* longer_str, radix_strlen_t longer_len, + uint8_t** split_str, radix_strlen_t* split_len) +{ + *split_len = longer_len - prefix_len; + *split_str = LDNS_XMALLOC(uint8_t, (*split_len)); + if (!*split_str) { + return 0; + } + memmove(*split_str, longer_str+prefix_len, longer_len-prefix_len); + return 1; +} + + +/** + * Create a split when two nodes have a shared prefix. + * @param array: array. + * @param key: key. + * @param pos: start position in key. + * @param len: length of the key. + * @param add: node to be added. + * @return 0 if failed, 1 if was successful. + * + */ +static int +ldns_radix_array_split(ldns_radix_array_t* array, uint8_t* key, + radix_strlen_t pos, radix_strlen_t len, ldns_radix_node_t* add) +{ + uint8_t* str_to_add = key + pos; + radix_strlen_t strlen_to_add = len - pos; + + if (ldns_radix_str_is_prefix(str_to_add, strlen_to_add, + array->str, array->len)) { + /** The string to add is a prefix of the existing string */ + uint8_t* split_str = NULL, *dup_str = NULL; + radix_strlen_t split_len = 0; + /** + * Example 5: 'ld' + * | [0] + * --| [d+ns] dns + * --| [e+dns] edns + * --| [l+d] ld + * ----| [n+s] ldns + **/ + assert(strlen_to_add < array->len); + /** Store the remainder in the split string */ + if (array->len - strlen_to_add > 1) { + if (!ldns_radix_prefix_remainder(strlen_to_add+1, + array->str, array->len, &split_str, + &split_len)) { + return 0; + } + } + /** Duplicate the string to add */ + if (strlen_to_add != 0) { + dup_str = LDNS_XMALLOC(uint8_t, strlen_to_add); + if (!dup_str) { + LDNS_FREE(split_str); + return 0; + } + memcpy(dup_str, str_to_add, strlen_to_add); + } + /** Make space in array for the new node */ + if (!ldns_radix_array_space(add, + array->str[strlen_to_add])) { + LDNS_FREE(split_str); + LDNS_FREE(dup_str); + return 0; + } + /** + * The added node should go direct under the existing parent. + * The existing node should go under the added node. + */ + add->parent = array->edge->parent; + add->parent_index = array->edge->parent_index; + add->array[0].edge = array->edge; + add->array[0].str = split_str; + add->array[0].len = split_len; + array->edge->parent = add; + array->edge->parent_index = 0; + LDNS_FREE(array->str); + array->edge = add; + array->str = dup_str; + array->len = strlen_to_add; + } else if (ldns_radix_str_is_prefix(array->str, array->len, + str_to_add, strlen_to_add)) { + /** The existing string is a prefix of the string to add */ + /** + * Example 6: 'dns-ng' + * | [0] + * --| [d+ns] dns + * ----| [-+ng] dns-ng + * --| [e+dns] edns + * --| [l+d] ld + * ----| [n+s] ldns + **/ + uint8_t* split_str = NULL; + radix_strlen_t split_len = 0; + assert(array->len < strlen_to_add); + if (strlen_to_add - array->len > 1) { + if (!ldns_radix_prefix_remainder(array->len+1, + str_to_add, strlen_to_add, &split_str, + &split_len)) { + return 0; + } + } + /** Make space in array for the new node */ + if (!ldns_radix_array_space(array->edge, + str_to_add[array->len])) { + LDNS_FREE(split_str); + return 0; + } + /** + * The added node should go direct under the existing node. + */ + add->parent = array->edge; + add->parent_index = str_to_add[array->len] - + array->edge->offset; + array->edge->array[add->parent_index].edge = add; + array->edge->array[add->parent_index].str = split_str; + array->edge->array[add->parent_index].len = split_len; + } else { + /** Create a new split node. */ + /** + * Example 7: 'dndns' + * | [0] + * --| [d+n] + * ----| [d+ns] dndns + * ----| [s] dns + * ------| [-+ng] dns-ng + * --| [e+dns] edns + * --| [l+d] ld + * ----| [n+s] ldns + **/ + ldns_radix_node_t* common = NULL; + uint8_t* common_str = NULL, *s1 = NULL, *s2 = NULL; + radix_strlen_t common_len = 0, l1 = 0, l2 = 0; + common_len = ldns_radix_str_common(array->str, array->len, + str_to_add, strlen_to_add); + assert(common_len < array->len); + assert(common_len < strlen_to_add); + /** Create the new common node. */ + common = ldns_radix_new_node(NULL, (uint8_t*)"", 0); + if (!common) { + return 0; + } + if (array->len - common_len > 1) { + if (!ldns_radix_prefix_remainder(common_len+1, + array->str, array->len, &s1, &l1)) { + return 0; + } + } + if (strlen_to_add - common_len > 1) { + if (!ldns_radix_prefix_remainder(common_len+1, + str_to_add, strlen_to_add, &s2, &l2)) { + return 0; + } + } + /** Create the shared prefix. */ + if (common_len > 0) { + common_str = LDNS_XMALLOC(uint8_t, common_len); + if (!common_str) { + LDNS_FREE(common); + LDNS_FREE(s1); + LDNS_FREE(s2); + return 0; + } + memcpy(common_str, str_to_add, common_len); + } + /** Make space in the common node array. */ + if (!ldns_radix_array_space(common, array->str[common_len]) || + !ldns_radix_array_space(common, str_to_add[common_len])) { + LDNS_FREE(common->array); + LDNS_FREE(common); + LDNS_FREE(common_str); + LDNS_FREE(s1); + LDNS_FREE(s2); + return 0; + } + /** + * The common node should go direct under the parent node. + * The added and existing nodes go under the common node. + */ + common->parent = array->edge->parent; + common->parent_index = array->edge->parent_index; + array->edge->parent = common; + array->edge->parent_index = array->str[common_len] - + common->offset; + add->parent = common; + add->parent_index = str_to_add[common_len] - common->offset; + common->array[array->edge->parent_index].edge = array->edge; + common->array[array->edge->parent_index].str = s1; + common->array[array->edge->parent_index].len = l1; + common->array[add->parent_index].edge = add; + common->array[add->parent_index].str = s2; + common->array[add->parent_index].len = l2; + LDNS_FREE(array->str); + array->edge = common; + array->str = common_str; + array->len = common_len; + } + return 1; +} + + +/** + * Check if one string prefix of other string. + * @param str1: one string. + * @param len1: one string length. + * @param str2: other string. + * @param len2: other string length. + * @return 1 if prefix, 0 otherwise. + * + */ +static int +ldns_radix_str_is_prefix(uint8_t* str1, radix_strlen_t len1, + uint8_t* str2, radix_strlen_t len2) +{ + if (len1 == 0) { + return 1; /* empty prefix is also a prefix */ + } + if (len1 > len2) { + return 0; /* len1 is longer so str1 cannot be a prefix */ + } + return (memcmp(str1, str2, len1) == 0); +} + + +/** + * Return the number of bytes in common for the two strings. + * @param str1: one string. + * @param len1: one string length. + * @param str2: other string. + * @param len2: other string length. + * @return length of substring that the two strings have in common. + * + */ +static radix_strlen_t +ldns_radix_str_common(uint8_t* str1, radix_strlen_t len1, + uint8_t* str2, radix_strlen_t len2) +{ + radix_strlen_t i, max = (len1len; i++) { + if (node->array[i].edge) { + /** Node itself. */ + if (node->array[i].edge->data) { + return node->array[i].edge; + } + /** Dive into subtree. */ + next = ldns_radix_next_in_subtree(node->array[i].edge); + if (next) { + return next; + } + } + } + return NULL; +} + + +/** + * Find the previous element in the array of this node, from index. + * @param node: node. + * @param index: index. + * @return previous node from index. + * + */ +static ldns_radix_node_t* +ldns_radix_prev_from_index(ldns_radix_node_t* node, uint8_t index) +{ + uint8_t i = index; + while (i > 0) { + i--; + if (node->array[i].edge) { + ldns_radix_node_t* prev = + ldns_radix_last_in_subtree_incl_self(node); + if (prev) { + return prev; + } + } + } + return NULL; +} + + +/** + * Find last node in subtree, or this node (if have data). + * @param node: node. + * @return last node in subtree, or this node, or NULL. + * + */ +static ldns_radix_node_t* +ldns_radix_last_in_subtree_incl_self(ldns_radix_node_t* node) +{ + ldns_radix_node_t* last = ldns_radix_last_in_subtree(node); + if (last) { + return last; + } else if (node->data) { + return node; + } + return NULL; +} + + +/** + * Find last node in subtree. + * @param node: node. + * @return last node in subtree. + * + */ +static ldns_radix_node_t* +ldns_radix_last_in_subtree(ldns_radix_node_t* node) +{ + int i; + /** Look for the most right leaf node. */ + for (i=(int)(node->len)-1; i >= 0; i--) { + if (node->array[i].edge) { + /** Keep looking for the most right leaf node. */ + if (node->array[i].edge->len > 0) { + ldns_radix_node_t* last = + ldns_radix_last_in_subtree( + node->array[i].edge); + if (last) { + return last; + } + } + /** Could this be the most right leaf node? */ + if (node->array[i].edge->data) { + return node->array[i].edge; + } + } + } + return NULL; +} + + +/** + * Fix tree after deleting element. + * @param tree: tree. + * @param node: node with deleted element. + * + */ +static void +ldns_radix_del_fix(ldns_radix_t* tree, ldns_radix_node_t* node) +{ + while (node) { + if (node->data) { + /** Thou should not delete nodes with data attached. */ + return; + } else if (node->len == 1 && node->parent) { + /** Node with one child is fold back into. */ + ldns_radix_cleanup_onechild(node); + return; + } else if (node->len == 0) { + /** Leaf node. */ + ldns_radix_node_t* parent = node->parent; + if (!parent) { + /** The root is a leaf node. */ + ldns_radix_node_free(node, NULL); + tree->root = NULL; + return; + } + /** Cleanup leaf node and continue with parent. */ + ldns_radix_cleanup_leaf(node); + node = parent; + } else { + /** + * Node cannot be deleted, because it has edge nodes + * and no parent to fix up to. + */ + return; + } + } + /** Not reached. */ + return; +} + + +/** + * Clean up a node with one child. + * @param node: node with one child. + * + */ +static void +ldns_radix_cleanup_onechild(ldns_radix_node_t* node) +{ + uint8_t* join_str; + radix_strlen_t join_len; + uint8_t parent_index = node->parent_index; + ldns_radix_node_t* child = node->array[0].edge; + ldns_radix_node_t* parent = node->parent; + + /** Node has one child, merge the child node into the parent node. */ + assert(parent_index < parent->len); + join_len = parent->array[parent_index].len + node->array[0].len + 1; + + join_str = LDNS_XMALLOC(uint8_t, join_len); + if (!join_str) { + /** + * Cleanup failed due to out of memory. + * This tree is now inefficient, with the empty node still + * existing, but it is still valid. + */ + return; + } + + memcpy(join_str, parent->array[parent_index].str, + parent->array[parent_index].len); + join_str[parent->array[parent_index].len] = child->parent_index + + node->offset; + memmove(join_str + parent->array[parent_index].len+1, + node->array[0].str, node->array[0].len); + + LDNS_FREE(parent->array[parent_index].str); + parent->array[parent_index].str = join_str; + parent->array[parent_index].len = join_len; + parent->array[parent_index].edge = child; + child->parent = parent; + child->parent_index = parent_index; + ldns_radix_node_free(node, NULL); + return; +} + + +/** + * Clean up a leaf node. + * @param node: leaf node. + * + */ +static void +ldns_radix_cleanup_leaf(ldns_radix_node_t* node) +{ + uint8_t parent_index = node->parent_index; + ldns_radix_node_t* parent = node->parent; + /** Delete lead node and fix parent array. */ + assert(parent_index < parent->len); + ldns_radix_node_free(node, NULL); + LDNS_FREE(parent->array[parent_index].str); + parent->array[parent_index].str = NULL; + parent->array[parent_index].len = 0; + parent->array[parent_index].edge = NULL; + /** Fix array in parent. */ + if (parent->len == 1) { + ldns_radix_node_array_free(parent); + } else if (parent_index == 0) { + ldns_radix_node_array_free_front(parent); + } else { + ldns_radix_node_array_free_end(parent); + } + return; +} + + +/** + * Free a radix node. + * @param node: node. + * @param arg: user argument. + * + */ +static void +ldns_radix_node_free(ldns_radix_node_t* node, void* arg) +{ + uint16_t i; + (void) arg; + if (!node) { + return; + } + for (i=0; i < node->len; i++) { + LDNS_FREE(node->array[i].str); + } + node->key = NULL; + node->klen = 0; + LDNS_FREE(node->array); + LDNS_FREE(node); + return; +} + + +/** + * Free select edge array. + * @param node: node. + * + */ +static void +ldns_radix_node_array_free(ldns_radix_node_t* node) +{ + node->offset = 0; + node->len = 0; + LDNS_FREE(node->array); + node->array = NULL; + node->capacity = 0; + return; +} + + +/** + * Free front of select edge array. + * @param node: node. + * + */ +static void +ldns_radix_node_array_free_front(ldns_radix_node_t* node) +{ + uint16_t i, n = 0; + /** Remove until a non NULL entry. */ + while (n < node->len && node->array[n].edge == NULL) { + n++; + } + if (n == 0) { + return; + } + if (n == node->len) { + ldns_radix_node_array_free(node); + return; + } + assert(n < node->len); + assert((int) n <= (255 - (int) node->offset)); + memmove(&node->array[0], &node->array[n], + (node->len - n)*sizeof(ldns_radix_array_t)); + node->offset += n; + node->len -= n; + for (i=0; i < node->len; i++) { + if (node->array[i].edge) { + node->array[i].edge->parent_index = i; + } + } + ldns_radix_array_reduce(node); + return; +} + + +/** + * Free front of select edge array. + * @param node: node. + * + */ +static void +ldns_radix_node_array_free_end(ldns_radix_node_t* node) +{ + uint16_t n = 0; + /** Shorten array. */ + while (n < node->len && node->array[node->len-1-n].edge == NULL) { + n++; + } + if (n == 0) { + return; + } + if (n == node->len) { + ldns_radix_node_array_free(node); + return; + } + assert(n < node->len); + node->len -= n; + ldns_radix_array_reduce(node); + return; +} + + +/** + * Reduce the capacity of the array if needed. + * @param node: node. + * + */ +static void +ldns_radix_array_reduce(ldns_radix_node_t* node) +{ + if (node->len <= node->capacity/2 && node->len != node->capacity) { + ldns_radix_array_t* a = LDNS_XMALLOC(ldns_radix_array_t, + node->len); + if (!a) { + return; + } + memcpy(a, node->array, sizeof(ldns_radix_array_t)*node->len); + LDNS_FREE(node->array); + node->array = a; + node->capacity = node->len; + } + return; +} + + +/** + * Return this element if it exists, the previous otherwise. + * @param node: from this node. + * @param result: result node. + * + */ +static void +ldns_radix_self_or_prev(ldns_radix_node_t* node, ldns_radix_node_t** result) +{ + if (node->data) { + *result = node; + } else { + *result = ldns_radix_prev(node); + } + return; +} diff --git a/contrib/ldns/rdata.c b/contrib/ldns/rdata.c index 8af16a13a1c..6493543f0a2 100644 --- a/contrib/ldns/rdata.c +++ b/contrib/ldns/rdata.c @@ -112,14 +112,14 @@ time_t ldns_rdf2native_time_t(const ldns_rdf *rd) { uint32_t data; - - switch(ldns_rdf_get_type(rd)) { - case LDNS_RDF_TYPE_TIME: - memcpy(&data, ldns_rdf_data(rd), sizeof(data)); - return (time_t)ntohl(data); - default: - return 0; + + /* only allow 32 bit rdfs */ + if (ldns_rdf_size(rd) != LDNS_RDF_SIZE_DOUBLEWORD || + ldns_rdf_get_type(rd) != LDNS_RDF_TYPE_TIME) { + return 0; } + memcpy(&data, ldns_rdf_data(rd), sizeof(data)); + return (time_t)ntohl(data); } ldns_rdf * @@ -309,8 +309,8 @@ ldns_rdf_new_frm_str(ldns_rdf_type type, const char *str) case LDNS_RDF_TYPE_PERIOD: status = ldns_str2rdf_period(&rdf, str); break; - case LDNS_RDF_TYPE_TSIG: - status = ldns_str2rdf_tsig(&rdf, str); + case LDNS_RDF_TYPE_HIP: + status = ldns_str2rdf_hip(&rdf, str); break; case LDNS_RDF_TYPE_SERVICE: status = ldns_str2rdf_service(&rdf, str); @@ -336,6 +336,21 @@ ldns_rdf_new_frm_str(ldns_rdf_type type, const char *str) case LDNS_RDF_TYPE_NSEC3_NEXT_OWNER: status = ldns_str2rdf_b32_ext(&rdf, str); break; + case LDNS_RDF_TYPE_ILNP64: + status = ldns_str2rdf_ilnp64(&rdf, str); + break; + case LDNS_RDF_TYPE_EUI48: + status = ldns_str2rdf_eui48(&rdf, str); + break; + case LDNS_RDF_TYPE_EUI64: + status = ldns_str2rdf_eui64(&rdf, str); + break; + case LDNS_RDF_TYPE_TAG: + status = ldns_str2rdf_tag(&rdf, str); + break; + case LDNS_RDF_TYPE_LONG_STR: + status = ldns_str2rdf_long_str(&rdf, str); + break; case LDNS_RDF_TYPE_NONE: default: /* default default ??? */ @@ -503,6 +518,64 @@ ldns_rdf_address_reverse(ldns_rdf *rd) return rev; } +ldns_status +ldns_rdf_hip_get_alg_hit_pk(ldns_rdf *rdf, uint8_t* alg, + uint8_t *hit_size, uint8_t** hit, + uint16_t *pk_size, uint8_t** pk) +{ + uint8_t *data; + size_t rdf_size; + + if (! rdf || ! alg || ! hit || ! hit_size || ! pk || ! pk_size) { + return LDNS_STATUS_INVALID_POINTER; + } else if (ldns_rdf_get_type(rdf) != LDNS_RDF_TYPE_HIP) { + return LDNS_STATUS_INVALID_RDF_TYPE; + } else if ((rdf_size = ldns_rdf_size(rdf)) < 6) { + return LDNS_STATUS_WIRE_RDATA_ERR; + } + data = ldns_rdf_data(rdf); + *hit_size = data[0]; + *alg = data[1]; + *pk_size = ldns_read_uint16(data + 2); + *hit = data + 4; + *pk = data + 4 + *hit_size; + if (*hit_size == 0 || *pk_size == 0 || + rdf_size < (size_t) *hit_size + *pk_size + 4) { + return LDNS_STATUS_WIRE_RDATA_ERR; + } + return LDNS_STATUS_OK; +} + +ldns_status +ldns_rdf_hip_new_frm_alg_hit_pk(ldns_rdf** rdf, uint8_t alg, + uint8_t hit_size, uint8_t *hit, + uint16_t pk_size, uint8_t *pk) +{ + uint8_t *data; + + if (! rdf) { + return LDNS_STATUS_INVALID_POINTER; + } + if (4 + hit_size + pk_size > LDNS_MAX_RDFLEN) { + return LDNS_STATUS_RDATA_OVERFLOW; + } + data = LDNS_XMALLOC(uint8_t, 4 + hit_size + pk_size); + if (data == NULL) { + return LDNS_STATUS_MEM_ERR; + } + data[0] = hit_size; + data[1] = alg; + ldns_write_uint16(data + 2, pk_size); + memcpy(data + 4, hit, hit_size); + memcpy(data + 4 + hit_size, pk, pk_size); + *rdf = ldns_rdf_new(LDNS_RDF_TYPE_HIP, 4 + hit_size + pk_size, data); + if (! *rdf) { + LDNS_FREE(data); + return LDNS_STATUS_MEM_ERR; + } + return LDNS_STATUS_OK; +} + ldns_status ldns_octet(char *word, size_t *length) { diff --git a/contrib/ldns/resolver.c b/contrib/ldns/resolver.c index 20d4e6dd4b5..16efc90f1a3 100644 --- a/contrib/ldns/resolver.c +++ b/contrib/ldns/resolver.c @@ -26,6 +26,12 @@ ldns_resolver_port(const ldns_resolver *r) return r->_port; } +ldns_rdf * +ldns_resolver_source(const ldns_resolver *r) +{ + return r->_source; +} + uint16_t ldns_resolver_edns_udp_size(const ldns_resolver *r) { @@ -234,6 +240,12 @@ ldns_resolver_set_port(ldns_resolver *r, uint16_t p) r->_port = p; } +void +ldns_resolver_set_source(ldns_resolver *r, ldns_rdf *s) +{ + r->_source = s; +} + ldns_rdf * ldns_resolver_pop_nameserver(ldns_resolver *r) { @@ -625,6 +637,7 @@ ldns_resolver_new(void) ldns_resolver_set_igntc(r, false); ldns_resolver_set_recursive(r, false); ldns_resolver_set_dnsrch(r, true); + ldns_resolver_set_source(r, NULL); /* randomize the nameserver to be queried * when there are multiple @@ -670,8 +683,15 @@ ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr) ssize_t gtr, bgtr; ldns_buffer *b; int lnr = 0, oldline; + FILE* myfp = fp; if(!line_nr) line_nr = &lnr; + if(!fp) { + myfp = fopen("/etc/resolv.conf", "r"); + if(!myfp) + return LDNS_STATUS_FILE_ERR; + } + /* do this better * expect = * 0: keyword @@ -691,6 +711,7 @@ ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr) r = ldns_resolver_new(); if (!r) { + if(!fp) fclose(myfp); return LDNS_STATUS_MEM_ERR; } @@ -706,9 +727,9 @@ ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr) /* skip until end of line */ int c; do { - c = fgetc(fp); + c = fgetc(myfp); } while(c != EOF && c != '\n'); - if(c=='\n' && line_nr) (*line_nr)++; + if(c=='\n') (*line_nr)++; } /* and read next to prepare for further parsing */ oldline = *line_nr; @@ -718,7 +739,7 @@ ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr) switch(expect) { case LDNS_RESOLV_KEYWORD: /* keyword */ - gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_NORMAL, 0, line_nr); + gtr = ldns_fget_token_l(myfp, word, LDNS_PARSE_NORMAL, 0, line_nr); if (gtr != 0) { if(word[0] == '#') continue; for(i = 0; i < LDNS_RESOLV_KEYWORDS; i++) { @@ -735,6 +756,7 @@ ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr) /* skip line */ /* ldns_resolver_deep_free(r); + if(!fp) fclose(myfp); return LDNS_STATUS_SYNTAX_KEYWORD_ERR; */ } @@ -742,8 +764,9 @@ ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr) break; case LDNS_RESOLV_DEFDOMAIN: /* default domain dname */ - gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_NORMAL, 0, line_nr); + gtr = ldns_fget_token_l(myfp, word, LDNS_PARSE_NORMAL, 0, line_nr); if (gtr == 0) { + if(!fp) fclose(myfp); return LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR; } if(word[0] == '#') { @@ -753,6 +776,7 @@ ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr) tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, word); if (!tmp) { ldns_resolver_deep_free(r); + if(!fp) fclose(myfp); return LDNS_STATUS_SYNTAX_DNAME_ERR; } @@ -762,8 +786,9 @@ ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr) break; case LDNS_RESOLV_NAMESERVER: /* NS aaaa or a record */ - gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_NORMAL, 0, line_nr); + gtr = ldns_fget_token_l(myfp, word, LDNS_PARSE_NORMAL, 0, line_nr); if (gtr == 0) { + if(!fp) fclose(myfp); return LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR; } if(word[0] == '#') { @@ -783,6 +808,7 @@ ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr) /* could not parse it, exit */ if (!tmp) { ldns_resolver_deep_free(r); + if(!fp) fclose(myfp); return LDNS_STATUS_SYNTAX_ERR; } (void)ldns_resolver_push_nameserver(r, tmp); @@ -791,10 +817,11 @@ ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr) break; case LDNS_RESOLV_SEARCH: /* search list domain dname */ - gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_SKIP_SPACE, 0, line_nr); + gtr = ldns_fget_token_l(myfp, word, LDNS_PARSE_SKIP_SPACE, 0, line_nr); b = LDNS_MALLOC(ldns_buffer); if(!b) { ldns_resolver_deep_free(r); + if(!fp) fclose(myfp); return LDNS_STATUS_MEM_ERR; } @@ -802,6 +829,7 @@ ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr) if(ldns_buffer_status(b) != LDNS_STATUS_OK) { LDNS_FREE(b); ldns_resolver_deep_free(r); + if(!fp) fclose(myfp); return LDNS_STATUS_MEM_ERR; } bgtr = ldns_bget_token(b, word, LDNS_PARSE_NORMAL, (size_t) gtr + 1); @@ -815,6 +843,7 @@ ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr) if (!tmp) { ldns_resolver_deep_free(r); ldns_buffer_free(b); + if(!fp) fclose(myfp); return LDNS_STATUS_SYNTAX_DNAME_ERR; } @@ -831,20 +860,21 @@ ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr) } break; case LDNS_RESOLV_SORTLIST: - gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_SKIP_SPACE, 0, line_nr); + gtr = ldns_fget_token_l(myfp, word, LDNS_PARSE_SKIP_SPACE, 0, line_nr); /* sortlist not implemented atm */ expect = LDNS_RESOLV_KEYWORD; break; case LDNS_RESOLV_OPTIONS: - gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_SKIP_SPACE, 0, line_nr); + gtr = ldns_fget_token_l(myfp, word, LDNS_PARSE_SKIP_SPACE, 0, line_nr); /* options not implemented atm */ expect = LDNS_RESOLV_KEYWORD; break; case LDNS_RESOLV_ANCHOR: /* a file containing a DNSSEC trust anchor */ - gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_NORMAL, 0, line_nr); + gtr = ldns_fget_token_l(myfp, word, LDNS_PARSE_NORMAL, 0, line_nr); if (gtr == 0) { ldns_resolver_deep_free(r); + if(!fp) fclose(myfp); return LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR; } if(word[0] == '#') { @@ -862,6 +892,9 @@ ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr) } } + if(!fp) + fclose(myfp); + if (res) { *res = r; return LDNS_STATUS_OK; @@ -953,86 +986,82 @@ ldns_resolver_deep_free(ldns_resolver *res) } } -ldns_pkt * -ldns_resolver_search(const ldns_resolver *r,const ldns_rdf *name, - ldns_rr_type t, ldns_rr_class c, uint16_t flags) +ldns_status +ldns_resolver_search_status(ldns_pkt** pkt, + ldns_resolver *r, const ldns_rdf *name, + ldns_rr_type t, ldns_rr_class c, uint16_t flags) { - ldns_rdf *new_name; ldns_rdf **search_list; size_t i; - ldns_pkt *p; + ldns_status s = LDNS_STATUS_OK; if (ldns_dname_absolute(name)) { /* query as-is */ - return ldns_resolver_query(r, name, t, c, flags); + return ldns_resolver_query_status(pkt, r, name, t, c, flags); } else if (ldns_resolver_dnsrch(r)) { search_list = ldns_resolver_searchlist(r); for (i = 0; i < ldns_resolver_searchlist_count(r); i++) { new_name = ldns_dname_cat_clone(name, search_list[i]); - p = ldns_resolver_query(r, new_name, t, c, flags); + s = ldns_resolver_query_status(pkt, r, + new_name, t, c, flags); ldns_rdf_free(new_name); - if (p) { - if (ldns_pkt_get_rcode(p) == LDNS_RCODE_NOERROR) { - return p; - } else { - ldns_pkt_free(p); - p = NULL; + if (pkt) { + if (s == LDNS_STATUS_OK && *pkt && + ldns_pkt_get_rcode(*pkt) == + LDNS_RCODE_NOERROR) { + return LDNS_STATUS_OK; } + ldns_pkt_free(*pkt); } } } - return NULL; + return s; +} + +ldns_pkt * +ldns_resolver_search(const ldns_resolver *r,const ldns_rdf *name, + ldns_rr_type t, ldns_rr_class c, uint16_t flags) +{ + ldns_pkt* pkt = NULL; + if (ldns_resolver_search_status(&pkt, (ldns_resolver *)r, + name, t, c, flags) != LDNS_STATUS_OK) { + ldns_pkt_free(pkt); + } + return pkt; +} + +ldns_status +ldns_resolver_query_status(ldns_pkt** pkt, + ldns_resolver *r, const ldns_rdf *name, + ldns_rr_type t, ldns_rr_class c, uint16_t flags) +{ + ldns_rdf *newname; + ldns_status status; + + if (!ldns_resolver_defnames(r) || !ldns_resolver_domain(r)) { + return ldns_resolver_send(pkt, r, name, t, c, flags); + } + + newname = ldns_dname_cat_clone(name, ldns_resolver_domain(r)); + if (!newname) { + return LDNS_STATUS_MEM_ERR; + } + status = ldns_resolver_send(pkt, r, newname, t, c, flags); + ldns_rdf_free(newname); + return status; } ldns_pkt * ldns_resolver_query(const ldns_resolver *r, const ldns_rdf *name, ldns_rr_type t, ldns_rr_class c, uint16_t flags) { - ldns_rdf *newname; - ldns_pkt *pkt; - ldns_status status; - - pkt = NULL; - - if (!ldns_resolver_defnames(r)) { - status = ldns_resolver_send(&pkt, (ldns_resolver *)r, name, - t, c, flags); - if (status == LDNS_STATUS_OK) { - return pkt; - } else { - if (pkt) { - ldns_pkt_free(pkt); - } - return NULL; - } + ldns_pkt* pkt = NULL; + if (ldns_resolver_query_status(&pkt, (ldns_resolver *)r, + name, t, c, flags) != LDNS_STATUS_OK) { + ldns_pkt_free(pkt); } - - if (!ldns_resolver_domain(r)) { - /* _defnames is set, but the domain is not....?? */ - status = ldns_resolver_send(&pkt, (ldns_resolver *)r, name, - t, c, flags); - if (status == LDNS_STATUS_OK) { - return pkt; - } else { - if (pkt) { - ldns_pkt_free(pkt); - } - return NULL; - } - } - - newname = ldns_dname_cat_clone((const ldns_rdf*)name, ldns_resolver_domain(r)); - if (!newname) { - return NULL; - } - - (void)ldns_resolver_send(&pkt, (ldns_resolver *)r, newname, t, c, - flags); - - ldns_rdf_free(newname); - return pkt; } @@ -1129,7 +1158,12 @@ ldns_resolver_prepare_query_pkt(ldns_pkt **query_pkt, ldns_resolver *r, /* prepare a question pkt from the parameters * and then send this */ - *query_pkt = ldns_pkt_query_new(ldns_rdf_clone(name), t, c, flags); + if (t == LDNS_RR_TYPE_IXFR) { + *query_pkt = ldns_pkt_ixfr_request_new(ldns_rdf_clone(name), + c, flags, NULL); + } else { + *query_pkt = ldns_pkt_query_new(ldns_rdf_clone(name), t, c, flags); + } if (!*query_pkt) { return LDNS_STATUS_ERR; } @@ -1206,7 +1240,7 @@ ldns_resolver_send(ldns_pkt **answer, ldns_resolver *r, const ldns_rdf *name, /* if tsig values are set, tsign it */ /* TODO: make last 3 arguments optional too? maybe make complete - rr instead of seperate values in resolver (and packet) + rr instead of separate values in resolver (and packet) Jelte should this go in pkt_prepare? */ @@ -1286,9 +1320,11 @@ ldns_axfr_next(ldns_resolver *resolver) resolver->_axfr_i = 0; if (status != LDNS_STATUS_OK) { /* TODO: make status return type of this function (...api change) */ +#ifdef STDERR_MSGS fprintf(stderr, "Error parsing rr during AXFR: %s\n", ldns_get_errorstr_by_id(status)); +#endif - /* RoRi: we must now also close the socket, otherwise subsequent uses of the + /* we must now also close the socket, otherwise subsequent uses of the same resolver structure will fail because the link is still open or in an undefined state */ #ifndef USE_WINSOCK @@ -1301,6 +1337,7 @@ ldns_axfr_next(ldns_resolver *resolver) return NULL; } else if (ldns_pkt_get_rcode(resolver->_cur_axfr_pkt) != 0) { rcode = ldns_lookup_by_id(ldns_rcodes, (int) ldns_pkt_get_rcode(resolver->_cur_axfr_pkt)); +#ifdef STDERR_MSGS if (rcode) { fprintf(stderr, "Error in AXFR: %s\n", rcode->name); @@ -1309,8 +1346,9 @@ ldns_axfr_next(ldns_resolver *resolver) (int) ldns_pkt_get_rcode( resolver->_cur_axfr_pkt)); } +#endif - /* RoRi: we must now also close the socket, otherwise subsequent uses of the + /* we must now also close the socket, otherwise subsequent uses of the same resolver structure will fail because the link is still open or in an undefined state */ #ifndef USE_WINSOCK @@ -1329,6 +1367,26 @@ ldns_axfr_next(ldns_resolver *resolver) } +/* this function is needed to abort a transfer that is in progress; + * without it an aborted transfer will lead to the AXFR code in the + * library staying in an indetermined state because the socket for the + * AXFR is never closed + */ +void +ldns_axfr_abort(ldns_resolver *resolver) +{ + /* Only abort if an actual AXFR is in progress */ + if (resolver->_socket != 0) + { +#ifndef USE_WINSOCK + close(resolver->_socket); +#else + closesocket(resolver->_socket); +#endif + resolver->_socket = 0; + } +} + bool ldns_axfr_complete(const ldns_resolver *res) { diff --git a/contrib/ldns/rr.c b/contrib/ldns/rr.c index c8b2ef9ce89..cfee170eb2b 100644 --- a/contrib/ldns/rr.c +++ b/contrib/ldns/rr.c @@ -87,6 +87,14 @@ ldns_rr_free(ldns_rr *rr) } } +/* Syntactic sugar for ldns_rr_new_frm_str_internal */ +INLINE bool +ldns_rdf_type_maybe_quoted(ldns_rdf_type rdf_type) +{ + return rdf_type == LDNS_RDF_TYPE_STR || + rdf_type == LDNS_RDF_TYPE_LONG_STR; +} + /* * trailing spaces are allowed * leading spaces are not allowed @@ -119,7 +127,7 @@ ldns_rr_new_frm_str_internal(ldns_rr **newrr, const char *str, char *type = NULL; char *rdata = NULL; char *rd = NULL; - char * b64 = NULL; + char *xtok = NULL; /* For RDF types with spaces (i.e. extra tokens) */ size_t rd_strlen; const char *delimiters; ssize_t c; @@ -138,6 +146,12 @@ ldns_rr_new_frm_str_internal(ldns_rr **newrr, const char *str, uint16_t r_max; size_t pre_data_pos; + uint16_t hex_data_size; + char *hex_data_str = NULL; + uint16_t cur_hex_data_size; + size_t hex_pos = 0; + uint8_t *hex_data = NULL; + new = ldns_rr_new(); owner = LDNS_XMALLOC(char, LDNS_MAX_DOMAINLEN + 1); @@ -147,26 +161,32 @@ ldns_rr_new_frm_str_internal(ldns_rr **newrr, const char *str, rr_buf = LDNS_MALLOC(ldns_buffer); rd_buf = LDNS_MALLOC(ldns_buffer); rd = LDNS_XMALLOC(char, LDNS_MAX_RDFLEN); - b64 = LDNS_XMALLOC(char, LDNS_MAX_RDFLEN); - if (!new || !owner || !ttl || !clas || !rdata || !rr_buf || !rd_buf || !rd || !b64 ) { - status = LDNS_STATUS_MEM_ERR; - LDNS_FREE(rr_buf); - goto ldnserror; + xtok = LDNS_XMALLOC(char, LDNS_MAX_RDFLEN); + if (rr_buf) { + rr_buf->_data = NULL; + } + if (rd_buf) { + rd_buf->_data = NULL; + } + if (!new || !owner || !ttl || !clas || !rdata || + !rr_buf || !rd_buf || !rd || !xtok) { + + goto memerror; } ldns_buffer_new_frm_data(rr_buf, (char*)str, strlen(str)); /* split the rr in its parts -1 signals trouble */ - if (ldns_bget_token(rr_buf, owner, "\t\n ", LDNS_MAX_DOMAINLEN) == -1) { + if (ldns_bget_token(rr_buf, owner, "\t\n ", LDNS_MAX_DOMAINLEN) == -1){ + status = LDNS_STATUS_SYNTAX_ERR; - ldns_buffer_free(rr_buf); - goto ldnserror; + goto error; } if (ldns_bget_token(rr_buf, ttl, "\t\n ", LDNS_TTL_DATALEN) == -1) { + status = LDNS_STATUS_SYNTAX_TTL_ERR; - ldns_buffer_free(rr_buf); - goto ldnserror; + goto error; } ttl_val = (uint32_t) ldns_str2period(ttl, &endptr); @@ -189,18 +209,17 @@ ldns_rr_new_frm_str_internal(ldns_rr **newrr, const char *str, if (clas_val == 0) { clas_val = LDNS_RR_CLASS_IN; type = LDNS_XMALLOC(char, strlen(ttl) + 1); - if(!type) { - status = LDNS_STATUS_MEM_ERR; - ldns_buffer_free(rr_buf); - goto ldnserror; + if (!type) { + goto memerror; } strncpy(type, ttl, strlen(ttl) + 1); } } else { - if (ldns_bget_token(rr_buf, clas, "\t\n ", LDNS_SYNTAX_DATALEN) == -1) { + if (-1 == ldns_bget_token( + rr_buf, clas, "\t\n ", LDNS_SYNTAX_DATALEN)) { + status = LDNS_STATUS_SYNTAX_CLASS_ERR; - ldns_buffer_free(rr_buf); - goto ldnserror; + goto error; } clas_val = ldns_get_rr_class_by_name(clas); /* class can be left out too, assume IN, current @@ -209,10 +228,8 @@ ldns_rr_new_frm_str_internal(ldns_rr **newrr, const char *str, if (clas_val == 0) { clas_val = LDNS_RR_CLASS_IN; type = LDNS_XMALLOC(char, strlen(clas) + 1); - if(!type) { - status = LDNS_STATUS_MEM_ERR; - ldns_buffer_free(rr_buf); - goto ldnserror; + if (!type) { + goto memerror; } strncpy(type, clas, strlen(clas) + 1); } @@ -221,24 +238,22 @@ ldns_rr_new_frm_str_internal(ldns_rr **newrr, const char *str, if (!type) { type = LDNS_XMALLOC(char, LDNS_SYNTAX_DATALEN); - if(!type) { - status = LDNS_STATUS_MEM_ERR; - ldns_buffer_free(rr_buf); - goto ldnserror; + if (!type) { + goto memerror; } - if (ldns_bget_token(rr_buf, type, "\t\n ", LDNS_SYNTAX_DATALEN) == -1) { + if (-1 == ldns_bget_token( + rr_buf, type, "\t\n ", LDNS_SYNTAX_DATALEN)) { + status = LDNS_STATUS_SYNTAX_TYPE_ERR; - ldns_buffer_free(rr_buf); - goto ldnserror; + goto error; } } if (ldns_bget_token(rr_buf, rdata, "\0", LDNS_MAX_PACKETLEN) == -1) { /* apparently we are done, and it's only a question RR * so do not set status and go to ldnserror here - */ + */ } - ldns_buffer_new_frm_data(rd_buf, rdata, strlen(rdata)); if (strlen(owner) <= 1 && strncmp(owner, "@", 1) == 0) { @@ -256,9 +271,7 @@ ldns_rr_new_frm_str_internal(ldns_rr **newrr, const char *str, ldns_rdf_deep_free(*prev); *prev = ldns_rdf_clone(ldns_rr_owner(new)); if (!*prev) { - status = LDNS_STATUS_MEM_ERR; - ldns_buffer_free(rr_buf); - goto ldnserror; + goto memerror; } } } else { @@ -270,57 +283,49 @@ ldns_rr_new_frm_str_internal(ldns_rr **newrr, const char *str, } else if (origin) { ldns_rr_set_owner(new, ldns_rdf_clone(origin)); } else { - ldns_rr_set_owner(new, ldns_dname_new_frm_str(".")); + ldns_rr_set_owner(new, + ldns_dname_new_frm_str(".")); } if(!ldns_rr_owner(new)) { - status = LDNS_STATUS_MEM_ERR; - ldns_buffer_free(rr_buf); - goto ldnserror; + goto memerror; } } else { owner_dname = ldns_dname_new_frm_str(owner); if (!owner_dname) { status = LDNS_STATUS_SYNTAX_ERR; - ldns_buffer_free(rr_buf); - goto ldnserror; + goto error; } ldns_rr_set_owner(new, owner_dname); if (!ldns_dname_str_absolute(owner) && origin) { - if(ldns_dname_cat(ldns_rr_owner(new), - origin) != LDNS_STATUS_OK) { + if(ldns_dname_cat(ldns_rr_owner(new), origin) + != LDNS_STATUS_OK) { + status = LDNS_STATUS_SYNTAX_ERR; - ldns_buffer_free(rr_buf); - goto ldnserror; + goto error; } } if (prev) { ldns_rdf_deep_free(*prev); *prev = ldns_rdf_clone(ldns_rr_owner(new)); - if(!*prev) { - status = LDNS_STATUS_MEM_ERR; - ldns_buffer_free(rr_buf); - goto ldnserror; + if (!*prev) { + goto error; } } } } LDNS_FREE(owner); - owner = NULL; ldns_rr_set_question(new, question); ldns_rr_set_ttl(new, ttl_val); LDNS_FREE(ttl); - ttl = NULL; ldns_rr_set_class(new, clas_val); LDNS_FREE(clas); - clas = NULL; rr_type = ldns_get_rr_type_by_name(type); LDNS_FREE(type); - type = NULL; desc = ldns_rr_descript((uint16_t)rr_type); ldns_rr_set_type(new, rr_type); @@ -333,268 +338,275 @@ ldns_rr_new_frm_str_internal(ldns_rr **newrr, const char *str, r_max = 1; } - /* depending on the rr_type we need to extract - * the rdata differently, e.g. NSEC/NSEC3 */ - switch(rr_type) { - default: - done = false; + for (done = false, r_cnt = 0; !done && r_cnt < r_max; r_cnt++) { + quoted = false; - for (r_cnt = 0; !done && r_cnt < r_max; r_cnt++) { - quoted = false; - /* if type = B64, the field may contain spaces */ - if (ldns_rr_descriptor_field_type(desc, - r_cnt) == LDNS_RDF_TYPE_B64 || - ldns_rr_descriptor_field_type(desc, - r_cnt) == LDNS_RDF_TYPE_HEX || - ldns_rr_descriptor_field_type(desc, - r_cnt) == LDNS_RDF_TYPE_LOC || - ldns_rr_descriptor_field_type(desc, - r_cnt) == LDNS_RDF_TYPE_WKS || - ldns_rr_descriptor_field_type(desc, - r_cnt) == LDNS_RDF_TYPE_IPSECKEY || - ldns_rr_descriptor_field_type(desc, - r_cnt) == LDNS_RDF_TYPE_NSEC) { - delimiters = "\n\t"; - } else { - delimiters = "\n\t "; - } + switch (ldns_rr_descriptor_field_type(desc, r_cnt)) { + case LDNS_RDF_TYPE_B64 : + case LDNS_RDF_TYPE_HEX : /* These rdf types may con- */ + case LDNS_RDF_TYPE_LOC : /* tain whitespace, only if */ + case LDNS_RDF_TYPE_WKS : /* it is the last rd field. */ + case LDNS_RDF_TYPE_IPSECKEY : + case LDNS_RDF_TYPE_NSEC : if (r_cnt == r_max - 1) { + delimiters = "\n\t"; + break; + } + default : delimiters = "\n\t "; + } - if (ldns_rr_descriptor_field_type(desc, - r_cnt) == LDNS_RDF_TYPE_STR && - ldns_buffer_remaining(rd_buf) > 0) { - /* skip spaces */ - while (*(ldns_buffer_current(rd_buf)) == ' ') { - ldns_buffer_skip(rd_buf, 1); - } + if (ldns_rdf_type_maybe_quoted( + ldns_rr_descriptor_field_type( + desc, r_cnt)) && + ldns_buffer_remaining(rd_buf) > 0){ - if (*(ldns_buffer_current(rd_buf)) == '\"') { - delimiters = "\"\0"; - ldns_buffer_skip(rd_buf, 1); - quoted = true; - } - } + /* skip spaces */ + while (*(ldns_buffer_current(rd_buf)) == ' ') { + ldns_buffer_skip(rd_buf, 1); + } - /* because number of fields can be variable, we can't - rely on _maximum() only */ - /* skip spaces */ - while (ldns_buffer_position(rd_buf) < ldns_buffer_limit(rd_buf) && - *(ldns_buffer_current(rd_buf)) == ' ' && !quoted - ) { - ldns_buffer_skip(rd_buf, 1); - } + if (*(ldns_buffer_current(rd_buf)) == '\"') { + delimiters = "\"\0"; + ldns_buffer_skip(rd_buf, 1); + quoted = true; + } + } - pre_data_pos = ldns_buffer_position(rd_buf); - if ((c = ldns_bget_token(rd_buf, rd, delimiters, - LDNS_MAX_RDFLEN)) != -1) { - /* hmmz, rfc3597 specifies that any type can be represented with - * \# method, which can contain spaces... - * it does specify size though... - */ + /* because number of fields can be variable, we can't rely on + * _maximum() only + */ + + /* skip spaces */ + while (ldns_buffer_position(rd_buf) < ldns_buffer_limit(rd_buf) + && *(ldns_buffer_current(rd_buf)) == ' ' + && !quoted) { + + ldns_buffer_skip(rd_buf, 1); + } + + pre_data_pos = ldns_buffer_position(rd_buf); + if (-1 == (c = ldns_bget_token( + rd_buf, rd, delimiters, LDNS_MAX_RDFLEN))) { + + done = true; + break; + } + /* hmmz, rfc3597 specifies that any type can be represented + * with \# method, which can contain spaces... + * it does specify size though... + */ + rd_strlen = strlen(rd); + + /* unknown RR data */ + if (strncmp(rd, "\\#", 2) == 0 && !quoted && + (rd_strlen == 2 || rd[2]==' ')) { + + was_unknown_rr_format = 1; + /* go back to before \# + * and skip it while setting delimiters better + */ + ldns_buffer_set_position(rd_buf, pre_data_pos); + delimiters = "\n\t "; + (void)ldns_bget_token(rd_buf, rd, + delimiters, LDNS_MAX_RDFLEN); + /* read rdata octet length */ + c = ldns_bget_token(rd_buf, rd, + delimiters, LDNS_MAX_RDFLEN); + if (c == -1) { + /* something goes very wrong here */ + status = LDNS_STATUS_SYNTAX_RDATA_ERR; + goto error; + } + hex_data_size = (uint16_t) atoi(rd); + /* copy hex chars into hex str (2 chars per byte) */ + hex_data_str = LDNS_XMALLOC(char, 2*hex_data_size + 1); + if (!hex_data_str) { + /* malloc error */ + goto memerror; + } + cur_hex_data_size = 0; + while(cur_hex_data_size < 2 * hex_data_size) { + c = ldns_bget_token(rd_buf, rd, + delimiters, LDNS_MAX_RDFLEN); + if (c != -1) { rd_strlen = strlen(rd); + } + if (c == -1 || + (size_t)cur_hex_data_size + rd_strlen > + 2 * (size_t)hex_data_size) { - /* unknown RR data */ - if (strncmp(rd, "\\#", 2) == 0 && !quoted && (rd_strlen == 2 || rd[2]==' ')) { - uint16_t hex_data_size; - char *hex_data_str; - uint16_t cur_hex_data_size; + status = LDNS_STATUS_SYNTAX_RDATA_ERR; + goto error; + } + strncpy(hex_data_str + cur_hex_data_size, rd, + rd_strlen); - was_unknown_rr_format = 1; - /* go back to before \# and skip it while setting delimiters better */ - ldns_buffer_set_position(rd_buf, pre_data_pos); - delimiters = "\n\t "; - (void)ldns_bget_token(rd_buf, rd, delimiters, LDNS_MAX_RDFLEN); - /* read rdata octet length */ - c = ldns_bget_token(rd_buf, rd, delimiters, LDNS_MAX_RDFLEN); - if (c == -1) { - /* something goes very wrong here */ - LDNS_FREE(rd); - LDNS_FREE(b64); - ldns_buffer_free(rd_buf); - ldns_buffer_free(rr_buf); - LDNS_FREE(rdata); - ldns_rr_free(new); - return LDNS_STATUS_SYNTAX_RDATA_ERR; - } - hex_data_size = (uint16_t) atoi(rd); - /* copy the hex chars into hex str (which is 2 chars per byte) */ - hex_data_str = LDNS_XMALLOC(char, 2 * hex_data_size + 1); - if (!hex_data_str) { - /* malloc error */ - LDNS_FREE(rd); - LDNS_FREE(b64); - ldns_buffer_free(rd_buf); - ldns_buffer_free(rr_buf); - LDNS_FREE(rdata); - ldns_rr_free(new); - return LDNS_STATUS_SYNTAX_RDATA_ERR; - } - cur_hex_data_size = 0; - while(cur_hex_data_size < 2 * hex_data_size) { - c = ldns_bget_token(rd_buf, rd, delimiters, LDNS_MAX_RDFLEN); - if (c != -1) { - rd_strlen = strlen(rd); - } - if (c == -1 || (size_t)cur_hex_data_size + rd_strlen > 2 * (size_t)hex_data_size) { - LDNS_FREE(hex_data_str); - LDNS_FREE(rd); - LDNS_FREE(b64); - ldns_buffer_free(rd_buf); - ldns_buffer_free(rr_buf); - LDNS_FREE(rdata); - ldns_rr_free(new); - return LDNS_STATUS_SYNTAX_RDATA_ERR; - } - strncpy(hex_data_str + cur_hex_data_size, rd, rd_strlen); - cur_hex_data_size += rd_strlen; - } - hex_data_str[cur_hex_data_size] = '\0'; + cur_hex_data_size += rd_strlen; + } + hex_data_str[cur_hex_data_size] = '\0'; - /* correct the rdf type */ - /* if *we* know the type, interpret it as wireformat */ - if (desc) { - size_t hex_pos = 0; - uint8_t *hex_data = LDNS_XMALLOC(uint8_t, hex_data_size + 2); - ldns_status s; - if(!hex_data) { - LDNS_FREE(hex_data_str); - LDNS_FREE(rd); - LDNS_FREE(b64); - ldns_buffer_free(rd_buf); - ldns_buffer_free(rr_buf); - LDNS_FREE(rdata); - ldns_rr_free(new); - return LDNS_STATUS_MEM_ERR; - } - ldns_write_uint16(hex_data, hex_data_size); - ldns_hexstring_to_data(hex_data + 2, hex_data_str); - s = ldns_wire2rdf(new, hex_data, - hex_data_size+2, &hex_pos); - if(s != LDNS_STATUS_OK) { - LDNS_FREE(hex_data_str); - LDNS_FREE(rd); - LDNS_FREE(b64); - ldns_buffer_free(rd_buf); - ldns_buffer_free(rr_buf); - LDNS_FREE(rdata); - ldns_rr_free(new); - LDNS_FREE(hex_data); - return s; - } - LDNS_FREE(hex_data); - } else { - r = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_HEX, hex_data_str); - if(!r) { - LDNS_FREE(hex_data_str); - LDNS_FREE(rd); - LDNS_FREE(b64); - ldns_buffer_free(rd_buf); - ldns_buffer_free(rr_buf); - LDNS_FREE(rdata); - ldns_rr_free(new); - return LDNS_STATUS_MEM_ERR; - } - ldns_rdf_set_type(r, LDNS_RDF_TYPE_UNKNOWN); - if(!ldns_rr_push_rdf(new, r)) { - LDNS_FREE(hex_data_str); - LDNS_FREE(rd); - LDNS_FREE(b64); - ldns_buffer_free(rd_buf); - ldns_buffer_free(rr_buf); - LDNS_FREE(rdata); - ldns_rr_free(new); - return LDNS_STATUS_MEM_ERR; - } - } - LDNS_FREE(hex_data_str); - } else { - /* Normal RR */ - switch(ldns_rr_descriptor_field_type(desc, r_cnt)) { - case LDNS_RDF_TYPE_HEX: - case LDNS_RDF_TYPE_B64: - /* can have spaces, and will always be the last - * record of the rrdata. Read in the rest */ - if ((c = ldns_bget_token(rd_buf, - b64, - "\n", - LDNS_MAX_RDFLEN)) - != -1) { - rd = strncat(rd, - b64, - LDNS_MAX_RDFLEN - - strlen(rd) - 1); - } - r = ldns_rdf_new_frm_str( - ldns_rr_descriptor_field_type(desc, r_cnt), - rd); - break; - case LDNS_RDF_TYPE_DNAME: - r = ldns_rdf_new_frm_str( - ldns_rr_descriptor_field_type(desc, r_cnt), - rd); + /* correct the rdf type */ + /* if *we* know the type, interpret it as wireformat */ + if (desc) { + hex_pos = 0; + hex_data = + LDNS_XMALLOC(uint8_t, hex_data_size+2); - /* check if the origin should be used or concatenated */ - if (r && ldns_rdf_size(r) > 1 && ldns_rdf_data(r)[0] == 1 - && ldns_rdf_data(r)[1] == '@') { - ldns_rdf_deep_free(r); - if (origin) { - r = ldns_rdf_clone(origin); - } else { - /* if this is the SOA, use its own owner name */ - if (rr_type == LDNS_RR_TYPE_SOA) { - r = ldns_rdf_clone(ldns_rr_owner(new)); - } else { - r = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, "."); - } - } - } else if (r && rd_strlen >= 1 && !ldns_dname_str_absolute(rd) && origin) { - if (ldns_dname_cat(r, origin) != LDNS_STATUS_OK) { - LDNS_FREE(rd); - LDNS_FREE(b64); - ldns_buffer_free(rd_buf); - ldns_buffer_free(rr_buf); - LDNS_FREE(rdata); - ldns_rr_free(new); - return LDNS_STATUS_ERR; - } - } - break; - default: - r = ldns_rdf_new_frm_str( - ldns_rr_descriptor_field_type(desc, r_cnt), - rd); - break; - } - if (r) { - ldns_rr_push_rdf(new, r); - } else { - LDNS_FREE(rd); - LDNS_FREE(b64); - ldns_buffer_free(rd_buf); - ldns_buffer_free(rr_buf); - LDNS_FREE(rdata); - ldns_rr_free(new); - return LDNS_STATUS_SYNTAX_RDATA_ERR; - } - } - if (quoted) { - if (ldns_buffer_available(rd_buf, 1)) { - ldns_buffer_skip(rd_buf, 1); - } else { - done = true; - } - } - } else { - done = true; + if (!hex_data) { + goto memerror; + } + ldns_write_uint16(hex_data, hex_data_size); + ldns_hexstring_to_data( + hex_data + 2, hex_data_str); + status = ldns_wire2rdf(new, hex_data, + hex_data_size + 2, &hex_pos); + if (status != LDNS_STATUS_OK) { + goto error; + } + LDNS_FREE(hex_data); + } else { + r = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_HEX, + hex_data_str); + if (!r) { + goto memerror; + } + ldns_rdf_set_type(r, LDNS_RDF_TYPE_UNKNOWN); + if (!ldns_rr_push_rdf(new, r)) { + goto memerror; } } - } + LDNS_FREE(hex_data_str); + + } else { + /* Normal RR */ + switch(ldns_rr_descriptor_field_type(desc, r_cnt)) { + + case LDNS_RDF_TYPE_HEX: + case LDNS_RDF_TYPE_B64: + /* When this is the last rdata field, then the + * rest should be read in (cause then these + * rdf types may contain spaces). + */ + if (r_cnt == r_max - 1) { + c = ldns_bget_token(rd_buf, xtok, + "\n", LDNS_MAX_RDFLEN); + if (c != -1) { + (void) strncat(rd, xtok, + LDNS_MAX_RDFLEN - + strlen(rd) - 1); + } + } + r = ldns_rdf_new_frm_str( + ldns_rr_descriptor_field_type( + desc, r_cnt), rd); + break; + + case LDNS_RDF_TYPE_HIP: + /* + * In presentation format this RDATA type has + * three tokens: An algorithm byte, then a + * variable length HIT (in hexbytes) and then + * a variable length Public Key (in base64). + * + * We have just read the algorithm, so we need + * two more tokens: HIT and Public Key. + */ + do { + /* Read and append HIT */ + if (ldns_bget_token(rd_buf, + xtok, delimiters, + LDNS_MAX_RDFLEN) == -1) + break; + + (void) strncat(rd, " ", + LDNS_MAX_RDFLEN - + strlen(rd) - 1); + (void) strncat(rd, xtok, + LDNS_MAX_RDFLEN - + strlen(rd) - 1); + + /* Read and append Public Key*/ + if (ldns_bget_token(rd_buf, + xtok, delimiters, + LDNS_MAX_RDFLEN) == -1) + break; + + (void) strncat(rd, " ", + LDNS_MAX_RDFLEN - + strlen(rd) - 1); + (void) strncat(rd, xtok, + LDNS_MAX_RDFLEN - + strlen(rd) - 1); + } while (false); + + r = ldns_rdf_new_frm_str( + ldns_rr_descriptor_field_type( + desc, r_cnt), rd); + break; + + case LDNS_RDF_TYPE_DNAME: + r = ldns_rdf_new_frm_str( + ldns_rr_descriptor_field_type( + desc, r_cnt), rd); + + /* check if the origin should be used + * or concatenated + */ + if (r && ldns_rdf_size(r) > 1 && + ldns_rdf_data(r)[0] == 1 && + ldns_rdf_data(r)[1] == '@') { + + ldns_rdf_deep_free(r); + + r = origin ? ldns_rdf_clone(origin) + + : ( rr_type == LDNS_RR_TYPE_SOA ? + + ldns_rdf_clone( + ldns_rr_owner(new)) + + : ldns_rdf_new_frm_str( + LDNS_RDF_TYPE_DNAME, ".") + ); + + } else if (r && rd_strlen >= 1 && origin && + !ldns_dname_str_absolute(rd)) { + + status = ldns_dname_cat(r, origin); + if (status != LDNS_STATUS_OK) { + goto error; + } + } + break; + default: + r = ldns_rdf_new_frm_str( + ldns_rr_descriptor_field_type( + desc, r_cnt), rd); + break; + } + if (!r) { + status = LDNS_STATUS_SYNTAX_RDATA_ERR; + goto error; + } + ldns_rr_push_rdf(new, r); + } + if (quoted) { + if (ldns_buffer_available(rd_buf, 1)) { + ldns_buffer_skip(rd_buf, 1); + } else { + done = true; + } + } + + } /* for (done = false, r_cnt = 0; !done && r_cnt < r_max; r_cnt++) */ LDNS_FREE(rd); - LDNS_FREE(b64); + LDNS_FREE(xtok); ldns_buffer_free(rd_buf); ldns_buffer_free(rr_buf); LDNS_FREE(rdata); - if (!question && desc && !was_unknown_rr_format && ldns_rr_rd_count(new) < r_min) { + if (!question && desc && !was_unknown_rr_format && + ldns_rr_rd_count(new) < r_min) { + ldns_rr_free(new); return LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR; } @@ -607,17 +619,30 @@ ldns_rr_new_frm_str_internal(ldns_rr **newrr, const char *str, } return LDNS_STATUS_OK; -ldnserror: +memerror: + status = LDNS_STATUS_MEM_ERR; +error: + if (rd_buf && rd_buf->_data) { + ldns_buffer_free(rd_buf); + } else { + LDNS_FREE(rd_buf); + } + if (rr_buf && rr_buf->_data) { + ldns_buffer_free(rr_buf); + } else { + LDNS_FREE(rr_buf); + } LDNS_FREE(type); LDNS_FREE(owner); LDNS_FREE(ttl); LDNS_FREE(clas); - LDNS_FREE(rdata); + LDNS_FREE(hex_data); + LDNS_FREE(hex_data_str); + LDNS_FREE(xtok); LDNS_FREE(rd); - LDNS_FREE(rd_buf); - LDNS_FREE(b64); + LDNS_FREE(rdata); ldns_rr_free(new); - return status; + return status; } ldns_status @@ -1845,9 +1870,7 @@ static const ldns_rdf_type type_px_wireformat[] = { LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME }; static const ldns_rdf_type type_gpos_wireformat[] = { - LDNS_RDF_TYPE_STR, - LDNS_RDF_TYPE_STR, - LDNS_RDF_TYPE_STR + LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR }; static const ldns_rdf_type type_aaaa_wireformat[] = { LDNS_RDF_TYPE_AAAA }; static const ldns_rdf_type type_loc_wireformat[] = { LDNS_RDF_TYPE_LOC }; @@ -1925,6 +1948,15 @@ static const ldns_rdf_type type_dnskey_wireformat[] = { LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_B64 }; +static const ldns_rdf_type type_tkey_wireformat[] = { + LDNS_RDF_TYPE_DNAME, + LDNS_RDF_TYPE_TIME, + LDNS_RDF_TYPE_TIME, + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_INT16_DATA, + LDNS_RDF_TYPE_INT16_DATA, +}; static const ldns_rdf_type type_tsig_wireformat[] = { LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_TSIGTIME, @@ -1940,6 +1972,43 @@ static const ldns_rdf_type type_tlsa_wireformat[] = { LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_HEX }; +static const ldns_rdf_type type_hip_wireformat[] = { + LDNS_RDF_TYPE_HIP +}; +static const ldns_rdf_type type_nid_wireformat[] = { + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_ILNP64 +}; +static const ldns_rdf_type type_l32_wireformat[] = { + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_A +}; +static const ldns_rdf_type type_l64_wireformat[] = { + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_ILNP64 +}; +static const ldns_rdf_type type_lp_wireformat[] = { + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_DNAME +}; +static const ldns_rdf_type type_eui48_wireformat[] = { + LDNS_RDF_TYPE_EUI48 +}; +static const ldns_rdf_type type_eui64_wireformat[] = { + LDNS_RDF_TYPE_EUI64 +}; +#ifdef RRTYPE_URI +static const ldns_rdf_type type_uri_wireformat[] = { + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_LONG_STR +}; +#endif +static const ldns_rdf_type type_caa_wireformat[] = { + LDNS_RDF_TYPE_INT8, + LDNS_RDF_TYPE_TAG, + LDNS_RDF_TYPE_LONG_STR +}; /** \endcond */ /** \cond */ @@ -2003,7 +2072,7 @@ static ldns_rr_descriptor rdata_field_descriptors[] = { /* 26 */ {LDNS_RR_TYPE_PX, "PX", 3, 3, type_px_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 2 }, /* 27 */ - {LDNS_RR_TYPE_GPOS, "GPOS", 1, 1, type_gpos_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + {LDNS_RR_TYPE_GPOS, "GPOS", 3, 3, type_gpos_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, /* 28 */ {LDNS_RR_TYPE_AAAA, "AAAA", 1, 1, type_aaaa_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, /* 29 */ @@ -2043,7 +2112,7 @@ static ldns_rr_descriptor rdata_field_descriptors[] = { /* 46 */ {LDNS_RR_TYPE_RRSIG, "RRSIG", 9, 9, type_rrsig_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, /* 47 */ - {LDNS_RR_TYPE_NSEC, "NSEC", 1, 2, type_nsec_wireformat, LDNS_RDF_TYPE_NSEC, LDNS_RR_NO_COMPRESS, 1 }, + {LDNS_RR_TYPE_NSEC, "NSEC", 1, 2, type_nsec_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, /* 48 */ {LDNS_RR_TYPE_DNSKEY, "DNSKEY", 4, 4, type_dnskey_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, /* 49 */ @@ -2057,12 +2126,36 @@ static ldns_rr_descriptor rdata_field_descriptors[] = { {LDNS_RR_TYPE_NULL, "TYPE53", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, {LDNS_RR_TYPE_NULL, "TYPE54", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE55", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + + /* 55 + * Hip ends with 0 or more Rendezvous Servers represented as dname's. + * Hence the LDNS_RDF_TYPE_DNAME _variable field and the _maximum field + * set to 0. + */ + {LDNS_RR_TYPE_HIP, "HIP", 1, 1, type_hip_wireformat, LDNS_RDF_TYPE_DNAME, LDNS_RR_NO_COMPRESS, 0 }, + +#ifdef RRTYPE_NINFO + /* 56 */ + {LDNS_RR_TYPE_NINFO, "NINFO", 1, 0, NULL, LDNS_RDF_TYPE_STR, LDNS_RR_NO_COMPRESS, 0 }, +#else {LDNS_RR_TYPE_NULL, "TYPE56", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +#endif +#ifdef RRTYPE_RKEY + /* 57 */ + {LDNS_RR_TYPE_RKEY, "RKEY", 4, 4, type_key_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +#else {LDNS_RR_TYPE_NULL, "TYPE57", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +#endif /* 58 */ -{LDNS_RR_TYPE_TALINK, "TALINK", 2, 2, type_talink_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 2 }, + {LDNS_RR_TYPE_TALINK, "TALINK", 2, 2, type_talink_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 2 }, + +#ifdef RRTYPE_CDS + /* 59 */ + {LDNS_RR_TYPE_CDS, "CDS", 4, 4, type_ds_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +#else {LDNS_RR_TYPE_NULL, "TYPE59", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +#endif + {LDNS_RR_TYPE_NULL, "TYPE60", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, {LDNS_RR_TYPE_NULL, "TYPE61", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, {LDNS_RR_TYPE_NULL, "TYPE62", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, @@ -2102,17 +2195,32 @@ static ldns_rr_descriptor rdata_field_descriptors[] = { {LDNS_RR_TYPE_NULL, "TYPE96", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, {LDNS_RR_TYPE_NULL, "TYPE97", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, {LDNS_RR_TYPE_NULL, "TYPE98", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_SPF, "SPF", 1, 0, NULL, LDNS_RDF_TYPE_STR, LDNS_RR_NO_COMPRESS, 0 }, + + /* 99 */ + {LDNS_RR_TYPE_SPF, "SPF", 1, 0, NULL, LDNS_RDF_TYPE_STR, LDNS_RR_NO_COMPRESS, 0 }, + + /* UINFO [IANA-Reserved] */ {LDNS_RR_TYPE_NULL, "TYPE100", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* UID [IANA-Reserved] */ {LDNS_RR_TYPE_NULL, "TYPE101", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* GID [IANA-Reserved] */ {LDNS_RR_TYPE_NULL, "TYPE102", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* UNSPEC [IANA-Reserved] */ {LDNS_RR_TYPE_NULL, "TYPE103", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE104", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE105", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE106", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE107", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE108", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE109", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + + /* 104 */ + {LDNS_RR_TYPE_NID, "NID", 2, 2, type_nid_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 105 */ + {LDNS_RR_TYPE_L32, "L32", 2, 2, type_l32_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 106 */ + {LDNS_RR_TYPE_L64, "L64", 2, 2, type_l64_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 107 */ + {LDNS_RR_TYPE_LP, "LP", 2, 2, type_lp_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 108 */ + {LDNS_RR_TYPE_EUI48, "EUI48", 1, 1, type_eui48_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 109 */ + {LDNS_RR_TYPE_EUI64, "EUI64", 1, 1, type_eui64_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + {LDNS_RR_TYPE_NULL, "TYPE110", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, {LDNS_RR_TYPE_NULL, "TYPE111", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, {LDNS_RR_TYPE_NULL, "TYPE112", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, @@ -2252,14 +2360,48 @@ static ldns_rr_descriptor rdata_field_descriptors[] = { {LDNS_RR_TYPE_NULL, "TYPE246", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, {LDNS_RR_TYPE_NULL, "TYPE247", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, {LDNS_RR_TYPE_NULL, "TYPE248", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE249", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -/* LDNS_RDF_TYPE_INT16_DATA essentially takes two fields (length and data) and - * makes them into one. So, while in rfc 2845 is specified that a TSIG may have - * 8 or 9 rdata fields, by this implementation, the min/max are 7 each. - */ -{LDNS_RR_TYPE_TSIG, "TSIG", 7, 7, type_tsig_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + + /* LDNS_RDF_TYPE_INT16_DATA takes two fields (length and data) as one. + * So, unlike RFC 2930 spec, we have 7 min/max rdf's i.s.o. 8/9. + */ + /* 249 */ + {LDNS_RR_TYPE_TKEY, "TKEY", 7, 7, type_tkey_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* LDNS_RDF_TYPE_INT16_DATA takes two fields (length and data) as one. + * So, unlike RFC 2930 spec, we have 7 min/max rdf's i.s.o. 8/9. + */ + /* 250 */ + {LDNS_RR_TYPE_TSIG, "TSIG", 7, 7, type_tsig_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + + /* IXFR: A request for a transfer of an incremental zone transfer */ +{LDNS_RR_TYPE_NULL, "TYPE251", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* AXFR: A request for a transfer of an entire zone */ +{LDNS_RR_TYPE_NULL, "TYPE252", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* MAILB: A request for mailbox-related records (MB, MG or MR) */ +{LDNS_RR_TYPE_NULL, "TYPE253", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* MAILA: A request for mail agent RRs (Obsolete - see MX) */ +{LDNS_RR_TYPE_NULL, "TYPE254", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* ANY: A request for all (available) records */ +{LDNS_RR_TYPE_NULL, "TYPE255", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + +#ifdef RRTYPE_URI + /* 256 */ + {LDNS_RR_TYPE_URI, "URI", 3, 3, type_uri_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +#else +{LDNS_RR_TYPE_NULL, "TYPE256", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +#endif + /* 257 */ + {LDNS_RR_TYPE_CAA, "CAA", 3, 3, type_caa_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* split in array, no longer contiguous */ -{LDNS_RR_TYPE_DLV, "DLV", 4, 4, type_ds_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 } + +#ifdef RRTYPE_TA + /* 32768 */ + {LDNS_RR_TYPE_TA, "TA", 4, 4, type_ds_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +#else +{LDNS_RR_TYPE_NULL, "TYPE32768", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +#endif + /* 32769 */ + {LDNS_RR_TYPE_DLV, "DLV", 4, 4, type_ds_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 } }; /** \endcond */ @@ -2270,11 +2412,130 @@ static ldns_rr_descriptor rdata_field_descriptors[] = { #define LDNS_RDATA_FIELD_DESCRIPTORS_COUNT \ (sizeof(rdata_field_descriptors)/sizeof(rdata_field_descriptors[0])) + +/*---------------------------------------------------------------------------* + * The functions below return an bitmap RDF with the space required to set + * or unset all known RR types. Arguably these functions are better situated + * in rdata.c, however for the space calculation it is necesarry to walk + * through rdata_field_descriptors which is not easily possible from anywhere + * other than rr.c where it is declared static. + * + * Alternatively rr.c could have provided an iterator for rr_type or + * rdf_descriptors, but this seemed overkill for internal use only. + */ +static ldns_rr_descriptor* rdata_field_descriptors_end = + &rdata_field_descriptors[LDNS_RDATA_FIELD_DESCRIPTORS_COUNT]; + +/* From RFC3845: + * + * 2.1.2. The List of Type Bit Map(s) Field + * + * The RR type space is split into 256 window blocks, each representing + * the low-order 8 bits of the 16-bit RR type space. Each block that + * has at least one active RR type is encoded using a single octet + * window number (from 0 to 255), a single octet bitmap length (from 1 + * to 32) indicating the number of octets used for the window block's + * bitmap, and up to 32 octets (256 bits) of bitmap. + * + * Window blocks are present in the NSEC RR RDATA in increasing + * numerical order. + * + * "|" denotes concatenation + * + * Type Bit Map(s) Field = ( Window Block # | Bitmap Length | Bitmap ) + + * + * + * + * Blocks with no types present MUST NOT be included. Trailing zero + * octets in the bitmap MUST be omitted. The length of each block's + * bitmap is determined by the type code with the largest numerical + * value within that block, among the set of RR types present at the + * NSEC RR's owner name. Trailing zero octets not specified MUST be + * interpreted as zero octets. + */ +static ldns_status +ldns_rdf_bitmap_known_rr_types_set(ldns_rdf** rdf, int value) +{ + uint8_t window; /* most significant octet of type */ + uint8_t subtype; /* least significant octet of type */ + uint16_t windows[256] /* Max subtype per window */ +#ifndef S_SPLINT_S + = { 0 } +#endif + ; + ldns_rr_descriptor* d; /* used to traverse rdata_field_descriptors */ + size_t i; /* used to traverse windows array */ + + size_t sz; /* size needed for type bitmap rdf */ + uint8_t* data = NULL; /* rdf data */ + uint8_t* dptr; /* used to itraverse rdf data */ + + assert(rdf != NULL); + + /* Which windows need to be in the bitmap rdf? + */ + for (d=rdata_field_descriptors; d < rdata_field_descriptors_end; d++) { + window = d->_type >> 8; + subtype = d->_type & 0xff; + if (windows[window] < subtype) { + windows[window] = subtype; + } + } + + /* How much space do we need in the rdf for those windows? + */ + sz = 0; + for (i = 0; i < 256; i++) { + if (windows[i]) { + sz += windows[i] / 8 + 3; + } + } + if (sz > 0) { + /* Format rdf data according RFC3845 Section 2.1.2 (see above) + */ + dptr = data = LDNS_XMALLOC(uint8_t, sz); + memset(data, value, sz); + if (!data) { + return LDNS_STATUS_MEM_ERR; + } + for (i = 0; i < 256; i++) { + if (windows[i]) { + *dptr++ = (uint8_t)i; + *dptr++ = (uint8_t)(windows[i] / 8 + 1); + dptr += dptr[-1]; + } + } + } + /* Allocate and return rdf structure for the data + */ + *rdf = ldns_rdf_new(LDNS_RDF_TYPE_BITMAP, sz, data); + if (!*rdf) { + LDNS_FREE(data); + return LDNS_STATUS_MEM_ERR; + } + return LDNS_STATUS_OK; +} + +ldns_status +ldns_rdf_bitmap_known_rr_types_space(ldns_rdf** rdf) +{ + return ldns_rdf_bitmap_known_rr_types_set(rdf, 0); +} + +ldns_status +ldns_rdf_bitmap_known_rr_types(ldns_rdf** rdf) +{ + return ldns_rdf_bitmap_known_rr_types_set(rdf, 255); +} +/* End of RDF bitmap functions + *---------------------------------------------------------------------------*/ + + const ldns_rr_descriptor * ldns_rr_descript(uint16_t type) { size_t i; - if (type <= LDNS_RDATA_FIELD_DESCRIPTORS_COMMON) { + if (type < LDNS_RDATA_FIELD_DESCRIPTORS_COMMON) { return &rdata_field_descriptors[type]; } else { /* because not all array index equals type code */ diff --git a/contrib/ldns/sha1.c b/contrib/ldns/sha1.c index 5dec680a1b7..18a4dd28f34 100644 --- a/contrib/ldns/sha1.c +++ b/contrib/ldns/sha1.c @@ -15,12 +15,12 @@ */ /* #define LITTLE_ENDIAN * This should be #define'd already, if true. */ -/* #define SHA1HANDSOFF * Copies data before messing with it. */ #include #include #include +#define SHA1HANDSOFF 1 /* Copies data before messing with it. */ #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) /* blk0() and blk() perform the initial expand. */ diff --git a/contrib/ldns/sha2.c b/contrib/ldns/sha2.c index 6ba4ab5cb1e..9a27122bfe1 100644 --- a/contrib/ldns/sha2.c +++ b/contrib/ldns/sha2.c @@ -546,9 +546,15 @@ void ldns_sha256_update(ldns_sha256_CTX* context, const sha2_byte *data, size_t usedspace = freespace = 0; } +typedef union _ldns_sha2_buffer_union { + uint8_t* theChars; + uint64_t* theLongs; +} ldns_sha2_buffer_union; + void ldns_sha256_final(sha2_byte digest[], ldns_sha256_CTX* context) { sha2_word32 *d = (sha2_word32*)digest; size_t usedspace; + ldns_sha2_buffer_union cast_var; /* Sanity check: */ assert(context != (ldns_sha256_CTX*)0); @@ -585,7 +591,8 @@ void ldns_sha256_final(sha2_byte digest[], ldns_sha256_CTX* context) { *context->buffer = 0x80; } /* Set the bit count: */ - *(sha2_word64*)&context->buffer[ldns_sha256_SHORT_BLOCK_LENGTH] = context->bitcount; + cast_var.theChars = context->buffer; + cast_var.theLongs[ldns_sha256_SHORT_BLOCK_LENGTH / 8] = context->bitcount; /* final transform: */ ldns_sha256_Transform(context, (sha2_word32*)context->buffer); @@ -850,6 +857,7 @@ void ldns_sha512_update(ldns_sha512_CTX* context, const sha2_byte *data, size_t static void ldns_sha512_Last(ldns_sha512_CTX* context) { size_t usedspace; + ldns_sha2_buffer_union cast_var; usedspace = (context->bitcount[0] >> 3) % LDNS_SHA512_BLOCK_LENGTH; #if BYTE_ORDER == LITTLE_ENDIAN @@ -882,8 +890,9 @@ static void ldns_sha512_Last(ldns_sha512_CTX* context) { *context->buffer = 0x80; } /* Store the length of input data (in bits): */ - *(sha2_word64*)&context->buffer[ldns_sha512_SHORT_BLOCK_LENGTH] = context->bitcount[1]; - *(sha2_word64*)&context->buffer[ldns_sha512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0]; + cast_var.theChars = context->buffer; + cast_var.theLongs[ldns_sha512_SHORT_BLOCK_LENGTH / 8] = context->bitcount[1]; + cast_var.theLongs[ldns_sha512_SHORT_BLOCK_LENGTH / 8 + 1] = context->bitcount[0]; /* final transform: */ ldns_sha512_Transform(context, (sha2_word64*)context->buffer); diff --git a/contrib/ldns/str2host.c b/contrib/ldns/str2host.c index 51357cc3176..26cef3d036e 100644 --- a/contrib/ldns/str2host.c +++ b/contrib/ldns/str2host.c @@ -257,33 +257,48 @@ ldns_str2rdf_int8(ldns_rdf **rd, const char *bytestr) * Returns the number of bytes read from the escaped string, or * 0 on error */ -static int -parse_escape(uint8_t *s, uint8_t *q) { +INLINE bool +parse_escape(uint8_t *ch_p, const char** str_p) +{ uint16_t val; - if (strlen((char *)s) > 3 && - isdigit((int) s[1]) && - isdigit((int) s[2]) && - isdigit((int) s[3])) { - /* cast this so it fits */ - val = (uint16_t) ldns_hexdigit_to_int((char) s[1]) * 100 + - ldns_hexdigit_to_int((char) s[2]) * 10 + - ldns_hexdigit_to_int((char) s[3]); + + if ((*str_p)[0] && isdigit((*str_p)[0]) && + (*str_p)[1] && isdigit((*str_p)[1]) && + (*str_p)[2] && isdigit((*str_p)[2])) { + + val = (uint16_t)(((*str_p)[0] - '0') * 100 + + ((*str_p)[1] - '0') * 10 + + ((*str_p)[2] - '0')); + if (val > 255) { - /* outside range */ - return 0; + goto error; } - *q = (uint8_t) val; - return 3; - } else { - s++; - if (*s == '\0' || isdigit((int) *s)) { - /* apparently the string terminator - * or a digit has been escaped... - */ - return 0; - } - *q = *s; - return 1; + *ch_p = (uint8_t)val; + *str_p += 3; + return true; + + } else if ((*str_p)[0] && !isdigit((*str_p)[0])) { + + *ch_p = (uint8_t)*(*str_p)++; + return true; + } +error: + *str_p = NULL; + return false; /* LDNS_STATUS_SYNTAX_BAD_ESCAPE */ +} + +INLINE bool +parse_char(uint8_t *ch_p, const char** str_p) +{ + switch (**str_p) { + + case '\0': return false; + + case '\\': *str_p += 1; + return parse_escape(ch_p, str_p); + + default: *ch_p = (uint8_t)*(*str_p)++; + return true; } } @@ -297,8 +312,8 @@ ldns_str2rdf_dname(ldns_rdf **d, const char *str) { size_t len; - int esc; - uint8_t *s, *q, *pq, label_len; + const char *s; + uint8_t *q, *pq, label_len; uint8_t buf[LDNS_MAX_DOMAINLEN + 1]; *d = NULL; @@ -328,7 +343,7 @@ ldns_str2rdf_dname(ldns_rdf **d, const char *str) q = buf+1; pq = buf; label_len = 0; - for (s = (uint8_t *)str; *s; s++, q++) { + for (s = str; *s; s++, q++) { if (q > buf + LDNS_MAX_DOMAINLEN) { return LDNS_STATUS_DOMAINNAME_OVERFLOW; } @@ -348,16 +363,15 @@ ldns_str2rdf_dname(ldns_rdf **d, const char *str) break; case '\\': /* octet value or literal char */ - esc = parse_escape(s, q); - if (esc > 0) { - s += esc; - label_len++; - } else { + s += 1; + if (! parse_escape(q, &s)) { return LDNS_STATUS_SYNTAX_BAD_ESCAPE; } + s -= 1; + label_len++; break; default: - *q = *s; + *q = (uint8_t)*s; label_len++; } } @@ -413,36 +427,44 @@ ldns_str2rdf_aaaa(ldns_rdf **rd, const char *str) ldns_status ldns_str2rdf_str(ldns_rdf **rd, const char *str) { - uint8_t *data; - size_t i, str_i, esc_i; + uint8_t *data, *dp, ch = 0; + size_t length; - if (strlen(str) > 255) { - return LDNS_STATUS_INVALID_STR; + /* Worst case space requirement. We'll realloc to actual size later. */ + dp = data = LDNS_XMALLOC(uint8_t, strlen(str) > 255 ? 256 : (strlen(str) + 1)); + if (! data) { + return LDNS_STATUS_MEM_ERR; } - data = LDNS_XMALLOC(uint8_t, strlen(str) + 1); - if(!data) return LDNS_STATUS_MEM_ERR; - i = 1; - - for (str_i = 0; str_i < strlen(str); str_i++) { - if (str[str_i] == '\\') { - /* octet value or literal char */ - esc_i = (size_t) parse_escape((uint8_t*) &str[str_i], (uint8_t*) &data[i]); - if (esc_i == 0) { - LDNS_FREE(data); - return LDNS_STATUS_SYNTAX_BAD_ESCAPE; - } - str_i += esc_i; - } else { - data[i] = (uint8_t) str[str_i]; + /* Fill data (up to 255 characters) */ + while (parse_char(&ch, &str)) { + if (dp - data >= 255) { + LDNS_FREE(data); + return LDNS_STATUS_INVALID_STR; } - i++; + *++dp = ch; } - data[0] = i - 1; - *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_STR, i, data); + if (! str) { + return LDNS_STATUS_SYNTAX_BAD_ESCAPE; + } + length = (size_t)(dp - data); + /* Fix last length byte */ + data[0] = (uint8_t)length; - LDNS_FREE(data); - return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; + /* Lose the overmeasure */ + data = LDNS_XREALLOC(dp = data, uint8_t, length + 1); + if (! data) { + LDNS_FREE(dp); + return LDNS_STATUS_MEM_ERR; + } + + /* Create rdf */ + *rd = ldns_rdf_new(LDNS_RDF_TYPE_STR, length + 1, data); + if (! *rd) { + LDNS_FREE(data); + return LDNS_STATUS_MEM_ERR; + } + return LDNS_STATUS_OK; } ldns_status @@ -790,15 +812,6 @@ ldns_str2rdf_unknown( ATTR_UNUSED(ldns_rdf **rd) return LDNS_STATUS_NOT_IMPL; } -ldns_status -ldns_str2rdf_tsig( ATTR_UNUSED(ldns_rdf **rd) - , ATTR_UNUSED(const char *str) - ) -{ - /* there is no string representation for TSIG rrs */ - return LDNS_STATUS_NOT_IMPL; -} - ldns_status ldns_str2rdf_service( ATTR_UNUSED(ldns_rdf **rd) , ATTR_UNUSED(const char *str) @@ -1317,3 +1330,240 @@ ldns_str2rdf_ipseckey(ldns_rdf **rd, const char *str) if(!*rd) return LDNS_STATUS_MEM_ERR; return LDNS_STATUS_OK; } + +ldns_status +ldns_str2rdf_ilnp64(ldns_rdf **rd, const char *str) +{ + unsigned int a, b, c, d; + uint16_t shorts[4]; + int l; + + if (sscanf(str, "%4x:%4x:%4x:%4x%n", &a, &b, &c, &d, &l) != 4 || + l != (int)strlen(str) || /* more data to read */ + strpbrk(str, "+-") /* signed hexes */ + ) { + return LDNS_STATUS_INVALID_ILNP64; + } else { + shorts[0] = htons(a); + shorts[1] = htons(b); + shorts[2] = htons(c); + shorts[3] = htons(d); + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_ILNP64, 4 * sizeof(uint16_t), &shorts); + } + return *rd ? LDNS_STATUS_OK : LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_eui48(ldns_rdf **rd, const char *str) +{ + unsigned int a, b, c, d, e, f; + uint8_t bytes[6]; + int l; + + if (sscanf(str, "%2x-%2x-%2x-%2x-%2x-%2x%n", + &a, &b, &c, &d, &e, &f, &l) != 6 || + l != (int)strlen(str) || /* more data to read */ + strpbrk(str, "+-") /* signed hexes */ + ) { + return LDNS_STATUS_INVALID_EUI48; + } else { + bytes[0] = a; + bytes[1] = b; + bytes[2] = c; + bytes[3] = d; + bytes[4] = e; + bytes[5] = f; + *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_EUI48, 6, &bytes); + } + return *rd ? LDNS_STATUS_OK : LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_eui64(ldns_rdf **rd, const char *str) +{ + unsigned int a, b, c, d, e, f, g, h; + uint8_t bytes[8]; + int l; + + if (sscanf(str, "%2x-%2x-%2x-%2x-%2x-%2x-%2x-%2x%n", + &a, &b, &c, &d, &e, &f, &g, &h, &l) != 8 || + l != (int)strlen(str) || /* more data to read */ + strpbrk(str, "+-") /* signed hexes */ + ) { + return LDNS_STATUS_INVALID_EUI64; + } else { + bytes[0] = a; + bytes[1] = b; + bytes[2] = c; + bytes[3] = d; + bytes[4] = e; + bytes[5] = f; + bytes[6] = g; + bytes[7] = h; + *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_EUI64, 8, &bytes); + } + return *rd ? LDNS_STATUS_OK : LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_tag(ldns_rdf **rd, const char *str) +{ + uint8_t *data; + const char* ptr; + + if (strlen(str) > 255) { + return LDNS_STATUS_INVALID_TAG; + } + for (ptr = str; *ptr; ptr++) { + if (! isalnum(*ptr)) { + return LDNS_STATUS_INVALID_TAG; + } + } + data = LDNS_XMALLOC(uint8_t, strlen(str) + 1); + if (!data) { + return LDNS_STATUS_MEM_ERR; + } + data[0] = strlen(str); + memcpy(data + 1, str, strlen(str)); + + *rd = ldns_rdf_new(LDNS_RDF_TYPE_TAG, strlen(str) + 1, data); + if (!*rd) { + LDNS_FREE(data); + return LDNS_STATUS_MEM_ERR; + } + return LDNS_STATUS_OK; +} + +ldns_status +ldns_str2rdf_long_str(ldns_rdf **rd, const char *str) +{ + uint8_t *data, *dp, ch = 0; + size_t length; + + /* Worst case space requirement. We'll realloc to actual size later. */ + dp = data = LDNS_XMALLOC(uint8_t, strlen(str)); + if (! data) { + return LDNS_STATUS_MEM_ERR; + } + + /* Fill data with parsed bytes */ + while (parse_char(&ch, &str)) { + *dp++ = ch; + if (dp - data > LDNS_MAX_RDFLEN) { + LDNS_FREE(data); + return LDNS_STATUS_INVALID_STR; + } + } + if (! str) { + return LDNS_STATUS_SYNTAX_BAD_ESCAPE; + } + length = (size_t)(dp - data); + + /* Lose the overmeasure */ + data = LDNS_XREALLOC(dp = data, uint8_t, length); + if (! data) { + LDNS_FREE(dp); + return LDNS_STATUS_MEM_ERR; + } + + /* Create rdf */ + *rd = ldns_rdf_new(LDNS_RDF_TYPE_LONG_STR, length, data); + if (! *rd) { + LDNS_FREE(data); + return LDNS_STATUS_MEM_ERR; + } + return LDNS_STATUS_OK; +} + +ldns_status +ldns_str2rdf_hip(ldns_rdf **rd, const char *str) +{ + const char *hit = strchr(str, ' ') + 1; + const char *pk = hit == NULL ? NULL : strchr(hit, ' ') + 1; + size_t hit_size = hit == NULL ? 0 + : pk == NULL ? strlen(hit) : (size_t) (pk - hit) - 1; + size_t pk_size = pk == NULL ? 0 : strlen(pk); + size_t hit_wire_size = (hit_size + 1) / 2; + size_t pk_wire_size = ldns_b64_pton_calculate_size(pk_size); + size_t rdf_size = 4 + hit_wire_size + pk_wire_size; + + char *endptr; /* utility var for strtol usage */ + int algorithm = strtol(str, &endptr, 10); + + uint8_t *data, *dp; + int hi, lo, written; + + if (hit_size == 0 || pk_size == 0 || (hit_size + 1) / 2 > 255 + || rdf_size > LDNS_MAX_RDFLEN + || algorithm < 0 || algorithm > 255 + || (errno != 0 && algorithm == 0) /* out of range */ + || endptr == str /* no digits */) { + + return LDNS_STATUS_SYNTAX_ERR; + } + if ((data = LDNS_XMALLOC(uint8_t, rdf_size)) == NULL) { + + return LDNS_STATUS_MEM_ERR; + } + /* From RFC 5205 section 5. HIP RR Storage Format: + ************************************************* + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | HIT length | PK algorithm | PK length | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | + ~ HIT ~ + | | + + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | | + +-+-+-+-+-+-+-+-+-+-+-+ + + | Public Key | + ~ ~ + | | + + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + + | | + ~ Rendezvous Servers ~ + | | + + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | + +-+-+-+-+-+-+-+ */ + + data[0] = (uint8_t) hit_wire_size; + data[1] = (uint8_t) algorithm; + + for (dp = data + 4; *hit && *hit != ' '; dp++) { + + if ((hi = ldns_hexdigit_to_int(*hit++)) == -1 || + (lo = ldns_hexdigit_to_int(*hit++)) == -1) { + + LDNS_FREE(data); + return LDNS_STATUS_INVALID_HEX; + } + *dp = (uint8_t) hi << 4 | lo; + } + if ((written = ldns_b64_pton(pk, dp, pk_wire_size)) <= 0) { + + LDNS_FREE(data); + return LDNS_STATUS_INVALID_B64; + } + + /* Because ldns_b64_pton_calculate_size isn't always correct: + * (we have to fix it at some point) + */ + pk_wire_size = (uint16_t) written; + ldns_write_uint16(data + 2, pk_wire_size); + rdf_size = 4 + hit_wire_size + pk_wire_size; + + /* Create rdf */ + if (! (*rd = ldns_rdf_new(LDNS_RDF_TYPE_HIP, rdf_size, data))) { + + LDNS_FREE(data); + return LDNS_STATUS_MEM_ERR; + } + return LDNS_STATUS_OK; +} diff --git a/contrib/ldns/tsig.c b/contrib/ldns/tsig.c index afc2590231f..53aa85ecb46 100644 --- a/contrib/ldns/tsig.c +++ b/contrib/ldns/tsig.c @@ -134,19 +134,15 @@ ldns_digest_function(char *name) { /* these are the mandatory algorithms from RFC4635 */ /* The optional algorithms are not yet implemented */ - if (strlen(name) == 12 - && strncasecmp(name, "hmac-sha256.", 11) == 0) { + if (strcasecmp(name, "hmac-sha256.") == 0) { #ifdef HAVE_EVP_SHA256 return EVP_sha256(); #else return NULL; #endif - } else if (strlen(name) == 10 - && strncasecmp(name, "hmac-sha1.", 9) == 0) { + } else if (strcasecmp(name, "hmac-sha1.") == 0) { return EVP_sha1(); - } else if (strlen(name) == 25 - && strncasecmp(name, "hmac-md5.sig-alg.reg.int.", 25) - == 0) { + } else if (strcasecmp(name, "hmac-md5.sig-alg.reg.int.") == 0) { return EVP_md5(); } else { return NULL; diff --git a/contrib/ldns/util.c b/contrib/ldns/util.c index 0439fbe25b3..33060d9637b 100644 --- a/contrib/ldns/util.c +++ b/contrib/ldns/util.c @@ -20,6 +20,7 @@ #include #include #include +#include #ifdef HAVE_SSL #include @@ -460,3 +461,313 @@ ldns_bubblebabble(uint8_t *data, size_t len) retval[j++] = '\0'; return retval; } + +/* + * For backwards compatibility, because we have always exported this symbol. + */ +#ifdef HAVE_B64_NTOP +int ldns_b64_ntop(const uint8_t* src, size_t srclength, + char *target, size_t targsize); +{ + return b64_ntop(src, srclength, target, targsize); +} +#endif + +/* + * For backwards compatibility, because we have always exported this symbol. + */ +#ifdef HAVE_B64_PTON +int ldns_b64_pton(const char* src, uint8_t *target, size_t targsize) +{ + return b64_pton(src, target, targsize); +} +#endif + + +static int +ldns_b32_ntop_base(const uint8_t* src, size_t src_sz, + char* dst, size_t dst_sz, + bool extended_hex, bool add_padding) +{ + size_t ret_sz; + const char* b32 = extended_hex ? "0123456789abcdefghijklmnopqrstuv" + : "abcdefghijklmnopqrstuvwxyz234567"; + + size_t c = 0; /* c is used to carry partial base32 character over + * byte boundaries for sizes with a remainder. + * (i.e. src_sz % 5 != 0) + */ + + ret_sz = add_padding ? ldns_b32_ntop_calculate_size(src_sz) + : ldns_b32_ntop_calculate_size_no_padding(src_sz); + + /* Do we have enough space? */ + if (dst_sz < ret_sz + 1) + return -1; + + /* We know the size; terminate the string */ + dst[ret_sz] = '\0'; + + /* First process all chunks of five */ + while (src_sz >= 5) { + /* 00000... ........ ........ ........ ........ */ + dst[0] = b32[(src[0] ) >> 3]; + + /* .....111 11...... ........ ........ ........ */ + dst[1] = b32[(src[0] & 0x07) << 2 | src[1] >> 6]; + + /* ........ ..22222. ........ ........ ........ */ + dst[2] = b32[(src[1] & 0x3e) >> 1]; + + /* ........ .......3 3333.... ........ ........ */ + dst[3] = b32[(src[1] & 0x01) << 4 | src[2] >> 4]; + + /* ........ ........ ....4444 4....... ........ */ + dst[4] = b32[(src[2] & 0x0f) << 1 | src[3] >> 7]; + + /* ........ ........ ........ .55555.. ........ */ + dst[5] = b32[(src[3] & 0x7c) >> 2]; + + /* ........ ........ ........ ......66 666..... */ + dst[6] = b32[(src[3] & 0x03) << 3 | src[4] >> 5]; + + /* ........ ........ ........ ........ ...77777 */ + dst[7] = b32[(src[4] & 0x1f) ]; + + src_sz -= 5; + src += 5; + dst += 8; + } + /* Process what remains */ + switch (src_sz) { + case 4: /* ........ ........ ........ ......66 666..... */ + dst[6] = b32[(src[3] & 0x03) << 3]; + + /* ........ ........ ........ .55555.. ........ */ + dst[5] = b32[(src[3] & 0x7c) >> 2]; + + /* ........ ........ ....4444 4....... ........ */ + c = src[3] >> 7 ; + case 3: dst[4] = b32[(src[2] & 0x0f) << 1 | c]; + + /* ........ .......3 3333.... ........ ........ */ + c = src[2] >> 4 ; + case 2: dst[3] = b32[(src[1] & 0x01) << 4 | c]; + + /* ........ ..22222. ........ ........ ........ */ + dst[2] = b32[(src[1] & 0x3e) >> 1]; + + /* .....111 11...... ........ ........ ........ */ + c = src[1] >> 6 ; + case 1: dst[1] = b32[(src[0] & 0x07) << 2 | c]; + + /* 00000... ........ ........ ........ ........ */ + dst[0] = b32[ src[0] >> 3]; + } + /* Add padding */ + if (add_padding) { + switch (src_sz) { + case 1: dst[2] = '='; + dst[3] = '='; + case 2: dst[4] = '='; + case 3: dst[5] = '='; + dst[6] = '='; + case 4: dst[7] = '='; + } + } + return (int)ret_sz; +} + +int +ldns_b32_ntop(const uint8_t* src, size_t src_sz, char* dst, size_t dst_sz) +{ + return ldns_b32_ntop_base(src, src_sz, dst, dst_sz, false, true); +} + +int +ldns_b32_ntop_extended_hex(const uint8_t* src, size_t src_sz, + char* dst, size_t dst_sz) +{ + return ldns_b32_ntop_base(src, src_sz, dst, dst_sz, true, true); +} + +#ifndef HAVE_B32_NTOP + +int +b32_ntop(const uint8_t* src, size_t src_sz, char* dst, size_t dst_sz) +{ + return ldns_b32_ntop_base(src, src_sz, dst, dst_sz, false, true); +} + +int +b32_ntop_extended_hex(const uint8_t* src, size_t src_sz, + char* dst, size_t dst_sz) +{ + return ldns_b32_ntop_base(src, src_sz, dst, dst_sz, true, true); +} + +#endif /* ! HAVE_B32_NTOP */ + +static int +ldns_b32_pton_base(const char* src, size_t src_sz, + uint8_t* dst, size_t dst_sz, + bool extended_hex, bool check_padding) +{ + size_t i = 0; + char ch = '\0'; + uint8_t buf[8]; + uint8_t* start = dst; + + while (src_sz) { + /* Collect 8 characters in buf (if possible) */ + for (i = 0; i < 8; i++) { + + do { + ch = *src++; + --src_sz; + + } while (isspace(ch) && src_sz > 0); + + if (ch == '=' || ch == '\0') + break; + + else if (extended_hex) + + if (ch >= '0' && ch <= '9') + buf[i] = (uint8_t)ch - '0'; + else if (ch >= 'a' && ch <= 'v') + buf[i] = (uint8_t)ch - 'a' + 10; + else if (ch >= 'A' && ch <= 'V') + buf[i] = (uint8_t)ch - 'A' + 10; + else + return -1; + + else if (ch >= 'a' && ch <= 'z') + buf[i] = (uint8_t)ch - 'a'; + else if (ch >= 'A' && ch <= 'Z') + buf[i] = (uint8_t)ch - 'A'; + else if (ch >= '2' && ch <= '7') + buf[i] = (uint8_t)ch - '2' + 26; + else + return -1; + } + /* Less that 8 characters. We're done. */ + if (i < 8) + break; + + /* Enough space available at the destination? */ + if (dst_sz < 5) + return -1; + + /* 00000... ........ ........ ........ ........ */ + /* .....111 11...... ........ ........ ........ */ + dst[0] = buf[0] << 3 | buf[1] >> 2; + + /* .....111 11...... ........ ........ ........ */ + /* ........ ..22222. ........ ........ ........ */ + /* ........ .......3 3333.... ........ ........ */ + dst[1] = buf[1] << 6 | buf[2] << 1 | buf[3] >> 4; + + /* ........ .......3 3333.... ........ ........ */ + /* ........ ........ ....4444 4....... ........ */ + dst[2] = buf[3] << 4 | buf[4] >> 1; + + /* ........ ........ ....4444 4....... ........ */ + /* ........ ........ ........ .55555.. ........ */ + /* ........ ........ ........ ......66 666..... */ + dst[3] = buf[4] << 7 | buf[5] << 2 | buf[6] >> 3; + + /* ........ ........ ........ ......66 666..... */ + /* ........ ........ ........ ........ ...77777 */ + dst[4] = buf[6] << 5 | buf[7]; + + dst += 5; + dst_sz -= 5; + } + /* Not ending on a eight byte boundary? */ + if (i > 0 && i < 8) { + + /* Enough space available at the destination? */ + if (dst_sz < (i + 1) / 2) + return -1; + + switch (i) { + case 7: /* ........ ........ ........ ......66 666..... */ + /* ........ ........ ........ .55555.. ........ */ + /* ........ ........ ....4444 4....... ........ */ + dst[3] = buf[4] << 7 | buf[5] << 2 | buf[6] >> 3; + + case 5: /* ........ ........ ....4444 4....... ........ */ + /* ........ .......3 3333.... ........ ........ */ + dst[2] = buf[3] << 4 | buf[4] >> 1; + + case 4: /* ........ .......3 3333.... ........ ........ */ + /* ........ ..22222. ........ ........ ........ */ + /* .....111 11...... ........ ........ ........ */ + dst[1] = buf[1] << 6 | buf[2] << 1 | buf[3] >> 4; + + case 2: /* .....111 11...... ........ ........ ........ */ + /* 00000... ........ ........ ........ ........ */ + dst[0] = buf[0] << 3 | buf[1] >> 2; + + break; + + default: + return -1; + } + dst += (i + 1) / 2; + + if (check_padding) { + /* Check remaining padding characters */ + if (ch != '=') + return -1; + + /* One down, 8 - i - 1 more to come... */ + for (i = 8 - i - 1; i > 0; i--) { + + do { + if (src_sz == 0) + return -1; + ch = *src++; + src_sz--; + + } while (isspace(ch)); + + if (ch != '=') + return -1; + } + } + } + return dst - start; +} + +int +ldns_b32_pton(const char* src, size_t src_sz, uint8_t* dst, size_t dst_sz) +{ + return ldns_b32_pton_base(src, src_sz, dst, dst_sz, false, true); +} + +int +ldns_b32_pton_extended_hex(const char* src, size_t src_sz, + uint8_t* dst, size_t dst_sz) +{ + return ldns_b32_pton_base(src, src_sz, dst, dst_sz, true, true); +} + +#ifndef HAVE_B32_PTON + +int +b32_pton(const char* src, size_t src_sz, uint8_t* dst, size_t dst_sz) +{ + return ldns_b32_pton_base(src, src_sz, dst, dst_sz, false, true); +} + +int +b32_pton_extended_hex(const char* src, size_t src_sz, + uint8_t* dst, size_t dst_sz) +{ + return ldns_b32_pton_base(src, src_sz, dst, dst_sz, true, true); +} + +#endif /* ! HAVE_B32_PTON */ + diff --git a/contrib/ldns/wire2host.c b/contrib/ldns/wire2host.c index e87fcdf5df6..f305808c285 100644 --- a/contrib/ldns/wire2host.c +++ b/contrib/ldns/wire2host.c @@ -64,10 +64,12 @@ ldns_wire2dname(ldns_rdf **dname, const uint8_t *wire, size_t max, size_t *pos) uint8_t tmp_dname[LDNS_MAX_DOMAINLEN]; unsigned int pointer_count = 0; + if (pos == NULL) { + return LDNS_STATUS_WIRE_RDATA_ERR; + } if (*pos >= max) { return LDNS_STATUS_PACKET_OVERFLOW; } - label_size = wire[*pos]; while (label_size > 0) { /* compression */ @@ -162,9 +164,13 @@ ldns_wire2rdf(ldns_rr *rr, const uint8_t *wire, size_t max, size_t *pos) uint16_t rd_length; ldns_rdf *cur_rdf = NULL; ldns_rdf_type cur_rdf_type; - const ldns_rr_descriptor *descriptor = ldns_rr_descript(ldns_rr_get_type(rr)); + const ldns_rr_descriptor *descriptor; ldns_status status; + assert(rr != NULL); + + descriptor = ldns_rr_descript(ldns_rr_get_type(rr)); + if (*pos + 2 > max) { return LDNS_STATUS_PACKET_OVERFLOW; } @@ -178,14 +184,15 @@ ldns_wire2rdf(ldns_rr *rr, const uint8_t *wire, size_t max, size_t *pos) end = *pos + (size_t) rd_length; - for (rdf_index = 0; - rdf_index < ldns_rr_descriptor_maximum(descriptor); rdf_index++) { - if (*pos >= end) { - break; - } + rdf_index = 0; + while (*pos < end && + rdf_index < ldns_rr_descriptor_maximum(descriptor)) { + cur_rdf_length = 0; - cur_rdf_type = ldns_rr_descriptor_field_type(descriptor, rdf_index); + cur_rdf_type = ldns_rr_descriptor_field_type( + descriptor, rdf_index); + /* handle special cases immediately, set length for fixed length rdata and do them below */ switch (cur_rdf_type) { @@ -210,21 +217,40 @@ ldns_wire2rdf(ldns_rr *rr, const uint8_t *wire, size_t max, size_t *pos) cur_rdf_length = LDNS_RDF_SIZE_DOUBLEWORD; break; case LDNS_RDF_TYPE_TSIGTIME: + case LDNS_RDF_TYPE_EUI48: cur_rdf_length = LDNS_RDF_SIZE_6BYTES; break; + case LDNS_RDF_TYPE_ILNP64: + case LDNS_RDF_TYPE_EUI64: + cur_rdf_length = LDNS_RDF_SIZE_8BYTES; + break; case LDNS_RDF_TYPE_AAAA: cur_rdf_length = LDNS_RDF_SIZE_16BYTES; break; case LDNS_RDF_TYPE_STR: case LDNS_RDF_TYPE_NSEC3_SALT: + case LDNS_RDF_TYPE_TAG: /* len is stored in first byte * it should be in the rdf too, so just * copy len+1 from this position */ cur_rdf_length = ((size_t) wire[*pos]) + 1; break; + case LDNS_RDF_TYPE_INT16_DATA: - cur_rdf_length = (size_t) ldns_read_uint16(&wire[*pos]) + 2; + if (*pos + 2 > end) { + return LDNS_STATUS_PACKET_OVERFLOW; + } + cur_rdf_length = + (size_t) ldns_read_uint16(&wire[*pos]) + 2; + break; + case LDNS_RDF_TYPE_HIP: + if (*pos + 4 > end) { + return LDNS_STATUS_PACKET_OVERFLOW; + } + cur_rdf_length = + (size_t) wire[*pos] + + (size_t) ldns_read_uint16(&wire[*pos + 2]) + 4; break; case LDNS_RDF_TYPE_B32_EXT: case LDNS_RDF_TYPE_NSEC3_NEXT_OWNER: @@ -242,7 +268,7 @@ ldns_wire2rdf(ldns_rr *rr, const uint8_t *wire, size_t max, size_t *pos) case LDNS_RDF_TYPE_NSAP: case LDNS_RDF_TYPE_ATMA: case LDNS_RDF_TYPE_IPSECKEY: - case LDNS_RDF_TYPE_TSIG: + case LDNS_RDF_TYPE_LONG_STR: case LDNS_RDF_TYPE_NONE: /* * Read to end of rr rdata @@ -262,7 +288,8 @@ ldns_wire2rdf(ldns_rr *rr, const uint8_t *wire, size_t max, size_t *pos) } memcpy(data, &wire[*pos], cur_rdf_length); - cur_rdf = ldns_rdf_new(cur_rdf_type, cur_rdf_length, data); + cur_rdf = ldns_rdf_new(cur_rdf_type, + cur_rdf_length, data); *pos = *pos + cur_rdf_length; } @@ -270,7 +297,11 @@ ldns_wire2rdf(ldns_rr *rr, const uint8_t *wire, size_t max, size_t *pos) ldns_rr_push_rdf(rr, cur_rdf); cur_rdf = NULL; } - } + + rdf_index++; + + } /* while (rdf_index < ldns_rr_descriptor_maximum(descriptor)) */ + return LDNS_STATUS_OK; } diff --git a/contrib/libstdc++/libsupc++/unwind-cxx.h b/contrib/libstdc++/libsupc++/unwind-cxx.h index 7eb150e059b..2ccd11e633f 100644 --- a/contrib/libstdc++/libsupc++/unwind-cxx.h +++ b/contrib/libstdc++/libsupc++/unwind-cxx.h @@ -142,9 +142,9 @@ typedef enum { ctm_succeeded = 1, ctm_succeeded_with_ptr_to_base = 2 } __cxa_type_match_result; -extern "C" bool __cxa_type_match(_Unwind_Exception*, const std::type_info*, +extern "C" __cxa_type_match_result __cxa_type_match(_Unwind_Exception*, const std::type_info*, bool, void**); -extern "C" void __cxa_begin_cleanup (_Unwind_Exception*); +extern "C" bool __cxa_begin_cleanup (_Unwind_Exception*); extern "C" void __cxa_end_cleanup (void); #endif diff --git a/contrib/libucl/ChangeLog.md b/contrib/libucl/ChangeLog.md new file mode 100644 index 00000000000..09c331f4c6d --- /dev/null +++ b/contrib/libucl/ChangeLog.md @@ -0,0 +1,6 @@ +# Version history + +## Libucl 0.5 + +- Streamline emitter has been added, so it is now possible to output partial `ucl` objects +- Emitter now is more flexible due to emitter_context structure diff --git a/contrib/libucl/configure.ac b/contrib/libucl/configure.ac index 1f6e87d41ef..2d612f6236e 100644 --- a/contrib/libucl/configure.ac +++ b/contrib/libucl/configure.ac @@ -1,7 +1,7 @@ m4_define([maj_ver], [0]) -m4_define([med_ver], [4]) +m4_define([med_ver], [5]) m4_define([min_ver], [0]) -m4_define([so_version], [maj_ver:med_ver]) +m4_define([so_version], [2:0:0]) m4_define([ucl_version], [maj_ver.med_ver.min_ver]) AC_INIT([libucl],[ucl_version],[https://github.com/vstakhov/libucl],[libucl]) diff --git a/contrib/libucl/doc/api.md b/contrib/libucl/doc/api.md index 41e660a428e..174c7ff4706 100644 --- a/contrib/libucl/doc/api.md +++ b/contrib/libucl/doc/api.md @@ -52,15 +52,15 @@ Used to parse `ucl` files and provide interface to extract `ucl` object. Current ### Emitting functions Convert `ucl` objects to some textual or binary representation. Currently, libucl supports the following exports: -- `JSON` - valid json format (can possibly loose some original data, such as implicit arrays) -- `Config` - human-readable configuration format (losseless) +- `JSON` - valid json format (can possibly lose some original data, such as implicit arrays) +- `Config` - human-readable configuration format (lossless) - `YAML` - embedded yaml format (has the same limitations as `json` output) ### Conversion functions Help to convert `ucl` objects to C types. These functions are used to convert `ucl_object_t` to C primitive types, such as numbers, strings or boolean values. ### Generation functions -Allow creating of `ucl` objects from C types and creating of complex `ucl` objects, such as hashes or arrays from primitive `ucl` objects, such as numbers or strings. +Allow creation of `ucl` objects from C types and creating of complex `ucl` objects, such as hashes or arrays from primitive `ucl` objects, such as numbers or strings. ### Iteration functions Iterate over `ucl` complex objects or over a chain of values, for example when a key in an object has multiple values (that can be treated as implicit array or implicit consolidation). @@ -148,7 +148,7 @@ bool ucl_parser_add_file (struct ucl_parser *parser, const char *filename); ~~~ -Load file `filename` and parse it with the specified `parser`. This function uses `mmap` call to load file, therefore, it should not be `shrinked` during parsing. Otherwise, `libucl` can cause memory corruption and terminate the calling application. This function is also used by the internal handler of `include` macro, hence, this macro has the same limitation. +Load file `filename` and parse it with the specified `parser`. This function uses `mmap` call to load file, therefore, it should not be `shrunk` during parsing. Otherwise, `libucl` can cause memory corruption and terminate the calling application. This function is also used by the internal handler of `include` macro, hence, this macro has the same limitation. ### ucl_parser_get_object @@ -225,7 +225,7 @@ ucl_parser_add_chunk (parser, inbuf, r); fclose (in); if (ucl_parser_get_error (parser)) { - printf ("Error occured: %s\n", ucl_parser_get_error (parser)); + printf ("Error occurred: %s\n", ucl_parser_get_error (parser)); ret = 1; } else { @@ -251,7 +251,7 @@ Libucl can transform UCL objects to a number of tectual formats: - compact yaml: `UCL_EMIT_YAML` - compact YAML output Moreover, libucl API allows to select a custom set of emitting functions allowing -efficent and zero-copy output of libucl objects. Libucl uses the following structure to support this feature: +efficient and zero-copy output of libucl objects. Libucl uses the following structure to support this feature: ~~~C struct ucl_emitter_functions { @@ -298,12 +298,12 @@ This function is similar to the previous with the exception that it accepts the # Conversion functions -Conversion functions are used to convert UCL objects to primitive types, such as strings, numbers or boolean values. There are two types of conversion functions: +Conversion functions are used to convert UCL objects to primitive types, such as strings, numbers, or boolean values. There are two types of conversion functions: - safe: try to convert an ucl object to a primitive type and fail if such a conversion is not possible - unsafe: return primitive type without additional checks, if the object cannot be converted then some reasonable default is returned (NULL for strings and 0 for numbers) -Also there is a single `ucl_object_tostring_forced` function that converts any UCL object (including compound types - arrays and objects) to a string representation. For compound and numeric types this function performs emitting to a compact json format actually. +Also there is a single `ucl_object_tostring_forced` function that converts any UCL object (including compound types - arrays and objects) to a string representation. For objects, arrays, booleans and numeric types this function performs emitting to a compact json format actually. Here is a list of all conversion functions: @@ -311,14 +311,14 @@ Here is a list of all conversion functions: - `ucl_object_todouble` - returns `double` of UCL object - `ucl_object_toboolean` - returns `bool` of UCL object - `ucl_object_tostring` - returns `const char *` of UCL object (this string is NULL terminated) -- `ucl_object_tolstring` - returns `const char *` and `size_t` len of UCL object (string can be not NULL terminated) +- `ucl_object_tolstring` - returns `const char *` and `size_t` len of UCL object (string does not need to be NULL terminated) - `ucl_object_tostring_forced` - returns string representation of any UCL object Strings returned by these pointers are associated with the UCL object and exist over its lifetime. A caller should not free this memory. # Generation functions -It is possible to generate UCL objects from C primitive types. Moreover, libucl permits to create and modify complex UCL objects, such as arrays or associative objects. +It is possible to generate UCL objects from C primitive types. Moreover, libucl allows creation and modifying complex UCL objects, such as arrays or associative objects. ## ucl_object_new ~~~C @@ -350,8 +350,8 @@ Libucl provides the functions similar to inverse conversion functions called wit - `ucl_object_fromint` - converts `int64_t` to UCL object - `ucl_object_fromdouble` - converts `double` to UCL object - `ucl_object_fromboolean` - converts `bool` to UCL object -- `ucl_object_fromstring` - converts `const char *` to UCL object (this string is NULL terminated) -- `ucl_object_fromlstring` - converts `const char *` and `size_t` len to UCL object (string can be not NULL terminated) +- `ucl_object_fromstring` - converts `const char *` to UCL object (this string should be NULL terminated) +- `ucl_object_fromlstring` - converts `const char *` and `size_t` len to UCL object (string does not need to be NULL terminated) Also there is a function to generate UCL object from a string performing various parsing or conversion operations called `ucl_object_fromstring_common`. @@ -361,7 +361,7 @@ ucl_object_t * ucl_object_fromstring_common (const char *str, size_t len, enum ucl_string_flags flags) ~~~ -This function is used to convert a string `str` of size `len` to an UCL objects applying `flags` conversions. If `len` is equal to zero then a `str` is assumed as NULL-terminated. This function supports the following flags (a set of flags can be specified using logical `OR` operation): +This function is used to convert a string `str` of size `len` to a UCL object applying `flags` conversions. If `len` is equal to zero then a `str` is assumed as NULL-terminated. This function supports the following flags (a set of flags can be specified using logical `OR` operation): - `UCL_STRING_ESCAPE` - perform JSON escape - `UCL_STRING_TRIM` - trim leading and trailing whitespaces @@ -385,7 +385,7 @@ const ucl_object_t* ucl_iterate_object (const ucl_object_t *obj, ucl_object_iter_t *iter, bool expand_values); ~~~ -This function accept opaque iterator pointer `iter`. In the first call this iterator *must* be initialized to `NULL`. Iterator is changed by this function call. `ucl_iterate_object` returns the next UCL object in the compound object `obj` or `NULL` if all objects have been iterated. The reference count of the object returned is not increased, so a caller should not unref the object or modify its content (e.g. by inserting to another compound object). The object `obj` should not be changed during the iteration process as well. `expand_values` flag speicifies whether `ucl_iterate_object` should expand keys with multiple values. The general rule is that if you need to iterate throught the *object* or *explicit array*, then you always need to set this flag to `true`. However, if you get some key in the object and want to extract all its values then you should set `expand_values` to `false`. Mixing of iteration types are not permitted since the iterator is set according to the iteration type and cannot be reused. Here is an example of iteration over the objects using libucl API (assuming that `top` is `UCL_OBJECT` in this example): +This function accepts opaque iterator pointer `iter`. In the first call this iterator *must* be initialized to `NULL`. Iterator is changed by this function call. `ucl_iterate_object` returns the next UCL object in the compound object `obj` or `NULL` if all objects have been iterated. The reference count of the object returned is not increased, so a caller should not unref the object or modify its content (e.g. by inserting to another compound object). The object `obj` should not be changed during the iteration process as well. `expand_values` flag speicifies whether `ucl_iterate_object` should expand keys with multiple values. The general rule is that if you need to iterate through the *object* or *explicit array*, then you always need to set this flag to `true`. However, if you get some key in the object and want to extract all its values then you should set `expand_values` to `false`. Mixing of iteration types is not permitted since the iterator is set according to the iteration type and cannot be reused. Here is an example of iteration over the objects using libucl API (assuming that `top` is `UCL_OBJECT` in this example): ~~~C ucl_object_iter_t it = NULL, it_obj = NULL; @@ -412,13 +412,13 @@ bool ucl_object_validate (const ucl_object_t *schema, const ucl_object_t *obj, struct ucl_schema_error *err); ~~~ -This function uses ucl object `schema`, that must be valid in terms of `json-schema` draft v4, to validate input object `obj`. If this function returns `true` then validation procedure has been succeed. Otherwise, `false` is returned and `err` is set to a specific value. If caller set `err` to NULL then this function does not set any error just returning `false`. Error is the structure defined as following: +This function uses ucl object `schema`, that must be valid in terms of `json-schema` draft v4, to validate input object `obj`. If this function returns `true` then validation procedure has been succeed. Otherwise, `false` is returned and `err` is set to a specific value. If a caller sets `err` to NULL then this function does not set any error just returning `false`. Error is the structure defined as following: ~~~C struct ucl_schema_error { enum ucl_schema_error_code code; /* error code */ char msg[128]; /* error message */ - ucl_object_t *obj; /* object where error occured */ + ucl_object_t *obj; /* object where error occurred */ }; ~~~ @@ -436,4 +436,4 @@ enum ucl_schema_error_code { }; ~~~ -`msg` is a stiring description of an error and `obj` is an object where error has been occurred. Error object is not allocated by libucl, so there is no need to free it after validation (a static object should thus be used). \ No newline at end of file +`msg` is a string description of an error and `obj` is an object where error has occurred. Error object is not allocated by libucl, so there is no need to free it after validation (a static object should thus be used). diff --git a/contrib/libucl/doc/libucl.3 b/contrib/libucl/doc/libucl.3 index a185d1a5667..e319a0d3f93 100644 --- a/contrib/libucl/doc/libucl.3 +++ b/contrib/libucl/doc/libucl.3 @@ -1,4 +1,4 @@ -.TH LIBUCL 5 "March 20, 2014" "Libucl manual" +.TH "LIBUCL" "3" "July 26, 2014" "Libucl manual" "" .SH NAME .PP \f[B]ucl_parser_new\f[], \f[B]ucl_parser_register_macro\f[], @@ -32,10 +32,10 @@ In future, this limitation can be removed. Convert \f[C]ucl\f[] objects to some textual or binary representation. Currently, libucl supports the following exports: .IP \[bu] 2 -\f[C]JSON\f[] \- valid json format (can possibly loose some original +\f[C]JSON\f[] \- valid json format (can possibly lose some original data, such as implicit arrays) .IP \[bu] 2 -\f[C]Config\f[] \- human\-readable configuration format (losseless) +\f[C]Config\f[] \- human\-readable configuration format (lossless) .IP \[bu] 2 \f[C]YAML\f[] \- embedded yaml format (has the same limitations as \f[C]json\f[] output) @@ -46,7 +46,7 @@ These functions are used to convert \f[C]ucl_object_t\f[] to C primitive types, such as numbers, strings or boolean values. .SS Generation functions .PP -Allow creating of \f[C]ucl\f[] objects from C types and creating of +Allow creation of \f[C]ucl\f[] objects from C types and creating of complex \f[C]ucl\f[] objects, such as hashes or arrays from primitive \f[C]ucl\f[] objects, such as numbers or strings. .SS Iteration functions @@ -175,7 +175,7 @@ bool\ ucl_parser_add_file\ (struct\ ucl_parser\ *parser,\ Load file \f[C]filename\f[] and parse it with the specified \f[C]parser\f[]. This function uses \f[C]mmap\f[] call to load file, therefore, it should -not be \f[C]shrinked\f[] during parsing. +not be \f[C]shrunk\f[] during parsing. Otherwise, \f[C]libucl\f[] can cause memory corruption and terminate the calling application. This function is also used by the internal handler of \f[C]include\f[] @@ -290,7 +290,7 @@ ucl_parser_add_chunk\ (parser,\ inbuf,\ r); fclose\ (in); if\ (ucl_parser_get_error\ (parser))\ { -\ \ \ \ printf\ ("Error\ occured:\ %s\\n",\ ucl_parser_get_error\ (parser)); +\ \ \ \ printf\ ("Error\ occurred:\ %s\\n",\ ucl_parser_get_error\ (parser)); \ \ \ \ ret\ =\ 1; } else\ { @@ -323,7 +323,7 @@ newlines and spaces compact yaml: \f[C]UCL_EMIT_YAML\f[] \- compact YAML output .PP Moreover, libucl API allows to select a custom set of emitting functions -allowing efficent and zero\-copy output of libucl objects. +allowing efficient and zero\-copy output of libucl objects. Libucl uses the following structure to support this feature: .IP .nf @@ -390,7 +390,7 @@ emitters (including C++ ones, for example). .SH CONVERSION FUNCTIONS .PP Conversion functions are used to convert UCL objects to primitive types, -such as strings, numbers or boolean values. +such as strings, numbers, or boolean values. There are two types of conversion functions: .IP \[bu] 2 safe: try to convert an ucl object to a primitive type and fail if such @@ -403,8 +403,8 @@ strings and 0 for numbers) Also there is a single \f[C]ucl_object_tostring_forced\f[] function that converts any UCL object (including compound types \- arrays and objects) to a string representation. -For compound and numeric types this function performs emitting to a -compact json format actually. +For objects, arrays, booleans and numeric types this function performs +emitting to a compact json format actually. .PP Here is a list of all conversion functions: .IP \[bu] 2 @@ -418,7 +418,8 @@ Here is a list of all conversion functions: object (this string is NULL terminated) .IP \[bu] 2 \f[C]ucl_object_tolstring\f[] \- returns \f[C]const\ char\ *\f[] and -\f[C]size_t\f[] len of UCL object (string can be not NULL terminated) +\f[C]size_t\f[] len of UCL object (string does not need to be NULL +terminated) .IP \[bu] 2 \f[C]ucl_object_tostring_forced\f[] \- returns string representation of any UCL object @@ -429,7 +430,7 @@ A caller should not free this memory. .SH GENERATION FUNCTIONS .PP It is possible to generate UCL objects from C primitive types. -Moreover, libucl permits to create and modify complex UCL objects, such +Moreover, libucl allows creation and modifying complex UCL objects, such as arrays or associative objects. .SS ucl_object_new .IP @@ -467,10 +468,10 @@ converts \f[C]int64_t\f[] to UCL object \- \f[C]ucl_object_fromdouble\f[] \- converts \f[C]double\f[] to UCL object \- \f[C]ucl_object_fromboolean\f[] \- converts \f[C]bool\f[] to UCL object \- \f[C]ucl_object_fromstring\f[] \- converts -\f[C]const\ char\ *\f[] to UCL object (this string is NULL terminated) -\- \f[C]ucl_object_fromlstring\f[] \- converts \f[C]const\ char\ *\f[] -and \f[C]size_t\f[] len to UCL object (string can be not NULL -terminated) +\f[C]const\ char\ *\f[] to UCL object (this string should be NULL +terminated) \- \f[C]ucl_object_fromlstring\f[] \- converts +\f[C]const\ char\ *\f[] and \f[C]size_t\f[] len to UCL object (string +does not need to be NULL terminated) .PP Also there is a function to generate UCL object from a string performing various parsing or conversion operations called @@ -485,7 +486,7 @@ ucl_object_t\ *\ ucl_object_fromstring_common\ (const\ char\ *str,\ .fi .PP This function is used to convert a string \f[C]str\f[] of size -\f[C]len\f[] to an UCL objects applying \f[C]flags\f[] conversions. +\f[C]len\f[] to a UCL object applying \f[C]flags\f[] conversions. If \f[C]len\f[] is equal to zero then a \f[C]str\f[] is assumed as NULL\-terminated. This function supports the following flags (a set of flags can be @@ -538,7 +539,7 @@ const\ ucl_object_t*\ ucl_iterate_object\ (const\ ucl_object_t\ *obj,\ \f[] .fi .PP -This function accept opaque iterator pointer \f[C]iter\f[]. +This function accepts opaque iterator pointer \f[C]iter\f[]. In the first call this iterator \f[I]must\f[] be initialized to \f[C]NULL\f[]. Iterator is changed by this function call. @@ -551,12 +552,12 @@ The object \f[C]obj\f[] should not be changed during the iteration process as well. \f[C]expand_values\f[] flag speicifies whether \f[C]ucl_iterate_object\f[] should expand keys with multiple values. -The general rule is that if you need to iterate throught the +The general rule is that if you need to iterate through the \f[I]object\f[] or \f[I]explicit array\f[], then you always need to set this flag to \f[C]true\f[]. However, if you get some key in the object and want to extract all its values then you should set \f[C]expand_values\f[] to \f[C]false\f[]. -Mixing of iteration types are not permitted since the iterator is set +Mixing of iteration types is not permitted since the iterator is set according to the iteration type and cannot be reused. Here is an example of iteration over the objects using libucl API (assuming that \f[C]top\f[] is \f[C]UCL_OBJECT\f[] in this example): @@ -599,8 +600,8 @@ If this function returns \f[C]true\f[] then validation procedure has been succeed. Otherwise, \f[C]false\f[] is returned and \f[C]err\f[] is set to a specific value. -If caller set \f[C]err\f[] to NULL then this function does not set any -error just returning \f[C]false\f[]. +If a caller sets \f[C]err\f[] to NULL then this function does not set +any error just returning \f[C]false\f[]. Error is the structure defined as following: .IP .nf @@ -608,7 +609,7 @@ Error is the structure defined as following: struct\ ucl_schema_error\ { \ \ \ \ enum\ ucl_schema_error_code\ code;\ \ \ \ /*\ error\ code\ */ \ \ \ \ char\ msg[128];\ \ \ \ \ \ \ \ \ \ \ \ \ \ /*\ error\ message\ */ -\ \ \ \ ucl_object_t\ *obj;\ \ \ \ \ \ \ \ \ \ /*\ object\ where\ error\ occured\ */ +\ \ \ \ ucl_object_t\ *obj;\ \ \ \ \ \ \ \ \ \ /*\ object\ where\ error\ occurred\ */ }; \f[] .fi @@ -629,8 +630,8 @@ enum\ ucl_schema_error_code\ { \f[] .fi .PP -\f[C]msg\f[] is a stiring description of an error and \f[C]obj\f[] is an -object where error has been occurred. +\f[C]msg\f[] is a string description of an error and \f[C]obj\f[] is an +object where error has occurred. Error object is not allocated by libucl, so there is no need to free it after validation (a static object should thus be used). .SH AUTHORS diff --git a/contrib/libucl/doc/pandoc.template b/contrib/libucl/doc/pandoc.template index e29e20c287b..6d5f0277ae4 100644 --- a/contrib/libucl/doc/pandoc.template +++ b/contrib/libucl/doc/pandoc.template @@ -1,6 +1,6 @@ -% LIBUCL(5) Libucl manual +% LIBUCL(3) Libucl manual % Vsevolod Stakhov -% March 20, 2014 +% July 26, 2014 # Name diff --git a/contrib/libucl/include/ucl.h b/contrib/libucl/include/ucl.h index 08039b29001..b40f1132250 100644 --- a/contrib/libucl/include/ucl.h +++ b/contrib/libucl/include/ucl.h @@ -236,7 +236,13 @@ UCL_EXTERN ucl_object_t* ucl_object_new (void) UCL_WARN_UNUSED_RESULT; * @param type type of a new object * @return new object */ -UCL_EXTERN ucl_object_t* ucl_object_typed_new (unsigned int type) UCL_WARN_UNUSED_RESULT; +UCL_EXTERN ucl_object_t* ucl_object_typed_new (ucl_type_t type) UCL_WARN_UNUSED_RESULT; + +/** + * Return the type of an object + * @return the object type + */ +UCL_EXTERN ucl_type_t ucl_object_type (const ucl_object_t *obj); /** * Convert any string to an ucl object making the specified transformations @@ -412,6 +418,15 @@ UCL_EXTERN const ucl_object_t* ucl_array_tail (const ucl_object_t *top); */ UCL_EXTERN ucl_object_t* ucl_array_pop_last (ucl_object_t *top); +/** + * Return object identified by an index of the array `top` + * @param obj object to get a key from (must be of type UCL_ARRAY) + * @param index index to return + * @return object at the specified index or NULL if index is not found + */ +UCL_EXTERN const ucl_object_t* ucl_array_find_index (const ucl_object_t *top, + unsigned int index); + /** * Removes the first element from the array `top`. Caller must unref the returned object when it is not * needed. @@ -533,6 +548,15 @@ UCL_EXTERN const ucl_object_t* ucl_object_find_key (const ucl_object_t *obj, UCL_EXTERN const ucl_object_t* ucl_object_find_keyl (const ucl_object_t *obj, const char *key, size_t klen); +/** + * Return object identified by dot notation string + * @param obj object to search in + * @param path dot.notation.path to the path to lookup. May use numeric .index on arrays + * @return object matched the specified path or NULL if path is not found + */ +UCL_EXTERN const ucl_object_t *ucl_lookup_path (const ucl_object_t *obj, + const char *path); + /** * Returns a key of an object as a NULL terminated string * @param obj CL object @@ -642,6 +666,19 @@ UCL_EXTERN struct ucl_parser* ucl_parser_new (int flags); UCL_EXTERN void ucl_parser_register_macro (struct ucl_parser *parser, const char *macro, ucl_macro_handler handler, void* ud); +/** + * Handler to detect unregistered variables + * @param data variable data + * @param len length of variable + * @param replace (out) replace value for variable + * @param replace_len (out) replace length for variable + * @param need_free (out) UCL will free `dest` after usage + * @param ud opaque userdata + * @return true if variable + */ +typedef bool (*ucl_variable_handler) (const unsigned char *data, size_t len, + unsigned char **replace, size_t *replace_len, bool *need_free, void* ud); + /** * Register new parser variable * @param parser parser object @@ -651,6 +688,15 @@ UCL_EXTERN void ucl_parser_register_macro (struct ucl_parser *parser, const char UCL_EXTERN void ucl_parser_register_variable (struct ucl_parser *parser, const char *var, const char *value); +/** + * Set handler for unknown variables + * @param parser parser structure + * @param handler desired handler + * @param ud opaque data for the handler + */ +UCL_EXTERN void ucl_parser_set_variables_handler (struct ucl_parser *parser, + ucl_variable_handler handler, void *ud); + /** * Load new chunk to a parser * @param parser parser structure @@ -740,6 +786,7 @@ UCL_EXTERN bool ucl_parser_set_filevars (struct ucl_parser *parser, const char * * @{ */ +struct ucl_emitter_context; /** * Structure using for emitter callbacks */ @@ -752,10 +799,49 @@ struct ucl_emitter_functions { int (*ucl_emitter_append_int) (int64_t elt, void *ud); /** Append floating point element */ int (*ucl_emitter_append_double) (double elt, void *ud); + /** Free userdata */ + void (*ucl_emitter_free_func)(void *ud); /** Opaque userdata pointer */ void *ud; }; +struct ucl_emitter_operations { + /** Write a primitive element */ + void (*ucl_emitter_write_elt) (struct ucl_emitter_context *ctx, + const ucl_object_t *obj, bool first, bool print_key); + /** Start ucl object */ + void (*ucl_emitter_start_object) (struct ucl_emitter_context *ctx, + const ucl_object_t *obj, bool print_key); + /** End ucl object */ + void (*ucl_emitter_end_object) (struct ucl_emitter_context *ctx, + const ucl_object_t *obj); + /** Start ucl array */ + void (*ucl_emitter_start_array) (struct ucl_emitter_context *ctx, + const ucl_object_t *obj, bool print_key); + void (*ucl_emitter_end_array) (struct ucl_emitter_context *ctx, + const ucl_object_t *obj); +}; + +/** + * Structure that defines emitter functions + */ +struct ucl_emitter_context { + /** Name of emitter (e.g. json, compact_json) */ + const char *name; + /** Unique id (e.g. UCL_EMIT_JSON for standard emitters */ + int id; + /** A set of output functions */ + const struct ucl_emitter_functions *func; + /** A set of output operations */ + const struct ucl_emitter_operations *ops; + /** Current amount of indent tabs */ + unsigned int ident; + /** Top level object */ + const ucl_object_t *top; + /** The rest of context */ + unsigned char data[1]; +}; + /** * Emit object to a string * @param obj object @@ -771,11 +857,81 @@ UCL_EXTERN unsigned char *ucl_object_emit (const ucl_object_t *obj, * @param obj object * @param emit_type if type is #UCL_EMIT_JSON then emit json, if type is * #UCL_EMIT_CONFIG then emit config like object + * @param emitter a set of emitter functions * @return dump of an object (must be freed after using) or NULL in case of error */ UCL_EXTERN bool ucl_object_emit_full (const ucl_object_t *obj, enum ucl_emitter emit_type, struct ucl_emitter_functions *emitter); + +/** + * Start streamlined UCL object emitter + * @param obj top UCL object + * @param emit_type emit type + * @param emitter a set of emitter functions + * @return new streamlined context that should be freed by + * `ucl_object_emit_streamline_finish` + */ +UCL_EXTERN struct ucl_emitter_context* ucl_object_emit_streamline_new ( + const ucl_object_t *obj, enum ucl_emitter emit_type, + struct ucl_emitter_functions *emitter); + +/** + * Start object or array container for the streamlined output + * @param ctx streamlined context + * @param obj container object + */ +UCL_EXTERN void ucl_object_emit_streamline_start_container ( + struct ucl_emitter_context *ctx, const ucl_object_t *obj); +/** + * Add a complete UCL object to streamlined output + * @param ctx streamlined context + * @param obj object to output + */ +UCL_EXTERN void ucl_object_emit_streamline_add_object ( + struct ucl_emitter_context *ctx, const ucl_object_t *obj); +/** + * End previously added container + * @param ctx streamlined context + */ +UCL_EXTERN void ucl_object_emit_streamline_end_container ( + struct ucl_emitter_context *ctx); +/** + * Terminate streamlined container finishing all containers in it + * @param ctx streamlined context + */ +UCL_EXTERN void ucl_object_emit_streamline_finish ( + struct ucl_emitter_context *ctx); + +/** + * Returns functions to emit object to memory + * @param pmem target pointer (should be freed by caller) + * @return emitter functions structure + */ +UCL_EXTERN struct ucl_emitter_functions* ucl_object_emit_memory_funcs ( + void **pmem); + +/** + * Returns functions to emit object to FILE * + * @param fp FILE * object + * @return emitter functions structure + */ +UCL_EXTERN struct ucl_emitter_functions* ucl_object_emit_file_funcs ( + FILE *fp); +/** + * Returns functions to emit object to a file descriptor + * @param fd file descriptor + * @return emitter functions structure + */ +UCL_EXTERN struct ucl_emitter_functions* ucl_object_emit_fd_funcs ( + int fd); + +/** + * Free emitter functions + * @param f pointer to functions + */ +UCL_EXTERN void ucl_object_emit_funcs_free (struct ucl_emitter_functions *f); + /** @} */ /** diff --git a/contrib/libucl/src/Makefile.am b/contrib/libucl/src/Makefile.am index 76391cd044f..417d34e161c 100644 --- a/contrib/libucl/src/Makefile.am +++ b/contrib/libucl/src/Makefile.am @@ -4,6 +4,8 @@ libucl_common_cflags= -I$(top_srcdir)/src \ -Wall -W -Wno-unused-parameter -Wno-pointer-sign lib_LTLIBRARIES= libucl.la libucl_la_SOURCES= ucl_emitter.c \ + ucl_emitter_streamline.c \ + ucl_emitter_utils.c \ ucl_hash.c \ ucl_parser.c \ ucl_schema.c \ diff --git a/contrib/libucl/src/ucl_emitter.c b/contrib/libucl/src/ucl_emitter.c index 04c3d4b1323..11fe50c0060 100644 --- a/contrib/libucl/src/ucl_emitter.c +++ b/contrib/libucl/src/ucl_emitter.c @@ -36,38 +36,55 @@ #endif /** - * @file rcl_emitter.c + * @file ucl_emitter.c * Serialise UCL object to various of output formats */ +static void ucl_emitter_common_elt (struct ucl_emitter_context *ctx, + const ucl_object_t *obj, bool first, bool print_key, bool compact); + +#define UCL_EMIT_TYPE_OPS(type) \ + static void ucl_emit_ ## type ## _elt (struct ucl_emitter_context *ctx, \ + const ucl_object_t *obj, bool first, bool print_key); \ + static void ucl_emit_ ## type ## _start_obj (struct ucl_emitter_context *ctx, \ + const ucl_object_t *obj, bool print_key); \ + static void ucl_emit_ ## type## _start_array (struct ucl_emitter_context *ctx, \ + const ucl_object_t *obj, bool print_key); \ + static void ucl_emit_ ##type## _end_object (struct ucl_emitter_context *ctx, \ + const ucl_object_t *obj); \ + static void ucl_emit_ ##type## _end_array (struct ucl_emitter_context *ctx, \ + const ucl_object_t *obj) + +/* + * JSON format operations + */ +UCL_EMIT_TYPE_OPS(json); +UCL_EMIT_TYPE_OPS(json_compact); +UCL_EMIT_TYPE_OPS(config); +UCL_EMIT_TYPE_OPS(yaml); + +#define UCL_EMIT_TYPE_CONTENT(type) { \ + .ucl_emitter_write_elt = ucl_emit_ ## type ## _elt, \ + .ucl_emitter_start_object = ucl_emit_ ## type ##_start_obj, \ + .ucl_emitter_start_array = ucl_emit_ ## type ##_start_array, \ + .ucl_emitter_end_object = ucl_emit_ ## type ##_end_object, \ + .ucl_emitter_end_array = ucl_emit_ ## type ##_end_array \ +} + + +const struct ucl_emitter_operations ucl_standartd_emitter_ops[] = { + [UCL_EMIT_JSON] = UCL_EMIT_TYPE_CONTENT(json), + [UCL_EMIT_JSON_COMPACT] = UCL_EMIT_TYPE_CONTENT(json_compact), + [UCL_EMIT_CONFIG] = UCL_EMIT_TYPE_CONTENT(config), + [UCL_EMIT_YAML] = UCL_EMIT_TYPE_CONTENT(yaml) +}; + +/* + * Utility to check whether we need a top object + */ +#define UCL_EMIT_IDENT_TOP_OBJ(ctx, obj) ((ctx)->top != (obj) || \ + ((ctx)->id == UCL_EMIT_JSON_COMPACT || (ctx)->id == UCL_EMIT_JSON)) -static void ucl_obj_write_json (const ucl_object_t *obj, - struct ucl_emitter_functions *func, - unsigned int tabs, - bool start_tabs, - bool compact); -static void ucl_elt_write_json (const ucl_object_t *obj, - struct ucl_emitter_functions *func, - unsigned int tabs, - bool start_tabs, - bool compact); -static void ucl_elt_write_config (const ucl_object_t *obj, - struct ucl_emitter_functions *func, - unsigned int tabs, - bool start_tabs, - bool is_top, - bool expand_array); -static void ucl_elt_write_yaml (const ucl_object_t *obj, - struct ucl_emitter_functions *func, - unsigned int tabs, - bool start_tabs, - bool compact, - bool expand_array); -static void ucl_elt_array_write_yaml (const ucl_object_t *obj, - struct ucl_emitter_functions *func, - unsigned int tabs, - bool start_tabs, - bool is_top); /** * Add tabulation to the output buffer @@ -75,189 +92,282 @@ static void ucl_elt_array_write_yaml (const ucl_object_t *obj, * @param tabs number of tabs to add */ static inline void -ucl_add_tabs (struct ucl_emitter_functions *func, unsigned int tabs, bool compact) +ucl_add_tabs (const struct ucl_emitter_functions *func, unsigned int tabs, + bool compact) { - if (!compact) { + if (!compact && tabs > 0) { func->ucl_emitter_append_character (' ', tabs * 4, func->ud); } } /** - * Serialise string - * @param str string to emit - * @param buf target buffer + * Print key for the element + * @param ctx + * @param obj */ static void -ucl_elt_string_write_json (const char *str, size_t size, - struct ucl_emitter_functions *func) +ucl_emitter_print_key (bool print_key, struct ucl_emitter_context *ctx, + const ucl_object_t *obj, bool compact) { - const char *p = str, *c = str; - size_t len = 0; + const struct ucl_emitter_functions *func = ctx->func; - func->ucl_emitter_append_character ('"', 1, func->ud); - while (size) { - if (ucl_test_character (*p, UCL_CHARACTER_JSON_UNSAFE)) { - if (len > 0) { - func->ucl_emitter_append_len (c, len, func->ud); - } - switch (*p) { - case '\n': - func->ucl_emitter_append_len ("\\n", 2, func->ud); - break; - case '\r': - func->ucl_emitter_append_len ("\\r", 2, func->ud); - break; - case '\b': - func->ucl_emitter_append_len ("\\b", 2, func->ud); - break; - case '\t': - func->ucl_emitter_append_len ("\\t", 2, func->ud); - break; - case '\f': - func->ucl_emitter_append_len ("\\f", 2, func->ud); - break; - case '\\': - func->ucl_emitter_append_len ("\\\\", 2, func->ud); - break; - case '"': - func->ucl_emitter_append_len ("\\\"", 2, func->ud); - break; - } - len = 0; - c = ++p; + if (!print_key) { + return; + } + + if (ctx->id == UCL_EMIT_CONFIG) { + if (obj->flags & UCL_OBJECT_NEED_KEY_ESCAPE) { + ucl_elt_string_write_json (obj->key, obj->keylen, ctx); } else { - p ++; - len ++; + func->ucl_emitter_append_len (obj->key, obj->keylen, func->ud); } - size --; - } - if (len > 0) { - func->ucl_emitter_append_len (c, len, func->ud); - } - func->ucl_emitter_append_character ('"', 1, func->ud); -} -/** - * Write a single object to the buffer - * @param obj object to write - * @param buf target buffer - */ -static void -ucl_elt_obj_write_json (const ucl_object_t *obj, struct ucl_emitter_functions *func, - unsigned int tabs, bool start_tabs, bool compact) -{ - const ucl_object_t *cur; - ucl_hash_iter_t it = NULL; - - if (start_tabs) { - ucl_add_tabs (func, tabs, compact); - } - if (compact) { - func->ucl_emitter_append_character ('{', 1, func->ud); + if (obj->type != UCL_OBJECT && obj->type != UCL_ARRAY) { + func->ucl_emitter_append_len (" = ", 3, func->ud); + } + else { + func->ucl_emitter_append_character (' ', 1, func->ud); + } } else { - func->ucl_emitter_append_len ("{\n", 2, func->ud); - } - while ((cur = ucl_hash_iterate (obj->value.ov, &it))) { - ucl_add_tabs (func, tabs + 1, compact); - if (cur->keylen > 0) { - ucl_elt_string_write_json (cur->key, cur->keylen, func); + if (obj->keylen > 0) { + ucl_elt_string_write_json (obj->key, obj->keylen, ctx); } else { func->ucl_emitter_append_len ("null", 4, func->ud); } + if (compact) { func->ucl_emitter_append_character (':', 1, func->ud); } else { func->ucl_emitter_append_len (": ", 2, func->ud); } - ucl_obj_write_json (cur, func, tabs + 1, false, compact); - if (ucl_hash_iter_has_next (it)) { - if (compact) { - func->ucl_emitter_append_character (',', 1, func->ud); + } +} + +static void +ucl_emitter_finish_object (struct ucl_emitter_context *ctx, + const ucl_object_t *obj, bool compact, bool is_array) +{ + const struct ucl_emitter_functions *func = ctx->func; + + if (ctx->id == UCL_EMIT_CONFIG && obj != ctx->top) { + if (obj->type != UCL_OBJECT && obj->type != UCL_ARRAY) { + if (!is_array) { + /* Objects are split by ';' */ + func->ucl_emitter_append_len (";\n", 2, func->ud); } else { + /* Use commas for arrays */ func->ucl_emitter_append_len (",\n", 2, func->ud); } } - else if (!compact) { + else { func->ucl_emitter_append_character ('\n', 1, func->ud); } } - ucl_add_tabs (func, tabs, compact); - func->ucl_emitter_append_character ('}', 1, func->ud); } /** - * Write a single array to the buffer - * @param obj array to write - * @param buf target buffer + * End standard ucl object + * @param ctx emitter context + * @param compact compact flag */ static void -ucl_elt_array_write_json (const ucl_object_t *obj, struct ucl_emitter_functions *func, - unsigned int tabs, bool start_tabs, bool compact) +ucl_emitter_common_end_object (struct ucl_emitter_context *ctx, + const ucl_object_t *obj, bool compact) { - const ucl_object_t *cur = obj; + const struct ucl_emitter_functions *func = ctx->func; - if (start_tabs) { - ucl_add_tabs (func, tabs, compact); + if (UCL_EMIT_IDENT_TOP_OBJ(ctx, obj)) { + ctx->ident --; + if (compact) { + func->ucl_emitter_append_character ('}', 1, func->ud); + } + else { + if (ctx->id != UCL_EMIT_CONFIG) { + /* newline is already added for this format */ + func->ucl_emitter_append_character ('\n', 1, func->ud); + } + ucl_add_tabs (func, ctx->ident, compact); + func->ucl_emitter_append_character ('}', 1, func->ud); + } } + + ucl_emitter_finish_object (ctx, obj, compact, false); +} + +/** + * End standard ucl array + * @param ctx emitter context + * @param compact compact flag + */ +static void +ucl_emitter_common_end_array (struct ucl_emitter_context *ctx, + const ucl_object_t *obj, bool compact) +{ + const struct ucl_emitter_functions *func = ctx->func; + + ctx->ident --; + if (compact) { + func->ucl_emitter_append_character (']', 1, func->ud); + } + else { + if (ctx->id != UCL_EMIT_CONFIG) { + /* newline is already added for this format */ + func->ucl_emitter_append_character ('\n', 1, func->ud); + } + ucl_add_tabs (func, ctx->ident, compact); + func->ucl_emitter_append_character (']', 1, func->ud); + } + + ucl_emitter_finish_object (ctx, obj, compact, true); +} + +/** + * Start emit standard UCL array + * @param ctx emitter context + * @param obj object to write + * @param compact compact flag + */ +static void +ucl_emitter_common_start_array (struct ucl_emitter_context *ctx, + const ucl_object_t *obj, bool print_key, bool compact) +{ + const ucl_object_t *cur; + const struct ucl_emitter_functions *func = ctx->func; + bool first = true; + + ucl_emitter_print_key (print_key, ctx, obj, compact); + if (compact) { func->ucl_emitter_append_character ('[', 1, func->ud); } else { func->ucl_emitter_append_len ("[\n", 2, func->ud); } + + ctx->ident ++; + + if (obj->type == UCL_ARRAY) { + /* explicit array */ + cur = obj->value.av; + } + else { + /* implicit array */ + cur = obj; + } + while (cur) { - ucl_elt_write_json (cur, func, tabs + 1, true, compact); - if (cur->next != NULL) { - if (compact) { - func->ucl_emitter_append_character (',', 1, func->ud); - } - else { - func->ucl_emitter_append_len (",\n", 2, func->ud); - } - } - else if (!compact) { - func->ucl_emitter_append_character ('\n', 1, func->ud); - } + ucl_emitter_common_elt (ctx, cur, first, false, compact); + first = false; cur = cur->next; } - ucl_add_tabs (func, tabs, compact); - func->ucl_emitter_append_character (']', 1, func->ud); } /** - * Emit a single element - * @param obj object - * @param buf buffer + * Start emit standard UCL object + * @param ctx emitter context + * @param obj object to write + * @param compact compact flag */ static void -ucl_elt_write_json (const ucl_object_t *obj, struct ucl_emitter_functions *func, - unsigned int tabs, bool start_tabs, bool compact) +ucl_emitter_common_start_object (struct ucl_emitter_context *ctx, + const ucl_object_t *obj, bool print_key, bool compact) { + ucl_hash_iter_t it = NULL; + const ucl_object_t *cur, *elt; + const struct ucl_emitter_functions *func = ctx->func; + bool first = true; + + ucl_emitter_print_key (print_key, ctx, obj, compact); + /* + * Print { + * + */ + if (UCL_EMIT_IDENT_TOP_OBJ(ctx, obj)) { + if (compact) { + func->ucl_emitter_append_character ('{', 1, func->ud); + } + else { + func->ucl_emitter_append_len ("{\n", 2, func->ud); + } + ctx->ident ++; + } + + while ((cur = ucl_hash_iterate (obj->value.ov, &it))) { + + if (ctx->id == UCL_EMIT_CONFIG) { + LL_FOREACH (cur, elt) { + ucl_emitter_common_elt (ctx, elt, first, true, compact); + } + } + else { + /* Expand implicit arrays */ + if (cur->next != NULL) { + if (!first) { + if (compact) { + func->ucl_emitter_append_character (',', 1, func->ud); + } + else { + func->ucl_emitter_append_len (",\n", 2, func->ud); + } + } + ucl_add_tabs (func, ctx->ident, compact); + ucl_emitter_common_start_array (ctx, cur, true, compact); + ucl_emitter_common_end_array (ctx, cur, compact); + } + else { + ucl_emitter_common_elt (ctx, cur, first, true, compact); + } + } + + first = false; + } +} + +/** + * Common choice of object emitting + * @param ctx emitter context + * @param obj object to print + * @param first flag to mark the first element + * @param print_key print key of an object + * @param compact compact output + */ +static void +ucl_emitter_common_elt (struct ucl_emitter_context *ctx, + const ucl_object_t *obj, bool first, bool print_key, bool compact) +{ + const struct ucl_emitter_functions *func = ctx->func; bool flag; + if (ctx->id != UCL_EMIT_CONFIG && !first) { + if (compact) { + func->ucl_emitter_append_character (',', 1, func->ud); + } + else { + func->ucl_emitter_append_len (",\n", 2, func->ud); + } + } + + ucl_add_tabs (func, ctx->ident, compact); + switch (obj->type) { case UCL_INT: - if (start_tabs) { - ucl_add_tabs (func, tabs, compact); - } + ucl_emitter_print_key (print_key, ctx, obj, compact); func->ucl_emitter_append_int (ucl_object_toint (obj), func->ud); + ucl_emitter_finish_object (ctx, obj, compact, !print_key); break; case UCL_FLOAT: case UCL_TIME: - if (start_tabs) { - ucl_add_tabs (func, tabs, compact); - } + ucl_emitter_print_key (print_key, ctx, obj, compact); func->ucl_emitter_append_double (ucl_object_todouble (obj), func->ud); + ucl_emitter_finish_object (ctx, obj, compact, !print_key); break; case UCL_BOOLEAN: - if (start_tabs) { - ucl_add_tabs (func, tabs, compact); - } + ucl_emitter_print_key (print_key, ctx, obj, compact); flag = ucl_object_toboolean (obj); if (flag) { func->ucl_emitter_append_len ("true", 4, func->ud); @@ -265,499 +375,75 @@ ucl_elt_write_json (const ucl_object_t *obj, struct ucl_emitter_functions *func, else { func->ucl_emitter_append_len ("false", 5, func->ud); } + ucl_emitter_finish_object (ctx, obj, compact, !print_key); break; case UCL_STRING: - if (start_tabs) { - ucl_add_tabs (func, tabs, compact); - } - ucl_elt_string_write_json (obj->value.sv, obj->len, func); + ucl_emitter_print_key (print_key, ctx, obj, compact); + ucl_elt_string_write_json (obj->value.sv, obj->len, ctx); + ucl_emitter_finish_object (ctx, obj, compact, !print_key); break; case UCL_NULL: - if (start_tabs) { - ucl_add_tabs (func, tabs, compact); - } + ucl_emitter_print_key (print_key, ctx, obj, compact); func->ucl_emitter_append_len ("null", 4, func->ud); + ucl_emitter_finish_object (ctx, obj, compact, !print_key); break; case UCL_OBJECT: - ucl_elt_obj_write_json (obj, func, tabs, start_tabs, compact); + ucl_emitter_common_start_object (ctx, obj, print_key, compact); + ucl_emitter_common_end_object (ctx, obj, compact); break; case UCL_ARRAY: - ucl_elt_array_write_json (obj->value.av, func, tabs, start_tabs, compact); + ucl_emitter_common_start_array (ctx, obj, print_key, compact); + ucl_emitter_common_end_array (ctx, obj, compact); break; case UCL_USERDATA: break; } } -/** - * Write a single object to the buffer - * @param obj object - * @param buf target buffer - */ -static void -ucl_obj_write_json (const ucl_object_t *obj, struct ucl_emitter_functions *func, - unsigned int tabs, bool start_tabs, bool compact) -{ - const ucl_object_t *cur; - bool is_array = (obj->next != NULL); - - if (is_array) { - /* This is an array actually */ - if (start_tabs) { - ucl_add_tabs (func, tabs, compact); - } - - if (compact) { - func->ucl_emitter_append_character ('[', 1, func->ud); - } - else { - func->ucl_emitter_append_len ("[\n", 2, func->ud); - } - cur = obj; - while (cur != NULL) { - ucl_elt_write_json (cur, func, tabs + 1, true, compact); - if (cur->next) { - func->ucl_emitter_append_character (',', 1, func->ud); - } - if (!compact) { - func->ucl_emitter_append_character ('\n', 1, func->ud); - } - cur = cur->next; - } - ucl_add_tabs (func, tabs, compact); - func->ucl_emitter_append_character (']', 1, func->ud); - } - else { - ucl_elt_write_json (obj, func, tabs, start_tabs, compact); - } - -} - -/** - * Emit an object to json - * @param obj object - * @return json output (should be freed after using) - */ -static void -ucl_object_emit_json (const ucl_object_t *obj, bool compact, - struct ucl_emitter_functions *func) -{ - ucl_obj_write_json (obj, func, 0, false, compact); -} - -/** - * Write a single object to the buffer - * @param obj object to write - * @param buf target buffer - */ -static void -ucl_elt_obj_write_config (const ucl_object_t *obj, struct ucl_emitter_functions *func, - unsigned int tabs, bool start_tabs, bool is_top) -{ - const ucl_object_t *cur, *cur_obj; - ucl_hash_iter_t it = NULL; - - if (start_tabs) { - ucl_add_tabs (func, tabs, is_top); - } - if (!is_top) { - func->ucl_emitter_append_len ("{\n", 2, func->ud); - } - - while ((cur = ucl_hash_iterate (obj->value.ov, &it))) { - LL_FOREACH (cur, cur_obj) { - ucl_add_tabs (func, tabs + 1, is_top); - if (cur_obj->flags & UCL_OBJECT_NEED_KEY_ESCAPE) { - ucl_elt_string_write_json (cur_obj->key, cur_obj->keylen, func); - } - else { - func->ucl_emitter_append_len (cur_obj->key, cur_obj->keylen, func->ud); - } - if (cur_obj->type != UCL_OBJECT && cur_obj->type != UCL_ARRAY) { - func->ucl_emitter_append_len (" = ", 3, func->ud); - } - else { - func->ucl_emitter_append_character (' ', 1, func->ud); - } - ucl_elt_write_config (cur_obj, func, - is_top ? tabs : tabs + 1, - false, false, false); - if (cur_obj->type != UCL_OBJECT && cur_obj->type != UCL_ARRAY) { - func->ucl_emitter_append_len (";\n", 2, func->ud); - } - else { - func->ucl_emitter_append_character ('\n', 1, func->ud); - } - } - } - - ucl_add_tabs (func, tabs, is_top); - if (!is_top) { - func->ucl_emitter_append_character ('}', 1, func->ud); - } -} - -/** - * Write a single array to the buffer - * @param obj array to write - * @param buf target buffer - */ -static void -ucl_elt_array_write_config (const ucl_object_t *obj, struct ucl_emitter_functions *func, - unsigned int tabs, bool start_tabs, bool is_top) -{ - const ucl_object_t *cur = obj; - - if (start_tabs) { - ucl_add_tabs (func, tabs, false); - } - - func->ucl_emitter_append_len ("[\n", 2, func->ud); - while (cur) { - ucl_elt_write_config (cur, func, tabs + 1, true, false, false); - func->ucl_emitter_append_len (",\n", 2, func->ud); - cur = cur->next; - } - ucl_add_tabs (func, tabs, false); - func->ucl_emitter_append_character (']', 1, func->ud); -} - -/** - * Emit a single element - * @param obj object - * @param buf buffer - */ -static void -ucl_elt_write_config (const ucl_object_t *obj, struct ucl_emitter_functions *func, - unsigned int tabs, bool start_tabs, bool is_top, bool expand_array) -{ - bool flag; - - if (expand_array && obj->next != NULL) { - ucl_elt_array_write_config (obj, func, tabs, start_tabs, is_top); - } - else { - switch (obj->type) { - case UCL_INT: - if (start_tabs) { - ucl_add_tabs (func, tabs, false); - } - func->ucl_emitter_append_int (ucl_object_toint (obj), func->ud); - break; - case UCL_FLOAT: - case UCL_TIME: - if (start_tabs) { - ucl_add_tabs (func, tabs, false); - } - func->ucl_emitter_append_double (ucl_object_todouble (obj), func->ud); - break; - case UCL_BOOLEAN: - if (start_tabs) { - ucl_add_tabs (func, tabs, false); - } - flag = ucl_object_toboolean (obj); - if (flag) { - func->ucl_emitter_append_len ("true", 4, func->ud); - } - else { - func->ucl_emitter_append_len ("false", 5, func->ud); - } - break; - case UCL_STRING: - if (start_tabs) { - ucl_add_tabs (func, tabs, false); - } - ucl_elt_string_write_json (obj->value.sv, obj->len, func); - break; - case UCL_NULL: - if (start_tabs) { - ucl_add_tabs (func, tabs, false); - } - func->ucl_emitter_append_len ("null", 4, func->ud); - break; - case UCL_OBJECT: - ucl_elt_obj_write_config (obj, func, tabs, start_tabs, is_top); - break; - case UCL_ARRAY: - ucl_elt_array_write_config (obj->value.av, func, tabs, start_tabs, is_top); - break; - case UCL_USERDATA: - break; - } - } -} - -/** - * Emit an object to rcl - * @param obj object - * @return rcl output (should be freed after using) - */ -static void -ucl_object_emit_config (const ucl_object_t *obj, struct ucl_emitter_functions *func) -{ - ucl_elt_write_config (obj, func, 0, false, true, true); -} - - -static void -ucl_obj_write_yaml (const ucl_object_t *obj, struct ucl_emitter_functions *func, - unsigned int tabs, bool start_tabs) -{ - bool is_array = (obj->next != NULL); - - if (is_array) { - ucl_elt_array_write_yaml (obj, func, tabs, start_tabs, false); - } - else { - ucl_elt_write_yaml (obj, func, tabs, start_tabs, false, true); - } -} - -/** - * Write a single object to the buffer - * @param obj object to write - * @param buf target buffer - */ -static void -ucl_elt_obj_write_yaml (const ucl_object_t *obj, struct ucl_emitter_functions *func, - unsigned int tabs, bool start_tabs, bool is_top) -{ - const ucl_object_t *cur; - ucl_hash_iter_t it = NULL; - - if (start_tabs) { - ucl_add_tabs (func, tabs, is_top); - } - if (!is_top) { - func->ucl_emitter_append_len ("{\n", 2, func->ud); - } - - while ((cur = ucl_hash_iterate (obj->value.ov, &it))) { - ucl_add_tabs (func, tabs + 1, is_top); - if (cur->keylen > 0) { - ucl_elt_string_write_json (cur->key, cur->keylen, func); - } - else { - func->ucl_emitter_append_len ("null", 4, func->ud); - } - func->ucl_emitter_append_len (": ", 2, func->ud); - ucl_obj_write_yaml (cur, func, is_top ? tabs : tabs + 1, false); - if (ucl_hash_iter_has_next(it)) { - if (!is_top) { - func->ucl_emitter_append_len (",\n", 2, func->ud); - } - else { - func->ucl_emitter_append_character ('\n', 1, func->ud); - } - } - else { - func->ucl_emitter_append_character ('\n', 1, func->ud); - } - } - - ucl_add_tabs (func, tabs, is_top); - if (!is_top) { - func->ucl_emitter_append_character ('}', 1, func->ud); - } -} - -/** - * Write a single array to the buffer - * @param obj array to write - * @param buf target buffer - */ -static void -ucl_elt_array_write_yaml (const ucl_object_t *obj, struct ucl_emitter_functions *func, - unsigned int tabs, bool start_tabs, bool is_top) -{ - const ucl_object_t *cur = obj; - - if (start_tabs) { - ucl_add_tabs (func, tabs, false); - } - - func->ucl_emitter_append_len ("[\n", 2, func->ud); - while (cur) { - ucl_elt_write_yaml (cur, func, tabs + 1, true, false, false); - func->ucl_emitter_append_len (",\n", 2, func->ud); - cur = cur->next; - } - ucl_add_tabs (func, tabs, false); - func->ucl_emitter_append_character (']', 1, func->ud); -} - -/** - * Emit a single element - * @param obj object - * @param buf buffer - */ -static void -ucl_elt_write_yaml (const ucl_object_t *obj, struct ucl_emitter_functions *func, - unsigned int tabs, bool start_tabs, bool is_top, bool expand_array) -{ - bool flag; - - if (expand_array && obj->next != NULL ) { - ucl_elt_array_write_yaml (obj, func, tabs, start_tabs, is_top); - } - else { - switch (obj->type) { - case UCL_INT: - if (start_tabs) { - ucl_add_tabs (func, tabs, false); - } - func->ucl_emitter_append_int (ucl_object_toint (obj), func->ud); - break; - case UCL_FLOAT: - case UCL_TIME: - if (start_tabs) { - ucl_add_tabs (func, tabs, false); - } - func->ucl_emitter_append_double (ucl_object_todouble (obj), func->ud); - break; - case UCL_BOOLEAN: - if (start_tabs) { - ucl_add_tabs (func, tabs, false); - } - flag = ucl_object_toboolean (obj); - if (flag) { - func->ucl_emitter_append_len ("true", 4, func->ud); - } - else { - func->ucl_emitter_append_len ("false", 5, func->ud); - } - break; - case UCL_STRING: - if (start_tabs) { - ucl_add_tabs (func, tabs, false); - } - ucl_elt_string_write_json (obj->value.sv, obj->len, func); - break; - case UCL_NULL: - if (start_tabs) { - ucl_add_tabs (func, tabs, false); - } - func->ucl_emitter_append_len ("null", 4, func->ud); - break; - case UCL_OBJECT: - ucl_elt_obj_write_yaml (obj, func, tabs, start_tabs, is_top); - break; - case UCL_ARRAY: - ucl_elt_array_write_yaml (obj->value.av, func, tabs, start_tabs, is_top); - break; - case UCL_USERDATA: - break; - } - } -} - -/** - * Emit an object to rcl - * @param obj object - * @return rcl output (should be freed after using) - */ -static void -ucl_object_emit_yaml (const ucl_object_t *obj, struct ucl_emitter_functions *func) -{ - ucl_elt_write_yaml (obj, func, 0, false, true, true); -} - /* - * Generic utstring output + * Specific standard implementations of the emitter functions */ -static int -ucl_utstring_append_character (unsigned char c, size_t len, void *ud) -{ - UT_string *buf = ud; - - if (len == 1) { - utstring_append_c (buf, c); - } - else { - utstring_reserve (buf, len); - memset (&buf->d[buf->i], c, len); - buf->i += len; - buf->d[buf->i] = '\0'; +#define UCL_EMIT_TYPE_IMPL(type, compact) \ + static void ucl_emit_ ## type ## _elt (struct ucl_emitter_context *ctx, \ + const ucl_object_t *obj, bool first, bool print_key) { \ + ucl_emitter_common_elt (ctx, obj, first, print_key, (compact)); \ + } \ + static void ucl_emit_ ## type ## _start_obj (struct ucl_emitter_context *ctx, \ + const ucl_object_t *obj, bool print_key) { \ + ucl_emitter_common_start_object (ctx, obj, print_key, (compact)); \ + } \ + static void ucl_emit_ ## type## _start_array (struct ucl_emitter_context *ctx, \ + const ucl_object_t *obj, bool print_key) { \ + ucl_emitter_common_start_array (ctx, obj, print_key, (compact)); \ + } \ + static void ucl_emit_ ##type## _end_object (struct ucl_emitter_context *ctx, \ + const ucl_object_t *obj) { \ + ucl_emitter_common_end_object (ctx, obj, (compact)); \ + } \ + static void ucl_emit_ ##type## _end_array (struct ucl_emitter_context *ctx, \ + const ucl_object_t *obj) { \ + ucl_emitter_common_end_array (ctx, obj, (compact)); \ } - return 0; -} - -static int -ucl_utstring_append_len (const unsigned char *str, size_t len, void *ud) -{ - UT_string *buf = ud; - - utstring_append_len (buf, str, len); - - return 0; -} - -static int -ucl_utstring_append_int (int64_t val, void *ud) -{ - UT_string *buf = ud; - - utstring_printf (buf, "%jd", (intmax_t)val); - return 0; -} - -static int -ucl_utstring_append_double (double val, void *ud) -{ - UT_string *buf = ud; - const double delta = 0.0000001; - - if (val == (double)(int)val) { - utstring_printf (buf, "%.1lf", val); - } - else if (fabs (val - (double)(int)val) < delta) { - /* Write at maximum precision */ - utstring_printf (buf, "%.*lg", DBL_DIG, val); - } - else { - utstring_printf (buf, "%lf", val); - } - - return 0; -} - +UCL_EMIT_TYPE_IMPL(json, false); +UCL_EMIT_TYPE_IMPL(json_compact, true); +UCL_EMIT_TYPE_IMPL(config, false); +UCL_EMIT_TYPE_IMPL(yaml, false); unsigned char * ucl_object_emit (const ucl_object_t *obj, enum ucl_emitter emit_type) { - UT_string *buf = NULL; unsigned char *res = NULL; - struct ucl_emitter_functions func = { - .ucl_emitter_append_character = ucl_utstring_append_character, - .ucl_emitter_append_len = ucl_utstring_append_len, - .ucl_emitter_append_int = ucl_utstring_append_int, - .ucl_emitter_append_double = ucl_utstring_append_double - }; - + struct ucl_emitter_functions *func; if (obj == NULL) { return NULL; } - utstring_new (buf); - func.ud = buf; + func = ucl_object_emit_memory_funcs ((void **)&res); - if (buf != NULL) { - if (emit_type == UCL_EMIT_JSON) { - ucl_object_emit_json (obj, false, &func); - } - else if (emit_type == UCL_EMIT_JSON_COMPACT) { - ucl_object_emit_json (obj, true, &func); - } - else if (emit_type == UCL_EMIT_YAML) { - ucl_object_emit_yaml (obj, &func); - } - else { - ucl_object_emit_config (obj, &func); - } - - res = utstring_body (buf); - free (buf); + if (func != NULL) { + ucl_object_emit_full (obj, emit_type, func); + ucl_object_emit_funcs_free (func); } return res; @@ -767,71 +453,19 @@ bool ucl_object_emit_full (const ucl_object_t *obj, enum ucl_emitter emit_type, struct ucl_emitter_functions *emitter) { - if (emit_type == UCL_EMIT_JSON) { - ucl_object_emit_json (obj, false, emitter); - } - else if (emit_type == UCL_EMIT_JSON_COMPACT) { - ucl_object_emit_json (obj, true, emitter); - } - else if (emit_type == UCL_EMIT_YAML) { - ucl_object_emit_yaml (obj, emitter); - } - else { - ucl_object_emit_config (obj, emitter); - } + const struct ucl_emitter_context *ctx; + struct ucl_emitter_context my_ctx; + bool res = false; - /* XXX: need some error checks here */ - return true; -} + ctx = ucl_emit_get_standard_context (emit_type); + if (ctx != NULL) { + memcpy (&my_ctx, ctx, sizeof (my_ctx)); + my_ctx.func = emitter; + my_ctx.ident = 0; + my_ctx.top = obj; - -unsigned char * -ucl_object_emit_single_json (const ucl_object_t *obj) -{ - UT_string *buf = NULL; - unsigned char *res = NULL; - - if (obj == NULL) { - return NULL; - } - - utstring_new (buf); - - if (buf != NULL) { - switch (obj->type) { - case UCL_OBJECT: - ucl_utstring_append_len ("object", 6, buf); - break; - case UCL_ARRAY: - ucl_utstring_append_len ("array", 5, buf); - break; - case UCL_INT: - ucl_utstring_append_int (obj->value.iv, buf); - break; - case UCL_FLOAT: - case UCL_TIME: - ucl_utstring_append_double (obj->value.dv, buf); - break; - case UCL_NULL: - ucl_utstring_append_len ("null", 4, buf); - break; - case UCL_BOOLEAN: - if (obj->value.iv) { - ucl_utstring_append_len ("true", 4, buf); - } - else { - ucl_utstring_append_len ("false", 5, buf); - } - break; - case UCL_STRING: - ucl_utstring_append_len (obj->value.sv, obj->len, buf); - break; - case UCL_USERDATA: - ucl_utstring_append_len ("userdata", 8, buf); - break; - } - res = utstring_body (buf); - free (buf); + my_ctx.ops->ucl_emitter_write_elt (&my_ctx, obj, true, false); + res = true; } return res; diff --git a/contrib/libucl/src/ucl_emitter_streamline.c b/contrib/libucl/src/ucl_emitter_streamline.c new file mode 100644 index 00000000000..acf4a305a46 --- /dev/null +++ b/contrib/libucl/src/ucl_emitter_streamline.c @@ -0,0 +1,166 @@ +/* Copyright (c) 2014, Vsevolod Stakhov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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 ''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 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 HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ucl.h" +#include "ucl_internal.h" +#include "ucl_chartable.h" + +struct ucl_emitter_streamline_stack { + bool is_array; + bool empty; + const ucl_object_t *obj; + struct ucl_emitter_streamline_stack *next; +}; + +struct ucl_emitter_context_streamline { + /* Inherited from the main context */ + const char *name; + int id; + const struct ucl_emitter_functions *func; + const struct ucl_emitter_operations *ops; + unsigned int ident; + const ucl_object_t *top; + + /* Streamline specific fields */ + struct ucl_emitter_streamline_stack *containers; +}; + +#define TO_STREAMLINE(ctx) (struct ucl_emitter_context_streamline *)(ctx) + +struct ucl_emitter_context* +ucl_object_emit_streamline_new (const ucl_object_t *obj, + enum ucl_emitter emit_type, + struct ucl_emitter_functions *emitter) +{ + const struct ucl_emitter_context *ctx; + struct ucl_emitter_context_streamline *sctx; + + ctx = ucl_emit_get_standard_context (emit_type); + if (ctx == NULL) { + return NULL; + } + + sctx = calloc (1, sizeof (*sctx)); + if (sctx == NULL) { + return NULL; + } + + memcpy (sctx, ctx, sizeof (*ctx)); + sctx->func = emitter; + sctx->top = obj; + + ucl_object_emit_streamline_start_container ((struct ucl_emitter_context *)sctx, + obj); + + return (struct ucl_emitter_context *)sctx; +} + +void +ucl_object_emit_streamline_start_container (struct ucl_emitter_context *ctx, + const ucl_object_t *obj) +{ + struct ucl_emitter_context_streamline *sctx = TO_STREAMLINE(ctx); + struct ucl_emitter_streamline_stack *st, *top; + bool print_key = false; + + /* Check top object presence */ + if (sctx->top == NULL) { + sctx->top = obj; + } + + top = sctx->containers; + st = malloc (sizeof (*st)); + if (st != NULL) { + if (top != NULL && !top->is_array) { + print_key = true; + } + st->empty = true; + st->obj = obj; + if (obj != NULL && obj->type == UCL_ARRAY) { + st->is_array = true; + sctx->ops->ucl_emitter_start_array (ctx, obj, print_key); + } + else { + st->is_array = false; + sctx->ops->ucl_emitter_start_object (ctx, obj, print_key); + } + } + + LL_PREPEND (sctx->containers, st); +} + +void +ucl_object_emit_streamline_add_object ( + struct ucl_emitter_context *ctx, const ucl_object_t *obj) +{ + struct ucl_emitter_context_streamline *sctx = TO_STREAMLINE(ctx); + bool is_array = false, is_first = false; + + if (sctx->containers != NULL) { + if (sctx->containers->is_array) { + is_array = true; + } + if (sctx->containers->empty) { + is_first = true; + sctx->containers->empty = false; + } + } + + sctx->ops->ucl_emitter_write_elt (ctx, obj, is_first, !is_array); +} + +void +ucl_object_emit_streamline_end_container (struct ucl_emitter_context *ctx) +{ + struct ucl_emitter_context_streamline *sctx = TO_STREAMLINE(ctx); + struct ucl_emitter_streamline_stack *st; + + if (sctx->containers != NULL) { + st = sctx->containers; + + if (st->is_array) { + sctx->ops->ucl_emitter_end_array (ctx, st->obj); + } + else { + sctx->ops->ucl_emitter_end_object (ctx, st->obj); + } + sctx->containers = st->next; + free (st); + } +} + +void +ucl_object_emit_streamline_finish (struct ucl_emitter_context *ctx) +{ + struct ucl_emitter_context_streamline *sctx = TO_STREAMLINE(ctx); + + while (sctx->containers != NULL) { + ucl_object_emit_streamline_end_container (ctx); + } + + free (sctx); +} diff --git a/contrib/libucl/src/ucl_emitter_utils.c b/contrib/libucl/src/ucl_emitter_utils.c new file mode 100644 index 00000000000..c619ab9df15 --- /dev/null +++ b/contrib/libucl/src/ucl_emitter_utils.c @@ -0,0 +1,466 @@ +/* Copyright (c) 2014, Vsevolod Stakhov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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 ''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 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 HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ucl.h" +#include "ucl_internal.h" +#include "ucl_chartable.h" + +#ifdef HAVE_FLOAT_H +#include +#endif +#ifdef HAVE_MATH_H +#include +#endif + +extern const struct ucl_emitter_operations ucl_standartd_emitter_ops[]; + +static const struct ucl_emitter_context ucl_standard_emitters[] = { + [UCL_EMIT_JSON] = { + .name = "json", + .id = UCL_EMIT_JSON, + .func = NULL, + .ops = &ucl_standartd_emitter_ops[UCL_EMIT_JSON] + }, + [UCL_EMIT_JSON_COMPACT] = { + .name = "json_compact", + .id = UCL_EMIT_JSON_COMPACT, + .func = NULL, + .ops = &ucl_standartd_emitter_ops[UCL_EMIT_JSON_COMPACT] + }, + [UCL_EMIT_CONFIG] = { + .name = "config", + .id = UCL_EMIT_CONFIG, + .func = NULL, + .ops = &ucl_standartd_emitter_ops[UCL_EMIT_CONFIG] + }, + [UCL_EMIT_YAML] = { + .name = "yaml", + .id = UCL_EMIT_YAML, + .func = NULL, + .ops = &ucl_standartd_emitter_ops[UCL_EMIT_YAML] + } +}; + +/** + * Get standard emitter context for a specified emit_type + * @param emit_type type of emitter + * @return context or NULL if input is invalid + */ +const struct ucl_emitter_context * +ucl_emit_get_standard_context (enum ucl_emitter emit_type) +{ + if (emit_type >= UCL_EMIT_JSON && emit_type <= UCL_EMIT_YAML) { + return &ucl_standard_emitters[emit_type]; + } + + return NULL; +} + +/** + * Serialise string + * @param str string to emit + * @param buf target buffer + */ +void +ucl_elt_string_write_json (const char *str, size_t size, + struct ucl_emitter_context *ctx) +{ + const char *p = str, *c = str; + size_t len = 0; + const struct ucl_emitter_functions *func = ctx->func; + + if (ctx->id != UCL_EMIT_YAML) { + func->ucl_emitter_append_character ('"', 1, func->ud); + } + + while (size) { + if (ucl_test_character (*p, UCL_CHARACTER_JSON_UNSAFE)) { + if (len > 0) { + func->ucl_emitter_append_len (c, len, func->ud); + } + switch (*p) { + case '\n': + func->ucl_emitter_append_len ("\\n", 2, func->ud); + break; + case '\r': + func->ucl_emitter_append_len ("\\r", 2, func->ud); + break; + case '\b': + func->ucl_emitter_append_len ("\\b", 2, func->ud); + break; + case '\t': + func->ucl_emitter_append_len ("\\t", 2, func->ud); + break; + case '\f': + func->ucl_emitter_append_len ("\\f", 2, func->ud); + break; + case '\\': + func->ucl_emitter_append_len ("\\\\", 2, func->ud); + break; + case '"': + func->ucl_emitter_append_len ("\\\"", 2, func->ud); + break; + } + len = 0; + c = ++p; + } + else { + p ++; + len ++; + } + size --; + } + if (len > 0) { + func->ucl_emitter_append_len (c, len, func->ud); + } + if (ctx->id != UCL_EMIT_YAML) { + func->ucl_emitter_append_character ('"', 1, func->ud); + } +} + +/* + * Generic utstring output + */ +static int +ucl_utstring_append_character (unsigned char c, size_t len, void *ud) +{ + UT_string *buf = ud; + + if (len == 1) { + utstring_append_c (buf, c); + } + else { + utstring_reserve (buf, len); + memset (&buf->d[buf->i], c, len); + buf->i += len; + buf->d[buf->i] = '\0'; + } + + return 0; +} + +static int +ucl_utstring_append_len (const unsigned char *str, size_t len, void *ud) +{ + UT_string *buf = ud; + + utstring_append_len (buf, str, len); + + return 0; +} + +static int +ucl_utstring_append_int (int64_t val, void *ud) +{ + UT_string *buf = ud; + + utstring_printf (buf, "%jd", (intmax_t)val); + return 0; +} + +static int +ucl_utstring_append_double (double val, void *ud) +{ + UT_string *buf = ud; + const double delta = 0.0000001; + + if (val == (double)(int)val) { + utstring_printf (buf, "%.1lf", val); + } + else if (fabs (val - (double)(int)val) < delta) { + /* Write at maximum precision */ + utstring_printf (buf, "%.*lg", DBL_DIG, val); + } + else { + utstring_printf (buf, "%lf", val); + } + + return 0; +} + +/* + * Generic file output + */ +static int +ucl_file_append_character (unsigned char c, size_t len, void *ud) +{ + FILE *fp = ud; + + while (len --) { + fputc (c, fp); + } + + return 0; +} + +static int +ucl_file_append_len (const unsigned char *str, size_t len, void *ud) +{ + FILE *fp = ud; + + fwrite (str, len, 1, fp); + + return 0; +} + +static int +ucl_file_append_int (int64_t val, void *ud) +{ + FILE *fp = ud; + + fprintf (fp, "%jd", (intmax_t)val); + + return 0; +} + +static int +ucl_file_append_double (double val, void *ud) +{ + FILE *fp = ud; + const double delta = 0.0000001; + + if (val == (double)(int)val) { + fprintf (fp, "%.1lf", val); + } + else if (fabs (val - (double)(int)val) < delta) { + /* Write at maximum precision */ + fprintf (fp, "%.*lg", DBL_DIG, val); + } + else { + fprintf (fp, "%lf", val); + } + + return 0; +} + +/* + * Generic file descriptor writing functions + */ +static int +ucl_fd_append_character (unsigned char c, size_t len, void *ud) +{ + int fd = *(int *)ud; + unsigned char *buf; + + if (len == 1) { + write (fd, &c, 1); + } + else { + buf = malloc (len); + if (buf == NULL) { + /* Fallback */ + while (len --) { + write (fd, &c, 1); + } + } + else { + memset (buf, c, len); + write (fd, buf, len); + free (buf); + } + } + + return 0; +} + +static int +ucl_fd_append_len (const unsigned char *str, size_t len, void *ud) +{ + int fd = *(int *)ud; + + write (fd, str, len); + + return 0; +} + +static int +ucl_fd_append_int (int64_t val, void *ud) +{ + int fd = *(int *)ud; + char intbuf[64]; + + snprintf (intbuf, sizeof (intbuf), "%jd", (intmax_t)val); + write (fd, intbuf, strlen (intbuf)); + + return 0; +} + +static int +ucl_fd_append_double (double val, void *ud) +{ + int fd = *(int *)ud; + const double delta = 0.0000001; + char nbuf[64]; + + if (val == (double)(int)val) { + snprintf (nbuf, sizeof (nbuf), "%.1lf", val); + } + else if (fabs (val - (double)(int)val) < delta) { + /* Write at maximum precision */ + snprintf (nbuf, sizeof (nbuf), "%.*lg", DBL_DIG, val); + } + else { + snprintf (nbuf, sizeof (nbuf), "%lf", val); + } + + write (fd, nbuf, strlen (nbuf)); + + return 0; +} + +struct ucl_emitter_functions* +ucl_object_emit_memory_funcs (void **pmem) +{ + struct ucl_emitter_functions *f; + UT_string *s; + + f = calloc (1, sizeof (*f)); + + if (f != NULL) { + f->ucl_emitter_append_character = ucl_utstring_append_character; + f->ucl_emitter_append_double = ucl_utstring_append_double; + f->ucl_emitter_append_int = ucl_utstring_append_int; + f->ucl_emitter_append_len = ucl_utstring_append_len; + f->ucl_emitter_free_func = free; + utstring_new (s); + f->ud = s; + *pmem = s->d; + s->pd = pmem; + } + + return f; +} + +struct ucl_emitter_functions* +ucl_object_emit_file_funcs (FILE *fp) +{ + struct ucl_emitter_functions *f; + + f = calloc (1, sizeof (*f)); + + if (f != NULL) { + f->ucl_emitter_append_character = ucl_file_append_character; + f->ucl_emitter_append_double = ucl_file_append_double; + f->ucl_emitter_append_int = ucl_file_append_int; + f->ucl_emitter_append_len = ucl_file_append_len; + f->ucl_emitter_free_func = NULL; + f->ud = fp; + } + + return f; +} + +struct ucl_emitter_functions* +ucl_object_emit_fd_funcs (int fd) +{ + struct ucl_emitter_functions *f; + int *ip; + + f = calloc (1, sizeof (*f)); + + if (f != NULL) { + ip = malloc (sizeof (fd)); + if (ip == NULL) { + free (f); + return NULL; + } + + memcpy (ip, &fd, sizeof (fd)); + f->ucl_emitter_append_character = ucl_fd_append_character; + f->ucl_emitter_append_double = ucl_fd_append_double; + f->ucl_emitter_append_int = ucl_fd_append_int; + f->ucl_emitter_append_len = ucl_fd_append_len; + f->ucl_emitter_free_func = free; + f->ud = ip; + } + + return f; +} + +void +ucl_object_emit_funcs_free (struct ucl_emitter_functions *f) +{ + if (f != NULL) { + if (f->ucl_emitter_free_func != NULL) { + f->ucl_emitter_free_func (f->ud); + } + free (f); + } +} + + +unsigned char * +ucl_object_emit_single_json (const ucl_object_t *obj) +{ + UT_string *buf = NULL; + unsigned char *res = NULL; + + if (obj == NULL) { + return NULL; + } + + utstring_new (buf); + + if (buf != NULL) { + switch (obj->type) { + case UCL_OBJECT: + ucl_utstring_append_len ("object", 6, buf); + break; + case UCL_ARRAY: + ucl_utstring_append_len ("array", 5, buf); + break; + case UCL_INT: + ucl_utstring_append_int (obj->value.iv, buf); + break; + case UCL_FLOAT: + case UCL_TIME: + ucl_utstring_append_double (obj->value.dv, buf); + break; + case UCL_NULL: + ucl_utstring_append_len ("null", 4, buf); + break; + case UCL_BOOLEAN: + if (obj->value.iv) { + ucl_utstring_append_len ("true", 4, buf); + } + else { + ucl_utstring_append_len ("false", 5, buf); + } + break; + case UCL_STRING: + ucl_utstring_append_len (obj->value.sv, obj->len, buf); + break; + case UCL_USERDATA: + ucl_utstring_append_len ("userdata", 8, buf); + break; + } + res = utstring_body (buf); + free (buf); + } + + return res; +} diff --git a/contrib/libucl/src/ucl_internal.h b/contrib/libucl/src/ucl_internal.h index 9a35dcec40b..0ac8de84c2e 100644 --- a/contrib/libucl/src/ucl_internal.h +++ b/contrib/libucl/src/ucl_internal.h @@ -197,6 +197,8 @@ struct ucl_parser { struct ucl_chunk *chunks; struct ucl_pubkey *keys; struct ucl_variable *variables; + ucl_variable_handler var_handler; + void *var_data; UT_string *err; }; @@ -340,6 +342,22 @@ ucl_hash_insert_object (ucl_hash_t *hashlin, const ucl_object_t *obj) return hashlin; } +/** + * Get standard emitter context for a specified emit_type + * @param emit_type type of emitter + * @return context or NULL if input is invalid + */ +const struct ucl_emitter_context * +ucl_emit_get_standard_context (enum ucl_emitter emit_type); + +/** + * Serialise string + * @param str string to emit + * @param buf target buffer + */ +void ucl_elt_string_write_json (const char *str, size_t size, + struct ucl_emitter_context *ctx); + /** * Emit a single object to string * @param obj diff --git a/contrib/libucl/src/ucl_parser.c b/contrib/libucl/src/ucl_parser.c index d5a085ebf82..e51a54b77bc 100644 --- a/contrib/libucl/src/ucl_parser.c +++ b/contrib/libucl/src/ucl_parser.c @@ -236,6 +236,9 @@ ucl_check_variable_safe (struct ucl_parser *parser, const char *ptr, size_t rema size_t *out_len, bool strict, bool *found) { struct ucl_variable *var; + unsigned char *dst; + size_t dstlen; + bool need_free = false; LL_FOREACH (parser->variables, var) { if (strict) { @@ -258,6 +261,19 @@ ucl_check_variable_safe (struct ucl_parser *parser, const char *ptr, size_t rema } } + /* XXX: can only handle ${VAR} */ + if (!(*found) && parser->var_handler != NULL && strict) { + /* Call generic handler */ + if (parser->var_handler (ptr, remain, &dst, &dstlen, &need_free, + parser->var_data)) { + *found = true; + if (need_free) { + free (dst); + } + return (ptr + remain); + } + } + return ptr; } @@ -271,7 +287,8 @@ ucl_check_variable_safe (struct ucl_parser *parser, const char *ptr, size_t rema * @return */ static const char * -ucl_check_variable (struct ucl_parser *parser, const char *ptr, size_t remain, size_t *out_len, bool *vars_found) +ucl_check_variable (struct ucl_parser *parser, const char *ptr, + size_t remain, size_t *out_len, bool *vars_found) { const char *p, *end, *ret = ptr; bool found = false; @@ -282,7 +299,8 @@ ucl_check_variable (struct ucl_parser *parser, const char *ptr, size_t remain, s end = ptr + remain; while (p < end) { if (*p == '}') { - ret = ucl_check_variable_safe (parser, ptr + 1, p - ptr - 1, out_len, true, &found); + ret = ucl_check_variable_safe (parser, ptr + 1, p - ptr - 1, + out_len, true, &found); if (found) { /* {} must be excluded actually */ ret ++; @@ -328,10 +346,13 @@ static const char * ucl_expand_single_variable (struct ucl_parser *parser, const char *ptr, size_t remain, unsigned char **dest) { - unsigned char *d = *dest; + unsigned char *d = *dest, *dst; const char *p = ptr + 1, *ret; struct ucl_variable *var; + size_t dstlen; + bool need_free = false; bool found = false; + bool strict = false; ret = ptr + 1; remain --; @@ -343,6 +364,7 @@ ucl_expand_single_variable (struct ucl_parser *parser, const char *ptr, } else if (*p == '{') { p ++; + strict = true; ret += 2; remain -= 2; } @@ -359,9 +381,29 @@ ucl_expand_single_variable (struct ucl_parser *parser, const char *ptr, } } if (!found) { - memcpy (d, ptr, 2); - d += 2; - ret --; + if (strict && parser->var_handler != NULL) { + if (parser->var_handler (ptr, remain, &dst, &dstlen, &need_free, + parser->var_data)) { + memcpy (d, dst, dstlen); + ret += dstlen; + d += remain; + found = true; + } + } + + /* Leave variable as is */ + if (!found) { + if (strict) { + /* Copy '${' */ + memcpy (d, ptr, 2); + d += 2; + ret --; + } + else { + memcpy (d, ptr, 1); + d ++; + } + } } *dest = d; @@ -1619,6 +1661,11 @@ ucl_state_machine (struct ucl_parser *parser) return false; } else { + /* Skip any spaces */ + while (p < chunk->end && ucl_test_character (*p, + UCL_CHARACTER_WHITESPACE_UNSAFE)) { + ucl_chunk_skipc (chunk, p); + } p = chunk->pos; if (*p == '[') { parser->state = UCL_STATE_VALUE; @@ -1873,6 +1920,14 @@ ucl_parser_register_variable (struct ucl_parser *parser, const char *var, } } +void +ucl_parser_set_variables_handler (struct ucl_parser *parser, + ucl_variable_handler handler, void *ud) +{ + parser->var_handler = handler; + parser->var_data = ud; +} + bool ucl_parser_add_chunk (struct ucl_parser *parser, const unsigned char *data, size_t len) diff --git a/contrib/libucl/src/ucl_util.c b/contrib/libucl/src/ucl_util.c index 9178795d944..63f5e629826 100644 --- a/contrib/libucl/src/ucl_util.c +++ b/contrib/libucl/src/ucl_util.c @@ -1330,20 +1330,10 @@ ucl_object_find_keyl (const ucl_object_t *obj, const char *key, size_t klen) const ucl_object_t * ucl_object_find_key (const ucl_object_t *obj, const char *key) { - size_t klen; - const ucl_object_t *ret; - ucl_object_t srch; - - if (obj == NULL || obj->type != UCL_OBJECT || key == NULL) { + if (key == NULL) return NULL; - } - klen = strlen (key); - srch.key = key; - srch.keylen = klen; - ret = ucl_hash_search_obj (obj->value.ov, &srch); - - return ret; + return ucl_object_find_keyl (obj, key, strlen(key)); } const ucl_object_t* @@ -1396,6 +1386,58 @@ ucl_iterate_object (const ucl_object_t *obj, ucl_object_iter_t *iter, bool expan return NULL; } +const ucl_object_t * +ucl_lookup_path (const ucl_object_t *top, const char *path_in) { + const ucl_object_t *o = NULL, *found; + const char *p, *c; + char *err_str; + unsigned index; + + if (path_in == NULL || top == NULL) { + return NULL; + } + + found = NULL; + p = path_in; + + /* Skip leading dots */ + while (*p == '.') { + p ++; + } + + c = p; + while (*p != '\0') { + p ++; + if (*p == '.' || *p == '\0') { + if (p > c) { + switch (top->type) { + case UCL_ARRAY: + /* Key should be an int */ + index = strtoul (c, &err_str, 10); + if (err_str != NULL && (*err_str != '.' && *err_str != '\0')) { + return NULL; + } + o = ucl_array_find_index (top, index); + break; + default: + o = ucl_object_find_keyl (top, c, p - c); + break; + } + if (o == NULL) { + return NULL; + } + top = o; + } + if (*p != '\0') { + c = p + 1; + } + } + } + found = o; + + return found; +} + ucl_object_t * ucl_object_new (void) @@ -1411,7 +1453,7 @@ ucl_object_new (void) } ucl_object_t * -ucl_object_typed_new (unsigned int type) +ucl_object_typed_new (ucl_type_t type) { ucl_object_t *new; new = malloc (sizeof (ucl_object_t)); @@ -1423,6 +1465,12 @@ ucl_object_typed_new (unsigned int type) return new; } +ucl_type_t +ucl_object_type (const ucl_object_t *obj) +{ + return obj->type; +} + ucl_object_t* ucl_object_fromstring (const char *str) { @@ -1591,6 +1639,27 @@ ucl_array_pop_first (ucl_object_t *top) return ucl_array_delete (top, __DECONST(ucl_object_t *, ucl_array_head (top))); } +const ucl_object_t * +ucl_array_find_index (const ucl_object_t *top, unsigned int index) +{ + ucl_object_iter_t it = NULL; + const ucl_object_t *ret; + + if (top == NULL || top->type != UCL_ARRAY || top->len == 0 || + (index + 1) > top->len) { + return NULL; + } + + while ((ret = ucl_iterate_object (top, &it, true)) != NULL) { + if (index == 0) { + return ret; + } + --index; + } + + return NULL; +} + ucl_object_t * ucl_elt_append (ucl_object_t *head, ucl_object_t *elt) { diff --git a/contrib/libucl/tests/Makefile.am b/contrib/libucl/tests/Makefile.am index efc93506c1e..a21a65c1653 100644 --- a/contrib/libucl/tests/Makefile.am +++ b/contrib/libucl/tests/Makefile.am @@ -3,7 +3,8 @@ EXTRA_DIST = $(TESTS) basic schema generate.res rcl_test.json.xz TESTS = basic.test \ generate.test \ schema.test \ - speed.test + speed.test \ + streamline.test TESTS_ENVIRONMENT = $(SH) \ TEST_DIR=$(top_srcdir)/tests \ TEST_OUT_DIR=$(top_builddir)/tests \ @@ -30,4 +31,8 @@ test_schema_SOURCES = test_schema.c test_schema_LDADD = $(common_test_ldadd) test_schema_CFLAGS = $(common_test_cflags) -check_PROGRAMS = test_basic test_speed test_generate test_schema +test_streamline_SOURCES = test_streamline.c +test_streamline_LDADD = $(common_test_ldadd) +test_streamline_CFLAGS = $(common_test_cflags) + +check_PROGRAMS = test_basic test_speed test_generate test_schema test_streamline \ No newline at end of file diff --git a/contrib/libucl/tests/basic/11.in b/contrib/libucl/tests/basic/11.in new file mode 100644 index 00000000000..3131fc7e154 --- /dev/null +++ b/contrib/libucl/tests/basic/11.in @@ -0,0 +1,3 @@ + + + {"key": "value"} diff --git a/contrib/libucl/tests/basic/11.res b/contrib/libucl/tests/basic/11.res new file mode 100644 index 00000000000..4b17c4b4eb1 --- /dev/null +++ b/contrib/libucl/tests/basic/11.res @@ -0,0 +1,2 @@ +key = "value"; + diff --git a/contrib/libucl/tests/streamline.res b/contrib/libucl/tests/streamline.res new file mode 100644 index 00000000000..5eb18d7c273 --- /dev/null +++ b/contrib/libucl/tests/streamline.res @@ -0,0 +1,8 @@ +key1 = "test string"; +key2 = "test \\nstring"; +key3 = " test string \n"; +key4 [ + 10, + 10.100000, + 9.999000, +] diff --git a/contrib/libucl/tests/streamline.test b/contrib/libucl/tests/streamline.test new file mode 100755 index 00000000000..dbe583622fc --- /dev/null +++ b/contrib/libucl/tests/streamline.test @@ -0,0 +1,12 @@ +#!/bin/sh + +PROG=${TEST_BINARY_DIR}/test_streamline + +$PROG ${TEST_OUT_DIR}/streamline.out +diff -s ${TEST_OUT_DIR}/streamline.out ${TEST_DIR}/streamline.res -u 2>/dev/null +if [ $? -ne 0 ] ; then + rm ${TEST_OUT_DIR}/streamline.out + echo "Test: streamline.res output missmatch" + exit 1 +fi +rm ${TEST_OUT_DIR}/streamline.out \ No newline at end of file diff --git a/contrib/libucl/tests/test_basic.c b/contrib/libucl/tests/test_basic.c index 5a977aa7191..b4ed7788dce 100644 --- a/contrib/libucl/tests/test_basic.c +++ b/contrib/libucl/tests/test_basic.c @@ -33,15 +33,21 @@ main (int argc, char **argv) FILE *in, *out; unsigned char *emitted = NULL; const char *fname_in = NULL, *fname_out = NULL; - int ret = 0, inlen, opt, json = 0; + int ret = 0, inlen, opt, json = 0, compact = 0, yaml = 0; - while ((opt = getopt(argc, argv, "j")) != -1) { + while ((opt = getopt(argc, argv, "jcy")) != -1) { switch (opt) { case 'j': json = 1; break; + case 'c': + compact = 1; + break; + case 'y': + yaml = 1; + break; default: /* '?' */ - fprintf (stderr, "Usage: %s [-j] [in] [out]\n", + fprintf (stderr, "Usage: %s [-jcy] [in] [out]\n", argv[0]); exit (EXIT_FAILURE); } @@ -104,7 +110,15 @@ main (int argc, char **argv) } obj = ucl_parser_get_object (parser); if (json) { - emitted = ucl_object_emit (obj, UCL_EMIT_JSON); + if (compact) { + emitted = ucl_object_emit (obj, UCL_EMIT_JSON_COMPACT); + } + else { + emitted = ucl_object_emit (obj, UCL_EMIT_JSON); + } + } + else if (yaml) { + emitted = ucl_object_emit (obj, UCL_EMIT_YAML); } else { emitted = ucl_object_emit (obj, UCL_EMIT_CONFIG); @@ -125,7 +139,15 @@ main (int argc, char **argv) } obj = ucl_parser_get_object (parser2); if (json) { - emitted = ucl_object_emit (obj, UCL_EMIT_JSON); + if (compact) { + emitted = ucl_object_emit (obj, UCL_EMIT_JSON_COMPACT); + } + else { + emitted = ucl_object_emit (obj, UCL_EMIT_JSON); + } + } + else if (yaml) { + emitted = ucl_object_emit (obj, UCL_EMIT_YAML); } else { emitted = ucl_object_emit (obj, UCL_EMIT_CONFIG); diff --git a/contrib/libucl/tests/test_generate.c b/contrib/libucl/tests/test_generate.c index 2b1bf8d73a3..5c130e67499 100644 --- a/contrib/libucl/tests/test_generate.c +++ b/contrib/libucl/tests/test_generate.c @@ -30,6 +30,7 @@ int main (int argc, char **argv) { ucl_object_t *obj, *cur, *ar, *ref; + const ucl_object_t *found; FILE *out; unsigned char *emitted; const char *fname_out = NULL; @@ -114,6 +115,23 @@ main (int argc, char **argv) cur = ucl_object_frombool (true); ucl_object_insert_key (obj, cur, "k=3", 0, false); + /* Try to find using path */ + /* Should exist */ + found = ucl_lookup_path (obj, "key4.1"); + assert (found != NULL && ucl_object_toint (found) == 10); + /* . should be ignored */ + found = ucl_lookup_path (obj, ".key4.1"); + assert (found != NULL && ucl_object_toint (found) == 10); + /* moar dots... */ + found = ucl_lookup_path (obj, ".key4........1..."); + assert (found != NULL && ucl_object_toint (found) == 10); + /* No such index */ + found = ucl_lookup_path (obj, ".key4.3"); + assert (found == NULL); + /* No such key */ + found = ucl_lookup_path (obj, "key9..key1"); + assert (found == NULL); + emitted = ucl_object_emit (obj, UCL_EMIT_CONFIG); fprintf (out, "%s\n", emitted); diff --git a/contrib/libucl/tests/test_streamline.c b/contrib/libucl/tests/test_streamline.c new file mode 100644 index 00000000000..4c56c4cdcff --- /dev/null +++ b/contrib/libucl/tests/test_streamline.c @@ -0,0 +1,92 @@ +/* Copyright (c) 2013, Vsevolod Stakhov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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 ''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 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 "ucl.h" + +int +main (int argc, char **argv) +{ + ucl_object_t *obj, *cur, *ar; + FILE *out; + const char *fname_out = NULL; + struct ucl_emitter_context *ctx; + struct ucl_emitter_functions *f; + int ret = 0; + + switch (argc) { + case 2: + fname_out = argv[1]; + break; + } + + if (fname_out != NULL) { + out = fopen (fname_out, "w"); + if (out == NULL) { + exit (-errno); + } + } + else { + out = stdout; + } + + obj = ucl_object_typed_new (UCL_OBJECT); + + /* Create some strings */ + cur = ucl_object_fromstring_common (" test string ", 0, UCL_STRING_TRIM); + ucl_object_insert_key (obj, cur, "key1", 0, false); + cur = ucl_object_fromstring_common (" test \nstring\n ", 0, UCL_STRING_TRIM | UCL_STRING_ESCAPE); + ucl_object_insert_key (obj, cur, "key2", 0, false); + cur = ucl_object_fromstring_common (" test string \n", 0, 0); + ucl_object_insert_key (obj, cur, "key3", 0, false); + + f = ucl_object_emit_file_funcs (out); + ctx = ucl_object_emit_streamline_new (obj, UCL_EMIT_CONFIG, f); + + assert (ctx != NULL); + + /* Array of numbers */ + ar = ucl_object_typed_new (UCL_ARRAY); + ar->key = "key4"; + ar->keylen = sizeof ("key4") - 1; + + ucl_object_emit_streamline_start_container (ctx, ar); + cur = ucl_object_fromint (10); + ucl_object_emit_streamline_add_object (ctx, cur); + cur = ucl_object_fromdouble (10.1); + ucl_object_emit_streamline_add_object (ctx, cur); + cur = ucl_object_fromdouble (9.999); + ucl_object_emit_streamline_add_object (ctx, cur); + + + ucl_object_emit_streamline_end_container (ctx); + ucl_object_emit_streamline_finish (ctx); + ucl_object_emit_funcs_free (f); + ucl_object_unref (obj); + + fclose (out); + + return ret; +} diff --git a/contrib/libucl/uthash/utstring.h b/contrib/libucl/uthash/utstring.h index 4ef7b5690dc..f11f34b77e7 100644 --- a/contrib/libucl/uthash/utstring.h +++ b/contrib/libucl/uthash/utstring.h @@ -44,6 +44,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. typedef struct { char *d; + void **pd; size_t n; /* allocd size */ size_t i; /* index of first unused byte */ } UT_string; @@ -54,6 +55,7 @@ do { \ (s)->d = (char*)realloc((s)->d, (s)->n + amt); \ if ((s)->d == NULL) oom(); \ (s)->n += amt; \ + if ((s)->pd) *((s)->pd) = (s)->d; \ } \ } while(0) @@ -78,7 +80,7 @@ do { \ #define utstring_new(s) \ do { \ - s = (UT_string*)calloc(sizeof(UT_string),1); \ + s = (UT_string*)calloc(1, sizeof(UT_string)); \ if (!s) oom(); \ utstring_init(s); \ } while(0) diff --git a/contrib/llvm/include/llvm/IR/IntrinsicsX86.td b/contrib/llvm/include/llvm/IR/IntrinsicsX86.td index 4c5718f8c8b..46c32ae2fd0 100644 --- a/contrib/llvm/include/llvm/IR/IntrinsicsX86.td +++ b/contrib/llvm/include/llvm/IR/IntrinsicsX86.td @@ -1758,68 +1758,68 @@ let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.". def int_x86_avx2_gather_d_pd : GCCBuiltin<"__builtin_ia32_gatherd_pd">, Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_v2f64_ty, llvm_i8_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; def int_x86_avx2_gather_d_pd_256 : GCCBuiltin<"__builtin_ia32_gatherd_pd256">, Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_v4f64_ty, llvm_i8_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; def int_x86_avx2_gather_q_pd : GCCBuiltin<"__builtin_ia32_gatherq_pd">, Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_ptr_ty, llvm_v2i64_ty, llvm_v2f64_ty, llvm_i8_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; def int_x86_avx2_gather_q_pd_256 : GCCBuiltin<"__builtin_ia32_gatherq_pd256">, Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty, llvm_ptr_ty, llvm_v4i64_ty, llvm_v4f64_ty, llvm_i8_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; def int_x86_avx2_gather_d_ps : GCCBuiltin<"__builtin_ia32_gatherd_ps">, Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_v4f32_ty, llvm_i8_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; def int_x86_avx2_gather_d_ps_256 : GCCBuiltin<"__builtin_ia32_gatherd_ps256">, Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty, llvm_ptr_ty, llvm_v8i32_ty, llvm_v8f32_ty, llvm_i8_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; def int_x86_avx2_gather_q_ps : GCCBuiltin<"__builtin_ia32_gatherq_ps">, Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_ptr_ty, llvm_v2i64_ty, llvm_v4f32_ty, llvm_i8_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; def int_x86_avx2_gather_q_ps_256 : GCCBuiltin<"__builtin_ia32_gatherq_ps256">, Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_ptr_ty, llvm_v4i64_ty, llvm_v4f32_ty, llvm_i8_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; def int_x86_avx2_gather_d_q : GCCBuiltin<"__builtin_ia32_gatherd_q">, Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_v2i64_ty, llvm_i8_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; def int_x86_avx2_gather_d_q_256 : GCCBuiltin<"__builtin_ia32_gatherd_q256">, Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_v4i64_ty, llvm_i8_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; def int_x86_avx2_gather_q_q : GCCBuiltin<"__builtin_ia32_gatherq_q">, Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_ptr_ty, llvm_v2i64_ty, llvm_v2i64_ty, llvm_i8_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; def int_x86_avx2_gather_q_q_256 : GCCBuiltin<"__builtin_ia32_gatherq_q256">, Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, llvm_ptr_ty, llvm_v4i64_ty, llvm_v4i64_ty, llvm_i8_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; def int_x86_avx2_gather_d_d : GCCBuiltin<"__builtin_ia32_gatherd_d">, Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_v4i32_ty, llvm_i8_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; def int_x86_avx2_gather_d_d_256 : GCCBuiltin<"__builtin_ia32_gatherd_d256">, Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_ptr_ty, llvm_v8i32_ty, llvm_v8i32_ty, llvm_i8_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; def int_x86_avx2_gather_q_d : GCCBuiltin<"__builtin_ia32_gatherq_d">, Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_ptr_ty, llvm_v2i64_ty, llvm_v4i32_ty, llvm_i8_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; def int_x86_avx2_gather_q_d_256 : GCCBuiltin<"__builtin_ia32_gatherq_d256">, Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_ptr_ty, llvm_v4i64_ty, llvm_v4i32_ty, llvm_i8_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; } // Misc. @@ -2909,28 +2909,28 @@ let TargetPrefix = "x86" in { def int_x86_avx512_gather_dpd_mask_512 : GCCBuiltin<"__builtin_ia32_mask_gatherdpd512">, Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty, llvm_i8_ty, llvm_v8i32_ty, llvm_ptr_ty, llvm_i32_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; def int_x86_avx512_gather_dps_mask_512 : GCCBuiltin<"__builtin_ia32_mask_gatherdps512">, Intrinsic<[llvm_v16f32_ty], [llvm_v16f32_ty, llvm_i16_ty, llvm_v16i32_ty, llvm_ptr_ty, llvm_i32_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; def int_x86_avx512_gather_qpd_mask_512 : GCCBuiltin<"__builtin_ia32_mask_gatherqpd512">, Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty, llvm_i8_ty, llvm_v8i64_ty, llvm_ptr_ty, llvm_i32_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; def int_x86_avx512_gather_qps_mask_512 : GCCBuiltin<"__builtin_ia32_mask_gatherqps512">, Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty, llvm_i8_ty, llvm_v8i64_ty, llvm_ptr_ty, llvm_i32_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; def int_x86_avx512_gather_dpd_512 : GCCBuiltin<"__builtin_ia32_gatherdpd512">, Intrinsic<[llvm_v8f64_ty], [llvm_v8i32_ty, llvm_ptr_ty, llvm_i32_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; def int_x86_avx512_gather_dps_512 : GCCBuiltin<"__builtin_ia32_gatherdps512">, Intrinsic<[llvm_v16f32_ty], [llvm_v16i32_ty, llvm_ptr_ty, llvm_i32_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; def int_x86_avx512_gather_qpd_512 : GCCBuiltin<"__builtin_ia32_gatherqpd512">, Intrinsic<[llvm_v8f64_ty], [llvm_v8i64_ty, llvm_ptr_ty, llvm_i32_ty], @@ -2938,12 +2938,12 @@ let TargetPrefix = "x86" in { def int_x86_avx512_gather_qps_512 : GCCBuiltin<"__builtin_ia32_gatherqps512">, Intrinsic<[llvm_v8f32_ty], [llvm_v8i64_ty, llvm_ptr_ty, llvm_i32_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; def int_x86_avx512_gather_dpq_mask_512 : GCCBuiltin<"__builtin_ia32_mask_gatherdpq512">, Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_i8_ty, llvm_v8i32_ty, llvm_ptr_ty, llvm_i32_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; def int_x86_avx512_gather_dpi_mask_512 : GCCBuiltin<"__builtin_ia32_mask_gatherdpi512">, Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty, llvm_i16_ty, llvm_v16i32_ty, llvm_ptr_ty, llvm_i32_ty], @@ -2955,7 +2955,7 @@ let TargetPrefix = "x86" in { def int_x86_avx512_gather_qpi_mask_512 : GCCBuiltin<"__builtin_ia32_mask_gatherqpi512">, Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_i8_ty, llvm_v8i64_ty, llvm_ptr_ty, llvm_i32_ty], - [IntrReadMem]>; + [IntrReadArgMem]>; def int_x86_avx512_gather_dpq_512 : GCCBuiltin<"__builtin_ia32_gatherdpq512">, Intrinsic<[llvm_v8i64_ty], [llvm_v8i32_ty, llvm_ptr_ty, diff --git a/contrib/llvm/include/llvm/MC/MCAsmInfo.h b/contrib/llvm/include/llvm/MC/MCAsmInfo.h index aba8bcbc3f4..f5ca921d378 100644 --- a/contrib/llvm/include/llvm/MC/MCAsmInfo.h +++ b/contrib/llvm/include/llvm/MC/MCAsmInfo.h @@ -266,13 +266,16 @@ namespace llvm { /// global as being a weak undefined symbol. const char *WeakRefDirective; // Defaults to NULL. - /// WeakDefDirective - This directive, if non-null, is used to declare a - /// global as being a weak defined symbol. - const char *WeakDefDirective; // Defaults to NULL. + /// True if we have a directive to declare a global as being a weak + /// defined symbol. + bool HasWeakDefDirective; // Defaults to false. - /// LinkOnceDirective - This directive, if non-null is used to declare a - /// global as being a weak defined symbol. This is used on cygwin/mingw. - const char *LinkOnceDirective; // Defaults to NULL. + /// True if we have a directive to declare a global as being a weak + /// defined symbol that can be hidden (unexported). + bool HasWeakDefCanBeHiddenDirective; // Defaults to false. + + /// True if we have a .linkonce directive. This is used on cygwin/mingw. + bool HasLinkOnceDirective; // Defaults to false. /// HiddenVisibilityAttr - This attribute, if not MCSA_Invalid, is used to /// declare a symbol as having hidden visibility. @@ -303,6 +306,10 @@ namespace llvm { /// uses relocations for references to other .debug_* sections. bool DwarfUsesRelocationsAcrossSections; + /// DwarfFDESymbolsUseAbsDiff - true if DWARF FDE symbol reference + /// relocations should be replaced by an absolute difference. + bool DwarfFDESymbolsUseAbsDiff; + /// DwarfRegNumForCFI - True if dwarf register numbers are printed /// instead of symbolic register names in .cfi_* directives. bool DwarfRegNumForCFI; // Defaults to false; @@ -497,8 +504,11 @@ namespace llvm { bool hasIdentDirective() const { return HasIdentDirective; } bool hasNoDeadStrip() const { return HasNoDeadStrip; } const char *getWeakRefDirective() const { return WeakRefDirective; } - const char *getWeakDefDirective() const { return WeakDefDirective; } - const char *getLinkOnceDirective() const { return LinkOnceDirective; } + bool hasWeakDefDirective() const { return HasWeakDefDirective; } + bool hasWeakDefCanBeHiddenDirective() const { + return HasWeakDefCanBeHiddenDirective; + } + bool hasLinkOnceDirective() const { return HasLinkOnceDirective; } MCSymbolAttr getHiddenVisibilityAttr() const { return HiddenVisibilityAttr;} MCSymbolAttr getHiddenDeclarationVisibilityAttr() const { @@ -528,6 +538,9 @@ namespace llvm { bool doesDwarfUseRelocationsAcrossSections() const { return DwarfUsesRelocationsAcrossSections; } + bool doDwarfFDESymbolsUseAbsDiff() const { + return DwarfFDESymbolsUseAbsDiff; + } bool useDwarfRegNumForCFI() const { return DwarfRegNumForCFI; } diff --git a/contrib/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/contrib/llvm/lib/Analysis/BasicAliasAnalysis.cpp index b2c20110e90..d0e186c5f23 100644 --- a/contrib/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/contrib/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -18,7 +18,10 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/CaptureTracking.h" +#include "llvm/Analysis/CFG.h" +#include "llvm/Analysis/Dominators.h" #include "llvm/Analysis/InstructionSimplify.h" +#include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/MemoryBuiltins.h" #include "llvm/Analysis/ValueTracking.h" #include "llvm/IR/Constants.h" @@ -38,6 +41,12 @@ #include using namespace llvm; +/// Cutoff after which to stop analysing a set of phi nodes potentially involved +/// in a cycle. Because we are analysing 'through' phi nodes we need to be +/// careful with value equivalence. We use reachability to make sure a value +/// cannot be involved in a cycle. +const unsigned MaxNumPhiBBsValueReachabilityCheck = 20; + //===----------------------------------------------------------------------===// // Useful predicates //===----------------------------------------------------------------------===// @@ -403,42 +412,6 @@ DecomposeGEPExpression(const Value *V, int64_t &BaseOffs, return V; } -/// GetIndexDifference - Dest and Src are the variable indices from two -/// decomposed GetElementPtr instructions GEP1 and GEP2 which have common base -/// pointers. Subtract the GEP2 indices from GEP1 to find the symbolic -/// difference between the two pointers. -static void GetIndexDifference(SmallVectorImpl &Dest, - const SmallVectorImpl &Src) { - if (Src.empty()) return; - - for (unsigned i = 0, e = Src.size(); i != e; ++i) { - const Value *V = Src[i].V; - ExtensionKind Extension = Src[i].Extension; - int64_t Scale = Src[i].Scale; - - // Find V in Dest. This is N^2, but pointer indices almost never have more - // than a few variable indexes. - for (unsigned j = 0, e = Dest.size(); j != e; ++j) { - if (Dest[j].V != V || Dest[j].Extension != Extension) continue; - - // If we found it, subtract off Scale V's from the entry in Dest. If it - // goes to zero, remove the entry. - if (Dest[j].Scale != Scale) - Dest[j].Scale -= Scale; - else - Dest.erase(Dest.begin()+j); - Scale = 0; - break; - } - - // If we didn't consume this entry, add it to the end of the Dest list. - if (Scale) { - VariableGEPIndex Entry = { V, Extension, -Scale }; - Dest.push_back(Entry); - } - } -} - //===----------------------------------------------------------------------===// // BasicAliasAnalysis Pass //===----------------------------------------------------------------------===// @@ -492,6 +465,7 @@ namespace { // SmallDenseMap if it ever grows larger. // FIXME: This should really be shrink_to_inline_capacity_and_clear(). AliasCache.shrink_and_clear(); + VisitedPhiBBs.clear(); return Alias; } @@ -532,9 +506,39 @@ namespace { typedef SmallDenseMap AliasCacheTy; AliasCacheTy AliasCache; + /// \brief Track phi nodes we have visited. When interpret "Value" pointer + /// equality as value equality we need to make sure that the "Value" is not + /// part of a cycle. Otherwise, two uses could come from different + /// "iterations" of a cycle and see different values for the same "Value" + /// pointer. + /// The following example shows the problem: + /// %p = phi(%alloca1, %addr2) + /// %l = load %ptr + /// %addr1 = gep, %alloca2, 0, %l + /// %addr2 = gep %alloca2, 0, (%l + 1) + /// alias(%p, %addr1) -> MayAlias ! + /// store %l, ... + SmallPtrSet VisitedPhiBBs; + // Visited - Track instructions visited by pointsToConstantMemory. SmallPtrSet Visited; + /// \brief Check whether two Values can be considered equivalent. + /// + /// In addition to pointer equivalence of \p V1 and \p V2 this checks + /// whether they can not be part of a cycle in the value graph by looking at + /// all visited phi nodes an making sure that the phis cannot reach the + /// value. We have to do this because we are looking through phi nodes (That + /// is we say noalias(V, phi(VA, VB)) if noalias(V, VA) and noalias(V, VB). + bool isValueEqualInPotentialCycles(const Value *V1, const Value *V2); + + /// \brief Dest and Src are the variable indices from two decomposed + /// GetElementPtr instructions GEP1 and GEP2 which have common base + /// pointers. Subtract the GEP2 indices from GEP1 to find the symbolic + /// difference between the two pointers. + void GetIndexDifference(SmallVectorImpl &Dest, + const SmallVectorImpl &Src); + // aliasGEP - Provide a bunch of ad-hoc rules to disambiguate a GEP // instruction against another. AliasResult aliasGEP(const GEPOperator *V1, uint64_t V1Size, @@ -1005,7 +1009,15 @@ BasicAliasAnalysis::aliasGEP(const GEPOperator *GEP1, uint64_t V1Size, return NoAlias; } } else { - if (V1Size != UnknownSize) { + // We have the situation where: + // + + + // | BaseOffset | + // ---------------->| + // |-->V1Size |-------> V2Size + // GEP1 V2 + // We need to know that V2Size is not unknown, otherwise we might have + // stripped a gep with negative index ('gep , -1, ...). + if (V1Size != UnknownSize && V2Size != UnknownSize) { if (-(uint64_t)GEP1BaseOffset < V1Size) return PartialAlias; return NoAlias; @@ -1094,6 +1106,10 @@ BasicAliasAnalysis::aliasPHI(const PHINode *PN, uint64_t PNSize, const MDNode *PNTBAAInfo, const Value *V2, uint64_t V2Size, const MDNode *V2TBAAInfo) { + // Track phi nodes we have visited. We use this information when we determine + // value equivalence. + VisitedPhiBBs.insert(PN->getParent()); + // If the values are PHIs in the same block, we can do a more precise // as well as efficient check: just check for aliases between the values // on corresponding edges. @@ -1187,7 +1203,13 @@ BasicAliasAnalysis::aliasCheck(const Value *V1, uint64_t V1Size, V2 = V2->stripPointerCasts(); // Are we checking for alias of the same value? - if (V1 == V2) return MustAlias; + // Because we look 'through' phi nodes we could look at "Value" pointers from + // different iterations. We must therefore make sure that this is not the + // case. The function isValueEqualInPotentialCycles ensures that this cannot + // happen by looking at the visited phi nodes and making sure they cannot + // reach the value. + if (isValueEqualInPotentialCycles(V1, V2)) + return MustAlias; if (!V1->getType()->isPointerTy() || !V2->getType()->isPointerTy()) return NoAlias; // Scalars cannot alias each other @@ -1307,3 +1329,71 @@ BasicAliasAnalysis::aliasCheck(const Value *V1, uint64_t V1Size, Location(V2, V2Size, V2TBAAInfo)); return AliasCache[Locs] = Result; } + +bool BasicAliasAnalysis::isValueEqualInPotentialCycles(const Value *V, + const Value *V2) { + if (V != V2) + return false; + + const Instruction *Inst = dyn_cast(V); + if (!Inst) + return true; + + if (VisitedPhiBBs.size() > MaxNumPhiBBsValueReachabilityCheck) + return false; + + // Use dominance or loop info if available. + DominatorTree *DT = getAnalysisIfAvailable(); + LoopInfo *LI = getAnalysisIfAvailable(); + + // Make sure that the visited phis cannot reach the Value. This ensures that + // the Values cannot come from different iterations of a potential cycle the + // phi nodes could be involved in. + for (SmallPtrSet::iterator PI = VisitedPhiBBs.begin(), + PE = VisitedPhiBBs.end(); + PI != PE; ++PI) + if (isPotentiallyReachable((*PI)->begin(), Inst, DT, LI)) + return false; + + return true; +} + +/// GetIndexDifference - Dest and Src are the variable indices from two +/// decomposed GetElementPtr instructions GEP1 and GEP2 which have common base +/// pointers. Subtract the GEP2 indices from GEP1 to find the symbolic +/// difference between the two pointers. +void BasicAliasAnalysis::GetIndexDifference( + SmallVectorImpl &Dest, + const SmallVectorImpl &Src) { + if (Src.empty()) + return; + + for (unsigned i = 0, e = Src.size(); i != e; ++i) { + const Value *V = Src[i].V; + ExtensionKind Extension = Src[i].Extension; + int64_t Scale = Src[i].Scale; + + // Find V in Dest. This is N^2, but pointer indices almost never have more + // than a few variable indexes. + for (unsigned j = 0, e = Dest.size(); j != e; ++j) { + if (!isValueEqualInPotentialCycles(Dest[j].V, V) || + Dest[j].Extension != Extension) + continue; + + // If we found it, subtract off Scale V's from the entry in Dest. If it + // goes to zero, remove the entry. + if (Dest[j].Scale != Scale) + Dest[j].Scale -= Scale; + else + Dest.erase(Dest.begin() + j); + Scale = 0; + break; + } + + // If we didn't consume this entry, add it to the end of the Dest list. + if (Scale) { + VariableGEPIndex Entry = { V, Extension, -Scale }; + Dest.push_back(Entry); + } + } +} diff --git a/contrib/llvm/lib/Analysis/IVUsers.cpp b/contrib/llvm/lib/Analysis/IVUsers.cpp index b33e2cb9999..5a06cdce308 100644 --- a/contrib/llvm/lib/Analysis/IVUsers.cpp +++ b/contrib/llvm/lib/Analysis/IVUsers.cpp @@ -187,15 +187,34 @@ bool IVUsers::AddUsersImpl(Instruction *I, if (AddUserToIVUsers) { // Okay, we found a user that we cannot reduce. - IVUses.push_back(new IVStrideUse(this, User, I)); - IVStrideUse &NewUse = IVUses.back(); + IVStrideUse &NewUse = AddUser(User, I); // Autodetect the post-inc loop set, populating NewUse.PostIncLoops. // The regular return value here is discarded; instead of recording // it, we just recompute it when we need it. + const SCEV *OriginalISE = ISE; ISE = TransformForPostIncUse(NormalizeAutodetect, ISE, User, I, NewUse.PostIncLoops, *SE, *DT); + + // PostIncNormalization effectively simplifies the expression under + // pre-increment assumptions. Those assumptions (no wrapping) might not + // hold for the post-inc value. Catch such cases by making sure the + // transformation is invertible. + if (OriginalISE != ISE) { + const SCEV *DenormalizedISE = + TransformForPostIncUse(Denormalize, ISE, User, I, + NewUse.PostIncLoops, *SE, *DT); + + // If we normalized the expression, but denormalization doesn't give the + // original one, discard this user. + if (OriginalISE != DenormalizedISE) { + DEBUG(dbgs() << " DISCARDING (NORMALIZATION ISN'T INVERTIBLE): " + << *ISE << '\n'); + IVUses.pop_back(); + return false; + } + } DEBUG(if (SE->getSCEV(I) != ISE) dbgs() << " NORMALIZED TO: " << *ISE << '\n'); } diff --git a/contrib/llvm/lib/Analysis/ScalarEvolution.cpp b/contrib/llvm/lib/Analysis/ScalarEvolution.cpp index 0a02f4e9d74..d9b696e0798 100644 --- a/contrib/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/contrib/llvm/lib/Analysis/ScalarEvolution.cpp @@ -6218,7 +6218,7 @@ bool ScalarEvolution::isImpliedCond(ICmpInst::Predicate Pred, // LHS' type is checked for above. if (getTypeSizeInBits(LHS->getType()) > getTypeSizeInBits(FoundLHS->getType())) { - if (CmpInst::isSigned(Pred)) { + if (CmpInst::isSigned(FoundPred)) { FoundLHS = getSignExtendExpr(FoundLHS, LHS->getType()); FoundRHS = getSignExtendExpr(FoundRHS, LHS->getType()); } else { diff --git a/contrib/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/contrib/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index d5c6713d0b6..060e010b7de 100644 --- a/contrib/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/contrib/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -223,13 +223,14 @@ void AsmPrinter::EmitLinkage(const GlobalValue *GV, MCSymbol *GVSym) const { case GlobalValue::WeakAnyLinkage: case GlobalValue::WeakODRLinkage: case GlobalValue::LinkerPrivateWeakLinkage: - if (MAI->getWeakDefDirective() != 0) { + if (MAI->hasWeakDefDirective()) { // .globl _foo OutStreamer.EmitSymbolAttribute(GVSym, MCSA_Global); bool CanBeHidden = false; - if (Linkage == GlobalValue::LinkOnceODRLinkage) { + if (Linkage == GlobalValue::LinkOnceODRLinkage && + MAI->hasWeakDefCanBeHiddenDirective()) { if (GV->hasUnnamedAddr()) { CanBeHidden = true; } else { @@ -244,7 +245,7 @@ void AsmPrinter::EmitLinkage(const GlobalValue *GV, MCSymbol *GVSym) const { OutStreamer.EmitSymbolAttribute(GVSym, MCSA_WeakDefinition); else OutStreamer.EmitSymbolAttribute(GVSym, MCSA_WeakDefAutoPrivate); - } else if (MAI->getLinkOnceDirective() != 0) { + } else if (MAI->hasLinkOnceDirective()) { // .globl _foo OutStreamer.EmitSymbolAttribute(GVSym, MCSA_Global); //NOTE: linkonce is handled by the section the symbol was assigned to. diff --git a/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 43f72c5ef9b..69cf8d9a909 100644 --- a/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -8547,7 +8547,10 @@ struct MemOpLink { // base ptr. struct ConsecutiveMemoryChainSorter { bool operator()(MemOpLink LHS, MemOpLink RHS) { - return LHS.OffsetFromBase < RHS.OffsetFromBase; + return + LHS.OffsetFromBase < RHS.OffsetFromBase || + (LHS.OffsetFromBase == RHS.OffsetFromBase && + LHS.SequenceNum > RHS.SequenceNum); } }; diff --git a/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h b/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h index 13bb08f08c0..ce2ba016cf4 100644 --- a/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h +++ b/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h @@ -569,6 +569,7 @@ class LLVM_LIBRARY_VISIBILITY DAGTypeLegalizer { void SplitVecRes_BUILD_VECTOR(SDNode *N, SDValue &Lo, SDValue &Hi); void SplitVecRes_CONCAT_VECTORS(SDNode *N, SDValue &Lo, SDValue &Hi); void SplitVecRes_EXTRACT_SUBVECTOR(SDNode *N, SDValue &Lo, SDValue &Hi); + void SplitVecRes_INSERT_SUBVECTOR(SDNode *N, SDValue &Lo, SDValue &Hi); void SplitVecRes_FPOWI(SDNode *N, SDValue &Lo, SDValue &Hi); void SplitVecRes_INSERT_VECTOR_ELT(SDNode *N, SDValue &Lo, SDValue &Hi); void SplitVecRes_LOAD(LoadSDNode *N, SDValue &Lo, SDValue &Hi); diff --git a/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp b/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp index 2c3cdccb56e..3fb2d9bdf55 100644 --- a/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp +++ b/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp @@ -210,6 +210,7 @@ SDValue VectorLegalizer::LegalizeOp(SDValue Op) { case ISD::SRL: case ISD::ROTL: case ISD::ROTR: + case ISD::BSWAP: case ISD::CTLZ: case ISD::CTTZ: case ISD::CTLZ_ZERO_UNDEF: diff --git a/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp b/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp index 5f4ff753361..fb8c6021721 100644 --- a/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp +++ b/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp @@ -506,6 +506,7 @@ void DAGTypeLegalizer::SplitVectorResult(SDNode *N, unsigned ResNo) { case ISD::BUILD_VECTOR: SplitVecRes_BUILD_VECTOR(N, Lo, Hi); break; case ISD::CONCAT_VECTORS: SplitVecRes_CONCAT_VECTORS(N, Lo, Hi); break; case ISD::EXTRACT_SUBVECTOR: SplitVecRes_EXTRACT_SUBVECTOR(N, Lo, Hi); break; + case ISD::INSERT_SUBVECTOR: SplitVecRes_INSERT_SUBVECTOR(N, Lo, Hi); break; case ISD::FP_ROUND_INREG: SplitVecRes_InregOp(N, Lo, Hi); break; case ISD::FPOWI: SplitVecRes_FPOWI(N, Lo, Hi); break; case ISD::INSERT_VECTOR_ELT: SplitVecRes_INSERT_VECTOR_ELT(N, Lo, Hi); break; @@ -725,6 +726,43 @@ void DAGTypeLegalizer::SplitVecRes_EXTRACT_SUBVECTOR(SDNode *N, SDValue &Lo, TLI.getVectorIdxTy())); } +void DAGTypeLegalizer::SplitVecRes_INSERT_SUBVECTOR(SDNode *N, SDValue &Lo, + SDValue &Hi) { + SDValue Vec = N->getOperand(0); + SDValue SubVec = N->getOperand(1); + SDValue Idx = N->getOperand(2); + SDLoc dl(N); + GetSplitVector(Vec, Lo, Hi); + + // Spill the vector to the stack. + EVT VecVT = Vec.getValueType(); + EVT SubVecVT = VecVT.getVectorElementType(); + SDValue StackPtr = DAG.CreateStackTemporary(VecVT); + SDValue Store = DAG.getStore(DAG.getEntryNode(), dl, Vec, StackPtr, + MachinePointerInfo(), false, false, 0); + + // Store the new subvector into the specified index. + SDValue SubVecPtr = GetVectorElementPointer(StackPtr, SubVecVT, Idx); + Type *VecType = VecVT.getTypeForEVT(*DAG.getContext()); + unsigned Alignment = TLI.getDataLayout()->getPrefTypeAlignment(VecType); + Store = DAG.getStore(Store, dl, SubVec, SubVecPtr, MachinePointerInfo(), + false, false, 0); + + // Load the Lo part from the stack slot. + Lo = DAG.getLoad(Lo.getValueType(), dl, Store, StackPtr, MachinePointerInfo(), + false, false, false, 0); + + // Increment the pointer to the other part. + unsigned IncrementSize = Lo.getValueType().getSizeInBits() / 8; + StackPtr = + DAG.getNode(ISD::ADD, dl, StackPtr.getValueType(), StackPtr, + DAG.getConstant(IncrementSize, StackPtr.getValueType())); + + // Load the Hi part from the stack slot. + Hi = DAG.getLoad(Hi.getValueType(), dl, Store, StackPtr, MachinePointerInfo(), + false, false, false, MinAlign(Alignment, IncrementSize)); +} + void DAGTypeLegalizer::SplitVecRes_FPOWI(SDNode *N, SDValue &Lo, SDValue &Hi) { SDLoc dl(N); diff --git a/contrib/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp b/contrib/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp index 054e3dd840b..c1893c9231f 100644 --- a/contrib/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp +++ b/contrib/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp @@ -219,8 +219,11 @@ void ScheduleDAGSDNodes::ClusterNeighboringLoads(SDNode *Node) { DenseMap O2SMap; // Map from offset to SDNode. bool Cluster = false; SDNode *Base = Node; + // This algorithm requires a reasonably low use count before finding a match + // to avoid uselessly blowing up compile time in large blocks. + unsigned UseCount = 0; for (SDNode::use_iterator I = Chain->use_begin(), E = Chain->use_end(); - I != E; ++I) { + I != E && UseCount < 100; ++I, ++UseCount) { SDNode *User = *I; if (User == Node || !Visited.insert(User)) continue; @@ -237,6 +240,8 @@ void ScheduleDAGSDNodes::ClusterNeighboringLoads(SDNode *Node) { if (Offset2 < Offset1) Base = User; Cluster = true; + // Reset UseCount to allow more matches. + UseCount = 0; } if (!Cluster) diff --git a/contrib/llvm/lib/MC/MCAsmInfo.cpp b/contrib/llvm/lib/MC/MCAsmInfo.cpp index 28f1c951641..daf19e927c7 100644 --- a/contrib/llvm/lib/MC/MCAsmInfo.cpp +++ b/contrib/llvm/lib/MC/MCAsmInfo.cpp @@ -76,8 +76,9 @@ MCAsmInfo::MCAsmInfo() { HasIdentDirective = false; HasNoDeadStrip = false; WeakRefDirective = 0; - WeakDefDirective = 0; - LinkOnceDirective = 0; + HasWeakDefDirective = false; + HasWeakDefCanBeHiddenDirective = false; + HasLinkOnceDirective = false; HiddenVisibilityAttr = MCSA_Hidden; HiddenDeclarationVisibilityAttr = MCSA_Hidden; ProtectedVisibilityAttr = MCSA_Protected; @@ -85,6 +86,7 @@ MCAsmInfo::MCAsmInfo() { SupportsDebugInformation = false; ExceptionsType = ExceptionHandling::None; DwarfUsesRelocationsAcrossSections = true; + DwarfFDESymbolsUseAbsDiff = false; DwarfRegNumForCFI = false; HasMicrosoftFastStdCallMangling = false; NeedsDwarfSectionOffsetDirective = false; diff --git a/contrib/llvm/lib/MC/MCAsmInfoCOFF.cpp b/contrib/llvm/lib/MC/MCAsmInfoCOFF.cpp index 9d9f98e72b9..1cac71f1eda 100644 --- a/contrib/llvm/lib/MC/MCAsmInfoCOFF.cpp +++ b/contrib/llvm/lib/MC/MCAsmInfoCOFF.cpp @@ -27,7 +27,7 @@ MCAsmInfoCOFF::MCAsmInfoCOFF() { HasSingleParameterDotFile = false; PrivateGlobalPrefix = "L"; // Prefix for private global symbols WeakRefDirective = "\t.weak\t"; - LinkOnceDirective = "\t.linkonce discard\n"; + HasLinkOnceDirective = true; // Doesn't support visibility: HiddenVisibilityAttr = HiddenDeclarationVisibilityAttr = MCSA_Invalid; diff --git a/contrib/llvm/lib/MC/MCAsmInfoDarwin.cpp b/contrib/llvm/lib/MC/MCAsmInfoDarwin.cpp index 704c8161f88..351ec56352a 100644 --- a/contrib/llvm/lib/MC/MCAsmInfoDarwin.cpp +++ b/contrib/llvm/lib/MC/MCAsmInfoDarwin.cpp @@ -36,7 +36,8 @@ MCAsmInfoDarwin::MCAsmInfoDarwin() { InlineAsmEnd = " InlineAsm End"; // Directives: - WeakDefDirective = "\t.weak_definition "; + HasWeakDefDirective = true; + HasWeakDefCanBeHiddenDirective = true; WeakRefDirective = "\t.weak_reference "; ZeroDirective = "\t.space\t"; // ".space N" emits N zeros. HasMachoZeroFillDirective = true; // Uses .zerofill diff --git a/contrib/llvm/lib/MC/MCDwarf.cpp b/contrib/llvm/lib/MC/MCDwarf.cpp index 479f4452d4a..12070f36ea6 100644 --- a/contrib/llvm/lib/MC/MCDwarf.cpp +++ b/contrib/llvm/lib/MC/MCDwarf.cpp @@ -839,8 +839,9 @@ static unsigned getSizeForEncoding(MCStreamer &streamer, } } -static void EmitSymbol(MCStreamer &streamer, const MCSymbol &symbol, - unsigned symbolEncoding, const char *comment = 0) { +static void EmitFDESymbol(MCStreamer &streamer, const MCSymbol &symbol, + unsigned symbolEncoding, bool isEH, + const char *comment = 0) { MCContext &context = streamer.getContext(); const MCAsmInfo *asmInfo = context.getAsmInfo(); const MCExpr *v = asmInfo->getExprForFDESymbol(&symbol, @@ -848,7 +849,10 @@ static void EmitSymbol(MCStreamer &streamer, const MCSymbol &symbol, streamer); unsigned size = getSizeForEncoding(streamer, symbolEncoding); if (streamer.isVerboseAsm() && comment) streamer.AddComment(comment); - streamer.EmitAbsValue(v, size); + if (asmInfo->doDwarfFDESymbolsUseAbsDiff() && isEH) + streamer.EmitAbsValue(v, size); + else + streamer.EmitValue(v, size); } static void EmitPersonality(MCStreamer &streamer, const MCSymbol &symbol, @@ -1347,7 +1351,7 @@ MCSymbol *FrameEmitterImpl::EmitFDE(MCStreamer &streamer, unsigned PCEncoding = IsEH ? MOFI->getFDEEncoding(UsingCFI) : (unsigned)dwarf::DW_EH_PE_absptr; unsigned PCSize = getSizeForEncoding(streamer, PCEncoding); - EmitSymbol(streamer, *frame.Begin, PCEncoding, "FDE initial location"); + EmitFDESymbol(streamer, *frame.Begin, PCEncoding, IsEH, "FDE initial location"); // PC Range const MCExpr *Range = MakeStartMinusEndExpr(streamer, *frame.Begin, @@ -1367,8 +1371,8 @@ MCSymbol *FrameEmitterImpl::EmitFDE(MCStreamer &streamer, // Augmentation Data if (frame.Lsda) - EmitSymbol(streamer, *frame.Lsda, frame.LsdaEncoding, - "Language Specific Data Area"); + EmitFDESymbol(streamer, *frame.Lsda, frame.LsdaEncoding, true, + "Language Specific Data Area"); } // Call Frame Instructions diff --git a/contrib/llvm/lib/MC/MCParser/AsmParser.cpp b/contrib/llvm/lib/MC/MCParser/AsmParser.cpp index 8fe39c8ef87..5eeb3080ae0 100644 --- a/contrib/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/contrib/llvm/lib/MC/MCParser/AsmParser.cpp @@ -4297,6 +4297,10 @@ bool AsmParser::parseMSInlineAsm( break; } case AOK_DotOperator: + // Insert the dot if the user omitted it. + OS.flush(); + if (AsmStringIR.at(AsmStringIR.size() - 1) != '.') + OS << '.'; OS << (*I).Val; break; } diff --git a/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index 4fdb667b953..cf7aec3b453 100644 --- a/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -31,12 +31,8 @@ using namespace llvm; static TargetLoweringObjectFile *createTLOF(AArch64TargetMachine &TM) { const AArch64Subtarget *Subtarget = &TM.getSubtarget(); - - if (Subtarget->isTargetLinux()) - return new AArch64LinuxTargetObjectFile(); - if (Subtarget->isTargetELF()) - return new TargetLoweringObjectFileELF(); - llvm_unreachable("unknown subtarget type"); + assert (Subtarget->isTargetELF() && "unknown subtarget type"); + return new AArch64ElfTargetObjectFile(); } AArch64TargetLowering::AArch64TargetLowering(AArch64TargetMachine &TM) @@ -2782,7 +2778,7 @@ AArch64TargetLowering::LowerSETCC(SDValue Op, SelectionDAG &DAG) const { SDValue AArch64TargetLowering::LowerVACOPY(SDValue Op, SelectionDAG &DAG) const { const Value *DestSV = cast(Op.getOperand(3))->getValue(); - const Value *SrcSV = cast(Op.getOperand(3))->getValue(); + const Value *SrcSV = cast(Op.getOperand(4))->getValue(); // We have to make sure we copy the entire structure: 8+8+8+4+4 = 32 bytes // rather than just 8. diff --git a/contrib/llvm/lib/Target/AArch64/AArch64InstrInfo.td b/contrib/llvm/lib/Target/AArch64/AArch64InstrInfo.td index 23d81fc478e..8e5a4d30396 100644 --- a/contrib/llvm/lib/Target/AArch64/AArch64InstrInfo.td +++ b/contrib/llvm/lib/Target/AArch64/AArch64InstrInfo.td @@ -2587,6 +2587,7 @@ class A64I_SRexs_impl size, bits<3> opcode, string asm, dag outs, pat, itin> { let mayStore = 1; let PostEncoderMethod = "fixLoadStoreExclusive<1,0>"; + let Constraints = "@earlyclobber $Rs"; } multiclass A64I_SRex opcode, string prefix> { diff --git a/contrib/llvm/lib/Target/AArch64/AArch64TargetObjectFile.cpp b/contrib/llvm/lib/Target/AArch64/AArch64TargetObjectFile.cpp index b4452f51459..f8f21198a4f 100644 --- a/contrib/llvm/lib/Target/AArch64/AArch64TargetObjectFile.cpp +++ b/contrib/llvm/lib/Target/AArch64/AArch64TargetObjectFile.cpp @@ -22,3 +22,10 @@ AArch64LinuxTargetObjectFile::Initialize(MCContext &Ctx, TargetLoweringObjectFileELF::Initialize(Ctx, TM); InitializeELF(TM.Options.UseInitArray); } + +void +AArch64ElfTargetObjectFile::Initialize(MCContext &Ctx, + const TargetMachine &TM) { + TargetLoweringObjectFileELF::Initialize(Ctx, TM); + InitializeELF(TM.Options.UseInitArray); +} diff --git a/contrib/llvm/lib/Target/AArch64/AArch64TargetObjectFile.h b/contrib/llvm/lib/Target/AArch64/AArch64TargetObjectFile.h index bf0565a79ec..f782285d1c0 100644 --- a/contrib/llvm/lib/Target/AArch64/AArch64TargetObjectFile.h +++ b/contrib/llvm/lib/Target/AArch64/AArch64TargetObjectFile.h @@ -20,8 +20,12 @@ namespace llvm { - /// AArch64LinuxTargetObjectFile - This implementation is used for linux - /// AArch64. + /// AArch64ElfTargetObjectFile - This implementation is used for ELF + /// AArch64 targets. + class AArch64ElfTargetObjectFile : public TargetLoweringObjectFileELF { + virtual void Initialize(MCContext &Ctx, const TargetMachine &TM); + }; + class AArch64LinuxTargetObjectFile : public TargetLoweringObjectFileELF { virtual void Initialize(MCContext &Ctx, const TargetMachine &TM); }; diff --git a/contrib/llvm/lib/Target/ARM/A15SDOptimizer.cpp b/contrib/llvm/lib/Target/ARM/A15SDOptimizer.cpp index ff585b41a2a..3e805a2b68b 100644 --- a/contrib/llvm/lib/Target/ARM/A15SDOptimizer.cpp +++ b/contrib/llvm/lib/Target/ARM/A15SDOptimizer.cpp @@ -418,7 +418,8 @@ SmallVector A15SDOptimizer::getReadDPRs(MachineInstr *MI) { if (!MO.isReg() || !MO.isUse()) continue; if (!usesRegClass(MO, &ARM::DPRRegClass) && - !usesRegClass(MO, &ARM::QPRRegClass)) + !usesRegClass(MO, &ARM::QPRRegClass) && + !usesRegClass(MO, &ARM::DPairRegClass)) // Treat DPair as QPR continue; Defs.push_back(MO.getReg()); @@ -538,7 +539,10 @@ A15SDOptimizer::optimizeAllLanesPattern(MachineInstr *MI, unsigned Reg) { InsertPt++; unsigned Out; - if (MRI->getRegClass(Reg)->hasSuperClassEq(&ARM::QPRRegClass)) { + // DPair has the same length as QPR and also has two DPRs as subreg. + // Treat DPair as QPR. + if (MRI->getRegClass(Reg)->hasSuperClassEq(&ARM::QPRRegClass) || + MRI->getRegClass(Reg)->hasSuperClassEq(&ARM::DPairRegClass)) { unsigned DSub0 = createExtractSubreg(MBB, InsertPt, DL, Reg, ARM::dsub_0, &ARM::DPRRegClass); unsigned DSub1 = createExtractSubreg(MBB, InsertPt, DL, Reg, @@ -571,7 +575,9 @@ A15SDOptimizer::optimizeAllLanesPattern(MachineInstr *MI, unsigned Reg) { default: llvm_unreachable("Unknown preferred lane!"); } - bool UsesQPR = usesRegClass(MI->getOperand(0), &ARM::QPRRegClass); + // Treat DPair as QPR + bool UsesQPR = usesRegClass(MI->getOperand(0), &ARM::QPRRegClass) || + usesRegClass(MI->getOperand(0), &ARM::DPairRegClass); Out = createImplicitDef(MBB, InsertPt, DL); Out = createInsertSubreg(MBB, InsertPt, DL, Out, PrefLane, Reg); diff --git a/contrib/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp b/contrib/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp index f835a4e5b5f..658af8380d8 100644 --- a/contrib/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp +++ b/contrib/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp @@ -3684,6 +3684,7 @@ ARMBaseInstrInfo::getOperandLatency(const InstrItineraryData *ItinData, case ARM::VLD3d16Pseudo: case ARM::VLD3d32Pseudo: case ARM::VLD1d64TPseudo: + case ARM::VLD1d64TPseudoWB_fixed: case ARM::VLD3d8Pseudo_UPD: case ARM::VLD3d16Pseudo_UPD: case ARM::VLD3d32Pseudo_UPD: @@ -3700,6 +3701,7 @@ ARMBaseInstrInfo::getOperandLatency(const InstrItineraryData *ItinData, case ARM::VLD4d16Pseudo: case ARM::VLD4d32Pseudo: case ARM::VLD1d64QPseudo: + case ARM::VLD1d64QPseudoWB_fixed: case ARM::VLD4d8Pseudo_UPD: case ARM::VLD4d16Pseudo_UPD: case ARM::VLD4d32Pseudo_UPD: diff --git a/contrib/llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp b/contrib/llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp index e6f7f86c558..3e62b649e0d 100644 --- a/contrib/llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp +++ b/contrib/llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp @@ -136,7 +136,9 @@ static const NEONLdStTableEntry NEONLdStTable[] = { { ARM::VLD1LNq8Pseudo_UPD, ARM::VLD1LNd8_UPD, true, true, true, EvenDblSpc, 1, 8 ,true}, { ARM::VLD1d64QPseudo, ARM::VLD1d64Q, true, false, false, SingleSpc, 4, 1 ,false}, +{ ARM::VLD1d64QPseudoWB_fixed, ARM::VLD1d64Qwb_fixed, true, true, false, SingleSpc, 4, 1 ,false}, { ARM::VLD1d64TPseudo, ARM::VLD1d64T, true, false, false, SingleSpc, 3, 1 ,false}, +{ ARM::VLD1d64TPseudoWB_fixed, ARM::VLD1d64Twb_fixed, true, true, false, SingleSpc, 3, 1 ,false}, { ARM::VLD2LNd16Pseudo, ARM::VLD2LNd16, true, false, false, SingleSpc, 2, 4 ,true}, { ARM::VLD2LNd16Pseudo_UPD, ARM::VLD2LNd16_UPD, true, true, true, SingleSpc, 2, 4 ,true}, @@ -1071,6 +1073,7 @@ bool ARMExpandPseudo::ExpandMI(MachineBasicBlock &MBB, case ARM::VLD3d16Pseudo: case ARM::VLD3d32Pseudo: case ARM::VLD1d64TPseudo: + case ARM::VLD1d64TPseudoWB_fixed: case ARM::VLD3d8Pseudo_UPD: case ARM::VLD3d16Pseudo_UPD: case ARM::VLD3d32Pseudo_UPD: @@ -1087,6 +1090,7 @@ bool ARMExpandPseudo::ExpandMI(MachineBasicBlock &MBB, case ARM::VLD4d16Pseudo: case ARM::VLD4d32Pseudo: case ARM::VLD1d64QPseudo: + case ARM::VLD1d64QPseudoWB_fixed: case ARM::VLD4d8Pseudo_UPD: case ARM::VLD4d16Pseudo_UPD: case ARM::VLD4d32Pseudo_UPD: diff --git a/contrib/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp b/contrib/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp index 87d15226947..6d9b18877f7 100644 --- a/contrib/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp +++ b/contrib/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp @@ -1673,9 +1673,61 @@ SDValue ARMDAGToDAGISel::GetVLDSTAlign(SDValue Align, unsigned NumVecs, return CurDAG->getTargetConstant(Alignment, MVT::i32); } +static bool isVLDfixed(unsigned Opc) +{ + switch (Opc) { + default: return false; + case ARM::VLD1d8wb_fixed : return true; + case ARM::VLD1d16wb_fixed : return true; + case ARM::VLD1d64Qwb_fixed : return true; + case ARM::VLD1d32wb_fixed : return true; + case ARM::VLD1d64wb_fixed : return true; + case ARM::VLD1d64TPseudoWB_fixed : return true; + case ARM::VLD1d64QPseudoWB_fixed : return true; + case ARM::VLD1q8wb_fixed : return true; + case ARM::VLD1q16wb_fixed : return true; + case ARM::VLD1q32wb_fixed : return true; + case ARM::VLD1q64wb_fixed : return true; + case ARM::VLD2d8wb_fixed : return true; + case ARM::VLD2d16wb_fixed : return true; + case ARM::VLD2d32wb_fixed : return true; + case ARM::VLD2q8PseudoWB_fixed : return true; + case ARM::VLD2q16PseudoWB_fixed : return true; + case ARM::VLD2q32PseudoWB_fixed : return true; + case ARM::VLD2DUPd8wb_fixed : return true; + case ARM::VLD2DUPd16wb_fixed : return true; + case ARM::VLD2DUPd32wb_fixed : return true; + } +} + +static bool isVSTfixed(unsigned Opc) +{ + switch (Opc) { + default: return false; + case ARM::VST1d8wb_fixed : return true; + case ARM::VST1d16wb_fixed : return true; + case ARM::VST1d32wb_fixed : return true; + case ARM::VST1d64wb_fixed : return true; + case ARM::VST1q8wb_fixed : return true; + case ARM::VST1q16wb_fixed : return true; + case ARM::VST1q32wb_fixed : return true; + case ARM::VST1q64wb_fixed : return true; + case ARM::VST1d64TPseudoWB_fixed : return true; + case ARM::VST1d64QPseudoWB_fixed : return true; + case ARM::VST2d8wb_fixed : return true; + case ARM::VST2d16wb_fixed : return true; + case ARM::VST2d32wb_fixed : return true; + case ARM::VST2q8PseudoWB_fixed : return true; + case ARM::VST2q16PseudoWB_fixed : return true; + case ARM::VST2q32PseudoWB_fixed : return true; + } +} + // Get the register stride update opcode of a VLD/VST instruction that // is otherwise equivalent to the given fixed stride updating instruction. static unsigned getVLDSTRegisterUpdateOpcode(unsigned Opc) { + assert((isVLDfixed(Opc) || isVSTfixed(Opc)) + && "Incorrect fixed stride updating instruction."); switch (Opc) { default: break; case ARM::VLD1d8wb_fixed: return ARM::VLD1d8wb_register; @@ -1686,6 +1738,10 @@ static unsigned getVLDSTRegisterUpdateOpcode(unsigned Opc) { case ARM::VLD1q16wb_fixed: return ARM::VLD1q16wb_register; case ARM::VLD1q32wb_fixed: return ARM::VLD1q32wb_register; case ARM::VLD1q64wb_fixed: return ARM::VLD1q64wb_register; + case ARM::VLD1d64Twb_fixed: return ARM::VLD1d64Twb_register; + case ARM::VLD1d64Qwb_fixed: return ARM::VLD1d64Qwb_register; + case ARM::VLD1d64TPseudoWB_fixed: return ARM::VLD1d64TPseudoWB_register; + case ARM::VLD1d64QPseudoWB_fixed: return ARM::VLD1d64QPseudoWB_register; case ARM::VST1d8wb_fixed: return ARM::VST1d8wb_register; case ARM::VST1d16wb_fixed: return ARM::VST1d16wb_register; @@ -1785,11 +1841,11 @@ SDNode *ARMDAGToDAGISel::SelectVLD(SDNode *N, bool isUpdating, unsigned NumVecs, SDValue Inc = N->getOperand(AddrOpIdx + 1); // FIXME: VLD1/VLD2 fixed increment doesn't need Reg0. Remove the reg0 // case entirely when the rest are updated to that form, too. - if ((NumVecs == 1 || NumVecs == 2) && !isa(Inc.getNode())) + if ((NumVecs <= 2) && !isa(Inc.getNode())) Opc = getVLDSTRegisterUpdateOpcode(Opc); - // We use a VLD1 for v1i64 even if the pseudo says vld2/3/4, so + // FIXME: We use a VLD1 for v1i64 even if the pseudo says vld2/3/4, so // check for that explicitly too. Horribly hacky, but temporary. - if ((NumVecs != 1 && NumVecs != 2 && Opc != ARM::VLD1q64wb_fixed) || + if ((NumVecs > 2 && !isVLDfixed(Opc)) || !isa(Inc.getNode())) Ops.push_back(isa(Inc.getNode()) ? Reg0 : Inc); } @@ -1937,11 +1993,12 @@ SDNode *ARMDAGToDAGISel::SelectVST(SDNode *N, bool isUpdating, unsigned NumVecs, // case entirely when the rest are updated to that form, too. if (NumVecs <= 2 && !isa(Inc.getNode())) Opc = getVLDSTRegisterUpdateOpcode(Opc); - // We use a VST1 for v1i64 even if the pseudo says vld2/3/4, so + // FIXME: We use a VST1 for v1i64 even if the pseudo says vld2/3/4, so // check for that explicitly too. Horribly hacky, but temporary. - if ((NumVecs > 2 && Opc != ARM::VST1q64wb_fixed) || - !isa(Inc.getNode())) - Ops.push_back(isa(Inc.getNode()) ? Reg0 : Inc); + if (!isa(Inc.getNode())) + Ops.push_back(Inc); + else if (NumVecs > 2 && !isVSTfixed(Opc)) + Ops.push_back(Reg0); } Ops.push_back(SrcReg); Ops.push_back(Pred); @@ -2834,7 +2891,7 @@ SDNode *ARMDAGToDAGISel::Select(SDNode *N) { static const uint16_t DOpcodes[] = { ARM::VLD3d8Pseudo_UPD, ARM::VLD3d16Pseudo_UPD, ARM::VLD3d32Pseudo_UPD, - ARM::VLD1q64wb_fixed}; + ARM::VLD1d64TPseudoWB_fixed}; static const uint16_t QOpcodes0[] = { ARM::VLD3q8Pseudo_UPD, ARM::VLD3q16Pseudo_UPD, ARM::VLD3q32Pseudo_UPD }; @@ -2848,7 +2905,7 @@ SDNode *ARMDAGToDAGISel::Select(SDNode *N) { static const uint16_t DOpcodes[] = { ARM::VLD4d8Pseudo_UPD, ARM::VLD4d16Pseudo_UPD, ARM::VLD4d32Pseudo_UPD, - ARM::VLD1q64wb_fixed}; + ARM::VLD1d64QPseudoWB_fixed}; static const uint16_t QOpcodes0[] = { ARM::VLD4q8Pseudo_UPD, ARM::VLD4q16Pseudo_UPD, ARM::VLD4q32Pseudo_UPD }; diff --git a/contrib/llvm/lib/Target/ARM/ARMInstrNEON.td b/contrib/llvm/lib/Target/ARM/ARMInstrNEON.td index 43bd4c21dc3..0b05c08ed94 100644 --- a/contrib/llvm/lib/Target/ARM/ARMInstrNEON.td +++ b/contrib/llvm/lib/Target/ARM/ARMInstrNEON.td @@ -730,6 +730,8 @@ defm VLD1d32Twb : VLD1D3WB<{1,0,0,?}, "32">; defm VLD1d64Twb : VLD1D3WB<{1,1,0,?}, "64">; def VLD1d64TPseudo : VLDQQPseudo; +def VLD1d64TPseudoWB_fixed : VLDQQWBfixedPseudo; +def VLD1d64TPseudoWB_register : VLDQQWBregisterPseudo; // ...with 4 registers class VLD1D4 op7_4, string Dt> @@ -769,6 +771,8 @@ defm VLD1d32Qwb : VLD1D4WB<{1,0,?,?}, "32">; defm VLD1d64Qwb : VLD1D4WB<{1,1,?,?}, "64">; def VLD1d64QPseudo : VLDQQPseudo; +def VLD1d64QPseudoWB_fixed : VLDQQWBfixedPseudo; +def VLD1d64QPseudoWB_register : VLDQQWBregisterPseudo; // VLD2 : Vector Load (multiple 2-element structures) class VLD2 op11_8, bits<4> op7_4, string Dt, RegisterOperand VdTy, @@ -1671,7 +1675,7 @@ defm VST1d32Twb : VST1D3WB<{1,0,0,?}, "32">; defm VST1d64Twb : VST1D3WB<{1,1,0,?}, "64">; def VST1d64TPseudo : VSTQQPseudo; -def VST1d64TPseudoWB_fixed : VSTQQWBPseudo; +def VST1d64TPseudoWB_fixed : VSTQQWBfixedPseudo; def VST1d64TPseudoWB_register : VSTQQWBPseudo; // ...with 4 registers @@ -1714,7 +1718,7 @@ defm VST1d32Qwb : VST1D4WB<{1,0,?,?}, "32">; defm VST1d64Qwb : VST1D4WB<{1,1,?,?}, "64">; def VST1d64QPseudo : VSTQQPseudo; -def VST1d64QPseudoWB_fixed : VSTQQWBPseudo; +def VST1d64QPseudoWB_fixed : VSTQQWBfixedPseudo; def VST1d64QPseudoWB_register : VSTQQWBPseudo; // VST2 : Vector Store (multiple 2-element structures) diff --git a/contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp b/contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp index f3dddce3012..1d9c06406a4 100644 --- a/contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp +++ b/contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp @@ -12,10 +12,14 @@ //===----------------------------------------------------------------------===// #include "PPCMCAsmInfo.h" +#include "llvm/ADT/Triple.h" + using namespace llvm; void PPCMCAsmInfoDarwin::anchor() { } +/// This version of the constructor is here to maintain ABI compatibility with +/// LLVM 3.4.0 PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit) { if (is64Bit) { PointerSize = CalleeSaveStackSlotSize = 8; @@ -32,6 +36,28 @@ PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit) { SupportsDebugInformation= true; // Debug information. } +PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit, const Triple& T) { + if (is64Bit) { + PointerSize = CalleeSaveStackSlotSize = 8; + } + IsLittleEndian = false; + + CommentString = ";"; + ExceptionsType = ExceptionHandling::DwarfCFI; + + if (!is64Bit) + Data64bitsDirective = 0; // We can't emit a 64-bit unit in PPC32 mode. + + AssemblerDialect = 1; // New-Style mnemonics. + SupportsDebugInformation= true; // Debug information. + + // old assembler lacks some directives + // FIXME: this should really be a check on the assembler characteristics + // rather than OS version + if (T.isMacOSX() && T.isMacOSXVersionLT(10, 6)) + HasWeakDefCanBeHiddenDirective = false; +} + void PPCLinuxMCAsmInfo::anchor() { } PPCLinuxMCAsmInfo::PPCLinuxMCAsmInfo(bool is64Bit) { diff --git a/contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.h b/contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.h index 1530e774cfc..633970ccc28 100644 --- a/contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.h +++ b/contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.h @@ -18,11 +18,15 @@ #include "llvm/MC/MCAsmInfoELF.h" namespace llvm { +class Triple; class PPCMCAsmInfoDarwin : public MCAsmInfoDarwin { virtual void anchor(); public: + /// This version of the constructor is here to maintain ABI compatibility + /// with LLVM 3.4.0. explicit PPCMCAsmInfoDarwin(bool is64Bit); + explicit PPCMCAsmInfoDarwin(bool is64Bit, const Triple&); }; class PPCLinuxMCAsmInfo : public MCAsmInfoELF { diff --git a/contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp b/contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp index f18d095c6d0..6a505184018 100644 --- a/contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp +++ b/contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp @@ -72,7 +72,7 @@ static MCAsmInfo *createPPCMCAsmInfo(const MCRegisterInfo &MRI, StringRef TT) { MCAsmInfo *MAI; if (TheTriple.isOSDarwin()) - MAI = new PPCMCAsmInfoDarwin(isPPC64); + MAI = new PPCMCAsmInfoDarwin(isPPC64, TheTriple); else MAI = new PPCLinuxMCAsmInfo(isPPC64); diff --git a/contrib/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/contrib/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp index ada34ed9e18..2d92a112d5e 100644 --- a/contrib/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/contrib/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -701,13 +701,6 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) { return; } break; - case PPC::SYNC: - // In Book E sync is called msync, handle this special case here... - if (Subtarget.isBookE()) { - OutStreamer.EmitRawText(StringRef("\tmsync")); - return; - } - break; case PPC::LD: case PPC::STD: case PPC::LWA_32: diff --git a/contrib/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp b/contrib/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp index 4224ae2d273..e419b9b40d8 100644 --- a/contrib/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp +++ b/contrib/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp @@ -186,6 +186,13 @@ bool PPCCTRLoops::runOnFunction(Function &F) { return MadeChange; } +static bool isLargeIntegerTy(bool Is32Bit, Type *Ty) { + if (IntegerType *ITy = dyn_cast(Ty)) + return ITy->getBitWidth() > (Is32Bit ? 32 : 64); + + return false; +} + bool PPCCTRLoops::mightUseCTR(const Triple &TT, BasicBlock *BB) { for (BasicBlock::iterator J = BB->begin(), JE = BB->end(); J != JE; ++J) { @@ -352,13 +359,11 @@ bool PPCCTRLoops::mightUseCTR(const Triple &TT, BasicBlock *BB) { CastInst *CI = cast(J); if (CI->getSrcTy()->getScalarType()->isPPC_FP128Ty() || CI->getDestTy()->getScalarType()->isPPC_FP128Ty() || - (TT.isArch32Bit() && - (CI->getSrcTy()->getScalarType()->isIntegerTy(64) || - CI->getDestTy()->getScalarType()->isIntegerTy(64)) - )) + isLargeIntegerTy(TT.isArch32Bit(), CI->getSrcTy()->getScalarType()) || + isLargeIntegerTy(TT.isArch32Bit(), CI->getDestTy()->getScalarType())) return true; - } else if (TT.isArch32Bit() && - J->getType()->getScalarType()->isIntegerTy(64) && + } else if (isLargeIntegerTy(TT.isArch32Bit(), + J->getType()->getScalarType()) && (J->getOpcode() == Instruction::UDiv || J->getOpcode() == Instruction::SDiv || J->getOpcode() == Instruction::URem || diff --git a/contrib/llvm/lib/Target/PowerPC/PPCFastISel.cpp b/contrib/llvm/lib/Target/PowerPC/PPCFastISel.cpp index 09117e7ded4..970c804e71e 100644 --- a/contrib/llvm/lib/Target/PowerPC/PPCFastISel.cpp +++ b/contrib/llvm/lib/Target/PowerPC/PPCFastISel.cpp @@ -892,11 +892,13 @@ unsigned PPCFastISel::PPCMoveToFPReg(MVT SrcVT, unsigned SrcReg, unsigned LoadOpc = PPC::LFD; if (SrcVT == MVT::i32) { - Addr.Offset = 4; - if (!IsSigned) + if (!IsSigned) { LoadOpc = PPC::LFIWZX; - else if (PPCSubTarget.hasLFIWAX()) + Addr.Offset = 4; + } else if (PPCSubTarget.hasLFIWAX()) { LoadOpc = PPC::LFIWAX; + Addr.Offset = 4; + } } const TargetRegisterClass *RC = &PPC::F8RCRegClass; @@ -1024,6 +1026,10 @@ bool PPCFastISel::SelectFPToI(const Instruction *I, bool IsSigned) { if (DstVT != MVT::i32 && DstVT != MVT::i64) return false; + // If we don't have FCTIDUZ and we need it, punt to SelectionDAG. + if (DstVT == MVT::i64 && !IsSigned && !PPCSubTarget.hasFPCVT()) + return false; + Value *Src = I->getOperand(0); Type *SrcTy = Src->getType(); if (!isTypeLegal(SrcTy, SrcVT)) diff --git a/contrib/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp b/contrib/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp index 6ba6af6446e..d25762a5bbc 100644 --- a/contrib/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp +++ b/contrib/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp @@ -261,11 +261,11 @@ SDNode *PPCDAGToDAGISel::getGlobalBaseReg() { DebugLoc dl; if (PPCLowering.getPointerTy() == MVT::i32) { - GlobalBaseReg = RegInfo->createVirtualRegister(&PPC::GPRCRegClass); + GlobalBaseReg = RegInfo->createVirtualRegister(&PPC::GPRC_NOR0RegClass); BuildMI(FirstMBB, MBBI, dl, TII.get(PPC::MovePCtoLR)); BuildMI(FirstMBB, MBBI, dl, TII.get(PPC::MFLR), GlobalBaseReg); } else { - GlobalBaseReg = RegInfo->createVirtualRegister(&PPC::G8RCRegClass); + GlobalBaseReg = RegInfo->createVirtualRegister(&PPC::G8RC_NOX0RegClass); BuildMI(FirstMBB, MBBI, dl, TII.get(PPC::MovePCtoLR8)); BuildMI(FirstMBB, MBBI, dl, TII.get(PPC::MFLR8), GlobalBaseReg); } diff --git a/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp index 8da5f0563c6..25a7ca7f59a 100644 --- a/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -2333,7 +2333,7 @@ PPCTargetLowering::LowerFormalArguments_64SVR4( EVT ObjType = (ObjSize == 1 ? MVT::i8 : (ObjSize == 2 ? MVT::i16 : MVT::i32)); Store = DAG.getTruncStore(Val.getValue(1), dl, Val, FIN, - MachinePointerInfo(FuncArg, CurArgOffset), + MachinePointerInfo(FuncArg), ObjType, false, false, 0); } else { // For sizes that don't fit a truncating store (3, 5, 6, 7), @@ -2345,7 +2345,7 @@ PPCTargetLowering::LowerFormalArguments_64SVR4( int FI = MFI->CreateFixedObject(PtrByteSize, ArgOffset, true); SDValue FIN = DAG.getFrameIndex(FI, PtrVT); Store = DAG.getStore(Val.getValue(1), dl, Val, FIN, - MachinePointerInfo(FuncArg, ArgOffset), + MachinePointerInfo(FuncArg), false, false, 0); } @@ -2369,7 +2369,7 @@ PPCTargetLowering::LowerFormalArguments_64SVR4( SDValue FIN = DAG.getFrameIndex(FI, PtrVT); SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, PtrVT); SDValue Store = DAG.getStore(Val.getValue(1), dl, Val, FIN, - MachinePointerInfo(FuncArg, ArgOffset), + MachinePointerInfo(FuncArg, j), false, false, 0); MemOps.push_back(Store); ++GPR_idx; @@ -2665,8 +2665,7 @@ PPCTargetLowering::LowerFormalArguments_Darwin( SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, PtrVT); EVT ObjType = ObjSize == 1 ? MVT::i8 : MVT::i16; SDValue Store = DAG.getTruncStore(Val.getValue(1), dl, Val, FIN, - MachinePointerInfo(FuncArg, - CurArgOffset), + MachinePointerInfo(FuncArg), ObjType, false, false, 0); MemOps.push_back(Store); ++GPR_idx; @@ -2690,7 +2689,7 @@ PPCTargetLowering::LowerFormalArguments_Darwin( SDValue FIN = DAG.getFrameIndex(FI, PtrVT); SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, PtrVT); SDValue Store = DAG.getStore(Val.getValue(1), dl, Val, FIN, - MachinePointerInfo(FuncArg, ArgOffset), + MachinePointerInfo(FuncArg, j), false, false, 0); MemOps.push_back(Store); ++GPR_idx; diff --git a/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp b/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp index 315ad04ebe3..80bc27a9576 100644 --- a/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp +++ b/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp @@ -570,12 +570,14 @@ PPCInstrInfo::StoreRegToStackSlot(MachineFunction &MF, // update isStoreToStackSlot. DebugLoc DL; - if (PPC::GPRCRegClass.hasSubClassEq(RC)) { + if (PPC::GPRCRegClass.hasSubClassEq(RC) || + PPC::GPRC_NOR0RegClass.hasSubClassEq(RC)) { NewMIs.push_back(addFrameReference(BuildMI(MF, DL, get(PPC::STW)) .addReg(SrcReg, getKillRegState(isKill)), FrameIdx)); - } else if (PPC::G8RCRegClass.hasSubClassEq(RC)) { + } else if (PPC::G8RCRegClass.hasSubClassEq(RC) || + PPC::G8RC_NOX0RegClass.hasSubClassEq(RC)) { NewMIs.push_back(addFrameReference(BuildMI(MF, DL, get(PPC::STD)) .addReg(SrcReg, getKillRegState(isKill)), @@ -695,10 +697,12 @@ PPCInstrInfo::LoadRegFromStackSlot(MachineFunction &MF, DebugLoc DL, // Note: If additional load instructions are added here, // update isLoadFromStackSlot. - if (PPC::GPRCRegClass.hasSubClassEq(RC)) { + if (PPC::GPRCRegClass.hasSubClassEq(RC) || + PPC::GPRC_NOR0RegClass.hasSubClassEq(RC)) { NewMIs.push_back(addFrameReference(BuildMI(MF, DL, get(PPC::LWZ), DestReg), FrameIdx)); - } else if (PPC::G8RCRegClass.hasSubClassEq(RC)) { + } else if (PPC::G8RCRegClass.hasSubClassEq(RC) || + PPC::G8RC_NOX0RegClass.hasSubClassEq(RC)) { NewMIs.push_back(addFrameReference(BuildMI(MF, DL, get(PPC::LD), DestReg), FrameIdx)); } else if (PPC::F8RCRegClass.hasSubClassEq(RC)) { diff --git a/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.td b/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.td index 2bd3aadc798..fc29c69642b 100644 --- a/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.td +++ b/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.td @@ -580,6 +580,7 @@ def iaddroff : ComplexPattern; def In32BitMode : Predicate<"!PPCSubTarget.isPPC64()">; def In64BitMode : Predicate<"PPCSubTarget.isPPC64()">; def IsBookE : Predicate<"PPCSubTarget.isBookE()">; +def IsNotBookE : Predicate<"!PPCSubTarget.isBookE()">; //===----------------------------------------------------------------------===// // PowerPC Multiclass Definitions. @@ -1541,8 +1542,17 @@ def STMW : DForm_1<47, (outs), (ins gprc:$rS, memri:$dst), "stmw $rS, $dst", LdStLMW, []>; def SYNC : XForm_24_sync<31, 598, (outs), (ins i32imm:$L), - "sync $L", LdStSync, []>; -def : Pat<(int_ppc_sync), (SYNC 0)>; + "sync $L", LdStSync, []>, Requires<[IsNotBookE]>; + +let isCodeGenOnly = 1 in { + def MSYNC : XForm_24_sync<31, 598, (outs), (ins), + "msync", LdStSync, []>, Requires<[IsBookE]> { + let L = 0; + } +} + +def : Pat<(int_ppc_sync), (SYNC 0)>, Requires<[IsNotBookE]>; +def : Pat<(int_ppc_sync), (MSYNC)>, Requires<[IsBookE]>; //===----------------------------------------------------------------------===// // PPC32 Arithmetic Instructions. @@ -2284,7 +2294,8 @@ def : Pat<(f64 (extloadf32 xaddr:$src)), def : Pat<(f64 (fextend f32:$src)), (COPY_TO_REGCLASS $src, F8RC)>; -def : Pat<(atomic_fence (imm), (imm)), (SYNC 0)>; +def : Pat<(atomic_fence (imm), (imm)), (SYNC 0)>, Requires<[IsNotBookE]>; +def : Pat<(atomic_fence (imm), (imm)), (MSYNC)>, Requires<[IsBookE]>; // Additional FNMSUB patterns: -a*c + b == -(a*c - b) def : Pat<(fma (fneg f64:$A), f64:$C, f64:$B), @@ -2373,10 +2384,10 @@ class PPCAsmPseudo def : InstAlias<"sc", (SC 0)>; -def : InstAlias<"sync", (SYNC 0)>; -def : InstAlias<"msync", (SYNC 0)>; -def : InstAlias<"lwsync", (SYNC 1)>; -def : InstAlias<"ptesync", (SYNC 2)>; +def : InstAlias<"sync", (SYNC 0)>, Requires<[IsNotBookE]>; +def : InstAlias<"msync", (SYNC 0)>, Requires<[IsNotBookE]>; +def : InstAlias<"lwsync", (SYNC 1)>, Requires<[IsNotBookE]>; +def : InstAlias<"ptesync", (SYNC 2)>, Requires<[IsNotBookE]>; def : InstAlias<"wait", (WAIT 0)>; def : InstAlias<"waitrsv", (WAIT 1)>; diff --git a/contrib/llvm/lib/Target/PowerPC/PPCRegisterInfo.td b/contrib/llvm/lib/Target/PowerPC/PPCRegisterInfo.td index d566e2c3e52..43663ce013e 100644 --- a/contrib/llvm/lib/Target/PowerPC/PPCRegisterInfo.td +++ b/contrib/llvm/lib/Target/PowerPC/PPCRegisterInfo.td @@ -144,6 +144,13 @@ def CR6 : CR<6, "cr6", [CR6LT, CR6GT, CR6EQ, CR6UN]>, DwarfRegNum<[74, 74]>; def CR7 : CR<7, "cr7", [CR7LT, CR7GT, CR7EQ, CR7UN]>, DwarfRegNum<[75, 75]>; } +// The full condition-code register. This is not modeled fully, but defined +// here primarily, for compatibility with gcc, to allow the inline asm "cc" +// clobber specification to work. +def CC : PPCReg<"cc">, DwarfRegAlias { + let Aliases = [CR0, CR1, CR2, CR3, CR4, CR5, CR6, CR7]; +} + // Link register def LR : SPR<8, "lr">, DwarfRegNum<[-2, 65]>; //let Aliases = [LR] in @@ -234,3 +241,8 @@ def VRSAVERC : RegisterClass<"PPC", [i32], 32, (add VRSAVE)>; def CARRYRC : RegisterClass<"PPC", [i32], 32, (add CARRY)> { let CopyCost = -1; } + +def CCRC : RegisterClass<"PPC", [i32], 32, (add CC)> { + let isAllocatable = 0; +} + diff --git a/contrib/llvm/lib/Target/PowerPC/PPCSubtarget.h b/contrib/llvm/lib/Target/PowerPC/PPCSubtarget.h index c863a6ecc77..ec8c82ad521 100644 --- a/contrib/llvm/lib/Target/PowerPC/PPCSubtarget.h +++ b/contrib/llvm/lib/Target/PowerPC/PPCSubtarget.h @@ -126,22 +126,6 @@ class PPCSubtarget : public PPCGenSubtargetInfo { /// selection. const InstrItineraryData &getInstrItineraryData() const { return InstrItins; } - /// getDataLayoutString - Return the pointer size and type alignment - /// properties of this subtarget. - const char *getDataLayoutString() const { - // Note, the alignment values for f64 and i64 on ppc64 in Darwin - // documentation are wrong; these are correct (i.e. "what gcc does"). - if (isPPC64() && isSVR4ABI()) { - if (TargetTriple.getOS() == llvm::Triple::FreeBSD) - return "E-p:64:64-f64:64:64-i64:64:64-v128:128:128-n32:64"; - else - return "E-p:64:64-f64:64:64-i64:64:64-f128:128:128-v128:128:128-n32:64"; - } - - return isPPC64() ? "E-p:64:64-f64:64:64-i64:64:64-f128:64:128-n32:64" - : "E-p:32:32-f64:64:64-i64:64:64-f128:64:128-n32"; - } - /// \brief Reset the features for the PowerPC target. virtual void resetSubtargetFeatures(const MachineFunction *MF); private: diff --git a/contrib/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp b/contrib/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp index 9acefe53ce4..d6767d51f2c 100644 --- a/contrib/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp +++ b/contrib/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp @@ -33,6 +33,43 @@ extern "C" void LLVMInitializePowerPCTarget() { RegisterTargetMachine C(ThePPC64LETarget); } +/// Return the datalayout string of a subtarget. +static std::string getDataLayoutString(const PPCSubtarget &ST) { + const Triple &T = ST.getTargetTriple(); + + // PPC is big endian + std::string Ret = "E"; + + // PPC64 has 64 bit pointers, PPC32 has 32 bit pointers. + if (ST.isPPC64()) + Ret += "-p:64:64"; + else + Ret += "-p:32:32"; + + // Note, the alignment values for f64 and i64 on ppc64 in Darwin + // documentation are wrong; these are correct (i.e. "what gcc does"). + if (ST.isPPC64() || ST.isSVR4ABI()) + Ret += "-f64:64:64-i64:64:64"; + else + Ret += "-f64:32:64"; + + // Set support for 128 floats depending on the ABI. + if (!ST.isPPC64() && ST.isSVR4ABI()) + Ret += "-f128:64:128"; + + // Some ABIs support 128 bit vectors. + if (ST.isPPC64() && ST.isSVR4ABI()) + Ret += "-v128:128:128"; + + // PPC64 has 32 and 64 bit register, PPC32 has only 32 bit ones. + if (ST.isPPC64()) + Ret += "-n32:64"; + else + Ret += "-n32"; + + return Ret; +} + PPCTargetMachine::PPCTargetMachine(const Target &T, StringRef TT, StringRef CPU, StringRef FS, const TargetOptions &Options, @@ -41,7 +78,7 @@ PPCTargetMachine::PPCTargetMachine(const Target &T, StringRef TT, bool is64Bit) : LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL), Subtarget(TT, CPU, FS, is64Bit), - DL(Subtarget.getDataLayoutString()), InstrInfo(*this), + DL(getDataLayoutString(Subtarget)), InstrInfo(*this), FrameLowering(Subtarget), JITInfo(*this, is64Bit), TLInfo(*this), TSInfo(*this), InstrItins(Subtarget.getInstrItineraryData()) { diff --git a/contrib/llvm/lib/Target/R600/AMDGPUISelLowering.cpp b/contrib/llvm/lib/Target/R600/AMDGPUISelLowering.cpp index c4d75ffa0d0..1029f306d63 100644 --- a/contrib/llvm/lib/Target/R600/AMDGPUISelLowering.cpp +++ b/contrib/llvm/lib/Target/R600/AMDGPUISelLowering.cpp @@ -133,6 +133,8 @@ AMDGPUTargetLowering::AMDGPUTargetLowering(TargetMachine &TM) : setLoadExtAction(ISD::SEXTLOAD, MVT::v4i16, Expand); setLoadExtAction(ISD::ZEXTLOAD, MVT::v4i16, Expand); + setOperationAction(ISD::BR_CC, MVT::i1, Expand); + setOperationAction(ISD::FNEG, MVT::v2f32, Expand); setOperationAction(ISD::FNEG, MVT::v4f32, Expand); diff --git a/contrib/llvm/lib/Target/R600/AMDGPUInstructions.td b/contrib/llvm/lib/Target/R600/AMDGPUInstructions.td index 3c5375d84ec..7acd67313ee 100644 --- a/contrib/llvm/lib/Target/R600/AMDGPUInstructions.td +++ b/contrib/llvm/lib/Target/R600/AMDGPUInstructions.td @@ -388,6 +388,11 @@ class SHA256MaPattern : Pat < // Bitfield extract patterns +/* + +XXX: The BFE pattern is not working correctly because the XForm is not being +applied. + def legalshift32 : ImmLeaf =0 && Imm < 32;}]>; def bfemask : PatLeaf <(imm), [{return isMask_32(N->getZExtValue());}], SDNodeXFormgetTargetConstant(CountTrailingOnes_32(N->getZExtValue()), MVT::i32);}]>>; @@ -397,6 +402,8 @@ class BFEPattern : Pat < (BFE $x, $y, $z) >; +*/ + // rotr pattern class ROTRPattern : Pat < (rotr i32:$src0, i32:$src1), diff --git a/contrib/llvm/lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp b/contrib/llvm/lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp index 4a8e1b0b2d8..9b26af7bc73 100644 --- a/contrib/llvm/lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp +++ b/contrib/llvm/lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp @@ -13,7 +13,6 @@ using namespace llvm; AMDGPUMCAsmInfo::AMDGPUMCAsmInfo(StringRef &TT) : MCAsmInfo() { HasSingleParameterDotFile = false; - WeakDefDirective = 0; //===------------------------------------------------------------------===// HasSubsectionsViaSymbols = true; HasMachoZeroFillDirective = false; @@ -58,7 +57,6 @@ AMDGPUMCAsmInfo::AMDGPUMCAsmInfo(StringRef &TT) : MCAsmInfo() { HasDotTypeDotSizeDirective = false; HasNoDeadStrip = true; WeakRefDirective = ".weakref\t"; - LinkOnceDirective = 0; //===--- Dwarf Emission Directives -----------------------------------===// HasLEB128 = true; SupportsDebugInformation = true; diff --git a/contrib/llvm/lib/Target/R600/R600ControlFlowFinalizer.cpp b/contrib/llvm/lib/Target/R600/R600ControlFlowFinalizer.cpp index ac3d8f63d57..2a8276b2214 100644 --- a/contrib/llvm/lib/Target/R600/R600ControlFlowFinalizer.cpp +++ b/contrib/llvm/lib/Target/R600/R600ControlFlowFinalizer.cpp @@ -356,6 +356,7 @@ class R600ControlFlowFinalizer : public MachineFunctionPass { DEBUG(dbgs() << CfCount << ":"; I->dump();); FetchClauses.push_back(MakeFetchClause(MBB, I)); CfCount++; + LastAlu.back() = 0; continue; } diff --git a/contrib/llvm/lib/Target/R600/R600InstrInfo.cpp b/contrib/llvm/lib/Target/R600/R600InstrInfo.cpp index c0827fc1ca4..2eca6cf4327 100644 --- a/contrib/llvm/lib/Target/R600/R600InstrInfo.cpp +++ b/contrib/llvm/lib/Target/R600/R600InstrInfo.cpp @@ -716,7 +716,13 @@ R600InstrInfo::AnalyzeBranch(MachineBasicBlock &MBB, return false; } - // Get the last instruction in the block. + // Remove successive JUMP + while (I != MBB.begin() && llvm::prior(I)->getOpcode() == AMDGPU::JUMP) { + MachineBasicBlock::iterator PriorI = llvm::prior(I); + if (AllowModify) + I->removeFromParent(); + I = PriorI; + } MachineInstr *LastInst = I; // If there is only one terminator instruction, process it. diff --git a/contrib/llvm/lib/Target/R600/R600Instructions.td b/contrib/llvm/lib/Target/R600/R600Instructions.td index 0346e24ab77..74c65daa065 100644 --- a/contrib/llvm/lib/Target/R600/R600Instructions.td +++ b/contrib/llvm/lib/Target/R600/R600Instructions.td @@ -1516,7 +1516,9 @@ let Predicates = [isEGorCayman] in { i32:$src2))], VecALU >; - def : BFEPattern ; +// XXX: This pattern is broken, disabling for now. See comment in +// AMDGPUInstructions.td for more info. +// def : BFEPattern ; def BFI_INT_eg : R600_3OP <0x06, "BFI_INT", [], VecALU>; defm : BFIPatterns ; @@ -1636,7 +1638,6 @@ class R600_LDS_1A lds_op, string name, list pattern> : R600_LDS < let src2 = 0; let src2_rel = 0; - let Defs = [OQAP]; let usesCustomInserter = 1; let LDS_1A = 1; let DisableEncoding = "$dst"; @@ -1672,7 +1673,6 @@ class R600_LDS_1A1D_RET lds_op, string name, list pattern> : let BaseOp = name; let usesCustomInserter = 1; let DisableEncoding = "$dst"; - let Defs = [OQAP]; } class R600_LDS_1A2D lds_op, string name, list pattern> : diff --git a/contrib/llvm/lib/Target/R600/SIFixSGPRCopies.cpp b/contrib/llvm/lib/Target/R600/SIFixSGPRCopies.cpp index 3370c7955bc..f0065ea13c5 100644 --- a/contrib/llvm/lib/Target/R600/SIFixSGPRCopies.cpp +++ b/contrib/llvm/lib/Target/R600/SIFixSGPRCopies.cpp @@ -187,7 +187,7 @@ bool SIFixSGPRCopies::isVGPRToSGPRCopy(const MachineInstr &Copy, DstRC == &AMDGPU::M0RegRegClass) return false; - SrcRC = inferRegClassFromDef(TRI, MRI, SrcReg, SrcSubReg); + SrcRC = TRI->getSubRegClass(MRI.getRegClass(SrcReg), SrcSubReg); return TRI->isSGPRClass(DstRC) && TRI->hasVGPRs(SrcRC); } diff --git a/contrib/llvm/lib/Target/R600/SIInsertWaits.cpp b/contrib/llvm/lib/Target/R600/SIInsertWaits.cpp index 7ef662eb65b..695ec407fdb 100644 --- a/contrib/llvm/lib/Target/R600/SIInsertWaits.cpp +++ b/contrib/llvm/lib/Target/R600/SIInsertWaits.cpp @@ -314,6 +314,12 @@ Counters SIInsertWaits::handleOperands(MachineInstr &MI) { Counters Result = ZeroCounts; + // S_SENDMSG implicitly waits for all outstanding LGKM transfers to finish, + // but we also want to wait for any other outstanding transfers before + // signalling other hardware blocks + if (MI.getOpcode() == AMDGPU::S_SENDMSG) + return LastIssued; + // For each register affected by this // instruction increase the result sequence for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { diff --git a/contrib/llvm/lib/Target/R600/SIInstrInfo.td b/contrib/llvm/lib/Target/R600/SIInstrInfo.td index 4cd0daa55c5..b7879c6efac 100644 --- a/contrib/llvm/lib/Target/R600/SIInstrInfo.td +++ b/contrib/llvm/lib/Target/R600/SIInstrInfo.td @@ -290,10 +290,10 @@ multiclass VOP2_64 op, string opName, list pattern, : VOP2_Helper ; multiclass VOP2b_32 op, string opName, list pattern, - string revOp = opName> { + RegisterClass src0_rc, string revOp = opName> { def _e32 : VOP2 < - op, (outs VReg_32:$dst), (ins VSrc_32:$src0, VReg_32:$src1), + op, (outs VReg_32:$dst), (ins src0_rc:$src0, VReg_32:$src1), opName#"_e32 $dst, $src0, $src1", pattern >, VOP , VOP2_REV; @@ -425,26 +425,48 @@ class MTBUF_Store_Helper op, string asm, RegisterClass regClass> : MTBU multiclass MUBUF_Load_Helper op, string asm, RegisterClass regClass> { - let glc = 0, lds = 0, slc = 0, tfe = 0, soffset = 128 /* ZERO */, - mayLoad = 1 in { + let lds = 0, mayLoad = 1 in { - let offen = 1, idxen = 0, addr64 = 0, offset = 0 in { - def _OFFEN : MUBUF ; - } + let addr64 = 0 in { - let offen = 0, idxen = 1, addr64 = 0 in { - def _IDXEN : MUBUF ; - } + let offen = 0, idxen = 0 in { + def _OFFSET : MUBUF ; + } - let offen = 0, idxen = 0, addr64 = 1 in { - def _ADDR64 : MUBUF ; - } + let offen = 1, idxen = 0, offset = 0 in { + def _OFFEN : MUBUF ; + } + + let offen = 0, idxen = 1 in { + def _IDXEN : MUBUF ; + } + + let offen = 1, idxen = 1 in { + def _BOTHEN : MUBUF ; + } + } + + let offen = 0, idxen = 0, addr64 = 1, glc = 0, slc = 0, tfe = 0, soffset = 128 /* ZERO */ in { + def _ADDR64 : MUBUF ; + } } } diff --git a/contrib/llvm/lib/Target/R600/SIInstructions.td b/contrib/llvm/lib/Target/R600/SIInstructions.td index 76f05eb4965..2ca6a95978b 100644 --- a/contrib/llvm/lib/Target/R600/SIInstructions.td +++ b/contrib/llvm/lib/Target/R600/SIInstructions.td @@ -22,6 +22,8 @@ def InterpSlot : Operand { let PrintMethod = "printInterpSlot"; } +def SendMsgImm : Operand; + def isSI : Predicate<"Subtarget.getGeneration() " ">= AMDGPUSubtarget::SOUTHERN_ISLANDS">; @@ -826,17 +828,25 @@ def S_BARRIER : SOPP <0x0000000a, (ins), "S_BARRIER", def S_WAITCNT : SOPP <0x0000000c, (ins WAIT_FLAG:$simm16), "S_WAITCNT $simm16", [] >; -} // End hasSideEffects //def S_SETHALT : SOPP_ <0x0000000d, "S_SETHALT", []>; //def S_SLEEP : SOPP_ <0x0000000e, "S_SLEEP", []>; //def S_SETPRIO : SOPP_ <0x0000000f, "S_SETPRIO", []>; -//def S_SENDMSG : SOPP_ <0x00000010, "S_SENDMSG", []>; + +let Uses = [EXEC] in { + def S_SENDMSG : SOPP <0x00000010, (ins SendMsgImm:$simm16, M0Reg:$m0), "S_SENDMSG $simm16", + [(int_SI_sendmsg imm:$simm16, M0Reg:$m0)] + > { + let DisableEncoding = "$m0"; + } +} // End Uses = [EXEC] + //def S_SENDMSGHALT : SOPP_ <0x00000011, "S_SENDMSGHALT", []>; //def S_TRAP : SOPP_ <0x00000012, "S_TRAP", []>; //def S_ICACHE_INV : SOPP_ <0x00000013, "S_ICACHE_INV", []>; //def S_INCPERFLEVEL : SOPP_ <0x00000014, "S_INCPERFLEVEL", []>; //def S_DECPERFLEVEL : SOPP_ <0x00000015, "S_DECPERFLEVEL", []>; //def S_TTRACEDATA : SOPP_ <0x00000016, "S_TTRACEDATA", []>; +} // End hasSideEffects def V_CNDMASK_B32_e32 : VOP2 <0x00000000, (outs VReg_32:$dst), (ins VSrc_32:$src0, VReg_32:$src1, VCCReg:$vcc), @@ -979,14 +989,16 @@ defm V_MBCNT_HI_U32_B32 : VOP2_32 <0x00000024, "V_MBCNT_HI_U32_B32", []>; let isCommutable = 1, Defs = [VCC] in { // Carry-out goes to VCC // No patterns so that the scalar instructions are always selected. // The scalar versions will be replaced with vector when needed later. -defm V_ADD_I32 : VOP2b_32 <0x00000025, "V_ADD_I32", []>; -defm V_SUB_I32 : VOP2b_32 <0x00000026, "V_SUB_I32", []>; -defm V_SUBREV_I32 : VOP2b_32 <0x00000027, "V_SUBREV_I32", [], "V_SUB_I32">; +defm V_ADD_I32 : VOP2b_32 <0x00000025, "V_ADD_I32", [], VSrc_32>; +defm V_SUB_I32 : VOP2b_32 <0x00000026, "V_SUB_I32", [], VSrc_32>; +defm V_SUBREV_I32 : VOP2b_32 <0x00000027, "V_SUBREV_I32", [], VSrc_32, + "V_SUB_I32">; let Uses = [VCC] in { // Carry-in comes from VCC -defm V_ADDC_U32 : VOP2b_32 <0x00000028, "V_ADDC_U32", []>; -defm V_SUBB_U32 : VOP2b_32 <0x00000029, "V_SUBB_U32", []>; -defm V_SUBBREV_U32 : VOP2b_32 <0x0000002a, "V_SUBBREV_U32", [], "V_SUBB_U32">; +defm V_ADDC_U32 : VOP2b_32 <0x00000028, "V_ADDC_U32", [], VReg_32>; +defm V_SUBB_U32 : VOP2b_32 <0x00000029, "V_SUBB_U32", [], VReg_32>; +defm V_SUBBREV_U32 : VOP2b_32 <0x0000002a, "V_SUBBREV_U32", [], VReg_32, + "V_SUBB_U32">; } // End Uses = [VCC] } // End isCommutable = 1, Defs = [VCC] @@ -1403,7 +1415,7 @@ def : Pat < /* int_SI_vs_load_input */ def : Pat< (SIload_input i128:$tlst, IMM12bit:$attr_offset, i32:$buf_idx_vgpr), - (BUFFER_LOAD_FORMAT_XYZW_IDXEN $tlst, $buf_idx_vgpr, imm:$attr_offset) + (BUFFER_LOAD_FORMAT_XYZW_IDXEN $tlst, $buf_idx_vgpr, imm:$attr_offset, 0, 0, 0, 0) >; /* int_SI_export */ @@ -1658,16 +1670,30 @@ def : Pat < 0 /* ABS */, 1 /* CLAMP */, 0 /* OMOD */, 0 /* NEG */) >; +/********** ================================ **********/ +/********** Floating point absolute/negative **********/ +/********** ================================ **********/ + +// Manipulate the sign bit directly, as e.g. using the source negation modifier +// in V_ADD_F32_e64 $src, 0, [...] does not result in -0.0 for $src == +0.0, +// breaking the piglit *s-floatBitsToInt-neg* tests + +// TODO: Look into not implementing isFNegFree/isFAbsFree for SI, and possibly +// removing these patterns + +def : Pat < + (fneg (fabs f32:$src)), + (V_OR_B32_e32 $src, (V_MOV_B32_e32 0x80000000)) /* Set sign bit */ +>; + def : Pat < (fabs f32:$src), - (V_ADD_F32_e64 $src, (i32 0 /* SRC1 */), - 1 /* ABS */, 0 /* CLAMP */, 0 /* OMOD */, 0 /* NEG */) + (V_AND_B32_e32 $src, (V_MOV_B32_e32 0x7fffffff)) /* Clear sign bit */ >; def : Pat < (fneg f32:$src), - (V_ADD_F32_e64 $src, (i32 0 /* SRC1 */), - 0 /* ABS */, 0 /* CLAMP */, 0 /* OMOD */, 1 /* NEG */) + (V_XOR_B32_e32 $src, (V_MOV_B32_e32 0x80000000)) /* Toggle sign bit */ >; /********** ================== **********/ @@ -1794,6 +1820,11 @@ def : Pat < (V_CNDMASK_B32_e64 (i32 0), (i32 -1), $src0) >; +def : Pat < + (i32 (zext i1:$src0)), + (V_CNDMASK_B32_e64 (i32 0), (i32 1), $src0) +>; + // 1. Offset as 8bit DWORD immediate def : Pat < (SIload_constant i128:$sbase, IMM8bitDWORD:$offset), @@ -1809,7 +1840,7 @@ def : Pat < // 3. Offset in an 32Bit VGPR def : Pat < (SIload_constant i128:$sbase, i32:$voff), - (BUFFER_LOAD_DWORD_OFFEN $sbase, $voff) + (BUFFER_LOAD_DWORD_OFFEN $sbase, $voff, 0, 0, 0, 0) >; // The multiplication scales from [0,1] to the unsigned integer range @@ -1970,6 +2001,50 @@ defm : MUBUFStore_Pattern ; defm : MUBUFStore_Pattern ; defm : MUBUFStore_Pattern ; +// BUFFER_LOAD_DWORD*, addr64=0 +multiclass MUBUF_Load_Dword { + + def : Pat < + (vt (int_SI_buffer_load_dword i128:$rsrc, i32:$vaddr, i32:$soffset, + imm:$offset, 0, 0, imm:$glc, imm:$slc, + imm:$tfe)), + (offset $rsrc, $vaddr, (as_i16imm $offset), $soffset, (as_i1imm $glc), + (as_i1imm $slc), (as_i1imm $tfe)) + >; + + def : Pat < + (vt (int_SI_buffer_load_dword i128:$rsrc, i32:$vaddr, i32:$soffset, + imm, 1, 0, imm:$glc, imm:$slc, + imm:$tfe)), + (offen $rsrc, $vaddr, $soffset, (as_i1imm $glc), (as_i1imm $slc), + (as_i1imm $tfe)) + >; + + def : Pat < + (vt (int_SI_buffer_load_dword i128:$rsrc, i32:$vaddr, i32:$soffset, + imm:$offset, 0, 1, imm:$glc, imm:$slc, + imm:$tfe)), + (idxen $rsrc, $vaddr, (as_i16imm $offset), $soffset, (as_i1imm $glc), + (as_i1imm $slc), (as_i1imm $tfe)) + >; + + def : Pat < + (vt (int_SI_buffer_load_dword i128:$rsrc, v2i32:$vaddr, i32:$soffset, + imm, 1, 1, imm:$glc, imm:$slc, + imm:$tfe)), + (bothen $rsrc, $vaddr, $soffset, (as_i1imm $glc), (as_i1imm $slc), + (as_i1imm $tfe)) + >; +} + +defm : MUBUF_Load_Dword ; +defm : MUBUF_Load_Dword ; +defm : MUBUF_Load_Dword ; + //===----------------------------------------------------------------------===// // MTBUF Patterns //===----------------------------------------------------------------------===// @@ -2057,6 +2132,11 @@ def : Pat < (EXTRACT_SUBREG $a, sub0) >; +def : Pat < + (i1 (trunc i32:$a)), + (V_CMP_EQ_I32_e64 (V_AND_B32_e32 (i32 1), $a), 1) +>; + // V_ADD_I32_e32/S_ADD_I32 produces carry in VCC/SCC. For the vector // case, the sgpr-copies pass will fix this to use the vector version. def : Pat < diff --git a/contrib/llvm/lib/Target/R600/SIIntrinsics.td b/contrib/llvm/lib/Target/R600/SIIntrinsics.td index 7fcc9645211..00e32c03a99 100644 --- a/contrib/llvm/lib/Target/R600/SIIntrinsics.td +++ b/contrib/llvm/lib/Target/R600/SIIntrinsics.td @@ -38,6 +38,22 @@ let TargetPrefix = "SI", isTarget = 1 in { llvm_i32_ty], // tfe(imm) []>; + // Fully-flexible BUFFER_LOAD_DWORD_* except for the ADDR64 bit, which is not exposed + def int_SI_buffer_load_dword : Intrinsic < + [llvm_anyint_ty], // vdata(VGPR), overloaded for types i32, v2i32, v4i32 + [llvm_anyint_ty, // rsrc(SGPR) + llvm_anyint_ty, // vaddr(VGPR) + llvm_i32_ty, // soffset(SGPR) + llvm_i32_ty, // inst_offset(imm) + llvm_i32_ty, // offen(imm) + llvm_i32_ty, // idxen(imm) + llvm_i32_ty, // glc(imm) + llvm_i32_ty, // slc(imm) + llvm_i32_ty], // tfe(imm) + [IntrReadArgMem]>; + + def int_SI_sendmsg : Intrinsic <[], [llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>; + class Sample : Intrinsic <[llvm_v4f32_ty], [llvm_anyvector_ty, llvm_v32i8_ty, llvm_anyint_ty, llvm_i32_ty], [IntrNoMem]>; def int_SI_sample : Sample; diff --git a/contrib/llvm/lib/Target/R600/SILowerControlFlow.cpp b/contrib/llvm/lib/Target/R600/SILowerControlFlow.cpp index 958763dffc2..ef867d36692 100644 --- a/contrib/llvm/lib/Target/R600/SILowerControlFlow.cpp +++ b/contrib/llvm/lib/Target/R600/SILowerControlFlow.cpp @@ -109,6 +109,23 @@ FunctionPass *llvm::createSILowerControlFlowPass(TargetMachine &tm) { return new SILowerControlFlowPass(tm); } +static bool isDS(unsigned Opcode) { + switch(Opcode) { + default: return false; + case AMDGPU::DS_ADD_U32_RTN: + case AMDGPU::DS_SUB_U32_RTN: + case AMDGPU::DS_WRITE_B32: + case AMDGPU::DS_WRITE_B8: + case AMDGPU::DS_WRITE_B16: + case AMDGPU::DS_READ_B32: + case AMDGPU::DS_READ_I8: + case AMDGPU::DS_READ_U8: + case AMDGPU::DS_READ_I16: + case AMDGPU::DS_READ_U16: + return true; + } +} + bool SILowerControlFlowPass::shouldSkip(MachineBasicBlock *From, MachineBasicBlock *To) { @@ -145,7 +162,9 @@ void SILowerControlFlowPass::SkipIfDead(MachineInstr &MI) { MachineBasicBlock &MBB = *MI.getParent(); DebugLoc DL = MI.getDebugLoc(); - if (!shouldSkip(&MBB, &MBB.getParent()->back())) + if (MBB.getParent()->getInfo()->ShaderType != + ShaderType::PIXEL || + !shouldSkip(&MBB, &MBB.getParent()->back())) return; MachineBasicBlock::iterator Insert = &MI; @@ -296,9 +315,11 @@ void SILowerControlFlowPass::Kill(MachineInstr &MI) { MachineBasicBlock &MBB = *MI.getParent(); DebugLoc DL = MI.getDebugLoc(); - // Kill is only allowed in pixel shaders + // Kill is only allowed in pixel / geometry shaders assert(MBB.getParent()->getInfo()->ShaderType == - ShaderType::PIXEL); + ShaderType::PIXEL || + MBB.getParent()->getInfo()->ShaderType == + ShaderType::GEOMETRY); // Clear this pixel from the exec mask if the operand is negative BuildMI(MBB, &MI, DL, TII->get(AMDGPU::V_CMPX_LE_F32_e32), AMDGPU::VCC) @@ -431,6 +452,11 @@ bool SILowerControlFlowPass::runOnMachineFunction(MachineFunction &MF) { Next = llvm::next(I); MachineInstr &MI = *I; + if (isDS(MI.getOpcode())) { + NeedM0 = true; + NeedWQM = true; + } + switch (MI.getOpcode()) { default: break; case AMDGPU::SI_IF: @@ -491,14 +517,6 @@ bool SILowerControlFlowPass::runOnMachineFunction(MachineFunction &MF) { IndirectDst(MI); break; - case AMDGPU::DS_READ_B32: - NeedWQM = true; - // Fall through - case AMDGPU::DS_WRITE_B32: - case AMDGPU::DS_ADD_U32_RTN: - NeedM0 = true; - break; - case AMDGPU::V_INTERP_P1_F32: case AMDGPU::V_INTERP_P2_F32: case AMDGPU::V_INTERP_MOV_F32: @@ -517,7 +535,7 @@ bool SILowerControlFlowPass::runOnMachineFunction(MachineFunction &MF) { AMDGPU::M0).addImm(0xffffffff); } - if (NeedWQM && MFI->ShaderType != ShaderType::COMPUTE) { + if (NeedWQM && MFI->ShaderType == ShaderType::PIXEL) { MachineBasicBlock &MBB = MF.front(); BuildMI(MBB, MBB.getFirstNonPHI(), DebugLoc(), TII->get(AMDGPU::S_WQM_B64), AMDGPU::EXEC).addReg(AMDGPU::EXEC); diff --git a/contrib/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/contrib/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp index bc8f367e925..22b79b3b284 100644 --- a/contrib/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/contrib/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -1181,16 +1181,23 @@ X86AsmParser::CreateMemForInlineAsm(unsigned SegReg, const MCExpr *Disp, unsigned Scale, SMLoc Start, SMLoc End, unsigned Size, StringRef Identifier, InlineAsmIdentifierInfo &Info){ - if (isa(Disp)) { - // If this is not a VarDecl then assume it is a FuncDecl or some other label - // reference. We need an 'r' constraint here, so we need to create register - // operand to ensure proper matching. Just pick a GPR based on the size of - // a pointer. - if (!Info.IsVarDecl) { - unsigned RegNo = is64BitMode() ? X86::RBX : X86::EBX; - return X86Operand::CreateReg(RegNo, Start, End, /*AddressOf=*/true, - SMLoc(), Identifier, Info.OpDecl); - } + // If this is not a VarDecl then assume it is a FuncDecl or some other label + // reference. We need an 'r' constraint here, so we need to create register + // operand to ensure proper matching. Just pick a GPR based on the size of + // a pointer. + if (isa(Disp) && !Info.IsVarDecl) { + unsigned RegNo = is64BitMode() ? X86::RBX : X86::EBX; + return X86Operand::CreateReg(RegNo, Start, End, /*AddressOf=*/true, + SMLoc(), Identifier, Info.OpDecl); + } + + // We either have a direct symbol reference, or an offset from a symbol. The + // parser always puts the symbol on the LHS, so look there for size + // calculation purposes. + const MCBinaryExpr *BinOp = dyn_cast(Disp); + bool IsSymRef = + isa(BinOp ? BinOp->getLHS() : Disp); + if (IsSymRef) { if (!Size) { Size = Info.Type * 8; // Size is in terms of bits in this context. if (Size) @@ -1312,10 +1319,15 @@ bool X86AsmParser::ParseIntelExpression(IntelExprStateMachine &SM, SMLoc &End) { if (getParser().parsePrimaryExpr(Val, End)) return Error(Tok.getLoc(), "Unexpected identifier!"); } else { - InlineAsmIdentifierInfo &Info = SM.getIdentifierInfo(); - if (ParseIntelIdentifier(Val, Identifier, Info, - /*Unevaluated=*/false, End)) - return true; + // This is a dot operator, not an adjacent identifier. + if (Identifier.find('.') != StringRef::npos) { + return false; + } else { + InlineAsmIdentifierInfo &Info = SM.getIdentifierInfo(); + if (ParseIntelIdentifier(Val, Identifier, Info, + /*Unevaluated=*/false, End)) + return true; + } } SM.onIdentifierExpr(Val, Identifier); UpdateLocLex = false; @@ -1366,7 +1378,7 @@ X86Operand *X86AsmParser::ParseIntelBracExpression(unsigned SegReg, SMLoc Start, if (ParseIntelExpression(SM, End)) return 0; - const MCExpr *Disp; + const MCExpr *Disp = 0; if (const MCExpr *Sym = SM.getSym()) { // A symbolic displacement. Disp = Sym; @@ -1374,13 +1386,20 @@ X86Operand *X86AsmParser::ParseIntelBracExpression(unsigned SegReg, SMLoc Start, RewriteIntelBracExpression(InstInfo->AsmRewrites, SM.getSymName(), ImmDisp, SM.getImm(), BracLoc, StartInBrac, End); - } else { - // An immediate displacement only. - Disp = MCConstantExpr::Create(SM.getImm(), getContext()); } - // Parse the dot operator (e.g., [ebx].foo.bar). - if (Tok.getString().startswith(".")) { + if (SM.getImm() || !Disp) { + const MCExpr *Imm = MCConstantExpr::Create(SM.getImm(), getContext()); + if (Disp) + Disp = MCBinaryExpr::CreateAdd(Disp, Imm, getContext()); + else + Disp = Imm; // An immediate displacement only. + } + + // Parse struct field access. Intel requires a dot, but MSVC doesn't. MSVC + // will in fact do global lookup the field name inside all global typedefs, + // but we don't emulate that. + if (Tok.getString().find('.') != StringRef::npos) { const MCExpr *NewDisp; if (ParseIntelDotOperator(Disp, NewDisp)) return 0; @@ -1532,8 +1551,10 @@ bool X86AsmParser::ParseIntelDotOperator(const MCExpr *Disp, else return Error(Tok.getLoc(), "Non-constant offsets are not supported!"); - // Drop the '.'. - StringRef DotDispStr = Tok.getString().drop_front(1); + // Drop the optional '.'. + StringRef DotDispStr = Tok.getString(); + if (DotDispStr.startswith(".")) + DotDispStr = DotDispStr.drop_front(1); // .Imm gets lexed as a real. if (Tok.is(AsmToken::Real)) { diff --git a/contrib/llvm/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c b/contrib/llvm/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c index c81a85755f8..16ee0d357b7 100644 --- a/contrib/llvm/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c +++ b/contrib/llvm/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c @@ -1065,6 +1065,7 @@ static int readSIB(struct InternalInstruction* insn) { switch (base) { case 0x5: + case 0xd: switch (modFromModRM(insn->modRM)) { case 0x0: insn->eaDisplacement = EA_DISP_32; @@ -1072,13 +1073,11 @@ static int readSIB(struct InternalInstruction* insn) { break; case 0x1: insn->eaDisplacement = EA_DISP_8; - insn->sibBase = (insn->addressSize == 4 ? - SIB_BASE_EBP : SIB_BASE_RBP); + insn->sibBase = (SIBBase)(sibBaseBase + base); break; case 0x2: insn->eaDisplacement = EA_DISP_32; - insn->sibBase = (insn->addressSize == 4 ? - SIB_BASE_EBP : SIB_BASE_RBP); + insn->sibBase = (SIBBase)(sibBaseBase + base); break; case 0x3: debug("Cannot have Mod = 0b11 and a SIB byte"); diff --git a/contrib/llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp b/contrib/llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp index 3861e1ce290..8d2b5954ef2 100644 --- a/contrib/llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp +++ b/contrib/llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp @@ -65,6 +65,17 @@ X86MCAsmInfoDarwin::X86MCAsmInfoDarwin(const Triple &T) { // Exceptions handling ExceptionsType = ExceptionHandling::DwarfCFI; + + // FIXME: this should not depend on the target OS version, but on the ld64 + // version in use. From at least >= ld64-97.17 (Xcode 3.2.6) the abs-ified + // FDE relocs may be used. + DwarfFDESymbolsUseAbsDiff = T.isMacOSX() && !T.isMacOSXVersionLT(10, 6); + + // old assembler lacks some directives + // FIXME: this should really be a check on the assembler characteristics + // rather than OS version + if (T.isMacOSX() && T.isMacOSXVersionLT(10, 6)) + HasWeakDefCanBeHiddenDirective = false; } X86_64MCAsmInfoDarwin::X86_64MCAsmInfoDarwin(const Triple &Triple) diff --git a/contrib/llvm/lib/Target/X86/X86AsmPrinter.cpp b/contrib/llvm/lib/Target/X86/X86AsmPrinter.cpp index 12584411509..1f5f91844f8 100644 --- a/contrib/llvm/lib/Target/X86/X86AsmPrinter.cpp +++ b/contrib/llvm/lib/Target/X86/X86AsmPrinter.cpp @@ -393,9 +393,11 @@ bool X86AsmPrinter::printAsmMRegister(const MachineOperand &MO, char Mode, case 'k': // Print SImode register Reg = getX86SubSuperRegister(Reg, MVT::i32); break; - case 'q': // Print DImode register - // FIXME: gcc will actually print e instead of r for 32-bit. - Reg = getX86SubSuperRegister(Reg, MVT::i64); + case 'q': + // Print 64-bit register names if 64-bit integer registers are available. + // Otherwise, print 32-bit register names. + MVT::SimpleValueType Ty = Subtarget->is64Bit() ? MVT::i64 : MVT::i32; + Reg = getX86SubSuperRegister(Reg, Ty); break; } diff --git a/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp b/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp index 76eeb64650b..716c146811a 100644 --- a/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -15226,9 +15226,15 @@ X86TargetLowering::EmitVAStartSaveXMMRegsWithCustomInserter( MBB->addSuccessor(EndMBB); } + // Make sure the last operand is EFLAGS, which gets clobbered by the branch + // that was just emitted, but clearly shouldn't be "saved". + assert((MI->getNumOperands() <= 3 || + !MI->getOperand(MI->getNumOperands() - 1).isReg() || + MI->getOperand(MI->getNumOperands() - 1).getReg() == X86::EFLAGS) + && "Expected last argument to be EFLAGS"); unsigned MOVOpc = Subtarget->hasFp256() ? X86::VMOVAPSmr : X86::MOVAPSmr; // In the XMM save block, save all the XMM argument registers. - for (int i = 3, e = MI->getNumOperands(); i != e; ++i) { + for (int i = 3, e = MI->getNumOperands() - 1; i != e; ++i) { int64_t Offset = (i - 3) * 16 + VarArgsFPOffset; MachineMemOperand *MMO = F->getMachineMemOperand( @@ -17577,12 +17583,30 @@ static SDValue CMPEQCombine(SDNode *N, SelectionDAG &DAG, // FIXME: need symbolic constants for these magic numbers. // See X86ATTInstPrinter.cpp:printSSECC(). unsigned x86cc = (cc0 == X86::COND_E) ? 0 : 4; - SDValue OnesOrZeroesF = DAG.getNode(NTOperator, DL, MVT::f32, CMP00, CMP01, + SDValue OnesOrZeroesF = DAG.getNode(NTOperator, DL, CMP00.getValueType(), + CMP00, CMP01, DAG.getConstant(x86cc, MVT::i8)); - SDValue OnesOrZeroesI = DAG.getNode(ISD::BITCAST, DL, MVT::i32, - OnesOrZeroesF); - SDValue ANDed = DAG.getNode(ISD::AND, DL, MVT::i32, OnesOrZeroesI, - DAG.getConstant(1, MVT::i32)); + + MVT IntVT = is64BitFP ? MVT::i64 : MVT::i32; + + if (is64BitFP && !Subtarget->is64Bit()) { + // On a 32-bit target, we cannot bitcast the 64-bit float to a + // 64-bit integer, since that's not a legal type. Since + // OnesOrZeroesF is all ones of all zeroes, we don't need all the + // bits, but can do this little dance to extract the lowest 32 bits + // and work with those going forward. + SDValue Vector64 = DAG.getNode(ISD::SCALAR_TO_VECTOR, DL, MVT::v2f64, + OnesOrZeroesF); + SDValue Vector32 = DAG.getNode(ISD::BITCAST, DL, MVT::v4f32, + Vector64); + OnesOrZeroesF = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, DL, MVT::f32, + Vector32, DAG.getIntPtrConstant(0)); + IntVT = MVT::i32; + } + + SDValue OnesOrZeroesI = DAG.getNode(ISD::BITCAST, DL, IntVT, OnesOrZeroesF); + SDValue ANDed = DAG.getNode(ISD::AND, DL, IntVT, OnesOrZeroesI, + DAG.getConstant(1, IntVT)); SDValue OneBitOfTruth = DAG.getNode(ISD::TRUNCATE, DL, MVT::i8, ANDed); return OneBitOfTruth; } diff --git a/contrib/llvm/lib/Target/X86/X86InstrCompiler.td b/contrib/llvm/lib/Target/X86/X86InstrCompiler.td index 7d10b67bfe6..5c8840823b1 100644 --- a/contrib/llvm/lib/Target/X86/X86InstrCompiler.td +++ b/contrib/llvm/lib/Target/X86/X86InstrCompiler.td @@ -72,7 +72,7 @@ def ADJCALLSTACKUP64 : I<0, Pseudo, (outs), (ins i32imm:$amt1, i32imm:$amt2), // x86-64 va_start lowering magic. -let usesCustomInserter = 1 in { +let usesCustomInserter = 1, Defs = [EFLAGS] in { def VASTART_SAVE_XMM_REGS : I<0, Pseudo, (outs), (ins GR8:$al, @@ -81,7 +81,8 @@ def VASTART_SAVE_XMM_REGS : I<0, Pseudo, "#VASTART_SAVE_XMM_REGS $al, $regsavefi, $offset", [(X86vastart_save_xmm_regs GR8:$al, imm:$regsavefi, - imm:$offset)]>; + imm:$offset), + (implicit EFLAGS)]>; // The VAARG_64 pseudo-instruction takes the address of the va_list, // and places the address of the next argument into a register. diff --git a/contrib/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/contrib/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp index 1e724106991..30290ee7a79 100644 --- a/contrib/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp +++ b/contrib/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp @@ -25,11 +25,13 @@ static bool CheapToScalarize(Value *V, bool isConstant) { if (isConstant) return true; // If all elts are the same, we can extract it and use any of the values. - Constant *Op0 = C->getAggregateElement(0U); - for (unsigned i = 1, e = V->getType()->getVectorNumElements(); i != e; ++i) - if (C->getAggregateElement(i) != Op0) - return false; - return true; + if (Constant *Op0 = C->getAggregateElement(0U)) { + for (unsigned i = 1, e = V->getType()->getVectorNumElements(); i != e; + ++i) + if (C->getAggregateElement(i) != Op0) + return false; + return true; + } } Instruction *I = dyn_cast(V); if (!I) return false; diff --git a/contrib/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp b/contrib/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp index 335af81b957..643bc78f6e5 100644 --- a/contrib/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp +++ b/contrib/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp @@ -1088,9 +1088,8 @@ bool LoopReroll::reroll(Instruction *IV, Loop *L, BasicBlock *Header, L, SCEV::FlagAnyWrap)); { // Limit the lifetime of SCEVExpander. SCEVExpander Expander(*SE, "reroll"); - PHINode *NewIV = - cast(Expander.expandCodeFor(H, IV->getType(), - Header->begin())); + Value *NewIV = Expander.expandCodeFor(H, IV->getType(), Header->begin()); + for (DenseSet::iterator J = BaseUseSet.begin(), JE = BaseUseSet.end(); J != JE; ++J) (*J)->replaceUsesOfWith(IV, NewIV); @@ -1101,20 +1100,23 @@ bool LoopReroll::reroll(Instruction *IV, Loop *L, BasicBlock *Header, if (Inc == 1) ICSCEV = SE->getMulExpr(ICSCEV, SE->getConstant(ICSCEV->getType(), Scale)); - Value *IC; - if (isa(ICSCEV)) { - IC = Expander.expandCodeFor(ICSCEV, NewIV->getType(), BI); + // Iteration count SCEV minus 1 + const SCEV *ICMinus1SCEV = + SE->getMinusSCEV(ICSCEV, SE->getConstant(ICSCEV->getType(), 1)); + + Value *ICMinus1; // Iteration count minus 1 + if (isa(ICMinus1SCEV)) { + ICMinus1 = Expander.expandCodeFor(ICMinus1SCEV, NewIV->getType(), BI); } else { BasicBlock *Preheader = L->getLoopPreheader(); if (!Preheader) Preheader = InsertPreheaderForLoop(L, this); - IC = Expander.expandCodeFor(ICSCEV, NewIV->getType(), - Preheader->getTerminator()); + ICMinus1 = Expander.expandCodeFor(ICMinus1SCEV, NewIV->getType(), + Preheader->getTerminator()); } - Value *NewIVNext = NewIV->getIncomingValueForBlock(Header); - Value *Cond = new ICmpInst(BI, CmpInst::ICMP_EQ, NewIVNext, IC, + Value *Cond = new ICmpInst(BI, CmpInst::ICMP_EQ, NewIV, ICMinus1, "exitcond"); BI->setCondition(Cond); diff --git a/contrib/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/contrib/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index eff5268c448..6133962e42d 100644 --- a/contrib/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/contrib/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -3390,6 +3390,10 @@ void LSRInstance::GenerateICmpZeroScales(LSRUse &LU, unsigned LUIdx, int64_t NewBaseOffset = (uint64_t)Base.BaseOffset * Factor; if (NewBaseOffset / Factor != Base.BaseOffset) continue; + // If the offset will be truncated at this use, check that it is in bounds. + if (!IntTy->isPointerTy() && + !ConstantInt::isValueValidForType(IntTy, NewBaseOffset)) + continue; // Check that multiplying with the use offset doesn't overflow. int64_t Offset = LU.MinOffset; @@ -3398,6 +3402,10 @@ void LSRInstance::GenerateICmpZeroScales(LSRUse &LU, unsigned LUIdx, Offset = (uint64_t)Offset * Factor; if (Offset / Factor != LU.MinOffset) continue; + // If the offset will be truncated at this use, check that it is in bounds. + if (!IntTy->isPointerTy() && + !ConstantInt::isValueValidForType(IntTy, Offset)) + continue; Formula F = Base; F.BaseOffset = NewBaseOffset; @@ -3432,6 +3440,10 @@ void LSRInstance::GenerateICmpZeroScales(LSRUse &LU, unsigned LUIdx, F.UnfoldedOffset = (uint64_t)F.UnfoldedOffset * Factor; if (F.UnfoldedOffset / Factor != Base.UnfoldedOffset) continue; + // If the offset will be truncated, check that it is in bounds. + if (!IntTy->isPointerTy() && + !ConstantInt::isValueValidForType(IntTy, F.UnfoldedOffset)) + continue; } // If we make it here and it's legal, add it. diff --git a/contrib/llvm/lib/Transforms/Utils/LCSSA.cpp b/contrib/llvm/lib/Transforms/Utils/LCSSA.cpp index f15e8d59276..97e7e5d9578 100644 --- a/contrib/llvm/lib/Transforms/Utils/LCSSA.cpp +++ b/contrib/llvm/lib/Transforms/Utils/LCSSA.cpp @@ -32,6 +32,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/Statistic.h" #include "llvm/Analysis/Dominators.h" +#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/ScalarEvolution.h" #include "llvm/IR/Constants.h" @@ -70,6 +71,7 @@ namespace { AU.addRequired(); AU.addRequired(); AU.addPreservedID(LoopSimplifyID); + AU.addPreserved(); AU.addPreserved(); } private: diff --git a/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 5e758713ed1..f9f6b18940d 100644 --- a/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -4191,13 +4191,22 @@ bool LoopVectorizationLegality::AddReductionVar(PHINode *Phi, continue; } - // Process instructions only once (termination). + // Process instructions only once (termination). Each reduction cycle + // value must only be used once, except by phi nodes and min/max + // reductions which are represented as a cmp followed by a select. + ReductionInstDesc IgnoredVal(false, 0); if (VisitedInsts.insert(Usr)) { if (isa(Usr)) PHIs.push_back(Usr); else NonPHIs.push_back(Usr); - } + } else if (!isa(Usr) && + ((!isa(Usr) && + !isa(Usr) && + !isa(Usr)) || + !isMinMaxSelectCmpPattern(Usr, IgnoredVal).IsReduction)) + return false; + // Remember that we completed the cycle. if (Usr == Phi) FoundStartPHI = true; diff --git a/contrib/llvm/patches/patch-r208961-clang-version-include.diff b/contrib/llvm/patches/patch-r208961-clang-version-include.diff index fb0ac187168..993ecd9ddf2 100644 --- a/contrib/llvm/patches/patch-r208961-clang-version-include.diff +++ b/contrib/llvm/patches/patch-r208961-clang-version-include.diff @@ -1,7 +1,7 @@ This patch adjusts clang's default include paths to add FreeBSD-specific directories. -Introduced here: http://svn.freebsd.org/changeset/base/208961 +Introduced here: http://svnweb.freebsd.org/changeset/base/208961 Index: tools/clang/lib/Frontend/InitHeaderSearch.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r208987-format-extensions.diff b/contrib/llvm/patches/patch-r208987-format-extensions.diff index b01553e3e5b..6aa076c9827 100644 --- a/contrib/llvm/patches/patch-r208987-format-extensions.diff +++ b/contrib/llvm/patches/patch-r208987-format-extensions.diff @@ -1,7 +1,7 @@ This patch adds support for the FreeBSD-specific -fformat-extension option, which enables additional printf modifiers for the kernel. -Introduced here: http://svn.freebsd.org/changeset/base/208987 +Introduced here: http://svnweb.freebsd.org/changeset/base/208987 Index: tools/clang/lib/Frontend/CompilerInvocation.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r209107-clang-vendor-suffix.diff b/contrib/llvm/patches/patch-r209107-clang-vendor-suffix.diff index d761f786b06..1a26566883e 100644 --- a/contrib/llvm/patches/patch-r209107-clang-vendor-suffix.diff +++ b/contrib/llvm/patches/patch-r209107-clang-vendor-suffix.diff @@ -2,7 +2,7 @@ This patch adds a FreeBSD-specific suffix to clang's version string. This is usually of the form "(yyyyddmm)", representing the date when the compiler was last updated. -Introduced here: http://svn.freebsd.org/changeset/base/209107 +Introduced here: http://svnweb.freebsd.org/changeset/base/209107 Index: tools/clang/lib/Basic/Version.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r213492-amd64-multi-os-dot.diff b/contrib/llvm/patches/patch-r213492-amd64-multi-os-dot.diff index 36bf3177f6d..1ff9ce06a6c 100644 --- a/contrib/llvm/patches/patch-r213492-amd64-multi-os-dot.diff +++ b/contrib/llvm/patches/patch-r213492-amd64-multi-os-dot.diff @@ -1,7 +1,7 @@ This patch makes "clang -print-multi-os-directory" print "." on amd64, which is required by certain ports. -Introduced here: http://svn.freebsd.org/changeset/base/213492 +Introduced here: http://svnweb.freebsd.org/changeset/base/213492 Index: tools/clang/lib/Driver/Driver.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r221503-default-target-triple.diff b/contrib/llvm/patches/patch-r221503-default-target-triple.diff index d59cce9ff26..ee08af46d32 100644 --- a/contrib/llvm/patches/patch-r221503-default-target-triple.diff +++ b/contrib/llvm/patches/patch-r221503-default-target-triple.diff @@ -1,7 +1,7 @@ This patch ensures the target triple that is passed during the compiler build is respected, instead of mangling it. -Introduced here: http://svn.freebsd.org/changeset/base/221503 +Introduced here: http://svnweb.freebsd.org/changeset/base/221503 Index: lib/Support/Unix/Host.inc =================================================================== diff --git a/contrib/llvm/patches/patch-r243830-arm-disable-clear-cache.diff b/contrib/llvm/patches/patch-r243830-arm-disable-clear-cache.diff index b5a43425a88..d3341304105 100644 --- a/contrib/llvm/patches/patch-r243830-arm-disable-clear-cache.diff +++ b/contrib/llvm/patches/patch-r243830-arm-disable-clear-cache.diff @@ -2,7 +2,7 @@ This patch ensures __clear_cache is not called on arm. In earlier versions of clang, this special builtin was emitted as a function call, leading to link errors. -Introduced here: http://svn.freebsd.org/changeset/base/243830 +Introduced here: http://svnweb.freebsd.org/changeset/base/243830 Index: lib/Support/Unix/Memory.inc =================================================================== diff --git a/contrib/llvm/patches/patch-r252503-arm-transient-stack-alignment.diff b/contrib/llvm/patches/patch-r252503-arm-transient-stack-alignment.diff index a046858069a..d80378de988 100644 --- a/contrib/llvm/patches/patch-r252503-arm-transient-stack-alignment.diff +++ b/contrib/llvm/patches/patch-r252503-arm-transient-stack-alignment.diff @@ -1,7 +1,7 @@ This patch applies a workaround for an ARM EABI issue, where clang would sometimes incorrectly align the stack in a leaf function that uses TLS. -Introduced here: http://svn.freebsd.org/changeset/base/252503 +Introduced here: http://svnweb.freebsd.org/changeset/base/252503 Index: test/CodeGen/Thumb2/large-stack.ll =================================================================== diff --git a/contrib/llvm/patches/patch-r257109-add-CC-aliases.diff b/contrib/llvm/patches/patch-r257109-add-CC-aliases.diff index 686210bb71c..c5bc281cce3 100644 --- a/contrib/llvm/patches/patch-r257109-add-CC-aliases.diff +++ b/contrib/llvm/patches/patch-r257109-add-CC-aliases.diff @@ -1,7 +1,7 @@ This patch adds "CC" and "clang-CC" to the list of program name aliases which invoke the C++ compiler. -Introduced here: http://svn.freebsd.org/changeset/base/257109 +Introduced here: http://svnweb.freebsd.org/changeset/base/257109 Index: tools/clang/tools/driver/driver.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r259053-gcc-installation-detector.diff b/contrib/llvm/patches/patch-r259053-gcc-installation-detector.diff index 1d04e7e6840..48e0f284616 100644 --- a/contrib/llvm/patches/patch-r259053-gcc-installation-detector.diff +++ b/contrib/llvm/patches/patch-r259053-gcc-installation-detector.diff @@ -1,7 +1,7 @@ This patch eliminates the unnecessary search for various gcc installation directories during each startup of clang. -Introduced here: http://svn.freebsd.org/changeset/base/259053 +Introduced here: http://svnweb.freebsd.org/changeset/base/259053 Index: tools/clang/lib/Driver/ToolChains.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r259498-add-fxsave.diff b/contrib/llvm/patches/patch-r259498-add-fxsave.diff index 311be1e1f41..711f81cdf2e 100644 --- a/contrib/llvm/patches/patch-r259498-add-fxsave.diff +++ b/contrib/llvm/patches/patch-r259498-add-fxsave.diff @@ -1,6 +1,6 @@ This patch adds the alias bit_FXSAVE for bit_FXSR to cpuid.h. -Introduced here: http://svn.freebsd.org/changeset/base/259498 +Introduced here: http://svnweb.freebsd.org/changeset/base/259498 Index: tools/clang/lib/Headers/cpuid.h =================================================================== diff --git a/contrib/llvm/patches/patch-r261680-clang-r200899-fix-security-quantis.diff b/contrib/llvm/patches/patch-r261680-clang-r200899-fix-security-quantis.diff index be810510dcf..50478ba6b82 100644 --- a/contrib/llvm/patches/patch-r261680-clang-r200899-fix-security-quantis.diff +++ b/contrib/llvm/patches/patch-r261680-clang-r200899-fix-security-quantis.diff @@ -15,7 +15,7 @@ Pull in r200899 from upstream clang trunk (by Serge Pavlov): Differential Revision: http://llvm-reviews.chandlerc.com/D2688 -Introduced here: http://svn.freebsd.org/changeset/base/261680 +Introduced here: http://svnweb.freebsd.org/changeset/base/261680 Index: tools/clang/test/SemaCXX/c99-variable-length-array.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r261991-llvm-r195391-fix-dwarf2.diff b/contrib/llvm/patches/patch-r261991-llvm-r195391-fix-dwarf2.diff index 0a1af3e42ae..7864f147003 100644 --- a/contrib/llvm/patches/patch-r261991-llvm-r195391-fix-dwarf2.diff +++ b/contrib/llvm/patches/patch-r261991-llvm-r195391-fix-dwarf2.diff @@ -18,7 +18,7 @@ Pull in r195391 from upstream llvm trunk (by Eric Christopher): Patch (slightly modified) by Keith Walker! -Introduced here: http://svn.freebsd.org/changeset/base/261991 +Introduced here: http://svnweb.freebsd.org/changeset/base/261991 Index: lib/CodeGen/AsmPrinter/DIE.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r261991-llvm-r198385-fix-dwarf2.diff b/contrib/llvm/patches/patch-r261991-llvm-r198385-fix-dwarf2.diff index 375f6625296..e67301384cd 100644 --- a/contrib/llvm/patches/patch-r261991-llvm-r198385-fix-dwarf2.diff +++ b/contrib/llvm/patches/patch-r261991-llvm-r198385-fix-dwarf2.diff @@ -5,7 +5,7 @@ Pull in r198385 from upstream llvm trunk (by David Blaikie): Apologies for the noise - we're seeing some Go failures with cgo interacting with Clang's debug info due to this change. -Introduced here: http://svn.freebsd.org/changeset/base/261991 +Introduced here: http://svnweb.freebsd.org/changeset/base/261991 Index: lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r261991-llvm-r198389-fix-dwarf2.diff b/contrib/llvm/patches/patch-r261991-llvm-r198389-fix-dwarf2.diff index a4a00a9e8c6..3b0d21fdf9a 100644 --- a/contrib/llvm/patches/patch-r261991-llvm-r198389-fix-dwarf2.diff +++ b/contrib/llvm/patches/patch-r261991-llvm-r198389-fix-dwarf2.diff @@ -8,7 +8,7 @@ Pull in r198389 from upstream llvm trunk (by David Blaikie): This reverts commit r198385. -Introduced here: http://svn.freebsd.org/changeset/base/261991 +Introduced here: http://svnweb.freebsd.org/changeset/base/261991 Index: lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198028-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198028-sparc.diff index b4fb92915b3..971141c5c7e 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198028-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198028-sparc.diff @@ -2,7 +2,7 @@ Pull in r198028 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Add MCInstPrinter implementation for SPARC. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/InstPrinter/LLVMBuild.txt =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198029-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198029-sparc.diff index 6656bce1953..69c41fd86b7 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198029-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198029-sparc.diff @@ -2,7 +2,7 @@ Pull in r198029 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Add target specific MCExpr class to handle sparc specific modifiers like %hi, %lo, etc., -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198030-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198030-sparc.diff index 7ab42913f06..81fa67d6326 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198030-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198030-sparc.diff @@ -2,7 +2,7 @@ Pull in r198030 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Lower and MachineInstr to MC and print assembly using MCInstPrinter. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/MCTargetDesc/SparcTargetStreamer.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198145-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198145-sparc.diff index 2429e5248d7..1ff7ada039b 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198145-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198145-sparc.diff @@ -3,7 +3,7 @@ Pull in r198145 from upstream llvm trunk (by Venkatraman Govindaraju): [SparcV9]: Implement lowering of long double (fp128) arguments in Sparc64 ABI. Also, pass fp128 arguments to varargs through integer registers if necessary. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: test/CodeGen/SPARC/64abi.ll =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198149-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198149-sparc.diff index 912daf38eb8..ca50b6c5452 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198149-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198149-sparc.diff @@ -3,7 +3,7 @@ Pull in r198149 from upstream llvm trunk (by Venkatraman Govindaraju): [SparcV9] For codegen generated library calls that return float, set inreg flag manually in LowerCall(). This makes the sparc backend to generate Sparc64 ABI compliant code. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/SparcISelLowering.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198157-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198157-sparc.diff index 42ef3db601e..e9e69681fdc 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198157-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198157-sparc.diff @@ -3,7 +3,7 @@ Pull in r198157 from upstream llvm trunk (by Venkatraman Govindaraju): [SparcV9] Use separate instruction patterns for 64 bit arithmetic instructions instead of reusing 32 bit instruction patterns. This is done to avoid spilling the result of the 64-bit instructions to a 4-byte slot. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/SparcAsmPrinter.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198280-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198280-sparc.diff index f75d9fc6f9a..8f0f4446f2a 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198280-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198280-sparc.diff @@ -2,7 +2,7 @@ Pull in r198280 from upstream llvm trunk (by Venkatraman Govindaraju): [SparcV9]: Use SRL instead of SLL to clear top 32-bits in ctpop:i32. SLL does not clear top 32 bit, only SRL does. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/SparcInstrInfo.td =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198281-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198281-sparc.diff index 0af21f41330..02fa3c5f12f 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198281-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198281-sparc.diff @@ -2,7 +2,7 @@ Pull in r198281 from upstream llvm trunk (by Venkatraman Govindaraju): [SparcV9]: Custom lower UMULO/SMULO so that the arguments are send to __multi3() in correct order. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/SparcISelLowering.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198286-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198286-sparc.diff index 041e263e23a..58004ff1d60 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198286-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198286-sparc.diff @@ -2,7 +2,7 @@ Pull in r198286 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Handle atomic loads/stores in sparc backend. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/SparcInstrInfo.td =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198480-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198480-sparc.diff index b3e13627c23..d610ea9586b 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198480-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198480-sparc.diff @@ -2,7 +2,7 @@ Pull in r198480 from upstream llvm trunk (by Venkatraman Govindaraju): [SparcV9]: Implement RETURNADDR and FRAMEADDR lowering in SPARC64. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/SparcISelLowering.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198484-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198484-sparc.diff index 3bfb7d5d964..b3f2f3bed1c 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198484-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198484-sparc.diff @@ -2,7 +2,7 @@ Pull in r198484 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Add the initial implementation of an asm parser for sparc/sparcv9. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198533-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198533-sparc.diff index d6e65dad069..8a6eb31ee48 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198533-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198533-sparc.diff @@ -2,7 +2,7 @@ Pull in r198533 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Add initial implementation of MC Code emitter for sparc. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/SparcInstrInfo.td =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198565-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198565-sparc.diff index cf32440f5a5..694d00a4a14 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198565-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198565-sparc.diff @@ -2,7 +2,7 @@ Pull in r198565 from upstream llvm trunk (by Venkatraman Govindaraju): ELF relocation types for sparc. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: include/llvm/Support/ELF.h =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198567-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198567-sparc.diff index 0ce6863d804..867750d5285 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198567-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198567-sparc.diff @@ -2,7 +2,7 @@ Pull in r198567 from upstream llvm trunk (by Benjamin Kramer): SPARC: Make helper function static. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/SparcAsmPrinter.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198580-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198580-sparc.diff index e30cbb29018..9535a6c610d 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198580-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198580-sparc.diff @@ -2,7 +2,7 @@ Pull in r198580 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Add ELF Object Writer for Sparc. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/MCTargetDesc/SparcMCCodeEmitter.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198591-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198591-sparc.diff index 056cb34c53a..08897ed64b5 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198591-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198591-sparc.diff @@ -2,7 +2,7 @@ Pull in r198591 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Add initial implementation of disassembler for sparc -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/SparcInstrFormats.td =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198592-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198592-sparc.diff index 722290ed5f5..e0365bb5224 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198592-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198592-sparc.diff @@ -2,7 +2,7 @@ Pull in r198592 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Explicitly cast -1 to unsigned to fix buildbot errors. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/Disassembler/SparcDisassembler.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198658-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198658-sparc.diff index b7eb2a283a0..c9a667b5ad3 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198658-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198658-sparc.diff @@ -2,7 +2,7 @@ Pull in r198658 from upstream llvm trunk: [Sparc] Add support for parsing memory operands in sparc AsmParser. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: test/MC/Sparc/sparc-ctrl-instructions.s =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198681-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198681-sparc.diff index 4bd12d264ae..0b53ca96c6e 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198681-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198681-sparc.diff @@ -3,7 +3,7 @@ Pull in r198681 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Add support for parsing sparc asm modifiers such as %hi, %lo etc., Also, correct the offsets for FixupsKindInfo. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198738-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198738-sparc.diff index 87637a7fc18..32a3c54ca88 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198738-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198738-sparc.diff @@ -2,7 +2,7 @@ Pull in r198738 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Add support for parsing branch instructions and conditional moves. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: test/MC/Disassembler/Sparc/sparc.txt =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198739-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198739-sparc.diff index f7b884c5540..87b3f4125f7 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198739-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198739-sparc.diff @@ -2,7 +2,7 @@ Pull in r198739 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Correct the mask for fixup_sparc_br19. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198740-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198740-sparc.diff index ff9bfd5948b..1aa2f9ea72c 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198740-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198740-sparc.diff @@ -2,7 +2,7 @@ Pull in r198740 from upstream llvm trunk (by Venkatraman Govindaraju): [SparcV9] Rename operands in some sparc64 instructions so that TableGen can encode them correctly. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: test/MC/Sparc/sparc64-alu-instructions.s =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198893-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198893-sparc.diff index a1434c0a05c..b5e12e2249d 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198893-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198893-sparc.diff @@ -2,7 +2,7 @@ Pull in r198893 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Multiclass for loads/stores. No functionality change intended. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/SparcInstr64Bit.td =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198909-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198909-sparc.diff index e4fb0f350f1..e98f7073a89 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198909-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198909-sparc.diff @@ -2,7 +2,7 @@ Pull in r198909 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Add support for parsing jmpl instruction and make indirect call and jmp instructions as aliases to jmpl. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/AsmParser/SparcAsmParser.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198910-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198910-sparc.diff index 94b320c202b..028cbc6be12 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r198910-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r198910-sparc.diff @@ -2,7 +2,7 @@ Pull in r198910 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Emit retl/ret instead of jmp instruction. It improves the readability of the assembly generated. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: test/CodeGen/SPARC/ctpop.ll =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r199014-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r199014-sparc.diff index 6db27a065c9..d0fe057bb01 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r199014-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r199014-sparc.diff @@ -2,7 +2,7 @@ Pull in r199014 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Bundle instruction with delay slow and its filler. Now, we can use -verify-machineinstrs with SPARC backend. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/DelaySlotFiller.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r199024-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r199024-sparc.diff index 35bfc2bc40d..82cf12352f3 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r199024-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r199024-sparc.diff @@ -2,7 +2,7 @@ Pull in r199024 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Add missing processor types: v7 and niagara -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/Sparc.td =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r199028-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r199028-sparc.diff index 78bcc61d147..ef99531e3fa 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r199028-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r199028-sparc.diff @@ -13,7 +13,7 @@ Pull in r199028 from upstream llvm trunk (by Jakob Stoklund Olesen): 'inreg' flag on the return value, so that behavior is unchanged. This also happens when returning a float _Complex. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: test/CodeGen/SPARC/64abi.ll =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r199031-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r199031-sparc.diff index 5eb954959f4..783ca74f86f 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r199031-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r199031-sparc.diff @@ -2,7 +2,7 @@ Pull in r199031 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Replace (unsigned)-1 with ~OU as suggested by Reid Kleckner. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/Disassembler/SparcDisassembler.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r199033-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r199033-sparc.diff index c4b343804a2..f34a3e41aaa 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r199033-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r199033-sparc.diff @@ -2,7 +2,7 @@ Pull in r199033 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Add support for parsing floating point instructions. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/SparcInstrInfo.td =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r199061-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r199061-sparc.diff index 4a8e5b86a3e..c10b8a2ce81 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r199061-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r199061-sparc.diff @@ -8,7 +8,7 @@ Pull in r199061 from upstream llvm trunk (by Jakob Stoklund Olesen): Teach isBlockOnlyReachableByFallthrough to find any MBB operands on bundled terminators so SPARC doesn't need to specialize this function. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: test/CodeGen/SPARC/missinglabel.ll =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r199186-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r199186-sparc.diff index 167aa6ab2df..7293981c893 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r199186-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r199186-sparc.diff @@ -11,7 +11,7 @@ Pull in r199186 from upstream llvm trunk (by Jakob Stoklund Olesen): The allocation order for DPair begins with the QPR registers, so register allocation is unlikely to change much. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/ARM/ARMISelLowering.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r199187-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r199187-sparc.diff index bfc1cfc6d58..0520ecdfc71 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r199187-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r199187-sparc.diff @@ -19,7 +19,7 @@ Pull in r199187 from upstream llvm trunk (by Jakob Stoklund Olesen): This fixes a problem where InstrEmitter was picking 32-bit register classes for 64-bit values on SPARC. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: test/CodeGen/SPARC/spillsize.ll =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r199775-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r199775-sparc.diff index 489f4570d52..b90f24392db 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r199775-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r199775-sparc.diff @@ -3,7 +3,7 @@ Pull in r199775 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Do not add PC to _GLOBAL_OFFSET_TABLE_ address to access GOT in absolute code. Fixes PR#18521 -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/SparcAsmPrinter.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r199781-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r199781-sparc.diff index 04174109328..a94fda73345 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r199781-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r199781-sparc.diff @@ -2,7 +2,7 @@ Pull in r199781 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Add support for inline assembly constraint 'I'. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: test/CodeGen/SPARC/inlineasm.ll =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r199786-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r199786-sparc.diff index 844e4e4520f..004f85df4b9 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r199786-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r199786-sparc.diff @@ -2,7 +2,7 @@ Pull in r199786 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Add support for inline assembly constraints which specify registers by their aliases. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/SparcISelLowering.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r199940-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r199940-sparc.diff index e171799df0a..3b0940fe2fc 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r199940-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r199940-sparc.diff @@ -4,7 +4,7 @@ Pull in r199940 from upstream llvm trunk (by Eric Christopher): code this looks correct, but could use review. The previous was definitely not correct. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/AsmParser/SparcAsmParser.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r199974-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r199974-sparc.diff index 095199534a0..ca388fbff28 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r199974-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r199974-sparc.diff @@ -3,7 +3,7 @@ Pull in r199974 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Correct quad register list in the asm parser. Add test cases to check parsing of v9 double registers and their aliased quad registers. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: test/MC/Disassembler/Sparc/sparc-fp.txt =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r199975-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r199975-sparc.diff index b1dec41c684..57454081ddc 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r199975-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r199975-sparc.diff @@ -4,7 +4,7 @@ Pull in r199975 from upstream llvm trunk (by Jakob Stoklund Olesen): These all use the compare-and-swap CASA/CASXA instructions. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: test/CodeGen/SPARC/atomics.ll =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r199977-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r199977-sparc.diff index 166b5da6d57..bace09ea3a7 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r199977-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r199977-sparc.diff @@ -3,7 +3,7 @@ Pull in r199977 from upstream llvm trunk (by Venkatraman Govindaraju): [SparcV9] Add support for JIT in Sparc64. With this change, all supported tests in test/ExecutionEngine pass in sparcv9. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/SparcJITInfo.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r200103-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r200103-sparc.diff index a2fd7d207c5..2861161593d 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r200103-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r200103-sparc.diff @@ -2,7 +2,7 @@ Pull in r200103 from upstream llvm trunk (by Venkatraman Govindaraju): Missing ELF relocations for Sparc. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: include/llvm/Support/ELF.h =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r200104-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r200104-sparc.diff index c489ca10d40..b051d74779e 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r200104-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r200104-sparc.diff @@ -2,7 +2,7 @@ Pull in r200104 from upstream llvm trunk (by Venkatraman Govindaraju): removing duplicate enum value -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: include/llvm/Support/ELF.h =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r200112-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r200112-sparc.diff index f499b590f89..584dd30d198 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r200112-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r200112-sparc.diff @@ -2,7 +2,7 @@ Pull in r200112 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Add support for sparc relocation types in ELF object file. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: test/MC/Sparc/sparc-relocations.s =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r200130-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r200130-sparc.diff index aad6ae905cc..77e7b9012e8 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r200130-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r200130-sparc.diff @@ -4,7 +4,7 @@ Pull in r200130 from upstream llvm trunk (by Jakob Stoklund Olesen): Found by SingleSource/UnitTests/AtomicOps.c -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/SparcISelLowering.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r200131-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r200131-sparc.diff index 6b0ab16026f..c0ea20aa2b6 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r200131-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r200131-sparc.diff @@ -5,7 +5,7 @@ Pull in r200131 from upstream llvm trunk (by Jakob Stoklund Olesen): The popc instruction is defined in the SPARCv9 instruction set architecture, but it was emulated on CPUs older than Niagara 2. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/SparcISelLowering.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r200141-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r200141-sparc.diff index d8016e8a4ca..c507cafc60e 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r200141-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r200141-sparc.diff @@ -2,7 +2,7 @@ Pull in r200141 from upstream llvm trunk (by Jakob Stoklund Olesen): Clean up the Legal/Expand logic for SPARC popc. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/SparcSubtarget.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r200282-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r200282-sparc.diff index 95f28684463..b4e4cef24e4 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r200282-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r200282-sparc.diff @@ -5,7 +5,7 @@ Pull in r200282 from upstream llvm trunk (by Jakob Stoklund Olesen): Also emit the stubs that were generated for references to typeinfo symbols. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/SparcAsmPrinter.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r200368-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r200368-sparc.diff index f596b5f516d..04579767cdd 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r200368-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r200368-sparc.diff @@ -2,7 +2,7 @@ Pull r200368 from upstream llvm trunk (by Venkatraman Govindaraju): [SparcV9] Use correct register class (I64RegClass) to hold the address of _GLOBAL_OFFSET_TABLE_ in sparcv9. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/SparcInstrInfo.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r200373-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r200373-sparc.diff index f9bed357212..1eb13785f27 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r200373-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r200373-sparc.diff @@ -6,7 +6,7 @@ Pull in r200373 from upstream llvm trunk (by Venkatraman Govindaraju): combines symbols in different segments". This is because MC computes pc_rel entries with subtract expression between labels from different sections. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/SparcTargetObjectFile.h =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r200376-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r200376-sparc.diff index 0053365f6ab..c24ea253d65 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r200376-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r200376-sparc.diff @@ -4,7 +4,7 @@ Pull in r200376 from upstream llvm trunk (by Venkatraman Govindaraju): This makes MCAsmInfo::getExprForFDESymbol() a virtual function and overrides it in SparcMCAsmInfo. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.h =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r200509-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r200509-sparc.diff index 9ada6aa9345..f5f9bb3d116 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r200509-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r200509-sparc.diff @@ -2,7 +2,7 @@ Pull in r200509 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Save and restore float registers that may be used for parameter passing. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/SparcJITInfo.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r200617-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r200617-sparc.diff index 831cd98eccd..a92ba322abe 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r200617-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r200617-sparc.diff @@ -2,7 +2,7 @@ Pull in r200617 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Set %o7 as the return address register instead of %i7 in MCRegisterInfo. Also, add CFI instructions to initialize the frame correctly. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r200960-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r200960-sparc.diff index c430f882a2f..a57449b6ae8 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r200960-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r200960-sparc.diff @@ -2,7 +2,7 @@ Pull in r200960 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Use SparcMCExpr::VariantKind itself as MachineOperand's target flags. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/SparcISelLowering.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r200961-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r200961-sparc.diff index a08d173ed75..558715cebb9 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r200961-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r200961-sparc.diff @@ -2,7 +2,7 @@ Pull in r200961 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Emit correct relocations for PIC code when integrated assembler is used. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: test/CodeGen/SPARC/obj-relocs.ll =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r200962-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r200962-sparc.diff index 2e668a31abc..ca329c22555 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r200962-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r200962-sparc.diff @@ -2,7 +2,7 @@ Pull in r200962 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Emit relocations for Thread Local Storage (TLS) when integrated assembler is used. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r200963-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r200963-sparc.diff index f8a817ea0f1..55693c70005 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r200963-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r200963-sparc.diff @@ -2,7 +2,7 @@ Pull in r200963 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Emit correct encoding for atomic instructions. Also, add support for parsing CAS instructions to test the CAS encoding. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: test/MC/Sparc/sparc-atomic-instructions.s =================================================================== diff --git a/contrib/llvm/patches/patch-r262261-llvm-r200965-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r200965-sparc.diff index 2b0d41e5fea..aa758001e57 100644 --- a/contrib/llvm/patches/patch-r262261-llvm-r200965-sparc.diff +++ b/contrib/llvm/patches/patch-r262261-llvm-r200965-sparc.diff @@ -2,7 +2,7 @@ Pull in r200965 from upstream llvm trunk (by Venkatraman Govindaraju): [Sparc] Add support for parsing synthetic instruction 'mov'. -Introduced here: http://svn.freebsd.org/changeset/base/262261 +Introduced here: http://svnweb.freebsd.org/changeset/base/262261 Index: lib/Target/Sparc/SparcInstrAliases.td =================================================================== diff --git a/contrib/llvm/patches/patch-r262262-clang-r198311-sparc.diff b/contrib/llvm/patches/patch-r262262-clang-r198311-sparc.diff index 751b976bc56..126d362a743 100644 --- a/contrib/llvm/patches/patch-r262262-clang-r198311-sparc.diff +++ b/contrib/llvm/patches/patch-r262262-clang-r198311-sparc.diff @@ -3,7 +3,7 @@ Pull in r198311 from upstream clang trunk (by Roman Divacky): In the FreeBSD assembler driver, inform the sparc assembler that we're producing PIC code. -Introduced here: http://svn.freebsd.org/changeset/base/262262 +Introduced here: http://svnweb.freebsd.org/changeset/base/262262 Index: tools/clang/lib/Driver/Tools.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262262-clang-r198312-sparc.diff b/contrib/llvm/patches/patch-r262262-clang-r198312-sparc.diff index 8903d38eea6..7edefe23aaf 100644 --- a/contrib/llvm/patches/patch-r262262-clang-r198312-sparc.diff +++ b/contrib/llvm/patches/patch-r262262-clang-r198312-sparc.diff @@ -2,7 +2,7 @@ Pull in r198312 from upstream clang trunk (by Roman Divacky): Remove a tab that snuck in. -Introduced here: http://svn.freebsd.org/changeset/base/262262 +Introduced here: http://svnweb.freebsd.org/changeset/base/262262 Index: tools/clang/lib/Driver/Tools.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262262-clang-r198911-sparc.diff b/contrib/llvm/patches/patch-r262262-clang-r198911-sparc.diff index d50b53f60db..f6040415ad3 100644 --- a/contrib/llvm/patches/patch-r262262-clang-r198911-sparc.diff +++ b/contrib/llvm/patches/patch-r262262-clang-r198911-sparc.diff @@ -2,7 +2,7 @@ Pull in r198911 from upstream clang trunk (by Jakob Stoklund Olesen): Pass -32/-64 to the assembler when building for sparc/sparc64. -Introduced here: http://svn.freebsd.org/changeset/base/262262 +Introduced here: http://svnweb.freebsd.org/changeset/base/262262 Index: tools/clang/test/Driver/linux-as.c =================================================================== diff --git a/contrib/llvm/patches/patch-r262262-clang-r198912-sparc.diff b/contrib/llvm/patches/patch-r262262-clang-r198912-sparc.diff index 9e3ce439a8a..94428fb53bf 100644 --- a/contrib/llvm/patches/patch-r262262-clang-r198912-sparc.diff +++ b/contrib/llvm/patches/patch-r262262-clang-r198912-sparc.diff @@ -2,7 +2,7 @@ Pull in r198912 from upstream clang trunk (by Jakob Stoklund Olesen): Give the linker the right ELF type for SPARC targets. -Introduced here: http://svn.freebsd.org/changeset/base/262262 +Introduced here: http://svnweb.freebsd.org/changeset/base/262262 Index: tools/clang/lib/Driver/Tools.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262262-clang-r198918-sparc.diff b/contrib/llvm/patches/patch-r262262-clang-r198918-sparc.diff index a3c60261ae0..98add49b52f 100644 --- a/contrib/llvm/patches/patch-r262262-clang-r198918-sparc.diff +++ b/contrib/llvm/patches/patch-r262262-clang-r198918-sparc.diff @@ -2,7 +2,7 @@ Pull in r198918 from upstream clang trunk (by Jakob Stoklund Olesen): Locate GCC installations on SPARC systems. -Introduced here: http://svn.freebsd.org/changeset/base/262262 +Introduced here: http://svnweb.freebsd.org/changeset/base/262262 Index: tools/clang/lib/Driver/ToolChains.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262262-clang-r198923-sparc.diff b/contrib/llvm/patches/patch-r262262-clang-r198923-sparc.diff index 912aa62545a..83d658d3c54 100644 --- a/contrib/llvm/patches/patch-r262262-clang-r198923-sparc.diff +++ b/contrib/llvm/patches/patch-r262262-clang-r198923-sparc.diff @@ -2,7 +2,7 @@ Pull in r198923 from upstream clang trunk (by Jakob Stoklund Olesen): Use the right dynamic linker for SPARC Linux executables. -Introduced here: http://svn.freebsd.org/changeset/base/262262 +Introduced here: http://svnweb.freebsd.org/changeset/base/262262 Index: tools/clang/lib/Driver/Tools.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262262-clang-r199012-sparc.diff b/contrib/llvm/patches/patch-r262262-clang-r199012-sparc.diff index 7bc4a78b361..7d02c1f217c 100644 --- a/contrib/llvm/patches/patch-r262262-clang-r199012-sparc.diff +++ b/contrib/llvm/patches/patch-r262262-clang-r199012-sparc.diff @@ -2,7 +2,7 @@ Pull in r199012 from upstream clang trunk (by Jakob Stoklund Olesen): Select the UltraSPARC instruction set when invoking the assembler. -Introduced here: http://svn.freebsd.org/changeset/base/262262 +Introduced here: http://svnweb.freebsd.org/changeset/base/262262 Index: tools/clang/lib/Driver/Tools.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262262-clang-r199034-sparc.diff b/contrib/llvm/patches/patch-r262262-clang-r199034-sparc.diff index 8043e1f2818..6eb98df99cc 100644 --- a/contrib/llvm/patches/patch-r262262-clang-r199034-sparc.diff +++ b/contrib/llvm/patches/patch-r262262-clang-r199034-sparc.diff @@ -2,7 +2,7 @@ Pull in r199034 from upstream clang trunk (by Jakob Stoklund Olesen): MIPS and SPARC assemblers both take the -KPIC flag. -Introduced here: http://svn.freebsd.org/changeset/base/262262 +Introduced here: http://svnweb.freebsd.org/changeset/base/262262 Index: tools/clang/lib/Driver/Tools.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262262-clang-r199037-sparc.diff b/contrib/llvm/patches/patch-r262262-clang-r199037-sparc.diff index beed0ed9162..39e9765c528 100644 --- a/contrib/llvm/patches/patch-r262262-clang-r199037-sparc.diff +++ b/contrib/llvm/patches/patch-r262262-clang-r199037-sparc.diff @@ -2,7 +2,7 @@ Pull in r199037 from upstream clang trunk (by Jakob Stokund Olesen): SPARC passes non-trivial C++ objects indirectly like everybody else. -Introduced here: http://svn.freebsd.org/changeset/base/262262 +Introduced here: http://svnweb.freebsd.org/changeset/base/262262 Index: tools/clang/lib/CodeGen/TargetInfo.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262262-clang-r199188-sparc.diff b/contrib/llvm/patches/patch-r262262-clang-r199188-sparc.diff index 77e5eafc277..8f82bf3e6d8 100644 --- a/contrib/llvm/patches/patch-r262262-clang-r199188-sparc.diff +++ b/contrib/llvm/patches/patch-r262262-clang-r199188-sparc.diff @@ -5,7 +5,7 @@ Pull in r199188 from upstream clang trunk (by Jakob Stoklund Olesen): Pad these structs up so they are sret-returned even on that architecture. -Introduced here: http://svn.freebsd.org/changeset/base/262262 +Introduced here: http://svnweb.freebsd.org/changeset/base/262262 Index: tools/clang/test/CodeGen/sret.c =================================================================== diff --git a/contrib/llvm/patches/patch-r262262-clang-r199399-sparc.diff b/contrib/llvm/patches/patch-r262262-clang-r199399-sparc.diff index 106ab89236f..4a22be23285 100644 --- a/contrib/llvm/patches/patch-r262262-clang-r199399-sparc.diff +++ b/contrib/llvm/patches/patch-r262262-clang-r199399-sparc.diff @@ -2,7 +2,7 @@ Pull in r199399 from upstream clang trunk (by Jakob Stoklund Olesen): SPARCv9 implements long double as an IEEE quad. -Introduced here: http://svn.freebsd.org/changeset/base/262262 +Introduced here: http://svnweb.freebsd.org/changeset/base/262262 Index: tools/clang/test/CodeGen/sparcv9-abi.c =================================================================== diff --git a/contrib/llvm/patches/patch-r262262-clang-r200452-sparc.diff b/contrib/llvm/patches/patch-r262262-clang-r200452-sparc.diff index e14306d86f1..44f442f9a81 100644 --- a/contrib/llvm/patches/patch-r262262-clang-r200452-sparc.diff +++ b/contrib/llvm/patches/patch-r262262-clang-r200452-sparc.diff @@ -4,7 +4,7 @@ Pull in r200452 from upstream clang trunk (by Jakob Stoklund Olesen): Patch by Roman Divacky! -Introduced here: http://svn.freebsd.org/changeset/base/262262 +Introduced here: http://svnweb.freebsd.org/changeset/base/262262 Index: tools/clang/lib/Basic/Targets.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262264-llvm-r200453-sparc.diff b/contrib/llvm/patches/patch-r262264-llvm-r200453-sparc.diff index 2c4470ccf34..ed8e4b9c544 100644 --- a/contrib/llvm/patches/patch-r262264-llvm-r200453-sparc.diff +++ b/contrib/llvm/patches/patch-r262264-llvm-r200453-sparc.diff @@ -6,7 +6,7 @@ Pull in r200453 from upstream llvm trunk (by Jakob Stoklund Olesen): atomic swap can be implemented in terms of CASX, like the other atomic rmw primitives. -Introduced here: http://svn.freebsd.org/changeset/base/262264 +Introduced here: http://svnweb.freebsd.org/changeset/base/262264 Index: lib/Target/Sparc/SparcInstr64Bit.td =================================================================== diff --git a/contrib/llvm/patches/patch-r262265-llvm-r201718-sparc.diff b/contrib/llvm/patches/patch-r262265-llvm-r201718-sparc.diff index d9ca427a4f4..a7be299dda2 100644 --- a/contrib/llvm/patches/patch-r262265-llvm-r201718-sparc.diff +++ b/contrib/llvm/patches/patch-r262265-llvm-r201718-sparc.diff @@ -2,7 +2,7 @@ Pull in r201718 from upstream llvm trunk (by Roman Divacky): Expand 64bit {SHL,SHR,SRA}_PARTS on sparcv9. -Introduced here: http://svn.freebsd.org/changeset/base/262265 +Introduced here: http://svnweb.freebsd.org/changeset/base/262265 Index: test/CodeGen/SPARC/parts.ll =================================================================== diff --git a/contrib/llvm/patches/patch-r262303-enable-ppc-integrated-as.diff b/contrib/llvm/patches/patch-r262303-enable-ppc-integrated-as.diff index 3d2e107b974..bb020d578df 100644 --- a/contrib/llvm/patches/patch-r262303-enable-ppc-integrated-as.diff +++ b/contrib/llvm/patches/patch-r262303-enable-ppc-integrated-as.diff @@ -2,7 +2,7 @@ Pull in r197521 from upstream clang trunk (by Roman Divacky): Use the integrated assembler by default on FreeBSD/ppc and ppc64. -Introduced here: http://svn.freebsd.org/changeset/base/262303 +Introduced here: http://svnweb.freebsd.org/changeset/base/262303 Index: tools/clang/lib/Driver/ToolChains.h =================================================================== diff --git a/contrib/llvm/patches/patch-r262415-llvm-r201994-sparc.diff b/contrib/llvm/patches/patch-r262415-llvm-r201994-sparc.diff index 4f9b9166c39..308b2759f7a 100644 --- a/contrib/llvm/patches/patch-r262415-llvm-r201994-sparc.diff +++ b/contrib/llvm/patches/patch-r262415-llvm-r201994-sparc.diff @@ -2,7 +2,7 @@ Pull in r201994 from upstream llvm trunk (by Benjamin Kramer): SPARC: Implement TRAP lowering. Matches what GCC emits. -Introduced here: http://svn.freebsd.org/changeset/base/262415 +Introduced here: http://svnweb.freebsd.org/changeset/base/262415 Index: lib/Target/Sparc/SparcInstrInfo.td =================================================================== diff --git a/contrib/llvm/patches/patch-r262460-llvm-r202059-sparc.diff b/contrib/llvm/patches/patch-r262460-llvm-r202059-sparc.diff index e683e33ea32..e4ddf93e776 100644 --- a/contrib/llvm/patches/patch-r262460-llvm-r202059-sparc.diff +++ b/contrib/llvm/patches/patch-r262460-llvm-r202059-sparc.diff @@ -2,7 +2,7 @@ Pull in r202059 from upstream clang trunk (by Roman Divacky): Implement getDwarfEHStackPointer() and initDwarfEHRegSizeTable() for sparcv9. -Introduced here: http://svn.freebsd.org/changeset/base/262460 +Introduced here: http://svnweb.freebsd.org/changeset/base/262460 Index: tools/clang/lib/CodeGen/TargetInfo.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262535-clang-r202177-sparc.diff b/contrib/llvm/patches/patch-r262535-clang-r202177-sparc.diff index 00514eb1062..2ca2d00117c 100644 --- a/contrib/llvm/patches/patch-r262535-clang-r202177-sparc.diff +++ b/contrib/llvm/patches/patch-r262535-clang-r202177-sparc.diff @@ -4,7 +4,7 @@ Pull in r202177 from upstream clang trunk (by Roman Divacky): -march which doesnt exist on sparc gcc to -mcpu. While here adjust a few tests to not write an unused temporary file. -Introduced here: http://svn.freebsd.org/changeset/base/262535 +Introduced here: http://svnweb.freebsd.org/changeset/base/262535 Index: tools/clang/lib/Basic/Targets.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262536-clang-r202179-sparc.diff b/contrib/llvm/patches/patch-r262536-clang-r202179-sparc.diff index 5912dac935c..4f7adec09a3 100644 --- a/contrib/llvm/patches/patch-r262536-clang-r202179-sparc.diff +++ b/contrib/llvm/patches/patch-r262536-clang-r202179-sparc.diff @@ -2,7 +2,7 @@ Pull in r202179 from upstream clang trunk (by Roman Divacky): Pass the sparc architecture variant to the assembler. -Introduced here: http://svn.freebsd.org/changeset/base/262536 +Introduced here: http://svnweb.freebsd.org/changeset/base/262536 Index: tools/clang/lib/Driver/Tools.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262582-llvm-r202422-sparc.diff b/contrib/llvm/patches/patch-r262582-llvm-r202422-sparc.diff index 589dd4772c9..582fb05f20f 100644 --- a/contrib/llvm/patches/patch-r262582-llvm-r202422-sparc.diff +++ b/contrib/llvm/patches/patch-r262582-llvm-r202422-sparc.diff @@ -4,7 +4,7 @@ Pull in r202422 from upstream llvm trunk (by Roman Divacky): expensive libcall. Also, Qp_neg is not implemented on at least FreeBSD. This is also what gcc is doing. -Introduced here: http://svn.freebsd.org/changeset/base/262582 +Introduced here: http://svnweb.freebsd.org/changeset/base/262582 Index: lib/Target/Sparc/SparcISelLowering.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r262611-llvm-r196874-fix-invalid-pwd-crash.diff b/contrib/llvm/patches/patch-r262611-llvm-r196874-fix-invalid-pwd-crash.diff index 587693dd473..a83e8e5d46e 100644 --- a/contrib/llvm/patches/patch-r262611-llvm-r196874-fix-invalid-pwd-crash.diff +++ b/contrib/llvm/patches/patch-r262611-llvm-r196874-fix-invalid-pwd-crash.diff @@ -18,7 +18,7 @@ Pull in r196874 from upstream llvm trunk (by Andrew Trick): purely hypothetically and untestable case that this happens, the AT_comp_dir will be omitted from the compilation_unit DIE. -Introduced here: http://svn.freebsd.org/changeset/base/262611 +Introduced here: http://svnweb.freebsd.org/changeset/base/262611 Index: include/llvm/MC/MCContext.h =================================================================== diff --git a/contrib/llvm/patches/patch-r262809-clang-r203007-destructor-calling-conv.diff b/contrib/llvm/patches/patch-r262809-clang-r203007-destructor-calling-conv.diff deleted file mode 100644 index 5341b8bed84..00000000000 --- a/contrib/llvm/patches/patch-r262809-clang-r203007-destructor-calling-conv.diff +++ /dev/null @@ -1,61 +0,0 @@ -Pull in r203007 from upstream clang trunk (by Rafael Espindola): - - Don't produce an alias between destructors with different calling conventions. - - Fixes pr19007. - -Introduced here: http://svn.freebsd.org/changeset/base/262809 - -Index: tools/clang/lib/CodeGen/CGCXX.cpp -=================================================================== ---- tools/clang/lib/CodeGen/CGCXX.cpp -+++ tools/clang/lib/CodeGen/CGCXX.cpp -@@ -92,7 +92,13 @@ bool CodeGenModule::TryEmitBaseDestructorAsAlias(c - if (!ClassLayout.getBaseClassOffset(UniqueBase).isZero()) - return true; - -+ // Give up if the calling conventions don't match. We could update the call, -+ // but it is probably not worth it. - const CXXDestructorDecl *BaseD = UniqueBase->getDestructor(); -+ if (BaseD->getType()->getAs()->getCallConv() != -+ D->getType()->getAs()->getCallConv()) -+ return true; -+ - return TryEmitDefinitionAsAlias(GlobalDecl(D, Dtor_Base), - GlobalDecl(BaseD, Dtor_Base), - false); -Index: tools/clang/test/CodeGenCXX/ctor-dtor-alias.cpp -=================================================================== ---- tools/clang/test/CodeGenCXX/ctor-dtor-alias.cpp -+++ tools/clang/test/CodeGenCXX/ctor-dtor-alias.cpp -@@ -1,5 +1,5 @@ --// RUN: %clang_cc1 %s -triple x86_64-linux -emit-llvm -o - -mconstructor-aliases -O1 -disable-llvm-optzns | FileCheck %s --// RUN: %clang_cc1 %s -triple x86_64-linux -emit-llvm -o - -mconstructor-aliases | FileCheck --check-prefix=NOOPT %s -+// RUN: %clang_cc1 %s -triple i686-linux -emit-llvm -o - -mconstructor-aliases -O1 -disable-llvm-optzns | FileCheck %s -+// RUN: %clang_cc1 %s -triple i686-linux -emit-llvm -o - -mconstructor-aliases | FileCheck --check-prefix=NOOPT %s - - // RUN: %clang_cc1 -cc1 -triple x86_64--netbsd -emit-llvm \ - // RUN: -mconstructor-aliases -O2 %s -o - | FileCheck --check-prefix=CHECK-RAUW %s -@@ -133,6 +133,22 @@ namespace test8 { - zed foo; - } - -+namespace test9 { -+struct foo { -+ __attribute__((stdcall)) ~foo() { -+ } -+}; -+ -+struct bar : public foo {}; -+ -+void zed() { -+ // Test that we produce a call to bar's destructor. We used to call foo's, but -+ // it has a different calling conversion. -+ // CHECK-DAG: call void @_ZN5test93barD2Ev -+ bar ptr; -+} -+} -+ - // CHECK-RAUW: @_ZTV1C = linkonce_odr unnamed_addr constant [4 x i8*] [{{[^@]*}}@_ZTI1C {{[^@]*}}@_ZN1CD2Ev {{[^@]*}}@_ZN1CD0Ev {{[^@]*}}] - // r194296 replaced C::~C with B::~B without emitting the later. - diff --git a/contrib/llvm/patches/patch-r263048-clang-r203624-fix-CC-aliases.diff b/contrib/llvm/patches/patch-r263048-clang-r203624-fix-CC-aliases.diff index 1aac8cb0581..5b971b8e68e 100644 --- a/contrib/llvm/patches/patch-r263048-clang-r203624-fix-CC-aliases.diff +++ b/contrib/llvm/patches/patch-r263048-clang-r203624-fix-CC-aliases.diff @@ -5,7 +5,7 @@ Pull in r203624 from upstream clang trunk (by Hans Wennborg): This narrows the impact of r188833 after Dimitry pointed out that it's good to be able to tell the difference between 'cc' and 'CC'. -Introduced here: http://svn.freebsd.org/changeset/base/263048 +Introduced here: http://svnweb.freebsd.org/changeset/base/263048 Index: tools/clang/tools/driver/driver.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r263312-llvm-r169939-inline-asm-with-realign.diff b/contrib/llvm/patches/patch-r263312-llvm-r169939-inline-asm-with-realign.diff index f92dd3ac02c..c70ad4d5e49 100644 --- a/contrib/llvm/patches/patch-r263312-llvm-r169939-inline-asm-with-realign.diff +++ b/contrib/llvm/patches/patch-r263312-llvm-r169939-inline-asm-with-realign.diff @@ -9,7 +9,7 @@ Pull in r196939 from upstream llvm trunk (by Reid Kleckner): Update to clang side tests will land shortly. -Introduced here: http://svn.freebsd.org/changeset/base/263312 +Introduced here: http://svnweb.freebsd.org/changeset/base/263312 Index: test/CodeGen/X86/inline-asm-stack-realign2.ll =================================================================== diff --git a/contrib/llvm/patches/patch-r263312-llvm-r196940-update-inline-asm-test.diff b/contrib/llvm/patches/patch-r263312-llvm-r196940-update-inline-asm-test.diff index 6ce56cbf4a5..8b96584c565 100644 --- a/contrib/llvm/patches/patch-r263312-llvm-r196940-update-inline-asm-test.diff +++ b/contrib/llvm/patches/patch-r263312-llvm-r196940-update-inline-asm-test.diff @@ -2,7 +2,7 @@ Pull in r196940 from upstream clang trunk (by Reid Kleckner): Update clang MS inline asm tests for r196939 -Introduced here: http://svn.freebsd.org/changeset/base/263312 +Introduced here: http://svnweb.freebsd.org/changeset/base/263312 Index: tools/clang/test/CodeGen/ms-inline-asm.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r263312-llvm-r196986-allow-realign-alloca.diff b/contrib/llvm/patches/patch-r263312-llvm-r196986-allow-realign-alloca.diff index 2c0b7590858..32081e1874b 100644 --- a/contrib/llvm/patches/patch-r263312-llvm-r196986-allow-realign-alloca.diff +++ b/contrib/llvm/patches/patch-r263312-llvm-r196986-allow-realign-alloca.diff @@ -12,7 +12,7 @@ Pull in r196986 from upstream llvm trunk (by Reid Kleckner): XFAIL the test cases that would be miscompiled and add one that uses the relevant functionality. -Introduced here: http://svn.freebsd.org/changeset/base/263312 +Introduced here: http://svnweb.freebsd.org/changeset/base/263312 Index: lib/Target/X86/X86RegisterInfo.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r263312-llvm-r202930-fix-alloca-esi-clobber.diff b/contrib/llvm/patches/patch-r263312-llvm-r202930-fix-alloca-esi-clobber.diff index b4017c96739..b77d00c7d20 100644 --- a/contrib/llvm/patches/patch-r263312-llvm-r202930-fix-alloca-esi-clobber.diff +++ b/contrib/llvm/patches/patch-r263312-llvm-r202930-fix-alloca-esi-clobber.diff @@ -16,7 +16,7 @@ Pull in r202930 from upstream llvm trunk (by Hans Wennborg): Differential Revision: http://llvm-reviews.chandlerc.com/D2954 -Introduced here: http://svn.freebsd.org/changeset/base/263312 +Introduced here: http://svnweb.freebsd.org/changeset/base/263312 Index: lib/CodeGen/MachineFunction.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r263313-llvm-r203311-fix-sse1-oom.diff b/contrib/llvm/patches/patch-r263313-llvm-r203311-fix-sse1-oom.diff index 43efd12c87a..35c989cb906 100644 --- a/contrib/llvm/patches/patch-r263313-llvm-r203311-fix-sse1-oom.diff +++ b/contrib/llvm/patches/patch-r263313-llvm-r203311-fix-sse1-oom.diff @@ -12,7 +12,7 @@ Pull in r203311 from upstream llvm trunk (by Arnold Schwaighofer): Fixes PR18036. -Introduced here: http://svn.freebsd.org/changeset/base/263313 +Introduced here: http://svnweb.freebsd.org/changeset/base/263313 Index: test/CodeGen/X86/sse1.ll =================================================================== diff --git a/contrib/llvm/patches/patch-r263619-clang-r201662-arm-gnueabihf.diff b/contrib/llvm/patches/patch-r263619-clang-r201662-arm-gnueabihf.diff index d13648e393e..0e1997cd9ff 100644 --- a/contrib/llvm/patches/patch-r263619-clang-r201662-arm-gnueabihf.diff +++ b/contrib/llvm/patches/patch-r263619-clang-r201662-arm-gnueabihf.diff @@ -1,3 +1,11 @@ +Pull in r201662 from upstream clang trunk: + + Add FreeBSD ARM EABI hard-float support + + Patch by Andrew Turner. + +Introduced here: http://svnweb.freebsd.org/changeset/base/263619 + Index: tools/clang/lib/Driver/ToolChains.cpp =================================================================== --- tools/clang/lib/Driver/ToolChains.cpp diff --git a/contrib/llvm/patches/patch-r264826-llvm-r202188-variadic-fn-debug-info.diff b/contrib/llvm/patches/patch-r264826-llvm-r202188-variadic-fn-debug-info.diff index 6bb1db96a62..a91307b5650 100644 --- a/contrib/llvm/patches/patch-r264826-llvm-r202188-variadic-fn-debug-info.diff +++ b/contrib/llvm/patches/patch-r264826-llvm-r202188-variadic-fn-debug-info.diff @@ -18,7 +18,7 @@ DwarfUnit -> CompileUnit Sponsored by: DARPA, AFRL -http://svnweb.freebsd.org/changeset/base/264826 +Introduced here: http://svnweb.freebsd.org/changeset/base/264826 Index: include/llvm/DIBuilder.h =================================================================== diff --git a/contrib/llvm/patches/patch-r264827-clang-r202185-variadic-fn-debug-info.diff b/contrib/llvm/patches/patch-r264827-clang-r202185-variadic-fn-debug-info.diff index 7084f7b2ab4..8ae30b4cf2e 100644 --- a/contrib/llvm/patches/patch-r264827-clang-r202185-variadic-fn-debug-info.diff +++ b/contrib/llvm/patches/patch-r264827-clang-r202185-variadic-fn-debug-info.diff @@ -14,7 +14,7 @@ getReturnType -> getResultType Sponsored by: DARPA, AFRL -http://svnweb.freebsd.org/changeset/base/264827 +Introduced here: http://svnweb.freebsd.org/changeset/base/264827 Index: tools/clang/lib/CodeGen/CGDebugInfo.cpp =================================================================== diff --git a/contrib/llvm/patches/patch-r265477-clang-r198655-standalone-debug.diff b/contrib/llvm/patches/patch-r265477-clang-r198655-standalone-debug.diff new file mode 100644 index 00000000000..aabfb92ea78 --- /dev/null +++ b/contrib/llvm/patches/patch-r265477-clang-r198655-standalone-debug.diff @@ -0,0 +1,318 @@ +Merge -fstandalone-debug from Clang r198655: + + Implement a new -fstandalone-debug option. rdar://problem/15685848 + It controls everything that -flimit-debug-info used to, plus the + vtable type optimization. The old -fno-limit-debug-info option is now an + alias to -fstandalone-debug and vice versa. + + Standalone is the default on Darwin until dtrace is updated to work with + non-standalone debug info (rdar://problem/15758808). + + Note: I kept the LimitedDebugInfo name in CodeGenOptions::DebugInfoKind + because NoStandaloneDebugInfo sounded even more confusing. + +Introduced here: http://svnweb.freebsd.org/changeset/base/265477 + +Index: tools/clang/lib/CodeGen/CGDebugInfo.cpp +=================================================================== +--- tools/clang/lib/CodeGen/CGDebugInfo.cpp ++++ tools/clang/lib/CodeGen/CGDebugInfo.cpp +@@ -1456,13 +1456,13 @@ llvm::DIType CGDebugInfo::CreateType(const RecordT + // declaration. The completeType, completeRequiredType, and completeClassData + // callbacks will handle promoting the declaration to a definition. + if (T || ++ // Under -flimit-debug-info: + (DebugKind <= CodeGenOptions::LimitedDebugInfo && +- // Under -flimit-debug-info, emit only a declaration unless the type is +- // required to be complete. +- !RD->isCompleteDefinitionRequired() && CGM.getLangOpts().CPlusPlus) || +- // If the class is dynamic, only emit a declaration. A definition will be +- // emitted whenever the vtable is emitted. +- (CXXDecl && CXXDecl->hasDefinition() && CXXDecl->isDynamicClass()) || T) { ++ // Emit only a forward declaration unless the type is required. ++ ((!RD->isCompleteDefinitionRequired() && CGM.getLangOpts().CPlusPlus) || ++ // If the class is dynamic, only emit a declaration. A definition will be ++ // emitted whenever the vtable is emitted. ++ (CXXDecl && CXXDecl->hasDefinition() && CXXDecl->isDynamicClass())))) { + llvm::DIDescriptor FDContext = + getContextDescriptor(cast(RD->getDeclContext())); + if (!T) +Index: tools/clang/lib/Frontend/CompilerInvocation.cpp +=================================================================== +--- tools/clang/lib/Frontend/CompilerInvocation.cpp ++++ tools/clang/lib/Frontend/CompilerInvocation.cpp +@@ -295,7 +295,8 @@ static void ParseCommentArgs(CommentOptions &Opts, + } + + static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, +- DiagnosticsEngine &Diags) { ++ DiagnosticsEngine &Diags, ++ const TargetOptions &TargetOpts) { + using namespace options; + bool Success = true; + +@@ -322,10 +323,16 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, + Opts.setDebugInfo(CodeGenOptions::DebugLineTablesOnly); + } else if (Args.hasArg(OPT_g_Flag) || Args.hasArg(OPT_gdwarf_2) || + Args.hasArg(OPT_gdwarf_3) || Args.hasArg(OPT_gdwarf_4)) { +- if (Args.hasFlag(OPT_flimit_debug_info, OPT_fno_limit_debug_info, true)) ++ bool Default = false; ++ // Until dtrace (via CTF) can deal with distributed debug info, ++ // Darwin defaults to standalone/full debug info. ++ if (llvm::Triple(TargetOpts.Triple).isOSDarwin()) ++ Default = true; ++ ++ if (Args.hasFlag(OPT_fstandalone_debug, OPT_fno_standalone_debug, Default)) ++ Opts.setDebugInfo(CodeGenOptions::FullDebugInfo); ++ else + Opts.setDebugInfo(CodeGenOptions::LimitedDebugInfo); +- else +- Opts.setDebugInfo(CodeGenOptions::FullDebugInfo); + } + Opts.DebugColumnInfo = Args.hasArg(OPT_dwarf_column_info); + Opts.SplitDwarfFile = Args.getLastArgValue(OPT_split_dwarf_file); +@@ -1657,8 +1664,9 @@ bool CompilerInvocation::CreateFromArgs(CompilerIn + ParseFileSystemArgs(Res.getFileSystemOpts(), *Args); + // FIXME: We shouldn't have to pass the DashX option around here + InputKind DashX = ParseFrontendArgs(Res.getFrontendOpts(), *Args, Diags); +- Success = ParseCodeGenArgs(Res.getCodeGenOpts(), *Args, DashX, Diags) +- && Success; ++ ParseTargetArgs(Res.getTargetOpts(), *Args); ++ Success = ParseCodeGenArgs(Res.getCodeGenOpts(), *Args, DashX, Diags, ++ Res.getTargetOpts()) && Success; + ParseHeaderSearchArgs(Res.getHeaderSearchOpts(), *Args); + if (DashX != IK_AST && DashX != IK_LLVM_IR) { + ParseLangArgs(*Res.getLangOpts(), *Args, DashX, Diags); +@@ -1673,8 +1681,6 @@ bool CompilerInvocation::CreateFromArgs(CompilerIn + ParsePreprocessorArgs(Res.getPreprocessorOpts(), *Args, FileMgr, Diags); + ParsePreprocessorOutputArgs(Res.getPreprocessorOutputOpts(), *Args, + Res.getFrontendOpts().ProgramAction); +- ParseTargetArgs(Res.getTargetOpts(), *Args); +- + return Success; + } + +Index: tools/clang/lib/Driver/Tools.cpp +=================================================================== +--- tools/clang/lib/Driver/Tools.cpp ++++ tools/clang/lib/Driver/Tools.cpp +@@ -2995,8 +2995,8 @@ void Clang::ConstructJob(Compilation &C, const Job + Args.AddLastArg(CmdArgs, options::OPT_femit_all_decls); + Args.AddLastArg(CmdArgs, options::OPT_fformat_extensions); + Args.AddLastArg(CmdArgs, options::OPT_fheinous_gnu_extensions); +- Args.AddLastArg(CmdArgs, options::OPT_flimit_debug_info); +- Args.AddLastArg(CmdArgs, options::OPT_fno_limit_debug_info); ++ Args.AddLastArg(CmdArgs, options::OPT_fstandalone_debug); ++ Args.AddLastArg(CmdArgs, options::OPT_fno_standalone_debug); + Args.AddLastArg(CmdArgs, options::OPT_fno_operator_names); + // AltiVec language extensions aren't relevant for assembling. + if (!isa(JA) || +Index: tools/clang/test/CodeGenCXX/debug-info-template-member.cpp +=================================================================== +--- tools/clang/test/CodeGenCXX/debug-info-template-member.cpp ++++ tools/clang/test/CodeGenCXX/debug-info-template-member.cpp +@@ -1,4 +1,4 @@ +-// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s ++// RUN: %clang_cc1 -emit-llvm -g -fno-standalone-debug -triple x86_64-apple-darwin %s -o - | FileCheck %s + + struct MyClass { + template int add(int j) { +Index: tools/clang/test/CodeGenCXX/debug-info-vtable-optzn.cpp +=================================================================== +--- tools/clang/test/CodeGenCXX/debug-info-vtable-optzn.cpp ++++ tools/clang/test/CodeGenCXX/debug-info-vtable-optzn.cpp +@@ -0,0 +1,21 @@ ++// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s ++// ++// This tests that the "emit debug info for a C++ class only in the ++// module that has its vtable" optimization is disabled by default on ++// Darwin. ++// ++// CHECK: [ DW_TAG_member ] [lost] ++class A ++{ ++ virtual bool f() = 0; ++ int lost; ++}; ++ ++class B : public A ++{ ++ B *g(); ++}; ++ ++B *B::g() { ++ return this; ++} +Index: tools/clang/test/CodeGenCXX/debug-info-namespace.cpp +=================================================================== +--- tools/clang/test/CodeGenCXX/debug-info-namespace.cpp ++++ tools/clang/test/CodeGenCXX/debug-info-namespace.cpp +@@ -1,6 +1,6 @@ +-// RUN: %clang -g -S -emit-llvm %s -o - | FileCheck %s +-// RUN: %clang -g -gline-tables-only -S -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-GMLT %s +-// RUN: %clang -g -fno-limit-debug-info -S -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-NOLIMIT %s ++// RUN: %clang -g -fno-standalone-debug -S -emit-llvm %s -o - | FileCheck %s ++// RUN: %clang -g -gline-tables-only -S -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-GMLT %s ++// RUN: %clang -g -fstandalone-debug -S -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-NOLIMIT %s + + namespace A { + #line 1 "foo.cpp" +Index: tools/clang/test/CodeGenCXX/debug-info-class-limited.cpp +=================================================================== +--- tools/clang/test/CodeGenCXX/debug-info-class-limited.cpp ++++ tools/clang/test/CodeGenCXX/debug-info-class-limited.cpp +@@ -1,4 +1,4 @@ +-// RUN: %clang -emit-llvm -g -S %s -o - | FileCheck %s ++// RUN: %clang -emit-llvm -fno-standalone-debug -g -S %s -o - | FileCheck %s + + namespace PR16214_1 { + // CHECK-DAG: [ DW_TAG_structure_type ] [foo] [line [[@LINE+1]], {{.*}} [def] +Index: tools/clang/test/CodeGenCXX/debug-info-method2.cpp +=================================================================== +--- tools/clang/test/CodeGenCXX/debug-info-method2.cpp ++++ tools/clang/test/CodeGenCXX/debug-info-method2.cpp +@@ -1,4 +1,4 @@ +-// RUN: %clang_cc1 -flimit-debug-info -x c++ -g -S -emit-llvm < %s | FileCheck %s ++// RUN: %clang_cc1 -fno-standalone-debug -x c++ -g -S -emit-llvm < %s | FileCheck %s + // rdar://10336845 + // Preserve type qualifiers in -flimit-debug-info mode. + +Index: tools/clang/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp +=================================================================== +--- tools/clang/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp ++++ tools/clang/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp +@@ -1,4 +1,4 @@ +-// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin -fno-limit-debug-info %s -o - | FileCheck %s ++// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin -fstandalone-debug %s -o - | FileCheck %s + + class Test + { +Index: tools/clang/test/CodeGenCXX/debug-info-class-nolimit.cpp +=================================================================== +--- tools/clang/test/CodeGenCXX/debug-info-class-nolimit.cpp ++++ tools/clang/test/CodeGenCXX/debug-info-class-nolimit.cpp +@@ -1,4 +1,6 @@ +-// RUN: %clang_cc1 -triple x86_64-unk-unk -fno-limit-debug-info -o - -emit-llvm -g %s | FileCheck %s ++// RUN: %clang_cc1 -triple x86_64-unk-unk -fstandalone-debug -o - -emit-llvm -g %s | FileCheck %s ++// On Darwin, this should be the default: ++// RUN: %clang_cc1 -triple x86_64-apple-darwin -o - -emit-llvm -g %s | FileCheck %s + + namespace rdar14101097_1 { // see also PR16214 + // Check that we emit debug info for the definition of a struct if the +Index: tools/clang/test/CodeGenCXX/debug-info-template-limit.cpp +=================================================================== +--- tools/clang/test/CodeGenCXX/debug-info-template-limit.cpp ++++ tools/clang/test/CodeGenCXX/debug-info-template-limit.cpp +@@ -1,4 +1,4 @@ +-// RUN: %clang -flimit-debug-info -emit-llvm -g -S %s -o - | FileCheck %s ++// RUN: %clang -fno-standalone-debug -emit-llvm -g -S %s -o - | FileCheck %s + + // Check that this pointer type is TC + // CHECK: ![[LINE:[0-9]+]] = {{.*}}"TC", {{.*}} metadata !"_ZTS2TCIiE"} ; [ DW_TAG_class_type ] +Index: tools/clang/test/CodeGenCXX/debug-info-pubtypes.cpp +=================================================================== +--- tools/clang/test/CodeGenCXX/debug-info-pubtypes.cpp ++++ tools/clang/test/CodeGenCXX/debug-info-pubtypes.cpp +@@ -1,5 +1,5 @@ + // REQUIRES: x86-64-registered-target +-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -g -fno-limit-debug-info -S -mllvm -generate-dwarf-pub-sections=Enable %s -o - | FileCheck %s ++// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -g -fstandalone-debug -S -mllvm -generate-dwarf-pub-sections=Enable %s -o - | FileCheck %s + + // FIXME: This testcase shouldn't rely on assembly emission. + //CHECK: Lpubtypes_begin[[SECNUM:[0-9]:]] +Index: tools/clang/include/clang/Frontend/CodeGenOptions.h +=================================================================== +--- tools/clang/include/clang/Frontend/CodeGenOptions.h ++++ tools/clang/include/clang/Frontend/CodeGenOptions.h +@@ -50,12 +50,20 @@ class CodeGenOptions : public CodeGenOptionsBase { + }; + + enum DebugInfoKind { +- NoDebugInfo, // Don't generate debug info. +- DebugLineTablesOnly, // Emit only debug info necessary for generating +- // line number tables (-gline-tables-only). +- LimitedDebugInfo, // Limit generated debug info to reduce size +- // (-flimit-debug-info). +- FullDebugInfo // Generate complete debug info. ++ NoDebugInfo, /// Don't generate debug info. ++ ++ DebugLineTablesOnly, /// Emit only debug info necessary for generating ++ /// line number tables (-gline-tables-only). ++ ++ LimitedDebugInfo, /// Limit generated debug info to reduce size ++ /// (-fno-standalone-debug). This emits ++ /// forward decls for types that could be ++ /// replaced with forward decls in the source ++ /// code. For dynamic C++ classes type info ++ /// is only emitted int the module that ++ /// contains the classe's vtable. ++ ++ FullDebugInfo /// Generate complete debug info. + }; + + enum TLSModel { +Index: tools/clang/include/clang/Driver/Options.td +=================================================================== +--- tools/clang/include/clang/Driver/Options.td ++++ tools/clang/include/clang/Driver/Options.td +@@ -549,8 +549,6 @@ def finstrument_functions : Flag<["-"], "finstrume + def fkeep_inline_functions : Flag<["-"], "fkeep-inline-functions">, Group; + def flat__namespace : Flag<["-"], "flat_namespace">; + def flax_vector_conversions : Flag<["-"], "flax-vector-conversions">, Group; +-def flimit_debug_info : Flag<["-"], "flimit-debug-info">, Group, Flags<[CC1Option]>, +- HelpText<"Limit debug information produced to reduce size of debug binary">; + def flimited_precision_EQ : Joined<["-"], "flimited-precision=">, Group; + def flto : Flag<["-"], "flto">, Group; + def fno_lto : Flag<["-"], "fno-lto">, Group; +@@ -645,8 +643,6 @@ def fno_inline : Flag<["-"], "fno-inline">, Group< + def fno_keep_inline_functions : Flag<["-"], "fno-keep-inline-functions">, Group; + def fno_lax_vector_conversions : Flag<["-"], "fno-lax-vector-conversions">, Group, + HelpText<"Disallow implicit conversions between vectors with a different number of elements or different element types">, Flags<[CC1Option]>; +-def fno_limit_debug_info : Flag<["-"], "fno-limit-debug-info">, Group, Flags<[CC1Option]>, +- HelpText<"Do not limit debug information produced to reduce size of debug binary">; + def fno_merge_all_constants : Flag<["-"], "fno-merge-all-constants">, Group, + Flags<[CC1Option]>, HelpText<"Disallow merging of constants">; + def fno_modules : Flag <["-"], "fno-modules">, Group, +@@ -774,6 +770,12 @@ def fno_signed_char : Flag<["-"], "fno-signed-char + def fsplit_stack : Flag<["-"], "fsplit-stack">, Group; + def fstack_protector_all : Flag<["-"], "fstack-protector-all">, Group; + def fstack_protector : Flag<["-"], "fstack-protector">, Group; ++def fstandalone_debug : Flag<["-"], "fstandalone-debug">, Group, Flags<[CC1Option]>, ++ HelpText<"Emit full debug info for all types used by the program">; ++def fno_standalone_debug : Flag<["-"], "fno-standalone-debug">, Group, Flags<[CC1Option]>, ++ HelpText<"Limit debug information produced to reduce size of debug binary">; ++def flimit_debug_info : Flag<["-"], "flimit-debug-info">, Alias; ++def fno_limit_debug_info : Flag<["-"], "fno-limit-debug-info">, Alias; + def fstrict_aliasing : Flag<["-"], "fstrict-aliasing">, Group; + def fstrict_enums : Flag<["-"], "fstrict-enums">, Group, Flags<[CC1Option]>, + HelpText<"Enable optimizations based on the strict definition of an enum's " +Index: tools/clang/docs/tools/clang.pod +=================================================================== +--- tools/clang/docs/tools/clang.pod ++++ tools/clang/docs/tools/clang.pod +@@ -310,9 +310,23 @@ Currently equivalent to B<-O3> + =item B<-g> + + Generate debug information. Note that Clang debug information works best at +-B<-O0>. At higher optimization levels, only line number information is +-currently available. ++B<-O0>. + ++=item B<-fstandalone-debug> B<-fno-standalone-debug> ++ ++Clang supports a number of optimizations to reduce the size of debug ++information in the binary. They work based on the assumption that the ++debug type information can be spread out over multiple compilation ++units. For instance, Clang will not emit type definitions for types ++that are not needed by a module and could be replaced with a forward ++declaration. Further, Clang will only emit type info for a dynamic ++C++ class in the module that contains the vtable for the class. ++ ++The B<-fstandalone-debug> option turns off these optimizations. This ++is useful when working with 3rd-party libraries that don't come with ++debug information. Note that Clang will never emit type information ++for types that are not referenced at all by the program. ++ + =item B<-fexceptions> + + Enable generation of unwind information, this allows exceptions to be thrown diff --git a/contrib/llvm/patches/patch-r266674-clang-r209489-fix-xmmintrin.diff b/contrib/llvm/patches/patch-r266674-clang-r209489-fix-xmmintrin.diff new file mode 100644 index 00000000000..78473aa26a1 --- /dev/null +++ b/contrib/llvm/patches/patch-r266674-clang-r209489-fix-xmmintrin.diff @@ -0,0 +1,49 @@ +Pull in r209489 from upstream clang trunk (by Akira Hatanaka): + + Fix a bug in xmmintrin.h. + + The last step of _mm_cvtps_pi16 should use _mm_packs_pi32, which is a function + that reads two __m64 values and packs four 32-bit values into four 16-bit + values. + + + +Pull in r209559 from upstream clang trunk (by Akira Hatanaka): + + Recommit r209532 with -ffreestanding. + + This is a test case for r209489. + +Introduced here: http://svnweb.freebsd.org/changeset/base/266674 + +Index: tools/clang/lib/Headers/xmmintrin.h +=================================================================== +--- tools/clang/lib/Headers/xmmintrin.h ++++ tools/clang/lib/Headers/xmmintrin.h +@@ -903,7 +903,7 @@ _mm_cvtps_pi16(__m128 __a) + __a = _mm_movehl_ps(__a, __a); + __c = _mm_cvtps_pi32(__a); + +- return _mm_packs_pi16(__b, __c); ++ return _mm_packs_pi32(__b, __c); + } + + static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) +Index: tools/clang/test/Headers/xmmintrin.c +=================================================================== +--- tools/clang/test/Headers/xmmintrin.c ++++ tools/clang/test/Headers/xmmintrin.c +@@ -0,0 +1,13 @@ ++// RUN: %clang_cc1 %s -ffreestanding -triple x86_64-apple-macosx10.9.0 -emit-llvm -o - | FileCheck %s ++ ++#include ++ ++// Make sure the last step of _mm_cvtps_pi16 converts <4 x i32> to <4 x i16> by ++// checking that clang emits PACKSSDW instead of PACKSSWB. ++ ++// CHECK: define i64 @test_mm_cvtps_pi16 ++// CHECK: call x86_mmx @llvm.x86.mmx.packssdw ++ ++__m64 test_mm_cvtps_pi16(__m128 a) { ++ return _mm_cvtps_pi16(a); ++} diff --git a/contrib/llvm/patches/patch-r267704-llvm-r211435-fix-avx-backend.diff b/contrib/llvm/patches/patch-r267704-llvm-r211435-fix-avx-backend.diff new file mode 100644 index 00000000000..f64fc47c544 --- /dev/null +++ b/contrib/llvm/patches/patch-r267704-llvm-r211435-fix-avx-backend.diff @@ -0,0 +1,125 @@ +Pull in r211435 from upstream llvm trunk (by Benjamin Kramer): + + Legalizer: Add support for splitting insert_subvectors. + + We handle this by spilling the whole thing to the stack and doing the + insertion as a store. + + PR19492. This happens in real code because the vectorizer creates + v2i128 when AVX is enabled. + +This fixes a "fatal error: error in backend: Do not know how to split +the result of this operator!" message encountered during compilation of +the net-p2p/libtorrent-rasterbar port. + +Introduced here: http://svnweb.freebsd.org/changeset/base/267704 + +Index: lib/CodeGen/SelectionDAG/LegalizeTypes.h +=================================================================== +--- lib/CodeGen/SelectionDAG/LegalizeTypes.h ++++ lib/CodeGen/SelectionDAG/LegalizeTypes.h +@@ -569,6 +569,7 @@ class LLVM_LIBRARY_VISIBILITY DAGTypeLegalizer { + void SplitVecRes_BUILD_VECTOR(SDNode *N, SDValue &Lo, SDValue &Hi); + void SplitVecRes_CONCAT_VECTORS(SDNode *N, SDValue &Lo, SDValue &Hi); + void SplitVecRes_EXTRACT_SUBVECTOR(SDNode *N, SDValue &Lo, SDValue &Hi); ++ void SplitVecRes_INSERT_SUBVECTOR(SDNode *N, SDValue &Lo, SDValue &Hi); + void SplitVecRes_FPOWI(SDNode *N, SDValue &Lo, SDValue &Hi); + void SplitVecRes_INSERT_VECTOR_ELT(SDNode *N, SDValue &Lo, SDValue &Hi); + void SplitVecRes_LOAD(LoadSDNode *N, SDValue &Lo, SDValue &Hi); +Index: lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp +=================================================================== +--- lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp ++++ lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp +@@ -506,6 +506,7 @@ void DAGTypeLegalizer::SplitVectorResult(SDNode *N + case ISD::BUILD_VECTOR: SplitVecRes_BUILD_VECTOR(N, Lo, Hi); break; + case ISD::CONCAT_VECTORS: SplitVecRes_CONCAT_VECTORS(N, Lo, Hi); break; + case ISD::EXTRACT_SUBVECTOR: SplitVecRes_EXTRACT_SUBVECTOR(N, Lo, Hi); break; ++ case ISD::INSERT_SUBVECTOR: SplitVecRes_INSERT_SUBVECTOR(N, Lo, Hi); break; + case ISD::FP_ROUND_INREG: SplitVecRes_InregOp(N, Lo, Hi); break; + case ISD::FPOWI: SplitVecRes_FPOWI(N, Lo, Hi); break; + case ISD::INSERT_VECTOR_ELT: SplitVecRes_INSERT_VECTOR_ELT(N, Lo, Hi); break; +@@ -725,6 +726,43 @@ void DAGTypeLegalizer::SplitVecRes_EXTRACT_SUBVECT + TLI.getVectorIdxTy())); + } + ++void DAGTypeLegalizer::SplitVecRes_INSERT_SUBVECTOR(SDNode *N, SDValue &Lo, ++ SDValue &Hi) { ++ SDValue Vec = N->getOperand(0); ++ SDValue SubVec = N->getOperand(1); ++ SDValue Idx = N->getOperand(2); ++ SDLoc dl(N); ++ GetSplitVector(Vec, Lo, Hi); ++ ++ // Spill the vector to the stack. ++ EVT VecVT = Vec.getValueType(); ++ EVT SubVecVT = VecVT.getVectorElementType(); ++ SDValue StackPtr = DAG.CreateStackTemporary(VecVT); ++ SDValue Store = DAG.getStore(DAG.getEntryNode(), dl, Vec, StackPtr, ++ MachinePointerInfo(), false, false, 0); ++ ++ // Store the new subvector into the specified index. ++ SDValue SubVecPtr = GetVectorElementPointer(StackPtr, SubVecVT, Idx); ++ Type *VecType = VecVT.getTypeForEVT(*DAG.getContext()); ++ unsigned Alignment = TLI.getDataLayout()->getPrefTypeAlignment(VecType); ++ Store = DAG.getStore(Store, dl, SubVec, SubVecPtr, MachinePointerInfo(), ++ false, false, 0); ++ ++ // Load the Lo part from the stack slot. ++ Lo = DAG.getLoad(Lo.getValueType(), dl, Store, StackPtr, MachinePointerInfo(), ++ false, false, false, 0); ++ ++ // Increment the pointer to the other part. ++ unsigned IncrementSize = Lo.getValueType().getSizeInBits() / 8; ++ StackPtr = ++ DAG.getNode(ISD::ADD, dl, StackPtr.getValueType(), StackPtr, ++ DAG.getConstant(IncrementSize, StackPtr.getValueType())); ++ ++ // Load the Hi part from the stack slot. ++ Hi = DAG.getLoad(Hi.getValueType(), dl, Store, StackPtr, MachinePointerInfo(), ++ false, false, false, MinAlign(Alignment, IncrementSize)); ++} ++ + void DAGTypeLegalizer::SplitVecRes_FPOWI(SDNode *N, SDValue &Lo, + SDValue &Hi) { + SDLoc dl(N); +Index: test/CodeGen/X86/vec_split.ll +=================================================================== +--- test/CodeGen/X86/vec_split.ll ++++ test/CodeGen/X86/vec_split.ll +@@ -40,3 +40,36 @@ define <32 x i16> @split32(<32 x i16> %a, <32 x i1 + %2 = select <32 x i1> %1, <32 x i16> %a, <32 x i16> %b + ret <32 x i16> %2 + } ++ ++; PR19492 ++define i128 @split128(<2 x i128> %a, <2 x i128> %b) { ++; SSE4-LABEL: split128: ++; SSE4: addq ++; SSE4: adcq ++; SSE4: addq ++; SSE4: adcq ++; SSE4: addq ++; SSE4: adcq ++; SSE4: ret ++; AVX1-LABEL: split128: ++; AVX1: addq ++; AVX1: adcq ++; AVX1: addq ++; AVX1: adcq ++; AVX1: addq ++; AVX1: adcq ++; AVX1: ret ++; AVX2-LABEL: split128: ++; AVX2: addq ++; AVX2: adcq ++; AVX2: addq ++; AVX2: adcq ++; AVX2: addq ++; AVX2: adcq ++; AVX2: ret ++ %add = add nsw <2 x i128> %a, %b ++ %rdx.shuf = shufflevector <2 x i128> %add, <2 x i128> undef, <2 x i32> ++ %bin.rdx = add <2 x i128> %add, %rdx.shuf ++ %e = extractelement <2 x i128> %bin.rdx, i32 1 ++ ret i128 %e ++} diff --git a/contrib/llvm/patches/patch-r267981-llvm-r211435-fix-ppc-fctiduz.diff b/contrib/llvm/patches/patch-r267981-llvm-r211435-fix-ppc-fctiduz.diff new file mode 100644 index 00000000000..2cfb93ea36c --- /dev/null +++ b/contrib/llvm/patches/patch-r267981-llvm-r211435-fix-ppc-fctiduz.diff @@ -0,0 +1,494 @@ +Pull in r211627 from upstream llvm trunk (by Bill Schmidt): + + [PPC64] Fix PR20071 (fctiduz generated for targets lacking that + instruction) + + PR20071 identifies a problem in PowerPC's fast-isel implementation + for floating-point conversion to integer. The fctiduz instruction + was added in Power ISA 2.06 (i.e., Power7 and later). However, this + instruction is being generated regardless of which 64-bit PowerPC + target is selected. + + The intent is for fast-isel to punt to DAG selection when this + instruction is not available. This patch implements that change. + For testing purposes, the existing fast-isel-conversion.ll test adds + a RUN line for -mcpu=970 and tests for the expected code generation. + Additionally, the existing test fast-isel-conversion-p5.ll was found + to be incorrectly expecting the unavailable instruction to be + generated. I've removed these test variants since we have adequate + coverage in fast-isel-conversion.ll. + +This is needed to compile clang with debug+asserts on older powerpc64 +and ppc970 targets. + +Introduced here: http://svnweb.freebsd.org/changeset/base/267981 + +Index: lib/Target/PowerPC/PPCFastISel.cpp +=================================================================== +--- lib/Target/PowerPC/PPCFastISel.cpp (revision 106) ++++ lib/Target/PowerPC/PPCFastISel.cpp (revision 107) +@@ -1026,6 +1026,10 @@ bool PPCFastISel::SelectFPToI(const Instruction *I + if (DstVT != MVT::i32 && DstVT != MVT::i64) + return false; + ++ // If we don't have FCTIDUZ and we need it, punt to SelectionDAG. ++ if (DstVT == MVT::i64 && !IsSigned && !PPCSubTarget.hasFPCVT()) ++ return false; ++ + Value *Src = I->getOperand(0); + Type *SrcTy = Src->getType(); + if (!isTypeLegal(SrcTy, SrcVT)) +Index: test/CodeGen/PowerPC/fast-isel-conversion-p5.ll +=================================================================== +--- test/CodeGen/PowerPC/fast-isel-conversion-p5.ll (revision 106) ++++ test/CodeGen/PowerPC/fast-isel-conversion-p5.ll (revision 107) +@@ -116,18 +116,6 @@ entry: + ret void + } + +-define void @fptoui_float_i64(float %a) nounwind ssp { +-entry: +-; ELF64: fptoui_float_i64 +- %b.addr = alloca i64, align 4 +- %conv = fptoui float %a to i64 +-; ELF64: fctiduz +-; ELF64: stfd +-; ELF64: ld +- store i64 %conv, i64* %b.addr, align 4 +- ret void +-} +- + define void @fptoui_double_i32(double %a) nounwind ssp { + entry: + ; ELF64: fptoui_double_i32 +@@ -140,14 +128,3 @@ entry: + ret void + } + +-define void @fptoui_double_i64(double %a) nounwind ssp { +-entry: +-; ELF64: fptoui_double_i64 +- %b.addr = alloca i64, align 8 +- %conv = fptoui double %a to i64 +-; ELF64: fctiduz +-; ELF64: stfd +-; ELF64: ld +- store i64 %conv, i64* %b.addr, align 8 +- ret void +-} +Index: test/CodeGen/PowerPC/fast-isel-conversion.ll +=================================================================== +--- test/CodeGen/PowerPC/fast-isel-conversion.ll (revision 106) ++++ test/CodeGen/PowerPC/fast-isel-conversion.ll (revision 107) +@@ -1,15 +1,24 @@ + ; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck %s --check-prefix=ELF64 ++; RUN: llc < %s -O0 -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -mcpu=970 | FileCheck %s --check-prefix=PPC970 + ++;; Tests for 970 don't use -fast-isel-abort because we intentionally punt ++;; to SelectionDAG in some cases. ++ + ; Test sitofp + + define void @sitofp_single_i64(i64 %a, float %b) nounwind ssp { + entry: + ; ELF64: sitofp_single_i64 ++; PPC970: sitofp_single_i64 + %b.addr = alloca float, align 4 + %conv = sitofp i64 %a to float + ; ELF64: std + ; ELF64: lfd + ; ELF64: fcfids ++; PPC970: std ++; PPC970: lfd ++; PPC970: fcfid ++; PPC970: frsp + store float %conv, float* %b.addr, align 4 + ret void + } +@@ -17,11 +26,16 @@ entry: + define void @sitofp_single_i32(i32 %a, float %b) nounwind ssp { + entry: + ; ELF64: sitofp_single_i32 ++; PPC970: sitofp_single_i32 + %b.addr = alloca float, align 4 + %conv = sitofp i32 %a to float + ; ELF64: std + ; ELF64: lfiwax + ; ELF64: fcfids ++; PPC970: std ++; PPC970: lfd ++; PPC970: fcfid ++; PPC970: frsp + store float %conv, float* %b.addr, align 4 + ret void + } +@@ -29,6 +43,7 @@ entry: + define void @sitofp_single_i16(i16 %a, float %b) nounwind ssp { + entry: + ; ELF64: sitofp_single_i16 ++; PPC970: sitofp_single_i16 + %b.addr = alloca float, align 4 + %conv = sitofp i16 %a to float + ; ELF64: extsh +@@ -35,6 +50,11 @@ entry: + ; ELF64: std + ; ELF64: lfd + ; ELF64: fcfids ++; PPC970: extsh ++; PPC970: std ++; PPC970: lfd ++; PPC970: fcfid ++; PPC970: frsp + store float %conv, float* %b.addr, align 4 + ret void + } +@@ -42,6 +62,7 @@ entry: + define void @sitofp_single_i8(i8 %a) nounwind ssp { + entry: + ; ELF64: sitofp_single_i8 ++; PPC970: sitofp_single_i8 + %b.addr = alloca float, align 4 + %conv = sitofp i8 %a to float + ; ELF64: extsb +@@ -48,6 +69,11 @@ entry: + ; ELF64: std + ; ELF64: lfd + ; ELF64: fcfids ++; PPC970: extsb ++; PPC970: std ++; PPC970: lfd ++; PPC970: fcfid ++; PPC970: frsp + store float %conv, float* %b.addr, align 4 + ret void + } +@@ -55,11 +81,15 @@ entry: + define void @sitofp_double_i32(i32 %a, double %b) nounwind ssp { + entry: + ; ELF64: sitofp_double_i32 ++; PPC970: sitofp_double_i32 + %b.addr = alloca double, align 8 + %conv = sitofp i32 %a to double + ; ELF64: std + ; ELF64: lfiwax + ; ELF64: fcfid ++; PPC970: std ++; PPC970: lfd ++; PPC970: fcfid + store double %conv, double* %b.addr, align 8 + ret void + } +@@ -67,11 +97,15 @@ entry: + define void @sitofp_double_i64(i64 %a, double %b) nounwind ssp { + entry: + ; ELF64: sitofp_double_i64 ++; PPC970: sitofp_double_i64 + %b.addr = alloca double, align 8 + %conv = sitofp i64 %a to double + ; ELF64: std + ; ELF64: lfd + ; ELF64: fcfid ++; PPC970: std ++; PPC970: lfd ++; PPC970: fcfid + store double %conv, double* %b.addr, align 8 + ret void + } +@@ -79,6 +113,7 @@ entry: + define void @sitofp_double_i16(i16 %a, double %b) nounwind ssp { + entry: + ; ELF64: sitofp_double_i16 ++; PPC970: sitofp_double_i16 + %b.addr = alloca double, align 8 + %conv = sitofp i16 %a to double + ; ELF64: extsh +@@ -85,6 +120,10 @@ entry: + ; ELF64: std + ; ELF64: lfd + ; ELF64: fcfid ++; PPC970: extsh ++; PPC970: std ++; PPC970: lfd ++; PPC970: fcfid + store double %conv, double* %b.addr, align 8 + ret void + } +@@ -92,6 +131,7 @@ entry: + define void @sitofp_double_i8(i8 %a, double %b) nounwind ssp { + entry: + ; ELF64: sitofp_double_i8 ++; PPC970: sitofp_double_i8 + %b.addr = alloca double, align 8 + %conv = sitofp i8 %a to double + ; ELF64: extsb +@@ -98,6 +138,10 @@ entry: + ; ELF64: std + ; ELF64: lfd + ; ELF64: fcfid ++; PPC970: extsb ++; PPC970: std ++; PPC970: lfd ++; PPC970: fcfid + store double %conv, double* %b.addr, align 8 + ret void + } +@@ -107,11 +151,13 @@ entry: + define void @uitofp_single_i64(i64 %a, float %b) nounwind ssp { + entry: + ; ELF64: uitofp_single_i64 ++; PPC970: uitofp_single_i64 + %b.addr = alloca float, align 4 + %conv = uitofp i64 %a to float + ; ELF64: std + ; ELF64: lfd + ; ELF64: fcfidus ++; PPC970-NOT: fcfidus + store float %conv, float* %b.addr, align 4 + ret void + } +@@ -119,11 +165,14 @@ entry: + define void @uitofp_single_i32(i32 %a, float %b) nounwind ssp { + entry: + ; ELF64: uitofp_single_i32 ++; PPC970: uitofp_single_i32 + %b.addr = alloca float, align 4 + %conv = uitofp i32 %a to float + ; ELF64: std + ; ELF64: lfiwzx + ; ELF64: fcfidus ++; PPC970-NOT: lfiwzx ++; PPC970-NOT: fcfidus + store float %conv, float* %b.addr, align 4 + ret void + } +@@ -131,6 +180,7 @@ entry: + define void @uitofp_single_i16(i16 %a, float %b) nounwind ssp { + entry: + ; ELF64: uitofp_single_i16 ++; PPC970: uitofp_single_i16 + %b.addr = alloca float, align 4 + %conv = uitofp i16 %a to float + ; ELF64: rldicl {{[0-9]+}}, {{[0-9]+}}, 0, 48 +@@ -137,6 +187,11 @@ entry: + ; ELF64: std + ; ELF64: lfd + ; ELF64: fcfidus ++; PPC970: rlwinm {{[0-9]+}}, {{[0-9]+}}, 0, 16, 31 ++; PPC970: std ++; PPC970: lfd ++; PPC970: fcfid ++; PPC970: frsp + store float %conv, float* %b.addr, align 4 + ret void + } +@@ -144,6 +199,7 @@ entry: + define void @uitofp_single_i8(i8 %a) nounwind ssp { + entry: + ; ELF64: uitofp_single_i8 ++; PPC970: uitofp_single_i8 + %b.addr = alloca float, align 4 + %conv = uitofp i8 %a to float + ; ELF64: rldicl {{[0-9]+}}, {{[0-9]+}}, 0, 56 +@@ -150,6 +206,11 @@ entry: + ; ELF64: std + ; ELF64: lfd + ; ELF64: fcfidus ++; PPC970: rlwinm {{[0-9]+}}, {{[0-9]+}}, 0, 24, 31 ++; PPC970: std ++; PPC970: lfd ++; PPC970: fcfid ++; PPC970: frsp + store float %conv, float* %b.addr, align 4 + ret void + } +@@ -157,11 +218,13 @@ entry: + define void @uitofp_double_i64(i64 %a, double %b) nounwind ssp { + entry: + ; ELF64: uitofp_double_i64 ++; PPC970: uitofp_double_i64 + %b.addr = alloca double, align 8 + %conv = uitofp i64 %a to double + ; ELF64: std + ; ELF64: lfd + ; ELF64: fcfidu ++; PPC970-NOT: fcfidu + store double %conv, double* %b.addr, align 8 + ret void + } +@@ -169,11 +232,14 @@ entry: + define void @uitofp_double_i32(i32 %a, double %b) nounwind ssp { + entry: + ; ELF64: uitofp_double_i32 ++; PPC970: uitofp_double_i32 + %b.addr = alloca double, align 8 + %conv = uitofp i32 %a to double + ; ELF64: std + ; ELF64: lfiwzx + ; ELF64: fcfidu ++; PPC970-NOT: lfiwzx ++; PPC970-NOT: fcfidu + store double %conv, double* %b.addr, align 8 + ret void + } +@@ -181,6 +247,7 @@ entry: + define void @uitofp_double_i16(i16 %a, double %b) nounwind ssp { + entry: + ; ELF64: uitofp_double_i16 ++; PPC970: uitofp_double_i16 + %b.addr = alloca double, align 8 + %conv = uitofp i16 %a to double + ; ELF64: rldicl {{[0-9]+}}, {{[0-9]+}}, 0, 48 +@@ -187,6 +254,10 @@ entry: + ; ELF64: std + ; ELF64: lfd + ; ELF64: fcfidu ++; PPC970: rlwinm {{[0-9]+}}, {{[0-9]+}}, 0, 16, 31 ++; PPC970: std ++; PPC970: lfd ++; PPC970: fcfid + store double %conv, double* %b.addr, align 8 + ret void + } +@@ -194,6 +265,7 @@ entry: + define void @uitofp_double_i8(i8 %a, double %b) nounwind ssp { + entry: + ; ELF64: uitofp_double_i8 ++; PPC970: uitofp_double_i8 + %b.addr = alloca double, align 8 + %conv = uitofp i8 %a to double + ; ELF64: rldicl {{[0-9]+}}, {{[0-9]+}}, 0, 56 +@@ -200,6 +272,10 @@ entry: + ; ELF64: std + ; ELF64: lfd + ; ELF64: fcfidu ++; PPC970: rlwinm {{[0-9]+}}, {{[0-9]+}}, 0, 24, 31 ++; PPC970: std ++; PPC970: lfd ++; PPC970: fcfid + store double %conv, double* %b.addr, align 8 + ret void + } +@@ -209,11 +285,15 @@ entry: + define void @fptosi_float_i32(float %a) nounwind ssp { + entry: + ; ELF64: fptosi_float_i32 ++; PPC970: fptosi_float_i32 + %b.addr = alloca i32, align 4 + %conv = fptosi float %a to i32 + ; ELF64: fctiwz + ; ELF64: stfd + ; ELF64: lwa ++; PPC970: fctiwz ++; PPC970: stfd ++; PPC970: lwa + store i32 %conv, i32* %b.addr, align 4 + ret void + } +@@ -221,11 +301,15 @@ entry: + define void @fptosi_float_i64(float %a) nounwind ssp { + entry: + ; ELF64: fptosi_float_i64 ++; PPC970: fptosi_float_i64 + %b.addr = alloca i64, align 4 + %conv = fptosi float %a to i64 + ; ELF64: fctidz + ; ELF64: stfd + ; ELF64: ld ++; PPC970: fctidz ++; PPC970: stfd ++; PPC970: ld + store i64 %conv, i64* %b.addr, align 4 + ret void + } +@@ -233,11 +317,15 @@ entry: + define void @fptosi_double_i32(double %a) nounwind ssp { + entry: + ; ELF64: fptosi_double_i32 ++; PPC970: fptosi_double_i32 + %b.addr = alloca i32, align 8 + %conv = fptosi double %a to i32 + ; ELF64: fctiwz + ; ELF64: stfd + ; ELF64: lwa ++; PPC970: fctiwz ++; PPC970: stfd ++; PPC970: lwa + store i32 %conv, i32* %b.addr, align 8 + ret void + } +@@ -245,11 +333,15 @@ entry: + define void @fptosi_double_i64(double %a) nounwind ssp { + entry: + ; ELF64: fptosi_double_i64 ++; PPC970: fptosi_double_i64 + %b.addr = alloca i64, align 8 + %conv = fptosi double %a to i64 + ; ELF64: fctidz + ; ELF64: stfd + ; ELF64: ld ++; PPC970: fctidz ++; PPC970: stfd ++; PPC970: ld + store i64 %conv, i64* %b.addr, align 8 + ret void + } +@@ -259,11 +351,15 @@ entry: + define void @fptoui_float_i32(float %a) nounwind ssp { + entry: + ; ELF64: fptoui_float_i32 ++; PPC970: fptoui_float_i32 + %b.addr = alloca i32, align 4 + %conv = fptoui float %a to i32 + ; ELF64: fctiwuz + ; ELF64: stfd + ; ELF64: lwz ++; PPC970: fctidz ++; PPC970: stfd ++; PPC970: lwz + store i32 %conv, i32* %b.addr, align 4 + ret void + } +@@ -271,11 +367,13 @@ entry: + define void @fptoui_float_i64(float %a) nounwind ssp { + entry: + ; ELF64: fptoui_float_i64 ++; PPC970: fptoui_float_i64 + %b.addr = alloca i64, align 4 + %conv = fptoui float %a to i64 + ; ELF64: fctiduz + ; ELF64: stfd + ; ELF64: ld ++; PPC970-NOT: fctiduz + store i64 %conv, i64* %b.addr, align 4 + ret void + } +@@ -283,11 +381,15 @@ entry: + define void @fptoui_double_i32(double %a) nounwind ssp { + entry: + ; ELF64: fptoui_double_i32 ++; PPC970: fptoui_double_i32 + %b.addr = alloca i32, align 8 + %conv = fptoui double %a to i32 + ; ELF64: fctiwuz + ; ELF64: stfd + ; ELF64: lwz ++; PPC970: fctidz ++; PPC970: stfd ++; PPC970: lwz + store i32 %conv, i32* %b.addr, align 8 + ret void + } +@@ -295,11 +397,13 @@ entry: + define void @fptoui_double_i64(double %a) nounwind ssp { + entry: + ; ELF64: fptoui_double_i64 ++; PPC970: fptoui_double_i64 + %b.addr = alloca i64, align 8 + %conv = fptoui double %a to i64 + ; ELF64: fctiduz + ; ELF64: stfd + ; ELF64: ld ++; PPC970-NOT: fctiduz + store i64 %conv, i64* %b.addr, align 8 + ret void + } diff --git a/contrib/llvm/tools/clang/include/clang/Driver/Driver.h b/contrib/llvm/tools/clang/include/clang/Driver/Driver.h index 867444ea4e1..73c80860935 100644 --- a/contrib/llvm/tools/clang/include/clang/Driver/Driver.h +++ b/contrib/llvm/tools/clang/include/clang/Driver/Driver.h @@ -415,6 +415,10 @@ class Driver { bool &HadExtra); }; +/// \return True if the last defined optimization level is -Ofast. +/// And False otherwise. +bool isOptimizationLevelFast(const llvm::opt::ArgList &Args); + } // end namespace driver } // end namespace clang diff --git a/contrib/llvm/tools/clang/include/clang/Driver/ToolChain.h b/contrib/llvm/tools/clang/include/clang/Driver/ToolChain.h index 84e0b55ba5a..c212a833224 100644 --- a/contrib/llvm/tools/clang/include/clang/Driver/ToolChain.h +++ b/contrib/llvm/tools/clang/include/clang/Driver/ToolChain.h @@ -303,7 +303,7 @@ class ToolChain { /// AddFastMathRuntimeIfAvailable - If a runtime library exists that sets /// global flags for unsafe floating point math, add it and return true. /// - /// This checks for presence of the -ffast-math or -funsafe-math flags. + /// This checks for presence of the -Ofast, -ffast-math or -funsafe-math flags. virtual bool AddFastMathRuntimeIfAvailable(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const; diff --git a/contrib/llvm/tools/clang/lib/AST/ASTDumper.cpp b/contrib/llvm/tools/clang/lib/AST/ASTDumper.cpp index 2f402559f4d..670fd0ed3a9 100644 --- a/contrib/llvm/tools/clang/lib/AST/ASTDumper.cpp +++ b/contrib/llvm/tools/clang/lib/AST/ASTDumper.cpp @@ -32,12 +32,23 @@ using namespace clang::comments; namespace { // Colors used for various parts of the AST dump + // Do not use bold yellow for any text. It is hard to read on white screens. struct TerminalColor { raw_ostream::Colors Color; bool Bold; }; + // Red - CastColor + // Green - TypeColor + // Bold Green - DeclKindNameColor, UndeserializedColor + // Yellow - AddressColor, LocationColor + // Blue - CommentColor, NullColor, IndentColor + // Bold Blue - AttrColor + // Bold Magenta - StmtColor + // Cyan - ValueKindColor, ObjectKindColor + // Bold Cyan - ValueColor, DeclNameColor + // Decl kind names (VarDecl, FunctionDecl, etc) static const TerminalColor DeclKindNameColor = { raw_ostream::GREEN, true }; // Attr names (CleanupAttr, GuardedByAttr, etc) @@ -45,7 +56,7 @@ namespace { // Statement names (DeclStmt, ImplicitCastExpr, etc) static const TerminalColor StmtColor = { raw_ostream::MAGENTA, true }; // Comment names (FullComment, ParagraphComment, TextComment, etc) - static const TerminalColor CommentColor = { raw_ostream::YELLOW, true }; + static const TerminalColor CommentColor = { raw_ostream::BLUE, false }; // Type names (int, float, etc, plus user defined types) static const TerminalColor TypeColor = { raw_ostream::GREEN, false }; diff --git a/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp b/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp index 390cfe9cd23..4cac4fab847 100644 --- a/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp +++ b/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp @@ -5089,16 +5089,15 @@ bool RecordExprEvaluator::VisitCXXConstructExpr(const CXXConstructExpr *E) { if (!Result.isUninit()) return true; - if (ZeroInit) - return ZeroInitialization(E); - - const CXXRecordDecl *RD = FD->getParent(); - if (RD->isUnion()) - Result = APValue((FieldDecl*)0); - else - Result = APValue(APValue::UninitStruct(), RD->getNumBases(), - std::distance(RD->field_begin(), RD->field_end())); - return true; + // We can get here in two different ways: + // 1) We're performing value-initialization, and should zero-initialize + // the object, or + // 2) We're performing default-initialization of an object with a trivial + // constexpr default constructor, in which case we should start the + // lifetimes of all the base subobjects (there can be no data member + // subobjects in this case) per [basic.life]p1. + // Either way, ZeroInitialization is appropriate. + return ZeroInitialization(E); } const FunctionDecl *Definition = 0; @@ -5578,19 +5577,9 @@ bool ArrayExprEvaluator::VisitCXXConstructExpr(const CXXConstructExpr *E, if (HadZeroInit) return true; - if (ZeroInit) { - ImplicitValueInitExpr VIE(Type); - return EvaluateInPlace(*Value, Info, Subobject, &VIE); - } - - const CXXRecordDecl *RD = FD->getParent(); - if (RD->isUnion()) - *Value = APValue((FieldDecl*)0); - else - *Value = - APValue(APValue::UninitStruct(), RD->getNumBases(), - std::distance(RD->field_begin(), RD->field_end())); - return true; + // See RecordExprEvaluator::VisitCXXConstructExpr for explanation. + ImplicitValueInitExpr VIE(Type); + return EvaluateInPlace(*Value, Info, Subobject, &VIE); } const FunctionDecl *Definition = 0; diff --git a/contrib/llvm/tools/clang/lib/AST/StmtPrinter.cpp b/contrib/llvm/tools/clang/lib/AST/StmtPrinter.cpp index 0ecb5b52c24..ae2cdf75746 100644 --- a/contrib/llvm/tools/clang/lib/AST/StmtPrinter.cpp +++ b/contrib/llvm/tools/clang/lib/AST/StmtPrinter.cpp @@ -709,9 +709,11 @@ void StmtPrinter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *Node) { void StmtPrinter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node) { if (Node->isSuperReceiver()) OS << "super."; - else if (Node->getBase()) { + else if (Node->isObjectReceiver() && Node->getBase()) { PrintExpr(Node->getBase()); OS << "."; + } else if (Node->isClassReceiver() && Node->getClassReceiver()) { + OS << Node->getClassReceiver()->getName() << "."; } if (Node->isImplicitProperty()) diff --git a/contrib/llvm/tools/clang/lib/Analysis/Consumed.cpp b/contrib/llvm/tools/clang/lib/Analysis/Consumed.cpp index b33c8d8930f..e5ec3e6b927 100644 --- a/contrib/llvm/tools/clang/lib/Analysis/Consumed.cpp +++ b/contrib/llvm/tools/clang/lib/Analysis/Consumed.cpp @@ -605,13 +605,25 @@ void ConsumedStmtVisitor::VisitBinaryOperator(const BinaryOperator *BinOp) { } } +static bool isStdNamespace(const DeclContext *DC) { + if (!DC->isNamespace()) return false; + while (DC->getParent()->isNamespace()) + DC = DC->getParent(); + const NamespaceDecl *ND = dyn_cast(DC); + + return ND && ND->getName() == "std" && + ND->getDeclContext()->isTranslationUnit(); +} + void ConsumedStmtVisitor::VisitCallExpr(const CallExpr *Call) { if (const FunctionDecl *FunDecl = dyn_cast_or_null(Call->getDirectCallee())) { // Special case for the std::move function. // TODO: Make this more specific. (Deferred) - if (FunDecl->getNameAsString() == "move") { + if (Call->getNumArgs() == 1 && + FunDecl->getNameAsString() == "move" && + isStdNamespace(FunDecl->getDeclContext())) { forwardInfo(Call->getArg(0), Call); return; } diff --git a/contrib/llvm/tools/clang/lib/Basic/Targets.cpp b/contrib/llvm/tools/clang/lib/Basic/Targets.cpp index af9221b7955..b538792d452 100644 --- a/contrib/llvm/tools/clang/lib/Basic/Targets.cpp +++ b/contrib/llvm/tools/clang/lib/Basic/Targets.cpp @@ -358,6 +358,16 @@ class LinuxTargetInfo : public OSTargetInfo { LinuxTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { this->UserLabelPrefix = ""; this->WIntType = TargetInfo::UnsignedInt; + + switch (Triple.getArch()) { + default: + break; + case llvm::Triple::ppc: + case llvm::Triple::ppc64: + case llvm::Triple::ppc64le: + this->MCountName = "_mcount"; + break; + } } virtual const char *getStaticInitSectionSpecifier() const { @@ -1271,7 +1281,7 @@ class DarwinPPC32TargetInfo : LongLongAlign = 32; SuitableAlign = 128; DescriptionString = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-" - "i64:32:64-f32:32:32-f64:64:64-v128:128:128-n32"; + "i64:32:64-f32:32:32-f64:32:64-v128:128:128-n32"; } virtual BuiltinVaListKind getBuiltinVaListKind() const { return TargetInfo::CharPtrBuiltinVaList; diff --git a/contrib/llvm/tools/clang/lib/Basic/Version.cpp b/contrib/llvm/tools/clang/lib/Basic/Version.cpp index 17a8e35869f..bc098803563 100644 --- a/contrib/llvm/tools/clang/lib/Basic/Version.cpp +++ b/contrib/llvm/tools/clang/lib/Basic/Version.cpp @@ -36,7 +36,7 @@ std::string getClangRepositoryPath() { // If the SVN_REPOSITORY is empty, try to use the SVN keyword. This helps us // pick up a tag in an SVN export, for example. - StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_34/final/lib/Basic/Version.cpp $"); + StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_34/dot1-final/lib/Basic/Version.cpp $"); if (URL.empty()) { URL = SVNRepository.slice(SVNRepository.find(':'), SVNRepository.find("/lib/Basic")); diff --git a/contrib/llvm/tools/clang/lib/Driver/Driver.cpp b/contrib/llvm/tools/clang/lib/Driver/Driver.cpp index 49beb93e32f..1c76509bbe6 100644 --- a/contrib/llvm/tools/clang/lib/Driver/Driver.cpp +++ b/contrib/llvm/tools/clang/lib/Driver/Driver.cpp @@ -2055,3 +2055,7 @@ std::pair Driver::getIncludeExcludeOptionFlagMasks() const { return std::make_pair(IncludedFlagsBitmask, ExcludedFlagsBitmask); } + +bool clang::driver::isOptimizationLevelFast(const llvm::opt::ArgList &Args) { + return Args.hasFlag(options::OPT_Ofast, options::OPT_O_Group, false); +} diff --git a/contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp b/contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp index efd3945b3dd..36aae33ec83 100644 --- a/contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp +++ b/contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp @@ -430,16 +430,19 @@ void ToolChain::AddCCKextLibArgs(const ArgList &Args, bool ToolChain::AddFastMathRuntimeIfAvailable(const ArgList &Args, ArgStringList &CmdArgs) const { - // Check if -ffast-math or -funsafe-math is enabled. - Arg *A = Args.getLastArg(options::OPT_ffast_math, - options::OPT_fno_fast_math, - options::OPT_funsafe_math_optimizations, - options::OPT_fno_unsafe_math_optimizations); - - if (!A || A->getOption().getID() == options::OPT_fno_fast_math || - A->getOption().getID() == options::OPT_fno_unsafe_math_optimizations) - return false; + // Do not check for -fno-fast-math or -fno-unsafe-math when -Ofast passed + // (to keep the linker options consistent with gcc and clang itself). + if (!isOptimizationLevelFast(Args)) { + // Check if -ffast-math or -funsafe-math. + Arg *A = + Args.getLastArg(options::OPT_ffast_math, options::OPT_fno_fast_math, + options::OPT_funsafe_math_optimizations, + options::OPT_fno_unsafe_math_optimizations); + if (!A || A->getOption().getID() == options::OPT_fno_fast_math || + A->getOption().getID() == options::OPT_fno_unsafe_math_optimizations) + return false; + } // If crtfastmath.o exists add it to the arguments. std::string Path = GetFilePath("crtfastmath.o"); if (Path == "crtfastmath.o") // Not found. diff --git a/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp b/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp index d98c6546311..b568593a411 100644 --- a/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp +++ b/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp @@ -1650,6 +1650,21 @@ bool Generic_GCC::isPICDefaultForced() const { return false; } +void Generic_GCC::addClangTargetOptions(const ArgList &DriverArgs, + ArgStringList &CC1Args) const { + const Generic_GCC::GCCVersion &V = GCCInstallation.getVersion(); + bool UseInitArrayDefault = + getTriple().getArch() == llvm::Triple::aarch64 || + (getTriple().getOS() == llvm::Triple::Linux && ( + !V.isOlderThan(4, 7, 0) || + getTriple().getEnvironment() == llvm::Triple::Android)); + + if (DriverArgs.hasFlag(options::OPT_fuse_init_array, + options::OPT_fno_use_init_array, + UseInitArrayDefault)) + CC1Args.push_back("-fuse-init-array"); +} + /// Hexagon Toolchain std::string Hexagon_TC::GetGnuDir(const std::string &InstalledDir) { @@ -2566,19 +2581,6 @@ Tool *Linux::buildAssembler() const { return new tools::gnutools::Assemble(*this); } -void Linux::addClangTargetOptions(const ArgList &DriverArgs, - ArgStringList &CC1Args) const { - const Generic_GCC::GCCVersion &V = GCCInstallation.getVersion(); - bool UseInitArrayDefault = - !V.isOlderThan(4, 7, 0) || - getTriple().getArch() == llvm::Triple::aarch64 || - getTriple().getEnvironment() == llvm::Triple::Android; - if (DriverArgs.hasFlag(options::OPT_fuse_init_array, - options::OPT_fno_use_init_array, - UseInitArrayDefault)) - CC1Args.push_back("-fuse-init-array"); -} - std::string Linux::computeSysRoot() const { if (!getDriver().SysRoot.empty()) return getDriver().SysRoot; diff --git a/contrib/llvm/tools/clang/lib/Driver/ToolChains.h b/contrib/llvm/tools/clang/lib/Driver/ToolChains.h index ba794a7c207..50e745a8f92 100644 --- a/contrib/llvm/tools/clang/lib/Driver/ToolChains.h +++ b/contrib/llvm/tools/clang/lib/Driver/ToolChains.h @@ -164,6 +164,8 @@ class LLVM_LIBRARY_VISIBILITY Generic_GCC : public ToolChain { virtual bool isPICDefault() const; virtual bool isPIEDefault() const; virtual bool isPICDefaultForced() const; + virtual void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args) const; protected: virtual Tool *getTool(Action::ActionClass AC) const; @@ -584,8 +586,6 @@ class LLVM_LIBRARY_VISIBILITY Linux : public Generic_ELF { virtual void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const; - virtual void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const; virtual void AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const; diff --git a/contrib/llvm/tools/clang/lib/Driver/Tools.cpp b/contrib/llvm/tools/clang/lib/Driver/Tools.cpp index 83ce2afd247..8b68869bdd9 100644 --- a/contrib/llvm/tools/clang/lib/Driver/Tools.cpp +++ b/contrib/llvm/tools/clang/lib/Driver/Tools.cpp @@ -2003,13 +2003,6 @@ static void SplitDebugInfo(const ToolChain &TC, Compilation &C, C.addCommand(new Command(JA, T, Exec, StripArgs)); } -static bool isOptimizationLevelFast(const ArgList &Args) { - if (Arg *A = Args.getLastArg(options::OPT_O_Group)) - if (A->getOption().matches(options::OPT_Ofast)) - return true; - return false; -} - /// \brief Vectorize at all optimization levels greater than 1 except for -Oz. static bool shouldEnableVectorizerAtOLevel(const ArgList &Args) { if (Arg *A = Args.getLastArg(options::OPT_O_Group)) { @@ -4621,8 +4614,14 @@ void darwin::Assemble::ConstructJob(Compilation &C, const JobAction &JA, // If -no_integrated_as is used add -Q to the darwin assember driver to make // sure it runs its system assembler not clang's integrated assembler. - if (Args.hasArg(options::OPT_no_integrated_as)) - CmdArgs.push_back("-Q"); + // Applicable to darwin11+ and Xcode 4+. darwin<10 lacked integrated-as. + // FIXME: at run-time detect assembler capabilities or rely on version + // information forwarded by -target-assembler-version (future) + if (Args.hasArg(options::OPT_no_integrated_as)) { + const llvm::Triple& t(getToolChain().getTriple()); + if (!(t.isMacOSX() && t.isMacOSXVersionLT(10, 7))) + CmdArgs.push_back("-Q"); + } // Forward -g, assuming we are dealing with an actual assembly file. if (SourceAction->getType() == types::TY_Asm || diff --git a/contrib/llvm/tools/clang/lib/Headers/xmmintrin.h b/contrib/llvm/tools/clang/lib/Headers/xmmintrin.h index c68d3ed7b67..f6305fb999a 100644 --- a/contrib/llvm/tools/clang/lib/Headers/xmmintrin.h +++ b/contrib/llvm/tools/clang/lib/Headers/xmmintrin.h @@ -903,7 +903,7 @@ _mm_cvtps_pi16(__m128 __a) __a = _mm_movehl_ps(__a, __a); __c = _mm_cvtps_pi32(__a); - return _mm_packs_pi16(__b, __c); + return _mm_packs_pi32(__b, __c); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) diff --git a/contrib/llvm/tools/clang/lib/Sema/SemaExprCXX.cpp b/contrib/llvm/tools/clang/lib/Sema/SemaExprCXX.cpp index 07e465766b7..20118b57126 100644 --- a/contrib/llvm/tools/clang/lib/Sema/SemaExprCXX.cpp +++ b/contrib/llvm/tools/clang/lib/Sema/SemaExprCXX.cpp @@ -5836,17 +5836,16 @@ static inline bool VariableCanNeverBeAConstantExpression(VarDecl *Var, assert(DefVD); if (DefVD->isWeak()) return false; EvaluatedStmt *Eval = DefVD->ensureEvaluatedStmt(); - + Expr *Init = cast(Eval->Value); if (Var->getType()->isDependentType() || Init->isValueDependent()) { - if (!Init->isValueDependent()) - return !DefVD->checkInitIsICE(); - // FIXME: We might still be able to do some analysis of Init here - // to conclude that even in a dependent setting, Init can never - // be a constexpr - but for now admit agnosticity. + // FIXME: Teach the constant evaluator to deal with the non-dependent parts + // of value-dependent expressions, and use it here to determine whether the + // initializer is a potential constant expression. return false; - } + } + return !IsVariableAConstantExpression(Var, Context); } diff --git a/contrib/llvm/tools/lldb/tools/driver/Platform.h b/contrib/llvm/tools/lldb/tools/driver/Platform.h index faa2991bf6f..87b1d171a82 100644 --- a/contrib/llvm/tools/lldb/tools/driver/Platform.h +++ b/contrib/llvm/tools/lldb/tools/driver/Platform.h @@ -101,12 +101,6 @@ #include #include - #if defined(__FreeBSD__) - #include - #else - #include - #endif - #endif #endif // lldb_Platform_h_ diff --git a/contrib/openbsm/libbsm/bsm_io.c b/contrib/openbsm/libbsm/bsm_io.c index 85fab590b40..44c3b351eb1 100644 --- a/contrib/openbsm/libbsm/bsm_io.c +++ b/contrib/openbsm/libbsm/bsm_io.c @@ -949,7 +949,7 @@ print_header32_tok(FILE *fp, tokenstr_t *tok, char *del, int oflags) { print_tok_type(fp, tok->id, "header", oflags); - if (oflags & AU_OFLAG_RAW) { + if (oflags & AU_OFLAG_XML) { open_attr(fp, "version"); print_1_byte(fp, tok->tt.hdr32.version, "%u"); close_attr(fp); diff --git a/contrib/openpam/lib/libpam/openpam_configure.c b/contrib/openpam/lib/libpam/openpam_configure.c index 1a43dc799da..4e3de577dcd 100644 --- a/contrib/openpam/lib/libpam/openpam_configure.c +++ b/contrib/openpam/lib/libpam/openpam_configure.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2001-2003 Networks Associates Technology, Inc. - * Copyright (c) 2004-2012 Dag-Erling Smørgrav + * Copyright (c) 2004-2014 Dag-Erling Smørgrav * All rights reserved. * * This software was developed for the FreeBSD Project by ThinkSec AS and @@ -193,6 +193,7 @@ openpam_parse_chain(pam_handle_t *pamh, openpam_log(PAM_LOG_ERROR, "%s(%d): missing or invalid facility", filename, lineno); + errno = EINVAL; goto fail; } if (facility != fclt && facility != PAM_FACILITY_ANY) { @@ -208,18 +209,28 @@ openpam_parse_chain(pam_handle_t *pamh, openpam_log(PAM_LOG_ERROR, "%s(%d): missing or invalid service name", filename, lineno); + errno = EINVAL; goto fail; } if (wordv[i] != NULL) { openpam_log(PAM_LOG_ERROR, "%s(%d): garbage at end of line", filename, lineno); + errno = EINVAL; goto fail; } ret = openpam_load_chain(pamh, servicename, fclt); FREEV(wordc, wordv); - if (ret < 0) + if (ret < 0) { + /* + * Bogus errno, but this ensures that the + * outer loop does not just ignore the + * error and keep searching. + */ + if (errno == ENOENT) + errno = EINVAL; goto fail; + } continue; } @@ -229,6 +240,7 @@ openpam_parse_chain(pam_handle_t *pamh, openpam_log(PAM_LOG_ERROR, "%s(%d): missing or invalid control flag", filename, lineno); + errno = EINVAL; goto fail; } @@ -238,6 +250,7 @@ openpam_parse_chain(pam_handle_t *pamh, openpam_log(PAM_LOG_ERROR, "%s(%d): missing or invalid module name", filename, lineno); + errno = EINVAL; goto fail; } @@ -247,8 +260,11 @@ openpam_parse_chain(pam_handle_t *pamh, this->flag = ctlf; /* load module */ - if ((this->module = openpam_load_module(modulename)) == NULL) + if ((this->module = openpam_load_module(modulename)) == NULL) { + if (errno == ENOENT) + errno = ENOEXEC; goto fail; + } /* * The remaining items in wordv are the module's @@ -281,7 +297,11 @@ openpam_parse_chain(pam_handle_t *pamh, * The loop ended because openpam_readword() returned NULL, which * can happen for four different reasons: an I/O error (ferror(f) * is true), a memory allocation failure (ferror(f) is false, - * errno is non-zero) + * feof(f) is false, errno is non-zero), the file ended with an + * unterminated quote or backslash escape (ferror(f) is false, + * feof(f) is true, errno is non-zero), or the end of the file was + * reached without error (ferror(f) is false, feof(f) is true, + * errno is zero). */ if (ferror(f) || errno != 0) goto syserr; @@ -402,6 +422,9 @@ openpam_load_chain(pam_handle_t *pamh, } ret = openpam_load_file(pamh, service, facility, filename, style); + /* success */ + if (ret > 0) + RETURNN(ret); /* the file exists, but an error occurred */ if (ret == -1 && errno != ENOENT) RETURNN(ret); @@ -411,7 +434,8 @@ openpam_load_chain(pam_handle_t *pamh, } /* no hit */ - RETURNN(0); + errno = ENOENT; + RETURNN(-1); } /* @@ -432,8 +456,10 @@ openpam_configure(pam_handle_t *pamh, openpam_log(PAM_LOG_ERROR, "invalid service name"); RETURNC(PAM_SYSTEM_ERR); } - if (openpam_load_chain(pamh, service, PAM_FACILITY_ANY) < 0) - goto load_err; + if (openpam_load_chain(pamh, service, PAM_FACILITY_ANY) < 0) { + if (errno != ENOENT) + goto load_err; + } for (fclt = 0; fclt < PAM_NUM_FACILITIES; ++fclt) { if (pamh->chains[fclt] != NULL) continue; diff --git a/contrib/sendmail/CACerts b/contrib/sendmail/CACerts index 263e27bc6ea..618c3dcfee2 100644 --- a/contrib/sendmail/CACerts +++ b/contrib/sendmail/CACerts @@ -1,4 +1,4 @@ -# $Id: CACerts,v 8.6 2013/01/18 15:14:17 ca Exp $ +# $Id: CACerts,v 8.6 2013-01-18 15:14:17 ca Exp $ # This file contains some CA certificates that are used to sign the # certificates of mail servers of members of the sendmail consortium # who may reply to questions etc sent to sendmail.org. diff --git a/contrib/sendmail/FAQ b/contrib/sendmail/FAQ index f8c2e8409ce..4bab6b4c870 100644 --- a/contrib/sendmail/FAQ +++ b/contrib/sendmail/FAQ @@ -5,4 +5,4 @@ A plain-text version of the questions only, with URLs referring to the answers, is posted to comp.mail.sendmail on the 10th and 25th of each month. -$Revision: 8.24 $, Last updated $Date: 1999/02/07 03:21:03 $ +$Revision: 8.24 $, Last updated $Date: 1999-02-07 03:21:03 $ diff --git a/contrib/sendmail/FREEBSD-upgrade b/contrib/sendmail/FREEBSD-upgrade index 7f403eb7a16..57426e23b7c 100644 --- a/contrib/sendmail/FREEBSD-upgrade +++ b/contrib/sendmail/FREEBSD-upgrade @@ -1,6 +1,6 @@ $FreeBSD$ -sendmail 8.14.8 +sendmail 8.14.9 originals can be found at: ftp://ftp.sendmail.org/pub/sendmail/ For the import of sendmail, the following directories were renamed: @@ -97,4 +97,4 @@ infrastructure in FreeBSD: usr.sbin/mailwrapper/Makefile gshapiro@FreeBSD.org -26-January-2014 +21-May-2014 diff --git a/contrib/sendmail/INSTALL b/contrib/sendmail/INSTALL index 4337389fa69..1f76d77e64b 100644 --- a/contrib/sendmail/INSTALL +++ b/contrib/sendmail/INSTALL @@ -43,4 +43,4 @@ sendmail/SECURITY for more installation information. in case you are now using a different (and thereby incompatible) version of Berkeley DB. -$Revision: 8.16 $, Last updated $Date: 2007/10/03 21:00:28 $ +$Revision: 8.16 $, Last updated $Date: 2007-10-03 21:00:28 $ diff --git a/contrib/sendmail/KNOWNBUGS b/contrib/sendmail/KNOWNBUGS index 5b7918cef55..fb5e44e2d32 100644 --- a/contrib/sendmail/KNOWNBUGS +++ b/contrib/sendmail/KNOWNBUGS @@ -266,4 +266,4 @@ Kresolve sequence dnsmx canon be used if set instead of LOCAL_RELAY ($R). This will be fixed in a future version. -$Revision: 8.61 $, Last updated $Date: 2011/04/07 17:48:23 $ +$Revision: 8.61 $, Last updated $Date: 2011-04-07 17:48:23 $ diff --git a/contrib/sendmail/LICENSE b/contrib/sendmail/LICENSE index 62f53f7611f..b0885930cc0 100644 --- a/contrib/sendmail/LICENSE +++ b/contrib/sendmail/LICENSE @@ -35,7 +35,7 @@ each of the following conditions is met: forth as paragraph 6 below, in the documentation and/or other materials provided with the distribution. For the purposes of binary distribution the "Copyright Notice" refers to the following language: - "Copyright (c) 1998-2013 Proofpoint, Inc. All rights reserved." + "Copyright (c) 1998-2014 Proofpoint, Inc. All rights reserved." 4. Neither the name of Proofpoint, Inc. nor the University of California nor names of their contributors may be used to endorse or promote @@ -78,4 +78,4 @@ each of the following conditions is met: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -$Revision: 8.22 $, Last updated $Date: 2013/11/23 04:37:36 $, Document 139848.1 +$Revision: 8.23 $, Last updated $Date: 2014-01-26 20:10:01 $, Document 139848.1 diff --git a/contrib/sendmail/Makefile b/contrib/sendmail/Makefile index 97b2afc54c5..daf20f288f8 100644 --- a/contrib/sendmail/Makefile +++ b/contrib/sendmail/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile.dist,v 8.15 2001/08/23 20:44:39 ca Exp $ +# $Id: Makefile.dist,v 8.15 2001-08-23 20:44:39 ca Exp $ SHELL= /bin/sh SUBDIRS= libsm libsmutil libsmdb sendmail editmap mail.local \ diff --git a/contrib/sendmail/PGPKEYS b/contrib/sendmail/PGPKEYS index e24ea3e35a7..eb77d9cfa79 100644 --- a/contrib/sendmail/PGPKEYS +++ b/contrib/sendmail/PGPKEYS @@ -2613,4 +2613,4 @@ DnF3FZZEzV7oqPwC2jzv/1dD6GFhtgy0cnyoPGUJCyc= =nES8 -----END PGP PUBLIC KEY BLOCK----- -$Revision: 8.46 $, Last updated $Date: 2014/01/18 00:20:24 $ +$Revision: 8.46 $, Last updated $Date: 2014-01-18 00:20:24 $ diff --git a/contrib/sendmail/README b/contrib/sendmail/README index 8ff804bf21d..56f4c59ecc4 100644 --- a/contrib/sendmail/README +++ b/contrib/sendmail/README @@ -465,4 +465,4 @@ sendmail Source for the sendmail program itself. test Some test scripts (currently only for compilation aids). vacation Source for the vacation program. NOT PART OF SENDMAIL! -$Revision: 8.96 $, Last updated $Date: 2013/11/22 20:51:01 $ +$Revision: 8.96 $, Last updated $Date: 2013-11-22 20:51:01 $ diff --git a/contrib/sendmail/RELEASE_NOTES b/contrib/sendmail/RELEASE_NOTES index 77b70580b44..f581712635e 100644 --- a/contrib/sendmail/RELEASE_NOTES +++ b/contrib/sendmail/RELEASE_NOTES @@ -1,11 +1,20 @@ SENDMAIL RELEASE NOTES - $Id: RELEASE_NOTES,v 8.2043 2014/01/23 20:27:19 ca Exp $ This listing shows the version of the sendmail binary, the version of the sendmail configuration files, the date of release, and a summary of the changes in that release. +8.14.9/8.14.9 2014/05/21 + SECURITY: Properly set the close-on-exec flag for file descriptors + (except stdin, stdout, and stderr) before executing mailers. + Fix a misformed comment in conf.c: "/*" within comment + which may cause a compilation error on some systems. + Problem reported by John Beck of Oracle. + DEVTOOLS: Fix regression in auto-detection of libraries when only + shared libraries are available. Problem reported by + Bryan Costales. + 8.14.8/8.14.8 2014/01/26 Properly initialize all OpenSSL algorithms for versions before OpenSSL 0.9.8o. Without this SHA2 algorithms may not diff --git a/contrib/sendmail/cf/README b/contrib/sendmail/cf/README index dbff3de1ae3..b26c99c6aaf 100644 --- a/contrib/sendmail/cf/README +++ b/contrib/sendmail/cf/README @@ -4704,4 +4704,4 @@ M4 DIVERSIONS 8 DNS based blacklists 9 special local rulesets (1 and 2) -$Revision: 8.730 $, Last updated $Date: 2014/01/16 15:55:51 $ +$Revision: 8.730 $, Last updated $Date: 2014-01-16 15:55:51 $ diff --git a/contrib/sendmail/cf/cf/Makefile b/contrib/sendmail/cf/cf/Makefile index 2b0f4b307a3..00b75a8a0ca 100644 --- a/contrib/sendmail/cf/cf/Makefile +++ b/contrib/sendmail/cf/cf/Makefile @@ -1,7 +1,7 @@ # # Makefile for configuration files. # -# $Id: Makefile,v 8.60 2005/06/14 02:16:34 gshapiro Exp $ +# $Id: Makefile,v 8.60 2005-06-14 02:16:34 gshapiro Exp $ # # diff --git a/contrib/sendmail/cf/cf/README b/contrib/sendmail/cf/cf/README index d0ac86559d6..7988ddeb0b9 100644 --- a/contrib/sendmail/cf/cf/README +++ b/contrib/sendmail/cf/cf/README @@ -31,4 +31,4 @@ The name of the source file for "submit.cf" can be overridden by For more details see Makefile. -$Revision: 1.2 $, Last updated $Date: 2002/02/22 00:33:54 $ +$Revision: 1.2 $, Last updated $Date: 2002-02-22 00:33:54 $ diff --git a/contrib/sendmail/cf/cf/chez.cs.mc b/contrib/sendmail/cf/cf/chez.cs.mc index 9eeb3f6221d..9b0080f81fa 100644 --- a/contrib/sendmail/cf/cf/chez.cs.mc +++ b/contrib/sendmail/cf/cf/chez.cs.mc @@ -24,7 +24,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: chez.cs.mc,v 8.15 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: chez.cs.mc,v 8.15 2013-11-22 20:51:08 ca Exp $') OSTYPE(bsd4.4)dnl DOMAIN(CS.Berkeley.EDU)dnl define(`LOCAL_RELAY', vangogh.CS.Berkeley.EDU)dnl diff --git a/contrib/sendmail/cf/cf/clientproto.mc b/contrib/sendmail/cf/cf/clientproto.mc index 7aab2e4f51c..d2a8dee4069 100644 --- a/contrib/sendmail/cf/cf/clientproto.mc +++ b/contrib/sendmail/cf/cf/clientproto.mc @@ -23,7 +23,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: clientproto.mc,v 8.17 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: clientproto.mc,v 8.17 2013-11-22 20:51:08 ca Exp $') OSTYPE(unknown) FEATURE(nullclient, mailhost.$m) diff --git a/contrib/sendmail/cf/cf/cs-hpux10.mc b/contrib/sendmail/cf/cf/cs-hpux10.mc index 5c512323efb..b7430cb687a 100644 --- a/contrib/sendmail/cf/cf/cs-hpux10.mc +++ b/contrib/sendmail/cf/cf/cs-hpux10.mc @@ -23,7 +23,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: cs-hpux10.mc,v 8.14 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: cs-hpux10.mc,v 8.14 2013-11-22 20:51:08 ca Exp $') OSTYPE(hpux10)dnl DOMAIN(CS.Berkeley.EDU)dnl define(`MAIL_HUB', mailspool.CS.Berkeley.EDU)dnl diff --git a/contrib/sendmail/cf/cf/cs-hpux9.mc b/contrib/sendmail/cf/cf/cs-hpux9.mc index 806901fc65b..57197fe861a 100644 --- a/contrib/sendmail/cf/cf/cs-hpux9.mc +++ b/contrib/sendmail/cf/cf/cs-hpux9.mc @@ -23,7 +23,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: cs-hpux9.mc,v 8.15 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: cs-hpux9.mc,v 8.15 2013-11-22 20:51:08 ca Exp $') OSTYPE(hpux9)dnl DOMAIN(CS.Berkeley.EDU)dnl define(`MAIL_HUB', mailspool.CS.Berkeley.EDU)dnl diff --git a/contrib/sendmail/cf/cf/cs-osf1.mc b/contrib/sendmail/cf/cf/cs-osf1.mc index f5c3446983a..5d2956bbb9f 100644 --- a/contrib/sendmail/cf/cf/cs-osf1.mc +++ b/contrib/sendmail/cf/cf/cs-osf1.mc @@ -23,7 +23,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: cs-osf1.mc,v 8.14 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: cs-osf1.mc,v 8.14 2013-11-22 20:51:08 ca Exp $') OSTYPE(osf1)dnl DOMAIN(CS.Berkeley.EDU)dnl MAILER(local)dnl diff --git a/contrib/sendmail/cf/cf/cs-solaris2.mc b/contrib/sendmail/cf/cf/cs-solaris2.mc index 624180984cd..25cc333a977 100644 --- a/contrib/sendmail/cf/cf/cs-solaris2.mc +++ b/contrib/sendmail/cf/cf/cs-solaris2.mc @@ -23,7 +23,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: cs-solaris2.mc,v 8.13 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: cs-solaris2.mc,v 8.13 2013-11-22 20:51:08 ca Exp $') OSTYPE(solaris2)dnl DOMAIN(CS.Berkeley.EDU)dnl MAILER(local)dnl diff --git a/contrib/sendmail/cf/cf/cs-sunos4.1.mc b/contrib/sendmail/cf/cf/cs-sunos4.1.mc index 92798a08166..1d8162b2960 100644 --- a/contrib/sendmail/cf/cf/cs-sunos4.1.mc +++ b/contrib/sendmail/cf/cf/cs-sunos4.1.mc @@ -23,7 +23,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: cs-sunos4.1.mc,v 8.14 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: cs-sunos4.1.mc,v 8.14 2013-11-22 20:51:08 ca Exp $') OSTYPE(sunos4.1)dnl DOMAIN(CS.Berkeley.EDU)dnl MAILER(local)dnl diff --git a/contrib/sendmail/cf/cf/cs-ultrix4.mc b/contrib/sendmail/cf/cf/cs-ultrix4.mc index ababfd797a5..2cdf067290a 100644 --- a/contrib/sendmail/cf/cf/cs-ultrix4.mc +++ b/contrib/sendmail/cf/cf/cs-ultrix4.mc @@ -23,7 +23,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: cs-ultrix4.mc,v 8.14 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: cs-ultrix4.mc,v 8.14 2013-11-22 20:51:08 ca Exp $') OSTYPE(ultrix4)dnl DOMAIN(CS.Berkeley.EDU)dnl MAILER(local)dnl diff --git a/contrib/sendmail/cf/cf/cyrusproto.mc b/contrib/sendmail/cf/cf/cyrusproto.mc index 8fa00ceee8f..94460c12f6a 100644 --- a/contrib/sendmail/cf/cf/cyrusproto.mc +++ b/contrib/sendmail/cf/cf/cyrusproto.mc @@ -27,7 +27,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: cyrusproto.mc,v 8.7 1999/09/07 14:57:10 ca Exp $') +VERSIONID(`$Id: cyrusproto.mc,v 8.7 1999-09-07 14:57:10 ca Exp $') define(`confBIND_OPTS',`-DNSRCH -DEFNAMES') define(`confLOCAL_MAILER', `cyrus') FEATURE(`nocanonify') diff --git a/contrib/sendmail/cf/cf/generic-bsd4.4.mc b/contrib/sendmail/cf/cf/generic-bsd4.4.mc index dd2dd3a9c16..3d1a162786a 100644 --- a/contrib/sendmail/cf/cf/generic-bsd4.4.mc +++ b/contrib/sendmail/cf/cf/generic-bsd4.4.mc @@ -21,7 +21,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: generic-bsd4.4.mc,v 8.11 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: generic-bsd4.4.mc,v 8.11 2013-11-22 20:51:08 ca Exp $') OSTYPE(bsd4.4)dnl DOMAIN(generic)dnl MAILER(local)dnl diff --git a/contrib/sendmail/cf/cf/generic-hpux10.mc b/contrib/sendmail/cf/cf/generic-hpux10.mc index 1ddd01e92c8..1f1c257861d 100644 --- a/contrib/sendmail/cf/cf/generic-hpux10.mc +++ b/contrib/sendmail/cf/cf/generic-hpux10.mc @@ -20,7 +20,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: generic-hpux10.mc,v 8.14 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: generic-hpux10.mc,v 8.14 2013-11-22 20:51:08 ca Exp $') OSTYPE(hpux10)dnl DOMAIN(generic)dnl MAILER(local)dnl diff --git a/contrib/sendmail/cf/cf/generic-hpux9.mc b/contrib/sendmail/cf/cf/generic-hpux9.mc index 29d41ff6f5b..2eb0366365d 100644 --- a/contrib/sendmail/cf/cf/generic-hpux9.mc +++ b/contrib/sendmail/cf/cf/generic-hpux9.mc @@ -20,7 +20,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: generic-hpux9.mc,v 8.12 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: generic-hpux9.mc,v 8.12 2013-11-22 20:51:08 ca Exp $') OSTYPE(hpux9)dnl DOMAIN(generic)dnl MAILER(local)dnl diff --git a/contrib/sendmail/cf/cf/generic-linux.mc b/contrib/sendmail/cf/cf/generic-linux.mc index 9e7a367822f..f4327c5034f 100644 --- a/contrib/sendmail/cf/cf/generic-linux.mc +++ b/contrib/sendmail/cf/cf/generic-linux.mc @@ -20,7 +20,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: generic-linux.mc,v 8.2 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: generic-linux.mc,v 8.2 2013-11-22 20:51:08 ca Exp $') OSTYPE(linux)dnl DOMAIN(generic)dnl MAILER(local)dnl diff --git a/contrib/sendmail/cf/cf/generic-mpeix.mc b/contrib/sendmail/cf/cf/generic-mpeix.mc index ec1d07bb4ad..a376a121aa9 100644 --- a/contrib/sendmail/cf/cf/generic-mpeix.mc +++ b/contrib/sendmail/cf/cf/generic-mpeix.mc @@ -17,7 +17,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: generic-mpeix.mc,v 8.2 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: generic-mpeix.mc,v 8.2 2013-11-22 20:51:08 ca Exp $') OSTYPE(mpeix)dnl DOMAIN(generic)dnl define(`confFORWARD_PATH', `$z/.forward')dnl diff --git a/contrib/sendmail/cf/cf/generic-nextstep3.3.mc b/contrib/sendmail/cf/cf/generic-nextstep3.3.mc index 6b8ad2fef96..be98e7866eb 100644 --- a/contrib/sendmail/cf/cf/generic-nextstep3.3.mc +++ b/contrib/sendmail/cf/cf/generic-nextstep3.3.mc @@ -20,7 +20,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: generic-nextstep3.3.mc,v 8.11 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: generic-nextstep3.3.mc,v 8.11 2013-11-22 20:51:08 ca Exp $') OSTYPE(nextstep)dnl DOMAIN(generic)dnl MAILER(local)dnl diff --git a/contrib/sendmail/cf/cf/generic-osf1.mc b/contrib/sendmail/cf/cf/generic-osf1.mc index 1026849fae0..8d655ba9c70 100644 --- a/contrib/sendmail/cf/cf/generic-osf1.mc +++ b/contrib/sendmail/cf/cf/generic-osf1.mc @@ -20,7 +20,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: generic-osf1.mc,v 8.12 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: generic-osf1.mc,v 8.12 2013-11-22 20:51:08 ca Exp $') OSTYPE(osf1)dnl DOMAIN(generic)dnl MAILER(local)dnl diff --git a/contrib/sendmail/cf/cf/generic-solaris.mc b/contrib/sendmail/cf/cf/generic-solaris.mc index ed3c27104fa..2cd82d362f5 100644 --- a/contrib/sendmail/cf/cf/generic-solaris.mc +++ b/contrib/sendmail/cf/cf/generic-solaris.mc @@ -22,7 +22,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: generic-solaris.mc,v 8.14 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: generic-solaris.mc,v 8.14 2013-11-22 20:51:08 ca Exp $') OSTYPE(solaris2)dnl DOMAIN(generic)dnl MAILER(local)dnl diff --git a/contrib/sendmail/cf/cf/generic-sunos4.1.mc b/contrib/sendmail/cf/cf/generic-sunos4.1.mc index 4dcbd2f238e..845ac162d80 100644 --- a/contrib/sendmail/cf/cf/generic-sunos4.1.mc +++ b/contrib/sendmail/cf/cf/generic-sunos4.1.mc @@ -20,7 +20,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: generic-sunos4.1.mc,v 8.12 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: generic-sunos4.1.mc,v 8.12 2013-11-22 20:51:08 ca Exp $') OSTYPE(sunos4.1)dnl DOMAIN(generic)dnl MAILER(local)dnl diff --git a/contrib/sendmail/cf/cf/generic-ultrix4.mc b/contrib/sendmail/cf/cf/generic-ultrix4.mc index d886e7816c9..b82c9b63070 100644 --- a/contrib/sendmail/cf/cf/generic-ultrix4.mc +++ b/contrib/sendmail/cf/cf/generic-ultrix4.mc @@ -20,7 +20,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: generic-ultrix4.mc,v 8.12 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: generic-ultrix4.mc,v 8.12 2013-11-22 20:51:08 ca Exp $') OSTYPE(ultrix4)dnl DOMAIN(generic)dnl MAILER(local)dnl diff --git a/contrib/sendmail/cf/cf/huginn.cs.mc b/contrib/sendmail/cf/cf/huginn.cs.mc index ddca3a4194a..3b466a01da7 100644 --- a/contrib/sendmail/cf/cf/huginn.cs.mc +++ b/contrib/sendmail/cf/cf/huginn.cs.mc @@ -22,7 +22,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: huginn.cs.mc,v 8.16 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: huginn.cs.mc,v 8.16 2013-11-22 20:51:08 ca Exp $') OSTYPE(hpux9)dnl DOMAIN(CS.Berkeley.EDU)dnl MASQUERADE_AS(CS.Berkeley.EDU)dnl diff --git a/contrib/sendmail/cf/cf/knecht.mc b/contrib/sendmail/cf/cf/knecht.mc index f28424579b6..720389189eb 100644 --- a/contrib/sendmail/cf/cf/knecht.mc +++ b/contrib/sendmail/cf/cf/knecht.mc @@ -19,7 +19,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: knecht.mc,v 8.63 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: knecht.mc,v 8.63 2013-11-22 20:51:08 ca Exp $') OSTYPE(bsd4.4) DOMAIN(generic) diff --git a/contrib/sendmail/cf/cf/mail.cs.mc b/contrib/sendmail/cf/cf/mail.cs.mc index 2d501d1e4f4..3a927ccc976 100644 --- a/contrib/sendmail/cf/cf/mail.cs.mc +++ b/contrib/sendmail/cf/cf/mail.cs.mc @@ -22,7 +22,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: mail.cs.mc,v 8.19 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: mail.cs.mc,v 8.19 2013-11-22 20:51:08 ca Exp $') OSTYPE(ultrix4)dnl DOMAIN(Berkeley.EDU)dnl MASQUERADE_AS(CS.Berkeley.EDU)dnl diff --git a/contrib/sendmail/cf/cf/mail.eecs.mc b/contrib/sendmail/cf/cf/mail.eecs.mc index 1cbc6867b65..c1d593b3d83 100644 --- a/contrib/sendmail/cf/cf/mail.eecs.mc +++ b/contrib/sendmail/cf/cf/mail.eecs.mc @@ -22,7 +22,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: mail.eecs.mc,v 8.19 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: mail.eecs.mc,v 8.19 2013-11-22 20:51:08 ca Exp $') OSTYPE(ultrix4)dnl DOMAIN(EECS.Berkeley.EDU)dnl MASQUERADE_AS(EECS.Berkeley.EDU)dnl diff --git a/contrib/sendmail/cf/cf/mailspool.cs.mc b/contrib/sendmail/cf/cf/mailspool.cs.mc index dcbde566fc6..85db588f864 100644 --- a/contrib/sendmail/cf/cf/mailspool.cs.mc +++ b/contrib/sendmail/cf/cf/mailspool.cs.mc @@ -24,7 +24,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: mailspool.cs.mc,v 8.13 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: mailspool.cs.mc,v 8.13 2013-11-22 20:51:08 ca Exp $') OSTYPE(sunos4.1)dnl DOMAIN(CS.Berkeley.EDU)dnl MAILER(local)dnl diff --git a/contrib/sendmail/cf/cf/python.cs.mc b/contrib/sendmail/cf/cf/python.cs.mc index 59c5c66c173..6a1c00ae60a 100644 --- a/contrib/sendmail/cf/cf/python.cs.mc +++ b/contrib/sendmail/cf/cf/python.cs.mc @@ -24,7 +24,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: python.cs.mc,v 8.13 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: python.cs.mc,v 8.13 2013-11-22 20:51:08 ca Exp $') OSTYPE(bsd4.4)dnl DOMAIN(CS.Berkeley.EDU)dnl define(`LOCAL_RELAY', vangogh.CS.Berkeley.EDU)dnl diff --git a/contrib/sendmail/cf/cf/s2k-osf1.mc b/contrib/sendmail/cf/cf/s2k-osf1.mc index 91101417b0a..a4198341cf9 100644 --- a/contrib/sendmail/cf/cf/s2k-osf1.mc +++ b/contrib/sendmail/cf/cf/s2k-osf1.mc @@ -23,7 +23,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: s2k-osf1.mc,v 8.14 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: s2k-osf1.mc,v 8.14 2013-11-22 20:51:08 ca Exp $') OSTYPE(osf1)dnl DOMAIN(S2K.Berkeley.EDU)dnl MAILER(local)dnl diff --git a/contrib/sendmail/cf/cf/s2k-ultrix4.mc b/contrib/sendmail/cf/cf/s2k-ultrix4.mc index 5cd8c7fa46e..b70a082777e 100644 --- a/contrib/sendmail/cf/cf/s2k-ultrix4.mc +++ b/contrib/sendmail/cf/cf/s2k-ultrix4.mc @@ -23,7 +23,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: s2k-ultrix4.mc,v 8.14 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: s2k-ultrix4.mc,v 8.14 2013-11-22 20:51:08 ca Exp $') OSTYPE(ultrix4)dnl DOMAIN(S2K.Berkeley.EDU)dnl MAILER(local)dnl diff --git a/contrib/sendmail/cf/cf/submit.cf b/contrib/sendmail/cf/cf/submit.cf index 46fd8ff23e5..498b8f9f632 100644 --- a/contrib/sendmail/cf/cf/submit.cf +++ b/contrib/sendmail/cf/cf/submit.cf @@ -16,8 +16,8 @@ ##### ##### SENDMAIL CONFIGURATION FILE ##### -##### built by ca@lab.smi.sendmail.com on Thu Jan 23 12:29:13 PST 2014 -##### in /home/ca/sm8-rel/sm-8.14.8/OpenSource/sendmail-8.14.8/cf/cf +##### built by ca@lab.smi.sendmail.com on Tue May 20 12:12:52 PDT 2014 +##### in /home/ca/sm8.git/sendmail/OpenSource/sendmail-8.14.9/cf/cf ##### using ../ as configuration include directory ##### ###################################################################### @@ -27,15 +27,15 @@ ###################################################################### ###################################################################### -##### $Id: cfhead.m4,v 8.122 2013/11/22 20:51:13 ca Exp $ ##### -##### $Id: cf.m4,v 8.33 2013/11/22 20:51:13 ca Exp $ ##### -##### $Id: submit.mc,v 8.15 2013/11/22 20:51:08 ca Exp $ ##### -##### $Id: msp.m4,v 1.34 2013/11/22 20:51:11 ca Exp $ ##### +##### $Id: cfhead.m4,v 8.122 2013-11-22 20:51:13 ca Exp $ ##### +##### $Id: cf.m4,v 8.33 2013-11-22 20:51:13 ca Exp $ ##### +##### $Id: submit.mc,v 8.15 2013-11-22 20:51:08 ca Exp $ ##### +##### $Id: msp.m4,v 1.34 2013-11-22 20:51:11 ca Exp $ ##### -##### $Id: no_default_msa.m4,v 8.3 2013/11/22 20:51:11 ca Exp $ ##### +##### $Id: no_default_msa.m4,v 8.3 2013-11-22 20:51:11 ca Exp $ ##### -##### $Id: proto.m4,v 8.762 2013/11/22 20:51:13 ca Exp $ ##### +##### $Id: proto.m4,v 8.762 2013-11-22 20:51:13 ca Exp $ ##### # level 10 config file format V10/Berkeley @@ -114,7 +114,7 @@ D{MTAHost}[127.0.0.1] # Configuration version number -DZ8.14.8/Submit +DZ8.14.9/Submit ############### @@ -1299,7 +1299,7 @@ R$* $#relay $@ ${MTAHost} $: $1 < @ $j > ### Local and Program Mailer specification ### ################################################## -##### $Id: local.m4,v 8.60 2013/11/22 20:51:14 ca Exp $ ##### +##### $Id: local.m4,v 8.60 2013-11-22 20:51:14 ca Exp $ ##### # # Envelope sender rewriting @@ -1351,7 +1351,7 @@ Mprog, P=[IPC], F=lmDFMuXk5, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL, D=$z:/, ### SMTP Mailer specification ### ##################################### -##### $Id: smtp.m4,v 8.66 2013/11/22 20:51:14 ca Exp $ ##### +##### $Id: smtp.m4,v 8.66 2013-11-22 20:51:14 ca Exp $ ##### # # common sender and masquerading recipient rewriting @@ -1457,7 +1457,7 @@ Mrelay, P=[IPC], F=mDFMuXa8k, S=EnvFromSMTP/HdrFromSMTP, R=MasqSMTP, E=\r\n, L= # # # # divert(0)dnl -# VERSIONID(`$Id: submit.mc,v 8.15 2013/11/22 20:51:08 ca Exp $') +# VERSIONID(`$Id: submit.mc,v 8.15 2013-11-22 20:51:08 ca Exp $') # define(`confCF_VERSION', `Submit')dnl # define(`__OSTYPE__',`')dnl dirty hack to keep proto.m4 from complaining # define(`_USE_DECNET_SYNTAX_', `1')dnl support DECnet diff --git a/contrib/sendmail/cf/cf/submit.mc b/contrib/sendmail/cf/cf/submit.mc index 352d246d079..580f4ff46e3 100644 --- a/contrib/sendmail/cf/cf/submit.mc +++ b/contrib/sendmail/cf/cf/submit.mc @@ -15,7 +15,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: submit.mc,v 8.15 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: submit.mc,v 8.15 2013-11-22 20:51:08 ca Exp $') define(`confCF_VERSION', `Submit')dnl define(`__OSTYPE__',`')dnl dirty hack to keep proto.m4 from complaining define(`_USE_DECNET_SYNTAX_', `1')dnl support DECnet diff --git a/contrib/sendmail/cf/cf/tcpproto.mc b/contrib/sendmail/cf/cf/tcpproto.mc index db3fe3cb115..502d5ac182e 100644 --- a/contrib/sendmail/cf/cf/tcpproto.mc +++ b/contrib/sendmail/cf/cf/tcpproto.mc @@ -26,7 +26,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: tcpproto.mc,v 8.15 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: tcpproto.mc,v 8.15 2013-11-22 20:51:08 ca Exp $') OSTYPE(`unknown') FEATURE(`nouucp', `reject') MAILER(`local') diff --git a/contrib/sendmail/cf/cf/ucbarpa.mc b/contrib/sendmail/cf/cf/ucbarpa.mc index 3ab8851a7e7..aa3babc703c 100644 --- a/contrib/sendmail/cf/cf/ucbarpa.mc +++ b/contrib/sendmail/cf/cf/ucbarpa.mc @@ -21,7 +21,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: ucbarpa.mc,v 8.13 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: ucbarpa.mc,v 8.13 2013-11-22 20:51:08 ca Exp $') DOMAIN(CS.Berkeley.EDU)dnl OSTYPE(bsd4.4)dnl MAILER(local)dnl diff --git a/contrib/sendmail/cf/cf/ucbvax.mc b/contrib/sendmail/cf/cf/ucbvax.mc index 2b49b645f1c..98db5160a85 100644 --- a/contrib/sendmail/cf/cf/ucbvax.mc +++ b/contrib/sendmail/cf/cf/ucbvax.mc @@ -22,7 +22,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: ucbvax.mc,v 8.15 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: ucbvax.mc,v 8.15 2013-11-22 20:51:08 ca Exp $') OSTYPE(bsd4.3) DOMAIN(CS.Berkeley.EDU) MASQUERADE_AS(CS.Berkeley.EDU) diff --git a/contrib/sendmail/cf/cf/uucpproto.mc b/contrib/sendmail/cf/cf/uucpproto.mc index a3cca7e6a3a..8cfe6e77d57 100644 --- a/contrib/sendmail/cf/cf/uucpproto.mc +++ b/contrib/sendmail/cf/cf/uucpproto.mc @@ -26,7 +26,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: uucpproto.mc,v 8.16 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: uucpproto.mc,v 8.16 2013-11-22 20:51:08 ca Exp $') OSTYPE(unknown) FEATURE(promiscuous_relay)dnl FEATURE(accept_unresolvable_domains)dnl diff --git a/contrib/sendmail/cf/cf/vangogh.cs.mc b/contrib/sendmail/cf/cf/vangogh.cs.mc index 49329fb4255..1b93c1aa526 100644 --- a/contrib/sendmail/cf/cf/vangogh.cs.mc +++ b/contrib/sendmail/cf/cf/vangogh.cs.mc @@ -23,7 +23,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: vangogh.cs.mc,v 8.14 2013/11/22 20:51:08 ca Exp $') +VERSIONID(`$Id: vangogh.cs.mc,v 8.14 2013-11-22 20:51:08 ca Exp $') DOMAIN(CS.Berkeley.EDU)dnl OSTYPE(bsd4.4)dnl MAILER(local)dnl diff --git a/contrib/sendmail/cf/domain/Berkeley.EDU.m4 b/contrib/sendmail/cf/domain/Berkeley.EDU.m4 index cb4c931afed..bde19bd59db 100644 --- a/contrib/sendmail/cf/domain/Berkeley.EDU.m4 +++ b/contrib/sendmail/cf/domain/Berkeley.EDU.m4 @@ -12,7 +12,7 @@ divert(-1) # # divert(0) -VERSIONID(`$Id: Berkeley.EDU.m4,v 8.18 2013/11/22 20:51:10 ca Exp $') +VERSIONID(`$Id: Berkeley.EDU.m4,v 8.18 2013-11-22 20:51:10 ca Exp $') DOMAIN(berkeley-only)dnl define(`BITNET_RELAY', `bitnet-relay.Berkeley.EDU')dnl define(`UUCP_RELAY', `uucp-relay.Berkeley.EDU')dnl diff --git a/contrib/sendmail/cf/domain/CS.Berkeley.EDU.m4 b/contrib/sendmail/cf/domain/CS.Berkeley.EDU.m4 index 4f6e0fc130e..91747e0aefb 100644 --- a/contrib/sendmail/cf/domain/CS.Berkeley.EDU.m4 +++ b/contrib/sendmail/cf/domain/CS.Berkeley.EDU.m4 @@ -12,7 +12,7 @@ divert(-1) # # divert(0) -VERSIONID(`$Id: CS.Berkeley.EDU.m4,v 8.11 2013/11/22 20:51:10 ca Exp $') +VERSIONID(`$Id: CS.Berkeley.EDU.m4,v 8.11 2013-11-22 20:51:10 ca Exp $') DOMAIN(Berkeley.EDU)dnl HACK(cssubdomain)dnl define(`confUSERDB_SPEC', diff --git a/contrib/sendmail/cf/domain/EECS.Berkeley.EDU.m4 b/contrib/sendmail/cf/domain/EECS.Berkeley.EDU.m4 index e7607a4a7a5..29a85227503 100644 --- a/contrib/sendmail/cf/domain/EECS.Berkeley.EDU.m4 +++ b/contrib/sendmail/cf/domain/EECS.Berkeley.EDU.m4 @@ -12,6 +12,6 @@ divert(-1) # # divert(0) -VERSIONID(`$Id: EECS.Berkeley.EDU.m4,v 8.11 2013/11/22 20:51:10 ca Exp $') +VERSIONID(`$Id: EECS.Berkeley.EDU.m4,v 8.11 2013-11-22 20:51:10 ca Exp $') DOMAIN(Berkeley.EDU)dnl MASQUERADE_AS(EECS.Berkeley.EDU)dnl diff --git a/contrib/sendmail/cf/domain/S2K.Berkeley.EDU.m4 b/contrib/sendmail/cf/domain/S2K.Berkeley.EDU.m4 index 22927db282a..2362f870441 100644 --- a/contrib/sendmail/cf/domain/S2K.Berkeley.EDU.m4 +++ b/contrib/sendmail/cf/domain/S2K.Berkeley.EDU.m4 @@ -12,6 +12,6 @@ divert(-1) # # divert(0) -VERSIONID(`$Id: S2K.Berkeley.EDU.m4,v 8.11 2013/11/22 20:51:10 ca Exp $') +VERSIONID(`$Id: S2K.Berkeley.EDU.m4,v 8.11 2013-11-22 20:51:10 ca Exp $') DOMAIN(CS.Berkeley.EDU)dnl MASQUERADE_AS(postgres.Berkeley.EDU)dnl diff --git a/contrib/sendmail/cf/domain/berkeley-only.m4 b/contrib/sendmail/cf/domain/berkeley-only.m4 index 0e503bfc4da..8ff00744109 100644 --- a/contrib/sendmail/cf/domain/berkeley-only.m4 +++ b/contrib/sendmail/cf/domain/berkeley-only.m4 @@ -12,7 +12,7 @@ divert(-1) # # divert(0) -VERSIONID(`$Id: unspecified-domain.m4,v 8.11 2013/11/22 20:51:10 ca Exp $') +VERSIONID(`$Id: unspecified-domain.m4,v 8.11 2013-11-22 20:51:10 ca Exp $') errprint(`*** ERROR: You are trying to use the Berkeley sample configuration') errprint(` files outside of the Computer Science Division at Berkeley.') errprint(` The configuration (.mc) files must be customized to reference') diff --git a/contrib/sendmail/cf/domain/generic.m4 b/contrib/sendmail/cf/domain/generic.m4 index c3d369e37a1..3c467b7e377 100644 --- a/contrib/sendmail/cf/domain/generic.m4 +++ b/contrib/sendmail/cf/domain/generic.m4 @@ -20,7 +20,7 @@ divert(-1) # files. # divert(0) -VERSIONID(`$Id: generic.m4,v 8.16 2013/11/22 20:51:10 ca Exp $') +VERSIONID(`$Id: generic.m4,v 8.16 2013-11-22 20:51:10 ca Exp $') define(`confFORWARD_PATH', `$z/.forward.$w+$h:$z/.forward+$h:$z/.forward.$w:$z/.forward')dnl define(`confMAX_HEADERS_LENGTH', `32768')dnl FEATURE(`redirect')dnl diff --git a/contrib/sendmail/cf/feature/accept_unqualified_senders.m4 b/contrib/sendmail/cf/feature/accept_unqualified_senders.m4 index 6679adb1485..2b0262fe8d3 100644 --- a/contrib/sendmail/cf/feature/accept_unqualified_senders.m4 +++ b/contrib/sendmail/cf/feature/accept_unqualified_senders.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: accept_unqualified_senders.m4,v 8.7 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: accept_unqualified_senders.m4,v 8.7 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_ACCEPT_UNQUALIFIED_SENDERS_', 1) diff --git a/contrib/sendmail/cf/feature/accept_unresolvable_domains.m4 b/contrib/sendmail/cf/feature/accept_unresolvable_domains.m4 index 04014877a07..29c83bdacb8 100644 --- a/contrib/sendmail/cf/feature/accept_unresolvable_domains.m4 +++ b/contrib/sendmail/cf/feature/accept_unresolvable_domains.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: accept_unresolvable_domains.m4,v 8.11 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: accept_unresolvable_domains.m4,v 8.11 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_ACCEPT_UNRESOLVABLE_DOMAINS_', 1) diff --git a/contrib/sendmail/cf/feature/access_db.m4 b/contrib/sendmail/cf/feature/access_db.m4 index 24806776226..4c1e15c32f0 100644 --- a/contrib/sendmail/cf/feature/access_db.m4 +++ b/contrib/sendmail/cf/feature/access_db.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: access_db.m4,v 8.28 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: access_db.m4,v 8.28 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_ACCESS_TABLE_', `') diff --git a/contrib/sendmail/cf/feature/allmasquerade.m4 b/contrib/sendmail/cf/feature/allmasquerade.m4 index e99978b040e..7b10994fe17 100644 --- a/contrib/sendmail/cf/feature/allmasquerade.m4 +++ b/contrib/sendmail/cf/feature/allmasquerade.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: allmasquerade.m4,v 8.14 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: allmasquerade.m4,v 8.14 2013-11-22 20:51:11 ca Exp $') divert(-1) ifdef(`_MAILER_local_', diff --git a/contrib/sendmail/cf/feature/always_add_domain.m4 b/contrib/sendmail/cf/feature/always_add_domain.m4 index 507d55818b9..c3f53adfcd6 100644 --- a/contrib/sendmail/cf/feature/always_add_domain.m4 +++ b/contrib/sendmail/cf/feature/always_add_domain.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: always_add_domain.m4,v 8.12 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: always_add_domain.m4,v 8.12 2013-11-22 20:51:11 ca Exp $') divert(-1) ifdef(`_MAILER_local_', diff --git a/contrib/sendmail/cf/feature/authinfo.m4 b/contrib/sendmail/cf/feature/authinfo.m4 index f5a4345b609..cdbd82b997e 100644 --- a/contrib/sendmail/cf/feature/authinfo.m4 +++ b/contrib/sendmail/cf/feature/authinfo.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: authinfo.m4,v 1.10 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: authinfo.m4,v 1.10 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_AUTHINFO_TABLE_', `') diff --git a/contrib/sendmail/cf/feature/badmx.m4 b/contrib/sendmail/cf/feature/badmx.m4 index d1a29cdbaa9..7dee681743f 100644 --- a/contrib/sendmail/cf/feature/badmx.m4 +++ b/contrib/sendmail/cf/feature/badmx.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: badmx.m4,v 1.2 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: badmx.m4,v 1.2 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_BADMX_CHK_', 1) diff --git a/contrib/sendmail/cf/feature/bestmx_is_local.m4 b/contrib/sendmail/cf/feature/bestmx_is_local.m4 index d08e237c881..1930e03e832 100644 --- a/contrib/sendmail/cf/feature/bestmx_is_local.m4 +++ b/contrib/sendmail/cf/feature/bestmx_is_local.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: bestmx_is_local.m4,v 8.27 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: bestmx_is_local.m4,v 8.27 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_BESTMX_IS_LOCAL_', _ARG_) diff --git a/contrib/sendmail/cf/feature/bitdomain.m4 b/contrib/sendmail/cf/feature/bitdomain.m4 index 701b0698b66..3353a5dfd7f 100644 --- a/contrib/sendmail/cf/feature/bitdomain.m4 +++ b/contrib/sendmail/cf/feature/bitdomain.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: bitdomain.m4,v 8.31 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: bitdomain.m4,v 8.31 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_BITDOMAIN_TABLE_', `') diff --git a/contrib/sendmail/cf/feature/blacklist_recipients.m4 b/contrib/sendmail/cf/feature/blacklist_recipients.m4 index 373405f6173..706d1175439 100644 --- a/contrib/sendmail/cf/feature/blacklist_recipients.m4 +++ b/contrib/sendmail/cf/feature/blacklist_recipients.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: blacklist_recipients.m4,v 8.14 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: blacklist_recipients.m4,v 8.14 2013-11-22 20:51:11 ca Exp $') divert(-1) ifdef(`_ACCESS_TABLE_', diff --git a/contrib/sendmail/cf/feature/block_bad_helo.m4 b/contrib/sendmail/cf/feature/block_bad_helo.m4 index e24e22be610..e720be129c8 100644 --- a/contrib/sendmail/cf/feature/block_bad_helo.m4 +++ b/contrib/sendmail/cf/feature/block_bad_helo.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: block_bad_helo.m4,v 1.2 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: block_bad_helo.m4,v 1.2 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_BLOCK_BAD_HELO_', `')dnl diff --git a/contrib/sendmail/cf/feature/compat_check.m4 b/contrib/sendmail/cf/feature/compat_check.m4 index 694c1f529d3..45692cc1859 100644 --- a/contrib/sendmail/cf/feature/compat_check.m4 +++ b/contrib/sendmail/cf/feature/compat_check.m4 @@ -9,7 +9,7 @@ divert(-1) # # divert(0) -VERSIONID(`$Id: compat_check.m4,v 1.5 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: compat_check.m4,v 1.5 2013-11-22 20:51:11 ca Exp $') divert(-1) ifdef(`_ACCESS_TABLE_', `', `errprint(`FEATURE(`compat_check') requires FEATURE(`access_db') diff --git a/contrib/sendmail/cf/feature/conncontrol.m4 b/contrib/sendmail/cf/feature/conncontrol.m4 index 6abe0521f76..37a4f128e04 100644 --- a/contrib/sendmail/cf/feature/conncontrol.m4 +++ b/contrib/sendmail/cf/feature/conncontrol.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: conncontrol.m4,v 1.5 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: conncontrol.m4,v 1.5 2013-11-22 20:51:11 ca Exp $') divert(-1) ifdef(`_ACCESS_TABLE_', ` diff --git a/contrib/sendmail/cf/feature/delay_checks.m4 b/contrib/sendmail/cf/feature/delay_checks.m4 index 55761557a7c..368057c991a 100644 --- a/contrib/sendmail/cf/feature/delay_checks.m4 +++ b/contrib/sendmail/cf/feature/delay_checks.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: delay_checks.m4,v 8.9 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: delay_checks.m4,v 8.9 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_DELAY_CHECKS_', 1) diff --git a/contrib/sendmail/cf/feature/dnsbl.m4 b/contrib/sendmail/cf/feature/dnsbl.m4 index 7298ba24292..63b86759c32 100644 --- a/contrib/sendmail/cf/feature/dnsbl.m4 +++ b/contrib/sendmail/cf/feature/dnsbl.m4 @@ -12,7 +12,7 @@ divert(-1) ifdef(`DNSBL_MAP', `', `define(`DNSBL_MAP', `dns -R A')') divert(0) ifdef(`_DNSBL_R_',`dnl',`dnl -VERSIONID(`$Id: dnsbl.m4,v 8.34 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: dnsbl.m4,v 8.34 2013-11-22 20:51:11 ca Exp $') define(`_DNSBL_R_',`') ifelse(defn(`_ARG_'), `', `errprint(`*** ERROR: missing argument for FEATURE(`dnsbl')')') diff --git a/contrib/sendmail/cf/feature/domaintable.m4 b/contrib/sendmail/cf/feature/domaintable.m4 index d857e7a9cdb..0bfc1cfbff3 100644 --- a/contrib/sendmail/cf/feature/domaintable.m4 +++ b/contrib/sendmail/cf/feature/domaintable.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: domaintable.m4,v 8.25 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: domaintable.m4,v 8.25 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_DOMAIN_TABLE_', `') diff --git a/contrib/sendmail/cf/feature/enhdnsbl.m4 b/contrib/sendmail/cf/feature/enhdnsbl.m4 index 27a3009e53c..b3a86b969c2 100644 --- a/contrib/sendmail/cf/feature/enhdnsbl.m4 +++ b/contrib/sendmail/cf/feature/enhdnsbl.m4 @@ -13,7 +13,7 @@ ifelse(defn(`_ARG_'), `', `errprint(`*** ERROR: missing argument for FEATURE(`enhdnsbl')')') divert(0) ifdef(`_EDNSBL_R_',`dnl',`dnl -VERSIONID(`$Id: enhdnsbl.m4,v 1.13 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: enhdnsbl.m4,v 1.13 2013-11-22 20:51:11 ca Exp $') LOCAL_CONFIG define(`_EDNSBL_R_',`')dnl # map for enhanced DNS based blacklist lookups diff --git a/contrib/sendmail/cf/feature/generics_entire_domain.m4 b/contrib/sendmail/cf/feature/generics_entire_domain.m4 index dd2778a95e3..690a6259788 100644 --- a/contrib/sendmail/cf/feature/generics_entire_domain.m4 +++ b/contrib/sendmail/cf/feature/generics_entire_domain.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: generics_entire_domain.m4,v 8.2 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: generics_entire_domain.m4,v 8.2 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_GENERICS_ENTIRE_DOMAIN_', 1) diff --git a/contrib/sendmail/cf/feature/genericstable.m4 b/contrib/sendmail/cf/feature/genericstable.m4 index 22a7fc26113..38a2a16d3bf 100644 --- a/contrib/sendmail/cf/feature/genericstable.m4 +++ b/contrib/sendmail/cf/feature/genericstable.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: genericstable.m4,v 8.24 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: genericstable.m4,v 8.24 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_GENERICS_TABLE_', `') diff --git a/contrib/sendmail/cf/feature/greet_pause.m4 b/contrib/sendmail/cf/feature/greet_pause.m4 index cd912e7ed92..bd845a83e9a 100644 --- a/contrib/sendmail/cf/feature/greet_pause.m4 +++ b/contrib/sendmail/cf/feature/greet_pause.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: greet_pause.m4,v 1.5 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: greet_pause.m4,v 1.5 2013-11-22 20:51:11 ca Exp $') divert(-1) ifelse(len(X`'_ARG_),`1',`ifdef(`_ACCESS_TABLE_', `', diff --git a/contrib/sendmail/cf/feature/ldap_routing.m4 b/contrib/sendmail/cf/feature/ldap_routing.m4 index 2786d71d01a..9310600f1a2 100644 --- a/contrib/sendmail/cf/feature/ldap_routing.m4 +++ b/contrib/sendmail/cf/feature/ldap_routing.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: ldap_routing.m4,v 8.21 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: ldap_routing.m4,v 8.21 2013-11-22 20:51:11 ca Exp $') divert(-1) # Check first two arguments. If they aren't set, may need to warn in proto.m4 diff --git a/contrib/sendmail/cf/feature/limited_masquerade.m4 b/contrib/sendmail/cf/feature/limited_masquerade.m4 index 6f35e770270..a6fc8110d75 100644 --- a/contrib/sendmail/cf/feature/limited_masquerade.m4 +++ b/contrib/sendmail/cf/feature/limited_masquerade.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: limited_masquerade.m4,v 8.10 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: limited_masquerade.m4,v 8.10 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_LIMITED_MASQUERADE_', 1) diff --git a/contrib/sendmail/cf/feature/local_lmtp.m4 b/contrib/sendmail/cf/feature/local_lmtp.m4 index 2e0ed931fa1..7bc04be3c22 100644 --- a/contrib/sendmail/cf/feature/local_lmtp.m4 +++ b/contrib/sendmail/cf/feature/local_lmtp.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: local_lmtp.m4,v 8.18 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: local_lmtp.m4,v 8.18 2013-11-22 20:51:11 ca Exp $') divert(-1) ifdef(`_MAILER_local_', diff --git a/contrib/sendmail/cf/feature/local_no_masquerade.m4 b/contrib/sendmail/cf/feature/local_no_masquerade.m4 index ef9b5cfb614..536f35de338 100644 --- a/contrib/sendmail/cf/feature/local_no_masquerade.m4 +++ b/contrib/sendmail/cf/feature/local_no_masquerade.m4 @@ -9,7 +9,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: local_no_masquerade.m4,v 1.3 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: local_no_masquerade.m4,v 1.3 2013-11-22 20:51:11 ca Exp $') divert(-1) ifdef(`_MAILER_local_', diff --git a/contrib/sendmail/cf/feature/local_procmail.m4 b/contrib/sendmail/cf/feature/local_procmail.m4 index 778f58e0d5d..1e1f2e672e2 100644 --- a/contrib/sendmail/cf/feature/local_procmail.m4 +++ b/contrib/sendmail/cf/feature/local_procmail.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: local_procmail.m4,v 8.23 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: local_procmail.m4,v 8.23 2013-11-22 20:51:11 ca Exp $') divert(-1) ifdef(`_MAILER_local_', diff --git a/contrib/sendmail/cf/feature/lookupdotdomain.m4 b/contrib/sendmail/cf/feature/lookupdotdomain.m4 index 570807832f4..94ec2c866bd 100644 --- a/contrib/sendmail/cf/feature/lookupdotdomain.m4 +++ b/contrib/sendmail/cf/feature/lookupdotdomain.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: lookupdotdomain.m4,v 1.2 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: lookupdotdomain.m4,v 1.2 2013-11-22 20:51:11 ca Exp $') divert(-1) ifdef(`_ACCESS_TABLE_', diff --git a/contrib/sendmail/cf/feature/loose_relay_check.m4 b/contrib/sendmail/cf/feature/loose_relay_check.m4 index 675b7b3e1e1..83f1942e163 100644 --- a/contrib/sendmail/cf/feature/loose_relay_check.m4 +++ b/contrib/sendmail/cf/feature/loose_relay_check.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: loose_relay_check.m4,v 8.7 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: loose_relay_check.m4,v 8.7 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_LOOSE_RELAY_CHECK_', 1) diff --git a/contrib/sendmail/cf/feature/mailertable.m4 b/contrib/sendmail/cf/feature/mailertable.m4 index 38ebe68d44b..775bb5a916b 100644 --- a/contrib/sendmail/cf/feature/mailertable.m4 +++ b/contrib/sendmail/cf/feature/mailertable.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: mailertable.m4,v 8.26 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: mailertable.m4,v 8.26 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_MAILER_TABLE_', `') diff --git a/contrib/sendmail/cf/feature/masquerade_entire_domain.m4 b/contrib/sendmail/cf/feature/masquerade_entire_domain.m4 index d31b09b7af1..3f3e6621072 100644 --- a/contrib/sendmail/cf/feature/masquerade_entire_domain.m4 +++ b/contrib/sendmail/cf/feature/masquerade_entire_domain.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: masquerade_entire_domain.m4,v 8.10 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: masquerade_entire_domain.m4,v 8.10 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_MASQUERADE_ENTIRE_DOMAIN_', 1) diff --git a/contrib/sendmail/cf/feature/masquerade_envelope.m4 b/contrib/sendmail/cf/feature/masquerade_envelope.m4 index 336c40342bd..e708341504d 100644 --- a/contrib/sendmail/cf/feature/masquerade_envelope.m4 +++ b/contrib/sendmail/cf/feature/masquerade_envelope.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: masquerade_envelope.m4,v 8.10 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: masquerade_envelope.m4,v 8.10 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_MASQUERADE_ENVELOPE_', 1) diff --git a/contrib/sendmail/cf/feature/msp.m4 b/contrib/sendmail/cf/feature/msp.m4 index e838b43720e..b43b9d4fe3e 100644 --- a/contrib/sendmail/cf/feature/msp.m4 +++ b/contrib/sendmail/cf/feature/msp.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: msp.m4,v 1.34 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: msp.m4,v 1.34 2013-11-22 20:51:11 ca Exp $') divert(-1) undefine(`ALIAS_FILE') define(`confDELIVERY_MODE', `i') diff --git a/contrib/sendmail/cf/feature/mtamark.m4 b/contrib/sendmail/cf/feature/mtamark.m4 index 0214975240f..6e7f5e05e85 100644 --- a/contrib/sendmail/cf/feature/mtamark.m4 +++ b/contrib/sendmail/cf/feature/mtamark.m4 @@ -11,7 +11,7 @@ divert(-1) divert(0) ifdef(`_MTAMARK_R',`dnl',`dnl -VERSIONID(`$Id: mtamark.m4,v 1.3 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: mtamark.m4,v 1.3 2013-11-22 20:51:11 ca Exp $') LOCAL_CONFIG define(`_MTAMARK_R',`')dnl # map for MTA mark diff --git a/contrib/sendmail/cf/feature/no_default_msa.m4 b/contrib/sendmail/cf/feature/no_default_msa.m4 index 778f88e35b9..7ab265206d4 100644 --- a/contrib/sendmail/cf/feature/no_default_msa.m4 +++ b/contrib/sendmail/cf/feature/no_default_msa.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: no_default_msa.m4,v 8.3 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: no_default_msa.m4,v 8.3 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_NO_MSA_', `1') diff --git a/contrib/sendmail/cf/feature/nocanonify.m4 b/contrib/sendmail/cf/feature/nocanonify.m4 index 189a4d2c713..1aea01ca8b5 100644 --- a/contrib/sendmail/cf/feature/nocanonify.m4 +++ b/contrib/sendmail/cf/feature/nocanonify.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: nocanonify.m4,v 8.13 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: nocanonify.m4,v 8.13 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_NO_CANONIFY_', 1) diff --git a/contrib/sendmail/cf/feature/notsticky.m4 b/contrib/sendmail/cf/feature/notsticky.m4 index f32d9033987..de449429039 100644 --- a/contrib/sendmail/cf/feature/notsticky.m4 +++ b/contrib/sendmail/cf/feature/notsticky.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: notsticky.m4,v 8.12 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: notsticky.m4,v 8.12 2013-11-22 20:51:11 ca Exp $') # # This is now the default. Use ``FEATURE(stickyhost)'' if you want # the old default behaviour. diff --git a/contrib/sendmail/cf/feature/nouucp.m4 b/contrib/sendmail/cf/feature/nouucp.m4 index 26be26a5297..5d1ee76f4dd 100644 --- a/contrib/sendmail/cf/feature/nouucp.m4 +++ b/contrib/sendmail/cf/feature/nouucp.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: nouucp.m4,v 8.14 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: nouucp.m4,v 8.14 2013-11-22 20:51:11 ca Exp $') divert(-1) ifelse(defn(`_ARG_'), `', diff --git a/contrib/sendmail/cf/feature/nullclient.m4 b/contrib/sendmail/cf/feature/nullclient.m4 index 32f57d60434..a78a5f067ed 100644 --- a/contrib/sendmail/cf/feature/nullclient.m4 +++ b/contrib/sendmail/cf/feature/nullclient.m4 @@ -22,7 +22,7 @@ ifelse(defn(`_ARG_'), `', `errprint(`Feature "nullclient" requires argument')', # divert(0) -VERSIONID(`$Id: nullclient.m4,v 8.25 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: nullclient.m4,v 8.25 2013-11-22 20:51:11 ca Exp $') divert(-1) undefine(`ALIAS_FILE') diff --git a/contrib/sendmail/cf/feature/preserve_local_plus_detail.m4 b/contrib/sendmail/cf/feature/preserve_local_plus_detail.m4 index 983f6eaad28..620c1dccc16 100644 --- a/contrib/sendmail/cf/feature/preserve_local_plus_detail.m4 +++ b/contrib/sendmail/cf/feature/preserve_local_plus_detail.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: preserve_local_plus_detail.m4,v 8.2 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: preserve_local_plus_detail.m4,v 8.2 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_PRESERVE_LOCAL_PLUS_DETAIL_', `1') diff --git a/contrib/sendmail/cf/feature/preserve_luser_host.m4 b/contrib/sendmail/cf/feature/preserve_luser_host.m4 index d9af4fb5339..0e2bfbfe40a 100644 --- a/contrib/sendmail/cf/feature/preserve_luser_host.m4 +++ b/contrib/sendmail/cf/feature/preserve_luser_host.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: preserve_luser_host.m4,v 1.4 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: preserve_luser_host.m4,v 1.4 2013-11-22 20:51:11 ca Exp $') divert(-1) ifdef(`LUSER_RELAY', `', diff --git a/contrib/sendmail/cf/feature/promiscuous_relay.m4 b/contrib/sendmail/cf/feature/promiscuous_relay.m4 index 21fd40ffe75..fb060fa5624 100644 --- a/contrib/sendmail/cf/feature/promiscuous_relay.m4 +++ b/contrib/sendmail/cf/feature/promiscuous_relay.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: promiscuous_relay.m4,v 8.13 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: promiscuous_relay.m4,v 8.13 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_PROMISCUOUS_RELAY_', 1) diff --git a/contrib/sendmail/cf/feature/queuegroup.m4 b/contrib/sendmail/cf/feature/queuegroup.m4 index a7653d36e10..9c3d41eb732 100644 --- a/contrib/sendmail/cf/feature/queuegroup.m4 +++ b/contrib/sendmail/cf/feature/queuegroup.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: queuegroup.m4,v 1.5 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: queuegroup.m4,v 1.5 2013-11-22 20:51:11 ca Exp $') divert(-1) ifdef(`_ACCESS_TABLE_', `', diff --git a/contrib/sendmail/cf/feature/ratecontrol.m4 b/contrib/sendmail/cf/feature/ratecontrol.m4 index 5aa5bc5113e..3ff7bf982c3 100644 --- a/contrib/sendmail/cf/feature/ratecontrol.m4 +++ b/contrib/sendmail/cf/feature/ratecontrol.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: ratecontrol.m4,v 1.6 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: ratecontrol.m4,v 1.6 2013-11-22 20:51:11 ca Exp $') divert(-1) ifdef(`_ACCESS_TABLE_', ` diff --git a/contrib/sendmail/cf/feature/redirect.m4 b/contrib/sendmail/cf/feature/redirect.m4 index c932b7f0eca..c48dae63a98 100644 --- a/contrib/sendmail/cf/feature/redirect.m4 +++ b/contrib/sendmail/cf/feature/redirect.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: redirect.m4,v 8.16 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: redirect.m4,v 8.16 2013-11-22 20:51:11 ca Exp $') divert(-1) LOCAL_RULE_0 diff --git a/contrib/sendmail/cf/feature/relay_based_on_MX.m4 b/contrib/sendmail/cf/feature/relay_based_on_MX.m4 index 244120448da..ed981902638 100644 --- a/contrib/sendmail/cf/feature/relay_based_on_MX.m4 +++ b/contrib/sendmail/cf/feature/relay_based_on_MX.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: relay_based_on_MX.m4,v 8.12 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: relay_based_on_MX.m4,v 8.12 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_RELAY_MX_SERVED_', 1) diff --git a/contrib/sendmail/cf/feature/relay_entire_domain.m4 b/contrib/sendmail/cf/feature/relay_entire_domain.m4 index eddb35abac0..a66c14940bb 100644 --- a/contrib/sendmail/cf/feature/relay_entire_domain.m4 +++ b/contrib/sendmail/cf/feature/relay_entire_domain.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: relay_entire_domain.m4,v 8.11 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: relay_entire_domain.m4,v 8.11 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_RELAY_ENTIRE_DOMAIN_', 1) diff --git a/contrib/sendmail/cf/feature/relay_hosts_only.m4 b/contrib/sendmail/cf/feature/relay_hosts_only.m4 index 60102103916..9438196759e 100644 --- a/contrib/sendmail/cf/feature/relay_hosts_only.m4 +++ b/contrib/sendmail/cf/feature/relay_hosts_only.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: relay_hosts_only.m4,v 8.11 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: relay_hosts_only.m4,v 8.11 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_RELAY_HOSTS_ONLY_', 1) diff --git a/contrib/sendmail/cf/feature/relay_local_from.m4 b/contrib/sendmail/cf/feature/relay_local_from.m4 index 919dfc0f4a4..8ec831311f1 100644 --- a/contrib/sendmail/cf/feature/relay_local_from.m4 +++ b/contrib/sendmail/cf/feature/relay_local_from.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: relay_local_from.m4,v 8.7 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: relay_local_from.m4,v 8.7 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_RELAY_LOCAL_FROM_', 1) diff --git a/contrib/sendmail/cf/feature/relay_mail_from.m4 b/contrib/sendmail/cf/feature/relay_mail_from.m4 index c16cfed1632..b0a57c5b4f0 100644 --- a/contrib/sendmail/cf/feature/relay_mail_from.m4 +++ b/contrib/sendmail/cf/feature/relay_mail_from.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: relay_mail_from.m4,v 8.4 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: relay_mail_from.m4,v 8.4 2013-11-22 20:51:11 ca Exp $') divert(-1) ifdef(`_ACCESS_TABLE_', diff --git a/contrib/sendmail/cf/feature/require_rdns.m4 b/contrib/sendmail/cf/feature/require_rdns.m4 index 0dc2d072df2..583118d95f1 100644 --- a/contrib/sendmail/cf/feature/require_rdns.m4 +++ b/contrib/sendmail/cf/feature/require_rdns.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0)dnl -VERSIONID(`$Id: require_rdns.m4,v 1.2 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: require_rdns.m4,v 1.2 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_REQUIRE_RDNS_', `') diff --git a/contrib/sendmail/cf/feature/smrsh.m4 b/contrib/sendmail/cf/feature/smrsh.m4 index e7070d945c3..618ed4cd0bd 100644 --- a/contrib/sendmail/cf/feature/smrsh.m4 +++ b/contrib/sendmail/cf/feature/smrsh.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: smrsh.m4,v 8.15 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: smrsh.m4,v 8.15 2013-11-22 20:51:11 ca Exp $') divert(-1) ifdef(`_MAILER_local_', diff --git a/contrib/sendmail/cf/feature/stickyhost.m4 b/contrib/sendmail/cf/feature/stickyhost.m4 index 372e4f14b38..9c99fdd60f2 100644 --- a/contrib/sendmail/cf/feature/stickyhost.m4 +++ b/contrib/sendmail/cf/feature/stickyhost.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: stickyhost.m4,v 8.10 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: stickyhost.m4,v 8.10 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_STICKY_LOCAL_DOMAIN_', 1) diff --git a/contrib/sendmail/cf/feature/use_client_ptr.m4 b/contrib/sendmail/cf/feature/use_client_ptr.m4 index 2971941a5c3..993119991a3 100644 --- a/contrib/sendmail/cf/feature/use_client_ptr.m4 +++ b/contrib/sendmail/cf/feature/use_client_ptr.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: use_client_ptr.m4,v 1.2 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: use_client_ptr.m4,v 1.2 2013-11-22 20:51:11 ca Exp $') divert(-1) # if defined, check_relay will use {client_ptr} instead of whatever diff --git a/contrib/sendmail/cf/feature/use_ct_file.m4 b/contrib/sendmail/cf/feature/use_ct_file.m4 index 10c19284775..aff45aec2d3 100644 --- a/contrib/sendmail/cf/feature/use_ct_file.m4 +++ b/contrib/sendmail/cf/feature/use_ct_file.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: use_ct_file.m4,v 8.12 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: use_ct_file.m4,v 8.12 2013-11-22 20:51:11 ca Exp $') divert(-1) # if defined, the sendmail.cf will read the /etc/mail/trusted-users file to diff --git a/contrib/sendmail/cf/feature/use_cw_file.m4 b/contrib/sendmail/cf/feature/use_cw_file.m4 index 20f9bec474c..80fba652f78 100644 --- a/contrib/sendmail/cf/feature/use_cw_file.m4 +++ b/contrib/sendmail/cf/feature/use_cw_file.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: use_cw_file.m4,v 8.12 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: use_cw_file.m4,v 8.12 2013-11-22 20:51:11 ca Exp $') divert(-1) # if defined, the sendmail.cf will read the /etc/mail/local-host-names file diff --git a/contrib/sendmail/cf/feature/uucpdomain.m4 b/contrib/sendmail/cf/feature/uucpdomain.m4 index ddf3d9999bc..80d119ca0c1 100644 --- a/contrib/sendmail/cf/feature/uucpdomain.m4 +++ b/contrib/sendmail/cf/feature/uucpdomain.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: uucpdomain.m4,v 8.30 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: uucpdomain.m4,v 8.30 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_UUDOMAIN_TABLE_', `') diff --git a/contrib/sendmail/cf/feature/virtuser_entire_domain.m4 b/contrib/sendmail/cf/feature/virtuser_entire_domain.m4 index e5d4987524a..4ce117bef2f 100644 --- a/contrib/sendmail/cf/feature/virtuser_entire_domain.m4 +++ b/contrib/sendmail/cf/feature/virtuser_entire_domain.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: virtuser_entire_domain.m4,v 8.3 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: virtuser_entire_domain.m4,v 8.3 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_VIRTUSER_ENTIRE_DOMAIN_', 1) diff --git a/contrib/sendmail/cf/feature/virtusertable.m4 b/contrib/sendmail/cf/feature/virtusertable.m4 index cc437909553..3e34a629162 100644 --- a/contrib/sendmail/cf/feature/virtusertable.m4 +++ b/contrib/sendmail/cf/feature/virtusertable.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: virtusertable.m4,v 8.24 2013/11/22 20:51:11 ca Exp $') +VERSIONID(`$Id: virtusertable.m4,v 8.24 2013-11-22 20:51:11 ca Exp $') divert(-1) define(`_VIRTUSER_TABLE_', `') diff --git a/contrib/sendmail/cf/hack/cssubdomain.m4 b/contrib/sendmail/cf/hack/cssubdomain.m4 index 4a6bca51a4d..a20cb506099 100644 --- a/contrib/sendmail/cf/hack/cssubdomain.m4 +++ b/contrib/sendmail/cf/hack/cssubdomain.m4 @@ -12,7 +12,7 @@ divert(-1) # # divert(0) -VERSIONID(`$Id: cssubdomain.m4,v 8.10 2013/11/22 20:51:13 ca Exp $') +VERSIONID(`$Id: cssubdomain.m4,v 8.10 2013-11-22 20:51:13 ca Exp $') divert(2) # find possible (old & new) versions of our name via short circuit hack diff --git a/contrib/sendmail/cf/m4/cf.m4 b/contrib/sendmail/cf/m4/cf.m4 index 871b98fa626..b2f048d147d 100644 --- a/contrib/sendmail/cf/m4/cf.m4 +++ b/contrib/sendmail/cf/m4/cf.m4 @@ -26,4 +26,4 @@ ifdef(`_CF_DIR_', `', divert(0)dnl ifdef(`OSTYPE', `dnl', `include(_CF_DIR_`'m4/cfhead.m4)dnl -VERSIONID(`$Id: cf.m4,v 8.33 2013/11/22 20:51:13 ca Exp $')') +VERSIONID(`$Id: cf.m4,v 8.33 2013-11-22 20:51:13 ca Exp $')') diff --git a/contrib/sendmail/cf/m4/cfhead.m4 b/contrib/sendmail/cf/m4/cfhead.m4 index 729d23cddcf..a244b9ab3c0 100644 --- a/contrib/sendmail/cf/m4/cfhead.m4 +++ b/contrib/sendmail/cf/m4/cfhead.m4 @@ -309,4 +309,4 @@ define(`confMILTER_MACROS_EOM', `{msg_id}') divert(0)dnl -VERSIONID(`$Id: cfhead.m4,v 8.122 2013/11/22 20:51:13 ca Exp $') +VERSIONID(`$Id: cfhead.m4,v 8.122 2013-11-22 20:51:13 ca Exp $') diff --git a/contrib/sendmail/cf/m4/proto.m4 b/contrib/sendmail/cf/m4/proto.m4 index 79667c177b9..4089bf6a035 100644 --- a/contrib/sendmail/cf/m4/proto.m4 +++ b/contrib/sendmail/cf/m4/proto.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: proto.m4,v 8.762 2013/11/22 20:51:13 ca Exp $') +VERSIONID(`$Id: proto.m4,v 8.762 2013-11-22 20:51:13 ca Exp $') # level CF_LEVEL config file format V`'CF_LEVEL`'ifdef(`NO_VENDOR',`', `/ifdef(`VENDOR_NAME', `VENDOR_NAME', `Berkeley')') diff --git a/contrib/sendmail/cf/m4/version.m4 b/contrib/sendmail/cf/m4/version.m4 index ba2d36ab31c..31f6ffeac38 100644 --- a/contrib/sendmail/cf/m4/version.m4 +++ b/contrib/sendmail/cf/m4/version.m4 @@ -1,6 +1,6 @@ divert(-1) # -# Copyright (c) 1998-2013 Proofpoint, Inc. and its suppliers. +# Copyright (c) 1998-2014 Proofpoint, Inc. and its suppliers. # All rights reserved. # Copyright (c) 1983 Eric P. Allman. All rights reserved. # Copyright (c) 1988, 1993 @@ -11,8 +11,8 @@ divert(-1) # the sendmail distribution. # # -VERSIONID(`$Id: version.m4,v 8.236 2013/11/27 00:38:51 ca Exp $') +VERSIONID(`$Id: version.m4,v 8.236 2013-11-27 00:38:51 ca Exp $') # divert(0) # Configuration version number -DZ8.14.8`'ifdef(`confCF_VERSION', `/confCF_VERSION') +DZ8.14.9`'ifdef(`confCF_VERSION', `/confCF_VERSION') diff --git a/contrib/sendmail/cf/mailer/cyrus.m4 b/contrib/sendmail/cf/mailer/cyrus.m4 index 4189b9516a4..ba2f57e6f37 100644 --- a/contrib/sendmail/cf/mailer/cyrus.m4 +++ b/contrib/sendmail/cf/mailer/cyrus.m4 @@ -49,7 +49,7 @@ POPDIVERT ### Cyrus Mailer specification ### ################################################## -VERSIONID(`$Id: cyrus.m4,v 8.24 2013/11/22 20:51:14 ca Exp $ (Carnegie Mellon)') +VERSIONID(`$Id: cyrus.m4,v 8.24 2013-11-22 20:51:14 ca Exp $ (Carnegie Mellon)') Mcyrus, P=CYRUS_MAILER_PATH, F=_MODMF_(CONCAT(`lsDFMnPq', CYRUS_MAILER_FLAGS), `CYRUS'), S=EnvFromL, R=EnvToL/HdrToL, ifdef(`CYRUS_MAILER_MAX', `M=CYRUS_MAILER_MAX, ')U=CYRUS_MAILER_USER, T=DNS/RFC822/X-Unix,_CYRUS_QGRP diff --git a/contrib/sendmail/cf/mailer/cyrusv2.m4 b/contrib/sendmail/cf/mailer/cyrusv2.m4 index cd2809b5385..d8d2784e946 100644 --- a/contrib/sendmail/cf/mailer/cyrusv2.m4 +++ b/contrib/sendmail/cf/mailer/cyrusv2.m4 @@ -21,7 +21,7 @@ POPDIVERT ### Cyrus V2 Mailer specification ### ######################################### -VERSIONID(`$Id: cyrusv2.m4,v 1.2 2013/11/22 20:51:14 ca Exp $') +VERSIONID(`$Id: cyrusv2.m4,v 1.2 2013-11-22 20:51:14 ca Exp $') Mcyrusv2, P=[IPC], F=_MODMF_(CONCAT(_DEF_CYRUSV2_MAILER_FLAGS, CYRUSV2_MAILER_FLAGS), `CYRUSV2'), S=EnvFromSMTP/HdrFromL, R=EnvToL/HdrToL, E=\r\n, diff --git a/contrib/sendmail/cf/mailer/fax.m4 b/contrib/sendmail/cf/mailer/fax.m4 index cb4399ced3e..ca6d0188527 100644 --- a/contrib/sendmail/cf/mailer/fax.m4 +++ b/contrib/sendmail/cf/mailer/fax.m4 @@ -28,7 +28,7 @@ POPDIVERT ### FAX Mailer specification ### #################################### -VERSIONID(`$Id: fax.m4,v 8.17 2013/11/22 20:51:14 ca Exp $') +VERSIONID(`$Id: fax.m4,v 8.17 2013-11-22 20:51:14 ca Exp $') Mfax, P=FAX_MAILER_PATH, F=DFMhu, S=14, R=24, M=FAX_MAILER_MAX, T=X-Phone/X-FAX/X-Unix,_FAX_QGRP diff --git a/contrib/sendmail/cf/mailer/local.m4 b/contrib/sendmail/cf/mailer/local.m4 index d4a272cdac7..85d24f32a2a 100644 --- a/contrib/sendmail/cf/mailer/local.m4 +++ b/contrib/sendmail/cf/mailer/local.m4 @@ -32,7 +32,7 @@ POPDIVERT ### Local and Program Mailer specification ### ################################################## -VERSIONID(`$Id: local.m4,v 8.60 2013/11/22 20:51:14 ca Exp $') +VERSIONID(`$Id: local.m4,v 8.60 2013-11-22 20:51:14 ca Exp $') # # Envelope sender rewriting diff --git a/contrib/sendmail/cf/mailer/mail11.m4 b/contrib/sendmail/cf/mailer/mail11.m4 index 05a291c8ccf..d2a4cb04a50 100644 --- a/contrib/sendmail/cf/mailer/mail11.m4 +++ b/contrib/sendmail/cf/mailer/mail11.m4 @@ -42,7 +42,7 @@ POPDIVERT ### UTK-MAIL11 Mailer specification ### ########################################### -VERSIONID(`$Id: mail11.m4,v 8.23 2013/11/22 20:51:14 ca Exp $') +VERSIONID(`$Id: mail11.m4,v 8.23 2013-11-22 20:51:14 ca Exp $') SMail11To R$+ < @ $- .UUCP > $: $2 ! $1 back to old style diff --git a/contrib/sendmail/cf/mailer/phquery.m4 b/contrib/sendmail/cf/mailer/phquery.m4 index 940efe186a1..14baa112495 100644 --- a/contrib/sendmail/cf/mailer/phquery.m4 +++ b/contrib/sendmail/cf/mailer/phquery.m4 @@ -25,7 +25,7 @@ POPDIVERT ### PH Mailer specification ### #################################### -VERSIONID(`$Id: phquery.m4,v 8.18 2013/11/22 20:51:14 ca Exp $') +VERSIONID(`$Id: phquery.m4,v 8.18 2013-11-22 20:51:14 ca Exp $') Mph, P=PH_MAILER_PATH, F=_MODMF_(CONCAT(`nrDFM', PH_MAILER_FLAGS), `PH'), S=EnvFromL, R=EnvToL/HdrToL, T=DNS/RFC822/X-Unix,_PH_QGRP diff --git a/contrib/sendmail/cf/mailer/pop.m4 b/contrib/sendmail/cf/mailer/pop.m4 index 053b2aa8946..d1b92013f87 100644 --- a/contrib/sendmail/cf/mailer/pop.m4 +++ b/contrib/sendmail/cf/mailer/pop.m4 @@ -23,7 +23,7 @@ POPDIVERT ### POP Mailer specification ### #################################### -VERSIONID(`$Id: pop.m4,v 8.23 2013/11/22 20:51:14 ca Exp $') +VERSIONID(`$Id: pop.m4,v 8.23 2013-11-22 20:51:14 ca Exp $') Mpop, P=POP_MAILER_PATH, F=_MODMF_(CONCAT(`lsDFMq', POP_MAILER_FLAGS), `POP'), S=EnvFromL, R=EnvToL/HdrToL, T=DNS/RFC822/X-Unix,_POP_QGRP diff --git a/contrib/sendmail/cf/mailer/procmail.m4 b/contrib/sendmail/cf/mailer/procmail.m4 index bdbae471de6..83e95ed2759 100644 --- a/contrib/sendmail/cf/mailer/procmail.m4 +++ b/contrib/sendmail/cf/mailer/procmail.m4 @@ -27,7 +27,7 @@ POPDIVERT ### PROCMAIL Mailer specification ### ##################*****################## -VERSIONID(`$Id: procmail.m4,v 8.23 2013/11/22 20:51:14 ca Exp $') +VERSIONID(`$Id: procmail.m4,v 8.23 2013-11-22 20:51:14 ca Exp $') Mprocmail, P=PROCMAIL_MAILER_PATH, F=_MODMF_(CONCAT(`DFM', PROCMAIL_MAILER_FLAGS), `PROCMAIL'), S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP/HdrFromSMTP, ifdef(`PROCMAIL_MAILER_MAX', `M=PROCMAIL_MAILER_MAX, ')T=DNS/RFC822/X-Unix,_PROCMAIL_QGRP diff --git a/contrib/sendmail/cf/mailer/qpage.m4 b/contrib/sendmail/cf/mailer/qpage.m4 index 057bcf8791c..31070216893 100644 --- a/contrib/sendmail/cf/mailer/qpage.m4 +++ b/contrib/sendmail/cf/mailer/qpage.m4 @@ -24,7 +24,7 @@ POPDIVERT ### QPAGE Mailer specification ### ###################################### -VERSIONID(`$Id: qpage.m4,v 8.11 2013/11/22 20:51:14 ca Exp $') +VERSIONID(`$Id: qpage.m4,v 8.11 2013-11-22 20:51:14 ca Exp $') Mqpage, P=QPAGE_MAILER_PATH, F=_MODMF_(QPAGE_MAILER_FLAGS, `QPAGE'), M=QPAGE_MAILER_MAX, T=DNS/RFC822/X-Unix,_QPAGE_QGRP diff --git a/contrib/sendmail/cf/mailer/smtp.m4 b/contrib/sendmail/cf/mailer/smtp.m4 index 34bd438038b..7a62feacd09 100644 --- a/contrib/sendmail/cf/mailer/smtp.m4 +++ b/contrib/sendmail/cf/mailer/smtp.m4 @@ -31,7 +31,7 @@ POPDIVERT ### SMTP Mailer specification ### ##################################### -VERSIONID(`$Id: smtp.m4,v 8.66 2013/11/22 20:51:14 ca Exp $') +VERSIONID(`$Id: smtp.m4,v 8.66 2013-11-22 20:51:14 ca Exp $') # # common sender and masquerading recipient rewriting diff --git a/contrib/sendmail/cf/mailer/usenet.m4 b/contrib/sendmail/cf/mailer/usenet.m4 index 18dcf75b5eb..e5f5fad9eb9 100644 --- a/contrib/sendmail/cf/mailer/usenet.m4 +++ b/contrib/sendmail/cf/mailer/usenet.m4 @@ -21,7 +21,7 @@ POPDIVERT ### USENET Mailer specification ### #################################### -VERSIONID(`$Id: usenet.m4,v 8.23 2013/11/22 20:51:14 ca Exp $') +VERSIONID(`$Id: usenet.m4,v 8.23 2013-11-22 20:51:14 ca Exp $') Musenet, P=USENET_MAILER_PATH, F=_MODMF_(USENET_MAILER_FLAGS, `USENET'), S=EnvFromL, R=EnvToL, _OPTINS(`USENET_MAILER_MAX', `M=', `, ')T=X-Usenet/X-Usenet/X-Unix,_USENET_QGRP diff --git a/contrib/sendmail/cf/mailer/uucp.m4 b/contrib/sendmail/cf/mailer/uucp.m4 index 0ee24733a33..81dfb186413 100644 --- a/contrib/sendmail/cf/mailer/uucp.m4 +++ b/contrib/sendmail/cf/mailer/uucp.m4 @@ -24,7 +24,7 @@ POPDIVERT ### UUCP Mailer specification ### ##################################### -VERSIONID(`$Id: uucp.m4,v 8.45 2013/11/22 20:51:14 ca Exp $') +VERSIONID(`$Id: uucp.m4,v 8.45 2013-11-22 20:51:14 ca Exp $') # # envelope and header sender rewriting diff --git a/contrib/sendmail/cf/ostype/a-ux.m4 b/contrib/sendmail/cf/ostype/a-ux.m4 index 5587bb37985..46e4c7332b0 100644 --- a/contrib/sendmail/cf/ostype/a-ux.m4 +++ b/contrib/sendmail/cf/ostype/a-ux.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: a-ux.m4,v 8.3 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: a-ux.m4,v 8.3 2013-11-22 20:51:15 ca Exp $') ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /usr/spool/mqueue)')dnl ifdef(`UUCP_MAILER_PATH',, `define(`UUCP_MAILER_PATH', /usr/bin/uux)')dnl _DEFIFNOT(`LOCAL_MAILER_FLAGS', `mn9')dnl diff --git a/contrib/sendmail/cf/ostype/aix3.m4 b/contrib/sendmail/cf/ostype/aix3.m4 index dd36f60fe73..3a8179c5558 100644 --- a/contrib/sendmail/cf/ostype/aix3.m4 +++ b/contrib/sendmail/cf/ostype/aix3.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: aix3.m4,v 8.17 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: aix3.m4,v 8.17 2013-11-22 20:51:15 ca Exp $') ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /bin/bellmail)')dnl ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', mail $u)')dnl _DEFIFNOT(`LOCAL_MAILER_FLAGS', `mn9')dnl diff --git a/contrib/sendmail/cf/ostype/aix4.m4 b/contrib/sendmail/cf/ostype/aix4.m4 index 35dac65db0e..be66682e82c 100644 --- a/contrib/sendmail/cf/ostype/aix4.m4 +++ b/contrib/sendmail/cf/ostype/aix4.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: aix4.m4,v 8.12 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: aix4.m4,v 8.12 2013-11-22 20:51:15 ca Exp $') ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /bin/bellmail)')dnl ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', mail -F $g $u)')dnl _DEFIFNOT(`LOCAL_MAILER_FLAGS', `mn9')dnl diff --git a/contrib/sendmail/cf/ostype/aix5.m4 b/contrib/sendmail/cf/ostype/aix5.m4 index 0131b924a85..c8007f3523c 100644 --- a/contrib/sendmail/cf/ostype/aix5.m4 +++ b/contrib/sendmail/cf/ostype/aix5.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: aix5.m4,v 1.2 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: aix5.m4,v 1.2 2013-11-22 20:51:15 ca Exp $') ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /bin/bellmail)')dnl ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', mail -F $g $u)')dnl _DEFIFNOT(`LOCAL_MAILER_FLAGS', `mn9')dnl diff --git a/contrib/sendmail/cf/ostype/altos.m4 b/contrib/sendmail/cf/ostype/altos.m4 index 7136343ecdb..0a7c6ed14f9 100644 --- a/contrib/sendmail/cf/ostype/altos.m4 +++ b/contrib/sendmail/cf/ostype/altos.m4 @@ -15,7 +15,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: altos.m4,v 8.16 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: altos.m4,v 8.16 2013-11-22 20:51:15 ca Exp $') ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /usr/spool/mqueue)')dnl ifdef(`UUCP_MAILER_PATH',, `define(`UUCP_MAILER_PATH', /usr/bin/uux)')dnl diff --git a/contrib/sendmail/cf/ostype/amdahl-uts.m4 b/contrib/sendmail/cf/ostype/amdahl-uts.m4 index 10ecae92845..05bc60ee618 100644 --- a/contrib/sendmail/cf/ostype/amdahl-uts.m4 +++ b/contrib/sendmail/cf/ostype/amdahl-uts.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: amdahl-uts.m4,v 8.17 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: amdahl-uts.m4,v 8.17 2013-11-22 20:51:15 ca Exp $') divert(-1) _DEFIFNOT(`LOCAL_MAILER_FLAGS', `fSn9') diff --git a/contrib/sendmail/cf/ostype/bsd4.3.m4 b/contrib/sendmail/cf/ostype/bsd4.3.m4 index bca8a190563..6db287efebe 100644 --- a/contrib/sendmail/cf/ostype/bsd4.3.m4 +++ b/contrib/sendmail/cf/ostype/bsd4.3.m4 @@ -13,6 +13,6 @@ divert(-1) # divert(0) -VERSIONID(`$Id: bsd4.3.m4,v 8.13 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: bsd4.3.m4,v 8.13 2013-11-22 20:51:15 ca Exp $') ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /usr/spool/mqueue)')dnl ifdef(`UUCP_MAILER_ARGS',, `define(`UUCP_MAILER_ARGS', `uux - -r -z -a$g $h!rmail ($u)')')dnl diff --git a/contrib/sendmail/cf/ostype/bsd4.4.m4 b/contrib/sendmail/cf/ostype/bsd4.4.m4 index 3f7bf2990d9..d1d3927d637 100644 --- a/contrib/sendmail/cf/ostype/bsd4.4.m4 +++ b/contrib/sendmail/cf/ostype/bsd4.4.m4 @@ -14,7 +14,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: bsd4.4.m4,v 8.15 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: bsd4.4.m4,v 8.15 2013-11-22 20:51:15 ca Exp $') ifdef(`STATUS_FILE',, `define(`STATUS_FILE', `/var/log/sendmail.st')')dnl ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /usr/libexec/mail.local)')dnl ifdef(`UUCP_MAILER_ARGS',, `define(`UUCP_MAILER_ARGS', `uux - -r -z -a$g $h!rmail ($u)')')dnl diff --git a/contrib/sendmail/cf/ostype/bsdi.m4 b/contrib/sendmail/cf/ostype/bsdi.m4 index e7b144d0b1b..de33cea9d0c 100644 --- a/contrib/sendmail/cf/ostype/bsdi.m4 +++ b/contrib/sendmail/cf/ostype/bsdi.m4 @@ -13,5 +13,5 @@ divert(-1) # divert(0) -VERSIONID(`$Id: bsdi.m4,v 8.2 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: bsdi.m4,v 8.2 2013-11-22 20:51:15 ca Exp $') include(_CF_DIR_`'ostype/bsd4.4.m4)dnl diff --git a/contrib/sendmail/cf/ostype/bsdi1.0.m4 b/contrib/sendmail/cf/ostype/bsdi1.0.m4 index 02a54862d5b..6860c5d68af 100644 --- a/contrib/sendmail/cf/ostype/bsdi1.0.m4 +++ b/contrib/sendmail/cf/ostype/bsdi1.0.m4 @@ -13,6 +13,6 @@ divert(-1) # divert(0) -VERSIONID(`$Id: bsdi1.0.m4,v 8.12 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: bsdi1.0.m4,v 8.12 2013-11-22 20:51:15 ca Exp $') errprint(`NOTE: OSTYPE(bsdi1.0) is deprecated. Use OSTYPE(bsdi) instead.') include(_CF_DIR_`'ostype/bsdi.m4)dnl diff --git a/contrib/sendmail/cf/ostype/bsdi2.0.m4 b/contrib/sendmail/cf/ostype/bsdi2.0.m4 index 43922fd263a..2b68124a55e 100644 --- a/contrib/sendmail/cf/ostype/bsdi2.0.m4 +++ b/contrib/sendmail/cf/ostype/bsdi2.0.m4 @@ -13,6 +13,6 @@ divert(-1) # divert(0) -VERSIONID(`$Id: bsdi2.0.m4,v 8.11 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: bsdi2.0.m4,v 8.11 2013-11-22 20:51:15 ca Exp $') errprint(`NOTE: OSTYPE(bsdi2.0) is deprecated. Use OSTYPE(bsdi) instead.') include(_CF_DIR_`'ostype/bsdi.m4)dnl diff --git a/contrib/sendmail/cf/ostype/darwin.m4 b/contrib/sendmail/cf/ostype/darwin.m4 index a5fb99a8d13..218d668cab2 100644 --- a/contrib/sendmail/cf/ostype/darwin.m4 +++ b/contrib/sendmail/cf/ostype/darwin.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: darwin.m4,v 8.5 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: darwin.m4,v 8.5 2013-11-22 20:51:15 ca Exp $') ifdef(`STATUS_FILE',, `define(`STATUS_FILE', `/var/log/sendmail.st')')dnl dnl turn on S flag for local mailer MODIFY_MAILER_FLAGS(`LOCAL', `+S')dnl diff --git a/contrib/sendmail/cf/ostype/dgux.m4 b/contrib/sendmail/cf/ostype/dgux.m4 index e9ffad2810a..856e47c3338 100644 --- a/contrib/sendmail/cf/ostype/dgux.m4 +++ b/contrib/sendmail/cf/ostype/dgux.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: dgux.m4,v 8.15 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: dgux.m4,v 8.15 2013-11-22 20:51:15 ca Exp $') _DEFIFNOT(`LOCAL_MAILER_FLAGS', `m9')dnl define(`confTIME_ZONE', `USE_TZ')dnl define(`confEBINDIR', `/usr/lib')dnl diff --git a/contrib/sendmail/cf/ostype/domainos.m4 b/contrib/sendmail/cf/ostype/domainos.m4 index c11cffb2f7b..b944ccd5b1d 100644 --- a/contrib/sendmail/cf/ostype/domainos.m4 +++ b/contrib/sendmail/cf/ostype/domainos.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: domainos.m4,v 8.15 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: domainos.m4,v 8.15 2013-11-22 20:51:15 ca Exp $') divert(-1) ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /usr/spool/mqueue)') diff --git a/contrib/sendmail/cf/ostype/dragonfly.m4 b/contrib/sendmail/cf/ostype/dragonfly.m4 index 05124aa0cdf..d9814673256 100644 --- a/contrib/sendmail/cf/ostype/dragonfly.m4 +++ b/contrib/sendmail/cf/ostype/dragonfly.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: dragonfly.m4,v 1.2 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: dragonfly.m4,v 1.2 2013-11-22 20:51:15 ca Exp $') ifdef(`STATUS_FILE',, `define(`STATUS_FILE', `/var/log/sendmail.st')')dnl dnl turn on S flag for local mailer MODIFY_MAILER_FLAGS(`LOCAL', `+S')dnl diff --git a/contrib/sendmail/cf/ostype/dynix3.2.m4 b/contrib/sendmail/cf/ostype/dynix3.2.m4 index 4ef2d962bb5..bb46231bf8f 100644 --- a/contrib/sendmail/cf/ostype/dynix3.2.m4 +++ b/contrib/sendmail/cf/ostype/dynix3.2.m4 @@ -13,6 +13,6 @@ divert(-1) # divert(0) -VERSIONID(`$Id: dynix3.2.m4,v 8.15 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: dynix3.2.m4,v 8.15 2013-11-22 20:51:15 ca Exp $') ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /usr/spool/mqueue)')dnl define(`confEBINDIR', `/usr/lib')dnl diff --git a/contrib/sendmail/cf/ostype/freebsd4.m4 b/contrib/sendmail/cf/ostype/freebsd4.m4 index 590bbae2315..a605e7bf95d 100644 --- a/contrib/sendmail/cf/ostype/freebsd4.m4 +++ b/contrib/sendmail/cf/ostype/freebsd4.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: freebsd4.m4,v 1.2 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: freebsd4.m4,v 1.2 2013-11-22 20:51:15 ca Exp $') ifdef(`STATUS_FILE',, `define(`STATUS_FILE', `/var/log/sendmail.st')')dnl dnl turn on S flag for local mailer MODIFY_MAILER_FLAGS(`LOCAL', `+S')dnl diff --git a/contrib/sendmail/cf/ostype/freebsd5.m4 b/contrib/sendmail/cf/ostype/freebsd5.m4 index 2dc90c4b308..41876319dfb 100644 --- a/contrib/sendmail/cf/ostype/freebsd5.m4 +++ b/contrib/sendmail/cf/ostype/freebsd5.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: freebsd5.m4,v 1.2 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: freebsd5.m4,v 1.2 2013-11-22 20:51:15 ca Exp $') ifdef(`STATUS_FILE',, `define(`STATUS_FILE', `/var/log/sendmail.st')')dnl dnl turn on S flag for local mailer MODIFY_MAILER_FLAGS(`LOCAL', `+S')dnl diff --git a/contrib/sendmail/cf/ostype/freebsd6.m4 b/contrib/sendmail/cf/ostype/freebsd6.m4 index 183e63ea174..8bdfff6b3d8 100644 --- a/contrib/sendmail/cf/ostype/freebsd6.m4 +++ b/contrib/sendmail/cf/ostype/freebsd6.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: freebsd6.m4,v 1.2 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: freebsd6.m4,v 1.2 2013-11-22 20:51:15 ca Exp $') ifdef(`STATUS_FILE',, `define(`STATUS_FILE', `/var/log/sendmail.st')')dnl dnl turn on S flag for local mailer MODIFY_MAILER_FLAGS(`LOCAL', `+S')dnl diff --git a/contrib/sendmail/cf/ostype/gnu.m4 b/contrib/sendmail/cf/ostype/gnu.m4 index e1db598297f..1e1bd52cfbc 100644 --- a/contrib/sendmail/cf/ostype/gnu.m4 +++ b/contrib/sendmail/cf/ostype/gnu.m4 @@ -14,7 +14,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: gnu.m4,v 8.14 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: gnu.m4,v 8.14 2013-11-22 20:51:15 ca Exp $') ifdef(`STATUS_FILE',, `define(`STATUS_FILE', `/var/log/sendmail.st')')dnl ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /libexec/mail.local)')dnl ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `mail $u')')dnl diff --git a/contrib/sendmail/cf/ostype/hpux10.m4 b/contrib/sendmail/cf/ostype/hpux10.m4 index ccfb9c0a76a..c59828cedaa 100644 --- a/contrib/sendmail/cf/ostype/hpux10.m4 +++ b/contrib/sendmail/cf/ostype/hpux10.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: hpux10.m4,v 8.20 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: hpux10.m4,v 8.20 2013-11-22 20:51:15 ca Exp $') ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /var/spool/mqueue)')dnl ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /usr/bin/rmail)')dnl diff --git a/contrib/sendmail/cf/ostype/hpux11.m4 b/contrib/sendmail/cf/ostype/hpux11.m4 index 1b7e2f02e51..32719a13eb7 100644 --- a/contrib/sendmail/cf/ostype/hpux11.m4 +++ b/contrib/sendmail/cf/ostype/hpux11.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: hpux11.m4,v 8.2 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: hpux11.m4,v 8.2 2013-11-22 20:51:15 ca Exp $') ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /usr/bin/rmail)')dnl _DEFIFNOT(`LOCAL_MAILER_FLAGS', `m9')dnl diff --git a/contrib/sendmail/cf/ostype/hpux9.m4 b/contrib/sendmail/cf/ostype/hpux9.m4 index a630c646398..d9fa69faf7d 100644 --- a/contrib/sendmail/cf/ostype/hpux9.m4 +++ b/contrib/sendmail/cf/ostype/hpux9.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: hpux9.m4,v 8.25 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: hpux9.m4,v 8.25 2013-11-22 20:51:15 ca Exp $') ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /usr/spool/mqueue)')dnl ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', `/bin/rmail')')dnl diff --git a/contrib/sendmail/cf/ostype/irix4.m4 b/contrib/sendmail/cf/ostype/irix4.m4 index d2c43677567..92c788fe0e4 100644 --- a/contrib/sendmail/cf/ostype/irix4.m4 +++ b/contrib/sendmail/cf/ostype/irix4.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: irix4.m4,v 8.20 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: irix4.m4,v 8.20 2013-11-22 20:51:15 ca Exp $') _DEFIFNOT(`LOCAL_MAILER_FLAGS', `Ehm9')dnl ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /usr/spool/mqueue)')dnl define(`confEBINDIR', `/usr/lib')dnl diff --git a/contrib/sendmail/cf/ostype/irix5.m4 b/contrib/sendmail/cf/ostype/irix5.m4 index 43b44275858..6ab821c1d41 100644 --- a/contrib/sendmail/cf/ostype/irix5.m4 +++ b/contrib/sendmail/cf/ostype/irix5.m4 @@ -29,7 +29,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: irix5.m4,v 8.17 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: irix5.m4,v 8.17 2013-11-22 20:51:15 ca Exp $') _DEFIFNOT(`LOCAL_MAILER_FLAGS', `Ehmu9')dnl ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `mail -s -d $u')')dnl ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /var/spool/mqueue)')dnl diff --git a/contrib/sendmail/cf/ostype/irix6.m4 b/contrib/sendmail/cf/ostype/irix6.m4 index a037b4c4293..b27dec49941 100644 --- a/contrib/sendmail/cf/ostype/irix6.m4 +++ b/contrib/sendmail/cf/ostype/irix6.m4 @@ -29,7 +29,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: irix6.m4,v 8.15 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: irix6.m4,v 8.15 2013-11-22 20:51:15 ca Exp $') _DEFIFNOT(`LOCAL_MAILER_FLAGS', `Ehmu9')dnl ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `mail -s -d $u')')dnl ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /var/spool/mqueue)')dnl diff --git a/contrib/sendmail/cf/ostype/isc4.1.m4 b/contrib/sendmail/cf/ostype/isc4.1.m4 index 85ef89470c2..8e91f9f3e0b 100644 --- a/contrib/sendmail/cf/ostype/isc4.1.m4 +++ b/contrib/sendmail/cf/ostype/isc4.1.m4 @@ -14,7 +14,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: isc4.1.m4,v 8.17 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: isc4.1.m4,v 8.17 2013-11-22 20:51:15 ca Exp $') ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `lmail -s $u')')dnl _DEFIFNOT(`LOCAL_MAILER_FLAGS', `humS9')dnl ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /bin/lmail)')dnl diff --git a/contrib/sendmail/cf/ostype/linux.m4 b/contrib/sendmail/cf/ostype/linux.m4 index e836e6caf19..9d2282a9902 100644 --- a/contrib/sendmail/cf/ostype/linux.m4 +++ b/contrib/sendmail/cf/ostype/linux.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: linux.m4,v 8.14 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: linux.m4,v 8.14 2013-11-22 20:51:15 ca Exp $') define(`confEBINDIR', `/usr/sbin') ifdef(`PROCMAIL_MAILER_PATH',, define(`PROCMAIL_MAILER_PATH', `/usr/bin/procmail')) diff --git a/contrib/sendmail/cf/ostype/maxion.m4 b/contrib/sendmail/cf/ostype/maxion.m4 index 4eea3d41278..271bb2d0453 100644 --- a/contrib/sendmail/cf/ostype/maxion.m4 +++ b/contrib/sendmail/cf/ostype/maxion.m4 @@ -16,7 +16,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: maxion.m4,v 8.18 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: maxion.m4,v 8.18 2013-11-22 20:51:15 ca Exp $') define(`QUEUE_DIR', `/var/spool/mqueue')dnl define(`STATUS_FILE', `/var/adm/log/sendmail.st')dnl diff --git a/contrib/sendmail/cf/ostype/mklinux.m4 b/contrib/sendmail/cf/ostype/mklinux.m4 index 5ecf1ea5e4f..a6dd04bb9fd 100644 --- a/contrib/sendmail/cf/ostype/mklinux.m4 +++ b/contrib/sendmail/cf/ostype/mklinux.m4 @@ -15,7 +15,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: mklinux.m4,v 8.16 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: mklinux.m4,v 8.16 2013-11-22 20:51:15 ca Exp $') define(`confEBINDIR', `/usr/sbin') ifdef(`STATUS_FILE',, `define(`STATUS_FILE', `/var/log/sendmail.st')') diff --git a/contrib/sendmail/cf/ostype/mpeix.m4 b/contrib/sendmail/cf/ostype/mpeix.m4 index ba9566a7189..3660df728e1 100644 --- a/contrib/sendmail/cf/ostype/mpeix.m4 +++ b/contrib/sendmail/cf/ostype/mpeix.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: mpeix.m4,v 1.2 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: mpeix.m4,v 1.2 2013-11-22 20:51:15 ca Exp $') ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', `/bin/tsmail')')dnl _DEFIFNOT(`LOCAL_MAILER_FLAGS', `mu9')dnl diff --git a/contrib/sendmail/cf/ostype/nextstep.m4 b/contrib/sendmail/cf/ostype/nextstep.m4 index e5e211b4ff5..4b8c9cd0c98 100644 --- a/contrib/sendmail/cf/ostype/nextstep.m4 +++ b/contrib/sendmail/cf/ostype/nextstep.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: nextstep.m4,v 8.22 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: nextstep.m4,v 8.22 2013-11-22 20:51:15 ca Exp $') ifdef(`UUCP_MAILER_PATH',, `define(`UUCP_MAILER_PATH', /usr/bin/uux)')dnl ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /usr/spool/mqueue)')dnl ifdef(`LOCAL_SHELL_FLAGS',, `define(`LOCAL_SHELL_FLAGS', `euP')')dnl diff --git a/contrib/sendmail/cf/ostype/openbsd.m4 b/contrib/sendmail/cf/ostype/openbsd.m4 index a058c3d6186..5e8f978268d 100644 --- a/contrib/sendmail/cf/ostype/openbsd.m4 +++ b/contrib/sendmail/cf/ostype/openbsd.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: openbsd.m4,v 8.4 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: openbsd.m4,v 8.4 2013-11-22 20:51:15 ca Exp $') ifdef(`STATUS_FILE',, `define(`STATUS_FILE', `/var/log/sendmail.st')')dnl ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /usr/libexec/mail.local)')dnl _DEFIFNOT(`LOCAL_MAILER_FLAGS', `rmn9S')dnl diff --git a/contrib/sendmail/cf/ostype/osf1.m4 b/contrib/sendmail/cf/ostype/osf1.m4 index 2941648b00f..01a8d17c9ba 100644 --- a/contrib/sendmail/cf/ostype/osf1.m4 +++ b/contrib/sendmail/cf/ostype/osf1.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: osf1.m4,v 8.17 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: osf1.m4,v 8.17 2013-11-22 20:51:15 ca Exp $') ifdef(`STATUS_FILE',, `define(`STATUS_FILE', `/usr/adm/sendmail/sendmail.st')')dnl define(`confDEF_USER_ID', `daemon') define(`confEBINDIR', `/usr/lbin')dnl diff --git a/contrib/sendmail/cf/ostype/powerux.m4 b/contrib/sendmail/cf/ostype/powerux.m4 index 484a2a83032..9084e2b2ae0 100644 --- a/contrib/sendmail/cf/ostype/powerux.m4 +++ b/contrib/sendmail/cf/ostype/powerux.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: powerux.m4,v 8.14 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: powerux.m4,v 8.14 2013-11-22 20:51:15 ca Exp $') define(`LOCAL_MAILER_PATH', `/usr/bin/rmail')dnl _DEFIFNOT(`LOCAL_MAILER_FLAGS', `mn9')dnl diff --git a/contrib/sendmail/cf/ostype/ptx2.m4 b/contrib/sendmail/cf/ostype/ptx2.m4 index 054d21adcf4..f619b44a522 100644 --- a/contrib/sendmail/cf/ostype/ptx2.m4 +++ b/contrib/sendmail/cf/ostype/ptx2.m4 @@ -15,7 +15,7 @@ divert(-1) # Support for DYNIX/ptx 2.x. divert(0) -VERSIONID(`$Id: ptx2.m4,v 8.18 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: ptx2.m4,v 8.18 2013-11-22 20:51:15 ca Exp $') ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /usr/spool/mqueue)')dnl define(`LOCAL_MAILER_PATH', `/bin/mail')dnl _DEFIFNOT(`LOCAL_MAILER_FLAGS', `fmn9')dnl diff --git a/contrib/sendmail/cf/ostype/qnx.m4 b/contrib/sendmail/cf/ostype/qnx.m4 index 972c33acc22..6d20310686b 100644 --- a/contrib/sendmail/cf/ostype/qnx.m4 +++ b/contrib/sendmail/cf/ostype/qnx.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: qnx.m4,v 8.14 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: qnx.m4,v 8.14 2013-11-22 20:51:15 ca Exp $') define(`QUEUE_DIR', /usr/spool/mqueue)dnl define(`LOCAL_MAILER_ARGS', `mail $u')dnl _DEFIFNOT(`LOCAL_MAILER_FLAGS', `Sh')dnl diff --git a/contrib/sendmail/cf/ostype/riscos4.5.m4 b/contrib/sendmail/cf/ostype/riscos4.5.m4 index 1d09e3796e7..1c2e7466af9 100644 --- a/contrib/sendmail/cf/ostype/riscos4.5.m4 +++ b/contrib/sendmail/cf/ostype/riscos4.5.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: riscos4.5.m4,v 8.16 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: riscos4.5.m4,v 8.16 2013-11-22 20:51:15 ca Exp $') ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `rmail -d $u')')dnl ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', `/usr/spool/mqueue')')dnl diff --git a/contrib/sendmail/cf/ostype/sco-uw-2.1.m4 b/contrib/sendmail/cf/ostype/sco-uw-2.1.m4 index be5bcb94df7..5c6997bbf0e 100644 --- a/contrib/sendmail/cf/ostype/sco-uw-2.1.m4 +++ b/contrib/sendmail/cf/ostype/sco-uw-2.1.m4 @@ -13,7 +13,7 @@ divert(-1) # Contributed by Christopher Durham of SCO. # divert(0) -VERSIONID(`$Id: sco-uw-2.1.m4,v 8.14 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: sco-uw-2.1.m4,v 8.14 2013-11-22 20:51:15 ca Exp $') define(`LOCAL_MAILER_PATH', `/usr/bin/rmail')dnl _DEFIFNOT(`LOCAL_MAILER_FLAGS', `fhCEn9')dnl diff --git a/contrib/sendmail/cf/ostype/sco3.2.m4 b/contrib/sendmail/cf/ostype/sco3.2.m4 index 6e650a720d0..2d17251774d 100644 --- a/contrib/sendmail/cf/ostype/sco3.2.m4 +++ b/contrib/sendmail/cf/ostype/sco3.2.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: sco3.2.m4,v 8.17 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: sco3.2.m4,v 8.17 2013-11-22 20:51:15 ca Exp $') ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /usr/spool/mqueue)')dnl ifdef(`UUCP_MAILER_PATH',, `define(`UUCP_MAILER_PATH', /usr/bin/uux)')dnl ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /usr/bin/lmail)')dnl diff --git a/contrib/sendmail/cf/ostype/sinix.m4 b/contrib/sendmail/cf/ostype/sinix.m4 index b10c4d53285..a40f11c1df7 100644 --- a/contrib/sendmail/cf/ostype/sinix.m4 +++ b/contrib/sendmail/cf/ostype/sinix.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: sinix.m4,v 8.14 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: sinix.m4,v 8.14 2013-11-22 20:51:15 ca Exp $') ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /var/spool/mqueue)')dnl define(`LOCAL_MAILER_PATH', `/bin/mail.local')dnl ifdef(`STATUS_FILE',, `define(`STATUS_FILE', `/var/sendmail.st')')dnl diff --git a/contrib/sendmail/cf/ostype/solaris11.m4 b/contrib/sendmail/cf/ostype/solaris11.m4 index be2517b22e2..1ca1fa6487d 100644 --- a/contrib/sendmail/cf/ostype/solaris11.m4 +++ b/contrib/sendmail/cf/ostype/solaris11.m4 @@ -12,7 +12,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: solaris11.m4,v 1.2 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: solaris11.m4,v 1.2 2013-11-22 20:51:15 ca Exp $') divert(-1) ifdef(`UUCP_MAILER_ARGS',, `define(`UUCP_MAILER_ARGS', `uux - -r -a$g $h!rmail ($u)')') diff --git a/contrib/sendmail/cf/ostype/solaris2.m4 b/contrib/sendmail/cf/ostype/solaris2.m4 index d3df61b3199..1a7314f5e4f 100644 --- a/contrib/sendmail/cf/ostype/solaris2.m4 +++ b/contrib/sendmail/cf/ostype/solaris2.m4 @@ -17,7 +17,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: solaris2.m4,v 8.23 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: solaris2.m4,v 8.23 2013-11-22 20:51:15 ca Exp $') divert(-1) ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', `/usr/lib/mail.local')') diff --git a/contrib/sendmail/cf/ostype/solaris2.ml.m4 b/contrib/sendmail/cf/ostype/solaris2.ml.m4 index 4023898d1f5..bf38a60c66f 100644 --- a/contrib/sendmail/cf/ostype/solaris2.ml.m4 +++ b/contrib/sendmail/cf/ostype/solaris2.ml.m4 @@ -17,7 +17,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: solaris2.ml.m4,v 8.15 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: solaris2.ml.m4,v 8.15 2013-11-22 20:51:15 ca Exp $') divert(-1) ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', `/usr/lib/mail.local')') diff --git a/contrib/sendmail/cf/ostype/solaris2.pre5.m4 b/contrib/sendmail/cf/ostype/solaris2.pre5.m4 index 2a5007f38ea..24618adde59 100644 --- a/contrib/sendmail/cf/ostype/solaris2.pre5.m4 +++ b/contrib/sendmail/cf/ostype/solaris2.pre5.m4 @@ -17,7 +17,7 @@ divert(-1) divert(0) -VERSIONID(`$Id: solaris2.pre5.m4,v 8.2 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: solaris2.pre5.m4,v 8.2 2013-11-22 20:51:15 ca Exp $') divert(-1) _DEFIFNOT(`LOCAL_MAILER_FLAGS', `SnE9') diff --git a/contrib/sendmail/cf/ostype/solaris8.m4 b/contrib/sendmail/cf/ostype/solaris8.m4 index 33f0af7c33b..6ebb2d68ae7 100644 --- a/contrib/sendmail/cf/ostype/solaris8.m4 +++ b/contrib/sendmail/cf/ostype/solaris8.m4 @@ -15,7 +15,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: solaris8.m4,v 8.3 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: solaris8.m4,v 8.3 2013-11-22 20:51:15 ca Exp $') divert(-1) ifdef(`UUCP_MAILER_ARGS',, `define(`UUCP_MAILER_ARGS', `uux - -r -a$g $h!rmail ($u)')') diff --git a/contrib/sendmail/cf/ostype/sunos3.5.m4 b/contrib/sendmail/cf/ostype/sunos3.5.m4 index 64455286b30..4b2d99b0533 100644 --- a/contrib/sendmail/cf/ostype/sunos3.5.m4 +++ b/contrib/sendmail/cf/ostype/sunos3.5.m4 @@ -13,6 +13,6 @@ divert(-1) # divert(0) -VERSIONID(`$Id: sunos3.5.m4,v 8.11 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: sunos3.5.m4,v 8.11 2013-11-22 20:51:15 ca Exp $') define(`confEBINDIR', `/usr/lib')dnl diff --git a/contrib/sendmail/cf/ostype/sunos4.1.m4 b/contrib/sendmail/cf/ostype/sunos4.1.m4 index 4f2e8163029..3a699077923 100644 --- a/contrib/sendmail/cf/ostype/sunos4.1.m4 +++ b/contrib/sendmail/cf/ostype/sunos4.1.m4 @@ -13,6 +13,6 @@ divert(-1) # divert(0) -VERSIONID(`$Id: sunos4.1.m4,v 8.11 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: sunos4.1.m4,v 8.11 2013-11-22 20:51:15 ca Exp $') define(`confEBINDIR', `/usr/lib')dnl diff --git a/contrib/sendmail/cf/ostype/svr4.m4 b/contrib/sendmail/cf/ostype/svr4.m4 index de608ad8ff9..39faa5a4b39 100644 --- a/contrib/sendmail/cf/ostype/svr4.m4 +++ b/contrib/sendmail/cf/ostype/svr4.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: svr4.m4,v 8.18 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: svr4.m4,v 8.18 2013-11-22 20:51:15 ca Exp $') define(`LOCAL_MAILER_PATH', `/usr/ucblib/binmail')dnl define(`LOCAL_SHELL_FLAGS', `ehuP')dnl diff --git a/contrib/sendmail/cf/ostype/ultrix4.m4 b/contrib/sendmail/cf/ostype/ultrix4.m4 index 2a5a0dc0999..9cd7782b7cc 100644 --- a/contrib/sendmail/cf/ostype/ultrix4.m4 +++ b/contrib/sendmail/cf/ostype/ultrix4.m4 @@ -13,6 +13,6 @@ divert(-1) # divert(0) -VERSIONID(`$Id: ultrix4.m4,v 8.12 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: ultrix4.m4,v 8.12 2013-11-22 20:51:15 ca Exp $') define(`confEBINDIR', `/usr/lib')dnl diff --git a/contrib/sendmail/cf/ostype/unicos.m4 b/contrib/sendmail/cf/ostype/unicos.m4 index 180857a0c11..1764d7157bd 100644 --- a/contrib/sendmail/cf/ostype/unicos.m4 +++ b/contrib/sendmail/cf/ostype/unicos.m4 @@ -11,7 +11,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: unicos.m4,v 1.2 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: unicos.m4,v 1.2 2013-11-22 20:51:15 ca Exp $') define(`ALIAS_FILE', `/usr/lib/aliases') define(`HELP_FILE', `/usr/lib/sendmail.hf') define(`QUEUE_DIR', `/usr/spool/mqueue') diff --git a/contrib/sendmail/cf/ostype/unicosmk.m4 b/contrib/sendmail/cf/ostype/unicosmk.m4 index 39897e7fe72..482b4708307 100644 --- a/contrib/sendmail/cf/ostype/unicosmk.m4 +++ b/contrib/sendmail/cf/ostype/unicosmk.m4 @@ -11,7 +11,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: unicosmk.m4,v 1.2 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: unicosmk.m4,v 1.2 2013-11-22 20:51:15 ca Exp $') define(`ALIAS_FILE', `/usr/lib/aliases') define(`HELP_FILE', `/usr/lib/sendmail.hf') define(`QUEUE_DIR', `/usr/spool/mqueue') diff --git a/contrib/sendmail/cf/ostype/unicosmp.m4 b/contrib/sendmail/cf/ostype/unicosmp.m4 index dd724697210..b988ade84ef 100644 --- a/contrib/sendmail/cf/ostype/unicosmp.m4 +++ b/contrib/sendmail/cf/ostype/unicosmp.m4 @@ -17,7 +17,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: unicosmp.m4,v 1.2 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: unicosmp.m4,v 1.2 2013-11-22 20:51:15 ca Exp $') _DEFIFNOT(`LOCAL_MAILER_FLAGS', `Ehm9')dnl ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `mail -s -d $u')')dnl ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /var/spool/mqueue)')dnl diff --git a/contrib/sendmail/cf/ostype/unixware7.m4 b/contrib/sendmail/cf/ostype/unixware7.m4 index 21d5a164d06..63d4777e407 100644 --- a/contrib/sendmail/cf/ostype/unixware7.m4 +++ b/contrib/sendmail/cf/ostype/unixware7.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: unixware7.m4,v 8.9 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: unixware7.m4,v 8.9 2013-11-22 20:51:15 ca Exp $') ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /var/spool/mqueue)')dnl define(`confEBINDIR', `/usr/lib')dnl define(`confTIME_ZONE', `USE_TZ')dnl diff --git a/contrib/sendmail/cf/ostype/unknown.m4 b/contrib/sendmail/cf/ostype/unknown.m4 index 58e10368dc7..56dc75e81a1 100644 --- a/contrib/sendmail/cf/ostype/unknown.m4 +++ b/contrib/sendmail/cf/ostype/unknown.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: unknown.m4,v 8.10 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: unknown.m4,v 8.10 2013-11-22 20:51:15 ca Exp $') errprint(`*** ERROR: You have not specified a valid operating system type.') errprint(` Use the OSTYPE macro to select a valid system type. This') errprint(` is necessary in order to get the proper pathnames and flags') diff --git a/contrib/sendmail/cf/ostype/uxpds.m4 b/contrib/sendmail/cf/ostype/uxpds.m4 index 8cc393a7bc9..e768d0dee39 100644 --- a/contrib/sendmail/cf/ostype/uxpds.m4 +++ b/contrib/sendmail/cf/ostype/uxpds.m4 @@ -16,7 +16,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: uxpds.m4,v 8.17 2013/11/22 20:51:15 ca Exp $') +VERSIONID(`$Id: uxpds.m4,v 8.17 2013-11-22 20:51:15 ca Exp $') define(`confDEF_GROUP_ID', `6') define(`LOCAL_MAILER_PATH', `/usr/ucblib/binmail')dnl diff --git a/contrib/sendmail/cf/sendmail.schema b/contrib/sendmail/cf/sendmail.schema index 4c782877aa0..eeacf9c0ae6 100644 --- a/contrib/sendmail/cf/sendmail.schema +++ b/contrib/sendmail/cf/sendmail.schema @@ -5,7 +5,7 @@ # forth in the LICENSE file which can be found at the top level of # the sendmail distribution. # -# $Id: sendmail.schema,v 8.23 2013/11/22 20:51:07 ca Exp $ +# $Id: sendmail.schema,v 8.23 2013-11-22 20:51:07 ca Exp $ # Note that this schema is experimental at this point as it has had little # public review. Therefore, it may change in future versions. Feedback diff --git a/contrib/sendmail/cf/sh/makeinfo.sh b/contrib/sendmail/cf/sh/makeinfo.sh index 625709e47f5..1c907ccd68f 100644 --- a/contrib/sendmail/cf/sh/makeinfo.sh +++ b/contrib/sendmail/cf/sh/makeinfo.sh @@ -11,7 +11,7 @@ # the sendmail distribution. # # -# $Id: makeinfo.sh,v 8.15 2013/11/22 20:51:17 ca Exp $ +# $Id: makeinfo.sh,v 8.15 2013-11-22 20:51:17 ca Exp $ # # $FreeBSD$ # diff --git a/contrib/sendmail/contrib/README b/contrib/sendmail/contrib/README index 1098f48ea52..eb98987f8e6 100644 --- a/contrib/sendmail/contrib/README +++ b/contrib/sendmail/contrib/README @@ -7,4 +7,4 @@ care -- some of the patches may be out of date with the latest release of sendmail. Also, the previous comment applies -- patches belong to the original author, not to us. -$Revision: 8.2 $, Last updated $Date: 1999/09/24 05:46:47 $ +$Revision: 8.2 $, Last updated $Date: 1999-09-24 05:46:47 $ diff --git a/contrib/sendmail/contrib/bsdi.mc b/contrib/sendmail/contrib/bsdi.mc index 5175a34a303..acd197d5250 100644 --- a/contrib/sendmail/contrib/bsdi.mc +++ b/contrib/sendmail/contrib/bsdi.mc @@ -35,7 +35,7 @@ and examples describing most of the common things people need to setup. # See /usr/share/sendmail/README for help in building a configuration file. # include(`../m4/cf.m4') -VERSIONID(`@(#)$Id: bsdi.mc,v 8.1 1999/02/06 18:44:08 gshapiro Exp $') +VERSIONID(`@(#)$Id: bsdi.mc,v 8.1 1999-02-06 18:44:08 gshapiro Exp $') dnl # Specify your OS type below OSTYPE(`bsd4.4') diff --git a/contrib/sendmail/contrib/buildvirtuser b/contrib/sendmail/contrib/buildvirtuser index a35a6e71e93..173f95b0cc8 100755 --- a/contrib/sendmail/contrib/buildvirtuser +++ b/contrib/sendmail/contrib/buildvirtuser @@ -27,7 +27,7 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. -# $Id: buildvirtuser,v 1.8 2007/10/08 18:44:15 gshapiro Exp $ +# $Id: buildvirtuser,v 1.8 2007-10-08 18:44:15 gshapiro Exp $ =head1 NAME diff --git a/contrib/sendmail/contrib/cidrexpand b/contrib/sendmail/contrib/cidrexpand index f277481ca56..efa5323a010 100755 --- a/contrib/sendmail/contrib/cidrexpand +++ b/contrib/sendmail/contrib/cidrexpand @@ -1,6 +1,6 @@ #!/usr/bin/perl -w -# $Id: cidrexpand,v 8.8 2006/08/07 17:18:37 ca Exp $ +# $Id: cidrexpand,v 8.8 2006-08-07 17:18:37 ca Exp $ # # v 0.4 # diff --git a/contrib/sendmail/contrib/dnsblaccess.m4 b/contrib/sendmail/contrib/dnsblaccess.m4 index c90fc3b96bb..da8e13a0a6a 100644 --- a/contrib/sendmail/contrib/dnsblaccess.m4 +++ b/contrib/sendmail/contrib/dnsblaccess.m4 @@ -59,7 +59,7 @@ dnl ## address returned does not begin 127, then the mail is dnl ## processed as if the HACK line were not present. divert(0) -VERSIONID(`$Id: dnsblaccess.m4,v 1.7 2013/11/22 20:51:18 ca Exp $') +VERSIONID(`$Id: dnsblaccess.m4,v 1.7 2013-11-22 20:51:18 ca Exp $') ifdef(`_ACCESS_TABLE_', `dnl', `errprint(`*** ERROR: dnsblaccess requires FEATURE(`access_db') ')') diff --git a/contrib/sendmail/contrib/link_hash.sh b/contrib/sendmail/contrib/link_hash.sh index a89350c0296..7948f69d3a3 100644 --- a/contrib/sendmail/contrib/link_hash.sh +++ b/contrib/sendmail/contrib/link_hash.sh @@ -3,7 +3,7 @@ ## Copyright (c) 2000 Proofpoint, Inc. and its suppliers. ## All rights reserved. ## -## $Id: link_hash.sh,v 1.3 2013/11/22 20:51:18 ca Exp $ +## $Id: link_hash.sh,v 1.3 2013-11-22 20:51:18 ca Exp $ ## # # ln a certificate to its hash diff --git a/contrib/sendmail/contrib/qtool.8 b/contrib/sendmail/contrib/qtool.8 index 6676569247d..1b1856ec8ff 100644 --- a/contrib/sendmail/contrib/qtool.8 +++ b/contrib/sendmail/contrib/qtool.8 @@ -6,9 +6,9 @@ .\" the sendmail distribution. .\" .\" -.\" $Id: qtool.8,v 8.21 2013/11/22 20:51:18 ca Exp $ +.\" $Id: qtool.8,v 8.21 2013-11-22 20:51:18 ca Exp $ .\" -.TH QTOOL 8 "$Date: 2013/11/22 20:51:18 $" +.TH QTOOL 8 "$Date: 2013-11-22 20:51:18 $" .SH NAME qtool \- manipulate sendmail queues diff --git a/contrib/sendmail/contrib/qtool.pl b/contrib/sendmail/contrib/qtool.pl index 647da1a53a8..12a4f8084bf 100755 --- a/contrib/sendmail/contrib/qtool.pl +++ b/contrib/sendmail/contrib/qtool.pl @@ -3,7 +3,7 @@ ## Copyright (c) 1998-2002 Proofpoint, Inc. and its suppliers. ## All rights reserved. ## -## $Id: qtool.pl,v 8.32 2013/11/22 20:51:18 ca Exp $ +## $Id: qtool.pl,v 8.32 2013-11-22 20:51:18 ca Exp $ ## use strict; use File::Basename; diff --git a/contrib/sendmail/contrib/smcontrol.pl b/contrib/sendmail/contrib/smcontrol.pl index 43ae5759132..ec4635f5dd5 100755 --- a/contrib/sendmail/contrib/smcontrol.pl +++ b/contrib/sendmail/contrib/smcontrol.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -w -# $Id: smcontrol.pl,v 8.8 2008/07/21 21:31:43 ca Exp $ +# $Id: smcontrol.pl,v 8.8 2008-07-21 21:31:43 ca Exp $ use strict; use Getopt::Std; diff --git a/contrib/sendmail/contrib/socketmapClient.pl b/contrib/sendmail/contrib/socketmapClient.pl index 28fe603980a..ac86439a009 100755 --- a/contrib/sendmail/contrib/socketmapClient.pl +++ b/contrib/sendmail/contrib/socketmapClient.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # # Contributed by Bastiaan Bakker for SOCKETMAP -# $Id: socketmapClient.pl,v 1.1 2003/05/21 15:36:33 ca Exp $ +# $Id: socketmapClient.pl,v 1.1 2003-05-21 15:36:33 ca Exp $ use strict; use IO::Socket; diff --git a/contrib/sendmail/contrib/socketmapServer.pl b/contrib/sendmail/contrib/socketmapServer.pl index 153e9ef0abe..3a9b5ec2522 100755 --- a/contrib/sendmail/contrib/socketmapServer.pl +++ b/contrib/sendmail/contrib/socketmapServer.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # # Contributed by Bastiaan Bakker for SOCKETMAP -# $Id: socketmapServer.pl,v 1.1 2003/05/21 15:36:33 ca Exp $ +# $Id: socketmapServer.pl,v 1.1 2003-05-21 15:36:33 ca Exp $ use strict; use IO::Socket; diff --git a/contrib/sendmail/doc/op/Makefile b/contrib/sendmail/doc/op/Makefile index 7d93e618fb0..47673b47a13 100644 --- a/contrib/sendmail/doc/op/Makefile +++ b/contrib/sendmail/doc/op/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 8.16 2006/01/05 22:03:31 ca Exp $ +# $Id: Makefile,v 8.16 2006-01-05 22:03:31 ca Exp $ DIR= smm/08.sendmailop SRCS= op.me diff --git a/contrib/sendmail/doc/op/README b/contrib/sendmail/doc/op/README index 9ad8f5a9d67..f0e72b213a8 100644 --- a/contrib/sendmail/doc/op/README +++ b/contrib/sendmail/doc/op/README @@ -10,4 +10,4 @@ variable (see grotty(1) man page), e.g., csh% setenv GROFF_NO_SGR 1 sh$ GROFF_NO_SGR=1; export GROFF_NO_SGR -$Id: README,v 8.1 2004/07/20 20:25:10 ca Exp $ +$Id: README,v 8.1 2004-07-20 20:25:10 ca Exp $ diff --git a/contrib/sendmail/doc/op/op.me b/contrib/sendmail/doc/op/op.me index ddc6568f724..7534667ddf7 100644 --- a/contrib/sendmail/doc/op/op.me +++ b/contrib/sendmail/doc/op/op.me @@ -9,7 +9,7 @@ .\" the sendmail distribution. .\" .\" -.\" $Id: op.me,v 8.759 2014/01/13 14:40:05 ca Exp $ +.\" $Id: op.me,v 8.759 2014-01-13 14:40:05 ca Exp $ .\" .\" eqn op.me | pic | troff -me .\" diff --git a/contrib/sendmail/editmap/Makefile b/contrib/sendmail/editmap/Makefile index 965e0293bcd..f08d5a7ccde 100644 --- a/contrib/sendmail/editmap/Makefile +++ b/contrib/sendmail/editmap/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.1 2000/08/31 16:19:25 ca Exp $ +# $Id: Makefile,v 1.1 2000-08-31 16:19:25 ca Exp $ SHELL= /bin/sh BUILD= ./Build diff --git a/contrib/sendmail/editmap/Makefile.m4 b/contrib/sendmail/editmap/Makefile.m4 index 120aa7827d3..214b4b880da 100644 --- a/contrib/sendmail/editmap/Makefile.m4 +++ b/contrib/sendmail/editmap/Makefile.m4 @@ -1,4 +1,4 @@ -dnl $Id: Makefile.m4,v 1.6 2006/06/28 21:08:01 ca Exp $ +dnl $Id: Makefile.m4,v 1.6 2006-06-28 21:08:01 ca Exp $ include(confBUILDTOOLSDIR`/M4/switch.m4') define(`confREQUIRE_LIBSM', `true') diff --git a/contrib/sendmail/editmap/editmap.8 b/contrib/sendmail/editmap/editmap.8 index 99f8b636ab3..db72102a215 100644 --- a/contrib/sendmail/editmap/editmap.8 +++ b/contrib/sendmail/editmap/editmap.8 @@ -6,9 +6,9 @@ .\" the sendmail distribution. .\" .\" -.\" $Id: editmap.8,v 1.10 2013/11/22 20:51:26 ca Exp $ +.\" $Id: editmap.8,v 1.10 2013-11-22 20:51:26 ca Exp $ .\" -.TH EDITMAP 8 "$Date: 2013/11/22 20:51:26 $" +.TH EDITMAP 8 "$Date: 2013-11-22 20:51:26 $" .SH NAME .B editmap \- query and edit single records in database maps for sendmail diff --git a/contrib/sendmail/editmap/editmap.c b/contrib/sendmail/editmap/editmap.c index 5e65f40f195..3c1b8b9a8c5 100644 --- a/contrib/sendmail/editmap/editmap.c +++ b/contrib/sendmail/editmap/editmap.c @@ -22,7 +22,7 @@ SM_UNUSED(static char copyright[]) = #endif /* ! lint */ #ifndef lint -SM_UNUSED(static char id[]) = "@(#)$Id: editmap.c,v 1.26 2013/11/22 20:51:26 ca Exp $"; +SM_UNUSED(static char id[]) = "@(#)$Id: editmap.c,v 1.26 2013-11-22 20:51:26 ca Exp $"; #endif /* ! lint */ diff --git a/contrib/sendmail/include/libmilter/mfapi.h b/contrib/sendmail/include/libmilter/mfapi.h index 01636047f24..039a16a9448 100644 --- a/contrib/sendmail/include/libmilter/mfapi.h +++ b/contrib/sendmail/include/libmilter/mfapi.h @@ -7,7 +7,7 @@ * the sendmail distribution. * * - * $Id: mfapi.h,v 8.83 2013/11/22 20:51:27 ca Exp $ + * $Id: mfapi.h,v 8.83 2013-11-22 20:51:27 ca Exp $ */ /* diff --git a/contrib/sendmail/include/libmilter/mfdef.h b/contrib/sendmail/include/libmilter/mfdef.h index 52aa025ecc9..7dc9d5eb434 100644 --- a/contrib/sendmail/include/libmilter/mfdef.h +++ b/contrib/sendmail/include/libmilter/mfdef.h @@ -7,7 +7,7 @@ * the sendmail distribution. * * - * $Id: mfdef.h,v 8.40 2013/11/22 20:51:27 ca Exp $ + * $Id: mfdef.h,v 8.40 2013-11-22 20:51:27 ca Exp $ */ /* diff --git a/contrib/sendmail/include/libmilter/milter.h b/contrib/sendmail/include/libmilter/milter.h index b73af02b16a..38bcecfb7da 100644 --- a/contrib/sendmail/include/libmilter/milter.h +++ b/contrib/sendmail/include/libmilter/milter.h @@ -7,7 +7,7 @@ * the sendmail distribution. * * - * $Id: milter.h,v 8.42 2013/11/22 20:51:27 ca Exp $ + * $Id: milter.h,v 8.42 2013-11-22 20:51:27 ca Exp $ */ /* diff --git a/contrib/sendmail/include/libsmdb/smdb.h b/contrib/sendmail/include/libsmdb/smdb.h index 7abbd1245cc..a1df6d7ae80 100644 --- a/contrib/sendmail/include/libsmdb/smdb.h +++ b/contrib/sendmail/include/libsmdb/smdb.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: smdb.h,v 8.42 2013/11/22 20:51:28 ca Exp $ + * $Id: smdb.h,v 8.42 2013-11-22 20:51:28 ca Exp $ * */ diff --git a/contrib/sendmail/include/sendmail/mailstats.h b/contrib/sendmail/include/sendmail/mailstats.h index 9906974d15e..a4606ae5cdd 100644 --- a/contrib/sendmail/include/sendmail/mailstats.h +++ b/contrib/sendmail/include/sendmail/mailstats.h @@ -10,7 +10,7 @@ * the sendmail distribution. * * - * $Id: mailstats.h,v 8.20 2013/11/22 20:51:30 ca Exp $ + * $Id: mailstats.h,v 8.20 2013-11-22 20:51:30 ca Exp $ */ #define STAT_VERSION 4 diff --git a/contrib/sendmail/include/sendmail/pathnames.h b/contrib/sendmail/include/sendmail/pathnames.h index 6d637d9f54b..1e7bab58ccf 100644 --- a/contrib/sendmail/include/sendmail/pathnames.h +++ b/contrib/sendmail/include/sendmail/pathnames.h @@ -9,7 +9,7 @@ * the sendmail distribution. * * - * $Id: pathnames.h,v 8.37 2013/11/22 20:51:30 ca Exp $ + * $Id: pathnames.h,v 8.37 2013-11-22 20:51:30 ca Exp $ */ #ifndef SM_PATHNAMES_H diff --git a/contrib/sendmail/include/sendmail/sendmail.h b/contrib/sendmail/include/sendmail/sendmail.h index 790cc338ad6..fbd85d3b1f9 100644 --- a/contrib/sendmail/include/sendmail/sendmail.h +++ b/contrib/sendmail/include/sendmail/sendmail.h @@ -10,7 +10,7 @@ * the sendmail distribution. * * - * $Id: sendmail.h,v 8.69 2013/11/22 20:51:30 ca Exp $ + * $Id: sendmail.h,v 8.69 2013-11-22 20:51:30 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/assert.h b/contrib/sendmail/include/sm/assert.h index 4855032a17c..9d0ae54e627 100644 --- a/contrib/sendmail/include/sm/assert.h +++ b/contrib/sendmail/include/sm/assert.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: assert.h,v 1.11 2013/11/22 20:51:31 ca Exp $ + * $Id: assert.h,v 1.11 2013-11-22 20:51:31 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/bdb.h b/contrib/sendmail/include/sm/bdb.h index add683b5703..a8a977a8294 100644 --- a/contrib/sendmail/include/sm/bdb.h +++ b/contrib/sendmail/include/sm/bdb.h @@ -7,7 +7,7 @@ * the sendmail distribution. * * - * $Id: bdb.h,v 1.5 2013/11/22 20:51:31 ca Exp $ + * $Id: bdb.h,v 1.5 2013-11-22 20:51:31 ca Exp $ */ #ifndef SM_BDB_H diff --git a/contrib/sendmail/include/sm/bitops.h b/contrib/sendmail/include/sm/bitops.h index 77d987a9f4a..93cf2ce59bf 100644 --- a/contrib/sendmail/include/sm/bitops.h +++ b/contrib/sendmail/include/sm/bitops.h @@ -10,7 +10,7 @@ * the sendmail distribution. * * - * $Id: bitops.h,v 1.3 2013/11/22 20:51:31 ca Exp $ + * $Id: bitops.h,v 1.3 2013-11-22 20:51:31 ca Exp $ */ #ifndef SM_BITOPS_H diff --git a/contrib/sendmail/include/sm/cdefs.h b/contrib/sendmail/include/sm/cdefs.h index 125c0496ca8..d288aa0f71c 100644 --- a/contrib/sendmail/include/sm/cdefs.h +++ b/contrib/sendmail/include/sm/cdefs.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: cdefs.h,v 1.17 2013/11/22 20:51:31 ca Exp $ + * $Id: cdefs.h,v 1.17 2013-11-22 20:51:31 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/cf.h b/contrib/sendmail/include/sm/cf.h index f950b99a500..c619ddf9026 100644 --- a/contrib/sendmail/include/sm/cf.h +++ b/contrib/sendmail/include/sm/cf.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: cf.h,v 1.3 2013/11/22 20:51:31 ca Exp $ + * $Id: cf.h,v 1.3 2013-11-22 20:51:31 ca Exp $ */ #ifndef SM_CF_H diff --git a/contrib/sendmail/include/sm/clock.h b/contrib/sendmail/include/sm/clock.h index 8b3636e3a34..2c7a8e45e45 100644 --- a/contrib/sendmail/include/sm/clock.h +++ b/contrib/sendmail/include/sm/clock.h @@ -9,7 +9,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: clock.h,v 1.14 2013/11/22 20:51:31 ca Exp $ + * $Id: clock.h,v 1.14 2013-11-22 20:51:31 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/conf.h b/contrib/sendmail/include/sm/conf.h index 179be7aefd4..bea380aad49 100644 --- a/contrib/sendmail/include/sm/conf.h +++ b/contrib/sendmail/include/sm/conf.h @@ -10,7 +10,7 @@ * the sendmail distribution. * * - * $Id: conf.h,v 1.147 2013/11/22 20:51:31 ca Exp $ + * $Id: conf.h,v 1.147 2013-11-22 20:51:31 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/config.h b/contrib/sendmail/include/sm/config.h index 7a7331f2209..451f1360612 100644 --- a/contrib/sendmail/include/sm/config.h +++ b/contrib/sendmail/include/sm/config.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: config.h,v 1.49 2013/11/22 20:51:31 ca Exp $ + * $Id: config.h,v 1.49 2013-11-22 20:51:31 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/debug.h b/contrib/sendmail/include/sm/debug.h index e67cf47dd31..9c7bb803d12 100644 --- a/contrib/sendmail/include/sm/debug.h +++ b/contrib/sendmail/include/sm/debug.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: debug.h,v 1.17 2013/11/22 20:51:31 ca Exp $ + * $Id: debug.h,v 1.17 2013-11-22 20:51:31 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/errstring.h b/contrib/sendmail/include/sm/errstring.h index 952b57da7df..836fe14f70c 100644 --- a/contrib/sendmail/include/sm/errstring.h +++ b/contrib/sendmail/include/sm/errstring.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: errstring.h,v 1.11 2013/11/22 20:51:31 ca Exp $ + * $Id: errstring.h,v 1.11 2013-11-22 20:51:31 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/exc.h b/contrib/sendmail/include/sm/exc.h index 36dde2efef9..f7928a9f491 100644 --- a/contrib/sendmail/include/sm/exc.h +++ b/contrib/sendmail/include/sm/exc.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: exc.h,v 1.24 2013/11/22 20:51:31 ca Exp $ + * $Id: exc.h,v 1.24 2013-11-22 20:51:31 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/fdset.h b/contrib/sendmail/include/sm/fdset.h index 69b19e3a42f..8a5a1d4db45 100644 --- a/contrib/sendmail/include/sm/fdset.h +++ b/contrib/sendmail/include/sm/fdset.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: fdset.h,v 1.6 2013/11/22 20:51:31 ca Exp $ + * $Id: fdset.h,v 1.6 2013-11-22 20:51:31 ca Exp $ */ #ifndef SM_FDSET_H diff --git a/contrib/sendmail/include/sm/gen.h b/contrib/sendmail/include/sm/gen.h index 4efe452cc84..522892982e9 100644 --- a/contrib/sendmail/include/sm/gen.h +++ b/contrib/sendmail/include/sm/gen.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: gen.h,v 1.24 2013/11/22 20:51:31 ca Exp $ + * $Id: gen.h,v 1.24 2013-11-22 20:51:31 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/heap.h b/contrib/sendmail/include/sm/heap.h index ac2c898a700..152e3672fcc 100644 --- a/contrib/sendmail/include/sm/heap.h +++ b/contrib/sendmail/include/sm/heap.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: heap.h,v 1.24 2013/11/22 20:51:31 ca Exp $ + * $Id: heap.h,v 1.24 2013-11-22 20:51:31 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/io.h b/contrib/sendmail/include/sm/io.h index 1b5adf65da3..1eceffd22cf 100644 --- a/contrib/sendmail/include/sm/io.h +++ b/contrib/sendmail/include/sm/io.h @@ -11,7 +11,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: io.h,v 1.26 2013/11/22 20:51:31 ca Exp $ + * $Id: io.h,v 1.26 2013-11-22 20:51:31 ca Exp $ */ /*- diff --git a/contrib/sendmail/include/sm/ldap.h b/contrib/sendmail/include/sm/ldap.h index 06f2abdf3cb..9ce5d234e70 100644 --- a/contrib/sendmail/include/sm/ldap.h +++ b/contrib/sendmail/include/sm/ldap.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: ldap.h,v 1.35 2013/11/22 20:51:31 ca Exp $ + * $Id: ldap.h,v 1.35 2013-11-22 20:51:31 ca Exp $ */ #ifndef SM_LDAP_H diff --git a/contrib/sendmail/include/sm/limits.h b/contrib/sendmail/include/sm/limits.h index c2e2b258a69..001f81e190a 100644 --- a/contrib/sendmail/include/sm/limits.h +++ b/contrib/sendmail/include/sm/limits.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: limits.h,v 1.7 2013/11/22 20:51:31 ca Exp $ + * $Id: limits.h,v 1.7 2013-11-22 20:51:31 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/mbdb.h b/contrib/sendmail/include/sm/mbdb.h index e7d0bec7801..7663244cef6 100644 --- a/contrib/sendmail/include/sm/mbdb.h +++ b/contrib/sendmail/include/sm/mbdb.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: mbdb.h,v 1.7 2013/11/22 20:51:31 ca Exp $ + * $Id: mbdb.h,v 1.7 2013-11-22 20:51:31 ca Exp $ */ #ifndef SM_MBDB_H diff --git a/contrib/sendmail/include/sm/misc.h b/contrib/sendmail/include/sm/misc.h index 259cf2702d2..a1b328d5715 100644 --- a/contrib/sendmail/include/sm/misc.h +++ b/contrib/sendmail/include/sm/misc.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: misc.h,v 1.2 2013/11/22 20:51:31 ca Exp $ + * $Id: misc.h,v 1.2 2013-11-22 20:51:31 ca Exp $ */ #ifndef SM_MISC_H diff --git a/contrib/sendmail/include/sm/os/sm_os_aix.h b/contrib/sendmail/include/sm/os/sm_os_aix.h index 6797a88d58d..e708f30db73 100644 --- a/contrib/sendmail/include/sm/os/sm_os_aix.h +++ b/contrib/sendmail/include/sm/os/sm_os_aix.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: sm_os_aix.h,v 1.12 2013/11/22 20:51:34 ca Exp $ + * $Id: sm_os_aix.h,v 1.12 2013-11-22 20:51:34 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/os/sm_os_dragonfly.h b/contrib/sendmail/include/sm/os/sm_os_dragonfly.h index ec8fe4be525..f4cb0fc7ec6 100644 --- a/contrib/sendmail/include/sm/os/sm_os_dragonfly.h +++ b/contrib/sendmail/include/sm/os/sm_os_dragonfly.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: sm_os_dragonfly.h,v 1.2 2013/11/22 20:51:34 ca Exp $ + * $Id: sm_os_dragonfly.h,v 1.2 2013-11-22 20:51:34 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/os/sm_os_freebsd.h b/contrib/sendmail/include/sm/os/sm_os_freebsd.h index 2ee55a54406..306f62cb572 100644 --- a/contrib/sendmail/include/sm/os/sm_os_freebsd.h +++ b/contrib/sendmail/include/sm/os/sm_os_freebsd.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: sm_os_freebsd.h,v 1.12 2013/11/22 20:51:34 ca Exp $ + * $Id: sm_os_freebsd.h,v 1.12 2013-11-22 20:51:34 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/os/sm_os_hp.h b/contrib/sendmail/include/sm/os/sm_os_hp.h index 63f4911491f..c8c2b28fe7e 100644 --- a/contrib/sendmail/include/sm/os/sm_os_hp.h +++ b/contrib/sendmail/include/sm/os/sm_os_hp.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: sm_os_hp.h,v 1.9 2013/11/22 20:51:34 ca Exp $ + * $Id: sm_os_hp.h,v 1.9 2013-11-22 20:51:34 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/os/sm_os_irix.h b/contrib/sendmail/include/sm/os/sm_os_irix.h index c3a58da75d4..d6ca884d300 100644 --- a/contrib/sendmail/include/sm/os/sm_os_irix.h +++ b/contrib/sendmail/include/sm/os/sm_os_irix.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: sm_os_irix.h,v 1.8 2013/11/22 20:51:34 ca Exp $ + * $Id: sm_os_irix.h,v 1.8 2013-11-22 20:51:34 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/os/sm_os_linux.h b/contrib/sendmail/include/sm/os/sm_os_linux.h index 0ad1d903572..8268945a053 100644 --- a/contrib/sendmail/include/sm/os/sm_os_linux.h +++ b/contrib/sendmail/include/sm/os/sm_os_linux.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: sm_os_linux.h,v 1.13 2013/11/22 20:51:34 ca Exp $ + * $Id: sm_os_linux.h,v 1.13 2013-11-22 20:51:34 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/os/sm_os_mpeix.h b/contrib/sendmail/include/sm/os/sm_os_mpeix.h index 2223e78950a..9c2d12e5f41 100644 --- a/contrib/sendmail/include/sm/os/sm_os_mpeix.h +++ b/contrib/sendmail/include/sm/os/sm_os_mpeix.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: sm_os_mpeix.h,v 1.3 2013/11/22 20:51:34 ca Exp $ + * $Id: sm_os_mpeix.h,v 1.3 2013-11-22 20:51:34 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/os/sm_os_next.h b/contrib/sendmail/include/sm/os/sm_os_next.h index 658b0396701..f64476f28d2 100644 --- a/contrib/sendmail/include/sm/os/sm_os_next.h +++ b/contrib/sendmail/include/sm/os/sm_os_next.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: sm_os_next.h,v 1.8 2013/11/22 20:51:34 ca Exp $ + * $Id: sm_os_next.h,v 1.8 2013-11-22 20:51:34 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/os/sm_os_openbsd.h b/contrib/sendmail/include/sm/os/sm_os_openbsd.h index 1455059a99d..a1d94e949c3 100644 --- a/contrib/sendmail/include/sm/os/sm_os_openbsd.h +++ b/contrib/sendmail/include/sm/os/sm_os_openbsd.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: sm_os_openbsd.h,v 1.8 2013/11/22 20:51:34 ca Exp $ + * $Id: sm_os_openbsd.h,v 1.8 2013-11-22 20:51:34 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/os/sm_os_openunix.h b/contrib/sendmail/include/sm/os/sm_os_openunix.h index 070bc91e609..f26a1e1bca4 100644 --- a/contrib/sendmail/include/sm/os/sm_os_openunix.h +++ b/contrib/sendmail/include/sm/os/sm_os_openunix.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: sm_os_openunix.h,v 1.6 2013/11/22 20:51:34 ca Exp $ + * $Id: sm_os_openunix.h,v 1.6 2013-11-22 20:51:34 ca Exp $ */ #define SM_OS_NAME "openunix" diff --git a/contrib/sendmail/include/sm/os/sm_os_osf1.h b/contrib/sendmail/include/sm/os/sm_os_osf1.h index 98c154ca49b..db18a2009cc 100644 --- a/contrib/sendmail/include/sm/os/sm_os_osf1.h +++ b/contrib/sendmail/include/sm/os/sm_os_osf1.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: sm_os_osf1.h,v 1.4 2013/11/22 20:51:34 ca Exp $ + * $Id: sm_os_osf1.h,v 1.4 2013-11-22 20:51:34 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/os/sm_os_qnx.h b/contrib/sendmail/include/sm/os/sm_os_qnx.h index 695cb3c1851..2707df45739 100644 --- a/contrib/sendmail/include/sm/os/sm_os_qnx.h +++ b/contrib/sendmail/include/sm/os/sm_os_qnx.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: sm_os_qnx.h,v 1.2 2013/11/22 20:51:34 ca Exp $ + * $Id: sm_os_qnx.h,v 1.2 2013-11-22 20:51:34 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/os/sm_os_sunos.h b/contrib/sendmail/include/sm/os/sm_os_sunos.h index 3c2d3324457..40be590f256 100644 --- a/contrib/sendmail/include/sm/os/sm_os_sunos.h +++ b/contrib/sendmail/include/sm/os/sm_os_sunos.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: sm_os_sunos.h,v 1.15 2013/11/22 20:51:34 ca Exp $ + * $Id: sm_os_sunos.h,v 1.15 2013-11-22 20:51:34 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/os/sm_os_ultrix.h b/contrib/sendmail/include/sm/os/sm_os_ultrix.h index a10e71135a1..cd2f01ba327 100644 --- a/contrib/sendmail/include/sm/os/sm_os_ultrix.h +++ b/contrib/sendmail/include/sm/os/sm_os_ultrix.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: sm_os_ultrix.h,v 1.4 2013/11/22 20:51:34 ca Exp $ + * $Id: sm_os_ultrix.h,v 1.4 2013-11-22 20:51:34 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/os/sm_os_unicos.h b/contrib/sendmail/include/sm/os/sm_os_unicos.h index f3e1c56393e..b0ab511dd36 100644 --- a/contrib/sendmail/include/sm/os/sm_os_unicos.h +++ b/contrib/sendmail/include/sm/os/sm_os_unicos.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: sm_os_unicos.h,v 1.2 2013/11/22 20:51:34 ca Exp $ + * $Id: sm_os_unicos.h,v 1.2 2013-11-22 20:51:34 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/os/sm_os_unicosmk.h b/contrib/sendmail/include/sm/os/sm_os_unicosmk.h index c4fcd1acc2e..d90ec137f6f 100644 --- a/contrib/sendmail/include/sm/os/sm_os_unicosmk.h +++ b/contrib/sendmail/include/sm/os/sm_os_unicosmk.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: sm_os_unicosmk.h,v 1.2 2013/11/22 20:51:34 ca Exp $ + * $Id: sm_os_unicosmk.h,v 1.2 2013-11-22 20:51:34 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/os/sm_os_unicosmp.h b/contrib/sendmail/include/sm/os/sm_os_unicosmp.h index 713564f74a0..33398a5a418 100644 --- a/contrib/sendmail/include/sm/os/sm_os_unicosmp.h +++ b/contrib/sendmail/include/sm/os/sm_os_unicosmp.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: sm_os_unicosmp.h,v 1.2 2013/11/22 20:51:34 ca Exp $ + * $Id: sm_os_unicosmp.h,v 1.2 2013-11-22 20:51:34 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/os/sm_os_unixware.h b/contrib/sendmail/include/sm/os/sm_os_unixware.h index a3ade482293..46fc58851a3 100644 --- a/contrib/sendmail/include/sm/os/sm_os_unixware.h +++ b/contrib/sendmail/include/sm/os/sm_os_unixware.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: sm_os_unixware.h,v 1.9 2013/11/22 20:51:34 ca Exp $ + * $Id: sm_os_unixware.h,v 1.9 2013-11-22 20:51:34 ca Exp $ */ #define SM_OS_NAME "unixware" diff --git a/contrib/sendmail/include/sm/path.h b/contrib/sendmail/include/sm/path.h index 105275194db..70db30e212c 100644 --- a/contrib/sendmail/include/sm/path.h +++ b/contrib/sendmail/include/sm/path.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: path.h,v 1.7 2013/11/22 20:51:31 ca Exp $ + * $Id: path.h,v 1.7 2013-11-22 20:51:31 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/rpool.h b/contrib/sendmail/include/sm/rpool.h index 706ef28abd1..b01050de3a5 100644 --- a/contrib/sendmail/include/sm/rpool.h +++ b/contrib/sendmail/include/sm/rpool.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: rpool.h,v 1.17 2013/11/22 20:51:31 ca Exp $ + * $Id: rpool.h,v 1.17 2013-11-22 20:51:31 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/sem.h b/contrib/sendmail/include/sm/sem.h index 2fc52447df5..556400c39ca 100644 --- a/contrib/sendmail/include/sm/sem.h +++ b/contrib/sendmail/include/sm/sem.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: sem.h,v 1.11 2013/11/22 20:51:31 ca Exp $ + * $Id: sem.h,v 1.11 2013-11-22 20:51:31 ca Exp $ */ #ifndef SM_SEM_H diff --git a/contrib/sendmail/include/sm/setjmp.h b/contrib/sendmail/include/sm/setjmp.h index 1ba6807197f..31c9c90fe3f 100644 --- a/contrib/sendmail/include/sm/setjmp.h +++ b/contrib/sendmail/include/sm/setjmp.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: setjmp.h,v 1.4 2013/11/22 20:51:31 ca Exp $ + * $Id: setjmp.h,v 1.4 2013-11-22 20:51:31 ca Exp $ */ #ifndef SM_SETJMP_H diff --git a/contrib/sendmail/include/sm/shm.h b/contrib/sendmail/include/sm/shm.h index 18640429c01..1a3b3b4f8bd 100644 --- a/contrib/sendmail/include/sm/shm.h +++ b/contrib/sendmail/include/sm/shm.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: shm.h,v 1.12 2013/11/22 20:51:31 ca Exp $ + * $Id: shm.h,v 1.12 2013-11-22 20:51:31 ca Exp $ */ #ifndef SM_SHM_H diff --git a/contrib/sendmail/include/sm/signal.h b/contrib/sendmail/include/sm/signal.h index 834d77297b1..ba5e4b0586a 100644 --- a/contrib/sendmail/include/sm/signal.h +++ b/contrib/sendmail/include/sm/signal.h @@ -9,7 +9,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: signal.h,v 1.17 2013/11/22 20:51:31 ca Exp $ + * $Id: signal.h,v 1.17 2013-11-22 20:51:31 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/string.h b/contrib/sendmail/include/sm/string.h index 0484a5bfa2a..4fd87afe600 100644 --- a/contrib/sendmail/include/sm/string.h +++ b/contrib/sendmail/include/sm/string.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: string.h,v 1.39 2013/11/22 20:51:31 ca Exp $ + * $Id: string.h,v 1.39 2013-11-22 20:51:31 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/sysexits.h b/contrib/sendmail/include/sm/sysexits.h index c64e40d18ed..53767d54e7c 100644 --- a/contrib/sendmail/include/sm/sysexits.h +++ b/contrib/sendmail/include/sm/sysexits.h @@ -8,7 +8,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: sysexits.h,v 1.6 2013/11/22 20:51:31 ca Exp $ + * $Id: sysexits.h,v 1.6 2013-11-22 20:51:31 ca Exp $ * @(#)sysexits.h 8.1 (Berkeley) 6/2/93 */ diff --git a/contrib/sendmail/include/sm/tailq.h b/contrib/sendmail/include/sm/tailq.h index ef67a971b32..b49466eae30 100644 --- a/contrib/sendmail/include/sm/tailq.h +++ b/contrib/sendmail/include/sm/tailq.h @@ -36,7 +36,7 @@ #define SM_TAILQ_H_ /* - * $Id: tailq.h,v 1.3 2012/01/21 00:12:14 ashish Exp $ + * $Id: tailq.h,v 1.3 2012-01-21 00:12:14 ashish Exp $ * * This file is a modified copy of queue.h from a BSD system: * we only need tail queues here. diff --git a/contrib/sendmail/include/sm/test.h b/contrib/sendmail/include/sm/test.h index 629c110fc1e..fdcce848b7e 100644 --- a/contrib/sendmail/include/sm/test.h +++ b/contrib/sendmail/include/sm/test.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: test.h,v 1.7 2013/11/22 20:51:32 ca Exp $ + * $Id: test.h,v 1.7 2013-11-22 20:51:32 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/time.h b/contrib/sendmail/include/sm/time.h index 7e185f49250..b6d31a4bd29 100644 --- a/contrib/sendmail/include/sm/time.h +++ b/contrib/sendmail/include/sm/time.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: time.h,v 1.2 2013/11/22 20:51:32 ca Exp $ + * $Id: time.h,v 1.2 2013-11-22 20:51:32 ca Exp $ */ #ifndef SM_TIME_H diff --git a/contrib/sendmail/include/sm/types.h b/contrib/sendmail/include/sm/types.h index 3ad9d5f9dd7..32c696fb837 100644 --- a/contrib/sendmail/include/sm/types.h +++ b/contrib/sendmail/include/sm/types.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: types.h,v 1.14 2013/11/22 20:51:32 ca Exp $ + * $Id: types.h,v 1.14 2013-11-22 20:51:32 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/varargs.h b/contrib/sendmail/include/sm/varargs.h index 02b9dd96a5a..612858da9c1 100644 --- a/contrib/sendmail/include/sm/varargs.h +++ b/contrib/sendmail/include/sm/varargs.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: varargs.h,v 1.9 2013/11/22 20:51:32 ca Exp $ + * $Id: varargs.h,v 1.9 2013-11-22 20:51:32 ca Exp $ */ /* diff --git a/contrib/sendmail/include/sm/xtrap.h b/contrib/sendmail/include/sm/xtrap.h index 437fce1b00f..ed5de5348fe 100644 --- a/contrib/sendmail/include/sm/xtrap.h +++ b/contrib/sendmail/include/sm/xtrap.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: xtrap.h,v 1.8 2013/11/22 20:51:32 ca Exp $ + * $Id: xtrap.h,v 1.8 2013-11-22 20:51:32 ca Exp $ */ /* diff --git a/contrib/sendmail/libmilter/Makefile b/contrib/sendmail/libmilter/Makefile index b5bfba40344..825ddd52d9d 100644 --- a/contrib/sendmail/libmilter/Makefile +++ b/contrib/sendmail/libmilter/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 8.2 2006/05/23 21:55:55 ca Exp $ +# $Id: Makefile,v 8.2 2006-05-23 21:55:55 ca Exp $ SHELL= /bin/sh BUILD= ./Build diff --git a/contrib/sendmail/libmilter/Makefile.m4 b/contrib/sendmail/libmilter/Makefile.m4 index 34e5a2acc87..0ad45016af9 100644 --- a/contrib/sendmail/libmilter/Makefile.m4 +++ b/contrib/sendmail/libmilter/Makefile.m4 @@ -1,4 +1,4 @@ -dnl $Id: Makefile.m4,v 8.96 2013/10/14 16:16:44 ca Exp $ +dnl $Id: Makefile.m4,v 8.96 2013-10-14 16:16:44 ca Exp $ include(confBUILDTOOLSDIR`/M4/switch.m4') dnl only required for compilation of EXTRAS diff --git a/contrib/sendmail/libmilter/README b/contrib/sendmail/libmilter/README index e9c2cb1376e..64e1cca1cf7 100644 --- a/contrib/sendmail/libmilter/README +++ b/contrib/sendmail/libmilter/README @@ -231,4 +231,4 @@ Note that the filter example.c may not be thread safe on some operating systems. You should check your system man pages for the functions used below to verify the functions are thread safe. -$Revision: 8.42 $, Last updated $Date: 2006/06/29 17:10:16 $ +$Revision: 8.42 $, Last updated $Date: 2006-06-29 17:10:16 $ diff --git a/contrib/sendmail/libmilter/comm.c b/contrib/sendmail/libmilter/comm.c index e115c4625ca..a551a5253fd 100644 --- a/contrib/sendmail/libmilter/comm.c +++ b/contrib/sendmail/libmilter/comm.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Id: comm.c,v 8.71 2013/11/22 20:51:36 ca Exp $") +SM_RCSID("@(#)$Id: comm.c,v 8.71 2013-11-22 20:51:36 ca Exp $") #include "libmilter.h" #include diff --git a/contrib/sendmail/libmilter/docs/api.html b/contrib/sendmail/libmilter/docs/api.html index a479eb809a1..b314a0f4e96 100644 --- a/contrib/sendmail/libmilter/docs/api.html +++ b/contrib/sendmail/libmilter/docs/api.html @@ -2,7 +2,7 @@ Milter API

Milter API

diff --git a/contrib/sendmail/libmilter/docs/design.html b/contrib/sendmail/libmilter/docs/design.html index c0eabdd4b40..294f9a153d0 100644 --- a/contrib/sendmail/libmilter/docs/design.html +++ b/contrib/sendmail/libmilter/docs/design.html @@ -4,7 +4,7 @@

Architecture

diff --git a/contrib/sendmail/libmilter/docs/index.html b/contrib/sendmail/libmilter/docs/index.html index 5f7295ddfc6..57d9ebc6d74 100644 --- a/contrib/sendmail/libmilter/docs/index.html +++ b/contrib/sendmail/libmilter/docs/index.html @@ -4,7 +4,7 @@

Filtering Mail with Sendmail

diff --git a/contrib/sendmail/libmilter/docs/installation.html b/contrib/sendmail/libmilter/docs/installation.html index 7c403976a5a..91fe0d818a3 100644 --- a/contrib/sendmail/libmilter/docs/installation.html +++ b/contrib/sendmail/libmilter/docs/installation.html @@ -3,7 +3,7 @@

Installation

Contents

diff --git a/contrib/sendmail/libmilter/docs/other.html b/contrib/sendmail/libmilter/docs/other.html index 5f007d9c4f3..e252a206317 100644 --- a/contrib/sendmail/libmilter/docs/other.html +++ b/contrib/sendmail/libmilter/docs/other.html @@ -3,7 +3,7 @@ FAQ? Mailing list? More sample filters?
diff --git a/contrib/sendmail/libmilter/docs/overview.html b/contrib/sendmail/libmilter/docs/overview.html index fc95c331299..78676d377a1 100644 --- a/contrib/sendmail/libmilter/docs/overview.html +++ b/contrib/sendmail/libmilter/docs/overview.html @@ -4,7 +4,7 @@

Technical Overview

diff --git a/contrib/sendmail/libmilter/docs/sample.html b/contrib/sendmail/libmilter/docs/sample.html index 03c747b16eb..de8d58947a3 100644 --- a/contrib/sendmail/libmilter/docs/sample.html +++ b/contrib/sendmail/libmilter/docs/sample.html @@ -2,7 +2,7 @@ A Sample Filter

A Sample Filter

diff --git a/contrib/sendmail/libmilter/docs/smfi_addheader.html b/contrib/sendmail/libmilter/docs/smfi_addheader.html index 4cff9720045..e58c8d713c6 100644 --- a/contrib/sendmail/libmilter/docs/smfi_addheader.html +++ b/contrib/sendmail/libmilter/docs/smfi_addheader.html @@ -2,7 +2,7 @@ smfi_addheader

smfi_addheader

diff --git a/contrib/sendmail/libmilter/docs/smfi_addrcpt.html b/contrib/sendmail/libmilter/docs/smfi_addrcpt.html index e0bb1dba8dc..42014bf1d82 100644 --- a/contrib/sendmail/libmilter/docs/smfi_addrcpt.html +++ b/contrib/sendmail/libmilter/docs/smfi_addrcpt.html @@ -2,7 +2,7 @@ smfi_addrcpt

smfi_addrcpt

diff --git a/contrib/sendmail/libmilter/docs/smfi_addrcpt_par.html b/contrib/sendmail/libmilter/docs/smfi_addrcpt_par.html index 2073c8f371b..0176e69e061 100644 --- a/contrib/sendmail/libmilter/docs/smfi_addrcpt_par.html +++ b/contrib/sendmail/libmilter/docs/smfi_addrcpt_par.html @@ -2,7 +2,7 @@ smfi_addrcpt_par

smfi_addrcpt_par

diff --git a/contrib/sendmail/libmilter/docs/smfi_chgfrom.html b/contrib/sendmail/libmilter/docs/smfi_chgfrom.html index 8f08955109f..a107ee9ebeb 100644 --- a/contrib/sendmail/libmilter/docs/smfi_chgfrom.html +++ b/contrib/sendmail/libmilter/docs/smfi_chgfrom.html @@ -2,7 +2,7 @@ smfi_chgfrom

smfi_chgfrom

diff --git a/contrib/sendmail/libmilter/docs/smfi_chgheader.html b/contrib/sendmail/libmilter/docs/smfi_chgheader.html index d0403053332..b3004032e4b 100644 --- a/contrib/sendmail/libmilter/docs/smfi_chgheader.html +++ b/contrib/sendmail/libmilter/docs/smfi_chgheader.html @@ -2,7 +2,7 @@ smfi_chgheader

smfi_chgheader

diff --git a/contrib/sendmail/libmilter/docs/smfi_delrcpt.html b/contrib/sendmail/libmilter/docs/smfi_delrcpt.html index ff28430a3d1..ec1412bd377 100644 --- a/contrib/sendmail/libmilter/docs/smfi_delrcpt.html +++ b/contrib/sendmail/libmilter/docs/smfi_delrcpt.html @@ -2,7 +2,7 @@ smfi_delrcpt

smfi_delrcpt

diff --git a/contrib/sendmail/libmilter/docs/smfi_getpriv.html b/contrib/sendmail/libmilter/docs/smfi_getpriv.html index c870b534fd7..783d6402ef4 100644 --- a/contrib/sendmail/libmilter/docs/smfi_getpriv.html +++ b/contrib/sendmail/libmilter/docs/smfi_getpriv.html @@ -2,7 +2,7 @@ smfi_getpriv

smfi_getpriv

diff --git a/contrib/sendmail/libmilter/docs/smfi_getsymval.html b/contrib/sendmail/libmilter/docs/smfi_getsymval.html index a92fcdb7f52..dff8dc638c8 100644 --- a/contrib/sendmail/libmilter/docs/smfi_getsymval.html +++ b/contrib/sendmail/libmilter/docs/smfi_getsymval.html @@ -2,7 +2,7 @@ smfi_getsymval

smfi_getsymval

diff --git a/contrib/sendmail/libmilter/docs/smfi_insheader.html b/contrib/sendmail/libmilter/docs/smfi_insheader.html index 36ec0d44b7d..3f568864835 100644 --- a/contrib/sendmail/libmilter/docs/smfi_insheader.html +++ b/contrib/sendmail/libmilter/docs/smfi_insheader.html @@ -2,7 +2,7 @@ smfi_insheader

smfi_insheader

diff --git a/contrib/sendmail/libmilter/docs/smfi_main.html b/contrib/sendmail/libmilter/docs/smfi_main.html index dd7f8f9666f..cb63f96bc5d 100644 --- a/contrib/sendmail/libmilter/docs/smfi_main.html +++ b/contrib/sendmail/libmilter/docs/smfi_main.html @@ -2,7 +2,7 @@ smfi_main

smfi_main

diff --git a/contrib/sendmail/libmilter/docs/smfi_opensocket.html b/contrib/sendmail/libmilter/docs/smfi_opensocket.html index a1e9dbf0b30..d4f7e3a705e 100644 --- a/contrib/sendmail/libmilter/docs/smfi_opensocket.html +++ b/contrib/sendmail/libmilter/docs/smfi_opensocket.html @@ -2,7 +2,7 @@ smfi_opensocket

smfi_opensocket

diff --git a/contrib/sendmail/libmilter/docs/smfi_progress.html b/contrib/sendmail/libmilter/docs/smfi_progress.html index 27423eb4630..2b87b012422 100644 --- a/contrib/sendmail/libmilter/docs/smfi_progress.html +++ b/contrib/sendmail/libmilter/docs/smfi_progress.html @@ -2,7 +2,7 @@ smfi_progress

smfi_progress

diff --git a/contrib/sendmail/libmilter/docs/smfi_quarantine.html b/contrib/sendmail/libmilter/docs/smfi_quarantine.html index aed22c8ef18..b63da2d6c50 100644 --- a/contrib/sendmail/libmilter/docs/smfi_quarantine.html +++ b/contrib/sendmail/libmilter/docs/smfi_quarantine.html @@ -2,7 +2,7 @@ smfi_quarantine

smfi_quarantine

diff --git a/contrib/sendmail/libmilter/docs/smfi_register.html b/contrib/sendmail/libmilter/docs/smfi_register.html index 083d12264b0..30ab75cae49 100644 --- a/contrib/sendmail/libmilter/docs/smfi_register.html +++ b/contrib/sendmail/libmilter/docs/smfi_register.html @@ -2,7 +2,7 @@ smfi_register

smfi_register

diff --git a/contrib/sendmail/libmilter/docs/smfi_replacebody.html b/contrib/sendmail/libmilter/docs/smfi_replacebody.html index b3c17ccd9f0..4a5117964a3 100644 --- a/contrib/sendmail/libmilter/docs/smfi_replacebody.html +++ b/contrib/sendmail/libmilter/docs/smfi_replacebody.html @@ -2,7 +2,7 @@ smfi_replacebody

smfi_replacebody

diff --git a/contrib/sendmail/libmilter/docs/smfi_setbacklog.html b/contrib/sendmail/libmilter/docs/smfi_setbacklog.html index af52b80fa69..96128555544 100644 --- a/contrib/sendmail/libmilter/docs/smfi_setbacklog.html +++ b/contrib/sendmail/libmilter/docs/smfi_setbacklog.html @@ -2,7 +2,7 @@ smfi_setbacklog

smfi_setbacklog

diff --git a/contrib/sendmail/libmilter/docs/smfi_setconn.html b/contrib/sendmail/libmilter/docs/smfi_setconn.html index f08b15e5fc9..eba7c5b7e52 100644 --- a/contrib/sendmail/libmilter/docs/smfi_setconn.html +++ b/contrib/sendmail/libmilter/docs/smfi_setconn.html @@ -2,7 +2,7 @@ smfi_setconn

smfi_setconn

diff --git a/contrib/sendmail/libmilter/docs/smfi_setdbg.html b/contrib/sendmail/libmilter/docs/smfi_setdbg.html index c28468ca755..58d519935e2 100644 --- a/contrib/sendmail/libmilter/docs/smfi_setdbg.html +++ b/contrib/sendmail/libmilter/docs/smfi_setdbg.html @@ -2,7 +2,7 @@ smfi_setdbg

smfi_setdbg

diff --git a/contrib/sendmail/libmilter/docs/smfi_setmlreply.html b/contrib/sendmail/libmilter/docs/smfi_setmlreply.html index 46c04e3930c..e9118838fd3 100644 --- a/contrib/sendmail/libmilter/docs/smfi_setmlreply.html +++ b/contrib/sendmail/libmilter/docs/smfi_setmlreply.html @@ -2,7 +2,7 @@ smfi_setmlreply

smfi_setmlreply

diff --git a/contrib/sendmail/libmilter/docs/smfi_setpriv.html b/contrib/sendmail/libmilter/docs/smfi_setpriv.html index 66ddcd86af6..5b03456f47a 100644 --- a/contrib/sendmail/libmilter/docs/smfi_setpriv.html +++ b/contrib/sendmail/libmilter/docs/smfi_setpriv.html @@ -2,7 +2,7 @@ smfi_setpriv

smfi_setpriv

diff --git a/contrib/sendmail/libmilter/docs/smfi_setreply.html b/contrib/sendmail/libmilter/docs/smfi_setreply.html index 4db70bbe327..21ec5a57d09 100644 --- a/contrib/sendmail/libmilter/docs/smfi_setreply.html +++ b/contrib/sendmail/libmilter/docs/smfi_setreply.html @@ -2,7 +2,7 @@ smfi_setreply

smfi_setreply

diff --git a/contrib/sendmail/libmilter/docs/smfi_setsymlist.html b/contrib/sendmail/libmilter/docs/smfi_setsymlist.html index c371860e104..1b879c44704 100644 --- a/contrib/sendmail/libmilter/docs/smfi_setsymlist.html +++ b/contrib/sendmail/libmilter/docs/smfi_setsymlist.html @@ -2,7 +2,7 @@ smfi_setsymlist

smfi_setsymlist

diff --git a/contrib/sendmail/libmilter/docs/smfi_settimeout.html b/contrib/sendmail/libmilter/docs/smfi_settimeout.html index 92382abc5e2..35cd51003ae 100644 --- a/contrib/sendmail/libmilter/docs/smfi_settimeout.html +++ b/contrib/sendmail/libmilter/docs/smfi_settimeout.html @@ -2,7 +2,7 @@ smfi_settimeout

smfi_settimeout

diff --git a/contrib/sendmail/libmilter/docs/smfi_stop.html b/contrib/sendmail/libmilter/docs/smfi_stop.html index e218b5afd1f..aa725b9dbc2 100644 --- a/contrib/sendmail/libmilter/docs/smfi_stop.html +++ b/contrib/sendmail/libmilter/docs/smfi_stop.html @@ -2,7 +2,7 @@ smfi_stop

smfi_stop

diff --git a/contrib/sendmail/libmilter/docs/smfi_version.html b/contrib/sendmail/libmilter/docs/smfi_version.html index 9b7d325d6f6..64c4a4d8f8a 100644 --- a/contrib/sendmail/libmilter/docs/smfi_version.html +++ b/contrib/sendmail/libmilter/docs/smfi_version.html @@ -2,7 +2,7 @@ smfi_version()

smfi_version()

diff --git a/contrib/sendmail/libmilter/docs/xxfi_abort.html b/contrib/sendmail/libmilter/docs/xxfi_abort.html index 73a1705770c..9ec8f499073 100644 --- a/contrib/sendmail/libmilter/docs/xxfi_abort.html +++ b/contrib/sendmail/libmilter/docs/xxfi_abort.html @@ -2,7 +2,7 @@ xxfi_abort

xxfi_abort

diff --git a/contrib/sendmail/libmilter/docs/xxfi_body.html b/contrib/sendmail/libmilter/docs/xxfi_body.html index bc19201d385..81103506587 100644 --- a/contrib/sendmail/libmilter/docs/xxfi_body.html +++ b/contrib/sendmail/libmilter/docs/xxfi_body.html @@ -2,7 +2,7 @@ xxfi_body

xxfi_body

diff --git a/contrib/sendmail/libmilter/docs/xxfi_close.html b/contrib/sendmail/libmilter/docs/xxfi_close.html index 2af52f4fe16..b5cf2ff237a 100644 --- a/contrib/sendmail/libmilter/docs/xxfi_close.html +++ b/contrib/sendmail/libmilter/docs/xxfi_close.html @@ -2,7 +2,7 @@ xxfi_close

xxfi_close

diff --git a/contrib/sendmail/libmilter/docs/xxfi_connect.html b/contrib/sendmail/libmilter/docs/xxfi_connect.html index a3d5ee96de7..29a2c911153 100644 --- a/contrib/sendmail/libmilter/docs/xxfi_connect.html +++ b/contrib/sendmail/libmilter/docs/xxfi_connect.html @@ -2,7 +2,7 @@ xxfi_connect

xxfi_connect

diff --git a/contrib/sendmail/libmilter/docs/xxfi_data.html b/contrib/sendmail/libmilter/docs/xxfi_data.html index bfd4dbe0b21..7dedb418309 100644 --- a/contrib/sendmail/libmilter/docs/xxfi_data.html +++ b/contrib/sendmail/libmilter/docs/xxfi_data.html @@ -2,7 +2,7 @@ xxfi_data

xxfi_data

diff --git a/contrib/sendmail/libmilter/docs/xxfi_envfrom.html b/contrib/sendmail/libmilter/docs/xxfi_envfrom.html index 46ae35eb595..24811e14a6c 100644 --- a/contrib/sendmail/libmilter/docs/xxfi_envfrom.html +++ b/contrib/sendmail/libmilter/docs/xxfi_envfrom.html @@ -2,7 +2,7 @@ xxfi_envfrom

xxfi_envfrom

diff --git a/contrib/sendmail/libmilter/docs/xxfi_envrcpt.html b/contrib/sendmail/libmilter/docs/xxfi_envrcpt.html index d2febbc0c55..9503ab98c61 100644 --- a/contrib/sendmail/libmilter/docs/xxfi_envrcpt.html +++ b/contrib/sendmail/libmilter/docs/xxfi_envrcpt.html @@ -2,7 +2,7 @@ xxfi_envrcpt

xxfi_envrcpt

diff --git a/contrib/sendmail/libmilter/docs/xxfi_eoh.html b/contrib/sendmail/libmilter/docs/xxfi_eoh.html index d06bfdb1e6d..33f5fc00498 100644 --- a/contrib/sendmail/libmilter/docs/xxfi_eoh.html +++ b/contrib/sendmail/libmilter/docs/xxfi_eoh.html @@ -2,7 +2,7 @@ xxfi_eoh

xxfi_eoh

diff --git a/contrib/sendmail/libmilter/docs/xxfi_eom.html b/contrib/sendmail/libmilter/docs/xxfi_eom.html index ca206ce359e..d473777e4b1 100644 --- a/contrib/sendmail/libmilter/docs/xxfi_eom.html +++ b/contrib/sendmail/libmilter/docs/xxfi_eom.html @@ -2,7 +2,7 @@ xxfi_eom

xxfi_eom

diff --git a/contrib/sendmail/libmilter/docs/xxfi_header.html b/contrib/sendmail/libmilter/docs/xxfi_header.html index 001fd7fd8d1..16e814b47c4 100644 --- a/contrib/sendmail/libmilter/docs/xxfi_header.html +++ b/contrib/sendmail/libmilter/docs/xxfi_header.html @@ -2,7 +2,7 @@ xxfi_header

xxfi_header

diff --git a/contrib/sendmail/libmilter/docs/xxfi_helo.html b/contrib/sendmail/libmilter/docs/xxfi_helo.html index 10dd24b109b..716eb9290f1 100644 --- a/contrib/sendmail/libmilter/docs/xxfi_helo.html +++ b/contrib/sendmail/libmilter/docs/xxfi_helo.html @@ -2,7 +2,7 @@ xxfi_helo

xxfi_helo

diff --git a/contrib/sendmail/libmilter/docs/xxfi_negotiate.html b/contrib/sendmail/libmilter/docs/xxfi_negotiate.html index 61ea95b3c98..b0502f47a71 100644 --- a/contrib/sendmail/libmilter/docs/xxfi_negotiate.html +++ b/contrib/sendmail/libmilter/docs/xxfi_negotiate.html @@ -2,7 +2,7 @@ xxfi_negotiate

xxfi_negotiate

diff --git a/contrib/sendmail/libmilter/docs/xxfi_unknown.html b/contrib/sendmail/libmilter/docs/xxfi_unknown.html index f32a5a1206c..38c1c3d4716 100644 --- a/contrib/sendmail/libmilter/docs/xxfi_unknown.html +++ b/contrib/sendmail/libmilter/docs/xxfi_unknown.html @@ -2,7 +2,7 @@ xxfi_unknown

xxfi_unknown

diff --git a/contrib/sendmail/libmilter/engine.c b/contrib/sendmail/libmilter/engine.c index c060cbeb422..e557a59ea54 100644 --- a/contrib/sendmail/libmilter/engine.c +++ b/contrib/sendmail/libmilter/engine.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Id: engine.c,v 8.168 2013/11/22 20:51:36 ca Exp $") +SM_RCSID("@(#)$Id: engine.c,v 8.168 2013-11-22 20:51:36 ca Exp $") #include "libmilter.h" diff --git a/contrib/sendmail/libmilter/example.c b/contrib/sendmail/libmilter/example.c index 754ac0d81a7..f078eb7ba30 100644 --- a/contrib/sendmail/libmilter/example.c +++ b/contrib/sendmail/libmilter/example.c @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: example.c,v 8.5 2013/11/22 20:51:36 ca Exp $ + * $Id: example.c,v 8.5 2013-11-22 20:51:36 ca Exp $ */ /* diff --git a/contrib/sendmail/libmilter/handler.c b/contrib/sendmail/libmilter/handler.c index 6e69179ff71..5b4073b8533 100644 --- a/contrib/sendmail/libmilter/handler.c +++ b/contrib/sendmail/libmilter/handler.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Id: handler.c,v 8.40 2013/11/22 20:51:36 ca Exp $") +SM_RCSID("@(#)$Id: handler.c,v 8.40 2013-11-22 20:51:36 ca Exp $") #include "libmilter.h" diff --git a/contrib/sendmail/libmilter/libmilter.h b/contrib/sendmail/libmilter/libmilter.h index 3ddbbd221a4..3c572ec9a9e 100644 --- a/contrib/sendmail/libmilter/libmilter.h +++ b/contrib/sendmail/libmilter/libmilter.h @@ -19,7 +19,7 @@ #ifdef _DEFINE # define EXTERN # define INIT(x) = x -SM_IDSTR(MilterlId, "@(#)$Id: libmilter.h,v 8.78 2013/11/22 20:51:36 ca Exp $") +SM_IDSTR(MilterlId, "@(#)$Id: libmilter.h,v 8.78 2013-11-22 20:51:36 ca Exp $") #else /* _DEFINE */ # define EXTERN extern # define INIT(x) diff --git a/contrib/sendmail/libmilter/listener.c b/contrib/sendmail/libmilter/listener.c index cd3f6e82b72..b0a1362d46c 100644 --- a/contrib/sendmail/libmilter/listener.c +++ b/contrib/sendmail/libmilter/listener.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Id: listener.c,v 8.127 2013/11/22 20:51:36 ca Exp $") +SM_RCSID("@(#)$Id: listener.c,v 8.127 2013-11-22 20:51:36 ca Exp $") /* ** listener.c -- threaded network listener diff --git a/contrib/sendmail/libmilter/main.c b/contrib/sendmail/libmilter/main.c index 0ed4f864be7..ef3242feff0 100644 --- a/contrib/sendmail/libmilter/main.c +++ b/contrib/sendmail/libmilter/main.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Id: main.c,v 8.85 2013/11/22 20:51:36 ca Exp $") +SM_RCSID("@(#)$Id: main.c,v 8.85 2013-11-22 20:51:36 ca Exp $") #define _DEFINE 1 #include "libmilter.h" diff --git a/contrib/sendmail/libmilter/monitor.c b/contrib/sendmail/libmilter/monitor.c index ab85a3d8136..9916bb59598 100644 --- a/contrib/sendmail/libmilter/monitor.c +++ b/contrib/sendmail/libmilter/monitor.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Id: monitor.c,v 8.8 2013/11/22 20:51:36 ca Exp $") +SM_RCSID("@(#)$Id: monitor.c,v 8.8 2013-11-22 20:51:36 ca Exp $") #include "libmilter.h" #if _FFR_THREAD_MONITOR diff --git a/contrib/sendmail/libmilter/signal.c b/contrib/sendmail/libmilter/signal.c index 503ffa6972c..4f8ec6e2d99 100644 --- a/contrib/sendmail/libmilter/signal.c +++ b/contrib/sendmail/libmilter/signal.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Id: signal.c,v 8.45 2013/11/22 20:51:36 ca Exp $") +SM_RCSID("@(#)$Id: signal.c,v 8.45 2013-11-22 20:51:36 ca Exp $") #include "libmilter.h" diff --git a/contrib/sendmail/libmilter/sm_gethost.c b/contrib/sendmail/libmilter/sm_gethost.c index 346588a8f26..2423c34419c 100644 --- a/contrib/sendmail/libmilter/sm_gethost.c +++ b/contrib/sendmail/libmilter/sm_gethost.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Id: sm_gethost.c,v 8.32 2013/11/22 20:51:36 ca Exp $") +SM_RCSID("@(#)$Id: sm_gethost.c,v 8.32 2013-11-22 20:51:36 ca Exp $") #include #if NETINET || NETINET6 diff --git a/contrib/sendmail/libmilter/smfi.c b/contrib/sendmail/libmilter/smfi.c index cf162db04c1..2148f3c18ca 100644 --- a/contrib/sendmail/libmilter/smfi.c +++ b/contrib/sendmail/libmilter/smfi.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Id: smfi.c,v 8.84 2013/11/22 20:51:36 ca Exp $") +SM_RCSID("@(#)$Id: smfi.c,v 8.84 2013-11-22 20:51:36 ca Exp $") #include #include "libmilter.h" diff --git a/contrib/sendmail/libmilter/worker.c b/contrib/sendmail/libmilter/worker.c index 5c2ad6b2077..75a1f7caa85 100644 --- a/contrib/sendmail/libmilter/worker.c +++ b/contrib/sendmail/libmilter/worker.c @@ -11,7 +11,7 @@ */ #include -SM_RCSID("@(#)$Id: worker.c,v 8.25 2013/11/22 20:51:37 ca Exp $") +SM_RCSID("@(#)$Id: worker.c,v 8.25 2013-11-22 20:51:37 ca Exp $") #include "libmilter.h" diff --git a/contrib/sendmail/libsm/Makefile b/contrib/sendmail/libsm/Makefile index e7b64ca39dd..e4b9871f98c 100644 --- a/contrib/sendmail/libsm/Makefile +++ b/contrib/sendmail/libsm/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.2 2006/08/16 21:06:30 ca Exp $ +# $Id: Makefile,v 1.2 2006-08-16 21:06:30 ca Exp $ SHELL= /bin/sh BUILD= ./Build diff --git a/contrib/sendmail/libsm/Makefile.m4 b/contrib/sendmail/libsm/Makefile.m4 index 705b6ac88c0..3901fe887af 100644 --- a/contrib/sendmail/libsm/Makefile.m4 +++ b/contrib/sendmail/libsm/Makefile.m4 @@ -1,4 +1,4 @@ -dnl $Id: Makefile.m4,v 1.75 2013/08/27 19:02:10 ca Exp $ +dnl $Id: Makefile.m4,v 1.75 2013-08-27 19:02:10 ca Exp $ define(`confREQUIRE_LIBUNIX') include(confBUILDTOOLSDIR`/M4/switch.m4') diff --git a/contrib/sendmail/libsm/README b/contrib/sendmail/libsm/README index c595f0dee90..37345e05b11 100644 --- a/contrib/sendmail/libsm/README +++ b/contrib/sendmail/libsm/README @@ -5,7 +5,7 @@ # forth in the LICENSE file which can be found at the top level of # the sendmail distribution. # -# $Id: README,v 1.25 2013/11/22 20:51:42 ca Exp $ +# $Id: README,v 1.25 2013-11-22 20:51:42 ca Exp $ # Libsm is a library of generally useful C abstractions. diff --git a/contrib/sendmail/libsm/assert.c b/contrib/sendmail/libsm/assert.c index a2e996355f6..6393e9eca41 100644 --- a/contrib/sendmail/libsm/assert.c +++ b/contrib/sendmail/libsm/assert.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Id: assert.c,v 1.27 2013/11/22 20:51:42 ca Exp $") +SM_RCSID("@(#)$Id: assert.c,v 1.27 2013-11-22 20:51:42 ca Exp $") /* ** Abnormal program termination and assertion checking. diff --git a/contrib/sendmail/libsm/assert.html b/contrib/sendmail/libsm/assert.html index a3251998db6..0d97bc2f3db 100644 --- a/contrib/sendmail/libsm/assert.html +++ b/contrib/sendmail/libsm/assert.html @@ -8,7 +8,7 @@

libsm : Assert and Abort

-
$Id: assert.html,v 1.6 2001/08/27 21:47:03 ca Exp $ +
$Id: assert.html,v 1.6 2001-08-27 21:47:03 ca Exp $

Introduction

diff --git a/contrib/sendmail/libsm/b-strcmp.c b/contrib/sendmail/libsm/b-strcmp.c index f918619c5ac..d2cbc6de47c 100644 --- a/contrib/sendmail/libsm/b-strcmp.c +++ b/contrib/sendmail/libsm/b-strcmp.c @@ -8,7 +8,7 @@ */ #include -SM_RCSID("@(#)$Id: b-strcmp.c,v 1.15 2013/11/22 20:51:42 ca Exp $") +SM_RCSID("@(#)$Id: b-strcmp.c,v 1.15 2013-11-22 20:51:42 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/b-strl.c b/contrib/sendmail/libsm/b-strl.c index eb6fb00da85..1e0e770cf62 100644 --- a/contrib/sendmail/libsm/b-strl.c +++ b/contrib/sendmail/libsm/b-strl.c @@ -19,7 +19,7 @@ */ #include -SM_RCSID("@(#)$Id: b-strl.c,v 1.26 2013/11/22 20:51:42 ca Exp $") +SM_RCSID("@(#)$Id: b-strl.c,v 1.26 2013-11-22 20:51:42 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/cdefs.html b/contrib/sendmail/libsm/cdefs.html index 33e45acfd3e..6a521008730 100644 --- a/contrib/sendmail/libsm/cdefs.html +++ b/contrib/sendmail/libsm/cdefs.html @@ -8,7 +8,7 @@

libsm : C Language Portability Macros

-
$Id: cdefs.html,v 1.2 2000/12/07 17:33:09 dmoen Exp $ +
$Id: cdefs.html,v 1.2 2000-12-07 17:33:09 dmoen Exp $

Description

@@ -86,7 +86,7 @@ SM_DEAD(void exit __P((int))); Examples:
-SM_UNUSED(static const char Id[]) = "@(#)$Id: cdefs.html,v 1.2 2000/12/07 17:33:09 dmoen Exp $";
+SM_UNUSED(static const char Id[]) = "@(#)$Id: cdefs.html,v 1.2 2000-12-07 17:33:09 dmoen Exp $";
 void
 foo(x)
 	SM_UNUSED(int x);
diff --git a/contrib/sendmail/libsm/cf.c b/contrib/sendmail/libsm/cf.c
index fe1adf4baed..62ca3972832 100644
--- a/contrib/sendmail/libsm/cf.c
+++ b/contrib/sendmail/libsm/cf.c
@@ -9,7 +9,7 @@
  */
 
 #include 
-SM_RCSID("@(#)$Id: cf.c,v 1.8 2013/11/22 20:51:42 ca Exp $")
+SM_RCSID("@(#)$Id: cf.c,v 1.8 2013-11-22 20:51:42 ca Exp $")
 
 #include 
 #include 
diff --git a/contrib/sendmail/libsm/clock.c b/contrib/sendmail/libsm/clock.c
index cb53d637252..5e4d7598dba 100644
--- a/contrib/sendmail/libsm/clock.c
+++ b/contrib/sendmail/libsm/clock.c
@@ -12,7 +12,7 @@
  */
 
 #include 
-SM_RCSID("@(#)$Id: clock.c,v 1.48 2013/11/22 20:51:42 ca Exp $")
+SM_RCSID("@(#)$Id: clock.c,v 1.48 2013-11-22 20:51:42 ca Exp $")
 #include 
 #include 
 #include 
diff --git a/contrib/sendmail/libsm/clrerr.c b/contrib/sendmail/libsm/clrerr.c
index 9d98b1d9b95..af5d5ee71be 100644
--- a/contrib/sendmail/libsm/clrerr.c
+++ b/contrib/sendmail/libsm/clrerr.c
@@ -13,7 +13,7 @@
  */
 
 #include 
-SM_RCSID("@(#)$Id: clrerr.c,v 1.14 2013/11/22 20:51:42 ca Exp $")
+SM_RCSID("@(#)$Id: clrerr.c,v 1.14 2013-11-22 20:51:42 ca Exp $")
 #include 
 #include 
 #include "local.h"
diff --git a/contrib/sendmail/libsm/config.c b/contrib/sendmail/libsm/config.c
index 231f9543c40..b8f77d9bbe5 100644
--- a/contrib/sendmail/libsm/config.c
+++ b/contrib/sendmail/libsm/config.c
@@ -9,7 +9,7 @@
  */
 
 #include 
-SM_RCSID("@(#)$Id: config.c,v 1.32 2013/11/22 20:51:42 ca Exp $")
+SM_RCSID("@(#)$Id: config.c,v 1.32 2013-11-22 20:51:42 ca Exp $")
 
 #include 
 #include 
diff --git a/contrib/sendmail/libsm/debug.c b/contrib/sendmail/libsm/debug.c
index 219079018e4..0dbc25733f1 100644
--- a/contrib/sendmail/libsm/debug.c
+++ b/contrib/sendmail/libsm/debug.c
@@ -8,7 +8,7 @@
  */
 
 #include 
-SM_RCSID("@(#)$Id: debug.c,v 1.33 2013/11/22 20:51:42 ca Exp $")
+SM_RCSID("@(#)$Id: debug.c,v 1.33 2013-11-22 20:51:42 ca Exp $")
 
 /*
 **  libsm debugging and tracing
diff --git a/contrib/sendmail/libsm/debug.html b/contrib/sendmail/libsm/debug.html
index a9b184af7c0..75ea551f736 100644
--- a/contrib/sendmail/libsm/debug.html
+++ b/contrib/sendmail/libsm/debug.html
@@ -8,7 +8,7 @@
 
 

libsm : Debugging and Tracing

-
$Id: debug.html,v 1.9 2002/02/02 16:50:56 ca Exp $ +
$Id: debug.html,v 1.9 2002-02-02 16:50:56 ca Exp $

Introduction

diff --git a/contrib/sendmail/libsm/errstring.c b/contrib/sendmail/libsm/errstring.c index 6fc5aeb9722..7233c5a9b3f 100644 --- a/contrib/sendmail/libsm/errstring.c +++ b/contrib/sendmail/libsm/errstring.c @@ -11,7 +11,7 @@ */ #include -SM_RCSID("@(#)$Id: errstring.c,v 1.20 2013/11/22 20:51:42 ca Exp $") +SM_RCSID("@(#)$Id: errstring.c,v 1.20 2013-11-22 20:51:42 ca Exp $") #include #include /* sys_errlist, on some platforms */ diff --git a/contrib/sendmail/libsm/exc.c b/contrib/sendmail/libsm/exc.c index cbb6a62f5fe..d9ebe4419c8 100644 --- a/contrib/sendmail/libsm/exc.c +++ b/contrib/sendmail/libsm/exc.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Id: exc.c,v 1.50 2013/11/22 20:51:42 ca Exp $") +SM_RCSID("@(#)$Id: exc.c,v 1.50 2013-11-22 20:51:42 ca Exp $") /* ** exception handling diff --git a/contrib/sendmail/libsm/exc.html b/contrib/sendmail/libsm/exc.html index 669ebe21323..d9b7941f65c 100644 --- a/contrib/sendmail/libsm/exc.html +++ b/contrib/sendmail/libsm/exc.html @@ -8,7 +8,7 @@

libsm : Exception Handling

-
$Id: exc.html,v 1.13 2006/06/20 17:18:16 ca Exp $ +
$Id: exc.html,v 1.13 2006-06-20 17:18:16 ca Exp $

Introduction

diff --git a/contrib/sendmail/libsm/fclose.c b/contrib/sendmail/libsm/fclose.c index 0e6b4ae6768..963c52ea6a9 100644 --- a/contrib/sendmail/libsm/fclose.c +++ b/contrib/sendmail/libsm/fclose.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: fclose.c,v 1.45 2013/11/22 20:51:42 ca Exp $") +SM_RCSID("@(#)$Id: fclose.c,v 1.45 2013-11-22 20:51:42 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/feof.c b/contrib/sendmail/libsm/feof.c index 4a98eb313b4..b60635458e7 100644 --- a/contrib/sendmail/libsm/feof.c +++ b/contrib/sendmail/libsm/feof.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: feof.c,v 1.14 2013/11/22 20:51:42 ca Exp $") +SM_RCSID("@(#)$Id: feof.c,v 1.14 2013-11-22 20:51:42 ca Exp $") #include #include #include "local.h" diff --git a/contrib/sendmail/libsm/ferror.c b/contrib/sendmail/libsm/ferror.c index 3a1d51ed1b5..77d6caad734 100644 --- a/contrib/sendmail/libsm/ferror.c +++ b/contrib/sendmail/libsm/ferror.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: ferror.c,v 1.14 2013/11/22 20:51:42 ca Exp $") +SM_RCSID("@(#)$Id: ferror.c,v 1.14 2013-11-22 20:51:42 ca Exp $") #include #include #include "local.h" diff --git a/contrib/sendmail/libsm/fflush.c b/contrib/sendmail/libsm/fflush.c index a444d0882bc..ce7300c0601 100644 --- a/contrib/sendmail/libsm/fflush.c +++ b/contrib/sendmail/libsm/fflush.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: fflush.c,v 1.46 2013/11/22 20:51:42 ca Exp $") +SM_RCSID("@(#)$Id: fflush.c,v 1.46 2013-11-22 20:51:42 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/fget.c b/contrib/sendmail/libsm/fget.c index 132c5249140..1883e905d07 100644 --- a/contrib/sendmail/libsm/fget.c +++ b/contrib/sendmail/libsm/fget.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: fget.c,v 1.26 2013/11/22 20:51:42 ca Exp $") +SM_RCSID("@(#)$Id: fget.c,v 1.26 2013-11-22 20:51:42 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/findfp.c b/contrib/sendmail/libsm/findfp.c index 24d9d806c79..25f7663e879 100644 --- a/contrib/sendmail/libsm/findfp.c +++ b/contrib/sendmail/libsm/findfp.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: findfp.c,v 1.68 2013/11/22 20:51:42 ca Exp $") +SM_RCSID("@(#)$Id: findfp.c,v 1.68 2013-11-22 20:51:42 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/flags.c b/contrib/sendmail/libsm/flags.c index cca63166f9f..0786b026ffe 100644 --- a/contrib/sendmail/libsm/flags.c +++ b/contrib/sendmail/libsm/flags.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: flags.c,v 1.24 2013/11/22 20:51:42 ca Exp $") +SM_RCSID("@(#)$Id: flags.c,v 1.24 2013-11-22 20:51:42 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/fopen.c b/contrib/sendmail/libsm/fopen.c index ef53efa60c2..33ddc6015b9 100644 --- a/contrib/sendmail/libsm/fopen.c +++ b/contrib/sendmail/libsm/fopen.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: fopen.c,v 1.63 2013/11/22 20:51:42 ca Exp $") +SM_RCSID("@(#)$Id: fopen.c,v 1.63 2013-11-22 20:51:42 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/fpos.c b/contrib/sendmail/libsm/fpos.c index 63f24dba03b..30015f57599 100644 --- a/contrib/sendmail/libsm/fpos.c +++ b/contrib/sendmail/libsm/fpos.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: fpos.c,v 1.40 2013/11/22 20:51:42 ca Exp $") +SM_RCSID("@(#)$Id: fpos.c,v 1.40 2013-11-22 20:51:42 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/fprintf.c b/contrib/sendmail/libsm/fprintf.c index bcb92b2a309..7242a5ab332 100644 --- a/contrib/sendmail/libsm/fprintf.c +++ b/contrib/sendmail/libsm/fprintf.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: fprintf.c,v 1.18 2013/11/22 20:51:42 ca Exp $") +SM_RCSID("@(#)$Id: fprintf.c,v 1.18 2013-11-22 20:51:42 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/fpurge.c b/contrib/sendmail/libsm/fpurge.c index 2d86f2a0997..9441e1bab17 100644 --- a/contrib/sendmail/libsm/fpurge.c +++ b/contrib/sendmail/libsm/fpurge.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: fpurge.c,v 1.21 2013/11/22 20:51:42 ca Exp $") +SM_RCSID("@(#)$Id: fpurge.c,v 1.21 2013-11-22 20:51:42 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/fput.c b/contrib/sendmail/libsm/fput.c index 764051977bf..ad9f13d603a 100644 --- a/contrib/sendmail/libsm/fput.c +++ b/contrib/sendmail/libsm/fput.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: fput.c,v 1.21 2013/11/22 20:51:42 ca Exp $") +SM_RCSID("@(#)$Id: fput.c,v 1.21 2013-11-22 20:51:42 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/fread.c b/contrib/sendmail/libsm/fread.c index bed66bcca1b..660203bafcd 100644 --- a/contrib/sendmail/libsm/fread.c +++ b/contrib/sendmail/libsm/fread.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: fread.c,v 1.29 2013/11/22 20:51:42 ca Exp $") +SM_RCSID("@(#)$Id: fread.c,v 1.29 2013-11-22 20:51:42 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/fscanf.c b/contrib/sendmail/libsm/fscanf.c index b7dab1e8e97..c45ef3a3cad 100644 --- a/contrib/sendmail/libsm/fscanf.c +++ b/contrib/sendmail/libsm/fscanf.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: fscanf.c,v 1.18 2013/11/22 20:51:42 ca Exp $") +SM_RCSID("@(#)$Id: fscanf.c,v 1.18 2013-11-22 20:51:42 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/fseek.c b/contrib/sendmail/libsm/fseek.c index de58e4e0c44..eb4892ed368 100644 --- a/contrib/sendmail/libsm/fseek.c +++ b/contrib/sendmail/libsm/fseek.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: fseek.c,v 1.48 2013/11/22 20:51:42 ca Exp $") +SM_RCSID("@(#)$Id: fseek.c,v 1.48 2013-11-22 20:51:42 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/fvwrite.c b/contrib/sendmail/libsm/fvwrite.c index 485f78ec62f..4c8f5c373aa 100644 --- a/contrib/sendmail/libsm/fvwrite.c +++ b/contrib/sendmail/libsm/fvwrite.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: fvwrite.c,v 1.50 2013/11/22 20:51:42 ca Exp $") +SM_RCSID("@(#)$Id: fvwrite.c,v 1.50 2013-11-22 20:51:42 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/fvwrite.h b/contrib/sendmail/libsm/fvwrite.h index 11814a30b4a..56a0d8b5dbe 100644 --- a/contrib/sendmail/libsm/fvwrite.h +++ b/contrib/sendmail/libsm/fvwrite.h @@ -11,7 +11,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: fvwrite.h,v 1.8 2013/11/22 20:51:43 ca Exp $ + * $Id: fvwrite.h,v 1.8 2013-11-22 20:51:43 ca Exp $ */ /* I/O descriptors for sm_fvwrite() */ diff --git a/contrib/sendmail/libsm/fwalk.c b/contrib/sendmail/libsm/fwalk.c index c647223b733..7b82215da3f 100644 --- a/contrib/sendmail/libsm/fwalk.c +++ b/contrib/sendmail/libsm/fwalk.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: fwalk.c,v 1.22 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: fwalk.c,v 1.22 2013-11-22 20:51:43 ca Exp $") #include #include #include "local.h" diff --git a/contrib/sendmail/libsm/fwrite.c b/contrib/sendmail/libsm/fwrite.c index c7d9ad6de80..f02b1d2ca56 100644 --- a/contrib/sendmail/libsm/fwrite.c +++ b/contrib/sendmail/libsm/fwrite.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: fwrite.c,v 1.25 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: fwrite.c,v 1.25 2013-11-22 20:51:43 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/gen.html b/contrib/sendmail/libsm/gen.html index cf642ae88b4..f1083d06b2d 100644 --- a/contrib/sendmail/libsm/gen.html +++ b/contrib/sendmail/libsm/gen.html @@ -8,7 +8,7 @@

libsm : General Definitions

-
$Id: gen.html,v 1.5 2000/12/08 21:41:42 ca Exp $ +
$Id: gen.html,v 1.5 2000-12-08 21:41:42 ca Exp $

Introduction

diff --git a/contrib/sendmail/libsm/get.c b/contrib/sendmail/libsm/get.c index fc58fd16a43..2d145cffaa7 100644 --- a/contrib/sendmail/libsm/get.c +++ b/contrib/sendmail/libsm/get.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: get.c,v 1.19 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: get.c,v 1.19 2013-11-22 20:51:43 ca Exp $") #include #include #include "local.h" diff --git a/contrib/sendmail/libsm/glue.h b/contrib/sendmail/libsm/glue.h index d616f44caea..0713d94fb8c 100644 --- a/contrib/sendmail/libsm/glue.h +++ b/contrib/sendmail/libsm/glue.h @@ -11,7 +11,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: glue.h,v 1.7 2013/11/22 20:51:43 ca Exp $ + * $Id: glue.h,v 1.7 2013-11-22 20:51:43 ca Exp $ */ /* diff --git a/contrib/sendmail/libsm/heap.c b/contrib/sendmail/libsm/heap.c index 974865a0c15..dd5e64b0bfd 100644 --- a/contrib/sendmail/libsm/heap.c +++ b/contrib/sendmail/libsm/heap.c @@ -8,7 +8,7 @@ */ #include -SM_RCSID("@(#)$Id: heap.c,v 1.52 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: heap.c,v 1.52 2013-11-22 20:51:43 ca Exp $") /* ** debugging memory allocation package diff --git a/contrib/sendmail/libsm/heap.html b/contrib/sendmail/libsm/heap.html index bc32b012e75..7269008cbb9 100644 --- a/contrib/sendmail/libsm/heap.html +++ b/contrib/sendmail/libsm/heap.html @@ -8,7 +8,7 @@

libsm : Memory Allocation

-
$Id: heap.html,v 1.9 2000/12/08 21:41:42 ca Exp $ +
$Id: heap.html,v 1.9 2000-12-08 21:41:42 ca Exp $

Introduction

diff --git a/contrib/sendmail/libsm/index.html b/contrib/sendmail/libsm/index.html index f2eec16e6c0..a42a483f638 100644 --- a/contrib/sendmail/libsm/index.html +++ b/contrib/sendmail/libsm/index.html @@ -6,7 +6,7 @@

libsm Overview

-
$Id: index.html,v 1.14 2001/02/13 21:21:25 gshapiro Exp $ +
$Id: index.html,v 1.14 2001-02-13 21:21:25 gshapiro Exp $

Introduction

diff --git a/contrib/sendmail/libsm/inet6_ntop.c b/contrib/sendmail/libsm/inet6_ntop.c index 675f79ee412..9cfdd722918 100644 --- a/contrib/sendmail/libsm/inet6_ntop.c +++ b/contrib/sendmail/libsm/inet6_ntop.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Id: inet6_ntop.c,v 1.2 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: inet6_ntop.c,v 1.2 2013-11-22 20:51:43 ca Exp $") #if NETINET6 # include diff --git a/contrib/sendmail/libsm/io.html b/contrib/sendmail/libsm/io.html index 5bb7c32dbc1..5304d26236b 100644 --- a/contrib/sendmail/libsm/io.html +++ b/contrib/sendmail/libsm/io.html @@ -6,7 +6,7 @@ Back to libsm overview

libsm sm_io general overview

-
$Id: io.html,v 1.3 2001/03/17 03:22:50 gshapiro Exp $ +
$Id: io.html,v 1.3 2001-03-17 03:22:50 gshapiro Exp $

Introduction

diff --git a/contrib/sendmail/libsm/ldap.c b/contrib/sendmail/libsm/ldap.c index 586149c6551..9359aedfded 100644 --- a/contrib/sendmail/libsm/ldap.c +++ b/contrib/sendmail/libsm/ldap.c @@ -11,7 +11,7 @@ #define LDAP_DEPRECATED 1 #include -SM_RCSID("@(#)$Id: ldap.c,v 1.86 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: ldap.c,v 1.86 2013-11-22 20:51:43 ca Exp $") #if LDAPMAP # include diff --git a/contrib/sendmail/libsm/local.h b/contrib/sendmail/libsm/local.h index 9ce4122c0e7..8532ad8db6b 100644 --- a/contrib/sendmail/libsm/local.h +++ b/contrib/sendmail/libsm/local.h @@ -11,7 +11,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: local.h,v 1.59 2013/11/22 20:51:43 ca Exp $ + * $Id: local.h,v 1.59 2013-11-22 20:51:43 ca Exp $ */ /* diff --git a/contrib/sendmail/libsm/makebuf.c b/contrib/sendmail/libsm/makebuf.c index dc778a05946..8d05e68bcb9 100644 --- a/contrib/sendmail/libsm/makebuf.c +++ b/contrib/sendmail/libsm/makebuf.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: makebuf.c,v 1.27 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: makebuf.c,v 1.27 2013-11-22 20:51:43 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/match.c b/contrib/sendmail/libsm/match.c index 6aeb2ef4b09..f2516e74816 100644 --- a/contrib/sendmail/libsm/match.c +++ b/contrib/sendmail/libsm/match.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Id: match.c,v 1.11 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: match.c,v 1.11 2013-11-22 20:51:43 ca Exp $") #include diff --git a/contrib/sendmail/libsm/mbdb.c b/contrib/sendmail/libsm/mbdb.c index 482ed7089d2..d68d3b12492 100644 --- a/contrib/sendmail/libsm/mbdb.c +++ b/contrib/sendmail/libsm/mbdb.c @@ -8,7 +8,7 @@ */ #include -SM_RCSID("@(#)$Id: mbdb.c,v 1.43 2014/01/08 17:03:15 ca Exp $") +SM_RCSID("@(#)$Id: mbdb.c,v 1.43 2014-01-08 17:03:15 ca Exp $") #include diff --git a/contrib/sendmail/libsm/memstat.c b/contrib/sendmail/libsm/memstat.c index b8fe04884fc..a58b4c2ed3e 100644 --- a/contrib/sendmail/libsm/memstat.c +++ b/contrib/sendmail/libsm/memstat.c @@ -8,7 +8,7 @@ */ #include -SM_RCSID("@(#)$Id: memstat.c,v 1.7 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: memstat.c,v 1.7 2013-11-22 20:51:43 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/mpeix.c b/contrib/sendmail/libsm/mpeix.c index f997e8197ac..3fe361709f6 100644 --- a/contrib/sendmail/libsm/mpeix.c +++ b/contrib/sendmail/libsm/mpeix.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Id: mpeix.c,v 1.8 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: mpeix.c,v 1.8 2013-11-22 20:51:43 ca Exp $") #ifdef MPE /* diff --git a/contrib/sendmail/libsm/niprop.c b/contrib/sendmail/libsm/niprop.c index 41465cf3f00..ca60e38f53c 100644 --- a/contrib/sendmail/libsm/niprop.c +++ b/contrib/sendmail/libsm/niprop.c @@ -8,7 +8,7 @@ */ #include -SM_RCSID("@(#)$Id: niprop.c,v 1.9 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: niprop.c,v 1.9 2013-11-22 20:51:43 ca Exp $") #if NETINFO #include diff --git a/contrib/sendmail/libsm/path.c b/contrib/sendmail/libsm/path.c index 0e33972d9f4..0819c3e08dc 100644 --- a/contrib/sendmail/libsm/path.c +++ b/contrib/sendmail/libsm/path.c @@ -8,7 +8,7 @@ */ #include -SM_RCSID("@(#)$Id: path.c,v 1.10 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: path.c,v 1.10 2013-11-22 20:51:43 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/put.c b/contrib/sendmail/libsm/put.c index 05de94a959d..567b60af487 100644 --- a/contrib/sendmail/libsm/put.c +++ b/contrib/sendmail/libsm/put.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: put.c,v 1.28 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: put.c,v 1.28 2013-11-22 20:51:43 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/refill.c b/contrib/sendmail/libsm/refill.c index 43c76f917b8..43eee97382d 100644 --- a/contrib/sendmail/libsm/refill.c +++ b/contrib/sendmail/libsm/refill.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: refill.c,v 1.54 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: refill.c,v 1.54 2013-11-22 20:51:43 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/rewind.c b/contrib/sendmail/libsm/rewind.c index 9b079b156c9..9203ddb32f6 100644 --- a/contrib/sendmail/libsm/rewind.c +++ b/contrib/sendmail/libsm/rewind.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: rewind.c,v 1.19 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: rewind.c,v 1.19 2013-11-22 20:51:43 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/rpool.c b/contrib/sendmail/libsm/rpool.c index 4c7598e9ab4..2624123cca9 100644 --- a/contrib/sendmail/libsm/rpool.c +++ b/contrib/sendmail/libsm/rpool.c @@ -8,7 +8,7 @@ */ #include -SM_RCSID("@(#)$Id: rpool.c,v 1.29 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: rpool.c,v 1.29 2013-11-22 20:51:43 ca Exp $") /* ** resource pools diff --git a/contrib/sendmail/libsm/rpool.html b/contrib/sendmail/libsm/rpool.html index f796bc043aa..87794720549 100644 --- a/contrib/sendmail/libsm/rpool.html +++ b/contrib/sendmail/libsm/rpool.html @@ -8,7 +8,7 @@

libsm : Resource Pools

-
$Id: rpool.html,v 1.4 2000/12/07 17:33:09 dmoen Exp $ +
$Id: rpool.html,v 1.4 2000-12-07 17:33:09 dmoen Exp $

Introduction

diff --git a/contrib/sendmail/libsm/sem.c b/contrib/sendmail/libsm/sem.c index 06723c8842d..23b2de70f31 100644 --- a/contrib/sendmail/libsm/sem.c +++ b/contrib/sendmail/libsm/sem.c @@ -8,7 +8,7 @@ */ #include -SM_RCSID("@(#)$Id: sem.c,v 1.15 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: sem.c,v 1.15 2013-11-22 20:51:43 ca Exp $") #if SM_CONF_SEM # include diff --git a/contrib/sendmail/libsm/setvbuf.c b/contrib/sendmail/libsm/setvbuf.c index 0d8bee926c3..85b178b60c8 100644 --- a/contrib/sendmail/libsm/setvbuf.c +++ b/contrib/sendmail/libsm/setvbuf.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: setvbuf.c,v 1.33 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: setvbuf.c,v 1.33 2013-11-22 20:51:43 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/shm.c b/contrib/sendmail/libsm/shm.c index c4045bee82b..ac3919d5723 100644 --- a/contrib/sendmail/libsm/shm.c +++ b/contrib/sendmail/libsm/shm.c @@ -8,7 +8,7 @@ */ #include -SM_RCSID("@(#)$Id: shm.c,v 1.20 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: shm.c,v 1.20 2013-11-22 20:51:43 ca Exp $") #if SM_CONF_SHM # include diff --git a/contrib/sendmail/libsm/signal.c b/contrib/sendmail/libsm/signal.c index b8d6a3433ec..469b0fd7050 100644 --- a/contrib/sendmail/libsm/signal.c +++ b/contrib/sendmail/libsm/signal.c @@ -8,7 +8,7 @@ */ #include -SM_RCSID("@(#)$Id: signal.c,v 1.18 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: signal.c,v 1.18 2013-11-22 20:51:43 ca Exp $") #if SM_CONF_SETITIMER # include diff --git a/contrib/sendmail/libsm/smstdio.c b/contrib/sendmail/libsm/smstdio.c index 711609db9d2..10af9b12b27 100644 --- a/contrib/sendmail/libsm/smstdio.c +++ b/contrib/sendmail/libsm/smstdio.c @@ -8,7 +8,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: smstdio.c,v 1.35 2013/11/22 20:51:43 ca Exp $") +SM_IDSTR(id, "@(#)$Id: smstdio.c,v 1.35 2013-11-22 20:51:43 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/snprintf.c b/contrib/sendmail/libsm/snprintf.c index ee12d97918d..be251a34dc2 100644 --- a/contrib/sendmail/libsm/snprintf.c +++ b/contrib/sendmail/libsm/snprintf.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: snprintf.c,v 1.25 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: snprintf.c,v 1.25 2013-11-22 20:51:43 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/stdio.c b/contrib/sendmail/libsm/stdio.c index 974b2427634..a13f2ffd6c7 100644 --- a/contrib/sendmail/libsm/stdio.c +++ b/contrib/sendmail/libsm/stdio.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: stdio.c,v 1.72 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: stdio.c,v 1.72 2013-11-22 20:51:43 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/strcasecmp.c b/contrib/sendmail/libsm/strcasecmp.c index 3f1c218c6f1..1e7cb541556 100644 --- a/contrib/sendmail/libsm/strcasecmp.c +++ b/contrib/sendmail/libsm/strcasecmp.c @@ -12,7 +12,7 @@ */ #include -SM_RCSID("@(#)$Id: strcasecmp.c,v 1.16 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: strcasecmp.c,v 1.16 2013-11-22 20:51:43 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/strdup.c b/contrib/sendmail/libsm/strdup.c index e7de0375ad4..3ddf73b4629 100644 --- a/contrib/sendmail/libsm/strdup.c +++ b/contrib/sendmail/libsm/strdup.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Id: strdup.c,v 1.16 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: strdup.c,v 1.16 2013-11-22 20:51:43 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/strerror.c b/contrib/sendmail/libsm/strerror.c index 4b9e15fc439..b6b0b668ab5 100644 --- a/contrib/sendmail/libsm/strerror.c +++ b/contrib/sendmail/libsm/strerror.c @@ -12,7 +12,7 @@ */ #include -SM_RCSID("@(#)$Id: strerror.c,v 1.24 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: strerror.c,v 1.24 2013-11-22 20:51:43 ca Exp $") /* ** define strerror for platforms that lack it. diff --git a/contrib/sendmail/libsm/strexit.c b/contrib/sendmail/libsm/strexit.c index 74bac560a1d..13b14b703d0 100644 --- a/contrib/sendmail/libsm/strexit.c +++ b/contrib/sendmail/libsm/strexit.c @@ -8,7 +8,7 @@ */ #include -SM_RCSID("@(#)$Id: strexit.c,v 1.6 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: strexit.c,v 1.6 2013-11-22 20:51:43 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/string.c b/contrib/sendmail/libsm/string.c index fe53d211918..2b06e2c7ec7 100644 --- a/contrib/sendmail/libsm/string.c +++ b/contrib/sendmail/libsm/string.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Id: string.c,v 1.4 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: string.c,v 1.4 2013-11-22 20:51:43 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/stringf.c b/contrib/sendmail/libsm/stringf.c index fa9814b35b8..41b8898542e 100644 --- a/contrib/sendmail/libsm/stringf.c +++ b/contrib/sendmail/libsm/stringf.c @@ -8,7 +8,7 @@ */ #include -SM_RCSID("@(#)$Id: stringf.c,v 1.16 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: stringf.c,v 1.16 2013-11-22 20:51:43 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/strio.c b/contrib/sendmail/libsm/strio.c index 4775858bd55..4fae8070ad0 100644 --- a/contrib/sendmail/libsm/strio.c +++ b/contrib/sendmail/libsm/strio.c @@ -13,7 +13,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: strio.c,v 1.45 2013/11/22 20:51:43 ca Exp $") +SM_IDSTR(id, "@(#)$Id: strio.c,v 1.45 2013-11-22 20:51:43 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/strl.c b/contrib/sendmail/libsm/strl.c index bcf2382aafb..ba1b24c45a3 100644 --- a/contrib/sendmail/libsm/strl.c +++ b/contrib/sendmail/libsm/strl.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Id: strl.c,v 1.32 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: strl.c,v 1.32 2013-11-22 20:51:43 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/strrevcmp.c b/contrib/sendmail/libsm/strrevcmp.c index 9403c89d9dc..f5f51eaa78a 100644 --- a/contrib/sendmail/libsm/strrevcmp.c +++ b/contrib/sendmail/libsm/strrevcmp.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Id: strrevcmp.c,v 1.6 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: strrevcmp.c,v 1.6 2013-11-22 20:51:43 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/strto.c b/contrib/sendmail/libsm/strto.c index a264cbadfdd..7f53424faf5 100644 --- a/contrib/sendmail/libsm/strto.c +++ b/contrib/sendmail/libsm/strto.c @@ -10,7 +10,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: strto.c,v 1.19 2013/11/22 20:51:43 ca Exp $") +SM_IDSTR(id, "@(#)$Id: strto.c,v 1.19 2013-11-22 20:51:43 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/syslogio.c b/contrib/sendmail/libsm/syslogio.c index 02130246dca..78cf700aff3 100644 --- a/contrib/sendmail/libsm/syslogio.c +++ b/contrib/sendmail/libsm/syslogio.c @@ -8,7 +8,7 @@ */ #include -SM_RCSID("@(#)$Id: syslogio.c,v 1.30 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: syslogio.c,v 1.30 2013-11-22 20:51:43 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/t-cf.c b/contrib/sendmail/libsm/t-cf.c index 7fa89f9064a..4b873a51f64 100644 --- a/contrib/sendmail/libsm/t-cf.c +++ b/contrib/sendmail/libsm/t-cf.c @@ -9,7 +9,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: t-cf.c,v 1.8 2013/11/22 20:51:43 ca Exp $") +SM_IDSTR(id, "@(#)$Id: t-cf.c,v 1.8 2013-11-22 20:51:43 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/t-event.c b/contrib/sendmail/libsm/t-event.c index 611599eee9a..7f08b914bb5 100644 --- a/contrib/sendmail/libsm/t-event.c +++ b/contrib/sendmail/libsm/t-event.c @@ -8,7 +8,7 @@ */ #include -SM_RCSID("@(#)$Id: t-event.c,v 1.14 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: t-event.c,v 1.14 2013-11-22 20:51:43 ca Exp $") #include diff --git a/contrib/sendmail/libsm/t-exc.c b/contrib/sendmail/libsm/t-exc.c index 94557035201..e0b45a86d52 100644 --- a/contrib/sendmail/libsm/t-exc.c +++ b/contrib/sendmail/libsm/t-exc.c @@ -8,7 +8,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: t-exc.c,v 1.21 2013/11/22 20:51:43 ca Exp $") +SM_IDSTR(id, "@(#)$Id: t-exc.c,v 1.21 2013-11-22 20:51:43 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/t-fget.c b/contrib/sendmail/libsm/t-fget.c index ab2145c6e5c..414979845de 100644 --- a/contrib/sendmail/libsm/t-fget.c +++ b/contrib/sendmail/libsm/t-fget.c @@ -8,7 +8,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: t-fget.c,v 1.2 2013/11/22 20:51:43 ca Exp $") +SM_IDSTR(id, "@(#)$Id: t-fget.c,v 1.2 2013-11-22 20:51:43 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/t-float.c b/contrib/sendmail/libsm/t-float.c index 93f7434cc47..c34c1535e2b 100644 --- a/contrib/sendmail/libsm/t-float.c +++ b/contrib/sendmail/libsm/t-float.c @@ -8,7 +8,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: t-float.c,v 1.19 2013/11/22 20:51:43 ca Exp $") +SM_IDSTR(id, "@(#)$Id: t-float.c,v 1.19 2013-11-22 20:51:43 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/t-fopen.c b/contrib/sendmail/libsm/t-fopen.c index 143bb943df8..4f3da65c762 100644 --- a/contrib/sendmail/libsm/t-fopen.c +++ b/contrib/sendmail/libsm/t-fopen.c @@ -8,7 +8,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: t-fopen.c,v 1.10 2013/11/22 20:51:43 ca Exp $") +SM_IDSTR(id, "@(#)$Id: t-fopen.c,v 1.10 2013-11-22 20:51:43 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/t-heap.c b/contrib/sendmail/libsm/t-heap.c index 60528239066..d5e9e7e3f54 100644 --- a/contrib/sendmail/libsm/t-heap.c +++ b/contrib/sendmail/libsm/t-heap.c @@ -8,7 +8,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: t-heap.c,v 1.11 2013/11/22 20:51:43 ca Exp $") +SM_IDSTR(id, "@(#)$Id: t-heap.c,v 1.11 2013-11-22 20:51:43 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/t-inet6_ntop.c b/contrib/sendmail/libsm/t-inet6_ntop.c index 525bbecd0bb..ff3bef6a65a 100644 --- a/contrib/sendmail/libsm/t-inet6_ntop.c +++ b/contrib/sendmail/libsm/t-inet6_ntop.c @@ -8,7 +8,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: t-inet6_ntop.c,v 1.2 2013/11/22 20:51:43 ca Exp $") +SM_IDSTR(id, "@(#)$Id: t-inet6_ntop.c,v 1.2 2013-11-22 20:51:43 ca Exp $") #include #if NETINET6 diff --git a/contrib/sendmail/libsm/t-match.c b/contrib/sendmail/libsm/t-match.c index ec07239a49d..8cdd0680a74 100644 --- a/contrib/sendmail/libsm/t-match.c +++ b/contrib/sendmail/libsm/t-match.c @@ -8,7 +8,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: t-match.c,v 1.10 2013/11/22 20:51:43 ca Exp $") +SM_IDSTR(id, "@(#)$Id: t-match.c,v 1.10 2013-11-22 20:51:43 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/t-memstat.c b/contrib/sendmail/libsm/t-memstat.c index a4622b64b42..ca9dc9b43fd 100644 --- a/contrib/sendmail/libsm/t-memstat.c +++ b/contrib/sendmail/libsm/t-memstat.c @@ -8,7 +8,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: t-memstat.c,v 1.11 2013/11/22 20:51:43 ca Exp $") +SM_IDSTR(id, "@(#)$Id: t-memstat.c,v 1.11 2013-11-22 20:51:43 ca Exp $") #include diff --git a/contrib/sendmail/libsm/t-path.c b/contrib/sendmail/libsm/t-path.c index 1387fc635e9..b664e66e236 100644 --- a/contrib/sendmail/libsm/t-path.c +++ b/contrib/sendmail/libsm/t-path.c @@ -8,7 +8,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: t-path.c,v 1.9 2013/11/22 20:51:43 ca Exp $") +SM_IDSTR(id, "@(#)$Id: t-path.c,v 1.9 2013-11-22 20:51:43 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/t-qic.c b/contrib/sendmail/libsm/t-qic.c index 0e62dd44329..11375750a19 100644 --- a/contrib/sendmail/libsm/t-qic.c +++ b/contrib/sendmail/libsm/t-qic.c @@ -8,7 +8,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: t-qic.c,v 1.10 2013/11/22 20:51:43 ca Exp $") +SM_IDSTR(id, "@(#)$Id: t-qic.c,v 1.10 2013-11-22 20:51:43 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/t-rpool.c b/contrib/sendmail/libsm/t-rpool.c index 6408c1b469a..cdbb872df10 100644 --- a/contrib/sendmail/libsm/t-rpool.c +++ b/contrib/sendmail/libsm/t-rpool.c @@ -8,7 +8,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: t-rpool.c,v 1.19 2013/11/22 20:51:43 ca Exp $") +SM_IDSTR(id, "@(#)$Id: t-rpool.c,v 1.19 2013-11-22 20:51:43 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/t-scanf.c b/contrib/sendmail/libsm/t-scanf.c index e7e980759f6..d7c20f748ab 100644 --- a/contrib/sendmail/libsm/t-scanf.c +++ b/contrib/sendmail/libsm/t-scanf.c @@ -8,7 +8,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: t-scanf.c,v 1.6 2013/11/22 20:51:43 ca Exp $") +SM_IDSTR(id, "@(#)$Id: t-scanf.c,v 1.6 2013-11-22 20:51:43 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/t-sem.c b/contrib/sendmail/libsm/t-sem.c index 017ba7cdd82..4232b096ead 100644 --- a/contrib/sendmail/libsm/t-sem.c +++ b/contrib/sendmail/libsm/t-sem.c @@ -8,7 +8,7 @@ */ #include -SM_RCSID("@(#)$Id: t-sem.c,v 1.18 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: t-sem.c,v 1.18 2013-11-22 20:51:43 ca Exp $") #include diff --git a/contrib/sendmail/libsm/t-shm.c b/contrib/sendmail/libsm/t-shm.c index 5a81f225c50..a9958fe026a 100644 --- a/contrib/sendmail/libsm/t-shm.c +++ b/contrib/sendmail/libsm/t-shm.c @@ -8,7 +8,7 @@ */ #include -SM_RCSID("@(#)$Id: t-shm.c,v 1.23 2013/11/22 20:51:43 ca Exp $") +SM_RCSID("@(#)$Id: t-shm.c,v 1.23 2013-11-22 20:51:43 ca Exp $") #include diff --git a/contrib/sendmail/libsm/t-smstdio.c b/contrib/sendmail/libsm/t-smstdio.c index 32d770b4593..7f0b07e1518 100644 --- a/contrib/sendmail/libsm/t-smstdio.c +++ b/contrib/sendmail/libsm/t-smstdio.c @@ -8,7 +8,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: t-smstdio.c,v 1.12 2013/11/22 20:51:43 ca Exp $") +SM_IDSTR(id, "@(#)$Id: t-smstdio.c,v 1.12 2013-11-22 20:51:43 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/t-string.c b/contrib/sendmail/libsm/t-string.c index 03e5ca80a29..7e46a812fed 100644 --- a/contrib/sendmail/libsm/t-string.c +++ b/contrib/sendmail/libsm/t-string.c @@ -8,7 +8,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: t-string.c,v 1.12 2013/11/22 20:51:43 ca Exp $") +SM_IDSTR(id, "@(#)$Id: t-string.c,v 1.12 2013-11-22 20:51:43 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/t-strio.c b/contrib/sendmail/libsm/t-strio.c index 17cfc7b5d9a..f1f479e9c93 100644 --- a/contrib/sendmail/libsm/t-strio.c +++ b/contrib/sendmail/libsm/t-strio.c @@ -8,7 +8,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: t-strio.c,v 1.12 2013/11/22 20:51:44 ca Exp $") +SM_IDSTR(id, "@(#)$Id: t-strio.c,v 1.12 2013-11-22 20:51:44 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/t-strl.c b/contrib/sendmail/libsm/t-strl.c index 24dc8df0727..2f6032bd9ac 100644 --- a/contrib/sendmail/libsm/t-strl.c +++ b/contrib/sendmail/libsm/t-strl.c @@ -9,7 +9,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: t-strl.c,v 1.16 2013/11/22 20:51:44 ca Exp $") +SM_IDSTR(id, "@(#)$Id: t-strl.c,v 1.16 2013-11-22 20:51:44 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/t-strrevcmp.c b/contrib/sendmail/libsm/t-strrevcmp.c index a4031be42e0..ed5f20400ea 100644 --- a/contrib/sendmail/libsm/t-strrevcmp.c +++ b/contrib/sendmail/libsm/t-strrevcmp.c @@ -8,7 +8,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: t-strrevcmp.c,v 1.4 2013/11/22 20:51:44 ca Exp $") +SM_IDSTR(id, "@(#)$Id: t-strrevcmp.c,v 1.4 2013-11-22 20:51:44 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/t-types.c b/contrib/sendmail/libsm/t-types.c index aed1e93d7bc..c58c78c9d9c 100644 --- a/contrib/sendmail/libsm/t-types.c +++ b/contrib/sendmail/libsm/t-types.c @@ -8,7 +8,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: t-types.c,v 1.19 2013/11/22 20:51:44 ca Exp $") +SM_IDSTR(id, "@(#)$Id: t-types.c,v 1.19 2013-11-22 20:51:44 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/test.c b/contrib/sendmail/libsm/test.c index 117e89bb569..0aee5ae4aa6 100644 --- a/contrib/sendmail/libsm/test.c +++ b/contrib/sendmail/libsm/test.c @@ -8,7 +8,7 @@ */ #include -SM_IDSTR(Id, "@(#)$Id: test.c,v 1.17 2013/11/22 20:51:44 ca Exp $") +SM_IDSTR(Id, "@(#)$Id: test.c,v 1.17 2013-11-22 20:51:44 ca Exp $") /* ** Abstractions for writing libsm test programs. diff --git a/contrib/sendmail/libsm/ungetc.c b/contrib/sendmail/libsm/ungetc.c index 36d62e68f13..5ac0d6eedb8 100644 --- a/contrib/sendmail/libsm/ungetc.c +++ b/contrib/sendmail/libsm/ungetc.c @@ -13,7 +13,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: ungetc.c,v 1.31 2013/11/22 20:51:44 ca Exp $") +SM_IDSTR(id, "@(#)$Id: ungetc.c,v 1.31 2013-11-22 20:51:44 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/util.c b/contrib/sendmail/libsm/util.c index 7a600ae2597..1653fbdbb15 100644 --- a/contrib/sendmail/libsm/util.c +++ b/contrib/sendmail/libsm/util.c @@ -10,7 +10,7 @@ #include -SM_RCSID("@(#)$Id: util.c,v 1.10 2013/11/22 20:51:44 ca Exp $") +SM_RCSID("@(#)$Id: util.c,v 1.10 2013-11-22 20:51:44 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/vasprintf.c b/contrib/sendmail/libsm/vasprintf.c index 7507656f766..a880889a3d3 100644 --- a/contrib/sendmail/libsm/vasprintf.c +++ b/contrib/sendmail/libsm/vasprintf.c @@ -24,7 +24,7 @@ */ #include -SM_RCSID("@(#)$Id: vasprintf.c,v 1.28 2013/11/22 20:51:44 ca Exp $") +SM_RCSID("@(#)$Id: vasprintf.c,v 1.28 2013-11-22 20:51:44 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/vfprintf.c b/contrib/sendmail/libsm/vfprintf.c index fcc18a10c61..860938d3168 100644 --- a/contrib/sendmail/libsm/vfprintf.c +++ b/contrib/sendmail/libsm/vfprintf.c @@ -13,7 +13,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: vfprintf.c,v 1.55 2013/11/22 20:51:44 ca Exp $") +SM_IDSTR(id, "@(#)$Id: vfprintf.c,v 1.55 2013-11-22 20:51:44 ca Exp $") /* ** Overall: diff --git a/contrib/sendmail/libsm/vfscanf.c b/contrib/sendmail/libsm/vfscanf.c index a2b871a6070..d043a113588 100644 --- a/contrib/sendmail/libsm/vfscanf.c +++ b/contrib/sendmail/libsm/vfscanf.c @@ -13,7 +13,7 @@ */ #include -SM_IDSTR(id, "@(#)$Id: vfscanf.c,v 1.55 2013/11/22 20:51:44 ca Exp $") +SM_IDSTR(id, "@(#)$Id: vfscanf.c,v 1.55 2013-11-22 20:51:44 ca Exp $") #include #include diff --git a/contrib/sendmail/libsm/vprintf.c b/contrib/sendmail/libsm/vprintf.c index 4061a669084..670482960d9 100644 --- a/contrib/sendmail/libsm/vprintf.c +++ b/contrib/sendmail/libsm/vprintf.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: vprintf.c,v 1.15 2013/11/22 20:51:44 ca Exp $") +SM_RCSID("@(#)$Id: vprintf.c,v 1.15 2013-11-22 20:51:44 ca Exp $") #include #include "local.h" diff --git a/contrib/sendmail/libsm/vsnprintf.c b/contrib/sendmail/libsm/vsnprintf.c index 15abcbacd47..f0da6028531 100644 --- a/contrib/sendmail/libsm/vsnprintf.c +++ b/contrib/sendmail/libsm/vsnprintf.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: vsnprintf.c,v 1.24 2013/11/22 20:51:44 ca Exp $") +SM_RCSID("@(#)$Id: vsnprintf.c,v 1.24 2013-11-22 20:51:44 ca Exp $") #include #include #include "local.h" diff --git a/contrib/sendmail/libsm/wbuf.c b/contrib/sendmail/libsm/wbuf.c index b52e97e0c63..e2ea36a2bc3 100644 --- a/contrib/sendmail/libsm/wbuf.c +++ b/contrib/sendmail/libsm/wbuf.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: wbuf.c,v 1.22 2013/11/22 20:51:44 ca Exp $") +SM_RCSID("@(#)$Id: wbuf.c,v 1.22 2013-11-22 20:51:44 ca Exp $") #include #include #include "local.h" diff --git a/contrib/sendmail/libsm/wsetup.c b/contrib/sendmail/libsm/wsetup.c index 1d8b48f30bb..bcb4df7f4fc 100644 --- a/contrib/sendmail/libsm/wsetup.c +++ b/contrib/sendmail/libsm/wsetup.c @@ -13,7 +13,7 @@ */ #include -SM_RCSID("@(#)$Id: wsetup.c,v 1.21 2013/11/22 20:51:44 ca Exp $") +SM_RCSID("@(#)$Id: wsetup.c,v 1.21 2013-11-22 20:51:44 ca Exp $") #include #include #include diff --git a/contrib/sendmail/libsm/xtrap.c b/contrib/sendmail/libsm/xtrap.c index c25450bf742..368bd03b54c 100644 --- a/contrib/sendmail/libsm/xtrap.c +++ b/contrib/sendmail/libsm/xtrap.c @@ -8,7 +8,7 @@ */ #include -SM_RCSID("@(#)$Id: xtrap.c,v 1.6 2013/11/22 20:51:44 ca Exp $") +SM_RCSID("@(#)$Id: xtrap.c,v 1.6 2013-11-22 20:51:44 ca Exp $") #include diff --git a/contrib/sendmail/libsmdb/Makefile b/contrib/sendmail/libsmdb/Makefile index 0422ed5cb3d..13c8af07a52 100644 --- a/contrib/sendmail/libsmdb/Makefile +++ b/contrib/sendmail/libsmdb/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 8.2 1999/09/23 22:36:29 ca Exp $ +# $Id: Makefile,v 8.2 1999-09-23 22:36:29 ca Exp $ SHELL= /bin/sh BUILD= ./Build diff --git a/contrib/sendmail/libsmdb/Makefile.m4 b/contrib/sendmail/libsmdb/Makefile.m4 index 85f7084cc0f..dfd62fa6a37 100644 --- a/contrib/sendmail/libsmdb/Makefile.m4 +++ b/contrib/sendmail/libsmdb/Makefile.m4 @@ -1,4 +1,4 @@ -dnl $Id: Makefile.m4,v 8.15 2006/06/28 21:08:01 ca Exp $ +dnl $Id: Makefile.m4,v 8.15 2006-06-28 21:08:01 ca Exp $ include(confBUILDTOOLSDIR`/M4/switch.m4') define(`confREQUIRE_SM_OS_H', `true') diff --git a/contrib/sendmail/libsmdb/smdb.c b/contrib/sendmail/libsmdb/smdb.c index 8442246fec9..74d42e29913 100644 --- a/contrib/sendmail/libsmdb/smdb.c +++ b/contrib/sendmail/libsmdb/smdb.c @@ -8,7 +8,7 @@ */ #include -SM_RCSID("@(#)$Id: smdb.c,v 8.59 2013/11/22 20:51:49 ca Exp $") +SM_RCSID("@(#)$Id: smdb.c,v 8.59 2013-11-22 20:51:49 ca Exp $") #include #include diff --git a/contrib/sendmail/libsmdb/smdb1.c b/contrib/sendmail/libsmdb/smdb1.c index 2bd9ce0fd64..9d4e958032a 100644 --- a/contrib/sendmail/libsmdb/smdb1.c +++ b/contrib/sendmail/libsmdb/smdb1.c @@ -8,7 +8,7 @@ */ #include -SM_RCSID("@(#)$Id: smdb1.c,v 8.63 2013/11/22 20:51:49 ca Exp $") +SM_RCSID("@(#)$Id: smdb1.c,v 8.63 2013-11-22 20:51:49 ca Exp $") #include #include diff --git a/contrib/sendmail/libsmdb/smdb2.c b/contrib/sendmail/libsmdb/smdb2.c index 12e4192fb93..403040307a9 100644 --- a/contrib/sendmail/libsmdb/smdb2.c +++ b/contrib/sendmail/libsmdb/smdb2.c @@ -8,7 +8,7 @@ */ #include -SM_RCSID("@(#)$Id: smdb2.c,v 8.83 2013/11/22 20:51:49 ca Exp $") +SM_RCSID("@(#)$Id: smdb2.c,v 8.83 2013-11-22 20:51:49 ca Exp $") #include #include diff --git a/contrib/sendmail/libsmdb/smndbm.c b/contrib/sendmail/libsmdb/smndbm.c index 4ea6e581829..579c5f55171 100644 --- a/contrib/sendmail/libsmdb/smndbm.c +++ b/contrib/sendmail/libsmdb/smndbm.c @@ -8,7 +8,7 @@ */ #include -SM_RCSID("@(#)$Id: smndbm.c,v 8.55 2013/11/22 20:51:49 ca Exp $") +SM_RCSID("@(#)$Id: smndbm.c,v 8.55 2013-11-22 20:51:49 ca Exp $") #include #include diff --git a/contrib/sendmail/libsmutil/Makefile b/contrib/sendmail/libsmutil/Makefile index 2de323192e3..baffab14d0d 100644 --- a/contrib/sendmail/libsmutil/Makefile +++ b/contrib/sendmail/libsmutil/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 8.2 1999/09/23 22:36:32 ca Exp $ +# $Id: Makefile,v 8.2 1999-09-23 22:36:32 ca Exp $ SHELL= /bin/sh BUILD= ./Build diff --git a/contrib/sendmail/libsmutil/Makefile.m4 b/contrib/sendmail/libsmutil/Makefile.m4 index 1e7dcb4a326..e8efdc2cd95 100644 --- a/contrib/sendmail/libsmutil/Makefile.m4 +++ b/contrib/sendmail/libsmutil/Makefile.m4 @@ -1,4 +1,4 @@ -dnl $Id: Makefile.m4,v 8.18 2006/06/28 21:02:39 ca Exp $ +dnl $Id: Makefile.m4,v 8.18 2006-06-28 21:02:39 ca Exp $ include(confBUILDTOOLSDIR`/M4/switch.m4') define(`confREQUIRE_SM_OS_H', `true') diff --git a/contrib/sendmail/libsmutil/cf.c b/contrib/sendmail/libsmutil/cf.c index 7048c837f6f..e447aca4f79 100644 --- a/contrib/sendmail/libsmutil/cf.c +++ b/contrib/sendmail/libsmutil/cf.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Id: cf.c,v 8.20 2013/11/22 20:51:50 ca Exp $") +SM_RCSID("@(#)$Id: cf.c,v 8.20 2013-11-22 20:51:50 ca Exp $") #include /* diff --git a/contrib/sendmail/libsmutil/debug.c b/contrib/sendmail/libsmutil/debug.c index 91db5960ee0..a9061b96d3d 100644 --- a/contrib/sendmail/libsmutil/debug.c +++ b/contrib/sendmail/libsmutil/debug.c @@ -10,6 +10,6 @@ #include -SM_RCSID("@(#)$Id: debug.c,v 8.10 2013/11/22 20:51:50 ca Exp $") +SM_RCSID("@(#)$Id: debug.c,v 8.10 2013-11-22 20:51:50 ca Exp $") unsigned char tTdvect[100]; /* trace vector */ diff --git a/contrib/sendmail/libsmutil/err.c b/contrib/sendmail/libsmutil/err.c index 92c5a8f31ff..c3547d2a56b 100644 --- a/contrib/sendmail/libsmutil/err.c +++ b/contrib/sendmail/libsmutil/err.c @@ -10,7 +10,7 @@ #include -SM_RCSID("@(#)$Id: err.c,v 8.6 2013/11/22 20:51:50 ca Exp $") +SM_RCSID("@(#)$Id: err.c,v 8.6 2013-11-22 20:51:50 ca Exp $") #include diff --git a/contrib/sendmail/libsmutil/lockfile.c b/contrib/sendmail/libsmutil/lockfile.c index ae4020c0625..0d46b3cfdd6 100644 --- a/contrib/sendmail/libsmutil/lockfile.c +++ b/contrib/sendmail/libsmutil/lockfile.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: lockfile.c,v 8.22 2013/11/22 20:51:50 ca Exp $") +SM_RCSID("@(#)$Id: lockfile.c,v 8.22 2013-11-22 20:51:50 ca Exp $") /* diff --git a/contrib/sendmail/libsmutil/safefile.c b/contrib/sendmail/libsmutil/safefile.c index cd1d1ed7e8e..43d66eceee1 100644 --- a/contrib/sendmail/libsmutil/safefile.c +++ b/contrib/sendmail/libsmutil/safefile.c @@ -15,7 +15,7 @@ #include #include -SM_RCSID("@(#)$Id: safefile.c,v 8.130 2013/11/22 20:51:50 ca Exp $") +SM_RCSID("@(#)$Id: safefile.c,v 8.130 2013-11-22 20:51:50 ca Exp $") /* diff --git a/contrib/sendmail/libsmutil/snprintf.c b/contrib/sendmail/libsmutil/snprintf.c index 4e347a79eef..e11a92162ee 100644 --- a/contrib/sendmail/libsmutil/snprintf.c +++ b/contrib/sendmail/libsmutil/snprintf.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: snprintf.c,v 8.45 2013/11/22 20:51:50 ca Exp $") +SM_RCSID("@(#)$Id: snprintf.c,v 8.45 2013-11-22 20:51:50 ca Exp $") /* ** SHORTENSTRING -- return short version of a string diff --git a/contrib/sendmail/mail.local/Makefile b/contrib/sendmail/mail.local/Makefile index b560a3039df..f3776a9d502 100644 --- a/contrib/sendmail/mail.local/Makefile +++ b/contrib/sendmail/mail.local/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 8.5 1999/10/05 16:39:32 ca Exp $ +# $Id: Makefile,v 8.5 1999-10-05 16:39:32 ca Exp $ SHELL= /bin/sh BUILD= ./Build diff --git a/contrib/sendmail/mail.local/Makefile.m4 b/contrib/sendmail/mail.local/Makefile.m4 index 4f1e763a438..73c8213ed83 100644 --- a/contrib/sendmail/mail.local/Makefile.m4 +++ b/contrib/sendmail/mail.local/Makefile.m4 @@ -1,4 +1,4 @@ -dnl $Id: Makefile.m4,v 8.52 2006/06/28 21:08:02 ca Exp $ +dnl $Id: Makefile.m4,v 8.52 2006-06-28 21:08:02 ca Exp $ include(confBUILDTOOLSDIR`/M4/switch.m4') define(`confREQUIRE_LIBSM', `true') diff --git a/contrib/sendmail/mail.local/README b/contrib/sendmail/mail.local/README index 2ab9dbc4af9..8507ae2dbee 100644 --- a/contrib/sendmail/mail.local/README +++ b/contrib/sendmail/mail.local/README @@ -61,4 +61,4 @@ subdirectory tree. The subdirectories will be named with A-Z, a-z, 0-9, +, and _. The hash type is "m", so use "-H m3" to get a three level MD5 based hash. -$Revision: 8.11 $, Last updated $Date: 2003/10/20 20:19:13 $ +$Revision: 8.11 $, Last updated $Date: 2003-10-20 20:19:13 $ diff --git a/contrib/sendmail/mail.local/mail.local.8 b/contrib/sendmail/mail.local/mail.local.8 index 1a968cc354e..172c70446b4 100644 --- a/contrib/sendmail/mail.local/mail.local.8 +++ b/contrib/sendmail/mail.local/mail.local.8 @@ -8,9 +8,9 @@ .\" the sendmail distribution. .\" .\" -.\" $Id: mail.local.8,v 8.26 2013/11/22 20:51:51 ca Exp $ +.\" $Id: mail.local.8,v 8.26 2013-11-22 20:51:51 ca Exp $ .\" -.TH MAIL.LOCAL 8 "$Date: 2013/11/22 20:51:51 $" +.TH MAIL.LOCAL 8 "$Date: 2013-11-22 20:51:51 $" .SH NAME mail.local \- store mail in a mailbox diff --git a/contrib/sendmail/mail.local/mail.local.c b/contrib/sendmail/mail.local/mail.local.c index 617eefc1d7b..52998e2f7db 100644 --- a/contrib/sendmail/mail.local/mail.local.c +++ b/contrib/sendmail/mail.local/mail.local.c @@ -20,7 +20,7 @@ SM_IDSTR(copyright, Copyright (c) 1990, 1993, 1994\n\ The Regents of the University of California. All rights reserved.\n") -SM_IDSTR(id, "@(#)$Id: mail.local.c,v 8.257 2013/11/22 20:51:51 ca Exp $") +SM_IDSTR(id, "@(#)$Id: mail.local.c,v 8.257 2013-11-22 20:51:51 ca Exp $") #include #include diff --git a/contrib/sendmail/mailstats/Makefile b/contrib/sendmail/mailstats/Makefile index 6dbcb62430a..b4137b7c451 100644 --- a/contrib/sendmail/mailstats/Makefile +++ b/contrib/sendmail/mailstats/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 8.5 1999/09/23 22:36:36 ca Exp $ +# $Id: Makefile,v 8.5 1999-09-23 22:36:36 ca Exp $ SHELL= /bin/sh BUILD= ./Build diff --git a/contrib/sendmail/mailstats/Makefile.m4 b/contrib/sendmail/mailstats/Makefile.m4 index 1d454120b9f..a9047898dae 100644 --- a/contrib/sendmail/mailstats/Makefile.m4 +++ b/contrib/sendmail/mailstats/Makefile.m4 @@ -1,4 +1,4 @@ -dnl $Id: Makefile.m4,v 8.36 2006/06/28 21:08:02 ca Exp $ +dnl $Id: Makefile.m4,v 8.36 2006-06-28 21:08:02 ca Exp $ include(confBUILDTOOLSDIR`/M4/switch.m4') define(`confREQUIRE_LIBSM', `true') diff --git a/contrib/sendmail/mailstats/mailstats.8 b/contrib/sendmail/mailstats/mailstats.8 index 4a4b0209027..1cbc1aedae9 100644 --- a/contrib/sendmail/mailstats/mailstats.8 +++ b/contrib/sendmail/mailstats/mailstats.8 @@ -6,9 +6,9 @@ .\" the sendmail distribution. .\" .\" -.\" $Id: mailstats.8,v 8.32 2013/11/22 20:51:51 ca Exp $ +.\" $Id: mailstats.8,v 8.32 2013-11-22 20:51:51 ca Exp $ .\" -.TH MAILSTATS 8 "$Date: 2013/11/22 20:51:51 $" +.TH MAILSTATS 8 "$Date: 2013-11-22 20:51:51 $" .SH NAME mailstats \- display mail statistics diff --git a/contrib/sendmail/mailstats/mailstats.c b/contrib/sendmail/mailstats/mailstats.c index b820395438a..7107e62744b 100644 --- a/contrib/sendmail/mailstats/mailstats.c +++ b/contrib/sendmail/mailstats/mailstats.c @@ -20,7 +20,7 @@ SM_IDSTR(copyright, Copyright (c) 1988, 1993\n\ The Regents of the University of California. All rights reserved.\n") -SM_IDSTR(id, "@(#)$Id: mailstats.c,v 8.103 2013/11/22 20:51:51 ca Exp $") +SM_IDSTR(id, "@(#)$Id: mailstats.c,v 8.103 2013-11-22 20:51:51 ca Exp $") #include #include diff --git a/contrib/sendmail/makemap/Makefile b/contrib/sendmail/makemap/Makefile index a6960c1d22a..953d28b37e7 100644 --- a/contrib/sendmail/makemap/Makefile +++ b/contrib/sendmail/makemap/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 8.7 1999/09/23 22:36:37 ca Exp $ +# $Id: Makefile,v 8.7 1999-09-23 22:36:37 ca Exp $ SHELL= /bin/sh BUILD= ./Build diff --git a/contrib/sendmail/makemap/Makefile.m4 b/contrib/sendmail/makemap/Makefile.m4 index 9d5baf9e604..c6dffd0f57f 100644 --- a/contrib/sendmail/makemap/Makefile.m4 +++ b/contrib/sendmail/makemap/Makefile.m4 @@ -1,4 +1,4 @@ -dnl $Id: Makefile.m4,v 8.44 2006/06/28 21:08:03 ca Exp $ +dnl $Id: Makefile.m4,v 8.44 2006-06-28 21:08:03 ca Exp $ include(confBUILDTOOLSDIR`/M4/switch.m4') define(`confREQUIRE_LIBSM', `true') diff --git a/contrib/sendmail/makemap/makemap.8 b/contrib/sendmail/makemap/makemap.8 index 60352b037d6..a6bfd21462c 100644 --- a/contrib/sendmail/makemap/makemap.8 +++ b/contrib/sendmail/makemap/makemap.8 @@ -8,9 +8,9 @@ .\" the sendmail distribution. .\" .\" -.\" $Id: makemap.8,v 8.32 2013/11/22 20:51:52 ca Exp $ +.\" $Id: makemap.8,v 8.32 2013-11-22 20:51:52 ca Exp $ .\" -.TH MAKEMAP 8 "$Date: 2013/11/22 20:51:52 $" +.TH MAKEMAP 8 "$Date: 2013-11-22 20:51:52 $" .SH NAME makemap \- create database maps for sendmail diff --git a/contrib/sendmail/makemap/makemap.c b/contrib/sendmail/makemap/makemap.c index ae8774584d6..fa889447c5d 100644 --- a/contrib/sendmail/makemap/makemap.c +++ b/contrib/sendmail/makemap/makemap.c @@ -20,7 +20,7 @@ SM_IDSTR(copyright, Copyright (c) 1992, 1993\n\ The Regents of the University of California. All rights reserved.\n") -SM_IDSTR(id, "@(#)$Id: makemap.c,v 8.183 2013/11/22 20:51:52 ca Exp $") +SM_IDSTR(id, "@(#)$Id: makemap.c,v 8.183 2013-11-22 20:51:52 ca Exp $") #include diff --git a/contrib/sendmail/praliases/Makefile b/contrib/sendmail/praliases/Makefile index 6b6db708f24..adf435249c1 100644 --- a/contrib/sendmail/praliases/Makefile +++ b/contrib/sendmail/praliases/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 8.5 1999/09/23 22:36:39 ca Exp $ +# $Id: Makefile,v 8.5 1999-09-23 22:36:39 ca Exp $ SHELL= /bin/sh BUILD= ./Build diff --git a/contrib/sendmail/praliases/Makefile.m4 b/contrib/sendmail/praliases/Makefile.m4 index d6ebeedb6da..6068c57029e 100644 --- a/contrib/sendmail/praliases/Makefile.m4 +++ b/contrib/sendmail/praliases/Makefile.m4 @@ -1,4 +1,4 @@ -dnl $Id: Makefile.m4,v 8.36 2006/06/28 21:08:03 ca Exp $ +dnl $Id: Makefile.m4,v 8.36 2006-06-28 21:08:03 ca Exp $ include(confBUILDTOOLSDIR`/M4/switch.m4') define(`confREQUIRE_LIBSM', `true') diff --git a/contrib/sendmail/praliases/praliases.8 b/contrib/sendmail/praliases/praliases.8 index e263fcf21e1..8a8f66d9055 100644 --- a/contrib/sendmail/praliases/praliases.8 +++ b/contrib/sendmail/praliases/praliases.8 @@ -6,9 +6,9 @@ .\" the sendmail distribution. .\" .\" -.\" $Id: praliases.8,v 8.20 2013/11/22 20:51:53 ca Exp $ +.\" $Id: praliases.8,v 8.20 2013-11-22 20:51:53 ca Exp $ .\" -.TH PRALIASES 8 "$Date: 2013/11/22 20:51:53 $" +.TH PRALIASES 8 "$Date: 2013-11-22 20:51:53 $" .SH NAME praliases \- display system mail aliases diff --git a/contrib/sendmail/praliases/praliases.c b/contrib/sendmail/praliases/praliases.c index 4a7ea50ec8b..67b28eaec91 100644 --- a/contrib/sendmail/praliases/praliases.c +++ b/contrib/sendmail/praliases/praliases.c @@ -20,7 +20,7 @@ SM_IDSTR(copyright, Copyright (c) 1988, 1993\n\ The Regents of the University of California. All rights reserved.\n") -SM_IDSTR(id, "@(#)$Id: praliases.c,v 8.98 2013/11/22 20:51:53 ca Exp $") +SM_IDSTR(id, "@(#)$Id: praliases.c,v 8.98 2013-11-22 20:51:53 ca Exp $") #include #include diff --git a/contrib/sendmail/rmail/Makefile b/contrib/sendmail/rmail/Makefile index 2934322c6bf..eeace604b1d 100644 --- a/contrib/sendmail/rmail/Makefile +++ b/contrib/sendmail/rmail/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 8.5 1999/10/05 16:39:19 ca Exp $ +# $Id: Makefile,v 8.5 1999-10-05 16:39:19 ca Exp $ SHELL= /bin/sh BUILD= ./Build diff --git a/contrib/sendmail/rmail/Makefile.m4 b/contrib/sendmail/rmail/Makefile.m4 index ed4250d367e..9deb8bf4e07 100644 --- a/contrib/sendmail/rmail/Makefile.m4 +++ b/contrib/sendmail/rmail/Makefile.m4 @@ -1,4 +1,4 @@ -dnl $Id: Makefile.m4,v 8.44 2006/06/28 21:08:04 ca Exp $ +dnl $Id: Makefile.m4,v 8.44 2006-06-28 21:08:04 ca Exp $ include(confBUILDTOOLSDIR`/M4/switch.m4') define(`confREQUIRE_LIBSM', `true') diff --git a/contrib/sendmail/rmail/rmail.8 b/contrib/sendmail/rmail/rmail.8 index a243e639c56..3d2a8c5ec6b 100644 --- a/contrib/sendmail/rmail/rmail.8 +++ b/contrib/sendmail/rmail/rmail.8 @@ -8,9 +8,9 @@ .\" the sendmail distribution. .\" .\" -.\" $Id: rmail.8,v 8.5 2013/11/22 20:51:53 ca Exp $ +.\" $Id: rmail.8,v 8.5 2013-11-22 20:51:53 ca Exp $ .\" -.TH RMAIL 8 "$Date: 2013/11/22 20:51:53 $" +.TH RMAIL 8 "$Date: 2013-11-22 20:51:53 $" .SH NAME rmail \- handle remote mail received via uucp diff --git a/contrib/sendmail/rmail/rmail.c b/contrib/sendmail/rmail/rmail.c index 357ed73bbed..60c0100c9ee 100644 --- a/contrib/sendmail/rmail/rmail.c +++ b/contrib/sendmail/rmail/rmail.c @@ -20,7 +20,7 @@ SM_IDSTR(copyright, Copyright (c) 1988, 1993\n\ The Regents of the University of California. All rights reserved.\n") -SM_IDSTR(id, "@(#)$Id: rmail.c,v 8.63 2013/11/22 20:51:53 ca Exp $") +SM_IDSTR(id, "@(#)$Id: rmail.c,v 8.63 2013-11-22 20:51:53 ca Exp $") /* * RMAIL -- UUCP mail server. diff --git a/contrib/sendmail/smrsh/Makefile b/contrib/sendmail/smrsh/Makefile index a9c4af7a2a9..e5dd03089f1 100644 --- a/contrib/sendmail/smrsh/Makefile +++ b/contrib/sendmail/smrsh/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 8.5 1999/09/23 22:36:43 ca Exp $ +# $Id: Makefile,v 8.5 1999-09-23 22:36:43 ca Exp $ SHELL= /bin/sh BUILD= ./Build diff --git a/contrib/sendmail/smrsh/Makefile.m4 b/contrib/sendmail/smrsh/Makefile.m4 index 0f773275ea2..43a4a14c9b6 100644 --- a/contrib/sendmail/smrsh/Makefile.m4 +++ b/contrib/sendmail/smrsh/Makefile.m4 @@ -1,4 +1,4 @@ -dnl $Id: Makefile.m4,v 8.36 2006/06/28 21:08:04 ca Exp $ +dnl $Id: Makefile.m4,v 8.36 2006-06-28 21:08:04 ca Exp $ include(confBUILDTOOLSDIR`/M4/switch.m4') define(`confREQUIRE_LIBSM', `true') diff --git a/contrib/sendmail/smrsh/README b/contrib/sendmail/smrsh/README index 452b208ea26..7723b3a278e 100644 --- a/contrib/sendmail/smrsh/README +++ b/contrib/sendmail/smrsh/README @@ -163,4 +163,4 @@ a typical system follows: host.domain# /usr/sbin/sendmail -bd -q30m -$Revision: 8.10 $, Last updated $Date: 2008/02/12 16:40:06 $ +$Revision: 8.10 $, Last updated $Date: 2008-02-12 16:40:06 $ diff --git a/contrib/sendmail/smrsh/smrsh.8 b/contrib/sendmail/smrsh/smrsh.8 index d461591a351..883ff32a212 100644 --- a/contrib/sendmail/smrsh/smrsh.8 +++ b/contrib/sendmail/smrsh/smrsh.8 @@ -9,9 +9,9 @@ .\" the sendmail distribution. .\" .\" -.\" $Id: smrsh.8,v 8.23 2013/11/22 20:52:00 ca Exp $ +.\" $Id: smrsh.8,v 8.23 2013-11-22 20:52:00 ca Exp $ .\" -.TH SMRSH 8 "$Date: 2013/11/22 20:52:00 $" +.TH SMRSH 8 "$Date: 2013-11-22 20:52:00 $" .SH NAME smrsh \- restricted shell for sendmail .SH SYNOPSIS diff --git a/contrib/sendmail/smrsh/smrsh.c b/contrib/sendmail/smrsh/smrsh.c index a70e32d7806..86e20a4cf53 100644 --- a/contrib/sendmail/smrsh/smrsh.c +++ b/contrib/sendmail/smrsh/smrsh.c @@ -20,7 +20,7 @@ SM_IDSTR(copyright, Copyright (c) 1993\n\ The Regents of the University of California. All rights reserved.\n") -SM_IDSTR(id, "@(#)$Id: smrsh.c,v 8.66 2013/11/22 20:52:00 ca Exp $") +SM_IDSTR(id, "@(#)$Id: smrsh.c,v 8.66 2013-11-22 20:52:00 ca Exp $") /* ** SMRSH -- sendmail restricted shell diff --git a/contrib/sendmail/src/Makefile b/contrib/sendmail/src/Makefile index a5633c791d7..2326faf113b 100644 --- a/contrib/sendmail/src/Makefile +++ b/contrib/sendmail/src/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 8.12 2006/08/29 22:00:11 ca Exp $ +# $Id: Makefile,v 8.12 2006-08-29 22:00:11 ca Exp $ SHELL= /bin/sh BUILD= ./Build diff --git a/contrib/sendmail/src/Makefile.m4 b/contrib/sendmail/src/Makefile.m4 index dd04b2b3bae..a666aa276e5 100644 --- a/contrib/sendmail/src/Makefile.m4 +++ b/contrib/sendmail/src/Makefile.m4 @@ -1,4 +1,4 @@ -dnl $Id: Makefile.m4,v 8.143 2013/09/04 19:49:04 ca Exp $ +dnl $Id: Makefile.m4,v 8.143 2013-09-04 19:49:04 ca Exp $ include(confBUILDTOOLSDIR`/M4/switch.m4') define(`confREQUIRE_LIBSM', `true') diff --git a/contrib/sendmail/src/README b/contrib/sendmail/src/README index 18bffcb27b7..c437b1e8890 100644 --- a/contrib/sendmail/src/README +++ b/contrib/sendmail/src/README @@ -9,7 +9,7 @@ # the sendmail distribution. # # -# $Id: README,v 8.393 2013/11/22 20:51:54 ca Exp $ +# $Id: README,v 8.393 2013-11-22 20:51:54 ca Exp $ # This directory contains the source files for sendmail(TM). @@ -1848,4 +1848,4 @@ util.c Some general purpose routines used by sendmail. version.c The version number and information about this version of sendmail. -(Version $Revision: 8.393 $, last update $Date: 2013/11/22 20:51:54 $ ) +(Version $Revision: 8.393 $, last update $Date: 2013-11-22 20:51:54 $ ) diff --git a/contrib/sendmail/src/SECURITY b/contrib/sendmail/src/SECURITY index 9f3cf5896d8..0e38835ca02 100644 --- a/contrib/sendmail/src/SECURITY +++ b/contrib/sendmail/src/SECURITY @@ -5,7 +5,7 @@ # forth in the LICENSE file which can be found at the top level of # the sendmail distribution. # -# $Id: SECURITY,v 1.52 2013/11/22 20:51:54 ca Exp $ +# $Id: SECURITY,v 1.52 2013-11-22 20:51:54 ca Exp $ # This file gives some hints how to configure and run sendmail for diff --git a/contrib/sendmail/src/TRACEFLAGS b/contrib/sendmail/src/TRACEFLAGS index 0ebe8b2c233..e73ed10edb3 100644 --- a/contrib/sendmail/src/TRACEFLAGS +++ b/contrib/sendmail/src/TRACEFLAGS @@ -1,4 +1,4 @@ -# $Id: TRACEFLAGS,v 8.53 2013/11/27 01:27:03 gshapiro Exp $ +# $Id: TRACEFLAGS,v 8.53 2013-11-27 01:27:03 gshapiro Exp $ 0, 4 main.c main canonical name, UUCP node name, a.k.a.s 0, 15 main.c main print configuration 0, 44 util.c printav print address of each string diff --git a/contrib/sendmail/src/TUNING b/contrib/sendmail/src/TUNING index c42f3219b2d..77c3f64f690 100644 --- a/contrib/sendmail/src/TUNING +++ b/contrib/sendmail/src/TUNING @@ -5,7 +5,7 @@ # forth in the LICENSE file which can be found at the top level of # the sendmail distribution. # -# $Id: TUNING,v 1.22 2013/11/22 20:51:54 ca Exp $ +# $Id: TUNING,v 1.22 2013-11-22 20:51:54 ca Exp $ # ******************************************** diff --git a/contrib/sendmail/src/alias.c b/contrib/sendmail/src/alias.c index c1b85cf9f7e..c31d8d09317 100644 --- a/contrib/sendmail/src/alias.c +++ b/contrib/sendmail/src/alias.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: alias.c,v 8.221 2013/11/22 20:51:54 ca Exp $") +SM_RCSID("@(#)$Id: alias.c,v 8.221 2013-11-22 20:51:54 ca Exp $") #define SEPARATOR ':' # define ALIAS_SPEC_SEPARATORS " ,/:" diff --git a/contrib/sendmail/src/aliases b/contrib/sendmail/src/aliases index 2d06ae31255..38540d5ad3b 100644 --- a/contrib/sendmail/src/aliases +++ b/contrib/sendmail/src/aliases @@ -1,5 +1,5 @@ # -# $Id: aliases,v 8.5 2002/06/05 22:54:26 gshapiro Exp $ +# $Id: aliases,v 8.5 2002-06-05 22:54:26 gshapiro Exp $ # @(#)aliases 8.2 (Berkeley) 3/5/94 # # Aliases in this file will NOT be expanded in the header from diff --git a/contrib/sendmail/src/aliases.5 b/contrib/sendmail/src/aliases.5 index 6715b516d24..f09b49cf5e0 100644 --- a/contrib/sendmail/src/aliases.5 +++ b/contrib/sendmail/src/aliases.5 @@ -9,9 +9,9 @@ .\" the sendmail distribution. .\" .\" -.\" $Id: aliases.5,v 8.20 2013/11/22 20:51:55 ca Exp $ +.\" $Id: aliases.5,v 8.20 2013-11-22 20:51:55 ca Exp $ .\" -.TH ALIASES 5 "$Date: 2013/11/22 20:51:55 $" +.TH ALIASES 5 "$Date: 2013-11-22 20:51:55 $" .SH NAME aliases \- aliases file for sendmail diff --git a/contrib/sendmail/src/arpadate.c b/contrib/sendmail/src/arpadate.c index e3e771a2704..57d5a06ff7d 100644 --- a/contrib/sendmail/src/arpadate.c +++ b/contrib/sendmail/src/arpadate.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: arpadate.c,v 8.32 2013/11/22 20:51:55 ca Exp $") +SM_RCSID("@(#)$Id: arpadate.c,v 8.32 2013-11-22 20:51:55 ca Exp $") /* ** ARPADATE -- Create date in ARPANET format diff --git a/contrib/sendmail/src/bf.c b/contrib/sendmail/src/bf.c index e4725b73316..7d908560dba 100644 --- a/contrib/sendmail/src/bf.c +++ b/contrib/sendmail/src/bf.c @@ -18,7 +18,7 @@ */ #include -SM_RCSID("@(#)$Id: bf.c,v 8.63 2013/11/22 20:51:55 ca Exp $") +SM_RCSID("@(#)$Id: bf.c,v 8.63 2013-11-22 20:51:55 ca Exp $") #include #include diff --git a/contrib/sendmail/src/bf.h b/contrib/sendmail/src/bf.h index eb0101f8891..c49736de640 100644 --- a/contrib/sendmail/src/bf.h +++ b/contrib/sendmail/src/bf.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: bf.h,v 8.17 2013/11/22 20:51:55 ca Exp $ + * $Id: bf.h,v 8.17 2013-11-22 20:51:55 ca Exp $ * * Contributed by Exactis.com, Inc. * diff --git a/contrib/sendmail/src/collect.c b/contrib/sendmail/src/collect.c index 8af4d4e6c2d..8d90acb827e 100644 --- a/contrib/sendmail/src/collect.c +++ b/contrib/sendmail/src/collect.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: collect.c,v 8.287 2013/11/22 20:51:55 ca Exp $") +SM_RCSID("@(#)$Id: collect.c,v 8.287 2013-11-22 20:51:55 ca Exp $") static void eatfrom __P((char *volatile, ENVELOPE *)); static void collect_doheader __P((ENVELOPE *)); diff --git a/contrib/sendmail/src/conf.c b/contrib/sendmail/src/conf.c index 7c0ea394ae3..b64f3c7fab7 100644 --- a/contrib/sendmail/src/conf.c +++ b/contrib/sendmail/src/conf.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: conf.c,v 8.1191 2014/01/08 17:03:14 ca Exp $") +SM_RCSID("@(#)$Id: conf.c,v 8.1191 2014-01-08 17:03:14 ca Exp $") #include #include @@ -5309,8 +5309,8 @@ closefd_walk(lowest, fd) */ void -sm_close_on_exec(highest, lowest) - int highest, lowest; +sm_close_on_exec(lowest, highest) + int lowest, highest; { #if HASFDWALK (void) fdwalk(closefd_walk, &lowest); @@ -6540,8 +6540,8 @@ char *FFRCompileOptions[] = /* ** See libsm/mbdb.c: only enable this on OSs ** that implement the correct (POSIX) semantics. - ** This will need to become an OS-specific #if - ** enabled in include/sm/os/*.h. + ** This will need to become an OS-specific #if enabled + ** in one of the headers files under include/sm/os/ . */ "_FFR_USE_GETPWNAM_ERRNO", diff --git a/contrib/sendmail/src/conf.h b/contrib/sendmail/src/conf.h index d9162de25c1..54b1d09fc0a 100644 --- a/contrib/sendmail/src/conf.h +++ b/contrib/sendmail/src/conf.h @@ -10,7 +10,7 @@ * the sendmail distribution. * * - * $Id: conf.h,v 8.577 2013/11/22 20:51:55 ca Exp $ + * $Id: conf.h,v 8.577 2013-11-22 20:51:55 ca Exp $ */ /* diff --git a/contrib/sendmail/src/control.c b/contrib/sendmail/src/control.c index 25ad91c1238..25419738947 100644 --- a/contrib/sendmail/src/control.c +++ b/contrib/sendmail/src/control.c @@ -10,7 +10,7 @@ #include -SM_RCSID("@(#)$Id: control.c,v 8.130 2013/11/22 20:51:55 ca Exp $") +SM_RCSID("@(#)$Id: control.c,v 8.130 2013-11-22 20:51:55 ca Exp $") #include diff --git a/contrib/sendmail/src/convtime.c b/contrib/sendmail/src/convtime.c index e1b95356330..4d51d97ad6d 100644 --- a/contrib/sendmail/src/convtime.c +++ b/contrib/sendmail/src/convtime.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: convtime.c,v 8.40 2013/11/22 20:51:55 ca Exp $") +SM_RCSID("@(#)$Id: convtime.c,v 8.40 2013-11-22 20:51:55 ca Exp $") /* ** CONVTIME -- convert time diff --git a/contrib/sendmail/src/daemon.c b/contrib/sendmail/src/daemon.c index e0521016fa2..d6b3f497ac1 100644 --- a/contrib/sendmail/src/daemon.c +++ b/contrib/sendmail/src/daemon.c @@ -14,7 +14,7 @@ #include #include "map.h" -SM_RCSID("@(#)$Id: daemon.c,v 8.698 2013/11/22 20:51:55 ca Exp $") +SM_RCSID("@(#)$Id: daemon.c,v 8.698 2013-11-22 20:51:55 ca Exp $") #if defined(SOCK_STREAM) || defined(__GNU_LIBRARY__) # define USE_SOCK_STREAM 1 diff --git a/contrib/sendmail/src/daemon.h b/contrib/sendmail/src/daemon.h index d7865806987..649b4d5279a 100644 --- a/contrib/sendmail/src/daemon.h +++ b/contrib/sendmail/src/daemon.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: daemon.h,v 8.4 2013/11/22 20:51:55 ca Exp $ + * $Id: daemon.h,v 8.4 2013-11-22 20:51:55 ca Exp $ */ #ifndef DAEMON_H diff --git a/contrib/sendmail/src/deliver.c b/contrib/sendmail/src/deliver.c index 987781c786b..39c484c1a09 100644 --- a/contrib/sendmail/src/deliver.c +++ b/contrib/sendmail/src/deliver.c @@ -14,7 +14,7 @@ #include #include -SM_RCSID("@(#)$Id: deliver.c,v 8.1030 2013/11/22 20:51:55 ca Exp $") +SM_RCSID("@(#)$Id: deliver.c,v 8.1030 2013-11-22 20:51:55 ca Exp $") #if HASSETUSERCONTEXT # include diff --git a/contrib/sendmail/src/domain.c b/contrib/sendmail/src/domain.c index fbd5c445fae..4d1b92d05c8 100644 --- a/contrib/sendmail/src/domain.c +++ b/contrib/sendmail/src/domain.c @@ -15,9 +15,9 @@ #include "map.h" #if NAMED_BIND -SM_RCSID("@(#)$Id: domain.c,v 8.205 2013/11/22 20:51:55 ca Exp $ (with name server)") +SM_RCSID("@(#)$Id: domain.c,v 8.205 2013-11-22 20:51:55 ca Exp $ (with name server)") #else /* NAMED_BIND */ -SM_RCSID("@(#)$Id: domain.c,v 8.205 2013/11/22 20:51:55 ca Exp $ (without name server)") +SM_RCSID("@(#)$Id: domain.c,v 8.205 2013-11-22 20:51:55 ca Exp $ (without name server)") #endif /* NAMED_BIND */ #if NAMED_BIND diff --git a/contrib/sendmail/src/envelope.c b/contrib/sendmail/src/envelope.c index 24972896925..df6c5c781fc 100644 --- a/contrib/sendmail/src/envelope.c +++ b/contrib/sendmail/src/envelope.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: envelope.c,v 8.313 2013/11/22 20:51:55 ca Exp $") +SM_RCSID("@(#)$Id: envelope.c,v 8.313 2013-11-22 20:51:55 ca Exp $") /* ** CLRSESSENVELOPE -- clear session oriented data in an envelope diff --git a/contrib/sendmail/src/err.c b/contrib/sendmail/src/err.c index 357222d1a11..835fa4b1061 100644 --- a/contrib/sendmail/src/err.c +++ b/contrib/sendmail/src/err.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: err.c,v 8.206 2013/11/22 20:51:55 ca Exp $") +SM_RCSID("@(#)$Id: err.c,v 8.206 2013-11-22 20:51:55 ca Exp $") #if LDAPMAP # include diff --git a/contrib/sendmail/src/headers.c b/contrib/sendmail/src/headers.c index 7b390a8adc0..3c59a40d3ca 100644 --- a/contrib/sendmail/src/headers.c +++ b/contrib/sendmail/src/headers.c @@ -14,7 +14,7 @@ #include #include -SM_RCSID("@(#)$Id: headers.c,v 8.320 2013/11/22 20:51:55 ca Exp $") +SM_RCSID("@(#)$Id: headers.c,v 8.320 2013-11-22 20:51:55 ca Exp $") static HDR *allocheader __P((char *, char *, int, SM_RPOOL_T *, bool)); static size_t fix_mime_header __P((HDR *, ENVELOPE *)); diff --git a/contrib/sendmail/src/helpfile b/contrib/sendmail/src/helpfile index 0ce4c871a3a..9529b28a7fc 100644 --- a/contrib/sendmail/src/helpfile +++ b/contrib/sendmail/src/helpfile @@ -11,7 +11,7 @@ cpyr By using this file, you agree to the terms and conditions set cpyr forth in the LICENSE file which can be found at the top level of cpyr the sendmail distribution. cpyr -cpyr $$Id: helpfile,v 8.49 2013/11/22 20:51:55 ca Exp $$ +cpyr $$Id: helpfile,v 8.49 2013-11-22 20:51:55 ca Exp $$ cpyr smtp This is sendmail version $v smtp Topics: diff --git a/contrib/sendmail/src/macro.c b/contrib/sendmail/src/macro.c index d18d5c7cf7d..cb7daf8cf69 100644 --- a/contrib/sendmail/src/macro.c +++ b/contrib/sendmail/src/macro.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: macro.c,v 8.108 2013/11/22 20:51:55 ca Exp $") +SM_RCSID("@(#)$Id: macro.c,v 8.108 2013-11-22 20:51:55 ca Exp $") #include #if MAXMACROID != (BITMAPBITS - 1) diff --git a/contrib/sendmail/src/mailq.1 b/contrib/sendmail/src/mailq.1 index ec0cb210e27..0a12d3775b5 100644 --- a/contrib/sendmail/src/mailq.1 +++ b/contrib/sendmail/src/mailq.1 @@ -9,9 +9,9 @@ .\" the sendmail distribution. .\" .\" -.\" $Id: mailq.1,v 8.22 2013/11/22 20:51:55 ca Exp $ +.\" $Id: mailq.1,v 8.22 2013-11-22 20:51:55 ca Exp $ .\" -.TH MAILQ 1 "$Date: 2013/11/22 20:51:55 $" +.TH MAILQ 1 "$Date: 2013-11-22 20:51:55 $" .SH NAME mailq \- print the mail queue diff --git a/contrib/sendmail/src/main.c b/contrib/sendmail/src/main.c index a5eb50b198c..511eb023fbf 100644 --- a/contrib/sendmail/src/main.c +++ b/contrib/sendmail/src/main.c @@ -26,7 +26,7 @@ SM_UNUSED(static char copyright[]) = The Regents of the University of California. All rights reserved.\n"; #endif /* ! lint */ -SM_RCSID("@(#)$Id: main.c,v 8.988 2013/11/23 02:52:37 gshapiro Exp $") +SM_RCSID("@(#)$Id: main.c,v 8.988 2013-11-23 02:52:37 gshapiro Exp $") #if NETINET || NETINET6 diff --git a/contrib/sendmail/src/map.c b/contrib/sendmail/src/map.c index 24ed1f1b09d..b79f5917486 100644 --- a/contrib/sendmail/src/map.c +++ b/contrib/sendmail/src/map.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: map.c,v 8.713 2013/11/22 20:51:55 ca Exp $") +SM_RCSID("@(#)$Id: map.c,v 8.713 2013-11-22 20:51:55 ca Exp $") #if LDAPMAP # include diff --git a/contrib/sendmail/src/map.h b/contrib/sendmail/src/map.h index f4198c0f571..f20cf647706 100644 --- a/contrib/sendmail/src/map.h +++ b/contrib/sendmail/src/map.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: map.h,v 8.4 2013/11/22 20:51:56 ca Exp $ + * $Id: map.h,v 8.4 2013-11-22 20:51:56 ca Exp $ */ #ifndef _MAP_H diff --git a/contrib/sendmail/src/mci.c b/contrib/sendmail/src/mci.c index 860dce82952..773eb16e58a 100644 --- a/contrib/sendmail/src/mci.c +++ b/contrib/sendmail/src/mci.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: mci.c,v 8.225 2013/11/22 20:51:56 ca Exp $") +SM_RCSID("@(#)$Id: mci.c,v 8.225 2013-11-22 20:51:56 ca Exp $") #if NETINET || NETINET6 # include diff --git a/contrib/sendmail/src/milter.c b/contrib/sendmail/src/milter.c index 88f8b601fdb..cbc4d35bc47 100644 --- a/contrib/sendmail/src/milter.c +++ b/contrib/sendmail/src/milter.c @@ -10,7 +10,7 @@ #include -SM_RCSID("@(#)$Id: milter.c,v 8.281 2013/11/22 20:51:56 ca Exp $") +SM_RCSID("@(#)$Id: milter.c,v 8.281 2013-11-22 20:51:56 ca Exp $") #if MILTER # include diff --git a/contrib/sendmail/src/mime.c b/contrib/sendmail/src/mime.c index 2022bb74fcb..ecfc761dd2e 100644 --- a/contrib/sendmail/src/mime.c +++ b/contrib/sendmail/src/mime.c @@ -14,7 +14,7 @@ #include #include -SM_RCSID("@(#)$Id: mime.c,v 8.149 2013/11/22 20:51:56 ca Exp $") +SM_RCSID("@(#)$Id: mime.c,v 8.149 2013-11-22 20:51:56 ca Exp $") /* ** MIME support. diff --git a/contrib/sendmail/src/newaliases.1 b/contrib/sendmail/src/newaliases.1 index cae00416064..59dc0de20cf 100644 --- a/contrib/sendmail/src/newaliases.1 +++ b/contrib/sendmail/src/newaliases.1 @@ -9,9 +9,9 @@ .\" the sendmail distribution. .\" .\" -.\" $Id: newaliases.1,v 8.20 2013/11/22 20:51:56 ca Exp $ +.\" $Id: newaliases.1,v 8.20 2013-11-22 20:51:56 ca Exp $ .\" -.TH NEWALIASES 1 "$Date: 2013/11/22 20:51:56 $" +.TH NEWALIASES 1 "$Date: 2013-11-22 20:51:56 $" .SH NAME newaliases \- rebuild the data base for the mail aliases file diff --git a/contrib/sendmail/src/parseaddr.c b/contrib/sendmail/src/parseaddr.c index d40f69b2084..4c787204d73 100644 --- a/contrib/sendmail/src/parseaddr.c +++ b/contrib/sendmail/src/parseaddr.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: parseaddr.c,v 8.407 2013/11/22 20:51:56 ca Exp $") +SM_RCSID("@(#)$Id: parseaddr.c,v 8.407 2013-11-22 20:51:56 ca Exp $") #include #include "map.h" diff --git a/contrib/sendmail/src/queue.c b/contrib/sendmail/src/queue.c index 54cc4084dad..db339f2e3a4 100644 --- a/contrib/sendmail/src/queue.c +++ b/contrib/sendmail/src/queue.c @@ -14,7 +14,7 @@ #include #include -SM_RCSID("@(#)$Id: queue.c,v 8.1000 2013/11/22 20:51:56 ca Exp $") +SM_RCSID("@(#)$Id: queue.c,v 8.1000 2013-11-22 20:51:56 ca Exp $") #include diff --git a/contrib/sendmail/src/ratectrl.c b/contrib/sendmail/src/ratectrl.c index 50c776937f1..cb7dca58b53 100644 --- a/contrib/sendmail/src/ratectrl.c +++ b/contrib/sendmail/src/ratectrl.c @@ -45,7 +45,7 @@ */ #include -SM_RCSID("@(#)$Id: ratectrl.c,v 8.14 2013/11/22 20:51:56 ca Exp $") +SM_RCSID("@(#)$Id: ratectrl.c,v 8.14 2013-11-22 20:51:56 ca Exp $") /* ** stuff included - given some warnings (inet_ntoa) diff --git a/contrib/sendmail/src/readcf.c b/contrib/sendmail/src/readcf.c index cdc172c2ae2..9189a9523dc 100644 --- a/contrib/sendmail/src/readcf.c +++ b/contrib/sendmail/src/readcf.c @@ -14,7 +14,7 @@ #include #include -SM_RCSID("@(#)$Id: readcf.c,v 8.692 2013/11/22 20:51:56 ca Exp $") +SM_RCSID("@(#)$Id: readcf.c,v 8.692 2013-11-22 20:51:56 ca Exp $") #if NETINET || NETINET6 # include diff --git a/contrib/sendmail/src/recipient.c b/contrib/sendmail/src/recipient.c index 84d2f87f295..ff3a3b9d363 100644 --- a/contrib/sendmail/src/recipient.c +++ b/contrib/sendmail/src/recipient.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: recipient.c,v 8.351 2013/11/22 20:51:56 ca Exp $") +SM_RCSID("@(#)$Id: recipient.c,v 8.351 2013-11-22 20:51:56 ca Exp $") static void includetimeout __P((int)); static ADDRESS *self_reference __P((ADDRESS *)); diff --git a/contrib/sendmail/src/sasl.c b/contrib/sendmail/src/sasl.c index 666616afc1c..bd2d908a11a 100644 --- a/contrib/sendmail/src/sasl.c +++ b/contrib/sendmail/src/sasl.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Id: sasl.c,v 8.24 2013/11/22 20:51:56 ca Exp $") +SM_RCSID("@(#)$Id: sasl.c,v 8.24 2013-11-22 20:51:56 ca Exp $") #if SASL # include diff --git a/contrib/sendmail/src/savemail.c b/contrib/sendmail/src/savemail.c index 2ea7d2f9347..07c3c90ffa3 100644 --- a/contrib/sendmail/src/savemail.c +++ b/contrib/sendmail/src/savemail.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: savemail.c,v 8.319 2013/11/22 20:51:56 ca Exp $") +SM_RCSID("@(#)$Id: savemail.c,v 8.319 2013-11-22 20:51:56 ca Exp $") static bool errbody __P((MCI *, ENVELOPE *, char *)); static bool pruneroute __P((char *)); diff --git a/contrib/sendmail/src/sendmail.8 b/contrib/sendmail/src/sendmail.8 index f225ff4b018..a6c47fecfb2 100644 --- a/contrib/sendmail/src/sendmail.8 +++ b/contrib/sendmail/src/sendmail.8 @@ -9,9 +9,9 @@ .\" the sendmail distribution. .\" .\" -.\" $Id: sendmail.8,v 8.61 2013/11/22 20:51:56 ca Exp $ +.\" $Id: sendmail.8,v 8.61 2013-11-22 20:51:56 ca Exp $ .\" -.TH SENDMAIL 8 "$Date: 2013/11/22 20:51:56 $" +.TH SENDMAIL 8 "$Date: 2013-11-22 20:51:56 $" .SH NAME sendmail \- an electronic mail transport agent diff --git a/contrib/sendmail/src/sendmail.h b/contrib/sendmail/src/sendmail.h index 613d01ed8f4..1a079c0e153 100644 --- a/contrib/sendmail/src/sendmail.h +++ b/contrib/sendmail/src/sendmail.h @@ -52,7 +52,7 @@ #ifdef _DEFINE # ifndef lint -SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.1104 2013/11/22 20:51:56 ca Exp $"; +SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.1104 2013-11-22 20:51:56 ca Exp $"; # endif /* ! lint */ #endif /* _DEFINE */ diff --git a/contrib/sendmail/src/sfsasl.c b/contrib/sendmail/src/sfsasl.c index 1186b18ced5..0593a2577d7 100644 --- a/contrib/sendmail/src/sfsasl.c +++ b/contrib/sendmail/src/sfsasl.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Id: sfsasl.c,v 8.121 2013/11/22 20:51:56 ca Exp $") +SM_RCSID("@(#)$Id: sfsasl.c,v 8.121 2013-11-22 20:51:56 ca Exp $") #include #include #include diff --git a/contrib/sendmail/src/sfsasl.h b/contrib/sendmail/src/sfsasl.h index 88f45c0e37d..a53ed9d69f3 100644 --- a/contrib/sendmail/src/sfsasl.h +++ b/contrib/sendmail/src/sfsasl.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: sfsasl.h,v 8.21 2013/11/22 20:51:56 ca Exp $" + * $Id: sfsasl.h,v 8.21 2013-11-22 20:51:56 ca Exp $" */ #ifndef SFSASL_H diff --git a/contrib/sendmail/src/shmticklib.c b/contrib/sendmail/src/shmticklib.c index df620b7351b..78af91552b8 100644 --- a/contrib/sendmail/src/shmticklib.c +++ b/contrib/sendmail/src/shmticklib.c @@ -11,7 +11,7 @@ */ #include -SM_RCSID("@(#)$Id: shmticklib.c,v 8.15 2013/11/22 20:51:56 ca Exp $") +SM_RCSID("@(#)$Id: shmticklib.c,v 8.15 2013-11-22 20:51:56 ca Exp $") #if _FFR_SHM_STATUS # include diff --git a/contrib/sendmail/src/sm_resolve.c b/contrib/sendmail/src/sm_resolve.c index d8fb6b7fa19..662eaa5cb4f 100644 --- a/contrib/sendmail/src/sm_resolve.c +++ b/contrib/sendmail/src/sm_resolve.c @@ -50,7 +50,7 @@ # endif /* NETINET */ # include "sm_resolve.h" -SM_RCSID("$Id: sm_resolve.c,v 8.40 2013/11/22 20:51:56 ca Exp $") +SM_RCSID("$Id: sm_resolve.c,v 8.40 2013-11-22 20:51:56 ca Exp $") static struct stot { diff --git a/contrib/sendmail/src/sm_resolve.h b/contrib/sendmail/src/sm_resolve.h index 239fe749077..5f3fe21005b 100644 --- a/contrib/sendmail/src/sm_resolve.h +++ b/contrib/sendmail/src/sm_resolve.h @@ -41,7 +41,7 @@ * SUCH DAMAGE. */ -/* $Id: sm_resolve.h,v 8.9 2013/11/22 20:51:56 ca Exp $ */ +/* $Id: sm_resolve.h,v 8.9 2013-11-22 20:51:56 ca Exp $ */ #if DNSMAP # ifndef __ROKEN_RESOLVE_H__ diff --git a/contrib/sendmail/src/srvrsmtp.c b/contrib/sendmail/src/srvrsmtp.c index 98998b48180..1a535678290 100644 --- a/contrib/sendmail/src/srvrsmtp.c +++ b/contrib/sendmail/src/srvrsmtp.c @@ -17,7 +17,7 @@ # include #endif /* MILTER */ -SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.1016 2013/11/22 20:51:56 ca Exp $") +SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.1016 2013-11-22 20:51:56 ca Exp $") #include #include diff --git a/contrib/sendmail/src/stab.c b/contrib/sendmail/src/stab.c index a04a3e582ef..bf8651113b7 100644 --- a/contrib/sendmail/src/stab.c +++ b/contrib/sendmail/src/stab.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: stab.c,v 8.92 2013/11/22 20:51:56 ca Exp $") +SM_RCSID("@(#)$Id: stab.c,v 8.92 2013-11-22 20:51:56 ca Exp $") /* ** STAB -- manage the symbol table diff --git a/contrib/sendmail/src/stats.c b/contrib/sendmail/src/stats.c index 8a3b2db9b35..382382d53de 100644 --- a/contrib/sendmail/src/stats.c +++ b/contrib/sendmail/src/stats.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: stats.c,v 8.58 2013/11/22 20:51:56 ca Exp $") +SM_RCSID("@(#)$Id: stats.c,v 8.58 2013-11-22 20:51:56 ca Exp $") #include diff --git a/contrib/sendmail/src/statusd_shm.h b/contrib/sendmail/src/statusd_shm.h index 980cf0f7fbc..779f638c884 100644 --- a/contrib/sendmail/src/statusd_shm.h +++ b/contrib/sendmail/src/statusd_shm.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: statusd_shm.h,v 8.8 2013/11/22 20:51:57 ca Exp $ + * $Id: statusd_shm.h,v 8.8 2013-11-22 20:51:57 ca Exp $ * * Contributed by Exactis.com, Inc. * diff --git a/contrib/sendmail/src/sysexits.c b/contrib/sendmail/src/sysexits.c index dde5a4bddb3..7d958827aff 100644 --- a/contrib/sendmail/src/sysexits.c +++ b/contrib/sendmail/src/sysexits.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: sysexits.c,v 8.35 2013/11/22 20:51:57 ca Exp $") +SM_RCSID("@(#)$Id: sysexits.c,v 8.35 2013-11-22 20:51:57 ca Exp $") /* ** DSNTOEXITSTAT -- convert DSN-style error code to EX_ style. diff --git a/contrib/sendmail/src/timers.c b/contrib/sendmail/src/timers.c index 735c93b1d20..9ceb3a714f7 100644 --- a/contrib/sendmail/src/timers.c +++ b/contrib/sendmail/src/timers.c @@ -11,7 +11,7 @@ */ #include -SM_RCSID("@(#)$Id: timers.c,v 8.27 2013/11/22 20:51:57 ca Exp $") +SM_RCSID("@(#)$Id: timers.c,v 8.27 2013-11-22 20:51:57 ca Exp $") #if _FFR_TIMERS # include diff --git a/contrib/sendmail/src/timers.h b/contrib/sendmail/src/timers.h index 6b7c6486f1b..6f5c1eb7e8d 100644 --- a/contrib/sendmail/src/timers.h +++ b/contrib/sendmail/src/timers.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: timers.h,v 8.7 2013/11/22 20:51:57 ca Exp $ + * $Id: timers.h,v 8.7 2013-11-22 20:51:57 ca Exp $ * * Contributed by Exactis.com, Inc. * diff --git a/contrib/sendmail/src/tls.c b/contrib/sendmail/src/tls.c index a9c963c58ba..75207ee4a1f 100644 --- a/contrib/sendmail/src/tls.c +++ b/contrib/sendmail/src/tls.c @@ -10,7 +10,7 @@ #include -SM_RCSID("@(#)$Id: tls.c,v 8.127 2013/11/27 02:51:11 gshapiro Exp $") +SM_RCSID("@(#)$Id: tls.c,v 8.127 2013-11-27 02:51:11 gshapiro Exp $") #if STARTTLS # include diff --git a/contrib/sendmail/src/trace.c b/contrib/sendmail/src/trace.c index 6efd09e68b6..afc43a5cf4b 100644 --- a/contrib/sendmail/src/trace.c +++ b/contrib/sendmail/src/trace.c @@ -15,7 +15,7 @@ #include #include -SM_RCSID("@(#)$Id: trace.c,v 8.39 2013/11/22 20:51:57 ca Exp $") +SM_RCSID("@(#)$Id: trace.c,v 8.39 2013-11-22 20:51:57 ca Exp $") static char *tTnewflag __P((char *)); static char *tToldflag __P((char *)); diff --git a/contrib/sendmail/src/udb.c b/contrib/sendmail/src/udb.c index 6ee88ce91ef..b2372b76616 100644 --- a/contrib/sendmail/src/udb.c +++ b/contrib/sendmail/src/udb.c @@ -15,9 +15,9 @@ #include "map.h" #if USERDB -SM_RCSID("@(#)$Id: udb.c,v 8.166 2013/11/22 20:51:57 ca Exp $ (with USERDB)") +SM_RCSID("@(#)$Id: udb.c,v 8.166 2013-11-22 20:51:57 ca Exp $ (with USERDB)") #else /* USERDB */ -SM_RCSID("@(#)$Id: udb.c,v 8.166 2013/11/22 20:51:57 ca Exp $ (without USERDB)") +SM_RCSID("@(#)$Id: udb.c,v 8.166 2013-11-22 20:51:57 ca Exp $ (without USERDB)") #endif /* USERDB */ #if USERDB diff --git a/contrib/sendmail/src/usersmtp.c b/contrib/sendmail/src/usersmtp.c index c217ffa8b93..f3ddcf2c811 100644 --- a/contrib/sendmail/src/usersmtp.c +++ b/contrib/sendmail/src/usersmtp.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: usersmtp.c,v 8.488 2013/11/22 20:51:57 ca Exp $") +SM_RCSID("@(#)$Id: usersmtp.c,v 8.488 2013-11-22 20:51:57 ca Exp $") #include diff --git a/contrib/sendmail/src/util.c b/contrib/sendmail/src/util.c index b03fa66cf41..02e8ec204ad 100644 --- a/contrib/sendmail/src/util.c +++ b/contrib/sendmail/src/util.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: util.c,v 8.427 2013/11/22 20:51:57 ca Exp $") +SM_RCSID("@(#)$Id: util.c,v 8.427 2013-11-22 20:51:57 ca Exp $") #include #include diff --git a/contrib/sendmail/src/version.c b/contrib/sendmail/src/version.c index 3f85c0696c9..14767780b7c 100644 --- a/contrib/sendmail/src/version.c +++ b/contrib/sendmail/src/version.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2013 Proofpoint, Inc. and its suppliers. + * Copyright (c) 1998-2014 Proofpoint, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -13,6 +13,6 @@ #include -SM_RCSID("@(#)$Id: version.c,v 8.249 2013/11/27 00:38:50 ca Exp $") +SM_RCSID("@(#)$Id: version.c,v 8.249 2013-11-27 00:38:50 ca Exp $") -char Version[] = "8.14.8"; +char Version[] = "8.14.9"; diff --git a/contrib/sendmail/test/Makefile b/contrib/sendmail/test/Makefile index d0a88423bb5..30a1b37b6a9 100644 --- a/contrib/sendmail/test/Makefile +++ b/contrib/sendmail/test/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.2 2006/05/30 18:50:26 ca Exp $ +# $Id: Makefile,v 1.2 2006-05-30 18:50:26 ca Exp $ SHELL= /bin/sh BUILD= ./Build diff --git a/contrib/sendmail/test/Makefile.m4 b/contrib/sendmail/test/Makefile.m4 index 1149d876bcb..9ab0ee50676 100644 --- a/contrib/sendmail/test/Makefile.m4 +++ b/contrib/sendmail/test/Makefile.m4 @@ -1,4 +1,4 @@ -dnl $Id: Makefile.m4,v 1.6 2013/04/01 21:04:29 ca Exp $ +dnl $Id: Makefile.m4,v 1.6 2013-04-01 21:04:29 ca Exp $ include(confBUILDTOOLSDIR`/M4/switch.m4') bldPRODUCT_START(`executable', `test') diff --git a/contrib/sendmail/test/README b/contrib/sendmail/test/README index 5c3851bfc90..7ca022f3d9f 100644 --- a/contrib/sendmail/test/README +++ b/contrib/sendmail/test/README @@ -5,7 +5,7 @@ # forth in the LICENSE file which can be found at the top level of # the sendmail distribution. # -# $Id: README,v 1.3 2013/11/22 20:52:01 ca Exp $ +# $Id: README,v 1.3 2013-11-22 20:52:01 ca Exp $ # This directory contains several programs to test various OS calls. diff --git a/contrib/sendmail/test/Results b/contrib/sendmail/test/Results index 934f9a10755..508427b3708 100644 --- a/contrib/sendmail/test/Results +++ b/contrib/sendmail/test/Results @@ -195,4 +195,4 @@ SunOS 5.8 HASSETREGID 2001-09-22 ca SunOS 5.9 HASSETREGID 2001-09-22 Neil W Rickert -$Revision: 8.3 $, Last updated $Date: 2001/09/30 01:32:33 $ +$Revision: 8.3 $, Last updated $Date: 2001-09-30 01:32:33 $ diff --git a/contrib/sendmail/test/t_dropgid.c b/contrib/sendmail/test/t_dropgid.c index 4f8aedcfb95..28fdfeed90f 100644 --- a/contrib/sendmail/test/t_dropgid.c +++ b/contrib/sendmail/test/t_dropgid.c @@ -22,7 +22,7 @@ #include #ifndef lint -static char id[] = "@(#)$Id: t_dropgid.c,v 1.7 2013/11/22 20:52:01 ca Exp $"; +static char id[] = "@(#)$Id: t_dropgid.c,v 1.7 2013-11-22 20:52:01 ca Exp $"; #endif /* ! lint */ static void diff --git a/contrib/sendmail/test/t_exclopen.c b/contrib/sendmail/test/t_exclopen.c index 08670cd74f4..978508fa8b5 100644 --- a/contrib/sendmail/test/t_exclopen.c +++ b/contrib/sendmail/test/t_exclopen.c @@ -46,7 +46,7 @@ #include #ifndef lint -static char id[] = "@(#)$Id: t_exclopen.c,v 8.7 2013/11/22 20:52:01 ca Exp $"; +static char id[] = "@(#)$Id: t_exclopen.c,v 8.7 2013-11-22 20:52:01 ca Exp $"; #endif /* ! lint */ static char Attacker[128]; diff --git a/contrib/sendmail/test/t_pathconf.c b/contrib/sendmail/test/t_pathconf.c index e3c7c7f2d36..f03875391ac 100644 --- a/contrib/sendmail/test/t_pathconf.c +++ b/contrib/sendmail/test/t_pathconf.c @@ -26,7 +26,7 @@ #include #ifndef lint -static char id[] = "@(#)$Id: t_pathconf.c,v 8.7 2013/11/22 20:52:01 ca Exp $"; +static char id[] = "@(#)$Id: t_pathconf.c,v 8.7 2013-11-22 20:52:01 ca Exp $"; #endif /* ! lint */ int diff --git a/contrib/sendmail/test/t_seteuid.c b/contrib/sendmail/test/t_seteuid.c index f64b93be877..be4ab17fe8c 100644 --- a/contrib/sendmail/test/t_seteuid.c +++ b/contrib/sendmail/test/t_seteuid.c @@ -26,7 +26,7 @@ #include #ifndef lint -static char id[] = "@(#)$Id: t_seteuid.c,v 8.9 2013/11/22 20:52:01 ca Exp $"; +static char id[] = "@(#)$Id: t_seteuid.c,v 8.9 2013-11-22 20:52:01 ca Exp $"; #endif /* ! lint */ #ifdef __hpux diff --git a/contrib/sendmail/test/t_setgid.c b/contrib/sendmail/test/t_setgid.c index a7d6bc591bc..64290744071 100644 --- a/contrib/sendmail/test/t_setgid.c +++ b/contrib/sendmail/test/t_setgid.c @@ -22,7 +22,7 @@ #include #ifndef lint -static char id[] = "@(#)$Id: t_setgid.c,v 1.7 2013/11/22 20:52:01 ca Exp $"; +static char id[] = "@(#)$Id: t_setgid.c,v 1.7 2013-11-22 20:52:01 ca Exp $"; #endif /* ! lint */ static void diff --git a/contrib/sendmail/test/t_setreuid.c b/contrib/sendmail/test/t_setreuid.c index 1eef37cd627..46fcb5f3ee9 100644 --- a/contrib/sendmail/test/t_setreuid.c +++ b/contrib/sendmail/test/t_setreuid.c @@ -23,7 +23,7 @@ #include #ifndef lint -static char id[] = "@(#)$Id: t_setreuid.c,v 8.10 2013/11/22 20:52:01 ca Exp $"; +static char id[] = "@(#)$Id: t_setreuid.c,v 8.10 2013-11-22 20:52:01 ca Exp $"; #endif /* ! lint */ #ifdef __hpux diff --git a/contrib/sendmail/test/t_setuid.c b/contrib/sendmail/test/t_setuid.c index 0d4f9f06489..627db2d0d0d 100644 --- a/contrib/sendmail/test/t_setuid.c +++ b/contrib/sendmail/test/t_setuid.c @@ -25,7 +25,7 @@ #include #ifndef lint -static char id[] = "@(#)$Id: t_setuid.c,v 8.8 2013/11/22 20:52:01 ca Exp $"; +static char id[] = "@(#)$Id: t_setuid.c,v 8.8 2013-11-22 20:52:01 ca Exp $"; #endif /* ! lint */ static void diff --git a/contrib/sendmail/test/t_snprintf.c b/contrib/sendmail/test/t_snprintf.c index b78f2d5ecb4..f690f611a16 100644 --- a/contrib/sendmail/test/t_snprintf.c +++ b/contrib/sendmail/test/t_snprintf.c @@ -12,7 +12,7 @@ #include #ifndef lint -static char id[] = "@(#)$Id: t_snprintf.c,v 8.5 2013/11/22 20:52:01 ca Exp $"; +static char id[] = "@(#)$Id: t_snprintf.c,v 8.5 2013-11-22 20:52:01 ca Exp $"; #endif /* ! lint */ #define TEST_STRING "1234567890" diff --git a/contrib/sendmail/vacation/Makefile b/contrib/sendmail/vacation/Makefile index 7cc577f4b6c..68f48c394f8 100644 --- a/contrib/sendmail/vacation/Makefile +++ b/contrib/sendmail/vacation/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 8.5 1999/09/23 22:36:45 ca Exp $ +# $Id: Makefile,v 8.5 1999-09-23 22:36:45 ca Exp $ SHELL= /bin/sh BUILD= ./Build diff --git a/contrib/sendmail/vacation/Makefile.m4 b/contrib/sendmail/vacation/Makefile.m4 index 8979d5d3f43..1a1bcfb395b 100644 --- a/contrib/sendmail/vacation/Makefile.m4 +++ b/contrib/sendmail/vacation/Makefile.m4 @@ -1,4 +1,4 @@ -dnl $Id: Makefile.m4,v 8.26 2006/06/28 21:08:05 ca Exp $ +dnl $Id: Makefile.m4,v 8.26 2006-06-28 21:08:05 ca Exp $ include(confBUILDTOOLSDIR`/M4/switch.m4') define(`confREQUIRE_LIBSM', `true') diff --git a/contrib/sendmail/vacation/vacation.1 b/contrib/sendmail/vacation/vacation.1 index 3f9c158e8cb..237368c9840 100644 --- a/contrib/sendmail/vacation/vacation.1 +++ b/contrib/sendmail/vacation/vacation.1 @@ -9,9 +9,9 @@ .\" the sendmail distribution. .\" .\" -.\" $Id: vacation.1,v 8.35 2013/11/22 20:52:02 ca Exp $ +.\" $Id: vacation.1,v 8.35 2013-11-22 20:52:02 ca Exp $ .\" -.TH VACATION 1 "$Date: 2013/11/22 20:52:02 $" +.TH VACATION 1 "$Date: 2013-11-22 20:52:02 $" .SH NAME vacation \- E-mail auto-responder diff --git a/contrib/sendmail/vacation/vacation.c b/contrib/sendmail/vacation/vacation.c index 00cbdc15cfd..1196464e72d 100644 --- a/contrib/sendmail/vacation/vacation.c +++ b/contrib/sendmail/vacation/vacation.c @@ -20,7 +20,7 @@ SM_IDSTR(copyright, The Regents of the University of California. All rights reserved.\n\ Copyright (c) 1983 Eric P. Allman. All rights reserved.\n") -SM_IDSTR(id, "@(#)$Id: vacation.c,v 8.148 2013/11/22 20:52:02 ca Exp $") +SM_IDSTR(id, "@(#)$Id: vacation.c,v 8.148 2013-11-22 20:52:02 ca Exp $") #include diff --git a/contrib/serf/CHANGES b/contrib/serf/CHANGES index e4e1c892b78..441eb1edf63 100644 --- a/contrib/serf/CHANGES +++ b/contrib/serf/CHANGES @@ -1,4 +1,15 @@ -Serf 1.3.4 [2014-02-08, from /tags/1.3.4, rxxxx] +Serf 1.3.6 [2014-06-09, from /tags/1.3.6, rxxxx] + Revert r2319 from serf 1.3.5: this change was making serf call handle_response + multiple times in case of an error response, leading to unexpected behavior. + +Serf 1.3.5 [2014-04-27, from /tags/1.3.5, rxxxx] + Fix issue #125: no reverse lookup during Negotiate authentication for proxies. + Fix a crash caused by incorrect reuse of the ssltunnel CONNECT request (r2316) + Cancel request if response parsing failed + authn callback set (r2319) + Update the expired certificates in the test suite. + + +Serf 1.3.4 [2014-02-08, from /tags/1.3.4, r2310] Fix issue #119: Endless loop during ssl tunnel setup with Negotiate authn Fix issue #123: Can't setup ssl tunnel which sends Connection close header Fix a race condition when initializing OpenSSL from multiple threads (r2263) diff --git a/contrib/serf/auth/auth_spnego.c b/contrib/serf/auth/auth_spnego.c index c0ad27e362d..e55fad2ae93 100644 --- a/contrib/serf/auth/auth_spnego.c +++ b/contrib/serf/auth/auth_spnego.c @@ -335,8 +335,7 @@ do_auth(peer_t peer, &tmp, &tmp_len, gss_info); } else { - char *proxy_host; - apr_getnameinfo(&proxy_host, conn->ctx->proxy_address, 0); + char *proxy_host = conn->ctx->proxy_address->hostname; status = gss_api_get_credentials(conn, token, token_len, proxy_host, &tmp, &tmp_len, diff --git a/contrib/serf/serf.h b/contrib/serf/serf.h index c28703f0c1c..d3ac2f3548d 100644 --- a/contrib/serf/serf.h +++ b/contrib/serf/serf.h @@ -1062,7 +1062,7 @@ void serf_debug__bucket_alloc_check( /* Version info */ #define SERF_MAJOR_VERSION 1 #define SERF_MINOR_VERSION 3 -#define SERF_PATCH_VERSION 4 +#define SERF_PATCH_VERSION 6 /* Version number string */ #define SERF_VERSION_STRING APR_STRINGIFY(SERF_MAJOR_VERSION) "." \ diff --git a/contrib/serf/ssltunnel.c b/contrib/serf/ssltunnel.c index 28ca1270044..0ad04d67703 100644 --- a/contrib/serf/ssltunnel.c +++ b/contrib/serf/ssltunnel.c @@ -70,12 +70,11 @@ static apr_status_t handle_response(serf_request_t *request, req_ctx_t *ctx = handler_baton; serf_connection_t *conn = request->conn; - if (! response) { - serf_connection_request_create(conn, - setup_request, - ctx); + /* CONNECT request was cancelled. Assuming that this is during connection + reset, we can safely discard the request as a new one will be created + when setting up the next connection. */ + if (!response) return APR_SUCCESS; - } status = serf_bucket_response_status(response, &sl); if (SERF_BUCKET_READ_ERROR(status)) { diff --git a/contrib/subversion/CHANGES b/contrib/subversion/CHANGES index b78eadd79d5..f1087479468 100644 --- a/contrib/subversion/CHANGES +++ b/contrib/subversion/CHANGES @@ -1,3 +1,70 @@ +Version 1.8.9 +(07 May 2014, from /branches/1.8.x) +http://svn.apache.org/repos/asf/subversion/tags/1.8.9 + + User-visible changes: + - Client-side bugfixes: + * log: use proper peg revision over DAV (r1568872) + * upgrade: allow upgrading from 1.7 with exclusive locks (r1572102 et al) + * proplist: resolve inconsitent inherited property results (r1575270 et al) + * increase minimal timestamp sleep from 1ms to 10ms (r1581305 et al) + * merge: automatic merge confused by subtree merge (issue #4481) + * propget: report proper error on invalid revision for url (r1586255) + * commit: fix an assertion when committing a deleted descendant + (r1571747, r1571787, r1571795) + * merge: resolve segfault when '--force' merges a directory delete + (r1577812, r1577813, r1579429) + * resolve: prevent interactive conflict resolution when nothing has been + done to resolve the conflict (r1577294) + * update: fix locks lost from wc with pre-1.6.17 servers (issue #4412) + * merge: honor the 'preserved-conflict-file-exts' setting (r1577151) + * list: fix '--verbose' against older servers (r1591111) + * unlock: fix ability to remove locks with timeouts (r1579588) + * copy: fix 'svn copy URL WC' on relocated working copies + (r1580626, r1580650) + * export: allow file externals to be exported (issue #4427) + * move: fix working copy db inconsistency in cert scenarios (issue #4437) + * commit: fix an issue where mixed revision copy with non copy descendants + that shadow a not present node couldn't be committed (r1518942 et al) + * delete: properly remove move_to info when the node in its original + location is removed (r1538812 et al) + * status; fix an issue where output would vary based on if the target + was the node itself or its parent (r1544597 et al) + + - Server-side bugfixes: + * ensure proper access synchronization in fsfs on Windows (r1568953 et al) + * svnadmin dump: don't let invalid mergeinfo stop dump (r1574868 et al) + * svnserve: resolve performance regression caused by iprops (r1578853 et al) + * reduce size of memory buffer when reading config files (r1581296) + * remove dead transaction if commit was blocked by hook (r1583977) + * svnrdump load: fix crash when svn:* normalization (issue #4490) + * fix memcached support (issue #4470) + * svndumpfilter: fix order of node record headers (r1578670 et al) + * mod_dav_svn: blacklist building with broken versions of httpd; 2.2.25, + 2.4.5 and 2.4.6 (r1545835) + * mod_dav_svn: allow generic DAV clients to refresh locks (issue #3515) + * mod_dav_svn: detect out of dateness correctly during commit (issue #4480) + + Developer-visible changes: + - General: + * improve consistency checks of DAV inherited property requests (r1498000) + * fix ocassional failure in autoprop_tests.py (r1567752) + * avoid duplicate sqlite analyze information rows (r1571214) + * add Mavericks to our sysinfo output (r1573088) + * bump copyright years to 2014 (r1555403) + * unbreak test suite when running as root (r1583580) + * resolve buffer overflow in testcode (r1481782) + * fix libmagic detection with custom LDFLAGS (r1577200) + * fix an out of scope variable use in merge (r1587946) + * javahl: fix crash from resolve callback throwing an exception (r1586439) + * ruby: fix two memory lifetime bugs (r1586052, r1586467) + * fix a missing null byte when handling old pre-1.4 deltas (r1587968) + * fix building with APR 0.9.x (r1585499) + * make svn_ra_get_locks() and svn_ra_get_lock() report not locked nodes + with a NULL svn_lock_t *, as documented (r1578273, r1578311, r1578326) + * fix tests for compiler flags (r1573106) + + Version 1.8.8 (19 Feb 2014, from /branches/1.8.x) http://svn.apache.org/repos/asf/subversion/tags/1.8.8 @@ -620,9 +687,36 @@ http://svn.apache.org/repos/asf/subversion/tags/1.8.0 * fix some reference counting bugs in swig-py bindings (r1464899, r1466524) -Version 1.7.15 -(12 Feb 2014, from /branches/1.7.x) -http://svn.apache.org/repos/asf/subversion/tags/1.7.15 +Version 1.7.17 +(07 May 2014, from /branches/1.7.x) +http://svn.apache.org/repos/asf/subversion/tags/1.7.17 + + User-visible changes: + - Client-side bugfixes: + * log: use proper peg revision over DAV (r1568872) + * move: fix errors when moving files between an external and the parent + working copy (r1551579) + * copy: fix 'svn copy URL WC' on relocated working copies + (r1580626, r1580650) + + - Server-side bugfixes: + * mod_dav_svn: blacklist building with broken versions of httpd; 2.2.25, + 2.4.5 and 2.4.6 (r1545835) + * mod_dav_svn: detect out of dateness correctly during commit (issue #4480) + + Developer-visible changes: + - General: + * fix libmagic detection with custom LDFLAGS (r1577200) + * fix a missing null byte when handling old pre-1.4 deltas (r1587968) + * support building with Serf 1.3.x (r1517123, r1535139) + + - Bindings: + * javahl: fix crash from resolve callback throwing an exception (r1586439) + + +Version 1.7.16 +(26 Feb 2014, from /branches/1.7.x) +http://svn.apache.org/repos/asf/subversion/tags/1.7.16 User-visible changes: - Client-side bugfixes: @@ -637,6 +731,11 @@ http://svn.apache.org/repos/asf/subversion/tags/1.7.15 - General: * fix failure in checkout_tests.py * support compiling against Cyrus sasl 2.1.25 (r1404912, r1413402) + * support compiling against neon 0.30.x (r1566320) + + +Version 1.7.15 +(Not released, see changes for 1.7.16.) Version 1.7.14 @@ -883,7 +982,7 @@ http://svn.apache.org/repos/asf/subversion/tags/1.7.6 * fix ra_serf against Subversion 1.2 servers (r1349367) * fix 'svn upgrade' on working copies with certain tree conflicts (r1345482) * avoid workqueue references to system temp dir (r1367854) - * allow non-existant canonical paths (r1367853) + * allow non-existent canonical paths (r1367853) * fix 'svn revert --depth files' to operate on files (r1365554) * fix ra_serf XML namespace handling against malicious server (r1337441) * fix relocate with server-relative externals (issue 4216) @@ -1235,7 +1334,7 @@ the 1.6 release: http://subversion.apache.org/docs/release-notes/1.7.html * fixed: rm -> ci -> cp = missing directory (issue #2763) * fixed: 'svn info' returns parent info on missing dirs (issue #3178) * fixed: spurious prop conflict with 'merge --reintegrate' (issue #3919) - * fixed: 'svn --version' fails with non-existant $HOME (issue #3947) + * fixed: 'svn --version' fails with non-existent $HOME (issue #3947) * fixed: unforced export silently overwites existing file (issue #3799) * fixed: reverse merge which adds subtree mergeinfo fails (issue #3978) * fixed: 'svn up -r{R>HEAD}' hangs client over ra_svn (issue #3963) @@ -1410,7 +1509,7 @@ http://svn.apache.org/repos/asf/subversion/tags/1.6.17 * fix crash in mod_dav_svn with GETs of baselined resources (r1104126) See CVE-2011-1752, and descriptive advisory at http://subversion.apache.org/security/CVE-2011-1752-advisory.txt - * fixed: write-through proxy could direcly commit to slave (r917523) + * fixed: write-through proxy could directly commit to slave (r917523) * detect a particular corruption condition in FSFS (r1100213) * improve error message when clients refer to unknown revisions (r939000) * bugfixes and optimizations to the DAV mirroring code (r878607) diff --git a/contrib/subversion/NOTICE b/contrib/subversion/NOTICE index fdcea3c804a..c1afd4127c6 100644 --- a/contrib/subversion/NOTICE +++ b/contrib/subversion/NOTICE @@ -1,5 +1,5 @@ Apache Subversion -Copyright 2013 The Apache Software Foundation +Copyright 2014 The Apache Software Foundation This product includes software developed by many people, and distributed under Contributor License Agreements to The Apache Software Foundation diff --git a/contrib/subversion/build-outputs.mk b/contrib/subversion/build-outputs.mk index 5845a86c2c9..6d73c30bc8d 100644 --- a/contrib/subversion/build-outputs.mk +++ b/contrib/subversion/build-outputs.mk @@ -2829,17 +2829,17 @@ subversion/tests/libsvn_wc/op-depth-test.lo: subversion/tests/libsvn_wc/op-depth subversion/tests/libsvn_wc/pristine-store-test.lo: subversion/tests/libsvn_wc/pristine-store-test.c subversion/include/private/svn_debug.h subversion/include/private/svn_diff_tree.h subversion/include/private/svn_skel.h subversion/include/private/svn_sqlite.h subversion/include/private/svn_token.h subversion/include/private/svn_wc_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_client.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_diff.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_opt.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_ra.h subversion/include/svn_repos.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/include/svn_wc.h subversion/libsvn_wc/wc-queries.h subversion/libsvn_wc/wc.h subversion/libsvn_wc/wc_db.h subversion/libsvn_wc/workqueue.h subversion/svn_private_config.h subversion/tests/libsvn_wc/utils.h subversion/tests/svn_test.h -subversion/tests/libsvn_wc/utils.lo: subversion/tests/libsvn_wc/utils.c subversion/include/private/svn_debug.h subversion/include/private/svn_diff_tree.h subversion/include/private/svn_skel.h subversion/include/private/svn_sqlite.h subversion/include/private/svn_token.h subversion/include/private/svn_wc_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_client.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_diff.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_opt.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_ra.h subversion/include/svn_repos.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/include/svn_wc.h subversion/libsvn_wc/wc-queries.h subversion/libsvn_wc/wc.h subversion/libsvn_wc/wc_db.h subversion/libsvn_wc/wc_db_private.h subversion/svn_private_config.h subversion/tests/libsvn_wc/utils.h subversion/tests/svn_test.h subversion/tests/svn_test_fs.h +subversion/tests/libsvn_wc/utils.lo: subversion/tests/libsvn_wc/utils.c subversion/include/private/svn_debug.h subversion/include/private/svn_dep_compat.h subversion/include/private/svn_diff_tree.h subversion/include/private/svn_skel.h subversion/include/private/svn_sqlite.h subversion/include/private/svn_token.h subversion/include/private/svn_wc_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_client.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_diff.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_opt.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_ra.h subversion/include/svn_repos.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/include/svn_wc.h subversion/libsvn_wc/wc-queries.h subversion/libsvn_wc/wc.h subversion/libsvn_wc/wc_db.h subversion/libsvn_wc/wc_db_private.h subversion/svn_private_config.h subversion/tests/libsvn_wc/utils.h subversion/tests/svn_test.h subversion/tests/svn_test_fs.h -subversion/tests/libsvn_wc/utils.lo: subversion/tests/libsvn_wc/utils.c subversion/include/private/svn_debug.h subversion/include/private/svn_diff_tree.h subversion/include/private/svn_skel.h subversion/include/private/svn_sqlite.h subversion/include/private/svn_token.h subversion/include/private/svn_wc_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_client.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_diff.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_opt.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_ra.h subversion/include/svn_repos.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/include/svn_wc.h subversion/libsvn_wc/wc-queries.h subversion/libsvn_wc/wc.h subversion/libsvn_wc/wc_db.h subversion/libsvn_wc/wc_db_private.h subversion/svn_private_config.h subversion/tests/libsvn_wc/utils.h subversion/tests/svn_test.h subversion/tests/svn_test_fs.h +subversion/tests/libsvn_wc/utils.lo: subversion/tests/libsvn_wc/utils.c subversion/include/private/svn_debug.h subversion/include/private/svn_dep_compat.h subversion/include/private/svn_diff_tree.h subversion/include/private/svn_skel.h subversion/include/private/svn_sqlite.h subversion/include/private/svn_token.h subversion/include/private/svn_wc_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_client.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_diff.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_opt.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_ra.h subversion/include/svn_repos.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/include/svn_wc.h subversion/libsvn_wc/wc-queries.h subversion/libsvn_wc/wc.h subversion/libsvn_wc/wc_db.h subversion/libsvn_wc/wc_db_private.h subversion/svn_private_config.h subversion/tests/libsvn_wc/utils.h subversion/tests/svn_test.h subversion/tests/svn_test_fs.h -subversion/tests/libsvn_wc/utils.lo: subversion/tests/libsvn_wc/utils.c subversion/include/private/svn_debug.h subversion/include/private/svn_diff_tree.h subversion/include/private/svn_skel.h subversion/include/private/svn_sqlite.h subversion/include/private/svn_token.h subversion/include/private/svn_wc_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_client.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_diff.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_opt.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_ra.h subversion/include/svn_repos.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/include/svn_wc.h subversion/libsvn_wc/wc-queries.h subversion/libsvn_wc/wc.h subversion/libsvn_wc/wc_db.h subversion/libsvn_wc/wc_db_private.h subversion/svn_private_config.h subversion/tests/libsvn_wc/utils.h subversion/tests/svn_test.h subversion/tests/svn_test_fs.h +subversion/tests/libsvn_wc/utils.lo: subversion/tests/libsvn_wc/utils.c subversion/include/private/svn_debug.h subversion/include/private/svn_dep_compat.h subversion/include/private/svn_diff_tree.h subversion/include/private/svn_skel.h subversion/include/private/svn_sqlite.h subversion/include/private/svn_token.h subversion/include/private/svn_wc_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_client.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_diff.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_opt.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_ra.h subversion/include/svn_repos.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/include/svn_wc.h subversion/libsvn_wc/wc-queries.h subversion/libsvn_wc/wc.h subversion/libsvn_wc/wc_db.h subversion/libsvn_wc/wc_db_private.h subversion/svn_private_config.h subversion/tests/libsvn_wc/utils.h subversion/tests/svn_test.h subversion/tests/svn_test_fs.h -subversion/tests/libsvn_wc/utils.lo: subversion/tests/libsvn_wc/utils.c subversion/include/private/svn_debug.h subversion/include/private/svn_diff_tree.h subversion/include/private/svn_skel.h subversion/include/private/svn_sqlite.h subversion/include/private/svn_token.h subversion/include/private/svn_wc_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_client.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_diff.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_opt.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_ra.h subversion/include/svn_repos.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/include/svn_wc.h subversion/libsvn_wc/wc-queries.h subversion/libsvn_wc/wc.h subversion/libsvn_wc/wc_db.h subversion/libsvn_wc/wc_db_private.h subversion/svn_private_config.h subversion/tests/libsvn_wc/utils.h subversion/tests/svn_test.h subversion/tests/svn_test_fs.h +subversion/tests/libsvn_wc/utils.lo: subversion/tests/libsvn_wc/utils.c subversion/include/private/svn_debug.h subversion/include/private/svn_dep_compat.h subversion/include/private/svn_diff_tree.h subversion/include/private/svn_skel.h subversion/include/private/svn_sqlite.h subversion/include/private/svn_token.h subversion/include/private/svn_wc_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_client.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_diff.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_opt.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_ra.h subversion/include/svn_repos.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/include/svn_wc.h subversion/libsvn_wc/wc-queries.h subversion/libsvn_wc/wc.h subversion/libsvn_wc/wc_db.h subversion/libsvn_wc/wc_db_private.h subversion/svn_private_config.h subversion/tests/libsvn_wc/utils.h subversion/tests/svn_test.h subversion/tests/svn_test_fs.h -subversion/tests/libsvn_wc/utils.lo: subversion/tests/libsvn_wc/utils.c subversion/include/private/svn_debug.h subversion/include/private/svn_diff_tree.h subversion/include/private/svn_skel.h subversion/include/private/svn_sqlite.h subversion/include/private/svn_token.h subversion/include/private/svn_wc_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_client.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_diff.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_opt.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_ra.h subversion/include/svn_repos.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/include/svn_wc.h subversion/libsvn_wc/wc-queries.h subversion/libsvn_wc/wc.h subversion/libsvn_wc/wc_db.h subversion/libsvn_wc/wc_db_private.h subversion/svn_private_config.h subversion/tests/libsvn_wc/utils.h subversion/tests/svn_test.h subversion/tests/svn_test_fs.h +subversion/tests/libsvn_wc/utils.lo: subversion/tests/libsvn_wc/utils.c subversion/include/private/svn_debug.h subversion/include/private/svn_dep_compat.h subversion/include/private/svn_diff_tree.h subversion/include/private/svn_skel.h subversion/include/private/svn_sqlite.h subversion/include/private/svn_token.h subversion/include/private/svn_wc_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_client.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_diff.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_opt.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_ra.h subversion/include/svn_repos.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/include/svn_wc.h subversion/libsvn_wc/wc-queries.h subversion/libsvn_wc/wc.h subversion/libsvn_wc/wc_db.h subversion/libsvn_wc/wc_db_private.h subversion/svn_private_config.h subversion/tests/libsvn_wc/utils.h subversion/tests/svn_test.h subversion/tests/svn_test_fs.h -subversion/tests/libsvn_wc/utils.lo: subversion/tests/libsvn_wc/utils.c subversion/include/private/svn_debug.h subversion/include/private/svn_diff_tree.h subversion/include/private/svn_skel.h subversion/include/private/svn_sqlite.h subversion/include/private/svn_token.h subversion/include/private/svn_wc_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_client.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_diff.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_opt.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_ra.h subversion/include/svn_repos.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/include/svn_wc.h subversion/libsvn_wc/wc-queries.h subversion/libsvn_wc/wc.h subversion/libsvn_wc/wc_db.h subversion/libsvn_wc/wc_db_private.h subversion/svn_private_config.h subversion/tests/libsvn_wc/utils.h subversion/tests/svn_test.h subversion/tests/svn_test_fs.h +subversion/tests/libsvn_wc/utils.lo: subversion/tests/libsvn_wc/utils.c subversion/include/private/svn_debug.h subversion/include/private/svn_dep_compat.h subversion/include/private/svn_diff_tree.h subversion/include/private/svn_skel.h subversion/include/private/svn_sqlite.h subversion/include/private/svn_token.h subversion/include/private/svn_wc_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_client.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_diff.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_opt.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_ra.h subversion/include/svn_repos.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/include/svn_wc.h subversion/libsvn_wc/wc-queries.h subversion/libsvn_wc/wc.h subversion/libsvn_wc/wc_db.h subversion/libsvn_wc/wc_db_private.h subversion/svn_private_config.h subversion/tests/libsvn_wc/utils.h subversion/tests/svn_test.h subversion/tests/svn_test_fs.h subversion/tests/libsvn_wc/wc-incomplete-tester.lo: subversion/tests/libsvn_wc/wc-incomplete-tester.c subversion/include/private/svn_debug.h subversion/include/private/svn_diff_tree.h subversion/include/private/svn_skel.h subversion/include/private/svn_sqlite.h subversion/include/private/svn_token.h subversion/include/private/svn_wc_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_opt.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_ra.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/include/svn_wc.h subversion/libsvn_wc/wc.h subversion/libsvn_wc/wc_db.h subversion/svn_private_config.h diff --git a/contrib/subversion/configure b/contrib/subversion/configure index 17799235bb4..3010dc7a878 100755 --- a/contrib/subversion/configure +++ b/contrib/subversion/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for subversion 1.8.8. +# Generated by GNU Autoconf 2.69 for subversion 1.8.9. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='subversion' PACKAGE_TARNAME='subversion' -PACKAGE_VERSION='1.8.8' -PACKAGE_STRING='subversion 1.8.8' +PACKAGE_VERSION='1.8.9' +PACKAGE_STRING='subversion 1.8.9' PACKAGE_BUGREPORT='http://subversion.apache.org/' PACKAGE_URL='' @@ -1457,7 +1457,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures subversion 1.8.8 to adapt to many kinds of systems. +\`configure' configures subversion 1.8.9 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1523,7 +1523,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of subversion 1.8.8:";; + short | recursive ) echo "Configuration of subversion 1.8.9:";; esac cat <<\_ACEOF @@ -1737,7 +1737,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -subversion configure 1.8.8 +subversion configure 1.8.9 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1789,6 +1789,52 @@ fi } # ac_fn_c_try_compile +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + # ac_fn_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. @@ -1827,6 +1873,52 @@ fi } # ac_fn_cxx_try_compile +# ac_fn_cxx_try_link LINENO +# ------------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_link + # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. @@ -2028,52 +2120,6 @@ $as_echo "$ac_res" >&6; } } # ac_fn_c_check_header_compile -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly @@ -2178,52 +2224,6 @@ fi } # ac_fn_cxx_try_cpp -# ac_fn_cxx_try_link LINENO -# ------------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_link - # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache @@ -2281,7 +2281,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by subversion $as_me 1.8.8, which was +It was created by subversion $as_me 1.8.9, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2661,8 +2661,8 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. -{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring Subversion 1.8.8" >&5 -$as_echo "$as_me: Configuring Subversion 1.8.8" >&6;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring Subversion 1.8.9" >&5 +$as_echo "$as_me: Configuring Subversion 1.8.9" >&6;} abs_srcdir="`cd $srcdir && pwd`" @@ -3509,11 +3509,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -std=c90" >&5 $as_echo_n "checking if $CC accepts -std=c90... " >&6; } CFLAGS="-std=c90 $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -3536,11 +3536,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -std=c89" >&5 $as_echo_n "checking if $CC accepts -std=c89... " >&6; } CFLAGS="-std=c89 $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -3563,11 +3563,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -ansi" >&5 $as_echo_n "checking if $CC accepts -ansi... " >&6; } CFLAGS="-ansi $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -3581,7 +3581,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3592,7 +3593,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3603,7 +3605,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3628,11 +3631,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -Werror=unknown-warning-option" >&5 $as_echo_n "checking if $CC accepts -Werror=unknown-warning-option... " >&6; } CFLAGS="-Werror=unknown-warning-option $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -3646,7 +3649,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3932,11 +3936,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CXX accepts -std=c++98" >&5 $as_echo_n "checking if $CXX accepts -std=c++98... " >&6; } CXXFLAGS="-std=c++98 $CXXFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(){} _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -3950,7 +3954,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3975,11 +3980,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CXX accepts -Werror=unknown-warning-option" >&5 $as_echo_n "checking if $CXX accepts -Werror=unknown-warning-option... " >&6; } CXXFLAGS="-Werror=unknown-warning-option $CXXFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(){} _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -3993,7 +3998,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -4578,7 +4584,7 @@ fi # ==== Libraries, for which we may have source to build ====================== -APR_VER_REGEXES="0\.9\.[7-9] 0\.9\.1[0-9] 1\. 2\." +APR_VER_REGEXES="0\.9\.[7-9] 0\.9\.[12][0-9] 1\. 2\." APR_WANTED_REGEXES="$APR_VER_REGEXES" @@ -5718,6 +5724,38 @@ rm -f conftest* CPPFLAGS="$old_CPPFLAGS" fi +# check for some busted versions of mod_dav +# in particular 2.2.25, 2.4.5, and 2.4.6 had the following bugs which are +# troublesome for Subversion: +# PR 55304: https://issues.apache.org/bugzilla/show_bug.cgi?id=55304 +# PR 55306: https://issues.apache.org/bugzilla/show_bug.cgi?id=55306 +# PR 55397: https://issues.apache.org/bugzilla/show_bug.cgi?id=55397 +if test -n "$APXS" && test "$APXS" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking mod_dav version" >&5 +$as_echo_n "checking mod_dav version... " >&6; } + old_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $SVN_APR_INCLUDES" + blacklisted_versions_regex="\"2\" \"\.\" (\"2\" \"\.\" \"25\"|\"4\" \"\.\" \"[56]\")" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include "$APXS_INCLUDE/ap_release.h" +apache_version=AP_SERVER_BASEREVISION +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "apache_version= *$blacklisted_versions_regex" >/dev/null 2>&1; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: broken" >&5 +$as_echo "broken" >&6; } + as_fn_error $? "Apache httpd version includes a broken mod_dav; use a newer version of httpd" "$LINENO" 5 +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: acceptable" >&5 +$as_echo "acceptable" >&6; } +fi +rm -f conftest* + + CPPFLAGS="$old_CPPFLAGS" +fi + # Check whether --with-apache-libexecdir was given. if test "${with_apache_libexecdir+set}" = set; then : @@ -19147,7 +19185,7 @@ if test "x$ac_cv_header_magic_h" = xyes; then : _ACEOF save_ldflags="$LDFLAGS" - LDFLAGS="-L$libmagic_prefix/lib" + LDFLAGS="-L$libmagic_prefix/lib $LDFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for magic_open in -lmagic" >&5 $as_echo_n "checking for magic_open in -lmagic... " >&6; } if ${ac_cv_lib_magic_magic_open+:} false; then : @@ -20013,11 +20051,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -Werror=implicit-function-declaration" >&5 $as_echo_n "checking if $CC accepts -Werror=implicit-function-declaration... " >&6; } CFLAGS="-Werror=implicit-function-declaration $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20031,7 +20069,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -20050,11 +20089,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -Werror=declaration-after-statement" >&5 $as_echo_n "checking if $CC accepts -Werror=declaration-after-statement... " >&6; } CFLAGS="-Werror=declaration-after-statement $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20068,7 +20107,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -20087,11 +20127,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -Wextra-tokens" >&5 $as_echo_n "checking if $CC accepts -Wextra-tokens... " >&6; } CFLAGS="-Wextra-tokens $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20105,7 +20145,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -20124,11 +20165,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -Wnewline-eof" >&5 $as_echo_n "checking if $CC accepts -Wnewline-eof... " >&6; } CFLAGS="-Wnewline-eof $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20142,7 +20183,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -20161,11 +20203,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -Wshorten-64-to-32" >&5 $as_echo_n "checking if $CC accepts -Wshorten-64-to-32... " >&6; } CFLAGS="-Wshorten-64-to-32 $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20179,7 +20221,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -20198,11 +20241,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -Wold-style-definition" >&5 $as_echo_n "checking if $CC accepts -Wold-style-definition... " >&6; } CFLAGS="-Wold-style-definition $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20216,7 +20259,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -20235,11 +20279,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -Wno-system-headers" >&5 $as_echo_n "checking if $CC accepts -Wno-system-headers... " >&6; } CFLAGS="-Wno-system-headers $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20253,7 +20297,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -20272,11 +20317,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -Wno-format-nonliteral" >&5 $as_echo_n "checking if $CC accepts -Wno-format-nonliteral... " >&6; } CFLAGS="-Wno-format-nonliteral $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20290,7 +20335,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -20322,11 +20368,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CXX accepts -Wextra-tokens" >&5 $as_echo_n "checking if $CXX accepts -Wextra-tokens... " >&6; } CXXFLAGS="-Wextra-tokens $CXXFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(){} _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20340,7 +20386,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -20359,11 +20406,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CXX accepts -Wnewline-eof" >&5 $as_echo_n "checking if $CXX accepts -Wnewline-eof... " >&6; } CXXFLAGS="-Wnewline-eof $CXXFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(){} _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20377,7 +20424,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -20396,11 +20444,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CXX accepts -Wshorten-64-to-32" >&5 $as_echo_n "checking if $CXX accepts -Wshorten-64-to-32... " >&6; } CXXFLAGS="-Wshorten-64-to-32 $CXXFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(){} _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20414,7 +20462,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -20433,11 +20482,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CXX accepts -Wno-system-headers" >&5 $as_echo_n "checking if $CXX accepts -Wno-system-headers... " >&6; } CXXFLAGS="-Wno-system-headers $CXXFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(){} _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20451,7 +20500,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -20492,11 +20542,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -fno-inline" >&5 $as_echo_n "checking if $CC accepts -fno-inline... " >&6; } CFLAGS="-fno-inline $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20510,7 +20560,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -20529,11 +20580,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -fno-omit-frame-pointer" >&5 $as_echo_n "checking if $CC accepts -fno-omit-frame-pointer... " >&6; } CFLAGS="-fno-omit-frame-pointer $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20547,7 +20598,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -20566,11 +20618,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -g3" >&5 $as_echo_n "checking if $CC accepts -g3... " >&6; } CFLAGS="-g3 $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20593,11 +20645,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -g2" >&5 $as_echo_n "checking if $CC accepts -g2... " >&6; } CFLAGS="-g2 $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20620,11 +20672,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -g" >&5 $as_echo_n "checking if $CC accepts -g... " >&6; } CFLAGS="-g $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20638,7 +20690,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -20648,7 +20701,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -20658,7 +20712,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -20682,11 +20737,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CXX accepts -fno-inline" >&5 $as_echo_n "checking if $CXX accepts -fno-inline... " >&6; } CXXFLAGS="-fno-inline $CXXFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(){} _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20700,7 +20755,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -20719,11 +20775,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CXX accepts -fno-omit-frame-pointer" >&5 $as_echo_n "checking if $CXX accepts -fno-omit-frame-pointer... " >&6; } CXXFLAGS="-fno-omit-frame-pointer $CXXFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(){} _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20737,7 +20793,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -20756,11 +20813,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CXX accepts -g3" >&5 $as_echo_n "checking if $CXX accepts -g3... " >&6; } CXXFLAGS="-g3 $CXXFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(){} _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20783,11 +20840,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CXX accepts -g2" >&5 $as_echo_n "checking if $CXX accepts -g2... " >&6; } CXXFLAGS="-g2 $CXXFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(){} _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20810,11 +20867,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CXX accepts -g" >&5 $as_echo_n "checking if $CXX accepts -g... " >&6; } CXXFLAGS="-g $CXXFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(){} _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20828,7 +20885,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -20838,7 +20896,8 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -20848,7 +20907,8 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -20887,11 +20947,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -O1" >&5 $as_echo_n "checking if $CC accepts -O1... " >&6; } CFLAGS="-O1 $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20914,11 +20974,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -O" >&5 $as_echo_n "checking if $CC accepts -O... " >&6; } CFLAGS="-O $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20932,7 +20992,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -20942,7 +21003,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -20964,11 +21026,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -O3" >&5 $as_echo_n "checking if $CC accepts -O3... " >&6; } CFLAGS="-O3 $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -20991,11 +21053,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -O2" >&5 $as_echo_n "checking if $CC accepts -O2... " >&6; } CFLAGS="-O2 $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -21018,11 +21080,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -O1" >&5 $as_echo_n "checking if $CC accepts -O1... " >&6; } CFLAGS="-O1 $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -21045,11 +21107,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -O" >&5 $as_echo_n "checking if $CC accepts -O... " >&6; } CFLAGS="-O $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -21063,7 +21125,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -21073,7 +21136,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -21083,7 +21147,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -21093,7 +21158,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -21112,11 +21178,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -Wno-clobbered" >&5 $as_echo_n "checking if $CC accepts -Wno-clobbered... " >&6; } CFLAGS="-Wno-clobbered $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -21130,7 +21196,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -21149,11 +21216,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -flto" >&5 $as_echo_n "checking if $CC accepts -flto... " >&6; } CFLAGS="-flto $CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(void){return 0;} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -21167,7 +21234,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -21193,11 +21261,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CXX accepts -O1" >&5 $as_echo_n "checking if $CXX accepts -O1... " >&6; } CXXFLAGS="-O1 $CXXFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(){} _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -21220,11 +21288,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CXX accepts -O" >&5 $as_echo_n "checking if $CXX accepts -O... " >&6; } CXXFLAGS="-O $CXXFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(){} _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -21238,7 +21306,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -21248,7 +21317,8 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -21270,11 +21340,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CXX accepts -O3" >&5 $as_echo_n "checking if $CXX accepts -O3... " >&6; } CXXFLAGS="-O3 $CXXFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(){} _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -21297,11 +21367,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CXX accepts -O2" >&5 $as_echo_n "checking if $CXX accepts -O2... " >&6; } CXXFLAGS="-O2 $CXXFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(){} _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -21324,11 +21394,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CXX accepts -O1" >&5 $as_echo_n "checking if $CXX accepts -O1... " >&6; } CXXFLAGS="-O1 $CXXFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(){} _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -21351,11 +21421,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CXX accepts -O" >&5 $as_echo_n "checking if $CXX accepts -O... " >&6; } CXXFLAGS="-O $CXXFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(){} _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -21369,7 +21439,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -21379,7 +21450,8 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -21389,7 +21461,8 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -21399,7 +21472,8 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -21418,11 +21492,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CXX accepts -Wno-clobbered" >&5 $as_echo_n "checking if $CXX accepts -Wno-clobbered... " >&6; } CXXFLAGS="-Wno-clobbered $CXXFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(){} _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -21436,7 +21510,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -21455,11 +21530,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CXX accepts -flto" >&5 $as_echo_n "checking if $CXX accepts -flto... " >&6; } CXXFLAGS="-flto $CXXFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +int main(){} _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -21473,7 +21548,8 @@ $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -25670,7 +25746,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by subversion $as_me 1.8.8, which was +This file was extended by subversion $as_me 1.8.9, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -25736,7 +25812,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -subversion config.status 1.8.8 +subversion config.status 1.8.9 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/contrib/subversion/configure.ac b/contrib/subversion/configure.ac index e93d7a35f28..f7d2264a9b8 100644 --- a/contrib/subversion/configure.ac +++ b/contrib/subversion/configure.ac @@ -98,7 +98,7 @@ dnl now generating errors instead of silently ignoring dnl them. Only .7 and later can guarantee repository dnl integrity with FSFS. -APR_VER_REGEXES=["0\.9\.[7-9] 0\.9\.1[0-9] 1\. 2\."] +APR_VER_REGEXES=["0\.9\.[7-9] 0\.9\.[12][0-9] 1\. 2\."] SVN_LIB_APR($APR_VER_REGEXES) @@ -755,7 +755,7 @@ AC_ARG_WITH(libmagic,AS_HELP_STRING([--with-libmagic=PREFIX], CPPFLAGS="$CPPFLAGS -I$libmagic_prefix/include" AC_CHECK_HEADERS(magic.h,[ save_ldflags="$LDFLAGS" - LDFLAGS="-L$libmagic_prefix/lib" + LDFLAGS="-L$libmagic_prefix/lib $LDFLAGS" AC_CHECK_LIB(magic, magic_open, [libmagic_found="yes"]) LDFLAGS="$save_ldflags" ]) diff --git a/contrib/subversion/subversion/include/private/svn_cache.h b/contrib/subversion/subversion/include/private/svn_cache.h index df40f7e0691..08d2f09cb61 100644 --- a/contrib/subversion/subversion/include/private/svn_cache.h +++ b/contrib/subversion/subversion/include/private/svn_cache.h @@ -182,6 +182,10 @@ typedef struct svn_cache__info_t * if they are strings. Cached values will be copied in and out of * the cache using @a serialize_func and @a deserialize_func, respectively. * + * If @a deserialize_func is NULL, then the data is returned as an + * svn_stringbuf_t; if @a serialize_func is NULL, then the data is + * assumed to be an svn_stringbuf_t. + * * The cache stores up to @a pages * @a items_per_page items at a * time. The exact cache invalidation strategy is not defined here, * but in general, a lower value for @a items_per_page means more @@ -224,7 +228,7 @@ svn_cache__create_inprocess(svn_cache__t **cache_p, * other caches. @a *cache_p will be allocated in @a result_pool. * * If @a deserialize_func is NULL, then the data is returned as an - * svn_string_t; if @a serialize_func is NULL, then the data is + * svn_stringbuf_t; if @a serialize_func is NULL, then the data is * assumed to be an svn_stringbuf_t. * * These caches are always thread safe. @@ -309,7 +313,7 @@ svn_cache__membuffer_cache_create(svn_membuffer_t **cache, * this cache from other caches. @a *cache_p will be allocated in @a result_pool. * * If @a deserialize_func is NULL, then the data is returned as an - * svn_string_t; if @a serialize_func is NULL, then the data is + * svn_stringbuf_t; if @a serialize_func is NULL, then the data is * assumed to be an svn_stringbuf_t. * * If @a thread_safe is true, and APR is compiled with threads, all diff --git a/contrib/subversion/subversion/include/private/svn_dep_compat.h b/contrib/subversion/subversion/include/private/svn_dep_compat.h index 71c0b9a7549..108b67cd673 100644 --- a/contrib/subversion/subversion/include/private/svn_dep_compat.h +++ b/contrib/subversion/subversion/include/private/svn_dep_compat.h @@ -78,6 +78,7 @@ void svn_hash__clear(struct apr_hash_t *ht); #if !APR_VERSION_AT_LEAST(1,0,0) #define APR_UINT64_C(val) UINT64_C(val) #define APR_FPROT_OS_DEFAULT APR_OS_DEFAULT +#define apr_hash_make_custom(pool,hash_func) apr_hash_make(pool) #endif #if !APR_VERSION_AT_LEAST(1,3,0) @@ -114,6 +115,12 @@ typedef apr_uint32_t apr_uintptr_t; #define SVN_LOCK_IS_BUSY(x) APR_STATUS_IS_EBUSY(x) #endif +#if !APR_VERSION_AT_LEAST(1,4,0) +#ifndef apr_time_from_msec +#define apr_time_from_msec(msec) ((apr_time_t)(msec) * 1000) +#endif +#endif + /** * Check at compile time if the Serf version is at least a certain * level. diff --git a/contrib/subversion/subversion/include/svn_version.h b/contrib/subversion/subversion/include/svn_version.h index 646c0286abc..ee97c88a2f0 100644 --- a/contrib/subversion/subversion/include/svn_version.h +++ b/contrib/subversion/subversion/include/svn_version.h @@ -72,7 +72,7 @@ extern "C" { * * @since New in 1.1. */ -#define SVN_VER_PATCH 8 +#define SVN_VER_PATCH 9 /** @deprecated Provided for backward compatibility with the 1.0 API. */ @@ -95,7 +95,7 @@ extern "C" { * * Always change this at the same time as SVN_VER_NUMTAG. */ -#define SVN_VER_TAG " (r1568071)" +#define SVN_VER_TAG " (r1591380)" /** Number tag: a string describing the version. @@ -121,7 +121,7 @@ extern "C" { * When rolling a tarball, we automatically replace it with what we * guess to be the correct revision number. */ -#define SVN_VER_REVISION 1568071 +#define SVN_VER_REVISION 1591380 /* Version strings composed from the above definitions. */ diff --git a/contrib/subversion/subversion/libsvn_client/commit_util.c b/contrib/subversion/subversion/libsvn_client/commit_util.c index 1e2c50cd9e6..a32ec5d3ef8 100644 --- a/contrib/subversion/subversion/libsvn_client/commit_util.c +++ b/contrib/subversion/subversion/libsvn_client/commit_util.c @@ -892,7 +892,7 @@ harvest_status_callback(void *status_baton, if (matches_changelists && (is_harvest_root || baton->changelists) && state_flags - && is_added + && (is_added || (is_deleted && is_op_root && status->copied)) && baton->danglers) { /* If a node is added, its parent must exist in the repository at the @@ -966,17 +966,19 @@ struct handle_descendants_baton void *cancel_baton; svn_client__check_url_kind_t check_url_func; void *check_url_baton; + svn_client__committables_t *committables; }; /* Helper for the commit harvesters */ static svn_error_t * handle_descendants(void *baton, - const void *key, apr_ssize_t klen, void *val, - apr_pool_t *pool) + const void *key, apr_ssize_t klen, void *val, + apr_pool_t *pool) { struct handle_descendants_baton *hdb = baton; apr_array_header_t *commit_items = val; apr_pool_t *iterpool = svn_pool_create(pool); + const char *repos_root_url = key; int i; for (i = 0; i < commit_items->nelts; i++) @@ -1002,33 +1004,65 @@ handle_descendants(void *baton, for (j = 0; j < absent_descendants->nelts; j++) { - int k; - svn_boolean_t found_item = FALSE; svn_node_kind_t kind; + svn_client_commit_item3_t *desc_item; const char *relpath = APR_ARRAY_IDX(absent_descendants, j, const char *); const char *local_abspath = svn_dirent_join(item->path, relpath, iterpool); - /* If the path has a commit operation, we do nothing. - (It will be deleted by the operation) */ - for (k = 0; k < commit_items->nelts; k++) - { - svn_client_commit_item3_t *cmt_item = - APR_ARRAY_IDX(commit_items, k, svn_client_commit_item3_t *); - - if (! strcmp(cmt_item->path, local_abspath)) - { - found_item = TRUE; - break; - } - } - - if (found_item) - continue; /* We have an explicit delete or replace for this path */ - /* ### Need a sub-iterpool? */ + + /* We found a 'not present' descendant during a copy (at op_depth>0), + this is most commonly caused by copying some mixed revision tree. + + In this case not present can imply that the node does not exist + in the parent revision, or that the node does. But we want to copy + the working copy state in which it does not exist, but might be + replaced. */ + + desc_item = svn_hash_gets(hdb->committables->by_path, local_abspath); + + /* If the path has a commit operation (possibly at an higher + op_depth, we might want to turn an add in a replace. */ + if (desc_item) + { + const char *dir; + svn_boolean_t found_intermediate = FALSE; + + if (desc_item->state_flags & SVN_CLIENT_COMMIT_ITEM_DELETE) + continue; /* We already have a delete or replace */ + else if (!(desc_item->state_flags & SVN_CLIENT_COMMIT_ITEM_ADD)) + continue; /* Not a copy/add, just a modification */ + + dir = svn_dirent_dirname(local_abspath, iterpool); + + while (strcmp(dir, item->path)) + { + svn_client_commit_item3_t *i_item; + + i_item = svn_hash_gets(hdb->committables->by_path, dir); + + if (i_item) + { + if ((i_item->state_flags & SVN_CLIENT_COMMIT_ITEM_DELETE) + || (i_item->state_flags & SVN_CLIENT_COMMIT_ITEM_ADD)) + { + found_intermediate = TRUE; + break; + } + } + dir = svn_dirent_dirname(dir, iterpool); + } + + if (found_intermediate) + continue; /* Some intermediate ancestor is an add or delete */ + + /* Fall through to detect if we need to turn the add in a + replace. */ + } + if (hdb->check_url_func) { const char *from_url = svn_path_url_add_component2( @@ -1045,25 +1079,35 @@ handle_descendants(void *baton, else kind = svn_node_unknown; /* 'Ok' for a delete of something */ - { - /* Add a new commit item that describes the delete */ - apr_pool_t *result_pool = commit_items->pool; - svn_client_commit_item3_t *new_item - = svn_client_commit_item3_create(result_pool); + if (desc_item) + { + /* Extend the existing add/copy item to create a replace */ + desc_item->state_flags |= SVN_CLIENT_COMMIT_ITEM_DELETE; + continue; + } - new_item->path = svn_dirent_join(item->path, relpath, - result_pool); - new_item->kind = kind; - new_item->url = svn_path_url_add_component2(item->url, relpath, - result_pool); - new_item->revision = SVN_INVALID_REVNUM; - new_item->state_flags = SVN_CLIENT_COMMIT_ITEM_DELETE; - new_item->incoming_prop_changes = apr_array_make(result_pool, 1, - sizeof(svn_prop_t *)); + /* Add a new commit item that describes the delete */ - APR_ARRAY_PUSH(commit_items, svn_client_commit_item3_t *) - = new_item; - } + SVN_ERR(add_committable(hdb->committables, + svn_dirent_join(item->path, relpath, + iterpool), + kind, + repos_root_url, + svn_uri_skip_ancestor( + repos_root_url, + svn_path_url_add_component2(item->url, + relpath, + iterpool), + iterpool), + SVN_INVALID_REVNUM, + NULL /* copyfrom_relpath */, + SVN_INVALID_REVNUM, + NULL /* moved_from_abspath */, + SVN_CLIENT_COMMIT_ITEM_DELETE, + NULL /* lock tokens */, + NULL /* lock */, + commit_items->pool, + iterpool)); } } @@ -1181,6 +1225,7 @@ svn_client__harvest_committables(svn_client__committables_t **committables, hdb.cancel_baton = ctx->cancel_baton; hdb.check_url_func = check_url_func; hdb.check_url_baton = check_url_baton; + hdb.committables = *committables; SVN_ERR(svn_iter_apr_hash(NULL, (*committables)->by_repository, handle_descendants, &hdb, iterpool)); @@ -1274,6 +1319,7 @@ harvest_copy_committables(void *baton, void *item, apr_pool_t *pool) hdb.cancel_baton = btn->ctx->cancel_baton; hdb.check_url_func = btn->check_url_func; hdb.check_url_baton = btn->check_url_baton; + hdb.committables = btn->committables; SVN_ERR(svn_iter_apr_hash(NULL, btn->committables->by_repository, handle_descendants, &hdb, pool)); diff --git a/contrib/subversion/subversion/libsvn_client/export.c b/contrib/subversion/subversion/libsvn_client/export.c index d6022ed68f2..c14a5f0bc01 100644 --- a/contrib/subversion/subversion/libsvn_client/export.c +++ b/contrib/subversion/subversion/libsvn_client/export.c @@ -267,7 +267,9 @@ export_node(void *baton, scratch_pool)); } - if (status->file_external) + /* Skip file externals if they are a descendant of the export, + BUT NOT if we are explictly exporting the file external. */ + if (status->file_external && strcmp(eib->origin_abspath, local_abspath) != 0) return SVN_NO_ERROR; /* Produce overwrite errors for the export root */ @@ -1587,3 +1589,4 @@ svn_client_export5(svn_revnum_t *result_rev, return SVN_NO_ERROR; } + diff --git a/contrib/subversion/subversion/libsvn_client/merge.c b/contrib/subversion/subversion/libsvn_client/merge.c index cb07f8303c2..b314e8409b2 100644 --- a/contrib/subversion/subversion/libsvn_client/merge.c +++ b/contrib/subversion/subversion/libsvn_client/merge.c @@ -322,6 +322,10 @@ typedef struct merge_cmd_baton_t { const char *diff3_cmd; const apr_array_header_t *merge_options; + /* Array of file extension patterns to preserve as extensions in + generated conflict files. */ + const apr_array_header_t *ext_patterns; + /* RA sessions used throughout a merge operation. Opened/re-parented as needed. @@ -2023,17 +2027,36 @@ merge_file_changed(const char *relpath, { svn_boolean_t has_local_mods; enum svn_wc_merge_outcome_t content_outcome; + const char *target_label; + const char *left_label; + const char *right_label; + const char *path_ext = ""; + + if (merge_b->ext_patterns && merge_b->ext_patterns->nelts) + { + svn_path_splitext(NULL, &path_ext, local_abspath, scratch_pool); + if (! (*path_ext + && svn_cstring_match_glob_list(path_ext, + merge_b->ext_patterns))) + { + path_ext = ""; + } + } /* xgettext: the '.working', '.merge-left.r%ld' and '.merge-right.r%ld' strings are used to tag onto a file name in case of a merge conflict */ - const char *target_label = _(".working"); - const char *left_label = apr_psprintf(scratch_pool, - _(".merge-left.r%ld"), - left_source->revision); - const char *right_label = apr_psprintf(scratch_pool, - _(".merge-right.r%ld"), - right_source->revision); + + target_label = apr_psprintf(scratch_pool, _(".working%s%s"), + *path_ext ? "." : "", path_ext); + left_label = apr_psprintf(scratch_pool, + _(".merge-left.r%ld%s%s"), + left_source->revision, + *path_ext ? "." : "", path_ext); + right_label = apr_psprintf(scratch_pool, + _(".merge-right.r%ld%s%s"), + right_source->revision, + *path_ext ? "." : "", path_ext); SVN_ERR(svn_wc_text_modified_p2(&has_local_mods, ctx->wc_ctx, local_abspath, FALSE, scratch_pool)); @@ -3062,7 +3085,6 @@ merge_dir_deleted(const char *relpath, struct merge_dir_baton_t *db = dir_baton; const char *local_abspath = svn_dirent_join(merge_b->target->abspath, relpath, scratch_pool); - struct dir_delete_baton_t *delb; svn_boolean_t same; apr_hash_t *working_props; @@ -3093,66 +3115,69 @@ merge_dir_deleted(const char *relpath, scratch_pool, scratch_pool)); if (merge_b->force_delete) - same = TRUE; + { + /* In this legacy mode we just assume that a directory delete + matches any directory. db->delete_state is NULL */ + same = TRUE; + } else { + struct dir_delete_baton_t *delb; + /* Compare the properties */ SVN_ERR(properties_same_p(&same, left_props, working_props, scratch_pool)); - } + delb = db->delete_state; + assert(delb != NULL); - delb = db->delete_state; - assert(delb != NULL); - - if (! same) - { - delb->found_edit = TRUE; - } - else - { - store_path(delb->compared_abspaths, local_abspath); - } - - if (delb->del_root != db) - return SVN_NO_ERROR; - - if (delb->found_edit) - same = FALSE; - else if (merge_b->force_delete) - same = TRUE; - else - { - apr_array_header_t *ignores; - svn_error_t *err; - same = TRUE; - - SVN_ERR(svn_wc_get_default_ignores(&ignores, merge_b->ctx->config, - scratch_pool)); - - /* None of the descendants was modified, but maybe there are - descendants we haven't walked? - - Note that we aren't interested in changes, as we already verified - changes in the paths touched by the merge. And the existance of - other paths is enough to mark the directory edited */ - err = svn_wc_walk_status(merge_b->ctx->wc_ctx, local_abspath, - svn_depth_infinity, TRUE /* get-all */, - FALSE /* no-ignore */, - TRUE /* ignore-text-mods */, ignores, - verify_touched_by_del_check, delb, - merge_b->ctx->cancel_func, - merge_b->ctx->cancel_baton, - scratch_pool); - - if (err) + if (! same) { - if (err->apr_err != SVN_ERR_CEASE_INVOCATION) - return svn_error_trace(err); - - svn_error_clear(err); + delb->found_edit = TRUE; + } + else + { + store_path(delb->compared_abspaths, local_abspath); } - same = ! delb->found_edit; + if (delb->del_root != db) + return SVN_NO_ERROR; + + if (delb->found_edit) + same = FALSE; + else + { + apr_array_header_t *ignores; + svn_error_t *err; + same = TRUE; + + SVN_ERR(svn_wc_get_default_ignores(&ignores, merge_b->ctx->config, + scratch_pool)); + + /* None of the descendants was modified, but maybe there are + descendants we haven't walked? + + Note that we aren't interested in changes, as we already verified + changes in the paths touched by the merge. And the existence of + other paths is enough to mark the directory edited */ + err = svn_wc_walk_status(merge_b->ctx->wc_ctx, local_abspath, + svn_depth_infinity, TRUE /* get-all */, + FALSE /* no-ignore */, + TRUE /* ignore-text-mods */, ignores, + verify_touched_by_del_check, delb, + merge_b->ctx->cancel_func, + merge_b->ctx->cancel_baton, + scratch_pool); + + if (err) + { + if (err->apr_err != SVN_ERR_CEASE_INVOCATION) + return svn_error_trace(err); + + svn_error_clear(err); + } + + same = ! delb->found_edit; + } } if (same && !merge_b->dry_run) @@ -9668,6 +9693,7 @@ do_merge(apr_hash_t **modified_subtrees, merge_cmd_baton_t merge_cmd_baton = { 0 }; svn_config_t *cfg; const char *diff3_cmd; + const char *preserved_exts_str; int i; svn_boolean_t checked_mergeinfo_capability = FALSE; svn_ra_session_t *ra_session1 = NULL, *ra_session2 = NULL; @@ -9728,6 +9754,11 @@ do_merge(apr_hash_t **modified_subtrees, if (diff3_cmd != NULL) SVN_ERR(svn_path_cstring_to_utf8(&diff3_cmd, diff3_cmd, scratch_pool)); + /* See which files the user wants to preserve the extension of when + conflict files are made. */ + svn_config_get(cfg, &preserved_exts_str, SVN_CONFIG_SECTION_MISCELLANY, + SVN_CONFIG_OPTION_PRESERVED_CF_EXTS, ""); + /* Build the merge context baton (or at least the parts of it that don't need to be reset for each merge source). */ merge_cmd_baton.force_delete = force_delete; @@ -9743,6 +9774,11 @@ do_merge(apr_hash_t **modified_subtrees, merge_cmd_baton.pool = iterpool; merge_cmd_baton.merge_options = merge_options; merge_cmd_baton.diff3_cmd = diff3_cmd; + merge_cmd_baton.ext_patterns = *preserved_exts_str + ? svn_cstring_split(preserved_exts_str, "\n\r\t\v ", + FALSE, scratch_pool) + : NULL; + merge_cmd_baton.use_sleep = use_sleep; /* Do we already know the specific subtrees with mergeinfo we want @@ -10447,15 +10483,10 @@ merge_locked(conflict_report_t **conflict_report, } else { - merge_source_t source; - - source.loc1 = source1_loc; - source.loc2 = source2_loc; - source.ancestral = FALSE; - /* Build a single-item merge_source_t array. */ merge_sources = apr_array_make(scratch_pool, 1, sizeof(merge_source_t *)); - APR_ARRAY_PUSH(merge_sources, merge_source_t *) = &source; + APR_ARRAY_PUSH(merge_sources, merge_source_t *) + = merge_source_create(source1_loc, source2_loc, FALSE, scratch_pool); } err = do_merge(NULL, NULL, conflict_report, &use_sleep, @@ -10761,7 +10792,7 @@ log_find_operative_revs(void *baton, UNMERGED_CATALOG represents the history (as mergeinfo) from TARGET_LOC that is not represented in SOURCE_LOC's explicit/inherited mergeinfo as represented by MERGED_CATALOG. - MERGEINFO_CATALOG may be empty if the source has no explicit or inherited + MERGED_CATALOG may be empty if the source has no explicit or inherited mergeinfo. Check that all of the unmerged revisions in UNMERGED_CATALOG's @@ -11464,7 +11495,7 @@ find_reintegrate_merge(merge_source_t **source_p, prefix. */ svn_mergeinfo_catalog_t final_unmerged_catalog = apr_hash_make(scratch_pool); - SVN_ERR(find_unsynced_ranges(source_loc, yc_ancestor, + SVN_ERR(find_unsynced_ranges(source_loc, &target->loc, unmerged_to_source_mergeinfo_catalog, merged_to_source_mergeinfo_catalog, final_unmerged_catalog, diff --git a/contrib/subversion/subversion/libsvn_client/prop_commands.c b/contrib/subversion/subversion/libsvn_client/prop_commands.c index a3e59c86681..06c4d21dc1e 100644 --- a/contrib/subversion/subversion/libsvn_client/prop_commands.c +++ b/contrib/subversion/subversion/libsvn_client/prop_commands.c @@ -890,8 +890,14 @@ svn_client_propget5(apr_hash_t **props, const char *copy_root_abspath; svn_boolean_t is_copy; - SVN_ERR(svn_dirent_get_absolute(&local_abspath, target, - scratch_pool)); + /* Avoid assertion on the next line when somebody accidentally asks for + a working copy revision on a URL */ + if (svn_path_is_url(target)) + return svn_error_create(SVN_ERR_CLIENT_VERSIONED_PATH_REQUIRED, + NULL, NULL); + + SVN_ERR_ASSERT(svn_dirent_is_absolute(target)); + local_abspath = target; if (SVN_CLIENT__REVKIND_NEEDS_WC(peg_revision->kind)) { @@ -1232,7 +1238,7 @@ recursive_proplist_receiver(void *baton, Report iprops anyway */ SVN_ERR(b->wrapped_receiver(b->wrapped_receiver_baton, - b->anchor ? b->anchor : local_abspath, + b->anchor ? b->anchor : b->anchor_abspath, NULL /* prop_hash */, b->iprops, scratch_pool)); @@ -1293,6 +1299,12 @@ get_remote_props(const char *path_or_url, const char *copy_root_abspath; svn_boolean_t is_copy; + /* Avoid assertion on the next line when somebody accidentally asks for + a working copy revision on a URL */ + if (svn_path_is_url(path_or_url)) + return svn_error_create(SVN_ERR_CLIENT_VERSIONED_PATH_REQUIRED, + NULL, NULL); + SVN_ERR(svn_dirent_get_absolute(&local_abspath, path_or_url, scratch_pool)); diff --git a/contrib/subversion/subversion/libsvn_delta/svndiff.c b/contrib/subversion/subversion/libsvn_delta/svndiff.c index f4b9dc68666..b9cb2851511 100644 --- a/contrib/subversion/subversion/libsvn_delta/svndiff.c +++ b/contrib/subversion/subversion/libsvn_delta/svndiff.c @@ -723,8 +723,6 @@ decode_window(svn_txdelta_window_t *window, svn_filesize_t sview_offset, svn_stringbuf_t *instout = svn_stringbuf_create_empty(pool); svn_stringbuf_t *ndout = svn_stringbuf_create_empty(pool); - /* these may in fact simply return references to insend */ - SVN_ERR(zlib_decode(insend, newlen, ndout, SVN_DELTA_WINDOW_SIZE)); SVN_ERR(zlib_decode(data, insend - data, instout, @@ -739,7 +737,13 @@ decode_window(svn_txdelta_window_t *window, svn_filesize_t sview_offset, } else { - new_data->data = (const char *) insend; + /* Copy the data because an svn_string_t must have the invariant + data[len]=='\0'. */ + char *buf = apr_palloc(pool, newlen + 1); + + memcpy(buf, insend, newlen); + buf[newlen] = '\0'; + new_data->data = buf; new_data->len = newlen; } diff --git a/contrib/subversion/subversion/libsvn_fs_fs/fs.c b/contrib/subversion/subversion/libsvn_fs_fs/fs.c index 691f416d374..d0ba7342a0b 100644 --- a/contrib/subversion/subversion/libsvn_fs_fs/fs.c +++ b/contrib/subversion/subversion/libsvn_fs_fs/fs.c @@ -98,8 +98,11 @@ fs_serialized_init(svn_fs_t *fs, apr_pool_t *common_pool, apr_pool_t *pool) SVN_ERR(svn_mutex__init(&ffsd->txn_current_lock, SVN_FS_FS__USE_LOCK_MUTEX, common_pool)); + /* We also need a mutex for synchronizing access to the active + transaction list and free transaction pointer. This one is + enabled unconditionally. */ SVN_ERR(svn_mutex__init(&ffsd->txn_list_lock, - SVN_FS_FS__USE_LOCK_MUTEX, common_pool)); + TRUE, common_pool)); key = apr_pstrdup(common_pool, key); status = apr_pool_userdata_set(ffsd, key, NULL, common_pool); diff --git a/contrib/subversion/subversion/libsvn_fs_fs/fs.h b/contrib/subversion/subversion/libsvn_fs_fs/fs.h index ea301f6f5e7..5cdc27033fa 100644 --- a/contrib/subversion/subversion/libsvn_fs_fs/fs.h +++ b/contrib/subversion/subversion/libsvn_fs_fs/fs.h @@ -266,7 +266,7 @@ typedef struct fs_fs_data_t svn_cache__t *dir_cache; /* Fulltext cache; currently only used with memcached. Maps from - rep key (revision/offset) to svn_string_t. */ + rep key (revision/offset) to svn_stringbuf_t. */ svn_cache__t *fulltext_cache; /* Access object to the atomics namespace used by revprop caching. diff --git a/contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.h b/contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.h index b02b052c562..5e151078480 100644 --- a/contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.h +++ b/contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.h @@ -1,4 +1,4 @@ -/* This file is automatically generated from rep-cache-db.sql and .dist_sandbox/subversion-1.8.8/subversion/libsvn_fs_fs/token-map.h. +/* This file is automatically generated from rep-cache-db.sql and .dist_sandbox/subversion-1.8.9/subversion/libsvn_fs_fs/token-map.h. * Do not edit this file -- edit the source and rerun gen-make.py */ #define STMT_CREATE_SCHEMA 0 diff --git a/contrib/subversion/subversion/libsvn_ra_serf/getlocks.c b/contrib/subversion/subversion/libsvn_ra_serf/getlocks.c index 04e55617993..df201a7506f 100644 --- a/contrib/subversion/subversion/libsvn_ra_serf/getlocks.c +++ b/contrib/subversion/subversion/libsvn_ra_serf/getlocks.c @@ -116,6 +116,7 @@ getlocks_closed(svn_ra_serf__xml_estate_t *xes, if (leaving_state == LOCK) { const char *path = svn_hash_gets(attrs, "path"); + const char *token = svn_hash_gets(attrs, "token"); svn_boolean_t save_lock = FALSE; /* Filter out unwanted paths. Since Subversion only allows @@ -128,6 +129,12 @@ getlocks_closed(svn_ra_serf__xml_estate_t *xes, c) we've asked for depth=files or depth=immediates, and this lock is on an immediate child of our query path. */ + if (! token) + { + /* A lock without a token is not a lock; just an answer that there + is no lock on the node. */ + save_lock = FALSE; + } if (strcmp(lock_ctx->path, path) == 0 || lock_ctx->requested_depth == svn_depth_infinity) { @@ -154,7 +161,7 @@ getlocks_closed(svn_ra_serf__xml_estate_t *xes, them may have not been sent, so the value will be NULL. */ lock.path = path; - lock.token = svn_hash_gets(attrs, "token"); + lock.token = token; lock.owner = svn_hash_gets(attrs, "owner"); lock.comment = svn_hash_gets(attrs, "comment"); @@ -234,6 +241,7 @@ svn_ra_serf__get_locks(svn_ra_session_t *ra_session, svn_ra_serf__handler_t *handler; svn_ra_serf__xml_context_t *xmlctx; const char *req_url, *rel_path; + svn_error_t *err; req_url = svn_path_url_add_component2(session->session_url.path, path, pool); SVN_ERR(svn_ra_serf__get_relative_path(&rel_path, req_url, session, @@ -260,7 +268,14 @@ svn_ra_serf__get_locks(svn_ra_session_t *ra_session, handler->body_delegate = create_getlocks_body; handler->body_delegate_baton = lock_ctx; - SVN_ERR(svn_ra_serf__context_run_one(handler, pool)); + err = svn_ra_serf__context_run_one(handler, pool); + + /* Wrap the server generated error for an unsupported report with the + documented error for this ra function. */ + if (svn_error_find_cause(err, SVN_ERR_UNSUPPORTED_FEATURE)) + err = svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, err, NULL); + + SVN_ERR(err); /* We get a 404 when a path doesn't exist in HEAD, but it might have existed earlier (E.g. 'svn ls http://s/svn/trunk/file@1' */ diff --git a/contrib/subversion/subversion/libsvn_ra_serf/inherited_props.c b/contrib/subversion/subversion/libsvn_ra_serf/inherited_props.c index 54eae0b5be7..f1172e7b681 100644 --- a/contrib/subversion/subversion/libsvn_ra_serf/inherited_props.c +++ b/contrib/subversion/subversion/libsvn_ra_serf/inherited_props.c @@ -41,7 +41,7 @@ /* The current state of our XML parsing. */ typedef enum iprops_state_e { - NONE = 0, + INITIAL = 0, IPROPS_REPORT, IPROPS_ITEM, IPROPS_PATH, @@ -61,18 +61,12 @@ typedef struct iprops_context_t { /* The repository's root URL. */ const char *repos_root_url; - /* Current CDATA values*/ - svn_stringbuf_t *curr_path; + /* Current property name */ svn_stringbuf_t *curr_propname; - svn_stringbuf_t *curr_propval; - const char *curr_prop_val_encoding; /* Current element in IPROPS. */ svn_prop_inherited_item_t *curr_iprop; - /* Serf context completion flag for svn_ra_serf__context_run_wait() */ - svn_boolean_t done; - /* Path we are finding inherited properties for. This is relative to the RA session passed to svn_ra_serf__get_inherited_props. */ const char *path; @@ -80,162 +74,121 @@ typedef struct iprops_context_t { svn_revnum_t revision; } iprops_context_t; +#define S_ SVN_XML_NAMESPACE +static const svn_ra_serf__xml_transition_t iprops_table[] = { + { INITIAL, S_, SVN_DAV__INHERITED_PROPS_REPORT, IPROPS_REPORT, + FALSE, { NULL }, FALSE }, + + { IPROPS_REPORT, S_, SVN_DAV__IPROP_ITEM, IPROPS_ITEM, + FALSE, { NULL }, TRUE }, + + { IPROPS_ITEM, S_, SVN_DAV__IPROP_PATH, IPROPS_PATH, + TRUE, { NULL }, TRUE }, + + { IPROPS_ITEM, S_, SVN_DAV__IPROP_PROPNAME, IPROPS_PROPNAME, + TRUE, { NULL }, TRUE }, + + { IPROPS_ITEM, S_, SVN_DAV__IPROP_PROPVAL, IPROPS_PROPVAL, + TRUE, { "?V:encoding", NULL }, TRUE }, + + { 0 } +}; + +/* Conforms to svn_ra_serf__xml_opened_t */ static svn_error_t * -start_element(svn_ra_serf__xml_parser_t *parser, - svn_ra_serf__dav_props_t name, - const char **attrs, +iprops_opened(svn_ra_serf__xml_estate_t *xes, + void *baton, + int entered_state, + const svn_ra_serf__dav_props_t *tag, apr_pool_t *scratch_pool) { - iprops_context_t *iprops_ctx = parser->user_data; - iprops_state_e state; + iprops_context_t *iprops_ctx = baton; - state = parser->state->current_state; - if (state == NONE - && strcmp(name.name, SVN_DAV__INHERITED_PROPS_REPORT) == 0) + if (entered_state == IPROPS_ITEM) { - svn_ra_serf__xml_push_state(parser, IPROPS_REPORT); - } - else if (state == IPROPS_REPORT && - strcmp(name.name, SVN_DAV__IPROP_ITEM) == 0) - { - svn_stringbuf_setempty(iprops_ctx->curr_path); svn_stringbuf_setempty(iprops_ctx->curr_propname); - svn_stringbuf_setempty(iprops_ctx->curr_propval); - iprops_ctx->curr_prop_val_encoding = NULL; - iprops_ctx->curr_iprop = NULL; - svn_ra_serf__xml_push_state(parser, IPROPS_ITEM); - } - else if (state == IPROPS_ITEM && - strcmp(name.name, SVN_DAV__IPROP_PROPVAL) == 0) - { - const char *prop_val_encoding = svn_xml_get_attr_value("encoding", - attrs); - iprops_ctx->curr_prop_val_encoding = apr_pstrdup(iprops_ctx->pool, - prop_val_encoding); - svn_ra_serf__xml_push_state(parser, IPROPS_PROPVAL); - } - else if (state == IPROPS_ITEM && - strcmp(name.name, SVN_DAV__IPROP_PATH) == 0) - { - svn_ra_serf__xml_push_state(parser, IPROPS_PATH); - } - else if (state == IPROPS_ITEM && - strcmp(name.name, SVN_DAV__IPROP_PROPNAME) == 0) - { - svn_ra_serf__xml_push_state(parser, IPROPS_PROPNAME); - } - else if (state == IPROPS_ITEM && - strcmp(name.name, SVN_DAV__IPROP_PROPVAL) == 0) - { - svn_ra_serf__xml_push_state(parser, IPROPS_PROPVAL); - } + iprops_ctx->curr_iprop = apr_pcalloc(iprops_ctx->pool, + sizeof(*iprops_ctx->curr_iprop)); + + iprops_ctx->curr_iprop->prop_hash = apr_hash_make(iprops_ctx->pool); + } return SVN_NO_ERROR; } +/* Conforms to svn_ra_serf__xml_closed_t */ static svn_error_t * -end_element(svn_ra_serf__xml_parser_t *parser, - svn_ra_serf__dav_props_t name, - apr_pool_t *scratch_pool) +iprops_closed(svn_ra_serf__xml_estate_t *xes, + void *baton, + int leaving_state, + const svn_string_t *cdata, + apr_hash_t *attrs, + apr_pool_t *scratch_pool) { - iprops_context_t *iprops_ctx = parser->user_data; - iprops_state_e state; + iprops_context_t *iprops_ctx = baton; - state = parser->state->current_state; - - if (state == IPROPS_REPORT && - strcmp(name.name, SVN_DAV__INHERITED_PROPS_REPORT) == 0) + if (leaving_state == IPROPS_ITEM) { - svn_ra_serf__xml_pop_state(parser); + APR_ARRAY_PUSH(iprops_ctx->iprops, svn_prop_inherited_item_t *) = + iprops_ctx->curr_iprop; + + iprops_ctx->curr_iprop = NULL; } - else if (state == IPROPS_PATH - && strcmp(name.name, SVN_DAV__IPROP_PATH) == 0) + else if (leaving_state == IPROPS_PATH) { - iprops_ctx->curr_iprop = apr_palloc( - iprops_ctx->pool, sizeof(svn_prop_inherited_item_t)); + /* Every has a single */ + if (iprops_ctx->curr_iprop->path_or_url) + return svn_error_create(SVN_ERR_XML_MALFORMED, NULL, NULL); iprops_ctx->curr_iprop->path_or_url = svn_path_url_add_component2(iprops_ctx->repos_root_url, - iprops_ctx->curr_path->data, + cdata->data, iprops_ctx->pool); - iprops_ctx->curr_iprop->prop_hash = apr_hash_make(iprops_ctx->pool); - svn_ra_serf__xml_pop_state(parser); } - else if (state == IPROPS_PROPVAL - && strcmp(name.name, SVN_DAV__IPROP_PROPVAL) == 0) + else if (leaving_state == IPROPS_PROPNAME) { - const svn_string_t *prop_val; + if (iprops_ctx->curr_propname->len) + return svn_error_create(SVN_ERR_XML_MALFORMED, NULL, NULL); - if (iprops_ctx->curr_prop_val_encoding) + /* Store propname for value */ + svn_stringbuf_set(iprops_ctx->curr_propname, cdata->data); + } + else if (leaving_state == IPROPS_PROPVAL) + { + const char *encoding; + const svn_string_t *val_str; + + if (! iprops_ctx->curr_propname->len) + return svn_error_create(SVN_ERR_XML_MALFORMED, NULL, NULL); + + encoding = svn_hash_gets(attrs, "V:encoding"); + + if (encoding) { - svn_string_t encoded_prop_val; + if (strcmp(encoding, "base64") != 0) + return svn_error_createf(SVN_ERR_XML_MALFORMED, + NULL, + _("Got unrecognized encoding '%s'"), + encoding); - if (strcmp(iprops_ctx->curr_prop_val_encoding, "base64") != 0) - return svn_error_create(SVN_ERR_XML_MALFORMED, NULL, NULL); - - encoded_prop_val.data = iprops_ctx->curr_propval->data; - encoded_prop_val.len = iprops_ctx->curr_propval->len; - prop_val = svn_base64_decode_string(&encoded_prop_val, - iprops_ctx->pool); + /* Decode into the right pool. */ + val_str = svn_base64_decode_string(cdata, iprops_ctx->pool); } else { - prop_val = svn_string_create_from_buf(iprops_ctx->curr_propval, - iprops_ctx->pool); + /* Copy into the right pool. */ + val_str = svn_string_dup(cdata, iprops_ctx->pool); } svn_hash_sets(iprops_ctx->curr_iprop->prop_hash, apr_pstrdup(iprops_ctx->pool, iprops_ctx->curr_propname->data), - prop_val); - /* Clear current propname and propval in the event there are - multiple properties on the current path. */ + val_str); + /* Clear current propname. */ svn_stringbuf_setempty(iprops_ctx->curr_propname); - svn_stringbuf_setempty(iprops_ctx->curr_propval); - svn_ra_serf__xml_pop_state(parser); - } - else if (state == IPROPS_PROPNAME - && strcmp(name.name, SVN_DAV__IPROP_PROPNAME) == 0) - { - svn_ra_serf__xml_pop_state(parser); - } - else if (state == IPROPS_ITEM - && strcmp(name.name, SVN_DAV__IPROP_ITEM) == 0) - { - APR_ARRAY_PUSH(iprops_ctx->iprops, svn_prop_inherited_item_t *) = - iprops_ctx->curr_iprop; - svn_ra_serf__xml_pop_state(parser); - } - return SVN_NO_ERROR; -} - - -static svn_error_t * -cdata_handler(svn_ra_serf__xml_parser_t *parser, - const char *data, - apr_size_t len, - apr_pool_t *scratch_pool) -{ - iprops_context_t *iprops_ctx = parser->user_data; - iprops_state_e state = parser->state->current_state; - - switch (state) - { - case IPROPS_PATH: - svn_stringbuf_appendbytes(iprops_ctx->curr_path, data, len); - break; - - case IPROPS_PROPNAME: - svn_stringbuf_appendbytes(iprops_ctx->curr_propname, data, len); - break; - - case IPROPS_PROPVAL: - svn_stringbuf_appendbytes(iprops_ctx->curr_propval, data, len); - break; - - default: - break; } + else + SVN_ERR_MALFUNCTION(); /* Invalid transition table */ return SVN_NO_ERROR; } @@ -281,7 +234,7 @@ svn_ra_serf__get_inherited_props(svn_ra_session_t *ra_session, iprops_context_t *iprops_ctx; svn_ra_serf__session_t *session = ra_session->priv; svn_ra_serf__handler_t *handler; - svn_ra_serf__xml_parser_t *parser_ctx; + svn_ra_serf__xml_context_t *xmlctx; const char *req_url; SVN_ERR(svn_ra_serf__get_stable_url(&req_url, @@ -295,19 +248,20 @@ svn_ra_serf__get_inherited_props(svn_ra_session_t *ra_session, SVN_ERR_ASSERT(session->repos_root_str); iprops_ctx = apr_pcalloc(scratch_pool, sizeof(*iprops_ctx)); - iprops_ctx->done = FALSE; iprops_ctx->repos_root_url = session->repos_root_str; iprops_ctx->pool = result_pool; - iprops_ctx->curr_path = svn_stringbuf_create_empty(scratch_pool); iprops_ctx->curr_propname = svn_stringbuf_create_empty(scratch_pool); - iprops_ctx->curr_propval = svn_stringbuf_create_empty(scratch_pool); iprops_ctx->curr_iprop = NULL; iprops_ctx->iprops = apr_array_make(result_pool, 1, sizeof(svn_prop_inherited_item_t *)); iprops_ctx->path = path; iprops_ctx->revision = revision; - handler = apr_pcalloc(scratch_pool, sizeof(*handler)); + xmlctx = svn_ra_serf__xml_context_create(iprops_table, + iprops_opened, iprops_closed, NULL, + iprops_ctx, + scratch_pool); + handler = svn_ra_serf__create_expat_handler(xmlctx, scratch_pool); handler->method = "REPORT"; handler->path = req_url; @@ -318,18 +272,6 @@ svn_ra_serf__get_inherited_props(svn_ra_session_t *ra_session, handler->body_type = "text/xml"; handler->handler_pool = scratch_pool; - parser_ctx = apr_pcalloc(scratch_pool, sizeof(*parser_ctx)); - - parser_ctx->pool = scratch_pool; - parser_ctx->user_data = iprops_ctx; - parser_ctx->start = start_element; - parser_ctx->end = end_element; - parser_ctx->cdata = cdata_handler; - parser_ctx->done = &iprops_ctx->done; - - handler->response_handler = svn_ra_serf__handle_xml_parser; - handler->response_baton = parser_ctx; - err = svn_ra_serf__context_run_one(handler, scratch_pool); SVN_ERR(svn_error_compose_create( svn_ra_serf__error_on_status(handler->sline, @@ -337,8 +279,7 @@ svn_ra_serf__get_inherited_props(svn_ra_session_t *ra_session, handler->location), err)); - if (iprops_ctx->done) - *iprops = iprops_ctx->iprops; + *iprops = iprops_ctx->iprops; return SVN_NO_ERROR; } diff --git a/contrib/subversion/subversion/libsvn_ra_serf/locks.c b/contrib/subversion/subversion/libsvn_ra_serf/locks.c index db2d37125a0..252c30182a5 100644 --- a/contrib/subversion/subversion/libsvn_ra_serf/locks.c +++ b/contrib/subversion/subversion/libsvn_ra_serf/locks.c @@ -156,11 +156,20 @@ locks_closed(svn_ra_serf__xml_estate_t *xes, if (leaving_state == TIMEOUT) { - if (strcmp(cdata->data, "Infinite") == 0) + if (strcasecmp(cdata->data, "Infinite") == 0) lock_ctx->lock->expiration_date = 0; + else if (strncasecmp(cdata->data, "Second-", 7) == 0) + { + unsigned n; + SVN_ERR(svn_cstring_atoui(&n, cdata->data+7)); + + lock_ctx->lock->expiration_date = apr_time_now() + + apr_time_from_sec(n); + } else - SVN_ERR(svn_time_from_cstring(&lock_ctx->lock->creation_date, - cdata->data, lock_ctx->pool)); + return svn_error_createf(SVN_ERR_RA_DAV_MALFORMED_DATA, NULL, + _("Invalid LOCK timeout value '%s'"), + cdata->data); } else if (leaving_state == HREF) { @@ -362,29 +371,30 @@ svn_error_t * svn_ra_serf__get_lock(svn_ra_session_t *ra_session, svn_lock_t **lock, const char *path, - apr_pool_t *pool) + apr_pool_t *result_pool) { svn_ra_serf__session_t *session = ra_session->priv; svn_ra_serf__handler_t *handler; svn_ra_serf__xml_context_t *xmlctx; + apr_pool_t *scratch_pool = svn_pool_create(result_pool); lock_info_t *lock_ctx; const char *req_url; svn_error_t *err; - req_url = svn_path_url_add_component2(session->session_url.path, path, pool); + req_url = svn_path_url_add_component2(session->session_url.path, path, + scratch_pool); - lock_ctx = apr_pcalloc(pool, sizeof(*lock_ctx)); - - lock_ctx->pool = pool; + lock_ctx = apr_pcalloc(scratch_pool, sizeof(*lock_ctx)); + lock_ctx->pool = result_pool; lock_ctx->path = req_url; - lock_ctx->lock = svn_lock_create(pool); - lock_ctx->lock->path = apr_pstrdup(pool, path); /* be sure */ + lock_ctx->lock = svn_lock_create(result_pool); + lock_ctx->lock->path = apr_pstrdup(result_pool, path); xmlctx = svn_ra_serf__xml_context_create(locks_ttable, NULL, locks_closed, NULL, lock_ctx, - pool); - handler = svn_ra_serf__create_expat_handler(xmlctx, pool); + scratch_pool); + handler = svn_ra_serf__create_expat_handler(xmlctx, scratch_pool); handler->method = "PROPFIND"; handler->path = req_url; @@ -405,7 +415,7 @@ svn_ra_serf__get_lock(svn_ra_session_t *ra_session, lock_ctx->handler = handler; - err = svn_ra_serf__context_run_one(handler, pool); + err = svn_ra_serf__context_run_one(handler, scratch_pool); err = determine_error(handler, err); if (handler->sline.code == 404) @@ -420,7 +430,12 @@ svn_ra_serf__get_lock(svn_ra_session_t *ra_session, _("Server does not support locking features")); } - *lock = lock_ctx->lock; + if (lock_ctx->lock && lock_ctx->lock->token) + *lock = lock_ctx->lock; + else + *lock = NULL; + + svn_pool_destroy(scratch_pool); return SVN_NO_ERROR; } @@ -574,7 +589,7 @@ svn_ra_serf__unlock(svn_ra_session_t *ra_session, { SVN_ERR(svn_ra_serf__get_lock(ra_session, &existing_lock, path, iterpool)); - token = existing_lock->token; + token = existing_lock ? existing_lock->token : NULL; if (!token) { err = svn_error_createf(SVN_ERR_RA_NOT_LOCKED, NULL, diff --git a/contrib/subversion/subversion/libsvn_ra_serf/log.c b/contrib/subversion/subversion/libsvn_ra_serf/log.c index 58a57d890ee..02f2f2995e5 100644 --- a/contrib/subversion/subversion/libsvn_ra_serf/log.c +++ b/contrib/subversion/subversion/libsvn_ra_serf/log.c @@ -571,7 +571,7 @@ svn_ra_serf__get_log(svn_ra_session_t *ra_session, /* At this point, we may have a deleted file. So, we'll match ra_neon's * behavior and use the larger of start or end as our 'peg' rev. */ - peg_rev = (start > end) ? start : end; + peg_rev = (start == SVN_INVALID_REVNUM || start > end) ? start : end; SVN_ERR(svn_ra_serf__get_stable_url(&req_url, NULL /* latest_revnum */, session, NULL /* conn */, diff --git a/contrib/subversion/subversion/libsvn_ra_serf/update.c b/contrib/subversion/subversion/libsvn_ra_serf/update.c index 06a16c06eff..88488ff206f 100644 --- a/contrib/subversion/subversion/libsvn_ra_serf/update.c +++ b/contrib/subversion/subversion/libsvn_ra_serf/update.c @@ -329,9 +329,6 @@ struct report_context_t { files/dirs? */ svn_boolean_t add_props_included; - /* Path -> lock token mapping. */ - apr_hash_t *lock_path_tokens; - /* Path -> const char *repos_relpath mapping */ apr_hash_t *switched_paths; @@ -2248,8 +2245,6 @@ end_report(svn_ra_serf__xml_parser_t *parser, info->pool); } - info->lock_token = svn_hash_gets(ctx->lock_path_tokens, info->name); - if (info->lock_token && !info->fetch_props) info->fetch_props = TRUE; @@ -2578,13 +2573,6 @@ set_path(void *report_baton, SVN_ERR(svn_io_file_write_full(report->body_file, buf->data, buf->len, NULL, pool)); - if (lock_token) - { - svn_hash_sets(report->lock_path_tokens, - apr_pstrdup(report->pool, path), - apr_pstrdup(report->pool, lock_token)); - } - return SVN_NO_ERROR; } @@ -2660,12 +2648,6 @@ link_path(void *report_baton, if (!*path) report->root_is_switched = TRUE; - if (lock_token) - { - svn_hash_sets(report->lock_path_tokens, - path, apr_pstrdup(report->pool, lock_token)); - } - return APR_SUCCESS; } @@ -3193,7 +3175,6 @@ make_update_reporter(svn_ra_session_t *ra_session, report->ignore_ancestry = ignore_ancestry; report->send_copyfrom_args = send_copyfrom_args; report->text_deltas = text_deltas; - report->lock_path_tokens = apr_hash_make(report->pool); report->switched_paths = apr_hash_make(report->pool); report->source = src_path; diff --git a/contrib/subversion/subversion/libsvn_ra_svn/protocol b/contrib/subversion/subversion/libsvn_ra_svn/protocol index d056b74a513..4d98b2bb19d 100644 --- a/contrib/subversion/subversion/libsvn_ra_svn/protocol +++ b/contrib/subversion/subversion/libsvn_ra_svn/protocol @@ -310,6 +310,7 @@ second place for auth-request point as noted below. sends file contents as a series of strings, terminated by the empty string, followed by a second empty command response to indicate whether an error occurred during the sending of the file. + NOTE: the standard client never sends want-iprops, it uses get-iprops. get-dir params: ( path:string [ rev:number ] want-props:bool want-contents:bool @@ -321,6 +322,7 @@ second place for auth-request point as noted below. [ last-author:string ] ) dirent-field: kind | size | has-props | created-rev | time | last-author | word + NOTE: the standard client never sends want-iprops, it uses get-iprops. check-path params: ( path:string [ rev:number ] ) diff --git a/contrib/subversion/subversion/libsvn_repos/dump.c b/contrib/subversion/subversion/libsvn_repos/dump.c index 75843d7057a..a64b1809c7a 100644 --- a/contrib/subversion/subversion/libsvn_repos/dump.c +++ b/contrib/subversion/subversion/libsvn_repos/dump.c @@ -217,6 +217,49 @@ make_dir_baton(const char *path, } +/* If the mergeinfo in MERGEINFO_STR refers to any revisions older than + * OLDEST_DUMPED_REV, issue a warning and set *FOUND_OLD_MERGEINFO to TRUE, + * otherwise leave *FOUND_OLD_MERGEINFO unchanged. + */ +static svn_error_t * +verify_mergeinfo_revisions(svn_boolean_t *found_old_mergeinfo, + const char *mergeinfo_str, + svn_revnum_t oldest_dumped_rev, + svn_repos_notify_func_t notify_func, + void *notify_baton, + apr_pool_t *pool) +{ + svn_mergeinfo_t mergeinfo, old_mergeinfo; + + SVN_ERR(svn_mergeinfo_parse(&mergeinfo, mergeinfo_str, pool)); + SVN_ERR(svn_mergeinfo__filter_mergeinfo_by_ranges( + &old_mergeinfo, mergeinfo, + oldest_dumped_rev - 1, 0, + TRUE, pool, pool)); + + if (apr_hash_count(old_mergeinfo)) + { + svn_repos_notify_t *notify = + svn_repos_notify_create(svn_repos_notify_warning, pool); + + notify->warning = svn_repos_notify_warning_found_old_mergeinfo; + notify->warning_str = apr_psprintf( + pool, + _("Mergeinfo referencing revision(s) prior " + "to the oldest dumped revision (r%ld). " + "Loading this dump may result in invalid " + "mergeinfo."), + oldest_dumped_rev); + + if (found_old_mergeinfo) + *found_old_mergeinfo = TRUE; + notify_func(notify_baton, notify, pool); + } + + return SVN_NO_ERROR; +} + + /* This helper is the main "meat" of the editor -- it does all the work of writing a node record. @@ -475,32 +518,13 @@ dump_node(struct edit_baton *eb, SVN_PROP_MERGEINFO); if (mergeinfo_str) { - svn_mergeinfo_t mergeinfo, old_mergeinfo; - - SVN_ERR(svn_mergeinfo_parse(&mergeinfo, mergeinfo_str->data, - pool)); - SVN_ERR(svn_mergeinfo__filter_mergeinfo_by_ranges( - &old_mergeinfo, mergeinfo, - eb->oldest_dumped_rev - 1, 0, - TRUE, pool, pool)); - if (apr_hash_count(old_mergeinfo)) - { - svn_repos_notify_t *notify = - svn_repos_notify_create(svn_repos_notify_warning, pool); - - notify->warning = svn_repos_notify_warning_found_old_mergeinfo; - notify->warning_str = apr_psprintf( - pool, - _("Mergeinfo referencing revision(s) prior " - "to the oldest dumped revision (r%ld). " - "Loading this dump may result in invalid " - "mergeinfo."), - eb->oldest_dumped_rev); - - if (eb->found_old_mergeinfo) - *eb->found_old_mergeinfo = TRUE; - eb->notify_func(eb->notify_baton, notify, pool); - } + /* An error in verifying the mergeinfo must not prevent dumping + the data. Ignore any such error. */ + svn_error_clear(verify_mergeinfo_revisions( + eb->found_old_mergeinfo, + mergeinfo_str->data, eb->oldest_dumped_rev, + eb->notify_func, eb->notify_baton, + pool)); } } diff --git a/contrib/subversion/subversion/libsvn_repos/fs-wrap.c b/contrib/subversion/subversion/libsvn_repos/fs-wrap.c index 755fa61bbb0..006b2861eb0 100644 --- a/contrib/subversion/subversion/libsvn_repos/fs-wrap.c +++ b/contrib/subversion/subversion/libsvn_repos/fs-wrap.c @@ -117,6 +117,8 @@ svn_repos_fs_begin_txn_for_commit2(svn_fs_txn_t **txn_p, const char *txn_name; svn_string_t *author = svn_hash_gets(revprop_table, SVN_PROP_REVISION_AUTHOR); apr_hash_t *hooks_env; + svn_error_t *err; + svn_fs_txn_t *txn; /* Parse the hooks-env file (if any). */ SVN_ERR(svn_repos__parse_hooks_env(&hooks_env, repos->hooks_env_path, @@ -124,21 +126,30 @@ svn_repos_fs_begin_txn_for_commit2(svn_fs_txn_t **txn_p, /* Begin the transaction, ask for the fs to do on-the-fly lock checks. We fetch its name, too, so the start-commit hook can use it. */ - SVN_ERR(svn_fs_begin_txn2(txn_p, repos->fs, rev, + SVN_ERR(svn_fs_begin_txn2(&txn, repos->fs, rev, SVN_FS_TXN_CHECK_LOCKS, pool)); - SVN_ERR(svn_fs_txn_name(&txn_name, *txn_p, pool)); + err = svn_fs_txn_name(&txn_name, txn, pool); + if (err) + return svn_error_compose_create(err, svn_fs_abort_txn(txn, pool)); /* We pass the revision properties to the filesystem by adding them as properties on the txn. Later, when we commit the txn, these properties will be copied into the newly created revision. */ revprops = svn_prop_hash_to_array(revprop_table, pool); - SVN_ERR(svn_repos_fs_change_txn_props(*txn_p, revprops, pool)); + err = svn_repos_fs_change_txn_props(txn, revprops, pool); + if (err) + return svn_error_compose_create(err, svn_fs_abort_txn(txn, pool)); /* Run start-commit hooks. */ - SVN_ERR(svn_repos__hooks_start_commit(repos, hooks_env, - author ? author->data : NULL, - repos->client_capabilities, txn_name, - pool)); + err = svn_repos__hooks_start_commit(repos, hooks_env, + author ? author->data : NULL, + repos->client_capabilities, txn_name, + pool); + if (err) + return svn_error_compose_create(err, svn_fs_abort_txn(txn, pool)); + + /* We have API promise that *TXN_P is unaffected on faulure. */ + *txn_p = txn; return SVN_NO_ERROR; } diff --git a/contrib/subversion/subversion/libsvn_subr/cache-memcache.c b/contrib/subversion/subversion/libsvn_subr/cache-memcache.c index 5332d04428e..500426d0ff1 100644 --- a/contrib/subversion/subversion/libsvn_subr/cache-memcache.c +++ b/contrib/subversion/subversion/libsvn_subr/cache-memcache.c @@ -203,9 +203,10 @@ memcache_get(void **value_p, } else { - svn_string_t *value = apr_pcalloc(result_pool, sizeof(*value)); + svn_stringbuf_t *value = svn_stringbuf_create_empty(result_pool); value->data = data; - value->len = data_len; + value->blocksize = data_len; + value->len = data_len - 1; /* account for trailing NUL */ *value_p = value; } } @@ -263,7 +264,7 @@ memcache_set(void *cache_void, { svn_stringbuf_t *value_str = value; data = value_str->data; - data_len = value_str->len; + data_len = value_str->len + 1; /* copy trailing NUL */ } err = memcache_internal_set(cache_void, key, data, data_len, subpool); diff --git a/contrib/subversion/subversion/libsvn_subr/config_file.c b/contrib/subversion/subversion/libsvn_subr/config_file.c index c705b14fd40..9969b8eb970 100644 --- a/contrib/subversion/subversion/libsvn_subr/config_file.c +++ b/contrib/subversion/subversion/libsvn_subr/config_file.c @@ -69,7 +69,7 @@ typedef struct parse_context_t /* Parser buffer for getc() to avoid call overhead into several libraries for every character */ - char parser_buffer[SVN_STREAM_CHUNK_SIZE]; /* Larger than most config files */ + char parser_buffer[SVN__STREAM_CHUNK_SIZE]; /* Larger than most config files */ size_t buffer_pos; /* Current position within parser_buffer */ size_t buffer_size; /* parser_buffer contains this many bytes */ } parse_context_t; diff --git a/contrib/subversion/subversion/libsvn_subr/internal_statements.h b/contrib/subversion/subversion/libsvn_subr/internal_statements.h index 84c616f38be..4fa938932ec 100644 --- a/contrib/subversion/subversion/libsvn_subr/internal_statements.h +++ b/contrib/subversion/subversion/libsvn_subr/internal_statements.h @@ -1,4 +1,4 @@ -/* This file is automatically generated from internal_statements.sql and .dist_sandbox/subversion-1.8.8/subversion/libsvn_subr/token-map.h. +/* This file is automatically generated from internal_statements.sql and .dist_sandbox/subversion-1.8.9/subversion/libsvn_subr/token-map.h. * Do not edit this file -- edit the source and rerun gen-make.py */ #define STMT_INTERNAL_SAVEPOINT_SVN 0 diff --git a/contrib/subversion/subversion/libsvn_subr/io.c b/contrib/subversion/subversion/libsvn_subr/io.c index f0956e2aa8e..08f2e326d7f 100644 --- a/contrib/subversion/subversion/libsvn_subr/io.c +++ b/contrib/subversion/subversion/libsvn_subr/io.c @@ -1243,32 +1243,44 @@ svn_io_sleep_for_timestamps(const char *path, apr_pool_t *pool) { /* Very simplistic but safe approach: If the filesystem has < sec mtime we can be reasonably sure - that the filesystem has <= millisecond precision. + that the filesystem has some sub-second resolution. On Windows + it is likely to be sub-millisecond; on Linux systems it depends + on the filesystem, ext4 is typically 1ms, 4ms or 10ms resolution. ## Perhaps find a better algorithm here. This will fail once - in every 1000 cases on a millisecond precision filesystem. + in every 1000 cases on a millisecond precision filesystem + if the mtime happens to be an exact second. But better to fail once in every thousand cases than every time, like we did before. - (All tested filesystems I know have at least microsecond precision.) Note for further research on algorithm: - FAT32 has < 1 sec precision on ctime, but 2 sec on mtime */ + FAT32 has < 1 sec precision on ctime, but 2 sec on mtime. - /* Sleep for at least 1 millisecond. - (t < 1000 will be round to 0 in apr) */ - apr_sleep(1000); + Linux/ext4 with CONFIG_HZ=250 has high resolution + apr_time_now and although the filesystem timestamps + have similar high precision they are only updated with + a coarser 4ms resolution. */ - return; + /* 10 milliseconds after now. */ +#ifndef SVN_HI_RES_SLEEP_MS +#define SVN_HI_RES_SLEEP_MS 10 +#endif + then = now + apr_time_from_msec(SVN_HI_RES_SLEEP_MS); } - now = apr_time_now(); /* Extract the time used for the path stat */ - - if (now >= then) - return; /* Passing negative values may suspend indefinitely (Windows) */ + /* Remove time taken to do stat() from sleep. */ + now = apr_time_now(); } - apr_sleep(then - now); + if (now >= then) + return; /* Passing negative values may suspend indefinitely (Windows) */ + + /* (t < 1000 will be round to 0 in apr) */ + if (then - now < 1000) + apr_sleep(1000); + else + apr_sleep(then - now); } diff --git a/contrib/subversion/subversion/libsvn_subr/prompt.c b/contrib/subversion/subversion/libsvn_subr/prompt.c index 92ee6a27888..d0c29d025cb 100644 --- a/contrib/subversion/subversion/libsvn_subr/prompt.c +++ b/contrib/subversion/subversion/libsvn_subr/prompt.c @@ -177,7 +177,7 @@ terminal_open(terminal_handle_t **terminal, svn_boolean_t noecho, and stderr for prompting. */ apr_file_t *tmpfd; status = apr_file_open(&tmpfd, "/dev/tty", - APR_FOPEN_READ | APR_FOPEN_WRITE, + APR_READ | APR_WRITE, APR_OS_DEFAULT, pool); *terminal = apr_palloc(pool, sizeof(terminal_handle_t)); if (!status) diff --git a/contrib/subversion/subversion/libsvn_subr/sysinfo.c b/contrib/subversion/subversion/libsvn_subr/sysinfo.c index a506310aa90..f20050cdb01 100644 --- a/contrib/subversion/subversion/libsvn_subr/sysinfo.c +++ b/contrib/subversion/subversion/libsvn_subr/sysinfo.c @@ -1022,6 +1022,7 @@ release_name_from_version(const char *osver) case 6: return "Snow Leopard"; case 7: return "Lion"; case 8: return "Mountain Lion"; + case 9: return "Mavericks"; } return NULL; diff --git a/contrib/subversion/subversion/libsvn_subr/version.c b/contrib/subversion/subversion/libsvn_subr/version.c index d89a5122121..b385a9442f7 100644 --- a/contrib/subversion/subversion/libsvn_subr/version.c +++ b/contrib/subversion/subversion/libsvn_subr/version.c @@ -136,7 +136,7 @@ svn_version_extended(svn_boolean_t verbose, info->build_time = NULL; info->build_host = SVN_BUILD_HOST; info->copyright = apr_pstrdup - (pool, _("Copyright (C) 2013 The Apache Software Foundation.\n" + (pool, _("Copyright (C) 2014 The Apache Software Foundation.\n" "This software consists of contributions made by many people;\n" "see the NOTICE file for more information.\n" "Subversion is open source software, see " diff --git a/contrib/subversion/subversion/libsvn_wc/status.c b/contrib/subversion/subversion/libsvn_wc/status.c index 1440b2ee5e4..fa57b0aee5e 100644 --- a/contrib/subversion/subversion/libsvn_wc/status.c +++ b/contrib/subversion/subversion/libsvn_wc/status.c @@ -242,144 +242,7 @@ struct file_baton /** Code **/ -/* Fill in *INFO with the information it would contain if it were - obtained from svn_wc__db_read_children_info. */ -static svn_error_t * -read_info(const struct svn_wc__db_info_t **info, - const char *local_abspath, - svn_wc__db_t *db, - apr_pool_t *result_pool, - apr_pool_t *scratch_pool) -{ - struct svn_wc__db_info_t *mtb = apr_pcalloc(result_pool, sizeof(*mtb)); - const svn_checksum_t *checksum; - const char *original_repos_relpath; - SVN_ERR(svn_wc__db_read_info(&mtb->status, &mtb->kind, - &mtb->revnum, &mtb->repos_relpath, - &mtb->repos_root_url, &mtb->repos_uuid, - &mtb->changed_rev, &mtb->changed_date, - &mtb->changed_author, &mtb->depth, - &checksum, NULL, &original_repos_relpath, NULL, - NULL, NULL, &mtb->lock, &mtb->recorded_size, - &mtb->recorded_time, &mtb->changelist, - &mtb->conflicted, &mtb->op_root, - &mtb->had_props, &mtb->props_mod, - &mtb->have_base, &mtb->have_more_work, NULL, - db, local_abspath, - result_pool, scratch_pool)); - - SVN_ERR(svn_wc__db_wclocked(&mtb->locked, db, local_abspath, scratch_pool)); - - /* Maybe we have to get some shadowed lock from BASE to make our test suite - happy... (It might be completely unrelated, but...) */ - if (mtb->have_base - && (mtb->status == svn_wc__db_status_added - || mtb->status == svn_wc__db_status_deleted - || mtb->kind == svn_node_file)) - { - svn_boolean_t update_root; - svn_wc__db_lock_t **lock_arg = NULL; - - if (mtb->status == svn_wc__db_status_added - || mtb->status == svn_wc__db_status_deleted) - lock_arg = &mtb->lock; - - SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, - lock_arg, NULL, NULL, &update_root, - db, local_abspath, - result_pool, scratch_pool)); - - mtb->file_external = (update_root && mtb->kind == svn_node_file); - - if (mtb->status == svn_wc__db_status_deleted) - { - const char *moved_to_abspath; - const char *moved_to_op_root_abspath; - - /* NOTE: we can't use op-root-ness as a condition here since a base - * node can be the root of a move and still not be an explicit - * op-root (having a working node with op_depth == pathelements). - * - * Both these (almost identical) situations showcase this: - * svn mv a/b bb - * svn del a - * and - * svn mv a aa - * svn mv aa/b bb - * In both, 'bb' is moved from 'a/b', but 'a/b' has no op_depth>0 - * node at all, as its parent 'a' is locally deleted. */ - - SVN_ERR(svn_wc__db_scan_deletion(NULL, - &moved_to_abspath, - NULL, - &moved_to_op_root_abspath, - db, local_abspath, - scratch_pool, scratch_pool)); - if (moved_to_abspath != NULL - && moved_to_op_root_abspath != NULL - && strcmp(moved_to_abspath, moved_to_op_root_abspath) == 0) - { - mtb->moved_to_abspath = apr_pstrdup(result_pool, - moved_to_abspath); - } - /* ### ^^^ THIS SUCKS. For at least two reasons: - * 1) We scan the node deletion and that's technically not necessary. - * We'd be fine to know if this is an actual root of a move. - * 2) From the elaborately calculated results, we backwards-guess - * whether this is a root. - * It works ok, and this code only gets called when a node is an - * explicit target of a 'status'. But it would be better to do this - * differently. - * We could return moved-to via svn_wc__db_base_get_info() (called - * just above), but as moved-to is only intended to be returned for - * roots of a move, that doesn't fit too well. */ - } - } - - /* ### svn_wc__db_read_info() could easily return the moved-here flag. But - * for now... (The per-dir query for recursive status is far more optimal.) - * Note that this actually scans around to get the full path, for a bool. - * This bool then gets returned, later is evaluated, and if true leads to - * the same paths being scanned again. We'd want to obtain this bool here as - * cheaply as svn_wc__db_read_children_info() does. */ - if (mtb->status == svn_wc__db_status_added) - { - svn_wc__db_status_t status; - - SVN_ERR(svn_wc__db_scan_addition(&status, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - db, local_abspath, - result_pool, scratch_pool)); - - mtb->moved_here = (status == svn_wc__db_status_moved_here); - mtb->incomplete = (status == svn_wc__db_status_incomplete); - } - - mtb->has_checksum = (checksum != NULL); - mtb->copied = (original_repos_relpath != NULL); - -#ifdef HAVE_SYMLINK - if (mtb->kind == svn_node_file - && (mtb->had_props || mtb->props_mod)) - { - apr_hash_t *properties; - - if (mtb->props_mod) - SVN_ERR(svn_wc__db_read_props(&properties, db, local_abspath, - scratch_pool, scratch_pool)); - else - SVN_ERR(svn_wc__db_read_pristine_props(&properties, db, local_abspath, - scratch_pool, scratch_pool)); - - mtb->special = (NULL != svn_hash_gets(properties, SVN_PROP_SPECIAL)); - } -#endif - *info = mtb; - - return SVN_NO_ERROR; -} /* Return *REPOS_RELPATH and *REPOS_ROOT_URL for LOCAL_ABSPATH using information in INFO if available, falling back on @@ -421,13 +284,42 @@ get_repos_root_url_relpath(const char **repos_relpath, db, local_abspath, result_pool, scratch_pool)); } - else if (info->have_base) + else if (info->status == svn_wc__db_status_deleted + && !info->have_more_work + && info->have_base) { SVN_ERR(svn_wc__db_scan_base_repos(repos_relpath, repos_root_url, repos_uuid, db, local_abspath, result_pool, scratch_pool)); } + else if (info->status == svn_wc__db_status_deleted) + { + const char *work_del_abspath; + const char *add_abspath; + + /* Handles working DELETE and the special case where there is just + svn_wc__db_status_not_present in WORKING */ + + SVN_ERR(svn_wc__db_scan_deletion(NULL, NULL, &work_del_abspath, NULL, + db, local_abspath, + scratch_pool, scratch_pool)); + + /* The parent of what has been deleted must be added */ + add_abspath = svn_dirent_dirname(work_del_abspath, scratch_pool); + + SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, repos_relpath, + repos_root_url, repos_uuid, NULL, + NULL, NULL, NULL, + db, add_abspath, + result_pool, scratch_pool)); + + *repos_relpath = svn_relpath_join(*repos_relpath, + svn_dirent_skip_ancestor( + add_abspath, + local_abspath), + result_pool); + } else { *repos_relpath = NULL; @@ -493,7 +385,8 @@ assemble_status(svn_wc_status3_t **status, if (!info) - SVN_ERR(read_info(&info, local_abspath, db, result_pool, scratch_pool)); + SVN_ERR(svn_wc__db_read_single_info(&info, db, local_abspath, + result_pool, scratch_pool)); if (!info->repos_relpath || !parent_repos_relpath) switched_p = FALSE; @@ -799,8 +692,11 @@ assemble_status(svn_wc_status3_t **status, stat->changelist = apr_pstrdup(result_pool, info->changelist); stat->moved_from_abspath = moved_from_abspath; - if (info->moved_to_abspath) - stat->moved_to_abspath = apr_pstrdup(result_pool, info->moved_to_abspath); + + /* ### TODO: Handle multiple moved_to values properly */ + if (info->moved_to) + stat->moved_to_abspath = apr_pstrdup(result_pool, + info->moved_to->moved_to_abspath); stat->file_external = info->file_external; @@ -1345,8 +1241,8 @@ get_dir_status(const struct walk_status_baton *wb, SVN_ERR(err); if (!dir_info) - SVN_ERR(read_info(&dir_info, local_abspath, wb->db, - scratch_pool, iterpool)); + SVN_ERR(svn_wc__db_read_single_info(&dir_info, wb->db, local_abspath, + scratch_pool, iterpool)); SVN_ERR(get_repos_root_url_relpath(&dir_repos_relpath, &dir_repos_root_url, &dir_repos_uuid, dir_info, @@ -1506,8 +1402,9 @@ get_child_status(const struct walk_status_baton *wb, if (dirent->kind == svn_node_none) dirent = NULL; - SVN_ERR(read_info(&dir_info, parent_abspath, wb->db, - scratch_pool, scratch_pool)); + SVN_ERR(svn_wc__db_read_single_info(&dir_info, + wb->db, parent_abspath, + scratch_pool, scratch_pool)); SVN_ERR(get_repos_root_url_relpath(&dir_repos_relpath, &dir_repos_root_url, &dir_repos_uuid, dir_info, @@ -2710,7 +2607,8 @@ svn_wc__internal_walk_status(svn_wc__db_t *db, ignore_patterns = ignores; } - err = read_info(&info, local_abspath, db, scratch_pool, scratch_pool); + err = svn_wc__db_read_single_info(&info, db, local_abspath, + scratch_pool, scratch_pool); if (err) { diff --git a/contrib/subversion/subversion/libsvn_wc/wc-checks.h b/contrib/subversion/subversion/libsvn_wc/wc-checks.h index 14d7ef3a755..9fd40bd9fad 100644 --- a/contrib/subversion/subversion/libsvn_wc/wc-checks.h +++ b/contrib/subversion/subversion/libsvn_wc/wc-checks.h @@ -1,4 +1,4 @@ -/* This file is automatically generated from wc-checks.sql and .dist_sandbox/subversion-1.8.8/subversion/libsvn_wc/token-map.h. +/* This file is automatically generated from wc-checks.sql and .dist_sandbox/subversion-1.8.9/subversion/libsvn_wc/token-map.h. * Do not edit this file -- edit the source and rerun gen-make.py */ #define STMT_VERIFICATION_TRIGGERS 0 diff --git a/contrib/subversion/subversion/libsvn_wc/wc-metadata.h b/contrib/subversion/subversion/libsvn_wc/wc-metadata.h index 0ab17d4537d..e39db8ab6ba 100644 --- a/contrib/subversion/subversion/libsvn_wc/wc-metadata.h +++ b/contrib/subversion/subversion/libsvn_wc/wc-metadata.h @@ -1,4 +1,4 @@ -/* This file is automatically generated from wc-metadata.sql and .dist_sandbox/subversion-1.8.8/subversion/libsvn_wc/token-map.h. +/* This file is automatically generated from wc-metadata.sql and .dist_sandbox/subversion-1.8.9/subversion/libsvn_wc/token-map.h. * Do not edit this file -- edit the source and rerun gen-make.py */ #define STMT_CREATE_SCHEMA 0 @@ -163,6 +163,8 @@ #define STMT_4_INFO {"STMT_INSTALL_SCHEMA_STATISTICS", NULL} #define STMT_4 \ "ANALYZE sqlite_master; " \ + "DELETE FROM sqlite_stat1 " \ + "WHERE tbl in ('NODES', 'ACTUAL_NODE', 'LOCK', 'WC_LOCK'); " \ "INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES " \ " ('NODES', 'sqlite_autoindex_NODES_1', '8000 8000 2 1'); " \ "INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES " \ diff --git a/contrib/subversion/subversion/libsvn_wc/wc-metadata.sql b/contrib/subversion/subversion/libsvn_wc/wc-metadata.sql index 848293d2ceb..e4b226e09ea 100644 --- a/contrib/subversion/subversion/libsvn_wc/wc-metadata.sql +++ b/contrib/subversion/subversion/libsvn_wc/wc-metadata.sql @@ -597,6 +597,9 @@ CREATE UNIQUE INDEX I_EXTERNALS_DEFINED ON EXTERNALS (wc_id, -- STMT_INSTALL_SCHEMA_STATISTICS ANALYZE sqlite_master; /* Creates empty sqlite_stat1 if necessary */ +DELETE FROM sqlite_stat1 +WHERE tbl in ('NODES', 'ACTUAL_NODE', 'LOCK', 'WC_LOCK'); + INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES ('NODES', 'sqlite_autoindex_NODES_1', '8000 8000 2 1'); INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES diff --git a/contrib/subversion/subversion/libsvn_wc/wc-queries.h b/contrib/subversion/subversion/libsvn_wc/wc-queries.h index 0246ee50b99..3fc6b2fe0f5 100644 --- a/contrib/subversion/subversion/libsvn_wc/wc-queries.h +++ b/contrib/subversion/subversion/libsvn_wc/wc-queries.h @@ -1,4 +1,4 @@ -/* This file is automatically generated from wc-queries.sql and .dist_sandbox/subversion-1.8.8/subversion/libsvn_wc/token-map.h. +/* This file is automatically generated from wc-queries.sql and .dist_sandbox/subversion-1.8.9/subversion/libsvn_wc/token-map.h. * Do not edit this file -- edit the source and rerun gen-make.py */ #define STMT_SELECT_NODE_INFO 0 @@ -221,7 +221,7 @@ #define STMT_21 \ "DELETE " \ "FROM NODES " \ - "WHERE wc_id = ?1 AND local_relpath = ?2 " \ + "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3 " \ "" #define STMT_DELETE_ACTUAL_FOR_BASE_RECURSIVE 22 @@ -516,9 +516,18 @@ "LIMIT 1 " \ "" -#define STMT_SELECT_OP_DEPTH_MOVED_TO 50 -#define STMT_50_INFO {"STMT_SELECT_OP_DEPTH_MOVED_TO", NULL} +#define STMT_SELECT_MOVED_TO_NODE 50 +#define STMT_50_INFO {"STMT_SELECT_MOVED_TO_NODE", NULL} #define STMT_50 \ + "SELECT op_depth, moved_to " \ + "FROM nodes " \ + "WHERE wc_id = ?1 AND local_relpath = ?2 AND moved_to IS NOT NULL " \ + "ORDER BY op_depth DESC " \ + "" + +#define STMT_SELECT_OP_DEPTH_MOVED_TO 51 +#define STMT_51_INFO {"STMT_SELECT_OP_DEPTH_MOVED_TO", NULL} +#define STMT_51 \ "SELECT op_depth, moved_to, repos_path, revision " \ "FROM nodes " \ "WHERE wc_id = ?1 AND local_relpath = ?2 " \ @@ -527,26 +536,26 @@ "ORDER BY op_depth DESC " \ "" -#define STMT_SELECT_MOVED_TO 51 -#define STMT_51_INFO {"STMT_SELECT_MOVED_TO", NULL} -#define STMT_51 \ +#define STMT_SELECT_MOVED_TO 52 +#define STMT_52_INFO {"STMT_SELECT_MOVED_TO", NULL} +#define STMT_52 \ "SELECT moved_to " \ "FROM nodes " \ "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3 " \ "" -#define STMT_SELECT_MOVED_HERE 52 -#define STMT_52_INFO {"STMT_SELECT_MOVED_HERE", NULL} -#define STMT_52 \ +#define STMT_SELECT_MOVED_HERE 53 +#define STMT_53_INFO {"STMT_SELECT_MOVED_HERE", NULL} +#define STMT_53 \ "SELECT moved_here, presence, repos_path, revision " \ "FROM nodes " \ "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth >= ?3 " \ "ORDER BY op_depth " \ "" -#define STMT_SELECT_MOVED_BACK 53 -#define STMT_53_INFO {"STMT_SELECT_MOVED_BACK", NULL} -#define STMT_53 \ +#define STMT_SELECT_MOVED_BACK 54 +#define STMT_54_INFO {"STMT_SELECT_MOVED_BACK", NULL} +#define STMT_54 \ "SELECT u.local_relpath, " \ " u.presence, u.repos_id, u.repos_path, u.revision, " \ " l.presence, l.repos_id, l.repos_path, l.revision, " \ @@ -572,9 +581,9 @@ " AND u.op_depth = ?4 " \ "" -#define STMT_DELETE_MOVED_BACK 54 -#define STMT_54_INFO {"STMT_DELETE_MOVED_BACK", NULL} -#define STMT_54 \ +#define STMT_DELETE_MOVED_BACK 55 +#define STMT_55_INFO {"STMT_DELETE_MOVED_BACK", NULL} +#define STMT_55 \ "DELETE FROM nodes " \ "WHERE wc_id = ?1 " \ " AND (local_relpath = ?2 " \ @@ -582,71 +591,71 @@ " AND op_depth = ?3 " \ "" -#define STMT_DELETE_LOCK 55 -#define STMT_55_INFO {"STMT_DELETE_LOCK", NULL} -#define STMT_55 \ +#define STMT_DELETE_LOCK 56 +#define STMT_56_INFO {"STMT_DELETE_LOCK", NULL} +#define STMT_56 \ "DELETE FROM lock " \ "WHERE repos_id = ?1 AND repos_relpath = ?2 " \ "" -#define STMT_DELETE_LOCK_RECURSIVELY 56 -#define STMT_56_INFO {"STMT_DELETE_LOCK_RECURSIVELY", NULL} -#define STMT_56 \ +#define STMT_DELETE_LOCK_RECURSIVELY 57 +#define STMT_57_INFO {"STMT_DELETE_LOCK_RECURSIVELY", NULL} +#define STMT_57 \ "DELETE FROM lock " \ "WHERE repos_id = ?1 AND (repos_relpath = ?2 OR (((repos_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((repos_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \ "" -#define STMT_CLEAR_BASE_NODE_RECURSIVE_DAV_CACHE 57 -#define STMT_57_INFO {"STMT_CLEAR_BASE_NODE_RECURSIVE_DAV_CACHE", NULL} -#define STMT_57 \ +#define STMT_CLEAR_BASE_NODE_RECURSIVE_DAV_CACHE 58 +#define STMT_58_INFO {"STMT_CLEAR_BASE_NODE_RECURSIVE_DAV_CACHE", NULL} +#define STMT_58 \ "UPDATE nodes SET dav_cache = NULL " \ "WHERE dav_cache IS NOT NULL AND wc_id = ?1 AND op_depth = 0 " \ " AND (local_relpath = ?2 " \ " OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \ "" -#define STMT_RECURSIVE_UPDATE_NODE_REPO 58 -#define STMT_58_INFO {"STMT_RECURSIVE_UPDATE_NODE_REPO", NULL} -#define STMT_58 \ +#define STMT_RECURSIVE_UPDATE_NODE_REPO 59 +#define STMT_59_INFO {"STMT_RECURSIVE_UPDATE_NODE_REPO", NULL} +#define STMT_59 \ "UPDATE nodes SET repos_id = ?4, dav_cache = NULL " \ "WHERE (wc_id = ?1 AND local_relpath = ?2 AND repos_id = ?3) " \ " OR (wc_id = ?1 AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \ " AND repos_id = ?3) " \ "" -#define STMT_UPDATE_LOCK_REPOS_ID 59 -#define STMT_59_INFO {"STMT_UPDATE_LOCK_REPOS_ID", NULL} -#define STMT_59 \ +#define STMT_UPDATE_LOCK_REPOS_ID 60 +#define STMT_60_INFO {"STMT_UPDATE_LOCK_REPOS_ID", NULL} +#define STMT_60 \ "UPDATE lock SET repos_id = ?2 " \ "WHERE repos_id = ?1 " \ "" -#define STMT_UPDATE_NODE_FILEINFO 60 -#define STMT_60_INFO {"STMT_UPDATE_NODE_FILEINFO", NULL} -#define STMT_60 \ +#define STMT_UPDATE_NODE_FILEINFO 61 +#define STMT_61_INFO {"STMT_UPDATE_NODE_FILEINFO", NULL} +#define STMT_61 \ "UPDATE nodes SET translated_size = ?3, last_mod_time = ?4 " \ "WHERE wc_id = ?1 AND local_relpath = ?2 " \ " AND op_depth = (SELECT MAX(op_depth) FROM nodes " \ " WHERE wc_id = ?1 AND local_relpath = ?2) " \ "" -#define STMT_INSERT_ACTUAL_CONFLICT 61 -#define STMT_61_INFO {"STMT_INSERT_ACTUAL_CONFLICT", NULL} -#define STMT_61 \ +#define STMT_INSERT_ACTUAL_CONFLICT 62 +#define STMT_62_INFO {"STMT_INSERT_ACTUAL_CONFLICT", NULL} +#define STMT_62 \ "INSERT INTO actual_node (wc_id, local_relpath, conflict_data, parent_relpath) " \ "VALUES (?1, ?2, ?3, ?4) " \ "" -#define STMT_UPDATE_ACTUAL_CONFLICT 62 -#define STMT_62_INFO {"STMT_UPDATE_ACTUAL_CONFLICT", NULL} -#define STMT_62 \ +#define STMT_UPDATE_ACTUAL_CONFLICT 63 +#define STMT_63_INFO {"STMT_UPDATE_ACTUAL_CONFLICT", NULL} +#define STMT_63 \ "UPDATE actual_node SET conflict_data = ?3 " \ "WHERE wc_id = ?1 AND local_relpath = ?2 " \ "" -#define STMT_UPDATE_ACTUAL_CHANGELISTS 63 -#define STMT_63_INFO {"STMT_UPDATE_ACTUAL_CHANGELISTS", NULL} -#define STMT_63 \ +#define STMT_UPDATE_ACTUAL_CHANGELISTS 64 +#define STMT_64_INFO {"STMT_UPDATE_ACTUAL_CHANGELISTS", NULL} +#define STMT_64 \ "UPDATE actual_node SET changelist = ?3 " \ "WHERE wc_id = ?1 " \ " AND (local_relpath = ?2 OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \ @@ -656,16 +665,16 @@ " AND kind = 'file') " \ "" -#define STMT_UPDATE_ACTUAL_CLEAR_CHANGELIST 64 -#define STMT_64_INFO {"STMT_UPDATE_ACTUAL_CLEAR_CHANGELIST", NULL} -#define STMT_64 \ +#define STMT_UPDATE_ACTUAL_CLEAR_CHANGELIST 65 +#define STMT_65_INFO {"STMT_UPDATE_ACTUAL_CLEAR_CHANGELIST", NULL} +#define STMT_65 \ "UPDATE actual_node SET changelist = NULL " \ " WHERE wc_id = ?1 AND local_relpath = ?2 " \ "" -#define STMT_MARK_SKIPPED_CHANGELIST_DIRS 65 -#define STMT_65_INFO {"STMT_MARK_SKIPPED_CHANGELIST_DIRS", NULL} -#define STMT_65 \ +#define STMT_MARK_SKIPPED_CHANGELIST_DIRS 66 +#define STMT_66_INFO {"STMT_MARK_SKIPPED_CHANGELIST_DIRS", NULL} +#define STMT_66 \ "INSERT INTO changelist_list (wc_id, local_relpath, notify, changelist) " \ "SELECT wc_id, local_relpath, 7, ?3 " \ "FROM targets_list " \ @@ -674,17 +683,17 @@ " AND kind = 'dir' " \ "" -#define STMT_RESET_ACTUAL_WITH_CHANGELIST 66 -#define STMT_66_INFO {"STMT_RESET_ACTUAL_WITH_CHANGELIST", NULL} -#define STMT_66 \ +#define STMT_RESET_ACTUAL_WITH_CHANGELIST 67 +#define STMT_67_INFO {"STMT_RESET_ACTUAL_WITH_CHANGELIST", NULL} +#define STMT_67 \ "REPLACE INTO actual_node ( " \ " wc_id, local_relpath, parent_relpath, changelist) " \ "VALUES (?1, ?2, ?3, ?4) " \ "" -#define STMT_CREATE_CHANGELIST_LIST 67 -#define STMT_67_INFO {"STMT_CREATE_CHANGELIST_LIST", NULL} -#define STMT_67 \ +#define STMT_CREATE_CHANGELIST_LIST 68 +#define STMT_68_INFO {"STMT_CREATE_CHANGELIST_LIST", NULL} +#define STMT_68 \ "DROP TABLE IF EXISTS changelist_list; " \ "CREATE TEMPORARY TABLE changelist_list ( " \ " wc_id INTEGER NOT NULL, " \ @@ -695,9 +704,9 @@ ") " \ "" -#define STMT_CREATE_CHANGELIST_TRIGGER 68 -#define STMT_68_INFO {"STMT_CREATE_CHANGELIST_TRIGGER", NULL} -#define STMT_68 \ +#define STMT_CREATE_CHANGELIST_TRIGGER 69 +#define STMT_69_INFO {"STMT_CREATE_CHANGELIST_TRIGGER", NULL} +#define STMT_69 \ "DROP TRIGGER IF EXISTS trigger_changelist_list_change; " \ "CREATE TEMPORARY TRIGGER trigger_changelist_list_change " \ "BEFORE UPDATE ON actual_node " \ @@ -712,25 +721,25 @@ "END " \ "" -#define STMT_FINALIZE_CHANGELIST 69 -#define STMT_69_INFO {"STMT_FINALIZE_CHANGELIST", NULL} -#define STMT_69 \ +#define STMT_FINALIZE_CHANGELIST 70 +#define STMT_70_INFO {"STMT_FINALIZE_CHANGELIST", NULL} +#define STMT_70 \ "DROP TRIGGER trigger_changelist_list_change; " \ "DROP TABLE changelist_list; " \ "DROP TABLE targets_list " \ "" -#define STMT_SELECT_CHANGELIST_LIST 70 -#define STMT_70_INFO {"STMT_SELECT_CHANGELIST_LIST", NULL} -#define STMT_70 \ +#define STMT_SELECT_CHANGELIST_LIST 71 +#define STMT_71_INFO {"STMT_SELECT_CHANGELIST_LIST", NULL} +#define STMT_71 \ "SELECT wc_id, local_relpath, notify, changelist " \ "FROM changelist_list " \ "ORDER BY wc_id, local_relpath ASC, notify DESC " \ "" -#define STMT_CREATE_TARGETS_LIST 71 -#define STMT_71_INFO {"STMT_CREATE_TARGETS_LIST", NULL} -#define STMT_71 \ +#define STMT_CREATE_TARGETS_LIST 72 +#define STMT_72_INFO {"STMT_CREATE_TARGETS_LIST", NULL} +#define STMT_72 \ "DROP TABLE IF EXISTS targets_list; " \ "CREATE TEMPORARY TABLE targets_list ( " \ " wc_id INTEGER NOT NULL, " \ @@ -741,15 +750,15 @@ " ); " \ "" -#define STMT_DROP_TARGETS_LIST 72 -#define STMT_72_INFO {"STMT_DROP_TARGETS_LIST", NULL} -#define STMT_72 \ +#define STMT_DROP_TARGETS_LIST 73 +#define STMT_73_INFO {"STMT_DROP_TARGETS_LIST", NULL} +#define STMT_73 \ "DROP TABLE targets_list " \ "" -#define STMT_INSERT_TARGET 73 -#define STMT_73_INFO {"STMT_INSERT_TARGET", NULL} -#define STMT_73 \ +#define STMT_INSERT_TARGET 74 +#define STMT_74_INFO {"STMT_INSERT_TARGET", NULL} +#define STMT_74 \ "INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind) " \ "SELECT wc_id, local_relpath, parent_relpath, kind " \ "FROM nodes_current " \ @@ -757,9 +766,9 @@ " AND local_relpath = ?2 " \ "" -#define STMT_INSERT_TARGET_DEPTH_FILES 74 -#define STMT_74_INFO {"STMT_INSERT_TARGET_DEPTH_FILES", NULL} -#define STMT_74 \ +#define STMT_INSERT_TARGET_DEPTH_FILES 75 +#define STMT_75_INFO {"STMT_INSERT_TARGET_DEPTH_FILES", NULL} +#define STMT_75 \ "INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind) " \ "SELECT wc_id, local_relpath, parent_relpath, kind " \ "FROM nodes_current " \ @@ -768,9 +777,9 @@ " AND kind = 'file' " \ "" -#define STMT_INSERT_TARGET_DEPTH_IMMEDIATES 75 -#define STMT_75_INFO {"STMT_INSERT_TARGET_DEPTH_IMMEDIATES", NULL} -#define STMT_75 \ +#define STMT_INSERT_TARGET_DEPTH_IMMEDIATES 76 +#define STMT_76_INFO {"STMT_INSERT_TARGET_DEPTH_IMMEDIATES", NULL} +#define STMT_76 \ "INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind) " \ "SELECT wc_id, local_relpath, parent_relpath, kind " \ "FROM nodes_current " \ @@ -778,9 +787,9 @@ " AND parent_relpath = ?2 " \ "" -#define STMT_INSERT_TARGET_DEPTH_INFINITY 76 -#define STMT_76_INFO {"STMT_INSERT_TARGET_DEPTH_INFINITY", NULL} -#define STMT_76 \ +#define STMT_INSERT_TARGET_DEPTH_INFINITY 77 +#define STMT_77_INFO {"STMT_INSERT_TARGET_DEPTH_INFINITY", NULL} +#define STMT_77 \ "INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind) " \ "SELECT wc_id, local_relpath, parent_relpath, kind " \ "FROM nodes_current " \ @@ -788,9 +797,9 @@ " AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \ "" -#define STMT_INSERT_TARGET_WITH_CHANGELIST 77 -#define STMT_77_INFO {"STMT_INSERT_TARGET_WITH_CHANGELIST", NULL} -#define STMT_77 \ +#define STMT_INSERT_TARGET_WITH_CHANGELIST 78 +#define STMT_78_INFO {"STMT_INSERT_TARGET_WITH_CHANGELIST", NULL} +#define STMT_78 \ "INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind) " \ "SELECT N.wc_id, N.local_relpath, N.parent_relpath, N.kind " \ " FROM actual_node AS A JOIN nodes_current AS N " \ @@ -800,9 +809,9 @@ " AND A.changelist = ?3 " \ "" -#define STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_FILES 78 -#define STMT_78_INFO {"STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_FILES", NULL} -#define STMT_78 \ +#define STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_FILES 79 +#define STMT_79_INFO {"STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_FILES", NULL} +#define STMT_79 \ "INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind) " \ "SELECT N.wc_id, N.local_relpath, N.parent_relpath, N.kind " \ " FROM actual_node AS A JOIN nodes_current AS N " \ @@ -813,9 +822,9 @@ " AND A.changelist = ?3 " \ "" -#define STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_IMMEDIATES 79 -#define STMT_79_INFO {"STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_IMMEDIATES", NULL} -#define STMT_79 \ +#define STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_IMMEDIATES 80 +#define STMT_80_INFO {"STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_IMMEDIATES", NULL} +#define STMT_80 \ "INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind) " \ "SELECT N.wc_id, N.local_relpath, N.parent_relpath, N.kind " \ " FROM actual_node AS A JOIN nodes_current AS N " \ @@ -825,9 +834,9 @@ " AND A.changelist = ?3 " \ "" -#define STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_INFINITY 80 -#define STMT_80_INFO {"STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_INFINITY", NULL} -#define STMT_80 \ +#define STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_INFINITY 81 +#define STMT_81_INFO {"STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_INFINITY", NULL} +#define STMT_81 \ "INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind) " \ "SELECT N.wc_id, N.local_relpath, N.parent_relpath, N.kind " \ " FROM actual_node AS A JOIN nodes_current AS N " \ @@ -837,18 +846,18 @@ " AND A.changelist = ?3 " \ "" -#define STMT_INSERT_ACTUAL_EMPTIES 81 -#define STMT_81_INFO {"STMT_INSERT_ACTUAL_EMPTIES", NULL} -#define STMT_81 \ +#define STMT_INSERT_ACTUAL_EMPTIES 82 +#define STMT_82_INFO {"STMT_INSERT_ACTUAL_EMPTIES", NULL} +#define STMT_82 \ "INSERT OR IGNORE INTO actual_node ( " \ " wc_id, local_relpath, parent_relpath) " \ "SELECT wc_id, local_relpath, parent_relpath " \ "FROM targets_list " \ "" -#define STMT_DELETE_ACTUAL_EMPTY 82 -#define STMT_82_INFO {"STMT_DELETE_ACTUAL_EMPTY", NULL} -#define STMT_82 \ +#define STMT_DELETE_ACTUAL_EMPTY 83 +#define STMT_83_INFO {"STMT_DELETE_ACTUAL_EMPTY", NULL} +#define STMT_83 \ "DELETE FROM actual_node " \ "WHERE wc_id = ?1 AND local_relpath = ?2 " \ " AND properties IS NULL " \ @@ -860,9 +869,9 @@ " AND left_checksum IS NULL " \ "" -#define STMT_DELETE_ACTUAL_EMPTIES 83 -#define STMT_83_INFO {"STMT_DELETE_ACTUAL_EMPTIES", NULL} -#define STMT_83 \ +#define STMT_DELETE_ACTUAL_EMPTIES 84 +#define STMT_84_INFO {"STMT_DELETE_ACTUAL_EMPTIES", NULL} +#define STMT_84 \ "DELETE FROM actual_node " \ "WHERE wc_id = ?1 " \ " AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \ @@ -875,25 +884,25 @@ " AND left_checksum IS NULL " \ "" -#define STMT_DELETE_BASE_NODE 84 -#define STMT_84_INFO {"STMT_DELETE_BASE_NODE", NULL} -#define STMT_84 \ +#define STMT_DELETE_BASE_NODE 85 +#define STMT_85_INFO {"STMT_DELETE_BASE_NODE", NULL} +#define STMT_85 \ "DELETE FROM nodes " \ "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \ "" -#define STMT_DELETE_WORKING_NODE 85 -#define STMT_85_INFO {"STMT_DELETE_WORKING_NODE", NULL} -#define STMT_85 \ +#define STMT_DELETE_WORKING_NODE 86 +#define STMT_86_INFO {"STMT_DELETE_WORKING_NODE", NULL} +#define STMT_86 \ "DELETE FROM nodes " \ "WHERE wc_id = ?1 AND local_relpath = ?2 " \ " AND op_depth = (SELECT MAX(op_depth) FROM nodes " \ " WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > 0) " \ "" -#define STMT_DELETE_LOWEST_WORKING_NODE 86 -#define STMT_86_INFO {"STMT_DELETE_LOWEST_WORKING_NODE", NULL} -#define STMT_86 \ +#define STMT_DELETE_LOWEST_WORKING_NODE 87 +#define STMT_87_INFO {"STMT_DELETE_LOWEST_WORKING_NODE", NULL} +#define STMT_87 \ "DELETE FROM nodes " \ "WHERE wc_id = ?1 AND local_relpath = ?2 " \ " AND op_depth = (SELECT MIN(op_depth) FROM nodes " \ @@ -901,16 +910,16 @@ " AND presence = 'base-deleted' " \ "" -#define STMT_DELETE_ALL_LAYERS 87 -#define STMT_87_INFO {"STMT_DELETE_ALL_LAYERS", NULL} -#define STMT_87 \ +#define STMT_DELETE_NODE_ALL_LAYERS 88 +#define STMT_88_INFO {"STMT_DELETE_NODE_ALL_LAYERS", NULL} +#define STMT_88 \ "DELETE FROM nodes " \ "WHERE wc_id = ?1 AND local_relpath = ?2 " \ "" -#define STMT_DELETE_NODES_ABOVE_DEPTH_RECURSIVE 88 -#define STMT_88_INFO {"STMT_DELETE_NODES_ABOVE_DEPTH_RECURSIVE", NULL} -#define STMT_88 \ +#define STMT_DELETE_NODES_ABOVE_DEPTH_RECURSIVE 89 +#define STMT_89_INFO {"STMT_DELETE_NODES_ABOVE_DEPTH_RECURSIVE", NULL} +#define STMT_89 \ "DELETE FROM nodes " \ "WHERE wc_id = ?1 " \ " AND (local_relpath = ?2 " \ @@ -918,25 +927,25 @@ " AND op_depth >= ?3 " \ "" -#define STMT_DELETE_ACTUAL_NODE 89 -#define STMT_89_INFO {"STMT_DELETE_ACTUAL_NODE", NULL} -#define STMT_89 \ +#define STMT_DELETE_ACTUAL_NODE 90 +#define STMT_90_INFO {"STMT_DELETE_ACTUAL_NODE", NULL} +#define STMT_90 \ "DELETE FROM actual_node " \ "WHERE wc_id = ?1 AND local_relpath = ?2 " \ "" -#define STMT_DELETE_ACTUAL_NODE_RECURSIVE 90 -#define STMT_90_INFO {"STMT_DELETE_ACTUAL_NODE_RECURSIVE", NULL} -#define STMT_90 \ +#define STMT_DELETE_ACTUAL_NODE_RECURSIVE 91 +#define STMT_91_INFO {"STMT_DELETE_ACTUAL_NODE_RECURSIVE", NULL} +#define STMT_91 \ "DELETE FROM actual_node " \ "WHERE wc_id = ?1 " \ " AND (local_relpath = ?2 " \ " OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \ "" -#define STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST 91 -#define STMT_91_INFO {"STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST", NULL} -#define STMT_91 \ +#define STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST 92 +#define STMT_92_INFO {"STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST", NULL} +#define STMT_92 \ "DELETE FROM actual_node " \ "WHERE wc_id = ?1 " \ " AND local_relpath = ?2 " \ @@ -946,9 +955,9 @@ " AND c.kind = 'file')) " \ "" -#define STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE 92 -#define STMT_92_INFO {"STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE", NULL} -#define STMT_92 \ +#define STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE 93 +#define STMT_93_INFO {"STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE", NULL} +#define STMT_93 \ "DELETE FROM actual_node " \ "WHERE wc_id = ?1 " \ " AND (local_relpath = ?2 " \ @@ -960,9 +969,9 @@ " AND c.kind = 'file')) " \ "" -#define STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST 93 -#define STMT_93_INFO {"STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST", NULL} -#define STMT_93 \ +#define STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST 94 +#define STMT_94_INFO {"STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST", NULL} +#define STMT_94 \ "UPDATE actual_node " \ "SET properties = NULL, " \ " text_mod = NULL, " \ @@ -974,9 +983,9 @@ "WHERE wc_id = ?1 AND local_relpath = ?2 " \ "" -#define STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE 94 -#define STMT_94_INFO {"STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE", NULL} -#define STMT_94 \ +#define STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE 95 +#define STMT_95_INFO {"STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE", NULL} +#define STMT_95 \ "UPDATE actual_node " \ "SET properties = NULL, " \ " text_mod = NULL, " \ @@ -990,108 +999,108 @@ " OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \ "" -#define STMT_UPDATE_NODE_BASE_DEPTH 95 -#define STMT_95_INFO {"STMT_UPDATE_NODE_BASE_DEPTH", NULL} -#define STMT_95 \ +#define STMT_UPDATE_NODE_BASE_DEPTH 96 +#define STMT_96_INFO {"STMT_UPDATE_NODE_BASE_DEPTH", NULL} +#define STMT_96 \ "UPDATE nodes SET depth = ?3 " \ "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \ " AND kind='dir' " \ "" -#define STMT_UPDATE_NODE_BASE_PRESENCE 96 -#define STMT_96_INFO {"STMT_UPDATE_NODE_BASE_PRESENCE", NULL} -#define STMT_96 \ +#define STMT_UPDATE_NODE_BASE_PRESENCE 97 +#define STMT_97_INFO {"STMT_UPDATE_NODE_BASE_PRESENCE", NULL} +#define STMT_97 \ "UPDATE nodes SET presence = ?3 " \ "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \ "" -#define STMT_UPDATE_BASE_NODE_PRESENCE_REVNUM_AND_REPOS_PATH 97 -#define STMT_97_INFO {"STMT_UPDATE_BASE_NODE_PRESENCE_REVNUM_AND_REPOS_PATH", NULL} -#define STMT_97 \ +#define STMT_UPDATE_BASE_NODE_PRESENCE_REVNUM_AND_REPOS_PATH 98 +#define STMT_98_INFO {"STMT_UPDATE_BASE_NODE_PRESENCE_REVNUM_AND_REPOS_PATH", NULL} +#define STMT_98 \ "UPDATE nodes SET presence = ?3, revision = ?4, repos_path = ?5 " \ "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \ "" -#define STMT_LOOK_FOR_WORK 98 -#define STMT_98_INFO {"STMT_LOOK_FOR_WORK", NULL} -#define STMT_98 \ +#define STMT_LOOK_FOR_WORK 99 +#define STMT_99_INFO {"STMT_LOOK_FOR_WORK", NULL} +#define STMT_99 \ "SELECT id FROM work_queue LIMIT 1 " \ "" -#define STMT_INSERT_WORK_ITEM 99 -#define STMT_99_INFO {"STMT_INSERT_WORK_ITEM", NULL} -#define STMT_99 \ +#define STMT_INSERT_WORK_ITEM 100 +#define STMT_100_INFO {"STMT_INSERT_WORK_ITEM", NULL} +#define STMT_100 \ "INSERT INTO work_queue (work) VALUES (?1) " \ "" -#define STMT_SELECT_WORK_ITEM 100 -#define STMT_100_INFO {"STMT_SELECT_WORK_ITEM", NULL} -#define STMT_100 \ +#define STMT_SELECT_WORK_ITEM 101 +#define STMT_101_INFO {"STMT_SELECT_WORK_ITEM", NULL} +#define STMT_101 \ "SELECT id, work FROM work_queue ORDER BY id LIMIT 1 " \ "" -#define STMT_DELETE_WORK_ITEM 101 -#define STMT_101_INFO {"STMT_DELETE_WORK_ITEM", NULL} -#define STMT_101 \ +#define STMT_DELETE_WORK_ITEM 102 +#define STMT_102_INFO {"STMT_DELETE_WORK_ITEM", NULL} +#define STMT_102 \ "DELETE FROM work_queue WHERE id = ?1 " \ "" -#define STMT_INSERT_OR_IGNORE_PRISTINE 102 -#define STMT_102_INFO {"STMT_INSERT_OR_IGNORE_PRISTINE", NULL} -#define STMT_102 \ +#define STMT_INSERT_OR_IGNORE_PRISTINE 103 +#define STMT_103_INFO {"STMT_INSERT_OR_IGNORE_PRISTINE", NULL} +#define STMT_103 \ "INSERT OR IGNORE INTO pristine (checksum, md5_checksum, size, refcount) " \ "VALUES (?1, ?2, ?3, 0) " \ "" -#define STMT_INSERT_PRISTINE 103 -#define STMT_103_INFO {"STMT_INSERT_PRISTINE", NULL} -#define STMT_103 \ +#define STMT_INSERT_PRISTINE 104 +#define STMT_104_INFO {"STMT_INSERT_PRISTINE", NULL} +#define STMT_104 \ "INSERT INTO pristine (checksum, md5_checksum, size, refcount) " \ "VALUES (?1, ?2, ?3, 0) " \ "" -#define STMT_SELECT_PRISTINE 104 -#define STMT_104_INFO {"STMT_SELECT_PRISTINE", NULL} -#define STMT_104 \ +#define STMT_SELECT_PRISTINE 105 +#define STMT_105_INFO {"STMT_SELECT_PRISTINE", NULL} +#define STMT_105 \ "SELECT md5_checksum " \ "FROM pristine " \ "WHERE checksum = ?1 " \ "" -#define STMT_SELECT_PRISTINE_SIZE 105 -#define STMT_105_INFO {"STMT_SELECT_PRISTINE_SIZE", NULL} -#define STMT_105 \ +#define STMT_SELECT_PRISTINE_SIZE 106 +#define STMT_106_INFO {"STMT_SELECT_PRISTINE_SIZE", NULL} +#define STMT_106 \ "SELECT size " \ "FROM pristine " \ "WHERE checksum = ?1 LIMIT 1 " \ "" -#define STMT_SELECT_PRISTINE_BY_MD5 106 -#define STMT_106_INFO {"STMT_SELECT_PRISTINE_BY_MD5", NULL} -#define STMT_106 \ +#define STMT_SELECT_PRISTINE_BY_MD5 107 +#define STMT_107_INFO {"STMT_SELECT_PRISTINE_BY_MD5", NULL} +#define STMT_107 \ "SELECT checksum " \ "FROM pristine " \ "WHERE md5_checksum = ?1 " \ "" -#define STMT_SELECT_UNREFERENCED_PRISTINES 107 -#define STMT_107_INFO {"STMT_SELECT_UNREFERENCED_PRISTINES", NULL} -#define STMT_107 \ +#define STMT_SELECT_UNREFERENCED_PRISTINES 108 +#define STMT_108_INFO {"STMT_SELECT_UNREFERENCED_PRISTINES", NULL} +#define STMT_108 \ "SELECT checksum " \ "FROM pristine " \ "WHERE refcount = 0 " \ "" -#define STMT_DELETE_PRISTINE_IF_UNREFERENCED 108 -#define STMT_108_INFO {"STMT_DELETE_PRISTINE_IF_UNREFERENCED", NULL} -#define STMT_108 \ +#define STMT_DELETE_PRISTINE_IF_UNREFERENCED 109 +#define STMT_109_INFO {"STMT_DELETE_PRISTINE_IF_UNREFERENCED", NULL} +#define STMT_109 \ "DELETE FROM pristine " \ "WHERE checksum = ?1 AND refcount = 0 " \ "" -#define STMT_SELECT_COPY_PRISTINES 109 -#define STMT_109_INFO {"STMT_SELECT_COPY_PRISTINES", NULL} -#define STMT_109 \ +#define STMT_SELECT_COPY_PRISTINES 110 +#define STMT_110_INFO {"STMT_SELECT_COPY_PRISTINES", NULL} +#define STMT_110 \ "SELECT n.checksum, md5_checksum, size " \ "FROM nodes_current n " \ "LEFT JOIN pristine p ON n.checksum = p.checksum " \ @@ -1109,62 +1118,62 @@ " AND n.checksum IS NOT NULL " \ "" -#define STMT_VACUUM 110 -#define STMT_110_INFO {"STMT_VACUUM", NULL} -#define STMT_110 \ +#define STMT_VACUUM 111 +#define STMT_111_INFO {"STMT_VACUUM", NULL} +#define STMT_111 \ "VACUUM " \ "" -#define STMT_SELECT_CONFLICT_VICTIMS 111 -#define STMT_111_INFO {"STMT_SELECT_CONFLICT_VICTIMS", NULL} -#define STMT_111 \ +#define STMT_SELECT_CONFLICT_VICTIMS 112 +#define STMT_112_INFO {"STMT_SELECT_CONFLICT_VICTIMS", NULL} +#define STMT_112 \ "SELECT local_relpath, conflict_data " \ "FROM actual_node " \ "WHERE wc_id = ?1 AND parent_relpath = ?2 AND " \ " NOT (conflict_data IS NULL) " \ "" -#define STMT_INSERT_WC_LOCK 112 -#define STMT_112_INFO {"STMT_INSERT_WC_LOCK", NULL} -#define STMT_112 \ +#define STMT_INSERT_WC_LOCK 113 +#define STMT_113_INFO {"STMT_INSERT_WC_LOCK", NULL} +#define STMT_113 \ "INSERT INTO wc_lock (wc_id, local_dir_relpath, locked_levels) " \ "VALUES (?1, ?2, ?3) " \ "" -#define STMT_SELECT_WC_LOCK 113 -#define STMT_113_INFO {"STMT_SELECT_WC_LOCK", NULL} -#define STMT_113 \ +#define STMT_SELECT_WC_LOCK 114 +#define STMT_114_INFO {"STMT_SELECT_WC_LOCK", NULL} +#define STMT_114 \ "SELECT locked_levels FROM wc_lock " \ "WHERE wc_id = ?1 AND local_dir_relpath = ?2 " \ "" -#define STMT_SELECT_ANCESTOR_WCLOCKS 114 -#define STMT_114_INFO {"STMT_SELECT_ANCESTOR_WCLOCKS", NULL} -#define STMT_114 \ +#define STMT_SELECT_ANCESTOR_WCLOCKS 115 +#define STMT_115_INFO {"STMT_SELECT_ANCESTOR_WCLOCKS", NULL} +#define STMT_115 \ "SELECT local_dir_relpath, locked_levels FROM wc_lock " \ "WHERE wc_id = ?1 " \ " AND ((local_dir_relpath >= ?3 AND local_dir_relpath <= ?2) " \ " OR local_dir_relpath = '') " \ "" -#define STMT_DELETE_WC_LOCK 115 -#define STMT_115_INFO {"STMT_DELETE_WC_LOCK", NULL} -#define STMT_115 \ +#define STMT_DELETE_WC_LOCK 116 +#define STMT_116_INFO {"STMT_DELETE_WC_LOCK", NULL} +#define STMT_116 \ "DELETE FROM wc_lock " \ "WHERE wc_id = ?1 AND local_dir_relpath = ?2 " \ "" -#define STMT_FIND_WC_LOCK 116 -#define STMT_116_INFO {"STMT_FIND_WC_LOCK", NULL} -#define STMT_116 \ +#define STMT_FIND_WC_LOCK 117 +#define STMT_117_INFO {"STMT_FIND_WC_LOCK", NULL} +#define STMT_117 \ "SELECT local_dir_relpath FROM wc_lock " \ "WHERE wc_id = ?1 " \ " AND (((local_dir_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_dir_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \ "" -#define STMT_DELETE_WC_LOCK_ORPHAN 117 -#define STMT_117_INFO {"STMT_DELETE_WC_LOCK_ORPHAN", NULL} -#define STMT_117 \ +#define STMT_DELETE_WC_LOCK_ORPHAN 118 +#define STMT_118_INFO {"STMT_DELETE_WC_LOCK_ORPHAN", NULL} +#define STMT_118 \ "DELETE FROM wc_lock " \ "WHERE wc_id = ?1 AND local_dir_relpath = ?2 " \ "AND NOT EXISTS (SELECT 1 FROM nodes " \ @@ -1172,9 +1181,9 @@ " AND nodes.local_relpath = wc_lock.local_dir_relpath) " \ "" -#define STMT_DELETE_WC_LOCK_ORPHAN_RECURSIVE 118 -#define STMT_118_INFO {"STMT_DELETE_WC_LOCK_ORPHAN_RECURSIVE", NULL} -#define STMT_118 \ +#define STMT_DELETE_WC_LOCK_ORPHAN_RECURSIVE 119 +#define STMT_119_INFO {"STMT_DELETE_WC_LOCK_ORPHAN_RECURSIVE", NULL} +#define STMT_119 \ "DELETE FROM wc_lock " \ "WHERE wc_id = ?1 " \ " AND (local_dir_relpath = ?2 " \ @@ -1184,9 +1193,9 @@ " AND nodes.local_relpath = wc_lock.local_dir_relpath) " \ "" -#define STMT_APPLY_CHANGES_TO_BASE_NODE 119 -#define STMT_119_INFO {"STMT_APPLY_CHANGES_TO_BASE_NODE", NULL} -#define STMT_119 \ +#define STMT_APPLY_CHANGES_TO_BASE_NODE 120 +#define STMT_120_INFO {"STMT_APPLY_CHANGES_TO_BASE_NODE", NULL} +#define STMT_120 \ "INSERT OR REPLACE INTO nodes ( " \ " wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path, " \ " revision, presence, depth, kind, changed_revision, changed_date, " \ @@ -1200,18 +1209,18 @@ " AND op_depth = 0)) " \ "" -#define STMT_INSTALL_WORKING_NODE_FOR_DELETE 120 -#define STMT_120_INFO {"STMT_INSTALL_WORKING_NODE_FOR_DELETE", NULL} -#define STMT_120 \ +#define STMT_INSTALL_WORKING_NODE_FOR_DELETE 121 +#define STMT_121_INFO {"STMT_INSTALL_WORKING_NODE_FOR_DELETE", NULL} +#define STMT_121 \ "INSERT OR REPLACE INTO nodes ( " \ " wc_id, local_relpath, op_depth, " \ " parent_relpath, presence, kind) " \ "VALUES(?1, ?2, ?3, ?4, 'base-deleted', ?5) " \ "" -#define STMT_DELETE_NO_LOWER_LAYER 121 -#define STMT_121_INFO {"STMT_DELETE_NO_LOWER_LAYER", NULL} -#define STMT_121 \ +#define STMT_DELETE_NO_LOWER_LAYER 122 +#define STMT_122_INFO {"STMT_DELETE_NO_LOWER_LAYER", NULL} +#define STMT_122 \ "DELETE FROM nodes " \ " WHERE wc_id = ?1 " \ " AND (local_relpath = ?2 OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \ @@ -1223,9 +1232,9 @@ " AND n.presence IN ('normal', 'incomplete')) " \ "" -#define STMT_REPLACE_WITH_BASE_DELETED 122 -#define STMT_122_INFO {"STMT_REPLACE_WITH_BASE_DELETED", NULL} -#define STMT_122 \ +#define STMT_REPLACE_WITH_BASE_DELETED 123 +#define STMT_123_INFO {"STMT_REPLACE_WITH_BASE_DELETED", NULL} +#define STMT_123 \ "INSERT OR REPLACE INTO nodes (wc_id, local_relpath, op_depth, parent_relpath, " \ " kind, moved_to, presence) " \ "SELECT wc_id, local_relpath, op_depth, parent_relpath, " \ @@ -1236,9 +1245,9 @@ " AND op_depth = ?3 " \ "" -#define STMT_INSERT_DELETE_FROM_NODE_RECURSIVE 123 -#define STMT_123_INFO {"STMT_INSERT_DELETE_FROM_NODE_RECURSIVE", NULL} -#define STMT_123 \ +#define STMT_INSERT_DELETE_FROM_NODE_RECURSIVE 124 +#define STMT_124_INFO {"STMT_INSERT_DELETE_FROM_NODE_RECURSIVE", NULL} +#define STMT_124 \ "INSERT INTO nodes ( " \ " wc_id, local_relpath, op_depth, parent_relpath, presence, kind) " \ "SELECT wc_id, local_relpath, ?4 , parent_relpath, 'base-deleted', " \ @@ -1252,9 +1261,9 @@ " AND file_external IS NULL " \ "" -#define STMT_INSERT_WORKING_NODE_FROM_BASE_COPY 124 -#define STMT_124_INFO {"STMT_INSERT_WORKING_NODE_FROM_BASE_COPY", NULL} -#define STMT_124 \ +#define STMT_INSERT_WORKING_NODE_FROM_BASE_COPY 125 +#define STMT_125_INFO {"STMT_INSERT_WORKING_NODE_FROM_BASE_COPY", NULL} +#define STMT_125 \ "INSERT INTO nodes ( " \ " wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path, " \ " revision, presence, depth, kind, changed_revision, changed_date, " \ @@ -1268,9 +1277,9 @@ "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \ "" -#define STMT_INSERT_DELETE_FROM_BASE 125 -#define STMT_125_INFO {"STMT_INSERT_DELETE_FROM_BASE", NULL} -#define STMT_125 \ +#define STMT_INSERT_DELETE_FROM_BASE 126 +#define STMT_126_INFO {"STMT_INSERT_DELETE_FROM_BASE", NULL} +#define STMT_126 \ "INSERT INTO nodes ( " \ " wc_id, local_relpath, op_depth, parent_relpath, presence, kind) " \ "SELECT wc_id, local_relpath, ?3 , parent_relpath, " \ @@ -1279,34 +1288,34 @@ "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \ "" -#define STMT_UPDATE_OP_DEPTH_INCREASE_RECURSIVE 126 -#define STMT_126_INFO {"STMT_UPDATE_OP_DEPTH_INCREASE_RECURSIVE", NULL} -#define STMT_126 \ +#define STMT_UPDATE_OP_DEPTH_INCREASE_RECURSIVE 127 +#define STMT_127_INFO {"STMT_UPDATE_OP_DEPTH_INCREASE_RECURSIVE", NULL} +#define STMT_127 \ "UPDATE nodes SET op_depth = ?3 + 1 " \ "WHERE wc_id = ?1 " \ " AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \ " AND op_depth = ?3 " \ "" -#define STMT_UPDATE_OP_DEPTH_RECURSIVE 127 -#define STMT_127_INFO {"STMT_UPDATE_OP_DEPTH_RECURSIVE", NULL} -#define STMT_127 \ +#define STMT_UPDATE_OP_DEPTH_RECURSIVE 128 +#define STMT_128_INFO {"STMT_UPDATE_OP_DEPTH_RECURSIVE", NULL} +#define STMT_128 \ "UPDATE nodes SET op_depth = ?4, moved_here = NULL " \ "WHERE wc_id = ?1 " \ " AND (local_relpath = ?2 OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \ " AND op_depth = ?3 " \ "" -#define STMT_DOES_NODE_EXIST 128 -#define STMT_128_INFO {"STMT_DOES_NODE_EXIST", NULL} -#define STMT_128 \ +#define STMT_DOES_NODE_EXIST 129 +#define STMT_129_INFO {"STMT_DOES_NODE_EXIST", NULL} +#define STMT_129 \ "SELECT 1 FROM nodes WHERE wc_id = ?1 AND local_relpath = ?2 " \ "LIMIT 1 " \ "" -#define STMT_HAS_SERVER_EXCLUDED_DESCENDANTS 129 -#define STMT_129_INFO {"STMT_HAS_SERVER_EXCLUDED_DESCENDANTS", NULL} -#define STMT_129 \ +#define STMT_HAS_SERVER_EXCLUDED_DESCENDANTS 130 +#define STMT_130_INFO {"STMT_HAS_SERVER_EXCLUDED_DESCENDANTS", NULL} +#define STMT_130 \ "SELECT local_relpath FROM nodes " \ "WHERE wc_id = ?1 " \ " AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \ @@ -1314,9 +1323,9 @@ "LIMIT 1 " \ "" -#define STMT_SELECT_ALL_EXCLUDED_DESCENDANTS 130 -#define STMT_130_INFO {"STMT_SELECT_ALL_EXCLUDED_DESCENDANTS", NULL} -#define STMT_130 \ +#define STMT_SELECT_ALL_EXCLUDED_DESCENDANTS 131 +#define STMT_131_INFO {"STMT_SELECT_ALL_EXCLUDED_DESCENDANTS", NULL} +#define STMT_131 \ "SELECT local_relpath FROM nodes " \ "WHERE wc_id = ?1 " \ " AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \ @@ -1324,9 +1333,9 @@ " AND (presence = 'server-excluded' OR presence = 'excluded') " \ "" -#define STMT_INSERT_WORKING_NODE_COPY_FROM 131 -#define STMT_131_INFO {"STMT_INSERT_WORKING_NODE_COPY_FROM", NULL} -#define STMT_131 \ +#define STMT_INSERT_WORKING_NODE_COPY_FROM 132 +#define STMT_132_INFO {"STMT_INSERT_WORKING_NODE_COPY_FROM", NULL} +#define STMT_132 \ "INSERT OR REPLACE INTO nodes ( " \ " wc_id, local_relpath, op_depth, parent_relpath, repos_id, " \ " repos_path, revision, presence, depth, moved_here, kind, changed_revision, " \ @@ -1345,9 +1354,9 @@ "WHERE wc_id = ?1 AND local_relpath = ?2 " \ "" -#define STMT_INSERT_WORKING_NODE_COPY_FROM_DEPTH 132 -#define STMT_132_INFO {"STMT_INSERT_WORKING_NODE_COPY_FROM_DEPTH", NULL} -#define STMT_132 \ +#define STMT_INSERT_WORKING_NODE_COPY_FROM_DEPTH 133 +#define STMT_133_INFO {"STMT_INSERT_WORKING_NODE_COPY_FROM_DEPTH", NULL} +#define STMT_133 \ "INSERT OR REPLACE INTO nodes ( " \ " wc_id, local_relpath, op_depth, parent_relpath, repos_id, " \ " repos_path, revision, presence, depth, moved_here, kind, changed_revision, " \ @@ -1366,49 +1375,49 @@ "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?7 " \ "" -#define STMT_UPDATE_BASE_REVISION 133 -#define STMT_133_INFO {"STMT_UPDATE_BASE_REVISION", NULL} -#define STMT_133 \ +#define STMT_UPDATE_BASE_REVISION 134 +#define STMT_134_INFO {"STMT_UPDATE_BASE_REVISION", NULL} +#define STMT_134 \ "UPDATE nodes SET revision = ?3 " \ "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \ "" -#define STMT_UPDATE_BASE_REPOS 134 -#define STMT_134_INFO {"STMT_UPDATE_BASE_REPOS", NULL} -#define STMT_134 \ +#define STMT_UPDATE_BASE_REPOS 135 +#define STMT_135_INFO {"STMT_UPDATE_BASE_REPOS", NULL} +#define STMT_135 \ "UPDATE nodes SET repos_id = ?3, repos_path = ?4 " \ "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \ "" -#define STMT_ACTUAL_HAS_CHILDREN 135 -#define STMT_135_INFO {"STMT_ACTUAL_HAS_CHILDREN", NULL} -#define STMT_135 \ +#define STMT_ACTUAL_HAS_CHILDREN 136 +#define STMT_136_INFO {"STMT_ACTUAL_HAS_CHILDREN", NULL} +#define STMT_136 \ "SELECT 1 FROM actual_node " \ "WHERE wc_id = ?1 AND parent_relpath = ?2 " \ "LIMIT 1 " \ "" -#define STMT_INSERT_EXTERNAL 136 -#define STMT_136_INFO {"STMT_INSERT_EXTERNAL", NULL} -#define STMT_136 \ +#define STMT_INSERT_EXTERNAL 137 +#define STMT_137_INFO {"STMT_INSERT_EXTERNAL", NULL} +#define STMT_137 \ "INSERT OR REPLACE INTO externals ( " \ " wc_id, local_relpath, parent_relpath, presence, kind, def_local_relpath, " \ " repos_id, def_repos_relpath, def_operational_revision, def_revision) " \ "VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10) " \ "" -#define STMT_SELECT_EXTERNAL_INFO 137 -#define STMT_137_INFO {"STMT_SELECT_EXTERNAL_INFO", NULL} -#define STMT_137 \ +#define STMT_SELECT_EXTERNAL_INFO 138 +#define STMT_138_INFO {"STMT_SELECT_EXTERNAL_INFO", NULL} +#define STMT_138 \ "SELECT presence, kind, def_local_relpath, repos_id, " \ " def_repos_relpath, def_operational_revision, def_revision " \ "FROM externals WHERE wc_id = ?1 AND local_relpath = ?2 " \ "LIMIT 1 " \ "" -#define STMT_DELETE_FILE_EXTERNALS 138 -#define STMT_138_INFO {"STMT_DELETE_FILE_EXTERNALS", NULL} -#define STMT_138 \ +#define STMT_DELETE_FILE_EXTERNALS 139 +#define STMT_139_INFO {"STMT_DELETE_FILE_EXTERNALS", NULL} +#define STMT_139 \ "DELETE FROM nodes " \ "WHERE wc_id = ?1 " \ " AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \ @@ -1416,26 +1425,26 @@ " AND file_external IS NOT NULL " \ "" -#define STMT_DELETE_FILE_EXTERNAL_REGISTATIONS 139 -#define STMT_139_INFO {"STMT_DELETE_FILE_EXTERNAL_REGISTATIONS", NULL} -#define STMT_139 \ +#define STMT_DELETE_FILE_EXTERNAL_REGISTATIONS 140 +#define STMT_140_INFO {"STMT_DELETE_FILE_EXTERNAL_REGISTATIONS", NULL} +#define STMT_140 \ "DELETE FROM externals " \ "WHERE wc_id = ?1 " \ " AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \ " AND kind != 'dir' " \ "" -#define STMT_DELETE_EXTERNAL_REGISTATIONS 140 -#define STMT_140_INFO {"STMT_DELETE_EXTERNAL_REGISTATIONS", NULL} -#define STMT_140 \ +#define STMT_DELETE_EXTERNAL_REGISTATIONS 141 +#define STMT_141_INFO {"STMT_DELETE_EXTERNAL_REGISTATIONS", NULL} +#define STMT_141 \ "DELETE FROM externals " \ "WHERE wc_id = ?1 " \ " AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \ "" -#define STMT_SELECT_COMMITTABLE_EXTERNALS_BELOW 141 -#define STMT_141_INFO {"STMT_SELECT_COMMITTABLE_EXTERNALS_BELOW", NULL} -#define STMT_141 \ +#define STMT_SELECT_COMMITTABLE_EXTERNALS_BELOW 142 +#define STMT_142_INFO {"STMT_SELECT_COMMITTABLE_EXTERNALS_BELOW", NULL} +#define STMT_142 \ "SELECT local_relpath, kind, def_repos_relpath, " \ " (SELECT root FROM repository AS r WHERE r.id = e.repos_id) " \ "FROM externals e " \ @@ -1453,9 +1462,9 @@ " AND nodes.local_relpath = e.parent_relpath)) " \ "" -#define STMT_SELECT_COMMITTABLE_EXTERNALS_IMMEDIATELY_BELOW 142 -#define STMT_142_INFO {"STMT_SELECT_COMMITTABLE_EXTERNALS_IMMEDIATELY_BELOW", NULL} -#define STMT_142 \ +#define STMT_SELECT_COMMITTABLE_EXTERNALS_IMMEDIATELY_BELOW 143 +#define STMT_143_INFO {"STMT_SELECT_COMMITTABLE_EXTERNALS_IMMEDIATELY_BELOW", NULL} +#define STMT_143 \ "SELECT local_relpath, kind, def_repos_relpath, " \ " (SELECT root FROM repository AS r WHERE r.id = e.repos_id) " \ "FROM externals e " \ @@ -1474,25 +1483,25 @@ " AND nodes.local_relpath = e.parent_relpath)) " \ "" -#define STMT_SELECT_EXTERNALS_DEFINED 143 -#define STMT_143_INFO {"STMT_SELECT_EXTERNALS_DEFINED", NULL} -#define STMT_143 \ +#define STMT_SELECT_EXTERNALS_DEFINED 144 +#define STMT_144_INFO {"STMT_SELECT_EXTERNALS_DEFINED", NULL} +#define STMT_144 \ "SELECT local_relpath, def_local_relpath " \ "FROM externals " \ "WHERE (wc_id = ?1 AND def_local_relpath = ?2) " \ " OR (wc_id = ?1 AND (((def_local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((def_local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \ "" -#define STMT_DELETE_EXTERNAL 144 -#define STMT_144_INFO {"STMT_DELETE_EXTERNAL", NULL} -#define STMT_144 \ +#define STMT_DELETE_EXTERNAL 145 +#define STMT_145_INFO {"STMT_DELETE_EXTERNAL", NULL} +#define STMT_145 \ "DELETE FROM externals " \ "WHERE wc_id = ?1 AND local_relpath = ?2 " \ "" -#define STMT_SELECT_EXTERNAL_PROPERTIES 145 -#define STMT_145_INFO {"STMT_SELECT_EXTERNAL_PROPERTIES", NULL} -#define STMT_145 \ +#define STMT_SELECT_EXTERNAL_PROPERTIES 146 +#define STMT_146_INFO {"STMT_SELECT_EXTERNAL_PROPERTIES", NULL} +#define STMT_146 \ "SELECT IFNULL((SELECT properties FROM actual_node a " \ " WHERE a.wc_id = ?1 AND A.local_relpath = n.local_relpath), " \ " properties), " \ @@ -1510,9 +1519,9 @@ " AND kind = 'dir' AND presence IN ('normal', 'incomplete') " \ "" -#define STMT_SELECT_CURRENT_PROPS_RECURSIVE 146 -#define STMT_146_INFO {"STMT_SELECT_CURRENT_PROPS_RECURSIVE", NULL} -#define STMT_146 \ +#define STMT_SELECT_CURRENT_PROPS_RECURSIVE 147 +#define STMT_147_INFO {"STMT_SELECT_CURRENT_PROPS_RECURSIVE", NULL} +#define STMT_147 \ "SELECT IFNULL((SELECT properties FROM actual_node a " \ " WHERE a.wc_id = ?1 AND A.local_relpath = n.local_relpath), " \ " properties), " \ @@ -1522,57 +1531,57 @@ " OR (wc_id = ?1 AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \ "" -#define STMT_PRAGMA_LOCKING_MODE 147 -#define STMT_147_INFO {"STMT_PRAGMA_LOCKING_MODE", NULL} -#define STMT_147 \ +#define STMT_PRAGMA_LOCKING_MODE 148 +#define STMT_148_INFO {"STMT_PRAGMA_LOCKING_MODE", NULL} +#define STMT_148 \ "PRAGMA locking_mode = exclusive " \ "" -#define STMT_INSERT_ACTUAL_NODE 148 -#define STMT_148_INFO {"STMT_INSERT_ACTUAL_NODE", NULL} -#define STMT_148 \ +#define STMT_INSERT_ACTUAL_NODE 149 +#define STMT_149_INFO {"STMT_INSERT_ACTUAL_NODE", NULL} +#define STMT_149 \ "INSERT OR REPLACE INTO actual_node ( " \ " wc_id, local_relpath, parent_relpath, properties, changelist, conflict_data) " \ "VALUES (?1, ?2, ?3, ?4, ?5, ?6) " \ "" -#define STMT_UPDATE_ACTUAL_CONFLICT_DATA 149 -#define STMT_149_INFO {"STMT_UPDATE_ACTUAL_CONFLICT_DATA", NULL} -#define STMT_149 \ +#define STMT_UPDATE_ACTUAL_CONFLICT_DATA 150 +#define STMT_150_INFO {"STMT_UPDATE_ACTUAL_CONFLICT_DATA", NULL} +#define STMT_150 \ "UPDATE actual_node SET conflict_data = ?3 " \ "WHERE wc_id = ?1 AND local_relpath = ?2 " \ "" -#define STMT_INSERT_ACTUAL_CONFLICT_DATA 150 -#define STMT_150_INFO {"STMT_INSERT_ACTUAL_CONFLICT_DATA", NULL} -#define STMT_150 \ +#define STMT_INSERT_ACTUAL_CONFLICT_DATA 151 +#define STMT_151_INFO {"STMT_INSERT_ACTUAL_CONFLICT_DATA", NULL} +#define STMT_151 \ "INSERT INTO actual_node (wc_id, local_relpath, conflict_data, parent_relpath) " \ "VALUES (?1, ?2, ?3, ?4) " \ "" -#define STMT_SELECT_ALL_FILES 151 -#define STMT_151_INFO {"STMT_SELECT_ALL_FILES", NULL} -#define STMT_151 \ +#define STMT_SELECT_ALL_FILES 152 +#define STMT_152_INFO {"STMT_SELECT_ALL_FILES", NULL} +#define STMT_152 \ "SELECT local_relpath FROM nodes_current " \ "WHERE wc_id = ?1 AND parent_relpath = ?2 AND kind = 'file' " \ "" -#define STMT_UPDATE_NODE_PROPS 152 -#define STMT_152_INFO {"STMT_UPDATE_NODE_PROPS", NULL} -#define STMT_152 \ +#define STMT_UPDATE_NODE_PROPS 153 +#define STMT_153_INFO {"STMT_UPDATE_NODE_PROPS", NULL} +#define STMT_153 \ "UPDATE nodes SET properties = ?4 " \ "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3 " \ "" -#define STMT_PRAGMA_TABLE_INFO_NODES 153 -#define STMT_153_INFO {"STMT_PRAGMA_TABLE_INFO_NODES", NULL} -#define STMT_153 \ +#define STMT_PRAGMA_TABLE_INFO_NODES 154 +#define STMT_154_INFO {"STMT_PRAGMA_TABLE_INFO_NODES", NULL} +#define STMT_154 \ "PRAGMA table_info(\"NODES\") " \ "" -#define STMT_CREATE_TARGET_PROP_CACHE 154 -#define STMT_154_INFO {"STMT_CREATE_TARGET_PROP_CACHE", NULL} -#define STMT_154 \ +#define STMT_CREATE_TARGET_PROP_CACHE 155 +#define STMT_155_INFO {"STMT_CREATE_TARGET_PROP_CACHE", NULL} +#define STMT_155 \ "DROP TABLE IF EXISTS target_prop_cache; " \ "CREATE TEMPORARY TABLE target_prop_cache ( " \ " local_relpath TEXT NOT NULL PRIMARY KEY, " \ @@ -1581,9 +1590,9 @@ "); " \ "" -#define STMT_CACHE_TARGET_PROPS 155 -#define STMT_155_INFO {"STMT_CACHE_TARGET_PROPS", NULL} -#define STMT_155 \ +#define STMT_CACHE_TARGET_PROPS 156 +#define STMT_156_INFO {"STMT_CACHE_TARGET_PROPS", NULL} +#define STMT_156 \ "INSERT INTO target_prop_cache(local_relpath, kind, properties) " \ " SELECT n.local_relpath, n.kind, " \ " IFNULL((SELECT properties FROM actual_node AS a " \ @@ -1602,9 +1611,9 @@ " ORDER BY t.local_relpath " \ "" -#define STMT_CACHE_TARGET_PRISTINE_PROPS 156 -#define STMT_156_INFO {"STMT_CACHE_TARGET_PRISTINE_PROPS", NULL} -#define STMT_156 \ +#define STMT_CACHE_TARGET_PRISTINE_PROPS 157 +#define STMT_157_INFO {"STMT_CACHE_TARGET_PRISTINE_PROPS", NULL} +#define STMT_157 \ "INSERT INTO target_prop_cache(local_relpath, kind, properties) " \ " SELECT n.local_relpath, n.kind, " \ " CASE n.presence " \ @@ -1629,22 +1638,22 @@ " ORDER BY t.local_relpath " \ "" -#define STMT_SELECT_ALL_TARGET_PROP_CACHE 157 -#define STMT_157_INFO {"STMT_SELECT_ALL_TARGET_PROP_CACHE", NULL} -#define STMT_157 \ +#define STMT_SELECT_ALL_TARGET_PROP_CACHE 158 +#define STMT_158_INFO {"STMT_SELECT_ALL_TARGET_PROP_CACHE", NULL} +#define STMT_158 \ "SELECT local_relpath, properties FROM target_prop_cache " \ "ORDER BY local_relpath " \ "" -#define STMT_DROP_TARGET_PROP_CACHE 158 -#define STMT_158_INFO {"STMT_DROP_TARGET_PROP_CACHE", NULL} -#define STMT_158 \ +#define STMT_DROP_TARGET_PROP_CACHE 159 +#define STMT_159_INFO {"STMT_DROP_TARGET_PROP_CACHE", NULL} +#define STMT_159 \ "DROP TABLE target_prop_cache; " \ "" -#define STMT_CREATE_REVERT_LIST 159 -#define STMT_159_INFO {"STMT_CREATE_REVERT_LIST", NULL} -#define STMT_159 \ +#define STMT_CREATE_REVERT_LIST 160 +#define STMT_160_INFO {"STMT_CREATE_REVERT_LIST", NULL} +#define STMT_160 \ "DROP TABLE IF EXISTS revert_list; " \ "CREATE TEMPORARY TABLE revert_list ( " \ " local_relpath TEXT NOT NULL, " \ @@ -1700,26 +1709,26 @@ "END " \ "" -#define STMT_DROP_REVERT_LIST_TRIGGERS 160 -#define STMT_160_INFO {"STMT_DROP_REVERT_LIST_TRIGGERS", NULL} -#define STMT_160 \ +#define STMT_DROP_REVERT_LIST_TRIGGERS 161 +#define STMT_161_INFO {"STMT_DROP_REVERT_LIST_TRIGGERS", NULL} +#define STMT_161 \ "DROP TRIGGER trigger_revert_list_nodes; " \ "DROP TRIGGER trigger_revert_list_actual_delete; " \ "DROP TRIGGER trigger_revert_list_actual_update " \ "" -#define STMT_SELECT_REVERT_LIST 161 -#define STMT_161_INFO {"STMT_SELECT_REVERT_LIST", NULL} -#define STMT_161 \ +#define STMT_SELECT_REVERT_LIST 162 +#define STMT_162_INFO {"STMT_SELECT_REVERT_LIST", NULL} +#define STMT_162 \ "SELECT actual, notify, kind, op_depth, repos_id, conflict_data " \ "FROM revert_list " \ "WHERE local_relpath = ?1 " \ "ORDER BY actual DESC " \ "" -#define STMT_SELECT_REVERT_LIST_COPIED_CHILDREN 162 -#define STMT_162_INFO {"STMT_SELECT_REVERT_LIST_COPIED_CHILDREN", NULL} -#define STMT_162 \ +#define STMT_SELECT_REVERT_LIST_COPIED_CHILDREN 163 +#define STMT_163_INFO {"STMT_SELECT_REVERT_LIST_COPIED_CHILDREN", NULL} +#define STMT_163 \ "SELECT local_relpath, kind " \ "FROM revert_list " \ "WHERE (((local_relpath) > (CASE (?1) WHEN '' THEN '' ELSE (?1) || '/' END)) AND ((local_relpath) < CASE (?1) WHEN '' THEN X'FFFF' ELSE (?1) || '0' END)) " \ @@ -1728,15 +1737,15 @@ "ORDER BY local_relpath " \ "" -#define STMT_DELETE_REVERT_LIST 163 -#define STMT_163_INFO {"STMT_DELETE_REVERT_LIST", NULL} -#define STMT_163 \ +#define STMT_DELETE_REVERT_LIST 164 +#define STMT_164_INFO {"STMT_DELETE_REVERT_LIST", NULL} +#define STMT_164 \ "DELETE FROM revert_list WHERE local_relpath = ?1 " \ "" -#define STMT_SELECT_REVERT_LIST_RECURSIVE 164 -#define STMT_164_INFO {"STMT_SELECT_REVERT_LIST_RECURSIVE", NULL} -#define STMT_164 \ +#define STMT_SELECT_REVERT_LIST_RECURSIVE 165 +#define STMT_165_INFO {"STMT_SELECT_REVERT_LIST_RECURSIVE", NULL} +#define STMT_165 \ "SELECT DISTINCT local_relpath " \ "FROM revert_list " \ "WHERE (local_relpath = ?1 " \ @@ -1745,32 +1754,32 @@ "ORDER BY local_relpath " \ "" -#define STMT_DELETE_REVERT_LIST_RECURSIVE 165 -#define STMT_165_INFO {"STMT_DELETE_REVERT_LIST_RECURSIVE", NULL} -#define STMT_165 \ +#define STMT_DELETE_REVERT_LIST_RECURSIVE 166 +#define STMT_166_INFO {"STMT_DELETE_REVERT_LIST_RECURSIVE", NULL} +#define STMT_166 \ "DELETE FROM revert_list " \ "WHERE (local_relpath = ?1 " \ " OR (((local_relpath) > (CASE (?1) WHEN '' THEN '' ELSE (?1) || '/' END)) AND ((local_relpath) < CASE (?1) WHEN '' THEN X'FFFF' ELSE (?1) || '0' END))) " \ "" -#define STMT_DROP_REVERT_LIST 166 -#define STMT_166_INFO {"STMT_DROP_REVERT_LIST", NULL} -#define STMT_166 \ +#define STMT_DROP_REVERT_LIST 167 +#define STMT_167_INFO {"STMT_DROP_REVERT_LIST", NULL} +#define STMT_167 \ "DROP TABLE IF EXISTS revert_list " \ "" -#define STMT_CREATE_DELETE_LIST 167 -#define STMT_167_INFO {"STMT_CREATE_DELETE_LIST", NULL} -#define STMT_167 \ +#define STMT_CREATE_DELETE_LIST 168 +#define STMT_168_INFO {"STMT_CREATE_DELETE_LIST", NULL} +#define STMT_168 \ "DROP TABLE IF EXISTS delete_list; " \ "CREATE TEMPORARY TABLE delete_list ( " \ " local_relpath TEXT PRIMARY KEY NOT NULL UNIQUE " \ " ) " \ "" -#define STMT_INSERT_DELETE_LIST 168 -#define STMT_168_INFO {"STMT_INSERT_DELETE_LIST", NULL} -#define STMT_168 \ +#define STMT_INSERT_DELETE_LIST 169 +#define STMT_169_INFO {"STMT_INSERT_DELETE_LIST", NULL} +#define STMT_169 \ "INSERT INTO delete_list(local_relpath) " \ "SELECT local_relpath FROM nodes AS n " \ "WHERE wc_id = ?1 " \ @@ -1784,22 +1793,22 @@ " AND file_external IS NULL " \ "" -#define STMT_SELECT_DELETE_LIST 169 -#define STMT_169_INFO {"STMT_SELECT_DELETE_LIST", NULL} -#define STMT_169 \ +#define STMT_SELECT_DELETE_LIST 170 +#define STMT_170_INFO {"STMT_SELECT_DELETE_LIST", NULL} +#define STMT_170 \ "SELECT local_relpath FROM delete_list " \ "ORDER BY local_relpath " \ "" -#define STMT_FINALIZE_DELETE 170 -#define STMT_170_INFO {"STMT_FINALIZE_DELETE", NULL} -#define STMT_170 \ +#define STMT_FINALIZE_DELETE 171 +#define STMT_171_INFO {"STMT_FINALIZE_DELETE", NULL} +#define STMT_171 \ "DROP TABLE IF EXISTS delete_list " \ "" -#define STMT_CREATE_UPDATE_MOVE_LIST 171 -#define STMT_171_INFO {"STMT_CREATE_UPDATE_MOVE_LIST", NULL} -#define STMT_171 \ +#define STMT_CREATE_UPDATE_MOVE_LIST 172 +#define STMT_172_INFO {"STMT_CREATE_UPDATE_MOVE_LIST", NULL} +#define STMT_172 \ "DROP TABLE IF EXISTS update_move_list; " \ "CREATE TEMPORARY TABLE update_move_list ( " \ " local_relpath TEXT PRIMARY KEY NOT NULL UNIQUE, " \ @@ -1810,31 +1819,31 @@ " ) " \ "" -#define STMT_INSERT_UPDATE_MOVE_LIST 172 -#define STMT_172_INFO {"STMT_INSERT_UPDATE_MOVE_LIST", NULL} -#define STMT_172 \ +#define STMT_INSERT_UPDATE_MOVE_LIST 173 +#define STMT_173_INFO {"STMT_INSERT_UPDATE_MOVE_LIST", NULL} +#define STMT_173 \ "INSERT INTO update_move_list(local_relpath, action, kind, content_state, " \ " prop_state) " \ "VALUES (?1, ?2, ?3, ?4, ?5) " \ "" -#define STMT_SELECT_UPDATE_MOVE_LIST 173 -#define STMT_173_INFO {"STMT_SELECT_UPDATE_MOVE_LIST", NULL} -#define STMT_173 \ +#define STMT_SELECT_UPDATE_MOVE_LIST 174 +#define STMT_174_INFO {"STMT_SELECT_UPDATE_MOVE_LIST", NULL} +#define STMT_174 \ "SELECT local_relpath, action, kind, content_state, prop_state " \ "FROM update_move_list " \ "ORDER BY local_relpath " \ "" -#define STMT_FINALIZE_UPDATE_MOVE 174 -#define STMT_174_INFO {"STMT_FINALIZE_UPDATE_MOVE", NULL} -#define STMT_174 \ +#define STMT_FINALIZE_UPDATE_MOVE 175 +#define STMT_175_INFO {"STMT_FINALIZE_UPDATE_MOVE", NULL} +#define STMT_175 \ "DROP TABLE IF EXISTS update_move_list " \ "" -#define STMT_SELECT_MIN_MAX_REVISIONS 175 -#define STMT_175_INFO {"STMT_SELECT_MIN_MAX_REVISIONS", NULL} -#define STMT_175 \ +#define STMT_SELECT_MIN_MAX_REVISIONS 176 +#define STMT_176_INFO {"STMT_SELECT_MIN_MAX_REVISIONS", NULL} +#define STMT_176 \ "SELECT MIN(revision), MAX(revision), " \ " MIN(changed_revision), MAX(changed_revision) FROM nodes " \ " WHERE wc_id = ?1 " \ @@ -1845,9 +1854,9 @@ " AND op_depth = 0 " \ "" -#define STMT_HAS_SPARSE_NODES 176 -#define STMT_176_INFO {"STMT_HAS_SPARSE_NODES", NULL} -#define STMT_176 \ +#define STMT_HAS_SPARSE_NODES 177 +#define STMT_177_INFO {"STMT_HAS_SPARSE_NODES", NULL} +#define STMT_177 \ "SELECT 1 FROM nodes " \ "WHERE wc_id = ?1 " \ " AND (local_relpath = ?2 " \ @@ -1859,9 +1868,9 @@ "LIMIT 1 " \ "" -#define STMT_SUBTREE_HAS_TREE_MODIFICATIONS 177 -#define STMT_177_INFO {"STMT_SUBTREE_HAS_TREE_MODIFICATIONS", NULL} -#define STMT_177 \ +#define STMT_SUBTREE_HAS_TREE_MODIFICATIONS 178 +#define STMT_178_INFO {"STMT_SUBTREE_HAS_TREE_MODIFICATIONS", NULL} +#define STMT_178 \ "SELECT 1 FROM nodes " \ "WHERE wc_id = ?1 " \ " AND (local_relpath = ?2 " \ @@ -1870,9 +1879,9 @@ "LIMIT 1 " \ "" -#define STMT_SUBTREE_HAS_PROP_MODIFICATIONS 178 -#define STMT_178_INFO {"STMT_SUBTREE_HAS_PROP_MODIFICATIONS", NULL} -#define STMT_178 \ +#define STMT_SUBTREE_HAS_PROP_MODIFICATIONS 179 +#define STMT_179_INFO {"STMT_SUBTREE_HAS_PROP_MODIFICATIONS", NULL} +#define STMT_179 \ "SELECT 1 FROM actual_node " \ "WHERE wc_id = ?1 " \ " AND (local_relpath = ?2 " \ @@ -1881,9 +1890,9 @@ "LIMIT 1 " \ "" -#define STMT_HAS_SWITCHED 179 -#define STMT_179_INFO {"STMT_HAS_SWITCHED", NULL} -#define STMT_179 \ +#define STMT_HAS_SWITCHED 180 +#define STMT_180_INFO {"STMT_HAS_SWITCHED", NULL} +#define STMT_180 \ "SELECT 1 " \ "FROM nodes " \ "WHERE wc_id = ?1 " \ @@ -1895,9 +1904,9 @@ "LIMIT 1 " \ "" -#define STMT_SELECT_BASE_FILES_RECURSIVE 180 -#define STMT_180_INFO {"STMT_SELECT_BASE_FILES_RECURSIVE", NULL} -#define STMT_180 \ +#define STMT_SELECT_BASE_FILES_RECURSIVE 181 +#define STMT_181_INFO {"STMT_SELECT_BASE_FILES_RECURSIVE", NULL} +#define STMT_181 \ "SELECT local_relpath, translated_size, last_mod_time FROM nodes AS n " \ "WHERE wc_id = ?1 " \ " AND (local_relpath = ?2 " \ @@ -1908,75 +1917,92 @@ " AND file_external IS NULL " \ "" -#define STMT_SELECT_MOVED_FROM_RELPATH 181 -#define STMT_181_INFO {"STMT_SELECT_MOVED_FROM_RELPATH", NULL} -#define STMT_181 \ +#define STMT_SELECT_MOVED_FROM_RELPATH 182 +#define STMT_182_INFO {"STMT_SELECT_MOVED_FROM_RELPATH", NULL} +#define STMT_182 \ "SELECT local_relpath, op_depth FROM nodes " \ "WHERE wc_id = ?1 AND moved_to = ?2 AND op_depth > 0 " \ "" -#define STMT_UPDATE_MOVED_TO_RELPATH 182 -#define STMT_182_INFO {"STMT_UPDATE_MOVED_TO_RELPATH", NULL} -#define STMT_182 \ +#define STMT_UPDATE_MOVED_TO_RELPATH 183 +#define STMT_183_INFO {"STMT_UPDATE_MOVED_TO_RELPATH", NULL} +#define STMT_183 \ "UPDATE nodes SET moved_to = ?4 " \ "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3 " \ "" -#define STMT_CLEAR_MOVED_TO_RELPATH 183 -#define STMT_183_INFO {"STMT_CLEAR_MOVED_TO_RELPATH", NULL} -#define STMT_183 \ +#define STMT_CLEAR_MOVED_TO_RELPATH 184 +#define STMT_184_INFO {"STMT_CLEAR_MOVED_TO_RELPATH", NULL} +#define STMT_184 \ "UPDATE nodes SET moved_to = NULL " \ "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3 " \ "" -#define STMT_CLEAR_MOVED_HERE_RECURSIVE 184 -#define STMT_184_INFO {"STMT_CLEAR_MOVED_HERE_RECURSIVE", NULL} -#define STMT_184 \ +#define STMT_CLEAR_MOVED_HERE_RECURSIVE 185 +#define STMT_185_INFO {"STMT_CLEAR_MOVED_HERE_RECURSIVE", NULL} +#define STMT_185 \ "UPDATE nodes SET moved_here = NULL " \ "WHERE wc_id = ?1 " \ " AND (local_relpath = ?2 OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \ " AND op_depth = ?3 " \ "" -#define STMT_SELECT_MOVED_HERE_CHILDREN 185 -#define STMT_185_INFO {"STMT_SELECT_MOVED_HERE_CHILDREN", NULL} -#define STMT_185 \ +#define STMT_SELECT_MOVED_HERE_CHILDREN 186 +#define STMT_186_INFO {"STMT_SELECT_MOVED_HERE_CHILDREN", NULL} +#define STMT_186 \ "SELECT moved_to, local_relpath FROM nodes " \ "WHERE wc_id = ?1 AND op_depth > 0 " \ " AND (((moved_to) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((moved_to) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \ "" -#define STMT_SELECT_MOVED_FOR_DELETE 186 -#define STMT_186_INFO {"STMT_SELECT_MOVED_FOR_DELETE", NULL} -#define STMT_186 \ - "SELECT local_relpath, moved_to, op_depth FROM nodes " \ +#define STMT_SELECT_MOVED_FOR_DELETE 187 +#define STMT_187_INFO {"STMT_SELECT_MOVED_FOR_DELETE", NULL} +#define STMT_187 \ + "SELECT local_relpath, moved_to, op_depth, " \ + " (SELECT CASE WHEN r.moved_here THEN r.op_depth END FROM nodes r " \ + " WHERE r.wc_id = ?1 " \ + " AND r.local_relpath = n.local_relpath " \ + " AND r.op_depth < n.op_depth " \ + " ORDER BY r.op_depth DESC LIMIT 1) AS moved_here_op_depth " \ + " FROM nodes n " \ "WHERE wc_id = ?1 " \ " AND (local_relpath = ?2 OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \ " AND moved_to IS NOT NULL " \ - " AND op_depth >= (SELECT MAX(op_depth) FROM nodes o " \ - " WHERE o.wc_id = ?1 " \ - " AND o.local_relpath = ?2) " \ + " AND op_depth >= ?3 " \ "" -#define STMT_UPDATE_MOVED_TO_DESCENDANTS 187 -#define STMT_187_INFO {"STMT_UPDATE_MOVED_TO_DESCENDANTS", NULL} -#define STMT_187 \ +#define STMT_SELECT_MOVED_FROM_FOR_DELETE 188 +#define STMT_188_INFO {"STMT_SELECT_MOVED_FROM_FOR_DELETE", NULL} +#define STMT_188 \ + "SELECT local_relpath, op_depth, " \ + " (SELECT CASE WHEN r.moved_here THEN r.op_depth END FROM nodes r " \ + " WHERE r.wc_id = ?1 " \ + " AND r.local_relpath = n.local_relpath " \ + " AND r.op_depth < n.op_depth " \ + " ORDER BY r.op_depth DESC LIMIT 1) AS moved_here_op_depth " \ + " FROM nodes n " \ + "WHERE wc_id = ?1 AND moved_to = ?2 AND op_depth > 0 " \ + "" + +#define STMT_UPDATE_MOVED_TO_DESCENDANTS 189 +#define STMT_189_INFO {"STMT_UPDATE_MOVED_TO_DESCENDANTS", NULL} +#define STMT_189 \ "UPDATE nodes SET moved_to = (CASE WHEN (?2) = '' THEN (CASE WHEN (?3) = '' THEN (moved_to) WHEN (moved_to) = '' THEN (?3) ELSE (?3) || '/' || (moved_to) END) WHEN (?3) = '' THEN (CASE WHEN (?2) = '' THEN (moved_to) WHEN SUBSTR((moved_to), 1, LENGTH(?2)) = (?2) THEN CASE WHEN LENGTH(?2) = LENGTH(moved_to) THEN '' WHEN SUBSTR((moved_to), LENGTH(?2)+1, 1) = '/' THEN SUBSTR((moved_to), LENGTH(?2)+2) END END) WHEN SUBSTR((moved_to), 1, LENGTH(?2)) = (?2) THEN CASE WHEN LENGTH(?2) = LENGTH(moved_to) THEN (?3) WHEN SUBSTR((moved_to), LENGTH(?2)+1, 1) = '/' THEN (?3) || SUBSTR((moved_to), LENGTH(?2)+1) END END) " \ " WHERE wc_id = ?1 " \ " AND (((moved_to) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((moved_to) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \ "" -#define STMT_CLEAR_MOVED_TO_DESCENDANTS 188 -#define STMT_188_INFO {"STMT_CLEAR_MOVED_TO_DESCENDANTS", NULL} -#define STMT_188 \ +#define STMT_CLEAR_MOVED_TO_DESCENDANTS 190 +#define STMT_190_INFO {"STMT_CLEAR_MOVED_TO_DESCENDANTS", NULL} +#define STMT_190 \ "UPDATE nodes SET moved_to = NULL " \ " WHERE wc_id = ?1 " \ " AND (((moved_to) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((moved_to) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \ "" -#define STMT_SELECT_MOVED_PAIR2 189 -#define STMT_189_INFO {"STMT_SELECT_MOVED_PAIR2", NULL} -#define STMT_189 \ +#define STMT_SELECT_MOVED_PAIR2 191 +#define STMT_191_INFO {"STMT_SELECT_MOVED_PAIR2", NULL} +#define STMT_191 \ "SELECT local_relpath, moved_to, op_depth FROM nodes " \ "WHERE wc_id = ?1 " \ " AND (local_relpath = ?2 OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \ @@ -1987,9 +2013,9 @@ " AND o.local_relpath = ?2) " \ "" -#define STMT_SELECT_MOVED_PAIR3 190 -#define STMT_190_INFO {"STMT_SELECT_MOVED_PAIR3", NULL} -#define STMT_190 \ +#define STMT_SELECT_MOVED_PAIR3 192 +#define STMT_192_INFO {"STMT_SELECT_MOVED_PAIR3", NULL} +#define STMT_192 \ "SELECT local_relpath, moved_to, op_depth, kind FROM nodes " \ "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > ?3 " \ " AND moved_to IS NOT NULL " \ @@ -2002,9 +2028,9 @@ "ORDER BY local_relpath, op_depth " \ "" -#define STMT_SELECT_MOVED_OUTSIDE 191 -#define STMT_191_INFO {"STMT_SELECT_MOVED_OUTSIDE", NULL} -#define STMT_191 \ +#define STMT_SELECT_MOVED_OUTSIDE 193 +#define STMT_193_INFO {"STMT_SELECT_MOVED_OUTSIDE", NULL} +#define STMT_193 \ "SELECT local_relpath, moved_to, op_depth FROM nodes " \ "WHERE wc_id = ?1 " \ " AND (local_relpath = ?2 OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \ @@ -2013,9 +2039,9 @@ " AND NOT (((moved_to) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((moved_to) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \ "" -#define STMT_SELECT_OP_DEPTH_MOVED_PAIR 192 -#define STMT_192_INFO {"STMT_SELECT_OP_DEPTH_MOVED_PAIR", NULL} -#define STMT_192 \ +#define STMT_SELECT_OP_DEPTH_MOVED_PAIR 194 +#define STMT_194_INFO {"STMT_SELECT_OP_DEPTH_MOVED_PAIR", NULL} +#define STMT_194 \ "SELECT n.local_relpath, n.moved_to, " \ " (SELECT o.repos_path FROM nodes AS o " \ " WHERE o.wc_id = n.wc_id " \ @@ -2028,9 +2054,9 @@ " AND n.moved_to IS NOT NULL " \ "" -#define STMT_SELECT_MOVED_DESCENDANTS 193 -#define STMT_193_INFO {"STMT_SELECT_MOVED_DESCENDANTS", NULL} -#define STMT_193 \ +#define STMT_SELECT_MOVED_DESCENDANTS 195 +#define STMT_195_INFO {"STMT_SELECT_MOVED_DESCENDANTS", NULL} +#define STMT_195 \ "SELECT n.local_relpath, h.moved_to " \ "FROM nodes n, nodes h " \ "WHERE n.wc_id = ?1 " \ @@ -2046,9 +2072,9 @@ " AND h.moved_to IS NOT NULL " \ "" -#define STMT_COMMIT_UPDATE_ORIGIN 194 -#define STMT_194_INFO {"STMT_COMMIT_UPDATE_ORIGIN", NULL} -#define STMT_194 \ +#define STMT_COMMIT_UPDATE_ORIGIN 196 +#define STMT_196_INFO {"STMT_COMMIT_UPDATE_ORIGIN", NULL} +#define STMT_196 \ "UPDATE nodes SET repos_id = ?4, " \ " repos_path = ?5 || SUBSTR(local_relpath, LENGTH(?2)+1), " \ " revision = ?6 " \ @@ -2058,16 +2084,16 @@ " AND op_depth = ?3 " \ "" -#define STMT_HAS_LAYER_BETWEEN 195 -#define STMT_195_INFO {"STMT_HAS_LAYER_BETWEEN", NULL} -#define STMT_195 \ +#define STMT_HAS_LAYER_BETWEEN 197 +#define STMT_197_INFO {"STMT_HAS_LAYER_BETWEEN", NULL} +#define STMT_197 \ "SELECT 1 FROM NODES " \ "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > ?3 AND op_depth < ?4 " \ "" -#define STMT_SELECT_REPOS_PATH_REVISION 196 -#define STMT_196_INFO {"STMT_SELECT_REPOS_PATH_REVISION", NULL} -#define STMT_196 \ +#define STMT_SELECT_REPOS_PATH_REVISION 198 +#define STMT_198_INFO {"STMT_SELECT_REPOS_PATH_REVISION", NULL} +#define STMT_198 \ "SELECT local_relpath, repos_path, revision FROM nodes " \ "WHERE wc_id = ?1 " \ " AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \ @@ -2075,16 +2101,16 @@ "ORDER BY local_relpath " \ "" -#define STMT_SELECT_HAS_NON_FILE_CHILDREN 197 -#define STMT_197_INFO {"STMT_SELECT_HAS_NON_FILE_CHILDREN", NULL} -#define STMT_197 \ +#define STMT_SELECT_HAS_NON_FILE_CHILDREN 199 +#define STMT_199_INFO {"STMT_SELECT_HAS_NON_FILE_CHILDREN", NULL} +#define STMT_199 \ "SELECT 1 FROM nodes " \ "WHERE wc_id = ?1 AND parent_relpath = ?2 AND op_depth = 0 AND kind != 'file' " \ "" -#define STMT_SELECT_HAS_GRANDCHILDREN 198 -#define STMT_198_INFO {"STMT_SELECT_HAS_GRANDCHILDREN", NULL} -#define STMT_198 \ +#define STMT_SELECT_HAS_GRANDCHILDREN 200 +#define STMT_200_INFO {"STMT_SELECT_HAS_GRANDCHILDREN", NULL} +#define STMT_200 \ "SELECT 1 FROM nodes " \ "WHERE wc_id = ?1 " \ " AND (((parent_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((parent_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \ @@ -2092,33 +2118,33 @@ " AND file_external IS NULL " \ "" -#define STMT_SELECT_ALL_NODES 199 -#define STMT_199_INFO {"STMT_SELECT_ALL_NODES", NULL} -#define STMT_199 \ +#define STMT_SELECT_ALL_NODES 201 +#define STMT_201_INFO {"STMT_SELECT_ALL_NODES", NULL} +#define STMT_201 \ "SELECT op_depth, local_relpath, parent_relpath, file_external FROM nodes " \ "WHERE wc_id = ?1 " \ "" -#define STMT_SELECT_IPROPS 200 -#define STMT_200_INFO {"STMT_SELECT_IPROPS", NULL} -#define STMT_200 \ +#define STMT_SELECT_IPROPS 202 +#define STMT_202_INFO {"STMT_SELECT_IPROPS", NULL} +#define STMT_202 \ "SELECT inherited_props FROM nodes " \ "WHERE wc_id = ?1 " \ " AND local_relpath = ?2 " \ " AND op_depth = 0 " \ "" -#define STMT_UPDATE_IPROP 201 -#define STMT_201_INFO {"STMT_UPDATE_IPROP", NULL} -#define STMT_201 \ +#define STMT_UPDATE_IPROP 203 +#define STMT_203_INFO {"STMT_UPDATE_IPROP", NULL} +#define STMT_203 \ "UPDATE nodes " \ "SET inherited_props = ?3 " \ "WHERE (wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0) " \ "" -#define STMT_SELECT_IPROPS_NODE 202 -#define STMT_202_INFO {"STMT_SELECT_IPROPS_NODE", NULL} -#define STMT_202 \ +#define STMT_SELECT_IPROPS_NODE 204 +#define STMT_204_INFO {"STMT_SELECT_IPROPS_NODE", NULL} +#define STMT_204 \ "SELECT local_relpath, repos_path FROM nodes " \ "WHERE wc_id = ?1 " \ " AND local_relpath = ?2 " \ @@ -2126,9 +2152,9 @@ " AND (inherited_props not null) " \ "" -#define STMT_SELECT_IPROPS_RECURSIVE 203 -#define STMT_203_INFO {"STMT_SELECT_IPROPS_RECURSIVE", NULL} -#define STMT_203 \ +#define STMT_SELECT_IPROPS_RECURSIVE 205 +#define STMT_205_INFO {"STMT_SELECT_IPROPS_RECURSIVE", NULL} +#define STMT_205 \ "SELECT local_relpath, repos_path FROM nodes " \ "WHERE wc_id = ?1 " \ " AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \ @@ -2136,9 +2162,9 @@ " AND (inherited_props not null) " \ "" -#define STMT_SELECT_IPROPS_CHILDREN 204 -#define STMT_204_INFO {"STMT_SELECT_IPROPS_CHILDREN", NULL} -#define STMT_204 \ +#define STMT_SELECT_IPROPS_CHILDREN 206 +#define STMT_206_INFO {"STMT_SELECT_IPROPS_CHILDREN", NULL} +#define STMT_206 \ "SELECT local_relpath, repos_path FROM nodes " \ "WHERE wc_id = ?1 " \ " AND parent_relpath = ?2 " \ @@ -2146,9 +2172,9 @@ " AND (inherited_props not null) " \ "" -#define STMT_CREATE_SCHEMA 205 -#define STMT_205_INFO {"STMT_CREATE_SCHEMA", NULL} -#define STMT_205 \ +#define STMT_CREATE_SCHEMA 207 +#define STMT_207_INFO {"STMT_CREATE_SCHEMA", NULL} +#define STMT_207 \ "CREATE TABLE REPOSITORY ( " \ " id INTEGER PRIMARY KEY AUTOINCREMENT, " \ " root TEXT UNIQUE NOT NULL, " \ @@ -2213,9 +2239,9 @@ "; " \ "" -#define STMT_CREATE_NODES 206 -#define STMT_206_INFO {"STMT_CREATE_NODES", NULL} -#define STMT_206 \ +#define STMT_CREATE_NODES 208 +#define STMT_208_INFO {"STMT_CREATE_NODES", NULL} +#define STMT_208 \ "CREATE TABLE NODES ( " \ " wc_id INTEGER NOT NULL REFERENCES WCROOT (id), " \ " local_relpath TEXT NOT NULL, " \ @@ -2255,9 +2281,9 @@ " WHERE op_depth = 0; " \ "" -#define STMT_CREATE_NODES_TRIGGERS 207 -#define STMT_207_INFO {"STMT_CREATE_NODES_TRIGGERS", NULL} -#define STMT_207 \ +#define STMT_CREATE_NODES_TRIGGERS 209 +#define STMT_209_INFO {"STMT_CREATE_NODES_TRIGGERS", NULL} +#define STMT_209 \ "CREATE TRIGGER nodes_insert_trigger " \ "AFTER INSERT ON nodes " \ "WHEN NEW.checksum IS NOT NULL " \ @@ -2283,9 +2309,9 @@ "END; " \ "" -#define STMT_CREATE_EXTERNALS 208 -#define STMT_208_INFO {"STMT_CREATE_EXTERNALS", NULL} -#define STMT_208 \ +#define STMT_CREATE_EXTERNALS 210 +#define STMT_210_INFO {"STMT_CREATE_EXTERNALS", NULL} +#define STMT_210 \ "CREATE TABLE EXTERNALS ( " \ " wc_id INTEGER NOT NULL REFERENCES WCROOT (id), " \ " local_relpath TEXT NOT NULL, " \ @@ -2304,10 +2330,12 @@ " local_relpath); " \ "" -#define STMT_INSTALL_SCHEMA_STATISTICS 209 -#define STMT_209_INFO {"STMT_INSTALL_SCHEMA_STATISTICS", NULL} -#define STMT_209 \ +#define STMT_INSTALL_SCHEMA_STATISTICS 211 +#define STMT_211_INFO {"STMT_INSTALL_SCHEMA_STATISTICS", NULL} +#define STMT_211 \ "ANALYZE sqlite_master; " \ + "DELETE FROM sqlite_stat1 " \ + "WHERE tbl in ('NODES', 'ACTUAL_NODE', 'LOCK', 'WC_LOCK'); " \ "INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES " \ " ('NODES', 'sqlite_autoindex_NODES_1', '8000 8000 2 1'); " \ "INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES " \ @@ -2325,9 +2353,9 @@ "ANALYZE sqlite_master; " \ "" -#define STMT_UPGRADE_TO_20 210 -#define STMT_210_INFO {"STMT_UPGRADE_TO_20", NULL} -#define STMT_210 \ +#define STMT_UPGRADE_TO_20 212 +#define STMT_212_INFO {"STMT_UPGRADE_TO_20", NULL} +#define STMT_212 \ "UPDATE BASE_NODE SET checksum = (SELECT checksum FROM pristine " \ " WHERE md5_checksum = BASE_NODE.checksum) " \ "WHERE EXISTS (SELECT 1 FROM pristine WHERE md5_checksum = BASE_NODE.checksum); " \ @@ -2368,59 +2396,59 @@ "PRAGMA user_version = 20; " \ "" -#define STMT_UPGRADE_TO_21 211 -#define STMT_211_INFO {"STMT_UPGRADE_TO_21", NULL} -#define STMT_211 \ +#define STMT_UPGRADE_TO_21 213 +#define STMT_213_INFO {"STMT_UPGRADE_TO_21", NULL} +#define STMT_213 \ "PRAGMA user_version = 21; " \ "" -#define STMT_UPGRADE_21_SELECT_OLD_TREE_CONFLICT 212 -#define STMT_212_INFO {"STMT_UPGRADE_21_SELECT_OLD_TREE_CONFLICT", NULL} -#define STMT_212 \ +#define STMT_UPGRADE_21_SELECT_OLD_TREE_CONFLICT 214 +#define STMT_214_INFO {"STMT_UPGRADE_21_SELECT_OLD_TREE_CONFLICT", NULL} +#define STMT_214 \ "SELECT wc_id, local_relpath, tree_conflict_data " \ "FROM actual_node " \ "WHERE tree_conflict_data IS NOT NULL " \ "" -#define STMT_UPGRADE_21_ERASE_OLD_CONFLICTS 213 -#define STMT_213_INFO {"STMT_UPGRADE_21_ERASE_OLD_CONFLICTS", NULL} -#define STMT_213 \ +#define STMT_UPGRADE_21_ERASE_OLD_CONFLICTS 215 +#define STMT_215_INFO {"STMT_UPGRADE_21_ERASE_OLD_CONFLICTS", NULL} +#define STMT_215 \ "UPDATE actual_node SET tree_conflict_data = NULL " \ "" -#define STMT_UPGRADE_TO_22 214 -#define STMT_214_INFO {"STMT_UPGRADE_TO_22", NULL} -#define STMT_214 \ +#define STMT_UPGRADE_TO_22 216 +#define STMT_216_INFO {"STMT_UPGRADE_TO_22", NULL} +#define STMT_216 \ "UPDATE actual_node SET tree_conflict_data = conflict_data; " \ "UPDATE actual_node SET conflict_data = NULL; " \ "PRAGMA user_version = 22; " \ "" -#define STMT_UPGRADE_TO_23 215 -#define STMT_215_INFO {"STMT_UPGRADE_TO_23", NULL} -#define STMT_215 \ +#define STMT_UPGRADE_TO_23 217 +#define STMT_217_INFO {"STMT_UPGRADE_TO_23", NULL} +#define STMT_217 \ "PRAGMA user_version = 23; " \ "" -#define STMT_UPGRADE_23_HAS_WORKING_NODES 216 -#define STMT_216_INFO {"STMT_UPGRADE_23_HAS_WORKING_NODES", NULL} -#define STMT_216 \ +#define STMT_UPGRADE_23_HAS_WORKING_NODES 218 +#define STMT_218_INFO {"STMT_UPGRADE_23_HAS_WORKING_NODES", NULL} +#define STMT_218 \ "SELECT 1 FROM nodes WHERE op_depth > 0 " \ "LIMIT 1 " \ "" -#define STMT_UPGRADE_TO_24 217 -#define STMT_217_INFO {"STMT_UPGRADE_TO_24", NULL} -#define STMT_217 \ +#define STMT_UPGRADE_TO_24 219 +#define STMT_219_INFO {"STMT_UPGRADE_TO_24", NULL} +#define STMT_219 \ "UPDATE pristine SET refcount = " \ " (SELECT COUNT(*) FROM nodes " \ " WHERE checksum = pristine.checksum ); " \ "PRAGMA user_version = 24; " \ "" -#define STMT_UPGRADE_TO_25 218 -#define STMT_218_INFO {"STMT_UPGRADE_TO_25", NULL} -#define STMT_218 \ +#define STMT_UPGRADE_TO_25 220 +#define STMT_220_INFO {"STMT_UPGRADE_TO_25", NULL} +#define STMT_220 \ "DROP VIEW IF EXISTS NODES_CURRENT; " \ "CREATE VIEW NODES_CURRENT AS " \ " SELECT * FROM nodes " \ @@ -2432,9 +2460,9 @@ "PRAGMA user_version = 25; " \ "" -#define STMT_UPGRADE_TO_26 219 -#define STMT_219_INFO {"STMT_UPGRADE_TO_26", NULL} -#define STMT_219 \ +#define STMT_UPGRADE_TO_26 221 +#define STMT_221_INFO {"STMT_UPGRADE_TO_26", NULL} +#define STMT_221 \ "DROP VIEW IF EXISTS NODES_BASE; " \ "CREATE VIEW NODES_BASE AS " \ " SELECT * FROM nodes " \ @@ -2442,15 +2470,15 @@ "PRAGMA user_version = 26; " \ "" -#define STMT_UPGRADE_TO_27 220 -#define STMT_220_INFO {"STMT_UPGRADE_TO_27", NULL} -#define STMT_220 \ +#define STMT_UPGRADE_TO_27 222 +#define STMT_222_INFO {"STMT_UPGRADE_TO_27", NULL} +#define STMT_222 \ "PRAGMA user_version = 27; " \ "" -#define STMT_UPGRADE_27_HAS_ACTUAL_NODES_CONFLICTS 221 -#define STMT_221_INFO {"STMT_UPGRADE_27_HAS_ACTUAL_NODES_CONFLICTS", NULL} -#define STMT_221 \ +#define STMT_UPGRADE_27_HAS_ACTUAL_NODES_CONFLICTS 223 +#define STMT_223_INFO {"STMT_UPGRADE_27_HAS_ACTUAL_NODES_CONFLICTS", NULL} +#define STMT_223 \ "SELECT 1 FROM actual_node " \ "WHERE NOT ((prop_reject IS NULL) AND (conflict_old IS NULL) " \ " AND (conflict_new IS NULL) AND (conflict_working IS NULL) " \ @@ -2458,18 +2486,18 @@ "LIMIT 1 " \ "" -#define STMT_UPGRADE_TO_28 222 -#define STMT_222_INFO {"STMT_UPGRADE_TO_28", NULL} -#define STMT_222 \ +#define STMT_UPGRADE_TO_28 224 +#define STMT_224_INFO {"STMT_UPGRADE_TO_28", NULL} +#define STMT_224 \ "UPDATE NODES SET checksum = (SELECT checksum FROM pristine " \ " WHERE md5_checksum = nodes.checksum) " \ "WHERE EXISTS (SELECT 1 FROM pristine WHERE md5_checksum = nodes.checksum); " \ "PRAGMA user_version = 28; " \ "" -#define STMT_UPGRADE_TO_29 223 -#define STMT_223_INFO {"STMT_UPGRADE_TO_29", NULL} -#define STMT_223 \ +#define STMT_UPGRADE_TO_29 225 +#define STMT_225_INFO {"STMT_UPGRADE_TO_29", NULL} +#define STMT_225 \ "DROP TRIGGER IF EXISTS nodes_update_checksum_trigger; " \ "DROP TRIGGER IF EXISTS nodes_insert_trigger; " \ "DROP TRIGGER IF EXISTS nodes_delete_trigger; " \ @@ -2499,9 +2527,9 @@ "PRAGMA user_version = 29; " \ "" -#define STMT_UPGRADE_TO_30 224 -#define STMT_224_INFO {"STMT_UPGRADE_TO_30", NULL} -#define STMT_224 \ +#define STMT_UPGRADE_TO_30 226 +#define STMT_226_INFO {"STMT_UPGRADE_TO_30", NULL} +#define STMT_226 \ "CREATE UNIQUE INDEX IF NOT EXISTS I_NODES_MOVED " \ "ON NODES (wc_id, moved_to, op_depth); " \ "CREATE INDEX IF NOT EXISTS I_PRISTINE_MD5 ON PRISTINE (md5_checksum); " \ @@ -2509,9 +2537,9 @@ "UPDATE nodes SET file_external=1 WHERE file_external IS NOT NULL; " \ "" -#define STMT_UPGRADE_30_SELECT_CONFLICT_SEPARATE 225 -#define STMT_225_INFO {"STMT_UPGRADE_30_SELECT_CONFLICT_SEPARATE", NULL} -#define STMT_225 \ +#define STMT_UPGRADE_30_SELECT_CONFLICT_SEPARATE 227 +#define STMT_227_INFO {"STMT_UPGRADE_30_SELECT_CONFLICT_SEPARATE", NULL} +#define STMT_227 \ "SELECT wc_id, local_relpath, " \ " conflict_old, conflict_working, conflict_new, prop_reject, tree_conflict_data " \ "FROM actual_node " \ @@ -2523,24 +2551,24 @@ "ORDER by wc_id, local_relpath " \ "" -#define STMT_UPGRADE_30_SET_CONFLICT 226 -#define STMT_226_INFO {"STMT_UPGRADE_30_SET_CONFLICT", NULL} -#define STMT_226 \ +#define STMT_UPGRADE_30_SET_CONFLICT 228 +#define STMT_228_INFO {"STMT_UPGRADE_30_SET_CONFLICT", NULL} +#define STMT_228 \ "UPDATE actual_node SET conflict_data = ?3, conflict_old = NULL, " \ " conflict_working = NULL, conflict_new = NULL, prop_reject = NULL, " \ " tree_conflict_data = NULL " \ "WHERE wc_id = ?1 and local_relpath = ?2 " \ "" -#define STMT_UPGRADE_TO_31_ALTER_TABLE 227 -#define STMT_227_INFO {"STMT_UPGRADE_TO_31_ALTER_TABLE", NULL} -#define STMT_227 \ +#define STMT_UPGRADE_TO_31_ALTER_TABLE 229 +#define STMT_229_INFO {"STMT_UPGRADE_TO_31_ALTER_TABLE", NULL} +#define STMT_229 \ "ALTER TABLE NODES ADD COLUMN inherited_props BLOB; " \ "" -#define STMT_UPGRADE_TO_31_FINALIZE 228 -#define STMT_228_INFO {"STMT_UPGRADE_TO_31_FINALIZE", NULL} -#define STMT_228 \ +#define STMT_UPGRADE_TO_31_FINALIZE 230 +#define STMT_230_INFO {"STMT_UPGRADE_TO_31_FINALIZE", NULL} +#define STMT_230 \ "DROP INDEX IF EXISTS I_ACTUAL_CHANGELIST; " \ "DROP INDEX IF EXISTS I_EXTERNALS_PARENT; " \ "DROP INDEX I_NODES_PARENT; " \ @@ -2552,9 +2580,9 @@ "PRAGMA user_version = 31; " \ "" -#define STMT_UPGRADE_31_SELECT_WCROOT_NODES 229 -#define STMT_229_INFO {"STMT_UPGRADE_31_SELECT_WCROOT_NODES", NULL} -#define STMT_229 \ +#define STMT_UPGRADE_31_SELECT_WCROOT_NODES 231 +#define STMT_231_INFO {"STMT_UPGRADE_31_SELECT_WCROOT_NODES", NULL} +#define STMT_231 \ "SELECT l.wc_id, l.local_relpath FROM nodes as l " \ "LEFT OUTER JOIN nodes as r " \ "ON l.wc_id = r.wc_id " \ @@ -2566,9 +2594,9 @@ " OR (l.repos_path IS NOT (CASE WHEN (r.local_relpath) = '' THEN (CASE WHEN (r.repos_path) = '' THEN (l.local_relpath) WHEN (l.local_relpath) = '' THEN (r.repos_path) ELSE (r.repos_path) || '/' || (l.local_relpath) END) WHEN (r.repos_path) = '' THEN (CASE WHEN (r.local_relpath) = '' THEN (l.local_relpath) WHEN SUBSTR((l.local_relpath), 1, LENGTH(r.local_relpath)) = (r.local_relpath) THEN CASE WHEN LENGTH(r.local_relpath) = LENGTH(l.local_relpath) THEN '' WHEN SUBSTR((l.local_relpath), LENGTH(r.local_relpath)+1, 1) = '/' THEN SUBSTR((l.local_relpath), LENGTH(r.local_relpath)+2) END END) WHEN SUBSTR((l.local_relpath), 1, LENGTH(r.local_relpath)) = (r.local_relpath) THEN CASE WHEN LENGTH(r.local_relpath) = LENGTH(l.local_relpath) THEN (r.repos_path) WHEN SUBSTR((l.local_relpath), LENGTH(r.local_relpath)+1, 1) = '/' THEN (r.repos_path) || SUBSTR((l.local_relpath), LENGTH(r.local_relpath)+1) END END))) " \ "" -#define STMT_UPGRADE_TO_32 230 -#define STMT_230_INFO {"STMT_UPGRADE_TO_32", NULL} -#define STMT_230 \ +#define STMT_UPGRADE_TO_32 232 +#define STMT_232_INFO {"STMT_UPGRADE_TO_32", NULL} +#define STMT_232 \ "DROP INDEX IF EXISTS I_ACTUAL_CHANGELIST; " \ "DROP INDEX IF EXISTS I_EXTERNALS_PARENT; " \ "CREATE INDEX I_EXTERNALS_PARENT ON EXTERNALS (wc_id, parent_relpath); " \ @@ -2621,9 +2649,9 @@ "DROP TABLE ACTUAL_NODE_BACKUP; " \ "" -#define STMT_VERIFICATION_TRIGGERS 231 -#define STMT_231_INFO {"STMT_VERIFICATION_TRIGGERS", NULL} -#define STMT_231 \ +#define STMT_VERIFICATION_TRIGGERS 233 +#define STMT_233_INFO {"STMT_VERIFICATION_TRIGGERS", NULL} +#define STMT_233 \ "CREATE TEMPORARY TRIGGER no_repository_updates BEFORE UPDATE ON repository " \ "BEGIN " \ " SELECT RAISE(FAIL, 'Updates to REPOSITORY are not allowed.'); " \ @@ -2896,6 +2924,8 @@ STMT_229, \ STMT_230, \ STMT_231, \ + STMT_232, \ + STMT_233, \ NULL \ } @@ -3133,5 +3163,7 @@ STMT_229_INFO, \ STMT_230_INFO, \ STMT_231_INFO, \ + STMT_232_INFO, \ + STMT_233_INFO, \ {NULL, NULL} \ } diff --git a/contrib/subversion/subversion/libsvn_wc/wc-queries.sql b/contrib/subversion/subversion/libsvn_wc/wc-queries.sql index a8388a3a289..0ced98c79c2 100644 --- a/contrib/subversion/subversion/libsvn_wc/wc-queries.sql +++ b/contrib/subversion/subversion/libsvn_wc/wc-queries.sql @@ -191,7 +191,7 @@ WHERE wc_id = ?1 -- STMT_DELETE_NODE DELETE FROM NODES -WHERE wc_id = ?1 AND local_relpath = ?2 +WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3 -- STMT_DELETE_ACTUAL_FOR_BASE_RECURSIVE /* The ACTUAL_NODE applies to BASE, unless there is in at least one op_depth @@ -417,6 +417,12 @@ LEFT OUTER JOIN nodes AS moved WHERE work.wc_id = ?1 AND work.local_relpath = ?2 AND work.op_depth > 0 LIMIT 1 +-- STMT_SELECT_MOVED_TO_NODE +SELECT op_depth, moved_to +FROM nodes +WHERE wc_id = ?1 AND local_relpath = ?2 AND moved_to IS NOT NULL +ORDER BY op_depth DESC + -- STMT_SELECT_OP_DEPTH_MOVED_TO SELECT op_depth, moved_to, repos_path, revision FROM nodes @@ -711,7 +717,7 @@ WHERE wc_id = ?1 AND local_relpath = ?2 WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > ?3) AND presence = MAP_BASE_DELETED --- STMT_DELETE_ALL_LAYERS +-- STMT_DELETE_NODE_ALL_LAYERS DELETE FROM nodes WHERE wc_id = ?1 AND local_relpath = ?2 @@ -1503,7 +1509,6 @@ WHERE wc_id = ?1 AND presence=MAP_NORMAL AND file_external IS NULL -/* ### FIXME: op-depth? What about multiple moves? */ -- STMT_SELECT_MOVED_FROM_RELPATH SELECT local_relpath, op_depth FROM nodes WHERE wc_id = ?1 AND moved_to = ?2 AND op_depth > 0 @@ -1530,14 +1535,31 @@ SELECT moved_to, local_relpath FROM nodes WHERE wc_id = ?1 AND op_depth > 0 AND IS_STRICT_DESCENDANT_OF(moved_to, ?2) +/* If the node is moved here (r.moved_here = 1) we are really interested in + where the node was moved from. To obtain that we need the op_depth, but + this form of select only allows a single return value */ -- STMT_SELECT_MOVED_FOR_DELETE -SELECT local_relpath, moved_to, op_depth FROM nodes +SELECT local_relpath, moved_to, op_depth, + (SELECT CASE WHEN r.moved_here THEN r.op_depth END FROM nodes r + WHERE r.wc_id = ?1 + AND r.local_relpath = n.local_relpath + AND r.op_depth < n.op_depth + ORDER BY r.op_depth DESC LIMIT 1) AS moved_here_op_depth + FROM nodes n WHERE wc_id = ?1 AND (local_relpath = ?2 OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2)) AND moved_to IS NOT NULL - AND op_depth >= (SELECT MAX(op_depth) FROM nodes o - WHERE o.wc_id = ?1 - AND o.local_relpath = ?2) + AND op_depth >= ?3 + +-- STMT_SELECT_MOVED_FROM_FOR_DELETE +SELECT local_relpath, op_depth, + (SELECT CASE WHEN r.moved_here THEN r.op_depth END FROM nodes r + WHERE r.wc_id = ?1 + AND r.local_relpath = n.local_relpath + AND r.op_depth < n.op_depth + ORDER BY r.op_depth DESC LIMIT 1) AS moved_here_op_depth + FROM nodes n +WHERE wc_id = ?1 AND moved_to = ?2 AND op_depth > 0 -- STMT_UPDATE_MOVED_TO_DESCENDANTS UPDATE nodes SET moved_to = RELPATH_SKIP_JOIN(?2, ?3, moved_to) diff --git a/contrib/subversion/subversion/libsvn_wc/wc_db.c b/contrib/subversion/subversion/libsvn_wc/wc_db.c index 7d038cf57fb..81056c9a4a6 100644 --- a/contrib/subversion/subversion/libsvn_wc/wc_db.c +++ b/contrib/subversion/subversion/libsvn_wc/wc_db.c @@ -627,6 +627,10 @@ svn_wc__db_extend_parent_delete(svn_wc__db_wcroot_t *wcroot, When removing a node if the parent has a higher working node then the parent node and this node are both deleted or replaced and any delete over this node must be removed. + + This function (like most wcroot functions) assumes that its caller + only uses this function within an sqlite transaction if atomic + behavior is needed. */ svn_error_t * svn_wc__db_retract_parent_delete(svn_wc__db_wcroot_t *wcroot, @@ -635,14 +639,60 @@ svn_wc__db_retract_parent_delete(svn_wc__db_wcroot_t *wcroot, apr_pool_t *scratch_pool) { svn_sqlite__stmt_t *stmt; + svn_boolean_t have_row; + int working_depth; + svn_wc__db_status_t presence; + const char *moved_to; SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, - STMT_DELETE_LOWEST_WORKING_NODE)); + STMT_SELECT_LOWEST_WORKING_NODE)); SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, local_relpath, op_depth)); - SVN_ERR(svn_sqlite__step_done(stmt)); + SVN_ERR(svn_sqlite__step(&have_row, stmt)); - return SVN_NO_ERROR; + if (!have_row) + return svn_error_trace(svn_sqlite__reset(stmt)); + + working_depth = svn_sqlite__column_int(stmt, 0); + presence = svn_sqlite__column_token(stmt, 1, presence_map); + moved_to = svn_sqlite__column_text(stmt, 3, scratch_pool); + + SVN_ERR(svn_sqlite__reset(stmt)); + + if (moved_to) + { + /* Turn the move into a copy to keep the NODES table valid */ + SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, + STMT_CLEAR_MOVED_HERE_RECURSIVE)); + SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, + moved_to, relpath_depth(moved_to))); + SVN_ERR(svn_sqlite__step_done(stmt)); + + /* This leaves just the moved_to information on the origin, + which we will remove in the next step */ + } + + if (presence == svn_wc__db_status_base_deleted) + { + /* Nothing left to shadow; remove the base-deleted node */ + SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, STMT_DELETE_NODE)); + } + else if (moved_to) + { + /* Clear moved to information, as this node is no longer base-deleted */ + SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, + STMT_CLEAR_MOVED_TO_RELPATH)); + } + else + { + /* Nothing to update */ + return SVN_NO_ERROR; + } + + SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, local_relpath, + working_depth)); + + return svn_error_trace(svn_sqlite__update(NULL, stmt)); } @@ -4076,8 +4126,9 @@ get_info_for_copy(apr_int64_t *copyfrom_id, svn_wc__db_status_t *status, svn_node_kind_t *kind, svn_boolean_t *op_root, - svn_wc__db_wcroot_t *wcroot, + svn_wc__db_wcroot_t *src_wcroot, const char *local_relpath, + svn_wc__db_wcroot_t *dst_wcroot, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { @@ -4094,7 +4145,7 @@ get_info_for_copy(apr_int64_t *copyfrom_id, NULL /* have_base */, NULL /* have_more_work */, NULL /* have_work */, - wcroot, local_relpath, result_pool, scratch_pool)); + src_wcroot, local_relpath, result_pool, scratch_pool)); if (op_root) *op_root = is_op_root; @@ -4109,7 +4160,7 @@ get_info_for_copy(apr_int64_t *copyfrom_id, scratch_pool); SVN_ERR(get_info_for_copy(copyfrom_id, copyfrom_relpath, copyfrom_rev, NULL, NULL, NULL, - wcroot, parent_relpath, + src_wcroot, parent_relpath, dst_wcroot, scratch_pool, scratch_pool)); if (*copyfrom_relpath) *copyfrom_relpath = svn_relpath_join(*copyfrom_relpath, base_name, @@ -4118,7 +4169,7 @@ get_info_for_copy(apr_int64_t *copyfrom_id, else if (node_status == svn_wc__db_status_added) { SVN_ERR(scan_addition(&node_status, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, wcroot, local_relpath, + NULL, NULL, NULL, src_wcroot, local_relpath, scratch_pool, scratch_pool)); } else if (node_status == svn_wc__db_status_deleted && is_op_root) @@ -4127,7 +4178,7 @@ get_info_for_copy(apr_int64_t *copyfrom_id, SVN_ERR(scan_deletion_txn(&base_del_relpath, NULL, &work_del_relpath, - NULL, wcroot, local_relpath, + NULL, src_wcroot, local_relpath, scratch_pool, scratch_pool)); if (work_del_relpath) { @@ -4140,7 +4191,8 @@ get_info_for_copy(apr_int64_t *copyfrom_id, SVN_ERR(scan_addition(NULL, &op_root_relpath, NULL, NULL, /* repos_* */ copyfrom_relpath, copyfrom_id, copyfrom_rev, - NULL, NULL, NULL, wcroot, parent_del_relpath, + NULL, NULL, NULL, + src_wcroot, parent_del_relpath, scratch_pool, scratch_pool)); *copyfrom_relpath = svn_relpath_join(*copyfrom_relpath, @@ -4155,7 +4207,7 @@ get_info_for_copy(apr_int64_t *copyfrom_id, copyfrom_id, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - wcroot, local_relpath, + src_wcroot, local_relpath, result_pool, scratch_pool)); } @@ -4177,6 +4229,24 @@ get_info_for_copy(apr_int64_t *copyfrom_id, if (status) *status = node_status; + if (src_wcroot != dst_wcroot && *copyfrom_relpath) + { + const char *repos_root_url; + const char *repos_uuid; + + /* Pass the right repos-id for the destination db. We can't just use + the id of the source database, as this value can change after + relocation (and perhaps also when we start storing multiple + working copies in a single db)! */ + + SVN_ERR(svn_wc__db_fetch_repos_info(&repos_root_url, &repos_uuid, + src_wcroot->sdb, *copyfrom_id, + scratch_pool)); + + SVN_ERR(create_repos_id(copyfrom_id, repos_root_url, repos_uuid, + dst_wcroot->sdb, scratch_pool)); + } + return SVN_NO_ERROR; } @@ -4336,8 +4406,9 @@ db_op_copy(svn_wc__db_wcroot_t *src_wcroot, const apr_array_header_t *children; SVN_ERR(get_info_for_copy(©from_id, ©from_relpath, ©from_rev, - &status, &kind, &op_root, src_wcroot, - src_relpath, scratch_pool, scratch_pool)); + &status, &kind, &op_root, + src_wcroot, src_relpath, dst_wcroot, + scratch_pool, scratch_pool)); SVN_ERR(op_depth_for_copy(&dst_op_depth, &dst_np_op_depth, &dst_parent_op_depth, @@ -4562,21 +4633,6 @@ db_op_copy(svn_wc__db_wcroot_t *src_wcroot, } else { - if (copyfrom_relpath) - { - const char *repos_root_url; - const char *repos_uuid; - - /* Pass the right repos-id for the destination db! */ - - SVN_ERR(svn_wc__db_fetch_repos_info(&repos_root_url, &repos_uuid, - src_wcroot->sdb, copyfrom_id, - scratch_pool)); - - SVN_ERR(create_repos_id(©from_id, repos_root_url, repos_uuid, - dst_wcroot->sdb, scratch_pool)); - } - SVN_ERR(cross_db_copy(src_wcroot, src_relpath, dst_wcroot, dst_relpath, dst_presence, dst_op_depth, dst_np_op_depth, kind, @@ -7176,7 +7232,7 @@ remove_node_txn(svn_boolean_t *left_changes, if (local_relpath[0] != '\0') { SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, - STMT_DELETE_NODE)); + STMT_DELETE_NODE_ALL_LAYERS)); SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath)); SVN_ERR(svn_sqlite__step_done(stmt)); } @@ -7487,8 +7543,86 @@ struct moved_node_t { /* The op-depth of the deleted node at the source of the move. */ int op_depth; + + /* When >= 1 the op_depth at which local_relpath was moved to its + location. Used to find its original location outside the delete */ + int moved_from_depth; }; +/* Helper function to resolve the original location of local_relpath at OP_DEPTH + before it was moved into the tree rooted at ROOT_RELPATH. */ +static svn_error_t * +resolve_moved_from(const char **moved_from_relpath, + int *moved_from_op_depth, + svn_wc__db_wcroot_t *wcroot, + const char *root_relpath, + const char *local_relpath, + int op_depth, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) +{ + const char *suffix = ""; + svn_sqlite__stmt_t *stmt; + const char *m_from_relpath; + int m_from_op_depth; + int m_move_from_depth; + svn_boolean_t have_row; + + while (relpath_depth(local_relpath) > op_depth) + { + const char *name; + svn_relpath_split(&local_relpath, &name, local_relpath, scratch_pool); + suffix = svn_relpath_join(suffix, name, scratch_pool); + } + + SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, + STMT_SELECT_MOVED_FROM_FOR_DELETE)); + SVN_ERR(svn_sqlite__bindf(stmt, "is", + wcroot->wc_id, local_relpath)); + SVN_ERR(svn_sqlite__step(&have_row, stmt)); + + if (!have_row) + { + /* assert(have_row); */ + *moved_from_relpath = NULL; + *moved_from_op_depth = -1; + + SVN_ERR(svn_sqlite__reset(stmt)); + + return SVN_NO_ERROR; + } + + m_from_relpath = svn_sqlite__column_text(stmt, 0, scratch_pool); + m_from_op_depth = svn_sqlite__column_int(stmt, 1); + m_move_from_depth = svn_sqlite__column_int(stmt, 2); + + SVN_ERR(svn_sqlite__reset(stmt)); + + if (! svn_relpath_skip_ancestor(root_relpath, m_from_relpath)) + { + *moved_from_relpath = svn_relpath_join(m_from_relpath, suffix, + result_pool); + *moved_from_op_depth = m_from_op_depth; /* ### Ok? */ + return SVN_NO_ERROR; + } + else if (!m_move_from_depth) + { + *moved_from_relpath = NULL; + *moved_from_op_depth = -1; + return SVN_NO_ERROR; + } + + return svn_error_trace( + resolve_moved_from(moved_from_relpath, + moved_from_op_depth, + wcroot, + root_relpath, + svn_relpath_join(m_from_relpath, suffix, + scratch_pool), + m_move_from_depth, + result_pool, scratch_pool)); +} + static svn_error_t * delete_node(void *baton, svn_wc__db_wcroot_t *wcroot, @@ -7500,19 +7634,70 @@ delete_node(void *baton, svn_boolean_t have_row, op_root; svn_boolean_t add_work = FALSE; svn_sqlite__stmt_t *stmt; - int select_depth; /* Depth of what is to be deleted */ - svn_boolean_t refetch_depth = FALSE; + int working_op_depth; /* Depth of what is to be deleted */ + int keep_op_depth = 0; /* Depth of what is below what is deleted */ svn_node_kind_t kind; apr_array_header_t *moved_nodes = NULL; - int delete_depth = relpath_depth(local_relpath); + int delete_op_depth = relpath_depth(local_relpath); - SVN_ERR(read_info(&status, - &kind, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - &op_root, NULL, NULL, - NULL, NULL, NULL, - wcroot, local_relpath, - scratch_pool, scratch_pool)); + assert(*local_relpath); /* Can't delete wcroot */ + + SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, + STMT_SELECT_NODE_INFO)); + SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath)); + SVN_ERR(svn_sqlite__step(&have_row, stmt)); + + if (!have_row) + { + return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, + svn_sqlite__reset(stmt), + _("The node '%s' was not found."), + path_for_error_message(wcroot, + local_relpath, + scratch_pool)); + } + + working_op_depth = svn_sqlite__column_int(stmt, 0); + status = svn_sqlite__column_token(stmt, 3, presence_map); + kind = svn_sqlite__column_token(stmt, 4, kind_map); + + if (working_op_depth < delete_op_depth) + { + op_root = FALSE; + add_work = TRUE; + keep_op_depth = working_op_depth; + } + else + { + op_root = TRUE; + + SVN_ERR(svn_sqlite__step(&have_row, stmt)); + + if (have_row) + { + svn_wc__db_status_t below_status; + int below_op_depth; + + below_op_depth = svn_sqlite__column_int(stmt, 0); + below_status = svn_sqlite__column_token(stmt, 3, presence_map); + + if (below_status != svn_wc__db_status_not_present + && below_status != svn_wc__db_status_base_deleted) + { + add_work = TRUE; + keep_op_depth = below_op_depth; + } + else + keep_op_depth = 0; + } + else + keep_op_depth = -1; + } + + SVN_ERR(svn_sqlite__reset(stmt)); + + if (working_op_depth != 0) /* WORKING */ + SVN_ERR(convert_to_working_status(&status, status)); if (status == svn_wc__db_status_deleted || status == svn_wc__db_status_not_present) @@ -7591,6 +7776,7 @@ delete_node(void *baton, part, scratch_pool); moved_node->op_depth = move_op_depth; moved_node->moved_to_relpath = b->moved_to_relpath; + moved_node->moved_from_depth = -1; APR_ARRAY_PUSH(moved_nodes, const struct moved_node_t *) = moved_node; } @@ -7602,8 +7788,9 @@ delete_node(void *baton, * possibly because of a nested move operation. */ moved_node = apr_palloc(scratch_pool, sizeof(struct moved_node_t)); moved_node->local_relpath = local_relpath; - moved_node->op_depth = delete_depth; + moved_node->op_depth = delete_op_depth; moved_node->moved_to_relpath = b->moved_to_relpath; + moved_node->moved_from_depth = -1; APR_ARRAY_PUSH(moved_nodes, const struct moved_node_t *) = moved_node; } @@ -7618,24 +7805,18 @@ delete_node(void *baton, b->moved_to_relpath)); SVN_ERR(svn_sqlite__update(NULL, stmt)); } - else - { - SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, - STMT_CLEAR_MOVED_TO_DESCENDANTS)); - SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, - local_relpath)); - SVN_ERR(svn_sqlite__update(NULL, stmt)); - } /* Find children that were moved out of the subtree rooted at this node. * We'll need to update their op-depth columns because their deletion * is now implied by the deletion of their parent (i.e. this node). */ { apr_pool_t *iterpool; + int i; SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, STMT_SELECT_MOVED_FOR_DELETE)); - SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath)); + SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, local_relpath, + delete_op_depth)); SVN_ERR(svn_sqlite__step(&have_row, stmt)); iterpool = svn_pool_create(scratch_pool); @@ -7645,52 +7826,85 @@ delete_node(void *baton, const char *child_relpath = svn_sqlite__column_text(stmt, 0, NULL); const char *mv_to_relpath = svn_sqlite__column_text(stmt, 1, NULL); int child_op_depth = svn_sqlite__column_int(stmt, 2); + int moved_from_depth = -1; svn_boolean_t fixup = FALSE; - if (!b->moved_to_relpath + if (! b->moved_to_relpath && ! svn_relpath_skip_ancestor(local_relpath, mv_to_relpath)) { - /* Update the op-depth of an moved node below this tree */ - fixup = TRUE; - child_op_depth = delete_depth; - } - else if (b->moved_to_relpath - && delete_depth == child_op_depth) - { - /* Update the op-depth of a tree shadowed by this tree */ - fixup = TRUE; - child_op_depth = delete_depth; - } - else if (b->moved_to_relpath - && child_op_depth >= delete_depth - && !svn_relpath_skip_ancestor(local_relpath, mv_to_relpath)) - { - /* Update the move destination of something that is now moved - away further */ + /* a NULL moved_here_depth will be reported as 0 */ + int moved_here_depth = svn_sqlite__column_int(stmt, 3); - child_relpath = svn_relpath_skip_ancestor(local_relpath, child_relpath); + /* Plain delete. Fixup move information of descendants that were + moved here, or that were moved out */ - if (child_relpath) + if (moved_here_depth >= delete_op_depth) { - child_relpath = svn_relpath_join(b->moved_to_relpath, child_relpath, scratch_pool); + /* The move we recorded here must be moved to the location + this node had before it was moved here. - if (child_op_depth > delete_depth - && svn_relpath_skip_ancestor(local_relpath, child_relpath)) - child_op_depth = delete_depth; - else - child_op_depth = relpath_depth(child_relpath); + This might contain multiple steps when the node was moved + in several places within the to be deleted tree */ + /* ### TODO: Add logic */ fixup = TRUE; + moved_from_depth = moved_here_depth; + } + else + { + /* Update the op-depth of an moved away node that was + registered as moved by the records that we are about + to delete */ + fixup = TRUE; + child_op_depth = delete_op_depth; + } + } + else if (b->moved_to_relpath) + { + /* The node is moved to a new location */ + + if (delete_op_depth == child_op_depth) + { + /* Update the op-depth of a tree shadowed by this tree */ + fixup = TRUE; + /*child_op_depth = delete_depth;*/ + } + else if (child_op_depth >= delete_op_depth + && !svn_relpath_skip_ancestor(local_relpath, + mv_to_relpath)) + { + /* Update the move destination of something that is now moved + away further */ + + child_relpath = svn_relpath_skip_ancestor(local_relpath, + child_relpath); + + if (child_relpath) + { + child_relpath = svn_relpath_join(b->moved_to_relpath, + child_relpath, + scratch_pool); + + if (child_op_depth > delete_op_depth + && svn_relpath_skip_ancestor(local_relpath, + child_relpath)) + child_op_depth = delete_op_depth; + else + child_op_depth = relpath_depth(child_relpath); + + fixup = TRUE; + } } } if (fixup) { - mn = apr_pcalloc(scratch_pool, sizeof(struct moved_node_t)); + mn = apr_palloc(scratch_pool, sizeof(struct moved_node_t)); mn->local_relpath = apr_pstrdup(scratch_pool, child_relpath); mn->moved_to_relpath = apr_pstrdup(scratch_pool, mv_to_relpath); mn->op_depth = child_op_depth; + mn->moved_from_depth = moved_from_depth; if (!moved_nodes) moved_nodes = apr_array_make(scratch_pool, 1, @@ -7700,58 +7914,67 @@ delete_node(void *baton, SVN_ERR(svn_sqlite__step(&have_row, stmt)); } - svn_pool_destroy(iterpool); SVN_ERR(svn_sqlite__reset(stmt)); - } - if (op_root) - { - svn_boolean_t below_base; - svn_boolean_t below_work; - svn_wc__db_status_t below_status; - - /* Use STMT_SELECT_NODE_INFO directly instead of read_info plus - info_below_working */ - SVN_ERR(info_below_working(&below_base, &below_work, &below_status, - wcroot, local_relpath, -1, scratch_pool)); - if ((below_base || below_work) - && below_status != svn_wc__db_status_not_present - && below_status != svn_wc__db_status_deleted) + for (i = 0; moved_nodes && (i < moved_nodes->nelts); i++) { - add_work = TRUE; - refetch_depth = TRUE; + struct moved_node_t *mn = APR_ARRAY_IDX(moved_nodes, i, + struct moved_node_t *); + + if (mn->moved_from_depth > 0) + { + svn_pool_clear(iterpool); + + SVN_ERR(resolve_moved_from(&mn->local_relpath, &mn->op_depth, + wcroot, local_relpath, + mn->local_relpath, + mn->moved_from_depth, + scratch_pool, iterpool)); + + if (!mn->local_relpath) + svn_sort__array_delete(moved_nodes, i--, 1); + } } - select_depth = relpath_depth(local_relpath); + svn_pool_destroy(iterpool); } - else + + if (!b->moved_to_relpath) { - add_work = TRUE; - if (status != svn_wc__db_status_normal) - SVN_ERR(op_depth_of(&select_depth, wcroot, local_relpath)); - else - select_depth = 0; /* Deleting BASE node */ + SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, + STMT_CLEAR_MOVED_TO_DESCENDANTS)); + SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, + local_relpath)); + SVN_ERR(svn_sqlite__update(NULL, stmt)); + + if (op_root) + { + SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, + STMT_CLEAR_MOVED_TO_FROM_DEST)); + SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, + local_relpath)); + + SVN_ERR(svn_sqlite__update(NULL, stmt)); + } } + /* ### Put actual-only nodes into the list? */ if (b->notify) { SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, STMT_INSERT_DELETE_LIST)); SVN_ERR(svn_sqlite__bindf(stmt, "isd", - wcroot->wc_id, local_relpath, select_depth)); + wcroot->wc_id, local_relpath, working_op_depth)); SVN_ERR(svn_sqlite__step_done(stmt)); } SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, STMT_DELETE_NODES_ABOVE_DEPTH_RECURSIVE)); SVN_ERR(svn_sqlite__bindf(stmt, "isd", - wcroot->wc_id, local_relpath, delete_depth)); + wcroot->wc_id, local_relpath, delete_op_depth)); SVN_ERR(svn_sqlite__step_done(stmt)); - if (refetch_depth) - SVN_ERR(op_depth_of(&select_depth, wcroot, local_relpath)); - /* Delete ACTUAL_NODE rows, but leave those that have changelist and a NODES row. */ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, @@ -7781,7 +8004,7 @@ delete_node(void *baton, STMT_INSERT_DELETE_FROM_NODE_RECURSIVE)); SVN_ERR(svn_sqlite__bindf(stmt, "isdd", wcroot->wc_id, local_relpath, - select_depth, delete_depth)); + keep_op_depth, delete_op_depth)); SVN_ERR(svn_sqlite__step_done(stmt)); } @@ -8680,7 +8903,11 @@ read_children_info(svn_wc__db_wcroot_t *wcroot, else child->op_root = (op_depth == relpath_depth(child_relpath)); - svn_hash_sets(nodes, apr_pstrdup(result_pool, name), child); + if (op_depth && child->op_root) + child_item->info.moved_here = svn_sqlite__column_boolean(stmt, 20); + + if (new_child) + svn_hash_sets(nodes, apr_pstrdup(result_pool, name), child); } if (op_depth == 0) @@ -8702,18 +8929,48 @@ read_children_info(svn_wc__db_wcroot_t *wcroot, child_item->nr_layers++; child_item->info.have_more_work = (child_item->nr_layers > 1); - /* Moved-to can only exist at op_depth > 0. */ - /* ### Should we really do this for every layer where op_depth > 0 - in undefined order? */ + + /* A local_relpath can be moved multiple times at different op + depths and it really depends on the caller what is interesting. + We provide a simple linked list with the moved_from information */ + moved_to_relpath = svn_sqlite__column_text(stmt, 21, NULL); if (moved_to_relpath) - child_item->info.moved_to_abspath = - svn_dirent_join(wcroot->abspath, moved_to_relpath, result_pool); + { + struct svn_wc__db_moved_to_info_t *moved_to; + struct svn_wc__db_moved_to_info_t **next; + const char *shadow_op_relpath; + int cur_op_depth; - /* Moved-here can only exist at op_depth > 0. */ - /* ### Should we really do this for every layer where op_depth > 0 - in undefined order? */ - child_item->info.moved_here = svn_sqlite__column_boolean(stmt, 20); + moved_to = apr_pcalloc(result_pool, sizeof(*moved_to)); + moved_to->moved_to_abspath = svn_dirent_join(wcroot->abspath, + moved_to_relpath, + result_pool); + + cur_op_depth = relpath_depth(child_relpath); + shadow_op_relpath = child_relpath; + + while (cur_op_depth > op_depth) + { + shadow_op_relpath = svn_relpath_dirname(shadow_op_relpath, + scratch_pool); + cur_op_depth--; + } + + moved_to->shadow_op_root_abspath = + svn_dirent_join(wcroot->abspath, shadow_op_relpath, + result_pool); + + next = &child_item->info.moved_to; + + while (*next && + 0 < strcmp((*next)->shadow_op_root_abspath, + moved_to->shadow_op_root_abspath)) + next = &((*next)->next); + + moved_to->next = *next; + *next = moved_to; + } } SVN_ERR(svn_sqlite__step(&have_row, stmt)); @@ -8801,6 +9058,178 @@ svn_wc__db_read_children_info(apr_hash_t **nodes, return SVN_NO_ERROR; } +static svn_error_t * +db_read_props(apr_hash_t **props, + svn_wc__db_wcroot_t *wcroot, + const char *local_relpath, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + +static svn_error_t * +read_single_info(const struct svn_wc__db_info_t **info, + svn_wc__db_wcroot_t *wcroot, + const char *local_relpath, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) +{ + struct svn_wc__db_info_t *mtb; + apr_int64_t repos_id; + const svn_checksum_t *checksum; + const char *original_repos_relpath; + svn_boolean_t have_work; + + mtb = apr_pcalloc(result_pool, sizeof(*mtb)); + + SVN_ERR(read_info(&mtb->status, &mtb->kind, &mtb->revnum, + &mtb->repos_relpath, &repos_id, &mtb->changed_rev, + &mtb->changed_date, &mtb->changed_author, &mtb->depth, + &checksum, NULL, &original_repos_relpath, NULL, NULL, + &mtb->lock, &mtb->recorded_size, &mtb->recorded_time, + &mtb->changelist, &mtb->conflicted, &mtb->op_root, + &mtb->had_props, &mtb->props_mod, &mtb->have_base, + &mtb->have_more_work, &have_work, + wcroot, local_relpath, + result_pool, scratch_pool)); + + /* Query the same rows in the database again for move information */ + if (have_work && (mtb->have_base || mtb->have_more_work)) + { + svn_sqlite__stmt_t *stmt; + svn_boolean_t have_row; + const char *cur_relpath = NULL; + int cur_op_depth; + + SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, + STMT_SELECT_MOVED_TO_NODE)); + SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath)); + + SVN_ERR(svn_sqlite__step(&have_row, stmt)); + + while (have_row) + { + struct svn_wc__db_moved_to_info_t *move; + int op_depth = svn_sqlite__column_int(stmt, 0); + const char *moved_to_relpath = svn_sqlite__column_text(stmt, 1, NULL); + + move = apr_pcalloc(result_pool, sizeof(*move)); + move->moved_to_abspath = svn_dirent_join(wcroot->abspath, + moved_to_relpath, + result_pool); + + if (!cur_relpath) + { + cur_relpath = local_relpath; + cur_op_depth = relpath_depth(cur_relpath); + } + while (cur_op_depth > op_depth) + { + cur_relpath = svn_relpath_dirname(cur_relpath, scratch_pool); + cur_op_depth--; + } + move->shadow_op_root_abspath = svn_dirent_join(wcroot->abspath, + cur_relpath, + result_pool); + + move->next = mtb->moved_to; + mtb->moved_to = move; + + SVN_ERR(svn_sqlite__step(&have_row, stmt)); + } + + SVN_ERR(svn_sqlite__reset(stmt)); + } + + /* Maybe we have to get some shadowed lock from BASE to make our test suite + happy... (It might be completely unrelated, but...) + This queries the same BASE row again, joined to the lock table */ + if (mtb->have_base && (have_work || mtb->kind == svn_node_file)) + { + svn_boolean_t update_root; + svn_wc__db_lock_t **lock_arg = NULL; + + if (have_work) + lock_arg = &mtb->lock; + + SVN_ERR(svn_wc__db_base_get_info_internal(NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, + NULL, lock_arg, NULL, NULL, + &update_root, + wcroot, local_relpath, + result_pool, scratch_pool)); + + mtb->file_external = (update_root && mtb->kind == svn_node_file); + } + + if (mtb->status == svn_wc__db_status_added) + { + svn_wc__db_status_t status; + + SVN_ERR(scan_addition(&status, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, + wcroot, local_relpath, + result_pool, scratch_pool)); + + mtb->moved_here = (status == svn_wc__db_status_moved_here); + mtb->incomplete = (status == svn_wc__db_status_incomplete); + } + +#ifdef HAVE_SYMLINK + if (mtb->kind == svn_node_file + && (mtb->had_props || mtb->props_mod)) + { + apr_hash_t *properties; + + if (mtb->props_mod) + SVN_ERR(db_read_props(&properties, + wcroot, local_relpath, + scratch_pool, scratch_pool)); + else + SVN_ERR(db_read_pristine_props(&properties, wcroot, local_relpath, + TRUE /* deleted_ok */, + scratch_pool, scratch_pool)); + + mtb->special = (NULL != svn_hash_gets(properties, SVN_PROP_SPECIAL)); + } +#endif + + mtb->has_checksum = (checksum != NULL); + mtb->copied = (original_repos_relpath != NULL); + + SVN_ERR(svn_wc__db_fetch_repos_info(&mtb->repos_root_url, &mtb->repos_uuid, + wcroot->sdb, repos_id, result_pool)); + + if (mtb->kind == svn_node_dir) + SVN_ERR(is_wclocked(&mtb->locked, wcroot, local_relpath, scratch_pool)); + + *info = mtb; + + return SVN_NO_ERROR; +} + +svn_error_t * +svn_wc__db_read_single_info(const struct svn_wc__db_info_t **info, + svn_wc__db_t *db, + const char *local_abspath, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) +{ + svn_wc__db_wcroot_t *wcroot; + const char *local_relpath; + + SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath)); + + SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db, + local_abspath, + scratch_pool, scratch_pool)); + VERIFY_USABLE_WCROOT(wcroot); + + SVN_WC__DB_WITH_TXN(read_single_info(info, wcroot, local_relpath, + result_pool, scratch_pool), + wcroot); + + return SVN_NO_ERROR; +} + svn_error_t * svn_wc__db_read_pristine_info(svn_wc__db_status_t *status, svn_node_kind_t *kind, @@ -10730,7 +11159,7 @@ commit_node(svn_wc__db_wcroot_t *wcroot, if we need to remove shadowed layers below our descendants. */ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, - STMT_DELETE_ALL_LAYERS)); + STMT_DELETE_NODE_ALL_LAYERS)); SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath)); SVN_ERR(svn_sqlite__update(&affected_rows, stmt)); diff --git a/contrib/subversion/subversion/libsvn_wc/wc_db.h b/contrib/subversion/subversion/libsvn_wc/wc_db.h index a4ed3f976d6..b0914942416 100644 --- a/contrib/subversion/subversion/libsvn_wc/wc_db.h +++ b/contrib/subversion/subversion/libsvn_wc/wc_db.h @@ -1909,6 +1909,16 @@ svn_wc__db_read_info(svn_wc__db_status_t *status, /* ### derived */ apr_pool_t *result_pool, apr_pool_t *scratch_pool); +/* Structure used as linked list in svn_wc__db_info_t to describe all nodes + in this location that were moved to another location */ +struct svn_wc__db_moved_to_info_t +{ + const char *moved_to_abspath; + const char *shadow_op_root_abspath; + + struct svn_wc__db_moved_to_info_t *next; +}; + /* Structure returned by svn_wc__db_read_children_info. Only has the fields needed by status. */ struct svn_wc__db_info_t { @@ -1945,7 +1955,10 @@ struct svn_wc__db_info_t { svn_wc__db_lock_t *lock; /* Repository file lock */ svn_boolean_t incomplete; /* TRUE if a working node is incomplete */ - const char *moved_to_abspath; /* Only on op-roots. See svn_wc_status3_t. */ + struct svn_wc__db_moved_to_info_t *moved_to; /* A linked list of locations + where nodes at this path + are moved to. Highest layers + first */ svn_boolean_t moved_here; /* Only on op-roots. */ svn_boolean_t file_external; @@ -1967,6 +1980,14 @@ svn_wc__db_read_children_info(apr_hash_t **nodes, apr_pool_t *result_pool, apr_pool_t *scratch_pool); +/* Like svn_wc__db_read_children_info, but only gets an info node for the root + element. */ +svn_error_t * +svn_wc__db_read_single_info(const struct svn_wc__db_info_t **info, + svn_wc__db_t *db, + const char *local_abspath, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); /* Structure returned by svn_wc__db_read_walker_info. Only has the fields needed by svn_wc__internal_walk_children(). */ diff --git a/contrib/subversion/subversion/libsvn_wc/wc_db_wcroot.c b/contrib/subversion/subversion/libsvn_wc/wc_db_wcroot.c index 21173e50cfa..d801451f613 100644 --- a/contrib/subversion/subversion/libsvn_wc/wc_db_wcroot.c +++ b/contrib/subversion/subversion/libsvn_wc/wc_db_wcroot.c @@ -690,8 +690,12 @@ svn_wc__db_wcroot_parse_local_abspath(svn_wc__db_wcroot_t **wcroot, svn_error_clear(err); *wcroot = NULL; } - else - SVN_ERR(err); + else if (err) + { + /* Close handle if we are not going to use it to support + upgrading with exclusive wc locking. */ + return svn_error_compose_create(err, svn_sqlite__close(sdb)); + } } else { diff --git a/contrib/subversion/subversion/svn/conflict-callbacks.c b/contrib/subversion/subversion/svn/conflict-callbacks.c index 3d41ecf9367..b5cdf5f0785 100644 --- a/contrib/subversion/subversion/svn/conflict-callbacks.c +++ b/contrib/subversion/subversion/svn/conflict-callbacks.c @@ -935,7 +935,7 @@ handle_text_conflict(svn_wc_conflict_result_t *result, /* We only allow the user accept the merged version of the file if they've edited it, or at least looked at the diff. */ - if (result->choice == svn_wc_conflict_choose_merged + if (opt->choice == svn_wc_conflict_choose_merged && ! knows_something) { SVN_ERR(svn_cmdline_fprintf( diff --git a/contrib/subversion/subversion/svndumpfilter/svndumpfilter.c b/contrib/subversion/subversion/svndumpfilter/svndumpfilter.c index a2f3fe2b4f8..a9430f7ef4f 100644 --- a/contrib/subversion/subversion/svndumpfilter/svndumpfilter.c +++ b/contrib/subversion/subversion/svndumpfilter/svndumpfilter.c @@ -570,6 +570,9 @@ new_node_record(void **node_baton, } else { + const char *kind; + const char *action; + tcl = svn_hash_gets(headers, SVN_REPOS_DUMPFILE_TEXT_CONTENT_LENGTH); /* Test if this node was copied from dropped source. */ @@ -584,7 +587,6 @@ new_node_record(void **node_baton, dumpfile should contain the new contents of the file. In this scenario, we'll just do an add without history using the new contents. */ - const char *kind; kind = svn_hash_gets(headers, SVN_REPOS_DUMPFILE_NODE_KIND); /* If there is a Text-content-length header, and the kind is @@ -623,6 +625,30 @@ new_node_record(void **node_baton, if (! nb->rb->writing_begun) SVN_ERR(output_revision(nb->rb)); + /* A node record is required to begin with 'Node-path', skip the + leading '/' to match the form used by 'svnadmin dump'. */ + SVN_ERR(svn_stream_printf(nb->rb->pb->out_stream, + pool, "%s: %s\n", + SVN_REPOS_DUMPFILE_NODE_PATH, node_path + 1)); + + /* Node-kind is next and is optional. */ + kind = svn_hash_gets(headers, SVN_REPOS_DUMPFILE_NODE_KIND); + if (kind) + SVN_ERR(svn_stream_printf(nb->rb->pb->out_stream, + pool, "%s: %s\n", + SVN_REPOS_DUMPFILE_NODE_KIND, kind)); + + /* Node-action is next and required. */ + action = svn_hash_gets(headers, SVN_REPOS_DUMPFILE_NODE_ACTION); + if (action) + SVN_ERR(svn_stream_printf(nb->rb->pb->out_stream, + pool, "%s: %s\n", + SVN_REPOS_DUMPFILE_NODE_ACTION, action)); + else + return svn_error_createf(SVN_ERR_INCOMPLETE_DATA, 0, + _("Missing Node-action for path '%s'"), + node_path); + for (hi = apr_hash_first(pool, headers); hi; hi = apr_hash_next(hi)) { const char *key = svn__apr_hash_index_key(hi); @@ -638,7 +664,10 @@ new_node_record(void **node_baton, if ((!strcmp(key, SVN_REPOS_DUMPFILE_CONTENT_LENGTH)) || (!strcmp(key, SVN_REPOS_DUMPFILE_PROP_CONTENT_LENGTH)) - || (!strcmp(key, SVN_REPOS_DUMPFILE_TEXT_CONTENT_LENGTH))) + || (!strcmp(key, SVN_REPOS_DUMPFILE_TEXT_CONTENT_LENGTH)) + || (!strcmp(key, SVN_REPOS_DUMPFILE_NODE_PATH)) + || (!strcmp(key, SVN_REPOS_DUMPFILE_NODE_KIND)) + || (!strcmp(key, SVN_REPOS_DUMPFILE_NODE_ACTION))) continue; /* Rewrite Node-Copyfrom-Rev if we are renumbering revisions. diff --git a/contrib/subversion/subversion/svnrdump/util.c b/contrib/subversion/subversion/svnrdump/util.c index 91cefb3f080..2586cd1dbf0 100644 --- a/contrib/subversion/subversion/svnrdump/util.c +++ b/contrib/subversion/subversion/svnrdump/util.c @@ -35,7 +35,7 @@ svn_rdump__normalize_prop(const char *name, const svn_string_t **value, apr_pool_t *result_pool) { - if (svn_prop_needs_translation(name)) + if (svn_prop_needs_translation(name) && *value) { const char *cstring; diff --git a/contrib/subversion/subversion/svnserve/serve.c b/contrib/subversion/subversion/svnserve/serve.c index 6b66b199f26..a3fd938b1c3 100644 --- a/contrib/subversion/subversion/svnserve/serve.c +++ b/contrib/subversion/subversion/svnserve/serve.c @@ -1526,6 +1526,9 @@ static svn_error_t *get_file(svn_ra_svn_conn_t *conn, apr_pool_t *pool, &want_props, &want_contents, &wants_inherited_props)); + if (wants_inherited_props == SVN_RA_SVN_UNSPECIFIED_NUMBER) + wants_inherited_props = FALSE; + full_path = svn_fspath__join(b->fs_path->data, svn_relpath_canonicalize(path, pool), pool); @@ -1545,8 +1548,14 @@ static svn_error_t *get_file(svn_ra_svn_conn_t *conn, apr_pool_t *pool, SVN_CMD_ERR(svn_fs_file_checksum(&checksum, svn_checksum_md5, root, full_path, TRUE, pool)); hex_digest = svn_checksum_to_cstring_display(checksum, pool); + + /* Fetch the file's explicit and/or inherited properties if + requested. Although the wants-iprops boolean was added to the + protocol in 1.8 a standard 1.8 client never requests iprops. */ if (want_props || wants_inherited_props) - SVN_CMD_ERR(get_props(&props, &inherited_props, &ab, root, full_path, + SVN_CMD_ERR(get_props(want_props ? &props : NULL, + wants_inherited_props ? &inherited_props : NULL, + &ab, root, full_path, pool)); if (want_contents) SVN_CMD_ERR(svn_fs_file_contents(&contents, root, full_path, pool)); @@ -1640,6 +1649,9 @@ static svn_error_t *get_dir(svn_ra_svn_conn_t *conn, apr_pool_t *pool, &dirent_fields_list, &wants_inherited_props)); + if (wants_inherited_props == SVN_RA_SVN_UNSPECIFIED_NUMBER) + wants_inherited_props = FALSE; + if (! dirent_fields_list) { dirent_fields = SVN_DIRENT_ALL; @@ -1689,10 +1701,13 @@ static svn_error_t *get_dir(svn_ra_svn_conn_t *conn, apr_pool_t *pool, /* Fetch the root of the appropriate revision. */ SVN_CMD_ERR(svn_fs_revision_root(&root, b->fs, rev, pool)); - /* Fetch the directory's explicit and/or inherited properties - if requested. */ + /* Fetch the directory's explicit and/or inherited properties if + requested. Although the wants-iprops boolean was added to the + protocol in 1.8 a standard 1.8 client never requests iprops. */ if (want_props || wants_inherited_props) - SVN_CMD_ERR(get_props(&props, &inherited_props, &ab, root, full_path, + SVN_CMD_ERR(get_props(want_props ? &props : NULL, + wants_inherited_props ? &inherited_props : NULL, + &ab, root, full_path, pool)); /* Begin response ... */ diff --git a/contrib/tzcode/stdtime/ctime.3 b/contrib/tzcode/stdtime/ctime.3 index 143bc2c9fd0..9ee40554fa7 100644 --- a/contrib/tzcode/stdtime/ctime.3 +++ b/contrib/tzcode/stdtime/ctime.3 @@ -342,7 +342,7 @@ Except for and the .Fn \&_r variants of the other functions, -these functions leaves their result in an internal static object and return +these functions leave their result in an internal static object and return a pointer to that object. Subsequent calls to these function will modify the same object. diff --git a/contrib/tzdata/africa b/contrib/tzdata/africa index fbf0b65ab54..90f773578f2 100644 --- a/contrib/tzdata/africa +++ b/contrib/tzdata/africa @@ -239,13 +239,13 @@ Rule Egypt 1990 1994 - May 1 1:00 1:00 S # http://www.worldtimezone.com/dst_news/dst_news_egypt04.html # Rule Egypt 1995 2010 - Apr lastFri 0:00s 1:00 S -Rule Egypt 1995 2005 - Sep lastThu 23:00s 0 - +Rule Egypt 1995 2005 - Sep lastThu 24:00 0 - # From Steffen Thorsen (2006-09-19): # The Egyptian Gazette, issue 41,090 (2006-09-18), page 1, reports: # Egypt will turn back clocks by one hour at the midnight of Thursday # after observing the daylight saving time since May. # http://news.gom.com.eg/gazette/pdf/2006/09/18/01.pdf -Rule Egypt 2006 only - Sep 21 23:00s 0 - +Rule Egypt 2006 only - Sep 21 24:00 0 - # From Dirk Losch (2007-08-14): # I received a mail from an airline which says that the daylight # saving time in Egypt will end in the night of 2007-09-06 to 2007-09-07. @@ -254,7 +254,7 @@ Rule Egypt 2006 only - Sep 21 23:00s 0 - # http://www.timeanddate.com/worldclock/city.html?n=53 # From Steffen Thorsen (2007-09-04): The official information...: # http://www.sis.gov.eg/En/EgyptOnline/Miscellaneous/000002/0207000000000000001580.htm -Rule Egypt 2007 only - Sep Thu>=1 23:00s 0 - +Rule Egypt 2007 only - Sep Thu>=1 24:00 0 - # From Abdelrahman Hassan (2007-09-06): # Due to the Hijri (lunar Islamic calendar) year being 11 days shorter # than the year of the Gregorian calendar, Ramadan shifts earlier each @@ -335,11 +335,85 @@ Rule Egypt 2007 only - Sep Thu>=1 23:00s 0 - # http://www.worldtimezone.com/dst_news/dst_news_egypt02.html # -Rule Egypt 2008 only - Aug lastThu 23:00s 0 - -Rule Egypt 2009 only - Aug 20 23:00s 0 - -Rule Egypt 2010 only - Aug 11 0:00 0 - -Rule Egypt 2010 only - Sep 10 0:00 1:00 S -Rule Egypt 2010 only - Sep lastThu 23:00s 0 - +# From Ahmad El-Dardiry (2014-05-07): +# Egypt is to change back to Daylight system on May 15 +# http://english.ahram.org.eg/NewsContent/1/64/100735/Egypt/Politics-/Egypts-government-to-reapply-daylight-saving-time-.aspx + +# From Gunther Vermier (2015-05-13): +# our Egypt office confirms that the change will be at 15 May "midnight" (24:00) + +# From Imed Chihi (2014-06-04): +# We have finally "located" a precise official reference about the DST changes +# in Egypt. The Ministers Cabinet decision is explained at +# http://www.cabinet.gov.eg/Media/CabinetMeetingsDetails.aspx?id=347 ... +# [T]his (Arabic) site is not accessible outside Egypt, but the page ... +# translates into: "With regard to daylight saving time, it is scheduled to +# take effect at exactly twelve o'clock this evening, Thursday, 15 MAY 2014, +# to be suspended by twelve o'clock on the evening of Thursday, 26 JUN 2014, +# and re-established again at the end of the month of Ramadan, at twelve +# o'clock on the evening of Thursday, 31 JUL 2014." This statement has been +# reproduced by other (more accessible) sites[, e.g.,]... +# http://elgornal.net/news/news.aspx?id=4699258 + +# From Paul Eggert (2014-06-04): +# Sarah El Deeb and Lee Keath of AP report that the Egyptian government says +# the change is because of blackouts in Cairo, even though Ahram Online (cited +# above) says DST had no affect on electricity consumption. There is +# no information about when DST will end this fall. See: +# http://abcnews.go.com/International/wireStory/el-sissi-pushes-egyptians-line-23614833 +# +# For now, guess that later spring and fall transitions will use +# 2010's rules, and guess that Egypt will switch to standard time at +# 24:00 the last Thursday before Ramadan, and back to DST at 00:00 the +# first Friday after Ramadan. To implement this, +# transition dates for 2015 through 2037 were determined by running +# the following program under GNU Emacs 24.3, with the results integrated +# by hand into the table below. Ramadan again intrudes on the guessed +# DST starting in 2038, but that's beyond our somewhat-arbitrary cutoff. +# (let ((islamic-year 1436)) +# (while (< islamic-year 1460) +# (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year))) +# (b (calendar-islamic-to-absolute (list 10 1 islamic-year))) +# (friday 5)) +# (while (/= friday (mod a 7)) +# (setq a (1- a))) +# (while (/= friday (mod b 7)) +# (setq b (1+ b))) +# (setq a (1- a)) +# (setq b (1- b)) +# (setq a (calendar-gregorian-from-absolute a)) +# (setq b (calendar-gregorian-from-absolute b)) +# (insert +# (format +# (concat "Rule\tEgypt\t%d\tonly\t-\t%s\t%2d\t24:00\t0\t-\n" +# "Rule\tEgypt\t%d\tonly\t-\t%s\t%2d\t24:00\t1:00\tS\n") +# (car (cdr (cdr a))) (calendar-month-name (car a) t) (car (cdr a)) +# (car (cdr (cdr b))) (calendar-month-name (car b) t) (car (cdr b))))) +# (setq islamic-year (+ 1 islamic-year)))) +Rule Egypt 2008 only - Aug lastThu 24:00 0 - +Rule Egypt 2009 only - Aug 20 24:00 0 - +Rule Egypt 2010 only - Aug 10 24:00 0 - +Rule Egypt 2010 only - Sep 9 24:00 1:00 S +Rule Egypt 2010 only - Sep lastThu 24:00 0 - +Rule Egypt 2014 only - May 15 24:00 1:00 S +Rule Egypt 2014 only - Jun 26 24:00 0 - +Rule Egypt 2014 only - Jul 31 24:00 1:00 S +Rule Egypt 2014 max - Sep lastThu 24:00 0 - +Rule Egypt 2015 2019 - Apr lastFri 0:00s 1:00 S +Rule Egypt 2015 only - Jun 11 24:00 0 - +Rule Egypt 2015 only - Jul 23 24:00 1:00 S +Rule Egypt 2016 only - Jun 2 24:00 0 - +Rule Egypt 2016 only - Jul 7 24:00 1:00 S +Rule Egypt 2017 only - May 25 24:00 0 - +Rule Egypt 2017 only - Jun 29 24:00 1:00 S +Rule Egypt 2018 only - May 10 24:00 0 - +Rule Egypt 2018 only - Jun 14 24:00 1:00 S +Rule Egypt 2019 only - May 2 24:00 0 - +Rule Egypt 2019 only - Jun 6 24:00 1:00 S +Rule Egypt 2020 only - May 28 24:00 1:00 S +Rule Egypt 2021 only - May 13 24:00 1:00 S +Rule Egypt 2022 only - May 5 24:00 1:00 S +Rule Egypt 2023 max - Apr lastFri 0:00s 1:00 S # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Cairo 2:05:09 - LMT 1900 Oct @@ -871,39 +945,36 @@ Zone Indian/Mayotte 3:00:56 - LMT 1911 Jul # Mamoutzou # From Sebastien Willemijns (2014-03-18): # http://www.afriquinfos.com/articles/2014/3/18/maroc-heure-dete-avancez-tous-horloges-247891.asp -# From Paul Eggert (2014-03-19): -# To estimate what the Moroccan government will do in future years, -# transition dates for 2014 through 2038 were determined by running -# the following program under GNU Emacs 24.3: -# -# (let ((islamic-year 1435)) -# (while (< islamic-year 1461) -# (let ((a -# (calendar-gregorian-from-absolute -# (calendar-islamic-to-absolute (list 9 1 islamic-year)))) -# (b -# (calendar-gregorian-from-absolute -# (calendar-islamic-to-absolute (list 10 1 islamic-year))))) -# (insert -# (format -# (concat "Rule\tMorocco\t%d\tonly\t-\t%s\t %2d\t 3:00\t0\t-\n" -# "Rule\tMorocco\t%d\tonly\t-\t%s\t %2d\t 2:00\t1:00\tS\n") -# (car (cdr (cdr a))) (calendar-month-name (car a) t) (car (cdr a)) -# (car (cdr (cdr b))) (calendar-month-name (car b) t) (car (cdr b))))) +# From Milamber Space Network (2014-06-05): +# The Moroccan government has recently announced that the country will return +# to standard time at 03:00 on Saturday, June 28, 2014 local time.... DST +# will resume again at 02:00 on Saturday, August 2, 2014.... +# http://www.mmsp.gov.ma/fr/actualites.aspx?id=586 + +# From Paul Eggert (2014-06-05): +# For now, guess that later spring and fall transitions will use 2014's rules, +# and guess that Morocco will switch to standard time at 03:00 the last +# Saturday before Ramadan, and back to DST at 02:00 the first Saturday after +# Ramadan. To implement this, transition dates for 2015 through 2037 were +# determined by running the following program under GNU Emacs 24.3, with the +# results integrated by hand into the table below. +# (let ((islamic-year 1436)) +# (while (< islamic-year 1460) +# (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year))) +# (b (calendar-islamic-to-absolute (list 10 1 islamic-year))) +# (saturday 6)) +# (while (/= saturday (mod (setq a (1- a)) 7))) +# (while (/= saturday (mod b 7)) +# (setq b (1+ b))) +# (setq a (calendar-gregorian-from-absolute a)) +# (setq b (calendar-gregorian-from-absolute b)) +# (insert +# (format +# (concat "Rule\tMorocco\t%d\tonly\t-\t%s\t%2d\t 3:00\t0\t-\n" +# "Rule\tMorocco\t%d\tonly\t-\t%s\t%2d\t 2:00\t1:00\tS\n") +# (car (cdr (cdr a))) (calendar-month-name (car a) t) (car (cdr a)) +# (car (cdr (cdr b))) (calendar-month-name (car b) t) (car (cdr b))))) # (setq islamic-year (+ 1 islamic-year)))) -# -# with spring-forward transitions removed for 2023-2025, when the -# normal spring-forward date falls during the estimated Ramadan; with -# all transitions removed for 2026-2035, where the estimated Ramadan -# falls entirely outside daylight-saving time; and with fall-back -# transitions removed for 2036-2037, where the normal fall-back -# date falls during the estimated Ramadan. Normally, the table would -# stop after 2037 because 32-bit time_t values roll around early in 2038, -# but that would imply a prediction of perpetual DST after March 2038 -# due to the year-2037 glitches. So, this table instead stops after -# 2038, the first non-glitchy year after the 32-bit rollover. -# An advantage of stopping after 2038 is that it lets zic guess -# TZ='WET0WEST,M3.5.0,M10.5.0/3' for time stamps far in the future. # RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -925,46 +996,44 @@ Rule Morocco 1978 only - Aug 4 0:00 0 - Rule Morocco 2008 only - Jun 1 0:00 1:00 S Rule Morocco 2008 only - Sep 1 0:00 0 - Rule Morocco 2009 only - Jun 1 0:00 1:00 S -Rule Morocco 2009 only - Aug 21 0:00 0 - +Rule Morocco 2009 only - Aug 21 0:00 0 - Rule Morocco 2010 only - May 2 0:00 1:00 S Rule Morocco 2010 only - Aug 8 0:00 0 - Rule Morocco 2011 only - Apr 3 0:00 1:00 S -Rule Morocco 2011 only - Jul 31 0 0 - -Rule Morocco 2012 2013 - Apr lastSun 2:00 1:00 S -Rule Morocco 2012 only - Sep 30 3:00 0 - -Rule Morocco 2012 only - Jul 20 3:00 0 - -Rule Morocco 2012 only - Aug 20 2:00 1:00 S -Rule Morocco 2013 only - Jul 7 3:00 0 - -Rule Morocco 2013 only - Aug 10 2:00 1:00 S -Rule Morocco 2013 2035 - Oct lastSun 3:00 0 - -Rule Morocco 2014 2022 - Mar lastSun 2:00 1:00 S -Rule Morocco 2014 only - Jun 29 3:00 0 - -Rule Morocco 2014 only - Jul 29 2:00 1:00 S -Rule Morocco 2015 only - Jun 18 3:00 0 - -Rule Morocco 2015 only - Jul 18 2:00 1:00 S -Rule Morocco 2016 only - Jun 7 3:00 0 - -Rule Morocco 2016 only - Jul 7 2:00 1:00 S -Rule Morocco 2017 only - May 27 3:00 0 - -Rule Morocco 2017 only - Jun 26 2:00 1:00 S -Rule Morocco 2018 only - May 16 3:00 0 - -Rule Morocco 2018 only - Jun 15 2:00 1:00 S -Rule Morocco 2019 only - May 6 3:00 0 - -Rule Morocco 2019 only - Jun 5 2:00 1:00 S -Rule Morocco 2020 only - Apr 24 3:00 0 - -Rule Morocco 2020 only - May 24 2:00 1:00 S -Rule Morocco 2021 only - Apr 13 3:00 0 - -Rule Morocco 2021 only - May 13 2:00 1:00 S -Rule Morocco 2022 only - Apr 3 3:00 0 - -Rule Morocco 2022 only - May 3 2:00 1:00 S -Rule Morocco 2023 only - Apr 22 2:00 1:00 S -Rule Morocco 2024 only - Apr 10 2:00 1:00 S -Rule Morocco 2025 only - Mar 31 2:00 1:00 S -Rule Morocco 2026 max - Mar lastSun 2:00 1:00 S -Rule Morocco 2036 only - Oct 21 3:00 0 - -Rule Morocco 2037 only - Oct 11 3:00 0 - -Rule Morocco 2038 only - Sep 30 3:00 0 - -Rule Morocco 2038 only - Oct 30 2:00 1:00 S -Rule Morocco 2038 max - Oct lastSun 3:00 0 - +Rule Morocco 2011 only - Jul 31 0 0 - +Rule Morocco 2012 2013 - Apr lastSun 2:00 1:00 S +Rule Morocco 2012 only - Sep 30 3:00 0 - +Rule Morocco 2012 only - Jul 20 3:00 0 - +Rule Morocco 2012 only - Aug 20 2:00 1:00 S +Rule Morocco 2013 only - Jul 7 3:00 0 - +Rule Morocco 2013 only - Aug 10 2:00 1:00 S +Rule Morocco 2013 max - Oct lastSun 3:00 0 - +Rule Morocco 2014 2022 - Mar lastSun 2:00 1:00 S +Rule Morocco 2014 only - Jun 28 3:00 0 - +Rule Morocco 2014 only - Aug 2 2:00 1:00 S +Rule Morocco 2015 only - Jun 13 3:00 0 - +Rule Morocco 2015 only - Jul 18 2:00 1:00 S +Rule Morocco 2016 only - Jun 4 3:00 0 - +Rule Morocco 2016 only - Jul 9 2:00 1:00 S +Rule Morocco 2017 only - May 20 3:00 0 - +Rule Morocco 2017 only - Jul 1 2:00 1:00 S +Rule Morocco 2018 only - May 12 3:00 0 - +Rule Morocco 2018 only - Jun 16 2:00 1:00 S +Rule Morocco 2019 only - May 4 3:00 0 - +Rule Morocco 2019 only - Jun 8 2:00 1:00 S +Rule Morocco 2020 only - Apr 18 3:00 0 - +Rule Morocco 2020 only - May 30 2:00 1:00 S +Rule Morocco 2021 only - Apr 10 3:00 0 - +Rule Morocco 2021 only - May 15 2:00 1:00 S +Rule Morocco 2022 only - Apr 2 3:00 0 - +Rule Morocco 2022 only - May 7 2:00 1:00 S +Rule Morocco 2023 only - Apr 22 2:00 1:00 S +Rule Morocco 2024 only - Apr 13 2:00 1:00 S +Rule Morocco 2025 only - Apr 5 2:00 1:00 S +Rule Morocco 2026 max - Mar lastSun 2:00 1:00 S +Rule Morocco 2035 only - Oct 27 3:00 0 - +Rule Morocco 2036 only - Oct 18 3:00 0 - +Rule Morocco 2037 only - Oct 10 3:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26 diff --git a/contrib/tzdata/asia b/contrib/tzdata/asia index 3bd7e7da5b2..24566ca0f5b 100644 --- a/contrib/tzdata/asia +++ b/contrib/tzdata/asia @@ -1347,22 +1347,6 @@ Zone Asia/Tokyo 9:18:59 - LMT 1887 Dec 31 15:00u # "Jordan will switch to winter time on Friday, October 27". # -# From Phil Pizzey (2009-04-02): -# ...I think I may have spotted an error in the timezone data for -# Jordan. -# The current (2009d) asia file shows Jordan going to daylight -# saving -# time on the last Thursday in March. -# -# Rule Jordan 2000 max - Mar lastThu 0:00s 1:00 S -# -# However timeanddate.com, which I usually find reliable, shows Jordan -# going to daylight saving time on the last Friday in March since 2002. -# Please see -# -# http://www.timeanddate.com/worldclock/timezone.html?n=11 -# - # From Steffen Thorsen (2009-04-02): # This single one might be good enough, (2009-03-24, Arabic): # diff --git a/contrib/tzdata/australasia b/contrib/tzdata/australasia index a61c184fcf4..2a8297b01fa 100644 --- a/contrib/tzdata/australasia +++ b/contrib/tzdata/australasia @@ -250,24 +250,14 @@ Zone Antarctica/Macquarie 0 - zzz 1899 Nov Zone Indian/Christmas 7:02:52 - LMT 1895 Feb 7:00 - CXT # Christmas Island Time -# Cook Is -# From Shanks & Pottenger: -# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Cook 1978 only - Nov 12 0:00 0:30 HS -Rule Cook 1979 1991 - Mar Sun>=1 0:00 0 - -Rule Cook 1979 1990 - Oct lastSun 0:00 0:30 HS -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Pacific/Rarotonga -10:39:04 - LMT 1901 # Avarua - -10:30 - CKT 1978 Nov 12 # Cook Is Time - -10:00 Cook CK%sT - -# Cocos +# Cocos (Keeling) Is # These islands were ruled by the Ross family from about 1830 to 1978. # We don't know when standard time was introduced; for now, we guess 1900. # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Indian/Cocos 6:27:40 - LMT 1900 6:30 - CCT # Cocos Islands Time + # Fiji # Milne gives 11:55:44 for Suva. @@ -473,7 +463,8 @@ Rule NZ 1934 1940 - Apr lastSun 2:00 0 M Rule NZ 1934 1940 - Sep lastSun 2:00 0:30 S Rule NZ 1946 only - Jan 1 0:00 0 S # Since 1957 Chatham has been 45 minutes ahead of NZ, but there's no -# convenient notation for this so we must duplicate the Rule lines. +# convenient single notation for the date and time of this transition +# so we must duplicate the Rule lines. Rule NZ 1974 only - Nov Sun>=1 2:00s 1:00 D Rule Chatham 1974 only - Nov Sun>=1 2:45s 1:00 D Rule NZ 1975 only - Feb lastSun 2:00s 0 S @@ -511,6 +502,17 @@ Link Pacific/Auckland Antarctica/McMurdo # previously whalers, sealers, pastoralists, and scientific personnel wintered # was probably like Pacific/Auckland +# Cook Is +# From Shanks & Pottenger: +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Cook 1978 only - Nov 12 0:00 0:30 HS +Rule Cook 1979 1991 - Mar Sun>=1 0:00 0 - +Rule Cook 1979 1990 - Oct lastSun 0:00 0:30 HS +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Pacific/Rarotonga -10:39:04 - LMT 1901 # Avarua + -10:30 - CKT 1978 Nov 12 # Cook Is Time + -10:00 Cook CK%sT + ############################################################################### diff --git a/contrib/tzdata/europe b/contrib/tzdata/europe index f9a33921e85..7ae96ffc931 100644 --- a/contrib/tzdata/europe +++ b/contrib/tzdata/europe @@ -6,7 +6,7 @@ # go ahead and edit the file (and please send any changes to # tz@iana.org for general use in the future). -# From Paul Eggert (2006-03-22): +# From Paul Eggert (2014-05-31): # A good source for time zone historical data outside the U.S. is # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), # San Diego: ACS Publications, Inc. (2003). @@ -17,6 +17,9 @@ # published semiannually. Law sent in several helpful summaries # of the IATA's data after 1990. # +# A reliable and entertaining source about time zones is +# Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997). +# # Except where otherwise noted, Shanks & Pottenger is the source for # entries through 1991, and IATA SSIM is the source for entries afterwards. # @@ -26,9 +29,9 @@ # Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated), # which I found in the UCLA library. # -# # William Willett, The Waste of Daylight, 19th edition -# (1914-03) +# +# [PDF] (1914-03) # # Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94 # . He writes: @@ -58,10 +61,7 @@ # 1:00 CET CEST CEMT Central Europe # 1:00:14 SET Swedish (1879-1899)* # 2:00 EET EEST Eastern Europe -# 3:00 MSK MSD Moscow -# -# A reliable and entertaining source about time zones, especially in Britain, -# Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997). +# 3:00 MSK MSD MSM* Moscow # From Peter Ilieve (1994-12-04), # The original six [EU members]: Belgium, France, (West) Germany, Italy, @@ -558,11 +558,11 @@ Rule Russia 1917 only - Dec 28 0:00 0 MMT # Moscow Mean Time Rule Russia 1918 only - May 31 22:00 2:00 MDST # Moscow Double Summer Time Rule Russia 1918 only - Sep 16 1:00 1:00 MST Rule Russia 1919 only - May 31 23:00 2:00 MDST -Rule Russia 1919 only - Jul 1 2:00 1:00 S -Rule Russia 1919 only - Aug 16 0:00 0 - -Rule Russia 1921 only - Feb 14 23:00 1:00 S -Rule Russia 1921 only - Mar 20 23:00 2:00 M # Midsummer -Rule Russia 1921 only - Sep 1 0:00 1:00 S +Rule Russia 1919 only - Jul 1 2:00 1:00 MSD +Rule Russia 1919 only - Aug 16 0:00 0 MSK +Rule Russia 1921 only - Feb 14 23:00 1:00 MSD +Rule Russia 1921 only - Mar 20 23:00 2:00 MSM # Midsummer +Rule Russia 1921 only - Sep 1 0:00 1:00 MSD Rule Russia 1921 only - Oct 1 0:00 0 - # Act No.925 of the Council of Ministers of the USSR (1980-10-24): Rule Russia 1981 1984 - Apr 1 0:00 1:00 S @@ -2217,6 +2217,7 @@ Zone Europe/Kaliningrad 1:22:00 - LMT 1893 Apr Zone Europe/Moscow 2:30:20 - LMT 1880 2:30 - MMT 1916 Jul 3 # Moscow Mean Time 2:30:48 Russia %s 1919 Jul 1 2:00 + 3:00 Russia %s 1921 Oct 3:00 Russia MSK/MSD 1922 Oct 2:00 - EET 1930 Jun 21 3:00 Russia MSK/MSD 1991 Mar 31 2:00s @@ -2375,7 +2376,7 @@ Zone Asia/Yakutsk 8:38:40 - LMT 1919 Dec 15 Zone Asia/Vladivostok 8:47:44 - LMT 1922 Nov 15 9:00 - VLAT 1930 Jun 21 # Vladivostok Time 10:00 Russia VLA%sT 1991 Mar 31 2:00s - 9:00 Russia VLA%sST 1992 Jan 19 2:00s + 9:00 Russia VLA%sT 1992 Jan 19 2:00s 10:00 Russia VLA%sT 2011 Mar 27 2:00s 11:00 - VLAT @@ -2966,6 +2967,10 @@ Zone Europe/Simferopol 2:16:24 - LMT 1880 # From Alexander Krivenyshev (2014-03-17): # time change at 2:00 (2am) on March 30, 2014 # http://vz.ru/news/2014/3/17/677464.html +# From Paul Eggert (2014-03-30): +# Simferopol and Sevastopol reportedly changed their central town clocks +# late the previous day, but this appears to have been ceremonial +# and the discrepancies are small enough to not worry about. 2:00 EU EE%sT 2014 Mar 30 2:00 4:00 - MSK diff --git a/contrib/tzdata/northamerica b/contrib/tzdata/northamerica index d51a7e1d6bd..9660a46d22a 100644 --- a/contrib/tzdata/northamerica +++ b/contrib/tzdata/northamerica @@ -1019,9 +1019,9 @@ Zone America/Menominee -5:50:27 - LMT 1885 Sep 18 12:00 # Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated), # which I found in the UCLA library. # -# # William Willett, The Waste of Daylight, 19th edition -# (1914-03) +# +# [PDF] (1914-03) # # Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94 # . diff --git a/contrib/unbound/LICENSE b/contrib/unbound/LICENSE index c248049fb8d..1859c095a5b 100644 --- a/contrib/unbound/LICENSE +++ b/contrib/unbound/LICENSE @@ -18,13 +18,13 @@ be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. +"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 COPYRIGHT +HOLDER 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. diff --git a/contrib/unbound/Makefile.in b/contrib/unbound/Makefile.in index 0064341462c..27defa685be 100644 --- a/contrib/unbound/Makefile.in +++ b/contrib/unbound/Makefile.in @@ -16,7 +16,6 @@ datadir=@datadir@ includedir=@includedir@ doxygen=@doxygen@ libtool=@libtool@ -ldnsdir=@ldnsdir@ staticexe=@staticexe@ EXEEXT=@EXEEXT@ configfile=@ub_conf_file@ @@ -30,7 +29,13 @@ PYTHONMOD_INSTALL=@PYTHONMOD_INSTALL@ PYTHONMOD_UNINSTALL=@PYTHONMOD_UNINSTALL@ PYUNBOUND_INSTALL=@PYUNBOUND_INSTALL@ PYUNBOUND_UNINSTALL=@PYUNBOUND_UNINSTALL@ +UNBOUND_EVENT_INSTALL=@UNBOUND_EVENT_INSTALL@ +UNBOUND_EVENT_UNINSTALL=@UNBOUND_EVENT_UNINSTALL@ +UNBOUND_VERSION_MAJOR=@UNBOUND_VERSION_MAJOR@ +UNBOUND_VERSION_MINOR=@UNBOUND_VERSION_MINOR@ +UNBOUND_VERSION_MICRO=@UNBOUND_VERSION_MICRO@ ALLTARGET=@ALLTARGET@ +INSTALLTARGET=@INSTALLTARGET@ # _unbound.la if pyunbound enabled. PYUNBOUND_TARGET=@PYUNBOUND_TARGET@ @@ -61,7 +66,7 @@ EXTRALINK=@EXTRALINK@ WINDRES=@WINDRES@ LINT=splint -LINTFLAGS=+quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t -preproc -Drlimit=rlimit64 -D__gnuc_va_list=va_list +LINTFLAGS=+quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t -preproc -Drlimit=rlimit64 -D__gnuc_va_list=va_list -formatcode #-Dglob64=glob -Dglobfree64=globfree # compat with openssl linux edition. LINTFLAGS+="-DBN_ULONG=unsigned long" -Dkrb5_int32=int "-Dkrb5_ui_4=unsigned int" -DPQ_64BIT=uint64_t -DRC4_INT=unsigned -fixedformalarray -D"ENGINE=unsigned" -D"RSA=unsigned" -D"DSA=unsigned" -D"EVP_PKEY=unsigned" -D"EVP_MD=unsigned" -D"SSL=unsigned" -D"SSL_CTX=unsigned" -D"X509=unsigned" -D"RC4_KEY=unsigned" -D"EVP_MD_CTX=unsigned" -D"ECDSA_SIG=DSA_SIG" @@ -69,8 +74,8 @@ LINTFLAGS+="-DBN_ULONG=unsigned long" -Dkrb5_int32=int "-Dkrb5_ui_4=unsigned int LINTFLAGS+=@NETBSD_LINTFLAGS@ # compat with OpenBSD LINTFLAGS+="-Dsigset_t=long" -# FreeBSD8 -LINTFLAGS+="-D__uint16_t=uint16_t" +# FreeBSD +LINTFLAGS+="-D__uint16_t=uint16_t" "-DEVP_PKEY_ASN1_METHOD=int" INSTALL=$(srcdir)/install-sh @@ -118,80 +123,83 @@ outside_network.lo COMMON_OBJ_ALL_SYMBOLS=@COMMON_OBJ_ALL_SYMBOLS@ COMPAT_SRC=compat/ctime_r.c compat/fake-rfc2553.c compat/gmtime_r.c \ compat/inet_aton.c compat/inet_ntop.c compat/inet_pton.c compat/malloc.c \ -compat/memcmp.c compat/memmove.c compat/snprintf.c compat/strlcpy.c \ -compat/strptime.c +compat/memcmp.c compat/memmove.c compat/snprintf.c compat/strlcat.c \ +compat/strlcpy.c compat/strptime.c COMPAT_OBJ=$(LIBOBJS:.o=.lo) COMPAT_OBJ_WITHOUT_CTIME=$(LIBOBJ_WITHOUT_CTIME:.o=.lo) +SLDNS_SRC=ldns/keyraw.c ldns/sbuffer.c ldns/wire2str.c ldns/parse.c \ +ldns/parseutil.c ldns/rrdef.c ldns/str2wire.c +SLDNS_OBJ=keyraw.lo sbuffer.lo wire2str.lo parse.lo parseutil.lo rrdef.lo \ +str2wire.lo UNITTEST_SRC=testcode/unitanchor.c testcode/unitdname.c \ testcode/unitlruhash.c testcode/unitmain.c testcode/unitmsgparse.c \ testcode/unitneg.c testcode/unitregional.c testcode/unitslabhash.c \ -testcode/unitverify.c testcode/readhex.c testcode/ldns-testpkts.c +testcode/unitverify.c testcode/readhex.c testcode/testpkts.c testcode/unitldns.c UNITTEST_OBJ=unitanchor.lo unitdname.lo unitlruhash.lo unitmain.lo \ unitmsgparse.lo unitneg.lo unitregional.lo unitslabhash.lo unitverify.lo \ -readhex.lo ldns-testpkts.lo -UNITTEST_OBJ_LINK=$(UNITTEST_OBJ) worker_cb.lo $(COMMON_OBJ) $(COMPAT_OBJ) +readhex.lo testpkts.lo unitldns.lo +UNITTEST_OBJ_LINK=$(UNITTEST_OBJ) worker_cb.lo $(COMMON_OBJ) $(SLDNS_OBJ) \ +$(COMPAT_OBJ) DAEMON_SRC=daemon/acl_list.c daemon/cachedump.c daemon/daemon.c \ daemon/remote.c daemon/stats.c daemon/unbound.c daemon/worker.c @WIN_DAEMON_SRC@ DAEMON_OBJ=acl_list.lo cachedump.lo daemon.lo remote.lo stats.lo unbound.lo \ worker.lo @WIN_DAEMON_OBJ@ -DAEMON_OBJ_LINK=$(DAEMON_OBJ) $(COMMON_OBJ_ALL_SYMBOLS) \ +DAEMON_OBJ_LINK=$(DAEMON_OBJ) $(COMMON_OBJ_ALL_SYMBOLS) $(SLDNS_OBJ) \ $(COMPAT_OBJ) @WIN_DAEMON_OBJ_LINK@ CHECKCONF_SRC=smallapp/unbound-checkconf.c smallapp/worker_cb.c CHECKCONF_OBJ=unbound-checkconf.lo worker_cb.lo -CHECKCONF_OBJ_LINK=$(CHECKCONF_OBJ) $(COMMON_OBJ_ALL_SYMBOLS) \ +CHECKCONF_OBJ_LINK=$(CHECKCONF_OBJ) $(COMMON_OBJ_ALL_SYMBOLS) $(SLDNS_OBJ) \ $(COMPAT_OBJ) @WIN_CHECKCONF_OBJ_LINK@ CONTROL_SRC=smallapp/unbound-control.c CONTROL_OBJ=unbound-control.lo CONTROL_OBJ_LINK=$(CONTROL_OBJ) worker_cb.lo $(COMMON_OBJ_ALL_SYMBOLS) \ -$(COMPAT_OBJ) @WIN_CONTROL_OBJ_LINK@ +$(SLDNS_OBJ) $(COMPAT_OBJ) @WIN_CONTROL_OBJ_LINK@ HOST_SRC=smallapp/unbound-host.c HOST_OBJ=unbound-host.lo -HOST_OBJ_LINK=$(HOST_OBJ) $(COMPAT_OBJ_WITHOUT_CTIME) @WIN_HOST_OBJ_LINK@ +HOST_OBJ_LINK=$(HOST_OBJ) $(SLDNS_OBJ) $(COMPAT_OBJ_WITHOUT_CTIME) @WIN_HOST_OBJ_LINK@ UBANCHOR_SRC=smallapp/unbound-anchor.c UBANCHOR_OBJ=unbound-anchor.lo UBANCHOR_OBJ_LINK=$(UBANCHOR_OBJ) \ $(COMPAT_OBJ_WITHOUT_CTIME) @WIN_UBANCHOR_OBJ_LINK@ -TESTBOUND_SRC=testcode/testbound.c testcode/ldns-testpkts.c \ +TESTBOUND_SRC=testcode/testbound.c testcode/testpkts.c \ daemon/worker.c daemon/acl_list.c daemon/daemon.c daemon/stats.c \ testcode/replay.c testcode/fake_event.c TESTBOUND_OBJ=testbound.lo replay.lo fake_event.lo -TESTBOUND_OBJ_LINK=$(TESTBOUND_OBJ) ldns-testpkts.lo worker.lo acl_list.lo \ -daemon.lo stats.lo $(COMMON_OBJ_WITHOUT_NETCALL) $(COMPAT_OBJ) +TESTBOUND_OBJ_LINK=$(TESTBOUND_OBJ) testpkts.lo worker.lo acl_list.lo \ +daemon.lo stats.lo $(COMMON_OBJ_WITHOUT_NETCALL) $(SLDNS_OBJ) $(COMPAT_OBJ) LOCKVERIFY_SRC=testcode/lock_verify.c LOCKVERIFY_OBJ=lock_verify.lo -LOCKVERIFY_OBJ_LINK=$(LOCKVERIFY_OBJ) worker_cb.lo $(COMMON_OBJ) $(COMPAT_OBJ) +LOCKVERIFY_OBJ_LINK=$(LOCKVERIFY_OBJ) worker_cb.lo $(COMMON_OBJ) $(COMPAT_OBJ) \ +$(SLDNS_OBJ) PETAL_SRC=testcode/petal.c PETAL_OBJ=petal.lo PETAL_OBJ_LINK=$(PETAL_OBJ) $(COMPAT_OBJ_WITHOUT_CTIME) PKTVIEW_SRC=testcode/pktview.c testcode/readhex.c PKTVIEW_OBJ=pktview.lo PKTVIEW_OBJ_LINK=$(PKTVIEW_OBJ) worker_cb.lo readhex.lo $(COMMON_OBJ) \ -$(COMPAT_OBJ) -SIGNIT_SRC=testcode/signit.c -SIGNIT_OBJ=signit.lo -SIGNIT_OBJ_LINK=$(SIGNIT_OBJ) worker_cb.lo $(COMMON_OBJ) $(COMPAT_OBJ) +$(COMPAT_OBJ) $(SLDNS_OBJ) MEMSTATS_SRC=testcode/memstats.c MEMSTATS_OBJ=memstats.lo -MEMSTATS_OBJ_LINK=$(MEMSTATS_OBJ) worker_cb.lo $(COMMON_OBJ) $(COMPAT_OBJ) +MEMSTATS_OBJ_LINK=$(MEMSTATS_OBJ) worker_cb.lo $(COMMON_OBJ) $(COMPAT_OBJ) \ +$(SLDNS_OBJ) ASYNCLOOK_SRC=testcode/asynclook.c ASYNCLOOK_OBJ=asynclook.lo ASYNCLOOK_OBJ_LINK=$(ASYNCLOOK_OBJ) log.lo locks.lo $(COMPAT_OBJ) STREAMTCP_SRC=testcode/streamtcp.c STREAMTCP_OBJ=streamtcp.lo -STREAMTCP_OBJ_LINK=$(STREAMTCP_OBJ) worker_cb.lo $(COMMON_OBJ) $(COMPAT_OBJ) +STREAMTCP_OBJ_LINK=$(STREAMTCP_OBJ) worker_cb.lo $(COMMON_OBJ) $(COMPAT_OBJ) \ +$(SLDNS_OBJ) PERF_SRC=testcode/perf.c PERF_OBJ=perf.lo -PERF_OBJ_LINK=$(PERF_OBJ) worker_cb.lo $(COMMON_OBJ) $(COMPAT_OBJ) +PERF_OBJ_LINK=$(PERF_OBJ) worker_cb.lo $(COMMON_OBJ) $(COMPAT_OBJ) $(SLDNS_OBJ) DELAYER_SRC=testcode/delayer.c DELAYER_OBJ=delayer.lo -DELAYER_OBJ_LINK=$(DELAYER_OBJ) worker_cb.lo $(COMMON_OBJ) $(COMPAT_OBJ) -HARVEST_SRC=testcode/harvest.c -HARVEST_OBJ=harvest.lo -HARVEST_OBJ_LINK=$(HARVEST_OBJ) $(COMPAT_OBJ_WITHOUT_CTIME) +DELAYER_OBJ_LINK=$(DELAYER_OBJ) worker_cb.lo $(COMMON_OBJ) $(COMPAT_OBJ) \ +$(SLDNS_OBJ) LIBUNBOUND_SRC=libunbound/context.c libunbound/libunbound.c \ libunbound/libworker.c LIBUNBOUND_OBJ=context.lo libunbound.lo libworker.lo -LIBUNBOUND_OBJ_LINK=$(LIBUNBOUND_OBJ) $(COMMON_OBJ) $(COMPAT_OBJ) +LIBUNBOUND_OBJ_LINK=$(LIBUNBOUND_OBJ) $(COMMON_OBJ) $(SLDNS_OBJ) $(COMPAT_OBJ) # win apps or "" if not on windows WINAPPS=@WINAPPS@ @@ -211,19 +219,19 @@ RSRC_OBJ=rsrc_svcinst.o rsrc_svcuninst.o rsrc_anchorupd.o rsrc_unbound.o \ rsrc_unbound_checkconf.o ALL_SRC=$(COMMON_SRC) $(UNITTEST_SRC) $(DAEMON_SRC) \ - $(TESTBOUND_SRC) $(LOCKVERIFY_SRC) $(PKTVIEW_SRC) $(SIGNIT_SRC) \ + $(TESTBOUND_SRC) $(LOCKVERIFY_SRC) $(PKTVIEW_SRC) \ $(MEMSTATS_SRC) $(CHECKCONF_SRC) $(LIBUNBOUND_SRC) $(HOST_SRC) \ $(ASYNCLOOK_SRC) $(STREAMTCP_SRC) $(PERF_SRC) $(DELAYER_SRC) \ - $(HARVEST_SRC) $(CONTROL_SRC) $(UBANCHOR_SRC) $(PETAL_SRC) \ + $(CONTROL_SRC) $(UBANCHOR_SRC) $(PETAL_SRC) \ $(PYTHONMOD_SRC) $(PYUNBOUND_SRC) $(WIN_DAEMON_THE_SRC)\ - $(SVCINST_SRC) $(SVCUNINST_SRC) $(ANCHORUPD_SRC) + $(SVCINST_SRC) $(SVCUNINST_SRC) $(ANCHORUPD_SRC) $(SLDNS_SRC) ALL_OBJ=$(COMMON_OBJ) $(UNITTEST_OBJ) $(DAEMON_OBJ) \ - $(TESTBOUND_OBJ) $(LOCKVERIFY_OBJ) $(PKTVIEW_OBJ) $(SIGNIT_OBJ) \ + $(TESTBOUND_OBJ) $(LOCKVERIFY_OBJ) $(PKTVIEW_OBJ) \ $(MEMSTATS_OBJ) $(CHECKCONF_OBJ) $(LIBUNBOUND_OBJ) $(HOST_OBJ) \ $(ASYNCLOOK_OBJ) $(STREAMTCP_OBJ) $(PERF_OBJ) $(DELAYER_OBJ) \ - $(HARVEST_OBJ) $(CONTROL_OBJ) $(UBANCHOR_OBJ) $(PETAL_OBJ) \ + $(CONTROL_OBJ) $(UBANCHOR_OBJ) $(PETAL_OBJ) \ $(COMPAT_OBJ) $(PYUNBOUND_OBJ) \ - $(SVCINST_OBJ) $(SVCUNINST_OBJ) $(ANCHORUPD_OBJ) + $(SVCINST_OBJ) $(SVCUNINST_OBJ) $(ANCHORUPD_OBJ) $(SLDNS_OBJ) COMPILE=$(LIBTOOL) --tag=CC --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) LINK=$(LIBTOOL) --tag=CC --mode=link $(CC) $(staticexe) $(RUNTIME_PATH) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) @@ -257,9 +265,9 @@ rsrc_unbound_anchor.o: $(srcdir)/winrc/rsrc_unbound_anchor.rc config.h rsrc_unbound_control.o: $(srcdir)/winrc/rsrc_unbound_control.rc config.h rsrc_unbound_checkconf.o: $(srcdir)/winrc/rsrc_unbound_checkconf.rc config.h -TEST_BIN=asynclook$(EXEEXT) delayer$(EXEEXT) harvest$(EXEEXT) \ +TEST_BIN=asynclook$(EXEEXT) delayer$(EXEEXT) \ lock-verify$(EXEEXT) memstats$(EXEEXT) perf$(EXEEXT) \ - petal$(EXEEXT) pktview$(EXEEXT) signit$(EXEEXT) streamtcp$(EXEEXT) \ + petal$(EXEEXT) pktview$(EXEEXT) streamtcp$(EXEEXT) \ testbound$(EXEEXT) unittest$(EXEEXT) tests: all $(TEST_BIN) @@ -275,7 +283,7 @@ test: unittest$(EXEEXT) testbound$(EXEEXT) longtest: tests if test -x "`which bash`"; then bash testcode/do-tests.sh; else sh testcode/do-tests.sh; fi -lib: libunbound.la +lib: libunbound.la unbound.h libunbound.la: $(LIBUNBOUND_OBJ_LINK) $(LINK_LIB) $(UBSYMS) -o $@ $(LIBUNBOUND_OBJ_LINK) -rpath $(libdir) -lssl $(LIBS) @@ -319,9 +327,6 @@ petal$(EXEEXT): $(PETAL_OBJ_LINK) pktview$(EXEEXT): $(PKTVIEW_OBJ_LINK) $(LINK) -o $@ $(PKTVIEW_OBJ_LINK) -lssl $(LIBS) -signit$(EXEEXT): $(SIGNIT_OBJ_LINK) - $(LINK) -o $@ $(SIGNIT_OBJ_LINK) -lssl $(LIBS) - memstats$(EXEEXT): $(MEMSTATS_OBJ_LINK) $(LINK) -o $@ $(MEMSTATS_OBJ_LINK) -lssl $(LIBS) @@ -337,18 +342,16 @@ perf$(EXEEXT): $(PERF_OBJ_LINK) delayer$(EXEEXT): $(DELAYER_OBJ_LINK) $(LINK) -o $@ $(DELAYER_OBJ_LINK) -lssl $(LIBS) -harvest$(EXEEXT): $(HARVEST_OBJ_LINK) libunbound.la - $(LINK) -o $@ $(HARVEST_OBJ_LINK) $(LIBS) -L. -L.libs -lunbound +signit$(EXEEXT): testcode/signit.c + $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ testcode/signit.c $(LDFLAGS) -lldns -lssl $(LIBS) + +unbound.h: $(srcdir)/libunbound/unbound.h + sed -e 's/@''UNBOUND_VERSION_MAJOR@/$(UNBOUND_VERSION_MAJOR)/' -e 's/@''UNBOUND_VERSION_MINOR@/$(UNBOUND_VERSION_MINOR)/' -e 's/@''UNBOUND_VERSION_MICRO@/$(UNBOUND_VERSION_MICRO)/' < $(srcdir)/libunbound/unbound.h > $@ unbound-control-setup: $(srcdir)/smallapp/unbound-control-setup.sh sed -e 's:^DESTDIR=.*$$:DESTDIR=$(UNBOUND_RUN_DIR):' < $(srcdir)/smallapp/unbound-control-setup.sh > $@ -chmod +x $@ -#testcode/ldns-testpkts.c: $(ldnsdir)/examples/ldns-testpkts.c \ -# $(ldnsdir)/examples/ldns-testpkts.h -# cp $(ldnsdir)/examples/ldns-testpkts.c testcode/ldns-testpkts.c -# cp $(ldnsdir)/examples/ldns-testpkts.h testcode/ldns-testpkts.h - # Python Module pythonmod.lo pythonmod.o: $(srcdir)/pythonmod/pythonmod.c config.h \ pythonmod/interface.h \ @@ -367,8 +370,8 @@ pythonmod/interface.h: $(srcdir)/pythonmod/interface.i config.h $(SWIG) $(CPPFLAGS) -o $@ -python $(srcdir)/pythonmod/interface.i libunbound_wrap.lo libunbound_wrap.o: libunbound/python/libunbound_wrap.c \ - $(srcdir)/libunbound/unbound.h -libunbound/python/libunbound_wrap.c: $(srcdir)/libunbound/python/libunbound.i $(srcdir)/libunbound/unbound.h + unbound.h +libunbound/python/libunbound_wrap.c: $(srcdir)/libunbound/python/libunbound.i unbound.h @-if test ! -d libunbound/python; then $(INSTALL) -d libunbound/python; fi $(SWIG) -python -o $@ $(CPPFLAGS) $(srcdir)/libunbound/python/libunbound.i @@ -391,7 +394,7 @@ util/configparser.c util/configparser.h: $(srcdir)/util/configparser.y clean: rm -f *.o *.d *.lo *~ tags - rm -f unbound$(EXEEXT) unbound-checkconf$(EXEEXT) unbound-host$(EXEEXT) unbound-control$(EXEEXT) unbound-anchor$(EXEEXT) unbound-control-setup libunbound.la + rm -f unbound$(EXEEXT) unbound-checkconf$(EXEEXT) unbound-host$(EXEEXT) unbound-control$(EXEEXT) unbound-anchor$(EXEEXT) unbound-control-setup libunbound.la unbound.h rm -f $(ALL_SRC:.c=.lint) rm -f _unbound.la libunbound/python/libunbound_wrap.c libunbound/python/unbound.py pythonmod/interface.h pythonmod/unboundmodule.py rm -rf autom4te.cache .libs build doc/html doc/xml @@ -406,7 +409,7 @@ realclean: clean .SUFFIXES: .lint .c.lint: - $(LINT) $(LINTFLAGS) -I. -I$(srcdir) -I$(ldnsdir)/include $< + $(LINT) $(LINTFLAGS) -I. -I$(srcdir) $< touch $@ util/configparser.lint util/configlexer.lint pythonmod/pythonmod.lint libunbound/python/libunbound_wrap.lint: @@ -449,26 +452,17 @@ pyunbound-install: $(LIBTOOL) --mode=install cp _unbound.la $(DESTDIR)$(PYTHON_SITE_PKG) $(LIBTOOL) --mode=finish $(DESTDIR)$(PYTHON_SITE_PKG) -install: all $(PYTHONMOD_INSTALL) $(PYUNBOUND_INSTALL) - $(INSTALL) -m 755 -d $(DESTDIR)$(sbindir) - $(INSTALL) -m 755 -d $(DESTDIR)$(mandir) - $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man8 - $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man5 - $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man3 - $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1 +unbound-event-install: + $(INSTALL) -m 755 -d $(DESTDIR)$(includedir) + $(LIBTOOL) --mode=install cp $(srcdir)/libunbound/unbound-event.h $(DESTDIR)$(includedir)/unbound-event.h + +install: $(INSTALLTARGET) + +install-lib: lib $(UNBOUND_EVENT_INSTALL) $(INSTALL) -m 755 -d $(DESTDIR)$(libdir) $(INSTALL) -m 755 -d $(DESTDIR)$(includedir) - $(LIBTOOL) --mode=install cp unbound$(EXEEXT) $(DESTDIR)$(sbindir)/unbound$(EXEEXT) - $(LIBTOOL) --mode=install cp unbound-checkconf$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-checkconf$(EXEEXT) - $(LIBTOOL) --mode=install cp unbound-control$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-control$(EXEEXT) - $(LIBTOOL) --mode=install cp unbound-host$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-host$(EXEEXT) - $(LIBTOOL) --mode=install cp unbound-anchor$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-anchor$(EXEEXT) - $(INSTALL) -c -m 644 doc/unbound.8 $(DESTDIR)$(mandir)/man8 - $(INSTALL) -c -m 644 doc/unbound-checkconf.8 $(DESTDIR)$(mandir)/man8 - $(INSTALL) -c -m 644 doc/unbound-control.8 $(DESTDIR)$(mandir)/man8 - $(INSTALL) -c -m 644 doc/unbound-anchor.8 $(DESTDIR)$(mandir)/man8 - $(INSTALL) -c -m 644 doc/unbound.conf.5 $(DESTDIR)$(mandir)/man5 - $(INSTALL) -c -m 644 $(srcdir)/doc/unbound-host.1 $(DESTDIR)$(mandir)/man1 + $(INSTALL) -m 755 -d $(DESTDIR)$(mandir) + $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man3 $(INSTALL) -c -m 644 doc/libunbound.3 $(DESTDIR)$(mandir)/man3 for mpage in ub_ctx ub_result ub_ctx_create ub_ctx_delete \ ub_ctx_set_option ub_ctx_get_option ub_ctx_config ub_ctx_set_fwd \ @@ -480,12 +474,31 @@ install: all $(PYTHONMOD_INSTALL) $(PYUNBOUND_INSTALL) do \ echo ".so man3/libunbound.3" > $(DESTDIR)$(mandir)/man3/$$mpage.3 ; \ done - $(INSTALL) -c -m 755 unbound-control-setup $(DESTDIR)$(sbindir)/unbound-control-setup - if test ! -e $(DESTDIR)$(configfile); then $(INSTALL) -d `dirname $(DESTDIR)$(configfile)`; $(INSTALL) -c -m 644 doc/example.conf $(DESTDIR)$(configfile); fi - $(LIBTOOL) --mode=install cp $(srcdir)/libunbound/unbound.h $(DESTDIR)$(includedir)/unbound.h + $(LIBTOOL) --mode=install cp unbound.h $(DESTDIR)$(includedir)/unbound.h $(LIBTOOL) --mode=install cp libunbound.la $(DESTDIR)$(libdir) $(LIBTOOL) --mode=finish $(DESTDIR)$(libdir) +install-all: all $(PYTHONMOD_INSTALL) $(PYUNBOUND_INSTALL) $(UNBOUND_EVENT_INSTALL) install-lib + $(INSTALL) -m 755 -d $(DESTDIR)$(sbindir) + $(INSTALL) -m 755 -d $(DESTDIR)$(mandir) + $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man8 + $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man5 + $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1 + $(LIBTOOL) --mode=install cp unbound$(EXEEXT) $(DESTDIR)$(sbindir)/unbound$(EXEEXT) + $(LIBTOOL) --mode=install cp unbound-checkconf$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-checkconf$(EXEEXT) + $(LIBTOOL) --mode=install cp unbound-control$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-control$(EXEEXT) + $(LIBTOOL) --mode=install cp unbound-host$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-host$(EXEEXT) + $(LIBTOOL) --mode=install cp unbound-anchor$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-anchor$(EXEEXT) + $(INSTALL) -c -m 644 doc/unbound.8 $(DESTDIR)$(mandir)/man8 + $(INSTALL) -c -m 644 doc/unbound-checkconf.8 $(DESTDIR)$(mandir)/man8 + $(INSTALL) -c -m 644 doc/unbound-control.8 $(DESTDIR)$(mandir)/man8 + $(INSTALL) -c -m 644 doc/unbound-control.8 $(DESTDIR)$(mandir)/man8/unbound-control-setup.8 + $(INSTALL) -c -m 644 doc/unbound-anchor.8 $(DESTDIR)$(mandir)/man8 + $(INSTALL) -c -m 644 doc/unbound.conf.5 $(DESTDIR)$(mandir)/man5 + $(INSTALL) -c -m 644 $(srcdir)/doc/unbound-host.1 $(DESTDIR)$(mandir)/man1 + $(INSTALL) -c -m 755 unbound-control-setup $(DESTDIR)$(sbindir)/unbound-control-setup + if test ! -e $(DESTDIR)$(configfile); then $(INSTALL) -d `dirname $(DESTDIR)$(configfile)`; $(INSTALL) -c -m 644 doc/example.conf $(DESTDIR)$(configfile); fi + pythonmod-uninstall: rm -f -- $(DESTDIR)$(PYTHON_SITE_PKG)/unboundmodule.py @@ -493,9 +506,12 @@ pyunbound-uninstall: rm -f -- $(DESTDIR)$(PYTHON_SITE_PKG)/unbound.py $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(PYTHON_SITE_PKG)/_unbound.la -uninstall: $(PYTHONMOD_UNINSTALL) $(PYUNBOUND_UNINSTALL) +unbound-event-uninstall: + rm -f -- $(DESTDIR)$(includedir)/unbound-event.h + +uninstall: $(PYTHONMOD_UNINSTALL) $(PYUNBOUND_UNINSTALL) $(UNBOUND_EVENT_UNINSTALL) rm -f -- $(DESTDIR)$(sbindir)/unbound$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-checkconf$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-host$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-control$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-anchor$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-control-setup - rm -f -- $(DESTDIR)$(mandir)/man8/unbound.8 $(DESTDIR)$(mandir)/man8/unbound-checkconf.8 $(DESTDIR)$(mandir)/man5/unbound.conf.5 $(DESTDIR)$(mandir)/man8/unbound-control.8 $(DESTDIR)$(mandir)/man8/unbound-anchor.8 + rm -f -- $(DESTDIR)$(mandir)/man8/unbound.8 $(DESTDIR)$(mandir)/man8/unbound-checkconf.8 $(DESTDIR)$(mandir)/man5/unbound.conf.5 $(DESTDIR)$(mandir)/man8/unbound-control.8 $(DESTDIR)$(mandir)/man8/unbound-anchor.8 $(DESTDIR)$(mandir)/man8/unbound-control-setup.8 rm -f -- $(DESTDIR)$(mandir)/man1/unbound-host.1 $(DESTDIR)$(mandir)/man3/libunbound.3 for mpage in ub_ctx ub_result ub_ctx_create ub_ctx_delete \ ub_ctx_set_option ub_ctx_get_option ub_ctx_config ub_ctx_set_fwd \ @@ -556,655 +572,3 @@ depend: rm -f $(DEPEND_TMP) $(DEPEND_TMP2) # Dependencies -dns.lo dns.o: $(srcdir)/services/cache/dns.c config.h $(srcdir)/iterator/iter_delegpt.h $(srcdir)/util/log.h \ - $(srcdir)/validator/val_nsec.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ - $(srcdir)/services/cache/dns.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \ - $(srcdir)/util/data/dname.h $(srcdir)/util/module.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/util/net_help.h \ - $(srcdir)/util/regional.h $(srcdir)/util/config_file.h -infra.lo infra.o: $(srcdir)/services/cache/infra.c config.h \ - $(srcdir)/services/cache/infra.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/rtt.h \ - $(srcdir)/util/storage/slabhash.h $(srcdir)/util/storage/lookup3.h $(srcdir)/util/data/dname.h \ - $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h $(srcdir)/iterator/iterator.h \ - $(srcdir)/services/outbound_list.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/module.h $(srcdir)/util/data/msgparse.h \ - -rrset.lo rrset.o: $(srcdir)/services/cache/rrset.c config.h $(srcdir)/services/cache/rrset.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/util/storage/slabhash.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/config_file.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/regional.h $(srcdir)/util/alloc.h -dname.lo dname.o: $(srcdir)/util/data/dname.c config.h $(srcdir)/util/data/dname.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/util/data/msgparse.h \ - $(srcdir)/util/storage/lookup3.h -msgencode.lo msgencode.o: $(srcdir)/util/data/msgencode.c config.h \ - $(srcdir)/util/data/msgencode.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/util/data/dname.h \ - $(srcdir)/util/regional.h $(srcdir)/util/net_help.h -msgparse.lo msgparse.o: $(srcdir)/util/data/msgparse.c config.h \ - $(srcdir)/util/data/msgparse.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/dname.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lookup3.h $(srcdir)/util/regional.h -msgreply.lo msgreply.o: $(srcdir)/util/data/msgreply.c config.h \ - $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/storage/lookup3.h $(srcdir)/util/alloc.h $(srcdir)/util/netevent.h $(srcdir)/util/net_help.h \ - $(srcdir)/util/data/dname.h $(srcdir)/util/regional.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/util/data/msgencode.h -packed_rrset.lo packed_rrset.o: $(srcdir)/util/data/packed_rrset.c config.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/util/data/dname.h $(srcdir)/util/storage/lookup3.h $(srcdir)/util/alloc.h $(srcdir)/util/regional.h \ - $(srcdir)/util/net_help.h -iterator.lo iterator.o: $(srcdir)/iterator/iterator.c config.h \ - $(srcdir)/iterator/iterator.h \ - $(srcdir)/services/outbound_list.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/module.h \ - $(srcdir)/util/data/msgparse.h $(srcdir)/iterator/iter_utils.h $(srcdir)/iterator/iter_resptype.h \ - $(srcdir)/iterator/iter_hints.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h \ - $(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_donotq.h $(srcdir)/iterator/iter_delegpt.h \ - $(srcdir)/iterator/iter_scrub.h $(srcdir)/iterator/iter_priv.h $(srcdir)/validator/val_neg.h \ - $(srcdir)/services/cache/dns.h $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h $(srcdir)/util/netevent.h \ - $(srcdir)/util/net_help.h $(srcdir)/util/regional.h $(srcdir)/util/data/dname.h $(srcdir)/util/data/msgencode.h \ - $(srcdir)/util/fptr_wlist.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h \ - $(srcdir)/util/config_file.h -iter_delegpt.lo iter_delegpt.o: $(srcdir)/iterator/iter_delegpt.c config.h $(srcdir)/iterator/iter_delegpt.h \ - $(srcdir)/util/log.h \ - $(srcdir)/services/cache/dns.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/regional.h \ - $(srcdir)/util/data/dname.h $(srcdir)/util/net_help.h -iter_donotq.lo iter_donotq.o: $(srcdir)/iterator/iter_donotq.c config.h $(srcdir)/iterator/iter_donotq.h \ - $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/util/regional.h $(srcdir)/util/log.h \ - $(srcdir)/util/config_file.h \ - $(srcdir)/util/net_help.h -iter_fwd.lo iter_fwd.o: $(srcdir)/iterator/iter_fwd.c config.h \ - $(srcdir)/iterator/iter_fwd.h \ - $(srcdir)/util/rbtree.h $(srcdir)/iterator/iter_delegpt.h $(srcdir)/util/log.h $(srcdir)/util/config_file.h \ - $(srcdir)/util/net_help.h $(srcdir)/util/data/dname.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h -iter_hints.lo iter_hints.o: $(srcdir)/iterator/iter_hints.c config.h \ - $(srcdir)/iterator/iter_hints.h \ - $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/iterator/iter_delegpt.h $(srcdir)/util/log.h \ - $(srcdir)/util/config_file.h $(srcdir)/util/net_help.h $(srcdir)/util/data/dname.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h -iter_priv.lo iter_priv.o: $(srcdir)/iterator/iter_priv.c config.h \ - $(srcdir)/iterator/iter_priv.h \ - $(srcdir)/util/rbtree.h \ - $(srcdir)/util/regional.h $(srcdir)/util/log.h $(srcdir)/util/config_file.h $(srcdir)/util/data/dname.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/util/net_help.h \ - $(srcdir)/util/storage/dnstree.h -iter_resptype.lo iter_resptype.o: $(srcdir)/iterator/iter_resptype.c config.h \ - $(srcdir)/iterator/iter_resptype.h $(srcdir)/iterator/iter_delegpt.h $(srcdir)/util/log.h \ - $(srcdir)/services/cache/dns.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/net_help.h \ - $(srcdir)/util/data/dname.h -iter_scrub.lo iter_scrub.o: $(srcdir)/iterator/iter_scrub.c config.h $(srcdir)/iterator/iter_scrub.h \ - $(srcdir)/iterator/iterator.h \ - $(srcdir)/services/outbound_list.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/module.h \ - $(srcdir)/util/data/msgparse.h \ - $(srcdir)/iterator/iter_priv.h $(srcdir)/util/rbtree.h $(srcdir)/services/cache/rrset.h \ - $(srcdir)/util/storage/slabhash.h $(srcdir)/util/net_help.h $(srcdir)/util/regional.h \ - $(srcdir)/util/config_file.h $(srcdir)/util/data/dname.h $(srcdir)/util/alloc.h -iter_utils.lo iter_utils.o: $(srcdir)/iterator/iter_utils.c config.h $(srcdir)/iterator/iter_utils.h \ - $(srcdir)/iterator/iter_resptype.h \ - $(srcdir)/iterator/iterator.h \ - $(srcdir)/services/outbound_list.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/module.h \ - $(srcdir)/util/data/msgparse.h \ - $(srcdir)/iterator/iter_hints.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h \ - $(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_donotq.h $(srcdir)/iterator/iter_delegpt.h \ - $(srcdir)/iterator/iter_priv.h $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h \ - $(srcdir)/services/cache/dns.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \ - $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h $(srcdir)/util/regional.h $(srcdir)/util/data/dname.h \ - $(srcdir)/util/random.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h $(srcdir)/util/tube.h \ - $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h $(srcdir)/validator/val_anchor.h \ - $(srcdir)/validator/val_kcache.h $(srcdir)/validator/val_kentry.h $(srcdir)/validator/val_utils.h -listen_dnsport.lo listen_dnsport.o: $(srcdir)/services/listen_dnsport.c config.h \ - $(srcdir)/services/listen_dnsport.h $(srcdir)/util/netevent.h \ - $(srcdir)/services/outside_network.h $(srcdir)/util/rbtree.h $(srcdir)/util/log.h $(srcdir)/util/config_file.h \ - $(srcdir)/util/net_help.h -localzone.lo localzone.o: $(srcdir)/services/localzone.c config.h \ - $(srcdir)/services/localzone.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/regional.h $(srcdir)/util/config_file.h \ - $(srcdir)/util/data/dname.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/data/msgencode.h $(srcdir)/util/net_help.h $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/data/msgparse.h -mesh.lo mesh.o: $(srcdir)/services/mesh.c config.h \ - $(srcdir)/services/mesh.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/netevent.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/module.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/services/modstack.h \ - $(srcdir)/services/outbound_list.h $(srcdir)/services/cache/dns.h $(srcdir)/util/net_help.h \ - $(srcdir)/util/regional.h $(srcdir)/util/data/msgencode.h $(srcdir)/util/timehist.h $(srcdir)/util/fptr_wlist.h \ - $(srcdir)/util/tube.h $(srcdir)/util/alloc.h $(srcdir)/util/config_file.h -modstack.lo modstack.o: $(srcdir)/services/modstack.c config.h $(srcdir)/services/modstack.h \ - $(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/data/msgparse.h \ - $(srcdir)/util/fptr_wlist.h \ - $(srcdir)/util/netevent.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \ - $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h $(srcdir)/validator/validator.h \ - $(srcdir)/validator/val_utils.h -outbound_list.lo outbound_list.o: $(srcdir)/services/outbound_list.c config.h \ - $(srcdir)/services/outbound_list.h $(srcdir)/services/outside_network.h $(srcdir)/util/rbtree.h \ - $(srcdir)/util/netevent.h \ - -outside_network.lo outside_network.o: $(srcdir)/services/outside_network.c config.h \ - $(srcdir)/services/outside_network.h $(srcdir)/util/rbtree.h $(srcdir)/util/netevent.h \ - $(srcdir)/services/listen_dnsport.h $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/rtt.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgencode.h \ - $(srcdir)/util/data/dname.h $(srcdir)/util/net_help.h $(srcdir)/util/random.h $(srcdir)/util/fptr_wlist.h \ - $(srcdir)/util/module.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h \ - -alloc.lo alloc.o: $(srcdir)/util/alloc.c config.h $(srcdir)/util/alloc.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/util/regional.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/fptr_wlist.h \ - $(srcdir)/util/netevent.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/util/tube.h \ - $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h -config_file.lo config_file.o: $(srcdir)/util/config_file.c config.h \ - $(srcdir)/util/log.h \ - $(srcdir)/util/configyyrename.h $(srcdir)/util/config_file.h util/configparser.h \ - $(srcdir)/util/net_help.h $(srcdir)/util/data/msgparse.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ - $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/regional.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h $(srcdir)/util/tube.h \ - $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h $(srcdir)/util/data/dname.h \ - $(srcdir)/util/iana_ports.inc -configlexer.lo configlexer.o: util/configlexer.c config.h $(srcdir)/util/configyyrename.h \ - $(srcdir)/util/config_file.h util/configparser.h -configparser.lo configparser.o: util/configparser.c config.h $(srcdir)/util/configyyrename.h \ - $(srcdir)/util/config_file.h $(srcdir)/util/net_help.h $(srcdir)/util/log.h \ - -fptr_wlist.lo fptr_wlist.o: $(srcdir)/util/fptr_wlist.c config.h $(srcdir)/util/fptr_wlist.h \ - $(srcdir)/util/netevent.h \ - $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/data/msgparse.h \ - $(srcdir)/util/tube.h \ - $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h $(srcdir)/util/mini_event.h \ - $(srcdir)/daemon/worker.h $(srcdir)/util/alloc.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h \ - $(srcdir)/daemon/remote.h \ - $(srcdir)/services/outside_network.h $(srcdir)/services/localzone.h $(srcdir)/services/cache/infra.h \ - $(srcdir)/util/rtt.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \ - $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h $(srcdir)/iterator/iter_fwd.h \ - $(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h $(srcdir)/validator/val_anchor.h \ - $(srcdir)/validator/val_nsec3.h $(srcdir)/validator/val_sigcrypt.h $(srcdir)/validator/val_kentry.h \ - $(srcdir)/validator/val_neg.h $(srcdir)/validator/autotrust.h $(srcdir)/util/storage/dnstree.h \ - $(srcdir)/libunbound/libworker.h $(srcdir)/libunbound/context.h $(srcdir)/libunbound/unbound.h \ - $(srcdir)/util/config_file.h -locks.lo locks.o: $(srcdir)/util/locks.c config.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - -log.lo log.o: $(srcdir)/util/log.c config.h $(srcdir)/util/log.h \ - $(srcdir)/util/locks.h -mini_event.lo mini_event.o: $(srcdir)/util/mini_event.c config.h -module.lo module.o: $(srcdir)/util/module.c config.h $(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/data/msgparse.h \ - -netevent.lo netevent.o: $(srcdir)/util/netevent.c config.h \ - $(srcdir)/util/netevent.h \ - $(srcdir)/util/log.h $(srcdir)/util/net_help.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/locks.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/data/msgparse.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \ - $(srcdir)/services/modstack.h \ - -net_help.lo net_help.o: $(srcdir)/util/net_help.c config.h \ - $(srcdir)/util/net_help.h \ - $(srcdir)/util/log.h $(srcdir)/util/data/dname.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ - $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/data/msgparse.h $(srcdir)/util/regional.h \ - -random.lo random.o: $(srcdir)/util/random.c config.h $(srcdir)/util/random.h $(srcdir)/util/log.h \ - -rbtree.lo rbtree.o: $(srcdir)/util/rbtree.c config.h $(srcdir)/util/log.h \ - $(srcdir)/util/fptr_wlist.h \ - $(srcdir)/util/netevent.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/data/msgparse.h \ - $(srcdir)/util/tube.h \ - $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h -regional.lo regional.o: $(srcdir)/util/regional.c config.h $(srcdir)/util/log.h \ - $(srcdir)/util/regional.h -rtt.lo rtt.o: $(srcdir)/util/rtt.c config.h $(srcdir)/util/rtt.h -dnstree.lo dnstree.o: $(srcdir)/util/storage/dnstree.c config.h $(srcdir)/util/storage/dnstree.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/data/dname.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ - $(srcdir)/util/log.h \ - $(srcdir)/util/net_help.h -lookup3.lo lookup3.o: $(srcdir)/util/storage/lookup3.c config.h $(srcdir)/util/storage/lookup3.h -lruhash.lo lruhash.o: $(srcdir)/util/storage/lruhash.c config.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/util/fptr_wlist.h \ - $(srcdir)/util/netevent.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/data/msgparse.h \ - $(srcdir)/util/tube.h \ - $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h -slabhash.lo slabhash.o: $(srcdir)/util/storage/slabhash.c config.h $(srcdir)/util/storage/slabhash.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - -timehist.lo timehist.o: $(srcdir)/util/timehist.c config.h $(srcdir)/util/timehist.h $(srcdir)/util/log.h \ - -tube.lo tube.o: $(srcdir)/util/tube.c config.h $(srcdir)/util/tube.h $(srcdir)/util/log.h \ - $(srcdir)/util/net_help.h \ - $(srcdir)/util/netevent.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ - $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/data/msgparse.h \ - $(srcdir)/services/mesh.h \ - $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h -winsock_event.lo winsock_event.o: $(srcdir)/util/winsock_event.c config.h -autotrust.lo autotrust.o: $(srcdir)/validator/autotrust.c config.h \ - $(srcdir)/validator/autotrust.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/validator/val_anchor.h $(srcdir)/validator/val_utils.h \ - $(srcdir)/validator/val_sigcrypt.h $(srcdir)/util/data/dname.h $(srcdir)/util/module.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/util/net_help.h \ - $(srcdir)/util/config_file.h $(srcdir)/util/regional.h $(srcdir)/util/random.h $(srcdir)/services/mesh.h \ - $(srcdir)/util/netevent.h $(srcdir)/services/modstack.h $(srcdir)/services/cache/rrset.h \ - $(srcdir)/util/storage/slabhash.h $(srcdir)/validator/val_kcache.h -val_anchor.lo val_anchor.o: $(srcdir)/validator/val_anchor.c config.h \ - $(srcdir)/validator/val_anchor.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/validator/val_sigcrypt.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/validator/autotrust.h \ - $(srcdir)/util/data/dname.h $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h -validator.lo validator.o: $(srcdir)/validator/validator.c config.h \ - $(srcdir)/validator/validator.h \ - $(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/validator/val_utils.h $(srcdir)/validator/val_anchor.h $(srcdir)/util/rbtree.h \ - $(srcdir)/validator/val_kcache.h $(srcdir)/util/storage/slabhash.h $(srcdir)/validator/val_kentry.h \ - $(srcdir)/validator/val_nsec.h $(srcdir)/validator/val_nsec3.h $(srcdir)/validator/val_neg.h \ - $(srcdir)/validator/val_sigcrypt.h $(srcdir)/validator/autotrust.h $(srcdir)/services/cache/dns.h \ - $(srcdir)/util/data/dname.h $(srcdir)/util/net_help.h $(srcdir)/util/regional.h $(srcdir)/util/config_file.h \ - $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h \ - $(srcdir)/services/modstack.h -val_kcache.lo val_kcache.o: $(srcdir)/validator/val_kcache.c config.h $(srcdir)/validator/val_kcache.h \ - $(srcdir)/util/storage/slabhash.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/validator/val_kentry.h \ - $(srcdir)/util/config_file.h $(srcdir)/util/data/dname.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/data/msgparse.h \ - -val_kentry.lo val_kentry.o: $(srcdir)/validator/val_kentry.c config.h \ - $(srcdir)/validator/val_kentry.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/data/dname.h $(srcdir)/util/storage/lookup3.h $(srcdir)/util/regional.h $(srcdir)/util/net_help.h -val_neg.lo val_neg.o: $(srcdir)/validator/val_neg.c config.h \ - $(srcdir)/validator/val_neg.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/util/rbtree.h \ - $(srcdir)/validator/val_nsec.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/validator/val_nsec3.h \ - $(srcdir)/validator/val_utils.h $(srcdir)/util/data/dname.h $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h $(srcdir)/services/cache/rrset.h \ - $(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/dns.h -val_nsec3.lo val_nsec3.o: $(srcdir)/validator/val_nsec3.c config.h \ - $(srcdir)/validator/val_nsec3.h $(srcdir)/util/rbtree.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/validator/validator.h \ - $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/validator/val_utils.h \ - $(srcdir)/validator/val_kentry.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \ - $(srcdir)/util/regional.h $(srcdir)/util/net_help.h $(srcdir)/util/data/dname.h $(srcdir)/validator/val_nsec.h -val_nsec.lo val_nsec.o: $(srcdir)/validator/val_nsec.c config.h \ - $(srcdir)/validator/val_nsec.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/validator/val_utils.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/dname.h \ - $(srcdir)/util/net_help.h $(srcdir)/util/module.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h -val_secalgo.lo val_secalgo.o: $(srcdir)/validator/val_secalgo.c config.h \ - $(srcdir)/validator/val_secalgo.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - -val_sigcrypt.lo val_sigcrypt.o: $(srcdir)/validator/val_sigcrypt.c config.h \ - $(srcdir)/validator/val_sigcrypt.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/validator/val_secalgo.h $(srcdir)/validator/validator.h $(srcdir)/util/module.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/validator/val_utils.h \ - $(srcdir)/util/data/dname.h $(srcdir)/util/rbtree.h $(srcdir)/util/net_help.h $(srcdir)/util/regional.h \ - -val_utils.lo val_utils.o: $(srcdir)/validator/val_utils.c config.h $(srcdir)/validator/val_utils.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/validator/validator.h \ - $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/validator/val_kentry.h \ - $(srcdir)/validator/val_sigcrypt.h $(srcdir)/validator/val_anchor.h $(srcdir)/util/rbtree.h \ - $(srcdir)/validator/val_nsec.h $(srcdir)/validator/val_neg.h $(srcdir)/services/cache/rrset.h \ - $(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/dns.h $(srcdir)/util/data/dname.h \ - $(srcdir)/util/net_help.h $(srcdir)/util/regional.h -checklocks.lo checklocks.o: $(srcdir)/testcode/checklocks.c config.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/testcode/checklocks.h -unitanchor.lo unitanchor.o: $(srcdir)/testcode/unitanchor.c config.h \ - $(srcdir)/util/log.h \ - $(srcdir)/util/data/dname.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ - $(srcdir)/testcode/unitmain.h $(srcdir)/validator/val_anchor.h $(srcdir)/util/rbtree.h -unitdname.lo unitdname.o: $(srcdir)/testcode/unitdname.c config.h \ - $(srcdir)/util/log.h \ - $(srcdir)/testcode/unitmain.h $(srcdir)/util/data/dname.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/locks.h -unitlruhash.lo unitlruhash.o: $(srcdir)/testcode/unitlruhash.c config.h $(srcdir)/testcode/unitmain.h \ - $(srcdir)/util/log.h \ - $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/locks.h $(srcdir)/util/storage/slabhash.h -unitmain.lo unitmain.o: $(srcdir)/testcode/unitmain.c config.h \ - $(srcdir)/util/log.h \ - $(srcdir)/testcode/unitmain.h $(srcdir)/util/alloc.h $(srcdir)/util/locks.h $(srcdir)/util/net_help.h \ - $(srcdir)/util/config_file.h $(srcdir)/util/rtt.h $(srcdir)/services/cache/infra.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/random.h -unitmsgparse.lo unitmsgparse.o: $(srcdir)/testcode/unitmsgparse.c config.h \ - $(srcdir)/util/log.h \ - $(srcdir)/testcode/unitmain.h $(srcdir)/util/data/msgparse.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/locks.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/data/msgencode.h $(srcdir)/util/data/dname.h $(srcdir)/util/alloc.h $(srcdir)/util/regional.h \ - $(srcdir)/util/net_help.h $(srcdir)/testcode/readhex.h -unitneg.lo unitneg.o: $(srcdir)/testcode/unitneg.c config.h $(srcdir)/util/log.h \ - $(srcdir)/util/net_help.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ - $(srcdir)/util/data/dname.h \ - $(srcdir)/testcode/unitmain.h $(srcdir)/validator/val_neg.h $(srcdir)/util/rbtree.h -unitregional.lo unitregional.o: $(srcdir)/testcode/unitregional.c config.h $(srcdir)/testcode/unitmain.h \ - $(srcdir)/util/log.h \ - $(srcdir)/util/regional.h -unitslabhash.lo unitslabhash.o: $(srcdir)/testcode/unitslabhash.c config.h $(srcdir)/testcode/unitmain.h \ - $(srcdir)/util/log.h \ - $(srcdir)/util/storage/slabhash.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h -unitverify.lo unitverify.o: $(srcdir)/testcode/unitverify.c config.h $(srcdir)/util/log.h \ - $(srcdir)/testcode/unitmain.h \ - $(srcdir)/validator/val_sigcrypt.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/locks.h \ - $(srcdir)/validator/val_secalgo.h \ - $(srcdir)/validator/val_nsec.h $(srcdir)/validator/val_nsec3.h $(srcdir)/util/rbtree.h \ - $(srcdir)/validator/validator.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/data/msgparse.h \ - $(srcdir)/validator/val_utils.h $(srcdir)/testcode/ldns-testpkts.h \ - $(srcdir)/util/data/dname.h \ - $(srcdir)/util/regional.h $(srcdir)/util/alloc.h $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h -readhex.lo readhex.o: $(srcdir)/testcode/readhex.c config.h $(srcdir)/testcode/readhex.h \ - $(srcdir)/util/log.h -ldns-testpkts.lo ldns-testpkts.o: $(srcdir)/testcode/ldns-testpkts.c config.h \ - $(srcdir)/testcode/ldns-testpkts.h -acl_list.lo acl_list.o: $(srcdir)/daemon/acl_list.c config.h $(srcdir)/daemon/acl_list.h \ - $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/util/regional.h $(srcdir)/util/log.h \ - $(srcdir)/util/config_file.h \ - $(srcdir)/util/net_help.h -cachedump.lo cachedump.o: $(srcdir)/daemon/cachedump.c config.h \ - $(srcdir)/daemon/cachedump.h \ - $(srcdir)/daemon/remote.h $(srcdir)/daemon/worker.h $(srcdir)/util/netevent.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/daemon/stats.h \ - $(srcdir)/util/timehist.h $(srcdir)/util/module.h $(srcdir)/services/cache/rrset.h \ - $(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/dns.h $(srcdir)/services/cache/infra.h \ - $(srcdir)/util/rtt.h $(srcdir)/util/regional.h $(srcdir)/util/net_help.h $(srcdir)/util/data/dname.h \ - $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h $(srcdir)/iterator/iter_delegpt.h \ - $(srcdir)/iterator/iter_utils.h $(srcdir)/iterator/iter_resptype.h $(srcdir)/iterator/iter_fwd.h \ - $(srcdir)/util/rbtree.h $(srcdir)/iterator/iter_hints.h $(srcdir)/util/storage/dnstree.h -daemon.lo daemon.o: $(srcdir)/daemon/daemon.c config.h \ - $(srcdir)/daemon/daemon.h \ - $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/alloc.h $(srcdir)/services/modstack.h $(srcdir)/daemon/worker.h \ - $(srcdir)/util/netevent.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/daemon/stats.h \ - $(srcdir)/util/timehist.h $(srcdir)/util/module.h $(srcdir)/daemon/remote.h $(srcdir)/daemon/acl_list.h \ - $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/util/config_file.h \ - $(srcdir)/util/storage/lookup3.h $(srcdir)/util/storage/slabhash.h $(srcdir)/services/listen_dnsport.h \ - $(srcdir)/services/cache/rrset.h $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h \ - $(srcdir)/services/localzone.h $(srcdir)/util/random.h $(srcdir)/util/tube.h $(srcdir)/util/net_help.h -remote.lo remote.o: $(srcdir)/daemon/remote.c config.h \ - $(srcdir)/daemon/remote.h \ - $(srcdir)/daemon/worker.h $(srcdir)/util/netevent.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/alloc.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/data/msgparse.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/util/module.h \ - $(srcdir)/daemon/daemon.h $(srcdir)/services/modstack.h $(srcdir)/daemon/cachedump.h \ - $(srcdir)/util/config_file.h $(srcdir)/util/net_help.h $(srcdir)/services/listen_dnsport.h \ - $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/infra.h \ - $(srcdir)/util/rtt.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/localzone.h \ - $(srcdir)/util/fptr_wlist.h $(srcdir)/util/tube.h $(srcdir)/util/data/dname.h $(srcdir)/validator/validator.h \ - $(srcdir)/validator/val_utils.h $(srcdir)/validator/val_kcache.h $(srcdir)/validator/val_kentry.h \ - $(srcdir)/validator/val_anchor.h $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h \ - $(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_hints.h $(srcdir)/util/storage/dnstree.h \ - $(srcdir)/iterator/iter_delegpt.h $(srcdir)/services/outside_network.h -stats.lo stats.o: $(srcdir)/daemon/stats.c config.h \ - $(srcdir)/daemon/stats.h \ - $(srcdir)/util/timehist.h $(srcdir)/daemon/worker.h $(srcdir)/util/netevent.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/util/module.h \ - $(srcdir)/daemon/daemon.h $(srcdir)/services/modstack.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \ - $(srcdir)/services/outside_network.h $(srcdir)/util/config_file.h $(srcdir)/util/tube.h \ - $(srcdir)/util/net_help.h $(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h -unbound.lo unbound.o: $(srcdir)/daemon/unbound.c config.h $(srcdir)/util/log.h \ - $(srcdir)/daemon/daemon.h \ - $(srcdir)/util/locks.h $(srcdir)/util/alloc.h $(srcdir)/services/modstack.h $(srcdir)/daemon/remote.h \ - $(srcdir)/util/config_file.h $(srcdir)/util/storage/slabhash.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/services/listen_dnsport.h $(srcdir)/util/netevent.h $(srcdir)/services/cache/rrset.h \ - $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/services/cache/infra.h \ - $(srcdir)/util/rtt.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/module.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/util/net_help.h -worker.lo worker.o: $(srcdir)/daemon/worker.c config.h \ - $(srcdir)/util/log.h \ - $(srcdir)/util/net_help.h $(srcdir)/util/random.h $(srcdir)/daemon/worker.h $(srcdir)/util/netevent.h \ - $(srcdir)/util/locks.h $(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/daemon/stats.h \ - $(srcdir)/util/timehist.h $(srcdir)/util/module.h $(srcdir)/daemon/daemon.h $(srcdir)/services/modstack.h \ - $(srcdir)/daemon/remote.h \ - $(srcdir)/daemon/acl_list.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h \ - $(srcdir)/util/config_file.h $(srcdir)/util/regional.h $(srcdir)/util/storage/slabhash.h \ - $(srcdir)/services/listen_dnsport.h $(srcdir)/services/outside_network.h \ - $(srcdir)/services/outbound_list.h $(srcdir)/services/cache/rrset.h $(srcdir)/services/cache/infra.h \ - $(srcdir)/util/rtt.h $(srcdir)/services/cache/dns.h $(srcdir)/services/mesh.h $(srcdir)/services/localzone.h \ - $(srcdir)/util/data/msgencode.h $(srcdir)/util/data/dname.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/tube.h \ - $(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_hints.h $(srcdir)/validator/autotrust.h \ - $(srcdir)/validator/val_anchor.h -testbound.lo testbound.o: $(srcdir)/testcode/testbound.c config.h $(srcdir)/testcode/ldns-testpkts.h \ - $(srcdir)/testcode/replay.h \ - $(srcdir)/util/netevent.h $(srcdir)/util/rbtree.h $(srcdir)/testcode/fake_event.h $(srcdir)/daemon/remote.h \ - $(srcdir)/util/config_file.h $(srcdir)/daemon/unbound.c $(srcdir)/util/log.h $(srcdir)/daemon/daemon.h \ - $(srcdir)/util/locks.h $(srcdir)/util/alloc.h $(srcdir)/services/modstack.h $(srcdir)/util/storage/slabhash.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/services/listen_dnsport.h $(srcdir)/services/cache/rrset.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/module.h $(srcdir)/util/data/msgparse.h $(srcdir)/util/net_help.h -ldns-testpkts.lo ldns-testpkts.o: $(srcdir)/testcode/ldns-testpkts.c config.h \ - $(srcdir)/testcode/ldns-testpkts.h -worker.lo worker.o: $(srcdir)/daemon/worker.c config.h \ - $(srcdir)/util/log.h \ - $(srcdir)/util/net_help.h $(srcdir)/util/random.h $(srcdir)/daemon/worker.h $(srcdir)/util/netevent.h \ - $(srcdir)/util/locks.h $(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/daemon/stats.h \ - $(srcdir)/util/timehist.h $(srcdir)/util/module.h $(srcdir)/daemon/daemon.h $(srcdir)/services/modstack.h \ - $(srcdir)/daemon/remote.h \ - $(srcdir)/daemon/acl_list.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h \ - $(srcdir)/util/config_file.h $(srcdir)/util/regional.h $(srcdir)/util/storage/slabhash.h \ - $(srcdir)/services/listen_dnsport.h $(srcdir)/services/outside_network.h \ - $(srcdir)/services/outbound_list.h $(srcdir)/services/cache/rrset.h $(srcdir)/services/cache/infra.h \ - $(srcdir)/util/rtt.h $(srcdir)/services/cache/dns.h $(srcdir)/services/mesh.h $(srcdir)/services/localzone.h \ - $(srcdir)/util/data/msgencode.h $(srcdir)/util/data/dname.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/tube.h \ - $(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_hints.h $(srcdir)/validator/autotrust.h \ - $(srcdir)/validator/val_anchor.h -acl_list.lo acl_list.o: $(srcdir)/daemon/acl_list.c config.h $(srcdir)/daemon/acl_list.h \ - $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/util/regional.h $(srcdir)/util/log.h \ - $(srcdir)/util/config_file.h \ - $(srcdir)/util/net_help.h -daemon.lo daemon.o: $(srcdir)/daemon/daemon.c config.h \ - $(srcdir)/daemon/daemon.h \ - $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/alloc.h $(srcdir)/services/modstack.h $(srcdir)/daemon/worker.h \ - $(srcdir)/util/netevent.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/daemon/stats.h \ - $(srcdir)/util/timehist.h $(srcdir)/util/module.h $(srcdir)/daemon/remote.h $(srcdir)/daemon/acl_list.h \ - $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/util/config_file.h \ - $(srcdir)/util/storage/lookup3.h $(srcdir)/util/storage/slabhash.h $(srcdir)/services/listen_dnsport.h \ - $(srcdir)/services/cache/rrset.h $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h \ - $(srcdir)/services/localzone.h $(srcdir)/util/random.h $(srcdir)/util/tube.h $(srcdir)/util/net_help.h -stats.lo stats.o: $(srcdir)/daemon/stats.c config.h \ - $(srcdir)/daemon/stats.h \ - $(srcdir)/util/timehist.h $(srcdir)/daemon/worker.h $(srcdir)/util/netevent.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/util/module.h \ - $(srcdir)/daemon/daemon.h $(srcdir)/services/modstack.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \ - $(srcdir)/services/outside_network.h $(srcdir)/util/config_file.h $(srcdir)/util/tube.h \ - $(srcdir)/util/net_help.h $(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h -replay.lo replay.o: $(srcdir)/testcode/replay.c config.h $(srcdir)/util/log.h \ - $(srcdir)/util/net_help.h \ - $(srcdir)/util/config_file.h $(srcdir)/testcode/replay.h $(srcdir)/util/netevent.h \ - $(srcdir)/testcode/ldns-testpkts.h \ - $(srcdir)/util/rbtree.h \ - $(srcdir)/testcode/fake_event.h -fake_event.lo fake_event.o: $(srcdir)/testcode/fake_event.c config.h $(srcdir)/testcode/fake_event.h \ - $(srcdir)/util/netevent.h \ - $(srcdir)/util/net_help.h \ - $(srcdir)/util/log.h $(srcdir)/util/data/msgparse.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ - $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgencode.h $(srcdir)/util/data/dname.h \ - $(srcdir)/util/config_file.h $(srcdir)/services/listen_dnsport.h $(srcdir)/services/outside_network.h \ - $(srcdir)/util/rbtree.h $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h $(srcdir)/testcode/replay.h \ - $(srcdir)/testcode/ldns-testpkts.h \ - $(srcdir)/util/fptr_wlist.h \ - $(srcdir)/util/module.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h -lock_verify.lo lock_verify.o: $(srcdir)/testcode/lock_verify.c config.h $(srcdir)/util/log.h \ - $(srcdir)/util/rbtree.h \ - $(srcdir)/util/locks.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/data/msgparse.h \ - $(srcdir)/util/tube.h \ - $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h -pktview.lo pktview.o: $(srcdir)/testcode/pktview.c config.h \ - $(srcdir)/util/log.h \ - $(srcdir)/util/data/dname.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ - $(srcdir)/util/data/msgparse.h $(srcdir)/testcode/unitmain.h $(srcdir)/testcode/readhex.h -readhex.lo readhex.o: $(srcdir)/testcode/readhex.c config.h $(srcdir)/testcode/readhex.h \ - $(srcdir)/util/log.h -signit.lo signit.o: $(srcdir)/testcode/signit.c config.h \ - $(srcdir)/util/log.h \ - $(srcdir)/util/config_file.h $(srcdir)/util/net_help.h -memstats.lo memstats.o: $(srcdir)/testcode/memstats.c config.h $(srcdir)/util/log.h \ - $(srcdir)/util/rbtree.h \ - $(srcdir)/util/locks.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/data/msgparse.h \ - $(srcdir)/util/tube.h \ - $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h -unbound-checkconf.lo unbound-checkconf.o: $(srcdir)/smallapp/unbound-checkconf.c config.h $(srcdir)/util/log.h \ - $(srcdir)/util/config_file.h \ - $(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/data/msgparse.h \ - $(srcdir)/util/net_help.h \ - $(srcdir)/util/regional.h $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h \ - $(srcdir)/iterator/iter_fwd.h $(srcdir)/util/rbtree.h $(srcdir)/iterator/iter_hints.h \ - $(srcdir)/util/storage/dnstree.h $(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h \ - $(srcdir)/services/localzone.h -worker_cb.lo worker_cb.o: $(srcdir)/smallapp/worker_cb.c config.h $(srcdir)/util/log.h \ - $(srcdir)/services/mesh.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/netevent.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ - $(srcdir)/util/module.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/services/modstack.h -context.lo context.o: $(srcdir)/libunbound/context.c config.h $(srcdir)/libunbound/context.h \ - $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/util/alloc.h \ - $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h $(srcdir)/libunbound/unbound.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/module.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/util/config_file.h \ - $(srcdir)/util/net_help.h $(srcdir)/services/localzone.h $(srcdir)/services/cache/rrset.h \ - $(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h -libunbound.lo libunbound.o: $(srcdir)/libunbound/libunbound.c $(srcdir)/libunbound/unbound.h config.h \ - $(srcdir)/libunbound/context.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/util/alloc.h \ - $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/libunbound/libworker.h \ - $(srcdir)/util/config_file.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/data/msgparse.h \ - $(srcdir)/util/regional.h $(srcdir)/util/random.h $(srcdir)/util/net_help.h $(srcdir)/util/tube.h \ - $(srcdir)/services/localzone.h $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h \ - $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h -libworker.lo libworker.o: $(srcdir)/libunbound/libworker.c config.h \ - $(srcdir)/libunbound/libworker.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/libunbound/context.h $(srcdir)/util/alloc.h $(srcdir)/util/rbtree.h \ - $(srcdir)/services/modstack.h $(srcdir)/libunbound/unbound.h $(srcdir)/services/outside_network.h \ - $(srcdir)/util/netevent.h $(srcdir)/services/mesh.h $(srcdir)/util/data/msgparse.h $(srcdir)/util/module.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/services/localzone.h $(srcdir)/services/cache/rrset.h \ - $(srcdir)/util/storage/slabhash.h $(srcdir)/services/outbound_list.h $(srcdir)/util/regional.h \ - $(srcdir)/util/random.h $(srcdir)/util/config_file.h $(srcdir)/util/storage/lookup3.h $(srcdir)/util/net_help.h \ - $(srcdir)/util/data/dname.h $(srcdir)/util/data/msgencode.h $(srcdir)/util/tube.h $(srcdir)/iterator/iter_fwd.h \ - $(srcdir)/iterator/iter_hints.h $(srcdir)/util/storage/dnstree.h -unbound-host.lo unbound-host.o: $(srcdir)/smallapp/unbound-host.c config.h $(srcdir)/libunbound/unbound.h \ - -asynclook.lo asynclook.o: $(srcdir)/testcode/asynclook.c config.h $(srcdir)/libunbound/unbound.h \ - $(srcdir)/libunbound/context.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/util/alloc.h \ - $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/storage/lruhash.h \ - -streamtcp.lo streamtcp.o: $(srcdir)/testcode/streamtcp.c config.h \ - $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/util/net_help.h $(srcdir)/util/data/msgencode.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/data/dname.h \ - -perf.lo perf.o: $(srcdir)/testcode/perf.c config.h \ - $(srcdir)/util/log.h $(srcdir)/util/locks.h \ - $(srcdir)/util/net_help.h $(srcdir)/util/data/msgencode.h $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h -delayer.lo delayer.o: $(srcdir)/testcode/delayer.c config.h $(srcdir)/util/net_help.h $(srcdir)/util/log.h \ - $(srcdir)/util/config_file.h -harvest.lo harvest.o: $(srcdir)/testcode/harvest.c config.h \ - $(srcdir)/libunbound/unbound.h -unbound-control.lo unbound-control.o: $(srcdir)/smallapp/unbound-control.c config.h \ - $(srcdir)/util/log.h \ - $(srcdir)/util/config_file.h \ - $(srcdir)/util/locks.h $(srcdir)/util/net_help.h -unbound-anchor.lo unbound-anchor.o: $(srcdir)/smallapp/unbound-anchor.c config.h $(srcdir)/libunbound/unbound.h \ - -petal.lo petal.o: $(srcdir)/testcode/petal.c config.h \ - -pythonmod_utils.lo pythonmod_utils.o: $(srcdir)/pythonmod/pythonmod_utils.c config.h $(srcdir)/util/module.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/data/msgparse.h \ - $(srcdir)/util/netevent.h \ - $(srcdir)/util/net_help.h $(srcdir)/services/cache/dns.h $(srcdir)/services/cache/rrset.h \ - $(srcdir)/util/storage/slabhash.h $(srcdir)/util/regional.h -win_svc.lo win_svc.o: $(srcdir)/winrc/win_svc.c config.h $(srcdir)/winrc/win_svc.h $(srcdir)/winrc/w_inst.h \ - $(srcdir)/daemon/daemon.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/util/alloc.h \ - $(srcdir)/services/modstack.h $(srcdir)/daemon/worker.h $(srcdir)/util/netevent.h $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/data/msgparse.h \ - $(srcdir)/daemon/stats.h \ - $(srcdir)/util/timehist.h $(srcdir)/util/module.h $(srcdir)/daemon/remote.h \ - $(srcdir)/util/config_file.h $(srcdir)/util/winsock_event.h -w_inst.lo w_inst.o: $(srcdir)/winrc/w_inst.c config.h $(srcdir)/winrc/w_inst.h $(srcdir)/winrc/win_svc.h -unbound-service-install.lo unbound-service-install.o: $(srcdir)/winrc/unbound-service-install.c config.h \ - $(srcdir)/winrc/w_inst.h -unbound-service-remove.lo unbound-service-remove.o: $(srcdir)/winrc/unbound-service-remove.c config.h \ - $(srcdir)/winrc/w_inst.h -anchor-update.lo anchor-update.o: $(srcdir)/winrc/anchor-update.c config.h \ - $(srcdir)/libunbound/unbound.h -ctime_r.lo ctime_r.o: $(srcdir)/compat/ctime_r.c config.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - -fake-rfc2553.lo fake-rfc2553.o: $(srcdir)/compat/fake-rfc2553.c $(srcdir)/compat/fake-rfc2553.h config.h -gmtime_r.lo gmtime_r.o: $(srcdir)/compat/gmtime_r.c config.h -inet_aton.lo inet_aton.o: $(srcdir)/compat/inet_aton.c config.h -inet_ntop.lo inet_ntop.o: $(srcdir)/compat/inet_ntop.c config.h -inet_pton.lo inet_pton.o: $(srcdir)/compat/inet_pton.c config.h -malloc.lo malloc.o: $(srcdir)/compat/malloc.c config.h -memcmp.lo memcmp.o: $(srcdir)/compat/memcmp.c config.h -memmove.lo memmove.o: $(srcdir)/compat/memmove.c config.h -snprintf.lo snprintf.o: $(srcdir)/compat/snprintf.c config.h -strlcpy.lo strlcpy.o: $(srcdir)/compat/strlcpy.c config.h -strptime.lo strptime.o: $(srcdir)/compat/strptime.c config.h diff --git a/contrib/unbound/acx_nlnetlabs.m4 b/contrib/unbound/acx_nlnetlabs.m4 index e90c81ea02a..e1cf83a70bd 100644 --- a/contrib/unbound/acx_nlnetlabs.m4 +++ b/contrib/unbound/acx_nlnetlabs.m4 @@ -2,7 +2,12 @@ # Copyright 2009, Wouter Wijngaards, NLnet Labs. # BSD licensed. # -# Version 21 +# Version 26 +# 2013-09-19 FLTO help text improved. +# 2013-07-18 Enable ACX_CHECK_COMPILER_FLAG to test for -Wstrict-prototypes +# 2013-06-25 FLTO has --disable-flto option. +# 2013-05-03 Update W32_SLEEP for newer mingw that links but not defines it. +# 2013-03-22 Fix ACX_RSRC_VERSION for long version numbers. # 2012-02-09 Fix AHX_MEMCMP_BROKEN with undef in compat/memcmp.h. # 2012-01-20 Fix COMPILER_FLAGS_UNBOUND for gcc 4.6.2 assigned-not-used-warns. # 2011-12-05 Fix getaddrinfowithincludes on windows with fedora16 mingw32-gcc. @@ -101,7 +106,7 @@ dnl Calculate comma separated windows-resource numbers from package version. dnl Picks the first three(,0) or four numbers out of the name. dnl $1: variable for the result AC_DEFUN([ACX_RSRC_VERSION], -[$1=[`echo $PACKAGE_VERSION | sed -e 's/^[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\).*$/\1,\2,\3,\4/' -e 's/^[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*$/\1,\2,\3,0/' `] +[$1=[`echo $PACKAGE_VERSION | sed -e 's/^[^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\).*$/\1,\2,\3,\4/' -e 's/^[^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9]*$/\1,\2,\3,0/' `] ]) dnl Routine to help check for compiler flags. @@ -116,7 +121,7 @@ AC_MSG_CHECKING(whether $CC supports -$1) cache=`echo $1 | sed 'y%.=/+-%___p_%'` AC_CACHE_VAL(cv_prog_cc_flag_$cache, [ -echo 'void f(){}' >conftest.c +echo 'void f(void){}' >conftest.c if test -z "`$CC $CPPFLAGS $CFLAGS -$1 -c conftest.c 2>&1`"; then eval "cv_prog_cc_flag_$cache=yes" else @@ -405,19 +410,22 @@ int test() { dnl Check if CC supports -flto. dnl in a way that supports clang and suncc (that flag does something else, dnl but fails to link). It sets it in CFLAGS if it works. -AC_DEFUN([ACX_CHECK_FLTO], -[AC_MSG_CHECKING([if $CC supports -flto]) -BAKCFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -flto" -AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [ - if $CC $CFLAGS -o conftest conftest.c 2>&1 | grep "warning: no debug symbols in executable" >/dev/null; then - CFLAGS="$BAKCFLAGS" - AC_MSG_RESULT(no) - else - AC_MSG_RESULT(yes) - fi - rm -f conftest conftest.c conftest.o -], [CFLAGS="$BAKCFLAGS" ; AC_MSG_RESULT(no)]) +AC_DEFUN([ACX_CHECK_FLTO], [ + AC_ARG_ENABLE([flto], AS_HELP_STRING([--disable-flto], [Disable link-time optimization (gcc specific option)])) + AS_IF([test "x$enable_flto" != "xno"], [ + AC_MSG_CHECKING([if $CC supports -flto]) + BAKCFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -flto" + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [ + if $CC $CFLAGS -o conftest conftest.c 2>&1 | grep "warning: no debug symbols in executable" >/dev/null; then + CFLAGS="$BAKCFLAGS" + AC_MSG_RESULT(no) + else + AC_MSG_RESULT(yes) + fi + rm -f conftest conftest.c conftest.o + ], [CFLAGS="$BAKCFLAGS" ; AC_MSG_RESULT(no)]) + ]) ]) dnl Check the printf-format attribute (if any) @@ -1208,7 +1216,7 @@ struct tm *gmtime_r(const time_t *timep, struct tm *result); dnl provide w32 compat definition for sleep AC_DEFUN([AHX_CONFIG_W32_SLEEP], [ -#ifndef HAVE_SLEEP +#if !defined(HAVE_SLEEP) || defined(HAVE_WINDOWS_H) #define sleep(x) Sleep((x)*1000) /* on win32 */ #endif /* HAVE_SLEEP */ ]) diff --git a/contrib/unbound/acx_pthread.m4 b/contrib/unbound/acx_pthread.m4 deleted file mode 100644 index 7ac8ffddc5b..00000000000 --- a/contrib/unbound/acx_pthread.m4 +++ /dev/null @@ -1,280 +0,0 @@ -##### http://autoconf-archive.cryp.to/acx_pthread.html -# -# SYNOPSIS -# -# ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) -# -# DESCRIPTION -# -# This macro figures out how to build C programs using POSIX threads. -# It sets the PTHREAD_LIBS output variable to the threads library and -# linker flags, and the PTHREAD_CFLAGS output variable to any special -# C compiler flags that are needed. (The user can also force certain -# compiler flags/libs to be tested by setting these environment -# variables.) -# -# Also sets PTHREAD_CC to any special C compiler that is needed for -# multi-threaded programs (defaults to the value of CC otherwise). -# (This is necessary on AIX to use the special cc_r compiler alias.) -# -# NOTE: You are assumed to not only compile your program with these -# flags, but also link it with them as well. e.g. you should link -# with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS -# $LIBS -# -# If you are only building threads programs, you may wish to use -# these variables in your default LIBS, CFLAGS, and CC: -# -# LIBS="$PTHREAD_LIBS $LIBS" -# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" -# CC="$PTHREAD_CC" -# -# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute -# constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to -# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). -# -# ACTION-IF-FOUND is a list of shell commands to run if a threads -# library is found, and ACTION-IF-NOT-FOUND is a list of commands to -# run it if it is not found. If ACTION-IF-FOUND is not specified, the -# default action will define HAVE_PTHREAD. -# -# Please let the authors know if this macro fails on any platform, or -# if you have any other suggestions or comments. This macro was based -# on work by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) -# (with help from M. Frigo), as well as ac_pthread and hb_pthread -# macros posted by Alejandro Forero Cuervo to the autoconf macro -# repository. We are also grateful for the helpful feedback of -# numerous users. -# -# LAST MODIFICATION -# -# 2006-05-29 -# -# COPYLEFT -# -# Copyright (c) 2006 Steven G. Johnson -# -# This program 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 of the -# License, or (at your option) any later version. -# -# This program 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 this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. -# -# As a special exception, the respective Autoconf Macro's copyright -# owner gives unlimited permission to copy, distribute and modify the -# configure scripts that are the output of Autoconf when processing -# the Macro. You need not follow the terms of the GNU General Public -# License when using or distributing such scripts, even though -# portions of the text of the Macro appear in them. The GNU General -# Public License (GPL) does govern all other use of the material that -# constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the -# Autoconf Macro released by the Autoconf Macro Archive. When you -# make and distribute a modified version of the Autoconf Macro, you -# may extend this special exception to the GPL to apply to your -# modified version as well. - -AC_DEFUN([ACX_PTHREAD], [ -AC_REQUIRE([AC_CANONICAL_HOST]) -AC_LANG_SAVE -AC_LANG_C -acx_pthread_ok=no - -# We used to check for pthread.h first, but this fails if pthread.h -# requires special compiler flags (e.g. on True64 or Sequent). -# It gets checked for in the link test anyway. - -# First of all, check if the user has set any of the PTHREAD_LIBS, -# etcetera environment variables, and if threads linking works using -# them: -if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - save_LIBS="$LIBS" - LIBS="$PTHREAD_LIBS $LIBS" - AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) - AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) - AC_MSG_RESULT($acx_pthread_ok) - if test x"$acx_pthread_ok" = xno; then - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" - fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" -fi - -# We must check for the threads library under a number of different -# names; the ordering is very important because some systems -# (e.g. DEC) have both -lpthread and -lpthreads, where one of the -# libraries is broken (non-POSIX). - -# Create a list of thread flags to try. Items starting with a "-" are -# C compiler flags, and other items are library names, except for "none" -# which indicates that we try without any flags at all, and "pthread-config" -# which is a program returning the flags for the Pth emulation library. - -acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" - -# The ordering *is* (sometimes) important. Some notes on the -# individual items follow: - -# pthreads: AIX (must check this before -lpthread) -# none: in case threads are in libc; should be tried before -Kthread and -# other compiler flags to prevent continual compiler warnings -# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) -# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) -# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) -# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) -# -pthreads: Solaris/gcc -# -mthreads: Mingw32/gcc, Lynx/gcc -# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it -# doesn't hurt to check since this sometimes defines pthreads too; -# also defines -D_REENTRANT) -# ... -mt is also the pthreads flag for HP/aCC -# pthread: Linux, etcetera -# --thread-safe: KAI C++ -# pthread-config: use pthread-config program (for GNU Pth library) - -case "${host_cpu}-${host_os}" in - *solaris*) - - # On Solaris (at least, for some versions), libc contains stubbed - # (non-functional) versions of the pthreads routines, so link-based - # tests will erroneously succeed. (We need to link with -pthreads/-mt/ - # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather - # a function called by this macro, so we could check for that, but - # who knows whether they'll stub that too in a future libc.) So, - # we'll just look for -pthreads and -lpthread first: - - acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags" - ;; -esac - -if test x"$acx_pthread_ok" = xno; then -for flag in $acx_pthread_flags; do - - case $flag in - none) - AC_MSG_CHECKING([whether pthreads work without any flags]) - ;; - - -*) - AC_MSG_CHECKING([whether pthreads work with $flag]) - PTHREAD_CFLAGS="$flag" - ;; - - pthread-config) - AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no) - if test x"$acx_pthread_config" = xno; then continue; fi - PTHREAD_CFLAGS="`pthread-config --cflags`" - PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" - ;; - - *) - AC_MSG_CHECKING([for the pthreads library -l$flag]) - PTHREAD_LIBS="-l$flag" - ;; - esac - - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - - # Check for various functions. We must include pthread.h, - # since some functions may be macros. (On the Sequent, we - # need a special flag -Kthread to make this header compile.) - # We check for pthread_join because it is in -lpthread on IRIX - # while pthread_create is in libc. We check for pthread_attr_init - # due to DEC craziness with -lpthreads. We check for - # pthread_cleanup_push because it is one of the few pthread - # functions on Solaris that doesn't have a non-functional libc stub. - # We try pthread_create on general principles. - AC_TRY_LINK([#include ], - [pthread_t th; pthread_join(th, 0); - pthread_attr_init(0); pthread_cleanup_push(0, 0); - pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], - [acx_pthread_ok=yes]) - - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - - AC_MSG_RESULT($acx_pthread_ok) - if test "x$acx_pthread_ok" = xyes; then - break; - fi - - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" -done -fi - -# Various other checks: -if test "x$acx_pthread_ok" = xyes; then - save_LIBS="$LIBS" - LIBS="$PTHREAD_LIBS $LIBS" - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - - # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. - AC_MSG_CHECKING([for joinable pthread attribute]) - attr_name=unknown - for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do - AC_TRY_LINK([#include ], [int attr=$attr; return attr;], - [attr_name=$attr; break]) - done - AC_MSG_RESULT($attr_name) - if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then - AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, - [Define to necessary symbol if this constant - uses a non-standard name on your system.]) - fi - - AC_MSG_CHECKING([if more special flags are required for pthreads]) - flag=no - case "${host_cpu}-${host_os}" in - *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; - *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; - esac - AC_MSG_RESULT(${flag}) - if test "x$flag" != xno; then - PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" - fi - - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - - # More AIX lossage: must compile with xlc_r or cc_r - if test x"$GCC" != xyes; then - AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC}) - else - PTHREAD_CC=$CC - fi -else - PTHREAD_CC="$CC" -fi - -AC_SUBST(PTHREAD_LIBS) -AC_SUBST(PTHREAD_CFLAGS) -AC_SUBST(PTHREAD_CC) - -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x"$acx_pthread_ok" = xyes; then - ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) - : -else - acx_pthread_ok=no - $2 -fi -AC_LANG_RESTORE -])dnl ACX_PTHREAD diff --git a/contrib/unbound/ax_pthread.m4 b/contrib/unbound/ax_pthread.m4 new file mode 100644 index 00000000000..47fe233b20f --- /dev/null +++ b/contrib/unbound/ax_pthread.m4 @@ -0,0 +1,317 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_pthread.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# +# DESCRIPTION +# +# This macro figures out how to build C programs using POSIX threads. It +# sets the PTHREAD_LIBS output variable to the threads library and linker +# flags, and the PTHREAD_CFLAGS output variable to any special C compiler +# flags that are needed. (The user can also force certain compiler +# flags/libs to be tested by setting these environment variables.) +# +# Also sets PTHREAD_CC to any special C compiler that is needed for +# multi-threaded programs (defaults to the value of CC otherwise). (This +# is necessary on AIX to use the special cc_r compiler alias.) +# +# NOTE: You are assumed to not only compile your program with these flags, +# but also link it with them as well. e.g. you should link with +# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS +# +# If you are only building threads programs, you may wish to use these +# variables in your default LIBS, CFLAGS, and CC: +# +# LIBS="$PTHREAD_LIBS $LIBS" +# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +# CC="$PTHREAD_CC" +# +# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant +# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name +# (e.g. PTHREAD_CREATE_UNDETACHED on AIX). +# +# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the +# PTHREAD_PRIO_INHERIT symbol is defined when compiling with +# PTHREAD_CFLAGS. +# +# ACTION-IF-FOUND is a list of shell commands to run if a threads library +# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it +# is not found. If ACTION-IF-FOUND is not specified, the default action +# will define HAVE_PTHREAD. +# +# Please let the authors know if this macro fails on any platform, or if +# you have any other suggestions or comments. This macro was based on work +# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help +# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by +# Alejandro Forero Cuervo to the autoconf macro repository. We are also +# grateful for the helpful feedback of numerous users. +# +# Updated for Autoconf 2.68 by Daniel Richard G. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2011 Daniel Richard G. +# +# This program 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 3 of the License, or (at your +# option) any later version. +# +# This program 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 this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 20 + +AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) +AC_DEFUN([AX_PTHREAD], [ +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_LANG_PUSH([C]) +ax_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on True64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) + AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes) + AC_MSG_RESULT($ax_pthread_ok) + if test x"$ax_pthread_ok" = xno; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items starting with a "-" are +# C compiler flags, and other items are library names, except for "none" +# which indicates that we try without any flags at all, and "pthread-config" +# which is a program returning the flags for the Pth emulation library. + +ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) +# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) +# -pthreads: Solaris/gcc +# -mthreads: Mingw32/gcc, Lynx/gcc +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads too; +# also defines -D_REENTRANT) +# ... -mt is also the pthreads flag for HP/aCC +# pthread: Linux, etcetera +# --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) + +case ${host_os} in + solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (We need to link with -pthreads/-mt/ + # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather + # a function called by this macro, so we could check for that, but + # who knows whether they'll stub that too in a future libc.) So, + # we'll just look for -pthreads and -lpthread first: + + ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" + ;; + + darwin*) + ax_pthread_flags="-pthread $ax_pthread_flags" + ;; +esac + +if test x"$ax_pthread_ok" = xno; then +for flag in $ax_pthread_flags; do + + case $flag in + none) + AC_MSG_CHECKING([whether pthreads work without any flags]) + ;; + + -*) + AC_MSG_CHECKING([whether pthreads work with $flag]) + PTHREAD_CFLAGS="$flag" + ;; + + pthread-config) + AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no) + if test x"$ax_pthread_config" = xno; then continue; fi + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; + + *) + AC_MSG_CHECKING([for the pthreads library -l$flag]) + PTHREAD_LIBS="-l$flag" + ;; + esac + + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include + static void routine(void *a) { *((int*)a) = 0; } + static void *start_routine(void *a) { return a; }], + [pthread_t th; pthread_attr_t attr; + pthread_create(&th, 0, start_routine, 0); + pthread_join(th, 0); + pthread_attr_init(&attr); + pthread_cleanup_push(routine, 0); + pthread_cleanup_pop(0) /* ; */])], + [ax_pthread_ok=yes], + []) + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + AC_MSG_RESULT($ax_pthread_ok) + if test "x$ax_pthread_ok" = xyes; then + break; + fi + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi + +# Various other checks: +if test "x$ax_pthread_ok" = xyes; then + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + AC_MSG_CHECKING([for joinable pthread attribute]) + attr_name=unknown + for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], + [int attr = $attr; return attr /* ; */])], + [attr_name=$attr; break], + []) + done + AC_MSG_RESULT($attr_name) + if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then + AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, + [Define to necessary symbol if this constant + uses a non-standard name on your system.]) + fi + + AC_MSG_CHECKING([if more special flags are required for pthreads]) + flag=no + case ${host_os} in + aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";; + osf* | hpux*) flag="-D_REENTRANT";; + solaris*) + if test "$GCC" = "yes"; then + flag="-D_REENTRANT" + else + flag="-mt -D_REENTRANT" + fi + ;; + esac + AC_MSG_RESULT(${flag}) + if test "x$flag" != xno; then + PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" + fi + + AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], + ax_cv_PTHREAD_PRIO_INHERIT, [ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[#include ]], [[int i = PTHREAD_PRIO_INHERIT;]])], + [ax_cv_PTHREAD_PRIO_INHERIT=yes], + [ax_cv_PTHREAD_PRIO_INHERIT=no]) + ]) + AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"], + AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.])) + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + # More AIX lossage: compile with *_r variant + if test "x$GCC" != xyes; then + case $host_os in + aix*) + AS_CASE(["x/$CC"], + [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], + [#handle absolute path differently from PATH based program lookup + AS_CASE(["x$CC"], + [x/*], + [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], + [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) + ;; + esac + fi +fi + +test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" + +AC_SUBST(PTHREAD_LIBS) +AC_SUBST(PTHREAD_CFLAGS) +AC_SUBST(PTHREAD_CC) + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x"$ax_pthread_ok" = xyes; then + ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) + : +else + ax_pthread_ok=no + $2 +fi +AC_LANG_POP +])dnl AX_PTHREAD diff --git a/contrib/unbound/compat/snprintf.c b/contrib/unbound/compat/snprintf.c index b736175199e..0663557037f 100644 --- a/contrib/unbound/compat/snprintf.c +++ b/contrib/unbound/compat/snprintf.c @@ -1,792 +1,1036 @@ -#include - -#ifndef HAVE_SNPRINTF - -#include -#include - -/* Define this as a fall through, HAVE_STDARG_H is probably already set */ - -#define HAVE_VARARGS_H - -/************************************************************** - * Original: - * Patrick Powell Tue Apr 11 09:48:21 PDT 1995 - * A bombproof version of doprnt (dopr) included. - * Sigh. This sort of thing is always nasty do deal with. Note that - * the version here does not include floating point... +/* snprintf - compatibility implementation of snprintf, vsnprintf * - * snprintf() is used instead of sprintf() as it does limit checks - * for string length. This covers a nasty loophole. + * Copyright (c) 2013, NLnet Labs. All rights reserved. * - * The other functions are there to prevent NULL pointers from - * causing nast effects. - * - * More Recently: - * Brandon Long (blong@fiction.net) 9/15/96 for mutt 0.43 - * This was ugly. It is still ugly. I opted out of floating point - * numbers, but the formatter understands just about everything - * from the normal C string format, at least as far as I can tell from - * the Solaris 2.5 printf(3S) man page. - * - * Brandon Long (blong@fiction.net) 10/22/97 for mutt 0.87.1 - * Ok, added some minimal floating point support, which means this - * probably requires libm on most operating systems. Don't yet - * support the exponent (e,E) and sigfig (g,G). Also, fmtint() - * was pretty badly broken, it just wasn't being exercised in ways - * which showed it, so that's been fixed. Also, formated the code - * to mutt conventions, and removed dead code left over from the - * original. Also, there is now a builtin-test, just compile with: - * gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm - * and run snprintf for results. - * - * Wouter Wijngaards(wouter@nlnetlabs.nl) 2/09/2010 for unbound. - * Limited support for %g. Does not do the exponents for the before-dot. - * - **************************************************************/ - - -/* varargs declarations: */ - -#if defined(HAVE_STDARG_H) -# include -# define HAVE_STDARGS /* let's hope that works everywhere (mj) */ -# define VA_LOCAL_DECL va_list ap -# define VA_START(f) va_start(ap, f) -# define VA_SHIFT(v,t) ; /* no-op for ANSI */ -# define VA_END va_end(ap) -#else -# if defined(HAVE_VARARGS_H) -# include -# undef HAVE_STDARGS -# define VA_LOCAL_DECL va_list ap -# define VA_START(f) va_start(ap) /* f is ignored! */ -# define VA_SHIFT(v,t) v = va_arg(ap,t) -# define VA_END va_end(ap) -# else -/*XX ** NO VARARGS ** XX*/ -# endif -#endif - -int snprintf (char *str, size_t count, const char *fmt, ...); -int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); - -static void dopr (char *buffer, size_t maxlen, const char *format, - va_list args); -static void fmtstr (char *buffer, size_t *currlen, size_t maxlen, - char *value, int flags, int min, int max); -static void fmtint (char *buffer, size_t *currlen, size_t maxlen, - long value, int base, int min, int max, int flags); -static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, - long double fvalue, int min, int max, int flags, int conv); -static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c ); - -int vsnprintf (char *str, size_t count, const char *fmt, va_list args) -{ - str[0] = 0; - dopr(str, count, fmt, args); - return(strlen(str)); -} - -/* VARARGS3 */ -#ifdef HAVE_STDARGS -int snprintf (char *str,size_t count,const char *fmt,...) -#else -int snprintf (va_alist) va_dcl -#endif -{ -#ifndef HAVE_STDARGS - char *str; - size_t count; - char *fmt; -#endif - VA_LOCAL_DECL; - - VA_START (fmt); - VA_SHIFT (str, char *); - VA_SHIFT (count, size_t ); - VA_SHIFT (fmt, char *); - (void) vsnprintf(str, count, fmt, ap); - VA_END; - return(strlen(str)); -} - -/* - * dopr(): poor man's version of doprintf + * This software is open source. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 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. + * + * Neither the name of the NLNET LABS 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 COPYRIGHT HOLDERS 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 COPYRIGHT + * HOLDER 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. */ -/* format read states */ -#define DP_S_DEFAULT 0 -#define DP_S_FLAGS 1 -#define DP_S_MIN 2 -#define DP_S_DOT 3 -#define DP_S_MAX 4 -#define DP_S_MOD 5 -#define DP_S_CONV 6 -#define DP_S_DONE 7 - -/* format flags - Bits */ -#define DP_F_MINUS 1 -#define DP_F_PLUS 2 -#define DP_F_SPACE 4 -#define DP_F_NUM 8 -#define DP_F_ZERO 16 -#define DP_F_UP 32 - -/* Conversion Flags */ -#define DP_C_SHORT 1 -#define DP_C_LONG 2 -#define DP_C_LDOUBLE 3 - -#define char_to_int(p) (p - '0') -#ifndef MAX -#define MAX(p,q) ((p >= q) ? p : q) +#include "config.h" +#include +#include +#include +#include +#include +#include +#ifdef HAVE_STDINT_H +#include #endif -static void dopr (char *buffer, size_t maxlen, const char *format, va_list args) -{ - char ch; - long value; - long double fvalue; - char *strvalue; - int min; - int max; - int state; - int flags; - int cflags; - size_t currlen; - - state = DP_S_DEFAULT; - currlen = flags = cflags = min = 0; - max = -1; - ch = *format++; - - while (state != DP_S_DONE) - { - if ((ch == '\0') || (currlen >= maxlen)) - state = DP_S_DONE; - - switch(state) - { - case DP_S_DEFAULT: - if (ch == '%') - state = DP_S_FLAGS; - else - dopr_outch (buffer, &currlen, maxlen, ch); - ch = *format++; - break; - case DP_S_FLAGS: - switch (ch) - { - case '-': - flags |= DP_F_MINUS; - ch = *format++; - break; - case '+': - flags |= DP_F_PLUS; - ch = *format++; - break; - case ' ': - flags |= DP_F_SPACE; - ch = *format++; - break; - case '#': - flags |= DP_F_NUM; - ch = *format++; - break; - case '0': - flags |= DP_F_ZERO; - ch = *format++; - break; - default: - state = DP_S_MIN; - break; - } - break; - case DP_S_MIN: - if (isdigit(ch)) - { - min = 10*min + char_to_int (ch); - ch = *format++; - } - else if (ch == '*') - { - min = va_arg (args, int); - ch = *format++; - state = DP_S_DOT; - } - else - state = DP_S_DOT; - break; - case DP_S_DOT: - if (ch == '.') - { - state = DP_S_MAX; - ch = *format++; - } - else - state = DP_S_MOD; - break; - case DP_S_MAX: - if (isdigit(ch)) - { - if (max < 0) - max = 0; - max = 10*max + char_to_int (ch); - ch = *format++; - } - else if (ch == '*') - { - max = va_arg (args, int); - ch = *format++; - state = DP_S_MOD; - } - else - state = DP_S_MOD; - break; - case DP_S_MOD: - /* Currently, we don't support Long Long, bummer */ - switch (ch) - { - case 'h': - cflags = DP_C_SHORT; - ch = *format++; - break; - case 'l': - cflags = DP_C_LONG; - ch = *format++; - break; - case 'L': - cflags = DP_C_LDOUBLE; - ch = *format++; - break; - default: - break; - } - state = DP_S_CONV; - break; - case DP_S_CONV: - switch (ch) - { - case 'd': - case 'i': - if (cflags == DP_C_SHORT) - value = va_arg (args, int); - else if (cflags == DP_C_LONG) - value = va_arg (args, long int); - else - value = va_arg (args, int); - fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags); - break; - case 'o': - flags &= ~DP_F_PLUS; - if (cflags == DP_C_SHORT) - value = va_arg (args, unsigned int); - else if (cflags == DP_C_LONG) - value = va_arg (args, unsigned long int); - else - value = va_arg (args, unsigned int); - fmtint (buffer, &currlen, maxlen, value, 8, min, max, flags); - break; - case 'u': - flags &= ~DP_F_PLUS; - if (cflags == DP_C_SHORT) - value = va_arg (args, unsigned int); - else if (cflags == DP_C_LONG) - value = va_arg (args, unsigned long int); - else - value = va_arg (args, unsigned int); - fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags); - break; - case 'X': - flags |= DP_F_UP; - case 'x': - flags &= ~DP_F_PLUS; - if (cflags == DP_C_SHORT) - value = va_arg (args, unsigned int); - else if (cflags == DP_C_LONG) - value = va_arg (args, unsigned long int); - else - value = va_arg (args, unsigned int); - fmtint (buffer, &currlen, maxlen, value, 16, min, max, flags); - break; - case 'f': - if (cflags == DP_C_LDOUBLE) - fvalue = va_arg (args, long double); - else - fvalue = va_arg (args, double); - /* um, floating point? */ - fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags, 'f'); - break; - case 'E': - flags |= DP_F_UP; - case 'e': - if (cflags == DP_C_LDOUBLE) - fvalue = va_arg (args, long double); - else - fvalue = va_arg (args, double); - break; - case 'G': - flags |= DP_F_UP; - case 'g': - if (cflags == DP_C_LDOUBLE) - fvalue = va_arg (args, long double); - else - fvalue = va_arg (args, double); - fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags, 'g'); - break; - case 'c': - dopr_outch (buffer, &currlen, maxlen, va_arg (args, int)); - break; - case 's': - strvalue = va_arg (args, char *); - if (max < 0) - max = maxlen; /* ie, no max */ - fmtstr (buffer, &currlen, maxlen, strvalue, flags, min, max); - break; - case 'p': - strvalue = va_arg (args, void *); - fmtint (buffer, &currlen, maxlen, (long) strvalue, 16, min, max, flags); - break; - case 'n': - if (cflags == DP_C_SHORT) - { - short int *num; - num = va_arg (args, short int *); - *num = currlen; - } - else if (cflags == DP_C_LONG) - { - long int *num; - num = va_arg (args, long int *); - *num = currlen; - } - else - { - int *num; - num = va_arg (args, int *); - *num = currlen; - } - break; - case '%': - dopr_outch (buffer, &currlen, maxlen, ch); - break; - case 'w': - /* not supported yet, treat as next char */ - ch = *format++; - break; - default: - /* Unknown, skip */ - break; - } - ch = *format++; - state = DP_S_DEFAULT; - flags = cflags = min = 0; - max = -1; - break; - case DP_S_DONE: - break; - default: - /* hmm? */ - break; /* some picky compilers need this */ - } - } - if (currlen < maxlen - 1) - buffer[currlen] = '\0'; - else - buffer[maxlen - 1] = '\0'; -} - -static void fmtstr (char *buffer, size_t *currlen, size_t maxlen, - char *value, int flags, int min, int max) -{ - int padlen, strln; /* amount to pad */ - int cnt = 0; - - if (value == 0) - { - value = ""; - } - - for (strln = 0; value[strln]; ++strln); /* strlen */ - padlen = min - strln; - if (padlen < 0) - padlen = 0; - if (flags & DP_F_MINUS) - padlen = -padlen; /* Left Justify */ - - while ((padlen > 0) && (cnt < max)) - { - dopr_outch (buffer, currlen, maxlen, ' '); - --padlen; - ++cnt; - } - while (*value && (cnt < max)) - { - dopr_outch (buffer, currlen, maxlen, *value++); - ++cnt; - } - while ((padlen < 0) && (cnt < max)) - { - dopr_outch (buffer, currlen, maxlen, ' '); - ++padlen; - ++cnt; - } -} - -/* Have to handle DP_F_NUM (ie 0x and 0 alternates) */ - -static void fmtint (char *buffer, size_t *currlen, size_t maxlen, - long value, int base, int min, int max, int flags) -{ - int signvalue = 0; - unsigned long uvalue; - char convert[20]; - int place = 0; - int spadlen = 0; /* amount to space pad */ - int zpadlen = 0; /* amount to zero pad */ - int caps = 0; - - if (max < 0) - max = 0; - - uvalue = value; - if( value < 0 ) { - signvalue = '-'; - uvalue = -value; - } - else - if (flags & DP_F_PLUS) /* Do a sign (+/i) */ - signvalue = '+'; - else - if (flags & DP_F_SPACE) - signvalue = ' '; - - if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */ - - do { - convert[place++] = - (caps? "0123456789ABCDEF":"0123456789abcdef") - [uvalue % (unsigned)base ]; - uvalue = (uvalue / (unsigned)base ); - } while(uvalue && (place < 20)); - if (place == 20) place--; - convert[place] = 0; - - zpadlen = max - place; - spadlen = min - MAX (max, place) - (signvalue ? 1 : 0); - if (zpadlen < 0) zpadlen = 0; - if (spadlen < 0) spadlen = 0; - if (flags & DP_F_ZERO) - { - zpadlen = MAX(zpadlen, spadlen); - spadlen = 0; - } - if (flags & DP_F_MINUS) - spadlen = -spadlen; /* Left Justifty */ - -#ifdef DEBUG_SNPRINTF - dprint (1, (debugfile, "zpad: %d, spad: %d, min: %d, max: %d, place: %d\n", - zpadlen, spadlen, min, max, place)); -#endif - - /* Spaces */ - while (spadlen > 0) - { - dopr_outch (buffer, currlen, maxlen, ' '); - --spadlen; - } - - /* Sign */ - if (signvalue) - dopr_outch (buffer, currlen, maxlen, signvalue); - - /* Zeros */ - if (zpadlen > 0) - { - while (zpadlen > 0) - { - dopr_outch (buffer, currlen, maxlen, '0'); - --zpadlen; - } - } - - /* Digits */ - while (place > 0) - dopr_outch (buffer, currlen, maxlen, convert[--place]); - - /* Left Justified spaces */ - while (spadlen < 0) { - dopr_outch (buffer, currlen, maxlen, ' '); - ++spadlen; - } -} - -static long double abs_val (long double value) -{ - long double result = value; - - if (value < 0) - result = -value; - - return result; -} - -static long double compat_pow10 (int exp) -{ - long double result = 1; - - while (exp) - { - result *= 10; - exp--; - } - - return result; -} - -static long compat_round (long double value) -{ - long intpart; - - intpart = value; - value = value - intpart; - if (value >= 0.5) - intpart++; - - return intpart; -} - -static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, - long double fvalue, int min, int max, int flags, int conv) -{ - int signvalue = 0; - long double ufvalue; - char iconvert[20]; - char fconvert[20]; - int iplace = 0; - int fplace = 0; - int padlen = 0; /* amount to pad */ - int zpadlen = 0; - int caps = 0; - long intpart; - long fracpart; - - /* - * AIX manpage says the default is 0, but Solaris says the default - * is 6, and sprintf on AIX defaults to 6 - */ - if (max < 0) - max = 6; - - ufvalue = abs_val (fvalue); - - if (fvalue < 0) - signvalue = '-'; - else - if (flags & DP_F_PLUS) /* Do a sign (+/i) */ - signvalue = '+'; - else - if (flags & DP_F_SPACE) - signvalue = ' '; - -#if 0 - if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */ -#endif - - intpart = ufvalue; - - /* - * Sorry, we only support 9 digits past the decimal because of our - * conversion method - */ - if (max > 9) - max = 9; - - /* We "cheat" by converting the fractional part to integer by - * multiplying by a factor of 10 - */ - fracpart = compat_round ((compat_pow10 (max)) * (ufvalue - intpart)); - - if (fracpart >= compat_pow10 (max)) - { - intpart++; - fracpart -= compat_pow10 (max); - } - -#ifdef DEBUG_SNPRINTF - dprint (1, (debugfile, "fmtfp: %f =? %d.%d\n", fvalue, intpart, fracpart)); -#endif - - /* Convert integer part */ - do { - iconvert[iplace++] = - (caps? "0123456789ABCDEF":"0123456789abcdef")[intpart % 10]; - intpart = (intpart / 10); - } while(intpart && (iplace < 20)); - if (iplace == 20) iplace--; - iconvert[iplace] = 0; - - /* Convert fractional part */ - do { - fconvert[fplace++] = - (caps? "0123456789ABCDEF":"0123456789abcdef")[fracpart % 10]; - fracpart = (fracpart / 10); - if(conv == 'g' && fplace == 1 && fconvert[0] == '0') { - fplace = 0; /* skip trailing zeroes for %g */ - zpadlen ++; - } - } while(fracpart && (fplace < 20)); - if (fplace == 20) fplace--; - fconvert[fplace] = 0; - - if(conv == 'f') { - /* -1 for decimal point, another -1 if we are printing a sign */ - padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0); - zpadlen = max - fplace; - } else if(conv == 'g') { - /* zpadlen contains number of trailing zeroes removed */ - padlen = min - iplace - (max-zpadlen) - 1 - ((signvalue) ? 1 : 0); - if(fplace == 0) { - padlen += 1; /* add the decimal dot suppressed */ - zpadlen = 0; - } else zpadlen = (max-zpadlen) - fplace; - } - if (zpadlen < 0) - zpadlen = 0; - if (padlen < 0) - padlen = 0; - if (flags & DP_F_MINUS) - padlen = -padlen; /* Left Justifty */ - - if ((flags & DP_F_ZERO) && (padlen > 0)) - { - if (signvalue) - { - dopr_outch (buffer, currlen, maxlen, signvalue); - --padlen; - signvalue = 0; - } - while (padlen > 0) - { - dopr_outch (buffer, currlen, maxlen, '0'); - --padlen; - } - } - while (padlen > 0) - { - dopr_outch (buffer, currlen, maxlen, ' '); - --padlen; - } - if (signvalue) - dopr_outch (buffer, currlen, maxlen, signvalue); - - while (iplace > 0) - dopr_outch (buffer, currlen, maxlen, iconvert[--iplace]); - - /* for %g do not output decimal point if no fraction is present */ - if(conv == 'f' || (conv == 'g' && fplace > 0)) { - /* - * Decimal point. This should probably use locale to find the correct - * char to print out. - */ - dopr_outch (buffer, currlen, maxlen, '.'); - } - - while (zpadlen > 0) - { - dopr_outch (buffer, currlen, maxlen, '0'); - --zpadlen; - } - - while (fplace > 0) - dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]); - - while (padlen < 0) - { - dopr_outch (buffer, currlen, maxlen, ' '); - ++padlen; - } -} - -static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c) -{ - if (*currlen < maxlen) - buffer[(*currlen)++] = c; -} - -#ifdef TEST_SNPRINTF -#ifndef LONG_STRING -#define LONG_STRING 1024 -#endif -int main (void) -{ - char buf1[LONG_STRING]; - char buf2[LONG_STRING]; - char *fp_fmt[] = { - "%-1.5f", - "%1.5f", - "%123.9f", - "%10.5f", - "% 10.5f", - "%+22.9f", - "%+4.9f", - "%01.3f", - "%4f", - "%3.1f", - "%3.2f", - NULL - }; - double fp_nums[] = { -1.5, 134.21, 91340.2, 341.1234, 0203.9, 0.96, 0.996, - 0.9996, 1.996, 4.136, 0}; - char *int_fmt[] = { - "%-1.5d", - "%1.5d", - "%123.9d", - "%5.5d", - "%10.5d", - "% 10.5d", - "%+22.33d", - "%01.3d", - "%4d", - NULL - }; - long int_nums[] = { -1, 134, 91340, 341, 0203, 0}; - int x, y; - int fail = 0; - int num = 0; - - printf ("Testing snprintf format codes against system sprintf...\n"); - - for (x = 0; fp_fmt[x] != NULL ; x++) - for (y = 0; fp_nums[y] != 0 ; y++) - { - snprintf (buf1, sizeof (buf1), fp_fmt[x], fp_nums[y]); - sprintf (buf2, fp_fmt[x], fp_nums[y]); - if (strcmp (buf1, buf2)) - { - printf("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", - fp_fmt[x], buf1, buf2); - fail++; - } - num++; - } - - for (x = 0; int_fmt[x] != NULL ; x++) - for (y = 0; int_nums[y] != 0 ; y++) - { - snprintf (buf1, sizeof (buf1), int_fmt[x], int_nums[y]); - sprintf (buf2, int_fmt[x], int_nums[y]); - if (strcmp (buf1, buf2)) - { - printf("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", - int_fmt[x], buf1, buf2); - fail++; - } - num++; - } - printf ("%d tests failed out of %d.\n", fail, num); -} +/* for test */ +/* #define SNPRINTF_TEST 1 */ +#ifdef SNPRINTF_TEST +#define snprintf my_snprintf +#define vsnprintf my_vsnprintf #endif /* SNPRINTF_TEST */ -#endif /* !HAVE_SNPRINTF */ +int snprintf(char* str, size_t size, const char* format, ...); +int vsnprintf(char* str, size_t size, const char* format, va_list arg); + +/** + * Very portable snprintf implementation, limited in functionality, + * esp. for %[capital] %[nonportable] and so on. Reduced float functionality, + * mostly in formatting and range (e+-16), for %f and %g. + * + * %s, %d, %u, %i, %x, %c, %n and %% are fully supported. + * This includes width, precision, flags 0- +, and *(arg for wid,prec). + * %f, %g, %m, %p have reduced support, support for wid,prec,flags,*, but + * less floating point range, no %e formatting for %g. + */ +int snprintf(char* str, size_t size, const char* format, ...) +{ + int r; + va_list args; + va_start(args, format); + r = vsnprintf(str, size, format, args); + va_end(args); + return r; +} + +/** add padding to string */ +static void +print_pad(char** at, size_t* left, int* ret, char p, int num) +{ + while(num--) { + if(*left > 1) { + *(*at)++ = p; + (*left)--; + } + (*ret)++; + } +} + +/** get negative symbol, 0 if none */ +static char +get_negsign(int negative, int plus, int space) +{ + if(negative) + return '-'; + if(plus) + return '+'; + if(space) + return ' '; + return 0; +} + +#define PRINT_DEC_BUFSZ 32 /* 20 is enough for 64 bit decimals */ +/** print decimal into buffer, returns length */ +static int +print_dec(char* buf, int max, unsigned int value) +{ + int i = 0; + if(value == 0) { + if(max > 0) { + buf[0] = '0'; + i = 1; + } + } else while(value && i < max) { + buf[i++] = '0' + value % 10; + value /= 10; + } + return i; +} + +/** print long decimal into buffer, returns length */ +static int +print_dec_l(char* buf, int max, unsigned long value) +{ + int i = 0; + if(value == 0) { + if(max > 0) { + buf[0] = '0'; + i = 1; + } + } else while(value && i < max) { + buf[i++] = '0' + value % 10; + value /= 10; + } + return i; +} + +/** print long decimal into buffer, returns length */ +static int +print_dec_ll(char* buf, int max, unsigned long long value) +{ + int i = 0; + if(value == 0) { + if(max > 0) { + buf[0] = '0'; + i = 1; + } + } else while(value && i < max) { + buf[i++] = '0' + value % 10; + value /= 10; + } + return i; +} + +/** print hex into buffer, returns length */ +static int +print_hex(char* buf, int max, unsigned int value) +{ + const char* h = "0123456789abcdef"; + int i = 0; + if(value == 0) { + if(max > 0) { + buf[0] = '0'; + i = 1; + } + } else while(value && i < max) { + buf[i++] = h[value & 0x0f]; + value >>= 4; + } + return i; +} + +/** print long hex into buffer, returns length */ +static int +print_hex_l(char* buf, int max, unsigned long value) +{ + const char* h = "0123456789abcdef"; + int i = 0; + if(value == 0) { + if(max > 0) { + buf[0] = '0'; + i = 1; + } + } else while(value && i < max) { + buf[i++] = h[value & 0x0f]; + value >>= 4; + } + return i; +} + +/** print long long hex into buffer, returns length */ +static int +print_hex_ll(char* buf, int max, unsigned long long value) +{ + const char* h = "0123456789abcdef"; + int i = 0; + if(value == 0) { + if(max > 0) { + buf[0] = '0'; + i = 1; + } + } else while(value && i < max) { + buf[i++] = h[value & 0x0f]; + value >>= 4; + } + return i; +} + +/** copy string into result, reversed */ +static void +spool_str_rev(char** at, size_t* left, int* ret, const char* buf, int len) +{ + int i = len; + while(i) { + if(*left > 1) { + *(*at)++ = buf[--i]; + (*left)--; + } else --i; + (*ret)++; + } +} + +/** copy string into result */ +static void +spool_str(char** at, size_t* left, int* ret, const char* buf, int len) +{ + int i; + for(i=0; i 1) { + *(*at)++ = buf[i]; + (*left)--; + } + (*ret)++; + } +} + +/** print number formatted */ +static void +print_num(char** at, size_t* left, int* ret, int minw, int precision, + int prgiven, int zeropad, int minus, int plus, int space, + int zero, int negative, char* buf, int len) +{ + int w = len; /* excludes minus sign */ + char s = get_negsign(negative, plus, space); + if(minus) { + /* left adjust the number into the field, space padding */ + /* calc numw = [sign][zeroes][number] */ + int numw = w; + if(precision == 0 && zero) numw = 0; + if(numw < precision) numw = precision; + if(s) numw++; + + /* sign */ + if(s) print_pad(at, left, ret, s, 1); + + /* number */ + if(precision == 0 && zero) { + /* "" for the number */ + } else { + if(w < precision) + print_pad(at, left, ret, '0', precision - w); + spool_str_rev(at, left, ret, buf, len); + } + /* spaces */ + if(numw < minw) + print_pad(at, left, ret, ' ', minw - numw); + } else { + /* pad on the left of the number */ + /* calculate numw has width of [sign][zeroes][number] */ + int numw = w; + if(precision == 0 && zero) numw = 0; + if(numw < precision) numw = precision; + if(!prgiven && zeropad && numw < minw) numw = minw; + else if(s) numw++; + + /* pad with spaces */ + if(numw < minw) + print_pad(at, left, ret, ' ', minw - numw); + /* print sign (and one less zeropad if so) */ + if(s) { + print_pad(at, left, ret, s, 1); + numw--; + } + /* pad with zeroes */ + if(w < numw) + print_pad(at, left, ret, '0', numw - w); + if(precision == 0 && zero) + return; + /* print the characters for the value */ + spool_str_rev(at, left, ret, buf, len); + } +} + +/** print %d and %i */ +static void +print_num_d(char** at, size_t* left, int* ret, int value, + int minw, int precision, int prgiven, int zeropad, int minus, + int plus, int space) +{ + char buf[PRINT_DEC_BUFSZ]; + int negative = (value < 0); + int zero = (value == 0); + int len = print_dec(buf, (int)sizeof(buf), + (unsigned int)(negative?-value:value)); + print_num(at, left, ret, minw, precision, prgiven, zeropad, minus, + plus, space, zero, negative, buf, len); +} + +/** print %ld and %li */ +static void +print_num_ld(char** at, size_t* left, int* ret, long value, + int minw, int precision, int prgiven, int zeropad, int minus, + int plus, int space) +{ + char buf[PRINT_DEC_BUFSZ]; + int negative = (value < 0); + int zero = (value == 0); + int len = print_dec_l(buf, (int)sizeof(buf), + (unsigned long)(negative?-value:value)); + print_num(at, left, ret, minw, precision, prgiven, zeropad, minus, + plus, space, zero, negative, buf, len); +} + +/** print %lld and %lli */ +static void +print_num_lld(char** at, size_t* left, int* ret, long long value, + int minw, int precision, int prgiven, int zeropad, int minus, + int plus, int space) +{ + char buf[PRINT_DEC_BUFSZ]; + int negative = (value < 0); + int zero = (value == 0); + int len = print_dec_ll(buf, (int)sizeof(buf), + (unsigned long long)(negative?-value:value)); + print_num(at, left, ret, minw, precision, prgiven, zeropad, minus, + plus, space, zero, negative, buf, len); +} + +/** print %u */ +static void +print_num_u(char** at, size_t* left, int* ret, unsigned int value, + int minw, int precision, int prgiven, int zeropad, int minus, + int plus, int space) +{ + char buf[PRINT_DEC_BUFSZ]; + int negative = 0; + int zero = (value == 0); + int len = print_dec(buf, (int)sizeof(buf), value); + print_num(at, left, ret, minw, precision, prgiven, zeropad, minus, + plus, space, zero, negative, buf, len); +} + +/** print %lu */ +static void +print_num_lu(char** at, size_t* left, int* ret, unsigned long value, + int minw, int precision, int prgiven, int zeropad, int minus, + int plus, int space) +{ + char buf[PRINT_DEC_BUFSZ]; + int negative = 0; + int zero = (value == 0); + int len = print_dec_l(buf, (int)sizeof(buf), value); + print_num(at, left, ret, minw, precision, prgiven, zeropad, minus, + plus, space, zero, negative, buf, len); +} + +/** print %llu */ +static void +print_num_llu(char** at, size_t* left, int* ret, unsigned long long value, + int minw, int precision, int prgiven, int zeropad, int minus, + int plus, int space) +{ + char buf[PRINT_DEC_BUFSZ]; + int negative = 0; + int zero = (value == 0); + int len = print_dec_ll(buf, (int)sizeof(buf), value); + print_num(at, left, ret, minw, precision, prgiven, zeropad, minus, + plus, space, zero, negative, buf, len); +} + +/** print %x */ +static void +print_num_x(char** at, size_t* left, int* ret, unsigned int value, + int minw, int precision, int prgiven, int zeropad, int minus, + int plus, int space) +{ + char buf[PRINT_DEC_BUFSZ]; + int negative = 0; + int zero = (value == 0); + int len = print_hex(buf, (int)sizeof(buf), value); + print_num(at, left, ret, minw, precision, prgiven, zeropad, minus, + plus, space, zero, negative, buf, len); +} + +/** print %lx */ +static void +print_num_lx(char** at, size_t* left, int* ret, unsigned long value, + int minw, int precision, int prgiven, int zeropad, int minus, + int plus, int space) +{ + char buf[PRINT_DEC_BUFSZ]; + int negative = 0; + int zero = (value == 0); + int len = print_hex_l(buf, (int)sizeof(buf), value); + print_num(at, left, ret, minw, precision, prgiven, zeropad, minus, + plus, space, zero, negative, buf, len); +} + +/** print %llx */ +static void +print_num_llx(char** at, size_t* left, int* ret, unsigned long long value, + int minw, int precision, int prgiven, int zeropad, int minus, + int plus, int space) +{ + char buf[PRINT_DEC_BUFSZ]; + int negative = 0; + int zero = (value == 0); + int len = print_hex_ll(buf, (int)sizeof(buf), value); + print_num(at, left, ret, minw, precision, prgiven, zeropad, minus, + plus, space, zero, negative, buf, len); +} + +/** print %llp */ +static void +print_num_llp(char** at, size_t* left, int* ret, void* value, + int minw, int precision, int prgiven, int zeropad, int minus, + int plus, int space) +{ + char buf[PRINT_DEC_BUFSZ]; + int negative = 0; + int zero = (value == 0); +#if defined(UINTPTR_MAX) && defined(UINT32_MAX) && (UINTPTR_MAX == UINT32_MAX) + /* avoid warning about upcast on 32bit systems */ + unsigned long long llvalue = (unsigned long)value; +#else + unsigned long long llvalue = (unsigned long long)value; +#endif + int len = print_hex_ll(buf, (int)sizeof(buf), llvalue); + if(zero) { + buf[0]=')'; + buf[1]='l'; + buf[2]='i'; + buf[3]='n'; + buf[4]='('; + len = 5; + } else { + /* put '0x' in front of the (reversed) buffer result */ + if(len < PRINT_DEC_BUFSZ) + buf[len++] = 'x'; + if(len < PRINT_DEC_BUFSZ) + buf[len++] = '0'; + } + print_num(at, left, ret, minw, precision, prgiven, zeropad, minus, + plus, space, zero, negative, buf, len); +} + +#define PRINT_FLOAT_BUFSZ 64 /* xx.yy with 20.20 about the max */ +/** spool remainder after the decimal point to buffer, in reverse */ +static int +print_remainder(char* buf, int max, double r, int prec) +{ + unsigned long long cap = 1; + unsigned long long value; + int len, i; + if(prec > 19) prec = 19; /* max we can do */ + if(max < prec) return 0; + for(i=0; i= 5) { + value++; + /* that might carry to numbers before the comma, if so, + * just ignore that rounding. failure because 64bitprintout */ + if(value >= cap) + value = cap-1; + } + len = print_dec_ll(buf, max, value); + while(len < prec) { /* pad with zeroes, e.g. if 0.0012 */ + buf[len++] = '0'; + } + if(len < max) + buf[len++] = '.'; + return len; +} + +/** spool floating point to buffer */ +static int +print_float(char* buf, int max, double value, int prec) +{ + /* as xxx.xxx if prec==0, no '.', with prec decimals after . */ + /* no conversion for NAN and INF, because we do not want to require + linking with -lm. */ + /* Thus, the conversions use 64bit integers to convert the numbers, + * which makes 19 digits before and after the decimal point the max */ + unsigned long long whole = (unsigned long long)value; + double remain = value - (double)whole; + int len = 0; + if(prec != 0) + len = print_remainder(buf, max, remain, prec); + len += print_dec_ll(buf+len, max-len, whole); + return len; +} + +/** print %f */ +static void +print_num_f(char** at, size_t* left, int* ret, double value, + int minw, int precision, int prgiven, int zeropad, int minus, + int plus, int space) +{ + char buf[PRINT_FLOAT_BUFSZ]; + int negative = (value < 0); + int zero = 0; + int len; + if(!prgiven) precision = 6; + len = print_float(buf, (int)sizeof(buf), negative?-value:value, + precision); + print_num(at, left, ret, minw, 1, 0, zeropad, minus, + plus, space, zero, negative, buf, len); +} + +/* rudimentary %g support */ +static int +print_float_g(char* buf, int max, double value, int prec) +{ + unsigned long long whole = (unsigned long long)value; + double remain = value - (double)whole; + int before = 0; + int len = 0; + + /* number of digits before the decimal point */ + while(whole > 0) { + before++; + whole /= 10; + } + whole = (unsigned long long)value; + + if(prec > before && remain != 0.0) { + /* see if the last decimals are zero, if so, skip them */ + len = print_remainder(buf, max, remain, prec-before); + while(len > 0 && buf[0]=='0') { + memmove(buf, buf+1, --len); + } + } + len += print_dec_ll(buf+len, max-len, whole); + return len; +} + + +/** print %g */ +static void +print_num_g(char** at, size_t* left, int* ret, double value, + int minw, int precision, int prgiven, int zeropad, int minus, + int plus, int space) +{ + char buf[PRINT_FLOAT_BUFSZ]; + int negative = (value < 0); + int zero = 0; + int len; + if(!prgiven) precision = 6; + if(precision == 0) precision = 1; + len = print_float_g(buf, (int)sizeof(buf), negative?-value:value, + precision); + print_num(at, left, ret, minw, 1, 0, zeropad, minus, + plus, space, zero, negative, buf, len); +} + + +/** strnlen (compat implementation) */ +static int +my_strnlen(const char* s, int max) +{ + int i; + for(i=0; i 1) { + *at++ = *fmt++; + left--; + } else fmt++; + ret++; + } + + /* see if we are at end */ + if(!*fmt) break; + + /* fetch next argument % designation from format string */ + fmt++; /* skip the '%' */ + + /********************************/ + /* get the argument designation */ + /********************************/ + /* we must do this vararg stuff inside this function for + * portability. Hence, get_designation, and print_designation + * are not their own functions. */ + + /* printout designation: + * conversion specifier: x, d, u, s, c, n, m, p + * flags: # not supported + * 0 zeropad (on the left) + * - left adjust (right by default) + * ' ' printspace for positive number (in - position). + * + alwayssign + * fieldwidth: [1-9][0-9]* minimum field width. + * if this is * then type int next argument specifies the minwidth. + * if this is negative, the - flag is set (with positive width). + * precision: period[digits]*, %.2x. + * if this is * then type int next argument specifies the precision. + * just '.' or negative value means precision=0. + * this is mindigits to print for d, i, u, x + * this is aftercomma digits for f + * this is max number significant digits for g + * maxnumber characters to be printed for s + * length: 0-none (int), 1-l (long), 2-ll (long long) + * notsupported: hh (char), h (short), L (long double), q, j, z, t + * Does not support %m$ and *m$ argument designation as array indices. + * Does not support %#x + * + */ + minw = 0; + precision = 1; + prgiven = 0; + zeropad = 0; + minus = 0; + plus = 0; + space = 0; + length = 0; + + /* get flags in any order */ + for(;;) { + if(*fmt == '0') + zeropad = 1; + else if(*fmt == '-') + minus = 1; + else if(*fmt == '+') + plus = 1; + else if(*fmt == ' ') + space = 1; + else break; + fmt++; + } + + /* field width */ + if(*fmt == '*') { + fmt++; /* skip char */ + minw = va_arg(arg, int); + if(minw < 0) { + minus = 1; + minw = -minw; + } + } else while(*fmt >= '0' && *fmt <= '9') { + minw = minw*10 + (*fmt++)-'0'; + } + + /* precision */ + if(*fmt == '.') { + fmt++; /* skip period */ + prgiven = 1; + precision = 0; + if(*fmt == '*') { + fmt++; /* skip char */ + precision = va_arg(arg, int); + if(precision < 0) + precision = 0; + } else while(*fmt >= '0' && *fmt <= '9') { + precision = precision*10 + (*fmt++)-'0'; + } + } + + /* length */ + if(*fmt == 'l') { + fmt++; /* skip char */ + length = 1; + if(*fmt == 'l') { + fmt++; /* skip char */ + length = 2; + } + } + + /* get the conversion */ + if(!*fmt) conv = 0; + else conv = *fmt++; + + /***********************************/ + /* print that argument designation */ + /***********************************/ + switch(conv) { + case 'i': + case 'd': + if(length == 0) + print_num_d(&at, &left, &ret, va_arg(arg, int), + minw, precision, prgiven, zeropad, minus, plus, space); + else if(length == 1) + print_num_ld(&at, &left, &ret, va_arg(arg, long), + minw, precision, prgiven, zeropad, minus, plus, space); + else if(length == 2) + print_num_lld(&at, &left, &ret, + va_arg(arg, long long), + minw, precision, prgiven, zeropad, minus, plus, space); + break; + case 'u': + if(length == 0) + print_num_u(&at, &left, &ret, + va_arg(arg, unsigned int), + minw, precision, prgiven, zeropad, minus, plus, space); + else if(length == 1) + print_num_lu(&at, &left, &ret, + va_arg(arg, unsigned long), + minw, precision, prgiven, zeropad, minus, plus, space); + else if(length == 2) + print_num_llu(&at, &left, &ret, + va_arg(arg, unsigned long long), + minw, precision, prgiven, zeropad, minus, plus, space); + break; + case 'x': + if(length == 0) + print_num_x(&at, &left, &ret, + va_arg(arg, unsigned int), + minw, precision, prgiven, zeropad, minus, plus, space); + else if(length == 1) + print_num_lx(&at, &left, &ret, + va_arg(arg, unsigned long), + minw, precision, prgiven, zeropad, minus, plus, space); + else if(length == 2) + print_num_llx(&at, &left, &ret, + va_arg(arg, unsigned long long), + minw, precision, prgiven, zeropad, minus, plus, space); + break; + case 's': + print_str(&at, &left, &ret, va_arg(arg, char*), + minw, precision, prgiven, minus); + break; + case 'c': + print_char(&at, &left, &ret, va_arg(arg, int), + minw, minus); + break; + case 'n': + *va_arg(arg, int*) = ret; + break; + case 'm': + print_str(&at, &left, &ret, strerror(errno), + minw, precision, prgiven, minus); + break; + case 'p': + print_num_llp(&at, &left, &ret, va_arg(arg, void*), + minw, precision, prgiven, zeropad, minus, plus, space); + break; + case '%': + print_pad(&at, &left, &ret, '%', 1); + break; + case 'f': + print_num_f(&at, &left, &ret, va_arg(arg, double), + minw, precision, prgiven, zeropad, minus, plus, space); + break; + case 'g': + print_num_g(&at, &left, &ret, va_arg(arg, double), + minw, precision, prgiven, zeropad, minus, plus, space); + break; + /* unknown */ + default: + case 0: break; + } + } + + /* zero terminate */ + if(left > 0) + *at = 0; + return ret; +} + +#ifdef SNPRINTF_TEST + +/** do tests */ +#undef snprintf +#define DOTEST(bufsz, result, retval, ...) do { \ + char buf[bufsz]; \ + printf("now test %s\n", #__VA_ARGS__); \ + int r=my_snprintf(buf, sizeof(buf), __VA_ARGS__); \ + if(r != retval || strcmp(buf, result) != 0) { \ + printf("error test(%s) was \"%s\":%d\n", \ + ""#bufsz", "#result", "#retval", "#__VA_ARGS__, \ + buf, r); \ + exit(1); \ + } \ + r=snprintf(buf, sizeof(buf), __VA_ARGS__); \ + if(r != retval || strcmp(buf, result) != 0) { \ + printf("error test(%s) differs with system, \"%s\":%d\n", \ + ""#bufsz", "#result", "#retval", "#__VA_ARGS__, \ + buf, r); \ + exit(1); \ + } \ + printf("test(\"%s\":%d) passed\n", buf, r); \ + } while(0); + +/** test program */ +int main(void) +{ + int x = 0; + + /* bufsize, expectedstring, expectedretval, snprintf arguments */ + DOTEST(1024, "hello", 5, "hello"); + DOTEST(1024, "h", 1, "h"); + /* warning from gcc for format string, but it does work + * DOTEST(1024, "", 0, ""); */ + + DOTEST(3, "he", 5, "hello"); + DOTEST(1, "", 7, "%d", 7823089); + + /* test positive numbers */ + DOTEST(1024, "0", 1, "%d", 0); + DOTEST(1024, "1", 1, "%d", 1); + DOTEST(1024, "9", 1, "%d", 9); + DOTEST(1024, "15", 2, "%d", 15); + DOTEST(1024, "ab15cd", 6, "ab%dcd", 15); + DOTEST(1024, "167", 3, "%d", 167); + DOTEST(1024, "7823089", 7, "%d", 7823089); + DOTEST(1024, " 12", 3, "%3d", 12); + DOTEST(1024, "012", 3, "%.3d", 12); + DOTEST(1024, "012", 3, "%3.3d", 12); + DOTEST(1024, "012", 3, "%03d", 12); + DOTEST(1024, " 012", 4, "%4.3d", 12); + DOTEST(1024, "", 0, "%.0d", 0); + + /* test negative numbers */ + DOTEST(1024, "-1", 2, "%d", -1); + DOTEST(1024, "-12", 3, "%3d", -12); + DOTEST(1024, " -2", 3, "%3d", -2); + DOTEST(1024, "-012", 4, "%.3d", -12); + DOTEST(1024, "-012", 4, "%3.3d", -12); + DOTEST(1024, "-012", 4, "%4.3d", -12); + DOTEST(1024, " -012", 5, "%5.3d", -12); + DOTEST(1024, "-12", 3, "%03d", -12); + DOTEST(1024, "-02", 3, "%03d", -2); + DOTEST(1024, "-15", 3, "%d", -15); + DOTEST(1024, "-7307", 5, "%d", -7307); + DOTEST(1024, "-12 ", 5, "%-5d", -12); + DOTEST(1024, "-00012", 6, "%-.5d", -12); + + /* test + and space flags */ + DOTEST(1024, "+12", 3, "%+d", 12); + DOTEST(1024, " 12", 3, "% d", 12); + + /* test %u */ + DOTEST(1024, "12", 2, "%u", 12); + DOTEST(1024, "0", 1, "%u", 0); + DOTEST(1024, "4294967295", 10, "%u", 0xffffffff); + + /* test %x */ + DOTEST(1024, "0", 1, "%x", 0); + DOTEST(1024, "c", 1, "%x", 12); + DOTEST(1024, "12ab34cd", 8, "%x", 0x12ab34cd); + + /* test %llu, %lld */ + DOTEST(1024, "18446744073709551615", 20, "%llu", + (long long)0xffffffffffffffff); + DOTEST(1024, "-9223372036854775808", 20, "%lld", + (long long)0x8000000000000000); + DOTEST(1024, "9223372036854775808", 19, "%llu", + (long long)0x8000000000000000); + + /* test %s */ + DOTEST(1024, "hello", 5, "%s", "hello"); + DOTEST(1024, " hello", 10, "%10s", "hello"); + DOTEST(1024, "hello ", 10, "%-10s", "hello"); + DOTEST(1024, "he", 2, "%.2s", "hello"); + DOTEST(1024, " he", 4, "%4.2s", "hello"); + DOTEST(1024, " h", 4, "%4.2s", "h"); + + /* test %c */ + DOTEST(1024, "a", 1, "%c", 'a'); + /* warning from gcc for format string, but it does work + DOTEST(1024, " a", 5, "%5c", 'a'); + DOTEST(1024, "a", 1, "%.0c", 'a'); */ + + /* test %n */ + DOTEST(1024, "hello", 5, "hello%n", &x); + if(x != 5) { printf("the %%n failed\n"); exit(1); } + + /* test %m */ + errno = 0; + DOTEST(1024, "Success", 7, "%m"); + + /* test %p */ + DOTEST(1024, "0x10", 4, "%p", (void*)0x10); + DOTEST(1024, "(nil)", 5, "%p", (void*)0x0); + + /* test %% */ + DOTEST(1024, "%", 1, "%%"); + + /* test %f */ + DOTEST(1024, "0.000000", 8, "%f", 0.0); + DOTEST(1024, "0.00", 4, "%.2f", 0.0); + /* differs, "-0.00" DOTEST(1024, "0.00", 4, "%.2f", -0.0); */ + DOTEST(1024, "234.00", 6, "%.2f", 234.005); + DOTEST(1024, "8973497.1246", 12, "%.4f", 8973497.12456); + DOTEST(1024, "-12.000000", 10, "%f", -12.0); + DOTEST(1024, "6", 1, "%.0f", 6.0); + + DOTEST(1024, "6", 1, "%g", 6.0); + DOTEST(1024, "6.1", 3, "%g", 6.1); + DOTEST(1024, "6.15", 4, "%g", 6.15); + + /* These format strings are from the code of NSD, Unbound, ldns */ + + DOTEST(1024, "abcdef", 6, "%s", "abcdef"); + DOTEST(1024, "005", 3, "%03u", 5); + DOTEST(1024, "12345", 5, "%03u", 12345); + DOTEST(1024, "5", 1, "%d", 5); + DOTEST(1024, "(nil)", 5, "%p", NULL); + DOTEST(1024, "12345", 5, "%ld", (long)12345); + DOTEST(1024, "12345", 5, "%lu", (long)12345); + DOTEST(1024, " 12345", 12, "%12u", (unsigned)12345); + DOTEST(1024, "12345", 5, "%u", (unsigned)12345); + DOTEST(1024, "12345", 5, "%llu", (unsigned long long)12345); + DOTEST(1024, "12345", 5, "%x", 0x12345); + DOTEST(1024, "12345", 5, "%llx", (long long)0x12345); + DOTEST(1024, "012345", 6, "%6.6d", 12345); + DOTEST(1024, "012345", 6, "%6.6u", 12345); + DOTEST(1024, "1234.54", 7, "%g", 1234.54); + DOTEST(1024, "123456789.54", 12, "%.12g", 123456789.54); + DOTEST(1024, "3456789123456.54", 16, "%.16g", 3456789123456.54); + /* %24g does not work with 24 digits, not enough accuracy, + * the first 16 digits are correct */ + DOTEST(1024, "12345", 5, "%3.3d", 12345); + DOTEST(1024, "000", 3, "%3.3d", 0); + DOTEST(1024, "001", 3, "%3.3d", 1); + DOTEST(1024, "012", 3, "%3.3d", 12); + DOTEST(1024, "-012", 4, "%3.3d", -12); + DOTEST(1024, "he", 2, "%.2s", "hello"); + DOTEST(1024, "helloworld", 10, "%s%s", "hello", "world"); + DOTEST(1024, "he", 2, "%.*s", 2, "hello"); + DOTEST(1024, " hello", 7, "%*s", 7, "hello"); + DOTEST(1024, "hello ", 7, "%*s", -7, "hello"); + DOTEST(1024, "0", 1, "%c", '0'); + DOTEST(1024, "A", 1, "%c", 'A'); + DOTEST(1024, "", 1, "%c", 0); + DOTEST(1024, "\010", 1, "%c", 8); + DOTEST(1024, "%", 1, "%%"); + DOTEST(1024, "0a", 2, "%02x", 0x0a); + DOTEST(1024, "bd", 2, "%02x", 0xbd); + DOTEST(1024, "12", 2, "%02ld", (long)12); + DOTEST(1024, "02", 2, "%02ld", (long)2); + DOTEST(1024, "02", 2, "%02u", (unsigned)2); + DOTEST(1024, "765432", 6, "%05u", (unsigned)765432); + DOTEST(1024, "10.234", 6, "%0.3f", 10.23421); + DOTEST(1024, "123456.234", 10, "%0.3f", 123456.23421); + DOTEST(1024, "123456789.234", 13, "%0.3f", 123456789.23421); + DOTEST(1024, "123456.23", 9, "%.2f", 123456.23421); + DOTEST(1024, "123456", 6, "%.0f", 123456.23421); + DOTEST(1024, "0123", 4, "%.4x", 0x0123); + DOTEST(1024, "00000123", 8, "%.8x", 0x0123); + DOTEST(1024, "ffeb0cde", 8, "%.8x", 0xffeb0cde); + DOTEST(1024, " 987654321", 10, "%10lu", (unsigned long)987654321); + DOTEST(1024, " 987654321", 12, "%12lu", (unsigned long)987654321); + DOTEST(1024, "987654321", 9, "%i", 987654321); + DOTEST(1024, "-87654321", 9, "%i", -87654321); + DOTEST(1024, "hello ", 16, "%-16s", "hello"); + DOTEST(1024, " ", 16, "%-16s", ""); + DOTEST(1024, "a ", 16, "%-16s", "a"); + DOTEST(1024, "foobarfoobar ", 16, "%-16s", "foobarfoobar"); + DOTEST(1024, "foobarfoobarfoobar", 18, "%-16s", "foobarfoobarfoobar"); + + /* combined expressions */ + DOTEST(1024, "foo 1.0 size 512 edns", 21, + "foo %s size %d %s%s", "1.0", 512, "", "edns"); + DOTEST(15, "foo 1.0 size 5", 21, + "foo %s size %d %s%s", "1.0", 512, "", "edns"); + DOTEST(1024, "packet 1203ceff id", 18, + "packet %2.2x%2.2x%2.2x%2.2x id", 0x12, 0x03, 0xce, 0xff); + DOTEST(1024, "/tmp/testbound_123abcd.tmp", 26, "/tmp/testbound_%u%s%s.tmp", 123, "ab", "cd"); + + return 0; +} +#endif /* SNPRINTF_TEST */ diff --git a/contrib/unbound/compat/strlcat.c b/contrib/unbound/compat/strlcat.c new file mode 100644 index 00000000000..0bea9250b66 --- /dev/null +++ b/contrib/unbound/compat/strlcat.c @@ -0,0 +1,73 @@ +/* compat/strlcat.c */ + +/*- + * Copyright (c) 1998 Todd C. Miller + * 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. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``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. + */ + +/* OPENBSD ORIGINAL: lib/libc/string/strlcat.c */ + +#include "config.h" +#ifndef HAVE_STRLCAT + +#include +#include + +/* + * Appends src to string dst of size siz (unlike strncat, siz is the + * full size of dst, not space left). At most siz-1 characters + * will be copied. Always NUL terminates (unless siz <= strlen(dst)). + * Returns strlen(src) + MIN(siz, strlen(initial dst)). + * If retval >= siz, truncation occurred. + */ +size_t +strlcat(char *dst, const char *src, size_t siz) +{ + char *d = dst; + const char *s = src; + size_t n = siz; + size_t dlen; + + /* Find the end of dst and adjust bytes left but don't go past end */ + while (n-- != 0 && *d != '\0') + d++; + dlen = d - dst; + n = siz - dlen; + + if (n == 0) + return(dlen + strlen(s)); + while (*s != '\0') { + if (n != 1) { + *d++ = *s; + n--; + } + s++; + } + *d = '\0'; + + return(dlen + (s - src)); /* count does not include NUL */ +} + +#endif /* !HAVE_STRLCAT */ diff --git a/contrib/unbound/config.h b/contrib/unbound/config.h index 27af3d642d8..9c53c13e0d2 100644 --- a/contrib/unbound/config.h +++ b/contrib/unbound/config.h @@ -62,6 +62,12 @@ /* Define to 1 if you have the header file. */ #define HAVE_DLFCN_H 1 +/* Define to 1 if you have the `endprotoent' function. */ +#define HAVE_ENDPROTOENT 1 + +/* Define to 1 if you have the `endservent' function. */ +#define HAVE_ENDSERVENT 1 + /* Define to 1 if you have the `event_base_free' function. */ /* #undef HAVE_EVENT_BASE_FREE */ @@ -158,15 +164,6 @@ /* Define to 1 if you have the `kill' function. */ #define HAVE_KILL 1 -/* Define to 1 if you have the `ldns_key_EVP_unload_gost' function. */ -/* #undef HAVE_LDNS_KEY_EVP_UNLOAD_GOST */ - -/* Define to 1 if you have the header file. */ -#define HAVE_LDNS_LDNS_H 1 - -/* Define to 1 if you have the `ldns' library (-lldns). */ -#define HAVE_LIBLDNS 1 - /* Define to 1 if you have the `localtime_r' function. */ #define HAVE_LOCALTIME_R 1 @@ -212,6 +209,9 @@ /* Define if you have POSIX threads libraries and header files. */ #define HAVE_PTHREAD 1 +/* Have PTHREAD_PRIO_INHERIT. */ +#define HAVE_PTHREAD_PRIO_INHERIT 1 + /* Define to 1 if the system has the type `pthread_rwlock_t'. */ #define HAVE_PTHREAD_RWLOCK_T 1 @@ -231,7 +231,7 @@ #define HAVE_RECVMSG 1 /* Define to 1 if you have the `sbrk' function. */ -#define HAVE_SBRK 1 +/* #undef HAVE_SBRK */ /* Define to 1 if you have the `sendmsg' function. */ #define HAVE_SENDMSG 1 @@ -299,6 +299,9 @@ /* Define to 1 if you have the header file. */ #define HAVE_STRING_H 1 +/* Define to 1 if you have the `strlcat' function. */ +#define HAVE_STRLCAT 1 + /* Define to 1 if you have the `strlcpy' function. */ #define HAVE_STRLCPY 1 @@ -428,7 +431,7 @@ #define PACKAGE_NAME "unbound" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "unbound 1.4.20" +#define PACKAGE_STRING "unbound 1.4.22" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "unbound" @@ -437,7 +440,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.4.20" +#define PACKAGE_VERSION "1.4.22" /* default pidfile location */ #define PIDFILE "/var/unbound/unbound.pid" @@ -456,7 +459,7 @@ #define ROOT_CERT_FILE "/var/unbound/icannbundle.pem" /* version number for resource files */ -#define RSRC_PACKAGE_VERSION 1,4,2,0 +#define RSRC_PACKAGE_VERSION 1,4,22,0 /* Directory to chdir to */ #define RUN_DIR "/var/unbound" @@ -464,6 +467,9 @@ /* Shared data */ #define SHARE_DIR "/var/unbound" +/* The size of `time_t', as computed by sizeof. */ +#define SIZEOF_TIME_T 8 + /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 @@ -558,6 +564,9 @@ /* Define to 1 if on MINIX. */ /* #undef _MINIX */ +/* Enable for compile on Minix */ +/* #undef _NETBSD_SOURCE */ + /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ /* #undef _POSIX_1_SOURCE */ @@ -676,6 +685,12 @@ # define NDEBUG #endif +/** Use small-ldns codebase */ +#define USE_SLDNS 1 +#ifdef HAVE_SSL +# define LDNS_BUILD_CONFIG_HAVE_SSL 1 +#endif + #include #include #include @@ -686,6 +701,10 @@ #include #endif +#ifdef HAVE_STDARG_H +#include +#endif + #ifdef HAVE_STDINT_H #include #endif @@ -720,6 +739,12 @@ #include #endif +#ifndef USE_WINSOCK +#define ARG_LL "%ll" +#else +#define ARG_LL "%I64" +#endif + #ifdef HAVE_ATTR_FORMAT @@ -785,6 +810,12 @@ void *memmove(void *dest, const void *src, size_t n); #endif +#ifndef HAVE_STRLCAT +#define strlcat strlcat_unbound +size_t strlcat(char *dst, const char *src, size_t siz); +#endif + + #ifndef HAVE_STRLCPY #define strlcpy strlcpy_unbound size_t strlcpy(char *dst, const char *src, size_t siz); @@ -797,7 +828,7 @@ struct tm *gmtime_r(const time_t *timep, struct tm *result); #endif -#ifndef HAVE_SLEEP +#if !defined(HAVE_SLEEP) || defined(HAVE_WINDOWS_H) #define sleep(x) Sleep((x)*1000) /* on win32 */ #endif /* HAVE_SLEEP */ @@ -863,8 +894,6 @@ char *strptime(const char *s, const char *format, struct tm *tm); # endif #endif /* CHECKED_INET6 */ -/* maximum nesting of included files */ -#define MAXINCLUDES 10 #ifndef HAVE_GETADDRINFO struct sockaddr_storage; #include "compat/fake-rfc2553.h" diff --git a/contrib/unbound/config.h.in b/contrib/unbound/config.h.in index 930b638c3e4..630a939bf9f 100644 --- a/contrib/unbound/config.h.in +++ b/contrib/unbound/config.h.in @@ -61,6 +61,12 @@ /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H +/* Define to 1 if you have the `endprotoent' function. */ +#undef HAVE_ENDPROTOENT + +/* Define to 1 if you have the `endservent' function. */ +#undef HAVE_ENDSERVENT + /* Define to 1 if you have the `event_base_free' function. */ #undef HAVE_EVENT_BASE_FREE @@ -157,15 +163,6 @@ /* Define to 1 if you have the `kill' function. */ #undef HAVE_KILL -/* Define to 1 if you have the `ldns_key_EVP_unload_gost' function. */ -#undef HAVE_LDNS_KEY_EVP_UNLOAD_GOST - -/* Define to 1 if you have the header file. */ -#undef HAVE_LDNS_LDNS_H - -/* Define to 1 if you have the `ldns' library (-lldns). */ -#undef HAVE_LIBLDNS - /* Define to 1 if you have the `localtime_r' function. */ #undef HAVE_LOCALTIME_R @@ -211,6 +208,9 @@ /* Define if you have POSIX threads libraries and header files. */ #undef HAVE_PTHREAD +/* Have PTHREAD_PRIO_INHERIT. */ +#undef HAVE_PTHREAD_PRIO_INHERIT + /* Define to 1 if the system has the type `pthread_rwlock_t'. */ #undef HAVE_PTHREAD_RWLOCK_T @@ -298,6 +298,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H +/* Define to 1 if you have the `strlcat' function. */ +#undef HAVE_STRLCAT + /* Define to 1 if you have the `strlcpy' function. */ #undef HAVE_STRLCPY @@ -463,6 +466,9 @@ /* Shared data */ #undef SHARE_DIR +/* The size of `time_t', as computed by sizeof. */ +#undef SIZEOF_TIME_T + /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS @@ -557,6 +563,9 @@ /* Define to 1 if on MINIX. */ #undef _MINIX +/* Enable for compile on Minix */ +#undef _NETBSD_SOURCE + /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE @@ -675,6 +684,12 @@ # define NDEBUG #endif +/** Use small-ldns codebase */ +#define USE_SLDNS 1 +#ifdef HAVE_SSL +# define LDNS_BUILD_CONFIG_HAVE_SSL 1 +#endif + #include #include #include @@ -685,6 +700,10 @@ #include #endif +#ifdef HAVE_STDARG_H +#include +#endif + #ifdef HAVE_STDINT_H #include #endif @@ -719,6 +738,12 @@ #include #endif +#ifndef USE_WINSOCK +#define ARG_LL "%ll" +#else +#define ARG_LL "%I64" +#endif + #ifdef HAVE_ATTR_FORMAT @@ -784,6 +809,12 @@ void *memmove(void *dest, const void *src, size_t n); #endif +#ifndef HAVE_STRLCAT +#define strlcat strlcat_unbound +size_t strlcat(char *dst, const char *src, size_t siz); +#endif + + #ifndef HAVE_STRLCPY #define strlcpy strlcpy_unbound size_t strlcpy(char *dst, const char *src, size_t siz); @@ -796,7 +827,7 @@ struct tm *gmtime_r(const time_t *timep, struct tm *result); #endif -#ifndef HAVE_SLEEP +#if !defined(HAVE_SLEEP) || defined(HAVE_WINDOWS_H) #define sleep(x) Sleep((x)*1000) /* on win32 */ #endif /* HAVE_SLEEP */ @@ -862,8 +893,6 @@ char *strptime(const char *s, const char *format, struct tm *tm); # endif #endif /* CHECKED_INET6 */ -/* maximum nesting of included files */ -#define MAXINCLUDES 10 #ifndef HAVE_GETADDRINFO struct sockaddr_storage; #include "compat/fake-rfc2553.h" diff --git a/contrib/unbound/configure b/contrib/unbound/configure index 8d3a1812ecf..5672b3934e1 100755 --- a/contrib/unbound/configure +++ b/contrib/unbound/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for unbound 1.4.20. +# Generated by GNU Autoconf 2.69 for unbound 1.4.22. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='unbound' PACKAGE_TARNAME='unbound' -PACKAGE_VERSION='1.4.20' -PACKAGE_STRING='unbound 1.4.20' +PACKAGE_VERSION='1.4.22' +PACKAGE_STRING='unbound 1.4.22' PACKAGE_BUGREPORT='unbound-bugs@nlnetlabs.nl' PACKAGE_URL='' @@ -632,7 +632,7 @@ ac_includes_default="\ #endif" ac_subst_vars='LTLIBOBJS -ldnsdir +INSTALLTARGET ALLTARGET SOURCEFILE SOURCEDETERMINE @@ -651,6 +651,8 @@ WINAPPS WINDRES CHECKLOCK_OBJ staticexe +UNBOUND_EVENT_UNINSTALL +UNBOUND_EVENT_INSTALL HAVE_SSL CONFIG_DATE NETBSD_LINTFLAGS @@ -677,7 +679,7 @@ PYTHON_VERSION PTHREAD_CFLAGS PTHREAD_LIBS PTHREAD_CC -acx_pthread_config +ax_pthread_config RUNTIME_PATH LIBOBJS OTOOL64 @@ -739,6 +741,9 @@ CC LIBUNBOUND_AGE LIBUNBOUND_REVISION LIBUNBOUND_CURRENT +UNBOUND_VERSION_MICRO +UNBOUND_VERSION_MINOR +UNBOUND_VERSION_MAJOR target_alias host_alias build_alias @@ -790,6 +795,7 @@ with_rootcert_file with_username enable_checking enable_debug +enable_flto enable_shared enable_static with_pic @@ -811,13 +817,13 @@ with_ssl enable_sha2 enable_gost enable_ecdsa +enable_event_api with_libevent with_libexpat enable_static_exe enable_lock_checks enable_allsymbols with_libunbound_only -with_ldns ' ac_precious_vars='build_alias host_alias @@ -1371,7 +1377,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures unbound 1.4.20 to adapt to many kinds of systems. +\`configure' configures unbound 1.4.22 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1436,7 +1442,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of unbound 1.4.20:";; + short | recursive ) echo "Configuration of unbound 1.4.22:";; esac cat <<\_ACEOF @@ -1446,6 +1452,7 @@ Optional Features: --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-checking Enable warnings, asserts, makefile-dependencies --enable-debug same as enable-checking + --disable-flto Disable link-time optimization (gcc specific option) --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] @@ -1464,8 +1471,10 @@ Optional Features: --disable-sha2 Disable SHA256 and SHA512 RRSIG support --disable-gost Disable GOST support --disable-ecdsa Disable ECDSA support + --enable-event-api Enable (experimental) libevent-based libunbound API + installed to unbound-event.h --enable-static-exe enable to compile executables statically against - event, ldns libs, for debug purposes + (event) libs, for debug purposes --enable-lock-checks enable to check lock and unlock calls, for debug purposes --enable-allsymbols export all symbols from libunbound and link binaries @@ -1516,7 +1525,6 @@ Optional Packages: outgoing port ranges. --with-libexpat=path specify explicit path for libexpat. --with-libunbound-only do not build daemon and tool programs - --with-ldns=PATH specify prefix of path of ldns library to use Some influential environment variables: CC C compiler command @@ -1604,7 +1612,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -unbound configure 1.4.20 +unbound configure 1.4.22 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2024,6 +2032,189 @@ $as_echo "$ac_res" >&6; } } # ac_fn_c_check_type +# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES +# -------------------------------------------- +# Tries to find the compile-time value of EXPR in a program that includes +# INCLUDES, setting VAR accordingly. Returns whether the value could be +# computed +ac_fn_c_compute_int () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) >= 0)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=0 ac_mid=0 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid; break +else + as_fn_arith $ac_mid + 1 && ac_lo=$as_val + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) < 0)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=-1 ac_mid=-1 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) >= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=$ac_mid; break +else + as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + ac_lo= ac_hi= +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid +else + as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in #(( +?*) eval "$3=\$ac_lo"; ac_retval=0 ;; +'') ac_retval=1 ;; +esac + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +static long int longval () { return $2; } +static unsigned long int ulongval () { return $2; } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (($2) < 0) + { + long int i = longval (); + if (i != ($2)) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ($2)) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + echo >>conftest.val; read $3 config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by unbound $as_me 1.4.20, which was +It was created by unbound $as_me 1.4.22, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2478,10 +2669,16 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu +UNBOUND_VERSION_MAJOR=1 -LIBUNBOUND_CURRENT=3 -LIBUNBOUND_REVISION=5 -LIBUNBOUND_AGE=1 +UNBOUND_VERSION_MINOR=4 + +UNBOUND_VERSION_MICRO=22 + + +LIBUNBOUND_CURRENT=4 +LIBUNBOUND_REVISION=1 +LIBUNBOUND_AGE=2 # 1.0.0 had 0:12:0 # 1.0.1 had 0:13:0 # 1.0.2 had 0:14:0 @@ -2516,7 +2713,8 @@ LIBUNBOUND_AGE=1 # 1.4.17 had 3:2:1 # 1.4.18 had 3:3:1 # 1.4.19 had 3:4:1 -# 1.4.20 had 4:0:2 # adds libunbound.ttl +# 1.4.20 had 4:0:2 # adds libunbound.ttl # but shipped 3:5:1 +# 1.4.21 had 4:1:2 # Current -- the number of the binary API that we're implementing # Revision -- which iteration of the implementation of the binary @@ -3790,6 +3988,11 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } +if test "$ac_cv_header_minix_config_h" = "yes"; then + +$as_echo "#define _NETBSD_SOURCE 1" >>confdefs.h + +fi case "$prefix" in NONE) @@ -3971,7 +4174,7 @@ _ACEOF $as_echo "#define WINVER 0x0502" >>confdefs.h -wnvs=`echo $PACKAGE_VERSION | sed -e 's/^[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\).*$/\1,\2,\3,\4/' -e 's/^[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*$/\1,\2,\3,0/' ` +wnvs=`echo $PACKAGE_VERSION | sed -e 's/^[^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\).*$/\1,\2,\3,\4/' -e 's/^[^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9]*$/\1,\2,\3,0/' ` cat >>confdefs.h <<_ACEOF @@ -4078,7 +4281,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then : $as_echo_n "(cached) " >&6 else -echo 'void f(){}' >conftest.c +echo 'void f(void){}' >conftest.c if test -z "`$CC $CPPFLAGS $CFLAGS -g -c conftest.c 2>&1`"; then eval "cv_prog_cc_flag_$cache=yes" else @@ -4109,7 +4312,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then : $as_echo_n "(cached) " >&6 else -echo 'void f(){}' >conftest.c +echo 'void f(void){}' >conftest.c if test -z "`$CC $CPPFLAGS $CFLAGS -O2 -c conftest.c 2>&1`"; then eval "cv_prog_cc_flag_$cache=yes" else @@ -4699,7 +4902,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then : $as_echo_n "(cached) " >&6 else -echo 'void f(){}' >conftest.c +echo 'void f(void){}' >conftest.c if test -z "`$CC $CPPFLAGS $CFLAGS -Werror -c conftest.c 2>&1`"; then eval "cv_prog_cc_flag_$cache=yes" else @@ -4730,7 +4933,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then : $as_echo_n "(cached) " >&6 else -echo 'void f(){}' >conftest.c +echo 'void f(void){}' >conftest.c if test -z "`$CC $CPPFLAGS $CFLAGS -Wall -c conftest.c 2>&1`"; then eval "cv_prog_cc_flag_$cache=yes" else @@ -4763,7 +4966,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then : $as_echo_n "(cached) " >&6 else -echo 'void f(){}' >conftest.c +echo 'void f(void){}' >conftest.c if test -z "`$CC $CPPFLAGS $CFLAGS -std=c99 -c conftest.c 2>&1`"; then eval "cv_prog_cc_flag_$cache=yes" else @@ -4794,7 +4997,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then : $as_echo_n "(cached) " >&6 else -echo 'void f(){}' >conftest.c +echo 'void f(void){}' >conftest.c if test -z "`$CC $CPPFLAGS $CFLAGS -xc99 -c conftest.c 2>&1`"; then eval "cv_prog_cc_flag_$cache=yes" else @@ -5461,7 +5664,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then : $as_echo_n "(cached) " >&6 else -echo 'void f(){}' >conftest.c +echo 'void f(void){}' >conftest.c if test -z "`$CC $CPPFLAGS $CFLAGS -W -c conftest.c 2>&1`"; then eval "cv_prog_cc_flag_$cache=yes" else @@ -5492,7 +5695,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then : $as_echo_n "(cached) " >&6 else -echo 'void f(){}' >conftest.c +echo 'void f(void){}' >conftest.c if test -z "`$CC $CPPFLAGS $CFLAGS -Wall -c conftest.c 2>&1`"; then eval "cv_prog_cc_flag_$cache=yes" else @@ -5523,7 +5726,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then : $as_echo_n "(cached) " >&6 else -echo 'void f(){}' >conftest.c +echo 'void f(void){}' >conftest.c if test -z "`$CC $CPPFLAGS $CFLAGS -Wextra -c conftest.c 2>&1`"; then eval "cv_prog_cc_flag_$cache=yes" else @@ -5554,7 +5757,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then : $as_echo_n "(cached) " >&6 else -echo 'void f(){}' >conftest.c +echo 'void f(void){}' >conftest.c if test -z "`$CC $CPPFLAGS $CFLAGS -Wdeclaration-after-statement -c conftest.c 2>&1`"; then eval "cv_prog_cc_flag_$cache=yes" else @@ -5584,11 +5787,19 @@ $as_echo "#define UNBOUND_DEBUG /**/" >>confdefs.h # nothing to do. ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -flto" >&5 + + # Check whether --enable-flto was given. +if test "${enable_flto+set}" = set; then : + enableval=$enable_flto; +fi + + if test "x$enable_flto" != "xno"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -flto" >&5 $as_echo_n "checking if $CC supports -flto... " >&6; } -BAKCFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -flto" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + BAKCFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -flto" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -5601,15 +5812,15 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : - if $CC $CFLAGS -o conftest conftest.c 2>&1 | grep "warning: no debug symbols in executable" >/dev/null; then - CFLAGS="$BAKCFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + if $CC $CFLAGS -o conftest conftest.c 2>&1 | grep "warning: no debug symbols in executable" >/dev/null; then + CFLAGS="$BAKCFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - fi - rm -f conftest conftest.c conftest.o + fi + rm -f conftest conftest.c conftest.o else CFLAGS="$BAKCFLAGS" ; { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 @@ -5618,6 +5829,8 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } @@ -13793,6 +14006,53 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of time_t" >&5 +$as_echo_n "checking size of time_t... " >&6; } +if ${ac_cv_sizeof_time_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (time_t))" "ac_cv_sizeof_time_t" " +$ac_includes_default +#ifdef TIME_WITH_SYS_TIME +# include +# include +#else +# ifdef HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif + +"; then : + +else + if test "$ac_cv_type_time_t" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (time_t) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_time_t=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_time_t" >&5 +$as_echo "$ac_cv_sizeof_time_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_TIME_T $ac_cv_sizeof_time_t +_ACEOF + + + # add option to disable the evil rpath # Check whether --enable-rpath was given. @@ -15002,14 +15262,13 @@ ub_have_pthreads=no if test x_$withval != x_no; then - ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -acx_pthread_ok=no +ax_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h # requires special compiler flags (e.g. on True64 or Sequent). @@ -15044,13 +15303,13 @@ return pthread_join (); } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - acx_pthread_ok=yes + ax_pthread_ok=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5 -$as_echo "$acx_pthread_ok" >&6; } - if test x"$acx_pthread_ok" = xno; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 +$as_echo "$ax_pthread_ok" >&6; } + if test x"$ax_pthread_ok" = xno; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi @@ -15068,7 +15327,7 @@ fi # which indicates that we try without any flags at all, and "pthread-config" # which is a program returning the flags for the Pth emulation library. -acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" +ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: @@ -15090,8 +15349,8 @@ acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -m # --thread-safe: KAI C++ # pthread-config: use pthread-config program (for GNU Pth library) -case "${host_cpu}-${host_os}" in - *solaris*) +case ${host_os} in + solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based @@ -15101,12 +15360,16 @@ case "${host_cpu}-${host_os}" in # who knows whether they'll stub that too in a future libc.) So, # we'll just look for -pthreads and -lpthread first: - acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags" + ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" + ;; + + darwin*) + ax_pthread_flags="-pthread $ax_pthread_flags" ;; esac -if test x"$acx_pthread_ok" = xno; then -for flag in $acx_pthread_flags; do +if test x"$ax_pthread_ok" = xno; then +for flag in $ax_pthread_flags; do case $flag in none) @@ -15120,16 +15383,16 @@ $as_echo_n "checking whether pthreads work with $flag... " >&6; } PTHREAD_CFLAGS="$flag" ;; - pthread-config) - # Extract the first word of "pthread-config", so it can be a program name with args. + pthread-config) + # Extract the first word of "pthread-config", so it can be a program name with args. set dummy pthread-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_acx_pthread_config+:} false; then : +if ${ac_cv_prog_ax_pthread_config+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$acx_pthread_config"; then - ac_cv_prog_acx_pthread_config="$acx_pthread_config" # Let the user override the test. + if test -n "$ax_pthread_config"; then + ac_cv_prog_ax_pthread_config="$ax_pthread_config" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -15138,7 +15401,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_acx_pthread_config="yes" + ac_cv_prog_ax_pthread_config="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -15146,23 +15409,23 @@ done done IFS=$as_save_IFS - test -z "$ac_cv_prog_acx_pthread_config" && ac_cv_prog_acx_pthread_config="no" + test -z "$ac_cv_prog_ax_pthread_config" && ac_cv_prog_ax_pthread_config="no" fi fi -acx_pthread_config=$ac_cv_prog_acx_pthread_config -if test -n "$acx_pthread_config"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_config" >&5 -$as_echo "$acx_pthread_config" >&6; } +ax_pthread_config=$ac_cv_prog_ax_pthread_config +if test -n "$ax_pthread_config"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_config" >&5 +$as_echo "$ax_pthread_config" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test x"$acx_pthread_config" = xno; then continue; fi - PTHREAD_CFLAGS="`pthread-config --cflags`" - PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" - ;; + if test x"$ax_pthread_config" = xno; then continue; fi + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag" >&5 @@ -15188,18 +15451,23 @@ $as_echo_n "checking for the pthreads library -l$flag... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include + static void routine(void *a) { *((int*)a) = 0; } + static void *start_routine(void *a) { return a; } int main () { -pthread_t th; pthread_join(th, 0); - pthread_attr_init(0); pthread_cleanup_push(0, 0); - pthread_create(0,0,0,0); pthread_cleanup_pop(0); +pthread_t th; pthread_attr_t attr; + pthread_create(&th, 0, start_routine, 0); + pthread_join(th, 0); + pthread_attr_init(&attr); + pthread_cleanup_push(routine, 0); + pthread_cleanup_pop(0) /* ; */ ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - acx_pthread_ok=yes + ax_pthread_ok=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext @@ -15207,9 +15475,9 @@ rm -f core conftest.err conftest.$ac_objext \ LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5 -$as_echo "$acx_pthread_ok" >&6; } - if test "x$acx_pthread_ok" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 +$as_echo "$ax_pthread_ok" >&6; } + if test "x$ax_pthread_ok" = xyes; then break; fi @@ -15219,24 +15487,24 @@ done fi # Various other checks: -if test "x$acx_pthread_ok" = xyes; then +if test "x$ax_pthread_ok" = xyes; then save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 $as_echo_n "checking for joinable pthread attribute... " >&6; } - attr_name=unknown - for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + attr_name=unknown + for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { -int attr=$attr; return attr; +int attr = $attr; return attr /* ; */ ; return 0; } @@ -15246,7 +15514,7 @@ if ac_fn_c_try_link "$LINENO"; then : fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - done + done { $as_echo "$as_me:${as_lineno-$LINENO}: result: $attr_name" >&5 $as_echo "$attr_name" >&6; } if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then @@ -15260,9 +15528,16 @@ _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking if more special flags are required for pthreads" >&5 $as_echo_n "checking if more special flags are required for pthreads... " >&6; } flag=no - case "${host_cpu}-${host_os}" in - *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; - *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; + case ${host_os} in + aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";; + osf* | hpux*) flag="-D_REENTRANT";; + solaris*) + if test "$GCC" = "yes"; then + flag="-D_REENTRANT" + else + flag="-mt -D_REENTRANT" + fi + ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${flag}" >&5 $as_echo "${flag}" >&6; } @@ -15270,12 +15545,58 @@ $as_echo "${flag}" >&6; } PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PRIO_INHERIT" >&5 +$as_echo_n "checking for PTHREAD_PRIO_INHERIT... " >&6; } +if ${ax_cv_PTHREAD_PRIO_INHERIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include +int +main () +{ +int i = PTHREAD_PRIO_INHERIT; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ax_cv_PTHREAD_PRIO_INHERIT=yes +else + ax_cv_PTHREAD_PRIO_INHERIT=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_PRIO_INHERIT" >&5 +$as_echo "$ax_cv_PTHREAD_PRIO_INHERIT" >&6; } + if test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"; then : + +$as_echo "#define HAVE_PTHREAD_PRIO_INHERIT 1" >>confdefs.h + +fi + LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" - # More AIX lossage: must compile with xlc_r or cc_r - if test x"$GCC" != xyes; then - for ac_prog in xlc_r cc_r + # More AIX lossage: compile with *_r variant + if test "x$GCC" != xyes; then + case $host_os in + aix*) + case "x/$CC" in #( + x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6) : + #handle absolute path differently from PATH based program lookup + case "x$CC" in #( + x/*) : + if as_fn_executable_p ${CC}_r; then : + PTHREAD_CC="${CC}_r" +fi ;; #( + *) : + for ac_prog in ${CC}_r do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 @@ -15316,21 +15637,25 @@ fi test -n "$PTHREAD_CC" && break done -test -n "$PTHREAD_CC" || PTHREAD_CC="${CC}" - - else - PTHREAD_CC=$CC - fi -else - PTHREAD_CC="$CC" +test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" + ;; +esac ;; #( + *) : + ;; +esac + ;; + esac + fi fi +test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" + # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x"$acx_pthread_ok" = xyes; then +if test x"$ax_pthread_ok" = xyes; then $as_echo "#define HAVE_PTHREAD 1" >>confdefs.h @@ -15363,7 +15688,7 @@ fi : else - acx_pthread_ok=no + ax_pthread_ok=no fi ac_ext=c @@ -15457,7 +15782,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then : $as_echo_n "(cached) " >&6 else -echo 'void f(){}' >conftest.c +echo 'void f(void){}' >conftest.c if test -z "`$CC $CPPFLAGS $CFLAGS -mt -c conftest.c 2>&1`"; then eval "cv_prog_cc_flag_$cache=yes" else @@ -16570,7 +16895,7 @@ else #include #include #include -/* routine to load gost from ldns */ +/* routine to load gost (from sldns) */ int load_gost_id(void) { static int gost_id = 0; @@ -16760,6 +17085,20 @@ _ACEOF ;; esac +# Check whether --enable-event-api was given. +if test "${enable_event_api+set}" = set; then : + enableval=$enable_event_api; +fi + +use_unbound_event="no" +case "$enable_event_api" in + yes) + use_unbound_event="yes" + ;; + *) + ;; +esac + # check for libevent # Check whether --with-libevent was given. @@ -16777,7 +17116,7 @@ $as_echo_n "checking for libevent... " >&6; } fi for dir in $withval; do thedir="$dir" - if test -f "$dir/include/event.h"; then + if test -f "$dir/include/event.h" -o -f "$dir/include/event2/event.h"; then found_libevent="yes" if test "$thedir" != "/usr"; then CPPFLAGS="$CPPFLAGS -I$thedir/include" @@ -16814,8 +17153,18 @@ large outgoing port ranges. " "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in $thedir" >&5 $as_echo "found in $thedir" >&6; } - if test "$thedir" != "/usr" -a "$thedir" != ""; then - LDFLAGS="$LDFLAGS -L$thedir/lib" + if test ! -f $thedir/lib/libevent.a -a ! -f $thedir/lib/libevent.so -a -d "$thedir/lib/event2"; then + LDFLAGS="$LDFLAGS -L$thedir/lib/event2" + + if test "x$enable_rpath" = xyes; then + if echo "$thedir/lib/event2" | grep "^/" >/dev/null; then + RUNTIME_PATH="$RUNTIME_PATH -R$thedir/lib/event2" + fi + fi + + else + if test "$thedir" != "/usr" -a "$thedir" != ""; then + LDFLAGS="$LDFLAGS -L$thedir/lib" if test "x$enable_rpath" = xyes; then if echo "$thedir/lib" | grep "^/" >/dev/null; then @@ -16823,6 +17172,7 @@ $as_echo "found in $thedir" >&6; } fi fi + fi fi fi # check for library used by libevent after 1.3c @@ -17090,6 +17440,12 @@ done if test -n "$BAK_LDFLAGS_SET"; then LDFLAGS="$BAK_LDFLAGS" fi + if test "$use_unbound_event" = "yes"; then + UNBOUND_EVENT_INSTALL=unbound-event-install + + UNBOUND_EVENT_UNINSTALL=unbound-event-uninstall + + fi else $as_echo "#define USE_MINI_EVENT 1" >>confdefs.h @@ -17577,7 +17933,7 @@ if test "$ac_res" != no; then : fi -for ac_func in tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex +for ac_func in tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex endservent endprotoent do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -17698,6 +18054,20 @@ esac fi +ac_fn_c_check_func "$LINENO" "strlcat" "ac_cv_func_strlcat" +if test "x$ac_cv_func_strlcat" = xyes; then : + $as_echo "#define HAVE_STRLCAT 1" >>confdefs.h + +else + case " $LIBOBJS " in + *" strlcat.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strlcat.$ac_objext" + ;; +esac + +fi + + ac_fn_c_check_func "$LINENO" "strlcpy" "ac_cv_func_strlcpy" if test "x$ac_cv_func_strlcpy" = xyes; then : $as_echo "#define HAVE_STRLCPY 1" >>confdefs.h @@ -17835,204 +18205,20 @@ rm -f conftest.lo # see if we want to build the library or everything ALLTARGET="alltargets" +INSTALLTARGET="install-all" # Check whether --with-libunbound-only was given. if test "${with_libunbound_only+set}" = set; then : withval=$with_libunbound_only; if test "$withval" = "yes"; then ALLTARGET="lib" + INSTALLTARGET="install-lib" fi fi -# check this after all other compilation checks, since the linking of the lib -# may break checks after this. - -# Check whether --with-ldns was given. -if test "${with_ldns+set}" = set; then : - withval=$with_ldns; - if test "$withval" != "yes"; then - if test "$withval" != "/usr" -a "$withval" != ""; then - CPPFLAGS="-I$withval/include $CPPFLAGS" - LDFLAGS="-L$withval/lib $LDFLAGS" - - if test "x$enable_rpath" = xyes; then - if echo "$withval/lib" | grep "^/" >/dev/null; then - RUNTIME_PATH="$RUNTIME_PATH -R$withval/lib" - fi - fi - - fi - ldnsdir="$withval" - - fi - -fi - - -# check if ldns is good enough -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldns_rr_new in -lldns" >&5 -$as_echo_n "checking for ldns_rr_new in -lldns... " >&6; } -if ${ac_cv_lib_ldns_ldns_rr_new+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lldns $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char ldns_rr_new (); -int -main () -{ -return ldns_rr_new (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_ldns_ldns_rr_new=yes -else - ac_cv_lib_ldns_ldns_rr_new=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldns_ldns_rr_new" >&5 -$as_echo "$ac_cv_lib_ldns_ldns_rr_new" >&6; } -if test "x$ac_cv_lib_ldns_ldns_rr_new" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBLDNS 1 -_ACEOF - - LIBS="-lldns $LIBS" - -else - - as_fn_error $? "No ldns library found, install the ldns library into system lib dir or use --with-ldns=path to other location. The --with-ldns can point to the make-dir of ldns. Install the package ldns or download source http://www.nlnetlabs.nl/projects/ldns" "$LINENO" 5 - -fi - -ac_fn_c_check_func "$LINENO" "ldns_buffer_copy" "ac_cv_func_ldns_buffer_copy" -if test "x$ac_cv_func_ldns_buffer_copy" = xyes; then : - -fi - -if test $USE_NSS = "no"; then - ac_fn_c_check_func "$LINENO" "ldns_key_buf2rsa_raw" "ac_cv_func_ldns_key_buf2rsa_raw" -if test "x$ac_cv_func_ldns_key_buf2rsa_raw" = xyes; then : - -fi - -else - ac_cv_func_ldns_key_buf2rsa_raw="yes" -fi -ac_fn_c_check_func "$LINENO" "ldns_get_random" "ac_cv_func_ldns_get_random" -if test "x$ac_cv_func_ldns_get_random" = xyes; then : - -fi - -ac_fn_c_check_func "$LINENO" "ldns_b32_ntop_extended_hex" "ac_cv_func_ldns_b32_ntop_extended_hex" -if test "x$ac_cv_func_ldns_b32_ntop_extended_hex" = xyes; then : - -fi - -if test x$use_gost = xyes -a x$USE_NSS = xno; then - ac_fn_c_check_func "$LINENO" "ldns_key_EVP_load_gost_id" "ac_cv_func_ldns_key_EVP_load_gost_id" -if test "x$ac_cv_func_ldns_key_EVP_load_gost_id" = xyes; then : - -fi - - for ac_func in ldns_key_EVP_unload_gost -do : - ac_fn_c_check_func "$LINENO" "ldns_key_EVP_unload_gost" "ac_cv_func_ldns_key_EVP_unload_gost" -if test "x$ac_cv_func_ldns_key_EVP_unload_gost" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LDNS_KEY_EVP_UNLOAD_GOST 1 -_ACEOF - -fi -done - -else - ac_cv_func_ldns_key_EVP_load_gost_id="yes" -fi -if test x$use_ecdsa = xyes; then - ac_fn_c_check_decl "$LINENO" "LDNS_ECDSAP384SHA384" "ac_cv_have_decl_LDNS_ECDSAP384SHA384" " -$ac_includes_default -#ifdef HAVE_SYS_SOCKET_H -# include -#endif -#ifdef HAVE_WS2TCPIP_H -# include -#endif -#include - -" -if test "x$ac_cv_have_decl_LDNS_ECDSAP384SHA384" = xyes; then : - -fi - -else - ac_cv_have_decl_LDNS_ECDSAP384SHA384="yes" -fi -for ac_header in ldns/ldns.h -do : - ac_fn_c_check_header_compile "$LINENO" "ldns/ldns.h" "ac_cv_header_ldns_ldns_h" "$ac_includes_default -#ifdef HAVE_SYS_SOCKET_H -#include -#endif - -#ifdef HAVE_NETINET_IN_H -#include -#endif - -#ifdef HAVE_ARPA_INET_H -#include -#endif - -#ifdef HAVE_WINSOCK2_H -#include -#endif - -#ifdef HAVE_WS2TCPIP_H -#include -#endif - -" -if test "x$ac_cv_header_ldns_ldns_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LDNS_LDNS_H 1 -_ACEOF - -else - - as_fn_error $? "No ldns include file found, install the ldns library development files. Install package ldns-dev or ldns-devel or download source http://www.nlnetlabs.nl/projects/ldns" "$LINENO" 5 - -fi - -done - -if test $ac_cv_func_ldns_buffer_copy = yes \ - -a $ac_cv_func_ldns_key_buf2rsa_raw = yes \ - -a $ac_cv_func_ldns_get_random = yes \ - -a $ac_cv_header_ldns_ldns_h = yes \ - -a $ac_cv_func_ldns_b32_ntop_extended_hex = yes \ - -a $ac_cv_func_ldns_key_EVP_load_gost_id = yes \ - -a $ac_cv_have_decl_LDNS_ECDSAP384SHA384 = yes; then - : -else - as_fn_error $? "ldns library is not recent, update the ldns library, install it into system lib dir or use --with-ldns=path to other location. The --with-ldns can point to the make-dir of ldns. Package libldns or download source http://www.nlnetlabs.nl/projects/ldns" "$LINENO" 5 -fi { $as_echo "$as_me:${as_lineno-$LINENO}: Stripping extension flags..." >&5 @@ -18622,7 +18808,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by unbound $as_me 1.4.20, which was +This file was extended by unbound $as_me 1.4.22, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -18688,7 +18874,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -unbound config.status 1.4.20 +unbound config.status 1.4.22 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/contrib/unbound/configure.ac b/contrib/unbound/configure.ac index 180b9d7e3b6..5eaab7541da 100644 --- a/contrib/unbound/configure.ac +++ b/contrib/unbound/configure.ac @@ -2,15 +2,22 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.56) sinclude(acx_nlnetlabs.m4) -sinclude(acx_pthread.m4) +sinclude(ax_pthread.m4) sinclude(acx_python.m4) sinclude(ac_pkg_swig.m4) -AC_INIT(unbound, 1.4.20, unbound-bugs@nlnetlabs.nl, unbound) +# must be numbers. ac_defun because of later processing +m4_define([VERSION_MAJOR],[1]) +m4_define([VERSION_MINOR],[4]) +m4_define([VERSION_MICRO],[22]) +AC_INIT(unbound, m4_defn([VERSION_MAJOR]).m4_defn([VERSION_MINOR]).m4_defn([VERSION_MICRO]), unbound-bugs@nlnetlabs.nl, unbound) +AC_SUBST(UNBOUND_VERSION_MAJOR, [VERSION_MAJOR]) +AC_SUBST(UNBOUND_VERSION_MINOR, [VERSION_MINOR]) +AC_SUBST(UNBOUND_VERSION_MICRO, [VERSION_MICRO]) -LIBUNBOUND_CURRENT=3 -LIBUNBOUND_REVISION=5 -LIBUNBOUND_AGE=1 +LIBUNBOUND_CURRENT=4 +LIBUNBOUND_REVISION=1 +LIBUNBOUND_AGE=2 # 1.0.0 had 0:12:0 # 1.0.1 had 0:13:0 # 1.0.2 had 0:14:0 @@ -45,7 +52,8 @@ LIBUNBOUND_AGE=1 # 1.4.17 had 3:2:1 # 1.4.18 had 3:3:1 # 1.4.19 had 3:4:1 -# 1.4.20 had 4:0:2 # adds libunbound.ttl +# 1.4.20 had 4:0:2 # adds libunbound.ttl # but shipped 3:5:1 +# 1.4.21 had 4:1:2 # Current -- the number of the binary API that we're implementing # Revision -- which iteration of the implementation of the binary @@ -71,6 +79,9 @@ AC_SUBST(LIBUNBOUND_AGE) CFLAGS="$CFLAGS" AC_AIX +if test "$ac_cv_header_minix_config_h" = "yes"; then + AC_DEFINE(_NETBSD_SOURCE,1, [Enable for compile on Minix]) +fi dnl dnl By default set prefix to /usr/local @@ -275,6 +286,20 @@ ACX_TYPE_IN_ADDR_T ACX_TYPE_IN_PORT_T ACX_CHECK_MEMCMP_SIGNED +AC_CHECK_SIZEOF(time_t,,[ +AC_INCLUDES_DEFAULT +#ifdef TIME_WITH_SYS_TIME +# include +# include +#else +# ifdef HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif +]) + # add option to disable the evil rpath ACX_ARG_RPATH AC_SUBST(RUNTIME_PATH) @@ -371,7 +396,7 @@ AC_ARG_WITH(pthreads, AC_HELP_STRING([--with-pthreads], [ ],[ withval="yes" ]) ub_have_pthreads=no if test x_$withval != x_no; then - ACX_PTHREAD([ + AX_PTHREAD([ AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]) LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" @@ -579,7 +604,7 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include #include -/* routine to load gost from ldns */ +/* routine to load gost (from sldns) */ int load_gost_id(void) { static int gost_id = 0; @@ -707,6 +732,16 @@ case "$enable_ecdsa" in ;; esac +AC_ARG_ENABLE(event-api, AC_HELP_STRING([--enable-event-api], [Enable (experimental) libevent-based libunbound API installed to unbound-event.h])) +use_unbound_event="no" +case "$enable_event_api" in + yes) + use_unbound_event="yes" + ;; + *) + ;; +esac + # check for libevent AC_ARG_WITH(libevent, AC_HELP_STRING([--with-libevent=pathname], [use libevent (will check /usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr or you can specify an explicit path). Slower, but allows use of large outgoing port ranges.]), @@ -718,7 +753,7 @@ if test x_$withval = x_yes -o x_$withval != x_no; then fi for dir in $withval; do thedir="$dir" - if test -f "$dir/include/event.h"; then + if test -f "$dir/include/event.h" -o -f "$dir/include/event2/event.h"; then found_libevent="yes" dnl assume /usr is in default path. if test "$thedir" != "/usr"; then @@ -754,10 +789,16 @@ large outgoing port ranges. ]) fi else AC_MSG_RESULT(found in $thedir) - dnl assume /usr is in default path, do not add "". - if test "$thedir" != "/usr" -a "$thedir" != ""; then - LDFLAGS="$LDFLAGS -L$thedir/lib" - ACX_RUNTIME_PATH_ADD([$thedir/lib]) + dnl if event2 exists and no event lib in dir itself, use subdir + if test ! -f $thedir/lib/libevent.a -a ! -f $thedir/lib/libevent.so -a -d "$thedir/lib/event2"; then + LDFLAGS="$LDFLAGS -L$thedir/lib/event2" + ACX_RUNTIME_PATH_ADD([$thedir/lib/event2]) + else + dnl assume /usr is in default path, do not add "". + if test "$thedir" != "/usr" -a "$thedir" != ""; then + LDFLAGS="$LDFLAGS -L$thedir/lib" + ACX_RUNTIME_PATH_ADD([$thedir/lib]) + fi fi fi # check for library used by libevent after 1.3c @@ -781,6 +822,10 @@ large outgoing port ranges. ]) if test -n "$BAK_LDFLAGS_SET"; then LDFLAGS="$BAK_LDFLAGS" fi + if test "$use_unbound_event" = "yes"; then + AC_SUBST(UNBOUND_EVENT_INSTALL, [unbound-event-install]) + AC_SUBST(UNBOUND_EVENT_UNINSTALL, [unbound-event-uninstall]) + fi else AC_DEFINE(USE_MINI_EVENT, 1, [Define if you want to use internal select based events]) fi @@ -812,7 +857,7 @@ AC_CHECK_HEADERS([expat.h],,, [AC_INCLUDES_DEFAULT]) AC_SUBST(staticexe) staticexe="" AC_ARG_ENABLE(static-exe, AC_HELP_STRING([--enable-static-exe], - [ enable to compile executables statically against event, ldns libs, for debug purposes ]), + [ enable to compile executables statically against (event) libs, for debug purposes ]), , ) if test x_$enable_static_exe = x_yes; then staticexe="-static" @@ -905,7 +950,7 @@ AC_INCLUDES_DEFAULT #endif ]) AC_SEARCH_LIBS([setusercontext], [util]) -AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex]) +AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex endservent endprotoent]) AC_CHECK_FUNCS([setresuid],,[AC_CHECK_FUNCS([setreuid])]) AC_CHECK_FUNCS([setresgid],,[AC_CHECK_FUNCS([setregid])]) @@ -917,6 +962,7 @@ AC_REPLACE_FUNCS(inet_aton) AC_REPLACE_FUNCS(inet_pton) AC_REPLACE_FUNCS(inet_ntop) AC_REPLACE_FUNCS(snprintf) +AC_REPLACE_FUNCS(strlcat) AC_REPLACE_FUNCS(strlcpy) AC_REPLACE_FUNCS(memmove) AC_REPLACE_FUNCS(gmtime_r) @@ -993,100 +1039,17 @@ AC_SUBST(SOURCEFILE) # see if we want to build the library or everything ALLTARGET="alltargets" +INSTALLTARGET="install-all" AC_ARG_WITH(libunbound-only, AC_HELP_STRING([--with-libunbound-only], [do not build daemon and tool programs]), [ if test "$withval" = "yes"; then ALLTARGET="lib" + INSTALLTARGET="install-lib" fi ]) AC_SUBST(ALLTARGET) - -# check this after all other compilation checks, since the linking of the lib -# may break checks after this. -AC_ARG_WITH(ldns, AC_HELP_STRING([--with-ldns=PATH], - [specify prefix of path of ldns library to use]), - [ - if test "$withval" != "yes"; then - if test "$withval" != "/usr" -a "$withval" != ""; then - CPPFLAGS="-I$withval/include $CPPFLAGS" - LDFLAGS="-L$withval/lib $LDFLAGS" - ACX_RUNTIME_PATH_ADD([$withval/lib]) - fi - ldnsdir="$withval" - AC_SUBST(ldnsdir) - fi -]) - -# check if ldns is good enough -AC_CHECK_LIB(ldns, ldns_rr_new,,[ - AC_MSG_ERROR([No ldns library found, install the ldns library into system lib dir or use --with-ldns=path to other location. The --with-ldns can point to the make-dir of ldns. Install the package ldns or download source http://www.nlnetlabs.nl/projects/ldns]) -]) -AC_CHECK_FUNC(ldns_buffer_copy) -if test $USE_NSS = "no"; then - AC_CHECK_FUNC(ldns_key_buf2rsa_raw) -else - dnl ignore test - ac_cv_func_ldns_key_buf2rsa_raw="yes" -fi -AC_CHECK_FUNC(ldns_get_random) -AC_CHECK_FUNC(ldns_b32_ntop_extended_hex) -if test x$use_gost = xyes -a x$USE_NSS = xno; then - AC_CHECK_FUNC(ldns_key_EVP_load_gost_id) - AC_CHECK_FUNCS([ldns_key_EVP_unload_gost]) -else - dnl ignore test - ac_cv_func_ldns_key_EVP_load_gost_id="yes" -fi -if test x$use_ecdsa = xyes; then - AC_CHECK_DECL([LDNS_ECDSAP384SHA384], [], [], [ -AC_INCLUDES_DEFAULT -#ifdef HAVE_SYS_SOCKET_H -# include -#endif -#ifdef HAVE_WS2TCPIP_H -# include -#endif -#include - ]) -else - ac_cv_have_decl_LDNS_ECDSAP384SHA384="yes" -fi -AC_CHECK_HEADERS([ldns/ldns.h],,[ - AC_MSG_ERROR([No ldns include file found, install the ldns library development files. Install package ldns-dev or ldns-devel or download source http://www.nlnetlabs.nl/projects/ldns]) - ], [AC_INCLUDES_DEFAULT -#ifdef HAVE_SYS_SOCKET_H -#include -#endif - -#ifdef HAVE_NETINET_IN_H -#include -#endif - -#ifdef HAVE_ARPA_INET_H -#include -#endif - -#ifdef HAVE_WINSOCK2_H -#include -#endif - -#ifdef HAVE_WS2TCPIP_H -#include -#endif -]) -if test $ac_cv_func_ldns_buffer_copy = yes \ - -a $ac_cv_func_ldns_key_buf2rsa_raw = yes \ - -a $ac_cv_func_ldns_get_random = yes \ - -a $ac_cv_header_ldns_ldns_h = yes \ - -a $ac_cv_func_ldns_b32_ntop_extended_hex = yes \ - -a $ac_cv_func_ldns_key_EVP_load_gost_id = yes \ - -a $ac_cv_have_decl_LDNS_ECDSAP384SHA384 = yes; then - dnl ldns was found - : -else - AC_MSG_ERROR([ldns library is not recent, update the ldns library, install it into system lib dir or use --with-ldns=path to other location. The --with-ldns can point to the make-dir of ldns. Package libldns or download source http://www.nlnetlabs.nl/projects/ldns]) -fi +AC_SUBST(INSTALLTARGET) ACX_STRIP_EXT_FLAGS LDFLAGS="$LATE_LDFLAGS $LDFLAGS" @@ -1103,6 +1066,12 @@ dnl includes # define NDEBUG #endif +/** Use small-ldns codebase */ +#define USE_SLDNS 1 +#ifdef HAVE_SSL +# define LDNS_BUILD_CONFIG_HAVE_SSL 1 +#endif + #include #include #include @@ -1113,6 +1082,10 @@ dnl includes #include #endif +#ifdef HAVE_STDARG_H +#include +#endif + #ifdef HAVE_STDINT_H #include #endif @@ -1146,6 +1119,12 @@ dnl includes #ifdef HAVE_WS2TCPIP_H #include #endif + +#ifndef USE_WINSOCK +#define ARG_LL "%ll" +#else +#define ARG_LL "%I64" +#endif ] AHX_CONFIG_FORMAT_ATTRIBUTE @@ -1157,6 +1136,7 @@ AHX_CONFIG_INET_PTON(unbound) AHX_CONFIG_INET_NTOP(unbound) AHX_CONFIG_INET_ATON(unbound) AHX_CONFIG_MEMMOVE(unbound) +AHX_CONFIG_STRLCAT(unbound) AHX_CONFIG_STRLCPY(unbound) AHX_CONFIG_GMTIME_R(unbound) AHX_CONFIG_W32_SLEEP @@ -1193,8 +1173,6 @@ char *strptime(const char *s, const char *format, struct tm *tm); # endif #endif /* CHECKED_INET6 */ -/* maximum nesting of included files */ -#define MAXINCLUDES 10 #ifndef HAVE_GETADDRINFO struct sockaddr_storage; #include "compat/fake-rfc2553.h" diff --git a/contrib/unbound/daemon/acl_list.c b/contrib/unbound/daemon/acl_list.c index 48c8e0fe4db..84d099ca509 100644 --- a/contrib/unbound/daemon/acl_list.c +++ b/contrib/unbound/daemon/acl_list.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -103,6 +103,10 @@ acl_list_str_cfg(struct acl_list* acl, const char* str, const char* s2, control = acl_deny; else if(strcmp(s2, "refuse") == 0) control = acl_refuse; + else if(strcmp(s2, "deny_non_local") == 0) + control = acl_deny_non_local; + else if(strcmp(s2, "refuse_non_local") == 0) + control = acl_refuse_non_local; else if(strcmp(s2, "allow_snoop") == 0) control = acl_allow_snoop; else { diff --git a/contrib/unbound/daemon/acl_list.h b/contrib/unbound/daemon/acl_list.h index 03ac301bf32..2323697d5b8 100644 --- a/contrib/unbound/daemon/acl_list.h +++ b/contrib/unbound/daemon/acl_list.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -55,6 +55,10 @@ enum acl_access { acl_deny = 0, /** disallow access, send a polite 'REFUSED' reply */ acl_refuse, + /** disallow any access to zones that aren't local, drop it */ + acl_deny_non_local, + /** disallow access to zones that aren't local, 'REFUSED' reply */ + acl_refuse_non_local, /** allow full access for recursion (+RD) queries */ acl_allow, /** allow full access for all queries, recursion and cache snooping */ diff --git a/contrib/unbound/daemon/cachedump.c b/contrib/unbound/daemon/cachedump.c index 9d941d7171f..cf5b1a12c9a 100644 --- a/contrib/unbound/daemon/cachedump.c +++ b/contrib/unbound/daemon/cachedump.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -40,7 +40,7 @@ * to text format. */ #include "config.h" -#include +#include #include "daemon/cachedump.h" #include "daemon/remote.h" #include "daemon/worker.h" @@ -56,70 +56,25 @@ #include "iterator/iter_utils.h" #include "iterator/iter_fwd.h" #include "iterator/iter_hints.h" - -/** convert to ldns rr */ -static ldns_rr* -to_rr(struct ub_packed_rrset_key* k, struct packed_rrset_data* d, - uint32_t now, size_t i, uint16_t type) -{ - ldns_rr* rr = ldns_rr_new(); - ldns_rdf* rdf; - ldns_status status; - size_t pos; - log_assert(i < d->count + d->rrsig_count); - if(!rr) { - return NULL; - } - ldns_rr_set_type(rr, type); - ldns_rr_set_class(rr, ntohs(k->rk.rrset_class)); - if(d->rr_ttl[i] < now) - ldns_rr_set_ttl(rr, 0); - else ldns_rr_set_ttl(rr, d->rr_ttl[i] - now); - pos = 0; - status = ldns_wire2dname(&rdf, k->rk.dname, k->rk.dname_len, &pos); - if(status != LDNS_STATUS_OK) { - /* we drop detailed error in status */ - ldns_rr_free(rr); - return NULL; - } - ldns_rr_set_owner(rr, rdf); - pos = 0; - status = ldns_wire2rdf(rr, d->rr_data[i], d->rr_len[i], &pos); - if(status != LDNS_STATUS_OK) { - /* we drop detailed error in status */ - ldns_rr_free(rr); - return NULL; - } - return rr; -} +#include "ldns/sbuffer.h" +#include "ldns/wire2str.h" +#include "ldns/str2wire.h" /** dump one rrset zonefile line */ static int -dump_rrset_line(SSL* ssl, struct ub_packed_rrset_key* k, - struct packed_rrset_data* d, uint32_t now, size_t i, uint16_t type) +dump_rrset_line(SSL* ssl, struct ub_packed_rrset_key* k, time_t now, size_t i) { - char* s; - ldns_rr* rr = to_rr(k, d, now, i, type); - if(!rr) { + char s[65535]; + if(!packed_rr_to_string(k, i, now, s, sizeof(s))) { return ssl_printf(ssl, "BADRR\n"); } - s = ldns_rr2str(rr); - ldns_rr_free(rr); - if(!s) { - return ssl_printf(ssl, "BADRR\n"); - } - if(!ssl_printf(ssl, "%s", s)) { - free(s); - return 0; - } - free(s); - return 1; + return ssl_printf(ssl, "%s", s); } /** dump rrset key and data info */ static int dump_rrset(SSL* ssl, struct ub_packed_rrset_key* k, - struct packed_rrset_data* d, uint32_t now) + struct packed_rrset_data* d, time_t now) { size_t i; /* rd lock held by caller */ @@ -127,29 +82,23 @@ dump_rrset(SSL* ssl, struct ub_packed_rrset_key* k, if(d->ttl < now) return 1; /* expired */ /* meta line */ - if(!ssl_printf(ssl, ";rrset%s %u %u %u %d %d\n", + if(!ssl_printf(ssl, ";rrset%s " ARG_LL "d %u %u %d %d\n", (k->rk.flags & PACKED_RRSET_NSEC_AT_APEX)?" nsec_apex":"", - (unsigned)(d->ttl - now), + (long long)(d->ttl - now), (unsigned)d->count, (unsigned)d->rrsig_count, (int)d->trust, (int)d->security )) return 0; - for(i=0; icount; i++) { - if(!dump_rrset_line(ssl, k, d, now, i, ntohs(k->rk.type))) + for(i=0; icount + d->rrsig_count; i++) { + if(!dump_rrset_line(ssl, k, now, i)) return 0; } - for(i=0; irrsig_count; i++) { - if(!dump_rrset_line(ssl, k, d, now, i+d->count, - LDNS_RR_TYPE_RRSIG)) - return 0; - } - return 1; } /** dump lruhash rrset cache */ static int -dump_rrset_lruhash(SSL* ssl, struct lruhash* h, uint32_t now) +dump_rrset_lruhash(SSL* ssl, struct lruhash* h, time_t now) { struct lruhash_entry* e; /* lruhash already locked by caller */ @@ -189,20 +138,10 @@ dump_rrset_cache(SSL* ssl, struct worker* worker) static int dump_msg_ref(SSL* ssl, struct ub_packed_rrset_key* k) { - ldns_rdf* rdf; - ldns_status status; - size_t pos; char* nm, *tp, *cl; - - pos = 0; - status = ldns_wire2dname(&rdf, k->rk.dname, k->rk.dname_len, &pos); - if(status != LDNS_STATUS_OK) { - return ssl_printf(ssl, "BADREF\n"); - } - nm = ldns_rdf2str(rdf); - ldns_rdf_deep_free(rdf); - tp = ldns_rr_type2str(ntohs(k->rk.type)); - cl = ldns_rr_class2str(ntohs(k->rk.rrset_class)); + nm = sldns_wire2str_dname(k->rk.dname, k->rk.dname_len); + tp = sldns_wire2str_type(ntohs(k->rk.type)); + cl = sldns_wire2str_class(ntohs(k->rk.rrset_class)); if(!nm || !cl || !tp) { free(nm); free(tp); @@ -225,25 +164,16 @@ dump_msg_ref(SSL* ssl, struct ub_packed_rrset_key* k) /** dump message entry */ static int dump_msg(SSL* ssl, struct query_info* k, struct reply_info* d, - uint32_t now) + time_t now) { size_t i; char* nm, *tp, *cl; - ldns_rdf* rdf; - ldns_status status; - size_t pos; if(!k || !d) return 1; if(d->ttl < now) return 1; /* expired */ - pos = 0; - status = ldns_wire2dname(&rdf, k->qname, k->qname_len, &pos); - if(status != LDNS_STATUS_OK) { - return 1; /* skip this entry */ - } - nm = ldns_rdf2str(rdf); - ldns_rdf_deep_free(rdf); - tp = ldns_rr_type2str(k->qtype); - cl = ldns_rr_class2str(k->qclass); + nm = sldns_wire2str_dname(k->qname, k->qname_len); + tp = sldns_wire2str_type(k->qtype); + cl = sldns_wire2str_class(k->qclass); if(!nm || !tp || !cl) { free(nm); free(tp); @@ -259,10 +189,10 @@ dump_msg(SSL* ssl, struct query_info* k, struct reply_info* d, } /* meta line */ - if(!ssl_printf(ssl, "msg %s %s %s %d %d %u %d %u %u %u\n", + if(!ssl_printf(ssl, "msg %s %s %s %d %d " ARG_LL "d %d %u %u %u\n", nm, cl, tp, (int)d->flags, (int)d->qdcount, - (unsigned)(d->ttl-now), (int)d->security, + (long long)(d->ttl-now), (int)d->security, (unsigned)d->an_numrrsets, (unsigned)d->ns_numrrsets, (unsigned)d->ar_numrrsets)) { @@ -369,96 +299,74 @@ dump_cache(SSL* ssl, struct worker* worker) /** read a line from ssl into buffer */ static int -ssl_read_buf(SSL* ssl, ldns_buffer* buf) +ssl_read_buf(SSL* ssl, sldns_buffer* buf) { - return ssl_read_line(ssl, (char*)ldns_buffer_begin(buf), - ldns_buffer_capacity(buf)); + return ssl_read_line(ssl, (char*)sldns_buffer_begin(buf), + sldns_buffer_capacity(buf)); } /** check fixed text on line */ static int -read_fixed(SSL* ssl, ldns_buffer* buf, const char* str) +read_fixed(SSL* ssl, sldns_buffer* buf, const char* str) { if(!ssl_read_buf(ssl, buf)) return 0; - return (strcmp((char*)ldns_buffer_begin(buf), str) == 0); + return (strcmp((char*)sldns_buffer_begin(buf), str) == 0); } /** load an RR into rrset */ static int -load_rr(SSL* ssl, ldns_buffer* buf, struct regional* region, +load_rr(SSL* ssl, sldns_buffer* buf, struct regional* region, struct ub_packed_rrset_key* rk, struct packed_rrset_data* d, - unsigned int i, int is_rrsig, int* go_on, uint32_t now) + unsigned int i, int is_rrsig, int* go_on, time_t now) { - ldns_rr* rr; - ldns_status status; + uint8_t rr[LDNS_RR_BUF_SIZE]; + size_t rr_len = sizeof(rr), dname_len = 0; + int status; /* read the line */ if(!ssl_read_buf(ssl, buf)) return 0; - if(strncmp((char*)ldns_buffer_begin(buf), "BADRR\n", 6) == 0) { + if(strncmp((char*)sldns_buffer_begin(buf), "BADRR\n", 6) == 0) { *go_on = 0; return 1; } - status = ldns_rr_new_frm_str(&rr, (char*)ldns_buffer_begin(buf), - LDNS_DEFAULT_TTL, NULL, NULL); - if(status != LDNS_STATUS_OK) { + status = sldns_str2wire_rr_buf((char*)sldns_buffer_begin(buf), rr, + &rr_len, &dname_len, 3600, NULL, 0, NULL, 0); + if(status != 0) { log_warn("error cannot parse rr: %s: %s", - ldns_get_errorstr_by_id(status), - (char*)ldns_buffer_begin(buf)); + sldns_get_errorstr_parse(status), + (char*)sldns_buffer_begin(buf)); return 0; } - if(is_rrsig && ldns_rr_get_type(rr) != LDNS_RR_TYPE_RRSIG) { + if(is_rrsig && sldns_wirerr_get_type(rr, rr_len, dname_len) + != LDNS_RR_TYPE_RRSIG) { log_warn("error expected rrsig but got %s", - (char*)ldns_buffer_begin(buf)); + (char*)sldns_buffer_begin(buf)); return 0; } /* convert ldns rr into packed_rr */ - d->rr_ttl[i] = ldns_rr_ttl(rr) + now; - ldns_buffer_clear(buf); - ldns_buffer_skip(buf, 2); - status = ldns_rr_rdata2buffer_wire(buf, rr); - if(status != LDNS_STATUS_OK) { - log_warn("error cannot rr2wire: %s", - ldns_get_errorstr_by_id(status)); - ldns_rr_free(rr); - return 0; - } - ldns_buffer_flip(buf); - ldns_buffer_write_u16_at(buf, 0, ldns_buffer_limit(buf) - 2); - - d->rr_len[i] = ldns_buffer_limit(buf); + d->rr_ttl[i] = (time_t)sldns_wirerr_get_ttl(rr, rr_len, dname_len) + now; + sldns_buffer_clear(buf); + d->rr_len[i] = sldns_wirerr_get_rdatalen(rr, rr_len, dname_len)+2; d->rr_data[i] = (uint8_t*)regional_alloc_init(region, - ldns_buffer_begin(buf), ldns_buffer_limit(buf)); + sldns_wirerr_get_rdatawl(rr, rr_len, dname_len), d->rr_len[i]); if(!d->rr_data[i]) { - ldns_rr_free(rr); log_warn("error out of memory"); return 0; } /* if first entry, fill the key structure */ if(i==0) { - rk->rk.type = htons(ldns_rr_get_type(rr)); - rk->rk.rrset_class = htons(ldns_rr_get_class(rr)); - ldns_buffer_clear(buf); - status = ldns_dname2buffer_wire(buf, ldns_rr_owner(rr)); - if(status != LDNS_STATUS_OK) { - log_warn("error cannot dname2buffer: %s", - ldns_get_errorstr_by_id(status)); - ldns_rr_free(rr); - return 0; - } - ldns_buffer_flip(buf); - rk->rk.dname_len = ldns_buffer_limit(buf); - rk->rk.dname = regional_alloc_init(region, - ldns_buffer_begin(buf), ldns_buffer_limit(buf)); + rk->rk.type = htons(sldns_wirerr_get_type(rr, rr_len, dname_len)); + rk->rk.rrset_class = htons(sldns_wirerr_get_class(rr, rr_len, dname_len)); + rk->rk.dname_len = dname_len; + rk->rk.dname = regional_alloc_init(region, rr, dname_len); if(!rk->rk.dname) { log_warn("error out of memory"); - ldns_rr_free(rr); return 0; } } - ldns_rr_free(rr); return 1; } @@ -489,7 +397,7 @@ move_into_cache(struct ub_packed_rrset_key* k, return 0; } s = sizeof(*ad) + (sizeof(size_t) + sizeof(uint8_t*) + - sizeof(uint32_t))* num; + sizeof(time_t))* num; for(i=0; irr_len[i]; ad = (struct packed_rrset_data*)malloc(s); @@ -505,8 +413,8 @@ move_into_cache(struct ub_packed_rrset_key* k, p += sizeof(size_t)*num; memmove(p, &d->rr_data[0], sizeof(uint8_t*)*num); p += sizeof(uint8_t*)*num; - memmove(p, &d->rr_ttl[0], sizeof(uint32_t)*num); - p += sizeof(uint32_t)*num; + memmove(p, &d->rr_ttl[0], sizeof(time_t)*num); + p += sizeof(time_t)*num; for(i=0; irr_data[i], d->rr_len[i]); p += d->rr_len[i]; @@ -524,13 +432,14 @@ move_into_cache(struct ub_packed_rrset_key* k, /** load an rrset entry */ static int -load_rrset(SSL* ssl, ldns_buffer* buf, struct worker* worker) +load_rrset(SSL* ssl, sldns_buffer* buf, struct worker* worker) { - char* s = (char*)ldns_buffer_begin(buf); + char* s = (char*)sldns_buffer_begin(buf); struct regional* region = worker->scratchpad; struct ub_packed_rrset_key* rk; struct packed_rrset_data* d; - unsigned int ttl, rr_count, rrsig_count, trust, security; + unsigned int rr_count, rrsig_count, trust, security; + long long ttl; unsigned int i; int go_on = 1; regional_free_all(region); @@ -552,7 +461,7 @@ load_rrset(SSL* ssl, ldns_buffer* buf, struct worker* worker) s += 10; rk->rk.flags |= PACKED_RRSET_NSEC_AT_APEX; } - if(sscanf(s, " %u %u %u %u %u", &ttl, &rr_count, &rrsig_count, + if(sscanf(s, " " ARG_LL "d %u %u %u %u", &ttl, &rr_count, &rrsig_count, &trust, &security) != 5) { log_warn("error bad rrset spec %s", s); return 0; @@ -565,12 +474,12 @@ load_rrset(SSL* ssl, ldns_buffer* buf, struct worker* worker) d->rrsig_count = (size_t)rrsig_count; d->security = (enum sec_status)security; d->trust = (enum rrset_trust)trust; - d->ttl = (uint32_t)ttl + *worker->env.now; + d->ttl = (time_t)ttl + *worker->env.now; d->rr_len = regional_alloc_zero(region, sizeof(size_t)*(d->count+d->rrsig_count)); d->rr_ttl = regional_alloc_zero(region, - sizeof(uint32_t)*(d->count+d->rrsig_count)); + sizeof(time_t)*(d->count+d->rrsig_count)); d->rr_data = regional_alloc_zero(region, sizeof(uint8_t*)*(d->count+d->rrsig_count)); if(!d->rr_len || !d->rr_ttl || !d->rr_data) { @@ -605,10 +514,10 @@ load_rrset(SSL* ssl, ldns_buffer* buf, struct worker* worker) static int load_rrset_cache(SSL* ssl, struct worker* worker) { - ldns_buffer* buf = worker->env.scratch_buffer; + sldns_buffer* buf = worker->env.scratch_buffer; if(!read_fixed(ssl, buf, "START_RRSET_CACHE")) return 0; while(ssl_read_buf(ssl, buf) && - strcmp((char*)ldns_buffer_begin(buf), "END_RRSET_CACHE")!=0) { + strcmp((char*)sldns_buffer_begin(buf), "END_RRSET_CACHE")!=0) { if(!load_rrset(ssl, buf, worker)) return 0; } @@ -617,13 +526,13 @@ load_rrset_cache(SSL* ssl, struct worker* worker) /** read qinfo from next three words */ static char* -load_qinfo(char* str, struct query_info* qinfo, ldns_buffer* buf, - struct regional* region) +load_qinfo(char* str, struct query_info* qinfo, struct regional* region) { /* s is part of the buf */ char* s = str; - ldns_rr* rr; - ldns_status status; + uint8_t rr[LDNS_RR_BUF_SIZE]; + size_t rr_len = sizeof(rr), dname_len = 0; + int status; /* skip three words */ s = strchr(str, ' '); @@ -637,26 +546,17 @@ load_qinfo(char* str, struct query_info* qinfo, ldns_buffer* buf, s++; /* parse them */ - status = ldns_rr_new_question_frm_str(&rr, str, NULL, NULL); - if(status != LDNS_STATUS_OK) { + status = sldns_str2wire_rr_question_buf(str, rr, &rr_len, &dname_len, + NULL, 0, NULL, 0); + if(status != 0) { log_warn("error cannot parse: %s %s", - ldns_get_errorstr_by_id(status), str); + sldns_get_errorstr_parse(status), str); return NULL; } - qinfo->qtype = ldns_rr_get_type(rr); - qinfo->qclass = ldns_rr_get_class(rr); - ldns_buffer_clear(buf); - status = ldns_dname2buffer_wire(buf, ldns_rr_owner(rr)); - ldns_rr_free(rr); - if(status != LDNS_STATUS_OK) { - log_warn("error cannot dname2wire: %s", - ldns_get_errorstr_by_id(status)); - return NULL; - } - ldns_buffer_flip(buf); - qinfo->qname_len = ldns_buffer_limit(buf); - qinfo->qname = (uint8_t*)regional_alloc_init(region, - ldns_buffer_begin(buf), ldns_buffer_limit(buf)); + qinfo->qtype = sldns_wirerr_get_type(rr, rr_len, dname_len); + qinfo->qclass = sldns_wirerr_get_class(rr, rr_len, dname_len); + qinfo->qname_len = dname_len; + qinfo->qname = (uint8_t*)regional_alloc_init(region, rr, dname_len); if(!qinfo->qname) { log_warn("error out of memory"); return NULL; @@ -667,11 +567,11 @@ load_qinfo(char* str, struct query_info* qinfo, ldns_buffer* buf, /** load a msg rrset reference */ static int -load_ref(SSL* ssl, ldns_buffer* buf, struct worker* worker, +load_ref(SSL* ssl, sldns_buffer* buf, struct worker* worker, struct regional *region, struct ub_packed_rrset_key** rrset, int* go_on) { - char* s = (char*)ldns_buffer_begin(buf); + char* s = (char*)sldns_buffer_begin(buf); struct query_info qinfo; unsigned int flags; struct ub_packed_rrset_key* k; @@ -684,7 +584,7 @@ load_ref(SSL* ssl, ldns_buffer* buf, struct worker* worker, return 1; } - s = load_qinfo(s, &qinfo, buf, region); + s = load_qinfo(s, &qinfo, region); if(!s) { return 0; } @@ -712,13 +612,14 @@ load_ref(SSL* ssl, ldns_buffer* buf, struct worker* worker, /** load a msg entry */ static int -load_msg(SSL* ssl, ldns_buffer* buf, struct worker* worker) +load_msg(SSL* ssl, sldns_buffer* buf, struct worker* worker) { struct regional* region = worker->scratchpad; struct query_info qinf; struct reply_info rep; - char* s = (char*)ldns_buffer_begin(buf); - unsigned int flags, qdcount, ttl, security, an, ns, ar; + char* s = (char*)sldns_buffer_begin(buf); + unsigned int flags, qdcount, security, an, ns, ar; + long long ttl; size_t i; int go_on = 1; @@ -729,20 +630,20 @@ load_msg(SSL* ssl, ldns_buffer* buf, struct worker* worker) return 0; } s += 4; - s = load_qinfo(s, &qinf, buf, region); + s = load_qinfo(s, &qinf, region); if(!s) { return 0; } /* read remainder of line */ - if(sscanf(s, " %u %u %u %u %u %u %u", &flags, &qdcount, &ttl, + if(sscanf(s, " %u %u " ARG_LL "d %u %u %u %u", &flags, &qdcount, &ttl, &security, &an, &ns, &ar) != 7) { log_warn("error cannot parse numbers: %s", s); return 0; } rep.flags = (uint16_t)flags; rep.qdcount = (uint16_t)qdcount; - rep.ttl = (uint32_t)ttl; + rep.ttl = (time_t)ttl; rep.prefetch_ttl = PREFETCH_TTL_CALC(rep.ttl); rep.security = (enum sec_status)security; rep.an_numrrsets = (size_t)an; @@ -774,10 +675,10 @@ load_msg(SSL* ssl, ldns_buffer* buf, struct worker* worker) static int load_msg_cache(SSL* ssl, struct worker* worker) { - ldns_buffer* buf = worker->env.scratch_buffer; + sldns_buffer* buf = worker->env.scratch_buffer; if(!read_fixed(ssl, buf, "START_MSG_CACHE")) return 0; while(ssl_read_buf(ssl, buf) && - strcmp((char*)ldns_buffer_begin(buf), "END_MSG_CACHE")!=0) { + strcmp((char*)sldns_buffer_begin(buf), "END_MSG_CACHE")!=0) { if(!load_msg(ssl, buf, worker)) return 0; } @@ -800,8 +701,9 @@ print_dp_details(SSL* ssl, struct worker* worker, struct delegpt* dp) { char buf[257]; struct delegpt_addr* a; - int lame, dlame, rlame, rto, edns_vs, to, delay, entry_ttl, + int lame, dlame, rlame, rto, edns_vs, to, delay, tA = 0, tAAAA = 0, tother = 0; + long long entry_ttl; struct rtt_info ri; uint8_t edns_lame_known; for(a = dp->target_list; a; a = a->next_target) { @@ -840,8 +742,8 @@ print_dp_details(SSL* ssl, struct worker* worker, struct delegpt* dp) return; continue; /* skip stuff not in infra cache */ } - if(!ssl_printf(ssl, "%s%s%s%srto %d msec, ttl %d, ping %d " - "var %d rtt %d, tA %d, tAAAA %d, tother %d", + if(!ssl_printf(ssl, "%s%s%s%srto %d msec, ttl " ARG_LL "d, " + "ping %d var %d rtt %d, tA %d, tAAAA %d, tother %d", lame?"LAME ":"", dlame?"NoDNSSEC ":"", a->lame?"AddrWasParentSide ":"", rlame?"NoAuthButRecursive ":"", rto, entry_ttl, diff --git a/contrib/unbound/daemon/cachedump.h b/contrib/unbound/daemon/cachedump.h index da9804ff1e0..0f2feabcb7f 100644 --- a/contrib/unbound/daemon/cachedump.h +++ b/contrib/unbound/daemon/cachedump.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/daemon/daemon.c b/contrib/unbound/daemon/daemon.c index b91683feb91..aed22c2db7f 100644 --- a/contrib/unbound/daemon/daemon.c +++ b/contrib/unbound/daemon/daemon.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -56,12 +56,16 @@ #include #endif +#ifdef HAVE_TIME_H +#include +#endif +#include + #ifdef HAVE_NSS /* nss3 */ #include "nss.h" #endif -#include #include "daemon/daemon.h" #include "daemon/worker.h" #include "daemon/remote.h" @@ -80,6 +84,7 @@ #include "util/random.h" #include "util/tube.h" #include "util/net_help.h" +#include "ldns/keyraw.h" #include /** How many quit requests happened. */ @@ -203,7 +208,7 @@ daemon_init(void) OPENSSL_config("unbound"); # endif # ifdef USE_GOST - (void)ldns_key_EVP_load_gost_id(); + (void)sldns_key_EVP_load_gost_id(); # endif OpenSSL_add_all_algorithms(); # if HAVE_DECL_SSL_COMP_GET_COMPRESSION_METHODS @@ -250,9 +255,55 @@ daemon_open_shared_ports(struct daemon* daemon) { log_assert(daemon); if(daemon->cfg->port != daemon->listening_port) { - listening_ports_free(daemon->ports); - if(!(daemon->ports=listening_ports_open(daemon->cfg))) + size_t i; + int reuseport = 0; + struct listen_port* p0; + /* free and close old ports */ + if(daemon->ports != NULL) { + for(i=0; inum_ports; i++) + listening_ports_free(daemon->ports[i]); + free(daemon->ports); + daemon->ports = NULL; + } + /* see if we want to reuseport */ +#if defined(__linux__) && defined(SO_REUSEPORT) + if(daemon->cfg->so_reuseport && daemon->cfg->num_threads > 0) + reuseport = 1; +#endif + /* try to use reuseport */ + p0 = listening_ports_open(daemon->cfg, &reuseport); + if(!p0) { + listening_ports_free(p0); return 0; + } + if(reuseport) { + /* reuseport was successful, allocate for it */ + daemon->num_ports = (size_t)daemon->cfg->num_threads; + } else { + /* do the normal, singleportslist thing, + * reuseport not enabled or did not work */ + daemon->num_ports = 1; + } + if(!(daemon->ports = (struct listen_port**)calloc( + daemon->num_ports, sizeof(*daemon->ports)))) { + listening_ports_free(p0); + return 0; + } + daemon->ports[0] = p0; + if(reuseport) { + /* continue to use reuseport */ + for(i=1; inum_ports; i++) { + if(!(daemon->ports[i]= + listening_ports_open(daemon->cfg, + &reuseport)) || !reuseport ) { + for(i=0; inum_ports; i++) + listening_ports_free(daemon->ports[i]); + free(daemon->ports); + daemon->ports = NULL; + return 0; + } + } + } daemon->listening_port = daemon->cfg->port; } if(!daemon->cfg->remote_control_enable && daemon->rc_port) { @@ -389,6 +440,7 @@ static void* thread_start(void* arg) { struct worker* worker = (struct worker*)arg; + int port_num = 0; log_thread_set(&worker->thread_num); ub_thread_blocksigs(); #ifdef THREADS_DISABLED @@ -396,7 +448,14 @@ thread_start(void* arg) tube_close_write(worker->cmd); close_other_pipes(worker->daemon, worker->thread_num); #endif - if(!worker_init(worker, worker->daemon->cfg, worker->daemon->ports, 0)) +#if defined(__linux__) && defined(SO_REUSEPORT) + if(worker->daemon->cfg->so_reuseport) + port_num = worker->thread_num; + else + port_num = 0; +#endif + if(!worker_init(worker, worker->daemon->cfg, + worker->daemon->ports[port_num], 0)) fatal_exit("Could not initialize thread"); worker_work(worker); @@ -469,7 +528,7 @@ daemon_fork(struct daemon* daemon) #if defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP) /* in libev the first inited base gets signals */ - if(!worker_init(daemon->workers[0], daemon->cfg, daemon->ports, 1)) + if(!worker_init(daemon->workers[0], daemon->cfg, daemon->ports[0], 1)) fatal_exit("Could not initialize main thread"); #endif @@ -483,7 +542,7 @@ daemon_fork(struct daemon* daemon) */ #if !(defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)) /* libevent has the last inited base get signals (or any base) */ - if(!worker_init(daemon->workers[0], daemon->cfg, daemon->ports, 1)) + if(!worker_init(daemon->workers[0], daemon->cfg, daemon->ports[0], 1)) fatal_exit("Could not initialize main thread"); #endif signal_handling_playback(daemon->workers[0]); @@ -529,11 +588,14 @@ daemon_cleanup(struct daemon* daemon) void daemon_delete(struct daemon* daemon) { + size_t i; if(!daemon) return; modstack_desetup(&daemon->mods, daemon->env); daemon_remote_delete(daemon->rc); - listening_ports_free(daemon->ports); + for(i = 0; i < daemon->num_ports; i++) + listening_ports_free(daemon->ports[i]); + free(daemon->ports); listening_ports_free(daemon->rc_ports); if(daemon->env) { slabhash_delete(daemon->env->msg_cache); @@ -558,7 +620,7 @@ daemon_delete(struct daemon* daemon) /* libcrypto cleanup */ #ifdef HAVE_SSL # if defined(USE_GOST) && defined(HAVE_LDNS_KEY_EVP_UNLOAD_GOST) - ldns_key_EVP_unload_gost(); + sldns_key_EVP_unload_gost(); # endif # if HAVE_DECL_SSL_COMP_GET_COMPRESSION_METHODS && HAVE_DECL_SK_SSL_COMP_POP_FREE # ifndef S_SPLINT_S diff --git a/contrib/unbound/daemon/daemon.h b/contrib/unbound/daemon/daemon.h index 8e47ea00b9e..855b0d34408 100644 --- a/contrib/unbound/daemon/daemon.h +++ b/contrib/unbound/daemon/daemon.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -72,8 +72,11 @@ struct daemon { char* pidfile; /** port number that has ports opened. */ int listening_port; - /** listening ports, opened, to be shared by threads */ - struct listen_port* ports; + /** array of listening ports, opened. Listening ports per worker, + * or just one element[0] shared by the worker threads. */ + struct listen_port** ports; + /** size of ports array */ + size_t num_ports; /** port number for remote that has ports opened. */ int rc_port; /** listening ports for remote control */ diff --git a/contrib/unbound/daemon/remote.c b/contrib/unbound/daemon/remote.c index ba02d7de100..6882e16604f 100644 --- a/contrib/unbound/daemon/remote.c +++ b/contrib/unbound/daemon/remote.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -47,7 +47,6 @@ #include #endif #include -#include #include "daemon/remote.h" #include "daemon/worker.h" #include "daemon/daemon.h" @@ -75,6 +74,10 @@ #include "iterator/iter_delegpt.h" #include "services/outbound_list.h" #include "services/outside_network.h" +#include "ldns/str2wire.h" +#include "ldns/parseutil.h" +#include "ldns/wire2str.h" +#include "ldns/sbuffer.h" #ifdef HAVE_SYS_TYPES_H # include @@ -268,7 +271,7 @@ add_open(const char* ip, int nr, struct listen_port** list, int noproto_is_err) } /* open fd */ - fd = create_tcp_accept_sock(res, 1, &noproto); + fd = create_tcp_accept_sock(res, 1, &noproto, 0); freeaddrinfo(res); if(fd == -1 && noproto) { if(!noproto_is_err) @@ -629,8 +632,8 @@ print_stats(SSL* ssl, const char* nm, struct stats_info* s) if(!ssl_printf(ssl, "%s.requestlist.current.user"SQ"%u\n", nm, (unsigned)s->mesh_num_reply_states)) return 0; timeval_divide(&avg, &s->mesh_replies_sum_wait, s->mesh_replies_sent); - if(!ssl_printf(ssl, "%s.recursion.time.avg"SQ"%d.%6.6d\n", nm, - (int)avg.tv_sec, (int)avg.tv_usec)) return 0; + if(!ssl_printf(ssl, "%s.recursion.time.avg"SQ ARG_LL "d.%6.6d\n", nm, + (long long)avg.tv_sec, (int)avg.tv_usec)) return 0; if(!ssl_printf(ssl, "%s.recursion.time.median"SQ"%g\n", nm, s->mesh_time_median)) return 0; return 1; @@ -713,12 +716,12 @@ print_uptime(SSL* ssl, struct worker* worker, int reset) timeval_subtract(&dt, &now, &worker->daemon->time_last_stat); if(reset) worker->daemon->time_last_stat = now; - if(!ssl_printf(ssl, "time.now"SQ"%d.%6.6d\n", - (unsigned)now.tv_sec, (unsigned)now.tv_usec)) return 0; - if(!ssl_printf(ssl, "time.up"SQ"%d.%6.6d\n", - (unsigned)up.tv_sec, (unsigned)up.tv_usec)) return 0; - if(!ssl_printf(ssl, "time.elapsed"SQ"%d.%6.6d\n", - (unsigned)dt.tv_sec, (unsigned)dt.tv_usec)) return 0; + if(!ssl_printf(ssl, "time.now"SQ ARG_LL "d.%6.6d\n", + (long long)now.tv_sec, (unsigned)now.tv_usec)) return 0; + if(!ssl_printf(ssl, "time.up"SQ ARG_LL "d.%6.6d\n", + (long long)up.tv_sec, (unsigned)up.tv_usec)) return 0; + if(!ssl_printf(ssl, "time.elapsed"SQ ARG_LL "d.%6.6d\n", + (long long)dt.tv_sec, (unsigned)dt.tv_usec)) return 0; return 1; } @@ -756,13 +759,13 @@ print_ext(SSL* ssl, struct stats_info* s) { int i; char nm[16]; - const ldns_rr_descriptor* desc; - const ldns_lookup_table* lt; + const sldns_rr_descriptor* desc; + const sldns_lookup_table* lt; /* TYPE */ for(i=0; isvr.qtype[i] == 0) continue; - desc = ldns_rr_descript((uint16_t)i); + desc = sldns_rr_descript((uint16_t)i); if(desc && desc->_name) { snprintf(nm, sizeof(nm), "%s", desc->_name); } else if (i == LDNS_RR_TYPE_IXFR) { @@ -789,7 +792,7 @@ print_ext(SSL* ssl, struct stats_info* s) for(i=0; isvr.qclass[i] == 0) continue; - lt = ldns_lookup_by_id(ldns_rr_classes, i); + lt = sldns_lookup_by_id(sldns_rr_classes, i); if(lt && lt->name) { snprintf(nm, sizeof(nm), "%s", lt->name); } else { @@ -806,7 +809,7 @@ print_ext(SSL* ssl, struct stats_info* s) for(i=0; isvr.qopcode[i] == 0) continue; - lt = ldns_lookup_by_id(ldns_opcodes, i); + lt = sldns_lookup_by_id(sldns_opcodes, i); if(lt && lt->name) { snprintf(nm, sizeof(nm), "%s", lt->name); } else { @@ -846,7 +849,7 @@ print_ext(SSL* ssl, struct stats_info* s) for(i=0; isvr.ans_rcode[i] == 0) continue; - lt = ldns_lookup_by_id(ldns_rcodes, i); + lt = sldns_lookup_by_id(sldns_rcodes, i); if(lt && lt->name) { snprintf(nm, sizeof(nm), "%s", lt->name); } else { @@ -912,17 +915,20 @@ do_stats(SSL* ssl, struct daemon_remote* rc, int reset) static int parse_arg_name(SSL* ssl, char* str, uint8_t** res, size_t* len, int* labs) { - ldns_rdf* rdf; + uint8_t nm[LDNS_MAX_DOMAINLEN+1]; + size_t nmlen = sizeof(nm); + int status; *res = NULL; *len = 0; *labs = 0; - rdf = ldns_dname_new_frm_str(str); - if(!rdf) { - ssl_printf(ssl, "error cannot parse name %s\n", str); + status = sldns_str2wire_dname_buf(str, nm, &nmlen); + if(status != 0) { + ssl_printf(ssl, "error cannot parse name %s at %d: %s\n", str, + LDNS_WIREPARSE_OFFSET(status), + sldns_get_errorstr_parse(status)); return 0; } - *res = memdup(ldns_rdf_data(rdf), ldns_rdf_size(rdf)); - ldns_rdf_deep_free(rdf); + *res = memdup(nm, nmlen); if(!*res) { ssl_printf(ssl, "error out of memory\n"); return 0; @@ -975,7 +981,7 @@ do_zone_add(SSL* ssl, struct worker* worker, char* arg) free(nm); return; } - lock_quick_lock(&worker->daemon->local_zones->lock); + lock_rw_wrlock(&worker->daemon->local_zones->lock); if((z=local_zones_find(worker->daemon->local_zones, nm, nmlen, nmlabs, LDNS_RR_CLASS_IN))) { /* already present in tree */ @@ -983,17 +989,17 @@ do_zone_add(SSL* ssl, struct worker* worker, char* arg) z->type = t; /* update type anyway */ lock_rw_unlock(&z->lock); free(nm); - lock_quick_unlock(&worker->daemon->local_zones->lock); + lock_rw_unlock(&worker->daemon->local_zones->lock); send_ok(ssl); return; } if(!local_zones_add_zone(worker->daemon->local_zones, nm, nmlen, nmlabs, LDNS_RR_CLASS_IN, t)) { - lock_quick_unlock(&worker->daemon->local_zones->lock); + lock_rw_unlock(&worker->daemon->local_zones->lock); ssl_printf(ssl, "error out of memory\n"); return; } - lock_quick_unlock(&worker->daemon->local_zones->lock); + lock_rw_unlock(&worker->daemon->local_zones->lock); send_ok(ssl); } @@ -1007,13 +1013,13 @@ do_zone_remove(SSL* ssl, struct worker* worker, char* arg) struct local_zone* z; if(!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs)) return; - lock_quick_lock(&worker->daemon->local_zones->lock); + lock_rw_wrlock(&worker->daemon->local_zones->lock); if((z=local_zones_find(worker->daemon->local_zones, nm, nmlen, nmlabs, LDNS_RR_CLASS_IN))) { /* present in tree */ local_zones_del_zone(worker->daemon->local_zones, z); } - lock_quick_unlock(&worker->daemon->local_zones->lock); + lock_rw_unlock(&worker->daemon->local_zones->lock); free(nm); send_ok(ssl); } @@ -1022,8 +1028,7 @@ do_zone_remove(SSL* ssl, struct worker* worker, char* arg) static void do_data_add(SSL* ssl, struct worker* worker, char* arg) { - if(!local_zones_add_RR(worker->daemon->local_zones, arg, - worker->env.scratch_buffer)) { + if(!local_zones_add_RR(worker->daemon->local_zones, arg)) { ssl_printf(ssl,"error in syntax or out of memory, %s\n", arg); return; } @@ -1090,7 +1095,7 @@ do_flush_type(SSL* ssl, struct worker* worker, char* arg) return; if(!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs)) return; - t = ldns_get_rr_type_by_name(arg2); + t = sldns_get_rr_type_by_name(arg2); do_cache_remove(worker, nm, nmlen, t, LDNS_RR_CLASS_IN); free(nm); @@ -1118,9 +1123,9 @@ struct del_info { /** labels */ int labs; /** now */ - uint32_t now; + time_t now; /** time to invalidate to */ - uint32_t expired; + time_t expired; /** number of rrsets removed */ size_t num_rrsets; /** number of msgs removed */ @@ -1388,9 +1393,9 @@ ssl_print_name_dp(SSL* ssl, const char* str, uint8_t* nm, uint16_t dclass, struct delegpt_addr* a; int f = 0; if(str) { /* print header for forward, stub */ - char* c = ldns_rr_class2str(dclass); + char* c = sldns_wire2str_class(dclass); dname_str(nm, buf); - if(!ssl_printf(ssl, "%s %s %s: ", buf, c, str)) { + if(!ssl_printf(ssl, "%s %s %s: ", buf, (c?c:"CLASS??"), str)) { free(c); return 0; } @@ -1571,7 +1576,7 @@ do_forward_add(SSL* ssl, struct worker* worker, char* args) struct delegpt* dp = NULL; if(!parse_fs_args(ssl, args, &nm, &dp, &insecure, NULL)) return; - if(insecure) { + if(insecure && worker->env.anchors) { if(!anchors_add_insecure(worker->env.anchors, LDNS_RR_CLASS_IN, nm)) { (void)ssl_printf(ssl, "error out of memory\n"); @@ -1598,7 +1603,7 @@ do_forward_remove(SSL* ssl, struct worker* worker, char* args) uint8_t* nm = NULL; if(!parse_fs_args(ssl, args, &nm, NULL, &insecure, NULL)) return; - if(insecure) + if(insecure && worker->env.anchors) anchors_delete_insecure(worker->env.anchors, LDNS_RR_CLASS_IN, nm); forwards_delete_zone(fwd, LDNS_RR_CLASS_IN, nm); @@ -1616,7 +1621,7 @@ do_stub_add(SSL* ssl, struct worker* worker, char* args) struct delegpt* dp = NULL; if(!parse_fs_args(ssl, args, &nm, &dp, &insecure, &prime)) return; - if(insecure) { + if(insecure && worker->env.anchors) { if(!anchors_add_insecure(worker->env.anchors, LDNS_RR_CLASS_IN, nm)) { (void)ssl_printf(ssl, "error out of memory\n"); @@ -1626,8 +1631,9 @@ do_stub_add(SSL* ssl, struct worker* worker, char* args) } } if(!forwards_add_stub_hole(fwd, LDNS_RR_CLASS_IN, nm)) { - if(insecure) anchors_delete_insecure(worker->env.anchors, - LDNS_RR_CLASS_IN, nm); + if(insecure && worker->env.anchors) + anchors_delete_insecure(worker->env.anchors, + LDNS_RR_CLASS_IN, nm); (void)ssl_printf(ssl, "error out of memory\n"); delegpt_free_mlc(dp); free(nm); @@ -1636,8 +1642,9 @@ do_stub_add(SSL* ssl, struct worker* worker, char* args) if(!hints_add_stub(worker->env.hints, LDNS_RR_CLASS_IN, dp, !prime)) { (void)ssl_printf(ssl, "error out of memory\n"); forwards_delete_stub_hole(fwd, LDNS_RR_CLASS_IN, nm); - if(insecure) anchors_delete_insecure(worker->env.anchors, - LDNS_RR_CLASS_IN, nm); + if(insecure && worker->env.anchors) + anchors_delete_insecure(worker->env.anchors, + LDNS_RR_CLASS_IN, nm); free(nm); return; } @@ -1654,7 +1661,7 @@ do_stub_remove(SSL* ssl, struct worker* worker, char* args) uint8_t* nm = NULL; if(!parse_fs_args(ssl, args, &nm, NULL, &insecure, NULL)) return; - if(insecure) + if(insecure && worker->env.anchors) anchors_delete_insecure(worker->env.anchors, LDNS_RR_CLASS_IN, nm); forwards_delete_stub_hole(fwd, LDNS_RR_CLASS_IN, nm); @@ -1663,6 +1670,43 @@ do_stub_remove(SSL* ssl, struct worker* worker, char* args) send_ok(ssl); } +/** do the insecure_add command */ +static void +do_insecure_add(SSL* ssl, struct worker* worker, char* arg) +{ + size_t nmlen; + int nmlabs; + uint8_t* nm = NULL; + if(!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs)) + return; + if(worker->env.anchors) { + if(!anchors_add_insecure(worker->env.anchors, + LDNS_RR_CLASS_IN, nm)) { + (void)ssl_printf(ssl, "error out of memory\n"); + free(nm); + return; + } + } + free(nm); + send_ok(ssl); +} + +/** do the insecure_remove command */ +static void +do_insecure_remove(SSL* ssl, struct worker* worker, char* arg) +{ + size_t nmlen; + int nmlabs; + uint8_t* nm = NULL; + if(!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs)) + return; + if(worker->env.anchors) + anchors_delete_insecure(worker->env.anchors, + LDNS_RR_CLASS_IN, nm); + free(nm); + send_ok(ssl); +} + /** do the status command */ static void do_status(SSL* ssl, struct worker* worker) @@ -1684,7 +1728,7 @@ do_status(SSL* ssl, struct worker* worker) if(!ssl_printf(ssl, " ]\n")) return; uptime = (time_t)time(NULL) - (time_t)worker->daemon->time_boot.tv_sec; - if(!ssl_printf(ssl, "uptime: %u seconds\n", (unsigned)uptime)) + if(!ssl_printf(ssl, "uptime: " ARG_LL "d seconds\n", (long long)uptime)) return; if(!ssl_printf(ssl, "unbound (pid %d) is running...\n", (int)getpid())) @@ -1703,7 +1747,8 @@ get_mesh_age(struct mesh_state* m, char* buf, size_t len, while(r && r->next) r = r->next; timeval_subtract(&d, env->now_tv, &r->start_time); - snprintf(buf, len, "%d.%6.6d", (int)d.tv_sec, (int)d.tv_usec); + snprintf(buf, len, ARG_LL "d.%6.6d", + (long long)d.tv_sec, (int)d.tv_usec); } else { snprintf(buf, len, "-"); } @@ -1748,10 +1793,11 @@ get_mesh_status(struct mesh_area* mesh, struct mesh_state* m, if(m->sub_set.count == 0) snprintf(buf, len, " (empty_list)"); RBTREE_FOR(sub, struct mesh_state_ref*, &m->sub_set) { - char* t = ldns_rr_type2str(sub->s->s.qinfo.qtype); - char* c = ldns_rr_class2str(sub->s->s.qinfo.qclass); + char* t = sldns_wire2str_type(sub->s->s.qinfo.qtype); + char* c = sldns_wire2str_class(sub->s->s.qinfo.qclass); dname_str(sub->s->s.qinfo.qname, nm); - snprintf(buf, len, " %s %s %s", t, c, nm); + snprintf(buf, len, " %s %s %s", (t?t:"TYPE??"), + (c?c:"CLASS??"), nm); l = strlen(buf); buf += l; len -= l; free(t); @@ -1780,13 +1826,14 @@ do_dump_requestlist(SSL* ssl, struct worker* worker) mesh = worker->env.mesh; if(!mesh) return; RBTREE_FOR(m, struct mesh_state*, &mesh->all) { - char* t = ldns_rr_type2str(m->s.qinfo.qtype); - char* c = ldns_rr_class2str(m->s.qinfo.qclass); + char* t = sldns_wire2str_type(m->s.qinfo.qtype); + char* c = sldns_wire2str_class(m->s.qinfo.qclass); dname_str(m->s.qinfo.qname, buf); get_mesh_age(m, timebuf, sizeof(timebuf), &worker->env); get_mesh_status(mesh, m, statbuf, sizeof(statbuf)); if(!ssl_printf(ssl, "%3d %4s %2s %s %s %s\n", - num, t, c, buf, timebuf, statbuf)) { + num, (t?t:"TYPE??"), (c?c:"CLASS??"), buf, timebuf, + statbuf)) { free(t); free(c); return; @@ -1804,7 +1851,7 @@ struct infra_arg { /** the SSL connection */ SSL* ssl; /** the time now */ - uint32_t now; + time_t now; }; /** callback for every host element in the infra cache */ @@ -1927,7 +1974,7 @@ do_list_local_zones(SSL* ssl, struct worker* worker) struct local_zones* zones = worker->daemon->local_zones; struct local_zone* z; char buf[257]; - lock_quick_lock(&zones->lock); + lock_rw_rdlock(&zones->lock); RBTREE_FOR(z, struct local_zone*, &zones->ztree) { lock_rw_rdlock(&z->lock); dname_str(z->name, buf); @@ -1935,7 +1982,7 @@ do_list_local_zones(SSL* ssl, struct worker* worker) local_zone_type2str(z->type)); lock_rw_unlock(&z->lock); } - lock_quick_unlock(&zones->lock); + lock_rw_unlock(&zones->lock); } /** do the list_local_data command */ @@ -1946,22 +1993,30 @@ do_list_local_data(SSL* ssl, struct worker* worker) struct local_zone* z; struct local_data* d; struct local_rrset* p; - lock_quick_lock(&zones->lock); + char* s = (char*)sldns_buffer_begin(worker->env.scratch_buffer); + size_t slen = sldns_buffer_capacity(worker->env.scratch_buffer); + lock_rw_rdlock(&zones->lock); RBTREE_FOR(z, struct local_zone*, &zones->ztree) { lock_rw_rdlock(&z->lock); RBTREE_FOR(d, struct local_data*, &z->data) { for(p = d->rrsets; p; p = p->next) { - ldns_rr_list* rr = packed_rrset_to_rr_list( - p->rrset, worker->env.scratch_buffer); - char* str = ldns_rr_list2str(rr); - (void)ssl_printf(ssl, "%s", str); - free(str); - ldns_rr_list_free(rr); + struct packed_rrset_data* d = + (struct packed_rrset_data*)p->rrset->entry.data; + size_t i; + for(i=0; icount + d->rrsig_count; i++) { + if(!packed_rr_to_string(p->rrset, i, + 0, s, slen)) { + if(!ssl_printf(ssl, "BADRR\n")) + return; + } + if(!ssl_printf(ssl, "%s\n", s)) + return; + } } } lock_rw_unlock(&z->lock); } - lock_quick_unlock(&zones->lock); + lock_rw_unlock(&zones->lock); } /** tell other processes to execute the command */ @@ -2050,6 +2105,16 @@ execute_cmd(struct daemon_remote* rc, SSL* ssl, char* cmd, if(rc) distribute_cmd(rc, ssl, cmd); do_forward_remove(ssl, worker, skipwhite(p+14)); return; + } else if(cmdcmp(p, "insecure_add", 12)) { + /* must always distribute this cmd */ + if(rc) distribute_cmd(rc, ssl, cmd); + do_insecure_add(ssl, worker, skipwhite(p+12)); + return; + } else if(cmdcmp(p, "insecure_remove", 15)) { + /* must always distribute this cmd */ + if(rc) distribute_cmd(rc, ssl, cmd); + do_insecure_remove(ssl, worker, skipwhite(p+15)); + return; } else if(cmdcmp(p, "forward", 7)) { /* must always distribute this cmd */ if(rc) distribute_cmd(rc, ssl, cmd); diff --git a/contrib/unbound/daemon/remote.h b/contrib/unbound/daemon/remote.h index 7d922bd7677..cc670b70128 100644 --- a/contrib/unbound/daemon/remote.h +++ b/contrib/unbound/daemon/remote.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/daemon/stats.c b/contrib/unbound/daemon/stats.c index 9a1a7d2617e..57ad1ef6bcd 100644 --- a/contrib/unbound/daemon/stats.c +++ b/contrib/unbound/daemon/stats.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -40,7 +40,11 @@ * numbers. These 'statistics' may be of interest to the operator. */ #include "config.h" -#include +#ifdef HAVE_TIME_H +#include +#endif +#include +#include #include "daemon/stats.h" #include "daemon/worker.h" #include "daemon/daemon.h" @@ -51,6 +55,7 @@ #include "util/timehist.h" #include "util/net_help.h" #include "validator/validator.h" +#include "ldns/sbuffer.h" /** add timers and the values do not overflow or become negative */ static void @@ -257,14 +262,14 @@ void server_stats_insquery(struct server_stats* stats, struct comm_point* c, uint16_t qtype, uint16_t qclass, struct edns_data* edns, struct comm_reply* repinfo) { - uint16_t flags = ldns_buffer_read_u16_at(c->buffer, 2); + uint16_t flags = sldns_buffer_read_u16_at(c->buffer, 2); if(qtype < STATS_QTYPE_NUM) stats->qtype[qtype]++; else stats->qtype_big++; if(qclass < STATS_QCLASS_NUM) stats->qclass[qclass]++; else stats->qclass_big++; - stats->qopcode[ LDNS_OPCODE_WIRE(ldns_buffer_begin(c->buffer)) ]++; + stats->qopcode[ LDNS_OPCODE_WIRE(sldns_buffer_begin(c->buffer)) ]++; if(c->type != comm_udp) stats->qtcp++; if(repinfo && addr_is_ip6(&repinfo->addr, repinfo->addrlen)) @@ -292,12 +297,12 @@ void server_stats_insquery(struct server_stats* stats, struct comm_point* c, } } -void server_stats_insrcode(struct server_stats* stats, ldns_buffer* buf) +void server_stats_insrcode(struct server_stats* stats, sldns_buffer* buf) { - if(stats->extended && ldns_buffer_limit(buf) != 0) { - int r = (int)LDNS_RCODE_WIRE( ldns_buffer_begin(buf) ); + if(stats->extended && sldns_buffer_limit(buf) != 0) { + int r = (int)LDNS_RCODE_WIRE( sldns_buffer_begin(buf) ); stats->ans_rcode[r] ++; - if(r == 0 && LDNS_ANCOUNT( ldns_buffer_begin(buf) ) == 0) + if(r == 0 && LDNS_ANCOUNT( sldns_buffer_begin(buf) ) == 0) stats->ans_rcode_nodata ++; } } diff --git a/contrib/unbound/daemon/stats.h b/contrib/unbound/daemon/stats.h index c0fc1cc1544..7c315513f36 100644 --- a/contrib/unbound/daemon/stats.h +++ b/contrib/unbound/daemon/stats.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -43,12 +43,12 @@ #ifndef DAEMON_STATS_H #define DAEMON_STATS_H #include "util/timehist.h" -#include struct worker; struct config_file; struct comm_point; struct comm_reply; struct edns_data; +struct sldns_buffer; /** number of qtype that is stored for in array */ #define STATS_QTYPE_NUM 256 @@ -230,6 +230,6 @@ void server_stats_insquery(struct server_stats* stats, struct comm_point* c, * @param stats: the stats * @param buf: buffer with rcode. If buffer is length0: not counted. */ -void server_stats_insrcode(struct server_stats* stats, ldns_buffer* buf); +void server_stats_insrcode(struct server_stats* stats, struct sldns_buffer* buf); #endif /* DAEMON_STATS_H */ diff --git a/contrib/unbound/daemon/unbound.c b/contrib/unbound/daemon/unbound.c index 6539b9eb517..716fbce172c 100644 --- a/contrib/unbound/daemon/unbound.c +++ b/contrib/unbound/daemon/unbound.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. * */ @@ -67,9 +67,12 @@ #include #endif +#ifndef S_SPLINT_S +/* splint chokes on this system header file */ #ifdef HAVE_SYS_RESOURCE_H #include #endif +#endif /* S_SPLINT_S */ #ifdef HAVE_LOGIN_CAP_H #include #endif @@ -165,8 +168,8 @@ static void usage() #endif printf("Version %s\n", PACKAGE_VERSION); get_event_sys(&evnm, &evsys, &evmethod); - printf("linked libs: %s %s (it uses %s), ldns %s, %s\n", - evnm, evsys, evmethod, ldns_version(), + printf("linked libs: %s %s (it uses %s), %s\n", + evnm, evsys, evmethod, #ifdef HAVE_SSL SSLeay_version(SSLEAY_VERSION) #elif defined(HAVE_NSS) @@ -193,6 +196,7 @@ int replay_var_compare(const void* ATTR_UNUSED(a), const void* ATTR_UNUSED(b)) static void checkrlimits(struct config_file* cfg) { +#ifndef S_SPLINT_S #ifdef HAVE_GETRLIMIT /* list has number of ports to listen to, ifs number addresses */ int list = ((cfg->do_udp?1:0) + (cfg->do_tcp?1 + @@ -283,6 +287,7 @@ checkrlimits(struct config_file* cfg) #else (void)cfg; #endif /* HAVE_GETRLIMIT */ +#endif /* S_SPLINT_S */ } /** set verbosity, check rlimits, cache settings */ @@ -522,7 +527,7 @@ perform_setup(struct daemon* daemon, struct config_file* cfg, int debug_mode, /* setusercontext does initgroups, setuid, setgid, and * also resource limits from login config, but we * still call setresuid, setresgid to be sure to set all uid*/ - if(setusercontext(NULL, pwd, uid, + if(setusercontext(NULL, pwd, uid, (unsigned) LOGIN_SETALL & ~LOGIN_SETUSER & ~LOGIN_SETGROUP) != 0) log_warn("unable to setusercontext %s: %s", cfg->username, strerror(errno)); @@ -715,6 +720,7 @@ main(int argc, char* argv[]) #endif log_init(NULL, 0, NULL); + log_ident_set(strrchr(argv[0],'/')?strrchr(argv[0],'/')+1:argv[0]); /* parse the options */ while( (c=getopt(argc, argv, "c:dhvw:")) != -1) { switch(c) { diff --git a/contrib/unbound/daemon/worker.c b/contrib/unbound/daemon/worker.c index 0e5b14d4c0c..ccc45f68fc8 100644 --- a/contrib/unbound/daemon/worker.c +++ b/contrib/unbound/daemon/worker.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -40,7 +40,6 @@ * pending requests. */ #include "config.h" -#include #include "util/log.h" #include "util/net_help.h" #include "util/random.h" @@ -72,6 +71,7 @@ #include "validator/val_anchor.h" #include "libunbound/context.h" #include "libunbound/libworker.h" +#include "ldns/sbuffer.h" #ifdef HAVE_SYS_TYPES_H # include @@ -181,7 +181,7 @@ worker_mem_report(struct worker* ATTR_UNUSED(worker), + sizeof(worker->rndstate) + regional_get_mem(worker->scratchpad) + sizeof(*worker->env.scratch_buffer) - + ldns_buffer_capacity(worker->env.scratch_buffer) + + sldns_buffer_capacity(worker->env.scratch_buffer) + forwards_get_mem(worker->env.fwds) + hints_get_mem(worker->env.hints); if(worker->thread_num == 0) @@ -243,10 +243,10 @@ worker_handle_reply(struct comm_point* c, void* arg, int error, return 0; } /* sanity check. */ - if(!LDNS_QR_WIRE(ldns_buffer_begin(c->buffer)) - || LDNS_OPCODE_WIRE(ldns_buffer_begin(c->buffer)) != + if(!LDNS_QR_WIRE(sldns_buffer_begin(c->buffer)) + || LDNS_OPCODE_WIRE(sldns_buffer_begin(c->buffer)) != LDNS_PACKET_QUERY - || LDNS_QDCOUNT(ldns_buffer_begin(c->buffer)) > 1) { + || LDNS_QDCOUNT(sldns_buffer_begin(c->buffer)) > 1) { /* error becomes timeout for the module as if this reply * never arrived. */ mesh_report_reply(worker->env.mesh, &e, reply_info, @@ -274,10 +274,10 @@ worker_handle_service_reply(struct comm_point* c, void* arg, int error, return 0; } /* sanity check. */ - if(!LDNS_QR_WIRE(ldns_buffer_begin(c->buffer)) - || LDNS_OPCODE_WIRE(ldns_buffer_begin(c->buffer)) != + if(!LDNS_QR_WIRE(sldns_buffer_begin(c->buffer)) + || LDNS_OPCODE_WIRE(sldns_buffer_begin(c->buffer)) != LDNS_PACKET_QUERY - || LDNS_QDCOUNT(ldns_buffer_begin(c->buffer)) > 1) { + || LDNS_QDCOUNT(sldns_buffer_begin(c->buffer)) > 1) { /* error becomes timeout for the module as if this reply * never arrived. */ verbose(VERB_ALGO, "worker: bad reply handled as timeout"); @@ -297,49 +297,49 @@ worker_handle_service_reply(struct comm_point* c, void* arg, int error, * @return error code, 0 OK, or -1 discard. */ static int -worker_check_request(ldns_buffer* pkt, struct worker* worker) +worker_check_request(sldns_buffer* pkt, struct worker* worker) { - if(ldns_buffer_limit(pkt) < LDNS_HEADER_SIZE) { + if(sldns_buffer_limit(pkt) < LDNS_HEADER_SIZE) { verbose(VERB_QUERY, "request too short, discarded"); return -1; } - if(ldns_buffer_limit(pkt) > NORMAL_UDP_SIZE && + if(sldns_buffer_limit(pkt) > NORMAL_UDP_SIZE && worker->daemon->cfg->harden_large_queries) { verbose(VERB_QUERY, "request too large, discarded"); return -1; } - if(LDNS_QR_WIRE(ldns_buffer_begin(pkt))) { + if(LDNS_QR_WIRE(sldns_buffer_begin(pkt))) { verbose(VERB_QUERY, "request has QR bit on, discarded"); return -1; } - if(LDNS_TC_WIRE(ldns_buffer_begin(pkt))) { - LDNS_TC_CLR(ldns_buffer_begin(pkt)); + if(LDNS_TC_WIRE(sldns_buffer_begin(pkt))) { + LDNS_TC_CLR(sldns_buffer_begin(pkt)); verbose(VERB_QUERY, "request bad, has TC bit on"); return LDNS_RCODE_FORMERR; } - if(LDNS_OPCODE_WIRE(ldns_buffer_begin(pkt)) != LDNS_PACKET_QUERY) { + if(LDNS_OPCODE_WIRE(sldns_buffer_begin(pkt)) != LDNS_PACKET_QUERY) { verbose(VERB_QUERY, "request unknown opcode %d", - LDNS_OPCODE_WIRE(ldns_buffer_begin(pkt))); + LDNS_OPCODE_WIRE(sldns_buffer_begin(pkt))); return LDNS_RCODE_NOTIMPL; } - if(LDNS_QDCOUNT(ldns_buffer_begin(pkt)) != 1) { + if(LDNS_QDCOUNT(sldns_buffer_begin(pkt)) != 1) { verbose(VERB_QUERY, "request wrong nr qd=%d", - LDNS_QDCOUNT(ldns_buffer_begin(pkt))); + LDNS_QDCOUNT(sldns_buffer_begin(pkt))); return LDNS_RCODE_FORMERR; } - if(LDNS_ANCOUNT(ldns_buffer_begin(pkt)) != 0) { + if(LDNS_ANCOUNT(sldns_buffer_begin(pkt)) != 0) { verbose(VERB_QUERY, "request wrong nr an=%d", - LDNS_ANCOUNT(ldns_buffer_begin(pkt))); + LDNS_ANCOUNT(sldns_buffer_begin(pkt))); return LDNS_RCODE_FORMERR; } - if(LDNS_NSCOUNT(ldns_buffer_begin(pkt)) != 0) { + if(LDNS_NSCOUNT(sldns_buffer_begin(pkt)) != 0) { verbose(VERB_QUERY, "request wrong nr ns=%d", - LDNS_NSCOUNT(ldns_buffer_begin(pkt))); + LDNS_NSCOUNT(sldns_buffer_begin(pkt))); return LDNS_RCODE_FORMERR; } - if(LDNS_ARCOUNT(ldns_buffer_begin(pkt)) > 1) { + if(LDNS_ARCOUNT(sldns_buffer_begin(pkt)) > 1) { verbose(VERB_QUERY, "request wrong nr ar=%d", - LDNS_ARCOUNT(ldns_buffer_begin(pkt))); + LDNS_ARCOUNT(sldns_buffer_begin(pkt))); return LDNS_RCODE_FORMERR; } return 0; @@ -361,7 +361,7 @@ worker_handle_control_cmd(struct tube* ATTR_UNUSED(tube), uint8_t* msg, if(len != sizeof(uint32_t)) { fatal_exit("bad control msg length %d", (int)len); } - cmd = ldns_read_uint32(msg); + cmd = sldns_read_uint32(msg); free(msg); switch(cmd) { case worker_cmd_quit: @@ -451,7 +451,7 @@ answer_norec_from_cache(struct worker* worker, struct query_info* qinfo, */ uint16_t udpsize = edns->udp_size; int secure = 0; - uint32_t timenow = *worker->env.now; + time_t timenow = *worker->env.now; int must_validate = (!(flags&BIT_CD) || worker->env.cfg->ignore_cd) && worker->env.need_to_validate; struct dns_msg *msg = NULL; @@ -526,7 +526,7 @@ answer_from_cache(struct worker* worker, struct query_info* qinfo, struct reply_info* rep, uint16_t id, uint16_t flags, struct comm_reply* repinfo, struct edns_data* edns) { - uint32_t timenow = *worker->env.now; + time_t timenow = *worker->env.now; uint16_t udpsize = edns->udp_size; int secure; int must_validate = (!(flags&BIT_CD) || worker->env.cfg->ignore_cd) @@ -616,7 +616,7 @@ answer_from_cache(struct worker* worker, struct query_info* qinfo, /** Reply to client and perform prefetch to keep cache up to date */ static void reply_and_prefetch(struct worker* worker, struct query_info* qinfo, - uint16_t flags, struct comm_reply* repinfo, uint32_t leeway) + uint16_t flags, struct comm_reply* repinfo, time_t leeway) { /* first send answer to client to keep its latency * as small as a cachereply */ @@ -638,32 +638,32 @@ reply_and_prefetch(struct worker* worker, struct query_info* qinfo, * @param edns: edns reply information. */ static void -chaos_replystr(ldns_buffer* pkt, const char* str, struct edns_data* edns) +chaos_replystr(sldns_buffer* pkt, const char* str, struct edns_data* edns) { size_t len = strlen(str); - unsigned int rd = LDNS_RD_WIRE(ldns_buffer_begin(pkt)); - unsigned int cd = LDNS_CD_WIRE(ldns_buffer_begin(pkt)); + unsigned int rd = LDNS_RD_WIRE(sldns_buffer_begin(pkt)); + unsigned int cd = LDNS_CD_WIRE(sldns_buffer_begin(pkt)); if(len>255) len=255; /* cap size of TXT record */ - ldns_buffer_clear(pkt); - ldns_buffer_skip(pkt, (ssize_t)sizeof(uint16_t)); /* skip id */ - ldns_buffer_write_u16(pkt, (uint16_t)(BIT_QR|BIT_RA)); - if(rd) LDNS_RD_SET(ldns_buffer_begin(pkt)); - if(cd) LDNS_CD_SET(ldns_buffer_begin(pkt)); - ldns_buffer_write_u16(pkt, 1); /* qdcount */ - ldns_buffer_write_u16(pkt, 1); /* ancount */ - ldns_buffer_write_u16(pkt, 0); /* nscount */ - ldns_buffer_write_u16(pkt, 0); /* arcount */ + sldns_buffer_clear(pkt); + sldns_buffer_skip(pkt, (ssize_t)sizeof(uint16_t)); /* skip id */ + sldns_buffer_write_u16(pkt, (uint16_t)(BIT_QR|BIT_RA)); + if(rd) LDNS_RD_SET(sldns_buffer_begin(pkt)); + if(cd) LDNS_CD_SET(sldns_buffer_begin(pkt)); + sldns_buffer_write_u16(pkt, 1); /* qdcount */ + sldns_buffer_write_u16(pkt, 1); /* ancount */ + sldns_buffer_write_u16(pkt, 0); /* nscount */ + sldns_buffer_write_u16(pkt, 0); /* arcount */ (void)query_dname_len(pkt); /* skip qname */ - ldns_buffer_skip(pkt, (ssize_t)sizeof(uint16_t)); /* skip qtype */ - ldns_buffer_skip(pkt, (ssize_t)sizeof(uint16_t)); /* skip qclass */ - ldns_buffer_write_u16(pkt, 0xc00c); /* compr ptr to query */ - ldns_buffer_write_u16(pkt, LDNS_RR_TYPE_TXT); - ldns_buffer_write_u16(pkt, LDNS_RR_CLASS_CH); - ldns_buffer_write_u32(pkt, 0); /* TTL */ - ldns_buffer_write_u16(pkt, sizeof(uint8_t) + len); - ldns_buffer_write_u8(pkt, len); - ldns_buffer_write(pkt, str, len); - ldns_buffer_flip(pkt); + sldns_buffer_skip(pkt, (ssize_t)sizeof(uint16_t)); /* skip qtype */ + sldns_buffer_skip(pkt, (ssize_t)sizeof(uint16_t)); /* skip qclass */ + sldns_buffer_write_u16(pkt, 0xc00c); /* compr ptr to query */ + sldns_buffer_write_u16(pkt, LDNS_RR_TYPE_TXT); + sldns_buffer_write_u16(pkt, LDNS_RR_CLASS_CH); + sldns_buffer_write_u32(pkt, 0); /* TTL */ + sldns_buffer_write_u16(pkt, sizeof(uint8_t) + len); + sldns_buffer_write_u8(pkt, len); + sldns_buffer_write(pkt, str, len); + sldns_buffer_flip(pkt); edns->edns_version = EDNS_ADVERTISED_VERSION; edns->udp_size = EDNS_ADVERTISED_SIZE; edns->bits &= EDNS_DO; @@ -680,7 +680,7 @@ chaos_replystr(ldns_buffer* pkt, const char* str, struct edns_data* edns) */ static int answer_chaos(struct worker* w, struct query_info* qinfo, - struct edns_data* edns, ldns_buffer* pkt) + struct edns_data* edns, sldns_buffer* pkt) { struct config_file* cfg = w->env.cfg; if(qinfo->qtype != LDNS_RR_TYPE_ANY && qinfo->qtype != LDNS_RR_TYPE_TXT) @@ -720,6 +720,52 @@ answer_chaos(struct worker* w, struct query_info* qinfo, return 0; } +static int +deny_refuse(struct comm_point* c, enum acl_access acl, + enum acl_access deny, enum acl_access refuse, + struct worker* worker, struct comm_reply* repinfo) +{ + if(acl == deny) { + comm_point_drop_reply(repinfo); + if(worker->stats.extended) + worker->stats.unwanted_queries++; + return 0; + } else if(acl == refuse) { + log_addr(VERB_ALGO, "refused query from", + &repinfo->addr, repinfo->addrlen); + log_buf(VERB_ALGO, "refuse", c->buffer); + if(worker->stats.extended) + worker->stats.unwanted_queries++; + if(worker_check_request(c->buffer, worker) == -1) { + comm_point_drop_reply(repinfo); + return 0; /* discard this */ + } + sldns_buffer_set_limit(c->buffer, LDNS_HEADER_SIZE); + sldns_buffer_write_at(c->buffer, 4, + (uint8_t*)"\0\0\0\0\0\0\0\0", 8); + LDNS_QR_SET(sldns_buffer_begin(c->buffer)); + LDNS_RCODE_SET(sldns_buffer_begin(c->buffer), + LDNS_RCODE_REFUSED); + return 1; + } + + return -1; +} + +static int +deny_refuse_all(struct comm_point* c, enum acl_access acl, + struct worker* worker, struct comm_reply* repinfo) +{ + return deny_refuse(c, acl, acl_deny, acl_refuse, worker, repinfo); +} + +static int +deny_refuse_non_local(struct comm_point* c, enum acl_access acl, + struct worker* worker, struct comm_reply* repinfo) +{ + return deny_refuse(c, acl, acl_deny_non_local, acl_refuse_non_local, worker, repinfo); +} + int worker_handle_request(struct comm_point* c, void* arg, int error, struct comm_reply* repinfo) @@ -739,35 +785,16 @@ worker_handle_request(struct comm_point* c, void* arg, int error, } acl = acl_list_lookup(worker->daemon->acl, &repinfo->addr, repinfo->addrlen); - if(acl == acl_deny) { - comm_point_drop_reply(repinfo); - if(worker->stats.extended) - worker->stats.unwanted_queries++; - return 0; - } else if(acl == acl_refuse) { - log_addr(VERB_ALGO, "refused query from", - &repinfo->addr, repinfo->addrlen); - log_buf(VERB_ALGO, "refuse", c->buffer); - if(worker->stats.extended) - worker->stats.unwanted_queries++; - if(worker_check_request(c->buffer, worker) == -1) { - comm_point_drop_reply(repinfo); - return 0; /* discard this */ - } - ldns_buffer_set_limit(c->buffer, LDNS_HEADER_SIZE); - ldns_buffer_write_at(c->buffer, 4, - (uint8_t*)"\0\0\0\0\0\0\0\0", 8); - LDNS_QR_SET(ldns_buffer_begin(c->buffer)); - LDNS_RCODE_SET(ldns_buffer_begin(c->buffer), - LDNS_RCODE_REFUSED); - return 1; + if((ret=deny_refuse_all(c, acl, worker, repinfo)) != -1) + { + return ret; } if((ret=worker_check_request(c->buffer, worker)) != 0) { verbose(VERB_ALGO, "worker check request: bad query."); log_addr(VERB_CLIENT,"from",&repinfo->addr, repinfo->addrlen); if(ret != -1) { - LDNS_QR_SET(ldns_buffer_begin(c->buffer)); - LDNS_RCODE_SET(ldns_buffer_begin(c->buffer), ret); + LDNS_QR_SET(sldns_buffer_begin(c->buffer)); + LDNS_RCODE_SET(sldns_buffer_begin(c->buffer), ret); return 1; } comm_point_drop_reply(repinfo); @@ -778,9 +805,9 @@ worker_handle_request(struct comm_point* c, void* arg, int error, if(!query_info_parse(&qinfo, c->buffer)) { verbose(VERB_ALGO, "worker parse request: formerror."); log_addr(VERB_CLIENT,"from",&repinfo->addr, repinfo->addrlen); - ldns_buffer_rewind(c->buffer); - LDNS_QR_SET(ldns_buffer_begin(c->buffer)); - LDNS_RCODE_SET(ldns_buffer_begin(c->buffer), + sldns_buffer_rewind(c->buffer); + LDNS_QR_SET(sldns_buffer_begin(c->buffer)); + LDNS_RCODE_SET(sldns_buffer_begin(c->buffer), LDNS_RCODE_FORMERR); server_stats_insrcode(&worker->stats, c->buffer); return 1; @@ -794,9 +821,9 @@ worker_handle_request(struct comm_point* c, void* arg, int error, qinfo.qtype == LDNS_RR_TYPE_IXFR) { verbose(VERB_ALGO, "worker request: refused zone transfer."); log_addr(VERB_CLIENT,"from",&repinfo->addr, repinfo->addrlen); - ldns_buffer_rewind(c->buffer); - LDNS_QR_SET(ldns_buffer_begin(c->buffer)); - LDNS_RCODE_SET(ldns_buffer_begin(c->buffer), + sldns_buffer_rewind(c->buffer); + LDNS_QR_SET(sldns_buffer_begin(c->buffer)); + LDNS_RCODE_SET(sldns_buffer_begin(c->buffer), LDNS_RCODE_REFUSED); if(worker->stats.extended) { worker->stats.qtype[qinfo.qtype]++; @@ -807,9 +834,9 @@ worker_handle_request(struct comm_point* c, void* arg, int error, if((ret=parse_edns_from_pkt(c->buffer, &edns)) != 0) { verbose(VERB_ALGO, "worker parse edns: formerror."); log_addr(VERB_CLIENT,"from",&repinfo->addr, repinfo->addrlen); - ldns_buffer_rewind(c->buffer); - LDNS_QR_SET(ldns_buffer_begin(c->buffer)); - LDNS_RCODE_SET(ldns_buffer_begin(c->buffer), ret); + sldns_buffer_rewind(c->buffer); + LDNS_QR_SET(sldns_buffer_begin(c->buffer)); + LDNS_RCODE_SET(sldns_buffer_begin(c->buffer), ret); server_stats_insrcode(&worker->stats, c->buffer); return 1; } @@ -821,8 +848,8 @@ worker_handle_request(struct comm_point* c, void* arg, int error, verbose(VERB_ALGO, "query with bad edns version."); log_addr(VERB_CLIENT,"from",&repinfo->addr, repinfo->addrlen); error_encode(c->buffer, EDNS_RCODE_BADVERS&0xf, &qinfo, - *(uint16_t*)(void *)ldns_buffer_begin(c->buffer), - ldns_buffer_read_u16_at(c->buffer, 2), NULL); + *(uint16_t*)(void *)sldns_buffer_begin(c->buffer), + sldns_buffer_read_u16_at(c->buffer, 2), NULL); attach_edns_record(c->buffer, &edns); return 1; } @@ -833,17 +860,25 @@ worker_handle_request(struct comm_point* c, void* arg, int error, log_addr(VERB_CLIENT,"from",&repinfo->addr, repinfo->addrlen); edns.udp_size = NORMAL_UDP_SIZE; } - if(edns.edns_present && edns.udp_size < LDNS_HEADER_SIZE) { + if(edns.udp_size > worker->daemon->cfg->max_udp_size && + c->type == comm_udp) { + verbose(VERB_QUERY, + "worker request: max UDP reply size modified" + " (%d to max-udp-size)", (int)edns.udp_size); + log_addr(VERB_CLIENT,"from",&repinfo->addr, repinfo->addrlen); + edns.udp_size = worker->daemon->cfg->max_udp_size; + } + if(edns.udp_size < LDNS_HEADER_SIZE) { verbose(VERB_ALGO, "worker request: edns is too small."); log_addr(VERB_CLIENT, "from", &repinfo->addr, repinfo->addrlen); - LDNS_QR_SET(ldns_buffer_begin(c->buffer)); - LDNS_TC_SET(ldns_buffer_begin(c->buffer)); - LDNS_RCODE_SET(ldns_buffer_begin(c->buffer), + LDNS_QR_SET(sldns_buffer_begin(c->buffer)); + LDNS_TC_SET(sldns_buffer_begin(c->buffer)); + LDNS_RCODE_SET(sldns_buffer_begin(c->buffer), LDNS_RCODE_SERVFAIL); - ldns_buffer_set_position(c->buffer, LDNS_HEADER_SIZE); - ldns_buffer_write_at(c->buffer, 4, + sldns_buffer_set_position(c->buffer, LDNS_HEADER_SIZE); + sldns_buffer_write_at(c->buffer, 4, (uint8_t*)"\0\0\0\0\0\0\0\0", 8); - ldns_buffer_flip(c->buffer); + sldns_buffer_flip(c->buffer); return 1; } if(worker->stats.extended) @@ -859,22 +894,32 @@ worker_handle_request(struct comm_point* c, void* arg, int error, if(local_zones_answer(worker->daemon->local_zones, &qinfo, &edns, c->buffer, worker->scratchpad)) { regional_free_all(worker->scratchpad); - if(ldns_buffer_limit(c->buffer) == 0) { + if(sldns_buffer_limit(c->buffer) == 0) { comm_point_drop_reply(repinfo); return 0; } server_stats_insrcode(&worker->stats, c->buffer); return 1; } - if(!(LDNS_RD_WIRE(ldns_buffer_begin(c->buffer))) && + + /* We've looked in our local zones. If the answer isn't there, we + * might need to bail out based on ACLs now. */ + if((ret=deny_refuse_non_local(c, acl, worker, repinfo)) != -1) + { + return ret; + } + + /* If this request does not have the recursion bit set, verify + * ACLs allow the snooping. */ + if(!(LDNS_RD_WIRE(sldns_buffer_begin(c->buffer))) && acl != acl_allow_snoop ) { - ldns_buffer_set_limit(c->buffer, LDNS_HEADER_SIZE); - ldns_buffer_write_at(c->buffer, 4, + sldns_buffer_set_limit(c->buffer, LDNS_HEADER_SIZE); + sldns_buffer_write_at(c->buffer, 4, (uint8_t*)"\0\0\0\0\0\0\0\0", 8); - LDNS_QR_SET(ldns_buffer_begin(c->buffer)); - LDNS_RCODE_SET(ldns_buffer_begin(c->buffer), + LDNS_QR_SET(sldns_buffer_begin(c->buffer)); + LDNS_RCODE_SET(sldns_buffer_begin(c->buffer), LDNS_RCODE_REFUSED); - ldns_buffer_flip(c->buffer); + sldns_buffer_flip(c->buffer); server_stats_insrcode(&worker->stats, c->buffer); log_addr(VERB_ALGO, "refused nonrec (cache snoop) query from", &repinfo->addr, repinfo->addrlen); @@ -885,17 +930,17 @@ worker_handle_request(struct comm_point* c, void* arg, int error, /* answer from cache - we have acquired a readlock on it */ if(answer_from_cache(worker, &qinfo, (struct reply_info*)e->data, - *(uint16_t*)(void *)ldns_buffer_begin(c->buffer), - ldns_buffer_read_u16_at(c->buffer, 2), repinfo, + *(uint16_t*)(void *)sldns_buffer_begin(c->buffer), + sldns_buffer_read_u16_at(c->buffer, 2), repinfo, &edns)) { /* prefetch it if the prefetch TTL expired */ if(worker->env.cfg->prefetch && *worker->env.now >= ((struct reply_info*)e->data)->prefetch_ttl) { - uint32_t leeway = ((struct reply_info*)e-> + time_t leeway = ((struct reply_info*)e-> data)->ttl - *worker->env.now; lock_rw_unlock(&e->lock); reply_and_prefetch(worker, &qinfo, - ldns_buffer_read_u16_at(c->buffer, 2), + sldns_buffer_read_u16_at(c->buffer, 2), repinfo, leeway); return 0; } @@ -905,17 +950,17 @@ worker_handle_request(struct comm_point* c, void* arg, int error, verbose(VERB_ALGO, "answer from the cache failed"); lock_rw_unlock(&e->lock); } - if(!LDNS_RD_WIRE(ldns_buffer_begin(c->buffer))) { + if(!LDNS_RD_WIRE(sldns_buffer_begin(c->buffer))) { if(answer_norec_from_cache(worker, &qinfo, - *(uint16_t*)(void *)ldns_buffer_begin(c->buffer), - ldns_buffer_read_u16_at(c->buffer, 2), repinfo, + *(uint16_t*)(void *)sldns_buffer_begin(c->buffer), + sldns_buffer_read_u16_at(c->buffer, 2), repinfo, &edns)) { return 1; } verbose(VERB_ALGO, "answer norec from cache -- " "need to validate or not primed"); } - ldns_buffer_rewind(c->buffer); + sldns_buffer_rewind(c->buffer); server_stats_querymiss(&worker->stats, worker); if(verbosity >= VERB_CLIENT) { @@ -928,8 +973,8 @@ worker_handle_request(struct comm_point* c, void* arg, int error, /* grab a work request structure for this new request */ mesh_new_client(worker->env.mesh, &qinfo, - ldns_buffer_read_u16_at(c->buffer, 2), &edns, repinfo, - *(uint16_t*)(void *)ldns_buffer_begin(c->buffer)); + sldns_buffer_read_u16_at(c->buffer, 2), + &edns, repinfo, *(uint16_t*)(void *)sldns_buffer_begin(c->buffer)); worker_mem_report(worker, NULL); return 0; } @@ -1113,7 +1158,7 @@ worker_init(struct worker* worker, struct config_file *cfg, worker->daemon->env->infra_cache, worker->rndstate, cfg->use_caps_bits_for_id, worker->ports, worker->numports, cfg->unwanted_threshold, &worker_alloc_cleanup, worker, - cfg->do_udp, worker->daemon->connect_sslctx); + cfg->do_udp, worker->daemon->connect_sslctx, cfg->delay_close); if(!worker->back) { log_err("could not create outgoing sockets"); worker_delete(worker); @@ -1159,7 +1204,7 @@ worker_init(struct worker* worker, struct config_file *cfg, worker->env.attach_sub = &mesh_attach_sub; worker->env.kill_sub = &mesh_state_delete; worker->env.detect_cycle = &mesh_detect_cycle; - worker->env.scratch_buffer = ldns_buffer_new(cfg->msg_buffer_size); + worker->env.scratch_buffer = sldns_buffer_new(cfg->msg_buffer_size); if(!(worker->env.fwds = forwards_create()) || !forwards_apply_cfg(worker->env.fwds, cfg)) { log_err("Could not set forward zones"); @@ -1222,7 +1267,7 @@ worker_delete(struct worker* worker) } outside_network_quit_prepare(worker->back); mesh_delete(worker->env.mesh); - ldns_buffer_free(worker->env.scratch_buffer); + sldns_buffer_free(worker->env.scratch_buffer); forwards_delete(worker->env.fwds); hints_delete(worker->env.hints); listen_delete(worker->front); @@ -1336,14 +1381,21 @@ void libworker_handle_control_cmd(struct tube* ATTR_UNUSED(tube), } void libworker_fg_done_cb(void* ATTR_UNUSED(arg), int ATTR_UNUSED(rcode), - ldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(s), + sldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(s), char* ATTR_UNUSED(why_bogus)) { log_assert(0); } void libworker_bg_done_cb(void* ATTR_UNUSED(arg), int ATTR_UNUSED(rcode), - ldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(s), + sldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(s), + char* ATTR_UNUSED(why_bogus)) +{ + log_assert(0); +} + +void libworker_event_done_cb(void* ATTR_UNUSED(arg), int ATTR_UNUSED(rcode), + sldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(s), char* ATTR_UNUSED(why_bogus)) { log_assert(0); diff --git a/contrib/unbound/daemon/worker.h b/contrib/unbound/daemon/worker.h index f0e8cf0d8f0..83503ae89e9 100644 --- a/contrib/unbound/daemon/worker.h +++ b/contrib/unbound/daemon/worker.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/doc/Changelog b/contrib/unbound/doc/Changelog index 346f02a764e..55650ae4826 100644 --- a/contrib/unbound/doc/Changelog +++ b/contrib/unbound/doc/Changelog @@ -1,5 +1,316 @@ +12 March 2014: Wouter + - tag 1.4.22 + +10 March 2014: Wouter + - Fix bug#561: contrib/cacti plugin did not report SERVFAIL rcodes + because of spelling. Patch from Chris Coates. + +27 February 2014: Wouter + - tag 1.4.22rc1 + +21 February 2014: Wouter + - iana portlist updated. + +20 February 2014: Matthijs + - Be lenient when a NSEC NameError response with RCODE=NXDOMAIN is + received. This is okay according 4035, but not after revising + existence in 4592. NSEC empty non-terminals exist and thus the + RCODE should have been NOERROR. If this occurs, and the RRsets + are secure, we set the RCODE to NOERROR and the security status + of the reponse is also considered secure. + +14 February 2014: Wouter + - Works on Minix (3.2.1). + +11 February 2014: Wouter + - Fix parse of #553(NSD) string in sldns, quotes without spaces. + +7 February 2014: Wouter + - iana portlist updated. + - add body to ifstatement if locks disabled. + - add TXT string"string" test case to unit test. + - Fix #551: License change "Regents" to "Copyright holder", matching + the BSD license on opensource.org. + +6 February 2014: Wouter + - sldns has type HIP. + - code documentation on the module interface. + +5 February 2014: Wouter + - Fix sldns parse tests on osx. + +3 February 2014: Wouter + - Detect libevent2 install automatically by configure. + - Fixup link with lib/event2 subdir. + - Fix parse in sldns of quoted parenthesized text strings. + +31 January 2014: Wouter + - unit test for ldns wire to str and back with zones, root, nlnetlabs + and types.sidnlabs. + - Fix for hex to string in unknown, atma and nsap. + - fixup nss compile (no ldns in it). + - fixup warning in unitldns + - fixup WKS and rdata type service to print unsigned because strings + are not portable; they cannot be read (for sure) on other computers. + - fixup type EUI48 and EUI64, type APL and type IPSECKEY in string + parse sldns. + +30 January 2014: Wouter + - delay-close does not act if there are udp-wait queries, so that + it does not make a socketdrain DoS easier. + +28 January 2014: Wouter + - iana portlist updated. + - iana portlist test updated so it does not touch the source + if there are no changes. + - delay-close: msec option that delays closing ports for which + the UDP reply has timed out. Keeps the port open, only accepts + the correct reply. This correct reply is not used, but the port + is open so that no port-denied ICMPs are generated. + +27 January 2014: Wouter + - reuseport is attempted, then fallback to without on failure. + +24 January 2014: Wouter + - Change unbound-event.h to use void* buffer, length idiom. + - iana portlist updated. + - unbound-event.h is installed if you configure --enable-event-api. + - speed up unbound (reports say it could be up to 10%), by reducing + lock contention on localzones.lock. It is changed to an rwlock. + - so-reuseport: yesno option to distribute queries evenly over + threads on Linux (Thanks Robert Edmonds). + - made lint clean. + +21 January 2014: Wouter + - Fix #547: no trustanchor written if filesystem full, fclose checked. + +17 January 2014: Wouter + - Fix isprint() portability in sldns, uses unsigned int. + - iana portlist updated. + +16 January 2014: Wouter + - fix #544: Fixed +i causes segfault when running with module conf + "iterator". + - Windows port, adjust %lld to %I64d, and warning in win_event.c. + +14 January 2014: Wouter + - iana portlist updated. + +5 Dec 2013: Wouter + - Fix bug in cachedump that uses sldns. + - update pythonmod for ldns_ to sldns_ name change. + +3 Dec 2013: Wouter + - Fix sldns to use sldns_ prefix for all ldns_ variables. + - Fix windows compile to compile with sldns. + +30 Nov 2013: Wouter + - Fix sldns to make globals use sldns_ prefix. This fixes + linking with libldns that uses global variables ldns_ . + +13 Nov 2013: Wouter + - Fix bug#537: compile python plugin without ldns library. + +12 Nov 2013: Wouter + - Fix bug#536: acl_deny_non_local and refuse_non_local added. + +5 Nov 2013: Wouter + - Patch from Neel Goyal to fix async id assignment if callback + is called by libunbound in the mesh attach. + - Accept ip-address: as an alternative for interface: for + consistency with nsd.conf syntax. + +4 Nov 2013: Wouter + - Patch from Neel Goyal to fix callback in libunbound. + +3 Nov 2013: Wouter + - if configured --with-libunbound-only fix make install. + +31 Oct 2013: Wouter + - Fix #531: Set SO_REUSEADDR so that the wildcard interface and a + more specific interface port 53 can be used at the same time, and + one of the daemons is unbound. + - iana portlist update. + - separate ldns into core ldns inside ldns/ subdirectory. No more + --with-ldns is needed and unbound does not rely on libldns. + - portability fixes for new USE_SLDNS ldns subdir codebase. + +22 Oct 2013: Wouter + - Patch from Neel Goyal: Add an API call to set an event base on an + existing ub_ctx. This basically just destroys the current worker and + sets the event base to the current. And fix a deadlock in + ub_resolve_event – the cfglock is held when libworker_create is + called. This ends up trying to acquire the lock again in + context_obtain_alloc in the call chain. + - Fix #528: if very high logging (4 or more) segfault on allow_snoop. + +26 Sep 2013: Wouter + - unbound-event.h is installed if configured --with-libevent. It + contains low-level library calls, that use libevent's event_base + and an ldns_buffer for the wire return packet to perform async + resolution in the client's eventloop. + +19 Sep 2013: Wouter + - 1.4.21 tag created. + - trunk has 1.4.22 number inside it. + - iana portlist updated. + - acx_nlnetlabs.m4 to 26; improve FLTO help text. + +16 Sep 2013: Wouter + - Fix#524: max-udp-size not effective to non-EDNS0 queries, from + Daisuke HIGASHI. + +10 Sep 2013: Wouter + - MIN_TTL and MAX_TTL also in time_t. + - tag 1.4.21rc1 made again. + +26 Aug 2013: Wouter + - More fixes for bug#519: for the threaded case test if the bg + thread has been killed, on ub_ctx_delete, to avoid hangs. + +22 Aug 2013: Wouter + - more fixes that I overlooked. + - review fixes from Willem. + +21 Aug 2013: Wouter + - Fix#520: Errors found by static analysis from Tomas Hozza(redhat). + +20 Aug 2013: Wouter + - Fix for 2038, with time_t instead of uint32_t. + +19 Aug 2013: Wouter + - Fix#519 ub_ctx_delete may hang in some scenarios (libunbound). + +14 Aug 2013: Wouter + - Fix uninit variable in fix#516. + +8 Aug 2013: Wouter + - Fix#516 dnssec lameness detection for answers that are improper. + +30 Jun 2013: Wouter + - tag 1.4.21rc1 + +29 Jun 2013: Wouter + - Fix#512 memleak in testcode for testbound (if it fails). + - Fix#512 NSS returned arrays out of setup function to be statics. + +26 Jun 2013: Wouter + - max include of 100.000 files (depth and globbed at one time). + This is to preserve system memory in bug cases, or endless cases. + - iana portlist updated. + +19 Jun 2013: Wouter + - streamtcp man page, contributed by Tomas Hozza. + - iana portlist updated. + - libunbound documentation on how to avoid openssl race conditions. + +25 Jun 2013: Wouter + - Squelch sendto-permission denied errors when the network is + not connected, to avoid spamming syslog. + - configure --disable-flto option (from Robert Edmonds). + +18 Jun 2013: Wouter + - Fix for const string literals in C++ for libunbound, from Karel + Slany. + - iana portlist updated. + +17 Jun 2013: Wouter + - Fixup manpage syntax. + +14 Jun 2013: Wouter + - get_option and set_option support for log-time-ascii, python-script + val-sig-skew-min and val-sig-skew-max. log-time-ascii takes effect + immediately. The others are mostly useful for libunbound users. + +13 Jun 2013: Wouter + - get_option, set_option, unbound-checkconf -o and libunbound + getoption and setoption support cache-min-ttl and cache-max-ttl. + +10 Jun 2013: Wouter + - Fix#501: forward-first does not recurse, when forward name is ".". + - iana portlist update. + - Max include depth is unlimited. + +27 May 2013: Wouter + - Update acx_pthreads.m4 to ax_pthreads.4 (2013-03-29), and apply + patch to it to not fail when -Werror is also specified, from the + autoconf-archives. + - iana portlist update. + +21 May 2013: Wouter + - Explain bogus and secure flags in libunbound more. + +16 May 2013: Wouter + - Fix#499 use-after-free in out-of-memory handling code (thanks Jake + Montgomery). + - Fix#500 use on non-initialised values on socket bind failures. + +15 May 2013: Wouter + - Fix round-robin doesn't work with some Windows clients (from Ilya + Bakulin). + +3 May 2013: Wouter + - update acx_nlnetlabs.m4 to v23, sleep w32 fix. + +26 April 2013: Wouter + - add unbound-control insecure_add and insecure_remove for the + administration of negative trust anchors. + +25 April 2013: Wouter + - Implement max-udp-size config option, default 4096 (thanks + Daisuke Higashi). + - Robust checks on dname validity from rdata for dname compare. + - updated iana portlist. + +19 April 2013: Wouter + - Fixup snprintf return value usage, fixed libunbound_get_option. + +18 April 2013: Wouter + - fix bug #491: pick program name (0th argument) as syslog identity. + - own implementation of compat/snprintf.c. + +15 April 2013: Wouter + - Fix so that for a configuration line of include: "*.conf" it is not + an error if there are no files matching the glob pattern. + - unbound-anchor review: BIO_write can return 0 successfully if it + has successfully appended a zero length string. + +11 April 2013: Wouter + - Fix queries leaking up for stubs and forwards, if the configured + nameservers all fail to answer. + +10 April 2013: Wouter + - code improve for minimal responses, small speed increase. + +9 April 2013: Wouter + - updated iana portlist. + - Fix crash in previous private address fixup of 22 March. + +28 March 2013: Wouter + - Make reverse zones easier by documenting the nodefault statements + commented-out in the example config file. + +26 March 2013: Wouter + - more fixes to lookup3.c endianness detection. + +25 March 2013: Wouter + - #492: Fix endianness detection, revert to older lookup3.c detection + and put new detect lines after previous tests, to avoid regressions + but allow new detections to succeed. + And add detection for machine/endian.h to it. + +22 March 2013: Wouter + - Fix resolve of names that use a mix of public and private addresses. + - iana portlist update. + - Fix makedist for new svn for -d option. + - unbound.h header file has UNBOUND_VERSION_MAJOR define. + - Fix windows RSRC version for long version numbers. + 21 March 2013: Wouter - release 1.4.20 + - trunk has 1.4.21 + - committed libunbound version 4:1:2 for binary API updated in 1.4.20 + - install copy of unbound-control.8 man page for unbound-control-setup 14 March 2013: Wouter - iana portlist update. diff --git a/contrib/unbound/doc/FEATURES b/contrib/unbound/doc/FEATURES index 93ed2925718..076988ea912 100644 --- a/contrib/unbound/doc/FEATURES +++ b/contrib/unbound/doc/FEATURES @@ -99,4 +99,5 @@ SSHFP type 4701: DHCID 5155: NSEC3, NSEC3PARAM 4408: SPF +6944: DNSKEY algorithm status diff --git a/contrib/unbound/doc/LICENSE b/contrib/unbound/doc/LICENSE index c248049fb8d..1859c095a5b 100644 --- a/contrib/unbound/doc/LICENSE +++ b/contrib/unbound/doc/LICENSE @@ -18,13 +18,13 @@ be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. +"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 COPYRIGHT +HOLDER 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. diff --git a/contrib/unbound/doc/README b/contrib/unbound/doc/README index c8c69c1aa2b..badc60fc48a 100644 --- a/contrib/unbound/doc/README +++ b/contrib/unbound/doc/README @@ -1,4 +1,4 @@ -README for Unbound 1.4.20 +README for Unbound 1.4.22 Copyright 2007 NLnet Labs http://unbound.net @@ -10,14 +10,11 @@ This software is under BSD license, see LICENSE for details. http://unbound.net/svn/ * Uses the following libraries; - * ldns http://www.nlnetlabs.nl/ldns/ (BSD license) - (required) can use ldns build directory directly with --with-ldns=path. * libevent http://www.monkey.org/~provos/libevent/ (BSD license) (optional) can use builtin alternative instead. + * libexpat (for the unbound-anchor helper program) (MIT license) * Make and install: ./configure; make; make install - * --with-ldns=/path/to/ldns - It will dynamically link against it. * --with-libevent=/path/to/libevent Can be set to either the system install or the build directory. --with-libevent=no (default) gives a builtin alternative @@ -36,8 +33,8 @@ This software is under BSD license, see LICENSE for details. programming errors, among which buffer overflows. The program exits with an error if an assertion fails (but the buffer did not overflow). * --enable-static-exe - This enables a debug option to statically link, against ldns and - libevent libraries. + This enables a debug option to statically link against the + libevent library. * --enable-lock-checks This enables a debug option to check lock and unlock calls. It needs a recent pthreads library to work. diff --git a/contrib/unbound/doc/example.conf.in b/contrib/unbound/doc/example.conf.in index aa9a7f7d44d..9e91d1f8919 100644 --- a/contrib/unbound/doc/example.conf.in +++ b/contrib/unbound/doc/example.conf.in @@ -1,7 +1,7 @@ # # Example configuration file. # -# See unbound.conf(5) man page, version 1.4.20. +# See unbound.conf(5) man page, version 1.4.22. # # this is a comment. @@ -84,11 +84,18 @@ server: # buffer size for UDP port 53 outgoing (SO_SNDBUF socket option). # 0 is system default. Use 4m to handle spikes on very busy servers. # so-sndbuf: 0 + + # on Linux(3.9+) use SO_REUSEPORT to distribute queries over threads. + # so-reuseport: no # EDNS reassembly buffer to advertise to UDP peers (the actual buffer # is set with msg-buffer-size). 1480 can solve fragmentation (timeouts). # edns-buffer-size: 4096 + # Maximum UDP response size (not applied to TCP response). + # Suggested values are 512 to 4096. Default is 4096. 65536 disables it. + # max-udp-size: 4096 + # buffer size for handling DNS data. No messages larger than this # size can be sent or received, by UDP or TCP. In bytes. # msg-buffer-size: 65552 @@ -107,6 +114,9 @@ server: # if very busy, 50% queries run to completion, 50% get timeout in msec # jostle-timeout: 200 + + # msec to wait before close of port on timeout UDP. 0 disables. + # delay-close: 0 # the amount of memory to use for the RRset cache. # plain value in bytes or you can append k, m or G. default is "4Mb". @@ -161,6 +171,8 @@ server: # By default everything is refused, except for localhost. # Choose deny (drop message), refuse (polite error reply), # allow (recursive ok), allow_snoop (recursive and nonrecursive ok) + # deny_non_local (drop queries unless can be answered from local-data) + # refuse_non_local (like deny_non_local but polite error reply). # access-control: 0.0.0.0/0 refuse # access-control: 127.0.0.0/8 allow # access-control: ::0/0 refuse @@ -425,6 +437,54 @@ server: # the amount of memory to use for the negative cache (used for DLV). # plain value in bytes or you can append k, m or G. default is "1Mb". # neg-cache-size: 1m + + # if unbound is running service for the local host then it is useful + # to perform lan-wide lookups to the upstream, and unblock the + # long list of local-zones above. If this unbound is a dns server + # for a network of computers, disabled is better and stops information + # leakage of local lan information. + # unblock-lan-zones: no + + # By default, for a number of zones a small default 'nothing here' + # reply is built-in. Query traffic is thus blocked. If you + # wish to serve such zone you can unblock them by uncommenting one + # of the nodefault statements below. + # You may also have to use domain-insecure: zone to make DNSSEC work, + # unless you have your own trust anchors for this zone. + # local-zone: "localhost." nodefault + # local-zone: "127.in-addr.arpa." nodefault + # local-zone: "1.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.ip6.arpa." nodefault + # local-zone: "10.in-addr.arpa." nodefault + # local-zone: "16.172.in-addr.arpa." nodefault + # local-zone: "17.172.in-addr.arpa." nodefault + # local-zone: "18.172.in-addr.arpa." nodefault + # local-zone: "19.172.in-addr.arpa." nodefault + # local-zone: "20.172.in-addr.arpa." nodefault + # local-zone: "21.172.in-addr.arpa." nodefault + # local-zone: "22.172.in-addr.arpa." nodefault + # local-zone: "23.172.in-addr.arpa." nodefault + # local-zone: "24.172.in-addr.arpa." nodefault + # local-zone: "25.172.in-addr.arpa." nodefault + # local-zone: "26.172.in-addr.arpa." nodefault + # local-zone: "27.172.in-addr.arpa." nodefault + # local-zone: "28.172.in-addr.arpa." nodefault + # local-zone: "29.172.in-addr.arpa." nodefault + # local-zone: "30.172.in-addr.arpa." nodefault + # local-zone: "31.172.in-addr.arpa." nodefault + # local-zone: "168.192.in-addr.arpa." nodefault + # local-zone: "0.in-addr.arpa." nodefault + # local-zone: "254.169.in-addr.arpa." nodefault + # local-zone: "2.0.192.in-addr.arpa." nodefault + # local-zone: "100.51.198.in-addr.arpa." nodefault + # local-zone: "113.0.203.in-addr.arpa." nodefault + # local-zone: "255.255.255.255.in-addr.arpa." nodefault + # local-zone: "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.ip6.arpa." nodefault + # local-zone: "d.f.ip6.arpa." nodefault + # local-zone: "8.e.f.ip6.arpa." nodefault + # local-zone: "9.e.f.ip6.arpa." nodefault + # local-zone: "a.e.f.ip6.arpa." nodefault + # local-zone: "b.e.f.ip6.arpa." nodefault + # local-zone: "8.b.d.0.1.0.0.2.ip6.arpa." nodefault # a number of locally served zones can be configured. # local-zone: diff --git a/contrib/unbound/doc/libunbound.3 b/contrib/unbound/doc/libunbound.3 index 0f6f0c6c294..52c0a53917e 100644 --- a/contrib/unbound/doc/libunbound.3 +++ b/contrib/unbound/doc/libunbound.3 @@ -1,4 +1,4 @@ -.TH "libunbound" "3" "Mar 21, 2013" "NLnet Labs" "unbound 1.4.20" +.TH "libunbound" "3" "Mar 12, 2014" "NLnet Labs" "unbound 1.4.22" .\" .\" libunbound.3 -- unbound library functions manual .\" @@ -42,7 +42,7 @@ .B ub_ctx_zone_remove, .B ub_ctx_data_add, .B ub_ctx_data_remove -\- Unbound DNS validating resolver 1.4.20 functions. +\- Unbound DNS validating resolver 1.4.22 functions. .SH "SYNOPSIS" .LP .B #include @@ -171,6 +171,9 @@ by default. Use and .B ub_ctx_hosts to read them. +Before you call this, use the openssl functions CRYPTO_set_id_callback and +CRYPTO_set_locking_callback to set up asyncronous operation if you use +lib openssl (the application calls these functions once for initialisation). .TP .B ub_ctx_delete Delete validation context and free associated resources. @@ -364,7 +367,7 @@ The result of the DNS resolution and validation is returned as .fi .P If both secure and bogus are false, security was not enabled for the -domain of the query. +domain of the query. Else, they are not both true, one of them is true. .SH "RETURN VALUES" Many routines return an error code. The value 0 (zero) denotes no error happened. Other values can be passed to diff --git a/contrib/unbound/doc/libunbound.3.in b/contrib/unbound/doc/libunbound.3.in index 0f6f0c6c294..52c0a53917e 100644 --- a/contrib/unbound/doc/libunbound.3.in +++ b/contrib/unbound/doc/libunbound.3.in @@ -1,4 +1,4 @@ -.TH "libunbound" "3" "Mar 21, 2013" "NLnet Labs" "unbound 1.4.20" +.TH "libunbound" "3" "Mar 12, 2014" "NLnet Labs" "unbound 1.4.22" .\" .\" libunbound.3 -- unbound library functions manual .\" @@ -42,7 +42,7 @@ .B ub_ctx_zone_remove, .B ub_ctx_data_add, .B ub_ctx_data_remove -\- Unbound DNS validating resolver 1.4.20 functions. +\- Unbound DNS validating resolver 1.4.22 functions. .SH "SYNOPSIS" .LP .B #include @@ -171,6 +171,9 @@ by default. Use and .B ub_ctx_hosts to read them. +Before you call this, use the openssl functions CRYPTO_set_id_callback and +CRYPTO_set_locking_callback to set up asyncronous operation if you use +lib openssl (the application calls these functions once for initialisation). .TP .B ub_ctx_delete Delete validation context and free associated resources. @@ -364,7 +367,7 @@ The result of the DNS resolution and validation is returned as .fi .P If both secure and bogus are false, security was not enabled for the -domain of the query. +domain of the query. Else, they are not both true, one of them is true. .SH "RETURN VALUES" Many routines return an error code. The value 0 (zero) denotes no error happened. Other values can be passed to diff --git a/contrib/unbound/doc/unbound-anchor.8 b/contrib/unbound/doc/unbound-anchor.8 index 4c9c6a7d4ef..27bb5a6d290 100644 --- a/contrib/unbound/doc/unbound-anchor.8 +++ b/contrib/unbound/doc/unbound-anchor.8 @@ -1,4 +1,4 @@ -.TH "unbound-anchor" "8" "Mar 21, 2013" "NLnet Labs" "unbound 1.4.20" +.TH "unbound-anchor" "8" "Mar 12, 2014" "NLnet Labs" "unbound 1.4.22" .\" .\" unbound-anchor.8 -- unbound anchor maintenance utility manual .\" diff --git a/contrib/unbound/doc/unbound-anchor.8.in b/contrib/unbound/doc/unbound-anchor.8.in index 0b5e5a0bf2a..41b18ed5382 100644 --- a/contrib/unbound/doc/unbound-anchor.8.in +++ b/contrib/unbound/doc/unbound-anchor.8.in @@ -1,4 +1,4 @@ -.TH "unbound-anchor" "8" "Mar 21, 2013" "NLnet Labs" "unbound 1.4.20" +.TH "unbound-anchor" "8" "Mar 12, 2014" "NLnet Labs" "unbound 1.4.22" .\" .\" unbound-anchor.8 -- unbound anchor maintenance utility manual .\" diff --git a/contrib/unbound/doc/unbound-checkconf.8 b/contrib/unbound/doc/unbound-checkconf.8 index 768bda5cf74..2ed61244604 100644 --- a/contrib/unbound/doc/unbound-checkconf.8 +++ b/contrib/unbound/doc/unbound-checkconf.8 @@ -1,4 +1,4 @@ -.TH "unbound-checkconf" "8" "Mar 21, 2013" "NLnet Labs" "unbound 1.4.20" +.TH "unbound-checkconf" "8" "Mar 12, 2014" "NLnet Labs" "unbound 1.4.22" .\" .\" unbound-checkconf.8 -- unbound configuration checker manual .\" diff --git a/contrib/unbound/doc/unbound-checkconf.8.in b/contrib/unbound/doc/unbound-checkconf.8.in index 4ae174f2255..69e0b4f439b 100644 --- a/contrib/unbound/doc/unbound-checkconf.8.in +++ b/contrib/unbound/doc/unbound-checkconf.8.in @@ -1,4 +1,4 @@ -.TH "unbound-checkconf" "8" "Mar 21, 2013" "NLnet Labs" "unbound 1.4.20" +.TH "unbound-checkconf" "8" "Mar 12, 2014" "NLnet Labs" "unbound 1.4.22" .\" .\" unbound-checkconf.8 -- unbound configuration checker manual .\" diff --git a/contrib/unbound/doc/unbound-control.8 b/contrib/unbound/doc/unbound-control.8 index 5b3559d36fb..4f1a1cfba2b 100644 --- a/contrib/unbound/doc/unbound-control.8 +++ b/contrib/unbound/doc/unbound-control.8 @@ -1,4 +1,4 @@ -.TH "unbound-control" "8" "Mar 21, 2013" "NLnet Labs" "unbound 1.4.20" +.TH "unbound-control" "8" "Mar 12, 2014" "NLnet Labs" "unbound 1.4.22" .\" .\" unbound-control.8 -- unbound remote control manual .\" @@ -170,7 +170,7 @@ harden\-glue, harden\-dnssec\-stripped, harden\-below\-nxdomain, harden\-referral\-path, prefetch, prefetch\-key, log\-queries, hide\-identity, hide\-version, identity, version, val\-log\-level, val\-log\-squelch, ignore\-cd\-flag, add\-holddown, del\-holddown, -keep\-missing, tcp\-upstream, ssl\-upstream. +keep\-missing, tcp\-upstream, ssl\-upstream, max\-udp\-size. .TP .B get_option \fIopt Get the value of the option. Give the option name without a trailing ':'. @@ -196,6 +196,14 @@ List the local zones in use. These are printed one per line with zone type. .B list_local_data List the local data RRs in use. The resource records are printed. .TP +.B insecure_add \fIzone +Add a \fBdomain\-insecure\fR for the given zone, like the statement in unbound.conf. +Adds to the running unbound without affecting the cache contents (which may +still be bogus, use \fBflush_zone\fR to remove it), does not affect the config file. +.TP +.B insecure_remove \fIzone +Removes domain\-insecure for the given zone. +.TP .B forward_add \fR[\fI+i\fR] \fIzone addr ... Add a new forward zone to running unbound. With +i option also adds a \fIdomain\-insecure\fR for the zone (so it can resolve insecurely if you have diff --git a/contrib/unbound/doc/unbound-control.8.in b/contrib/unbound/doc/unbound-control.8.in index 669e81dfd75..e57231c205f 100644 --- a/contrib/unbound/doc/unbound-control.8.in +++ b/contrib/unbound/doc/unbound-control.8.in @@ -1,4 +1,4 @@ -.TH "unbound-control" "8" "Mar 21, 2013" "NLnet Labs" "unbound 1.4.20" +.TH "unbound-control" "8" "Mar 12, 2014" "NLnet Labs" "unbound 1.4.22" .\" .\" unbound-control.8 -- unbound remote control manual .\" @@ -170,7 +170,7 @@ harden\-glue, harden\-dnssec\-stripped, harden\-below\-nxdomain, harden\-referral\-path, prefetch, prefetch\-key, log\-queries, hide\-identity, hide\-version, identity, version, val\-log\-level, val\-log\-squelch, ignore\-cd\-flag, add\-holddown, del\-holddown, -keep\-missing, tcp\-upstream, ssl\-upstream. +keep\-missing, tcp\-upstream, ssl\-upstream, max\-udp\-size. .TP .B get_option \fIopt Get the value of the option. Give the option name without a trailing ':'. @@ -196,6 +196,14 @@ List the local zones in use. These are printed one per line with zone type. .B list_local_data List the local data RRs in use. The resource records are printed. .TP +.B insecure_add \fIzone +Add a \fBdomain\-insecure\fR for the given zone, like the statement in unbound.conf. +Adds to the running unbound without affecting the cache contents (which may +still be bogus, use \fBflush_zone\fR to remove it), does not affect the config file. +.TP +.B insecure_remove \fIzone +Removes domain\-insecure for the given zone. +.TP .B forward_add \fR[\fI+i\fR] \fIzone addr ... Add a new forward zone to running unbound. With +i option also adds a \fIdomain\-insecure\fR for the zone (so it can resolve insecurely if you have diff --git a/contrib/unbound/doc/unbound-host.1 b/contrib/unbound/doc/unbound-host.1 index 4957705cd88..1c8c42d587c 100644 --- a/contrib/unbound/doc/unbound-host.1 +++ b/contrib/unbound/doc/unbound-host.1 @@ -1,4 +1,4 @@ -.TH "unbound\-host" "1" "Mar 21, 2013" "NLnet Labs" "unbound 1.4.20" +.TH "unbound\-host" "1" "Mar 12, 2014" "NLnet Labs" "unbound 1.4.22" .\" .\" unbound-host.1 -- unbound DNS lookup utility .\" diff --git a/contrib/unbound/doc/unbound.8 b/contrib/unbound/doc/unbound.8 index 09fcc6abb89..9c04538fed3 100644 --- a/contrib/unbound/doc/unbound.8 +++ b/contrib/unbound/doc/unbound.8 @@ -1,4 +1,4 @@ -.TH "unbound" "8" "Mar 21, 2013" "NLnet Labs" "unbound 1.4.20" +.TH "unbound" "8" "Mar 12, 2014" "NLnet Labs" "unbound 1.4.22" .\" .\" unbound.8 -- unbound manual .\" @@ -10,7 +10,7 @@ .SH "NAME" .LP .B unbound -\- Unbound DNS validating resolver 1.4.20. +\- Unbound DNS validating resolver 1.4.22. .SH "SYNOPSIS" .LP .B unbound diff --git a/contrib/unbound/doc/unbound.8.in b/contrib/unbound/doc/unbound.8.in index 5d84d9a781b..fd67e71856b 100644 --- a/contrib/unbound/doc/unbound.8.in +++ b/contrib/unbound/doc/unbound.8.in @@ -1,4 +1,4 @@ -.TH "unbound" "8" "Mar 21, 2013" "NLnet Labs" "unbound 1.4.20" +.TH "unbound" "8" "Mar 12, 2014" "NLnet Labs" "unbound 1.4.22" .\" .\" unbound.8 -- unbound manual .\" @@ -10,7 +10,7 @@ .SH "NAME" .LP .B unbound -\- Unbound DNS validating resolver 1.4.20. +\- Unbound DNS validating resolver 1.4.22. .SH "SYNOPSIS" .LP .B unbound diff --git a/contrib/unbound/doc/unbound.conf.5 b/contrib/unbound/doc/unbound.conf.5 index 1b399a400d7..a106733c430 100644 --- a/contrib/unbound/doc/unbound.conf.5 +++ b/contrib/unbound/doc/unbound.conf.5 @@ -1,4 +1,4 @@ -.TH "unbound.conf" "5" "Mar 21, 2013" "NLnet Labs" "unbound 1.4.20" +.TH "unbound.conf" "5" "Mar 12, 2014" "NLnet Labs" "unbound 1.4.22" .\" .\" unbound.conf.5 -- unbound.conf manual .\" @@ -122,6 +122,9 @@ A port number can be specified with @port (without spaces between interface and port number), if not specified the default port (from \fBport\fR) is used. .TP +.B ip\-address: \fI +Same as interface: (for easy of compatibility with nsd.conf). +.TP .B interface\-automatic: \fI Detect source interface on UDP queries and copy them to replies. This feature is experimental, and needs support in your OS for particular socket @@ -183,6 +186,11 @@ stringent path MTU problems, but is seen as extreme, since the amount of TCP fallback generated is excessive (probably also for this resolver, consider tuning the outgoing tcp number). .TP +.B max\-udp\-size: \fI +Maximum UDP response size (not applied to TCP response). 65536 disables the +udp response size maximum, and uses the choice from the client, always. +Suggested values are 512 to 4096. Default is 4096. +.TP .B msg\-buffer\-size: \fI Number of bytes size of the message buffers. Default is 65552 bytes, enough for 64 Kb packets, the maximum DNS message size. No message larger than this @@ -220,6 +228,15 @@ The qps for short queries can be about (numqueriesperthread / 2) / (jostletimeout in whole seconds) qps per thread, about (1024/2)*5 = 2560 qps by default. .TP +.B delay\-close: \fI +Extra delay for timeouted UDP ports before they are closed, in msec. +Default is 0, and that disables it. This prevents very delayed answer +packets from the upstream (recursive) servers from bouncing against +closed ports and setting off all sort of close-port counters, with +eg. 1500 msec. When timeouts happen you need extra sockets, it checks +the ID and remote IP of packets, and unwanted packets are added to the +unwanted packet counter. +.TP .B so\-rcvbuf: \fI If not 0, then set the SO_RCVBUF socket option to get more buffer space on UDP port 53 incoming queries. So that short spikes on busy @@ -242,6 +259,15 @@ linux unbound needs root permission to bypass the limit, or the admin can use sysctl net.core.wmem_max. On BSD, Solaris changes are similar to so\-rcvbuf. .TP +.B so\-reuseport: \fI +If yes, then open dedicated listening sockets for incoming queries for each +thread and try to set the SO_REUSEPORT socket option on each socket. May +distribute incoming queries to threads more evenly. Default is no. Only +supported on Linux >= 3.9. You can enable it (on any platform and kernel), +it then attempts to open the port and passes the option if it was available +at compile time, if that works it is used, if it fails, it continues +silently (unless verbosity 3) without the option. +.TP .B rrset\-cache\-size: \fI Number of bytes size of the RRset cache. Default is 4 megabytes. A plain number is in bytes, append 'k', 'm' or 'g' for kilobytes, megabytes @@ -326,7 +352,7 @@ a daemon. Default is yes. .B access\-control: \fI The netblock is given as an IP4 or IP6 address with /size appended for a classless network block. The action can be \fIdeny\fR, \fIrefuse\fR, -\fIallow\fR or \fIallow_snoop\fR. +\fIallow\fR, \fIallow_snoop\fR, \fIdeny_non_local\fR or \fIrefuse_non_local\fR. .IP The action \fIdeny\fR stops queries from hosts from that netblock. .IP @@ -355,6 +381,12 @@ By default only localhost is \fIallow\fRed, the rest is \fIrefuse\fRd. The default is \fIrefuse\fRd, because that is protocol\-friendly. The DNS protocol is not designed to handle dropped packets due to policy, and dropping may result in (possibly excessive) retried queries. +.IP +The deny_non_local and refuse_non_local settings are for hosts that are +only allowed to query for the authoritative local\-data, they are not +allowed full recursion but only the static data. With deny_non_local, +messages that are disallowed are dropped, with refuse_non_local they +receive error code REFUSED. .TP .B chroot: \fI If chroot is enabled, you should pass the configfile (from the @@ -492,7 +524,7 @@ unsigned to badly signed often. If turned off you run the risk of a downgrade attack that disables security for a zone. Default is on. .TP .B harden\-below\-nxdomain: \fI -From draft-vixie-dnsext-resimprove, returns nxdomain to queries for a name +From draft\-vixie\-dnsext\-resimprove, returns nxdomain to queries for a name below another name that is already known to be nxdomain. DNSSEC mandates noerror for empty nonterminals, hence this is possible. Very old software might return nxdomain for empty nonterminals (that usually happen for reverse @@ -746,6 +778,17 @@ Number of bytes size of the aggressive negative cache. Default is 1 megabyte. A plain number is in bytes, append 'k', 'm' or 'g' for kilobytes, megabytes or gigabytes (1024*1024 bytes in a megabyte). .TP +.B unblock\-lan\-zones: \fI +Default is disabled. If enabled, then for private address space, +the reverse lookups are no longer filtered. This allows unbound when +running as dns service on a host where it provides service for that host, +to put out all of the queries for the 'lan' upstream. When enabled, +only localhost, 127.0.0.1 reverse and ::1 reverse zones are configured +with default local zones. Disable the option when unbound is running +as a (DHCP-) DNS network resolver for a group of machines, where such +lookups should be filtered (RFC compliance), this also stops potential +data leakage about the local network to the upstream DNS servers. +.TP .B local\-zone: \fI Configure a local zone. The type determines the answer to give if there is no match from local\-data. The types are deny, refuse, static, diff --git a/contrib/unbound/doc/unbound.conf.5.in b/contrib/unbound/doc/unbound.conf.5.in index 6dd0216d036..aadd0daa0ee 100644 --- a/contrib/unbound/doc/unbound.conf.5.in +++ b/contrib/unbound/doc/unbound.conf.5.in @@ -1,4 +1,4 @@ -.TH "unbound.conf" "5" "Mar 21, 2013" "NLnet Labs" "unbound 1.4.20" +.TH "unbound.conf" "5" "Mar 12, 2014" "NLnet Labs" "unbound 1.4.22" .\" .\" unbound.conf.5 -- unbound.conf manual .\" @@ -122,6 +122,9 @@ A port number can be specified with @port (without spaces between interface and port number), if not specified the default port (from \fBport\fR) is used. .TP +.B ip\-address: \fI +Same as interface: (for easy of compatibility with nsd.conf). +.TP .B interface\-automatic: \fI Detect source interface on UDP queries and copy them to replies. This feature is experimental, and needs support in your OS for particular socket @@ -183,6 +186,11 @@ stringent path MTU problems, but is seen as extreme, since the amount of TCP fallback generated is excessive (probably also for this resolver, consider tuning the outgoing tcp number). .TP +.B max\-udp\-size: \fI +Maximum UDP response size (not applied to TCP response). 65536 disables the +udp response size maximum, and uses the choice from the client, always. +Suggested values are 512 to 4096. Default is 4096. +.TP .B msg\-buffer\-size: \fI Number of bytes size of the message buffers. Default is 65552 bytes, enough for 64 Kb packets, the maximum DNS message size. No message larger than this @@ -220,6 +228,15 @@ The qps for short queries can be about (numqueriesperthread / 2) / (jostletimeout in whole seconds) qps per thread, about (1024/2)*5 = 2560 qps by default. .TP +.B delay\-close: \fI +Extra delay for timeouted UDP ports before they are closed, in msec. +Default is 0, and that disables it. This prevents very delayed answer +packets from the upstream (recursive) servers from bouncing against +closed ports and setting off all sort of close-port counters, with +eg. 1500 msec. When timeouts happen you need extra sockets, it checks +the ID and remote IP of packets, and unwanted packets are added to the +unwanted packet counter. +.TP .B so\-rcvbuf: \fI If not 0, then set the SO_RCVBUF socket option to get more buffer space on UDP port 53 incoming queries. So that short spikes on busy @@ -242,6 +259,15 @@ linux unbound needs root permission to bypass the limit, or the admin can use sysctl net.core.wmem_max. On BSD, Solaris changes are similar to so\-rcvbuf. .TP +.B so\-reuseport: \fI +If yes, then open dedicated listening sockets for incoming queries for each +thread and try to set the SO_REUSEPORT socket option on each socket. May +distribute incoming queries to threads more evenly. Default is no. Only +supported on Linux >= 3.9. You can enable it (on any platform and kernel), +it then attempts to open the port and passes the option if it was available +at compile time, if that works it is used, if it fails, it continues +silently (unless verbosity 3) without the option. +.TP .B rrset\-cache\-size: \fI Number of bytes size of the RRset cache. Default is 4 megabytes. A plain number is in bytes, append 'k', 'm' or 'g' for kilobytes, megabytes @@ -326,7 +352,7 @@ a daemon. Default is yes. .B access\-control: \fI The netblock is given as an IP4 or IP6 address with /size appended for a classless network block. The action can be \fIdeny\fR, \fIrefuse\fR, -\fIallow\fR or \fIallow_snoop\fR. +\fIallow\fR, \fIallow_snoop\fR, \fIdeny_non_local\fR or \fIrefuse_non_local\fR. .IP The action \fIdeny\fR stops queries from hosts from that netblock. .IP @@ -355,6 +381,12 @@ By default only localhost is \fIallow\fRed, the rest is \fIrefuse\fRd. The default is \fIrefuse\fRd, because that is protocol\-friendly. The DNS protocol is not designed to handle dropped packets due to policy, and dropping may result in (possibly excessive) retried queries. +.IP +The deny_non_local and refuse_non_local settings are for hosts that are +only allowed to query for the authoritative local\-data, they are not +allowed full recursion but only the static data. With deny_non_local, +messages that are disallowed are dropped, with refuse_non_local they +receive error code REFUSED. .TP .B chroot: \fI If chroot is enabled, you should pass the configfile (from the @@ -492,7 +524,7 @@ unsigned to badly signed often. If turned off you run the risk of a downgrade attack that disables security for a zone. Default is on. .TP .B harden\-below\-nxdomain: \fI -From draft-vixie-dnsext-resimprove, returns nxdomain to queries for a name +From draft\-vixie\-dnsext\-resimprove, returns nxdomain to queries for a name below another name that is already known to be nxdomain. DNSSEC mandates noerror for empty nonterminals, hence this is possible. Very old software might return nxdomain for empty nonterminals (that usually happen for reverse @@ -746,6 +778,17 @@ Number of bytes size of the aggressive negative cache. Default is 1 megabyte. A plain number is in bytes, append 'k', 'm' or 'g' for kilobytes, megabytes or gigabytes (1024*1024 bytes in a megabyte). .TP +.B unblock\-lan\-zones: \fI +Default is disabled. If enabled, then for private address space, +the reverse lookups are no longer filtered. This allows unbound when +running as dns service on a host where it provides service for that host, +to put out all of the queries for the 'lan' upstream. When enabled, +only localhost, 127.0.0.1 reverse and ::1 reverse zones are configured +with default local zones. Disable the option when unbound is running +as a (DHCP-) DNS network resolver for a group of machines, where such +lookups should be filtered (RFC compliance), this also stops potential +data leakage about the local network to the upstream DNS servers. +.TP .B local\-zone: \fI Configure a local zone. The type determines the answer to give if there is no match from local\-data. The types are deny, refuse, static, diff --git a/contrib/unbound/freebsd-configure.sh b/contrib/unbound/freebsd-configure.sh index 46dc53a3074..c8852e7fee1 100755 --- a/contrib/unbound/freebsd-configure.sh +++ b/contrib/unbound/freebsd-configure.sh @@ -32,13 +32,6 @@ autoheader --with-run-dir=/var/unbound \ --with-username=unbound -# Regenerate the configuration parser -{ -cat <util/configlexer.c - -/usr/bin/yacc -d -o util/configparser.c util/configparser.y +# Don't try to provide bogus memory usage statistics based on sbrk(2). +sed -n -i.orig -e '/HAVE_SBRK/!p' config.status +./config.status config.h diff --git a/contrib/unbound/iterator/iter_delegpt.c b/contrib/unbound/iterator/iter_delegpt.c index d2f5d73335d..1d84280d2ea 100644 --- a/contrib/unbound/iterator/iter_delegpt.c +++ b/contrib/unbound/iterator/iter_delegpt.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -47,6 +47,8 @@ #include "util/data/packed_rrset.h" #include "util/data/msgreply.h" #include "util/net_help.h" +#include "ldns/rrdef.h" +#include "ldns/sbuffer.h" struct delegpt* delegpt_create(struct regional* region) @@ -71,7 +73,7 @@ struct delegpt* delegpt_copy(struct delegpt* dp, struct regional* region) copy->bogus = dp->bogus; copy->has_parent_side_NS = dp->has_parent_side_NS; for(ns = dp->nslist; ns; ns = ns->next) { - if(!delegpt_add_ns(copy, region, ns->name, (int)ns->lame)) + if(!delegpt_add_ns(copy, region, ns->name, ns->lame)) return NULL; copy->nslist->resolved = ns->resolved; copy->nslist->got4 = ns->got4; @@ -98,7 +100,7 @@ delegpt_set_name(struct delegpt* dp, struct regional* region, uint8_t* name) int delegpt_add_ns(struct delegpt* dp, struct regional* region, uint8_t* name, - int lame) + uint8_t lame) { struct delegpt_ns* ns; size_t len; @@ -119,7 +121,7 @@ delegpt_add_ns(struct delegpt* dp, struct regional* region, uint8_t* name, ns->resolved = 0; ns->got4 = 0; ns->got6 = 0; - ns->lame = (uint8_t)lame; + ns->lame = lame; ns->done_pside4 = 0; ns->done_pside6 = 0; return ns->name != 0; @@ -156,7 +158,7 @@ delegpt_find_addr(struct delegpt* dp, struct sockaddr_storage* addr, int delegpt_add_target(struct delegpt* dp, struct regional* region, uint8_t* name, size_t namelen, struct sockaddr_storage* addr, - socklen_t addrlen, int bogus, int lame) + socklen_t addrlen, uint8_t bogus, uint8_t lame) { struct delegpt_ns* ns = delegpt_find_ns(dp, name, namelen); log_assert(!dp->dp_type_mlc); @@ -176,8 +178,8 @@ delegpt_add_target(struct delegpt* dp, struct regional* region, int delegpt_add_addr(struct delegpt* dp, struct regional* region, - struct sockaddr_storage* addr, socklen_t addrlen, int bogus, - int lame) + struct sockaddr_storage* addr, socklen_t addrlen, uint8_t bogus, + uint8_t lame) { struct delegpt_addr* a; log_assert(!dp->dp_type_mlc); @@ -204,6 +206,7 @@ delegpt_add_addr(struct delegpt* dp, struct regional* region, a->attempts = 0; a->bogus = bogus; a->lame = lame; + a->dnsseclame = 0; return 1; } @@ -376,7 +379,7 @@ delegpt_from_message(struct dns_msg* msg, struct regional* region) int delegpt_rrset_add_ns(struct delegpt* dp, struct regional* region, - struct ub_packed_rrset_key* ns_rrset, int lame) + struct ub_packed_rrset_key* ns_rrset, uint8_t lame) { struct packed_rrset_data* nsdata = (struct packed_rrset_data*) ns_rrset->entry.data; @@ -387,7 +390,7 @@ delegpt_rrset_add_ns(struct delegpt* dp, struct regional* region, for(i=0; icount; i++) { if(nsdata->rr_len[i] < 2+1) continue; /* len + root label */ if(dname_valid(nsdata->rr_data[i]+2, nsdata->rr_len[i]-2) != - (size_t)ldns_read_uint16(nsdata->rr_data[i])) + (size_t)sldns_read_uint16(nsdata->rr_data[i])) continue; /* bad format */ /* add rdata of NS (= wirefmt dname), skip rdatalen bytes */ if(!delegpt_add_ns(dp, region, nsdata->rr_data[i]+2, lame)) @@ -398,7 +401,7 @@ delegpt_rrset_add_ns(struct delegpt* dp, struct regional* region, int delegpt_add_rrset_A(struct delegpt* dp, struct regional* region, - struct ub_packed_rrset_key* ak, int lame) + struct ub_packed_rrset_key* ak, uint8_t lame) { struct packed_rrset_data* d=(struct packed_rrset_data*)ak->entry.data; size_t i; @@ -422,7 +425,7 @@ delegpt_add_rrset_A(struct delegpt* dp, struct regional* region, int delegpt_add_rrset_AAAA(struct delegpt* dp, struct regional* region, - struct ub_packed_rrset_key* ak, int lame) + struct ub_packed_rrset_key* ak, uint8_t lame) { struct packed_rrset_data* d=(struct packed_rrset_data*)ak->entry.data; size_t i; @@ -446,7 +449,7 @@ delegpt_add_rrset_AAAA(struct delegpt* dp, struct regional* region, int delegpt_add_rrset(struct delegpt* dp, struct regional* region, - struct ub_packed_rrset_key* rrset, int lame) + struct ub_packed_rrset_key* rrset, uint8_t lame) { if(!rrset) return 1; @@ -548,7 +551,7 @@ int delegpt_set_name_mlc(struct delegpt* dp, uint8_t* name) return (dp->name != NULL); } -int delegpt_add_ns_mlc(struct delegpt* dp, uint8_t* name, int lame) +int delegpt_add_ns_mlc(struct delegpt* dp, uint8_t* name, uint8_t lame) { struct delegpt_ns* ns; size_t len; @@ -579,7 +582,7 @@ int delegpt_add_ns_mlc(struct delegpt* dp, uint8_t* name, int lame) } int delegpt_add_addr_mlc(struct delegpt* dp, struct sockaddr_storage* addr, - socklen_t addrlen, int bogus, int lame) + socklen_t addrlen, uint8_t bogus, uint8_t lame) { struct delegpt_addr* a; log_assert(dp->dp_type_mlc); @@ -605,11 +608,13 @@ int delegpt_add_addr_mlc(struct delegpt* dp, struct sockaddr_storage* addr, a->attempts = 0; a->bogus = bogus; a->lame = lame; + a->dnsseclame = 0; return 1; } int delegpt_add_target_mlc(struct delegpt* dp, uint8_t* name, size_t namelen, - struct sockaddr_storage* addr, socklen_t addrlen, int bogus, int lame) + struct sockaddr_storage* addr, socklen_t addrlen, uint8_t bogus, + uint8_t lame) { struct delegpt_ns* ns = delegpt_find_ns(dp, name, namelen); log_assert(dp->dp_type_mlc); diff --git a/contrib/unbound/iterator/iter_delegpt.h b/contrib/unbound/iterator/iter_delegpt.h index 7728031aa99..eb771359c5f 100644 --- a/contrib/unbound/iterator/iter_delegpt.h +++ b/contrib/unbound/iterator/iter_delegpt.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -140,9 +140,13 @@ struct delegpt_addr { int sel_rtt; /** if true, the A or AAAA RR was bogus, so this address is bad. * Also check the dp->bogus to see if everything is bogus. */ - int bogus; + uint8_t bogus; /** if true, this address is dispreferred: it is a lame IP address */ - int lame; + uint8_t lame; + /** if the address is dnsseclame, but this cannot be cached, this + * option is useful to mark the address dnsseclame. + * This value is not copied in addr-copy and dp-copy. */ + uint8_t dnsseclame; }; /** @@ -179,7 +183,7 @@ int delegpt_set_name(struct delegpt* dp, struct regional* regional, * @return false on error. */ int delegpt_add_ns(struct delegpt* dp, struct regional* regional, - uint8_t* name, int lame); + uint8_t* name, uint8_t lame); /** * Add NS rrset; calls add_ns repeatedly. @@ -190,7 +194,7 @@ int delegpt_add_ns(struct delegpt* dp, struct regional* regional, * @return 0 on alloc error. */ int delegpt_rrset_add_ns(struct delegpt* dp, struct regional* regional, - struct ub_packed_rrset_key* ns_rrset, int lame); + struct ub_packed_rrset_key* ns_rrset, uint8_t lame); /** * Add target address to the delegation point. @@ -207,7 +211,7 @@ int delegpt_rrset_add_ns(struct delegpt* dp, struct regional* regional, */ int delegpt_add_target(struct delegpt* dp, struct regional* regional, uint8_t* name, size_t namelen, struct sockaddr_storage* addr, - socklen_t addrlen, int bogus, int lame); + socklen_t addrlen, uint8_t bogus, uint8_t lame); /** * Add A RRset to delegpt. @@ -218,7 +222,7 @@ int delegpt_add_target(struct delegpt* dp, struct regional* regional, * @return 0 on alloc error. */ int delegpt_add_rrset_A(struct delegpt* dp, struct regional* regional, - struct ub_packed_rrset_key* rrset, int lame); + struct ub_packed_rrset_key* rrset, uint8_t lame); /** * Add AAAA RRset to delegpt. @@ -229,7 +233,7 @@ int delegpt_add_rrset_A(struct delegpt* dp, struct regional* regional, * @return 0 on alloc error. */ int delegpt_add_rrset_AAAA(struct delegpt* dp, struct regional* regional, - struct ub_packed_rrset_key* rrset, int lame); + struct ub_packed_rrset_key* rrset, uint8_t lame); /** * Add any RRset to delegpt. @@ -241,7 +245,7 @@ int delegpt_add_rrset_AAAA(struct delegpt* dp, struct regional* regional, * @return 0 on alloc error. */ int delegpt_add_rrset(struct delegpt* dp, struct regional* regional, - struct ub_packed_rrset_key* rrset, int lame); + struct ub_packed_rrset_key* rrset, uint8_t lame); /** * Add address to the delegation point. No servername is associated or checked. @@ -254,7 +258,8 @@ int delegpt_add_rrset(struct delegpt* dp, struct regional* regional, * @return false on error. */ int delegpt_add_addr(struct delegpt* dp, struct regional* regional, - struct sockaddr_storage* addr, socklen_t addrlen, int bogus, int lame); + struct sockaddr_storage* addr, socklen_t addrlen, + uint8_t bogus, uint8_t lame); /** * Find NS record in name list of delegation point. @@ -376,7 +381,7 @@ int delegpt_set_name_mlc(struct delegpt* dp, uint8_t* name); * @param lame: the name is lame, disprefer. * @return false on error. */ -int delegpt_add_ns_mlc(struct delegpt* dp, uint8_t* name, int lame); +int delegpt_add_ns_mlc(struct delegpt* dp, uint8_t* name, uint8_t lame); /** * add an address to a malloced delegation point. @@ -388,7 +393,7 @@ int delegpt_add_ns_mlc(struct delegpt* dp, uint8_t* name, int lame); * @return false on error. */ int delegpt_add_addr_mlc(struct delegpt* dp, struct sockaddr_storage* addr, - socklen_t addrlen, int bogus, int lame); + socklen_t addrlen, uint8_t bogus, uint8_t lame); /** * Add target address to the delegation point. @@ -403,7 +408,8 @@ int delegpt_add_addr_mlc(struct delegpt* dp, struct sockaddr_storage* addr, * @return false on error. */ int delegpt_add_target_mlc(struct delegpt* dp, uint8_t* name, size_t namelen, - struct sockaddr_storage* addr, socklen_t addrlen, int bogus, int lame); + struct sockaddr_storage* addr, socklen_t addrlen, uint8_t bogus, + uint8_t lame); /** get memory in use by dp */ size_t delegpt_get_mem(struct delegpt* dp); diff --git a/contrib/unbound/iterator/iter_donotq.c b/contrib/unbound/iterator/iter_donotq.c index bd606335bcd..40ffb45c49a 100644 --- a/contrib/unbound/iterator/iter_donotq.c +++ b/contrib/unbound/iterator/iter_donotq.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/iterator/iter_donotq.h b/contrib/unbound/iterator/iter_donotq.h index 4c4fcb289dc..429e5a3dd26 100644 --- a/contrib/unbound/iterator/iter_donotq.h +++ b/contrib/unbound/iterator/iter_donotq.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/iterator/iter_fwd.c b/contrib/unbound/iterator/iter_fwd.c index 0b3b6525c26..01212124119 100644 --- a/contrib/unbound/iterator/iter_fwd.c +++ b/contrib/unbound/iterator/iter_fwd.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -40,15 +40,14 @@ * Keep track of forward zones and config settings. */ #include "config.h" -#include -#include -#include #include "iterator/iter_fwd.h" #include "iterator/iter_delegpt.h" #include "util/log.h" #include "util/config_file.h" #include "util/net_help.h" #include "util/data/dname.h" +#include "ldns/rrdef.h" +#include "ldns/str2wire.h" int fwd_cmp(const void* k1, const void* k2) @@ -180,22 +179,23 @@ static struct delegpt* read_fwds_name(struct config_stub* s) { struct delegpt* dp; - ldns_rdf* rdf; + uint8_t* dname; + size_t dname_len; if(!s->name) { log_err("forward zone without a name (use name \".\" to forward everything)"); return NULL; } - rdf = ldns_dname_new_frm_str(s->name); - if(!rdf) { + dname = sldns_str2wire_dname(s->name, &dname_len); + if(!dname) { log_err("cannot parse forward zone name %s", s->name); return NULL; } - if(!(dp=delegpt_create_mlc(ldns_rdf_data(rdf)))) { - ldns_rdf_deep_free(rdf); + if(!(dp=delegpt_create_mlc(dname))) { + free(dname); log_err("out of memory"); return NULL; } - ldns_rdf_deep_free(rdf); + free(dname); return dp; } @@ -204,21 +204,22 @@ static int read_fwds_host(struct config_stub* s, struct delegpt* dp) { struct config_strlist* p; - ldns_rdf* rdf; + uint8_t* dname; + size_t dname_len; for(p = s->hosts; p; p = p->next) { log_assert(p->str); - rdf = ldns_dname_new_frm_str(p->str); - if(!rdf) { + dname = sldns_str2wire_dname(p->str, &dname_len); + if(!dname) { log_err("cannot parse forward %s server name: '%s'", s->name, p->str); return 0; } - if(!delegpt_add_ns_mlc(dp, ldns_rdf_data(rdf), 0)) { - ldns_rdf_deep_free(rdf); + if(!delegpt_add_ns_mlc(dp, dname, 0)) { + free(dname); log_err("out of memory"); return 0; } - ldns_rdf_deep_free(rdf); + free(dname); } return 1; } @@ -290,19 +291,20 @@ static int make_stub_holes(struct iter_forwards* fwd, struct config_file* cfg) { struct config_stub* s; + uint8_t* dname; + size_t dname_len; for(s = cfg->stubs; s; s = s->next) { - ldns_rdf* rdf = ldns_dname_new_frm_str(s->name); - if(!rdf) { + dname = sldns_str2wire_dname(s->name, &dname_len); + if(!dname) { log_err("cannot parse stub name '%s'", s->name); return 0; } - if(!fwd_add_stub_hole(fwd, LDNS_RR_CLASS_IN, - ldns_rdf_data(rdf))) { - ldns_rdf_deep_free(rdf); + if(!fwd_add_stub_hole(fwd, LDNS_RR_CLASS_IN, dname)) { + free(dname); log_err("out of memory"); return 0; } - ldns_rdf_deep_free(rdf); + free(dname); } return 1; } @@ -324,6 +326,20 @@ forwards_apply_cfg(struct iter_forwards* fwd, struct config_file* cfg) return 1; } +struct delegpt* +forwards_find(struct iter_forwards* fwd, uint8_t* qname, uint16_t qclass) +{ + rbnode_t* res = NULL; + struct iter_forward_zone key; + key.node.key = &key; + key.dclass = qclass; + key.name = qname; + key.namelabs = dname_count_size_labels(qname, &key.namelen); + res = rbtree_search(fwd->tree, &key); + if(res) return ((struct iter_forward_zone*)res)->dp; + return NULL; +} + struct delegpt* forwards_lookup(struct iter_forwards* fwd, uint8_t* qname, uint16_t qclass) { diff --git a/contrib/unbound/iterator/iter_fwd.h b/contrib/unbound/iterator/iter_fwd.h index dbb84f22612..20113a395ec 100644 --- a/contrib/unbound/iterator/iter_fwd.h +++ b/contrib/unbound/iterator/iter_fwd.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -104,6 +104,16 @@ void forwards_delete(struct iter_forwards* fwd); */ int forwards_apply_cfg(struct iter_forwards* fwd, struct config_file* cfg); +/** + * Find forward zone exactly by name + * @param fwd: forward storage. + * @param qname: The qname of the query. + * @param qclass: The qclass of the query. + * @return: A delegation point or null. + */ +struct delegpt* forwards_find(struct iter_forwards* fwd, uint8_t* qname, + uint16_t qclass); + /** * Find forward zone information * For this qname/qclass find forward zone information, returns delegation diff --git a/contrib/unbound/iterator/iter_hints.c b/contrib/unbound/iterator/iter_hints.c index cde3a7e1bac..7fa07a72969 100644 --- a/contrib/unbound/iterator/iter_hints.c +++ b/contrib/unbound/iterator/iter_hints.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -40,14 +40,15 @@ * Keep track of stub and root hints, and read those from config. */ #include "config.h" -#include -#include #include "iterator/iter_hints.h" #include "iterator/iter_delegpt.h" #include "util/log.h" #include "util/config_file.h" #include "util/net_help.h" #include "util/data/dname.h" +#include "ldns/rrdef.h" +#include "ldns/str2wire.h" +#include "ldns/wire2str.h" struct iter_hints* hints_create(void) @@ -92,19 +93,20 @@ ah(struct delegpt* dp, const char* sv, const char* ip) { struct sockaddr_storage addr; socklen_t addrlen; - ldns_rdf* rdf = ldns_dname_new_frm_str(sv); - if(!rdf) { + size_t dname_len; + uint8_t* dname = sldns_str2wire_dname(sv, &dname_len); + if(!dname) { log_err("could not parse %s", sv); return 0; } - if(!delegpt_add_ns_mlc(dp, ldns_rdf_data(rdf), 0) || + if(!delegpt_add_ns_mlc(dp, dname, 0) || !extstrtoaddr(ip, &addr, &addrlen) || - !delegpt_add_target_mlc(dp, ldns_rdf_data(rdf), ldns_rdf_size(rdf), + !delegpt_add_target_mlc(dp, dname, dname_len, &addr, addrlen, 0, 0)) { - ldns_rdf_deep_free(rdf); + free(dname); return 0; } - ldns_rdf_deep_free(rdf); + free(dname); return 1; } @@ -186,22 +188,23 @@ static struct delegpt* read_stubs_name(struct config_stub* s) { struct delegpt* dp; - ldns_rdf* rdf; + size_t dname_len; + uint8_t* dname; if(!s->name) { log_err("stub zone without a name"); return NULL; } - rdf = ldns_dname_new_frm_str(s->name); - if(!rdf) { + dname = sldns_str2wire_dname(s->name, &dname_len); + if(!dname) { log_err("cannot parse stub zone name %s", s->name); return NULL; } - if(!(dp=delegpt_create_mlc(ldns_rdf_data(rdf)))) { - ldns_rdf_deep_free(rdf); + if(!(dp=delegpt_create_mlc(dname))) { + free(dname); log_err("out of memory"); return NULL; } - ldns_rdf_deep_free(rdf); + free(dname); return dp; } @@ -210,21 +213,22 @@ static int read_stubs_host(struct config_stub* s, struct delegpt* dp) { struct config_strlist* p; - ldns_rdf* rdf; + size_t dname_len; + uint8_t* dname; for(p = s->hosts; p; p = p->next) { log_assert(p->str); - rdf = ldns_dname_new_frm_str(p->str); - if(!rdf) { + dname = sldns_str2wire_dname(p->str, &dname_len); + if(!dname) { log_err("cannot parse stub %s nameserver name: '%s'", s->name, p->str); return 0; } - if(!delegpt_add_ns_mlc(dp, ldns_rdf_data(rdf), 0)) { - ldns_rdf_deep_free(rdf); + if(!delegpt_add_ns_mlc(dp, dname, 0)) { + free(dname); log_err("out of memory"); return 0; } - ldns_rdf_deep_free(rdf); + free(dname); } return 1; } @@ -279,13 +283,11 @@ read_stubs(struct iter_hints* hints, struct config_file* cfg) static int read_root_hints(struct iter_hints* hints, char* fname) { - int lineno = 0; - uint32_t default_ttl = 0; - ldns_rdf* origin = NULL; - ldns_rdf* prev_rr = NULL; + struct sldns_file_parse_state pstate; struct delegpt* dp; - ldns_rr* rr = NULL; - ldns_status status; + uint8_t rr[LDNS_RR_BUF_SIZE]; + size_t rr_len, dname_len; + int status; uint16_t c = LDNS_RR_CLASS_IN; FILE* f = fopen(fname, "r"); if(!f) { @@ -300,77 +302,78 @@ read_root_hints(struct iter_hints* hints, char* fname) return 0; } verbose(VERB_QUERY, "Reading root hints from %s", fname); + memset(&pstate, 0, sizeof(pstate)); + pstate.lineno = 1; dp->has_parent_side_NS = 1; while(!feof(f)) { - status = ldns_rr_new_frm_fp_l(&rr, f, - &default_ttl, &origin, &prev_rr, &lineno); - if(status == LDNS_STATUS_SYNTAX_EMPTY || - status == LDNS_STATUS_SYNTAX_TTL || - status == LDNS_STATUS_SYNTAX_ORIGIN) - continue; - if(status != LDNS_STATUS_OK) { - log_err("reading root hints %s %d: %s", fname, - lineno, ldns_get_errorstr_by_id(status)); + rr_len = sizeof(rr); + dname_len = 0; + status = sldns_fp2wire_rr_buf(f, rr, &rr_len, &dname_len, + &pstate); + if(status != 0) { + log_err("reading root hints %s %d:%d: %s", fname, + pstate.lineno, LDNS_WIREPARSE_OFFSET(status), + sldns_get_errorstr_parse(status)); goto stop_read; } - if(ldns_rr_get_type(rr) == LDNS_RR_TYPE_NS) { - if(!delegpt_add_ns_mlc(dp, - ldns_rdf_data(ldns_rr_rdf(rr, 0)), 0)) { + if(rr_len == 0) + continue; /* EMPTY line, TTL or ORIGIN */ + if(sldns_wirerr_get_type(rr, rr_len, dname_len) + == LDNS_RR_TYPE_NS) { + if(!delegpt_add_ns_mlc(dp, sldns_wirerr_get_rdata(rr, + rr_len, dname_len), 0)) { log_err("out of memory reading root hints"); goto stop_read; } - c = ldns_rr_get_class(rr); + c = sldns_wirerr_get_class(rr, rr_len, dname_len); if(!dp->name) { - if(!delegpt_set_name_mlc(dp, - ldns_rdf_data(ldns_rr_owner(rr)))){ + if(!delegpt_set_name_mlc(dp, rr)) { log_err("out of memory."); goto stop_read; } } - } else if(ldns_rr_get_type(rr) == LDNS_RR_TYPE_A) { + } else if(sldns_wirerr_get_type(rr, rr_len, dname_len) + == LDNS_RR_TYPE_A && sldns_wirerr_get_rdatalen(rr, + rr_len, dname_len) == INET_SIZE) { struct sockaddr_in sa; socklen_t len = (socklen_t)sizeof(sa); memset(&sa, 0, len); sa.sin_family = AF_INET; sa.sin_port = (in_port_t)htons(UNBOUND_DNS_PORT); memmove(&sa.sin_addr, - ldns_rdf_data(ldns_rr_rdf(rr, 0)), INET_SIZE); - if(!delegpt_add_target_mlc(dp, - ldns_rdf_data(ldns_rr_owner(rr)), - ldns_rdf_size(ldns_rr_owner(rr)), + sldns_wirerr_get_rdata(rr, rr_len, dname_len), + INET_SIZE); + if(!delegpt_add_target_mlc(dp, rr, dname_len, (struct sockaddr_storage*)&sa, len, 0, 0)) { log_err("out of memory reading root hints"); goto stop_read; } - } else if(ldns_rr_get_type(rr) == LDNS_RR_TYPE_AAAA) { + } else if(sldns_wirerr_get_type(rr, rr_len, dname_len) + == LDNS_RR_TYPE_AAAA && sldns_wirerr_get_rdatalen(rr, + rr_len, dname_len) == INET6_SIZE) { struct sockaddr_in6 sa; socklen_t len = (socklen_t)sizeof(sa); memset(&sa, 0, len); sa.sin6_family = AF_INET6; sa.sin6_port = (in_port_t)htons(UNBOUND_DNS_PORT); memmove(&sa.sin6_addr, - ldns_rdf_data(ldns_rr_rdf(rr, 0)), INET6_SIZE); - if(!delegpt_add_target_mlc(dp, - ldns_rdf_data(ldns_rr_owner(rr)), - ldns_rdf_size(ldns_rr_owner(rr)), + sldns_wirerr_get_rdata(rr, rr_len, dname_len), + INET6_SIZE); + if(!delegpt_add_target_mlc(dp, rr, dname_len, (struct sockaddr_storage*)&sa, len, 0, 0)) { log_err("out of memory reading root hints"); goto stop_read; } } else { - log_warn("root hints %s:%d skipping type %d", - fname, lineno, ldns_rr_get_type(rr)); + char buf[17]; + sldns_wire2str_type_buf(sldns_wirerr_get_type(rr, + rr_len, dname_len), buf, sizeof(buf)); + log_warn("root hints %s:%d skipping type %s", + fname, pstate.lineno, buf); } - - ldns_rr_free(rr); } - - if (origin) - ldns_rdf_deep_free(origin); - if (prev_rr) - ldns_rdf_deep_free(prev_rr); fclose(f); if(!dp->name) { log_warn("root hints %s: no NS content", fname); @@ -384,10 +387,6 @@ read_root_hints(struct iter_hints* hints, char* fname) return 1; stop_read: - if (origin) - ldns_rdf_deep_free(origin); - if (prev_rr) - ldns_rdf_deep_free(prev_rr); delegpt_free_mlc(dp); fclose(f); return 0; diff --git a/contrib/unbound/iterator/iter_hints.h b/contrib/unbound/iterator/iter_hints.h index 7cac811ecd1..715ec9f4106 100644 --- a/contrib/unbound/iterator/iter_hints.h +++ b/contrib/unbound/iterator/iter_hints.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/iterator/iter_priv.c b/contrib/unbound/iterator/iter_priv.c index db7dbe5faa6..9e09a84bd01 100644 --- a/contrib/unbound/iterator/iter_priv.c +++ b/contrib/unbound/iterator/iter_priv.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -41,7 +41,6 @@ */ #include "config.h" -#include #include "iterator/iter_priv.h" #include "util/regional.h" #include "util/log.h" @@ -50,6 +49,8 @@ #include "util/data/msgparse.h" #include "util/net_help.h" #include "util/storage/dnstree.h" +#include "ldns/str2wire.h" +#include "ldns/sbuffer.h" struct iter_priv* priv_create(void) { @@ -110,23 +111,21 @@ static int read_names(struct iter_priv* priv, struct config_file* cfg) /* parse names, report errors, insert into tree */ struct config_strlist* p; struct name_tree_node* n; - uint8_t* nm; + uint8_t* nm, *nmr; size_t nm_len; int nm_labs; - ldns_rdf* rdf; for(p = cfg->private_domain; p; p = p->next) { log_assert(p->str); - rdf = ldns_dname_new_frm_str(p->str); - if(!rdf) { + nm = sldns_str2wire_dname(p->str, &nm_len); + if(!nm) { log_err("cannot parse private-domain: %s", p->str); return 0; } - nm = ldns_rdf_data(rdf); nm_labs = dname_count_size_labels(nm, &nm_len); - nm = (uint8_t*)regional_alloc_init(priv->region, nm, nm_len); - ldns_rdf_deep_free(rdf); - if(!nm) { + nmr = (uint8_t*)regional_alloc_init(priv->region, nm, nm_len); + free(nm); + if(!nmr) { log_err("out of memory"); return 0; } @@ -136,7 +135,7 @@ static int read_names(struct iter_priv* priv, struct config_file* cfg) log_err("out of memory"); return 0; } - if(!name_tree_insert(&priv->n, n, nm, nm_len, nm_labs, + if(!name_tree_insert(&priv->n, n, nmr, nm_len, nm_labs, LDNS_RR_CLASS_IN)) { verbose(VERB_QUERY, "ignoring duplicate " "private-domain: %s", p->str); @@ -188,7 +187,7 @@ priv_lookup_addr(struct iter_priv* priv, struct sockaddr_storage* addr, * @return: true if the name is OK. false if unlisted. */ static int -priv_lookup_name(struct iter_priv* priv, ldns_buffer* pkt, +priv_lookup_name(struct iter_priv* priv, sldns_buffer* pkt, uint8_t* name, size_t name_len, uint16_t dclass) { size_t len; @@ -208,7 +207,29 @@ size_t priv_get_mem(struct iter_priv* priv) return sizeof(*priv) + regional_get_mem(priv->region); } -int priv_rrset_bad(struct iter_priv* priv, ldns_buffer* pkt, +/** remove RR from msgparse RRset, return true if rrset is entirely bad */ +static int +remove_rr(const char* str, sldns_buffer* pkt, struct rrset_parse* rrset, + struct rr_parse* prev, struct rr_parse** rr, struct sockaddr_storage* addr, socklen_t addrlen) +{ + if(verbosity >= VERB_QUERY && rrset->dname_len <= LDNS_MAX_DOMAINLEN && str) { + uint8_t buf[LDNS_MAX_DOMAINLEN+1]; + dname_pkt_copy(pkt, buf, rrset->dname); + log_name_addr(VERB_QUERY, str, buf, addr, addrlen); + } + if(prev) + prev->next = (*rr)->next; + else rrset->rr_first = (*rr)->next; + if(rrset->rr_last == *rr) + rrset->rr_last = prev; + rrset->rr_count --; + rrset->size -= (*rr)->size; + /* rr struct still exists, but is unlinked, so that in the for loop + * the rr->next works fine to continue. */ + return rrset->rr_count == 0; +} + +int priv_rrset_bad(struct iter_priv* priv, sldns_buffer* pkt, struct rrset_parse* rrset) { if(priv->a.count == 0) @@ -221,7 +242,7 @@ int priv_rrset_bad(struct iter_priv* priv, ldns_buffer* pkt, } else { /* so its a public name, check the address */ socklen_t len; - struct rr_parse* rr; + struct rr_parse* rr, *prev = NULL; if(rrset->type == LDNS_RR_TYPE_A) { struct sockaddr_storage addr; struct sockaddr_in sa; @@ -231,14 +252,20 @@ int priv_rrset_bad(struct iter_priv* priv, ldns_buffer* pkt, sa.sin_family = AF_INET; sa.sin_port = (in_port_t)htons(UNBOUND_DNS_PORT); for(rr = rrset->rr_first; rr; rr = rr->next) { - if(ldns_read_uint16(rr->ttl_data+4) - != INET_SIZE) + if(sldns_read_uint16(rr->ttl_data+4) + != INET_SIZE) { + prev = rr; continue; + } memmove(&sa.sin_addr, rr->ttl_data+4+2, INET_SIZE); memmove(&addr, &sa, len); - if(priv_lookup_addr(priv, &addr, len)) - return 1; + if(priv_lookup_addr(priv, &addr, len)) { + if(remove_rr("sanitize: removing public name with private address", pkt, rrset, prev, &rr, &addr, len)) + return 1; + continue; + } + prev = rr; } } else if(rrset->type == LDNS_RR_TYPE_AAAA) { struct sockaddr_storage addr; @@ -248,14 +275,20 @@ int priv_rrset_bad(struct iter_priv* priv, ldns_buffer* pkt, sa.sin6_family = AF_INET6; sa.sin6_port = (in_port_t)htons(UNBOUND_DNS_PORT); for(rr = rrset->rr_first; rr; rr = rr->next) { - if(ldns_read_uint16(rr->ttl_data+4) - != INET6_SIZE) + if(sldns_read_uint16(rr->ttl_data+4) + != INET6_SIZE) { + prev = rr; continue; + } memmove(&sa.sin6_addr, rr->ttl_data+4+2, INET6_SIZE); memmove(&addr, &sa, len); - if(priv_lookup_addr(priv, &addr, len)) - return 1; + if(priv_lookup_addr(priv, &addr, len)) { + if(remove_rr("sanitize: removing public name with private address", pkt, rrset, prev, &rr, &addr, len)) + return 1; + continue; + } + prev = rr; } } } diff --git a/contrib/unbound/iterator/iter_priv.h b/contrib/unbound/iterator/iter_priv.h index f6264f8d0c9..6fa84900bf1 100644 --- a/contrib/unbound/iterator/iter_priv.h +++ b/contrib/unbound/iterator/iter_priv.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -43,7 +43,7 @@ #ifndef ITERATOR_ITER_PRIV_H #define ITERATOR_ITER_PRIV_H #include "util/rbtree.h" -#include +struct sldns_buffer; struct iter_env; struct config_file; struct regional; @@ -92,12 +92,14 @@ int priv_apply_cfg(struct iter_priv* priv, struct config_file* cfg); /** * See if rrset is bad. + * Will remove individual RRs that are bad (if possible) to + * sanitize the RRset without removing it completely. * @param priv: structure for private address storage. * @param pkt: packet to decompress rrset name in. * @param rrset: the rrset to examine, A or AAAA. * @return true if the rrset is bad and should be removed. */ -int priv_rrset_bad(struct iter_priv* priv, ldns_buffer* pkt, +int priv_rrset_bad(struct iter_priv* priv, struct sldns_buffer* pkt, struct rrset_parse* rrset); /** diff --git a/contrib/unbound/iterator/iter_resptype.c b/contrib/unbound/iterator/iter_resptype.c index 2cdc5fcfc3d..45f919387dc 100644 --- a/contrib/unbound/iterator/iter_resptype.c +++ b/contrib/unbound/iterator/iter_resptype.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -40,12 +40,13 @@ * one of the response types. */ #include "config.h" -#include #include "iterator/iter_resptype.h" #include "iterator/iter_delegpt.h" #include "services/cache/dns.h" #include "util/net_help.h" #include "util/data/dname.h" +#include "ldns/rrdef.h" +#include "ldns/pkthdr.h" enum response_type response_type_from_cache(struct dns_msg* msg, diff --git a/contrib/unbound/iterator/iter_resptype.h b/contrib/unbound/iterator/iter_resptype.h index 3bb3eedb2ef..fee9ef35f83 100644 --- a/contrib/unbound/iterator/iter_resptype.h +++ b/contrib/unbound/iterator/iter_resptype.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/iterator/iter_scrub.c b/contrib/unbound/iterator/iter_scrub.c index 6147c96a9e3..b2248bc0cbc 100644 --- a/contrib/unbound/iterator/iter_scrub.c +++ b/contrib/unbound/iterator/iter_scrub.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -53,16 +53,17 @@ #include "util/data/dname.h" #include "util/data/msgreply.h" #include "util/alloc.h" +#include "ldns/sbuffer.h" /** RRset flag used during scrubbing. The RRset is OK. */ #define RRSET_SCRUB_OK 0x80 /** remove rrset, update loop variables */ static void -remove_rrset(const char* str, ldns_buffer* pkt, struct msg_parse* msg, +remove_rrset(const char* str, sldns_buffer* pkt, struct msg_parse* msg, struct rrset_parse* prev, struct rrset_parse** rrset) { - if(verbosity >= VERB_QUERY + if(verbosity >= VERB_QUERY && str && (*rrset)->dname_len <= LDNS_MAX_DOMAINLEN) { uint8_t buf[LDNS_MAX_DOMAINLEN+1]; dname_pkt_copy(pkt, buf, (*rrset)->dname); @@ -108,7 +109,7 @@ has_additional(uint16_t t) /** get additional name from rrset RR, return false if no name present */ static int get_additional_name(struct rrset_parse* rrset, struct rr_parse* rr, - uint8_t** nm, size_t* nmlen, ldns_buffer* pkt) + uint8_t** nm, size_t* nmlen, sldns_buffer* pkt) { size_t offset = 0; size_t len, oldpos; @@ -132,14 +133,14 @@ get_additional_name(struct rrset_parse* rrset, struct rr_parse* rr, default: return 0; } - len = ldns_read_uint16(rr->ttl_data+sizeof(uint32_t)); + len = sldns_read_uint16(rr->ttl_data+sizeof(uint32_t)); if(len < offset+1) return 0; /* rdata field too small */ *nm = rr->ttl_data+sizeof(uint32_t)+sizeof(uint16_t)+offset; - oldpos = ldns_buffer_position(pkt); - ldns_buffer_set_position(pkt, (size_t)(*nm - ldns_buffer_begin(pkt))); + oldpos = sldns_buffer_position(pkt); + sldns_buffer_set_position(pkt, (size_t)(*nm - sldns_buffer_begin(pkt))); *nmlen = pkt_dname_len(pkt); - ldns_buffer_set_position(pkt, oldpos); + sldns_buffer_set_position(pkt, oldpos); if(*nmlen == 0) return 0; return 1; @@ -147,7 +148,7 @@ get_additional_name(struct rrset_parse* rrset, struct rr_parse* rr, /** Place mark on rrsets in additional section they are OK */ static void -mark_additional_rrset(ldns_buffer* pkt, struct msg_parse* msg, +mark_additional_rrset(sldns_buffer* pkt, struct msg_parse* msg, struct rrset_parse* rrset) { /* Mark A and AAAA for NS as appropriate additional section info. */ @@ -209,7 +210,7 @@ parse_get_cname_target(struct rrset_parse* rrset, uint8_t** sname, /** Synthesize CNAME from DNAME, false if too long */ static int synth_cname(uint8_t* qname, size_t qnamelen, struct rrset_parse* dname_rrset, - uint8_t* alias, size_t* aliaslen, ldns_buffer* pkt) + uint8_t* alias, size_t* aliaslen, sldns_buffer* pkt) { /* we already know that sname is a strict subdomain of DNAME owner */ uint8_t* dtarg = NULL; @@ -233,7 +234,7 @@ static struct rrset_parse* synth_cname_rrset(uint8_t** sname, size_t* snamelen, uint8_t* alias, size_t aliaslen, struct regional* region, struct msg_parse* msg, struct rrset_parse* rrset, struct rrset_parse* prev, - struct rrset_parse* nx, ldns_buffer* pkt) + struct rrset_parse* nx, sldns_buffer* pkt) { struct rrset_parse* cn = (struct rrset_parse*)regional_alloc(region, sizeof(struct rrset_parse)); @@ -264,8 +265,8 @@ synth_cname_rrset(uint8_t** sname, size_t* snamelen, uint8_t* alias, sizeof(uint32_t)+sizeof(uint16_t)+aliaslen); if(!cn->rr_first->ttl_data) return NULL; - ldns_write_uint32(cn->rr_first->ttl_data, 0); /* TTL = 0 */ - ldns_write_uint16(cn->rr_first->ttl_data+4, aliaslen); + sldns_write_uint32(cn->rr_first->ttl_data, 0); /* TTL = 0 */ + sldns_write_uint16(cn->rr_first->ttl_data+4, aliaslen); memmove(cn->rr_first->ttl_data+6, alias, aliaslen); cn->rr_first->size = sizeof(uint16_t)+aliaslen; @@ -287,7 +288,7 @@ synth_cname_rrset(uint8_t** sname, size_t* snamelen, uint8_t* alias, /** check if DNAME applies to a name */ static int -pkt_strict_sub(ldns_buffer* pkt, uint8_t* sname, uint8_t* dr) +pkt_strict_sub(sldns_buffer* pkt, uint8_t* sname, uint8_t* dr) { uint8_t buf1[LDNS_MAX_DOMAINLEN+1]; uint8_t buf2[LDNS_MAX_DOMAINLEN+1]; @@ -299,7 +300,7 @@ pkt_strict_sub(ldns_buffer* pkt, uint8_t* sname, uint8_t* dr) /** check subdomain with decompression */ static int -pkt_sub(ldns_buffer* pkt, uint8_t* comprname, uint8_t* zone) +pkt_sub(sldns_buffer* pkt, uint8_t* comprname, uint8_t* zone) { uint8_t buf[LDNS_MAX_DOMAINLEN+1]; dname_pkt_copy(pkt, buf, comprname); @@ -308,7 +309,7 @@ pkt_sub(ldns_buffer* pkt, uint8_t* comprname, uint8_t* zone) /** check subdomain with decompression, compressed is parent */ static int -sub_of_pkt(ldns_buffer* pkt, uint8_t* zone, uint8_t* comprname) +sub_of_pkt(sldns_buffer* pkt, uint8_t* zone, uint8_t* comprname) { uint8_t buf[LDNS_MAX_DOMAINLEN+1]; dname_pkt_copy(pkt, buf, comprname); @@ -327,7 +328,7 @@ sub_of_pkt(ldns_buffer* pkt, uint8_t* zone, uint8_t* comprname) * @return 0 on error. */ static int -scrub_normalize(ldns_buffer* pkt, struct msg_parse* msg, +scrub_normalize(sldns_buffer* pkt, struct msg_parse* msg, struct query_info* qinfo, struct regional* region) { uint8_t* sname = qinfo->qname; @@ -514,13 +515,13 @@ scrub_normalize(ldns_buffer* pkt, struct msg_parse* msg, * @param rrset: to store. */ static void -store_rrset(ldns_buffer* pkt, struct msg_parse* msg, struct module_env* env, +store_rrset(sldns_buffer* pkt, struct msg_parse* msg, struct module_env* env, struct rrset_parse* rrset) { struct ub_packed_rrset_key* k; struct packed_rrset_data* d; struct rrset_ref ref; - uint32_t now = *env->now; + time_t now = *env->now; k = alloc_special_obtain(env->alloc); if(!k) @@ -565,7 +566,7 @@ static int sanitize_nsec_is_overreach(struct rrset_parse* rrset, log_assert(rrset->type == LDNS_RR_TYPE_NSEC); for(rr = rrset->rr_first; rr; rr = rr->next) { rhs = rr->ttl_data+4+2; - len = ldns_read_uint16(rr->ttl_data+4); + len = sldns_read_uint16(rr->ttl_data+4); if(!dname_valid(rhs, len)) { /* malformed domain name in rdata */ return 1; @@ -594,7 +595,7 @@ static int sanitize_nsec_is_overreach(struct rrset_parse* rrset, * @return 0 on error. */ static int -scrub_sanitize(ldns_buffer* pkt, struct msg_parse* msg, +scrub_sanitize(sldns_buffer* pkt, struct msg_parse* msg, struct query_info* qinfo, uint8_t* zonename, struct module_env* env, struct iter_env* ie) { @@ -646,14 +647,16 @@ scrub_sanitize(ldns_buffer* pkt, struct msg_parse* msg, /* remove private addresses */ if( (rrset->type == LDNS_RR_TYPE_A || - rrset->type == LDNS_RR_TYPE_AAAA) && - priv_rrset_bad(ie->priv, pkt, rrset)) { + rrset->type == LDNS_RR_TYPE_AAAA)) { /* do not set servfail since this leads to too * many drops of other people using rfc1918 space */ - remove_rrset("sanitize: removing public name with " - "private address", pkt, msg, prev, &rrset); - continue; + /* also do not remove entire rrset, unless all records + * in it are bad */ + if(priv_rrset_bad(ie->priv, pkt, rrset)) { + remove_rrset(NULL, pkt, msg, prev, &rrset); + continue; + } } /* skip DNAME records -- they will always be followed by a @@ -711,7 +714,7 @@ scrub_sanitize(ldns_buffer* pkt, struct msg_parse* msg, } int -scrub_message(ldns_buffer* pkt, struct msg_parse* msg, +scrub_message(sldns_buffer* pkt, struct msg_parse* msg, struct query_info* qinfo, uint8_t* zonename, struct regional* region, struct module_env* env, struct iter_env* ie) { diff --git a/contrib/unbound/iterator/iter_scrub.h b/contrib/unbound/iterator/iter_scrub.h index 6b7274e4ac3..cbbaf73c91d 100644 --- a/contrib/unbound/iterator/iter_scrub.h +++ b/contrib/unbound/iterator/iter_scrub.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -42,7 +42,7 @@ #ifndef ITERATOR_ITER_SCRUB_H #define ITERATOR_ITER_SCRUB_H -#include +struct sldns_buffer; struct msg_parse; struct query_info; struct regional; @@ -62,7 +62,7 @@ struct iter_env; * @param ie: iterator module environment data. * @return: false if the message is total waste. true if scrubbed with success. */ -int scrub_message(ldns_buffer* pkt, struct msg_parse* msg, +int scrub_message(struct sldns_buffer* pkt, struct msg_parse* msg, struct query_info* qinfo, uint8_t* zonename, struct regional* regional, struct module_env* env, struct iter_env* ie); diff --git a/contrib/unbound/iterator/iter_utils.c b/contrib/unbound/iterator/iter_utils.c index a500c75e786..5d55b623ea6 100644 --- a/contrib/unbound/iterator/iter_utils.c +++ b/contrib/unbound/iterator/iter_utils.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -63,6 +63,8 @@ #include "validator/val_kcache.h" #include "validator/val_kentry.h" #include "validator/val_utils.h" +#include "validator/val_sigcrypt.h" +#include "ldns/sbuffer.h" /** time when nameserver glue is said to be 'recent' */ #define SUSPICION_RECENT_EXPIRY 86400 @@ -177,7 +179,7 @@ iter_apply_cfg(struct iter_env* iter_env, struct config_file* cfg) */ static int iter_filter_unsuitable(struct iter_env* iter_env, struct module_env* env, - uint8_t* name, size_t namelen, uint16_t qtype, uint32_t now, + uint8_t* name, size_t namelen, uint16_t qtype, time_t now, struct delegpt_addr* a) { int rtt, lame, reclame, dnsseclame; @@ -217,14 +219,16 @@ iter_filter_unsuitable(struct iter_env* iter_env, struct module_env* env, /* select remainder from worst to best */ else if(reclame) return rtt+USEFUL_SERVER_TOP_TIMEOUT*3; /* nonpref */ - else if(dnsseclame ) + else if(dnsseclame || a->dnsseclame) return rtt+USEFUL_SERVER_TOP_TIMEOUT*2; /* nonpref */ else if(a->lame) return rtt+USEFUL_SERVER_TOP_TIMEOUT+1; /* nonpref */ else return rtt; } /* no server information present */ - if(a->lame) + if(a->dnsseclame) + return UNKNOWN_SERVER_NICENESS+USEFUL_SERVER_TOP_TIMEOUT*2; /* nonpref */ + else if(a->lame) return USEFUL_SERVER_TOP_TIMEOUT+1+UNKNOWN_SERVER_NICENESS; /* nonpref */ return UNKNOWN_SERVER_NICENESS; } @@ -232,7 +236,7 @@ iter_filter_unsuitable(struct iter_env* iter_env, struct module_env* env, /** lookup RTT information, and also store fastest rtt (if any) */ static int iter_fill_rtt(struct iter_env* iter_env, struct module_env* env, - uint8_t* name, size_t namelen, uint16_t qtype, uint32_t now, + uint8_t* name, size_t namelen, uint16_t qtype, time_t now, struct delegpt* dp, int* best_rtt, struct sock_list* blacklist) { int got_it = 0; @@ -261,7 +265,7 @@ iter_fill_rtt(struct iter_env* iter_env, struct module_env* env, * returns number of best targets (or 0, no suitable targets) */ static int iter_filter_order(struct iter_env* iter_env, struct module_env* env, - uint8_t* name, size_t namelen, uint16_t qtype, uint32_t now, + uint8_t* name, size_t namelen, uint16_t qtype, time_t now, struct delegpt* dp, int* selected_rtt, int open_target, struct sock_list* blacklist) { @@ -387,7 +391,7 @@ iter_server_selection(struct iter_env* iter_env, } struct dns_msg* -dns_alloc_msg(ldns_buffer* pkt, struct msg_parse* msg, +dns_alloc_msg(sldns_buffer* pkt, struct msg_parse* msg, struct regional* region) { struct dns_msg* m = (struct dns_msg*)regional_alloc(region, @@ -420,7 +424,7 @@ dns_copy_msg(struct dns_msg* from, struct regional* region) void iter_dns_store(struct module_env* env, struct query_info* msgqinf, - struct reply_info* msgrep, int is_referral, uint32_t leeway, int pside, + struct reply_info* msgrep, int is_referral, time_t leeway, int pside, struct regional* region) { if(!dns_cache_store(env, msgqinf, msgrep, is_referral, leeway, @@ -680,7 +684,7 @@ rrset_equal(struct ub_packed_rrset_key* k1, struct ub_packed_rrset_key* k2) } int -reply_equal(struct reply_info* p, struct reply_info* q, ldns_buffer* scratch) +reply_equal(struct reply_info* p, struct reply_info* q, struct regional* region) { size_t i; if(p->flags != q->flags || @@ -695,27 +699,12 @@ reply_equal(struct reply_info* p, struct reply_info* q, ldns_buffer* scratch) return 0; for(i=0; irrset_count; i++) { if(!rrset_equal(p->rrsets[i], q->rrsets[i])) { - /* fallback procedure: try to sort and canonicalize */ - ldns_rr_list* pl, *ql; - pl = packed_rrset_to_rr_list(p->rrsets[i], scratch); - ql = packed_rrset_to_rr_list(q->rrsets[i], scratch); - if(!pl || !ql) { - ldns_rr_list_deep_free(pl); - ldns_rr_list_deep_free(ql); + if(!rrset_canonical_equal(region, p->rrsets[i], + q->rrsets[i])) { + regional_free_all(region); return 0; } - ldns_rr_list2canonical(pl); - ldns_rr_list2canonical(ql); - ldns_rr_list_sort(pl); - ldns_rr_list_sort(ql); - if(ldns_rr_list_compare(pl, ql) != 0) { - ldns_rr_list_deep_free(pl); - ldns_rr_list_deep_free(ql); - return 0; - } - ldns_rr_list_deep_free(pl); - ldns_rr_list_deep_free(ql); - continue; + regional_free_all(region); } } return 1; @@ -768,7 +757,7 @@ void iter_store_parentside_neg(struct module_env* env, /* TTL: NS from referral in iq->deleg_msg, * or first RR from iq->response, * or servfail5secs if !iq->response */ - uint32_t ttl = NORR_TTL; + time_t ttl = NORR_TTL; struct ub_packed_rrset_key* neg; struct packed_rrset_data* newd; if(rep) { @@ -798,7 +787,7 @@ void iter_store_parentside_neg(struct module_env* env, neg->entry.hash = rrset_key_hash(&neg->rk); newd = (struct packed_rrset_data*)regional_alloc_zero(env->scratch, sizeof(struct packed_rrset_data) + sizeof(size_t) + - sizeof(uint8_t*) + sizeof(uint32_t) + sizeof(uint16_t)); + sizeof(uint8_t*) + sizeof(time_t) + sizeof(uint16_t)); if(!newd) { log_err("out of memory in store_parentside_neg"); return; @@ -815,7 +804,7 @@ void iter_store_parentside_neg(struct module_env* env, newd->rr_len[0] = 0 /* zero len rdata */ + sizeof(uint16_t); packed_rrset_ptr_fixup(newd); newd->rr_ttl[0] = newd->ttl; - ldns_write_uint16(newd->rr_data[0], 0 /* zero len rdata */); + sldns_write_uint16(newd->rr_data[0], 0 /* zero len rdata */); /* store it */ log_rrset_key(VERB_ALGO, "store parent-side negative", neg); iter_store_parentside_rrset(env, neg); diff --git a/contrib/unbound/iterator/iter_utils.h b/contrib/unbound/iterator/iter_utils.h index 8f5a291af67..abdc68f3cd4 100644 --- a/contrib/unbound/iterator/iter_utils.h +++ b/contrib/unbound/iterator/iter_utils.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -43,7 +43,7 @@ #ifndef ITERATOR_ITER_UTILS_H #define ITERATOR_ITER_UTILS_H #include "iterator/iter_resptype.h" -#include +struct sldns_buffer; struct iter_env; struct iter_hints; struct iter_forwards; @@ -102,7 +102,7 @@ struct delegpt_addr* iter_server_selection(struct iter_env* iter_env, * @param regional: regional to use for allocation. * @return newly allocated dns_msg, or NULL on memory error. */ -struct dns_msg* dns_alloc_msg(ldns_buffer* pkt, struct msg_parse* msg, +struct dns_msg* dns_alloc_msg(struct sldns_buffer* pkt, struct msg_parse* msg, struct regional* regional); /** @@ -131,7 +131,7 @@ struct dns_msg* dns_copy_msg(struct dns_msg* from, struct regional* regional); * but the query resolution can continue without cache storage. */ void iter_dns_store(struct module_env* env, struct query_info* qinf, - struct reply_info* rep, int is_referral, uint32_t leeway, int pside, + struct reply_info* rep, int is_referral, time_t leeway, int pside, struct regional* region); /** @@ -216,10 +216,10 @@ int iter_msg_from_zone(struct dns_msg* msg, struct delegpt* dp, * @param p: reply one. The reply has rrset data pointers in region. * Does not check rrset-IDs * @param q: reply two - * @param buf: scratch buffer. + * @param region: scratch buffer. * @return if one and two are equal. */ -int reply_equal(struct reply_info* p, struct reply_info* q, ldns_buffer* buf); +int reply_equal(struct reply_info* p, struct reply_info* q, struct regional* region); /** * Store parent-side rrset in seperate rrset cache entries for later diff --git a/contrib/unbound/iterator/iterator.c b/contrib/unbound/iterator/iterator.c index e3f058fe512..87fac81f38c 100644 --- a/contrib/unbound/iterator/iterator.c +++ b/contrib/unbound/iterator/iterator.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -41,7 +41,6 @@ */ #include "config.h" -#include #include "iterator/iterator.h" #include "iterator/iter_utils.h" #include "iterator/iter_hints.h" @@ -62,6 +61,10 @@ #include "util/data/msgencode.h" #include "util/fptr_wlist.h" #include "util/config_file.h" +#include "ldns/rrdef.h" +#include "ldns/wire2str.h" +#include "ldns/parseutil.h" +#include "ldns/sbuffer.h" int iter_init(struct module_env* env, int id) @@ -228,8 +231,8 @@ static int error_response(struct module_qstate* qstate, int id, int rcode) { verbose(VERB_QUERY, "return error response %s", - ldns_lookup_by_id(ldns_rcodes, rcode)? - ldns_lookup_by_id(ldns_rcodes, rcode)->name:"??"); + sldns_lookup_by_id(sldns_rcodes, rcode)? + sldns_lookup_by_id(sldns_rcodes, rcode)->name:"??"); qstate->return_rcode = rcode; qstate->return_msg = NULL; qstate->ext_state[id] = module_finished; @@ -540,8 +543,8 @@ prime_root(struct module_qstate* qstate, struct iter_qstate* iq, int id, struct delegpt* dp; struct module_qstate* subq; verbose(VERB_DETAIL, "priming . %s NS", - ldns_lookup_by_id(ldns_rr_classes, (int)qclass)? - ldns_lookup_by_id(ldns_rr_classes, (int)qclass)->name:"??"); + sldns_lookup_by_id(sldns_rr_classes, (int)qclass)? + sldns_lookup_by_id(sldns_rr_classes, (int)qclass)->name:"??"); dp = hints_lookup_root(qstate->env->hints, qclass); if(!dp) { verbose(VERB_ALGO, "Cannot prime due to lack of hints"); @@ -1212,7 +1215,7 @@ processInitRequest3(struct module_qstate* qstate, struct iter_qstate* iq, * cached referral as the response. */ if(!(qstate->query_flags & BIT_RD)) { iq->response = iq->deleg_msg; - if(verbosity >= VERB_ALGO) + if(verbosity >= VERB_ALGO && iq->response) log_dns_msg("no RD requested, using delegation msg", &iq->response->qinfo, iq->response->rep); if(qstate->reply_origin) @@ -1409,6 +1412,35 @@ query_for_targets(struct module_qstate* qstate, struct iter_qstate* iq, return 1; } +/** see if last resort is possible - does config allow queries to parent */ +static int +can_have_last_resort(struct module_env* env, struct delegpt* dp, + struct iter_qstate* iq) +{ + struct delegpt* fwddp; + struct iter_hints_stub* stub; + /* do not process a last resort (the parent side) if a stub + * or forward is configured, because we do not want to go 'above' + * the configured servers */ + if(!dname_is_root(dp->name) && (stub = (struct iter_hints_stub*) + name_tree_find(&env->hints->tree, dp->name, dp->namelen, + dp->namelabs, iq->qchase.qclass)) && + /* has_parent side is turned off for stub_first, where we + * are allowed to go to the parent */ + stub->dp->has_parent_side_NS) { + verbose(VERB_QUERY, "configured stub servers failed -- returning SERVFAIL"); + return 0; + } + if((fwddp = forwards_find(env->fwds, dp->name, iq->qchase.qclass)) && + /* has_parent_side is turned off for forward_first, where + * we are allowed to go to the parent */ + fwddp->has_parent_side_NS) { + verbose(VERB_QUERY, "configured forward servers failed -- returning SERVFAIL"); + return 0; + } + return 1; +} + /** * Called by processQueryTargets when it would like extra targets to query * but it seems to be out of options. At last resort some less appealing @@ -1430,6 +1462,11 @@ processLastResort(struct module_qstate* qstate, struct iter_qstate* iq, verbose(VERB_ALGO, "No more query targets, attempting last resort"); log_assert(iq->dp); + if(!can_have_last_resort(qstate->env, iq->dp, iq)) { + /* fail -- no more targets, no more hope of targets, no hope + * of a response. */ + return error_response_cache(qstate, id, LDNS_RCODE_SERVFAIL); + } if(!iq->dp->has_parent_side_NS && dname_is_root(iq->dp->name)) { struct delegpt* p = hints_lookup_root(qstate->env->hints, iq->qchase.qclass); @@ -1439,7 +1476,7 @@ processLastResort(struct module_qstate* qstate, struct iter_qstate* iq, iq->chase_flags &= ~BIT_RD; /* go to authorities */ for(ns = p->nslist; ns; ns=ns->next) { (void)delegpt_add_ns(iq->dp, qstate->region, - ns->name, (int)ns->lame); + ns->name, ns->lame); } for(a = p->target_list; a; a=a->next_target) { (void)delegpt_add_addr(iq->dp, qstate->region, @@ -1880,12 +1917,23 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq, && type != RESPONSE_TYPE_UNTYPED) { /* a possible answer, see if it is missing DNSSEC */ /* but not when forwarding, so we dont mark fwder lame */ - /* also make sure the answer is from the zone we expected, - * otherwise, (due to parent,child on same server), we - * might mark the server,zone lame inappropriately */ - if(!iter_msg_has_dnssec(iq->response) && - iter_msg_from_zone(iq->response, iq->dp, type, - iq->qchase.qclass)) { + if(!iter_msg_has_dnssec(iq->response)) { + /* Mark this address as dnsseclame in this dp, + * because that will make serverselection disprefer + * it, but also, once it is the only final option, + * use dnssec-lame-bypass if it needs to query there.*/ + if(qstate->reply) { + struct delegpt_addr* a = delegpt_find_addr( + iq->dp, &qstate->reply->addr, + qstate->reply->addrlen); + if(a) a->dnsseclame = 1; + } + /* test the answer is from the zone we expected, + * otherwise, (due to parent,child on same server), we + * might mark the server,zone lame inappropriately */ + if(!iter_msg_from_zone(iq->response, iq->dp, type, + iq->qchase.qclass)) + qstate->reply = NULL; type = RESPONSE_TYPE_LAME; dnsseclame = 1; } @@ -2117,8 +2165,7 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq, *qstate->env->now, dnsseclame, 0, iq->qchase.qtype)) log_err("mark host lame: out of memory"); - } else log_err("%slame response from cache", - dnsseclame?"DNSSEC ":""); + } } else if(type == RESPONSE_TYPE_REC_LAME) { /* Cache the LAMEness. */ verbose(VERB_DETAIL, "query response REC_LAME: " @@ -2326,12 +2373,12 @@ processTargetResponse(struct module_qstate* qstate, int id, rrset->rk.dname_len)) { /* if dpns->lame then set newcname ns lame too */ if(!delegpt_add_ns(foriq->dp, forq->region, - rrset->rk.dname, (int)dpns->lame)) + rrset->rk.dname, dpns->lame)) log_err("out of memory adding cnamed-ns"); } /* if dpns->lame then set the address(es) lame too */ if(!delegpt_add_rrset(foriq->dp, forq->region, rrset, - (int)dpns->lame)) + dpns->lame)) log_err("out of memory adding targets"); verbose(VERB_ALGO, "added target response"); delegpt_log(VERB_ALGO, foriq->dp); @@ -2704,7 +2751,7 @@ process_response(struct module_qstate* qstate, struct iter_qstate* iq, { struct msg_parse* prs; struct edns_data edns; - ldns_buffer* pkt; + sldns_buffer* pkt; verbose(VERB_ALGO, "process_response: new external response event"); iq->response = NULL; @@ -2731,7 +2778,7 @@ process_response(struct module_qstate* qstate, struct iter_qstate* iq, memset(prs, 0, sizeof(*prs)); memset(&edns, 0, sizeof(edns)); pkt = qstate->reply->c->buffer; - ldns_buffer_set_position(pkt, 0); + sldns_buffer_set_position(pkt, 0); if(parse_packet(pkt, prs, qstate->env->scratch) != LDNS_RCODE_NOERROR) { verbose(VERB_ALGO, "parse error on reply packet"); goto handle_it; @@ -2771,7 +2818,7 @@ process_response(struct module_qstate* qstate, struct iter_qstate* iq, } else { /* check if reply is the same, otherwise, fail */ if(!reply_equal(iq->response->rep, iq->caps_reply, - qstate->env->scratch_buffer)) { + qstate->env->scratch)) { verbose(VERB_DETAIL, "Capsforid fallback: " "getting different replies, failed"); outbound_list_remove(&iq->outlist, outbound); diff --git a/contrib/unbound/iterator/iterator.h b/contrib/unbound/iterator/iterator.h index eb333157a4f..1816d12cd03 100644 --- a/contrib/unbound/iterator/iterator.h +++ b/contrib/unbound/iterator/iterator.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/ldns/keyraw.c b/contrib/unbound/ldns/keyraw.c new file mode 100644 index 00000000000..fe650aadacb --- /dev/null +++ b/contrib/unbound/ldns/keyraw.c @@ -0,0 +1,368 @@ +/* + * keyraw.c - raw key operations and conversions + * + * (c) NLnet Labs, 2004-2008 + * + * See the file LICENSE for the license + */ +/** + * \file + * Implementation of raw DNSKEY functions (work on wire rdata). + */ + +#include "config.h" +#include "ldns/keyraw.h" +#include "ldns/rrdef.h" + +#ifdef HAVE_SSL +#include +#include +#include +#include +#include +#ifdef HAVE_OPENSSL_ENGINE_H +# include +#endif +#endif /* HAVE_SSL */ + +size_t +sldns_rr_dnskey_key_size_raw(const unsigned char* keydata, + const size_t len, int alg) +{ + /* for DSA keys */ + uint8_t t; + + /* for RSA keys */ + uint16_t exp; + uint16_t int16; + + switch ((sldns_algorithm)alg) { + case LDNS_DSA: + case LDNS_DSA_NSEC3: + if (len > 0) { + t = keydata[0]; + return (64 + t*8)*8; + } else { + return 0; + } + break; + case LDNS_RSAMD5: + case LDNS_RSASHA1: + case LDNS_RSASHA1_NSEC3: +#ifdef USE_SHA2 + case LDNS_RSASHA256: + case LDNS_RSASHA512: +#endif + if (len > 0) { + if (keydata[0] == 0) { + /* big exponent */ + if (len > 3) { + memmove(&int16, keydata + 1, 2); + exp = ntohs(int16); + return (len - exp - 3)*8; + } else { + return 0; + } + } else { + exp = keydata[0]; + return (len-exp-1)*8; + } + } else { + return 0; + } + break; +#ifdef USE_GOST + case LDNS_ECC_GOST: + return 512; +#endif +#ifdef USE_ECDSA + case LDNS_ECDSAP256SHA256: + return 256; + case LDNS_ECDSAP384SHA384: + return 384; +#endif + default: + return 0; + } +} + +uint16_t sldns_calc_keytag_raw(uint8_t* key, size_t keysize) +{ + if(keysize < 4) { + return 0; + } + /* look at the algorithm field, copied from 2535bis */ + if (key[3] == LDNS_RSAMD5) { + uint16_t ac16 = 0; + if (keysize > 4) { + memmove(&ac16, key + keysize - 3, 2); + } + ac16 = ntohs(ac16); + return (uint16_t) ac16; + } else { + size_t i; + uint32_t ac32 = 0; + for (i = 0; i < keysize; ++i) { + ac32 += (i & 1) ? key[i] : key[i] << 8; + } + ac32 += (ac32 >> 16) & 0xFFFF; + return (uint16_t) (ac32 & 0xFFFF); + } +} + +#ifdef HAVE_SSL +#ifdef USE_GOST +/** store GOST engine reference loaded into OpenSSL library */ +ENGINE* sldns_gost_engine = NULL; + +int +sldns_key_EVP_load_gost_id(void) +{ + static int gost_id = 0; + const EVP_PKEY_ASN1_METHOD* meth; + ENGINE* e; + + if(gost_id) return gost_id; + + /* see if configuration loaded gost implementation from other engine*/ + meth = EVP_PKEY_asn1_find_str(NULL, "gost2001", -1); + if(meth) { + EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth); + return gost_id; + } + + /* see if engine can be loaded already */ + e = ENGINE_by_id("gost"); + if(!e) { + /* load it ourself, in case statically linked */ + ENGINE_load_builtin_engines(); + ENGINE_load_dynamic(); + e = ENGINE_by_id("gost"); + } + if(!e) { + /* no gost engine in openssl */ + return 0; + } + if(!ENGINE_set_default(e, ENGINE_METHOD_ALL)) { + ENGINE_finish(e); + ENGINE_free(e); + return 0; + } + + meth = EVP_PKEY_asn1_find_str(&e, "gost2001", -1); + if(!meth) { + /* algo not found */ + ENGINE_finish(e); + ENGINE_free(e); + return 0; + } + /* Note: do not ENGINE_finish and ENGINE_free the acquired engine + * on some platforms this frees up the meth and unloads gost stuff */ + sldns_gost_engine = e; + + EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth); + return gost_id; +} + +void sldns_key_EVP_unload_gost(void) +{ + if(sldns_gost_engine) { + ENGINE_finish(sldns_gost_engine); + ENGINE_free(sldns_gost_engine); + sldns_gost_engine = NULL; + } +} +#endif /* USE_GOST */ + +DSA * +sldns_key_buf2dsa_raw(unsigned char* key, size_t len) +{ + uint8_t T; + uint16_t length; + uint16_t offset; + DSA *dsa; + BIGNUM *Q; BIGNUM *P; + BIGNUM *G; BIGNUM *Y; + + if(len == 0) + return NULL; + T = (uint8_t)key[0]; + length = (64 + T * 8); + offset = 1; + + if (T > 8) { + return NULL; + } + if(len < (size_t)1 + SHA_DIGEST_LENGTH + 3*length) + return NULL; + + Q = BN_bin2bn(key+offset, SHA_DIGEST_LENGTH, NULL); + offset += SHA_DIGEST_LENGTH; + + P = BN_bin2bn(key+offset, (int)length, NULL); + offset += length; + + G = BN_bin2bn(key+offset, (int)length, NULL); + offset += length; + + Y = BN_bin2bn(key+offset, (int)length, NULL); + offset += length; + + /* create the key and set its properties */ + if(!Q || !P || !G || !Y || !(dsa = DSA_new())) { + BN_free(Q); + BN_free(P); + BN_free(G); + BN_free(Y); + return NULL; + } +#ifndef S_SPLINT_S + dsa->p = P; + dsa->q = Q; + dsa->g = G; + dsa->pub_key = Y; +#endif /* splint */ + + return dsa; +} + +RSA * +sldns_key_buf2rsa_raw(unsigned char* key, size_t len) +{ + uint16_t offset; + uint16_t exp; + uint16_t int16; + RSA *rsa; + BIGNUM *modulus; + BIGNUM *exponent; + + if (len == 0) + return NULL; + if (key[0] == 0) { + if(len < 3) + return NULL; + memmove(&int16, key+1, 2); + exp = ntohs(int16); + offset = 3; + } else { + exp = key[0]; + offset = 1; + } + + /* key length at least one */ + if(len < (size_t)offset + exp + 1) + return NULL; + + /* Exponent */ + exponent = BN_new(); + if(!exponent) return NULL; + (void) BN_bin2bn(key+offset, (int)exp, exponent); + offset += exp; + + /* Modulus */ + modulus = BN_new(); + if(!modulus) { + BN_free(exponent); + return NULL; + } + /* length of the buffer must match the key length! */ + (void) BN_bin2bn(key+offset, (int)(len - offset), modulus); + + rsa = RSA_new(); + if(!rsa) { + BN_free(exponent); + BN_free(modulus); + return NULL; + } +#ifndef S_SPLINT_S + rsa->n = modulus; + rsa->e = exponent; +#endif /* splint */ + + return rsa; +} + +#ifdef USE_GOST +EVP_PKEY* +sldns_gost2pkey_raw(unsigned char* key, size_t keylen) +{ + /* prefix header for X509 encoding */ + uint8_t asn[37] = { 0x30, 0x63, 0x30, 0x1c, 0x06, 0x06, 0x2a, 0x85, + 0x03, 0x02, 0x02, 0x13, 0x30, 0x12, 0x06, 0x07, 0x2a, 0x85, + 0x03, 0x02, 0x02, 0x23, 0x01, 0x06, 0x07, 0x2a, 0x85, 0x03, + 0x02, 0x02, 0x1e, 0x01, 0x03, 0x43, 0x00, 0x04, 0x40}; + unsigned char encoded[37+64]; + const unsigned char* pp; + if(keylen != 64) { + /* key wrong size */ + return NULL; + } + + /* create evp_key */ + memmove(encoded, asn, 37); + memmove(encoded+37, key, 64); + pp = (unsigned char*)&encoded[0]; + + return d2i_PUBKEY(NULL, &pp, (int)sizeof(encoded)); +} +#endif /* USE_GOST */ + +#ifdef USE_ECDSA +EVP_PKEY* +sldns_ecdsa2pkey_raw(unsigned char* key, size_t keylen, uint8_t algo) +{ + unsigned char buf[256+2]; /* sufficient for 2*384/8+1 */ + const unsigned char* pp = buf; + EVP_PKEY *evp_key; + EC_KEY *ec; + /* check length, which uncompressed must be 2 bignums */ + if(algo == LDNS_ECDSAP256SHA256) { + if(keylen != 2*256/8) return NULL; + ec = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); + } else if(algo == LDNS_ECDSAP384SHA384) { + if(keylen != 2*384/8) return NULL; + ec = EC_KEY_new_by_curve_name(NID_secp384r1); + } else ec = NULL; + if(!ec) return NULL; + if(keylen+1 > sizeof(buf)) + return NULL; /* sanity check */ + /* prepend the 0x02 (from docs) (or actually 0x04 from implementation + * of openssl) for uncompressed data */ + buf[0] = POINT_CONVERSION_UNCOMPRESSED; + memmove(buf+1, key, keylen); + if(!o2i_ECPublicKey(&ec, &pp, (int)keylen+1)) { + EC_KEY_free(ec); + return NULL; + } + evp_key = EVP_PKEY_new(); + if(!evp_key) { + EC_KEY_free(ec); + return NULL; + } + if (!EVP_PKEY_assign_EC_KEY(evp_key, ec)) { + EVP_PKEY_free(evp_key); + EC_KEY_free(ec); + return NULL; + } + return evp_key; +} +#endif /* USE_ECDSA */ + +int +sldns_digest_evp(unsigned char* data, unsigned int len, unsigned char* dest, + const EVP_MD* md) +{ + EVP_MD_CTX* ctx; + ctx = EVP_MD_CTX_create(); + if(!ctx) + return 0; + if(!EVP_DigestInit_ex(ctx, md, NULL) || + !EVP_DigestUpdate(ctx, data, len) || + !EVP_DigestFinal_ex(ctx, dest, NULL)) { + EVP_MD_CTX_destroy(ctx); + return 0; + } + EVP_MD_CTX_destroy(ctx); + return 1; +} +#endif /* HAVE_SSL */ diff --git a/contrib/unbound/ldns/keyraw.h b/contrib/unbound/ldns/keyraw.h new file mode 100644 index 00000000000..8abe235097b --- /dev/null +++ b/contrib/unbound/ldns/keyraw.h @@ -0,0 +1,112 @@ +/* + * keyraw.h -- raw key and signature access and conversion + * + * Copyright (c) 2005-2008, NLnet Labs. All rights reserved. + * + * See LICENSE for the license. + * + */ + +/** + * \file + * + * raw key and signature access and conversion + * + * Since those functions heavily rely op cryptographic operations, + * this module is dependent on openssl. + * + */ + +#ifndef LDNS_KEYRAW_H +#define LDNS_KEYRAW_H + +#ifdef __cplusplus +extern "C" { +#endif +#if LDNS_BUILD_CONFIG_HAVE_SSL +# include +# include +#endif /* LDNS_BUILD_CONFIG_HAVE_SSL */ + +/** + * get the length of the keydata in bits + * \param[in] keydata the raw key data + * \param[in] len the length of the keydata + * \param[in] alg the cryptographic algorithm this is a key for + * \return the keysize in bits, or 0 on error + */ +size_t sldns_rr_dnskey_key_size_raw(const unsigned char *keydata, + const size_t len, int alg); + +/** + * Calculates keytag of DNSSEC key, operates on wireformat rdata. + * \param[in] key the key as uncompressed wireformat rdata. + * \param[in] keysize length of key data. + * \return the keytag + */ +uint16_t sldns_calc_keytag_raw(uint8_t* key, size_t keysize); + +#if LDNS_BUILD_CONFIG_HAVE_SSL +/** + * Get the PKEY id for GOST, loads GOST into openssl as a side effect. + * Only available if GOST is compiled into the library and openssl. + * \return the gost id for EVP_CTX creation. + */ +int sldns_key_EVP_load_gost_id(void); + +/** Release the engine reference held for the GOST engine. */ +void sldns_key_EVP_unload_gost(void); + +/** + * Like sldns_key_buf2dsa, but uses raw buffer. + * \param[in] key the uncompressed wireformat of the key. + * \param[in] len length of key data + * \return a DSA * structure with the key material + */ +DSA *sldns_key_buf2dsa_raw(unsigned char* key, size_t len); + +/** + * Converts a holding buffer with key material to EVP PKEY in openssl. + * Only available if ldns was compiled with GOST. + * \param[in] key data to convert + * \param[in] keylen length of the key data + * \return the key or NULL on error. + */ +EVP_PKEY* sldns_gost2pkey_raw(unsigned char* key, size_t keylen); + +/** + * Converts a holding buffer with key material to EVP PKEY in openssl. + * Only available if ldns was compiled with ECDSA. + * \param[in] key data to convert + * \param[in] keylen length of the key data + * \param[in] algo precise algorithm to initialize ECC group values. + * \return the key or NULL on error. + */ +EVP_PKEY* sldns_ecdsa2pkey_raw(unsigned char* key, size_t keylen, uint8_t algo); + +/** + * Like sldns_key_buf2rsa, but uses raw buffer. + * \param[in] key the uncompressed wireformat of the key. + * \param[in] len length of key data + * \return a RSA * structure with the key material + */ +RSA *sldns_key_buf2rsa_raw(unsigned char* key, size_t len); + +/** + * Utility function to calculate hash using generic EVP_MD pointer. + * \param[in] data the data to hash. + * \param[in] len length of data. + * \param[out] dest the destination of the hash, must be large enough. + * \param[in] md the message digest to use. + * \return true if worked, false on failure. + */ +int sldns_digest_evp(unsigned char* data, unsigned int len, + unsigned char* dest, const EVP_MD* md); + +#endif /* LDNS_BUILD_CONFIG_HAVE_SSL */ + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_KEYRAW_H */ diff --git a/contrib/unbound/ldns/parse.c b/contrib/unbound/ldns/parse.c new file mode 100644 index 00000000000..a605e549fca --- /dev/null +++ b/contrib/unbound/ldns/parse.c @@ -0,0 +1,470 @@ +/* + * a generic (simple) parser. Use to parse rr's, private key + * information and /etc/resolv.conf files + * + * a Net::DNS like library for C + * LibDNS Team @ NLnet Labs + * (c) NLnet Labs, 2005-2006 + * See the file LICENSE for the license + */ +#include "config.h" +#include "ldns/parse.h" +#include "ldns/parseutil.h" +#include "ldns/sbuffer.h" + +#include +#include + +sldns_lookup_table sldns_directive_types[] = { + { LDNS_DIR_TTL, "$TTL" }, + { LDNS_DIR_ORIGIN, "$ORIGIN" }, + { LDNS_DIR_INCLUDE, "$INCLUDE" }, + { 0, NULL } +}; + +/* add max_limit here? */ +ssize_t +sldns_fget_token(FILE *f, char *token, const char *delim, size_t limit) +{ + return sldns_fget_token_l(f, token, delim, limit, NULL); +} + +ssize_t +sldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit, int *line_nr) +{ + int c, prev_c; + int p; /* 0 -> no parenthese seen, >0 nr of ( seen */ + int com, quoted; + char *t; + size_t i; + const char *d; + const char *del; + + /* standard delimeters */ + if (!delim) { + /* from isspace(3) */ + del = LDNS_PARSE_NORMAL; + } else { + del = delim; + } + + p = 0; + i = 0; + com = 0; + quoted = 0; + prev_c = 0; + t = token; + if (del[0] == '"') { + quoted = 1; + } + while ((c = getc(f)) != EOF) { + if (c == '\r') /* carriage return */ + c = ' '; + if (c == '(' && prev_c != '\\' && !quoted) { + /* this only counts for non-comments */ + if (com == 0) { + p++; + } + prev_c = c; + continue; + } + + if (c == ')' && prev_c != '\\' && !quoted) { + /* this only counts for non-comments */ + if (com == 0) { + p--; + } + prev_c = c; + continue; + } + + if (p < 0) { + /* more ) then ( - close off the string */ + *t = '\0'; + return 0; + } + + /* do something with comments ; */ + if (c == ';' && quoted == 0) { + if (prev_c != '\\') { + com = 1; + } + } + if (c == '\"' && com == 0 && prev_c != '\\') { + quoted = 1 - quoted; + } + + if (c == '\n' && com != 0) { + /* comments */ + com = 0; + *t = ' '; + if (line_nr) { + *line_nr = *line_nr + 1; + } + if (p == 0 && i > 0) { + goto tokenread; + } else { + prev_c = c; + continue; + } + } + + if (com == 1) { + *t = ' '; + prev_c = c; + continue; + } + + if (c == '\n' && p != 0 && t > token) { + /* in parentheses */ + if (line_nr) { + *line_nr = *line_nr + 1; + } + *t++ = ' '; + prev_c = c; + continue; + } + + /* check if we hit the delim */ + for (d = del; *d; d++) { + if (c == *d && i > 0 && prev_c != '\\' && p == 0) { + if (c == '\n' && line_nr) { + *line_nr = *line_nr + 1; + } + goto tokenread; + } + } + if (c != '\0' && c != '\n') { + i++; + } + if (limit > 0 && (i >= limit || (size_t)(t-token) >= limit)) { + *t = '\0'; + return -1; + } + if (c != '\0' && c != '\n') { + *t++ = c; + } + if (c == '\\' && prev_c == '\\') + prev_c = 0; + else prev_c = c; + } + *t = '\0'; + if (c == EOF) { + return (ssize_t)i; + } + + if (i == 0) { + /* nothing read */ + return -1; + } + if (p != 0) { + return -1; + } + return (ssize_t)i; + +tokenread: + if(*del == '"') + /* do not skip over quotes after the string, they are part + * of the next string. But skip over whitespace (if needed)*/ + sldns_fskipcs_l(f, del+1, line_nr); + else sldns_fskipcs_l(f, del, line_nr); + *t = '\0'; + if (p != 0) { + return -1; + } + + return (ssize_t)i; +} + +ssize_t +sldns_fget_keyword_data(FILE *f, const char *keyword, const char *k_del, char *data, + const char *d_del, size_t data_limit) +{ + return sldns_fget_keyword_data_l(f, keyword, k_del, data, d_del, + data_limit, NULL); +} + +ssize_t +sldns_fget_keyword_data_l(FILE *f, const char *keyword, const char *k_del, char *data, + const char *d_del, size_t data_limit, int *line_nr) +{ + /* we assume: keyword|sep|data */ + char *fkeyword; + ssize_t i; + + if(strlen(keyword) >= LDNS_MAX_KEYWORDLEN) + return -1; + fkeyword = (char*)malloc(LDNS_MAX_KEYWORDLEN); + if(!fkeyword) + return -1; + + i = sldns_fget_token(f, fkeyword, k_del, LDNS_MAX_KEYWORDLEN); + if(i==0 || i==-1) { + free(fkeyword); + return -1; + } + + /* case??? i instead of strlen? */ + if (strncmp(fkeyword, keyword, LDNS_MAX_KEYWORDLEN - 1) == 0) { + /* whee! */ + /* printf("%s\n%s\n", "Matching keyword", fkeyword); */ + i = sldns_fget_token_l(f, data, d_del, data_limit, line_nr); + free(fkeyword); + return i; + } else { + /*printf("no match for %s (read: %s)\n", keyword, fkeyword);*/ + free(fkeyword); + return -1; + } +} + +int +sldns_bgetc(sldns_buffer *buffer) +{ + if (!sldns_buffer_available_at(buffer, buffer->_position, sizeof(uint8_t))) { + sldns_buffer_set_position(buffer, sldns_buffer_limit(buffer)); + /* sldns_buffer_rewind(buffer);*/ + return EOF; + } + return (int)sldns_buffer_read_u8(buffer); +} + +ssize_t +sldns_bget_token(sldns_buffer *b, char *token, const char *delim, size_t limit) +{ + return sldns_bget_token_par(b, token, delim, limit, NULL, NULL); +} + +ssize_t +sldns_bget_token_par(sldns_buffer *b, char *token, const char *delim, + size_t limit, int* par, const char* skipw) +{ + int c, lc; + int p; /* 0 -> no parenthese seen, >0 nr of ( seen */ + int com, quoted; + char *t; + size_t i; + const char *d; + const char *del; + + /* standard delimiters */ + if (!delim) { + /* from isspace(3) */ + del = LDNS_PARSE_NORMAL; + } else { + del = delim; + } + + p = (par?*par:0); + i = 0; + com = 0; + quoted = 0; + t = token; + lc = 0; + if (del[0] == '"') { + quoted = 1; + } + + while ((c = sldns_bgetc(b)) != EOF) { + if (c == '\r') /* carriage return */ + c = ' '; + if (c == '(' && lc != '\\' && !quoted) { + /* this only counts for non-comments */ + if (com == 0) { + if(par) (*par)++; + p++; + } + lc = c; + continue; + } + + if (c == ')' && lc != '\\' && !quoted) { + /* this only counts for non-comments */ + if (com == 0) { + if(par) (*par)--; + p--; + } + lc = c; + continue; + } + + if (p < 0) { + /* more ) then ( */ + *t = '\0'; + return 0; + } + + /* do something with comments ; */ + if (c == ';' && quoted == 0) { + if (lc != '\\') { + com = 1; + } + } + if (c == '"' && com == 0 && lc != '\\') { + quoted = 1 - quoted; + } + + if (c == '\n' && com != 0) { + /* comments */ + com = 0; + *t = ' '; + lc = c; + continue; + } + + if (com == 1) { + *t = ' '; + lc = c; + continue; + } + + if (c == '\n' && p != 0) { + /* in parentheses */ + /* do not write ' ' if we want to skip spaces */ + if(!(skipw && (strchr(skipw, c)||strchr(skipw, ' ')))) + *t++ = ' '; + lc = c; + continue; + } + + /* check to skip whitespace at start, but also after ( */ + if(skipw && i==0 && !com && !quoted && lc != '\\') { + if(strchr(skipw, c)) { + lc = c; + continue; + } + } + + /* check if we hit the delim */ + for (d = del; *d; d++) { + /* we can only exit if no parens or user tracks them */ + if (c == *d && lc != '\\' && (p == 0 || par)) { + goto tokenread; + } + } + + i++; + if (limit > 0 && (i >= limit || (size_t)(t-token) >= limit)) { + *t = '\0'; + return -1; + } + *t++ = c; + + if (c == '\\' && lc == '\\') { + lc = 0; + } else { + lc = c; + } + } + *t = '\0'; + if (i == 0) { + /* nothing read */ + return -1; + } + if (!par && p != 0) { + return -1; + } + return (ssize_t)i; + +tokenread: + if(*del == '"') + /* do not skip over quotes after the string, they are part + * of the next string. But skip over whitespace (if needed)*/ + sldns_bskipcs(b, del+1); + else sldns_bskipcs(b, del); + *t = '\0'; + + if (!par && p != 0) { + return -1; + } + return (ssize_t)i; +} + + +void +sldns_bskipcs(sldns_buffer *buffer, const char *s) +{ + int found; + char c; + const char *d; + + while(sldns_buffer_available_at(buffer, buffer->_position, sizeof(char))) { + c = (char) sldns_buffer_read_u8_at(buffer, buffer->_position); + found = 0; + for (d = s; *d; d++) { + if (*d == c) { + found = 1; + } + } + if (found && buffer->_limit > buffer->_position) { + buffer->_position += sizeof(char); + } else { + return; + } + } +} + +void +sldns_fskipcs(FILE *fp, const char *s) +{ + sldns_fskipcs_l(fp, s, NULL); +} + +void +sldns_fskipcs_l(FILE *fp, const char *s, int *line_nr) +{ + int found; + int c; + const char *d; + + while ((c = fgetc(fp)) != EOF) { + if (line_nr && c == '\n') { + *line_nr = *line_nr + 1; + } + found = 0; + for (d = s; *d; d++) { + if (*d == c) { + found = 1; + } + } + if (!found) { + /* with getc, we've read too far */ + ungetc(c, fp); + return; + } + } +} + +ssize_t +sldns_bget_keyword_data(sldns_buffer *b, const char *keyword, const char *k_del, char +*data, const char *d_del, size_t data_limit) +{ + /* we assume: keyword|sep|data */ + char *fkeyword; + ssize_t i; + + if(strlen(keyword) >= LDNS_MAX_KEYWORDLEN) + return -1; + fkeyword = (char*)malloc(LDNS_MAX_KEYWORDLEN); + if(!fkeyword) + return -1; /* out of memory */ + + i = sldns_bget_token(b, fkeyword, k_del, data_limit); + if(i==0 || i==-1) { + free(fkeyword); + return -1; /* nothing read */ + } + + /* case??? */ + if (strncmp(fkeyword, keyword, strlen(keyword)) == 0) { + free(fkeyword); + /* whee, the match! */ + /* retrieve it's data */ + i = sldns_bget_token(b, data, d_del, 0); + return i; + } else { + free(fkeyword); + return -1; + } +} + diff --git a/contrib/unbound/ldns/parse.h b/contrib/unbound/ldns/parse.h new file mode 100644 index 00000000000..7b7456dd206 --- /dev/null +++ b/contrib/unbound/ldns/parse.h @@ -0,0 +1,184 @@ +/* + * parse.h + * + * a Net::DNS like library for C + * LibDNS Team @ NLnet Labs + * (c) NLnet Labs, 2005-2006 + * See the file LICENSE for the license + */ + +#ifndef LDNS_PARSE_H +#define LDNS_PARSE_H + +struct sldns_buffer; + +#ifdef __cplusplus +extern "C" { +#endif + +#define LDNS_PARSE_SKIP_SPACE "\f\n\r\v" +#define LDNS_PARSE_NORMAL " \f\n\r\t\v" +#define LDNS_PARSE_NO_NL " \t" +#define LDNS_MAX_LINELEN 10230 +#define LDNS_MAX_KEYWORDLEN 32 + + +/** + * \file + * + * Contains some low-level parsing functions, mostly used in the _frm_str + * family of functions. + */ + +/** + * different type of directives in zone files + * We now deal with $TTL, $ORIGIN and $INCLUDE. + * The latter is not implemented in ldns (yet) + */ +enum sldns_enum_directive +{ + LDNS_DIR_TTL, + LDNS_DIR_ORIGIN, + LDNS_DIR_INCLUDE +}; +typedef enum sldns_enum_directive sldns_directive; + +/** + * returns a token/char from the stream F. + * This function deals with ( and ) in the stream, + * and ignores them when encountered + * \param[in] *f the file to read from + * \param[out] *token the read token is put here + * \param[in] *delim chars at which the parsing should stop + * \param[in] *limit how much to read. If 0 the builtin maximum is used + * \return 0 on error of EOF of the stream F. Otherwise return the length of what is read + */ +ssize_t sldns_fget_token(FILE *f, char *token, const char *delim, size_t limit); + +/** + * returns a token/char from the stream F. + * This function deals with ( and ) in the stream, + * and ignores when it finds them. + * \param[in] *f the file to read from + * \param[out] *token the token is put here + * \param[in] *delim chars at which the parsing should stop + * \param[in] *limit how much to read. If 0 use builtin maximum + * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) + * \return 0 on error of EOF of F otherwise return the length of what is read + */ +ssize_t sldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit, int *line_nr); + +/** + * returns a token/char from the buffer b. + * This function deals with ( and ) in the buffer, + * and ignores when it finds them. + * \param[in] *b the buffer to read from + * \param[out] *token the token is put here + * \param[in] *delim chars at which the parsing should stop + * \param[in] *limit how much to read. If 0 the builtin maximum is used + * \param[in] *par if you pass nonNULL, set to 0 on first call, the parenthesis + * state is stored in it, for use on next call. User must check it is back + * to zero after last bget in string (for parse error). If you pass NULL, + * the entire parenthesized string is read in. + * \param[in] skipw string with whitespace to skip before the start of the + * token, like " ", or " \t", or NULL for none. + * \returns 0 on error of EOF of b. Otherwise return the length of what is read + */ +ssize_t sldns_bget_token_par(struct sldns_buffer *b, char *token, const char *delim, size_t limit, int* par, const char* skipw); + +/** + * returns a token/char from the buffer b. + * This function deals with ( and ) in the buffer, + * and ignores when it finds them. + * \param[in] *b the buffer to read from + * \param[out] *token the token is put here + * \param[in] *delim chars at which the parsing should stop + * \param[in] *limit how much to read. If 0 the builtin maximum is used + * \returns 0 on error of EOF of b. Otherwise return the length of what is read + */ +ssize_t sldns_bget_token(struct sldns_buffer *b, char *token, const char *delim, size_t limit); + +/* + * searches for keyword and delim in a file. Gives everything back + * after the keyword + k_del until we hit d_del + * \param[in] f file pointer to read from + * \param[in] keyword keyword to look for + * \param[in] k_del keyword delimeter + * \param[out] data the data found + * \param[in] d_del the data delimeter + * \param[in] data_limit maximum size the the data buffer + * \return the number of character read + */ +ssize_t sldns_fget_keyword_data(FILE *f, const char *keyword, const char *k_del, char *data, const char *d_del, size_t data_limit); + +/* + * searches for keyword and delim. Gives everything back + * after the keyword + k_del until we hit d_del + * \param[in] f file pointer to read from + * \param[in] keyword keyword to look for + * \param[in] k_del keyword delimeter + * \param[out] data the data found + * \param[in] d_del the data delimeter + * \param[in] data_limit maximum size the the data buffer + * \param[in] line_nr pointer to an integer containing the current line number (for +debugging purposes) + * \return the number of character read + */ +ssize_t sldns_fget_keyword_data_l(FILE *f, const char *keyword, const char *k_del, char *data, const char *d_del, size_t data_limit, int *line_nr); + +/* + * searches for keyword and delim in a buffer. Gives everything back + * after the keyword + k_del until we hit d_del + * \param[in] b buffer pointer to read from + * \param[in] keyword keyword to look for + * \param[in] k_del keyword delimeter + * \param[out] data the data found + * \param[in] d_del the data delimeter + * \param[in] data_limit maximum size the the data buffer + * \return the number of character read + */ +ssize_t sldns_bget_keyword_data(struct sldns_buffer *b, const char *keyword, const char *k_del, char *data, const char *d_del, size_t data_limit); + +/** + * returns the next character from a buffer. Advances the position pointer with 1. + * When end of buffer is reached returns EOF. This is the buffer's equivalent + * for getc(). + * \param[in] *buffer buffer to read from + * \return EOF on failure otherwise return the character + */ +int sldns_bgetc(struct sldns_buffer *buffer); + +/** + * skips all of the characters in the given string in the buffer, moving + * the position to the first character that is not in *s. + * \param[in] *buffer buffer to use + * \param[in] *s characters to skip + * \return void + */ +void sldns_bskipcs(struct sldns_buffer *buffer, const char *s); + +/** + * skips all of the characters in the given string in the fp, moving + * the position to the first character that is not in *s. + * \param[in] *fp file to use + * \param[in] *s characters to skip + * \return void + */ +void sldns_fskipcs(FILE *fp, const char *s); + + +/** + * skips all of the characters in the given string in the fp, moving + * the position to the first character that is not in *s. + * \param[in] *fp file to use + * \param[in] *s characters to skip + * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) + * \return void + */ +void sldns_fskipcs_l(FILE *fp, const char *s, int *line_nr); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_PARSE_H */ diff --git a/contrib/unbound/ldns/parseutil.c b/contrib/unbound/ldns/parseutil.c new file mode 100644 index 00000000000..55e3a5b1ad9 --- /dev/null +++ b/contrib/unbound/ldns/parseutil.c @@ -0,0 +1,726 @@ +/* + * parseutil.c - parse utilities for string and wire conversion + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ +/** + * \file + * + * Utility functions for parsing, base32(DNS variant) and base64 encoding + * and decoding, Hex, Time units, Escape codes. + */ + +#include "config.h" +#include "ldns/parseutil.h" +#include +#include +#include + +sldns_lookup_table * +sldns_lookup_by_name(sldns_lookup_table *table, const char *name) +{ + while (table->name != NULL) { + if (strcasecmp(name, table->name) == 0) + return table; + table++; + } + return NULL; +} + +sldns_lookup_table * +sldns_lookup_by_id(sldns_lookup_table *table, int id) +{ + while (table->name != NULL) { + if (table->id == id) + return table; + table++; + } + return NULL; +} + +/* Number of days per month (except for February in leap years). */ +static const int mdays[] = { + 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 +}; + +#define LDNS_MOD(x,y) (((x) % (y) < 0) ? ((x) % (y) + (y)) : ((x) % (y))) +#define LDNS_DIV(x,y) (((x) % (y) < 0) ? ((x) / (y) - 1 ) : ((x) / (y))) + +static int +is_leap_year(int year) +{ + return LDNS_MOD(year, 4) == 0 && (LDNS_MOD(year, 100) != 0 + || LDNS_MOD(year, 400) == 0); +} + +static int +leap_days(int y1, int y2) +{ + --y1; + --y2; + return (LDNS_DIV(y2, 4) - LDNS_DIV(y1, 4)) - + (LDNS_DIV(y2, 100) - LDNS_DIV(y1, 100)) + + (LDNS_DIV(y2, 400) - LDNS_DIV(y1, 400)); +} + +/* + * Code adapted from Python 2.4.1 sources (Lib/calendar.py). + */ +time_t +sldns_mktime_from_utc(const struct tm *tm) +{ + int year = 1900 + tm->tm_year; + time_t days = 365 * ((time_t) year - 1970) + leap_days(1970, year); + time_t hours; + time_t minutes; + time_t seconds; + int i; + + for (i = 0; i < tm->tm_mon; ++i) { + days += mdays[i]; + } + if (tm->tm_mon > 1 && is_leap_year(year)) { + ++days; + } + days += tm->tm_mday - 1; + + hours = days * 24 + tm->tm_hour; + minutes = hours * 60 + tm->tm_min; + seconds = minutes * 60 + tm->tm_sec; + + return seconds; +} + +#if SIZEOF_TIME_T <= 4 + +static void +sldns_year_and_yday_from_days_since_epoch(int64_t days, struct tm *result) +{ + int year = 1970; + int new_year; + + while (days < 0 || days >= (int64_t) (is_leap_year(year) ? 366 : 365)) { + new_year = year + (int) LDNS_DIV(days, 365); + days -= (new_year - year) * 365; + days -= leap_days(year, new_year); + year = new_year; + } + result->tm_year = year; + result->tm_yday = (int) days; +} + +/* Number of days per month in a leap year. */ +static const int leap_year_mdays[] = { + 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 +}; + +static void +sldns_mon_and_mday_from_year_and_yday(struct tm *result) +{ + int idays = result->tm_yday; + const int *mon_lengths = is_leap_year(result->tm_year) ? + leap_year_mdays : mdays; + + result->tm_mon = 0; + while (idays >= mon_lengths[result->tm_mon]) { + idays -= mon_lengths[result->tm_mon++]; + } + result->tm_mday = idays + 1; +} + +static void +sldns_wday_from_year_and_yday(struct tm *result) +{ + result->tm_wday = 4 /* 1-1-1970 was a thursday */ + + LDNS_MOD((result->tm_year - 1970), 7) * LDNS_MOD(365, 7) + + leap_days(1970, result->tm_year) + + result->tm_yday; + result->tm_wday = LDNS_MOD(result->tm_wday, 7); + if (result->tm_wday < 0) { + result->tm_wday += 7; + } +} + +static struct tm * +sldns_gmtime64_r(int64_t clock, struct tm *result) +{ + result->tm_isdst = 0; + result->tm_sec = (int) LDNS_MOD(clock, 60); + clock = LDNS_DIV(clock, 60); + result->tm_min = (int) LDNS_MOD(clock, 60); + clock = LDNS_DIV(clock, 60); + result->tm_hour = (int) LDNS_MOD(clock, 24); + clock = LDNS_DIV(clock, 24); + + sldns_year_and_yday_from_days_since_epoch(clock, result); + sldns_mon_and_mday_from_year_and_yday(result); + sldns_wday_from_year_and_yday(result); + result->tm_year -= 1900; + + return result; +} + +#endif /* SIZEOF_TIME_T <= 4 */ + +static int64_t +sldns_serial_arithmitics_time(int32_t time, time_t now) +{ + int32_t offset = time - (int32_t) now; + return (int64_t) now + offset; +} + +struct tm * +sldns_serial_arithmitics_gmtime_r(int32_t time, time_t now, struct tm *result) +{ +#if SIZEOF_TIME_T <= 4 + int64_t secs_since_epoch = sldns_serial_arithmitics_time(time, now); + return sldns_gmtime64_r(secs_since_epoch, result); +#else + time_t secs_since_epoch = sldns_serial_arithmitics_time(time, now); + return gmtime_r(&secs_since_epoch, result); +#endif +} + +int +sldns_hexdigit_to_int(char ch) +{ + switch (ch) { + case '0': return 0; + case '1': return 1; + case '2': return 2; + case '3': return 3; + case '4': return 4; + case '5': return 5; + case '6': return 6; + case '7': return 7; + case '8': return 8; + case '9': return 9; + case 'a': case 'A': return 10; + case 'b': case 'B': return 11; + case 'c': case 'C': return 12; + case 'd': case 'D': return 13; + case 'e': case 'E': return 14; + case 'f': case 'F': return 15; + default: + return -1; + } +} + +uint32_t +sldns_str2period(const char *nptr, const char **endptr) +{ + int sign = 0; + uint32_t i = 0; + uint32_t seconds = 0; + + for(*endptr = nptr; **endptr; (*endptr)++) { + switch (**endptr) { + case ' ': + case '\t': + break; + case '-': + if(sign == 0) { + sign = -1; + } else { + return seconds; + } + break; + case '+': + if(sign == 0) { + sign = 1; + } else { + return seconds; + } + break; + case 's': + case 'S': + seconds += i; + i = 0; + break; + case 'm': + case 'M': + seconds += i * 60; + i = 0; + break; + case 'h': + case 'H': + seconds += i * 60 * 60; + i = 0; + break; + case 'd': + case 'D': + seconds += i * 60 * 60 * 24; + i = 0; + break; + case 'w': + case 'W': + seconds += i * 60 * 60 * 24 * 7; + i = 0; + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + i *= 10; + i += (**endptr - '0'); + break; + default: + seconds += i; + /* disregard signedness */ + return seconds; + } + } + seconds += i; + /* disregard signedness */ + return seconds; +} + +int +sldns_parse_escape(uint8_t *ch_p, const char** str_p) +{ + uint16_t val; + + if ((*str_p)[0] && isdigit((*str_p)[0]) && + (*str_p)[1] && isdigit((*str_p)[1]) && + (*str_p)[2] && isdigit((*str_p)[2])) { + + val = (uint16_t)(((*str_p)[0] - '0') * 100 + + ((*str_p)[1] - '0') * 10 + + ((*str_p)[2] - '0')); + + if (val > 255) { + goto error; + } + *ch_p = (uint8_t)val; + *str_p += 3; + return 1; + + } else if ((*str_p)[0] && !isdigit((*str_p)[0])) { + + *ch_p = (uint8_t)*(*str_p)++; + return 1; + } +error: + *str_p = NULL; + return 0; /* LDNS_WIREPARSE_ERR_SYNTAX_BAD_ESCAPE */ +} + +/** parse one character, with escape codes */ +int +sldns_parse_char(uint8_t *ch_p, const char** str_p) +{ + switch (**str_p) { + + case '\0': return 0; + + case '\\': *str_p += 1; + return sldns_parse_escape(ch_p, str_p); + + default: *ch_p = (uint8_t)*(*str_p)++; + return 1; + } +} + +size_t sldns_b32_ntop_calculate_size(size_t src_data_length) +{ + return src_data_length == 0 ? 0 : ((src_data_length - 1) / 5 + 1) * 8; +} + +size_t sldns_b32_ntop_calculate_size_no_padding(size_t src_data_length) +{ + return ((src_data_length + 3) * 8 / 5) - 4; +} + +static int +sldns_b32_ntop_base(const uint8_t* src, size_t src_sz, char* dst, size_t dst_sz, + int extended_hex, int add_padding) +{ + size_t ret_sz; + const char* b32 = extended_hex ? "0123456789abcdefghijklmnopqrstuv" + : "abcdefghijklmnopqrstuvwxyz234567"; + + size_t c = 0; /* c is used to carry partial base32 character over + * byte boundaries for sizes with a remainder. + * (i.e. src_sz % 5 != 0) + */ + + ret_sz = add_padding ? sldns_b32_ntop_calculate_size(src_sz) + : sldns_b32_ntop_calculate_size_no_padding(src_sz); + + /* Do we have enough space? */ + if (dst_sz < ret_sz + 1) + return -1; + + /* We know the size; terminate the string */ + dst[ret_sz] = '\0'; + + /* First process all chunks of five */ + while (src_sz >= 5) { + /* 00000... ........ ........ ........ ........ */ + dst[0] = b32[(src[0] ) >> 3]; + + /* .....111 11...... ........ ........ ........ */ + dst[1] = b32[(src[0] & 0x07) << 2 | src[1] >> 6]; + + /* ........ ..22222. ........ ........ ........ */ + dst[2] = b32[(src[1] & 0x3e) >> 1]; + + /* ........ .......3 3333.... ........ ........ */ + dst[3] = b32[(src[1] & 0x01) << 4 | src[2] >> 4]; + + /* ........ ........ ....4444 4....... ........ */ + dst[4] = b32[(src[2] & 0x0f) << 1 | src[3] >> 7]; + + /* ........ ........ ........ .55555.. ........ */ + dst[5] = b32[(src[3] & 0x7c) >> 2]; + + /* ........ ........ ........ ......66 666..... */ + dst[6] = b32[(src[3] & 0x03) << 3 | src[4] >> 5]; + + /* ........ ........ ........ ........ ...77777 */ + dst[7] = b32[(src[4] & 0x1f) ]; + + src_sz -= 5; + src += 5; + dst += 8; + } + /* Process what remains */ + switch (src_sz) { + case 4: /* ........ ........ ........ ......66 666..... */ + dst[6] = b32[(src[3] & 0x03) << 3]; + + /* ........ ........ ........ .55555.. ........ */ + dst[5] = b32[(src[3] & 0x7c) >> 2]; + + /* ........ ........ ....4444 4....... ........ */ + c = src[3] >> 7 ; + case 3: dst[4] = b32[(src[2] & 0x0f) << 1 | c]; + + /* ........ .......3 3333.... ........ ........ */ + c = src[2] >> 4 ; + case 2: dst[3] = b32[(src[1] & 0x01) << 4 | c]; + + /* ........ ..22222. ........ ........ ........ */ + dst[2] = b32[(src[1] & 0x3e) >> 1]; + + /* .....111 11...... ........ ........ ........ */ + c = src[1] >> 6 ; + case 1: dst[1] = b32[(src[0] & 0x07) << 2 | c]; + + /* 00000... ........ ........ ........ ........ */ + dst[0] = b32[ src[0] >> 3]; + } + /* Add padding */ + if (add_padding) { + switch (src_sz) { + case 1: dst[2] = '='; + dst[3] = '='; + case 2: dst[4] = '='; + case 3: dst[5] = '='; + dst[6] = '='; + case 4: dst[7] = '='; + } + } + return (int)ret_sz; +} + +int +sldns_b32_ntop(const uint8_t* src, size_t src_sz, char* dst, size_t dst_sz) +{ + return sldns_b32_ntop_base(src, src_sz, dst, dst_sz, 0, 1); +} + +int +sldns_b32_ntop_extended_hex(const uint8_t* src, size_t src_sz, + char* dst, size_t dst_sz) +{ + return sldns_b32_ntop_base(src, src_sz, dst, dst_sz, 1, 1); +} + +size_t sldns_b32_pton_calculate_size(size_t src_text_length) +{ + return src_text_length * 5 / 8; +} + +static int +sldns_b32_pton_base(const char* src, size_t src_sz, uint8_t* dst, size_t dst_sz, + int extended_hex, int check_padding) +{ + size_t i = 0; + char ch = '\0'; + uint8_t buf[8]; + uint8_t* start = dst; + + while (src_sz) { + /* Collect 8 characters in buf (if possible) */ + for (i = 0; i < 8; i++) { + + do { + ch = *src++; + --src_sz; + + } while (isspace(ch) && src_sz > 0); + + if (ch == '=' || ch == '\0') + break; + + else if (extended_hex) + + if (ch >= '0' && ch <= '9') + buf[i] = (uint8_t)ch - '0'; + else if (ch >= 'a' && ch <= 'v') + buf[i] = (uint8_t)ch - 'a' + 10; + else if (ch >= 'A' && ch <= 'V') + buf[i] = (uint8_t)ch - 'A' + 10; + else + return -1; + + else if (ch >= 'a' && ch <= 'z') + buf[i] = (uint8_t)ch - 'a'; + else if (ch >= 'A' && ch <= 'Z') + buf[i] = (uint8_t)ch - 'A'; + else if (ch >= '2' && ch <= '7') + buf[i] = (uint8_t)ch - '2' + 26; + else + return -1; + } + /* Less that 8 characters. We're done. */ + if (i < 8) + break; + + /* Enough space available at the destination? */ + if (dst_sz < 5) + return -1; + + /* 00000... ........ ........ ........ ........ */ + /* .....111 11...... ........ ........ ........ */ + dst[0] = buf[0] << 3 | buf[1] >> 2; + + /* .....111 11...... ........ ........ ........ */ + /* ........ ..22222. ........ ........ ........ */ + /* ........ .......3 3333.... ........ ........ */ + dst[1] = buf[1] << 6 | buf[2] << 1 | buf[3] >> 4; + + /* ........ .......3 3333.... ........ ........ */ + /* ........ ........ ....4444 4....... ........ */ + dst[2] = buf[3] << 4 | buf[4] >> 1; + + /* ........ ........ ....4444 4....... ........ */ + /* ........ ........ ........ .55555.. ........ */ + /* ........ ........ ........ ......66 666..... */ + dst[3] = buf[4] << 7 | buf[5] << 2 | buf[6] >> 3; + + /* ........ ........ ........ ......66 666..... */ + /* ........ ........ ........ ........ ...77777 */ + dst[4] = buf[6] << 5 | buf[7]; + + dst += 5; + dst_sz -= 5; + } + /* Not ending on a eight byte boundary? */ + if (i > 0 && i < 8) { + + /* Enough space available at the destination? */ + if (dst_sz < (i + 1) / 2) + return -1; + + switch (i) { + case 7: /* ........ ........ ........ ......66 666..... */ + /* ........ ........ ........ .55555.. ........ */ + /* ........ ........ ....4444 4....... ........ */ + dst[3] = buf[4] << 7 | buf[5] << 2 | buf[6] >> 3; + + case 5: /* ........ ........ ....4444 4....... ........ */ + /* ........ .......3 3333.... ........ ........ */ + dst[2] = buf[3] << 4 | buf[4] >> 1; + + case 4: /* ........ .......3 3333.... ........ ........ */ + /* ........ ..22222. ........ ........ ........ */ + /* .....111 11...... ........ ........ ........ */ + dst[1] = buf[1] << 6 | buf[2] << 1 | buf[3] >> 4; + + case 2: /* .....111 11...... ........ ........ ........ */ + /* 00000... ........ ........ ........ ........ */ + dst[0] = buf[0] << 3 | buf[1] >> 2; + + break; + + default: + return -1; + } + dst += (i + 1) / 2; + + if (check_padding) { + /* Check remaining padding characters */ + if (ch != '=') + return -1; + + /* One down, 8 - i - 1 more to come... */ + for (i = 8 - i - 1; i > 0; i--) { + + do { + if (src_sz == 0) + return -1; + ch = *src++; + src_sz--; + + } while (isspace(ch)); + + if (ch != '=') + return -1; + } + } + } + return dst - start; +} + +int +sldns_b32_pton(const char* src, size_t src_sz, uint8_t* dst, size_t dst_sz) +{ + return sldns_b32_pton_base(src, src_sz, dst, dst_sz, 0, 1); +} + +int +sldns_b32_pton_extended_hex(const char* src, size_t src_sz, + uint8_t* dst, size_t dst_sz) +{ + return sldns_b32_pton_base(src, src_sz, dst, dst_sz, 1, 1); +} + +size_t sldns_b64_ntop_calculate_size(size_t srcsize) +{ + return ((((srcsize + 2) / 3) * 4) + 1); +} + +/* RFC 1521, section 5.2. + * + * The encoding process represents 24-bit groups of input bits as output + * strings of 4 encoded characters. Proceeding from left to right, a + * 24-bit input group is formed by concatenating 3 8-bit input groups. + * These 24 bits are then treated as 4 concatenated 6-bit groups, each + * of which is translated into a single digit in the base64 alphabet. + * + * This routine does not insert spaces or linebreaks after 76 characters. + */ +int sldns_b64_ntop(uint8_t const *src, size_t srclength, + char *target, size_t targsize) +{ + const char* b64 = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + const char pad64 = '='; + size_t i = 0, o = 0; + if(targsize < sldns_b64_ntop_calculate_size(srclength)) + return -1; + /* whole chunks: xxxxxxyy yyyyzzzz zzwwwwww */ + while(i+3 <= srclength) { + if(o+4 > targsize) return -1; + target[o] = b64[src[i] >> 2]; + target[o+1] = b64[ ((src[i]&0x03)<<4) | (src[i+1]>>4) ]; + target[o+2] = b64[ ((src[i+1]&0x0f)<<2) | (src[i+2]>>6) ]; + target[o+3] = b64[ (src[i+2]&0x3f) ]; + i += 3; + o += 4; + } + /* remainder */ + switch(srclength - i) { + case 2: + /* two at end, converted into A B C = */ + target[o] = b64[src[i] >> 2]; + target[o+1] = b64[ ((src[i]&0x03)<<4) | (src[i+1]>>4) ]; + target[o+2] = b64[ ((src[i+1]&0x0f)<<2) ]; + target[o+3] = pad64; + i += 2; + o += 4; + break; + case 1: + /* one at end, converted into A B = = */ + target[o] = b64[src[i] >> 2]; + target[o+1] = b64[ ((src[i]&0x03)<<4) ]; + target[o+2] = pad64; + target[o+3] = pad64; + i += 1; + o += 4; + break; + case 0: + default: + /* nothing */ + break; + } + /* assert: i == srclength */ + if(o+1 > targsize) return -1; + target[o] = 0; + return (int)o; +} + +size_t sldns_b64_pton_calculate_size(size_t srcsize) +{ + return (((((srcsize + 3) / 4) * 3)) + 1); +} + +int sldns_b64_pton(char const *src, uint8_t *target, size_t targsize) +{ + const uint8_t pad64 = 64; /* is 64th in the b64 array */ + const char* s = src; + uint8_t in[4]; + size_t o = 0, incount = 0; + + while(*s) { + /* skip any character that is not base64 */ + /* conceptually we do: + const char* b64 = pad'=' is appended to array + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + const char* d = strchr(b64, *s++); + and use d-b64; + */ + char d = *s++; + if(d <= 'Z' && d >= 'A') + d -= 'A'; + else if(d <= 'z' && d >= 'a') + d = d - 'a' + 26; + else if(d <= '9' && d >= '0') + d = d - '0' + 52; + else if(d == '+') + d = 62; + else if(d == '/') + d = 63; + else if(d == '=') + d = 64; + else continue; + in[incount++] = (uint8_t)d; + if(incount != 4) + continue; + /* process whole block of 4 characters into 3 output bytes */ + if(in[3] == pad64 && in[2] == pad64) { /* A B = = */ + if(o+1 > targsize) + return -1; + target[o] = (in[0]<<2) | ((in[1]&0x30)>>4); + o += 1; + break; /* we are done */ + } else if(in[3] == pad64) { /* A B C = */ + if(o+2 > targsize) + return -1; + target[o] = (in[0]<<2) | ((in[1]&0x30)>>4); + target[o+1]= ((in[1]&0x0f)<<4) | ((in[2]&0x3c)>>2); + o += 2; + break; /* we are done */ + } else { + if(o+3 > targsize) + return -1; + /* write xxxxxxyy yyyyzzzz zzwwwwww */ + target[o] = (in[0]<<2) | ((in[1]&0x30)>>4); + target[o+1]= ((in[1]&0x0f)<<4) | ((in[2]&0x3c)>>2); + target[o+2]= ((in[2]&0x03)<<6) | in[3]; + o += 3; + } + incount = 0; + } + return (int)o; +} diff --git a/contrib/unbound/ldns/parseutil.h b/contrib/unbound/ldns/parseutil.h new file mode 100644 index 00000000000..dfa1c2a2b14 --- /dev/null +++ b/contrib/unbound/ldns/parseutil.h @@ -0,0 +1,148 @@ +/* + * parseutil.h - parse utilities for string and wire conversion + * + * (c) NLnet Labs, 2004 + * + * See the file LICENSE for the license + */ +/** + * \file + * + * Utility functions for parsing, base32(DNS variant) and base64 encoding + * and decoding, Hex, Time units, Escape codes. + */ + +#ifndef LDNS_PARSEUTIL_H +#define LDNS_PARSEUTIL_H +struct tm; + +/** + * A general purpose lookup table + * + * Lookup tables are arrays of (id, name) pairs, + * So you can for instance lookup the RCODE 3, which is "NXDOMAIN", + * and vice versa. The lookup tables themselves are defined wherever needed, + * for instance in host2str.c + */ +struct sldns_struct_lookup_table { + int id; + const char *name; +}; +typedef struct sldns_struct_lookup_table sldns_lookup_table; + +/** + * Looks up the table entry by name, returns NULL if not found. + * \param[in] table the lookup table to search in + * \param[in] name what to search for + * \return the item found + */ +sldns_lookup_table *sldns_lookup_by_name(sldns_lookup_table table[], + const char *name); +/** + * Looks up the table entry by id, returns NULL if not found. + * \param[in] table the lookup table to search in + * \param[in] id what to search for + * \return the item found + */ +sldns_lookup_table *sldns_lookup_by_id(sldns_lookup_table table[], int id); + +/** + * Convert TM to seconds since epoch (midnight, January 1st, 1970). + * Like timegm(3), which is not always available. + * \param[in] tm a struct tm* with the date + * \return the seconds since epoch + */ +time_t sldns_mktime_from_utc(const struct tm *tm); + +/** + * The function interprets time as the number of seconds since epoch + * with respect to now using serial arithmitics (rfc1982). + * That number of seconds is then converted to broken-out time information. + * This is especially usefull when converting the inception and expiration + * fields of RRSIG records. + * + * \param[in] time number of seconds since epoch (midnight, January 1st, 1970) + * to be intepreted as a serial arithmitics number relative to now. + * \param[in] now number of seconds since epoch (midnight, January 1st, 1970) + * to which the time value is compared to determine the final value. + * \param[out] result the struct with the broken-out time information + * \return result on success or NULL on error + */ +struct tm * sldns_serial_arithmitics_gmtime_r(int32_t time, time_t now, struct tm *result); + +/** + * converts a ttl value (like 5d2h) to a long. + * \param[in] nptr the start of the string + * \param[out] endptr points to the last char in case of error + * \return the convert duration value + */ +uint32_t sldns_str2period(const char *nptr, const char **endptr); + +/** + * Returns the int value of the given (hex) digit + * \param[in] ch the hex char to convert + * \return the converted decimal value + */ +int sldns_hexdigit_to_int(char ch); + +/** + * calculates the size needed to store the result of b64_ntop + */ +size_t sldns_b64_ntop_calculate_size(size_t srcsize); + +int sldns_b64_ntop(uint8_t const *src, size_t srclength, + char *target, size_t targsize); + +/** + * calculates the size needed to store the result of sldns_b64_pton + */ +size_t sldns_b64_pton_calculate_size(size_t srcsize); + +int sldns_b64_pton(char const *src, uint8_t *target, size_t targsize); + +/** + * calculates the size needed to store the result of b32_ntop + */ +size_t sldns_b32_ntop_calculate_size(size_t src_data_length); + +size_t sldns_b32_ntop_calculate_size_no_padding(size_t src_data_length); + +int sldns_b32_ntop(const uint8_t* src_data, size_t src_data_length, + char* target_text_buffer, size_t target_text_buffer_size); + +int sldns_b32_ntop_extended_hex(const uint8_t* src_data, size_t src_data_length, + char* target_text_buffer, size_t target_text_buffer_size); + +/** + * calculates the size needed to store the result of b32_pton + */ +size_t sldns_b32_pton_calculate_size(size_t src_text_length); + +int sldns_b32_pton(const char* src_text, size_t src_text_length, + uint8_t* target_data_buffer, size_t target_data_buffer_size); + +int sldns_b32_pton_extended_hex(const char* src_text, size_t src_text_length, + uint8_t* target_data_buffer, size_t target_data_buffer_size); + +/* + * Checks whether the escaped value at **s is an octal value or + * a 'normally' escaped character (and not eos) + * + * @param ch_p: the parsed character + * @param str_p: the string. moved along for characters read. + * The string pointer at *s is increased by either 0 (on error), 1 (on + * normal escapes), or 3 (on octals) + * + * @return 0 on error + */ +int sldns_parse_escape(uint8_t *ch_p, const char** str_p); + +/** + * Parse one character, with escape codes, + * @param ch_p: the parsed character + * @param str_p: the string. moved along for characters read. + * @return 0 on error + */ +int sldns_parse_char(uint8_t *ch_p, const char** str_p); + +#endif /* LDNS_PARSEUTIL_H */ diff --git a/contrib/unbound/ldns/pkthdr.h b/contrib/unbound/ldns/pkthdr.h new file mode 100644 index 00000000000..de9952ea71f --- /dev/null +++ b/contrib/unbound/ldns/pkthdr.h @@ -0,0 +1,158 @@ +/* + * pkthdr.h - packet header from wire conversion routines + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +/** + * \file + * + * Contains functions that translate dns data from the wire format (as sent + * by servers and clients) to the internal structures for the packet header. + */ + +#ifndef LDNS_PKTHDR_H +#define LDNS_PKTHDR_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* The length of the header */ +#define LDNS_HEADER_SIZE 12 + +/* First octet of flags */ +#define LDNS_RD_MASK 0x01U +#define LDNS_RD_SHIFT 0 +#define LDNS_RD_WIRE(wirebuf) (*(wirebuf+2) & LDNS_RD_MASK) +#define LDNS_RD_SET(wirebuf) (*(wirebuf+2) |= LDNS_RD_MASK) +#define LDNS_RD_CLR(wirebuf) (*(wirebuf+2) &= ~LDNS_RD_MASK) + +#define LDNS_TC_MASK 0x02U +#define LDNS_TC_SHIFT 1 +#define LDNS_TC_WIRE(wirebuf) (*(wirebuf+2) & LDNS_TC_MASK) +#define LDNS_TC_SET(wirebuf) (*(wirebuf+2) |= LDNS_TC_MASK) +#define LDNS_TC_CLR(wirebuf) (*(wirebuf+2) &= ~LDNS_TC_MASK) + +#define LDNS_AA_MASK 0x04U +#define LDNS_AA_SHIFT 2 +#define LDNS_AA_WIRE(wirebuf) (*(wirebuf+2) & LDNS_AA_MASK) +#define LDNS_AA_SET(wirebuf) (*(wirebuf+2) |= LDNS_AA_MASK) +#define LDNS_AA_CLR(wirebuf) (*(wirebuf+2) &= ~LDNS_AA_MASK) + +#define LDNS_OPCODE_MASK 0x78U +#define LDNS_OPCODE_SHIFT 3 +#define LDNS_OPCODE_WIRE(wirebuf) ((*(wirebuf+2) & LDNS_OPCODE_MASK) >> LDNS_OPCODE_SHIFT) +#define LDNS_OPCODE_SET(wirebuf, opcode) \ + (*(wirebuf+2) = ((*(wirebuf+2)) & ~LDNS_OPCODE_MASK) | ((opcode) << LDNS_OPCODE_SHIFT)) + +#define LDNS_QR_MASK 0x80U +#define LDNS_QR_SHIFT 7 +#define LDNS_QR_WIRE(wirebuf) (*(wirebuf+2) & LDNS_QR_MASK) +#define LDNS_QR_SET(wirebuf) (*(wirebuf+2) |= LDNS_QR_MASK) +#define LDNS_QR_CLR(wirebuf) (*(wirebuf+2) &= ~LDNS_QR_MASK) + +/* Second octet of flags */ +#define LDNS_RCODE_MASK 0x0fU +#define LDNS_RCODE_SHIFT 0 +#define LDNS_RCODE_WIRE(wirebuf) (*(wirebuf+3) & LDNS_RCODE_MASK) +#define LDNS_RCODE_SET(wirebuf, rcode) \ + (*(wirebuf+3) = ((*(wirebuf+3)) & ~LDNS_RCODE_MASK) | (rcode)) + +#define LDNS_CD_MASK 0x10U +#define LDNS_CD_SHIFT 4 +#define LDNS_CD_WIRE(wirebuf) (*(wirebuf+3) & LDNS_CD_MASK) +#define LDNS_CD_SET(wirebuf) (*(wirebuf+3) |= LDNS_CD_MASK) +#define LDNS_CD_CLR(wirebuf) (*(wirebuf+3) &= ~LDNS_CD_MASK) + +#define LDNS_AD_MASK 0x20U +#define LDNS_AD_SHIFT 5 +#define LDNS_AD_WIRE(wirebuf) (*(wirebuf+3) & LDNS_AD_MASK) +#define LDNS_AD_SET(wirebuf) (*(wirebuf+3) |= LDNS_AD_MASK) +#define LDNS_AD_CLR(wirebuf) (*(wirebuf+3) &= ~LDNS_AD_MASK) + +#define LDNS_Z_MASK 0x40U +#define LDNS_Z_SHIFT 6 +#define LDNS_Z_WIRE(wirebuf) (*(wirebuf+3) & LDNS_Z_MASK) +#define LDNS_Z_SET(wirebuf) (*(wirebuf+3) |= LDNS_Z_MASK) +#define LDNS_Z_CLR(wirebuf) (*(wirebuf+3) &= ~LDNS_Z_MASK) + +#define LDNS_RA_MASK 0x80U +#define LDNS_RA_SHIFT 7 +#define LDNS_RA_WIRE(wirebuf) (*(wirebuf+3) & LDNS_RA_MASK) +#define LDNS_RA_SET(wirebuf) (*(wirebuf+3) |= LDNS_RA_MASK) +#define LDNS_RA_CLR(wirebuf) (*(wirebuf+3) &= ~LDNS_RA_MASK) + +/* Query ID */ +#define LDNS_ID_WIRE(wirebuf) (sldns_read_uint16(wirebuf)) +#define LDNS_ID_SET(wirebuf, id) (sldns_write_uint16(wirebuf, id)) + +/* Counter of the question section */ +#define LDNS_QDCOUNT_OFF 4 +/* +#define QDCOUNT(wirebuf) (ntohs(*(uint16_t *)(wirebuf+QDCOUNT_OFF))) +*/ +#define LDNS_QDCOUNT(wirebuf) (sldns_read_uint16(wirebuf+LDNS_QDCOUNT_OFF)) + +/* Counter of the answer section */ +#define LDNS_ANCOUNT_OFF 6 +#define LDNS_ANCOUNT(wirebuf) (sldns_read_uint16(wirebuf+LDNS_ANCOUNT_OFF)) + +/* Counter of the authority section */ +#define LDNS_NSCOUNT_OFF 8 +#define LDNS_NSCOUNT(wirebuf) (sldns_read_uint16(wirebuf+LDNS_NSCOUNT_OFF)) + +/* Counter of the additional section */ +#define LDNS_ARCOUNT_OFF 10 +#define LDNS_ARCOUNT(wirebuf) (sldns_read_uint16(wirebuf+LDNS_ARCOUNT_OFF)) + +/** + * The sections of a packet + */ +enum sldns_enum_pkt_section { + LDNS_SECTION_QUESTION = 0, + LDNS_SECTION_ANSWER = 1, + LDNS_SECTION_AUTHORITY = 2, + LDNS_SECTION_ADDITIONAL = 3, + /** bogus section, if not interested */ + LDNS_SECTION_ANY = 4, + /** used to get all non-question rrs from a packet */ + LDNS_SECTION_ANY_NOQUESTION = 5 +}; +typedef enum sldns_enum_pkt_section sldns_pkt_section; + +/* opcodes for pkt's */ +enum sldns_enum_pkt_opcode { + LDNS_PACKET_QUERY = 0, + LDNS_PACKET_IQUERY = 1, + LDNS_PACKET_STATUS = 2, /* there is no 3?? DNS is weird */ + LDNS_PACKET_NOTIFY = 4, + LDNS_PACKET_UPDATE = 5 +}; +typedef enum sldns_enum_pkt_opcode sldns_pkt_opcode; + +/* rcodes for pkts */ +enum sldns_enum_pkt_rcode { + LDNS_RCODE_NOERROR = 0, + LDNS_RCODE_FORMERR = 1, + LDNS_RCODE_SERVFAIL = 2, + LDNS_RCODE_NXDOMAIN = 3, + LDNS_RCODE_NOTIMPL = 4, + LDNS_RCODE_REFUSED = 5, + LDNS_RCODE_YXDOMAIN = 6, + LDNS_RCODE_YXRRSET = 7, + LDNS_RCODE_NXRRSET = 8, + LDNS_RCODE_NOTAUTH = 9, + LDNS_RCODE_NOTZONE = 10 +}; +typedef enum sldns_enum_pkt_rcode sldns_pkt_rcode; + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_PKTHDR_H */ diff --git a/contrib/unbound/ldns/rrdef.c b/contrib/unbound/ldns/rrdef.c new file mode 100644 index 00000000000..8f7dd3036ec --- /dev/null +++ b/contrib/unbound/ldns/rrdef.c @@ -0,0 +1,738 @@ +/* rrdef.c + * + * access functions to rr definitions list. + * a Net::DNS like library for C + * LibDNS Team @ NLnet Labs + * + * (c) NLnet Labs, 2004-2006 + * See the file LICENSE for the license + */ +/** + * \file + * + * Defines resource record types and constants. + */ +#include "config.h" +#include "ldns/rrdef.h" +#include "ldns/parseutil.h" + +/* classes */ +static sldns_lookup_table sldns_rr_classes_data[] = { + { LDNS_RR_CLASS_IN, "IN" }, + { LDNS_RR_CLASS_CH, "CH" }, + { LDNS_RR_CLASS_HS, "HS" }, + { LDNS_RR_CLASS_NONE, "NONE" }, + { LDNS_RR_CLASS_ANY, "ANY" }, + { 0, NULL } +}; +sldns_lookup_table* sldns_rr_classes = sldns_rr_classes_data; + +/* types */ +static const sldns_rdf_type type_0_wireformat[] = { LDNS_RDF_TYPE_UNKNOWN }; +static const sldns_rdf_type type_a_wireformat[] = { LDNS_RDF_TYPE_A }; +static const sldns_rdf_type type_ns_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const sldns_rdf_type type_md_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const sldns_rdf_type type_mf_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const sldns_rdf_type type_cname_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const sldns_rdf_type type_soa_wireformat[] = { + LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_INT32, + LDNS_RDF_TYPE_PERIOD, LDNS_RDF_TYPE_PERIOD, LDNS_RDF_TYPE_PERIOD, + LDNS_RDF_TYPE_PERIOD +}; +static const sldns_rdf_type type_mb_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const sldns_rdf_type type_mg_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const sldns_rdf_type type_mr_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const sldns_rdf_type type_wks_wireformat[] = { + LDNS_RDF_TYPE_A, LDNS_RDF_TYPE_WKS +}; +static const sldns_rdf_type type_ptr_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const sldns_rdf_type type_hinfo_wireformat[] = { + LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR +}; +static const sldns_rdf_type type_minfo_wireformat[] = { + LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME +}; +static const sldns_rdf_type type_mx_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME +}; +static const sldns_rdf_type type_rp_wireformat[] = { + LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME +}; +static const sldns_rdf_type type_afsdb_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME +}; +static const sldns_rdf_type type_x25_wireformat[] = { LDNS_RDF_TYPE_STR }; +static const sldns_rdf_type type_isdn_wireformat[] = { + LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR +}; +static const sldns_rdf_type type_rt_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME +}; +static const sldns_rdf_type type_nsap_wireformat[] = { + LDNS_RDF_TYPE_NSAP +}; +static const sldns_rdf_type type_nsap_ptr_wireformat[] = { + LDNS_RDF_TYPE_STR +}; +static const sldns_rdf_type type_sig_wireformat[] = { + LDNS_RDF_TYPE_TYPE, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT32, + LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_B64 +}; +static const sldns_rdf_type type_key_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_B64 +}; +static const sldns_rdf_type type_px_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME +}; +static const sldns_rdf_type type_gpos_wireformat[] = { + LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR +}; +static const sldns_rdf_type type_aaaa_wireformat[] = { LDNS_RDF_TYPE_AAAA }; +static const sldns_rdf_type type_loc_wireformat[] = { LDNS_RDF_TYPE_LOC }; +static const sldns_rdf_type type_nxt_wireformat[] = { + LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_UNKNOWN +}; +static const sldns_rdf_type type_eid_wireformat[] = { + LDNS_RDF_TYPE_HEX +}; +static const sldns_rdf_type type_nimloc_wireformat[] = { + LDNS_RDF_TYPE_HEX +}; +static const sldns_rdf_type type_srv_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME +}; +static const sldns_rdf_type type_atma_wireformat[] = { + LDNS_RDF_TYPE_ATMA +}; +static const sldns_rdf_type type_naptr_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_DNAME +}; +static const sldns_rdf_type type_kx_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME +}; +static const sldns_rdf_type type_cert_wireformat[] = { + LDNS_RDF_TYPE_CERT_ALG, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_B64 +}; +static const sldns_rdf_type type_a6_wireformat[] = { LDNS_RDF_TYPE_UNKNOWN }; +static const sldns_rdf_type type_dname_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const sldns_rdf_type type_sink_wireformat[] = { LDNS_RDF_TYPE_INT8, + LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_B64 +}; +static const sldns_rdf_type type_apl_wireformat[] = { + LDNS_RDF_TYPE_APL +}; +static const sldns_rdf_type type_ds_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_HEX +}; +static const sldns_rdf_type type_sshfp_wireformat[] = { + LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_HEX +}; +static const sldns_rdf_type type_ipseckey_wireformat[] = { + LDNS_RDF_TYPE_IPSECKEY +}; +static const sldns_rdf_type type_rrsig_wireformat[] = { + LDNS_RDF_TYPE_TYPE, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT32, + LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_B64 +}; +static const sldns_rdf_type type_nsec_wireformat[] = { + LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_NSEC +}; +static const sldns_rdf_type type_dhcid_wireformat[] = { + LDNS_RDF_TYPE_B64 +}; +static const sldns_rdf_type type_talink_wireformat[] = { + LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME +}; +/* nsec3 is some vars, followed by same type of data of nsec */ +static const sldns_rdf_type type_nsec3_wireformat[] = { +/* LDNS_RDF_TYPE_NSEC3_VARS, LDNS_RDF_TYPE_NSEC3_NEXT_OWNER, LDNS_RDF_TYPE_NSEC*/ + LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_NSEC3_SALT, LDNS_RDF_TYPE_NSEC3_NEXT_OWNER, LDNS_RDF_TYPE_NSEC +}; + +static const sldns_rdf_type type_nsec3param_wireformat[] = { +/* LDNS_RDF_TYPE_NSEC3_PARAMS_VARS*/ + LDNS_RDF_TYPE_INT8, + LDNS_RDF_TYPE_INT8, + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_NSEC3_SALT +}; + +static const sldns_rdf_type type_dnskey_wireformat[] = { + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_INT8, + LDNS_RDF_TYPE_ALG, + LDNS_RDF_TYPE_B64 +}; +static const sldns_rdf_type type_tkey_wireformat[] = { + LDNS_RDF_TYPE_DNAME, + LDNS_RDF_TYPE_TIME, + LDNS_RDF_TYPE_TIME, + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_INT16_DATA, + LDNS_RDF_TYPE_INT16_DATA, +}; +static const sldns_rdf_type type_tsig_wireformat[] = { + LDNS_RDF_TYPE_DNAME, + LDNS_RDF_TYPE_TSIGTIME, + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_INT16_DATA, + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_INT16_DATA +}; +static const sldns_rdf_type type_tlsa_wireformat[] = { + LDNS_RDF_TYPE_INT8, + LDNS_RDF_TYPE_INT8, + LDNS_RDF_TYPE_INT8, + LDNS_RDF_TYPE_HEX +}; +static const sldns_rdf_type type_hip_wireformat[] = { + LDNS_RDF_TYPE_HIP +}; +static const sldns_rdf_type type_nid_wireformat[] = { + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_ILNP64 +}; +static const sldns_rdf_type type_l32_wireformat[] = { + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_A +}; +static const sldns_rdf_type type_l64_wireformat[] = { + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_ILNP64 +}; +static const sldns_rdf_type type_lp_wireformat[] = { + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_DNAME +}; +static const sldns_rdf_type type_eui48_wireformat[] = { + LDNS_RDF_TYPE_EUI48 +}; +static const sldns_rdf_type type_eui64_wireformat[] = { + LDNS_RDF_TYPE_EUI64 +}; +#ifdef DRAFT_RRTYPES +static const sldns_rdf_type type_uri_wireformat[] = { + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_LONG_STR +}; +#endif +static const sldns_rdf_type type_caa_wireformat[] = { + LDNS_RDF_TYPE_INT8, + LDNS_RDF_TYPE_TAG, + LDNS_RDF_TYPE_LONG_STR +}; + +/* All RR's defined in 1035 are well known and can thus + * be compressed. See RFC3597. These RR's are: + * CNAME HINFO MB MD MF MG MINFO MR MX NULL NS PTR SOA TXT + */ +static sldns_rr_descriptor rdata_field_descriptors[] = { + /* 0 */ + { 0, NULL, 0, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 1 */ + {LDNS_RR_TYPE_A, "A", 1, 1, type_a_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 2 */ + {LDNS_RR_TYPE_NS, "NS", 1, 1, type_ns_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 3 */ + {LDNS_RR_TYPE_MD, "MD", 1, 1, type_md_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 4 */ + {LDNS_RR_TYPE_MF, "MF", 1, 1, type_mf_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 5 */ + {LDNS_RR_TYPE_CNAME, "CNAME", 1, 1, type_cname_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 6 */ + {LDNS_RR_TYPE_SOA, "SOA", 7, 7, type_soa_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 2 }, + /* 7 */ + {LDNS_RR_TYPE_MB, "MB", 1, 1, type_mb_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 8 */ + {LDNS_RR_TYPE_MG, "MG", 1, 1, type_mg_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 9 */ + {LDNS_RR_TYPE_MR, "MR", 1, 1, type_mr_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 10 */ + {LDNS_RR_TYPE_NULL, "NULL", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 11 */ + {LDNS_RR_TYPE_WKS, "WKS", 2, 2, type_wks_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 12 */ + {LDNS_RR_TYPE_PTR, "PTR", 1, 1, type_ptr_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 13 */ + {LDNS_RR_TYPE_HINFO, "HINFO", 2, 2, type_hinfo_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 14 */ + {LDNS_RR_TYPE_MINFO, "MINFO", 2, 2, type_minfo_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 2 }, + /* 15 */ + {LDNS_RR_TYPE_MX, "MX", 2, 2, type_mx_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 16 */ + {LDNS_RR_TYPE_TXT, "TXT", 1, 0, NULL, LDNS_RDF_TYPE_STR, LDNS_RR_NO_COMPRESS, 0 }, + /* 17 */ + {LDNS_RR_TYPE_RP, "RP", 2, 2, type_rp_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 2 }, + /* 18 */ + {LDNS_RR_TYPE_AFSDB, "AFSDB", 2, 2, type_afsdb_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 19 */ + {LDNS_RR_TYPE_X25, "X25", 1, 1, type_x25_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 20 */ + {LDNS_RR_TYPE_ISDN, "ISDN", 1, 2, type_isdn_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 21 */ + {LDNS_RR_TYPE_RT, "RT", 2, 2, type_rt_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 22 */ + {LDNS_RR_TYPE_NSAP, "NSAP", 1, 1, type_nsap_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 23 */ + {LDNS_RR_TYPE_NSAP_PTR, "NSAP-PTR", 1, 1, type_nsap_ptr_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 24 */ + {LDNS_RR_TYPE_SIG, "SIG", 9, 9, type_sig_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 25 */ + {LDNS_RR_TYPE_KEY, "KEY", 4, 4, type_key_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 26 */ + {LDNS_RR_TYPE_PX, "PX", 3, 3, type_px_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 2 }, + /* 27 */ + {LDNS_RR_TYPE_GPOS, "GPOS", 3, 3, type_gpos_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 28 */ + {LDNS_RR_TYPE_AAAA, "AAAA", 1, 1, type_aaaa_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 29 */ + {LDNS_RR_TYPE_LOC, "LOC", 1, 1, type_loc_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 30 */ + {LDNS_RR_TYPE_NXT, "NXT", 2, 2, type_nxt_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 31 */ + {LDNS_RR_TYPE_EID, "EID", 1, 1, type_eid_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 32 */ + {LDNS_RR_TYPE_NIMLOC, "NIMLOC", 1, 1, type_nimloc_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 33 */ + {LDNS_RR_TYPE_SRV, "SRV", 4, 4, type_srv_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 34 */ + {LDNS_RR_TYPE_ATMA, "ATMA", 1, 1, type_atma_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 35 */ + {LDNS_RR_TYPE_NAPTR, "NAPTR", 6, 6, type_naptr_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 36 */ + {LDNS_RR_TYPE_KX, "KX", 2, 2, type_kx_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 37 */ + {LDNS_RR_TYPE_CERT, "CERT", 4, 4, type_cert_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 38 */ + {LDNS_RR_TYPE_A6, "A6", 1, 1, type_a6_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 39 */ + {LDNS_RR_TYPE_DNAME, "DNAME", 1, 1, type_dname_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 40 */ + {LDNS_RR_TYPE_SINK, "SINK", 1, 1, type_sink_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 41 */ + {LDNS_RR_TYPE_OPT, "OPT", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 42 */ + {LDNS_RR_TYPE_APL, "APL", 0, 0, type_apl_wireformat, LDNS_RDF_TYPE_APL, LDNS_RR_NO_COMPRESS, 0 }, + /* 43 */ + {LDNS_RR_TYPE_DS, "DS", 4, 4, type_ds_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 44 */ + {LDNS_RR_TYPE_SSHFP, "SSHFP", 3, 3, type_sshfp_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 45 */ + {LDNS_RR_TYPE_IPSECKEY, "IPSECKEY", 1, 1, type_ipseckey_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 46 */ + {LDNS_RR_TYPE_RRSIG, "RRSIG", 9, 9, type_rrsig_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 47 */ + {LDNS_RR_TYPE_NSEC, "NSEC", 1, 2, type_nsec_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 48 */ + {LDNS_RR_TYPE_DNSKEY, "DNSKEY", 4, 4, type_dnskey_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 49 */ + {LDNS_RR_TYPE_DHCID, "DHCID", 1, 1, type_dhcid_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 50 */ + {LDNS_RR_TYPE_NSEC3, "NSEC3", 5, 6, type_nsec3_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 51 */ + {LDNS_RR_TYPE_NSEC3PARAM, "NSEC3PARAM", 4, 4, type_nsec3param_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 52 */ + {LDNS_RR_TYPE_TLSA, "TLSA", 4, 4, type_tlsa_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + +{LDNS_RR_TYPE_NULL, "TYPE53", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE54", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 55 + * Hip ends with 0 or more Rendezvous Servers represented as dname's. + * Hence the LDNS_RDF_TYPE_DNAME _variable field and the _maximum field + * set to 0. + */ + {LDNS_RR_TYPE_HIP, "HIP", 1, 1, type_hip_wireformat, LDNS_RDF_TYPE_DNAME, LDNS_RR_NO_COMPRESS, 0 }, + +#ifdef DRAFT_RRTYPES + /* 56 */ + {LDNS_RR_TYPE_NINFO, "NINFO", 1, 0, NULL, LDNS_RDF_TYPE_STR, LDNS_RR_NO_COMPRESS, 0 }, + /* 57 */ + {LDNS_RR_TYPE_RKEY, "RKEY", 4, 4, type_key_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +#else +{LDNS_RR_TYPE_NULL, "TYPE56", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE57", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +#endif + /* 58 */ + {LDNS_RR_TYPE_TALINK, "TALINK", 2, 2, type_talink_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 2 }, + +#ifdef DRAFT_RRTYPES + /* 59 */ + {LDNS_RR_TYPE_CDS, "CDS", 4, 4, type_ds_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +#else +{LDNS_RR_TYPE_NULL, "TYPE59", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +#endif + +{LDNS_RR_TYPE_NULL, "TYPE60", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE61", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE62", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE63", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE64", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE65", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE66", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE67", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE68", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE69", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE70", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE71", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE72", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE73", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE74", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE75", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE76", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE77", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE78", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE79", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE80", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE81", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE82", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE83", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE84", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE85", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE86", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE87", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE88", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE89", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE90", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE91", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE92", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE93", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE94", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE95", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE96", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE97", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE98", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + + /* 99 */ + {LDNS_RR_TYPE_SPF, "SPF", 1, 0, NULL, LDNS_RDF_TYPE_STR, LDNS_RR_NO_COMPRESS, 0 }, + + /* UINFO [IANA-Reserved] */ +{LDNS_RR_TYPE_NULL, "TYPE100", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* UID [IANA-Reserved] */ +{LDNS_RR_TYPE_NULL, "TYPE101", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* GID [IANA-Reserved] */ +{LDNS_RR_TYPE_NULL, "TYPE102", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* UNSPEC [IANA-Reserved] */ +{LDNS_RR_TYPE_NULL, "TYPE103", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + + /* 104 */ + {LDNS_RR_TYPE_NID, "NID", 2, 2, type_nid_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 105 */ + {LDNS_RR_TYPE_L32, "L32", 2, 2, type_l32_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 106 */ + {LDNS_RR_TYPE_L64, "L64", 2, 2, type_l64_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 107 */ + {LDNS_RR_TYPE_LP, "LP", 2, 2, type_lp_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + + /* 108 */ + {LDNS_RR_TYPE_EUI48, "EUI48", 1, 1, type_eui48_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 109 */ + {LDNS_RR_TYPE_EUI64, "EUI64", 1, 1, type_eui64_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + +{LDNS_RR_TYPE_NULL, "TYPE110", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE111", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE112", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE113", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE114", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE115", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE116", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE117", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE118", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE119", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE120", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE121", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE122", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE123", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE124", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE125", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE126", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE127", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE128", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE129", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE130", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE131", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE132", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE133", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE134", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE135", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE136", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE137", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE138", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE139", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE140", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE141", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE142", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE143", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE144", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE145", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE146", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE147", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE148", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE149", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE150", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE151", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE152", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE153", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE154", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE155", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE156", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE157", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE158", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE159", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE160", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE161", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE162", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE163", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE164", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE165", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE166", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE167", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE168", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE169", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE170", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE171", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE172", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE173", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE174", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE175", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE176", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE177", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE178", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE179", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE180", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE181", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE182", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE183", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE184", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE185", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE186", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE187", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE188", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE189", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE190", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE191", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE192", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE193", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE194", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE195", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE196", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE197", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE198", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE199", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE200", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE201", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE202", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE203", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE204", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE205", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE206", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE207", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE208", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE209", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE210", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE211", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE212", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE213", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE214", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE215", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE216", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE217", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE218", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE219", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE220", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE221", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE222", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE223", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE224", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE225", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE226", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE227", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE228", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE229", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE230", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE231", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE232", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE233", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE234", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE235", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE236", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE237", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE238", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE239", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE240", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE241", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE242", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE243", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE244", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE245", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE246", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE247", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE248", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + + /* LDNS_RDF_TYPE_INT16_DATA takes two fields (length and data) as one. + * So, unlike RFC 2930 spec, we have 7 min/max rdf's i.s.o. 8/9. + */ + /* 249 */ + {LDNS_RR_TYPE_TKEY, "TKEY", 7, 7, type_tkey_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* LDNS_RDF_TYPE_INT16_DATA takes two fields (length and data) as one. + * So, unlike RFC 2930 spec, we have 7 min/max rdf's i.s.o. 8/9. + */ + /* 250 */ + {LDNS_RR_TYPE_TSIG, "TSIG", 7, 7, type_tsig_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + + /* IXFR: A request for a transfer of an incremental zone transfer */ +{LDNS_RR_TYPE_IXFR, "IXFR", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* AXFR: A request for a transfer of an entire zone */ +{LDNS_RR_TYPE_AXFR, "AXFR", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* MAILB: A request for mailbox-related records (MB, MG or MR) */ +{LDNS_RR_TYPE_MAILB, "MAILB", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* MAILA: A request for mail agent RRs (Obsolete - see MX) */ +{LDNS_RR_TYPE_MAILA, "MAILA", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* ANY: A request for all (available) records */ +{LDNS_RR_TYPE_ANY, "ANY", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + +#ifdef DRAFT_RRTYPES + /* 256 */ + {LDNS_RR_TYPE_URI, "URI", 3, 3, type_uri_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +#else +{LDNS_RR_TYPE_NULL, "TYPE256", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +#endif + /* 257 */ + {LDNS_RR_TYPE_CAA, "CAA", 3, 3, type_caa_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + +/* split in array, no longer contiguous */ + +#ifdef DRAFT_RRTYPES + /* 32768 */ + {LDNS_RR_TYPE_TA, "TA", 4, 4, type_ds_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +#else +{LDNS_RR_TYPE_NULL, "TYPE32768", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +#endif + /* 32769 */ + {LDNS_RR_TYPE_DLV, "DLV", 4, 4, type_ds_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 } +}; + +/** + * \def LDNS_RDATA_FIELD_DESCRIPTORS_COUNT + * computes the number of rdata fields + */ +#define LDNS_RDATA_FIELD_DESCRIPTORS_COUNT \ + (sizeof(rdata_field_descriptors)/sizeof(rdata_field_descriptors[0])) + +const sldns_rr_descriptor * +sldns_rr_descript(uint16_t type) +{ + size_t i; + if (type < LDNS_RDATA_FIELD_DESCRIPTORS_COMMON) { + return &rdata_field_descriptors[type]; + } else { + /* because not all array index equals type code */ + for (i = LDNS_RDATA_FIELD_DESCRIPTORS_COMMON; + i < LDNS_RDATA_FIELD_DESCRIPTORS_COUNT; + i++) { + if (rdata_field_descriptors[i]._type == type) { + return &rdata_field_descriptors[i]; + } + } + return &rdata_field_descriptors[0]; + } +} + +size_t +sldns_rr_descriptor_minimum(const sldns_rr_descriptor *descriptor) +{ + if (descriptor) { + return descriptor->_minimum; + } else { + return 0; + } +} + +size_t +sldns_rr_descriptor_maximum(const sldns_rr_descriptor *descriptor) +{ + if (descriptor) { + if (descriptor->_variable != LDNS_RDF_TYPE_NONE) { + return 65535; /* cannot be more than 64k */ + } else { + return descriptor->_maximum; + } + } else { + return 0; + } +} + +sldns_rdf_type +sldns_rr_descriptor_field_type(const sldns_rr_descriptor *descriptor, + size_t index) +{ + assert(descriptor != NULL); + assert(index < descriptor->_maximum + || descriptor->_variable != LDNS_RDF_TYPE_NONE); + if (index < descriptor->_maximum) { + return descriptor->_wireformat[index]; + } else { + return descriptor->_variable; + } +} + +sldns_rr_type +sldns_get_rr_type_by_name(const char *name) +{ + unsigned int i; + const char *desc_name; + const sldns_rr_descriptor *desc; + + /* TYPEXX representation */ + if (strlen(name) > 4 && strncasecmp(name, "TYPE", 4) == 0) { + return atoi(name + 4); + } + + /* Normal types */ + for (i = 0; i < (unsigned int) LDNS_RDATA_FIELD_DESCRIPTORS_COUNT; i++) { + desc = &rdata_field_descriptors[i]; + desc_name = desc->_name; + if(desc_name && + strlen(name) == strlen(desc_name) && + strncasecmp(name, desc_name, strlen(desc_name)) == 0) { + /* because not all array index equals type code */ + return desc->_type; + } + } + + /* special cases for query types */ + if (strlen(name) == 4 && strncasecmp(name, "IXFR", 4) == 0) { + return 251; + } else if (strlen(name) == 4 && strncasecmp(name, "AXFR", 4) == 0) { + return 252; + } else if (strlen(name) == 5 && strncasecmp(name, "MAILB", 5) == 0) { + return 253; + } else if (strlen(name) == 5 && strncasecmp(name, "MAILA", 5) == 0) { + return 254; + } else if (strlen(name) == 3 && strncasecmp(name, "ANY", 3) == 0) { + return 255; + } + + return 0; +} + +sldns_rr_class +sldns_get_rr_class_by_name(const char *name) +{ + sldns_lookup_table *lt; + + /* CLASSXX representation */ + if (strlen(name) > 5 && strncasecmp(name, "CLASS", 5) == 0) { + return atoi(name + 5); + } + + /* Normal types */ + lt = sldns_lookup_by_name(sldns_rr_classes, name); + if (lt) { + return lt->id; + } + return 0; +} diff --git a/contrib/unbound/ldns/rrdef.h b/contrib/unbound/ldns/rrdef.h new file mode 100644 index 00000000000..442eb26e0e0 --- /dev/null +++ b/contrib/unbound/ldns/rrdef.h @@ -0,0 +1,503 @@ +/* + * rrdef.h + * + * RR definitions + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +/** + * \file + * + * Defines resource record types and constants. + */ + +#ifndef LDNS_RRDEF_H +#define LDNS_RRDEF_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** Maximum length of a dname label */ +#define LDNS_MAX_LABELLEN 63 +/** Maximum length of a complete dname */ +#define LDNS_MAX_DOMAINLEN 255 +/** Maximum number of pointers in 1 dname */ +#define LDNS_MAX_POINTERS 65535 +/** The bytes TTL, CLASS and length use up in an rr */ +#define LDNS_RR_OVERHEAD 10 + +#define LDNS_DNSSEC_KEYPROTO 3 +#define LDNS_KEY_ZONE_KEY 0x0100 /* set for ZSK&KSK, rfc 4034 */ +#define LDNS_KEY_SEP_KEY 0x0001 /* set for KSK, rfc 4034 */ +#define LDNS_KEY_REVOKE_KEY 0x0080 /* used to revoke KSK, rfc 5011 */ + +/* The first fields are contiguous and can be referenced instantly */ +#define LDNS_RDATA_FIELD_DESCRIPTORS_COMMON 258 + +/** lookuptable for rr classes */ +extern struct sldns_struct_lookup_table* sldns_rr_classes; + +/** + * The different RR classes. + */ +enum sldns_enum_rr_class +{ + /** the Internet */ + LDNS_RR_CLASS_IN = 1, + /** Chaos class */ + LDNS_RR_CLASS_CH = 3, + /** Hesiod (Dyer 87) */ + LDNS_RR_CLASS_HS = 4, + /** None class, dynamic update */ + LDNS_RR_CLASS_NONE = 254, + /** Any class */ + LDNS_RR_CLASS_ANY = 255, + + LDNS_RR_CLASS_FIRST = 0, + LDNS_RR_CLASS_LAST = 65535, + LDNS_RR_CLASS_COUNT = LDNS_RR_CLASS_LAST - LDNS_RR_CLASS_FIRST + 1 +}; +typedef enum sldns_enum_rr_class sldns_rr_class; + +/** + * Used to specify whether compression is allowed. + */ +enum sldns_enum_rr_compress +{ + /** compression is allowed */ + LDNS_RR_COMPRESS, + LDNS_RR_NO_COMPRESS +}; +typedef enum sldns_enum_rr_compress sldns_rr_compress; + +/** + * The different RR types. + */ +enum sldns_enum_rr_type +{ + /** a host address */ + LDNS_RR_TYPE_A = 1, + /** an authoritative name server */ + LDNS_RR_TYPE_NS = 2, + /** a mail destination (Obsolete - use MX) */ + LDNS_RR_TYPE_MD = 3, + /** a mail forwarder (Obsolete - use MX) */ + LDNS_RR_TYPE_MF = 4, + /** the canonical name for an alias */ + LDNS_RR_TYPE_CNAME = 5, + /** marks the start of a zone of authority */ + LDNS_RR_TYPE_SOA = 6, + /** a mailbox domain name (EXPERIMENTAL) */ + LDNS_RR_TYPE_MB = 7, + /** a mail group member (EXPERIMENTAL) */ + LDNS_RR_TYPE_MG = 8, + /** a mail rename domain name (EXPERIMENTAL) */ + LDNS_RR_TYPE_MR = 9, + /** a null RR (EXPERIMENTAL) */ + LDNS_RR_TYPE_NULL = 10, + /** a well known service description */ + LDNS_RR_TYPE_WKS = 11, + /** a domain name pointer */ + LDNS_RR_TYPE_PTR = 12, + /** host information */ + LDNS_RR_TYPE_HINFO = 13, + /** mailbox or mail list information */ + LDNS_RR_TYPE_MINFO = 14, + /** mail exchange */ + LDNS_RR_TYPE_MX = 15, + /** text strings */ + LDNS_RR_TYPE_TXT = 16, + /** RFC1183 */ + LDNS_RR_TYPE_RP = 17, + /** RFC1183 */ + LDNS_RR_TYPE_AFSDB = 18, + /** RFC1183 */ + LDNS_RR_TYPE_X25 = 19, + /** RFC1183 */ + LDNS_RR_TYPE_ISDN = 20, + /** RFC1183 */ + LDNS_RR_TYPE_RT = 21, + /** RFC1706 */ + LDNS_RR_TYPE_NSAP = 22, + /** RFC1348 */ + LDNS_RR_TYPE_NSAP_PTR = 23, + /** 2535typecode */ + LDNS_RR_TYPE_SIG = 24, + /** 2535typecode */ + LDNS_RR_TYPE_KEY = 25, + /** RFC2163 */ + LDNS_RR_TYPE_PX = 26, + /** RFC1712 */ + LDNS_RR_TYPE_GPOS = 27, + /** ipv6 address */ + LDNS_RR_TYPE_AAAA = 28, + /** LOC record RFC1876 */ + LDNS_RR_TYPE_LOC = 29, + /** 2535typecode */ + LDNS_RR_TYPE_NXT = 30, + /** draft-ietf-nimrod-dns-01.txt */ + LDNS_RR_TYPE_EID = 31, + /** draft-ietf-nimrod-dns-01.txt */ + LDNS_RR_TYPE_NIMLOC = 32, + /** SRV record RFC2782 */ + LDNS_RR_TYPE_SRV = 33, + /** http://www.jhsoft.com/rfc/af-saa-0069.000.rtf */ + LDNS_RR_TYPE_ATMA = 34, + /** RFC2915 */ + LDNS_RR_TYPE_NAPTR = 35, + /** RFC2230 */ + LDNS_RR_TYPE_KX = 36, + /** RFC2538 */ + LDNS_RR_TYPE_CERT = 37, + /** RFC2874 */ + LDNS_RR_TYPE_A6 = 38, + /** RFC2672 */ + LDNS_RR_TYPE_DNAME = 39, + /** dnsind-kitchen-sink-02.txt */ + LDNS_RR_TYPE_SINK = 40, + /** Pseudo OPT record... */ + LDNS_RR_TYPE_OPT = 41, + /** RFC3123 */ + LDNS_RR_TYPE_APL = 42, + /** RFC4034, RFC3658 */ + LDNS_RR_TYPE_DS = 43, + /** SSH Key Fingerprint */ + LDNS_RR_TYPE_SSHFP = 44, /* RFC 4255 */ + /** IPsec Key */ + LDNS_RR_TYPE_IPSECKEY = 45, /* RFC 4025 */ + /** DNSSEC */ + LDNS_RR_TYPE_RRSIG = 46, /* RFC 4034 */ + LDNS_RR_TYPE_NSEC = 47, /* RFC 4034 */ + LDNS_RR_TYPE_DNSKEY = 48, /* RFC 4034 */ + + LDNS_RR_TYPE_DHCID = 49, /* RFC 4701 */ + /* NSEC3 */ + LDNS_RR_TYPE_NSEC3 = 50, /* RFC 5155 */ + LDNS_RR_TYPE_NSEC3PARAM = 51, /* RFC 5155 */ + LDNS_RR_TYPE_NSEC3PARAMS = 51, + LDNS_RR_TYPE_TLSA = 52, /* RFC 6698 */ + + LDNS_RR_TYPE_HIP = 55, /* RFC 5205 */ + + /** draft-reid-dnsext-zs */ + LDNS_RR_TYPE_NINFO = 56, + /** draft-reid-dnsext-rkey */ + LDNS_RR_TYPE_RKEY = 57, + /** draft-ietf-dnsop-trust-history */ + LDNS_RR_TYPE_TALINK = 58, + /** draft-barwood-dnsop-ds-publis */ + LDNS_RR_TYPE_CDS = 59, + + LDNS_RR_TYPE_SPF = 99, /* RFC 4408 */ + + LDNS_RR_TYPE_UINFO = 100, + LDNS_RR_TYPE_UID = 101, + LDNS_RR_TYPE_GID = 102, + LDNS_RR_TYPE_UNSPEC = 103, + + LDNS_RR_TYPE_NID = 104, /* RFC 6742 */ + LDNS_RR_TYPE_L32 = 105, /* RFC 6742 */ + LDNS_RR_TYPE_L64 = 106, /* RFC 6742 */ + LDNS_RR_TYPE_LP = 107, /* RFC 6742 */ + + /** draft-jabley-dnsext-eui48-eui64-rrtypes */ + LDNS_RR_TYPE_EUI48 = 108, + LDNS_RR_TYPE_EUI64 = 109, + + LDNS_RR_TYPE_TKEY = 249, /* RFC 2930 */ + LDNS_RR_TYPE_TSIG = 250, + LDNS_RR_TYPE_IXFR = 251, + LDNS_RR_TYPE_AXFR = 252, + /** A request for mailbox-related records (MB, MG or MR) */ + LDNS_RR_TYPE_MAILB = 253, + /** A request for mail agent RRs (Obsolete - see MX) */ + LDNS_RR_TYPE_MAILA = 254, + /** any type (wildcard) */ + LDNS_RR_TYPE_ANY = 255, + /** draft-faltstrom-uri-06 */ + LDNS_RR_TYPE_URI = 256, + LDNS_RR_TYPE_CAA = 257, /* RFC 6844 */ + + /** DNSSEC Trust Authorities */ + LDNS_RR_TYPE_TA = 32768, + /* RFC 4431, 5074, DNSSEC Lookaside Validation */ + LDNS_RR_TYPE_DLV = 32769, + + /* type codes from nsec3 experimental phase + LDNS_RR_TYPE_NSEC3 = 65324, + LDNS_RR_TYPE_NSEC3PARAMS = 65325, */ + LDNS_RR_TYPE_FIRST = 0, + LDNS_RR_TYPE_LAST = 65535, + LDNS_RR_TYPE_COUNT = LDNS_RR_TYPE_LAST - LDNS_RR_TYPE_FIRST + 1 +}; +typedef enum sldns_enum_rr_type sldns_rr_type; + +/* RDATA */ +#define LDNS_MAX_RDFLEN 65535 + +#define LDNS_RDF_SIZE_BYTE 1 +#define LDNS_RDF_SIZE_WORD 2 +#define LDNS_RDF_SIZE_DOUBLEWORD 4 +#define LDNS_RDF_SIZE_6BYTES 6 +#define LDNS_RDF_SIZE_8BYTES 8 +#define LDNS_RDF_SIZE_16BYTES 16 + +#define LDNS_NSEC3_VARS_OPTOUT_MASK 0x01 + +#define LDNS_APL_IP4 1 +#define LDNS_APL_IP6 2 +#define LDNS_APL_MASK 0x7f +#define LDNS_APL_NEGATION 0x80 + +/** + * The different types of RDATA fields. + */ +enum sldns_enum_rdf_type +{ + /** none */ + LDNS_RDF_TYPE_NONE, + /** domain name */ + LDNS_RDF_TYPE_DNAME, + /** 8 bits */ + LDNS_RDF_TYPE_INT8, + /** 16 bits */ + LDNS_RDF_TYPE_INT16, + /** 32 bits */ + LDNS_RDF_TYPE_INT32, + /** A record */ + LDNS_RDF_TYPE_A, + /** AAAA record */ + LDNS_RDF_TYPE_AAAA, + /** txt string */ + LDNS_RDF_TYPE_STR, + /** apl data */ + LDNS_RDF_TYPE_APL, + /** b32 string */ + LDNS_RDF_TYPE_B32_EXT, + /** b64 string */ + LDNS_RDF_TYPE_B64, + /** hex string */ + LDNS_RDF_TYPE_HEX, + /** nsec type codes */ + LDNS_RDF_TYPE_NSEC, + /** a RR type */ + LDNS_RDF_TYPE_TYPE, + /** a class */ + LDNS_RDF_TYPE_CLASS, + /** certificate algorithm */ + LDNS_RDF_TYPE_CERT_ALG, + /** a key algorithm */ + LDNS_RDF_TYPE_ALG, + /** unknown types */ + LDNS_RDF_TYPE_UNKNOWN, + /** time (32 bits) */ + LDNS_RDF_TYPE_TIME, + /** period */ + LDNS_RDF_TYPE_PERIOD, + /** tsig time 48 bits */ + LDNS_RDF_TYPE_TSIGTIME, + /** Represents the Public Key Algorithm, HIT and Public Key fields + for the HIP RR types. A HIP specific rdf type is used because of + the unusual layout in wireformat (see RFC 5205 Section 5) */ + LDNS_RDF_TYPE_HIP, + /** variable length any type rdata where the length + is specified by the first 2 bytes */ + LDNS_RDF_TYPE_INT16_DATA, + /** protocol and port bitmaps */ + LDNS_RDF_TYPE_SERVICE, + /** location data */ + LDNS_RDF_TYPE_LOC, + /** well known services */ + LDNS_RDF_TYPE_WKS, + /** NSAP */ + LDNS_RDF_TYPE_NSAP, + /** ATMA */ + LDNS_RDF_TYPE_ATMA, + /** IPSECKEY */ + LDNS_RDF_TYPE_IPSECKEY, + /** nsec3 hash salt */ + LDNS_RDF_TYPE_NSEC3_SALT, + /** nsec3 base32 string (with length byte on wire */ + LDNS_RDF_TYPE_NSEC3_NEXT_OWNER, + + /** 4 shorts represented as 4 * 16 bit hex numbers + * seperated by colons. For NID and L64. + */ + LDNS_RDF_TYPE_ILNP64, + + /** 6 * 8 bit hex numbers seperated by dashes. For EUI48. */ + LDNS_RDF_TYPE_EUI48, + /** 8 * 8 bit hex numbers seperated by dashes. For EUI64. */ + LDNS_RDF_TYPE_EUI64, + + /** A non-zero sequence of US-ASCII letters and numbers in lower case. + * For CAA. + */ + LDNS_RDF_TYPE_TAG, + + /** A encoding of the value field as specified + * [RFC1035], Section 5.1., encoded as remaining rdata. + * For CAA. + */ + LDNS_RDF_TYPE_LONG_STR, + + /* Aliases */ + LDNS_RDF_TYPE_BITMAP = LDNS_RDF_TYPE_NSEC +}; +typedef enum sldns_enum_rdf_type sldns_rdf_type; + +/** + * Algorithms used in dns + */ +enum sldns_enum_algorithm +{ + LDNS_RSAMD5 = 1, /* RFC 4034,4035 */ + LDNS_DH = 2, + LDNS_DSA = 3, + LDNS_ECC = 4, + LDNS_RSASHA1 = 5, + LDNS_DSA_NSEC3 = 6, + LDNS_RSASHA1_NSEC3 = 7, + LDNS_RSASHA256 = 8, /* RFC 5702 */ + LDNS_RSASHA512 = 10, /* RFC 5702 */ + LDNS_ECC_GOST = 12, /* RFC 5933 */ + LDNS_ECDSAP256SHA256 = 13, /* RFC 6605 */ + LDNS_ECDSAP384SHA384 = 14, /* RFC 6605 */ + LDNS_INDIRECT = 252, + LDNS_PRIVATEDNS = 253, + LDNS_PRIVATEOID = 254 +}; +typedef enum sldns_enum_algorithm sldns_algorithm; + +/** + * Hashing algorithms used in the DS record + */ +enum sldns_enum_hash +{ + LDNS_SHA1 = 1, /* RFC 4034 */ + LDNS_SHA256 = 2, /* RFC 4509 */ + LDNS_HASH_GOST = 3, /* RFC 5933 */ + LDNS_SHA384 = 4 /* RFC 6605 */ +}; +typedef enum sldns_enum_hash sldns_hash; + +/** + * algorithms used in CERT rrs + */ +enum sldns_enum_cert_algorithm +{ + LDNS_CERT_PKIX = 1, + LDNS_CERT_SPKI = 2, + LDNS_CERT_PGP = 3, + LDNS_CERT_IPKIX = 4, + LDNS_CERT_ISPKI = 5, + LDNS_CERT_IPGP = 6, + LDNS_CERT_ACPKIX = 7, + LDNS_CERT_IACPKIX = 8, + LDNS_CERT_URI = 253, + LDNS_CERT_OID = 254 +}; +typedef enum sldns_enum_cert_algorithm sldns_cert_algorithm; + +/** + * EDNS option codes + */ +enum sldns_enum_edns_option +{ + LDNS_EDNS_LLQ = 1, /* http://files.dns-sd.org/draft-sekar-dns-llq.txt */ + LDNS_EDNS_UL = 2, /* http://files.dns-sd.org/draft-sekar-dns-ul.txt */ + LDNS_EDNS_NSID = 3, /* RFC5001 */ + /* 4 draft-cheshire-edns0-owner-option */ + LDNS_EDNS_DAU = 5, /* RFC6975 */ + LDNS_EDNS_DHU = 6, /* RFC6975 */ + LDNS_EDNS_N3U = 7, /* RFC6975 */ + LDNS_EDNS_CLIENT_SUBNET = 8 /* draft-vandergaast-edns-client-subnet */ +}; +typedef enum sldns_edns_option sldns_edns_option; + +#define LDNS_EDNS_MASK_DO_BIT 0x8000 + +/** + * Contains all information about resource record types. + * + * This structure contains, for all rr types, the rdata fields that are defined. + */ +struct sldns_struct_rr_descriptor +{ + /** Type of the RR that is described here */ + sldns_rr_type _type; + /** Textual name of the RR type. */ + const char *_name; + /** Minimum number of rdata fields in the RRs of this type. */ + uint8_t _minimum; + /** Maximum number of rdata fields in the RRs of this type. */ + uint8_t _maximum; + /** Wireformat specification for the rr, i.e. the types of rdata fields in their respective order. */ + const sldns_rdf_type *_wireformat; + /** Special rdf types */ + sldns_rdf_type _variable; + /** Specifies whether compression can be used for dnames in this RR type. */ + sldns_rr_compress _compress; + /** The number of DNAMEs in the _wireformat string, for parsing. */ + uint8_t _dname_count; +}; +typedef struct sldns_struct_rr_descriptor sldns_rr_descriptor; + +/** + * returns the resource record descriptor for the given rr type. + * + * \param[in] type the type value of the rr type + *\return the sldns_rr_descriptor for this type + */ +const sldns_rr_descriptor *sldns_rr_descript(uint16_t type); + +/** + * returns the minimum number of rdata fields of the rr type this descriptor describes. + * + * \param[in] descriptor for an rr type + * \return the minimum number of rdata fields + */ +size_t sldns_rr_descriptor_minimum(const sldns_rr_descriptor *descriptor); + +/** + * returns the maximum number of rdata fields of the rr type this descriptor describes. + * + * \param[in] descriptor for an rr type + * \return the maximum number of rdata fields + */ +size_t sldns_rr_descriptor_maximum(const sldns_rr_descriptor *descriptor); + +/** + * returns the rdf type for the given rdata field number of the rr type for the given descriptor. + * + * \param[in] descriptor for an rr type + * \param[in] field the field number + * \return the rdf type for the field + */ +sldns_rdf_type sldns_rr_descriptor_field_type(const sldns_rr_descriptor *descriptor, size_t field); + +/** + * retrieves a rrtype by looking up its name. + * \param[in] name a string with the name + * \return the type which corresponds with the name + */ +sldns_rr_type sldns_get_rr_type_by_name(const char *name); + +/** + * retrieves a class by looking up its name. + * \param[in] name string with the name + * \return the cass which corresponds with the name + */ +sldns_rr_class sldns_get_rr_class_by_name(const char *name); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_RRDEF_H */ diff --git a/contrib/unbound/ldns/sbuffer.c b/contrib/unbound/ldns/sbuffer.c new file mode 100644 index 00000000000..3d087bfe252 --- /dev/null +++ b/contrib/unbound/ldns/sbuffer.c @@ -0,0 +1,178 @@ +/* + * buffer.c -- generic memory buffer . + * + * Copyright (c) 2001-2008, NLnet Labs. All rights reserved. + * + * See LICENSE for the license. + * + */ +/** + * \file + * + * This file contains the definition of sldns_buffer, and functions to manipulate those. + */ +#include "config.h" +#include "ldns/sbuffer.h" +#include + +sldns_buffer * +sldns_buffer_new(size_t capacity) +{ + sldns_buffer *buffer = (sldns_buffer*)malloc(sizeof(sldns_buffer)); + + if (!buffer) { + return NULL; + } + + buffer->_data = (uint8_t *) malloc(capacity); + if (!buffer->_data) { + free(buffer); + return NULL; + } + + buffer->_position = 0; + buffer->_limit = buffer->_capacity = capacity; + buffer->_fixed = 0; + buffer->_status_err = 0; + + sldns_buffer_invariant(buffer); + + return buffer; +} + +void +sldns_buffer_new_frm_data(sldns_buffer *buffer, void *data, size_t size) +{ + assert(data != NULL); + + buffer->_position = 0; + buffer->_limit = buffer->_capacity = size; + buffer->_fixed = 0; + buffer->_data = malloc(size); + if(!buffer->_data) { + buffer->_status_err = 1; + return; + } + memcpy(buffer->_data, data, size); + buffer->_status_err = 0; + + sldns_buffer_invariant(buffer); +} + +void +sldns_buffer_init_frm_data(sldns_buffer *buffer, void *data, size_t size) +{ + memset(buffer, 0, sizeof(*buffer)); + buffer->_data = data; + buffer->_capacity = buffer->_limit = size; + buffer->_fixed = 1; +} + +int +sldns_buffer_set_capacity(sldns_buffer *buffer, size_t capacity) +{ + void *data; + + sldns_buffer_invariant(buffer); + assert(buffer->_position <= capacity); + + data = (uint8_t *) realloc(buffer->_data, capacity); + if (!data) { + buffer->_status_err = 1; + return 0; + } else { + buffer->_data = data; + buffer->_limit = buffer->_capacity = capacity; + return 1; + } +} + +int +sldns_buffer_reserve(sldns_buffer *buffer, size_t amount) +{ + sldns_buffer_invariant(buffer); + assert(!buffer->_fixed); + if (buffer->_capacity < buffer->_position + amount) { + size_t new_capacity = buffer->_capacity * 3 / 2; + + if (new_capacity < buffer->_position + amount) { + new_capacity = buffer->_position + amount; + } + if (!sldns_buffer_set_capacity(buffer, new_capacity)) { + buffer->_status_err = 1; + return 0; + } + } + buffer->_limit = buffer->_capacity; + return 1; +} + +int +sldns_buffer_printf(sldns_buffer *buffer, const char *format, ...) +{ + va_list args; + int written = 0; + size_t remaining; + + if (sldns_buffer_status_ok(buffer)) { + sldns_buffer_invariant(buffer); + assert(buffer->_limit == buffer->_capacity); + + remaining = sldns_buffer_remaining(buffer); + va_start(args, format); + written = vsnprintf((char *) sldns_buffer_current(buffer), remaining, + format, args); + va_end(args); + if (written == -1) { + buffer->_status_err = 1; + return -1; + } else if ((size_t) written >= remaining) { + if (!sldns_buffer_reserve(buffer, (size_t) written + 1)) { + buffer->_status_err = 1; + return -1; + } + va_start(args, format); + written = vsnprintf((char *) sldns_buffer_current(buffer), + sldns_buffer_remaining(buffer), format, args); + va_end(args); + if (written == -1) { + buffer->_status_err = 1; + return -1; + } + } + buffer->_position += written; + } + return written; +} + +void +sldns_buffer_free(sldns_buffer *buffer) +{ + if (!buffer) { + return; + } + + if (!buffer->_fixed) + free(buffer->_data); + + free(buffer); +} + +void * +sldns_buffer_export(sldns_buffer *buffer) +{ + buffer->_fixed = 1; + return buffer->_data; +} + +void +sldns_buffer_copy(sldns_buffer* result, sldns_buffer* from) +{ + size_t tocopy = sldns_buffer_limit(from); + + if(tocopy > sldns_buffer_capacity(result)) + tocopy = sldns_buffer_capacity(result); + sldns_buffer_clear(result); + sldns_buffer_write(result, sldns_buffer_begin(from), tocopy); + sldns_buffer_flip(result); +} diff --git a/contrib/unbound/ldns/sbuffer.h b/contrib/unbound/ldns/sbuffer.h new file mode 100644 index 00000000000..2436763d3ea --- /dev/null +++ b/contrib/unbound/ldns/sbuffer.h @@ -0,0 +1,706 @@ +/* + * buffer.h -- generic memory buffer. + * + * Copyright (c) 2005-2008, NLnet Labs. All rights reserved. + * + * See LICENSE for the license. + * + * + * The buffer module implements a generic buffer. The API is based on + * the java.nio.Buffer interface. + */ + +#ifndef LDNS_SBUFFER_H +#define LDNS_SBUFFER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef S_SPLINT_S +# define INLINE +#else +# ifdef SWIG +# define INLINE static +# else +# define INLINE static inline +# endif +#endif + +/* + * Copy data allowing for unaligned accesses in network byte order + * (big endian). + */ +INLINE uint16_t +sldns_read_uint16(const void *src) +{ +#ifdef ALLOW_UNALIGNED_ACCESSES + return ntohs(*(uint16_t *) src); +#else + uint8_t *p = (uint8_t *) src; + return ((uint16_t) p[0] << 8) | (uint16_t) p[1]; +#endif +} + +INLINE uint32_t +sldns_read_uint32(const void *src) +{ +#ifdef ALLOW_UNALIGNED_ACCESSES + return ntohl(*(uint32_t *) src); +#else + uint8_t *p = (uint8_t *) src; + return ( ((uint32_t) p[0] << 24) + | ((uint32_t) p[1] << 16) + | ((uint32_t) p[2] << 8) + | (uint32_t) p[3]); +#endif +} + +/* + * Copy data allowing for unaligned accesses in network byte order + * (big endian). + */ +INLINE void +sldns_write_uint16(void *dst, uint16_t data) +{ +#ifdef ALLOW_UNALIGNED_ACCESSES + * (uint16_t *) dst = htons(data); +#else + uint8_t *p = (uint8_t *) dst; + p[0] = (uint8_t) ((data >> 8) & 0xff); + p[1] = (uint8_t) (data & 0xff); +#endif +} + +INLINE void +sldns_write_uint32(void *dst, uint32_t data) +{ +#ifdef ALLOW_UNALIGNED_ACCESSES + * (uint32_t *) dst = htonl(data); +#else + uint8_t *p = (uint8_t *) dst; + p[0] = (uint8_t) ((data >> 24) & 0xff); + p[1] = (uint8_t) ((data >> 16) & 0xff); + p[2] = (uint8_t) ((data >> 8) & 0xff); + p[3] = (uint8_t) (data & 0xff); +#endif +} + + +/** + * \file sbuffer.h + * + * This file contains the definition of sldns_buffer, and functions to manipulate those. + */ + +/** + * implementation of buffers to ease operations + * + * sldns_buffers can contain arbitrary information, per octet. You can write + * to the current end of a buffer, read from the current position, and + * access any data within it. + */ +struct sldns_buffer +{ + /** The current position used for reading/writing */ + size_t _position; + + /** The read/write limit */ + size_t _limit; + + /** The amount of data the buffer can contain */ + size_t _capacity; + + /** The data contained in the buffer */ + uint8_t *_data; + + /** If the buffer is fixed it cannot be resized */ + unsigned _fixed : 1; + + /** The current state of the buffer. If writing to the buffer fails + * for any reason, this value is changed. This way, you can perform + * multiple writes in sequence and check for success afterwards. */ + unsigned _status_err : 1; +}; +typedef struct sldns_buffer sldns_buffer; + +#ifdef NDEBUG +INLINE void +sldns_buffer_invariant(sldns_buffer *ATTR_UNUSED(buffer)) +{ +} +#else +INLINE void +sldns_buffer_invariant(sldns_buffer *buffer) +{ + assert(buffer != NULL); + assert(buffer->_position <= buffer->_limit); + assert(buffer->_limit <= buffer->_capacity); + assert(buffer->_data != NULL); +} +#endif + +/** + * creates a new buffer with the specified capacity. + * + * \param[in] capacity the size (in bytes) to allocate for the buffer + * \return the created buffer + */ +sldns_buffer *sldns_buffer_new(size_t capacity); + +/** + * creates a buffer with the specified data. The data IS copied + * and MEMORY allocations are done. The buffer is not fixed and can + * be resized using buffer_reserve(). + * + * \param[in] buffer pointer to the buffer to put the data in + * \param[in] data the data to encapsulate in the buffer + * \param[in] size the size of the data + */ +void sldns_buffer_new_frm_data(sldns_buffer *buffer, void *data, size_t size); + +/** + * Setup a buffer with the data pointed to. No data copied, no memory allocs. + * The buffer is fixed. + * \param[in] buffer pointer to the buffer to put the data in + * \param[in] data the data to encapsulate in the buffer + * \param[in] size the size of the data + */ +void sldns_buffer_init_frm_data(sldns_buffer *buffer, void *data, size_t size); + +/** + * clears the buffer and make it ready for writing. The buffer's limit + * is set to the capacity and the position is set to 0. + * \param[in] buffer the buffer to clear + */ +INLINE void sldns_buffer_clear(sldns_buffer *buffer) +{ + sldns_buffer_invariant(buffer); + + /* reset status here? */ + + buffer->_position = 0; + buffer->_limit = buffer->_capacity; +} + +/** + * makes the buffer ready for reading the data that has been written to + * the buffer. The buffer's limit is set to the current position and + * the position is set to 0. + * + * \param[in] buffer the buffer to flip + * \return void + */ +INLINE void sldns_buffer_flip(sldns_buffer *buffer) +{ + sldns_buffer_invariant(buffer); + + buffer->_limit = buffer->_position; + buffer->_position = 0; +} + +/** + * make the buffer ready for re-reading the data. The buffer's + * position is reset to 0. + * \param[in] buffer the buffer to rewind + */ +INLINE void sldns_buffer_rewind(sldns_buffer *buffer) +{ + sldns_buffer_invariant(buffer); + + buffer->_position = 0; +} + +/** + * returns the current position in the buffer (as a number of bytes) + * \param[in] buffer the buffer + * \return the current position + */ +INLINE size_t +sldns_buffer_position(sldns_buffer *buffer) +{ + return buffer->_position; +} + +/** + * sets the buffer's position to MARK. The position must be less than + * or equal to the buffer's limit. + * \param[in] buffer the buffer + * \param[in] mark the mark to use + */ +INLINE void +sldns_buffer_set_position(sldns_buffer *buffer, size_t mark) +{ + assert(mark <= buffer->_limit); + buffer->_position = mark; +} + +/** + * changes the buffer's position by COUNT bytes. The position must not + * be moved behind the buffer's limit or before the beginning of the + * buffer. + * \param[in] buffer the buffer + * \param[in] count the count to use + */ +INLINE void +sldns_buffer_skip(sldns_buffer *buffer, ssize_t count) +{ + assert(buffer->_position + count <= buffer->_limit); + buffer->_position += count; +} + +/** + * returns the maximum size of the buffer + * \param[in] buffer + * \return the size + */ +INLINE size_t +sldns_buffer_limit(sldns_buffer *buffer) +{ + return buffer->_limit; +} + +/** + * changes the buffer's limit. If the buffer's position is greater + * than the new limit the position is set to the limit. + * \param[in] buffer the buffer + * \param[in] limit the new limit + */ +INLINE void +sldns_buffer_set_limit(sldns_buffer *buffer, size_t limit) +{ + assert(limit <= buffer->_capacity); + buffer->_limit = limit; + if (buffer->_position > buffer->_limit) + buffer->_position = buffer->_limit; +} + +/** + * returns the number of bytes the buffer can hold. + * \param[in] buffer the buffer + * \return the number of bytes + */ +INLINE size_t +sldns_buffer_capacity(sldns_buffer *buffer) +{ + return buffer->_capacity; +} + +/** + * changes the buffer's capacity. The data is reallocated so any + * pointers to the data may become invalid. The buffer's limit is set + * to the buffer's new capacity. + * \param[in] buffer the buffer + * \param[in] capacity the capacity to use + * \return whether this failed or succeeded + */ +int sldns_buffer_set_capacity(sldns_buffer *buffer, size_t capacity); + +/** + * ensures BUFFER can contain at least AMOUNT more bytes. The buffer's + * capacity is increased if necessary using buffer_set_capacity(). + * + * The buffer's limit is always set to the (possibly increased) + * capacity. + * \param[in] buffer the buffer + * \param[in] amount amount to use + * \return whether this failed or succeeded + */ +int sldns_buffer_reserve(sldns_buffer *buffer, size_t amount); + +/** + * returns a pointer to the data at the indicated position. + * \param[in] buffer the buffer + * \param[in] at position + * \return the pointer to the data + */ +INLINE uint8_t * +sldns_buffer_at(const sldns_buffer *buffer, size_t at) +{ + assert(at <= buffer->_limit); + return buffer->_data + at; +} + +/** + * returns a pointer to the beginning of the buffer (the data at + * position 0). + * \param[in] buffer the buffer + * \return the pointer + */ +INLINE uint8_t * +sldns_buffer_begin(const sldns_buffer *buffer) +{ + return sldns_buffer_at(buffer, 0); +} + +/** + * returns a pointer to the end of the buffer (the data at the buffer's + * limit). + * \param[in] buffer the buffer + * \return the pointer + */ +INLINE uint8_t * +sldns_buffer_end(sldns_buffer *buffer) +{ + return sldns_buffer_at(buffer, buffer->_limit); +} + +/** + * returns a pointer to the data at the buffer's current position. + * \param[in] buffer the buffer + * \return the pointer + */ +INLINE uint8_t * +sldns_buffer_current(sldns_buffer *buffer) +{ + return sldns_buffer_at(buffer, buffer->_position); +} + +/** + * returns the number of bytes remaining between the indicated position and + * the limit. + * \param[in] buffer the buffer + * \param[in] at indicated position + * \return number of bytes + */ +INLINE size_t +sldns_buffer_remaining_at(sldns_buffer *buffer, size_t at) +{ + sldns_buffer_invariant(buffer); + assert(at <= buffer->_limit); + return buffer->_limit - at; +} + +/** + * returns the number of bytes remaining between the buffer's position and + * limit. + * \param[in] buffer the buffer + * \return the number of bytes + */ +INLINE size_t +sldns_buffer_remaining(sldns_buffer *buffer) +{ + return sldns_buffer_remaining_at(buffer, buffer->_position); +} + +/** + * checks if the buffer has at least COUNT more bytes available. + * Before reading or writing the caller needs to ensure enough space + * is available! + * \param[in] buffer the buffer + * \param[in] at indicated position + * \param[in] count how much is available + * \return true or false (as int?) + */ +INLINE int +sldns_buffer_available_at(sldns_buffer *buffer, size_t at, size_t count) +{ + return count <= sldns_buffer_remaining_at(buffer, at); +} + +/** + * checks if the buffer has count bytes available at the current position + * \param[in] buffer the buffer + * \param[in] count how much is available + * \return true or false (as int?) + */ +INLINE int +sldns_buffer_available(sldns_buffer *buffer, size_t count) +{ + return sldns_buffer_available_at(buffer, buffer->_position, count); +} + +/** + * writes the given data to the buffer at the specified position + * \param[in] buffer the buffer + * \param[in] at the position (in number of bytes) to write the data at + * \param[in] data pointer to the data to write to the buffer + * \param[in] count the number of bytes of data to write + */ +INLINE void +sldns_buffer_write_at(sldns_buffer *buffer, size_t at, const void *data, size_t count) +{ + assert(sldns_buffer_available_at(buffer, at, count)); + memcpy(buffer->_data + at, data, count); +} + +/** + * writes count bytes of data to the current position of the buffer + * \param[in] buffer the buffer + * \param[in] data the data to write + * \param[in] count the lenght of the data to write + */ +INLINE void +sldns_buffer_write(sldns_buffer *buffer, const void *data, size_t count) +{ + sldns_buffer_write_at(buffer, buffer->_position, data, count); + buffer->_position += count; +} + +/** + * copies the given (null-delimited) string to the specified position at the buffer + * \param[in] buffer the buffer + * \param[in] at the position in the buffer + * \param[in] str the string to write + */ +INLINE void +sldns_buffer_write_string_at(sldns_buffer *buffer, size_t at, const char *str) +{ + sldns_buffer_write_at(buffer, at, str, strlen(str)); +} + +/** + * copies the given (null-delimited) string to the current position at the buffer + * \param[in] buffer the buffer + * \param[in] str the string to write + */ +INLINE void +sldns_buffer_write_string(sldns_buffer *buffer, const char *str) +{ + sldns_buffer_write(buffer, str, strlen(str)); +} + +/** + * writes the given byte of data at the given position in the buffer + * \param[in] buffer the buffer + * \param[in] at the position in the buffer + * \param[in] data the 8 bits to write + */ +INLINE void +sldns_buffer_write_u8_at(sldns_buffer *buffer, size_t at, uint8_t data) +{ + assert(sldns_buffer_available_at(buffer, at, sizeof(data))); + buffer->_data[at] = data; +} + +/** + * writes the given byte of data at the current position in the buffer + * \param[in] buffer the buffer + * \param[in] data the 8 bits to write + */ +INLINE void +sldns_buffer_write_u8(sldns_buffer *buffer, uint8_t data) +{ + sldns_buffer_write_u8_at(buffer, buffer->_position, data); + buffer->_position += sizeof(data); +} + +/** + * writes the given 2 byte integer at the given position in the buffer + * \param[in] buffer the buffer + * \param[in] at the position in the buffer + * \param[in] data the 16 bits to write + */ +INLINE void +sldns_buffer_write_u16_at(sldns_buffer *buffer, size_t at, uint16_t data) +{ + assert(sldns_buffer_available_at(buffer, at, sizeof(data))); + sldns_write_uint16(buffer->_data + at, data); +} + +/** + * writes the given 2 byte integer at the current position in the buffer + * \param[in] buffer the buffer + * \param[in] data the 16 bits to write + */ +INLINE void +sldns_buffer_write_u16(sldns_buffer *buffer, uint16_t data) +{ + sldns_buffer_write_u16_at(buffer, buffer->_position, data); + buffer->_position += sizeof(data); +} + +/** + * writes the given 4 byte integer at the given position in the buffer + * \param[in] buffer the buffer + * \param[in] at the position in the buffer + * \param[in] data the 32 bits to write + */ +INLINE void +sldns_buffer_write_u32_at(sldns_buffer *buffer, size_t at, uint32_t data) +{ + assert(sldns_buffer_available_at(buffer, at, sizeof(data))); + sldns_write_uint32(buffer->_data + at, data); +} + +/** + * writes the given 4 byte integer at the current position in the buffer + * \param[in] buffer the buffer + * \param[in] data the 32 bits to write + */ +INLINE void +sldns_buffer_write_u32(sldns_buffer *buffer, uint32_t data) +{ + sldns_buffer_write_u32_at(buffer, buffer->_position, data); + buffer->_position += sizeof(data); +} + +/** + * copies count bytes of data at the given position to the given data-array + * \param[in] buffer the buffer + * \param[in] at the position in the buffer to start + * \param[out] data buffer to copy to + * \param[in] count the length of the data to copy + */ +INLINE void +sldns_buffer_read_at(sldns_buffer *buffer, size_t at, void *data, size_t count) +{ + assert(sldns_buffer_available_at(buffer, at, count)); + memcpy(data, buffer->_data + at, count); +} + +/** + * copies count bytes of data at the current position to the given data-array + * \param[in] buffer the buffer + * \param[out] data buffer to copy to + * \param[in] count the length of the data to copy + */ +INLINE void +sldns_buffer_read(sldns_buffer *buffer, void *data, size_t count) +{ + sldns_buffer_read_at(buffer, buffer->_position, data, count); + buffer->_position += count; +} + +/** + * returns the byte value at the given position in the buffer + * \param[in] buffer the buffer + * \param[in] at the position in the buffer + * \return 1 byte integer + */ +INLINE uint8_t +sldns_buffer_read_u8_at(sldns_buffer *buffer, size_t at) +{ + assert(sldns_buffer_available_at(buffer, at, sizeof(uint8_t))); + return buffer->_data[at]; +} + +/** + * returns the byte value at the current position in the buffer + * \param[in] buffer the buffer + * \return 1 byte integer + */ +INLINE uint8_t +sldns_buffer_read_u8(sldns_buffer *buffer) +{ + uint8_t result = sldns_buffer_read_u8_at(buffer, buffer->_position); + buffer->_position += sizeof(uint8_t); + return result; +} + +/** + * returns the 2-byte integer value at the given position in the buffer + * \param[in] buffer the buffer + * \param[in] at position in the buffer + * \return 2 byte integer + */ +INLINE uint16_t +sldns_buffer_read_u16_at(sldns_buffer *buffer, size_t at) +{ + assert(sldns_buffer_available_at(buffer, at, sizeof(uint16_t))); + return sldns_read_uint16(buffer->_data + at); +} + +/** + * returns the 2-byte integer value at the current position in the buffer + * \param[in] buffer the buffer + * \return 2 byte integer + */ +INLINE uint16_t +sldns_buffer_read_u16(sldns_buffer *buffer) +{ + uint16_t result = sldns_buffer_read_u16_at(buffer, buffer->_position); + buffer->_position += sizeof(uint16_t); + return result; +} + +/** + * returns the 4-byte integer value at the given position in the buffer + * \param[in] buffer the buffer + * \param[in] at position in the buffer + * \return 4 byte integer + */ +INLINE uint32_t +sldns_buffer_read_u32_at(sldns_buffer *buffer, size_t at) +{ + assert(sldns_buffer_available_at(buffer, at, sizeof(uint32_t))); + return sldns_read_uint32(buffer->_data + at); +} + +/** + * returns the 4-byte integer value at the current position in the buffer + * \param[in] buffer the buffer + * \return 4 byte integer + */ +INLINE uint32_t +sldns_buffer_read_u32(sldns_buffer *buffer) +{ + uint32_t result = sldns_buffer_read_u32_at(buffer, buffer->_position); + buffer->_position += sizeof(uint32_t); + return result; +} + +/** + * returns the status of the buffer + * \param[in] buffer + * \return the status + */ +INLINE int +sldns_buffer_status(sldns_buffer *buffer) +{ + return (int)buffer->_status_err; +} + +/** + * returns true if the status of the buffer is LDNS_STATUS_OK, false otherwise + * \param[in] buffer the buffer + * \return true or false + */ +INLINE int +sldns_buffer_status_ok(sldns_buffer *buffer) +{ + if (buffer) { + return sldns_buffer_status(buffer) == 0; + } else { + return 0; + } +} + +/** + * prints to the buffer, increasing the capacity if required using + * buffer_reserve(). The buffer's position is set to the terminating '\\0' + * Returns the number of characters written (not including the + * terminating '\\0') or -1 on failure. + */ +int sldns_buffer_printf(sldns_buffer *buffer, const char *format, ...) + ATTR_FORMAT(printf, 2, 3); + +/** + * frees the buffer. + * \param[in] *buffer the buffer to be freed + * \return void + */ +void sldns_buffer_free(sldns_buffer *buffer); + +/** + * Makes the buffer fixed and returns a pointer to the data. The + * caller is responsible for free'ing the result. + * \param[in] *buffer the buffer to be exported + * \return void + */ +void *sldns_buffer_export(sldns_buffer *buffer); + +/** + * Copy contents of the from buffer to the result buffer and then flips + * the result buffer. Data will be silently truncated if the result buffer is + * too small. + * \param[out] *result resulting buffer which is copied to. + * \param[in] *from what to copy to result. + */ +void sldns_buffer_copy(sldns_buffer* result, sldns_buffer* from); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_SBUFFER_H */ diff --git a/contrib/unbound/ldns/str2wire.c b/contrib/unbound/ldns/str2wire.c new file mode 100644 index 00000000000..92eefa8518f --- /dev/null +++ b/contrib/unbound/ldns/str2wire.c @@ -0,0 +1,2001 @@ +/** + * str2wire.c - read txt presentation of RRs + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +/** + * \file + * + * Parses text to wireformat. + */ +#include "config.h" +#include "ldns/str2wire.h" +#include "ldns/wire2str.h" +#include "ldns/sbuffer.h" +#include "ldns/parse.h" +#include "ldns/parseutil.h" +#include +#ifdef HAVE_TIME_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif + +/** return an error */ +#define RET_ERR(e, off) ((int)((e)|((off)< LDNS_MAX_DOMAINLEN * 4) { + return RET_ERR(LDNS_WIREPARSE_ERR_DOMAINNAME_OVERFLOW, 0); + } + if (0 == len) { + return RET_ERR(LDNS_WIREPARSE_ERR_DOMAINNAME_UNDERFLOW, 0); + } + + /* root label */ + if (1 == len && *str == '.') { + if(*olen < 1) + return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, 0); + buf[0] = 0; + *olen = 1; + return LDNS_WIREPARSE_ERR_OK; + } + + /* get on with the rest */ + + /* s is on the current character in the string + * pq points to where the labellength is going to go + * label_len keeps track of the current label's length + * q builds the dname inside the buf array + */ + len = 0; + if(*olen < 1) + return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, 0); + q = buf+1; + pq = buf; + label_len = 0; + for (s = str; *s; s++, q++) { + if (q >= buf + *olen) + return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, q-buf); + if (q > buf + LDNS_MAX_DOMAINLEN) + return RET_ERR(LDNS_WIREPARSE_ERR_DOMAINNAME_OVERFLOW, q-buf); + switch (*s) { + case '.': + if (label_len > LDNS_MAX_LABELLEN) { + return RET_ERR(LDNS_WIREPARSE_ERR_LABEL_OVERFLOW, q-buf); + } + if (label_len == 0) { + return RET_ERR(LDNS_WIREPARSE_ERR_EMPTY_LABEL, q-buf); + } + len += label_len + 1; + *q = 0; + *pq = label_len; + label_len = 0; + pq = q; + break; + case '\\': + /* octet value or literal char */ + s += 1; + if (!sldns_parse_escape(q, &s)) { + *q = 0; + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_BAD_ESCAPE, q-buf); + } + s -= 1; + label_len++; + break; + default: + *q = (uint8_t)*s; + label_len++; + } + } + + /* add root label if last char was not '.' */ + if(label_len != 0) { + if(rel) *rel = 1; + if (q >= buf + *olen) + return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, q-buf); + if (q > buf + LDNS_MAX_DOMAINLEN) { + return RET_ERR(LDNS_WIREPARSE_ERR_DOMAINNAME_OVERFLOW, q-buf); + } + if (label_len > LDNS_MAX_LABELLEN) { + return RET_ERR(LDNS_WIREPARSE_ERR_LABEL_OVERFLOW, q-buf); + } + if (label_len == 0) { /* label_len 0 but not . at end? */ + return RET_ERR(LDNS_WIREPARSE_ERR_EMPTY_LABEL, q-buf); + } + len += label_len + 1; + *pq = label_len; + *q = 0; + } + len++; + *olen = len; + + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_dname_buf(const char* str, uint8_t* buf, size_t* len) +{ + return sldns_str2wire_dname_buf_rel(str, buf, len, NULL); +} + +int sldns_str2wire_dname_buf_origin(const char* str, uint8_t* buf, size_t* len, + uint8_t* origin, size_t origin_len) +{ + size_t dlen = *len; + int rel = 0; + int s = sldns_str2wire_dname_buf_rel(str, buf, &dlen, &rel); + if(s) return s; + + if(rel && origin && dlen > 0) { + if(dlen + origin_len - 1 > LDNS_MAX_DOMAINLEN) + return RET_ERR(LDNS_WIREPARSE_ERR_DOMAINNAME_OVERFLOW, + LDNS_MAX_DOMAINLEN); + if(dlen + origin_len - 1 > *len) + return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, + *len); + memmove(buf+dlen-1, origin, origin_len); + *len = dlen + origin_len - 1; + } else + *len = dlen; + return LDNS_WIREPARSE_ERR_OK; +} + +uint8_t* sldns_str2wire_dname(const char* str, size_t* len) +{ + uint8_t dname[LDNS_MAX_DOMAINLEN+1]; + *len = sizeof(dname); + if(sldns_str2wire_dname_buf(str, dname, len) == 0) { + uint8_t* r = (uint8_t*)malloc(*len); + if(r) return memcpy(r, dname, *len); + } + *len = 0; + return NULL; +} + +/** read owner name */ +static int +rrinternal_get_owner(sldns_buffer* strbuf, uint8_t* rr, size_t* len, + size_t* dname_len, uint8_t* origin, size_t origin_len, uint8_t* prev, + size_t prev_len, char* token, size_t token_len) +{ + /* split the rr in its parts -1 signals trouble */ + if(sldns_bget_token(strbuf, token, "\t\n ", token_len) == -1) { + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX, + sldns_buffer_position(strbuf)); + } + + if(strcmp(token, "@") == 0) { + uint8_t* tocopy; + if (origin) { + *dname_len = origin_len; + tocopy = origin; + } else if (prev) { + *dname_len = prev_len; + tocopy = prev; + } else { + /* default to root */ + *dname_len = 1; + tocopy = (uint8_t*)"\0"; + } + if(*len < *dname_len) + return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, + sldns_buffer_position(strbuf)); + memmove(rr, tocopy, *dname_len); + } else if(strlen(token) == 0) { + /* no ownername was given, try prev, if that fails + * origin, else default to root */ + uint8_t* tocopy; + if(prev) { + *dname_len = prev_len; + tocopy = prev; + } else if(origin) { + *dname_len = origin_len; + tocopy = origin; + } else { + *dname_len = 1; + tocopy = (uint8_t*)"\0"; + } + if(*len < *dname_len) + return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, + sldns_buffer_position(strbuf)); + memmove(rr, tocopy, *dname_len); + } else { + size_t dlen = *len; + int s = sldns_str2wire_dname_buf_origin(token, rr, &dlen, + origin, origin_len); + if(s) return RET_ERR_SHIFT(s, + sldns_buffer_position(strbuf)-strlen(token)); + *dname_len = dlen; + } + return LDNS_WIREPARSE_ERR_OK; +} + +/** read ttl */ +static int +rrinternal_get_ttl(sldns_buffer* strbuf, char* token, size_t token_len, + int* not_there, uint32_t* ttl, uint32_t default_ttl) +{ + const char* endptr; + if(sldns_bget_token(strbuf, token, "\t\n ", token_len) == -1) { + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_TTL, + sldns_buffer_position(strbuf)); + } + *ttl = (uint32_t) sldns_str2period(token, &endptr); + + if (strlen(token) > 0 && !isdigit((int)token[0])) { + *not_there = 1; + /* ah, it's not there or something */ + if (default_ttl == 0) { + *ttl = LDNS_DEFAULT_TTL; + } else { + *ttl = default_ttl; + } + } + return LDNS_WIREPARSE_ERR_OK; +} + +/** read class */ +static int +rrinternal_get_class(sldns_buffer* strbuf, char* token, size_t token_len, + int* not_there, uint16_t* cl) +{ + /* if 'not_there' then we got token from previous parse routine */ + if(!*not_there) { + /* parse new token for class */ + if(sldns_bget_token(strbuf, token, "\t\n ", token_len) == -1) { + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_CLASS, + sldns_buffer_position(strbuf)); + } + } else *not_there = 0; + *cl = sldns_get_rr_class_by_name(token); + /* class can be left out too, assume IN, current token must be type */ + if(*cl == 0 && strcmp(token, "CLASS0") != 0) { + *not_there = 1; + *cl = LDNS_RR_CLASS_IN; + } + return LDNS_WIREPARSE_ERR_OK; +} + +/** read type */ +static int +rrinternal_get_type(sldns_buffer* strbuf, char* token, size_t token_len, + int* not_there, uint16_t* tp) +{ + /* if 'not_there' then we got token from previous parse routine */ + if(!*not_there) { + /* parse new token for type */ + if(sldns_bget_token(strbuf, token, "\t\n ", token_len) == -1) { + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_TYPE, + sldns_buffer_position(strbuf)); + } + } + *tp = sldns_get_rr_type_by_name(token); + if(*tp == 0 && strcmp(token, "TYPE0") != 0) { + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_TYPE, + sldns_buffer_position(strbuf)); + } + return LDNS_WIREPARSE_ERR_OK; +} + +/** put type, class, ttl into rr buffer */ +static int +rrinternal_write_typeclassttl(sldns_buffer* strbuf, uint8_t* rr, size_t len, + size_t dname_len, uint16_t tp, uint16_t cl, uint32_t ttl, int question) +{ + if(question) { + /* question is : name, type, class */ + if(dname_len + 4 > len) + return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, + sldns_buffer_position(strbuf)); + sldns_write_uint16(rr+dname_len, tp); + sldns_write_uint16(rr+dname_len+2, cl); + return LDNS_WIREPARSE_ERR_OK; + } + + /* type(2), class(2), ttl(4), rdatalen(2 (later)) = 10 */ + if(dname_len + 10 > len) + return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, + sldns_buffer_position(strbuf)); + sldns_write_uint16(rr+dname_len, tp); + sldns_write_uint16(rr+dname_len+2, cl); + sldns_write_uint32(rr+dname_len+4, ttl); + sldns_write_uint16(rr+dname_len+8, 0); /* rdatalen placeholder */ + return LDNS_WIREPARSE_ERR_OK; +} + +/** find delimiters for type */ +static const char* +rrinternal_get_delims(sldns_rdf_type rdftype, uint16_t r_cnt, uint16_t r_max) +{ + switch(rdftype) { + case LDNS_RDF_TYPE_B64 : + case LDNS_RDF_TYPE_HEX : /* These rdf types may con- */ + case LDNS_RDF_TYPE_LOC : /* tain whitespace, only if */ + case LDNS_RDF_TYPE_WKS : /* it is the last rd field. */ + case LDNS_RDF_TYPE_IPSECKEY : + case LDNS_RDF_TYPE_NSEC : if (r_cnt == r_max - 1) { + return "\n\t"; + } + break; + default : break; + } + return "\n\t "; +} + +/* Syntactic sugar for sldns_rr_new_frm_str_internal */ +static int +sldns_rdf_type_maybe_quoted(sldns_rdf_type rdf_type) +{ + return rdf_type == LDNS_RDF_TYPE_STR || + rdf_type == LDNS_RDF_TYPE_LONG_STR; +} + +/** see if rdata is quoted */ +static int +rrinternal_get_quoted(sldns_buffer* strbuf, const char** delimiters, + sldns_rdf_type rdftype) +{ + if(sldns_rdf_type_maybe_quoted(rdftype) && + sldns_buffer_remaining(strbuf) > 0) { + + /* skip spaces */ + while(sldns_buffer_remaining(strbuf) > 0 && + *(sldns_buffer_current(strbuf)) == ' ') { + sldns_buffer_skip(strbuf, 1); + } + + if(sldns_buffer_remaining(strbuf) > 0 && + *(sldns_buffer_current(strbuf)) == '\"') { + *delimiters = "\"\0"; + sldns_buffer_skip(strbuf, 1); + return 1; + } + } + return 0; +} + +/** spool hex data into rdata */ +static int +rrinternal_spool_hex(char* token, uint8_t* rr, size_t rr_len, + size_t rr_cur_len, size_t* cur_hex_data_size, size_t hex_data_size) +{ + char* p = token; + while(*p) { + if(isspace(*p)) { + p++; + continue; + } + if(!isxdigit(*p)) + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_RDATA, + p-token); + if(*cur_hex_data_size >= hex_data_size) + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_RDATA, + p-token); + /* extra robust check */ + if(rr_cur_len+(*cur_hex_data_size)/2 >= rr_len) + return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, + p-token); + /* see if 16s or 1s */ + if( ((*cur_hex_data_size)&1) == 0) { + rr[rr_cur_len+(*cur_hex_data_size)/2] = + (uint8_t)sldns_hexdigit_to_int(*p)*16; + } else { + rr[rr_cur_len+(*cur_hex_data_size)/2] += + (uint8_t)sldns_hexdigit_to_int(*p); + } + p++; + (*cur_hex_data_size)++; + } + return LDNS_WIREPARSE_ERR_OK; +} + +/** read unknown rr type format */ +static int +rrinternal_parse_unknown(sldns_buffer* strbuf, char* token, size_t token_len, + uint8_t* rr, size_t* rr_len, size_t* rr_cur_len, size_t pre_data_pos) +{ + const char* delim = "\n\t "; + size_t hex_data_size, cur_hex_data_size; + /* go back to before \# + * and skip it while setting delimiters better + */ + sldns_buffer_set_position(strbuf, pre_data_pos); + if(sldns_bget_token(strbuf, token, delim, token_len) == -1) + return LDNS_WIREPARSE_ERR_GENERAL; /* should not fail */ + /* read rdata octet length */ + if(sldns_bget_token(strbuf, token, delim, token_len) == -1) { + /* something goes very wrong here */ + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_RDATA, + sldns_buffer_position(strbuf)); + } + hex_data_size = (size_t)atoi(token); + if(hex_data_size > LDNS_MAX_RDFLEN || + *rr_cur_len + hex_data_size > *rr_len) { + return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, + sldns_buffer_position(strbuf)); + } + /* copy hex chars into hex str (2 chars per byte) */ + hex_data_size *= 2; + cur_hex_data_size = 0; + while(cur_hex_data_size < hex_data_size) { + int status; + ssize_t c = sldns_bget_token(strbuf, token, delim, token_len); + if((status = rrinternal_spool_hex(token, rr, *rr_len, + *rr_cur_len, &cur_hex_data_size, hex_data_size)) != 0) + return RET_ERR_SHIFT(status, + sldns_buffer_position(strbuf)-strlen(token)); + if(c == -1) { + if(cur_hex_data_size != hex_data_size) + return RET_ERR( + LDNS_WIREPARSE_ERR_SYNTAX_RDATA, + sldns_buffer_position(strbuf)); + break; + } + } + *rr_cur_len += hex_data_size/2; + return LDNS_WIREPARSE_ERR_OK; +} + +/** parse normal RR rdata element */ +static int +rrinternal_parse_rdf(sldns_buffer* strbuf, char* token, size_t token_len, + uint8_t* rr, size_t rr_len, size_t* rr_cur_len, sldns_rdf_type rdftype, + uint16_t rr_type, uint16_t r_cnt, uint16_t r_max, size_t dname_len, + uint8_t* origin, size_t origin_len) +{ + size_t len; + int status; + + switch(rdftype) { + case LDNS_RDF_TYPE_DNAME: + /* check if the origin should be used or concatenated */ + if(strcmp(token, "@") == 0) { + uint8_t* tocopy; + size_t copylen; + if(origin) { + copylen = origin_len; + tocopy = origin; + } else if(rr_type == LDNS_RR_TYPE_SOA) { + copylen = dname_len; + tocopy = rr; /* copy rr owner name */ + } else { + copylen = 1; + tocopy = (uint8_t*)"\0"; + } + if((*rr_cur_len) + copylen > rr_len) + return RET_ERR( + LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, + sldns_buffer_position(strbuf)); + memmove(rr+*rr_cur_len, tocopy, copylen); + (*rr_cur_len) += copylen; + } else { + size_t dlen = rr_len - (*rr_cur_len); + int s = sldns_str2wire_dname_buf_origin(token, + rr+*rr_cur_len, &dlen, origin, origin_len); + if(s) return RET_ERR_SHIFT(s, + sldns_buffer_position(strbuf)-strlen(token)); + (*rr_cur_len) += dlen; + } + return LDNS_WIREPARSE_ERR_OK; + + case LDNS_RDF_TYPE_HEX: + case LDNS_RDF_TYPE_B64: + /* When this is the last rdata field, then the + * rest should be read in (cause then these + * rdf types may contain spaces). */ + if(r_cnt == r_max - 1) { + size_t tlen = strlen(token); + (void)sldns_bget_token(strbuf, token+tlen, "\n", + token_len - tlen); + } + break; + default: + break; + } + + len = rr_len - (*rr_cur_len); + if((status=sldns_str2wire_rdf_buf(token, rr+(*rr_cur_len), &len, + rdftype)) != 0) + return RET_ERR_SHIFT(status, + sldns_buffer_position(strbuf)-strlen(token)); + *rr_cur_len += len; + return LDNS_WIREPARSE_ERR_OK; +} + +/** + * Parse one rdf token. Takes care of quotes and parenthesis. + */ +static int +sldns_parse_rdf_token(sldns_buffer* strbuf, char* token, size_t token_len, + int* quoted, int* parens, size_t* pre_data_pos, + const char* delimiters, sldns_rdf_type rdftype, size_t* token_strlen) +{ + size_t slen; + + /* skip spaces */ + while(sldns_buffer_remaining(strbuf) > 0 && !*quoted && + *(sldns_buffer_current(strbuf)) == ' ') { + sldns_buffer_skip(strbuf, 1); + } + + *pre_data_pos = sldns_buffer_position(strbuf); + if(sldns_bget_token_par(strbuf, token, (*quoted)?"\"":delimiters, + token_len, parens, (*quoted)?NULL:" \t") == -1) { + return 0; + } + slen = strlen(token); + /* check if not quoted yet, and we have encountered quotes */ + if(!*quoted && sldns_rdf_type_maybe_quoted(rdftype) && + slen >= 2 && + (token[0] == '"' || token[0] == '\'') && + (token[slen-1] == '"' || token[slen-1] == '\'')) { + /* move token two smaller (quotes) with endnull */ + memmove(token, token+1, slen-2); + token[slen-2] = 0; + slen -= 2; + *quoted = 1; + } else if(!*quoted && sldns_rdf_type_maybe_quoted(rdftype) && + slen >= 2 && + (token[0] == '"' || token[0] == '\'')) { + /* got the start quote (remove it) but read remainder + * of quoted string as well into remainder of token */ + memmove(token, token+1, slen-1); + token[slen-1] = 0; + slen -= 1; + *quoted = 1; + /* rewind buffer over skipped whitespace */ + while(sldns_buffer_position(strbuf) > 0 && + (sldns_buffer_current(strbuf)[-1] == ' ' || + sldns_buffer_current(strbuf)[-1] == '\t')) { + sldns_buffer_skip(strbuf, -1); + } + if(sldns_bget_token_par(strbuf, token+slen, + "\"", token_len-slen, + parens, NULL) == -1) { + return 0; + } + slen = strlen(token); + } + *token_strlen = slen; + return 1; +} + +/** Add space and one more rdf token onto the existing token string. */ +static int +sldns_affix_token(sldns_buffer* strbuf, char* token, size_t* token_len, + int* quoted, int* parens, size_t* pre_data_pos, + const char* delimiters, sldns_rdf_type rdftype, size_t* token_strlen) +{ + size_t addlen = *token_len - *token_strlen; + size_t addstrlen = 0; + + /* add space */ + if(addlen < 1) return 0; + token[*token_strlen] = ' '; + token[++(*token_strlen)] = 0; + + /* read another token */ + addlen = *token_len - *token_strlen; + if(!sldns_parse_rdf_token(strbuf, token+*token_strlen, addlen, quoted, + parens, pre_data_pos, delimiters, rdftype, &addstrlen)) + return 0; + (*token_strlen) += addstrlen; + return 1; +} + +/** parse rdata from string into rr buffer(-remainder after dname). */ +static int +rrinternal_parse_rdata(sldns_buffer* strbuf, char* token, size_t token_len, + uint8_t* rr, size_t* rr_len, size_t dname_len, uint16_t rr_type, + uint8_t* origin, size_t origin_len) +{ + const sldns_rr_descriptor *desc = sldns_rr_descript((uint16_t)rr_type); + uint16_t r_cnt, r_min, r_max; + size_t rr_cur_len = dname_len + 10, pre_data_pos, token_strlen; + int was_unknown_rr_format = 0, parens = 0, status, quoted; + const char* delimiters; + sldns_rdf_type rdftype; + /* a desc is always returned */ + if(!desc) return LDNS_WIREPARSE_ERR_GENERAL; + r_max = sldns_rr_descriptor_maximum(desc); + r_min = sldns_rr_descriptor_minimum(desc); + /* robust check */ + if(rr_cur_len > *rr_len) + return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, + sldns_buffer_position(strbuf)); + + /* because number of fields can be variable, we can't rely on + * _maximum() only */ + for(r_cnt=0; r_cnt < r_max; r_cnt++) { + rdftype = sldns_rr_descriptor_field_type(desc, r_cnt); + delimiters = rrinternal_get_delims(rdftype, r_cnt, r_max); + quoted = rrinternal_get_quoted(strbuf, &delimiters, rdftype); + + if(!sldns_parse_rdf_token(strbuf, token, token_len, "ed, + &parens, &pre_data_pos, delimiters, rdftype, + &token_strlen)) + break; + + /* rfc3597 specifies that any type can be represented + * with \# method, which can contain spaces... + * it does specify size though... */ + + /* unknown RR data */ + if(token_strlen>=2 && strncmp(token, "\\#", 2) == 0 && + !quoted && (token_strlen == 2 || token[2]==' ')) { + was_unknown_rr_format = 1; + if((status=rrinternal_parse_unknown(strbuf, token, + token_len, rr, rr_len, &rr_cur_len, + pre_data_pos)) != 0) + return status; + } else if(token_strlen > 0 || quoted) { + if(rdftype == LDNS_RDF_TYPE_HIP) { + /* affix the HIT and PK fields, with a space */ + if(!sldns_affix_token(strbuf, token, + &token_len, "ed, &parens, + &pre_data_pos, delimiters, + rdftype, &token_strlen)) + break; + if(!sldns_affix_token(strbuf, token, + &token_len, "ed, &parens, + &pre_data_pos, delimiters, + rdftype, &token_strlen)) + break; + } + + /* normal RR */ + if((status=rrinternal_parse_rdf(strbuf, token, + token_len, rr, *rr_len, &rr_cur_len, rdftype, + rr_type, r_cnt, r_max, dname_len, origin, + origin_len)) != 0) { + return status; + } + } + } + if(!was_unknown_rr_format && r_cnt+1 < r_min) { + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_MISSING_VALUE, + sldns_buffer_position(strbuf)); + } + while(parens != 0) { + /* read remainder, must be "" */ + if(sldns_bget_token_par(strbuf, token, "\n", token_len, + &parens, " \t") == -1) { + if(parens != 0) + return RET_ERR(LDNS_WIREPARSE_ERR_PARENTHESIS, + sldns_buffer_position(strbuf)); + break; + } + if(strcmp(token, "") != 0) + return RET_ERR(LDNS_WIREPARSE_ERR_PARENTHESIS, + sldns_buffer_position(strbuf)); + } + /* write rdata length */ + sldns_write_uint16(rr+dname_len+8, rr_cur_len-dname_len-10); + *rr_len = rr_cur_len; + return LDNS_WIREPARSE_ERR_OK; +} + +/* + * trailing spaces are allowed + * leading spaces are not allowed + * allow ttl to be optional + * class is optional too + * if ttl is missing, and default_ttl is 0, use DEF_TTL + * allow ttl to be written as 1d3h + * So the RR should look like. e.g. + * miek.nl. 3600 IN MX 10 elektron.atoom.net + * or + * miek.nl. 1h IN MX 10 elektron.atoom.net + * or + * miek.nl. IN MX 10 elektron.atoom.net + */ +static int +sldns_str2wire_rr_buf_internal(const char* str, uint8_t* rr, size_t* len, + size_t* dname_len, uint32_t default_ttl, uint8_t* origin, + size_t origin_len, uint8_t* prev, size_t prev_len, int question) +{ + int status; + int not_there = 0; + char token[LDNS_MAX_RDFLEN+1]; + uint32_t ttl = 0; + uint16_t tp = 0, cl = 0; + size_t ddlen = 0; + + /* string in buffer */ + sldns_buffer strbuf; + sldns_buffer_init_frm_data(&strbuf, (uint8_t*)str, strlen(str)); + if(!dname_len) dname_len = &ddlen; + + /* parse the owner */ + if((status=rrinternal_get_owner(&strbuf, rr, len, dname_len, origin, + origin_len, prev, prev_len, token, sizeof(token))) != 0) + return status; + + /* parse the [ttl] [class] */ + if((status=rrinternal_get_ttl(&strbuf, token, sizeof(token), + ¬_there, &ttl, default_ttl)) != 0) + return status; + if((status=rrinternal_get_class(&strbuf, token, sizeof(token), + ¬_there, &cl)) != 0) + return status; + if((status=rrinternal_get_type(&strbuf, token, sizeof(token), + ¬_there, &tp)) != 0) + return status; + /* put ttl, class, type into the rr result */ + if((status=rrinternal_write_typeclassttl(&strbuf, rr, *len, *dname_len, tp, cl, + ttl, question)) != 0) + return status; + /* for a question-RR we are done, no rdata */ + if(question) { + *len = *dname_len + 4; + return LDNS_WIREPARSE_ERR_OK; + } + + /* rdata */ + if((status=rrinternal_parse_rdata(&strbuf, token, sizeof(token), + rr, len, *dname_len, tp, origin, origin_len)) != 0) + return status; + + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_rr_buf(const char* str, uint8_t* rr, size_t* len, + size_t* dname_len, uint32_t default_ttl, uint8_t* origin, + size_t origin_len, uint8_t* prev, size_t prev_len) +{ + return sldns_str2wire_rr_buf_internal(str, rr, len, dname_len, + default_ttl, origin, origin_len, prev, prev_len, 0); +} + +int sldns_str2wire_rr_question_buf(const char* str, uint8_t* rr, size_t* len, + size_t* dname_len, uint8_t* origin, size_t origin_len, uint8_t* prev, + size_t prev_len) +{ + return sldns_str2wire_rr_buf_internal(str, rr, len, dname_len, + 0, origin, origin_len, prev, prev_len, 1); +} + +uint16_t sldns_wirerr_get_type(uint8_t* rr, size_t len, size_t dname_len) +{ + if(len < dname_len+2) + return 0; + return sldns_read_uint16(rr+dname_len); +} + +uint16_t sldns_wirerr_get_class(uint8_t* rr, size_t len, size_t dname_len) +{ + if(len < dname_len+4) + return 0; + return sldns_read_uint16(rr+dname_len+2); +} + +uint32_t sldns_wirerr_get_ttl(uint8_t* rr, size_t len, size_t dname_len) +{ + if(len < dname_len+8) + return 0; + return sldns_read_uint32(rr+dname_len+4); +} + +uint16_t sldns_wirerr_get_rdatalen(uint8_t* rr, size_t len, size_t dname_len) +{ + if(len < dname_len+10) + return 0; + return sldns_read_uint16(rr+dname_len+8); +} + +uint8_t* sldns_wirerr_get_rdata(uint8_t* rr, size_t len, size_t dname_len) +{ + if(len < dname_len+10) + return NULL; + return rr+dname_len+10; +} + +uint8_t* sldns_wirerr_get_rdatawl(uint8_t* rr, size_t len, size_t dname_len) +{ + if(len < dname_len+10) + return NULL; + return rr+dname_len+8; +} + +const char* sldns_get_errorstr_parse(int e) +{ + sldns_lookup_table *lt; + lt = sldns_lookup_by_id(sldns_wireparse_errors, LDNS_WIREPARSE_ERROR(e)); + return lt?lt->name:"unknown error"; +} + +int sldns_fp2wire_rr_buf(FILE* in, uint8_t* rr, size_t* len, size_t* dname_len, + struct sldns_file_parse_state* parse_state) +{ + char line[LDNS_RR_BUF_SIZE+1]; + ssize_t size; + + /* read an entire line in from the file */ + if((size = sldns_fget_token_l(in, line, LDNS_PARSE_SKIP_SPACE, + LDNS_RR_BUF_SIZE, parse_state?&parse_state->lineno:NULL)) + == -1) { + /* if last line was empty, we are now at feof, which is not + * always a parse error (happens when for instance last line + * was a comment) + */ + return LDNS_WIREPARSE_ERR_SYNTAX; + } + + /* we can have the situation, where we've read ok, but still got + * no bytes to play with, in this case size is 0 */ + if(size == 0) { + *len = 0; + *dname_len = 0; + return LDNS_WIREPARSE_ERR_OK; + } + + if(strncmp(line, "$ORIGIN", 7) == 0 && isspace(line[7])) { + size_t off = 8; + int s; + *len = 0; + *dname_len = 0; + if(!parse_state) return LDNS_WIREPARSE_ERR_OK; + while(isspace(line[off])) + off++; + parse_state->origin_len = sizeof(parse_state->origin); + s = sldns_str2wire_dname_buf(line+off, parse_state->origin, + &parse_state->origin_len); + if(s) parse_state->origin_len = 0; + return s; + } else if(strncmp(line, "$TTL", 4) == 0 && isspace(line[4])) { + const char* end = NULL; + size_t off = 8; + *len = 0; + *dname_len = 0; + if(!parse_state) return LDNS_WIREPARSE_ERR_OK; + while(isspace(line[off])) + off++; + parse_state->default_ttl = sldns_str2period(line+off, &end); + } else if (strncmp(line, "$INCLUDE", 8) == 0) { + *len = 0; + *dname_len = 0; + return LDNS_WIREPARSE_ERR_INCLUDE; + } else { + return sldns_str2wire_rr_buf(line, rr, len, dname_len, + parse_state?parse_state->default_ttl:0, + (parse_state&&parse_state->origin_len)? + parse_state->origin:NULL, + parse_state->origin_len, + (parse_state&&parse_state->prev_rr_len)? + parse_state->prev_rr:NULL, + parse_state->prev_rr_len); + } + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_rdf_buf(const char* str, uint8_t* rd, size_t* len, + sldns_rdf_type rdftype) +{ + switch (rdftype) { + case LDNS_RDF_TYPE_DNAME: + return sldns_str2wire_dname_buf(str, rd, len); + case LDNS_RDF_TYPE_INT8: + return sldns_str2wire_int8_buf(str, rd, len); + case LDNS_RDF_TYPE_INT16: + return sldns_str2wire_int16_buf(str, rd, len); + case LDNS_RDF_TYPE_INT32: + return sldns_str2wire_int32_buf(str, rd, len); + case LDNS_RDF_TYPE_A: + return sldns_str2wire_a_buf(str, rd, len); + case LDNS_RDF_TYPE_AAAA: + return sldns_str2wire_aaaa_buf(str, rd, len); + case LDNS_RDF_TYPE_STR: + return sldns_str2wire_str_buf(str, rd, len); + case LDNS_RDF_TYPE_APL: + return sldns_str2wire_apl_buf(str, rd, len); + case LDNS_RDF_TYPE_B64: + return sldns_str2wire_b64_buf(str, rd, len); + case LDNS_RDF_TYPE_B32_EXT: + return sldns_str2wire_b32_ext_buf(str, rd, len); + case LDNS_RDF_TYPE_HEX: + return sldns_str2wire_hex_buf(str, rd, len); + case LDNS_RDF_TYPE_NSEC: + return sldns_str2wire_nsec_buf(str, rd, len); + case LDNS_RDF_TYPE_TYPE: + return sldns_str2wire_type_buf(str, rd, len); + case LDNS_RDF_TYPE_CLASS: + return sldns_str2wire_class_buf(str, rd, len); + case LDNS_RDF_TYPE_CERT_ALG: + return sldns_str2wire_cert_alg_buf(str, rd, len); + case LDNS_RDF_TYPE_ALG: + return sldns_str2wire_alg_buf(str, rd, len); + case LDNS_RDF_TYPE_TIME: + return sldns_str2wire_time_buf(str, rd, len); + case LDNS_RDF_TYPE_PERIOD: + return sldns_str2wire_period_buf(str, rd, len); + case LDNS_RDF_TYPE_LOC: + return sldns_str2wire_loc_buf(str, rd, len); + case LDNS_RDF_TYPE_WKS: + return sldns_str2wire_wks_buf(str, rd, len); + case LDNS_RDF_TYPE_NSAP: + return sldns_str2wire_nsap_buf(str, rd, len); + case LDNS_RDF_TYPE_ATMA: + return sldns_str2wire_atma_buf(str, rd, len); + case LDNS_RDF_TYPE_IPSECKEY: + return sldns_str2wire_ipseckey_buf(str, rd, len); + case LDNS_RDF_TYPE_NSEC3_SALT: + return sldns_str2wire_nsec3_salt_buf(str, rd, len); + case LDNS_RDF_TYPE_NSEC3_NEXT_OWNER: + return sldns_str2wire_b32_ext_buf(str, rd, len); + case LDNS_RDF_TYPE_ILNP64: + return sldns_str2wire_ilnp64_buf(str, rd, len); + case LDNS_RDF_TYPE_EUI48: + return sldns_str2wire_eui48_buf(str, rd, len); + case LDNS_RDF_TYPE_EUI64: + return sldns_str2wire_eui64_buf(str, rd, len); + case LDNS_RDF_TYPE_TAG: + return sldns_str2wire_tag_buf(str, rd, len); + case LDNS_RDF_TYPE_LONG_STR: + return sldns_str2wire_long_str_buf(str, rd, len); + case LDNS_RDF_TYPE_HIP: + return sldns_str2wire_hip_buf(str, rd, len); + case LDNS_RDF_TYPE_INT16_DATA: + return sldns_str2wire_int16_data_buf(str, rd, len); + case LDNS_RDF_TYPE_UNKNOWN: + case LDNS_RDF_TYPE_SERVICE: + return LDNS_WIREPARSE_ERR_NOT_IMPL; + case LDNS_RDF_TYPE_NONE: + default: + break; + } + return LDNS_WIREPARSE_ERR_GENERAL; +} + +int sldns_str2wire_int8_buf(const char* str, uint8_t* rd, size_t* len) +{ + char* end; + uint8_t r = (uint8_t)strtol((char*)str, &end, 10); + if(*end != 0) + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_INT, end-(char*)str); + if(*len < 1) + return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; + rd[0] = r; + *len = 1; + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_int16_buf(const char* str, uint8_t* rd, size_t* len) +{ + char* end; + uint16_t r = (uint16_t)strtol((char*)str, &end, 10); + if(*end != 0) + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_INT, end-(char*)str); + if(*len < 2) + return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; + sldns_write_uint16(rd, r); + *len = 2; + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_int32_buf(const char* str, uint8_t* rd, size_t* len) +{ + char* end; + uint32_t r; + errno = 0; /* must set to zero before call, + note race condition on errno */ + if(*str == '-') + r = (uint32_t)strtol((char*)str, &end, 10); + else r = (uint32_t)strtoul((char*)str, &end, 10); + if(*end != 0) + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_INT, end-(char*)str); + if(errno == ERANGE) + return LDNS_WIREPARSE_ERR_SYNTAX_INTEGER_OVERFLOW; + if(*len < 4) + return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; + sldns_write_uint32(rd, r); + *len = 4; + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_a_buf(const char* str, uint8_t* rd, size_t* len) +{ + struct in_addr address; + if(inet_pton(AF_INET, (char*)str, &address) != 1) + return LDNS_WIREPARSE_ERR_SYNTAX_IP4; + if(*len < sizeof(address)) + return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; + memmove(rd, &address, sizeof(address)); + *len = sizeof(address); + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_aaaa_buf(const char* str, uint8_t* rd, size_t* len) +{ +#ifdef AF_INET6 + uint8_t address[LDNS_IP6ADDRLEN + 1]; + if(inet_pton(AF_INET6, (char*)str, address) != 1) + return LDNS_WIREPARSE_ERR_SYNTAX_IP6; + if(*len < LDNS_IP6ADDRLEN) + return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; + memmove(rd, address, LDNS_IP6ADDRLEN); + *len = LDNS_IP6ADDRLEN; + return LDNS_WIREPARSE_ERR_OK; +#else + return LDNS_WIREPARSE_ERR_NOT_IMPL; +#endif +} + +int sldns_str2wire_str_buf(const char* str, uint8_t* rd, size_t* len) +{ + uint8_t ch = 0; + size_t sl = 0; + const char* s = str; + /* skip length byte */ + if(*len < 1) + return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; + + /* read characters */ + while(sldns_parse_char(&ch, &s)) { + if(sl >= 255) + return RET_ERR(LDNS_WIREPARSE_ERR_INVALID_STR, s-str); + if(*len < sl+1) + return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, + s-str); + rd[++sl] = ch; + } + if(!s) + return LDNS_WIREPARSE_ERR_SYNTAX_BAD_ESCAPE; + rd[0] = (uint8_t)sl; + *len = sl+1; + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_apl_buf(const char* str, uint8_t* rd, size_t* len) +{ + const char *my_str = str; + + char my_ip_str[64]; + size_t ip_str_len; + + uint16_t family; + int negation; + size_t adflength = 0; + uint8_t data[16+4]; + uint8_t prefix; + size_t i; + + if(strlen(my_str) == 0) { + /* empty APL element, no data, no string */ + *len = 0; + return LDNS_WIREPARSE_ERR_OK; + } + + /* [!]afi:address/prefix */ + if (strlen(my_str) < 2 + || strchr(my_str, ':') == NULL + || strchr(my_str, '/') == NULL + || strchr(my_str, ':') > strchr(my_str, '/')) { + return LDNS_WIREPARSE_ERR_INVALID_STR; + } + + if (my_str[0] == '!') { + negation = 1; + my_str += 1; + } else { + negation = 0; + } + + family = (uint16_t) atoi(my_str); + + my_str = strchr(my_str, ':') + 1; + + /* need ip addr and only ip addr for inet_pton */ + ip_str_len = (size_t) (strchr(my_str, '/') - my_str); + if(ip_str_len+1 > sizeof(my_ip_str)) + return LDNS_WIREPARSE_ERR_INVALID_STR; + (void)strlcpy(my_ip_str, my_str, sizeof(my_ip_str)); + my_ip_str[ip_str_len] = 0; + + if (family == 1) { + /* ipv4 */ + if(inet_pton(AF_INET, my_ip_str, data+4) == 0) + return LDNS_WIREPARSE_ERR_INVALID_STR; + for (i = 0; i < 4; i++) { + if (data[i+4] != 0) { + adflength = i + 1; + } + } + } else if (family == 2) { + /* ipv6 */ + if (inet_pton(AF_INET6, my_ip_str, data+4) == 0) + return LDNS_WIREPARSE_ERR_INVALID_STR; + for (i = 0; i < 16; i++) { + if (data[i+4] != 0) { + adflength = i + 1; + } + } + } else { + /* unknown family */ + return LDNS_WIREPARSE_ERR_INVALID_STR; + } + + my_str = strchr(my_str, '/') + 1; + prefix = (uint8_t) atoi(my_str); + + sldns_write_uint16(data, family); + data[2] = prefix; + data[3] = (uint8_t)adflength; + if (negation) { + /* set bit 1 of byte 3 */ + data[3] = data[3] | 0x80; + } + + if(*len < 4+adflength) + return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; + memmove(rd, data, 4+adflength); + *len = 4+adflength; + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_b64_buf(const char* str, uint8_t* rd, size_t* len) +{ + size_t sz = sldns_b64_pton_calculate_size(strlen(str)); + int n; + if(*len < sz) + return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; + n = sldns_b64_pton(str, rd, *len); + if(n < 0) + return LDNS_WIREPARSE_ERR_SYNTAX_B64; + *len = (size_t)n; + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_b32_ext_buf(const char* str, uint8_t* rd, size_t* len) +{ + size_t slen = strlen(str); + size_t sz = sldns_b32_pton_calculate_size(slen); + int n; + if(*len < 1+sz) + return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; + rd[0] = (uint8_t)sz; + n = sldns_b32_pton_extended_hex(str, slen, rd+1, *len-1); + if(n < 0) + return LDNS_WIREPARSE_ERR_SYNTAX_B32_EXT; + *len = (size_t)n+1; + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_hex_buf(const char* str, uint8_t* rd, size_t* len) +{ + const char* s = str; + size_t dlen = 0; /* number of hexdigits parsed */ + while(*s) { + if(isspace(*s)) { + s++; + continue; + } + if(!isxdigit(*s)) + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, s-str); + if(*len < dlen/2 + 1) + return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, + s-str); + if((dlen&1)==0) + rd[dlen/2] = (uint8_t)sldns_hexdigit_to_int(*s++) * 16; + else rd[dlen/2] += (uint8_t)sldns_hexdigit_to_int(*s++); + dlen++; + } + if((dlen&1)!=0) + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, s-str); + *len = dlen/2; + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_nsec_buf(const char* str, uint8_t* rd, size_t* len) +{ + const char *delim = "\n\t "; + char token[64]; /* for a type name */ + size_t type_count = 0; + int block; + size_t used = 0; + uint16_t maxtype = 0; + uint8_t typebits[8192]; /* 65536 bits */ + uint8_t window_in_use[256]; + + /* string in buffer */ + sldns_buffer strbuf; + sldns_buffer_init_frm_data(&strbuf, (uint8_t*)str, strlen(str)); + + /* parse the types */ + memset(typebits, 0, sizeof(typebits)); + memset(window_in_use, 0, sizeof(window_in_use)); + while(sldns_buffer_remaining(&strbuf) > 0 && + sldns_bget_token(&strbuf, token, delim, sizeof(token)) != -1) { + uint16_t t = sldns_get_rr_type_by_name(token); + if(token[0] == 0) + continue; + if(t == 0 && strcmp(token, "TYPE0") != 0) + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_TYPE, + sldns_buffer_position(&strbuf)); + typebits[t/8] |= (0x80>>(t%8)); + window_in_use[t/256] = 1; + type_count++; + if(t > maxtype) maxtype = t; + } + + /* empty NSEC bitmap */ + if(type_count == 0) { + *len = 0; + return LDNS_WIREPARSE_ERR_OK; + } + + /* encode windows {u8 windowblock, u8 bitmaplength, 0-32u8 bitmap}, + * block is 0-255 upper octet of types, length if 0-32. */ + for(block = 0; block <= (int)maxtype/256; block++) { + int i, blocklen = 0; + if(!window_in_use[block]) + continue; + for(i=0; i<32; i++) { + if(typebits[block*32+i] != 0) + blocklen = i+1; + } + if(blocklen == 0) + continue; /* empty window should have been !in_use */ + if(used+blocklen+2 > *len) + return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; + rd[used+0] = (uint8_t)block; + rd[used+1] = (uint8_t)blocklen; + for(i=0; iid); + } else { + int s = sldns_str2wire_int16_buf(str, rd, len); + if(s) return s; + if(sldns_read_uint16(rd) == 0) + return LDNS_WIREPARSE_ERR_CERT_BAD_ALGORITHM; + } + *len = 2; + return LDNS_WIREPARSE_ERR_OK; +} + +/* An alg field can either be specified as a 8 bits number + * or by its symbolic name. Handle both */ +int sldns_str2wire_alg_buf(const char* str, uint8_t* rd, size_t* len) +{ + sldns_lookup_table *lt = sldns_lookup_by_name(sldns_algorithms, str); + if(*len < 1) + return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; + if(lt) { + rd[0] = (uint8_t)lt->id; + *len = 1; + } else { + /* try as-is (a number) */ + return sldns_str2wire_int8_buf(str, rd, len); + } + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_time_buf(const char* str, uint8_t* rd, size_t* len) +{ + /* convert a time YYYYDDMMHHMMSS to wireformat */ + struct tm tm; + if(*len < 4) + return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; + + /* Try to scan the time... */ + memset(&tm, 0, sizeof(tm)); + if (strlen(str) == 14 && sscanf(str, "%4d%2d%2d%2d%2d%2d", + &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, + &tm.tm_min, &tm.tm_sec) == 6) { + tm.tm_year -= 1900; + tm.tm_mon--; + /* Check values */ + if (tm.tm_year < 70) + return LDNS_WIREPARSE_ERR_SYNTAX_TIME; + if (tm.tm_mon < 0 || tm.tm_mon > 11) + return LDNS_WIREPARSE_ERR_SYNTAX_TIME; + if (tm.tm_mday < 1 || tm.tm_mday > 31) + return LDNS_WIREPARSE_ERR_SYNTAX_TIME; + if (tm.tm_hour < 0 || tm.tm_hour > 23) + return LDNS_WIREPARSE_ERR_SYNTAX_TIME; + if (tm.tm_min < 0 || tm.tm_min > 59) + return LDNS_WIREPARSE_ERR_SYNTAX_TIME; + if (tm.tm_sec < 0 || tm.tm_sec > 59) + return LDNS_WIREPARSE_ERR_SYNTAX_TIME; + + sldns_write_uint32(rd, sldns_mktime_from_utc(&tm)); + } else { + /* handle it as 32 bits timestamp */ + char *end; + uint32_t l = (uint32_t)strtol((char*)str, &end, 10); + if(*end != 0) + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_TIME, + end-(char*)str); + sldns_write_uint32(rd, l); + } + *len = 4; + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_period_buf(const char* str, uint8_t* rd, size_t* len) +{ + const char* end; + uint32_t p = sldns_str2period(str, &end); + if(*end != 0) + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_PERIOD, end-str); + if(*len < 4) + return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; + sldns_write_uint32(rd, p); + *len = 4; + return LDNS_WIREPARSE_ERR_OK; +} + +/** read "[.][mM]" into mantissa exponent format for LOC type */ +static int +loc_parse_cm(char* my_str, char** endstr, uint8_t* m, uint8_t* e) +{ + uint32_t meters = 0, cm = 0, val; + while (isblank(*my_str)) { + my_str++; + } + meters = (uint32_t)strtol(my_str, &my_str, 10); + if (*my_str == '.') { + my_str++; + cm = (uint32_t)strtol(my_str, &my_str, 10); + } + if (meters >= 1) { + *e = 2; + val = meters; + } else { + *e = 0; + val = cm; + } + while(val >= 10) { + (*e)++; + val /= 10; + } + *m = (uint8_t)val; + + if (*e > 9) + return 0; + if (*my_str == 'm' || *my_str == 'M') { + my_str++; + } + *endstr = my_str; + return 1; +} + +int sldns_str2wire_loc_buf(const char* str, uint8_t* rd, size_t* len) +{ + uint32_t latitude = 0; + uint32_t longitude = 0; + uint32_t altitude = 0; + + uint32_t equator = (uint32_t)1<<31; /* 2**31 */ + + /* only support version 0 */ + uint32_t h = 0; + uint32_t m = 0; + uint8_t size_b = 1, size_e = 2; + uint8_t horiz_pre_b = 1, horiz_pre_e = 6; + uint8_t vert_pre_b = 1, vert_pre_e = 3; + + double s = 0.0; + int northerness; + int easterness; + + char *my_str = (char *) str; + + if (isdigit((int) *my_str)) { + h = (uint32_t) strtol(my_str, &my_str, 10); + } else { + return LDNS_WIREPARSE_ERR_INVALID_STR; + } + + while (isblank((int) *my_str)) { + my_str++; + } + + if (isdigit((int) *my_str)) { + m = (uint32_t) strtol(my_str, &my_str, 10); + } else if (*my_str == 'N' || *my_str == 'S') { + goto north; + } else { + return LDNS_WIREPARSE_ERR_INVALID_STR; + } + + while (isblank((int) *my_str)) { + my_str++; + } + + if (isdigit((int) *my_str)) { + s = strtod(my_str, &my_str); + } + + /* skip blanks before norterness */ + while (isblank((int) *my_str)) { + my_str++; + } + +north: + if (*my_str == 'N') { + northerness = 1; + } else if (*my_str == 'S') { + northerness = 0; + } else { + return LDNS_WIREPARSE_ERR_INVALID_STR; + } + + my_str++; + + /* store number */ + s = 1000.0 * s; + /* add a little to make floor in conversion a round */ + s += 0.0005; + latitude = (uint32_t) s; + latitude += 1000 * 60 * m; + latitude += 1000 * 60 * 60 * h; + if (northerness) { + latitude = equator + latitude; + } else { + latitude = equator - latitude; + } + while (isblank(*my_str)) { + my_str++; + } + + if (isdigit((int) *my_str)) { + h = (uint32_t) strtol(my_str, &my_str, 10); + } else { + return LDNS_WIREPARSE_ERR_INVALID_STR; + } + + while (isblank((int) *my_str)) { + my_str++; + } + + if (isdigit((int) *my_str)) { + m = (uint32_t) strtol(my_str, &my_str, 10); + } else if (*my_str == 'E' || *my_str == 'W') { + goto east; + } else { + return LDNS_WIREPARSE_ERR_INVALID_STR; + } + + while (isblank(*my_str)) { + my_str++; + } + + if (isdigit((int) *my_str)) { + s = strtod(my_str, &my_str); + } + + /* skip blanks before easterness */ + while (isblank(*my_str)) { + my_str++; + } + +east: + if (*my_str == 'E') { + easterness = 1; + } else if (*my_str == 'W') { + easterness = 0; + } else { + return LDNS_WIREPARSE_ERR_INVALID_STR; + } + + my_str++; + + /* store number */ + s *= 1000.0; + /* add a little to make floor in conversion a round */ + s += 0.0005; + longitude = (uint32_t) s; + longitude += 1000 * 60 * m; + longitude += 1000 * 60 * 60 * h; + + if (easterness) { + longitude += equator; + } else { + longitude = equator - longitude; + } + + altitude = (uint32_t)(strtod(my_str, &my_str)*100.0 + + 10000000.0 + 0.5); + if (*my_str == 'm' || *my_str == 'M') { + my_str++; + } + + if (strlen(my_str) > 0) { + if(!loc_parse_cm(my_str, &my_str, &size_b, &size_e)) + return LDNS_WIREPARSE_ERR_INVALID_STR; + } + + if (strlen(my_str) > 0) { + if(!loc_parse_cm(my_str, &my_str, &horiz_pre_b, &horiz_pre_e)) + return LDNS_WIREPARSE_ERR_INVALID_STR; + } + + if (strlen(my_str) > 0) { + if(!loc_parse_cm(my_str, &my_str, &vert_pre_b, &vert_pre_e)) + return LDNS_WIREPARSE_ERR_INVALID_STR; + } + + if(*len < 16) + return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; + rd[0] = 0; + rd[1] = ((size_b << 4) & 0xf0) | (size_e & 0x0f); + rd[2] = ((horiz_pre_b << 4) & 0xf0) | (horiz_pre_e & 0x0f); + rd[3] = ((vert_pre_b << 4) & 0xf0) | (vert_pre_e & 0x0f); + sldns_write_uint32(rd + 4, latitude); + sldns_write_uint32(rd + 8, longitude); + sldns_write_uint32(rd + 12, altitude); + *len = 16; + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_wks_buf(const char* str, uint8_t* rd, size_t* len) +{ + int rd_len = 1; + int have_proto = 0; + char token[50], proto_str[50]; + sldns_buffer strbuf; + sldns_buffer_init_frm_data(&strbuf, (uint8_t*)str, strlen(str)); + proto_str[0]=0; + + /* check we have one byte for proto */ + if(*len < 1) + return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; + + while(sldns_bget_token(&strbuf, token, "\t\n ", sizeof(token)) > 0) { + if(!have_proto) { + struct protoent *p = getprotobyname(token); + have_proto = 1; + if(p) rd[0] = (uint8_t)p->p_proto; + else rd[0] = (uint8_t)atoi(token); + (void)strlcpy(proto_str, token, sizeof(proto_str)); + } else { + int serv_port; + struct servent *serv = getservbyname(token, proto_str); + if(serv) serv_port=(int)ntohs((uint16_t)serv->s_port); + else { + serv_port = atoi(token); + if(serv_port == 0 && strcmp(token, "0") != 0) { +#ifdef HAVE_ENDSERVENT + endservent(); +#endif +#ifdef HAVE_ENDPROTOENT + endprotoent(); +#endif + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX, + sldns_buffer_position(&strbuf)); + } + if(serv_port < 0 || serv_port > 65535) { +#ifdef HAVE_ENDSERVENT + endservent(); +#endif +#ifdef HAVE_ENDPROTOENT + endprotoent(); +#endif + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX, + sldns_buffer_position(&strbuf)); + } + } + if(rd_len < 1+serv_port/8+1) { + /* bitmap is larger, init new bytes at 0 */ + if(*len < 1+(size_t)serv_port/8+1) { +#ifdef HAVE_ENDSERVENT + endservent(); +#endif +#ifdef HAVE_ENDPROTOENT + endprotoent(); +#endif + return RET_ERR( + LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, + sldns_buffer_position(&strbuf)); + } + memset(rd+rd_len, 0, 1+(size_t)serv_port/8+1-rd_len); + rd_len = 1+serv_port/8+1; + } + rd[1+ serv_port/8] |= (1 << (7 - serv_port % 8)); + } + } + *len = (size_t)rd_len; + +#ifdef HAVE_ENDSERVENT + endservent(); +#endif +#ifdef HAVE_ENDPROTOENT + endprotoent(); +#endif + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_nsap_buf(const char* str, uint8_t* rd, size_t* len) +{ + const char* s = str; + size_t slen; + size_t dlen = 0; /* number of hexdigits parsed */ + + /* just a hex string with optional dots? */ + if (s[0] != '0' || s[1] != 'x') + return LDNS_WIREPARSE_ERR_INVALID_STR; + s += 2; + slen = strlen(s); + if(slen > LDNS_MAX_RDFLEN*2) + return LDNS_WIREPARSE_ERR_LABEL_OVERFLOW; + while(*s) { + if(isspace(*s) || *s == '.') { + s++; + continue; + } + if(!isxdigit(*s)) + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, s-str); + if(*len < dlen/2 + 1) + return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, + s-str); + if((dlen&1)==0) + rd[dlen/2] = (uint8_t)sldns_hexdigit_to_int(*s++) * 16; + else rd[dlen/2] += sldns_hexdigit_to_int(*s++); + dlen++; + } + if((dlen&1)!=0) + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, s-str); + *len = dlen/2; + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_atma_buf(const char* str, uint8_t* rd, size_t* len) +{ + const char* s = str; + size_t slen = strlen(str); + size_t dlen = 0; /* number of hexdigits parsed */ + + /* just a hex string with optional dots? */ + /* notimpl e.164 format */ + if(slen > LDNS_MAX_RDFLEN*2) + return LDNS_WIREPARSE_ERR_LABEL_OVERFLOW; + while(*s) { + if(isspace(*s) || *s == '.') { + s++; + continue; + } + if(!isxdigit(*s)) + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, s-str); + if(*len < dlen/2 + 1) + return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, + s-str); + if((dlen&1)==0) + rd[dlen/2] = (uint8_t)sldns_hexdigit_to_int(*s++) * 16; + else rd[dlen/2] += sldns_hexdigit_to_int(*s++); + dlen++; + } + if((dlen&1)!=0) + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, s-str); + *len = dlen/2; + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_ipseckey_buf(const char* str, uint8_t* rd, size_t* len) +{ + size_t gwlen = 0, keylen = 0; + int s; + uint8_t gwtype; + char token[512]; + sldns_buffer strbuf; + sldns_buffer_init_frm_data(&strbuf, (uint8_t*)str, strlen(str)); + + if(*len < 3) + return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; + /* precedence */ + if(sldns_bget_token(&strbuf, token, "\t\n ", sizeof(token)) <= 0) + return RET_ERR(LDNS_WIREPARSE_ERR_INVALID_STR, + sldns_buffer_position(&strbuf)); + rd[0] = (uint8_t)atoi(token); + /* gateway_type */ + if(sldns_bget_token(&strbuf, token, "\t\n ", sizeof(token)) <= 0) + return RET_ERR(LDNS_WIREPARSE_ERR_INVALID_STR, + sldns_buffer_position(&strbuf)); + rd[1] = (uint8_t)atoi(token); + gwtype = rd[1]; + /* algorithm */ + if(sldns_bget_token(&strbuf, token, "\t\n ", sizeof(token)) <= 0) + return RET_ERR(LDNS_WIREPARSE_ERR_INVALID_STR, + sldns_buffer_position(&strbuf)); + rd[2] = (uint8_t)atoi(token); + + /* gateway */ + if(sldns_bget_token(&strbuf, token, "\t\n ", sizeof(token)) <= 0) + return RET_ERR(LDNS_WIREPARSE_ERR_INVALID_STR, + sldns_buffer_position(&strbuf)); + if(gwtype == 0) { + /* NOGATEWAY */ + if(strcmp(token, ".") != 0) + return RET_ERR(LDNS_WIREPARSE_ERR_INVALID_STR, + sldns_buffer_position(&strbuf)); + gwlen = 0; + } else if(gwtype == 1) { + /* IP4 */ + gwlen = *len - 3; + s = sldns_str2wire_a_buf(token, rd+3, &gwlen); + if(s) return RET_ERR_SHIFT(s, sldns_buffer_position(&strbuf)); + } else if(gwtype == 2) { + /* IP6 */ + gwlen = *len - 3; + s = sldns_str2wire_aaaa_buf(token, rd+3, &gwlen); + if(s) return RET_ERR_SHIFT(s, sldns_buffer_position(&strbuf)); + } else if(gwtype == 3) { + /* DNAME */ + gwlen = *len - 3; + s = sldns_str2wire_dname_buf(token, rd+3, &gwlen); + if(s) return RET_ERR_SHIFT(s, sldns_buffer_position(&strbuf)); + } else { + /* unknown gateway type */ + return RET_ERR(LDNS_WIREPARSE_ERR_INVALID_STR, + sldns_buffer_position(&strbuf)); + } + /* double check for size */ + if(*len < 3 + gwlen) + return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, + sldns_buffer_position(&strbuf)); + + /* publickey in remainder of strbuf */ + keylen = *len - 3 - gwlen; + s = sldns_str2wire_b64_buf((const char*)sldns_buffer_current(&strbuf), + rd+3+gwlen, &keylen); + if(s) return RET_ERR_SHIFT(s, sldns_buffer_position(&strbuf)); + + *len = 3 + gwlen + keylen; + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_nsec3_salt_buf(const char* str, uint8_t* rd, size_t* len) +{ + int i, salt_length_str = (int)strlen(str); + if (salt_length_str == 1 && str[0] == '-') { + salt_length_str = 0; + } else if (salt_length_str % 2 != 0) { + return LDNS_WIREPARSE_ERR_SYNTAX_HEX; + } + if (salt_length_str > 512) + return LDNS_WIREPARSE_ERR_SYNTAX_HEX; + if(*len < 1+(size_t)salt_length_str / 2) + return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; + rd[0] = (uint8_t) (salt_length_str / 2); + for (i = 0; i < salt_length_str; i += 2) { + if (isxdigit((int)str[i]) && isxdigit((int)str[i+1])) { + rd[1+i/2] = (uint8_t)(sldns_hexdigit_to_int(str[i])*16 + + sldns_hexdigit_to_int(str[i+1])); + } else { + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, i); + } + } + *len = 1 + (size_t)rd[0]; + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_ilnp64_buf(const char* str, uint8_t* rd, size_t* len) +{ + unsigned int a, b, c, d; + uint16_t shorts[4]; + int l; + if(*len < sizeof(shorts)) + return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; + + if (sscanf(str, "%4x:%4x:%4x:%4x%n", &a, &b, &c, &d, &l) != 4 || + l != (int)strlen(str) || /* more data to read */ + strpbrk(str, "+-") /* signed hexes */ + ) + return LDNS_WIREPARSE_ERR_SYNTAX_ILNP64; + shorts[0] = htons(a); + shorts[1] = htons(b); + shorts[2] = htons(c); + shorts[3] = htons(d); + memmove(rd, &shorts, sizeof(shorts)); + *len = sizeof(shorts); + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_eui48_buf(const char* str, uint8_t* rd, size_t* len) +{ + unsigned int a, b, c, d, e, f; + int l; + + if(*len < 6) + return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; + if (sscanf(str, "%2x-%2x-%2x-%2x-%2x-%2x%n", + &a, &b, &c, &d, &e, &f, &l) != 6 || + l != (int)strlen(str)) + return LDNS_WIREPARSE_ERR_SYNTAX_EUI48; + rd[0] = a; + rd[1] = b; + rd[2] = c; + rd[3] = d; + rd[4] = e; + rd[5] = f; + *len = 6; + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_eui64_buf(const char* str, uint8_t* rd, size_t* len) +{ + unsigned int a, b, c, d, e, f, g, h; + int l; + + if(*len < 8) + return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; + if (sscanf(str, "%2x-%2x-%2x-%2x-%2x-%2x-%2x-%2x%n", + &a, &b, &c, &d, &e, &f, &g, &h, &l) != 8 || + l != (int)strlen(str)) + return LDNS_WIREPARSE_ERR_SYNTAX_EUI64; + rd[0] = a; + rd[1] = b; + rd[2] = c; + rd[3] = d; + rd[4] = e; + rd[5] = f; + rd[6] = g; + rd[7] = h; + *len = 8; + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_tag_buf(const char* str, uint8_t* rd, size_t* len) +{ + size_t slen = strlen(str); + const char* ptr; + + if (slen > 255) + return LDNS_WIREPARSE_ERR_SYNTAX_TAG; + if(*len < slen+1) + return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; + for (ptr = str; *ptr; ptr++) { + if(!isalnum(*ptr)) + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_TAG, ptr-str); + } + rd[0] = slen; + memmove(rd+1, str, slen); + *len = slen+1; + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_long_str_buf(const char* str, uint8_t* rd, size_t* len) +{ + uint8_t ch = 0; + const char* pstr = str; + size_t length = 0; + + /* Fill data with parsed bytes */ + while (sldns_parse_char(&ch, &pstr)) { + if(*len < length+1) + return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; + rd[length++] = ch; + } + if(!pstr) + return LDNS_WIREPARSE_ERR_SYNTAX_BAD_ESCAPE; + *len = length; + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_hip_buf(const char* str, uint8_t* rd, size_t* len) +{ + char* s, *end; + int e; + size_t hitlen, pklen = 0; + /* presentation format: + * pk-algo HIThex pubkeybase64 + * wireformat: + * hitlen[1byte] pkalgo[1byte] pubkeylen[2byte] [hit] [pubkey] */ + if(*len < 4) + return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; + + /* read PK algorithm */ + rd[1] = (uint8_t)strtol((char*)str, &s, 10); + if(*s != ' ') + return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_INT, s-(char*)str); + s++; + while(*s == ' ') + s++; + + /* read HIT hex tag */ + /* zero terminate the tag (replace later) */ + end = strchr(s, ' '); + if(!end) return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX, s-(char*)str); + *end = 0; + hitlen = *len - 4; + if((e = sldns_str2wire_hex_buf(s, rd+4, &hitlen)) != 0) { + *end = ' '; + return RET_ERR_SHIFT(e, s-(char*)str); + } + if(hitlen > 255) { + *end = ' '; + return RET_ERR(LDNS_WIREPARSE_ERR_LABEL_OVERFLOW, s-(char*)str+255*2); + } + rd[0] = (uint8_t)hitlen; + *end = ' '; + s = end+1; + + /* read pubkey base64 sequence */ + pklen = *len - 4 - hitlen; + if((e = sldns_str2wire_b64_buf(s, rd+4+hitlen, &pklen)) != 0) + return RET_ERR_SHIFT(e, s-(char*)str); + if(pklen > 65535) + return RET_ERR(LDNS_WIREPARSE_ERR_LABEL_OVERFLOW, s-(char*)str+65535); + sldns_write_uint16(rd+2, pklen); + + *len = 4 + hitlen + pklen; + return LDNS_WIREPARSE_ERR_OK; +} + +int sldns_str2wire_int16_data_buf(const char* str, uint8_t* rd, size_t* len) +{ + size_t sz = sldns_b64_pton_calculate_size(strlen(str)); + int n; + if(*len < sz+2) + return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; + if(sz > 65535) + return LDNS_WIREPARSE_ERR_LABEL_OVERFLOW; + n = sldns_b64_pton(str, rd+2, (*len)-2); + if(n < 0) + return LDNS_WIREPARSE_ERR_SYNTAX_B64; + sldns_write_uint16(rd, (uint16_t)n); + *len = (size_t)n; + return LDNS_WIREPARSE_ERR_OK; +} diff --git a/contrib/unbound/ldns/str2wire.h b/contrib/unbound/ldns/str2wire.h new file mode 100644 index 00000000000..94c8933897c --- /dev/null +++ b/contrib/unbound/ldns/str2wire.h @@ -0,0 +1,541 @@ +/** + * str2wire.h - read txt presentation of RRs + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +/** + * \file + * + * Parses text to wireformat. + */ + +#ifndef LDNS_STR2WIRE_H +#define LDNS_STR2WIRE_H + +/* include rrdef for MAX_DOMAINLEN constant */ +#include + +#ifdef __cplusplus +extern "C" { +#endif +struct sldns_struct_lookup_table; + +/** buffer to read an RR, cannot be larger than 64K because of packet size */ +#define LDNS_RR_BUF_SIZE 65535 /* bytes */ +#define LDNS_DEFAULT_TTL 3600 + +/* + * To convert class and type to string see + * sldns_get_rr_class_by_name(str) + * sldns_get_rr_type_by_name(str) + * from rrdef.h + */ + +/** + * Convert text string into dname wireformat, mallocless, with user buffer. + * @param str: the text string with the domain name. + * @param buf: the result buffer, suggested size LDNS_MAX_DOMAINLEN+1 + * @param len: length of the buffer on input, length of the result on output. + * @return 0 on success, otherwise an error. + */ +int sldns_str2wire_dname_buf(const char* str, uint8_t* buf, size_t* len); + +/** + * Same as sldns_str2wire_dname_buf, but concatenates origin if the domain + * name is relative (does not end in '.'). + * @param str: the text string with the domain name. + * @param buf: the result buffer, suggested size LDNS_MAX_DOMAINLEN+1 + * @param len: length of the buffer on input, length of the result on output. + * @param origin: the origin to append or NULL (nothing is appended). + * @param origin_len: length of origin. + * @return 0 on success, otherwise an error. + */ +int sldns_str2wire_dname_buf_origin(const char* str, uint8_t* buf, size_t* len, + uint8_t* origin, size_t origin_len); + +/** + * Convert text string into dname wireformat + * @param str: the text string with the domain name. + * @param len: returned length of wireformat. + * @return wireformat dname (malloced) or NULL on failure. + */ +uint8_t* sldns_str2wire_dname(const char* str, size_t* len); + +/** + * Convert text RR to wireformat, with user buffer. + * @param str: the RR data in text presentation format. + * @param rr: the buffer where the result is stored into. This buffer has + * the wire-dname(uncompressed), type, class, ttl, rdatalen, rdata. + * These values are probably not aligned, and in network format. + * Use the sldns_wirerr_get_xxx functions to access them safely. + * buffer size LDNS_RR_BUF_SIZE is suggested. + * @param len: on input the length of the buffer, on output the amount of + * the buffer used for the rr. + * @param dname_len: if non-NULL, filled with the dname length as result. + * Because after the dname you find the type, class, ttl, rdatalen, rdata. + * @param default_ttl: TTL used if no TTL available. + * @param origin: used for origin dname (if not NULL) + * @param origin_len: length of origin. + * @param prev: used for prev_rr dname (if not NULL) + * @param prev_len: length of prev. + * @return 0 on success, an error on failure. + */ +int sldns_str2wire_rr_buf(const char* str, uint8_t* rr, size_t* len, + size_t* dname_len, uint32_t default_ttl, uint8_t* origin, + size_t origin_len, uint8_t* prev, size_t prev_len); + +/** + * Same as sldns_str2wire_rr_buf, but there is no rdata, it returns an RR + * with zero rdata and no ttl. It has name, type, class. + * You can access those with the sldns_wirerr_get_type and class functions. + * @param str: the RR data in text presentation format. + * @param rr: the buffer where the result is stored into. + * @param len: on input the length of the buffer, on output the amount of + * the buffer used for the rr. + * @param dname_len: if non-NULL, filled with the dname length as result. + * Because after the dname you find the type, class, ttl, rdatalen, rdata. + * @param origin: used for origin dname (if not NULL) + * @param origin_len: length of origin. + * @param prev: used for prev_rr dname (if not NULL) + * @param prev_len: length of prev. + * @return 0 on success, an error on failure. + */ +int sldns_str2wire_rr_question_buf(const char* str, uint8_t* rr, size_t* len, + size_t* dname_len, uint8_t* origin, size_t origin_len, uint8_t* prev, + size_t prev_len); + +/** + * Get the type of the RR. + * @param rr: the RR in wire format. + * @param len: rr length. + * @param dname_len: dname length to skip. + * @return type in host byteorder + */ +uint16_t sldns_wirerr_get_type(uint8_t* rr, size_t len, size_t dname_len); + +/** + * Get the class of the RR. + * @param rr: the RR in wire format. + * @param len: rr length. + * @param dname_len: dname length to skip. + * @return class in host byteorder + */ +uint16_t sldns_wirerr_get_class(uint8_t* rr, size_t len, size_t dname_len); + +/** + * Get the ttl of the RR. + * @param rr: the RR in wire format. + * @param len: rr length. + * @param dname_len: dname length to skip. + * @return ttl in host byteorder + */ +uint32_t sldns_wirerr_get_ttl(uint8_t* rr, size_t len, size_t dname_len); + +/** + * Get the rdata length of the RR. + * @param rr: the RR in wire format. + * @param len: rr length. + * @param dname_len: dname length to skip. + * @return rdata length in host byteorder + * If the rdata length is larger than the rr-len allows, it is truncated. + * So, that it is safe to read the data length returned + * from this function from the rdata pointer of sldns_wirerr_get_rdata. + */ +uint16_t sldns_wirerr_get_rdatalen(uint8_t* rr, size_t len, size_t dname_len); + +/** + * Get the rdata pointer of the RR. + * @param rr: the RR in wire format. + * @param len: rr length. + * @param dname_len: dname length to skip. + * @return rdata pointer + */ +uint8_t* sldns_wirerr_get_rdata(uint8_t* rr, size_t len, size_t dname_len); + +/** + * Get the rdata pointer of the RR. prefixed with rdata length. + * @param rr: the RR in wire format. + * @param len: rr length. + * @param dname_len: dname length to skip. + * @return pointer to rdatalength, followed by the rdata. + */ +uint8_t* sldns_wirerr_get_rdatawl(uint8_t* rr, size_t len, size_t dname_len); + +/** + * Parse result codes + */ +#define LDNS_WIREPARSE_MASK 0x0fff +#define LDNS_WIREPARSE_SHIFT 12 +#define LDNS_WIREPARSE_ERROR(e) ((e)&LDNS_WIREPARSE_MASK) +#define LDNS_WIREPARSE_OFFSET(e) (((e)&~LDNS_WIREPARSE_MASK)>>LDNS_WIREPARSE_SHIFT) +/* use lookuptable to get error string, sldns_wireparse_errors */ +#define LDNS_WIREPARSE_ERR_OK 0 +#define LDNS_WIREPARSE_ERR_GENERAL 342 +#define LDNS_WIREPARSE_ERR_DOMAINNAME_OVERFLOW 343 +#define LDNS_WIREPARSE_ERR_DOMAINNAME_UNDERFLOW 344 +#define LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL 345 +#define LDNS_WIREPARSE_ERR_LABEL_OVERFLOW 346 +#define LDNS_WIREPARSE_ERR_EMPTY_LABEL 347 +#define LDNS_WIREPARSE_ERR_SYNTAX_BAD_ESCAPE 348 +#define LDNS_WIREPARSE_ERR_SYNTAX 349 +#define LDNS_WIREPARSE_ERR_SYNTAX_TTL 350 +#define LDNS_WIREPARSE_ERR_SYNTAX_TYPE 351 +#define LDNS_WIREPARSE_ERR_SYNTAX_CLASS 352 +#define LDNS_WIREPARSE_ERR_SYNTAX_RDATA 353 +#define LDNS_WIREPARSE_ERR_SYNTAX_MISSING_VALUE 354 +#define LDNS_WIREPARSE_ERR_INVALID_STR 355 +#define LDNS_WIREPARSE_ERR_SYNTAX_B64 356 +#define LDNS_WIREPARSE_ERR_SYNTAX_B32_EXT 357 +#define LDNS_WIREPARSE_ERR_SYNTAX_HEX 358 +#define LDNS_WIREPARSE_ERR_CERT_BAD_ALGORITHM 359 +#define LDNS_WIREPARSE_ERR_SYNTAX_TIME 360 +#define LDNS_WIREPARSE_ERR_SYNTAX_PERIOD 361 +#define LDNS_WIREPARSE_ERR_SYNTAX_ILNP64 362 +#define LDNS_WIREPARSE_ERR_SYNTAX_EUI48 363 +#define LDNS_WIREPARSE_ERR_SYNTAX_EUI64 364 +#define LDNS_WIREPARSE_ERR_SYNTAX_TAG 365 +#define LDNS_WIREPARSE_ERR_NOT_IMPL 366 +#define LDNS_WIREPARSE_ERR_SYNTAX_INT 367 +#define LDNS_WIREPARSE_ERR_SYNTAX_IP4 368 +#define LDNS_WIREPARSE_ERR_SYNTAX_IP6 369 +#define LDNS_WIREPARSE_ERR_SYNTAX_INTEGER_OVERFLOW 370 +#define LDNS_WIREPARSE_ERR_INCLUDE 371 +#define LDNS_WIREPARSE_ERR_PARENTHESIS 372 + +/** + * Get reference to a constant string for the (parse) error. + * @param e: error return value + * @return string. + */ +const char* sldns_get_errorstr_parse(int e); + +/** + * wire parse state for parsing files + */ +struct sldns_file_parse_state { + /** the origin domain name, if len!=0. uncompressed wireformat */ + uint8_t origin[LDNS_MAX_DOMAINLEN+1]; + /** length of origin domain name, in bytes. 0 if not set. */ + size_t origin_len; + /** the previous domain name, if len!=0. uncompressed wireformat*/ + uint8_t prev_rr[LDNS_MAX_DOMAINLEN+1]; + /** length of the previous domain name, in bytes. 0 if not set. */ + size_t prev_rr_len; + /** default TTL, this is used if the text does not specify a TTL, + * host byteorder */ + uint32_t default_ttl; + /** line number information */ + int lineno; +}; + +/** + * Read one RR from zonefile with buffer for the data. + * @param in: file that is read from (one RR, multiple lines if it spans them). + * @param rr: this is malloced by the user and the result is stored here, + * if an RR is read. If no RR is read this is signalled with the + * return len set to 0 (for ORIGIN, TTL directives). + * @param len: on input, the length of the rr buffer. on output the rr len. + * Buffer size of 64k should be enough. + * @param dname_len: returns the length of the dname initial part of the rr. + * @param parse_state: pass a pointer to user-allocated struct. + * Contents are maintained by this function. + * If you pass NULL then ORIGIN and TTL directives are not honored. + * You can start out with a particular origin by pre-filling it. + * otherwise, zero the structure before passing it. + * lineno is incremented when a newline is passed by the parser, + * you should initialize it at 1 at the start of the file. + * @return 0 on success, error on failure. + */ +int sldns_fp2wire_rr_buf(FILE* in, uint8_t* rr, size_t* len, size_t* dname_len, + struct sldns_file_parse_state* parse_state); + +/** + * Convert one rdf in rdata to wireformat and parse from string. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @param rdftype: the type of the rdf. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_rdf_buf(const char* str, uint8_t* rd, size_t* len, + sldns_rdf_type rdftype); + +/** + * Convert rdf of type LDNS_RDF_TYPE_INT8 from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_int8_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_INT16 from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_int16_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_INT32 from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_int32_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_A from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_a_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_AAAA from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_aaaa_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_STR from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_str_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_APL from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_apl_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_B64 from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_b64_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_B32_EXT from string to wireformat. + * And also LDNS_RDF_TYPE_NSEC3_NEXT_OWNER. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_b32_ext_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_HEX from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_hex_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_NSEC from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_nsec_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_TYPE from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_type_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_CLASS from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_class_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_CERT_ALG from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_cert_alg_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_ALG from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_alg_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_TIME from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_time_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_PERIOD from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_period_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_LOC from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_loc_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_WKS from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_wks_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_NSAP from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_nsap_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_ATMA from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_atma_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_IPSECKEY from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_ipseckey_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_NSEC3_SALT from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_nsec3_salt_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_ILNP64 from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_ilnp64_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_EUI48 from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_eui48_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_EUI64 from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_eui64_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_TAG from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_tag_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_LONG_STR from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_long_str_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_HIP from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_hip_buf(const char* str, uint8_t* rd, size_t* len); + +/** + * Convert rdf of type LDNS_RDF_TYPE_INT16_DATA from string to wireformat. + * @param str: the text to convert for this rdata element. + * @param rd: rdata buffer for the wireformat. + * @param len: length of rd buffer on input, used length on output. + * @return 0 on success, error on failure. + */ +int sldns_str2wire_int16_data_buf(const char* str, uint8_t* rd, size_t* len); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_STR2WIRE_H */ diff --git a/contrib/unbound/ldns/wire2str.c b/contrib/unbound/ldns/wire2str.c new file mode 100644 index 00000000000..c2a1850ef9b --- /dev/null +++ b/contrib/unbound/ldns/wire2str.c @@ -0,0 +1,1967 @@ +/* + * wire2str.c + * + * conversion routines from the wire format + * to the presentation format (strings) + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ +/** + * \file + * + * Contains functions to translate the wireformat to text + * representation, as well as functions to print them. + */ +#include "config.h" +#include "ldns/wire2str.h" +#include "ldns/str2wire.h" +#include "ldns/rrdef.h" +#include "ldns/pkthdr.h" +#include "ldns/parseutil.h" +#include "ldns/sbuffer.h" +#include "ldns/keyraw.h" +#ifdef HAVE_TIME_H +#include +#endif +#include +#include +#include +#ifdef HAVE_NETDB_H +#include +#endif + +/* lookup tables for standard DNS stuff */ +/* Taken from RFC 2535, section 7. */ +static sldns_lookup_table sldns_algorithms_data[] = { + { LDNS_RSAMD5, "RSAMD5" }, + { LDNS_DH, "DH" }, + { LDNS_DSA, "DSA" }, + { LDNS_ECC, "ECC" }, + { LDNS_RSASHA1, "RSASHA1" }, + { LDNS_DSA_NSEC3, "DSA-NSEC3-SHA1" }, + { LDNS_RSASHA1_NSEC3, "RSASHA1-NSEC3-SHA1" }, + { LDNS_RSASHA256, "RSASHA256"}, + { LDNS_RSASHA512, "RSASHA512"}, + { LDNS_ECC_GOST, "ECC-GOST"}, + { LDNS_ECDSAP256SHA256, "ECDSAP256SHA256"}, + { LDNS_ECDSAP384SHA384, "ECDSAP384SHA384"}, + { LDNS_INDIRECT, "INDIRECT" }, + { LDNS_PRIVATEDNS, "PRIVATEDNS" }, + { LDNS_PRIVATEOID, "PRIVATEOID" }, + { 0, NULL } +}; +sldns_lookup_table* sldns_algorithms = sldns_algorithms_data; + +/* hash algorithms in DS record */ +static sldns_lookup_table sldns_hashes_data[] = { + { LDNS_SHA1, "SHA1" }, + { LDNS_SHA256, "SHA256" }, + { LDNS_HASH_GOST, "HASH-GOST" }, + { LDNS_SHA384, "SHA384" }, + { 0, NULL } +}; +sldns_lookup_table* sldns_hashes = sldns_hashes_data; + +/* Taken from RFC 4398 */ +static sldns_lookup_table sldns_cert_algorithms_data[] = { + { LDNS_CERT_PKIX, "PKIX" }, + { LDNS_CERT_SPKI, "SPKI" }, + { LDNS_CERT_PGP, "PGP" }, + { LDNS_CERT_IPKIX, "IPKIX" }, + { LDNS_CERT_ISPKI, "ISPKI" }, + { LDNS_CERT_IPGP, "IPGP" }, + { LDNS_CERT_ACPKIX, "ACPKIX" }, + { LDNS_CERT_IACPKIX, "IACPKIX" }, + { LDNS_CERT_URI, "URI" }, + { LDNS_CERT_OID, "OID" }, + { 0, NULL } +}; +sldns_lookup_table* sldns_cert_algorithms = sldns_cert_algorithms_data; + +/* if these are used elsewhere */ +static sldns_lookup_table sldns_rcodes_data[] = { + { LDNS_RCODE_NOERROR, "NOERROR" }, + { LDNS_RCODE_FORMERR, "FORMERR" }, + { LDNS_RCODE_SERVFAIL, "SERVFAIL" }, + { LDNS_RCODE_NXDOMAIN, "NXDOMAIN" }, + { LDNS_RCODE_NOTIMPL, "NOTIMPL" }, + { LDNS_RCODE_REFUSED, "REFUSED" }, + { LDNS_RCODE_YXDOMAIN, "YXDOMAIN" }, + { LDNS_RCODE_YXRRSET, "YXRRSET" }, + { LDNS_RCODE_NXRRSET, "NXRRSET" }, + { LDNS_RCODE_NOTAUTH, "NOTAUTH" }, + { LDNS_RCODE_NOTZONE, "NOTZONE" }, + { 0, NULL } +}; +sldns_lookup_table* sldns_rcodes = sldns_rcodes_data; + +static sldns_lookup_table sldns_opcodes_data[] = { + { LDNS_PACKET_QUERY, "QUERY" }, + { LDNS_PACKET_IQUERY, "IQUERY" }, + { LDNS_PACKET_STATUS, "STATUS" }, + { LDNS_PACKET_NOTIFY, "NOTIFY" }, + { LDNS_PACKET_UPDATE, "UPDATE" }, + { 0, NULL } +}; +sldns_lookup_table* sldns_opcodes = sldns_opcodes_data; + +static sldns_lookup_table sldns_wireparse_errors_data[] = { + { LDNS_WIREPARSE_ERR_OK, "no parse error" }, + { LDNS_WIREPARSE_ERR_GENERAL, "parse error" }, + { LDNS_WIREPARSE_ERR_DOMAINNAME_OVERFLOW, "Domainname length overflow" }, + { LDNS_WIREPARSE_ERR_DOMAINNAME_UNDERFLOW, "Domainname length underflow (zero length)" }, + { LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, "buffer too small" }, + { LDNS_WIREPARSE_ERR_LABEL_OVERFLOW, "Label length overflow" }, + { LDNS_WIREPARSE_ERR_EMPTY_LABEL, "Empty label" }, + { LDNS_WIREPARSE_ERR_SYNTAX_BAD_ESCAPE, "Syntax error, bad escape sequence" }, + { LDNS_WIREPARSE_ERR_SYNTAX, "Syntax error, could not parse the RR" }, + { LDNS_WIREPARSE_ERR_SYNTAX_TTL, "Syntax error, could not parse the RR's TTL" }, + { LDNS_WIREPARSE_ERR_SYNTAX_TYPE, "Syntax error, could not parse the RR's type" }, + { LDNS_WIREPARSE_ERR_SYNTAX_CLASS, "Syntax error, could not parse the RR's class" }, + { LDNS_WIREPARSE_ERR_SYNTAX_RDATA, "Syntax error, could not parse the RR's rdata" }, + { LDNS_WIREPARSE_ERR_SYNTAX_MISSING_VALUE, "Syntax error, value expected" }, + { LDNS_WIREPARSE_ERR_INVALID_STR, "Conversion error, string expected" }, + { LDNS_WIREPARSE_ERR_SYNTAX_B64, "Conversion error, b64 encoding expected" }, + { LDNS_WIREPARSE_ERR_SYNTAX_B32_EXT, "Conversion error, b32 ext encoding expected" }, + { LDNS_WIREPARSE_ERR_SYNTAX_HEX, "Conversion error, hex encoding expected" }, + { LDNS_WIREPARSE_ERR_CERT_BAD_ALGORITHM, "Bad algorithm type for CERT record" }, + { LDNS_WIREPARSE_ERR_SYNTAX_TIME, "Conversion error, time encoding expected" }, + { LDNS_WIREPARSE_ERR_SYNTAX_PERIOD, "Conversion error, time period encoding expected" }, + { LDNS_WIREPARSE_ERR_SYNTAX_ILNP64, "Conversion error, 4 colon separated hex numbers expected" }, + { LDNS_WIREPARSE_ERR_SYNTAX_EUI48, + "Conversion error, 6 two character hex numbers " + "separated by dashes expected (i.e. xx-xx-xx-xx-xx-xx" }, + { LDNS_WIREPARSE_ERR_SYNTAX_EUI64, + "Conversion error, 8 two character hex numbers " + "separated by dashes expected (i.e. xx-xx-xx-xx-xx-xx-xx-xx" }, + { LDNS_WIREPARSE_ERR_SYNTAX_TAG, + "Conversion error, a non-zero sequence of US-ASCII letters " + "and numbers in lower case expected" }, + { LDNS_WIREPARSE_ERR_NOT_IMPL, "not implemented" }, + { LDNS_WIREPARSE_ERR_SYNTAX_INT, "Conversion error, integer expected" }, + { LDNS_WIREPARSE_ERR_SYNTAX_IP4, "Conversion error, ip4 addr expected" }, + { LDNS_WIREPARSE_ERR_SYNTAX_IP6, "Conversion error, ip6 addr expected" }, + { LDNS_WIREPARSE_ERR_SYNTAX_INTEGER_OVERFLOW, "Syntax error, integer overflow" }, + { LDNS_WIREPARSE_ERR_INCLUDE, "$INCLUDE directive was seen in the zone" }, + { LDNS_WIREPARSE_ERR_PARENTHESIS, "Parse error, parenthesis mismatch" }, + { 0, NULL } +}; +sldns_lookup_table* sldns_wireparse_errors = sldns_wireparse_errors_data; + +static sldns_lookup_table sldns_edns_flags_data[] = { + { 3600, "do"}, + { 0, NULL} +}; +sldns_lookup_table* sldns_edns_flags = sldns_edns_flags_data; + +static sldns_lookup_table sldns_edns_options_data[] = { + { 1, "LLQ" }, + { 2, "UL" }, + { 3, "NSID" }, + /* 4 draft-cheshire-edns0-owner-option */ + { 5, "DAU" }, + { 6, "DHU" }, + { 7, "N3U" }, + { 8, "edns-client-subnet" }, + { 0, NULL} +}; +sldns_lookup_table* sldns_edns_options = sldns_edns_options_data; + +char* sldns_wire2str_pkt(uint8_t* data, size_t len) +{ + size_t slen = (size_t)sldns_wire2str_pkt_buf(data, len, NULL, 0); + char* result = (char*)malloc(slen+1); + if(!result) return NULL; + sldns_wire2str_pkt_buf(data, len, result, slen+1); + return result; +} + +char* sldns_wire2str_rr(uint8_t* rr, size_t len) +{ + size_t slen = (size_t)sldns_wire2str_rr_buf(rr, len, NULL, 0); + char* result = (char*)malloc(slen+1); + if(!result) return NULL; + sldns_wire2str_rr_buf(rr, len, result, slen+1); + return result; +} + +char* sldns_wire2str_type(uint16_t rrtype) +{ + char buf[16]; + sldns_wire2str_type_buf(rrtype, buf, sizeof(buf)); + return strdup(buf); +} + +char* sldns_wire2str_class(uint16_t rrclass) +{ + char buf[16]; + sldns_wire2str_class_buf(rrclass, buf, sizeof(buf)); + return strdup(buf); +} + +char* sldns_wire2str_dname(uint8_t* dname, size_t dname_len) +{ + size_t slen=(size_t)sldns_wire2str_dname_buf(dname, dname_len, NULL, 0); + char* result = (char*)malloc(slen+1); + if(!result) return NULL; + sldns_wire2str_dname_buf(dname, dname_len, result, slen+1); + return result; +} + +char* sldns_wire2str_rcode(int rcode) +{ + char buf[16]; + sldns_wire2str_rcode_buf(rcode, buf, sizeof(buf)); + return strdup(buf); +} + +int sldns_wire2str_pkt_buf(uint8_t* d, size_t dlen, char* s, size_t slen) +{ + /* use arguments as temporary variables */ + return sldns_wire2str_pkt_scan(&d, &dlen, &s, &slen); +} + +int sldns_wire2str_rr_buf(uint8_t* d, size_t dlen, char* s, size_t slen) +{ + /* use arguments as temporary variables */ + return sldns_wire2str_rr_scan(&d, &dlen, &s, &slen, NULL, 0); +} + +int sldns_wire2str_rdata_buf(uint8_t* rdata, size_t rdata_len, char* str, + size_t str_len, uint16_t rrtype) +{ + /* use arguments as temporary variables */ + return sldns_wire2str_rdata_scan(&rdata, &rdata_len, &str, &str_len, + rrtype, NULL, 0); +} + +int sldns_wire2str_rr_unknown_buf(uint8_t* d, size_t dlen, char* s, size_t slen) +{ + /* use arguments as temporary variables */ + return sldns_wire2str_rr_unknown_scan(&d, &dlen, &s, &slen, NULL, 0); +} + +int sldns_wire2str_rr_comment_buf(uint8_t* rr, size_t rrlen, size_t dname_len, + char* s, size_t slen) +{ + uint16_t rrtype = sldns_wirerr_get_type(rr, rrlen, dname_len); + return sldns_wire2str_rr_comment_print(&s, &slen, rr, rrlen, dname_len, + rrtype); +} + +int sldns_wire2str_type_buf(uint16_t rrtype, char* s, size_t slen) +{ + /* use arguments as temporary variables */ + return sldns_wire2str_type_print(&s, &slen, rrtype); +} + +int sldns_wire2str_class_buf(uint16_t rrclass, char* s, size_t slen) +{ + /* use arguments as temporary variables */ + return sldns_wire2str_class_print(&s, &slen, rrclass); +} + +int sldns_wire2str_rcode_buf(int rcode, char* s, size_t slen) +{ + /* use arguments as temporary variables */ + return sldns_wire2str_rcode_print(&s, &slen, rcode); +} + +int sldns_wire2str_dname_buf(uint8_t* d, size_t dlen, char* s, size_t slen) +{ + /* use arguments as temporary variables */ + return sldns_wire2str_dname_scan(&d, &dlen, &s, &slen, NULL, 0); +} + +int sldns_str_vprint(char** str, size_t* slen, const char* format, va_list args) +{ + int w = vsnprintf(*str, *slen, format, args); + if(w < 0) { + /* error in printout */ + return 0; + } else if((size_t)w >= *slen) { + *str = NULL; /* we do not want str to point outside of buffer*/ + *slen = 0; + } else { + *str += w; + *slen -= w; + } + return w; +} + +int sldns_str_print(char** str, size_t* slen, const char* format, ...) +{ + int w; + va_list args; + va_start(args, format); + w = sldns_str_vprint(str, slen, format, args); + va_end(args); + return w; +} + +/** print hex format into text buffer for specified length */ +static int print_hex_buf(char** s, size_t* slen, uint8_t* buf, size_t len) +{ + const char* hex = "0123456789ABCDEF"; + size_t i; + for(i=0; i>4], + hex[buf[i]&0x0f]); + } + return (int)len*2; +} + +/** print remainder of buffer in hex format with prefixed text */ +static int print_remainder_hex(const char* pref, uint8_t** d, size_t* dlen, + char** s, size_t* slen) +{ + int w = 0; + w += sldns_str_print(s, slen, "%s", pref); + w += print_hex_buf(s, slen, *d, *dlen); + *d += *dlen; + *dlen = 0; + return w; +} + +int sldns_wire2str_pkt_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen) +{ + int w = 0; + unsigned qdcount, ancount, nscount, arcount, i; + uint8_t* pkt = *d; + size_t pktlen = *dlen; + if(*dlen >= LDNS_HEADER_SIZE) { + qdcount = (unsigned)LDNS_QDCOUNT(*d); + ancount = (unsigned)LDNS_ANCOUNT(*d); + nscount = (unsigned)LDNS_NSCOUNT(*d); + arcount = (unsigned)LDNS_ARCOUNT(*d); + } else { + qdcount = ancount = nscount = arcount = 0; + } + w += sldns_wire2str_header_scan(d, dlen, s, slen); + w += sldns_str_print(s, slen, "\n"); + w += sldns_str_print(s, slen, ";; QUESTION SECTION:\n"); + for(i=0; i 0) { + w += print_remainder_hex(";; trailing garbage 0x", + d, dlen, s, slen); + w += sldns_str_print(s, slen, "\n"); + } + return w; +} + +/** scan type, class and ttl and printout, for rr */ +static int sldns_rr_tcttl_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + int w = 0; + uint16_t t, c; + uint32_t ttl; + if(*dl < 8) { + if(*dl < 4) + return w + print_remainder_hex("; Error malformed 0x", + d, dl, s, sl); + /* these print values or 0x.. if none left */ + t = sldns_read_uint16(*d); + c = sldns_read_uint16((*d)+2); + (*d)+=4; + (*dl)-=4; + w += sldns_wire2str_class_print(s, sl, c); + w += sldns_str_print(s, sl, "\t"); + w += sldns_wire2str_type_print(s, sl, t); + if(*dl == 0) + return w + sldns_str_print(s, sl, "; Error no ttl"); + return w + print_remainder_hex( + "; Error malformed ttl 0x", d, dl, s, sl); + } + t = sldns_read_uint16(*d); + c = sldns_read_uint16((*d)+2); + ttl = sldns_read_uint32((*d)+4); + (*d)+=8; + (*dl)-=8; + w += sldns_str_print(s, sl, "%lu\t", (unsigned long)ttl); + w += sldns_wire2str_class_print(s, sl, c); + w += sldns_str_print(s, sl, "\t"); + w += sldns_wire2str_type_print(s, sl, t); + return w; +} + +int sldns_wire2str_rr_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen, + uint8_t* pkt, size_t pktlen) +{ + int w = 0; + uint8_t* rr = *d; + size_t rrlen = *dlen, dname_off, rdlen, ordlen; + uint16_t rrtype = 0; + + if(*dlen >= 3 && (*d)[0]==0 && + sldns_read_uint16((*d)+1)==LDNS_RR_TYPE_OPT) { + /* perform EDNS OPT processing */ + return sldns_wire2str_edns_scan(d, dlen, s, slen, pkt, pktlen); + } + + /* try to scan the rdata with pretty-printing, but if that fails, then + * scan the rdata as an unknown RR type */ + w += sldns_wire2str_dname_scan(d, dlen, s, slen, pkt, pktlen); + w += sldns_str_print(s, slen, "\t"); + dname_off = rrlen-(*dlen); + if(*dlen == 4) { + /* like a question-RR */ + uint16_t t = sldns_read_uint16(*d); + uint16_t c = sldns_read_uint16((*d)+2); + (*d)+=4; + (*dlen)-=4; + w += sldns_wire2str_class_print(s, slen, c); + w += sldns_str_print(s, slen, "\t"); + w += sldns_wire2str_type_print(s, slen, t); + w += sldns_str_print(s, slen, " ; Error no ttl,rdata\n"); + return w; + } + if(*dlen < 8) { + if(*dlen == 0) + return w + sldns_str_print(s, slen, ";Error missing RR\n"); + w += print_remainder_hex(";Error partial RR 0x", d, dlen, s, slen); + return w + sldns_str_print(s, slen, "\n"); + } + rrtype = sldns_read_uint16(*d); + w += sldns_rr_tcttl_scan(d, dlen, s, slen); + w += sldns_str_print(s, slen, "\t"); + + /* rdata */ + if(*dlen < 2) { + if(*dlen == 0) + return w + sldns_str_print(s, slen, ";Error missing rdatalen\n"); + w += print_remainder_hex(";Error missing rdatalen 0x", + d, dlen, s, slen); + return w + sldns_str_print(s, slen, "\n"); + } + rdlen = sldns_read_uint16(*d); + ordlen = rdlen; + (*d)+=2; + (*dlen)-=2; + if(*dlen < rdlen) { + w += sldns_str_print(s, slen, "\\# %u ", (unsigned)rdlen); + if(*dlen == 0) + return w + sldns_str_print(s, slen, ";Error missing rdata\n"); + w += print_remainder_hex(";Error partial rdata 0x", d, dlen, s, slen); + return w + sldns_str_print(s, slen, "\n"); + } + w += sldns_wire2str_rdata_scan(d, &rdlen, s, slen, rrtype, pkt, pktlen); + (*dlen) -= (ordlen-rdlen); + + /* default comment */ + w += sldns_wire2str_rr_comment_print(s, slen, rr, rrlen, dname_off, + rrtype); + w += sldns_str_print(s, slen, "\n"); + return w; +} + +int sldns_wire2str_rrquestion_scan(uint8_t** d, size_t* dlen, char** s, + size_t* slen, uint8_t* pkt, size_t pktlen) +{ + int w = 0; + uint16_t t, c; + w += sldns_wire2str_dname_scan(d, dlen, s, slen, pkt, pktlen); + w += sldns_str_print(s, slen, "\t"); + if(*dlen < 4) { + if(*dlen == 0) + return w + sldns_str_print(s, slen, "Error malformed\n"); + w += print_remainder_hex("Error malformed 0x", d, dlen, s, slen); + return w + sldns_str_print(s, slen, "\n"); + } + t = sldns_read_uint16(*d); + c = sldns_read_uint16((*d)+2); + (*d)+=4; + (*dlen)-=4; + w += sldns_wire2str_class_print(s, slen, c); + w += sldns_str_print(s, slen, "\t"); + w += sldns_wire2str_type_print(s, slen, t); + w += sldns_str_print(s, slen, "\n"); + return w; +} + +int sldns_wire2str_rr_unknown_scan(uint8_t** d, size_t* dlen, char** s, + size_t* slen, uint8_t* pkt, size_t pktlen) +{ + size_t rdlen, ordlen; + int w = 0; + w += sldns_wire2str_dname_scan(d, dlen, s, slen, pkt, pktlen); + w += sldns_str_print(s, slen, "\t"); + w += sldns_rr_tcttl_scan(d, dlen, s, slen); + w += sldns_str_print(s, slen, "\t"); + if(*dlen < 2) { + if(*dlen == 0) + return w + sldns_str_print(s, slen, ";Error missing rdatalen\n"); + w += print_remainder_hex(";Error missing rdatalen 0x", + d, dlen, s, slen); + return w + sldns_str_print(s, slen, "\n"); + } + rdlen = sldns_read_uint16(*d); + ordlen = rdlen; + (*d) += 2; + (*dlen) -= 2; + if(*dlen < rdlen) { + w += sldns_str_print(s, slen, "\\# %u ", (unsigned)rdlen); + if(*dlen == 0) + return w + sldns_str_print(s, slen, ";Error missing rdata\n"); + w += print_remainder_hex(";Error partial rdata 0x", d, dlen, s, slen); + return w + sldns_str_print(s, slen, "\n"); + } + w += sldns_wire2str_rdata_unknown_scan(d, &rdlen, s, slen); + (*dlen) -= (ordlen-rdlen); + w += sldns_str_print(s, slen, "\n"); + return w; +} + +/** print rr comment for type DNSKEY */ +static int rr_comment_dnskey(char** s, size_t* slen, uint8_t* rr, + size_t rrlen, size_t dname_off) +{ + size_t rdlen; + uint8_t* rdata; + int flags, w = 0; + if(rrlen < dname_off + 10) return 0; + rdlen = sldns_read_uint16(rr+dname_off+8); + if(rrlen < dname_off + 10 + rdlen) return 0; + rdata = rr + dname_off + 10; + flags = (int)sldns_read_uint16(rdata); + w += sldns_str_print(s, slen, " ;{"); + + /* id */ + w += sldns_str_print(s, slen, "id = %u", + sldns_calc_keytag_raw(rdata, rdlen)); + + /* flags */ + if((flags&LDNS_KEY_ZONE_KEY)) { + if((flags&LDNS_KEY_SEP_KEY)) + w += sldns_str_print(s, slen, " (ksk)"); + else w += sldns_str_print(s, slen, " (zsk)"); + } + + /* keysize */ + if(rdlen > 4) { + w += sldns_str_print(s, slen, ", "); + w += sldns_str_print(s, slen, "size = %db", + (int)sldns_rr_dnskey_key_size_raw( + (unsigned char*)rdata+4, rdlen-4, (int)(rdata[3]))); + } + + w += sldns_str_print(s, slen, "}"); + return w; +} + +/** print rr comment for type RRSIG */ +static int rr_comment_rrsig(char** s, size_t* slen, uint8_t* rr, + size_t rrlen, size_t dname_off) +{ + size_t rdlen; + uint8_t* rdata; + if(rrlen < dname_off + 10) return 0; + rdlen = sldns_read_uint16(rr+dname_off+8); + if(rrlen < dname_off + 10 + rdlen) return 0; + rdata = rr + dname_off + 10; + if(rdlen < 18) return 0; + return sldns_str_print(s, slen, " ;{id = %d}", + (int)sldns_read_uint16(rdata+16)); +} + +/** print rr comment for type NSEC3 */ +static int rr_comment_nsec3(char** s, size_t* slen, uint8_t* rr, + size_t rrlen, size_t dname_off) +{ + size_t rdlen; + uint8_t* rdata; + int w = 0; + if(rrlen < dname_off + 10) return 0; + rdlen = sldns_read_uint16(rr+dname_off+8); + if(rrlen < dname_off + 10 + rdlen) return 0; + rdata = rr + dname_off + 10; + if(rdlen < 2) return 0; + if((rdata[1] & LDNS_NSEC3_VARS_OPTOUT_MASK)) + w += sldns_str_print(s, slen, " ;{flags: optout}"); + return w; +} + +int sldns_wire2str_rr_comment_print(char** s, size_t* slen, uint8_t* rr, + size_t rrlen, size_t dname_off, uint16_t rrtype) +{ + if(rrtype == LDNS_RR_TYPE_DNSKEY) { + return rr_comment_dnskey(s, slen, rr, rrlen, dname_off); + } else if(rrtype == LDNS_RR_TYPE_RRSIG) { + return rr_comment_rrsig(s, slen, rr, rrlen, dname_off); + } else if(rrtype == LDNS_RR_TYPE_NSEC3) { + return rr_comment_nsec3(s, slen, rr, rrlen, dname_off); + } + return 0; +} + +int sldns_wire2str_header_scan(uint8_t** d, size_t* dlen, char** s, + size_t* slen) +{ + int w = 0; + int opcode, rcode; + w += sldns_str_print(s, slen, ";; ->>HEADER<<- "); + if(*dlen == 0) + return w+sldns_str_print(s, slen, "Error empty packet"); + if(*dlen < 4) + return w+print_remainder_hex("Error header too short 0x", d, dlen, s, slen); + opcode = (int)LDNS_OPCODE_WIRE(*d); + rcode = (int)LDNS_RCODE_WIRE(*d); + w += sldns_str_print(s, slen, "opcode: "); + w += sldns_wire2str_opcode_print(s, slen, opcode); + w += sldns_str_print(s, slen, ", "); + w += sldns_str_print(s, slen, "rcode: "); + w += sldns_wire2str_rcode_print(s, slen, rcode); + w += sldns_str_print(s, slen, ", "); + w += sldns_str_print(s, slen, "id: %d\n", (int)LDNS_ID_WIRE(*d)); + w += sldns_str_print(s, slen, ";; flags:"); + if(LDNS_QR_WIRE(*d)) w += sldns_str_print(s, slen, " qr"); + if(LDNS_AA_WIRE(*d)) w += sldns_str_print(s, slen, " aa"); + if(LDNS_TC_WIRE(*d)) w += sldns_str_print(s, slen, " tc"); + if(LDNS_RD_WIRE(*d)) w += sldns_str_print(s, slen, " rd"); + if(LDNS_CD_WIRE(*d)) w += sldns_str_print(s, slen, " cd"); + if(LDNS_RA_WIRE(*d)) w += sldns_str_print(s, slen, " ra"); + if(LDNS_AD_WIRE(*d)) w += sldns_str_print(s, slen, " ad"); + if(LDNS_Z_WIRE(*d)) w += sldns_str_print(s, slen, " z"); + w += sldns_str_print(s, slen, " ; "); + if(*dlen < LDNS_HEADER_SIZE) + return w+print_remainder_hex("Error header too short 0x", d, dlen, s, slen); + w += sldns_str_print(s, slen, "QUERY: %d, ", (int)LDNS_QDCOUNT(*d)); + w += sldns_str_print(s, slen, "ANSWER: %d, ", (int)LDNS_ANCOUNT(*d)); + w += sldns_str_print(s, slen, "AUTHORITY: %d, ", (int)LDNS_NSCOUNT(*d)); + w += sldns_str_print(s, slen, "ADDITIONAL: %d ", (int)LDNS_ARCOUNT(*d)); + *d += LDNS_HEADER_SIZE; + *dlen -= LDNS_HEADER_SIZE; + return w; +} + +int sldns_wire2str_rdata_scan(uint8_t** d, size_t* dlen, char** s, + size_t* slen, uint16_t rrtype, uint8_t* pkt, size_t pktlen) +{ + /* try to prettyprint, but if that fails, use unknown format */ + uint8_t* origd = *d; + char* origs = *s; + size_t origdlen = *dlen, origslen = *slen; + uint16_t r_cnt, r_max; + sldns_rdf_type rdftype; + int w = 0, n; + + const sldns_rr_descriptor *desc = sldns_rr_descript(rrtype); + if(!desc) /* unknown format */ + return sldns_wire2str_rdata_unknown_scan(d, dlen, s, slen); + /* dlen equals the rdatalen for the rdata */ + + r_max = sldns_rr_descriptor_maximum(desc); + for(r_cnt=0; r_cnt < r_max; r_cnt++) { + if(*dlen == 0) { + if(r_cnt < sldns_rr_descriptor_minimum(desc)) + goto failed; + break; /* nothing more to print */ + } + rdftype = sldns_rr_descriptor_field_type(desc, r_cnt); + if(r_cnt != 0) + w += sldns_str_print(s, slen, " "); + n = sldns_wire2str_rdf_scan(d, dlen, s, slen, rdftype, + pkt, pktlen); + if(n == -1) { + failed: + /* failed, use unknown format */ + *d = origd; *s = origs; + *dlen = origdlen; *slen = origslen; + return sldns_wire2str_rdata_unknown_scan(d, dlen, + s, slen); + } + w += n; + } + return w; +} + +int sldns_wire2str_rdata_unknown_scan(uint8_t** d, size_t* dlen, char** s, + size_t* slen) +{ + int w = 0; + + /* print length */ + w += sldns_str_print(s, slen, "\\# %u", (unsigned)*dlen); + + /* print rdlen in hex */ + if(*dlen != 0) + w += sldns_str_print(s, slen, " "); + w += print_hex_buf(s, slen, *d, *dlen); + (*d) += *dlen; + (*dlen) = 0; + return w; +} + +/** print and escape one character for a domain dname */ +static int dname_char_print(char** s, size_t* slen, uint8_t c) +{ + if(c == '.' || c == ';' || c == '(' || c == ')' || c == '\\') + return sldns_str_print(s, slen, "\\%c", c); + else if(!(isascii((int)c) && isgraph((int)c))) + return sldns_str_print(s, slen, "\\%03u", (unsigned)c); + /* plain printout */ + if(*slen) { + **s = (char)c; + (*s)++; + (*slen)--; + } + return 1; +} + +int sldns_wire2str_dname_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen, + uint8_t* pkt, size_t pktlen) +{ + int w = 0; + /* spool labels onto the string, use compression if its there */ + uint8_t* pos = *d; + unsigned i, counter=0; + const unsigned maxcompr = 1000; /* loop detection, max compr ptrs */ + int in_buf = 1; + if(*dlen == 0) return sldns_str_print(s, slen, "ErrorMissingDname"); + if(*pos == 0) { + (*d)++; + (*dlen)--; + return sldns_str_print(s, slen, "."); + } + while(*pos) { + /* read label length */ + uint8_t labellen = *pos++; + if(in_buf) { (*d)++; (*dlen)--; } + + /* find out what sort of label we have */ + if((labellen&0xc0) == 0xc0) { + /* compressed */ + uint16_t target = 0; + if(in_buf && *dlen == 0) + return w + sldns_str_print(s, slen, + "ErrorPartialDname"); + else if(!in_buf && pos+1 > pkt+pktlen) + return w + sldns_str_print(s, slen, + "ErrorPartialDname"); + target = ((labellen&0x3f)<<8) | *pos; + if(in_buf) { (*d)++; (*dlen)--; } + /* move to target, if possible */ + if(!pkt || target >= pktlen) + return w + sldns_str_print(s, slen, + "ErrorComprPtrOutOfBounds"); + if(counter++ > maxcompr) + return w + sldns_str_print(s, slen, + "ErrorComprPtrLooped"); + in_buf = 0; + pos = pkt+target; + continue; + } else if((labellen&0xc0)) { + /* notimpl label type */ + w += sldns_str_print(s, slen, + "ErrorLABELTYPE%xIsUnknown", + (int)(labellen&0xc0)); + return w; + } + + /* spool label characters, end with '.' */ + if(in_buf && *dlen < labellen) labellen = *dlen; + else if(!in_buf && pos+labellen > pkt+pktlen) + labellen = (uint8_t)(pkt + pktlen - pos); + for(i=0; i<(unsigned)labellen; i++) { + w += dname_char_print(s, slen, *pos++); + } + if(in_buf) { + (*d) += labellen; + (*dlen) -= labellen; + if(*dlen == 0) break; + } + w += sldns_str_print(s, slen, "."); + } + /* skip over final root label */ + if(in_buf && *dlen > 0) { (*d)++; (*dlen)--; } + /* in case we printed no labels, terminate dname */ + if(w == 0) w += sldns_str_print(s, slen, "."); + return w; +} + +int sldns_wire2str_opcode_print(char** s, size_t* slen, int opcode) +{ + sldns_lookup_table *lt = sldns_lookup_by_id(sldns_opcodes, opcode); + if (lt && lt->name) { + return sldns_str_print(s, slen, "%s", lt->name); + } + return sldns_str_print(s, slen, "OPCODE%u", (unsigned)opcode); +} + +int sldns_wire2str_rcode_print(char** s, size_t* slen, int rcode) +{ + sldns_lookup_table *lt = sldns_lookup_by_id(sldns_rcodes, rcode); + if (lt && lt->name) { + return sldns_str_print(s, slen, "%s", lt->name); + } + return sldns_str_print(s, slen, "RCODE%u", (unsigned)rcode); +} + +int sldns_wire2str_class_print(char** s, size_t* slen, uint16_t rrclass) +{ + sldns_lookup_table *lt = sldns_lookup_by_id(sldns_rr_classes, + (int)rrclass); + if (lt && lt->name) { + return sldns_str_print(s, slen, "%s", lt->name); + } + return sldns_str_print(s, slen, "CLASS%u", (unsigned)rrclass); +} + +int sldns_wire2str_type_print(char** s, size_t* slen, uint16_t rrtype) +{ + const sldns_rr_descriptor *descriptor = sldns_rr_descript(rrtype); + if (descriptor && descriptor->_name) { + return sldns_str_print(s, slen, "%s", descriptor->_name); + } + return sldns_str_print(s, slen, "TYPE%u", (unsigned)rrtype); +} + +int sldns_wire2str_edns_option_code_print(char** s, size_t* slen, + uint16_t opcode) +{ + sldns_lookup_table *lt = sldns_lookup_by_id(sldns_edns_options, + (int)opcode); + if (lt && lt->name) { + return sldns_str_print(s, slen, "%s", lt->name); + } + return sldns_str_print(s, slen, "OPT%u", (unsigned)opcode); +} + +int sldns_wire2str_class_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen) +{ + uint16_t c; + if(*dlen == 0) return 0; + if(*dlen < 2) return print_remainder_hex("Error malformed 0x", d, dlen, s, slen); + c = sldns_read_uint16(*d); + (*d)+=2; + (*dlen)-=2; + return sldns_wire2str_class_print(s, slen, c); +} + +int sldns_wire2str_type_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen) +{ + uint16_t t; + if(*dlen == 0) return 0; + if(*dlen < 2) return print_remainder_hex("Error malformed 0x", d, dlen, s, slen); + t = sldns_read_uint16(*d); + (*d)+=2; + (*dlen)-=2; + return sldns_wire2str_type_print(s, slen, t); +} + +int sldns_wire2str_ttl_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen) +{ + uint32_t ttl; + if(*dlen == 0) return 0; + if(*dlen < 4) return print_remainder_hex("Error malformed 0x", d, dlen, s, slen); + ttl = sldns_read_uint32(*d); + (*d)+=4; + (*dlen)-=4; + return sldns_str_print(s, slen, "%u", (unsigned)ttl); +} + +int sldns_wire2str_rdf_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen, + int rdftype, uint8_t* pkt, size_t pktlen) +{ + if(*dlen == 0) return 0; + switch(rdftype) { + case LDNS_RDF_TYPE_NONE: + return 0; + case LDNS_RDF_TYPE_DNAME: + return sldns_wire2str_dname_scan(d, dlen, s, slen, pkt, pktlen); + case LDNS_RDF_TYPE_INT8: + return sldns_wire2str_int8_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_INT16: + return sldns_wire2str_int16_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_INT32: + return sldns_wire2str_int32_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_PERIOD: + return sldns_wire2str_period_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_TSIGTIME: + return sldns_wire2str_tsigtime_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_A: + return sldns_wire2str_a_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_AAAA: + return sldns_wire2str_aaaa_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_STR: + return sldns_wire2str_str_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_APL: + return sldns_wire2str_apl_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_B32_EXT: + return sldns_wire2str_b32_ext_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_B64: + return sldns_wire2str_b64_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_HEX: + return sldns_wire2str_hex_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_NSEC: + return sldns_wire2str_nsec_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_NSEC3_SALT: + return sldns_wire2str_nsec3_salt_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_TYPE: + return sldns_wire2str_type_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_CLASS: + return sldns_wire2str_class_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_CERT_ALG: + return sldns_wire2str_cert_alg_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_ALG: + return sldns_wire2str_alg_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_UNKNOWN: + return sldns_wire2str_unknown_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_TIME: + return sldns_wire2str_time_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_LOC: + return sldns_wire2str_loc_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_WKS: + case LDNS_RDF_TYPE_SERVICE: + return sldns_wire2str_wks_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_NSAP: + return sldns_wire2str_nsap_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_ATMA: + return sldns_wire2str_atma_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_IPSECKEY: + return sldns_wire2str_ipseckey_scan(d, dlen, s, slen, pkt, + pktlen); + case LDNS_RDF_TYPE_HIP: + return sldns_wire2str_hip_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_INT16_DATA: + return sldns_wire2str_int16_data_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_NSEC3_NEXT_OWNER: + return sldns_wire2str_b32_ext_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_ILNP64: + return sldns_wire2str_ilnp64_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_EUI48: + return sldns_wire2str_eui48_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_EUI64: + return sldns_wire2str_eui64_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_TAG: + return sldns_wire2str_tag_scan(d, dlen, s, slen); + case LDNS_RDF_TYPE_LONG_STR: + return sldns_wire2str_long_str_scan(d, dlen, s, slen); + } + /* unknown rdf type */ + return -1; +} + +int sldns_wire2str_int8_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + int w; + if(*dl < 1) return -1; + w = sldns_str_print(s, sl, "%u", (unsigned)**d); + (*d)++; + (*dl)--; + return w; +} + +int sldns_wire2str_int16_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + int w; + if(*dl < 2) return -1; + w = sldns_str_print(s, sl, "%lu", (unsigned long)sldns_read_uint16(*d)); + (*d)+=2; + (*dl)-=2; + return w; +} + +int sldns_wire2str_int32_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + int w; + if(*dl < 4) return -1; + w = sldns_str_print(s, sl, "%lu", (unsigned long)sldns_read_uint32(*d)); + (*d)+=4; + (*dl)-=4; + return w; +} + +int sldns_wire2str_period_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + int w; + if(*dl < 4) return -1; + w = sldns_str_print(s, sl, "%u", (unsigned)sldns_read_uint32(*d)); + (*d)+=4; + (*dl)-=4; + return w; +} + +int sldns_wire2str_tsigtime_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + /* tsigtime is 48 bits network order unsigned integer */ + int w; + uint64_t tsigtime = 0; + uint64_t d0, d1, d2, d3, d4, d5; + if(*dl < 6) return -1; + d0 = (*d)[0]; /* cast to uint64 for shift operations */ + d1 = (*d)[1]; + d2 = (*d)[2]; + d3 = (*d)[3]; + d4 = (*d)[4]; + d5 = (*d)[5]; + tsigtime = (d0<<40) | (d1<<32) | (d2<<24) | (d3<<16) | (d4<<8) | d5; +#ifndef USE_WINSOCK + w = sldns_str_print(s, sl, "%llu", (long long)tsigtime); +#else + w = sldns_str_print(s, sl, "%I64u", (long long)tsigtime); +#endif + (*d)+=6; + (*dl)-=6; + return w; +} + +int sldns_wire2str_a_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + char buf[32]; + int w; + if(*dl < 4) return -1; + if(!inet_ntop(AF_INET, *d, buf, (socklen_t)sizeof(buf))) + return -1; + w = sldns_str_print(s, sl, "%s", buf); + (*d)+=4; + (*dl)-=4; + return w; +} + +int sldns_wire2str_aaaa_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ +#ifdef AF_INET6 + char buf[64]; + int w; + if(*dl < 16) return -1; + if(!inet_ntop(AF_INET6, *d, buf, (socklen_t)sizeof(buf))) + return -1; + w = sldns_str_print(s, sl, "%s", buf); + (*d)+=16; + (*dl)-=16; + return w; +#else + return -1; +#endif +} + +/** printout escaped TYPE_STR character */ +static int str_char_print(char** s, size_t* sl, uint8_t c) +{ + if(isprint((int)c) || c == '\t') { + if(c == '\"' || c == '\\') + return sldns_str_print(s, sl, "\\%c", c); + if(*sl) { + **s = (char)c; + (*s)++; + (*sl)--; + } + return 1; + } + return sldns_str_print(s, sl, "\\%03u", (unsigned)c); +} + +int sldns_wire2str_str_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + int w = 0; + size_t i, len; + if(*dl < 1) return -1; + len = **d; + if(*dl < 1+len) return -1; + (*d)++; + (*dl)--; + w += sldns_str_print(s, sl, "\""); + for(i=0; i 0) + w += sldns_str_print(s, sl, "."); + if(i < (int)adflength) + w += sldns_str_print(s, sl, "%d", (*d)[4+i]); + else w += sldns_str_print(s, sl, "0"); + } + } else if(family == LDNS_APL_IP6) { + /* check if prefix <128 ? */ + /* address is variable length 0 - 16 */ + for(i=0; i<16; i++) { + if(i%2 == 0 && i>0) + w += sldns_str_print(s, sl, ":"); + if(i < (int)adflength) + w += sldns_str_print(s, sl, "%02x", (*d)[4+i]); + else w += sldns_str_print(s, sl, "00"); + } + } + w += sldns_str_print(s, sl, "/%u", (unsigned)prefix); + (*d) += 4+adflength; + (*dl) -= 4+adflength; + return w; +} + +int sldns_wire2str_b32_ext_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + size_t datalen; + size_t sz; + if(*dl < 1) return -1; + datalen = (*d)[0]; + if(*dl < 1+datalen) return -1; + sz = sldns_b32_ntop_calculate_size(datalen); + if(*sl < sz+1) { + (*d) += datalen+1; + (*dl) -= (datalen+1); + return (int)sz; /* out of space really, but would need buffer + in order to truncate the output */ + } + sldns_b32_ntop_extended_hex((*d)+1, datalen, *s, *sl); + (*d) += datalen+1; + (*dl) -= (datalen+1); + (*s) += sz; + (*sl) -= sz; + return (int)sz; +} + +/** scan number of bytes from wire into b64 presentation format */ +static int sldns_wire2str_b64_scan_num(uint8_t** d, size_t* dl, char** s, + size_t* sl, size_t num) +{ + /* b64_ntop_calculate size includes null at the end */ + size_t sz = sldns_b64_ntop_calculate_size(num)-1; + if(*sl < sz+1) { + (*d) += num; + (*dl) -= num; + return (int)sz; /* out of space really, but would need buffer + in order to truncate the output */ + } + sldns_b64_ntop(*d, num, *s, *sl); + (*d) += num; + (*dl) -= num; + (*s) += sz; + (*sl) -= sz; + return (int)sz; +} + +int sldns_wire2str_b64_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + return sldns_wire2str_b64_scan_num(d, dl, s, sl, *dl); +} + +int sldns_wire2str_hex_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + return print_remainder_hex("", d, dl, s, sl); +} + +int sldns_wire2str_nsec_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + uint8_t* p = *d; + size_t pl = *dl; + unsigned i, bit, window, block_len; + uint16_t t; + int w = 0; + + /* check for errors */ + while(pl) { + if(pl < 2) return -1; + block_len = (unsigned)p[1]; + if(pl < 2+block_len) return -1; + p += block_len+2; + pl -= block_len+2; + } + + /* do it */ + p = *d; + pl = *dl; + while(pl) { + if(pl < 2) return -1; /* cannot happen */ + window = (unsigned)p[0]; + block_len = (unsigned)p[1]; + if(pl < 2+block_len) return -1; /* cannot happen */ + p += 2; + for(i=0; i>bit))) { + if(w) w += sldns_str_print(s, sl, " "); + w += sldns_wire2str_type_print(s, sl, + t+bit); + } + } + } + p += block_len; + pl -= block_len+2; + } + (*d) += *dl; + (*dl) = 0; + return w; +} + +int sldns_wire2str_nsec3_salt_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + size_t salt_len; + int w; + if(*dl < 1) return -1; + salt_len = (size_t)(*d)[0]; + if(*dl < 1+salt_len) return -1; + (*d)++; + (*dl)--; + if(salt_len == 0) { + return sldns_str_print(s, sl, "-"); + } + w = print_hex_buf(s, sl, *d, salt_len); + (*dl)-=salt_len; + (*d)+=salt_len; + return w; +} + +int sldns_wire2str_cert_alg_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + sldns_lookup_table *lt; + int data, w; + if(*dl < 2) return -1; + data = (int)sldns_read_uint16(*d); + lt = sldns_lookup_by_id(sldns_cert_algorithms, data); + if(lt && lt->name) + w = sldns_str_print(s, sl, "%s", lt->name); + else w = sldns_str_print(s, sl, "%d", data); + (*dl)-=2; + (*d)+=2; + return w; +} + +int sldns_wire2str_alg_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + /* don't use algorithm mnemonics in the presentation format + * this kind of got sneaked into the rfc's */ + return sldns_wire2str_int8_scan(d, dl, s, sl); +} + +int sldns_wire2str_unknown_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + return sldns_wire2str_rdata_unknown_scan(d, dl, s, sl); +} + +int sldns_wire2str_time_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + /* create a YYYYMMDDHHMMSS string if possible */ + struct tm tm; + char date_buf[16]; + uint32_t t; + memset(&tm, 0, sizeof(tm)); + if(*dl < 4) return -1; + t = sldns_read_uint32(*d); + date_buf[15]=0; + if(sldns_serial_arithmitics_gmtime_r(t, time(NULL), &tm) && + strftime(date_buf, 15, "%Y%m%d%H%M%S", &tm)) { + (*d) += 4; + (*dl) -= 4; + return sldns_str_print(s, sl, "%s", date_buf); + } + return -1; +} + +static int +loc_cm_print(char** str, size_t* sl, uint8_t mantissa, uint8_t exponent) +{ + int w = 0; + uint8_t i; + /* is it 0. ? */ + if(exponent < 2) { + if(exponent == 1) + mantissa *= 10; + return sldns_str_print(str, sl, "0.%02ld", (long)mantissa); + } + /* always */ + w += sldns_str_print(str, sl, "%d", (int)mantissa); + for(i=0; i equator) { + northerness = 'N'; + latitude = latitude - equator; + } else { + northerness = 'S'; + latitude = equator - latitude; + } + h = latitude / (1000 * 60 * 60); + latitude = latitude % (1000 * 60 * 60); + m = latitude / (1000 * 60); + latitude = latitude % (1000 * 60); + s = (double) latitude / 1000.0; + w += sldns_str_print(str, sl, "%02u %02u %06.3f %c ", + h, m, s, northerness); + + if (longitude > equator) { + easterness = 'E'; + longitude = longitude - equator; + } else { + easterness = 'W'; + longitude = equator - longitude; + } + h = longitude / (1000 * 60 * 60); + longitude = longitude % (1000 * 60 * 60); + m = longitude / (1000 * 60); + longitude = longitude % (1000 * 60); + s = (double) longitude / (1000.0); + w += sldns_str_print(str, sl, "%02u %02u %06.3f %c ", + h, m, s, easterness); + + s = ((double) altitude) / 100; + s -= 100000; + + if(altitude%100 != 0) + w += sldns_str_print(str, sl, "%.2f", s); + else + w += sldns_str_print(str, sl, "%.0f", s); + + w += sldns_str_print(str, sl, "m "); + + w += loc_cm_print(str, sl, (size & 0xf0) >> 4, size & 0x0f); + w += sldns_str_print(str, sl, "m "); + + w += loc_cm_print(str, sl, (horizontal_precision & 0xf0) >> 4, + horizontal_precision & 0x0f); + w += sldns_str_print(str, sl, "m "); + + w += loc_cm_print(str, sl, (vertical_precision & 0xf0) >> 4, + vertical_precision & 0x0f); + w += sldns_str_print(str, sl, "m"); + + (*d)+=16; + (*dl)-=16; + return w; +} + +int sldns_wire2str_wks_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + /* protocol, followed by bitmap of services */ + const char* proto_name = NULL; + struct protoent *protocol; + struct servent *service; + uint8_t protocol_nr; + int bit, port, w = 0; + size_t i; + /* we cannot print with strings because they + * are not portable, the presentation format may + * not be able to be read in on another computer. */ + int print_symbols = 0; + + /* protocol */ + if(*dl < 1) return -1; + protocol_nr = (*d)[0]; + (*d)++; + (*dl)--; + protocol = getprotobynumber((int)protocol_nr); + if(protocol && (protocol->p_name != NULL)) { + w += sldns_str_print(s, sl, "%s", protocol->p_name); + proto_name = protocol->p_name; + } else { + w += sldns_str_print(s, sl, "%u", (unsigned)protocol_nr); + } + + for(i=0; i<*dl; i++) { + if((*d)[i] == 0) + continue; + for(bit=0; bit<8; bit++) { + if(!(((*d)[i])&(0x80>>bit))) + continue; + port = (int)i*8 + bit; + + if(!print_symbols) + service = NULL; + else + service = getservbyport( + (int)htons((uint16_t)port), proto_name); + if(service && service->s_name) + w += sldns_str_print(s, sl, " %s", + service->s_name); + else w += sldns_str_print(s, sl, " %u", + (unsigned)port); + } + } + +#ifdef HAVE_ENDSERVENT + endservent(); +#endif +#ifdef HAVE_ENDPROTOENT + endprotoent(); +#endif + (*d) += *dl; + (*dl) = 0; + return w; +} + +int sldns_wire2str_nsap_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + return print_remainder_hex("0x", d, dl, s, sl); +} + +int sldns_wire2str_atma_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + return print_remainder_hex("", d, dl, s, sl); +} + +/* internal scan routine that can modify arguments on failure */ +static int sldns_wire2str_ipseckey_scan_internal(uint8_t** d, size_t* dl, + char** s, size_t* sl, uint8_t* pkt, size_t pktlen) +{ + /* http://www.ietf.org/internet-drafts/draft-ietf-ipseckey-rr-12.txt*/ + uint8_t precedence, gateway_type, algorithm; + int w = 0; + + if(*dl < 3) return -1; + precedence = (*d)[0]; + gateway_type = (*d)[1]; + algorithm = (*d)[2]; + if(gateway_type > 3) + return -1; /* unknown */ + (*d)+=3; + (*dl)-=3; + w += sldns_str_print(s, sl, "%d %d %d ", + (int)precedence, (int)gateway_type, (int)algorithm); + + switch(gateway_type) { + case 0: /* no gateway */ + w += sldns_str_print(s, sl, "."); + break; + case 1: /* ip4 */ + w += sldns_wire2str_a_scan(d, dl, s, sl); + break; + case 2: /* ip6 */ + w += sldns_wire2str_aaaa_scan(d, dl, s, sl); + break; + case 3: /* dname */ + w += sldns_wire2str_dname_scan(d, dl, s, sl, pkt, pktlen); + break; + default: /* unknown */ + return -1; + } + + if(*dl < 1) + return -1; + w += sldns_str_print(s, sl, " "); + w += sldns_wire2str_b64_scan_num(d, dl, s, sl, *dl); + return w; +} + +int sldns_wire2str_ipseckey_scan(uint8_t** d, size_t* dl, char** s, size_t* sl, + uint8_t* pkt, size_t pktlen) +{ + uint8_t* od = *d; + char* os = *s; + size_t odl = *dl, osl = *sl; + int w=sldns_wire2str_ipseckey_scan_internal(d, dl, s, sl, pkt, pktlen); + if(w == -1) { + *d = od; + *s = os; + *dl = odl; + *sl = osl; + return -1; + } + return w; +} + +int sldns_wire2str_hip_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + int w; + uint8_t algo, hitlen; + uint16_t pklen; + + /* read lengths */ + if(*dl < 4) + return -1; + hitlen = (*d)[0]; + algo = (*d)[1]; + pklen = sldns_read_uint16((*d)+2); + if(*dl < (size_t)4 + (size_t)hitlen + (size_t)pklen) + return -1; + + /* write: algo hit pubkey */ + w = sldns_str_print(s, sl, "%u ", (unsigned)algo); + w += print_hex_buf(s, sl, (*d)+4, hitlen); + w += sldns_str_print(s, sl, " "); + (*d)+=4+hitlen; + (*dl)-= (4+hitlen); + w += sldns_wire2str_b64_scan_num(d, dl, s, sl, pklen); + return w; +} + +int sldns_wire2str_int16_data_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + uint16_t n; + if(*dl < 2) + return -1; + n = sldns_read_uint16(*d); + if(*dl < 2+(size_t)n) + return -1; + (*d)+=2; + (*dl)-=2; + return sldns_wire2str_b64_scan_num(d, dl, s, sl, n); +} + +int sldns_wire2str_nsec3_next_owner_scan(uint8_t** d, size_t* dl, char** s, + size_t* sl) +{ + return sldns_wire2str_b32_ext_scan(d, dl, s, sl); +} + +int sldns_wire2str_ilnp64_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + int w; + if(*dl < 8) + return -1; + w = sldns_str_print(s, sl, "%.4x:%.4x:%.4x:%.4x", + sldns_read_uint16(*d), sldns_read_uint16((*d)+2), + sldns_read_uint16((*d)+4), sldns_read_uint16((*d)+6)); + (*d)+=8; + (*dl)-=8; + return w; +} + +int sldns_wire2str_eui48_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + int w; + if(*dl < 6) + return -1; + w = sldns_str_print(s, sl, "%.2x-%.2x-%.2x-%.2x-%.2x-%.2x", + (*d)[0], (*d)[1], (*d)[2], (*d)[3], (*d)[4], (*d)[5]); + (*d)+=6; + (*dl)-=6; + return w; +} + +int sldns_wire2str_eui64_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + int w; + if(*dl < 8) + return -1; + w = sldns_str_print(s, sl, "%.2x-%.2x-%.2x-%.2x-%.2x-%.2x-%.2x-%.2x", + (*d)[0], (*d)[1], (*d)[2], (*d)[3], (*d)[4], (*d)[5], + (*d)[6], (*d)[7]); + (*d)+=8; + (*dl)-=8; + return w; +} + +int sldns_wire2str_tag_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) +{ + size_t i, n; + int w = 0; + if(*dl < 1) + return -1; + n = (size_t)((*d)[0]); + if(*dl < 1+n) + return -1; + for(i=0; iname) + w += sldns_str_print(s, sl, " %s", lt->name); + else w += sldns_str_print(s, sl, " %d", (int)data[i]); + } + return w; +} + +int sldns_wire2str_edns_dhu_print(char** s, size_t* sl, uint8_t* data, + size_t len) +{ + sldns_lookup_table *lt; + size_t i; + int w = 0; + for(i=0; iname) + w += sldns_str_print(s, sl, " %s", lt->name); + else w += sldns_str_print(s, sl, " %d", (int)data[i]); + } + return w; +} + +int sldns_wire2str_edns_n3u_print(char** s, size_t* sl, uint8_t* data, + size_t len) +{ + size_t i; + int w = 0; + for(i=0; i 4) { + w += sldns_str_print(s, sl, "trailingdata:"); + w += print_hex_buf(s, sl, data+4+4, len-4-4); + w += sldns_str_print(s, sl, " "); + len = 4+4; + } + memmove(ip4, data+4, len-4); + if(!inet_ntop(AF_INET, ip4, buf, (socklen_t)sizeof(buf))) { + w += sldns_str_print(s, sl, "ip4ntoperror "); + w += print_hex_buf(s, sl, data+4+4, len-4-4); + } else { + w += sldns_str_print(s, sl, "%s", buf); + } + } else if(family == 2) { + /* IP6 */ + char buf[64]; + uint8_t ip6[16]; + memset(ip6, 0, sizeof(ip6)); + if(len-4 > 16) { + w += sldns_str_print(s, sl, "trailingdata:"); + w += print_hex_buf(s, sl, data+4+16, len-4-16); + w += sldns_str_print(s, sl, " "); + len = 4+16; + } + memmove(ip6, data+4, len-4); +#ifdef AF_INET6 + if(!inet_ntop(AF_INET6, ip6, buf, (socklen_t)sizeof(buf))) { + w += sldns_str_print(s, sl, "ip6ntoperror "); + w += print_hex_buf(s, sl, data+4+4, len-4-4); + } else { + w += sldns_str_print(s, sl, "%s", buf); + } +#else + w += print_hex_buf(s, sl, data+4+4, len-4-4); +#endif + } else { + /* unknown */ + w += sldns_str_print(s, sl, "family %d ", + (int)family); + w += print_hex_buf(s, sl, data, len); + } + w += sldns_str_print(s, sl, "/%d scope /%d", (int)source, (int)scope); + return w; +} + +int sldns_wire2str_edns_option_print(char** s, size_t* sl, + uint16_t option_code, uint8_t* optdata, size_t optlen) +{ + int w = 0; + w += sldns_wire2str_edns_option_code_print(s, sl, option_code); + w += sldns_str_print(s, sl, ": "); + switch(option_code) { + case LDNS_EDNS_LLQ: + w += sldns_wire2str_edns_llq_print(s, sl, optdata, optlen); + break; + case LDNS_EDNS_UL: + w += sldns_wire2str_edns_ul_print(s, sl, optdata, optlen); + break; + case LDNS_EDNS_NSID: + w += sldns_wire2str_edns_nsid_print(s, sl, optdata, optlen); + break; + case LDNS_EDNS_DAU: + w += sldns_wire2str_edns_dau_print(s, sl, optdata, optlen); + break; + case LDNS_EDNS_DHU: + w += sldns_wire2str_edns_dhu_print(s, sl, optdata, optlen); + break; + case LDNS_EDNS_N3U: + w += sldns_wire2str_edns_n3u_print(s, sl, optdata, optlen); + break; + case LDNS_EDNS_CLIENT_SUBNET: + w += sldns_wire2str_edns_subnet_print(s, sl, optdata, optlen); + break; + default: + /* unknown option code */ + w += print_hex_buf(s, sl, optdata, optlen); + break; + } + return w; +} + +/** print the edns options to string */ +static int +print_edns_opts(char** s, size_t* sl, uint8_t* rdata, size_t rdatalen) +{ + uint16_t option_code, option_len; + int w = 0; + while(rdatalen > 0) { + /* option name */ + if(rdatalen < 4) { + w += sldns_str_print(s, sl, " ; malformed: "); + w += print_hex_buf(s, sl, rdata, rdatalen); + return w; + } + option_code = sldns_read_uint16(rdata); + option_len = sldns_read_uint16(rdata+2); + rdata += 4; + rdatalen -= 4; + + /* option value */ + if(rdatalen < (size_t)option_len) { + w += sldns_str_print(s, sl, " ; malformed "); + w += sldns_wire2str_edns_option_code_print(s, sl, + option_code); + w += sldns_str_print(s, sl, ": "); + w += print_hex_buf(s, sl, rdata, rdatalen); + return w; + } + w += sldns_str_print(s, sl, " ; "); + w += sldns_wire2str_edns_option_print(s, sl, option_code, + rdata, option_len); + rdata += option_len; + rdatalen -= option_len; + } + return w; +} + +int sldns_wire2str_edns_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len, uint8_t* pkt, size_t pktlen) +{ + int w = 0; + uint8_t ext_rcode, edns_version; + uint16_t udpsize, edns_bits, rdatalen; + w += sldns_str_print(str, str_len, "; EDNS:"); + + /* some input checks, domain name */ + if(*data_len < 1+10) + return w + print_remainder_hex("Error malformed 0x", + data, data_len, str, str_len); + if(*data[0] != 0) { + return w + print_remainder_hex("Error nonrootdname 0x", + data, data_len, str, str_len); + } + (*data)++; + (*data_len)--; + + /* check type and read fixed contents */ + if(sldns_read_uint16((*data)) != LDNS_RR_TYPE_OPT) { + return w + print_remainder_hex("Error nottypeOPT 0x", + data, data_len, str, str_len); + } + udpsize = sldns_read_uint16((*data)+2); + ext_rcode = (*data)[4]; + edns_version = (*data)[5]; + edns_bits = sldns_read_uint16((*data)+6); + rdatalen = sldns_read_uint16((*data)+8); + (*data)+=10; + (*data_len)-=10; + + w += sldns_str_print(str, str_len, " version: %u;", + (unsigned)edns_version); + w += sldns_str_print(str, str_len, " flags:"); + if((edns_bits & LDNS_EDNS_MASK_DO_BIT)) + w += sldns_str_print(str, str_len, " do"); + /* the extended rcode is the value set, shifted four bits, + * and or'd with the original rcode */ + if(ext_rcode) { + int rc = ((int)ext_rcode)<<4; + if(pkt && pktlen >= LDNS_HEADER_SIZE) + rc |= LDNS_RCODE_WIRE(pkt); + w += sldns_str_print(str, str_len, " ; ext-rcode: %d", rc); + } + w += sldns_str_print(str, str_len, " ; udp: %u", (unsigned)udpsize); + + if(rdatalen) { + if(*data_len < rdatalen) { + w += sldns_str_print(str, str_len, + " ; Error EDNS rdata too short; "); + rdatalen = *data_len; + } + w += print_edns_opts(str, str_len, *data, rdatalen); + (*data) += rdatalen; + (*data_len) -= rdatalen; + } + w += sldns_str_print(str, str_len, "\n"); + return w; +} diff --git a/contrib/unbound/ldns/wire2str.h b/contrib/unbound/ldns/wire2str.h new file mode 100644 index 00000000000..67f54356626 --- /dev/null +++ b/contrib/unbound/ldns/wire2str.h @@ -0,0 +1,984 @@ +/** + * wire2str.h - txt presentation of RRs + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +/** + * \file + * + * Contains functions to translate the wireformat to text + * representation, as well as functions to print them. + */ + +#ifndef LDNS_WIRE2STR_H +#define LDNS_WIRE2STR_H + +#ifdef __cplusplus +extern "C" { +#endif +struct sldns_struct_lookup_table; + +/* lookup tables for standard DNS stuff */ +/** Taken from RFC 2535, section 7. */ +extern struct sldns_struct_lookup_table* sldns_algorithms; +/** DS record hash algorithms */ +extern struct sldns_struct_lookup_table* sldns_hashes; +/** Taken from RFC 2538, section 2.1. */ +extern struct sldns_struct_lookup_table* sldns_cert_algorithms; +/** Response codes */ +extern struct sldns_struct_lookup_table* sldns_rcodes; +/** Operation codes */ +extern struct sldns_struct_lookup_table* sldns_opcodes; +/** EDNS flags */ +extern struct sldns_struct_lookup_table* sldns_edns_flags; +/** EDNS option codes */ +extern struct sldns_struct_lookup_table* sldns_edns_options; +/** error string from wireparse */ +extern struct sldns_struct_lookup_table* sldns_wireparse_errors; + +/** + * Convert wireformat packet to a string representation + * @param data: wireformat packet data (starting at ID bytes). + * @param len: length of packet. + * @return string(malloced) or NULL on failure. + */ +char* sldns_wire2str_pkt(uint8_t* data, size_t len); + +/** + * Convert wireformat RR to a string representation. + * @param rr: the wireformat RR, in uncompressed form. Starts at the domain + * name start, ends with the rdata of the RR. + * @param len: length of the rr wireformat. + * @return string(malloced) or NULL on failure. + */ +char* sldns_wire2str_rr(uint8_t* rr, size_t len); + +/** + * Conver wire dname to a string. + * @param dname: the dname in uncompressed wireformat. + * @param dname_len: length of the dname. + * @return string or NULL on failure. + */ +char* sldns_wire2str_dname(uint8_t* dname, size_t dname_len); + +/** + * Convert wire RR type to a string, 'MX', 'TYPE1234'... + * @param rrtype: the RR type in host order. + * @return malloced string with the RR type or NULL on malloc failure. + */ +char* sldns_wire2str_type(uint16_t rrtype); + +/** + * Convert wire RR class to a string, 'IN', 'CLASS1'. + * @param rrclass: the RR class in host order. + * @return malloced string with the RR class or NULL on malloc failure. + */ +char* sldns_wire2str_class(uint16_t rrclass); + +/** + * Convert wire packet rcode to a string, 'NOERROR', 'NXDOMAIN'... + * @param rcode: as integer, host order + * @return malloced string with the rcode or NULL on malloc failure. + */ +char* sldns_wire2str_rcode(int rcode); + +/** + * Print to string, move string along for next content. With va_list. + * @param str: string buffer. Adjusted at end to after the output. + * @param slen: length of the string buffer. Adjusted at end. + * @param format: printf format string. + * @param args: arguments for printf. + * @return number of characters needed. Can be larger than slen. + */ +int sldns_str_vprint(char** str, size_t* slen, const char* format, va_list args); + +/** + * Print to string, move string along for next content. + * @param str: string buffer. Adjusted at end to after the output. + * @param slen: length of the string buffer. Adjusted at end. + * @param format: printf format string and arguments for it. + * @return number of characters needed. Can be larger than slen. + */ +int sldns_str_print(char** str, size_t* slen, const char* format, ...) + ATTR_FORMAT(printf, 3, 4); + +/** + * Convert wireformat packet to a string representation with user buffer + * It appends every RR with default comments. + * For more formatter options use the function: TBD(TODO) + * @param data: wireformat packet data (starting at ID bytes). + * @param data_len: length of packet. + * @param str: the string buffer for the output. + * If you pass NULL as the str the return value of the function is + * the str_len you need for the entire packet. It does not include + * the 0 byte at the end. + * @param str_len: the size of the string buffer. If more is needed, it'll + * silently truncate the output to fit in the buffer. + * @return the number of characters for this element, excluding zerobyte. + * Is larger than str_len if output was truncated. + */ +int sldns_wire2str_pkt_buf(uint8_t* data, size_t data_len, char* str, + size_t str_len); + +/** + * Scan wireformat packet to a string representation with user buffer + * It appends every RR with default comments. + * For more formatter options use the function: TBD(TODO) + * @param data: wireformat packet data (starting at ID bytes). + * @param data_len: length of packet. + * @param str: the string buffer for the output. + * @param str_len: the size of the string buffer. + * @return number of characters for string. + * returns the number of characters that are needed (except terminating null), + * so it may return a value larger than str_len. + * On error you get less output (i.e. shorter output in str (null terminated)) + * On exit the data, data_len, str and str_len values are adjusted to move them + * from their original position along the input and output for the content + * that has been consumed (and produced) by this function. If the end of the + * output string is reached, *str_len is set to 0. The output string is null + * terminated (shortening the output if necessary). If the end of the input + * is reached *data_len is set to 0. + */ +int sldns_wire2str_pkt_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat rr to string, with user buffers. It shifts the arguments + * to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @param pkt: packet for decompression, if NULL no decompression. + * @param pktlen: length of packet buffer. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_rr_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len, uint8_t* pkt, size_t pktlen); + +/** + * Scan wireformat question rr to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @param pkt: packet for decompression, if NULL no decompression. + * @param pktlen: length of packet buffer. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_rrquestion_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len, uint8_t* pkt, size_t pktlen); + +/** + * Scan wireformat RR to string in unknown RR format, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @param pkt: packet for decompression, if NULL no decompression. + * @param pktlen: length of packet buffer. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_rr_unknown_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len, uint8_t* pkt, size_t pktlen); + +/** + * Print to string the RR-information comment in default format, + * with user buffers. Moves string along. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @param rr: wireformat data. + * @param rrlen: length of data buffer. + * @param dname_off: offset in buffer behind owner dname, the compressed size + * of the owner name. + * @param rrtype: type of the RR, host format. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_rr_comment_print(char** str, size_t* str_len, uint8_t* rr, + size_t rrlen, size_t dname_off, uint16_t rrtype); + +/** + * Scan wireformat packet header to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_header_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat rdata to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. The length of the rdata in the + * buffer. The rdatalen itself has already been scanned, the data + * points to the rdata after the rdatalen. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @param rrtype: RR type of Rdata, host format. + * @param pkt: packet for decompression, if NULL no decompression. + * @param pktlen: length of packet buffer. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_rdata_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len, uint16_t rrtype, uint8_t* pkt, size_t pktlen); + +/** + * Scan wireformat rdata to string in unknown format, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer, the length of the rdata in buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_rdata_unknown_scan(uint8_t** data, size_t* data_len, + char** str, size_t* str_len); + +/** + * Scan wireformat domain name to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @param pkt: packet for decompression, if NULL no decompression. + * @param pktlen: length of packet buffer. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_dname_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len, uint8_t* pkt, size_t pktlen); + +/** + * Scan wireformat rr type to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_type_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat rr class to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_class_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat rr ttl to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_ttl_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + + +/** + * Print host format rr type to string. Moves string along, user buffers. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @param rrtype: host format rr type. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_type_print(char** str, size_t* str_len, uint16_t rrtype); + +/** + * Print host format rr class to string. Moves string along, user buffers. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @param rrclass: host format rr class. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_class_print(char** str, size_t* str_len, uint16_t rrclass); + +/** + * Print host format rcode to string. Moves string along, user buffers. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @param rcode: host format rcode number. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_rcode_print(char** str, size_t* str_len, int rcode); + +/** + * Print host format opcode to string. Moves string along, user buffers. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @param opcode: host format opcode number. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_opcode_print(char** str, size_t* str_len, int opcode); + +/** + * Print host format EDNS0 option to string. Moves string along, user buffers. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @param opcode: host format option number. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_edns_option_code_print(char** str, size_t* str_len, + uint16_t opcode); + +/** + * Convert RR to string presentation format, on one line. User buffer. + * @param rr: wireformat RR data + * @param rr_len: length of the rr wire data. + * @param str: the string buffer to write to. + * If you pass NULL as the str, the return value of the function is + * the str_len you need for the entire packet. It does not include + * the 0 byte at the end. + * @param str_len: the size of the string buffer. If more is needed, it'll + * silently truncate the output to fit in the buffer. + * @return the number of characters for this element, excluding zerobyte. + * Is larger than str_len if output was truncated. + */ +int sldns_wire2str_rr_buf(uint8_t* rr, size_t rr_len, char* str, + size_t str_len); + +/** + * 3597 printout of an RR in unknown rr format. + * There are more format and comment options available for printout + * with the function: TBD(TODO) + * @param rr: wireformat RR data + * @param rr_len: length of the rr wire data. + * @param str: the string buffer to write to. + * If you pass NULL as the str, the return value of the function is + * the str_len you need for the entire rr. It does not include + * the 0 byte at the end. + * @param str_len: the size of the string buffer. If more is needed, it'll + * silently truncate the output to fit in the buffer. + * @return the number of characters for this element, excluding zerobyte. + * Is larger than str_len if output was truncated. + */ +int sldns_wire2str_rr_unknown_buf(uint8_t* rr, size_t rr_len, char* str, + size_t str_len); + +/** + * This creates the comment to print after the RR. ; keytag=... , and other + * basic comments for RRs. + * There are more format and comment options available for printout + * with the function: TBD(TODO) + * @param rr: wireformat RR data + * @param rr_len: length of the rr wire data. + * @param dname_len: length of the dname in front of the RR. + * @param str: the string buffer to write to. + * If you pass NULL as the str, the return value of the function is + * the str_len you need for the entire comment. It does not include + * the 0 byte at the end. + * @param str_len: the size of the string buffer. If more is needed, it'll + * silently truncate the output to fit in the buffer. + * @return the number of characters for this element, excluding zerobyte. + * Is larger than str_len if output was truncated. + */ +int sldns_wire2str_rr_comment_buf(uint8_t* rr, size_t rr_len, size_t dname_len, + char* str, size_t str_len); + +/** + * Convert RDATA to string presentation format, on one line. User buffer. + * @param rdata: wireformat rdata part of an RR. + * @param rdata_len: length of the rr wire data. + * @param str: the string buffer to write to. + * If you pass NULL as the str, the return value of the function is + * the str_len you need for the entire packet. It does not include + * the 0 byte at the end. + * @param str_len: the size of the string buffer. If more is needed, it'll + * silently truncate the output to fit in the buffer. + * @param rrtype: rr type of the data + * @return the number of characters for this element, excluding zerobyte. + * Is larger than str_len if output was truncated. + */ +int sldns_wire2str_rdata_buf(uint8_t* rdata, size_t rdata_len, char* str, + size_t str_len, uint16_t rrtype); + +/** + * Convert wire RR type to a string, 'MX', 'TYPE12'. With user buffer. + * @param rrtype: the RR type in host order. + * @param str: the string to write to. + * @param len: length of str. + * @return the number of characters for this element, excluding zerobyte. + * Is larger than str_len if output was truncated. + */ +int sldns_wire2str_type_buf(uint16_t rrtype, char* str, size_t len); + +/** + * Convert wire RR class to a string, 'IN', 'CLASS12'. With user buffer. + * @param rrclass: the RR class in host order. + * @param str: the string to write to. + * @param len: length of str. + * @return the number of characters for this element, excluding zerobyte. + * Is larger than str_len if output was truncated. + */ +int sldns_wire2str_class_buf(uint16_t rrclass, char* str, size_t len); + +/** + * Convert wire RR rcode to a string, 'NOERROR', 'NXDOMAIN'. With user buffer. + * @param rcode: rcode as integer in host order + * @param str: the string to write to. + * @param len: length of str. + * @return the number of characters for this element, excluding zerobyte. + * Is larger than str_len if output was truncated. + */ +int sldns_wire2str_rcode_buf(int rcode, char* str, size_t len); + +/** + * Convert wire dname to a string, "example.com.". With user buffer. + * @param dname: the dname in uncompressed wireformat. + * @param dname_len: length of the dname. + * @param str: the string to write to. + * @param len: length of string. + * @return the number of characters for this element, excluding zerobyte. + * Is larger than str_len if output was truncated. + */ +int sldns_wire2str_dname_buf(uint8_t* dname, size_t dname_len, char* str, + size_t len); + +/** + * Scan wireformat rdf field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @param rdftype: the type of the rdata field, enum sldns_rdf_type. + * @param pkt: packet for decompression, if NULL no decompression. + * @param pktlen: length of packet buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_rdf_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len, int rdftype, uint8_t* pkt, size_t pktlen); + +/** + * Scan wireformat int8 field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_int8_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat int16 field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_int16_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat int32 field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_int32_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat period field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_period_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat tsigtime field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_tsigtime_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat ip4 A field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_a_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat ip6 AAAA field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_aaaa_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat str field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_str_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat apl field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_apl_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat b32_ext field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_b32_ext_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat b64 field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_b64_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat hex field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_hex_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat nsec bitmap field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_nsec_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat nsec3_salt field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_nsec3_salt_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat cert_alg field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_cert_alg_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat alg field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_alg_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat type unknown field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_unknown_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat time field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_time_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat LOC field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_loc_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat WKS field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_wks_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat NSAP field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_nsap_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat ATMA field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_atma_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat IPSECKEY field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @param pkt: packet for decompression, if NULL no decompression. + * @param pktlen: length of packet buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_ipseckey_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len, uint8_t* pkt, size_t pktlen); + +/** + * Scan wireformat HIP (algo, HIT, pubkey) field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_hip_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat int16_data field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_int16_data_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat nsec3_next_owner field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_nsec3_next_owner_scan(uint8_t** data, size_t* data_len, + char** str, size_t* str_len); + +/** + * Scan wireformat ILNP64 field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_ilnp64_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat EUI48 field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_eui48_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat EUI64 field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_eui64_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat TAG field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_tag_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Scan wireformat long_str field to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @return number of characters (except null) needed to print. + * Can return -1 on failure. + */ +int sldns_wire2str_long_str_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len); + +/** + * Print EDNS LLQ option data to string. User buffers, moves string pointers. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @param option_data: buffer with EDNS option code data. + * @param option_len: length of the data for this option. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_edns_llq_print(char** str, size_t* str_len, + uint8_t* option_data, size_t option_len); + +/** + * Print EDNS UL option data to string. User buffers, moves string pointers. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @param option_data: buffer with EDNS option code data. + * @param option_len: length of the data for this option. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_edns_ul_print(char** str, size_t* str_len, + uint8_t* option_data, size_t option_len); + +/** + * Print EDNS NSID option data to string. User buffers, moves string pointers. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @param option_data: buffer with EDNS option code data. + * @param option_len: length of the data for this option. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_edns_nsid_print(char** str, size_t* str_len, + uint8_t* option_data, size_t option_len); + +/** + * Print EDNS DAU option data to string. User buffers, moves string pointers. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @param option_data: buffer with EDNS option code data. + * @param option_len: length of the data for this option. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_edns_dau_print(char** str, size_t* str_len, + uint8_t* option_data, size_t option_len); + +/** + * Print EDNS DHU option data to string. User buffers, moves string pointers. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @param option_data: buffer with EDNS option code data. + * @param option_len: length of the data for this option. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_edns_dhu_print(char** str, size_t* str_len, + uint8_t* option_data, size_t option_len); + +/** + * Print EDNS N3U option data to string. User buffers, moves string pointers. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @param option_data: buffer with EDNS option code data. + * @param option_len: length of the data for this option. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_edns_n3u_print(char** str, size_t* str_len, + uint8_t* option_data, size_t option_len); + +/** + * Print EDNS SUBNET option data to string. User buffers, moves string pointers. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @param option_data: buffer with EDNS option code data. + * @param option_len: length of the data for this option. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_edns_subnet_print(char** str, size_t* str_len, + uint8_t* option_data, size_t option_len); + +/** + * Print an EDNS option as OPT: VALUE. User buffers, moves string pointers. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @param option_code: host format EDNS option code. + * @param option_data: buffer with EDNS option code data. + * @param option_len: length of the data for this option. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_edns_option_print(char** str, size_t* str_len, + uint16_t option_code, uint8_t* option_data, size_t option_len); + +/** + * Scan wireformat EDNS OPT to string, with user buffers. + * It shifts the arguments to move along (see sldns_wire2str_pkt_scan). + * @param data: wireformat data. + * @param data_len: length of data buffer. + * @param str: string buffer. + * @param str_len: length of string buffer. + * @param pkt: packet with header and other info (may be NULL) + * @param pktlen: length of packet buffer. + * @return number of characters (except null) needed to print. + */ +int sldns_wire2str_edns_scan(uint8_t** data, size_t* data_len, char** str, + size_t* str_len, uint8_t* pkt, size_t pktlen); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_WIRE2STR_H */ diff --git a/contrib/unbound/libunbound/context.c b/contrib/unbound/libunbound/context.c index e3e64960124..c21f9418415 100644 --- a/contrib/unbound/libunbound/context.c +++ b/contrib/unbound/libunbound/context.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -49,6 +49,7 @@ #include "services/cache/infra.h" #include "util/data/msgreply.h" #include "util/storage/slabhash.h" +#include "ldns/sbuffer.h" int context_finalize(struct ub_ctx* ctx) @@ -124,7 +125,7 @@ find_id(struct ub_ctx* ctx, int* id) } struct ctx_query* -context_new(struct ub_ctx* ctx, const char* name, int rrtype, int rrclass, +context_new(struct ub_ctx* ctx, const char* name, int rrtype, int rrclass, ub_callback_t cb, void* cbarg) { struct ctx_query* q = (struct ctx_query*)calloc(1, sizeof(*q)); @@ -220,10 +221,10 @@ context_serialize_new_query(struct ctx_query* q, uint32_t* len) *len = sizeof(uint32_t)*4 + slen; p = (uint8_t*)malloc(*len); if(!p) return NULL; - ldns_write_uint32(p, UB_LIBCMD_NEWQUERY); - ldns_write_uint32(p+sizeof(uint32_t), (uint32_t)q->querynum); - ldns_write_uint32(p+2*sizeof(uint32_t), (uint32_t)q->res->qtype); - ldns_write_uint32(p+3*sizeof(uint32_t), (uint32_t)q->res->qclass); + sldns_write_uint32(p, UB_LIBCMD_NEWQUERY); + sldns_write_uint32(p+sizeof(uint32_t), (uint32_t)q->querynum); + sldns_write_uint32(p+2*sizeof(uint32_t), (uint32_t)q->res->qtype); + sldns_write_uint32(p+3*sizeof(uint32_t), (uint32_t)q->res->qclass); memmove(p+4*sizeof(uint32_t), q->res->qname, slen); return p; } @@ -237,8 +238,8 @@ context_deserialize_new_query(struct ub_ctx* ctx, uint8_t* p, uint32_t len) free(q); return NULL; } - log_assert( ldns_read_uint32(p) == UB_LIBCMD_NEWQUERY); - q->querynum = (int)ldns_read_uint32(p+sizeof(uint32_t)); + log_assert( sldns_read_uint32(p) == UB_LIBCMD_NEWQUERY); + q->querynum = (int)sldns_read_uint32(p+sizeof(uint32_t)); q->node.key = &q->querynum; q->async = 1; q->res = (struct ub_result*)calloc(1, sizeof(*q->res)); @@ -246,8 +247,8 @@ context_deserialize_new_query(struct ub_ctx* ctx, uint8_t* p, uint32_t len) free(q); return NULL; } - q->res->qtype = (int)ldns_read_uint32(p+2*sizeof(uint32_t)); - q->res->qclass = (int)ldns_read_uint32(p+3*sizeof(uint32_t)); + q->res->qtype = (int)sldns_read_uint32(p+2*sizeof(uint32_t)); + q->res->qclass = (int)sldns_read_uint32(p+3*sizeof(uint32_t)); q->res->qname = strdup((char*)(p+4*sizeof(uint32_t))); if(!q->res->qname) { free(q->res); @@ -269,8 +270,8 @@ context_lookup_new_query(struct ub_ctx* ctx, uint8_t* p, uint32_t len) if(len < 4*sizeof(uint32_t)+1) { return NULL; } - log_assert( ldns_read_uint32(p) == UB_LIBCMD_NEWQUERY); - querynum = (int)ldns_read_uint32(p+sizeof(uint32_t)); + log_assert( sldns_read_uint32(p) == UB_LIBCMD_NEWQUERY); + querynum = (int)sldns_read_uint32(p+sizeof(uint32_t)); q = (struct ctx_query*)rbtree_search(&ctx->queries, &querynum); if(!q) { return NULL; @@ -280,7 +281,7 @@ context_lookup_new_query(struct ub_ctx* ctx, uint8_t* p, uint32_t len) } uint8_t* -context_serialize_answer(struct ctx_query* q, int err, ldns_buffer* pkt, +context_serialize_answer(struct ctx_query* q, int err, sldns_buffer* pkt, uint32_t* len) { /* answer format @@ -293,22 +294,22 @@ context_serialize_answer(struct ctx_query* q, int err, ldns_buffer* pkt, * o the remainder is the answer msg from resolver lookup. * remainder can be length 0. */ - size_t pkt_len = pkt?ldns_buffer_remaining(pkt):0; + size_t pkt_len = pkt?sldns_buffer_remaining(pkt):0; size_t wlen = (pkt&&q->res->why_bogus)?strlen(q->res->why_bogus)+1:0; uint8_t* p; *len = sizeof(uint32_t)*5 + pkt_len + wlen; p = (uint8_t*)malloc(*len); if(!p) return NULL; - ldns_write_uint32(p, UB_LIBCMD_ANSWER); - ldns_write_uint32(p+sizeof(uint32_t), (uint32_t)q->querynum); - ldns_write_uint32(p+2*sizeof(uint32_t), (uint32_t)err); - ldns_write_uint32(p+3*sizeof(uint32_t), (uint32_t)q->msg_security); - ldns_write_uint32(p+4*sizeof(uint32_t), (uint32_t)wlen); + sldns_write_uint32(p, UB_LIBCMD_ANSWER); + sldns_write_uint32(p+sizeof(uint32_t), (uint32_t)q->querynum); + sldns_write_uint32(p+2*sizeof(uint32_t), (uint32_t)err); + sldns_write_uint32(p+3*sizeof(uint32_t), (uint32_t)q->msg_security); + sldns_write_uint32(p+4*sizeof(uint32_t), (uint32_t)wlen); if(wlen > 0) memmove(p+5*sizeof(uint32_t), q->res->why_bogus, wlen); if(pkt_len > 0) memmove(p+5*sizeof(uint32_t)+wlen, - ldns_buffer_begin(pkt), pkt_len); + sldns_buffer_begin(pkt), pkt_len); return p; } @@ -320,13 +321,13 @@ context_deserialize_answer(struct ub_ctx* ctx, int id; size_t wlen; if(len < 5*sizeof(uint32_t)) return NULL; - log_assert( ldns_read_uint32(p) == UB_LIBCMD_ANSWER); - id = (int)ldns_read_uint32(p+sizeof(uint32_t)); + log_assert( sldns_read_uint32(p) == UB_LIBCMD_ANSWER); + id = (int)sldns_read_uint32(p+sizeof(uint32_t)); q = (struct ctx_query*)rbtree_search(&ctx->queries, &id); if(!q) return NULL; - *err = (int)ldns_read_uint32(p+2*sizeof(uint32_t)); - q->msg_security = ldns_read_uint32(p+3*sizeof(uint32_t)); - wlen = (size_t)ldns_read_uint32(p+4*sizeof(uint32_t)); + *err = (int)sldns_read_uint32(p+2*sizeof(uint32_t)); + q->msg_security = sldns_read_uint32(p+3*sizeof(uint32_t)); + wlen = (size_t)sldns_read_uint32(p+4*sizeof(uint32_t)); if(len > 5*sizeof(uint32_t) && wlen > 0) { if(len >= 5*sizeof(uint32_t)+wlen) q->res->why_bogus = (char*)memdup( @@ -362,8 +363,8 @@ context_serialize_cancel(struct ctx_query* q, uint32_t* len) uint8_t* p = (uint8_t*)malloc(2*sizeof(uint32_t)); if(!p) return NULL; *len = 2*sizeof(uint32_t); - ldns_write_uint32(p, UB_LIBCMD_CANCEL); - ldns_write_uint32(p+sizeof(uint32_t), (uint32_t)q->querynum); + sldns_write_uint32(p, UB_LIBCMD_CANCEL); + sldns_write_uint32(p+sizeof(uint32_t), (uint32_t)q->querynum); return p; } @@ -373,8 +374,8 @@ struct ctx_query* context_deserialize_cancel(struct ub_ctx* ctx, struct ctx_query* q; int id; if(len != 2*sizeof(uint32_t)) return NULL; - log_assert( ldns_read_uint32(p) == UB_LIBCMD_CANCEL); - id = (int)ldns_read_uint32(p+sizeof(uint32_t)); + log_assert( sldns_read_uint32(p) == UB_LIBCMD_CANCEL); + id = (int)sldns_read_uint32(p+sizeof(uint32_t)); q = (struct ctx_query*)rbtree_search(&ctx->queries, &id); return q; } @@ -386,7 +387,7 @@ context_serialize_quit(uint32_t* len) if(!p) return NULL; *len = sizeof(uint32_t); - ldns_write_uint32(p, UB_LIBCMD_QUIT); + sldns_write_uint32(p, UB_LIBCMD_QUIT); return p; } @@ -395,6 +396,6 @@ enum ub_ctx_cmd context_serial_getcmd(uint8_t* p, uint32_t len) uint32_t v; if((size_t)len < sizeof(v)) return UB_LIBCMD_QUIT; - v = ldns_read_uint32(p); + v = sldns_read_uint32(p); return v; } diff --git a/contrib/unbound/libunbound/context.h b/contrib/unbound/libunbound/context.h index 743178baae6..31ca09c6db0 100644 --- a/contrib/unbound/libunbound/context.h +++ b/contrib/unbound/libunbound/context.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -48,6 +48,8 @@ #include "util/data/packed_rrset.h" struct libworker; struct tube; +struct sldns_buffer; +struct event_base; /** * The context structure @@ -111,6 +113,11 @@ struct ub_ctx { /** random state used to seed new random state structures */ struct ub_randstate* seed_rnd; + /** event base for event oriented interface */ + struct event_base* event_base; + /** libworker for event based interface */ + struct libworker* event_worker; + /** next query number (to try) to use */ int next_querynum; /** number of async queries outstanding */ @@ -234,8 +241,8 @@ void context_query_delete(struct ctx_query* q); * @param cbarg: user arg for async queries. * @return new ctx_query or NULL for malloc failure. */ -struct ctx_query* context_new(struct ub_ctx* ctx, const char* name, - int rrtype, int rrclass, ub_callback_t cb, void* cbarg); +struct ctx_query* context_new(struct ub_ctx* ctx, const char* name, int rrtype, + int rrclass, ub_callback_t cb, void* cbarg); /** * Get a new alloc. Creates a new one or uses a cached one. @@ -275,7 +282,7 @@ uint8_t* context_serialize_new_query(struct ctx_query* q, uint32_t* len); * @return: an alloc, or NULL on mem error. */ uint8_t* context_serialize_answer(struct ctx_query* q, int err, - ldns_buffer* pkt, uint32_t* len); + struct sldns_buffer* pkt, uint32_t* len); /** * Serialize a query cancellation. Serializes query async id diff --git a/contrib/unbound/libunbound/libunbound.c b/contrib/unbound/libunbound/libunbound.c index 7efd4cbfada..78d31968ac6 100644 --- a/contrib/unbound/libunbound/libunbound.c +++ b/contrib/unbound/libunbound/libunbound.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -43,6 +43,7 @@ /* include the public api first, it should be able to stand alone */ #include "libunbound/unbound.h" +#include "libunbound/unbound-event.h" #include "config.h" #include #include "libunbound/context.h" @@ -60,14 +61,18 @@ #include "services/localzone.h" #include "services/cache/infra.h" #include "services/cache/rrset.h" +#include "ldns/sbuffer.h" +#ifdef HAVE_PTHREAD +#include +#endif #if defined(UB_ON_WINDOWS) && defined (HAVE_WINDOWS_H) #include #include #endif /* UB_ON_WINDOWS */ -struct ub_ctx* -ub_ctx_create(void) +/** create context functionality, but no pipes */ +static struct ub_ctx* ub_ctx_create_nopipe(void) { struct ub_ctx* ctx; unsigned int seed; @@ -102,28 +107,11 @@ ub_ctx_create(void) return NULL; } seed = 0; - if((ctx->qq_pipe = tube_create()) == NULL) { - int e = errno; - ub_randfree(ctx->seed_rnd); - free(ctx); - errno = e; - return NULL; - } - if((ctx->rr_pipe = tube_create()) == NULL) { - int e = errno; - tube_delete(ctx->qq_pipe); - ub_randfree(ctx->seed_rnd); - free(ctx); - errno = e; - return NULL; - } lock_basic_init(&ctx->qqpipe_lock); lock_basic_init(&ctx->rrpipe_lock); lock_basic_init(&ctx->cfglock); ctx->env = (struct module_env*)calloc(1, sizeof(*ctx->env)); if(!ctx->env) { - tube_delete(ctx->qq_pipe); - tube_delete(ctx->rr_pipe); ub_randfree(ctx->seed_rnd); free(ctx); errno = ENOMEM; @@ -131,8 +119,6 @@ ub_ctx_create(void) } ctx->env->cfg = config_create_forlib(); if(!ctx->env->cfg) { - tube_delete(ctx->qq_pipe); - tube_delete(ctx->rr_pipe); free(ctx->env); ub_randfree(ctx->seed_rnd); free(ctx); @@ -147,6 +133,50 @@ ub_ctx_create(void) return ctx; } +struct ub_ctx* +ub_ctx_create(void) +{ + struct ub_ctx* ctx = ub_ctx_create_nopipe(); + if(!ctx) + return NULL; + if((ctx->qq_pipe = tube_create()) == NULL) { + int e = errno; + ub_randfree(ctx->seed_rnd); + config_delete(ctx->env->cfg); + modstack_desetup(&ctx->mods, ctx->env); + free(ctx->env); + free(ctx); + errno = e; + return NULL; + } + if((ctx->rr_pipe = tube_create()) == NULL) { + int e = errno; + tube_delete(ctx->qq_pipe); + ub_randfree(ctx->seed_rnd); + config_delete(ctx->env->cfg); + modstack_desetup(&ctx->mods, ctx->env); + free(ctx->env); + free(ctx); + errno = e; + return NULL; + } + return ctx; +} + +struct ub_ctx* +ub_ctx_create_event(struct event_base* eb) +{ + struct ub_ctx* ctx = ub_ctx_create_nopipe(); + if(!ctx) + return NULL; + /* no pipes, but we have the locks to make sure everything works */ + ctx->created_bg = 0; + ctx->dothread = 1; /* the processing is in the same process, + makes ub_cancel and ub_ctx_delete do the right thing */ + ctx->event_base = eb; + return ctx; +} + /** delete q */ static void delq(rbnode_t* n, void* ATTR_UNUSED(arg)) @@ -155,11 +185,9 @@ delq(rbnode_t* n, void* ATTR_UNUSED(arg)) context_query_delete(q); } -void -ub_ctx_delete(struct ub_ctx* ctx) +/** stop the bg thread */ +static void ub_stop_bg(struct ub_ctx* ctx) { - struct alloc_cache* a, *na; - if(!ctx) return; /* stop the bg thread */ lock_basic_lock(&ctx->cfglock); if(ctx->created_bg) { @@ -195,7 +223,29 @@ ub_ctx_delete(struct ub_ctx* ctx) else { lock_basic_unlock(&ctx->cfglock); } +} +void +ub_ctx_delete(struct ub_ctx* ctx) +{ + struct alloc_cache* a, *na; + int do_stop = 1; + if(!ctx) return; + + /* see if bg thread is created and if threads have been killed */ + /* no locks, because those may be held by terminated threads */ + /* for processes the read pipe is closed and we see that on read */ +#ifdef HAVE_PTHREAD + if(ctx->created_bg && ctx->dothread) { + if(pthread_kill(ctx->bg_tid, 0) == ESRCH) { + /* thread has been killed */ + do_stop = 0; + } + } +#endif /* HAVE_PTHREAD */ + if(do_stop) + ub_stop_bg(ctx); + libworker_delete_event(ctx->event_worker); modstack_desetup(&ctx->mods, ctx->env); a = ctx->alloc_list; @@ -419,21 +469,21 @@ process_answer_detail(struct ub_ctx* ctx, uint8_t* msg, uint32_t len, ub_resolve_free(q->res); } else { /* parse the message, extract rcode, fill result */ - ldns_buffer* buf = ldns_buffer_new(q->msg_len); + sldns_buffer* buf = sldns_buffer_new(q->msg_len); struct regional* region = regional_create(); *res = q->res; (*res)->rcode = LDNS_RCODE_SERVFAIL; if(region && buf) { - ldns_buffer_clear(buf); - ldns_buffer_write(buf, q->msg, q->msg_len); - ldns_buffer_flip(buf); + sldns_buffer_clear(buf); + sldns_buffer_write(buf, q->msg, q->msg_len); + sldns_buffer_flip(buf); libworker_enter_result(*res, buf, region, q->msg_security); } (*res)->answer_packet = q->msg; (*res)->answer_len = (int)q->msg_len; q->msg = NULL; - ldns_buffer_free(buf); + sldns_buffer_free(buf); regional_destroy(region); } q->res = NULL; @@ -590,6 +640,45 @@ ub_resolve(struct ub_ctx* ctx, const char* name, int rrtype, return UB_NOERROR; } +int +ub_resolve_event(struct ub_ctx* ctx, const char* name, int rrtype, + int rrclass, void* mydata, ub_event_callback_t callback, int* async_id) +{ + struct ctx_query* q; + int r; + + if(async_id) + *async_id = 0; + lock_basic_lock(&ctx->cfglock); + if(!ctx->finalized) { + int r = context_finalize(ctx); + if(r) { + lock_basic_unlock(&ctx->cfglock); + return r; + } + } + lock_basic_unlock(&ctx->cfglock); + if(!ctx->event_worker) { + ctx->event_worker = libworker_create_event(ctx, + ctx->event_base); + if(!ctx->event_worker) { + return UB_INITFAIL; + } + } + + /* create new ctx_query and attempt to add to the list */ + q = context_new(ctx, name, rrtype, rrclass, (ub_callback_t)callback, + mydata); + if(!q) + return UB_NOMEM; + + /* attach to mesh */ + if((r=libworker_attach_mesh(ctx, q, async_id)) != 0) + return r; + return UB_NOERROR; +} + + int ub_resolve_async(struct ub_ctx* ctx, const char* name, int rrtype, int rrclass, void* mydata, ub_callback_t callback, int* async_id) @@ -1016,7 +1105,8 @@ int ub_ctx_print_local_zones(struct ub_ctx* ctx) } /* Add a new zone */ -int ub_ctx_zone_add(struct ub_ctx* ctx, char *zone_name, char *zone_type) +int ub_ctx_zone_add(struct ub_ctx* ctx, const char *zone_name, + const char *zone_type) { enum localzone_type t; struct local_zone* z; @@ -1035,28 +1125,28 @@ int ub_ctx_zone_add(struct ub_ctx* ctx, char *zone_name, char *zone_type) return UB_SYNTAX; } - lock_quick_lock(&ctx->local_zones->lock); + lock_rw_wrlock(&ctx->local_zones->lock); if((z=local_zones_find(ctx->local_zones, nm, nmlen, nmlabs, LDNS_RR_CLASS_IN))) { /* already present in tree */ lock_rw_wrlock(&z->lock); z->type = t; /* update type anyway */ lock_rw_unlock(&z->lock); - lock_quick_unlock(&ctx->local_zones->lock); + lock_rw_unlock(&ctx->local_zones->lock); free(nm); return UB_NOERROR; } if(!local_zones_add_zone(ctx->local_zones, nm, nmlen, nmlabs, LDNS_RR_CLASS_IN, t)) { - lock_quick_unlock(&ctx->local_zones->lock); + lock_rw_unlock(&ctx->local_zones->lock); return UB_NOMEM; } - lock_quick_unlock(&ctx->local_zones->lock); + lock_rw_unlock(&ctx->local_zones->lock); return UB_NOERROR; } /* Remove zone */ -int ub_ctx_zone_remove(struct ub_ctx* ctx, char *zone_name) +int ub_ctx_zone_remove(struct ub_ctx* ctx, const char *zone_name) { struct local_zone* z; uint8_t* nm; @@ -1070,37 +1160,29 @@ int ub_ctx_zone_remove(struct ub_ctx* ctx, char *zone_name) return UB_SYNTAX; } - lock_quick_lock(&ctx->local_zones->lock); + lock_rw_wrlock(&ctx->local_zones->lock); if((z=local_zones_find(ctx->local_zones, nm, nmlen, nmlabs, LDNS_RR_CLASS_IN))) { /* present in tree */ local_zones_del_zone(ctx->local_zones, z); } - lock_quick_unlock(&ctx->local_zones->lock); + lock_rw_unlock(&ctx->local_zones->lock); free(nm); return UB_NOERROR; } /* Add new RR data */ -int ub_ctx_data_add(struct ub_ctx* ctx, char *data) +int ub_ctx_data_add(struct ub_ctx* ctx, const char *data) { - ldns_buffer* buf; int res = ub_ctx_finalize(ctx); if (res) return res; - lock_basic_lock(&ctx->cfglock); - buf = ldns_buffer_new(ctx->env->cfg->msg_buffer_size); - lock_basic_unlock(&ctx->cfglock); - if(!buf) return UB_NOMEM; - - res = local_zones_add_RR(ctx->local_zones, data, buf); - - ldns_buffer_free(buf); + res = local_zones_add_RR(ctx->local_zones, data); return (!res) ? UB_NOMEM : UB_NOERROR; } /* Remove RR data */ -int ub_ctx_data_remove(struct ub_ctx* ctx, char *data) +int ub_ctx_data_remove(struct ub_ctx* ctx, const char *data) { uint8_t* nm; int nmlabs; @@ -1122,3 +1204,24 @@ const char* ub_version(void) { return PACKAGE_VERSION; } + +int +ub_ctx_set_event(struct ub_ctx* ctx, struct event_base* base) { + if (!ctx || !ctx->event_base || !base) { + return UB_INITFAIL; + } + if (ctx->event_base == base) { + /* already set */ + return UB_NOERROR; + } + + lock_basic_lock(&ctx->cfglock); + /* destroy the current worker - safe to pass in NULL */ + libworker_delete_event(ctx->event_worker); + ctx->event_worker = NULL; + ctx->event_base = base; + ctx->created_bg = 0; + ctx->dothread = 1; + lock_basic_unlock(&ctx->cfglock); + return UB_NOERROR; +} diff --git a/contrib/unbound/libunbound/libworker.c b/contrib/unbound/libunbound/libworker.c index ffc4716df9f..fa5418063fe 100644 --- a/contrib/unbound/libunbound/libworker.c +++ b/contrib/unbound/libunbound/libworker.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -42,8 +42,6 @@ * returns from the procedure when done. */ #include "config.h" -#include -#include #ifdef HAVE_SSL #include #endif @@ -51,6 +49,7 @@ #include "libunbound/context.h" #include "libunbound/unbound.h" #include "libunbound/worker.h" +#include "libunbound/unbound-event.h" #include "services/outside_network.h" #include "services/mesh.h" #include "services/localzone.h" @@ -71,21 +70,22 @@ #include "util/tube.h" #include "iterator/iter_fwd.h" #include "iterator/iter_hints.h" +#include "ldns/sbuffer.h" +#include "ldns/str2wire.h" /** handle new query command for bg worker */ static void handle_newq(struct libworker* w, uint8_t* buf, uint32_t len); -/** delete libworker struct */ +/** delete libworker env */ static void -libworker_delete(struct libworker* w) +libworker_delete_env(struct libworker* w) { - if(!w) return; if(w->env) { outside_network_quit_prepare(w->back); mesh_delete(w->env->mesh); context_release_alloc(w->ctx, w->env->alloc, !w->is_bg || w->is_bg_thread); - ldns_buffer_free(w->env->scratch_buffer); + sldns_buffer_free(w->env->scratch_buffer); regional_destroy(w->env->scratch); forwards_delete(w->env->fwds); hints_delete(w->env->hints); @@ -96,13 +96,30 @@ libworker_delete(struct libworker* w) SSL_CTX_free(w->sslctx); #endif outside_network_delete(w->back); +} + +/** delete libworker struct */ +static void +libworker_delete(struct libworker* w) +{ + if(!w) return; + libworker_delete_env(w); comm_base_delete(w->base); free(w); } +void +libworker_delete_event(struct libworker* w) +{ + if(!w) return; + libworker_delete_env(w); + comm_base_delete_no_base(w->base); + free(w); +} + /** setup fresh libworker struct */ static struct libworker* -libworker_setup(struct ub_ctx* ctx, int is_bg) +libworker_setup(struct ub_ctx* ctx, int is_bg, struct event_base* eb) { unsigned int seed; struct libworker* w = (struct libworker*)calloc(1, sizeof(*w)); @@ -129,7 +146,7 @@ libworker_setup(struct ub_ctx* ctx, int is_bg) lock_basic_lock(&ctx->cfglock); } w->env->scratch = regional_create_custom(cfg->msg_buffer_size); - w->env->scratch_buffer = ldns_buffer_new(cfg->msg_buffer_size); + w->env->scratch_buffer = sldns_buffer_new(cfg->msg_buffer_size); w->env->fwds = forwards_create(); if(w->env->fwds && !forwards_apply_cfg(w->env->fwds, cfg)) { forwards_delete(w->env->fwds); @@ -190,7 +207,9 @@ libworker_setup(struct ub_ctx* ctx, int is_bg) } seed = 0; - w->base = comm_base_create(0); + if(eb) + w->base = comm_base_create_event(eb); + else w->base = comm_base_create(0); if(!w->base) { libworker_delete(w); return NULL; @@ -200,7 +219,11 @@ libworker_setup(struct ub_ctx* ctx, int is_bg) } numports = cfg_condense_ports(cfg, &ports); if(numports == 0) { + int locked = !w->is_bg || w->is_bg_thread; libworker_delete(w); + if(locked) { + lock_basic_unlock(&ctx->cfglock); + } return NULL; } w->back = outside_network_create(w->base, cfg->msg_buffer_size, @@ -209,7 +232,8 @@ libworker_setup(struct ub_ctx* ctx, int is_bg) cfg->do_tcp?cfg->outgoing_num_tcp:0, w->env->infra_cache, w->env->rnd, cfg->use_caps_bits_for_id, ports, numports, cfg->unwanted_threshold, - &libworker_alloc_cleanup, w, cfg->do_udp, w->sslctx); + &libworker_alloc_cleanup, w, cfg->do_udp, w->sslctx, + cfg->delay_close); if(!w->is_bg || w->is_bg_thread) { lock_basic_unlock(&ctx->cfglock); } @@ -232,6 +256,12 @@ libworker_setup(struct ub_ctx* ctx, int is_bg) return w; } +struct libworker* libworker_create_event(struct ub_ctx* ctx, + struct event_base* eb) +{ + return libworker_setup(ctx, 0, eb); +} + /** handle cancel command for bg worker */ static void handle_cancel(struct libworker* w, uint8_t* buf, uint32_t len) @@ -348,7 +378,7 @@ int libworker_bg(struct ub_ctx* ctx) lock_basic_lock(&ctx->cfglock); if(ctx->dothread) { lock_basic_unlock(&ctx->cfglock); - w = libworker_setup(ctx, 1); + w = libworker_setup(ctx, 1, NULL); if(!w) return UB_NOMEM; w->is_bg_thread = 1; #ifdef ENABLE_LOCK_CHECKS @@ -363,7 +393,7 @@ int libworker_bg(struct ub_ctx* ctx) #else /* HAVE_FORK */ switch((ctx->bg_pid=fork())) { case 0: - w = libworker_setup(ctx, 1); + w = libworker_setup(ctx, 1, NULL); if(!w) fatal_exit("out of memory"); /* close non-used parts of the pipes */ tube_close_write(ctx->qq_pipe); @@ -374,6 +404,11 @@ int libworker_bg(struct ub_ctx* ctx) case -1: return UB_FORKFAIL; default: + /* close non-used parts, so that the worker + * bgprocess gets 'pipe closed' when the + * main process exits */ + tube_close_read(ctx->qq_pipe); + tube_close_write(ctx->rr_pipe); break; } #endif /* HAVE_FORK */ @@ -383,7 +418,7 @@ int libworker_bg(struct ub_ctx* ctx) /** get msg reply struct (in temp region) */ static struct reply_info* -parse_reply(ldns_buffer* pkt, struct regional* region, struct query_info* qi) +parse_reply(sldns_buffer* pkt, struct regional* region, struct query_info* qi) { struct reply_info* rep; struct msg_parse* msg; @@ -391,7 +426,7 @@ parse_reply(ldns_buffer* pkt, struct regional* region, struct query_info* qi) return NULL; } memset(msg, 0, sizeof(*msg)); - ldns_buffer_set_position(pkt, 0); + sldns_buffer_set_position(pkt, 0); if(parse_packet(pkt, msg, region) != 0) return 0; if(!parse_create_msg(pkt, msg, NULL, qi, &rep, region)) { @@ -467,7 +502,7 @@ fill_res(struct ub_result* res, struct ub_packed_rrset_key* answer, /** fill result from parsed message, on error fills servfail */ void -libworker_enter_result(struct ub_result* res, ldns_buffer* buf, +libworker_enter_result(struct ub_result* res, sldns_buffer* buf, struct regional* temp, enum sec_status msg_security) { struct query_info rq; @@ -495,7 +530,7 @@ libworker_enter_result(struct ub_result* res, ldns_buffer* buf, /** fillup fg results */ static void -libworker_fillup_fg(struct ctx_query* q, int rcode, ldns_buffer* buf, +libworker_fillup_fg(struct ctx_query* q, int rcode, sldns_buffer* buf, enum sec_status s, char* why_bogus) { if(why_bogus) @@ -508,8 +543,8 @@ libworker_fillup_fg(struct ctx_query* q, int rcode, ldns_buffer* buf, q->res->rcode = LDNS_RCODE_SERVFAIL; q->msg_security = 0; - q->msg = memdup(ldns_buffer_begin(buf), ldns_buffer_limit(buf)); - q->msg_len = ldns_buffer_limit(buf); + q->msg = memdup(sldns_buffer_begin(buf), sldns_buffer_limit(buf)); + q->msg_len = sldns_buffer_limit(buf); if(!q->msg) { return; /* the error is in the rcode */ } @@ -520,7 +555,7 @@ libworker_fillup_fg(struct ctx_query* q, int rcode, ldns_buffer* buf, } void -libworker_fg_done_cb(void* arg, int rcode, ldns_buffer* buf, enum sec_status s, +libworker_fg_done_cb(void* arg, int rcode, sldns_buffer* buf, enum sec_status s, char* why_bogus) { struct ctx_query* q = (struct ctx_query*)arg; @@ -535,37 +570,26 @@ static int setup_qinfo_edns(struct libworker* w, struct ctx_query* q, struct query_info* qinfo, struct edns_data* edns) { - ldns_rdf* rdf; qinfo->qtype = (uint16_t)q->res->qtype; qinfo->qclass = (uint16_t)q->res->qclass; - rdf = ldns_dname_new_frm_str(q->res->qname); - if(!rdf) { + qinfo->qname = sldns_str2wire_dname(q->res->qname, &qinfo->qname_len); + if(!qinfo->qname) { return 0; } -#ifdef UNBOUND_ALLOC_LITE - qinfo->qname = memdup(ldns_rdf_data(rdf), ldns_rdf_size(rdf)); - qinfo->qname_len = ldns_rdf_size(rdf); - ldns_rdf_deep_free(rdf); - rdf = 0; -#else - qinfo->qname = ldns_rdf_data(rdf); - qinfo->qname_len = ldns_rdf_size(rdf); -#endif edns->edns_present = 1; edns->ext_rcode = 0; edns->edns_version = 0; edns->bits = EDNS_DO; - if(ldns_buffer_capacity(w->back->udp_buff) < 65535) - edns->udp_size = (uint16_t)ldns_buffer_capacity( + if(sldns_buffer_capacity(w->back->udp_buff) < 65535) + edns->udp_size = (uint16_t)sldns_buffer_capacity( w->back->udp_buff); else edns->udp_size = 65535; - ldns_rdf_free(rdf); return 1; } int libworker_fg(struct ub_ctx* ctx, struct ctx_query* q) { - struct libworker* w = libworker_setup(ctx, 0); + struct libworker* w = libworker_setup(ctx, 0, NULL); uint16_t qflags, qid; struct query_info qinfo; struct edns_data edns; @@ -579,8 +603,8 @@ int libworker_fg(struct ub_ctx* ctx, struct ctx_query* q) qflags = BIT_RD; q->w = w; /* see if there is a fixed answer */ - ldns_buffer_write_u16_at(w->back->udp_buff, 0, qid); - ldns_buffer_write_u16_at(w->back->udp_buff, 2, qflags); + sldns_buffer_write_u16_at(w->back->udp_buff, 0, qid); + sldns_buffer_write_u16_at(w->back->udp_buff, 2, qflags); if(local_zones_answer(ctx->local_zones, &qinfo, &edns, w->back->udp_buff, w->env->scratch)) { regional_free_all(w->env->scratch); @@ -605,9 +629,75 @@ int libworker_fg(struct ub_ctx* ctx, struct ctx_query* q) return UB_NOERROR; } +void +libworker_event_done_cb(void* arg, int rcode, sldns_buffer* buf, + enum sec_status s, char* why_bogus) +{ + struct ctx_query* q = (struct ctx_query*)arg; + ub_event_callback_t cb = (ub_event_callback_t)q->cb; + void* cb_arg = q->cb_arg; + int cancelled = q->cancelled; + + /* delete it now */ + struct ub_ctx* ctx = q->w->ctx; + lock_basic_lock(&ctx->cfglock); + (void)rbtree_delete(&ctx->queries, q->node.key); + ctx->num_async--; + context_query_delete(q); + lock_basic_unlock(&ctx->cfglock); + + if(!cancelled) { + /* call callback */ + int sec = 0; + if(s == sec_status_bogus) + sec = 1; + else if(s == sec_status_secure) + sec = 2; + (*cb)(cb_arg, rcode, (void*)sldns_buffer_begin(buf), + (int)sldns_buffer_limit(buf), sec, why_bogus); + } +} + +int libworker_attach_mesh(struct ub_ctx* ctx, struct ctx_query* q, + int* async_id) +{ + struct libworker* w = ctx->event_worker; + uint16_t qflags, qid; + struct query_info qinfo; + struct edns_data edns; + if(!w) + return UB_INITFAIL; + if(!setup_qinfo_edns(w, q, &qinfo, &edns)) + return UB_SYNTAX; + qid = 0; + qflags = BIT_RD; + q->w = w; + /* see if there is a fixed answer */ + sldns_buffer_write_u16_at(w->back->udp_buff, 0, qid); + sldns_buffer_write_u16_at(w->back->udp_buff, 2, qflags); + if(local_zones_answer(ctx->local_zones, &qinfo, &edns, + w->back->udp_buff, w->env->scratch)) { + regional_free_all(w->env->scratch); + free(qinfo.qname); + libworker_event_done_cb(q, LDNS_RCODE_NOERROR, + w->back->udp_buff, sec_status_insecure, NULL); + return UB_NOERROR; + } + /* process new query */ + if(async_id) + *async_id = q->querynum; + if(!mesh_new_callback(w->env->mesh, &qinfo, qflags, &edns, + w->back->udp_buff, qid, libworker_event_done_cb, q)) { + free(qinfo.qname); + return UB_NOMEM; + } + free(qinfo.qname); + return UB_NOERROR; +} + /** add result to the bg worker result queue */ static void -add_bg_result(struct libworker* w, struct ctx_query* q, ldns_buffer* pkt, +add_bg_result(struct libworker* w, struct ctx_query* q, sldns_buffer* pkt, int err, char* reason) { uint8_t* msg = NULL; @@ -619,8 +709,8 @@ add_bg_result(struct libworker* w, struct ctx_query* q, ldns_buffer* pkt, if(reason) q->res->why_bogus = strdup(reason); if(pkt) { - q->msg_len = ldns_buffer_remaining(pkt); - q->msg = memdup(ldns_buffer_begin(pkt), q->msg_len); + q->msg_len = sldns_buffer_remaining(pkt); + q->msg = memdup(sldns_buffer_begin(pkt), q->msg_len); if(!q->msg) msg = context_serialize_answer(q, UB_NOMEM, NULL, &len); @@ -648,7 +738,7 @@ add_bg_result(struct libworker* w, struct ctx_query* q, ldns_buffer* pkt, } void -libworker_bg_done_cb(void* arg, int rcode, ldns_buffer* buf, enum sec_status s, +libworker_bg_done_cb(void* arg, int rcode, sldns_buffer* buf, enum sec_status s, char* why_bogus) { struct ctx_query* q = (struct ctx_query*)arg; @@ -703,8 +793,8 @@ handle_newq(struct libworker* w, uint8_t* buf, uint32_t len) qid = 0; qflags = BIT_RD; /* see if there is a fixed answer */ - ldns_buffer_write_u16_at(w->back->udp_buff, 0, qid); - ldns_buffer_write_u16_at(w->back->udp_buff, 2, qflags); + sldns_buffer_write_u16_at(w->back->udp_buff, 0, qid); + sldns_buffer_write_u16_at(w->back->udp_buff, 2, qflags); if(local_zones_answer(w->ctx->local_zones, &qinfo, &edns, w->back->udp_buff, w->env->scratch)) { regional_free_all(w->env->scratch); @@ -766,10 +856,10 @@ libworker_handle_reply(struct comm_point* c, void* arg, int error, return 0; } /* sanity check. */ - if(!LDNS_QR_WIRE(ldns_buffer_begin(c->buffer)) - || LDNS_OPCODE_WIRE(ldns_buffer_begin(c->buffer)) != + if(!LDNS_QR_WIRE(sldns_buffer_begin(c->buffer)) + || LDNS_OPCODE_WIRE(sldns_buffer_begin(c->buffer)) != LDNS_PACKET_QUERY - || LDNS_QDCOUNT(ldns_buffer_begin(c->buffer)) > 1) { + || LDNS_QDCOUNT(sldns_buffer_begin(c->buffer)) > 1) { /* error becomes timeout for the module as if this reply * never arrived. */ mesh_report_reply(lw->env->mesh, &e, reply_info, @@ -792,10 +882,10 @@ libworker_handle_service_reply(struct comm_point* c, void* arg, int error, return 0; } /* sanity check. */ - if(!LDNS_QR_WIRE(ldns_buffer_begin(c->buffer)) - || LDNS_OPCODE_WIRE(ldns_buffer_begin(c->buffer)) != + if(!LDNS_QR_WIRE(sldns_buffer_begin(c->buffer)) + || LDNS_OPCODE_WIRE(sldns_buffer_begin(c->buffer)) != LDNS_PACKET_QUERY - || LDNS_QDCOUNT(ldns_buffer_begin(c->buffer)) > 1) { + || LDNS_QDCOUNT(sldns_buffer_begin(c->buffer)) > 1) { /* error becomes timeout for the module as if this reply * never arrived. */ mesh_report_reply(lw->env->mesh, e, reply_info, diff --git a/contrib/unbound/libunbound/libworker.h b/contrib/unbound/libunbound/libworker.h index 86b187ad80e..0103b5d8898 100644 --- a/contrib/unbound/libunbound/libworker.h +++ b/contrib/unbound/libunbound/libworker.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -57,6 +57,8 @@ struct comm_point; struct comm_reply; struct regional; struct tube; +struct sldns_buffer; +struct event_base; /** * The library-worker status structure @@ -106,6 +108,31 @@ int libworker_bg(struct ub_ctx* ctx); */ int libworker_fg(struct ub_ctx* ctx, struct ctx_query* q); +/** + * create worker for event-based interface. + * @param ctx: context with config. + * @param eb: event base. + * @return new worker or NULL. + */ +struct libworker* libworker_create_event(struct ub_ctx* ctx, + struct event_base* eb); + +/** + * Attach context_query to mesh for callback in event-driven setup. + * @param ctx: context + * @param q: context query entry + * @param async_id: store query num if query takes long. + * @return 0 if finished OK, else error. + */ +int libworker_attach_mesh(struct ub_ctx* ctx, struct ctx_query* q, + int* async_id); + +/** + * delete worker for event-based interface. does not free the event_base. + * @param w: event-based worker to delete. + */ +void libworker_delete_event(struct libworker* w); + /** cleanup the cache to remove all rrset IDs from it, arg is libworker */ void libworker_alloc_cleanup(void* arg); @@ -118,7 +145,7 @@ void libworker_alloc_cleanup(void* arg); * On error, the res may contain a different status * (out of memory is not secure, not bogus). */ -void libworker_enter_result(struct ub_result* res, ldns_buffer* buf, +void libworker_enter_result(struct ub_result* res, struct sldns_buffer* buf, struct regional* temp, enum sec_status msg_security); #endif /* LIBUNBOUND_LIBWORKER_H */ diff --git a/contrib/unbound/libunbound/ubsyms.def b/contrib/unbound/libunbound/ubsyms.def index 7e3fdd1e25e..866c1764cf7 100644 --- a/contrib/unbound/libunbound/ubsyms.def +++ b/contrib/unbound/libunbound/ubsyms.def @@ -1,4 +1,5 @@ ub_ctx_create +ub_ctx_create_event ub_ctx_delete ub_ctx_get_option ub_ctx_set_option @@ -18,6 +19,7 @@ ub_fd ub_process ub_resolve ub_resolve_async +ub_resolve_event ub_cancel ub_resolve_free ub_strerror @@ -27,3 +29,4 @@ ub_ctx_zone_remove ub_ctx_data_add ub_ctx_data_remove ub_version +ub_ctx_set_event diff --git a/contrib/unbound/libunbound/unbound-event.h b/contrib/unbound/libunbound/unbound-event.h new file mode 100644 index 00000000000..b80de38de14 --- /dev/null +++ b/contrib/unbound/libunbound/unbound-event.h @@ -0,0 +1,135 @@ +/* + * unbound-event.h - unbound validating resolver public API with events + * + * Copyright (c) 2007, NLnet Labs. All rights reserved. + * + * This software is open source. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 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. + * + * Neither the name of the NLNET LABS 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 COPYRIGHT HOLDERS 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 COPYRIGHT + * HOLDER 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. + */ + +/** + * \file + * + * This file contains the unbound interface for use with libevent. + * You have to use the same libevent that unbound was compiled with, + * otherwise it wouldn't work, the event and event_base structures would + * be different. If unbound is compiled without libevent support then + * this header file is not supposed to be installed on the system. + * + * Use ub_ctx_create_event_base() to create an unbound context that uses + * the event base that you have made. Then, use the ub_resolve_event call + * to add DNS resolve queries to the context. Those then run when you + * call event_dispatch() on your event_base, and when they are done you + * get a function callback. + * + * This method does not fork another process or create a thread, the effort + * is done by the unbound state machines that are connected to the event_base. + */ +#ifndef _UB_UNBOUND_EVENT_H +#define _UB_UNBOUND_EVENT_H + +#ifdef __cplusplus +extern "C" { +#endif + +struct ub_ctx; +struct ub_result; +struct event_base; + +typedef void (*ub_event_callback_t)(void*, int, void*, int, int, char*); + +/** + * Create a resolving and validation context. + * The information from /etc/resolv.conf and /etc/hosts is not utilised by + * default. Use ub_ctx_resolvconf and ub_ctx_hosts to read them. + * @param base: the event base that the caller has created. The unbound + * context uses this event base. + * @return a new context. default initialisation. + * returns NULL on error. + * You must use ub_resolve_event with this context. + * Do not call ub_ctx_async, ub_poll, ub_wait, ub_process, this is all done + * with the event_base. Setup the options you like with the other functions. + */ +struct ub_ctx* ub_ctx_create_event(struct event_base* base); + +/** + * Set a new event_base on a context created with ub_ctx_create_event. + * Any outbound queries will be canceled. + * @param ctx the ub_ctx to update. Must have been created with ub_ctx_create_event + * @param base the new event_base to attach to the ctx + * @return 0 if OK, else error + */ +int ub_ctx_set_event(struct ub_ctx* ctx, struct event_base* base); + +/** + * Perform resolution and validation of the target name. + * Asynchronous, after a while, the callback will be called with your + * data and the result. Uses the event_base user installed by creating the + * context with ub_ctx_create_event(). + * @param ctx: context with event_base in it. + * The context is finalized, and can no longer accept all config changes. + * @param name: domain name in text format (a string). + * @param rrtype: type of RR in host order, 1 is A. + * @param rrclass: class of RR in host order, 1 is IN (for internet). + * @param mydata: this data is your own data (you can pass NULL), + * and is passed on to the callback function. + * @param callback: this is called on completion of the resolution. + * It is called as: + * void callback(void* mydata, int rcode, void* packet, int packet_len, + * int sec, char* why_bogus) + * with mydata: the same as passed here, you may pass NULL, + * with rcode: 0 on no error, nonzero for mostly SERVFAIL situations, + * this is a DNS rcode. + * with packet: a buffer with DNS wireformat packet with the answer. + * do not inspect if rcode != 0. + * do not write or free the packet buffer, it is used internally + * in unbound (for other callbacks that want the same data). + * with packet_len: length in bytes of the packet buffer. + * with sec: 0 if insecure, 1 if bogus, 2 if DNSSEC secure. + * with why_bogus: text string explaining why it is bogus (or NULL). + * These point to buffers inside unbound; do not deallocate the packet or + * error string. + * + * If an error happens during processing, your callback will be called + * with error set to a nonzero value (and result==NULL). + * For localdata (etc/hosts) the callback is called immediately, before + * resolve_event returns, async_id=0 is returned. + * @param async_id: if you pass a non-NULL value, an identifier number is + * returned for the query as it is in progress. It can be used to + * cancel the query. + * @return 0 if OK, else error. + */ +int ub_resolve_event(struct ub_ctx* ctx, const char* name, int rrtype, + int rrclass, void* mydata, ub_event_callback_t callback, int* async_id); + +#ifdef __cplusplus +} +#endif + +#endif /* _UB_UNBOUND_H */ diff --git a/contrib/unbound/libunbound/unbound.h b/contrib/unbound/libunbound/unbound.h index 1de9566029a..86bd3bfb444 100644 --- a/contrib/unbound/libunbound/unbound.h +++ b/contrib/unbound/libunbound/unbound.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -78,6 +78,10 @@ * ... same as async for non-threaded * ... the callbacks are called in the thread that calls process(ctx) * + * Openssl needs to have locking in place, and the application must set + * it up, because a mere library cannot do this, use the calls + * CRYPTO_set_id_callback and CRYPTO_set_locking_callback. + * * If no threading is compiled in, the above async example uses fork(2) to * create a process to perform the work. The forked process exits when the * calling process exits, or ctx_delete() is called. @@ -97,6 +101,11 @@ extern "C" { #endif +/** the version of this header file */ +#define UNBOUND_VERSION_MAJOR @UNBOUND_VERSION_MAJOR@ +#define UNBOUND_VERSION_MINOR @UNBOUND_VERSION_MINOR@ +#define UNBOUND_VERSION_MICRO @UNBOUND_VERSION_MICRO@ + /** * The validation context is created to hold the resolver status, * validation keys and a small cache (containing messages, rrsets, @@ -520,7 +529,8 @@ int ub_ctx_print_local_zones(struct ub_ctx* ctx); * @param zone_type: type of the zone (like for unbound.conf) in text. * @return 0 if OK, else error. */ -int ub_ctx_zone_add(struct ub_ctx* ctx, char *zone_name, char *zone_type); +int ub_ctx_zone_add(struct ub_ctx* ctx, const char *zone_name, + const char *zone_type); /** * Remove zone from local authority info of the library. @@ -529,7 +539,7 @@ int ub_ctx_zone_add(struct ub_ctx* ctx, char *zone_name, char *zone_type); * If it does not exist, nothing happens. * @return 0 if OK, else error. */ -int ub_ctx_zone_remove(struct ub_ctx* ctx, char *zone_name); +int ub_ctx_zone_remove(struct ub_ctx* ctx, const char *zone_name); /** * Add localdata to the library local authority info. @@ -539,7 +549,7 @@ int ub_ctx_zone_remove(struct ub_ctx* ctx, char *zone_name); * "www.example.com IN A 127.0.0.1" * @return 0 if OK, else error. */ -int ub_ctx_data_add(struct ub_ctx* ctx, char *data); +int ub_ctx_data_add(struct ub_ctx* ctx, const char *data); /** * Remove localdata from the library local authority info. @@ -547,7 +557,7 @@ int ub_ctx_data_add(struct ub_ctx* ctx, char *data); * @param data: the name to delete all data from, like "www.example.com". * @return 0 if OK, else error. */ -int ub_ctx_data_remove(struct ub_ctx* ctx, char *data); +int ub_ctx_data_remove(struct ub_ctx* ctx, const char *data); /** * Get a version string from the libunbound implementation. diff --git a/contrib/unbound/libunbound/worker.h b/contrib/unbound/libunbound/worker.h index bdcb0338cab..d8354c65438 100644 --- a/contrib/unbound/libunbound/worker.h +++ b/contrib/unbound/libunbound/worker.h @@ -42,6 +42,7 @@ #ifndef LIBUNBOUND_WORKER_H #define LIBUNBOUND_WORKER_H +#include "ldns/sbuffer.h" #include "util/data/packed_rrset.h" /* for enum sec_status */ struct comm_reply; struct comm_point; @@ -83,11 +84,15 @@ void libworker_handle_control_cmd(struct tube* tube, uint8_t* msg, size_t len, int err, void* arg); /** mesh callback with fg results */ -void libworker_fg_done_cb(void* arg, int rcode, ldns_buffer* buf, +void libworker_fg_done_cb(void* arg, int rcode, sldns_buffer* buf, enum sec_status s, char* why_bogus); /** mesh callback with bg results */ -void libworker_bg_done_cb(void* arg, int rcode, ldns_buffer* buf, +void libworker_bg_done_cb(void* arg, int rcode, sldns_buffer* buf, + enum sec_status s, char* why_bogus); + +/** mesh callback with event results */ +void libworker_event_done_cb(void* arg, int rcode, struct sldns_buffer* buf, enum sec_status s, char* why_bogus); /** diff --git a/contrib/unbound/services/cache/dns.c b/contrib/unbound/services/cache/dns.c index 6e99b7fa4a8..f2a04a227cb 100644 --- a/contrib/unbound/services/cache/dns.c +++ b/contrib/unbound/services/cache/dns.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -50,6 +50,7 @@ #include "util/net_help.h" #include "util/regional.h" #include "util/config_file.h" +#include "ldns/sbuffer.h" /** store rrsets in the rrset cache. * @param env: module environment with caches. @@ -66,8 +67,8 @@ * @param region: for qrep allocs. */ static void -store_rrsets(struct module_env* env, struct reply_info* rep, uint32_t now, - uint32_t leeway, int pside, struct reply_info* qrep, +store_rrsets(struct module_env* env, struct reply_info* rep, time_t now, + time_t leeway, int pside, struct reply_info* qrep, struct regional* region) { size_t i; @@ -105,11 +106,11 @@ store_rrsets(struct module_env* env, struct reply_info* rep, uint32_t now, void dns_cache_store_msg(struct module_env* env, struct query_info* qinfo, - hashvalue_t hash, struct reply_info* rep, uint32_t leeway, int pside, + hashvalue_t hash, struct reply_info* rep, time_t leeway, int pside, struct reply_info* qrep, struct regional* region) { struct msgreply_entry* e; - uint32_t ttl = rep->ttl; + time_t ttl = rep->ttl; size_t i; /* store RRsets */ @@ -142,7 +143,7 @@ dns_cache_store_msg(struct module_env* env, struct query_info* qinfo, /** find closest NS or DNAME and returns the rrset (locked) */ static struct ub_packed_rrset_key* find_closest_of_type(struct module_env* env, uint8_t* qname, size_t qnamelen, - uint16_t qclass, uint32_t now, uint16_t searchtype, int stripfront) + uint16_t qclass, time_t now, uint16_t searchtype, int stripfront) { struct ub_packed_rrset_key *rrset; uint8_t lablen; @@ -171,7 +172,7 @@ find_closest_of_type(struct module_env* env, uint8_t* qname, size_t qnamelen, /** add addr to additional section */ static void addr_to_additional(struct ub_packed_rrset_key* rrset, struct regional* region, - struct dns_msg* msg, uint32_t now) + struct dns_msg* msg, time_t now) { if((msg->rep->rrsets[msg->rep->rrset_count] = packed_rrset_copy_region(rrset, region, now))) { @@ -183,7 +184,7 @@ addr_to_additional(struct ub_packed_rrset_key* rrset, struct regional* region, /** lookup message in message cache */ static struct msgreply_entry* msg_cache_lookup(struct module_env* env, uint8_t* qname, size_t qnamelen, - uint16_t qtype, uint16_t qclass, uint32_t now, int wr) + uint16_t qtype, uint16_t qclass, time_t now, int wr) { struct lruhash_entry* e; struct query_info k; @@ -207,7 +208,7 @@ msg_cache_lookup(struct module_env* env, uint8_t* qname, size_t qnamelen, /** find and add A and AAAA records for nameservers in delegpt */ static int find_add_addrs(struct module_env* env, uint16_t qclass, - struct regional* region, struct delegpt* dp, uint32_t now, + struct regional* region, struct delegpt* dp, time_t now, struct dns_msg** msg) { struct delegpt_ns* ns; @@ -262,12 +263,12 @@ cache_fill_missing(struct module_env* env, uint16_t qclass, struct delegpt_ns* ns; struct msgreply_entry* neg; struct ub_packed_rrset_key* akey; - uint32_t now = *env->now; + time_t now = *env->now; for(ns = dp->nslist; ns; ns = ns->next) { akey = rrset_cache_lookup(env->rrset_cache, ns->name, ns->namelen, LDNS_RR_TYPE_A, qclass, 0, now, 0); if(akey) { - if(!delegpt_add_rrset_A(dp, region, akey, (int)ns->lame)) { + if(!delegpt_add_rrset_A(dp, region, akey, ns->lame)) { lock_rw_unlock(&akey->entry.lock); return 0; } @@ -285,7 +286,7 @@ cache_fill_missing(struct module_env* env, uint16_t qclass, akey = rrset_cache_lookup(env->rrset_cache, ns->name, ns->namelen, LDNS_RR_TYPE_AAAA, qclass, 0, now, 0); if(akey) { - if(!delegpt_add_rrset_AAAA(dp, region, akey, (int)ns->lame)) { + if(!delegpt_add_rrset_AAAA(dp, region, akey, ns->lame)) { lock_rw_unlock(&akey->entry.lock); return 0; } @@ -307,7 +308,7 @@ cache_fill_missing(struct module_env* env, uint16_t qclass, /** find and add DS or NSEC to delegation msg */ static void find_add_ds(struct module_env* env, struct regional* region, - struct dns_msg* msg, struct delegpt* dp, uint32_t now) + struct dns_msg* msg, struct delegpt* dp, time_t now) { /* Lookup the DS or NSEC at the delegation point. */ struct ub_packed_rrset_key* rrset = rrset_cache_lookup( @@ -369,7 +370,7 @@ dns_msg_create(uint8_t* qname, size_t qnamelen, uint16_t qtype, int dns_msg_authadd(struct dns_msg* msg, struct regional* region, - struct ub_packed_rrset_key* rrset, uint32_t now) + struct ub_packed_rrset_key* rrset, time_t now) { if(!(msg->rep->rrsets[msg->rep->rrset_count++] = packed_rrset_copy_region(rrset, region, now))) @@ -381,7 +382,7 @@ dns_msg_authadd(struct dns_msg* msg, struct regional* region, struct delegpt* dns_cache_find_delegation(struct module_env* env, uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, - struct regional* region, struct dns_msg** msg, uint32_t now) + struct regional* region, struct dns_msg** msg, time_t now) { /* try to find closest NS rrset */ struct ub_packed_rrset_key* nskey; @@ -455,7 +456,7 @@ gen_dns_msg(struct regional* region, struct query_info* q, size_t num) /** generate dns_msg from cached message */ static struct dns_msg* tomsg(struct module_env* env, struct query_info* q, struct reply_info* r, - struct regional* region, uint32_t now, struct regional* scratch) + struct regional* region, time_t now, struct regional* scratch) { struct dns_msg* msg; size_t i; @@ -506,7 +507,7 @@ tomsg(struct module_env* env, struct query_info* q, struct reply_info* r, /** synthesize RRset-only response from cached RRset item */ static struct dns_msg* rrset_msg(struct ub_packed_rrset_key* rrset, struct regional* region, - uint32_t now, struct query_info* q) + time_t now, struct query_info* q) { struct dns_msg* msg; struct packed_rrset_data* d = (struct packed_rrset_data*) @@ -535,7 +536,7 @@ rrset_msg(struct ub_packed_rrset_key* rrset, struct regional* region, /** synthesize DNAME+CNAME response from cached DNAME item */ static struct dns_msg* synth_dname_msg(struct ub_packed_rrset_key* rrset, struct regional* region, - uint32_t now, struct query_info* q) + time_t now, struct query_info* q) { struct dns_msg* msg; struct ub_packed_rrset_key* ck; @@ -599,7 +600,7 @@ synth_dname_msg(struct ub_packed_rrset_key* rrset, struct regional* region, ck->entry.hash = rrset_key_hash(&ck->rk); newd = (struct packed_rrset_data*)regional_alloc_zero(region, sizeof(struct packed_rrset_data) + sizeof(size_t) + - sizeof(uint8_t*) + sizeof(uint32_t) + sizeof(uint16_t) + sizeof(uint8_t*) + sizeof(time_t) + sizeof(uint16_t) + newlen); if(!newd) return NULL; @@ -615,7 +616,7 @@ synth_dname_msg(struct ub_packed_rrset_key* rrset, struct regional* region, newd->rr_ttl[0] = newd->ttl; msg->rep->ttl = newd->ttl; msg->rep->prefetch_ttl = PREFETCH_TTL_CALC(newd->ttl); - ldns_write_uint16(newd->rr_data[0], newlen); + sldns_write_uint16(newd->rr_data[0], newlen); memmove(newd->rr_data[0] + sizeof(uint16_t), newname, newlen); msg->rep->an_numrrsets ++; msg->rep->rrset_count ++; @@ -630,7 +631,7 @@ dns_cache_lookup(struct module_env* env, struct lruhash_entry* e; struct query_info k; hashvalue_t h; - uint32_t now = *env->now; + time_t now = *env->now; struct ub_packed_rrset_key* rrset; /* lookup first, this has both NXdomains and ANSWER responses */ @@ -739,7 +740,7 @@ dns_cache_lookup(struct module_env* env, int dns_cache_store(struct module_env* env, struct query_info* msgqinf, - struct reply_info* msgrep, int is_referral, uint32_t leeway, int pside, + struct reply_info* msgrep, int is_referral, time_t leeway, int pside, struct regional* region) { struct reply_info* rep = NULL; diff --git a/contrib/unbound/services/cache/dns.h b/contrib/unbound/services/cache/dns.h index bc9f57c9c0d..a7a6190cffb 100644 --- a/contrib/unbound/services/cache/dns.h +++ b/contrib/unbound/services/cache/dns.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -82,7 +82,7 @@ struct dns_msg { * @return 0 on alloc error (out of memory). */ int dns_cache_store(struct module_env* env, struct query_info* qinf, - struct reply_info* rep, int is_referral, uint32_t leeway, int pside, + struct reply_info* rep, int is_referral, time_t leeway, int pside, struct regional* region); /** @@ -105,7 +105,7 @@ int dns_cache_store(struct module_env* env, struct query_info* qinf, * @param region: to allocate into for qmsg. */ void dns_cache_store_msg(struct module_env* env, struct query_info* qinfo, - hashvalue_t hash, struct reply_info* rep, uint32_t leeway, int pside, + hashvalue_t hash, struct reply_info* rep, time_t leeway, int pside, struct reply_info* qrep, struct regional* region); /** @@ -123,7 +123,7 @@ void dns_cache_store_msg(struct module_env* env, struct query_info* qinfo, */ struct delegpt* dns_cache_find_delegation(struct module_env* env, uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, - struct regional* region, struct dns_msg** msg, uint32_t timenow); + struct regional* region, struct dns_msg** msg, time_t timenow); /** * Find cached message @@ -177,6 +177,6 @@ struct dns_msg* dns_msg_create(uint8_t* qname, size_t qnamelen, uint16_t qtype, * @return true if worked, false on fail */ int dns_msg_authadd(struct dns_msg* msg, struct regional* region, - struct ub_packed_rrset_key* rrset, uint32_t now); + struct ub_packed_rrset_key* rrset, time_t now); #endif /* SERVICES_CACHE_DNS_H */ diff --git a/contrib/unbound/services/cache/infra.c b/contrib/unbound/services/cache/infra.c index c674aca6675..07f2103d756 100644 --- a/contrib/unbound/services/cache/infra.c +++ b/contrib/unbound/services/cache/infra.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -39,7 +39,7 @@ * This file contains the infrastructure cache. */ #include "config.h" -#include +#include "ldns/rrdef.h" #include "services/cache/infra.h" #include "util/storage/slabhash.h" #include "util/storage/lookup3.h" @@ -189,7 +189,7 @@ infra_lookup_nottl(struct infra_cache* infra, struct sockaddr_storage* addr, /** init the data elements */ static void data_entry_init(struct infra_cache* infra, struct lruhash_entry* e, - uint32_t timenow) + time_t timenow) { struct infra_data* data = (struct infra_data*)e->data; data->ttl = timenow + infra->host_ttl; @@ -218,7 +218,7 @@ data_entry_init(struct infra_cache* infra, struct lruhash_entry* e, */ static struct lruhash_entry* new_entry(struct infra_cache* infra, struct sockaddr_storage* addr, - socklen_t addrlen, uint8_t* name, size_t namelen, uint32_t tm) + socklen_t addrlen, uint8_t* name, size_t namelen, time_t tm) { struct infra_data* data; struct infra_key* key = (struct infra_key*)malloc(sizeof(*key)); @@ -248,7 +248,7 @@ new_entry(struct infra_cache* infra, struct sockaddr_storage* addr, int infra_host(struct infra_cache* infra, struct sockaddr_storage* addr, - socklen_t addrlen, uint8_t* nm, size_t nmlen, uint32_t timenow, + socklen_t addrlen, uint8_t* nm, size_t nmlen, time_t timenow, int* edns_vs, uint8_t* edns_lame_known, int* to) { struct lruhash_entry* e = infra_lookup_nottl(infra, addr, addrlen, @@ -317,7 +317,7 @@ infra_host(struct infra_cache* infra, struct sockaddr_storage* addr, int infra_set_lame(struct infra_cache* infra, struct sockaddr_storage* addr, - socklen_t addrlen, uint8_t* nm, size_t nmlen, uint32_t timenow, + socklen_t addrlen, uint8_t* nm, size_t nmlen, time_t timenow, int dnsseclame, int reclame, uint16_t qtype) { struct infra_data* data; @@ -374,7 +374,7 @@ infra_update_tcp_works(struct infra_cache* infra, int infra_rtt_update(struct infra_cache* infra, struct sockaddr_storage* addr, socklen_t addrlen, uint8_t* nm, size_t nmlen, int qtype, - int roundtrip, int orig_rtt, uint32_t timenow) + int roundtrip, int orig_rtt, time_t timenow) { struct lruhash_entry* e = infra_lookup_nottl(infra, addr, addrlen, nm, nmlen, 1); @@ -425,19 +425,19 @@ infra_rtt_update(struct infra_cache* infra, struct sockaddr_storage* addr, return rto; } -int infra_get_host_rto(struct infra_cache* infra, +long long infra_get_host_rto(struct infra_cache* infra, struct sockaddr_storage* addr, socklen_t addrlen, uint8_t* nm, - size_t nmlen, struct rtt_info* rtt, int* delay, uint32_t timenow, + size_t nmlen, struct rtt_info* rtt, int* delay, time_t timenow, int* tA, int* tAAAA, int* tother) { struct lruhash_entry* e = infra_lookup_nottl(infra, addr, addrlen, nm, nmlen, 0); struct infra_data* data; - int ttl = -2; + long long ttl = -2; if(!e) return -1; data = (struct infra_data*)e->data; if(data->ttl >= timenow) { - ttl = (int)(data->ttl - timenow); + ttl = (long long)(data->ttl - timenow); memmove(rtt, &data->rtt, sizeof(*rtt)); if(timenow < data->probedelay) *delay = (int)(data->probedelay - timenow); @@ -453,7 +453,7 @@ int infra_get_host_rto(struct infra_cache* infra, int infra_edns_update(struct infra_cache* infra, struct sockaddr_storage* addr, socklen_t addrlen, uint8_t* nm, size_t nmlen, int edns_version, - uint32_t timenow) + time_t timenow) { struct lruhash_entry* e = infra_lookup_nottl(infra, addr, addrlen, nm, nmlen, 1); @@ -485,7 +485,7 @@ int infra_get_lame_rtt(struct infra_cache* infra, struct sockaddr_storage* addr, socklen_t addrlen, uint8_t* name, size_t namelen, uint16_t qtype, - int* lame, int* dnsseclame, int* reclame, int* rtt, uint32_t timenow) + int* lame, int* dnsseclame, int* reclame, int* rtt, time_t timenow) { struct infra_data* host; struct lruhash_entry* e = infra_lookup_nottl(infra, addr, addrlen, diff --git a/contrib/unbound/services/cache/infra.h b/contrib/unbound/services/cache/infra.h index 161f5ab4319..fc54f7f0df0 100644 --- a/contrib/unbound/services/cache/infra.h +++ b/contrib/unbound/services/cache/infra.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -68,10 +68,10 @@ struct infra_key { */ struct infra_data { /** TTL value for this entry. absolute time. */ - uint32_t ttl; + time_t ttl; /** time in seconds (absolute) when probing re-commences, 0 disabled */ - uint32_t probedelay; + time_t probedelay; /** round trip times for timeout calculation */ struct rtt_info rtt; @@ -173,7 +173,7 @@ struct lruhash_entry* infra_lookup_nottl(struct infra_cache* infra, */ int infra_host(struct infra_cache* infra, struct sockaddr_storage* addr, socklen_t addrlen, uint8_t* name, size_t namelen, - uint32_t timenow, int* edns_vs, uint8_t* edns_lame_known, int* to); + time_t timenow, int* edns_vs, uint8_t* edns_lame_known, int* to); /** * Set a host to be lame for the given zone. @@ -192,7 +192,7 @@ int infra_host(struct infra_cache* infra, struct sockaddr_storage* addr, */ int infra_set_lame(struct infra_cache* infra, struct sockaddr_storage* addr, socklen_t addrlen, - uint8_t* name, size_t namelen, uint32_t timenow, int dnsseclame, + uint8_t* name, size_t namelen, time_t timenow, int dnsseclame, int reclame, uint16_t qtype); /** @@ -212,7 +212,7 @@ int infra_set_lame(struct infra_cache* infra, */ int infra_rtt_update(struct infra_cache* infra, struct sockaddr_storage* addr, socklen_t addrlen, uint8_t* name, size_t namelen, int qtype, - int roundtrip, int orig_rtt, uint32_t timenow); + int roundtrip, int orig_rtt, time_t timenow); /** * Update information for the host, store that a TCP transaction works. @@ -240,7 +240,7 @@ void infra_update_tcp_works(struct infra_cache* infra, */ int infra_edns_update(struct infra_cache* infra, struct sockaddr_storage* addr, socklen_t addrlen, - uint8_t* name, size_t namelen, int edns_version, uint32_t timenow); + uint8_t* name, size_t namelen, int edns_version, time_t timenow); /** * Get Lameness information and average RTT if host is in the cache. @@ -263,7 +263,7 @@ int infra_edns_update(struct infra_cache* infra, int infra_get_lame_rtt(struct infra_cache* infra, struct sockaddr_storage* addr, socklen_t addrlen, uint8_t* name, size_t namelen, uint16_t qtype, - int* lame, int* dnsseclame, int* reclame, int* rtt, uint32_t timenow); + int* lame, int* dnsseclame, int* reclame, int* rtt, time_t timenow); /** * Get additional (debug) info on timing. @@ -281,9 +281,9 @@ int infra_get_lame_rtt(struct infra_cache* infra, * @return TTL the infra host element is valid for. If -1: not found in cache. * TTL -2: found but expired. */ -int infra_get_host_rto(struct infra_cache* infra, +long long infra_get_host_rto(struct infra_cache* infra, struct sockaddr_storage* addr, socklen_t addrlen, uint8_t* name, - size_t namelen, struct rtt_info* rtt, int* delay, uint32_t timenow, + size_t namelen, struct rtt_info* rtt, int* delay, time_t timenow, int* tA, int* tAAAA, int* tother); /** diff --git a/contrib/unbound/services/cache/rrset.c b/contrib/unbound/services/cache/rrset.c index b9d20db0e5d..5f52dbce194 100644 --- a/contrib/unbound/services/cache/rrset.c +++ b/contrib/unbound/services/cache/rrset.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -40,6 +40,7 @@ */ #include "config.h" #include "services/cache/rrset.h" +#include "ldns/rrdef.h" #include "util/storage/slabhash.h" #include "util/config_file.h" #include "util/data/packed_rrset.h" @@ -120,7 +121,7 @@ rrset_cache_touch(struct rrset_cache* r, struct ub_packed_rrset_key* key, /** see if rrset needs to be updated in the cache */ static int -need_to_update_rrset(void* nd, void* cd, uint32_t timenow, int equal, int ns) +need_to_update_rrset(void* nd, void* cd, time_t timenow, int equal, int ns) { struct packed_rrset_data* newd = (struct packed_rrset_data*)nd; struct packed_rrset_data* cached = (struct packed_rrset_data*)cd; @@ -181,7 +182,7 @@ rrset_update_id(struct rrset_ref* ref, struct alloc_cache* alloc) int rrset_cache_update(struct rrset_cache* r, struct rrset_ref* ref, - struct alloc_cache* alloc, uint32_t timenow) + struct alloc_cache* alloc, time_t timenow) { struct lruhash_entry* e; struct ub_packed_rrset_key* k = ref->key; @@ -237,7 +238,7 @@ rrset_cache_update(struct rrset_cache* r, struct rrset_ref* ref, struct ub_packed_rrset_key* rrset_cache_lookup(struct rrset_cache* r, uint8_t* qname, size_t qnamelen, - uint16_t qtype, uint16_t qclass, uint32_t flags, uint32_t timenow, + uint16_t qtype, uint16_t qclass, uint32_t flags, time_t timenow, int wr) { struct lruhash_entry* e; @@ -268,7 +269,7 @@ rrset_cache_lookup(struct rrset_cache* r, uint8_t* qname, size_t qnamelen, } int -rrset_array_lock(struct rrset_ref* ref, size_t count, uint32_t timenow) +rrset_array_lock(struct rrset_ref* ref, size_t count, time_t timenow) { size_t i; for(i=0; ientry.data; @@ -366,7 +367,7 @@ rrset_update_sec_status(struct rrset_cache* r, void rrset_check_sec_status(struct rrset_cache* r, - struct ub_packed_rrset_key* rrset, uint32_t now) + struct ub_packed_rrset_key* rrset, time_t now) { struct packed_rrset_data* updata = (struct packed_rrset_data*)rrset->entry.data; diff --git a/contrib/unbound/services/cache/rrset.h b/contrib/unbound/services/cache/rrset.h index 22d36719eaf..98e44a4e526 100644 --- a/contrib/unbound/services/cache/rrset.h +++ b/contrib/unbound/services/cache/rrset.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -131,7 +131,7 @@ void rrset_cache_touch(struct rrset_cache* r, struct ub_packed_rrset_key* key, * also the rdata is equal (but other parameters in cache are superior). */ int rrset_cache_update(struct rrset_cache* r, struct rrset_ref* ref, - struct alloc_cache* alloc, uint32_t timenow); + struct alloc_cache* alloc, time_t timenow); /** * Lookup rrset. You obtain read/write lock. You must unlock before lookup @@ -149,7 +149,7 @@ int rrset_cache_update(struct rrset_cache* r, struct rrset_ref* ref, */ struct ub_packed_rrset_key* rrset_cache_lookup(struct rrset_cache* r, uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, - uint32_t flags, uint32_t timenow, int wr); + uint32_t flags, time_t timenow, int wr); /** * Obtain readlock on a (sorted) list of rrset references. @@ -163,7 +163,7 @@ struct ub_packed_rrset_key* rrset_cache_lookup(struct rrset_cache* r, * RRsets have been purged from the cache. * If true, you hold readlocks on all the ref items. */ -int rrset_array_lock(struct rrset_ref* ref, size_t count, uint32_t timenow); +int rrset_array_lock(struct rrset_ref* ref, size_t count, time_t timenow); /** * Unlock array (sorted) of rrset references. @@ -199,7 +199,7 @@ void rrset_array_unlock_touch(struct rrset_cache* r, struct regional* scratch, * @param now: current time. */ void rrset_update_sec_status(struct rrset_cache* r, - struct ub_packed_rrset_key* rrset, uint32_t now); + struct ub_packed_rrset_key* rrset, time_t now); /** * Looks up security status of an rrset. Looks up the rrset. @@ -211,7 +211,7 @@ void rrset_update_sec_status(struct rrset_cache* r, * @param now: current time. */ void rrset_check_sec_status(struct rrset_cache* r, - struct ub_packed_rrset_key* rrset, uint32_t now); + struct ub_packed_rrset_key* rrset, time_t now); /** * Remove an rrset from the cache, by name and type and flags diff --git a/contrib/unbound/services/listen_dnsport.c b/contrib/unbound/services/listen_dnsport.c index 647cbe07ebd..8b1d62e3a20 100644 --- a/contrib/unbound/services/listen_dnsport.c +++ b/contrib/unbound/services/listen_dnsport.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -49,6 +49,7 @@ #include "util/log.h" #include "util/config_file.h" #include "util/net_help.h" +#include "ldns/sbuffer.h" #ifdef HAVE_NETDB_H #include @@ -75,7 +76,7 @@ verbose_print_addr(struct addrinfo *addr) #endif /* INET6 */ if(inet_ntop(addr->ai_family, sinaddr, buf, (socklen_t)sizeof(buf)) == 0) { - strncpy(buf, "(null)", sizeof(buf)); + (void)strlcpy(buf, "(null)", sizeof(buf)); } buf[sizeof(buf)-1] = 0; verbose(VERB_ALGO, "creating %s%s socket %s %d", @@ -91,10 +92,10 @@ verbose_print_addr(struct addrinfo *addr) int create_udp_sock(int family, int socktype, struct sockaddr* addr, socklen_t addrlen, int v6only, int* inuse, int* noproto, - int rcv, int snd) + int rcv, int snd, int listen, int* reuseport) { int s; -#if defined(IPV6_USE_MIN_MTU) +#if defined(SO_REUSEADDR) || defined(SO_REUSEPORT) || defined(IPV6_USE_MIN_MTU) int on=1; #endif #ifdef IPV6_MTU @@ -129,6 +130,50 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr, *noproto = 0; return -1; } + if(listen) { +#ifdef SO_REUSEADDR + if(setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (void*)&on, + (socklen_t)sizeof(on)) < 0) { +#ifndef USE_WINSOCK + log_err("setsockopt(.. SO_REUSEADDR ..) failed: %s", + strerror(errno)); + if(errno != ENOSYS) { + close(s); + *noproto = 0; + *inuse = 0; + return -1; + } +#else + log_err("setsockopt(.. SO_REUSEADDR ..) failed: %s", + wsa_strerror(WSAGetLastError())); + closesocket(s); + *noproto = 0; + *inuse = 0; + return -1; +#endif + } +#endif /* SO_REUSEADDR */ +#if defined(__linux__) && defined(SO_REUSEPORT) + /* Linux specific: try to set SO_REUSEPORT so that incoming + * queries are distributed evenly among the receiving threads. + * Each thread must have its own socket bound to the same port, + * with SO_REUSEPORT set on each socket. + */ + if (reuseport && *reuseport && + setsockopt(s, SOL_SOCKET, SO_REUSEPORT, (void*)&on, + (socklen_t)sizeof(on)) < 0) { +#ifdef ENOPROTOOPT + if(errno != ENOPROTOOPT || verbosity >= 3) + log_warn("setsockopt(.. SO_REUSEPORT ..) failed: %s", + strerror(errno)); +#endif + /* this option is not essential, we can continue */ + *reuseport = 0; + } +#else + (void)reuseport; +#endif /* defined(__linux__) && defined(SO_REUSEPORT) */ + } if(rcv) { #ifdef SO_RCVBUF int got; @@ -328,6 +373,8 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr, # else closesocket(s); # endif + *noproto = 0; + *inuse = 0; return -1; } # elif defined(IP_DONTFRAG) @@ -341,12 +388,15 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr, # else closesocket(s); # endif + *noproto = 0; + *inuse = 0; return -1; } # endif /* IPv4 MTU */ } if(bind(s, (struct sockaddr*)addr, addrlen) != 0) { *noproto = 0; + *inuse = 0; #ifndef USE_WINSOCK #ifdef EADDRINUSE *inuse = (errno == EADDRINUSE); @@ -386,10 +436,11 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr, } int -create_tcp_accept_sock(struct addrinfo *addr, int v6only, int* noproto) +create_tcp_accept_sock(struct addrinfo *addr, int v6only, int* noproto, + int* reuseport) { int s; -#if defined(SO_REUSEADDR) || defined(IPV6_V6ONLY) +#if defined(SO_REUSEADDR) || defined(SO_REUSEPORT) || defined(IPV6_V6ONLY) int on = 1; #endif /* SO_REUSEADDR || IPV6_V6ONLY */ verbose_print_addr(addr); @@ -427,6 +478,26 @@ create_tcp_accept_sock(struct addrinfo *addr, int v6only, int* noproto) return -1; } #endif /* SO_REUSEADDR */ +#if defined(__linux__) && defined(SO_REUSEPORT) + /* Linux specific: try to set SO_REUSEPORT so that incoming + * connections are distributed evenly among the receiving threads. + * Each thread must have its own socket bound to the same port, + * with SO_REUSEPORT set on each socket. + */ + if (reuseport && *reuseport && + setsockopt(s, SOL_SOCKET, SO_REUSEPORT, (void*)&on, + (socklen_t)sizeof(on)) < 0) { +#ifdef ENOPROTOOPT + if(errno != ENOPROTOOPT || verbosity >= 3) + log_warn("setsockopt(.. SO_REUSEPORT ..) failed: %s", + strerror(errno)); +#endif + /* this option is not essential, we can continue */ + *reuseport = 0; + } +#else + (void)reuseport; +#endif /* defined(__linux__) && defined(SO_REUSEPORT) */ #if defined(IPV6_V6ONLY) if(addr->ai_family == AF_INET6 && v6only) { if(setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, @@ -494,7 +565,8 @@ create_tcp_accept_sock(struct addrinfo *addr, int v6only, int* noproto) */ static int make_sock(int stype, const char* ifname, const char* port, - struct addrinfo *hints, int v6only, int* noip6, size_t rcv, size_t snd) + struct addrinfo *hints, int v6only, int* noip6, size_t rcv, size_t snd, + int* reuseport) { struct addrinfo *res = NULL; int r, s, inuse, noproto; @@ -521,14 +593,15 @@ make_sock(int stype, const char* ifname, const char* port, verbose_print_addr(res); s = create_udp_sock(res->ai_family, res->ai_socktype, (struct sockaddr*)res->ai_addr, res->ai_addrlen, - v6only, &inuse, &noproto, (int)rcv, (int)snd); + v6only, &inuse, &noproto, (int)rcv, (int)snd, 1, + reuseport); if(s == -1 && inuse) { log_err("bind: address already in use"); } else if(s == -1 && noproto && hints->ai_family == AF_INET6){ *noip6 = 1; } } else { - s = create_tcp_accept_sock(res, v6only, &noproto); + s = create_tcp_accept_sock(res, v6only, &noproto, reuseport); if(s == -1 && noproto && hints->ai_family == AF_INET6){ *noip6 = 1; } @@ -540,7 +613,8 @@ make_sock(int stype, const char* ifname, const char* port, /** make socket and first see if ifname contains port override info */ static int make_sock_port(int stype, const char* ifname, const char* port, - struct addrinfo *hints, int v6only, int* noip6, size_t rcv, size_t snd) + struct addrinfo *hints, int v6only, int* noip6, size_t rcv, size_t snd, + int* reuseport) { char* s = strchr(ifname, '@'); if(s) { @@ -557,14 +631,15 @@ make_sock_port(int stype, const char* ifname, const char* port, *noip6 = 0; return -1; } - strncpy(newif, ifname, sizeof(newif)); + (void)strlcpy(newif, ifname, sizeof(newif)); newif[s-ifname] = 0; - strncpy(p, s+1, sizeof(p)); + (void)strlcpy(p, s+1, sizeof(p)); p[strlen(s+1)]=0; return make_sock(stype, newif, p, hints, v6only, noip6, - rcv, snd); + rcv, snd, reuseport); } - return make_sock(stype, ifname, port, hints, v6only, noip6, rcv, snd); + return make_sock(stype, ifname, port, hints, v6only, noip6, rcv, snd, + reuseport); } /** @@ -656,19 +731,21 @@ set_recvpktinfo(int s, int family) * @param rcv: receive buffer size for UDP * @param snd: send buffer size for UDP * @param ssl_port: ssl service port number + * @param reuseport: try to set SO_REUSEPORT if nonNULL and true. + * set to false on exit if reuseport failed due to no kernel support. * @return: returns false on error. */ static int ports_create_if(const char* ifname, int do_auto, int do_udp, int do_tcp, struct addrinfo *hints, const char* port, struct listen_port** list, - size_t rcv, size_t snd, int ssl_port) + size_t rcv, size_t snd, int ssl_port, int* reuseport) { int s, noip6=0; if(!do_udp && !do_tcp) return 0; if(do_auto) { if((s = make_sock_port(SOCK_DGRAM, ifname, port, hints, 1, - &noip6, rcv, snd)) == -1) { + &noip6, rcv, snd, reuseport)) == -1) { if(noip6) { log_warn("IPv6 protocol not available"); return 1; @@ -695,7 +772,7 @@ ports_create_if(const char* ifname, int do_auto, int do_udp, int do_tcp, } else if(do_udp) { /* regular udp socket */ if((s = make_sock_port(SOCK_DGRAM, ifname, port, hints, 1, - &noip6, rcv, snd)) == -1) { + &noip6, rcv, snd, reuseport)) == -1) { if(noip6) { log_warn("IPv6 protocol not available"); return 1; @@ -716,7 +793,7 @@ ports_create_if(const char* ifname, int do_auto, int do_udp, int do_tcp, atoi(strchr(ifname, '@')+1) == ssl_port) || (!strchr(ifname, '@') && atoi(port) == ssl_port)); if((s = make_sock_port(SOCK_STREAM, ifname, port, hints, 1, - &noip6, 0, 0)) == -1) { + &noip6, 0, 0, reuseport)) == -1) { if(noip6) { /*log_warn("IPv6 protocol not available");*/ return 1; @@ -767,7 +844,7 @@ listen_create(struct comm_base* base, struct listen_port* ports, if(!front) return NULL; front->cps = NULL; - front->udp_buff = ldns_buffer_new(bufsize); + front->udp_buff = sldns_buffer_new(bufsize); if(!front->udp_buff) { free(front); return NULL; @@ -830,12 +907,12 @@ listen_delete(struct listen_dnsport* front) if(!front) return; listen_list_delete(front->cps); - ldns_buffer_free(front->udp_buff); + sldns_buffer_free(front->udp_buff); free(front); } struct listen_port* -listening_ports_open(struct config_file* cfg) +listening_ports_open(struct config_file* cfg, int* reuseport) { struct listen_port* list = NULL; struct addrinfo hints; @@ -871,7 +948,7 @@ listening_ports_open(struct config_file* cfg) do_auto, cfg->do_udp, do_tcp, &hints, portbuf, &list, cfg->so_rcvbuf, cfg->so_sndbuf, - cfg->ssl_port)) { + cfg->ssl_port, reuseport)) { listening_ports_free(list); return NULL; } @@ -882,7 +959,7 @@ listening_ports_open(struct config_file* cfg) do_auto, cfg->do_udp, do_tcp, &hints, portbuf, &list, cfg->so_rcvbuf, cfg->so_sndbuf, - cfg->ssl_port)) { + cfg->ssl_port, reuseport)) { listening_ports_free(list); return NULL; } @@ -895,7 +972,7 @@ listening_ports_open(struct config_file* cfg) if(!ports_create_if(cfg->ifs[i], 0, cfg->do_udp, do_tcp, &hints, portbuf, &list, cfg->so_rcvbuf, cfg->so_sndbuf, - cfg->ssl_port)) { + cfg->ssl_port, reuseport)) { listening_ports_free(list); return NULL; } @@ -906,7 +983,7 @@ listening_ports_open(struct config_file* cfg) if(!ports_create_if(cfg->ifs[i], 0, cfg->do_udp, do_tcp, &hints, portbuf, &list, cfg->so_rcvbuf, cfg->so_sndbuf, - cfg->ssl_port)) { + cfg->ssl_port, reuseport)) { listening_ports_free(list); return NULL; } @@ -936,7 +1013,7 @@ size_t listen_get_mem(struct listen_dnsport* listen) { size_t s = sizeof(*listen) + sizeof(*listen->base) + sizeof(*listen->udp_buff) + - ldns_buffer_capacity(listen->udp_buff); + sldns_buffer_capacity(listen->udp_buff); struct listen_list* p; for(p = listen->cps; p; p = p->next) { s += sizeof(*p); diff --git a/contrib/unbound/services/listen_dnsport.h b/contrib/unbound/services/listen_dnsport.h index 4d37aca5eee..61fb9a0b44e 100644 --- a/contrib/unbound/services/listen_dnsport.h +++ b/contrib/unbound/services/listen_dnsport.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -46,6 +46,7 @@ struct listen_list; struct config_file; struct addrinfo; +struct sldns_buffer; /** * Listening for queries structure. @@ -57,7 +58,7 @@ struct listen_dnsport { /** buffer shared by UDP connections, since there is only one datagram at any time. */ - ldns_buffer* udp_buff; + struct sldns_buffer* udp_buff; /** list of comm points used to get incoming events */ struct listen_list* cps; @@ -106,9 +107,13 @@ struct listen_port { * interfaces for IP4 and/or IP6, for UDP and/or TCP. * On the given port number. It creates the sockets. * @param cfg: settings on what ports to open. + * @param reuseport: set to true if you want reuseport, or NULL to not have it, + * set to false on exit if reuseport failed to apply (because of no + * kernel support). * @return: linked list of ports or NULL on error. */ -struct listen_port* listening_ports_open(struct config_file* cfg); +struct listen_port* listening_ports_open(struct config_file* cfg, + int* reuseport); /** * Close and delete the (list of) listening ports. @@ -178,19 +183,26 @@ void listen_start_accept(struct listen_dnsport* listen); IPv6 proto (family) is not available. * @param rcv: set size on rcvbuf with socket option, if 0 it is not set. * @param snd: set size on sndbuf with socket option, if 0 it is not set. + * @param listen: if true, this is a listening UDP port, eg port 53, and + * set SO_REUSEADDR on it. + * @param reuseport: if nonNULL and true, try to set SO_REUSEPORT on + * listening UDP port. Set to false on return if it failed to do so. * @return: the socket. -1 on error. */ int create_udp_sock(int family, int socktype, struct sockaddr* addr, socklen_t addrlen, int v6only, int* inuse, int* noproto, int rcv, - int snd); + int snd, int listen, int* reuseport); /** * Create and bind TCP listening socket * @param addr: address info ready to make socket. * @param v6only: enable ip6 only flag on ip6 sockets. * @param noproto: if error caused by lack of protocol support. + * @param reuseport: if nonNULL and true, try to set SO_REUSEPORT on + * listening UDP port. Set to false on return if it failed to do so. * @return: the socket. -1 on error. */ -int create_tcp_accept_sock(struct addrinfo *addr, int v6only, int* noproto); +int create_tcp_accept_sock(struct addrinfo *addr, int v6only, int* noproto, + int* reuseport); #endif /* LISTEN_DNSPORT_H */ diff --git a/contrib/unbound/services/localzone.c b/contrib/unbound/services/localzone.c index 9fdab51c108..a1688e1c6d0 100644 --- a/contrib/unbound/services/localzone.c +++ b/contrib/unbound/services/localzone.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -39,9 +39,9 @@ * This file contains functions to enable local zone authority service. */ #include "config.h" -#include -#include #include "services/localzone.h" +#include "ldns/str2wire.h" +#include "ldns/sbuffer.h" #include "util/regional.h" #include "util/config_file.h" #include "util/data/dname.h" @@ -59,7 +59,7 @@ local_zones_create(void) if(!zones) return NULL; rbtree_init(&zones->ztree, &local_zone_cmp); - lock_quick_init(&zones->lock); + lock_rw_init(&zones->lock); lock_protect(&zones->lock, &zones->ztree, sizeof(zones->ztree)); /* also lock protects the rbnode's in struct local_zone */ return zones; @@ -78,7 +78,7 @@ local_zones_delete(struct local_zones* zones) { if(!zones) return; - lock_quick_destroy(&zones->lock); + lock_rw_destroy(&zones->lock); /* walk through zones and delete them all */ traverse_postorder(&zones->ztree, lzdel, NULL); free(zones); @@ -125,19 +125,10 @@ local_data_cmp(const void* d1, const void* d2) int parse_dname(const char* str, uint8_t** res, size_t* len, int* labs) { - ldns_rdf* rdf; - *res = NULL; - *len = 0; + *res = sldns_str2wire_dname(str, len); *labs = 0; - rdf = ldns_dname_new_frm_str(str); - if(!rdf) { - log_err("cannot parse name %s", str); - return 0; - } - *res = memdup(ldns_rdf_data(rdf), ldns_rdf_size(rdf)); - ldns_rdf_deep_free(rdf); if(!*res) { - log_err("out of memory"); + log_err("cannot parse name %s", str); return 0; } *labs = dname_count_size_labels(*res, len); @@ -183,16 +174,16 @@ lz_enter_zone_dname(struct local_zones* zones, uint8_t* nm, size_t len, } /* add to rbtree */ - lock_quick_lock(&zones->lock); + lock_rw_wrlock(&zones->lock); lock_rw_wrlock(&z->lock); if(!rbtree_insert(&zones->ztree, &z->node)) { log_warn("duplicate local-zone"); lock_rw_unlock(&z->lock); local_zone_delete(z); - lock_quick_unlock(&zones->lock); + lock_rw_unlock(&zones->lock); return NULL; } - lock_quick_unlock(&zones->lock); + lock_rw_unlock(&zones->lock); return z; } @@ -225,39 +216,28 @@ lz_enter_zone(struct local_zones* zones, const char* name, const char* type, /** return name and class and rdata of rr; parses string */ static int get_rr_content(const char* str, uint8_t** nm, uint16_t* type, - uint16_t* dclass, uint32_t* ttl, ldns_buffer* rdata) + uint16_t* dclass, time_t* ttl, uint8_t* rr, size_t len, + uint8_t** rdata, size_t* rdata_len) { - ldns_rr* rr = NULL; - ldns_status status = ldns_rr_new_frm_str(&rr, str, 3600, NULL, NULL); - if(status != LDNS_STATUS_OK) { - log_err("error parsing local-data '%s': %s", - str, ldns_get_errorstr_by_id(status)); - ldns_rr_free(rr); + size_t dname_len = 0; + int e = sldns_str2wire_rr_buf(str, rr, &len, &dname_len, 3600, + NULL, 0, NULL, 0); + if(e) { + log_err("error parsing local-data at %d: '%s': %s", + LDNS_WIREPARSE_OFFSET(e), str, + sldns_get_errorstr_parse(e)); return 0; } - *nm = memdup(ldns_rdf_data(ldns_rr_owner(rr)), - ldns_rdf_size(ldns_rr_owner(rr))); + *nm = memdup(rr, dname_len); if(!*nm) { log_err("out of memory"); - ldns_rr_free(rr); return 0; } - *dclass = ldns_rr_get_class(rr); - *type = ldns_rr_get_type(rr); - *ttl = (uint32_t)ldns_rr_ttl(rr); - ldns_buffer_clear(rdata); - ldns_buffer_skip(rdata, 2); - status = ldns_rr_rdata2buffer_wire(rdata, rr); - ldns_rr_free(rr); - if(status != LDNS_STATUS_OK) { - log_err("error converting RR '%s' to wireformat: %s", - str, ldns_get_errorstr_by_id(status)); - free(*nm); - *nm = NULL; - return 0; - } - ldns_buffer_flip(rdata); - ldns_buffer_write_u16_at(rdata, 0, ldns_buffer_limit(rdata) - 2); + *dclass = sldns_wirerr_get_class(rr, len, dname_len); + *type = sldns_wirerr_get_type(rr, len, dname_len); + *ttl = (time_t)sldns_wirerr_get_ttl(rr, len, dname_len); + *rdata = sldns_wirerr_get_rdatawl(rr, len, dname_len); + *rdata_len = sldns_wirerr_get_rdatalen(rr, len, dname_len)+2; return 1; } @@ -265,18 +245,18 @@ get_rr_content(const char* str, uint8_t** nm, uint16_t* type, static int get_rr_nameclass(const char* str, uint8_t** nm, uint16_t* dclass) { - ldns_rr* rr = NULL; - ldns_status status = ldns_rr_new_frm_str(&rr, str, 3600, NULL, NULL); - if(status != LDNS_STATUS_OK) { - log_err("error parsing local-data '%s': %s", - str, ldns_get_errorstr_by_id(status)); - ldns_rr_free(rr); + uint8_t rr[LDNS_RR_BUF_SIZE]; + size_t len = sizeof(rr), dname_len = 0; + int s = sldns_str2wire_rr_buf(str, rr, &len, &dname_len, 3600, + NULL, 0, NULL, 0); + if(s != 0) { + log_err("error parsing local-data at %d '%s': %s", + LDNS_WIREPARSE_OFFSET(s), str, + sldns_get_errorstr_parse(s)); return 0; } - *nm = memdup(ldns_rdf_data(ldns_rr_owner(rr)), - ldns_rdf_size(ldns_rr_owner(rr))); - *dclass = ldns_rr_get_class(rr); - ldns_rr_free(rr); + *nm = memdup(rr, dname_len); + *dclass = sldns_wirerr_get_class(rr, len, dname_len); if(!*nm) { log_err("out of memory"); return 0; @@ -304,13 +284,12 @@ local_data_find_type(struct local_data* data, uint16_t type) /** check for RR duplicates */ static int -rr_is_duplicate(struct packed_rrset_data* pd, ldns_buffer* buf) +rr_is_duplicate(struct packed_rrset_data* pd, uint8_t* rdata, size_t rdata_len) { size_t i; for(i=0; icount; i++) { - if(ldns_buffer_limit(buf) == pd->rr_len[i] && - memcmp(ldns_buffer_begin(buf), pd->rr_data[i], - ldns_buffer_limit(buf)) == 0) + if(pd->rr_len[i] == rdata_len && + memcmp(pd->rr_data[i], rdata, rdata_len) == 0) return 1; } return 0; @@ -356,10 +335,10 @@ new_local_rrset(struct regional* region, struct local_data* node, /** insert RR into RRset data structure; Wastes a couple of bytes */ static int insert_rr(struct regional* region, struct packed_rrset_data* pd, - ldns_buffer* buf, uint32_t ttl) + uint8_t* rdata, size_t rdata_len, time_t ttl) { size_t* oldlen = pd->rr_len; - uint32_t* oldttl = pd->rr_ttl; + time_t* oldttl = pd->rr_ttl; uint8_t** olddata = pd->rr_data; /* add RR to rrset */ @@ -379,10 +358,9 @@ insert_rr(struct regional* region, struct packed_rrset_data* pd, memcpy(pd->rr_data+1, olddata, sizeof(*pd->rr_data)*(pd->count-1)); } - pd->rr_len[0] = ldns_buffer_limit(buf); + pd->rr_len[0] = rdata_len; pd->rr_ttl[0] = ttl; - pd->rr_data[0] = regional_alloc_init(region, - ldns_buffer_begin(buf), ldns_buffer_limit(buf)); + pd->rr_data[0] = regional_alloc_init(region, rdata, rdata_len); if(!pd->rr_data[0]) { log_err("out of memory"); return 0; @@ -440,8 +418,7 @@ lz_find_create_node(struct local_zone* z, uint8_t* nm, size_t nmlen, /** enter data RR into auth zone */ static int -lz_enter_rr_into_zone(struct local_zone* z, ldns_buffer* buf, - const char* rrstr) +lz_enter_rr_into_zone(struct local_zone* z, const char* rrstr) { uint8_t* nm; size_t nmlen; @@ -450,8 +427,12 @@ lz_enter_rr_into_zone(struct local_zone* z, ldns_buffer* buf, struct local_rrset* rrset; struct packed_rrset_data* pd; uint16_t rrtype = 0, rrclass = 0; - uint32_t ttl = 0; - if(!get_rr_content(rrstr, &nm, &rrtype, &rrclass, &ttl, buf)) { + time_t ttl = 0; + uint8_t rr[LDNS_RR_BUF_SIZE]; + uint8_t* rdata; + size_t rdata_len; + if(!get_rr_content(rrstr, &nm, &rrtype, &rrclass, &ttl, rr, sizeof(rr), + &rdata, &rdata_len)) { log_err("bad local-data: %s", rrstr); return 0; } @@ -487,16 +468,16 @@ lz_enter_rr_into_zone(struct local_zone* z, ldns_buffer* buf, log_assert(rrset && pd); /* check for duplicate RR */ - if(rr_is_duplicate(pd, buf)) { + if(rr_is_duplicate(pd, rdata, rdata_len)) { verbose(VERB_ALGO, "ignoring duplicate RR: %s", rrstr); return 1; } - return insert_rr(z->region, pd, buf, ttl); + return insert_rr(z->region, pd, rdata, rdata_len, ttl); } /** enter a data RR into auth data; a zone for it must exist */ static int -lz_enter_rr_str(struct local_zones* zones, const char* rr, ldns_buffer* buf) +lz_enter_rr_str(struct local_zones* zones, const char* rr) { uint8_t* rr_name; uint16_t rr_class; @@ -509,16 +490,16 @@ lz_enter_rr_str(struct local_zones* zones, const char* rr, ldns_buffer* buf) return 0; } labs = dname_count_size_labels(rr_name, &len); - lock_quick_lock(&zones->lock); + lock_rw_rdlock(&zones->lock); z = local_zones_lookup(zones, rr_name, len, labs, rr_class); if(!z) { - lock_quick_unlock(&zones->lock); + lock_rw_unlock(&zones->lock); fatal_exit("internal error: no zone for rr %s", rr); } lock_rw_wrlock(&z->lock); - lock_quick_unlock(&zones->lock); + lock_rw_unlock(&zones->lock); free(rr_name); - r = lz_enter_rr_into_zone(z, buf, rr); + r = lz_enter_rr_into_zone(z, rr); lock_rw_unlock(&z->lock); return r; } @@ -549,13 +530,13 @@ lz_exists(struct local_zones* zones, const char* name) log_err("bad name %s", name); return 0; } - lock_quick_lock(&zones->lock); + lock_rw_rdlock(&zones->lock); if(rbtree_search(&zones->ztree, &z.node)) { - lock_quick_unlock(&zones->lock); + lock_rw_unlock(&zones->lock); free(z.name); return 1; } - lock_quick_unlock(&zones->lock); + lock_rw_unlock(&zones->lock); free(z.name); return 0; } @@ -582,7 +563,7 @@ lz_nodefault(struct config_file* cfg, const char* name) /** enter AS112 default zone */ static int add_as112_default(struct local_zones* zones, struct config_file* cfg, - ldns_buffer* buf, const char* name) + const char* name) { struct local_zone* z; char str[1024]; /* known long enough */ @@ -592,12 +573,12 @@ add_as112_default(struct local_zones* zones, struct config_file* cfg, return 0; snprintf(str, sizeof(str), "%s 10800 IN SOA localhost. " "nobody.invalid. 1 3600 1200 604800 10800", name); - if(!lz_enter_rr_into_zone(z, buf, str)) { + if(!lz_enter_rr_into_zone(z, str)) { lock_rw_unlock(&z->lock); return 0; } snprintf(str, sizeof(str), "%s 10800 IN NS localhost. ", name); - if(!lz_enter_rr_into_zone(z, buf, str)) { + if(!lz_enter_rr_into_zone(z, str)) { lock_rw_unlock(&z->lock); return 0; } @@ -607,26 +588,27 @@ add_as112_default(struct local_zones* zones, struct config_file* cfg, /** enter default zones */ static int -lz_enter_defaults(struct local_zones* zones, struct config_file* cfg, - ldns_buffer* buf) +lz_enter_defaults(struct local_zones* zones, struct config_file* cfg) { struct local_zone* z; /* this list of zones is from RFC 6303 */ + /* block localhost level zones, first, later the LAN zones */ + /* localhost. zone */ if(!lz_exists(zones, "localhost.") && !lz_nodefault(cfg, "localhost.")) { if(!(z=lz_enter_zone(zones, "localhost.", "static", LDNS_RR_CLASS_IN)) || - !lz_enter_rr_into_zone(z, buf, + !lz_enter_rr_into_zone(z, "localhost. 10800 IN NS localhost.") || - !lz_enter_rr_into_zone(z, buf, + !lz_enter_rr_into_zone(z, "localhost. 10800 IN SOA localhost. nobody.invalid. " "1 3600 1200 604800 10800") || - !lz_enter_rr_into_zone(z, buf, + !lz_enter_rr_into_zone(z, "localhost. 10800 IN A 127.0.0.1") || - !lz_enter_rr_into_zone(z, buf, + !lz_enter_rr_into_zone(z, "localhost. 10800 IN AAAA ::1")) { log_err("out of memory adding default zone"); if(z) { lock_rw_unlock(&z->lock); } @@ -639,12 +621,12 @@ lz_enter_defaults(struct local_zones* zones, struct config_file* cfg, !lz_nodefault(cfg, "127.in-addr.arpa.")) { if(!(z=lz_enter_zone(zones, "127.in-addr.arpa.", "static", LDNS_RR_CLASS_IN)) || - !lz_enter_rr_into_zone(z, buf, + !lz_enter_rr_into_zone(z, "127.in-addr.arpa. 10800 IN NS localhost.") || - !lz_enter_rr_into_zone(z, buf, + !lz_enter_rr_into_zone(z, "127.in-addr.arpa. 10800 IN SOA localhost. " "nobody.invalid. 1 3600 1200 604800 10800") || - !lz_enter_rr_into_zone(z, buf, + !lz_enter_rr_into_zone(z, "1.0.0.127.in-addr.arpa. 10800 IN PTR localhost.")) { log_err("out of memory adding default zone"); if(z) { lock_rw_unlock(&z->lock); } @@ -657,12 +639,12 @@ lz_enter_defaults(struct local_zones* zones, struct config_file* cfg, !lz_nodefault(cfg, "1.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.ip6.arpa.")) { if(!(z=lz_enter_zone(zones, "1.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.ip6.arpa.", "static", LDNS_RR_CLASS_IN)) || - !lz_enter_rr_into_zone(z, buf, + !lz_enter_rr_into_zone(z, "1.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.ip6.arpa. 10800 IN NS localhost.") || - !lz_enter_rr_into_zone(z, buf, + !lz_enter_rr_into_zone(z, "1.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.ip6.arpa. 10800 IN SOA localhost. " "nobody.invalid. 1 3600 1200 604800 10800") || - !lz_enter_rr_into_zone(z, buf, + !lz_enter_rr_into_zone(z, "1.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.ip6.arpa. 10800 IN PTR localhost.")) { log_err("out of memory adding default zone"); if(z) { lock_rw_unlock(&z->lock); } @@ -670,37 +652,45 @@ lz_enter_defaults(struct local_zones* zones, struct config_file* cfg, } lock_rw_unlock(&z->lock); } - if ( !add_as112_default(zones, cfg, buf, "10.in-addr.arpa.") || - !add_as112_default(zones, cfg, buf, "16.172.in-addr.arpa.") || - !add_as112_default(zones, cfg, buf, "17.172.in-addr.arpa.") || - !add_as112_default(zones, cfg, buf, "18.172.in-addr.arpa.") || - !add_as112_default(zones, cfg, buf, "19.172.in-addr.arpa.") || - !add_as112_default(zones, cfg, buf, "20.172.in-addr.arpa.") || - !add_as112_default(zones, cfg, buf, "21.172.in-addr.arpa.") || - !add_as112_default(zones, cfg, buf, "22.172.in-addr.arpa.") || - !add_as112_default(zones, cfg, buf, "23.172.in-addr.arpa.") || - !add_as112_default(zones, cfg, buf, "24.172.in-addr.arpa.") || - !add_as112_default(zones, cfg, buf, "25.172.in-addr.arpa.") || - !add_as112_default(zones, cfg, buf, "26.172.in-addr.arpa.") || - !add_as112_default(zones, cfg, buf, "27.172.in-addr.arpa.") || - !add_as112_default(zones, cfg, buf, "28.172.in-addr.arpa.") || - !add_as112_default(zones, cfg, buf, "29.172.in-addr.arpa.") || - !add_as112_default(zones, cfg, buf, "30.172.in-addr.arpa.") || - !add_as112_default(zones, cfg, buf, "31.172.in-addr.arpa.") || - !add_as112_default(zones, cfg, buf, "168.192.in-addr.arpa.") || - !add_as112_default(zones, cfg, buf, "0.in-addr.arpa.") || - !add_as112_default(zones, cfg, buf, "254.169.in-addr.arpa.") || - !add_as112_default(zones, cfg, buf, "2.0.192.in-addr.arpa.") || - !add_as112_default(zones, cfg, buf, "100.51.198.in-addr.arpa.") || - !add_as112_default(zones, cfg, buf, "113.0.203.in-addr.arpa.") || - !add_as112_default(zones, cfg, buf, "255.255.255.255.in-addr.arpa.") || - !add_as112_default(zones, cfg, buf, "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.ip6.arpa.") || - !add_as112_default(zones, cfg, buf, "d.f.ip6.arpa.") || - !add_as112_default(zones, cfg, buf, "8.e.f.ip6.arpa.") || - !add_as112_default(zones, cfg, buf, "9.e.f.ip6.arpa.") || - !add_as112_default(zones, cfg, buf, "a.e.f.ip6.arpa.") || - !add_as112_default(zones, cfg, buf, "b.e.f.ip6.arpa.") || - !add_as112_default(zones, cfg, buf, "8.b.d.0.1.0.0.2.ip6.arpa.")) { + + /* if unblock lan-zones, then do not add the zones below. + * we do add the zones above, about 127.0.0.1, because localhost is + * not on the lan. */ + if(cfg->unblock_lan_zones) + return 1; + + /* block LAN level zones */ + if ( !add_as112_default(zones, cfg, "10.in-addr.arpa.") || + !add_as112_default(zones, cfg, "16.172.in-addr.arpa.") || + !add_as112_default(zones, cfg, "17.172.in-addr.arpa.") || + !add_as112_default(zones, cfg, "18.172.in-addr.arpa.") || + !add_as112_default(zones, cfg, "19.172.in-addr.arpa.") || + !add_as112_default(zones, cfg, "20.172.in-addr.arpa.") || + !add_as112_default(zones, cfg, "21.172.in-addr.arpa.") || + !add_as112_default(zones, cfg, "22.172.in-addr.arpa.") || + !add_as112_default(zones, cfg, "23.172.in-addr.arpa.") || + !add_as112_default(zones, cfg, "24.172.in-addr.arpa.") || + !add_as112_default(zones, cfg, "25.172.in-addr.arpa.") || + !add_as112_default(zones, cfg, "26.172.in-addr.arpa.") || + !add_as112_default(zones, cfg, "27.172.in-addr.arpa.") || + !add_as112_default(zones, cfg, "28.172.in-addr.arpa.") || + !add_as112_default(zones, cfg, "29.172.in-addr.arpa.") || + !add_as112_default(zones, cfg, "30.172.in-addr.arpa.") || + !add_as112_default(zones, cfg, "31.172.in-addr.arpa.") || + !add_as112_default(zones, cfg, "168.192.in-addr.arpa.") || + !add_as112_default(zones, cfg, "0.in-addr.arpa.") || + !add_as112_default(zones, cfg, "254.169.in-addr.arpa.") || + !add_as112_default(zones, cfg, "2.0.192.in-addr.arpa.") || + !add_as112_default(zones, cfg, "100.51.198.in-addr.arpa.") || + !add_as112_default(zones, cfg, "113.0.203.in-addr.arpa.") || + !add_as112_default(zones, cfg, "255.255.255.255.in-addr.arpa.") || + !add_as112_default(zones, cfg, "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.ip6.arpa.") || + !add_as112_default(zones, cfg, "d.f.ip6.arpa.") || + !add_as112_default(zones, cfg, "8.e.f.ip6.arpa.") || + !add_as112_default(zones, cfg, "9.e.f.ip6.arpa.") || + !add_as112_default(zones, cfg, "a.e.f.ip6.arpa.") || + !add_as112_default(zones, cfg, "b.e.f.ip6.arpa.") || + !add_as112_default(zones, cfg, "8.b.d.0.1.0.0.2.ip6.arpa.")) { log_err("out of memory adding default zone"); return 0; } @@ -713,7 +703,7 @@ init_parents(struct local_zones* zones) { struct local_zone* node, *prev = NULL, *p; int m; - lock_quick_lock(&zones->lock); + lock_rw_wrlock(&zones->lock); RBTREE_FOR(node, struct local_zone*, &zones->ztree) { lock_rw_wrlock(&node->lock); node->parent = NULL; @@ -738,7 +728,7 @@ init_parents(struct local_zones* zones) prev = node; lock_rw_unlock(&node->lock); } - lock_quick_unlock(&zones->lock); + lock_rw_unlock(&zones->lock); } /** enter implicit transparent zone for local-data: without local-zone: */ @@ -768,7 +758,7 @@ lz_setup_implicit(struct local_zones* zones, struct config_file* cfg) return 0; } labs = dname_count_size_labels(rr_name, &len); - lock_quick_lock(&zones->lock); + lock_rw_rdlock(&zones->lock); if(!local_zones_lookup(zones, rr_name, len, labs, rr_class)) { if(!have_name) { dclass = rr_class; @@ -783,7 +773,7 @@ lz_setup_implicit(struct local_zones* zones, struct config_file* cfg) /* process other classes later */ free(rr_name); have_other_classes = 1; - lock_quick_unlock(&zones->lock); + lock_rw_unlock(&zones->lock); continue; } /* find smallest shared topdomain */ @@ -794,7 +784,7 @@ lz_setup_implicit(struct local_zones* zones, struct config_file* cfg) match = m; } } else free(rr_name); - lock_quick_unlock(&zones->lock); + lock_rw_unlock(&zones->lock); } if(have_name) { uint8_t* n2; @@ -825,12 +815,11 @@ lz_setup_implicit(struct local_zones* zones, struct config_file* cfg) /** enter auth data */ static int -lz_enter_data(struct local_zones* zones, struct config_file* cfg, - ldns_buffer* buf) +lz_enter_data(struct local_zones* zones, struct config_file* cfg) { struct config_strlist* p; for(p = cfg->local_data; p; p = p->next) { - if(!lz_enter_rr_str(zones, p->str, buf)) + if(!lz_enter_rr_str(zones, p->str)) return 0; } return 1; @@ -851,35 +840,27 @@ lz_freeup_cfg(struct config_file* cfg) int local_zones_apply_cfg(struct local_zones* zones, struct config_file* cfg) { - ldns_buffer* buf = ldns_buffer_new(65535); - if(!buf) fatal_exit("cannot create temporary buffer"); - /* create zones from zone statements. */ if(!lz_enter_zones(zones, cfg)) { - ldns_buffer_free(buf); return 0; } /* apply default zones+content (unless disabled, or overridden) */ - if(!lz_enter_defaults(zones, cfg, buf)) { - ldns_buffer_free(buf); + if(!lz_enter_defaults(zones, cfg)) { return 0; } /* create implicit transparent zone from data. */ if(!lz_setup_implicit(zones, cfg)) { - ldns_buffer_free(buf); return 0; } /* setup parent ptrs for lookup during data entry */ init_parents(zones); /* insert local data */ - if(!lz_enter_data(zones, cfg, buf)) { - ldns_buffer_free(buf); + if(!lz_enter_data(zones, cfg)) { return 0; } /* freeup memory from cfg struct. */ lz_freeup_cfg(cfg); - ldns_buffer_free(buf); return 1; } @@ -948,7 +929,7 @@ local_zone_out(struct local_zone* z) void local_zones_print(struct local_zones* zones) { struct local_zone* z; - lock_quick_lock(&zones->lock); + lock_rw_rdlock(&zones->lock); log_info("number of auth zones %u", (unsigned)zones->ztree.count); RBTREE_FOR(z, struct local_zone*, &zones->ztree) { lock_rw_rdlock(&z->lock); @@ -985,13 +966,13 @@ void local_zones_print(struct local_zones* zones) local_zone_out(z); lock_rw_unlock(&z->lock); } - lock_quick_unlock(&zones->lock); + lock_rw_unlock(&zones->lock); } /** encode answer consisting of 1 rrset */ static int local_encode(struct query_info* qinfo, struct edns_data* edns, - ldns_buffer* buf, struct regional* temp, + sldns_buffer* buf, struct regional* temp, struct ub_packed_rrset_key* rrset, int ansec, int rcode) { struct reply_info rep; @@ -1011,20 +992,20 @@ local_encode(struct query_info* qinfo, struct edns_data* edns, edns->ext_rcode = 0; edns->bits &= EDNS_DO; if(!reply_info_answer_encode(qinfo, &rep, - *(uint16_t*)ldns_buffer_begin(buf), - ldns_buffer_read_u16_at(buf, 2), + *(uint16_t*)sldns_buffer_begin(buf), + sldns_buffer_read_u16_at(buf, 2), buf, 0, 0, temp, udpsize, edns, (int)(edns->bits&EDNS_DO), 0)) error_encode(buf, (LDNS_RCODE_SERVFAIL|BIT_AA), qinfo, - *(uint16_t*)ldns_buffer_begin(buf), - ldns_buffer_read_u16_at(buf, 2), edns); + *(uint16_t*)sldns_buffer_begin(buf), + sldns_buffer_read_u16_at(buf, 2), edns); return 1; } /** answer local data match */ static int local_data_answer(struct local_zone* z, struct query_info* qinfo, - struct edns_data* edns, ldns_buffer* buf, struct regional* temp, + struct edns_data* edns, sldns_buffer* buf, struct regional* temp, int labs, struct local_data** ldp) { struct local_data key; @@ -1071,18 +1052,18 @@ local_data_answer(struct local_zone* z, struct query_info* qinfo, */ static int lz_zone_answer(struct local_zone* z, struct query_info* qinfo, - struct edns_data* edns, ldns_buffer* buf, struct regional* temp, + struct edns_data* edns, sldns_buffer* buf, struct regional* temp, struct local_data* ld) { if(z->type == local_zone_deny) { /** no reply at all, signal caller by clearing buffer. */ - ldns_buffer_clear(buf); - ldns_buffer_flip(buf); + sldns_buffer_clear(buf); + sldns_buffer_flip(buf); return 1; } else if(z->type == local_zone_refuse) { error_encode(buf, (LDNS_RCODE_REFUSED|BIT_AA), qinfo, - *(uint16_t*)ldns_buffer_begin(buf), - ldns_buffer_read_u16_at(buf, 2), edns); + *(uint16_t*)sldns_buffer_begin(buf), + sldns_buffer_read_u16_at(buf, 2), edns); return 1; } else if(z->type == local_zone_static || z->type == local_zone_redirect) { @@ -1098,8 +1079,8 @@ lz_zone_answer(struct local_zone* z, struct query_info* qinfo, return local_encode(qinfo, edns, buf, temp, z->soa, 0, rcode); error_encode(buf, (rcode|BIT_AA), qinfo, - *(uint16_t*)ldns_buffer_begin(buf), - ldns_buffer_read_u16_at(buf, 2), edns); + *(uint16_t*)sldns_buffer_begin(buf), + sldns_buffer_read_u16_at(buf, 2), edns); return 1; } else if(z->type == local_zone_typetransparent) { /* no NODATA or NXDOMAINS for this zone type */ @@ -1115,8 +1096,8 @@ lz_zone_answer(struct local_zone* z, struct query_info* qinfo, return local_encode(qinfo, edns, buf, temp, z->soa, 0, rcode); error_encode(buf, (rcode|BIT_AA), qinfo, - *(uint16_t*)ldns_buffer_begin(buf), - ldns_buffer_read_u16_at(buf, 2), edns); + *(uint16_t*)sldns_buffer_begin(buf), + sldns_buffer_read_u16_at(buf, 2), edns); return 1; } @@ -1126,7 +1107,7 @@ lz_zone_answer(struct local_zone* z, struct query_info* qinfo, int local_zones_answer(struct local_zones* zones, struct query_info* qinfo, - struct edns_data* edns, ldns_buffer* buf, struct regional* temp) + struct edns_data* edns, sldns_buffer* buf, struct regional* temp) { /* see if query is covered by a zone, * if so: - try to match (exact) local data @@ -1135,15 +1116,15 @@ local_zones_answer(struct local_zones* zones, struct query_info* qinfo, struct local_data* ld; struct local_zone* z; int r; - lock_quick_lock(&zones->lock); + lock_rw_rdlock(&zones->lock); z = local_zones_lookup(zones, qinfo->qname, qinfo->qname_len, labs, qinfo->qclass); if(!z) { - lock_quick_unlock(&zones->lock); + lock_rw_unlock(&zones->lock); return 0; } lock_rw_rdlock(&z->lock); - lock_quick_unlock(&zones->lock); + lock_rw_unlock(&zones->lock); if(local_data_answer(z, qinfo, edns, buf, temp, labs, &ld)) { lock_rw_unlock(&z->lock); @@ -1255,7 +1236,7 @@ void local_zones_del_zone(struct local_zones* zones, struct local_zone* z) } int -local_zones_add_RR(struct local_zones* zones, const char* rr, ldns_buffer* buf) +local_zones_add_RR(struct local_zones* zones, const char* rr) { uint8_t* rr_name; uint16_t rr_class; @@ -1267,21 +1248,23 @@ local_zones_add_RR(struct local_zones* zones, const char* rr, ldns_buffer* buf) return 0; } labs = dname_count_size_labels(rr_name, &len); - lock_quick_lock(&zones->lock); + /* could first try readlock then get writelock if zone does not exist, + * but we do not add enough RRs (from multiple threads) to optimize */ + lock_rw_wrlock(&zones->lock); z = local_zones_lookup(zones, rr_name, len, labs, rr_class); if(!z) { z = local_zones_add_zone(zones, rr_name, len, labs, rr_class, local_zone_transparent); if(!z) { - lock_quick_unlock(&zones->lock); + lock_rw_unlock(&zones->lock); return 0; } } else { free(rr_name); } lock_rw_wrlock(&z->lock); - lock_quick_unlock(&zones->lock); - r = lz_enter_rr_into_zone(z, buf, rr); + lock_rw_unlock(&zones->lock); + r = lz_enter_rr_into_zone(z, rr); lock_rw_unlock(&z->lock); return r; } @@ -1326,15 +1309,15 @@ void local_zones_del_data(struct local_zones* zones, /* find zone */ struct local_zone* z; struct local_data* d; - lock_quick_lock(&zones->lock); + lock_rw_rdlock(&zones->lock); z = local_zones_lookup(zones, name, len, labs, dclass); if(!z) { /* no such zone, we're done */ - lock_quick_unlock(&zones->lock); + lock_rw_unlock(&zones->lock); return; } lock_rw_wrlock(&z->lock); - lock_quick_unlock(&zones->lock); + lock_rw_unlock(&zones->lock); /* find the domain */ d = lz_find_node(z, name, len, labs); diff --git a/contrib/unbound/services/localzone.h b/contrib/unbound/services/localzone.h index 794988e66bb..788fbfb3ba2 100644 --- a/contrib/unbound/services/localzone.h +++ b/contrib/unbound/services/localzone.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -48,6 +48,7 @@ struct regional; struct config_file; struct edns_data; struct query_info; +struct sldns_buffer; /** * Local zone type @@ -77,7 +78,7 @@ enum localzone_type { */ struct local_zones { /** lock on the localzone tree */ - lock_quick_t lock; + lock_rw_t lock; /** rbtree of struct local_zone */ rbtree_t ztree; }; @@ -224,7 +225,7 @@ void local_zones_print(struct local_zones* zones); * value is true, but the buffer is cleared (empty). */ int local_zones_answer(struct local_zones* zones, struct query_info* qinfo, - struct edns_data* edns, ldns_buffer* buf, struct regional* temp); + struct edns_data* edns, struct sldns_buffer* buf, struct regional* temp); /** * Parse the string into localzone type. @@ -286,11 +287,9 @@ void local_zones_del_zone(struct local_zones* zones, struct local_zone* zone); * name of the RR is created. * @param zones: the zones tree. Not locked by caller. * @param rr: string with on RR. - * @param buf: buffer for scratch. * @return false on failure. */ -int local_zones_add_RR(struct local_zones* zones, const char* rr, - ldns_buffer* buf); +int local_zones_add_RR(struct local_zones* zones, const char* rr); /** * Remove data from domain name in the tree. diff --git a/contrib/unbound/services/mesh.c b/contrib/unbound/services/mesh.c index 5c66caf3236..bc711d9b3ed 100644 --- a/contrib/unbound/services/mesh.c +++ b/contrib/unbound/services/mesh.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -43,7 +43,6 @@ * send back to clients. */ #include "config.h" -#include #include "services/mesh.h" #include "services/outbound_list.h" #include "services/cache/dns.h" @@ -56,6 +55,7 @@ #include "util/fptr_wlist.h" #include "util/alloc.h" #include "util/config_file.h" +#include "ldns/sbuffer.h" /** subtract timers and the values do not overflow or become negative */ static void @@ -162,7 +162,7 @@ mesh_create(struct module_stack* stack, struct module_env* env) return NULL; } mesh->histogram = timehist_setup(); - mesh->qbuf_bak = ldns_buffer_new(env->cfg->msg_buffer_size); + mesh->qbuf_bak = sldns_buffer_new(env->cfg->msg_buffer_size); if(!mesh->histogram || !mesh->qbuf_bak) { free(mesh); log_err("mesh area alloc: out of memory"); @@ -210,7 +210,7 @@ mesh_delete(struct mesh_area* mesh) while(mesh->all.count) mesh_delete_helper(mesh->all.root); timehist_delete(mesh->histogram); - ldns_buffer_free(mesh->qbuf_bak); + sldns_buffer_free(mesh->qbuf_bak); free(mesh); } @@ -234,7 +234,7 @@ mesh_delete_all(struct mesh_area* mesh) mesh->jostle_last = NULL; } -int mesh_make_new_space(struct mesh_area* mesh, ldns_buffer* qbuf) +int mesh_make_new_space(struct mesh_area* mesh, sldns_buffer* qbuf) { struct mesh_state* m = mesh->jostle_first; /* free space is available */ @@ -253,7 +253,7 @@ int mesh_make_new_space(struct mesh_area* mesh, ldns_buffer* qbuf) m->s.qinfo.qname, m->s.qinfo.qtype, m->s.qinfo.qclass); /* backup the query */ - if(qbuf) ldns_buffer_copy(mesh->qbuf_bak, qbuf); + if(qbuf) sldns_buffer_copy(mesh->qbuf_bak, qbuf); /* notify supers */ if(m->super_set.count > 0) { verbose(VERB_ALGO, "notify supers of failure"); @@ -265,7 +265,7 @@ int mesh_make_new_space(struct mesh_area* mesh, ldns_buffer* qbuf) mesh_state_delete(&m->s); /* restore the query - note that the qinfo ptr to * the querybuffer is then correct again. */ - if(qbuf) ldns_buffer_copy(qbuf, mesh->qbuf_bak); + if(qbuf) sldns_buffer_copy(qbuf, mesh->qbuf_bak); return 1; } } @@ -321,6 +321,8 @@ void mesh_new_client(struct mesh_area* mesh, struct query_info* qinfo, } #ifdef UNBOUND_DEBUG n = +#else + (void) #endif rbtree_insert(&mesh->all, &s->node); log_assert(n != NULL); @@ -370,7 +372,7 @@ void mesh_new_client(struct mesh_area* mesh, struct query_info* qinfo, int mesh_new_callback(struct mesh_area* mesh, struct query_info* qinfo, - uint16_t qflags, struct edns_data* edns, ldns_buffer* buf, + uint16_t qflags, struct edns_data* edns, sldns_buffer* buf, uint16_t qid, mesh_cb_func_t cb, void* cb_arg) { struct mesh_state* s = mesh_area_find(mesh, qinfo, qflags&BIT_RD, 0); @@ -390,6 +392,8 @@ mesh_new_callback(struct mesh_area* mesh, struct query_info* qinfo, } #ifdef UNBOUND_DEBUG n = +#else + (void) #endif rbtree_insert(&mesh->all, &s->node); log_assert(n != NULL); @@ -422,7 +426,7 @@ mesh_new_callback(struct mesh_area* mesh, struct query_info* qinfo, } void mesh_new_prefetch(struct mesh_area* mesh, struct query_info* qinfo, - uint16_t qflags, uint32_t leeway) + uint16_t qflags, time_t leeway) { struct mesh_state* s = mesh_area_find(mesh, qinfo, qflags&BIT_RD, 0); #ifdef UNBOUND_DEBUG @@ -450,6 +454,8 @@ void mesh_new_prefetch(struct mesh_area* mesh, struct query_info* qinfo, } #ifdef UNBOUND_DEBUG n = +#else + (void) #endif rbtree_insert(&mesh->all, &s->node); log_assert(n != NULL); @@ -657,6 +663,8 @@ void mesh_detach_subs(struct module_qstate* qstate) RBTREE_FOR(ref, struct mesh_state_ref*, &qstate->mesh_info->sub_set) { #ifdef UNBOUND_DEBUG n = +#else + (void) #endif rbtree_delete(&ref->s->super_set, &lookup); log_assert(n != NULL); /* must have been present */ @@ -693,6 +701,8 @@ int mesh_attach_sub(struct module_qstate* qstate, struct query_info* qinfo, } #ifdef UNBOUND_DEBUG n = +#else + (void) #endif rbtree_insert(&mesh->all, &sub->node); log_assert(n != NULL); @@ -701,6 +711,8 @@ int mesh_attach_sub(struct module_qstate* qstate, struct query_info* qinfo, /* set new query state to run */ #ifdef UNBOUND_DEBUG n = +#else + (void) #endif rbtree_insert(&mesh->run, &sub->run_node); log_assert(n != NULL); @@ -749,6 +761,8 @@ int mesh_state_attachment(struct mesh_state* super, struct mesh_state* sub) } #ifdef UNBOUND_DEBUG n = +#else + (void) #endif rbtree_insert(&super->sub_set, &subref->node); log_assert(n != NULL); /* we checked above if statement, the reverse @@ -786,7 +800,7 @@ mesh_do_callback(struct mesh_state* m, int rcode, struct reply_info* rep, (*r->cb)(r->cb_arg, rcode, r->buf, sec_status_unchecked, NULL); } else { size_t udp_size = r->edns.udp_size; - ldns_buffer_clear(r->buf); + sldns_buffer_clear(r->buf); r->edns.edns_version = EDNS_ADVERTISED_VERSION; r->edns.udp_size = EDNS_ADVERTISED_SIZE; r->edns.ext_rcode = 0; @@ -844,11 +858,11 @@ mesh_send_reply(struct mesh_state* m, int rcode, struct reply_info* rep, prev->edns.udp_size == r->edns.udp_size) { /* if the previous reply is identical to this one, fix ID */ if(prev->query_reply.c->buffer != r->query_reply.c->buffer) - ldns_buffer_copy(r->query_reply.c->buffer, + sldns_buffer_copy(r->query_reply.c->buffer, prev->query_reply.c->buffer); - ldns_buffer_write_at(r->query_reply.c->buffer, 0, + sldns_buffer_write_at(r->query_reply.c->buffer, 0, &r->qid, sizeof(uint16_t)); - ldns_buffer_write_at(r->query_reply.c->buffer, 12, + sldns_buffer_write_at(r->query_reply.c->buffer, 12, r->qname, m->s.qinfo.qname_len); comm_point_send_reply(&r->query_reply); } else if(rcode) { @@ -878,17 +892,17 @@ mesh_send_reply(struct mesh_state* m, int rcode, struct reply_info* rep, m->s.env->mesh->num_reply_addrs--; end_time = *m->s.env->now_tv; timeval_subtract(&duration, &end_time, &r->start_time); - verbose(VERB_ALGO, "query took %d.%6.6d sec", - (int)duration.tv_sec, (int)duration.tv_usec); + verbose(VERB_ALGO, "query took " ARG_LL "d.%6.6d sec", + (long long)duration.tv_sec, (int)duration.tv_usec); m->s.env->mesh->replies_sent++; timeval_add(&m->s.env->mesh->replies_sum_wait, &duration); timehist_insert(m->s.env->mesh->histogram, &duration); if(m->s.env->cfg->stat_extended) { - uint16_t rc = FLAGS_GET_RCODE(ldns_buffer_read_u16_at(r-> + uint16_t rc = FLAGS_GET_RCODE(sldns_buffer_read_u16_at(r-> query_reply.c->buffer, 2)); if(secure) m->s.env->mesh->ans_secure++; m->s.env->mesh->ans_rcode[ rc ] ++; - if(rc == 0 && LDNS_ANCOUNT(ldns_buffer_begin(r-> + if(rc == 0 && LDNS_ANCOUNT(sldns_buffer_begin(r-> query_reply.c->buffer)) == 0) m->s.env->mesh->ans_nodata++; } @@ -942,7 +956,7 @@ struct mesh_state* mesh_area_find(struct mesh_area* mesh, } int mesh_state_add_cb(struct mesh_state* s, struct edns_data* edns, - ldns_buffer* buf, mesh_cb_func_t cb, void* cb_arg, + sldns_buffer* buf, mesh_cb_func_t cb, void* cb_arg, uint16_t qid, uint16_t qflags) { struct mesh_cb* r = regional_alloc(s->s.region, @@ -1124,7 +1138,8 @@ mesh_stats(struct mesh_area* mesh, const char* str) timeval_divide(&avg, &mesh->replies_sum_wait, mesh->replies_sent); log_info("average recursion processing time " - "%d.%6.6d sec", (int)avg.tv_sec, (int)avg.tv_usec); + ARG_LL "d.%6.6d sec", + (long long)avg.tv_sec, (int)avg.tv_usec); log_info("histogram of recursion processing times"); timehist_log(mesh->histogram, "recursions"); } @@ -1153,7 +1168,7 @@ mesh_get_mem(struct mesh_area* mesh) struct mesh_state* m; size_t s = sizeof(*mesh) + sizeof(struct timehist) + sizeof(struct th_buck)*mesh->histogram->num + - sizeof(ldns_buffer) + ldns_buffer_capacity(mesh->qbuf_bak); + sizeof(sldns_buffer) + sldns_buffer_capacity(mesh->qbuf_bak); RBTREE_FOR(m, struct mesh_state*, &mesh->all) { /* all, including m itself allocated in qstate region */ s += regional_get_mem(m->s.region); diff --git a/contrib/unbound/services/mesh.h b/contrib/unbound/services/mesh.h index 5f109779a4d..fbfbbcb4a94 100644 --- a/contrib/unbound/services/mesh.h +++ b/contrib/unbound/services/mesh.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -51,6 +51,7 @@ #include "util/data/msgparse.h" #include "util/module.h" #include "services/modstack.h" +struct sldns_buffer; struct mesh_state; struct mesh_reply; struct mesh_cb; @@ -125,7 +126,7 @@ struct mesh_area { /** backup of query if other operations recurse and need the * network buffers */ - ldns_buffer* qbuf_bak; + struct sldns_buffer* qbuf_bak; /** double linked list of the run-to-completion query states. * These are query states with a reply */ @@ -219,7 +220,7 @@ struct mesh_reply { * Mesh result callback func. * called as func(cb_arg, rcode, buffer_with_reply, security, why_bogus); */ -typedef void (*mesh_cb_func_t)(void*, int, ldns_buffer*, enum sec_status, +typedef void (*mesh_cb_func_t)(void*, int, struct sldns_buffer*, enum sec_status, char*); /** @@ -235,7 +236,7 @@ struct mesh_cb { /** flags of query, for reply flags */ uint16_t qflags; /** buffer for reply */ - ldns_buffer* buf; + struct sldns_buffer* buf; /** callback routine for results. if rcode != 0 buf has message. * called as cb(cb_arg, rcode, buf, sec_state); @@ -294,7 +295,7 @@ void mesh_new_client(struct mesh_area* mesh, struct query_info* qinfo, * @return 0 on error. */ int mesh_new_callback(struct mesh_area* mesh, struct query_info* qinfo, - uint16_t qflags, struct edns_data* edns, ldns_buffer* buf, + uint16_t qflags, struct edns_data* edns, struct sldns_buffer* buf, uint16_t qid, mesh_cb_func_t cb, void* cb_arg); /** @@ -307,7 +308,7 @@ int mesh_new_callback(struct mesh_area* mesh, struct query_info* qinfo, * @param leeway: TTL leeway what to expire earlier for this update. */ void mesh_new_prefetch(struct mesh_area* mesh, struct query_info* qinfo, - uint16_t qflags, uint32_t leeway); + uint16_t qflags, time_t leeway); /** * Handle new event from the wire. A serviced query has returned. @@ -473,7 +474,7 @@ int mesh_state_add_reply(struct mesh_state* s, struct edns_data* edns, * @return: 0 on alloc error. */ int mesh_state_add_cb(struct mesh_state* s, struct edns_data* edns, - ldns_buffer* buf, mesh_cb_func_t cb, void* cb_arg, uint16_t qid, + struct sldns_buffer* buf, mesh_cb_func_t cb, void* cb_arg, uint16_t qid, uint16_t qflags); /** @@ -548,7 +549,7 @@ int mesh_state_ref_compare(const void* ap, const void* bp); * You can pass NULL if there is no buffer that must be backed up. * @return false if no space is available. */ -int mesh_make_new_space(struct mesh_area* mesh, ldns_buffer* qbuf); +int mesh_make_new_space(struct mesh_area* mesh, struct sldns_buffer* qbuf); /** * Insert mesh state into a double linked list. Inserted at end. diff --git a/contrib/unbound/services/modstack.c b/contrib/unbound/services/modstack.c index 7395598c31c..56515a61f36 100644 --- a/contrib/unbound/services/modstack.c +++ b/contrib/unbound/services/modstack.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/services/modstack.h b/contrib/unbound/services/modstack.h index 869b593ad26..cb8613299ab 100644 --- a/contrib/unbound/services/modstack.h +++ b/contrib/unbound/services/modstack.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/services/outbound_list.c b/contrib/unbound/services/outbound_list.c index be491490411..ad73380bcf8 100644 --- a/contrib/unbound/services/outbound_list.c +++ b/contrib/unbound/services/outbound_list.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/services/outbound_list.h b/contrib/unbound/services/outbound_list.h index 5631910f6f8..ad59e42d192 100644 --- a/contrib/unbound/services/outbound_list.h +++ b/contrib/unbound/services/outbound_list.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/services/outside_network.c b/contrib/unbound/services/outside_network.c index e1cd0fd3877..fedbd0fa8c8 100644 --- a/contrib/unbound/services/outside_network.c +++ b/contrib/unbound/services/outside_network.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -45,7 +45,6 @@ # include #endif #include -#include #include "services/outside_network.h" #include "services/listen_dnsport.h" #include "services/cache/infra.h" @@ -58,6 +57,7 @@ #include "util/net_help.h" #include "util/random.h" #include "util/fptr_wlist.h" +#include "ldns/sbuffer.h" #ifdef HAVE_OPENSSL_SSL_H #include #endif @@ -76,10 +76,10 @@ /** initiate TCP transaction for serviced query */ static void serviced_tcp_initiate(struct outside_network* outnet, - struct serviced_query* sq, ldns_buffer* buff); + struct serviced_query* sq, sldns_buffer* buff); /** with a fd available, randomize and send UDP */ static int randomize_and_send_udp(struct outside_network* outnet, - struct pending* pend, ldns_buffer* packet, int timeout); + struct pending* pend, sldns_buffer* packet, int timeout); int pending_cmp(const void* key1, const void* key2) @@ -263,9 +263,9 @@ outnet_tcp_take_into_use(struct waiting_tcp* w, uint8_t* pkt, size_t pkt_len) pend->query = w; pend->c->repinfo.addrlen = w->addrlen; memcpy(&pend->c->repinfo.addr, &w->addr, w->addrlen); - ldns_buffer_clear(pend->c->buffer); - ldns_buffer_write(pend->c->buffer, pkt, pkt_len); - ldns_buffer_flip(pend->c->buffer); + sldns_buffer_clear(pend->c->buffer); + sldns_buffer_write(pend->c->buffer, pkt, pkt_len); + sldns_buffer_flip(pend->c->buffer); pend->c->tcp_is_reading = 0; pend->c->tcp_byte_count = 0; comm_point_start_listening(pend->c, s, -1); @@ -325,8 +325,8 @@ outnet_tcp_cb(struct comm_point* c, void* arg, int error, /* pass error below and exit */ } else { /* check ID */ - if(ldns_buffer_limit(c->buffer) < sizeof(uint16_t) || - LDNS_ID_WIRE(ldns_buffer_begin(c->buffer))!=pend->id) { + if(sldns_buffer_limit(c->buffer) < sizeof(uint16_t) || + LDNS_ID_WIRE(sldns_buffer_begin(c->buffer))!=pend->id) { log_addr(VERB_QUERY, "outnettcp: bad ID in reply, from:", &pend->query->addr, pend->query->addrlen); @@ -372,18 +372,20 @@ outnet_send_wait_udp(struct outside_network* outnet) pend = outnet->udp_wait_first; outnet->udp_wait_first = pend->next_waiting; if(!pend->next_waiting) outnet->udp_wait_last = NULL; - ldns_buffer_clear(outnet->udp_buff); - ldns_buffer_write(outnet->udp_buff, pend->pkt, pend->pkt_len); - ldns_buffer_flip(outnet->udp_buff); + sldns_buffer_clear(outnet->udp_buff); + sldns_buffer_write(outnet->udp_buff, pend->pkt, pend->pkt_len); + sldns_buffer_flip(outnet->udp_buff); free(pend->pkt); /* freeing now makes get_mem correct */ pend->pkt = NULL; pend->pkt_len = 0; if(!randomize_and_send_udp(outnet, pend, outnet->udp_buff, pend->timeout)) { /* callback error on pending */ - fptr_ok(fptr_whitelist_pending_udp(pend->cb)); - (void)(*pend->cb)(outnet->unused_fds->cp, pend->cb_arg, - NETEVENT_CLOSED, NULL); + if(pend->cb) { + fptr_ok(fptr_whitelist_pending_udp(pend->cb)); + (void)(*pend->cb)(outnet->unused_fds->cp, pend->cb_arg, + NETEVENT_CLOSED, NULL); + } pending_delete(outnet, pend); } } @@ -402,14 +404,14 @@ outnet_udp_cb(struct comm_point* c, void* arg, int error, verbose(VERB_QUERY, "outnetudp got udp error %d", error); return 0; } - if(ldns_buffer_limit(c->buffer) < LDNS_HEADER_SIZE) { + if(sldns_buffer_limit(c->buffer) < LDNS_HEADER_SIZE) { verbose(VERB_QUERY, "outnetudp udp too short"); return 0; } log_assert(reply_info); /* setup lookup key */ - key.id = (unsigned)LDNS_ID_WIRE(ldns_buffer_begin(c->buffer)); + key.id = (unsigned)LDNS_ID_WIRE(sldns_buffer_begin(c->buffer)); memcpy(&key.addr, &reply_info->addr, reply_info->addrlen); key.addrlen = reply_info->addrlen; verbose(VERB_ALGO, "Incoming reply id = %4.4x", key.id); @@ -460,8 +462,10 @@ outnet_udp_cb(struct comm_point* c, void* arg, int error, verbose(VERB_ALGO, "outnet handle udp reply"); /* delete from tree first in case callback creates a retry */ (void)rbtree_delete(outnet->pending, p->node.key); - fptr_ok(fptr_whitelist_pending_udp(p->cb)); - (void)(*p->cb)(p->pc->cp, p->cb_arg, NETEVENT_NOERROR, reply_info); + if(p->cb) { + fptr_ok(fptr_whitelist_pending_udp(p->cb)); + (void)(*p->cb)(p->pc->cp, p->cb_arg, NETEVENT_NOERROR, reply_info); + } portcomm_loweruse(outnet, p->pc); pending_delete(NULL, p); outnet_send_wait_udp(outnet); @@ -496,6 +500,17 @@ calc_num46(char** ifs, int num_ifs, int do_ip4, int do_ip6, } +void +pending_udp_timer_delay_cb(void* arg) +{ + struct pending* p = (struct pending*)arg; + struct outside_network* outnet = p->outnet; + verbose(VERB_ALGO, "timeout udp with delay"); + portcomm_loweruse(outnet, p->pc); + pending_delete(outnet, p); + outnet_send_wait_udp(outnet); +} + void pending_udp_timer_cb(void *arg) { @@ -503,8 +518,20 @@ pending_udp_timer_cb(void *arg) struct outside_network* outnet = p->outnet; /* it timed out */ verbose(VERB_ALGO, "timeout udp"); - fptr_ok(fptr_whitelist_pending_udp(p->cb)); - (void)(*p->cb)(p->pc->cp, p->cb_arg, NETEVENT_TIMEOUT, NULL); + if(p->cb) { + fptr_ok(fptr_whitelist_pending_udp(p->cb)); + (void)(*p->cb)(p->pc->cp, p->cb_arg, NETEVENT_TIMEOUT, NULL); + } + /* if delayclose, keep port open for a longer time. + * But if the udpwaitlist exists, then we are struggling to + * keep up with demand for sockets, so do not wait, but service + * the customer (customer service more important than portICMPs) */ + if(outnet->delayclose && !outnet->udp_wait_first) { + p->cb = NULL; + p->timer->callback = &pending_udp_timer_delay_cb; + comm_timer_set(p->timer, &outnet->delay_tv); + return; + } portcomm_loweruse(outnet, p->pc); pending_delete(outnet, p); outnet_send_wait_udp(outnet); @@ -561,7 +588,7 @@ outside_network_create(struct comm_base *base, size_t bufsize, struct ub_randstate* rnd, int use_caps_for_id, int* availports, int numavailports, size_t unwanted_threshold, void (*unwanted_action)(void*), void* unwanted_param, int do_udp, - void* sslctx) + void* sslctx, int delayclose) { struct outside_network* outnet = (struct outside_network*) calloc(1, sizeof(struct outside_network)); @@ -583,6 +610,13 @@ outside_network_create(struct comm_base *base, size_t bufsize, outnet->unwanted_param = unwanted_param; outnet->use_caps_for_id = use_caps_for_id; outnet->do_udp = do_udp; +#ifndef S_SPLINT_S + if(delayclose) { + outnet->delayclose = 1; + outnet->delay_tv.tv_sec = delayclose/1000; + outnet->delay_tv.tv_usec = (delayclose%1000)*1000; + } +#endif if(numavailports == 0) { log_err("no outgoing ports available"); outside_network_delete(outnet); @@ -609,7 +643,7 @@ outside_network_create(struct comm_base *base, size_t bufsize, return NULL; } } - if( !(outnet->udp_buff = ldns_buffer_new(bufsize)) || + if( !(outnet->udp_buff = sldns_buffer_new(bufsize)) || !(outnet->pending = rbtree_create(pending_cmp)) || !(outnet->serviced = rbtree_create(serviced_cmp)) || !create_pending_tcp(outnet, bufsize)) { @@ -731,7 +765,7 @@ outside_network_delete(struct outside_network* outnet) free(outnet->serviced); } if(outnet->udp_buff) - ldns_buffer_free(outnet->udp_buff); + sldns_buffer_free(outnet->udp_buff); if(outnet->unused_fds) { struct port_comm* p = outnet->unused_fds, *np; while(p) { @@ -849,13 +883,13 @@ udp_sockport(struct sockaddr_storage* addr, socklen_t addrlen, int port, sa->sin6_port = (in_port_t)htons((uint16_t)port); fd = create_udp_sock(AF_INET6, SOCK_DGRAM, (struct sockaddr*)addr, addrlen, 1, inuse, &noproto, - 0, 0); + 0, 0, 0, NULL); } else { struct sockaddr_in* sa = (struct sockaddr_in*)addr; sa->sin_port = (in_port_t)htons((uint16_t)port); fd = create_udp_sock(AF_INET, SOCK_DGRAM, (struct sockaddr*)addr, addrlen, 1, inuse, &noproto, - 0, 0); + 0, 0, 0, NULL); } return fd; } @@ -863,18 +897,18 @@ udp_sockport(struct sockaddr_storage* addr, socklen_t addrlen, int port, /** Select random ID */ static int select_id(struct outside_network* outnet, struct pending* pend, - ldns_buffer* packet) + sldns_buffer* packet) { int id_tries = 0; pend->id = ((unsigned)ub_random(outnet->rnd)>>8) & 0xffff; - LDNS_ID_SET(ldns_buffer_begin(packet), pend->id); + LDNS_ID_SET(sldns_buffer_begin(packet), pend->id); /* insert in tree */ pend->node.key = pend; while(!rbtree_insert(outnet->pending, &pend->node)) { /* change ID to avoid collision */ pend->id = ((unsigned)ub_random(outnet->rnd)>>8) & 0xffff; - LDNS_ID_SET(ldns_buffer_begin(packet), pend->id); + LDNS_ID_SET(sldns_buffer_begin(packet), pend->id); id_tries++; if(id_tries == MAX_ID_RETRY) { pend->id=99999; /* non existant ID */ @@ -958,7 +992,7 @@ select_ifport(struct outside_network* outnet, struct pending* pend, static int randomize_and_send_udp(struct outside_network* outnet, struct pending* pend, - ldns_buffer* packet, int timeout) + sldns_buffer* packet, int timeout) { struct timeval tv; @@ -997,7 +1031,7 @@ randomize_and_send_udp(struct outside_network* outnet, struct pending* pend, } struct pending* -pending_udp_query(struct outside_network* outnet, ldns_buffer* packet, +pending_udp_query(struct outside_network* outnet, sldns_buffer* packet, struct sockaddr_storage* addr, socklen_t addrlen, int timeout, comm_point_callback_t* cb, void* cb_arg) { @@ -1020,8 +1054,8 @@ pending_udp_query(struct outside_network* outnet, ldns_buffer* packet, /* no unused fd, cannot create a new port (randomly) */ verbose(VERB_ALGO, "no fds available, udp query waiting"); pend->timeout = timeout; - pend->pkt_len = ldns_buffer_limit(packet); - pend->pkt = (uint8_t*)memdup(ldns_buffer_begin(packet), + pend->pkt_len = sldns_buffer_limit(packet); + pend->pkt = (uint8_t*)memdup(sldns_buffer_begin(packet), pend->pkt_len); if(!pend->pkt) { comm_timer_delete(pend->timer); @@ -1080,7 +1114,7 @@ outnet_tcptimer(void* arg) } struct waiting_tcp* -pending_tcp_query(struct outside_network* outnet, ldns_buffer* packet, +pending_tcp_query(struct outside_network* outnet, sldns_buffer* packet, struct sockaddr_storage* addr, socklen_t addrlen, int timeout, comm_point_callback_t* callback, void* callback_arg, int ssl_upstream) { @@ -1090,7 +1124,7 @@ pending_tcp_query(struct outside_network* outnet, ldns_buffer* packet, uint16_t id; /* if no buffer is free allocate space to store query */ w = (struct waiting_tcp*)malloc(sizeof(struct waiting_tcp) - + (pend?0:ldns_buffer_limit(packet))); + + (pend?0:sldns_buffer_limit(packet))); if(!w) { return NULL; } @@ -1101,7 +1135,7 @@ pending_tcp_query(struct outside_network* outnet, ldns_buffer* packet, w->pkt = NULL; w->pkt_len = 0; id = ((unsigned)ub_random(outnet->rnd)>>8) & 0xffff; - LDNS_ID_SET(ldns_buffer_begin(packet), id); + LDNS_ID_SET(sldns_buffer_begin(packet), id); memcpy(&w->addr, addr, addrlen); w->addrlen = addrlen; w->outnet = outnet; @@ -1115,16 +1149,16 @@ pending_tcp_query(struct outside_network* outnet, ldns_buffer* packet, comm_timer_set(w->timer, &tv); if(pend) { /* we have a buffer available right now */ - if(!outnet_tcp_take_into_use(w, ldns_buffer_begin(packet), - ldns_buffer_limit(packet))) { + if(!outnet_tcp_take_into_use(w, sldns_buffer_begin(packet), + sldns_buffer_limit(packet))) { waiting_tcp_delete(w); return NULL; } } else { /* queue up */ w->pkt = (uint8_t*)w + sizeof(struct waiting_tcp); - w->pkt_len = ldns_buffer_limit(packet); - memmove(w->pkt, ldns_buffer_begin(packet), w->pkt_len); + w->pkt_len = sldns_buffer_limit(packet); + memmove(w->pkt, sldns_buffer_begin(packet), w->pkt_len); w->next_waiting = NULL; if(outnet->tcp_wait_last) outnet->tcp_wait_last->next_waiting = w; @@ -1136,31 +1170,31 @@ pending_tcp_query(struct outside_network* outnet, ldns_buffer* packet, /** create query for serviced queries */ static void -serviced_gen_query(ldns_buffer* buff, uint8_t* qname, size_t qnamelen, +serviced_gen_query(sldns_buffer* buff, uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, uint16_t flags) { - ldns_buffer_clear(buff); + sldns_buffer_clear(buff); /* skip id */ - ldns_buffer_write_u16(buff, flags); - ldns_buffer_write_u16(buff, 1); /* qdcount */ - ldns_buffer_write_u16(buff, 0); /* ancount */ - ldns_buffer_write_u16(buff, 0); /* nscount */ - ldns_buffer_write_u16(buff, 0); /* arcount */ - ldns_buffer_write(buff, qname, qnamelen); - ldns_buffer_write_u16(buff, qtype); - ldns_buffer_write_u16(buff, qclass); - ldns_buffer_flip(buff); + sldns_buffer_write_u16(buff, flags); + sldns_buffer_write_u16(buff, 1); /* qdcount */ + sldns_buffer_write_u16(buff, 0); /* ancount */ + sldns_buffer_write_u16(buff, 0); /* nscount */ + sldns_buffer_write_u16(buff, 0); /* arcount */ + sldns_buffer_write(buff, qname, qnamelen); + sldns_buffer_write_u16(buff, qtype); + sldns_buffer_write_u16(buff, qclass); + sldns_buffer_flip(buff); } /** lookup serviced query in serviced query rbtree */ static struct serviced_query* -lookup_serviced(struct outside_network* outnet, ldns_buffer* buff, int dnssec, +lookup_serviced(struct outside_network* outnet, sldns_buffer* buff, int dnssec, struct sockaddr_storage* addr, socklen_t addrlen) { struct serviced_query key; key.node.key = &key; - key.qbuf = ldns_buffer_begin(buff); - key.qbuflen = ldns_buffer_limit(buff); + key.qbuf = sldns_buffer_begin(buff); + key.qbuflen = sldns_buffer_limit(buff); key.dnssec = dnssec; memcpy(&key.addr, addr, addrlen); key.addrlen = addrlen; @@ -1170,7 +1204,7 @@ lookup_serviced(struct outside_network* outnet, ldns_buffer* buff, int dnssec, /** Create new serviced entry */ static struct serviced_query* -serviced_create(struct outside_network* outnet, ldns_buffer* buff, int dnssec, +serviced_create(struct outside_network* outnet, sldns_buffer* buff, int dnssec, int want_dnssec, int tcp_upstream, int ssl_upstream, struct sockaddr_storage* addr, socklen_t addrlen, uint8_t* zone, size_t zonelen, int qtype) @@ -1182,12 +1216,12 @@ serviced_create(struct outside_network* outnet, ldns_buffer* buff, int dnssec, if(!sq) return NULL; sq->node.key = sq; - sq->qbuf = memdup(ldns_buffer_begin(buff), ldns_buffer_limit(buff)); + sq->qbuf = memdup(sldns_buffer_begin(buff), sldns_buffer_limit(buff)); if(!sq->qbuf) { free(sq); return NULL; } - sq->qbuflen = ldns_buffer_limit(buff); + sq->qbuflen = sldns_buffer_limit(buff); sq->zone = memdup(zone, zonelen); if(!sq->zone) { free(sq->qbuf); @@ -1210,6 +1244,8 @@ serviced_create(struct outside_network* outnet, ldns_buffer* buff, int dnssec, sq->to_be_deleted = 0; #ifdef UNBOUND_DEBUG ins = +#else + (void) #endif rbtree_insert(outnet->serviced, &sq->node); log_assert(ins != NULL); /* must not be already present */ @@ -1310,17 +1346,17 @@ serviced_perturb_qname(struct ub_randstate* rnd, uint8_t* qbuf, size_t len) /** put serviced query into a buffer */ static void -serviced_encode(struct serviced_query* sq, ldns_buffer* buff, int with_edns) +serviced_encode(struct serviced_query* sq, sldns_buffer* buff, int with_edns) { /* if we are using 0x20 bits for ID randomness, perturb them */ if(sq->outnet->use_caps_for_id) { serviced_perturb_qname(sq->outnet->rnd, sq->qbuf, sq->qbuflen); } /* generate query */ - ldns_buffer_clear(buff); - ldns_buffer_write_u16(buff, 0); /* id placeholder */ - ldns_buffer_write(buff, sq->qbuf, sq->qbuflen); - ldns_buffer_flip(buff); + sldns_buffer_clear(buff); + sldns_buffer_write_u16(buff, 0); /* id placeholder */ + sldns_buffer_write(buff, sq->qbuf, sq->qbuflen); + sldns_buffer_flip(buff); if(with_edns) { /* add edns section */ struct edns_data edns; @@ -1344,7 +1380,7 @@ serviced_encode(struct serviced_query* sq, ldns_buffer* buff, int with_edns) if(sq->dnssec & EDNS_DO) edns.bits = EDNS_DO; if(sq->dnssec & BIT_CD) - LDNS_CD_SET(ldns_buffer_begin(buff)); + LDNS_CD_SET(sldns_buffer_begin(buff)); attach_edns_record(buff, &edns); } } @@ -1357,11 +1393,11 @@ serviced_encode(struct serviced_query* sq, ldns_buffer* buff, int with_edns) * @return 0 on error. */ static int -serviced_udp_send(struct serviced_query* sq, ldns_buffer* buff) +serviced_udp_send(struct serviced_query* sq, sldns_buffer* buff) { int rtt, vs; uint8_t edns_lame_known; - uint32_t now = *sq->outnet->now_secs; + time_t now = *sq->outnet->now_secs; if(!infra_host(sq->outnet->infra, &sq->addr, sq->addrlen, sq->zone, sq->zonelen, now, &vs, &edns_lame_known, &rtt)) @@ -1397,21 +1433,21 @@ serviced_udp_send(struct serviced_query* sq, ldns_buffer* buff) /** check that perturbed qname is identical */ static int -serviced_check_qname(ldns_buffer* pkt, uint8_t* qbuf, size_t qbuflen) +serviced_check_qname(sldns_buffer* pkt, uint8_t* qbuf, size_t qbuflen) { - uint8_t* d1 = ldns_buffer_at(pkt, 12); + uint8_t* d1 = sldns_buffer_at(pkt, 12); uint8_t* d2 = qbuf+10; uint8_t len1, len2; int count = 0; log_assert(qbuflen >= 15 /* 10 header, root, type, class */); len1 = *d1++; len2 = *d2++; - if(ldns_buffer_limit(pkt) < 12+1+4) /* packet too small for qname */ + if(sldns_buffer_limit(pkt) < 12+1+4) /* packet too small for qname */ return 0; while(len1 != 0 || len2 != 0) { if(LABEL_IS_PTR(len1)) { - d1 = ldns_buffer_at(pkt, PTR_OFFSET(len1, *d1)); - if(d1 >= ldns_buffer_at(pkt, ldns_buffer_limit(pkt))) + d1 = sldns_buffer_at(pkt, PTR_OFFSET(len1, *d1)); + if(d1 >= sldns_buffer_at(pkt, sldns_buffer_limit(pkt))) return 0; len1 = *d1++; if(count++ > MAX_COMPRESS_PTRS) @@ -1449,6 +1485,8 @@ serviced_callbacks(struct serviced_query* sq, int error, struct comm_point* c, size_t backlen = 0; #ifdef UNBOUND_DEBUG rbnode_t* rem = +#else + (void) #endif /* remove from tree, and schedule for deletion, so that callbacks * can safely deregister themselves and even create new serviced @@ -1459,10 +1497,10 @@ serviced_callbacks(struct serviced_query* sq, int error, struct comm_point* c, verbose(VERB_ALGO, "svcd callbacks start"); if(sq->outnet->use_caps_for_id && error == NETEVENT_NOERROR && c) { /* noerror and nxdomain must have a qname in reply */ - if(ldns_buffer_read_u16_at(c->buffer, 4) == 0 && - (LDNS_RCODE_WIRE(ldns_buffer_begin(c->buffer)) + if(sldns_buffer_read_u16_at(c->buffer, 4) == 0 && + (LDNS_RCODE_WIRE(sldns_buffer_begin(c->buffer)) == LDNS_RCODE_NOERROR || - LDNS_RCODE_WIRE(ldns_buffer_begin(c->buffer)) + LDNS_RCODE_WIRE(sldns_buffer_begin(c->buffer)) == LDNS_RCODE_NXDOMAIN)) { verbose(VERB_DETAIL, "no qname in reply to check 0x20ID"); log_addr(VERB_DETAIL, "from server", @@ -1470,7 +1508,7 @@ serviced_callbacks(struct serviced_query* sq, int error, struct comm_point* c, log_buf(VERB_DETAIL, "for packet", c->buffer); error = NETEVENT_CLOSED; c = NULL; - } else if(ldns_buffer_read_u16_at(c->buffer, 4) > 0 && + } else if(sldns_buffer_read_u16_at(c->buffer, 4) > 0 && !serviced_check_qname(c->buffer, sq->qbuf, sq->qbuflen)) { verbose(VERB_DETAIL, "wrong 0x20-ID in reply qname"); @@ -1480,12 +1518,12 @@ serviced_callbacks(struct serviced_query* sq, int error, struct comm_point* c, error = NETEVENT_CAPSFAIL; /* and cleanup too */ pkt_dname_tolower(c->buffer, - ldns_buffer_at(c->buffer, 12)); + sldns_buffer_at(c->buffer, 12)); } else { verbose(VERB_ALGO, "good 0x20-ID in reply qname"); /* cleanup caps, prettier cache contents. */ pkt_dname_tolower(c->buffer, - ldns_buffer_at(c->buffer, 12)); + sldns_buffer_at(c->buffer, 12)); } } if(dobackup && c) { @@ -1493,8 +1531,8 @@ serviced_callbacks(struct serviced_query* sq, int error, struct comm_point* c, * may send outgoing queries that overwrite the buffer. * use secondary buffer to store the query. * This is a data copy, but faster than packet to server */ - backlen = ldns_buffer_limit(c->buffer); - backup_p = memdup(ldns_buffer_begin(c->buffer), backlen); + backlen = sldns_buffer_limit(c->buffer); + backup_p = memdup(sldns_buffer_begin(c->buffer), backlen); if(!backup_p) { log_err("malloc failure in serviced query callbacks"); error = NETEVENT_CLOSED; @@ -1506,9 +1544,9 @@ serviced_callbacks(struct serviced_query* sq, int error, struct comm_point* c, while((p=sq->cblist) != NULL) { sq->cblist = p->next; /* remove this element */ if(dobackup && c) { - ldns_buffer_clear(c->buffer); - ldns_buffer_write(c->buffer, backup_p, backlen); - ldns_buffer_flip(c->buffer); + sldns_buffer_clear(c->buffer); + sldns_buffer_write(c->buffer, backup_p, backlen); + sldns_buffer_flip(c->buffer); } fptr_ok(fptr_whitelist_serviced_query(p->cb)); (void)(*p->cb)(c, p->cb_arg, error, rep); @@ -1537,8 +1575,8 @@ serviced_tcp_callback(struct comm_point* c, void* arg, int error, infra_update_tcp_works(sq->outnet->infra, &sq->addr, sq->addrlen, sq->zone, sq->zonelen); if(error==NETEVENT_NOERROR && sq->status == serviced_query_TCP_EDNS && - (LDNS_RCODE_WIRE(ldns_buffer_begin(c->buffer)) == - LDNS_RCODE_FORMERR || LDNS_RCODE_WIRE(ldns_buffer_begin( + (LDNS_RCODE_WIRE(sldns_buffer_begin(c->buffer)) == + LDNS_RCODE_FORMERR || LDNS_RCODE_WIRE(sldns_buffer_begin( c->buffer)) == LDNS_RCODE_NOTIMPL) ) { /* attempt to fallback to nonEDNS */ sq->status = serviced_query_TCP_EDNS_fallback; @@ -1546,10 +1584,10 @@ serviced_tcp_callback(struct comm_point* c, void* arg, int error, return 0; } else if(error==NETEVENT_NOERROR && sq->status == serviced_query_TCP_EDNS_fallback && - (LDNS_RCODE_WIRE(ldns_buffer_begin(c->buffer)) == + (LDNS_RCODE_WIRE(sldns_buffer_begin(c->buffer)) == LDNS_RCODE_NOERROR || LDNS_RCODE_WIRE( - ldns_buffer_begin(c->buffer)) == LDNS_RCODE_NXDOMAIN - || LDNS_RCODE_WIRE(ldns_buffer_begin(c->buffer)) + sldns_buffer_begin(c->buffer)) == LDNS_RCODE_NXDOMAIN + || LDNS_RCODE_WIRE(sldns_buffer_begin(c->buffer)) == LDNS_RCODE_YXDOMAIN)) { /* the fallback produced a result that looks promising, note * that this server should be approached without EDNS */ @@ -1567,7 +1605,7 @@ serviced_tcp_callback(struct comm_point* c, void* arg, int error, (now.tv_sec == sq->last_sent_time.tv_sec && now.tv_usec > sq->last_sent_time.tv_usec)) { /* convert from microseconds to milliseconds */ - int roundtime = ((int)now.tv_sec - (int)sq->last_sent_time.tv_sec)*1000 + int roundtime = ((int)(now.tv_sec - sq->last_sent_time.tv_sec))*1000 + ((int)now.tv_usec - (int)sq->last_sent_time.tv_usec)/1000; verbose(VERB_ALGO, "measured TCP-time at %d msec", roundtime); log_assert(roundtime >= 0); @@ -1576,7 +1614,7 @@ serviced_tcp_callback(struct comm_point* c, void* arg, int error, if(roundtime < TCP_AUTH_QUERY_TIMEOUT*1000) { if(!infra_rtt_update(sq->outnet->infra, &sq->addr, sq->addrlen, sq->zone, sq->zonelen, sq->qtype, - roundtime, sq->last_rtt, (uint32_t)now.tv_sec)) + roundtime, sq->last_rtt, (time_t)now.tv_sec)) log_err("out of memory noting rtt."); } } @@ -1595,7 +1633,7 @@ serviced_tcp_callback(struct comm_point* c, void* arg, int error, static void serviced_tcp_initiate(struct outside_network* outnet, - struct serviced_query* sq, ldns_buffer* buff) + struct serviced_query* sq, sldns_buffer* buff) { verbose(VERB_ALGO, "initiate TCP query %s", sq->status==serviced_query_TCP_EDNS?"EDNS":""); @@ -1614,7 +1652,7 @@ serviced_tcp_initiate(struct outside_network* outnet, /** Send serviced query over TCP return false on initial failure */ static int -serviced_tcp_send(struct serviced_query* sq, ldns_buffer* buff) +serviced_tcp_send(struct serviced_query* sq, sldns_buffer* buff) { int vs, rtt; uint8_t edns_lame_known; @@ -1668,7 +1706,7 @@ serviced_udp_callback(struct comm_point* c, void* arg, int error, sq->retry++; if(!(rto=infra_rtt_update(outnet->infra, &sq->addr, sq->addrlen, sq->zone, sq->zonelen, sq->qtype, -1, sq->last_rtt, - (uint32_t)now.tv_sec))) + (time_t)now.tv_sec))) log_err("out of memory in UDP exponential backoff"); if(sq->retry < OUTBOUND_UDP_RETRY) { log_name_addr(VERB_ALGO, "retry query", sq->qbuf+10, @@ -1693,9 +1731,9 @@ serviced_udp_callback(struct comm_point* c, void* arg, int error, if(!fallback_tcp) { if( (sq->status == serviced_query_UDP_EDNS ||sq->status == serviced_query_UDP_EDNS_FRAG) - && (LDNS_RCODE_WIRE(ldns_buffer_begin(c->buffer)) + && (LDNS_RCODE_WIRE(sldns_buffer_begin(c->buffer)) == LDNS_RCODE_FORMERR || LDNS_RCODE_WIRE( - ldns_buffer_begin(c->buffer)) == LDNS_RCODE_NOTIMPL)) { + sldns_buffer_begin(c->buffer)) == LDNS_RCODE_NOTIMPL)) { /* try to get an answer by falling back without EDNS */ verbose(VERB_ALGO, "serviced query: attempt without EDNS"); sq->status = serviced_query_UDP_EDNS_fallback; @@ -1712,7 +1750,7 @@ serviced_udp_callback(struct comm_point* c, void* arg, int error, /* only store noEDNS in cache if domain is noDNSSEC */ if(!sq->want_dnssec) if(!infra_edns_update(outnet->infra, &sq->addr, sq->addrlen, - sq->zone, sq->zonelen, -1, (uint32_t)now.tv_sec)) { + sq->zone, sq->zonelen, -1, (time_t)now.tv_sec)) { log_err("Out of memory caching no edns for host"); } sq->status = serviced_query_UDP; @@ -1722,15 +1760,15 @@ serviced_udp_callback(struct comm_point* c, void* arg, int error, log_addr(VERB_ALGO, "serviced query: EDNS works for", &sq->addr, sq->addrlen); if(!infra_edns_update(outnet->infra, &sq->addr, sq->addrlen, - sq->zone, sq->zonelen, 0, (uint32_t)now.tv_sec)) { + sq->zone, sq->zonelen, 0, (time_t)now.tv_sec)) { log_err("Out of memory caching edns works"); } sq->edns_lame_known = 1; } else if(sq->status == serviced_query_UDP_EDNS_fallback && !sq->edns_lame_known && (LDNS_RCODE_WIRE( - ldns_buffer_begin(c->buffer)) == LDNS_RCODE_NOERROR || - LDNS_RCODE_WIRE(ldns_buffer_begin(c->buffer)) == - LDNS_RCODE_NXDOMAIN || LDNS_RCODE_WIRE(ldns_buffer_begin( + sldns_buffer_begin(c->buffer)) == LDNS_RCODE_NOERROR || + LDNS_RCODE_WIRE(sldns_buffer_begin(c->buffer)) == + LDNS_RCODE_NXDOMAIN || LDNS_RCODE_WIRE(sldns_buffer_begin( c->buffer)) == LDNS_RCODE_YXDOMAIN)) { /* the fallback produced a result that looks promising, note * that this server should be approached without EDNS */ @@ -1739,7 +1777,7 @@ serviced_udp_callback(struct comm_point* c, void* arg, int error, log_addr(VERB_ALGO, "serviced query: EDNS fails for", &sq->addr, sq->addrlen); if(!infra_edns_update(outnet->infra, &sq->addr, sq->addrlen, - sq->zone, sq->zonelen, -1, (uint32_t)now.tv_sec)) { + sq->zone, sq->zonelen, -1, (time_t)now.tv_sec)) { log_err("Out of memory caching no edns for host"); } } else { @@ -1753,7 +1791,7 @@ serviced_udp_callback(struct comm_point* c, void* arg, int error, (now.tv_sec == sq->last_sent_time.tv_sec && now.tv_usec > sq->last_sent_time.tv_usec)) { /* convert from microseconds to milliseconds */ - int roundtime = ((int)now.tv_sec - (int)sq->last_sent_time.tv_sec)*1000 + int roundtime = ((int)(now.tv_sec - sq->last_sent_time.tv_sec))*1000 + ((int)now.tv_usec - (int)sq->last_sent_time.tv_usec)/1000; verbose(VERB_ALGO, "measured roundtrip at %d msec", roundtime); log_assert(roundtime >= 0); @@ -1762,14 +1800,14 @@ serviced_udp_callback(struct comm_point* c, void* arg, int error, if(roundtime < 60000) { if(!infra_rtt_update(outnet->infra, &sq->addr, sq->addrlen, sq->zone, sq->zonelen, sq->qtype, roundtime, - sq->last_rtt, (uint32_t)now.tv_sec)) + sq->last_rtt, (time_t)now.tv_sec)) log_err("out of memory noting rtt."); } } } /* end of if_!fallback_tcp */ /* perform TC flag check and TCP fallback after updating our * cache entries for EDNS status and RTT times */ - if(LDNS_TC_WIRE(ldns_buffer_begin(c->buffer)) || fallback_tcp) { + if(LDNS_TC_WIRE(sldns_buffer_begin(c->buffer)) || fallback_tcp) { /* fallback to TCP */ /* this discards partial UDP contents */ if(sq->status == serviced_query_UDP_EDNS || @@ -1792,7 +1830,7 @@ outnet_serviced_query(struct outside_network* outnet, uint16_t flags, int dnssec, int want_dnssec, int tcp_upstream, int ssl_upstream, struct sockaddr_storage* addr, socklen_t addrlen, uint8_t* zone, size_t zonelen, comm_point_callback_t* callback, - void* callback_arg, ldns_buffer* buff) + void* callback_arg, sldns_buffer* buff) { struct serviced_query* sq; struct service_callback* cb; @@ -1866,6 +1904,8 @@ void outnet_serviced_query_stop(struct serviced_query* sq, void* cb_arg) if(!sq->cblist && !sq->to_be_deleted) { #ifdef UNBOUND_DEBUG rbnode_t* rem = +#else + (void) #endif rbtree_delete(sq->outnet->serviced, sq); log_assert(rem); /* should be present */ @@ -1919,7 +1959,7 @@ size_t outnet_get_mem(struct outside_network* outnet) struct port_comm* pc; size_t s = sizeof(*outnet) + sizeof(*outnet->base) + sizeof(*outnet->udp_buff) + - ldns_buffer_capacity(outnet->udp_buff); + sldns_buffer_capacity(outnet->udp_buff); /* second buffer is not ours */ for(pc = outnet->unused_fds; pc; pc = pc->next) { s += sizeof(*pc) + comm_point_get_mem(pc->cp); diff --git a/contrib/unbound/services/outside_network.h b/contrib/unbound/services/outside_network.h index 9ec81f405e6..dda9d6f5a23 100644 --- a/contrib/unbound/services/outside_network.h +++ b/contrib/unbound/services/outside_network.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -54,6 +54,7 @@ struct waiting_udp; struct infra_cache; struct port_comm; struct port_if; +struct sldns_buffer; /** * Send queries to outside servers and wait for answers from servers. @@ -63,13 +64,13 @@ struct outside_network { /** Base for select calls */ struct comm_base* base; /** pointer to time in seconds */ - uint32_t* now_secs; + time_t* now_secs; /** pointer to time in microseconds */ struct timeval* now_tv; /** buffer shared by UDP connections, since there is only one datagram at any time. */ - ldns_buffer* udp_buff; + struct sldns_buffer* udp_buff; /** serviced_callbacks malloc overhead when processing multiple * identical serviced queries to the same server. */ size_t svcd_overhead; @@ -94,6 +95,10 @@ struct outside_network { struct port_comm* unused_fds; /** if udp is done */ int do_udp; + /** if udp is delay-closed (delayed answers do not meet closed port)*/ + int delayclose; + /** timeout for delayclose */ + struct timeval delay_tv; /** array of outgoing IP4 interfaces */ struct port_if* ip4_ifs; @@ -376,6 +381,8 @@ struct serviced_query { * @param unwanted_param: user parameter to action. * @param do_udp: if udp is done. * @param sslctx: context to create outgoing connections with (if enabled). + * @param delayclose: if not 0, udp sockets are delayed before timeout closure. + * msec to wait on timeouted udp sockets. * @return: the new structure (with no pending answers) or NULL on error. */ struct outside_network* outside_network_create(struct comm_base* base, @@ -384,7 +391,7 @@ struct outside_network* outside_network_create(struct comm_base* base, struct ub_randstate* rnd, int use_caps_for_id, int* availports, int numavailports, size_t unwanted_threshold, void (*unwanted_action)(void*), void* unwanted_param, int do_udp, - void* sslctx); + void* sslctx, int delayclose); /** * Delete outside_network structure. @@ -411,7 +418,7 @@ void outside_network_quit_prepare(struct outside_network* outnet); * @return: NULL on error for malloc or socket. Else the pending query object. */ struct pending* pending_udp_query(struct outside_network* outnet, - ldns_buffer* packet, struct sockaddr_storage* addr, + struct sldns_buffer* packet, struct sockaddr_storage* addr, socklen_t addrlen, int timeout, comm_point_callback_t* callback, void* callback_arg); @@ -431,7 +438,7 @@ struct pending* pending_udp_query(struct outside_network* outnet, * @return: false on error for malloc or socket. Else the pending TCP object. */ struct waiting_tcp* pending_tcp_query(struct outside_network* outnet, - ldns_buffer* packet, struct sockaddr_storage* addr, + struct sldns_buffer* packet, struct sockaddr_storage* addr, socklen_t addrlen, int timeout, comm_point_callback_t* callback, void* callback_arg, int ssl_upstream); @@ -476,7 +483,7 @@ struct serviced_query* outnet_serviced_query(struct outside_network* outnet, uint16_t flags, int dnssec, int want_dnssec, int tcp_upstream, int ssl_upstream, struct sockaddr_storage* addr, socklen_t addrlen, uint8_t* zone, size_t zonelen, comm_point_callback_t* callback, - void* callback_arg, ldns_buffer* buff); + void* callback_arg, struct sldns_buffer* buff); /** * Remove service query callback. @@ -515,6 +522,9 @@ int outnet_tcp_cb(struct comm_point* c, void* arg, int error, /** callback for udp timeout */ void pending_udp_timer_cb(void *arg); +/** callback for udp delay for timeout */ +void pending_udp_timer_delay_cb(void *arg); + /** callback for outgoing TCP timer event */ void outnet_tcptimer(void* arg); diff --git a/contrib/unbound/smallapp/unbound-anchor.c b/contrib/unbound/smallapp/unbound-anchor.c index eeb76821d06..33d8c547f4a 100644 --- a/contrib/unbound/smallapp/unbound-anchor.c +++ b/contrib/unbound/smallapp/unbound-anchor.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -116,7 +116,7 @@ #include "config.h" #include "libunbound/unbound.h" -#include +#include "ldns/rrdef.h" #include #ifndef HAVE_EXPAT_H #error "need libexpat to parse root-anchors.xml file." @@ -667,6 +667,15 @@ count_unused(struct ip_list* p) return num; } +static int get_random(void) +{ + int r; + if (RAND_bytes((unsigned char*)&r, (int)sizeof(r)) == 1) { + return r; + } + return (int)random(); +} + /** pick random unused element from IP list */ static struct ip_list* pick_random_ip(struct ip_list* list) @@ -676,7 +685,7 @@ pick_random_ip(struct ip_list* list) int sel; if(num == 0) return NULL; /* not perfect, but random enough */ - sel = (int)ldns_get_random() % num; + sel = get_random() % num; /* skip over unused elements that we did not select */ while(sel > 0 && p) { if(!p->used) sel--; @@ -1229,7 +1238,7 @@ xml_charhandle(void *userData, const XML_Char *s, int len) printf("'\n"); } if(strcasecmp(data->tag, "Zone") == 0) { - if(BIO_write(data->czone, s, len) <= 0) { + if(BIO_write(data->czone, s, len) < 0) { if(verb) printf("out of memory in BIO_write\n"); exit(0); } @@ -1240,7 +1249,7 @@ xml_charhandle(void *userData, const XML_Char *s, int len) return; b = xml_selectbio(data, data->tag); if(b) { - if(BIO_write(b, s, len) <= 0) { + if(BIO_write(b, s, len) < 0) { if(verb) printf("out of memory in BIO_write\n"); exit(0); } @@ -1433,7 +1442,7 @@ xml_startelem(void *userData, const XML_Char *name, const XML_Char **atts) static void xml_append_str(BIO* b, const char* s) { - if(BIO_write(b, s, (int)strlen(s)) <= 0) { + if(BIO_write(b, s, (int)strlen(s)) < 0) { if(verb) printf("out of memory in BIO_write\n"); exit(0); } @@ -1457,7 +1466,7 @@ xml_append_bio(BIO* b, BIO* a) z[i] = ' '; } /* write to BIO */ - if(BIO_write(b, z, len) <= 0) { + if(BIO_write(b, z, len) < 0) { if(verb) printf("out of memory in BIO_write\n"); exit(0); } @@ -1543,7 +1552,7 @@ xml_parse_setup(XML_Parser parser, struct xml_data* data, time_t now) } snprintf(buf, sizeof(buf), "; created by unbound-anchor on %s", ctime(&now)); - if(BIO_write(data->ds, buf, (int)strlen(buf)) <= 0) { + if(BIO_write(data->ds, buf, (int)strlen(buf)) < 0) { if(verb) printf("out of memory\n"); exit(0); } diff --git a/contrib/unbound/smallapp/unbound-checkconf.c b/contrib/unbound/smallapp/unbound-checkconf.c index c73d8bdc7c9..78733edcfd7 100644 --- a/contrib/unbound/smallapp/unbound-checkconf.c +++ b/contrib/unbound/smallapp/unbound-checkconf.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -53,6 +53,7 @@ #include "iterator/iter_hints.h" #include "validator/validator.h" #include "services/localzone.h" +#include "ldns/sbuffer.h" #ifdef HAVE_GETOPT_H #include #endif @@ -105,14 +106,14 @@ check_mod(struct config_file* cfg, struct module_func_block* fb) memset(&env, 0, sizeof(env)); env.cfg = cfg; env.scratch = regional_create(); - env.scratch_buffer = ldns_buffer_new(BUFSIZ); + env.scratch_buffer = sldns_buffer_new(BUFSIZ); if(!env.scratch || !env.scratch_buffer) fatal_exit("out of memory"); if(!(*fb->init)(&env, 0)) { fatal_exit("bad config for %s module", fb->name); } (*fb->deinit)(&env, 0); - ldns_buffer_free(env.scratch_buffer); + sldns_buffer_free(env.scratch_buffer); regional_destroy(env.scratch); } @@ -343,9 +344,9 @@ morechecks(struct config_file* cfg, const char* fname) if(fname[0] != '/') { if(getcwd(buf, sizeof(buf)) == NULL) fatal_exit("getcwd: %s", strerror(errno)); - strncat(buf, "/", sizeof(buf)-strlen(buf)-1); + (void)strlcat(buf, "/", sizeof(buf)); } - strncat(buf, fname, sizeof(buf)-strlen(buf)-1); + (void)strlcat(buf, fname, sizeof(buf)); if(strncmp(buf, cfg->chrootdir, strlen(cfg->chrootdir)) != 0) fatal_exit("config file %s is not inside chroot %s", buf, cfg->chrootdir); diff --git a/contrib/unbound/smallapp/unbound-control-setup.sh b/contrib/unbound/smallapp/unbound-control-setup.sh index 7fe1c3392b3..f22f4b85f62 100755 --- a/contrib/unbound/smallapp/unbound-control-setup.sh +++ b/contrib/unbound/smallapp/unbound-control-setup.sh @@ -22,16 +22,16 @@ # specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. +# "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 COPYRIGHT +# HOLDER 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. # settings: diff --git a/contrib/unbound/smallapp/unbound-control-setup.sh.in b/contrib/unbound/smallapp/unbound-control-setup.sh.in index a2caffe2c06..79605dc6fd4 100755 --- a/contrib/unbound/smallapp/unbound-control-setup.sh.in +++ b/contrib/unbound/smallapp/unbound-control-setup.sh.in @@ -22,16 +22,16 @@ # specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. +# "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 COPYRIGHT +# HOLDER 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. # settings: diff --git a/contrib/unbound/smallapp/unbound-control.c b/contrib/unbound/smallapp/unbound-control.c index cc48866c5db..067e133fc16 100644 --- a/contrib/unbound/smallapp/unbound-control.c +++ b/contrib/unbound/smallapp/unbound-control.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -106,6 +106,8 @@ usage() printf(" list_forwards list forward-zones in use\n"); printf(" list_local_zones list local-zones in use\n"); printf(" list_local_data list local-data RRs in use\n"); + printf(" insecure_add zone add domain-insecure zone\n"); + printf(" insecure_remove zone remove domain-insecure zone\n"); printf(" forward_add [+i] zone addr.. add forward-zone with servers\n"); printf(" forward_remove [+i] zone remove forward zone\n"); printf(" stub_add [+ip] zone addr.. add stub-zone with servers\n"); diff --git a/contrib/unbound/smallapp/unbound-host.c b/contrib/unbound/smallapp/unbound-host.c index 715aa4a6516..12c60f4060b 100644 --- a/contrib/unbound/smallapp/unbound-host.c +++ b/contrib/unbound/smallapp/unbound-host.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -60,7 +60,8 @@ #define unbound_lite_wrapstr(s) s #endif #include "libunbound/unbound.h" -#include +#include "ldns/rrdef.h" +#include "ldns/wire2str.h" #ifdef HAVE_NSS /* nss3 */ #include "nss.h" @@ -172,7 +173,7 @@ static int massage_type(const char* t, int reverse, int* multi) { if(t) { - int r = ldns_get_rr_type_by_name(t); + int r = sldns_get_rr_type_by_name(t); if(r == 0 && strcasecmp(t, "TYPE0") != 0 && strcmp(t, "") != 0) { fprintf(stderr, "error unknown type %s\n", t); @@ -191,7 +192,7 @@ static int massage_class(const char* c) { if(c) { - int r = ldns_get_rr_class_by_name(c); + int r = sldns_get_rr_class_by_name(c); if(r == 0 && strcasecmp(c, "CLASS0") != 0 && strcmp(c, "") != 0) { fprintf(stderr, "error unknown class %s\n", c); @@ -215,61 +216,36 @@ secure_str(struct ub_result* result) static void pretty_type(char* s, size_t len, int t) { - char* d = ldns_rr_type2str(t); + char d[16]; + sldns_wire2str_type_buf((uint16_t)t, d, sizeof(d)); snprintf(s, len, "%s", d); - free(d); } /** nice string for class */ static void pretty_class(char* s, size_t len, int c) { - char* d = ldns_rr_class2str(c); + char d[16]; + sldns_wire2str_class_buf((uint16_t)c, d, sizeof(d)); snprintf(s, len, "%s", d); - free(d); } /** nice string for rcode */ static void pretty_rcode(char* s, size_t len, int r) { - ldns_lookup_table *rcode = ldns_lookup_by_id(ldns_rcodes, r); - if(rcode) { - snprintf(s, len, "%s", rcode->name); - } else { - snprintf(s, len, "RCODE%d", r); - } + char d[16]; + sldns_wire2str_rcode_buf(r, d, sizeof(d)); + snprintf(s, len, "%s", d); } /** convert and print rdata */ static void print_rd(int t, char* data, size_t len) { - size_t i, pos = 0; - uint8_t* rd = (uint8_t*)malloc(len+2); - ldns_rr* rr = ldns_rr_new(); - ldns_status status; - if(!rd || !rr) { - fprintf(stderr, "out of memory"); - exit(1); - } - ldns_rr_set_type(rr, t); - ldns_write_uint16(rd, len); - memmove(rd+2, data, len); - ldns_rr_set_owner(rr, NULL); - status = ldns_wire2rdf(rr, rd, len+2, &pos); - if(status != LDNS_STATUS_OK) { - free(rd); - ldns_rr_free(rr); - printf("error_printing_data"); - return; - } - for(i=0; ianswer_packet, - (size_t)result->answer_len)==LDNS_STATUS_OK){ - if(ldns_rr_list_rr_count( - ldns_pkt_answer(p)) == 0) - printf(" has no records\n"); - else { - printf(" ANY:\n"); - ldns_rr_list_print(stdout, - ldns_pkt_answer(p)); - } - } else { - fprintf(stderr, "could not parse " - "reply packet to ANY query\n"); + char* s = sldns_wire2str_pkt( + result->answer_packet, + (size_t)result->answer_len); + if(!s) { + fprintf(stderr, "alloc failure\n"); exit(1); } - ldns_pkt_free(p); - + printf("%s\n", s); } else printf(" has no %s record", tstr); printf(" %s\n", secstatus); } diff --git a/contrib/unbound/smallapp/worker_cb.c b/contrib/unbound/smallapp/worker_cb.c index fd8498fb58f..035d9087aea 100644 --- a/contrib/unbound/smallapp/worker_cb.c +++ b/contrib/unbound/smallapp/worker_cb.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -167,14 +167,21 @@ void libworker_handle_control_cmd(struct tube* ATTR_UNUSED(tube), } void libworker_fg_done_cb(void* ATTR_UNUSED(arg), int ATTR_UNUSED(rcode), - ldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(s), + struct sldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(s), char* ATTR_UNUSED(why_bogus)) { log_assert(0); } void libworker_bg_done_cb(void* ATTR_UNUSED(arg), int ATTR_UNUSED(rcode), - ldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(s), + struct sldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(s), + char* ATTR_UNUSED(why_bogus)) +{ + log_assert(0); +} + +void libworker_event_done_cb(void* ATTR_UNUSED(arg), int ATTR_UNUSED(rcode), + struct sldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(s), char* ATTR_UNUSED(why_bogus)) { log_assert(0); diff --git a/contrib/unbound/util/alloc.c b/contrib/unbound/util/alloc.c index b5ccd96b429..4b81beb4c4c 100644 --- a/contrib/unbound/util/alloc.c +++ b/contrib/unbound/util/alloc.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -601,13 +601,13 @@ char* unbound_lite_wrapstr(char* s) return n; } -#undef ldns_pkt2wire -ldns_status unbound_lite_pkt2wire(uint8_t **dest, const ldns_pkt *p, +#undef sldns_pkt2wire +sldns_status unbound_lite_pkt2wire(uint8_t **dest, const sldns_pkt *p, size_t *size) { uint8_t* md = NULL; size_t ms = 0; - ldns_status s = ldns_pkt2wire(&md, p, &ms); + sldns_status s = sldns_pkt2wire(&md, p, &ms); if(md) { *dest = unbound_stat_malloc_lite(ms, __FILE__, __LINE__, __func__); diff --git a/contrib/unbound/util/alloc.h b/contrib/unbound/util/alloc.h index cb8d6b1bceb..ffd605c5dc1 100644 --- a/contrib/unbound/util/alloc.h +++ b/contrib/unbound/util/alloc.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -201,15 +201,15 @@ void *unbound_stat_realloc_lite(void *ptr, size_t size, const char* file, char* unbound_strdup_lite(const char* s, const char* file, int line, const char* func); char* unbound_lite_wrapstr(char* s); -# define ldns_rr2str(rr) unbound_lite_wrapstr(ldns_rr2str(rr)) -# define ldns_rdf2str(rdf) unbound_lite_wrapstr(ldns_rdf2str(rdf)) -# define ldns_rr_type2str(t) unbound_lite_wrapstr(ldns_rr_type2str(t)) -# define ldns_rr_class2str(c) unbound_lite_wrapstr(ldns_rr_class2str(c)) -# define ldns_rr_list2str(r) unbound_lite_wrapstr(ldns_rr_list2str(r)) -# define ldns_pkt2str(p) unbound_lite_wrapstr(ldns_pkt2str(p)) -# define ldns_pkt_rcode2str(r) unbound_lite_wrapstr(ldns_pkt_rcode2str(r)) -# define ldns_pkt2wire(a, r, s) unbound_lite_pkt2wire(a, r, s) -ldns_status unbound_lite_pkt2wire(uint8_t **dest, const ldns_pkt *p, size_t *size); +# define sldns_rr2str(rr) unbound_lite_wrapstr(sldns_rr2str(rr)) +# define sldns_rdf2str(rdf) unbound_lite_wrapstr(sldns_rdf2str(rdf)) +# define sldns_rr_type2str(t) unbound_lite_wrapstr(sldns_rr_type2str(t)) +# define sldns_rr_class2str(c) unbound_lite_wrapstr(sldns_rr_class2str(c)) +# define sldns_rr_list2str(r) unbound_lite_wrapstr(sldns_rr_list2str(r)) +# define sldns_pkt2str(p) unbound_lite_wrapstr(sldns_pkt2str(p)) +# define sldns_pkt_rcode2str(r) unbound_lite_wrapstr(sldns_pkt_rcode2str(r)) +# define sldns_pkt2wire(a, r, s) unbound_lite_pkt2wire(a, r, s) +sldns_status unbound_lite_pkt2wire(uint8_t **dest, const sldns_pkt *p, size_t *size); # define i2d_DSA_SIG(d, s) unbound_lite_i2d_DSA_SIG(d, s) int unbound_lite_i2d_DSA_SIG(DSA_SIG* dsasig, unsigned char** sig); #endif /* UNBOUND_ALLOC_LITE */ diff --git a/contrib/unbound/util/config_file.c b/contrib/unbound/util/config_file.c index ebfb795c1d8..f8341ccecb2 100644 --- a/contrib/unbound/util/config_file.c +++ b/contrib/unbound/util/config_file.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -41,18 +41,22 @@ #include "config.h" #include -#include +#include +#ifdef HAVE_TIME_H +#include +#endif #include "util/log.h" - #include "util/configyyrename.h" #include "util/config_file.h" -#include "util/configparser.h" +#include "configparser.h" #include "util/net_help.h" #include "util/data/msgparse.h" #include "util/module.h" #include "util/regional.h" #include "util/fptr_wlist.h" #include "util/data/dname.h" +#include "ldns/wire2str.h" +#include "ldns/parseutil.h" #ifdef HAVE_GLOB_H # include #endif @@ -122,6 +126,7 @@ config_create(void) cfg->prefetch_key = 0; cfg->infra_cache_slabs = 4; cfg->infra_cache_numhosts = 10000; + cfg->delay_close = 0; if(!(cfg->outgoing_avail_ports = (int*)calloc(65536, sizeof(int)))) goto error_exit; init_outgoing_availports(cfg->outgoing_avail_ports, 65536); @@ -140,6 +145,7 @@ config_create(void) cfg->if_automatic = 0; cfg->so_rcvbuf = 0; cfg->so_sndbuf = 0; + cfg->so_reuseport = 0; cfg->num_ifs = 0; cfg->ifs = NULL; cfg->num_out_ifs = 0; @@ -185,12 +191,14 @@ config_create(void) cfg->local_zones = NULL; cfg->local_zones_nodefault = NULL; cfg->local_data = NULL; + cfg->unblock_lan_zones = 0; cfg->python_script = NULL; cfg->remote_control_enable = 0; cfg->control_ifs = NULL; cfg->control_port = UNBOUND_CONTROL_PORT; cfg->minimal_responses = 0; cfg->rrset_roundrobin = 0; + cfg->max_udp_size = 4096; if(!(cfg->server_key_file = strdup(RUN_DIR"/unbound_server.key"))) goto error_exit; if(!(cfg->server_cert_file = strdup(RUN_DIR"/unbound_server.pem"))) @@ -317,7 +325,11 @@ int config_set_option(struct config_file* cfg, const char* opt, cfg->use_syslog = 0; free(cfg->logfile); return (cfg->logfile = strdup(val)) != NULL; - } + } + else if(strcmp(opt, "log-time-ascii:") == 0) + { IS_YES_OR_NO; cfg->log_time_ascii = (strcmp(val, "yes") == 0); + log_set_time_asc(cfg->log_time_ascii); } + else S_SIZET_NONZERO("max-udp-size:", max_udp_size) else S_YNO("use-syslog:", use_syslog) else S_YNO("extended-statistics:", stat_extended) else S_YNO("statistics-cumulative:", stat_cumulative) @@ -344,14 +356,19 @@ int config_set_option(struct config_file* cfg, const char* opt, else S_SIZET_OR_ZERO("jostle-timeout:", jostle_time) else S_MEMSIZE("so-rcvbuf:", so_rcvbuf) else S_MEMSIZE("so-sndbuf:", so_sndbuf) + else S_YNO("so-reuseport:", so_reuseport) else S_MEMSIZE("rrset-cache-size:", rrset_cache_size) else S_POW2("rrset-cache-slabs:", rrset_cache_slabs) else S_YNO("prefetch:", prefetch) else S_YNO("prefetch-key:", prefetch_key) - else S_NUMBER_OR_ZERO("cache-max-ttl:", max_ttl) + else if(strcmp(opt, "cache-max-ttl:") == 0) + { IS_NUMBER_OR_ZERO; cfg->max_ttl = atoi(val); MAX_TTL=(time_t)cfg->max_ttl;} + else if(strcmp(opt, "cache-min-ttl:") == 0) + { IS_NUMBER_OR_ZERO; cfg->min_ttl = atoi(val); MIN_TTL=(time_t)cfg->min_ttl;} else S_NUMBER_OR_ZERO("infra-host-ttl:", host_ttl) else S_POW2("infra-cache-slabs:", infra_cache_slabs) else S_SIZET_NONZERO("infra-cache-numhosts:", infra_cache_numhosts) + else S_NUMBER_OR_ZERO("delay-close:", delay_close) else S_STR("chroot:", chrootdir) else S_STR("username:", username) else S_STR("directory:", directory) @@ -398,6 +415,7 @@ int config_set_option(struct config_file* cfg, const char* opt, else S_YNO("minimal-responses:", minimal_responses) else S_YNO("rrset-roundrobin:", rrset_roundrobin) else S_STRLIST("local-data:", local_data) + else S_YNO("unblock-lan-zones:", unblock_lan_zones) else S_YNO("control-enable:", remote_control_enable) else S_STRLIST("control-interface:", control_ifs) else S_NUMBER_NONZERO("control-port:", control_port) @@ -407,6 +425,12 @@ int config_set_option(struct config_file* cfg, const char* opt, else S_STR("control-cert-file:", control_cert_file) else S_STR("module-config:", module_conf) else S_STR("python-script:", python_script) + /* val_sig_skew_min and max are copied into val_env during init, + * so this does not update val_env with set_option */ + else if(strcmp(opt, "val-sig-skew-min:") == 0) + { IS_NUMBER_OR_ZERO; cfg->val_sig_skew_min = (int32_t)atoi(val); } + else if(strcmp(opt, "val-sig-skew-max:") == 0) + { IS_NUMBER_OR_ZERO; cfg->val_sig_skew_max = (int32_t)atoi(val); } else if (strcmp(opt, "outgoing-interface:") == 0) { char* d = strdup(val); char** oi = (char**)malloc((cfg->num_out_ifs+1)*sizeof(char*)); @@ -506,8 +530,9 @@ config_collate_cat(struct config_strlist* list) return NULL; } snprintf(w, left, "%s\n", s->str); - w += this+1; - left -= this+1; + this = strlen(w); + w += this; + left -= this; } return r; } @@ -562,6 +587,7 @@ config_get_option(struct config_file* cfg, const char* opt, else O_YNO(opt, "statistics-cumulative", stat_cumulative) else O_YNO(opt, "extended-statistics", stat_extended) else O_YNO(opt, "use-syslog", use_syslog) + else O_YNO(opt, "log-time-ascii", log_time_ascii) else O_DEC(opt, "num-threads", num_threads) else O_IFC(opt, "interface", num_ifs, ifs) else O_IFC(opt, "outgoing-interface", num_out_ifs, out_ifs) @@ -578,14 +604,17 @@ config_get_option(struct config_file* cfg, const char* opt, else O_UNS(opt, "jostle-timeout", jostle_time) else O_MEM(opt, "so-rcvbuf", so_rcvbuf) else O_MEM(opt, "so-sndbuf", so_sndbuf) + else O_YNO(opt, "so-reuseport", so_reuseport) else O_MEM(opt, "rrset-cache-size", rrset_cache_size) else O_DEC(opt, "rrset-cache-slabs", rrset_cache_slabs) else O_YNO(opt, "prefetch-key", prefetch_key) else O_YNO(opt, "prefetch", prefetch) else O_DEC(opt, "cache-max-ttl", max_ttl) + else O_DEC(opt, "cache-min-ttl", min_ttl) else O_DEC(opt, "infra-host-ttl", host_ttl) else O_DEC(opt, "infra-cache-slabs", infra_cache_slabs) else O_MEM(opt, "infra-cache-numhosts", infra_cache_numhosts) + else O_UNS(opt, "delay-close", delay_close) else O_YNO(opt, "do-ip4", do_ip4) else O_YNO(opt, "do-ip6", do_ip6) else O_YNO(opt, "do-udp", do_udp) @@ -651,6 +680,11 @@ config_get_option(struct config_file* cfg, const char* opt, else O_UNS(opt, "val-override-date", val_date_override) else O_YNO(opt, "minimal-responses", minimal_responses) else O_YNO(opt, "rrset-roundrobin", rrset_roundrobin) + else O_YNO(opt, "unblock-lan-zones", unblock_lan_zones) + else O_DEC(opt, "max-udp-size", max_udp_size) + else O_STR(opt, "python-script", python_script) + else O_DEC(opt, "val-sig-skew-min", val_sig_skew_min) + else O_DEC(opt, "val-sig-skew-max", val_sig_skew_max) /* not here: * outgoing-permit, outgoing-avoid - have list of ports * local-zone - zones and nodefault variables @@ -674,6 +708,7 @@ create_cfg_parser(struct config_file* cfg, char* filename, const char* chroot) cfg_parser->errors = 0; cfg_parser->cfg = cfg; cfg_parser->chroot = chroot; + init_cfg_parse(); } int @@ -1030,10 +1065,10 @@ cfg_str2list_insert(struct config_str2list** head, char* item, char* i2) return 1; } -uint32_t +time_t cfg_convert_timeval(const char* str) { - uint32_t t; + time_t t; struct tm tm; memset(&tm, 0, sizeof(tm)); if(strlen(str) < 14) @@ -1051,7 +1086,7 @@ cfg_convert_timeval(const char* str) if (tm.tm_min < 0 || tm.tm_min > 59) return 0; if (tm.tm_sec < 0 || tm.tm_sec > 59) return 0; /* call ldns conversion function */ - t = mktime_from_utc(&tm); + t = sldns_mktime_from_utc(&tm); return t; } @@ -1137,8 +1172,8 @@ cfg_parse_memsize(const char* str, size_t* res) void config_apply(struct config_file* config) { - MAX_TTL = (uint32_t)config->max_ttl; - MIN_TTL = (uint32_t)config->min_ttl; + MAX_TTL = (time_t)config->max_ttl; + MIN_TTL = (time_t)config->min_ttl; EDNS_ADVERTISED_SIZE = (uint16_t)config->edns_buffer_size; MINIMAL_RESPONSES = config->minimal_responses; RRSET_ROUNDROBIN = config->rrset_roundrobin; @@ -1199,9 +1234,9 @@ strlen_after_chroot(const char* fname, struct config_file* cfg, int use_chdir) char* fname_after_chroot(const char* fname, struct config_file* cfg, int use_chdir) { - size_t len = strlen_after_chroot(fname, cfg, use_chdir); + size_t len = strlen_after_chroot(fname, cfg, use_chdir)+1; int slashit = 0; - char* buf = (char*)malloc(len+1); + char* buf = (char*)malloc(len); if(!buf) return NULL; buf[0] = 0; @@ -1209,14 +1244,14 @@ fname_after_chroot(const char* fname, struct config_file* cfg, int use_chdir) if(cfg->chrootdir && cfg->chrootdir[0] && strncmp(cfg->chrootdir, fname, strlen(cfg->chrootdir)) == 0) { /* already full pathname, return it */ - strncpy(buf, fname, len); - buf[len] = 0; + (void)strlcpy(buf, fname, len); + buf[len-1] = 0; return buf; } /* chroot */ if(cfg->chrootdir && cfg->chrootdir[0]) { /* start with chrootdir */ - strncpy(buf, cfg->chrootdir, len); + (void)strlcpy(buf, cfg->chrootdir, len); slashit = 1; } #ifdef UB_ON_WINDOWS @@ -1230,21 +1265,21 @@ fname_after_chroot(const char* fname, struct config_file* cfg, int use_chdir) } else if(cfg->directory && cfg->directory[0]) { /* prepend chdir */ if(slashit && cfg->directory[0] != '/') - strncat(buf, "/", len-strlen(buf)); + (void)strlcat(buf, "/", len); /* is the directory already in the chroot? */ if(cfg->chrootdir && cfg->chrootdir[0] && strncmp(cfg->chrootdir, cfg->directory, strlen(cfg->chrootdir)) == 0) - strncat(buf, cfg->directory+strlen(cfg->chrootdir), - len-strlen(buf)); - else strncat(buf, cfg->directory, len-strlen(buf)); + (void)strlcat(buf, cfg->directory+strlen(cfg->chrootdir), + len); + else (void)strlcat(buf, cfg->directory, len); slashit = 1; } /* fname */ if(slashit && fname[0] != '/') - strncat(buf, "/", len-strlen(buf)); - strncat(buf, fname, len-strlen(buf)); - buf[len] = 0; + (void)strlcat(buf, "/", len); + (void)strlcat(buf, fname, len); + buf[len-1] = 0; return buf; } @@ -1295,7 +1330,7 @@ cfg_parse_local_zone(struct config_file* cfg, const char* val) log_err("syntax error: bad zone name: %s", val); return 0; } - strncpy(buf, name, (size_t)(name_end-name)); + (void)strlcpy(buf, name, sizeof(buf)); buf[name_end-name] = '\0'; type = last_space_pos(name_end); @@ -1485,18 +1520,11 @@ char* errinf_to_str(struct module_qstate* qstate) size_t left = sizeof(buf); struct config_strlist* s; char dname[LDNS_MAX_DOMAINLEN+1]; - char* t = ldns_rr_type2str(qstate->qinfo.qtype); - char* c = ldns_rr_class2str(qstate->qinfo.qclass); - if(!t || !c) { - free(t); - free(c); - log_err("malloc failure in errinf_to_str"); - return NULL; - } + char t[16], c[16]; + sldns_wire2str_type_buf(qstate->qinfo.qtype, t, sizeof(t)); + sldns_wire2str_class_buf(qstate->qinfo.qclass, c, sizeof(c)); dname_str(qstate->qinfo.qname, dname); snprintf(p, left, "validation failure <%s %s %s>:", dname, t, c); - free(t); - free(c); left -= strlen(p); p += strlen(p); if(!qstate->errinf) snprintf(p, left, " misc failure"); @@ -1514,21 +1542,13 @@ void errinf_rrset(struct module_qstate* qstate, struct ub_packed_rrset_key *rr) { char buf[1024]; char dname[LDNS_MAX_DOMAINLEN+1]; - char *t, *c; + char t[16], c[16]; if(qstate->env->cfg->val_log_level < 2 || !rr) return; - t = ldns_rr_type2str(ntohs(rr->rk.type)); - c = ldns_rr_class2str(ntohs(rr->rk.rrset_class)); - if(!t || !c) { - free(t); - free(c); - log_err("malloc failure in errinf_rrset"); - return; - } + sldns_wire2str_type_buf(ntohs(rr->rk.type), t, sizeof(t)); + sldns_wire2str_class_buf(ntohs(rr->rk.rrset_class), c, sizeof(c)); dname_str(rr->rk.dname, dname); snprintf(buf, sizeof(buf), "for <%s %s %s>", dname, t, c); - free(t); - free(c); errinf(qstate, buf); } diff --git a/contrib/unbound/util/config_file.h b/contrib/unbound/util/config_file.h index e790cecb8e1..f041df1051e 100644 --- a/contrib/unbound/util/config_file.h +++ b/contrib/unbound/util/config_file.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -119,6 +119,8 @@ struct config_file { size_t infra_cache_slabs; /** max number of hosts in the infra cache */ size_t infra_cache_numhosts; + /** delay close of udp-timeouted ports, if 0 no delayclose. in msec */ + int delay_close; /** the target fetch policy for the iterator */ char* target_fetch_policy; @@ -130,6 +132,8 @@ struct config_file { size_t so_rcvbuf; /** SO_SNDBUF size to set on port 53 UDP socket */ size_t so_sndbuf; + /** SO_REUSEPORT requested on port 53 sockets */ + int so_reuseport; /** number of interfaces to open. If 0 default all interfaces. */ int num_ifs; @@ -269,6 +273,8 @@ struct config_file { struct config_strlist* local_zones_nodefault; /** local data RRs configged */ struct config_strlist* local_data; + /** unblock lan zones (reverse lookups for 10/8 and so on) */ + int unblock_lan_zones; /** remote control section. enable toggle. */ int remote_control_enable; @@ -296,6 +302,9 @@ struct config_file { /* RRSet roundrobin */ int rrset_roundrobin; + + /* maximum UDP response size */ + size_t max_udp_size; }; /** @@ -493,7 +502,7 @@ void config_delstubs(struct config_stub* list); * @param str: string of 14 digits * @return time value or 0 for error. */ -uint32_t cfg_convert_timeval(const char* str); +time_t cfg_convert_timeval(const char* str); /** * Count number of values in the string. @@ -632,6 +641,8 @@ struct config_parser_state { /** global config parser object used during config parsing */ extern struct config_parser_state* cfg_parser; +/** init lex state */ +void init_cfg_parse(void); /** lex in file */ extern FILE* ub_c_in; /** lex out file */ diff --git a/contrib/unbound/util/configlexer.c b/contrib/unbound/util/configlexer.c deleted file mode 100644 index 505c787be7c..00000000000 --- a/contrib/unbound/util/configlexer.c +++ /dev/null @@ -1,3536 +0,0 @@ -#include "config.h" -#include "util/configyyrename.h" - -#line 3 "" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 37 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -/* First, we deal with platform-specific or compiler-specific issues. */ - -#if defined(__FreeBSD__) -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS -#endif -#include -#include -#else -#define __dead2 -#endif - -/* begin standard C headers. */ -#include -#include -#include -#include - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have . Non-C99 systems may or may not. */ - -#if defined(__FreeBSD__) || \ - (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#endif /* ! C99 */ - -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN (yy_start) = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START (((yy_start) - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart(yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#define YY_BUF_SIZE 16384 -#endif - -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -extern yy_size_t yyleng; - -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - - #define YY_LESS_LINENO(n) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, (yytext_ptr) ) - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - yy_size_t yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) -#define yy_current_buffer YY_CURRENT_BUFFER - -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart (FILE *input_file ); -void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); -void yy_delete_buffer (YY_BUFFER_STATE b ); -void yy_flush_buffer (YY_BUFFER_STATE b ); -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); -void yypop_buffer_state (void ); - -static void yyensure_buffer_stack (void ); -static void yy_load_buffer_state (void ); -static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); - -#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) - -YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); - -void *yyalloc (yy_size_t ); -void *yyrealloc (void *,yy_size_t ); -void yyfree (void * ); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -/* Begin user sect3 */ - -typedef unsigned char YY_CHAR; - -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; - -typedef int yy_state_type; - -extern int yylineno; - -int yylineno = 1; - -extern char *yytext; -#define yytext_ptr yytext - -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ) __dead2; - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - (yytext_ptr) -= (yy_more_len); \ - yyleng = (size_t) (yy_cp - (yytext_ptr)); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - -#define YY_NUM_RULES 142 -#define YY_END_OF_BUFFER 143 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static yyconst flex_int16_t yy_accept[1343] = - { 0, - 1, 1, 124, 124, 128, 128, 132, 132, 136, 136, - 1, 1, 143, 140, 1, 122, 122, 141, 2, 141, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 124, - 125, 125, 126, 141, 128, 129, 129, 130, 141, 135, - 132, 133, 133, 134, 141, 136, 137, 137, 138, 141, - 139, 123, 2, 127, 141, 139, 140, 0, 1, 2, - 2, 2, 2, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 124, - 0, 128, 0, 135, 0, 132, 136, 0, 139, 0, - 2, 2, 139, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 139, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 139, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 62, 140, 140, - 140, 140, 140, 6, 140, 140, 140, 140, 140, 140, - - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 139, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - - 140, 140, 140, 140, 139, 140, 140, 140, 140, 27, - 140, 140, 140, 140, 140, 12, 13, 140, 15, 14, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 118, 140, 140, 140, 140, - 140, 3, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 139, 140, 140, 140, 140, 140, 140, 140, 140, 140, - - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 131, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 30, - 140, 140, 140, 140, 140, 140, 140, 140, 31, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 77, 131, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - - 140, 140, 140, 140, 140, 140, 140, 76, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 60, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 20, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 28, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 29, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - - 140, 140, 140, 22, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 25, 26, 140, 140, 140, 63, 140, 64, - 140, 61, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 5, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 79, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 104, 103, 140, - - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 32, 140, 140, - 140, 140, 140, 140, 140, 66, 65, 140, 140, 140, - 140, 140, 140, 100, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 51, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 102, 140, 140, 140, 140, 140, 140, 140, 140, - 4, 140, 140, 140, 140, 140, 140, 140, 140, 140, - - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 97, 140, 140, 140, 140, 140, 140, 140, - 112, 98, 140, 21, 140, 140, 140, 140, 68, 140, - 69, 67, 140, 140, 140, 140, 140, 140, 75, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 99, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 59, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 17, 140, 140, 140, 16, - 140, 84, 140, 140, 140, 140, 140, 140, 140, 140, - - 140, 140, 140, 140, 39, 40, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 70, 140, 140, 140, - 140, 140, 74, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 78, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 117, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 88, 140, 92, 140, 140, - 140, 140, 73, 140, 140, 110, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 91, - 140, 140, 140, 140, 41, 42, 140, 47, 93, 140, - - 105, 101, 140, 140, 35, 140, 95, 140, 140, 140, - 140, 140, 7, 140, 58, 109, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 80, 140, 140, 119, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 94, 140, 34, 36, - 140, 140, 140, 140, 140, 57, 140, 140, 140, 140, - 113, 18, 19, 140, 140, 140, 140, 140, 140, 55, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 115, - 140, 140, 33, 140, 140, 140, 140, 140, 140, 11, - - 140, 140, 140, 140, 140, 140, 140, 10, 140, 140, - 37, 140, 121, 114, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 87, 86, 140, 116, 111, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 43, - 140, 120, 140, 140, 140, 140, 38, 140, 140, 140, - 81, 83, 140, 140, 140, 85, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 23, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 108, 140, 140, 140, 140, 140, 140, - 140, 24, 140, 9, 140, 140, 106, 48, 140, 140, - - 140, 90, 140, 71, 140, 140, 140, 50, 54, 49, - 140, 44, 140, 8, 140, 140, 89, 140, 140, 140, - 53, 140, 45, 140, 107, 140, 140, 82, 72, 52, - 46, 140, 140, 140, 140, 56, 140, 140, 140, 140, - 96, 0 - } ; - -static yyconst flex_int32_t yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 1, 5, 6, 1, 1, 1, 7, 1, - 1, 1, 1, 1, 8, 1, 1, 1, 1, 1, - 9, 10, 1, 11, 1, 1, 1, 12, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 13, 1, 1, 1, 1, 14, 15, 16, 17, - - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst flex_int32_t yy_meta[40] = - { 0, - 1, 2, 3, 4, 5, 1, 6, 1, 1, 1, - 1, 7, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1 - } ; - -static yyconst flex_int16_t yy_base[1357] = - { 0, - 0, 0, 37, 40, 44, 51, 63, 75, 56, 68, - 87, 108, 2577, 2563, 50, 2683, 2683, 2683, 129, 94, - 70, 104, 122, 90, 92, 115, 126, 95, 84, 132, - 135, 138, 50, 142, 148, 156, 169, 164, 179, 2493, - 2683, 2683, 2683, 70, 2371, 2683, 2683, 2683, 42, 2326, - 1987, 2683, 2683, 2683, 197, 1681, 2683, 2683, 2683, 154, - 1191, 2683, 201, 2683, 205, 111, 1082, 211, 120, 0, - 222, 0, 0, 103, 158, 165, 149, 155, 168, 206, - 207, 198, 217, 209, 204, 208, 215, 177, 136, 227, - 228, 219, 232, 236, 235, 240, 245, 229, 246, 247, - - 250, 251, 254, 256, 258, 262, 259, 263, 266, 269, - 267, 276, 268, 271, 273, 49, 280, 281, 283, 853, - 297, 751, 301, 603, 311, 572, 360, 299, 298, 315, - 319, 0, 296, 312, 320, 314, 316, 318, 321, 327, - 323, 330, 342, 331, 326, 334, 335, 336, 338, 347, - 337, 353, 348, 344, 350, 355, 359, 372, 369, 367, - 357, 379, 377, 385, 386, 383, 387, 384, 388, 389, - 391, 392, 395, 396, 397, 398, 405, 402, 406, 403, - 414, 412, 420, 418, 428, 424, 425, 427, 430, 434, - 435, 432, 433, 441, 439, 444, 452, 448, 450, 454, - - 455, 458, 461, 460, 462, 466, 473, 469, 470, 472, - 477, 475, 478, 479, 485, 481, 482, 483, 486, 492, - 487, 504, 498, 508, 501, 502, 510, 513, 509, 515, - 520, 522, 528, 524, 525, 526, 527, 531, 534, 537, - 533, 536, 539, 540, 545, 546, 565, 551, 549, 553, - 556, 555, 562, 576, 563, 572, 573, 569, 578, 585, - 596, 586, 591, 595, 598, 597, 600, 601, 602, 605, - 608, 610, 609, 620, 623, 622, 621, 624, 630, 638, - 625, 632, 635, 639, 643, 634, 644, 2683, 649, 636, - 651, 652, 642, 2683, 653, 656, 658, 660, 662, 668, - - 664, 666, 667, 669, 674, 675, 677, 697, 680, 678, - 690, 681, 686, 683, 692, 689, 699, 702, 706, 707, - 709, 710, 712, 715, 716, 726, 722, 718, 724, 728, - 732, 733, 735, 738, 739, 743, 747, 753, 755, 757, - 763, 740, 759, 762, 765, 767, 768, 749, 775, 772, - 774, 778, 779, 787, 776, 789, 791, 793, 783, 794, - 797, 805, 801, 803, 808, 810, 784, 804, 814, 813, - 820, 827, 828, 812, 829, 835, 831, 836, 824, 837, - 839, 840, 841, 843, 844, 846, 848, 854, 850, 856, - 861, 862, 866, 851, 868, 871, 872, 873, 874, 883, - - 875, 884, 876, 886, 887, 894, 895, 889, 902, 2683, - 901, 904, 898, 905, 906, 2683, 2683, 890, 2683, 2683, - 909, 914, 915, 917, 922, 923, 925, 927, 930, 932, - 935, 936, 938, 944, 946, 939, 947, 948, 950, 954, - 955, 957, 961, 963, 964, 965, 968, 970, 972, 974, - 975, 981, 977, 988, 984, 2683, 986, 987, 991, 993, - 994, 2683, 995, 996, 998, 999, 1000, 1002, 1006, 1004, - 1007, 1014, 1013, 1009, 1012, 1019, 1029, 1030, 1025, 1028, - 1031, 1035, 1037, 1046, 1039, 1043, 1045, 1052, 1048, 1050, - 1054, 1051, 1055, 1057, 1060, 1063, 1085, 1065, 1062, 1064, - - 1067, 1070, 1072, 1074, 1078, 1092, 1097, 1075, 1071, 1103, - 1105, 1099, 1095, 1106, 1112, 1113, 2683, 1119, 1120, 1108, - 1115, 1116, 1122, 1124, 1129, 1126, 1130, 1132, 1138, 2683, - 1135, 1136, 1137, 1140, 1147, 1139, 1149, 1159, 2683, 1161, - 1162, 1155, 1157, 1164, 1165, 1167, 1169, 1170, 1171, 1173, - 1181, 1176, 1178, 1183, 1182, 1187, 1189, 1190, 1192, 1193, - 1194, 1199, 1204, 1210, 1213, 1201, 1218, 1195, 1207, 1211, - 1224, 1219, 1222, 1225, 1226, 2683, 174, 1227, 1228, 1229, - 1235, 1238, 1234, 1232, 1236, 1240, 1242, 1247, 1253, 1248, - 1254, 1255, 1256, 1259, 1258, 1261, 1267, 1268, 1269, 1270, - - 1271, 1272, 1273, 1274, 1279, 1278, 1286, 2683, 1292, 1285, - 1281, 1288, 1296, 1305, 1297, 1302, 1312, 1313, 1315, 1316, - 1317, 1319, 1309, 1322, 1330, 1331, 1327, 1329, 1328, 1334, - 2683, 1335, 1336, 1338, 1341, 1343, 1349, 1347, 1348, 1350, - 1353, 1359, 2683, 1303, 1360, 1354, 1364, 1367, 1369, 1371, - 1378, 1370, 1374, 1372, 1381, 1382, 1383, 1384, 2683, 1393, - 1397, 1394, 1401, 1395, 1398, 1402, 1406, 1403, 1385, 1412, - 1409, 1410, 1414, 1415, 1411, 1418, 1419, 1421, 2683, 1425, - 1422, 1427, 1428, 1434, 1426, 1435, 1436, 1438, 1441, 1447, - 1440, 1451, 1442, 1453, 1450, 1460, 1461, 1464, 1463, 1466, - - 1472, 1478, 1474, 2683, 1477, 1465, 1480, 1486, 1488, 1483, - 1489, 1490, 1491, 1498, 1492, 1494, 1495, 1496, 1503, 1500, - 1501, 1504, 1507, 1506, 1518, 1519, 1520, 1523, 1524, 1526, - 1525, 1532, 2683, 2683, 1533, 1534, 1541, 2683, 1543, 2683, - 1547, 2683, 1548, 1549, 1537, 1539, 1553, 1544, 1555, 1556, - 1560, 1557, 1562, 1563, 1565, 1566, 2683, 1568, 1569, 1574, - 1570, 1572, 1577, 1578, 1582, 1593, 1581, 1585, 1589, 2683, - 1591, 1594, 1600, 1607, 1604, 1598, 1606, 1608, 1609, 1610, - 1612, 1621, 1613, 1611, 1615, 1622, 1623, 1624, 1626, 1632, - 1630, 1631, 1634, 1638, 1640, 1645, 1643, 2683, 2683, 1649, - - 1641, 1646, 1652, 1656, 1658, 1660, 1668, 1665, 1666, 1671, - 1672, 1673, 1674, 1676, 1677, 1679, 1680, 2683, 1688, 1682, - 1696, 1697, 1706, 1689, 1704, 2683, 2683, 1685, 1692, 1708, - 1709, 1711, 1712, 2683, 1714, 1715, 1716, 1717, 1718, 1720, - 1710, 1724, 1732, 1735, 1725, 1736, 1743, 1740, 1741, 1744, - 1746, 1754, 1742, 1756, 1762, 1747, 1758, 1760, 1764, 1761, - 1766, 1770, 1772, 1771, 2683, 1778, 1775, 1784, 1776, 1783, - 1785, 1792, 1788, 1789, 1790, 1791, 1794, 1796, 1797, 1798, - 1804, 2683, 1803, 1805, 1806, 1808, 1814, 1818, 1816, 1821, - 2683, 1822, 1830, 1826, 1828, 1832, 1829, 1836, 1833, 1839, - - 1838, 1841, 1843, 1850, 1844, 1848, 1851, 1852, 1863, 1862, - 1869, 1870, 1867, 1876, 1873, 1874, 1875, 1877, 1886, 1882, - 1888, 1880, 2683, 1890, 1895, 1897, 1899, 1884, 1900, 1898, - 2683, 2683, 1891, 2683, 1908, 1901, 1912, 1913, 2683, 1911, - 2683, 2683, 1914, 1923, 1915, 1916, 1924, 1930, 2683, 1927, - 1925, 1935, 1931, 1937, 1938, 1939, 1933, 1940, 2683, 1941, - 1942, 1943, 1947, 1953, 1955, 1957, 1958, 1962, 1965, 1966, - 1959, 1968, 1974, 1973, 2683, 1972, 1975, 1980, 1981, 1985, - 1982, 1986, 1987, 1996, 1998, 2683, 1992, 1990, 2000, 2683, - 2002, 2683, 2006, 2004, 2009, 2014, 2011, 2022, 2007, 2015, - - 2023, 2017, 2025, 2027, 2683, 2683, 2031, 2033, 2036, 2034, - 2038, 2041, 2039, 2042, 2044, 2048, 2683, 2049, 2050, 2051, - 2052, 2053, 2683, 2056, 2057, 2058, 2062, 2065, 2077, 2079, - 2068, 2083, 2085, 2061, 2087, 2089, 2090, 2683, 2091, 2093, - 2094, 2098, 2099, 2095, 2100, 2104, 2107, 2102, 2111, 2683, - 2115, 2108, 2118, 2116, 2112, 2122, 2123, 2126, 2128, 2130, - 2129, 2131, 2132, 2138, 2059, 2683, 2136, 2683, 2137, 2142, - 2150, 2151, 2683, 2147, 2153, 2683, 2154, 2158, 2167, 2155, - 2161, 2169, 2170, 2171, 2172, 2173, 2174, 2182, 2178, 2683, - 2180, 2181, 2187, 2183, 2683, 2683, 2188, 2683, 2683, 2198, - - 2683, 2683, 2194, 2201, 2683, 2203, 2683, 2209, 2205, 2192, - 2190, 2210, 2683, 2214, 2683, 2683, 2211, 2217, 2207, 2218, - 2225, 2227, 2229, 2220, 2222, 2230, 2231, 2233, 2234, 2236, - 2237, 2238, 2239, 2244, 2241, 2247, 2248, 2250, 2251, 2253, - 2683, 2249, 2262, 2683, 2269, 2270, 2258, 2260, 2271, 2272, - 2274, 2276, 2282, 2280, 2281, 2283, 2683, 2285, 2683, 2683, - 2286, 2284, 2291, 2292, 2294, 2683, 2297, 2298, 2302, 2309, - 2683, 2683, 2683, 2310, 2299, 2305, 2313, 2315, 2316, 2683, - 2319, 2322, 2323, 2325, 2330, 2332, 2338, 2336, 2342, 2683, - 2339, 2337, 2683, 2343, 2345, 2347, 2348, 2350, 2352, 2683, - - 2353, 2354, 2360, 2355, 2363, 2366, 2365, 2683, 2367, 2368, - 2683, 2378, 2683, 2683, 2369, 2379, 2382, 2384, 2387, 2375, - 2388, 2395, 2392, 2394, 2683, 2683, 2397, 2683, 2683, 2396, - 2399, 2400, 2404, 2401, 2406, 2408, 2409, 2412, 2410, 2683, - 2413, 2683, 2414, 2423, 2420, 2418, 2683, 2425, 2426, 2429, - 2683, 2683, 2431, 2439, 2433, 2683, 2441, 2443, 2437, 2444, - 2448, 2449, 2445, 2450, 2455, 2457, 2451, 2453, 2465, 2466, - 2683, 2468, 2460, 2470, 2474, 2476, 2478, 2479, 2481, 2483, - 2484, 2486, 2487, 2683, 2488, 2489, 2499, 2504, 2508, 2490, - 2510, 2683, 2511, 2683, 2514, 2500, 2683, 2683, 2515, 2517, - - 2519, 2683, 2520, 2683, 2518, 2522, 2526, 2683, 2683, 2683, - 2528, 2683, 2529, 2683, 2532, 2534, 2683, 2535, 2537, 2540, - 2683, 2542, 2683, 2544, 2683, 2545, 2546, 2683, 2683, 2683, - 2683, 2548, 2550, 2555, 2551, 2683, 2556, 2558, 2559, 2562, - 2683, 2683, 2591, 2598, 2605, 2612, 2619, 94, 2626, 2633, - 2640, 2647, 2654, 2661, 2668, 2675 - } ; - -static yyconst flex_int16_t yy_def[1357] = - { 0, - 1342, 1, 1343, 1343, 1344, 1344, 1345, 1345, 1346, 1346, - 1347, 1347, 1342, 1348, 1342, 1342, 1342, 1342, 1349, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1350, - 1342, 1342, 1342, 1350, 1351, 1342, 1342, 1342, 1351, 1352, - 1342, 1342, 1342, 1342, 1352, 1353, 1342, 1342, 1342, 1353, - 1354, 1342, 1355, 1342, 1354, 1354, 1348, 1348, 1342, 1356, - 1349, 1356, 1349, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1350, - 1350, 1351, 1351, 1352, 1352, 1342, 1353, 1353, 1354, 1354, - 1355, 1355, 1354, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1354, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1354, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1342, 1348, 1348, - 1348, 1348, 1348, 1342, 1348, 1348, 1348, 1348, 1348, 1348, - - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1354, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - - 1348, 1348, 1348, 1348, 1354, 1348, 1348, 1348, 1348, 1342, - 1348, 1348, 1348, 1348, 1348, 1342, 1342, 1348, 1342, 1342, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1342, 1348, 1348, 1348, 1348, - 1348, 1342, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1354, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1342, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1342, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1342, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1342, 1354, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1342, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1342, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1342, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1342, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1342, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - - 1348, 1348, 1348, 1342, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1342, 1342, 1348, 1348, 1348, 1342, 1348, 1342, - 1348, 1342, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1342, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1342, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1342, 1342, 1348, - - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1342, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1342, 1342, 1348, 1348, 1348, - 1348, 1348, 1348, 1342, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1342, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1342, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1342, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1342, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1342, 1342, 1348, 1342, 1348, 1348, 1348, 1348, 1342, 1348, - 1342, 1342, 1348, 1348, 1348, 1348, 1348, 1348, 1342, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1342, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1342, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1342, 1348, 1348, 1348, 1342, - 1348, 1342, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - - 1348, 1348, 1348, 1348, 1342, 1342, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1342, 1348, 1348, 1348, - 1348, 1348, 1342, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1342, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1342, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1342, 1348, 1342, 1348, 1348, - 1348, 1348, 1342, 1348, 1348, 1342, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1342, - 1348, 1348, 1348, 1348, 1342, 1342, 1348, 1342, 1342, 1348, - - 1342, 1342, 1348, 1348, 1342, 1348, 1342, 1348, 1348, 1348, - 1348, 1348, 1342, 1348, 1342, 1342, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1342, 1348, 1348, 1342, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1342, 1348, 1342, 1342, - 1348, 1348, 1348, 1348, 1348, 1342, 1348, 1348, 1348, 1348, - 1342, 1342, 1342, 1348, 1348, 1348, 1348, 1348, 1348, 1342, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1342, - 1348, 1348, 1342, 1348, 1348, 1348, 1348, 1348, 1348, 1342, - - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1342, 1348, 1348, - 1342, 1348, 1342, 1342, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1342, 1342, 1348, 1342, 1342, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1342, - 1348, 1342, 1348, 1348, 1348, 1348, 1342, 1348, 1348, 1348, - 1342, 1342, 1348, 1348, 1348, 1342, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1342, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1348, 1348, 1342, 1348, 1348, 1348, 1348, 1348, 1348, - 1348, 1342, 1348, 1342, 1348, 1348, 1342, 1342, 1348, 1348, - - 1348, 1342, 1348, 1342, 1348, 1348, 1348, 1342, 1342, 1342, - 1348, 1342, 1348, 1342, 1348, 1348, 1342, 1348, 1348, 1348, - 1342, 1348, 1342, 1348, 1342, 1348, 1348, 1342, 1342, 1342, - 1342, 1348, 1348, 1348, 1348, 1342, 1348, 1348, 1348, 1348, - 1342, 0, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, - 1342, 1342, 1342, 1342, 1342, 1342 - } ; - -static yyconst flex_int16_t yy_nxt[2723] = - { 0, - 14, 15, 16, 17, 18, 19, 18, 14, 14, 14, - 14, 18, 20, 21, 14, 22, 23, 24, 25, 14, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 14, - 35, 36, 37, 38, 39, 14, 14, 14, 14, 41, - 42, 43, 41, 42, 43, 122, 46, 47, 122, 44, - 48, 69, 44, 46, 47, 70, 49, 48, 57, 58, - 59, 68, 68, 49, 51, 52, 53, 54, 60, 18, - 57, 58, 59, 120, 120, 55, 51, 52, 53, 54, - 60, 18, 68, 101, 183, 74, 75, 55, 15, 16, - 17, 62, 63, 64, 67, 67, 68, 67, 67, 65, - - 67, 93, 68, 76, 68, 67, 84, 68, 66, 15, - 16, 17, 62, 63, 64, 68, 68, 77, 134, 86, - 65, 69, 92, 130, 78, 70, 85, 68, 87, 66, - 72, 79, 72, 72, 68, 72, 88, 133, 68, 80, - 72, 73, 89, 81, 68, 90, 82, 68, 68, 83, - 68, 98, 91, 150, 68, 99, 95, 127, 127, 94, - 68, 68, 96, 102, 137, 106, 97, 68, 68, 103, - 68, 100, 104, 109, 135, 107, 68, 68, 108, 105, - 68, 68, 113, 110, 114, 138, 130, 111, 112, 68, - 116, 68, 118, 149, 139, 117, 119, 136, 124, 115, - - 124, 124, 72, 124, 72, 72, 129, 72, 129, 129, - 68, 129, 67, 132, 67, 67, 68, 67, 68, 68, - 68, 68, 67, 72, 143, 72, 72, 68, 72, 68, - 140, 68, 142, 72, 73, 145, 146, 141, 147, 68, - 68, 68, 144, 152, 68, 148, 153, 68, 68, 156, - 155, 158, 68, 151, 163, 159, 161, 68, 68, 68, - 154, 160, 68, 68, 162, 164, 68, 167, 68, 157, - 68, 68, 165, 169, 68, 68, 176, 170, 68, 68, - 68, 68, 166, 68, 168, 68, 173, 172, 68, 178, - 171, 177, 68, 68, 174, 68, 175, 184, 180, 181, - - 120, 120, 127, 127, 122, 185, 182, 122, 130, 179, - 130, 187, 124, 186, 124, 124, 129, 124, 129, 129, - 72, 129, 72, 72, 68, 72, 68, 189, 68, 188, - 68, 132, 68, 68, 194, 68, 191, 196, 68, 68, - 195, 190, 68, 68, 202, 192, 68, 68, 68, 68, - 68, 204, 206, 193, 68, 207, 68, 203, 197, 68, - 68, 213, 68, 198, 209, 68, 216, 68, 199, 68, - 205, 68, 128, 208, 200, 201, 218, 210, 212, 68, - 211, 68, 214, 215, 68, 217, 222, 219, 220, 68, - 221, 68, 224, 225, 223, 68, 68, 68, 68, 68, - - 68, 68, 226, 68, 68, 227, 229, 68, 68, 68, - 68, 231, 238, 234, 68, 68, 228, 68, 68, 232, - 240, 242, 241, 230, 68, 245, 68, 233, 236, 237, - 68, 235, 68, 244, 239, 247, 68, 130, 248, 68, - 68, 253, 68, 243, 68, 68, 68, 68, 246, 250, - 252, 68, 254, 68, 258, 249, 68, 259, 251, 255, - 68, 257, 68, 256, 68, 260, 68, 68, 266, 263, - 68, 264, 68, 68, 68, 268, 261, 262, 68, 265, - 270, 68, 68, 269, 68, 68, 267, 68, 275, 68, - 68, 68, 278, 68, 68, 68, 279, 68, 68, 68, - - 272, 271, 274, 277, 68, 273, 280, 283, 276, 288, - 68, 285, 281, 68, 68, 282, 68, 284, 286, 287, - 68, 68, 68, 289, 294, 68, 295, 68, 296, 292, - 290, 293, 68, 291, 68, 299, 68, 68, 68, 68, - 68, 302, 301, 68, 308, 68, 68, 297, 68, 68, - 309, 68, 68, 303, 298, 307, 300, 68, 68, 304, - 313, 68, 305, 68, 306, 130, 312, 68, 68, 310, - 324, 311, 315, 126, 68, 68, 314, 68, 323, 316, - 317, 68, 327, 329, 68, 68, 325, 326, 68, 318, - 68, 319, 320, 321, 328, 330, 322, 68, 68, 331, - - 332, 333, 335, 68, 334, 336, 337, 68, 68, 68, - 68, 342, 68, 68, 68, 125, 343, 68, 338, 339, - 68, 68, 68, 340, 341, 350, 346, 349, 345, 348, - 352, 344, 68, 68, 68, 68, 68, 68, 354, 347, - 353, 351, 68, 356, 68, 357, 68, 68, 68, 355, - 68, 68, 361, 359, 68, 68, 68, 364, 358, 360, - 362, 68, 365, 68, 68, 68, 369, 363, 68, 366, - 68, 367, 68, 368, 68, 375, 68, 373, 68, 68, - 68, 68, 374, 378, 372, 370, 68, 68, 371, 68, - 68, 380, 68, 68, 376, 68, 379, 390, 68, 393, - - 377, 68, 68, 381, 68, 395, 389, 391, 382, 68, - 383, 68, 388, 392, 68, 384, 396, 385, 68, 68, - 394, 68, 68, 397, 68, 386, 401, 68, 130, 398, - 68, 402, 405, 406, 68, 387, 68, 399, 68, 410, - 68, 400, 404, 403, 68, 68, 407, 68, 408, 409, - 68, 68, 68, 414, 416, 68, 411, 412, 417, 68, - 418, 68, 413, 123, 415, 68, 419, 68, 420, 68, - 421, 68, 425, 422, 68, 68, 423, 68, 424, 68, - 68, 428, 429, 426, 68, 427, 68, 68, 68, 430, - 68, 68, 435, 432, 436, 68, 68, 437, 433, 68, - - 431, 68, 434, 68, 438, 68, 68, 439, 442, 68, - 441, 443, 445, 68, 450, 68, 68, 68, 447, 446, - 68, 444, 68, 448, 68, 68, 68, 449, 453, 440, - 451, 452, 68, 458, 455, 457, 68, 454, 456, 68, - 68, 68, 461, 68, 459, 463, 462, 68, 68, 68, - 464, 68, 68, 68, 465, 68, 68, 469, 68, 460, - 68, 474, 68, 68, 470, 121, 68, 466, 68, 476, - 467, 471, 468, 68, 68, 473, 472, 477, 68, 478, - 68, 475, 480, 68, 68, 68, 68, 68, 68, 483, - 482, 485, 484, 481, 479, 68, 68, 489, 68, 130, - - 486, 68, 68, 488, 491, 487, 68, 68, 497, 492, - 68, 493, 490, 68, 68, 495, 68, 68, 68, 502, - 498, 68, 494, 496, 506, 500, 68, 68, 499, 68, - 503, 505, 504, 501, 68, 68, 507, 68, 508, 68, - 513, 509, 68, 517, 68, 516, 510, 68, 68, 519, - 68, 68, 511, 512, 518, 514, 68, 521, 68, 68, - 68, 522, 68, 526, 515, 520, 68, 68, 525, 68, - 531, 523, 530, 68, 529, 68, 68, 68, 524, 532, - 68, 527, 68, 533, 68, 528, 68, 68, 534, 68, - 535, 537, 539, 68, 538, 541, 68, 540, 68, 68, - - 68, 543, 536, 68, 545, 68, 68, 68, 68, 547, - 68, 68, 68, 544, 68, 542, 68, 548, 68, 68, - 546, 68, 555, 554, 68, 68, 68, 560, 549, 550, - 551, 68, 553, 552, 556, 558, 563, 68, 557, 559, - 68, 68, 68, 68, 561, 562, 564, 68, 567, 68, - 569, 68, 566, 570, 571, 68, 565, 68, 68, 574, - 68, 576, 68, 68, 68, 577, 130, 68, 568, 68, - 573, 579, 68, 572, 68, 68, 68, 68, 578, 68, - 575, 588, 68, 68, 68, 595, 68, 68, 580, 582, - 68, 590, 594, 591, 68, 602, 581, 68, 593, 589, - - 583, 601, 584, 592, 68, 596, 585, 68, 586, 68, - 597, 68, 598, 587, 600, 68, 603, 68, 68, 605, - 68, 606, 604, 608, 68, 68, 610, 68, 68, 609, - 599, 68, 68, 614, 68, 611, 68, 607, 68, 612, - 613, 68, 68, 615, 68, 621, 617, 68, 68, 68, - 68, 68, 68, 620, 624, 616, 619, 625, 618, 68, - 627, 68, 628, 623, 626, 622, 629, 68, 630, 68, - 634, 68, 631, 68, 68, 632, 68, 68, 633, 68, - 637, 68, 68, 68, 635, 68, 639, 640, 68, 641, - 68, 642, 643, 68, 68, 68, 636, 644, 646, 68, - - 638, 68, 68, 130, 68, 68, 68, 68, 645, 651, - 652, 68, 647, 68, 654, 650, 68, 656, 648, 68, - 657, 649, 68, 68, 653, 68, 660, 655, 658, 659, - 68, 68, 663, 661, 68, 662, 68, 68, 68, 68, - 68, 68, 671, 665, 68, 672, 68, 68, 68, 664, - 68, 673, 68, 668, 68, 669, 666, 676, 674, 68, - 68, 670, 675, 667, 679, 68, 68, 68, 68, 677, - 68, 68, 682, 68, 678, 681, 684, 686, 680, 68, - 68, 68, 68, 68, 68, 68, 68, 683, 687, 685, - 68, 68, 694, 68, 690, 688, 689, 68, 68, 698, - - 68, 700, 691, 693, 68, 692, 695, 697, 68, 68, - 696, 699, 703, 702, 68, 68, 704, 68, 735, 707, - 701, 68, 705, 706, 68, 68, 708, 68, 68, 68, - 711, 68, 709, 710, 68, 713, 712, 715, 716, 68, - 68, 68, 68, 68, 717, 718, 68, 68, 68, 719, - 68, 724, 714, 68, 720, 68, 721, 723, 722, 68, - 68, 68, 68, 725, 733, 68, 68, 727, 726, 729, - 734, 68, 68, 730, 728, 738, 68, 736, 731, 68, - 740, 68, 68, 68, 68, 737, 68, 732, 741, 742, - 68, 744, 745, 68, 68, 68, 68, 68, 746, 739, - - 750, 748, 743, 749, 751, 68, 68, 68, 753, 68, - 68, 752, 747, 68, 68, 68, 754, 757, 68, 760, - 759, 68, 68, 68, 68, 756, 68, 68, 764, 755, - 68, 68, 769, 68, 68, 758, 770, 68, 68, 68, - 68, 761, 762, 765, 763, 773, 68, 68, 68, 767, - 68, 776, 68, 68, 68, 766, 768, 772, 775, 68, - 771, 783, 68, 68, 774, 68, 777, 779, 782, 778, - 784, 781, 68, 68, 780, 68, 68, 68, 68, 791, - 785, 786, 788, 790, 68, 792, 68, 793, 787, 68, - 68, 795, 68, 797, 794, 68, 789, 798, 68, 799, - - 68, 68, 68, 68, 68, 804, 68, 68, 68, 803, - 68, 796, 68, 68, 800, 68, 68, 812, 68, 68, - 801, 802, 814, 805, 813, 806, 807, 808, 811, 809, - 68, 68, 68, 810, 818, 68, 68, 68, 68, 822, - 816, 819, 820, 815, 68, 68, 68, 824, 825, 68, - 823, 68, 817, 68, 826, 68, 68, 821, 827, 68, - 68, 68, 829, 828, 830, 68, 834, 68, 68, 68, - 832, 833, 68, 836, 68, 68, 831, 68, 68, 839, - 68, 68, 68, 841, 68, 838, 68, 844, 835, 68, - 68, 837, 848, 68, 68, 843, 840, 68, 842, 849, - - 850, 68, 845, 68, 846, 68, 68, 853, 854, 847, - 68, 852, 68, 851, 857, 856, 68, 858, 68, 68, - 68, 68, 68, 68, 68, 68, 862, 68, 859, 864, - 866, 855, 865, 68, 68, 68, 68, 860, 68, 873, - 861, 867, 68, 68, 68, 863, 68, 868, 871, 870, - 68, 872, 68, 68, 869, 68, 883, 68, 68, 878, - 882, 68, 874, 875, 68, 877, 879, 876, 68, 880, - 68, 881, 68, 885, 884, 890, 891, 68, 68, 887, - 68, 889, 888, 68, 68, 68, 68, 886, 68, 68, - 898, 68, 68, 128, 68, 901, 893, 68, 892, 895, - - 68, 68, 894, 903, 68, 909, 897, 899, 68, 68, - 900, 896, 902, 905, 906, 904, 68, 910, 68, 907, - 68, 68, 68, 68, 68, 908, 68, 68, 68, 68, - 68, 916, 68, 917, 918, 919, 68, 68, 911, 913, - 912, 920, 914, 923, 68, 921, 915, 68, 68, 925, - 927, 922, 68, 68, 68, 68, 68, 931, 68, 68, - 926, 924, 930, 933, 928, 932, 68, 934, 68, 935, - 68, 929, 68, 68, 68, 939, 68, 941, 68, 943, - 936, 942, 68, 68, 68, 945, 944, 68, 68, 937, - 68, 947, 938, 940, 949, 68, 68, 68, 950, 951, - - 68, 68, 68, 68, 68, 946, 68, 959, 68, 68, - 68, 961, 952, 948, 953, 68, 68, 68, 68, 954, - 68, 955, 956, 957, 963, 965, 68, 958, 68, 966, - 68, 968, 964, 68, 68, 960, 962, 972, 68, 971, - 68, 68, 68, 975, 68, 68, 976, 974, 68, 970, - 68, 68, 967, 68, 969, 68, 68, 977, 973, 986, - 68, 982, 68, 68, 68, 978, 979, 984, 981, 980, - 989, 983, 985, 990, 68, 68, 991, 993, 988, 68, - 992, 68, 68, 995, 987, 68, 68, 68, 68, 68, - 997, 994, 68, 1000, 68, 1002, 68, 996, 68, 998, - - 68, 1008, 68, 68, 1003, 1004, 1005, 68, 1006, 68, - 68, 68, 68, 68, 999, 1011, 1001, 1007, 1009, 1010, - 68, 1012, 1017, 68, 68, 68, 68, 68, 68, 1021, - 1019, 1014, 1013, 1015, 1016, 68, 68, 68, 1022, 68, - 1018, 1023, 68, 68, 1020, 68, 1024, 68, 1026, 68, - 68, 68, 68, 68, 68, 68, 1034, 1025, 1033, 68, - 1031, 1028, 1029, 1030, 1027, 68, 1038, 68, 1036, 68, - 68, 68, 1032, 1035, 68, 1040, 1041, 68, 68, 1037, - 68, 1046, 1042, 1043, 68, 68, 68, 68, 126, 1044, - 1047, 1050, 68, 68, 68, 1039, 1054, 68, 68, 68, - - 1045, 1049, 68, 1048, 68, 1051, 1052, 1055, 68, 1053, - 68, 1056, 68, 1057, 68, 1058, 68, 1059, 68, 68, - 1062, 68, 1060, 68, 1063, 1066, 68, 68, 1061, 68, - 1065, 1070, 1067, 1068, 68, 68, 1073, 68, 1069, 68, - 1071, 1064, 1072, 68, 1076, 68, 68, 1074, 68, 1077, - 68, 68, 1075, 68, 68, 1079, 68, 1080, 1078, 1082, - 68, 68, 68, 68, 68, 68, 1081, 1090, 68, 68, - 68, 68, 1091, 68, 68, 1130, 1088, 68, 1094, 1084, - 68, 1086, 1083, 1092, 1087, 1085, 1089, 1093, 1095, 68, - 1096, 68, 1100, 1097, 1098, 68, 1099, 68, 1101, 68, - - 1102, 68, 68, 68, 1105, 68, 68, 68, 1104, 1107, - 68, 68, 68, 1109, 68, 1110, 68, 1111, 1113, 68, - 68, 1103, 1115, 68, 68, 1106, 1116, 68, 68, 1108, - 68, 1118, 1112, 1114, 68, 68, 1120, 1119, 68, 1121, - 68, 68, 68, 68, 68, 1129, 1117, 1125, 68, 68, - 68, 1123, 1127, 1128, 68, 1133, 1126, 1134, 1132, 68, - 1122, 1124, 68, 68, 1135, 68, 68, 68, 1131, 1139, - 68, 1142, 1136, 68, 1137, 1140, 1143, 1138, 1141, 68, - 1144, 68, 68, 68, 68, 68, 68, 1145, 1147, 1150, - 68, 1149, 68, 68, 68, 68, 1151, 1155, 1153, 68, - - 68, 1156, 68, 1146, 68, 1148, 68, 1154, 1152, 1157, - 68, 1158, 1159, 68, 1160, 68, 1161, 68, 1162, 68, - 1163, 68, 68, 68, 1164, 1166, 68, 1165, 1167, 68, - 68, 1168, 68, 1169, 68, 1170, 1171, 68, 1172, 68, - 1173, 68, 68, 68, 1174, 68, 68, 1180, 68, 68, - 68, 68, 1175, 68, 1176, 1177, 68, 1178, 1181, 68, - 68, 68, 68, 68, 1190, 68, 1179, 1188, 1189, 1184, - 68, 1183, 68, 1186, 68, 1192, 1182, 1185, 1187, 1191, - 1193, 68, 68, 68, 68, 1195, 68, 1200, 68, 1201, - 1196, 1194, 68, 68, 68, 68, 68, 68, 68, 1207, - - 1198, 1197, 1208, 68, 68, 1199, 68, 1202, 1211, 68, - 68, 68, 1203, 1213, 68, 1204, 1205, 68, 1206, 1209, - 1214, 68, 68, 1215, 1210, 68, 1217, 68, 68, 1212, - 1218, 68, 1219, 1216, 68, 68, 1220, 68, 125, 1222, - 1223, 1225, 68, 1226, 68, 1227, 1221, 1228, 68, 68, - 68, 68, 1224, 1229, 68, 68, 1230, 68, 1232, 68, - 68, 1231, 68, 1236, 68, 68, 68, 68, 1234, 1235, - 1233, 1240, 68, 1237, 1242, 68, 1241, 68, 68, 68, - 68, 68, 1244, 123, 1238, 1239, 1243, 68, 1245, 1247, - 68, 68, 1249, 1246, 68, 1251, 68, 1250, 1252, 68, - - 68, 1248, 1255, 1256, 68, 1253, 68, 68, 68, 68, - 1257, 68, 68, 68, 1254, 1258, 68, 1262, 68, 1260, - 68, 68, 68, 1264, 68, 68, 68, 1259, 1269, 1263, - 68, 1261, 68, 1267, 1271, 68, 1272, 68, 68, 1273, - 1265, 68, 1268, 68, 1270, 68, 1274, 1266, 1277, 68, - 1275, 68, 1278, 68, 1279, 68, 68, 68, 1280, 1284, - 68, 68, 68, 68, 1281, 68, 1276, 68, 1282, 68, - 1285, 1283, 68, 1286, 1289, 1288, 1292, 68, 68, 1294, - 68, 1287, 68, 1293, 1291, 1297, 68, 1298, 68, 1290, - 68, 68, 1295, 68, 1302, 68, 68, 1304, 68, 68, - - 68, 68, 68, 1300, 1296, 121, 1307, 1311, 1303, 1299, - 1308, 68, 68, 1301, 1306, 1309, 68, 1315, 1305, 1310, - 68, 1312, 68, 68, 1313, 1314, 68, 68, 1317, 68, - 68, 68, 68, 1321, 68, 1316, 1318, 1319, 68, 1323, - 68, 68, 1322, 1325, 68, 1324, 68, 68, 1328, 68, - 1320, 1329, 68, 1330, 68, 1331, 68, 68, 68, 1333, - 68, 1326, 68, 68, 1334, 1327, 1336, 68, 68, 1332, - 68, 68, 1337, 1341, 68, 68, 1342, 1342, 1342, 1342, - 1342, 1342, 1335, 1338, 1339, 1342, 1342, 1342, 1342, 1342, - 1340, 40, 40, 40, 40, 40, 40, 40, 45, 45, - - 45, 45, 45, 45, 45, 50, 50, 50, 50, 50, - 50, 50, 56, 56, 56, 56, 56, 56, 56, 61, - 61, 61, 61, 61, 61, 61, 71, 71, 1342, 71, - 71, 71, 71, 120, 120, 1342, 1342, 1342, 120, 120, - 122, 122, 1342, 1342, 122, 1342, 122, 124, 1342, 1342, - 1342, 1342, 1342, 124, 127, 127, 1342, 1342, 1342, 127, - 127, 129, 1342, 1342, 1342, 1342, 1342, 129, 131, 131, - 1342, 131, 131, 131, 131, 72, 72, 1342, 72, 72, - 72, 72, 13, 1342, 1342, 1342, 1342, 1342, 1342, 1342, - 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, - - 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, - 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, - 1342, 1342 - } ; - -static yyconst flex_int16_t yy_chk[2723] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, - 3, 3, 4, 4, 4, 49, 5, 5, 49, 3, - 5, 15, 4, 6, 6, 15, 5, 6, 9, 9, - 9, 116, 33, 6, 7, 7, 7, 7, 9, 7, - 10, 10, 10, 44, 44, 7, 8, 8, 8, 8, - 10, 8, 21, 33, 116, 21, 21, 8, 11, 11, - 11, 11, 11, 11, 1348, 20, 29, 20, 20, 11, - - 20, 29, 24, 21, 25, 20, 24, 28, 11, 12, - 12, 12, 12, 12, 12, 74, 22, 22, 74, 25, - 12, 69, 28, 66, 22, 69, 24, 26, 26, 12, - 19, 22, 19, 19, 23, 19, 26, 66, 27, 23, - 19, 19, 27, 23, 30, 27, 23, 31, 89, 23, - 32, 32, 27, 89, 34, 32, 31, 60, 60, 30, - 35, 77, 31, 34, 77, 35, 31, 78, 36, 34, - 75, 32, 34, 36, 75, 35, 38, 76, 35, 34, - 79, 37, 37, 36, 37, 78, 577, 36, 36, 88, - 38, 39, 39, 88, 79, 38, 39, 76, 55, 37, - - 55, 55, 63, 55, 63, 63, 65, 63, 65, 65, - 82, 65, 68, 63, 68, 68, 85, 68, 80, 81, - 86, 84, 68, 71, 83, 71, 71, 87, 71, 83, - 80, 92, 82, 71, 71, 84, 85, 81, 86, 90, - 91, 98, 83, 91, 93, 87, 91, 95, 94, 93, - 92, 94, 96, 90, 98, 94, 96, 97, 99, 100, - 91, 95, 101, 102, 97, 99, 103, 102, 104, 93, - 105, 107, 100, 104, 106, 108, 110, 104, 109, 111, - 113, 110, 101, 114, 103, 115, 107, 106, 112, 112, - 105, 111, 117, 118, 108, 119, 109, 117, 113, 114, - - 121, 121, 128, 128, 123, 118, 115, 123, 133, 112, - 129, 133, 125, 119, 125, 125, 130, 125, 130, 130, - 131, 130, 131, 131, 134, 131, 136, 135, 137, 134, - 138, 131, 135, 139, 140, 141, 137, 142, 145, 140, - 141, 136, 142, 144, 144, 138, 146, 147, 148, 151, - 149, 146, 148, 139, 143, 149, 154, 145, 143, 150, - 153, 154, 155, 143, 151, 152, 157, 156, 143, 161, - 147, 157, 127, 150, 143, 143, 159, 152, 153, 160, - 152, 159, 155, 156, 158, 158, 162, 159, 160, 163, - 161, 162, 164, 165, 163, 166, 168, 164, 165, 167, - - 169, 170, 166, 171, 172, 167, 169, 173, 174, 175, - 176, 171, 177, 174, 178, 180, 168, 177, 179, 172, - 179, 181, 180, 170, 182, 184, 181, 173, 176, 176, - 184, 175, 183, 183, 178, 185, 186, 187, 186, 188, - 185, 190, 189, 182, 192, 193, 190, 191, 184, 187, - 189, 195, 191, 194, 195, 186, 196, 196, 188, 192, - 198, 194, 199, 193, 197, 197, 200, 201, 203, 200, - 202, 201, 204, 203, 205, 205, 198, 199, 206, 202, - 207, 208, 209, 206, 210, 207, 204, 212, 212, 211, - 213, 214, 215, 216, 217, 218, 216, 215, 219, 221, - - 209, 208, 211, 214, 220, 210, 217, 219, 213, 223, - 223, 221, 218, 225, 226, 218, 222, 220, 222, 222, - 224, 229, 227, 224, 228, 228, 229, 230, 230, 226, - 225, 227, 231, 225, 232, 233, 234, 235, 236, 237, - 233, 236, 235, 238, 240, 241, 239, 231, 242, 240, - 241, 243, 244, 237, 232, 239, 234, 245, 246, 238, - 245, 249, 238, 248, 238, 250, 244, 252, 251, 242, - 249, 243, 246, 126, 253, 255, 245, 247, 248, 247, - 247, 258, 252, 254, 256, 257, 250, 251, 254, 247, - 259, 247, 247, 247, 253, 255, 247, 260, 262, 256, - - 257, 258, 260, 263, 259, 261, 261, 264, 261, 266, - 265, 266, 267, 268, 269, 124, 267, 270, 262, 263, - 271, 273, 272, 264, 265, 273, 270, 272, 269, 271, - 275, 268, 274, 277, 276, 275, 278, 281, 277, 270, - 276, 274, 279, 279, 282, 280, 286, 283, 290, 278, - 280, 284, 284, 282, 293, 285, 287, 287, 281, 283, - 285, 289, 289, 291, 292, 295, 293, 286, 296, 290, - 297, 291, 298, 292, 299, 300, 301, 298, 302, 303, - 300, 304, 299, 303, 297, 295, 305, 306, 296, 307, - 310, 305, 309, 312, 301, 314, 304, 311, 313, 313, - - 302, 316, 311, 306, 315, 315, 310, 311, 307, 308, - 308, 317, 309, 312, 318, 308, 316, 308, 319, 320, - 314, 321, 322, 317, 323, 308, 321, 324, 325, 318, - 328, 322, 325, 326, 327, 308, 329, 319, 326, 330, - 330, 320, 324, 323, 331, 332, 327, 333, 328, 329, - 334, 335, 342, 334, 336, 336, 331, 332, 337, 337, - 338, 348, 333, 122, 335, 338, 339, 339, 340, 340, - 341, 343, 345, 342, 344, 341, 343, 345, 344, 346, - 347, 348, 349, 346, 350, 347, 351, 349, 355, 350, - 352, 353, 353, 352, 354, 359, 367, 355, 352, 354, - - 351, 356, 352, 357, 356, 358, 360, 357, 359, 361, - 358, 360, 362, 363, 367, 364, 368, 362, 364, 363, - 365, 361, 366, 365, 374, 370, 369, 366, 370, 357, - 368, 369, 371, 374, 372, 373, 379, 371, 372, 372, - 373, 375, 376, 377, 375, 377, 376, 376, 378, 380, - 378, 381, 382, 383, 379, 384, 385, 383, 386, 375, - 387, 388, 389, 394, 384, 120, 388, 380, 390, 390, - 381, 385, 382, 391, 392, 387, 386, 391, 393, 392, - 395, 389, 394, 396, 397, 398, 399, 401, 403, 397, - 396, 399, 398, 395, 393, 400, 402, 403, 404, 405, - - 400, 408, 418, 402, 405, 401, 406, 407, 411, 406, - 413, 407, 404, 411, 409, 409, 412, 414, 415, 418, - 412, 421, 408, 409, 424, 414, 422, 423, 413, 424, - 421, 423, 422, 415, 425, 426, 425, 427, 425, 428, - 426, 425, 429, 430, 430, 429, 425, 431, 432, 432, - 433, 436, 425, 425, 431, 427, 434, 434, 435, 437, - 438, 435, 439, 439, 428, 433, 440, 441, 438, 442, - 444, 436, 443, 443, 442, 444, 445, 446, 437, 445, - 447, 440, 448, 446, 449, 441, 450, 451, 447, 453, - 448, 450, 452, 452, 451, 454, 455, 453, 457, 458, - - 454, 457, 449, 459, 459, 460, 461, 463, 464, 461, - 465, 466, 467, 458, 468, 455, 470, 461, 469, 471, - 460, 474, 469, 468, 475, 473, 472, 474, 463, 464, - 465, 476, 467, 466, 470, 472, 477, 479, 471, 473, - 480, 477, 478, 481, 475, 476, 478, 482, 481, 483, - 483, 485, 480, 484, 485, 486, 479, 487, 484, 488, - 489, 490, 490, 492, 488, 491, 491, 493, 482, 494, - 487, 493, 495, 486, 499, 496, 500, 498, 492, 501, - 489, 498, 502, 509, 503, 505, 504, 508, 494, 496, - 505, 500, 504, 501, 67, 509, 495, 497, 503, 499, - - 497, 508, 497, 502, 506, 506, 497, 513, 497, 507, - 506, 512, 506, 497, 507, 510, 510, 511, 514, 512, - 520, 513, 511, 515, 515, 516, 518, 521, 522, 516, - 506, 518, 519, 522, 523, 519, 524, 514, 526, 520, - 521, 525, 527, 523, 528, 529, 525, 531, 532, 533, - 529, 536, 534, 528, 533, 524, 527, 534, 526, 535, - 536, 537, 537, 532, 535, 531, 538, 542, 540, 543, - 542, 538, 540, 540, 541, 541, 544, 545, 541, 546, - 545, 547, 548, 549, 543, 550, 547, 548, 552, 549, - 553, 550, 551, 551, 555, 554, 544, 552, 554, 556, - - 546, 557, 558, 61, 559, 560, 561, 568, 553, 559, - 560, 562, 555, 566, 562, 558, 563, 564, 556, 569, - 565, 557, 564, 570, 561, 565, 568, 563, 566, 567, - 567, 572, 571, 569, 573, 570, 571, 574, 575, 578, - 579, 580, 581, 573, 584, 582, 583, 581, 585, 572, - 582, 583, 586, 578, 587, 579, 574, 586, 584, 588, - 590, 580, 585, 575, 589, 589, 591, 592, 593, 587, - 595, 594, 592, 596, 588, 591, 594, 596, 590, 597, - 598, 599, 600, 601, 602, 603, 604, 593, 597, 595, - 606, 605, 604, 611, 600, 598, 599, 610, 607, 609, - - 612, 611, 601, 603, 609, 602, 605, 607, 613, 615, - 606, 610, 614, 613, 616, 644, 614, 614, 644, 617, - 612, 623, 615, 616, 617, 618, 618, 619, 620, 621, - 621, 622, 619, 620, 624, 623, 622, 625, 626, 627, - 629, 628, 625, 626, 627, 628, 630, 632, 633, 629, - 634, 632, 624, 635, 629, 636, 629, 630, 629, 638, - 639, 637, 640, 633, 641, 641, 646, 635, 634, 637, - 642, 642, 645, 638, 636, 647, 647, 645, 639, 648, - 649, 649, 652, 650, 654, 646, 653, 640, 650, 651, - 651, 653, 654, 655, 656, 657, 658, 669, 655, 648, - - 660, 657, 652, 658, 661, 660, 662, 664, 663, 661, - 665, 662, 656, 663, 666, 668, 664, 667, 667, 670, - 669, 671, 672, 675, 670, 666, 673, 674, 674, 665, - 676, 677, 680, 678, 681, 668, 680, 680, 685, 682, - 683, 671, 672, 675, 673, 683, 684, 686, 687, 677, - 688, 686, 691, 689, 693, 676, 678, 682, 685, 690, - 681, 693, 695, 692, 684, 694, 687, 689, 692, 688, - 694, 691, 696, 697, 690, 699, 698, 706, 700, 701, - 695, 696, 698, 700, 701, 702, 703, 703, 697, 705, - 702, 706, 707, 708, 705, 710, 699, 708, 708, 709, - - 709, 711, 712, 713, 715, 714, 716, 717, 718, 713, - 714, 707, 720, 721, 710, 719, 722, 722, 724, 723, - 711, 712, 724, 715, 723, 716, 717, 718, 721, 719, - 725, 726, 727, 720, 728, 728, 729, 731, 730, 732, - 726, 729, 730, 725, 732, 735, 736, 736, 737, 745, - 735, 746, 727, 737, 739, 739, 748, 731, 741, 741, - 743, 744, 744, 743, 745, 747, 749, 749, 750, 752, - 747, 748, 751, 751, 753, 754, 746, 755, 756, 754, - 758, 759, 761, 756, 762, 753, 760, 760, 750, 763, - 764, 752, 764, 767, 765, 759, 755, 768, 758, 765, - - 766, 769, 761, 771, 762, 766, 772, 769, 771, 763, - 776, 768, 773, 767, 774, 773, 775, 775, 777, 774, - 778, 779, 780, 784, 781, 783, 779, 785, 776, 781, - 783, 772, 782, 782, 786, 787, 788, 777, 789, 790, - 778, 784, 791, 792, 790, 780, 793, 785, 788, 787, - 794, 789, 795, 801, 786, 797, 801, 796, 802, 795, - 800, 800, 791, 792, 803, 794, 796, 793, 804, 796, - 805, 797, 806, 803, 802, 807, 808, 808, 809, 805, - 807, 806, 805, 810, 811, 812, 813, 804, 814, 815, - 815, 816, 817, 56, 820, 819, 810, 828, 809, 812, - - 819, 824, 811, 821, 829, 828, 814, 816, 821, 822, - 817, 813, 820, 823, 824, 822, 825, 829, 823, 825, - 830, 831, 841, 832, 833, 825, 835, 836, 837, 838, - 839, 836, 840, 837, 838, 839, 842, 845, 830, 832, - 831, 840, 833, 843, 843, 841, 835, 844, 846, 845, - 847, 842, 848, 849, 853, 847, 850, 851, 851, 856, - 846, 844, 850, 853, 848, 852, 852, 854, 854, 855, - 857, 849, 858, 860, 855, 859, 859, 861, 861, 863, - 856, 862, 862, 864, 863, 866, 864, 867, 869, 857, - 866, 868, 858, 860, 870, 870, 868, 871, 871, 872, - - 873, 874, 875, 876, 872, 867, 877, 878, 878, 879, - 880, 880, 873, 869, 873, 883, 881, 884, 885, 873, - 886, 874, 875, 876, 883, 885, 887, 877, 889, 886, - 888, 888, 884, 890, 892, 879, 881, 893, 894, 892, - 895, 897, 893, 896, 896, 899, 897, 895, 898, 890, - 901, 900, 887, 902, 889, 903, 905, 898, 894, 906, - 906, 903, 904, 907, 908, 899, 900, 905, 902, 901, - 909, 904, 905, 910, 910, 909, 911, 912, 908, 913, - 911, 911, 912, 914, 907, 915, 916, 917, 914, 918, - 916, 913, 922, 919, 920, 921, 928, 915, 919, 917, - - 921, 928, 924, 933, 922, 924, 925, 925, 926, 926, - 930, 927, 929, 936, 918, 933, 920, 927, 929, 930, - 935, 935, 940, 940, 937, 938, 943, 945, 946, 946, - 944, 936, 935, 937, 938, 944, 947, 951, 947, 950, - 943, 948, 948, 953, 945, 957, 950, 952, 952, 954, - 955, 956, 958, 960, 961, 962, 961, 951, 960, 963, - 957, 954, 955, 956, 953, 964, 965, 965, 963, 966, - 967, 971, 958, 962, 968, 967, 968, 969, 970, 964, - 972, 973, 969, 970, 976, 974, 973, 977, 51, 971, - 974, 978, 978, 979, 981, 966, 981, 980, 982, 983, - - 972, 977, 988, 976, 987, 979, 980, 982, 984, 980, - 985, 983, 989, 984, 991, 985, 994, 987, 993, 999, - 991, 995, 988, 997, 993, 996, 996, 1000, 989, 1002, - 995, 1000, 997, 998, 998, 1001, 1003, 1003, 999, 1004, - 1001, 994, 1002, 1007, 1008, 1008, 1010, 1004, 1009, 1009, - 1011, 1013, 1007, 1012, 1014, 1011, 1015, 1012, 1010, 1014, - 1016, 1018, 1019, 1020, 1021, 1022, 1013, 1024, 1024, 1025, - 1026, 1065, 1025, 1034, 1027, 1065, 1021, 1028, 1028, 1016, - 1031, 1019, 1015, 1026, 1020, 1018, 1022, 1027, 1029, 1029, - 1030, 1030, 1034, 1031, 1032, 1032, 1033, 1033, 1035, 1035, - - 1036, 1036, 1037, 1039, 1040, 1040, 1041, 1044, 1039, 1042, - 1042, 1043, 1045, 1044, 1048, 1045, 1046, 1046, 1047, 1047, - 1052, 1037, 1049, 1049, 1055, 1041, 1051, 1051, 1054, 1043, - 1053, 1053, 1046, 1048, 1056, 1057, 1055, 1054, 1058, 1056, - 1059, 1061, 1060, 1062, 1063, 1064, 1052, 1060, 1067, 1069, - 1064, 1058, 1062, 1063, 1070, 1070, 1061, 1071, 1069, 1074, - 1057, 1059, 1071, 1072, 1072, 1075, 1077, 1080, 1067, 1077, - 1078, 1080, 1072, 1081, 1074, 1078, 1081, 1075, 1079, 1079, - 1082, 1082, 1083, 1084, 1085, 1086, 1087, 1083, 1085, 1088, - 1089, 1087, 1091, 1092, 1088, 1094, 1089, 1094, 1092, 1093, - - 1097, 1097, 1111, 1084, 1110, 1086, 1103, 1093, 1091, 1100, - 1100, 1103, 1104, 1104, 1106, 1106, 1108, 1109, 1109, 1119, - 1110, 1108, 1112, 1117, 1111, 1114, 1114, 1112, 1117, 1118, - 1120, 1118, 1124, 1119, 1125, 1120, 1121, 1121, 1122, 1122, - 1123, 1123, 1126, 1127, 1124, 1128, 1129, 1130, 1130, 1131, - 1132, 1133, 1125, 1135, 1126, 1127, 1134, 1128, 1131, 1136, - 1137, 1142, 1138, 1139, 1140, 1140, 1129, 1138, 1139, 1134, - 1147, 1133, 1148, 1136, 1143, 1143, 1132, 1135, 1137, 1142, - 1145, 1145, 1146, 1149, 1150, 1147, 1151, 1152, 1152, 1153, - 1148, 1146, 1154, 1155, 1153, 1156, 1162, 1158, 1161, 1162, - - 1150, 1149, 1163, 1163, 1164, 1151, 1165, 1154, 1167, 1167, - 1168, 1175, 1155, 1169, 1169, 1156, 1158, 1176, 1161, 1164, - 1170, 1170, 1174, 1174, 1165, 1177, 1176, 1178, 1179, 1168, - 1177, 1181, 1178, 1175, 1182, 1183, 1179, 1184, 50, 1182, - 1183, 1185, 1185, 1186, 1186, 1187, 1181, 1188, 1188, 1192, - 1187, 1191, 1184, 1189, 1189, 1194, 1191, 1195, 1194, 1196, - 1197, 1192, 1198, 1198, 1199, 1201, 1202, 1204, 1196, 1197, - 1195, 1203, 1203, 1199, 1205, 1205, 1204, 1207, 1206, 1209, - 1210, 1215, 1207, 45, 1201, 1202, 1206, 1220, 1209, 1212, - 1212, 1216, 1216, 1210, 1217, 1218, 1218, 1217, 1219, 1219, - - 1221, 1215, 1222, 1223, 1223, 1220, 1224, 1222, 1230, 1227, - 1224, 1231, 1232, 1234, 1221, 1227, 1233, 1233, 1235, 1231, - 1236, 1237, 1239, 1235, 1238, 1241, 1243, 1230, 1241, 1234, - 1246, 1232, 1245, 1238, 1244, 1244, 1245, 1248, 1249, 1246, - 1236, 1250, 1239, 1253, 1243, 1255, 1248, 1237, 1253, 1259, - 1249, 1254, 1254, 1257, 1255, 1258, 1260, 1263, 1257, 1261, - 1261, 1262, 1264, 1267, 1258, 1268, 1250, 1265, 1259, 1266, - 1262, 1260, 1273, 1263, 1266, 1265, 1269, 1269, 1270, 1272, - 1272, 1264, 1274, 1270, 1268, 1275, 1275, 1276, 1276, 1267, - 1277, 1278, 1273, 1279, 1280, 1280, 1281, 1282, 1282, 1283, - - 1285, 1286, 1290, 1278, 1274, 40, 1286, 1290, 1281, 1277, - 1287, 1287, 1296, 1279, 1285, 1288, 1288, 1296, 1283, 1289, - 1289, 1291, 1291, 1293, 1293, 1295, 1295, 1299, 1300, 1300, - 1305, 1301, 1303, 1306, 1306, 1299, 1301, 1303, 1307, 1311, - 1311, 1313, 1307, 1315, 1315, 1313, 1316, 1318, 1319, 1319, - 1305, 1320, 1320, 1322, 1322, 1324, 1324, 1326, 1327, 1327, - 1332, 1316, 1333, 1335, 1332, 1318, 1334, 1334, 1337, 1326, - 1338, 1339, 1335, 1340, 1340, 14, 13, 0, 0, 0, - 0, 0, 1333, 1337, 1338, 0, 0, 0, 0, 0, - 1339, 1343, 1343, 1343, 1343, 1343, 1343, 1343, 1344, 1344, - - 1344, 1344, 1344, 1344, 1344, 1345, 1345, 1345, 1345, 1345, - 1345, 1345, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1347, - 1347, 1347, 1347, 1347, 1347, 1347, 1349, 1349, 0, 1349, - 1349, 1349, 1349, 1350, 1350, 0, 0, 0, 1350, 1350, - 1351, 1351, 0, 0, 1351, 0, 1351, 1352, 0, 0, - 0, 0, 0, 1352, 1353, 1353, 0, 0, 0, 1353, - 1353, 1354, 0, 0, 0, 0, 0, 1354, 1355, 1355, - 0, 1355, 1355, 1355, 1355, 1356, 1356, 0, 1356, 1356, - 1356, 1356, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, - 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, - - 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, - 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, - 1342, 1342 - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -extern int yy_flex_debug; -int yy_flex_debug = 0; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -static int yy_more_flag = 0; -static int yy_more_len = 0; -#define yymore() ((yy_more_flag) = 1) -#define YY_MORE_ADJ (yy_more_len) -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -/* - * configlexer.lex - lexical analyzer for unbound config file - * - * Copyright (c) 2001-2006, NLnet Labs. All rights reserved - * - * See LICENSE for the license. - * - */ - -#include -#include -#include -#ifdef HAVE_GLOB_H -# include -#endif - -#include "util/config_file.h" -#include "util/configparser.h" -void ub_c_error(const char *message); - -#if 0 -#define LEXOUT(s) printf s /* used ONLY when debugging */ -#else -#define LEXOUT(s) -#endif - -/** avoid warning in about fwrite return value */ -#define ECHO ub_c_error_msg("syntax error at text: %s", yytext) - -/** A parser variable, this is a statement in the config file which is - * of the form variable: value1 value2 ... nargs is the number of values. */ -#define YDVAR(nargs, var) \ - num_args=(nargs); \ - LEXOUT(("v(%s%d) ", yytext, num_args)); \ - if(num_args > 0) { BEGIN(val); } \ - return (var); - -struct inc_state { - char* filename; - int line; -}; -static struct inc_state parse_stack[MAXINCLUDES]; -static YY_BUFFER_STATE include_stack[MAXINCLUDES]; -static int config_include_stack_ptr = 0; -static int inc_prev = 0; -static int num_args = 0; - -static void config_start_include(const char* filename) -{ - FILE *input; - if(strlen(filename) == 0) { - ub_c_error_msg("empty include file name"); - return; - } - if(config_include_stack_ptr >= MAXINCLUDES) { - ub_c_error_msg("includes nested too deeply, skipped (>%d)", MAXINCLUDES); - return; - } - if(cfg_parser->chroot && strncmp(filename, cfg_parser->chroot, - strlen(cfg_parser->chroot)) == 0) { - filename += strlen(cfg_parser->chroot); - } - input = fopen(filename, "r"); - if(!input) { - ub_c_error_msg("cannot open include file '%s': %s", - filename, strerror(errno)); - return; - } - LEXOUT(("switch_to_include_file(%s) ", filename)); - parse_stack[config_include_stack_ptr].filename = cfg_parser->filename; - parse_stack[config_include_stack_ptr].line = cfg_parser->line; - include_stack[config_include_stack_ptr] = YY_CURRENT_BUFFER; - cfg_parser->filename = strdup(filename); - cfg_parser->line = 1; - yy_switch_to_buffer(yy_create_buffer(input,YY_BUF_SIZE)); - ++config_include_stack_ptr; -} - -static void config_start_include_glob(const char* filename) -{ - - /* check for wildcards */ -#ifdef HAVE_GLOB - glob_t g; - size_t i; - int r, flags; - if(!(!strchr(filename, '*') && !strchr(filename, '?') && !strchr(filename, '[') && - !strchr(filename, '{') && !strchr(filename, '~'))) { - flags = 0 -#ifdef GLOB_ERR - | GLOB_ERR -#endif -#ifdef GLOB_NOSORT - | GLOB_NOSORT -#endif -#ifdef GLOB_BRACE - | GLOB_BRACE -#endif -#ifdef GLOB_TILDE - | GLOB_TILDE -#endif - ; - memset(&g, 0, sizeof(g)); - r = glob(filename, flags, NULL, &g); - if(r) { - /* some error */ - globfree(&g); - config_start_include(filename); /* let original deal with it */ - return; - } - /* process files found, if any */ - for(i=0; i<(size_t)g.gl_pathc; i++) { - config_start_include(g.gl_pathv[i]); - } - globfree(&g); - return; - } -#endif /* HAVE_GLOB */ - - config_start_include(filename); -} - -static void config_end_include(void) -{ - --config_include_stack_ptr; - free(cfg_parser->filename); - cfg_parser->filename = parse_stack[config_include_stack_ptr].filename; - cfg_parser->line = parse_stack[config_include_stack_ptr].line; - yy_delete_buffer(YY_CURRENT_BUFFER); - yy_switch_to_buffer(include_stack[config_include_stack_ptr]); -} - -#ifndef yy_set_bol /* compat definition, for flex 2.4.6 */ -#define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer(yyin,YY_BUF_SIZE ); \ - yy_current_buffer->yy_ch_buf[0] = ((at_bol)?'\n':' '); \ - } -#endif - -#define YY_NO_INPUT 1 -#ifndef YY_NO_UNPUT -#define YY_NO_UNPUT 1 -#endif -#ifndef YY_NO_INPUT -#define YY_NO_INPUT 1 -#endif - -#define INITIAL 0 -#define quotedstring 1 -#define singlequotedstr 2 -#define include 3 -#define include_quoted 4 -#define val 5 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -static int yy_init_globals (void ); - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int yylex_destroy (void ); - -int yyget_debug (void ); - -void yyset_debug (int debug_flag ); - -YY_EXTRA_TYPE yyget_extra (void ); - -void yyset_extra (YY_EXTRA_TYPE user_defined ); - -FILE *yyget_in (void ); - -void yyset_in (FILE * in_str ); - -FILE *yyget_out (void ); - -void yyset_out (FILE * out_str ); - -yy_size_t yyget_leng (void ); - -char *yyget_text (void ); - -int yyget_lineno (void ); - -void yyset_lineno (int line_number ); - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap (void ); -#else -extern int yywrap (void ); -#endif -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); -#endif - -#ifndef YY_NO_INPUT - -#ifdef __cplusplus -static int yyinput (void ); -#else -static int input (void ); -#endif - -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - size_t n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ - }\ -\ - -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* end tables serialization structures and prototypes */ - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int yylex (void); - -#define YY_DECL int yylex (void) -#endif /* !YY_DECL */ - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - YY_USER_ACTION - -/** The main scanner function which does all the work. - */ -YY_DECL -{ - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; - - if ( !(yy_init) ) - { - (yy_init) = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_load_buffer_state( ); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - (yy_more_len) = 0; - if ( (yy_more_flag) ) - { - (yy_more_len) = (yy_c_buf_p) - (yytext_ptr); - (yy_more_flag) = 0; - } - yy_cp = (yy_c_buf_p); - - /* Support of yytext. */ - *yy_cp = (yy_hold_char); - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = (yy_start); -yy_match: - do - { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 1343 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 2683 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; - -case 1: -YY_RULE_SETUP -{ - LEXOUT(("SP ")); /* ignore */ } - YY_BREAK -case 2: -YY_RULE_SETUP -{ - /* note that flex makes the longest match and '.' is any but not nl */ - LEXOUT(("comment(%s) ", yytext)); /* ignore */ } - YY_BREAK -case 3: -YY_RULE_SETUP -{ YDVAR(0, VAR_SERVER) } - YY_BREAK -case 4: -YY_RULE_SETUP -{ YDVAR(1, VAR_NUM_THREADS) } - YY_BREAK -case 5: -YY_RULE_SETUP -{ YDVAR(1, VAR_VERBOSITY) } - YY_BREAK -case 6: -YY_RULE_SETUP -{ YDVAR(1, VAR_PORT) } - YY_BREAK -case 7: -YY_RULE_SETUP -{ YDVAR(1, VAR_OUTGOING_RANGE) } - YY_BREAK -case 8: -YY_RULE_SETUP -{ YDVAR(1, VAR_OUTGOING_PORT_PERMIT) } - YY_BREAK -case 9: -YY_RULE_SETUP -{ YDVAR(1, VAR_OUTGOING_PORT_AVOID) } - YY_BREAK -case 10: -YY_RULE_SETUP -{ YDVAR(1, VAR_OUTGOING_NUM_TCP) } - YY_BREAK -case 11: -YY_RULE_SETUP -{ YDVAR(1, VAR_INCOMING_NUM_TCP) } - YY_BREAK -case 12: -YY_RULE_SETUP -{ YDVAR(1, VAR_DO_IP4) } - YY_BREAK -case 13: -YY_RULE_SETUP -{ YDVAR(1, VAR_DO_IP6) } - YY_BREAK -case 14: -YY_RULE_SETUP -{ YDVAR(1, VAR_DO_UDP) } - YY_BREAK -case 15: -YY_RULE_SETUP -{ YDVAR(1, VAR_DO_TCP) } - YY_BREAK -case 16: -YY_RULE_SETUP -{ YDVAR(1, VAR_TCP_UPSTREAM) } - YY_BREAK -case 17: -YY_RULE_SETUP -{ YDVAR(1, VAR_SSL_UPSTREAM) } - YY_BREAK -case 18: -YY_RULE_SETUP -{ YDVAR(1, VAR_SSL_SERVICE_KEY) } - YY_BREAK -case 19: -YY_RULE_SETUP -{ YDVAR(1, VAR_SSL_SERVICE_PEM) } - YY_BREAK -case 20: -YY_RULE_SETUP -{ YDVAR(1, VAR_SSL_PORT) } - YY_BREAK -case 21: -YY_RULE_SETUP -{ YDVAR(1, VAR_DO_DAEMONIZE) } - YY_BREAK -case 22: -YY_RULE_SETUP -{ YDVAR(1, VAR_INTERFACE) } - YY_BREAK -case 23: -YY_RULE_SETUP -{ YDVAR(1, VAR_OUTGOING_INTERFACE) } - YY_BREAK -case 24: -YY_RULE_SETUP -{ YDVAR(1, VAR_INTERFACE_AUTOMATIC) } - YY_BREAK -case 25: -YY_RULE_SETUP -{ YDVAR(1, VAR_SO_RCVBUF) } - YY_BREAK -case 26: -YY_RULE_SETUP -{ YDVAR(1, VAR_SO_SNDBUF) } - YY_BREAK -case 27: -YY_RULE_SETUP -{ YDVAR(1, VAR_CHROOT) } - YY_BREAK -case 28: -YY_RULE_SETUP -{ YDVAR(1, VAR_USERNAME) } - YY_BREAK -case 29: -YY_RULE_SETUP -{ YDVAR(1, VAR_DIRECTORY) } - YY_BREAK -case 30: -YY_RULE_SETUP -{ YDVAR(1, VAR_LOGFILE) } - YY_BREAK -case 31: -YY_RULE_SETUP -{ YDVAR(1, VAR_PIDFILE) } - YY_BREAK -case 32: -YY_RULE_SETUP -{ YDVAR(1, VAR_ROOT_HINTS) } - YY_BREAK -case 33: -YY_RULE_SETUP -{ YDVAR(1, VAR_EDNS_BUFFER_SIZE) } - YY_BREAK -case 34: -YY_RULE_SETUP -{ YDVAR(1, VAR_MSG_BUFFER_SIZE) } - YY_BREAK -case 35: -YY_RULE_SETUP -{ YDVAR(1, VAR_MSG_CACHE_SIZE) } - YY_BREAK -case 36: -YY_RULE_SETUP -{ YDVAR(1, VAR_MSG_CACHE_SLABS) } - YY_BREAK -case 37: -YY_RULE_SETUP -{ YDVAR(1, VAR_RRSET_CACHE_SIZE) } - YY_BREAK -case 38: -YY_RULE_SETUP -{ YDVAR(1, VAR_RRSET_CACHE_SLABS) } - YY_BREAK -case 39: -YY_RULE_SETUP -{ YDVAR(1, VAR_CACHE_MAX_TTL) } - YY_BREAK -case 40: -YY_RULE_SETUP -{ YDVAR(1, VAR_CACHE_MIN_TTL) } - YY_BREAK -case 41: -YY_RULE_SETUP -{ YDVAR(1, VAR_INFRA_HOST_TTL) } - YY_BREAK -case 42: -YY_RULE_SETUP -{ YDVAR(1, VAR_INFRA_LAME_TTL) } - YY_BREAK -case 43: -YY_RULE_SETUP -{ YDVAR(1, VAR_INFRA_CACHE_SLABS) } - YY_BREAK -case 44: -YY_RULE_SETUP -{ YDVAR(1, VAR_INFRA_CACHE_NUMHOSTS) } - YY_BREAK -case 45: -YY_RULE_SETUP -{ YDVAR(1, VAR_INFRA_CACHE_LAME_SIZE) } - YY_BREAK -case 46: -YY_RULE_SETUP -{ YDVAR(1, VAR_NUM_QUERIES_PER_THREAD) } - YY_BREAK -case 47: -YY_RULE_SETUP -{ YDVAR(1, VAR_JOSTLE_TIMEOUT) } - YY_BREAK -case 48: -YY_RULE_SETUP -{ YDVAR(1, VAR_TARGET_FETCH_POLICY) } - YY_BREAK -case 49: -YY_RULE_SETUP -{ YDVAR(1, VAR_HARDEN_SHORT_BUFSIZE) } - YY_BREAK -case 50: -YY_RULE_SETUP -{ YDVAR(1, VAR_HARDEN_LARGE_QUERIES) } - YY_BREAK -case 51: -YY_RULE_SETUP -{ YDVAR(1, VAR_HARDEN_GLUE) } - YY_BREAK -case 52: -YY_RULE_SETUP -{ YDVAR(1, VAR_HARDEN_DNSSEC_STRIPPED) } - YY_BREAK -case 53: -YY_RULE_SETUP -{ YDVAR(1, VAR_HARDEN_BELOW_NXDOMAIN) } - YY_BREAK -case 54: -YY_RULE_SETUP -{ YDVAR(1, VAR_HARDEN_REFERRAL_PATH) } - YY_BREAK -case 55: -YY_RULE_SETUP -{ YDVAR(1, VAR_USE_CAPS_FOR_ID) } - YY_BREAK -case 56: -YY_RULE_SETUP -{ YDVAR(1, VAR_UNWANTED_REPLY_THRESHOLD) } - YY_BREAK -case 57: -YY_RULE_SETUP -{ YDVAR(1, VAR_PRIVATE_ADDRESS) } - YY_BREAK -case 58: -YY_RULE_SETUP -{ YDVAR(1, VAR_PRIVATE_DOMAIN) } - YY_BREAK -case 59: -YY_RULE_SETUP -{ YDVAR(1, VAR_PREFETCH_KEY) } - YY_BREAK -case 60: -YY_RULE_SETUP -{ YDVAR(1, VAR_PREFETCH) } - YY_BREAK -case 61: -YY_RULE_SETUP -{ YDVAR(0, VAR_STUB_ZONE) } - YY_BREAK -case 62: -YY_RULE_SETUP -{ YDVAR(1, VAR_NAME) } - YY_BREAK -case 63: -YY_RULE_SETUP -{ YDVAR(1, VAR_STUB_ADDR) } - YY_BREAK -case 64: -YY_RULE_SETUP -{ YDVAR(1, VAR_STUB_HOST) } - YY_BREAK -case 65: -YY_RULE_SETUP -{ YDVAR(1, VAR_STUB_PRIME) } - YY_BREAK -case 66: -YY_RULE_SETUP -{ YDVAR(1, VAR_STUB_FIRST) } - YY_BREAK -case 67: -YY_RULE_SETUP -{ YDVAR(0, VAR_FORWARD_ZONE) } - YY_BREAK -case 68: -YY_RULE_SETUP -{ YDVAR(1, VAR_FORWARD_ADDR) } - YY_BREAK -case 69: -YY_RULE_SETUP -{ YDVAR(1, VAR_FORWARD_HOST) } - YY_BREAK -case 70: -YY_RULE_SETUP -{ YDVAR(1, VAR_FORWARD_FIRST) } - YY_BREAK -case 71: -YY_RULE_SETUP -{ YDVAR(1, VAR_DO_NOT_QUERY_ADDRESS) } - YY_BREAK -case 72: -YY_RULE_SETUP -{ YDVAR(1, VAR_DO_NOT_QUERY_LOCALHOST) } - YY_BREAK -case 73: -YY_RULE_SETUP -{ YDVAR(2, VAR_ACCESS_CONTROL) } - YY_BREAK -case 74: -YY_RULE_SETUP -{ YDVAR(1, VAR_HIDE_IDENTITY) } - YY_BREAK -case 75: -YY_RULE_SETUP -{ YDVAR(1, VAR_HIDE_VERSION) } - YY_BREAK -case 76: -YY_RULE_SETUP -{ YDVAR(1, VAR_IDENTITY) } - YY_BREAK -case 77: -YY_RULE_SETUP -{ YDVAR(1, VAR_VERSION) } - YY_BREAK -case 78: -YY_RULE_SETUP -{ YDVAR(1, VAR_MODULE_CONF) } - YY_BREAK -case 79: -YY_RULE_SETUP -{ YDVAR(1, VAR_DLV_ANCHOR) } - YY_BREAK -case 80: -YY_RULE_SETUP -{ YDVAR(1, VAR_DLV_ANCHOR_FILE) } - YY_BREAK -case 81: -YY_RULE_SETUP -{ YDVAR(1, VAR_TRUST_ANCHOR_FILE) } - YY_BREAK -case 82: -YY_RULE_SETUP -{ YDVAR(1, VAR_AUTO_TRUST_ANCHOR_FILE) } - YY_BREAK -case 83: -YY_RULE_SETUP -{ YDVAR(1, VAR_TRUSTED_KEYS_FILE) } - YY_BREAK -case 84: -YY_RULE_SETUP -{ YDVAR(1, VAR_TRUST_ANCHOR) } - YY_BREAK -case 85: -YY_RULE_SETUP -{ YDVAR(1, VAR_VAL_OVERRIDE_DATE) } - YY_BREAK -case 86: -YY_RULE_SETUP -{ YDVAR(1, VAR_VAL_SIG_SKEW_MIN) } - YY_BREAK -case 87: -YY_RULE_SETUP -{ YDVAR(1, VAR_VAL_SIG_SKEW_MAX) } - YY_BREAK -case 88: -YY_RULE_SETUP -{ YDVAR(1, VAR_BOGUS_TTL) } - YY_BREAK -case 89: -YY_RULE_SETUP -{ YDVAR(1, VAR_VAL_CLEAN_ADDITIONAL) } - YY_BREAK -case 90: -YY_RULE_SETUP -{ YDVAR(1, VAR_VAL_PERMISSIVE_MODE) } - YY_BREAK -case 91: -YY_RULE_SETUP -{ YDVAR(1, VAR_IGNORE_CD_FLAG) } - YY_BREAK -case 92: -YY_RULE_SETUP -{ YDVAR(1, VAR_VAL_LOG_LEVEL) } - YY_BREAK -case 93: -YY_RULE_SETUP -{ YDVAR(1, VAR_KEY_CACHE_SIZE) } - YY_BREAK -case 94: -YY_RULE_SETUP -{ YDVAR(1, VAR_KEY_CACHE_SLABS) } - YY_BREAK -case 95: -YY_RULE_SETUP -{ YDVAR(1, VAR_NEG_CACHE_SIZE) } - YY_BREAK -case 96: -YY_RULE_SETUP -{ - YDVAR(1, VAR_VAL_NSEC3_KEYSIZE_ITERATIONS) } - YY_BREAK -case 97: -YY_RULE_SETUP -{ YDVAR(1, VAR_ADD_HOLDDOWN) } - YY_BREAK -case 98: -YY_RULE_SETUP -{ YDVAR(1, VAR_DEL_HOLDDOWN) } - YY_BREAK -case 99: -YY_RULE_SETUP -{ YDVAR(1, VAR_KEEP_MISSING) } - YY_BREAK -case 100: -YY_RULE_SETUP -{ YDVAR(1, VAR_USE_SYSLOG) } - YY_BREAK -case 101: -YY_RULE_SETUP -{ YDVAR(1, VAR_LOG_TIME_ASCII) } - YY_BREAK -case 102: -YY_RULE_SETUP -{ YDVAR(1, VAR_LOG_QUERIES) } - YY_BREAK -case 103: -YY_RULE_SETUP -{ YDVAR(2, VAR_LOCAL_ZONE) } - YY_BREAK -case 104: -YY_RULE_SETUP -{ YDVAR(1, VAR_LOCAL_DATA) } - YY_BREAK -case 105: -YY_RULE_SETUP -{ YDVAR(1, VAR_LOCAL_DATA_PTR) } - YY_BREAK -case 106: -YY_RULE_SETUP -{ YDVAR(1, VAR_STATISTICS_INTERVAL) } - YY_BREAK -case 107: -YY_RULE_SETUP -{ YDVAR(1, VAR_STATISTICS_CUMULATIVE) } - YY_BREAK -case 108: -YY_RULE_SETUP -{ YDVAR(1, VAR_EXTENDED_STATISTICS) } - YY_BREAK -case 109: -YY_RULE_SETUP -{ YDVAR(0, VAR_REMOTE_CONTROL) } - YY_BREAK -case 110: -YY_RULE_SETUP -{ YDVAR(1, VAR_CONTROL_ENABLE) } - YY_BREAK -case 111: -YY_RULE_SETUP -{ YDVAR(1, VAR_CONTROL_INTERFACE) } - YY_BREAK -case 112: -YY_RULE_SETUP -{ YDVAR(1, VAR_CONTROL_PORT) } - YY_BREAK -case 113: -YY_RULE_SETUP -{ YDVAR(1, VAR_SERVER_KEY_FILE) } - YY_BREAK -case 114: -YY_RULE_SETUP -{ YDVAR(1, VAR_SERVER_CERT_FILE) } - YY_BREAK -case 115: -YY_RULE_SETUP -{ YDVAR(1, VAR_CONTROL_KEY_FILE) } - YY_BREAK -case 116: -YY_RULE_SETUP -{ YDVAR(1, VAR_CONTROL_CERT_FILE) } - YY_BREAK -case 117: -YY_RULE_SETUP -{ YDVAR(1, VAR_PYTHON_SCRIPT) } - YY_BREAK -case 118: -YY_RULE_SETUP -{ YDVAR(0, VAR_PYTHON) } - YY_BREAK -case 119: -YY_RULE_SETUP -{ YDVAR(1, VAR_DOMAIN_INSECURE) } - YY_BREAK -case 120: -YY_RULE_SETUP -{ YDVAR(1, VAR_MINIMAL_RESPONSES) } - YY_BREAK -case 121: -YY_RULE_SETUP -{ YDVAR(1, VAR_RRSET_ROUNDROBIN) } - YY_BREAK -case 122: -/* rule 122 can match eol */ -YY_RULE_SETUP -{ LEXOUT(("NL\n")); cfg_parser->line++; } - YY_BREAK -/* Quoted strings. Strip leading and ending quotes */ -case 123: -YY_RULE_SETUP -{ BEGIN(quotedstring); LEXOUT(("QS ")); } - YY_BREAK -case YY_STATE_EOF(quotedstring): -{ - yyerror("EOF inside quoted string"); - if(--num_args == 0) { BEGIN(INITIAL); } - else { BEGIN(val); } -} - YY_BREAK -case 124: -YY_RULE_SETUP -{ LEXOUT(("STR(%s) ", yytext)); yymore(); } - YY_BREAK -case 125: -/* rule 125 can match eol */ -YY_RULE_SETUP -{ yyerror("newline inside quoted string, no end \""); - cfg_parser->line++; BEGIN(INITIAL); } - YY_BREAK -case 126: -YY_RULE_SETUP -{ - LEXOUT(("QE ")); - if(--num_args == 0) { BEGIN(INITIAL); } - else { BEGIN(val); } - yytext[yyleng - 1] = '\0'; - yylval.str = strdup(yytext); - if(!yylval.str) - yyerror("out of memory"); - return STRING_ARG; -} - YY_BREAK -/* Single Quoted strings. Strip leading and ending quotes */ -case 127: -YY_RULE_SETUP -{ BEGIN(singlequotedstr); LEXOUT(("SQS ")); } - YY_BREAK -case YY_STATE_EOF(singlequotedstr): -{ - yyerror("EOF inside quoted string"); - if(--num_args == 0) { BEGIN(INITIAL); } - else { BEGIN(val); } -} - YY_BREAK -case 128: -YY_RULE_SETUP -{ LEXOUT(("STR(%s) ", yytext)); yymore(); } - YY_BREAK -case 129: -/* rule 129 can match eol */ -YY_RULE_SETUP -{ yyerror("newline inside quoted string, no end '"); - cfg_parser->line++; BEGIN(INITIAL); } - YY_BREAK -case 130: -YY_RULE_SETUP -{ - LEXOUT(("SQE ")); - if(--num_args == 0) { BEGIN(INITIAL); } - else { BEGIN(val); } - yytext[yyleng - 1] = '\0'; - yylval.str = strdup(yytext); - if(!yylval.str) - yyerror("out of memory"); - return STRING_ARG; -} - YY_BREAK -/* include: directive */ -case 131: -YY_RULE_SETUP -{ - LEXOUT(("v(%s) ", yytext)); inc_prev = YYSTATE; BEGIN(include); } - YY_BREAK -case YY_STATE_EOF(include): -{ - yyerror("EOF inside include directive"); - BEGIN(inc_prev); -} - YY_BREAK -case 132: -YY_RULE_SETUP -{ LEXOUT(("ISP ")); /* ignore */ } - YY_BREAK -case 133: -/* rule 133 can match eol */ -YY_RULE_SETUP -{ LEXOUT(("NL\n")); cfg_parser->line++;} - YY_BREAK -case 134: -YY_RULE_SETUP -{ LEXOUT(("IQS ")); BEGIN(include_quoted); } - YY_BREAK -case 135: -YY_RULE_SETUP -{ - LEXOUT(("Iunquotedstr(%s) ", yytext)); - config_start_include_glob(yytext); - BEGIN(inc_prev); -} - YY_BREAK -case YY_STATE_EOF(include_quoted): -{ - yyerror("EOF inside quoted string"); - BEGIN(inc_prev); -} - YY_BREAK -case 136: -YY_RULE_SETUP -{ LEXOUT(("ISTR(%s) ", yytext)); yymore(); } - YY_BREAK -case 137: -/* rule 137 can match eol */ -YY_RULE_SETUP -{ yyerror("newline before \" in include name"); - cfg_parser->line++; BEGIN(inc_prev); } - YY_BREAK -case 138: -YY_RULE_SETUP -{ - LEXOUT(("IQE ")); - yytext[yyleng - 1] = '\0'; - config_start_include_glob(yytext); - BEGIN(inc_prev); -} - YY_BREAK -case YY_STATE_EOF(INITIAL): -case YY_STATE_EOF(val): -{ - yy_set_bol(1); /* Set beginning of line, so "^" rules match. */ - if (config_include_stack_ptr == 0) { - yyterminate(); - } else { - fclose(yyin); - config_end_include(); - } -} - YY_BREAK -case 139: -YY_RULE_SETUP -{ LEXOUT(("unquotedstr(%s) ", yytext)); - if(--num_args == 0) { BEGIN(INITIAL); } - yylval.str = strdup(yytext); return STRING_ARG; } - YY_BREAK -case 140: -YY_RULE_SETUP -{ - ub_c_error_msg("unknown keyword '%s'", yytext); - } - YY_BREAK -case 141: -YY_RULE_SETUP -{ - ub_c_error_msg("stray '%s'", yytext); - } - YY_BREAK -case 142: -YY_RULE_SETUP -ECHO; - YY_BREAK - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( yywrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ -} /* end of yylex */ - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ -static int yy_get_next_buffer (void) -{ - char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - char *source = (yytext_ptr); - int number_to_move, i; - int ret_val; - - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - yy_size_t num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - yy_size_t new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ( (yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart(yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - } - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; -} - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - - static yy_state_type yy_get_previous_state (void) -{ - yy_state_type yy_current_state; - char *yy_cp; - - yy_current_state = (yy_start); - - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) - { - YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 1343 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; -} - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) -{ - int yy_is_jam; - char *yy_cp = (yy_c_buf_p); - - YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 1343 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 1342); - - return yy_is_jam ? 0 : yy_current_state; -} - -#ifndef YY_NO_INPUT -#ifdef __cplusplus - static int yyinput (void) -#else - static int input (void) -#endif - -{ - int c; - - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart(yyin ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap( ) ) - return EOF; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } - - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve yytext */ - (yy_hold_char) = *++(yy_c_buf_p); - - return c; -} -#endif /* ifndef YY_NO_INPUT */ - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ - void yyrestart (FILE * input_file ) -{ - - if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_init_buffer(YY_CURRENT_BUFFER,input_file ); - yy_load_buffer_state( ); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ - void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) -{ - - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); - */ - yyensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; -} - -static void yy_load_buffer_state (void) -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ - YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer(b,file ); - - return b; -} - -/** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() - * - */ - void yy_delete_buffer (YY_BUFFER_STATE b ) -{ - - if ( ! b ) - return; - - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yyfree((void *) b->yy_ch_buf ); - - yyfree((void *) b ); -} - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. - */ - static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) - -{ - int oerrno = errno; - - yy_flush_buffer(b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ - void yy_flush_buffer (YY_BUFFER_STATE b ) -{ - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) -{ - if (new_buffer == NULL) - return; - - yyensure_buffer_stack(); - - /* This block is copied from yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -void yypop_buffer_state (void) -{ - if (!YY_CURRENT_BUFFER) - return; - - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } -} - -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -static void yyensure_buffer_stack (void) -{ - yy_size_t num_to_alloc; - - if (!(yy_buffer_stack)) { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} - -/** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) -{ - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer(b ); - - return b; -} - -/** Setup the input buffer state to scan a string. The next call to yylex() will - * scan from a @e copy of @a str. - * @param yystr a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * yy_scan_bytes() instead. - */ -YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) -{ - - return yy_scan_bytes(yystr,strlen(yystr) ); -} - -/** Setup the input buffer state to scan the given bytes. The next call to yylex() will - * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - yy_size_t i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) yyalloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer(buf,n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -static void yy_fatal_error (yyconst char* msg ) -{ - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); -} - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - yytext[yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = yytext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) - -/* Accessor methods (get/set functions) to struct members. */ - -/** Get the current line number. - * - */ -int yyget_lineno (void) -{ - - return yylineno; -} - -/** Get the input stream. - * - */ -FILE *yyget_in (void) -{ - return yyin; -} - -/** Get the output stream. - * - */ -FILE *yyget_out (void) -{ - return yyout; -} - -/** Get the length of the current token. - * - */ -yy_size_t yyget_leng (void) -{ - return yyleng; -} - -/** Get the current token. - * - */ - -char *yyget_text (void) -{ - return yytext; -} - -/** Set the current line number. - * @param line_number - * - */ -void yyset_lineno (int line_number ) -{ - - yylineno = line_number; -} - -/** Set the input stream. This does not discard the current - * input buffer. - * @param in_str A readable stream. - * - * @see yy_switch_to_buffer - */ -void yyset_in (FILE * in_str ) -{ - yyin = in_str ; -} - -void yyset_out (FILE * out_str ) -{ - yyout = out_str ; -} - -int yyget_debug (void) -{ - return yy_flex_debug; -} - -void yyset_debug (int bdebug ) -{ - yy_flex_debug = bdebug ; -} - -static int yy_init_globals (void) -{ - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. - */ - - (yy_buffer_stack) = 0; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; - (yy_init) = 0; - (yy_start) = 0; - -/* Defined in main.c */ -#ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; -#else - yyin = (FILE *) 0; - yyout = (FILE *) 0; -#endif - - /* For future reference: Set errno on error, since we are called by - * yylex_init() - */ - return 0; -} - -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy (void) -{ - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); - } - - /* Destroy the stack itself. */ - yyfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * yylex() is called, initialization will occur. */ - yy_init_globals( ); - - return 0; -} - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) -{ - int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) -{ - int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; -} -#endif - -void *yyalloc (yy_size_t size ) -{ - return (void *) malloc( size ); -} - -void *yyrealloc (void * ptr, yy_size_t size ) -{ - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); -} - -void yyfree (void * ptr ) -{ - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ -} - -#define YYTABLES_NAME "yytables" - diff --git a/contrib/unbound/util/configlexer.lex b/contrib/unbound/util/configlexer.lex index 4694cdd821e..6c22609c0d9 100644 --- a/contrib/unbound/util/configlexer.lex +++ b/contrib/unbound/util/configlexer.lex @@ -8,6 +8,8 @@ * */ +#include "config.h" + #include #include #include @@ -16,7 +18,7 @@ #endif #include "util/config_file.h" -#include "util/configparser.h" +#include "configparser.h" void ub_c_error(const char *message); #if 0 @@ -26,56 +28,80 @@ void ub_c_error(const char *message); #endif /** avoid warning in about fwrite return value */ -#define ECHO ub_c_error_msg("syntax error at text: %s", yytext) +#define ECHO ub_c_error_msg("syntax error at text: %s", ub_c_text) /** A parser variable, this is a statement in the config file which is * of the form variable: value1 value2 ... nargs is the number of values. */ #define YDVAR(nargs, var) \ num_args=(nargs); \ - LEXOUT(("v(%s%d) ", yytext, num_args)); \ + LEXOUT(("v(%s%d) ", ub_c_text, num_args)); \ if(num_args > 0) { BEGIN(val); } \ return (var); struct inc_state { char* filename; int line; + YY_BUFFER_STATE buffer; + struct inc_state* next; }; -static struct inc_state parse_stack[MAXINCLUDES]; -static YY_BUFFER_STATE include_stack[MAXINCLUDES]; -static int config_include_stack_ptr = 0; +static struct inc_state* config_include_stack = NULL; +static int inc_depth = 0; static int inc_prev = 0; static int num_args = 0; +void init_cfg_parse(void) +{ + config_include_stack = NULL; + inc_depth = 0; + inc_prev = 0; + num_args = 0; +} static void config_start_include(const char* filename) { FILE *input; + struct inc_state* s; + char* nm; + if(inc_depth++ > 100000) { + ub_c_error_msg("too many include files"); + return; + } if(strlen(filename) == 0) { ub_c_error_msg("empty include file name"); return; } - if(config_include_stack_ptr >= MAXINCLUDES) { - ub_c_error_msg("includes nested too deeply, skipped (>%d)", MAXINCLUDES); + s = (struct inc_state*)malloc(sizeof(*s)); + if(!s) { + ub_c_error_msg("include %s: malloc failure", filename); return; } if(cfg_parser->chroot && strncmp(filename, cfg_parser->chroot, strlen(cfg_parser->chroot)) == 0) { filename += strlen(cfg_parser->chroot); } + nm = strdup(filename); + if(!nm) { + ub_c_error_msg("include %s: strdup failure", filename); + free(s); + return; + } input = fopen(filename, "r"); if(!input) { ub_c_error_msg("cannot open include file '%s': %s", filename, strerror(errno)); + free(s); + free(nm); return; } - LEXOUT(("switch_to_include_file(%s) ", filename)); - parse_stack[config_include_stack_ptr].filename = cfg_parser->filename; - parse_stack[config_include_stack_ptr].line = cfg_parser->line; - include_stack[config_include_stack_ptr] = YY_CURRENT_BUFFER; - cfg_parser->filename = strdup(filename); + LEXOUT(("switch_to_include_file(%s)\n", filename)); + s->filename = cfg_parser->filename; + s->line = cfg_parser->line; + s->buffer = YY_CURRENT_BUFFER; + s->next = config_include_stack; + config_include_stack = s; + cfg_parser->filename = nm; cfg_parser->line = 1; yy_switch_to_buffer(yy_create_buffer(input, YY_BUF_SIZE)); - ++config_include_stack_ptr; } static void config_start_include_glob(const char* filename) @@ -107,6 +133,8 @@ static void config_start_include_glob(const char* filename) if(r) { /* some error */ globfree(&g); + if(r == GLOB_NOMATCH) + return; /* no matches for pattern */ config_start_include(filename); /* let original deal with it */ return; } @@ -124,19 +152,23 @@ static void config_start_include_glob(const char* filename) static void config_end_include(void) { - --config_include_stack_ptr; + struct inc_state* s = config_include_stack; + --inc_depth; + if(!s) return; free(cfg_parser->filename); - cfg_parser->filename = parse_stack[config_include_stack_ptr].filename; - cfg_parser->line = parse_stack[config_include_stack_ptr].line; + cfg_parser->filename = s->filename; + cfg_parser->line = s->line; yy_delete_buffer(YY_CURRENT_BUFFER); - yy_switch_to_buffer(include_stack[config_include_stack_ptr]); + yy_switch_to_buffer(s->buffer); + config_include_stack = s->next; + free(s); } #ifndef yy_set_bol /* compat definition, for flex 2.4.6 */ #define yy_set_bol(at_bol) \ { \ if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer = yy_create_buffer( ub_c_in, YY_BUF_SIZE ); \ yy_current_buffer->yy_ch_buf[0] = ((at_bol)?'\n':' '); \ } #endif @@ -170,7 +202,7 @@ SQANY [^\'\n\r\\]|\\. LEXOUT(("SP ")); /* ignore */ } {SPACE}*{COMMENT}.* { /* note that flex makes the longest match and '.' is any but not nl */ - LEXOUT(("comment(%s) ", yytext)); /* ignore */ } + LEXOUT(("comment(%s) ", ub_c_text)); /* ignore */ } server{COLON} { YDVAR(0, VAR_SERVER) } num-threads{COLON} { YDVAR(1, VAR_NUM_THREADS) } verbosity{COLON} { YDVAR(1, VAR_VERBOSITY) } @@ -191,10 +223,12 @@ ssl-service-pem{COLON} { YDVAR(1, VAR_SSL_SERVICE_PEM) } ssl-port{COLON} { YDVAR(1, VAR_SSL_PORT) } do-daemonize{COLON} { YDVAR(1, VAR_DO_DAEMONIZE) } interface{COLON} { YDVAR(1, VAR_INTERFACE) } +ip-address{COLON} { YDVAR(1, VAR_INTERFACE) } outgoing-interface{COLON} { YDVAR(1, VAR_OUTGOING_INTERFACE) } interface-automatic{COLON} { YDVAR(1, VAR_INTERFACE_AUTOMATIC) } so-rcvbuf{COLON} { YDVAR(1, VAR_SO_RCVBUF) } so-sndbuf{COLON} { YDVAR(1, VAR_SO_SNDBUF) } +so-reuseport{COLON} { YDVAR(1, VAR_SO_REUSEPORT) } chroot{COLON} { YDVAR(1, VAR_CHROOT) } username{COLON} { YDVAR(1, VAR_USERNAME) } directory{COLON} { YDVAR(1, VAR_DIRECTORY) } @@ -216,6 +250,7 @@ infra-cache-numhosts{COLON} { YDVAR(1, VAR_INFRA_CACHE_NUMHOSTS) } infra-cache-lame-size{COLON} { YDVAR(1, VAR_INFRA_CACHE_LAME_SIZE) } num-queries-per-thread{COLON} { YDVAR(1, VAR_NUM_QUERIES_PER_THREAD) } jostle-timeout{COLON} { YDVAR(1, VAR_JOSTLE_TIMEOUT) } +delay-close{COLON} { YDVAR(1, VAR_DELAY_CLOSE) } target-fetch-policy{COLON} { YDVAR(1, VAR_TARGET_FETCH_POLICY) } harden-short-bufsize{COLON} { YDVAR(1, VAR_HARDEN_SHORT_BUFSIZE) } harden-large-queries{COLON} { YDVAR(1, VAR_HARDEN_LARGE_QUERIES) } @@ -275,6 +310,7 @@ log-queries{COLON} { YDVAR(1, VAR_LOG_QUERIES) } local-zone{COLON} { YDVAR(2, VAR_LOCAL_ZONE) } local-data{COLON} { YDVAR(1, VAR_LOCAL_DATA) } local-data-ptr{COLON} { YDVAR(1, VAR_LOCAL_DATA_PTR) } +unblock-lan-zones{COLON} { YDVAR(1, VAR_UNBLOCK_LAN_ZONES) } statistics-interval{COLON} { YDVAR(1, VAR_STATISTICS_INTERVAL) } statistics-cumulative{COLON} { YDVAR(1, VAR_STATISTICS_CUMULATIVE) } extended-statistics{COLON} { YDVAR(1, VAR_EXTENDED_STATISTICS) } @@ -291,98 +327,100 @@ python{COLON} { YDVAR(0, VAR_PYTHON) } domain-insecure{COLON} { YDVAR(1, VAR_DOMAIN_INSECURE) } minimal-responses{COLON} { YDVAR(1, VAR_MINIMAL_RESPONSES) } rrset-roundrobin{COLON} { YDVAR(1, VAR_RRSET_ROUNDROBIN) } +max-udp-size{COLON} { YDVAR(1, VAR_MAX_UDP_SIZE) } {NEWLINE} { LEXOUT(("NL\n")); cfg_parser->line++; } /* Quoted strings. Strip leading and ending quotes */ \" { BEGIN(quotedstring); LEXOUT(("QS ")); } <> { - yyerror("EOF inside quoted string"); + ub_c_error("EOF inside quoted string"); if(--num_args == 0) { BEGIN(INITIAL); } else { BEGIN(val); } } -{DQANY}* { LEXOUT(("STR(%s) ", yytext)); yymore(); } -{NEWLINE} { yyerror("newline inside quoted string, no end \""); +{DQANY}* { LEXOUT(("STR(%s) ", ub_c_text)); yymore(); } +{NEWLINE} { ub_c_error("newline inside quoted string, no end \""); cfg_parser->line++; BEGIN(INITIAL); } \" { LEXOUT(("QE ")); if(--num_args == 0) { BEGIN(INITIAL); } else { BEGIN(val); } - yytext[yyleng - 1] = '\0'; - yylval.str = strdup(yytext); - if(!yylval.str) - yyerror("out of memory"); + ub_c_text[ub_c_leng - 1] = '\0'; + ub_c_lval.str = strdup(ub_c_text); + if(!ub_c_lval.str) + ub_c_error("out of memory"); return STRING_ARG; } /* Single Quoted strings. Strip leading and ending quotes */ \' { BEGIN(singlequotedstr); LEXOUT(("SQS ")); } <> { - yyerror("EOF inside quoted string"); + ub_c_error("EOF inside quoted string"); if(--num_args == 0) { BEGIN(INITIAL); } else { BEGIN(val); } } -{SQANY}* { LEXOUT(("STR(%s) ", yytext)); yymore(); } -{NEWLINE} { yyerror("newline inside quoted string, no end '"); +{SQANY}* { LEXOUT(("STR(%s) ", ub_c_text)); yymore(); } +{NEWLINE} { ub_c_error("newline inside quoted string, no end '"); cfg_parser->line++; BEGIN(INITIAL); } \' { LEXOUT(("SQE ")); if(--num_args == 0) { BEGIN(INITIAL); } else { BEGIN(val); } - yytext[yyleng - 1] = '\0'; - yylval.str = strdup(yytext); - if(!yylval.str) - yyerror("out of memory"); + ub_c_text[ub_c_leng - 1] = '\0'; + ub_c_lval.str = strdup(ub_c_text); + if(!ub_c_lval.str) + ub_c_error("out of memory"); return STRING_ARG; } /* include: directive */ include{COLON} { - LEXOUT(("v(%s) ", yytext)); inc_prev = YYSTATE; BEGIN(include); } + LEXOUT(("v(%s) ", ub_c_text)); inc_prev = YYSTATE; BEGIN(include); } <> { - yyerror("EOF inside include directive"); + ub_c_error("EOF inside include directive"); BEGIN(inc_prev); } {SPACE}* { LEXOUT(("ISP ")); /* ignore */ } {NEWLINE} { LEXOUT(("NL\n")); cfg_parser->line++;} \" { LEXOUT(("IQS ")); BEGIN(include_quoted); } {UNQUOTEDLETTER}* { - LEXOUT(("Iunquotedstr(%s) ", yytext)); - config_start_include_glob(yytext); + LEXOUT(("Iunquotedstr(%s) ", ub_c_text)); + config_start_include_glob(ub_c_text); BEGIN(inc_prev); } <> { - yyerror("EOF inside quoted string"); + ub_c_error("EOF inside quoted string"); BEGIN(inc_prev); } -{DQANY}* { LEXOUT(("ISTR(%s) ", yytext)); yymore(); } -{NEWLINE} { yyerror("newline before \" in include name"); +{DQANY}* { LEXOUT(("ISTR(%s) ", ub_c_text)); yymore(); } +{NEWLINE} { ub_c_error("newline before \" in include name"); cfg_parser->line++; BEGIN(inc_prev); } \" { LEXOUT(("IQE ")); - yytext[yyleng - 1] = '\0'; - config_start_include_glob(yytext); + ub_c_text[ub_c_leng - 1] = '\0'; + config_start_include_glob(ub_c_text); BEGIN(inc_prev); } <> { + LEXOUT(("LEXEOF ")); yy_set_bol(1); /* Set beginning of line, so "^" rules match. */ - if (config_include_stack_ptr == 0) { + if (!config_include_stack) { yyterminate(); } else { - fclose(yyin); + fclose(ub_c_in); config_end_include(); } } -{UNQUOTEDLETTER}* { LEXOUT(("unquotedstr(%s) ", yytext)); +{UNQUOTEDLETTER}* { LEXOUT(("unquotedstr(%s) ", ub_c_text)); if(--num_args == 0) { BEGIN(INITIAL); } - yylval.str = strdup(yytext); return STRING_ARG; } + ub_c_lval.str = strdup(ub_c_text); return STRING_ARG; } {UNQUOTEDLETTER_NOCOLON}* { - ub_c_error_msg("unknown keyword '%s'", yytext); + ub_c_error_msg("unknown keyword '%s'", ub_c_text); } <*>. { - ub_c_error_msg("stray '%s'", yytext); + ub_c_error_msg("stray '%s'", ub_c_text); } %% diff --git a/contrib/unbound/util/configparser.c b/contrib/unbound/util/configparser.c deleted file mode 100644 index 1f89d57f2bd..00000000000 --- a/contrib/unbound/util/configparser.c +++ /dev/null @@ -1,2330 +0,0 @@ -#ifndef lint -static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; -#endif - -#define YYBYACC 1 -#define YYMAJOR 1 -#define YYMINOR 9 - -#define YYEMPTY (-1) -#define yyclearin (yychar = YYEMPTY) -#define yyerrok (yyerrflag = 0) -#define YYRECOVERING() (yyerrflag != 0) - -#define YYPREFIX "yy" - -#define YYPURE 0 - -#line 39 "util/configparser.y" -#include "config.h" - -#include -#include -#include -#include -#include - -#include "util/configyyrename.h" -#include "util/config_file.h" -#include "util/net_help.h" - -int ub_c_lex(void); -void ub_c_error(const char *message); - -/* these need to be global, otherwise they cannot be used inside yacc */ -extern struct config_parser_state* cfg_parser; - -#if 0 -#define OUTYY(s) printf s /* used ONLY when debugging */ -#else -#define OUTYY(s) -#endif - -#line 64 "util/configparser.y" -#ifdef YYSTYPE -#undef YYSTYPE_IS_DECLARED -#define YYSTYPE_IS_DECLARED 1 -#endif -#ifndef YYSTYPE_IS_DECLARED -#define YYSTYPE_IS_DECLARED 1 -typedef union { - char* str; -} YYSTYPE; -#endif /* !YYSTYPE_IS_DECLARED */ -#line 54 "util/configparser.c" - -/* compatibility with bison */ -#ifdef YYPARSE_PARAM -/* compatibility with FreeBSD */ -# ifdef YYPARSE_PARAM_TYPE -# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) -# else -# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) -# endif -#else -# define YYPARSE_DECL() yyparse(void) -#endif - -/* Parameters sent to lex. */ -#ifdef YYLEX_PARAM -# define YYLEX_DECL() yylex(void *YYLEX_PARAM) -# define YYLEX yylex(YYLEX_PARAM) -#else -# define YYLEX_DECL() yylex(void) -# define YYLEX yylex() -#endif - -/* Parameters sent to yyerror. */ -#ifndef YYERROR_DECL -#define YYERROR_DECL() yyerror(const char *s) -#endif -#ifndef YYERROR_CALL -#define YYERROR_CALL(msg) yyerror(msg) -#endif - -extern int YYPARSE_DECL(); - -#define SPACE 257 -#define LETTER 258 -#define NEWLINE 259 -#define COMMENT 260 -#define COLON 261 -#define ANY 262 -#define ZONESTR 263 -#define STRING_ARG 264 -#define VAR_SERVER 265 -#define VAR_VERBOSITY 266 -#define VAR_NUM_THREADS 267 -#define VAR_PORT 268 -#define VAR_OUTGOING_RANGE 269 -#define VAR_INTERFACE 270 -#define VAR_DO_IP4 271 -#define VAR_DO_IP6 272 -#define VAR_DO_UDP 273 -#define VAR_DO_TCP 274 -#define VAR_CHROOT 275 -#define VAR_USERNAME 276 -#define VAR_DIRECTORY 277 -#define VAR_LOGFILE 278 -#define VAR_PIDFILE 279 -#define VAR_MSG_CACHE_SIZE 280 -#define VAR_MSG_CACHE_SLABS 281 -#define VAR_NUM_QUERIES_PER_THREAD 282 -#define VAR_RRSET_CACHE_SIZE 283 -#define VAR_RRSET_CACHE_SLABS 284 -#define VAR_OUTGOING_NUM_TCP 285 -#define VAR_INFRA_HOST_TTL 286 -#define VAR_INFRA_LAME_TTL 287 -#define VAR_INFRA_CACHE_SLABS 288 -#define VAR_INFRA_CACHE_NUMHOSTS 289 -#define VAR_INFRA_CACHE_LAME_SIZE 290 -#define VAR_NAME 291 -#define VAR_STUB_ZONE 292 -#define VAR_STUB_HOST 293 -#define VAR_STUB_ADDR 294 -#define VAR_TARGET_FETCH_POLICY 295 -#define VAR_HARDEN_SHORT_BUFSIZE 296 -#define VAR_HARDEN_LARGE_QUERIES 297 -#define VAR_FORWARD_ZONE 298 -#define VAR_FORWARD_HOST 299 -#define VAR_FORWARD_ADDR 300 -#define VAR_DO_NOT_QUERY_ADDRESS 301 -#define VAR_HIDE_IDENTITY 302 -#define VAR_HIDE_VERSION 303 -#define VAR_IDENTITY 304 -#define VAR_VERSION 305 -#define VAR_HARDEN_GLUE 306 -#define VAR_MODULE_CONF 307 -#define VAR_TRUST_ANCHOR_FILE 308 -#define VAR_TRUST_ANCHOR 309 -#define VAR_VAL_OVERRIDE_DATE 310 -#define VAR_BOGUS_TTL 311 -#define VAR_VAL_CLEAN_ADDITIONAL 312 -#define VAR_VAL_PERMISSIVE_MODE 313 -#define VAR_INCOMING_NUM_TCP 314 -#define VAR_MSG_BUFFER_SIZE 315 -#define VAR_KEY_CACHE_SIZE 316 -#define VAR_KEY_CACHE_SLABS 317 -#define VAR_TRUSTED_KEYS_FILE 318 -#define VAR_VAL_NSEC3_KEYSIZE_ITERATIONS 319 -#define VAR_USE_SYSLOG 320 -#define VAR_OUTGOING_INTERFACE 321 -#define VAR_ROOT_HINTS 322 -#define VAR_DO_NOT_QUERY_LOCALHOST 323 -#define VAR_CACHE_MAX_TTL 324 -#define VAR_HARDEN_DNSSEC_STRIPPED 325 -#define VAR_ACCESS_CONTROL 326 -#define VAR_LOCAL_ZONE 327 -#define VAR_LOCAL_DATA 328 -#define VAR_INTERFACE_AUTOMATIC 329 -#define VAR_STATISTICS_INTERVAL 330 -#define VAR_DO_DAEMONIZE 331 -#define VAR_USE_CAPS_FOR_ID 332 -#define VAR_STATISTICS_CUMULATIVE 333 -#define VAR_OUTGOING_PORT_PERMIT 334 -#define VAR_OUTGOING_PORT_AVOID 335 -#define VAR_DLV_ANCHOR_FILE 336 -#define VAR_DLV_ANCHOR 337 -#define VAR_NEG_CACHE_SIZE 338 -#define VAR_HARDEN_REFERRAL_PATH 339 -#define VAR_PRIVATE_ADDRESS 340 -#define VAR_PRIVATE_DOMAIN 341 -#define VAR_REMOTE_CONTROL 342 -#define VAR_CONTROL_ENABLE 343 -#define VAR_CONTROL_INTERFACE 344 -#define VAR_CONTROL_PORT 345 -#define VAR_SERVER_KEY_FILE 346 -#define VAR_SERVER_CERT_FILE 347 -#define VAR_CONTROL_KEY_FILE 348 -#define VAR_CONTROL_CERT_FILE 349 -#define VAR_EXTENDED_STATISTICS 350 -#define VAR_LOCAL_DATA_PTR 351 -#define VAR_JOSTLE_TIMEOUT 352 -#define VAR_STUB_PRIME 353 -#define VAR_UNWANTED_REPLY_THRESHOLD 354 -#define VAR_LOG_TIME_ASCII 355 -#define VAR_DOMAIN_INSECURE 356 -#define VAR_PYTHON 357 -#define VAR_PYTHON_SCRIPT 358 -#define VAR_VAL_SIG_SKEW_MIN 359 -#define VAR_VAL_SIG_SKEW_MAX 360 -#define VAR_CACHE_MIN_TTL 361 -#define VAR_VAL_LOG_LEVEL 362 -#define VAR_AUTO_TRUST_ANCHOR_FILE 363 -#define VAR_KEEP_MISSING 364 -#define VAR_ADD_HOLDDOWN 365 -#define VAR_DEL_HOLDDOWN 366 -#define VAR_SO_RCVBUF 367 -#define VAR_EDNS_BUFFER_SIZE 368 -#define VAR_PREFETCH 369 -#define VAR_PREFETCH_KEY 370 -#define VAR_SO_SNDBUF 371 -#define VAR_HARDEN_BELOW_NXDOMAIN 372 -#define VAR_IGNORE_CD_FLAG 373 -#define VAR_LOG_QUERIES 374 -#define VAR_TCP_UPSTREAM 375 -#define VAR_SSL_UPSTREAM 376 -#define VAR_SSL_SERVICE_KEY 377 -#define VAR_SSL_SERVICE_PEM 378 -#define VAR_SSL_PORT 379 -#define VAR_FORWARD_FIRST 380 -#define VAR_STUB_FIRST 381 -#define VAR_MINIMAL_RESPONSES 382 -#define VAR_RRSET_ROUNDROBIN 383 -#define YYERRCODE 256 -static const short yylhs[] = { -1, - 0, 0, 1, 1, 1, 1, 1, 2, 3, 3, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 4, 5, - 5, 111, 111, 111, 111, 111, 6, 7, 7, 117, - 117, 117, 117, 13, 14, 70, 73, 82, 15, 21, - 61, 16, 74, 75, 32, 54, 69, 17, 18, 19, - 20, 104, 105, 106, 107, 108, 71, 60, 86, 103, - 22, 23, 24, 25, 26, 62, 76, 77, 92, 48, - 58, 49, 87, 42, 43, 44, 45, 96, 100, 97, - 55, 27, 28, 29, 84, 30, 31, 33, 34, 36, - 37, 35, 38, 39, 40, 46, 65, 101, 79, 72, - 80, 81, 98, 99, 85, 41, 63, 66, 47, 50, - 88, 89, 64, 90, 51, 52, 53, 102, 91, 59, - 93, 94, 95, 56, 57, 78, 67, 68, 83, 109, - 110, 112, 113, 114, 116, 115, 118, 119, 120, 121, - 10, 11, 11, 122, 122, 122, 122, 122, 122, 122, - 123, 125, 124, 126, 127, 128, 129, 8, 9, 9, - 130, 131, -}; -static const short yylen[] = { 2, - 0, 2, 2, 2, 2, 2, 2, 1, 2, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, - 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, - 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, 2, 1, 2, 0, - 1, 2, -}; -static const short yydefred[] = { 1, - 0, 8, 109, 117, 231, 248, 2, 10, 111, 119, - 250, 233, 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, 9, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 0, 0, 0, 0, 0, 110, - 112, 113, 114, 115, 116, 0, 0, 0, 0, 118, - 120, 121, 122, 123, 0, 249, 251, 0, 0, 0, - 0, 0, 0, 0, 232, 234, 235, 236, 237, 238, - 239, 240, 125, 124, 129, 132, 130, 138, 139, 140, - 141, 151, 152, 153, 154, 155, 172, 173, 174, 176, - 177, 135, 178, 179, 182, 180, 181, 183, 184, 185, - 196, 164, 165, 166, 167, 186, 199, 160, 162, 200, - 205, 206, 207, 136, 171, 214, 215, 161, 210, 148, - 131, 156, 197, 203, 187, 0, 0, 218, 137, 126, - 147, 190, 127, 133, 134, 157, 158, 216, 189, 191, - 192, 128, 219, 175, 195, 149, 163, 201, 202, 204, - 209, 159, 213, 211, 212, 168, 170, 193, 194, 169, - 188, 208, 150, 142, 143, 144, 145, 146, 220, 221, - 222, 223, 224, 226, 225, 227, 228, 229, 230, 252, - 241, 243, 242, 244, 245, 246, 247, 198, 217, -}; -static const short yydgoto[] = { 1, - 7, 8, 13, 9, 14, 10, 15, 11, 16, 12, - 17, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 220, 221, 222, 223, 224, 225, 230, 231, 232, 233, - 234, 245, 246, 247, 248, 249, 250, 251, 252, 236, - 237, -}; -static const short yysindex[] = { 0, - -172, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, -260, -209, -202, -358, -216, -233, -232, -231, - -230, -226, -225, -224, -181, -178, -177, -176, -143, -140, - -139, -130, -129, -128, -127, -126, -125, -124, -123, -122, - -121, -119, -118, -117, -116, -115, -114, -113, -112, -111, - -110, -109, -108, -107, -106, -105, -104, -103, -102, -101, - -100, -99, -98, -97, -96, -95, -93, -91, -90, -89, - -88, -87, -85, -84, -83, -82, -81, -80, -78, -77, - -76, -75, -74, -73, -72, -71, -70, -69, -68, -67, - -66, -65, -64, -63, -62, -61, -60, -59, -58, -57, - -56, -55, -54, -53, -52, -51, -50, -49, -48, -47, - -46, -45, -44, -43, -42, 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, -41, -40, -39, -38, -37, 0, - 0, 0, 0, 0, 0, -36, -35, -34, -33, 0, - 0, 0, 0, 0, -32, 0, 0, -31, -30, -29, - -28, -27, -26, -25, 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, -24, -23, 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, -}; -static const short yyrindex[] = { 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 2, 3, 4, 5, 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, 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, -}; -static const short yygindex[] = { 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, -}; -#define YYTABLESIZE 362 -static const short yytable[] = { 235, - 3, 4, 5, 6, 7, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 253, 254, 255, 256, 43, 44, 45, 257, 258, 259, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 215, 260, 216, 217, 261, 262, 263, 226, 87, - 88, 89, 2, 90, 91, 92, 227, 228, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 3, - 264, 114, 115, 265, 266, 4, 238, 239, 240, 241, - 242, 243, 244, 267, 268, 269, 270, 271, 272, 273, - 274, 275, 276, 218, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 5, - 302, 219, 303, 304, 305, 306, 307, 229, 308, 309, - 310, 311, 312, 313, 6, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, - 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, - 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, - 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, - 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, - 369, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 3, 4, 5, 6, 7, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 4, 5, 6, 7, 0, 3, 4, - 5, 6, 7, 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, 3, 4, 5, 6, 7, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 3, 4, 5, - 6, 7, -}; -static const short yycheck[] = { 358, - 0, 0, 0, 0, 0, 266, 267, 268, 269, 270, - 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, - 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, - 264, 264, 264, 264, 295, 296, 297, 264, 264, 264, - 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, - 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, - 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, - 341, 291, 264, 293, 294, 264, 264, 264, 291, 350, - 351, 352, 265, 354, 355, 356, 299, 300, 359, 360, - 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, - 371, 372, 373, 374, 375, 376, 377, 378, 379, 292, - 264, 382, 383, 264, 264, 298, 343, 344, 345, 346, - 347, 348, 349, 264, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 353, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 342, - 264, 381, 264, 264, 264, 264, 264, 380, 264, 264, - 264, 264, 264, 264, 357, 264, 264, 264, 264, 264, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 265, 265, 265, 265, 265, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 292, 292, 292, 292, 292, -1, 298, 298, - 298, 298, 298, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 342, 342, 342, 342, 342, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 357, 357, 357, - 357, 357, -}; -#define YYFINAL 1 -#ifndef YYDEBUG -#define YYDEBUG 0 -#endif -#define YYMAXTOKEN 383 -#if YYDEBUG -static const char *yyname[] = { - -"end-of-file",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,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,"SPACE","LETTER","NEWLINE", -"COMMENT","COLON","ANY","ZONESTR","STRING_ARG","VAR_SERVER","VAR_VERBOSITY", -"VAR_NUM_THREADS","VAR_PORT","VAR_OUTGOING_RANGE","VAR_INTERFACE","VAR_DO_IP4", -"VAR_DO_IP6","VAR_DO_UDP","VAR_DO_TCP","VAR_CHROOT","VAR_USERNAME", -"VAR_DIRECTORY","VAR_LOGFILE","VAR_PIDFILE","VAR_MSG_CACHE_SIZE", -"VAR_MSG_CACHE_SLABS","VAR_NUM_QUERIES_PER_THREAD","VAR_RRSET_CACHE_SIZE", -"VAR_RRSET_CACHE_SLABS","VAR_OUTGOING_NUM_TCP","VAR_INFRA_HOST_TTL", -"VAR_INFRA_LAME_TTL","VAR_INFRA_CACHE_SLABS","VAR_INFRA_CACHE_NUMHOSTS", -"VAR_INFRA_CACHE_LAME_SIZE","VAR_NAME","VAR_STUB_ZONE","VAR_STUB_HOST", -"VAR_STUB_ADDR","VAR_TARGET_FETCH_POLICY","VAR_HARDEN_SHORT_BUFSIZE", -"VAR_HARDEN_LARGE_QUERIES","VAR_FORWARD_ZONE","VAR_FORWARD_HOST", -"VAR_FORWARD_ADDR","VAR_DO_NOT_QUERY_ADDRESS","VAR_HIDE_IDENTITY", -"VAR_HIDE_VERSION","VAR_IDENTITY","VAR_VERSION","VAR_HARDEN_GLUE", -"VAR_MODULE_CONF","VAR_TRUST_ANCHOR_FILE","VAR_TRUST_ANCHOR", -"VAR_VAL_OVERRIDE_DATE","VAR_BOGUS_TTL","VAR_VAL_CLEAN_ADDITIONAL", -"VAR_VAL_PERMISSIVE_MODE","VAR_INCOMING_NUM_TCP","VAR_MSG_BUFFER_SIZE", -"VAR_KEY_CACHE_SIZE","VAR_KEY_CACHE_SLABS","VAR_TRUSTED_KEYS_FILE", -"VAR_VAL_NSEC3_KEYSIZE_ITERATIONS","VAR_USE_SYSLOG","VAR_OUTGOING_INTERFACE", -"VAR_ROOT_HINTS","VAR_DO_NOT_QUERY_LOCALHOST","VAR_CACHE_MAX_TTL", -"VAR_HARDEN_DNSSEC_STRIPPED","VAR_ACCESS_CONTROL","VAR_LOCAL_ZONE", -"VAR_LOCAL_DATA","VAR_INTERFACE_AUTOMATIC","VAR_STATISTICS_INTERVAL", -"VAR_DO_DAEMONIZE","VAR_USE_CAPS_FOR_ID","VAR_STATISTICS_CUMULATIVE", -"VAR_OUTGOING_PORT_PERMIT","VAR_OUTGOING_PORT_AVOID","VAR_DLV_ANCHOR_FILE", -"VAR_DLV_ANCHOR","VAR_NEG_CACHE_SIZE","VAR_HARDEN_REFERRAL_PATH", -"VAR_PRIVATE_ADDRESS","VAR_PRIVATE_DOMAIN","VAR_REMOTE_CONTROL", -"VAR_CONTROL_ENABLE","VAR_CONTROL_INTERFACE","VAR_CONTROL_PORT", -"VAR_SERVER_KEY_FILE","VAR_SERVER_CERT_FILE","VAR_CONTROL_KEY_FILE", -"VAR_CONTROL_CERT_FILE","VAR_EXTENDED_STATISTICS","VAR_LOCAL_DATA_PTR", -"VAR_JOSTLE_TIMEOUT","VAR_STUB_PRIME","VAR_UNWANTED_REPLY_THRESHOLD", -"VAR_LOG_TIME_ASCII","VAR_DOMAIN_INSECURE","VAR_PYTHON","VAR_PYTHON_SCRIPT", -"VAR_VAL_SIG_SKEW_MIN","VAR_VAL_SIG_SKEW_MAX","VAR_CACHE_MIN_TTL", -"VAR_VAL_LOG_LEVEL","VAR_AUTO_TRUST_ANCHOR_FILE","VAR_KEEP_MISSING", -"VAR_ADD_HOLDDOWN","VAR_DEL_HOLDDOWN","VAR_SO_RCVBUF","VAR_EDNS_BUFFER_SIZE", -"VAR_PREFETCH","VAR_PREFETCH_KEY","VAR_SO_SNDBUF","VAR_HARDEN_BELOW_NXDOMAIN", -"VAR_IGNORE_CD_FLAG","VAR_LOG_QUERIES","VAR_TCP_UPSTREAM","VAR_SSL_UPSTREAM", -"VAR_SSL_SERVICE_KEY","VAR_SSL_SERVICE_PEM","VAR_SSL_PORT","VAR_FORWARD_FIRST", -"VAR_STUB_FIRST","VAR_MINIMAL_RESPONSES","VAR_RRSET_ROUNDROBIN", -}; -static const char *yyrule[] = { -"$accept : toplevelvars", -"toplevelvars :", -"toplevelvars : toplevelvars toplevelvar", -"toplevelvar : serverstart contents_server", -"toplevelvar : stubstart contents_stub", -"toplevelvar : forwardstart contents_forward", -"toplevelvar : pythonstart contents_py", -"toplevelvar : rcstart contents_rc", -"serverstart : VAR_SERVER", -"contents_server : contents_server content_server", -"contents_server :", -"content_server : server_num_threads", -"content_server : server_verbosity", -"content_server : server_port", -"content_server : server_outgoing_range", -"content_server : server_do_ip4", -"content_server : server_do_ip6", -"content_server : server_do_udp", -"content_server : server_do_tcp", -"content_server : server_interface", -"content_server : server_chroot", -"content_server : server_username", -"content_server : server_directory", -"content_server : server_logfile", -"content_server : server_pidfile", -"content_server : server_msg_cache_size", -"content_server : server_msg_cache_slabs", -"content_server : server_num_queries_per_thread", -"content_server : server_rrset_cache_size", -"content_server : server_rrset_cache_slabs", -"content_server : server_outgoing_num_tcp", -"content_server : server_infra_host_ttl", -"content_server : server_infra_lame_ttl", -"content_server : server_infra_cache_slabs", -"content_server : server_infra_cache_numhosts", -"content_server : server_infra_cache_lame_size", -"content_server : server_target_fetch_policy", -"content_server : server_harden_short_bufsize", -"content_server : server_harden_large_queries", -"content_server : server_do_not_query_address", -"content_server : server_hide_identity", -"content_server : server_hide_version", -"content_server : server_identity", -"content_server : server_version", -"content_server : server_harden_glue", -"content_server : server_module_conf", -"content_server : server_trust_anchor_file", -"content_server : server_trust_anchor", -"content_server : server_val_override_date", -"content_server : server_bogus_ttl", -"content_server : server_val_clean_additional", -"content_server : server_val_permissive_mode", -"content_server : server_incoming_num_tcp", -"content_server : server_msg_buffer_size", -"content_server : server_key_cache_size", -"content_server : server_key_cache_slabs", -"content_server : server_trusted_keys_file", -"content_server : server_val_nsec3_keysize_iterations", -"content_server : server_use_syslog", -"content_server : server_outgoing_interface", -"content_server : server_root_hints", -"content_server : server_do_not_query_localhost", -"content_server : server_cache_max_ttl", -"content_server : server_harden_dnssec_stripped", -"content_server : server_access_control", -"content_server : server_local_zone", -"content_server : server_local_data", -"content_server : server_interface_automatic", -"content_server : server_statistics_interval", -"content_server : server_do_daemonize", -"content_server : server_use_caps_for_id", -"content_server : server_statistics_cumulative", -"content_server : server_outgoing_port_permit", -"content_server : server_outgoing_port_avoid", -"content_server : server_dlv_anchor_file", -"content_server : server_dlv_anchor", -"content_server : server_neg_cache_size", -"content_server : server_harden_referral_path", -"content_server : server_private_address", -"content_server : server_private_domain", -"content_server : server_extended_statistics", -"content_server : server_local_data_ptr", -"content_server : server_jostle_timeout", -"content_server : server_unwanted_reply_threshold", -"content_server : server_log_time_ascii", -"content_server : server_domain_insecure", -"content_server : server_val_sig_skew_min", -"content_server : server_val_sig_skew_max", -"content_server : server_cache_min_ttl", -"content_server : server_val_log_level", -"content_server : server_auto_trust_anchor_file", -"content_server : server_add_holddown", -"content_server : server_del_holddown", -"content_server : server_keep_missing", -"content_server : server_so_rcvbuf", -"content_server : server_edns_buffer_size", -"content_server : server_prefetch", -"content_server : server_prefetch_key", -"content_server : server_so_sndbuf", -"content_server : server_harden_below_nxdomain", -"content_server : server_ignore_cd_flag", -"content_server : server_log_queries", -"content_server : server_tcp_upstream", -"content_server : server_ssl_upstream", -"content_server : server_ssl_service_key", -"content_server : server_ssl_service_pem", -"content_server : server_ssl_port", -"content_server : server_minimal_responses", -"content_server : server_rrset_roundrobin", -"stubstart : VAR_STUB_ZONE", -"contents_stub : contents_stub content_stub", -"contents_stub :", -"content_stub : stub_name", -"content_stub : stub_host", -"content_stub : stub_addr", -"content_stub : stub_prime", -"content_stub : stub_first", -"forwardstart : VAR_FORWARD_ZONE", -"contents_forward : contents_forward content_forward", -"contents_forward :", -"content_forward : forward_name", -"content_forward : forward_host", -"content_forward : forward_addr", -"content_forward : forward_first", -"server_num_threads : VAR_NUM_THREADS STRING_ARG", -"server_verbosity : VAR_VERBOSITY STRING_ARG", -"server_statistics_interval : VAR_STATISTICS_INTERVAL STRING_ARG", -"server_statistics_cumulative : VAR_STATISTICS_CUMULATIVE STRING_ARG", -"server_extended_statistics : VAR_EXTENDED_STATISTICS STRING_ARG", -"server_port : VAR_PORT STRING_ARG", -"server_interface : VAR_INTERFACE STRING_ARG", -"server_outgoing_interface : VAR_OUTGOING_INTERFACE STRING_ARG", -"server_outgoing_range : VAR_OUTGOING_RANGE STRING_ARG", -"server_outgoing_port_permit : VAR_OUTGOING_PORT_PERMIT STRING_ARG", -"server_outgoing_port_avoid : VAR_OUTGOING_PORT_AVOID STRING_ARG", -"server_outgoing_num_tcp : VAR_OUTGOING_NUM_TCP STRING_ARG", -"server_incoming_num_tcp : VAR_INCOMING_NUM_TCP STRING_ARG", -"server_interface_automatic : VAR_INTERFACE_AUTOMATIC STRING_ARG", -"server_do_ip4 : VAR_DO_IP4 STRING_ARG", -"server_do_ip6 : VAR_DO_IP6 STRING_ARG", -"server_do_udp : VAR_DO_UDP STRING_ARG", -"server_do_tcp : VAR_DO_TCP STRING_ARG", -"server_tcp_upstream : VAR_TCP_UPSTREAM STRING_ARG", -"server_ssl_upstream : VAR_SSL_UPSTREAM STRING_ARG", -"server_ssl_service_key : VAR_SSL_SERVICE_KEY STRING_ARG", -"server_ssl_service_pem : VAR_SSL_SERVICE_PEM STRING_ARG", -"server_ssl_port : VAR_SSL_PORT STRING_ARG", -"server_do_daemonize : VAR_DO_DAEMONIZE STRING_ARG", -"server_use_syslog : VAR_USE_SYSLOG STRING_ARG", -"server_log_time_ascii : VAR_LOG_TIME_ASCII STRING_ARG", -"server_log_queries : VAR_LOG_QUERIES STRING_ARG", -"server_chroot : VAR_CHROOT STRING_ARG", -"server_username : VAR_USERNAME STRING_ARG", -"server_directory : VAR_DIRECTORY STRING_ARG", -"server_logfile : VAR_LOGFILE STRING_ARG", -"server_pidfile : VAR_PIDFILE STRING_ARG", -"server_root_hints : VAR_ROOT_HINTS STRING_ARG", -"server_dlv_anchor_file : VAR_DLV_ANCHOR_FILE STRING_ARG", -"server_dlv_anchor : VAR_DLV_ANCHOR STRING_ARG", -"server_auto_trust_anchor_file : VAR_AUTO_TRUST_ANCHOR_FILE STRING_ARG", -"server_trust_anchor_file : VAR_TRUST_ANCHOR_FILE STRING_ARG", -"server_trusted_keys_file : VAR_TRUSTED_KEYS_FILE STRING_ARG", -"server_trust_anchor : VAR_TRUST_ANCHOR STRING_ARG", -"server_domain_insecure : VAR_DOMAIN_INSECURE STRING_ARG", -"server_hide_identity : VAR_HIDE_IDENTITY STRING_ARG", -"server_hide_version : VAR_HIDE_VERSION STRING_ARG", -"server_identity : VAR_IDENTITY STRING_ARG", -"server_version : VAR_VERSION STRING_ARG", -"server_so_rcvbuf : VAR_SO_RCVBUF STRING_ARG", -"server_so_sndbuf : VAR_SO_SNDBUF STRING_ARG", -"server_edns_buffer_size : VAR_EDNS_BUFFER_SIZE STRING_ARG", -"server_msg_buffer_size : VAR_MSG_BUFFER_SIZE STRING_ARG", -"server_msg_cache_size : VAR_MSG_CACHE_SIZE STRING_ARG", -"server_msg_cache_slabs : VAR_MSG_CACHE_SLABS STRING_ARG", -"server_num_queries_per_thread : VAR_NUM_QUERIES_PER_THREAD STRING_ARG", -"server_jostle_timeout : VAR_JOSTLE_TIMEOUT STRING_ARG", -"server_rrset_cache_size : VAR_RRSET_CACHE_SIZE STRING_ARG", -"server_rrset_cache_slabs : VAR_RRSET_CACHE_SLABS STRING_ARG", -"server_infra_host_ttl : VAR_INFRA_HOST_TTL STRING_ARG", -"server_infra_lame_ttl : VAR_INFRA_LAME_TTL STRING_ARG", -"server_infra_cache_numhosts : VAR_INFRA_CACHE_NUMHOSTS STRING_ARG", -"server_infra_cache_lame_size : VAR_INFRA_CACHE_LAME_SIZE STRING_ARG", -"server_infra_cache_slabs : VAR_INFRA_CACHE_SLABS STRING_ARG", -"server_target_fetch_policy : VAR_TARGET_FETCH_POLICY STRING_ARG", -"server_harden_short_bufsize : VAR_HARDEN_SHORT_BUFSIZE STRING_ARG", -"server_harden_large_queries : VAR_HARDEN_LARGE_QUERIES STRING_ARG", -"server_harden_glue : VAR_HARDEN_GLUE STRING_ARG", -"server_harden_dnssec_stripped : VAR_HARDEN_DNSSEC_STRIPPED STRING_ARG", -"server_harden_below_nxdomain : VAR_HARDEN_BELOW_NXDOMAIN STRING_ARG", -"server_harden_referral_path : VAR_HARDEN_REFERRAL_PATH STRING_ARG", -"server_use_caps_for_id : VAR_USE_CAPS_FOR_ID STRING_ARG", -"server_private_address : VAR_PRIVATE_ADDRESS STRING_ARG", -"server_private_domain : VAR_PRIVATE_DOMAIN STRING_ARG", -"server_prefetch : VAR_PREFETCH STRING_ARG", -"server_prefetch_key : VAR_PREFETCH_KEY STRING_ARG", -"server_unwanted_reply_threshold : VAR_UNWANTED_REPLY_THRESHOLD STRING_ARG", -"server_do_not_query_address : VAR_DO_NOT_QUERY_ADDRESS STRING_ARG", -"server_do_not_query_localhost : VAR_DO_NOT_QUERY_LOCALHOST STRING_ARG", -"server_access_control : VAR_ACCESS_CONTROL STRING_ARG STRING_ARG", -"server_module_conf : VAR_MODULE_CONF STRING_ARG", -"server_val_override_date : VAR_VAL_OVERRIDE_DATE STRING_ARG", -"server_val_sig_skew_min : VAR_VAL_SIG_SKEW_MIN STRING_ARG", -"server_val_sig_skew_max : VAR_VAL_SIG_SKEW_MAX STRING_ARG", -"server_cache_max_ttl : VAR_CACHE_MAX_TTL STRING_ARG", -"server_cache_min_ttl : VAR_CACHE_MIN_TTL STRING_ARG", -"server_bogus_ttl : VAR_BOGUS_TTL STRING_ARG", -"server_val_clean_additional : VAR_VAL_CLEAN_ADDITIONAL STRING_ARG", -"server_val_permissive_mode : VAR_VAL_PERMISSIVE_MODE STRING_ARG", -"server_ignore_cd_flag : VAR_IGNORE_CD_FLAG STRING_ARG", -"server_val_log_level : VAR_VAL_LOG_LEVEL STRING_ARG", -"server_val_nsec3_keysize_iterations : VAR_VAL_NSEC3_KEYSIZE_ITERATIONS STRING_ARG", -"server_add_holddown : VAR_ADD_HOLDDOWN STRING_ARG", -"server_del_holddown : VAR_DEL_HOLDDOWN STRING_ARG", -"server_keep_missing : VAR_KEEP_MISSING STRING_ARG", -"server_key_cache_size : VAR_KEY_CACHE_SIZE STRING_ARG", -"server_key_cache_slabs : VAR_KEY_CACHE_SLABS STRING_ARG", -"server_neg_cache_size : VAR_NEG_CACHE_SIZE STRING_ARG", -"server_local_zone : VAR_LOCAL_ZONE STRING_ARG STRING_ARG", -"server_local_data : VAR_LOCAL_DATA STRING_ARG", -"server_local_data_ptr : VAR_LOCAL_DATA_PTR STRING_ARG", -"server_minimal_responses : VAR_MINIMAL_RESPONSES STRING_ARG", -"server_rrset_roundrobin : VAR_RRSET_ROUNDROBIN STRING_ARG", -"stub_name : VAR_NAME STRING_ARG", -"stub_host : VAR_STUB_HOST STRING_ARG", -"stub_addr : VAR_STUB_ADDR STRING_ARG", -"stub_first : VAR_STUB_FIRST STRING_ARG", -"stub_prime : VAR_STUB_PRIME STRING_ARG", -"forward_name : VAR_NAME STRING_ARG", -"forward_host : VAR_FORWARD_HOST STRING_ARG", -"forward_addr : VAR_FORWARD_ADDR STRING_ARG", -"forward_first : VAR_FORWARD_FIRST STRING_ARG", -"rcstart : VAR_REMOTE_CONTROL", -"contents_rc : contents_rc content_rc", -"contents_rc :", -"content_rc : rc_control_enable", -"content_rc : rc_control_interface", -"content_rc : rc_control_port", -"content_rc : rc_server_key_file", -"content_rc : rc_server_cert_file", -"content_rc : rc_control_key_file", -"content_rc : rc_control_cert_file", -"rc_control_enable : VAR_CONTROL_ENABLE STRING_ARG", -"rc_control_port : VAR_CONTROL_PORT STRING_ARG", -"rc_control_interface : VAR_CONTROL_INTERFACE STRING_ARG", -"rc_server_key_file : VAR_SERVER_KEY_FILE STRING_ARG", -"rc_server_cert_file : VAR_SERVER_CERT_FILE STRING_ARG", -"rc_control_key_file : VAR_CONTROL_KEY_FILE STRING_ARG", -"rc_control_cert_file : VAR_CONTROL_CERT_FILE STRING_ARG", -"pythonstart : VAR_PYTHON", -"contents_py : contents_py content_py", -"contents_py :", -"content_py : py_script", -"py_script : VAR_PYTHON_SCRIPT STRING_ARG", - -}; -#endif - -int yydebug; -int yynerrs; - -int yyerrflag; -int yychar; -YYSTYPE yyval; -YYSTYPE yylval; - -/* define the initial stack-sizes */ -#ifdef YYSTACKSIZE -#undef YYMAXDEPTH -#define YYMAXDEPTH YYSTACKSIZE -#else -#ifdef YYMAXDEPTH -#define YYSTACKSIZE YYMAXDEPTH -#else -#define YYSTACKSIZE 500 -#define YYMAXDEPTH 500 -#endif -#endif - -#define YYINITSTACKSIZE 500 - -typedef struct { - unsigned stacksize; - short *s_base; - short *s_mark; - short *s_last; - YYSTYPE *l_base; - YYSTYPE *l_mark; -} YYSTACKDATA; -/* variables for the parser stack */ -static YYSTACKDATA yystack; -#line 1277 "util/configparser.y" - -/* parse helper routines could be here */ -#line 845 "util/configparser.c" - -#if YYDEBUG -#include /* needed for printf */ -#endif - -#include /* needed for malloc, etc */ -#include /* needed for memset */ - -/* allocate initial stack or double stack size, up to YYMAXDEPTH */ -static int yygrowstack(YYSTACKDATA *data) -{ - int i; - unsigned newsize; - short *newss; - YYSTYPE *newvs; - - if ((newsize = data->stacksize) == 0) - newsize = YYINITSTACKSIZE; - else if (newsize >= YYMAXDEPTH) - return -1; - else if ((newsize *= 2) > YYMAXDEPTH) - newsize = YYMAXDEPTH; - - i = (int) (data->s_mark - data->s_base); - newss = (short *)realloc(data->s_base, newsize * sizeof(*newss)); - if (newss == 0) - return -1; - - data->s_base = newss; - data->s_mark = newss + i; - - newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); - if (newvs == 0) - return -1; - - data->l_base = newvs; - data->l_mark = newvs + i; - - data->stacksize = newsize; - data->s_last = data->s_base + newsize - 1; - return 0; -} - -#if YYPURE || defined(YY_NO_LEAKS) -static void yyfreestack(YYSTACKDATA *data) -{ - free(data->s_base); - free(data->l_base); - memset(data, 0, sizeof(*data)); -} -#else -#define yyfreestack(data) /* nothing */ -#endif - -#define YYABORT goto yyabort -#define YYREJECT goto yyabort -#define YYACCEPT goto yyaccept -#define YYERROR goto yyerrlab - -int -YYPARSE_DECL() -{ - int yym, yyn, yystate; -#if YYDEBUG - const char *yys; - - if ((yys = getenv("YYDEBUG")) != 0) - { - yyn = *yys; - if (yyn >= '0' && yyn <= '9') - yydebug = yyn - '0'; - } -#endif - - yynerrs = 0; - yyerrflag = 0; - yychar = YYEMPTY; - yystate = 0; - -#if YYPURE - memset(&yystack, 0, sizeof(yystack)); -#endif - - if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow; - yystack.s_mark = yystack.s_base; - yystack.l_mark = yystack.l_base; - yystate = 0; - *yystack.s_mark = 0; - -yyloop: - if ((yyn = yydefred[yystate]) != 0) goto yyreduce; - if (yychar < 0) - { - if ((yychar = YYLEX) < 0) yychar = 0; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, reading %d (%s)\n", - YYPREFIX, yystate, yychar, yys); - } -#endif - } - if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, shifting to state %d\n", - YYPREFIX, yystate, yytable[yyn]); -#endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack)) - { - goto yyoverflow; - } - yystate = yytable[yyn]; - *++yystack.s_mark = yytable[yyn]; - *++yystack.l_mark = yylval; - yychar = YYEMPTY; - if (yyerrflag > 0) --yyerrflag; - goto yyloop; - } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) - { - yyn = yytable[yyn]; - goto yyreduce; - } - if (yyerrflag) goto yyinrecovery; - - yyerror("syntax error"); - - goto yyerrlab; - -yyerrlab: - ++yynerrs; - -yyinrecovery: - if (yyerrflag < 3) - { - yyerrflag = 3; - for (;;) - { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, error recovery shifting\ - to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); -#endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack)) - { - goto yyoverflow; - } - yystate = yytable[yyn]; - *++yystack.s_mark = yytable[yyn]; - *++yystack.l_mark = yylval; - goto yyloop; - } - else - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: error recovery discarding state %d\n", - YYPREFIX, *yystack.s_mark); -#endif - if (yystack.s_mark <= yystack.s_base) goto yyabort; - --yystack.s_mark; - --yystack.l_mark; - } - } - } - else - { - if (yychar == 0) goto yyabort; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, error recovery discards token %d (%s)\n", - YYPREFIX, yystate, yychar, yys); - } -#endif - yychar = YYEMPTY; - goto yyloop; - } - -yyreduce: -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, reducing by rule %d (%s)\n", - YYPREFIX, yystate, yyn, yyrule[yyn]); -#endif - yym = yylen[yyn]; - if (yym) - yyval = yystack.l_mark[1-yym]; - else - memset(&yyval, 0, sizeof yyval); - switch (yyn) - { -case 8: -#line 118 "util/configparser.y" - { - OUTYY(("\nP(server:)\n")); - } -break; -case 109: -#line 167 "util/configparser.y" - { - struct config_stub* s; - OUTYY(("\nP(stub_zone:)\n")); - s = (struct config_stub*)calloc(1, sizeof(struct config_stub)); - if(s) { - s->next = cfg_parser->cfg->stubs; - cfg_parser->cfg->stubs = s; - } else - yyerror("out of memory"); - } -break; -case 117: -#line 183 "util/configparser.y" - { - struct config_stub* s; - OUTYY(("\nP(forward_zone:)\n")); - s = (struct config_stub*)calloc(1, sizeof(struct config_stub)); - if(s) { - s->next = cfg_parser->cfg->forwards; - cfg_parser->cfg->forwards = s; - } else - yyerror("out of memory"); - } -break; -case 124: -#line 199 "util/configparser.y" - { - OUTYY(("P(server_num_threads:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0 && strcmp(yystack.l_mark[0].str, "0") != 0) - yyerror("number expected"); - else cfg_parser->cfg->num_threads = atoi(yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 125: -#line 208 "util/configparser.y" - { - OUTYY(("P(server_verbosity:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0 && strcmp(yystack.l_mark[0].str, "0") != 0) - yyerror("number expected"); - else cfg_parser->cfg->verbosity = atoi(yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 126: -#line 217 "util/configparser.y" - { - OUTYY(("P(server_statistics_interval:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "") == 0 || strcmp(yystack.l_mark[0].str, "0") == 0) - cfg_parser->cfg->stat_interval = 0; - else if(atoi(yystack.l_mark[0].str) == 0) - yyerror("number expected"); - else cfg_parser->cfg->stat_interval = atoi(yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 127: -#line 228 "util/configparser.y" - { - OUTYY(("P(server_statistics_cumulative:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->stat_cumulative = (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 128: -#line 237 "util/configparser.y" - { - OUTYY(("P(server_extended_statistics:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->stat_extended = (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 129: -#line 246 "util/configparser.y" - { - OUTYY(("P(server_port:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0) - yyerror("port number expected"); - else cfg_parser->cfg->port = atoi(yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 130: -#line 255 "util/configparser.y" - { - OUTYY(("P(server_interface:%s)\n", yystack.l_mark[0].str)); - if(cfg_parser->cfg->num_ifs == 0) - cfg_parser->cfg->ifs = calloc(1, sizeof(char*)); - else cfg_parser->cfg->ifs = realloc(cfg_parser->cfg->ifs, - (cfg_parser->cfg->num_ifs+1)*sizeof(char*)); - if(!cfg_parser->cfg->ifs) - yyerror("out of memory"); - else - cfg_parser->cfg->ifs[cfg_parser->cfg->num_ifs++] = yystack.l_mark[0].str; - } -break; -case 131: -#line 268 "util/configparser.y" - { - OUTYY(("P(server_outgoing_interface:%s)\n", yystack.l_mark[0].str)); - if(cfg_parser->cfg->num_out_ifs == 0) - cfg_parser->cfg->out_ifs = calloc(1, sizeof(char*)); - else cfg_parser->cfg->out_ifs = realloc( - cfg_parser->cfg->out_ifs, - (cfg_parser->cfg->num_out_ifs+1)*sizeof(char*)); - if(!cfg_parser->cfg->out_ifs) - yyerror("out of memory"); - else - cfg_parser->cfg->out_ifs[ - cfg_parser->cfg->num_out_ifs++] = yystack.l_mark[0].str; - } -break; -case 132: -#line 283 "util/configparser.y" - { - OUTYY(("P(server_outgoing_range:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0) - yyerror("number expected"); - else cfg_parser->cfg->outgoing_num_ports = atoi(yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 133: -#line 292 "util/configparser.y" - { - OUTYY(("P(server_outgoing_port_permit:%s)\n", yystack.l_mark[0].str)); - if(!cfg_mark_ports(yystack.l_mark[0].str, 1, - cfg_parser->cfg->outgoing_avail_ports, 65536)) - yyerror("port number or range (\"low-high\") expected"); - free(yystack.l_mark[0].str); - } -break; -case 134: -#line 301 "util/configparser.y" - { - OUTYY(("P(server_outgoing_port_avoid:%s)\n", yystack.l_mark[0].str)); - if(!cfg_mark_ports(yystack.l_mark[0].str, 0, - cfg_parser->cfg->outgoing_avail_ports, 65536)) - yyerror("port number or range (\"low-high\") expected"); - free(yystack.l_mark[0].str); - } -break; -case 135: -#line 310 "util/configparser.y" - { - OUTYY(("P(server_outgoing_num_tcp:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0 && strcmp(yystack.l_mark[0].str, "0") != 0) - yyerror("number expected"); - else cfg_parser->cfg->outgoing_num_tcp = atoi(yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 136: -#line 319 "util/configparser.y" - { - OUTYY(("P(server_incoming_num_tcp:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0 && strcmp(yystack.l_mark[0].str, "0") != 0) - yyerror("number expected"); - else cfg_parser->cfg->incoming_num_tcp = atoi(yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 137: -#line 328 "util/configparser.y" - { - OUTYY(("P(server_interface_automatic:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->if_automatic = (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 138: -#line 337 "util/configparser.y" - { - OUTYY(("P(server_do_ip4:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->do_ip4 = (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 139: -#line 346 "util/configparser.y" - { - OUTYY(("P(server_do_ip6:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->do_ip6 = (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 140: -#line 355 "util/configparser.y" - { - OUTYY(("P(server_do_udp:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->do_udp = (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 141: -#line 364 "util/configparser.y" - { - OUTYY(("P(server_do_tcp:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->do_tcp = (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 142: -#line 373 "util/configparser.y" - { - OUTYY(("P(server_tcp_upstream:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->tcp_upstream = (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 143: -#line 382 "util/configparser.y" - { - OUTYY(("P(server_ssl_upstream:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->ssl_upstream = (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 144: -#line 391 "util/configparser.y" - { - OUTYY(("P(server_ssl_service_key:%s)\n", yystack.l_mark[0].str)); - free(cfg_parser->cfg->ssl_service_key); - cfg_parser->cfg->ssl_service_key = yystack.l_mark[0].str; - } -break; -case 145: -#line 398 "util/configparser.y" - { - OUTYY(("P(server_ssl_service_pem:%s)\n", yystack.l_mark[0].str)); - free(cfg_parser->cfg->ssl_service_pem); - cfg_parser->cfg->ssl_service_pem = yystack.l_mark[0].str; - } -break; -case 146: -#line 405 "util/configparser.y" - { - OUTYY(("P(server_ssl_port:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0) - yyerror("port number expected"); - else cfg_parser->cfg->ssl_port = atoi(yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 147: -#line 414 "util/configparser.y" - { - OUTYY(("P(server_do_daemonize:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->do_daemonize = (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 148: -#line 423 "util/configparser.y" - { - OUTYY(("P(server_use_syslog:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->use_syslog = (strcmp(yystack.l_mark[0].str, "yes")==0); -#if !defined(HAVE_SYSLOG_H) && !defined(UB_ON_WINDOWS) - if(strcmp(yystack.l_mark[0].str, "yes") == 0) - yyerror("no syslog services are available. " - "(reconfigure and compile to add)"); -#endif - free(yystack.l_mark[0].str); - } -break; -case 149: -#line 437 "util/configparser.y" - { - OUTYY(("P(server_log_time_ascii:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->log_time_ascii = (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 150: -#line 446 "util/configparser.y" - { - OUTYY(("P(server_log_queries:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->log_queries = (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 151: -#line 455 "util/configparser.y" - { - OUTYY(("P(server_chroot:%s)\n", yystack.l_mark[0].str)); - free(cfg_parser->cfg->chrootdir); - cfg_parser->cfg->chrootdir = yystack.l_mark[0].str; - } -break; -case 152: -#line 462 "util/configparser.y" - { - OUTYY(("P(server_username:%s)\n", yystack.l_mark[0].str)); - free(cfg_parser->cfg->username); - cfg_parser->cfg->username = yystack.l_mark[0].str; - } -break; -case 153: -#line 469 "util/configparser.y" - { - OUTYY(("P(server_directory:%s)\n", yystack.l_mark[0].str)); - free(cfg_parser->cfg->directory); - cfg_parser->cfg->directory = yystack.l_mark[0].str; - } -break; -case 154: -#line 476 "util/configparser.y" - { - OUTYY(("P(server_logfile:%s)\n", yystack.l_mark[0].str)); - free(cfg_parser->cfg->logfile); - cfg_parser->cfg->logfile = yystack.l_mark[0].str; - cfg_parser->cfg->use_syslog = 0; - } -break; -case 155: -#line 484 "util/configparser.y" - { - OUTYY(("P(server_pidfile:%s)\n", yystack.l_mark[0].str)); - free(cfg_parser->cfg->pidfile); - cfg_parser->cfg->pidfile = yystack.l_mark[0].str; - } -break; -case 156: -#line 491 "util/configparser.y" - { - OUTYY(("P(server_root_hints:%s)\n", yystack.l_mark[0].str)); - if(!cfg_strlist_insert(&cfg_parser->cfg->root_hints, yystack.l_mark[0].str)) - yyerror("out of memory"); - } -break; -case 157: -#line 498 "util/configparser.y" - { - OUTYY(("P(server_dlv_anchor_file:%s)\n", yystack.l_mark[0].str)); - free(cfg_parser->cfg->dlv_anchor_file); - cfg_parser->cfg->dlv_anchor_file = yystack.l_mark[0].str; - } -break; -case 158: -#line 505 "util/configparser.y" - { - OUTYY(("P(server_dlv_anchor:%s)\n", yystack.l_mark[0].str)); - if(!cfg_strlist_insert(&cfg_parser->cfg->dlv_anchor_list, yystack.l_mark[0].str)) - yyerror("out of memory"); - } -break; -case 159: -#line 512 "util/configparser.y" - { - OUTYY(("P(server_auto_trust_anchor_file:%s)\n", yystack.l_mark[0].str)); - if(!cfg_strlist_insert(&cfg_parser->cfg-> - auto_trust_anchor_file_list, yystack.l_mark[0].str)) - yyerror("out of memory"); - } -break; -case 160: -#line 520 "util/configparser.y" - { - OUTYY(("P(server_trust_anchor_file:%s)\n", yystack.l_mark[0].str)); - if(!cfg_strlist_insert(&cfg_parser->cfg-> - trust_anchor_file_list, yystack.l_mark[0].str)) - yyerror("out of memory"); - } -break; -case 161: -#line 528 "util/configparser.y" - { - OUTYY(("P(server_trusted_keys_file:%s)\n", yystack.l_mark[0].str)); - if(!cfg_strlist_insert(&cfg_parser->cfg-> - trusted_keys_file_list, yystack.l_mark[0].str)) - yyerror("out of memory"); - } -break; -case 162: -#line 536 "util/configparser.y" - { - OUTYY(("P(server_trust_anchor:%s)\n", yystack.l_mark[0].str)); - if(!cfg_strlist_insert(&cfg_parser->cfg->trust_anchor_list, yystack.l_mark[0].str)) - yyerror("out of memory"); - } -break; -case 163: -#line 543 "util/configparser.y" - { - OUTYY(("P(server_domain_insecure:%s)\n", yystack.l_mark[0].str)); - if(!cfg_strlist_insert(&cfg_parser->cfg->domain_insecure, yystack.l_mark[0].str)) - yyerror("out of memory"); - } -break; -case 164: -#line 550 "util/configparser.y" - { - OUTYY(("P(server_hide_identity:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->hide_identity = (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 165: -#line 559 "util/configparser.y" - { - OUTYY(("P(server_hide_version:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->hide_version = (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 166: -#line 568 "util/configparser.y" - { - OUTYY(("P(server_identity:%s)\n", yystack.l_mark[0].str)); - free(cfg_parser->cfg->identity); - cfg_parser->cfg->identity = yystack.l_mark[0].str; - } -break; -case 167: -#line 575 "util/configparser.y" - { - OUTYY(("P(server_version:%s)\n", yystack.l_mark[0].str)); - free(cfg_parser->cfg->version); - cfg_parser->cfg->version = yystack.l_mark[0].str; - } -break; -case 168: -#line 582 "util/configparser.y" - { - OUTYY(("P(server_so_rcvbuf:%s)\n", yystack.l_mark[0].str)); - if(!cfg_parse_memsize(yystack.l_mark[0].str, &cfg_parser->cfg->so_rcvbuf)) - yyerror("buffer size expected"); - free(yystack.l_mark[0].str); - } -break; -case 169: -#line 590 "util/configparser.y" - { - OUTYY(("P(server_so_sndbuf:%s)\n", yystack.l_mark[0].str)); - if(!cfg_parse_memsize(yystack.l_mark[0].str, &cfg_parser->cfg->so_sndbuf)) - yyerror("buffer size expected"); - free(yystack.l_mark[0].str); - } -break; -case 170: -#line 598 "util/configparser.y" - { - OUTYY(("P(server_edns_buffer_size:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0) - yyerror("number expected"); - else if (atoi(yystack.l_mark[0].str) < 12) - yyerror("edns buffer size too small"); - else if (atoi(yystack.l_mark[0].str) > 65535) - cfg_parser->cfg->edns_buffer_size = 65535; - else cfg_parser->cfg->edns_buffer_size = atoi(yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 171: -#line 611 "util/configparser.y" - { - OUTYY(("P(server_msg_buffer_size:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0) - yyerror("number expected"); - else if (atoi(yystack.l_mark[0].str) < 4096) - yyerror("message buffer size too small (use 4096)"); - else cfg_parser->cfg->msg_buffer_size = atoi(yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 172: -#line 622 "util/configparser.y" - { - OUTYY(("P(server_msg_cache_size:%s)\n", yystack.l_mark[0].str)); - if(!cfg_parse_memsize(yystack.l_mark[0].str, &cfg_parser->cfg->msg_cache_size)) - yyerror("memory size expected"); - free(yystack.l_mark[0].str); - } -break; -case 173: -#line 630 "util/configparser.y" - { - OUTYY(("P(server_msg_cache_slabs:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0) - yyerror("number expected"); - else { - cfg_parser->cfg->msg_cache_slabs = atoi(yystack.l_mark[0].str); - if(!is_pow2(cfg_parser->cfg->msg_cache_slabs)) - yyerror("must be a power of 2"); - } - free(yystack.l_mark[0].str); - } -break; -case 174: -#line 643 "util/configparser.y" - { - OUTYY(("P(server_num_queries_per_thread:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0) - yyerror("number expected"); - else cfg_parser->cfg->num_queries_per_thread = atoi(yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 175: -#line 652 "util/configparser.y" - { - OUTYY(("P(server_jostle_timeout:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0 && strcmp(yystack.l_mark[0].str, "0") != 0) - yyerror("number expected"); - else cfg_parser->cfg->jostle_time = atoi(yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 176: -#line 661 "util/configparser.y" - { - OUTYY(("P(server_rrset_cache_size:%s)\n", yystack.l_mark[0].str)); - if(!cfg_parse_memsize(yystack.l_mark[0].str, &cfg_parser->cfg->rrset_cache_size)) - yyerror("memory size expected"); - free(yystack.l_mark[0].str); - } -break; -case 177: -#line 669 "util/configparser.y" - { - OUTYY(("P(server_rrset_cache_slabs:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0) - yyerror("number expected"); - else { - cfg_parser->cfg->rrset_cache_slabs = atoi(yystack.l_mark[0].str); - if(!is_pow2(cfg_parser->cfg->rrset_cache_slabs)) - yyerror("must be a power of 2"); - } - free(yystack.l_mark[0].str); - } -break; -case 178: -#line 682 "util/configparser.y" - { - OUTYY(("P(server_infra_host_ttl:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0 && strcmp(yystack.l_mark[0].str, "0") != 0) - yyerror("number expected"); - else cfg_parser->cfg->host_ttl = atoi(yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 179: -#line 691 "util/configparser.y" - { - OUTYY(("P(server_infra_lame_ttl:%s)\n", yystack.l_mark[0].str)); - verbose(VERB_DETAIL, "ignored infra-lame-ttl: %s (option " - "removed, use infra-host-ttl)", yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 180: -#line 699 "util/configparser.y" - { - OUTYY(("P(server_infra_cache_numhosts:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0) - yyerror("number expected"); - else cfg_parser->cfg->infra_cache_numhosts = atoi(yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 181: -#line 708 "util/configparser.y" - { - OUTYY(("P(server_infra_cache_lame_size:%s)\n", yystack.l_mark[0].str)); - verbose(VERB_DETAIL, "ignored infra-cache-lame-size: %s " - "(option removed, use infra-cache-numhosts)", yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 182: -#line 716 "util/configparser.y" - { - OUTYY(("P(server_infra_cache_slabs:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0) - yyerror("number expected"); - else { - cfg_parser->cfg->infra_cache_slabs = atoi(yystack.l_mark[0].str); - if(!is_pow2(cfg_parser->cfg->infra_cache_slabs)) - yyerror("must be a power of 2"); - } - free(yystack.l_mark[0].str); - } -break; -case 183: -#line 729 "util/configparser.y" - { - OUTYY(("P(server_target_fetch_policy:%s)\n", yystack.l_mark[0].str)); - free(cfg_parser->cfg->target_fetch_policy); - cfg_parser->cfg->target_fetch_policy = yystack.l_mark[0].str; - } -break; -case 184: -#line 736 "util/configparser.y" - { - OUTYY(("P(server_harden_short_bufsize:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->harden_short_bufsize = - (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 185: -#line 746 "util/configparser.y" - { - OUTYY(("P(server_harden_large_queries:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->harden_large_queries = - (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 186: -#line 756 "util/configparser.y" - { - OUTYY(("P(server_harden_glue:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->harden_glue = - (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 187: -#line 766 "util/configparser.y" - { - OUTYY(("P(server_harden_dnssec_stripped:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->harden_dnssec_stripped = - (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 188: -#line 776 "util/configparser.y" - { - OUTYY(("P(server_harden_below_nxdomain:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->harden_below_nxdomain = - (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 189: -#line 786 "util/configparser.y" - { - OUTYY(("P(server_harden_referral_path:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->harden_referral_path = - (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 190: -#line 796 "util/configparser.y" - { - OUTYY(("P(server_use_caps_for_id:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->use_caps_bits_for_id = - (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 191: -#line 806 "util/configparser.y" - { - OUTYY(("P(server_private_address:%s)\n", yystack.l_mark[0].str)); - if(!cfg_strlist_insert(&cfg_parser->cfg->private_address, yystack.l_mark[0].str)) - yyerror("out of memory"); - } -break; -case 192: -#line 813 "util/configparser.y" - { - OUTYY(("P(server_private_domain:%s)\n", yystack.l_mark[0].str)); - if(!cfg_strlist_insert(&cfg_parser->cfg->private_domain, yystack.l_mark[0].str)) - yyerror("out of memory"); - } -break; -case 193: -#line 820 "util/configparser.y" - { - OUTYY(("P(server_prefetch:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->prefetch = (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 194: -#line 829 "util/configparser.y" - { - OUTYY(("P(server_prefetch_key:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->prefetch_key = (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 195: -#line 838 "util/configparser.y" - { - OUTYY(("P(server_unwanted_reply_threshold:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0 && strcmp(yystack.l_mark[0].str, "0") != 0) - yyerror("number expected"); - else cfg_parser->cfg->unwanted_threshold = atoi(yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 196: -#line 847 "util/configparser.y" - { - OUTYY(("P(server_do_not_query_address:%s)\n", yystack.l_mark[0].str)); - if(!cfg_strlist_insert(&cfg_parser->cfg->donotqueryaddrs, yystack.l_mark[0].str)) - yyerror("out of memory"); - } -break; -case 197: -#line 854 "util/configparser.y" - { - OUTYY(("P(server_do_not_query_localhost:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->donotquery_localhost = - (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 198: -#line 864 "util/configparser.y" - { - OUTYY(("P(server_access_control:%s %s)\n", yystack.l_mark[-1].str, yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "deny")!=0 && strcmp(yystack.l_mark[0].str, "refuse")!=0 && - strcmp(yystack.l_mark[0].str, "allow")!=0 && - strcmp(yystack.l_mark[0].str, "allow_snoop")!=0) { - yyerror("expected deny, refuse, allow or allow_snoop " - "in access control action"); - } else { - if(!cfg_str2list_insert(&cfg_parser->cfg->acls, yystack.l_mark[-1].str, yystack.l_mark[0].str)) - fatal_exit("out of memory adding acl"); - } - } -break; -case 199: -#line 878 "util/configparser.y" - { - OUTYY(("P(server_module_conf:%s)\n", yystack.l_mark[0].str)); - free(cfg_parser->cfg->module_conf); - cfg_parser->cfg->module_conf = yystack.l_mark[0].str; - } -break; -case 200: -#line 885 "util/configparser.y" - { - OUTYY(("P(server_val_override_date:%s)\n", yystack.l_mark[0].str)); - if(strlen(yystack.l_mark[0].str) == 0 || strcmp(yystack.l_mark[0].str, "0") == 0) { - cfg_parser->cfg->val_date_override = 0; - } else if(strlen(yystack.l_mark[0].str) == 14) { - cfg_parser->cfg->val_date_override = - cfg_convert_timeval(yystack.l_mark[0].str); - if(!cfg_parser->cfg->val_date_override) - yyerror("bad date/time specification"); - } else { - if(atoi(yystack.l_mark[0].str) == 0) - yyerror("number expected"); - cfg_parser->cfg->val_date_override = atoi(yystack.l_mark[0].str); - } - free(yystack.l_mark[0].str); - } -break; -case 201: -#line 903 "util/configparser.y" - { - OUTYY(("P(server_val_sig_skew_min:%s)\n", yystack.l_mark[0].str)); - if(strlen(yystack.l_mark[0].str) == 0 || strcmp(yystack.l_mark[0].str, "0") == 0) { - cfg_parser->cfg->val_sig_skew_min = 0; - } else { - cfg_parser->cfg->val_sig_skew_min = atoi(yystack.l_mark[0].str); - if(!cfg_parser->cfg->val_sig_skew_min) - yyerror("number expected"); - } - free(yystack.l_mark[0].str); - } -break; -case 202: -#line 916 "util/configparser.y" - { - OUTYY(("P(server_val_sig_skew_max:%s)\n", yystack.l_mark[0].str)); - if(strlen(yystack.l_mark[0].str) == 0 || strcmp(yystack.l_mark[0].str, "0") == 0) { - cfg_parser->cfg->val_sig_skew_max = 0; - } else { - cfg_parser->cfg->val_sig_skew_max = atoi(yystack.l_mark[0].str); - if(!cfg_parser->cfg->val_sig_skew_max) - yyerror("number expected"); - } - free(yystack.l_mark[0].str); - } -break; -case 203: -#line 929 "util/configparser.y" - { - OUTYY(("P(server_cache_max_ttl:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0 && strcmp(yystack.l_mark[0].str, "0") != 0) - yyerror("number expected"); - else cfg_parser->cfg->max_ttl = atoi(yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 204: -#line 938 "util/configparser.y" - { - OUTYY(("P(server_cache_min_ttl:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0 && strcmp(yystack.l_mark[0].str, "0") != 0) - yyerror("number expected"); - else cfg_parser->cfg->min_ttl = atoi(yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 205: -#line 947 "util/configparser.y" - { - OUTYY(("P(server_bogus_ttl:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0 && strcmp(yystack.l_mark[0].str, "0") != 0) - yyerror("number expected"); - else cfg_parser->cfg->bogus_ttl = atoi(yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 206: -#line 956 "util/configparser.y" - { - OUTYY(("P(server_val_clean_additional:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->val_clean_additional = - (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 207: -#line 966 "util/configparser.y" - { - OUTYY(("P(server_val_permissive_mode:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->val_permissive_mode = - (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 208: -#line 976 "util/configparser.y" - { - OUTYY(("P(server_ignore_cd_flag:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->ignore_cd = (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 209: -#line 985 "util/configparser.y" - { - OUTYY(("P(server_val_log_level:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0 && strcmp(yystack.l_mark[0].str, "0") != 0) - yyerror("number expected"); - else cfg_parser->cfg->val_log_level = atoi(yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 210: -#line 994 "util/configparser.y" - { - OUTYY(("P(server_val_nsec3_keysize_iterations:%s)\n", yystack.l_mark[0].str)); - free(cfg_parser->cfg->val_nsec3_key_iterations); - cfg_parser->cfg->val_nsec3_key_iterations = yystack.l_mark[0].str; - } -break; -case 211: -#line 1001 "util/configparser.y" - { - OUTYY(("P(server_add_holddown:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0 && strcmp(yystack.l_mark[0].str, "0") != 0) - yyerror("number expected"); - else cfg_parser->cfg->add_holddown = atoi(yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 212: -#line 1010 "util/configparser.y" - { - OUTYY(("P(server_del_holddown:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0 && strcmp(yystack.l_mark[0].str, "0") != 0) - yyerror("number expected"); - else cfg_parser->cfg->del_holddown = atoi(yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 213: -#line 1019 "util/configparser.y" - { - OUTYY(("P(server_keep_missing:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0 && strcmp(yystack.l_mark[0].str, "0") != 0) - yyerror("number expected"); - else cfg_parser->cfg->keep_missing = atoi(yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 214: -#line 1028 "util/configparser.y" - { - OUTYY(("P(server_key_cache_size:%s)\n", yystack.l_mark[0].str)); - if(!cfg_parse_memsize(yystack.l_mark[0].str, &cfg_parser->cfg->key_cache_size)) - yyerror("memory size expected"); - free(yystack.l_mark[0].str); - } -break; -case 215: -#line 1036 "util/configparser.y" - { - OUTYY(("P(server_key_cache_slabs:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0) - yyerror("number expected"); - else { - cfg_parser->cfg->key_cache_slabs = atoi(yystack.l_mark[0].str); - if(!is_pow2(cfg_parser->cfg->key_cache_slabs)) - yyerror("must be a power of 2"); - } - free(yystack.l_mark[0].str); - } -break; -case 216: -#line 1049 "util/configparser.y" - { - OUTYY(("P(server_neg_cache_size:%s)\n", yystack.l_mark[0].str)); - if(!cfg_parse_memsize(yystack.l_mark[0].str, &cfg_parser->cfg->neg_cache_size)) - yyerror("memory size expected"); - free(yystack.l_mark[0].str); - } -break; -case 217: -#line 1057 "util/configparser.y" - { - OUTYY(("P(server_local_zone:%s %s)\n", yystack.l_mark[-1].str, yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "static")!=0 && strcmp(yystack.l_mark[0].str, "deny")!=0 && - strcmp(yystack.l_mark[0].str, "refuse")!=0 && strcmp(yystack.l_mark[0].str, "redirect")!=0 && - strcmp(yystack.l_mark[0].str, "transparent")!=0 && strcmp(yystack.l_mark[0].str, "nodefault")!=0 - && strcmp(yystack.l_mark[0].str, "typetransparent")!=0) - yyerror("local-zone type: expected static, deny, " - "refuse, redirect, transparent, " - "typetransparent or nodefault"); - else if(strcmp(yystack.l_mark[0].str, "nodefault")==0) { - if(!cfg_strlist_insert(&cfg_parser->cfg-> - local_zones_nodefault, yystack.l_mark[-1].str)) - fatal_exit("out of memory adding local-zone"); - free(yystack.l_mark[0].str); - } else { - if(!cfg_str2list_insert(&cfg_parser->cfg->local_zones, - yystack.l_mark[-1].str, yystack.l_mark[0].str)) - fatal_exit("out of memory adding local-zone"); - } - } -break; -case 218: -#line 1079 "util/configparser.y" - { - OUTYY(("P(server_local_data:%s)\n", yystack.l_mark[0].str)); - if(!cfg_strlist_insert(&cfg_parser->cfg->local_data, yystack.l_mark[0].str)) - fatal_exit("out of memory adding local-data"); - } -break; -case 219: -#line 1086 "util/configparser.y" - { - char* ptr; - OUTYY(("P(server_local_data_ptr:%s)\n", yystack.l_mark[0].str)); - ptr = cfg_ptr_reverse(yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - if(ptr) { - if(!cfg_strlist_insert(&cfg_parser->cfg-> - local_data, ptr)) - fatal_exit("out of memory adding local-data"); - } else { - yyerror("local-data-ptr could not be reversed"); - } - } -break; -case 220: -#line 1101 "util/configparser.y" - { - OUTYY(("P(server_minimal_responses:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->minimal_responses = - (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 221: -#line 1111 "util/configparser.y" - { - OUTYY(("P(server_rrset_roundrobin:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->rrset_roundrobin = - (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 222: -#line 1121 "util/configparser.y" - { - OUTYY(("P(name:%s)\n", yystack.l_mark[0].str)); - if(cfg_parser->cfg->stubs->name) - yyerror("stub name override, there must be one name " - "for one stub-zone"); - free(cfg_parser->cfg->stubs->name); - cfg_parser->cfg->stubs->name = yystack.l_mark[0].str; - } -break; -case 223: -#line 1131 "util/configparser.y" - { - OUTYY(("P(stub-host:%s)\n", yystack.l_mark[0].str)); - if(!cfg_strlist_insert(&cfg_parser->cfg->stubs->hosts, yystack.l_mark[0].str)) - yyerror("out of memory"); - } -break; -case 224: -#line 1138 "util/configparser.y" - { - OUTYY(("P(stub-addr:%s)\n", yystack.l_mark[0].str)); - if(!cfg_strlist_insert(&cfg_parser->cfg->stubs->addrs, yystack.l_mark[0].str)) - yyerror("out of memory"); - } -break; -case 225: -#line 1145 "util/configparser.y" - { - OUTYY(("P(stub-first:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->stubs->isfirst=(strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 226: -#line 1154 "util/configparser.y" - { - OUTYY(("P(stub-prime:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->stubs->isprime = - (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 227: -#line 1164 "util/configparser.y" - { - OUTYY(("P(name:%s)\n", yystack.l_mark[0].str)); - if(cfg_parser->cfg->forwards->name) - yyerror("forward name override, there must be one " - "name for one forward-zone"); - free(cfg_parser->cfg->forwards->name); - cfg_parser->cfg->forwards->name = yystack.l_mark[0].str; - } -break; -case 228: -#line 1174 "util/configparser.y" - { - OUTYY(("P(forward-host:%s)\n", yystack.l_mark[0].str)); - if(!cfg_strlist_insert(&cfg_parser->cfg->forwards->hosts, yystack.l_mark[0].str)) - yyerror("out of memory"); - } -break; -case 229: -#line 1181 "util/configparser.y" - { - OUTYY(("P(forward-addr:%s)\n", yystack.l_mark[0].str)); - if(!cfg_strlist_insert(&cfg_parser->cfg->forwards->addrs, yystack.l_mark[0].str)) - yyerror("out of memory"); - } -break; -case 230: -#line 1188 "util/configparser.y" - { - OUTYY(("P(forward-first:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->forwards->isfirst=(strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 231: -#line 1197 "util/configparser.y" - { - OUTYY(("\nP(remote-control:)\n")); - } -break; -case 241: -#line 1208 "util/configparser.y" - { - OUTYY(("P(control_enable:%s)\n", yystack.l_mark[0].str)); - if(strcmp(yystack.l_mark[0].str, "yes") != 0 && strcmp(yystack.l_mark[0].str, "no") != 0) - yyerror("expected yes or no."); - else cfg_parser->cfg->remote_control_enable = - (strcmp(yystack.l_mark[0].str, "yes")==0); - free(yystack.l_mark[0].str); - } -break; -case 242: -#line 1218 "util/configparser.y" - { - OUTYY(("P(control_port:%s)\n", yystack.l_mark[0].str)); - if(atoi(yystack.l_mark[0].str) == 0) - yyerror("control port number expected"); - else cfg_parser->cfg->control_port = atoi(yystack.l_mark[0].str); - free(yystack.l_mark[0].str); - } -break; -case 243: -#line 1227 "util/configparser.y" - { - OUTYY(("P(control_interface:%s)\n", yystack.l_mark[0].str)); - if(!cfg_strlist_insert(&cfg_parser->cfg->control_ifs, yystack.l_mark[0].str)) - yyerror("out of memory"); - } -break; -case 244: -#line 1234 "util/configparser.y" - { - OUTYY(("P(rc_server_key_file:%s)\n", yystack.l_mark[0].str)); - free(cfg_parser->cfg->server_key_file); - cfg_parser->cfg->server_key_file = yystack.l_mark[0].str; - } -break; -case 245: -#line 1241 "util/configparser.y" - { - OUTYY(("P(rc_server_cert_file:%s)\n", yystack.l_mark[0].str)); - free(cfg_parser->cfg->server_cert_file); - cfg_parser->cfg->server_cert_file = yystack.l_mark[0].str; - } -break; -case 246: -#line 1248 "util/configparser.y" - { - OUTYY(("P(rc_control_key_file:%s)\n", yystack.l_mark[0].str)); - free(cfg_parser->cfg->control_key_file); - cfg_parser->cfg->control_key_file = yystack.l_mark[0].str; - } -break; -case 247: -#line 1255 "util/configparser.y" - { - OUTYY(("P(rc_control_cert_file:%s)\n", yystack.l_mark[0].str)); - free(cfg_parser->cfg->control_cert_file); - cfg_parser->cfg->control_cert_file = yystack.l_mark[0].str; - } -break; -case 248: -#line 1262 "util/configparser.y" - { - OUTYY(("\nP(python:)\n")); - } -break; -case 252: -#line 1271 "util/configparser.y" - { - OUTYY(("P(python-script:%s)\n", yystack.l_mark[0].str)); - free(cfg_parser->cfg->python_script); - cfg_parser->cfg->python_script = yystack.l_mark[0].str; - } -break; -#line 2269 "util/configparser.c" - } - yystack.s_mark -= yym; - yystate = *yystack.s_mark; - yystack.l_mark -= yym; - yym = yylhs[yyn]; - if (yystate == 0 && yym == 0) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: after reduction, shifting from state 0 to\ - state %d\n", YYPREFIX, YYFINAL); -#endif - yystate = YYFINAL; - *++yystack.s_mark = YYFINAL; - *++yystack.l_mark = yyval; - if (yychar < 0) - { - if ((yychar = YYLEX) < 0) yychar = 0; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, reading %d (%s)\n", - YYPREFIX, YYFINAL, yychar, yys); - } -#endif - } - if (yychar == 0) goto yyaccept; - goto yyloop; - } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) - yystate = yytable[yyn]; - else - yystate = yydgoto[yym]; -#if YYDEBUG - if (yydebug) - printf("%sdebug: after reduction, shifting from state %d \ -to state %d\n", YYPREFIX, *yystack.s_mark, yystate); -#endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack)) - { - goto yyoverflow; - } - *++yystack.s_mark = (short) yystate; - *++yystack.l_mark = yyval; - goto yyloop; - -yyoverflow: - yyerror("yacc stack overflow"); - -yyabort: - yyfreestack(&yystack); - return (1); - -yyaccept: - yyfreestack(&yystack); - return (0); -} diff --git a/contrib/unbound/util/configparser.h b/contrib/unbound/util/configparser.h deleted file mode 100644 index 7bf42351ef4..00000000000 --- a/contrib/unbound/util/configparser.h +++ /dev/null @@ -1,138 +0,0 @@ -#define SPACE 257 -#define LETTER 258 -#define NEWLINE 259 -#define COMMENT 260 -#define COLON 261 -#define ANY 262 -#define ZONESTR 263 -#define STRING_ARG 264 -#define VAR_SERVER 265 -#define VAR_VERBOSITY 266 -#define VAR_NUM_THREADS 267 -#define VAR_PORT 268 -#define VAR_OUTGOING_RANGE 269 -#define VAR_INTERFACE 270 -#define VAR_DO_IP4 271 -#define VAR_DO_IP6 272 -#define VAR_DO_UDP 273 -#define VAR_DO_TCP 274 -#define VAR_CHROOT 275 -#define VAR_USERNAME 276 -#define VAR_DIRECTORY 277 -#define VAR_LOGFILE 278 -#define VAR_PIDFILE 279 -#define VAR_MSG_CACHE_SIZE 280 -#define VAR_MSG_CACHE_SLABS 281 -#define VAR_NUM_QUERIES_PER_THREAD 282 -#define VAR_RRSET_CACHE_SIZE 283 -#define VAR_RRSET_CACHE_SLABS 284 -#define VAR_OUTGOING_NUM_TCP 285 -#define VAR_INFRA_HOST_TTL 286 -#define VAR_INFRA_LAME_TTL 287 -#define VAR_INFRA_CACHE_SLABS 288 -#define VAR_INFRA_CACHE_NUMHOSTS 289 -#define VAR_INFRA_CACHE_LAME_SIZE 290 -#define VAR_NAME 291 -#define VAR_STUB_ZONE 292 -#define VAR_STUB_HOST 293 -#define VAR_STUB_ADDR 294 -#define VAR_TARGET_FETCH_POLICY 295 -#define VAR_HARDEN_SHORT_BUFSIZE 296 -#define VAR_HARDEN_LARGE_QUERIES 297 -#define VAR_FORWARD_ZONE 298 -#define VAR_FORWARD_HOST 299 -#define VAR_FORWARD_ADDR 300 -#define VAR_DO_NOT_QUERY_ADDRESS 301 -#define VAR_HIDE_IDENTITY 302 -#define VAR_HIDE_VERSION 303 -#define VAR_IDENTITY 304 -#define VAR_VERSION 305 -#define VAR_HARDEN_GLUE 306 -#define VAR_MODULE_CONF 307 -#define VAR_TRUST_ANCHOR_FILE 308 -#define VAR_TRUST_ANCHOR 309 -#define VAR_VAL_OVERRIDE_DATE 310 -#define VAR_BOGUS_TTL 311 -#define VAR_VAL_CLEAN_ADDITIONAL 312 -#define VAR_VAL_PERMISSIVE_MODE 313 -#define VAR_INCOMING_NUM_TCP 314 -#define VAR_MSG_BUFFER_SIZE 315 -#define VAR_KEY_CACHE_SIZE 316 -#define VAR_KEY_CACHE_SLABS 317 -#define VAR_TRUSTED_KEYS_FILE 318 -#define VAR_VAL_NSEC3_KEYSIZE_ITERATIONS 319 -#define VAR_USE_SYSLOG 320 -#define VAR_OUTGOING_INTERFACE 321 -#define VAR_ROOT_HINTS 322 -#define VAR_DO_NOT_QUERY_LOCALHOST 323 -#define VAR_CACHE_MAX_TTL 324 -#define VAR_HARDEN_DNSSEC_STRIPPED 325 -#define VAR_ACCESS_CONTROL 326 -#define VAR_LOCAL_ZONE 327 -#define VAR_LOCAL_DATA 328 -#define VAR_INTERFACE_AUTOMATIC 329 -#define VAR_STATISTICS_INTERVAL 330 -#define VAR_DO_DAEMONIZE 331 -#define VAR_USE_CAPS_FOR_ID 332 -#define VAR_STATISTICS_CUMULATIVE 333 -#define VAR_OUTGOING_PORT_PERMIT 334 -#define VAR_OUTGOING_PORT_AVOID 335 -#define VAR_DLV_ANCHOR_FILE 336 -#define VAR_DLV_ANCHOR 337 -#define VAR_NEG_CACHE_SIZE 338 -#define VAR_HARDEN_REFERRAL_PATH 339 -#define VAR_PRIVATE_ADDRESS 340 -#define VAR_PRIVATE_DOMAIN 341 -#define VAR_REMOTE_CONTROL 342 -#define VAR_CONTROL_ENABLE 343 -#define VAR_CONTROL_INTERFACE 344 -#define VAR_CONTROL_PORT 345 -#define VAR_SERVER_KEY_FILE 346 -#define VAR_SERVER_CERT_FILE 347 -#define VAR_CONTROL_KEY_FILE 348 -#define VAR_CONTROL_CERT_FILE 349 -#define VAR_EXTENDED_STATISTICS 350 -#define VAR_LOCAL_DATA_PTR 351 -#define VAR_JOSTLE_TIMEOUT 352 -#define VAR_STUB_PRIME 353 -#define VAR_UNWANTED_REPLY_THRESHOLD 354 -#define VAR_LOG_TIME_ASCII 355 -#define VAR_DOMAIN_INSECURE 356 -#define VAR_PYTHON 357 -#define VAR_PYTHON_SCRIPT 358 -#define VAR_VAL_SIG_SKEW_MIN 359 -#define VAR_VAL_SIG_SKEW_MAX 360 -#define VAR_CACHE_MIN_TTL 361 -#define VAR_VAL_LOG_LEVEL 362 -#define VAR_AUTO_TRUST_ANCHOR_FILE 363 -#define VAR_KEEP_MISSING 364 -#define VAR_ADD_HOLDDOWN 365 -#define VAR_DEL_HOLDDOWN 366 -#define VAR_SO_RCVBUF 367 -#define VAR_EDNS_BUFFER_SIZE 368 -#define VAR_PREFETCH 369 -#define VAR_PREFETCH_KEY 370 -#define VAR_SO_SNDBUF 371 -#define VAR_HARDEN_BELOW_NXDOMAIN 372 -#define VAR_IGNORE_CD_FLAG 373 -#define VAR_LOG_QUERIES 374 -#define VAR_TCP_UPSTREAM 375 -#define VAR_SSL_UPSTREAM 376 -#define VAR_SSL_SERVICE_KEY 377 -#define VAR_SSL_SERVICE_PEM 378 -#define VAR_SSL_PORT 379 -#define VAR_FORWARD_FIRST 380 -#define VAR_STUB_FIRST 381 -#define VAR_MINIMAL_RESPONSES 382 -#define VAR_RRSET_ROUNDROBIN 383 -#ifdef YYSTYPE -#undef YYSTYPE_IS_DECLARED -#define YYSTYPE_IS_DECLARED 1 -#endif -#ifndef YYSTYPE_IS_DECLARED -#define YYSTYPE_IS_DECLARED 1 -typedef union { - char* str; -} YYSTYPE; -#endif /* !YYSTYPE_IS_DECLARED */ -extern YYSTYPE yylval; diff --git a/contrib/unbound/util/configparser.y b/contrib/unbound/util/configparser.y index 0dbee2b498c..f119507f289 100644 --- a/contrib/unbound/util/configparser.y +++ b/contrib/unbound/util/configparser.y @@ -23,16 +23,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ %{ @@ -44,7 +44,6 @@ #include #include -#include "util/configyyrename.h" #include "util/config_file.h" #include "util/net_help.h" @@ -101,10 +100,11 @@ extern struct config_parser_state* cfg_parser; %token VAR_VAL_SIG_SKEW_MAX VAR_CACHE_MIN_TTL VAR_VAL_LOG_LEVEL %token VAR_AUTO_TRUST_ANCHOR_FILE VAR_KEEP_MISSING VAR_ADD_HOLDDOWN %token VAR_DEL_HOLDDOWN VAR_SO_RCVBUF VAR_EDNS_BUFFER_SIZE VAR_PREFETCH -%token VAR_PREFETCH_KEY VAR_SO_SNDBUF VAR_HARDEN_BELOW_NXDOMAIN +%token VAR_PREFETCH_KEY VAR_SO_SNDBUF VAR_SO_REUSEPORT VAR_HARDEN_BELOW_NXDOMAIN %token VAR_IGNORE_CD_FLAG VAR_LOG_QUERIES VAR_TCP_UPSTREAM VAR_SSL_UPSTREAM %token VAR_SSL_SERVICE_KEY VAR_SSL_SERVICE_PEM VAR_SSL_PORT VAR_FORWARD_FIRST %token VAR_STUB_FIRST VAR_MINIMAL_RESPONSES VAR_RRSET_ROUNDROBIN +%token VAR_MAX_UDP_SIZE VAR_DELAY_CLOSE VAR_UNBLOCK_LAN_ZONES %% toplevelvars: /* empty */ | toplevelvars toplevelvar ; @@ -161,7 +161,8 @@ content_server: server_num_threads | server_verbosity | server_port | server_so_sndbuf | server_harden_below_nxdomain | server_ignore_cd_flag | server_log_queries | server_tcp_upstream | server_ssl_upstream | server_ssl_service_key | server_ssl_service_pem | server_ssl_port | - server_minimal_responses | server_rrset_roundrobin + server_minimal_responses | server_rrset_roundrobin | server_max_udp_size | + server_so_reuseport | server_delay_close | server_unblock_lan_zones ; stubstart: VAR_STUB_ZONE { @@ -594,6 +595,16 @@ server_so_sndbuf: VAR_SO_SNDBUF STRING_ARG free($2); } ; +server_so_reuseport: VAR_SO_REUSEPORT STRING_ARG + { + OUTYY(("P(server_so_reuseport:%s)\n", $2)); + if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0) + yyerror("expected yes or no."); + else cfg_parser->cfg->so_reuseport = + (strcmp($2, "yes")==0); + free($2); + } + ; server_edns_buffer_size: VAR_EDNS_BUFFER_SIZE STRING_ARG { OUTYY(("P(server_edns_buffer_size:%s)\n", $2)); @@ -657,6 +668,25 @@ server_jostle_timeout: VAR_JOSTLE_TIMEOUT STRING_ARG free($2); } ; +server_delay_close: VAR_DELAY_CLOSE STRING_ARG + { + OUTYY(("P(server_delay_close:%s)\n", $2)); + if(atoi($2) == 0 && strcmp($2, "0") != 0) + yyerror("number expected"); + else cfg_parser->cfg->delay_close = atoi($2); + free($2); + } + ; +server_unblock_lan_zones: VAR_UNBLOCK_LAN_ZONES STRING_ARG + { + OUTYY(("P(server_unblock_lan_zones:%s)\n", $2)); + if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0) + yyerror("expected yes or no."); + else cfg_parser->cfg->unblock_lan_zones = + (strcmp($2, "yes")==0); + free($2); + } + ; server_rrset_cache_size: VAR_RRSET_CACHE_SIZE STRING_ARG { OUTYY(("P(server_rrset_cache_size:%s)\n", $2)); @@ -864,9 +894,12 @@ server_access_control: VAR_ACCESS_CONTROL STRING_ARG STRING_ARG { OUTYY(("P(server_access_control:%s %s)\n", $2, $3)); if(strcmp($3, "deny")!=0 && strcmp($3, "refuse")!=0 && + strcmp($3, "deny_non_local")!=0 && + strcmp($3, "refuse_non_local")!=0 && strcmp($3, "allow")!=0 && strcmp($3, "allow_snoop")!=0) { - yyerror("expected deny, refuse, allow or allow_snoop " + yyerror("expected deny, refuse, deny_non_local, " + "refuse_non_local, allow or allow_snoop " "in access control action"); } else { if(!cfg_str2list_insert(&cfg_parser->cfg->acls, $2, $3)) @@ -1117,6 +1150,13 @@ server_rrset_roundrobin: VAR_RRSET_ROUNDROBIN STRING_ARG free($2); } ; +server_max_udp_size: VAR_MAX_UDP_SIZE STRING_ARG + { + OUTYY(("P(server_max_udp_size:%s)\n", $2)); + cfg_parser->cfg->max_udp_size = atoi($2); + free($2); + } + ; stub_name: VAR_NAME STRING_ARG { OUTYY(("P(name:%s)\n", $2)); diff --git a/contrib/unbound/util/data/dname.c b/contrib/unbound/util/data/dname.c index d2b299744fb..76f2e645826 100644 --- a/contrib/unbound/util/data/dname.c +++ b/contrib/unbound/util/data/dname.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -45,17 +45,18 @@ #include "util/data/msgparse.h" #include "util/log.h" #include "util/storage/lookup3.h" +#include "ldns/sbuffer.h" /* determine length of a dname in buffer, no compression pointers allowed */ size_t -query_dname_len(ldns_buffer* query) +query_dname_len(sldns_buffer* query) { size_t len = 0; size_t labellen; while(1) { - if(ldns_buffer_remaining(query) < 1) + if(sldns_buffer_remaining(query) < 1) return 0; /* parse error, need label len */ - labellen = ldns_buffer_read_u8(query); + labellen = sldns_buffer_read_u8(query); if(labellen&0xc0) return 0; /* no compression allowed in queries */ len += labellen + 1; @@ -63,9 +64,9 @@ query_dname_len(ldns_buffer* query) return 0; /* too long */ if(labellen == 0) return len; - if(ldns_buffer_remaining(query) < labellen) + if(sldns_buffer_remaining(query) < labellen) return 0; /* parse error, need content */ - ldns_buffer_skip(query, (ssize_t)labellen); + sldns_buffer_skip(query, (ssize_t)labellen); } } @@ -145,31 +146,31 @@ query_dname_tolower(uint8_t* dname) } void -pkt_dname_tolower(ldns_buffer* pkt, uint8_t* dname) +pkt_dname_tolower(sldns_buffer* pkt, uint8_t* dname) { uint8_t lablen; int count = 0; - if(dname >= ldns_buffer_end(pkt)) + if(dname >= sldns_buffer_end(pkt)) return; lablen = *dname++; while(lablen) { if(LABEL_IS_PTR(lablen)) { if((size_t)PTR_OFFSET(lablen, *dname) - >= ldns_buffer_limit(pkt)) + >= sldns_buffer_limit(pkt)) return; - dname = ldns_buffer_at(pkt, PTR_OFFSET(lablen, *dname)); + dname = sldns_buffer_at(pkt, PTR_OFFSET(lablen, *dname)); lablen = *dname++; if(count++ > MAX_COMPRESS_PTRS) return; continue; } - if(dname+lablen >= ldns_buffer_end(pkt)) + if(dname+lablen >= sldns_buffer_end(pkt)) return; while(lablen--) { *dname = (uint8_t)tolower((int)*dname); dname++; } - if(dname >= ldns_buffer_end(pkt)) + if(dname >= sldns_buffer_end(pkt)) return; lablen = *dname++; } @@ -177,7 +178,7 @@ pkt_dname_tolower(ldns_buffer* pkt, uint8_t* dname) size_t -pkt_dname_len(ldns_buffer* pkt) +pkt_dname_len(sldns_buffer* pkt) { size_t len = 0; int ptrcount = 0; @@ -188,22 +189,22 @@ pkt_dname_len(ldns_buffer* pkt) /* check compression pointers, loops, out of bounds */ while(1) { /* read next label */ - if(ldns_buffer_remaining(pkt) < 1) + if(sldns_buffer_remaining(pkt) < 1) return 0; - labellen = ldns_buffer_read_u8(pkt); + labellen = sldns_buffer_read_u8(pkt); if(LABEL_IS_PTR(labellen)) { /* compression ptr */ uint16_t ptr; - if(ldns_buffer_remaining(pkt) < 1) + if(sldns_buffer_remaining(pkt) < 1) return 0; - ptr = PTR_OFFSET(labellen, ldns_buffer_read_u8(pkt)); + ptr = PTR_OFFSET(labellen, sldns_buffer_read_u8(pkt)); if(ptrcount++ > MAX_COMPRESS_PTRS) return 0; /* loop! */ - if(ldns_buffer_limit(pkt) <= ptr) + if(sldns_buffer_limit(pkt) <= ptr) return 0; /* out of bounds! */ if(!endpos) - endpos = ldns_buffer_position(pkt); - ldns_buffer_set_position(pkt, ptr); + endpos = sldns_buffer_position(pkt); + sldns_buffer_set_position(pkt, ptr); } else { /* label contents */ if(labellen > 0x3f) @@ -215,19 +216,19 @@ pkt_dname_len(ldns_buffer* pkt) /* end of dname */ break; } - if(ldns_buffer_remaining(pkt) < labellen) + if(sldns_buffer_remaining(pkt) < labellen) return 0; - ldns_buffer_skip(pkt, (ssize_t)labellen); + sldns_buffer_skip(pkt, (ssize_t)labellen); } } if(endpos) - ldns_buffer_set_position(pkt, endpos); + sldns_buffer_set_position(pkt, endpos); return len; } int -dname_pkt_compare(ldns_buffer* pkt, uint8_t* d1, uint8_t* d2) +dname_pkt_compare(sldns_buffer* pkt, uint8_t* d1, uint8_t* d2) { uint8_t len1, len2; log_assert(pkt && d1 && d2); @@ -236,12 +237,12 @@ dname_pkt_compare(ldns_buffer* pkt, uint8_t* d1, uint8_t* d2) while( len1 != 0 || len2 != 0 ) { /* resolve ptrs */ if(LABEL_IS_PTR(len1)) { - d1 = ldns_buffer_at(pkt, PTR_OFFSET(len1, *d1)); + d1 = sldns_buffer_at(pkt, PTR_OFFSET(len1, *d1)); len1 = *d1++; continue; } if(LABEL_IS_PTR(len2)) { - d2 = ldns_buffer_at(pkt, PTR_OFFSET(len2, *d2)); + d2 = sldns_buffer_at(pkt, PTR_OFFSET(len2, *d2)); len2 = *d2++; continue; } @@ -290,7 +291,7 @@ dname_query_hash(uint8_t* dname, hashvalue_t h) } hashvalue_t -dname_pkt_hash(ldns_buffer* pkt, uint8_t* dname, hashvalue_t h) +dname_pkt_hash(sldns_buffer* pkt, uint8_t* dname, hashvalue_t h) { uint8_t labuf[LDNS_MAX_LABELLEN+1]; uint8_t lablen; @@ -301,7 +302,7 @@ dname_pkt_hash(ldns_buffer* pkt, uint8_t* dname, hashvalue_t h) while(lablen) { if(LABEL_IS_PTR(lablen)) { /* follow pointer */ - dname = ldns_buffer_at(pkt, PTR_OFFSET(lablen, *dname)); + dname = sldns_buffer_at(pkt, PTR_OFFSET(lablen, *dname)); lablen = *dname++; continue; } @@ -317,7 +318,7 @@ dname_pkt_hash(ldns_buffer* pkt, uint8_t* dname, hashvalue_t h) return h; } -void dname_pkt_copy(ldns_buffer* pkt, uint8_t* to, uint8_t* dname) +void dname_pkt_copy(sldns_buffer* pkt, uint8_t* to, uint8_t* dname) { /* copy over the dname and decompress it at the same time */ size_t len = 0; @@ -326,7 +327,7 @@ void dname_pkt_copy(ldns_buffer* pkt, uint8_t* to, uint8_t* dname) while(lablen) { if(LABEL_IS_PTR(lablen)) { /* follow pointer */ - dname = ldns_buffer_at(pkt, PTR_OFFSET(lablen, *dname)); + dname = sldns_buffer_at(pkt, PTR_OFFSET(lablen, *dname)); lablen = *dname++; continue; } @@ -347,7 +348,7 @@ void dname_pkt_copy(ldns_buffer* pkt, uint8_t* to, uint8_t* dname) *to = 0; } -void dname_print(FILE* out, ldns_buffer* pkt, uint8_t* dname) +void dname_print(FILE* out, struct sldns_buffer* pkt, uint8_t* dname) { uint8_t lablen; if(!out) out = stdout; @@ -363,7 +364,7 @@ void dname_print(FILE* out, ldns_buffer* pkt, uint8_t* dname) fputs("??compressionptr??", out); return; } - dname = ldns_buffer_at(pkt, PTR_OFFSET(lablen, *dname)); + dname = sldns_buffer_at(pkt, PTR_OFFSET(lablen, *dname)); lablen = *dname++; continue; } @@ -517,21 +518,21 @@ dname_lab_cmp(uint8_t* d1, int labs1, uint8_t* d2, int labs2, int* mlabs) } int -dname_buffer_write(ldns_buffer* pkt, uint8_t* dname) +dname_buffer_write(sldns_buffer* pkt, uint8_t* dname) { uint8_t lablen; - if(ldns_buffer_remaining(pkt) < 1) + if(sldns_buffer_remaining(pkt) < 1) return 0; lablen = *dname++; - ldns_buffer_write_u8(pkt, lablen); + sldns_buffer_write_u8(pkt, lablen); while(lablen) { - if(ldns_buffer_remaining(pkt) < (size_t)lablen+1) + if(sldns_buffer_remaining(pkt) < (size_t)lablen+1) return 0; - ldns_buffer_write(pkt, dname, lablen); + sldns_buffer_write(pkt, dname, lablen); dname += lablen; lablen = *dname++; - ldns_buffer_write_u8(pkt, lablen); + sldns_buffer_write_u8(pkt, lablen); } return 1; } diff --git a/contrib/unbound/util/data/dname.h b/contrib/unbound/util/data/dname.h index b942848a9dc..ae2fbadc1d8 100644 --- a/contrib/unbound/util/data/dname.h +++ b/contrib/unbound/util/data/dname.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -45,6 +45,7 @@ #ifndef UTIL_DATA_DNAME_H #define UTIL_DATA_DNAME_H #include "util/storage/lruhash.h" +struct sldns_buffer; /** max number of compression ptrs to follow */ #define MAX_COMPRESS_PTRS 256 @@ -55,7 +56,7 @@ * at end, position is at end of the dname. * @return: 0 on parse failure, or length including ending 0 of dname. */ -size_t query_dname_len(ldns_buffer* query); +size_t query_dname_len(struct sldns_buffer* query); /** * Determine if dname in memory is correct. no compression ptrs allowed. @@ -74,7 +75,7 @@ void query_dname_tolower(uint8_t* dname); * is unchanged. * @param dname: start of dname in packet. */ -void pkt_dname_tolower(ldns_buffer* pkt, uint8_t* dname); +void pkt_dname_tolower(struct sldns_buffer* pkt, uint8_t* dname); /** * Compare query dnames (uncompressed storage). The Dnames passed do not @@ -106,7 +107,7 @@ int query_dname_compare(uint8_t* d1, uint8_t* d2); * Compression pointers are followed and checked for loops. * The uncompressed wireformat length is returned. */ -size_t pkt_dname_len(ldns_buffer* pkt); +size_t pkt_dname_len(struct sldns_buffer* pkt); /** * Compare dnames in packet (compressed). Dnames must be valid. @@ -117,7 +118,7 @@ size_t pkt_dname_len(ldns_buffer* pkt); * @return: -1, 0, or +1 depending on comparison results. * Sort order is first difference found. not the canonical ordering. */ -int dname_pkt_compare(ldns_buffer* pkt, uint8_t* d1, uint8_t* d2); +int dname_pkt_compare(struct sldns_buffer* pkt, uint8_t* d1, uint8_t* d2); /** * Hash dname, label by label, lowercasing, into hashvalue. @@ -138,7 +139,7 @@ hashvalue_t dname_query_hash(uint8_t* dname, hashvalue_t h); * @return: result hash value. * Result is the same as dname_query_hash, even if compression is used. */ -hashvalue_t dname_pkt_hash(ldns_buffer* pkt, uint8_t* dname, hashvalue_t h); +hashvalue_t dname_pkt_hash(struct sldns_buffer* pkt, uint8_t* dname, hashvalue_t h); /** * Copy over a valid dname and decompress it. @@ -146,7 +147,7 @@ hashvalue_t dname_pkt_hash(ldns_buffer* pkt, uint8_t* dname, hashvalue_t h); * @param to: buffer of size from pkt_len function to hold result. * @param dname: pointer into packet where dname starts. */ -void dname_pkt_copy(ldns_buffer* pkt, uint8_t* to, uint8_t* dname); +void dname_pkt_copy(struct sldns_buffer* pkt, uint8_t* to, uint8_t* dname); /** * Copy over a valid dname to a packet. @@ -154,7 +155,7 @@ void dname_pkt_copy(ldns_buffer* pkt, uint8_t* to, uint8_t* dname); * @param dname: dname to copy. * @return: 0 if not enough space in buffer. */ -int dname_buffer_write(ldns_buffer* pkt, uint8_t* dname); +int dname_buffer_write(struct sldns_buffer* pkt, uint8_t* dname); /** * Count the number of labels in an uncompressed dname in memory. @@ -216,7 +217,7 @@ int dname_subdomain_c(uint8_t* d1, uint8_t* d2); * @param pkt: if not NULL, the packet for resolving compression ptrs. * @param dname: pointer to (start of) dname. */ -void dname_print(FILE* out, ldns_buffer* pkt, uint8_t* dname); +void dname_print(FILE* out, struct sldns_buffer* pkt, uint8_t* dname); /** * Debug helper. Print dname to given string buffer (string buffer must diff --git a/contrib/unbound/util/data/msgencode.c b/contrib/unbound/util/data/msgencode.c index 157796deb95..26b5deabe4d 100644 --- a/contrib/unbound/util/data/msgencode.c +++ b/contrib/unbound/util/data/msgencode.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -40,7 +40,6 @@ */ #include "config.h" -#include #include "util/data/msgencode.h" #include "util/data/msgreply.h" #include "util/data/msgparse.h" @@ -48,6 +47,7 @@ #include "util/log.h" #include "util/regional.h" #include "util/net_help.h" +#include "ldns/sbuffer.h" /** return code that means the function ran out of memory. negative so it does * not conflict with DNS rcodes. */ @@ -243,7 +243,7 @@ compress_tree_store(uint8_t* dname, int labs, size_t offset, /** compress a domain name */ static int -write_compressed_dname(ldns_buffer* pkt, uint8_t* dname, int labs, +write_compressed_dname(sldns_buffer* pkt, uint8_t* dname, int labs, struct compress_tree_node* p) { /* compress it */ @@ -253,32 +253,32 @@ write_compressed_dname(ldns_buffer* pkt, uint8_t* dname, int labs, if(labs == 1) { /* write root label */ - if(ldns_buffer_remaining(pkt) < 1) + if(sldns_buffer_remaining(pkt) < 1) return 0; - ldns_buffer_write_u8(pkt, 0); + sldns_buffer_write_u8(pkt, 0); return 1; } /* copy the first couple of labels */ while(labcopy--) { lablen = *dname++; - if(ldns_buffer_remaining(pkt) < (size_t)lablen+1) + if(sldns_buffer_remaining(pkt) < (size_t)lablen+1) return 0; - ldns_buffer_write_u8(pkt, lablen); - ldns_buffer_write(pkt, dname, lablen); + sldns_buffer_write_u8(pkt, lablen); + sldns_buffer_write(pkt, dname, lablen); dname += lablen; } /* insert compression ptr */ - if(ldns_buffer_remaining(pkt) < 2) + if(sldns_buffer_remaining(pkt) < 2) return 0; ptr = PTR_CREATE(p->offset); - ldns_buffer_write_u16(pkt, ptr); + sldns_buffer_write_u16(pkt, ptr); return 1; } /** compress owner name of RR, return RETVAL_OUTMEM RETVAL_TRUNC */ static int -compress_owner(struct ub_packed_rrset_key* key, ldns_buffer* pkt, +compress_owner(struct ub_packed_rrset_key* key, sldns_buffer* pkt, struct regional* region, struct compress_tree_node** tree, size_t owner_pos, uint16_t* owner_ptr, int owner_labs) { @@ -296,13 +296,13 @@ compress_owner(struct ub_packed_rrset_key* key, ldns_buffer* pkt, owner_labs, p)) return RETVAL_TRUNC; /* check if typeclass+4 ttl + rdatalen is available */ - if(ldns_buffer_remaining(pkt) < 4+4+2) + if(sldns_buffer_remaining(pkt) < 4+4+2) return RETVAL_TRUNC; } else { /* no compress */ - if(ldns_buffer_remaining(pkt) < key->rk.dname_len+4+4+2) + if(sldns_buffer_remaining(pkt) < key->rk.dname_len+4+4+2) return RETVAL_TRUNC; - ldns_buffer_write(pkt, key->rk.dname, + sldns_buffer_write(pkt, key->rk.dname, key->rk.dname_len); if(owner_pos <= PTR_MAX_OFFSET) *owner_ptr = htons(PTR_CREATE(owner_pos)); @@ -313,13 +313,13 @@ compress_owner(struct ub_packed_rrset_key* key, ldns_buffer* pkt, } else { /* always compress 2nd-further RRs in RRset */ if(owner_labs == 1) { - if(ldns_buffer_remaining(pkt) < 1+4+4+2) + if(sldns_buffer_remaining(pkt) < 1+4+4+2) return RETVAL_TRUNC; - ldns_buffer_write_u8(pkt, 0); + sldns_buffer_write_u8(pkt, 0); } else { - if(ldns_buffer_remaining(pkt) < 2+4+4+2) + if(sldns_buffer_remaining(pkt) < 2+4+4+2) return RETVAL_TRUNC; - ldns_buffer_write(pkt, owner_ptr, 2); + sldns_buffer_write(pkt, owner_ptr, 2); } } return RETVAL_OK; @@ -327,12 +327,12 @@ compress_owner(struct ub_packed_rrset_key* key, ldns_buffer* pkt, /** compress any domain name to the packet, return RETVAL_* */ static int -compress_any_dname(uint8_t* dname, ldns_buffer* pkt, int labs, +compress_any_dname(uint8_t* dname, sldns_buffer* pkt, int labs, struct regional* region, struct compress_tree_node** tree) { struct compress_tree_node* p; struct compress_tree_node** insertpt = NULL; - size_t pos = ldns_buffer_position(pkt); + size_t pos = sldns_buffer_position(pkt); if((p = compress_tree_lookup(tree, dname, labs, &insertpt))) { if(!write_compressed_dname(pkt, dname, labs, p)) return RETVAL_TRUNC; @@ -346,27 +346,27 @@ compress_any_dname(uint8_t* dname, ldns_buffer* pkt, int labs, } /** return true if type needs domain name compression in rdata */ -static const ldns_rr_descriptor* +static const sldns_rr_descriptor* type_rdata_compressable(struct ub_packed_rrset_key* key) { uint16_t t = ntohs(key->rk.type); - if(ldns_rr_descript(t) && - ldns_rr_descript(t)->_compress == LDNS_RR_COMPRESS) - return ldns_rr_descript(t); + if(sldns_rr_descript(t) && + sldns_rr_descript(t)->_compress == LDNS_RR_COMPRESS) + return sldns_rr_descript(t); return 0; } /** compress domain names in rdata, return RETVAL_* */ static int -compress_rdata(ldns_buffer* pkt, uint8_t* rdata, size_t todolen, +compress_rdata(sldns_buffer* pkt, uint8_t* rdata, size_t todolen, struct regional* region, struct compress_tree_node** tree, - const ldns_rr_descriptor* desc) + const sldns_rr_descriptor* desc) { int labs, r, rdf = 0; - size_t dname_len, len, pos = ldns_buffer_position(pkt); + size_t dname_len, len, pos = sldns_buffer_position(pkt); uint8_t count = desc->_dname_count; - ldns_buffer_skip(pkt, 2); /* rdata len fill in later */ + sldns_buffer_skip(pkt, 2); /* rdata len fill in later */ /* space for rdatalen checked for already */ rdata += 2; todolen -= 2; @@ -390,9 +390,9 @@ compress_rdata(ldns_buffer* pkt, uint8_t* rdata, size_t todolen, } if(len) { /* copy over */ - if(ldns_buffer_remaining(pkt) < len) + if(sldns_buffer_remaining(pkt) < len) return RETVAL_TRUNC; - ldns_buffer_write(pkt, rdata, len); + sldns_buffer_write(pkt, rdata, len); todolen -= len; rdata += len; } @@ -400,19 +400,19 @@ compress_rdata(ldns_buffer* pkt, uint8_t* rdata, size_t todolen, } /* copy remainder */ if(todolen > 0) { - if(ldns_buffer_remaining(pkt) < todolen) + if(sldns_buffer_remaining(pkt) < todolen) return RETVAL_TRUNC; - ldns_buffer_write(pkt, rdata, todolen); + sldns_buffer_write(pkt, rdata, todolen); } /* set rdata len */ - ldns_buffer_write_u16_at(pkt, pos, ldns_buffer_position(pkt)-pos-2); + sldns_buffer_write_u16_at(pkt, pos, sldns_buffer_position(pkt)-pos-2); return RETVAL_OK; } /** Returns true if RR type should be included */ static int -rrset_belongs_in_reply(ldns_pkt_section s, uint16_t rrtype, uint16_t qtype, +rrset_belongs_in_reply(sldns_pkt_section s, uint16_t rrtype, uint16_t qtype, int dnssec) { if(dnssec) @@ -440,10 +440,10 @@ rrset_belongs_in_reply(ldns_pkt_section s, uint16_t rrtype, uint16_t qtype, /** store rrset in buffer in wireformat, return RETVAL_* */ static int -packed_rrset_encode(struct ub_packed_rrset_key* key, ldns_buffer* pkt, - uint16_t* num_rrs, uint32_t timenow, struct regional* region, +packed_rrset_encode(struct ub_packed_rrset_key* key, sldns_buffer* pkt, + uint16_t* num_rrs, time_t timenow, struct regional* region, int do_data, int do_sig, struct compress_tree_node** tree, - ldns_pkt_section s, uint16_t qtype, int dnssec, size_t rr_offset) + sldns_pkt_section s, uint16_t qtype, int dnssec, size_t rr_offset) { size_t i, j, owner_pos; int r, owner_labs; @@ -456,10 +456,10 @@ packed_rrset_encode(struct ub_packed_rrset_key* key, ldns_buffer* pkt, return RETVAL_OK; owner_labs = dname_count_labels(key->rk.dname); - owner_pos = ldns_buffer_position(pkt); + owner_pos = sldns_buffer_position(pkt); if(do_data) { - const ldns_rr_descriptor* c = type_rdata_compressable(key); + const sldns_rr_descriptor* c = type_rdata_compressable(key); for(i=0; icount; i++) { /* rrset roundrobin */ j = (i + rr_offset) % data->count; @@ -467,11 +467,11 @@ packed_rrset_encode(struct ub_packed_rrset_key* key, ldns_buffer* pkt, owner_pos, &owner_ptr, owner_labs)) != RETVAL_OK) return r; - ldns_buffer_write(pkt, &key->rk.type, 2); - ldns_buffer_write(pkt, &key->rk.rrset_class, 2); + sldns_buffer_write(pkt, &key->rk.type, 2); + sldns_buffer_write(pkt, &key->rk.rrset_class, 2); if(data->rr_ttl[j] < timenow) - ldns_buffer_write_u32(pkt, 0); - else ldns_buffer_write_u32(pkt, + sldns_buffer_write_u32(pkt, 0); + else sldns_buffer_write_u32(pkt, data->rr_ttl[j]-timenow); if(c) { if((r=compress_rdata(pkt, data->rr_data[j], @@ -479,9 +479,9 @@ packed_rrset_encode(struct ub_packed_rrset_key* key, ldns_buffer* pkt, != RETVAL_OK) return r; } else { - if(ldns_buffer_remaining(pkt) < data->rr_len[j]) + if(sldns_buffer_remaining(pkt) < data->rr_len[j]) return RETVAL_TRUNC; - ldns_buffer_write(pkt, data->rr_data[j], + sldns_buffer_write(pkt, data->rr_data[j], data->rr_len[j]); } } @@ -491,28 +491,28 @@ packed_rrset_encode(struct ub_packed_rrset_key* key, ldns_buffer* pkt, size_t total = data->count+data->rrsig_count; for(i=data->count; irr_len[i]) return RETVAL_TRUNC; - ldns_buffer_write(pkt, &owner_ptr, 2); + sldns_buffer_write(pkt, &owner_ptr, 2); } else { if((r=compress_any_dname(key->rk.dname, pkt, owner_labs, region, tree)) != RETVAL_OK) return r; - if(ldns_buffer_remaining(pkt) < + if(sldns_buffer_remaining(pkt) < 4+4+data->rr_len[i]) return RETVAL_TRUNC; } - ldns_buffer_write_u16(pkt, LDNS_RR_TYPE_RRSIG); - ldns_buffer_write(pkt, &key->rk.rrset_class, 2); + sldns_buffer_write_u16(pkt, LDNS_RR_TYPE_RRSIG); + sldns_buffer_write(pkt, &key->rk.rrset_class, 2); if(data->rr_ttl[i] < timenow) - ldns_buffer_write_u32(pkt, 0); - else ldns_buffer_write_u32(pkt, + sldns_buffer_write_u32(pkt, 0); + else sldns_buffer_write_u32(pkt, data->rr_ttl[i]-timenow); /* rrsig rdata cannot be compressed, perform 100+ byte * memcopy. */ - ldns_buffer_write(pkt, data->rr_data[i], + sldns_buffer_write(pkt, data->rr_data[i], data->rr_len[i]); } } @@ -528,9 +528,9 @@ packed_rrset_encode(struct ub_packed_rrset_key* key, ldns_buffer* pkt, /** store msg section in wireformat buffer, return RETVAL_* */ static int insert_section(struct reply_info* rep, size_t num_rrsets, uint16_t* num_rrs, - ldns_buffer* pkt, size_t rrsets_before, uint32_t timenow, + sldns_buffer* pkt, size_t rrsets_before, time_t timenow, struct regional* region, struct compress_tree_node** tree, - ldns_pkt_section s, uint16_t qtype, int dnssec, size_t rr_offset) + sldns_pkt_section s, uint16_t qtype, int dnssec, size_t rr_offset) { int r; size_t i, setstart; @@ -539,36 +539,36 @@ insert_section(struct reply_info* rep, size_t num_rrsets, uint16_t* num_rrs, if(s == LDNS_SECTION_ANSWER && qtype == LDNS_RR_TYPE_ANY) dnssec = 1; /* include all types in ANY answer */ for(i=0; irrsets[rrsets_before+i], pkt, num_rrs, timenow, region, 1, 1, tree, s, qtype, dnssec, rr_offset)) != RETVAL_OK) { /* Bad, but if due to size must set TC bit */ /* trim off the rrset neatly. */ - ldns_buffer_set_position(pkt, setstart); + sldns_buffer_set_position(pkt, setstart); return r; } } } else { for(i=0; irrsets[rrsets_before+i], pkt, num_rrs, timenow, region, 1, 0, tree, s, qtype, dnssec, rr_offset)) != RETVAL_OK) { - ldns_buffer_set_position(pkt, setstart); + sldns_buffer_set_position(pkt, setstart); return r; } } if(dnssec) for(i=0; irrsets[rrsets_before+i], pkt, num_rrs, timenow, region, 0, 1, tree, s, qtype, dnssec, rr_offset)) != RETVAL_OK) { - ldns_buffer_set_position(pkt, setstart); + sldns_buffer_set_position(pkt, setstart); return r; } } @@ -579,21 +579,21 @@ insert_section(struct reply_info* rep, size_t num_rrsets, uint16_t* num_rrs, /** store query section in wireformat buffer, return RETVAL */ static int insert_query(struct query_info* qinfo, struct compress_tree_node** tree, - ldns_buffer* buffer, struct regional* region) + sldns_buffer* buffer, struct regional* region) { - if(ldns_buffer_remaining(buffer) < + if(sldns_buffer_remaining(buffer) < qinfo->qname_len+sizeof(uint16_t)*2) return RETVAL_TRUNC; /* buffer too small */ /* the query is the first name inserted into the tree */ if(!compress_tree_store(qinfo->qname, dname_count_labels(qinfo->qname), - ldns_buffer_position(buffer), region, NULL, tree)) + sldns_buffer_position(buffer), region, NULL, tree)) return RETVAL_OUTMEM; - if(ldns_buffer_current(buffer) == qinfo->qname) - ldns_buffer_skip(buffer, (ssize_t)qinfo->qname_len); - else ldns_buffer_write(buffer, qinfo->qname, qinfo->qname_len); - ldns_buffer_write_u16(buffer, qinfo->qtype); - ldns_buffer_write_u16(buffer, qinfo->qclass); + if(sldns_buffer_current(buffer) == qinfo->qname) + sldns_buffer_skip(buffer, (ssize_t)qinfo->qname_len); + else sldns_buffer_write(buffer, qinfo->qname, qinfo->qname_len); + sldns_buffer_write_u16(buffer, qinfo->qtype); + sldns_buffer_write_u16(buffer, qinfo->qclass); return RETVAL_OK; } @@ -624,7 +624,7 @@ positive_answer(struct reply_info* rep, uint16_t qtype) { int reply_info_encode(struct query_info* qinfo, struct reply_info* rep, - uint16_t id, uint16_t flags, ldns_buffer* buffer, uint32_t timenow, + uint16_t id, uint16_t flags, sldns_buffer* buffer, time_t timenow, struct regional* region, uint16_t udpsize, int dnssec) { uint16_t ancount=0, nscount=0, arcount=0; @@ -632,17 +632,17 @@ reply_info_encode(struct query_info* qinfo, struct reply_info* rep, int r; size_t rr_offset; - ldns_buffer_clear(buffer); - if(udpsize < ldns_buffer_limit(buffer)) - ldns_buffer_set_limit(buffer, udpsize); - if(ldns_buffer_remaining(buffer) < LDNS_HEADER_SIZE) + sldns_buffer_clear(buffer); + if(udpsize < sldns_buffer_limit(buffer)) + sldns_buffer_set_limit(buffer, udpsize); + if(sldns_buffer_remaining(buffer) < LDNS_HEADER_SIZE) return 0; - ldns_buffer_write(buffer, &id, sizeof(uint16_t)); - ldns_buffer_write_u16(buffer, flags); - ldns_buffer_write_u16(buffer, rep->qdcount); + sldns_buffer_write(buffer, &id, sizeof(uint16_t)); + sldns_buffer_write_u16(buffer, flags); + sldns_buffer_write_u16(buffer, rep->qdcount); /* set an, ns, ar counts to zero in case of small packets */ - ldns_buffer_write(buffer, "\000\000\000\000\000\000", 6); + sldns_buffer_write(buffer, "\000\000\000\000\000\000", 6); /* insert query section */ if(rep->qdcount) { @@ -650,16 +650,17 @@ reply_info_encode(struct query_info* qinfo, struct reply_info* rep, RETVAL_OK) { if(r == RETVAL_TRUNC) { /* create truncated message */ - ldns_buffer_write_u16_at(buffer, 4, 0); - LDNS_TC_SET(ldns_buffer_begin(buffer)); - ldns_buffer_flip(buffer); + sldns_buffer_write_u16_at(buffer, 4, 0); + LDNS_TC_SET(sldns_buffer_begin(buffer)); + sldns_buffer_flip(buffer); return 1; } return 0; } } - /* roundrobin offset. using query id for random number */ - rr_offset = RRSET_ROUNDROBIN?id:0; + /* roundrobin offset. using query id for random number. With ntohs + * for different roundrobins for sequential id client senders. */ + rr_offset = RRSET_ROUNDROBIN?ntohs(id):0; /* insert answer section */ if((r=insert_section(rep, rep->an_numrrsets, &ancount, buffer, @@ -667,14 +668,14 @@ reply_info_encode(struct query_info* qinfo, struct reply_info* rep, dnssec, rr_offset)) != RETVAL_OK) { if(r == RETVAL_TRUNC) { /* create truncated message */ - ldns_buffer_write_u16_at(buffer, 6, ancount); - LDNS_TC_SET(ldns_buffer_begin(buffer)); - ldns_buffer_flip(buffer); + sldns_buffer_write_u16_at(buffer, 6, ancount); + LDNS_TC_SET(sldns_buffer_begin(buffer)); + sldns_buffer_flip(buffer); return 1; } return 0; } - ldns_buffer_write_u16_at(buffer, 6, ancount); + sldns_buffer_write_u16_at(buffer, 6, ancount); /* if response is positive answer, auth/add sections are not required */ if( ! (MINIMAL_RESPONSES && positive_answer(rep, qinfo->qtype)) ) { @@ -685,14 +686,14 @@ reply_info_encode(struct query_info* qinfo, struct reply_info* rep, dnssec, rr_offset)) != RETVAL_OK) { if(r == RETVAL_TRUNC) { /* create truncated message */ - ldns_buffer_write_u16_at(buffer, 8, nscount); - LDNS_TC_SET(ldns_buffer_begin(buffer)); - ldns_buffer_flip(buffer); + sldns_buffer_write_u16_at(buffer, 8, nscount); + LDNS_TC_SET(sldns_buffer_begin(buffer)); + sldns_buffer_flip(buffer); return 1; } return 0; } - ldns_buffer_write_u16_at(buffer, 8, nscount); + sldns_buffer_write_u16_at(buffer, 8, nscount); /* insert add section */ if((r=insert_section(rep, rep->ar_numrrsets, &arcount, buffer, @@ -701,18 +702,15 @@ reply_info_encode(struct query_info* qinfo, struct reply_info* rep, dnssec, rr_offset)) != RETVAL_OK) { if(r == RETVAL_TRUNC) { /* no need to set TC bit, this is the additional */ - ldns_buffer_write_u16_at(buffer, 10, arcount); - ldns_buffer_flip(buffer); + sldns_buffer_write_u16_at(buffer, 10, arcount); + sldns_buffer_flip(buffer); return 1; } return 0; } - ldns_buffer_write_u16_at(buffer, 10, arcount); - } else { - ldns_buffer_write_u16_at(buffer, 8, nscount); - ldns_buffer_write_u16_at(buffer, 10, arcount); + sldns_buffer_write_u16_at(buffer, 10, arcount); } - ldns_buffer_flip(buffer); + sldns_buffer_flip(buffer); return 1; } @@ -726,31 +724,31 @@ calc_edns_field_size(struct edns_data* edns) } void -attach_edns_record(ldns_buffer* pkt, struct edns_data* edns) +attach_edns_record(sldns_buffer* pkt, struct edns_data* edns) { size_t len; if(!edns || !edns->edns_present) return; /* inc additional count */ - ldns_buffer_write_u16_at(pkt, 10, - ldns_buffer_read_u16_at(pkt, 10) + 1); - len = ldns_buffer_limit(pkt); - ldns_buffer_clear(pkt); - ldns_buffer_set_position(pkt, len); + sldns_buffer_write_u16_at(pkt, 10, + sldns_buffer_read_u16_at(pkt, 10) + 1); + len = sldns_buffer_limit(pkt); + sldns_buffer_clear(pkt); + sldns_buffer_set_position(pkt, len); /* write EDNS record */ - ldns_buffer_write_u8(pkt, 0); /* '.' label */ - ldns_buffer_write_u16(pkt, LDNS_RR_TYPE_OPT); /* type */ - ldns_buffer_write_u16(pkt, edns->udp_size); /* class */ - ldns_buffer_write_u8(pkt, edns->ext_rcode); /* ttl */ - ldns_buffer_write_u8(pkt, edns->edns_version); - ldns_buffer_write_u16(pkt, edns->bits); - ldns_buffer_write_u16(pkt, 0); /* rdatalen */ - ldns_buffer_flip(pkt); + sldns_buffer_write_u8(pkt, 0); /* '.' label */ + sldns_buffer_write_u16(pkt, LDNS_RR_TYPE_OPT); /* type */ + sldns_buffer_write_u16(pkt, edns->udp_size); /* class */ + sldns_buffer_write_u8(pkt, edns->ext_rcode); /* ttl */ + sldns_buffer_write_u8(pkt, edns->edns_version); + sldns_buffer_write_u16(pkt, edns->bits); + sldns_buffer_write_u16(pkt, 0); /* rdatalen */ + sldns_buffer_flip(pkt); } int reply_info_answer_encode(struct query_info* qinf, struct reply_info* rep, - uint16_t id, uint16_t qflags, ldns_buffer* pkt, uint32_t timenow, + uint16_t id, uint16_t qflags, sldns_buffer* pkt, time_t timenow, int cached, struct regional* region, uint16_t udpsize, struct edns_data* edns, int dnssec, int secure) { @@ -788,54 +786,54 @@ reply_info_answer_encode(struct query_info* qinf, struct reply_info* rep, } void -qinfo_query_encode(ldns_buffer* pkt, struct query_info* qinfo) +qinfo_query_encode(sldns_buffer* pkt, struct query_info* qinfo) { uint16_t flags = 0; /* QUERY, NOERROR */ - ldns_buffer_clear(pkt); - log_assert(ldns_buffer_remaining(pkt) >= 12+255+4/*max query*/); - ldns_buffer_skip(pkt, 2); /* id done later */ - ldns_buffer_write_u16(pkt, flags); - ldns_buffer_write_u16(pkt, 1); /* query count */ - ldns_buffer_write(pkt, "\000\000\000\000\000\000", 6); /* counts */ - ldns_buffer_write(pkt, qinfo->qname, qinfo->qname_len); - ldns_buffer_write_u16(pkt, qinfo->qtype); - ldns_buffer_write_u16(pkt, qinfo->qclass); - ldns_buffer_flip(pkt); + sldns_buffer_clear(pkt); + log_assert(sldns_buffer_remaining(pkt) >= 12+255+4/*max query*/); + sldns_buffer_skip(pkt, 2); /* id done later */ + sldns_buffer_write_u16(pkt, flags); + sldns_buffer_write_u16(pkt, 1); /* query count */ + sldns_buffer_write(pkt, "\000\000\000\000\000\000", 6); /* counts */ + sldns_buffer_write(pkt, qinfo->qname, qinfo->qname_len); + sldns_buffer_write_u16(pkt, qinfo->qtype); + sldns_buffer_write_u16(pkt, qinfo->qclass); + sldns_buffer_flip(pkt); } void -error_encode(ldns_buffer* buf, int r, struct query_info* qinfo, +error_encode(sldns_buffer* buf, int r, struct query_info* qinfo, uint16_t qid, uint16_t qflags, struct edns_data* edns) { uint16_t flags; - ldns_buffer_clear(buf); - ldns_buffer_write(buf, &qid, sizeof(uint16_t)); + sldns_buffer_clear(buf); + sldns_buffer_write(buf, &qid, sizeof(uint16_t)); flags = (uint16_t)(BIT_QR | BIT_RA | r); /* QR and retcode*/ flags |= (qflags & (BIT_RD|BIT_CD)); /* copy RD and CD bit */ - ldns_buffer_write_u16(buf, flags); + sldns_buffer_write_u16(buf, flags); if(qinfo) flags = 1; else flags = 0; - ldns_buffer_write_u16(buf, flags); + sldns_buffer_write_u16(buf, flags); flags = 0; - ldns_buffer_write(buf, &flags, sizeof(uint16_t)); - ldns_buffer_write(buf, &flags, sizeof(uint16_t)); - ldns_buffer_write(buf, &flags, sizeof(uint16_t)); + sldns_buffer_write(buf, &flags, sizeof(uint16_t)); + sldns_buffer_write(buf, &flags, sizeof(uint16_t)); + sldns_buffer_write(buf, &flags, sizeof(uint16_t)); if(qinfo) { - if(ldns_buffer_current(buf) == qinfo->qname) - ldns_buffer_skip(buf, (ssize_t)qinfo->qname_len); - else ldns_buffer_write(buf, qinfo->qname, qinfo->qname_len); - ldns_buffer_write_u16(buf, qinfo->qtype); - ldns_buffer_write_u16(buf, qinfo->qclass); + if(sldns_buffer_current(buf) == qinfo->qname) + sldns_buffer_skip(buf, (ssize_t)qinfo->qname_len); + else sldns_buffer_write(buf, qinfo->qname, qinfo->qname_len); + sldns_buffer_write_u16(buf, qinfo->qtype); + sldns_buffer_write_u16(buf, qinfo->qclass); } - ldns_buffer_flip(buf); + sldns_buffer_flip(buf); if(edns) { struct edns_data es = *edns; es.edns_version = EDNS_ADVERTISED_VERSION; es.udp_size = EDNS_ADVERTISED_SIZE; es.ext_rcode = 0; es.bits &= EDNS_DO; - if(ldns_buffer_limit(buf) + calc_edns_field_size(&es) > + if(sldns_buffer_limit(buf) + calc_edns_field_size(&es) > edns->udp_size) return; attach_edns_record(buf, &es); diff --git a/contrib/unbound/util/data/msgencode.h b/contrib/unbound/util/data/msgencode.h index 74d6c1fb2dd..eea129d98d5 100644 --- a/contrib/unbound/util/data/msgencode.h +++ b/contrib/unbound/util/data/msgencode.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -42,6 +42,7 @@ #ifndef UTIL_DATA_MSGENCODE_H #define UTIL_DATA_MSGENCODE_H +struct sldns_buffer; struct query_info; struct reply_info; struct regional; @@ -66,7 +67,7 @@ struct edns_data; * @return: 0 on error (server failure). */ int reply_info_answer_encode(struct query_info* qinf, struct reply_info* rep, - uint16_t id, uint16_t qflags, ldns_buffer* dest, uint32_t timenow, + uint16_t id, uint16_t qflags, struct sldns_buffer* dest, time_t timenow, int cached, struct regional* region, uint16_t udpsize, struct edns_data* edns, int dnssec, int secure); @@ -88,7 +89,7 @@ int reply_info_answer_encode(struct query_info* qinf, struct reply_info* rep, * 0 on error: malloc failure (no log_err has been done). */ int reply_info_encode(struct query_info* qinfo, struct reply_info* rep, - uint16_t id, uint16_t flags, ldns_buffer* buffer, uint32_t timenow, + uint16_t id, uint16_t flags, struct sldns_buffer* buffer, time_t timenow, struct regional* region, uint16_t udpsize, int dnssec); /** @@ -96,7 +97,7 @@ int reply_info_encode(struct query_info* qinfo, struct reply_info* rep, * @param pkt: where to store the packet. * @param qinfo: query info. */ -void qinfo_query_encode(ldns_buffer* pkt, struct query_info* qinfo); +void qinfo_query_encode(struct sldns_buffer* pkt, struct query_info* qinfo); /** * Estimate size of EDNS record in packet. EDNS record will be no larger. @@ -111,7 +112,7 @@ uint16_t calc_edns_field_size(struct edns_data* edns); * @param pkt: packet added to. * @param edns: if NULL or present=0, nothing is added to the packet. */ -void attach_edns_record(ldns_buffer* pkt, struct edns_data* edns); +void attach_edns_record(struct sldns_buffer* pkt, struct edns_data* edns); /** * Encode an error. With QR and RA set. @@ -124,7 +125,7 @@ void attach_edns_record(ldns_buffer* pkt, struct edns_data* edns); * @param edns: if not NULL, this is the query edns info, * and an edns reply is attached. Only attached if EDNS record fits reply. */ -void error_encode(ldns_buffer* pkt, int r, struct query_info* qinfo, +void error_encode(struct sldns_buffer* pkt, int r, struct query_info* qinfo, uint16_t qid, uint16_t qflags, struct edns_data* edns); #endif /* UTIL_DATA_MSGENCODE_H */ diff --git a/contrib/unbound/util/data/msgparse.c b/contrib/unbound/util/data/msgparse.c index 2791ae56086..abe778a89fb 100644 --- a/contrib/unbound/util/data/msgparse.c +++ b/contrib/unbound/util/data/msgparse.c @@ -21,37 +21,40 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** * \file * Routines for message parsing a packet buffer to a descriptive structure. */ #include "config.h" -#include #include "util/data/msgparse.h" #include "util/data/dname.h" #include "util/data/packed_rrset.h" #include "util/storage/lookup3.h" #include "util/regional.h" +#include "ldns/rrdef.h" +#include "ldns/sbuffer.h" +#include "ldns/parseutil.h" +#include "ldns/wire2str.h" /** smart comparison of (compressed, valid) dnames from packet */ static int -smart_compare(ldns_buffer* pkt, uint8_t* dnow, +smart_compare(sldns_buffer* pkt, uint8_t* dnow, uint8_t* dprfirst, uint8_t* dprlast) { if(LABEL_IS_PTR(*dnow)) { /* ptr points to a previous dname */ - uint8_t* p = ldns_buffer_at(pkt, PTR_OFFSET(dnow[0], dnow[1])); + uint8_t* p = sldns_buffer_at(pkt, PTR_OFFSET(dnow[0], dnow[1])); if( p == dprfirst || p == dprlast ) return 0; /* prev dname is also a ptr, both ptrs are the same. */ @@ -68,7 +71,7 @@ smart_compare(ldns_buffer* pkt, uint8_t* dnow, static struct rrset_parse* new_rrset(struct msg_parse* msg, uint8_t* dname, size_t dnamelen, uint16_t type, uint16_t dclass, hashvalue_t hash, - uint32_t rrset_flags, ldns_pkt_section section, + uint32_t rrset_flags, sldns_pkt_section section, struct regional* region) { struct rrset_parse* p = regional_alloc(region, sizeof(*p)); @@ -99,52 +102,52 @@ new_rrset(struct msg_parse* msg, uint8_t* dname, size_t dnamelen, /** See if next rrset is nsec at zone apex */ static int -nsec_at_apex(ldns_buffer* pkt) +nsec_at_apex(sldns_buffer* pkt) { /* we are at ttl position in packet. */ - size_t pos = ldns_buffer_position(pkt); + size_t pos = sldns_buffer_position(pkt); uint16_t rdatalen; - if(ldns_buffer_remaining(pkt) < 7) /* ttl+len+root */ + if(sldns_buffer_remaining(pkt) < 7) /* ttl+len+root */ return 0; /* eek! */ - ldns_buffer_skip(pkt, 4); /* ttl */; - rdatalen = ldns_buffer_read_u16(pkt); - if(ldns_buffer_remaining(pkt) < rdatalen) { - ldns_buffer_set_position(pkt, pos); + sldns_buffer_skip(pkt, 4); /* ttl */; + rdatalen = sldns_buffer_read_u16(pkt); + if(sldns_buffer_remaining(pkt) < rdatalen) { + sldns_buffer_set_position(pkt, pos); return 0; /* parse error happens later */ } /* must validate the nsec next domain name format */ if(pkt_dname_len(pkt) == 0) { - ldns_buffer_set_position(pkt, pos); + sldns_buffer_set_position(pkt, pos); return 0; /* parse error */ } /* see if SOA bit is set. */ - if(ldns_buffer_position(pkt) < pos+4+rdatalen) { + if(sldns_buffer_position(pkt) < pos+4+rdatalen) { /* nsec type bitmap contains items */ uint8_t win, blen, bits; /* need: windownum, bitmap len, firstbyte */ - if(ldns_buffer_position(pkt)+3 > pos+4+rdatalen) { - ldns_buffer_set_position(pkt, pos); + if(sldns_buffer_position(pkt)+3 > pos+4+rdatalen) { + sldns_buffer_set_position(pkt, pos); return 0; /* malformed nsec */ } - win = ldns_buffer_read_u8(pkt); - blen = ldns_buffer_read_u8(pkt); - bits = ldns_buffer_read_u8(pkt); + win = sldns_buffer_read_u8(pkt); + blen = sldns_buffer_read_u8(pkt); + bits = sldns_buffer_read_u8(pkt); /* 0window always first window. bitlen >=1 or parse error really. bit 0x2 is SOA. */ if(win == 0 && blen >= 1 && (bits & 0x02)) { - ldns_buffer_set_position(pkt, pos); + sldns_buffer_set_position(pkt, pos); return 1; } } - ldns_buffer_set_position(pkt, pos); + sldns_buffer_set_position(pkt, pos); return 0; } /** Calculate rrset flags */ static uint32_t -pkt_rrset_flags(ldns_buffer* pkt, uint16_t type, ldns_pkt_section sec) +pkt_rrset_flags(sldns_buffer* pkt, uint16_t type, sldns_pkt_section sec) { uint32_t f = 0; if(type == LDNS_RR_TYPE_NSEC && nsec_at_apex(pkt)) { @@ -156,7 +159,7 @@ pkt_rrset_flags(ldns_buffer* pkt, uint16_t type, ldns_pkt_section sec) } hashvalue_t -pkt_hash_rrset(ldns_buffer* pkt, uint8_t* dname, uint16_t type, +pkt_hash_rrset(sldns_buffer* pkt, uint8_t* dname, uint16_t type, uint16_t dclass, uint32_t rrset_flags) { /* note this MUST be identical to rrset_key_hash in packed_rrset.c */ @@ -171,7 +174,7 @@ pkt_hash_rrset(ldns_buffer* pkt, uint8_t* dname, uint16_t type, /** create partial dname hash for rrset hash */ static hashvalue_t -pkt_hash_rrset_first(ldns_buffer* pkt, uint8_t* dname) +pkt_hash_rrset_first(sldns_buffer* pkt, uint8_t* dname) { /* works together with pkt_hash_rrset_rest */ /* note this MUST be identical to rrset_key_hash in packed_rrset.c */ @@ -197,7 +200,7 @@ pkt_hash_rrset_rest(hashvalue_t dname_h, uint16_t type, uint16_t dclass, /** compare rrset_parse with data */ static int -rrset_parse_equals(struct rrset_parse* p, ldns_buffer* pkt, hashvalue_t h, +rrset_parse_equals(struct rrset_parse* p, sldns_buffer* pkt, hashvalue_t h, uint32_t rrset_flags, uint8_t* dname, size_t dnamelen, uint16_t type, uint16_t dclass) { @@ -210,7 +213,7 @@ rrset_parse_equals(struct rrset_parse* p, ldns_buffer* pkt, hashvalue_t h, struct rrset_parse* -msgparse_hashtable_lookup(struct msg_parse* msg, ldns_buffer* pkt, +msgparse_hashtable_lookup(struct msg_parse* msg, sldns_buffer* pkt, hashvalue_t h, uint32_t rrset_flags, uint8_t* dname, size_t dnamelen, uint16_t type, uint16_t dclass) { @@ -226,26 +229,26 @@ msgparse_hashtable_lookup(struct msg_parse* msg, ldns_buffer* pkt, /** return type networkformat that rrsig in packet covers */ static int -pkt_rrsig_covered(ldns_buffer* pkt, uint8_t* here, uint16_t* type) +pkt_rrsig_covered(sldns_buffer* pkt, uint8_t* here, uint16_t* type) { - size_t pos = ldns_buffer_position(pkt); - ldns_buffer_set_position(pkt, (size_t)(here-ldns_buffer_begin(pkt))); + size_t pos = sldns_buffer_position(pkt); + sldns_buffer_set_position(pkt, (size_t)(here-sldns_buffer_begin(pkt))); /* ttl + len + size of small rrsig(rootlabel, no signature) */ - if(ldns_buffer_remaining(pkt) < 4+2+19) + if(sldns_buffer_remaining(pkt) < 4+2+19) return 0; - ldns_buffer_skip(pkt, 4); /* ttl */ - if(ldns_buffer_read_u16(pkt) < 19) /* too short */ { - ldns_buffer_set_position(pkt, pos); + sldns_buffer_skip(pkt, 4); /* ttl */ + if(sldns_buffer_read_u16(pkt) < 19) /* too short */ { + sldns_buffer_set_position(pkt, pos); return 0; } - *type = ldns_buffer_read_u16(pkt); - ldns_buffer_set_position(pkt, pos); + *type = sldns_buffer_read_u16(pkt); + sldns_buffer_set_position(pkt, pos); return 1; } /** true if covered type equals prevtype */ static int -pkt_rrsig_covered_equals(ldns_buffer* pkt, uint8_t* here, uint16_t type) +pkt_rrsig_covered_equals(sldns_buffer* pkt, uint8_t* here, uint16_t type) { uint16_t t; if(pkt_rrsig_covered(pkt, here, &t) && t == type) @@ -270,7 +273,7 @@ msgparse_bucket_remove(struct msg_parse* msg, struct rrset_parse* rrset) /** change section of rrset from previous to current section */ static void change_section(struct msg_parse* msg, struct rrset_parse* rrset, - ldns_pkt_section section) + sldns_pkt_section section) { struct rrset_parse *p, *prev; /* remove from list */ @@ -313,7 +316,7 @@ change_section(struct msg_parse* msg, struct rrset_parse* rrset, /** see if rrset of type RRSIG contains sig over given type */ static int -rrset_has_sigover(ldns_buffer* pkt, struct rrset_parse* rrset, uint16_t type, +rrset_has_sigover(sldns_buffer* pkt, struct rrset_parse* rrset, uint16_t type, int* hasother) { int res = 0; @@ -330,7 +333,7 @@ rrset_has_sigover(ldns_buffer* pkt, struct rrset_parse* rrset, uint16_t type, /** move rrsigs from sigset to dataset */ static int -moveover_rrsigs(ldns_buffer* pkt, struct regional* region, +moveover_rrsigs(sldns_buffer* pkt, struct regional* region, struct rrset_parse* sigset, struct rrset_parse* dataset, int duplicate) { struct rr_parse* sig = sigset->rr_first; @@ -380,8 +383,8 @@ moveover_rrsigs(ldns_buffer* pkt, struct regional* region, /** change an rrsig rrset for use as data rrset */ static struct rrset_parse* change_rrsig_rrset(struct rrset_parse* sigset, struct msg_parse* msg, - ldns_buffer* pkt, uint16_t datatype, uint32_t rrset_flags, - int hasother, ldns_pkt_section section, struct regional* region) + sldns_buffer* pkt, uint16_t datatype, uint32_t rrset_flags, + int hasother, sldns_pkt_section section, struct regional* region) { struct rrset_parse* dataset = sigset; hashvalue_t hash = pkt_hash_rrset(pkt, sigset->dname, datatype, @@ -450,13 +453,13 @@ change_rrsig_rrset(struct rrset_parse* sigset, struct msg_parse* msg, * @return 0 on out of memory. */ static int -find_rrset(struct msg_parse* msg, ldns_buffer* pkt, uint8_t* dname, +find_rrset(struct msg_parse* msg, sldns_buffer* pkt, uint8_t* dname, size_t dnamelen, uint16_t type, uint16_t dclass, hashvalue_t* hash, uint32_t* rrset_flags, uint8_t** prev_dname_first, uint8_t** prev_dname_last, size_t* prev_dnamelen, uint16_t* prev_type, uint16_t* prev_dclass, struct rrset_parse** rrset_prev, - ldns_pkt_section section, struct regional* region) + sldns_pkt_section section, struct regional* region) { hashvalue_t dname_h = pkt_hash_rrset_first(pkt, dname); uint16_t covtype; @@ -473,7 +476,7 @@ find_rrset(struct msg_parse* msg, ldns_buffer* pkt, uint8_t* dname, } /* check if rrsig over previous item */ if(type == LDNS_RR_TYPE_RRSIG && dclass == *prev_dclass && - pkt_rrsig_covered_equals(pkt, ldns_buffer_current(pkt), + pkt_rrsig_covered_equals(pkt, sldns_buffer_current(pkt), *prev_type) && smart_compare(pkt, dname, *prev_dname_first, *prev_dname_last) == 0) { @@ -487,7 +490,7 @@ find_rrset(struct msg_parse* msg, ldns_buffer* pkt, uint8_t* dname, /* if rrsig - try to lookup matching data set first */ if(type == LDNS_RR_TYPE_RRSIG && pkt_rrsig_covered(pkt, - ldns_buffer_current(pkt), &covtype)) { + sldns_buffer_current(pkt), &covtype)) { *hash = pkt_hash_rrset_rest(dname_h, covtype, dclass, *rrset_flags); *rrset_prev = msgparse_hashtable_lookup(msg, pkt, *hash, @@ -568,27 +571,27 @@ find_rrset(struct msg_parse* msg, ldns_buffer* pkt, uint8_t* dname, * @return: 0 if OK, or rcode on error. */ static int -parse_query_section(ldns_buffer* pkt, struct msg_parse* msg) +parse_query_section(sldns_buffer* pkt, struct msg_parse* msg) { if(msg->qdcount == 0) return 0; if(msg->qdcount > 1) return LDNS_RCODE_FORMERR; log_assert(msg->qdcount == 1); - if(ldns_buffer_remaining(pkt) <= 0) + if(sldns_buffer_remaining(pkt) <= 0) return LDNS_RCODE_FORMERR; - msg->qname = ldns_buffer_current(pkt); + msg->qname = sldns_buffer_current(pkt); if((msg->qname_len = pkt_dname_len(pkt)) == 0) return LDNS_RCODE_FORMERR; - if(ldns_buffer_remaining(pkt) < sizeof(uint16_t)*2) + if(sldns_buffer_remaining(pkt) < sizeof(uint16_t)*2) return LDNS_RCODE_FORMERR; - msg->qtype = ldns_buffer_read_u16(pkt); - msg->qclass = ldns_buffer_read_u16(pkt); + msg->qtype = sldns_buffer_read_u16(pkt); + msg->qclass = sldns_buffer_read_u16(pkt); return 0; } size_t -get_rdf_size(ldns_rdf_type rdf) +get_rdf_size(sldns_rdf_type rdf) { switch(rdf) { case LDNS_RDF_TYPE_CLASS: @@ -614,7 +617,7 @@ get_rdf_size(ldns_rdf_type rdf) return 16; break; default: - log_assert(false); /* add type above */ + log_assert(0); /* add type above */ /* only types that appear before a domain * * name are needed. rest is simply copied. */ } @@ -623,16 +626,16 @@ get_rdf_size(ldns_rdf_type rdf) /** calculate the size of one rr */ static int -calc_size(ldns_buffer* pkt, uint16_t type, struct rr_parse* rr) +calc_size(sldns_buffer* pkt, uint16_t type, struct rr_parse* rr) { - const ldns_rr_descriptor* desc; + const sldns_rr_descriptor* desc; uint16_t pkt_len; /* length of rr inside the packet */ rr->size = sizeof(uint16_t); /* the rdatalen */ - ldns_buffer_skip(pkt, 4); /* skip ttl */ - pkt_len = ldns_buffer_read_u16(pkt); - if(ldns_buffer_remaining(pkt) < pkt_len) + sldns_buffer_skip(pkt, 4); /* skip ttl */ + pkt_len = sldns_buffer_read_u16(pkt); + if(sldns_buffer_remaining(pkt) < pkt_len) return 0; - desc = ldns_rr_descript(type); + desc = sldns_rr_descript(type); if(pkt_len > 0 && desc && desc->_dname_count > 0) { int count = (int)desc->_dname_count; int rdf = 0; @@ -643,12 +646,12 @@ calc_size(ldns_buffer* pkt, uint16_t type, struct rr_parse* rr) switch(desc->_wireformat[rdf]) { case LDNS_RDF_TYPE_DNAME: /* decompress every domain name */ - oldpos = ldns_buffer_position(pkt); + oldpos = sldns_buffer_position(pkt); if((len = pkt_dname_len(pkt)) == 0) return 0; /* malformed dname */ - if(ldns_buffer_position(pkt)-oldpos > pkt_len) + if(sldns_buffer_position(pkt)-oldpos > pkt_len) return 0; /* dname exceeds rdata */ - pkt_len -= ldns_buffer_position(pkt)-oldpos; + pkt_len -= sldns_buffer_position(pkt)-oldpos; rr->size += len; count--; len = 0; @@ -658,7 +661,7 @@ calc_size(ldns_buffer* pkt, uint16_t type, struct rr_parse* rr) /* NOTREACHED, due to 'while(>0)' */ return 0; /* len byte exceeds rdata */ } - len = ldns_buffer_current(pkt)[0] + 1; + len = sldns_buffer_current(pkt)[0] + 1; break; default: len = get_rdf_size(desc->_wireformat[rdf]); @@ -667,7 +670,7 @@ calc_size(ldns_buffer* pkt, uint16_t type, struct rr_parse* rr) if(pkt_len < len) return 0; /* exceeds rdata */ pkt_len -= len; - ldns_buffer_skip(pkt, (ssize_t)len); + sldns_buffer_skip(pkt, (ssize_t)len); rr->size += len; } rdf++; @@ -675,41 +678,41 @@ calc_size(ldns_buffer* pkt, uint16_t type, struct rr_parse* rr) } /* remaining rdata */ rr->size += pkt_len; - ldns_buffer_skip(pkt, (ssize_t)pkt_len); + sldns_buffer_skip(pkt, (ssize_t)pkt_len); return 1; } /** skip rr ttl and rdata */ static int -skip_ttl_rdata(ldns_buffer* pkt) +skip_ttl_rdata(sldns_buffer* pkt) { uint16_t rdatalen; - if(ldns_buffer_remaining(pkt) < 6) /* ttl + rdatalen */ + if(sldns_buffer_remaining(pkt) < 6) /* ttl + rdatalen */ return 0; - ldns_buffer_skip(pkt, 4); /* ttl */ - rdatalen = ldns_buffer_read_u16(pkt); - if(ldns_buffer_remaining(pkt) < rdatalen) + sldns_buffer_skip(pkt, 4); /* ttl */ + rdatalen = sldns_buffer_read_u16(pkt); + if(sldns_buffer_remaining(pkt) < rdatalen) return 0; - ldns_buffer_skip(pkt, (ssize_t)rdatalen); + sldns_buffer_skip(pkt, (ssize_t)rdatalen); return 1; } /** see if RRSIG is a duplicate of another */ static int -sig_is_double(ldns_buffer* pkt, struct rrset_parse* rrset, uint8_t* ttldata) +sig_is_double(sldns_buffer* pkt, struct rrset_parse* rrset, uint8_t* ttldata) { uint16_t rlen, siglen; - size_t pos = ldns_buffer_position(pkt); + size_t pos = sldns_buffer_position(pkt); struct rr_parse* sig; - if(ldns_buffer_remaining(pkt) < 6) + if(sldns_buffer_remaining(pkt) < 6) return 0; - ldns_buffer_skip(pkt, 4); /* ttl */ - rlen = ldns_buffer_read_u16(pkt); - if(ldns_buffer_remaining(pkt) < rlen) { - ldns_buffer_set_position(pkt, pos); + sldns_buffer_skip(pkt, 4); /* ttl */ + rlen = sldns_buffer_read_u16(pkt); + if(sldns_buffer_remaining(pkt) < rlen) { + sldns_buffer_set_position(pkt, pos); return 0; } - ldns_buffer_set_position(pkt, pos); + sldns_buffer_set_position(pkt, pos); sig = rrset->rrsig_first; while(sig) { @@ -738,9 +741,9 @@ sig_is_double(ldns_buffer* pkt, struct rrset_parse* rrset, uint8_t* ttldata) /** Add rr (from packet here) to rrset, skips rr */ static int -add_rr_to_rrset(struct rrset_parse* rrset, ldns_buffer* pkt, +add_rr_to_rrset(struct rrset_parse* rrset, sldns_buffer* pkt, struct msg_parse* msg, struct regional* region, - ldns_pkt_section section, uint16_t type) + sldns_pkt_section section, uint16_t type) { struct rr_parse* rr; /* check section of rrset. */ @@ -764,7 +767,7 @@ add_rr_to_rrset(struct rrset_parse* rrset, ldns_buffer* pkt, if( (msg->qtype == LDNS_RR_TYPE_RRSIG || msg->qtype == LDNS_RR_TYPE_ANY) - && sig_is_double(pkt, rrset, ldns_buffer_current(pkt))) { + && sig_is_double(pkt, rrset, sldns_buffer_current(pkt))) { if(!skip_ttl_rdata(pkt)) return LDNS_RCODE_FORMERR; return 0; @@ -774,7 +777,7 @@ add_rr_to_rrset(struct rrset_parse* rrset, ldns_buffer* pkt, if(!(rr = (struct rr_parse*)regional_alloc(region, sizeof(*rr)))) return LDNS_RCODE_SERVFAIL; rr->outside_packet = 0; - rr->ttl_data = ldns_buffer_current(pkt); + rr->ttl_data = sldns_buffer_current(pkt); rr->next = 0; if(type == LDNS_RR_TYPE_RRSIG && rrset->type != LDNS_RR_TYPE_RRSIG) { if(rrset->rrsig_last) @@ -810,8 +813,8 @@ add_rr_to_rrset(struct rrset_parse* rrset, ldns_buffer* pkt, * @return: 0 if OK, or rcode on error. */ static int -parse_section(ldns_buffer* pkt, struct msg_parse* msg, - struct regional* region, ldns_pkt_section section, +parse_section(sldns_buffer* pkt, struct msg_parse* msg, + struct regional* region, sldns_pkt_section section, uint16_t num_rrs, size_t* num_rrsets) { uint16_t i; @@ -826,39 +829,39 @@ parse_section(ldns_buffer* pkt, struct msg_parse* msg, if(num_rrs == 0) return 0; - if(ldns_buffer_remaining(pkt) <= 0) + if(sldns_buffer_remaining(pkt) <= 0) return LDNS_RCODE_FORMERR; for(i=0; i_name: "??", + sldns_rr_descript(type)? + sldns_rr_descript(type)->_name: "??", (int)type, - ldns_rr_descript(t)? - ldns_rr_descript(t)->_name: "??", + sldns_rr_descript(t)? + sldns_rr_descript(t)->_name: "??", (int)t); } else fprintf(stderr, "parse of %s(%d)", - ldns_rr_descript(type)? - ldns_rr_descript(type)->_name: "??", + sldns_rr_descript(type)? + sldns_rr_descript(type)->_name: "??", (int)type); fprintf(stderr, " %s(%d) ", - ldns_lookup_by_id(ldns_rr_classes, - (int)ntohs(dclass))?ldns_lookup_by_id( - ldns_rr_classes, (int)ntohs(dclass))->name: + sldns_lookup_by_id(sldns_rr_classes, + (int)ntohs(dclass))?sldns_lookup_by_id( + sldns_rr_classes, (int)ntohs(dclass))->name: "??", (int)ntohs(dclass)); dname_print(stderr, pkt, dname); fprintf(stderr, "\n"); @@ -882,8 +885,8 @@ parse_section(ldns_buffer* pkt, struct msg_parse* msg, fprintf(stderr, "is part of existing: "); dname_print(stderr, pkt, rrset->dname); fprintf(stderr, " type %s(%d)\n", - ldns_rr_descript(rrset->type)? - ldns_rr_descript(rrset->type)->_name: "??", + sldns_rr_descript(rrset->type)? + sldns_rr_descript(rrset->type)->_name: "??", (int)rrset->type); } /* add to rrset. */ @@ -895,18 +898,18 @@ parse_section(ldns_buffer* pkt, struct msg_parse* msg, } int -parse_packet(ldns_buffer* pkt, struct msg_parse* msg, struct regional* region) +parse_packet(sldns_buffer* pkt, struct msg_parse* msg, struct regional* region) { int ret; - if(ldns_buffer_remaining(pkt) < LDNS_HEADER_SIZE) + if(sldns_buffer_remaining(pkt) < LDNS_HEADER_SIZE) return LDNS_RCODE_FORMERR; /* read the header */ - ldns_buffer_read(pkt, &msg->id, sizeof(uint16_t)); - msg->flags = ldns_buffer_read_u16(pkt); - msg->qdcount = ldns_buffer_read_u16(pkt); - msg->ancount = ldns_buffer_read_u16(pkt); - msg->nscount = ldns_buffer_read_u16(pkt); - msg->arcount = ldns_buffer_read_u16(pkt); + sldns_buffer_read(pkt, &msg->id, sizeof(uint16_t)); + msg->flags = sldns_buffer_read_u16(pkt); + msg->qdcount = sldns_buffer_read_u16(pkt); + msg->ancount = sldns_buffer_read_u16(pkt); + msg->nscount = sldns_buffer_read_u16(pkt); + msg->arcount = sldns_buffer_read_u16(pkt); if(msg->qdcount > 1) return LDNS_RCODE_FORMERR; if((ret = parse_query_section(pkt, msg)) != 0) @@ -917,13 +920,13 @@ parse_packet(ldns_buffer* pkt, struct msg_parse* msg, struct regional* region) if((ret = parse_section(pkt, msg, region, LDNS_SECTION_AUTHORITY, msg->nscount, &msg->ns_rrsets)) != 0) return ret; - if(ldns_buffer_remaining(pkt) == 0 && msg->arcount == 1) { + if(sldns_buffer_remaining(pkt) == 0 && msg->arcount == 1) { /* BIND accepts leniently that an EDNS record is missing. * so, we do too. */ } else if((ret = parse_section(pkt, msg, region, LDNS_SECTION_ADDITIONAL, msg->arcount, &msg->ar_rrsets)) != 0) return ret; - /* if(ldns_buffer_remaining(pkt) > 0) { */ + /* if(sldns_buffer_remaining(pkt) > 0) { */ /* there is spurious data at end of packet. ignore */ /* } */ msg->rrset_count = msg->an_rrsets + msg->ns_rrsets + msg->ar_rrsets; @@ -981,23 +984,23 @@ parse_extract_edns(struct msg_parse* msg, struct edns_data* edns) edns->edns_present = 1; edns->ext_rcode = found->rr_last->ttl_data[0]; edns->edns_version = found->rr_last->ttl_data[1]; - edns->bits = ldns_read_uint16(&found->rr_last->ttl_data[2]); + edns->bits = sldns_read_uint16(&found->rr_last->ttl_data[2]); edns->udp_size = ntohs(found->rrset_class); /* ignore rdata and rrsigs */ return 0; } int -parse_edns_from_pkt(ldns_buffer* pkt, struct edns_data* edns) +parse_edns_from_pkt(sldns_buffer* pkt, struct edns_data* edns) { - log_assert(LDNS_QDCOUNT(ldns_buffer_begin(pkt)) == 1); - log_assert(LDNS_ANCOUNT(ldns_buffer_begin(pkt)) == 0); - log_assert(LDNS_NSCOUNT(ldns_buffer_begin(pkt)) == 0); + log_assert(LDNS_QDCOUNT(sldns_buffer_begin(pkt)) == 1); + log_assert(LDNS_ANCOUNT(sldns_buffer_begin(pkt)) == 0); + log_assert(LDNS_NSCOUNT(sldns_buffer_begin(pkt)) == 0); /* check edns section is present */ - if(LDNS_ARCOUNT(ldns_buffer_begin(pkt)) > 1) { + if(LDNS_ARCOUNT(sldns_buffer_begin(pkt)) > 1) { return LDNS_RCODE_FORMERR; } - if(LDNS_ARCOUNT(ldns_buffer_begin(pkt)) == 0) { + if(LDNS_ARCOUNT(sldns_buffer_begin(pkt)) == 0) { memset(edns, 0, sizeof(*edns)); edns->udp_size = 512; return 0; @@ -1005,15 +1008,15 @@ parse_edns_from_pkt(ldns_buffer* pkt, struct edns_data* edns) /* domain name must be the root of length 1. */ if(pkt_dname_len(pkt) != 1) return LDNS_RCODE_FORMERR; - if(ldns_buffer_remaining(pkt) < 10) /* type, class, ttl, rdatalen */ + if(sldns_buffer_remaining(pkt) < 10) /* type, class, ttl, rdatalen */ return LDNS_RCODE_FORMERR; - if(ldns_buffer_read_u16(pkt) != LDNS_RR_TYPE_OPT) + if(sldns_buffer_read_u16(pkt) != LDNS_RR_TYPE_OPT) return LDNS_RCODE_FORMERR; edns->edns_present = 1; - edns->udp_size = ldns_buffer_read_u16(pkt); /* class is udp size */ - edns->ext_rcode = ldns_buffer_read_u8(pkt); /* ttl used for bits */ - edns->edns_version = ldns_buffer_read_u8(pkt); - edns->bits = ldns_buffer_read_u16(pkt); + edns->udp_size = sldns_buffer_read_u16(pkt); /* class is udp size */ + edns->ext_rcode = sldns_buffer_read_u8(pkt); /* ttl used for bits */ + edns->edns_version = sldns_buffer_read_u8(pkt); + edns->bits = sldns_buffer_read_u16(pkt); /* ignore rdata and rrsigs */ return 0; } diff --git a/contrib/unbound/util/data/msgparse.h b/contrib/unbound/util/data/msgparse.h index 830d68e16cd..221a45aadd7 100644 --- a/contrib/unbound/util/data/msgparse.h +++ b/contrib/unbound/util/data/msgparse.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** * \file @@ -63,7 +63,9 @@ #ifndef UTIL_DATA_MSGPARSE_H #define UTIL_DATA_MSGPARSE_H #include "util/storage/lruhash.h" -#include +#include "ldns/pkthdr.h" +#include "ldns/rrdef.h" +struct sldns_buffer; struct rrset_parse; struct rr_parse; struct regional; @@ -71,9 +73,9 @@ struct regional; /** number of buckets in parse rrset hash table. Must be power of 2. */ #define PARSE_TABLE_SIZE 32 /** Maximum TTL that is allowed. */ -extern uint32_t MAX_TTL; +extern time_t MAX_TTL; /** Minimum TTL that is allowed. */ -extern uint32_t MIN_TTL; +extern time_t MIN_TTL; /** Negative cache time (for entries without any RRs.) */ #define NORR_TTL 5 /* seconds */ @@ -137,7 +139,7 @@ struct rrset_parse { /** which section was it found in: one of * LDNS_SECTION_ANSWER, LDNS_SECTION_AUTHORITY, LDNS_SECTION_ADDITIONAL */ - ldns_pkt_section section; + sldns_pkt_section section; /** start of (possibly compressed) dname in packet */ uint8_t* dname; /** length of the dname uncompressed wireformat */ @@ -219,7 +221,7 @@ struct edns_data { * @param rdf: the rdf type from the descriptor. * @return: size in octets. 0 on failure. */ -size_t get_rdf_size(ldns_rdf_type rdf); +size_t get_rdf_size(sldns_rdf_type rdf); /** * Parse the packet. @@ -229,7 +231,7 @@ size_t get_rdf_size(ldns_rdf_type rdf); * @param region: how to alloc results. * @return: 0 if OK, or rcode on error. */ -int parse_packet(ldns_buffer* pkt, struct msg_parse* msg, +int parse_packet(struct sldns_buffer* pkt, struct msg_parse* msg, struct regional* region); /** @@ -259,7 +261,7 @@ int parse_extract_edns(struct msg_parse* msg, struct edns_data* edns); * @return: 0 on success, or an RCODE on error. * RCODE formerr if OPT is badly formatted and so on. */ -int parse_edns_from_pkt(ldns_buffer* pkt, struct edns_data* edns); +int parse_edns_from_pkt(struct sldns_buffer* pkt, struct edns_data* edns); /** * Calculate hash value for rrset in packet. @@ -270,7 +272,7 @@ int parse_edns_from_pkt(ldns_buffer* pkt, struct edns_data* edns); * @param rrset_flags: rrset flags (same as packed_rrset flags). * @return hash value */ -hashvalue_t pkt_hash_rrset(ldns_buffer* pkt, uint8_t* dname, uint16_t type, +hashvalue_t pkt_hash_rrset(struct sldns_buffer* pkt, uint8_t* dname, uint16_t type, uint16_t dclass, uint32_t rrset_flags); /** @@ -286,7 +288,7 @@ hashvalue_t pkt_hash_rrset(ldns_buffer* pkt, uint8_t* dname, uint16_t type, * @return NULL or the rrset_parse if found. */ struct rrset_parse* msgparse_hashtable_lookup(struct msg_parse* msg, - ldns_buffer* pkt, hashvalue_t h, uint32_t rrset_flags, + struct sldns_buffer* pkt, hashvalue_t h, uint32_t rrset_flags, uint8_t* dname, size_t dnamelen, uint16_t type, uint16_t dclass); /** diff --git a/contrib/unbound/util/data/msgreply.c b/contrib/unbound/util/data/msgreply.c index 6d711fff3a2..cfdf3fe1103 100644 --- a/contrib/unbound/util/data/msgreply.c +++ b/contrib/unbound/util/data/msgreply.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -40,7 +40,6 @@ */ #include "config.h" -#include #include "util/data/msgreply.h" #include "util/storage/lookup3.h" #include "util/log.h" @@ -51,15 +50,17 @@ #include "util/regional.h" #include "util/data/msgparse.h" #include "util/data/msgencode.h" +#include "ldns/sbuffer.h" +#include "ldns/wire2str.h" /** MAX TTL default for messages and rrsets */ -uint32_t MAX_TTL = 3600 * 24 * 10; /* ten days */ +time_t MAX_TTL = 3600 * 24 * 10; /* ten days */ /** MIN TTL default for messages and rrsets */ -uint32_t MIN_TTL = 0; +time_t MIN_TTL = 0; /** allocate qinfo, return 0 on error */ static int -parse_create_qinfo(ldns_buffer* pkt, struct msg_parse* msg, +parse_create_qinfo(sldns_buffer* pkt, struct msg_parse* msg, struct query_info* qinf, struct regional* region) { if(msg->qname) { @@ -79,7 +80,7 @@ parse_create_qinfo(ldns_buffer* pkt, struct msg_parse* msg, /** constructor for replyinfo */ static struct reply_info* construct_reply_info_base(struct regional* region, uint16_t flags, size_t qd, - uint32_t ttl, uint32_t prettl, size_t an, size_t ns, size_t ar, + time_t ttl, time_t prettl, size_t an, size_t ns, size_t ar, size_t total, enum sec_status sec) { struct reply_info* rep; @@ -153,13 +154,13 @@ repinfo_alloc_rrset_keys(struct reply_info* rep, struct alloc_cache* alloc, /** do the rdata copy */ static int -rdata_copy(ldns_buffer* pkt, struct packed_rrset_data* data, uint8_t* to, - struct rr_parse* rr, uint32_t* rr_ttl, uint16_t type) +rdata_copy(sldns_buffer* pkt, struct packed_rrset_data* data, uint8_t* to, + struct rr_parse* rr, time_t* rr_ttl, uint16_t type) { uint16_t pkt_len; - const ldns_rr_descriptor* desc; + const sldns_rr_descriptor* desc; - *rr_ttl = ldns_read_uint32(rr->ttl_data); + *rr_ttl = sldns_read_uint32(rr->ttl_data); /* RFC 2181 Section 8. if msb of ttl is set treat as if zero. */ if(*rr_ttl & 0x80000000U) *rr_ttl = 0; @@ -174,18 +175,18 @@ rdata_copy(ldns_buffer* pkt, struct packed_rrset_data* data, uint8_t* to, return 1; } - ldns_buffer_set_position(pkt, (size_t) - (rr->ttl_data - ldns_buffer_begin(pkt) + sizeof(uint32_t))); + sldns_buffer_set_position(pkt, (size_t) + (rr->ttl_data - sldns_buffer_begin(pkt) + sizeof(uint32_t))); /* insert decompressed size into rdata len stored in memory */ /* -2 because rdatalen bytes are not included. */ pkt_len = htons(rr->size - 2); memmove(to, &pkt_len, sizeof(uint16_t)); to += 2; /* read packet rdata len */ - pkt_len = ldns_buffer_read_u16(pkt); - if(ldns_buffer_remaining(pkt) < pkt_len) + pkt_len = sldns_buffer_read_u16(pkt); + if(sldns_buffer_remaining(pkt) < pkt_len) return 0; - desc = ldns_rr_descript(type); + desc = sldns_rr_descript(type); if(pkt_len > 0 && desc && desc->_dname_count > 0) { int count = (int)desc->_dname_count; int rdf = 0; @@ -195,25 +196,25 @@ rdata_copy(ldns_buffer* pkt, struct packed_rrset_data* data, uint8_t* to, while(pkt_len > 0 && count) { switch(desc->_wireformat[rdf]) { case LDNS_RDF_TYPE_DNAME: - oldpos = ldns_buffer_position(pkt); + oldpos = sldns_buffer_position(pkt); dname_pkt_copy(pkt, to, - ldns_buffer_current(pkt)); + sldns_buffer_current(pkt)); to += pkt_dname_len(pkt); - pkt_len -= ldns_buffer_position(pkt)-oldpos; + pkt_len -= sldns_buffer_position(pkt)-oldpos; count--; len = 0; break; case LDNS_RDF_TYPE_STR: - len = ldns_buffer_current(pkt)[0] + 1; + len = sldns_buffer_current(pkt)[0] + 1; break; default: len = get_rdf_size(desc->_wireformat[rdf]); break; } if(len) { - memmove(to, ldns_buffer_current(pkt), len); + memmove(to, sldns_buffer_current(pkt), len); to += len; - ldns_buffer_skip(pkt, (ssize_t)len); + sldns_buffer_skip(pkt, (ssize_t)len); log_assert(len <= pkt_len); pkt_len -= len; } @@ -222,14 +223,14 @@ rdata_copy(ldns_buffer* pkt, struct packed_rrset_data* data, uint8_t* to, } /* copy remaining rdata */ if(pkt_len > 0) - memmove(to, ldns_buffer_current(pkt), pkt_len); + memmove(to, sldns_buffer_current(pkt), pkt_len); return 1; } /** copy over the data into packed rrset */ static int -parse_rr_copy(ldns_buffer* pkt, struct rrset_parse* pset, +parse_rr_copy(sldns_buffer* pkt, struct rrset_parse* pset, struct packed_rrset_data* data) { size_t i; @@ -245,7 +246,7 @@ parse_rr_copy(ldns_buffer* pkt, struct rrset_parse* pset, data->rr_len = (size_t*)((uint8_t*)data + sizeof(struct packed_rrset_data)); data->rr_data = (uint8_t**)&(data->rr_len[total]); - data->rr_ttl = (uint32_t*)&(data->rr_data[total]); + data->rr_ttl = (time_t*)&(data->rr_data[total]); nextrdata = (uint8_t*)&(data->rr_ttl[total]); for(i=0; icount; i++) { data->rr_len[i] = rr->size; @@ -272,13 +273,13 @@ parse_rr_copy(ldns_buffer* pkt, struct rrset_parse* pset, /** create rrset return 0 on failure */ static int -parse_create_rrset(ldns_buffer* pkt, struct rrset_parse* pset, +parse_create_rrset(sldns_buffer* pkt, struct rrset_parse* pset, struct packed_rrset_data** data, struct regional* region) { /* allocate */ size_t s = sizeof(struct packed_rrset_data) + (pset->rr_count + pset->rrsig_count) * - (sizeof(size_t)+sizeof(uint8_t*)+sizeof(uint32_t)) + + (sizeof(size_t)+sizeof(uint8_t*)+sizeof(time_t)) + pset->size; if(region) *data = regional_alloc(region, s); @@ -332,7 +333,7 @@ get_rrset_trust(struct msg_parse* msg, struct rrset_parse* rrset) } int -parse_copy_decompress_rrset(ldns_buffer* pkt, struct msg_parse* msg, +parse_copy_decompress_rrset(sldns_buffer* pkt, struct msg_parse* msg, struct rrset_parse *pset, struct regional* region, struct ub_packed_rrset_key* pk) { @@ -370,7 +371,7 @@ parse_copy_decompress_rrset(ldns_buffer* pkt, struct msg_parse* msg, * @return 0 on failure. */ static int -parse_copy_decompress(ldns_buffer* pkt, struct msg_parse* msg, +parse_copy_decompress(sldns_buffer* pkt, struct msg_parse* msg, struct reply_info* rep, struct regional* region) { size_t i; @@ -397,7 +398,7 @@ parse_copy_decompress(ldns_buffer* pkt, struct msg_parse* msg, } int -parse_create_msg(ldns_buffer* pkt, struct msg_parse* msg, +parse_create_msg(sldns_buffer* pkt, struct msg_parse* msg, struct alloc_cache* alloc, struct query_info* qinf, struct reply_info** rep, struct regional* region) { @@ -413,7 +414,7 @@ parse_create_msg(ldns_buffer* pkt, struct msg_parse* msg, return 1; } -int reply_info_parse(ldns_buffer* pkt, struct alloc_cache* alloc, +int reply_info_parse(sldns_buffer* pkt, struct alloc_cache* alloc, struct query_info* qinf, struct reply_info** rep, struct regional* region, struct edns_data* edns) { @@ -428,7 +429,7 @@ int reply_info_parse(ldns_buffer* pkt, struct alloc_cache* alloc, } memset(msg, 0, sizeof(*msg)); - ldns_buffer_set_position(pkt, 0); + sldns_buffer_set_position(pkt, 0); if((ret = parse_packet(pkt, msg, region)) != 0) { return ret; } @@ -465,7 +466,7 @@ reply_info_sortref(struct reply_info* rep) } void -reply_info_set_ttls(struct reply_info* rep, uint32_t timenow) +reply_info_set_ttls(struct reply_info* rep, time_t timenow) { size_t i, j; rep->ttl += timenow; @@ -496,23 +497,23 @@ reply_info_parsedelete(struct reply_info* rep, struct alloc_cache* alloc) } int -query_info_parse(struct query_info* m, ldns_buffer* query) +query_info_parse(struct query_info* m, sldns_buffer* query) { - uint8_t* q = ldns_buffer_begin(query); + uint8_t* q = sldns_buffer_begin(query); /* minimum size: header + \0 + qtype + qclass */ - if(ldns_buffer_limit(query) < LDNS_HEADER_SIZE + 5) + if(sldns_buffer_limit(query) < LDNS_HEADER_SIZE + 5) return 0; if(LDNS_OPCODE_WIRE(q) != LDNS_PACKET_QUERY || - LDNS_QDCOUNT(q) != 1 || ldns_buffer_position(query) != 0) + LDNS_QDCOUNT(q) != 1 || sldns_buffer_position(query) != 0) return 0; - ldns_buffer_skip(query, LDNS_HEADER_SIZE); - m->qname = ldns_buffer_current(query); + sldns_buffer_skip(query, LDNS_HEADER_SIZE); + m->qname = sldns_buffer_current(query); if((m->qname_len = query_dname_len(query)) == 0) return 0; /* parse error */ - if(ldns_buffer_remaining(query) < 4) + if(sldns_buffer_remaining(query) < 4) return 0; /* need qtype, qclass */ - m->qtype = ldns_buffer_read_u16(query); - m->qclass = ldns_buffer_read_u16(query); + m->qtype = sldns_buffer_read_u16(query); + m->qclass = sldns_buffer_read_u16(query); return 1; } @@ -764,32 +765,23 @@ void log_dns_msg(const char* str, struct query_info* qinfo, struct reply_info* rep) { /* not particularly fast but flexible, make wireformat and print */ - ldns_buffer* buf = ldns_buffer_new(65535); + sldns_buffer* buf = sldns_buffer_new(65535); struct regional* region = regional_create(); if(!reply_info_encode(qinfo, rep, 0, rep->flags, buf, 0, region, 65535, 1)) { log_info("%s: log_dns_msg: out of memory", str); } else { - ldns_status s; - ldns_pkt* pkt = NULL; - s = ldns_buffer2pkt_wire(&pkt, buf); - if(s != LDNS_STATUS_OK) { - log_info("%s: log_dns_msg: ldns parse gave: %s", - str, ldns_get_errorstr_by_id(s)); + char* str = sldns_wire2str_pkt(sldns_buffer_begin(buf), + sldns_buffer_limit(buf)); + if(!str) { + log_info("%s: log_dns_msg: ldns tostr failed", str); } else { - ldns_buffer_clear(buf); - s = ldns_pkt2buffer_str(buf, pkt); - if(s != LDNS_STATUS_OK) { - log_info("%s: log_dns_msg: ldns tostr gave: %s", - str, ldns_get_errorstr_by_id(s)); - } else { - log_info("%s %s", - str, (char*)ldns_buffer_begin(buf)); - } + log_info("%s %s", + str, (char*)sldns_buffer_begin(buf)); } - ldns_pkt_free(pkt); + free(str); } - ldns_buffer_free(buf); + sldns_buffer_free(buf); regional_destroy(region); } diff --git a/contrib/unbound/util/data/msgreply.h b/contrib/unbound/util/data/msgreply.h index a32f2b1edab..f920108f952 100644 --- a/contrib/unbound/util/data/msgreply.h +++ b/contrib/unbound/util/data/msgreply.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -43,6 +43,7 @@ #define UTIL_DATA_MSGREPLY_H #include "util/storage/lruhash.h" #include "util/data/packed_rrset.h" +struct sldns_buffer; struct comm_reply; struct alloc_cache; struct iovec; @@ -116,21 +117,21 @@ struct reply_info { */ uint8_t qdcount; + /** 32 bit padding to pad struct member alignment to 64 bits. */ + uint32_t padding; + /** * TTL of the entire reply (for negative caching). * only for use when there are 0 RRsets in this message. * if there are RRsets, check those instead. */ - uint32_t ttl; + time_t ttl; /** * TTL for prefetch. After it has expired, a prefetch is suitable. * Smaller than the TTL, otherwise the prefetch would not happen. */ - uint32_t prefetch_ttl; - - /** 32 bit padding to pad struct member alignment to 64 bits. */ - uint32_t padding; + time_t prefetch_ttl; /** * The security status from DNSSEC validation of this message. @@ -201,7 +202,7 @@ struct msgreply_entry { * @param query: the wireformat packet query. starts with ID. * @return: 0 on format error. */ -int query_info_parse(struct query_info* m, ldns_buffer* query); +int query_info_parse(struct query_info* m, struct sldns_buffer* query); /** * Parse query reply. @@ -218,7 +219,7 @@ int query_info_parse(struct query_info* m, ldns_buffer* query); * o FORMERR for parse errors. * o SERVFAIL for memory allocation errors. */ -int reply_info_parse(ldns_buffer* pkt, struct alloc_cache* alloc, +int reply_info_parse(struct sldns_buffer* pkt, struct alloc_cache* alloc, struct query_info* qinf, struct reply_info** rep, struct regional* region, struct edns_data* edns); @@ -237,7 +238,7 @@ int reply_info_parse(ldns_buffer* pkt, struct alloc_cache* alloc, * and no rrset_ref array in the reply is built up. * @return 0 if allocation failed. */ -int parse_create_msg(ldns_buffer* pkt, struct msg_parse* msg, +int parse_create_msg(struct sldns_buffer* pkt, struct msg_parse* msg, struct alloc_cache* alloc, struct query_info* qinf, struct reply_info** rep, struct regional* region); @@ -253,7 +254,7 @@ void reply_info_sortref(struct reply_info* rep); * Also refs must be filled in. * @param timenow: the current time. */ -void reply_info_set_ttls(struct reply_info* rep, uint32_t timenow); +void reply_info_set_ttls(struct reply_info* rep, time_t timenow); /** * Delete reply_info and packed_rrsets (while they are not yet added to the @@ -322,7 +323,7 @@ struct reply_info* reply_info_copy(struct reply_info* rep, * Note that TTL will still be relative on return. * @return false on alloc failure. */ -int parse_copy_decompress_rrset(ldns_buffer* pkt, struct msg_parse* msg, +int parse_copy_decompress_rrset(struct sldns_buffer* pkt, struct msg_parse* msg, struct rrset_parse *pset, struct regional* region, struct ub_packed_rrset_key* pk); diff --git a/contrib/unbound/util/data/packed_rrset.c b/contrib/unbound/util/data/packed_rrset.c index e1fc2e5291e..8074685764b 100644 --- a/contrib/unbound/util/data/packed_rrset.c +++ b/contrib/unbound/util/data/packed_rrset.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -40,7 +40,6 @@ */ #include "config.h" -#include #include "util/data/packed_rrset.h" #include "util/data/dname.h" #include "util/storage/lookup3.h" @@ -48,6 +47,9 @@ #include "util/alloc.h" #include "util/regional.h" #include "util/net_help.h" +#include "ldns/rrdef.h" +#include "ldns/sbuffer.h" +#include "ldns/wire2str.h" void ub_packed_rrset_parsedelete(struct ub_packed_rrset_key* pkey, @@ -183,7 +185,7 @@ packed_rrset_ptr_fixup(struct packed_rrset_data* data) data->rr_len = (size_t*)((uint8_t*)data + sizeof(struct packed_rrset_data)); data->rr_data = (uint8_t**)&(data->rr_len[total]); - data->rr_ttl = (uint32_t*)&(data->rr_data[total]); + data->rr_ttl = (time_t*)&(data->rr_data[total]); nextrdata = (uint8_t*)&(data->rr_ttl[total]); for(i=0; irr_data[i] = nextrdata; @@ -205,7 +207,7 @@ get_cname_target(struct ub_packed_rrset_key* rrset, uint8_t** dname, return; if(d->rr_len[0] < 3) /* at least rdatalen + 0byte root label */ return; - len = ldns_read_uint16(d->rr_data[0]); + len = sldns_read_uint16(d->rr_data[0]); if(len != d->rr_len[0] - sizeof(uint16_t)) return; if(dname_valid(d->rr_data[0]+sizeof(uint16_t), len) != len) @@ -215,7 +217,7 @@ get_cname_target(struct ub_packed_rrset_key* rrset, uint8_t** dname, } void -packed_rrset_ttl_add(struct packed_rrset_data* data, uint32_t add) +packed_rrset_ttl_add(struct packed_rrset_data* data, time_t add) { size_t i; size_t total = data->count + data->rrsig_count; @@ -266,7 +268,53 @@ void log_rrset_key(enum verbosity_value v, const char* str, ntohs(rrset->rk.type), ntohs(rrset->rk.rrset_class)); } -uint32_t +int packed_rr_to_string(struct ub_packed_rrset_key* rrset, size_t i, + time_t now, char* dest, size_t dest_len) +{ + struct packed_rrset_data* d = (struct packed_rrset_data*)rrset-> + entry.data; + uint8_t rr[65535]; + size_t rlen = rrset->rk.dname_len + 2 + 2 + 4 + d->rr_len[i]; + log_assert(dest_len > 0 && dest); + if(rlen > dest_len) { + dest[0] = 0; + return 0; + } + memmove(rr, rrset->rk.dname, rrset->rk.dname_len); + if(i < d->count) + memmove(rr+rrset->rk.dname_len, &rrset->rk.type, 2); + else sldns_write_uint16(rr+rrset->rk.dname_len, LDNS_RR_TYPE_RRSIG); + memmove(rr+rrset->rk.dname_len+2, &rrset->rk.rrset_class, 2); + sldns_write_uint32(rr+rrset->rk.dname_len+4, + (uint32_t)(d->rr_ttl[i]-now)); + memmove(rr+rrset->rk.dname_len+8, d->rr_data[i], d->rr_len[i]); + if(sldns_wire2str_rr_buf(rr, rlen, dest, dest_len) == -1) { + log_info("rrbuf failure %d %s", (int)d->rr_len[i], dest); + dest[0] = 0; + return 0; + } + return 1; +} + +void log_packed_rrset(enum verbosity_value v, const char* str, + struct ub_packed_rrset_key* rrset) +{ + struct packed_rrset_data* d = (struct packed_rrset_data*)rrset-> + entry.data; + char buf[65535]; + size_t i; + if(verbosity < v) + return; + for(i=0; icount+d->rrsig_count; i++) { + if(!packed_rr_to_string(rrset, i, 0, buf, sizeof(buf))) { + log_info("%s: rr %d wire2str-error", str, (int)i); + } else { + log_info("%s: %s", str, buf); + } + } +} + +time_t ub_packed_rrset_ttl(struct ub_packed_rrset_key* key) { struct packed_rrset_data* d = (struct packed_rrset_data*)key-> @@ -276,7 +324,7 @@ ub_packed_rrset_ttl(struct ub_packed_rrset_key* key) struct ub_packed_rrset_key* packed_rrset_copy_region(struct ub_packed_rrset_key* key, - struct regional* region, uint32_t now) + struct regional* region, time_t now) { struct ub_packed_rrset_key* ck = regional_alloc(region, sizeof(struct ub_packed_rrset_key)); @@ -315,7 +363,7 @@ packed_rrset_copy_region(struct ub_packed_rrset_key* key, struct ub_packed_rrset_key* packed_rrset_copy_alloc(struct ub_packed_rrset_key* key, - struct alloc_cache* alloc, uint32_t now) + struct alloc_cache* alloc, time_t now) { struct packed_rrset_data* fd, *dd; struct ub_packed_rrset_key* dk = alloc_special_obtain(alloc); @@ -339,150 +387,3 @@ packed_rrset_copy_alloc(struct ub_packed_rrset_key* key, packed_rrset_ttl_add(dd, now); return dk; } - -struct ub_packed_rrset_key* -ub_packed_rrset_heap_key(ldns_rr_list* rrset) -{ - struct ub_packed_rrset_key* k; - ldns_rr* rr; - if(!rrset) - return NULL; - rr = ldns_rr_list_rr(rrset, 0); - if(!rr) - return NULL; - k = (struct ub_packed_rrset_key*)calloc(1, sizeof(*k)); - if(!k) - return NULL; - k->rk.type = htons(ldns_rr_get_type(rr)); - k->rk.rrset_class = htons(ldns_rr_get_class(rr)); - k->rk.dname_len = ldns_rdf_size(ldns_rr_owner(rr)); - k->rk.dname = memdup(ldns_rdf_data(ldns_rr_owner(rr)), - ldns_rdf_size(ldns_rr_owner(rr))); - if(!k->rk.dname) { - free(k); - return NULL; - } - return k; -} - -struct packed_rrset_data* -packed_rrset_heap_data(ldns_rr_list* rrset) -{ - struct packed_rrset_data* data; - size_t count=0, rrsig_count=0, len=0, i, j, total; - uint8_t* nextrdata; - if(!rrset || ldns_rr_list_rr_count(rrset)==0) - return NULL; - /* count sizes */ - for(i=0; ittl = ldns_rr_ttl(ldns_rr_list_rr(rrset, 0)); - data->count = count; - data->rrsig_count = rrsig_count; - data->rr_len = (size_t*)((uint8_t*)data + - sizeof(struct packed_rrset_data)); - data->rr_data = (uint8_t**)&(data->rr_len[total]); - data->rr_ttl = (uint32_t*)&(data->rr_data[total]); - nextrdata = (uint8_t*)&(data->rr_ttl[total]); - - /* fill out len, ttl, fields */ - for(i=0; irr_ttl[i] = ldns_rr_ttl(rr); - if(data->rr_ttl[i] < data->ttl) - data->ttl = data->rr_ttl[i]; - data->rr_len[i] = 2; /* the rdlength */ - for(j=0; jrr_len[i] += ldns_rdf_size(ldns_rr_rdf(rr, j)); - } - - /* fixup rest of ptrs */ - for(i=0; irr_data[i] = nextrdata; - nextrdata += data->rr_len[i]; - } - - /* copy data in there */ - for(i=0; irr_len[i]-2); - size_t p = sizeof(rdlen); - memmove(data->rr_data[i], &rdlen, p); - for(j=0; jrr_data[i]+p, ldns_rdf_data(rd), - ldns_rdf_size(rd)); - p += ldns_rdf_size(rd); - } - } - - if(data->rrsig_count && data->count == 0) { - data->count = data->rrsig_count; /* rrset type is RRSIG */ - data->rrsig_count = 0; - } - return data; -} - -/** convert i'th rr to ldns_rr */ -static ldns_rr* -torr(struct ub_packed_rrset_key* k, ldns_buffer* buf, size_t i) -{ - struct packed_rrset_data* d = (struct packed_rrset_data*)k->entry.data; - ldns_rr* rr = NULL; - size_t pos = 0; - ldns_status s; - ldns_buffer_clear(buf); - ldns_buffer_write(buf, k->rk.dname, k->rk.dname_len); - if(i < d->count) - ldns_buffer_write(buf, &k->rk.type, sizeof(uint16_t)); - else ldns_buffer_write_u16(buf, LDNS_RR_TYPE_RRSIG); - ldns_buffer_write(buf, &k->rk.rrset_class, sizeof(uint16_t)); - ldns_buffer_write_u32(buf, d->rr_ttl[i]); - ldns_buffer_write(buf, d->rr_data[i], d->rr_len[i]); - ldns_buffer_flip(buf); - s = ldns_wire2rr(&rr, ldns_buffer_begin(buf), ldns_buffer_limit(buf), - &pos, LDNS_SECTION_ANSWER); - if(s == LDNS_STATUS_OK) - return rr; - return NULL; -} - -ldns_rr_list* -packed_rrset_to_rr_list(struct ub_packed_rrset_key* k, ldns_buffer* buf) -{ - struct packed_rrset_data* d = (struct packed_rrset_data*)k->entry.data; - ldns_rr_list* r = ldns_rr_list_new(); - size_t i; - if(!r) - return NULL; - for(i=0; icount+d->rrsig_count; i++) { - ldns_rr* rr = torr(k, buf, i); - if(!rr) { - ldns_rr_list_deep_free(r); - return NULL; - } - if(!ldns_rr_list_push_rr(r, rr)) { - ldns_rr_free(rr); - ldns_rr_list_deep_free(r); - return NULL; - } - } - return r; -} diff --git a/contrib/unbound/util/data/packed_rrset.h b/contrib/unbound/util/data/packed_rrset.h index ad11a804226..4b0ef80cd74 100644 --- a/contrib/unbound/util/data/packed_rrset.h +++ b/contrib/unbound/util/data/packed_rrset.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -42,7 +42,6 @@ #ifndef UTIL_DATA_PACKED_RRSET_H #define UTIL_DATA_PACKED_RRSET_H #include "util/storage/lruhash.h" -#include struct alloc_cache; struct regional; @@ -215,7 +214,7 @@ enum sec_status { struct packed_rrset_data { /** TTL (in seconds like time()) of the rrset. * Same for all RRs see rfc2181(5.2). */ - uint32_t ttl; + time_t ttl; /** number of rrs. */ size_t count; /** number of rrsigs, if 0 no rrsigs */ @@ -227,7 +226,7 @@ struct packed_rrset_data { /** length of every rr's rdata, rr_len[i] is size of rr_data[i]. */ size_t* rr_len; /** ttl of every rr. rr_ttl[i] ttl of rr i. */ - uint32_t *rr_ttl; + time_t *rr_ttl; /** * Array of pointers to every rr's rdata. * The rr_data[i] rdata is stored in uncompressed wireformat. @@ -281,7 +280,7 @@ size_t packed_rrset_sizeof(struct packed_rrset_data* data); * @param key: rrset key, with data to examine. * @return ttl value. */ -uint32_t ub_packed_rrset_ttl(struct ub_packed_rrset_key* key); +time_t ub_packed_rrset_ttl(struct ub_packed_rrset_key* key); /** * Calculate memory size of rrset entry. For hash table usage. @@ -343,7 +342,7 @@ void packed_rrset_ptr_fixup(struct packed_rrset_data* data); * @param data: rrset data structure. Otherwise correctly filled in. * @param add: how many seconds to add, pass time(0) for example. */ -void packed_rrset_ttl_add(struct packed_rrset_data* data, uint32_t add); +void packed_rrset_ttl_add(struct packed_rrset_data* data, time_t add); /** * Utility procedure to extract CNAME target name from its rdata. @@ -382,6 +381,27 @@ const char* sec_status_to_string(enum sec_status s); void log_rrset_key(enum verbosity_value v, const char* str, struct ub_packed_rrset_key* rrset); +/** + * Convert RR from RRset to string. + * @param rrset: structure with data. + * @param i: index of rr or RRSIG. + * @param now: time that is subtracted from ttl before printout. Can be 0. + * @param dest: destination string buffer. Must be nonNULL. + * @param dest_len: length of dest buffer (>0). + * @return false on failure. + */ +int packed_rr_to_string(struct ub_packed_rrset_key* rrset, size_t i, + time_t now, char* dest, size_t dest_len); + +/** + * Print the string with prefix, one rr per line. + * @param v: at what verbosity level to print this. + * @param str: string of message. + * @param rrset: with name, and rdata, and rrsigs. + */ +void log_packed_rrset(enum verbosity_value v, const char* str, + struct ub_packed_rrset_key* rrset); + /** * Allocate rrset in region - no more locks needed * @param key: a (just from rrset cache looked up) rrset key + valid, @@ -392,7 +412,7 @@ void log_rrset_key(enum verbosity_value v, const char* str, */ struct ub_packed_rrset_key* packed_rrset_copy_region( struct ub_packed_rrset_key* key, struct regional* region, - uint32_t now); + time_t now); /** * Allocate rrset with malloc (from region or you are holding the lock). @@ -403,32 +423,6 @@ struct ub_packed_rrset_key* packed_rrset_copy_region( */ struct ub_packed_rrset_key* packed_rrset_copy_alloc( struct ub_packed_rrset_key* key, struct alloc_cache* alloc, - uint32_t now); - -/** - * Create a ub_packed_rrset_key allocated on the heap. - * It therefore does not have the correct ID value, and cannot be used - * inside the cache. It can be used in storage outside of the cache. - * Keys for the cache have to be obtained from alloc.h . - * @param rrset: the ldns rr set. - * @return key allocated or NULL on failure. - */ -struct ub_packed_rrset_key* ub_packed_rrset_heap_key(ldns_rr_list* rrset); - -/** - * Create packed_rrset data on the heap. - * @param rrset: the ldns rr set with the data to copy. - * @return data allocated or NULL on failure. - */ -struct packed_rrset_data* packed_rrset_heap_data(ldns_rr_list* rrset); - -/** - * Convert packed rrset to ldns rr list. - * @param rrset: packed rrset. - * @param buf: scratch buffer. - * @return rr list or NULL on failure. - */ -ldns_rr_list* packed_rrset_to_rr_list(struct ub_packed_rrset_key* rrset, - ldns_buffer* buf); + time_t now); #endif /* UTIL_DATA_PACKED_RRSET_H */ diff --git a/contrib/unbound/util/fptr_wlist.c b/contrib/unbound/util/fptr_wlist.c index 2d5ba5c9077..7aa773634a8 100644 --- a/contrib/unbound/util/fptr_wlist.c +++ b/contrib/unbound/util/fptr_wlist.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -103,6 +103,7 @@ fptr_whitelist_comm_timer(void (*fptr)(void*)) { if(fptr == &pending_udp_timer_cb) return 1; else if(fptr == &outnet_tcptimer) return 1; + else if(fptr == &pending_udp_timer_delay_cb) return 1; else if(fptr == &worker_stat_timer_cb) return 1; else if(fptr == &worker_probe_timer_cb) return 1; #ifdef UB_ON_WINDOWS @@ -387,6 +388,7 @@ int fptr_whitelist_mesh_cb(mesh_cb_func_t fptr) { if(fptr == &libworker_fg_done_cb) return 1; else if(fptr == &libworker_bg_done_cb) return 1; + else if(fptr == &libworker_event_done_cb) return 1; else if(fptr == &probe_answer_cb) return 1; return 0; } diff --git a/contrib/unbound/util/fptr_wlist.h b/contrib/unbound/util/fptr_wlist.h index d204e923884..b2925d6755d 100644 --- a/contrib/unbound/util/fptr_wlist.h +++ b/contrib/unbound/util/fptr_wlist.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/util/iana_ports.inc b/contrib/unbound/util/iana_ports.inc index c2c7a215640..252203033ff 100644 --- a/contrib/unbound/util/iana_ports.inc +++ b/contrib/unbound/util/iana_ports.inc @@ -33,7 +33,6 @@ 48, 49, 50, -51, 52, 53, 54, @@ -694,9 +693,6 @@ 1026, 1027, 1029, -1030, -1031, -1032, 1033, 1034, 1035, @@ -3968,6 +3964,7 @@ 4753, 4784, 4785, +4789, 4800, 4801, 4802, @@ -4095,6 +4092,7 @@ 5111, 5112, 5116, +5120, 5133, 5136, 5137, @@ -4173,6 +4171,7 @@ 5361, 5362, 5363, +5364, 5397, 5398, 5399, @@ -4276,6 +4275,7 @@ 5681, 5682, 5683, +5684, 5688, 5689, 5713, @@ -4418,6 +4418,7 @@ 6350, 6355, 6360, +6363, 6370, 6382, 6389, @@ -4479,6 +4480,8 @@ 6627, 6628, 6633, +6634, +6653, 6657, 6670, 6671, @@ -4573,9 +4576,11 @@ 7170, 7171, 7174, +7181, 7200, 7201, 7227, +7235, 7262, 7272, 7273, @@ -4599,6 +4604,7 @@ 7401, 7402, 7410, +7411, 7421, 7426, 7427, @@ -4794,7 +4800,6 @@ 8614, 8675, 8686, -8699, 8732, 8733, 8763, @@ -4985,6 +4990,7 @@ 10007, 10008, 10009, +10023, 10050, 10051, 10080, @@ -5025,7 +5031,9 @@ 10990, 11000, 11001, +11095, 11106, +11108, 11111, 11112, 11161, @@ -5044,6 +5052,7 @@ 11371, 11600, 11720, +11723, 11751, 11796, 11876, @@ -5285,7 +5294,10 @@ 29167, 30001, 30002, +30003, +30004, 30260, +30832, 30999, 31029, 31416, @@ -5324,6 +5336,8 @@ 34963, 34964, 34980, +35001, +35004, 35355, 36001, 36865, @@ -5371,6 +5385,7 @@ 47624, 47806, 47808, +47809, 48000, 48001, 48002, @@ -5379,3 +5394,4 @@ 48129, 48556, 48619, +48653, diff --git a/contrib/unbound/util/locks.c b/contrib/unbound/util/locks.c index 425f9b9d456..509895d0280 100644 --- a/contrib/unbound/util/locks.c +++ b/contrib/unbound/util/locks.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/util/locks.h b/contrib/unbound/util/locks.h index 91be5c3e26f..d63e5f03201 100644 --- a/contrib/unbound/util/locks.h +++ b/contrib/unbound/util/locks.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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 UTIL_LOCKS_H diff --git a/contrib/unbound/util/log.c b/contrib/unbound/util/log.c index 8c09c7ce312..39d3118a000 100644 --- a/contrib/unbound/util/log.c +++ b/contrib/unbound/util/log.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** * \file @@ -40,6 +40,8 @@ #include "config.h" #include "util/log.h" #include "util/locks.h" +#include "ldns/sbuffer.h" +#include #ifdef HAVE_TIME_H #include #endif @@ -73,7 +75,7 @@ static const char* ident="unbound"; static int logging_to_syslog = 0; #endif /* HAVE_SYSLOG_H */ /** time to print in log, if NULL, use time(2) */ -static uint32_t* log_now = NULL; +static time_t* log_now = NULL; /** print time in UTC or in secondsfrom1970 */ static int log_time_asc = 0; @@ -151,7 +153,7 @@ void log_ident_set(const char* id) ident = id; } -void log_set_time(uint32_t* t) +void log_set_time(time_t* t) { log_now = t; } @@ -228,7 +230,7 @@ log_vmsg(int pri, const char* type, ident, (int)getpid(), tid?*tid:0, type, message); } else #endif - fprintf(logfile, "[%u] %s[%d:%x] %s: %s\n", (unsigned)now, + fprintf(logfile, "[" ARG_LL "d] %s[%d:%x] %s: %s\n", (long long)now, ident, (int)getpid(), tid?*tid:0, type, message); #ifdef UB_ON_WINDOWS /* line buffering does not work on windows */ @@ -345,11 +347,11 @@ log_hex(const char* msg, void* data, size_t length) log_hex_f(verbosity, msg, data, length); } -void log_buf(enum verbosity_value level, const char* msg, ldns_buffer* buf) +void log_buf(enum verbosity_value level, const char* msg, sldns_buffer* buf) { if(verbosity < level) return; - log_hex_f(level, msg, ldns_buffer_begin(buf), ldns_buffer_limit(buf)); + log_hex_f(level, msg, sldns_buffer_begin(buf), sldns_buffer_limit(buf)); } #ifdef USE_WINSOCK diff --git a/contrib/unbound/util/log.h b/contrib/unbound/util/log.h index 270ffc5c180..ea283da7b26 100644 --- a/contrib/unbound/util/log.h +++ b/contrib/unbound/util/log.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -41,7 +41,7 @@ #ifndef UTIL_LOG_H #define UTIL_LOG_H -#include +struct sldns_buffer; /** * verbosity value: @@ -108,7 +108,7 @@ void log_ident_set(const char* id); * @param t: the point is copied and used to find the time. * if NULL, time(2) is used. */ -void log_set_time(uint32_t* t); +void log_set_time(time_t* t); /** * Set if the time value is printed ascii or decimal in log entries. @@ -149,13 +149,13 @@ void log_warn(const char* format, ...) ATTR_FORMAT(printf, 1, 2); void log_hex(const char* msg, void* data, size_t length); /** - * Easy alternative for log_hex, takes a ldns_buffer. + * Easy alternative for log_hex, takes a sldns_buffer. * @param level: verbosity level for this message, compared to global * verbosity setting. * @param msg: string desc to print * @param buf: the buffer. */ -void log_buf(enum verbosity_value level, const char* msg, ldns_buffer* buf); +void log_buf(enum verbosity_value level, const char* msg, struct sldns_buffer* buf); /** * Log fatal error message, and exit the current process. diff --git a/contrib/unbound/util/mini_event.c b/contrib/unbound/util/mini_event.c index f66214ddb8f..40dca375a01 100644 --- a/contrib/unbound/util/mini_event.c +++ b/contrib/unbound/util/mini_event.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. * */ @@ -79,13 +79,13 @@ settime(struct event_base* base) return -1; } #ifndef S_SPLINT_S - *base->time_secs = (uint32_t)base->time_tv->tv_sec; + *base->time_secs = (time_t)base->time_tv->tv_sec; #endif return 0; } /** create event base */ -void *event_init(uint32_t* time_secs, struct timeval* time_tv) +void *event_init(time_t* time_secs, struct timeval* time_tv) { struct event_base* base = (struct event_base*)malloc( sizeof(struct event_base)); diff --git a/contrib/unbound/util/mini_event.h b/contrib/unbound/util/mini_event.h index 248468ada84..58bbc807393 100644 --- a/contrib/unbound/util/mini_event.h +++ b/contrib/unbound/util/mini_event.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -103,7 +103,7 @@ struct event_base /** if we need to exit */ int need_to_exit; /** where to store time in seconds */ - uint32_t* time_secs; + time_t* time_secs; /** where to store time in microseconds */ struct timeval* time_tv; }; @@ -134,7 +134,7 @@ struct event { /* function prototypes (some are as they appear in event.h) */ /** create event base */ -void *event_init(uint32_t* time_secs, struct timeval* time_tv); +void *event_init(time_t* time_secs, struct timeval* time_tv); /** get version */ const char *event_get_version(void); /** get polling method, select */ diff --git a/contrib/unbound/util/module.c b/contrib/unbound/util/module.c index b45ec6fc878..09e276c3015 100644 --- a/contrib/unbound/util/module.c +++ b/contrib/unbound/util/module.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** * \file diff --git a/contrib/unbound/util/module.h b/contrib/unbound/util/module.h index 8fa4ec25960..dace1cf6ba2 100644 --- a/contrib/unbound/util/module.h +++ b/contrib/unbound/util/module.h @@ -21,22 +21,134 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** * \file * * This file contains the interface for DNS handling modules. + * + * The module interface uses the DNS modules as state machines. The + * state machines are activated in sequence to operate on queries. Once + * they are done, the reply is passed back. In the usual setup the mesh + * is the caller of the state machines and once things are done sends replies + * and invokes result callbacks. + * + * The module provides a number of functions, listed in the module_func_block. + * The module is inited and destroyed and memory usage queries, for the + * module as a whole, for entire-module state (such as a cache). And per-query + * functions are called, operate to move the state machine and cleanup of + * the per-query state. + * + * Most per-query state should simply be allocated in the query region. + * This is destroyed at the end of the query. + * + * The module environment contains services and information and caches + * shared by the modules and the rest of the system. It also contains + * function pointers for module-specific tasks (like sending queries). + * + * *** Example module calls for a normal query + * + * In this example, the query does not need recursion, all the other data + * can be found in the cache. This makes the example shorter. + * + * At the start of the program the iterator module is initialised. + * The iterator module sets up its global state, such as donotquery lists + * and private address trees. + * + * A query comes in, and a mesh entry is created for it. The mesh + * starts the resolution process. The validator module is the first + * in the list of modules, and it is started on this new query. The + * operate() function is called. The validator decides it needs not do + * anything yet until there is a result and returns wait_module, that + * causes the next module in the list to be started. + * + * The next module is the iterator. It is started on the passed query and + * decides to perform a lookup. For this simple example, the delegation + * point information is available, and all the iterator wants to do is + * send a UDP query. The iterator uses env.send_query() to send the + * query. Then the iterator suspends (returns from the operate call). + * + * When the UDP reply comes back (and on errors and timeouts), the + * operate function is called for the query, on the iterator module, + * with the event that there is a reply. The iterator decides that this + * is enough, the work is done. It returns the value finished from the + * operate call, which causes the previous module to be started. + * + * The previous module, the validator module, is started with the event + * that the iterator module is done. The validator decides to validate + * the query. Once it is done (which could take recursive lookups, but + * in this example no recursive lookups are needed), it returns from the + * operate function with finished. + * + * There is no previous module from the validator module, and the mesh + * takes this to mean that the query is finally done. The mesh invokes + * callbacks and sends packets to queriers. + * + * If other modules had been waiting (recursively) on the answer to this + * query, then the mesh will tell them about it. It calls the inform_super + * routine on all the waiting modules, and once that is done it calls all of + * them with the operate() call. During inform_super the query that is done + * still exists and information can be copied from it (but the module should + * not really re-entry codepoints and services). During the operate call + * the modules can use stored state to continue operation with the results. + * (network buffers are used to contain the answer packet during the + * inform_super phase, but after that the network buffers will be cleared + * of their contents so that other tasks can be performed). + * + * *** Example module calls for recursion + * + * A module is called in operate, and it decides that it wants to perform + * recursion. That is, it wants the full state-machine-list to operate on + * a different query. It calls env.attach_sub() to create a new query state. + * The routine returns the newly created state, and potentially the module + * can edit the module-states for the newly created query (i.e. pass along + * some information, like delegation points). The module then suspends, + * returns from the operate routine. + * + * The mesh meanwhile will have the newly created query (or queries) on + * a waiting list, and will call operate() on this query (or queries). + * It starts again at the start of the module list for them. The query + * (or queries) continue to operate their state machines, until they are + * done. When they are done the mesh calls inform_super on the module that + * wanted the recursion. After that the mesh calls operate() on the module + * that wanted to do the recursion, and during this phase the module could, + * for example, decide to create more recursions. + * + * If the module decides it no longer wants the recursive information + * it can call detach_subs. Those queries will still run to completion, + * potentially filling the cache with information. Inform_super is not + * called any more. + * + * The iterator module will fetch items from the cache, so a recursion + * attempt may complete very quickly if the item is in cache. The calling + * module has to wait for completion or eventual timeout. A recursive query + * that times out returns a servfail rcode (servfail is also returned for + * other errors during the lookup). + * + * Results are passed in the qstate, the rcode member is used to pass + * errors without requiring memory allocation, so that the code can continue + * in out-of-memory conditions. If the rcode member is 0 (NOERROR) then + * the dns_msg entry contains a filled out message. This message may + * also contain an rcode that is nonzero, but in this case additional + * information (query, additional) can be passed along. + * + * The rcode and dns_msg are used to pass the result from the the rightmost + * module towards the leftmost modules and then towards the user. + * + * If you want to avoid recursion-cycles where queries need other queries + * that need the first one, use detect_cycle() to see if that will happen. + * */ #ifndef UTIL_MODULE_H @@ -44,6 +156,7 @@ #include "util/storage/lruhash.h" #include "util/data/msgreply.h" #include "util/data/msgparse.h" +struct sldns_buffer; struct alloc_cache; struct rrset_cache; struct key_cache; @@ -176,7 +289,7 @@ struct module_env { /** region for temporary usage. May be cleared after operate() call. */ struct regional* scratch; /** buffer for temporary usage. May be cleared after operate() call. */ - ldns_buffer* scratch_buffer; + struct sldns_buffer* scratch_buffer; /** internal data for daemon - worker thread. */ struct worker* worker; /** mesh area with query state dependencies */ @@ -186,7 +299,7 @@ struct module_env { /** random table to generate random numbers */ struct ub_randstate* rnd; /** time in seconds, converted to integer */ - uint32_t* now; + time_t* now; /** time in microseconds. Relatively recent. */ struct timeval* now_tv; /** is validation required for messages, controls client-facing @@ -309,7 +422,7 @@ struct module_qstate { /** mesh related information for this query */ struct mesh_state* mesh_info; /** how many seconds before expiry is this prefetched (0 if not) */ - uint32_t prefetch_leeway; + time_t prefetch_leeway; }; /** diff --git a/contrib/unbound/util/net_help.c b/contrib/unbound/util/net_help.c index 64bd876dcbb..7f6daab4a1b 100644 --- a/contrib/unbound/util/net_help.c +++ b/contrib/unbound/util/net_help.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** * \file @@ -38,12 +38,13 @@ */ #include "config.h" -#include #include "util/net_help.h" #include "util/log.h" #include "util/data/dname.h" #include "util/module.h" #include "util/regional.h" +#include "ldns/parseutil.h" +#include "ldns/wire2str.h" #include #ifdef HAVE_OPENSSL_SSL_H #include @@ -159,7 +160,7 @@ log_addr(enum verbosity_value v, const char* str, default: break; } if(inet_ntop(af, sinaddr, dest, (socklen_t)sizeof(dest)) == 0) { - strncpy(dest, "(inet_ntop error)", sizeof(dest)); + (void)strlcpy(dest, "(inet_ntop error)", sizeof(dest)); } dest[sizeof(dest)-1] = 0; port = ntohs(((struct sockaddr_in*)addr)->sin_port); @@ -180,7 +181,7 @@ extstrtoaddr(const char* str, struct sockaddr_storage* addr, if(s-str >= MAX_ADDR_STRLEN) { return 0; } - strncpy(buf, str, MAX_ADDR_STRLEN); + (void)strlcpy(buf, str, sizeof(buf)); buf[s-str] = 0; port = atoi(s+1); if(port == 0 && strcmp(s+1,"0")!=0) { @@ -210,7 +211,7 @@ ipstrtoaddr(const char* ip, int port, struct sockaddr_storage* addr, if((s=strchr(ip, '%'))) { /* ip6%interface, rfc 4007 */ if(s-ip >= MAX_ADDR_STRLEN) return 0; - strncpy(buf, ip, MAX_ADDR_STRLEN); + (void)strlcpy(buf, ip, sizeof(buf)); buf[s-ip]=0; sa->sin6_scope_id = (uint32_t)atoi(s+1); ip = buf; @@ -280,15 +281,15 @@ log_nametypeclass(enum verbosity_value v, const char* str, uint8_t* name, else if(type == LDNS_RR_TYPE_MAILB) ts = "MAILB"; else if(type == LDNS_RR_TYPE_MAILA) ts = "MAILA"; else if(type == LDNS_RR_TYPE_ANY) ts = "ANY"; - else if(ldns_rr_descript(type) && ldns_rr_descript(type)->_name) - ts = ldns_rr_descript(type)->_name; + else if(sldns_rr_descript(type) && sldns_rr_descript(type)->_name) + ts = sldns_rr_descript(type)->_name; else { snprintf(t, sizeof(t), "TYPE%d", (int)type); ts = t; } - if(ldns_lookup_by_id(ldns_rr_classes, (int)dclass) && - ldns_lookup_by_id(ldns_rr_classes, (int)dclass)->name) - cs = ldns_lookup_by_id(ldns_rr_classes, (int)dclass)->name; + if(sldns_lookup_by_id(sldns_rr_classes, (int)dclass) && + sldns_lookup_by_id(sldns_rr_classes, (int)dclass)->name) + cs = sldns_lookup_by_id(sldns_rr_classes, (int)dclass)->name; else { snprintf(c, sizeof(c), "CLASS%d", (int)dclass); cs = c; @@ -316,7 +317,7 @@ void log_name_addr(enum verbosity_value v, const char* str, uint8_t* zone, default: break; } if(inet_ntop(af, sinaddr, dest, (socklen_t)sizeof(dest)) == 0) { - strncpy(dest, "(inet_ntop error)", sizeof(dest)); + (void)strlcpy(dest, "(inet_ntop error)", sizeof(dest)); } dest[sizeof(dest)-1] = 0; port = ntohs(((struct sockaddr_in*)addr)->sin_port); diff --git a/contrib/unbound/util/net_help.h b/contrib/unbound/util/net_help.h index 05b5087b412..b92dd40e85d 100644 --- a/contrib/unbound/util/net_help.h +++ b/contrib/unbound/util/net_help.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/util/netevent.c b/contrib/unbound/util/netevent.c index c5a7d8029f8..189aaa4e4ea 100644 --- a/contrib/unbound/util/netevent.c +++ b/contrib/unbound/util/netevent.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -39,11 +39,12 @@ * This file contains event notification functions. */ #include "config.h" -#include #include "util/netevent.h" #include "util/log.h" #include "util/net_help.h" #include "util/fptr_wlist.h" +#include "ldns/pkthdr.h" +#include "ldns/sbuffer.h" #ifdef HAVE_OPENSSL_SSL_H #include #endif @@ -122,7 +123,7 @@ struct internal_base { /** libevent event_base type. */ struct event_base* base; /** seconds time pointer points here */ - uint32_t secs; + time_t secs; /** timeval with current time */ struct timeval now; /** the event used for slow_accept timeouts */ @@ -171,7 +172,7 @@ comm_base_now(struct comm_base* b) if(gettimeofday(&b->eb->now, NULL) < 0) { log_err("gettimeofday: %s", strerror(errno)); } - b->eb->secs = (uint32_t)b->eb->now.tv_sec; + b->eb->secs = (time_t)b->eb->now.tv_sec; } #endif /* USE_MINI_EVENT */ @@ -234,6 +235,23 @@ comm_base_create(int sigs) return b; } +struct comm_base* +comm_base_create_event(struct event_base* base) +{ + struct comm_base* b = (struct comm_base*)calloc(1, + sizeof(struct comm_base)); + if(!b) + return NULL; + b->eb = (struct internal_base*)calloc(1, sizeof(struct internal_base)); + if(!b->eb) { + free(b); + return NULL; + } + b->eb->base = base; + comm_base_now(b); + return b; +} + void comm_base_delete(struct comm_base* b) { @@ -258,7 +276,22 @@ comm_base_delete(struct comm_base* b) } void -comm_base_timept(struct comm_base* b, uint32_t** tt, struct timeval** tv) +comm_base_delete_no_base(struct comm_base* b) +{ + if(!b) + return; + if(b->eb->slow_accept_enabled) { + if(event_del(&b->eb->slow_accept) != 0) { + log_err("could not event_del slow_accept"); + } + } + b->eb->base = NULL; + free(b->eb); + free(b); +} + +void +comm_base_timept(struct comm_base* b, time_t** tt, struct timeval** tv) { *tt = &b->eb->secs; *tv = &b->eb->now; @@ -320,6 +353,10 @@ udp_send_errno_needs_log(struct sockaddr* addr, socklen_t addrlen) break; } #endif + /* permission denied is gotten for every send if the + * network is disconnected (on some OS), squelch it */ + if(errno == EPERM && verbosity < VERB_DETAIL) + return 0; /* squelch errors where people deploy AAAA ::ffff:bla for * authority servers, which we try for intranets. */ if(errno == EINVAL && addr_is_ip4mapped( @@ -342,18 +379,18 @@ int tcp_connect_errno_needs_log(struct sockaddr* addr, socklen_t addrlen) /* send a UDP reply */ int -comm_point_send_udp_msg(struct comm_point *c, ldns_buffer* packet, +comm_point_send_udp_msg(struct comm_point *c, sldns_buffer* packet, struct sockaddr* addr, socklen_t addrlen) { ssize_t sent; log_assert(c->fd != -1); #ifdef UNBOUND_DEBUG - if(ldns_buffer_remaining(packet) == 0) + if(sldns_buffer_remaining(packet) == 0) log_err("error: send empty UDP packet"); #endif log_assert(addr && addrlen > 0); - sent = sendto(c->fd, (void*)ldns_buffer_begin(packet), - ldns_buffer_remaining(packet), 0, + sent = sendto(c->fd, (void*)sldns_buffer_begin(packet), + sldns_buffer_remaining(packet), 0, addr, addrlen); if(sent == -1) { if(!udp_send_errno_needs_log(addr, addrlen)) @@ -367,9 +404,9 @@ comm_point_send_udp_msg(struct comm_point *c, ldns_buffer* packet, log_addr(VERB_OPS, "remote address is", (struct sockaddr_storage*)addr, addrlen); return 0; - } else if((size_t)sent != ldns_buffer_remaining(packet)) { + } else if((size_t)sent != sldns_buffer_remaining(packet)) { log_err("sent %d in place of %d bytes", - (int)sent, (int)ldns_buffer_remaining(packet)); + (int)sent, (int)sldns_buffer_remaining(packet)); return 0; } return 1; @@ -387,7 +424,7 @@ static void p_ancil(const char* str, struct comm_reply* r) char buf[1024]; if(inet_ntop(AF_INET6, &r->pktinfo.v6info.ipi6_addr, buf, (socklen_t)sizeof(buf)) == 0) { - strncpy(buf, "(inet_ntop error)", sizeof(buf)); + (void)strlcpy(buf, "(inet_ntop error)", sizeof(buf)); } buf[sizeof(buf)-1]=0; log_info("%s: %s %d", str, buf, r->pktinfo.v6info.ipi6_ifindex); @@ -396,13 +433,13 @@ static void p_ancil(const char* str, struct comm_reply* r) char buf1[1024], buf2[1024]; if(inet_ntop(AF_INET, &r->pktinfo.v4info.ipi_addr, buf1, (socklen_t)sizeof(buf1)) == 0) { - strncpy(buf1, "(inet_ntop error)", sizeof(buf1)); + (void)strlcpy(buf1, "(inet_ntop error)", sizeof(buf1)); } buf1[sizeof(buf1)-1]=0; #ifdef HAVE_STRUCT_IN_PKTINFO_IPI_SPEC_DST if(inet_ntop(AF_INET, &r->pktinfo.v4info.ipi_spec_dst, buf2, (socklen_t)sizeof(buf2)) == 0) { - strncpy(buf2, "(inet_ntop error)", sizeof(buf2)); + (void)strlcpy(buf2, "(inet_ntop error)", sizeof(buf2)); } buf2[sizeof(buf2)-1]=0; #else @@ -414,7 +451,7 @@ static void p_ancil(const char* str, struct comm_reply* r) char buf1[1024]; if(inet_ntop(AF_INET, &r->pktinfo.v4addr, buf1, (socklen_t)sizeof(buf1)) == 0) { - strncpy(buf1, "(inet_ntop error)", sizeof(buf1)); + (void)strlcpy(buf1, "(inet_ntop error)", sizeof(buf1)); } buf1[sizeof(buf1)-1]=0; log_info("%s: %s", str, buf1); @@ -425,7 +462,7 @@ static void p_ancil(const char* str, struct comm_reply* r) /** send a UDP reply over specified interface*/ static int -comm_point_send_udp_msg_if(struct comm_point *c, ldns_buffer* packet, +comm_point_send_udp_msg_if(struct comm_point *c, sldns_buffer* packet, struct sockaddr* addr, socklen_t addrlen, struct comm_reply* r) { #if defined(AF_INET6) && defined(IPV6_PKTINFO) && defined(HAVE_SENDMSG) @@ -439,15 +476,15 @@ comm_point_send_udp_msg_if(struct comm_point *c, ldns_buffer* packet, log_assert(c->fd != -1); #ifdef UNBOUND_DEBUG - if(ldns_buffer_remaining(packet) == 0) + if(sldns_buffer_remaining(packet) == 0) log_err("error: send empty UDP packet"); #endif log_assert(addr && addrlen > 0); msg.msg_name = addr; msg.msg_namelen = addrlen; - iov[0].iov_base = ldns_buffer_begin(packet); - iov[0].iov_len = ldns_buffer_remaining(packet); + iov[0].iov_base = sldns_buffer_begin(packet); + iov[0].iov_len = sldns_buffer_remaining(packet); msg.msg_iov = iov; msg.msg_iovlen = 1; msg.msg_control = control; @@ -507,9 +544,9 @@ comm_point_send_udp_msg_if(struct comm_point *c, ldns_buffer* packet, log_addr(VERB_OPS, "remote address is", (struct sockaddr_storage*)addr, addrlen); return 0; - } else if((size_t)sent != ldns_buffer_remaining(packet)) { + } else if((size_t)sent != sldns_buffer_remaining(packet)) { log_err("sent %d in place of %d bytes", - (int)sent, (int)ldns_buffer_remaining(packet)); + (int)sent, (int)sldns_buffer_remaining(packet)); return 0; } return 1; @@ -546,14 +583,14 @@ comm_point_udp_ancil_callback(int fd, short event, void* arg) log_assert(rep.c && rep.c->buffer && rep.c->fd == fd); comm_base_now(rep.c->ev->base); for(i=0; ibuffer); + sldns_buffer_clear(rep.c->buffer); rep.addrlen = (socklen_t)sizeof(rep.addr); log_assert(fd != -1); - log_assert(ldns_buffer_remaining(rep.c->buffer) > 0); + log_assert(sldns_buffer_remaining(rep.c->buffer) > 0); msg.msg_name = &rep.addr; msg.msg_namelen = (socklen_t)sizeof(rep.addr); - iov[0].iov_base = ldns_buffer_begin(rep.c->buffer); - iov[0].iov_len = ldns_buffer_remaining(rep.c->buffer); + iov[0].iov_base = sldns_buffer_begin(rep.c->buffer); + iov[0].iov_len = sldns_buffer_remaining(rep.c->buffer); msg.msg_iov = iov; msg.msg_iovlen = 1; msg.msg_control = ancil; @@ -569,8 +606,8 @@ comm_point_udp_ancil_callback(int fd, short event, void* arg) return; } rep.addrlen = msg.msg_namelen; - ldns_buffer_skip(rep.c->buffer, rcv); - ldns_buffer_flip(rep.c->buffer); + sldns_buffer_skip(rep.c->buffer, rcv); + sldns_buffer_flip(rep.c->buffer); rep.srctype = 0; #ifndef S_SPLINT_S for(cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; @@ -634,12 +671,12 @@ comm_point_udp_callback(int fd, short event, void* arg) log_assert(rep.c && rep.c->buffer && rep.c->fd == fd); comm_base_now(rep.c->ev->base); for(i=0; ibuffer); + sldns_buffer_clear(rep.c->buffer); rep.addrlen = (socklen_t)sizeof(rep.addr); log_assert(fd != -1); - log_assert(ldns_buffer_remaining(rep.c->buffer) > 0); - rcv = recvfrom(fd, (void*)ldns_buffer_begin(rep.c->buffer), - ldns_buffer_remaining(rep.c->buffer), 0, + log_assert(sldns_buffer_remaining(rep.c->buffer) > 0); + rcv = recvfrom(fd, (void*)sldns_buffer_begin(rep.c->buffer), + sldns_buffer_remaining(rep.c->buffer), 0, (struct sockaddr*)&rep.addr, &rep.addrlen); if(rcv == -1) { #ifndef USE_WINSOCK @@ -655,8 +692,8 @@ comm_point_udp_callback(int fd, short event, void* arg) #endif return; } - ldns_buffer_skip(rep.c->buffer, rcv); - ldns_buffer_flip(rep.c->buffer); + sldns_buffer_skip(rep.c->buffer, rcv); + sldns_buffer_flip(rep.c->buffer); rep.srctype = 0; fptr_ok(fptr_whitelist_comm_point(rep.c->callback)); if((*rep.c->callback)(rep.c, rep.c->cb_arg, NETEVENT_NOERROR, &rep)) { @@ -676,7 +713,7 @@ setup_tcp_handler(struct comm_point* c, int fd) { log_assert(c->type == comm_tcp); log_assert(c->fd == -1); - ldns_buffer_clear(c->buffer); + sldns_buffer_clear(c->buffer); c->tcp_is_reading = 1; c->tcp_byte_count = 0; comm_point_start_listening(c, fd, TCP_QUERY_TIMEOUT); @@ -878,7 +915,7 @@ static void tcp_callback_writer(struct comm_point* c) { log_assert(c->type == comm_tcp); - ldns_buffer_clear(c->buffer); + sldns_buffer_clear(c->buffer); if(c->tcp_do_toggle_rw) c->tcp_is_reading = 1; c->tcp_byte_count = 0; @@ -892,7 +929,7 @@ static void tcp_callback_reader(struct comm_point* c) { log_assert(c->type == comm_tcp || c->type == comm_local); - ldns_buffer_flip(c->buffer); + sldns_buffer_flip(c->buffer); if(c->tcp_do_toggle_rw) c->tcp_is_reading = 0; c->tcp_byte_count = 0; @@ -985,7 +1022,7 @@ ssl_handle_read(struct comm_point* c) if(c->tcp_byte_count < sizeof(uint16_t)) { /* read length bytes */ ERR_clear_error(); - if((r=SSL_read(c->ssl, (void*)ldns_buffer_at(c->buffer, + if((r=SSL_read(c->ssl, (void*)sldns_buffer_at(c->buffer, c->tcp_byte_count), (int)(sizeof(uint16_t) - c->tcp_byte_count))) <= 0) { int want = SSL_get_error(c->ssl, r); @@ -1009,24 +1046,24 @@ ssl_handle_read(struct comm_point* c) c->tcp_byte_count += r; if(c->tcp_byte_count != sizeof(uint16_t)) return 1; - if(ldns_buffer_read_u16_at(c->buffer, 0) > - ldns_buffer_capacity(c->buffer)) { + if(sldns_buffer_read_u16_at(c->buffer, 0) > + sldns_buffer_capacity(c->buffer)) { verbose(VERB_QUERY, "ssl: dropped larger than buffer"); return 0; } - ldns_buffer_set_limit(c->buffer, - ldns_buffer_read_u16_at(c->buffer, 0)); - if(ldns_buffer_limit(c->buffer) < LDNS_HEADER_SIZE) { + sldns_buffer_set_limit(c->buffer, + sldns_buffer_read_u16_at(c->buffer, 0)); + if(sldns_buffer_limit(c->buffer) < LDNS_HEADER_SIZE) { verbose(VERB_QUERY, "ssl: dropped bogus too short."); return 0; } verbose(VERB_ALGO, "Reading ssl tcp query of length %d", - (int)ldns_buffer_limit(c->buffer)); + (int)sldns_buffer_limit(c->buffer)); } - log_assert(ldns_buffer_remaining(c->buffer) > 0); + log_assert(sldns_buffer_remaining(c->buffer) > 0); ERR_clear_error(); - r = SSL_read(c->ssl, (void*)ldns_buffer_current(c->buffer), - (int)ldns_buffer_remaining(c->buffer)); + r = SSL_read(c->ssl, (void*)sldns_buffer_current(c->buffer), + (int)sldns_buffer_remaining(c->buffer)); if(r <= 0) { int want = SSL_get_error(c->ssl, r); if(want == SSL_ERROR_ZERO_RETURN) { @@ -1046,8 +1083,8 @@ ssl_handle_read(struct comm_point* c) log_crypto_err("could not SSL_read"); return 0; } - ldns_buffer_skip(c->buffer, (ssize_t)r); - if(ldns_buffer_remaining(c->buffer) <= 0) { + sldns_buffer_skip(c->buffer, (ssize_t)r); + if(sldns_buffer_remaining(c->buffer) <= 0) { tcp_callback_reader(c); } return 1; @@ -1072,7 +1109,7 @@ ssl_handle_write(struct comm_point* c) /* ignore return, if fails we may simply block */ (void)SSL_set_mode(c->ssl, SSL_MODE_ENABLE_PARTIAL_WRITE); if(c->tcp_byte_count < sizeof(uint16_t)) { - uint16_t len = htons(ldns_buffer_limit(c->buffer)); + uint16_t len = htons(sldns_buffer_limit(c->buffer)); ERR_clear_error(); r = SSL_write(c->ssl, (void*)(((uint8_t*)&len)+c->tcp_byte_count), @@ -1099,17 +1136,17 @@ ssl_handle_write(struct comm_point* c) c->tcp_byte_count += r; if(c->tcp_byte_count < sizeof(uint16_t)) return 1; - ldns_buffer_set_position(c->buffer, c->tcp_byte_count - + sldns_buffer_set_position(c->buffer, c->tcp_byte_count - sizeof(uint16_t)); - if(ldns_buffer_remaining(c->buffer) == 0) { + if(sldns_buffer_remaining(c->buffer) == 0) { tcp_callback_writer(c); return 1; } } - log_assert(ldns_buffer_remaining(c->buffer) > 0); + log_assert(sldns_buffer_remaining(c->buffer) > 0); ERR_clear_error(); - r = SSL_write(c->ssl, (void*)ldns_buffer_current(c->buffer), - (int)ldns_buffer_remaining(c->buffer)); + r = SSL_write(c->ssl, (void*)sldns_buffer_current(c->buffer), + (int)sldns_buffer_remaining(c->buffer)); if(r <= 0) { int want = SSL_get_error(c->ssl, r); if(want == SSL_ERROR_ZERO_RETURN) { @@ -1129,9 +1166,9 @@ ssl_handle_write(struct comm_point* c) log_crypto_err("could not SSL_write"); return 0; } - ldns_buffer_skip(c->buffer, (ssize_t)r); + sldns_buffer_skip(c->buffer, (ssize_t)r); - if(ldns_buffer_remaining(c->buffer) == 0) { + if(sldns_buffer_remaining(c->buffer) == 0) { tcp_callback_writer(c); } return 1; @@ -1169,7 +1206,7 @@ comm_point_tcp_handle_read(int fd, struct comm_point* c, int short_ok) log_assert(fd != -1); if(c->tcp_byte_count < sizeof(uint16_t)) { /* read length bytes */ - r = recv(fd,(void*)ldns_buffer_at(c->buffer,c->tcp_byte_count), + r = recv(fd,(void*)sldns_buffer_at(c->buffer,c->tcp_byte_count), sizeof(uint16_t)-c->tcp_byte_count, 0); if(r == 0) return 0; @@ -1201,25 +1238,25 @@ comm_point_tcp_handle_read(int fd, struct comm_point* c, int short_ok) c->tcp_byte_count += r; if(c->tcp_byte_count != sizeof(uint16_t)) return 1; - if(ldns_buffer_read_u16_at(c->buffer, 0) > - ldns_buffer_capacity(c->buffer)) { + if(sldns_buffer_read_u16_at(c->buffer, 0) > + sldns_buffer_capacity(c->buffer)) { verbose(VERB_QUERY, "tcp: dropped larger than buffer"); return 0; } - ldns_buffer_set_limit(c->buffer, - ldns_buffer_read_u16_at(c->buffer, 0)); + sldns_buffer_set_limit(c->buffer, + sldns_buffer_read_u16_at(c->buffer, 0)); if(!short_ok && - ldns_buffer_limit(c->buffer) < LDNS_HEADER_SIZE) { + sldns_buffer_limit(c->buffer) < LDNS_HEADER_SIZE) { verbose(VERB_QUERY, "tcp: dropped bogus too short."); return 0; } verbose(VERB_ALGO, "Reading tcp query of length %d", - (int)ldns_buffer_limit(c->buffer)); + (int)sldns_buffer_limit(c->buffer)); } - log_assert(ldns_buffer_remaining(c->buffer) > 0); - r = recv(fd, (void*)ldns_buffer_current(c->buffer), - ldns_buffer_remaining(c->buffer), 0); + log_assert(sldns_buffer_remaining(c->buffer) > 0); + r = recv(fd, (void*)sldns_buffer_current(c->buffer), + sldns_buffer_remaining(c->buffer), 0); if(r == 0) { return 0; } else if(r == -1) { @@ -1243,8 +1280,8 @@ comm_point_tcp_handle_read(int fd, struct comm_point* c, int short_ok) c->repinfo.addrlen); return 0; } - ldns_buffer_skip(c->buffer, r); - if(ldns_buffer_remaining(c->buffer) <= 0) { + sldns_buffer_skip(c->buffer, r); + if(sldns_buffer_remaining(c->buffer) <= 0) { tcp_callback_reader(c); } return 1; @@ -1308,13 +1345,13 @@ comm_point_tcp_handle_write(int fd, struct comm_point* c) return ssl_handle_it(c); if(c->tcp_byte_count < sizeof(uint16_t)) { - uint16_t len = htons(ldns_buffer_limit(c->buffer)); + uint16_t len = htons(sldns_buffer_limit(c->buffer)); #ifdef HAVE_WRITEV struct iovec iov[2]; iov[0].iov_base = (uint8_t*)&len + c->tcp_byte_count; iov[0].iov_len = sizeof(uint16_t) - c->tcp_byte_count; - iov[1].iov_base = ldns_buffer_begin(c->buffer); - iov[1].iov_len = ldns_buffer_limit(c->buffer); + iov[1].iov_base = sldns_buffer_begin(c->buffer); + iov[1].iov_len = sldns_buffer_limit(c->buffer); log_assert(iov[0].iov_len > 0); log_assert(iov[1].iov_len > 0); r = writev(fd, iov, 2); @@ -1350,16 +1387,16 @@ comm_point_tcp_handle_write(int fd, struct comm_point* c) c->tcp_byte_count += r; if(c->tcp_byte_count < sizeof(uint16_t)) return 1; - ldns_buffer_set_position(c->buffer, c->tcp_byte_count - + sldns_buffer_set_position(c->buffer, c->tcp_byte_count - sizeof(uint16_t)); - if(ldns_buffer_remaining(c->buffer) == 0) { + if(sldns_buffer_remaining(c->buffer) == 0) { tcp_callback_writer(c); return 1; } } - log_assert(ldns_buffer_remaining(c->buffer) > 0); - r = send(fd, (void*)ldns_buffer_current(c->buffer), - ldns_buffer_remaining(c->buffer), 0); + log_assert(sldns_buffer_remaining(c->buffer) > 0); + r = send(fd, (void*)sldns_buffer_current(c->buffer), + sldns_buffer_remaining(c->buffer), 0); if(r == -1) { #ifndef USE_WINSOCK if(errno == EINTR || errno == EAGAIN) @@ -1379,9 +1416,9 @@ comm_point_tcp_handle_write(int fd, struct comm_point* c) c->repinfo.addrlen); return 0; } - ldns_buffer_skip(c->buffer, r); + sldns_buffer_skip(c->buffer, r); - if(ldns_buffer_remaining(c->buffer) == 0) { + if(sldns_buffer_remaining(c->buffer) == 0) { tcp_callback_writer(c); } @@ -1464,7 +1501,7 @@ void comm_point_raw_handle_callback(int ATTR_UNUSED(fd), } struct comm_point* -comm_point_create_udp(struct comm_base *base, int fd, ldns_buffer* buffer, +comm_point_create_udp(struct comm_base *base, int fd, sldns_buffer* buffer, comm_point_callback_t* callback, void* callback_arg) { struct comm_point* c = (struct comm_point*)calloc(1, @@ -1514,7 +1551,7 @@ comm_point_create_udp(struct comm_base *base, int fd, ldns_buffer* buffer, struct comm_point* comm_point_create_udp_ancil(struct comm_base *base, int fd, - ldns_buffer* buffer, + sldns_buffer* buffer, comm_point_callback_t* callback, void* callback_arg) { struct comm_point* c = (struct comm_point*)calloc(1, @@ -1580,7 +1617,7 @@ comm_point_create_tcp_handler(struct comm_base *base, } c->ev->base = base; c->fd = -1; - c->buffer = ldns_buffer_new(bufsize); + c->buffer = sldns_buffer_new(bufsize); if(!c->buffer) { free(c->ev); free(c); @@ -1588,7 +1625,7 @@ comm_point_create_tcp_handler(struct comm_base *base, } c->timeout = (struct timeval*)malloc(sizeof(struct timeval)); if(!c->timeout) { - ldns_buffer_free(c->buffer); + sldns_buffer_free(c->buffer); free(c->ev); free(c); return NULL; @@ -1705,7 +1742,7 @@ comm_point_create_tcp_out(struct comm_base *base, size_t bufsize, } c->ev->base = base; c->fd = -1; - c->buffer = ldns_buffer_new(bufsize); + c->buffer = sldns_buffer_new(bufsize); if(!c->buffer) { free(c->ev); free(c); @@ -1731,7 +1768,7 @@ comm_point_create_tcp_out(struct comm_base *base, size_t bufsize, if(event_base_set(base->eb->base, &c->ev->ev) != 0) { log_err("could not basetset tcpout event"); - ldns_buffer_free(c->buffer); + sldns_buffer_free(c->buffer); free(c->ev); free(c); return NULL; @@ -1757,7 +1794,7 @@ comm_point_create_local(struct comm_base *base, int fd, size_t bufsize, } c->ev->base = base; c->fd = fd; - c->buffer = ldns_buffer_new(bufsize); + c->buffer = sldns_buffer_new(bufsize); if(!c->buffer) { free(c->ev); free(c); @@ -1882,7 +1919,7 @@ comm_point_delete(struct comm_point* c) } free(c->timeout); if(c->type == comm_tcp || c->type == comm_local) - ldns_buffer_free(c->buffer); + sldns_buffer_free(c->buffer); free(c->ev); free(c); } @@ -1994,7 +2031,7 @@ size_t comm_point_get_mem(struct comm_point* c) if(c->timeout) s += sizeof(*c->timeout); if(c->type == comm_tcp || c->type == comm_local) - s += sizeof(*c->buffer) + ldns_buffer_capacity(c->buffer); + s += sizeof(*c->buffer) + sldns_buffer_capacity(c->buffer); if(c->type == comm_tcp_accept) { int i; for(i=0; imax_tcp_count; i++) diff --git a/contrib/unbound/util/netevent.h b/contrib/unbound/util/netevent.h index 0ea4cf04145..fe28ca5dd75 100644 --- a/contrib/unbound/util/netevent.h +++ b/contrib/unbound/util/netevent.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -60,7 +60,7 @@ #ifndef NET_EVENT_H #define NET_EVENT_H -#include +struct sldns_buffer; struct comm_point; struct comm_reply; struct event_base; @@ -149,7 +149,7 @@ struct comm_point { struct timeval* timeout; /** buffer pointer. Either to perthread, or own buffer or NULL */ - ldns_buffer* buffer; + struct sldns_buffer* buffer; /* -------- TCP Handler -------- */ /** Read/Write state for TCP */ @@ -294,6 +294,21 @@ struct comm_signal { */ struct comm_base* comm_base_create(int sigs); +/** + * Create comm base that uses the given event_base (underlying event + * mechanism pointer). + * @param base: underlying lib event base. + * @return: the new comm base. NULL on error. + */ +struct comm_base* comm_base_create_event(struct event_base* base); + +/** + * Delete comm base structure but not the underlying lib event base. + * All comm points must have been deleted. + * @param b: the base to delete. + */ +void comm_base_delete_no_base(struct comm_base* b); + /** * Destroy a comm base. * All comm points must have been deleted. @@ -308,7 +323,7 @@ void comm_base_delete(struct comm_base* b); * @param tt: pointer to time in seconds is returned. * @param tv: pointer to time in microseconds is returned. */ -void comm_base_timept(struct comm_base* b, uint32_t** tt, struct timeval** tv); +void comm_base_timept(struct comm_base* b, time_t** tt, struct timeval** tv); /** * Dispatch the comm base events. @@ -352,7 +367,7 @@ struct event_base* comm_base_internal(struct comm_base* b); * Sets timeout to NULL. Turns off TCP options. */ struct comm_point* comm_point_create_udp(struct comm_base* base, - int fd, ldns_buffer* buffer, + int fd, struct sldns_buffer* buffer, comm_point_callback_t* callback, void* callback_arg); /** @@ -368,7 +383,7 @@ struct comm_point* comm_point_create_udp(struct comm_base* base, * Sets timeout to NULL. Turns off TCP options. */ struct comm_point* comm_point_create_udp_ancil(struct comm_base* base, - int fd, ldns_buffer* buffer, + int fd, struct sldns_buffer* buffer, comm_point_callback_t* callback, void* callback_arg); /** @@ -462,7 +477,7 @@ void comm_point_drop_reply(struct comm_reply* repinfo); * @param addrlen: length of addr. * @return: false on a failure. */ -int comm_point_send_udp_msg(struct comm_point* c, ldns_buffer* packet, +int comm_point_send_udp_msg(struct comm_point* c, struct sldns_buffer* packet, struct sockaddr* addr, socklen_t addrlen); /** diff --git a/contrib/unbound/util/random.c b/contrib/unbound/util/random.c index 5d71fcfa4c1..8a24ff04d99 100644 --- a/contrib/unbound/util/random.c +++ b/contrib/unbound/util/random.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -60,6 +60,7 @@ #include "config.h" #include "util/random.h" #include "util/log.h" +#include #ifdef HAVE_SSL #include #include diff --git a/contrib/unbound/util/random.h b/contrib/unbound/util/random.h index 99879dca814..a05a994a3d5 100644 --- a/contrib/unbound/util/random.h +++ b/contrib/unbound/util/random.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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 UTIL_RANDOM_H diff --git a/contrib/unbound/util/rbtree.c b/contrib/unbound/util/rbtree.c index d31afd9c54c..a898f13f022 100644 --- a/contrib/unbound/util/rbtree.c +++ b/contrib/unbound/util/rbtree.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. * */ diff --git a/contrib/unbound/util/rbtree.h b/contrib/unbound/util/rbtree.h index 879804dd860..50c84bbab38 100644 --- a/contrib/unbound/util/rbtree.h +++ b/contrib/unbound/util/rbtree.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. * */ diff --git a/contrib/unbound/util/regional.c b/contrib/unbound/util/regional.c index 8b1fcdbb2ac..899a54edbdd 100644 --- a/contrib/unbound/util/regional.c +++ b/contrib/unbound/util/regional.c @@ -23,16 +23,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/util/regional.h b/contrib/unbound/util/regional.h index 250523a6d9b..e8b2cb8d00c 100644 --- a/contrib/unbound/util/regional.h +++ b/contrib/unbound/util/regional.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/util/rtt.c b/contrib/unbound/util/rtt.c index c888b0864f0..4b44fca5060 100644 --- a/contrib/unbound/util/rtt.c +++ b/contrib/unbound/util/rtt.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/util/rtt.h b/contrib/unbound/util/rtt.h index 1af5484c983..57e904d1407 100644 --- a/contrib/unbound/util/rtt.h +++ b/contrib/unbound/util/rtt.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/util/storage/dnstree.c b/contrib/unbound/util/storage/dnstree.c index 003e8af3ef3..0df490ee556 100644 --- a/contrib/unbound/util/storage/dnstree.c +++ b/contrib/unbound/util/storage/dnstree.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/util/storage/dnstree.h b/contrib/unbound/util/storage/dnstree.h index 3ecbd128f8c..ec8189100f9 100644 --- a/contrib/unbound/util/storage/dnstree.h +++ b/contrib/unbound/util/storage/dnstree.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/util/storage/lookup3.c b/contrib/unbound/util/storage/lookup3.c index 845cc388624..7596033bdee 100644 --- a/contrib/unbound/util/storage/lookup3.c +++ b/contrib/unbound/util/storage/lookup3.c @@ -50,6 +50,9 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy. #include /* defines time_t for timings in the test */ /*#include defines uint32_t etc (from config.h) */ #include /* attempt to define endianness */ +#ifdef HAVE_SYS_TYPES_H +# include /* attempt to define endianness (solaris) */ +#endif #ifdef linux # include /* attempt to define endianness */ #endif @@ -61,7 +64,7 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy. #endif /* random initial value */ -static uint32_t raninit = 0xdeadbeef; +static uint32_t raninit = (uint32_t)0xdeadbeef; void hash_set_raninit(uint32_t v) @@ -75,22 +78,25 @@ hash_set_raninit(uint32_t v) */ #if (defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && \ __BYTE_ORDER == __LITTLE_ENDIAN) || \ - (defined(_BYTE_ORDER) && defined(_LITTLE_ENDIAN) && \ - _BYTE_ORDER == _LITTLE_ENDIAN) || \ (defined(i386) || defined(__i386__) || defined(__i486__) || \ - defined(__i586__) || defined(__i686__) || defined(vax) || defined(MIPSEL)) + defined(__i586__) || defined(__i686__) || defined(vax) || defined(MIPSEL) || defined(__x86)) # define HASH_LITTLE_ENDIAN 1 # define HASH_BIG_ENDIAN 0 -#elif (!defined(_BYTE_ORDER) && !defined(__BYTE_ORDER) && defined(_BIG_ENDIAN)) -# define HASH_LITTLE_ENDIAN 0 -# define HASH_BIG_ENDIAN 1 #elif (defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && \ __BYTE_ORDER == __BIG_ENDIAN) || \ - (defined(_BYTE_ORDER) && defined(_BIG_ENDIAN) && \ - _BYTE_ORDER == _BIG_ENDIAN) || \ - (defined(sparc) || defined(POWERPC) || defined(mc68000) || defined(sel)) + (defined(sparc) || defined(__sparc) || defined(__sparc__) || defined(POWERPC) || defined(mc68000) || defined(sel)) # define HASH_LITTLE_ENDIAN 0 # define HASH_BIG_ENDIAN 1 +#elif defined(_MACHINE_ENDIAN_H_) +/* test for machine_endian_h protects failure if some are empty strings */ +# if defined(_BYTE_ORDER) && defined(_BIG_ENDIAN) && _BYTE_ORDER == _BIG_ENDIAN +# define HASH_LITTLE_ENDIAN 0 +# define HASH_BIG_ENDIAN 1 +# endif +# if defined(_BYTE_ORDER) && defined(_LITTLE_ENDIAN) && _BYTE_ORDER == _LITTLE_ENDIAN +# define HASH_LITTLE_ENDIAN 1 +# define HASH_BIG_ENDIAN 0 +# endif /* _MACHINE_ENDIAN_H_ */ #else # define HASH_LITTLE_ENDIAN 0 # define HASH_BIG_ENDIAN 0 diff --git a/contrib/unbound/util/storage/lookup3.h b/contrib/unbound/util/storage/lookup3.h index 06211fdde22..59dad7c48b5 100644 --- a/contrib/unbound/util/storage/lookup3.h +++ b/contrib/unbound/util/storage/lookup3.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/util/storage/lruhash.c b/contrib/unbound/util/storage/lruhash.c index c22278dda1e..2c987a2e563 100644 --- a/contrib/unbound/util/storage/lruhash.c +++ b/contrib/unbound/util/storage/lruhash.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/util/storage/lruhash.h b/contrib/unbound/util/storage/lruhash.h index d0efe2d3b59..30377d8e701 100644 --- a/contrib/unbound/util/storage/lruhash.h +++ b/contrib/unbound/util/storage/lruhash.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/util/storage/slabhash.c b/contrib/unbound/util/storage/slabhash.c index 9c0c5071175..128edd84ad7 100644 --- a/contrib/unbound/util/storage/slabhash.c +++ b/contrib/unbound/util/storage/slabhash.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/util/storage/slabhash.h b/contrib/unbound/util/storage/slabhash.h index 93228febcfe..cf968f9653d 100644 --- a/contrib/unbound/util/storage/slabhash.h +++ b/contrib/unbound/util/storage/slabhash.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/util/timehist.c b/contrib/unbound/util/timehist.c index 98d8db1c8f0..dbf5b98417c 100644 --- a/contrib/unbound/util/timehist.c +++ b/contrib/unbound/util/timehist.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -43,6 +43,7 @@ #include #endif #include +#include #include "util/timehist.h" #include "util/log.h" diff --git a/contrib/unbound/util/timehist.h b/contrib/unbound/util/timehist.h index d59448399b9..5c65048b9bb 100644 --- a/contrib/unbound/util/timehist.h +++ b/contrib/unbound/util/timehist.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/util/tube.c b/contrib/unbound/util/tube.c index 28c51d79d16..2106a078c8d 100644 --- a/contrib/unbound/util/tube.c +++ b/contrib/unbound/util/tube.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -368,7 +368,7 @@ int tube_read_msg(struct tube* tube, uint8_t** buf, uint32_t* len, return 0; } d = 0; - while(d != (ssize_t)*len) { + while(d < (ssize_t)*len) { if((r=read(fd, (*buf)+d, (size_t)((ssize_t)*len)-d)) == -1) { log_err("tube msg read failed: %s", strerror(errno)); (void)fd_set_nonblock(fd); diff --git a/contrib/unbound/util/tube.h b/contrib/unbound/util/tube.h index 2e704115637..9ec50af3849 100644 --- a/contrib/unbound/util/tube.h +++ b/contrib/unbound/util/tube.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/util/winsock_event.c b/contrib/unbound/util/winsock_event.c index ff5c9b0939d..38661a5e1a8 100644 --- a/contrib/unbound/util/winsock_event.c +++ b/contrib/unbound/util/winsock_event.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** * \file @@ -41,6 +41,10 @@ #include "config.h" #ifdef USE_WINSOCK #include +#ifdef HAVE_TIME_H +#include +#endif +#include #include "util/winsock_event.h" #include "util/fptr_wlist.h" @@ -71,7 +75,7 @@ settime(struct event_base* base) return -1; } #ifndef S_SPLINT_S - *base->time_secs = (uint32_t)base->time_tv->tv_sec; + *base->time_secs = (time_t)base->time_tv->tv_sec; #endif return 0; } @@ -108,7 +112,7 @@ zero_waitfor(WSAEVENT waitfor[], WSAEVENT x) } } -void *event_init(uint32_t* time_secs, struct timeval* time_tv) +void *event_init(time_t* time_secs, struct timeval* time_tv) { struct event_base* base = (struct event_base*)malloc( sizeof(struct event_base)); @@ -181,8 +185,8 @@ static void handle_timeouts(struct event_base* base, struct timeval* now, wait->tv_usec = p->ev_timeout.tv_usec - now->tv_usec; } - verbose(VERB_CLIENT, "winsock_event wait=%d.%6.6d", - (int)wait->tv_sec, (int)wait->tv_usec); + verbose(VERB_CLIENT, "winsock_event wait=" ARG_LL "d.%6.6d", + (long long)wait->tv_sec, (int)wait->tv_usec); return; } #endif @@ -488,9 +492,9 @@ int event_base_set(struct event_base *base, struct event *ev) int event_add(struct event *ev, struct timeval *tv) { - verbose(VERB_ALGO, "event_add %p added=%d fd=%d tv=%d %s%s%s", + verbose(VERB_ALGO, "event_add %p added=%d fd=%d tv=" ARG_LL "d %s%s%s", ev, ev->added, ev->ev_fd, - (tv?(int)tv->tv_sec*1000+(int)tv->tv_usec/1000:-1), + (tv?(long long)tv->tv_sec*1000+(long long)tv->tv_usec/1000:-1), (ev->ev_events&EV_READ)?" EV_READ":"", (ev->ev_events&EV_WRITE)?" EV_WRITE":"", (ev->ev_events&EV_TIMEOUT)?" EV_TIMEOUT":""); @@ -569,10 +573,10 @@ int event_add(struct event *ev, struct timeval *tv) int event_del(struct event *ev) { - verbose(VERB_ALGO, "event_del %p added=%d fd=%d tv=%d %s%s%s", + verbose(VERB_ALGO, "event_del %p added=%d fd=%d tv=" ARG_LL "d %s%s%s", ev, ev->added, ev->ev_fd, - (ev->ev_events&EV_TIMEOUT)?(int)ev->ev_timeout.tv_sec*1000+ - (int)ev->ev_timeout.tv_usec/1000:-1, + (ev->ev_events&EV_TIMEOUT)?(long long)ev->ev_timeout.tv_sec*1000+ + (long long)ev->ev_timeout.tv_usec/1000:-1, (ev->ev_events&EV_READ)?" EV_READ":"", (ev->ev_events&EV_WRITE)?" EV_WRITE":"", (ev->ev_events&EV_TIMEOUT)?" EV_TIMEOUT":""); diff --git a/contrib/unbound/util/winsock_event.h b/contrib/unbound/util/winsock_event.h index 088283e128a..40892c14b1c 100644 --- a/contrib/unbound/util/winsock_event.h +++ b/contrib/unbound/util/winsock_event.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -129,7 +129,7 @@ struct event_base /** if we need to exit */ int need_to_exit; /** where to store time in seconds */ - uint32_t* time_secs; + time_t* time_secs; /** where to store time in microseconds */ struct timeval* time_tv; /** @@ -194,7 +194,7 @@ struct event { }; /** create event base */ -void *event_init(uint32_t* time_secs, struct timeval* time_tv); +void *event_init(time_t* time_secs, struct timeval* time_tv); /** get version */ const char *event_get_version(void); /** get polling method (select,epoll) */ diff --git a/contrib/unbound/validator/autotrust.c b/contrib/unbound/validator/autotrust.c index 99537d18aee..a597633828f 100644 --- a/contrib/unbound/validator/autotrust.c +++ b/contrib/unbound/validator/autotrust.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -41,7 +41,6 @@ * It was modified to fit into unbound. The state table process is the same. */ #include "config.h" -#include #include "validator/autotrust.h" #include "validator/val_anchor.h" #include "validator/val_utils.h" @@ -58,6 +57,13 @@ #include "services/mesh.h" #include "services/cache/rrset.h" #include "validator/val_kcache.h" +#include "ldns/sbuffer.h" +#include "ldns/wire2str.h" +#include "ldns/str2wire.h" +#include "ldns/keyraw.h" +#include "ldns/rrdef.h" +#include +#include /** number of times a key must be seen before it can become valid */ #define MIN_PENDINGCOUNT 2 @@ -138,8 +144,11 @@ verbose_key(struct autr_ta* ta, enum verbosity_value level, va_list args; va_start(args, format); if(verbosity >= level) { - char* str = ldns_rdf2str(ldns_rr_owner(ta->rr)); - int keytag = (int)ldns_calc_keytag(ta->rr); + char* str = sldns_wire2str_dname(ta->rr, ta->dname_len); + int keytag = (int)sldns_calc_keytag_raw(sldns_wirerr_get_rdata( + ta->rr, ta->rr_len, ta->dname_len), + sldns_wirerr_get_rdatalen(ta->rr, ta->rr_len, + ta->dname_len)); char msg[MAXSYSLOGMSGLEN]; vsnprintf(msg, sizeof(msg), format, args); verbose(level, "%s key %d %s", str?str:"??", keytag, msg); @@ -242,7 +251,7 @@ parse_comments(char* str, struct autr_ta* ta) if (pos < 0 || !timestamp) ta->last_change = 0; else - ta->last_change = (uint32_t)timestamp; + ta->last_change = (time_t)timestamp; free(comment); return 1; @@ -262,55 +271,76 @@ str_contains_data(char* str, char comment) return 0; } -/** Get DNSKEY flags */ +/** Get DNSKEY flags + * rdata without rdatalen in front of it. */ static int -dnskey_flags(ldns_rr* rr) +dnskey_flags(uint16_t t, uint8_t* rdata, size_t len) { - if(ldns_rr_get_type(rr) != LDNS_RR_TYPE_DNSKEY) + uint16_t f; + if(t != LDNS_RR_TYPE_DNSKEY) return 0; - return (int)ldns_read_uint16(ldns_rdf_data(ldns_rr_dnskey_flags(rr))); + if(len < 2) + return 0; + memmove(&f, rdata, 2); + f = ntohs(f); + return (int)f; } - -/** Check if KSK DNSKEY */ +/** Check if KSK DNSKEY. + * pass rdata without rdatalen in front of it */ static int -rr_is_dnskey_sep(ldns_rr* rr) +rr_is_dnskey_sep(uint16_t t, uint8_t* rdata, size_t len) { - return (dnskey_flags(rr)&DNSKEY_BIT_SEP); + return (dnskey_flags(t, rdata, len)&DNSKEY_BIT_SEP); } -/** Check if REVOKED DNSKEY */ +/** Check if TA is KSK DNSKEY */ static int -rr_is_dnskey_revoked(ldns_rr* rr) +ta_is_dnskey_sep(struct autr_ta* ta) { - return (dnskey_flags(rr)&LDNS_KEY_REVOKE_KEY); + return (dnskey_flags( + sldns_wirerr_get_type(ta->rr, ta->rr_len, ta->dname_len), + sldns_wirerr_get_rdata(ta->rr, ta->rr_len, ta->dname_len), + sldns_wirerr_get_rdatalen(ta->rr, ta->rr_len, ta->dname_len) + ) & DNSKEY_BIT_SEP); +} + +/** Check if REVOKED DNSKEY + * pass rdata without rdatalen in front of it */ +static int +rr_is_dnskey_revoked(uint16_t t, uint8_t* rdata, size_t len) +{ + return (dnskey_flags(t, rdata, len)&LDNS_KEY_REVOKE_KEY); } /** create ta */ static struct autr_ta* -autr_ta_create(ldns_rr* rr) +autr_ta_create(uint8_t* rr, size_t rr_len, size_t dname_len) { struct autr_ta* ta = (struct autr_ta*)calloc(1, sizeof(*ta)); if(!ta) { - ldns_rr_free(rr); + free(rr); return NULL; } ta->rr = rr; + ta->rr_len = rr_len; + ta->dname_len = dname_len; return ta; } /** create tp */ static struct trust_anchor* -autr_tp_create(struct val_anchors* anchors, ldns_rdf* own, uint16_t dc) +autr_tp_create(struct val_anchors* anchors, uint8_t* own, size_t own_len, + uint16_t dc) { struct trust_anchor* tp = (struct trust_anchor*)calloc(1, sizeof(*tp)); if(!tp) return NULL; - tp->name = memdup(ldns_rdf_data(own), ldns_rdf_size(own)); + tp->name = memdup(own, own_len); if(!tp->name) { free(tp); return NULL; } - tp->namelen = ldns_rdf_size(own); + tp->namelen = own_len; tp->namelabs = dname_count_labels(tp->name); tp->node.key = tp; tp->dclass = dc; @@ -371,7 +401,7 @@ void autr_point_delete(struct trust_anchor* tp) struct autr_ta* p = tp->autr->keys, *np; while(p) { np = p->next; - ldns_rr_free(p->rr); + free(p->rr); free(p); p = np; } @@ -384,13 +414,12 @@ void autr_point_delete(struct trust_anchor* tp) /** find or add a new trust point for autotrust */ static struct trust_anchor* -find_add_tp(struct val_anchors* anchors, ldns_rr* rr) +find_add_tp(struct val_anchors* anchors, uint8_t* rr, size_t rr_len, + size_t dname_len) { struct trust_anchor* tp; - ldns_rdf* own = ldns_rr_owner(rr); - tp = anchor_find(anchors, ldns_rdf_data(own), - dname_count_labels(ldns_rdf_data(own)), - ldns_rdf_size(own), ldns_rr_get_class(rr)); + tp = anchor_find(anchors, rr, dname_count_labels(rr), dname_len, + sldns_wirerr_get_class(rr, rr_len, dname_len)); if(tp) { if(!tp->autr) { log_err("anchor cannot be with and without autotrust"); @@ -399,22 +428,23 @@ find_add_tp(struct val_anchors* anchors, ldns_rr* rr) } return tp; } - tp = autr_tp_create(anchors, ldns_rr_owner(rr), ldns_rr_get_class(rr)); + tp = autr_tp_create(anchors, rr, dname_len, sldns_wirerr_get_class(rr, + rr_len, dname_len)); lock_basic_lock(&tp->lock); return tp; } /** Add trust anchor from RR */ static struct autr_ta* -add_trustanchor_frm_rr(struct val_anchors* anchors, ldns_rr* rr, - struct trust_anchor** tp) +add_trustanchor_frm_rr(struct val_anchors* anchors, uint8_t* rr, size_t rr_len, + size_t dname_len, struct trust_anchor** tp) { - struct autr_ta* ta = autr_ta_create(rr); + struct autr_ta* ta = autr_ta_create(rr, rr_len, dname_len); if(!ta) return NULL; - *tp = find_add_tp(anchors, rr); + *tp = find_add_tp(anchors, rr, rr_len, dname_len); if(!*tp) { - ldns_rr_free(ta->rr); + free(ta->rr); free(ta); return NULL; } @@ -431,34 +461,51 @@ add_trustanchor_frm_rr(struct val_anchors* anchors, ldns_rr* rr, * @param str: string with anchor and comments, if any comments. * @param tp: trust point returned. * @param origin: what to use for @ + * @param origin_len: length of origin * @param prev: previous rr name + * @param prev_len: length of prev * @param skip: if true, the result is NULL, but not an error, skip it. * @return new key in trust point. */ static struct autr_ta* add_trustanchor_frm_str(struct val_anchors* anchors, char* str, - struct trust_anchor** tp, ldns_rdf* origin, ldns_rdf** prev, int* skip) + struct trust_anchor** tp, uint8_t* origin, size_t origin_len, + uint8_t** prev, size_t* prev_len, int* skip) { - ldns_rr* rr; - ldns_status lstatus; + uint8_t rr[LDNS_RR_BUF_SIZE]; + size_t rr_len = sizeof(rr), dname_len; + uint8_t* drr; + int lstatus; if (!str_contains_data(str, ';')) { *skip = 1; return NULL; /* empty line */ } - if (LDNS_STATUS_OK != - (lstatus = ldns_rr_new_frm_str(&rr, str, 0, origin, prev))) - { - log_err("ldns error while converting string to RR: %s", - ldns_get_errorstr_by_id(lstatus)); - return NULL; - } - if(ldns_rr_get_type(rr) != LDNS_RR_TYPE_DNSKEY && - ldns_rr_get_type(rr) != LDNS_RR_TYPE_DS) { - ldns_rr_free(rr); + if(0 != (lstatus = sldns_str2wire_rr_buf(str, rr, &rr_len, &dname_len, + 0, origin, origin_len, *prev, *prev_len))) + { + log_err("ldns error while converting string to RR at%d: %s: %s", + LDNS_WIREPARSE_OFFSET(lstatus), + sldns_get_errorstr_parse(lstatus), str); + return NULL; + } + free(*prev); + *prev = memdup(rr, dname_len); + *prev_len = dname_len; + if(!*prev) { + log_err("malloc failure in add_trustanchor"); + return NULL; + } + if(sldns_wirerr_get_type(rr, rr_len, dname_len)!=LDNS_RR_TYPE_DNSKEY && + sldns_wirerr_get_type(rr, rr_len, dname_len)!=LDNS_RR_TYPE_DS) { *skip = 1; return NULL; /* only DS and DNSKEY allowed */ } - return add_trustanchor_frm_rr(anchors, rr, tp); + drr = memdup(rr, rr_len); + if(!drr) { + log_err("malloc failure in add trustanchor"); + return NULL; + } + return add_trustanchor_frm_rr(anchors, drr, rr_len, dname_len, tp); } /** @@ -467,18 +514,22 @@ add_trustanchor_frm_str(struct val_anchors* anchors, char* str, * @param str: comments line * @param fname: filename * @param origin: the $ORIGIN. + * @param origin_len: length of origin * @param prev: passed to ldns. + * @param prev_len: length of prev * @param skip: if true, the result is NULL, but not an error, skip it. * @return false on failure, otherwise the tp read. */ static struct trust_anchor* load_trustanchor(struct val_anchors* anchors, char* str, const char* fname, - ldns_rdf* origin, ldns_rdf** prev, int* skip) + uint8_t* origin, size_t origin_len, uint8_t** prev, size_t* prev_len, + int* skip) { - struct autr_ta* ta = NULL; - struct trust_anchor* tp = NULL; + struct autr_ta* ta = NULL; + struct trust_anchor* tp = NULL; - ta = add_trustanchor_frm_str(anchors, str, &tp, origin, prev, skip); + ta = add_trustanchor_frm_str(anchors, str, &tp, origin, origin_len, + prev, prev_len, skip); if(!ta) return NULL; lock_basic_lock(&tp->lock); @@ -498,70 +549,228 @@ load_trustanchor(struct val_anchors* anchors, char* str, const char* fname, return tp; } +/** iterator for DSes from keylist. return true if a next element exists */ +static int +assemble_iterate_ds(struct autr_ta** list, uint8_t** rr, size_t* rr_len, + size_t* dname_len) +{ + while(*list) { + if(sldns_wirerr_get_type((*list)->rr, (*list)->rr_len, + (*list)->dname_len) == LDNS_RR_TYPE_DS) { + *rr = (*list)->rr; + *rr_len = (*list)->rr_len; + *dname_len = (*list)->dname_len; + *list = (*list)->next; + return 1; + } + *list = (*list)->next; + } + return 0; +} + +/** iterator for DNSKEYs from keylist. return true if a next element exists */ +static int +assemble_iterate_dnskey(struct autr_ta** list, uint8_t** rr, size_t* rr_len, + size_t* dname_len) +{ + while(*list) { + if(sldns_wirerr_get_type((*list)->rr, (*list)->rr_len, + (*list)->dname_len) != LDNS_RR_TYPE_DS && + ((*list)->s == AUTR_STATE_VALID || + (*list)->s == AUTR_STATE_MISSING)) { + *rr = (*list)->rr; + *rr_len = (*list)->rr_len; + *dname_len = (*list)->dname_len; + *list = (*list)->next; + return 1; + } + *list = (*list)->next; + } + return 0; +} + +/** see if iterator-list has any elements in it, or it is empty */ +static int +assemble_iterate_hasfirst(int iter(struct autr_ta**, uint8_t**, size_t*, + size_t*), struct autr_ta* list) +{ + uint8_t* rr = NULL; + size_t rr_len = 0, dname_len = 0; + return iter(&list, &rr, &rr_len, &dname_len); +} + +/** number of elements in iterator list */ +static size_t +assemble_iterate_count(int iter(struct autr_ta**, uint8_t**, size_t*, + size_t*), struct autr_ta* list) +{ + uint8_t* rr = NULL; + size_t i = 0, rr_len = 0, dname_len = 0; + while(iter(&list, &rr, &rr_len, &dname_len)) { + i++; + } + return i; +} + +/** + * Create a ub_packed_rrset_key allocated on the heap. + * It therefore does not have the correct ID value, and cannot be used + * inside the cache. It can be used in storage outside of the cache. + * Keys for the cache have to be obtained from alloc.h . + * @param iter: iterator over the elements in the list. It filters elements. + * @param list: the list. + * @return key allocated or NULL on failure. + */ +static struct ub_packed_rrset_key* +ub_packed_rrset_heap_key(int iter(struct autr_ta**, uint8_t**, size_t*, + size_t*), struct autr_ta* list) +{ + uint8_t* rr = NULL; + size_t rr_len = 0, dname_len = 0; + struct ub_packed_rrset_key* k; + if(!iter(&list, &rr, &rr_len, &dname_len)) + return NULL; + k = (struct ub_packed_rrset_key*)calloc(1, sizeof(*k)); + if(!k) + return NULL; + k->rk.type = htons(sldns_wirerr_get_type(rr, rr_len, dname_len)); + k->rk.rrset_class = htons(sldns_wirerr_get_class(rr, rr_len, dname_len)); + k->rk.dname_len = dname_len; + k->rk.dname = memdup(rr, dname_len); + if(!k->rk.dname) { + free(k); + return NULL; + } + return k; +} + +/** + * Create packed_rrset data on the heap. + * @param iter: iterator over the elements in the list. It filters elements. + * @param list: the list. + * @return data allocated or NULL on failure. + */ +static struct packed_rrset_data* +packed_rrset_heap_data(int iter(struct autr_ta**, uint8_t**, size_t*, + size_t*), struct autr_ta* list) +{ + uint8_t* rr = NULL; + size_t rr_len = 0, dname_len = 0; + struct packed_rrset_data* data; + size_t count=0, rrsig_count=0, len=0, i, total; + uint8_t* nextrdata; + struct autr_ta* list_i; + time_t ttl = 0; + + list_i = list; + while(iter(&list_i, &rr, &rr_len, &dname_len)) { + if(sldns_wirerr_get_type(rr, rr_len, dname_len) == + LDNS_RR_TYPE_RRSIG) + rrsig_count++; + else count++; + /* sizeof the rdlength + rdatalen */ + len += 2 + sldns_wirerr_get_rdatalen(rr, rr_len, dname_len); + ttl = (time_t)sldns_wirerr_get_ttl(rr, rr_len, dname_len); + } + if(count == 0 && rrsig_count == 0) + return NULL; + + /* allocate */ + total = count + rrsig_count; + len += sizeof(*data) + total*(sizeof(size_t) + sizeof(time_t) + + sizeof(uint8_t*)); + data = (struct packed_rrset_data*)calloc(1, len); + if(!data) + return NULL; + + /* fill it */ + data->ttl = ttl; + data->count = count; + data->rrsig_count = rrsig_count; + data->rr_len = (size_t*)((uint8_t*)data + + sizeof(struct packed_rrset_data)); + data->rr_data = (uint8_t**)&(data->rr_len[total]); + data->rr_ttl = (time_t*)&(data->rr_data[total]); + nextrdata = (uint8_t*)&(data->rr_ttl[total]); + + /* fill out len, ttl, fields */ + list_i = list; + i = 0; + while(iter(&list_i, &rr, &rr_len, &dname_len)) { + data->rr_ttl[i] = (time_t)sldns_wirerr_get_ttl(rr, rr_len, + dname_len); + if(data->rr_ttl[i] < data->ttl) + data->ttl = data->rr_ttl[i]; + data->rr_len[i] = 2 /* the rdlength */ + + sldns_wirerr_get_rdatalen(rr, rr_len, dname_len); + i++; + } + + /* fixup rest of ptrs */ + for(i=0; irr_data[i] = nextrdata; + nextrdata += data->rr_len[i]; + } + + /* copy data in there */ + list_i = list; + i = 0; + while(iter(&list_i, &rr, &rr_len, &dname_len)) { + memmove(data->rr_data[i], + sldns_wirerr_get_rdatawl(rr, rr_len, dname_len), + data->rr_len[i]); + i++; + } + + if(data->rrsig_count && data->count == 0) { + data->count = data->rrsig_count; /* rrset type is RRSIG */ + data->rrsig_count = 0; + } + return data; +} + /** * Assemble the trust anchors into DS and DNSKEY packed rrsets. * Uses only VALID and MISSING DNSKEYs. - * Read the ldns_rrs and builds packed rrsets + * Read the sldns_rrs and builds packed rrsets * @param tp: the trust point. Must be locked. * @return false on malloc failure. */ static int autr_assemble(struct trust_anchor* tp) { - ldns_rr_list* ds, *dnskey; - struct autr_ta* ta; struct ub_packed_rrset_key* ubds=NULL, *ubdnskey=NULL; - ds = ldns_rr_list_new(); - dnskey = ldns_rr_list_new(); - if(!ds || !dnskey) { - ldns_rr_list_free(ds); - ldns_rr_list_free(dnskey); - return 0; - } - for(ta = tp->autr->keys; ta; ta = ta->next) { - if(ldns_rr_get_type(ta->rr) == LDNS_RR_TYPE_DS) { - if(!ldns_rr_list_push_rr(ds, ta->rr)) { - ldns_rr_list_free(ds); - ldns_rr_list_free(dnskey); - return 0; - } - } else if(ta->s == AUTR_STATE_VALID || - ta->s == AUTR_STATE_MISSING) { - if(!ldns_rr_list_push_rr(dnskey, ta->rr)) { - ldns_rr_list_free(ds); - ldns_rr_list_free(dnskey); - return 0; - } - } - } - /* make packed rrset keys - malloced with no ID number, they * are not in the cache */ /* make packed rrset data (if there is a key) */ - - if(ldns_rr_list_rr_count(ds) > 0) { - ubds = ub_packed_rrset_heap_key(ds); - if(!ubds) + if(assemble_iterate_hasfirst(assemble_iterate_ds, tp->autr->keys)) { + ubds = ub_packed_rrset_heap_key( + assemble_iterate_ds, tp->autr->keys); + if(!ubds) goto error_cleanup; - ubds->entry.data = packed_rrset_heap_data(ds); + ubds->entry.data = packed_rrset_heap_data( + assemble_iterate_ds, tp->autr->keys); if(!ubds->entry.data) goto error_cleanup; } - if(ldns_rr_list_rr_count(dnskey) > 0) { - ubdnskey = ub_packed_rrset_heap_key(dnskey); + + /* make packed DNSKEY data */ + if(assemble_iterate_hasfirst(assemble_iterate_dnskey, tp->autr->keys)) { + ubdnskey = ub_packed_rrset_heap_key( + assemble_iterate_dnskey, tp->autr->keys); if(!ubdnskey) goto error_cleanup; - ubdnskey->entry.data = packed_rrset_heap_data(dnskey); + ubdnskey->entry.data = packed_rrset_heap_data( + assemble_iterate_dnskey, tp->autr->keys); if(!ubdnskey->entry.data) { error_cleanup: autr_rrset_delete(ubds); autr_rrset_delete(ubdnskey); - ldns_rr_list_free(ds); - ldns_rr_list_free(dnskey); return 0; } } + /* we have prepared the new keys so nothing can go wrong any more. * And we are sure we cannot be left without trustanchor after * any errors. Put in the new keys and remove old ones. */ @@ -573,11 +782,10 @@ autr_assemble(struct trust_anchor* tp) /* assign the data to replace the old */ tp->ds_rrset = ubds; tp->dnskey_rrset = ubdnskey; - tp->numDS = ldns_rr_list_rr_count(ds); - tp->numDNSKEY = ldns_rr_list_rr_count(dnskey); - - ldns_rr_list_free(ds); - ldns_rr_list_free(dnskey); + tp->numDS = assemble_iterate_count(assemble_iterate_ds, + tp->autr->keys); + tp->numDNSKEY = assemble_iterate_count(assemble_iterate_dnskey, + tp->autr->keys); return 1; } @@ -601,27 +809,28 @@ parse_id(struct val_anchors* anchors, char* line) { struct trust_anchor *tp; int r; - ldns_rdf* rdf; uint16_t dclass; + uint8_t* dname; + size_t dname_len; /* read the owner name */ char* next = strchr(line, ' '); if(!next) return NULL; next[0] = 0; - rdf = ldns_dname_new_frm_str(line); - if(!rdf) + dname = sldns_str2wire_dname(line, &dname_len); + if(!dname) return NULL; /* read the class */ dclass = parse_int(next+1, &r); if(r == -1) { - ldns_rdf_deep_free(rdf); + free(dname); return NULL; } /* find the trust point */ - tp = autr_tp_create(anchors, rdf, dclass); - ldns_rdf_deep_free(rdf); + tp = autr_tp_create(anchors, dname, dname_len, dclass); + free(dname); return tp; } @@ -677,12 +886,12 @@ parse_var_line(char* line, struct val_anchors* anchors, } else if(strncmp(line, ";;query_interval: ", 18) == 0) { if(!tp) return -1; lock_basic_lock(&tp->lock); - tp->autr->query_interval = (uint32_t)parse_int(line+18, &r); + tp->autr->query_interval = (time_t)parse_int(line+18, &r); lock_basic_unlock(&tp->lock); } else if(strncmp(line, ";;retry_time: ", 14) == 0) { if(!tp) return -1; lock_basic_lock(&tp->lock); - tp->autr->retry_time = (uint32_t)parse_int(line+14, &r); + tp->autr->retry_time = (time_t)parse_int(line+14, &r); lock_basic_unlock(&tp->lock); } return r; @@ -690,17 +899,19 @@ parse_var_line(char* line, struct val_anchors* anchors, /** handle origin lines */ static int -handle_origin(char* line, ldns_rdf** origin) +handle_origin(char* line, uint8_t** origin, size_t* origin_len) { + size_t len = 0; while(isspace((int)*line)) line++; if(strncmp(line, "$ORIGIN", 7) != 0) return 0; - ldns_rdf_deep_free(*origin); + free(*origin); line += 7; while(isspace((int)*line)) line++; - *origin = ldns_dname_new_frm_str(line); + *origin = sldns_str2wire_dname(line, &len); + *origin_len = len; if(!*origin) log_warn("malloc failure or parse error in $ORIGIN"); return 1; @@ -781,7 +992,8 @@ int autr_read_file(struct val_anchors* anchors, const char* nm) struct trust_anchor *tp = NULL, *tp2; int r; /* for $ORIGIN parsing */ - ldns_rdf *origin=NULL, *prev=NULL; + uint8_t *origin=NULL, *prev=NULL; + size_t origin_len=0, prev_len=0; if (!(fd = fopen(nm, "r"))) { log_err("unable to open %s for reading: %s", @@ -794,25 +1006,25 @@ int autr_read_file(struct val_anchors* anchors, const char* nm) log_err("could not parse auto-trust-anchor-file " "%s line %d", nm, line_nr); fclose(fd); - ldns_rdf_deep_free(origin); - ldns_rdf_deep_free(prev); + free(origin); + free(prev); return 0; } else if(r == 1) { continue; } else if(r == 2) { log_warn("trust anchor %s has been revoked", nm); fclose(fd); - ldns_rdf_deep_free(origin); - ldns_rdf_deep_free(prev); + free(origin); + free(prev); return 1; } if (!str_contains_data(line, ';')) continue; /* empty lines allowed */ - if(handle_origin(line, &origin)) + if(handle_origin(line, &origin, &origin_len)) continue; r = 0; - if(!(tp2=load_trustanchor(anchors, line, nm, origin, &prev, - &r))) { + if(!(tp2=load_trustanchor(anchors, line, nm, origin, + origin_len, &prev, &prev_len, &r))) { if(!r) log_err("failed to load trust anchor from %s " "at line %i, skipping", nm, line_nr); /* try to do the rest */ @@ -823,15 +1035,15 @@ int autr_read_file(struct val_anchors* anchors, const char* nm) "the file may only contain keys for one name, " "remove keys for other domain names", nm); fclose(fd); - ldns_rdf_deep_free(origin); - ldns_rdf_deep_free(prev); + free(origin); + free(prev); return 0; } tp = tp2; } fclose(fd); - ldns_rdf_deep_free(origin); - ldns_rdf_deep_free(prev); + free(origin); + free(prev); if(!tp) { log_err("failed to read %s", nm); return 0; @@ -865,39 +1077,24 @@ trustanchor_state2str(autr_state_t s) /** print ID to file */ static int -print_id(FILE* out, char* fname, struct module_env* env, - uint8_t* nm, size_t nmlen, uint16_t dclass) +print_id(FILE* out, char* fname, uint8_t* nm, size_t nmlen, uint16_t dclass) { - ldns_rdf rdf; -#ifdef UNBOUND_DEBUG - ldns_status s; -#endif - - memset(&rdf, 0, sizeof(rdf)); - ldns_rdf_set_data(&rdf, nm); - ldns_rdf_set_size(&rdf, nmlen); - ldns_rdf_set_type(&rdf, LDNS_RDF_TYPE_DNAME); - - ldns_buffer_clear(env->scratch_buffer); -#ifdef UNBOUND_DEBUG - s = -#endif - ldns_rdf2buffer_str_dname(env->scratch_buffer, &rdf); - log_assert(s == LDNS_STATUS_OK); - ldns_buffer_write_u8(env->scratch_buffer, 0); - ldns_buffer_flip(env->scratch_buffer); - if(fprintf(out, ";;id: %s %d\n", - (char*)ldns_buffer_begin(env->scratch_buffer), - (int)dclass) < 0) { - log_err("could not write to %s: %s", fname, strerror(errno)); + char* s = sldns_wire2str_dname(nm, nmlen); + if(!s) { + log_err("malloc failure in write to %s", fname); return 0; } + if(fprintf(out, ";;id: %s %d\n", s, (int)dclass) < 0) { + log_err("could not write to %s: %s", fname, strerror(errno)); + free(s); + return 0; + } + free(s); return 1; } static int -autr_write_contents(FILE* out, char* fn, struct module_env* env, - struct trust_anchor* tp) +autr_write_contents(FILE* out, char* fn, struct trust_anchor* tp) { char tmi[32]; struct autr_ta* ta; @@ -919,7 +1116,7 @@ autr_write_contents(FILE* out, char* fn, struct module_env* env, return 0; } } - if(!print_id(out, fn, env, tp->name, tp->namelen, tp->dclass)) { + if(!print_id(out, fn, tp->name, tp->namelen, tp->dclass)) { return 0; } if(fprintf(out, ";;last_queried: %u ;;%s", @@ -947,9 +1144,10 @@ autr_write_contents(FILE* out, char* fn, struct module_env* env, if(ta->s == AUTR_STATE_REMOVED) continue; /* only store keys */ - if(ldns_rr_get_type(ta->rr) != LDNS_RR_TYPE_DNSKEY) + if(sldns_wirerr_get_type(ta->rr, ta->rr_len, ta->dname_len) + != LDNS_RR_TYPE_DNSKEY) continue; - str = ldns_rr2str(ta->rr); + str = sldns_wire2str_rr(ta->rr, ta->rr_len); if(!str || !str[0]) { free(str); log_err("malloc failure writing %s", fn); @@ -976,9 +1174,13 @@ void autr_write_file(struct module_env* env, struct trust_anchor* tp) char* fname = tp->autr->file; char tempf[2048]; log_assert(tp->autr); + if(!env) { + log_err("autr_write_file: Module environment is NULL."); + return; + } /* unique name with pid number and thread number */ snprintf(tempf, sizeof(tempf), "%s.%d-%d", fname, (int)getpid(), - env&&env->worker?*(int*)env->worker:0); + env->worker?*(int*)env->worker:0); verbose(VERB_ALGO, "autotrust: write to disk: %s", tempf); out = fopen(tempf, "w"); if(!out) { @@ -986,15 +1188,20 @@ void autr_write_file(struct module_env* env, struct trust_anchor* tp) tempf, strerror(errno)); return; } - if(!autr_write_contents(out, tempf, env, tp)) { + if(!autr_write_contents(out, tempf, tp)) { /* failed to write contents (completely) */ fclose(out); unlink(tempf); log_err("could not completely write: %s", fname); return; } + if(fclose(out) != 0) { + log_err("could not complete write: %s: %s", + fname, strerror(errno)); + unlink(tempf); + return; + } /* success; overwrite actual file */ - fclose(out); verbose(VERB_ALGO, "autotrust: replaced %s", fname); #ifdef UB_ON_WINDOWS (void)unlink(fname); /* windows does not replace file with rename() */ @@ -1030,24 +1237,30 @@ verify_dnskey(struct module_env* env, struct val_env* ve, return sec == sec_status_secure; } +static int32_t +rrsig_get_expiry(uint8_t* d, size_t len) +{ + /* rrsig: 2(rdlen), 2(type) 1(alg) 1(v) 4(origttl), then 4(expi), (4)incep) */ + if(len < 2+8+4) + return 0; + return sldns_read_uint32(d+2+8); +} + /** Find minimum expiration interval from signatures */ -static uint32_t -min_expiry(struct module_env* env, ldns_rr_list* rrset) +static time_t +min_expiry(struct module_env* env, struct packed_rrset_data* dd) { size_t i; - uint32_t t, r = 15 * 24 * 3600; /* 15 days max */ - for(i=0; inow > 0) { - t -= *env->now; + int32_t t, r = 15 * 24 * 3600; /* 15 days max */ + for(i=dd->count; icount+dd->rrsig_count; i++) { + t = rrsig_get_expiry(dd->rr_data[i], dd->rr_len[i]); + if((int32_t)t - (int32_t)*env->now > 0) { + t -= (int32_t)*env->now; if(t < r) r = t; } } - return r; + return (time_t)r; } /** Is rr self-signed revoked key */ @@ -1086,131 +1299,92 @@ seen_revoked_trustanchor(struct autr_ta* ta, uint8_t revoked) static void revoke_dnskey(struct autr_ta* ta, int off) { - ldns_rdf* rdf; - uint16_t flags; - log_assert(ta && ta->rr); - if(ldns_rr_get_type(ta->rr) != LDNS_RR_TYPE_DNSKEY) + uint16_t flags; + uint8_t* data; + if(sldns_wirerr_get_type(ta->rr, ta->rr_len, ta->dname_len) != + LDNS_RR_TYPE_DNSKEY) return; - rdf = ldns_rr_dnskey_flags(ta->rr); - flags = ldns_read_uint16(ldns_rdf_data(rdf)); - + if(sldns_wirerr_get_rdatalen(ta->rr, ta->rr_len, ta->dname_len) < 2) + return; + data = sldns_wirerr_get_rdata(ta->rr, ta->rr_len, ta->dname_len); + flags = sldns_read_uint16(data); if (off && (flags&LDNS_KEY_REVOKE_KEY)) flags ^= LDNS_KEY_REVOKE_KEY; /* flip */ else flags |= LDNS_KEY_REVOKE_KEY; - ldns_write_uint16(ldns_rdf_data(rdf), flags); + sldns_write_uint16(data, flags); } -/** Compare two RR buffers skipping the REVOKED bit */ +/** Compare two RRs skipping the REVOKED bit. Pass rdata(no len) */ static int -ldns_rr_compare_wire_skip_revbit(ldns_buffer* rr1_buf, ldns_buffer* rr2_buf) +dnskey_compare_skip_revbit(uint8_t* a, size_t a_len, uint8_t* b, size_t b_len) { - size_t rr1_len, rr2_len, min_len, i, offset; - rr1_len = ldns_buffer_capacity(rr1_buf); - rr2_len = ldns_buffer_capacity(rr2_buf); - /* jump past dname (checked in earlier part) and especially past TTL */ - offset = 0; - while (offset < rr1_len && *ldns_buffer_at(rr1_buf, offset) != 0) - offset += *ldns_buffer_at(rr1_buf, offset) + 1; - /* jump to rdata section (PAST the rdata length field) */ - offset += 11; /* 0-dname-end + type + class + ttl + rdatalen */ - min_len = (rr1_len < rr2_len) ? rr1_len : rr2_len; + size_t i; + if(a_len != b_len) + return -1; /* compare RRs RDATA byte for byte. */ - for(i = offset; i < min_len; i++) + for(i = 0; i < a_len; i++) { - uint8_t *rdf1, *rdf2; - rdf1 = ldns_buffer_at(rr1_buf, i); - rdf2 = ldns_buffer_at(rr2_buf, i); - if (i==(offset+1)) - { + uint8_t rdf1, rdf2; + rdf1 = a[i]; + rdf2 = b[i]; + if(i==1) { /* this is the second part of the flags field */ - *rdf1 = *rdf1 | LDNS_KEY_REVOKE_KEY; - *rdf2 = *rdf2 | LDNS_KEY_REVOKE_KEY; + rdf1 |= LDNS_KEY_REVOKE_KEY; + rdf2 |= LDNS_KEY_REVOKE_KEY; } - if (*rdf1 < *rdf2) return -1; - else if (*rdf1 > *rdf2) return 1; + if (rdf1 < rdf2) return -1; + else if (rdf1 > rdf2) return 1; } return 0; } -/** Compare two RRs skipping the REVOKED bit */ + +/** compare trust anchor with rdata, 0 if equal. Pass rdata(no len) */ static int -ldns_rr_compare_skip_revbit(const ldns_rr* rr1, const ldns_rr* rr2, int* result) +ta_compare(struct autr_ta* a, uint16_t t, uint8_t* b, size_t b_len) { - size_t rr1_len, rr2_len; - ldns_buffer* rr1_buf; - ldns_buffer* rr2_buf; - - *result = ldns_rr_compare_no_rdata(rr1, rr2); - if (*result == 0) - { - rr1_len = ldns_rr_uncompressed_size(rr1); - rr2_len = ldns_rr_uncompressed_size(rr2); - rr1_buf = ldns_buffer_new(rr1_len); - rr2_buf = ldns_buffer_new(rr2_len); - if(!rr1_buf || !rr2_buf) { - ldns_buffer_free(rr1_buf); - ldns_buffer_free(rr2_buf); - return 0; - } - if (ldns_rr2buffer_wire_canonical(rr1_buf, rr1, - LDNS_SECTION_ANY) != LDNS_STATUS_OK) - { - ldns_buffer_free(rr1_buf); - ldns_buffer_free(rr2_buf); - return 0; - } - if (ldns_rr2buffer_wire_canonical(rr2_buf, rr2, - LDNS_SECTION_ANY) != LDNS_STATUS_OK) { - ldns_buffer_free(rr1_buf); - ldns_buffer_free(rr2_buf); - return 0; - } - *result = ldns_rr_compare_wire_skip_revbit(rr1_buf, rr2_buf); - ldns_buffer_free(rr1_buf); - ldns_buffer_free(rr2_buf); + if(!a) return -1; + else if(!b) return -1; + else if(sldns_wirerr_get_type(a->rr, a->rr_len, a->dname_len) != t) + return (int)sldns_wirerr_get_type(a->rr, a->rr_len, + a->dname_len) - (int)t; + else if(t == LDNS_RR_TYPE_DNSKEY) { + return dnskey_compare_skip_revbit( + sldns_wirerr_get_rdata(a->rr, a->rr_len, a->dname_len), + sldns_wirerr_get_rdatalen(a->rr, a->rr_len, + a->dname_len), b, b_len); } - return 1; -} - - -/** compare two trust anchors */ -static int -ta_compare(ldns_rr* a, ldns_rr* b, int* result) -{ - if (!a && !b) *result = 0; - else if (!a) *result = -1; - else if (!b) *result = 1; - else if (ldns_rr_get_type(a) != ldns_rr_get_type(b)) - *result = (int)ldns_rr_get_type(a) - (int)ldns_rr_get_type(b); - else if (ldns_rr_get_type(a) == LDNS_RR_TYPE_DNSKEY) { - if(!ldns_rr_compare_skip_revbit(a, b, result)) - return 0; + else if(t == LDNS_RR_TYPE_DS) { + if(sldns_wirerr_get_rdatalen(a->rr, a->rr_len, a->dname_len) != + b_len) + return -1; + return memcmp(sldns_wirerr_get_rdata(a->rr, + a->rr_len, a->dname_len), b, b_len); } - else if (ldns_rr_get_type(a) == LDNS_RR_TYPE_DS) - *result = ldns_rr_compare(a, b); - else *result = -1; - return 1; + return -1; } /** * Find key * @param tp: to search in - * @param rr: to look for + * @param t: rr type of the rdata. + * @param rdata: to look for (no rdatalen in it) + * @param rdata_len: length of rdata * @param result: returns NULL or the ta key looked for. * @return false on malloc failure during search. if true examine result. */ static int -find_key(struct trust_anchor* tp, ldns_rr* rr, struct autr_ta** result) +find_key(struct trust_anchor* tp, uint16_t t, uint8_t* rdata, size_t rdata_len, + struct autr_ta** result) { struct autr_ta* ta; - int ret; - if(!tp || !rr) + if(!tp || !rdata) { + *result = NULL; return 0; + } for(ta=tp->autr->keys; ta; ta=ta->next) { - if(!ta_compare(ta->rr, rr, &ret)) - return 0; - if(ret == 0) { + if(ta_compare(ta, t, rdata, rdata_len) == 0) { *result = ta; return 1; } @@ -1219,17 +1393,30 @@ find_key(struct trust_anchor* tp, ldns_rr* rr, struct autr_ta** result) return 1; } -/** add key and clone RR and tp already locked */ +/** add key and clone RR and tp already locked. rdata without rdlen. */ static struct autr_ta* -add_key(struct trust_anchor* tp, ldns_rr* rr) +add_key(struct trust_anchor* tp, uint32_t ttl, uint8_t* rdata, size_t rdata_len) { - ldns_rr* c; struct autr_ta* ta; - c = ldns_rr_clone(rr); - if(!c) return NULL; - ta = autr_ta_create(c); + uint8_t* rr; + size_t rr_len, dname_len; + uint16_t rrtype = htons(LDNS_RR_TYPE_DNSKEY); + uint16_t rrclass = htons(LDNS_RR_CLASS_IN); + uint16_t rdlen = htons(rdata_len); + dname_len = tp->namelen; + ttl = htonl(ttl); + rr_len = dname_len + 10 /* type,class,ttl,rdatalen */ + rdata_len; + rr = (uint8_t*)malloc(rr_len); + if(!rr) return NULL; + memmove(rr, tp->name, tp->namelen); + memmove(rr+dname_len, &rrtype, 2); + memmove(rr+dname_len+2, &rrclass, 2); + memmove(rr+dname_len+4, &ttl, 4); + memmove(rr+dname_len+8, &rdlen, 2); + memmove(rr+dname_len+10, rdata, rdata_len); + ta = autr_ta_create(rr, rr_len, dname_len); if(!ta) { - ldns_rr_free(c); + /* rr freed in autr_ta_create */ return NULL; } /* link in, tp already locked */ @@ -1239,7 +1426,7 @@ add_key(struct trust_anchor* tp, ldns_rr* rr) } /** get TTL from DNSKEY rrset */ -static uint32_t +static time_t key_ttl(struct ub_packed_rrset_key* k) { struct packed_rrset_data* d = (struct packed_rrset_data*)k->entry.data; @@ -1248,10 +1435,10 @@ key_ttl(struct ub_packed_rrset_key* k) /** update the time values for the trustpoint */ static void -set_tp_times(struct trust_anchor* tp, uint32_t rrsig_exp_interval, - uint32_t origttl, int* changed) +set_tp_times(struct trust_anchor* tp, time_t rrsig_exp_interval, + time_t origttl, int* changed) { - uint32_t x, qi = tp->autr->query_interval, rt = tp->autr->retry_time; + time_t x, qi = tp->autr->query_interval, rt = tp->autr->retry_time; /* x = MIN(15days, ttl/2, expire/2) */ x = 15 * 24 * 3600; @@ -1302,21 +1489,19 @@ check_contains_revoked(struct module_env* env, struct val_env* ve, struct trust_anchor* tp, struct ub_packed_rrset_key* dnskey_rrset, int* changed) { - ldns_rr_list* r = packed_rrset_to_rr_list(dnskey_rrset, - env->scratch_buffer); + struct packed_rrset_data* dd = (struct packed_rrset_data*) + dnskey_rrset->entry.data; size_t i; - if(!r) { - log_err("malloc failure"); - return; - } - for(i=0; irk.type) == LDNS_RR_TYPE_DNSKEY); + for(i=0; icount; i++) { struct autr_ta* ta = NULL; - if(ldns_rr_get_type(rr) != LDNS_RR_TYPE_DNSKEY) - continue; - if(!rr_is_dnskey_sep(rr) || !rr_is_dnskey_revoked(rr)) + if(!rr_is_dnskey_sep(ntohs(dnskey_rrset->rk.type), + dd->rr_data[i]+2, dd->rr_len[i]-2) || + !rr_is_dnskey_revoked(ntohs(dnskey_rrset->rk.type), + dd->rr_data[i]+2, dd->rr_len[i]-2)) continue; /* not a revoked KSK */ - if(!find_key(tp, rr, &ta)) { + if(!find_key(tp, ntohs(dnskey_rrset->rk.type), + dd->rr_data[i]+2, dd->rr_len[i]-2, &ta)) { log_err("malloc failure"); continue; /* malloc fail in compare*/ } @@ -1324,8 +1509,18 @@ check_contains_revoked(struct module_env* env, struct val_env* ve, continue; /* key not found */ if(rr_is_selfsigned_revoked(env, ve, dnskey_rrset, i)) { /* checked if there is an rrsig signed by this key. */ - log_assert(dnskey_calc_keytag(dnskey_rrset, i) == - ldns_calc_keytag(rr)); /* checks conversion*/ + /* same keytag, but stored can be revoked already, so + * compare keytags, with +0 or +128(REVOKE flag) */ + log_assert(dnskey_calc_keytag(dnskey_rrset, i)-128 == + sldns_calc_keytag_raw(sldns_wirerr_get_rdata( + ta->rr, ta->rr_len, ta->dname_len), + sldns_wirerr_get_rdatalen(ta->rr, ta->rr_len, + ta->dname_len)) || + dnskey_calc_keytag(dnskey_rrset, i) == + sldns_calc_keytag_raw(sldns_wirerr_get_rdata( + ta->rr, ta->rr_len, ta->dname_len), + sldns_wirerr_get_rdatalen(ta->rr, ta->rr_len, + ta->dname_len))); /* checks conversion*/ verbose_key(ta, VERB_ALGO, "is self-signed revoked"); if(!ta->revoked) *changed = 1; @@ -1333,7 +1528,6 @@ check_contains_revoked(struct module_env* env, struct val_env* ve, do_revoked(env, ta, changed); } } - ldns_rr_list_deep_free(r); } /** See if a DNSKEY is verified by one of the DSes */ @@ -1380,20 +1574,18 @@ update_events(struct module_env* env, struct val_env* ve, struct trust_anchor* tp, struct ub_packed_rrset_key* dnskey_rrset, int* changed) { - ldns_rr_list* r = packed_rrset_to_rr_list(dnskey_rrset, - env->scratch_buffer); + struct packed_rrset_data* dd = (struct packed_rrset_data*) + dnskey_rrset->entry.data; size_t i; - if(!r) - return 0; + log_assert(ntohs(dnskey_rrset->rk.type) == LDNS_RR_TYPE_DNSKEY); init_events(tp); - for(i=0; icount; i++) { struct autr_ta* ta = NULL; - if(ldns_rr_get_type(rr) != LDNS_RR_TYPE_DNSKEY) + if(!rr_is_dnskey_sep(ntohs(dnskey_rrset->rk.type), + dd->rr_data[i]+2, dd->rr_len[i]-2)) continue; - if(!rr_is_dnskey_sep(rr)) - continue; - if(rr_is_dnskey_revoked(rr)) { + if(rr_is_dnskey_revoked(ntohs(dnskey_rrset->rk.type), + dd->rr_data[i]+2, dd->rr_len[i]-2)) { /* self-signed revoked keys already detected before, * other revoked keys are not 'added' again */ continue; @@ -1409,12 +1601,13 @@ update_events(struct module_env* env, struct val_env* ve, } /* is it new? if revocation bit set, find the unrevoked key */ - if(!find_key(tp, rr, &ta)) { - ldns_rr_list_deep_free(r); /* malloc fail in compare*/ + if(!find_key(tp, ntohs(dnskey_rrset->rk.type), + dd->rr_data[i]+2, dd->rr_len[i]-2, &ta)) { return 0; } if(!ta) { - ta = add_key(tp, rr); + ta = add_key(tp, (uint32_t)dd->rr_ttl[i], + dd->rr_data[i]+2, dd->rr_len[i]-2); *changed = 1; /* first time seen, do we have DSes? if match: VALID */ if(ta && tp->ds_rrset && key_matches_a_ds(env, ve, @@ -1424,14 +1617,12 @@ update_events(struct module_env* env, struct val_env* ve, } } if(!ta) { - ldns_rr_list_deep_free(r); return 0; } seen_trustanchor(ta, 1); verbose_key(ta, VERB_ALGO, "in DNS response"); } - set_tp_times(tp, min_expiry(env, r), key_ttl(dnskey_rrset), changed); - ldns_rr_list_deep_free(r); + set_tp_times(tp, min_expiry(env, dd), key_ttl(dnskey_rrset), changed); return 1; } @@ -1444,21 +1635,21 @@ update_events(struct module_env* env, struct val_env* ve, * @param holddown: the timer value * @return number of seconds the holddown has passed. */ -static int -check_holddown(struct module_env* env, struct autr_ta* ta, +static time_t +check_holddown(struct module_env* env, struct autr_ta* ta, unsigned int holddown) { - unsigned int elapsed; - if((unsigned)*env->now < (unsigned)ta->last_change) { + time_t elapsed; + if(*env->now < ta->last_change) { log_warn("time goes backwards. delaying key holddown"); return 0; } - elapsed = (unsigned)*env->now - (unsigned)ta->last_change; - if (elapsed > holddown) { - return (int) (elapsed-holddown); + elapsed = *env->now - ta->last_change; + if (elapsed > (time_t)holddown) { + return elapsed-(time_t)holddown; } - verbose_key(ta, VERB_ALGO, "holddown time %d seconds to go", - (int) (holddown-elapsed)); + verbose_key(ta, VERB_ALGO, "holddown time " ARG_LL "d seconds to go", + (long long) ((time_t)holddown-elapsed)); return 0; } @@ -1498,11 +1689,11 @@ do_addtime(struct module_env* env, struct autr_ta* anchor, int* c) /* This not according to RFC, this is 30 days, but the RFC demands * MAX(30days, TTL expire time of first DNSKEY set with this key), * The value may be too small if a very large TTL was used. */ - int exceeded = check_holddown(env, anchor, env->cfg->add_holddown); + time_t exceeded = check_holddown(env, anchor, env->cfg->add_holddown); if (exceeded && anchor->s == AUTR_STATE_ADDPEND) { verbose_key(anchor, VERB_ALGO, "add-holddown time exceeded " - "%d seconds ago, and pending-count %d", exceeded, - anchor->pending_count); + ARG_LL "d seconds ago, and pending-count %d", + (long long)exceeded, anchor->pending_count); if(anchor->pending_count >= MIN_PENDINGCOUNT) { set_trustanchor_state(env, anchor, c, AUTR_STATE_VALID); anchor->pending_count = 0; @@ -1517,10 +1708,10 @@ do_addtime(struct module_env* env, struct autr_ta* anchor, int* c) static void do_remtime(struct module_env* env, struct autr_ta* anchor, int* c) { - int exceeded = check_holddown(env, anchor, env->cfg->del_holddown); + time_t exceeded = check_holddown(env, anchor, env->cfg->del_holddown); if(exceeded && anchor->s == AUTR_STATE_REVOKED) { verbose_key(anchor, VERB_ALGO, "del-holddown time exceeded " - "%d seconds ago", exceeded); + ARG_LL "d seconds ago", (long long)exceeded); set_trustanchor_state(env, anchor, c, AUTR_STATE_REMOVED); } } @@ -1622,16 +1813,17 @@ init_zsk_to_ksk(struct module_env* env, struct trust_anchor* tp, int* changed) int validksk = 0; for(anchor = tp->autr->keys; anchor; anchor = anchor->next) { /* last_change test makes sure it was manually configured */ - if (ldns_rr_get_type(anchor->rr) == LDNS_RR_TYPE_DNSKEY && + if(sldns_wirerr_get_type(anchor->rr, anchor->rr_len, + anchor->dname_len) == LDNS_RR_TYPE_DNSKEY && anchor->last_change == 0 && - !rr_is_dnskey_sep(anchor->rr) && + !ta_is_dnskey_sep(anchor) && anchor->s == AUTR_STATE_VALID) validzsk++; } if(validzsk == 0) return 0; for(anchor = tp->autr->keys; anchor; anchor = anchor->next) { - if (rr_is_dnskey_sep(anchor->rr) && + if (ta_is_dnskey_sep(anchor) && anchor->s == AUTR_STATE_ADDPEND) { verbose_key(anchor, VERB_ALGO, "trust KSK from " "ZSK(config)"); @@ -1649,12 +1841,12 @@ remove_missing_trustanchors(struct module_env* env, struct trust_anchor* tp, int* changed) { struct autr_ta* anchor; - int exceeded; + time_t exceeded; int valid = 0; /* see if we have anchors that are valid */ for(anchor = tp->autr->keys; anchor; anchor = anchor->next) { /* Only do KSKs */ - if (!rr_is_dnskey_sep(anchor->rr)) + if (!ta_is_dnskey_sep(anchor)) continue; if (anchor->s == AUTR_STATE_VALID) valid++; @@ -1677,7 +1869,7 @@ remove_missing_trustanchors(struct module_env* env, struct trust_anchor* tp, if(anchor->s == AUTR_STATE_START) continue; /* remove ZSKs if a KSK is present */ - if (!rr_is_dnskey_sep(anchor->rr)) { + if (!ta_is_dnskey_sep(anchor)) { if(valid > 0) { verbose_key(anchor, VERB_ALGO, "remove ZSK " "[%d key(s) VALID]", valid); @@ -1697,8 +1889,8 @@ remove_missing_trustanchors(struct module_env* env, struct trust_anchor* tp, * one valid KSK: remove missing trust anchor */ if (exceeded && valid > 0) { verbose_key(anchor, VERB_ALGO, "keep-missing time " - "exceeded %d seconds ago, [%d key(s) VALID]", - exceeded, valid); + "exceeded " ARG_LL "d seconds ago, [%d key(s) VALID]", + (long long)exceeded, valid); set_trustanchor_state(env, anchor, changed, AUTR_STATE_REMOVED); } @@ -1712,7 +1904,7 @@ do_statetable(struct module_env* env, struct trust_anchor* tp, int* changed) struct autr_ta* anchor; for(anchor = tp->autr->keys; anchor; anchor = anchor->next) { /* Only do KSKs */ - if(!rr_is_dnskey_sep(anchor->rr)) + if(!ta_is_dnskey_sep(anchor)) continue; anchor_state_update(env, anchor, changed); } @@ -1726,7 +1918,7 @@ autr_holddown_exceed(struct module_env* env, struct trust_anchor* tp, int* c) { struct autr_ta* anchor; for(anchor = tp->autr->keys; anchor; anchor = anchor->next) { - if(rr_is_dnskey_sep(anchor->rr) && + if(ta_is_dnskey_sep(anchor) && anchor->s == AUTR_STATE_ADDPEND) do_addtime(env, anchor, c); } @@ -1742,10 +1934,11 @@ autr_cleanup_keys(struct trust_anchor* tp) while(p) { /* do we want to remove this key? */ if(p->s == AUTR_STATE_START || p->s == AUTR_STATE_REMOVED || - ldns_rr_get_type(p->rr) != LDNS_RR_TYPE_DNSKEY) { + sldns_wirerr_get_type(p->rr, p->rr_len, p->dname_len) + != LDNS_RR_TYPE_DNSKEY) { struct autr_ta* np = p->next; /* remove */ - ldns_rr_free(p->rr); + free(p->rr); free(p); /* snip and go to next item */ *prevp = np; @@ -1762,15 +1955,15 @@ autr_cleanup_keys(struct trust_anchor* tp) /** calculate next probe time */ static time_t -calc_next_probe(struct module_env* env, uint32_t wait) +calc_next_probe(struct module_env* env, time_t wait) { /* make it random, 90-100% */ - uint32_t rnd, rest; + time_t rnd, rest; if(wait < 3600) wait = 3600; rnd = wait/10; rest = wait-rnd; - rnd = (uint32_t)ub_random_max(env->rnd, (long int)rnd); + rnd = (time_t)ub_random_max(env->rnd, (long int)rnd); return (time_t)(*env->now + rest + rnd); } @@ -1790,7 +1983,7 @@ reset_worker_timer(struct module_env* env) { struct timeval tv; #ifndef S_SPLINT_S - uint32_t next = (uint32_t)wait_probe_time(env->anchors); + time_t next = (time_t)wait_probe_time(env->anchors); /* in case this is libunbound, no timer */ if(!env->probe_timer) return; @@ -1800,7 +1993,7 @@ reset_worker_timer(struct module_env* env) #endif tv.tv_usec = 0; comm_timer_set(env->probe_timer, &tv); - verbose(VERB_ALGO, "scheduled next probe in %d sec", (int)tv.tv_sec); + verbose(VERB_ALGO, "scheduled next probe in " ARG_LL "d sec", (long long)tv.tv_sec); } /** set next probe for trust anchor */ @@ -2017,7 +2210,7 @@ static void autr_debug_print_ta(struct autr_ta* ta) { char buf[32]; - char* str = ldns_rr2str(ta->rr); + char* str = sldns_wire2str_rr(ta->rr, ta->rr_len); if(!str) { log_info("out of memory in debug_print_ta"); return; @@ -2043,20 +2236,11 @@ autr_debug_print_tp(struct trust_anchor* tp) log_info("trust point %s : %d", buf, (int)tp->dclass); log_info("assembled %d DS and %d DNSKEYs", (int)tp->numDS, (int)tp->numDNSKEY); - if(0) { /* turned off because it prints to stderr */ - ldns_buffer* bf = ldns_buffer_new(70000); - ldns_rr_list* list; - if(tp->ds_rrset) { - list = packed_rrset_to_rr_list(tp->ds_rrset, bf); - ldns_rr_list_print(stderr, list); - ldns_rr_list_deep_free(list); - } - if(tp->dnskey_rrset) { - list = packed_rrset_to_rr_list(tp->dnskey_rrset, bf); - ldns_rr_list_print(stderr, list); - ldns_rr_list_deep_free(list); - } - ldns_buffer_free(bf); + if(tp->ds_rrset) { + log_packed_rrset(0, "DS:", tp->ds_rrset); + } + if(tp->dnskey_rrset) { + log_packed_rrset(0, "DNSKEY:", tp->dnskey_rrset); } log_info("file %s", tp->autr->file); ctime_r(&tp->autr->last_queried, buf); @@ -2092,7 +2276,7 @@ autr_debug_print(struct val_anchors* anchors) } void probe_answer_cb(void* arg, int ATTR_UNUSED(rcode), - ldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(sec), + sldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(sec), char* ATTR_UNUSED(why_bogus)) { /* retry was set before the query was done, @@ -2117,7 +2301,7 @@ probe_anchor(struct module_env* env, struct trust_anchor* tp) struct query_info qinfo; uint16_t qflags = BIT_RD; struct edns_data edns; - ldns_buffer* buf = env->scratch_buffer; + sldns_buffer* buf = env->scratch_buffer; qinfo.qname = regional_alloc_init(env->scratch, tp->name, tp->namelen); if(!qinfo.qname) { log_err("out of memory making 5011 probe"); @@ -2133,8 +2317,8 @@ probe_anchor(struct module_env* env, struct trust_anchor* tp) edns.ext_rcode = 0; edns.edns_version = 0; edns.bits = EDNS_DO; - if(ldns_buffer_capacity(buf) < 65535) - edns.udp_size = (uint16_t)ldns_buffer_capacity(buf); + if(sldns_buffer_capacity(buf) < 65535) + edns.udp_size = (uint16_t)sldns_buffer_capacity(buf); else edns.udp_size = 65535; /* can't hold the lock while mesh_run is processing */ @@ -2156,7 +2340,7 @@ probe_anchor(struct module_env* env, struct trust_anchor* tp) /** fetch first to-probe trust-anchor and lock it and set retrytime */ static struct trust_anchor* -todo_probe(struct module_env* env, uint32_t* next) +todo_probe(struct module_env* env, time_t* next) { struct trust_anchor* tp; rbnode_t* el; @@ -2171,9 +2355,9 @@ todo_probe(struct module_env* env, uint32_t* next) lock_basic_lock(&tp->lock); /* is it eligible? */ - if((uint32_t)tp->autr->next_probe_time > *env->now) { + if((time_t)tp->autr->next_probe_time > *env->now) { /* no more to probe */ - *next = (uint32_t)tp->autr->next_probe_time - *env->now; + *next = (time_t)tp->autr->next_probe_time - *env->now; lock_basic_unlock(&tp->lock); lock_basic_unlock(&env->anchors->lock); return NULL; @@ -2188,11 +2372,11 @@ todo_probe(struct module_env* env, uint32_t* next) return tp; } -uint32_t +time_t autr_probe_timer(struct module_env* env) { struct trust_anchor* tp; - uint32_t next_probe = 3600; + time_t next_probe = 3600; int num = 0; verbose(VERB_ALGO, "autotrust probe timer callback"); /* while there are still anchors to probe */ diff --git a/contrib/unbound/validator/autotrust.h b/contrib/unbound/validator/autotrust.h index 4e88ed32042..ae61f8a872b 100644 --- a/contrib/unbound/validator/autotrust.h +++ b/contrib/unbound/validator/autotrust.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -48,6 +48,7 @@ struct trust_anchor; struct ub_packed_rrset_key; struct module_env; struct val_env; +struct sldns_buffer; /** Autotrust anchor states */ typedef enum { @@ -66,7 +67,9 @@ struct autr_ta { /** next key */ struct autr_ta* next; /** the RR */ - ldns_rr* rr; + uint8_t* rr; + /** length of rr */ + size_t rr_len, dname_len; /** last update of key state (new pending count keeps date the same) */ time_t last_change; /** 5011 state */ @@ -104,9 +107,9 @@ struct autr_point_data { time_t next_probe_time; /** when to query if !failed */ - uint32_t query_interval; + time_t query_interval; /** when to retry if failed */ - uint32_t retry_time; + time_t retry_time; /** * How many times did it fail. diagnostic only (has no effect). @@ -151,7 +154,7 @@ size_t autr_get_num_anchors(struct val_anchors* anchors); * @return time of next probe (in seconds from now). * If 0, then there is no next probe anymore (trust points deleted). */ -uint32_t autr_probe_timer(struct module_env* env); +time_t autr_probe_timer(struct module_env* env); /** probe tree compare function */ int probetree_cmp(const void* x, const void* y); @@ -199,7 +202,7 @@ int autr_process_prime(struct module_env* env, struct val_env* ve, void autr_debug_print(struct val_anchors* anchors); /** callback for query answer to 5011 probe */ -void probe_answer_cb(void* arg, int rcode, ldns_buffer* buf, +void probe_answer_cb(void* arg, int rcode, struct sldns_buffer* buf, enum sec_status sec, char* errinf); #endif /* VALIDATOR_AUTOTRUST_H */ diff --git a/contrib/unbound/validator/val_anchor.c b/contrib/unbound/validator/val_anchor.c index cc551f83320..a4adfe2d9dd 100644 --- a/contrib/unbound/validator/val_anchor.c +++ b/contrib/unbound/validator/val_anchor.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -40,8 +40,6 @@ */ #include "config.h" #include -#include -#include #include "validator/val_anchor.h" #include "validator/val_sigcrypt.h" #include "validator/autotrust.h" @@ -50,6 +48,9 @@ #include "util/log.h" #include "util/net_help.h" #include "util/config_file.h" +#include "ldns/sbuffer.h" +#include "ldns/rrdef.h" +#include "ldns/str2wire.h" #ifdef HAVE_GLOB_H #include #endif @@ -242,6 +243,8 @@ anchor_new_ta(struct val_anchors* anchors, uint8_t* name, int namelabs, } #ifdef UNBOUND_DEBUG r = +#else + (void) #endif rbtree_insert(anchors->tree, &ta->node); if(lockit) { @@ -344,36 +347,26 @@ anchor_store_new_key(struct val_anchors* anchors, uint8_t* name, uint16_t type, /** * Add new RR. It converts ldns RR to wire format. * @param anchors: anchor storage. - * @param buffer: parsing buffer. - * @param rr: the rr (allocated by caller). + * @param rr: the wirerr. + * @param rl: length of rr. + * @param dl: length of dname. * @return NULL on error, else the trust anchor. */ static struct trust_anchor* -anchor_store_new_rr(struct val_anchors* anchors, ldns_buffer* buffer, - ldns_rr* rr) +anchor_store_new_rr(struct val_anchors* anchors, uint8_t* rr, size_t rl, + size_t dl) { struct trust_anchor* ta; - ldns_rdf* owner = ldns_rr_owner(rr); - ldns_status status; - ldns_buffer_clear(buffer); - ldns_buffer_skip(buffer, 2); /* skip rdatalen */ - status = ldns_rr_rdata2buffer_wire(buffer, rr); - if(status != LDNS_STATUS_OK) { - log_err("error converting trustanchor to wireformat: %s", - ldns_get_errorstr_by_id(status)); - return NULL; - } - ldns_buffer_flip(buffer); - ldns_buffer_write_u16_at(buffer, 0, ldns_buffer_limit(buffer) - 2); - - if(!(ta=anchor_store_new_key(anchors, ldns_rdf_data(owner), - ldns_rr_get_type(rr), ldns_rr_get_class(rr), - ldns_buffer_begin(buffer), ldns_buffer_limit(buffer)))) { + if(!(ta=anchor_store_new_key(anchors, rr, + sldns_wirerr_get_type(rr, rl, dl), + sldns_wirerr_get_class(rr, rl, dl), + sldns_wirerr_get_rdatawl(rr, rl, dl), + sldns_wirerr_get_rdatalen(rr, rl, dl)+2))) { return NULL; } log_nametypeclass(VERB_QUERY, "adding trusted key", - ldns_rdf_data(owner), - ldns_rr_get_type(rr), ldns_rr_get_class(rr)); + rr, sldns_wirerr_get_type(rr, rl, dl), + sldns_wirerr_get_class(rr, rl, dl)); return ta; } @@ -387,36 +380,37 @@ static struct trust_anchor* anchor_insert_insecure(struct val_anchors* anchors, const char* str) { struct trust_anchor* ta; - ldns_rdf* nm = ldns_dname_new_frm_str(str); + size_t dname_len = 0; + uint8_t* nm = sldns_str2wire_dname(str, &dname_len); if(!nm) { log_err("parse error in domain name '%s'", str); return NULL; } - ta = anchor_store_new_key(anchors, ldns_rdf_data(nm), LDNS_RR_TYPE_DS, + ta = anchor_store_new_key(anchors, nm, LDNS_RR_TYPE_DS, LDNS_RR_CLASS_IN, NULL, 0); - ldns_rdf_deep_free(nm); + free(nm); return ta; } struct trust_anchor* -anchor_store_str(struct val_anchors* anchors, ldns_buffer* buffer, +anchor_store_str(struct val_anchors* anchors, sldns_buffer* buffer, const char* str) { struct trust_anchor* ta; - ldns_rr* rr = NULL; - ldns_status status = ldns_rr_new_frm_str(&rr, str, 0, NULL, NULL); - if(status != LDNS_STATUS_OK) { - log_err("error parsing trust anchor: %s", - ldns_get_errorstr_by_id(status)); - ldns_rr_free(rr); + uint8_t* rr = sldns_buffer_begin(buffer); + size_t len = sldns_buffer_capacity(buffer), dname_len = 0; + int status = sldns_str2wire_rr_buf(str, rr, &len, &dname_len, + 0, NULL, 0, NULL, 0); + if(status != 0) { + log_err("error parsing trust anchor %s: at %d: %s", + str, LDNS_WIREPARSE_OFFSET(status), + sldns_get_errorstr_parse(status)); return NULL; } - if(!(ta=anchor_store_new_rr(anchors, buffer, rr))) { + if(!(ta=anchor_store_new_rr(anchors, rr, len, dname_len))) { log_err("out of memory"); - ldns_rr_free(rr); return NULL; } - ldns_rr_free(rr); return ta; } @@ -429,44 +423,43 @@ anchor_store_str(struct val_anchors* anchors, ldns_buffer* buffer, * @return NULL on error. Else last trust-anchor point. */ static struct trust_anchor* -anchor_read_file(struct val_anchors* anchors, ldns_buffer* buffer, +anchor_read_file(struct val_anchors* anchors, sldns_buffer* buffer, const char* fname, int onlyone) { struct trust_anchor* ta = NULL, *tanew; - uint32_t default_ttl = 3600; - ldns_rdf* origin = NULL, *prev = NULL; - int line_nr = 1; - ldns_status status; - ldns_rr* rr; + struct sldns_file_parse_state pst; + int status; + size_t len, dname_len; + uint8_t* rr = sldns_buffer_begin(buffer); int ok = 1; FILE* in = fopen(fname, "r"); if(!in) { log_err("error opening file %s: %s", fname, strerror(errno)); return 0; } + memset(&pst, 0, sizeof(pst)); + pst.default_ttl = 3600; + pst.lineno = 1; while(!feof(in)) { - rr = NULL; - status = ldns_rr_new_frm_fp_l(&rr, in, &default_ttl, &origin, - &prev, &line_nr); - if(status == LDNS_STATUS_SYNTAX_EMPTY /* empty line */ - || status == LDNS_STATUS_SYNTAX_TTL /* $TTL */ - || status == LDNS_STATUS_SYNTAX_ORIGIN /* $ORIGIN */) + len = sldns_buffer_capacity(buffer); + dname_len = 0; + status = sldns_fp2wire_rr_buf(in, rr, &len, &dname_len, &pst); + if(len == 0) /* empty, $TTL, $ORIGIN */ continue; - if(status != LDNS_STATUS_OK) { - log_err("parse error in %s:%d : %s", fname, line_nr, - ldns_get_errorstr_by_id(status)); - ldns_rr_free(rr); + if(status != 0) { + log_err("parse error in %s:%d:%d : %s", fname, + pst.lineno, LDNS_WIREPARSE_OFFSET(status), + sldns_get_errorstr_parse(status)); ok = 0; break; } - if(ldns_rr_get_type(rr) != LDNS_RR_TYPE_DS && - ldns_rr_get_type(rr) != LDNS_RR_TYPE_DNSKEY) { - ldns_rr_free(rr); + if(sldns_wirerr_get_type(rr, len, dname_len) != + LDNS_RR_TYPE_DS && sldns_wirerr_get_type(rr, len, + dname_len) != LDNS_RR_TYPE_DNSKEY) { continue; } - if(!(tanew=anchor_store_new_rr(anchors, buffer, rr))) { - log_err("error at %s line %d", fname, line_nr); - ldns_rr_free(rr); + if(!(tanew=anchor_store_new_rr(anchors, rr, len, dname_len))) { + log_err("mem error at %s line %d", fname, pst.lineno); ok = 0; break; } @@ -474,16 +467,12 @@ anchor_read_file(struct val_anchors* anchors, ldns_buffer* buffer, log_err("error at %s line %d: no multiple anchor " "domains allowed (you can have multiple " "keys, but they must have the same name).", - fname, line_nr); - ldns_rr_free(rr); + fname, pst.lineno); ok = 0; break; } ta = tanew; - ldns_rr_free(rr); } - ldns_rdf_deep_free(origin); - ldns_rdf_deep_free(prev); fclose(in); if(!ok) return NULL; /* empty file is OK when multiple anchors are allowed */ @@ -538,7 +527,7 @@ is_bind_special(int c) * 0 on end of file. */ static int -readkeyword_bindfile(FILE* in, ldns_buffer* buf, int* line, int comments) +readkeyword_bindfile(FILE* in, sldns_buffer* buf, int* line, int comments) { int c; int numdone = 0; @@ -548,17 +537,17 @@ readkeyword_bindfile(FILE* in, ldns_buffer* buf, int* line, int comments) (*line)++; continue; } else if(comments && c=='/' && numdone>0 && /* /_/ bla*/ - ldns_buffer_read_u8_at(buf, - ldns_buffer_position(buf)-1) == '/') { - ldns_buffer_skip(buf, -1); + sldns_buffer_read_u8_at(buf, + sldns_buffer_position(buf)-1) == '/') { + sldns_buffer_skip(buf, -1); numdone--; skip_to_eol(in); (*line)++; continue; } else if(comments && c=='*' && numdone>0 && /* /_* bla *_/ */ - ldns_buffer_read_u8_at(buf, - ldns_buffer_position(buf)-1) == '/') { - ldns_buffer_skip(buf, -1); + sldns_buffer_read_u8_at(buf, + sldns_buffer_position(buf)-1) == '/') { + sldns_buffer_skip(buf, -1); numdone--; /* skip to end of comment */ while(c != EOF && (c=getc(in)) != EOF ) { @@ -588,10 +577,10 @@ readkeyword_bindfile(FILE* in, ldns_buffer* buf, int* line, int comments) (*line)++; } /* space for 1 char + 0 string terminator */ - if(ldns_buffer_remaining(buf) < 2) { + if(sldns_buffer_remaining(buf) < 2) { fatal_exit("trusted-keys, %d, string too long", *line); } - ldns_buffer_write_u8(buf, (uint8_t)c); + sldns_buffer_write_u8(buf, (uint8_t)c); numdone++; if(isspace(c)) { /* collate whitespace into ' ' */ @@ -613,17 +602,17 @@ readkeyword_bindfile(FILE* in, ldns_buffer* buf, int* line, int comments) /** skip through file to { or ; */ static int -skip_to_special(FILE* in, ldns_buffer* buf, int* line, int spec) +skip_to_special(FILE* in, sldns_buffer* buf, int* line, int spec) { int rdlen; - ldns_buffer_clear(buf); + sldns_buffer_clear(buf); while((rdlen=readkeyword_bindfile(in, buf, line, 1))) { - if(rdlen == 1 && isspace((int)*ldns_buffer_begin(buf))) { - ldns_buffer_clear(buf); + if(rdlen == 1 && isspace((int)*sldns_buffer_begin(buf))) { + sldns_buffer_clear(buf); continue; } - if(rdlen != 1 || *ldns_buffer_begin(buf) != (uint8_t)spec) { - ldns_buffer_write_u8(buf, 0); + if(rdlen != 1 || *sldns_buffer_begin(buf) != (uint8_t)spec) { + sldns_buffer_write_u8(buf, 0); log_err("trusted-keys, line %d, expected %c", *line, spec); return 0; @@ -643,7 +632,7 @@ skip_to_special(FILE* in, ldns_buffer* buf, int* line, int spec) * @return 0 on error. */ static int -process_bind_contents(struct val_anchors* anchors, ldns_buffer* buf, +process_bind_contents(struct val_anchors* anchors, sldns_buffer* buf, int* line, FILE* in) { /* loop over contents, collate strings before ; */ @@ -656,41 +645,41 @@ process_bind_contents(struct val_anchors* anchors, ldns_buffer* buf, int comments = 1; int rdlen; char* str = 0; - ldns_buffer_clear(buf); + sldns_buffer_clear(buf); while((rdlen=readkeyword_bindfile(in, buf, line, comments))) { - if(rdlen == 1 && ldns_buffer_position(buf) == 1 - && isspace((int)*ldns_buffer_begin(buf))) { + if(rdlen == 1 && sldns_buffer_position(buf) == 1 + && isspace((int)*sldns_buffer_begin(buf))) { /* starting whitespace is removed */ - ldns_buffer_clear(buf); + sldns_buffer_clear(buf); continue; - } else if(rdlen == 1 && ldns_buffer_current(buf)[-1] == '"') { + } else if(rdlen == 1 && sldns_buffer_current(buf)[-1] == '"') { /* remove " from the string */ if(contnum == 0) { quoted = 1; comments = 0; } - ldns_buffer_skip(buf, -1); + sldns_buffer_skip(buf, -1); if(contnum > 0 && quoted) { - if(ldns_buffer_remaining(buf) < 8+1) { + if(sldns_buffer_remaining(buf) < 8+1) { log_err("line %d, too long", *line); return 0; } - ldns_buffer_write(buf, " DNSKEY ", 8); + sldns_buffer_write(buf, " DNSKEY ", 8); quoted = 0; comments = 1; } else if(contnum > 0) comments = !comments; continue; - } else if(rdlen == 1 && ldns_buffer_current(buf)[-1] == ';') { + } else if(rdlen == 1 && sldns_buffer_current(buf)[-1] == ';') { if(contnum < 5) { - ldns_buffer_write_u8(buf, 0); + sldns_buffer_write_u8(buf, 0); log_err("line %d, bad key", *line); return 0; } - ldns_buffer_skip(buf, -1); - ldns_buffer_write_u8(buf, 0); - str = strdup((char*)ldns_buffer_begin(buf)); + sldns_buffer_skip(buf, -1); + sldns_buffer_write_u8(buf, 0); + str = strdup((char*)sldns_buffer_begin(buf)); if(!str) { log_err("line %d, allocation failure", *line); return 0; @@ -701,30 +690,30 @@ process_bind_contents(struct val_anchors* anchors, ldns_buffer* buf, return 0; } free(str); - ldns_buffer_clear(buf); + sldns_buffer_clear(buf); contnum = 0; quoted = 0; comments = 1; continue; - } else if(rdlen == 1 && ldns_buffer_current(buf)[-1] == '}') { + } else if(rdlen == 1 && sldns_buffer_current(buf)[-1] == '}') { if(contnum > 0) { - ldns_buffer_write_u8(buf, 0); + sldns_buffer_write_u8(buf, 0); log_err("line %d, bad key before }", *line); return 0; } return 1; } else if(rdlen == 1 && - isspace((int)ldns_buffer_current(buf)[-1])) { + isspace((int)sldns_buffer_current(buf)[-1])) { /* leave whitespace here */ } else { /* not space or whatnot, so actual content */ contnum ++; if(contnum == 1 && !quoted) { - if(ldns_buffer_remaining(buf) < 8+1) { + if(sldns_buffer_remaining(buf) < 8+1) { log_err("line %d, too long", *line); return 0; } - ldns_buffer_write(buf, " DNSKEY ", 8); + sldns_buffer_write(buf, " DNSKEY ", 8); } } } @@ -741,7 +730,7 @@ process_bind_contents(struct val_anchors* anchors, ldns_buffer* buf, * @return false on error. */ static int -anchor_read_bind_file(struct val_anchors* anchors, ldns_buffer* buffer, +anchor_read_bind_file(struct val_anchors* anchors, sldns_buffer* buffer, const char* fname) { int line_nr = 1; @@ -753,11 +742,11 @@ anchor_read_bind_file(struct val_anchors* anchors, ldns_buffer* buffer, } verbose(VERB_QUERY, "reading in bind-compat-mode: '%s'", fname); /* scan for trusted-keys keyword, ignore everything else */ - ldns_buffer_clear(buffer); + sldns_buffer_clear(buffer); while((rdlen=readkeyword_bindfile(in, buffer, &line_nr, 1)) != 0) { - if(rdlen != 12 || strncmp((char*)ldns_buffer_begin(buffer), + if(rdlen != 12 || strncmp((char*)sldns_buffer_begin(buffer), "trusted-keys", 12) != 0) { - ldns_buffer_clear(buffer); + sldns_buffer_clear(buffer); /* ignore everything but trusted-keys */ continue; } @@ -777,7 +766,7 @@ anchor_read_bind_file(struct val_anchors* anchors, ldns_buffer* buffer, fclose(in); return 0; } - ldns_buffer_clear(buffer); + sldns_buffer_clear(buffer); } fclose(in); return 1; @@ -792,7 +781,7 @@ anchor_read_bind_file(struct val_anchors* anchors, ldns_buffer* buffer, * @return false on error. */ static int -anchor_read_bind_file_wild(struct val_anchors* anchors, ldns_buffer* buffer, +anchor_read_bind_file_wild(struct val_anchors* anchors, sldns_buffer* buffer, const char* pat) { #ifdef HAVE_GLOB @@ -900,7 +889,7 @@ assemble_it(struct trust_anchor* ta, size_t num, uint16_t type) free(pkey); return NULL; } - pd->rr_ttl = (uint32_t*)malloc(num*sizeof(uint32_t)); + pd->rr_ttl = (time_t*)malloc(num*sizeof(time_t)); if(!pd->rr_ttl) { free(pd->rr_len); free(pd); @@ -1050,13 +1039,13 @@ anchors_apply_cfg(struct val_anchors* anchors, struct config_file* cfg) { struct config_strlist* f; char* nm; - ldns_buffer* parsebuf = ldns_buffer_new(65535); + sldns_buffer* parsebuf = sldns_buffer_new(65535); for(f = cfg->domain_insecure; f; f = f->next) { if(!f->str || f->str[0] == 0) /* empty "" */ continue; if(!anchor_insert_insecure(anchors, f->str)) { log_err("error in domain-insecure: %s", f->str); - ldns_buffer_free(parsebuf); + sldns_buffer_free(parsebuf); return 0; } } @@ -1069,7 +1058,7 @@ anchors_apply_cfg(struct val_anchors* anchors, struct config_file* cfg) nm += strlen(cfg->chrootdir); if(!anchor_read_file(anchors, parsebuf, nm, 0)) { log_err("error reading trust-anchor-file: %s", f->str); - ldns_buffer_free(parsebuf); + sldns_buffer_free(parsebuf); return 0; } } @@ -1082,7 +1071,7 @@ anchors_apply_cfg(struct val_anchors* anchors, struct config_file* cfg) nm += strlen(cfg->chrootdir); if(!anchor_read_bind_file_wild(anchors, parsebuf, nm)) { log_err("error reading trusted-keys-file: %s", f->str); - ldns_buffer_free(parsebuf); + sldns_buffer_free(parsebuf); return 0; } } @@ -1091,7 +1080,7 @@ anchors_apply_cfg(struct val_anchors* anchors, struct config_file* cfg) continue; if(!anchor_store_str(anchors, parsebuf, f->str)) { log_err("error in trust-anchor: \"%s\"", f->str); - ldns_buffer_free(parsebuf); + sldns_buffer_free(parsebuf); return 0; } } @@ -1105,7 +1094,7 @@ anchors_apply_cfg(struct val_anchors* anchors, struct config_file* cfg) nm, 1))) { log_err("error reading dlv-anchor-file: %s", cfg->dlv_anchor_file); - ldns_buffer_free(parsebuf); + sldns_buffer_free(parsebuf); return 0; } lock_basic_lock(&anchors->lock); @@ -1119,7 +1108,7 @@ anchors_apply_cfg(struct val_anchors* anchors, struct config_file* cfg) if(!(dlva = anchor_store_str( anchors, parsebuf, f->str))) { log_err("error in dlv-anchor: \"%s\"", f->str); - ldns_buffer_free(parsebuf); + sldns_buffer_free(parsebuf); return 0; } lock_basic_lock(&anchors->lock); @@ -1138,14 +1127,14 @@ anchors_apply_cfg(struct val_anchors* anchors, struct config_file* cfg) if(!autr_read_file(anchors, nm)) { log_err("error reading auto-trust-anchor-file: %s", f->str); - ldns_buffer_free(parsebuf); + sldns_buffer_free(parsebuf); return 0; } } /* first assemble, since it may delete useless anchors */ anchors_assemble_rrsets(anchors); init_parents(anchors); - ldns_buffer_free(parsebuf); + sldns_buffer_free(parsebuf); if(verbosity >= VERB_ALGO) autr_debug_print(anchors); return 1; } @@ -1195,6 +1184,8 @@ anchors_get_mem(struct val_anchors* anchors) { struct trust_anchor *ta; size_t s = sizeof(*anchors); + if(!anchors) + return 0; RBTREE_FOR(ta, struct trust_anchor*, anchors->tree) { s += sizeof(*ta) + ta->namelen; /* keys and so on */ diff --git a/contrib/unbound/validator/val_anchor.h b/contrib/unbound/validator/val_anchor.h index 5a3ad409a83..4951b9996cb 100644 --- a/contrib/unbound/validator/val_anchor.h +++ b/contrib/unbound/validator/val_anchor.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -48,6 +48,7 @@ struct config_file; struct ub_packed_rrset_key; struct autr_point_data; struct autr_global_data; +struct sldns_buffer; /** * Trust anchor store. @@ -184,7 +185,7 @@ struct trust_anchor* anchor_find(struct val_anchors* anchors, * @return NULL on error. */ struct trust_anchor* anchor_store_str(struct val_anchors* anchors, - ldns_buffer* buffer, const char* str); + struct sldns_buffer* buffer, const char* str); /** * Get memory in use by the trust anchor storage diff --git a/contrib/unbound/validator/val_kcache.c b/contrib/unbound/validator/val_kcache.c index 68e8c3f619b..22070cc6a90 100644 --- a/contrib/unbound/validator/val_kcache.c +++ b/contrib/unbound/validator/val_kcache.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -126,7 +126,7 @@ key_cache_search(struct key_cache* kcache, uint8_t* name, size_t namelen, struct key_entry_key* key_cache_obtain(struct key_cache* kcache, uint8_t* name, size_t namelen, - uint16_t key_class, struct regional* region, uint32_t now) + uint16_t key_class, struct regional* region, time_t now) { /* keep looking until we find a nonexpired entry */ while(1) { diff --git a/contrib/unbound/validator/val_kcache.h b/contrib/unbound/validator/val_kcache.h index c37cf1ecbaf..76c9dd094d1 100644 --- a/contrib/unbound/validator/val_kcache.h +++ b/contrib/unbound/validator/val_kcache.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -106,7 +106,7 @@ void key_cache_remove(struct key_cache* kcache, */ struct key_entry_key* key_cache_obtain(struct key_cache* kcache, uint8_t* name, size_t namelen, uint16_t key_class, - struct regional* region, uint32_t now); + struct regional* region, time_t now); /** * Get memory in use by the key cache. diff --git a/contrib/unbound/validator/val_kentry.c b/contrib/unbound/validator/val_kentry.c index ddac140d316..f99f18e894a 100644 --- a/contrib/unbound/validator/val_kentry.c +++ b/contrib/unbound/validator/val_kentry.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -39,13 +39,14 @@ * This file contains functions for dealing with validator key entries. */ #include "config.h" -#include #include "validator/val_kentry.h" #include "util/data/packed_rrset.h" #include "util/data/dname.h" #include "util/storage/lookup3.h" #include "util/regional.h" #include "util/net_help.h" +#include "ldns/rrdef.h" +#include "ldns/keyraw.h" size_t key_entry_sizefunc(void* key, void* data) @@ -275,8 +276,8 @@ key_entry_setup(struct regional* region, struct key_entry_key* key_entry_create_null(struct regional* region, - uint8_t* name, size_t namelen, uint16_t dclass, uint32_t ttl, - uint32_t now) + uint8_t* name, size_t namelen, uint16_t dclass, time_t ttl, + time_t now) { struct key_entry_key* k; struct key_entry_data* d; @@ -294,7 +295,7 @@ key_entry_create_null(struct regional* region, struct key_entry_key* key_entry_create_rrset(struct regional* region, uint8_t* name, size_t namelen, uint16_t dclass, - struct ub_packed_rrset_key* rrset, uint8_t* sigalg, uint32_t now) + struct ub_packed_rrset_key* rrset, uint8_t* sigalg, time_t now) { struct key_entry_key* k; struct key_entry_data* d; @@ -321,8 +322,8 @@ key_entry_create_rrset(struct regional* region, struct key_entry_key* key_entry_create_bad(struct regional* region, - uint8_t* name, size_t namelen, uint16_t dclass, uint32_t ttl, - uint32_t now) + uint8_t* name, size_t namelen, uint16_t dclass, time_t ttl, + time_t now) { struct key_entry_key* k; struct key_entry_data* d; @@ -377,7 +378,7 @@ dnskey_get_keysize(struct packed_rrset_data* data, size_t idx) algo = (int)data->rr_data[idx][2+3]; pk = (unsigned char*)data->rr_data[idx]+2+4; pklen = (unsigned)data->rr_len[idx]-2-4; - return ldns_rr_dnskey_key_size_raw(pk, pklen, algo); + return sldns_rr_dnskey_key_size_raw(pk, pklen, algo); } /** get dnskey flags from data */ diff --git a/contrib/unbound/validator/val_kentry.h b/contrib/unbound/validator/val_kentry.h index d14ffe58801..ade65571a57 100644 --- a/contrib/unbound/validator/val_kentry.h +++ b/contrib/unbound/validator/val_kentry.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -75,7 +75,7 @@ struct key_entry_key { */ struct key_entry_data { /** the TTL of this entry (absolute time) */ - uint32_t ttl; + time_t ttl; /** the key rrdata. can be NULL to signal keyless name. */ struct packed_rrset_data* rrset_data; /** not NULL sometimes to give reason why bogus */ @@ -169,8 +169,8 @@ char* key_entry_get_reason(struct key_entry_key* kkey); * @return new key entry or NULL on alloc failure */ struct key_entry_key* key_entry_create_null(struct regional* region, - uint8_t* name, size_t namelen, uint16_t dclass, uint32_t ttl, - uint32_t now); + uint8_t* name, size_t namelen, uint16_t dclass, time_t ttl, + time_t now); /** * Create a key entry from an rrset, in the given region. @@ -185,7 +185,7 @@ struct key_entry_key* key_entry_create_null(struct regional* region, */ struct key_entry_key* key_entry_create_rrset(struct regional* region, uint8_t* name, size_t namelen, uint16_t dclass, - struct ub_packed_rrset_key* rrset, uint8_t* sigalg, uint32_t now); + struct ub_packed_rrset_key* rrset, uint8_t* sigalg, time_t now); /** * Create a bad entry, in the given region. @@ -198,8 +198,8 @@ struct key_entry_key* key_entry_create_rrset(struct regional* region, * @return new key entry or NULL on alloc failure */ struct key_entry_key* key_entry_create_bad(struct regional* region, - uint8_t* name, size_t namelen, uint16_t dclass, uint32_t ttl, - uint32_t now); + uint8_t* name, size_t namelen, uint16_t dclass, time_t ttl, + time_t now); /** * Obtain rrset from a key entry, allocated in region. diff --git a/contrib/unbound/validator/val_neg.c b/contrib/unbound/validator/val_neg.c index eec2eb1b6bb..1d7a5c56e85 100644 --- a/contrib/unbound/validator/val_neg.c +++ b/contrib/unbound/validator/val_neg.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -59,6 +59,8 @@ #include "util/config_file.h" #include "services/cache/rrset.h" #include "services/cache/dns.h" +#include "ldns/rrdef.h" +#include "ldns/sbuffer.h" int val_neg_data_compare(const void* a, const void* b) { @@ -494,8 +496,8 @@ static struct val_neg_zone* neg_zone_chain( struct val_neg_zone* p=first, *np; while(p) { np = p->parent; - free(p); free(p->name); + free(p); p = np; } return NULL; @@ -640,8 +642,8 @@ static struct val_neg_data* neg_data_chain( struct val_neg_data* p = first, *np; while(p) { np = p->parent; - free(p); free(p->name); + free(p); p = np; } return NULL; @@ -917,7 +919,7 @@ static int neg_closest_data(struct val_neg_zone* zone, } int val_neg_dlvlookup(struct val_neg_cache* neg, uint8_t* qname, size_t len, - uint16_t qclass, struct rrset_cache* rrset_cache, uint32_t now) + uint16_t qclass, struct rrset_cache* rrset_cache, time_t now) { /* lookup closest zone */ struct val_neg_zone* zone; @@ -1138,7 +1140,7 @@ static struct ub_packed_rrset_key* grab_nsec(struct rrset_cache* rrset_cache, uint8_t* qname, size_t qname_len, uint16_t qtype, uint16_t qclass, uint32_t flags, struct regional* region, int checkbit, uint16_t checktype, - uint32_t now) + time_t now) { struct ub_packed_rrset_key* r, *k = rrset_cache_lookup(rrset_cache, qname, qname_len, qtype, qclass, flags, now, 0); @@ -1174,7 +1176,7 @@ grab_nsec(struct rrset_cache* rrset_cache, uint8_t* qname, size_t qname_len, /** find nsec3 closest encloser in neg cache */ static struct val_neg_data* neg_find_nsec3_ce(struct val_neg_zone* zone, uint8_t* qname, size_t qname_len, - int qlabs, ldns_buffer* buf, uint8_t* hashnc, size_t* nclen) + int qlabs, sldns_buffer* buf, uint8_t* hashnc, size_t* nclen) { struct val_neg_data* data; uint8_t hashce[NSEC3_SHA_LEN]; @@ -1225,7 +1227,7 @@ neg_params_ok(struct val_neg_zone* zone, struct ub_packed_rrset_key* rrset) static struct ub_packed_rrset_key* neg_nsec3_getnc(struct val_neg_zone* zone, uint8_t* hashnc, size_t nclen, struct rrset_cache* rrset_cache, struct regional* region, - uint32_t now, uint8_t* b32, size_t maxb32) + time_t now, uint8_t* b32, size_t maxb32) { struct ub_packed_rrset_key* nc_rrset; struct val_neg_data* data; @@ -1257,8 +1259,8 @@ neg_nsec3_getnc(struct val_neg_zone* zone, uint8_t* hashnc, size_t nclen, /** neg cache nsec3 proof procedure*/ static struct dns_msg* neg_nsec3_proof_ds(struct val_neg_zone* zone, uint8_t* qname, size_t qname_len, - int qlabs, ldns_buffer* buf, struct rrset_cache* rrset_cache, - struct regional* region, uint32_t now, uint8_t* topname) + int qlabs, sldns_buffer* buf, struct rrset_cache* rrset_cache, + struct regional* region, time_t now, uint8_t* topname) { struct dns_msg* msg; struct val_neg_data* data; @@ -1356,7 +1358,7 @@ neg_nsec3_proof_ds(struct val_neg_zone* zone, uint8_t* qname, size_t qname_len, * @param zone: val_neg_zone if we have one. * @return false on lookup or alloc failure. */ -static int add_soa(struct rrset_cache* rrset_cache, uint32_t now, +static int add_soa(struct rrset_cache* rrset_cache, time_t now, struct regional* region, struct dns_msg* msg, struct val_neg_zone* zone) { struct ub_packed_rrset_key* soa; @@ -1388,7 +1390,7 @@ static int add_soa(struct rrset_cache* rrset_cache, uint32_t now, struct dns_msg* val_neg_getmsg(struct val_neg_cache* neg, struct query_info* qinfo, struct regional* region, struct rrset_cache* rrset_cache, - ldns_buffer* buf, uint32_t now, int addsoa, uint8_t* topname) + sldns_buffer* buf, time_t now, int addsoa, uint8_t* topname) { struct dns_msg* msg; struct ub_packed_rrset_key* rrset; diff --git a/contrib/unbound/validator/val_neg.h b/contrib/unbound/validator/val_neg.h index 01b423e1afb..967d1a70f9c 100644 --- a/contrib/unbound/validator/val_neg.h +++ b/contrib/unbound/validator/val_neg.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -46,6 +46,7 @@ #define VALIDATOR_VAL_NEG_H #include "util/locks.h" #include "util/rbtree.h" +struct sldns_buffer; struct val_neg_data; struct config_file; struct reply_info; @@ -229,7 +230,7 @@ void val_neg_addreferral(struct val_neg_cache* neg, struct reply_info* rep, * thus, qname DLV qclass does not exist. */ int val_neg_dlvlookup(struct val_neg_cache* neg, uint8_t* qname, size_t len, - uint16_t qclass, struct rrset_cache* rrset_cache, uint32_t now); + uint16_t qclass, struct rrset_cache* rrset_cache, time_t now); /** * For the given query, try to get a reply out of the negative cache. @@ -255,7 +256,7 @@ int val_neg_dlvlookup(struct val_neg_cache* neg, uint8_t* qname, size_t len, */ struct dns_msg* val_neg_getmsg(struct val_neg_cache* neg, struct query_info* qinfo, struct regional* region, - struct rrset_cache* rrset_cache, ldns_buffer* buf, uint32_t now, + struct rrset_cache* rrset_cache, struct sldns_buffer* buf, time_t now, int addsoa, uint8_t* topname); diff --git a/contrib/unbound/validator/val_nsec.c b/contrib/unbound/validator/val_nsec.c index 8bda8dabc93..bdfe3c8fa18 100644 --- a/contrib/unbound/validator/val_nsec.c +++ b/contrib/unbound/validator/val_nsec.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -41,7 +41,6 @@ * for denial of existance, and proofs for presence of types. */ #include "config.h" -#include #include "validator/val_nsec.h" #include "validator/val_utils.h" #include "util/data/msgreply.h" @@ -197,7 +196,7 @@ nsec_verify_rrset(struct module_env* env, struct val_env* ve, enum sec_status val_nsec_prove_nodata_dsreply(struct module_env* env, struct val_env* ve, struct query_info* qinfo, struct reply_info* rep, - struct key_entry_key* kkey, uint32_t* proof_ttl, char** reason) + struct key_entry_key* kkey, time_t* proof_ttl, char** reason) { struct ub_packed_rrset_key* nsec = reply_find_rrset_section_ns( rep, qinfo->qname, qinfo->qname_len, LDNS_RR_TYPE_NSEC, diff --git a/contrib/unbound/validator/val_nsec.h b/contrib/unbound/validator/val_nsec.h index 34f7f63b40e..f680d08c0ae 100644 --- a/contrib/unbound/validator/val_nsec.h +++ b/contrib/unbound/validator/val_nsec.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -73,7 +73,7 @@ struct key_entry_key; enum sec_status val_nsec_prove_nodata_dsreply(struct module_env* env, struct val_env* ve, struct query_info* qinfo, struct reply_info* rep, struct key_entry_key* kkey, - uint32_t* proof_ttl, char** reason); + time_t* proof_ttl, char** reason); /** * nsec typemap check, takes an NSEC-type bitmap as argument, checks for type. diff --git a/contrib/unbound/validator/val_nsec3.c b/contrib/unbound/validator/val_nsec3.c index 4b48e7beed6..fe5091c0a38 100644 --- a/contrib/unbound/validator/val_nsec3.c +++ b/contrib/unbound/validator/val_nsec3.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -62,18 +62,19 @@ #include "util/data/msgreply.h" /* we include nsec.h for the bitmap_has_type function */ #include "validator/val_nsec.h" +#include "ldns/sbuffer.h" /** * This function we get from ldns-compat or from base system * it returns the number of data bytes stored at the target, or <0 on error. */ -int ldns_b32_ntop_extended_hex(uint8_t const *src, size_t srclength, +int sldns_b32_ntop_extended_hex(uint8_t const *src, size_t srclength, char *target, size_t targsize); /** * This function we get from ldns-compat or from base system * it returns the number of data bytes stored at the target, or <0 on error. */ -int ldns_b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, +int sldns_b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); /** @@ -259,7 +260,7 @@ size_t nsec3_hash_to_b32(uint8_t* hash, size_t hashlen, uint8_t* zone, int ret; if(max < hashlen*2+1) /* quick approx of b32, as if hexb16 */ return 0; - ret = ldns_b32_ntop_extended_hex(hash, hashlen, (char*)buf+1, max-1); + ret = sldns_b32_ntop_extended_hex(hash, hashlen, (char*)buf+1, max-1); if(ret < 1) return 0; buf[0] = (uint8_t)ret; /* length of b32 label */ @@ -534,16 +535,16 @@ nsec3_hash_cmp(const void* c1, const void* c2) } size_t -nsec3_get_hashed(ldns_buffer* buf, uint8_t* nm, size_t nmlen, int algo, +nsec3_get_hashed(sldns_buffer* buf, uint8_t* nm, size_t nmlen, int algo, size_t iter, uint8_t* salt, size_t saltlen, uint8_t* res, size_t max) { size_t i, hash_len; /* prepare buffer for first iteration */ - ldns_buffer_clear(buf); - ldns_buffer_write(buf, nm, nmlen); - query_dname_tolower(ldns_buffer_begin(buf)); - ldns_buffer_write(buf, salt, saltlen); - ldns_buffer_flip(buf); + sldns_buffer_clear(buf); + sldns_buffer_write(buf, nm, nmlen); + query_dname_tolower(sldns_buffer_begin(buf)); + sldns_buffer_write(buf, salt, saltlen); + sldns_buffer_flip(buf); switch(algo) { #if defined(HAVE_EVP_SHA1) || defined(HAVE_NSS) case NSEC3_HASH_SHA1: @@ -555,29 +556,29 @@ nsec3_get_hashed(ldns_buffer* buf, uint8_t* nm, size_t nmlen, int algo, if(hash_len > max) return 0; # ifdef HAVE_SSL - (void)SHA1((unsigned char*)ldns_buffer_begin(buf), - (unsigned long)ldns_buffer_limit(buf), + (void)SHA1((unsigned char*)sldns_buffer_begin(buf), + (unsigned long)sldns_buffer_limit(buf), (unsigned char*)res); # else (void)HASH_HashBuf(HASH_AlgSHA1, (unsigned char*)res, - (unsigned char*)ldns_buffer_begin(buf), - (unsigned long)ldns_buffer_limit(buf)); + (unsigned char*)sldns_buffer_begin(buf), + (unsigned long)sldns_buffer_limit(buf)); # endif for(i=0; insec3, c->rr); @@ -601,11 +602,11 @@ nsec3_calc_hash(struct regional* region, ldns_buffer* buf, if(!nsec3_get_salt(c->nsec3, c->rr, &salt, &saltlen)) return -1; /* prepare buffer for first iteration */ - ldns_buffer_clear(buf); - ldns_buffer_write(buf, c->dname, c->dname_len); - query_dname_tolower(ldns_buffer_begin(buf)); - ldns_buffer_write(buf, salt, saltlen); - ldns_buffer_flip(buf); + sldns_buffer_clear(buf); + sldns_buffer_write(buf, c->dname, c->dname_len); + query_dname_tolower(sldns_buffer_begin(buf)); + sldns_buffer_write(buf, salt, saltlen); + sldns_buffer_flip(buf); switch(algo) { #if defined(HAVE_EVP_SHA1) || defined(HAVE_NSS) case NSEC3_HASH_SHA1: @@ -619,30 +620,30 @@ nsec3_calc_hash(struct regional* region, ldns_buffer* buf, if(!c->hash) return 0; # ifdef HAVE_SSL - (void)SHA1((unsigned char*)ldns_buffer_begin(buf), - (unsigned long)ldns_buffer_limit(buf), + (void)SHA1((unsigned char*)sldns_buffer_begin(buf), + (unsigned long)sldns_buffer_limit(buf), (unsigned char*)c->hash); # else (void)HASH_HashBuf(HASH_AlgSHA1, (unsigned char*)c->hash, - (unsigned char*)ldns_buffer_begin(buf), - (unsigned long)ldns_buffer_limit(buf)); + (unsigned char*)sldns_buffer_begin(buf), + (unsigned long)sldns_buffer_limit(buf)); # endif for(i=0; ihash, c->hash_len); - ldns_buffer_write(buf, salt, saltlen); - ldns_buffer_flip(buf); + sldns_buffer_clear(buf); + sldns_buffer_write(buf, c->hash, c->hash_len); + sldns_buffer_write(buf, salt, saltlen); + sldns_buffer_flip(buf); # ifdef HAVE_SSL (void)SHA1( - (unsigned char*)ldns_buffer_begin(buf), - (unsigned long)ldns_buffer_limit(buf), + (unsigned char*)sldns_buffer_begin(buf), + (unsigned long)sldns_buffer_limit(buf), (unsigned char*)c->hash); # else (void)HASH_HashBuf(HASH_AlgSHA1, (unsigned char*)c->hash, - (unsigned char*)ldns_buffer_begin(buf), - (unsigned long)ldns_buffer_limit(buf)); + (unsigned char*)sldns_buffer_begin(buf), + (unsigned long)sldns_buffer_limit(buf)); # endif } break; @@ -656,19 +657,19 @@ nsec3_calc_hash(struct regional* region, ldns_buffer* buf, /** perform b32 encoding of hash */ static int -nsec3_calc_b32(struct regional* region, ldns_buffer* buf, +nsec3_calc_b32(struct regional* region, sldns_buffer* buf, struct nsec3_cached_hash* c) { int r; - ldns_buffer_clear(buf); - r = ldns_b32_ntop_extended_hex(c->hash, c->hash_len, - (char*)ldns_buffer_begin(buf), ldns_buffer_limit(buf)); + sldns_buffer_clear(buf); + r = sldns_b32_ntop_extended_hex(c->hash, c->hash_len, + (char*)sldns_buffer_begin(buf), sldns_buffer_limit(buf)); if(r < 1) { log_err("b32_ntop_extended_hex: error in encoding: %d", r); return 0; } c->b32_len = (size_t)r; - c->b32 = regional_alloc_init(region, ldns_buffer_begin(buf), + c->b32 = regional_alloc_init(region, sldns_buffer_begin(buf), c->b32_len); if(!c->b32) return 0; @@ -676,7 +677,7 @@ nsec3_calc_b32(struct regional* region, ldns_buffer* buf, } int -nsec3_hash_name(rbtree_t* table, struct regional* region, ldns_buffer* buf, +nsec3_hash_name(rbtree_t* table, struct regional* region, sldns_buffer* buf, struct ub_packed_rrset_key* nsec3, int rr, uint8_t* dname, size_t dname_len, struct nsec3_cached_hash** hash) { @@ -713,6 +714,8 @@ nsec3_hash_name(rbtree_t* table, struct regional* region, ldns_buffer* buf, return r; #ifdef UNBOUND_DEBUG n = +#else + (void) #endif rbtree_insert(table, &c->node); log_assert(n); /* cannot be duplicate, just did lookup */ @@ -814,7 +817,7 @@ find_matching_nsec3(struct module_env* env, struct nsec3_filter* flt, int nsec3_covers(uint8_t* zone, struct nsec3_cached_hash* hash, - struct ub_packed_rrset_key* rrset, int rr, ldns_buffer* buf) + struct ub_packed_rrset_key* rrset, int rr, sldns_buffer* buf) { uint8_t* next, *owner; size_t nextlen; @@ -838,10 +841,10 @@ nsec3_covers(uint8_t* zone, struct nsec3_cached_hash* hash, return 1; /* convert owner name from text to binary */ - ldns_buffer_clear(buf); - owner = ldns_buffer_begin(buf); - len = ldns_b32_pton_extended_hex((char*)rrset->rk.dname+1, - hash->b32_len, owner, ldns_buffer_limit(buf)); + sldns_buffer_clear(buf); + owner = sldns_buffer_begin(buf); + len = sldns_b32_pton_extended_hex((char*)rrset->rk.dname+1, + hash->b32_len, owner, sldns_buffer_limit(buf)); if(len<1) return 0; /* bad owner name in some way */ if((size_t)len != hash->hash_len || (size_t)len != nextlen) diff --git a/contrib/unbound/validator/val_nsec3.h b/contrib/unbound/validator/val_nsec3.h index ae4326daffb..d619d672d12 100644 --- a/contrib/unbound/validator/val_nsec3.h +++ b/contrib/unbound/validator/val_nsec3.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -75,6 +75,7 @@ struct ub_packed_rrset_key; struct reply_info; struct query_info; struct key_entry_key; +struct sldns_buffer; /** * 0 1 2 3 4 5 6 7 @@ -270,9 +271,9 @@ int nsec3_hash_cmp(const void* c1, const void* c2); * 0 on a malloc failure. * -1 if the NSEC3 rr was badly formatted (i.e. formerr). */ -int nsec3_hash_name(rbtree_t* table, struct regional* region, ldns_buffer* buf, - struct ub_packed_rrset_key* nsec3, int rr, uint8_t* dname, - size_t dname_len, struct nsec3_cached_hash** hash); +int nsec3_hash_name(rbtree_t* table, struct regional* region, + struct sldns_buffer* buf, struct ub_packed_rrset_key* nsec3, int rr, + uint8_t* dname, size_t dname_len, struct nsec3_cached_hash** hash); /** * Get next owner name, converted to base32 encoding and with the @@ -328,8 +329,9 @@ int nsec3_get_params(struct ub_packed_rrset_key* rrset, int r, * @param max: maximum space for result. * @return 0 on failure, otherwise bytelength stored. */ -size_t nsec3_get_hashed(ldns_buffer* buf, uint8_t* nm, size_t nmlen, int algo, - size_t iter, uint8_t* salt, size_t saltlen, uint8_t* res, size_t max); +size_t nsec3_get_hashed(struct sldns_buffer* buf, uint8_t* nm, size_t nmlen, + int algo, size_t iter, uint8_t* salt, size_t saltlen, uint8_t* res, + size_t max); /** * see if NSEC3 RR contains given type @@ -373,6 +375,6 @@ int nsec3_get_nextowner(struct ub_packed_rrset_key* rrset, int r, * @return true if covers, false if not. */ int nsec3_covers(uint8_t* zone, struct nsec3_cached_hash* hash, - struct ub_packed_rrset_key* rrset, int rr, ldns_buffer* buf); + struct ub_packed_rrset_key* rrset, int rr, struct sldns_buffer* buf); #endif /* VALIDATOR_VAL_NSEC3_H */ diff --git a/contrib/unbound/validator/val_secalgo.c b/contrib/unbound/validator/val_secalgo.c index 5cca578b1be..d89675f835b 100644 --- a/contrib/unbound/validator/val_secalgo.c +++ b/contrib/unbound/validator/val_secalgo.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -41,10 +41,12 @@ * and do the library calls (for the crypto library in use). */ #include "config.h" -#include #include "validator/val_secalgo.h" #include "util/data/packed_rrset.h" #include "util/log.h" +#include "ldns/rrdef.h" +#include "ldns/keyraw.h" +#include "ldns/sbuffer.h" #if !defined(HAVE_SSL) && !defined(HAVE_NSS) #error "Need crypto library to do digital signature cryptography" @@ -108,7 +110,7 @@ do_gost94(unsigned char* data, size_t len, unsigned char* dest) const EVP_MD* md = EVP_get_digestbyname("md_gost94"); if(!md) return 0; - return ldns_digest_evp(data, (unsigned int)len, dest, md); + return sldns_digest_evp(data, (unsigned int)len, dest, md); } #endif @@ -172,7 +174,7 @@ dnskey_algo_id_is_supported(int id) #ifdef USE_GOST case LDNS_ECC_GOST: /* we support GOST if it can be loaded */ - return ldns_key_EVP_load_gost_id(); + return sldns_key_EVP_load_gost_id(); #endif default: return 0; @@ -304,10 +306,10 @@ setup_key_digest(int algo, EVP_PKEY** evp_key, const EVP_MD** digest_type, log_err("verify: malloc failure in crypto"); return 0; } - dsa = ldns_key_buf2dsa_raw(key, keylen); + dsa = sldns_key_buf2dsa_raw(key, keylen); if(!dsa) { verbose(VERB_QUERY, "verify: " - "ldns_key_buf2dsa_raw failed"); + "sldns_key_buf2dsa_raw failed"); return 0; } if(EVP_PKEY_assign_DSA(*evp_key, dsa) == 0) { @@ -331,10 +333,10 @@ setup_key_digest(int algo, EVP_PKEY** evp_key, const EVP_MD** digest_type, log_err("verify: malloc failure in crypto"); return 0; } - rsa = ldns_key_buf2rsa_raw(key, keylen); + rsa = sldns_key_buf2rsa_raw(key, keylen); if(!rsa) { verbose(VERB_QUERY, "verify: " - "ldns_key_buf2rsa_raw SHA failed"); + "sldns_key_buf2rsa_raw SHA failed"); return 0; } if(EVP_PKEY_assign_RSA(*evp_key, rsa) == 0) { @@ -363,10 +365,10 @@ setup_key_digest(int algo, EVP_PKEY** evp_key, const EVP_MD** digest_type, log_err("verify: malloc failure in crypto"); return 0; } - rsa = ldns_key_buf2rsa_raw(key, keylen); + rsa = sldns_key_buf2rsa_raw(key, keylen); if(!rsa) { verbose(VERB_QUERY, "verify: " - "ldns_key_buf2rsa_raw MD5 failed"); + "sldns_key_buf2rsa_raw MD5 failed"); return 0; } if(EVP_PKEY_assign_RSA(*evp_key, rsa) == 0) { @@ -379,10 +381,10 @@ setup_key_digest(int algo, EVP_PKEY** evp_key, const EVP_MD** digest_type, break; #ifdef USE_GOST case LDNS_ECC_GOST: - *evp_key = ldns_gost2pkey_raw(key, keylen); + *evp_key = sldns_gost2pkey_raw(key, keylen); if(!*evp_key) { verbose(VERB_QUERY, "verify: " - "ldns_gost2pkey_raw failed"); + "sldns_gost2pkey_raw failed"); return 0; } *digest_type = EVP_get_digestbyname("md_gost94"); @@ -395,11 +397,11 @@ setup_key_digest(int algo, EVP_PKEY** evp_key, const EVP_MD** digest_type, #endif #ifdef USE_ECDSA case LDNS_ECDSAP256SHA256: - *evp_key = ldns_ecdsa2pkey_raw(key, keylen, + *evp_key = sldns_ecdsa2pkey_raw(key, keylen, LDNS_ECDSAP256SHA256); if(!*evp_key) { verbose(VERB_QUERY, "verify: " - "ldns_ecdsa2pkey_raw failed"); + "sldns_ecdsa2pkey_raw failed"); return 0; } #ifdef USE_ECDSA_EVP_WORKAROUND @@ -422,11 +424,11 @@ setup_key_digest(int algo, EVP_PKEY** evp_key, const EVP_MD** digest_type, #endif break; case LDNS_ECDSAP384SHA384: - *evp_key = ldns_ecdsa2pkey_raw(key, keylen, + *evp_key = sldns_ecdsa2pkey_raw(key, keylen, LDNS_ECDSAP384SHA384); if(!*evp_key) { verbose(VERB_QUERY, "verify: " - "ldns_ecdsa2pkey_raw failed"); + "sldns_ecdsa2pkey_raw failed"); return 0; } #ifdef USE_ECDSA_EVP_WORKAROUND @@ -471,7 +473,7 @@ setup_key_digest(int algo, EVP_PKEY** evp_key, const EVP_MD** digest_type, * unchecked on format errors and alloc failures. */ enum sec_status -verify_canonrrset(ldns_buffer* buf, int algo, unsigned char* sigblock, +verify_canonrrset(sldns_buffer* buf, int algo, unsigned char* sigblock, unsigned int sigblock_len, unsigned char* key, unsigned int keylen, char** reason) { @@ -518,8 +520,8 @@ verify_canonrrset(ldns_buffer* buf, int algo, unsigned char* sigblock, if(dofree) free(sigblock); return sec_status_unchecked; } - if(EVP_VerifyUpdate(&ctx, (unsigned char*)ldns_buffer_begin(buf), - (unsigned int)ldns_buffer_limit(buf)) == 0) { + if(EVP_VerifyUpdate(&ctx, (unsigned char*)sldns_buffer_begin(buf), + (unsigned int)sldns_buffer_limit(buf)) == 0) { verbose(VERB_QUERY, "verify: EVP_VerifyUpdate failed"); EVP_PKEY_free(evp_key); if(dofree) free(sigblock); @@ -669,12 +671,12 @@ static SECKEYPublicKey* nss_buf2ecdsa(unsigned char* key, size_t len, int algo) SECKEYPublicKey* pk; SECItem pub = {siBuffer, NULL, 0}; SECItem params = {siBuffer, NULL, 0}; - unsigned char param256[] = { + static unsigned char param256[] = { /* OBJECTIDENTIFIER 1.2.840.10045.3.1.7 (P-256) * {iso(1) member-body(2) us(840) ansi-x962(10045) curves(3) prime(1) prime256v1(7)} */ 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07 }; - unsigned char param384[] = { + static unsigned char param384[] = { /* OBJECTIDENTIFIER 1.3.132.0.34 (P-384) * {iso(1) identified-organization(3) certicom(132) curve(0) ansip384r1(34)} */ 0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x22 @@ -845,19 +847,19 @@ nss_setup_key_digest(int algo, SECKEYPublicKey** pubkey, HASH_HashType* htype, /* uses libNSS */ /* hash prefix for md5, RFC2537 */ - unsigned char p_md5[] = {0x30, 0x20, 0x30, 0x0c, 0x06, 0x08, 0x2a, + static unsigned char p_md5[] = {0x30, 0x20, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x02, 0x05, 0x05, 0x00, 0x04, 0x10}; /* hash prefix to prepend to hash output, from RFC3110 */ - unsigned char p_sha1[] = {0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2B, + static unsigned char p_sha1[] = {0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1A, 0x05, 0x00, 0x04, 0x14}; /* from RFC5702 */ - unsigned char p_sha256[] = {0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, + static unsigned char p_sha256[] = {0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20}; - unsigned char p_sha512[] = {0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, + static unsigned char p_sha512[] = {0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05, 0x00, 0x04, 0x40}; /* from RFC6234 */ /* for future RSASHA384 .. - unsigned char p_sha384[] = {0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, + static unsigned char p_sha384[] = {0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 0x00, 0x04, 0x30}; */ @@ -963,7 +965,7 @@ nss_setup_key_digest(int algo, SECKEYPublicKey** pubkey, HASH_HashType* htype, * unchecked on format errors and alloc failures. */ enum sec_status -verify_canonrrset(ldns_buffer* buf, int algo, unsigned char* sigblock, +verify_canonrrset(sldns_buffer* buf, int algo, unsigned char* sigblock, unsigned int sigblock_len, unsigned char* key, unsigned int keylen, char** reason) { @@ -1019,8 +1021,8 @@ verify_canonrrset(ldns_buffer* buf, int algo, unsigned char* sigblock, SECKEY_DestroyPublicKey(pubkey); return sec_status_unchecked; } - if(HASH_HashBuf(htype, hash, (unsigned char*)ldns_buffer_begin(buf), - (unsigned int)ldns_buffer_limit(buf)) != SECSuccess) { + if(HASH_HashBuf(htype, hash, (unsigned char*)sldns_buffer_begin(buf), + (unsigned int)sldns_buffer_limit(buf)) != SECSuccess) { verbose(VERB_QUERY, "verify: HASH_HashBuf failed"); SECKEY_DestroyPublicKey(pubkey); return sec_status_unchecked; diff --git a/contrib/unbound/validator/val_secalgo.h b/contrib/unbound/validator/val_secalgo.h index a5832af871e..085fbc5a44f 100644 --- a/contrib/unbound/validator/val_secalgo.h +++ b/contrib/unbound/validator/val_secalgo.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -42,6 +42,7 @@ #ifndef VALIDATOR_VAL_SECALGO_H #define VALIDATOR_VAL_SECALGO_H +struct sldns_buffer; /** * Return size of DS digest according to its hash algorithm. @@ -76,7 +77,7 @@ int dnskey_algo_id_is_supported(int id); * @return secure if verification succeeded, bogus on crypto failure, * unchecked on format errors and alloc failures. */ -enum sec_status verify_canonrrset(ldns_buffer* buf, int algo, +enum sec_status verify_canonrrset(struct sldns_buffer* buf, int algo, unsigned char* sigblock, unsigned int sigblock_len, unsigned char* key, unsigned int keylen, char** reason); diff --git a/contrib/unbound/validator/val_sigcrypt.c b/contrib/unbound/validator/val_sigcrypt.c index 79d5e45a237..5a4d0f471a8 100644 --- a/contrib/unbound/validator/val_sigcrypt.c +++ b/contrib/unbound/validator/val_sigcrypt.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -41,7 +41,6 @@ * bridging between RR wireformat data and crypto calls. */ #include "config.h" -#include #include "validator/val_sigcrypt.h" #include "validator/val_secalgo.h" #include "validator/validator.h" @@ -52,7 +51,12 @@ #include "util/module.h" #include "util/net_help.h" #include "util/regional.h" +#include "ldns/keyraw.h" +#include "ldns/sbuffer.h" +#include "ldns/parseutil.h" +#include "ldns/wire2str.h" +#include #if !defined(HAVE_SSL) && !defined(HAVE_NSS) #error "Need crypto library to do digital signature cryptography" #endif @@ -286,7 +290,7 @@ ds_create_dnskey_digest(struct module_env* env, struct ub_packed_rrset_key* ds_rrset, size_t ds_idx, uint8_t* digest) { - ldns_buffer* b = env->scratch_buffer; + sldns_buffer* b = env->scratch_buffer; uint8_t* dnskey_rdata; size_t dnskey_len; rrset_get_rdata(dnskey_rrset, dnskey_idx, &dnskey_rdata, &dnskey_len); @@ -294,15 +298,15 @@ ds_create_dnskey_digest(struct module_env* env, /* create digest source material in buffer * digest = digest_algorithm( DNSKEY owner name | DNSKEY RDATA); * DNSKEY RDATA = Flags | Protocol | Algorithm | Public Key. */ - ldns_buffer_clear(b); - ldns_buffer_write(b, dnskey_rrset->rk.dname, + sldns_buffer_clear(b); + sldns_buffer_write(b, dnskey_rrset->rk.dname, dnskey_rrset->rk.dname_len); - query_dname_tolower(ldns_buffer_begin(b)); - ldns_buffer_write(b, dnskey_rdata+2, dnskey_len-2); /* skip rdatalen*/ - ldns_buffer_flip(b); + query_dname_tolower(sldns_buffer_begin(b)); + sldns_buffer_write(b, dnskey_rdata+2, dnskey_len-2); /* skip rdatalen*/ + sldns_buffer_flip(b); return secalgo_ds_digest(ds_get_digest_algo(ds_rrset, ds_idx), - (unsigned char*)ldns_buffer_begin(b), ldns_buffer_limit(b), + (unsigned char*)sldns_buffer_begin(b), sldns_buffer_limit(b), (unsigned char*)digest); } @@ -366,7 +370,7 @@ dnskey_calc_keytag(struct ub_packed_rrset_key* dnskey_rrset, size_t dnskey_idx) size_t len; rrset_get_rdata(dnskey_rrset, dnskey_idx, &data, &len); /* do not pass rdatalen to ldns */ - return ldns_calc_keytag_raw(data+2, len-2); + return sldns_calc_keytag_raw(data+2, len-2); } int dnskey_algo_is_supported(struct ub_packed_rrset_key* dnskey_rrset, @@ -530,7 +534,7 @@ dnskeyset_verify_rrset(struct module_env* env, struct val_env* ve, void algo_needs_reason(struct module_env* env, int alg, char** reason, char* s) { char buf[256]; - ldns_lookup_table *t = ldns_lookup_by_id(ldns_algorithms, alg); + sldns_lookup_table *t = sldns_lookup_by_id(sldns_algorithms, alg); if(t&&t->name) snprintf(buf, sizeof(buf), "%s with algorithm %s", s, t->name); else snprintf(buf, sizeof(buf), "%s with algorithm ALG%u", s, @@ -579,7 +583,7 @@ dnskey_verify_rrset(struct module_env* env, struct val_env* ve, enum sec_status dnskeyset_verify_rrset_sig(struct module_env* env, struct val_env* ve, - uint32_t now, struct ub_packed_rrset_key* rrset, + time_t now, struct ub_packed_rrset_key* rrset, struct ub_packed_rrset_key* dnskey, size_t sig_idx, struct rbtree_t** sortree, char** reason) { @@ -640,7 +644,7 @@ struct canon_rr { */ static int canonical_compare_byfield(struct packed_rrset_data* d, - const ldns_rr_descriptor* desc, size_t i, size_t j) + const sldns_rr_descriptor* desc, size_t i, size_t j) { /* sweep across rdata, keep track of some state: * which rr field, and bytes left in field. @@ -784,7 +788,7 @@ canonical_compare(struct ub_packed_rrset_key* rrset, size_t i, size_t j) { struct packed_rrset_data* d = (struct packed_rrset_data*) rrset->entry.data; - const ldns_rr_descriptor* desc; + const sldns_rr_descriptor* desc; uint16_t type = ntohs(rrset->rk.type); size_t minlen; int c; @@ -808,7 +812,12 @@ canonical_compare(struct ub_packed_rrset_key* rrset, size_t i, size_t j) case LDNS_RR_TYPE_MR: case LDNS_RR_TYPE_PTR: case LDNS_RR_TYPE_DNAME: - return query_dname_compare(d->rr_data[i]+2, + /* the wireread function has already checked these + * dname's for correctness, and this double checks */ + if(!dname_valid(d->rr_data[i]+2, d->rr_len[i]-2) || + !dname_valid(d->rr_data[j]+2, d->rr_len[j]-2)) + return 0; + return query_dname_compare(d->rr_data[i]+2, d->rr_data[j]+2); /* These RR types have STR and fixed size rdata fields @@ -831,7 +840,7 @@ canonical_compare(struct ub_packed_rrset_key* rrset, size_t i, size_t j) case LDNS_RR_TYPE_PX: case LDNS_RR_TYPE_NAPTR: case LDNS_RR_TYPE_SRV: - desc = ldns_rr_descript(type); + desc = sldns_rr_descript(type); log_assert(desc); /* this holds for the types that need canonicalizing */ log_assert(desc->_minimum == desc->_maximum); @@ -904,15 +913,15 @@ canonical_sort(struct ub_packed_rrset_key* rrset, struct packed_rrset_data* d, * @param can_owner_len: length of canonical owner name. */ static void -insert_can_owner(ldns_buffer* buf, struct ub_packed_rrset_key* k, +insert_can_owner(sldns_buffer* buf, struct ub_packed_rrset_key* k, uint8_t* sig, uint8_t** can_owner, size_t* can_owner_len) { int rrsig_labels = (int)sig[3]; int fqdn_labels = dname_signame_label_count(k->rk.dname); - *can_owner = ldns_buffer_current(buf); + *can_owner = sldns_buffer_current(buf); if(rrsig_labels == fqdn_labels) { /* no change */ - ldns_buffer_write(buf, k->rk.dname, k->rk.dname_len); + sldns_buffer_write(buf, k->rk.dname, k->rk.dname_len); query_dname_tolower(*can_owner); *can_owner_len = k->rk.dname_len; return; @@ -928,8 +937,8 @@ insert_can_owner(ldns_buffer* buf, struct ub_packed_rrset_key* k, dname_remove_label(&nm, &len); } *can_owner_len = len+2; - ldns_buffer_write(buf, (uint8_t*)"\001*", 2); - ldns_buffer_write(buf, nm, len); + sldns_buffer_write(buf, (uint8_t*)"\001*", 2); + sldns_buffer_write(buf, nm, len); query_dname_tolower(*can_owner); } } @@ -941,10 +950,10 @@ insert_can_owner(ldns_buffer* buf, struct ub_packed_rrset_key* k, * @param len: length of the rdata (including rdatalen uint16). */ static void -canonicalize_rdata(ldns_buffer* buf, struct ub_packed_rrset_key* rrset, +canonicalize_rdata(sldns_buffer* buf, struct ub_packed_rrset_key* rrset, size_t len) { - uint8_t* datstart = ldns_buffer_current(buf)-len+2; + uint8_t* datstart = sldns_buffer_current(buf)-len+2; switch(ntohs(rrset->rk.type)) { case LDNS_RR_TYPE_NXT: case LDNS_RR_TYPE_NS: @@ -1035,6 +1044,69 @@ canonicalize_rdata(ldns_buffer* buf, struct ub_packed_rrset_key* rrset, } } +int rrset_canonical_equal(struct regional* region, + struct ub_packed_rrset_key* k1, struct ub_packed_rrset_key* k2) +{ + struct rbtree_t sortree1, sortree2; + struct canon_rr *rrs1, *rrs2, *p1, *p2; + struct packed_rrset_data* d1=(struct packed_rrset_data*)k1->entry.data; + struct packed_rrset_data* d2=(struct packed_rrset_data*)k2->entry.data; + struct ub_packed_rrset_key fk; + struct packed_rrset_data fd; + size_t flen[2]; + uint8_t* fdata[2]; + + /* basic compare */ + if(k1->rk.dname_len != k2->rk.dname_len || + k1->rk.flags != k2->rk.flags || + k1->rk.type != k2->rk.type || + k1->rk.rrset_class != k2->rk.rrset_class || + query_dname_compare(k1->rk.dname, k2->rk.dname) != 0) + return 0; + if(d1->ttl != d2->ttl || + d1->count != d2->count || + d1->rrsig_count != d2->rrsig_count || + d1->trust != d2->trust || + d1->security != d2->security) + return 0; + + /* init */ + memset(&fk, 0, sizeof(fk)); + memset(&fd, 0, sizeof(fd)); + fk.entry.data = &fd; + fd.count = 2; + fd.rr_len = flen; + fd.rr_data = fdata; + rbtree_init(&sortree1, &canonical_tree_compare); + rbtree_init(&sortree2, &canonical_tree_compare); + rrs1 = regional_alloc(region, sizeof(struct canon_rr)*d1->count); + rrs2 = regional_alloc(region, sizeof(struct canon_rr)*d2->count); + if(!rrs1 || !rrs2) return 1; /* alloc failure */ + + /* sort */ + canonical_sort(k1, d1, &sortree1, rrs1); + canonical_sort(k2, d2, &sortree2, rrs2); + + /* compare canonical-sorted RRs for canonical-equality */ + if(sortree1.count != sortree2.count) + return 0; + p1 = (struct canon_rr*)rbtree_first(&sortree1); + p2 = (struct canon_rr*)rbtree_first(&sortree2); + while(p1 != (struct canon_rr*)RBTREE_NULL && + p2 != (struct canon_rr*)RBTREE_NULL) { + flen[0] = d1->rr_len[p1->rr_idx]; + flen[1] = d2->rr_len[p2->rr_idx]; + fdata[0] = d1->rr_data[p1->rr_idx]; + fdata[1] = d2->rr_data[p2->rr_idx]; + + if(canonical_compare(&fk, 0, 1) != 0) + return 0; + p1 = (struct canon_rr*)rbtree_next(&p1->node); + p2 = (struct canon_rr*)rbtree_next(&p2->node); + } + return 1; +} + /** * Create canonical form of rrset in the scratch buffer. * @param region: temporary region. @@ -1048,7 +1120,7 @@ canonicalize_rdata(ldns_buffer* buf, struct ub_packed_rrset_key* rrset, * @return false on alloc error. */ static int -rrset_canonical(struct regional* region, ldns_buffer* buf, +rrset_canonical(struct regional* region, sldns_buffer* buf, struct ub_packed_rrset_key* k, uint8_t* sig, size_t siglen, struct rbtree_t** sortree) { @@ -1072,13 +1144,13 @@ rrset_canonical(struct regional* region, ldns_buffer* buf, canonical_sort(k, d, *sortree, rrs); } - ldns_buffer_clear(buf); - ldns_buffer_write(buf, sig, siglen); + sldns_buffer_clear(buf); + sldns_buffer_write(buf, sig, siglen); /* canonicalize signer name */ - query_dname_tolower(ldns_buffer_begin(buf)+18); + query_dname_tolower(sldns_buffer_begin(buf)+18); RBTREE_FOR(walk, struct canon_rr*, (*sortree)) { /* see if there is enough space left in the buffer */ - if(ldns_buffer_remaining(buf) < can_owner_len + 2 + 2 + 4 + if(sldns_buffer_remaining(buf) < can_owner_len + 2 + 2 + 4 + d->rr_len[walk->rr_idx]) { log_err("verify: failed to canonicalize, " "rrset too big"); @@ -1086,17 +1158,17 @@ rrset_canonical(struct regional* region, ldns_buffer* buf, } /* determine canonical owner name */ if(can_owner) - ldns_buffer_write(buf, can_owner, can_owner_len); + sldns_buffer_write(buf, can_owner, can_owner_len); else insert_can_owner(buf, k, sig, &can_owner, &can_owner_len); - ldns_buffer_write(buf, &k->rk.type, 2); - ldns_buffer_write(buf, &k->rk.rrset_class, 2); - ldns_buffer_write(buf, sig+4, 4); - ldns_buffer_write(buf, d->rr_data[walk->rr_idx], + sldns_buffer_write(buf, &k->rk.type, 2); + sldns_buffer_write(buf, &k->rk.rrset_class, 2); + sldns_buffer_write(buf, sig+4, 4); + sldns_buffer_write(buf, d->rr_data[walk->rr_idx], d->rr_len[walk->rr_idx]); canonicalize_rdata(buf, k, d->rr_len[walk->rr_idx]); } - ldns_buffer_flip(buf); + sldns_buffer_flip(buf); return 1; } @@ -1215,12 +1287,12 @@ adjust_ttl(struct val_env* ve, uint32_t unow, * * Use the smallest of these. */ - if(d->ttl > (uint32_t)origttl) { + if(d->ttl > (time_t)origttl) { verbose(VERB_QUERY, "rrset TTL larger than original TTL," " adjusting TTL downwards"); d->ttl = origttl; } - if(expittl > 0 && d->ttl > (uint32_t)expittl) { + if(expittl > 0 && d->ttl > (time_t)expittl) { verbose(VERB_ALGO, "rrset TTL larger than sig expiration ttl," " adjusting TTL downwards"); d->ttl = expittl; @@ -1228,8 +1300,8 @@ adjust_ttl(struct val_env* ve, uint32_t unow, } enum sec_status -dnskey_verify_rrset_sig(struct regional* region, ldns_buffer* buf, - struct val_env* ve, uint32_t now, +dnskey_verify_rrset_sig(struct regional* region, sldns_buffer* buf, + struct val_env* ve, time_t now, struct ub_packed_rrset_key* rrset, struct ub_packed_rrset_key* dnskey, size_t dnskey_idx, size_t sig_idx, struct rbtree_t** sortree, int* buf_canon, char** reason) diff --git a/contrib/unbound/validator/val_sigcrypt.h b/contrib/unbound/validator/val_sigcrypt.h index c220b0083ac..68aa9a445ae 100644 --- a/contrib/unbound/validator/val_sigcrypt.h +++ b/contrib/unbound/validator/val_sigcrypt.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -49,6 +49,7 @@ struct module_env; struct ub_packed_rrset_key; struct rbtree_t; struct regional; +struct sldns_buffer; /** number of entries in algorithm needs array */ #define ALGO_NEEDS_MAX 256 @@ -274,7 +275,7 @@ enum sec_status dnskey_verify_rrset(struct module_env* env, * or unchecked on error. */ enum sec_status dnskeyset_verify_rrset_sig(struct module_env* env, - struct val_env* ve, uint32_t now, struct ub_packed_rrset_key* rrset, + struct val_env* ve, time_t now, struct ub_packed_rrset_key* rrset, struct ub_packed_rrset_key* dnskey, size_t sig_idx, struct rbtree_t** sortree, char** reason); @@ -298,7 +299,7 @@ enum sec_status dnskeyset_verify_rrset_sig(struct module_env* env, * bogus if it did not validate. */ enum sec_status dnskey_verify_rrset_sig(struct regional* region, - ldns_buffer* buf, struct val_env* ve, uint32_t now, + struct sldns_buffer* buf, struct val_env* ve, time_t now, struct ub_packed_rrset_key* rrset, struct ub_packed_rrset_key* dnskey, size_t dnskey_idx, size_t sig_idx, struct rbtree_t** sortree, int* buf_canon, char** reason); @@ -308,4 +309,15 @@ enum sec_status dnskey_verify_rrset_sig(struct regional* region, */ int canonical_tree_compare(const void* k1, const void* k2); +/** + * Compare two rrsets and see if they are the same, canonicalised. + * The rrsets are not altered. + * @param region: temporary region. + * @param k1: rrset1 + * @param k2: rrset2 + * @return true if equal. + */ +int rrset_canonical_equal(struct regional* region, + struct ub_packed_rrset_key* k1, struct ub_packed_rrset_key* k2); + #endif /* VALIDATOR_VAL_SIGCRYPT_H */ diff --git a/contrib/unbound/validator/val_utils.c b/contrib/unbound/validator/val_utils.c index d4a64464d80..ecf2dfaf05c 100644 --- a/contrib/unbound/validator/val_utils.c +++ b/contrib/unbound/validator/val_utils.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -486,7 +486,7 @@ val_verify_DNSKEY_with_DS(struct module_env* env, struct val_env* ve, /* Once we see a single DS with a known digestID and * algorithm, we cannot return INSECURE (with a * "null" KeyEntry). */ - has_useful_ds = true; + has_useful_ds = 1; sec = verify_dnskeys_with_ds_rr(env, ve, dnskey_rrset, ds_rrset, i, reason); @@ -596,7 +596,7 @@ val_verify_DNSKEY_with_TA(struct module_env* env, struct val_env* ve, /* Once we see a single DS with a known digestID and * algorithm, we cannot return INSECURE (with a * "null" KeyEntry). */ - has_useful_ta = true; + has_useful_ta = 1; sec = verify_dnskeys_with_ds_rr(env, ve, dnskey_rrset, ta_ds, i, reason); @@ -622,7 +622,7 @@ val_verify_DNSKEY_with_TA(struct module_env* env, struct val_env* ve, continue; /* we saw a useful TA */ - has_useful_ta = true; + has_useful_ta = 1; sec = dnskey_verify_rrset(env, ve, dnskey_rrset, ta_dnskey, i, reason); @@ -773,6 +773,8 @@ rrset_has_signer(struct ub_packed_rrset_key* rrset, uint8_t* name, size_t len) for(i = d->count; i< d->count+d->rrsig_count; i++) { if(d->rr_len[i] > 2+18+len) { /* at least rdatalen + signature + signame (+1 sig)*/ + if(!dname_valid(d->rr_data[i]+2+18, d->rr_len[i]-2-18)) + continue; if(query_dname_compare(name, d->rr_data[i]+2+18) == 0) { return 1; diff --git a/contrib/unbound/validator/val_utils.h b/contrib/unbound/validator/val_utils.h index f0afc3756e9..b0344eff7de 100644 --- a/contrib/unbound/validator/val_utils.h +++ b/contrib/unbound/validator/val_utils.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/unbound/validator/validator.c b/contrib/unbound/validator/validator.c index 10b0a243cdf..aefa26a2794 100644 --- a/contrib/unbound/validator/validator.c +++ b/contrib/unbound/validator/validator.c @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** @@ -40,7 +40,6 @@ * According to RFC 4034. */ #include "config.h" -#include #include "validator/validator.h" #include "validator/val_anchor.h" #include "validator/val_kcache.h" @@ -59,6 +58,8 @@ #include "util/regional.h" #include "util/config_file.h" #include "util/fptr_wlist.h" +#include "ldns/rrdef.h" +#include "ldns/wire2str.h" /* forward decl for cache response and normal super inform calls of a DS */ static void process_ds_response(struct module_qstate* qstate, @@ -294,9 +295,12 @@ needs_validation(struct module_qstate* qstate, int ret_rc, else rcode = (int)FLAGS_GET_RCODE(ret_msg->rep->flags); if(rcode != LDNS_RCODE_NOERROR && rcode != LDNS_RCODE_NXDOMAIN) { - verbose(VERB_ALGO, "cannot validate non-answer, rcode %s", - ldns_lookup_by_id(ldns_rcodes, rcode)? - ldns_lookup_by_id(ldns_rcodes, rcode)->name:"??"); + if(verbosity >= VERB_ALGO) { + char rc[16]; + rc[0]=0; + (void)sldns_wire2str_rcode_buf(rcode, rc, sizeof(rc)); + verbose(VERB_ALGO, "cannot validate non-answer, rcode %s", rc); + } return 0; } @@ -758,11 +762,12 @@ validate_nodata_response(struct module_env* env, struct val_env* ve, * @param chase_reply: answer to that query to validate. * @param kkey: the key entry, which is trusted, and which matches * the signer of the answer. The key entry isgood(). + * @param rcode: adjusted RCODE, in case of RCODE/proof mismatch leniency. */ static void validate_nameerror_response(struct module_env* env, struct val_env* ve, struct query_info* qchase, struct reply_info* chase_reply, - struct key_entry_key* kkey) + struct key_entry_key* kkey, int* rcode) { int has_valid_nsec = 0; int has_valid_wnsec = 0; @@ -809,6 +814,10 @@ validate_nameerror_response(struct module_env* env, struct val_env* ve, verbose(VERB_QUERY, "NameError response has failed to prove: " "qname does not exist"); chase_reply->security = sec_status_bogus; + /* Be lenient with RCODE in NSEC NameError responses */ + validate_nodata_response(env, ve, qchase, chase_reply, kkey); + if (chase_reply->security == sec_status_secure) + *rcode = LDNS_RCODE_NOERROR; return; } @@ -816,6 +825,10 @@ validate_nameerror_response(struct module_env* env, struct val_env* ve, verbose(VERB_QUERY, "NameError response has failed to prove: " "covering wildcard does not exist"); chase_reply->security = sec_status_bogus; + /* Be lenient with RCODE in NSEC NameError responses */ + validate_nodata_response(env, ve, qchase, chase_reply, kkey); + if (chase_reply->security == sec_status_secure) + *rcode = LDNS_RCODE_NOERROR; return; } @@ -1564,6 +1577,7 @@ processValidate(struct module_qstate* qstate, struct val_qstate* vq, struct val_env* ve, int id) { enum val_classification subtype; + int rcode; if(!vq->key_entry) { verbose(VERB_ALGO, "validate: no key entry, failed"); @@ -1647,7 +1661,7 @@ processValidate(struct module_qstate* qstate, struct val_qstate* vq, sec_status_to_string( vq->chase_reply->security)); break; - + case VAL_CLASS_NODATA: verbose(VERB_ALGO, "Validating a nodata response"); validate_nodata_response(qstate->env, ve, @@ -1658,12 +1672,15 @@ processValidate(struct module_qstate* qstate, struct val_qstate* vq, break; case VAL_CLASS_NAMEERROR: + rcode = (int)FLAGS_GET_RCODE(vq->orig_msg->rep->flags); verbose(VERB_ALGO, "Validating a nxdomain response"); validate_nameerror_response(qstate->env, ve, - &vq->qchase, vq->chase_reply, vq->key_entry); + &vq->qchase, vq->chase_reply, vq->key_entry, &rcode); verbose(VERB_DETAIL, "validate(nxdomain): %s", sec_status_to_string( vq->chase_reply->security)); + FLAGS_SET_RCODE(vq->orig_msg->rep->flags, rcode); + FLAGS_SET_RCODE(vq->chase_reply->flags, rcode); break; case VAL_CLASS_CNAME: @@ -2344,12 +2361,13 @@ ds_response_to_ke(struct module_qstate* qstate, struct val_qstate* vq, char* reason = NULL; enum val_classification subtype; if(rcode != LDNS_RCODE_NOERROR) { - char* rc = ldns_pkt_rcode2str(rcode); + char rc[16]; + rc[0]=0; + (void)sldns_wire2str_rcode_buf(rcode, rc, sizeof(rc)); /* errors here pretty much break validation */ verbose(VERB_DETAIL, "DS response was error, thus bogus"); errinf(qstate, rc); errinf(qstate, "no DS"); - free(rc); goto return_bogus; } @@ -2398,7 +2416,7 @@ ds_response_to_ke(struct module_qstate* qstate, struct val_qstate* vq, subtype == VAL_CLASS_NAMEERROR) { /* NODATA means that the qname exists, but that there was * no DS. This is a pretty normal case. */ - uint32_t proof_ttl = 0; + time_t proof_ttl = 0; enum sec_status sec; /* make sure there are NSECs or NSEC3s with signatures */ @@ -2521,10 +2539,11 @@ ds_response_to_ke(struct module_qstate* qstate, struct val_qstate* vq, "DS response, thus bogus."); errinf(qstate, "no DS and"); if(FLAGS_GET_RCODE(msg->rep->flags) != LDNS_RCODE_NOERROR) { - char* rc = ldns_pkt_rcode2str( - FLAGS_GET_RCODE(msg->rep->flags)); + char rc[16]; + rc[0]=0; + (void)sldns_wire2str_rcode_buf((int)FLAGS_GET_RCODE( + msg->rep->flags), rc, sizeof(rc)); errinf(qstate, rc); - free(rc); } else errinf(qstate, val_classification_to_string(subtype)); errinf(qstate, "message fails to prove that"); goto return_bogus; diff --git a/contrib/unbound/validator/validator.h b/contrib/unbound/validator/validator.h index 1a29c161b9f..20f806adab3 100644 --- a/contrib/unbound/validator/validator.h +++ b/contrib/unbound/validator/validator.h @@ -21,16 +21,16 @@ * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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. + * "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 COPYRIGHT + * HOLDER 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. */ /** diff --git a/contrib/wpa/src/utils/os_unix.c b/contrib/wpa/src/utils/os_unix.c index 23a93becea4..fea511bdff3 100644 --- a/contrib/wpa/src/utils/os_unix.c +++ b/contrib/wpa/src/utils/os_unix.c @@ -153,16 +153,40 @@ static int os_daemon(int nochdir, int noclose) #endif /* __APPLE__ */ +#ifdef __FreeBSD__ +#include +#include +#include +#endif /* __FreeBSD__ */ + int os_daemonize(const char *pid_file) { #if defined(__uClinux__) || defined(__sun__) return -1; #else /* defined(__uClinux__) || defined(__sun__) */ +#ifdef __FreeBSD__ + pid_t otherpid; + struct pidfh *pfh; + + pfh = pidfile_open(pid_file, 0600, &otherpid); + if (pfh == NULL) { + if (errno == EEXIST) { + errx(1, "Daemon already running, pid: %jd.", + (intmax_t)otherpid); + } + warn("Cannot open or create pidfile."); + } +#endif /* __FreeBSD__ */ + if (os_daemon(0, 0)) { perror("daemon"); +#ifdef __FreeBSD__ + pidfile_remove(pfh); +#endif /* __FreeBSD__ */ return -1; } +#ifndef __FreeBSD__ if (pid_file) { FILE *f = fopen(pid_file, "w"); if (f) { @@ -170,6 +194,9 @@ int os_daemonize(const char *pid_file) fclose(f); } } +#else /* __FreeBSD__ */ + pidfile_write(pfh); +#endif /* __FreeBSD__ */ return -0; #endif /* defined(__uClinux__) || defined(__sun__) */ diff --git a/crypto/openssh/sshd_config b/crypto/openssh/sshd_config index 202da5f5ae8..d5588e2b84c 100644 --- a/crypto/openssh/sshd_config +++ b/crypto/openssh/sshd_config @@ -128,7 +128,7 @@ # override default of no subsystems Subsystem sftp /usr/libexec/sftp-server -# Disable HPN tuning improvements. +# Change to yes to disable HPN tuning improvements. #HPNDisabled no # Buffer size for HPN to non-HPN connections. diff --git a/crypto/openssl/ACKNOWLEDGMENTS b/crypto/openssl/ACKNOWLEDGMENTS index fb6dd912c43..59c6f01f97f 100644 --- a/crypto/openssl/ACKNOWLEDGMENTS +++ b/crypto/openssl/ACKNOWLEDGMENTS @@ -10,13 +10,18 @@ OpenSSL project. We would like to identify and thank the following such sponsors for their past or current significant support of the OpenSSL project: +Major support: + + Qualys http://www.qualys.com/ + Very significant support: - OpenGear: www.opengear.com + OpenGear: http://www.opengear.com/ Significant support: - PSW Group: www.psw.net + PSW Group: http://www.psw.net/ + Acano Ltd. http://acano.com/ Please note that we ask permission to identify sponsors and that some sponsors we consider eligible for inclusion here have requested to remain anonymous. diff --git a/crypto/openssl/CHANGES b/crypto/openssl/CHANGES index 4fcfd1d4be4..d161ecaf295 100644 --- a/crypto/openssl/CHANGES +++ b/crypto/openssl/CHANGES @@ -2,6 +2,50 @@ OpenSSL CHANGES _______________ + Changes between 1.0.1g and 1.0.1h [5 Jun 2014] + + *) Fix for SSL/TLS MITM flaw. An attacker using a carefully crafted + handshake can force the use of weak keying material in OpenSSL + SSL/TLS clients and servers. + + Thanks to KIKUCHI Masashi (Lepidum Co. Ltd.) for discovering and + researching this issue. (CVE-2014-0224) + [KIKUCHI Masashi, Steve Henson] + + *) Fix DTLS recursion flaw. By sending an invalid DTLS handshake to an + OpenSSL DTLS client the code can be made to recurse eventually crashing + in a DoS attack. + + Thanks to Imre Rad (Search-Lab Ltd.) for discovering this issue. + (CVE-2014-0221) + [Imre Rad, Steve Henson] + + *) Fix DTLS invalid fragment vulnerability. A buffer overrun attack can + be triggered by sending invalid DTLS fragments to an OpenSSL DTLS + client or server. This is potentially exploitable to run arbitrary + code on a vulnerable client or server. + + Thanks to Jri Aedla for reporting this issue. (CVE-2014-0195) + [Jri Aedla, Steve Henson] + + *) Fix bug in TLS code where clients enable anonymous ECDH ciphersuites + are subject to a denial of service attack. + + Thanks to Felix Grbert and Ivan Fratric at Google for discovering + this issue. (CVE-2014-3470) + [Felix Grbert, Ivan Fratric, Steve Henson] + + *) Harmonize version and its documentation. -f flag is used to display + compilation flags. + [mancha ] + + *) Fix eckey_priv_encode so it immediately returns an error upon a failure + in i2d_ECPrivateKey. + [mancha ] + + *) Fix some double frees. These are not thought to be exploitable. + [mancha ] + Changes between 1.0.1f and 1.0.1g [7 Apr 2014] *) A missing bounds check in the handling of the TLS heartbeat extension diff --git a/crypto/openssl/Makefile b/crypto/openssl/Makefile index 4a40b701d90..f5e7823f85c 100644 --- a/crypto/openssl/Makefile +++ b/crypto/openssl/Makefile @@ -4,7 +4,7 @@ ## Makefile for OpenSSL ## -VERSION=1.0.1g +VERSION=1.0.1h MAJOR=1 MINOR=0.1 SHLIB_VERSION_NUMBER=1.0.0 diff --git a/crypto/openssl/NEWS b/crypto/openssl/NEWS index ed486d146d9..d0620414ab0 100644 --- a/crypto/openssl/NEWS +++ b/crypto/openssl/NEWS @@ -5,6 +5,14 @@ This file gives a brief overview of the major changes between each OpenSSL release. For more details please read the CHANGES file. + Major changes between OpenSSL 1.0.1g and OpenSSL 1.0.1h [5 Jun 2014] + + o Fix for CVE-2014-0224 + o Fix for CVE-2014-0221 + o Fix for CVE-2014-0195 + o Fix for CVE-2014-3470 + o Fix for CVE-2010-5298 + Major changes between OpenSSL 1.0.1f and OpenSSL 1.0.1g [7 Apr 2014] o Fix for CVE-2014-0160 diff --git a/crypto/openssl/README b/crypto/openssl/README index 10b74d19d24..95c5cd24780 100644 --- a/crypto/openssl/README +++ b/crypto/openssl/README @@ -1,5 +1,5 @@ - OpenSSL 1.0.1g 7 Apr 2014 + OpenSSL 1.0.1h 5 Jun 2014 Copyright (c) 1998-2011 The OpenSSL Project Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson diff --git a/crypto/openssl/apps/enc.c b/crypto/openssl/apps/enc.c index 719acc32505..19ea3df9409 100644 --- a/crypto/openssl/apps/enc.c +++ b/crypto/openssl/apps/enc.c @@ -331,6 +331,12 @@ int MAIN(int argc, char **argv) setup_engine(bio_err, engine, 0); #endif + if (cipher && EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER) + { + BIO_printf(bio_err, "AEAD ciphers not supported by the enc utility\n"); + goto end; + } + if (md && (dgst=EVP_get_digestbyname(md)) == NULL) { BIO_printf(bio_err,"%s is an unsupported message digest type\n",md); diff --git a/crypto/openssl/apps/ocsp.c b/crypto/openssl/apps/ocsp.c index 83c5a767005..767f12c621c 100644 --- a/crypto/openssl/apps/ocsp.c +++ b/crypto/openssl/apps/ocsp.c @@ -127,6 +127,7 @@ int MAIN(int argc, char **argv) ENGINE *e = NULL; char **args; char *host = NULL, *port = NULL, *path = "/"; + char *thost = NULL, *tport = NULL, *tpath = NULL; char *reqin = NULL, *respin = NULL; char *reqout = NULL, *respout = NULL; char *signfile = NULL, *keyfile = NULL; @@ -204,6 +205,12 @@ int MAIN(int argc, char **argv) } else if (!strcmp(*args, "-url")) { + if (thost) + OPENSSL_free(thost); + if (tport) + OPENSSL_free(tport); + if (tpath) + OPENSSL_free(tpath); if (args[1]) { args++; @@ -212,6 +219,9 @@ int MAIN(int argc, char **argv) BIO_printf(bio_err, "Error parsing URL\n"); badarg = 1; } + thost = host; + tport = port; + tpath = path; } else badarg = 1; } @@ -920,12 +930,12 @@ int MAIN(int argc, char **argv) sk_X509_pop_free(verify_other, X509_free); sk_CONF_VALUE_pop_free(headers, X509V3_conf_free); - if (use_ssl != -1) - { - OPENSSL_free(host); - OPENSSL_free(port); - OPENSSL_free(path); - } + if (thost) + OPENSSL_free(thost); + if (tport) + OPENSSL_free(tport); + if (tpath) + OPENSSL_free(tpath); OPENSSL_EXIT(ret); } diff --git a/crypto/openssl/apps/req.c b/crypto/openssl/apps/req.c index 5e034a85e80..d41385d7063 100644 --- a/crypto/openssl/apps/req.c +++ b/crypto/openssl/apps/req.c @@ -1489,7 +1489,13 @@ static int add_DN_object(X509_NAME *n, char *text, const char *def, char *value, #ifdef CHARSET_EBCDIC ebcdic2ascii(buf, buf, i); #endif - if(!req_check_len(i, n_min, n_max)) goto start; + if(!req_check_len(i, n_min, n_max)) + { + if (batch || value) + return 0; + goto start; + } + if (!X509_NAME_add_entry_by_NID(n,nid, chtype, (unsigned char *) buf, -1,-1,mval)) goto err; ret=1; @@ -1548,7 +1554,12 @@ static int add_attribute_object(X509_REQ *req, char *text, const char *def, #ifdef CHARSET_EBCDIC ebcdic2ascii(buf, buf, i); #endif - if(!req_check_len(i, n_min, n_max)) goto start; + if(!req_check_len(i, n_min, n_max)) + { + if (batch || value) + return 0; + goto start; + } if(!X509_REQ_add1_attr_by_NID(req, nid, chtype, (unsigned char *)buf, -1)) { diff --git a/crypto/openssl/apps/s_cb.c b/crypto/openssl/apps/s_cb.c index 84c3b447c29..146a9607951 100644 --- a/crypto/openssl/apps/s_cb.c +++ b/crypto/openssl/apps/s_cb.c @@ -747,6 +747,10 @@ void MS_CALLBACK tlsext_cb(SSL *s, int client_server, int type, break; #endif + case TLSEXT_TYPE_padding: + extname = "TLS padding"; + break; + default: extname = "unknown"; break; diff --git a/crypto/openssl/apps/s_socket.c b/crypto/openssl/apps/s_socket.c index 380efdb1b97..94eb40f3ffc 100644 --- a/crypto/openssl/apps/s_socket.c +++ b/crypto/openssl/apps/s_socket.c @@ -274,7 +274,7 @@ static int init_client_ip(int *sock, unsigned char ip[4], int port, int type) { i=0; i=setsockopt(s,SOL_SOCKET,SO_KEEPALIVE,(char *)&i,sizeof(i)); - if (i < 0) { perror("keepalive"); return(0); } + if (i < 0) { closesocket(s); perror("keepalive"); return(0); } } #endif @@ -450,6 +450,7 @@ static int do_accept(int acc_sock, int *sock, char **host) if ((*host=(char *)OPENSSL_malloc(strlen(h1->h_name)+1)) == NULL) { perror("OPENSSL_malloc"); + closesocket(ret); return(0); } BUF_strlcpy(*host,h1->h_name,strlen(h1->h_name)+1); @@ -458,11 +459,13 @@ static int do_accept(int acc_sock, int *sock, char **host) if (h2 == NULL) { BIO_printf(bio_err,"gethostbyname failure\n"); + closesocket(ret); return(0); } if (h2->h_addrtype != AF_INET) { BIO_printf(bio_err,"gethostbyname addr is not AF_INET\n"); + closesocket(ret); return(0); } } diff --git a/crypto/openssl/apps/smime.c b/crypto/openssl/apps/smime.c index c583f8a0e16..d1fe32d31b3 100644 --- a/crypto/openssl/apps/smime.c +++ b/crypto/openssl/apps/smime.c @@ -541,8 +541,8 @@ int MAIN(int argc, char **argv) { if (!cipher) { -#ifndef OPENSSL_NO_RC2 - cipher = EVP_rc2_40_cbc(); +#ifndef OPENSSL_NO_DES + cipher = EVP_des_ede3_cbc(); #else BIO_printf(bio_err, "No cipher selected\n"); goto end; diff --git a/crypto/openssl/crypto/asn1/a_strnid.c b/crypto/openssl/crypto/asn1/a_strnid.c index 2fc48c1551a..2afd5a41368 100644 --- a/crypto/openssl/crypto/asn1/a_strnid.c +++ b/crypto/openssl/crypto/asn1/a_strnid.c @@ -74,7 +74,7 @@ static int sk_table_cmp(const ASN1_STRING_TABLE * const *a, * certain software (e.g. Netscape) has problems with them. */ -static unsigned long global_mask = 0xFFFFFFFFL; +static unsigned long global_mask = B_ASN1_UTF8STRING; void ASN1_STRING_set_default_mask(unsigned long mask) { diff --git a/crypto/openssl/crypto/bio/bss_dgram.c b/crypto/openssl/crypto/bio/bss_dgram.c index 54c012c47d7..d9967e72726 100644 --- a/crypto/openssl/crypto/bio/bss_dgram.c +++ b/crypto/openssl/crypto/bio/bss_dgram.c @@ -1333,7 +1333,7 @@ static long dgram_sctp_ctrl(BIO *b, int cmd, long num, void *ptr) bio_dgram_sctp_data *data = NULL; socklen_t sockopt_len = 0; struct sctp_authkeyid authkeyid; - struct sctp_authkey *authkey; + struct sctp_authkey *authkey = NULL; data = (bio_dgram_sctp_data *)b->ptr; @@ -1388,6 +1388,11 @@ static long dgram_sctp_ctrl(BIO *b, int cmd, long num, void *ptr) /* Add new key */ sockopt_len = sizeof(struct sctp_authkey) + 64 * sizeof(uint8_t); authkey = OPENSSL_malloc(sockopt_len); + if (authkey == NULL) + { + ret = -1; + break; + } memset(authkey, 0x00, sockopt_len); authkey->sca_keynumber = authkeyid.scact_keynumber + 1; #ifndef __FreeBSD__ @@ -1399,6 +1404,8 @@ static long dgram_sctp_ctrl(BIO *b, int cmd, long num, void *ptr) memcpy(&authkey->sca_key[0], ptr, 64 * sizeof(uint8_t)); ret = setsockopt(b->num, IPPROTO_SCTP, SCTP_AUTH_KEY, authkey, sockopt_len); + OPENSSL_free(authkey); + authkey = NULL; if (ret < 0) break; /* Reset active key */ diff --git a/crypto/openssl/crypto/bn/bn_mont.c b/crypto/openssl/crypto/bn/bn_mont.c index 427b5cf4df9..ee8532c7dc3 100644 --- a/crypto/openssl/crypto/bn/bn_mont.c +++ b/crypto/openssl/crypto/bn/bn_mont.c @@ -478,32 +478,38 @@ BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from) BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock, const BIGNUM *mod, BN_CTX *ctx) { - int got_write_lock = 0; BN_MONT_CTX *ret; CRYPTO_r_lock(lock); - if (!*pmont) - { - CRYPTO_r_unlock(lock); - CRYPTO_w_lock(lock); - got_write_lock = 1; - - if (!*pmont) - { - ret = BN_MONT_CTX_new(); - if (ret && !BN_MONT_CTX_set(ret, mod, ctx)) - BN_MONT_CTX_free(ret); - else - *pmont = ret; - } - } - ret = *pmont; - - if (got_write_lock) - CRYPTO_w_unlock(lock); + CRYPTO_r_unlock(lock); + if (ret) + return ret; + + /* We don't want to serialise globally while doing our lazy-init math in + * BN_MONT_CTX_set. That punishes threads that are doing independent + * things. Instead, punish the case where more than one thread tries to + * lazy-init the same 'pmont', by having each do the lazy-init math work + * independently and only use the one from the thread that wins the race + * (the losers throw away the work they've done). */ + ret = BN_MONT_CTX_new(); + if (!ret) + return NULL; + if (!BN_MONT_CTX_set(ret, mod, ctx)) + { + BN_MONT_CTX_free(ret); + return NULL; + } + + /* The locked compare-and-set, after the local work is done. */ + CRYPTO_w_lock(lock); + if (*pmont) + { + BN_MONT_CTX_free(ret); + ret = *pmont; + } else - CRYPTO_r_unlock(lock); - + *pmont = ret; + CRYPTO_w_unlock(lock); return ret; } diff --git a/crypto/openssl/crypto/cms/cms_env.c b/crypto/openssl/crypto/cms/cms_env.c index be20b1c024c..add00bf99cf 100644 --- a/crypto/openssl/crypto/cms/cms_env.c +++ b/crypto/openssl/crypto/cms/cms_env.c @@ -185,6 +185,8 @@ CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms, if (flags & CMS_USE_KEYID) { ktri->version = 2; + if (env->version < 2) + env->version = 2; type = CMS_RECIPINFO_KEYIDENTIFIER; } else diff --git a/crypto/openssl/crypto/cms/cms_sd.c b/crypto/openssl/crypto/cms/cms_sd.c index 77fbd135967..51dd33a1c32 100644 --- a/crypto/openssl/crypto/cms/cms_sd.c +++ b/crypto/openssl/crypto/cms/cms_sd.c @@ -158,8 +158,8 @@ static void cms_sd_set_version(CMS_SignedData *sd) if (sd->version < 3) sd->version = 3; } - else - sd->version = 1; + else if (si->version < 1) + si->version = 1; } if (sd->version < 1) diff --git a/crypto/openssl/crypto/cms/cms_smime.c b/crypto/openssl/crypto/cms/cms_smime.c index 8c56e3a8520..1af9f3a60f8 100644 --- a/crypto/openssl/crypto/cms/cms_smime.c +++ b/crypto/openssl/crypto/cms/cms_smime.c @@ -611,7 +611,7 @@ int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert) STACK_OF(CMS_RecipientInfo) *ris; CMS_RecipientInfo *ri; int i, r; - int debug = 0; + int debug = 0, ri_match = 0; ris = CMS_get0_RecipientInfos(cms); if (ris) debug = cms->d.envelopedData->encryptedContentInfo->debug; @@ -620,6 +620,7 @@ int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert) ri = sk_CMS_RecipientInfo_value(ris, i); if (CMS_RecipientInfo_type(ri) != CMS_RECIPINFO_TRANS) continue; + ri_match = 1; /* If we have a cert try matching RecipientInfo * otherwise try them all. */ @@ -655,7 +656,7 @@ int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert) } } /* If no cert and not debugging always return success */ - if (!cert && !debug) + if (ri_match && !cert && !debug) { ERR_clear_error(); return 1; diff --git a/crypto/openssl/crypto/dso/dso_dlfcn.c b/crypto/openssl/crypto/dso/dso_dlfcn.c index 5f2254806ca..4a56aace0e3 100644 --- a/crypto/openssl/crypto/dso/dso_dlfcn.c +++ b/crypto/openssl/crypto/dso/dso_dlfcn.c @@ -464,7 +464,7 @@ static int dlfcn_pathbyaddr(void *addr,char *path,int sz) return len; } - ERR_add_error_data(4, "dlfcn_pathbyaddr(): ", dlerror()); + ERR_add_error_data(2, "dlfcn_pathbyaddr(): ", dlerror()); #endif return -1; } diff --git a/crypto/openssl/crypto/ec/ec_ameth.c b/crypto/openssl/crypto/ec/ec_ameth.c index 0ce4524076f..f715a238a6f 100644 --- a/crypto/openssl/crypto/ec/ec_ameth.c +++ b/crypto/openssl/crypto/ec/ec_ameth.c @@ -352,6 +352,7 @@ static int eckey_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey) EC_KEY_set_enc_flags(ec_key, old_flags); OPENSSL_free(ep); ECerr(EC_F_ECKEY_PRIV_ENCODE, ERR_R_EC_LIB); + return 0; } /* restore old encoding flags */ EC_KEY_set_enc_flags(ec_key, old_flags); diff --git a/crypto/openssl/crypto/ec/ec_asn1.c b/crypto/openssl/crypto/ec/ec_asn1.c index 145807b611a..e94f34e11b7 100644 --- a/crypto/openssl/crypto/ec/ec_asn1.c +++ b/crypto/openssl/crypto/ec/ec_asn1.c @@ -1435,8 +1435,11 @@ int i2o_ECPublicKey(EC_KEY *a, unsigned char **out) *out, buf_len, NULL)) { ECerr(EC_F_I2O_ECPUBLICKEY, ERR_R_EC_LIB); - OPENSSL_free(*out); - *out = NULL; + if (new_buffer) + { + OPENSSL_free(*out); + *out = NULL; + } return 0; } if (!new_buffer) diff --git a/crypto/openssl/crypto/ec/ec_lcl.h b/crypto/openssl/crypto/ec/ec_lcl.h index da7967df38a..b0d48b6b5cc 100644 --- a/crypto/openssl/crypto/ec/ec_lcl.h +++ b/crypto/openssl/crypto/ec/ec_lcl.h @@ -404,7 +404,7 @@ int ec_GF2m_simple_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, int ec_GF2m_precompute_mult(EC_GROUP *group, BN_CTX *ctx); int ec_GF2m_have_precompute_mult(const EC_GROUP *group); -#ifndef OPENSSL_EC_NISTP_64_GCC_128 +#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 /* method functions in ecp_nistp224.c */ int ec_GFp_nistp224_group_init(EC_GROUP *group); int ec_GFp_nistp224_group_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *n, BN_CTX *); diff --git a/crypto/openssl/crypto/evp/bio_b64.c b/crypto/openssl/crypto/evp/bio_b64.c index ac6d441aadb..16863fe23f0 100644 --- a/crypto/openssl/crypto/evp/bio_b64.c +++ b/crypto/openssl/crypto/evp/bio_b64.c @@ -226,6 +226,7 @@ static int b64_read(BIO *b, char *out, int outl) else if (ctx->start) { q=p=(unsigned char *)ctx->tmp; + num = 0; for (j=0; j v) { rv=-1; goto end; } ret+=(v-eof); } else diff --git a/crypto/openssl/crypto/opensslv.h b/crypto/openssl/crypto/opensslv.h index 5f71de1fbd3..f998f988e3f 100644 --- a/crypto/openssl/crypto/opensslv.h +++ b/crypto/openssl/crypto/opensslv.h @@ -25,11 +25,11 @@ * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for * major minor fix final patch/beta) */ -#define OPENSSL_VERSION_NUMBER 0x1000107fL +#define OPENSSL_VERSION_NUMBER 0x1000108fL #ifdef OPENSSL_FIPS -#define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1g-fips 7 Apr 2014" +#define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1h-fips 5 Jun 2014" #else -#define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1g-freebsd 7 Apr 2014" +#define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1h-freebsd 5 Jun 2014" #endif #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT diff --git a/crypto/openssl/crypto/pkcs12/p12_crt.c b/crypto/openssl/crypto/pkcs12/p12_crt.c index a34915d02d1..35e8a4a8d4b 100644 --- a/crypto/openssl/crypto/pkcs12/p12_crt.c +++ b/crypto/openssl/crypto/pkcs12/p12_crt.c @@ -96,7 +96,11 @@ PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert, nid_cert = NID_pbe_WithSHA1And3_Key_TripleDES_CBC; else #endif +#ifdef OPENSSL_NO_RC2 + nid_cert = NID_pbe_WithSHA1And3_Key_TripleDES_CBC; +#else nid_cert = NID_pbe_WithSHA1And40BitRC2_CBC; +#endif } if (!nid_key) nid_key = NID_pbe_WithSHA1And3_Key_TripleDES_CBC; @@ -286,7 +290,11 @@ int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags, free_safes = 0; if (nid_safe == 0) +#ifdef OPENSSL_NO_RC2 + nid_safe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC; +#else nid_safe = NID_pbe_WithSHA1And40BitRC2_CBC; +#endif if (nid_safe == -1) p7 = PKCS12_pack_p7data(bags); diff --git a/crypto/openssl/crypto/pkcs12/p12_kiss.c b/crypto/openssl/crypto/pkcs12/p12_kiss.c index 206b1b0b18a..c9b7ab61d1b 100644 --- a/crypto/openssl/crypto/pkcs12/p12_kiss.c +++ b/crypto/openssl/crypto/pkcs12/p12_kiss.c @@ -269,7 +269,7 @@ static int parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen, int len, r; unsigned char *data; len = ASN1_STRING_to_UTF8(&data, fname); - if(len > 0) { + if(len >= 0) { r = X509_alias_set1(x509, data, len); OPENSSL_free(data); if (!r) diff --git a/crypto/openssl/crypto/pkcs7/pk7_doit.c b/crypto/openssl/crypto/pkcs7/pk7_doit.c index 77fda3b82a0..d91aa116a99 100644 --- a/crypto/openssl/crypto/pkcs7/pk7_doit.c +++ b/crypto/openssl/crypto/pkcs7/pk7_doit.c @@ -440,6 +440,11 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) { case NID_pkcs7_signed: data_body=PKCS7_get_octet_string(p7->d.sign->contents); + if (!PKCS7_is_detached(p7) && data_body == NULL) + { + PKCS7err(PKCS7_F_PKCS7_DATADECODE,PKCS7_R_INVALID_SIGNED_DATA_TYPE); + goto err; + } md_sk=p7->d.sign->md_algs; break; case NID_pkcs7_signedAndEnveloped: @@ -928,6 +933,7 @@ int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si) if (EVP_DigestSignUpdate(&mctx,abuf,alen) <= 0) goto err; OPENSSL_free(abuf); + abuf = NULL; if (EVP_DigestSignFinal(&mctx, NULL, &siglen) <= 0) goto err; abuf = OPENSSL_malloc(siglen); diff --git a/crypto/openssl/crypto/pkcs7/pkcs7.h b/crypto/openssl/crypto/pkcs7/pkcs7.h index e4d443193c4..04f60379fb6 100644 --- a/crypto/openssl/crypto/pkcs7/pkcs7.h +++ b/crypto/openssl/crypto/pkcs7/pkcs7.h @@ -453,6 +453,7 @@ void ERR_load_PKCS7_strings(void); #define PKCS7_R_ERROR_SETTING_CIPHER 121 #define PKCS7_R_INVALID_MIME_TYPE 131 #define PKCS7_R_INVALID_NULL_POINTER 143 +#define PKCS7_R_INVALID_SIGNED_DATA_TYPE 155 #define PKCS7_R_MIME_NO_CONTENT_TYPE 132 #define PKCS7_R_MIME_PARSE_ERROR 133 #define PKCS7_R_MIME_SIG_PARSE_ERROR 134 diff --git a/crypto/openssl/crypto/pkcs7/pkcs7err.c b/crypto/openssl/crypto/pkcs7/pkcs7err.c index d0af32a265d..f3db08e007a 100644 --- a/crypto/openssl/crypto/pkcs7/pkcs7err.c +++ b/crypto/openssl/crypto/pkcs7/pkcs7err.c @@ -1,6 +1,6 @@ /* crypto/pkcs7/pkcs7err.c */ /* ==================================================================== - * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. + * Copyright (c) 1999-2014 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -130,6 +130,7 @@ static ERR_STRING_DATA PKCS7_str_reasons[]= {ERR_REASON(PKCS7_R_ERROR_SETTING_CIPHER),"error setting cipher"}, {ERR_REASON(PKCS7_R_INVALID_MIME_TYPE) ,"invalid mime type"}, {ERR_REASON(PKCS7_R_INVALID_NULL_POINTER),"invalid null pointer"}, +{ERR_REASON(PKCS7_R_INVALID_SIGNED_DATA_TYPE),"invalid signed data type"}, {ERR_REASON(PKCS7_R_MIME_NO_CONTENT_TYPE),"mime no content type"}, {ERR_REASON(PKCS7_R_MIME_PARSE_ERROR) ,"mime parse error"}, {ERR_REASON(PKCS7_R_MIME_SIG_PARSE_ERROR),"mime sig parse error"}, diff --git a/crypto/openssl/crypto/rsa/rsa_ameth.c b/crypto/openssl/crypto/rsa/rsa_ameth.c index 5a2062f903a..4c8ecd9233e 100644 --- a/crypto/openssl/crypto/rsa/rsa_ameth.c +++ b/crypto/openssl/crypto/rsa/rsa_ameth.c @@ -358,7 +358,7 @@ static int rsa_pss_param_print(BIO *bp, RSA_PSS_PARAMS *pss, if (i2a_ASN1_INTEGER(bp, pss->saltLength) <= 0) goto err; } - else if (BIO_puts(bp, "0x14 (default)") <= 0) + else if (BIO_puts(bp, "14 (default)") <= 0) goto err; BIO_puts(bp, "\n"); diff --git a/crypto/openssl/crypto/srp/srp_vfy.c b/crypto/openssl/crypto/srp/srp_vfy.c index 4a3d13edf6c..fdca19ff7c6 100644 --- a/crypto/openssl/crypto/srp/srp_vfy.c +++ b/crypto/openssl/crypto/srp/srp_vfy.c @@ -93,6 +93,9 @@ static int t_fromb64(unsigned char *a, const char *src) else a[i] = loc - b64table; ++i; } + /* if nothing valid to process we have a zero length response */ + if (i == 0) + return 0; size = i; i = size - 1; j = size; diff --git a/crypto/openssl/crypto/ts/ts_rsp_verify.c b/crypto/openssl/crypto/ts/ts_rsp_verify.c index afe16afbe45..b7d170afac0 100644 --- a/crypto/openssl/crypto/ts/ts_rsp_verify.c +++ b/crypto/openssl/crypto/ts/ts_rsp_verify.c @@ -629,6 +629,7 @@ static int TS_compute_imprint(BIO *data, TS_TST_INFO *tst_info, X509_ALGOR_free(*md_alg); OPENSSL_free(*imprint); *imprint_len = 0; + *imprint = NULL; return 0; } diff --git a/crypto/openssl/crypto/x509v3/v3_purp.c b/crypto/openssl/crypto/x509v3/v3_purp.c index ad688657e01..f59bfc1844c 100644 --- a/crypto/openssl/crypto/x509v3/v3_purp.c +++ b/crypto/openssl/crypto/x509v3/v3_purp.c @@ -389,8 +389,8 @@ static void x509v3_cache_extensions(X509 *x) /* Handle proxy certificates */ if((pci=X509_get_ext_d2i(x, NID_proxyCertInfo, NULL, NULL))) { if (x->ex_flags & EXFLAG_CA - || X509_get_ext_by_NID(x, NID_subject_alt_name, 0) >= 0 - || X509_get_ext_by_NID(x, NID_issuer_alt_name, 0) >= 0) { + || X509_get_ext_by_NID(x, NID_subject_alt_name, -1) >= 0 + || X509_get_ext_by_NID(x, NID_issuer_alt_name, -1) >= 0) { x->ex_flags |= EXFLAG_INVALID; } if (pci->pcPathLengthConstraint) { @@ -670,7 +670,7 @@ static int check_purpose_timestamp_sign(const X509_PURPOSE *xp, const X509 *x, return 0; /* Extended Key Usage MUST be critical */ - i_ext = X509_get_ext_by_NID((X509 *) x, NID_ext_key_usage, 0); + i_ext = X509_get_ext_by_NID((X509 *) x, NID_ext_key_usage, -1); if (i_ext >= 0) { X509_EXTENSION *ext = X509_get_ext((X509 *) x, i_ext); diff --git a/crypto/openssl/doc/apps/cms.pod b/crypto/openssl/doc/apps/cms.pod index ce1f05648d5..a76b3e0fd1c 100644 --- a/crypto/openssl/doc/apps/cms.pod +++ b/crypto/openssl/doc/apps/cms.pod @@ -90,6 +90,11 @@ decrypt mail using the supplied certificate and private key. Expects an encrypted mail message in MIME format for the input file. The decrypted mail is written to the output file. +=item B<-debug_decrypt> + +this option sets the B flag. This option should be used +with caution: see the notes section below. + =item B<-sign> sign mail using the supplied certificate and private key. Input file is @@ -446,6 +451,16 @@ Streaming is always used for the B<-sign> operation with detached data but since the content is no longer part of the CMS structure the encoding remains DER. +If the B<-decrypt> option is used without a recipient certificate then an +attempt is made to locate the recipient by trying each potential recipient +in turn using the supplied private key. To thwart the MMA attack +(Bleichenbacher's attack on PKCS #1 v1.5 RSA padding) all recipients are +tried whether they succeed or not and if no recipients match the message +is "decrypted" using a random key which will typically output garbage. +The B<-debug_decrypt> option can be used to disable the MMA attack protection +and return an error if no recipient can be found: this option should be used +with caution. For a fuller description see L). + =head1 EXIT CODES =over 4 diff --git a/crypto/openssl/doc/apps/enc.pod b/crypto/openssl/doc/apps/enc.pod index 3dee4ed9923..41791ad6713 100644 --- a/crypto/openssl/doc/apps/enc.pod +++ b/crypto/openssl/doc/apps/enc.pod @@ -215,6 +215,10 @@ unsupported options (for example B) includes a list of ciphers, supported by your versesion of OpenSSL, including ones provided by configured engines. +The B program does not support authenticated encryption modes +like CCM and GCM. The utility does not store or retrieve the +authentication tag. + base64 Base 64 diff --git a/crypto/openssl/doc/apps/s_server.pod b/crypto/openssl/doc/apps/s_server.pod index 6758ba30801..f9b9ca5326d 100644 --- a/crypto/openssl/doc/apps/s_server.pod +++ b/crypto/openssl/doc/apps/s_server.pod @@ -44,6 +44,7 @@ B B [B<-no_ssl3>] [B<-no_tls1>] [B<-no_dhe>] +[B<-no_ecdhe>] [B<-bugs>] [B<-hack>] [B<-www>] @@ -131,6 +132,11 @@ a static set of parameters hard coded into the s_server program will be used. if this option is set then no DH parameters will be loaded effectively disabling the ephemeral DH cipher suites. +=item B<-no_ecdhe> + +if this option is set then no ECDH parameters will be loaded effectively +disabling the ephemeral ECDH cipher suites. + =item B<-no_tmp_rsa> certain export cipher suites sometimes use a temporary RSA key, this option diff --git a/crypto/openssl/doc/apps/smime.pod b/crypto/openssl/doc/apps/smime.pod index 3aa6e848afd..d39a59a90d8 100644 --- a/crypto/openssl/doc/apps/smime.pod +++ b/crypto/openssl/doc/apps/smime.pod @@ -159,7 +159,7 @@ EVP_get_cipherbyname() function) can also be used preceded by a dash, for example B<-aes_128_cbc>. See L|enc(1)> for list of ciphers supported by your version of OpenSSL. -If not specified 40 bit RC2 is used. Only used with B<-encrypt>. +If not specified triple DES is used. Only used with B<-encrypt>. =item B<-nointern> diff --git a/crypto/openssl/doc/apps/verify.pod b/crypto/openssl/doc/apps/verify.pod index da683004bd2..f35d4029506 100644 --- a/crypto/openssl/doc/apps/verify.pod +++ b/crypto/openssl/doc/apps/verify.pod @@ -25,6 +25,7 @@ B B [B<-untrusted file>] [B<-help>] [B<-issuer_checks>] +[B<-attime timestamp>] [B<-verbose>] [B<->] [certificates] @@ -80,6 +81,12 @@ rejected. The presence of rejection messages does not itself imply that anything is wrong; during the normal verification process, several rejections may take place. +=item B<-attime timestamp> + +Perform validation checks using time specified by B and not +current system time. B is the number of seconds since +01.01.1970 (UNIX time). + =item B<-policy arg> Enable policy processing and add B to the user-initial-policy-set (see @@ -386,7 +393,7 @@ an application specific error. Unused. =head1 BUGS -Although the issuer checks are a considerably improvement over the old technique they still +Although the issuer checks are a considerable improvement over the old technique they still suffer from limitations in the underlying X509_LOOKUP API. One consequence of this is that trusted certificates with matching subject name must either appear in a file (as specified by the B<-CAfile> option) or a directory (as specified by B<-CApath>. If they occur in both then only diff --git a/crypto/openssl/doc/apps/version.pod b/crypto/openssl/doc/apps/version.pod index e00324c446c..58f543bc3e6 100644 --- a/crypto/openssl/doc/apps/version.pod +++ b/crypto/openssl/doc/apps/version.pod @@ -13,6 +13,7 @@ B [B<-o>] [B<-f>] [B<-p>] +[B<-d>] =head1 DESCRIPTION @@ -38,7 +39,7 @@ the date the current version of OpenSSL was built. option information: various options set when the library was built. -=item B<-c> +=item B<-f> compilation flags. diff --git a/crypto/openssl/doc/apps/x509v3_config.pod b/crypto/openssl/doc/apps/x509v3_config.pod index 0450067cf1d..13ff85b17cb 100644 --- a/crypto/openssl/doc/apps/x509v3_config.pod +++ b/crypto/openssl/doc/apps/x509v3_config.pod @@ -301,7 +301,7 @@ Example: O=Organisation CN=Some Name - + =head2 Certificate Policies. This is a I extension. All the fields of this extension can be set by @@ -390,7 +390,7 @@ Examples: nameConstraints=permitted;email:.somedomain.com nameConstraints=excluded;email:.com -issuingDistributionPoint = idp_section + =head2 OCSP No Check diff --git a/crypto/openssl/doc/crypto/CMS_decrypt.pod b/crypto/openssl/doc/crypto/CMS_decrypt.pod index d857e4f93f6..3fa9212af32 100644 --- a/crypto/openssl/doc/crypto/CMS_decrypt.pod +++ b/crypto/openssl/doc/crypto/CMS_decrypt.pod @@ -27,7 +27,21 @@ function or errors about unknown algorithms will occur. Although the recipients certificate is not needed to decrypt the data it is needed to locate the appropriate (of possible several) recipients in the CMS -structure. If B is set to NULL all possible recipients are tried. +structure. + +If B is set to NULL all possible recipients are tried. This case however +is problematic. To thwart the MMA attack (Bleichenbacher's attack on +PKCS #1 v1.5 RSA padding) all recipients are tried whether they succeed or +not. If no recipient succeeds then a random symmetric key is used to decrypt +the content: this will typically output garbage and may (but is not guaranteed +to) ultimately return a padding error only. If CMS_decrypt() just returned an +error when all recipient encrypted keys failed to decrypt an attacker could +use this in a timing attack. If the special flag B is set +then the above behaviour is modified and an error B returned if no +recipient encrypted key can be decrypted B generating a random +content encryption key. Applications should use this flag with +B especially in automated gateways as it can leave them +open to attack. It is possible to determine the correct recipient key by other means (for example looking them up in a database) and setting them in the CMS structure diff --git a/crypto/openssl/doc/crypto/CONF_modules_free.pod b/crypto/openssl/doc/crypto/CONF_modules_free.pod index 87bc7b783c9..347020c5fe7 100644 --- a/crypto/openssl/doc/crypto/CONF_modules_free.pod +++ b/crypto/openssl/doc/crypto/CONF_modules_free.pod @@ -37,7 +37,7 @@ None of the functions return a value. =head1 SEE ALSO L, L, -L +L =head1 HISTORY diff --git a/crypto/openssl/doc/crypto/CONF_modules_load_file.pod b/crypto/openssl/doc/crypto/CONF_modules_load_file.pod index 9965d69bf2e..0c4d926858f 100644 --- a/crypto/openssl/doc/crypto/CONF_modules_load_file.pod +++ b/crypto/openssl/doc/crypto/CONF_modules_load_file.pod @@ -51,7 +51,7 @@ return value of the failing module (this will always be zero or negative). =head1 SEE ALSO L, L, -L, L +L, L =head1 HISTORY diff --git a/crypto/openssl/doc/crypto/OPENSSL_config.pod b/crypto/openssl/doc/crypto/OPENSSL_config.pod index e7bba2aacae..888de88f6bb 100644 --- a/crypto/openssl/doc/crypto/OPENSSL_config.pod +++ b/crypto/openssl/doc/crypto/OPENSSL_config.pod @@ -73,7 +73,7 @@ Neither OPENSSL_config() nor OPENSSL_no_config() return a value. =head1 SEE ALSO L, L, -L +L =head1 HISTORY diff --git a/crypto/openssl/doc/crypto/X509_NAME_ENTRY_get_object.pod b/crypto/openssl/doc/crypto/X509_NAME_ENTRY_get_object.pod index 41902c0d455..4716e7ee754 100644 --- a/crypto/openssl/doc/crypto/X509_NAME_ENTRY_get_object.pod +++ b/crypto/openssl/doc/crypto/X509_NAME_ENTRY_get_object.pod @@ -65,7 +65,7 @@ set first so the relevant field information can be looked up internally. =head1 SEE ALSO L, L, -L +L =head1 HISTORY diff --git a/crypto/openssl/doc/crypto/X509_STORE_CTX_get_ex_new_index.pod b/crypto/openssl/doc/crypto/X509_STORE_CTX_get_ex_new_index.pod index 8d6b9dda47e..8a9243d7561 100644 --- a/crypto/openssl/doc/crypto/X509_STORE_CTX_get_ex_new_index.pod +++ b/crypto/openssl/doc/crypto/X509_STORE_CTX_get_ex_new_index.pod @@ -15,7 +15,7 @@ X509_STORE_CTX_get_ex_new_index, X509_STORE_CTX_set_ex_data, X509_STORE_CTX_get_ int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *d, int idx, void *arg); - char *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *d, int idx); + void *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *d, int idx); =head1 DESCRIPTION diff --git a/crypto/openssl/doc/fingerprints.txt b/crypto/openssl/doc/fingerprints.txt index 7d05a855946..4030c81fa50 100644 --- a/crypto/openssl/doc/fingerprints.txt +++ b/crypto/openssl/doc/fingerprints.txt @@ -21,6 +21,13 @@ pub 2048R/F295C759 1998-12-13 Key fingerprint = D0 5D 8C 61 6E 27 E6 60 41 EC B1 B8 D5 7E E5 97 uid Dr S N Henson +pub 4096R/FA40E9E2 2005-03-19 + Key fingerprint = 6260 5AA4 334A F9F0 DDE5 D349 D357 7507 FA40 E9E2 +uid Dr Stephen Henson +uid Dr Stephen Henson +uid Dr Stephen N Henson +sub 4096R/8811F530 2005-03-19 + pub 1024R/49A563D9 1997-02-24 Key fingerprint = 7B 79 19 FA 71 6B 87 25 0E 77 21 E5 52 D9 83 BF uid Mark Cox diff --git a/crypto/openssl/doc/ssl/SSL_CTX_set_msg_callback.pod b/crypto/openssl/doc/ssl/SSL_CTX_set_msg_callback.pod index 0015e6ea792..8b82d94a389 100644 --- a/crypto/openssl/doc/ssl/SSL_CTX_set_msg_callback.pod +++ b/crypto/openssl/doc/ssl/SSL_CTX_set_msg_callback.pod @@ -11,8 +11,8 @@ SSL_CTX_set_msg_callback, SSL_CTX_set_msg_callback_arg, SSL_set_msg_callback, SS void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); void SSL_CTX_set_msg_callback_arg(SSL_CTX *ctx, void *arg); - void SSL_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); - void SSL_set_msg_callback_arg(SSL_CTX *ctx, void *arg); + void SSL_set_msg_callback(SSL *ssl, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); + void SSL_set_msg_callback_arg(SSL *ssl, void *arg); =head1 DESCRIPTION diff --git a/crypto/openssl/doc/ssl/SSL_CTX_set_options.pod b/crypto/openssl/doc/ssl/SSL_CTX_set_options.pod index fded0601b56..d8866927a26 100644 --- a/crypto/openssl/doc/ssl/SSL_CTX_set_options.pod +++ b/crypto/openssl/doc/ssl/SSL_CTX_set_options.pod @@ -112,6 +112,12 @@ vulnerability affecting CBC ciphers, which cannot be handled by some broken SSL implementations. This option has no effect for connections using other ciphers. +=item SSL_OP_TLSEXT_PADDING + +Adds a padding extension to ensure the ClientHello size is never between +256 and 511 bytes in length. This is needed as a workaround for some +implementations. + =item SSL_OP_ALL All of the above bug workarounds. diff --git a/crypto/openssl/doc/ssl/SSL_get_peer_cert_chain.pod b/crypto/openssl/doc/ssl/SSL_get_peer_cert_chain.pod index 49fb88f86fa..059376c76b2 100644 --- a/crypto/openssl/doc/ssl/SSL_get_peer_cert_chain.pod +++ b/crypto/openssl/doc/ssl/SSL_get_peer_cert_chain.pod @@ -8,11 +8,11 @@ SSL_get_peer_cert_chain - get the X509 certificate chain of the peer #include - STACKOF(X509) *SSL_get_peer_cert_chain(const SSL *ssl); + STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *ssl); =head1 DESCRIPTION -SSL_get_peer_cert_chain() returns a pointer to STACKOF(X509) certificates +SSL_get_peer_cert_chain() returns a pointer to STACK_OF(X509) certificates forming the certificate chain of the peer. If called on the client side, the stack also contains the peer's certificate; if called on the server side, the peer's certificate must be obtained separately using @@ -24,7 +24,7 @@ If the peer did not present a certificate, NULL is returned. The peer certificate chain is not necessarily available after reusing a session, in which case a NULL pointer is returned. -The reference count of the STACKOF(X509) object is not incremented. +The reference count of the STACK_OF(X509) object is not incremented. If the corresponding session is freed, the pointer must not be used any longer. @@ -39,7 +39,7 @@ The following return values can occur: No certificate was presented by the peer or no connection was established or the certificate chain is no longer available when a session is reused. -=item Pointer to a STACKOF(X509) +=item Pointer to a STACK_OF(X509) The return value points to the certificate chain presented by the peer. diff --git a/crypto/openssl/engines/ccgost/gost_ameth.c b/crypto/openssl/engines/ccgost/gost_ameth.c index 2cde1fcfd9d..8b9230b9ab4 100644 --- a/crypto/openssl/engines/ccgost/gost_ameth.c +++ b/crypto/openssl/engines/ccgost/gost_ameth.c @@ -269,7 +269,7 @@ static int pkey_ctrl_gost(EVP_PKEY *pkey, int op, case ASN1_PKEY_CTRL_CMS_ENVELOPE: if (arg1 == 0) { - X509_ALGOR *alg; + X509_ALGOR *alg = NULL; ASN1_STRING * params = encode_gost_algor_params(pkey); if (!params) { diff --git a/crypto/openssl/ssl/Makefile b/crypto/openssl/ssl/Makefile index debe07405bf..0045d898302 100644 --- a/crypto/openssl/ssl/Makefile +++ b/crypto/openssl/ssl/Makefile @@ -15,7 +15,7 @@ KRB5_INCLUDES= CFLAGS= $(INCLUDES) $(CFLAG) GENERAL=Makefile README ssl-lib.com install.com -TEST=ssltest.c +TEST=ssltest.c heartbeat_test.c APPS= LIB=$(TOP)/libssl.a diff --git a/crypto/openssl/ssl/d1_both.c b/crypto/openssl/ssl/d1_both.c index 2e8cf681ed0..04aa23107ec 100644 --- a/crypto/openssl/ssl/d1_both.c +++ b/crypto/openssl/ssl/d1_both.c @@ -627,7 +627,16 @@ dtls1_reassemble_fragment(SSL *s, struct hm_header_st* msg_hdr, int *ok) frag->msg_header.frag_off = 0; } else + { frag = (hm_fragment*) item->data; + if (frag->msg_header.msg_len != msg_hdr->msg_len) + { + item = NULL; + frag = NULL; + goto err; + } + } + /* If message is already reassembled, this must be a * retransmit and can be dropped. @@ -674,8 +683,8 @@ dtls1_reassemble_fragment(SSL *s, struct hm_header_st* msg_hdr, int *ok) item = pitem_new(seq64be, frag); if (item == NULL) { - goto err; i = -1; + goto err; } pqueue_insert(s->d1->buffered_messages, item); @@ -784,6 +793,7 @@ dtls1_get_message_fragment(SSL *s, int st1, int stn, long max, int *ok) int i,al; struct hm_header_st msg_hdr; + redo: /* see if we have the required fragment already */ if ((frag_len = dtls1_retrieve_buffered_fragment(s,max,ok)) || *ok) { @@ -842,8 +852,7 @@ dtls1_get_message_fragment(SSL *s, int st1, int stn, long max, int *ok) s->msg_callback_arg); s->init_num = 0; - return dtls1_get_message_fragment(s, st1, stn, - max, ok); + goto redo; } else /* Incorrectly formated Hello request */ { diff --git a/crypto/openssl/ssl/d1_lib.c b/crypto/openssl/ssl/d1_lib.c index 106939f2417..6bde16fa212 100644 --- a/crypto/openssl/ssl/d1_lib.c +++ b/crypto/openssl/ssl/d1_lib.c @@ -176,9 +176,12 @@ static void dtls1_clear_queues(SSL *s) while ( (item = pqueue_pop(s->d1->buffered_app_data.q)) != NULL) { - frag = (hm_fragment *)item->data; - OPENSSL_free(frag->fragment); - OPENSSL_free(frag); + rdata = (DTLS1_RECORD_DATA *) item->data; + if (rdata->rbuf.buf) + { + OPENSSL_free(rdata->rbuf.buf); + } + OPENSSL_free(item->data); pitem_free(item); } } diff --git a/crypto/openssl/ssl/d1_pkt.c b/crypto/openssl/ssl/d1_pkt.c index 8186462d4a6..438c0913d24 100644 --- a/crypto/openssl/ssl/d1_pkt.c +++ b/crypto/openssl/ssl/d1_pkt.c @@ -239,14 +239,6 @@ dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned char *priority) } #endif - /* insert should not fail, since duplicates are dropped */ - if (pqueue_insert(queue->q, item) == NULL) - { - OPENSSL_free(rdata); - pitem_free(item); - return(0); - } - s->packet = NULL; s->packet_length = 0; memset(&(s->s3->rbuf), 0, sizeof(SSL3_BUFFER)); @@ -259,7 +251,16 @@ dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned char *priority) pitem_free(item); return(0); } - + + /* insert should not fail, since duplicates are dropped */ + if (pqueue_insert(queue->q, item) == NULL) + { + SSLerr(SSL_F_DTLS1_BUFFER_RECORD, ERR_R_INTERNAL_ERROR); + OPENSSL_free(rdata); + pitem_free(item); + return(0); + } + return(1); } diff --git a/crypto/openssl/ssl/d1_srvr.c b/crypto/openssl/ssl/d1_srvr.c index 9975e20873c..1384ab0cbf1 100644 --- a/crypto/openssl/ssl/d1_srvr.c +++ b/crypto/openssl/ssl/d1_srvr.c @@ -1356,6 +1356,7 @@ int dtls1_send_server_key_exchange(SSL *s) (unsigned char *)encodedPoint, encodedlen); OPENSSL_free(encodedPoint); + encodedPoint = NULL; p += encodedlen; } #endif diff --git a/crypto/openssl/ssl/heartbeat_test.c b/crypto/openssl/ssl/heartbeat_test.c new file mode 100644 index 00000000000..d8cc559981c --- /dev/null +++ b/crypto/openssl/ssl/heartbeat_test.c @@ -0,0 +1,465 @@ +/* test/heartbeat_test.c */ +/* + * Unit test for TLS heartbeats. + * + * Acts as a regression test against the Heartbleed bug (CVE-2014-0160). + * + * Author: Mike Bland (mbland@acm.org, http://mike-bland.com/) + * Date: 2014-04-12 + * License: Creative Commons Attribution 4.0 International (CC By 4.0) + * http://creativecommons.org/licenses/by/4.0/deed.en_US + * + * OUTPUT + * ------ + * The program returns zero on success. It will print a message with a count + * of the number of failed tests and return nonzero if any tests fail. + * + * It will print the contents of the request and response buffers for each + * failing test. In a "fixed" version, all the tests should pass and there + * should be no output. + * + * In a "bleeding" version, you'll see: + * + * test_dtls1_heartbleed failed: + * expected payload len: 0 + * received: 1024 + * sent 26 characters + * "HEARTBLEED " + * received 1024 characters + * "HEARTBLEED \xde\xad\xbe\xef..." + * ** test_dtls1_heartbleed failed ** + * + * The contents of the returned buffer in the failing test will depend on the + * contents of memory on your machine. + * + * MORE INFORMATION + * ---------------- + * http://mike-bland.com/2014/04/12/heartbleed.html + * http://mike-bland.com/tags/heartbleed.html + */ + +#include "../ssl/ssl_locl.h" +#include +#include +#include +#include + +#if !defined(OPENSSL_NO_HEARTBEATS) && !defined(OPENSSL_SYS_WINDOWS) + +/* As per https://tools.ietf.org/html/rfc6520#section-4 */ +#define MIN_PADDING_SIZE 16 + +/* Maximum number of payload characters to print as test output */ +#define MAX_PRINTABLE_CHARACTERS 1024 + +typedef struct heartbeat_test_fixture + { + SSL_CTX *ctx; + SSL *s; + const char* test_case_name; + int (*process_heartbeat)(SSL* s); + unsigned char* payload; + int sent_payload_len; + int expected_return_value; + int return_payload_offset; + int expected_payload_len; + const char* expected_return_payload; + } HEARTBEAT_TEST_FIXTURE; + +static HEARTBEAT_TEST_FIXTURE set_up(const char* const test_case_name, + const SSL_METHOD* meth) + { + HEARTBEAT_TEST_FIXTURE fixture; + int setup_ok = 1; + memset(&fixture, 0, sizeof(fixture)); + fixture.test_case_name = test_case_name; + + fixture.ctx = SSL_CTX_new(meth); + if (!fixture.ctx) + { + fprintf(stderr, "Failed to allocate SSL_CTX for test: %s\n", + test_case_name); + setup_ok = 0; + goto fail; + } + + fixture.s = SSL_new(fixture.ctx); + if (!fixture.s) + { + fprintf(stderr, "Failed to allocate SSL for test: %s\n", test_case_name); + setup_ok = 0; + goto fail; + } + + if (!ssl_init_wbio_buffer(fixture.s, 1)) + { + fprintf(stderr, "Failed to set up wbio buffer for test: %s\n", + test_case_name); + setup_ok = 0; + goto fail; + } + + if (!ssl3_setup_buffers(fixture.s)) + { + fprintf(stderr, "Failed to setup buffers for test: %s\n", + test_case_name); + setup_ok = 0; + goto fail; + } + + /* Clear the memory for the return buffer, since this isn't automatically + * zeroed in opt mode and will cause spurious test failures that will change + * with each execution. + */ + memset(fixture.s->s3->wbuf.buf, 0, fixture.s->s3->wbuf.len); + + fail: + if (!setup_ok) + { + ERR_print_errors_fp(stderr); + exit(EXIT_FAILURE); + } + return fixture; + } + +static HEARTBEAT_TEST_FIXTURE set_up_dtls(const char* const test_case_name) + { + HEARTBEAT_TEST_FIXTURE fixture = set_up(test_case_name, + DTLSv1_server_method()); + fixture.process_heartbeat = dtls1_process_heartbeat; + + /* As per dtls1_get_record(), skipping the following from the beginning of + * the returned heartbeat message: + * type-1 byte; version-2 bytes; sequence number-8 bytes; length-2 bytes + * + * And then skipping the 1-byte type encoded by process_heartbeat for + * a total of 14 bytes, at which point we can grab the length and the + * payload we seek. + */ + fixture.return_payload_offset = 14; + return fixture; + } + +/* Needed by ssl3_write_bytes() */ +static int dummy_handshake(SSL* s) + { + return 1; + } + +static HEARTBEAT_TEST_FIXTURE set_up_tls(const char* const test_case_name) + { + HEARTBEAT_TEST_FIXTURE fixture = set_up(test_case_name, + TLSv1_server_method()); + fixture.process_heartbeat = tls1_process_heartbeat; + fixture.s->handshake_func = dummy_handshake; + + /* As per do_ssl3_write(), skipping the following from the beginning of + * the returned heartbeat message: + * type-1 byte; version-2 bytes; length-2 bytes + * + * And then skipping the 1-byte type encoded by process_heartbeat for + * a total of 6 bytes, at which point we can grab the length and the payload + * we seek. + */ + fixture.return_payload_offset = 6; + return fixture; + } + +static void tear_down(HEARTBEAT_TEST_FIXTURE fixture) + { + ERR_print_errors_fp(stderr); + SSL_free(fixture.s); + SSL_CTX_free(fixture.ctx); + } + +static void print_payload(const char* const prefix, + const unsigned char *payload, const int n) + { + const int end = n < MAX_PRINTABLE_CHARACTERS ? n + : MAX_PRINTABLE_CHARACTERS; + int i = 0; + + printf("%s %d character%s", prefix, n, n == 1 ? "" : "s"); + if (end != n) printf(" (first %d shown)", end); + printf("\n \""); + + for (; i != end; ++i) + { + const unsigned char c = payload[i]; + if (isprint(c)) fputc(c, stdout); + else printf("\\x%02x", c); + } + printf("\"\n"); + } + +static int execute_heartbeat(HEARTBEAT_TEST_FIXTURE fixture) + { + int result = 0; + SSL* s = fixture.s; + unsigned char *payload = fixture.payload; + unsigned char sent_buf[MAX_PRINTABLE_CHARACTERS + 1]; + int return_value; + unsigned const char *p; + int actual_payload_len; + + s->s3->rrec.data = payload; + s->s3->rrec.length = strlen((const char*)payload); + *payload++ = TLS1_HB_REQUEST; + s2n(fixture.sent_payload_len, payload); + + /* Make a local copy of the request, since it gets overwritten at some + * point */ + memcpy((char *)sent_buf, (const char*)payload, sizeof(sent_buf)); + + return_value = fixture.process_heartbeat(s); + + if (return_value != fixture.expected_return_value) + { + printf("%s failed: expected return value %d, received %d\n", + fixture.test_case_name, fixture.expected_return_value, + return_value); + result = 1; + } + + /* If there is any byte alignment, it will be stored in wbuf.offset. */ + p = &(s->s3->wbuf.buf[ + fixture.return_payload_offset + s->s3->wbuf.offset]); + actual_payload_len = 0; + n2s(p, actual_payload_len); + + if (actual_payload_len != fixture.expected_payload_len) + { + printf("%s failed:\n expected payload len: %d\n received: %d\n", + fixture.test_case_name, fixture.expected_payload_len, + actual_payload_len); + print_payload("sent", sent_buf, strlen((const char*)sent_buf)); + print_payload("received", p, actual_payload_len); + result = 1; + } + else + { + char* actual_payload = BUF_strndup((const char*)p, actual_payload_len); + if (strcmp(actual_payload, fixture.expected_return_payload) != 0) + { + printf("%s failed:\n expected payload: \"%s\"\n received: \"%s\"\n", + fixture.test_case_name, fixture.expected_return_payload, + actual_payload); + result = 1; + } + OPENSSL_free(actual_payload); + } + + if (result != 0) + { + printf("** %s failed **\n--------\n", fixture.test_case_name); + } + return result; + } + +static int honest_payload_size(unsigned char payload_buf[]) + { + /* Omit three-byte pad at the beginning for type and payload length */ + return strlen((const char*)&payload_buf[3]) - MIN_PADDING_SIZE; + } + +#define SETUP_HEARTBEAT_TEST_FIXTURE(type)\ + HEARTBEAT_TEST_FIXTURE fixture = set_up_##type(__func__);\ + int result = 0 + +#define EXECUTE_HEARTBEAT_TEST()\ + if (execute_heartbeat(fixture) != 0) result = 1;\ + tear_down(fixture);\ + return result + +static int test_dtls1_not_bleeding() + { + SETUP_HEARTBEAT_TEST_FIXTURE(dtls); + /* Three-byte pad at the beginning for type and payload length */ + unsigned char payload_buf[] = " Not bleeding, sixteen spaces of padding" + " "; + const int payload_buf_len = honest_payload_size(payload_buf); + + fixture.payload = &payload_buf[0]; + fixture.sent_payload_len = payload_buf_len; + fixture.expected_return_value = 0; + fixture.expected_payload_len = payload_buf_len; + fixture.expected_return_payload = "Not bleeding, sixteen spaces of padding"; + EXECUTE_HEARTBEAT_TEST(); + } + +static int test_dtls1_not_bleeding_empty_payload() + { + int payload_buf_len; + + SETUP_HEARTBEAT_TEST_FIXTURE(dtls); + /* Three-byte pad at the beginning for type and payload length, plus a NUL + * at the end */ + unsigned char payload_buf[4 + MIN_PADDING_SIZE]; + memset(payload_buf, ' ', sizeof(payload_buf)); + payload_buf[sizeof(payload_buf) - 1] = '\0'; + payload_buf_len = honest_payload_size(payload_buf); + + fixture.payload = &payload_buf[0]; + fixture.sent_payload_len = payload_buf_len; + fixture.expected_return_value = 0; + fixture.expected_payload_len = payload_buf_len; + fixture.expected_return_payload = ""; + EXECUTE_HEARTBEAT_TEST(); + } + +static int test_dtls1_heartbleed() + { + SETUP_HEARTBEAT_TEST_FIXTURE(dtls); + /* Three-byte pad at the beginning for type and payload length */ + unsigned char payload_buf[] = " HEARTBLEED "; + + fixture.payload = &payload_buf[0]; + fixture.sent_payload_len = MAX_PRINTABLE_CHARACTERS; + fixture.expected_return_value = 0; + fixture.expected_payload_len = 0; + fixture.expected_return_payload = ""; + EXECUTE_HEARTBEAT_TEST(); + } + +static int test_dtls1_heartbleed_empty_payload() + { + SETUP_HEARTBEAT_TEST_FIXTURE(dtls); + /* Excluding the NUL at the end, one byte short of type + payload length + + * minimum padding */ + unsigned char payload_buf[MIN_PADDING_SIZE + 3]; + memset(payload_buf, ' ', sizeof(payload_buf)); + payload_buf[sizeof(payload_buf) - 1] = '\0'; + + fixture.payload = &payload_buf[0]; + fixture.sent_payload_len = MAX_PRINTABLE_CHARACTERS; + fixture.expected_return_value = 0; + fixture.expected_payload_len = 0; + fixture.expected_return_payload = ""; + EXECUTE_HEARTBEAT_TEST(); + } + +static int test_dtls1_heartbleed_excessive_plaintext_length() + { + SETUP_HEARTBEAT_TEST_FIXTURE(dtls); + /* Excluding the NUL at the end, one byte in excess of maximum allowed + * heartbeat message length */ + unsigned char payload_buf[SSL3_RT_MAX_PLAIN_LENGTH + 2]; + memset(payload_buf, ' ', sizeof(payload_buf)); + payload_buf[sizeof(payload_buf) - 1] = '\0'; + + fixture.payload = &payload_buf[0]; + fixture.sent_payload_len = honest_payload_size(payload_buf); + fixture.expected_return_value = 0; + fixture.expected_payload_len = 0; + fixture.expected_return_payload = ""; + EXECUTE_HEARTBEAT_TEST(); + } + +static int test_tls1_not_bleeding() + { + SETUP_HEARTBEAT_TEST_FIXTURE(tls); + /* Three-byte pad at the beginning for type and payload length */ + unsigned char payload_buf[] = " Not bleeding, sixteen spaces of padding" + " "; + const int payload_buf_len = honest_payload_size(payload_buf); + + fixture.payload = &payload_buf[0]; + fixture.sent_payload_len = payload_buf_len; + fixture.expected_return_value = 0; + fixture.expected_payload_len = payload_buf_len; + fixture.expected_return_payload = "Not bleeding, sixteen spaces of padding"; + EXECUTE_HEARTBEAT_TEST(); + } + +static int test_tls1_not_bleeding_empty_payload() + { + int payload_buf_len; + + SETUP_HEARTBEAT_TEST_FIXTURE(tls); + /* Three-byte pad at the beginning for type and payload length, plus a NUL + * at the end */ + unsigned char payload_buf[4 + MIN_PADDING_SIZE]; + memset(payload_buf, ' ', sizeof(payload_buf)); + payload_buf[sizeof(payload_buf) - 1] = '\0'; + payload_buf_len = honest_payload_size(payload_buf); + + fixture.payload = &payload_buf[0]; + fixture.sent_payload_len = payload_buf_len; + fixture.expected_return_value = 0; + fixture.expected_payload_len = payload_buf_len; + fixture.expected_return_payload = ""; + EXECUTE_HEARTBEAT_TEST(); + } + +static int test_tls1_heartbleed() + { + SETUP_HEARTBEAT_TEST_FIXTURE(tls); + /* Three-byte pad at the beginning for type and payload length */ + unsigned char payload_buf[] = " HEARTBLEED "; + + fixture.payload = &payload_buf[0]; + fixture.sent_payload_len = MAX_PRINTABLE_CHARACTERS; + fixture.expected_return_value = 0; + fixture.expected_payload_len = 0; + fixture.expected_return_payload = ""; + EXECUTE_HEARTBEAT_TEST(); + } + +static int test_tls1_heartbleed_empty_payload() + { + SETUP_HEARTBEAT_TEST_FIXTURE(tls); + /* Excluding the NUL at the end, one byte short of type + payload length + + * minimum padding */ + unsigned char payload_buf[MIN_PADDING_SIZE + 3]; + memset(payload_buf, ' ', sizeof(payload_buf)); + payload_buf[sizeof(payload_buf) - 1] = '\0'; + + fixture.payload = &payload_buf[0]; + fixture.sent_payload_len = MAX_PRINTABLE_CHARACTERS; + fixture.expected_return_value = 0; + fixture.expected_payload_len = 0; + fixture.expected_return_payload = ""; + EXECUTE_HEARTBEAT_TEST(); + } + +#undef EXECUTE_HEARTBEAT_TEST +#undef SETUP_HEARTBEAT_TEST_FIXTURE + +int main(int argc, char *argv[]) + { + int num_failed; + + SSL_library_init(); + SSL_load_error_strings(); + + num_failed = test_dtls1_not_bleeding() + + test_dtls1_not_bleeding_empty_payload() + + test_dtls1_heartbleed() + + test_dtls1_heartbleed_empty_payload() + + /* The following test causes an assertion failure at + * ssl/d1_pkt.c:dtls1_write_bytes() in versions prior to 1.0.1g: */ + (OPENSSL_VERSION_NUMBER >= 0x1000107fL ? + test_dtls1_heartbleed_excessive_plaintext_length() : 0) + + test_tls1_not_bleeding() + + test_tls1_not_bleeding_empty_payload() + + test_tls1_heartbleed() + + test_tls1_heartbleed_empty_payload() + + 0; + + ERR_print_errors_fp(stderr); + + if (num_failed != 0) + { + printf("%d test%s failed\n", num_failed, num_failed != 1 ? "s" : ""); + return EXIT_FAILURE; + } + return EXIT_SUCCESS; + } + +#else /* OPENSSL_NO_HEARTBEATS*/ + +int main(int argc, char *argv[]) + { + return EXIT_SUCCESS; + } +#endif /* OPENSSL_NO_HEARTBEATS */ diff --git a/crypto/openssl/ssl/s3_clnt.c b/crypto/openssl/ssl/s3_clnt.c index a6b3c01afa1..0457af87891 100644 --- a/crypto/openssl/ssl/s3_clnt.c +++ b/crypto/openssl/ssl/s3_clnt.c @@ -559,6 +559,7 @@ int ssl3_connect(SSL *s) case SSL3_ST_CR_FINISHED_A: case SSL3_ST_CR_FINISHED_B: + s->s3->flags |= SSL3_FLAGS_CCS_OK; ret=ssl3_get_finished(s,SSL3_ST_CR_FINISHED_A, SSL3_ST_CR_FINISHED_B); if (ret <= 0) goto end; @@ -915,6 +916,7 @@ int ssl3_get_server_hello(SSL *s) SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT); goto f_err; } + s->s3->flags |= SSL3_FLAGS_CCS_OK; s->hit=1; } else /* a miss or crap from the other end */ @@ -2510,6 +2512,13 @@ int ssl3_send_client_key_exchange(SSL *s) int ecdh_clnt_cert = 0; int field_size = 0; + if (s->session->sess_cert == NULL) + { + ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_UNEXPECTED_MESSAGE); + SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,SSL_R_UNEXPECTED_MESSAGE); + goto err; + } + /* Did we send out the client's * ECDH share for use in premaster * computation as part of client certificate? diff --git a/crypto/openssl/ssl/s3_pkt.c b/crypto/openssl/ssl/s3_pkt.c index 8deeab3c9fb..59011e39c67 100644 --- a/crypto/openssl/ssl/s3_pkt.c +++ b/crypto/openssl/ssl/s3_pkt.c @@ -110,6 +110,7 @@ */ #include +#include #include #define USE_SOCKETS #include "ssl_locl.h" @@ -580,10 +581,11 @@ int ssl3_do_compress(SSL *ssl) int ssl3_write_bytes(SSL *s, int type, const void *buf_, int len) { const unsigned char *buf=buf_; - unsigned int tot,n,nw; - int i; + unsigned int n,nw; + int i,tot; s->rwstate=SSL_NOTHING; + OPENSSL_assert(s->s3->wnum <= INT_MAX); tot=s->s3->wnum; s->s3->wnum=0; @@ -598,6 +600,22 @@ int ssl3_write_bytes(SSL *s, int type, const void *buf_, int len) } } + /* ensure that if we end up with a smaller value of data to write + * out than the the original len from a write which didn't complete + * for non-blocking I/O and also somehow ended up avoiding + * the check for this in ssl3_write_pending/SSL_R_BAD_WRITE_RETRY as + * it must never be possible to end up with (len-tot) as a large + * number that will then promptly send beyond the end of the users + * buffer ... so we trap and report the error in a way the user + * will notice + */ + if (len < tot) + { + SSLerr(SSL_F_SSL3_WRITE_BYTES,SSL_R_BAD_LENGTH); + return(-1); + } + + n=(len-tot); for (;;) { @@ -641,9 +659,6 @@ static int do_ssl3_write(SSL *s, int type, const unsigned char *buf, SSL3_BUFFER *wb=&(s->s3->wbuf); SSL_SESSION *sess; - if (wb->buf == NULL) - if (!ssl3_setup_write_buffer(s)) - return -1; /* first check if there is a SSL3_BUFFER still being written * out. This will happen with non blocking IO */ @@ -659,6 +674,10 @@ static int do_ssl3_write(SSL *s, int type, const unsigned char *buf, /* if it went, fall through and send more stuff */ } + if (wb->buf == NULL) + if (!ssl3_setup_write_buffer(s)) + return -1; + if (len == 0 && !create_empty_fragment) return 0; @@ -1297,6 +1316,15 @@ int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek) goto f_err; } + if (!(s->s3->flags & SSL3_FLAGS_CCS_OK)) + { + al=SSL_AD_UNEXPECTED_MESSAGE; + SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_CCS_RECEIVED_EARLY); + goto f_err; + } + + s->s3->flags &= ~SSL3_FLAGS_CCS_OK; + rr->length=0; if (s->msg_callback) @@ -1431,7 +1459,7 @@ int ssl3_do_change_cipher_spec(SSL *s) if (s->s3->tmp.key_block == NULL) { - if (s->session == NULL) + if (s->session == NULL || s->session->master_key_length == 0) { /* might happen if dtls1_read_bytes() calls this */ SSLerr(SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC,SSL_R_CCS_RECEIVED_EARLY); diff --git a/crypto/openssl/ssl/s3_srvr.c b/crypto/openssl/ssl/s3_srvr.c index 9ac19c05f22..503bed3fe0b 100644 --- a/crypto/openssl/ssl/s3_srvr.c +++ b/crypto/openssl/ssl/s3_srvr.c @@ -673,6 +673,7 @@ int ssl3_accept(SSL *s) case SSL3_ST_SR_CERT_VRFY_A: case SSL3_ST_SR_CERT_VRFY_B: + s->s3->flags |= SSL3_FLAGS_CCS_OK; /* we should decide if we expected this one */ ret=ssl3_get_cert_verify(s); if (ret <= 0) goto end; @@ -700,6 +701,7 @@ int ssl3_accept(SSL *s) case SSL3_ST_SR_FINISHED_A: case SSL3_ST_SR_FINISHED_B: + s->s3->flags |= SSL3_FLAGS_CCS_OK; ret=ssl3_get_finished(s,SSL3_ST_SR_FINISHED_A, SSL3_ST_SR_FINISHED_B); if (ret <= 0) goto end; @@ -770,7 +772,10 @@ int ssl3_accept(SSL *s) s->s3->tmp.next_state=SSL3_ST_SR_FINISHED_A; #else if (s->s3->next_proto_neg_seen) + { + s->s3->flags |= SSL3_FLAGS_CCS_OK; s->s3->tmp.next_state=SSL3_ST_SR_NEXT_PROTO_A; + } else s->s3->tmp.next_state=SSL3_ST_SR_FINISHED_A; #endif @@ -2097,6 +2102,11 @@ int ssl3_send_certificate_request(SSL *s) s->init_num=n+4; s->init_off=0; #ifdef NETSCAPE_HANG_BUG + if (!BUF_MEM_grow_clean(buf, s->init_num + 4)) + { + SSLerr(SSL_F_SSL3_SEND_CERTIFICATE_REQUEST,ERR_R_BUF_LIB); + goto err; + } p=(unsigned char *)s->init_buf->data + s->init_num; /* do the header */ @@ -2813,6 +2823,8 @@ int ssl3_get_client_key_exchange(SSL *s) unsigned char premaster_secret[32], *start; size_t outlen=32, inlen; unsigned long alg_a; + int Ttag, Tclass; + long Tlen; /* Get our certificate private key*/ alg_a = s->s3->tmp.new_cipher->algorithm_auth; @@ -2834,26 +2846,15 @@ int ssl3_get_client_key_exchange(SSL *s) ERR_clear_error(); } /* Decrypt session key */ - if ((*p!=( V_ASN1_SEQUENCE| V_ASN1_CONSTRUCTED))) - { - SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_DECRYPTION_FAILED); - goto gerr; - } - if (p[1] == 0x81) - { - start = p+3; - inlen = p[2]; - } - else if (p[1] < 0x80) - { - start = p+2; - inlen = p[1]; - } - else + if (ASN1_get_object((const unsigned char **)&p, &Tlen, &Ttag, &Tclass, n) != V_ASN1_CONSTRUCTED || + Ttag != V_ASN1_SEQUENCE || + Tclass != V_ASN1_UNIVERSAL) { SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_DECRYPTION_FAILED); goto gerr; } + start = p; + inlen = Tlen; if (EVP_PKEY_decrypt(pkey_ctx,premaster_secret,&outlen,start,inlen) <=0) { diff --git a/crypto/openssl/ssl/ssl.h b/crypto/openssl/ssl/ssl.h index 7219a0e64bc..4c1242c9d20 100644 --- a/crypto/openssl/ssl/ssl.h +++ b/crypto/openssl/ssl/ssl.h @@ -553,7 +553,7 @@ struct ssl_session_st /* Allow initial connection to servers that don't support RI */ #define SSL_OP_LEGACY_SERVER_CONNECT 0x00000004L #define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 0x00000008L -#define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0x00000010L +#define SSL_OP_TLSEXT_PADDING 0x00000010L #define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER 0x00000020L #define SSL_OP_SAFARI_ECDHE_ECDSA_BUG 0x00000040L #define SSL_OP_SSLEAY_080_CLIENT_DH_BUG 0x00000080L @@ -562,6 +562,8 @@ struct ssl_session_st /* Hasn't done anything since OpenSSL 0.9.7h, retained for compatibility */ #define SSL_OP_MSIE_SSLV2_RSA_PADDING 0x0 +/* Refers to ancient SSLREF and SSLv2, retained for compatibility */ +#define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0x0 /* Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added * in OpenSSL 0.9.6d. Usually (depending on the application protocol) diff --git a/crypto/openssl/ssl/ssl3.h b/crypto/openssl/ssl/ssl3.h index cb8b2492ec9..37f19e3ab50 100644 --- a/crypto/openssl/ssl/ssl3.h +++ b/crypto/openssl/ssl/ssl3.h @@ -388,6 +388,7 @@ typedef struct ssl3_buffer_st #define TLS1_FLAGS_TLS_PADDING_BUG 0x0008 #define TLS1_FLAGS_SKIP_CERT_VERIFY 0x0010 #define TLS1_FLAGS_KEEP_HANDSHAKE 0x0020 +#define SSL3_FLAGS_CCS_OK 0x0080 /* SSL3_FLAGS_SGC_RESTART_DONE is set when we * restart a handshake because of MS SGC and so prevents us diff --git a/crypto/openssl/ssl/ssl_asn1.c b/crypto/openssl/ssl/ssl_asn1.c index 38540be1e53..47750037102 100644 --- a/crypto/openssl/ssl/ssl_asn1.c +++ b/crypto/openssl/ssl/ssl_asn1.c @@ -408,6 +408,7 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, if (os.length != 3) { c.error=SSL_R_CIPHER_CODE_WRONG_LENGTH; + c.line=__LINE__; goto err; } id=0x02000000L| @@ -420,6 +421,7 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, if (os.length != 2) { c.error=SSL_R_CIPHER_CODE_WRONG_LENGTH; + c.line=__LINE__; goto err; } id=0x03000000L| @@ -429,6 +431,7 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, else { c.error=SSL_R_UNKNOWN_SSL_VERSION; + c.line=__LINE__; goto err; } @@ -521,6 +524,7 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, if (os.length > SSL_MAX_SID_CTX_LENGTH) { c.error=SSL_R_BAD_LENGTH; + c.line=__LINE__; goto err; } else diff --git a/crypto/openssl/ssl/ssl_err.c b/crypto/openssl/ssl/ssl_err.c index 370fb57e3b8..49ab43e0e52 100644 --- a/crypto/openssl/ssl/ssl_err.c +++ b/crypto/openssl/ssl/ssl_err.c @@ -541,7 +541,7 @@ static ERR_STRING_DATA SSL_str_reasons[]= {ERR_REASON(SSL_R_TLSV1_UNRECOGNIZED_NAME),"tlsv1 unrecognized name"}, {ERR_REASON(SSL_R_TLSV1_UNSUPPORTED_EXTENSION),"tlsv1 unsupported extension"}, {ERR_REASON(SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER),"tls client cert req with anon cipher"}, -{ERR_REASON(SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT),"peer does not accept heartbearts"}, +{ERR_REASON(SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT),"peer does not accept heartbeats"}, {ERR_REASON(SSL_R_TLS_HEARTBEAT_PENDING) ,"heartbeat request already pending"}, {ERR_REASON(SSL_R_TLS_ILLEGAL_EXPORTER_LABEL),"tls illegal exporter label"}, {ERR_REASON(SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST),"tls invalid ecpointformat list"}, diff --git a/crypto/openssl/ssl/ssl_lib.c b/crypto/openssl/ssl/ssl_lib.c index 6dbc3c1f7d0..ef6258ca9f0 100644 --- a/crypto/openssl/ssl/ssl_lib.c +++ b/crypto/openssl/ssl/ssl_lib.c @@ -1349,6 +1349,10 @@ char *SSL_get_shared_ciphers(const SSL *s,char *buf,int len) p=buf; sk=s->session->ciphers; + + if (sk_SSL_CIPHER_num(sk) == 0) + return NULL; + for (i=0; ilength; z++) printf("%02X ",rec->data[z]); printf("\n"); } #endif if (ssl->version != DTLS1_VERSION && ssl->version != DTLS1_BAD_VER) @@ -1185,7 +1181,7 @@ int tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen, if (memcmp(val, TLS_MD_KEY_EXPANSION_CONST, TLS_MD_KEY_EXPANSION_CONST_SIZE) == 0) goto err1; - rv = tls1_PRF(s->s3->tmp.new_cipher->algorithm2, + rv = tls1_PRF(ssl_get_algorithm2(s), val, vallen, NULL, 0, NULL, 0, diff --git a/crypto/openssl/ssl/t1_lib.c b/crypto/openssl/ssl/t1_lib.c index bddffd92cc0..3b8d5153eb6 100644 --- a/crypto/openssl/ssl/t1_lib.c +++ b/crypto/openssl/ssl/t1_lib.c @@ -617,6 +617,8 @@ unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsigned cha #ifndef OPENSSL_NO_HEARTBEATS /* Add Heartbeat extension */ + if ((limit - ret - 4 - 1) < 0) + return NULL; s2n(TLSEXT_TYPE_heartbeat,ret); s2n(1,ret); /* Set mode: @@ -661,36 +663,35 @@ unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsigned cha ret += el; } #endif - -#ifdef TLSEXT_TYPE_padding /* Add padding to workaround bugs in F5 terminators. * See https://tools.ietf.org/html/draft-agl-tls-padding-03 * * NB: because this code works out the length of all existing * extensions it MUST always appear last. */ - { - int hlen = ret - (unsigned char *)s->init_buf->data; - /* The code in s23_clnt.c to build ClientHello messages includes the - * 5-byte record header in the buffer, while the code in s3_clnt.c does - * not. */ - if (s->state == SSL23_ST_CW_CLNT_HELLO_A) - hlen -= 5; - if (hlen > 0xff && hlen < 0x200) + if (s->options & SSL_OP_TLSEXT_PADDING) { - hlen = 0x200 - hlen; - if (hlen >= 4) - hlen -= 4; - else - hlen = 0; + int hlen = ret - (unsigned char *)s->init_buf->data; + /* The code in s23_clnt.c to build ClientHello messages + * includes the 5-byte record header in the buffer, while + * the code in s3_clnt.c does not. + */ + if (s->state == SSL23_ST_CW_CLNT_HELLO_A) + hlen -= 5; + if (hlen > 0xff && hlen < 0x200) + { + hlen = 0x200 - hlen; + if (hlen >= 4) + hlen -= 4; + else + hlen = 0; - s2n(TLSEXT_TYPE_padding, ret); - s2n(hlen, ret); - memset(ret, 0, hlen); - ret += hlen; + s2n(TLSEXT_TYPE_padding, ret); + s2n(hlen, ret); + memset(ret, 0, hlen); + ret += hlen; + } } - } -#endif if ((extdatalen = ret-p-2)== 0) return p; @@ -845,6 +846,8 @@ unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *p, unsigned cha /* Add Heartbeat extension if we've received one */ if (s->tlsext_heartbeat & SSL_TLSEXT_HB_ENABLED) { + if ((limit - ret - 4 - 1) < 0) + return NULL; s2n(TLSEXT_TYPE_heartbeat,ret); s2n(1,ret); /* Set mode: diff --git a/etc/Makefile b/etc/Makefile index 03edb13d616..054b2d669ee 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -174,7 +174,10 @@ afterinstall: .endif distribute: - ${_+_}cd ${.CURDIR} ; ${MAKE} install DESTDIR=${DISTDIR}/${DISTRIBUTION} + # Avoid installing tests here; "make distribution" will do this and + # correctly place them in the right location. + ${_+_}cd ${.CURDIR} ; ${MAKE} MK_TESTS=no install \ + DESTDIR=${DISTDIR}/${DISTRIBUTION} ${_+_}cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION} .include @@ -237,7 +240,6 @@ distribution: ${_+_}cd ${.CURDIR}/periodic; ${MAKE} install ${_+_}cd ${.CURDIR}/pkg; ${MAKE} install ${_+_}cd ${.CURDIR}/rc.d; ${MAKE} install - ${_+_}cd ${.CURDIR}/../gnu/usr.bin/send-pr; ${MAKE} etc-gnats-freefall ${_+_}cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap ${_+_}cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt ${_+_}cd ${.CURDIR}/pam.d; ${MAKE} install diff --git a/etc/etc.amd64/ttys b/etc/etc.amd64/ttys index 42fa7c04ba7..8268df3e994 100644 --- a/etc/etc.amd64/ttys +++ b/etc/etc.amd64/ttys @@ -41,7 +41,7 @@ ttyv7 "/usr/libexec/getty Pc" xterm on secure ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure # Serial terminals # The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 "/usr/libexec/getty std.9600" dialup off secure +ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure ttyu1 "/usr/libexec/getty std.9600" dialup off secure ttyu2 "/usr/libexec/getty std.9600" dialup off secure ttyu3 "/usr/libexec/getty std.9600" dialup off secure diff --git a/etc/etc.i386/ttys b/etc/etc.i386/ttys index 42fa7c04ba7..8268df3e994 100644 --- a/etc/etc.i386/ttys +++ b/etc/etc.i386/ttys @@ -41,7 +41,7 @@ ttyv7 "/usr/libexec/getty Pc" xterm on secure ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure # Serial terminals # The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 "/usr/libexec/getty std.9600" dialup off secure +ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure ttyu1 "/usr/libexec/getty std.9600" dialup off secure ttyu2 "/usr/libexec/getty std.9600" dialup off secure ttyu3 "/usr/libexec/getty std.9600" dialup off secure diff --git a/etc/etc.ia64/ttys b/etc/etc.ia64/ttys deleted file mode 100644 index 6ddc77759ca..00000000000 --- a/etc/etc.ia64/ttys +++ /dev/null @@ -1,49 +0,0 @@ -# -# $FreeBSD$ -# @(#)ttys 5.1 (Berkeley) 4/17/89 -# -# This file specifies various information about terminals on the system. -# It is used by several different programs. Common entries for the -# various columns include: -# -# name The name of the terminal device. -# -# getty The program to start running on the terminal. Typically a -# getty program, as the name implies. Other common entries -# include none, when no getty is needed, and xdm, to start the -# X Window System. -# -# type The initial terminal type for this port. For hardwired -# terminal lines, this will contain the type of terminal used. -# For virtual consoles, the correct type is typically xterm. -# Other common values include dialup for incoming modem ports, and -# unknown when the terminal type cannot be predetermined. -# -# status Must be on or off. If on, init will run the getty program on -# the specified port. If the word "secure" appears, this tty -# allows root login. -# -# name getty type status comments -# -# If console is marked "insecure", then init will ask for the root password -# when going to single-user mode. -console none unknown off secure -# -ttyv0 "/usr/libexec/getty Pc" xterm off secure -# Virtual terminals -ttyv1 "/usr/libexec/getty Pc" xterm off secure -ttyv2 "/usr/libexec/getty Pc" xterm off secure -ttyv3 "/usr/libexec/getty Pc" xterm off secure -ttyv4 "/usr/libexec/getty Pc" xterm off secure -ttyv5 "/usr/libexec/getty Pc" xterm off secure -ttyv6 "/usr/libexec/getty Pc" xterm off secure -ttyv7 "/usr/libexec/getty Pc" xterm off secure -ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure -# Serial terminals. The 'dialup' keyword identifies dialin lines to login, -# fingerd etc. -ttyu0 "/usr/libexec/getty 3wire" vt100 on secure -ttyu1 "/usr/libexec/getty 3wire" vt100 on secure -ttyu2 "/usr/libexec/getty std.9600" dialup off secure -ttyu3 "/usr/libexec/getty std.9600" dialup off secure -# Dumb console -dcons "/usr/libexec/getty std.9600" vt100 off secure diff --git a/etc/mtree/BSD.include.dist b/etc/mtree/BSD.include.dist index 9394a4bed7e..3462d7ed9b9 100644 --- a/etc/mtree/BSD.include.dist +++ b/etc/mtree/BSD.include.dist @@ -92,7 +92,7 @@ .. .. clang - 3.4 + 3.4.1 .. .. crypto @@ -162,6 +162,8 @@ .. .. fs + cuse + .. devfs .. fdescfs diff --git a/etc/mtree/BSD.root.dist b/etc/mtree/BSD.root.dist index d1617c645a6..44620132499 100644 --- a/etc/mtree/BSD.root.dist +++ b/etc/mtree/BSD.root.dist @@ -34,14 +34,14 @@ .. dma .. - gnats - .. gss .. mail .. mtree .. + newsyslog.conf.d + .. ntp mode=0700 .. pam.d diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist index 2e6d30afa0c..4d6f18a287e 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -12,8 +12,6 @@ .. .. share - aclocal - .. atf .. doc @@ -23,6 +21,8 @@ .. tests bin + chown + .. date .. mv @@ -90,6 +90,10 @@ atf atf-check .. + atf-sh + .. + .. + rtld-elf .. .. sbin @@ -129,25 +133,7 @@ usr.bin apply .. - atf - atf-sh - .. - .. - calendar - .. - comm - .. - file2c - .. - join - .. - jot - .. - lastcomm - .. - m4 - .. - make + bmake archives fmt_44bsd .. @@ -245,6 +231,20 @@ .. .. .. + calendar + .. + comm + .. + file2c + .. + join + .. + jot + .. + lastcomm + .. + m4 + .. ncal .. printf @@ -255,6 +255,10 @@ .. tr .. + truncate + .. + units + .. uudecode .. uuencode @@ -262,6 +266,8 @@ xargs .. yacc + yacc + .. .. .. usr.sbin diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist index ff8b96faae5..084850014d0 100644 --- a/etc/mtree/BSD.usr.dist +++ b/etc/mtree/BSD.usr.dist @@ -101,6 +101,10 @@ .. include .. + includes + include + .. + .. .. bsdinstall .. @@ -297,8 +301,6 @@ .. csh .. - cvsup - .. diskless .. dma @@ -1404,6 +1406,12 @@ catalog .. .. + vt + fonts + .. + keymaps + .. + .. zoneinfo Africa .. diff --git a/etc/mtree/BSD.var.dist b/etc/mtree/BSD.var.dist index 67c7b016a9d..990c23c9abb 100644 --- a/etc/mtree/BSD.var.dist +++ b/etc/mtree/BSD.var.dist @@ -96,6 +96,8 @@ .. .. unbound uname=unbound gname=unbound mode=0755 + conf.d uname=unbound gname=unbound mode=0755 + .. .. yp .. diff --git a/etc/network.subr b/etc/network.subr index aa72749c696..f67622d51ef 100644 --- a/etc/network.subr +++ b/etc/network.subr @@ -132,13 +132,6 @@ ifconfig_up() _cfg=0 fi - # ifconfig_IF - ifconfig_args=`ifconfig_getargs $1` - if [ -n "${ifconfig_args}" ]; then - eval ${IFCONFIG_CMD} $1 ${ifconfig_args} - _cfg=0 - fi - # inet6 specific if ! noafif $1 && afexists inet6; then if checkyesno ipv6_activate_all_interfaces; then @@ -174,14 +167,24 @@ ifconfig_up() if [ -n "${_ipv6_opts}" ]; then ${IFCONFIG_CMD} $1 inet6 ${_ipv6_opts} fi + fi + # ifconfig_IF + ifconfig_args=`ifconfig_getargs $1` + if [ -n "${ifconfig_args}" ]; then + eval ${IFCONFIG_CMD} $1 ${ifconfig_args} + _cfg=0 + fi + + # inet6 specific + if ! noafif $1 && afexists inet6; then # ifconfig_IF_ipv6 ifconfig_args=`ifconfig_getargs $1 ipv6` if [ -n "${ifconfig_args}" ]; then # backward compatibility: inet6 keyword case "${ifconfig_args}" in :*|[0-9a-fA-F]*:*) - warn "\$ifconfig_$1_ipv6 needs " \ + warn "\$ifconfig_$1_ipv6 needs leading" \ "\"inet6\" keyword for an IPv6 address." ifconfig_args="inet6 ${ifconfig_args}" ;; @@ -1037,7 +1040,7 @@ ifalias_af_common_handler() case $_c in ${_af}) case $_tmpargs in - ${_af}\ *-*) + ${_af}\ *[0-9a-fA-F]-*) ifalias_af_common_handler $_if $_af $_action \ `ifalias_expand_addr $_af $_action ${_tmpargs#${_af}\ }` ;; @@ -1055,7 +1058,7 @@ ifalias_af_common_handler() # Process the last component if any. if [ -n "$_tmpargs}" ]; then case $_tmpargs in - ${_af}\ *-*) + ${_af}\ *[0-9a-fA-F]-*) ifalias_af_common_handler $_if $_af $_action \ `ifalias_expand_addr $_af $_action ${_tmpargs#${_af}\ }` ;; @@ -1074,7 +1077,7 @@ ifalias_af_common_handler() ifalias_af_common() { local _ret _if _af _action alias ifconfig_args _aliasn _c _tmpargs _iaf - local _punct=".-/+" + local _vif _punct=".-/+" _ret=1 _aliasn= @@ -1083,11 +1086,11 @@ ifalias_af_common() _action=$3 # Normalize $_if before using it in a pattern to list_vars() - ltr "$_if" "$_punct" "_" _if + ltr "$_if" "$_punct" "_" _vif # ifconfig_IF_aliasN which starts with $_af - for alias in `list_vars ifconfig_${_if}_alias[0-9]\* | - sort_lite -nk1.$((9+${#_if}+7))` + for alias in `list_vars ifconfig_${_vif}_alias[0-9]\* | + sort_lite -nk1.$((9+${#_vif}+7))` do eval ifconfig_args=\"\$$alias\" _iaf= @@ -1107,7 +1110,7 @@ ifalias_af_common() ;; inet:alias:"":*) _aliasn="$_aliasn inet $ifconfig_args" - warn "\$ifconfig_${_if}_alias${alias} needs " \ + warn "\$${alias} needs leading" \ "\"inet\" keyword for an IPv4 address." esac done @@ -1115,8 +1118,8 @@ ifalias_af_common() # backward compatibility: ipv6_ifconfig_IF_aliasN. case $_af in inet6) - for alias in `list_vars ipv6_ifconfig_${_if}_alias[0-9]\* | - sort_lite -nk1.$((14+${#_if}+7))` + for alias in `list_vars ipv6_ifconfig_${_vif}_alias[0-9]\* | + sort_lite -nk1.$((14+${#_vif}+7))` do eval ifconfig_args=\"\$$alias\" case ${_action}:"${ifconfig_args}" in @@ -1125,9 +1128,8 @@ ifalias_af_common() ;; alias:*) _aliasn="${_aliasn} inet6 ${ifconfig_args}" - warn "\$ipv6_ifconfig_${_if}_alias${alias} " \ - "is obsolete. Use ifconfig_$1_aliasN " \ - "instead." + warn "\$${alias} is obsolete. " \ + "Use ifconfig_${_vif}_aliasN instead." ;; esac done diff --git a/etc/newsyslog.conf b/etc/newsyslog.conf index 9572f84efd1..ab595cac61d 100644 --- a/etc/newsyslog.conf +++ b/etc/newsyslog.conf @@ -38,3 +38,6 @@ /var/log/utx.log 644 3 * @01T05 B /var/log/weekly.log 640 5 * $W6D0 JN /var/log/xferlog 600 7 100 * JC + + /etc/newsyslog.conf.d/* + /usr/local/etc/newsyslog.conf.d/* diff --git a/etc/sendmail/freebsd.mc b/etc/sendmail/freebsd.mc index 9a9142573a5..7ab7386fa2b 100644 --- a/etc/sendmail/freebsd.mc +++ b/etc/sendmail/freebsd.mc @@ -33,7 +33,6 @@ divert(-1) # SUCH DAMAGE. # - # # This is a generic configuration file for FreeBSD 6.X and later systems. # If you want to customize it, copy it to a name appropriate for your diff --git a/etc/sendmail/freebsd.submit.mc b/etc/sendmail/freebsd.submit.mc index fbb036cd63b..c6ec6555359 100644 --- a/etc/sendmail/freebsd.submit.mc +++ b/etc/sendmail/freebsd.submit.mc @@ -9,7 +9,6 @@ divert(-1) # # - # # This is the FreeBSD configuration for a set-group-ID sm-msp sendmail # that acts as a initial mail submission program. diff --git a/etc/snmpd.config b/etc/snmpd.config index 86b09899412..98399caa473 100644 --- a/etc/snmpd.config +++ b/etc/snmpd.config @@ -278,6 +278,11 @@ begemotSnmpdModulePath."mibII" = "/usr/lib/snmp_mibII.so" #%netgraph #begemotNgControlNodeName = "snmpd" +# +# LM75 Sensor module +# +#begemotSnmpdModulePath."lm75" = "/usr/lib/snmp_lm75.so" + # # pf(4) module # diff --git a/games/fortune/datfiles/fortunes b/games/fortune/datfiles/fortunes index 790c39ee07a..d7fecf4e2cc 100644 --- a/games/fortune/datfiles/fortunes +++ b/games/fortune/datfiles/fortunes @@ -570,7 +570,7 @@ writing. Always pick on the correct idiom. The adverb always follows the verb. Last but not least, avoid cliches like the plague; seek viable alternatives. % - 1/2 + 1/3 /\(3) | 2 1/3 | z dz cos(3 * PI / 9) = ln (e ) @@ -578,7 +578,7 @@ viable alternatives. \/ 1 The integral of z squared, dz -From 1 to the square root of 3 +From 1 to the cube root of 3 Times the cosine Of 3 PI over nine Is the log of the cube root of e diff --git a/games/fortune/datfiles/freebsd-tips b/games/fortune/datfiles/freebsd-tips index 5f9dd49eda3..b984d100e90 100644 --- a/games/fortune/datfiles/freebsd-tips +++ b/games/fortune/datfiles/freebsd-tips @@ -231,10 +231,10 @@ is running FreeBSD at the time) to quickly find files based on name only. To erase a line you've written at the command prompt, use "Ctrl-U". -- Dru % -To find out the hostname associated with an IP address, use +To find the hostname associated with an IP address, use - dig -x IP_address - -- Dru + drill -x IP_address + -- Allan Jude % To obtain a neat PostScript rendering of a manual page, use ``-t'' switch of the man(1) utility: ``man -t ''. For example: diff --git a/games/fortune/fortune/pathnames.h b/games/fortune/fortune/pathnames.h index d777c6d3844..149b3e8d56b 100644 --- a/games/fortune/fortune/pathnames.h +++ b/games/fortune/fortune/pathnames.h @@ -30,4 +30,5 @@ * $FreeBSD$ */ -#define FORTDIR "/usr/share/games/fortune" +#define FORTDIR "/usr/share/games/fortune:" \ + "/usr/local/share/games/fortune" diff --git a/games/grdc/Makefile b/games/grdc/Makefile index 6b1d6ee8034..73d395ae33d 100644 --- a/games/grdc/Makefile +++ b/games/grdc/Makefile @@ -2,7 +2,7 @@ PROG= grdc MAN= grdc.6 -DPADD= ${LIBNCURSES} -LDADD= -lncurses +DPADD= ${LIBNCURSESW} +LDADD= -lncursesw .include diff --git a/games/grdc/Makefile.depend b/games/grdc/Makefile.depend index 4f4df6520bd..a25f5f6a245 100644 --- a/games/grdc/Makefile.depend +++ b/games/grdc/Makefile.depend @@ -10,7 +10,6 @@ DIRDEPS = \ lib/${CSU_DIR} \ lib/libc \ lib/libcompiler_rt \ - lib/ncurses/ncurses \ lib/ncurses/ncursesw \ diff --git a/games/morse/morse.6 b/games/morse/morse.6 index f0d30d7299f..94645bbf5c7 100644 --- a/games/morse/morse.6 +++ b/games/morse/morse.6 @@ -177,7 +177,7 @@ device file Sound support for .Nm added by -.An Lyndon Nerenberg (VE6BBM) Aq lyndon@orthanc.ca . +.An Lyndon Nerenberg (VE6BBM) Aq Mt lyndon@orthanc.ca . .Pp Ability to key an external device added by .An J\(:org Wunsch diff --git a/games/random/random.6 b/games/random/random.6 index 54815766956..bd38ba628eb 100644 --- a/games/random/random.6 +++ b/games/random/random.6 @@ -117,7 +117,7 @@ instead of newlines. .Sh HISTORY The functionality to randomizing lines and words was added in 2003 by -.An "Sean Chittenden" Aq seanc@FreeBSD.org . +.An Sean Chittenden Aq Mt seanc@FreeBSD.org . .Sh BUGS No index is used when printing out tokens from the list which makes it rather slow for large files (10MB+). diff --git a/gnu/lib/Makefile b/gnu/lib/Makefile index 2651eef5abd..373c2805fd6 100644 --- a/gnu/lib/Makefile +++ b/gnu/lib/Makefile @@ -14,7 +14,7 @@ SUBDIR+= tests # libsupc++ uses libstdc++ headers, although 'make includes' should # have taken care of that already. -.if ${MK_GNUCXX} != "no" && ${MK_CXX} != "no" +.if ${MK_GNUCXX} != "no" SUBDIR+= libstdc++ libsupc++ .endif diff --git a/gnu/lib/csu/Makefile b/gnu/lib/csu/Makefile index 0a2c7d35ea6..e1b759af322 100644 --- a/gnu/lib/csu/Makefile +++ b/gnu/lib/csu/Makefile @@ -28,13 +28,6 @@ MKDEP= -DCRT_BEGIN CFLAGS+= -DTARGET_ARM_EABI .endif -.if ${MACHINE_CPUARCH} == "ia64" -BEGINSRC= crtbegin.asm -ENDSRC= crtend.asm -CFLAGS+= -x assembler-with-cpp # Ugly hack -CFLAGS+= -include osreldate.h -.undef SRCS # hack for 'make depend' -.endif .if ${MACHINE_CPUARCH} == "powerpc" TGTOBJS= crtsavres.o SRCS+= crtsavres.asm @@ -73,7 +66,7 @@ crtendS.o: ${ENDSRC} CLEANFILES+= tm.h tconfig.h options.h optionlist cs-tconfig.h cs-tm.h tm.h tconfig.h options.h: ${CCDIR}/cc_tools/Makefile - ${MAKE} -f ${.ALLSRC} MFILE=${.ALLSRC} GCCDIR=${GCCDIR} ${.TARGET} + (cd ${.CURDIR}; ${MAKE} -f ${.ALLSRC} MFILE=${.ALLSRC} GCCDIR=${GCCDIR} ${.TARGET}) realinstall: .for file in ${OBJS} ${SOBJS} ${TGTOBJS} diff --git a/gnu/lib/csu/Makefile.depend b/gnu/lib/csu/Makefile.depend index dc4c8629b6e..2c6edc6c212 100644 --- a/gnu/lib/csu/Makefile.depend +++ b/gnu/lib/csu/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ include \ include/xlocale \ diff --git a/gnu/lib/libgcc/Makefile b/gnu/lib/libgcc/Makefile index 11af4305edb..f0e48349a7f 100644 --- a/gnu/lib/libgcc/Makefile +++ b/gnu/lib/libgcc/Makefile @@ -137,17 +137,6 @@ LIB2FUNCS_EXTRA+= fixdfdi.c fixunssfsi.c .endif .endif -.if ${TARGET_CPUARCH} == "ia64" -# from config/ia64/t-ia64 -LIB1ASMSRC = lib1funcs.asm -LIB1ASMFUNCS = __divxf3 __divdf3 __divsf3 \ - __divdi3 __moddi3 __udivdi3 __umoddi3 \ - __divsi3 __modsi3 __udivsi3 __umodsi3 __save_stack_nonlocal \ - __nonlocal_goto __restore_stack_nonlocal __trampoline \ - _fixtfdi _fixunstfdi _floatditf -LIB2ADDEH = unwind-ia64.c unwind-sjlj.c unwind-c.c -.endif - .if ${TARGET_ARCH} == "powerpc" # from config/rs6000/t-ppccomm LIB2FUNCS_EXTRA = tramp.asm @@ -317,7 +306,7 @@ ${_src:R:S/$/.So/}: ${_src} ${COMMONHDRS} # Generated headers # ${COMMONHDRS}: ${.CURDIR}/../../usr.bin/cc/cc_tools/Makefile - ${MAKE} -f ${.ALLSRC} MFILE=${.ALLSRC} GCCDIR=${GCCDIR} ${.TARGET} + (cd ${.CURDIR}; ${MAKE} -f ${.ALLSRC} MFILE=${.ALLSRC} GCCDIR=${GCCDIR} ${.TARGET}) CLEANFILES += ${COMMONHDRS} CLEANFILES += cs-*.h option* diff --git a/gnu/lib/libgcc/Makefile.depend b/gnu/lib/libgcc/Makefile.depend index 5a788db1e04..bc6313842e1 100644 --- a/gnu/lib/libgcc/Makefile.depend +++ b/gnu/lib/libgcc/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ include \ include/xlocale \ diff --git a/gnu/lib/libgcov/Makefile b/gnu/lib/libgcov/Makefile index 5292f9f8d53..e2b80744cf5 100644 --- a/gnu/lib/libgcov/Makefile +++ b/gnu/lib/libgcov/Makefile @@ -46,7 +46,7 @@ COMMONHDRS= tm.h tconfig.h gcov-iov.h options.h CLEANFILES+= ${COMMONHDRS} cs-tm.h cs-tconfig.h options.h optionlist ${COMMONHDRS}: ${.CURDIR}/../../usr.bin/cc/cc_tools/Makefile - ${MAKE} -f ${.ALLSRC} MFILE=${.ALLSRC} GCCDIR=${GCCDIR} ${.TARGET} + (cd ${.CURDIR}; ${MAKE} -f ${.ALLSRC} MFILE=${.ALLSRC} GCCDIR=${GCCDIR} ${.TARGET}) ${OBJS} beforedepend: ${COMMONHDRS} diff --git a/gnu/lib/libreadline/Makefile b/gnu/lib/libreadline/Makefile index 637dcc8a573..c2bfa669731 100644 --- a/gnu/lib/libreadline/Makefile +++ b/gnu/lib/libreadline/Makefile @@ -1,5 +1,5 @@ # $FreeBSD$ -SUBDIR = history readline +SUBDIR = readline .include diff --git a/gnu/lib/libreadline/readline/Makefile b/gnu/lib/libreadline/readline/Makefile index fab4aa23051..ce1fec19c2b 100644 --- a/gnu/lib/libreadline/readline/Makefile +++ b/gnu/lib/libreadline/readline/Makefile @@ -1,10 +1,8 @@ # $FreeBSD$ -SUBDIR= doc - LIB= readline -MAN= doc/readline.3 -SHLIBDIR?= /lib +INTERNALLIB= yes +NO_MAN= yes TILDESRC= tilde.c SRCS= readline.c vi_mode.c funmap.c keymaps.c parens.c search.c \ @@ -15,13 +13,17 @@ SRCS= readline.c vi_mode.c funmap.c keymaps.c parens.c search.c \ INSTALLED_HEADERS= readline.h chardefs.h keymaps.h history.h tilde.h \ rlstdc.h rlconf.h rltypedefs.h -DPADD= ${LIBTERMCAP} -LDADD= -ltermcap +CFLAGS+= -I${.OBJDIR}/.. +SRCDIR= ${.CURDIR}/../../../../contrib/libreadline -INCSDIR=${INCLUDEDIR}/readline - -.for hdr in ${INSTALLED_HEADERS} -INCS+= ${SRCDIR}/${hdr} +CLEANFILES+= ${INSTALLED_HEADERS} +beforebuild: ${INSTALLED_HEADERS} +.for h in ${INSTALLED_HEADERS} +$h: ${SRCDIR}/$h + ln -sf ${SRCDIR}/$h $h .endfor +DPADD= ${LIBTERMCAPW} +LDADD= -ltermcapw + .include diff --git a/gnu/lib/libreadline/readline/Makefile.depend b/gnu/lib/libreadline/readline/Makefile.depend index c2340200550..bc5416fdbaa 100644 --- a/gnu/lib/libreadline/readline/Makefile.depend +++ b/gnu/lib/libreadline/readline/Makefile.depend @@ -3,16 +3,9 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ - gnu/lib/csu \ - gnu/lib/libgcc \ include \ include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcompiler_rt \ - lib/ncurses/ncurses \ lib/ncurses/ncursesw \ - usr.bin/xinstall.host \ .include diff --git a/gnu/lib/libreadline/readline/doc/Makefile b/gnu/lib/libreadline/readline/doc/Makefile deleted file mode 100644 index 70289718f5e..00000000000 --- a/gnu/lib/libreadline/readline/doc/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# $FreeBSD$ - -SRCDIR= ${.CURDIR}/../../../../../contrib/libreadline/doc - -INFO = readline rluserman - -INFOSECTION= "Programming & development tools." -INFOENTRY_readline= "* Readline: (readline). The GNU Readline library" -INFOENTRY_rluserman= "* Readline: (readline). The GNU readline library API" - -CLEANFILES += readline.texi - -readline.info: rlman.texi rluser.texi rltech.texi version.texi fdl.texi - -readline.texi: rlman.texi - cp -f ${SRCDIR}/rlman.texi ${.TARGET} - -rluserman.info: rluserman.texi version.texi rluser.texi fdl.texi - -.include diff --git a/gnu/lib/libstdc++/Makefile b/gnu/lib/libstdc++/Makefile index dffb5632c0e..fa1d67e7ce6 100644 --- a/gnu/lib/libstdc++/Makefile +++ b/gnu/lib/libstdc++/Makefile @@ -632,8 +632,9 @@ ${VERSION_MAP}: ${SRCDIR}/config/abi/pre/gnu.ver CLEANFILES+= ${VERSION_MAP} +CXXFLAGS.clang+= -stdlib=libstdc++ + .include -CXXFLAGS.clang+= -stdlib=libstdc++ -CXXFLAGS+= -std=gnu++98 - +# Filter out libc++-specific flags, and -std= flags above c++98 or gnu++98. +CXXFLAGS:= ${CXXFLAGS:N-stdlib=libc++:N-std=c++[01][13x]:N-std=gnu++[01][13x]} diff --git a/gnu/lib/libsupc++/Makefile b/gnu/lib/libsupc++/Makefile index a172a6ed08a..c7cc30e5378 100644 --- a/gnu/lib/libsupc++/Makefile +++ b/gnu/lib/libsupc++/Makefile @@ -51,8 +51,9 @@ CLEANFILES+= unwind.h VERSION_MAP= ${.CURDIR}/Version.map +CXXFLAGS.clang+= -stdlib=libstdc++ .include -CXXFLAGS.clang+= -stdlib=libstdc++ -CXXFLAGS+= -std=gnu++98 +# Filter out libc++-specific flags, and -std= flags above c++98 or gnu++98. +CXXFLAGS:= ${CXXFLAGS:N-stdlib=libc++:N-std=c++[01][13x]:N-std=gnu++[01][13x]} diff --git a/gnu/usr.bin/Makefile b/gnu/usr.bin/Makefile index 76330699dff..7b1482d5359 100644 --- a/gnu/usr.bin/Makefile +++ b/gnu/usr.bin/Makefile @@ -14,7 +14,6 @@ SUBDIR= ${_binutils} \ ${_groff} \ ${_rcs} \ sdiff \ - send-pr \ ${_tests} \ ${_texinfo} diff --git a/gnu/usr.bin/binutils/addr2line/Makefile b/gnu/usr.bin/binutils/addr2line/Makefile index 2380738fa63..37649fa2e11 100644 --- a/gnu/usr.bin/binutils/addr2line/Makefile +++ b/gnu/usr.bin/binutils/addr2line/Makefile @@ -14,4 +14,6 @@ DPADD+= ${RELTOP}/libbfd/libbfd.a DPADD+= ${RELTOP}/libiberty/libiberty.a LDADD= ${DPADD} +NO_PIE= yes + .include diff --git a/gnu/usr.bin/binutils/as/ia64-freebsd/targ-cpu.h b/gnu/usr.bin/binutils/as/ia64-freebsd/targ-cpu.h deleted file mode 100644 index a0a6360d68e..00000000000 --- a/gnu/usr.bin/binutils/as/ia64-freebsd/targ-cpu.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $FreeBSD$ */ - -#include "tc-ia64.h" diff --git a/gnu/usr.bin/binutils/ld/Makefile b/gnu/usr.bin/binutils/ld/Makefile index 81a46d5d21b..6c59945808a 100644 --- a/gnu/usr.bin/binutils/ld/Makefile +++ b/gnu/usr.bin/binutils/ld/Makefile @@ -5,10 +5,6 @@ .PATH: ${SRCDIR}/ld -.if ${TARGET_ARCH} == "ia64" -CFLAGS+= -O1 -.endif - PROG= ld SCRIPTDIR= /usr/libdata/ldscripts SRCS+= ldcref.c \ diff --git a/gnu/usr.bin/binutils/ld/Makefile.depend.amd64 b/gnu/usr.bin/binutils/ld/Makefile.depend.amd64 index 9a0d07116a1..65ee0abc784 100644 --- a/gnu/usr.bin/binutils/ld/Makefile.depend.amd64 +++ b/gnu/usr.bin/binutils/ld/Makefile.depend.amd64 @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/usr.bin/binutils/libbfd \ gnu/usr.bin/binutils/libiberty \ diff --git a/gnu/usr.bin/binutils/ld/Makefile.ia64 b/gnu/usr.bin/binutils/ld/Makefile.ia64 deleted file mode 100644 index 50a7bb63a63..00000000000 --- a/gnu/usr.bin/binutils/ld/Makefile.ia64 +++ /dev/null @@ -1,24 +0,0 @@ -# $FreeBSD$ - -NATIVE_EMULATION= elf64_ia64_fbsd - -SRCS+= e${NATIVE_EMULATION}.c -CLEANFILES+= e${NATIVE_EMULATION}.c -e${NATIVE_EMULATION}.c: ${.CURDIR}/${NATIVE_EMULATION}.sh emultempl/elf32.em \ - scripttempl/elf.sc genscripts.sh stringify.sed - sh ${.CURDIR}/genscripts.sh ${SRCDIR}/ld ${LIBSEARCHPATH} \ - ${TOOLS_PREFIX}/usr \ - ${HOST} ${TARGET_TUPLE} ${TARGET_TUPLE} \ - ${NATIVE_EMULATION} "" no ${NATIVE_EMULATION} ${TARGET_TUPLE} \ - ${.CURDIR}/${NATIVE_EMULATION}.sh - -#XXX EMS+= eelf64_ia64 - -SRCS+= eelf64_ia64.c -CLEANFILES+= eelf64_ia64.c -eelf64_ia64.c: emulparams/elf64_ia64.sh emultempl/elf32.em \ - scripttempl/elf.sc genscripts.sh stringify.sed - sh ${.CURDIR}/genscripts.sh ${SRCDIR}/ld ${LIBSEARCHPATH} \ - ${TOOLS_PREFIX}/usr \ - ${HOST} ${TARGET_TUPLE} ${TARGET_TUPLE} \ - elf64_ia64 "" no elf64_ia64 ${TARGET_TUPLE} diff --git a/gnu/usr.bin/binutils/ld/elf64_ia64_fbsd.sh b/gnu/usr.bin/binutils/ld/elf64_ia64_fbsd.sh deleted file mode 100644 index 213b494736f..00000000000 --- a/gnu/usr.bin/binutils/ld/elf64_ia64_fbsd.sh +++ /dev/null @@ -1,8 +0,0 @@ -# $FreeBSD$ -. ${srcdir}/emulparams/elf64_ia64.sh -TEXT_START_ADDR="0x0000000100000000" -unset DATA_ADDR -unset SMALL_DATA_CTOR -unset SMALL_DATA_DTOR -. ${srcdir}/emulparams/elf_fbsd.sh -OUTPUT_FORMAT="elf64-ia64-freebsd" diff --git a/gnu/usr.bin/binutils/libbfd/Makefile b/gnu/usr.bin/binutils/libbfd/Makefile index 1493ccf07e8..a24dd045bec 100644 --- a/gnu/usr.bin/binutils/libbfd/Makefile +++ b/gnu/usr.bin/binutils/libbfd/Makefile @@ -42,7 +42,7 @@ SRCS+= archive.c \ targets.c \ targmatch.h \ tekhex.c -.if (${TARGET_ARCH} == "ia64" || ${TARGET_ARCH} == "sparc64") +.if ${TARGET_ARCH} == "sparc64" WARNS?= 2 .endif CFLAGS+= -D_GNU_SOURCE @@ -84,7 +84,7 @@ bfdver.h: Makefile echo '#define BFD_VERSION 217500000' > ${.TARGET} echo '#define BFD_VERSION_DATE 20070703' >> ${.TARGET} echo '#define BFD_VERSION_STRING ${VERSION}' >> ${.TARGET} - echo '#define REPORT_BUGS_TO ""' >> ${.TARGET} + echo '#define REPORT_BUGS_TO ""' >> ${.TARGET} targmatch.h: targmatch.sed config.bfd sed -f ${.ALLSRC:M*.sed} ${.ALLSRC:M*.bfd} > ${.TARGET} diff --git a/gnu/usr.bin/binutils/libbfd/Makefile.ia64 b/gnu/usr.bin/binutils/libbfd/Makefile.ia64 deleted file mode 100644 index 2e489bcc62e..00000000000 --- a/gnu/usr.bin/binutils/libbfd/Makefile.ia64 +++ /dev/null @@ -1,35 +0,0 @@ -# $FreeBSD$ - -DEFAULT_VECTOR= bfd_elf64_ia64_freebsd_vec - -SRCS+= cofflink.c \ - cpu-ia64.c \ - efi-app-ia64.c \ - elf32.c \ - elf32-gen.c \ - elf32-target.h \ - elf64.c \ - elf64-gen.c \ - elf64-ia64.c \ - elf64-target.h \ - elflink.c \ - pepigen.c \ - pex64igen.c - -VECS+= ${DEFAULT_VECTOR} \ - bfd_efi_app_ia64_vec \ - bfd_elf64_ia64_little_vec \ - bfd_elf64_ia64_big_vec \ - bfd_elf64_little_generic_vec bfd_elf64_big_generic_vec \ - bfd_elf32_little_generic_vec bfd_elf32_big_generic_vec - -CLEANFILES+= elf64-ia64.c pepigen.c pex64igen.c - -elf64-ia64.c: elfxx-ia64.c - sed -e s/NN/64/g ${.ALLSRC} > ${.TARGET} - -pepigen.c: peXXigen.c - sed -e s/XX/pep/g ${.ALLSRC} > ${.TARGET} - -pex64igen.c: peXXigen.c - sed -e s/XX/pex64/g ${.ALLSRC} > ${.TARGET} diff --git a/gnu/usr.bin/binutils/libbfd/bfd.h b/gnu/usr.bin/binutils/libbfd/bfd.h index c9dfef54ae2..f65123351d7 100644 --- a/gnu/usr.bin/binutils/libbfd/bfd.h +++ b/gnu/usr.bin/binutils/libbfd/bfd.h @@ -85,7 +85,7 @@ extern "C" { #define BFD_HOST_64BIT_LONG 0 #define BFD_HOST_64_BIT long long #define BFD_HOST_U_64_BIT unsigned long long -#elif defined(__alpha__) || defined(__sparc64__) || defined(__amd64__) || defined(__ia64__) +#elif defined(__alpha__) || defined(__sparc64__) || defined(__amd64__) #define BFD_HOST_64BIT_LONG 1 #define BFD_HOST_64_BIT long #define BFD_HOST_U_64_BIT unsigned long diff --git a/gnu/usr.bin/binutils/libopcodes/Makefile.ia64 b/gnu/usr.bin/binutils/libopcodes/Makefile.ia64 deleted file mode 100644 index 98198cdea10..00000000000 --- a/gnu/usr.bin/binutils/libopcodes/Makefile.ia64 +++ /dev/null @@ -1,4 +0,0 @@ -# $FreeBSD$ - -SRCS+= ia64-dis.c ia64-opc.c -CFLAGS+= -DARCH_ia64 diff --git a/gnu/usr.bin/binutils/nm/Makefile b/gnu/usr.bin/binutils/nm/Makefile index 4ef2b8fdf65..5945d25adfc 100644 --- a/gnu/usr.bin/binutils/nm/Makefile +++ b/gnu/usr.bin/binutils/nm/Makefile @@ -15,4 +15,6 @@ DPADD+= ${RELTOP}/libbfd/libbfd.a DPADD+= ${RELTOP}/libiberty/libiberty.a LDADD= ${DPADD} +NO_PIE= yes + .include diff --git a/gnu/usr.bin/binutils/objcopy/Makefile b/gnu/usr.bin/binutils/objcopy/Makefile index 66d99f4e753..c23e1e85662 100644 --- a/gnu/usr.bin/binutils/objcopy/Makefile +++ b/gnu/usr.bin/binutils/objcopy/Makefile @@ -14,4 +14,6 @@ DPADD+= ${RELTOP}/libbfd/libbfd.a DPADD+= ${RELTOP}/libiberty/libiberty.a LDADD= ${DPADD} +NO_PIE= yes + .include diff --git a/gnu/usr.bin/binutils/objdump/Makefile b/gnu/usr.bin/binutils/objdump/Makefile index 1a0d04625d1..fb275ac6a40 100644 --- a/gnu/usr.bin/binutils/objdump/Makefile +++ b/gnu/usr.bin/binutils/objdump/Makefile @@ -16,4 +16,6 @@ DPADD+= ${RELTOP}/libbfd/libbfd.a DPADD+= ${RELTOP}/libiberty/libiberty.a LDADD= ${DPADD} +NO_PIE= yes + .include diff --git a/gnu/usr.bin/binutils/readelf/Makefile b/gnu/usr.bin/binutils/readelf/Makefile index d90c3bcc9cc..fd3110d0654 100644 --- a/gnu/usr.bin/binutils/readelf/Makefile +++ b/gnu/usr.bin/binutils/readelf/Makefile @@ -17,4 +17,6 @@ DPADD+= ${RELTOP}/libbfd/libbfd.a DPADD+= ${RELTOP}/libiberty/libiberty.a LDADD= ${DPADD} +NO_PIE= yes + .include diff --git a/gnu/usr.bin/binutils/size/Makefile b/gnu/usr.bin/binutils/size/Makefile index c5c19c1908e..a22e67f22e2 100644 --- a/gnu/usr.bin/binutils/size/Makefile +++ b/gnu/usr.bin/binutils/size/Makefile @@ -14,4 +14,6 @@ DPADD+= ${RELTOP}/libbfd/libbfd.a DPADD+= ${RELTOP}/libiberty/libiberty.a LDADD= ${DPADD} +NO_PIE= yes + .include diff --git a/gnu/usr.bin/binutils/strings/Makefile b/gnu/usr.bin/binutils/strings/Makefile index a432d51ddf6..0ff82eb0ba2 100644 --- a/gnu/usr.bin/binutils/strings/Makefile +++ b/gnu/usr.bin/binutils/strings/Makefile @@ -14,4 +14,6 @@ DPADD+= ${RELTOP}/libbfd/libbfd.a DPADD+= ${RELTOP}/libiberty/libiberty.a LDADD= ${DPADD} +NO_PIE= yes + .include diff --git a/gnu/usr.bin/binutils/strip/Makefile b/gnu/usr.bin/binutils/strip/Makefile index d3cf8c454cd..6d170673d01 100644 --- a/gnu/usr.bin/binutils/strip/Makefile +++ b/gnu/usr.bin/binutils/strip/Makefile @@ -15,4 +15,6 @@ DPADD+= ${RELTOP}/libiberty/libiberty.a LDADD= ${DPADD} INSTALLFLAGS= -S +NO_PIE= yes + .include diff --git a/gnu/usr.bin/cc/Makefile b/gnu/usr.bin/cc/Makefile index 313aaf2da84..8191ea412a4 100644 --- a/gnu/usr.bin/cc/Makefile +++ b/gnu/usr.bin/cc/Makefile @@ -12,12 +12,7 @@ SUBDIR+= cpp .endif .if ${MK_CXX} != "no" -.if ${MK_GNUCXX} != "no" -SUBDIR+= cc1plus c++ -.endif -# This should be moved into the above block once c++filt from elftoolchain or -# similar is provided. -SUBDIR+= c++filt +SUBDIR+= cc1plus c++ c++filt .endif .if ${MK_GCOV} != "no" diff --git a/gnu/usr.bin/cc/Makefile.tgt b/gnu/usr.bin/cc/Makefile.tgt index 48cc774291f..ee5a7946452 100644 --- a/gnu/usr.bin/cc/Makefile.tgt +++ b/gnu/usr.bin/cc/Makefile.tgt @@ -11,9 +11,6 @@ TARGET_CPUARCH=${MACHINE_CPUARCH} TARGET_ARCH?= ${MACHINE_ARCH} GCC_CPU=${TARGET_CPUARCH:C/amd64/i386/:C/powerpc/rs6000/:C/sparc64/sparc/} -.if ${TARGET_ARCH} == "ia64" -TARGET_CPU_DEFAULT= MASK_GNU_AS|MASK_GNU_LD -.endif .if ${TARGET_ARCH} == "sparc64" TARGET_CPU_DEFAULT= TARGET_CPU_ultrasparc .endif diff --git a/gnu/usr.bin/cc/include/Makefile b/gnu/usr.bin/cc/include/Makefile index c48975e8f30..48060ecc775 100644 --- a/gnu/usr.bin/cc/include/Makefile +++ b/gnu/usr.bin/cc/include/Makefile @@ -12,8 +12,6 @@ INCSDIR=${INCLUDEDIR}/gcc/${GCCVER} INCS= ammintrin.h emmintrin.h mmintrin.h mm3dnow.h pmmintrin.h \ tmmintrin.h xmmintrin.h mm_malloc.h INCS+= wmmintrin.h __wmmintrin_aes.h __wmmintrin_pclmul.h -.elif ${TARGET_ARCH} == "ia64" -INCS= ia64intrin.h .elif ${TARGET_ARCH} == "arm" INCS= mmintrin.h .elif ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "powerpc64" diff --git a/gnu/usr.bin/dialog/Makefile b/gnu/usr.bin/dialog/Makefile index a7e0a57ad59..f9281c8fd68 100644 --- a/gnu/usr.bin/dialog/Makefile +++ b/gnu/usr.bin/dialog/Makefile @@ -3,21 +3,11 @@ DIALOG= ${.CURDIR}/../../../contrib/dialog PROG= dialog -DPADD= ${LIBDIALOG} ${LIBM} -LDADD= -ldialog -lm +DPADD= ${LIBDIALOG} ${LIBNCURSESW} ${LIBM} +LDADD= -ldialog -lncursesw -lm CFLAGS+= -I${.CURDIR} -I${DIALOG} .PATH: ${DIALOG} WARNS?= 6 -.include - -.if ${MK_NCURSESW} == "no" -DPADD+= ${LIBNCURSES} -LDADD+= -lncurses -.else -DPADD+= ${LIBNCURSESW} -LDADD+= -lncursesw -.endif - .include diff --git a/gnu/usr.bin/gdb/Makefile.inc b/gnu/usr.bin/gdb/Makefile.inc index 6679022a1bd..4912e0c6812 100644 --- a/gnu/usr.bin/gdb/Makefile.inc +++ b/gnu/usr.bin/gdb/Makefile.inc @@ -15,6 +15,8 @@ CNTRB_RL= ${CNTRB_ROOT}/libreadline OBJ_ROOT= ${.OBJDIR}/../.. OBJ_BU= ${OBJ_ROOT}/binutils OBJ_GDB= ${OBJ_ROOT}/gdb +OBJ_RL= ${OBJ_ROOT}/../lib/libreadline/readline +LIBREADLINE= ${OBJ_ROOT}/../lib/libreadline/readline/libreadline.a # These assignments duplicate much of the functionality of # MACHINE_CPUARCH, but there's no easy way to export make functions... @@ -46,6 +48,7 @@ CFLAGS+= -I${CNTRB_GDB}/gdb/config CFLAGS+= -I${CNTRB_BU}/include CFLAGS+= -I${CNTRB_GDB}/include CFLAGS+= -I${CNTRB_BU}/bfd +CFLAGS+= -I${OBJ_RL}/.. GENSRCS+= nm.h tm.h diff --git a/gnu/usr.bin/gdb/arch/ia64/Makefile b/gnu/usr.bin/gdb/arch/ia64/Makefile deleted file mode 100644 index 2fe489999cd..00000000000 --- a/gnu/usr.bin/gdb/arch/ia64/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# $FreeBSD$ - -.if !defined(GDB_CROSS_DEBUGGER) -LIBSRCS+= fbsd-proc.c fbsd-threads.c gcore.c -LIBSRCS+= ia64-fbsd-nat.c -.endif -LIBSRCS+= solib.c solib-svr4.c -LIBSRCS+= ia64-fbsd-tdep.c ia64-tdep.c - -nm.h: - echo '#include "ia64/nm-fbsd.h"' > ${.TARGET} - -tm.h: - echo '#include "ia64/tm-fbsd.h"' > ${.TARGET} diff --git a/gnu/usr.bin/gdb/arch/ia64/config.h b/gnu/usr.bin/gdb/arch/ia64/config.h deleted file mode 100644 index 4cc29f9e736..00000000000 --- a/gnu/usr.bin/gdb/arch/ia64/config.h +++ /dev/null @@ -1,550 +0,0 @@ -/* $FreeBSD$ */ - -/* config.h. Generated automatically by configure. */ -/* config.in. Generated automatically from configure.in by autoheader. */ - -/* Define if on AIX 3. - System headers sometimes define this. - We just want to avoid a redefinition error message. */ -#ifndef _ALL_SOURCE -/* #undef _ALL_SOURCE */ -#endif - -/* Define if using alloca.c. */ -/* #undef C_ALLOCA */ - -/* Define to empty if the keyword does not work. */ -/* #undef const */ - -/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. - This function is required for alloca.c support on those systems. */ -/* #undef CRAY_STACKSEG_END */ - -/* Define if you have alloca, as a function or macro. */ -#define HAVE_ALLOCA 1 - -/* Define if you have and it should be used (not on Ultrix). */ -/* #undef HAVE_ALLOCA_H */ - -/* Define if the `long double' type works. */ -#define HAVE_LONG_DOUBLE 1 - -/* Define if you have a working `mmap' system call. */ -#define HAVE_MMAP 1 - -/* Define if you have . */ -/* #undef HAVE_VFORK_H */ - -/* Define as __inline if that's what the C compiler calls it. */ -/* #undef inline */ - -/* Define to `long' if doesn't define. */ -/* #undef off_t */ - -/* Define to `int' if doesn't define. */ -/* #undef pid_t */ - -/* Define if you need to in order for stat and other things to work. */ -/* #undef _POSIX_SOURCE */ - -/* Define as the return type of signal handlers (int or void). */ -#define RETSIGTYPE void - -/* Define if the `setpgrp' function takes no argument. */ -/* #undef SETPGRP_VOID */ - -/* Define to `unsigned' if doesn't define. */ -/* #undef size_t */ - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown - */ -/* #undef STACK_DIRECTION */ - -/* Define if the `S_IS*' macros in do not work properly. */ -/* #undef STAT_MACROS_BROKEN */ - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define vfork as fork if vfork does not work. */ -/* #undef vfork */ - -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 -#endif - -/* Define if your struct reg has r_fs. */ -/* #undef HAVE_STRUCT_REG_R_FS */ - -/* Define if your struct stat has st_blocks. */ -#define HAVE_STRUCT_STAT_ST_BLOCKS 1 - -/* Define if your struct reg has r_gs. */ -/* #undef HAVE_STRUCT_REG_R_GS */ - -/* Define if exists and defines struct link_map which has - members with an ``l_'' prefix. (For Solaris, SVR4, and - SVR4-like systems.) */ -#define HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS 1 - -/* Define if exists and defines struct link_map which has - members with an ``lm_'' prefix. (For SunOS.) */ -/* #undef HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS */ - -/* Define if exists and defines a struct so_map which has - members with an ``som_'' prefix. (Found on older *BSD systems.) */ -/* #undef HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS */ - -/* Define if has struct link_map32 */ -/* #undef HAVE_STRUCT_LINK_MAP32 */ - -/* Define if has link_map32 (solaris sparc-64 target) */ -/* #undef _SYSCALL32 */ - -/* Define if the prfpregset_t type is broken. */ -/* #undef PRFPREGSET_T_BROKEN */ - -/* Define if you want to use new multi-fd /proc interface - (replaces HAVE_MULTIPLE_PROC_FDS as well as other macros). */ -/* #undef NEW_PROC_API */ - -/* Define if ioctl argument PIOCSET is available. */ -/* #undef HAVE_PROCFS_PIOCSET */ - -/* Define if the `long long' type works. */ -#define CC_HAS_LONG_LONG 1 - -/* Define if the "ll" format works to print long long ints. */ -#define PRINTF_HAS_LONG_LONG 1 - -/* Define if the "%Lg" format works to print long doubles. */ -#define PRINTF_HAS_LONG_DOUBLE 1 - -/* Define if the "%Lg" format works to scan long doubles. */ -#define SCANF_HAS_LONG_DOUBLE 1 - -/* Define if using Solaris thread debugging. */ -/* #undef HAVE_THREAD_DB_LIB */ - -/* Define on a GNU/Linux system to work around problems in sys/procfs.h. */ -/* #undef START_INFERIOR_TRAPS_EXPECTED */ -/* #undef sys_quotactl */ - -/* Define if you have HPUX threads */ -/* #undef HAVE_HPUX_THREAD_SUPPORT */ - -/* Define if on solaris uses int instead of - size_t, and assorted other type changes. */ -/* #undef PROC_SERVICE_IS_OLD */ - -/* Define if the simulator is being linked in. */ -#define WITH_SIM 1 - -/* Set to true if the save_state_t structure is present */ -/* #undef HAVE_STRUCT_SAVE_STATE_T */ - -/* Set to true if the save_state_t structure has the ss_wide member */ -/* #undef HAVE_STRUCT_MEMBER_SS_WIDE */ - -/* Define if defines the PTRACE_GETREGS request. */ -/* #undef HAVE_PTRACE_GETREGS */ - -/* Define if defines the PTRACE_GETFPXREGS request. */ -/* #undef HAVE_PTRACE_GETFPXREGS */ - -/* Define if defines the PT_GETDBREGS request. */ -#define HAVE_PT_GETDBREGS 1 - -/* Define if defines the PT_GETXMMREGS request. */ -/* #undef HAVE_PT_GETXMMREGS */ - -/* Define if libunwind library is being used. */ -/* #undef HAVE_LIBUNWIND */ - -/* hostfile */ -/* #undef GDB_XM_FILE */ - -/* targetfile */ -#define GDB_TM_FILE config/ia64/tm-fbsd.h - -/* nativefile */ -#ifndef CROSS_DEBUGGER -#define GDB_NM_FILE config/ia64/nm-fbsd.h -#endif - -/* Define to 1 so gets a definition of anon_hdl. Works - around a problem on IRIX 5. */ -#ifndef _KMEMUSER -/* #undef _KMEMUSER */ -#endif - -/* Define if you have the __argz_count function. */ -/* #undef HAVE___ARGZ_COUNT */ - -/* Define if you have the __argz_next function. */ -/* #undef HAVE___ARGZ_NEXT */ - -/* Define if you have the __argz_stringify function. */ -/* #undef HAVE___ARGZ_STRINGIFY */ - -/* Define if you have the _mcleanup function. */ -#define HAVE__MCLEANUP 1 - -/* Define if you have the canonicalize_file_name function. */ -/* #undef HAVE_CANONICALIZE_FILE_NAME */ - -/* Define if you have the dcgettext function. */ -/* #undef HAVE_DCGETTEXT */ - -/* Define if you have the getcwd function. */ -#define HAVE_GETCWD 1 - -/* Define if you have the getpagesize function. */ -#define HAVE_GETPAGESIZE 1 - -/* Define if you have the monstartup function. */ -#define HAVE_MONSTARTUP 1 - -/* Define if you have the munmap function. */ -#define HAVE_MUNMAP 1 - -/* Define if you have the poll function. */ -#define HAVE_POLL 1 - -/* Define if you have the pread64 function. */ -/* #undef HAVE_PREAD64 */ - -/* Define if you have the putenv function. */ -#define HAVE_PUTENV 1 - -/* Define if you have the realpath function. */ -#define HAVE_REALPATH 1 - -/* Define if you have the sbrk function. */ -#define HAVE_SBRK 1 - -/* Define if you have the setenv function. */ -#define HAVE_SETENV 1 - -/* Define if you have the setlocale function. */ -#define HAVE_SETLOCALE 1 - -/* Define if you have the setpgid function. */ -#define HAVE_SETPGID 1 - -/* Define if you have the setpgrp function. */ -#define HAVE_SETPGRP 1 - -/* Define if you have the sigaction function. */ -#define HAVE_SIGACTION 1 - -/* Define if you have the sigprocmask function. */ -#define HAVE_SIGPROCMASK 1 - -/* Define if you have the sigsetmask function. */ -#define HAVE_SIGSETMASK 1 - -/* Define if you have the socketpair function. */ -#define HAVE_SOCKETPAIR 1 - -/* Define if you have the stpcpy function. */ -#define HAVE_STPCPY 1 - -/* Define if you have the strcasecmp function. */ -#define HAVE_STRCASECMP 1 - -/* Define if you have the strchr function. */ -#define HAVE_STRCHR 1 - -/* Define if you have the syscall function. */ -#define HAVE_SYSCALL 1 - -/* Define if you have the header file. */ -/* #undef HAVE_ARGZ_H */ - -/* Define if you have the header file. */ -#define HAVE_CTYPE_H 1 - -/* Define if you have the header file. */ -#define HAVE_CURSES_H 1 - -/* Define if you have the header file. */ -#define HAVE_DIRENT_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_LIBUNWIND_IA64_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_LIBUNWIND_H */ - -/* Define if you have the header file. */ -#define HAVE_LIMITS_H 1 - -/* Define if you have the header file. */ -#define HAVE_LINK_H 1 - -/* Define if you have the header file. */ -#define HAVE_LOCALE_H 1 - -/* Define if you have the header file. */ -#define HAVE_MACHINE_REG_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_MALLOC_H */ - -/* Define if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define if you have the header file. */ -#define HAVE_NCURSES_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_NDIR_H */ - -/* Define if you have the header file. */ -#define HAVE_NL_TYPES_H 1 - -/* Define if you have the header file. */ -#define HAVE_NLIST_H 1 - -/* Define if you have the header file. */ -#define HAVE_POLL_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_PROC_SERVICE_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_PTRACE_H */ - -/* Define if you have the header file. */ -#define HAVE_SGTTY_H 1 - -/* Define if you have the header file. */ -#define HAVE_STDDEF_H 1 - -/* Define if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_DEBUGREG_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_DIR_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_FAULT_H */ - -/* Define if you have the header file. */ -#define HAVE_SYS_FILE_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_FILIO_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_IOCTL_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_NDIR_H */ - -/* Define if you have the header file. */ -#define HAVE_SYS_PARAM_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_POLL_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_PROC_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_PROCFS_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_PTRACE_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_REG_H */ - -/* Define if you have the header file. */ -#define HAVE_SYS_SELECT_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_SYSCALL_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_USER_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_WAIT_H 1 - -/* Define if you have the header file. */ -#define HAVE_TERM_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_TERMIO_H */ - -/* Define if you have the header file. */ -#define HAVE_TERMIOS_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_THREAD_DB_H */ - -/* Define if you have the header file. */ -#define HAVE_TIME_H 1 - -/* Define if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_VALUES_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_WAIT_H */ - -/* Define if you have the dl library (-ldl). */ -/* #undef HAVE_LIBDL */ - -/* Define if you have the m library (-lm). */ -#define HAVE_LIBM 1 - -/* Define if you have the w library (-lw). */ -/* #undef HAVE_LIBW */ - -/* Define if you have the stpcpy function */ -#define HAVE_STPCPY 1 - -/* Define if your locale.h file contains LC_MESSAGES. */ -#define HAVE_LC_MESSAGES 1 - -/* Define to 1 if NLS is requested */ -/* #undef ENABLE_NLS */ - -/* Define as 1 if you have gettext and don't want to use GNU gettext. */ -/* #undef HAVE_GETTEXT */ - -/* Name of this package. */ -#define PACKAGE "gdb" - -/* Define to BFD's default architecture. */ -#define DEFAULT_BFD_ARCH bfd_ia64_arch - -/* Define to BFD's default target vector. */ -#define DEFAULT_BFD_VEC bfd_elf64_ia64_little_vec - -/* Define to 1 if your system has the _etext variable. */ -#define HAVE__ETEXT 1 - -/* Define to 1 to avoid a clash between and on - Solaris 2.[78] when using GCC. */ -/* #undef _MSE_INT_H */ - -/* Define to 1 if we found this declaration otherwise define to 0. */ -#define HAVE_DECL_GETOPT 0 - -/* Define if sigsetjmp is available. */ -#define HAVE_SIGSETJMP 1 - -/* Define to 1 if the regex included in libiberty should be used. */ -#define USE_INCLUDED_REGEX 1 - -/* Define to 1 if your system has struct reg in . */ -#define HAVE_STRUCT_REG 1 - -/* Define if provides the uintptr_t type. */ -#define HAVE_UINTPTR_T 1 - -/* Define if malloc is not declared in system header files. */ -/* #undef NEED_DECLARATION_MALLOC */ - -/* Define if realloc is not declared in system header files. */ -/* #undef NEED_DECLARATION_REALLOC */ - -/* Define if free is not declared in system header files. */ -/* #undef NEED_DECLARATION_FREE */ - -/* Define if strerror is not declared in system header files. */ -/* #undef NEED_DECLARATION_STRERROR */ - -/* Define if strdup is not declared in system header files. */ -/* #undef NEED_DECLARATION_STRDUP */ - -/* Define if strstr is not declared in system header files. */ -/* #undef NEED_DECLARATION_STRSTR */ - -/* Define if canonicalize_file_name is not declared in system header files. */ -#define NEED_DECLARATION_CANONICALIZE_FILE_NAME 1 - -/* Define if has pstatus_t. */ -/* #undef HAVE_PSTATUS_T */ - -/* Define if has prrun_t. */ -/* #undef HAVE_PRRUN_T */ - -/* Define if has gregset_t. */ -#define HAVE_GREGSET_T 1 - -/* Define if has fpregset_t. */ -#define HAVE_FPREGSET_T 1 - -/* Define if has prgregset_t. */ -#define HAVE_PRGREGSET_T 1 - -/* Define if has prfpregset_t. */ -#define HAVE_PRFPREGSET_T 1 - -/* Define if has prgregset32_t. */ -/* #undef HAVE_PRGREGSET32_T */ - -/* Define if has prfpregset32_t. */ -/* #undef HAVE_PRFPREGSET32_T */ - -/* Define if has lwpid_t. */ -#define HAVE_LWPID_T 1 - -/* Define if has psaddr_t. */ -#define HAVE_PSADDR_T 1 - -/* Define if has prsysent_t. */ -/* #undef HAVE_PRSYSENT_T */ - -/* Define if has pr_sigset_t. */ -/* #undef HAVE_PR_SIGSET_T */ - -/* Define if has pr_sigaction64_t. */ -/* #undef HAVE_PR_SIGACTION64_T */ - -/* Define if has pr_siginfo64_t. */ -/* #undef HAVE_PR_SIGINFO64_T */ - -/* Define if has the TD_NOTALLOC error code. */ -/* #undef THREAD_DB_HAS_TD_NOTALLOC */ - -/* Define if we can use the tkill syscall. */ -/* #undef HAVE_TKILL_SYSCALL */ - -/* Define to the default OS ABI for this configuration. */ -/* #undef GDB_OSABI_DEFAULT */ - -/* Define to be a string naming the default host character set. */ -#define GDB_DEFAULT_HOST_CHARSET "ISO-8859-1" - -/* Define if you have the iconv() function. */ -/* #undef HAVE_ICONV */ - -/* Define as const if the declaration of iconv() needs const. */ -/* #undef ICONV_CONST */ - diff --git a/gnu/usr.bin/gdb/arch/ia64/init.c b/gnu/usr.bin/gdb/arch/ia64/init.c deleted file mode 100644 index ee383e9c96f..00000000000 --- a/gnu/usr.bin/gdb/arch/ia64/init.c +++ /dev/null @@ -1,230 +0,0 @@ -/* $FreeBSD$ */ - -/* Do not modify this file. */ -/* It is created automatically by the Makefile. */ -#include "defs.h" /* For initialize_file_ftype. */ -#include "call-cmds.h" /* For initialize_all_files. */ -extern initialize_file_ftype _initialize_gdbtypes; -extern initialize_file_ftype _initialize_corelow; -extern initialize_file_ftype _initialize_ia64_fbsd_tdep; -extern initialize_file_ftype _initialize_ia64_tdep; -extern initialize_file_ftype _initialize_solib; -extern initialize_file_ftype _initialize_svr4_solib; -extern initialize_file_ftype _initialize_ser_hardwire; -extern initialize_file_ftype _initialize_ser_pipe; -extern initialize_file_ftype _initialize_ser_tcp; -extern initialize_file_ftype _initialize_fbsd_proc; -extern initialize_file_ftype _initialize_gcore; -extern initialize_file_ftype _initialize_thread_db; -extern initialize_file_ftype _initialize_ia64_fbsd_nat; -extern initialize_file_ftype _initialize_kernel_u_addr; -extern initialize_file_ftype _initialize_infptrace; -extern initialize_file_ftype _initialize_inftarg; -extern initialize_file_ftype _initialize_remote; -extern initialize_file_ftype _initialize_dcache; -extern initialize_file_ftype _initialize_sr_support; -extern initialize_file_ftype _initialize_tracepoint; -extern initialize_file_ftype _initialize_ax_gdb; -extern initialize_file_ftype _initialize_annotate; -extern initialize_file_ftype _initialize_auxv; -extern initialize_file_ftype _initialize_breakpoint; -extern initialize_file_ftype _initialize_regcache; -extern initialize_file_ftype _initialize_charset; -extern initialize_file_ftype _initialize_dummy_frame; -extern initialize_file_ftype _initialize_source; -extern initialize_file_ftype _initialize_values; -extern initialize_file_ftype _initialize_valops; -extern initialize_file_ftype _initialize_valarith; -extern initialize_file_ftype _initialize_valprint; -extern initialize_file_ftype _initialize_printcmd; -extern initialize_file_ftype _initialize_symtab; -extern initialize_file_ftype _initialize_symfile; -extern initialize_file_ftype _initialize_symmisc; -extern initialize_file_ftype _initialize_infcall; -extern initialize_file_ftype _initialize_infcmd; -extern initialize_file_ftype _initialize_infrun; -extern initialize_file_ftype _initialize_stack; -extern initialize_file_ftype _initialize_thread; -extern initialize_file_ftype _initialize_interpreter; -extern initialize_file_ftype _initialize_macrocmd; -extern initialize_file_ftype _initialize_gdbarch; -extern initialize_file_ftype _initialize_gdbarch_utils; -extern initialize_file_ftype _initialize_gdb_osabi; -extern initialize_file_ftype _initialize_copying; -extern initialize_file_ftype _initialize_mem; -extern initialize_file_ftype _initialize_parse; -extern initialize_file_ftype _initialize_language; -extern initialize_file_ftype _initialize_frame_reg; -extern initialize_file_ftype _initialize_signals; -extern initialize_file_ftype _initialize_kod; -extern initialize_file_ftype _initialize_gdb_events; -extern initialize_file_ftype _initialize_exec; -extern initialize_file_ftype _initialize_maint_cmds; -extern initialize_file_ftype _initialize_demangler; -extern initialize_file_ftype _initialize_dbxread; -extern initialize_file_ftype _initialize_coffread; -extern initialize_file_ftype _initialize_elfread; -extern initialize_file_ftype _initialize_mipsread; -extern initialize_file_ftype _initialize_stabsread; -extern initialize_file_ftype _initialize_core; -extern initialize_file_ftype _initialize_dwarf2_frame; -extern initialize_file_ftype _initialize_c_language; -extern initialize_file_ftype _initialize_f_language; -extern initialize_file_ftype _initialize_objc_language; -extern initialize_file_ftype _initialize_ui_out; -extern initialize_file_ftype _initialize_cli_out; -extern initialize_file_ftype _initialize_varobj; -extern initialize_file_ftype _initialize_java_language; -extern initialize_file_ftype _initialize_m2_language; -extern initialize_file_ftype _initialize_pascal_language; -extern initialize_file_ftype _initialize_pascal_valprint; -extern initialize_file_ftype _initialize_scheme_language; -extern initialize_file_ftype _initialize_complaints; -extern initialize_file_ftype _initialize_typeprint; -extern initialize_file_ftype _initialize_cp_valprint; -extern initialize_file_ftype _initialize_f_valprint; -extern initialize_file_ftype _initialize_nlmread; -extern initialize_file_ftype _initialize_serial; -extern initialize_file_ftype _initialize_mdebugread; -extern initialize_file_ftype _initialize_user_regs; -extern initialize_file_ftype _initialize_frame; -extern initialize_file_ftype _initialize_frame_unwind; -extern initialize_file_ftype _initialize_frame_base; -extern initialize_file_ftype _initialize_gnu_v2_abi; -extern initialize_file_ftype _initialize_gnu_v3_abi; -extern initialize_file_ftype _initialize_hpacc_abi; -extern initialize_file_ftype _initialize_cp_abi; -extern initialize_file_ftype _initialize_cp_support; -extern initialize_file_ftype _initialize_cp_namespace; -extern initialize_file_ftype _initialize_reggroup; -extern initialize_file_ftype _initialize_inflow; -extern initialize_file_ftype _initialize_cli_dump; -extern initialize_file_ftype _initialize_cli_logging; -extern initialize_file_ftype _initialize_cli_interp; -extern initialize_file_ftype _initialize_mi_out; -extern initialize_file_ftype _initialize_mi_cmds; -extern initialize_file_ftype _initialize_mi_cmd_env; -extern initialize_file_ftype _initialize_mi_interp; -extern initialize_file_ftype _initialize_mi_main; -extern initialize_file_ftype _initialize_tui_hooks; -extern initialize_file_ftype _initialize_tui_interp; -extern initialize_file_ftype _initialize_tui_layout; -extern initialize_file_ftype _initialize_tui_out; -extern initialize_file_ftype _initialize_tui_regs; -extern initialize_file_ftype _initialize_tui_stack; -extern initialize_file_ftype _initialize_tui_win; -void -initialize_all_files (void) -{ - _initialize_gdbtypes (); - _initialize_corelow (); - _initialize_ia64_fbsd_tdep (); - _initialize_ia64_tdep (); - _initialize_solib (); - _initialize_svr4_solib (); - _initialize_ser_hardwire (); - _initialize_ser_pipe (); - _initialize_ser_tcp (); -#ifndef CROSS_DEBUGGER - _initialize_fbsd_proc (); - _initialize_gcore (); - _initialize_thread_db (); - _initialize_ia64_fbsd_nat (); - _initialize_kernel_u_addr (); - _initialize_infptrace (); - _initialize_inftarg (); -#endif - _initialize_remote (); - _initialize_dcache (); - _initialize_sr_support (); - _initialize_tracepoint (); - _initialize_ax_gdb (); - _initialize_annotate (); - _initialize_auxv (); - _initialize_breakpoint (); - _initialize_regcache (); - _initialize_charset (); - _initialize_dummy_frame (); - _initialize_source (); - _initialize_values (); - _initialize_valops (); - _initialize_valarith (); - _initialize_valprint (); - _initialize_printcmd (); - _initialize_symtab (); - _initialize_symfile (); - _initialize_symmisc (); - _initialize_infcall (); - _initialize_infcmd (); - _initialize_infrun (); - _initialize_stack (); - _initialize_thread (); - _initialize_interpreter (); - _initialize_macrocmd (); - _initialize_gdbarch (); - _initialize_gdbarch_utils (); - _initialize_gdb_osabi (); - _initialize_copying (); - _initialize_mem (); - _initialize_parse (); - _initialize_language (); - _initialize_frame_reg (); - _initialize_signals (); - _initialize_kod (); - _initialize_gdb_events (); - _initialize_exec (); - _initialize_maint_cmds (); - _initialize_demangler (); - _initialize_dbxread (); - _initialize_coffread (); - _initialize_elfread (); - _initialize_mipsread (); - _initialize_stabsread (); - _initialize_core (); - _initialize_dwarf2_frame (); - _initialize_c_language (); - _initialize_f_language (); - _initialize_objc_language (); - _initialize_ui_out (); - _initialize_cli_out (); - _initialize_varobj (); - _initialize_java_language (); - _initialize_m2_language (); - _initialize_pascal_language (); - _initialize_pascal_valprint (); - _initialize_scheme_language (); - _initialize_complaints (); - _initialize_typeprint (); - _initialize_cp_valprint (); - _initialize_f_valprint (); - _initialize_nlmread (); - _initialize_serial (); - _initialize_mdebugread (); - _initialize_user_regs (); - _initialize_frame (); - _initialize_frame_unwind (); - _initialize_frame_base (); - _initialize_gnu_v2_abi (); - _initialize_gnu_v3_abi (); - _initialize_hpacc_abi (); - _initialize_cp_abi (); - _initialize_cp_support (); - _initialize_cp_namespace (); - _initialize_reggroup (); - _initialize_inflow (); - _initialize_cli_dump (); - _initialize_cli_logging (); - _initialize_cli_interp (); - _initialize_mi_out (); - _initialize_mi_cmds (); - _initialize_mi_cmd_env (); - _initialize_mi_interp (); - _initialize_mi_main (); - _initialize_tui_hooks (); - _initialize_tui_interp (); - _initialize_tui_layout (); - _initialize_tui_out (); - _initialize_tui_regs (); - _initialize_tui_stack (); - _initialize_tui_win (); -} diff --git a/gnu/usr.bin/gdb/gdb/Makefile b/gnu/usr.bin/gdb/gdb/Makefile index 15eb2eb8f53..9da4da1f2fc 100644 --- a/gnu/usr.bin/gdb/gdb/Makefile +++ b/gnu/usr.bin/gdb/gdb/Makefile @@ -11,8 +11,10 @@ GDBLIBS= ${OBJ_GDB}/libgdb/libgdb.a # global symbols visible. LDFLAGS+= -Wl,-E -DPADD= ${GDBLIBS} ${BULIBS} ${LIBM} ${LIBREADLINE} ${LIBTERMCAP} ${LIBGNUREGEX} -LDADD= ${GDBLIBS} ${BULIBS} -lm -lreadline -ltermcap -lgnuregex +DPADD= ${GDBLIBS} ${BULIBS} ${LIBM} ${LIBREADLINE} ${LIBTERMCAPW} ${LIBGNUREGEX} +LDADD= ${GDBLIBS} ${BULIBS} -lm ${LIBREADLINE} -ltermcapw -lgnuregex + +NO_PIE= yes .include CFLAGS+= -DDEBUGDIR=\"${DEBUGDIR}\" diff --git a/gnu/usr.bin/gdb/gdb/Makefile.depend b/gnu/usr.bin/gdb/gdb/Makefile.depend index 4572bc150e3..595475a2f74 100644 --- a/gnu/usr.bin/gdb/gdb/Makefile.depend +++ b/gnu/usr.bin/gdb/gdb/Makefile.depend @@ -17,7 +17,7 @@ DIRDEPS = \ lib/libc \ lib/libcompiler_rt \ lib/msun \ - lib/ncurses/ncurses \ + lib/ncurses/ncursesw \ .include diff --git a/gnu/usr.bin/gdb/gdbtui/Makefile b/gnu/usr.bin/gdb/gdbtui/Makefile index 94dbb4babd5..8369b7f2fae 100644 --- a/gnu/usr.bin/gdb/gdbtui/Makefile +++ b/gnu/usr.bin/gdb/gdbtui/Makefile @@ -12,7 +12,9 @@ GDBLIBS= ${OBJ_GDB}/libgdb/libgdb.a # global symbols visible. LDFLAGS+= -Wl,-E -DPADD= ${GDBLIBS} ${BULIBS} ${LIBM} ${LIBREADLINE} ${LIBTERMCAP} ${LIBGNUREGEX} -LDADD= ${GDBLIBS} ${BULIBS} -lm -lreadline -ltermcap -lgnuregex +DPADD= ${GDBLIBS} ${BULIBS} ${LIBM} ${LIBREADLINE} ${LIBTERMCAPW} ${LIBGNUREGEX} +LDADD= ${GDBLIBS} ${BULIBS} -lm ${LIBREADLINE} -ltermcapw -lgnuregex + +NO_PIE= yes .include diff --git a/gnu/usr.bin/gdb/gdbtui/Makefile.depend b/gnu/usr.bin/gdb/gdbtui/Makefile.depend index 1d50acab904..7ed5830a984 100644 --- a/gnu/usr.bin/gdb/gdbtui/Makefile.depend +++ b/gnu/usr.bin/gdb/gdbtui/Makefile.depend @@ -17,7 +17,7 @@ DIRDEPS = \ lib/libc \ lib/libcompiler_rt \ lib/msun \ - lib/ncurses/ncurses \ + lib/ncurses/ncursesw \ .include diff --git a/gnu/usr.bin/gdb/kgdb/Makefile b/gnu/usr.bin/gdb/kgdb/Makefile index 30cbf3ca1f9..bbc886b5bbb 100644 --- a/gnu/usr.bin/gdb/kgdb/Makefile +++ b/gnu/usr.bin/gdb/kgdb/Makefile @@ -8,13 +8,15 @@ BULIBS= ${OBJ_BU}/libbfd/libbfd.a ${OBJ_BU}/libopcodes/libopcodes.a \ ${OBJ_BU}/libiberty/libiberty.a GDBLIBS= ${OBJ_GDB}/libgdb/libgdb.a -DPADD= ${GDBLIBS} ${BULIBS} ${LIBKVM} ${LIBM} ${LIBREADLINE} ${LIBTERMCAP} \ +DPADD= ${GDBLIBS} ${BULIBS} ${LIBKVM} ${LIBM} ${LIBREADLINE} ${LIBTERMCAPW} \ ${LIBGNUREGEX} -LDADD= ${GDBLIBS} ${BULIBS} -lkvm${GDB_SUFFIX} -lm -lreadline -ltermcap \ +LDADD= ${GDBLIBS} ${BULIBS} -lkvm${GDB_SUFFIX} -lm ${LIBREADLINE} -ltermcapw \ -lgnuregex .if defined(GDB_CROSS_DEBUGGER) CFLAGS+= -Wl,-export-dynamic .endif +NO_PIE= yes + .include diff --git a/gnu/usr.bin/gdb/kgdb/Makefile.depend.amd64 b/gnu/usr.bin/gdb/kgdb/Makefile.depend.amd64 index 165f4f0ff78..9a4e4059b46 100644 --- a/gnu/usr.bin/gdb/kgdb/Makefile.depend.amd64 +++ b/gnu/usr.bin/gdb/kgdb/Makefile.depend.amd64 @@ -18,7 +18,7 @@ DIRDEPS = \ lib/libcompiler_rt \ lib/libkvm \ lib/msun \ - lib/ncurses/ncurses \ + lib/ncurses/ncursesw \ .include diff --git a/gnu/usr.bin/gdb/kgdb/trgt_ia64.c b/gnu/usr.bin/gdb/kgdb/trgt_ia64.c deleted file mode 100644 index 6ba800bd014..00000000000 --- a/gnu/usr.bin/gdb/kgdb/trgt_ia64.c +++ /dev/null @@ -1,338 +0,0 @@ -/* - * 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 -#ifdef CROSS_DEBUGGER -#include -#include -#include -#include -#else -#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) -{ - CORE_ADDR addr; - char *expr; - - asprintf(&expr, "&cpuid_to_pcpu[%d]->pc_md.pcb", cpuid); - addr = kgdb_parse(expr); - free(expr); - return (addr); -} - -void -kgdb_trgt_fetch_registers(int regno __unused) -{ - struct kthr *kt; - struct pcb pcb; - uint64_t r; - - 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)); - } - - /* Registers 0-127: general registers. */ - supply_register(IA64_GR1_REGNUM, (char *)&pcb.pcb_special.gp); - supply_register(IA64_GR4_REGNUM, (char *)&pcb.pcb_preserved.gr4); - supply_register(IA64_GR5_REGNUM, (char *)&pcb.pcb_preserved.gr5); - supply_register(IA64_GR6_REGNUM, (char *)&pcb.pcb_preserved.gr6); - supply_register(IA64_GR7_REGNUM, (char *)&pcb.pcb_preserved.gr7); - supply_register(IA64_GR12_REGNUM, (char *)&pcb.pcb_special.sp); - supply_register(IA64_GR12_REGNUM+1, (char *)&pcb.pcb_special.tp); - - /* Registers 128-255: floating-point registers. */ - supply_register(IA64_FR2_REGNUM, (char *)&pcb.pcb_preserved_fp.fr2); - supply_register(IA64_FR2_REGNUM+1, (char *)&pcb.pcb_preserved_fp.fr3); - supply_register(IA64_FR2_REGNUM+2, (char *)&pcb.pcb_preserved_fp.fr4); - supply_register(IA64_FR2_REGNUM+3, (char *)&pcb.pcb_preserved_fp.fr5); - supply_register(IA64_FR16_REGNUM, (char *)&pcb.pcb_preserved_fp.fr16); - supply_register(IA64_FR16_REGNUM+1, (char*)&pcb.pcb_preserved_fp.fr17); - supply_register(IA64_FR16_REGNUM+2, (char*)&pcb.pcb_preserved_fp.fr18); - supply_register(IA64_FR16_REGNUM+3, (char*)&pcb.pcb_preserved_fp.fr19); - supply_register(IA64_FR16_REGNUM+4, (char*)&pcb.pcb_preserved_fp.fr20); - supply_register(IA64_FR16_REGNUM+5, (char*)&pcb.pcb_preserved_fp.fr21); - supply_register(IA64_FR16_REGNUM+6, (char*)&pcb.pcb_preserved_fp.fr22); - supply_register(IA64_FR16_REGNUM+7, (char*)&pcb.pcb_preserved_fp.fr23); - supply_register(IA64_FR16_REGNUM+8, (char*)&pcb.pcb_preserved_fp.fr24); - supply_register(IA64_FR16_REGNUM+9, (char*)&pcb.pcb_preserved_fp.fr25); - supply_register(IA64_FR16_REGNUM+10,(char*)&pcb.pcb_preserved_fp.fr26); - supply_register(IA64_FR16_REGNUM+11,(char*)&pcb.pcb_preserved_fp.fr27); - supply_register(IA64_FR16_REGNUM+12,(char*)&pcb.pcb_preserved_fp.fr28); - supply_register(IA64_FR16_REGNUM+13,(char*)&pcb.pcb_preserved_fp.fr29); - supply_register(IA64_FR16_REGNUM+14,(char*)&pcb.pcb_preserved_fp.fr30); - supply_register(IA64_FR16_REGNUM+15,(char*)&pcb.pcb_preserved_fp.fr31); - - /* Registers 320-327: branch registers. */ - if (pcb.pcb_special.__spare == ~0UL) - supply_register(IA64_BR0_REGNUM, (char *)&pcb.pcb_special.rp); - supply_register(IA64_BR1_REGNUM, (char *)&pcb.pcb_preserved.br1); - supply_register(IA64_BR2_REGNUM, (char *)&pcb.pcb_preserved.br2); - supply_register(IA64_BR3_REGNUM, (char *)&pcb.pcb_preserved.br3); - supply_register(IA64_BR4_REGNUM, (char *)&pcb.pcb_preserved.br4); - supply_register(IA64_BR5_REGNUM, (char *)&pcb.pcb_preserved.br5); - - /* Registers 328-333: misc. other registers. */ - supply_register(IA64_PR_REGNUM, (char *)&pcb.pcb_special.pr); - if (pcb.pcb_special.__spare == ~0UL) { - r = pcb.pcb_special.iip + ((pcb.pcb_special.psr >> 41) & 3); - supply_register(IA64_IP_REGNUM, (char *)&r); - supply_register(IA64_CFM_REGNUM, (char *)&pcb.pcb_special.cfm); - } else { - supply_register(IA64_IP_REGNUM, (char *)&pcb.pcb_special.rp); - supply_register(IA64_CFM_REGNUM, (char *)&pcb.pcb_special.pfs); - } - - /* Registers 334-461: application registers. */ - supply_register(IA64_RSC_REGNUM, (char *)&pcb.pcb_special.rsc); - r = pcb.pcb_special.bspstore; - if (pcb.pcb_special.__spare == ~0UL) - r += pcb.pcb_special.ndirty; - else - r = ia64_bsp_adjust(r, IA64_CFM_SOF(pcb.pcb_special.pfs) - - IA64_CFM_SOL(pcb.pcb_special.pfs)); - supply_register(IA64_BSP_REGNUM, (char *)&r); - supply_register(IA64_BSPSTORE_REGNUM, (char *)&r); - supply_register(IA64_RNAT_REGNUM, (char *)&pcb.pcb_special.rnat); - supply_register(IA64_UNAT_REGNUM, (char *)&pcb.pcb_special.unat); - supply_register(IA64_FPSR_REGNUM, (char *)&pcb.pcb_special.fpsr); - if (pcb.pcb_special.__spare == ~0UL) - supply_register(IA64_PFS_REGNUM, (char *)&pcb.pcb_special.pfs); - supply_register(IA64_LC_REGNUM, (char *)&pcb.pcb_preserved.lc); -} - -void -kgdb_trgt_store_registers(int regno __unused) -{ - fprintf_unfiltered(gdb_stderr, "XXX: %s\n", __func__); -} - -void -kgdb_trgt_new_objfile(struct objfile *objfile) -{ -} - -struct kgdb_frame_cache { - CORE_ADDR bsp; - CORE_ADDR ip; - CORE_ADDR sp; - CORE_ADDR saved_bsp; -}; - -#define SPECIAL(x) offsetof(struct trapframe, tf_special) \ - + offsetof(struct _special, x) -#define SCRATCH(x) offsetof(struct trapframe, tf_scratch) \ - + offsetof(struct _caller_saved, x) -#define SCRATCH_FP(x) offsetof(struct trapframe, tf_scratch_fp) \ - + offsetof(struct _caller_saved_fp, x) - -static int kgdb_trgt_frame_ofs_gr[32] = { - -1, /* gr0 */ - SPECIAL(gp), - SCRATCH(gr2), SCRATCH(gr3), - -1, -1, -1, -1, /* gr4-gr7 */ - SCRATCH(gr8), SCRATCH(gr9), SCRATCH(gr10), SCRATCH(gr11), - SPECIAL(sp), SPECIAL(tp), - SCRATCH(gr14), SCRATCH(gr15), SCRATCH(gr16), SCRATCH(gr17), - SCRATCH(gr18), SCRATCH(gr19), SCRATCH(gr20), SCRATCH(gr21), - SCRATCH(gr22), SCRATCH(gr23), SCRATCH(gr24), SCRATCH(gr25), - SCRATCH(gr26), SCRATCH(gr27), SCRATCH(gr28), SCRATCH(gr29), - SCRATCH(gr30), SCRATCH(gr31) -}; - -static int kgdb_trgt_frame_ofs_fr[32] = { - -1, /* fr0: constant 0.0 */ - -1, /* fr1: constant 1.0 */ - -1, -1, -1, -1, /* fr2-fr5 */ - SCRATCH_FP(fr6), SCRATCH_FP(fr7), SCRATCH_FP(fr8), SCRATCH_FP(fr9), - SCRATCH_FP(fr10), SCRATCH_FP(fr11), SCRATCH_FP(fr12), SCRATCH_FP(fr13), - SCRATCH_FP(fr14), SCRATCH_FP(fr15) -}; - -static int kgdb_trgt_frame_ofs_br[8] = { - SPECIAL(rp), - -1, -1, -1, -1, -1, /* br1-br5 */ - SCRATCH(br6), SCRATCH(br7) -}; - -static int kgdb_trgt_frame_ofs_ar[49] = { - /* ar0-ar15 */ - SPECIAL(rsc), - -1, /* ar.bsp */ - SPECIAL(bspstore), SPECIAL(rnat), - -1, -1, -1, -1, -1, /* ar20-ar24 */ - SCRATCH(csd), SCRATCH(ssd), - -1, -1, -1, -1, -1, /* ar27-ar31 */ - SCRATCH(ccv), - -1, -1, -1, /* ar33-ar35 */ - SPECIAL(unat), - -1, -1, -1, /* ar37-ar39 */ - SPECIAL(fpsr), - -1, -1, -1, -1, -1, -1, -1, /* ar41-ar47 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* ar48-ar55 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* ar56-ar63 */ - SPECIAL(pfs) -}; - -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, IA64_BSP_REGNUM, buf); - cache->bsp = extract_unsigned_integer(buf, - register_size(current_gdbarch, IA64_BSP_REGNUM)); - cache->ip = frame_func_unwind(next_frame); - frame_unwind_register(next_frame, SP_REGNUM, buf); - cache->sp = extract_unsigned_integer(buf, - register_size(current_gdbarch, SP_REGNUM)); - } - return (cache); -} - -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_special(cache->sp, cache->ip, cache->bsp); -} - -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 buf[MAX_REGISTER_SIZE]; - char dummy_valuep[MAX_REGISTER_SIZE]; - struct kgdb_frame_cache *cache; - CORE_ADDR bsp; - int ofs, regsz; - - 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; - - cache = kgdb_trgt_frame_cache(next_frame, this_cache); - - if (regnum == IA64_BSP_REGNUM) { - if (cache->saved_bsp == 0) { - target_read_memory(cache->sp + 16 + SPECIAL(bspstore), - buf, regsz); - bsp = extract_unsigned_integer(buf, regsz); - target_read_memory(cache->sp + 16 + SPECIAL(ndirty), - buf, regsz); - bsp += extract_unsigned_integer(buf, regsz); - cache->saved_bsp = bsp; - } - store_unsigned_integer(valuep, regsz, cache->saved_bsp); - return; - } - if (regnum == IA64_PR_REGNUM) - ofs = SPECIAL(pr); - else if (regnum == IA64_IP_REGNUM) - ofs = SPECIAL(iip); - else if (regnum == IA64_PSR_REGNUM) - ofs = SPECIAL(psr); - else if (regnum == IA64_CFM_REGNUM) - ofs = SPECIAL(cfm); - else if (regnum >= IA64_GR0_REGNUM && regnum <= IA64_GR31_REGNUM) - ofs = kgdb_trgt_frame_ofs_gr[regnum - IA64_GR0_REGNUM]; - else if (regnum >= IA64_FR0_REGNUM && regnum <= IA64_FR15_REGNUM) - ofs = kgdb_trgt_frame_ofs_fr[regnum - IA64_FR0_REGNUM]; - else if (regnum >= IA64_BR0_REGNUM && regnum <= IA64_BR7_REGNUM) - ofs = kgdb_trgt_frame_ofs_br[regnum - IA64_BR0_REGNUM]; - else if (regnum >= IA64_RSC_REGNUM && regnum <= IA64_PFS_REGNUM) - ofs = kgdb_trgt_frame_ofs_ar[regnum - IA64_RSC_REGNUM]; - else - ofs = -1; - if (ofs == -1) - return; - - *addrp = cache->sp + 16 + ofs; - *lvalp = lval_memory; - 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 -}; - -const struct frame_unwind * -kgdb_trgt_trapframe_sniffer(struct frame_info *next_frame) -{ - char *pname; - CORE_ADDR ip; - - ip = frame_func_unwind(next_frame); - pname = NULL; - find_pc_partial_function(ip, &pname, NULL, NULL); - if (pname == NULL) - return (NULL); - if (strncmp(pname, "ivt_", 4) == 0) - return (&kgdb_trgt_trapframe_unwind); - /* printf("%s: %lx =%s\n", __func__, ip, pname); */ - return (NULL); -} diff --git a/gnu/usr.bin/groff/contrib/mm/Makefile.depend b/gnu/usr.bin/groff/contrib/mm/Makefile.depend index 57b7e10c3d7..18f420a9559 100644 --- a/gnu/usr.bin/groff/contrib/mm/Makefile.depend +++ b/gnu/usr.bin/groff/contrib/mm/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ .include diff --git a/gnu/usr.bin/groff/font/devdvi/Makefile.depend b/gnu/usr.bin/groff/font/devdvi/Makefile.depend index 57b7e10c3d7..18f420a9559 100644 --- a/gnu/usr.bin/groff/font/devdvi/Makefile.depend +++ b/gnu/usr.bin/groff/font/devdvi/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ .include diff --git a/gnu/usr.bin/groff/font/devlbp/Makefile.depend b/gnu/usr.bin/groff/font/devlbp/Makefile.depend index 57b7e10c3d7..18f420a9559 100644 --- a/gnu/usr.bin/groff/font/devlbp/Makefile.depend +++ b/gnu/usr.bin/groff/font/devlbp/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ .include diff --git a/gnu/usr.bin/groff/font/devlj4/Makefile.depend b/gnu/usr.bin/groff/font/devlj4/Makefile.depend index 57b7e10c3d7..18f420a9559 100644 --- a/gnu/usr.bin/groff/font/devlj4/Makefile.depend +++ b/gnu/usr.bin/groff/font/devlj4/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ .include diff --git a/gnu/usr.bin/groff/font/devps/Makefile.depend b/gnu/usr.bin/groff/font/devps/Makefile.depend index 57b7e10c3d7..18f420a9559 100644 --- a/gnu/usr.bin/groff/font/devps/Makefile.depend +++ b/gnu/usr.bin/groff/font/devps/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ .include diff --git a/gnu/usr.bin/groff/man/Makefile.depend b/gnu/usr.bin/groff/man/Makefile.depend index 57b7e10c3d7..18f420a9559 100644 --- a/gnu/usr.bin/groff/man/Makefile.depend +++ b/gnu/usr.bin/groff/man/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ .include diff --git a/gnu/usr.bin/groff/src/devices/grodvi/Makefile b/gnu/usr.bin/groff/src/devices/grodvi/Makefile index 37454406520..7c88f046b1a 100644 --- a/gnu/usr.bin/groff/src/devices/grodvi/Makefile +++ b/gnu/usr.bin/groff/src/devices/grodvi/Makefile @@ -6,4 +6,6 @@ DPADD= ${LIBDRIVER} ${LIBGROFF} ${LIBM} LDADD= ${LIBDRIVER} ${LIBGROFF} -lm CLEANFILES= ${MAN} +NO_PIE= yes + .include diff --git a/gnu/usr.bin/groff/src/devices/grodvi/Makefile.depend b/gnu/usr.bin/groff/src/devices/grodvi/Makefile.depend index b5a6296105b..e3872b6cf46 100644 --- a/gnu/usr.bin/groff/src/devices/grodvi/Makefile.depend +++ b/gnu/usr.bin/groff/src/devices/grodvi/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ gnu/usr.bin/groff/src/libs/libdriver \ diff --git a/gnu/usr.bin/groff/src/devices/grohtml/Makefile b/gnu/usr.bin/groff/src/devices/grohtml/Makefile index 321f1c87c82..4d303386e2f 100644 --- a/gnu/usr.bin/groff/src/devices/grohtml/Makefile +++ b/gnu/usr.bin/groff/src/devices/grohtml/Makefile @@ -6,4 +6,6 @@ DPADD= ${LIBDRIVER} ${LIBGROFF} ${LIBM} LDADD= ${LIBDRIVER} ${LIBGROFF} -lm MAN= +NO_PIE= yes + .include diff --git a/gnu/usr.bin/groff/src/devices/grolbp/Makefile b/gnu/usr.bin/groff/src/devices/grolbp/Makefile index 85a41c169b9..69511e09449 100644 --- a/gnu/usr.bin/groff/src/devices/grolbp/Makefile +++ b/gnu/usr.bin/groff/src/devices/grolbp/Makefile @@ -6,4 +6,6 @@ DPADD= ${LIBDRIVER} ${LIBGROFF} ${LIBM} LDADD= ${LIBDRIVER} ${LIBGROFF} -lm CLEANFILES= ${MAN} +NO_PIE= yes + .include diff --git a/gnu/usr.bin/groff/src/devices/grolbp/Makefile.depend b/gnu/usr.bin/groff/src/devices/grolbp/Makefile.depend index b5a6296105b..e3872b6cf46 100644 --- a/gnu/usr.bin/groff/src/devices/grolbp/Makefile.depend +++ b/gnu/usr.bin/groff/src/devices/grolbp/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ gnu/usr.bin/groff/src/libs/libdriver \ diff --git a/gnu/usr.bin/groff/src/devices/grolj4/Makefile b/gnu/usr.bin/groff/src/devices/grolj4/Makefile index bb3f9e4f62d..51a003f0986 100644 --- a/gnu/usr.bin/groff/src/devices/grolj4/Makefile +++ b/gnu/usr.bin/groff/src/devices/grolj4/Makefile @@ -7,4 +7,6 @@ DPADD= ${LIBDRIVER} ${LIBGROFF} ${LIBM} LDADD= ${LIBDRIVER} ${LIBGROFF} -lm CLEANFILES= ${MAN} +NO_PIE= yes + .include diff --git a/gnu/usr.bin/groff/src/devices/grolj4/Makefile.depend b/gnu/usr.bin/groff/src/devices/grolj4/Makefile.depend index b5a6296105b..e3872b6cf46 100644 --- a/gnu/usr.bin/groff/src/devices/grolj4/Makefile.depend +++ b/gnu/usr.bin/groff/src/devices/grolj4/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ gnu/usr.bin/groff/src/libs/libdriver \ diff --git a/gnu/usr.bin/groff/src/devices/grops/Makefile b/gnu/usr.bin/groff/src/devices/grops/Makefile index 4511f69b152..4933dbb184e 100644 --- a/gnu/usr.bin/groff/src/devices/grops/Makefile +++ b/gnu/usr.bin/groff/src/devices/grops/Makefile @@ -6,4 +6,6 @@ DPADD= ${LIBDRIVER} ${LIBGROFF} ${LIBM} LDADD= ${LIBDRIVER} ${LIBGROFF} -lm CLEANFILES= ${MAN} +NO_PIE= yes + .include diff --git a/gnu/usr.bin/groff/src/devices/grops/Makefile.depend b/gnu/usr.bin/groff/src/devices/grops/Makefile.depend index b5a6296105b..e3872b6cf46 100644 --- a/gnu/usr.bin/groff/src/devices/grops/Makefile.depend +++ b/gnu/usr.bin/groff/src/devices/grops/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ gnu/usr.bin/groff/src/libs/libdriver \ diff --git a/gnu/usr.bin/groff/src/devices/grotty/Makefile b/gnu/usr.bin/groff/src/devices/grotty/Makefile index d15ee8bf623..78d6498c806 100644 --- a/gnu/usr.bin/groff/src/devices/grotty/Makefile +++ b/gnu/usr.bin/groff/src/devices/grotty/Makefile @@ -6,4 +6,6 @@ DPADD= ${LIBDRIVER} ${LIBGROFF} ${LIBM} LDADD= ${LIBDRIVER} ${LIBGROFF} -lm CLEANFILES= ${MAN} +NO_PIE= yes + .include diff --git a/gnu/usr.bin/groff/src/devices/grotty/Makefile.depend b/gnu/usr.bin/groff/src/devices/grotty/Makefile.depend index b5a6296105b..e3872b6cf46 100644 --- a/gnu/usr.bin/groff/src/devices/grotty/Makefile.depend +++ b/gnu/usr.bin/groff/src/devices/grotty/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ gnu/usr.bin/groff/src/libs/libdriver \ diff --git a/gnu/usr.bin/groff/src/libs/libgroff/Makefile.depend b/gnu/usr.bin/groff/src/libs/libgroff/Makefile.depend index e507cd0f2c0..d0592e7410d 100644 --- a/gnu/usr.bin/groff/src/libs/libgroff/Makefile.depend +++ b/gnu/usr.bin/groff/src/libs/libgroff/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ include \ include/xlocale \ lib/msun \ diff --git a/gnu/usr.bin/groff/src/preproc/eqn/Makefile b/gnu/usr.bin/groff/src/preproc/eqn/Makefile index 80871fee3c8..9e53be6be77 100644 --- a/gnu/usr.bin/groff/src/preproc/eqn/Makefile +++ b/gnu/usr.bin/groff/src/preproc/eqn/Makefile @@ -11,6 +11,8 @@ SCRIPTS= neqn MAN= eqn.1 neqn.1 CLEANFILES= eqn.cpp eqn_tab.h ${SCRIPTS} ${MAN} y.tab.c y.tab.h +NO_PIE= yes + eqn_tab.h: eqn.cpp .include diff --git a/gnu/usr.bin/groff/src/preproc/eqn/Makefile.depend b/gnu/usr.bin/groff/src/preproc/eqn/Makefile.depend index 78b43b7136d..29914047a11 100644 --- a/gnu/usr.bin/groff/src/preproc/eqn/Makefile.depend +++ b/gnu/usr.bin/groff/src/preproc/eqn/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ gnu/usr.bin/groff/src/libs/libgroff \ diff --git a/gnu/usr.bin/groff/src/preproc/grn/Makefile b/gnu/usr.bin/groff/src/preproc/grn/Makefile index 58309d2a5eb..d85927025f8 100644 --- a/gnu/usr.bin/groff/src/preproc/grn/Makefile +++ b/gnu/usr.bin/groff/src/preproc/grn/Makefile @@ -6,4 +6,6 @@ DPADD= ${LIBGROFF} ${LIBM} LDADD= ${LIBGROFF} -lm CLEANFILES= ${MAN} +NO_PIE= yes + .include diff --git a/gnu/usr.bin/groff/src/preproc/grn/Makefile.depend b/gnu/usr.bin/groff/src/preproc/grn/Makefile.depend index df023f12a0d..0c568068d28 100644 --- a/gnu/usr.bin/groff/src/preproc/grn/Makefile.depend +++ b/gnu/usr.bin/groff/src/preproc/grn/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ gnu/usr.bin/groff/src/libs/libgroff \ diff --git a/gnu/usr.bin/groff/src/preproc/html/Makefile b/gnu/usr.bin/groff/src/preproc/html/Makefile index d46626b4cbf..4e82fd15adb 100644 --- a/gnu/usr.bin/groff/src/preproc/html/Makefile +++ b/gnu/usr.bin/groff/src/preproc/html/Makefile @@ -6,4 +6,6 @@ DPADD= ${LIBGROFF} LDADD= ${LIBGROFF} MAN= +NO_PIE= yes + .include diff --git a/gnu/usr.bin/groff/src/preproc/pic/Makefile b/gnu/usr.bin/groff/src/preproc/pic/Makefile index 3b5939c3bff..2d14d0a7e4a 100644 --- a/gnu/usr.bin/groff/src/preproc/pic/Makefile +++ b/gnu/usr.bin/groff/src/preproc/pic/Makefile @@ -8,6 +8,8 @@ DPADD= ${LIBGROFF} ${LIBM} LDADD= ${LIBGROFF} -lm CLEANFILES= ${MAN} pic.cpp pic_tab.h y.tab.c y.tab.h +NO_PIE= yes + pic_tab.h: pic.cpp .include diff --git a/gnu/usr.bin/groff/src/preproc/pic/Makefile.depend b/gnu/usr.bin/groff/src/preproc/pic/Makefile.depend index dd0bc4c6445..436466d38c2 100644 --- a/gnu/usr.bin/groff/src/preproc/pic/Makefile.depend +++ b/gnu/usr.bin/groff/src/preproc/pic/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ gnu/usr.bin/groff/src/libs/libgroff \ diff --git a/gnu/usr.bin/groff/src/preproc/refer/Makefile b/gnu/usr.bin/groff/src/preproc/refer/Makefile index 8a18f6f7987..ce82c7018d1 100644 --- a/gnu/usr.bin/groff/src/preproc/refer/Makefile +++ b/gnu/usr.bin/groff/src/preproc/refer/Makefile @@ -7,4 +7,6 @@ DPADD= ${LIBBIB} ${LIBGROFF} ${LIBM} LDADD= ${LIBBIB} ${LIBGROFF} -lm CLEANFILES= label.cpp label_tab.h ${MAN} y.tab.c y.tab.h +NO_PIE= yes + .include diff --git a/gnu/usr.bin/groff/src/preproc/refer/Makefile.depend b/gnu/usr.bin/groff/src/preproc/refer/Makefile.depend index 661e26a334f..0eb0288ada9 100644 --- a/gnu/usr.bin/groff/src/preproc/refer/Makefile.depend +++ b/gnu/usr.bin/groff/src/preproc/refer/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ gnu/usr.bin/groff/src/libs/libbib \ diff --git a/gnu/usr.bin/groff/src/preproc/soelim/Makefile b/gnu/usr.bin/groff/src/preproc/soelim/Makefile index 2c68b8005f0..8567a442a74 100644 --- a/gnu/usr.bin/groff/src/preproc/soelim/Makefile +++ b/gnu/usr.bin/groff/src/preproc/soelim/Makefile @@ -6,4 +6,6 @@ DPADD= ${LIBGROFF} LDADD= ${LIBGROFF} CLEANFILES= ${MAN} +NO_PIE= yes + .include diff --git a/gnu/usr.bin/groff/src/preproc/soelim/Makefile.depend b/gnu/usr.bin/groff/src/preproc/soelim/Makefile.depend index df023f12a0d..0c568068d28 100644 --- a/gnu/usr.bin/groff/src/preproc/soelim/Makefile.depend +++ b/gnu/usr.bin/groff/src/preproc/soelim/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ gnu/usr.bin/groff/src/libs/libgroff \ diff --git a/gnu/usr.bin/groff/src/preproc/tbl/Makefile b/gnu/usr.bin/groff/src/preproc/tbl/Makefile index 29e7ac238f8..83bde828d54 100644 --- a/gnu/usr.bin/groff/src/preproc/tbl/Makefile +++ b/gnu/usr.bin/groff/src/preproc/tbl/Makefile @@ -6,4 +6,6 @@ DPADD= ${LIBGROFF} ${LIBM} LDADD= ${LIBGROFF} -lm CLEANFILES= ${MAN} +NO_PIE= yes + .include diff --git a/gnu/usr.bin/groff/src/preproc/tbl/Makefile.depend b/gnu/usr.bin/groff/src/preproc/tbl/Makefile.depend index df023f12a0d..0c568068d28 100644 --- a/gnu/usr.bin/groff/src/preproc/tbl/Makefile.depend +++ b/gnu/usr.bin/groff/src/preproc/tbl/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ gnu/usr.bin/groff/src/libs/libgroff \ diff --git a/gnu/usr.bin/groff/src/roff/groff/Makefile b/gnu/usr.bin/groff/src/roff/groff/Makefile index 2ae541bbb50..576507c911d 100644 --- a/gnu/usr.bin/groff/src/roff/groff/Makefile +++ b/gnu/usr.bin/groff/src/roff/groff/Makefile @@ -6,4 +6,6 @@ DPADD= ${LIBGROFF} ${LIBM} LDADD= ${LIBGROFF} -lm CLEANFILES= ${MAN} +NO_PIE= yes + .include diff --git a/gnu/usr.bin/groff/src/roff/groff/Makefile.depend b/gnu/usr.bin/groff/src/roff/groff/Makefile.depend index df023f12a0d..0c568068d28 100644 --- a/gnu/usr.bin/groff/src/roff/groff/Makefile.depend +++ b/gnu/usr.bin/groff/src/roff/groff/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ gnu/usr.bin/groff/src/libs/libgroff \ diff --git a/gnu/usr.bin/groff/src/roff/grog/Makefile.depend b/gnu/usr.bin/groff/src/roff/grog/Makefile.depend index 57b7e10c3d7..18f420a9559 100644 --- a/gnu/usr.bin/groff/src/roff/grog/Makefile.depend +++ b/gnu/usr.bin/groff/src/roff/grog/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ .include diff --git a/gnu/usr.bin/groff/src/roff/nroff/Makefile.depend b/gnu/usr.bin/groff/src/roff/nroff/Makefile.depend index 57b7e10c3d7..18f420a9559 100644 --- a/gnu/usr.bin/groff/src/roff/nroff/Makefile.depend +++ b/gnu/usr.bin/groff/src/roff/nroff/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ .include diff --git a/gnu/usr.bin/groff/src/roff/troff/Makefile b/gnu/usr.bin/groff/src/roff/troff/Makefile index 802af2b6be0..5c3b83720f2 100644 --- a/gnu/usr.bin/groff/src/roff/troff/Makefile +++ b/gnu/usr.bin/groff/src/roff/troff/Makefile @@ -7,6 +7,8 @@ DPADD= ${LIBGROFF} ${LIBM} LDADD= ${LIBGROFF} -lm CLEANFILES= majorminor.cpp ${MAN} +NO_PIE= yes + .include majorminor.cpp: ${GROFF_DIST}/VERSION ${GROFF_DIST}/REVISION diff --git a/gnu/usr.bin/groff/src/roff/troff/Makefile.depend b/gnu/usr.bin/groff/src/roff/troff/Makefile.depend index 093a8eec5e7..00efcdbf689 100644 --- a/gnu/usr.bin/groff/src/roff/troff/Makefile.depend +++ b/gnu/usr.bin/groff/src/roff/troff/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ gnu/usr.bin/groff/src/libs/libgroff \ diff --git a/gnu/usr.bin/groff/src/utils/addftinfo/Makefile b/gnu/usr.bin/groff/src/utils/addftinfo/Makefile index 26fbb57b9d1..ea3b7a29555 100644 --- a/gnu/usr.bin/groff/src/utils/addftinfo/Makefile +++ b/gnu/usr.bin/groff/src/utils/addftinfo/Makefile @@ -6,4 +6,6 @@ DPADD= ${LIBGROFF} LDADD= ${LIBGROFF} CLEANFILES= ${MAN} +NO_PIE= yes + .include diff --git a/gnu/usr.bin/groff/src/utils/addftinfo/Makefile.depend b/gnu/usr.bin/groff/src/utils/addftinfo/Makefile.depend index df023f12a0d..0c568068d28 100644 --- a/gnu/usr.bin/groff/src/utils/addftinfo/Makefile.depend +++ b/gnu/usr.bin/groff/src/utils/addftinfo/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ gnu/usr.bin/groff/src/libs/libgroff \ diff --git a/gnu/usr.bin/groff/src/utils/afmtodit/Makefile.depend b/gnu/usr.bin/groff/src/utils/afmtodit/Makefile.depend index 57b7e10c3d7..18f420a9559 100644 --- a/gnu/usr.bin/groff/src/utils/afmtodit/Makefile.depend +++ b/gnu/usr.bin/groff/src/utils/afmtodit/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ .include diff --git a/gnu/usr.bin/groff/src/utils/hpftodit/Makefile b/gnu/usr.bin/groff/src/utils/hpftodit/Makefile index 1376702a9a8..512ca1bc796 100644 --- a/gnu/usr.bin/groff/src/utils/hpftodit/Makefile +++ b/gnu/usr.bin/groff/src/utils/hpftodit/Makefile @@ -6,4 +6,6 @@ DPADD= ${LIBGROFF} ${LIBM} LDADD= ${LIBGROFF} -lm CLEANFILES= ${MAN} +NO_PIE= yes + .include diff --git a/gnu/usr.bin/groff/src/utils/hpftodit/Makefile.depend b/gnu/usr.bin/groff/src/utils/hpftodit/Makefile.depend index df023f12a0d..0c568068d28 100644 --- a/gnu/usr.bin/groff/src/utils/hpftodit/Makefile.depend +++ b/gnu/usr.bin/groff/src/utils/hpftodit/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ gnu/usr.bin/groff/src/libs/libgroff \ diff --git a/gnu/usr.bin/groff/src/utils/indxbib/Makefile b/gnu/usr.bin/groff/src/utils/indxbib/Makefile index b2c59a2cee8..86eb4fba7cc 100644 --- a/gnu/usr.bin/groff/src/utils/indxbib/Makefile +++ b/gnu/usr.bin/groff/src/utils/indxbib/Makefile @@ -6,6 +6,8 @@ DPADD= ${LIBBIB} ${LIBGROFF} ${LIBM} LDADD= ${LIBBIB} ${LIBGROFF} -lm CLEANFILES= ${MAN} +NO_PIE= yes + beforeinstall: ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ ${DIST_DIR}/eign ${DESTDIR}${SHAREDIR}/dict/ diff --git a/gnu/usr.bin/groff/src/utils/indxbib/Makefile.depend b/gnu/usr.bin/groff/src/utils/indxbib/Makefile.depend index 48d82090baa..d9e7bc19bd5 100644 --- a/gnu/usr.bin/groff/src/utils/indxbib/Makefile.depend +++ b/gnu/usr.bin/groff/src/utils/indxbib/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ gnu/usr.bin/groff/src/libs/libbib \ diff --git a/gnu/usr.bin/groff/src/utils/lkbib/Makefile b/gnu/usr.bin/groff/src/utils/lkbib/Makefile index f30dc56cbb8..42fbd63e242 100644 --- a/gnu/usr.bin/groff/src/utils/lkbib/Makefile +++ b/gnu/usr.bin/groff/src/utils/lkbib/Makefile @@ -6,4 +6,6 @@ DPADD= ${LIBBIB} ${LIBGROFF} ${LIBM} LDADD= ${LIBBIB} ${LIBGROFF} -lm CLEANFILES= ${MAN} +NO_PIE= yes + .include diff --git a/gnu/usr.bin/groff/src/utils/lkbib/Makefile.depend b/gnu/usr.bin/groff/src/utils/lkbib/Makefile.depend index 48d82090baa..d9e7bc19bd5 100644 --- a/gnu/usr.bin/groff/src/utils/lkbib/Makefile.depend +++ b/gnu/usr.bin/groff/src/utils/lkbib/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ gnu/usr.bin/groff/src/libs/libbib \ diff --git a/gnu/usr.bin/groff/src/utils/lookbib/Makefile b/gnu/usr.bin/groff/src/utils/lookbib/Makefile index 18834a7432d..e2ea17df2ec 100644 --- a/gnu/usr.bin/groff/src/utils/lookbib/Makefile +++ b/gnu/usr.bin/groff/src/utils/lookbib/Makefile @@ -6,4 +6,6 @@ DPADD= ${LIBBIB} ${LIBGROFF} ${LIBM} LDADD= ${LIBBIB} ${LIBGROFF} -lm CLEANFILES= ${MAN} +NO_PIE= yes + .include diff --git a/gnu/usr.bin/groff/src/utils/lookbib/Makefile.depend b/gnu/usr.bin/groff/src/utils/lookbib/Makefile.depend index 48d82090baa..d9e7bc19bd5 100644 --- a/gnu/usr.bin/groff/src/utils/lookbib/Makefile.depend +++ b/gnu/usr.bin/groff/src/utils/lookbib/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ gnu/usr.bin/groff/src/libs/libbib \ diff --git a/gnu/usr.bin/groff/src/utils/pfbtops/Makefile.depend b/gnu/usr.bin/groff/src/utils/pfbtops/Makefile.depend index fd3efc3ce77..21bca0b4401 100644 --- a/gnu/usr.bin/groff/src/utils/pfbtops/Makefile.depend +++ b/gnu/usr.bin/groff/src/utils/pfbtops/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ gnu/usr.bin/groff/src/libs/libgroff \ diff --git a/gnu/usr.bin/groff/src/utils/tfmtodit/Makefile b/gnu/usr.bin/groff/src/utils/tfmtodit/Makefile index ba3bbc54646..1b0434fbfd7 100644 --- a/gnu/usr.bin/groff/src/utils/tfmtodit/Makefile +++ b/gnu/usr.bin/groff/src/utils/tfmtodit/Makefile @@ -6,4 +6,6 @@ DPADD= ${LIBGROFF} ${LIBM} LDADD= ${LIBGROFF} -lm CLEANFILES= ${MAN} +NO_PIE= yes + .include diff --git a/gnu/usr.bin/groff/src/utils/tfmtodit/Makefile.depend b/gnu/usr.bin/groff/src/utils/tfmtodit/Makefile.depend index df023f12a0d..0c568068d28 100644 --- a/gnu/usr.bin/groff/src/utils/tfmtodit/Makefile.depend +++ b/gnu/usr.bin/groff/src/utils/tfmtodit/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ gnu/usr.bin/groff/src/libs/libgroff \ diff --git a/gnu/usr.bin/groff/tmac/Makefile.depend b/gnu/usr.bin/groff/tmac/Makefile.depend index 57b7e10c3d7..18f420a9559 100644 --- a/gnu/usr.bin/groff/tmac/Makefile.depend +++ b/gnu/usr.bin/groff/tmac/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ .include diff --git a/gnu/usr.bin/groff/tmac/mdoc.local b/gnu/usr.bin/groff/tmac/mdoc.local index bbab7047825..e7ec4cf4ad7 100644 --- a/gnu/usr.bin/groff/tmac/mdoc.local +++ b/gnu/usr.bin/groff/tmac/mdoc.local @@ -35,6 +35,7 @@ .ds doc-str-Lb-libarchive Streaming Archive Library (libarchive, \-larchive) .ds doc-str-Lb-libbluetooth Bluetooth User Library (libbluetooth, \-lbluetooth) .ds doc-str-Lb-libcapsicum Capsicum Library (libcapsicum, \-lcapsicum) +.ds doc-str-Lb-libcuse Userland Character Device Library (libcuse, \-lcuse) .ds doc-str-Lb-libedit Line Editor and History Library (libedit, \-ledit) .ds doc-str-Lb-libefi EFI Runtime Services Library (libefi, \-lefi) .ds doc-str-Lb-libelf ELF Parsing Library (libelf, \-lelf) @@ -58,9 +59,12 @@ .ds doc-operating-system-FreeBSD-8.4 8.4 .ds doc-operating-system-FreeBSD-9.1 9.1 .ds doc-operating-system-FreeBSD-9.2 9.2 +.ds doc-operating-system-FreeBSD-9.3 9.3 .ds doc-operating-system-FreeBSD-10.0 10.0 .ds doc-operating-system-FreeBSD-10.1 10.1 .ds doc-operating-system-FreeBSD-11.0 11.0 +. +.\" Definitions for other *BSDs not (yet) in doc-common .ds doc-operating-system-NetBSD-7.0 7.0 . .\" Definitions not (yet) in doc-syms diff --git a/gnu/usr.bin/rcs/Makefile.inc b/gnu/usr.bin/rcs/Makefile.inc index a46437ad8c8..912ae7b44e4 100644 --- a/gnu/usr.bin/rcs/Makefile.inc +++ b/gnu/usr.bin/rcs/Makefile.inc @@ -1,3 +1,4 @@ # $FreeBSD$ LIBRCS= ${.OBJDIR}/../lib/librcs.a +NO_PIE= yes diff --git a/gnu/usr.bin/texinfo/info/Makefile b/gnu/usr.bin/texinfo/info/Makefile index b4e44ac33a8..de95af6ec63 100644 --- a/gnu/usr.bin/texinfo/info/Makefile +++ b/gnu/usr.bin/texinfo/info/Makefile @@ -10,8 +10,10 @@ SRCS= dir.c display.c doc.c dribble.c echo-area.c filesys.c \ CFLAGS+= -DINFODIR=\"${INFODIR}:/usr/local/info:.\" -DPADD= ${LIBTERMCAP} ${LIBTXI} -LDADD= -ltermcap ${LIBTXI} +DPADD= ${LIBTERMCAPW} ${LIBTXI} +LDADD= -ltermcapw ${LIBTXI} + +NO_PIE= yes .include diff --git a/gnu/usr.bin/texinfo/info/Makefile.depend b/gnu/usr.bin/texinfo/info/Makefile.depend index 1afa811efa5..5f2bf774f98 100644 --- a/gnu/usr.bin/texinfo/info/Makefile.depend +++ b/gnu/usr.bin/texinfo/info/Makefile.depend @@ -11,7 +11,6 @@ DIRDEPS = \ lib/${CSU_DIR} \ lib/libc \ lib/libcompiler_rt \ - lib/ncurses/ncurses \ lib/ncurses/ncursesw \ diff --git a/gnu/usr.bin/texinfo/infokey/Makefile b/gnu/usr.bin/texinfo/infokey/Makefile index 50be00d9140..d42406faa96 100644 --- a/gnu/usr.bin/texinfo/infokey/Makefile +++ b/gnu/usr.bin/texinfo/infokey/Makefile @@ -6,6 +6,8 @@ SRCS= infokey.c key.c DPADD= ${LIBTXI} LDADD= ${LIBTXI} +NO_PIE= yes + .include .PATH: ${TXIDIR}/info ${TXIDIR}/doc diff --git a/gnu/usr.bin/texinfo/install-info/Makefile b/gnu/usr.bin/texinfo/install-info/Makefile index 325c9095b35..21ab9ea4038 100644 --- a/gnu/usr.bin/texinfo/install-info/Makefile +++ b/gnu/usr.bin/texinfo/install-info/Makefile @@ -5,6 +5,8 @@ PROG= install-info DPADD= ${LIBTXI} LDADD= ${LIBTXI} +NO_PIE= yes + .include .PATH: ${TXIDIR}/util ${TXIDIR}/doc diff --git a/gnu/usr.bin/texinfo/makeinfo/Makefile b/gnu/usr.bin/texinfo/makeinfo/Makefile index 373c326467b..1c3b77d3efd 100644 --- a/gnu/usr.bin/texinfo/makeinfo/Makefile +++ b/gnu/usr.bin/texinfo/makeinfo/Makefile @@ -8,6 +8,8 @@ SRCS= cmds.c defun.c files.c float.c footnote.c html.c \ DPADD= ${LIBTXI} LDADD= ${LIBTXI} +NO_PIE= yes + .include .PATH: $(TXIDIR)/makeinfo $(TXIDIR)/doc diff --git a/gnu/usr.bin/texinfo/texindex/Makefile b/gnu/usr.bin/texinfo/texindex/Makefile index 91c2dfc14e3..796d627dd92 100644 --- a/gnu/usr.bin/texinfo/texindex/Makefile +++ b/gnu/usr.bin/texinfo/texindex/Makefile @@ -5,6 +5,8 @@ PROG= texindex DPADD= ${LIBTXI} LDADD= ${LIBTXI} +NO_PIE= yes + .include .PATH: ${TXIDIR}/util ${TXIDIR}/doc diff --git a/include/Makefile b/include/Makefile index b1ffc6fcb49..8a5e9a2235c 100644 --- a/include/Makefile +++ b/include/Makefile @@ -6,11 +6,11 @@ .include CLEANFILES= osreldate.h version vers.c -SUBDIR= arpa gssapi protocols rpcsvc rpc xlocale +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 gssapi.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 \ @@ -45,6 +45,7 @@ LSUBDIRS= cam/ata cam/scsi \ dev/ic dev/iicbus ${_dev_ieee488} 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 \ @@ -66,6 +67,11 @@ _dev_powermac_nvram= dev/powermac_nvram _dev_ieee488= dev/ieee488 .endif +.if ${MK_GSSAPI} != "no" +SUBDIR+= gssapi +INCS+= gssapi.h +.endif + .if ${MK_HESIOD} != "no" INCS+= hesiod.h .endif diff --git a/include/Makefile.depend b/include/Makefile.depend index 8b97128420c..482a633b879 100644 --- a/include/Makefile.depend +++ b/include/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ usr.bin/xinstall.host \ diff --git a/include/dirent.h b/include/dirent.h index f43210c7ddb..b894bb84532 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -40,7 +40,7 @@ #include #include -#if __BSD_VISIBLE || __XSI_VISIBLE +#if __XSI_VISIBLE /* * XXX this is probably illegal in the __XSI_VISIBLE case, but brings us closer * to the specification. @@ -63,6 +63,7 @@ typedef struct _dirdesc DIR; #define DTF_NODUP 0x0002 /* don't return duplicate names */ #define DTF_REWIND 0x0004 /* rewind after reading union stack */ #define __DTF_READALL 0x0008 /* everything has been read */ +#define __DTF_SKIPREAD 0x0010 /* assume internal buffer is populated */ #else /* !__BSD_VISIBLE */ diff --git a/include/grp.h b/include/grp.h index e7f65ecad63..b10fd0f8ad3 100644 --- a/include/grp.h +++ b/include/grp.h @@ -61,7 +61,7 @@ struct group { }; __BEGIN_DECLS -#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE +#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE void endgrent(void); struct group *getgrent(void); #endif @@ -74,11 +74,11 @@ int pwcache_groupdb(int (*)(int), void (*)(void), struct group * (*)(const char *), struct group * (*)(gid_t)); #endif -#if __BSD_VISIBLE || __XSI_VISIBLE +#if __XSI_VISIBLE /* XXX IEEE Std 1003.1, 2003 specifies `void setgrent(void)' */ int setgrent(void); #endif -#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE +#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE int getgrgid_r(gid_t, struct group *, char *, size_t, struct group **); int getgrnam_r(const char *, struct group *, char *, size_t, diff --git a/include/search.h b/include/search.h index 4e4606f1272..068c82d3ca6 100644 --- a/include/search.h +++ b/include/search.h @@ -1,8 +1,8 @@ /*- - * Written by J.T. Conklin + * Written by J.T. Conklin * Public domain. * - * $NetBSD: search.h,v 1.12 1999/02/22 10:34:28 christos Exp $ + * $NetBSD: search.h,v 1.16 2005/02/03 04:39:32 perry Exp $ * $FreeBSD$ */ @@ -45,6 +45,15 @@ struct que_elem { }; #endif +#if __BSD_VISIBLE +struct _ENTRY; +struct hsearch_data { + struct _ENTRY *table; + size_t size; + size_t filled; +}; +#endif + __BEGIN_DECLS int hcreate(size_t); void hdestroy(void); @@ -61,6 +70,13 @@ void *tfind(const void *, void * const *, int (*)(const void *, const void *)); void *tsearch(const void *, void **, int (*)(const void *, const void *)); void twalk(const void *, void (*)(const void *, VISIT, int)); + +#if __BSD_VISIBLE +int hcreate_r(size_t, struct hsearch_data *); +void hdestroy_r(struct hsearch_data *); +int hsearch_r(ENTRY, ACTION, ENTRY **, struct hsearch_data *); +#endif + __END_DECLS #endif /* !_SEARCH_H_ */ diff --git a/include/setjmp.h b/include/setjmp.h index bf03f6fbb43..598e07a77bc 100644 --- a/include/setjmp.h +++ b/include/setjmp.h @@ -44,7 +44,7 @@ #include __BEGIN_DECLS -#if __BSD_VISIBLE || __XSI_VISIBLE >= 600 +#if __XSI_VISIBLE >= 600 void _longjmp(jmp_buf, int) __dead2; int _setjmp(jmp_buf) __returns_twice; #endif @@ -53,7 +53,7 @@ void longjmp(jmp_buf, int) __dead2; void longjmperror(void); #endif int setjmp(jmp_buf) __returns_twice; -#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE +#if __POSIX_VISIBLE || __XSI_VISIBLE void siglongjmp(sigjmp_buf, int) __dead2; int sigsetjmp(sigjmp_buf, int) __returns_twice; #endif diff --git a/include/signal.h b/include/signal.h index e7447dfd053..dca19aaa861 100644 --- a/include/signal.h +++ b/include/signal.h @@ -108,7 +108,7 @@ int xsi_sigpause(int); int siginterrupt(int, int); #endif -#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE +#if __POSIX_VISIBLE >= 200809 void psignal(unsigned int, const char *); #endif diff --git a/include/stdio.h b/include/stdio.h index 19b1e20f66b..512e60e9ac1 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -47,7 +47,7 @@ typedef __size_t size_t; #define _SIZE_T_DECLARED #endif -#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 +#if __POSIX_VISIBLE >= 200809 #ifndef _OFF_T_DECLARED #define _OFF_T_DECLARED typedef __off_t off_t; @@ -58,7 +58,7 @@ typedef __ssize_t ssize_t; #endif #endif -#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE +#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE #ifndef _VA_LIST_DECLARED typedef __va_list va_list; #define _VA_LIST_DECLARED @@ -290,7 +290,7 @@ int vsscanf(const char * __restrict, const char * __restrict, __va_list) /* * Functions defined in all versions of POSIX 1003.1. */ -#if __BSD_VISIBLE || __POSIX_VISIBLE <= 199506 +#if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE <= 199506) #define L_cuserid 17 /* size for cuserid(3); MAXLOGNAME, legacy */ #endif @@ -342,7 +342,7 @@ int putw(int, FILE *); char *tempnam(const char *, const char *); #endif -#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 +#if __POSIX_VISIBLE >= 200809 FILE *fmemopen(void * __restrict, size_t, const char * __restrict); ssize_t getdelim(char ** __restrict, size_t * __restrict, int, FILE * __restrict); @@ -387,7 +387,7 @@ ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict); int (dprintf)(int, const char * __restrict, ...); #endif -#endif /* __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 */ +#endif /* __POSIX_VISIBLE >= 200809 */ /* * Routines that are purely local. diff --git a/include/string.h b/include/string.h index ceffcf6aeaa..af8b0d46c86 100644 --- a/include/string.h +++ b/include/string.h @@ -65,7 +65,7 @@ void *memmem(const void *, size_t, const void *, size_t) __pure; #endif void *memmove(void *, const void *, size_t); void *memset(void *, int, size_t); -#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE +#if __POSIX_VISIBLE >= 200809 char *stpcpy(char * __restrict, const char * __restrict); char *stpncpy(char * __restrict, const char * __restrict, size_t); #endif @@ -99,7 +99,7 @@ void strmode(int, char *); char *strncat(char * __restrict, const char * __restrict, size_t); int strncmp(const char *, const char *, size_t) __pure; char *strncpy(char * __restrict, const char * __restrict, size_t); -#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE +#if __POSIX_VISIBLE >= 200809 char *strndup(const char *, size_t) __malloc_like; size_t strnlen(const char *, size_t) __pure; #endif @@ -111,7 +111,7 @@ char *strrchr(const char *, int) __pure; #if __BSD_VISIBLE char *strsep(char **, const char *); #endif -#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE +#if __POSIX_VISIBLE >= 200809 char *strsignal(int); #endif size_t strspn(const char *, const char *) __pure; diff --git a/include/strings.h b/include/strings.h index f2720786f09..4fb9311657f 100644 --- a/include/strings.h +++ b/include/strings.h @@ -59,6 +59,10 @@ char *rindex(const char *, int) __pure; /* LEGACY */ #endif int strcasecmp(const char *, const char *) __pure; int strncasecmp(const char *, const char *, size_t) __pure; + +#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_) +#include +#endif __END_DECLS #endif /* _STRINGS_H_ */ diff --git a/include/termios.h b/include/termios.h index e41da9fea12..ed8e328d7fd 100644 --- a/include/termios.h +++ b/include/termios.h @@ -81,7 +81,7 @@ int tcflow(int, int); int tcflush(int, int); int tcsendbreak(int, int); -#if __POSIX_VISIBLE >= 200112 || __BSD_VISIBLE +#if __POSIX_VISIBLE >= 200112 pid_t tcgetsid(int); #endif #if __BSD_VISIBLE diff --git a/include/unistd.h b/include/unistd.h index 5868ba2ed94..f1913b69345 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -426,7 +426,7 @@ int truncate(const char *, off_t); #endif #endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */ -#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE +#if __POSIX_VISIBLE >= 200809 int faccessat(int, const char *, int, int); int fchownat(int, const char *, uid_t, gid_t, int); int fexecve(int, char *const [], char *const []); @@ -434,14 +434,14 @@ int linkat(int, const char *, int, const char *, int); ssize_t readlinkat(int, const char * __restrict, char * __restrict, size_t); int symlinkat(const char *, int, const char *); int unlinkat(int, const char *, int); -#endif /* __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE */ +#endif /* __POSIX_VISIBLE >= 200809 */ /* * symlink() was originally in POSIX.1a, which was withdrawn after * being overtaken by events (1003.1-2001). It was in XPG4.2, and of * course has been in BSD since 4.2. */ -#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 402 || __BSD_VISIBLE +#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 402 int symlink(const char * __restrict, const char * __restrict); #endif diff --git a/include/wchar.h b/include/wchar.h index 8233bdff101..84a4a976e6b 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -204,7 +204,7 @@ int wcwidth(wchar_t); #define wcwidth(_c) __wcwidth(_c) #endif -#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE +#if __POSIX_VISIBLE >= 200809 size_t mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t, size_t, mbstate_t * __restrict); FILE *open_wmemstream(wchar_t **, size_t *); diff --git a/include/xlocale/Makefile b/include/xlocale/Makefile index 2dd4a9824bc..0ece6d29741 100644 --- a/include/xlocale/Makefile +++ b/include/xlocale/Makefile @@ -1,7 +1,7 @@ # $FreeBSD$ INCS= _ctype.h _inttypes.h _langinfo.h _locale.h _monetary.h _stdio.h\ - _stdlib.h _string.h _time.h _uchar.h _wchar.h + _stdlib.h _string.h _strings.h _time.h _uchar.h _wchar.h INCSDIR=${INCLUDEDIR}/xlocale .include diff --git a/include/xlocale/_string.h b/include/xlocale/_string.h index 262728066c2..a7c146efc92 100644 --- a/include/xlocale/_string.h +++ b/include/xlocale/_string.h @@ -53,9 +53,7 @@ size_t strxfrm_l(char *, const char *, size_t, locale_t); #ifdef _XLOCALE_H_ #ifndef _XLOCALE_STRING2_H #define _XLOCALE_STRING2_H -int strcasecmp_l(const char *, const char *, locale_t); char *strcasestr_l(const char *, const char *, locale_t); -int strncasecmp_l(const char *, const char *, size_t, locale_t); #endif /* _XLOCALE_STRING2_H */ #endif /* _XLOCALE_H_ */ diff --git a/sys/ia64/include/vm.h b/include/xlocale/_strings.h similarity index 68% rename from sys/ia64/include/vm.h rename to include/xlocale/_strings.h index 717677159ec..da1cff3e707 100644 --- a/sys/ia64/include/vm.h +++ b/include/xlocale/_strings.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009 Alan L. Cox + * Copyright (c) 2011, 2012 The FreeBSD Foundation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,19 +26,23 @@ * $FreeBSD$ */ -#ifndef _MACHINE_VM_H_ -#define _MACHINE_VM_H_ +#ifndef _LOCALE_T_DEFINED +#define _LOCALE_T_DEFINED +typedef struct _xlocale *locale_t; +#endif -#include -#include +/* + * This file is included from both strings.h and xlocale.h. We need to expose + * the declarations unconditionally if we are included from xlocale.h, but only + * if we are in POSIX2008 mode if included from string.h. + */ -/* Memory attributes. */ -#define VM_MEMATTR_WRITE_BACK ((vm_memattr_t)PTE_MA_WB) -#define VM_MEMATTR_UNCACHEABLE ((vm_memattr_t)PTE_MA_UC) -#define VM_MEMATTR_UNCACHEABLE_EXPORTED ((vm_memattr_t)PTE_MA_UCE) -#define VM_MEMATTR_WRITE_COMBINING ((vm_memattr_t)PTE_MA_WC) -#define VM_MEMATTR_NATPAGE ((vm_memattr_t)PTE_MA_NATPAGE) +#ifndef _XLOCALE_STRINGS1_H +#define _XLOCALE_STRINGS1_H -#define VM_MEMATTR_DEFAULT VM_MEMATTR_WRITE_BACK - -#endif /* !_MACHINE_VM_H_ */ +/* + * POSIX2008 functions + */ +int strcasecmp_l(const char *, const char *, locale_t); +int strncasecmp_l(const char *, const char *, size_t, locale_t); +#endif /* _XLOCALE_STRINGS1_H */ diff --git a/kerberos5/libexec/digest-service/Makefile b/kerberos5/libexec/digest-service/Makefile index 72f7125fa2f..937d0bf12af 100644 --- a/kerberos5/libexec/digest-service/Makefile +++ b/kerberos5/libexec/digest-service/Makefile @@ -14,6 +14,8 @@ LDADD= -lhdb -lkdc -lheimipcs -lkrb5 -lroken -lasn1 -lcrypto -lcrypt \ ${LIBVERS} -lheimntlm USEPRIVATELIB= heimipcs +NO_PIE= yes + .include .PATH: ${KRB5DIR}/kdc diff --git a/kerberos5/libexec/digest-service/Makefile.depend b/kerberos5/libexec/digest-service/Makefile.depend index 2ced5dae087..8910b8443c6 100644 --- a/kerberos5/libexec/digest-service/Makefile.depend +++ b/kerberos5/libexec/digest-service/Makefile.depend @@ -11,7 +11,6 @@ DIRDEPS = \ kerberos5/lib/libasn1 \ kerberos5/lib/libhdb \ kerberos5/lib/libheimbase \ - kerberos5/lib/libheimipcc \ kerberos5/lib/libheimipcs \ kerberos5/lib/libheimntlm \ kerberos5/lib/libheimsqlite \ diff --git a/kerberos5/libexec/hprop/Makefile b/kerberos5/libexec/hprop/Makefile index ac1dffa81a6..95b473961de 100644 --- a/kerberos5/libexec/hprop/Makefile +++ b/kerberos5/libexec/hprop/Makefile @@ -16,6 +16,8 @@ LDADD= -lhdb -lkrb5 -lhx509 -lroken ${LIBVERS} \ -lasn1 -lcrypto -lcrypt -lcom_err ${LDAPLDADD} LDFLAGS=${LDAPLDFLAGS} +NO_PIE= yes + .include .PATH: ${KRB5DIR}/kdc diff --git a/kerberos5/libexec/hpropd/Makefile b/kerberos5/libexec/hpropd/Makefile index e0722bd3864..31a5895a87a 100644 --- a/kerberos5/libexec/hpropd/Makefile +++ b/kerberos5/libexec/hpropd/Makefile @@ -10,6 +10,8 @@ LDADD= -lhdb -lkrb5 -lhx509 -lroken ${LIBVERS} \ -lasn1 -lcrypto -lcrypt -lcom_err ${LDAPLDADD} LDFLAGS=${LDAPLDFLAGS} +NO_PIE= yes + .include .PATH: ${KRB5DIR}/kdc diff --git a/kerberos5/libexec/ipropd-master/Makefile b/kerberos5/libexec/ipropd-master/Makefile index 99a4f9c3ca3..8dbe31536e3 100644 --- a/kerberos5/libexec/ipropd-master/Makefile +++ b/kerberos5/libexec/ipropd-master/Makefile @@ -11,6 +11,8 @@ LDADD= -lkadm5srv -lhdb -lkrb5 -lhx509 -lroken ${LIBVERS} \ -lasn1 -lcrypto -lcrypt -lcom_err ${LDAPLDADD} LDFLAGS=${LDAPLDFLAGS} +NO_PIE= yes + foo:: echo ${LIBHX509} diff --git a/kerberos5/libexec/ipropd-slave/Makefile b/kerberos5/libexec/ipropd-slave/Makefile index 8a72d9e8b2e..4aa1f2783e3 100644 --- a/kerberos5/libexec/ipropd-slave/Makefile +++ b/kerberos5/libexec/ipropd-slave/Makefile @@ -11,6 +11,8 @@ LDADD= -lkadm5srv -lhdb -lkrb5 -lhx509 -lroken ${LIBVERS} \ -lasn1 -lcrypto -lcrypt -lcom_err ${LDAPLDADD} LDFLAGS=${LDAPLDFLAGS} +NO_PIE= yes + .include .PATH: ${KRB5DIR}/lib/kadm5 diff --git a/kerberos5/libexec/kadmind/Makefile b/kerberos5/libexec/kadmind/Makefile index f88ac2f1b33..898e429de0d 100644 --- a/kerberos5/libexec/kadmind/Makefile +++ b/kerberos5/libexec/kadmind/Makefile @@ -15,6 +15,8 @@ LDADD= -lkadm5srv -lgssapi -lhdb -lkrb5 -lroken \ -lasn1 ${LIBVERS} -lcrypto -lcrypt ${LDAPLDADD} LDFLAGS=${LDAPLDFLAGS} +NO_PIE= yes + .include .PATH: ${KRB5DIR}/kadmin diff --git a/kerberos5/libexec/kcm/Makefile b/kerberos5/libexec/kcm/Makefile index bc84c051831..003c5104f9c 100644 --- a/kerberos5/libexec/kcm/Makefile +++ b/kerberos5/libexec/kcm/Makefile @@ -26,6 +26,8 @@ LDADD= -lhdb -lkrb5 -lroken -lasn1 -lheimntlm -lheimipcs \ USEPRIVATELIB= heimipcs LDFLAGS=${LDAPLDFLAGS} +NO_PIE= yes + .include .PATH: ${KRB5DIR}/kcm diff --git a/kerberos5/libexec/kcm/Makefile.depend b/kerberos5/libexec/kcm/Makefile.depend index 35a316f8b7a..ae60a400a04 100644 --- a/kerberos5/libexec/kcm/Makefile.depend +++ b/kerberos5/libexec/kcm/Makefile.depend @@ -11,7 +11,6 @@ DIRDEPS = \ kerberos5/lib/libasn1 \ kerberos5/lib/libhdb \ kerberos5/lib/libheimbase \ - kerberos5/lib/libheimipcc \ kerberos5/lib/libheimipcs \ kerberos5/lib/libheimntlm \ kerberos5/lib/libheimsqlite \ diff --git a/kerberos5/libexec/kdc/Makefile b/kerberos5/libexec/kdc/Makefile index 4ca5c3a201b..b309a257ac6 100644 --- a/kerberos5/libexec/kdc/Makefile +++ b/kerberos5/libexec/kdc/Makefile @@ -14,6 +14,8 @@ DPADD= ${LIBKDC} ${LIBHDB} ${LIBKRB5} ${LIBROKEN} ${LIBASN1} \ ${LIBCRYPTO} ${LIBCRYPT} ${LIBVERS} LDADD= -lkdc -lhdb -lkrb5 -lroken -lasn1 -lcrypto -lcrypt ${LIBVERS} +NO_PIE= yes + .include .PATH: ${KRB5DIR}/kdc diff --git a/kerberos5/libexec/kdigest/Makefile b/kerberos5/libexec/kdigest/Makefile index c88e3b990f0..03f1ddfb5ba 100644 --- a/kerberos5/libexec/kdigest/Makefile +++ b/kerberos5/libexec/kdigest/Makefile @@ -13,6 +13,8 @@ SRCS= kdigest.c \ kdigest-commands.c \ kdigest-commands.h +NO_PIE= yes + kdigest-commands.h: kdigest-commands.in ${SLC} ${.ALLSRC:M*.in} diff --git a/kerberos5/libexec/kdigest/Makefile.depend b/kerberos5/libexec/kdigest/Makefile.depend index 28e098540a8..a99bfacec01 100644 --- a/kerberos5/libexec/kdigest/Makefile.depend +++ b/kerberos5/libexec/kdigest/Makefile.depend @@ -26,7 +26,7 @@ DIRDEPS = \ lib/libcrypt \ lib/libedit \ lib/libthr \ - lib/ncurses/ncurses \ + lib/ncurses/ncursesw \ secure/lib/libcrypto \ diff --git a/kerberos5/libexec/kfd/Makefile b/kerberos5/libexec/kfd/Makefile index f5081f18bed..130cd45390a 100644 --- a/kerberos5/libexec/kfd/Makefile +++ b/kerberos5/libexec/kfd/Makefile @@ -9,6 +9,8 @@ DPADD= ${LIBKRB5} ${LIBROKEN} ${LIBASN1} ${LIBCRYPTO} \ LDADD= -lkrb5 -lroken -lasn1 -lcrypto -lcrypt \ ${LIBVERS} +NO_PIE= yes + .include .PATH: ${KRB5DIR}/appl/kf diff --git a/kerberos5/libexec/kimpersonate/Makefile b/kerberos5/libexec/kimpersonate/Makefile index 32f97772c9b..2dfeecbe3b9 100644 --- a/kerberos5/libexec/kimpersonate/Makefile +++ b/kerberos5/libexec/kimpersonate/Makefile @@ -11,6 +11,8 @@ DPADD= ${LIBKAFS5} ${LIBKRB5} ${LIBHEIMNTLM} ${LIBROKEN} ${LIBASN1} ${LIBCRYPTO} LDADD= -lkafs5 -lkrb5 -lheimntlm -lroken -lasn1 -lcrypto -lcrypt \ ${LIBVERS} +NO_PIE= yes + .include .PATH: ${KRB5DIR}/kuser diff --git a/kerberos5/libexec/kpasswdd/Makefile b/kerberos5/libexec/kpasswdd/Makefile index 22876861eda..4d3914ca05f 100644 --- a/kerberos5/libexec/kpasswdd/Makefile +++ b/kerberos5/libexec/kpasswdd/Makefile @@ -9,6 +9,8 @@ LDADD= -lkadm5srv -lhdb -lkrb5 -lhx509 -lroken ${LIBVERS} \ -lasn1 -lcrypto -lcrypt -lcom_err ${LDAPLDADD} LDFLAGS=${LDAPLDFLAGS} +NO_PIE= yes + .include .PATH: ${KRB5DIR}/kpasswd diff --git a/kerberos5/tools/asn1_compile/Makefile b/kerberos5/tools/asn1_compile/Makefile index 88224da89ef..45b04e12f42 100644 --- a/kerberos5/tools/asn1_compile/Makefile +++ b/kerberos5/tools/asn1_compile/Makefile @@ -27,6 +27,8 @@ CFLAGS+=-I${KRB5DIR}/lib/roken -I${KRB5DIR}/lib/asn1 -I. CLEANFILES= roken.h lex.c parse.c +NO_PIE= yes + roken.h: make-roken > ${.TARGET} diff --git a/kerberos5/tools/slc/Makefile b/kerberos5/tools/slc/Makefile index 1a26e7cd795..ee98843c667 100644 --- a/kerberos5/tools/slc/Makefile +++ b/kerberos5/tools/slc/Makefile @@ -14,6 +14,8 @@ CFLAGS+=-I${KRB5DIR}/lib/roken -I${KRB5DIR}/lib/sl -I${KRB5DIR}/lib/vers -I. CLEANFILES= roken.h slc-gram.c slc-lex.c +NO_PIE= yes + roken.h: ${MAKE_ROKEN} > ${.TARGET} diff --git a/kerberos5/usr.bin/hxtool/Makefile b/kerberos5/usr.bin/hxtool/Makefile index 3946484b78a..a51dd7df73d 100644 --- a/kerberos5/usr.bin/hxtool/Makefile +++ b/kerberos5/usr.bin/hxtool/Makefile @@ -10,6 +10,8 @@ DPADD= ${LIBHX509} ${LIBROKEN} ${LIBASN1} ${LIBCRYPTO} ${LIBCRYPT} ${LIBSL} ${LI LDADD= -lhx509 -lroken -lasn1 -lcrypto -lcrypt ${LIBSL} ${LIBVERS} -ledit SRCS= hxtool.c hxtool-commands.c hxtool-commands.h +NO_PIE= yes + hxtool-commands.h: hxtool-commands.in ${SLC} ${.ALLSRC:M*.in} diff --git a/kerberos5/usr.bin/hxtool/Makefile.depend b/kerberos5/usr.bin/hxtool/Makefile.depend index fc0959323f0..f5b3362ab82 100644 --- a/kerberos5/usr.bin/hxtool/Makefile.depend +++ b/kerberos5/usr.bin/hxtool/Makefile.depend @@ -20,7 +20,7 @@ DIRDEPS = \ lib/libcompiler_rt \ lib/libcrypt \ lib/libedit \ - lib/ncurses/ncurses \ + lib/ncurses/ncursesw \ secure/lib/libcrypto \ diff --git a/kerberos5/usr.bin/kadmin/Makefile b/kerberos5/usr.bin/kadmin/Makefile index c04ad360adb..b01d78923a8 100644 --- a/kerberos5/usr.bin/kadmin/Makefile +++ b/kerberos5/usr.bin/kadmin/Makefile @@ -29,13 +29,15 @@ CFLAGS+=-I${KRB5DIR}/lib/asn1 -I${KRB5DIR}/lib/krb5 -I${KRB5DIR}/lib/roken \ DPADD= ${LIBKADM5CLNT} ${LIBKADM5SRV} ${LIBHDB} ${LIBKRB5} ${LIBHX509} \ ${LIBSL} ${LIBROKEN} ${LIBVERS} ${LIBASN1} \ ${LIBCRYPTO} ${LIBCRYPT} ${LIBCOM_ERR} \ - ${LIBEDIT} ${LIBNCURSES} ${LDAPDPADD} + ${LIBEDIT} ${LIBNCURSESW} ${LDAPDPADD} LDADD= -lkadm5clnt -lkadm5srv -lhdb -lkrb5 -lhx509 \ ${LIBSL} -lroken ${LIBVERS} -lasn1 \ -lcrypto -lcrypt -lcom_err \ - -ledit -lncurses ${LDAPLDADD} + -ledit -lncursesw ${LDAPLDADD} LDFLAGS=${LDAPLDFLAGS} +NO_PIE= yes + .include kadmin-commands.h: ${KRB5DIR}/kadmin/kadmin-commands.in diff --git a/kerberos5/usr.bin/kadmin/Makefile.depend b/kerberos5/usr.bin/kadmin/Makefile.depend index 17a95c6a6b7..77fe838cb0e 100644 --- a/kerberos5/usr.bin/kadmin/Makefile.depend +++ b/kerberos5/usr.bin/kadmin/Makefile.depend @@ -29,7 +29,7 @@ DIRDEPS = \ lib/libedit \ lib/libthr \ lib/libutil \ - lib/ncurses/ncurses \ + lib/ncurses/ncursesw \ secure/lib/libcrypto \ diff --git a/kerberos5/usr.bin/kcc/Makefile b/kerberos5/usr.bin/kcc/Makefile index 3da43d7a35b..16487a2362b 100644 --- a/kerberos5/usr.bin/kcc/Makefile +++ b/kerberos5/usr.bin/kcc/Makefile @@ -19,6 +19,8 @@ SRCS= kcc.c \ kswitch.c \ copy_cred_cache.c +NO_PIE= yes + kcc-commands.h: kcc-commands.in ${SLC} ${.ALLSRC:M*.in} diff --git a/kerberos5/usr.bin/kcc/Makefile.depend b/kerberos5/usr.bin/kcc/Makefile.depend index 57e50ba9ef6..b00a47f2b6f 100644 --- a/kerberos5/usr.bin/kcc/Makefile.depend +++ b/kerberos5/usr.bin/kcc/Makefile.depend @@ -26,7 +26,7 @@ DIRDEPS = \ lib/libcrypt \ lib/libedit \ lib/libthr \ - lib/ncurses/ncurses \ + lib/ncurses/ncursesw \ secure/lib/libcrypto \ diff --git a/kerberos5/usr.bin/kdestroy/Makefile b/kerberos5/usr.bin/kdestroy/Makefile index b3946e42fd2..6ec3e9b294a 100644 --- a/kerberos5/usr.bin/kdestroy/Makefile +++ b/kerberos5/usr.bin/kdestroy/Makefile @@ -8,6 +8,8 @@ LDADD= -lkafs5 -lkrb5 -lheimntlm -lroken ${LIBVERS} \ -lasn1 -lcrypto -lcrypt MAN= kdestroy.1 +NO_PIE= yes + .include .PATH: ${KRB5DIR}/kuser diff --git a/kerberos5/usr.bin/kf/Makefile b/kerberos5/usr.bin/kf/Makefile index c9d3fceb14f..02447007219 100644 --- a/kerberos5/usr.bin/kf/Makefile +++ b/kerberos5/usr.bin/kf/Makefile @@ -9,6 +9,8 @@ DPADD= ${LIBKRB5} ${LIBROKEN} ${LIBASN1} ${LIBCRYPTO} \ LDADD= -lkrb5 -lroken -lasn1 -lcrypto -lcrypt \ ${LIBVERS} +NO_PIE= yes + .include .PATH: ${KRB5DIR}/appl/kf diff --git a/kerberos5/usr.bin/kgetcred/Makefile b/kerberos5/usr.bin/kgetcred/Makefile index dac38adcc18..d6ca2fc23ea 100644 --- a/kerberos5/usr.bin/kgetcred/Makefile +++ b/kerberos5/usr.bin/kgetcred/Makefile @@ -6,6 +6,8 @@ CFLAGS+= -I${KRB5DIR}/lib/asn1 \ DPADD= ${LIBKRB5} ${LIBROKEN} ${LIBASN1} ${LIBCRYPTO} ${LIBCRYPT} ${LIBVERS} LDADD= -lkrb5 -lroken -lasn1 -lcrypto -lcrypt ${LIBVERS} +NO_PIE= yes + .include .PATH: ${KRB5DIR}/kuser diff --git a/kerberos5/usr.bin/kinit/Makefile b/kerberos5/usr.bin/kinit/Makefile index e0229f98079..cefadf31f4c 100644 --- a/kerberos5/usr.bin/kinit/Makefile +++ b/kerberos5/usr.bin/kinit/Makefile @@ -7,6 +7,8 @@ DPADD= ${LIBKAFS5} ${LIBKRB5} ${LIBHEIMNTLM} ${LIBROKEN} ${LIBVERS} \ LDADD= -lkafs5 -lkrb5 -lheimntlm -lroken ${LIBVERS} \ -lasn1 -lcrypto -lcrypt -lcom_err +NO_PIE= yes + .include .PATH: ${KRB5DIR}/kuser diff --git a/kerberos5/usr.bin/kpasswd/Makefile b/kerberos5/usr.bin/kpasswd/Makefile index a9ab1c99ec8..2663892db08 100644 --- a/kerberos5/usr.bin/kpasswd/Makefile +++ b/kerberos5/usr.bin/kpasswd/Makefile @@ -7,6 +7,8 @@ DPADD= ${LIBKRB5} ${LIBHX509} ${LIBROKEN} ${LIBVERS} \ LDADD= -lkrb5 -lhx509 -lroken ${LIBVERS} \ -lasn1 -lcrypto -lcrypt -lcom_err +NO_PIE= yes + .include .PATH: ${KRB5DIR}/kpasswd diff --git a/kerberos5/usr.bin/ksu/Makefile b/kerberos5/usr.bin/ksu/Makefile index 9e2786577ff..3f4ba31f6cd 100644 --- a/kerberos5/usr.bin/ksu/Makefile +++ b/kerberos5/usr.bin/ksu/Makefile @@ -13,6 +13,8 @@ DPADD= ${LIBKAFS5} ${LIBKRB5} ${LIBHX509} ${LIBROKEN} ${LIBVERS} \ LDADD= -lkafs5 -lkrb5 -lhx509 -lroken ${LIBVERS} \ -lasn1 -lcrypto -lcrypt -lcom_err +NO_PIE= yes + .include .PATH: ${KRB5DIR}/appl/su diff --git a/kerberos5/usr.bin/string2key/Makefile b/kerberos5/usr.bin/string2key/Makefile index fc790e24dd8..32797f3212c 100644 --- a/kerberos5/usr.bin/string2key/Makefile +++ b/kerberos5/usr.bin/string2key/Makefile @@ -11,6 +11,8 @@ DPADD= ${LIBHDB} ${LIBKRB5} ${LIBROKEN} ${LIBASN1} ${LIBCRYPTO} \ ${LIBCRYPT} ${LIBVERS} LDADD= -lhdb -lkrb5 -lroken -lasn1 -lcrypto -lcrypt ${LIBVERS} +NO_PIE= yes + .include .PATH: ${KRB5DIR}/kdc diff --git a/kerberos5/usr.bin/verify_krb5_conf/Makefile b/kerberos5/usr.bin/verify_krb5_conf/Makefile index 830e66a2911..9968dd6018e 100644 --- a/kerberos5/usr.bin/verify_krb5_conf/Makefile +++ b/kerberos5/usr.bin/verify_krb5_conf/Makefile @@ -8,6 +8,8 @@ DPADD= ${LIBKAFS5} ${LIBKRB5} ${LIBHX509} ${LIBROKEN} ${LIBVERS} \ LDADD= -lkafs5 -lkrb5 -lhx509 -lroken ${LIBVERS} \ -lasn1 -lcrypto -lcrypt -lcom_err +NO_PIE= yes + .include .PATH: ${KRB5DIR}/lib/krb5 diff --git a/kerberos5/usr.sbin/iprop-log/Makefile b/kerberos5/usr.sbin/iprop-log/Makefile index 176012a9e7d..a5cb4f5e500 100644 --- a/kerberos5/usr.sbin/iprop-log/Makefile +++ b/kerberos5/usr.sbin/iprop-log/Makefile @@ -13,6 +13,8 @@ DPADD= ${LIBKADM5SRV} ${LIBHDB} ${LIBKRB5} ${LIBASN1} ${LIBCRYPTO} \ LDADD= -lkadm5srv -lhdb -lkrb5 -lasn1 -lcrypto -lcrypt ${LIBSL} -lroken \ ${LIBVERS} -ledit +NO_PIE= yes + iprop-commands.h: iprop-commands.in ${SLC} ${.ALLSRC:M*.in} diff --git a/kerberos5/usr.sbin/iprop-log/Makefile.depend b/kerberos5/usr.sbin/iprop-log/Makefile.depend index 5cbb43b7a40..6cd298d08a7 100644 --- a/kerberos5/usr.sbin/iprop-log/Makefile.depend +++ b/kerberos5/usr.sbin/iprop-log/Makefile.depend @@ -27,7 +27,7 @@ DIRDEPS = \ lib/libcrypt \ lib/libedit \ lib/libthr \ - lib/ncurses/ncurses \ + lib/ncurses/ncursesw \ secure/lib/libcrypto \ diff --git a/kerberos5/usr.sbin/kstash/Makefile b/kerberos5/usr.sbin/kstash/Makefile index 024e45dba91..9fc81017963 100644 --- a/kerberos5/usr.sbin/kstash/Makefile +++ b/kerberos5/usr.sbin/kstash/Makefile @@ -10,6 +10,8 @@ LDADD= -lhdb -lkrb5 -lroken ${LIBVERS} \ -lasn1 -lcrypto -lcrypt ${LDAPLDADD} LDFLAGS=${LDAPLDFLAGS} +NO_PIE= yes + .include .PATH: ${KRB5DIR}/kdc diff --git a/kerberos5/usr.sbin/ktutil/Makefile b/kerberos5/usr.sbin/ktutil/Makefile index f7d340f78e9..3445fc69562 100644 --- a/kerberos5/usr.sbin/ktutil/Makefile +++ b/kerberos5/usr.sbin/ktutil/Makefile @@ -22,6 +22,8 @@ DPADD= ${LIBKADM5CLNT} ${LIBKRB5} ${LIBSL} ${LIBROKEN} ${LIBVERS} \ LDADD= -lkadm5clnt -lkrb5 ${LIBSL} -lroken ${LIBVERS} \ -lasn1 -lcrypto -lcrypt -ledit +NO_PIE= yes + .include ktutil-commands.h: ${KRB5DIR}/admin/ktutil-commands.in diff --git a/kerberos5/usr.sbin/ktutil/Makefile.depend b/kerberos5/usr.sbin/ktutil/Makefile.depend index 7cee2f03d5c..bc401252657 100644 --- a/kerberos5/usr.sbin/ktutil/Makefile.depend +++ b/kerberos5/usr.sbin/ktutil/Makefile.depend @@ -25,7 +25,7 @@ DIRDEPS = \ lib/libcrypt \ lib/libedit \ lib/libthr \ - lib/ncurses/ncurses \ + lib/ncurses/ncursesw \ secure/lib/libcrypto \ diff --git a/lib/Makefile b/lib/Makefile index de87cbaa856..05fab01e23f 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -3,83 +3,47 @@ .include -# To satisfy shared library or ELF linkage when only the libraries being -# built are visible: -# -# csu must be built before all shared libaries for ELF. -# libc must be built before all other shared libraries. -# libbsm must be built before libauditd. -# libcom_err must be built before libpam. -# libcrypt must be built before libpam. -# libkvm must be built before libdevstat. -# libldns must be built before libunbound. -# msun must be built before libg++ and libstdc++. -# libmd must be built before libatm, libopie, libradius, and libtacplus. -# ncurses must be built before libdialog, libedit and libreadline. -# libnetgraph must be built before libbsnmp/modules/snmp_netgraph. -# libopie must be built before libpam. -# libradius must be built before libpam. -# librpcsvc must be built before libpam. -# libsbuf must be built before libcam. -# libtacplus must be built before libpam. -# libutil must be built before libpam. -# libypclnt must be built before libpam. -# libgssapi must be built before librpcsec_gss -# -# Otherwise, the SUBDIR list should be in alphabetical order. -# -# Except it appears bind needs to be compiled last +# 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 \ - libbsm \ - libauditd \ - libutil \ - libpjdlog \ - libnv \ - ${_libcapsicum} \ libcompiler_rt \ - libcrypt \ - libelf \ - ${_libiconv_modules} \ - libkvm \ - ${_libldns} \ - msun \ - libmd \ - ncurses \ - ${_libnetgraph} \ - libradius \ - librpcsvc \ - libsbuf \ - libtacplus \ - ${_libypclnt} \ + ${_libcplusplus} \ ${_libcxxrt} \ - ${_libcplusplus} + libelf \ + msun -.if ${MK_KERBEROS_SUPPORT} != "no" -SUBDIR_ORDERED+= libcom_err -.endif +# 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 \ libdwarf \ libedit \ - ${_libefi} \ libexecinfo \ libexpat \ libfetch \ @@ -87,26 +51,36 @@ SUBDIR= ${SUBDIR_ORDERED} \ ${_libgpib} \ ${_libgssapi} \ ${_librpcsec_gss} \ + ${_libiconv_modules} \ libipsec \ libjail \ libkiconv \ + libkvm \ + ${_libldns} \ liblzma \ libmagic \ libmandoc \ libmemstat \ + libmd \ ${_libmilter} \ ${_libmp} \ ${_libnandfs} \ libnetbsd \ + ${_libnetgraph} \ ${_libngatm} \ + libnv \ libopie \ libpam \ libpcap \ + libpjdlog \ ${_libpmc} \ ${_libproc} \ libprocstat \ + libradius \ + librpcsvc \ librt \ ${_librtld_db} \ + libsbuf \ ${_libsdp} \ ${_libsm} \ ${_libsmb} \ @@ -115,6 +89,7 @@ SUBDIR= ${SUBDIR_ORDERED} \ libstand \ libstdbuf \ libstdthreads \ + libtacplus \ ${_libtelnet} \ ${_libthr} \ libthread_db \ @@ -125,15 +100,51 @@ SUBDIR= ${SUBDIR_ORDERED} \ ${_libunbound} \ ${_libusbhid} \ ${_libusb} \ + libutil \ ${_libvgl} \ ${_libvmmapi} \ libwrap \ 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_libdiaglog= ncurses +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}) @@ -168,6 +179,10 @@ _libcasper= libcasper _clang= clang .endif +.if ${MK_CUSE} != "no" +_cuse= libcuse +.endif + .if ${MK_GPIB} != "no" _libgpib= libgpib .endif @@ -181,6 +196,10 @@ _librpcsec_gss= librpcsec_gss _libiconv_modules= libiconv_modules .endif +.if ${MK_KERBEROS_SUPPORT} != "no" +_libcom_err= libcom_err +.endif + .if ${MK_LDNS} != "no" _libldns= libldns .endif @@ -217,11 +236,6 @@ _librtld_db= librtld_db _libvmmapi= libvmmapi .endif -.if ${MACHINE_CPUARCH} == "ia64" -_libefi= libefi -_libsmb= libsmb -.endif - .if ${MACHINE_CPUARCH} == "mips" _libproc= libproc _librtld_db= librtld_db diff --git a/lib/atf/libatf-c++/Makefile b/lib/atf/libatf-c++/Makefile index 84477f79927..163f7fbf363 100644 --- a/lib/atf/libatf-c++/Makefile +++ b/lib/atf/libatf-c++/Makefile @@ -29,7 +29,8 @@ .include LIB= atf-c++ -SHLIB_MAJOR= 2 +PRIVATELIB= true +SHLIB_MAJOR= 1 # libatf-c++ depends on the C version of the ATF library to build. DPADD= ${LIBATFC} @@ -73,20 +74,6 @@ INCSDIR_atf-c++.hpp= ${INCLUDEDIR} MAN= atf-c++-api.3 -all: atf-c++.pc -atf-c++.pc: atf-c++.pc.in atf-version - sed -e 's,__CXX__,${CXX},g' \ - -e 's,__INCLUDEDIR__,${INCLUDEDIR},g' \ - -e 's,__LIBDIR__,${LIBDIR},g' \ - -e "s,__ATF_VERSION__,$$(cat atf-version),g" \ - <${ATF}/atf-c++/atf-c++.pc.in >atf-c++.pc - -beforeinstall: - ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ - atf-c++.pc ${DESTDIR}${LIBDATADIR}/pkgconfig - ${INSTALL} -C -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE} \ - ${ATF}/atf-c++/atf-c++.m4 ${DESTDIR}${SHAREDIR}/aclocal - .if ${MK_TESTS} != "no" SUBDIR= tests .endif diff --git a/lib/atf/libatf-c++/tests/Makefile b/lib/atf/libatf-c++/tests/Makefile index c5a1d2495b6..56355f29522 100644 --- a/lib/atf/libatf-c++/tests/Makefile +++ b/lib/atf/libatf-c++/tests/Makefile @@ -26,6 +26,4 @@ ATF_TESTS_CXX+= ${_T} SRCS.${_T}= ${_T}.cpp test_helpers.cpp .endfor -ATF_TESTS_SH= pkg_config_test - .include diff --git a/lib/atf/libatf-c/Makefile b/lib/atf/libatf-c/Makefile index 5c607f7b42d..4920eb5c78c 100644 --- a/lib/atf/libatf-c/Makefile +++ b/lib/atf/libatf-c/Makefile @@ -29,7 +29,8 @@ .include LIB= atf-c -SHLIB_MAJOR= 1 +PRIVATELIB= true +SHLIB_MAJOR= 0 ATF= ${.CURDIR:H:H:H}/contrib/atf .PATH: ${ATF} @@ -75,22 +76,6 @@ INCSDIR_atf-c.h= ${INCLUDEDIR} MAN= atf-c-api.3 -all: atf-c.pc -atf-c.pc: atf-c.pc.in atf-version - sed -e 's,__CC__,${CC},g' \ - -e 's,__INCLUDEDIR__,${INCLUDEDIR},g' \ - -e 's,__LIBDIR__,${LIBDIR},g' \ - -e "s,__ATF_VERSION__,$$(cat atf-version),g" \ - <${ATF}/atf-c/atf-c.pc.in >atf-c.pc - -beforeinstall: - ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ - atf-c.pc ${DESTDIR}${LIBDATADIR}/pkgconfig - ${INSTALL} -C -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE} \ - ${ATF}/atf-c/atf-common.m4 ${DESTDIR}${SHAREDIR}/aclocal - ${INSTALL} -C -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE} \ - ${ATF}/atf-c/atf-c.m4 ${DESTDIR}${SHAREDIR}/aclocal - .if ${MK_TESTS} != "no" SUBDIR= tests .endif diff --git a/lib/atf/libatf-c/tests/Makefile b/lib/atf/libatf-c/tests/Makefile index 1a091d3172f..70ba1a5ca2c 100644 --- a/lib/atf/libatf-c/tests/Makefile +++ b/lib/atf/libatf-c/tests/Makefile @@ -33,6 +33,4 @@ ATF_TESTS_C+= ${_T} SRCS.${_T}= ${_T}.c test_helpers.c .endfor -ATF_TESTS_SH= pkg_config_test - .include diff --git a/lib/clang/Makefile b/lib/clang/Makefile index ae7ae4a0a44..328aa7871a9 100644 --- a/lib/clang/Makefile +++ b/lib/clang/Makefile @@ -3,8 +3,7 @@ .include .if !make(install) -.if !defined(EARLY_BUILD) -.if defined(MK_CLANG_FULL) && ${MK_CLANG_FULL} != "no" +.if ${MK_CLANG_FULL} != "no" _libclangstaticanalyzer= \ libclangstaticanalyzercheckers \ libclangstaticanalyzercore \ @@ -12,13 +11,11 @@ _libclangstaticanalyzer= \ _libclangarcmigrate= \ libclangarcmigrate .endif # MK_CLANG_FULL -.if (defined(MK_CLANG_FULL) && ${MK_CLANG_FULL} != "no") || \ - (defined(MK_LLDB) && ${MK_LLDB} != "no") +.if ${MK_CLANG_FULL} != "no" || ${MK_LLDB} != "no" _libclangrewriter= \ libclangrewritecore \ libclangrewritefrontend .endif # (MK_CLANG_FULL || MK_LLDB) -.endif # !EARLY_BUILD SUBDIR= libclanganalysis \ ${_libclangarcmigrate} \ @@ -105,7 +102,7 @@ SUBDIR+=libllvmexecutionengine \ libllvmruntimedyld .endif # MK_CLANG_EXTRAS | LLDB -.if !defined(EARLY_BUILD) && ${MK_LLDB} != "no" +.if ${MK_LLDB} != "no" SUBDIR+=liblldb \ \ liblldbAPI \ @@ -141,7 +138,7 @@ SUBDIR+=liblldb \ liblldbPluginSymbolVendorELF \ liblldbPluginUnwindAssemblyInstEmulation \ liblldbPluginUnwindAssemblyX86 -.endif # !EARLY_BUILD && MK_LLDB +.endif # MK_LLDB .endif # !make(install) diff --git a/lib/clang/clang.build.mk b/lib/clang/clang.build.mk index c9d17982f69..ec8f4514ffc 100644 --- a/lib/clang/clang.build.mk +++ b/lib/clang/clang.build.mk @@ -10,11 +10,11 @@ CFLAGS+= -I${LLVM_SRCS}/include -I${CLANG_SRCS}/include \ -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD \ -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS #-DNDEBUG -.if !defined(EARLY_BUILD) && defined(MK_CLANG_FULL) && ${MK_CLANG_FULL} != "no" +.if ${MK_CLANG_FULL} != "no" CFLAGS+= -DCLANG_ENABLE_ARCMT \ -DCLANG_ENABLE_REWRITER \ -DCLANG_ENABLE_STATIC_ANALYZER -.endif # !EARLY_BUILD && MK_CLANG_FULL +.endif # MK_CLANG_FULL # LLVM is not strict aliasing safe as of 12/31/2011 CFLAGS+= -fno-strict-aliasing @@ -56,17 +56,9 @@ CLANG_TBLGEN= ${TOOLSDIR}/usr/bin/clang-tblgen TBLGEN?= tblgen CLANG_TBLGEN?= clang-tblgen -Intrinsics.inc.h: ${LLVM_SRCS}/include/llvm/IR/Intrinsics.td \ - ${LLVM_SRCS}/include/llvm/IR/IntrinsicsARM.td \ - ${LLVM_SRCS}/include/llvm/IR/IntrinsicsHexagon.td \ - ${LLVM_SRCS}/include/llvm/IR/IntrinsicsMips.td \ - ${LLVM_SRCS}/include/llvm/IR/IntrinsicsNVVM.td \ - ${LLVM_SRCS}/include/llvm/IR/IntrinsicsPowerPC.td \ - ${LLVM_SRCS}/include/llvm/IR/IntrinsicsR600.td \ - ${LLVM_SRCS}/include/llvm/IR/IntrinsicsX86.td \ - ${LLVM_SRCS}/include/llvm/IR/IntrinsicsXCore.td - ${TBLGEN} -I ${LLVM_SRCS}/include \ - -gen-intrinsic -o ${.TARGET} \ +Intrinsics.inc.h: ${LLVM_SRCS}/include/llvm/IR/Intrinsics.td + ${TBLGEN} -gen-intrinsic \ + -I ${LLVM_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ ${LLVM_SRCS}/include/llvm/IR/Intrinsics.td .for arch in \ ARM/ARM Mips/Mips PowerPC/PPC Sparc/Sparc X86/X86 @@ -85,147 +77,181 @@ Intrinsics.inc.h: ${LLVM_SRCS}/include/llvm/IR/Intrinsics.td \ RegisterInfo/-gen-register-info \ SubtargetInfo/-gen-subtarget ${arch:T}Gen${hdr:H:C/$/.inc.h/}: ${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}.td - ${TBLGEN} -I ${LLVM_SRCS}/include -I ${LLVM_SRCS}/lib/Target/${arch:H} \ - ${hdr:T:C/,/ /g} -o ${.TARGET} \ + ${TBLGEN} ${hdr:T:C/,/ /g} \ + -I ${LLVM_SRCS}/include -I ${LLVM_SRCS}/lib/Target/${arch:H} \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ ${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}.td . endfor .endfor Attrs.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-classes -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-classes \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrDump.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-dump -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-dump \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrIdentifierArg.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-identifier-arg-list -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-identifier-arg-list \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrImpl.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-impl -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-impl \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrLateParsed.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-late-parsed-list -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-late-parsed-list \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrList.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-list -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-list \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrParsedAttrImpl.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-parsed-attr-impl -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-parsed-attr-impl \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrParsedAttrKinds.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-parsed-attr-kinds -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-parsed-attr-kinds \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrParsedAttrList.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-parsed-attr-list -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-parsed-attr-list \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrPCHRead.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-pch-read -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-pch-read \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrPCHWrite.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-pch-write -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-pch-write \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrSpellings.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-spelling-list -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-spelling-list \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrSpellingListIndex.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-spelling-index -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-spelling-index \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrTemplateInstantiate.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-template-instantiate -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-template-instantiate \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrTypeArg.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-type-arg-list -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-type-arg-list \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td CommentCommandInfo.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentCommands.td - ${CLANG_TBLGEN} \ - -gen-clang-comment-command-info -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-comment-command-info \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/AST/CommentCommands.td CommentCommandList.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentCommands.td - ${CLANG_TBLGEN} \ - -gen-clang-comment-command-list -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-comment-command-list \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/AST/CommentCommands.td CommentHTMLNamedCharacterReferences.inc.h: \ ${CLANG_SRCS}/include/clang/AST/CommentHTMLNamedCharacterReferences.td - ${CLANG_TBLGEN} \ - -gen-clang-comment-html-named-character-references -o ${.TARGET} \ - ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-comment-html-named-character-references \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/AST/CommentHTMLNamedCharacterReferences.td CommentHTMLTags.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentHTMLTags.td - ${CLANG_TBLGEN} \ - -gen-clang-comment-html-tags -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-comment-html-tags \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/AST/CommentHTMLTags.td CommentHTMLTagsProperties.inc.h: \ ${CLANG_SRCS}/include/clang/AST/CommentHTMLTags.td - ${CLANG_TBLGEN} \ - -gen-clang-comment-html-tags-properties -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-comment-html-tags-properties \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/AST/CommentHTMLTags.td CommentNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/CommentNodes.td - ${CLANG_TBLGEN} \ - -gen-clang-comment-nodes -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-comment-nodes \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/CommentNodes.td DeclNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/DeclNodes.td - ${CLANG_TBLGEN} \ - -gen-clang-decl-nodes -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-decl-nodes \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/DeclNodes.td StmtNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/StmtNodes.td - ${CLANG_TBLGEN} \ - -gen-clang-stmt-nodes -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-stmt-nodes \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/StmtNodes.td arm_neon.h: ${CLANG_SRCS}/include/clang/Basic/arm_neon.td - ${CLANG_TBLGEN} \ - -gen-arm-neon -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-arm-neon \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/arm_neon.td arm_neon.inc.h: ${CLANG_SRCS}/include/clang/Basic/arm_neon.td - ${CLANG_TBLGEN} \ - -gen-arm-neon-sema -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-arm-neon-sema \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/arm_neon.td DiagnosticGroups.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic \ - -gen-clang-diag-groups -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-diag-groups \ + -I ${CLANG_SRCS}/include/clang/Basic -d ${.TARGET:C/\.h$/.d/} \ + -o ${.TARGET} ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td DiagnosticIndexName.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic \ - -gen-clang-diags-index-name -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-diags-index-name \ + -I ${CLANG_SRCS}/include/clang/Basic -d ${.TARGET:C/\.h$/.d/} \ + -o ${.TARGET} ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td .for hdr in AST Analysis Comment Common Driver Frontend Lex Parse Sema Serialization Diagnostic${hdr}Kinds.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic \ - -gen-clang-diags-defs -clang-component=${hdr} -o ${.TARGET} \ - ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-diags-defs -clang-component=${hdr} \ + -I ${CLANG_SRCS}/include/clang/Basic -d ${.TARGET:C/\.h$/.d/} \ + -o ${.TARGET} ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td .endfor Options.inc.h: ${CLANG_SRCS}/include/clang/Driver/Options.td - ${TBLGEN} -I ${LLVM_SRCS}/include -I ${CLANG_SRCS}/include/clang/Driver \ - -gen-opt-parser-defs -o ${.TARGET} ${.ALLSRC} + ${TBLGEN} -gen-opt-parser-defs \ + -I ${LLVM_SRCS}/include -I ${CLANG_SRCS}/include/clang/Driver \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Driver/Options.td CC1AsOptions.inc.h: ${CLANG_SRCS}/include/clang/Driver/CC1AsOptions.td - ${TBLGEN} -I ${LLVM_SRCS}/include -I ${CLANG_SRCS}/include/clang/Driver \ - -gen-opt-parser-defs -o ${.TARGET} ${.ALLSRC} + ${TBLGEN} -gen-opt-parser-defs \ + -I ${LLVM_SRCS}/include -I ${CLANG_SRCS}/include/clang/Driver \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Driver/CC1AsOptions.td -Checkers.inc.h: ${CLANG_SRCS}/lib/StaticAnalyzer/Checkers/Checkers.td \ - ${CLANG_SRCS}/include/clang/StaticAnalyzer/Checkers/CheckerBase.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-sa-checkers -o ${.TARGET} \ +Checkers.inc.h: ${CLANG_SRCS}/lib/StaticAnalyzer/Checkers/Checkers.td + ${CLANG_TBLGEN} -gen-clang-sa-checkers \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ ${CLANG_SRCS}/lib/StaticAnalyzer/Checkers/Checkers.td +.for dep in ${TGHDRS:C/$/.inc.d/} +. sinclude "${dep}" +.endfor + SRCS+= ${TGHDRS:C/$/.inc.h/} DPADD+= ${TGHDRS:C/$/.inc.h/} -CLEANFILES+= ${TGHDRS:C/$/.inc.h/} +CLEANFILES+= ${TGHDRS:C/$/.inc.h/} ${TGHDRS:C/$/.inc.d/} # if we are not doing explicit 'make depend', there is # nothing to cause these to be generated. diff --git a/lib/clang/include/IA64GenAsmWriter.inc b/lib/clang/include/IA64GenAsmWriter.inc deleted file mode 100644 index dddc7938ed2..00000000000 --- a/lib/clang/include/IA64GenAsmWriter.inc +++ /dev/null @@ -1,2 +0,0 @@ -/* $FreeBSD$ */ -#include "IA64GenAsmWriter.inc.h" diff --git a/lib/clang/include/IA64GenDAGISel.inc b/lib/clang/include/IA64GenDAGISel.inc deleted file mode 100644 index c6ae3dc2af0..00000000000 --- a/lib/clang/include/IA64GenDAGISel.inc +++ /dev/null @@ -1,2 +0,0 @@ -/* $FreeBSD$ */ -#include "IA64GenDAGISel.inc.h" diff --git a/lib/clang/include/IA64GenInstrInfo.inc b/lib/clang/include/IA64GenInstrInfo.inc deleted file mode 100644 index 7fe83f68e8c..00000000000 --- a/lib/clang/include/IA64GenInstrInfo.inc +++ /dev/null @@ -1,2 +0,0 @@ -/* $FreeBSD$ */ -#include "IA64GenInstrInfo.inc.h" diff --git a/lib/clang/include/IA64GenRegisterInfo.inc b/lib/clang/include/IA64GenRegisterInfo.inc deleted file mode 100644 index 89405ed9e6f..00000000000 --- a/lib/clang/include/IA64GenRegisterInfo.inc +++ /dev/null @@ -1,2 +0,0 @@ -/* $FreeBSD$ */ -#include "IA64GenRegisterInfo.inc.h" diff --git a/lib/clang/include/Makefile b/lib/clang/include/Makefile index da39f1ccbce..1ffd3e1595a 100644 --- a/lib/clang/include/Makefile +++ b/lib/clang/include/Makefile @@ -8,7 +8,7 @@ LLVM_SRCS= ${.CURDIR}/../../../contrib/llvm .PATH: ${LLVM_SRCS}/tools/clang/lib/Headers -INCSDIR=${INCLUDEDIR}/clang/3.4 +INCSDIR=${INCLUDEDIR}/clang/3.4.1 INCS= __wmmintrin_aes.h \ __wmmintrin_pclmul.h \ diff --git a/lib/clang/include/clang/Basic/Version.inc b/lib/clang/include/clang/Basic/Version.inc index d63713e823f..d2fcc046705 100644 --- a/lib/clang/include/clang/Basic/Version.inc +++ b/lib/clang/include/clang/Basic/Version.inc @@ -1,10 +1,11 @@ /* $FreeBSD$ */ -#define CLANG_VERSION 3.4 -#define CLANG_VERSION_MAJOR 3 -#define CLANG_VERSION_MINOR 4 +#define CLANG_VERSION 3.4.1 +#define CLANG_VERSION_MAJOR 3 +#define CLANG_VERSION_MINOR 4 +#define CLANG_VERSION_PATCHLEVEL 1 -#define CLANG_VENDOR "FreeBSD " -#define CLANG_VENDOR_SUFFIX " 20140216" +#define CLANG_VENDOR "FreeBSD " +#define CLANG_VENDOR_SUFFIX " 20140512" -#define SVN_REVISION "197956" +#define SVN_REVISION "208032" diff --git a/lib/clang/include/llvm/Config/config.h b/lib/clang/include/llvm/Config/config.h index 985d259dfbb..cbbb4fb7dbf 100644 --- a/lib/clang/include/llvm/Config/config.h +++ b/lib/clang/include/llvm/Config/config.h @@ -8,9 +8,6 @@ /* Get __FreeBSD_version. */ #include -/* Define if building universal (internal helper macro) */ -/* #undef AC_APPLE_UNIVERSAL_BUILD */ - /* Bug report URL. */ #define BUG_REPORT_URL "http://llvm.org/bugs/" @@ -634,7 +631,7 @@ /* #undef LLVM_PATH_XDOT */ /* Installation prefix directory */ -#define LLVM_PREFIX "" +#define LLVM_PREFIX "/usr" /* Define if we have the Intel JIT API runtime support library */ #define LLVM_USE_INTEL_JITEVENTS 0 @@ -648,6 +645,9 @@ /* Minor version of the LLVM API */ #define LLVM_VERSION_MINOR 4 +/* Patch version of the LLVM API */ +#define LLVM_VERSION_PATCH 1 + /* Define if the OS needs help to load dependent libraries for dlopen(). */ #define LTDL_DLOPEN_DEPLIBS 1 @@ -675,16 +675,13 @@ #define PACKAGE_NAME "LLVM" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "LLVM 3.4" +#define PACKAGE_STRING "LLVM 3.4.1" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "llvm" -/* Define to the home page for this package. */ -/* #undef PACKAGE_URL */ - /* Define to the version of this package. */ -#define PACKAGE_VERSION "3.4" +#define PACKAGE_VERSION "3.4.1" /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void @@ -707,18 +704,6 @@ /* Type of 1st arg on ELM Callback */ /* #undef WIN32_ELMCB_PCSTR */ -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -/* # undef WORDS_BIGENDIAN */ -# endif -#endif - /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ diff --git a/lib/clang/include/llvm/Config/llvm-config.h b/lib/clang/include/llvm/Config/llvm-config.h index c7466874ff1..1717863779a 100644 --- a/lib/clang/include/llvm/Config/llvm-config.h +++ b/lib/clang/include/llvm/Config/llvm-config.h @@ -109,7 +109,7 @@ /* #undef LLVM_PATH_XDOT_PY */ /* Installation prefix directory */ -#define LLVM_PREFIX "" +#define LLVM_PREFIX "/usr" /* Define if we have the Intel JIT API runtime support library */ #define LLVM_USE_INTEL_JITEVENTS 0 diff --git a/lib/clang/libllvmasmparser/Makefile.depend b/lib/clang/libllvmasmparser/Makefile.depend index d4069a67584..4d8f064b840 100644 --- a/lib/clang/libllvmasmparser/Makefile.depend +++ b/lib/clang/libllvmasmparser/Makefile.depend @@ -5,7 +5,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libc++ \ lib/msun \ diff --git a/lib/clang/libllvmbitwriter/Makefile.depend b/lib/clang/libllvmbitwriter/Makefile.depend index d4069a67584..4d8f064b840 100644 --- a/lib/clang/libllvmbitwriter/Makefile.depend +++ b/lib/clang/libllvmbitwriter/Makefile.depend @@ -5,7 +5,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libc++ \ lib/msun \ diff --git a/lib/clang/libllvmdebuginfo/Makefile.depend b/lib/clang/libllvmdebuginfo/Makefile.depend index d4069a67584..4d8f064b840 100644 --- a/lib/clang/libllvmdebuginfo/Makefile.depend +++ b/lib/clang/libllvmdebuginfo/Makefile.depend @@ -5,7 +5,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libc++ \ lib/msun \ diff --git a/lib/clang/libllvmirreader/Makefile.depend b/lib/clang/libllvmirreader/Makefile.depend index d4069a67584..4d8f064b840 100644 --- a/lib/clang/libllvmirreader/Makefile.depend +++ b/lib/clang/libllvmirreader/Makefile.depend @@ -5,7 +5,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libc++ \ lib/msun \ diff --git a/lib/clang/libllvmlinker/Makefile.depend b/lib/clang/libllvmlinker/Makefile.depend index d4069a67584..4d8f064b840 100644 --- a/lib/clang/libllvmlinker/Makefile.depend +++ b/lib/clang/libllvmlinker/Makefile.depend @@ -5,7 +5,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libc++ \ lib/msun \ diff --git a/lib/clang/libllvmmcdisassembler/Makefile.depend b/lib/clang/libllvmmcdisassembler/Makefile.depend index d4069a67584..4d8f064b840 100644 --- a/lib/clang/libllvmmcdisassembler/Makefile.depend +++ b/lib/clang/libllvmmcdisassembler/Makefile.depend @@ -5,7 +5,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libc++ \ lib/msun \ diff --git a/lib/clang/libllvmmcparser/Makefile.depend b/lib/clang/libllvmmcparser/Makefile.depend index d4069a67584..4d8f064b840 100644 --- a/lib/clang/libllvmmcparser/Makefile.depend +++ b/lib/clang/libllvmmcparser/Makefile.depend @@ -5,7 +5,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libc++ \ lib/msun \ diff --git a/lib/clang/libllvmobject/Makefile.depend b/lib/clang/libllvmobject/Makefile.depend index d4069a67584..4d8f064b840 100644 --- a/lib/clang/libllvmobject/Makefile.depend +++ b/lib/clang/libllvmobject/Makefile.depend @@ -5,7 +5,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libc++ \ lib/msun \ diff --git a/lib/clang/libllvmoption/Makefile.depend b/lib/clang/libllvmoption/Makefile.depend index ff10d3df73a..4d8f064b840 100644 --- a/lib/clang/libllvmoption/Makefile.depend +++ b/lib/clang/libllvmoption/Makefile.depend @@ -5,10 +5,8 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libc++ \ lib/msun \ - tools/usr/bin.host \ .include diff --git a/lib/clang/libllvmruntimedyld/Makefile.depend b/lib/clang/libllvmruntimedyld/Makefile.depend index d4069a67584..4d8f064b840 100644 --- a/lib/clang/libllvmruntimedyld/Makefile.depend +++ b/lib/clang/libllvmruntimedyld/Makefile.depend @@ -5,7 +5,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libc++ \ lib/msun \ diff --git a/lib/clang/libllvmsparccodegen/Makefile.depend b/lib/clang/libllvmsparccodegen/Makefile.depend index ce49f971ecc..19188f94875 100644 --- a/lib/clang/libllvmsparccodegen/Makefile.depend +++ b/lib/clang/libllvmsparccodegen/Makefile.depend @@ -7,7 +7,6 @@ DIRDEPS = \ include/xlocale \ lib/libc++ \ lib/msun \ - tools/usr/bin.host \ usr.bin/clang/tblgen.host \ diff --git a/lib/clang/libllvmsparcdesc/Makefile.depend b/lib/clang/libllvmsparcdesc/Makefile.depend index 940c6310de9..c7de05425c1 100644 --- a/lib/clang/libllvmsparcdesc/Makefile.depend +++ b/lib/clang/libllvmsparcdesc/Makefile.depend @@ -7,7 +7,6 @@ DIRDEPS = \ include/xlocale \ lib/libc++ \ lib/msun \ - tools/usr/bin.host \ usr.bin/clang/tblgen.host \ diff --git a/lib/clang/libllvmtarget/Makefile.depend b/lib/clang/libllvmtarget/Makefile.depend index d4069a67584..4d8f064b840 100644 --- a/lib/clang/libllvmtarget/Makefile.depend +++ b/lib/clang/libllvmtarget/Makefile.depend @@ -5,7 +5,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libc++ \ lib/msun \ diff --git a/lib/clang/libllvmx86utils/Makefile.depend b/lib/clang/libllvmx86utils/Makefile.depend index d4069a67584..4d8f064b840 100644 --- a/lib/clang/libllvmx86utils/Makefile.depend +++ b/lib/clang/libllvmx86utils/Makefile.depend @@ -5,7 +5,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libc++ \ lib/msun \ diff --git a/lib/csu/amd64/Makefile b/lib/csu/amd64/Makefile index 5ddbab661f4..7b888fad52d 100644 --- a/lib/csu/amd64/Makefile +++ b/lib/csu/amd64/Makefile @@ -14,6 +14,7 @@ FILESOWN= ${LIBOWN} FILESGRP= ${LIBGRP} FILESMODE= ${LIBMODE} FILESDIR= ${LIBDIR} +NO_PIE= yes all: ${OBJS} diff --git a/lib/csu/i386-elf/Makefile b/lib/csu/i386-elf/Makefile index 52e1955c109..8a685dcf9a0 100644 --- a/lib/csu/i386-elf/Makefile +++ b/lib/csu/i386-elf/Makefile @@ -13,6 +13,8 @@ CFLAGS+= -I${.CURDIR}/../common \ CLEANFILES= ${FILES} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o CLEANFILES+= crt1_c.s gcrt1_c.s Scrt1_c.s +NO_PIE= yes + # See the comment in lib/csu/common/crtbrand.c for the reason crt1_c.c is not # directly compiled to .o files. @@ -24,7 +26,7 @@ gcrt1_c.o: gcrt1_c.s ${CC} ${ACFLAGS} -c -o ${.TARGET} gcrt1_c.s gcrt1.o: gcrt1_c.o crt1_s.o - ${LD} ${LDFLAGS:N-[BL]/*} -o gcrt1.o -r crt1_s.o gcrt1_c.o + ${LD} ${_LDFLAGS} -o gcrt1.o -r crt1_s.o gcrt1_c.o crt1_c.s: crt1_c.c ${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1_c.c @@ -34,7 +36,7 @@ crt1_c.o: crt1_c.s ${CC} ${ACFLAGS} -c -o ${.TARGET} crt1_c.s crt1.o: crt1_c.o crt1_s.o - ${LD} ${LDFLAGS:N-[BL]/*} -o crt1.o -r crt1_s.o crt1_c.o + ${LD} ${_LDFLAGS} -o crt1.o -r crt1_s.o crt1_c.o objcopy --localize-symbol _start1 crt1.o Scrt1_c.s: crt1_c.c @@ -45,7 +47,7 @@ Scrt1_c.o: Scrt1_c.s ${CC} ${ACFLAGS} -c -o ${.TARGET} Scrt1_c.s Scrt1.o: Scrt1_c.o crt1_s.o - ${LD} ${LDFLAGS:N-[BL]/*} -o Scrt1.o -r crt1_s.o Scrt1_c.o + ${LD} ${_LDFLAGS} -o Scrt1.o -r crt1_s.o Scrt1_c.o objcopy --localize-symbol _start1 Scrt1.o .include diff --git a/lib/csu/ia64/Makefile b/lib/csu/ia64/Makefile deleted file mode 100644 index b12e88822d1..00000000000 --- a/lib/csu/ia64/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# $FreeBSD$ - -.PATH: ${.CURDIR}/../common - -SRCS= crti.S crtn.S -OBJS= ${SRCS:N*.h:R:S/$/.o/g} -OBJS+= crt1.o gcrt1.o Scrt1.o - -all: ${OBJS} - -CLEANFILES= ${OBJS} -CLEANFILES+= crt1_.o gcrt1_.o Scrt1_.o -CLEANFILES+= crtbrand.o gcrtbrand.o Scrtbrand.o -CLEANFILES+= crtbrand.s gcrtbrand.s Scrtbrand.s - -crt1_.o: crt1.S - ${CC} ${CFLAGS} -c -o ${.TARGET} ${.ALLSRC} - -# See the comment in lib/csu/common/crtbrand.c for the reason crtbrand.c is not -# directly compiled to .o files. - -crtbrand.s: crtbrand.c - ${CC} ${CFLAGS} -S -o ${.TARGET} ${.ALLSRC} - sed -i "" -e '/\.note\.ABI-tag/s/progbits/note/' ${.TARGET} - -crtbrand.o: crtbrand.s - ${CC} ${ACFLAGS} -c -o ${.TARGET} crtbrand.s - -crt1.o: crt1_.o crtbrand.o - ${LD} ${LDFLAGS} -r -o ${.TARGET} crt1_.o crtbrand.o - -gcrt1_.o: crt1.S - ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.ALLSRC} - -gcrtbrand.s: crtbrand.c - ${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.ALLSRC} - sed -i "" -e '/\.note\.ABI-tag/s/progbits/note/' ${.TARGET} - -gcrtbrand.o: gcrtbrand.s - ${CC} ${ACFLAGS} -c -o ${.TARGET} gcrtbrand.s - -gcrt1.o: gcrt1_.o gcrtbrand.o - ${LD} ${LDFLAGS} -r -o ${.TARGET} ${.ALLSRC} - -Scrt1_.o: crt1.S - ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.ALLSRC} - -Scrtbrand.s: crtbrand.c - ${CC} ${CFLAGS} -fPIC -DPIC -S -o ${.TARGET} ${.ALLSRC} - sed -i "" -e '/\.note\.ABI-tag/s/progbits/note/' ${.TARGET} - -Scrtbrand.o: Scrtbrand.s - ${CC} ${ACFLAGS} -c -o ${.TARGET} Scrtbrand.s - -Scrt1.o: Scrt1_.o Scrtbrand.o - ${LD} ${LDFLAGS} -r -o ${.TARGET} ${.ALLSRC} - -realinstall: - ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ - ${OBJS} ${DESTDIR}${LIBDIR} - -.include diff --git a/lib/csu/ia64/crt1.S b/lib/csu/ia64/crt1.S deleted file mode 100644 index 6ff9cd9171a..00000000000 --- a/lib/csu/ia64/crt1.S +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (c) 2003 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$"); - - .text - -/* - * void _start(char **ap, struct ps_strings *, void (*cleanup)(void)); - */ -#define AP in0 -#define CLEANUP in2 - -#define GP loc0 -#define ARGC loc1 -#define ARGV loc2 -#define ENVP loc3 - - .global _start - .type _start, @function - .proc _start -_start: - .prologue - .save rp, r0 - .body -{ .mlx - alloc r14=ar.pfs,3,4,3,0 - movl r15=@gprel(1f) -} -1: -{ .mmi - ld4 ARGC=[AP] - adds ARGV=8,AP - mov r16=ip - ;; -} -{ .mmi - sub gp=r16,r15 - sub GP=r16,r15 - shladd r14=ARGC,3,AP - ;; -} -{ .mii - addl r15=@ltoff(environ),gp - cmp4.ge p6,p7=0,ARGC - adds ENVP=16,r14 - ;; -} -{ .mmi - ld8 r14=[r15] -(p7) ld8 r15=[ARGV] - addl r16=@gprel(__progname),gp - ;; -} -{ .mib - st8 [r14]=ENVP -(p7) cmp.eq p6,p0=0,r15 -(p6) br.dpnt .L1 - ;; -} - /* Normalize __progname. */ -{ .mmi - st8 [r16]=r15 - ld1 r14=[r15],1 - nop 0 - ;; -} -.L0: -{ .mib - cmp4.eq p7,p0=0,r14 - cmp4.eq p6,p0=0x2f,r14 -(p7) br.dptk .L1 - ;; -} -{ .mmb -(p6) st8 [r16]=r15 - ld1 r14=[r15],1 - br.dptk.many .L0 -} -.L1: -{ .mib - cmp.ne p7,p0=0,CLEANUP - mov out0=CLEANUP -(p7) br.call.sptk b0=atexit - ;; -} -{ .mfb - mov gp=GP - nop 0 - br.call.sptk b0=_init_tls -} -#ifdef GCRT -{ .mmi - mov gp=GP - ;; - addl r14=@ltoff(@fptr(_mcleanup)),gp - nop 0 - ;; -} -{ .mfb - ld8 out0=[r14] - nop 0 - br.call.sptk b0=atexit - ;; -} -#endif -{ .mmi - mov gp=GP - ;; - addl r14=@ltoff(@fptr(_fini)),gp - nop 0 - ;; -} -{ .mfb - ld8 out0=[r14] - nop 0 - br.call.sptk b0=atexit - ;; -} -#ifdef GCRT -{ .mmi - mov gp=GP - ;; - addl r14=@ltoff(eprol),gp - addl r15=@ltoff(etext),gp - ;; -} -{ .mmb - ld8 out0=[r14] - ld8 out1=[r15] - br.call.sptk b0=monstartup - ;; -} -#endif -{ .mfb - mov gp=GP - nop 0 - br.call.sptk b0=_init - ;; -} -{ .mmi - mov gp=GP - mov out0=ARGC - mov out1=ARGV -} -{ .mfb - mov out2=ENVP - nop 0 - br.call.sptk b0=main - ;; -} -{ .mib - mov gp=GP - mov out0=r8 - br.call.sptk b0=exit - ;; -} - .endp _start - -#ifdef GCRT -eprol: -#endif - - .rodata -.empty: stringz "" - - .sdata - .global __progname - .size __progname,8 - .type __progname,@object -__progname: data8 .empty - - .common environ,8,8 diff --git a/lib/libarchive/Makefile b/lib/libarchive/Makefile index bbe03a0bf12..14603299116 100644 --- a/lib/libarchive/Makefile +++ b/lib/libarchive/Makefile @@ -41,7 +41,7 @@ SHARED_CFLAGS+= -DHAVE_ICONV=1 -DHAVE_ICONV_H=1 -DICONV_CONST=const .endif .if ${MACHINE_ARCH:Marm*} != "" || ${MACHINE_ARCH:Mmips*} != "" || \ - ${MACHINE_ARCH:Msparc64*} != "" || ${MACHINE_ARCH:Mia64*} != "" + ${MACHINE_ARCH:Msparc64*} != "" NO_WCAST_ALIGN= yes .if ${MACHINE_ARCH:M*64*} == "" CFLAGS+= -DPPMD_32BIT diff --git a/lib/libarchive/config_freebsd.h b/lib/libarchive/config_freebsd.h index bcbad161446..0df3f917e92 100644 --- a/lib/libarchive/config_freebsd.h +++ b/lib/libarchive/config_freebsd.h @@ -228,15 +228,15 @@ /* FreeBSD defines for archive_hash.h */ #ifdef WITH_OPENSSL -#define ARCHIVE_HASH_MD5_OPENSSL 1 -#define ARCHIVE_HASH_RMD160_OPENSSL 1 -#define ARCHIVE_HASH_SHA1_OPENSSL -#define ARCHIVE_HASH_SHA256_OPENSSL 1 -#define ARCHIVE_HASH_SHA384_OPENSSL 1 -#define ARCHIVE_HASH_SHA512_OPENSSL 1 +#define ARCHIVE_CRYPTO_MD5_OPENSSL 1 +#define ARCHIVE_CRYPTO_RMD160_OPENSSL 1 +#define ARCHIVE_CRYPTO_SHA1_OPENSSL +#define ARCHIVE_CRYPTO_SHA256_OPENSSL 1 +#define ARCHIVE_CRYPTO_SHA384_OPENSSL 1 +#define ARCHIVE_CRYPTO_SHA512_OPENSSL 1 #else -#define ARCHIVE_HASH_MD5_LIBMD 1 -#define ARCHIVE_HASH_SHA1_LIBMD 1 -#define ARCHIVE_HASH_SHA256_LIBMD 1 -#define ARCHIVE_HASH_SHA512_LIBMD 1 +#define ARCHIVE_CRYPTO_MD5_LIBMD 1 +#define ARCHIVE_CRYPTO_SHA1_LIBMD 1 +#define ARCHIVE_CRYPTO_SHA256_LIBMD 1 +#define ARCHIVE_CRYPTO_SHA512_LIBMD 1 #endif diff --git a/lib/libbegemot/Makefile.depend b/lib/libbegemot/Makefile.depend index 467741f6d1a..4acc32f64da 100644 --- a/lib/libbegemot/Makefile.depend +++ b/lib/libbegemot/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/libbluetooth/bluetooth.3 b/lib/libbluetooth/bluetooth.3 index e011094a18c..482c7328593 100644 --- a/lib/libbluetooth/bluetooth.3 +++ b/lib/libbluetooth/bluetooth.3 @@ -720,7 +720,7 @@ The function guarantees that the socket, passed to the callback function, will be bound and connected to the Bluetooth device being enumerated. .Sh AUTHORS -.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com +.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com .Sh BUGS Some of those functions use static data storage; if the data is needed for future use, it should be diff --git a/lib/libc/Makefile b/lib/libc/Makefile index e9bc33bd927..9951857dbf4 100644 --- a/lib/libc/Makefile +++ b/lib/libc/Makefile @@ -80,7 +80,6 @@ NOASM= .include "${LIBC_SRCTOP}/nls/Makefile.inc" .include "${LIBC_SRCTOP}/posix1e/Makefile.inc" .if ${LIBC_ARCH} != "amd64" && \ - ${LIBC_ARCH} != "ia64" && \ ${LIBC_ARCH} != "powerpc64" && \ ${LIBC_ARCH} != "sparc64" && \ ${MACHINE_ARCH:Mmipsn32*} == "" && \ diff --git a/lib/libc/Makefile.depend b/lib/libc/Makefile.depend index 616f3ba7761..d23769e1157 100644 --- a/lib/libc/Makefile.depend +++ b/lib/libc/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ include \ include/rpc \ diff --git a/lib/libc/amd64/gen/sigsetjmp.S b/lib/libc/amd64/gen/sigsetjmp.S index 02b154ce5fa..9a205567c3b 100644 --- a/lib/libc/amd64/gen/sigsetjmp.S +++ b/lib/libc/amd64/gen/sigsetjmp.S @@ -105,7 +105,6 @@ ENTRY(__siglongjmp) movq 40(%rdx),%r13 movq 48(%rdx),%r14 movq 56(%rdx),%r15 - fninit fldcw 64(%rdx) testq %rax,%rax jnz 1f diff --git a/lib/libc/arm/Symbol.map b/lib/libc/arm/Symbol.map index 746db23cb38..cf65492c305 100644 --- a/lib/libc/arm/Symbol.map +++ b/lib/libc/arm/Symbol.map @@ -37,8 +37,9 @@ FBSD_1.3 { __flt_rounds; }; -FBSD_1.3 { - __flt_rounds; +FBSD_1.4 { + __gnu_Unwind_Find_exidx; + dl_unwind_find_exidx; }; FBSDprivate_1.0 { diff --git a/lib/libc/arm/aeabi/Makefile.inc b/lib/libc/arm/aeabi/Makefile.inc index 8f9e19ec2df..0957c922e2d 100644 --- a/lib/libc/arm/aeabi/Makefile.inc +++ b/lib/libc/arm/aeabi/Makefile.inc @@ -3,7 +3,8 @@ .PATH: ${LIBC_SRCTOP}/arm/aeabi SRCS+= aeabi_atexit.c \ - aeabi_unwind_cpp.c + aeabi_unwind_cpp.c \ + aeabi_unwind_exidx.c .if ${MACHINE_ARCH} != "armv6hf" SRCS+= aeabi_double.c \ aeabi_float.c diff --git a/lib/libc/arm/aeabi/aeabi_unwind_exidx.c b/lib/libc/arm/aeabi/aeabi_unwind_exidx.c new file mode 100644 index 00000000000..d5af8b3fc6e --- /dev/null +++ b/lib/libc/arm/aeabi/aeabi_unwind_exidx.c @@ -0,0 +1,104 @@ +/*- + * Copyright (c) 2014 Ian Lepore + * 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 + +/* + * ARM EABI unwind helper. + * + * This finds the exidx section address and size associated with a given code + * address. There are separate implementations for static and dynamic code. + * + * GCC expects this function to exist as __gnu_Unwind_Find_exidx(), clang and + * BSD tools expect it to be dl_unwind_find_exidx(). Both have the same API, so + * we set up an alias for GCC. + */ +__strong_reference(dl_unwind_find_exidx, __gnu_Unwind_Find_exidx); + +/* + * Each entry in the exidx section is a pair of 32-bit words. We don't + * interpret the contents of the entries here; this typedef is just a local + * convenience for using sizeof() and doing pointer math. + */ +typedef struct exidx_entry { + uint32_t data[2]; +} exidx_entry; + +#ifdef __PIC__ + +/* + * Unwind helper for dynamically linked code. + * + * This finds the shared object that contains the given address, and returns the + * address of the exidx section in that shared object along with the number of + * entries in that section, or NULL if it wasn't found. + */ +void * +dl_unwind_find_exidx(const void *pc, int *pcount) +{ + const Elf_Phdr *hdr; + struct dl_phdr_info info; + int i; + + if (_rtld_addr_phdr(pc, &info)) { + hdr = info.dlpi_phdr; + for (i = 0; i < info.dlpi_phnum; i++, hdr++) { + if (hdr->p_type == PT_ARM_EXIDX) { + *pcount = hdr->p_memsz / sizeof(exidx_entry); + return ((void *)(info.dlpi_addr + hdr->p_vaddr)); + } + } + } + return (NULL); +} + +#else /* !__PIC__ */ + +/* + * Unwind helper for statically linked code. + * + * In a statically linked program, the linker populates a pair of symbols with + * the addresses of the start and end of the exidx table, so returning the + * address and count of elements is pretty straighforward. + */ +void * +dl_unwind_find_exidx(const void *pc, int *pcount) +{ + extern struct exidx_entry __exidx_start; + extern struct exidx_entry __exidx_end; + + *pcount = (int)(&__exidx_end - &__exidx_start); + return (&__exidx_start); +} + +#endif /* __PIC__ */ + diff --git a/lib/libc/capability/cap_rights_init.3 b/lib/libc/capability/cap_rights_init.3 index 464184eaea6..5615de1a680 100644 --- a/lib/libc/capability/cap_rights_init.3 +++ b/lib/libc/capability/cap_rights_init.3 @@ -237,5 +237,5 @@ Support for capabilities and capabilities mode was developed as part of the Project. .Sh AUTHORS This family of functions was created by -.An Pawel Jakub Dawidek Aq pawel@dawidek.net +.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net under sponsorship from the FreeBSD Foundation. diff --git a/lib/libc/gen/arc4random.c b/lib/libc/gen/arc4random.c index 59e410bc438..59c4f7fd1dc 100644 --- a/lib/libc/gen/arc4random.c +++ b/lib/libc/gen/arc4random.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arc4random.c,v 1.22 2010/12/22 08:23:42 otto Exp $ */ +/* $OpenBSD: arc4random.c,v 1.24 2013/06/11 16:59:50 deraadt Exp $ */ /* * Copyright (c) 1996, David Mazieres @@ -182,8 +182,7 @@ arc4_stir_if_needed(void) { pid_t pid = getpid(); - if (arc4_count <= 0 || !rs_initialized || arc4_stir_pid != pid) - { + if (arc4_count <= 0 || !rs_initialized || arc4_stir_pid != pid) { arc4_stir_pid = pid; arc4_stir(); } @@ -276,18 +275,8 @@ arc4random_uniform(u_int32_t upper_bound) if (upper_bound < 2) return 0; -#if (ULONG_MAX > 0xffffffffUL) - min = 0x100000000UL % upper_bound; -#else - /* Calculate (2**32 % upper_bound) avoiding 64-bit math */ - if (upper_bound > 0x80000000) - min = 1 + ~upper_bound; /* 2**32 - upper_bound */ - else { - /* (2**32 - (x * 2)) % x == 2**32 % x when x <= 2**31 */ - min = ((0xffffffff - (upper_bound * 2)) + 1) % upper_bound; - } -#endif - + /* 2**32 % x == (2**32 - x) % x */ + min = -upper_bound % upper_bound; /* * This could theoretically loop forever but each retry has * p > 0.5 (worst case, usually far better) of selecting a diff --git a/lib/libc/gen/cap_rights_get.3 b/lib/libc/gen/cap_rights_get.3 index bc6fb248ec2..f74d1f7aeda 100644 --- a/lib/libc/gen/cap_rights_get.3 +++ b/lib/libc/gen/cap_rights_get.3 @@ -115,5 +115,5 @@ Support for capabilities and capabilities mode was developed as part of the Project. .Sh AUTHORS This function was created by -.An Pawel Jakub Dawidek Aq pawel@dawidek.net +.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net under sponsorship of the FreeBSD Foundation. diff --git a/lib/libc/gen/cap_sandboxed.3 b/lib/libc/gen/cap_sandboxed.3 index 7019bfb9a3f..5882ff00278 100644 --- a/lib/libc/gen/cap_sandboxed.3 +++ b/lib/libc/gen/cap_sandboxed.3 @@ -67,5 +67,5 @@ or .Xr capsicum 4 .Sh AUTHORS This function was implemented and manual page was written by -.An Pawel Jakub Dawidek Aq pawel@dawidek.net +.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net under sponsorship of the FreeBSD Foundation. diff --git a/lib/libc/gen/check_utility_compat.3 b/lib/libc/gen/check_utility_compat.3 index 57638e50ead..89449a4064b 100644 --- a/lib/libc/gen/check_utility_compat.3 +++ b/lib/libc/gen/check_utility_compat.3 @@ -86,4 +86,4 @@ function first appeared in .Fx 5.0 . .Sh AUTHORS This manual page was written by -.An Garrett Wollman Aq wollman@FreeBSD.org . +.An Garrett Wollman Aq Mt wollman@FreeBSD.org . diff --git a/lib/libc/gen/clock_getcpuclockid.3 b/lib/libc/gen/clock_getcpuclockid.3 index 3d31993ccc2..ebaa3dc0cc4 100644 --- a/lib/libc/gen/clock_getcpuclockid.3 +++ b/lib/libc/gen/clock_getcpuclockid.3 @@ -92,4 +92,4 @@ The function first appeared in .Fx 10.0 . .Sh AUTHORS -.An David Xu Aq davidxu@FreeBSD.org +.An David Xu Aq Mt davidxu@FreeBSD.org diff --git a/lib/libc/gen/directory.3 b/lib/libc/gen/directory.3 index 4573d4513fe..1e864f8dcbc 100644 --- a/lib/libc/gen/directory.3 +++ b/lib/libc/gen/directory.3 @@ -28,7 +28,7 @@ .\" @(#)directory.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd August 18, 2013 +.Dd July 28, 2014 .Dt DIRECTORY 3 .Os .Sh NAME @@ -169,6 +169,10 @@ If the directory is closed and then reopened, prior values returned by .Fn telldir will no longer be valid. +Values returned by +.Fn telldir +are also invalidated by a call to +.Fn rewinddir . .Pp The .Fn seekdir @@ -182,13 +186,6 @@ The new position reverts to the one associated with the when the .Fn telldir operation was performed. -State associated with the token returned by -.Fn telldir is freed when it is passed to -.Fn seekdir . -If you wish return to the same location again, -then you must create a new token with another -.Fn telldir -call. .Pp The .Fn rewinddir diff --git a/lib/libc/gen/dlinfo.3 b/lib/libc/gen/dlinfo.3 index d00f07467af..3fc568e0fcc 100644 --- a/lib/libc/gen/dlinfo.3 +++ b/lib/libc/gen/dlinfo.3 @@ -271,12 +271,9 @@ The implementation of the .Fn dlinfo function was originally written by -.An Alexey Zelkin -.Aq phantom@FreeBSD.org +.An Alexey Zelkin Aq Mt phantom@FreeBSD.org and later extended and improved by -.An Alexander Kabaev -.Aq kan@FreeBSD.org . +.An Alexander Kabaev Aq Mt kan@FreeBSD.org . .Pp The manual page for this function was written by -.An Alexey Zelkin -.Aq phantom@FreeBSD.org . +.An Alexey Zelkin Aq Mt phantom@FreeBSD.org . diff --git a/lib/libc/gen/ftok.3 b/lib/libc/gen/ftok.3 index 996b2da41c7..98f8bad878f 100644 --- a/lib/libc/gen/ftok.3 +++ b/lib/libc/gen/ftok.3 @@ -73,7 +73,7 @@ The function originates with System V and is typically used by programs that use the System V IPC routines. .Sh AUTHORS -.An Thorsten Lockert Aq tholo@sigmasoft.com +.An Thorsten Lockert Aq Mt tholo@sigmasoft.com .Sh BUGS The returned key is computed based on the device minor number and inode of the specified diff --git a/lib/libc/gen/gen-private.h b/lib/libc/gen/gen-private.h index e8854ad2d85..d1fab5f3146 100644 --- a/lib/libc/gen/gen-private.h +++ b/lib/libc/gen/gen-private.h @@ -48,7 +48,6 @@ struct _dirdesc { char *dd_buf; /* data buffer */ int dd_len; /* size of data buffer */ long dd_seek; /* magic cookie returned by getdirentries */ - long dd_rewind; /* magic cookie for rewinding */ int dd_flags; /* flags for readdir */ struct pthread_mutex *dd_lock; /* lock */ struct _telldir *dd_td; /* telldir position recording */ diff --git a/lib/libc/gen/getpagesizes.3 b/lib/libc/gen/getpagesizes.3 index 854e2f7858f..52fa866821f 100644 --- a/lib/libc/gen/getpagesizes.3 +++ b/lib/libc/gen/getpagesizes.3 @@ -96,4 +96,4 @@ implementation that was first released in .Fx 7.3 . .Sh AUTHORS This manual page was written by -.An Alan L. Cox Aq alc@cs.rice.edu . +.An Alan L. Cox Aq Mt alc@cs.rice.edu . diff --git a/lib/libc/gen/getutxent.3 b/lib/libc/gen/getutxent.3 index 2ea09712d8d..120f4a08b8e 100644 --- a/lib/libc/gen/getutxent.3 +++ b/lib/libc/gen/getutxent.3 @@ -475,4 +475,4 @@ They replaced the .In utmp.h interface. .Sh AUTHORS -.An Ed Schouten Aq ed@FreeBSD.org +.An Ed Schouten Aq Mt ed@FreeBSD.org diff --git a/lib/libc/gen/opendir.c b/lib/libc/gen/opendir.c index a9eb0af1ba4..54928e73d60 100644 --- a/lib/libc/gen/opendir.c +++ b/lib/libc/gen/opendir.c @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #include "gen-private.h" #include "telldir.h" -static DIR * __opendir_common(int, int); +static DIR * __opendir_common(int, int, bool); /* * Open a directory. @@ -67,18 +67,10 @@ opendir(const char *name) DIR * fdopendir(int fd) { - struct stat statb; - /* Check that fd is associated with a directory. */ - if (_fstat(fd, &statb) != 0) - return (NULL); - if (!S_ISDIR(statb.st_mode)) { - errno = ENOTDIR; - return (NULL); - } if (_fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) return (NULL); - return (__opendir_common(fd, DTF_HIDEW|DTF_NODUP)); + return (__opendir_common(fd, DTF_HIDEW|DTF_NODUP, true)); } DIR * @@ -88,11 +80,13 @@ __opendir2(const char *name, int flags) DIR *dir; int saved_errno; + if ((flags & (__DTF_READALL | __DTF_SKIPREAD)) != 0) + return (NULL); if ((fd = _open(name, O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC)) == -1) return (NULL); - dir = __opendir_common(fd, flags); + dir = __opendir_common(fd, flags, false); if (dir == NULL) { saved_errno = errno; _close(fd); @@ -109,23 +103,196 @@ opendir_compar(const void *p1, const void *p2) (*(const struct dirent **)p2)->d_name)); } +/* + * For a directory at the top of a unionfs stack, the entire directory's + * contents are read and cached locally until the next call to rewinddir(). + * For the fdopendir() case, the initial seek position must be preserved. + * For rewinddir(), the full directory should always be re-read from the + * beginning. + * + * If an error occurs, the existing buffer and state of 'dirp' is left + * unchanged. + */ +bool +_filldir(DIR *dirp, bool use_current_pos) +{ + struct dirent **dpv; + char *buf, *ddptr, *ddeptr; + off_t pos; + int fd2, incr, len, n, saved_errno, space; + + len = 0; + space = 0; + buf = NULL; + ddptr = NULL; + + /* + * Use the system page size if that is a multiple of DIRBLKSIZ. + * Hopefully this can be a big win someday by allowing page + * trades to user space to be done by _getdirentries(). + */ + incr = getpagesize(); + if ((incr % DIRBLKSIZ) != 0) + incr = DIRBLKSIZ; + + /* + * The strategy here is to read all the directory + * entries into a buffer, sort the buffer, and + * remove duplicate entries by setting the inode + * number to zero. + * + * We reopen the directory because _getdirentries() + * on a MNT_UNION mount modifies the open directory, + * making it refer to the lower directory after the + * upper directory's entries are exhausted. + * This would otherwise break software that uses + * the directory descriptor for fchdir or *at + * functions, such as fts.c. + */ + if ((fd2 = _openat(dirp->dd_fd, ".", O_RDONLY | O_CLOEXEC)) == -1) + return (false); + + if (use_current_pos) { + pos = lseek(dirp->dd_fd, 0, SEEK_CUR); + if (pos == -1 || lseek(fd2, pos, SEEK_SET) == -1) { + saved_errno = errno; + _close(fd2); + errno = saved_errno; + return (false); + } + } + + do { + /* + * Always make at least DIRBLKSIZ bytes + * available to _getdirentries + */ + if (space < DIRBLKSIZ) { + space += incr; + len += incr; + buf = reallocf(buf, len); + if (buf == NULL) { + saved_errno = errno; + _close(fd2); + errno = saved_errno; + return (false); + } + ddptr = buf + (len - space); + } + + n = _getdirentries(fd2, ddptr, space, &dirp->dd_seek); + if (n > 0) { + ddptr += n; + space -= n; + } + if (n < 0) { + saved_errno = errno; + _close(fd2); + errno = saved_errno; + return (false); + } + } while (n > 0); + _close(fd2); + + ddeptr = ddptr; + + /* + * There is now a buffer full of (possibly) duplicate + * names. + */ + dirp->dd_buf = buf; + + /* + * Go round this loop twice... + * + * Scan through the buffer, counting entries. + * On the second pass, save pointers to each one. + * Then sort the pointers and remove duplicate names. + */ + for (dpv = 0;;) { + n = 0; + ddptr = buf; + while (ddptr < ddeptr) { + struct dirent *dp; + + dp = (struct dirent *) ddptr; + if ((long)dp & 03L) + break; + if ((dp->d_reclen <= 0) || + (dp->d_reclen > (ddeptr + 1 - ddptr))) + break; + ddptr += dp->d_reclen; + if (dp->d_fileno) { + if (dpv) + dpv[n] = dp; + n++; + } + } + + if (dpv) { + struct dirent *xp; + + /* + * This sort must be stable. + */ + mergesort(dpv, n, sizeof(*dpv), opendir_compar); + + dpv[n] = NULL; + xp = NULL; + + /* + * Scan through the buffer in sort order, + * zapping the inode number of any + * duplicate names. + */ + for (n = 0; dpv[n]; n++) { + struct dirent *dp = dpv[n]; + + if ((xp == NULL) || + strcmp(dp->d_name, xp->d_name)) { + xp = dp; + } else { + dp->d_fileno = 0; + } + if (dp->d_type == DT_WHT && + (dirp->dd_flags & DTF_HIDEW)) + dp->d_fileno = 0; + } + + free(dpv); + break; + } else { + dpv = malloc((n+1) * sizeof(struct dirent *)); + if (dpv == NULL) + break; + } + } + + dirp->dd_len = len; + dirp->dd_size = ddptr - dirp->dd_buf; + return (true); +} + + /* * Common routine for opendir(3), __opendir2(3) and fdopendir(3). */ static DIR * -__opendir_common(int fd, int flags) +__opendir_common(int fd, int flags, bool use_current_pos) { DIR *dirp; int incr; int saved_errno; int unionstack; - int fd2; - - fd2 = -1; if ((dirp = malloc(sizeof(DIR) + sizeof(struct _telldir))) == NULL) return (NULL); + dirp->dd_buf = NULL; + dirp->dd_fd = fd; + dirp->dd_flags = flags; + dirp->dd_loc = 0; + dirp->dd_lock = NULL; dirp->dd_td = (struct _telldir *)((char *)dirp + sizeof(DIR)); LIST_INIT(&dirp->dd_td->td_locq); dirp->dd_td->td_loccnt = 0; @@ -154,163 +321,39 @@ __opendir_common(int fd, int flags) } if (unionstack) { - int len = 0; - int space = 0; - char *buf = 0; - char *ddptr = 0; - char *ddeptr; - int n; - struct dirent **dpv; - - /* - * The strategy here is to read all the directory - * entries into a buffer, sort the buffer, and - * remove duplicate entries by setting the inode - * number to zero. - * - * We reopen the directory because _getdirentries() - * on a MNT_UNION mount modifies the open directory, - * making it refer to the lower directory after the - * upper directory's entries are exhausted. - * This would otherwise break software that uses - * the directory descriptor for fchdir or *at - * functions, such as fts.c. - */ - if ((fd2 = _openat(fd, ".", O_RDONLY | O_CLOEXEC)) == -1) { - saved_errno = errno; - free(buf); - free(dirp); - errno = saved_errno; - return (NULL); - } - - do { - /* - * Always make at least DIRBLKSIZ bytes - * available to _getdirentries - */ - if (space < DIRBLKSIZ) { - space += incr; - len += incr; - buf = reallocf(buf, len); - if (buf == NULL) - goto fail; - ddptr = buf + (len - space); - } - - n = _getdirentries(fd2, ddptr, space, &dirp->dd_seek); - if (n > 0) { - ddptr += n; - space -= n; - } - } while (n > 0); - - ddeptr = ddptr; - flags |= __DTF_READALL; - - _close(fd2); - fd2 = -1; - - /* - * There is now a buffer full of (possibly) duplicate - * names. - */ - dirp->dd_buf = buf; - - /* - * Go round this loop twice... - * - * Scan through the buffer, counting entries. - * On the second pass, save pointers to each one. - * Then sort the pointers and remove duplicate names. - */ - for (dpv = 0;;) { - n = 0; - ddptr = buf; - while (ddptr < ddeptr) { - struct dirent *dp; - - dp = (struct dirent *) ddptr; - if ((long)dp & 03L) - break; - if ((dp->d_reclen <= 0) || - (dp->d_reclen > (ddeptr + 1 - ddptr))) - break; - ddptr += dp->d_reclen; - if (dp->d_fileno) { - if (dpv) - dpv[n] = dp; - n++; - } - } - - if (dpv) { - struct dirent *xp; - - /* - * This sort must be stable. - */ - mergesort(dpv, n, sizeof(*dpv), - opendir_compar); - - dpv[n] = NULL; - xp = NULL; - - /* - * Scan through the buffer in sort order, - * zapping the inode number of any - * duplicate names. - */ - for (n = 0; dpv[n]; n++) { - struct dirent *dp = dpv[n]; - - if ((xp == NULL) || - strcmp(dp->d_name, xp->d_name)) { - xp = dp; - } else { - dp->d_fileno = 0; - } - if (dp->d_type == DT_WHT && - (flags & DTF_HIDEW)) - dp->d_fileno = 0; - } - - free(dpv); - break; - } else { - dpv = malloc((n+1) * sizeof(struct dirent *)); - if (dpv == NULL) - break; - } - } - - dirp->dd_len = len; - dirp->dd_size = ddptr - dirp->dd_buf; + if (!_filldir(dirp, use_current_pos)) + goto fail; + dirp->dd_flags |= __DTF_READALL; } else { dirp->dd_len = incr; - dirp->dd_size = 0; dirp->dd_buf = malloc(dirp->dd_len); if (dirp->dd_buf == NULL) goto fail; - dirp->dd_seek = 0; + if (use_current_pos) { + /* + * Read the first batch of directory entries + * to prime dd_seek. This also checks if the + * fd passed to fdopendir() is a directory. + */ + dirp->dd_size = _getdirentries(dirp->dd_fd, + dirp->dd_buf, dirp->dd_len, &dirp->dd_seek); + if (dirp->dd_size < 0) { + if (errno == EINVAL) + errno = ENOTDIR; + goto fail; + } + dirp->dd_flags |= __DTF_SKIPREAD; + } else { + dirp->dd_size = 0; + dirp->dd_seek = 0; + } } - dirp->dd_loc = 0; - dirp->dd_fd = fd; - dirp->dd_flags = flags; - dirp->dd_lock = NULL; - - /* - * Set up seek point for rewinddir. - */ - dirp->dd_rewind = telldir(dirp); - return (dirp); fail: saved_errno = errno; - if (fd2 != -1) - _close(fd2); + free(dirp->dd_buf); free(dirp); errno = saved_errno; return (NULL); diff --git a/lib/libc/gen/posix_spawn.3 b/lib/libc/gen/posix_spawn.3 index 73359b44b16..dd5bd2b5ed8 100644 --- a/lib/libc/gen/posix_spawn.3 +++ b/lib/libc/gen/posix_spawn.3 @@ -457,4 +457,4 @@ and functions first appeared in .Fx 8.0 . .Sh AUTHORS -.An Ed Schouten Aq ed@FreeBSD.org +.An Ed Schouten Aq Mt ed@FreeBSD.org diff --git a/lib/libc/gen/posix_spawn_file_actions_addopen.3 b/lib/libc/gen/posix_spawn_file_actions_addopen.3 index 9cd47efb02d..b28f3960ef6 100644 --- a/lib/libc/gen/posix_spawn_file_actions_addopen.3 +++ b/lib/libc/gen/posix_spawn_file_actions_addopen.3 @@ -200,4 +200,4 @@ and functions first appeared in .Fx 8.0 . .Sh AUTHORS -.An Ed Schouten Aq ed@FreeBSD.org +.An Ed Schouten Aq Mt ed@FreeBSD.org diff --git a/lib/libc/gen/posix_spawn_file_actions_init.3 b/lib/libc/gen/posix_spawn_file_actions_init.3 index d826b8bf445..eda2a1daa1e 100644 --- a/lib/libc/gen/posix_spawn_file_actions_init.3 +++ b/lib/libc/gen/posix_spawn_file_actions_init.3 @@ -101,4 +101,4 @@ and functions first appeared in .Fx 8.0 . .Sh AUTHORS -.An Ed Schouten Aq ed@FreeBSD.org +.An Ed Schouten Aq Mt ed@FreeBSD.org diff --git a/lib/libc/gen/posix_spawnattr_getflags.3 b/lib/libc/gen/posix_spawnattr_getflags.3 index 4064011f1d0..b5995cea4a8 100644 --- a/lib/libc/gen/posix_spawnattr_getflags.3 +++ b/lib/libc/gen/posix_spawnattr_getflags.3 @@ -108,4 +108,4 @@ and functions first appeared in .Fx 8.0 . .Sh AUTHORS -.An Ed Schouten Aq ed@FreeBSD.org +.An Ed Schouten Aq Mt ed@FreeBSD.org diff --git a/lib/libc/gen/posix_spawnattr_getpgroup.3 b/lib/libc/gen/posix_spawnattr_getpgroup.3 index 5cd51d687ab..91b3e5cd3d1 100644 --- a/lib/libc/gen/posix_spawnattr_getpgroup.3 +++ b/lib/libc/gen/posix_spawnattr_getpgroup.3 @@ -93,4 +93,4 @@ and functions first appeared in .Fx 8.0 . .Sh AUTHORS -.An Ed Schouten Aq ed@FreeBSD.org +.An Ed Schouten Aq Mt ed@FreeBSD.org diff --git a/lib/libc/gen/posix_spawnattr_getschedparam.3 b/lib/libc/gen/posix_spawnattr_getschedparam.3 index 70009b9b409..a137200bd6a 100644 --- a/lib/libc/gen/posix_spawnattr_getschedparam.3 +++ b/lib/libc/gen/posix_spawnattr_getschedparam.3 @@ -97,4 +97,4 @@ and functions first appeared in .Fx 8.0 . .Sh AUTHORS -.An Ed Schouten Aq ed@FreeBSD.org +.An Ed Schouten Aq Mt ed@FreeBSD.org diff --git a/lib/libc/gen/posix_spawnattr_getschedpolicy.3 b/lib/libc/gen/posix_spawnattr_getschedpolicy.3 index 45c1965408b..3e79d4b7958 100644 --- a/lib/libc/gen/posix_spawnattr_getschedpolicy.3 +++ b/lib/libc/gen/posix_spawnattr_getschedpolicy.3 @@ -95,4 +95,4 @@ and functions first appeared in .Fx 8.0 . .Sh AUTHORS -.An Ed Schouten Aq ed@FreeBSD.org +.An Ed Schouten Aq Mt ed@FreeBSD.org diff --git a/lib/libc/gen/posix_spawnattr_getsigdefault.3 b/lib/libc/gen/posix_spawnattr_getsigdefault.3 index 9e13c3742cf..88783322ff9 100644 --- a/lib/libc/gen/posix_spawnattr_getsigdefault.3 +++ b/lib/libc/gen/posix_spawnattr_getsigdefault.3 @@ -95,4 +95,4 @@ and functions first appeared in .Fx 8.0 . .Sh AUTHORS -.An Ed Schouten Aq ed@FreeBSD.org +.An Ed Schouten Aq Mt ed@FreeBSD.org diff --git a/lib/libc/gen/posix_spawnattr_getsigmask.3 b/lib/libc/gen/posix_spawnattr_getsigmask.3 index 5cee7ec6853..4f9c014853a 100644 --- a/lib/libc/gen/posix_spawnattr_getsigmask.3 +++ b/lib/libc/gen/posix_spawnattr_getsigmask.3 @@ -95,4 +95,4 @@ and functions first appeared in .Fx 8.0 . .Sh AUTHORS -.An Ed Schouten Aq ed@FreeBSD.org +.An Ed Schouten Aq Mt ed@FreeBSD.org diff --git a/lib/libc/gen/posix_spawnattr_init.3 b/lib/libc/gen/posix_spawnattr_init.3 index 66c99cd5afa..19d29a6f99c 100644 --- a/lib/libc/gen/posix_spawnattr_init.3 +++ b/lib/libc/gen/posix_spawnattr_init.3 @@ -120,4 +120,4 @@ and functions first appeared in .Fx 8.0 . .Sh AUTHORS -.An Ed Schouten Aq ed@FreeBSD.org +.An Ed Schouten Aq Mt ed@FreeBSD.org diff --git a/lib/libc/gen/readdir.c b/lib/libc/gen/readdir.c index 324870b39ad..69f59d16087 100644 --- a/lib/libc/gen/readdir.c +++ b/lib/libc/gen/readdir.c @@ -61,12 +61,14 @@ _readdir_unlocked(dirp, skip) return (NULL); dirp->dd_loc = 0; } - if (dirp->dd_loc == 0 && !(dirp->dd_flags & __DTF_READALL)) { + if (dirp->dd_loc == 0 && + !(dirp->dd_flags & (__DTF_READALL | __DTF_SKIPREAD))) { dirp->dd_size = _getdirentries(dirp->dd_fd, dirp->dd_buf, dirp->dd_len, &dirp->dd_seek); if (dirp->dd_size <= 0) return (NULL); } + dirp->dd_flags &= ~__DTF_SKIPREAD; dp = (struct dirent *)(dirp->dd_buf + dirp->dd_loc); if ((long)dp & 03L) /* bogus pointer check */ return (NULL); diff --git a/lib/libc/gen/readpassphrase.c b/lib/libc/gen/readpassphrase.c index 86c7811d9fb..95ae725e040 100644 --- a/lib/libc/gen/readpassphrase.c +++ b/lib/libc/gen/readpassphrase.c @@ -1,4 +1,4 @@ -/* $OpenBSD: readpassphrase.c,v 1.23 2010/05/14 13:30:34 millert Exp $ */ +/* $OpenBSD: readpassphrase.c,v 1.24 2013/11/24 23:51:29 deraadt Exp $ */ /* * Copyright (c) 2000-2002, 2007, 2010 @@ -122,11 +122,11 @@ readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags) if (p < end) { if ((flags & RPP_SEVENBIT)) ch &= 0x7f; - if (isalpha(ch)) { + if (isalpha((unsigned char)ch)) { if ((flags & RPP_FORCELOWER)) - ch = (char)tolower(ch); + ch = (char)tolower((unsigned char)ch); if ((flags & RPP_FORCEUPPER)) - ch = (char)toupper(ch); + ch = (char)toupper((unsigned char)ch); } *p++ = ch; } diff --git a/lib/libc/gen/rewinddir.c b/lib/libc/gen/rewinddir.c index 0eb091a0824..89e717cbfc1 100644 --- a/lib/libc/gen/rewinddir.c +++ b/lib/libc/gen/rewinddir.c @@ -33,9 +33,14 @@ static char sccsid[] = "@(#)rewinddir.c 8.1 (Berkeley) 6/8/93"; #include __FBSDID("$FreeBSD$"); +#include "namespace.h" #include #include +#include +#include +#include "un-namespace.h" +#include "libc_private.h" #include "gen-private.h" #include "telldir.h" @@ -44,6 +49,16 @@ rewinddir(dirp) DIR *dirp; { - _seekdir(dirp, dirp->dd_rewind); - dirp->dd_rewind = telldir(dirp); + if (__isthreaded) + _pthread_mutex_lock(&dirp->dd_lock); + if (dirp->dd_flags & __DTF_READALL) + _filldir(dirp, false); + else if (dirp->dd_seek != 0) { + (void) lseek(dirp->dd_fd, 0, SEEK_SET); + dirp->dd_seek = 0; + } + dirp->dd_loc = 0; + _reclaim_telldir(dirp); + if (__isthreaded) + _pthread_mutex_unlock(&dirp->dd_lock); } diff --git a/lib/libc/gen/sem_new.c b/lib/libc/gen/sem_new.c index 9a2ab2716df..ec1a2fde853 100644 --- a/lib/libc/gen/sem_new.c +++ b/lib/libc/gen/sem_new.c @@ -66,6 +66,8 @@ __weak_reference(_sem_wait, sem_wait); struct sem_nameinfo { int open_count; char *name; + dev_t dev; + ino_t ino; sem_t *sem; LIST_ENTRY(sem_nameinfo) next; }; @@ -151,36 +153,45 @@ _sem_open(const char *name, int flags, ...) return (SEM_FAILED); } name++; - + strcpy(path, SEM_PREFIX); + if (strlcat(path, name, sizeof(path)) >= sizeof(path)) { + errno = ENAMETOOLONG; + return (SEM_FAILED); + } if (flags & ~(O_CREAT|O_EXCL)) { errno = EINVAL; return (SEM_FAILED); } - - _pthread_once(&once, sem_module_init); - - _pthread_mutex_lock(&sem_llock); - LIST_FOREACH(ni, &sem_list, next) { - if (strcmp(name, ni->name) == 0) { - if ((flags & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL)) { - _pthread_mutex_unlock(&sem_llock); - errno = EEXIST; - return (SEM_FAILED); - } else { - ni->open_count++; - sem = ni->sem; - _pthread_mutex_unlock(&sem_llock); - return (sem); - } - } - } - - if (flags & O_CREAT) { + if ((flags & O_CREAT) != 0) { va_start(ap, flags); mode = va_arg(ap, int); value = va_arg(ap, int); va_end(ap); } + fd = -1; + _pthread_once(&once, sem_module_init); + + _pthread_mutex_lock(&sem_llock); + LIST_FOREACH(ni, &sem_list, next) { + if (ni->name != NULL && strcmp(name, ni->name) == 0) { + fd = _open(path, flags | O_RDWR | O_CLOEXEC | + O_EXLOCK, mode); + if (fd == -1 || _fstat(fd, &sb) == -1) + goto error; + if ((flags & (O_CREAT | O_EXCL)) == (O_CREAT | + O_EXCL) || ni->dev != sb.st_dev || + ni->ino != sb.st_ino) { + ni->name = NULL; + ni = NULL; + break; + } + ni->open_count++; + sem = ni->sem; + _pthread_mutex_unlock(&sem_llock); + _close(fd); + return (sem); + } + } len = sizeof(*ni) + strlen(name) + 1; ni = (struct sem_nameinfo *)malloc(len); @@ -192,17 +203,11 @@ _sem_open(const char *name, int flags, ...) ni->name = (char *)(ni+1); strcpy(ni->name, name); - strcpy(path, SEM_PREFIX); - if (strlcat(path, name, sizeof(path)) >= sizeof(path)) { - errno = ENAMETOOLONG; - goto error; + if (fd == -1) { + fd = _open(path, flags | O_RDWR | O_CLOEXEC | O_EXLOCK, mode); + if (fd == -1 || _fstat(fd, &sb) == -1) + goto error; } - - fd = _open(path, flags|O_RDWR|O_CLOEXEC|O_EXLOCK, mode); - if (fd == -1) - goto error; - if (_fstat(fd, &sb)) - goto error; if (sb.st_size < sizeof(sem_t)) { sem_t tmp; @@ -228,6 +233,8 @@ _sem_open(const char *name, int flags, ...) } ni->open_count = 1; ni->sem = sem; + ni->dev = sb.st_dev; + ni->ino = sb.st_ino; LIST_INSERT_HEAD(&sem_list, ni, next); _close(fd); _pthread_mutex_unlock(&sem_llock); @@ -294,13 +301,13 @@ _sem_unlink(const char *name) return -1; } name++; - strcpy(path, SEM_PREFIX); if (strlcat(path, name, sizeof(path)) >= sizeof(path)) { errno = ENAMETOOLONG; return (-1); } - return unlink(path); + + return (unlink(path)); } int diff --git a/lib/libc/gen/sem_wait.3 b/lib/libc/gen/sem_wait.3 index 993ac4a15a2..9de8ba8a0e7 100644 --- a/lib/libc/gen/sem_wait.3 +++ b/lib/libc/gen/sem_wait.3 @@ -81,6 +81,7 @@ will fail if: .It Bq Er EINTR A signal interrupted this function. .El +.Pp Additionally, .Fn sem_trywait will fail if: diff --git a/lib/libc/gen/setproctitle.3 b/lib/libc/gen/setproctitle.3 index 0fefddf3b31..955556e5b20 100644 --- a/lib/libc/gen/setproctitle.3 +++ b/lib/libc/gen/setproctitle.3 @@ -100,11 +100,11 @@ Other operating systems have similar functions. .Sh AUTHORS .An -nosplit -.An Peter Wemm Aq peter@FreeBSD.org +.An Peter Wemm Aq Mt peter@FreeBSD.org stole the idea from the .Sy "Sendmail 8.7.3" source code by -.An Eric Allman Aq eric@sendmail.org . +.An Eric Allman Aq Mt eric@sendmail.org . .Sh BUGS Never pass a string with user-supplied data as a format without using .Ql %s . diff --git a/lib/libc/gen/statvfs.3 b/lib/libc/gen/statvfs.3 index f9c7430f6e9..73109bd9834 100644 --- a/lib/libc/gen/statvfs.3 +++ b/lib/libc/gen/statvfs.3 @@ -184,4 +184,4 @@ The and .Fn fstatvfs functions and this manual page were written by -.An Garrett Wollman Aq wollman@FreeBSD.org . +.An Garrett Wollman Aq Mt wollman@FreeBSD.org . diff --git a/lib/libc/gen/sysconf.c b/lib/libc/gen/sysconf.c index b7952b107c3..2b3acfb5db7 100644 --- a/lib/libc/gen/sysconf.c +++ b/lib/libc/gen/sysconf.c @@ -367,11 +367,17 @@ sysconf(name) * _POSIX_FILE_LOCKING, so we can't answer this one. */ #endif -#if _POSIX_THREAD_SAFE_FUNCTIONS > -1 + + /* + * SUSv4tc1 says the following about _SC_GETGR_R_SIZE_MAX and + * _SC_GETPW_R_SIZE_MAX: + * Note that sysconf(_SC_GETGR_R_SIZE_MAX) may return -1 if + * there is no hard limit on the size of the buffer needed to + * store all the groups returned. + */ case _SC_GETGR_R_SIZE_MAX: case _SC_GETPW_R_SIZE_MAX: -#error "somebody needs to implement this" -#endif + return (-1); case _SC_HOST_NAME_MAX: return (MAXHOSTNAMELEN - 1); /* does not include \0 */ case _SC_LOGIN_NAME_MAX: diff --git a/lib/libc/gen/telldir.c b/lib/libc/gen/telldir.c index 4954b973a91..d72b500b051 100644 --- a/lib/libc/gen/telldir.c +++ b/lib/libc/gen/telldir.c @@ -46,13 +46,6 @@ __FBSDID("$FreeBSD$"); #include "gen-private.h" #include "telldir.h" -/* - * The option SINGLEUSE may be defined to say that a telldir - * cookie may be used only once before it is freed. This option - * is used to avoid having memory usage grow without bound. - */ -#define SINGLEUSE - /* * return a pointer into a directory */ @@ -61,18 +54,31 @@ telldir(dirp) DIR *dirp; { struct ddloc *lp; + long idx; - if ((lp = (struct ddloc *)malloc(sizeof(struct ddloc))) == NULL) - return (-1); if (__isthreaded) _pthread_mutex_lock(&dirp->dd_lock); - lp->loc_index = dirp->dd_td->td_loccnt++; - lp->loc_seek = dirp->dd_seek; - lp->loc_loc = dirp->dd_loc; - LIST_INSERT_HEAD(&dirp->dd_td->td_locq, lp, loc_lqe); + LIST_FOREACH(lp, &dirp->dd_td->td_locq, loc_lqe) { + if (lp->loc_seek == dirp->dd_seek && + lp->loc_loc == dirp->dd_loc) + break; + } + if (lp == NULL) { + lp = malloc(sizeof(struct ddloc)); + if (lp == NULL) { + if (__isthreaded) + _pthread_mutex_unlock(&dirp->dd_lock); + return (-1); + } + lp->loc_index = dirp->dd_td->td_loccnt++; + lp->loc_seek = dirp->dd_seek; + lp->loc_loc = dirp->dd_loc; + LIST_INSERT_HEAD(&dirp->dd_td->td_locq, lp, loc_lqe); + } + idx = lp->loc_index; if (__isthreaded) _pthread_mutex_unlock(&dirp->dd_lock); - return (lp->loc_index); + return (idx); } /* @@ -94,7 +100,7 @@ _seekdir(dirp, loc) if (lp == NULL) return; if (lp->loc_loc == dirp->dd_loc && lp->loc_seek == dirp->dd_seek) - goto found; + return; (void) lseek(dirp->dd_fd, (off_t)lp->loc_seek, SEEK_SET); dirp->dd_seek = lp->loc_seek; dirp->dd_loc = 0; @@ -103,11 +109,6 @@ _seekdir(dirp, loc) if (dp == NULL) break; } -found: -#ifdef SINGLEUSE - LIST_REMOVE(lp, loc_lqe); - free((caddr_t)lp); -#endif } /* diff --git a/lib/libc/gen/telldir.h b/lib/libc/gen/telldir.h index ef930d2b80b..04989bb7b53 100644 --- a/lib/libc/gen/telldir.h +++ b/lib/libc/gen/telldir.h @@ -36,6 +36,7 @@ #define _TELLDIR_H_ #include +#include /* * One of these structures is malloced to describe the current directory @@ -59,6 +60,7 @@ struct _telldir { long td_loccnt; /* index of entry for sequential readdir's */ }; +bool _filldir(DIR *, bool); struct dirent *_readdir_unlocked(DIR *, int); void _reclaim_telldir(DIR *); void _seekdir(DIR *, long); diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c index 4b083da2ae8..5219418fdc3 100644 --- a/lib/libc/gen/tls.c +++ b/lib/libc/gen/tls.c @@ -62,7 +62,7 @@ void _rtld_free_tls(void *tls, size_t tcbsize, size_t tcbalign); void *__libc_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign); void __libc_free_tls(void *tls, size_t tcbsize, size_t tcbalign); -#if defined(__ia64__) || defined(__amd64__) +#if defined(__amd64__) #define TLS_TCB_ALIGN 16 #elif defined(__powerpc__) || defined(__i386__) || defined(__arm__) || \ defined(__sparc64__) || defined(__mips__) @@ -71,8 +71,7 @@ void __libc_free_tls(void *tls, size_t tcbsize, size_t tcbalign); #error TLS_TCB_ALIGN undefined for target architecture #endif -#if defined(__arm__) || defined(__ia64__) || defined(__mips__) || \ - defined(__powerpc__) +#if defined(__arm__) || defined(__mips__) || defined(__powerpc__) #define TLS_VARIANT_I #endif #if defined(__i386__) || defined(__amd64__) || defined(__sparc64__) diff --git a/lib/libc/gen/ttyname.3 b/lib/libc/gen/ttyname.3 index 9420bbe8f9e..9e8a4f09959 100644 --- a/lib/libc/gen/ttyname.3 +++ b/lib/libc/gen/ttyname.3 @@ -28,7 +28,7 @@ .\" @(#)ttyname.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd May 14, 2005 +.Dd July 18, 2014 .Dt TTYNAME 3 .Os .Sh NAME @@ -76,6 +76,14 @@ function takes a buffer and length as arguments to avoid this problem. .Sh RETURN VALUES The +.Fn isatty +function returns 1 if +.Fa fd +refers to a terminal type device; +otherwise, it returns 0 and may set +.Va errno +to indicate the error. +The .Fn ttyname function returns the null terminated name if the device is found and @@ -89,15 +97,23 @@ The function returns 0 if successful. Otherwise an error number is returned. .Sh ERRORS -The -.Fn ttyname_r -may fail and return the following error codes: +These functions may fail if: .Bl -tag -width Er -.It Bq Er ENOTTY +.It Bq Er EBADF The .Fa fd argument is not a valid file descriptor. +.It Bq Er ENOTTY +The file associated with +.Fa fd +is not a terminal. +.El +.Pp +Additionally, +.Fn ttyname_r +may fail if: +.Bl -tag -width Er .It Bq Er ERANGE The .Fa bufsize diff --git a/lib/libc/i386/gen/sigsetjmp.S b/lib/libc/i386/gen/sigsetjmp.S index 0920b6da995..1c636493c50 100644 --- a/lib/libc/i386/gen/sigsetjmp.S +++ b/lib/libc/i386/gen/sigsetjmp.S @@ -115,7 +115,6 @@ ENTRY(__siglongjmp) movl 12(%edx),%ebp movl 16(%edx),%esi movl 20(%edx),%edi - fninit fldcw 24(%edx) testl %eax,%eax jnz 1f diff --git a/lib/libc/ia64/Makefile.inc b/lib/libc/ia64/Makefile.inc deleted file mode 100644 index 16565c61029..00000000000 --- a/lib/libc/ia64/Makefile.inc +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD$ -# -# Machine dependent definitions for the ia64 architecture. -# - -# Long double is 80 bits -GDTOASRCS+=strtorx.c -MDSRCS+=machdep_ldisx.c -SYM_MAPS+=${LIBC_SRCTOP}/ia64/Symbol.map diff --git a/lib/libc/ia64/SYS.h b/lib/libc/ia64/SYS.h deleted file mode 100644 index eb019a26bc3..00000000000 --- a/lib/libc/ia64/SYS.h +++ /dev/null @@ -1,63 +0,0 @@ -/* $NetBSD: SYS.h,v 1.5 1997/05/02 18:15:15 kleink Exp $ */ - -/* - * Copyright (c) 1994, 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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. - * - * $FreeBSD$ - */ - -#include -#include - -#define CALLSYS_ERROR(name) \ - CALLSYS_NOERROR(name); \ - cmp.ne p6,p0=r0,r10; \ -(p6) br.cond.sptk.few .cerror - - -#define SYSCALL(name) \ -ENTRY(__sys_ ## name,0); /* XXX # of args? */ \ - WEAK_ALIAS(name, __sys_ ## name); \ - WEAK_ALIAS(_ ## name, __sys_ ## name); \ - CALLSYS_ERROR(name) - -#define SYSCALL_NOERROR(name) \ -ENTRY(__sys_ ## name,0); /* XXX # of args? */ \ - WEAK_ALIAS(name, __sys_ ## name); \ - WEAK_ALIAS(_ ## name, __sys_ ## name); \ - CALLSYS_NOERROR(name) - -#define RSYSCALL(name) \ - SYSCALL(name); \ - br.ret.sptk.few rp; \ -END(__sys_ ## name) - -#define PSEUDO(name) \ -ENTRY(__sys_ ## name,0); /* XXX # of args? */ \ - WEAK_ALIAS(_ ## name, __sys_ ## name); \ - CALLSYS_ERROR(name); \ - br.ret.sptk.few rp; \ -END(__sys_ ## name); diff --git a/lib/libc/ia64/Symbol.map b/lib/libc/ia64/Symbol.map deleted file mode 100644 index 7a31a512f5c..00000000000 --- a/lib/libc/ia64/Symbol.map +++ /dev/null @@ -1,71 +0,0 @@ -/* - * $FreeBSD$ - */ - -/* - * This only needs to contain symbols that are not listed in - * symbol maps from other parts of libc (i.e., not found in - * stdlib/Symbol.map, string/Symbol.map, sys/Symbol.map, ...). - */ -FBSD_1.0 { - /* PSEUDO syscalls */ - _exit; - - mcount; - _setjmp; - _longjmp; - fabs; - __flt_rounds; - fpgetmask; - fpgetround; - fpsetmask; - fpsetround; - __infinity; - __nan; - makecontext; - setjmp; - longjmp; - sigsetjmp; - siglongjmp; - htonl; - htons; - ntohl; - ntohs; - vfork; - brk; - exect; - sbrk; -}; - -FBSDprivate_1.0 { - /* PSEUDO syscalls */ - __sys_getlogin; - _getlogin; - __sys_exit; - - _set_tp; - __divdf3; - __divdi3; - __divsf3; - __divsi3; - __moddi3; - __modsi3; - __udivdi3; - __udivsi3; - __umoddi3; - __umodsi3; - _mcount; - ___longjmp; - __makecontext; - __longjmp; - signalcontext; - __signalcontext; - __siglongjmp; - _Unwind_FindTableEntry; - __sys_vfork; - _vfork; - _end; - minbrk; - .cerror; - curbrk; -}; diff --git a/lib/libc/ia64/_fpmath.h b/lib/libc/ia64/_fpmath.h deleted file mode 100644 index 936ce23b6ef..00000000000 --- a/lib/libc/ia64/_fpmath.h +++ /dev/null @@ -1,82 +0,0 @@ -/*- - * Copyright (c) 2003 Mike Barcroft - * Copyright (c) 2002, 2003 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$ - */ - -#include - -union IEEEl2bits { - long double e; - struct { -#if _BYTE_ORDER == _LITTLE_ENDIAN - unsigned int manl :32; - unsigned int manh :32; - unsigned int exp :15; - unsigned int sign :1; - unsigned long junk :48; -#else /* _BIG_ENDIAN */ - unsigned long junk :48; - unsigned int sign :1; - unsigned int exp :15; - unsigned int manh :32; - unsigned int manl :32; -#endif - } bits; - struct { -#if _BYTE_ORDER == _LITTLE_ENDIAN - unsigned long man :64; - unsigned int expsign :16; - unsigned long junk :48; -#else /* _BIG_ENDIAN */ - unsigned long junk :48; - unsigned int expsign :16; - unsigned long man :64; -#endif - } xbits; -}; - -#if _BYTE_ORDER == _LITTLE_ENDIAN -#define LDBL_NBIT 0x80000000 -#define mask_nbit_l(u) ((u).bits.manh &= ~LDBL_NBIT) -#else /* _BIG_ENDIAN */ -/* - * XXX This doesn't look right. Very few machines have a different - * endianness for integers and floating-point, and in nextafterl() - * we assume that none do. If you have an environment for testing - * this, please let me know. --das - */ -#define LDBL_NBIT 0x80 -#define mask_nbit_l(u) ((u).bits.manh &= ~LDBL_NBIT) -#endif - -#define LDBL_MANH_SIZE 32 -#define LDBL_MANL_SIZE 32 - -#define LDBL_TO_ARRAY32(u, a) do { \ - (a)[0] = (uint32_t)(u).bits.manl; \ - (a)[1] = (uint32_t)(u).bits.manh; \ -} while (0) diff --git a/lib/libc/ia64/arith.h b/lib/libc/ia64/arith.h deleted file mode 100644 index 67265284dbf..00000000000 --- a/lib/libc/ia64/arith.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * MD header for contrib/gdtoa - * - * $FreeBSD$ - */ - -/* - * NOTE: The definitions in this file must be correct or strtod(3) and - * floating point formats in printf(3) will break! The file can be - * generated by running contrib/gdtoa/arithchk.c on the target - * architecture. See contrib/gdtoa/gdtoaimp.h for details. - */ - -#include - -#if _BYTE_ORDER == _LITTLE_ENDIAN - -#define IEEE_8087 -#define Arith_Kind_ASL 1 -#define Long int -#define Intcast (int)(long) -#define Double_Align -#define X64_bit_pointers - -#else /* _BYTE_ORDER == _LITTLE_ENDIAN */ - -#define IEEE_MC68k -#define Arith_Kind_ASL 2 -#define Long int -#define Intcast (int)(long) -#define Double_Align -#define X64_bit_pointers -#ifdef gcc_bug /* XXX Why does arithchk report sudden underflow here? */ -#define Sudden_Underflow -#endif - -#endif diff --git a/lib/libc/ia64/gd_qnan.h b/lib/libc/ia64/gd_qnan.h deleted file mode 100644 index 39923860db0..00000000000 --- a/lib/libc/ia64/gd_qnan.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * MD header for contrib/gdtoa - * - * This file can be generated by compiling and running contrib/gdtoa/qnan.c - * on the target architecture after arith.h has been generated. - * - * $FreeBSD$ - */ - -#define f_QNAN 0x7fc00000 -#define d_QNAN0 0x0 -#define d_QNAN1 0x7ff80000 -#define ld_QNAN0 0x0 -#define ld_QNAN1 0xc0000000 -#define ld_QNAN2 0x7fff -#define ld_QNAN3 0x0 -#define ldus_QNAN0 0x0 -#define ldus_QNAN1 0x0 -#define ldus_QNAN2 0x0 -#define ldus_QNAN3 0xc000 -#define ldus_QNAN4 0x7fff diff --git a/lib/libc/ia64/gen/Makefile.inc b/lib/libc/ia64/gen/Makefile.inc deleted file mode 100644 index 1e3373a6d65..00000000000 --- a/lib/libc/ia64/gen/Makefile.inc +++ /dev/null @@ -1,11 +0,0 @@ -# $FreeBSD$ - -SRCS+= __divdf3.S __divdi3.S __divsf3.S __divsi3.S __moddi3.S __modsi3.S \ - __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S _mcount.S _set_tp.c \ - _setjmp.S fabs.S flt_rounds.c fpgetmask.c fpgetround.c fpsetmask.c \ - fpsetround.c getcontextx.c infinity.c ldexp.c makecontext.c setjmp.S \ - signalcontext.c sigsetjmp.S - -# The following may go away if function _Unwind_FindTableEntry() -# will be part of GCC. -SRCS+= unwind.c diff --git a/lib/libc/ia64/gen/__divdf3.S b/lib/libc/ia64/gen/__divdf3.S deleted file mode 100644 index 58425d92dba..00000000000 --- a/lib/libc/ia64/gen/__divdf3.S +++ /dev/null @@ -1,142 +0,0 @@ -// -// Copyright (c) 2000, Intel Corporation -// All rights reserved. -// -// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache, -// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab, -// Intel Corporation. -// -// WARRANTY DISCLAIMER -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 INTEL OR ITS -// 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. -// -// Intel Corporation is the author of this code, and requests that all -// problem reports or change requests be submitted to it directly at -// http://developer.intel.com/opensource. -// - -#include -__FBSDID("$FreeBSD$"); - - .section .text - -ENTRY(__divdf3, 0) -{ .mfi - // a is in f8 - // b is in f9 - - // predicate registers used: p6 - // floating-point registers used: f6, f7, f8, f9, f10, f11 - - // load a, the first argument, in f6 - nop.m 0 - mov f6=f8 - nop.i 0 -} { .mfi - // load b, the second argument, in f7 - nop.m 0 - mov f7=f9 - nop.i 0;; -} { .mfi - - // BEGIN DOUBLE PRECISION LATENCY-OPTIMIZED DIVIDE ALGORITHM - - nop.m 0 - // Step (1) - // y0 = 1 / b in f8 - frcpa.s0 f8,p6=f6,f7 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (2) - // q0 = a * y0 in f9 - (p6) fma.s1 f9=f6,f8,f0 - nop.i 0 -} { .mfi - nop.m 0 - // Step (3) - // e0 = 1 - b * y0 in f10 - (p6) fnma.s1 f10=f7,f8,f1 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (4) - // q1 = q0 + e0 * q0 in f9 - (p6) fma.s1 f9=f10,f9,f9 - nop.i 0 -} { .mfi - nop.m 0 - // Step (5) - // e1 = e0 * e0 in f11 - (p6) fma.s1 f11=f10,f10,f0 - nop.i 0 -} { .mfi - nop.m 0 - // Step (6) - // y1 = y0 + e0 * y0 in f8 - (p6) fma.s1 f8=f10,f8,f8 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (7) - // q2 = q1 + e1 * q1 in f9 - (p6) fma.s1 f9=f11,f9,f9 - nop.i 0 -} { .mfi - nop.m 0 - // Step (8) - // e2 = e1 * e1 in f10 - (p6) fma.s1 f10=f11,f11,f0 - nop.i 0 -} { .mfi - nop.m 0 - // Step (9) - // y2 = y1 + e1 * y1 in f8 - (p6) fma.s1 f8=f11,f8,f8 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (10) - // q3 = q2 + e2 * q2 in f9 - (p6) fma.d.s1 f9=f10,f9,f9 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (11) - // y3 = y2 + e2 * y2 in f8 - (p6) fma.s1 f8=f10,f8,f8 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (12) - // r0 = a - b * q3 in f6 - (p6) fnma.d.s1 f6=f7,f9,f6 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (13) - // q4 = q3 + r0 * y3 in f8 - (p6) fma.d.s0 f8=f6,f8,f9 - nop.i 0;; - - // END DOUBLE PRECISION LATENCY-OPTIMIZED DIVIDE ALGORITHM - -} { .mib - nop.m 0 - nop.i 0 - // return - br.ret.sptk b0;; -} - -END(__divdf3) - diff --git a/lib/libc/ia64/gen/__divdi3.S b/lib/libc/ia64/gen/__divdi3.S deleted file mode 100644 index 92e29116f6e..00000000000 --- a/lib/libc/ia64/gen/__divdi3.S +++ /dev/null @@ -1,143 +0,0 @@ -.file "__divdi3.s" - -// -// Copyright (c) 2000, Intel Corporation -// All rights reserved. -// -// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache, -// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab, -// Intel Corporation. -// -// WARRANTY DISCLAIMER -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 INTEL OR ITS -// 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. -// -// Intel Corporation is the author of this code, and requests that all -// problem reports or change requests be submitted to it directly at -// http://developer.intel.com/opensource. -// - -#include -__FBSDID("$FreeBSD$"); - -.section .text -.proc __divdi3# -.align 32 -.global __divdi3# -.align 32 - -// 64-bit signed integer divide - -__divdi3: - -{ .mii - alloc r31=ar.pfs,2,0,0,0 - nop.i 0 - nop.i 0;; -} { .mmi - - // 64-BIT SIGNED INTEGER DIVIDE BEGINS HERE - - setf.sig f8=r32 - setf.sig f9=r33 - nop.i 0;; -} { .mfb - nop.m 0 - fcvt.xf f6=f8 - nop.b 0 -} { .mfb - nop.m 0 - fcvt.xf f7=f9 - nop.b 0;; -} { .mfi - nop.m 0 - // Step (1) - // y0 = 1 / b in f8 - frcpa.s1 f8,p6=f6,f7 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (2) - // e0 = 1 - b * y0 in f9 - (p6) fnma.s1 f9=f7,f8,f1 - nop.i 0 -} { .mfi - nop.m 0 - // Step (3) - // q0 = a * y0 in f10 - (p6) fma.s1 f10=f6,f8,f0 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (4) - // e1 = e0 * e0 in f11 - (p6) fma.s1 f11=f9,f9,f0 - nop.i 0 -} { .mfi - nop.m 0 - // Step (5) - // q1 = q0 + e0 * q0 in f10 - (p6) fma.s1 f10=f9,f10,f10 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (6) - // y1 = y0 + e0 * y0 in f8 - (p6) fma.s1 f8=f9,f8,f8 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (7) - // q2 = q1 + e1 * q1 in f9 - (p6) fma.s1 f9=f11,f10,f10 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (8) - // y2 = y1 + e1 * y1 in f8 - (p6) fma.s1 f8=f11,f8,f8 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (9) - // r2 = a - b * q2 in f10 - (p6) fnma.s1 f10=f7,f9,f6 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (10) - // q3 = q2 + r2 * y2 in f8 - (p6) fma.s1 f8=f10,f8,f9 - nop.i 0;; -} { .mfb - nop.m 0 - // Step (11) - // q = trunc (q3) - fcvt.fx.trunc.s1 f8=f8 - nop.b 0;; -} { .mmi - // quotient will be in r8 (if b != 0) - getf.sig r8=f8 - nop.m 0 - nop.i 0;; -} - - // 64-BIT SIGNED INTEGER DIVIDE ENDS HERE - -{ .mmb - nop.m 0 - nop.m 0 - br.ret.sptk b0;; -} - -.endp __divdi3 diff --git a/lib/libc/ia64/gen/__divsf3.S b/lib/libc/ia64/gen/__divsf3.S deleted file mode 100644 index fe7bcb4d68e..00000000000 --- a/lib/libc/ia64/gen/__divsf3.S +++ /dev/null @@ -1,116 +0,0 @@ -// -// Copyright (c) 2000, Intel Corporation -// All rights reserved. -// -// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache, -// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab, -// Intel Corporation. -// -// WARRANTY DISCLAIMER -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 INTEL OR ITS -// 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. -// -// Intel Corporation is the author of this code, and requests that all -// problem reports or change requests be submitted to it directly at -// http://developer.intel.com/opensource. -// - -#include -__FBSDID("$FreeBSD$"); - -ENTRY(__divsf3, 0) -{ .mfi - // a is in f8 - // b is in f9 - - // general registers used: r31, r32, r33, r34 - // predicate registers used: p6 - // floating-point registers used: f6, f7, f8 - - nop.m 0 - // load a, the first argument, in f6 - mov f6=f8 - nop.i 0;; -} { .mfi - nop.m 0 - // load b, the second argument, in f7 - mov f7=f9 - nop.i 0;; -} { .mfi - - // BEGIN SINGLE PRECISION LATENCY-OPTIMIZED DIVIDE ALGORITHM - - nop.m 0 - // Step (1) - // y0 = 1 / b in f8 - frcpa.s0 f8,p6=f6,f7 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (2) - // q0 = a * y0 in f6 - (p6) fma.s1 f6=f6,f8,f0 - nop.i 0 -} { .mfi - nop.m 0 - // Step (3) - // e0 = 1 - b * y0 in f7 - (p6) fnma.s1 f7=f7,f8,f1 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (4) - // q1 = q0 + e0 * q0 in f6 - (p6) fma.s1 f6=f7,f6,f6 - nop.i 0 -} { .mfi - nop.m 0 - // Step (5) - // e1 = e0 * e0 in f7 - (p6) fma.s1 f7=f7,f7,f0 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (6) - // q2 = q1 + e1 * q1 in f6 - (p6) fma.s1 f6=f7,f6,f6 - nop.i 0 -} { .mfi - nop.m 0 - // Step (7) - // e2 = e1 * e1 in f7 - (p6) fma.s1 f7=f7,f7,f0 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (8) - // q3 = q2 + e2 * q2 in f6 - (p6) fma.d.s1 f6=f7,f6,f6 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (9) - // q3' = q3 in f8 - (p6) fma.s.s0 f8=f6,f1,f0 - nop.i 0;; - - // END SINGLE PRECISION LATENCY-OPTIMIZED DIVIDE ALGORITHM - -} { .mmb - nop.m 0 - nop.m 0 - // return - br.ret.sptk b0;; -} - -END(__divsf3) diff --git a/lib/libc/ia64/gen/__divsi3.S b/lib/libc/ia64/gen/__divsi3.S deleted file mode 100644 index 4c82e32ddcf..00000000000 --- a/lib/libc/ia64/gen/__divsi3.S +++ /dev/null @@ -1,125 +0,0 @@ -.file "__divsi3.s" - -// -// Copyright (c) 2000, Intel Corporation -// All rights reserved. -// -// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache, -// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab, -// Intel Corporation. -// -// WARRANTY DISCLAIMER -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 INTEL OR ITS -// 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. -// -// Intel Corporation is the author of this code, and requests that all -// problem reports or change requests be submitted to it directly at -// http://developer.intel.com/opensource. -// - -#include -__FBSDID("$FreeBSD$"); - -.section .text - -// 32-bit signed integer divide - -.proc __divsi3# -.align 32 -.global __divsi3# -.align 32 - -__divsi3: - -{ .mii - alloc r31=ar.pfs,2,0,0,0 - nop.i 0 - nop.i 0;; -} { .mii - nop.m 0 - - // 32-BIT SIGNED INTEGER DIVIDE BEGINS HERE - - // general register used: - // r32 - 32-bit signed integer dividend - // r33 - 32-bit signed integer divisor - // r8 - 32-bit signed integer result - // r2 - scratch register - // floating-point registers used: f6, f7, f8, f9 - // predicate registers used: p6 - - sxt4 r32=r32 - sxt4 r33=r33;; -} { .mmb - setf.sig f6=r32 - setf.sig f7=r33 - nop.b 0;; -} { .mfi - nop.m 0 - fcvt.xf f6=f6 - nop.i 0 -} { .mfi - nop.m 0 - fcvt.xf f7=f7 - mov r2 = 0x0ffdd;; -} { .mfi - setf.exp f9 = r2 - // (1) y0 - frcpa.s1 f8,p6=f6,f7 - nop.i 0;; -} { .mfi - nop.m 0 - // (2) q0 = a * y0 - (p6) fma.s1 f6=f6,f8,f0 - nop.i 0 -} { .mfi - nop.m 0 - // (3) e0 = 1 - b * y0 - (p6) fnma.s1 f7=f7,f8,f1 - nop.i 0;; -} { .mfi - nop.m 0 - // (4) q1 = q0 + e0 * q0 - (p6) fma.s1 f6=f7,f6,f6 - nop.i 0 -} { .mfi - nop.m 0 - // (5) e1 = e0 * e0 + 2^-34 - (p6) fma.s1 f7=f7,f7,f9 - nop.i 0;; -} { .mfi - nop.m 0 - // (6) q2 = q1 + e1 * q1 - (p6) fma.s1 f8=f7,f6,f6 - nop.i 0;; -} { .mfi - nop.m 0 - // (7) q = trunc(q2) - fcvt.fx.trunc.s1 f8=f8 - nop.i 0;; -} { .mmi - // quotient will be in the least significant 32 bits of r8 (if b != 0) - getf.sig r8=f8 - nop.m 0 - nop.i 0;; -} - - // 32-BIT SIGNED INTEGER DIVIDE ENDS HERE - -{ .mmb - nop.m 0 - nop.m 0 - br.ret.sptk b0;; -} - -.endp __divsi3 diff --git a/lib/libc/ia64/gen/__moddi3.S b/lib/libc/ia64/gen/__moddi3.S deleted file mode 100644 index e15f964c6ff..00000000000 --- a/lib/libc/ia64/gen/__moddi3.S +++ /dev/null @@ -1,160 +0,0 @@ -.file "__moddi3.s" - -// -// Copyright (c) 2000, Intel Corporation -// All rights reserved. -// -// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache, -// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab, -// Intel Corporation. -// -// WARRANTY DISCLAIMER -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 INTEL OR ITS -// 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. -// -// Intel Corporation is the author of this code, and requests that all -// problem reports or change requests be submitted to it directly at -// http://developer.intel.com/opensource. -// - -#include -__FBSDID("$FreeBSD$"); - -.section .text - -// 64-bit signed integer remainder - -.proc __moddi3# -.align 32 -.global __moddi3# -.align 32 - -__moddi3: - -{ .mii - alloc r31=ar.pfs,3,0,0,0 - nop.i 0 - nop.i 0 -} { .mmb - - // 64-BIT SIGNED INTEGER REMAINDER BEGINS HERE - - // general register used: - // r32 - 64-bit signed integer dividend - // r33 - 64-bit signed integer divisor - // r8 - 64-bit signed integer result - // r2 - scratch register - // floating-point registers used: f6, f7, f8, f9, f10, f11, f12 - // predicate registers used: p6 - - setf.sig f12=r32 // holds an in integer form - setf.sig f7=r33 - nop.b 0 -} { .mlx - nop.m 0 - //movl r2=0x8000000000000000;; - movl r2=0xffffffffffffffff;; -} { .mfi - // get the 2's complement of b - sub r33=r0,r33 - fcvt.xf f6=f12 - nop.i 0 -} { .mfi - nop.m 0 - fcvt.xf f7=f7 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (1) - // y0 = 1 / b in f8 - frcpa.s1 f8,p6=f6,f7 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (2) - // q0 = a * y0 in f10 - (p6) fma.s1 f10=f6,f8,f0 - nop.i 0 -} { .mfi - nop.m 0 - // Step (3) - // e0 = 1 - b * y0 in f9 - (p6) fnma.s1 f9=f7,f8,f1 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (4) - // q1 = q0 + e0 * q0 in f10 - (p6) fma.s1 f10=f9,f10,f10 - nop.i 0 -} { .mfi - nop.m 0 - // Step (5) - // e1 = e0 * e0 in f11 - (p6) fma.s1 f11=f9,f9,f0 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (6) - // y1 = y0 + e0 * y0 in f8 - (p6) fma.s1 f8=f9,f8,f8 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (7) - // q2 = q1 + e1 * q1 in f9 - (p6) fma.s1 f9=f11,f10,f10 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (8) - // y2 = y1 + e1 * y1 in f8 - (p6) fma.s1 f8=f11,f8,f8 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (9) - // r2 = a - b * q2 in f10 - (p6) fnma.s1 f10=f7,f9,f6 - nop.i 0;; -} { .mfi - setf.sig f7=r33 - // Step (10) - // q3 = q2 + r2 * y2 in f8 - (p6) fma.s1 f8=f10,f8,f9 - nop.i 0;; -} { .mfi - nop.m 0 - // (11) q = trunc(q3) - fcvt.fx.trunc.s1 f8=f8 - nop.i 0;; -} { .mfi - nop.m 0 - // (12) r = a + (-b) * q - xma.l f8=f8,f7,f12 - nop.i 0;; -} { .mib - getf.sig r8=f8 - nop.i 0 - nop.b 0 -} - - // 64-BIT SIGNED INTEGER REMAINDER ENDS HERE - -{ .mib - nop.m 0 - nop.i 0 - br.ret.sptk b0;; -} - -.endp __moddi3 diff --git a/lib/libc/ia64/gen/__modsi3.S b/lib/libc/ia64/gen/__modsi3.S deleted file mode 100644 index 1939493eff3..00000000000 --- a/lib/libc/ia64/gen/__modsi3.S +++ /dev/null @@ -1,132 +0,0 @@ -.file "__modsi3.s" - -// -// Copyright (c) 2000, Intel Corporation -// All rights reserved. -// -// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache, -// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab, -// Intel Corporation. -// -// WARRANTY DISCLAIMER -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 INTEL OR ITS -// 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. -// -// Intel Corporation is the author of this code, and requests that all -// problem reports or change requests be submitted to it directly at -// http://developer.intel.com/opensource. -// - -#include -__FBSDID("$FreeBSD$"); - -.section .text - -// 32-bit signed integer remainder - -.proc __modsi3# -.align 32 -.global __modsi3# -.align 32 - -__modsi3: - -{ .mii - alloc r31=ar.pfs,2,0,0,0 - nop.i 0 - nop.i 0;; -} { .mii - nop.m 0 - - // 32-BIT SIGNED INTEGER REMAINDER BEGINS HERE - - // general register used: - // r32 - 32-bit signed integer dividend - // r33 - 32-bit signed integer divisor - // r8 - 32-bit signed integer result - // r2 - scratch register - // floating-point registers used: f6, f7, f8, f9, f10, f11 - // predicate registers used: p6 - - sxt4 r32=r32 - sxt4 r33=r33;; -} { .mmb - setf.sig f11=r32 - setf.sig f7=r33 - nop.b 0;; -} { .mfi - // get 2's complement of b - sub r33=r0,r33 - fcvt.xf f6=f11 - nop.i 0 -} { .mfi - nop.m 0 - fcvt.xf f7=f7 - mov r2 = 0x0ffdd;; -} { .mfi - setf.exp f9 = r2 - // (1) y0 - frcpa.s1 f8,p6=f6,f7 - nop.i 0;; -} { .mfi - nop.m 0 - // (2) q0 = a * y0 - (p6) fma.s1 f10=f6,f8,f0 - nop.i 0 -} { .mfi - nop.m 0 - // (3) e0 = 1 - b * y0 - (p6) fnma.s1 f8=f7,f8,f1 - nop.i 0;; -} { .mfi - // 2's complement of b - setf.sig f7=r33 - // (4) q1 = q0 + e0 * q0 - (p6) fma.s1 f10=f8,f10,f10 - nop.i 0 -} { .mfi - nop.m 0 - // (5) e1 = e0 * e0 + 2^-34 - (p6) fma.s1 f8=f8,f8,f9 - nop.i 0;; -} { .mfi - nop.m 0 - // (6) q2 = q1 + e1 * q1 - (p6) fma.s1 f8=f8,f10,f10 - nop.i 0;; -} { .mfi - nop.m 0 - // (7) q = trunc(q2) - fcvt.fx.trunc.s1 f8=f8 - nop.i 0;; -} { .mfi - nop.m 0 - // (8) r = a + (-b) * q - xma.l f8=f8,f7,f11 - nop.i 0;; -} { .mmi - // remainder will be in the least significant 32 bits of r8 (if b != 0) - getf.sig r8=f8 - nop.m 0 - nop.i 0;; -} - - // 32-BIT SIGNED INTEGER REMAINDER ENDS HERE - -{ .mmb - nop.m 0 - nop.m 0 - br.ret.sptk b0;; -} - -.endp __modsi3 diff --git a/lib/libc/ia64/gen/__udivdi3.S b/lib/libc/ia64/gen/__udivdi3.S deleted file mode 100644 index 1233e8aa410..00000000000 --- a/lib/libc/ia64/gen/__udivdi3.S +++ /dev/null @@ -1,144 +0,0 @@ -.file "__udivdi3.s" - -// -// Copyright (c) 2000, Intel Corporation -// All rights reserved. -// -// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache, -// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab, -// Intel Corporation. -// -// WARRANTY DISCLAIMER -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 INTEL OR ITS -// 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. -// -// Intel Corporation is the author of this code, and requests that all -// problem reports or change requests be submitted to it directly at -// http://developer.intel.com/opensource. -// - -#include -__FBSDID("$FreeBSD$"); - -.section .text -.proc __udivdi3# -.align 32 -.global __udivdi3# -.align 32 - -// 64-bit unsigned integer divide - -__udivdi3: - -{ .mii - alloc r31=ar.pfs,2,0,0,0 - nop.i 0 - nop.i 0;; -} - -{ .mmi - - // 64-BIT UNSIGNED INTEGER DIVIDE BEGINS HERE - - setf.sig f8=r32 - setf.sig f9=r33 - nop.i 0;; -} { .mfb - nop.m 0 - fma.s1 f6=f8,f1,f0 - nop.b 0 -} { .mfb - nop.m 0 - fma.s1 f7=f9,f1,f0 - nop.b 0;; -} { .mfi - nop.m 0 - // Step (1) - // y0 = 1 / b in f8 - frcpa.s1 f8,p6=f6,f7 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (2) - // e0 = 1 - b * y0 in f9 - (p6) fnma.s1 f9=f7,f8,f1 - nop.i 0 -} { .mfi - nop.m 0 - // Step (3) - // q0 = a * y0 in f10 - (p6) fma.s1 f10=f6,f8,f0 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (4) - // e1 = e0 * e0 in f11 - (p6) fma.s1 f11=f9,f9,f0 - nop.i 0 -} { .mfi - nop.m 0 - // Step (5) - // q1 = q0 + e0 * q0 in f10 - (p6) fma.s1 f10=f9,f10,f10 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (6) - // y1 = y0 + e0 * y0 in f8 - (p6) fma.s1 f8=f9,f8,f8 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (7) - // q2 = q1 + e1 * q1 in f9 - (p6) fma.s1 f9=f11,f10,f10 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (8) - // y2 = y1 + e1 * y1 in f8 - (p6) fma.s1 f8=f11,f8,f8 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (9) - // r2 = a - b * q2 in f10 - (p6) fnma.s1 f10=f7,f9,f6 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (10) - // q3 = q2 + r2 * y2 in f8 - (p6) fma.s1 f8=f10,f8,f9 - nop.i 0;; -} { .mfb - nop.m 0 - // (11) q = trunc(q3) - fcvt.fxu.trunc.s1 f8=f8 - nop.b 0;; -} { .mmi - // quotient will be in r8 (if b != 0) - getf.sig r8=f8 - nop.m 0 - nop.i 0;; -} - - // 64-BIT UNSIGNED INTEGER DIVIDE ENDS HERE - -{ .mmb - nop.m 0 - nop.m 0 - br.ret.sptk b0;; -} - -.endp __udivdi3 diff --git a/lib/libc/ia64/gen/__udivsi3.S b/lib/libc/ia64/gen/__udivsi3.S deleted file mode 100644 index 25959b88a92..00000000000 --- a/lib/libc/ia64/gen/__udivsi3.S +++ /dev/null @@ -1,125 +0,0 @@ -.file "__udivsi3.s" - -// -// Copyright (c) 2000, Intel Corporation -// All rights reserved. -// -// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache, -// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab, -// Intel Corporation. -// -// WARRANTY DISCLAIMER -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 INTEL OR ITS -// 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. -// -// Intel Corporation is the author of this code, and requests that all -// problem reports or change requests be submitted to it directly at -// http://developer.intel.com/opensource. -// - -#include -__FBSDID("$FreeBSD$"); - -.section .text - -// 32-bit unsigned integer divide - -.proc __udivsi3# -.align 32 -.global __udivsi3# -.align 32 - -__udivsi3: - -{ .mii - alloc r31=ar.pfs,2,0,0,0 - nop.i 0 - nop.i 0;; -} { .mii - nop.m 0 - - // 32-BIT UNSIGNED INTEGER DIVIDE BEGINS HERE - - // general register used: - // r32 - 32-bit unsigned integer dividend - // r33 - 32-bit unsigned integer divisor - // r8 - 32-bit unsigned integer result - // r2 - scratch register - // floating-point registers used: f6, f7, f8, f9 - // predicate registers used: p6 - - zxt4 r32=r32 - zxt4 r33=r33;; -} { .mmb - setf.sig f6=r32 - setf.sig f7=r33 - nop.b 0;; -} { .mfi - nop.m 0 - fcvt.xf f6=f6 - nop.i 0 -} { .mfi - nop.m 0 - fcvt.xf f7=f7 - mov r2 = 0x0ffdd;; -} { .mfi - setf.exp f9 = r2 - // (1) y0 - frcpa.s1 f8,p6=f6,f7 - nop.i 0;; -} { .mfi - nop.m 0 - // (2) q0 = a * y0 - (p6) fma.s1 f6=f6,f8,f0 - nop.i 0 -} { .mfi - nop.m 0 - // (3) e0 = 1 - b * y0 - (p6) fnma.s1 f7=f7,f8,f1 - nop.i 0;; -} { .mfi - nop.m 0 - // (4) q1 = q0 + e0 * q0 - (p6) fma.s1 f6=f7,f6,f6 - nop.i 0 -} { .mfi - nop.m 0 - // (5) e1 = e0 * e0 + 2^-34 - (p6) fma.s1 f7=f7,f7,f9 - nop.i 0;; -} { .mfi - nop.m 0 - // (6) q2 = q1 + e1 * q1 - (p6) fma.s1 f8=f7,f6,f6 - nop.i 0;; -} { .mfi - nop.m 0 - // (7) q = trunc(q2) - fcvt.fxu.trunc.s1 f8=f8 - nop.i 0;; -} { .mmi - // quotient will be in the least significant 32 bits of r8 (if b != 0) - getf.sig r8=f8 - nop.m 0 - nop.i 0;; -} - - // 32-BIT UNSIGNED INTEGER DIVIDE ENDS HERE - -{ .mmb - nop.m 0 - nop.m 0 - br.ret.sptk b0;; -} - -.endp __udivsi3 diff --git a/lib/libc/ia64/gen/__umoddi3.S b/lib/libc/ia64/gen/__umoddi3.S deleted file mode 100644 index 509c62bb687..00000000000 --- a/lib/libc/ia64/gen/__umoddi3.S +++ /dev/null @@ -1,156 +0,0 @@ -.file "__umoddi3.s" - -// -// Copyright (c) 2000, Intel Corporation -// All rights reserved. -// -// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache, -// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab, -// Intel Corporation. -// -// WARRANTY DISCLAIMER -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 INTEL OR ITS -// 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. -// -// Intel Corporation is the author of this code, and requests that all -// problem reports or change requests be submitted to it directly at -// http://developer.intel.com/opensource. -// - -#include -__FBSDID("$FreeBSD$"); - -.section .text - - // 64-bit unsigned integer remainder - -.proc __umoddi3# -.align 32 -.global __umoddi3# -.align 32 - -__umoddi3: - -{ .mii - alloc r31=ar.pfs,3,0,0,0 - nop.i 0 - nop.i 0 -} { .mmb - - // 64-BIT UNSIGNED INTEGER REMAINDER BEGINS HERE - - // general register used: - // r32 - 64-bit unsigned integer dividend - // r33 - 64-bit unsigned integer divisor - // r8 - 64-bit unsigned integer result - // floating-point registers used: f6, f7, f8, f9, f10, f11, f12 - // predicate registers used: p6 - - setf.sig f12=r32 // holds an in integer form - setf.sig f7=r33 - nop.b 0;; -} { .mfi - // get 2's complement of b - sub r33=r0,r33 - fcvt.xuf.s1 f6=f12 - nop.i 0 -} { .mfi - nop.m 0 - fcvt.xuf.s1 f7=f7 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (1) - // y0 = 1 / b in f8 - frcpa.s1 f8,p6=f6,f7 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (2) - // q0 = a * y0 in f10 - (p6) fma.s1 f10=f6,f8,f0 - nop.i 0 -} { .mfi - nop.m 0 - // Step (3) - // e0 = 1 - b * y0 in f9 - (p6) fnma.s1 f9=f7,f8,f1 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (4) - // q1 = q0 + e0 * q0 in f10 - (p6) fma.s1 f10=f9,f10,f10 - nop.i 0 -} { .mfi - nop.m 0 - // Step (5) - // e1 = e0 * e0 in f11 - (p6) fma.s1 f11=f9,f9,f0 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (6) - // y1 = y0 + e0 * y0 in f8 - (p6) fma.s1 f8=f9,f8,f8 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (7) - // q2 = q1 + e1 * q1 in f9 - (p6) fma.s1 f9=f11,f10,f10 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (8) - // y2 = y1 + e1 * y1 in f8 - (p6) fma.s1 f8=f11,f8,f8 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (9) - // r2 = a - b * q2 in f10 - (p6) fnma.s1 f10=f7,f9,f6 - nop.i 0;; -} { .mfi - // f7=-b - setf.sig f7=r33 - // Step (10) - // q3 = q2 + r2 * y2 in f8 - (p6) fma.s1 f8=f10,f8,f9 - nop.i 0;; -} { .mfi - nop.m 0 - // (11) q = trunc(q3) - fcvt.fxu.trunc.s1 f8=f8 - nop.i 0;; -} { .mfi - nop.m 0 - // (12) r = a + (-b) * q - xma.l f8=f8,f7,f12 - nop.i 0;; -} { .mib - getf.sig r8=f8 - nop.i 0 - nop.b 0 -} - - // 64-BIT UNSIGNED INTEGER REMAINDER ENDS HERE - -{ .mib - nop.m 0 - nop.i 0 - br.ret.sptk b0;; -} - -.endp __umoddi3 diff --git a/lib/libc/ia64/gen/__umodsi3.S b/lib/libc/ia64/gen/__umodsi3.S deleted file mode 100644 index 697db2e5d8c..00000000000 --- a/lib/libc/ia64/gen/__umodsi3.S +++ /dev/null @@ -1,132 +0,0 @@ -.file "__umodsi3.s" - -// -// Copyright (c) 2000, Intel Corporation -// All rights reserved. -// -// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache, -// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab, -// Intel Corporation. -// -// WARRANTY DISCLAIMER -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 INTEL OR ITS -// 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. -// -// Intel Corporation is the author of this code, and requests that all -// problem reports or change requests be submitted to it directly at -// http://developer.intel.com/opensource. -// - -#include -__FBSDID("$FreeBSD$"); - -.section .text - -// 32-bit unsigned integer remainder - -.proc __umodsi3# -.align 32 -.global __umodsi3# -.align 32 - -__umodsi3: - -{ .mii - alloc r31=ar.pfs,2,0,0,0 - nop.i 0 - nop.i 0;; -} { .mii - nop.m 0 - - // 32-BIT UNSIGNED INTEGER REMAINDER BEGINS HERE - - // general register used: - // r32 - 32-bit unsigned integer dividend - // r33 - 32-bit unsigned integer divisor - // r8 - 32-bit unsigned integer result - // r2 - scratch register - // floating-point registers used: f6, f7, f8, f9, f10, f11 - // predicate registers used: p6 - - zxt4 r32=r32 - zxt4 r33=r33;; -} { .mmb - setf.sig f11=r32 - setf.sig f7=r33 - nop.b 0;; -} { .mfi - nop.m 0 - fcvt.xf f6=f11 - nop.i 0 -} { .mfi - // get 2's complement of b - sub r33=r0,r33 - fcvt.xf f7=f7 - mov r2 = 0x0ffdd;; -} { .mfi - setf.exp f9 = r2 - // (1) y0 - frcpa.s1 f8,p6=f6,f7 - nop.i 0;; -} { .mfi - nop.m 0 - // (2) q0 = a * y0 - (p6) fma.s1 f10=f6,f8,f0 - nop.i 0 -} { .mfi - nop.m 0 - // (3) e0 = 1 - b * y0 - (p6) fnma.s1 f8=f7,f8,f1 - nop.i 0;; -} { .mfi - nop.m 0 - // (4) q1 = q0 + e0 * q0 - (p6) fma.s1 f10=f8,f10,f10 - nop.i 0 -} { .mfi - // get 2's complement of b - setf.sig f7=r33 - // (5) e1 = e0 * e0 + 2^-34 - (p6) fma.s1 f8=f8,f8,f9 - nop.i 0;; -} { .mfi - nop.m 0 - // (6) q2 = q1 + e1 * q1 - (p6) fma.s1 f8=f8,f10,f10 - nop.i 0;; -} { .mfi - nop.m 0 - // (7) q = trunc(q2) - fcvt.fxu.trunc.s1 f8=f8 - nop.i 0;; -} { .mfi - nop.m 0 - // (8) r = a + (-b) * q - xma.l f8=f8,f7,f11 - nop.i 0;; -} { .mmi - // remainder will be in the least significant 32 bits of r8 (if b != 0) - getf.sig r8=f8 - nop.m 0 - nop.i 0;; -} - - // 32-BIT UNSIGNED INTEGER REMAINDER ENDS HERE - -{ .mmb - nop.m 0 - nop.m 0 - br.ret.sptk b0;; -} - -.endp __umodsi3 diff --git a/lib/libc/ia64/gen/_mcount.S b/lib/libc/ia64/gen/_mcount.S deleted file mode 100644 index d9e9b76845d..00000000000 --- a/lib/libc/ia64/gen/_mcount.S +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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 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$"); - - .text - -/* - * Important registers: - * r8 structure return address - * r15 static link (nested routines) - * rp our return address - * in0 caller's ar.pfs - * in1 caller's gp - * in2 caller's rp - * in3 GOT entry - * ar.pfs our pfs - */ -ENTRY_NOPROFILE(_mcount, 4) - alloc loc0 = ar.pfs, 4, 4, 2, 0 - mov loc1 = r8 - mov loc2 = rp - mov loc3 = r15 - ;; - mov out0 = in2 - mov out1 = rp - br.call.sptk rp = __mcount - ;; -1: - mov gp = in1 - mov r14 = ip - mov b7 = loc2 - ;; - add r14 = 2f - 1b, r14 - mov ar.pfs = loc0 - mov rp = in2 - ;; - mov r15 = loc3 - mov b7 = r14 - mov b6 = loc2 - mov r8 = loc1 - mov r14 = in0 - br.ret.sptk b7 - ;; -2: - mov ar.pfs = r14 - br.sptk b6 - ;; -END(_mcount) - -WEAK_ALIAS(mcount, _mcount) diff --git a/lib/libc/ia64/gen/_setjmp.S b/lib/libc/ia64/gen/_setjmp.S deleted file mode 100644 index 3966e836475..00000000000 --- a/lib/libc/ia64/gen/_setjmp.S +++ /dev/null @@ -1,310 +0,0 @@ -// -// Copyright (c) 1999, 2000 -// Intel Corporation. -// 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 Intel Corporation and -// its contributors. -// -// 4. Neither the name of Intel Corporation or its contributors may be -// used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION 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 INTEL CORPORATION 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. -// -// - -// -// Module Name: -// -// setjmp.s -// -// Abstract: -// -// Contains an implementation of setjmp and longjmp for the -// IA-64 architecture. - - .file "setjmp.s" - -#include -__FBSDID("$FreeBSD$"); - -#define LOCORE -#include - -// int _setjmp(struct jmp_buffer *) -// -// Setup a non-local goto. -// -// Description: -// -// SetJump stores the current register set in the area pointed to -// by "save". It returns zero. Subsequent calls to "LongJump" will -// restore the registers and return non-zero to the same location. -// -// On entry, r32 contains the pointer to the jmp_buffer -// - -ENTRY(_setjmp, 1) - add r10 = J_PREDS, r32 // skip Unats & pfs save area - add r11 = J_BSP, r32 - // - // save immediate context - // - mov r2 = ar.bsp // save backing store pointer - mov r3 = pr // save predicates - flushrs - ;; - // - // save user Unat register - // - mov r16 = ar.lc // save loop count register - mov r14 = ar.unat // save user Unat register - - st8 [r10] = r3, J_LC-J_PREDS - st8 [r11] = r2, J_R4-J_BSP - ;; - st8 [r10] = r16, J_R5-J_LC - st8 [r32] = r14, J_NATS // Note: Unat at the - // beginning of the save area - mov r15 = ar.pfs - ;; - // - // save preserved general registers & NaT's - // - .mem.offset 0,0 - st8.spill [r11] = r4, J_R6-J_R4 - .mem.offset 8,0 - st8.spill [r10] = r5, J_R7-J_R5 - ;; - .mem.offset 16,0 - st8.spill [r11] = r6, J_SP-J_R6 - .mem.offset 24,0 - st8.spill [r10] = r7, J_F3-J_R7 - ;; - st8.spill [r11] = sp, J_F2-J_SP - mov r16 = ar.rsc - ;; - // - // save spilled Unat and pfs registers - // - mov r2 = ar.unat // save Unat register after spill - mov ar.rsc = r0 - ;; - st8 [r32] = r2, J_PFS-J_NATS // save unat for spilled regs - mov r17 = ar.rnat - ;; - st8 [r32] = r15, J_RNAT-J_PFS // save pfs - mov ar.rsc = r16 - // - // save floating registers - // - stf.spill [r11] = f2, J_F4-J_F2 - stf.spill [r10] = f3, J_F5-J_F3 - ;; - stf.spill [r11] = f4, J_F16-J_F4 - stf.spill [r10] = f5, J_F17-J_F5 - ;; - stf.spill [r11] = f16, J_F18-J_F16 - stf.spill [r10] = f17, J_F19-J_F17 - ;; - stf.spill [r11] = f18, J_F20-J_F18 - stf.spill [r10] = f19, J_F21-J_F19 - ;; - stf.spill [r11] = f20, J_F22-J_F20 - stf.spill [r10] = f21, J_F23-J_F21 - ;; - stf.spill [r11] = f22, J_F24-J_F22 - stf.spill [r10] = f23, J_F25-J_F23 - ;; - stf.spill [r11] = f24, J_F26-J_F24 - stf.spill [r10] = f25, J_F27-J_F25 - ;; - stf.spill [r11] = f26, J_F28-J_F26 - stf.spill [r10] = f27, J_F29-J_F27 - ;; - stf.spill [r11] = f28, J_F30-J_F28 - stf.spill [r10] = f29, J_F31-J_F29 - ;; - stf.spill [r11] = f30, J_FPSR-J_F30 - stf.spill [r10] = f31, J_B0-J_F31 // size of f31 + fpsr - ;; - st8 [r32] = r17 - // - // save FPSR register & branch registers - // - mov r2 = ar.fpsr // save fpsr register - mov r3 = b0 - ;; - st8 [r11] = r2, J_B1-J_FPSR - st8 [r10] = r3, J_B2-J_B0 - mov r2 = b1 - mov r3 = b2 - ;; - st8 [r11] = r2, J_B3-J_B1 - st8 [r10] = r3, J_B4-J_B2 - mov r2 = b3 - mov r3 = b4 - ;; - st8 [r11] = r2, J_B5-J_B3 - st8 [r10] = r3 - mov r2 = b5 - ;; - st8 [r11] = r2 - ;; - // - // return - // - mov r8 = r0 // return 0 from setjmp - mov ar.unat = r14 // restore unat - br.ret.sptk b0 - -END(_setjmp) - - -// -// void _longjmp(struct jmp_buffer *, int val) -// -// Perform a non-local goto. -// -// Description: -// -// LongJump initializes the register set to the values saved by a -// previous 'SetJump' and jumps to the return location saved by that -// 'SetJump'. This has the effect of unwinding the stack and returning -// for a second time to the 'SetJump'. -// - - WEAK_ALIAS(_longjmp,___longjmp) -ENTRY(___longjmp, 2) - mov r14 = ar.rsc // get user RSC conf - mov r8 = r33 // return value - add r10 = J_PFS, r32 // get address of pfs - ;; - mov ar.rsc = r0 - add r11 = J_NATS, r32 - add r17 = J_RNAT, r32 - ;; - ld8 r15 = [r10], J_BSP-J_PFS // get pfs - ld8 r2 = [r11], J_LC-J_NATS // get unat for spilled regs - mov r31 = r32 - ;; - loadrs - mov ar.unat = r2 - cmp.eq p6,p0=0,r8 // Return value 0? - ;; - ld8 r16 = [r10], J_PREDS-J_BSP // get backing store pointer - ld8 r17 = [r17] // ar.rnat - mov ar.pfs = r15 - ;; - mov ar.bspstore = r16 -(p6) add r8 = 1, r0 - ;; - mov ar.rnat = r17 - mov ar.rsc = r14 // restore RSC conf - - ld8 r3 = [r11], J_R4-J_LC // get lc register - ld8 r2 = [r10], J_R5-J_PREDS // get predicates - ;; - mov pr = r2, -1 - mov ar.lc = r3 - // - // restore preserved general registers & NaT's - // - ld8.fill r4 = [r11], J_R6-J_R4 - ;; - ld8.fill r5 = [r10], J_R7-J_R5 - ld8.fill r6 = [r11], J_SP-J_R6 - ;; - ld8.fill r7 = [r10], J_F2-J_R7 - ld8.fill sp = [r11], J_F3-J_SP - ;; - // - // restore floating registers - // - ldf.fill f2 = [r10], J_F4-J_F2 - ldf.fill f3 = [r11], J_F5-J_F3 - ;; - ldf.fill f4 = [r10], J_F16-J_F4 - ldf.fill f5 = [r11], J_F17-J_F5 - ;; - ldf.fill f16 = [r10], J_F18-J_F16 - ldf.fill f17 = [r11], J_F19-J_F17 - ;; - ldf.fill f18 = [r10], J_F20-J_F18 - ldf.fill f19 = [r11], J_F21-J_F19 - ;; - ldf.fill f20 = [r10], J_F22-J_F20 - ldf.fill f21 = [r11], J_F23-J_F21 - ;; - ldf.fill f22 = [r10], J_F24-J_F22 - ldf.fill f23 = [r11], J_F25-J_F23 - ;; - ldf.fill f24 = [r10], J_F26-J_F24 - ldf.fill f25 = [r11], J_F27-J_F25 - ;; - ldf.fill f26 = [r10], J_F28-J_F26 - ldf.fill f27 = [r11], J_F29-J_F27 - ;; - ldf.fill f28 = [r10], J_F30-J_F28 - ldf.fill f29 = [r11], J_F31-J_F29 - ;; - ldf.fill f30 = [r10], J_FPSR-J_F30 - ldf.fill f31 = [r11], J_B0-J_F31 ;; - - // - // restore branch registers and fpsr - // - ld8 r16 = [r10], J_B1-J_FPSR // get fpsr - ld8 r17 = [r11], J_B2-J_B0 // get return pointer - ;; - mov ar.fpsr = r16 - mov b0 = r17 - ld8 r2 = [r10], J_B3-J_B1 - ld8 r3 = [r11], J_B4-J_B2 - ;; - mov b1 = r2 - mov b2 = r3 - ld8 r2 = [r10], J_B5-J_B3 - ld8 r3 = [r11] - ;; - mov b3 = r2 - mov b4 = r3 - ld8 r2 = [r10] - ld8 r21 = [r31] // get user unat - ;; - mov b5 = r2 - mov ar.unat = r21 - - // - // invalidate ALAT - // - invala ;; - - br.ret.sptk b0 - -END(___longjmp) diff --git a/lib/libc/ia64/gen/fabs.S b/lib/libc/ia64/gen/fabs.S deleted file mode 100644 index 036d4920132..00000000000 --- a/lib/libc/ia64/gen/fabs.S +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * Copyright (c) 2000 Doug Rabson - * 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$"); - -ENTRY(fabs, 1) - fabs fret0=farg0 - br.ret.sptk.few rp -END(fabs) diff --git a/lib/libc/ia64/gen/flt_rounds.c b/lib/libc/ia64/gen/flt_rounds.c deleted file mode 100644 index d65096545ab..00000000000 --- a/lib/libc/ia64/gen/flt_rounds.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Written by J.T. Conklin, Apr 10, 1995 - * Public domain. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include - -static const int map[] = { - 1, /* round to nearest */ - 3, /* round to zero */ - 2, /* round to negative infinity */ - 0 /* round to positive infinity */ -}; - -int -__flt_rounds(void) -{ - int x; - - __asm("mov %0=ar.fpsr" : "=r" (x)); - return (map[(x >> 10) & 0x03]); -} diff --git a/lib/libc/ia64/gen/fpsetround.c b/lib/libc/ia64/gen/fpsetround.c deleted file mode 100644 index db2eef1e49c..00000000000 --- a/lib/libc/ia64/gen/fpsetround.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2003 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. - * - * $FreeBSD$ - */ - -#include -#include - -fp_rnd_t -fpsetround(fp_rnd_t rnd) -{ - uint64_t fpsr; - fp_rnd_t prev; - - __asm __volatile("mov %0=ar.fpsr" : "=r"(fpsr)); - prev = (fp_rnd_t)((fpsr >> 10) & 3); - fpsr = (fpsr & ~0xC00ULL) | ((unsigned int)rnd << 10); - __asm __volatile("mov ar.fpsr=%0" :: "r"(fpsr)); - return (prev); -} diff --git a/lib/libc/ia64/gen/getcontextx.c b/lib/libc/ia64/gen/getcontextx.c deleted file mode 100644 index 54f85138481..00000000000 --- a/lib/libc/ia64/gen/getcontextx.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2011 Konstantin Belousov - * 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 -#include -#include -#include - -int -__getcontextx_size(void) -{ - - return (sizeof(ucontext_t)); -} - -int -__fillcontextx2(char *ctx) -{ - - return (0); -} - -int -__fillcontextx(char *ctx) -{ - ucontext_t *ucp; - - ucp = (ucontext_t *)ctx; - return (getcontext(ucp)); -} - -__weak_reference(__getcontextx, getcontextx); - -ucontext_t * -__getcontextx(void) -{ - char *ctx; - int error; - - ctx = malloc(__getcontextx_size()); - if (ctx == NULL) - return (NULL); - if (__fillcontextx(ctx) == -1) { - error = errno; - free(ctx); - errno = error; - return (NULL); - } - return ((ucontext_t *)ctx); -} diff --git a/lib/libc/ia64/gen/infinity.c b/lib/libc/ia64/gen/infinity.c deleted file mode 100644 index 1ae92a804d5..00000000000 --- a/lib/libc/ia64/gen/infinity.c +++ /dev/null @@ -1,48 +0,0 @@ -/* $NetBSD: infinity.c,v 1.1 1995/02/10 17:50:23 cgd Exp $ */ - -/* - * Copyright (c) 1994, 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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 - -/* bytes for +Infinity on an ia64 (IEEE double format) */ -#if _BYTE_ORDER == _LITTLE_ENDIAN -const union __infinity_un __infinity = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } }; -#else /* _BIG_ENDIAN */ -const union __infinity_un __infinity = { { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } }; -#endif - -/* bytes for NaN */ -#if _BYTE_ORDER == _LITTLE_ENDIAN -const union __nan_un __nan = { { 0, 0, 0xc0, 0xff } }; -#else /* _BIG_ENDIAN */ -const union __nan_un __nan = { { 0xff, 0xc0, 0, 0 } }; -#endif diff --git a/lib/libc/ia64/gen/makecontext.c b/lib/libc/ia64/gen/makecontext.c deleted file mode 100644 index bee47f11ce5..00000000000 --- a/lib/libc/ia64/gen/makecontext.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2003 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 -#include -#include -#include -#include -#include -#include - -struct fdesc { - uint64_t ip; - uint64_t gp; -}; - -typedef void (*func_t)(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t, - uint64_t, uint64_t, uint64_t); - -static __inline uint64_t * -spill(uint64_t *bsp, uint64_t arg) -{ - *bsp++ = arg; - if (((intptr_t)bsp & 0x1ff) == 0x1f8) - *bsp++ = 0; - return (bsp); -} - -static void -ctx_wrapper(ucontext_t *ucp, func_t func, uint64_t *args) -{ - - (*func)(args[0], args[1], args[2], args[3], args[4], args[5], args[6], - args[7]); - if (ucp->uc_link == NULL) - exit(0); - setcontext((const ucontext_t *)ucp->uc_link); - /* should never get here */ - abort(); - /* NOTREACHED */ -} - -__weak_reference(__makecontext, makecontext); - -void -__makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...) -{ - uint64_t *args, *bsp; - va_list ap; - int i; - - /* - * Drop the ball completely if something's not right. We only - * support general registers as arguments and not more than 8 - * of them. Things get hairy if we need to support FP registers - * (alignment issues) or more than 8 arguments (stack based). - */ - if (argc < 0 || argc > 8 || ucp == NULL || - ucp->uc_stack.ss_sp == NULL || (ucp->uc_stack.ss_size & 15) || - ((intptr_t)ucp->uc_stack.ss_sp & 15) || - ucp->uc_stack.ss_size < MINSIGSTKSZ) - abort(); - - /* - * Copy the arguments of function 'func' onto the (memory) stack. - * Always take up space for 8 arguments. - */ - va_start(ap, argc); - args = (uint64_t*)(ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size) - 8; - i = 0; - while (i < argc) - args[i++] = va_arg(ap, uint64_t); - while (i < 8) - args[i++] = 0; - va_end(ap); - - /* - * Push (spill) the arguments of the context wrapper onto the register - * stack. They get loaded by the RSE on a context switch. - */ - bsp = (uint64_t*)ucp->uc_stack.ss_sp; - bsp = spill(bsp, (intptr_t)ucp); - bsp = spill(bsp, (intptr_t)func); - bsp = spill(bsp, (intptr_t)args); - - /* - * Setup the MD portion of the context. - */ - memset(&ucp->uc_mcontext, 0, sizeof(ucp->uc_mcontext)); - ucp->uc_mcontext.mc_special.sp = (intptr_t)args - 16; - ucp->uc_mcontext.mc_special.bspstore = (intptr_t)bsp; - ucp->uc_mcontext.mc_special.pfs = (3 << 7) | 3; - ucp->uc_mcontext.mc_special.rsc = 0xf; - ucp->uc_mcontext.mc_special.rp = ((struct fdesc*)ctx_wrapper)->ip; - ucp->uc_mcontext.mc_special.gp = ((struct fdesc*)ctx_wrapper)->gp; - ucp->uc_mcontext.mc_special.fpsr = IA64_FPSR_DEFAULT; -} diff --git a/lib/libc/ia64/gen/setjmp.S b/lib/libc/ia64/gen/setjmp.S deleted file mode 100644 index a2b56d6af9f..00000000000 --- a/lib/libc/ia64/gen/setjmp.S +++ /dev/null @@ -1,82 +0,0 @@ -/* $NetBSD: setjmp.S,v 1.3 1997/12/05 02:06:27 thorpej Exp $ */ - -/* - * Copyright (c) 1994, 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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$"); - -#define LOCORE -#include - -/* - * C library -- setjmp, longjmp - * - * longjmp(a,v) - * will generate a "return(v)" from - * the last call to - * setjmp(a) - * by restoring registers from the stack, - * and the previous signal state. - */ - -ENTRY(setjmp, 1) - alloc loc0=ar.pfs,1,2,3,0 - mov loc1=rp - ;; - mov out0=1 // how = SIG_BLOCK - mov out1=0 // set = NULL - add out2=J_SIGSET,in0 // oset = &jb[J_SIGSET] - br.call.sptk.few rp=__sys_sigprocmask - ;; - mov rp=loc1 - mov r14=loc0 - ;; - alloc r15=ar.pfs,1,0,0,0 // drop register frame - ;; - mov ar.pfs=r14 // restore ar.pfs - br.sptk.many _setjmp // finish saving state -END(setjmp) - - WEAK_ALIAS(longjmp,__longjmp) -ENTRY(__longjmp, 2) - alloc loc0=ar.pfs,2,2,3,0 - mov loc1=rp - ;; - mov out0=3 // how = SIG_SETMASK - add out1=J_SIGSET,in0 // set = &jb[J_SIGSET] - mov out2=0 // oset = NULL - br.call.sptk.few rp=__sys_sigprocmask - ;; - mov rp=loc1 - mov r14=loc0 - ;; - alloc r15=ar.pfs,2,0,0,0 // drop register frame - ;; - mov ar.pfs=r14 // restore ar.pfs - br.sptk.many _longjmp // finish restoring state -END(__longjmp) diff --git a/lib/libc/ia64/gen/signalcontext.c b/lib/libc/ia64/gen/signalcontext.c deleted file mode 100644 index b47daf37d9e..00000000000 --- a/lib/libc/ia64/gen/signalcontext.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2003 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 -#include -#include -#include -#include -#include -#include -#include - -struct fdesc { - uint64_t ip; - uint64_t gp; -}; - -typedef void (*handler_t)(uint64_t, uint64_t, uint64_t); - -static __inline uint64_t * -spill(uint64_t *bsp, uint64_t arg) -{ - *bsp++ = arg; - if (((intptr_t)bsp & 0x1ff) == 0x1f8) - *bsp++ = 0; - return (bsp); -} - -static void -ctx_wrapper(ucontext_t *ucp, handler_t func, uint64_t *args) -{ - - (*func)(args[0], args[1], args[2]); - if (ucp->uc_link == NULL) - exit(0); - setcontext((const ucontext_t *)ucp->uc_link); - /* should never get here */ - abort(); - /* NOTREACHED */ -} - -__weak_reference(__signalcontext, signalcontext); - -int -__signalcontext(ucontext_t *ucp, int sig, __sighandler_t *func) -{ - uint64_t *args, *bsp; - siginfo_t *sig_si; - ucontext_t *sig_uc; - uint64_t sp; - - /* Bail out if we don't have a valid ucontext pointer. */ - if (ucp == NULL) - abort(); - - /* - * Build a signal frame and copy the arguments of signal handler - * 'func' onto the (memory) stack. We only need 3 arguments, but - * we create room for 4 so that we are 16-byte aligned. - */ - sp = (ucp->uc_mcontext.mc_special.sp - sizeof(ucontext_t)) & ~15UL; - sig_uc = (ucontext_t*)sp; - bcopy(ucp, sig_uc, sizeof(*sig_uc)); - sp = (sp - sizeof(siginfo_t)) & ~15UL; - sig_si = (siginfo_t*)sp; - bzero(sig_si, sizeof(*sig_si)); - sig_si->si_signo = sig; - sp -= 4 * sizeof(uint64_t); - args = (uint64_t*)sp; - args[0] = sig; - args[1] = (intptr_t)sig_si; - args[2] = (intptr_t)sig_uc; - - /* - * Push (spill) the arguments of the context wrapper onto the register - * stack. They get loaded by the RSE on a context switch. - */ - bsp = (uint64_t*)ucp->uc_mcontext.mc_special.bspstore; - bsp = spill(bsp, (intptr_t)ucp); - bsp = spill(bsp, (intptr_t)func); - bsp = spill(bsp, (intptr_t)args); - - /* - * Setup the ucontext of the signal handler. - */ - memset(&ucp->uc_mcontext, 0, sizeof(ucp->uc_mcontext)); - ucp->uc_link = sig_uc; - sigdelset(&ucp->uc_sigmask, sig); - ucp->uc_mcontext.mc_special.sp = (intptr_t)args - 16; - ucp->uc_mcontext.mc_special.bspstore = (intptr_t)bsp; - ucp->uc_mcontext.mc_special.pfs = (3 << 7) | 3; - ucp->uc_mcontext.mc_special.rsc = 0xf; - ucp->uc_mcontext.mc_special.rp = ((struct fdesc*)ctx_wrapper)->ip; - ucp->uc_mcontext.mc_special.gp = ((struct fdesc*)ctx_wrapper)->gp; - ucp->uc_mcontext.mc_special.fpsr = IA64_FPSR_DEFAULT; - return (0); -} diff --git a/lib/libc/ia64/gen/sigsetjmp.S b/lib/libc/ia64/gen/sigsetjmp.S deleted file mode 100644 index 9f02a26a5a7..00000000000 --- a/lib/libc/ia64/gen/sigsetjmp.S +++ /dev/null @@ -1,66 +0,0 @@ -/* $NetBSD: sigsetjmp.S,v 1.2 1996/10/17 03:08:07 cgd Exp $ */ - -/* - * Copyright (c) 1994, 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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$"); - -#define LOCORE -#include - -/* - * C library -- sigsetjmp, siglongjmp - * - * siglongjmp(a,v) - * will generate a "return(v)" from - * the last call to - * sigsetjmp(a, mask) - * by restoring registers from the stack. - * If `mask' is non-zero, the previous signal - * state will be restored. - */ - -ENTRY(sigsetjmp, 2) - add r14=J_SIGMASK,in0 // place to save mask - cmp.ne p6,p7=0,in1 // save signal state? - ;; - st8 [r14]=in1 // save mask value -(p6) br.cond.dptk.many setjmp -(p7) br.cond.dpnt.many _setjmp -END(sigsetjmp) - - WEAK_ALIAS(siglongjmp,__siglongjmp) -ENTRY(__siglongjmp, 2) - add r14=J_SIGMASK,in0 // address of mask value - ;; - ld8 r14=[r14] - ;; - cmp.ne p6,p7=0,r14 // did we save signals? -(p6) br.cond.dptk.many longjmp -(p7) br.cond.dpnt.many _longjmp -END(__siglongjmp) diff --git a/lib/libc/ia64/gen/unwind.c b/lib/libc/ia64/gen/unwind.c deleted file mode 100644 index 7afd0eff496..00000000000 --- a/lib/libc/ia64/gen/unwind.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * 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. - * - * $FreeBSD$ - */ - -#include - -#include -#include -#include - -#include - -#ifndef PT_IA_64_UNWIND -#define PT_IA_64_UNWIND 0x70000001 -#endif - -#define SANITY 0 - -struct ia64_unwind_entry -{ - Elf64_Addr start; - Elf64_Addr end; - Elf64_Addr descr; -}; - -struct ia64_unwind_entry * -_Unwind_FindTableEntry(const void *pc, unsigned long *pseg, unsigned long *pgp) -{ - Dl_info info; - Elf_Dyn *dyn; - Elf_Ehdr *ehdr; - Elf_Phdr *phdr; - char *p, *p_top; - struct ia64_unwind_entry *unw, *res; - register unsigned long gp __asm__("gp"); /* XXX assumes gcc */ - unsigned long reloc, vaddr; - size_t l, m, r; - - if (!dladdr(pc, &info)) - return NULL; - - ehdr = (Elf_Ehdr*)info.dli_fbase; - -#if SANITY - assert(IS_ELF(*ehdr)); - assert(ehdr->e_ident[EI_CLASS] == ELFCLASS64); - assert(ehdr->e_ident[EI_DATA] == ELFDATA2LSB); - assert(ehdr->e_machine == EM_IA_64); -#endif - - reloc = (ehdr->e_type == ET_DYN) ? (uintptr_t)info.dli_fbase : 0; - *pgp = gp; - *pseg = 0UL; - res = NULL; - - p = (char*)info.dli_fbase + ehdr->e_phoff; - p_top = p + ehdr->e_phnum * ehdr->e_phentsize; - while (p < p_top) { - phdr = (Elf_Phdr*)p; - vaddr = phdr->p_vaddr + reloc; - - switch (phdr->p_type) { - case PT_DYNAMIC: - dyn = (Elf_Dyn*)vaddr; - while (dyn->d_tag != DT_NULL) { - if (dyn->d_tag == DT_PLTGOT) { - *pgp = dyn->d_un.d_ptr + reloc; - break; - } - dyn++; - } - break; - case PT_LOAD: - if (pc >= (void*)vaddr && - pc < (void*)(vaddr + phdr->p_memsz)) - *pseg = vaddr; - break; - case PT_IA_64_UNWIND: -#if SANITY - assert(*pseg != 0UL); - assert(res == NULL); -#endif - unw = (struct ia64_unwind_entry*)vaddr; - l = 0; - r = phdr->p_memsz / sizeof(struct ia64_unwind_entry); - while (l < r) { - m = (l + r) >> 1; - res = unw + m; - if (pc < (void*)(res->start + *pseg)) - r = m; - else if (pc >= (void*)(res->end + *pseg)) - l = m + 1; - else - break; /* found */ - } - if (l >= r) - res = NULL; - break; - } - - p += ehdr->e_phentsize; - } - - return res; -} diff --git a/lib/libc/ia64/string/Makefile.inc b/lib/libc/ia64/string/Makefile.inc deleted file mode 100644 index 7bbcc8de10e..00000000000 --- a/lib/libc/ia64/string/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD$ - -MDSRCS+= bcopy.S bzero.S ffs.S memcpy.S memmove.S diff --git a/lib/libc/ia64/string/bcopy.S b/lib/libc/ia64/string/bcopy.S deleted file mode 100644 index 34aac1984cf..00000000000 --- a/lib/libc/ia64/string/bcopy.S +++ /dev/null @@ -1,95 +0,0 @@ -/*- - * Copyright (c) 2000 Doug Rabson - * 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$"); - -/* - * Not the fastest bcopy in the world. - */ -ENTRY(bcopy, 3) - - cmp.le p6,p0=in2,r0 // bail if len <= 0 -(p6) br.ret.spnt.few rp - - sub r14=in1,in0 ;; // check for overlap - cmp.ltu p6,p0=r14,in2 // dst-src < len -(p6) br.cond.spnt.few 5f - - extr.u r14=in0,0,3 // src & 7 - extr.u r15=in1,0,3 ;; // dst & 7 - cmp.eq p6,p0=r14,r15 // different alignment? -(p6) br.cond.spnt.few 2f // branch if same alignment - -1: ld1 r14=[in0],1 ;; // copy bytewise - st1 [in1]=r14,1 - add in2=-1,in2 ;; // len-- - cmp.ne p6,p0=r0,in2 -(p6) br.cond.dptk.few 1b // loop - br.ret.sptk.few rp // done - -2: cmp.eq p6,p0=r14,r0 // aligned? -(p6) br.cond.sptk.few 4f - -3: ld1 r14=[in0],1 ;; // copy bytewise - st1 [in1]=r14,1 - extr.u r15=in0,0,3 // src & 7 - add in2=-1,in2 ;; // len-- - cmp.eq p6,p0=r0,in2 // done? - cmp.eq p7,p0=r0,r15 ;; // aligned now? -(p6) br.ret.spnt.few rp // return if done -(p7) br.cond.spnt.few 4f // go to main copy - br.cond.sptk.few 3b // more bytes to copy - - // At this point, in2 is non-zero - -4: mov r14=8 ;; - cmp.ltu p6,p0=in2,r14 ;; // len < 8? -(p6) br.cond.spnt.few 1b // byte copy the end - ld8 r15=[in0],8 ;; // copy word - st8 [in1]=r15,8 - add in2=-8,in2 ;; // len -= 8 - cmp.ne p6,p0=r0,in2 // done? -(p6) br.cond.spnt.few 4b // again - - br.ret.sptk.few rp // return - - // Don't bother optimising overlap case - -5: add in0=in0,in2 - add in1=in1,in2 ;; - add in0=-1,in0 - add in1=-1,in1 ;; - -6: ld1 r14=[in0],-1 ;; - st1 [in1]=r14,-1 - add in2=-1,in2 ;; - cmp.ne p6,p0=r0,in2 -(p6) br.cond.spnt.few 6b - - br.ret.sptk.few rp - -END(bcopy) diff --git a/lib/libc/ia64/string/bzero.S b/lib/libc/ia64/string/bzero.S deleted file mode 100644 index 0963c36aac8..00000000000 --- a/lib/libc/ia64/string/bzero.S +++ /dev/null @@ -1,81 +0,0 @@ -/*- - * Copyright (c) 2000 Doug Rabson - * 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$"); - -ENTRY(bzero, 2) - - cmp.le p6,p0=in1,r0 // bail if len <= 0 -(p6) br.ret.spnt.few rp - ;; - mov r14=ar.lc // save ar.lc - - cmp.ltu p6,p0=17,in1 // check for small -(p6) br.dptk.few 3f - -1: add r15=-1,in1 ;; - mov ar.lc=r15 ;; -2: st1 [in0]=r0,1 // zero one byte - br.cloop.sptk.few 2b // loop - - ;; - mov ar.lc=r14 // done - br.ret.sptk.few rp - - // Zero up to 8byte alignment - -3: tbit.nz p6,p0=in0,0 ;; -(p6) st1 [in0]=r0,1 -(p6) add in1=-1,in1 ;; - - tbit.nz p6,p0=in0,1 ;; -(p6) st2 [in0]=r0,2 -(p6) add in1=-2,in1 ;; - - tbit.nz p6,p0=in0,2 ;; -(p6) st4 [in0]=r0,4 -(p6) add in1=-4,in1 - - ;; - shr.u r15=in1,3 // word count - extr.u in1=in1,0,3 ;; // trailing bytes - cmp.eq p6,p0=r15,r0 // check for zero - cmp.ne p7,p0=in1,r0 -(p6) br.dpnt.few 1b // zero last bytes - - add r15=-1,r15 ;; - mov ar.lc=r15 ;; -4: st8 [in0]=r0,8 - br.cloop.sptk.few 4b - -(p7) br.dpnt.few 1b // zero last bytes - - ;; - mov ar.lc=r14 // done - br.ret.sptk.few rp - -END(bzero) diff --git a/lib/libc/ia64/string/ffs.S b/lib/libc/ia64/string/ffs.S deleted file mode 100644 index d99d7658134..00000000000 --- a/lib/libc/ia64/string/ffs.S +++ /dev/null @@ -1,99 +0,0 @@ -/* $NetBSD: ffs.S,v 1.3 1996/10/17 03:08:13 cgd Exp $ */ - -/* - * Copyright (c) 1995 Christopher G. Demetriou - * 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 Christopher G. Demetriou - * for the NetBSD Project. - * 4. The name of the author may not 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 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$"); - -ENTRY(ffs, 1) - sxt4 r14=in0 ;; - cmp.eq p6,p0=r14,r0 -(p6) br.dpnt.few Lallzero - - /* - * Initialize return value (ret0), and set up r15 so that it - * contains the mask with only the lowest bit set. - */ - sub r15=r0,r14 - mov ret0=1 ;; - and r15=r14,r15 ;; - - extr.u r16=r15,0,8 ;; - cmp.ne p6,p0=r0,r16 -(p6) br.dptk.few Ldo8 - - /* - * If lower 16 bits empty, add 16 to result and use upper 16. - */ - extr.u r16=r15,0,16 ;; - cmp.ne p6,p0=r0,r16 -(p6) br.dptk.few Ldo16 - extr.u r15=r15,16,16 - add ret0=16,ret0 ;; - -Ldo16: - /* - * If lower 8 bits empty, add 8 to result and use upper 8. - */ - extr.u r16=r15,0,8 ;; - cmp.ne p6,p0=r0,r16 -(p6) br.dptk.few Ldo8 - extr.u r15=r15,8,24 - add ret0=8,ret0 ;; - -Ldo8: - and r16=0x0f,r15 /* lower 4 of 8 empty? */ - and r17=0x33,r15 /* lower 2 of each 4 empty? */ - and r18=0x55,r15 ;; /* lower 1 of each 2 empty? */ - cmp.ne p6,p0=r16,r0 - cmp.ne p7,p0=r17,r0 - cmp.ne p8,p0=r18,r0 - - /* If lower 4 bits empty, add 4 to result. */ -(p6) br.dptk.few Ldo4 - add ret0=4,ret0 ;; - -Ldo4: /* If lower 2 bits of each 4 empty, add 2 to result. */ -(p7) br.dptk.few Ldo2 - add ret0=2,ret0 ;; - -Ldo2: /* If lower bit of each 2 empty, add 1 to result. */ -(p8) br.dptk.few Ldone - add ret0=1,ret0 - -Ldone: - br.ret.sptk.few rp - -Lallzero: - mov ret0=0 - br.ret.sptk.few rp -END(ffs) diff --git a/lib/libc/ia64/string/memcpy.S b/lib/libc/ia64/string/memcpy.S deleted file mode 100644 index d7557c1f039..00000000000 --- a/lib/libc/ia64/string/memcpy.S +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * Copyright (c) 2000 Doug Rabson - * 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$"); - -ENTRY(memcpy,3) - mov r8 = in0 - mov in0 = in1 - ;; - mov in1 = r8 - br.sptk.few bcopy -END(memcpy) diff --git a/lib/libc/ia64/string/memmove.S b/lib/libc/ia64/string/memmove.S deleted file mode 100644 index 19fa8affc39..00000000000 --- a/lib/libc/ia64/string/memmove.S +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * Copyright (c) 2000 Doug Rabson - * 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$"); - -ENTRY(memmove,3) - mov r8 = in0 - mov in0 = in1 - ;; - mov in1 = r8 - br.sptk.few bcopy -END(memmove) diff --git a/lib/libc/ia64/sys/Makefile.inc b/lib/libc/ia64/sys/Makefile.inc deleted file mode 100644 index b3bacd4cd65..00000000000 --- a/lib/libc/ia64/sys/Makefile.inc +++ /dev/null @@ -1,14 +0,0 @@ -# $FreeBSD$ - -SRCS+= __vdso_gettc.c - -MDASM+= Ovfork.S brk.S cerror.S exect.S fork.S getcontext.S pipe.S ptrace.S \ - sbrk.S setlogin.S sigreturn.S swapcontext.S - -# Don't generate default code for these syscalls: -NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o - -PSEUDO= _getlogin.o _exit.o -.if ${MK_SYSCALL_COMPAT} != "no" -PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o -.endif diff --git a/lib/libc/ia64/sys/__vdso_gettc.c b/lib/libc/ia64/sys/__vdso_gettc.c deleted file mode 100644 index b99bbc4f3d0..00000000000 --- a/lib/libc/ia64/sys/__vdso_gettc.c +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * Copyright (c) 2013 Konstantin Belousov - * - * 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 - -#pragma weak __vdso_gettc -u_int -__vdso_gettc(const struct vdso_timehands *th) -{ - - return (0); -} - -#pragma weak __vdso_gettimekeep -int -__vdso_gettimekeep(struct vdso_timekeep **tk) -{ - - return (ENOSYS); -} diff --git a/lib/libc/ia64/sys/brk.S b/lib/libc/ia64/sys/brk.S deleted file mode 100644 index fee1728bc0d..00000000000 --- a/lib/libc/ia64/sys/brk.S +++ /dev/null @@ -1,57 +0,0 @@ -/* $NetBSD: brk.S,v 1.4 1996/10/17 03:08:15 cgd Exp $ */ - -/* - * Copyright (c) 1994, 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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 "SYS.h" - - .globl _end -IMPORT(curbrk, 8) - - .data -EXPORT(minbrk) - .quad _end - - .text -ENTRY(brk, 1) - add r14=@ltoff(minbrk),gp ;; - ld8 r14=[r14] ;; - ld8 r14=[r14] ;; - cmp.ltu p6,p0=r32,r14 ;; -(p6) mov r32=r14 ;; - st8 [sp]=r32 - CALLSYS_ERROR(break) - ld8 r15=[sp] - add r14=@ltoff(curbrk),gp ;; - ld8 r14=[r14] ;; - st8 [r14]=r15 - mov ret0=0 - br.ret.sptk.few rp -END(brk) diff --git a/lib/libc/ia64/sys/cerror.S b/lib/libc/ia64/sys/cerror.S deleted file mode 100644 index ca0b0c735b1..00000000000 --- a/lib/libc/ia64/sys/cerror.S +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * Copyright (c) 2000 Doug Rabson - * 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$"); - - -ENTRY(.cerror, 0) - alloc loc0=ar.pfs,0,3,1,0 - ;; - mov loc1=rp - mov loc2=ret0 - mov out0=ret0 - ;; - br.call.sptk.few rp=__error - st4 [ret0]=loc2 - ;; - mov ret0=-1 - mov ar.pfs=loc0 - mov rp=loc1 - ;; - br.ret.sptk.few rp -END(.cerror) diff --git a/lib/libc/ia64/sys/exect.S b/lib/libc/ia64/sys/exect.S deleted file mode 100644 index 817d3b1b384..00000000000 --- a/lib/libc/ia64/sys/exect.S +++ /dev/null @@ -1,38 +0,0 @@ -/* $NetBSD: exect.S,v 1.2 1996/10/17 03:08:18 cgd Exp $ */ - -/* - * Copyright (c) 1994, 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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 "SYS.h" - -ENTRY(exect, 3) - CALLSYS_ERROR(execve) - br.ret.sptk.few rp -END(exect) diff --git a/lib/libc/ia64/sys/fork.S b/lib/libc/ia64/sys/fork.S deleted file mode 100644 index 5b09f771182..00000000000 --- a/lib/libc/ia64/sys/fork.S +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * Copyright (c) 2000 Doug Rabson - * 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 "SYS.h" - -SYSCALL(fork) - cmp.ne p7,p0=ret1,r0 /* ret1!=0 for child */ - ;; -(p7) mov ret0=r0 - br.ret.sptk.few rp -END(__sys_fork) diff --git a/lib/libc/ia64/sys/getcontext.S b/lib/libc/ia64/sys/getcontext.S deleted file mode 100644 index 0ec6f92e4f8..00000000000 --- a/lib/libc/ia64/sys/getcontext.S +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2003 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 "SYS.h" - -ENTRY(__sys_getcontext,2) - WEAK_ALIAS(getcontext, __sys_getcontext) - WEAK_ALIAS(_getcontext, __sys_getcontext) - flushrs - ;; - CALLSYS_ERROR(getcontext) - br.ret.sptk.few rp -END(__sys_getcontext) diff --git a/lib/libc/ia64/sys/pipe.S b/lib/libc/ia64/sys/pipe.S deleted file mode 100644 index a6413dfd464..00000000000 --- a/lib/libc/ia64/sys/pipe.S +++ /dev/null @@ -1,47 +0,0 @@ -/* $NetBSD: pipe.S,v 1.1 1995/02/10 17:50:35 cgd Exp $ */ - -/* - * Copyright (c) 1994, 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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 "SYS.h" - -ENTRY(__sys_pipe, 1) - WEAK_ALIAS(pipe, __sys_pipe) - WEAK_ALIAS(_pipe, __sys_pipe) - st8 [sp]=r32 - CALLSYS_ERROR(pipe) - ld8 r14=[sp] - ;; - st4 [r14]=ret0,4 - ;; - st4 [r14]=ret1 - mov ret0=0 - br.ret.sptk.few rp -END(__sys_pipe) diff --git a/lib/libc/ia64/sys/ptrace.S b/lib/libc/ia64/sys/ptrace.S deleted file mode 100644 index b6d3abdedda..00000000000 --- a/lib/libc/ia64/sys/ptrace.S +++ /dev/null @@ -1,41 +0,0 @@ -/* $NetBSD: ptrace.S,v 1.4 1996/11/08 00:51:24 cgd Exp $ */ - -/* - * Copyright (c) 1994, 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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 "SYS.h" - -ENTRY(ptrace, 4) - add r14=@ltoff(errno),gp ;; - ld8 r14=[r14] ;; - st4 [r14]=r0 - CALLSYS_ERROR(ptrace) - br.ret.sptk.few rp -END(ptrace) diff --git a/lib/libc/ia64/sys/sbrk.S b/lib/libc/ia64/sys/sbrk.S deleted file mode 100644 index 98b5ce92c21..00000000000 --- a/lib/libc/ia64/sys/sbrk.S +++ /dev/null @@ -1,63 +0,0 @@ -/* $NetBSD: sbrk.S,v 1.4 1996/10/17 03:08:20 cgd Exp $ */ - -/* - * Copyright (c) 1994, 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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 "SYS.h" - - .globl _end - - .data -EXPORT(curbrk) - .quad _end - - .text -ENTRY(sbrk, 1) - add r14 = @ltoff(curbrk), gp - ;; - ld8 r14 = [r14] - cmp.eq p6, p0 = r32, r0 - ;; - ld8 ret0 = [r14] -(p6) br.ret.sptk.few rp - ;; - add r32 = ret0, r32 - ;; - st8 [sp] = r32 - CALLSYS_ERROR(break) - ld8 r15 = [sp] - add r14 = @ltoff(curbrk), gp - ;; - ld8 r14 = [r14] - ;; - ld8 ret0 = [r14] - st8 [r14] = r15 - br.ret.sptk.few rp -END(sbrk) diff --git a/lib/libc/ia64/sys/setlogin.S b/lib/libc/ia64/sys/setlogin.S deleted file mode 100644 index 1d29a40664a..00000000000 --- a/lib/libc/ia64/sys/setlogin.S +++ /dev/null @@ -1,42 +0,0 @@ -/* $NetBSD: setlogin.S,v 1.1 1995/02/10 17:50:39 cgd Exp $ */ - -/* - * Copyright (c) 1994, 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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 "SYS.h" - -IMPORT(_logname_valid, 4) /* in getlogin() */ - -SYSCALL(setlogin) - add r14=@ltoff(_logname_valid),gp ;; - ld8 r14=[r14] ;; - st4 [r14]=r0 /* clear it */ - br.ret.sptk.few rp -END(__sys_setlogin) diff --git a/lib/libc/ia64/sys/sigreturn.S b/lib/libc/ia64/sys/sigreturn.S deleted file mode 100644 index 2c7a710a146..00000000000 --- a/lib/libc/ia64/sys/sigreturn.S +++ /dev/null @@ -1,41 +0,0 @@ -/* $NetBSD: sigreturn.S,v 1.1 1995/02/10 17:50:42 cgd Exp $ */ - -/* - * Copyright (c) 1994, 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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 "SYS.h" - -/* - * We must preserve the state of the registers as the user has set them up. - * However, that doesn't involve any special work on the ia64. - * (XXX PROFILING) - */ - -RSYSCALL(sigreturn) diff --git a/lib/libc/ia64/sys/swapcontext.S b/lib/libc/ia64/sys/swapcontext.S deleted file mode 100644 index 210189f6ff4..00000000000 --- a/lib/libc/ia64/sys/swapcontext.S +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2003 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 "SYS.h" - -ENTRY(__sys_swapcontext,2) - WEAK_ALIAS(swapcontext, __sys_swapcontext) - WEAK_ALIAS(_swapcontext, __sys_swapcontext) - flushrs - ;; - CALLSYS_ERROR(swapcontext) - br.ret.sptk.few rp -END(__sys_swapcontext) diff --git a/lib/libc/iconv/__iconv_get_list.3 b/lib/libc/iconv/__iconv_get_list.3 index 4db88d8faa6..076f4d5b6a1 100644 --- a/lib/libc/iconv/__iconv_get_list.3 +++ b/lib/libc/iconv/__iconv_get_list.3 @@ -92,4 +92,4 @@ The iconv implementation of the Citrus Project was adopted in .Fx 9.0 . .Sh AUTHORS This manual page was written by -.An Gabor Kovesdan Aq gabor@FreeBSD.org . +.An Gabor Kovesdan Aq Mt gabor@FreeBSD.org . diff --git a/lib/libc/iconv/bsd_iconv.c b/lib/libc/iconv/bsd_iconv.c index 40a1a4e8890..f764886d785 100644 --- a/lib/libc/iconv/bsd_iconv.c +++ b/lib/libc/iconv/bsd_iconv.c @@ -83,6 +83,7 @@ __bsd___iconv_open(const char *out, const char *in, struct _citrus_iconv *handle } handle->cv_shared->ci_discard_ilseq = strcasestr(out, "//IGNORE"); + handle->cv_shared->ci_ilseq_invalid = false; handle->cv_shared->ci_hooks = NULL; return ((iconv_t)(void *)handle); @@ -223,7 +224,7 @@ __bsd_iconvlist(int (*do_one) (unsigned int, const char * const *, return; } strlcpy(curkey, list[i], slashpos - list[i] + 1); - names[j++] = strdup(curkey); + names[j++] = curkey; for (; (i < sz) && (memcmp(curkey, list[i], strlen(curkey)) == 0); i++) { slashpos = strchr(list[i], '/'); curitem = (char *)malloc(strlen(slashpos) + 1); @@ -235,7 +236,7 @@ __bsd_iconvlist(int (*do_one) (unsigned int, const char * const *, if (strcmp(curkey, curitem) == 0) { continue; } - names[j++] = strdup(curitem); + names[j++] = curitem; } np = (const char * const *)names; do_one(j, np, data); diff --git a/lib/libc/iconv/citrus_db_factory.c b/lib/libc/iconv/citrus_db_factory.c index e9823ab0439..691fe4e8435 100644 --- a/lib/libc/iconv/citrus_db_factory.c +++ b/lib/libc/iconv/citrus_db_factory.c @@ -270,11 +270,9 @@ _citrus_db_factory_serialize(struct _citrus_db_factory *df, const char *magic, return (0); } /* allocate hash table */ - depp = malloc(sizeof(*depp) * df->df_num_entries); + depp = calloc(df->df_num_entries, sizeof(*depp)); if (depp == NULL) return (-1); - for (i = 0; i < df->df_num_entries; i++) - depp[i] = NULL; /* step1: store the entries which are not conflicting */ STAILQ_FOREACH(de, &df->df_entries, de_entry) { diff --git a/lib/libc/iconv/citrus_iconv.c b/lib/libc/iconv/citrus_iconv.c index df2ed73ffc7..5c8bf492366 100644 --- a/lib/libc/iconv/citrus_iconv.c +++ b/lib/libc/iconv/citrus_iconv.c @@ -344,9 +344,8 @@ const char { char *buf; - if ((buf = malloc((size_t)PATH_MAX)) == NULL) + if ((buf = calloc((size_t)PATH_MAX, sizeof(*buf))) == NULL) return (NULL); - memset((void *)buf, 0, (size_t)PATH_MAX); _citrus_esdb_alias(name, buf, (size_t)PATH_MAX); return (buf); } diff --git a/lib/libc/iconv/iconv_canonicalize.3 b/lib/libc/iconv/iconv_canonicalize.3 index a5d3e771662..d98235aabbf 100644 --- a/lib/libc/iconv/iconv_canonicalize.3 +++ b/lib/libc/iconv/iconv_canonicalize.3 @@ -71,4 +71,4 @@ the GNU implementation and was adopted in for compatibility's sake. .Sh AUTHORS This manual page was written by -.An Gabor Kovesdan Aq gabor@FreeBSD.org . +.An Gabor Kovesdan Aq Mt gabor@FreeBSD.org . diff --git a/lib/libc/iconv/iconvctl.3 b/lib/libc/iconv/iconvctl.3 index 5728ad3ee5e..d6bc67f9b98 100644 --- a/lib/libc/iconv/iconvctl.3 +++ b/lib/libc/iconv/iconvctl.3 @@ -179,7 +179,7 @@ the GNU implementation and was adopted in for compatibility's sake. .Sh AUTHORS This manual page was written by -.An Gabor Kovesdan Aq gabor@FreeBSD.org . +.An Gabor Kovesdan Aq Mt gabor@FreeBSD.org . .Sh BUGS Transliteration is enabled in this implementation by default, so it is impossible by design to turn it off. diff --git a/lib/libc/iconv/iconvlist.3 b/lib/libc/iconv/iconvlist.3 index ff9ea6b3f0f..bef609b3136 100644 --- a/lib/libc/iconv/iconvlist.3 +++ b/lib/libc/iconv/iconvlist.3 @@ -90,4 +90,4 @@ the GNU implementation and was adopted in for compatibility's sake. .Sh AUTHORS This manual page was written by -.An Gabor Kovesdan Aq gabor@FreeBSD.org . +.An Gabor Kovesdan Aq Mt gabor@FreeBSD.org . diff --git a/lib/libc/locale/utf8.c b/lib/libc/locale/utf8.c index cffa241133a..ce49279cb2d 100644 --- a/lib/libc/locale/utf8.c +++ b/lib/libc/locale/utf8.c @@ -1,4 +1,5 @@ /*- + * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2002-2004 Tim J. Robbins * All rights reserved. * @@ -112,13 +113,6 @@ _UTF8_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n, /* Incomplete multibyte sequence */ return ((size_t)-2); - if (us->want == 0 && ((ch = (unsigned char)*s) & ~0x7f) == 0) { - /* Fast path for plain ASCII characters. */ - if (pwc != NULL) - *pwc = ch; - return (ch != '\0' ? 1 : 0); - } - if (us->want == 0) { /* * Determine the number of octets that make up this character @@ -134,10 +128,12 @@ _UTF8_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n, */ ch = (unsigned char)*s; if ((ch & 0x80) == 0) { - mask = 0x7f; - want = 1; - lbound = 0; - } else if ((ch & 0xe0) == 0xc0) { + /* Fast path for plain ASCII characters. */ + if (pwc != NULL) + *pwc = ch; + return (ch != '\0' ? 1 : 0); + } + if ((ch & 0xe0) == 0xc0) { mask = 0x1f; want = 2; lbound = 0x80; @@ -316,12 +312,6 @@ _UTF8_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps) /* Reset to initial shift state (no-op) */ return (1); - if ((wc & ~0x7f) == 0) { - /* Fast path for plain ASCII characters. */ - *s = (char)wc; - return (1); - } - /* * Determine the number of octets needed to represent this character. * We always output the shortest sequence possible. Also specify the @@ -329,8 +319,9 @@ _UTF8_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps) * about the sequence length. */ if ((wc & ~0x7f) == 0) { - lead = 0; - len = 1; + /* Fast path for plain ASCII characters. */ + *s = (char)wc; + return (1); } else if ((wc & ~0x7ff) == 0) { lead = 0xc0; len = 2; diff --git a/lib/libc/mips/arith.h b/lib/libc/mips/arith.h index 02d6d2e80a9..61f3930f4a8 100644 --- a/lib/libc/mips/arith.h +++ b/lib/libc/mips/arith.h @@ -18,9 +18,6 @@ #define Double_Align #else /* TODO: Generate these values on a LE machine */ -/* Current values were stolen from ia64 except the - * Xpointer define. - */ #define IEEE_8087 #define Arith_Kind_ASL 1 #define Long int diff --git a/lib/libc/net/Makefile.inc b/lib/libc/net/Makefile.inc index 59cbdea4769..c6307afc1d5 100644 --- a/lib/libc/net/Makefile.inc +++ b/lib/libc/net/Makefile.inc @@ -34,11 +34,13 @@ CFLAGS+=-I${LIBC_SRCTOP}/resolv YFLAGS+=-p_nsyy LFLAGS+=-P_nsyy -CLEANFILES+=nslexer.c +CLEANFILES+=nslexer.c nslexer.c.* nslexer.c: nslexer.l nsparser.h - ${LEX} ${LFLAGS} -o/dev/stdout ${.IMPSRC} | \ - sed -e '/YY_BUF_SIZE/s/16384/1024/' >${.TARGET} + ${LEX} ${LFLAGS} -o${.TARGET}.tmp1 ${.IMPSRC} + sed -e '/YY_BUF_SIZE/s/16384/1024/' ${.TARGET}.tmp1 >${.TARGET}.tmp2 + rm -f ${.TARGET}.tmp1 + mv -f ${.TARGET}.tmp2 ${.TARGET} MAN+= byteorder.3 ethers.3 eui64.3 \ getaddrinfo.3 gai_strerror.3 gethostbyname.3 \ diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c index 00ab7963ff7..b4c1a33ddff 100644 --- a/lib/libc/net/getaddrinfo.c +++ b/lib/libc/net/getaddrinfo.c @@ -62,12 +62,15 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #ifdef INET6 #include #include #include -#include /* XXX */ +#include +#include #endif #include #include @@ -245,6 +248,9 @@ static int get_portmatch(const struct addrinfo *, const char *); static int get_port(struct addrinfo *, const char *, int); static const struct afd *find_afd(int); static int addrconfig(struct addrinfo *); +#ifdef INET6 +static int is_ifdisabled(char *); +#endif static void set_source(struct ai_order *, struct policyhead *); static int comp_dst(const void *, const void *); #ifdef INET6 @@ -1003,7 +1009,8 @@ comp_dst(const void *arg1, const void *arg2) * We compare the match length in a same AF only. */ if (dst1->aio_ai->ai_addr->sa_family == - dst2->aio_ai->ai_addr->sa_family) { + dst2->aio_ai->ai_addr->sa_family && + dst1->aio_ai->ai_addr->sa_family != AF_INET) { if (dst1->aio_matchlen > dst2->aio_matchlen) { return(-1); } @@ -1525,10 +1532,11 @@ find_afd(int af) } /* - * post-2553: AI_ADDRCONFIG check. if we use getipnodeby* as backend, backend - * will take care of it. - * the semantics of AI_ADDRCONFIG is not defined well. we are not sure - * if the code is right or not. + * RFC 3493: AI_ADDRCONFIG check. Determines which address families are + * configured on the local system and correlates with pai->ai_family value. + * If an address family is not configured on the system, it will not be + * queried for. For this purpose, loopback addresses are not considered + * configured addresses. * * XXX PF_UNSPEC -> PF_INET6 + PF_INET mapping needs to be in sync with * _dns_getaddrinfo. @@ -1536,38 +1544,80 @@ find_afd(int af) static int addrconfig(struct addrinfo *pai) { - int s, af; + struct ifaddrs *ifaddrs, *ifa; + struct sockaddr_in *sin; +#ifdef INET6 + struct sockaddr_in6 *sin6; +#endif + int seen_inet = 0, seen_inet6 = 0; - /* - * TODO: - * Note that implementation dependent test for address - * configuration should be done everytime called - * (or apropriate interval), - * because addresses will be dynamically assigned or deleted. - */ - af = pai->ai_family; - if (af == AF_UNSPEC) { - if ((s = _socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0)) < 0) - af = AF_INET; - else { - _close(s); - if ((s = _socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, - 0)) < 0) - af = AF_INET6; - else - _close(s); + if (getifaddrs(&ifaddrs) != 0) + return (0); + + for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) { + if (ifa->ifa_addr == NULL || (ifa->ifa_flags & IFF_UP) == 0) + continue; + switch (ifa->ifa_addr->sa_family) { + case AF_INET: + if (seen_inet) + continue; + sin = (struct sockaddr_in *)(ifa->ifa_addr); + if (IN_LOOPBACK(htonl(sin->sin_addr.s_addr))) + continue; + seen_inet = 1; + break; +#ifdef INET6 + case AF_INET6: + if (seen_inet6) + continue; + sin6 = (struct sockaddr_in6 *)(ifa->ifa_addr); + if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr)) + continue; + if ((ifa->ifa_flags & IFT_LOOP) != 0 && + IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) + continue; + if (is_ifdisabled(ifa->ifa_name)) + continue; + seen_inet6 = 1; + break; +#endif } } - if (af != AF_UNSPEC) { - if ((s = _socket(af, SOCK_DGRAM | SOCK_CLOEXEC, 0)) < 0) - return 0; - _close(s); + freeifaddrs(ifaddrs); + + switch(pai->ai_family) { + case AF_INET6: + return (seen_inet6); + case AF_INET: + return (seen_inet); + case AF_UNSPEC: + if (seen_inet == seen_inet6) + return (seen_inet); + pai->ai_family = seen_inet ? AF_INET : AF_INET6; + return (1); } - pai->ai_family = af; - return 1; + return (1); } #ifdef INET6 +static int +is_ifdisabled(char *name) +{ + struct in6_ndireq nd; + int fd; + + if ((fd = _socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0)) < 0) + return (-1); + memset(&nd, 0, sizeof(nd)); + strlcpy(nd.ifname, name, sizeof(nd.ifname)); + if (_ioctl(fd, SIOCGIFINFO_IN6, &nd) < 0) { + _close(fd); + return (-1); + } + _close(fd); + return ((nd.ndi.flags & ND6_IFF_IFDISABLED) != 0); +} + /* convert a string to a scope identifier. XXX: IPv6 specific */ static int ip6_str2scopeid(char *scope, struct sockaddr_in6 *sin6, u_int32_t *scopeid) diff --git a/lib/libc/net/nsdispatch.3 b/lib/libc/net/nsdispatch.3 index 577bce98e45..e08e9bef7ca 100644 --- a/lib/libc/net/nsdispatch.3 +++ b/lib/libc/net/nsdispatch.3 @@ -239,8 +239,7 @@ where it appeared first in Support for NSS modules first appeared in .Fx 5.1 . .Sh AUTHORS -Luke Mewburn -.Aq lukem@netbsd.org +.An Luke Mewburn Aq Mt lukem@netbsd.org wrote this freely-distributable name-service switch implementation, using ideas from the .Tn ULTRIX diff --git a/lib/libc/net/sourcefilter.3 b/lib/libc/net/sourcefilter.3 index 225b0209bd9..a123ff38d68 100644 --- a/lib/libc/net/sourcefilter.3 +++ b/lib/libc/net/sourcefilter.3 @@ -236,5 +236,4 @@ The functions first appeared in .Fx 7.0 . .Sh AUTHORS -Bruce M. Simpson -.Aq bms@FreeBSD.org +.An Bruce M. Simpson Aq Mt bms@FreeBSD.org diff --git a/lib/libc/net/sourcefilter.c b/lib/libc/net/sourcefilter.c index 4d29d9f36e0..cb64701e6f9 100644 --- a/lib/libc/net/sourcefilter.c +++ b/lib/libc/net/sourcefilter.c @@ -337,7 +337,8 @@ getsourcefilter(int s, uint32_t interface, struct sockaddr *group, { struct __msfilterreq msfr; sockunion_t *psu; - int err, level, nsrcs, optlen, optname; + socklen_t optlen; + int err, level, nsrcs, optname; if (interface == 0 || group == NULL || numsrc == NULL || fmode == NULL) { diff --git a/lib/libc/posix1e/acl_add_flag_np.3 b/lib/libc/posix1e/acl_add_flag_np.3 index 057de0393ca..9f7b21e0937 100644 --- a/lib/libc/posix1e/acl_add_flag_np.3 +++ b/lib/libc/posix1e/acl_add_flag_np.3 @@ -94,4 +94,4 @@ function was added in The .Fn acl_add_flag_np function was written by -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org . +.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org . diff --git a/lib/libc/posix1e/acl_add_perm.3 b/lib/libc/posix1e/acl_add_perm.3 index 564b83d9a33..c59aac8e41f 100644 --- a/lib/libc/posix1e/acl_add_perm.3 +++ b/lib/libc/posix1e/acl_add_perm.3 @@ -126,4 +126,4 @@ function was added in The .Fn acl_add_perm function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . +.An Chris D. Faulhaber Aq Mt jedgar@fxp.org . diff --git a/lib/libc/posix1e/acl_calc_mask.3 b/lib/libc/posix1e/acl_calc_mask.3 index 7bcdb4082e2..1cd3fd7c03c 100644 --- a/lib/libc/posix1e/acl_calc_mask.3 +++ b/lib/libc/posix1e/acl_calc_mask.3 @@ -95,4 +95,4 @@ function was added in The .Fn acl_calc_mask function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . +.An Chris D. Faulhaber Aq Mt jedgar@fxp.org . diff --git a/lib/libc/posix1e/acl_clear_flags_np.3 b/lib/libc/posix1e/acl_clear_flags_np.3 index 0780e149d5f..a3da4815371 100644 --- a/lib/libc/posix1e/acl_clear_flags_np.3 +++ b/lib/libc/posix1e/acl_clear_flags_np.3 @@ -76,4 +76,4 @@ function was added in The .Fn acl_clear_flags_np function was written by -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org . +.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org . diff --git a/lib/libc/posix1e/acl_clear_perms.3 b/lib/libc/posix1e/acl_clear_perms.3 index df82b6c7869..4b055fcf5e6 100644 --- a/lib/libc/posix1e/acl_clear_perms.3 +++ b/lib/libc/posix1e/acl_clear_perms.3 @@ -76,4 +76,4 @@ function was added in The .Fn acl_clear_perms function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . +.An Chris D. Faulhaber Aq Mt jedgar@fxp.org . diff --git a/lib/libc/posix1e/acl_copy_entry.3 b/lib/libc/posix1e/acl_copy_entry.3 index 586b8227176..5fd31ed793e 100644 --- a/lib/libc/posix1e/acl_copy_entry.3 +++ b/lib/libc/posix1e/acl_copy_entry.3 @@ -82,4 +82,4 @@ function was added in The .Fn acl_copy_entry function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . +.An Chris D. Faulhaber Aq Mt jedgar@fxp.org . diff --git a/lib/libc/posix1e/acl_create_entry.3 b/lib/libc/posix1e/acl_create_entry.3 index 784f6875cf9..76c14f3f0e9 100644 --- a/lib/libc/posix1e/acl_create_entry.3 +++ b/lib/libc/posix1e/acl_create_entry.3 @@ -95,4 +95,4 @@ function was added in The .Fn acl_create_entry function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . +.An Chris D. Faulhaber Aq Mt jedgar@fxp.org . diff --git a/lib/libc/posix1e/acl_delete_entry.3 b/lib/libc/posix1e/acl_delete_entry.3 index b1bdc5ac74b..06bb0ded1ed 100644 --- a/lib/libc/posix1e/acl_delete_entry.3 +++ b/lib/libc/posix1e/acl_delete_entry.3 @@ -98,4 +98,4 @@ function was added in The .Fn acl_delete_entry function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . +.An Chris D. Faulhaber Aq Mt jedgar@fxp.org . diff --git a/lib/libc/posix1e/acl_delete_flag_np.3 b/lib/libc/posix1e/acl_delete_flag_np.3 index a288978b8a3..ba7a738394f 100644 --- a/lib/libc/posix1e/acl_delete_flag_np.3 +++ b/lib/libc/posix1e/acl_delete_flag_np.3 @@ -81,4 +81,4 @@ function was added in The .Fn acl_delete_flag_np function was written by -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org . +.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org . diff --git a/lib/libc/posix1e/acl_delete_perm.3 b/lib/libc/posix1e/acl_delete_perm.3 index b6c725058b4..90f244e147c 100644 --- a/lib/libc/posix1e/acl_delete_perm.3 +++ b/lib/libc/posix1e/acl_delete_perm.3 @@ -81,4 +81,4 @@ function was added in The .Fn acl_delete_perm function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . +.An Chris D. Faulhaber Aq Mt jedgar@fxp.org . diff --git a/lib/libc/posix1e/acl_get_brand_np.3 b/lib/libc/posix1e/acl_get_brand_np.3 index 5caa40c862a..44b83e23293 100644 --- a/lib/libc/posix1e/acl_get_brand_np.3 +++ b/lib/libc/posix1e/acl_get_brand_np.3 @@ -83,4 +83,4 @@ function was added in The .Fn acl_get_brand_np function was written by -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org . +.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org . diff --git a/lib/libc/posix1e/acl_get_entry.3 b/lib/libc/posix1e/acl_get_entry.3 index 477b735edfb..88c72db2559 100644 --- a/lib/libc/posix1e/acl_get_entry.3 +++ b/lib/libc/posix1e/acl_get_entry.3 @@ -142,4 +142,4 @@ function was added in The .Fn acl_get_entry function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . +.An Chris D. Faulhaber Aq Mt jedgar@fxp.org . diff --git a/lib/libc/posix1e/acl_get_entry_type_np.3 b/lib/libc/posix1e/acl_get_entry_type_np.3 index eea4b17425c..6313d0607c7 100644 --- a/lib/libc/posix1e/acl_get_entry_type_np.3 +++ b/lib/libc/posix1e/acl_get_entry_type_np.3 @@ -77,4 +77,4 @@ function was added in The .Fn acl_get_entry_type_np function was written by -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org . +.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org . diff --git a/lib/libc/posix1e/acl_get_flag_np.3 b/lib/libc/posix1e/acl_get_flag_np.3 index b57fd04bc60..d70ce84427d 100644 --- a/lib/libc/posix1e/acl_get_flag_np.3 +++ b/lib/libc/posix1e/acl_get_flag_np.3 @@ -91,4 +91,4 @@ function was added in The .Fn acl_get_flag_np function was written by -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org . +.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org . diff --git a/lib/libc/posix1e/acl_get_flagset_np.3 b/lib/libc/posix1e/acl_get_flagset_np.3 index 221b93bce91..fd1c8b2aed3 100644 --- a/lib/libc/posix1e/acl_get_flagset_np.3 +++ b/lib/libc/posix1e/acl_get_flagset_np.3 @@ -80,4 +80,4 @@ function was added in The .Fn acl_get_flagset_np function was written by -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org . +.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org . diff --git a/lib/libc/posix1e/acl_get_perm_np.3 b/lib/libc/posix1e/acl_get_perm_np.3 index de1c0b5f9dc..0f4126ecbe6 100644 --- a/lib/libc/posix1e/acl_get_perm_np.3 +++ b/lib/libc/posix1e/acl_get_perm_np.3 @@ -91,4 +91,4 @@ function was added in The .Fn acl_get_perm_np function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . +.An Chris D. Faulhaber Aq Mt jedgar@fxp.org . diff --git a/lib/libc/posix1e/acl_get_permset.3 b/lib/libc/posix1e/acl_get_permset.3 index cf93b0a8d3f..064f71ce45b 100644 --- a/lib/libc/posix1e/acl_get_permset.3 +++ b/lib/libc/posix1e/acl_get_permset.3 @@ -80,4 +80,4 @@ function was added in The .Fn acl_get_permset function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . +.An Chris D. Faulhaber Aq Mt jedgar@fxp.org . diff --git a/lib/libc/posix1e/acl_get_qualifier.3 b/lib/libc/posix1e/acl_get_qualifier.3 index 653a3b4f327..fcafd2cc3bb 100644 --- a/lib/libc/posix1e/acl_get_qualifier.3 +++ b/lib/libc/posix1e/acl_get_qualifier.3 @@ -137,4 +137,4 @@ function was added in The .Fn acl_get_qualifier function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . +.An Chris D. Faulhaber Aq Mt jedgar@fxp.org . diff --git a/lib/libc/posix1e/acl_get_tag_type.3 b/lib/libc/posix1e/acl_get_tag_type.3 index 4856c508277..64c57efed73 100644 --- a/lib/libc/posix1e/acl_get_tag_type.3 +++ b/lib/libc/posix1e/acl_get_tag_type.3 @@ -82,4 +82,4 @@ function was added in The .Fn acl_get_tag_type function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . +.An Chris D. Faulhaber Aq Mt jedgar@fxp.org . diff --git a/lib/libc/posix1e/acl_is_trivial_np.3 b/lib/libc/posix1e/acl_is_trivial_np.3 index 4f5a22cd6dd..142a76c8f1a 100644 --- a/lib/libc/posix1e/acl_is_trivial_np.3 +++ b/lib/libc/posix1e/acl_is_trivial_np.3 @@ -82,4 +82,4 @@ The function was added in .Fx 8.0 . .Sh AUTHORS -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org . +.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org diff --git a/lib/libc/posix1e/acl_set_entry_type_np.3 b/lib/libc/posix1e/acl_set_entry_type_np.3 index 648775d4e83..2257b53c371 100644 --- a/lib/libc/posix1e/acl_set_entry_type_np.3 +++ b/lib/libc/posix1e/acl_set_entry_type_np.3 @@ -91,4 +91,4 @@ function was added in The .Fn acl_get_entry_type_np function was written by -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org . +.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org . diff --git a/lib/libc/posix1e/acl_set_flagset_np.3 b/lib/libc/posix1e/acl_set_flagset_np.3 index 386665d4b4c..3d271c86839 100644 --- a/lib/libc/posix1e/acl_set_flagset_np.3 +++ b/lib/libc/posix1e/acl_set_flagset_np.3 @@ -82,4 +82,4 @@ function was added in The .Fn acl_set_flagset_np function was written by -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org . +.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org . diff --git a/lib/libc/posix1e/acl_set_permset.3 b/lib/libc/posix1e/acl_set_permset.3 index 0cf658161b8..259aef6b845 100644 --- a/lib/libc/posix1e/acl_set_permset.3 +++ b/lib/libc/posix1e/acl_set_permset.3 @@ -78,4 +78,4 @@ function was added in The .Fn acl_set_permset function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . +.An Chris D. Faulhaber Aq Mt jedgar@fxp.org . diff --git a/lib/libc/posix1e/acl_set_qualifier.3 b/lib/libc/posix1e/acl_set_qualifier.3 index 47a60d81121..26542ce2838 100644 --- a/lib/libc/posix1e/acl_set_qualifier.3 +++ b/lib/libc/posix1e/acl_set_qualifier.3 @@ -88,4 +88,4 @@ function was added in The .Fn acl_get_qualifier function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . +.An Chris D. Faulhaber Aq Mt jedgar@fxp.org . diff --git a/lib/libc/posix1e/acl_set_tag_type.3 b/lib/libc/posix1e/acl_set_tag_type.3 index 79526a00445..42834c2657d 100644 --- a/lib/libc/posix1e/acl_set_tag_type.3 +++ b/lib/libc/posix1e/acl_set_tag_type.3 @@ -99,4 +99,4 @@ function was added in The .Fn acl_set_tag_type function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . +.An Chris D. Faulhaber Aq Mt jedgar@fxp.org . diff --git a/lib/libc/posix1e/acl_strip_np.3 b/lib/libc/posix1e/acl_strip_np.3 index cc6c65b70fd..8c1a920a717 100644 --- a/lib/libc/posix1e/acl_strip_np.3 +++ b/lib/libc/posix1e/acl_strip_np.3 @@ -106,4 +106,4 @@ The function was added in .Fx 8.0 . .Sh AUTHORS -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org . +.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org diff --git a/lib/libc/regex/re_format.7 b/lib/libc/regex/re_format.7 index a2a527da519..05b14947e45 100644 --- a/lib/libc/regex/re_format.7 +++ b/lib/libc/regex/re_format.7 @@ -36,7 +36,7 @@ .\" @(#)re_format.7 8.3 (Berkeley) 3/20/94 .\" $FreeBSD$ .\" -.Dd March 20, 1994 +.Dd June 30, 2014 .Dt RE_FORMAT 7 .Os .Sh NAME @@ -314,6 +314,13 @@ compatible with but not specified by .St -p1003.2 , and should be used with caution in software intended to be portable to other systems. +The additional word delimiters +.Ql \e< +and +.Ql \e> +are provided to ease compatibility with traditional +.Xr svr4 4 +systems but are not portable and should be avoided. .Pp In the event that an RE could match more than one substring of a given string, diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c index 55f9c04c691..a01bb95931b 100644 --- a/lib/libc/regex/regcomp.c +++ b/lib/libc/regex/regcomp.c @@ -412,7 +412,17 @@ p_ere_exp(struct parse *p) case '\\': (void)REQUIRE(MORE(), REG_EESCAPE); wc = WGETNEXT(); - ordinary(p, wc); + switch (wc) { + case '<': + EMIT(OBOW, 0); + break; + case '>': + EMIT(OEOW, 0); + break; + default: + ordinary(p, wc); + break; + } break; case '{': /* okay as ordinary except if digit follows */ (void)REQUIRE(!MORE() || !isdigit((uch)PEEK()), REG_BADRPT); @@ -569,6 +579,12 @@ p_simp_re(struct parse *p, case '[': p_bracket(p); break; + case BACKSL|'<': + EMIT(OBOW, 0); + break; + case BACKSL|'>': + EMIT(OEOW, 0); + break; case BACKSL|'{': SETERROR(REG_BADRPT); break; diff --git a/lib/libc/stdio/fflush.c b/lib/libc/stdio/fflush.c index 456b031dd01..ef9b45b8b6f 100644 --- a/lib/libc/stdio/fflush.c +++ b/lib/libc/stdio/fflush.c @@ -60,7 +60,7 @@ fflush(FILE *fp) /* * There is disagreement about the correct behaviour of fflush() - * when passed a file which is not open for reading. According to + * when passed a file which is not open for writing. According to * the ISO C standard, the behaviour is undefined. * Under linux, such an fflush returns success and has no effect; * under Windows, such an fflush is documented as behaving instead @@ -68,11 +68,13 @@ fflush(FILE *fp) * Given that applications may be written with the expectation of * either of these two behaviours, the only safe (non-astonishing) * option is to return EBADF and ask that applications be fixed. + * SUSv3 now requires that fflush() returns success on a read-only + * stream. + * */ - if ((fp->_flags & (__SWR | __SRW)) == 0) { - errno = EBADF; - retval = EOF; - } else + if ((fp->_flags & (__SWR | __SRW)) == 0) + retval = 0; + else retval = __sflush(fp); FUNLOCKFILE(fp); return (retval); @@ -89,10 +91,9 @@ __fflush(FILE *fp) if (fp == NULL) return (_fwalk(sflush_locked)); - if ((fp->_flags & (__SWR | __SRW)) == 0) { - errno = EBADF; - retval = EOF; - } else + if ((fp->_flags & (__SWR | __SRW)) == 0) + retval = 0; + else retval = __sflush(fp); return (retval); } @@ -122,6 +123,12 @@ __sflush(FILE *fp) for (; n > 0; n -= t, p += t) { t = _swrite(fp, (char *)p, n); if (t <= 0) { + /* Reset _p and _w. */ + if (p > fp->_p) /* Some was written. */ + memmove(fp->_p, p, n); + fp->_p += n; + if ((fp->_flags & (__SLBF | __SNBF)) == 0) + fp->_w -= n; fp->_flags |= __SERR; return (EOF); } diff --git a/lib/libc/stdio/fmemopen.c b/lib/libc/stdio/fmemopen.c index 581a91efd73..ebd3596be77 100644 --- a/lib/libc/stdio/fmemopen.c +++ b/lib/libc/stdio/fmemopen.c @@ -56,6 +56,14 @@ fmemopen(void * __restrict buf, size_t size, const char * __restrict mode) FILE *f; int flags, rc; + /* + * POSIX says we shall return EINVAL if size is 0. + */ + if (size == 0) { + errno = EINVAL; + return (NULL); + } + /* * Retrieve the flags as used by open(2) from the mode argument, and * validate them. @@ -119,14 +127,7 @@ fmemopen(void * __restrict buf, size_t size, const char * __restrict mode) */ switch (mode[0]) { case 'a': - if (ck->bin) { - /* - * This isn't useful, since the buffer isn't allowed - * to grow. - */ - ck->off = ck->len = size; - } else - ck->off = ck->len = strnlen(ck->buf, ck->size); + ck->off = ck->len = strnlen(ck->buf, ck->size); break; case 'r': ck->len = size; diff --git a/lib/libc/stdio/fopen.3 b/lib/libc/stdio/fopen.3 index f11f4e07e3d..b39cb5a0d50 100644 --- a/lib/libc/stdio/fopen.3 +++ b/lib/libc/stdio/fopen.3 @@ -302,6 +302,15 @@ for any of the errors specified for the routines .Xr fclose 3 and .Xr fflush 3 . +.Pp +The +.Fn fmemopen +function +may also fail and set +.Va errno +if the +.Fa size +argument is 0. .Sh SEE ALSO .Xr open 2 , .Xr fclose 3 , diff --git a/lib/libc/stdio/fputs.c b/lib/libc/stdio/fputs.c index 3b8f2c9d1b6..32e57645f56 100644 --- a/lib/libc/stdio/fputs.c +++ b/lib/libc/stdio/fputs.c @@ -55,7 +55,7 @@ fputs(const char * __restrict s, FILE * __restrict fp) struct __siov iov; iov.iov_base = (void *)s; - iov.iov_len = uio.uio_resid = strlen(s); + uio.uio_resid = iov.iov_len = strlen(s); uio.uio_iov = &iov; uio.uio_iovcnt = 1; FLOCKFILE(fp); diff --git a/lib/libc/stdio/fputws.c b/lib/libc/stdio/fputws.c index fa8d31784e0..41530673c00 100644 --- a/lib/libc/stdio/fputws.c +++ b/lib/libc/stdio/fputws.c @@ -67,7 +67,7 @@ fputws_l(const wchar_t * __restrict ws, FILE * __restrict fp, locale_t locale) &fp->_mbstate); if (nbytes == (size_t)-1) goto error; - iov.iov_len = uio.uio_resid = nbytes; + uio.uio_resid = iov.iov_len = nbytes; if (__sfvwrite(fp, &uio) != 0) goto error; } while (wsp != NULL); diff --git a/lib/libc/stdio/freopen.c b/lib/libc/stdio/freopen.c index 0ff83bf9617..4dcd50fbb13 100644 --- a/lib/libc/stdio/freopen.c +++ b/lib/libc/stdio/freopen.c @@ -97,7 +97,7 @@ freopen(const char * __restrict file, const char * __restrict mode, (dflags & (O_ACCMODE | O_EXEC)) != (oflags & O_ACCMODE)) { fclose(fp); FUNLOCKFILE(fp); - errno = EINVAL; + errno = EBADF; return (NULL); } if (fp->_flags & __SWR) @@ -151,6 +151,14 @@ freopen(const char * __restrict file, const char * __restrict mode, /* Get a new descriptor to refer to the new file. */ f = _open(file, oflags, DEFFILEMODE); + /* If out of fd's close the old one and try again. */ + if (f < 0 && isopen && wantfd > STDERR_FILENO && + (errno == ENFILE || errno == EMFILE)) { + (void) (*fp->_close)(fp->_cookie); + isopen = 0; + wantfd = -1; + f = _open(file, oflags, DEFFILEMODE); + } sverrno = errno; finish: diff --git a/lib/libc/stdio/ftell.c b/lib/libc/stdio/ftell.c index 2c8800ccfe1..745d500513d 100644 --- a/lib/libc/stdio/ftell.c +++ b/lib/libc/stdio/ftell.c @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include "namespace.h" #include #include +#include #include #include #include "un-namespace.h" @@ -87,6 +88,7 @@ _ftello(FILE *fp, fpos_t *offset) { fpos_t pos; size_t n; + int dflags; if (fp->_seek == NULL) { errno = ESPIPE; /* historic practice */ @@ -118,6 +120,22 @@ _ftello(FILE *fp, fpos_t *offset) if (HASUB(fp)) pos -= fp->_r; /* Can be negative at this point. */ } else if ((fp->_flags & __SWR) && fp->_p != NULL) { + dflags = 0; + if (fp->_flags & __SAPP) + dflags = O_APPEND; + else if (fp->_file != -1 && + (dflags = _fcntl(fp->_file, F_GETFL)) < 0) + return (1); + if ((dflags & O_APPEND) && + (pos = _sseek(fp, (fpos_t)0, SEEK_END)) == -1) { + if ((fp->_flags & __SOPT) || __sflush(fp) || + (pos = _sseek(fp, (fpos_t)0, SEEK_CUR)) == -1) + return (1); + else { + *offset = pos; + return (0); + } + } /* * Writing. Any buffered characters cause the * position to be greater than that in the diff --git a/lib/libc/stdio/gets.c b/lib/libc/stdio/gets.c index c7c1c2fa38c..c9438515323 100644 --- a/lib/libc/stdio/gets.c +++ b/lib/libc/stdio/gets.c @@ -52,7 +52,7 @@ gets(char *buf) int c; char *s; static int warned; - static char w[] = + static const char w[] = "warning: this program uses gets(), which is unsafe.\n"; FLOCKFILE(stdin); diff --git a/lib/libc/stdio/printf.3 b/lib/libc/stdio/printf.3 index 05c30dcfb52..058f9a9f7d6 100644 --- a/lib/libc/stdio/printf.3 +++ b/lib/libc/stdio/printf.3 @@ -827,14 +827,14 @@ first appeared in the .Tn GNU C library. These were implemented by -.An Peter Wemm Aq peter@FreeBSD.org +.An Peter Wemm Aq Mt peter@FreeBSD.org in .Fx 2.2 , but were later replaced with a different implementation from .Ox 2.3 by -.An Todd C. Miller Aq Todd.Miller@courtesan.com . +.An Todd C. Miller Aq Mt Todd.Miller@courtesan.com . The .Fn dprintf and diff --git a/lib/libc/stdio/puts.c b/lib/libc/stdio/puts.c index 5ee7fc1c63f..124afc73d60 100644 --- a/lib/libc/stdio/puts.c +++ b/lib/libc/stdio/puts.c @@ -51,12 +51,12 @@ int puts(char const *s) { int retval; - size_t c = strlen(s); + size_t c; struct __suio uio; struct __siov iov[2]; iov[0].iov_base = (void *)s; - iov[0].iov_len = c; + iov[0].iov_len = c = strlen(s); iov[1].iov_base = "\n"; iov[1].iov_len = 1; uio.uio_resid = c + 1; diff --git a/lib/libc/stdio/putw.c b/lib/libc/stdio/putw.c index 0360cafc405..ecd5d095de5 100644 --- a/lib/libc/stdio/putw.c +++ b/lib/libc/stdio/putw.c @@ -50,7 +50,7 @@ putw(int w, FILE *fp) struct __siov iov; iov.iov_base = &w; - iov.iov_len = uio.uio_resid = sizeof(w); + uio.uio_resid = iov.iov_len = sizeof(w); uio.uio_iov = &iov; uio.uio_iovcnt = 1; FLOCKFILE(fp); diff --git a/lib/libc/stdio/rewind.c b/lib/libc/stdio/rewind.c index ff4c9072c76..133e3f43dd0 100644 --- a/lib/libc/stdio/rewind.c +++ b/lib/libc/stdio/rewind.c @@ -53,9 +53,8 @@ rewind(FILE *fp) __sinit(); FLOCKFILE(fp); - if (_fseeko(fp, (off_t)0, SEEK_SET, 1) == 0) { - clearerr_unlocked(fp); + if (_fseeko(fp, (off_t)0, SEEK_SET, 1) == 0) errno = serrno; - } + clearerr_unlocked(fp); /* POSIX: clear stdio error regardless */ FUNLOCKFILE(fp); } diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c index ea47d36ea14..e54e8acf00f 100644 --- a/lib/libc/stdio/vfprintf.c +++ b/lib/libc/stdio/vfprintf.c @@ -455,8 +455,10 @@ __vfprintf(FILE *fp, locale_t locale, const char *fmt0, va_list ap) return (__xvprintf(fp, fmt0, ap)); /* sorry, fprintf(read_only_file, "") returns EOF, not 0 */ - if (prepwrite(fp) != 0) + if (prepwrite(fp) != 0) { + errno = EBADF; return (EOF); + } convbuf = NULL; fmt = (char *)fmt0; diff --git a/lib/libc/stdio/vfwprintf.c b/lib/libc/stdio/vfwprintf.c index 4350c48acaf..b75c504b1e7 100644 --- a/lib/libc/stdio/vfwprintf.c +++ b/lib/libc/stdio/vfwprintf.c @@ -531,8 +531,10 @@ __vfwprintf(FILE *fp, locale_t locale, const wchar_t *fmt0, va_list ap) /* sorry, fwprintf(read_only_file, L"") returns WEOF, not 0 */ - if (prepwrite(fp) != 0) + if (prepwrite(fp) != 0) { + errno = EBADF; return (EOF); + } convbuf = NULL; fmt = (wchar_t *)fmt0; diff --git a/lib/libc/stdio/wbuf.c b/lib/libc/stdio/wbuf.c index 3f697e287a1..5bc3c4dc3e7 100644 --- a/lib/libc/stdio/wbuf.c +++ b/lib/libc/stdio/wbuf.c @@ -36,6 +36,7 @@ static char sccsid[] = "@(#)wbuf.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD$"); +#include #include #include "local.h" @@ -59,8 +60,10 @@ __swbuf(int c, FILE *fp) * calls might wrap _w from negative to positive. */ fp->_w = fp->_lbfsize; - if (prepwrite(fp) != 0) + if (prepwrite(fp) != 0) { + errno = EBADF; return (EOF); + } c = (unsigned char)c; ORIENT(fp, -1); diff --git a/lib/libc/stdlib/Makefile.inc b/lib/libc/stdlib/Makefile.inc index 68dda94c5d4..57205a756a9 100644 --- a/lib/libc/stdlib/Makefile.inc +++ b/lib/libc/stdlib/Makefile.inc @@ -35,6 +35,7 @@ MLINKS+=exit.3 _Exit.3 MLINKS+=getenv.3 putenv.3 getenv.3 setenv.3 getenv.3 unsetenv.3 MLINKS+=getopt_long.3 getopt_long_only.3 MLINKS+=hcreate.3 hdestroy.3 hcreate.3 hsearch.3 +MLINKS+=hcreate.3 hcreate_r.3 hcreate.3 hdestroy_r.3 hcreate.3 hsearch_r.3 MLINKS+=insque.3 remque.3 MLINKS+=lsearch.3 lfind.3 MLINKS+=ptsname.3 grantpt.3 ptsname.3 unlockpt.3 diff --git a/lib/libc/stdlib/Symbol.map b/lib/libc/stdlib/Symbol.map index d28a8e9ecbd..64c0e169dd2 100644 --- a/lib/libc/stdlib/Symbol.map +++ b/lib/libc/stdlib/Symbol.map @@ -109,6 +109,9 @@ FBSD_1.4 { heapsort_b; mergesort_b; qsort_b; + hcreate_r; + hdestroy_r; + hsearch_r; }; FBSDprivate_1.0 { diff --git a/lib/libc/stdlib/a64l.3 b/lib/libc/stdlib/a64l.3 index 61fbffdbab3..eadc2f39346 100644 --- a/lib/libc/stdlib/a64l.3 +++ b/lib/libc/stdlib/a64l.3 @@ -181,7 +181,7 @@ functions were added to .Fx by -.An Tom Rhodes Aq trhodes@FreeBSD.org . +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org . Almost all of this manual page came from the .Tn POSIX standard. diff --git a/lib/libc/stdlib/getopt.3 b/lib/libc/stdlib/getopt.3 index 03a63abb19c..6e04e170471 100644 --- a/lib/libc/stdlib/getopt.3 +++ b/lib/libc/stdlib/getopt.3 @@ -1,4 +1,4 @@ -.\" $NetBSD: getopt.3,v 1.31 2003/09/23 10:26:54 wiz Exp $ +.\" $NetBSD: getopt.3,v 1.34 2014/06/05 22:09:50 wiz Exp $ .\" .\" Copyright (c) 1988, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -30,7 +30,7 @@ .\" @(#)getopt.3 8.5 (Berkeley) 4/27/95 .\" $FreeBSD$ .\" -.Dd April 27, 1995 +.Dd June 5, 2014 .Dt GETOPT 3 .Os .Sh NAME @@ -65,6 +65,17 @@ The option string may contain the following elements: individual characters, and characters followed by a colon to indicate an option argument is to follow. +If an individual character is followed by two colons, then the +option argument is optional; +.Va optarg +is set to the rest of the current +.Va argv +word, or +.Dv NULL +if there were no more characters in the current word. +This is a +.Tn GNU +extension. For example, an option string .Li \&"x" recognizes an option diff --git a/lib/libc/stdlib/getopt.c b/lib/libc/stdlib/getopt.c index b9d2ae31fc6..3929b321dca 100644 --- a/lib/libc/stdlib/getopt.c +++ b/lib/libc/stdlib/getopt.c @@ -1,4 +1,4 @@ -/* $NetBSD: getopt.c,v 1.26 2003/08/07 16:43:40 agc Exp $ */ +/* $NetBSD: getopt.c,v 1.29 2014/06/05 22:00:22 christos Exp $ */ /* * Copyright (c) 1987, 1993, 1994 @@ -59,10 +59,7 @@ char *optarg; /* argument associated with option */ * Parse argc/argv argument vector. */ int -getopt(nargc, nargv, ostr) - int nargc; - char * const nargv[]; - const char *ostr; +getopt(int nargc, char * const nargv[], const char *ostr) { static char *place = EMSG; /* option letter processing */ char *oli; /* option letter list index */ @@ -115,6 +112,12 @@ getopt(nargc, nargv, ostr) entire next argument. */ if (*place) optarg = place; + else if (oli[2] == ':') + /* + * GNU Extension, for optional arguments if the rest of + * the argument is empty, we return NULL + */ + optarg = NULL; else if (nargc > ++optind) optarg = nargv[optind]; else { diff --git a/lib/libc/stdlib/getopt_long.c b/lib/libc/stdlib/getopt_long.c index 9f7f6d5ae73..9534a2aff67 100644 --- a/lib/libc/stdlib/getopt_long.c +++ b/lib/libc/stdlib/getopt_long.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getopt_long.c,v 1.22 2006/10/04 21:29:04 jmc Exp $ */ +/* $OpenBSD: getopt_long.c,v 1.26 2013/06/08 22:47:56 millert Exp $ */ /* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */ /* @@ -248,7 +248,7 @@ parse_long_options(char * const *nargv, const char *options, if (short_too && current_argv_len == 1) continue; - if (match == -1) /* first partial match */ + if (match == -1) /* first partial match */ match = i; else if ((flags & FLAG_LONGONLY) || long_options[i].has_arg != @@ -359,30 +359,11 @@ getopt_internal(int nargc, char * const *nargv, const char *options, { char *oli; /* option letter list index */ int optchar, short_too; - int posixly_correct; /* no static, can be changed on the fly */ + static int posixly_correct = -1; if (options == NULL) return (-1); - /* - * Disable GNU extensions if POSIXLY_CORRECT is set or options - * string begins with a '+'. - */ - posixly_correct = (getenv("POSIXLY_CORRECT") != NULL); -#ifdef GNU_COMPATIBLE - if (*options == '-') - flags |= FLAG_ALLARGS; - else if (posixly_correct || *options == '+') - flags &= ~FLAG_PERMUTE; -#else - if (posixly_correct || *options == '+') - flags &= ~FLAG_PERMUTE; - else if (*options == '-') - flags |= FLAG_ALLARGS; -#endif - if (*options == '+' || *options == '-') - options++; - /* * XXX Some GNU programs (like cvs) set optind to 0 instead of * XXX using optreset. Work around this braindamage. @@ -390,6 +371,19 @@ getopt_internal(int nargc, char * const *nargv, const char *options, if (optind == 0) optind = optreset = 1; + /* + * Disable GNU extensions if POSIXLY_CORRECT is set or options + * string begins with a '+'. + */ + if (posixly_correct == -1 || optreset) + posixly_correct = (getenv("POSIXLY_CORRECT") != NULL); + if (*options == '-') + flags |= FLAG_ALLARGS; + else if (posixly_correct || *options == '+') + flags &= ~FLAG_PERMUTE; + if (*options == '+' || *options == '-') + options++; + optarg = NULL; if (optreset) nonopt_start = nonopt_end = -1; diff --git a/lib/libc/stdlib/hcreate.3 b/lib/libc/stdlib/hcreate.3 index 2466c9f428a..2161f9262c8 100644 --- a/lib/libc/stdlib/hcreate.3 +++ b/lib/libc/stdlib/hcreate.3 @@ -28,11 +28,16 @@ .\" .\" $FreeBSD$ .\" -.Dd July 6, 2008 +.Dd July 21, 2014 .Dt HCREATE 3 .Os .Sh NAME -.Nm hcreate , hdestroy , hsearch +.Nm hcreate , +.Nm hcreate_r , +.Nm hdestroy , +.Nm hdestroy_r , +.Nm hsearch , +.Nm hsearch_r .Nd manage hash search table .Sh LIBRARY .Lb libc @@ -40,16 +45,25 @@ .In search.h .Ft int .Fn hcreate "size_t nel" +.Ft int +.Fn hcreate_r "size_t nel" "struct hsearch_data *table" .Ft void -.Fn hdestroy void +.Fn hdestroy "void" +.Ft void +.Fn hdestroy_r "struct hsearch_data *table" .Ft ENTRY * .Fn hsearch "ENTRY item" "ACTION action" +.Ft int +.Fn hsearch_r "ENTRY item" "ACTION action" "ENTRY ** itemp" "struct hsearch_data *table" .Sh DESCRIPTION The .Fn hcreate , +.Fn hcreate_r , .Fn hdestroy , +.Fn hdestroy_r +.Fn hsearch , and -.Fn hsearch +.Fn hsearch_r functions manage hash search tables. .Pp The @@ -90,7 +104,7 @@ argument is a structure of type .Vt ENTRY (defined in the .In search.h -header) containing two pointers: +header) that contains two pointers: .Fa item.key points to the comparison key (a .Vt "char *" ) , @@ -136,21 +150,50 @@ is and .Fn hdestroy is called. +.Pp +The +.Fn hcreate_r , +.Fn hdestroy_r , +and +.Fn hsearch_r +functions are re-entrant versions of the above functions that can +operate on a table supplied by the user. +The +.Fn hsearch_r +function returns +.Dv 0 +if the action is +.Dv ENTER +and the element cannot be created, +.Dv 1 +otherwise. +If the element exists or can be created, it will be placed in +.Fa itemp , +otherwise +.Fa itemp +will be set to +.Dv NULL . .Sh RETURN VALUES The .Fn hcreate -function returns 0 if the table creation failed and the global variable +and +.Fn hcreate_r +functions return 0 if the table creation failed and the global variable .Va errno is set to indicate the error; otherwise, a non-zero value is returned. .Pp The .Fn hdestroy -function does not return a value. +and +.Fn hdestroy_r +functions return no value. .Pp The .Fn hsearch -function returns a +and +.Fn hsearch_r +functions return a .Dv NULL pointer if either the .Fa action @@ -223,15 +266,31 @@ main(void) .Sh ERRORS The .Fn hcreate -and +.Fn hcreate_r , .Fn hsearch -functions may fail if: +and +.Fn hsearch_r +functions will fail if: .Bl -tag -width Er .It Bq Er ENOMEM -Insufficient storage space is available. +Insufficient memory is available. .It Bq Er EINVAL A table already exists. .El +.Pp +The +.Fn hsearch +and +.Fn hsearch_r +functions will also fail if the action is +.Dv SEARCH +and the element is not found: +.Bl -tag -width Er +.It Bq Er ESRCH +The +.Fa item +given is not found. +.El .Sh SEE ALSO .Xr bsearch 3 , .Xr lsearch 3 , @@ -254,5 +313,15 @@ and .Fn hsearch functions first appeared in .At V . +The +.Fn hcreate_r , +.Fn hdestroy_r +and +.Fn hsearch_r +functions are +.Tn GNU +extensions. .Sh BUGS -The interface permits the use of only one hash table at a time. +The original, +.Pf non- Tn GNU +interface permits the use of only one hash table at a time. diff --git a/lib/libc/stdlib/hcreate.c b/lib/libc/stdlib/hcreate.c index c68fe1b76a5..b3be9b4dc43 100644 --- a/lib/libc/stdlib/hcreate.c +++ b/lib/libc/stdlib/hcreate.c @@ -1,4 +1,4 @@ -/* $NetBSD: hcreate.c,v 1.2 2001/02/19 21:26:04 ross Exp $ */ +/* $NetBSD: hcreate.c,v 1.7 2011/09/14 23:33:51 christos Exp $ */ /* * Copyright (c) 2001 Christopher G. Demetriou @@ -12,12 +12,7 @@ * 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. See http://www.netbsd.org/ for - * information about NetBSD. - * 4. The name of the author may not be used to endorse or promote products + * 3. The name of the author may not 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 @@ -49,7 +44,7 @@ #include #if 0 #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: hcreate.c,v 1.2 2001/02/19 21:26:04 ross Exp $"); +__RCSID("$NetBSD: hcreate.c,v 1.8 2011/09/17 16:54:39 christos Exp $"); #endif /* LIBC_SCCS and not lint */ #endif __FBSDID("$FreeBSD$"); @@ -84,20 +79,27 @@ SLIST_HEAD(internal_head, internal_entry); /* Default hash function, from db/hash/hash_func.c */ extern u_int32_t (*__default_hash)(const void *, size_t); -static struct internal_head *htable; -static size_t htablesize; +static struct hsearch_data htable; int hcreate(size_t nel) { - size_t idx; - unsigned int p2; /* Make sure this is not called when a table already exists. */ - if (htable != NULL) { + if (htable.table != NULL) { errno = EINVAL; return 0; } + return hcreate_r(nel, &htable); +} + +int +hcreate_r(size_t nel, struct hsearch_data *head) +{ + struct internal_head *table; + size_t idx; + unsigned int p2; + void *p; /* If nel is too small, make it min sized. */ if (nel < MIN_BUCKETS) @@ -115,71 +117,102 @@ hcreate(size_t nel) } /* Allocate the table. */ - htablesize = nel; - htable = malloc(htablesize * sizeof htable[0]); - if (htable == NULL) { + head->size = nel; + head->filled = 0; + p = malloc(nel * sizeof table[0]); + if (p == NULL) { errno = ENOMEM; return 0; } + head->table = p; + table = p; /* Initialize it. */ - for (idx = 0; idx < htablesize; idx++) - SLIST_INIT(&htable[idx]); + for (idx = 0; idx < nel; idx++) + SLIST_INIT(&table[idx]); return 1; } void hdestroy(void) +{ + hdestroy_r(&htable); +} + +void +hdestroy_r(struct hsearch_data *head) { struct internal_entry *ie; size_t idx; + void *p; + struct internal_head *table; - if (htable == NULL) + if (head == NULL) return; - for (idx = 0; idx < htablesize; idx++) { - while (!SLIST_EMPTY(&htable[idx])) { - ie = SLIST_FIRST(&htable[idx]); - SLIST_REMOVE_HEAD(&htable[idx], link); - free(ie->ent.key); + p = head->table; + head->table = NULL; + table = p; + + for (idx = 0; idx < head->size; idx++) { + while (!SLIST_EMPTY(&table[idx])) { + ie = SLIST_FIRST(&table[idx]); + SLIST_REMOVE_HEAD(&table[idx], link); free(ie); } } - free(htable); - htable = NULL; + free(table); } ENTRY * hsearch(ENTRY item, ACTION action) { - struct internal_head *head; + ENTRY *ep; + (void)hsearch_r(item, action, &ep, &htable); + return ep; +} + +int +hsearch_r(ENTRY item, ACTION action, ENTRY **itemp, struct hsearch_data *head) +{ + struct internal_head *table, *chain; struct internal_entry *ie; uint32_t hashval; size_t len; + void *p; + + p = head->table; + table = p; len = strlen(item.key); hashval = (*__default_hash)(item.key, len); - head = &htable[hashval & (htablesize - 1)]; - ie = SLIST_FIRST(head); + chain = &table[hashval & (head->size - 1)]; + ie = SLIST_FIRST(chain); while (ie != NULL) { if (strcmp(ie->ent.key, item.key) == 0) break; ie = SLIST_NEXT(ie, link); } - if (ie != NULL) - return &ie->ent; - else if (action == FIND) - return NULL; + if (ie != NULL) { + *itemp = &ie->ent; + return 1; + } else if (action == FIND) { + *itemp = NULL; + errno = ESRCH; + return 1; + } ie = malloc(sizeof *ie); if (ie == NULL) - return NULL; + return 0; ie->ent.key = item.key; ie->ent.data = item.data; - SLIST_INSERT_HEAD(head, ie, link); - return &ie->ent; + SLIST_INSERT_HEAD(chain, ie, link); + *itemp = &ie->ent; + head->filled++; + return 1; } diff --git a/lib/libc/stdlib/strfmon.3 b/lib/libc/stdlib/strfmon.3 index f82dfa30290..47f7131b677 100644 --- a/lib/libc/stdlib/strfmon.3 +++ b/lib/libc/stdlib/strfmon.3 @@ -171,10 +171,10 @@ function conforms to The .Fn strfmon function was implemented by -.An Alexey Zelkin Aq phantom@FreeBSD.org . +.An Alexey Zelkin Aq Mt phantom@FreeBSD.org . .Pp This manual page was written by -.An Jeroen Ruigrok van der Werven Aq asmodai@FreeBSD.org +.An Jeroen Ruigrok van der Werven Aq Mt asmodai@FreeBSD.org based on the standards' text. .Sh BUGS The diff --git a/lib/libc/stdlib/strfmon.c b/lib/libc/stdlib/strfmon.c index b82797dc6d1..689c78b8bff 100644 --- a/lib/libc/stdlib/strfmon.c +++ b/lib/libc/stdlib/strfmon.c @@ -526,7 +526,6 @@ __format_grouped_double(double value, int *flags, char *rslt; char *avalue; int avalue_size; - char fmt[32]; size_t bufsize; char *bufend; @@ -567,14 +566,13 @@ __format_grouped_double(double value, int *flags, left_prec += get_groups(left_prec, grouping); /* convert to string */ - snprintf(fmt, sizeof(fmt), "%%%d.%df", left_prec + right_prec + 1, - right_prec); - avalue_size = asprintf(&avalue, fmt, value); + avalue_size = asprintf(&avalue, "%*.*f", left_prec + right_prec + 1, + right_prec, value); if (avalue_size < 0) return (NULL); /* make sure that we've enough space for result string */ - bufsize = strlen(avalue)*2+1; + bufsize = avalue_size * 2 + 1; rslt = calloc(1, bufsize); if (rslt == NULL) { free(avalue); diff --git a/lib/libc/stdlib/tsearch.c b/lib/libc/stdlib/tsearch.c index 149c2bb00f1..16bbf7c2587 100644 --- a/lib/libc/stdlib/tsearch.c +++ b/lib/libc/stdlib/tsearch.c @@ -1,4 +1,4 @@ -/* $NetBSD: tsearch.c,v 1.3 1999/09/16 11:45:37 lukem Exp $ */ +/* $NetBSD: tsearch.c,v 1.7 2012/06/25 22:32:45 abs Exp $ */ /* * Tree search generalized from Knuth (6.2.2) Algorithm T just like @@ -14,7 +14,7 @@ #include #if 0 #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: tsearch.c,v 1.3 1999/09/16 11:45:37 lukem Exp $"); +__RCSID("$NetBSD: tsearch.c,v 1.7 2012/06/25 22:32:45 abs Exp $"); #endif /* LIBC_SCCS and not lint */ #endif __FBSDID("$FreeBSD$"); @@ -25,10 +25,8 @@ __FBSDID("$FreeBSD$"); /* find or insert datum into search tree */ void * -tsearch(vkey, vrootp, compar) - const void *vkey; /* key to be located */ - void **vrootp; /* address of tree root */ - int (*compar)(const void *, const void *); +tsearch(const void *vkey, void **vrootp, + int (*compar)(const void *, const void *)) { node_t *q; node_t **rootp = (node_t **)vrootp; @@ -50,8 +48,7 @@ tsearch(vkey, vrootp, compar) q = malloc(sizeof(node_t)); /* T5: key not found */ if (q != 0) { /* make new node */ *rootp = q; /* link new node to old */ - /* LINTED const castaway ok */ - q->key = (void *)vkey; /* initialize new node */ + q->key = __DECONST(void *, vkey);/* initialize new node */ q->llink = q->rlink = NULL; } return q; diff --git a/lib/libc/stdlib/twalk.c b/lib/libc/stdlib/twalk.c index 55f220f3875..7acee414d11 100644 --- a/lib/libc/stdlib/twalk.c +++ b/lib/libc/stdlib/twalk.c @@ -1,4 +1,4 @@ -/* $NetBSD: twalk.c,v 1.1 1999/02/22 10:33:16 christos Exp $ */ +/* $NetBSD: twalk.c,v 1.4 2012/03/20 16:38:45 matt Exp $ */ /* * Tree search generalized from Knuth (6.2.2) Algorithm T just like @@ -14,7 +14,7 @@ #include #if 0 #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: twalk.c,v 1.1 1999/02/22 10:33:16 christos Exp $"); +__RCSID("$NetBSD: twalk.c,v 1.4 2012/03/20 16:38:45 matt Exp $"); #endif /* LIBC_SCCS and not lint */ #endif __FBSDID("$FreeBSD$"); @@ -23,15 +23,12 @@ __FBSDID("$FreeBSD$"); #include #include -static void trecurse(const node_t *, - void (*action)(const void *, VISIT, int), int level); +typedef void (*cmp_fn_t)(const void *, VISIT, int); /* Walk the nodes of a tree */ static void -trecurse(root, action, level) - const node_t *root; /* Root of the tree to be walked */ - void (*action)(const void *, VISIT, int); - int level; +trecurse(const node_t *root, /* Root of the tree to be walked */ + cmp_fn_t action, int level) { if (root->llink == NULL && root->rlink == NULL) @@ -49,9 +46,7 @@ trecurse(root, action, level) /* Walk the nodes of a tree */ void -twalk(vroot, action) - const void *vroot; /* Root of the tree to be walked */ - void (*action)(const void *, VISIT, int); +twalk(const void *vroot, cmp_fn_t action) /* Root of the tree to be walked */ { if (vroot != NULL && action != NULL) trecurse(vroot, action, 0); diff --git a/lib/libc/stdtime/strftime.3 b/lib/libc/stdtime/strftime.3 index 0ed023b2cb3..5847a6b7267 100644 --- a/lib/libc/stdtime/strftime.3 +++ b/lib/libc/stdtime/strftime.3 @@ -248,7 +248,7 @@ function conforms to .St -isoC with a lot of extensions including -.Ql %C , +.Ql \&%C , .Ql \&%D , .Ql %E* , .Ql %e , diff --git a/lib/libc/stdtime/strftime.c b/lib/libc/stdtime/strftime.c index 4ad0bc4352a..898101136ea 100644 --- a/lib/libc/stdtime/strftime.c +++ b/lib/libc/stdtime/strftime.c @@ -24,9 +24,9 @@ #ifndef NOID static const char elsieid[] = "@(#)strftime.3 8.3"; /* -** Based on the UCB version with the ID appearing below. -** This is ANSIish only when "multibyte character == plain character". -*/ + * Based on the UCB version with the ID appearing below. + * This is ANSIish only when "multibyte character == plain character". + */ #endif /* !defined NOID */ #endif /* !defined lint */ @@ -46,10 +46,10 @@ __FBSDID("$FreeBSD$"); #include "timelocal.h" static char * _add(const char *, char *, const char *); -static char * _conv(int, const char *, char *, const char *); +static char * _conv(int, const char *, char *, const char *, locale_t); static char * _fmt(const char *, const struct tm *, char *, const char *, int *, locale_t); -static char * _yconv(int, int, int, int, char *, const char *); +static char * _yconv(int, int, int, int, char *, const char *, locale_t); extern char * tzname[]; @@ -57,32 +57,32 @@ extern char * tzname[]; #define YEAR_2000_NAME "CHECK_STRFTIME_FORMATS_FOR_TWO_DIGIT_YEARS" #endif /* !defined YEAR_2000_NAME */ -#define IN_NONE 0 -#define IN_SOME 1 -#define IN_THIS 2 -#define IN_ALL 3 +#define IN_NONE 0 +#define IN_SOME 1 +#define IN_THIS 2 +#define IN_ALL 3 -#define PAD_DEFAULT 0 -#define PAD_LESS 1 -#define PAD_SPACE 2 -#define PAD_ZERO 3 +#define PAD_DEFAULT 0 +#define PAD_LESS 1 +#define PAD_SPACE 2 +#define PAD_ZERO 3 static const char fmt_padding[][4][5] = { /* DEFAULT, LESS, SPACE, ZERO */ -#define PAD_FMT_MONTHDAY 0 -#define PAD_FMT_HMS 0 -#define PAD_FMT_CENTURY 0 -#define PAD_FMT_SHORTYEAR 0 -#define PAD_FMT_MONTH 0 -#define PAD_FMT_WEEKOFYEAR 0 -#define PAD_FMT_DAYOFMONTH 0 +#define PAD_FMT_MONTHDAY 0 +#define PAD_FMT_HMS 0 +#define PAD_FMT_CENTURY 0 +#define PAD_FMT_SHORTYEAR 0 +#define PAD_FMT_MONTH 0 +#define PAD_FMT_WEEKOFYEAR 0 +#define PAD_FMT_DAYOFMONTH 0 { "%02d", "%d", "%2d", "%02d" }, -#define PAD_FMT_SDAYOFMONTH 1 -#define PAD_FMT_SHMS 1 +#define PAD_FMT_SDAYOFMONTH 1 +#define PAD_FMT_SHMS 1 { "%2d", "%d", "%2d", "%02d" }, #define PAD_FMT_DAYOFYEAR 2 { "%03d", "%d", "%3d", "%03d" }, -#define PAD_FMT_YEAR 3 +#define PAD_FMT_YEAR 3 { "%04d", "%d", "%4d", "%04d" } }; @@ -101,20 +101,20 @@ strftime_l(char * __restrict s, size_t maxsize, const char * __restrict format, if (warn != IN_NONE && getenv(YEAR_2000_NAME) != NULL) { (void) fprintf_l(stderr, loc, "\n"); if (format == NULL) - (void) fprintf_l(stderr, loc, "NULL strftime format "); + (void) fputs("NULL strftime format ", stderr); else (void) fprintf_l(stderr, loc, "strftime format \"%s\" ", format); - (void) fprintf_l(stderr, loc, "yields only two digits of years in "); + (void) fputs("yields only two digits of years in ", stderr); if (warn == IN_SOME) - (void) fprintf_l(stderr, loc, "some locales"); + (void) fputs("some locales", stderr); else if (warn == IN_THIS) - (void) fprintf_l(stderr, loc, "the current locale"); - else (void) fprintf_l(stderr, loc, "all locales"); - (void) fprintf_l(stderr, loc, "\n"); + (void) fputs("the current locale", stderr); + else (void) fputs("all locales", stderr); + (void) fputs("\n", stderr); } #endif /* !defined NO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU */ if (p == s + maxsize) - return 0; + return (0); *p = '\0'; return p - s; } @@ -176,14 +176,14 @@ locale_t loc; continue; case 'C': /* - ** %C used to do a... - ** _fmt("%a %b %e %X %Y", t); - ** ...whereas now POSIX 1003.2 calls for - ** something completely different. - ** (ado, 1993-05-24) - */ + * %C used to do a... + * _fmt("%a %b %e %X %Y", t); + * ...whereas now POSIX 1003.2 calls for + * something completely different. + * (ado, 1993-05-24) + */ pt = _yconv(t->tm_year, TM_YEAR_BASE, 1, 0, - pt, ptlim); + pt, ptlim, loc); continue; case 'c': { @@ -200,8 +200,9 @@ locale_t loc; pt = _fmt("%m/%d/%y", t, pt, ptlim, warnp, loc); continue; case 'd': - pt = _conv(t->tm_mday, fmt_padding[PAD_FMT_DAYOFMONTH][PadIndex], - pt, ptlim); + pt = _conv(t->tm_mday, + fmt_padding[PAD_FMT_DAYOFMONTH][PadIndex], + pt, ptlim, loc); continue; case 'E': if (Ealternative || Oalternative) @@ -210,54 +211,57 @@ locale_t loc; goto label; case 'O': /* - ** C99 locale modifiers. - ** The sequences - ** %Ec %EC %Ex %EX %Ey %EY - ** %Od %oe %OH %OI %Om %OM - ** %OS %Ou %OU %OV %Ow %OW %Oy - ** are supposed to provide alternate - ** representations. - ** - ** FreeBSD extension - ** %OB - */ + * C99 locale modifiers. + * The sequences + * %Ec %EC %Ex %EX %Ey %EY + * %Od %oe %OH %OI %Om %OM + * %OS %Ou %OU %OV %Ow %OW %Oy + * are supposed to provide alternate + * representations. + * + * FreeBSD extension + * %OB + */ if (Ealternative || Oalternative) break; Oalternative++; goto label; case 'e': pt = _conv(t->tm_mday, - fmt_padding[PAD_FMT_SDAYOFMONTH][PadIndex], pt, ptlim); + fmt_padding[PAD_FMT_SDAYOFMONTH][PadIndex], + pt, ptlim, loc); continue; case 'F': pt = _fmt("%Y-%m-%d", t, pt, ptlim, warnp, loc); continue; case 'H': pt = _conv(t->tm_hour, fmt_padding[PAD_FMT_HMS][PadIndex], - pt, ptlim); + pt, ptlim, loc); continue; case 'I': pt = _conv((t->tm_hour % 12) ? (t->tm_hour % 12) : 12, - fmt_padding[PAD_FMT_HMS][PadIndex], pt, ptlim); + fmt_padding[PAD_FMT_HMS][PadIndex], + pt, ptlim, loc); continue; case 'j': pt = _conv(t->tm_yday + 1, - fmt_padding[PAD_FMT_DAYOFYEAR][PadIndex], pt, ptlim); + fmt_padding[PAD_FMT_DAYOFYEAR][PadIndex], + pt, ptlim, loc); continue; case 'k': /* - ** This used to be... - ** _conv(t->tm_hour % 12 ? - ** t->tm_hour % 12 : 12, 2, ' '); - ** ...and has been changed to the below to - ** match SunOS 4.1.1 and Arnold Robbins' - ** strftime version 3.0. That is, "%k" and - ** "%l" have been swapped. - ** (ado, 1993-05-24) - */ + * This used to be... + * _conv(t->tm_hour % 12 ? + * t->tm_hour % 12 : 12, 2, ' '); + * ...and has been changed to the below to + * match SunOS 4.1.1 and Arnold Robbins' + * strftime version 3.0. That is, "%k" and + * "%l" have been swapped. + * (ado, 1993-05-24) + */ pt = _conv(t->tm_hour, fmt_padding[PAD_FMT_SHMS][PadIndex], - pt, ptlim); + pt, ptlim, loc); continue; #ifdef KITCHEN_SINK case 'K': @@ -269,33 +273,34 @@ locale_t loc; #endif /* defined KITCHEN_SINK */ case 'l': /* - ** This used to be... - ** _conv(t->tm_hour, 2, ' '); - ** ...and has been changed to the below to - ** match SunOS 4.1.1 and Arnold Robbin's - ** strftime version 3.0. That is, "%k" and - ** "%l" have been swapped. - ** (ado, 1993-05-24) - */ + * This used to be... + * _conv(t->tm_hour, 2, ' '); + * ...and has been changed to the below to + * match SunOS 4.1.1 and Arnold Robbin's + * strftime version 3.0. That is, "%k" and + * "%l" have been swapped. + * (ado, 1993-05-24) + */ pt = _conv((t->tm_hour % 12) ? (t->tm_hour % 12) : 12, - fmt_padding[PAD_FMT_SHMS][PadIndex], pt, ptlim); + fmt_padding[PAD_FMT_SHMS][PadIndex], + pt, ptlim, loc); continue; case 'M': pt = _conv(t->tm_min, fmt_padding[PAD_FMT_HMS][PadIndex], - pt, ptlim); + pt, ptlim, loc); continue; case 'm': pt = _conv(t->tm_mon + 1, - fmt_padding[PAD_FMT_MONTH][PadIndex], pt, ptlim); + fmt_padding[PAD_FMT_MONTH][PadIndex], + pt, ptlim, loc); continue; case 'n': pt = _add("\n", pt, ptlim); continue; case 'p': pt = _add((t->tm_hour >= (HOURSPERDAY / 2)) ? - tptr->pm : - tptr->am, + tptr->pm : tptr->am, pt, ptlim); continue; case 'R': @@ -307,7 +312,7 @@ locale_t loc; continue; case 'S': pt = _conv(t->tm_sec, fmt_padding[PAD_FMT_HMS][PadIndex], - pt, ptlim); + pt, ptlim, loc); continue; case 's': { @@ -319,9 +324,9 @@ locale_t loc; tm = *t; mkt = mktime(&tm); if (TYPE_SIGNED(time_t)) - (void) sprintf(buf, "%ld", + (void) sprintf_l(buf, loc, "%ld", (long) mkt); - else (void) sprintf(buf, "%lu", + else (void) sprintf_l(buf, loc, "%lu", (unsigned long) mkt); pt = _add(buf, pt, ptlim); } @@ -335,40 +340,41 @@ locale_t loc; case 'U': pt = _conv((t->tm_yday + DAYSPERWEEK - t->tm_wday) / DAYSPERWEEK, - fmt_padding[PAD_FMT_WEEKOFYEAR][PadIndex], pt, ptlim); + fmt_padding[PAD_FMT_WEEKOFYEAR][PadIndex], + pt, ptlim, loc); continue; case 'u': /* - ** From Arnold Robbins' strftime version 3.0: - ** "ISO 8601: Weekday as a decimal number - ** [1 (Monday) - 7]" - ** (ado, 1993-05-24) - */ + * From Arnold Robbins' strftime version 3.0: + * "ISO 8601: Weekday as a decimal number + * [1 (Monday) - 7]" + * (ado, 1993-05-24) + */ pt = _conv((t->tm_wday == 0) ? DAYSPERWEEK : t->tm_wday, - "%d", pt, ptlim); + "%d", pt, ptlim, loc); continue; case 'V': /* ISO 8601 week number */ case 'G': /* ISO 8601 year (four digits) */ case 'g': /* ISO 8601 year (two digits) */ /* -** From Arnold Robbins' strftime version 3.0: "the week number of the -** year (the first Monday as the first day of week 1) as a decimal number -** (01-53)." -** (ado, 1993-05-24) -** -** From "http://www.ft.uni-erlangen.de/~mskuhn/iso-time.html" by Markus Kuhn: -** "Week 01 of a year is per definition the first week which has the -** Thursday in this year, which is equivalent to the week which contains -** the fourth day of January. In other words, the first week of a new year -** is the week which has the majority of its days in the new year. Week 01 -** might also contain days from the previous year and the week before week -** 01 of a year is the last week (52 or 53) of the previous year even if -** it contains days from the new year. A week starts with Monday (day 1) -** and ends with Sunday (day 7). For example, the first week of the year -** 1997 lasts from 1996-12-30 to 1997-01-05..." -** (ado, 1996-01-02) -*/ + * From Arnold Robbins' strftime version 3.0: "the week number of the + * year (the first Monday as the first day of week 1) as a decimal number + * (01-53)." + * (ado, 1993-05-24) + * + * From "http://www.ft.uni-erlangen.de/~mskuhn/iso-time.html" by Markus Kuhn: + * "Week 01 of a year is per definition the first week which has the + * Thursday in this year, which is equivalent to the week which contains + * the fourth day of January. In other words, the first week of a new year + * is the week which has the majority of its days in the new year. Week 01 + * might also contain days from the previous year and the week before week + * 01 of a year is the last week (52 or 53) of the previous year even if + * it contains days from the new year. A week starts with Monday (day 1) + * and ends with Sunday (day 7). For example, the first week of the year + * 1997 lasts from 1996-12-30 to 1997-01-05..." + * (ado, 1996-01-02) + */ { int year; int base; @@ -389,15 +395,15 @@ locale_t loc; DAYSPERLYEAR : DAYSPERNYEAR; /* - ** What yday (-3 ... 3) does - ** the ISO year begin on? - */ + * What yday (-3 ... 3) does + * the ISO year begin on? + */ bot = ((yday + 11 - wday) % DAYSPERWEEK) - 3; /* - ** What yday does the NEXT - ** ISO year begin on? - */ + * What yday does the NEXT + * ISO year begin on? + */ top = bot - (len % DAYSPERWEEK); if (top < -3) @@ -427,21 +433,21 @@ locale_t loc; #endif /* defined XPG4_1994_04_09 */ if (*format == 'V') pt = _conv(w, fmt_padding[PAD_FMT_WEEKOFYEAR][PadIndex], - pt, ptlim); + pt, ptlim, loc); else if (*format == 'g') { *warnp = IN_ALL; pt = _yconv(year, base, 0, 1, - pt, ptlim); + pt, ptlim, loc); } else pt = _yconv(year, base, 1, 1, - pt, ptlim); + pt, ptlim, loc); } continue; case 'v': /* - ** From Arnold Robbins' strftime version 3.0: - ** "date as dd-bbb-YYYY" - ** (ado, 1993-05-24) - */ + * From Arnold Robbins' strftime version 3.0: + * "date as dd-bbb-YYYY" + * (ado, 1993-05-24) + */ pt = _fmt("%e-%b-%Y", t, pt, ptlim, warnp, loc); continue; case 'W': @@ -449,10 +455,11 @@ locale_t loc; (t->tm_wday ? (t->tm_wday - 1) : (DAYSPERWEEK - 1))) / DAYSPERWEEK, - fmt_padding[PAD_FMT_WEEKOFYEAR][PadIndex], pt, ptlim); + fmt_padding[PAD_FMT_WEEKOFYEAR][PadIndex], + pt, ptlim, loc); continue; case 'w': - pt = _conv(t->tm_wday, "%d", pt, ptlim); + pt = _conv(t->tm_wday, "%d", pt, ptlim, loc); continue; case 'X': pt = _fmt(tptr->X_fmt, t, pt, ptlim, warnp, loc); @@ -471,11 +478,11 @@ locale_t loc; case 'y': *warnp = IN_ALL; pt = _yconv(t->tm_year, TM_YEAR_BASE, 0, 1, - pt, ptlim); + pt, ptlim, loc); continue; case 'Y': pt = _yconv(t->tm_year, TM_YEAR_BASE, 1, 1, - pt, ptlim); + pt, ptlim, loc); continue; case 'Z': #ifdef TM_ZONE @@ -487,10 +494,10 @@ locale_t loc; pt = _add(tzname[t->tm_isdst != 0], pt, ptlim); /* - ** C99 says that %Z must be replaced by the - ** empty string if the time zone is not - ** determinable. - */ + * C99 says that %Z must be replaced by the + * empty string if the time zone is not + * determinable. + */ continue; case 'z': { @@ -503,24 +510,24 @@ locale_t loc; diff = t->TM_GMTOFF; #else /* !defined TM_GMTOFF */ /* - ** C99 says that the UTC offset must - ** be computed by looking only at - ** tm_isdst. This requirement is - ** incorrect, since it means the code - ** must rely on magic (in this case - ** altzone and timezone), and the - ** magic might not have the correct - ** offset. Doing things correctly is - ** tricky and requires disobeying C99; - ** see GNU C strftime for details. - ** For now, punt and conform to the - ** standard, even though it's incorrect. - ** - ** C99 says that %z must be replaced by the - ** empty string if the time zone is not - ** determinable, so output nothing if the - ** appropriate variables are not available. - */ + * C99 says that the UTC offset must + * be computed by looking only at + * tm_isdst. This requirement is + * incorrect, since it means the code + * must rely on magic (in this case + * altzone and timezone), and the + * magic might not have the correct + * offset. Doing things correctly is + * tricky and requires disobeying C99; + * see GNU C strftime for details. + * For now, punt and conform to the + * standard, even though it's incorrect. + * + * C99 says that %z must be replaced by the + * empty string if the time zone is not + * determinable, so output nothing if the + * appropriate variables are not available. + */ if (t->tm_isdst == 0) #ifdef USG_COMPAT diff = -timezone; @@ -537,13 +544,15 @@ locale_t loc; if (diff < 0) { sign = "-"; diff = -diff; - } else sign = "+"; + } else + sign = "+"; pt = _add(sign, pt, ptlim); diff /= SECSPERMIN; diff = (diff / MINSPERHOUR) * 100 + (diff % MINSPERHOUR); pt = _conv(diff, - fmt_padding[PAD_FMT_YEAR][PadIndex], pt, ptlim); + fmt_padding[PAD_FMT_YEAR][PadIndex], + pt, ptlim, loc); } continue; case '+': @@ -567,10 +576,10 @@ locale_t loc; goto label; case '%': /* - ** X311J/88-090 (4.12.3.5): if conversion char is - ** undefined, behavior is undefined. Print out the - ** character itself as printf(3) also does. - */ + * X311J/88-090 (4.12.3.5): if conversion char is + * undefined, behavior is undefined. Print out the + * character itself as printf(3) also does. + */ default: break; } @@ -579,19 +588,20 @@ locale_t loc; break; *pt++ = *format; } - return pt; + return (pt); } static char * -_conv(n, format, pt, ptlim) +_conv(n, format, pt, ptlim, loc) const int n; const char * const format; char * const pt; const char * const ptlim; +locale_t loc; { char buf[INT_STRLEN_MAXIMUM(int) + 1]; - (void) sprintf(buf, format, n); + (void) sprintf_l(buf, loc, format, n); return _add(buf, pt, ptlim); } @@ -603,30 +613,31 @@ const char * const ptlim; { while (pt < ptlim && (*pt = *str++) != '\0') ++pt; - return pt; + return (pt); } /* -** POSIX and the C Standard are unclear or inconsistent about -** what %C and %y do if the year is negative or exceeds 9999. -** Use the convention that %C concatenated with %y yields the -** same output as %Y, and that %Y contains at least 4 bytes, -** with more only if necessary. -*/ + * POSIX and the C Standard are unclear or inconsistent about + * what %C and %y do if the year is negative or exceeds 9999. + * Use the convention that %C concatenated with %y yields the + * same output as %Y, and that %Y contains at least 4 bytes, + * with more only if necessary. + */ static char * -_yconv(a, b, convert_top, convert_yy, pt, ptlim) +_yconv(a, b, convert_top, convert_yy, pt, ptlim, loc) const int a; const int b; const int convert_top; const int convert_yy; char * pt; const char * const ptlim; +locale_t loc; { register int lead; register int trail; -#define DIVISOR 100 +#define DIVISOR 100 trail = a % DIVISOR + b % DIVISOR; lead = a / DIVISOR + b / DIVISOR + trail / DIVISOR; trail %= DIVISOR; @@ -640,9 +651,10 @@ const char * const ptlim; if (convert_top) { if (lead == 0 && trail < 0) pt = _add("-0", pt, ptlim); - else pt = _conv(lead, "%02d", pt, ptlim); + else pt = _conv(lead, "%02d", pt, ptlim, loc); } if (convert_yy) - pt = _conv(((trail < 0) ? -trail : trail), "%02d", pt, ptlim); - return pt; + pt = _conv(((trail < 0) ? -trail : trail), "%02d", pt, + ptlim, loc); + return (pt); } diff --git a/lib/libc/stdtime/strptime.c b/lib/libc/stdtime/strptime.c index fb94dcd0df4..2333ab47e76 100644 --- a/lib/libc/stdtime/strptime.c +++ b/lib/libc/stdtime/strptime.c @@ -1,25 +1,6 @@ -/* - * Powerdog Industries kindly requests feedback from anyone modifying - * this function: - * - * Date: Thu, 05 Jun 1997 23:17:17 -0400 - * From: Kevin Ruddy - * To: James FitzGibbon - * Subject: Re: Use of your strptime(3) code (fwd) - * - * The reason for the "no mod" clause was so that modifications would - * come back and we could integrate them and reissue so that a wider - * audience could use it (thereby spreading the wealth). This has - * made it possible to get strptime to work on many operating systems. - * I'm not sure why that's "plain unacceptable" to the FreeBSD team. - * - * Anyway, you can change it to "with or without modification" as - * you see fit. Enjoy. - * - * Kevin Ruddy - * Powerdog Industries, Inc. - */ -/* +/*- + * Copyright (c) 2014 Gary Mills + * Copyright 2011, Nexenta Systems, Inc. All rights reserved. * Copyright (c) 1994 Powerdog Industries. All rights reserved. * * Copyright (c) 2011 The FreeBSD Foundation @@ -36,12 +17,6 @@ * 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 Powerdog Industries. - * 4. The name of Powerdog Industries may not be used to endorse or - * promote products derived from this software without specific prior - * written permission. * * THIS SOFTWARE IS PROVIDED BY POWERDOG INDUSTRIES ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -54,6 +29,10 @@ * 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. + * + * The views and conclusions contained in the software and documentation + * are those of the authors and should not be interpreted as representing + * official policies, either expressed or implied, of Powerdog Industries. */ #include @@ -79,7 +58,7 @@ __FBSDID("$FreeBSD$"); static char * _strptime(const char *, const char *, struct tm *, int *, locale_t); -#define asizeof(a) (sizeof (a) / sizeof ((a)[0])) +#define asizeof(a) (sizeof (a) / sizeof ((a)[0])) static char * _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, @@ -87,8 +66,7 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, { char c; const char *ptr; - int i, - len; + int i, len; int Ealternative, Oalternative; struct lc_time_T *tptr = __get_current_time_locale(locale); @@ -105,7 +83,7 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, isspace_l((unsigned char)*buf, locale)) buf++; else if (c != *buf++) - return 0; + return (NULL); continue; } @@ -117,18 +95,18 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, case 0: case '%': if (*buf++ != '%') - return 0; + return (NULL); break; case '+': buf = _strptime(buf, tptr->date_fmt, tm, GMTp, locale); - if (buf == 0) - return 0; + if (buf == NULL) + return (NULL); break; case 'C': if (!isdigit_l((unsigned char)*buf, locale)) - return 0; + return (NULL); /* XXX This will break for 3-digit centuries. */ len = 2; @@ -139,21 +117,21 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, len--; } if (i < 19) - return 0; + return (NULL); tm->tm_year = i * 100 - 1900; break; case 'c': buf = _strptime(buf, tptr->c_fmt, tm, GMTp, locale); - if (buf == 0) - return 0; + if (buf == NULL) + return (NULL); break; case 'D': buf = _strptime(buf, "%m/%d/%y", tm, GMTp, locale); - if (buf == 0) - return 0; + if (buf == NULL) + return (NULL); break; case 'E': @@ -170,43 +148,43 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, case 'F': buf = _strptime(buf, "%Y-%m-%d", tm, GMTp, locale); - if (buf == 0) - return 0; + if (buf == NULL) + return (NULL); break; case 'R': buf = _strptime(buf, "%H:%M", tm, GMTp, locale); - if (buf == 0) - return 0; + if (buf == NULL) + return (NULL); break; case 'r': buf = _strptime(buf, tptr->ampm_fmt, tm, GMTp, locale); - if (buf == 0) - return 0; + if (buf == NULL) + return (NULL); break; case 'T': buf = _strptime(buf, "%H:%M:%S", tm, GMTp, locale); - if (buf == 0) - return 0; + if (buf == NULL) + return (NULL); break; case 'X': buf = _strptime(buf, tptr->X_fmt, tm, GMTp, locale); - if (buf == 0) - return 0; + if (buf == NULL) + return (NULL); break; case 'x': buf = _strptime(buf, tptr->x_fmt, tm, GMTp, locale); - if (buf == 0) - return 0; + if (buf == NULL) + return (NULL); break; case 'j': if (!isdigit_l((unsigned char)*buf, locale)) - return 0; + return (NULL); len = 3; for (i = 0; len && *buf != 0 && @@ -216,7 +194,7 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, len--; } if (i < 1 || i > 366) - return 0; + return (NULL); tm->tm_yday = i - 1; break; @@ -228,7 +206,7 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, break; if (!isdigit_l((unsigned char)*buf, locale)) - return 0; + return (NULL); len = 2; for (i = 0; len && *buf != 0 && @@ -240,19 +218,14 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, if (c == 'M') { if (i > 59) - return 0; + return (NULL); tm->tm_min = i; } else { if (i > 60) - return 0; + return (NULL); tm->tm_sec = i; } - if (*buf != 0 && - isspace_l((unsigned char)*buf, locale)) - while (*ptr != 0 && - !isspace_l((unsigned char)*ptr, locale)) - ptr++; break; case 'H': @@ -268,7 +241,7 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, * digits if used incorrectly. */ if (!isdigit_l((unsigned char)*buf, locale)) - return 0; + return (NULL); len = 2; for (i = 0; len && *buf != 0 && @@ -279,17 +252,12 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, } if (c == 'H' || c == 'k') { if (i > 23) - return 0; + return (NULL); } else if (i > 12) - return 0; + return (NULL); tm->tm_hour = i; - if (*buf != 0 && - isspace_l((unsigned char)*buf, locale)) - while (*ptr != 0 && - !isspace_l((unsigned char)*ptr, locale)) - ptr++; break; case 'p': @@ -300,7 +268,7 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, len = strlen(tptr->am); if (strncasecmp_l(buf, tptr->am, len, locale) == 0) { if (tm->tm_hour > 12) - return 0; + return (NULL); if (tm->tm_hour == 12) tm->tm_hour = 0; buf += len; @@ -310,14 +278,14 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, len = strlen(tptr->pm); if (strncasecmp_l(buf, tptr->pm, len, locale) == 0) { if (tm->tm_hour > 12) - return 0; + return (NULL); if (tm->tm_hour != 12) tm->tm_hour += 12; buf += len; break; } - return 0; + return (NULL); case 'A': case 'a': @@ -332,7 +300,7 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, break; } if (i == asizeof(tptr->weekday)) - return 0; + return (NULL); tm->tm_wday = i; buf += len; @@ -347,7 +315,7 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, * range for now. */ if (!isdigit_l((unsigned char)*buf, locale)) - return 0; + return (NULL); len = 2; for (i = 0; len && *buf != 0 && @@ -357,44 +325,43 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, len--; } if (i > 53) - return 0; + return (NULL); - if (*buf != 0 && - isspace_l((unsigned char)*buf, locale)) - while (*ptr != 0 && - !isspace_l((unsigned char)*ptr, locale)) - ptr++; break; case 'w': if (!isdigit_l((unsigned char)*buf, locale)) - return 0; + return (NULL); i = *buf - '0'; if (i > 6) - return 0; + return (NULL); tm->tm_wday = i; - if (*buf != 0 && - isspace_l((unsigned char)*buf, locale)) - while (*ptr != 0 && - !isspace_l((unsigned char)*ptr, locale)) - ptr++; break; - case 'd': case 'e': /* - * The %e specifier is explicitly documented as not - * being zero-padded but there is no harm in allowing + * With %e format, our strftime(3) adds a blank space + * before single digits. + */ + if (*buf != 0 && + isspace_l((unsigned char)*buf, locale)) + buf++; + /* FALLTHROUGH */ + case 'd': + /* + * The %e specifier was once explicitly documented as + * not being zero-padded but was later changed to + * equivalent to %d. There is no harm in allowing * such padding. * * XXX The %e specifier may gobble one too many * digits if used incorrectly. */ if (!isdigit_l((unsigned char)*buf, locale)) - return 0; + return (NULL); len = 2; for (i = 0; len && *buf != 0 && @@ -404,15 +371,10 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, len--; } if (i > 31) - return 0; + return (NULL); tm->tm_mday = i; - if (*buf != 0 && - isspace_l((unsigned char)*buf, locale)) - while (*ptr != 0 && - !isspace_l((unsigned char)*ptr, locale)) - ptr++; break; case 'B': @@ -447,7 +409,7 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, } } if (i == asizeof(tptr->month)) - return 0; + return (NULL); tm->tm_mon = i; buf += len; @@ -455,7 +417,7 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, case 'm': if (!isdigit_l((unsigned char)*buf, locale)) - return 0; + return (NULL); len = 2; for (i = 0; len && *buf != 0 && @@ -465,15 +427,10 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, len--; } if (i < 1 || i > 12) - return 0; + return (NULL); tm->tm_mon = i - 1; - if (*buf != 0 && - isspace_l((unsigned char)*buf, locale)) - while (*ptr != 0 && - !isspace_l((unsigned char)*ptr, locale)) - ptr++; break; case 's': @@ -488,7 +445,7 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, n = strtol_l(buf, &cp, 10, locale); if (errno == ERANGE || (long)(t = n) != n) { errno = sverrno; - return 0; + return (NULL); } errno = sverrno; buf = cp; @@ -504,7 +461,7 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, break; if (!isdigit_l((unsigned char)*buf, locale)) - return 0; + return (NULL); len = (c == 'Y') ? 4 : 2; for (i = 0; len && *buf != 0 && @@ -518,15 +475,10 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, if (c == 'y' && i < 69) i += 100; if (i < 0) - return 0; + return (NULL); tm->tm_year = i; - if (*buf != 0 && - isspace_l((unsigned char)*buf, locale)) - while (*ptr != 0 && - !isspace_l((unsigned char)*ptr, locale)) - ptr++; break; case 'Z': @@ -549,7 +501,7 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, } else if (0 == strcmp(zonestr, tzname[1])) { tm->tm_isdst = 1; } else { - return 0; + return (NULL); } buf += cp - buf; } @@ -564,7 +516,7 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, if (*buf == '-') sign = -1; else - return 0; + return (NULL); } buf++; @@ -575,7 +527,7 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, i += *buf - '0'; buf++; } else - return 0; + return (NULL); } tm->tm_hour -= sign * (i / 100); @@ -583,9 +535,15 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, *GMTp = 1; } break; + + case 'n': + case 't': + while (isspace_l((unsigned char)*buf, locale)) + buf++; + break; } } - return (char *)buf; + return ((char *)buf); } diff --git a/lib/libc/stdtime/timelocal.c b/lib/libc/stdtime/timelocal.c index 3d9d096c749..362cec3958c 100644 --- a/lib/libc/stdtime/timelocal.c +++ b/lib/libc/stdtime/timelocal.c @@ -46,7 +46,7 @@ struct xlocale_time { struct xlocale_time __xlocale_global_time; -#define LCTIME_SIZE (sizeof(struct lc_time_T) / sizeof(char *)) +#define LCTIME_SIZE (sizeof(struct lc_time_T) / sizeof(char *)) static const struct lc_time_T _C_time_locale = { { diff --git a/lib/libc/string/Makefile.inc b/lib/libc/string/Makefile.inc index 9ad5cbb0c18..731f4fc9041 100644 --- a/lib/libc/string/Makefile.inc +++ b/lib/libc/string/Makefile.inc @@ -30,7 +30,7 @@ SYM_MAPS+= ${LIBC_SRCTOP}/string/Symbol.map MAN+= bcmp.3 bcopy.3 bstring.3 bzero.3 ffs.3 index.3 memccpy.3 memchr.3 \ memcmp.3 memcpy.3 memmem.3 memmove.3 memset.3 strcasecmp.3 strcat.3 \ - strchr.3 strcmp.3 strcoll.3 strcpy.3 strcspn.3 strdup.3 strerror.3 \ + strchr.3 strcmp.3 strcoll.3 strcpy.3 strdup.3 strerror.3 \ string.3 strlcpy.3 strlen.3 strmode.3 strpbrk.3 strsep.3 \ strspn.3 strstr.3 strtok.3 strxfrm.3 swab.3 wcscoll.3 wcstok.3 \ wcswidth.3 wcsxfrm.3 wmemchr.3 @@ -60,6 +60,7 @@ MLINKS+=strerror.3 perror.3 \ strerror.3 sys_nerr.3 MLINKS+=strlcpy.3 strlcat.3 MLINKS+=strlen.3 strnlen.3 +MLINKS+=strspn.3 strcspn.3 MLINKS+=strstr.3 strcasestr.3 \ strstr.3 strnstr.3 \ strstr.3 strcasestr_l.3 diff --git a/lib/libc/string/memmem.3 b/lib/libc/string/memmem.3 index 73c267c14c1..31cdf77135e 100644 --- a/lib/libc/string/memmem.3 +++ b/lib/libc/string/memmem.3 @@ -80,7 +80,7 @@ The function first appeared in .Fx 6.0 . .Sh AUTHORS -.An Pascal Gloor Aq pascal.gloor@spale.com +.An Pascal Gloor Aq Mt pascal.gloor@spale.com .Sh BUGS This function was broken in Linux libc up to and including version 5.0.9 and in GNU libc prior to version 2.1. diff --git a/lib/libc/string/strcasecmp.3 b/lib/libc/string/strcasecmp.3 index 1c8504214f4..4a13cc41d93 100644 --- a/lib/libc/string/strcasecmp.3 +++ b/lib/libc/string/strcasecmp.3 @@ -30,7 +30,7 @@ .\" @(#)strcasecmp.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd June 9, 1993 +.Dd May 29, 2014 .Dt STRCASECMP 3 .Os .Sh NAME @@ -45,7 +45,7 @@ .Fn strcasecmp "const char *s1" "const char *s2" .Ft int .Fn strncasecmp "const char *s1" "const char *s2" "size_t len" -.In string.h +.In strings.h .In xlocale.h .Ft int .Fn strcasecmp_l "const char *s1" "const char *s2" "locale_t loc" diff --git a/lib/libc/string/strerror.3 b/lib/libc/string/strerror.3 index 50b15553001..a47494fd078 100644 --- a/lib/libc/string/strerror.3 +++ b/lib/libc/string/strerror.3 @@ -172,7 +172,7 @@ The function was implemented in .Fx 4.4 by -.An Wes Peters Aq wes@FreeBSD.org . +.An Wes Peters Aq Mt wes@FreeBSD.org . .Sh BUGS The .Fn strerror diff --git a/lib/libc/string/strspn.3 b/lib/libc/string/strspn.3 index 2ba6a6b5575..542b190f641 100644 --- a/lib/libc/string/strspn.3 +++ b/lib/libc/string/strspn.3 @@ -32,11 +32,12 @@ .\" @(#)strspn.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd May 24, 2014 .Dt STRSPN 3 .Os .Sh NAME -.Nm strspn +.Nm strspn , +.Nm strcspn .Nd span a string .Sh LIBRARY .Lb libc @@ -44,6 +45,8 @@ .In string.h .Ft size_t .Fn strspn "const char *s" "const char *charset" +.Ft size_t +.Fn strcspn "const char *s" "const char *charset" .Sh DESCRIPTION The .Fn strspn @@ -54,22 +57,44 @@ as long as the characters from .Fa s occur in the null-terminated string .Fa charset . -In other words, it computes the string array index in -.Fa s +In other words, it computes the string array index of the first character of .Fa s which is not in .Fa charset , else the index of the first null character. +.Pp +The +.Fn strcspn +function +spans the initial part of the null-terminated string +.Fa s +as long as the characters from +.Fa s +.Sy do not +occur in the null-terminated string +.Fa charset +.Po it spans the +.Sy complement +of +.Fa charset +.Pc . +In other words, it computes the string array index +of the first character of +.Fa s +which is also in +.Fa charset , +else the index of the first null character. .Sh RETURN VALUES The .Fn strspn -function -returns the number of characters spanned. +and +.Fn strcspn +functions +return the number of characters spanned. .Sh SEE ALSO .Xr memchr 3 , .Xr strchr 3 , -.Xr strcspn 3 , .Xr strpbrk 3 , .Xr strrchr 3 , .Xr strsep 3 , @@ -79,6 +104,8 @@ returns the number of characters spanned. .Sh STANDARDS The .Fn strspn -function -conforms to +and +.Fn strcspn +functions +conform to .St -isoC . diff --git a/lib/libc/string/strtok.3 b/lib/libc/string/strtok.3 index 97a8b156b92..78c22655d4a 100644 --- a/lib/libc/string/strtok.3 +++ b/lib/libc/string/strtok.3 @@ -150,9 +150,8 @@ function conforms to .St -isoC . .Sh AUTHORS -.An Wes Peters , -Softweyr LLC: -.Aq wes@softweyr.com +.An Wes Peters Aq Mt wes@softweyr.com , +Softweyr LLC .Pp Based on the .Fx 3.0 diff --git a/lib/libc/sys/abort2.2 b/lib/libc/sys/abort2.2 index 4698c728384..ca31d74267f 100644 --- a/lib/libc/sys/abort2.2 +++ b/lib/libc/sys/abort2.2 @@ -108,6 +108,6 @@ system call first appeared in The .Fn abort2 system call was designed by -.An "Poul-Henning Kamp" Aq phk@FreeBSD.org . +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . It was implemented by -.An "Wojciech A. Koszek" Aq dunstan@freebsd.czest.pl . +.An Wojciech A. Koszek Aq Mt dunstan@freebsd.czest.pl . diff --git a/lib/libc/sys/aio_cancel.2 b/lib/libc/sys/aio_cancel.2 index 54e7b394fc8..3d9cbaf2ff4 100644 --- a/lib/libc/sys/aio_cancel.2 +++ b/lib/libc/sys/aio_cancel.2 @@ -109,8 +109,8 @@ appeared in .An -nosplit This manual page was originally written by -.An Wes Peters Aq wes@softweyr.com . -.An Christopher M Sedore Aq cmsedore@maxwell.syr.edu +.An Wes Peters Aq Mt wes@softweyr.com . +.An Christopher M Sedore Aq Mt cmsedore@maxwell.syr.edu updated it when .Fn aio_cancel was implemented for diff --git a/lib/libc/sys/aio_error.2 b/lib/libc/sys/aio_error.2 index f63a2dd06c2..03091461612 100644 --- a/lib/libc/sys/aio_error.2 +++ b/lib/libc/sys/aio_error.2 @@ -98,4 +98,4 @@ system call first appeared in .Sh AUTHORS This manual page was written by -.An Wes Peters Aq wes@softweyr.com . +.An Wes Peters Aq Mt wes@softweyr.com . diff --git a/lib/libc/sys/aio_mlock.2 b/lib/libc/sys/aio_mlock.2 index 386393f32b1..95055e8c42b 100644 --- a/lib/libc/sys/aio_mlock.2 +++ b/lib/libc/sys/aio_mlock.2 @@ -130,4 +130,4 @@ system call first appeared in .Fx 10.0 . .Sh AUTHORS The system call was introduced by -.An Gleb Smirnoff Aq glebius@FreeBSD.org . +.An Gleb Smirnoff Aq Mt glebius@FreeBSD.org . diff --git a/lib/libc/sys/aio_read.2 b/lib/libc/sys/aio_read.2 index ddf4f763023..65b5e10d75f 100644 --- a/lib/libc/sys/aio_read.2 +++ b/lib/libc/sys/aio_read.2 @@ -207,7 +207,7 @@ system call first appeared in .Sh AUTHORS This manual page was written by -.An Terry Lambert Aq terry@whistle.com . +.An Terry Lambert Aq Mt terry@whistle.com . .Sh BUGS Invalid information in .Fa iocb->_aiocb_private diff --git a/lib/libc/sys/aio_return.2 b/lib/libc/sys/aio_return.2 index 2034f9d0482..2ef6c25953f 100644 --- a/lib/libc/sys/aio_return.2 +++ b/lib/libc/sys/aio_return.2 @@ -99,4 +99,4 @@ system call first appeared in .Sh AUTHORS This manual page was written by -.An Wes Peters Aq wes@softweyr.com . +.An Wes Peters Aq Mt wes@softweyr.com . diff --git a/lib/libc/sys/aio_suspend.2 b/lib/libc/sys/aio_suspend.2 index 5859d1527a9..0ff25f51c5a 100644 --- a/lib/libc/sys/aio_suspend.2 +++ b/lib/libc/sys/aio_suspend.2 @@ -114,4 +114,4 @@ system call first appeared in .Sh AUTHORS This manual page was written by -.An Wes Peters Aq wes@softweyr.com . +.An Wes Peters Aq Mt wes@softweyr.com . diff --git a/lib/libc/sys/aio_waitcomplete.2 b/lib/libc/sys/aio_waitcomplete.2 index 5145f78118a..885b3d7fa48 100644 --- a/lib/libc/sys/aio_waitcomplete.2 +++ b/lib/libc/sys/aio_waitcomplete.2 @@ -134,4 +134,4 @@ system call first appeared in The .Fn aio_waitcomplete system call and this manual page were written by -.An Christopher M Sedore Aq cmsedore@maxwell.syr.edu . +.An Christopher M Sedore Aq Mt cmsedore@maxwell.syr.edu . diff --git a/lib/libc/sys/aio_write.2 b/lib/libc/sys/aio_write.2 index 291fd7154bf..080a6b8bbf5 100644 --- a/lib/libc/sys/aio_write.2 +++ b/lib/libc/sys/aio_write.2 @@ -202,7 +202,7 @@ system call first appeared in .Fx 3.0 . .Sh AUTHORS This manual page was written by -.An Wes Peters Aq wes@softweyr.com . +.An Wes Peters Aq Mt wes@softweyr.com . .Sh BUGS Invalid information in .Fa iocb->_aiocb_private diff --git a/lib/libc/sys/bind.2 b/lib/libc/sys/bind.2 index 896b0053cad..c0f84110ab0 100644 --- a/lib/libc/sys/bind.2 +++ b/lib/libc/sys/bind.2 @@ -28,7 +28,7 @@ .\" @(#)bind.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd June 26, 2014 .Dt BIND 2 .Os .Sh NAME @@ -85,6 +85,10 @@ is not a valid descriptor. .It Bq Er EINVAL The socket is already bound to an address, and the protocol does not support binding to a new address; or the socket has been shut down. +.It Bq Er EINVAL +The +.Fa addrlen +argument is not a valid length for the address family. .It Bq Er ENOTSOCK The .Fa s diff --git a/lib/libc/sys/bindat.2 b/lib/libc/sys/bindat.2 index 9274679374a..692099092d6 100644 --- a/lib/libc/sys/bindat.2 +++ b/lib/libc/sys/bindat.2 @@ -105,5 +105,5 @@ nor a file descriptor associated with a directory. The .Nm was developed by -.An Pawel Jakub Dawidek Aq pawel@dawidek.net +.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net under sponsorship from the FreeBSD Foundation. diff --git a/lib/libc/sys/cap_fcntls_limit.2 b/lib/libc/sys/cap_fcntls_limit.2 index 0f792a5bb3d..193d97da37e 100644 --- a/lib/libc/sys/cap_fcntls_limit.2 +++ b/lib/libc/sys/cap_fcntls_limit.2 @@ -122,5 +122,5 @@ Support for capabilities and capabilities mode was developed as part of the Project. .Sh AUTHORS This function was created by -.An Pawel Jakub Dawidek Aq pawel@dawidek.net +.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net under sponsorship of the FreeBSD Foundation. diff --git a/lib/libc/sys/cap_ioctls_limit.2 b/lib/libc/sys/cap_ioctls_limit.2 index 4fdd2551d27..2d1eef9724c 100644 --- a/lib/libc/sys/cap_ioctls_limit.2 +++ b/lib/libc/sys/cap_ioctls_limit.2 @@ -153,5 +153,5 @@ Support for capabilities and capabilities mode was developed as part of the Project. .Sh AUTHORS This function was created by -.An Pawel Jakub Dawidek Aq pawel@dawidek.net +.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net under sponsorship of the FreeBSD Foundation. diff --git a/lib/libc/sys/cap_rights_limit.2 b/lib/libc/sys/cap_rights_limit.2 index 33b57e135c5..4663951e502 100644 --- a/lib/libc/sys/cap_rights_limit.2 +++ b/lib/libc/sys/cap_rights_limit.2 @@ -153,5 +153,5 @@ Support for capabilities and capabilities mode was developed as part of the Project. .Sh AUTHORS This function was created by -.An Pawel Jakub Dawidek Aq pawel@dawidek.net +.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net under sponsorship of the FreeBSD Foundation. diff --git a/lib/libc/sys/connect.2 b/lib/libc/sys/connect.2 index ac019e829c3..8ed3f12bc8a 100644 --- a/lib/libc/sys/connect.2 +++ b/lib/libc/sys/connect.2 @@ -28,7 +28,7 @@ .\" @(#)connect.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 5, 2010 +.Dd June 26, 2014 .Dt CONNECT 2 .Os .Sh NAME @@ -80,6 +80,10 @@ The .Fa s argument is not a valid descriptor. +.It Bq Er EINVAL +The +.Fa namelen +argument is not a valid length for the address family. .It Bq Er ENOTSOCK The .Fa s diff --git a/lib/libc/sys/connectat.2 b/lib/libc/sys/connectat.2 index 8cebf98372e..759b7eac8e2 100644 --- a/lib/libc/sys/connectat.2 +++ b/lib/libc/sys/connectat.2 @@ -105,5 +105,5 @@ nor a file descriptor associated with a directory. The .Nm was developed by -.An Pawel Jakub Dawidek Aq pawel@dawidek.net +.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net under sponsorship from the FreeBSD Foundation. diff --git a/lib/libc/sys/cpuset.2 b/lib/libc/sys/cpuset.2 index 3e76de39ca3..0c32b42192e 100644 --- a/lib/libc/sys/cpuset.2 +++ b/lib/libc/sys/cpuset.2 @@ -224,5 +224,5 @@ The .Nm family of system calls first appeared in .Fx 7.1 . -.Sh AUTHOR -.An Jeffrey Roberson Aq jeff@FreeBSD.org +.Sh AUTHORS +.An Jeffrey Roberson Aq Mt jeff@FreeBSD.org diff --git a/lib/libc/sys/cpuset_getaffinity.2 b/lib/libc/sys/cpuset_getaffinity.2 index 93cfe95dae2..810a03c72e9 100644 --- a/lib/libc/sys/cpuset_getaffinity.2 +++ b/lib/libc/sys/cpuset_getaffinity.2 @@ -159,5 +159,5 @@ The .Nm family of system calls first appeared in .Fx 7.1 . -.Sh AUTHOR -.An Jeffrey Roberson Aq jeff@FreeBSD.org +.Sh AUTHORS +.An Jeffrey Roberson Aq Mt jeff@FreeBSD.org diff --git a/lib/libc/sys/ffclock.2 b/lib/libc/sys/ffclock.2 index 68ea922e4d6..78fed527b14 100644 --- a/lib/libc/sys/ffclock.2 +++ b/lib/libc/sys/ffclock.2 @@ -171,7 +171,7 @@ Feed-forward clock support first appeared in .Sh AUTHORS .An -nosplit The feed-forward clock support was written by -.An Julien Ridoux Aq jridoux@unimelb.edu.au +.An Julien Ridoux Aq Mt jridoux@unimelb.edu.au in collaboration with -.An Darryl Veitch Aq dveitch@unimelb.edu.au +.An Darryl Veitch Aq Mt dveitch@unimelb.edu.au at the University of Melbourne under sponsorship from the FreeBSD Foundation. diff --git a/lib/libc/sys/intro.2 b/lib/libc/sys/intro.2 index bc10b1de59d..7ce57aaf2d7 100644 --- a/lib/libc/sys/intro.2 +++ b/lib/libc/sys/intro.2 @@ -133,7 +133,6 @@ executable file. A file descriptor argument was out of range, referred to no open file, or a read (write) request was made to a file that was only open for writing (reading). -.Pp .It Er 10 ECHILD Em "\&No child processes" . A .Xr wait 2 @@ -302,7 +301,6 @@ addresses with Internet protocols. .It Er 48 EADDRINUSE Em "Address already in use" . Only one usage of each address is normally permitted. -.Pp .It Er 49 EADDRNOTAVAIL Em "Can't assign requested address" . Normally results from an attempt to create a socket with an address not on this machine. diff --git a/lib/libc/sys/kenv.2 b/lib/libc/sys/kenv.2 index 866c0d38a6f..dc17388f08b 100644 --- a/lib/libc/sys/kenv.2 +++ b/lib/libc/sys/kenv.2 @@ -171,9 +171,9 @@ or the value of a variable is longer than .Sh AUTHORS .An -nosplit This manual page was written by -.An Chad David Aq davidc@FreeBSD.org . +.An Chad David Aq Mt davidc@FreeBSD.org . .Pp The .Fn kenv system call was written by -.An Maxime Henrion Aq mux@FreeBSD.org . +.An Maxime Henrion Aq Mt mux@FreeBSD.org . diff --git a/lib/libc/sys/kqueue.2 b/lib/libc/sys/kqueue.2 index b9e496a3c9c..f84bc05ba29 100644 --- a/lib/libc/sys/kqueue.2 +++ b/lib/libc/sys/kqueue.2 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 7, 2014 +.Dd July 18, 2014 .Dt KQUEUE 2 .Os .Sh NAME @@ -454,7 +454,7 @@ Establishes an arbitrary timer identified by .Va ident . When adding a timer, .Va data -specifies the timeout period in milliseconds. +specifies the timeout period. The timer will be periodic unless EV_ONESHOT is specified. On return, .Va data @@ -465,8 +465,25 @@ There is a system wide limit on the number of timers which is controlled by the .Va kern.kq_calloutmax sysctl. +.Bl -tag -width XXNOTE_USECONDS +.It Dv NOTE_SECONDS +.Va data +is in seconds. +.It Dv NOTE_MSECONDS +.Va data +is in milliseconds. +.It Dv NOTE_USECONDS +.Va data +is in microseconds. +.It Dv NOTE_NSECONDS +.Va data +is in nanoseconds. +.It +.El .Pp -On return, +If +.Va fflags +is not set, the default is milliseconds. On return, .Va fflags contains the events which triggered the filter. .It Dv EVFILT_USER @@ -613,7 +630,7 @@ system calls first appeared in The .Fn kqueue system and this manual page were written by -.An Jonathan Lemon Aq jlemon@FreeBSD.org . +.An Jonathan Lemon Aq Mt jlemon@FreeBSD.org . .Sh BUGS The .Fa timeout diff --git a/lib/libc/sys/kse.2 b/lib/libc/sys/kse.2 index 41fcc373ea8..95e72562404 100644 --- a/lib/libc/sys/kse.2 +++ b/lib/libc/sys/kse.2 @@ -665,15 +665,15 @@ The KSE system calls first appeared in .Sh AUTHORS KSE was originally implemented by .An -nosplit -.An "Julian Elischer" Aq julian@FreeBSD.org , +.An Julian Elischer Aq Mt julian@FreeBSD.org , with additional contributions by -.An "Jonathan Mini" Aq mini@FreeBSD.org , -.An "Daniel Eischen" Aq deischen@FreeBSD.org , +.An Jonathan Mini Aq Mt mini@FreeBSD.org , +.An Daniel Eischen Aq Mt deischen@FreeBSD.org , and -.An "David Xu" Aq davidxu@FreeBSD.org . +.An David Xu Aq Mt davidxu@FreeBSD.org . .Pp This manual page was written by -.An "Archie Cobbs" Aq archie@FreeBSD.org . +.An Archie Cobbs Aq Mt archie@FreeBSD.org . .Sh BUGS The KSE code is .Ud diff --git a/lib/libc/sys/listen.2 b/lib/libc/sys/listen.2 index ab22fd18e88..90059f89334 100644 --- a/lib/libc/sys/listen.2 +++ b/lib/libc/sys/listen.2 @@ -28,7 +28,7 @@ .\" From: @(#)listen.2 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd October 20, 2012 +.Dd July 15, 2014 .Dt LISTEN 2 .Os .Sh NAME @@ -139,6 +139,9 @@ will fail if: The argument .Fa s is not a valid descriptor. +.It Bq Er EDESTADDRREQ +The socket is not bound to a local address, and the protocol does not +support listening on an unbound socket. .It Bq Er EINVAL The socket is already connected, or in the process of being connected. .It Bq Er ENOTSOCK diff --git a/lib/libc/sys/mlock.2 b/lib/libc/sys/mlock.2 index 42acc971661..4f264206fd2 100644 --- a/lib/libc/sys/mlock.2 +++ b/lib/libc/sys/mlock.2 @@ -28,7 +28,7 @@ .\" @(#)mlock.2 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd March 18, 2013 +.Dd May 17, 2014 .Dt MLOCK 2 .Os .Sh NAME @@ -91,14 +91,21 @@ Locked mappings are not inherited by the child process after a .Pp Since physical memory is a potentially scarce resource, processes are limited in how much they can lock down. -A single process can +The amount of memory that a single process can .Fn mlock -the minimum of -a system-wide ``wired pages'' limit +is limited by both the per-process +.Dv RLIMIT_MEMLOCK +resource limit and the +system-wide +.Dq wired pages +limit +.Va vm.max_wired . .Va vm.max_wired -and the per-process -.Li RLIMIT_MEMLOCK -resource limit. +applies to the system as a whole, so the amount available to a single +process at any given time is the difference between +.Va vm.max_wired +and +.Va vm.stats.vm.v_wire_count . .Pp If .Va security.bsd.unprivileged_mlock diff --git a/lib/libc/sys/mmap.2 b/lib/libc/sys/mmap.2 index 01cde0ee5fe..3dd830326ad 100644 --- a/lib/libc/sys/mmap.2 +++ b/lib/libc/sys/mmap.2 @@ -28,7 +28,7 @@ .\" @(#)mmap.2 8.4 (Berkeley) 5/11/95 .\" $FreeBSD$ .\" -.Dd September 9, 2013 +.Dd June 19, 2014 .Dt MMAP 2 .Os .Sh NAME @@ -141,6 +141,12 @@ argument must be 0. This flag is identical to .Dv MAP_ANON and is provided for compatibility. +.It Dv MAP_EXCL +This flag can only be used in combination with +.Dv MAP_FIXED . +Please see the definition of +.Dv MAP_FIXED +for the description of its effect. .It Dv MAP_FIXED Do not permit the system to select a different address than the one specified. @@ -152,17 +158,21 @@ If is specified, .Fa addr must be a multiple of the pagesize. -If a +If +.Dv MAP_EXCL +is not specified, a successfull .Dv MAP_FIXED -request is successful, the mapping established by -.Fn mmap -replaces any previous mappings for the process' pages in the range from +request replaces any previous mappings for the process' +pages in the range from .Fa addr to .Fa addr + .Fa len . -Use of this option is discouraged. +In contrast, if +.Dv MAP_EXCL +is specified, the request will fail if a mapping +already exists within the range. .It Dv MAP_HASSEMAPHORE Notify the kernel that the region may contain semaphores and that special handling may be necessary. @@ -393,6 +403,17 @@ argument was not -1. was specified and the .Fa offset argument was not 0. +.It Bq Er EINVAL +Both +.Dv MAP_FIXED +and +.Dv MAP_EXCL +were specified, but the requested region is already used by a mapping. +.It Bq Er EINVAL +.Dv MAP_EXCL +was specified, but +.Dv MAP_FIXED +was not. .It Bq Er ENODEV .Dv MAP_ANON has not been specified and diff --git a/lib/libc/sys/mmap.c b/lib/libc/sys/mmap.c index cfdb9448ea3..0fa03baa374 100644 --- a/lib/libc/sys/mmap.c +++ b/lib/libc/sys/mmap.c @@ -44,18 +44,13 @@ __FBSDID("$FreeBSD$"); * is not supplied by GCC 1.X but is supplied by GCC 2.X. */ void * -mmap(addr, len, prot, flags, fd, offset) - void * addr; - size_t len; - int prot; - int flags; - int fd; - off_t offset; +mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset) { - if (__getosreldate() >= 700051) + if (__getosreldate() >= 700051) { return (__sys_mmap(addr, len, prot, flags, fd, offset)); - else - - return (__sys_freebsd6_mmap(addr, len, prot, flags, fd, 0, offset)); + } else { + return (__sys_freebsd6_mmap(addr, len, prot, flags, fd, 0, + offset)); + } } diff --git a/lib/libc/sys/pdfork.2 b/lib/libc/sys/pdfork.2 index a4895159f2a..e057f769b89 100644 --- a/lib/libc/sys/pdfork.2 +++ b/lib/libc/sys/pdfork.2 @@ -188,9 +188,9 @@ Project. .Sh AUTHORS .An -nosplit These functions and the capability facility were created by -.An "Robert N. M. Watson" Aq rwatson@FreeBSD.org +.An Robert N. M. Watson Aq Mt rwatson@FreeBSD.org and -.An "Jonathan Anderson" Aq jonathan@FreeBSD.org +.An Jonathan Anderson Aq Mt jonathan@FreeBSD.org at the University of Cambridge Computer Laboratory with support from a grant from Google, Inc. .Sh BUGS diff --git a/lib/libc/sys/posix_fallocate.2 b/lib/libc/sys/posix_fallocate.2 index 750177751e9..4c92d9b9c2b 100644 --- a/lib/libc/sys/posix_fallocate.2 +++ b/lib/libc/sys/posix_fallocate.2 @@ -141,4 +141,4 @@ function appeared in .Sh AUTHORS .Fn posix_fallocate and this manual page were initially written by -.An Matthew Fleming Aq mdf@FreeBSD.org . +.An Matthew Fleming Aq Mt mdf@FreeBSD.org . diff --git a/lib/libc/sys/posix_openpt.2 b/lib/libc/sys/posix_openpt.2 index 9ba26068ac7..916e75ac586 100644 --- a/lib/libc/sys/posix_openpt.2 +++ b/lib/libc/sys/posix_openpt.2 @@ -137,4 +137,4 @@ is included for compatibility; in opening a terminal does not cause it to become a process's controlling terminal. .Sh AUTHORS -.An Ed Schouten Aq ed@FreeBSD.org +.An Ed Schouten Aq Mt ed@FreeBSD.org diff --git a/lib/libc/sys/procctl.2 b/lib/libc/sys/procctl.2 index 8f553eac057..6ad0590804a 100644 --- a/lib/libc/sys/procctl.2 +++ b/lib/libc/sys/procctl.2 @@ -50,7 +50,7 @@ If multiple processes match the identifier, .Nm will make a .Dq best effort -to control as many of the selected possibles as possible. +to control as many of the selected processes as possible. An error is only returned if no selected processes successfully complete the request. The following identifier types are supported: diff --git a/lib/libc/sys/pselect.2 b/lib/libc/sys/pselect.2 index ed66aade1cd..6221c473e7d 100644 --- a/lib/libc/sys/pselect.2 +++ b/lib/libc/sys/pselect.2 @@ -120,4 +120,4 @@ function first appeared in The first implementation of .Fn pselect function and this manual page were written by -.An Garrett Wollman Aq wollman@FreeBSD.org . +.An Garrett Wollman Aq Mt wollman@FreeBSD.org . diff --git a/lib/libc/sys/rtprio.2 b/lib/libc/sys/rtprio.2 index f30ed225475..23088a70596 100644 --- a/lib/libc/sys/rtprio.2 +++ b/lib/libc/sys/rtprio.2 @@ -188,7 +188,7 @@ The specified process or thread was not found or visible. .Sh AUTHORS .An -nosplit The original author was -.An Henrik Vestergaard Draboel Aq hvd@terry.ping.dk . +.An Henrik Vestergaard Draboel Aq Mt hvd@terry.ping.dk . This implementation in .Fx was substantially rewritten by diff --git a/lib/libc/sys/sendfile.2 b/lib/libc/sys/sendfile.2 index 0e7dbe36263..b363382af15 100644 --- a/lib/libc/sys/sendfile.2 +++ b/lib/libc/sys/sendfile.2 @@ -315,4 +315,4 @@ The .Fn sendfile system call and this manual page were written by -.An David G. Lawrence Aq dg@dglawrence.com . +.An David G. Lawrence Aq Mt dg@dglawrence.com . diff --git a/lib/libc/sys/shm_open.2 b/lib/libc/sys/shm_open.2 index 76d8f3c150a..b56f717b76d 100644 --- a/lib/libc/sys/shm_open.2 +++ b/lib/libc/sys/shm_open.2 @@ -275,8 +275,8 @@ The functions were reimplemented as system calls using shared memory objects directly rather than files in .Fx 8.0 . .Sh AUTHORS -.An Garrett A. Wollman Aq wollman@FreeBSD.org +.An Garrett A. Wollman Aq Mt wollman@FreeBSD.org (C library support and this manual page) .Pp -.An Matthew Dillon Aq dillon@FreeBSD.org +.An Matthew Dillon Aq Mt dillon@FreeBSD.org .Pq Dv MAP_NOSYNC diff --git a/lib/libc/sys/shutdown.2 b/lib/libc/sys/shutdown.2 index 70211ffb2eb..e8a434b2395 100644 --- a/lib/libc/sys/shutdown.2 +++ b/lib/libc/sys/shutdown.2 @@ -171,7 +171,7 @@ constants appeared in .Sh AUTHORS .An -nosplit This manual page was updated by -.An Bruce M. Simpson Aq bms@FreeBSD.org +.An Bruce M. Simpson Aq Mt bms@FreeBSD.org to reflect how .Fn shutdown behaves with diff --git a/lib/libc/sys/socket.2 b/lib/libc/sys/socket.2 index 74730be9bf3..c0b1bdc35fd 100644 --- a/lib/libc/sys/socket.2 +++ b/lib/libc/sys/socket.2 @@ -57,24 +57,30 @@ These families are defined in the include file The currently understood formats are: .Pp .Bd -literal -offset indent -compact -PF_LOCAL Host-internal protocols, formerly called PF_UNIX, -PF_UNIX Host-internal protocols, deprecated, use PF_LOCAL, +PF_LOCAL Host-internal protocols (alias for PF_UNIX), +PF_UNIX Host-internal protocols, PF_INET Internet version 4 protocols, -PF_PUP PUP protocols, like BSP, -PF_APPLETALK AppleTalk protocols, -PF_ROUTE Internal Routing protocol, -PF_LINK Link layer interface, -PF_IPX Novell Internet Packet eXchange protocol, -PF_RTIP Help Identify RTIP packets, -PF_PIP Help Identify PIP packets, -PF_ISDN Integrated Services Digital Network, -PF_KEY Internal key-management function, PF_INET6 Internet version 6 protocols, -PF_NATM Native ATM access, -PF_ATM ATM, -PF_NETGRAPH Netgraph sockets +PF_ROUTE Internal routing protocol, +PF_LINK Link layer interface, +PF_KEY Internal key-management function, +PF_NATM Asynchronous transfer mode protocols, +PF_NETGRAPH Netgraph sockets, +PF_IEEE80211 IEEE 802.11 wireless link-layer protocols (WiFi), +PF_BLUETOOTH Bluetooth protocols, +PF_INET_SDP OFED socket direct protocol (IPv4), +PF_INET6_SDP OFED socket direct protocol (IPv6) .Ed .Pp +Each protocol family is connected to an address family, which has the +same name except that the prefix is +.Dq Dv AF_ +in place of +.Dq Dv PF_ . +Other protocol families may be also defined, beginning with +.Dq Dv PF_ , +with corresponding address families. +.Pp The socket has the indicated .Fa type , which specifies the semantics of communication. @@ -307,6 +313,37 @@ The socket type is not supported by the protocol. .%B PS1 .%N 8 .Re +.Sh STANDARDS +The +.Fn socket +function conforms to +.St -p1003.1-2008 . +The +.Tn POSIX +standard specifies only the +.Dv AF_INET , +.Dv AF_INET6 , +and +.Dv AF_UNIX +constants for address families, and requires the use of +.Dv AF_* +constants for the +.Fa domain +argument of +.Fn socket . +The +.Dv SOCK_CLOEXEC +flag is expected to conform to the next revision of the +.Tn POSIX +standard. +The +.Dv SOCK_RDM +.Fa type , +the +.Dv PF_* +constants, and other address families are +.Fx +extensions. .Sh HISTORY The .Fn socket diff --git a/lib/libc/sys/utimes.2 b/lib/libc/sys/utimes.2 index 74a7dd02ee4..15db6270407 100644 --- a/lib/libc/sys/utimes.2 +++ b/lib/libc/sys/utimes.2 @@ -30,7 +30,7 @@ .\" @(#)utimes.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd April 10, 2008 +.Dd July 3, 2014 .Dt UTIMES 2 .Os .Sh NAME @@ -119,22 +119,18 @@ is passed the special value .Dv AT_FDCWD in the .Fa fd -parameter, the current working directory is used and the behavior is identical to -a call to +parameter, the current working directory is used and the behavior +is identical to a call to .Fn utimes . .Sh RETURN VALUES .Rv -std .Sh ERRORS -The -.Fn utimes -and -.Fn lutimes -system calls -will fail if: +All of the system call will fail if: .Bl -tag -width Er .It Bq Er EACCES -Search permission is denied for a component of the path prefix; -or the +Search permission is denied for a component of the path prefix. +.It Bq Er EACCES +The .Fa times argument is .Dv NULL @@ -148,6 +144,17 @@ or .Fa times argument points outside the process's allocated address space. +.It Bq Er EFAULT +The +.Fa times +argument +points outside the process's allocated address space. +.It Bq Er EINVAL +The +.Va tv_usec +component of at least one of the values specified by the +.Fa times +argument has a value less than 0 or greater than 999999. .It Bq Er EIO An I/O error occurred while reading or writing the affected inode. .It Bq Er ELOOP @@ -170,7 +177,8 @@ argument is not and the calling process's effective user ID does not match the owner of the file and is not the super-user. .It Bq Er EPERM -The named file has its immutable or append-only flag set, see the +The named file has its immutable or append-only flags set. +See the .Xr chflags 2 manual page for more information. .It Bq Er EROFS @@ -189,40 +197,6 @@ argument does not refer to a valid descriptor. .El .Pp -All of the system calls will fail if: -.Bl -tag -width Er -.It Bq Er EACCES -The -.Fa times -argument is -.Dv NULL -and the effective user ID of the process does not -match the owner of the file, and is not the super-user, and write -access is denied. -.It Bq Er EFAULT -The -.Fa times -argument -points outside the process's allocated address space. -.It Bq Er EINVAL -The -.Va tv_usec -component of at least one of the values specified by the -.Fa times -argument has a value less than 0 or greater than 999999. -.It Bq Er EIO -An I/O error occurred while reading or writing the affected inode. -.It Bq Er EPERM -The -.Fa times -argument is not -.Dv NULL -and the calling process's effective user ID -does not match the owner of the file and is not the super-user. -.It Bq Er EROFS -The file system containing the file is mounted read-only. -.El -.Pp In addition to the errors returned by the .Fn utimes , the diff --git a/lib/libc/xdr/xdr_float.c b/lib/libc/xdr/xdr_float.c index 8051649202d..11358069e00 100644 --- a/lib/libc/xdr/xdr_float.c +++ b/lib/libc/xdr/xdr_float.c @@ -63,7 +63,7 @@ __FBSDID("$FreeBSD$"); #if defined(__m68k__) || defined(__sparc__) || defined(__i386__) || \ defined(__mips__) || defined(__ns32k__) || defined(__alpha__) || \ - defined(__arm__) || defined(__ppc__) || defined(__ia64__) || \ + defined(__arm__) || defined(__ppc__) || \ defined(__arm26__) || defined(__sparc64__) || defined(__amd64__) #include #define IEEEFP diff --git a/lib/libcalendar/calendar.3 b/lib/libcalendar/calendar.3 index 469f1c9e70c..f86d5e34eb0 100644 --- a/lib/libcalendar/calendar.3 +++ b/lib/libcalendar/calendar.3 @@ -198,6 +198,6 @@ library first appeared in .Fx 3.0 . .Sh AUTHORS This manual page and the library was written by -.An Wolfgang Helbig Aq helbig@FreeBSD.org . +.An Wolfgang Helbig Aq Mt helbig@FreeBSD.org . .Sh BUGS The library was coded with great care so there are no bugs left. diff --git a/lib/libcam/cam.3 b/lib/libcam/cam.3 index 4f918d2c09f..7fe2a168fe7 100644 --- a/lib/libcam/cam.3 +++ b/lib/libcam/cam.3 @@ -406,7 +406,7 @@ characters long. The CAM library first appeared in .Fx 3.0 . .Sh AUTHORS -.An Kenneth Merry Aq ken@FreeBSD.org +.An Kenneth Merry Aq Mt ken@FreeBSD.org .Sh BUGS .Fn cam_open_device does not check to see if the diff --git a/lib/libcapsicum/libcapsicum.3 b/lib/libcapsicum/libcapsicum.3 index efeec2f131f..9df565a4077 100644 --- a/lib/libcapsicum/libcapsicum.3 +++ b/lib/libcapsicum/libcapsicum.3 @@ -284,5 +284,5 @@ printf("Name associated with %s is %s.\\n", ipstr, hp->h_name); The .Nm libcapsicum library was implemented by -.An Pawel Jakub Dawidek Aq pawel@dawidek.net +.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net under sponsorship from the FreeBSD Foundation. diff --git a/lib/libcrypt/crypt.3 b/lib/libcrypt/crypt.3 index 50829c2fa43..828c37f51d6 100644 --- a/lib/libcrypt/crypt.3 +++ b/lib/libcrypt/crypt.3 @@ -283,7 +283,7 @@ libcrypt encryption library. .Sh AUTHORS .An -nosplit Originally written by -.An David Burren Aq davidb@werj.com.au , +.An David Burren Aq Mt davidb@werj.com.au , later additions and changes by .An Poul-Henning Kamp , .An Mark R V Murray , diff --git a/lib/libcrypt/crypt.c b/lib/libcrypt/crypt.c index 040fdc1b90a..c3ca4c225cb 100644 --- a/lib/libcrypt/crypt.c +++ b/lib/libcrypt/crypt.c @@ -104,12 +104,16 @@ char * crypt(const char *passwd, const char *salt) { const struct crypt_format *cf; +#ifdef HAS_DES + int len; +#endif for (cf = crypt_formats; cf->name != NULL; ++cf) if (cf->magic != NULL && strstr(salt, cf->magic) == salt) return (cf->func(passwd, salt)); #ifdef HAS_DES - if (strlen(salt) == 13 && strspn(salt, DES_SALT_ALPHABET) == 13) + len = strlen(salt); + if ((len == 13 || len == 2) && strspn(salt, DES_SALT_ALPHABET) == len) return (crypt_des(passwd, salt)); #endif return (crypt_format->func(passwd, salt)); diff --git a/lib/libcuse/Makefile b/lib/libcuse/Makefile new file mode 100644 index 00000000000..6269cbe2880 --- /dev/null +++ b/lib/libcuse/Makefile @@ -0,0 +1,69 @@ +# $FreeBSD$ +# +# Copyright (c) 2010 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. +# + +LIB= cuse +SHLIB_MAJOR= 1 +SHLIB_MINOR= 0 +SRCS= cuse_lib.c +INCS= cuse.h +MAN= cuse.3 +PTHREAD_LIBS?= -lpthread +CFLAGS+= -D_GNU_SOURCE +.if defined(HAVE_DEBUG) +CFLAGS+= -g +CFLAGS+= -DHAVE_DEBUG +.endif +LDADD+= ${PTHREAD_LIBS} + +MLINKS= +MLINKS+= cuse.3 cuse_alloc_unit_number.3 +MLINKS+= cuse.3 cuse_alloc_unit_number_by_id.3 +MLINKS+= cuse.3 cuse_copy_in.3 +MLINKS+= cuse.3 cuse_copy_out.3 +MLINKS+= cuse.3 cuse_dev_create.3 +MLINKS+= cuse.3 cuse_dev_destroy.3 +MLINKS+= cuse.3 cuse_dev_get_current.3 +MLINKS+= cuse.3 cuse_dev_get_per_file_handle.3 +MLINKS+= cuse.3 cuse_dev_get_priv0.3 +MLINKS+= cuse.3 cuse_dev_get_priv1.3 +MLINKS+= cuse.3 cuse_dev_set_per_file_handle.3 +MLINKS+= cuse.3 cuse_dev_set_priv0.3 +MLINKS+= cuse.3 cuse_dev_set_priv1.3 +MLINKS+= cuse.3 cuse_free_unit_number.3 +MLINKS+= cuse.3 cuse_free_unit_number_by_id.3 +MLINKS+= cuse.3 cuse_got_peer_signal.3 +MLINKS+= cuse.3 cuse_init.3 +MLINKS+= cuse.3 cuse_poll_wakeup.3 +MLINKS+= cuse.3 cuse_set_local.3 +MLINKS+= cuse.3 cuse_get_local.3 +MLINKS+= cuse.3 cuse_uninit.3 +MLINKS+= cuse.3 cuse_vmalloc.3 +MLINKS+= cuse.3 cuse_is_vmalloc_addr.3 +MLINKS+= cuse.3 cuse_vmfree.3 +MLINKS+= cuse.3 cuse_vmoffset.3 +MLINKS+= cuse.3 cuse_wait_and_process.3 + +.include diff --git a/lib/libcuse/Makefile.depend b/lib/libcuse/Makefile.depend new file mode 100644 index 00000000000..37acbe0cd62 --- /dev/null +++ b/lib/libcuse/Makefile.depend @@ -0,0 +1,21 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DIRDEPS = \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/libthr \ + usr.bin/xinstall.host \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/lib/libcuse/cuse.3 b/lib/libcuse/cuse.3 new file mode 100644 index 00000000000..6d8d2a3cd86 --- /dev/null +++ b/lib/libcuse/cuse.3 @@ -0,0 +1,388 @@ +.\" $FreeBSD$ +.\" +.\" Copyright (c) 2010-2013 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. +.\" +.Dd June 6, 2014 +.Dt CUSE 3 +.Os +.Sh NAME +.Nm libcuse +.Nd "Userland character device library" +.Sh LIBRARY +.Lb libcuse +.Sh SYNOPSIS +To load the required kernel module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +cuse_load="YES" +.Ed +.Pp +.In cuse.h +.Sh DESCRIPTION +The +.Nm +library contains functions to create a character device in userspace. +The +.Nm +library is thread safe. +.Sh LIBRARY INITIALISATION / DEINITIALISATION +.Ft "int" +.Fn "cuse_init" "void" +This function initialises +.Nm . +Must be called at the beginning of the program. +This function returns 0 on success or a negative value on failure. +See +.Dv CUSE_ERR_XXX +for known error codes. +If the cuse kernel module is not loaded, +.Dv CUSE_ERR_NOT_LOADED +is returned. +.Pp +.Ft "int" +.Fn "cuse_uninit" "void" +Deinitialise +.Nm . +Can be called at the end of the application. +This function returns 0 on success or a negative value on failure. +See +.Dv CUSE_ERR_XXX +for known error codes. +.Sh UNIT MANAGEMENT +.Ft "int" +.Fn "cuse_alloc_unit_number" "int *" +This function stores a uniq system unit number at the pointed +integer loation. +This function returns 0 on success or a negative value on failure. +See +.Dv CUSE_ERR_XXX +for known error codes. +.Pp +.Ft "int" +.Fn "cuse_alloc_unit_number_by_id" "int *" "int id" +This function stores a unique system unit number at the pointed +integer loation. +The returned unit number is uniq within the given ID. +Valid ID values are defined by the cuse include file. +See the +.Fn CUSE_ID_XXX +macros for more information. +This function returns 0 on success or a negative value on failure. +See +.Dv CUSE_ERR_XXX +for known error codes. +.Pp +.Ft "int" +.Fn "cuse_free_unit_number" "int" +This function frees the given allocated system unit number. +This function returns 0 on success or a negative value on failure. +See +.Dv CUSE_ERR_XXX +for known error codes. +.Pp +.Ft "int" +.Fn "cuse_free_unit_number_by_id" "int unit" "int id" +This function frees the given allocated system unit number belonging +to the given ID. +If both the unit and id argument is -1, all allocated units will be freed. +This function returns 0 on success or a negative value on failure. +See +.Dv CUSE_ERR_XXX +for known error codes. +.Sh LIBRARY USAGE +.Ft "void *" +.Fn "cuse_vmalloc" "int size" +This function allocates +.Ar size +bytes of memory. +Only memory allocated by this function can be memory +mapped by +.Xr mmap 2 . +This function returns a valid data pointer on success or +.Dv NULL +on failure. +.Pp +.Ft "int" +.Fn "cuse_is_vmalloc_addr" "void *" +This function returns non-zero if the passed pointer points to a valid +and non-freed allocation, as returned by +.Fn cuse_vmalloc . +Else this function returns zero. +.Pp +.Ft "void" +.Fn "cuse_vmfree" "void *" +This function frees memory allocated by +.Fn cuse_vmalloc . +Note that the +cuse library will internally not free the memory until the +.Fn cuse_uninit +function is called and that the number of unique +allocations is limited. +.Pp +.Ft "unsigned long" +.Fn "cuse_vmoffset" "void *" +This function returns the mmap offset that the client must use to +access the allocated memory. +.Pp +.Ft "struct cuse_dev *" +.Fn "cuse_dev_create" "const struct cuse_methods *mtod" "void *priv0" "void *priv1" "uid_t" "gid_t" "int permission" "const char *fmt" "..." +This function creates a new character device according to the given +parameters. +This function returns a valid cuse_dev structure pointer +on success or +.Dv NULL +on failure. +The device name can only contain a-z, +A-Z, 0-9, dot, / and underscore characters. +.Pp +.Ft "void" +.Fn "cuse_dev_destroy" "struct cuse_dev *" +This functions destroys a previously created character device. +.Pp +.Ft "void *" +.Fn "cuse_dev_get_priv0" "struct cuse_dev *" , +.Ft "void *" +.Fn "cuse_dev_get_priv1" "struct cuse_dev *" , +.Ft "void" +.Fn "cuse_dev_set_priv0" "struct cuse_dev *" "void *" , +.Ft "void" +.Fn "cuse_dev_set_priv1" "struct cuse_dev *" "void *" +These functions are used to set and get the private data of the given +cuse device. +.Pp +.Ft "int" +.Fn "cuse_wait_and_process" "void" +This function will block and do event processing. +If parallel I/O is +required multiple threads must be created looping on this +function. +This function returns 0 on success or a negative value on failure. +See +.Dv CUSE_ERR_XXX +for known error codes. +.Pp +.Ft "void *" +.Fn "cuse_dev_get_per_file_handle" "struct cuse_dev *" , +.Ft "void" +.Fn "cuse_dev_set_per_file_handle" "struct cuse_dev *" "void *" +These functions are used to set and get the per-file-open specific handle +and should only be used inside the cuse file operation callbacks. +.Pp +.Ft "void" +.Fn "cuse_set_local" "int" +This function instructs +.Fn cuse_copy_out +and +.Fn cuse_copy_in +that the +user pointer is local, if the argument passed to it is non-zero. +Else the user pointer is assumed to be at the peer application. +This function should only be used inside the cuse file operation callbacks. +The value is reset to zero when the given file operation returns, and +does not affect any other file operation callbacks. +.Pp +.Ft "int" +.Fn "cuse_get_local" "void" +Returns the current local state. +See +.Fn cuse_set_local . +.Pp +.Ft "int" +.Fn "cuse_copy_out" "const void *src" "void *peer_dst" "int len" , +.Ft "int" +.Fn "cuse_copy_in" "const void *peer_src" "void *dst" "int len" +These functions are used to transfer data between the local +application and the peer application. +These functions must be used +when operating on the data pointers passed to the +.Fn cm_read , +.Fn cm_write , +and +.Fn cm_ioctl +callback functions. +These functions return 0 on success or a negative value on failure. +See +.Dv CUSE_ERR_XXX +for known error codes. +.Pp +.Ft "int" +.Fn "cuse_got_peer_signal" "void" +This function is used to check if a signal has been delivered to the +peer application and should only be used inside the cuse file +operation callbacks. +This function returns 0 if a signal has been +delivered to the caller. +Else it returns a negative value. +See +.Dv CUSE_ERR_XXX +for known error codes. +.Pp +.Ft "struct cuse_dev *" +.Fn "cuse_dev_get_current" "int *pcmd" +This function is used to get the current cuse device pointer and the +currently executing command, by +.Dv CUSE_CMD_XXX +value. +The +.Ar pcmd +argument +is allowed to be +.Dv NULL . +This function should only be used inside the +cuse file operation callbacks. +On success a valid cuse device pointer +is returned. +On failure +.Dv NULL +is returned. +.Pp +.Ft "void" +.Fn "cuse_poll_wakeup" "void" +This function will wake up any file pollers. +.Sh LIBRARY LIMITATIONS +Transfer lengths for +.Fn read , +.Fn write , +.Fn cuse_copy_in , +and +.Fn cuse_copy_out +should not exceed what can fit into a 32-bit signed integer and is +defined by the +.Fn CUSE_LENGTH_MAX +macro. +Transfer lengths for ioctls should not exceed what is defined by the +.Fn CUSE_BUFFER_MAX +macro. +.Sh LIBRARY CALLBACK METHODS +In general fflags are defined by +.Dv CUSE_FFLAG_XXX +and errors are defined by +.Dv CUSE_ERR_XXX . +.Bd -literal -offset indent +enum { + CUSE_ERR_NONE + CUSE_ERR_BUSY + CUSE_ERR_WOULDBLOCK + CUSE_ERR_INVALID + CUSE_ERR_NO_MEMORY + CUSE_ERR_FAULT + CUSE_ERR_SIGNAL + CUSE_ERR_OTHER + CUSE_ERR_NOT_LOADED + + CUSE_POLL_NONE + CUSE_POLL_READ + CUSE_POLL_WRITE + CUSE_POLL_ERROR + + CUSE_FFLAG_NONE + CUSE_FFLAG_READ + CUSE_FFLAG_WRITE + CUSE_FFLAG_NONBLOCK + + CUSE_CMD_NONE + CUSE_CMD_OPEN + CUSE_CMD_CLOSE + CUSE_CMD_READ + CUSE_CMD_WRITE + CUSE_CMD_IOCTL + CUSE_CMD_POLL + CUSE_CMD_SIGNAL + CUSE_CMD_SYNC + CUSE_CMD_MAX +}; +.Ed +.Pp +.Ft "int" +.Fn "cuse_open_t" "struct cuse_dev *" "int fflags" +This function returns a +.Dv CUSE_ERR_XXX +value. +.Pp +.Ft "int" +.Fn "cuse_close_t" "struct cuse_dev *" "int fflags" +This function returns a +.Dv CUSE_ERR_XXX +value. +.Pp +.Ft "int" +.Fn "cuse_read_t" "struct cuse_dev *" "int fflags" "void *peer_ptr" "int len" +This function returns a +.Dv CUSE_ERR_XXX +value in case of failure or the +actually transferred length in case of success. +.Fn cuse_copy_in +and +.Fn cuse_copy_out +must be used to transfer data to and from the +.Ar peer_ptr . +.Pp +.Ft "int" +.Fn "cuse_write_t" "struct cuse_dev *" "int fflags" "const void *peer_ptr" "int len" +This function returns a +.Dv CUSE_ERR_XXX +value in case of failure or the +actually transferred length in case of success. +.Fn cuse_copy_in +and +.Fn cuse_copy_out +must be used to transfer data to and from the +.Ar peer_ptr . +.Pp +.Ft "int" +.Fn "cuse_ioctl_t" "struct cuse_dev *" "int fflags" "unsigned long cmd" "void *peer_data" +This function returns a +.Dv CUSE_ERR_XXX +value in case of failure or zero +in case of success. +.Fn cuse_copy_in +and +.Fn cuse_copy_out +must be used to +transfer data to and from the +.Ar peer_data . +.Pp +.Ft "int" +.Fn "cuse_poll_t" "struct cuse_dev *" "int fflags" "int events" +This function returns a mask of +.Dv CUSE_POLL_XXX +values in case of failure and success. +The events argument is also a mask of +.Dv CUSE_POLL_XXX +values. +.Bd -literal -offset indent +struct cuse_methods { + cuse_open_t *cm_open; + cuse_close_t *cm_close; + cuse_read_t *cm_read; + cuse_write_t *cm_write; + cuse_ioctl_t *cm_ioctl; + cuse_poll_t *cm_poll; +}; +.Ed +.Sh HISTORY +.Nm +was written by Hans Petter Selasky. diff --git a/lib/libcuse/cuse.h b/lib/libcuse/cuse.h new file mode 100644 index 00000000000..d502c5bd541 --- /dev/null +++ b/lib/libcuse/cuse.h @@ -0,0 +1,97 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 2014 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. + */ + +#ifndef _CUSE_H_ +#define _CUSE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +struct cuse_dev; + +typedef int (cuse_open_t)(struct cuse_dev *, int fflags); +typedef int (cuse_close_t)(struct cuse_dev *, int fflags); +typedef int (cuse_read_t)(struct cuse_dev *, int fflags, void *user_ptr, int len); +typedef int (cuse_write_t)(struct cuse_dev *, int fflags, const void *user_ptr, int len); +typedef int (cuse_ioctl_t)(struct cuse_dev *, int fflags, unsigned long cmd, void *user_data); +typedef int (cuse_poll_t)(struct cuse_dev *, int fflags, int events); + +struct cuse_methods { + cuse_open_t *cm_open; + cuse_close_t *cm_close; + cuse_read_t *cm_read; + cuse_write_t *cm_write; + cuse_ioctl_t *cm_ioctl; + cuse_poll_t *cm_poll; +}; + +int cuse_init(void); +int cuse_uninit(void); + +void *cuse_vmalloc(int); +int cuse_is_vmalloc_addr(void *); +void cuse_vmfree(void *); +unsigned long cuse_vmoffset(void *ptr); + +int cuse_alloc_unit_number_by_id(int *, int); +int cuse_free_unit_number_by_id(int, int); +int cuse_alloc_unit_number(int *); +int cuse_free_unit_number(int); + +struct cuse_dev *cuse_dev_create(const struct cuse_methods *, void *, void *, uid_t, gid_t, int, const char *,...); +void cuse_dev_destroy(struct cuse_dev *); + +void *cuse_dev_get_priv0(struct cuse_dev *); +void *cuse_dev_get_priv1(struct cuse_dev *); + +void cuse_dev_set_priv0(struct cuse_dev *, void *); +void cuse_dev_set_priv1(struct cuse_dev *, void *); + +void cuse_set_local(int); +int cuse_get_local(void); + +int cuse_wait_and_process(void); + +void cuse_dev_set_per_file_handle(struct cuse_dev *, void *); +void *cuse_dev_get_per_file_handle(struct cuse_dev *); + +int cuse_copy_out(const void *src, void *user_dst, int len); +int cuse_copy_in(const void *user_src, void *dst, int len); +int cuse_got_peer_signal(void); +void cuse_poll_wakeup(void); + +struct cuse_dev *cuse_dev_get_current(int *); + +extern int cuse_debug_level; + +#ifdef __cplusplus +} +#endif + +#endif /* _CUSE_H_ */ diff --git a/lib/libcuse/cuse_lib.c b/lib/libcuse/cuse_lib.c new file mode 100644 index 00000000000..9d8352f81df --- /dev/null +++ b/lib/libcuse/cuse_lib.c @@ -0,0 +1,800 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 2010-2012 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 "cuse.h" + +int cuse_debug_level; + +#ifdef HAVE_DEBUG +static const char *cuse_cmd_str(int cmd); + +#define DPRINTF(...) do { \ + if (cuse_debug_level != 0) \ + printf(__VA_ARGS__); \ +} while (0) +#else +#define DPRINTF(...) do { } while (0) +#endif + +struct cuse_vm_allocation { + uint8_t *ptr; + uint32_t size; +}; + +struct cuse_dev_entered { + TAILQ_ENTRY(cuse_dev_entered) entry; + pthread_t thread; + void *per_file_handle; + struct cuse_dev *cdev; + int cmd; + int is_local; + int got_signal; +}; + +struct cuse_dev { + TAILQ_ENTRY(cuse_dev) entry; + const struct cuse_methods *mtod; + void *priv0; + void *priv1; +}; + +static TAILQ_HEAD(, cuse_dev) h_cuse; +static TAILQ_HEAD(, cuse_dev_entered) h_cuse_entered; +static int f_cuse = -1; +static pthread_mutex_t m_cuse; +static struct cuse_vm_allocation a_cuse[CUSE_ALLOC_UNIT_MAX]; + +static void +cuse_lock(void) +{ + pthread_mutex_lock(&m_cuse); +} + +static void +cuse_unlock(void) +{ + pthread_mutex_unlock(&m_cuse); +} + +int +cuse_init(void) +{ + pthread_mutexattr_t attr; + + f_cuse = open("/dev/cuse", O_RDWR); + if (f_cuse < 0) { + if (feature_present("cuse") == 0) + return (CUSE_ERR_NOT_LOADED); + else + return (CUSE_ERR_INVALID); + } + pthread_mutexattr_init(&attr); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&m_cuse, &attr); + + TAILQ_INIT(&h_cuse); + TAILQ_INIT(&h_cuse_entered); + + return (0); +} + +int +cuse_uninit(void) +{ + int f; + + if (f_cuse < 0) + return (CUSE_ERR_INVALID); + + f = f_cuse; + f_cuse = -1; + + close(f); + + pthread_mutex_destroy(&m_cuse); + + memset(a_cuse, 0, sizeof(a_cuse)); + + return (0); +} + +unsigned long +cuse_vmoffset(void *_ptr) +{ + uint8_t *ptr_min; + uint8_t *ptr_max; + uint8_t *ptr = _ptr; + unsigned long remainder; + int n; + + cuse_lock(); + for (n = 0; n != CUSE_ALLOC_UNIT_MAX; n++) { + if (a_cuse[n].ptr == NULL) + continue; + + ptr_min = a_cuse[n].ptr; + ptr_max = a_cuse[n].ptr + a_cuse[n].size - 1; + + if ((ptr >= ptr_min) && (ptr <= ptr_max)) { + + cuse_unlock(); + + remainder = (ptr - ptr_min); + + remainder -= remainder % PAGE_SIZE; + + return ((n * PAGE_SIZE * CUSE_ALLOC_PAGES_MAX) + remainder); + } + } + cuse_unlock(); + + return (0x80000000UL); /* failure */ +} + +void * +cuse_vmalloc(int size) +{ + struct cuse_alloc_info info; + void *ptr; + int error; + int n; + + if (f_cuse < 0) + return (NULL); + + memset(&info, 0, sizeof(info)); + + if (size < 1) + return (NULL); + + info.page_count = (size + PAGE_SIZE - 1) / PAGE_SIZE; + + cuse_lock(); + for (n = 0; n != CUSE_ALLOC_UNIT_MAX; n++) { + + if (a_cuse[n].ptr != NULL) + continue; + + a_cuse[n].ptr = ((uint8_t *)1); /* reserve */ + a_cuse[n].size = 0; + + cuse_unlock(); + + info.alloc_nr = n; + + error = ioctl(f_cuse, CUSE_IOCTL_ALLOC_MEMORY, &info); + + if (error) { + + cuse_lock(); + + a_cuse[n].ptr = NULL; + + if (errno == EBUSY) + continue; + else + break; + } + ptr = mmap(NULL, info.page_count * PAGE_SIZE, + PROT_READ | PROT_WRITE, + MAP_SHARED, f_cuse, CUSE_ALLOC_PAGES_MAX * + PAGE_SIZE * n); + + if (ptr == MAP_FAILED) { + + error = ioctl(f_cuse, CUSE_IOCTL_FREE_MEMORY, &info); + + if (error) { + /* ignore */ + } + cuse_lock(); + + a_cuse[n].ptr = NULL; + + break; + } + cuse_lock(); + a_cuse[n].ptr = ptr; + a_cuse[n].size = size; + cuse_unlock(); + + return (ptr); /* success */ + } + cuse_unlock(); + return (NULL); /* failure */ +} + +int +cuse_is_vmalloc_addr(void *ptr) +{ + int n; + + if (f_cuse < 0 || ptr == NULL) + return (0); /* false */ + + cuse_lock(); + for (n = 0; n != CUSE_ALLOC_UNIT_MAX; n++) { + if (a_cuse[n].ptr == ptr) + break; + } + cuse_unlock(); + + return (n != CUSE_ALLOC_UNIT_MAX); +} + +void +cuse_vmfree(void *ptr) +{ + struct cuse_alloc_info info; + int error; + int n; + + if (f_cuse < 0) + return; + + memset(&info, 0, sizeof(info)); + + cuse_lock(); + for (n = 0; n != CUSE_ALLOC_UNIT_MAX; n++) { + if (a_cuse[n].ptr != ptr) + continue; + + cuse_unlock(); + + info.alloc_nr = n; + + munmap(ptr, a_cuse[n].size); + + error = ioctl(f_cuse, CUSE_IOCTL_FREE_MEMORY, &info); + + if (error) { + /* ignore */ + } + cuse_lock(); + + a_cuse[n].ptr = NULL; + a_cuse[n].size = 0; + + break; + } + cuse_unlock(); +} + +int +cuse_alloc_unit_number_by_id(int *pnum, int id) +{ + int error; + + if (f_cuse < 0) + return (CUSE_ERR_INVALID); + + *pnum = (id & CUSE_ID_MASK); + + error = ioctl(f_cuse, CUSE_IOCTL_ALLOC_UNIT_BY_ID, pnum); + if (error) + return (CUSE_ERR_NO_MEMORY); + + return (0); + +} + +int +cuse_free_unit_number_by_id(int num, int id) +{ + int error; + + if (f_cuse < 0) + return (CUSE_ERR_INVALID); + + if (num != -1 || id != -1) + num = (id & CUSE_ID_MASK) | (num & 0xFF); + + error = ioctl(f_cuse, CUSE_IOCTL_FREE_UNIT_BY_ID, &num); + if (error) + return (CUSE_ERR_NO_MEMORY); + + return (0); +} + +int +cuse_alloc_unit_number(int *pnum) +{ + int error; + + if (f_cuse < 0) + return (CUSE_ERR_INVALID); + + error = ioctl(f_cuse, CUSE_IOCTL_ALLOC_UNIT, pnum); + if (error) + return (CUSE_ERR_NO_MEMORY); + + return (0); +} + +int +cuse_free_unit_number(int num) +{ + int error; + + if (f_cuse < 0) + return (CUSE_ERR_INVALID); + + error = ioctl(f_cuse, CUSE_IOCTL_FREE_UNIT, &num); + if (error) + return (CUSE_ERR_NO_MEMORY); + + return (0); +} + +struct cuse_dev * +cuse_dev_create(const struct cuse_methods *mtod, void *priv0, void *priv1, + uid_t _uid, gid_t _gid, int _perms, const char *_fmt,...) +{ + struct cuse_create_dev info; + struct cuse_dev *cdev; + va_list args; + int error; + + if (f_cuse < 0) + return (NULL); + + cdev = malloc(sizeof(*cdev)); + if (cdev == NULL) + return (NULL); + + memset(cdev, 0, sizeof(*cdev)); + + cdev->mtod = mtod; + cdev->priv0 = priv0; + cdev->priv1 = priv1; + + memset(&info, 0, sizeof(info)); + + info.dev = cdev; + info.user_id = _uid; + info.group_id = _gid; + info.permissions = _perms; + + va_start(args, _fmt); + vsnprintf(info.devname, sizeof(info.devname), _fmt, args); + va_end(args); + + error = ioctl(f_cuse, CUSE_IOCTL_CREATE_DEV, &info); + if (error) { + free(cdev); + return (NULL); + } + cuse_lock(); + TAILQ_INSERT_TAIL(&h_cuse, cdev, entry); + cuse_unlock(); + + return (cdev); +} + + +void +cuse_dev_destroy(struct cuse_dev *cdev) +{ + int error; + + if (f_cuse < 0) + return; + + cuse_lock(); + TAILQ_REMOVE(&h_cuse, cdev, entry); + cuse_unlock(); + + error = ioctl(f_cuse, CUSE_IOCTL_DESTROY_DEV, &cdev); + if (error) + return; + + free(cdev); +} + +void * +cuse_dev_get_priv0(struct cuse_dev *cdev) +{ + return (cdev->priv0); +} + +void * +cuse_dev_get_priv1(struct cuse_dev *cdev) +{ + return (cdev->priv1); +} + +void +cuse_dev_set_priv0(struct cuse_dev *cdev, void *priv) +{ + cdev->priv0 = priv; +} + +void +cuse_dev_set_priv1(struct cuse_dev *cdev, void *priv) +{ + cdev->priv1 = priv; +} + +int +cuse_wait_and_process(void) +{ + pthread_t curr = pthread_self(); + struct cuse_dev_entered *pe; + struct cuse_dev_entered enter; + struct cuse_command info; + struct cuse_dev *cdev; + int error; + + if (f_cuse < 0) + return (CUSE_ERR_INVALID); + + error = ioctl(f_cuse, CUSE_IOCTL_GET_COMMAND, &info); + if (error) + return (CUSE_ERR_OTHER); + + cdev = info.dev; + + cuse_lock(); + enter.thread = curr; + enter.per_file_handle = (void *)info.per_file_handle; + enter.cmd = info.command; + enter.is_local = 0; + enter.got_signal = 0; + enter.cdev = cdev; + TAILQ_INSERT_TAIL(&h_cuse_entered, &enter, entry); + cuse_unlock(); + + DPRINTF("cuse: Command = %d = %s, flags = %d, arg = 0x%08x, ptr = 0x%08x\n", + (int)info.command, cuse_cmd_str(info.command), (int)info.fflags, + (int)info.argument, (int)info.data_pointer); + + switch (info.command) { + case CUSE_CMD_OPEN: + if (cdev->mtod->cm_open != NULL) + error = (cdev->mtod->cm_open) (cdev, (int)info.fflags); + else + error = 0; + break; + + case CUSE_CMD_CLOSE: + + /* wait for other threads to stop */ + + while (1) { + + error = 0; + + cuse_lock(); + TAILQ_FOREACH(pe, &h_cuse_entered, entry) { + if (pe->cdev != cdev) + continue; + if (pe->thread == curr) + continue; + if (pe->per_file_handle != + enter.per_file_handle) + continue; + pe->got_signal = 1; + pthread_kill(pe->thread, SIGHUP); + error = CUSE_ERR_BUSY; + } + cuse_unlock(); + + if (error == 0) + break; + else + usleep(10000); + } + + if (cdev->mtod->cm_close != NULL) + error = (cdev->mtod->cm_close) (cdev, (int)info.fflags); + else + error = 0; + break; + + case CUSE_CMD_READ: + if (cdev->mtod->cm_read != NULL) { + error = (cdev->mtod->cm_read) (cdev, (int)info.fflags, + (void *)info.data_pointer, (int)info.argument); + } else { + error = CUSE_ERR_INVALID; + } + break; + + case CUSE_CMD_WRITE: + if (cdev->mtod->cm_write != NULL) { + error = (cdev->mtod->cm_write) (cdev, (int)info.fflags, + (void *)info.data_pointer, (int)info.argument); + } else { + error = CUSE_ERR_INVALID; + } + break; + + case CUSE_CMD_IOCTL: + if (cdev->mtod->cm_ioctl != NULL) { + error = (cdev->mtod->cm_ioctl) (cdev, (int)info.fflags, + (unsigned int)info.argument, (void *)info.data_pointer); + } else { + error = CUSE_ERR_INVALID; + } + break; + + case CUSE_CMD_POLL: + if (cdev->mtod->cm_poll != NULL) { + error = (cdev->mtod->cm_poll) (cdev, (int)info.fflags, + (int)info.argument); + } else { + error = CUSE_POLL_ERROR; + } + break; + + case CUSE_CMD_SIGNAL: + cuse_lock(); + TAILQ_FOREACH(pe, &h_cuse_entered, entry) { + if (pe->cdev != cdev) + continue; + if (pe->thread == curr) + continue; + if (pe->per_file_handle != + enter.per_file_handle) + continue; + pe->got_signal = 1; + pthread_kill(pe->thread, SIGHUP); + } + cuse_unlock(); + break; + + default: + error = CUSE_ERR_INVALID; + break; + } + + DPRINTF("cuse: Command error = %d for %s\n", + error, cuse_cmd_str(info.command)); + + cuse_lock(); + TAILQ_REMOVE(&h_cuse_entered, &enter, entry); + cuse_unlock(); + + /* we ignore any sync command failures */ + ioctl(f_cuse, CUSE_IOCTL_SYNC_COMMAND, &error); + + return (0); +} + +static struct cuse_dev_entered * +cuse_dev_get_entered(void) +{ + struct cuse_dev_entered *pe; + pthread_t curr = pthread_self(); + + cuse_lock(); + TAILQ_FOREACH(pe, &h_cuse_entered, entry) { + if (pe->thread == curr) + break; + } + cuse_unlock(); + return (pe); +} + +void +cuse_dev_set_per_file_handle(struct cuse_dev *cdev, void *handle) +{ + struct cuse_dev_entered *pe; + + pe = cuse_dev_get_entered(); + if (pe == NULL || pe->cdev != cdev) + return; + + pe->per_file_handle = handle; + ioctl(f_cuse, CUSE_IOCTL_SET_PFH, &handle); +} + +void * +cuse_dev_get_per_file_handle(struct cuse_dev *cdev) +{ + struct cuse_dev_entered *pe; + + pe = cuse_dev_get_entered(); + if (pe == NULL || pe->cdev != cdev) + return (NULL); + + return (pe->per_file_handle); +} + +void +cuse_set_local(int val) +{ + struct cuse_dev_entered *pe; + + pe = cuse_dev_get_entered(); + if (pe == NULL) + return; + + pe->is_local = val; +} + +#ifdef HAVE_DEBUG +static const char * +cuse_cmd_str(int cmd) +{ + static const char *str[CUSE_CMD_MAX] = { + [CUSE_CMD_NONE] = "none", + [CUSE_CMD_OPEN] = "open", + [CUSE_CMD_CLOSE] = "close", + [CUSE_CMD_READ] = "read", + [CUSE_CMD_WRITE] = "write", + [CUSE_CMD_IOCTL] = "ioctl", + [CUSE_CMD_POLL] = "poll", + [CUSE_CMD_SIGNAL] = "signal", + [CUSE_CMD_SYNC] = "sync", + }; + + if ((cmd >= 0) && (cmd < CUSE_CMD_MAX) && + (str[cmd] != NULL)) + return (str[cmd]); + else + return ("unknown"); +} + +#endif + +int +cuse_get_local(void) +{ + struct cuse_dev_entered *pe; + + pe = cuse_dev_get_entered(); + if (pe == NULL) + return (0); + + return (pe->is_local); +} + +int +cuse_copy_out(const void *src, void *user_dst, int len) +{ + struct cuse_data_chunk info; + struct cuse_dev_entered *pe; + int error; + + if ((f_cuse < 0) || (len < 0)) + return (CUSE_ERR_INVALID); + + pe = cuse_dev_get_entered(); + if (pe == NULL) + return (CUSE_ERR_INVALID); + + DPRINTF("cuse: copy_out(%p,%p,%d), cmd = %d = %s\n", + src, user_dst, len, pe->cmd, cuse_cmd_str(pe->cmd)); + + if (pe->is_local) { + memcpy(user_dst, src, len); + } else { + info.local_ptr = (unsigned long)src; + info.peer_ptr = (unsigned long)user_dst; + info.length = len; + + error = ioctl(f_cuse, CUSE_IOCTL_WRITE_DATA, &info); + if (error) { + DPRINTF("cuse: copy_out() error = %d\n", errno); + return (CUSE_ERR_FAULT); + } + } + return (0); +} + +int +cuse_copy_in(const void *user_src, void *dst, int len) +{ + struct cuse_data_chunk info; + struct cuse_dev_entered *pe; + int error; + + if ((f_cuse < 0) || (len < 0)) + return (CUSE_ERR_INVALID); + + pe = cuse_dev_get_entered(); + if (pe == NULL) + return (CUSE_ERR_INVALID); + + DPRINTF("cuse: copy_in(%p,%p,%d), cmd = %d = %s\n", + user_src, dst, len, pe->cmd, cuse_cmd_str(pe->cmd)); + + if (pe->is_local) { + memcpy(dst, user_src, len); + } else { + info.local_ptr = (unsigned long)dst; + info.peer_ptr = (unsigned long)user_src; + info.length = len; + + error = ioctl(f_cuse, CUSE_IOCTL_READ_DATA, &info); + if (error) { + DPRINTF("cuse: copy_in() error = %d\n", errno); + return (CUSE_ERR_FAULT); + } + } + return (0); +} + +struct cuse_dev * +cuse_dev_get_current(int *pcmd) +{ + struct cuse_dev_entered *pe; + + pe = cuse_dev_get_entered(); + if (pe == NULL) { + if (pcmd != NULL) + *pcmd = 0; + return (NULL); + } + if (pcmd != NULL) + *pcmd = pe->cmd; + return (pe->cdev); +} + +int +cuse_got_peer_signal(void) +{ + struct cuse_dev_entered *pe; + + pe = cuse_dev_get_entered(); + if (pe == NULL) + return (CUSE_ERR_INVALID); + + if (pe->got_signal) + return (0); + + return (CUSE_ERR_OTHER); +} + +void +cuse_poll_wakeup(void) +{ + int error = 0; + + if (f_cuse < 0) + return; + + ioctl(f_cuse, CUSE_IOCTL_SELWAKEUP, &error); +} diff --git a/lib/libdevinfo/devinfo.3 b/lib/libdevinfo/devinfo.3 index 0788100b7e8..ee094dd62f8 100644 --- a/lib/libdevinfo/devinfo.3 +++ b/lib/libdevinfo/devinfo.3 @@ -238,7 +238,7 @@ The library first appeared in .Fx 5.0 . .Sh AUTHORS -.An Michael Smith Aq msmith@FreeBSD.org +.An Michael Smith Aq Mt msmith@FreeBSD.org .Sh BUGS This is the first implementation of the library, and the interface is still subject to refinement. diff --git a/lib/libdevstat/devstat.3 b/lib/libdevstat/devstat.3 index 39be6ac0ece..2bbe2d770ac 100644 --- a/lib/libdevstat/devstat.3 +++ b/lib/libdevstat/devstat.3 @@ -797,7 +797,7 @@ The new interface (the functions prefixed with first appeared in .Fx 5.0 . .Sh AUTHORS -.An Kenneth Merry Aq ken@FreeBSD.org +.An Kenneth Merry Aq Mt ken@FreeBSD.org .Sh BUGS There should probably be an interface to de-allocate memory allocated by .Fn devstat_getdevs , diff --git a/lib/libedit/Makefile b/lib/libedit/Makefile index d8ae6468196..df86778c577 100644 --- a/lib/libedit/Makefile +++ b/lib/libedit/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.34 2005/05/28 12:02:53 lukem Exp $ +# $NetBSD: Makefile,v 1.37 2009/01/18 12:17:49 lukem Exp $ # @(#)Makefile 8.1 (Berkeley) 6/4/93 # $FreeBSD$ @@ -10,8 +10,8 @@ OSRCS= chared.c common.c el.c emacs.c fcns.c filecomplete.c help.c \ hist.c key.c map.c \ parse.c prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c -DPADD= ${LIBNCURSES} -LDADD= -lncurses +DPADD= ${LIBNCURSESW} +LDADD= -lncursesw MAN= editline.3 editrc.5 @@ -70,9 +70,9 @@ editline.c: ${OSRCS} editline.o editline.po editline.So editline.ln: \ common.h emacs.h fcns.c fcns.h help.c help.h vi.h -test.o: ${.CURDIR}/TEST/test.c +tc1.o: ${.CURDIR}/TEST/tc1.c -test: test.o libedit.a ${DPADD} ${LIBTERMCAP} +test: tc1.o libedit.a ${DPADD} ${LIBTERMCAP} ${CC} ${CFLAGS} ${.ALLSRC} -o ${.TARGET} libedit.a ${LDADD} .include diff --git a/lib/libedit/Makefile.depend b/lib/libedit/Makefile.depend index 1d7ae944840..918d4927d64 100644 --- a/lib/libedit/Makefile.depend +++ b/lib/libedit/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ @@ -10,7 +11,6 @@ DIRDEPS = \ lib/${CSU_DIR} \ lib/libc \ lib/libcompiler_rt \ - lib/ncurses/ncurses \ lib/ncurses/ncursesw \ usr.bin/xinstall.host \ diff --git a/lib/libedit/TEST/test.c b/lib/libedit/TEST/tc1.c similarity index 96% rename from lib/libedit/TEST/test.c rename to lib/libedit/TEST/tc1.c index facbdaa7e3d..a60aa75775e 100644 --- a/lib/libedit/TEST/test.c +++ b/lib/libedit/TEST/tc1.c @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\ #if !defined(lint) && !defined(SCCSID) static char sccsid[] = "@(#)test.c 8.1 (Berkeley) 6/4/93"; #endif /* not lint && not SCCSID */ -__RCSID("$NetBSD: test.c,v 1.18 2005/06/01 11:37:52 lukem Exp $"); +__RCSID("$NetBSD: test.c,v 1.3 2009/07/17 12:25:52 christos Exp $"); __FBSDID("$FreeBSD$"); /* @@ -68,7 +68,7 @@ static void sig(int); static char * prompt(EditLine *el) { - static char a[] = "Edit$ "; + static char a[] = "\1\e[7m\1Edit$\1\e[0m\1 "; static char b[] = "Edit> "; return (continuation ? b : a); @@ -143,7 +143,7 @@ main(int argc, char *argv[]) el_set(el, EL_EDITOR, "vi"); /* Default editor is vi */ el_set(el, EL_SIGNAL, 1); /* Handle signals gracefully */ - el_set(el, EL_PROMPT, prompt); /* Set the prompt function */ + el_set(el, EL_PROMPT_ESC, prompt, '\1');/* Set the prompt function */ /* Tell editline to use this history interface */ el_set(el, EL_HIST, history, hist); @@ -183,7 +183,7 @@ main(int argc, char *argv[]) #endif if (gotsig) { - (void) fprintf(stderr, "Got signal %d.\n", gotsig); + (void) fprintf(stderr, "Got signal %d.\n", (int)gotsig); gotsig = 0; el_reset(el); } @@ -269,7 +269,7 @@ main(int argc, char *argv[]) } else if (el_parse(el, ac, av) == -1) { switch (fork()) { case 0: - execvp(av[0], __DECONST(char *const *, av)); + execvp(av[0], __DECONST(char **, av)); perror(av[0]); _exit(1); /*NOTREACHED*/ diff --git a/lib/libedit/common.c b/lib/libedit/common.c index 05995542541..64490c98629 100644 --- a/lib/libedit/common.c +++ b/lib/libedit/common.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $NetBSD: common.c,v 1.19 2006/03/06 21:11:56 christos Exp $ + * $NetBSD: common.c,v 1.23 2009/02/27 04:18:45 msaitoh Exp $ */ #if !defined(lint) && !defined(SCCSID) @@ -121,7 +121,7 @@ ed_delete_prev_word(EditLine *el, int c __unused) *kp++ = *p; el->el_chared.c_kill.last = kp; - c_delbefore(el, el->el_line.cursor - cp); /* delete before dot */ + c_delbefore(el, (int)(el->el_line.cursor - cp));/* delete before dot */ el->el_line.cursor = cp; if (el->el_line.cursor < el->el_line.buffer) el->el_line.cursor = el->el_line.buffer; /* bounds check */ @@ -208,9 +208,6 @@ ed_move_to_end(EditLine *el, int c __unused) el->el_line.cursor = el->el_line.lastchar; if (el->el_map.type == MAP_VI) { -#ifdef VI_MOVE - el->el_line.cursor--; -#endif if (el->el_chared.c_vcmd.action != NOP) { cv_delfini(el); return (CC_REFRESH); diff --git a/lib/libedit/editline.3 b/lib/libedit/editline.3 index 33f7666f428..df7cd879180 100644 --- a/lib/libedit/editline.3 +++ b/lib/libedit/editline.3 @@ -682,6 +682,9 @@ Load the history list stored in .It Dv H_SAVE , Fa "const char *file" Save the history list to .Fa file . +.It Dv H_SAVE_FP , Fa "FILE*" +Save the history list to the opened +.Fa FILE* . .It Dv H_SETUNIQUE , Fa "int unique" Set flag that adjacent identical event strings should not be entered into the history. diff --git a/lib/libedit/emacs.c b/lib/libedit/emacs.c index a285b1c305e..edcc84bb23b 100644 --- a/lib/libedit/emacs.c +++ b/lib/libedit/emacs.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $NetBSD: emacs.c,v 1.21 2006/03/06 21:11:56 christos Exp $ + * $NetBSD: emacs.c,v 1.22 2009/02/15 21:55:23 christos Exp $ */ #if !defined(lint) && !defined(SCCSID) @@ -101,7 +101,7 @@ em_delete_next_word(EditLine *el, int c __unused) *kp++ = *p; el->el_chared.c_kill.last = kp; - c_delafter(el, cp - el->el_line.cursor); /* delete after dot */ + c_delafter(el, (int)(cp - el->el_line.cursor)); /* delete after dot */ if (el->el_line.cursor > el->el_line.lastchar) el->el_line.cursor = el->el_line.lastchar; /* bounds check */ @@ -131,7 +131,8 @@ em_yank(EditLine *el, int c __unused) cp = el->el_line.cursor; /* open the space, */ - c_insert(el, el->el_chared.c_kill.last - el->el_chared.c_kill.buf); + c_insert(el, + (int)(el->el_chared.c_kill.last - el->el_chared.c_kill.buf)); /* copy the chars */ for (kp = el->el_chared.c_kill.buf; kp < el->el_chared.c_kill.last; kp++) *cp++ = *kp; @@ -185,14 +186,14 @@ em_kill_region(EditLine *el, int c __unused) while (cp < el->el_chared.c_kill.mark) *kp++ = *cp++; /* copy it */ el->el_chared.c_kill.last = kp; - c_delafter(el, cp - el->el_line.cursor); + c_delafter(el, (int)(cp - el->el_line.cursor)); } else { /* mark is before cursor */ cp = el->el_chared.c_kill.mark; kp = el->el_chared.c_kill.buf; while (cp < el->el_line.cursor) *kp++ = *cp++; /* copy it */ el->el_chared.c_kill.last = kp; - c_delbefore(el, cp - el->el_chared.c_kill.mark); + c_delbefore(el, (int)(cp - el->el_chared.c_kill.mark)); el->el_line.cursor = el->el_chared.c_kill.mark; } return (CC_REFRESH); @@ -446,7 +447,7 @@ em_copy_prev_word(EditLine *el, int c __unused) cp = c__prev_word(el->el_line.cursor, el->el_line.buffer, el->el_state.argument, ce__isword); - c_insert(el, oldc - cp); + c_insert(el, (int)(oldc - cp)); for (dp = oldc; cp < oldc && dp < el->el_line.lastchar; cp++) *dp++ = *cp; diff --git a/lib/libedit/filecomplete.h b/lib/libedit/filecomplete.h index a3156e942b9..215cf7d7b0b 100644 --- a/lib/libedit/filecomplete.h +++ b/lib/libedit/filecomplete.h @@ -26,7 +26,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $NetBSD: filecomplete.h,v 1.9 2009/12/30 22:37:40 christos Exp $ + * $NetBSD: filecomplete.h,v 1.8 2009/02/16 00:15:45 christos Exp $ * $FreeBSD$ */ #ifndef _FILECOMPLETE_H_ diff --git a/lib/libedit/hist.h b/lib/libedit/hist.h index 4f2824aff20..4ddedcc59b3 100644 --- a/lib/libedit/hist.h +++ b/lib/libedit/hist.h @@ -65,6 +65,7 @@ typedef struct el_history_t { #define HIST_SET(el, num) HIST_FUN(el, H_SET, num) #define HIST_LOAD(el, fname) HIST_FUN(el, H_LOAD fname) #define HIST_SAVE(el, fname) HIST_FUN(el, H_SAVE fname) +#define HIST_SAVE_FP(el, fp) HIST_FUN(el, H_SAVE_FP fp) protected int hist_init(EditLine *); protected void hist_end(EditLine *); diff --git a/lib/libedit/histedit.h b/lib/libedit/histedit.h index 8a6caf96c03..7cc524653c3 100644 --- a/lib/libedit/histedit.h +++ b/lib/libedit/histedit.h @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * @(#)histedit.h 8.2 (Berkeley) 1/3/94 - * $NetBSD: histedit.h,v 1.32 2007/06/10 20:20:28 christos Exp $ + * $NetBSD: histedit.h,v 1.41 2009/09/07 21:24:33 christos Exp $ * $FreeBSD$ */ @@ -208,6 +208,7 @@ int history(History *, HistEvent *, int, ...); #define H_NEXT_EVDATA 23 /* , const int, histdata_t *); */ #define H_DELDATA 24 /* , int, histdata_t *);*/ #define H_REPLACE 25 /* , const char *, histdata_t); */ +#define H_SAVE_FP 26 /* , FILE*); */ /* diff --git a/lib/libedit/history.c b/lib/libedit/history.c index 8f30a05a997..cd8697724f1 100644 --- a/lib/libedit/history.c +++ b/lib/libedit/history.c @@ -103,6 +103,7 @@ private int history_getunique(History *, HistEvent *); private int history_set_fun(History *, History *); private int history_load(History *, const char *); private int history_save(History *, const char *); +private int history_save_fp(History *, FILE*); private int history_prev_event(History *, HistEvent *, int); private int history_next_event(History *, HistEvent *, int); private int history_next_string(History *, HistEvent *, const char *); @@ -773,22 +774,16 @@ history_load(History *h, const char *fname) return (i); } - -/* history_save(): - * History save function +/* history_save_fp(): + * History save with open FILE* */ -private int -history_save(History *h, const char *fname) +private int history_save_fp(History *h, FILE* fp) { - FILE *fp; HistEvent ev; int i = -1, retval; size_t len, max_size; char *ptr; - if ((fp = fopen(fname, "w")) == NULL) - return (-1); - if (fchmod(fileno(fp), S_IRUSR|S_IWUSR) == -1) goto done; if (fputs(hist_cookie, fp) == EOF) @@ -815,6 +810,26 @@ history_save(History *h, const char *fname) } oomem: h_free((ptr_t)ptr); +done: + return (i); + +} + + +/* history_save(): + * History save function + */ +private int +history_save(History *h, const char *fname) +{ + FILE *fp; + int i; + + if ((fp = fopen(fname, "w")) == NULL) + return (-1); + + i = history_save_fp(h, fp); + done: (void) fclose(fp); return (i); @@ -1001,6 +1016,12 @@ history(History *h, HistEvent *ev, int fun, ...) he_seterrev(ev, _HE_HIST_WRITE); break; + case H_SAVE_FP: + retval = history_save_fp(h, va_arg(va, FILE*)); + if (retval == -1) + he_seterrev(ev, _HE_HIST_WRITE); + break; + case H_PREV_EVENT: retval = history_prev_event(h, ev, va_arg(va, int)); break; diff --git a/lib/libedit/prompt.c b/lib/libedit/prompt.c index 76d2d64a44a..2d37b67154d 100644 --- a/lib/libedit/prompt.c +++ b/lib/libedit/prompt.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $NetBSD: prompt.c,v 1.11 2003/08/07 16:44:32 agc Exp $ + * $NetBSD: prompt.c,v 1.14 2009/03/31 17:38:27 christos Exp $ */ #if !defined(lint) && !defined(SCCSID) diff --git a/lib/libedit/prompt.h b/lib/libedit/prompt.h index fe69ca488b5..c796d938d4b 100644 --- a/lib/libedit/prompt.h +++ b/lib/libedit/prompt.h @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * @(#)prompt.h 8.1 (Berkeley) 6/4/93 - * $NetBSD: prompt.h,v 1.6 2003/08/07 16:44:32 agc Exp $ + * $NetBSD: prompt.h,v 1.9 2009/03/31 17:38:27 christos Exp $ * $FreeBSD$ */ @@ -45,8 +45,8 @@ typedef char * (*el_pfunc_t)(EditLine*); typedef struct el_prompt_t { - el_pfunc_t p_func; /* Function to return the prompt */ - coord_t p_pos; /* position in the line after prompt */ + el_pfunc_t p_func; /* Function to return the prompt */ + coord_t p_pos; /* position in the line after prompt */ char p_ignore; /* character to start/end literal */ } el_prompt_t; diff --git a/lib/libedit/read.h b/lib/libedit/read.h index 1dcf16429a4..60189344ea4 100644 --- a/lib/libedit/read.h +++ b/lib/libedit/read.h @@ -26,7 +26,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $NetBSD: read.h,v 1.5 2006/08/21 12:45:30 christos Exp $ + * $NetBSD: read.h,v 1.6 2008/04/29 06:53:01 martin Exp $ * $FreeBSD$ */ diff --git a/lib/libedit/sys.h b/lib/libedit/sys.h index 9b1f0403107..5c017d3350b 100644 --- a/lib/libedit/sys.h +++ b/lib/libedit/sys.h @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * @(#)sys.h 8.1 (Berkeley) 6/4/93 - * $NetBSD: sys.h,v 1.9 2004/01/17 17:57:40 christos Exp $ + * $NetBSD: sys.h,v 1.12 2009/08/31 00:05:43 christos Exp $ * $FreeBSD$ */ @@ -70,6 +70,15 @@ typedef void *ioctl_t; #define REGEX /* Use POSIX.2 regular expression functions */ #undef REGEXP /* Use UNIX V8 regular expression functions */ +#if defined(__sun) +extern int tgetent(char *, const char *); +extern int tgetflag(char *); +extern int tgetnum(char *); +extern int tputs(const char *, int, int (*)(int)); +extern char* tgoto(const char*, int, int); +extern char* tgetstr(char*, char**); +#endif + #ifdef notdef # undef REGEX # undef REGEXP diff --git a/lib/libedit/term.h b/lib/libedit/term.h index 4bf4685f7f7..cf7a909bfc8 100644 --- a/lib/libedit/term.h +++ b/lib/libedit/term.h @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * @(#)term.h 8.1 (Berkeley) 6/4/93 - * $NetBSD: term.h,v 1.18 2006/11/24 00:01:17 christos Exp $ + * $NetBSD: term.h,v 1.20 2009/03/31 17:38:27 christos Exp $ * $FreeBSD$ */ diff --git a/lib/libedit/tty.c b/lib/libedit/tty.c index c0b4638b323..f8bae9424a7 100644 --- a/lib/libedit/tty.c +++ b/lib/libedit/tty.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $NetBSD: tty.c,v 1.25 2006/03/18 09:09:41 christos Exp $ + * $NetBSD: tty.c,v 1.31 2009/07/22 15:58:09 christos Exp $ */ #if !defined(lint) && !defined(SCCSID) @@ -443,13 +443,12 @@ private const ttymodes_t ttymodes[] = { -#define tty_getty(el, td) tcgetattr((el)->el_infd, (td)) -#define tty_setty(el, td) tcsetattr((el)->el_infd, TCSADRAIN, (td)) - #define tty__gettabs(td) ((((td)->c_oflag & TAB3) == TAB3) ? 0 : 1) #define tty__geteightbit(td) (((td)->c_cflag & CSIZE) == CS8) #define tty__cooked_mode(td) ((td)->c_lflag & ICANON) +private int tty_getty(EditLine *, struct termios *); +private int tty_setty(EditLine *, int, const struct termios *); private int tty__getcharindex(int); private void tty__getchar(struct termios *, unsigned char *); private void tty__setchar(struct termios *, unsigned char *); @@ -458,6 +457,29 @@ private int tty_setup(EditLine *); #define t_qu t_ts +/* tty_getty(): + * Wrapper for tcgetattr to handle EINTR + */ +private int +tty_getty(EditLine *el, struct termios *t) +{ + int rv; + while ((rv = tcgetattr(el->el_infd, t)) == -1 && errno == EINTR) + continue; + return rv; +} + +/* tty_setty(): + * Wrapper for tcsetattr to handle EINTR + */ +private int +tty_setty(EditLine *el, int action, const struct termios *t) +{ + int rv; + while ((rv = tcsetattr(el->el_infd, action, t)) == -1 && errno == EINTR) + continue; + return rv; +} /* tty_setup(): * Get the tty parameters and initialize the editing state @@ -996,7 +1018,7 @@ tty_rawmode(EditLine *el) if (el->el_tty.t_mode == EX_IO) el->el_tty.t_ex = el->el_tty.t_ts; - if (tty_setty(el, &el->el_tty.t_ed) == -1) { + if (tty_setty(el, TCSADRAIN, &el->el_tty.t_ed) == -1) { #ifdef DEBUG_TTY (void) fprintf(el->el_errfile, "tty_rawmode: tty_setty: %s\n", strerror(errno)); @@ -1021,7 +1043,7 @@ tty_cookedmode(EditLine *el) if (el->el_flags & EDIT_DISABLED) return (0); - if (tty_setty(el, &el->el_tty.t_ex) == -1) { + if (tty_setty(el, TCSADRAIN, &el->el_tty.t_ex) == -1) { #ifdef DEBUG_TTY (void) fprintf(el->el_errfile, "tty_cookedmode: tty_setty: %s\n", @@ -1057,7 +1079,7 @@ tty_quotemode(EditLine *el) el->el_tty.t_qu.c_lflag &= ~el->el_tty.t_t[QU_IO][MD_LIN].t_clrmask; el->el_tty.t_qu.c_lflag |= el->el_tty.t_t[QU_IO][MD_LIN].t_setmask; - if (tty_setty(el, &el->el_tty.t_qu) == -1) { + if (tty_setty(el, TCSADRAIN, &el->el_tty.t_qu) == -1) { #ifdef DEBUG_TTY (void) fprintf(el->el_errfile, "QuoteModeOn: tty_setty: %s\n", strerror(errno)); @@ -1078,7 +1100,7 @@ tty_noquotemode(EditLine *el) if (el->el_tty.t_mode != QU_IO) return (0); - if (tty_setty(el, &el->el_tty.t_ed) == -1) { + if (tty_setty(el, TCSADRAIN, &el->el_tty.t_ed) == -1) { #ifdef DEBUG_TTY (void) fprintf(el->el_errfile, "QuoteModeOff: tty_setty: %s\n", strerror(errno)); @@ -1139,7 +1161,7 @@ tty_stty(EditLine *el, int argc __unused, const char **argv) if (!argv || !*argv) { int i = -1; - int len = 0, st = 0, cu; + size_t len = 0, st = 0, cu; for (m = ttymodes; m->m_name; m++) { if (m->m_type != i) { (void) fprintf(el->el_outfile, "%s%s", @@ -1162,9 +1184,9 @@ tty_stty(EditLine *el, int argc __unused, const char **argv) cu = strlen(m->m_name) + (x != '\0') + 1; - if (len + cu >= el->el_term.t_size.h) { + if (len + cu >= (size_t)el->el_term.t_size.h) { (void) fprintf(el->el_outfile, "\n%*s", - st, ""); + (int)st, ""); len = st + cu; } else len += cu; @@ -1208,7 +1230,8 @@ tty_stty(EditLine *el, int argc __unused, const char **argv) int c = ffs((int)m->m_value); int v = *++p ? parse__escape((const char **) &p) : el->el_tty.t_vdisable; - assert(c-- != 0); + assert(c != 0); + c--; c = tty__getcharindex(c); assert(c != -1); tios->c_cc[c] = v; @@ -1229,6 +1252,17 @@ tty_stty(EditLine *el, int argc __unused, const char **argv) break; } } + + if (el->el_tty.t_mode == z) { + if (tty_setty(el, TCSADRAIN, tios) == -1) { +#ifdef DEBUG_TTY + (void) fprintf(el->el_errfile, + "tty_stty: tty_setty: %s\n", strerror(errno)); +#endif /* DEBUG_TTY */ + return (-1); + } + } + return (0); } diff --git a/lib/libefi/libefi.3 b/lib/libefi/libefi.3 index 7350508f855..e090fd6e711 100644 --- a/lib/libefi/libefi.3 +++ b/lib/libefi/libefi.3 @@ -140,4 +140,4 @@ for the ia64 architecture. The .Nm libefi library and this manual page were written by -.An Marcel Moolenaar Aq marcel@FreeBSD.org . +.An Marcel Moolenaar Aq Mt marcel@FreeBSD.org . diff --git a/lib/libexpat/libbsdxml.3 b/lib/libexpat/libbsdxml.3 index 04887f0f33a..0d706ea7219 100644 --- a/lib/libexpat/libbsdxml.3 +++ b/lib/libexpat/libbsdxml.3 @@ -59,11 +59,11 @@ For full documentation, please see the eXpat webpage at .Sh AUTHORS .An -nosplit The original eXpat was written by -.An James Clark Aq jjc@jclark.com . +.An James Clark Aq Mt jjc@jclark.com . .Pp Subsequently eXpat maintenance and development been taken up by a group of people under the leadership of -.An Fred Drake Aq fdrake@acm.com , +.An Fred Drake Aq Mt fdrake@acm.com , .An Paul Prescod , and .An Clark Cooper . diff --git a/lib/libfetch/Makefile.depend b/lib/libfetch/Makefile.depend index 3fcefec42ea..4bedb02c7bc 100644 --- a/lib/libfetch/Makefile.depend +++ b/lib/libfetch/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c index 5cc7e263b0c..a6fc47c60e4 100644 --- a/lib/libfetch/common.c +++ b/lib/libfetch/common.c @@ -688,6 +688,8 @@ fetch_ssl_setup_transport_layer(SSL_CTX *ctx, int verbose) /* * Configure peer verification based on environment. */ +#define LOCAL_CERT_FILE "/usr/local/etc/ssl/cert.pem" +#define BASE_CERT_FILE "/etc/ssl/cert.pem" static int fetch_ssl_setup_peer_verification(SSL_CTX *ctx, int verbose) { @@ -696,8 +698,12 @@ fetch_ssl_setup_peer_verification(SSL_CTX *ctx, int verbose) const char *ca_cert_file, *ca_cert_path, *crl_file; if (getenv("SSL_NO_VERIFY_PEER") == NULL) { - ca_cert_file = getenv("SSL_CA_CERT_FILE") != NULL ? - getenv("SSL_CA_CERT_FILE") : "/etc/ssl/cert.pem"; + ca_cert_file = getenv("SSL_CA_CERT_FILE"); + if (ca_cert_file == NULL && + access(LOCAL_CERT_FILE, R_OK) == 0) + ca_cert_file = LOCAL_CERT_FILE; + if (ca_cert_file == NULL) + ca_cert_file = BASE_CERT_FILE; ca_cert_path = getenv("SSL_CA_CERT_PATH"); if (verbose) { fetch_info("Peer verification enabled"); @@ -1104,6 +1110,9 @@ fetch_writev(conn_t *conn, struct iovec *iov, int iovcnt) errno = 0; pfd.revents = 0; if (poll(&pfd, 1, deltams) < 0) { + /* POSIX compliance */ + if (errno == EAGAIN) + continue; if (errno == EINTR && fetchRestartCalls) continue; return (-1); diff --git a/lib/libfetch/common.h b/lib/libfetch/common.h index 875eef196e9..41c10d20bbf 100644 --- a/lib/libfetch/common.h +++ b/lib/libfetch/common.h @@ -117,6 +117,9 @@ int fetch_no_proxy_match(const char *); */ FILE *http_request(struct url *, const char *, struct url_stat *, struct url *, const char *); +FILE *http_request_body(struct url *, const char *, + struct url_stat *, struct url *, const char *, + const char *, const char *); FILE *ftp_request(struct url *, const char *, struct url_stat *, struct url *, const char *); diff --git a/lib/libfetch/fetch.3 b/lib/libfetch/fetch.3 index 6b2e4c00b50..57ecea59339 100644 --- a/lib/libfetch/fetch.3 +++ b/lib/libfetch/fetch.3 @@ -627,6 +627,7 @@ the document URL will be used as referrer URL. Specifies the User-Agent string to use for HTTP requests. This can be useful when working with HTTP origin or proxy servers that differentiate between user agents. +If defined but empty, no User-Agent header is sent. .It Ev NETRC Specifies a file to use instead of .Pa ~/.netrc @@ -773,27 +774,27 @@ library first appeared in The .Nm fetch library was mostly written by -.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org +.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org with numerous suggestions and contributions from -.An Jordan K. Hubbard Aq jkh@FreeBSD.org , -.An Eugene Skepner Aq eu@qub.com , -.An Hajimu Umemoto Aq ume@FreeBSD.org , -.An Henry Whincup Aq henry@techiebod.com , -.An Jukka A. Ukkonen Aq jau@iki.fi , -.An Jean-Fran\(,cois Dockes Aq jf@dockes.org , -.An Michael Gmelin Aq freebsd@grem.de +.An Jordan K. Hubbard Aq Mt jkh@FreeBSD.org , +.An Eugene Skepner Aq Mt eu@qub.com , +.An Hajimu Umemoto Aq Mt ume@FreeBSD.org , +.An Henry Whincup Aq Mt henry@techiebod.com , +.An Jukka A. Ukkonen Aq Mt jau@iki.fi , +.An Jean-Fran\(,cois Dockes Aq Mt jf@dockes.org , +.An Michael Gmelin Aq Mt freebsd@grem.de and others. It replaces the older .Nm ftpio library written by -.An Poul-Henning Kamp Aq phk@FreeBSD.org +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org and -.An Jordan K. Hubbard Aq jkh@FreeBSD.org . +.An Jordan K. Hubbard Aq Mt jkh@FreeBSD.org . .Pp This manual page was written by -.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org +.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org and -.An Michael Gmelin Aq freebsd@grem.de . +.An Michael Gmelin Aq Mt freebsd@grem.de . .Sh BUGS Some parts of the library are not yet implemented. The most notable diff --git a/lib/libfetch/fetch.h b/lib/libfetch/fetch.h index be494821261..d56a1036a46 100644 --- a/lib/libfetch/fetch.h +++ b/lib/libfetch/fetch.h @@ -102,6 +102,8 @@ FILE *fetchGetHTTP(struct url *, const char *); FILE *fetchPutHTTP(struct url *, const char *); int fetchStatHTTP(struct url *, struct url_stat *, const char *); struct url_ent *fetchListHTTP(struct url *, const char *); +FILE *fetchReqHTTP(struct url *, const char *, const char *, + const char *, const char *); /* FTP-specific functions */ FILE *fetchXGetFTP(struct url *, struct url_stat *, const char *); diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c index cbbb8a8d351..ad4a4195215 100644 --- a/lib/libfetch/http.c +++ b/lib/libfetch/http.c @@ -1030,7 +1030,7 @@ typedef struct { static void init_http_auth_params(http_auth_params_t *s) { - s->scheme = s->realm = s->user = s->password = 0; + s->scheme = s->realm = s->user = s->password = NULL; } static void @@ -1129,7 +1129,7 @@ CvtHex(IN HASH Bin, OUT HASHHEX Hex) Hex[i*2] = hexchars[j]; j = Bin[i] & 0xf; Hex[i*2+1] = hexchars[j]; - }; + } Hex[HASHHEXLEN] = '\0'; }; @@ -1164,7 +1164,7 @@ DigestCalcHA1( MD5Update(&Md5Ctx, ":", 1); MD5Update(&Md5Ctx, pszCNonce, strlen(pszCNonce)); MD5Final(HA1, &Md5Ctx); - }; + } CvtHex(HA1, SessionKey); } @@ -1198,7 +1198,7 @@ DigestCalcResponse( if (strcasecmp(pszQop, "auth-int") == 0) { MD5Update(&Md5Ctx, ":", 1); MD5Update(&Md5Ctx, HEntity, HASHHEXLEN); - }; + } MD5Final(HA2, &Md5Ctx); CvtHex(HA2, HA2Hex); @@ -1215,7 +1215,7 @@ DigestCalcResponse( MD5Update(&Md5Ctx, ":", 1); MD5Update(&Md5Ctx, pszQop, strlen(pszQop)); MD5Update(&Md5Ctx, ":", 1); - }; + } MD5Update(&Md5Ctx, HA2Hex, HASHHEXLEN); MD5Final(RespHash, &Md5Ctx); CvtHex(RespHash, Response); @@ -1249,7 +1249,7 @@ http_digest_auth(conn_t *conn, const char *hdr, http_auth_challenge_t *c, int r; char noncecount[10]; char cnonce[40]; - char *options = 0; + char *options = NULL; if (!c->realm || !c->nonce) { DEBUG(fprintf(stderr, "realm/nonce not set in challenge\n")); @@ -1494,6 +1494,14 @@ http_print_html(FILE *out, FILE *in) * Core */ +FILE * +http_request(struct url *URL, const char *op, struct url_stat *us, + struct url *purl, const char *flags) +{ + + return (http_request_body(URL, op, us, purl, flags, NULL, NULL)); +} + /* * Send a request and process the reply * @@ -1501,8 +1509,9 @@ http_print_html(FILE *out, FILE *in) * XXX off into a separate function. */ FILE * -http_request(struct url *URL, const char *op, struct url_stat *us, - struct url *purl, const char *flags) +http_request_body(struct url *URL, const char *op, struct url_stat *us, + struct url *purl, const char *flags, const char *content_type, + const char *body) { char timebuf[80]; char hbuf[MAXHOSTNAMELEN + 7], *host; @@ -1519,6 +1528,7 @@ http_request(struct url *URL, const char *op, struct url_stat *us, http_headerbuf_t headerbuf; http_auth_challenges_t server_challenges; http_auth_challenges_t proxy_challenges; + size_t body_len; /* The following calls don't allocate anything */ init_http_headerbuf(&headerbuf); @@ -1683,15 +1693,31 @@ http_request(struct url *URL, const char *op, struct url_stat *us, else http_cmd(conn, "Referer: %s", p); } - if ((p = getenv("HTTP_USER_AGENT")) != NULL && *p != '\0') - http_cmd(conn, "User-Agent: %s", p); - else - http_cmd(conn, "User-Agent: %s " _LIBFETCH_VER, getprogname()); + if ((p = getenv("HTTP_USER_AGENT")) != NULL) { + /* no User-Agent if defined but empty */ + if (*p != '\0') + http_cmd(conn, "User-Agent: %s", p); + } else { + /* default User-Agent */ + http_cmd(conn, "User-Agent: %s " _LIBFETCH_VER, + getprogname()); + } if (url->offset > 0) http_cmd(conn, "Range: bytes=%lld-", (long long)url->offset); http_cmd(conn, "Connection: close"); + + if (body) { + body_len = strlen(body); + http_cmd(conn, "Content-Length: %zu", body_len); + if (content_type != NULL) + http_cmd(conn, "Content-Type: %s", content_type); + } + http_cmd(conn, ""); + if (body) + fetch_write(conn, body, body_len); + /* * Force the queued request to be dispatched. Normally, one * would do this with shutdown(2) but squid proxies can be @@ -2042,3 +2068,12 @@ fetchListHTTP(struct url *url __unused, const char *flags __unused) warnx("fetchListHTTP(): not implemented"); return (NULL); } + +FILE * +fetchReqHTTP(struct url *URL, const char *method, const char *flags, + const char *content_type, const char *body) +{ + + return (http_request_body(URL, method, NULL, http_get_proxy(URL, flags), + flags, content_type, body)); +} diff --git a/lib/libgeom/libgeom.3 b/lib/libgeom/libgeom.3 index b897fad5f77..bda0c9d03c3 100644 --- a/lib/libgeom/libgeom.3 +++ b/lib/libgeom/libgeom.3 @@ -388,6 +388,6 @@ The library appeared in .Fx 5.1 . .Sh AUTHORS -.An Poul-Henning Kamp Aq phk@FreeBSD.org -.An Lukas Ertl Aq le@FreeBSD.org -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org +.An Lukas Ertl Aq Mt le@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org diff --git a/lib/libgssapi/Makefile.depend b/lib/libgssapi/Makefile.depend index 4a1f10886ac..cf58a7bfde9 100644 --- a/lib/libgssapi/Makefile.depend +++ b/lib/libgssapi/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/libgssapi/mech.5 b/lib/libgssapi/mech.5 index dd15ba98938..619de02e1de 100644 --- a/lib/libgssapi/mech.5 +++ b/lib/libgssapi/mech.5 @@ -98,4 +98,4 @@ manual page first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/libiconv_modules/HZ/citrus_hz.c b/lib/libiconv_modules/HZ/citrus_hz.c index f9eb006af8d..d772b385b47 100644 --- a/lib/libiconv_modules/HZ/citrus_hz.c +++ b/lib/libiconv_modules/HZ/citrus_hz.c @@ -532,10 +532,9 @@ _citrus_HZ_parse_graphic(void *context, const char *name, const char *s) p = (void **)context; escape = (escape_t *)p[0]; ei = (_HZEncodingInfo *)p[1]; - graphic = malloc(sizeof(*graphic)); + graphic = calloc(1, sizeof(*graphic)); if (graphic == NULL) return (ENOMEM); - memset(graphic, 0, sizeof(*graphic)); if (strcmp("GL", name) == 0) { if (GL(escape) != NULL) goto release; @@ -598,10 +597,9 @@ _citrus_HZ_parse_escape(void *context, const char *name, const char *s) void *p[2]; ei = (_HZEncodingInfo *)context; - escape = malloc(sizeof(*escape)); + escape = calloc(1, sizeof(*escape)); if (escape == NULL) return (EINVAL); - memset(escape, 0, sizeof(*escape)); if (strcmp("0", name) == 0) { escape->set = E0SET(ei); TAILQ_INSERT_TAIL(E0SET(ei), escape, entry); diff --git a/lib/libkvm/kvm_amd64.c b/lib/libkvm/kvm_amd64.c index 65d697c9616..9a5ec64e95e 100644 --- a/lib/libkvm/kvm_amd64.c +++ b/lib/libkvm/kvm_amd64.c @@ -81,7 +81,7 @@ struct vmstate { /* * Map the ELF headers into the process' address space. We do this in two * steps: first the ELF header itself and using that information the whole - * set of headers. (Taken from kvm_ia64.c) + * set of headers. */ static int _kvm_maphdrs(kvm_t *kd, size_t sz) @@ -105,7 +105,6 @@ _kvm_maphdrs(kvm_t *kd, size_t sz) /* * Translate a physical memory address to a file-offset in the crash-dump. - * (Taken from kvm_ia64.c) */ static size_t _kvm_pa2off(kvm_t *kd, uint64_t pa, off_t *ofs) diff --git a/lib/libkvm/kvm_i386.c b/lib/libkvm/kvm_i386.c index 601126bc7a3..45f0a5e9b88 100644 --- a/lib/libkvm/kvm_i386.c +++ b/lib/libkvm/kvm_i386.c @@ -87,7 +87,7 @@ struct vmstate { /* * Map the ELF headers into the process' address space. We do this in two * steps: first the ELF header itself and using that information the whole - * set of headers. (Taken from kvm_ia64.c) + * set of headers. */ static int _kvm_maphdrs(kvm_t *kd, size_t sz) @@ -111,7 +111,6 @@ _kvm_maphdrs(kvm_t *kd, size_t sz) /* * Translate a physical memory address to a file-offset in the crash-dump. - * (Taken from kvm_ia64.c) */ static size_t _kvm_pa2off(kvm_t *kd, uint64_t pa, off_t *ofs) diff --git a/lib/libkvm/kvm_ia64.c b/lib/libkvm/kvm_ia64.c deleted file mode 100644 index 5db7e1e7ab0..00000000000 --- a/lib/libkvm/kvm_ia64.c +++ /dev/null @@ -1,375 +0,0 @@ -/* $FreeBSD$ */ -/* $NetBSD: kvm_alpha.c,v 1.7.2.1 1997/11/02 20:34:26 mellon Exp $ */ - -/* - * Copyright (c) 1994, 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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 -#include -#include - -#ifndef CROSS_LIBKVM -#include -#include -#include -#include -#else -#include "../../sys/ia64/include/atomic.h" -#include "../../sys/ia64/include/bootinfo.h" -#include "../../sys/ia64/include/elf.h" -#include "../../sys/ia64/include/pte.h" -#endif - -#include -#include -#include -#include -#include - -#include "kvm_private.h" - -#define REGION_BASE(n) (((uint64_t)(n)) << 61) -#define REGION_ADDR(x) ((x) & ((1LL<<61)-1LL)) - -#define NKPTEPG(ps) ((ps) / sizeof(struct ia64_lpte)) -#define NKPTEDIR(ps) ((ps) >> 3) -#define KPTE_PTE_INDEX(va,ps) (((va)/(ps)) % NKPTEPG(ps)) -#define KPTE_DIR0_INDEX(va,ps) ((((va)/(ps)) / NKPTEPG(ps)) / NKPTEDIR(ps)) -#define KPTE_DIR1_INDEX(va,ps) ((((va)/(ps)) / NKPTEPG(ps)) % NKPTEDIR(ps)) - -#define PBVM_BASE 0x9ffc000000000000UL -#define PBVM_PGSZ (64 * 1024) - -typedef size_t (a2p_f)(kvm_t *, uint64_t, off_t *); - -struct vmstate { - void *mmapbase; - size_t mmapsize; - size_t pagesize; - u_long kptdir; - u_long *pbvm_pgtbl; - u_int pbvm_pgtblsz; - a2p_f *kvatop; -}; - -/* - * Map the ELF headers into the process' address space. We do this in two - * steps: first the ELF header itself and using that information the whole - * set of headers. - */ -static int -ia64_maphdrs(kvm_t *kd, size_t sz) -{ - struct vmstate *vm = kd->vmst; - - /* munmap() previous mmap(). */ - if (vm->mmapbase != NULL) { - munmap(vm->mmapbase, vm->mmapsize); - vm->mmapbase = NULL; - } - - vm->mmapsize = sz; - vm->mmapbase = mmap(NULL, sz, PROT_READ, MAP_PRIVATE, kd->pmfd, 0); - if (vm->mmapbase == MAP_FAILED) { - _kvm_err(kd, kd->program, "cannot mmap corefile"); - return (-1); - } - - return (0); -} - -/* - * Physical core support. - */ - -static size_t -phys_addr2off(kvm_t *kd, uint64_t pa, off_t *ofs, size_t pgsz) -{ - Elf64_Ehdr *e; - Elf64_Phdr *p; - int n; - - if (pa != REGION_ADDR(pa)) - goto fail; - - e = (Elf64_Ehdr *)(kd->vmst->mmapbase); - n = e->e_phnum; - p = (Elf64_Phdr *)(void *)((uintptr_t)(void *)e + e->e_phoff); - while (n && (pa < p->p_paddr || pa >= p->p_paddr + p->p_memsz)) - p++, n--; - if (n == 0) - goto fail; - - *ofs = (pa - p->p_paddr) + p->p_offset; - if (pgsz == 0) - return (p->p_memsz - (pa - p->p_paddr)); - return (pgsz - ((size_t)pa & (pgsz - 1))); - - fail: - _kvm_err(kd, kd->program, "invalid physical address %#jx", - (uintmax_t)pa); - return (0); -} - -static size_t -phys_kvatop(kvm_t *kd, uint64_t va, off_t *ofs) -{ - struct ia64_lpte pte; - uint64_t pa, pgaddr, pt0addr, pt1addr; - size_t pgno, pgsz, pt0no, pt1no; - - if (va >= REGION_BASE(6)) { - /* Regions 6 and 7: direct mapped. */ - pa = REGION_ADDR(va); - return (phys_addr2off(kd, pa, ofs, 0)); - } else if (va >= REGION_BASE(5)) { - /* Region 5: Kernel Virtual Memory. */ - va = REGION_ADDR(va); - pgsz = kd->vmst->pagesize; - pt0no = KPTE_DIR0_INDEX(va, pgsz); - pt1no = KPTE_DIR1_INDEX(va, pgsz); - pgno = KPTE_PTE_INDEX(va, pgsz); - if (pt0no >= NKPTEDIR(pgsz)) - goto fail; - pt0addr = kd->vmst->kptdir + (pt0no << 3); - if (kvm_read(kd, pt0addr, &pt1addr, 8) != 8) - goto fail; - if (pt1addr == 0) - goto fail; - pt1addr += pt1no << 3; - if (kvm_read(kd, pt1addr, &pgaddr, 8) != 8) - goto fail; - if (pgaddr == 0) - goto fail; - pgaddr += pgno * sizeof(pte); - if (kvm_read(kd, pgaddr, &pte, sizeof(pte)) != sizeof(pte)) - goto fail; - if (!(pte.pte & PTE_PRESENT)) - goto fail; - pa = (pte.pte & PTE_PPN_MASK) + (va & (pgsz - 1)); - return (phys_addr2off(kd, pa, ofs, pgsz)); - } else if (va >= PBVM_BASE) { - /* Region 4: Pre-Boot Virtual Memory (PBVM). */ - va -= PBVM_BASE; - pgsz = PBVM_PGSZ; - pt0no = va / pgsz; - if (pt0no >= (kd->vmst->pbvm_pgtblsz >> 3)) - goto fail; - pt0addr = kd->vmst->pbvm_pgtbl[pt0no]; - if (!(pt0addr & PTE_PRESENT)) - goto fail; - pa = (pt0addr & PTE_PPN_MASK) + va % pgsz; - return (phys_addr2off(kd, pa, ofs, pgsz)); - } - - fail: - _kvm_err(kd, kd->program, "invalid kernel virtual address %#jx", - (uintmax_t)va); - *ofs = -1; - return (0); -} - -static ssize_t -phys_read(kvm_t *kd, uint64_t pa, void *buf, size_t bufsz) -{ - off_t ofs; - size_t sz; - - sz = phys_addr2off(kd, pa, &ofs, 0); - if (sz < bufsz) - return ((ssize_t)sz); - - if (lseek(kd->pmfd, ofs, 0) == -1) - return (-1); - return (read(kd->pmfd, buf, bufsz)); -} - -/* - * Virtual core support (aka minidump). - */ - -static size_t -virt_addr2off(kvm_t *kd, uint64_t va, off_t *ofs, size_t pgsz) -{ - Elf64_Ehdr *e; - Elf64_Phdr *p; - int n; - - if (va < REGION_BASE(4)) - goto fail; - - e = (Elf64_Ehdr *)(kd->vmst->mmapbase); - n = e->e_phnum; - p = (Elf64_Phdr *)(void *)((uintptr_t)(void *)e + e->e_phoff); - while (n && (va < p->p_vaddr || va >= p->p_vaddr + p->p_memsz)) - p++, n--; - if (n == 0) - goto fail; - - *ofs = (va - p->p_vaddr) + p->p_offset; - if (pgsz == 0) - return (p->p_memsz - (va - p->p_vaddr)); - return (pgsz - ((size_t)va & (pgsz - 1))); - - fail: - _kvm_err(kd, kd->program, "invalid virtual address %#jx", - (uintmax_t)va); - return (0); -} - -static size_t -virt_kvatop(kvm_t *kd, uint64_t va, off_t *ofs) -{ - - return (virt_addr2off(kd, va, ofs, 0)); -} - -/* - * KVM architecture support functions. - */ - -void -_kvm_freevtop(kvm_t *kd) -{ - struct vmstate *vm = kd->vmst; - - if (vm->pbvm_pgtbl != NULL) - free(vm->pbvm_pgtbl); - if (vm->mmapbase != NULL) - munmap(vm->mmapbase, vm->mmapsize); - free(vm); - kd->vmst = NULL; -} - -int -_kvm_initvtop(kvm_t *kd) -{ - struct bootinfo bi; - struct nlist nl[2]; - uint64_t va; - Elf64_Ehdr *ehdr; - size_t hdrsz; - ssize_t sz; - - kd->vmst = (struct vmstate *)_kvm_malloc(kd, sizeof(*kd->vmst)); - if (kd->vmst == NULL) { - _kvm_err(kd, kd->program, "cannot allocate vm"); - return (-1); - } - -#ifndef CROSS_LIBKVM - kd->vmst->pagesize = getpagesize(); -#else - kd->vmst->pagesize = 8192; -#endif - - if (ia64_maphdrs(kd, sizeof(Elf64_Ehdr)) == -1) - return (-1); - - ehdr = kd->vmst->mmapbase; - hdrsz = ehdr->e_phoff + ehdr->e_phentsize * ehdr->e_phnum; - if (ia64_maphdrs(kd, hdrsz) == -1) - return (-1); - - kd->vmst->kvatop = (ehdr->e_flags & EF_IA_64_ABSOLUTE) ? - phys_kvatop : virt_kvatop; - - /* - * Load the PBVM page table. We need this to resolve PBVM addresses. - * The PBVM page table is obtained from the bootinfo structure, of - * which the address is given to us in e_entry. If e_entry is 0, then - * this is assumed to be a pre-PBVM kernel. - * Note that the address of the bootinfo structure is either physical - * or virtual, depending on whether the core is physical or virtual. - */ - if (ehdr->e_entry != 0 && (ehdr->e_flags & EF_IA_64_ABSOLUTE) != 0) { - sz = phys_read(kd, ehdr->e_entry, &bi, sizeof(bi)); - if (sz != sizeof(bi)) { - _kvm_err(kd, kd->program, - "cannot read bootinfo at physical address %#jx", - (uintmax_t)ehdr->e_entry); - return (-1); - } - if (bi.bi_magic != BOOTINFO_MAGIC) { - _kvm_err(kd, kd->program, "invalid bootinfo"); - return (-1); - } - kd->vmst->pbvm_pgtbl = _kvm_malloc(kd, bi.bi_pbvm_pgtblsz); - if (kd->vmst->pbvm_pgtbl == NULL) { - _kvm_err(kd, kd->program, "cannot allocate page table"); - return (-1); - } - kd->vmst->pbvm_pgtblsz = bi.bi_pbvm_pgtblsz; - sz = phys_read(kd, bi.bi_pbvm_pgtbl, kd->vmst->pbvm_pgtbl, - bi.bi_pbvm_pgtblsz); - if (sz != bi.bi_pbvm_pgtblsz) { - _kvm_err(kd, kd->program, - "cannot read page table at physical address %#jx", - (uintmax_t)bi.bi_pbvm_pgtbl); - return (-1); - } - } else { - kd->vmst->pbvm_pgtbl = NULL; - kd->vmst->pbvm_pgtblsz = 0; - } - - /* - * At this point we've got enough information to use kvm_read() for - * direct mapped (ie region 6 and region 7) address, such as symbol - * addresses/values. - */ - - nl[0].n_name = "ia64_kptdir"; - nl[1].n_name = 0; - - if (kvm_nlist(kd, nl) != 0) { - _kvm_err(kd, kd->program, "bad namelist"); - return (-1); - } - - if (kvm_read(kd, (nl[0].n_value), &va, sizeof(va)) != sizeof(va)) { - _kvm_err(kd, kd->program, "cannot read kptdir"); - return (-1); - } - - if (va == REGION_BASE(5)) { - _kvm_err(kd, kd->program, "kptdir is itself virtual"); - return (-1); - } - - kd->vmst->kptdir = va; - return (0); -} - -int -_kvm_kvatop(kvm_t *kd, u_long va, off_t *ofs) -{ - size_t sz; - - sz = kd->vmst->kvatop(kd, va, ofs); - return ((sz > INT_MAX) ? INT_MAX : sz); -} diff --git a/lib/libldns/Makefile b/lib/libldns/Makefile index ae3518a4f26..db4b989506f 100644 --- a/lib/libldns/Makefile +++ b/lib/libldns/Makefile @@ -12,11 +12,11 @@ CFLAGS+= -I${LDNSDIR} SRCS= buffer.c dane.c dname.c dnssec.c dnssec_sign.c dnssec_verify.c \ dnssec_zone.c duration.c error.c higher.c host2str.c host2wire.c \ - keys.c net.c packet.c parse.c rbtree.c rdata.c resolver.c rr.c \ - rr_functions.c sha1.c sha2.c str2host.c tsig.c update.c util.c \ + keys.c net.c packet.c parse.c radix.c rbtree.c rdata.c resolver.c \ + rr.c rr_functions.c sha1.c sha2.c str2host.c tsig.c update.c util.c \ wire2host.c zone.c -SRCS+= b32_ntop.c b32_pton.c b64_ntop.c b64_pton.c +SRCS+= b64_ntop.c b64_pton.c DPADD+= ${LIBCRYPTO} LDADD+= -lcrypto diff --git a/lib/liblzma/Makefile.depend b/lib/liblzma/Makefile.depend index 467741f6d1a..4acc32f64da 100644 --- a/lib/liblzma/Makefile.depend +++ b/lib/liblzma/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/libmagic/Makefile b/lib/libmagic/Makefile index 59d772df552..14f17028e07 100644 --- a/lib/libmagic/Makefile +++ b/lib/libmagic/Makefile @@ -2,7 +2,8 @@ # Copyright (c) David E. O'Brien, 2000-2004, 2006, 2009 CONTRDIR= ${.CURDIR}/../../contrib/file -.PATH: ${CONTRDIR} +.PATH: ${CONTRDIR}/src +.PATH: ${CONTRDIR}/doc LIB= magic SHLIB_MAJOR= 4 @@ -18,7 +19,7 @@ INCS= magic.h MAGICPATH?= /usr/share/misc CFLAGS+= -DMAGIC='"${MAGICPATH}/magic"' -DHAVE_CONFIG_H -CFLAGS+= -I${.CURDIR} -I${CONTRDIR} +CFLAGS+= -I${.CURDIR} -I${CONTRDIR}/src WARNS?= 3 @@ -27,9 +28,9 @@ CLEANFILES+= magic magic.mgc FILES= magic magic.mgc FILESDIR= ${MAGICPATH} -MAGFILES= ${CONTRDIR}/Header\ - ${CONTRDIR}/Localstuff\ - ${CONTRDIR}/Magdir/[a-z]* +MAGFILES= ${CONTRDIR}/magic/Header \ + ${CONTRDIR}/magic/Localstuff \ + ${CONTRDIR}/magic/Magdir/[a-z]* magic: ${MAGFILES} cat ${.ALLSRC:O} > ${.TARGET} @@ -39,7 +40,7 @@ magic.mgc: mkmagic magic CLEANFILES+= mkmagic build-tools: mkmagic -mkmagic: apprentice.c encoding.c funcs.c magic.c print.c +mkmagic: apprentice.c cdf_time.c encoding.c funcs.c magic.c print.c ${CC} ${CFLAGS} -DCOMPILE_ONLY ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} \ ${LDADD} diff --git a/lib/libmagic/Makefile.depend b/lib/libmagic/Makefile.depend index 934940fb76d..ace658ad7a0 100644 --- a/lib/libmagic/Makefile.depend +++ b/lib/libmagic/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/libmagic/config.h b/lib/libmagic/config.h index c7e38ec761a..d80926d520b 100644 --- a/lib/libmagic/config.h +++ b/lib/libmagic/config.h @@ -3,15 +3,24 @@ /* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + /* Define in built-in ELF support is used */ #define BUILTIN_ELF 1 /* Define for ELF core file support */ #define ELFCORE 1 +/* Define to 1 if you have the `asctime_r' function. */ +#define HAVE_ASCTIME_R 1 + /* Define to 1 if you have the `asprintf' function. */ #define HAVE_ASPRINTF 1 +/* Define to 1 if you have the `ctime_r' function. */ +#define HAVE_CTIME_R 1 + /* HAVE_DAYLIGHT */ /* #undef HAVE_DAYLIGHT */ @@ -32,6 +41,9 @@ /* Define to 1 if you have the header file. */ #define HAVE_FCNTL_H 1 +/* Define to 1 if you have the `fmtcheck' function. */ +#define HAVE_FMTCHECK 1 + /* Define to 1 if you have the `fork' function. */ #define HAVE_FORK 1 @@ -47,11 +59,11 @@ /* Define to 1 if you have the `getopt_long' function. */ #define HAVE_GETOPT_LONG 1 -/* Define to 1 if the system has the type `int32_t'. */ -#define HAVE_INT32_T 1 +/* Define to 1 if you have the `getpagesize' function. */ +#define HAVE_GETPAGESIZE 1 -/* Define to 1 if the system has the type `int64_t'. */ -#define HAVE_INT64_T 1 +/* Define to 1 if the system has the type `intptr_t'. */ +#define HAVE_INTPTR_T 1 /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 @@ -68,7 +80,7 @@ /* Define to 1 if you have the header file. */ #define HAVE_LOCALE_H 1 -/* Define to 1 if you have the `mbrtowc' function. */ +/* Define to 1 if mbrtowc and mbstate_t are properly declared. */ #define HAVE_MBRTOWC 1 /* Define to 1 if declares mbstate_t. */ @@ -77,14 +89,20 @@ /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 +/* Define to 1 if you have the `mkostemp' function. */ +#define HAVE_MKOSTEMP 1 + /* Define to 1 if you have the `mkstemp' function. */ #define HAVE_MKSTEMP 1 -/* Define to 1 if you have the `mmap' function. */ +/* Define to 1 if you have a working `mmap' system call. */ #define HAVE_MMAP 1 -/* Define to 1 if the system has the type `pid_t'. */ -#define HAVE_PID_T 1 +/* Define to 1 if you have the `pread' function. */ +#define HAVE_PREAD 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDDEF_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDINT_H 1 @@ -92,6 +110,9 @@ /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 +/* Define to 1 if you have the `strcasestr' function. */ +#define HAVE_STRCASESTR 1 + /* Define to 1 if you have the `strerror' function. */ #define HAVE_STRERROR 1 @@ -131,6 +152,9 @@ /* Define to 1 if you have the header file. */ #define HAVE_SYS_MMAN_H 1 +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 @@ -155,17 +179,8 @@ /* HAVE_TZNAME */ #define HAVE_TZNAME 1 -/* Define to 1 if the system has the type `uint16_t'. */ -#define HAVE_UINT16_T 1 - -/* Define to 1 if the system has the type `uint32_t'. */ -#define HAVE_UINT32_T 1 - -/* Define to 1 if the system has the type `uint64_t'. */ -#define HAVE_UINT64_T 1 - -/* Define to 1 if the system has the type `uint8_t'. */ -#define HAVE_UINT8_T 1 +/* Define to 1 if the system has the type `uintptr_t'. */ +#define HAVE_UINTPTR_T 1 /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 @@ -182,6 +197,16 @@ /* Define to 1 if you have the `vasprintf' function. */ #define HAVE_VASPRINTF 1 +/* Define to 1 if you have the `vfork' function. */ +#define HAVE_VFORK 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_VFORK_H */ + +/* Define to 1 or 0, depending whether the compiler supports simple visibility + declarations. */ +#define HAVE_VISIBILITY 1 + /* Define to 1 if you have the header file. */ #define HAVE_WCHAR_H 1 @@ -191,6 +216,12 @@ /* Define to 1 if you have the `wcwidth' function. */ #define HAVE_WCWIDTH 1 +/* Define to 1 if `fork' works. */ +#define HAVE_WORKING_FORK 1 + +/* Define to 1 if `vfork' works. */ +#define HAVE_WORKING_VFORK 1 + /* Define to 1 if you have the header file. */ #define HAVE_ZLIB_H 1 @@ -206,9 +237,6 @@ . */ /* #undef MAJOR_IN_SYSMACROS */ -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -/* #undef NO_MINUS_C_MINUS_O */ - /* Name of package */ #define PACKAGE "file" @@ -219,7 +247,7 @@ #define PACKAGE_NAME "file" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "file 5.11" +#define PACKAGE_STRING "file 5.19" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "file" @@ -228,10 +256,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "5.11" - -/* The size of `long long', as computed by sizeof. */ -#define SIZEOF_LONG_LONG 8 +#define PACKAGE_VERSION "5.19" /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 @@ -262,7 +287,24 @@ /* Version number of package */ -#define VERSION "5.11" +#define VERSION "5.19" + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif /* Number of bits in a file offset, on hosts where this is settable. */ /* #undef _FILE_OFFSET_BITS */ @@ -283,45 +325,67 @@ /* Define to 1 if you need to in order for `stat' and other things to work. */ /* #undef _POSIX_SOURCE */ +/* Define for Solaris 2.5.1 so the uint32_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT32_T */ + +/* Define for Solaris 2.5.1 so the uint64_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT64_T */ + +/* Define for Solaris 2.5.1 so the uint8_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT8_T */ + /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ +/* Define to the type of a signed integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +/* #undef int32_t */ + +/* Define to the type of a signed integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +/* #undef int64_t */ + +/* Define to the type of a signed integer type wide enough to hold a pointer, + if such a type exists, and if the system does not define it. */ +/* #undef intptr_t */ + /* Define to a type if does not define. */ /* #undef mbstate_t */ /* Define to `long int' if does not define. */ /* #undef off_t */ +/* Define to `int' if does not define. */ +/* #undef pid_t */ + /* Define to `unsigned int' if does not define. */ /* #undef size_t */ +/* Define to the type of an unsigned integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint16_t */ -#ifdef _FREEBSD_UNUSED_ -#ifndef HAVE_UINT8_T -typedef unsigned char uint8_t; -#endif -#ifndef HAVE_UINT16_T -typedef unsigned short uint16_t; -#endif -#ifndef HAVE_UINT32_T -typedef unsigned int uint32_t; -#endif -#ifndef HAVE_INT32_T -typedef int int32_t; -#endif -#ifndef HAVE_UINT64_T -#if SIZEOF_LONG_LONG == 8 -typedef unsigned long long uint64_t; -#else -typedef unsigned long uint64_t; -#endif -#endif -#ifndef HAVE_INT64_T -#if SIZEOF_LONG_LONG == 8 -typedef long long int64_t; -#else -typedef long int64_t; -#endif -#endif -#endif /* _FREEBSD_UNUSED_ */ +/* Define to the type of an unsigned integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint32_t */ +/* Define to the type of an unsigned integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint64_t */ + +/* Define to the type of an unsigned integer type of width exactly 8 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint8_t */ + +/* Define to the type of an unsigned integer type wide enough to hold a + pointer, if such a type exists, and if the system does not define it. */ +/* #undef uintptr_t */ + +/* Define as `fork' if `vfork' does not work. */ +/* #undef vfork */ diff --git a/lib/libmd/Makefile.depend b/lib/libmd/Makefile.depend index 17ea6ebfae1..33e3fb551c7 100644 --- a/lib/libmd/Makefile.depend +++ b/lib/libmd/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/libmd/mdX.3 b/lib/libmd/mdX.3 index 223e2efa4b2..4cc321fda79 100644 --- a/lib/libmd/mdX.3 +++ b/lib/libmd/mdX.3 @@ -178,7 +178,7 @@ The original MDX routines were developed by .Tn RSA Data Security, Inc., and published in the above references. This code is derived directly from these implementations by -.An Poul-Henning Kamp Aq phk@FreeBSD.org +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . .Pp Phk ristede runen. .Sh BUGS diff --git a/lib/libmemstat/libmemstat.3 b/lib/libmemstat/libmemstat.3 index 3eff1566d03..0f6255399ea 100644 --- a/lib/libmemstat/libmemstat.3 +++ b/lib/libmemstat/libmemstat.3 @@ -484,7 +484,7 @@ library appeared in .Sh AUTHORS The kernel memory allocator changes necessary to support a general purpose monitoring library, along with the library, were written by -.An Robert Watson Aq rwatson@FreeBSD.org . +.An Robert Watson Aq Mt rwatson@FreeBSD.org . .Sh BUGS There are memory allocators in the kernel, such as the VM page allocator and diff --git a/lib/libmp/Makefile.depend b/lib/libmp/Makefile.depend index 4de5cd32a6b..62e4b3caef0 100644 --- a/lib/libmp/Makefile.depend +++ b/lib/libmp/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/libnetgraph/netgraph.3 b/lib/libnetgraph/netgraph.3 index bd557978f8a..9d8d26a0571 100644 --- a/lib/libnetgraph/netgraph.3 +++ b/lib/libnetgraph/netgraph.3 @@ -395,4 +395,4 @@ a version of .Fx 2.2 customized for the Whistle InterJet. .Sh AUTHORS -.An "Archie Cobbs" Aq archie@FreeBSD.org +.An Archie Cobbs Aq Mt archie@FreeBSD.org diff --git a/lib/libnv/nv.3 b/lib/libnv/nv.3 index 118f5bbd70b..63c8e8b0e20 100644 --- a/lib/libnv/nv.3 +++ b/lib/libnv/nv.3 @@ -194,7 +194,7 @@ The API supports the following data types: .Bl -ohang -offset indent .It Sy null ( NV_TYPE_NULL ) There is no data associated with the name. -.It Sy bool ( NV_TYPE_BOLL ) +.It Sy bool ( NV_TYPE_BOOL ) The value can be either .Dv true or @@ -600,5 +600,5 @@ library appeared in The .Nm libnv library was implemented by -.An Pawel Jakub Dawidek Aq pawel@dawidek.net +.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net under sponsorship from the FreeBSD Foundation. diff --git a/lib/libpam/modules/pam_group/pam_group.8 b/lib/libpam/modules/pam_group/pam_group.8 index 985094b1ed2..4f368e577c2 100644 --- a/lib/libpam/modules/pam_group/pam_group.8 +++ b/lib/libpam/modules/pam_group/pam_group.8 @@ -33,7 +33,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 9, 2011 +.Dd July 19, 2014 .Dt PAM_GROUP 8 .Os .Sh NAME @@ -48,6 +48,11 @@ .Sh DESCRIPTION The group service module for PAM accepts or rejects users based on their membership in a particular file group. +.Nm pam_group +provides functionality for two PAM categories: authentication and +account management. +In terms of the module-type parameter, they are the ``auth'' and +``account'' features. .Pp The following options may be passed to the .Nm diff --git a/lib/libpam/modules/pam_group/pam_group.c b/lib/libpam/modules/pam_group/pam_group.c index a6e32cd2bf7..6cf2774a308 100644 --- a/lib/libpam/modules/pam_group/pam_group.c +++ b/lib/libpam/modules/pam_group/pam_group.c @@ -47,15 +47,14 @@ __FBSDID("$FreeBSD$"); #include #define PAM_SM_AUTH +#define PAM_SM_ACCOUNT #include #include #include - -PAM_EXTERN int -pam_sm_authenticate(pam_handle_t *pamh, int flags __unused, - int argc __unused, const char *argv[] __unused) +static int +pam_group(pam_handle_t *pamh) { int local, remote; const char *group, *user; @@ -96,14 +95,12 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags __unused, if ((grp = getgrnam(group)) == NULL || grp->gr_mem == NULL) goto failed; - /* check if the group is empty */ - if (*grp->gr_mem == NULL) - goto failed; - - /* check membership */ + /* check if user's own primary group */ if (pwd->pw_gid == grp->gr_gid) goto found; - for (list = grp->gr_mem; *list != NULL; ++list) + + /* iterate over members */ + for (list = grp->gr_mem; list != NULL && *list != NULL; ++list) if (strcmp(*list, pwd->pw_name) == 0) goto found; @@ -122,6 +119,14 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags __unused, goto not_found; } +PAM_EXTERN int +pam_sm_authenticate(pam_handle_t *pamh, int flags __unused, + int argc __unused, const char *argv[] __unused) +{ + + return (pam_group(pamh)); +} + PAM_EXTERN int pam_sm_setcred(pam_handle_t * pamh __unused, int flags __unused, int argc __unused, const char *argv[] __unused) @@ -130,4 +135,12 @@ pam_sm_setcred(pam_handle_t * pamh __unused, int flags __unused, return (PAM_SUCCESS); } +PAM_EXTERN int +pam_sm_acct_mgmt(pam_handle_t *pamh, int flags __unused, + int argc __unused, const char *argv[] __unused) +{ + + return (pam_group(pamh)); +} + PAM_MODULE_ENTRY("pam_group"); diff --git a/lib/libpam/modules/pam_lastlog/pam_lastlog.c b/lib/libpam/modules/pam_lastlog/pam_lastlog.c index 72bb9421810..814edb8c59a 100644 --- a/lib/libpam/modules/pam_lastlog/pam_lastlog.c +++ b/lib/libpam/modules/pam_lastlog/pam_lastlog.c @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -68,7 +67,6 @@ PAM_EXTERN int pam_sm_open_session(pam_handle_t *pamh, int flags, int argc __unused, const char *argv[] __unused) { - struct passwd *pwd; struct utmpx *utx, utl; time_t t; const char *user; @@ -79,7 +77,7 @@ pam_sm_open_session(pam_handle_t *pamh, int flags, pam_err = pam_get_user(pamh, &user, NULL); if (pam_err != PAM_SUCCESS) return (pam_err); - if (user == NULL || (pwd = getpwnam(user)) == NULL) + if (user == NULL) return (PAM_SERVICE_ERR); PAM_LOG("Got user: %s", user); diff --git a/lib/libpam/modules/pam_passwdqc/pam_passwdqc.8 b/lib/libpam/modules/pam_passwdqc/pam_passwdqc.8 index 408f77d2707..abdd3907e97 100644 --- a/lib/libpam/modules/pam_passwdqc/pam_passwdqc.8 +++ b/lib/libpam/modules/pam_passwdqc/pam_passwdqc.8 @@ -123,7 +123,6 @@ password are not counted. In addition to being sufficiently long, passwords are required to contain enough different characters for the character classes and the minimum length they have been checked against. -.Pp .It Cm max Ns = Ns Ar N .Pq Cm max Ns = Ns 40 The maximum allowed password length. @@ -257,7 +256,7 @@ is that the former is incompatible with The .Nm module was written by -.An Solar Designer Aq solar@openwall.com . +.An Solar Designer Aq Mt solar@openwall.com . This manual page, derived from the author's documentation, was written for the .Fx diff --git a/lib/libpam/modules/pam_radius/pam_radius.8 b/lib/libpam/modules/pam_radius/pam_radius.8 index da36b7fe6c4..d71b4143441 100644 --- a/lib/libpam/modules/pam_radius/pam_radius.8 +++ b/lib/libpam/modules/pam_radius/pam_radius.8 @@ -126,9 +126,9 @@ manual page first appeared in The .Nm manual page was written by -.An Andrzej Bialecki Aq abial@FreeBSD.org . +.An Andrzej Bialecki Aq Mt abial@FreeBSD.org . .Pp The .Nm module was written by -.An John D. Polstra Aq jdp@FreeBSD.org . +.An John D. Polstra Aq Mt jdp@FreeBSD.org . diff --git a/lib/libpam/modules/pam_ssh/pam_ssh.8 b/lib/libpam/modules/pam_ssh/pam_ssh.8 index ea41455f2e5..7c1ee40bf1e 100644 --- a/lib/libpam/modules/pam_ssh/pam_ssh.8 +++ b/lib/libpam/modules/pam_ssh/pam_ssh.8 @@ -147,7 +147,7 @@ The .Nm module was originally written by .An -nosplit -.An "Andrew J. Korty" Aq ajk@iu.edu . +.An Andrew J. Korty Aq Mt ajk@iu.edu . The current implementation was developed for the .Fx Project by @@ -156,4 +156,4 @@ Associates, Inc.\& under DARPA/SPAWAR contract N66001-01-C-8035 .Pq Dq CBOSS , as part of the DARPA CHATS research program. This manual page was written by -.An "Mark R V Murray" Aq markm@FreeBSD.org . +.An Mark R V Murray Aq Mt markm@FreeBSD.org . diff --git a/lib/libpam/modules/pam_tacplus/pam_tacplus.8 b/lib/libpam/modules/pam_tacplus/pam_tacplus.8 index a1fe9ba7b8d..ee8cc78e0d9 100644 --- a/lib/libpam/modules/pam_tacplus/pam_tacplus.8 +++ b/lib/libpam/modules/pam_tacplus/pam_tacplus.8 @@ -116,11 +116,11 @@ module first appeared in The .Nm manual page was written by -.An Andrzej Bialecki Aq abial@FreeBSD.org +.An Andrzej Bialecki Aq Mt abial@FreeBSD.org and adapted to TACACS+ from RADIUS by -.An Mark R V Murray Aq markm@FreeBSD.org . +.An Mark R V Murray Aq Mt markm@FreeBSD.org . .Pp The .Nm module was written by -.An John D. Polstra Aq jdp@FreeBSD.org . +.An John D. Polstra Aq Mt jdp@FreeBSD.org . diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c index 2b7b61b2d6b..5282bb29f89 100644 --- a/lib/libpmc/libpmc.c +++ b/lib/libpmc/libpmc.c @@ -190,6 +190,11 @@ static const struct pmc_event_descr corei7_event_table[] = __PMC_EV_ALIAS_COREI7() }; +static const struct pmc_event_descr nehalem_ex_event_table[] = +{ + __PMC_EV_ALIAS_COREI7() +}; + static const struct pmc_event_descr haswell_event_table[] = { __PMC_EV_ALIAS_HASWELL() @@ -220,6 +225,11 @@ static const struct pmc_event_descr westmere_event_table[] = __PMC_EV_ALIAS_WESTMERE() }; +static const struct pmc_event_descr westmere_ex_event_table[] = +{ + __PMC_EV_ALIAS_WESTMERE() +}; + static const struct pmc_event_descr corei7uc_event_table[] = { __PMC_EV_ALIAS_COREI7UC() @@ -255,12 +265,14 @@ PMC_MDEP_TABLE(atom_silvermont, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TS PMC_MDEP_TABLE(core, IAP, PMC_CLASS_SOFT, PMC_CLASS_TSC); PMC_MDEP_TABLE(core2, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(corei7, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); +PMC_MDEP_TABLE(nehalem_ex, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(haswell, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); PMC_MDEP_TABLE(ivybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(ivybridge_xeon, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(sandybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); PMC_MDEP_TABLE(sandybridge_xeon, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(westmere, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); +PMC_MDEP_TABLE(westmere_ex, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(k7, K7, PMC_CLASS_SOFT, PMC_CLASS_TSC); PMC_MDEP_TABLE(k8, K8, PMC_CLASS_SOFT, PMC_CLASS_TSC); PMC_MDEP_TABLE(p4, P4, PMC_CLASS_SOFT, PMC_CLASS_TSC); @@ -298,12 +310,14 @@ PMC_CLASS_TABLE_DESC(atom_silvermont, IAP, atom_silvermont, iap); PMC_CLASS_TABLE_DESC(core, IAP, core, iap); PMC_CLASS_TABLE_DESC(core2, IAP, core2, iap); PMC_CLASS_TABLE_DESC(corei7, IAP, corei7, iap); +PMC_CLASS_TABLE_DESC(nehalem_ex, IAP, nehalem_ex, iap); PMC_CLASS_TABLE_DESC(haswell, IAP, haswell, iap); PMC_CLASS_TABLE_DESC(ivybridge, IAP, ivybridge, iap); PMC_CLASS_TABLE_DESC(ivybridge_xeon, IAP, ivybridge_xeon, iap); PMC_CLASS_TABLE_DESC(sandybridge, IAP, sandybridge, iap); PMC_CLASS_TABLE_DESC(sandybridge_xeon, IAP, sandybridge_xeon, iap); PMC_CLASS_TABLE_DESC(westmere, IAP, westmere, iap); +PMC_CLASS_TABLE_DESC(westmere_ex, IAP, westmere_ex, iap); PMC_CLASS_TABLE_DESC(ucf, UCF, ucf, ucf); PMC_CLASS_TABLE_DESC(corei7uc, UCP, corei7uc, ucp); PMC_CLASS_TABLE_DESC(haswelluc, UCP, haswelluc, ucp); @@ -608,6 +622,8 @@ static struct pmc_event_alias core2_aliases_without_iaf[] = { #define atom_silvermont_aliases_without_iaf core2_aliases_without_iaf #define corei7_aliases core2_aliases #define corei7_aliases_without_iaf core2_aliases_without_iaf +#define nehalem_ex_aliases core2_aliases +#define nehalem_ex_aliases_without_iaf core2_aliases_without_iaf #define haswell_aliases core2_aliases #define haswell_aliases_without_iaf core2_aliases_without_iaf #define ivybridge_aliases core2_aliases @@ -620,6 +636,8 @@ static struct pmc_event_alias core2_aliases_without_iaf[] = { #define sandybridge_xeon_aliases_without_iaf core2_aliases_without_iaf #define westmere_aliases core2_aliases #define westmere_aliases_without_iaf core2_aliases_without_iaf +#define westmere_ex_aliases core2_aliases +#define westmere_ex_aliases_without_iaf core2_aliases_without_iaf #define IAF_KW_OS "os" #define IAF_KW_USR "usr" @@ -863,7 +881,9 @@ iap_allocate_pmc(enum pmc_event pe, char *ctrspec, } else return (-1); } else if (cpu_info.pm_cputype == PMC_CPU_INTEL_COREI7 || - cpu_info.pm_cputype == PMC_CPU_INTEL_WESTMERE) { + cpu_info.pm_cputype == PMC_CPU_INTEL_WESTMERE || + cpu_info.pm_cputype == PMC_CPU_INTEL_NEHALEM_EX || + cpu_info.pm_cputype == PMC_CPU_INTEL_WESTMERE_EX) { if (KWPREFIXMATCH(p, IAP_KW_RSP "=")) { n = pmc_parse_mask(iap_rsp_mask_i7_wm, p, &rsp); } else @@ -2760,6 +2780,10 @@ pmc_event_names_of_class(enum pmc_class cl, const char ***eventnames, ev = corei7_event_table; count = PMC_EVENT_TABLE_SIZE(corei7); break; + case PMC_CPU_INTEL_NEHALEM_EX: + ev = nehalem_ex_event_table; + count = PMC_EVENT_TABLE_SIZE(nehalem_ex); + break; case PMC_CPU_INTEL_HASWELL: ev = haswell_event_table; count = PMC_EVENT_TABLE_SIZE(haswell); @@ -2784,6 +2808,10 @@ pmc_event_names_of_class(enum pmc_class cl, const char ***eventnames, ev = westmere_event_table; count = PMC_EVENT_TABLE_SIZE(westmere); break; + case PMC_CPU_INTEL_WESTMERE_EX: + ev = westmere_ex_event_table; + count = PMC_EVENT_TABLE_SIZE(westmere_ex); + break; } break; case PMC_CLASS_UCF: @@ -3079,6 +3107,9 @@ pmc_init(void) pmc_class_table[n++] = &corei7uc_class_table_descr; PMC_MDEP_INIT_INTEL_V2(corei7); break; + case PMC_CPU_INTEL_NEHALEM_EX: + PMC_MDEP_INIT_INTEL_V2(nehalem_ex); + break; case PMC_CPU_INTEL_HASWELL: pmc_class_table[n++] = &ucf_class_table_descr; pmc_class_table[n++] = &haswelluc_class_table_descr; @@ -3103,6 +3134,9 @@ pmc_init(void) pmc_class_table[n++] = &westmereuc_class_table_descr; PMC_MDEP_INIT_INTEL_V2(westmere); break; + case PMC_CPU_INTEL_WESTMERE_EX: + PMC_MDEP_INIT_INTEL_V2(westmere_ex); + break; case PMC_CPU_INTEL_PIV: PMC_MDEP_INIT(p4); pmc_class_table[n] = &p4_class_table_descr; @@ -3237,6 +3271,11 @@ _pmc_name_of_event(enum pmc_event pe, enum pmc_cputype cpu) ev = corei7_event_table; evfence = corei7_event_table + PMC_EVENT_TABLE_SIZE(corei7); break; + case PMC_CPU_INTEL_NEHALEM_EX: + ev = nehalem_ex_event_table; + evfence = nehalem_ex_event_table + + PMC_EVENT_TABLE_SIZE(nehalem_ex); + break; case PMC_CPU_INTEL_HASWELL: ev = haswell_event_table; evfence = haswell_event_table + PMC_EVENT_TABLE_SIZE(haswell); @@ -3261,6 +3300,11 @@ _pmc_name_of_event(enum pmc_event pe, enum pmc_cputype cpu) ev = westmere_event_table; evfence = westmere_event_table + PMC_EVENT_TABLE_SIZE(westmere); break; + case PMC_CPU_INTEL_WESTMERE_EX: + ev = westmere_ex_event_table; + evfence = westmere_ex_event_table + + PMC_EVENT_TABLE_SIZE(westmere_ex); + break; default: /* Unknown CPU type. */ break; } diff --git a/lib/libpmc/pmc.3 b/lib/libpmc/pmc.3 index c970da84605..8e6db485ae3 100644 --- a/lib/libpmc/pmc.3 +++ b/lib/libpmc/pmc.3 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 24, 2008 +.Dd July 28, 2014 .Dt PMC 3 .Os .Sh NAME @@ -525,14 +525,26 @@ API is .Xr pmc.atom 3 , .Xr pmc.core 3 , .Xr pmc.core2 3 , +.Xr pmc.haswell 3 , +.Xr pmc.haswelluc 3 , .Xr pmc.iaf 3 , +.Xr pmc.ivybridge 3 , +.Xr pmc.ivybridgexeon 3 , .Xr pmc.k7 3 , .Xr pmc.k8 3 , +.Xr pmc.mips24k 3 , +.Xr pmc.octeon 3 , .Xr pmc.p4 3 , .Xr pmc.p5 3 , .Xr pmc.p6 3 , +.Xr pmc.sandybridge 3 , +.Xr pmc.sandybridgeuc 3 , +.Xr pmc.sandybridgexeon 3 , .Xr pmc.soft 3 , .Xr pmc.tsc 3 , +.Xr pmc.westmere 3 , +.Xr pmc.westmereuc 3 , +.Xr pmc.xscale 3 , .Xr pmclog 3 , .Xr hwpmc 4 , .Xr pmccontrol 8 , @@ -546,5 +558,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.atom.3 b/lib/libpmc/pmc.atom.3 index 9b9a58fa95c..edf81ba54a5 100644 --- a/lib/libpmc/pmc.atom.3 +++ b/lib/libpmc/pmc.atom.3 @@ -1191,5 +1191,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.atomsilvermont.3 b/lib/libpmc/pmc.atomsilvermont.3 index 91e22e9e3f5..dca200aa8db 100644 --- a/lib/libpmc/pmc.atomsilvermont.3 +++ b/lib/libpmc/pmc.atomsilvermont.3 @@ -524,12 +524,11 @@ The library first appeared in .Fx 6.0 . .Sh AUTHORS +.An -nosplit The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . The support for the Atom Silvermont microarchitecture was written by -.An "Hiren Panchasara" -.Aq hiren@FreeBSD.org . +.An Hiren Panchasara Aq Mt hiren@FreeBSD.org . diff --git a/lib/libpmc/pmc.core.3 b/lib/libpmc/pmc.core.3 index 73e8d81d5dc..551e615dc32 100644 --- a/lib/libpmc/pmc.core.3 +++ b/lib/libpmc/pmc.core.3 @@ -805,5 +805,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.core2.3 b/lib/libpmc/pmc.core2.3 index 5c6b533164f..cd038fb411d 100644 --- a/lib/libpmc/pmc.core2.3 +++ b/lib/libpmc/pmc.core2.3 @@ -1121,5 +1121,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.corei7.3 b/lib/libpmc/pmc.corei7.3 index aaf1f022615..90d19dfcab3 100644 --- a/lib/libpmc/pmc.corei7.3 +++ b/lib/libpmc/pmc.corei7.3 @@ -1573,5 +1573,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.corei7uc.3 b/lib/libpmc/pmc.corei7uc.3 index 3114c8ea9f6..5b991138b73 100644 --- a/lib/libpmc/pmc.corei7uc.3 +++ b/lib/libpmc/pmc.corei7uc.3 @@ -877,5 +877,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.haswell.3 b/lib/libpmc/pmc.haswell.3 index dd0cbb82b44..ace9c2a544e 100644 --- a/lib/libpmc/pmc.haswell.3 +++ b/lib/libpmc/pmc.haswell.3 @@ -964,12 +964,11 @@ The library first appeared in .Fx 6.0 . .Sh AUTHORS +.An -nosplit The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . The support for the Haswell microarchitecture was written by -.An "Hiren Panchasara" -.Aq hiren.panchasara@gmail.com . +.An Hiren Panchasara Aq Mt hiren.panchasara@gmail.com . diff --git a/lib/libpmc/pmc.haswelluc.3 b/lib/libpmc/pmc.haswelluc.3 index dba9d474001..fedf056eae7 100644 --- a/lib/libpmc/pmc.haswelluc.3 +++ b/lib/libpmc/pmc.haswelluc.3 @@ -226,12 +226,11 @@ The library first appeared in .Fx 6.0 . .Sh AUTHORS +.An -nosplit The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . The support for the Haswell microarchitecture was added by -.An "Hiren Panchasara" -.Aq hiren.panchasara@gmail.com . +.An Hiren Panchasara Aq Mt hiren.panchasara@gmail.com . diff --git a/lib/libpmc/pmc.iaf.3 b/lib/libpmc/pmc.iaf.3 index 7e623d6548a..3184c199c59 100644 --- a/lib/libpmc/pmc.iaf.3 +++ b/lib/libpmc/pmc.iaf.3 @@ -146,5 +146,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.ivybridge.3 b/lib/libpmc/pmc.ivybridge.3 index 7d8bdca62e3..b8ad8e00c71 100644 --- a/lib/libpmc/pmc.ivybridge.3 +++ b/lib/libpmc/pmc.ivybridge.3 @@ -870,12 +870,11 @@ The library first appeared in .Fx 6.0 . .Sh AUTHORS +.An -nosplit The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . The support for the Ivy Bridge microarchitecture was written by -.An "Fabien Thomas" -.Aq fabient@FreeBSD.org . +.An Fabien Thomas Aq Mt fabient@FreeBSD.org . diff --git a/lib/libpmc/pmc.ivybridgexeon.3 b/lib/libpmc/pmc.ivybridgexeon.3 index 76d5e60fce8..3a5b7096b3a 100644 --- a/lib/libpmc/pmc.ivybridgexeon.3 +++ b/lib/libpmc/pmc.ivybridgexeon.3 @@ -900,12 +900,11 @@ The library first appeared in .Fx 6.0 . .Sh AUTHORS +.An -nosplit The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . The support for the Ivy Bridge Xeon microarchitecture was written by -.An "Hiren Panchasara" -.Aq hiren.panchasara@gmail.com . +.An Hiren Panchasara Aq Mt hiren.panchasara@gmail.com . diff --git a/lib/libpmc/pmc.k7.3 b/lib/libpmc/pmc.k7.3 index 646f3527514..a8be8143f9e 100644 --- a/lib/libpmc/pmc.k7.3 +++ b/lib/libpmc/pmc.k7.3 @@ -262,5 +262,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.k8.3 b/lib/libpmc/pmc.k8.3 index 628137d7ffa..45c70baa438 100644 --- a/lib/libpmc/pmc.k8.3 +++ b/lib/libpmc/pmc.k8.3 @@ -672,7 +672,6 @@ Count memory controller high priority bypasses. .It Li memory-controller-lo-pri-bypass Count memory controller low priority bypasses. .El -.Pp .It Li k8-nb-memory-controller-dram-slots-missed .Pq Event E2H Count memory controller DRAM command slots missed (in MemClks). @@ -796,5 +795,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.mips24k.3 b/lib/libpmc/pmc.mips24k.3 index 4acb0a7eab9..d886d0e8c90 100644 --- a/lib/libpmc/pmc.mips24k.3 +++ b/lib/libpmc/pmc.mips24k.3 @@ -403,11 +403,10 @@ The library first appeared in .Fx 6.0 . .Sh AUTHORS +.An -nosplit The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . MIPS support was added by -.An "George Neville-Neil" -.Aq gnn@FreeBSD.org . +.An George Neville-Neil Aq Mt gnn@FreeBSD.org . diff --git a/lib/libpmc/pmc.octeon.3 b/lib/libpmc/pmc.octeon.3 index be38dd8c578..019b448522e 100644 --- a/lib/libpmc/pmc.octeon.3 +++ b/lib/libpmc/pmc.octeon.3 @@ -243,11 +243,10 @@ The library first appeared in .Fx 6.0 . .Sh AUTHORS +.An -nosplit The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . MIPS support was added by -.An "George Neville-Neil" -.Aq gnn@FreeBSD.org . +.An George Neville-Neil Aq Mt gnn@FreeBSD.org . diff --git a/lib/libpmc/pmc.p4.3 b/lib/libpmc/pmc.p4.3 index b273edd8b1e..e113b72001e 100644 --- a/lib/libpmc/pmc.p4.3 +++ b/lib/libpmc/pmc.p4.3 @@ -541,7 +541,6 @@ can take the following value (which is also the default): .It Li running Count cycles when the processor is active. .El -.Pp .It Li p4-instr-retired Op Li ,mask= Ns Ar flags .Pq "TS event" Count instructions retired during a clock cycle. @@ -1221,5 +1220,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.p5.3 b/lib/libpmc/pmc.p5.3 index ebdd5054e2d..91d7677057b 100644 --- a/lib/libpmc/pmc.p5.3 +++ b/lib/libpmc/pmc.p5.3 @@ -457,5 +457,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.p6.3 b/lib/libpmc/pmc.p6.3 index 3fa98a75a39..6a8270a8679 100644 --- a/lib/libpmc/pmc.p6.3 +++ b/lib/libpmc/pmc.p6.3 @@ -1023,5 +1023,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.sandybridge.3 b/lib/libpmc/pmc.sandybridge.3 index 931bd9d5f4e..0b8f6b2f09a 100644 --- a/lib/libpmc/pmc.sandybridge.3 +++ b/lib/libpmc/pmc.sandybridge.3 @@ -949,12 +949,11 @@ The library first appeared in .Fx 6.0 . .Sh AUTHORS +.An -nosplit The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org. +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . The support for the Sandy Bridge microarchitecture was written by -.An "Davide Italiano" -.Aq davide@FreeBSD.org . +.An Davide Italiano Aq Mt davide@FreeBSD.org . diff --git a/lib/libpmc/pmc.sandybridgeuc.3 b/lib/libpmc/pmc.sandybridgeuc.3 index f952533334c..0215c36a45d 100644 --- a/lib/libpmc/pmc.sandybridgeuc.3 +++ b/lib/libpmc/pmc.sandybridgeuc.3 @@ -223,12 +223,11 @@ The library first appeared in .Fx 6.0 . .Sh AUTHORS +.An -nosplit The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . The support for the Sandy Bridge microarchitecture was added by -.An "Davide Italiano" -.Aq davide@FreeBSD.org . +.An Davide Italiano Aq Mt davide@FreeBSD.org . diff --git a/lib/libpmc/pmc.sandybridgexeon.3 b/lib/libpmc/pmc.sandybridgexeon.3 index 8d69abd107d..9a80f7892d1 100644 --- a/lib/libpmc/pmc.sandybridgexeon.3 +++ b/lib/libpmc/pmc.sandybridgexeon.3 @@ -1013,12 +1013,11 @@ The library first appeared in .Fx 6.0 . .Sh AUTHORS +.An -nosplit The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . The support for the Sandy Bridge Xeon microarchitecture was written by -.An "Hiren Panchasara" -.Aq hiren.panchasara@gmail.com . +.An Hiren Panchasara Aq Mt hiren.panchasara@gmail.com . diff --git a/lib/libpmc/pmc.soft.3 b/lib/libpmc/pmc.soft.3 index a6919aef0ca..5d331e220a9 100644 --- a/lib/libpmc/pmc.soft.3 +++ b/lib/libpmc/pmc.soft.3 @@ -96,11 +96,10 @@ The library first appeared in .Fx 6.0 . .Sh AUTHORS +.An -nosplit The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . Software PMC was written by -.An "Fabien Thomas" -.Aq fabient@FreeBSD.org . +.An Fabien Thomas Aq Mt fabient@FreeBSD.org . diff --git a/lib/libpmc/pmc.tsc.3 b/lib/libpmc/pmc.tsc.3 index 269200549d6..2392eb8db7a 100644 --- a/lib/libpmc/pmc.tsc.3 +++ b/lib/libpmc/pmc.tsc.3 @@ -80,5 +80,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.ucf.3 b/lib/libpmc/pmc.ucf.3 index 15399e43d02..6b027868d10 100644 --- a/lib/libpmc/pmc.ucf.3 +++ b/lib/libpmc/pmc.ucf.3 @@ -110,5 +110,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.westmere.3 b/lib/libpmc/pmc.westmere.3 index 547ee71eff0..6bfdf391c8b 100644 --- a/lib/libpmc/pmc.westmere.3 +++ b/lib/libpmc/pmc.westmere.3 @@ -1395,5 +1395,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.westmereuc.3 b/lib/libpmc/pmc.westmereuc.3 index 517c470fbe7..2f260c24456 100644 --- a/lib/libpmc/pmc.westmereuc.3 +++ b/lib/libpmc/pmc.westmereuc.3 @@ -1080,5 +1080,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.xscale.3 b/lib/libpmc/pmc.xscale.3 index 965ea741203..5a496b942ad 100644 --- a/lib/libpmc/pmc.xscale.3 +++ b/lib/libpmc/pmc.xscale.3 @@ -144,14 +144,13 @@ library first appeared in Intel XScale support first appeared in .Fx 9.0 . .Sh AUTHORS +.An -nosplit The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . .Pp Intel XScale support was added by -.An "Rui Paulo" -.Aq rpaulo@FreeBSD.org . +.An Rui Paulo Aq Mt rpaulo@FreeBSD.org . .Sh CAVEATS The Intel XScale code does not yet support sampling. diff --git a/lib/libproc/Makefile b/lib/libproc/Makefile index 930249628ed..5e5babffee7 100644 --- a/lib/libproc/Makefile +++ b/lib/libproc/Makefile @@ -17,7 +17,9 @@ CFLAGS+= -I${.CURDIR} # avoid cyclic dependency CFLAGS+= -I${.CURDIR:H}/librtld_db -.if ${MK_LIBCPLUSPLUS} != "no" +.if ${MK_CXX} == "no" +CFLAGS+= -DNO_CXA_DEMANGLE +.elif ${MK_LIBCPLUSPLUS} != "no" LDADD+= -lcxxrt DPADD+= ${LIBCXXRT} .else diff --git a/lib/libproc/proc_sym.c b/lib/libproc/proc_sym.c index 3777a46fd5e..4d600436c67 100644 --- a/lib/libproc/proc_sym.c +++ b/lib/libproc/proc_sym.c @@ -46,27 +46,34 @@ #include "_libproc.h" +#ifndef NO_CXA_DEMANGLE extern char *__cxa_demangle(const char *, char *, size_t *, int *); +#endif /* NO_CXA_DEMANGLE */ static void proc_rdl2prmap(rd_loadobj_t *, prmap_t *); static void demangle(const char *symbol, char *buf, size_t len) { +#ifndef NO_CXA_DEMANGLE char *dembuf; - size_t demlen = len; + size_t demlen; - dembuf = malloc(len); - if (!dembuf) - goto fail; - dembuf = __cxa_demangle(symbol, dembuf, &demlen, NULL); - if (!dembuf) - goto fail; - strlcpy(buf, dembuf, len); - free(dembuf); + if (symbol[0] == '_' && symbol[1] == 'Z' && symbol[2]) { + dembuf = malloc(len); + if (!dembuf) + goto fail; + demlen = len; + dembuf = __cxa_demangle(symbol, dembuf, &demlen, NULL); + if (!dembuf) + goto fail; + strlcpy(buf, dembuf, len); + free(dembuf); + } return; fail: +#endif /* NO_CXA_DEMANGLE */ strlcpy(buf, symbol, len); } @@ -297,10 +304,7 @@ proc_addr2sym(struct proc_handle *p, uintptr_t addr, char *name, if (addr >= rsym && addr < rsym + sym.st_size) { s = elf_strptr(e, dynsymstridx, sym.st_name); if (s) { - if (s[0] == '_' && s[1] == 'Z' && s[2]) - demangle(s, name, namesz); - else - strlcpy(name, s, namesz); + demangle(s, name, namesz); memcpy(symcopy, &sym, sizeof(sym)); /* * DTrace expects the st_value to contain @@ -335,10 +339,7 @@ proc_addr2sym(struct proc_handle *p, uintptr_t addr, char *name, if (addr >= rsym && addr < rsym + sym.st_size) { s = elf_strptr(e, symtabstridx, sym.st_name); if (s) { - if (s[0] == '_' && s[1] == 'Z' && s[2]) - demangle(s, name, namesz); - else - strlcpy(name, s, namesz); + demangle(s, name, namesz); memcpy(symcopy, &sym, sizeof(sym)); /* * DTrace expects the st_value to contain diff --git a/lib/libprocstat/Makefile.depend b/lib/libprocstat/Makefile.depend index bf92deb8955..914766954c5 100644 --- a/lib/libprocstat/Makefile.depend +++ b/lib/libprocstat/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/libprocstat/libprocstat.3 b/lib/libprocstat/libprocstat.3 index b472900dd8b..1c1f811e601 100644 --- a/lib/libprocstat/libprocstat.3 +++ b/lib/libprocstat/libprocstat.3 @@ -543,7 +543,7 @@ library appeared in The .Nm libprocstat library was written by -.An Stanislav Sedov Aq stas@FreeBSD.org . +.An Stanislav Sedov Aq Mt stas@FreeBSD.org . .Pp This manual page was written by -.An Sergey Kandaurov Aq pluknet@FreeBSD.org . +.An Sergey Kandaurov Aq Mt pluknet@FreeBSD.org . diff --git a/lib/libprocstat/zfs/Makefile.depend b/lib/libprocstat/zfs/Makefile.depend index 2b448e39c8b..b142a6736e9 100644 --- a/lib/libprocstat/zfs/Makefile.depend +++ b/lib/libprocstat/zfs/Makefile.depend @@ -5,7 +5,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libkvm \ lib/msun \ diff --git a/lib/librpcsec_gss/Makefile.depend b/lib/librpcsec_gss/Makefile.depend index 89fa5dfd28c..fc5d4714337 100644 --- a/lib/librpcsec_gss/Makefile.depend +++ b/lib/librpcsec_gss/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/librpcsec_gss/rpc_gss_get_error.3 b/lib/librpcsec_gss/rpc_gss_get_error.3 index f1d8fc74b4a..eea77c75549 100644 --- a/lib/librpcsec_gss/rpc_gss_get_error.3 +++ b/lib/librpcsec_gss/rpc_gss_get_error.3 @@ -55,4 +55,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_get_mech_info.3 b/lib/librpcsec_gss/rpc_gss_get_mech_info.3 index 9a26dc107d4..0bf6d452f71 100644 --- a/lib/librpcsec_gss/rpc_gss_get_mech_info.3 +++ b/lib/librpcsec_gss/rpc_gss_get_mech_info.3 @@ -65,4 +65,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_get_mechanisms.3 b/lib/librpcsec_gss/rpc_gss_get_mechanisms.3 index c37acea3421..7c3bcca0e64 100644 --- a/lib/librpcsec_gss/rpc_gss_get_mechanisms.3 +++ b/lib/librpcsec_gss/rpc_gss_get_mechanisms.3 @@ -52,4 +52,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_get_principal_name.3 b/lib/librpcsec_gss/rpc_gss_get_principal_name.3 index 50fc65b0fb2..286c09f6888 100644 --- a/lib/librpcsec_gss/rpc_gss_get_principal_name.3 +++ b/lib/librpcsec_gss/rpc_gss_get_principal_name.3 @@ -79,4 +79,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_get_versions.3 b/lib/librpcsec_gss/rpc_gss_get_versions.3 index d624f85e1bb..9d79db4f989 100644 --- a/lib/librpcsec_gss/rpc_gss_get_versions.3 +++ b/lib/librpcsec_gss/rpc_gss_get_versions.3 @@ -61,4 +61,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_getcred.3 b/lib/librpcsec_gss/rpc_gss_getcred.3 index 4ebd275728a..515bd99743f 100644 --- a/lib/librpcsec_gss/rpc_gss_getcred.3 +++ b/lib/librpcsec_gss/rpc_gss_getcred.3 @@ -82,4 +82,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_is_installed.3 b/lib/librpcsec_gss/rpc_gss_is_installed.3 index d427e87effa..3d83b71ad2b 100644 --- a/lib/librpcsec_gss/rpc_gss_is_installed.3 +++ b/lib/librpcsec_gss/rpc_gss_is_installed.3 @@ -62,4 +62,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_max_data_length.3 b/lib/librpcsec_gss/rpc_gss_max_data_length.3 index 1d3a9224f03..57cf673032c 100644 --- a/lib/librpcsec_gss/rpc_gss_max_data_length.3 +++ b/lib/librpcsec_gss/rpc_gss_max_data_length.3 @@ -61,4 +61,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_mech_to_oid.3 b/lib/librpcsec_gss/rpc_gss_mech_to_oid.3 index 14bd5ee8e76..1156325365d 100644 --- a/lib/librpcsec_gss/rpc_gss_mech_to_oid.3 +++ b/lib/librpcsec_gss/rpc_gss_mech_to_oid.3 @@ -65,4 +65,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_oid_to_mech.3 b/lib/librpcsec_gss/rpc_gss_oid_to_mech.3 index 661bdff851f..8ab8340f07c 100644 --- a/lib/librpcsec_gss/rpc_gss_oid_to_mech.3 +++ b/lib/librpcsec_gss/rpc_gss_oid_to_mech.3 @@ -65,4 +65,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_qop_to_num.3 b/lib/librpcsec_gss/rpc_gss_qop_to_num.3 index 0f95d278bf3..bb8b50a5d7f 100644 --- a/lib/librpcsec_gss/rpc_gss_qop_to_num.3 +++ b/lib/librpcsec_gss/rpc_gss_qop_to_num.3 @@ -67,4 +67,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_seccreate.3 b/lib/librpcsec_gss/rpc_gss_seccreate.3 index 836df2378fe..37e9efd5c04 100644 --- a/lib/librpcsec_gss/rpc_gss_seccreate.3 +++ b/lib/librpcsec_gss/rpc_gss_seccreate.3 @@ -109,4 +109,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_set_callback.3 b/lib/librpcsec_gss/rpc_gss_set_callback.3 index 4226285288a..2d202a5b038 100644 --- a/lib/librpcsec_gss/rpc_gss_set_callback.3 +++ b/lib/librpcsec_gss/rpc_gss_set_callback.3 @@ -105,7 +105,7 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . .Sh BUGS There is no mechanism for informing a server when a security context has been deleted. diff --git a/lib/librpcsec_gss/rpc_gss_set_defaults.3 b/lib/librpcsec_gss/rpc_gss_set_defaults.3 index 72f22147682..dcef9dad0b6 100644 --- a/lib/librpcsec_gss/rpc_gss_set_defaults.3 +++ b/lib/librpcsec_gss/rpc_gss_set_defaults.3 @@ -67,4 +67,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_set_svc_name.3 b/lib/librpcsec_gss/rpc_gss_set_svc_name.3 index a06d7d39aef..97f1dee4394 100644 --- a/lib/librpcsec_gss/rpc_gss_set_svc_name.3 +++ b/lib/librpcsec_gss/rpc_gss_set_svc_name.3 @@ -84,4 +84,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_svc_max_data_length.3 b/lib/librpcsec_gss/rpc_gss_svc_max_data_length.3 index f466e107434..24eeae90dd2 100644 --- a/lib/librpcsec_gss/rpc_gss_svc_max_data_length.3 +++ b/lib/librpcsec_gss/rpc_gss_svc_max_data_length.3 @@ -61,4 +61,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpcsec_gss.3 b/lib/librpcsec_gss/rpcsec_gss.3 index bcbef7cac06..d3120a6cee1 100644 --- a/lib/librpcsec_gss/rpcsec_gss.3 +++ b/lib/librpcsec_gss/rpcsec_gss.3 @@ -228,4 +228,4 @@ library first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librtld_db/librtld_db.3 b/lib/librtld_db/librtld_db.3 index 4645142f731..211ce79d757 100644 --- a/lib/librtld_db/librtld_db.3 +++ b/lib/librtld_db/librtld_db.3 @@ -179,7 +179,7 @@ and was modeled after the same library present in the Solaris operating system. The .Nm librtld_db library and this manual page were written by -.An Rui Paulo Aq rpaulo@FreeBSD.org +.An Rui Paulo Aq Mt rpaulo@FreeBSD.org under sponsorship from the FreeBSD Foundation. .Sh CAVEATS The functions diff --git a/lib/libsbuf/Makefile.depend b/lib/libsbuf/Makefile.depend index 467741f6d1a..4acc32f64da 100644 --- a/lib/libsbuf/Makefile.depend +++ b/lib/libsbuf/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/libsdp/sdp.3 b/lib/libsdp/sdp.3 index de115344e83..9d394e87249 100644 --- a/lib/libsdp/sdp.3 +++ b/lib/libsdp/sdp.3 @@ -409,7 +409,7 @@ to find out more about error. .Xr sdpcontrol 8 , .Xr sdpd 8 .Sh AUTHORS -.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com +.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com .Sh BUGS Most likely. Please report bugs if found. diff --git a/lib/libstand/Makefile b/lib/libstand/Makefile index 0e074d2a837..72b201e1225 100644 --- a/lib/libstand/Makefile +++ b/lib/libstand/Makefile @@ -57,12 +57,10 @@ SRCS+= ntoh.c # string functions from libc .PATH: ${.CURDIR}/../libc/string -.if ${MACHINE_CPUARCH} != "ia64" SRCS+= bcmp.c bcopy.c bzero.c ffs.c memccpy.c memchr.c memcmp.c memcpy.c \ memmove.c memset.c qdivrem.c strcat.c strchr.c strcmp.c strcpy.c \ strcspn.c strlen.c strncat.c strncmp.c strncpy.c strpbrk.c \ strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c -.endif .if ${MACHINE_CPUARCH} == "arm" .PATH: ${.CURDIR}/../libc/arm/gen @@ -82,17 +80,6 @@ SRCS+= aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S SRCS+= aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S .endif -.endif -.if ${MACHINE_CPUARCH} == "ia64" -.PATH: ${.CURDIR}/../libc/ia64/string -SRCS+= bcmp.c bcopy.S bzero.S ffs.S memccpy.c memchr.c memcmp.c memcpy.S \ - memmove.S memset.c strcat.c strchr.c strcmp.c strcpy.c strcspn.c \ - strlen.c strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \ - strspn.c strstr.c strtok.c swab.c - -.PATH: ${.CURDIR}/../libc/ia64/gen -SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S -SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S .endif .if ${MACHINE_CPUARCH} == "powerpc" .PATH: ${.CURDIR}/../libc/quad diff --git a/lib/libstand/Makefile.depend b/lib/libstand/Makefile.depend index 647f6f8b2c3..34236cbeda9 100644 --- a/lib/libstand/Makefile.depend +++ b/lib/libstand/Makefile.depend @@ -6,7 +6,6 @@ DIRDEPS = \ include \ include/arpa \ include/xlocale \ - lib/clang/include \ lib/libbz2 \ diff --git a/lib/libstand/libstand.3 b/lib/libstand/libstand.3 index 2938e2d90cb..b42c8b5bdd7 100644 --- a/lib/libstand/libstand.3 +++ b/lib/libstand/libstand.3 @@ -665,12 +665,12 @@ from .It .Nm zalloc from -.An Matthew Dillon Aq dillon@backplane.com +.An Matthew Dillon Aq Mt dillon@backplane.com .El .Pp The reorganisation and port to .Fx 3.0 , the environment functions and this manpage were written by -.An Mike Smith Aq msmith@FreeBSD.org . +.An Mike Smith Aq Mt msmith@FreeBSD.org . .Sh BUGS The lack of detailed memory usage data is unhelpful. diff --git a/lib/libstand/printf.c b/lib/libstand/printf.c index 977c0263883..157b327ead8 100644 --- a/lib/libstand/printf.c +++ b/lib/libstand/printf.c @@ -56,8 +56,17 @@ __FBSDID("$FreeBSD$"); #define MAXNBUF (sizeof(intmax_t) * CHAR_BIT + 1) +typedef void (kvprintf_fn_t)(int, void *); + static char *ksprintn (char *buf, uintmax_t num, int base, int *len, int upper); -static int kvprintf(char const *fmt, void (*func)(int), void *arg, int radix, va_list ap); +static int kvprintf(char const *fmt, kvprintf_fn_t *func, void *arg, int radix, va_list ap); + +static void +putchar_wrapper(int cc, void *arg) +{ + + putchar(cc); +} int printf(const char *fmt, ...) @@ -66,7 +75,7 @@ printf(const char *fmt, ...) int retval; va_start(ap, fmt); - retval = kvprintf(fmt, putchar, NULL, 10, ap); + retval = kvprintf(fmt, putchar_wrapper, NULL, 10, ap); va_end(ap); return retval; } @@ -75,7 +84,7 @@ void vprintf(const char *fmt, va_list ap) { - kvprintf(fmt, putchar, NULL, 10, ap); + kvprintf(fmt, putchar_wrapper, NULL, 10, ap); } int @@ -91,6 +100,46 @@ sprintf(char *buf, const char *cfmt, ...) return retval; } +struct print_buf { + char *buf; + size_t size; +}; + +static void +snprint_func(int ch, void *arg) +{ + struct print_buf *pbuf = arg; + + if (pbuf->size < 2) { + /* + * Reserve last buffer position for the terminating + * character: + */ + return; + } + *(pbuf->buf)++ = ch; + pbuf->size--; +} + +int +snprintf(char *buf, size_t size, const char *cfmt, ...) +{ + int retval; + va_list ap; + struct print_buf arg; + + arg.buf = buf; + arg.size = size; + + va_start(ap, cfmt); + retval = kvprintf(cfmt, &snprint_func, &arg, 10, ap); + va_end(ap); + + if (arg.size >= 1) + *(arg.buf)++ = 0; + return retval; +} + void vsprintf(char *buf, const char *cfmt, va_list ap) { @@ -149,9 +198,9 @@ ksprintn(char *nbuf, uintmax_t num, int base, int *lenp, int upper) * ("%*D", len, ptr, " " -> XX XX XX XX ... */ static int -kvprintf(char const *fmt, void (*func)(int), void *arg, int radix, va_list ap) +kvprintf(char const *fmt, kvprintf_fn_t *func, void *arg, int radix, va_list ap) { -#define PCHAR(c) {int cc=(c); if (func) (*func)(cc); else *d++ = cc; retval++; } +#define PCHAR(c) {int cc=(c); if (func) (*func)(cc, arg); else *d++ = cc; retval++; } char nbuf[MAXNBUF]; char *d; const char *p, *percent, *q; diff --git a/lib/libstand/qdivrem.c b/lib/libstand/qdivrem.c index 3a18eed8b31..bde3b0d56e4 100644 --- a/lib/libstand/qdivrem.c +++ b/lib/libstand/qdivrem.c @@ -46,14 +46,13 @@ __FBSDID("$FreeBSD$"); #define B (1 << HALF_BITS) /* digit base */ /* Combine two `digits' to make a single two-digit number. */ -#define COMBINE(a, b) (((u_long)(a) << HALF_BITS) | (b)) +#define COMBINE(a, b) (((u_int)(a) << HALF_BITS) | (b)) + +_Static_assert(sizeof(int) / 2 == sizeof(short), + "Bitwise functions in libstand are broken on this architecture\n"); /* select a type for digits in base B: use unsigned short if they fit */ -#if ULONG_MAX == 0xffffffff && USHRT_MAX >= 0xffff typedef unsigned short digit; -#else -typedef u_long digit; -#endif /* * Shift p[0]..p[len] left `sh' bits, ignoring any bits that @@ -74,7 +73,7 @@ shl(digit *p, int len, int sh) * __qdivrem(u, v, rem) returns u/v and, optionally, sets *rem to u%v. * * We do this in base 2-sup-HALF_BITS, so that all intermediate products - * fit within u_long. As a consequence, the maximum length dividend and + * fit within u_int. As a consequence, the maximum length dividend and * divisor are 4 `digits' in this base (they are shorter if they have * leading zeros). */ @@ -85,7 +84,7 @@ __qdivrem(uq, vq, arq) union uu tmp; digit *u, *v, *q; digit v1, v2; - u_long qhat, rhat, t; + u_int qhat, rhat, t; int m, n, d, j, i; digit uspace[5], vspace[5], qspace[5]; @@ -136,7 +135,7 @@ __qdivrem(uq, vq, arq) v[4] = LHALF(tmp.ul[L]); for (n = 4; v[1] == 0; v++) { if (--n == 1) { - u_long rbj; /* r*B+u[j] (not root boy jim) */ + u_int rbj; /* r*B+u[j] (not root boy jim) */ digit q1, q2, q3, q4; /* @@ -212,7 +211,7 @@ __qdivrem(uq, vq, arq) rhat = uj1; goto qhat_too_big; } else { - u_long nn = COMBINE(uj0, uj1); + u_int nn = COMBINE(uj0, uj1); qhat = nn / v1; rhat = nn % v1; } diff --git a/lib/libstand/quad.h b/lib/libstand/quad.h index 0ff27ff6635..349540a1e9f 100644 --- a/lib/libstand/quad.h +++ b/lib/libstand/quad.h @@ -54,6 +54,9 @@ #include #include +_Static_assert(sizeof(quad_t) == sizeof(int) * 2, + "Bitwise function in libstand are broken on this architecture\n"); + /* * Depending on the desired operation, we view a `long long' (aka quad_t) in * one or more of the following formats. @@ -61,8 +64,8 @@ union uu { quad_t q; /* as a (signed) quad */ quad_t uq; /* as an unsigned quad */ - long sl[2]; /* as two signed longs */ - u_long ul[2]; /* as two unsigned longs */ + int sl[2]; /* as two signed ints */ + u_int ul[2]; /* as two unsigned ints */ }; /* @@ -77,8 +80,7 @@ union uu { * and assembly. */ #define QUAD_BITS (sizeof(quad_t) * CHAR_BIT) -#define LONG_BITS (sizeof(long) * CHAR_BIT) -#define HALF_BITS (sizeof(long) * CHAR_BIT / 2) +#define HALF_BITS (sizeof(int) * CHAR_BIT / 2) /* * Extract high and low shortwords from longword, and move low shortword of diff --git a/lib/libstand/stand.h b/lib/libstand/stand.h index 2a1e9a99327..28087226a52 100644 --- a/lib/libstand/stand.h +++ b/lib/libstand/stand.h @@ -238,6 +238,7 @@ extern void mallocstats(void); extern int printf(const char *fmt, ...) __printflike(1, 2); extern void vprintf(const char *fmt, __va_list); extern int sprintf(char *buf, const char *cfmt, ...) __printflike(2, 3); +extern int snprintf(char *buf, size_t size, const char *cfmt, ...) __printflike(3, 4); extern void vsprintf(char *buf, const char *cfmt, __va_list); extern void twiddle(void); diff --git a/lib/libstdthreads/Makefile.depend b/lib/libstdthreads/Makefile.depend index 37acbe0cd62..3b39ad78036 100644 --- a/lib/libstdthreads/Makefile.depend +++ b/lib/libstdthreads/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/libstdthreads/thrd_create.3 b/lib/libstdthreads/thrd_create.3 index 5cd960890f2..df3bd4f922d 100644 --- a/lib/libstdthreads/thrd_create.3 +++ b/lib/libstdthreads/thrd_create.3 @@ -257,4 +257,4 @@ These functions are expected to conform to These functions appeared in .Fx 10.0 . .Sh AUTHORS -.An Ed Schouten Aq ed@FreeBSD.org +.An Ed Schouten Aq Mt ed@FreeBSD.org diff --git a/lib/libtelnet/Makefile b/lib/libtelnet/Makefile index a11138e48d9..7f737332673 100644 --- a/lib/libtelnet/Makefile +++ b/lib/libtelnet/Makefile @@ -15,7 +15,6 @@ CFLAGS+= -I${TELNETDIR} WARNS?= 2 -.if !defined(RELEASE_CRUNCH) .if ${MK_OPENSSL} != "no" SRCS+= encrypt.c auth.c enc_des.c sra.c pk.c CFLAGS+= -DENCRYPTION -DAUTHENTICATION -DSRA @@ -26,6 +25,5 @@ SRCS+= kerberos5.c CFLAGS+= -DKRB5 -I${KRB5DIR}/lib/krb5 -I${KRB5OBJDIR} -I${ASN1OBJDIR} CFLAGS+= -DFORWARD -Dnet_write=telnet_net_write .endif -.endif .include diff --git a/lib/libthr/Makefile.depend b/lib/libthr/Makefile.depend index 7cedd5f867c..be21aee72d1 100644 --- a/lib/libthr/Makefile.depend +++ b/lib/libthr/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/libthr/arch/ia64/Makefile.inc b/lib/libthr/arch/ia64/Makefile.inc deleted file mode 100644 index 795aa9992d5..00000000000 --- a/lib/libthr/arch/ia64/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD$ - -SRCS+= _umtx_op_err.S pthread_md.c diff --git a/lib/libthr/arch/ia64/ia64/_umtx_op_err.S b/lib/libthr/arch/ia64/ia64/_umtx_op_err.S deleted file mode 100644 index a71221096e6..00000000000 --- a/lib/libthr/arch/ia64/ia64/_umtx_op_err.S +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * Copyright (c) 2009 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 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 - -ENTRY(_umtx_op_err, 5) - CALLSYS_NOERROR(_umtx_op) - br.ret.sptk.few rp -END(_umtx_op_err) diff --git a/lib/libthr/arch/ia64/ia64/pthread_md.c b/lib/libthr/arch/ia64/ia64/pthread_md.c deleted file mode 100644 index c2ad71a4f77..00000000000 --- a/lib/libthr/arch/ia64/ia64/pthread_md.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2003 Daniel Eischen - * Copyright (c) 2005 David Xu - * 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. Neither the name of the author 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 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. - * - * $FreeBSD$ - */ - -#include -#include - -#include "pthread_md.h" - -/* - * The constructors. - */ -struct tcb * -_tcb_ctor(struct pthread *thread, int initial) -{ - struct tcb *tcb; - - tcb = _rtld_allocate_tls((initial) ? _tcb_get() : NULL, - sizeof(struct tcb), 16); - if (tcb) - tcb->tcb_thread = thread; - return (tcb); -} - -void -_tcb_dtor(struct tcb *tcb) -{ - _rtld_free_tls(tcb, sizeof(struct tcb), 16); -} diff --git a/lib/libthr/arch/ia64/include/pthread_md.h b/lib/libthr/arch/ia64/include/pthread_md.h deleted file mode 100644 index 69b3eece409..00000000000 --- a/lib/libthr/arch/ia64/include/pthread_md.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2003 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. - * - * $FreeBSD$ - */ - -#ifndef _PTHREAD_MD_H_ -#define _PTHREAD_MD_H_ - -#include - -#define CPU_SPINWAIT - -#define HAS__UMTX_OP_ERR 1 - -#define DTV_OFFSET offsetof(struct tcb, tcb_dtv) - -/* - * Variant I tcb. The structure layout is fixed, don't blindly - * change it! - */ -struct tcb { - void *tcb_dtv; - struct pthread *tcb_thread; -}; - -/* - * The tcb constructors. - */ -struct tcb *_tcb_ctor(struct pthread *, int); -void _tcb_dtor(struct tcb *); - -/* Called from the thread to set its private data. */ -static __inline void -_tcb_set(struct tcb *tcb) -{ - register struct tcb *tp __asm("%r13"); - - __asm __volatile("mov %0 = %1;;" : "=r"(tp) : "r"(tcb)); -} - -static __inline struct tcb * -_tcb_get(void) -{ - register struct tcb *tp __asm("%r13"); - - return (tp); -} - -extern struct pthread *_thr_initial; - -static __inline struct pthread * -_get_curthread(void) -{ - if (_thr_initial) - return (_tcb_get()->tcb_thread); - return (NULL); -} - -#endif /* _PTHREAD_MD_H_ */ diff --git a/lib/libthr/libthr.3 b/lib/libthr/libthr.3 index 696da17bdcb..bfbebec340b 100644 --- a/lib/libthr/libthr.3 +++ b/lib/libthr/libthr.3 @@ -53,10 +53,10 @@ The .Nm library was originally created by -.An "Jeff Roberson" Aq jeff@FreeBSD.org , +.An Jeff Roberson Aq Mt jeff@FreeBSD.org , and enhanced by -.An "Jonathan Mini" Aq mini@FreeBSD.org +.An Jonathan Mini Aq Mt mini@FreeBSD.org and -.An "Mike Makonnen" Aq mtm@FreeBSD.org . +.An Mike Makonnen Aq Mt mtm@FreeBSD.org . It has been substantially rewritten and optimized by -.An "David Xu" Aq davidxu@FreeBSD.org . +.An David Xu Aq Mt davidxu@FreeBSD.org . diff --git a/lib/csu/ia64/crti.S b/lib/libthr/plockstat.d similarity index 53% rename from lib/csu/ia64/crti.S rename to lib/libthr/plockstat.d index 66ef9484992..68586cf84fd 100644 --- a/lib/csu/ia64/crti.S +++ b/lib/libthr/plockstat.d @@ -1,60 +1,46 @@ -/*- - * Copyright (c) 2001 Peter Wemm - * 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. +/* + * Copyright (c) 2010 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Rui Paulo 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$ */ -#include -__FBSDID("$FreeBSD$"); +provider plockstat { + probe mutex__acquire(void *mutex, int rec, int spincount); + probe mutex__release(void *mutex, int rec); + probe mutex__block(void *mutex); + probe mutex__spin(void *mutex); + probe mutex__spun(void *mutex, int success, int spincount); + probe mutex__blocked(void *mutex, int success); + probe mutex__error(void *mutex, int err); -/* - * This file (and its companion crtn.S) form the terminators of the - * .init and .fini sections. - */ - .file "crti.S" - - .section .init,"ax",@progbits - .global _init# - .proc _init# -_init: - .regstk 0,2,0,0 - .prologue 12,loc0 - .save ar.pfs,loc1 - alloc loc1=ar.pfs,0,2,0,0 - mov loc0=b0 /* Save return addr */ - .body - .endp _init# - - .section .fini,"ax",@progbits - .global _fini# - .proc _fini# -_fini: - .regstk 0,2,0,0 - .prologue 12,loc0 - .save ar.pfs,loc1 - alloc loc1=ar.pfs,0,2,0,0 - mov loc0=b0 /* Save return addr */ - .body - .endp _fini# + probe rw__acquire(void *lock, int wr); + probe rw__release(void *lock, int wr); + probe rw__block(void *lock, int wr); + probe rw__blocked(void *lock, int wr, int success); + probe rw__error(void *lock, int wr, int err); +}; diff --git a/lib/libthr/thread/thr_fork.c b/lib/libthr/thread/thr_fork.c index c26541edf88..fc8768837ce 100644 --- a/lib/libthr/thread/thr_fork.c +++ b/lib/libthr/thread/thr_fork.c @@ -57,6 +57,7 @@ * */ +#include #include "namespace.h" #include #include @@ -174,8 +175,15 @@ _fork(void) was_threaded = 0; } - /* Fork a new process: */ - if ((ret = __sys_fork()) == 0) { + /* + * Fork a new process. + * There is no easy way to pre-resolve the __sys_fork symbol + * without performing the fork. Use the syscall(2) + * indirection, the syscall symbol is resolved in + * _thr_rtld_init() with side-effect free call. + */ + ret = syscall(SYS_fork); + if (ret == 0) { /* Child process */ errsave = errno; curthread->cancel_pending = 0; @@ -250,6 +258,5 @@ _fork(void) } errno = errsave; - /* Return the process ID: */ return (ret); } diff --git a/lib/libthr/thread/thr_rtld.c b/lib/libthr/thread/thr_rtld.c index fd379d615b7..5d899880d1c 100644 --- a/lib/libthr/thread/thr_rtld.c +++ b/lib/libthr/thread/thr_rtld.c @@ -32,10 +32,12 @@ */ #include #include +#include #include #include #include +#include "libc_private.h" #include "rtld_lock.h" #include "thr_private.h" @@ -207,7 +209,24 @@ _thr_rtld_init(void) li.thread_set_flag = _thr_rtld_set_flag; li.thread_clr_flag = _thr_rtld_clr_flag; li.at_fork = NULL; - + + /* + * Preresolve the symbols needed for the fork interposer. We + * call _rtld_atfork_pre() and _rtld_atfork_post() with NULL + * argument to indicate that no actual locking inside the + * functions should happen. Neither rtld compat locks nor + * libthr rtld locks cannot work there: + * - compat locks do not handle the case of two locks taken + * in write mode (the signal mask for the thread is corrupted); + * - libthr locks would work, but locked rtld_bind_lock prevents + * symbol resolution for _rtld_atfork_post. + */ + _rtld_atfork_pre(NULL); + _rtld_atfork_post(NULL); + _malloc_prefork(); + _malloc_postfork(); + syscall(SYS_getpid); + /* mask signals, also force to resolve __sys_sigprocmask PLT */ _thr_signal_block(curthread); _rtld_thread_init(&li); diff --git a/lib/libthread_db/Makefile.depend b/lib/libthread_db/Makefile.depend index 467741f6d1a..4acc32f64da 100644 --- a/lib/libthread_db/Makefile.depend +++ b/lib/libthread_db/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/libthread_db/arch/ia64/libpthread_md.c b/lib/libthread_db/arch/ia64/libpthread_md.c deleted file mode 100644 index f5f12d3ff64..00000000000 --- a/lib/libthread_db/arch/ia64/libpthread_md.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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 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 -#include -#include - -#include "libpthread_db.h" - -void -pt_reg_to_ucontext(const struct reg *r __unused, ucontext_t *uc __unused) -{ -} - -void -pt_ucontext_to_reg(const ucontext_t *uc __unused, struct reg *r __unused) -{ -} - -void -pt_fpreg_to_ucontext(const struct fpreg* r __unused, ucontext_t *uc __unused) -{ -} - -void -pt_ucontext_to_fpreg(const ucontext_t *uc __unused, struct fpreg *r __unused) -{ -} - -void -pt_md_init(void) -{ -} - -int -pt_reg_sstep(struct reg *reg __unused, int step __unused) -{ - return (0); -} diff --git a/lib/libucl/Makefile b/lib/libucl/Makefile index 3832c9fdd19..830c198bb49 100644 --- a/lib/libucl/Makefile +++ b/lib/libucl/Makefile @@ -5,7 +5,9 @@ LIBUCL= ${.CURDIR}/../../contrib/libucl LIB= ucl PRIVATELIB= true SHLIB_MAJOR= 1 -SRCS= ucl_emitter.c \ +SRCS= ucl_emitter_streamline.c \ + ucl_emitter_utils.c \ + ucl_emitter.c \ ucl_hash.c \ ucl_parser.c \ ucl_schema.c \ diff --git a/lib/libufs/bread.3 b/lib/libufs/bread.3 index 0a9b862c0ed..9109166bea4 100644 --- a/lib/libufs/bread.3 +++ b/lib/libufs/bread.3 @@ -96,4 +96,4 @@ These functions first appeared as part of in .Fx 5.0 . .Sh AUTHORS -.An Juli Mallett Aq jmallett@FreeBSD.org +.An Juli Mallett Aq Mt jmallett@FreeBSD.org diff --git a/lib/libufs/cgread.3 b/lib/libufs/cgread.3 index 38edf17ea14..28feaad1176 100644 --- a/lib/libufs/cgread.3 +++ b/lib/libufs/cgread.3 @@ -103,4 +103,4 @@ These functions first appeared as part of in .Fx 5.1 . .Sh AUTHORS -.An Juli Mallett Aq jmallett@FreeBSD.org +.An Juli Mallett Aq Mt jmallett@FreeBSD.org diff --git a/lib/libufs/libufs.3 b/lib/libufs/libufs.3 index 6a2c7f6aa73..5b5dd9b1c89 100644 --- a/lib/libufs/libufs.3 +++ b/lib/libufs/libufs.3 @@ -71,8 +71,8 @@ The library first appeared in .Fx 5.0 . .Sh AUTHORS -.An Juli Mallett Aq jmallett@FreeBSD.org +.An Juli Mallett Aq Mt jmallett@FreeBSD.org .Pp .An -nosplit Additional design, feedback, and ideas were provided by -.An Poul-Henning Kamp Aq phk@FreeBSD.org . +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . diff --git a/lib/libufs/sbread.3 b/lib/libufs/sbread.3 index e59365a80b2..8b5e8c0d4d6 100644 --- a/lib/libufs/sbread.3 +++ b/lib/libufs/sbread.3 @@ -78,4 +78,4 @@ These functions first appeared as part of in .Fx 5.0 . .Sh AUTHORS -.An Juli Mallett Aq jmallett@FreeBSD.org +.An Juli Mallett Aq Mt jmallett@FreeBSD.org diff --git a/lib/libufs/ufs_disk_close.3 b/lib/libufs/ufs_disk_close.3 index 25a059e87d6..6eb785a3998 100644 --- a/lib/libufs/ufs_disk_close.3 +++ b/lib/libufs/ufs_disk_close.3 @@ -109,4 +109,4 @@ These functions first appeared as part of in .Fx 5.0 . .Sh AUTHORS -.An Juli Mallett Aq jmallett@FreeBSD.org +.An Juli Mallett Aq Mt jmallett@FreeBSD.org diff --git a/lib/libulog/Makefile.depend b/lib/libulog/Makefile.depend index 0d8c29b0674..c448c48e5e6 100644 --- a/lib/libulog/Makefile.depend +++ b/lib/libulog/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/libunbound/Makefile b/lib/libunbound/Makefile index eab23e19fdd..c6bbedead59 100644 --- a/lib/libunbound/Makefile +++ b/lib/libunbound/Makefile @@ -5,29 +5,39 @@ LDNSDIR= ${.CURDIR}/../../contrib/ldns UNBOUNDDIR= ${.CURDIR}/../../contrib/unbound # Hold my beer and watch this -.PATH: ${UNBOUNDDIR} ${UNBOUNDDIR}/iterator ${UNBOUNDDIR}/libunbound ${UNBOUNDDIR}/services ${UNBOUNDDIR}/services/cache ${UNBOUNDDIR}/util ${UNBOUNDDIR}/util/data ${UNBOUNDDIR}/util/storage ${UNBOUNDDIR}/validator +.PATH: ${UNBOUNDDIR} ${UNBOUNDDIR}/iterator ${UNBOUNDDIR}/ldns ${UNBOUNDDIR}/libunbound ${UNBOUNDDIR}/services ${UNBOUNDDIR}/services/cache ${UNBOUNDDIR}/util ${UNBOUNDDIR}/util/data ${UNBOUNDDIR}/util/storage ${UNBOUNDDIR}/validator LIB= unbound PRIVATELIB= -CFLAGS= -I${LDNSDIR} -I${UNBOUNDDIR} +CFLAGS= -I${UNBOUNDDIR} -I${LDNSDIR} -I${.OBJDIR} -SRCS= alloc.c autotrust.c config_file.c configlexer.c configparser.c \ +SRCS= alloc.c autotrust.c config_file.c configlexer.l configparser.y \ context.c dname.c dns.c dnstree.c fptr_wlist.c infra.c \ iter_delegpt.c iter_donotq.c iter_fwd.c iter_hints.c iter_priv.c \ - iter_resptype.c iter_scrub.c iter_utils.c iterator.c libunbound.c \ - libworker.c listen_dnsport.c localzone.c locks.c log.c lookup3.c \ - lruhash.c mesh.c mini_event.c modstack.c module.c msgencode.c \ - msgparse.c msgreply.c net_help.c netevent.c outbound_list.c \ - outside_network.c packed_rrset.c random.c rbtree.c regional.c \ - rrset.c rtt.c slabhash.c timehist.c tube.c val_anchor.c \ + iter_resptype.c iter_scrub.c iter_utils.c iterator.c keyraw.c \ + libunbound.c libworker.c listen_dnsport.c localzone.c locks.c log.c \ + lookup3.c lruhash.c mesh.c mini_event.c modstack.c module.c \ + msgencode.c msgparse.c msgreply.c net_help.c netevent.c \ + outbound_list.c outside_network.c packed_rrset.c parse.c \ + parseutil.c random.c rbtree.c regional.c rrdef.c rrset.c rtt.c \ + sbuffer.c slabhash.c str2wire.c timehist.c tube.c val_anchor.c \ val_kcache.c val_kentry.c val_neg.c val_nsec.c val_nsec3.c \ val_secalgo.c val_sigcrypt.c val_utils.c validator.c \ - winsock_event.c + winsock_event.c wire2str.c WARNS?= 3 DPADD+= ${LIBSSL} ${LIBCRYPTO} ${LIBPTHREAD} LDADD+= -lssl -lcrypto -lpthread +# Misnamed file in upstream source +configlexer.l: configlexer.lex + cp -p ${.ALLSRC} ${.TARGET} +CLEANFILES+= configlexer.l + +# Symbol prefix for lex and yacc +LFLAGS= -Pub_c_ +YFLAGS= -pub_c_ -d + .include diff --git a/lib/libunbound/Makefile.depend b/lib/libunbound/Makefile.depend index 44c5fdc3413..2dac9b8fcc8 100644 --- a/lib/libunbound/Makefile.depend +++ b/lib/libunbound/Makefile.depend @@ -21,4 +21,16 @@ DIRDEPS = \ .if ${DEP_RELDIR} == ${_DEP_RELDIR} # local dependencies - needed for -jN in clean tree +config_file.So: configparser.h +config_file.o: configparser.h +config_file.po: configparser.h +configlexer.So: configlexer.c +configlexer.So: configparser.h +configlexer.o: configlexer.c +configlexer.o: configparser.h +configlexer.po: configlexer.c +configlexer.po: configparser.h +configparser.So: configparser.c +configparser.o: configparser.c +configparser.po: configparser.c .endif diff --git a/lib/libusb/libusb-1.0.pc b/lib/libusb/libusb-1.0.pc index bed98de3f99..b31affadbed 100644 --- a/lib/libusb/libusb-1.0.pc +++ b/lib/libusb/libusb-1.0.pc @@ -6,6 +6,6 @@ includedir=${prefix}/include Name: libusb-1.0 Description: Library that abstracts ways to access USB devices (v1.0) -Version: 1.0.9 +Version: 1.0.13 Libs: -L${libdir} -lusb Cflags: -I${includedir} diff --git a/lib/libusb/libusb.h b/lib/libusb/libusb.h index 4857f5bdb4f..e490f24a71b 100644 --- a/lib/libusb/libusb.h +++ b/lib/libusb/libusb.h @@ -33,6 +33,8 @@ #include #endif +#define LIBUSB_CALL + #ifdef __cplusplus extern "C" { #endif diff --git a/lib/libutil/flopen.3 b/lib/libutil/flopen.3 index 66657022c0e..aba788c67d8 100644 --- a/lib/libutil/flopen.3 +++ b/lib/libutil/flopen.3 @@ -98,4 +98,4 @@ and The .Nm function and this manual page were written by -.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . +.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org . diff --git a/lib/libutil/fparseln.3 b/lib/libutil/fparseln.3 index cd78437e3eb..245fba77ccf 100644 --- a/lib/libutil/fparseln.3 +++ b/lib/libutil/fparseln.3 @@ -122,7 +122,6 @@ Remove escape preceding any other character. .It Dv FPARSELN_UNESCALL All of the above. .El -.Pp .El .Sh RETURN VALUES Upon successful completion a pointer to the parsed line is returned; diff --git a/lib/libutil/fparseln.c b/lib/libutil/fparseln.c index 0624f0e4ea3..d03357eae95 100644 --- a/lib/libutil/fparseln.c +++ b/lib/libutil/fparseln.c @@ -1,4 +1,4 @@ -/* $NetBSD: fparseln.c,v 1.9 1999/09/20 04:48:06 lukem Exp $ */ +/* $NetBSD: fparseln.c,v 1.7 2007/03/08 19:57:53 drochner Exp $ */ /* * Copyright (c) 1997 Christos Zoulas. All rights reserved. @@ -59,7 +59,7 @@ isescaped(const char *sp, const char *p, int esc) /* No escape character */ if (esc == '\0') - return 1; + return 0; /* Count the number of escape characters that precede ours */ for (ne = 0, cp = p; --cp >= sp && *cp == esc; ne++) @@ -135,13 +135,19 @@ fparseln(FILE *fp, size_t *size, size_t *lineno, const char str[3], int flags) cp = &ptr[s - 1]; if (*cp == con && !isescaped(ptr, cp, esc)) { - s--; /* forget escape */ + s--; /* forget continuation char */ cnt = 1; } } - if (s == 0 && buf != NULL) - continue; + if (s == 0) { + /* + * nothing to add, skip realloc except in case + * we need a minimal buf to return an empty line + */ + if (cnt || buf != NULL) + continue; + } if ((cp = realloc(buf, len + s + 1)) == NULL) { free(buf); diff --git a/lib/libutil/kld.3 b/lib/libutil/kld.3 index 595ac96730b..f6b2c1394c1 100644 --- a/lib/libutil/kld.3 +++ b/lib/libutil/kld.3 @@ -90,4 +90,4 @@ The and .Fn kld_load functions and this manual page were written by -.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . +.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org . diff --git a/lib/libutil/login_class.3 b/lib/libutil/login_class.3 index 75f361481c8..c87faaeb881 100644 --- a/lib/libutil/login_class.3 +++ b/lib/libutil/login_class.3 @@ -160,7 +160,6 @@ capability "setenv=var1 val1,var2 val2..,varN valN". .It LOGIN_SETMAC Set the MAC label for the current process to the label specified in system login class database. -.Pp .It LOGIN_SETCPUMASK Create a new .Xr cpuset 2 diff --git a/lib/libutil/pidfile.3 b/lib/libutil/pidfile.3 index 30c880c1ad0..d5e2470752c 100644 --- a/lib/libutil/pidfile.3 +++ b/lib/libutil/pidfile.3 @@ -291,7 +291,7 @@ Probably called not from the process which used The .Nm pidfile functionality is based on ideas from -.An John-Mark Gurney Aq jmg@FreeBSD.org . +.An John-Mark Gurney Aq Mt jmg@FreeBSD.org . .Pp The code and manual page was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org . +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org . diff --git a/lib/libutil/pw_util.3 b/lib/libutil/pw_util.3 index 6c449ba069c..0d8c7632572 100644 --- a/lib/libutil/pw_util.3 +++ b/lib/libutil/pw_util.3 @@ -283,4 +283,4 @@ DARPA/SPAWAR contract N66001-01-C-8035 as part of the DARPA CHATS research program. .Pp This manual page was written by -.An Baptiste Daroussin Aq bapt@FreeBSD.org . +.An Baptiste Daroussin Aq Mt bapt@FreeBSD.org . diff --git a/lib/libutil/quotafile.3 b/lib/libutil/quotafile.3 index 1e75e9a8716..001a66c0e18 100644 --- a/lib/libutil/quotafile.3 +++ b/lib/libutil/quotafile.3 @@ -285,6 +285,6 @@ functions first appeared in The .Nm quotafile functions and this manual page were written by -.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org +.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org and -.An Marshall Kirk McKusick Aq mckusick@mckusick.com . +.An Marshall Kirk McKusick Aq Mt mckusick@mckusick.com . diff --git a/lib/libvgl/vgl.3 b/lib/libvgl/vgl.3 index 0979e44483a..d70ea73ddf3 100644 --- a/lib/libvgl/vgl.3 +++ b/lib/libvgl/vgl.3 @@ -468,4 +468,4 @@ The library appeared in .Fx 3.0 . .Sh AUTHORS -.An S\(/oren Schmidt Aq sos@FreeBSD.org +.An S\(/oren Schmidt Aq Mt sos@FreeBSD.org diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c index 4a7f852c6ff..93955c7c233 100644 --- a/lib/libvmmapi/vmmapi.c +++ b/lib/libvmmapi/vmmapi.c @@ -29,12 +29,16 @@ #include __FBSDID("$FreeBSD$"); -#include +#include #include #include #include +#include +#include +#include #include +#include #include #include @@ -57,6 +61,7 @@ struct vmctx { int fd; uint32_t lowmem_limit; enum vm_mmap_style vms; + int memflags; size_t lowmem; char *lowmem_addr; size_t highmem; @@ -101,6 +106,7 @@ vm_open(const char *name) assert(vm != NULL); vm->fd = -1; + vm->memflags = 0; vm->lowmem_limit = 3 * GB; vm->name = (char *)(vm + 1); strcpy(vm->name, name); @@ -180,10 +186,17 @@ vm_set_lowmem_limit(struct vmctx *ctx, uint32_t limit) ctx->lowmem_limit = limit; } +void +vm_set_memflags(struct vmctx *ctx, int flags) +{ + + ctx->memflags = flags; +} + static int setup_memory_segment(struct vmctx *ctx, vm_paddr_t gpa, size_t len, char **addr) { - int error; + int error, mmap_flags; struct vm_memory_segment seg; /* @@ -195,8 +208,11 @@ setup_memory_segment(struct vmctx *ctx, vm_paddr_t gpa, size_t len, char **addr) seg.len = len; error = ioctl(ctx->fd, VM_MAP_MEMORY, &seg); if (error == 0 && addr != NULL) { - *addr = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, - ctx->fd, gpa); + mmap_flags = MAP_SHARED; + if ((ctx->memflags & VM_MEM_F_INCORE) == 0) + mmap_flags |= MAP_NOCORE; + *addr = mmap(NULL, len, PROT_READ | PROT_WRITE, mmap_flags, + ctx->fd, gpa); } return (error); } @@ -259,6 +275,20 @@ vm_map_gpa(struct vmctx *ctx, vm_paddr_t gaddr, size_t len) return (NULL); } +size_t +vm_get_lowmem_size(struct vmctx *ctx) +{ + + return (ctx->lowmem); +} + +size_t +vm_get_highmem_size(struct vmctx *ctx) +{ + + return (ctx->highmem); +} + int vm_set_desc(struct vmctx *ctx, int vcpu, int reg, uint64_t base, uint32_t limit, uint32_t access) @@ -297,6 +327,16 @@ vm_get_desc(struct vmctx *ctx, int vcpu, int reg, return (error); } +int +vm_get_seg_desc(struct vmctx *ctx, int vcpu, int reg, struct seg_desc *seg_desc) +{ + int error; + + error = vm_get_desc(ctx, vcpu, reg, &seg_desc->base, &seg_desc->limit, + &seg_desc->access); + return (error); +} + int vm_set_register(struct vmctx *ctx, int vcpu, int reg, uint64_t val) { @@ -352,6 +392,13 @@ vm_suspend(struct vmctx *ctx, enum vm_suspend_how how) return (ioctl(ctx->fd, VM_SUSPEND, &vmsuspend)); } +int +vm_reinit(struct vmctx *ctx) +{ + + return (ioctl(ctx->fd, VM_REINIT, 0)); +} + static int vm_inject_exception_real(struct vmctx *ctx, int vcpu, int vector, int error_code, int error_code_valid) @@ -495,6 +542,7 @@ int vm_isa_pulse_irq(struct vmctx *ctx, int atpic_irq, int ioapic_irq) { struct vm_isa_irq isa_irq; + bzero(&isa_irq, sizeof(struct vm_isa_irq)); isa_irq.atpic_irq = atpic_irq; isa_irq.ioapic_irq = ioapic_irq; @@ -502,6 +550,19 @@ vm_isa_pulse_irq(struct vmctx *ctx, int atpic_irq, int ioapic_irq) return (ioctl(ctx->fd, VM_ISA_PULSE_IRQ, &isa_irq)); } +int +vm_isa_set_irq_trigger(struct vmctx *ctx, int atpic_irq, + enum vm_intr_trigger trigger) +{ + struct vm_isa_irq_trigger isa_irq_trigger; + + bzero(&isa_irq_trigger, sizeof(struct vm_isa_irq_trigger)); + isa_irq_trigger.atpic_irq = atpic_irq; + isa_irq_trigger.trigger = trigger; + + return (ioctl(ctx->fd, VM_ISA_SET_IRQ_TRIGGER, &isa_irq_trigger)); +} + int vm_inject_nmi(struct vmctx *ctx, int vcpu) { @@ -911,3 +972,177 @@ vm_get_hpet_capabilities(struct vmctx *ctx, uint32_t *capabilities) *capabilities = cap.capabilities; return (error); } + +static int +gla2gpa(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging, + uint64_t gla, int prot, int *fault, uint64_t *gpa) +{ + struct vm_gla2gpa gg; + int error; + + bzero(&gg, sizeof(struct vm_gla2gpa)); + gg.vcpuid = vcpu; + gg.prot = prot; + gg.gla = gla; + gg.paging = *paging; + + error = ioctl(ctx->fd, VM_GLA2GPA, &gg); + if (error == 0) { + *fault = gg.fault; + *gpa = gg.gpa; + } + return (error); +} + +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif + +int +vm_copy_setup(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging, + uint64_t gla, size_t len, int prot, struct iovec *iov, int iovcnt) +{ + uint64_t gpa; + int error, fault, i, n, off; + + for (i = 0; i < iovcnt; i++) { + iov[i].iov_base = 0; + iov[i].iov_len = 0; + } + + while (len) { + assert(iovcnt > 0); + error = gla2gpa(ctx, vcpu, paging, gla, prot, &fault, &gpa); + if (error) + return (-1); + if (fault) + return (1); + + off = gpa & PAGE_MASK; + n = min(len, PAGE_SIZE - off); + + iov->iov_base = (void *)gpa; + iov->iov_len = n; + iov++; + iovcnt--; + + gla += n; + len -= n; + } + return (0); +} + +void +vm_copyin(struct vmctx *ctx, int vcpu, struct iovec *iov, void *vp, size_t len) +{ + const char *src; + char *dst; + uint64_t gpa; + size_t n; + + dst = vp; + while (len) { + assert(iov->iov_len); + gpa = (uint64_t)iov->iov_base; + n = min(len, iov->iov_len); + src = vm_map_gpa(ctx, gpa, n); + bcopy(src, dst, n); + + iov++; + dst += n; + len -= n; + } +} + +void +vm_copyout(struct vmctx *ctx, int vcpu, const void *vp, struct iovec *iov, + size_t len) +{ + const char *src; + char *dst; + uint64_t gpa; + size_t n; + + src = vp; + while (len) { + assert(iov->iov_len); + gpa = (uint64_t)iov->iov_base; + n = min(len, iov->iov_len); + dst = vm_map_gpa(ctx, gpa, n); + bcopy(src, dst, n); + + iov++; + src += n; + len -= n; + } +} + +static int +vm_get_cpus(struct vmctx *ctx, int which, cpuset_t *cpus) +{ + struct vm_cpuset vm_cpuset; + int error; + + bzero(&vm_cpuset, sizeof(struct vm_cpuset)); + vm_cpuset.which = which; + vm_cpuset.cpusetsize = sizeof(cpuset_t); + vm_cpuset.cpus = cpus; + + error = ioctl(ctx->fd, VM_GET_CPUS, &vm_cpuset); + return (error); +} + +int +vm_active_cpus(struct vmctx *ctx, cpuset_t *cpus) +{ + + return (vm_get_cpus(ctx, VM_ACTIVE_CPUS, cpus)); +} + +int +vm_suspended_cpus(struct vmctx *ctx, cpuset_t *cpus) +{ + + return (vm_get_cpus(ctx, VM_SUSPENDED_CPUS, cpus)); +} + +int +vm_activate_cpu(struct vmctx *ctx, int vcpu) +{ + struct vm_activate_cpu ac; + int error; + + bzero(&ac, sizeof(struct vm_activate_cpu)); + ac.vcpuid = vcpu; + error = ioctl(ctx->fd, VM_ACTIVATE_CPU, &ac); + return (error); +} + +int +vm_get_intinfo(struct vmctx *ctx, int vcpu, uint64_t *info1, uint64_t *info2) +{ + struct vm_intinfo vmii; + int error; + + bzero(&vmii, sizeof(struct vm_intinfo)); + vmii.vcpuid = vcpu; + error = ioctl(ctx->fd, VM_GET_INTINFO, &vmii); + if (error == 0) { + *info1 = vmii.info1; + *info2 = vmii.info2; + } + return (error); +} + +int +vm_set_intinfo(struct vmctx *ctx, int vcpu, uint64_t info1) +{ + struct vm_intinfo vmii; + int error; + + bzero(&vmii, sizeof(struct vm_intinfo)); + vmii.vcpuid = vcpu; + vmii.info1 = info1; + error = ioctl(ctx->fd, VM_SET_INTINFO, &vmii); + return (error); +} diff --git a/lib/libvmmapi/vmmapi.h b/lib/libvmmapi/vmmapi.h index 2a2ca6b7f9d..fbb6ddd3acf 100644 --- a/lib/libvmmapi/vmmapi.h +++ b/lib/libvmmapi/vmmapi.h @@ -29,6 +29,10 @@ #ifndef _VMMAPI_H_ #define _VMMAPI_H_ +#include +#include + +struct iovec; struct vmctx; enum x2apic_state; @@ -42,6 +46,8 @@ enum vm_mmap_style { VM_MMAP_SPARSE, /* mappings created on-demand */ }; +#define VM_MEM_F_INCORE 0x01 /* include guest memory in core file */ + int vm_create(const char *name); struct vmctx *vm_open(const char *name); void vm_destroy(struct vmctx *ctx); @@ -53,15 +59,21 @@ void *vm_map_gpa(struct vmctx *ctx, vm_paddr_t gaddr, size_t len); int vm_get_gpa_pmap(struct vmctx *, uint64_t gpa, uint64_t *pte, int *num); uint32_t vm_get_lowmem_limit(struct vmctx *ctx); void vm_set_lowmem_limit(struct vmctx *ctx, uint32_t limit); +void vm_set_memflags(struct vmctx *ctx, int flags); +size_t vm_get_lowmem_size(struct vmctx *ctx); +size_t vm_get_highmem_size(struct vmctx *ctx); int vm_set_desc(struct vmctx *ctx, int vcpu, int reg, uint64_t base, uint32_t limit, uint32_t access); int vm_get_desc(struct vmctx *ctx, int vcpu, int reg, uint64_t *base, uint32_t *limit, uint32_t *access); +int vm_get_seg_desc(struct vmctx *ctx, int vcpu, int reg, + struct seg_desc *seg_desc); int vm_set_register(struct vmctx *ctx, int vcpu, int reg, uint64_t val); int vm_get_register(struct vmctx *ctx, int vcpu, int reg, uint64_t *retval); int vm_run(struct vmctx *ctx, int vcpu, uint64_t rip, struct vm_exit *ret_vmexit); int vm_suspend(struct vmctx *ctx, enum vm_suspend_how how); +int vm_reinit(struct vmctx *ctx); int vm_apicid2vcpu(struct vmctx *ctx, int apicid); int vm_inject_exception(struct vmctx *ctx, int vcpu, int vec); int vm_inject_exception2(struct vmctx *ctx, int vcpu, int vec, int errcode); @@ -75,6 +87,8 @@ int vm_ioapic_pincount(struct vmctx *ctx, int *pincount); int vm_isa_assert_irq(struct vmctx *ctx, int atpic_irq, int ioapic_irq); int vm_isa_deassert_irq(struct vmctx *ctx, int atpic_irq, int ioapic_irq); int vm_isa_pulse_irq(struct vmctx *ctx, int atpic_irq, int ioapic_irq); +int vm_isa_set_irq_trigger(struct vmctx *ctx, int atpic_irq, + enum vm_intr_trigger trigger); int vm_inject_nmi(struct vmctx *ctx, int vcpu); int vm_capability_name2type(const char *capname); const char *vm_capability_type2name(int type); @@ -92,6 +106,9 @@ int vm_setup_pptdev_msix(struct vmctx *ctx, int vcpu, int bus, int slot, int func, int idx, uint64_t addr, uint64_t msg, uint32_t vector_control); +int vm_get_intinfo(struct vmctx *ctx, int vcpu, uint64_t *i1, uint64_t *i2); +int vm_set_intinfo(struct vmctx *ctx, int vcpu, uint64_t exit_intinfo); + /* * Return a pointer to the statistics buffer. Note that this is not MT-safe. */ @@ -104,9 +121,25 @@ int vm_set_x2apic_state(struct vmctx *ctx, int vcpu, enum x2apic_state s); int vm_get_hpet_capabilities(struct vmctx *ctx, uint32_t *capabilities); +/* + * Translate the GLA range [gla,gla+len) into GPA segments in 'iov'. + * The 'iovcnt' should be big enough to accomodate all GPA segments. + * Returns 0 on success, 1 on a guest fault condition and -1 otherwise. + */ +int vm_copy_setup(struct vmctx *ctx, int vcpu, struct vm_guest_paging *pg, + uint64_t gla, size_t len, int prot, struct iovec *iov, int iovcnt); +void vm_copyin(struct vmctx *ctx, int vcpu, struct iovec *guest_iov, + void *host_dst, size_t len); +void vm_copyout(struct vmctx *ctx, int vcpu, const void *host_src, + struct iovec *guest_iov, size_t len); + /* Reset vcpu register state */ int vcpu_reset(struct vmctx *ctx, int vcpu); +int vm_active_cpus(struct vmctx *ctx, cpuset_t *cpus); +int vm_suspended_cpus(struct vmctx *ctx, cpuset_t *cpus); +int vm_activate_cpu(struct vmctx *ctx, int vcpu); + /* * FreeBSD specific APIs */ diff --git a/lib/libz/Makefile b/lib/libz/Makefile index fe6fb298cd7..1b2fec59911 100644 --- a/lib/libz/Makefile +++ b/lib/libz/Makefile @@ -55,6 +55,8 @@ CFLAGS+= -DSYMBOL_VERSIONING INCS= zconf.h zlib.h +.PATH: ${.CURDIR}/test + minigzip: all minigzip.o $(CC) -o minigzip minigzip.o -L. -lz @@ -66,6 +68,10 @@ test: example minigzip (export LD_LIBRARY_PATH=. ; \ echo hello world | ./minigzip | ./minigzip -d ) +beforeinstall: + ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${.CURDIR}/zlib.pc ${DESTDIR}${LIBDATADIR}/pkgconfig + .include ## XXX: clang integrated-as doesn't grok .intel_syntax directives yet diff --git a/lib/libz/Makefile.depend b/lib/libz/Makefile.depend index 467741f6d1a..4acc32f64da 100644 --- a/lib/libz/Makefile.depend +++ b/lib/libz/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/libz/zlib.pc b/lib/libz/zlib.pc new file mode 100644 index 00000000000..63a214f6ba7 --- /dev/null +++ b/lib/libz/zlib.pc @@ -0,0 +1,14 @@ +# $FreeBSD$ +prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +sharedlibdir=${libdir} +includedir=${prefix}/include + +Name: zlib +Description: zlib compression library +Version: 1.2.8 + +Requires: +Libs: -L${libdir} -L${sharedlibdir} -lz +Cflags: -I${includedir} diff --git a/lib/msun/Makefile b/lib/msun/Makefile index 800e0ab9155..e8458d49d5f 100644 --- a/lib/msun/Makefile +++ b/lib/msun/Makefile @@ -103,7 +103,7 @@ COMMON_SRCS+= e_acoshl.c e_acosl.c e_asinl.c e_atan2l.c e_atanhl.c \ e_remainderl.c e_sinhl.c e_sqrtl.c \ invtrig.c k_cosl.c k_sinl.c k_tanl.c \ s_asinhl.c s_atanl.c s_cbrtl.c s_ceill.c s_cosl.c s_cprojl.c \ - s_csqrtl.c s_exp2l.c s_expl.c s_floorl.c s_fmal.c \ + s_csqrtl.c s_erfl.c s_exp2l.c s_expl.c s_floorl.c s_fmal.c \ s_frexpl.c s_logbl.c s_logl.c s_nanl.c s_nextafterl.c \ s_nexttoward.c s_remquol.c s_rintl.c s_roundl.c s_scalbnl.c \ s_sinl.c s_tanhl.c s_tanl.c s_truncl.c w_cabsl.c @@ -166,7 +166,7 @@ MLINKS+=copysign.3 copysignf.3 copysign.3 copysignl.3 MLINKS+=cos.3 cosf.3 cos.3 cosl.3 MLINKS+=cosh.3 coshf.3 cosh.3 coshl.3 MLINKS+=csqrt.3 csqrtf.3 csqrt.3 csqrtl.3 -MLINKS+=erf.3 erfc.3 erf.3 erff.3 erf.3 erfcf.3 +MLINKS+=erf.3 erfc.3 erf.3 erff.3 erf.3 erfcf.3 erf.3 erfl.3 erf.3 erfcl.3 MLINKS+=exp.3 expm1.3 exp.3 expm1f.3 exp.3 expm1l.3 exp.3 pow.3 exp.3 powf.3 \ exp.3 exp2.3 exp.3 exp2f.3 exp.3 exp2l.3 exp.3 expf.3 exp.3 expl.3 MLINKS+=fabs.3 fabsf.3 fabs.3 fabsl.3 diff --git a/lib/msun/Makefile.depend b/lib/msun/Makefile.depend index 467741f6d1a..4acc32f64da 100644 --- a/lib/msun/Makefile.depend +++ b/lib/msun/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/msun/Symbol.map b/lib/msun/Symbol.map index c36472bafb0..e53ca07118f 100644 --- a/lib/msun/Symbol.map +++ b/lib/msun/Symbol.map @@ -265,6 +265,8 @@ FBSD_1.3 { ctanf; ctanh; ctanhf; + erfcl; + erfl; expl; expm1l; log10l; @@ -274,8 +276,6 @@ FBSD_1.3 { sinhl; tanhl; /* Implemented as weak aliases for imprecise versions */ - erfcl; - erfl; lgammal; powl; tgammal; diff --git a/lib/msun/ia64/Makefile.inc b/lib/msun/ia64/Makefile.inc deleted file mode 100644 index c941c66bb47..00000000000 --- a/lib/msun/ia64/Makefile.inc +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD$ - -ARCH_SRCS = s_fma.S s_fmaf.S s_fmal.S -LDBL_PREC = 64 -SYM_MAPS += ${.CURDIR}/ia64/Symbol.map diff --git a/lib/msun/ia64/Symbol.map b/lib/msun/ia64/Symbol.map deleted file mode 100644 index c92e75d6e01..00000000000 --- a/lib/msun/ia64/Symbol.map +++ /dev/null @@ -1,13 +0,0 @@ -/* - * $FreeBSD$ - */ -FBSD_1.0 { - feupdateenv; -}; - -FBSD_1.3 { - fesetexceptflag; - feraiseexcept; - fegetenv; - feholdexcept; -}; diff --git a/lib/msun/ia64/fenv.c b/lib/msun/ia64/fenv.c deleted file mode 100644 index 09d2d4e9252..00000000000 --- a/lib/msun/ia64/fenv.c +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * Copyright (c) 2004 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$ - */ - -#include - -#define __fenv_static -#include "fenv.h" - -#ifdef __GNUC_GNU_INLINE__ -#error "This file must be compiled with C99 'inline' semantics" -#endif - -const fenv_t __fe_dfl_env = 0x0009804c8a70033fULL; - -extern inline int feclearexcept(int __excepts); -extern inline int fegetexceptflag(fexcept_t *__flagp, int __excepts); -extern inline int fesetexceptflag(const fexcept_t *__flagp, int __excepts); -extern inline int feraiseexcept(int __excepts); -extern inline int fetestexcept(int __excepts); -extern inline int fegetround(void); -extern inline int fesetround(int __round); -extern inline int fegetenv(fenv_t *__envp); -extern inline int feholdexcept(fenv_t *__envp); -extern inline int fesetenv(const fenv_t *__envp); - -/* - * It doesn't pay to inline feupdateenv() because it includes one of - * the rare uses of feraiseexcept() where the argument is not a - * constant. Thus, no dead code elimination can occur, resulting in - * significant bloat. - */ -int -feupdateenv(const fenv_t *envp) -{ - fenv_t fpsr; - - __stfpsr(&fpsr); - __ldfpsr(*envp); - feraiseexcept((fpsr >> _FPUSW_SHIFT) & FE_ALL_EXCEPT); - return (0); -} diff --git a/lib/msun/ia64/fenv.h b/lib/msun/ia64/fenv.h deleted file mode 100644 index 0f001db0318..00000000000 --- a/lib/msun/ia64/fenv.h +++ /dev/null @@ -1,248 +0,0 @@ -/*- - * Copyright (c) 2004-2005 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$ - */ - -#ifndef _FENV_H_ -#define _FENV_H_ - -#include - -#ifndef __fenv_static -#define __fenv_static static -#endif - -typedef __uint64_t fenv_t; -typedef __uint16_t fexcept_t; - -/* Exception flags */ -#define FE_INVALID 0x01 -#define FE_DENORMAL 0x02 -#define FE_DIVBYZERO 0x04 -#define FE_OVERFLOW 0x08 -#define FE_UNDERFLOW 0x10 -#define FE_INEXACT 0x20 -#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_DENORMAL | FE_INEXACT | \ - FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW) - -/* Rounding modes */ -#define FE_TONEAREST 0x0000 -#define FE_DOWNWARD 0x0400 -#define FE_UPWARD 0x0800 -#define FE_TOWARDZERO 0x0c00 -#define _ROUND_MASK (FE_TONEAREST | FE_DOWNWARD | \ - FE_UPWARD | FE_TOWARDZERO) - -__BEGIN_DECLS - -/* Default floating-point environment */ -extern const fenv_t __fe_dfl_env; -#define FE_DFL_ENV (&__fe_dfl_env) - -#define _FPUSW_SHIFT 13 - -#define __stfpsr(__r) __asm __volatile("mov %0=ar.fpsr" : "=r" (*(__r))) -#define __ldfpsr(__r) __asm __volatile("mov ar.fpsr=%0;;" : : "r" (__r)) - -__fenv_static inline int -feclearexcept(int __excepts) -{ - fenv_t __fpsr; - - __stfpsr(&__fpsr); - __fpsr &= ~((fenv_t)__excepts << _FPUSW_SHIFT); - __ldfpsr(__fpsr); - return (0); -} - -__fenv_static inline int -fegetexceptflag(fexcept_t *__flagp, int __excepts) -{ - fenv_t __fpsr; - - __stfpsr(&__fpsr); - *__flagp = (fexcept_t)(__fpsr >> _FPUSW_SHIFT) & __excepts; - return (0); -} - -__fenv_static inline int -fesetexceptflag(const fexcept_t *__flagp, int __excepts) -{ - fenv_t __fpsr; - - __stfpsr(&__fpsr); - __fpsr &= ~((fenv_t)__excepts << _FPUSW_SHIFT); - __fpsr |= (fenv_t)(__excepts & *__flagp) << _FPUSW_SHIFT; - __ldfpsr(__fpsr); - return (0); -} - -/* - * It is worthwhile to use the inline version of this function iff it - * is called with arguments that are compile-time constants (due to - * dead code elimination). Unfortunately, gcc isn't smart enough to - * figure this out automatically, and there's no way to tell it. - * We assume that constant arguments will be the common case. - */ -__fenv_static inline int -feraiseexcept(int __excepts) -{ - volatile double d; - - /* - * With a compiler that supports the FENV_ACCESS pragma - * properly, simple expressions like '0.0 / 0.0' should - * be sufficient to generate traps. Unfortunately, we - * need to bring a volatile variable into the equation - * to prevent incorrect optimizations. - */ - if (__excepts & FE_INVALID) { - d = 0.0; - d = 0.0 / d; - } - if (__excepts & FE_DIVBYZERO) { - d = 0.0; - d = 1.0 / d; - } - if (__excepts & FE_OVERFLOW) { - d = 0x1.ffp1023; - d *= 2.0; - } - if (__excepts & FE_UNDERFLOW) { - d = 0x1p-1022; - d /= 0x1p1023; - } - if (__excepts & FE_INEXACT) { - d = 0x1p-1022; - d += 1.0; - } - return (0); -} - -__fenv_static inline int -fetestexcept(int __excepts) -{ - fenv_t __fpsr; - - __stfpsr(&__fpsr); - return ((__fpsr >> _FPUSW_SHIFT) & __excepts); -} - - -__fenv_static inline int -fegetround(void) -{ - fenv_t __fpsr; - - __stfpsr(&__fpsr); - return (__fpsr & _ROUND_MASK); -} - -__fenv_static inline int -fesetround(int __round) -{ - fenv_t __fpsr; - - if (__round & ~_ROUND_MASK) - return (-1); - __stfpsr(&__fpsr); - __fpsr &= ~_ROUND_MASK; - __fpsr |= __round; - __ldfpsr(__fpsr); - return (0); -} - -__fenv_static inline int -fegetenv(fenv_t *__envp) -{ - - __stfpsr(__envp); - return (0); -} - -__fenv_static inline int -feholdexcept(fenv_t *__envp) -{ - fenv_t __fpsr; - - __stfpsr(&__fpsr); - *__envp = __fpsr; - __fpsr &= ~((fenv_t)FE_ALL_EXCEPT << _FPUSW_SHIFT); - __fpsr |= FE_ALL_EXCEPT; - __ldfpsr(__fpsr); - return (0); -} - -__fenv_static inline int -fesetenv(const fenv_t *__envp) -{ - - __ldfpsr(*__envp); - return (0); -} - -int feupdateenv(const fenv_t *__envp); - -#if __BSD_VISIBLE - -/* We currently provide no external definitions of the functions below. */ - -static inline int -feenableexcept(int __mask) -{ - fenv_t __newfpsr, __oldfpsr; - - __stfpsr(&__oldfpsr); - __newfpsr = __oldfpsr & ~(__mask & FE_ALL_EXCEPT); - __ldfpsr(__newfpsr); - return (~__oldfpsr & FE_ALL_EXCEPT); -} - -static inline int -fedisableexcept(int __mask) -{ - fenv_t __newfpsr, __oldfpsr; - - __stfpsr(&__oldfpsr); - __newfpsr = __oldfpsr | (__mask & FE_ALL_EXCEPT); - __ldfpsr(__newfpsr); - return (~__oldfpsr & FE_ALL_EXCEPT); -} - -static inline int -fegetexcept(void) -{ - fenv_t __fpsr; - - __stfpsr(&__fpsr); - return (~__fpsr & FE_ALL_EXCEPT); -} - -#endif /* __BSD_VISIBLE */ - -__END_DECLS - -#endif /* !_FENV_H_ */ diff --git a/lib/msun/ia64/s_fma.S b/lib/msun/ia64/s_fma.S deleted file mode 100644 index 3fed3868bbe..00000000000 --- a/lib/msun/ia64/s_fma.S +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * Copyright (c) 2005 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. - */ - -#include -__FBSDID("$FreeBSD$") - -ENTRY(fma, 3) -{ - fma.d f8 = f8, f9, f10 - br.ret.sptk b0 -} -END(fma) diff --git a/lib/msun/ia64/s_fmaf.S b/lib/msun/ia64/s_fmaf.S deleted file mode 100644 index c12fb03e87e..00000000000 --- a/lib/msun/ia64/s_fmaf.S +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * Copyright (c) 2005 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. - */ - -#include -__FBSDID("$FreeBSD$") - -ENTRY(fmaf, 3) -{ - fma.s f8 = f8, f9, f10 - br.ret.sptk b0 -} -END(fmaf) diff --git a/lib/msun/ia64/s_fmal.S b/lib/msun/ia64/s_fmal.S deleted file mode 100644 index 4ae01cc00ca..00000000000 --- a/lib/msun/ia64/s_fmal.S +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * Copyright (c) 2005 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. - */ - -#include -__FBSDID("$FreeBSD$") - -ENTRY(fmal, 3) -{ - fma f8 = f8, f9, f10 - br.ret.sptk b0 -} -END(fmal) diff --git a/lib/msun/ld128/s_erfl.c b/lib/msun/ld128/s_erfl.c new file mode 100644 index 00000000000..e29c9691f45 --- /dev/null +++ b/lib/msun/ld128/s_erfl.c @@ -0,0 +1,329 @@ +/* @(#)s_erf.c 5.1 93/09/24 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * See s_erf.c for complete comments. + * + * Converted to long double by Steven G. Kargl. + */ +#include + +#include "fpmath.h" +#include "math.h" +#include "math_private.h" + +/* XXX Prevent compilers from erroneously constant folding these: */ +static const volatile long double tiny = 0x1p-10000L; + +static const double +half= 0.5, +one = 1, +two = 2; +/* + * In the domain [0, 2**-40], only the first term in the power series + * expansion of erf(x) is used. The magnitude of the first neglected + * terms is less than 2**-120. + */ +static const long double +efx = 1.28379167095512573896158903121545167e-01L, /* 0xecbff6a7, 0x481dd788, 0xb64d21a8, 0xeb06fc3f */ +efx8 = 1.02703333676410059116927122497236133e+00L, /* 0xecbff6a7, 0x481dd788, 0xb64d21a8, 0xeb06ff3f */ +/* + * Domain [0, 0.84375], range ~[-1.919e-38, 1.919e-38]: + * |(erf(x) - x)/x - pp(x)/qq(x)| < 2**-125.29 + */ +pp0 = 1.28379167095512573896158903121545167e-01L, /* 0x3ffc06eb, 0xa8214db6, 0x88d71d48, 0xa7f6bfec */ +pp1 = -3.14931554396568573802046931159683404e-01L, /* 0xbffd427d, 0x6ada7263, 0x547eb096, 0x95f37463 */ +pp2 = -5.27514920282183487103576956956725309e-02L, /* 0xbffab023, 0xe5a271e3, 0xb0e79b01, 0x2f7ac962 */ +pp3 = -1.13202828509005281355609495523452713e-02L, /* 0xbff872f1, 0x6a5023a1, 0xe08b3884, 0x326af20f */ +pp4 = -9.18626155872522453865998391206048506e-04L, /* 0xbff4e19f, 0xea5fb024, 0x43247a37, 0xe430b06c */ +pp5 = -7.87518862406176274922506447157284230e-05L, /* 0xbff14a4f, 0x31a85fe0, 0x7fff2204, 0x09c49b37 */ +pp6 = -3.42357944472240436548115331090560881e-06L, /* 0xbfeccb81, 0x4b43c336, 0xcd2eb6c2, 0x903f2d87 */ +pp7 = -1.37317432573890412634717890726745428e-07L, /* 0xbfe826e3, 0x0e915eb6, 0x42aee414, 0xf7e36805 */ +pp8 = -2.71115170113861755855049008732113726e-09L, /* 0xbfe2749e, 0x2b94fd00, 0xecb4d166, 0x0efb91f8 */ +pp9 = -3.37925756196555959454018189718117864e-11L, /* 0xbfdc293e, 0x1d9060cb, 0xd043204a, 0x314cd7f0 */ +qq1 = 4.76672625471551170489978555182449450e-01L, /* 0x3ffde81c, 0xde6531f0, 0x76803bee, 0x526e29e9 */ +qq2 = 1.06713144672281502058807525850732240e-01L, /* 0x3ffbb518, 0xd7a6bb74, 0xcd9bdd33, 0x7601eee5 */ +qq3 = 1.47747613127513761102189201923147490e-02L, /* 0x3ff8e423, 0xae527e18, 0xf12cb447, 0x723b4749 */ +qq4 = 1.39939377672028671891148770908874816e-03L, /* 0x3ff56ed7, 0xba055d84, 0xc21b45c4, 0x388d1812 */ +qq5 = 9.44302939359455241271983309378738276e-05L, /* 0x3ff18c11, 0xc18c99a4, 0x86d0fe09, 0x46387b4c */ +qq6 = 4.56199342312522842161301671745365650e-06L, /* 0x3fed3226, 0x73421d05, 0x08875300, 0x32fa1432 */ +qq7 = 1.53019260483764773845294600092361197e-07L, /* 0x3fe8489b, 0x3a63f627, 0x2b9ad2ce, 0x26516e57 */ +qq8 = 3.25542691121324805094777901250005508e-09L, /* 0x3fe2bf6c, 0x26d93a29, 0x9142be7c, 0x9f1dd043 */ +qq9 = 3.37405581964478060434410167262684979e-11L; /* 0x3fdc28c8, 0xfb8fa1be, 0x10e57eec, 0xaa19e49f */ + +static const long double +erx = 8.42700792949714894142232424201210961e-01L, /* 0x3ffeaf76, 0x7a741088, 0xb0000000, 0x00000000 */ +/* + * Domain [0.84375, 1.25], range ~[-2.521e-36, 2.523e-36]: + * |(erf(x) - erx) - pa(x)/qa(x)| < 2**-120.15 + */ +pa0 = -2.48010117891186017024438233323795897e-17L, /* 0xbfc7c97f, 0x77812279, 0x6c877f22, 0xef4bfb2e */ +pa1 = 4.15107497420594680894327969504526489e-01L, /* 0x3ffda911, 0xf096fbc2, 0x55662005, 0x2337fa64 */ +pa2 = -3.94180628087084846724448515851892609e-02L, /* 0xbffa42e9, 0xab54528c, 0xad529da1, 0x6efc2af3 */ +pa3 = 4.48897599625192107295954790681677462e-02L, /* 0x3ffa6fbc, 0xa65edba1, 0x0e4cbcea, 0x73ef9a31 */ +pa4 = 8.02069252143016600110972019232995528e-02L, /* 0x3ffb4887, 0x0e8b548e, 0x3230b417, 0x11b553b3 */ +pa5 = -1.02729816533435279443621120242391295e-02L, /* 0xbff850a0, 0x041de3ee, 0xd5bca6c9, 0x4ef5f9f2 */ +pa6 = 5.70777694530755634864821094419982095e-03L, /* 0x3ff77610, 0x9b501e10, 0x4c978382, 0x742df68f */ +pa7 = 1.22635150233075521018231779267077071e-03L, /* 0x3ff5417b, 0x0e623682, 0x60327da0, 0x96b9219e */ +pa8 = 5.36100234820204569428412542856666503e-04L, /* 0x3ff41912, 0x27ceb4c1, 0x1d3298ec, 0x84ced627 */ +pa9 = -1.97753571846365167177187858667583165e-04L, /* 0xbff29eb8, 0x23f5bcf3, 0x15c83c46, 0xe4fda98b */ +pa10 = 6.19333039900846970674794789568415105e-05L, /* 0x3ff103c4, 0x60f88e46, 0xc0c9fb02, 0x13cc7fc1 */ +pa11 = -5.40531400436645861492290270311751349e-06L, /* 0xbfed6abe, 0x9665f8a8, 0xdd0ad3ba, 0xe5dc0ee3 */ +qa1 = 9.05041313265490487793231810291907851e-01L, /* 0x3ffecf61, 0x93340222, 0xe9930620, 0xc4e61168 */ +qa2 = 6.79848064708886864767240880834868092e-01L, /* 0x3ffe5c15, 0x0ba858dc, 0xf7900ae9, 0xfea1e09a */ +qa3 = 4.04720609926471677581066689316516445e-01L, /* 0x3ffd9e6f, 0x145e9b00, 0x6d8c1749, 0xd2928623 */ +qa4 = 1.69183273898369996364661075664302225e-01L, /* 0x3ffc5a7c, 0xc2a363c1, 0xd6c19097, 0xef9b4063 */ +qa5 = 7.44476185988067992342479750486764248e-02L, /* 0x3ffb30ef, 0xfc7259ef, 0x1bcbb089, 0x686dd62d */ +qa6 = 2.02981172725892407200420389604788573e-02L, /* 0x3ff94c90, 0x7976cb0e, 0x21e1d36b, 0x0f09ca2b */ +qa7 = 6.94281866271607668268269403102277234e-03L, /* 0x3ff7c701, 0x2b193250, 0xc5d46ecc, 0x374843d8 */ +qa8 = 1.12952275469171559611651594706820034e-03L, /* 0x3ff52818, 0xfd2a7c06, 0xd13e38fd, 0xda4b34f5 */ +qa9 = 3.13736683241992737197226578597710179e-04L, /* 0x3ff348fa, 0x0cb48d18, 0x051f849b, 0x135ccf74 */ +qa10 = 1.17037675204033225470121134087771410e-05L, /* 0x3fee88b6, 0x98f47704, 0xa5d8f8f2, 0xc6422e11 */ +qa11 = 4.61312518293853991439362806880973592e-06L, /* 0x3fed3594, 0xe31db94f, 0x3592b693, 0xed4386b4 */ +qa12 = -1.02158572037456893687737553657431771e-06L; /* 0xbfeb123a, 0xd60d9b1e, 0x1f6fdeb9, 0x7dc8410a */ +/* + * Domain [1.25,2.85715], range ~[-2.922e-37,2.922e-37]: + * |log(x*erfc(x)) + x**2 + 0.5625 - ra(x)/sa(x)| < 2**-121.36 + */ +static const long double +ra0 = -9.86494292470069009555706994426014461e-03L, /* 0xbff84341, 0x239e8709, 0xe941b06a, 0xcb4b6ec5 */ +ra1 = -1.13580436992565640457579040117568870e+00L, /* 0xbfff22c4, 0x133f7c0d, 0x72d5e231, 0x2eb1ee3f */ +ra2 = -4.89744330295291950661185707066921755e+01L, /* 0xc00487cb, 0xa38b4fc2, 0xc136695b, 0xc1df8047 */ +ra3 = -1.10766149300215937173768072715352140e+03L, /* 0xc00914ea, 0x55e6beb3, 0xabc50e07, 0xb6e5664d */ +ra4 = -1.49991031232170934967642795601952100e+04L, /* 0xc00cd4b8, 0xd33243e6, 0xffbf6545, 0x3c57ef6e */ +ra5 = -1.29805749738318462882524181556996692e+05L, /* 0xc00ffb0d, 0xbfeed9b6, 0x5b2a3ff4, 0xe245bd3c */ +ra6 = -7.42828497044940065828871976644647850e+05L, /* 0xc0126ab5, 0x8fe7caca, 0x473352d9, 0xcd4e0c90 */ +ra7 = -2.85637299581890734287995171242421106e+06L, /* 0xc0145cad, 0xa7f76fe7, 0x3e358051, 0x1799f927 */ +ra8 = -7.40674797129824999383748865571026084e+06L, /* 0xc015c412, 0x6fe29c02, 0x298ad158, 0x7d24e45c */ +ra9 = -1.28653420911930973914078724204151759e+07L, /* 0xc016889e, 0x7c2eb0dc, 0x95d5863b, 0x0aa34dc3 */ +ra10 = -1.47198163599330179552932489109452638e+07L, /* 0xc016c136, 0x90b84923, 0xf9bcb497, 0x19bbd0f5 */ +ra11 = -1.07812992258382800318665248311522624e+07L, /* 0xc0164904, 0xe673a113, 0x35d7f079, 0xe13701f3 */ +ra12 = -4.83545565681708642630419905537756076e+06L, /* 0xc0152721, 0xfea094a8, 0x869eb39d, 0x413d6f13 */ +ra13 = -1.23956521201673964822976917356685286e+06L, /* 0xc0132ea0, 0xd3646baa, 0x2fe62b0d, 0xbae5ce85 */ +ra14 = -1.62289333553652417591275333240371812e+05L, /* 0xc0103cf8, 0xaab1e2d6, 0x4c25e014, 0x248d76ab */ +ra15 = -8.82890392601176969729168894389833110e+03L, /* 0xc00c13e7, 0x3b3d8f94, 0x6fbda6f6, 0xe7049a82 */ +ra16 = -1.22591866337261720023681535568334619e+02L, /* 0xc005ea5e, 0x12358891, 0xcfa712c5, 0x77f050d4 */ +sa1 = 6.44508918884710829371852723353794047e+01L, /* 0x400501cd, 0xb69a6c0f, 0x5716de14, 0x47161af6 */ +sa2 = 1.76118475473171481523704824327358534e+03L, /* 0x4009b84b, 0xd305829f, 0xc4c771b0, 0xbf1f7f9b */ +sa3 = 2.69448346969488374857087646131950188e+04L, /* 0x400da503, 0x56bacc05, 0x4fdba68d, 0x2cca27e6 */ +sa4 = 2.56826633369941456778326497384543763e+05L, /* 0x4010f59d, 0x51124428, 0x69c41de6, 0xbd0d5753 */ +sa5 = 1.60647413092257206847700054645905859e+06L, /* 0x40138834, 0xa2184244, 0x557a1bed, 0x68c9d556 */ +sa6 = 6.76963075165099718574753447122393797e+06L, /* 0x40159d2f, 0x7b01b0cc, 0x8bac9e95, 0x5d35d56e */ +sa7 = 1.94295690905361884290986932493647741e+07L, /* 0x40172878, 0xc1172d61, 0x3068501e, 0x2f3c71da */ +sa8 = 3.79774781017759149060839255547073541e+07L, /* 0x401821be, 0xc30d06fe, 0x410563d7, 0x032111fd */ +sa9 = 5.00659831846029484248302236457727397e+07L, /* 0x40187df9, 0x1f97a111, 0xc51d6ac2, 0x4b389793 */ +sa10 = 4.36486287620506484276130525941972541e+07L, /* 0x40184d03, 0x3a618ae0, 0x2a723357, 0xfa45c60a */ +sa11 = 2.43779678791333894255510508253951934e+07L, /* 0x401773fa, 0x6fe10ee2, 0xc467850d, 0xc6b7ff30 */ +sa12 = 8.30732360384443202039372372212966542e+06L, /* 0x4015fb09, 0xee6a5631, 0xdd98de7e, 0x8b00461a */ +sa13 = 1.60160846942050515734192397495105693e+06L, /* 0x40138704, 0x8782bf13, 0x5b8fb315, 0xa898abe5 */ +sa14 = 1.54255505242533291014555153757001825e+05L, /* 0x40102d47, 0xc0abc98e, 0x843c9490, 0xb4352440 */ +sa15 = 5.87949220002375547561467275493888824e+03L, /* 0x400b6f77, 0xe00d21d1, 0xec4d41e8, 0x2f8e1673 */ +sa16 = 4.97272976346793193860385983372237710e+01L; /* 0x40048dd1, 0x816c1b3f, 0x24f540a6, 0x4cfe03cc */ +/* + * Domain [2.85715,9], range ~[-7.886e-37,7.918e-37]: + * |log(x*erfc(x)) + x**2 + 0.5625 - rb(x)/sb(x)| < 2**-120 + */ +static const long double +rb0 = -9.86494292470008707171371994479162369e-3L, /* 0xbff84341, 0x239e86f4, 0x2f57e561, 0xf4469360 */ +rb1 = -1.57047326624110727986326503729442830L, /* 0xbfff920a, 0x8935bf73, 0x8803b894, 0x4656482d */ +rb2 = -1.03228196364885474342132255440317065e2L, /* 0xc0059ce9, 0xac4ed0ff, 0x2cff0ff7, 0x5e70d1ab */ +rb3 = -3.74000570653418227179358710865224376e3L, /* 0xc00ad380, 0x2ebf7835, 0xf6b07ed2, 0x861242f7 */ +rb4 = -8.35435477739098044190860390632813956e4L, /* 0xc00f4657, 0x8c3ae934, 0x3647d7b3, 0x80e76fb7 */ +rb5 = -1.21398672055223642118716640216747152e6L, /* 0xc0132862, 0x2b8761c8, 0x27d18c0f, 0x137c9463 */ +rb6 = -1.17669175877248796101665344873273970e7L, /* 0xc0166719, 0x0b2cea46, 0x81f14174, 0x11602ea5 */ +rb7 = -7.66108006086998253606773064264599615e7L, /* 0xc019243f, 0x3c26f4f0, 0x1cc05241, 0x3b953728 */ +rb8 = -3.32547117558141845968704725353130804e8L, /* 0xc01b3d24, 0x42d8ee26, 0x24ef6f3b, 0x604a8c65 */ +rb9 = -9.41561252426350696802167711221739746e8L, /* 0xc01cc0f8, 0xad23692a, 0x8ddb2310, 0xe9937145 */ +rb10 = -1.67157110805390944549427329626281063e9L, /* 0xc01d8e88, 0x9a903734, 0x09a55fa3, 0xd205c903 */ +rb11 = -1.74339631004410841337645931421427373e9L, /* 0xc01d9fa8, 0x77582d2a, 0xc183b8ab, 0x7e00cb05 */ +rb12 = -9.57655233596934915727573141357471703e8L, /* 0xc01cc8a5, 0x460cc685, 0xd0271fa0, 0x6a70e3da */ +rb13 = -2.26320062731339353035254704082495066e8L, /* 0xc01aafab, 0xd7d76721, 0xc9720e11, 0x6a8bd489 */ +rb14 = -1.42777302996263256686002973851837039e7L, /* 0xc016b3b8, 0xc499689f, 0x2b88d965, 0xc32414f9 */ +sb1 = 1.08512869705594540211033733976348506e2L, /* 0x4005b20d, 0x2db7528d, 0x00d20dcb, 0x858f6191 */ +sb2 = 5.02757713761390460534494530537572834e3L, /* 0x400b3a39, 0x3bf4a690, 0x3025d28d, 0xfd40a891 */ +sb3 = 1.31019107205412870059331647078328430e5L, /* 0x400fffcb, 0x1b71d05e, 0x3b28361d, 0x2a3c3690 */ +sb4 = 2.13021555152296846166736757455018030e6L, /* 0x40140409, 0x3c6984df, 0xc4491d7c, 0xb04aa08d */ +sb5 = 2.26649105281820861953868568619768286e7L, /* 0x401759d6, 0xce8736f0, 0xf28ad037, 0x2a901e0c */ +sb6 = 1.61071939490875921812318684143076081e8L, /* 0x401a3338, 0x686fb541, 0x6bd27d06, 0x4f95c9ac */ +sb7 = 7.66895673844301852676056750497991966e8L, /* 0x401c6daf, 0x31cec121, 0x54699126, 0x4bd9bf9e */ +sb8 = 2.41884450436101936436023058196042526e9L, /* 0x401e2059, 0x46b0b8d7, 0x87b64cbf, 0x78bc296d */ +sb9 = 4.92403055884071695093305291535107666e9L, /* 0x401f257e, 0xbe5ed739, 0x39e17346, 0xcadd2e55 */ +sb10 = 6.18627786365587486459633615573786416e9L, /* 0x401f70bb, 0x1be7a7e7, 0x6a45b5ae, 0x607c70f0 */ +sb11 = 4.45898013426501378097430226324743199e9L, /* 0x401f09c6, 0xa32643d7, 0xf1724620, 0x9ea46c32 */ +sb12 = 1.63006115763329848117160344854224975e9L, /* 0x401d84a3, 0x0996887f, 0x65a4f43b, 0x978c1d74 */ +sb13 = 2.39216717012421697446304015847567721e8L, /* 0x401ac845, 0x09a065c2, 0x30095da7, 0x9d72d6ae */ +sb14 = 7.84837329009278694937250358810225609e6L; /* 0x4015df06, 0xd5290e15, 0x63031fac, 0x4d9c894c */ +/* + * Domain [9,108], range ~[-5.324e-38,5.340e-38]: + * |log(x*erfc(x)) + x**2 + 0.5625 - r(x)/s(x)| < 2**-124 + */ +static const long double +rc0 = -9.86494292470008707171367567652935673e-3L, /* 0xbff84341, 0x239e86f4, 0x2f57e55b, 0x1aa10fd3 */ +rc1 = -1.26229447747315096406518846411562266L, /* 0xbfff4325, 0xbb1aab28, 0xda395cd9, 0xfb861c15 */ +rc2 = -6.13742634438922591780742637728666162e1L, /* 0xc004eafe, 0x7dd51cd8, 0x3c7c5928, 0x751e50cf */ +rc3 = -1.50455835478908280402912854338421517e3L, /* 0xc0097823, 0xbc15b9ab, 0x3d60745c, 0x523e80a5 */ +rc4 = -2.04415631865861549920184039902945685e4L, /* 0xc00d3f66, 0x40b3fc04, 0x5388f2ec, 0xb009e1f0 */ +rc5 = -1.57625662981714582753490610560037638e5L, /* 0xc01033dc, 0xd4dc95b6, 0xfd4da93b, 0xf355b4a9 */ +rc6 = -6.73473451616752528402917538033283794e5L, /* 0xc01248d8, 0x2e73a4f9, 0xcded49c5, 0xfa3bfeb7 */ +rc7 = -1.47433165421387483167186683764364857e6L, /* 0xc01367f1, 0xba77a8f7, 0xcfdd0dbb, 0x25d554b3 */ +rc8 = -1.38811981807868828563794929997744139e6L, /* 0xc01352e5, 0x7d16d9ad, 0xbbdcbf38, 0x38fbc5ea */ +rc9 = -3.59659700530831825640766479698155060e5L, /* 0xc0115f3a, 0xecd57f45, 0x21f8ad6c, 0x910a5958 */ +sc1 = 7.72730753022908298637508998072635696e1L, /* 0x40053517, 0xa10d52bc, 0xdabb55b6, 0xbd0328cd */ +sc2 = 2.36825757341694050500333261769082182e3L, /* 0x400a2808, 0x3e0a9b42, 0x82977842, 0x9c5de29e */ +sc3 = 3.72210540173034735352888847134073099e4L, /* 0x400e22ca, 0x1ba827ef, 0xac8390d7, 0x1fc39a41 */ +sc4 = 3.24136032646418336712461033591393412e5L, /* 0x40113c8a, 0x0216e100, 0xc59d1e44, 0xf0e68d9d */ +sc5 = 1.57836135851134393802505823370009175e6L, /* 0x40138157, 0x95bc7664, 0x17575961, 0xdbe58eeb */ +sc6 = 4.12881981392063738026679089714182355e6L, /* 0x4014f801, 0x9e82e8d2, 0xb8b3a70e, 0xfd84185d */ +sc7 = 5.24438427289213488410596395361544142e6L, /* 0x40154017, 0x81177109, 0x2aa6c3b0, 0x1f106625 */ +sc8 = 2.59909544563616121735963429710382149e6L, /* 0x40143d45, 0xbb90a9b1, 0x12bf9390, 0xa827a700 */ +sc9 = 2.80930665169282501639651995082335693e5L; /* 0x40111258, 0xaa92222e, 0xa97e3216, 0xa237fa6c */ + +long double +erfl(long double x) +{ + long double ax,R,S,P,Q,s,y,z,r; + uint64_t lx, llx; + int32_t i; + uint16_t hx; + + EXTRACT_LDBL128_WORDS(hx, lx, llx, x); + + if((hx & 0x7fff) == 0x7fff) { /* erfl(nan)=nan */ + i = (hx>>15)<<1; + return (1-i)+one/x; /* erfl(+-inf)=+-1 */ + } + + ax = fabsl(x); + if(ax < 0.84375) { + if(ax < 0x1p-40L) { + if(ax < 0x1p-16373L) + return (8*x+efx8*x)/8; /* avoid spurious underflow */ + return x + efx*x; + } + z = x*x; + r = pp0+z*(pp1+z*(pp2+z*(pp3+z*(pp4+z*(pp5+z*(pp6+z*(pp7+ + z*(pp8+z*pp9)))))))); + s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*(qq5+z*(qq6+z*(qq7+ + z*(qq8+z*qq9)))))))); + y = r/s; + return x + x*y; + } + if(ax < 1.25) { + s = ax-one; + P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*(pa6+s*(pa7+ + s*(pa8+s*(pa9+s*(pa10+s*pa11)))))))))); + Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*(qa6+s*(qa7+ + s*(qa8+s*(qa9+s*(qa10+s*(qa11+s*qa12))))))))))); + if(x>=0) return (erx + P/Q); else return (-erx - P/Q); + } + if (ax >= 9) { /* inf>|x|>= 9 */ + if(x>=0) return (one-tiny); else return (tiny-one); + } + s = one/(ax*ax); + if(ax < 2.85715) { /* |x| < 2.85715 */ + R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(ra5+s*(ra6+s*(ra7+ + s*(ra8+s*(ra9+s*(ra10+s*(ra11+s*(ra12+s*(ra13+s*(ra14+ + s*(ra15+s*ra16))))))))))))))); + S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(sa5+s*(sa6+s*(sa7+ + s*(sa8+s*(sa9+s*(sa10+s*(sa11+s*(sa12+s*(sa13+s*(sa14+ + s*(sa15+s*sa16))))))))))))))); + } else { /* |x| >= 2.85715 */ + R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(rb5+s*(rb6+s*(rb7+ + s*(rb8+s*(rb9+s*(rb10+s*(rb11+s*(rb12+s*(rb13+ + s*rb14))))))))))))); + S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(sb5+s*(sb6+s*(sb7+ + s*(sb8+s*(sb9+s*(sb10+s*(sb11+s*(sb12+s*(sb13+ + s*sb14))))))))))))); + } + z = (float)ax; + r = expl(-z*z-0.5625)*expl((z-ax)*(z+ax)+R/S); + if(x>=0) return (one-r/ax); else return (r/ax-one); +} + +long double +erfcl(long double x) +{ + long double ax,R,S,P,Q,s,y,z,r; + uint64_t lx, llx; + uint16_t hx; + + EXTRACT_LDBL128_WORDS(hx, lx, llx, x); + + if((hx & 0x7fff) == 0x7fff) { /* erfcl(nan)=nan */ + /* erfcl(+-inf)=0,2 */ + return ((hx>>15)<<1)+one/x; + } + + ax = fabsl(x); + if(ax < 0.84375L) { + if(ax < 0x1p-34L) + return one-x; + z = x*x; + r = pp0+z*(pp1+z*(pp2+z*(pp3+z*(pp4+z*(pp5+z*(pp6+z*(pp7+ + z*(pp8+z*pp9)))))))); + s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*(qq5+z*(qq6+z*(qq7+ + z*(qq8+z*qq9)))))))); + y = r/s; + if(ax < 0.25L) { /* x<1/4 */ + return one-(x+x*y); + } else { + r = x*y; + r += (x-half); + return half - r; + } + } + if(ax < 1.25L) { + s = ax-one; + P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*(pa6+s*(pa7+ + s*(pa8+s*(pa9+s*(pa10+s*pa11)))))))))); + Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*(qa6+s*(qa7+ + s*(qa8+s*(qa9+s*(qa10+s*(qa11+s*qa12))))))))))); + if(x>=0) { + z = one-erx; return z - P/Q; + } else { + z = erx+P/Q; return one+z; + } + } + + if(ax < 108) { /* |x| < 108 */ + s = one/(ax*ax); + if(ax < 2.85715) { /* |x| < 2.85715 */ + R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(ra5+s*(ra6+s*(ra7+ + s*(ra8+s*(ra9+s*(ra10+s*(ra11+s*(ra12+s*(ra13+s*(ra14+ + s*(ra15+s*ra16))))))))))))))); + S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(sa5+s*(sa6+s*(sa7+ + s*(sa8+s*(sa9+s*(sa10+s*(sa11+s*(sa12+s*(sa13+s*(sa14+ + s*(sa15+s*sa16))))))))))))))); + } else if(ax < 9) { + R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(rb5+s*(rb6+s*(rb7+ + s*(rb8+s*(rb9+s*(rb10+s*(rb11+s*(rb12+s*(rb13+ + s*rb14))))))))))))); + S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(sb5+s*(sb6+s*(sb7+ + s*(sb8+s*(sb9+s*(sb10+s*(sb11+s*(sb12+s*(sb13+ + s*sb14))))))))))))); + } else { + if(x < -9) return two-tiny; /* x < -9 */ + R=rc0+s*(rc1+s*(rc2+s*(rc3+s*(rc4+s*(rc5+s*(rc6+s*(rc7+ + s*(rc8+s*rc9)))))))); + S=one+s*(sc1+s*(sc2+s*(sc3+s*(sc4+s*(sc5+s*(sc6+s*(sc7+ + s*(sc8+s*sc9)))))))); + } + z = (float)ax; + r = expl(-z*z-0.5625)*expl((z-ax)*(z+ax)+R/S); + if(x>0) return r/ax; else return two-r/ax; + } else { + if(x>0) return tiny*tiny; else return two-tiny; + } +} diff --git a/lib/msun/ld80/s_erfl.c b/lib/msun/ld80/s_erfl.c new file mode 100644 index 00000000000..1ae2f909270 --- /dev/null +++ b/lib/msun/ld80/s_erfl.c @@ -0,0 +1,337 @@ +/* @(#)s_erf.c 5.1 93/09/24 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * See s_erf.c for complete comments. + * + * Converted to long double by Steven G. Kargl. + */ +#include +#ifdef __i386__ +#include +#endif + +#include "fpmath.h" +#include "math.h" +#include "math_private.h" + +/* XXX Prevent compilers from erroneously constant folding: */ +static const volatile long double tiny = 0x1p-10000L; + +static const double +half= 0.5, +one = 1, +two = 2; +/* + * In the domain [0, 2**-34], only the first term in the power series + * expansion of erf(x) is used. The magnitude of the first neglected + * terms is less than 2**-102. + */ +static const union IEEEl2bits +efxu = LD80C(0x8375d410a6db446c, -3, 1.28379167095512573902e-1L), +efx8u = LD80C(0x8375d410a6db446c, 0, 1.02703333676410059122e+0L), +/* + * Domain [0, 0.84375], range ~[-1.423e-22, 1.423e-22]: + * |(erf(x) - x)/x - pp(x)/qq(x)| < 2**-72.573 + */ +pp0u = LD80C(0x8375d410a6db446c, -3, 1.28379167095512573902e-1L), +pp1u = LD80C(0xa46c7d09ec3d0cec, -2, -3.21140201054840180596e-1L), +pp2u = LD80C(0x9b31e66325576f86, -5, -3.78893851760347812082e-2L), +pp3u = LD80C(0x804ac72c9a0b97dd, -7, -7.83032847030604679616e-3L), +pp4u = LD80C(0x9f42bcbc3d5a601d, -12, -3.03765663857082048459e-4L), +pp5u = LD80C(0x9ec4ad6193470693, -16, -1.89266527398167917502e-5L), +qq1u = LD80C(0xdb4b8eb713188d6b, -2, 4.28310832832310510579e-1L), +qq2u = LD80C(0xa5750835b2459bd1, -4, 8.07896272074540216658e-2L), +qq3u = LD80C(0x8b85d6bd6a90b51c, -7, 8.51579638189385354266e-3L), +qq4u = LD80C(0x87332f82cff4ff96, -11, 5.15746855583604912827e-4L), +qq5u = LD80C(0x83466cb6bf9dca00, -16, 1.56492109706256700009e-5L), +qq6u = LD80C(0xf5bf98c2f996bf63, -24, 1.14435527803073879724e-7L); +#define efx (efxu.e) +#define efx8 (efx8u.e) +#define pp0 (pp0u.e) +#define pp1 (pp1u.e) +#define pp2 (pp2u.e) +#define pp3 (pp3u.e) +#define pp4 (pp4u.e) +#define pp5 (pp5u.e) +#define qq1 (qq1u.e) +#define qq2 (qq2u.e) +#define qq3 (qq3u.e) +#define qq4 (qq4u.e) +#define qq5 (qq5u.e) +#define qq6 (qq6u.e) +static const union IEEEl2bits +erxu = LD80C(0xd7bb3d0000000000, -1, 8.42700779438018798828e-1L), +/* + * Domain [0.84375, 1.25], range ~[-8.132e-22, 8.113e-22]: + * |(erf(x) - erx) - pa(x)/qa(x)| < 2**-71.762 + */ +pa0u = LD80C(0xe8211158da02c692, -27, 1.35116960705131296711e-8L), +pa1u = LD80C(0xd488f89f36988618, -2, 4.15107507167065612570e-1L), +pa2u = LD80C(0xece74f8c63fa3942, -4, -1.15675565215949226989e-1L), +pa3u = LD80C(0xc8d31e020727c006, -4, 9.80589241379624665791e-2L), +pa4u = LD80C(0x985d5d5fafb0551f, -5, 3.71984145558422368847e-2L), +pa5u = LD80C(0xa5b6c4854d2f5452, -8, -5.05718799340957673661e-3L), +pa6u = LD80C(0x85c8d58fe3993a47, -8, 4.08277919612202243721e-3L), +pa7u = LD80C(0xddbfbc23677b35cf, -13, 2.11476292145347530794e-4L), +qa1u = LD80C(0xb8a977896f5eff3f, -1, 7.21335860303380361298e-1L), +qa2u = LD80C(0x9fcd662c3d4eac86, -1, 6.24227891731886593333e-1L), +qa3u = LD80C(0x9d0b618eac67ba07, -2, 3.06727455774491855801e-1L), +qa4u = LD80C(0x881a4293f6d6c92d, -3, 1.32912674218195890535e-1L), +qa5u = LD80C(0xbab144f07dea45bf, -5, 4.55792134233613027584e-2L), +qa6u = LD80C(0xa6c34ba438bdc900, -7, 1.01783980070527682680e-2L), +qa7u = LD80C(0x8fa866dc20717a91, -9, 2.19204436518951438183e-3L); +#define erx (erxu.e) +#define pa0 (pa0u.e) +#define pa1 (pa1u.e) +#define pa2 (pa2u.e) +#define pa3 (pa3u.e) +#define pa4 (pa4u.e) +#define pa5 (pa5u.e) +#define pa6 (pa6u.e) +#define pa7 (pa7u.e) +#define qa1 (qa1u.e) +#define qa2 (qa2u.e) +#define qa3 (qa3u.e) +#define qa4 (qa4u.e) +#define qa5 (qa5u.e) +#define qa6 (qa6u.e) +#define qa7 (qa7u.e) +static const union IEEEl2bits +/* + * Domain [1.25,2.85715], range ~[-2.334e-22,2.334e-22]: + * |log(x*erfc(x)) + x**2 + 0.5625 - ra(x)/sa(x)| < 2**-71.860 + */ +ra0u = LD80C(0xa1a091e0fb4f335a, -7, -9.86494298915814308249e-3L), +ra1u = LD80C(0xc2b0d045ae37df6b, -1, -7.60510460864878271275e-1L), +ra2u = LD80C(0xf2cec3ee7da636c5, 3, -1.51754798236892278250e+1L), +ra3u = LD80C(0x813cc205395adc7d, 7, -1.29237335516455333420e+2L), +ra4u = LD80C(0x8737c8b7b4062c2f, 9, -5.40871625829510494776e+2L), +ra5u = LD80C(0x8ffe5383c08d4943, 10, -1.15194769466026108551e+3L), +ra6u = LD80C(0x983573e64d5015a9, 10, -1.21767039790249025544e+3L), +ra7u = LD80C(0x92a794e763a6d4db, 9, -5.86618463370624636688e+2L), +ra8u = LD80C(0xd5ad1fae77c3d9a3, 6, -1.06838132335777049840e+2L), +ra9u = LD80C(0x934c1a247807bb9c, 2, -4.60303980944467334806e+0L), +sa1u = LD80C(0xd342f90012bb1189, 4, 2.64077014928547064865e+1L), +sa2u = LD80C(0x839be13d9d5da883, 8, 2.63217811300123973067e+2L), +sa3u = LD80C(0x9f8cba6d1ae1b24b, 10, 1.27639775710344617587e+3L), +sa4u = LD80C(0xcaa83f403713e33e, 11, 3.24251544209971162003e+3L), +sa5u = LD80C(0x8796aff2f3c47968, 12, 4.33883591261332837874e+3L), +sa6u = LD80C(0xb6ef97f9c753157b, 11, 2.92697460344182158454e+3L), +sa7u = LD80C(0xe02aee5f83773d1c, 9, 8.96670799139389559818e+2L), +sa8u = LD80C(0xc82b83855b88e07e, 6, 1.00084987800048510018e+2L), +sa9u = LD80C(0x92f030aefadf28ad, 1, 2.29591004455459083843e+0L); +#define ra0 (ra0u.e) +#define ra1 (ra1u.e) +#define ra2 (ra2u.e) +#define ra3 (ra3u.e) +#define ra4 (ra4u.e) +#define ra5 (ra5u.e) +#define ra6 (ra6u.e) +#define ra7 (ra7u.e) +#define ra8 (ra8u.e) +#define ra9 (ra9u.e) +#define sa1 (sa1u.e) +#define sa2 (sa2u.e) +#define sa3 (sa3u.e) +#define sa4 (sa4u.e) +#define sa5 (sa5u.e) +#define sa6 (sa6u.e) +#define sa7 (sa7u.e) +#define sa8 (sa8u.e) +#define sa9 (sa9u.e) +/* + * Domain [2.85715,7], range ~[-8.323e-22,8.390e-22]: + * |log(x*erfc(x)) + x**2 + 0.5625 - rb(x)/sb(x)| < 2**-70.326 + */ +static const union IEEEl2bits +rb0u = LD80C(0xa1a091cf43abcd26, -7, -9.86494292470284646962e-3L), +rb1u = LD80C(0xd19d2df1cbb8da0a, -1, -8.18804618389296662837e-1L), +rb2u = LD80C(0x9a4dd1383e5daf5b, 4, -1.92879967111618594779e+1L), +rb3u = LD80C(0xbff0ae9fc0751de6, 7, -1.91940164551245394969e+2L), +rb4u = LD80C(0xdde08465310b472b, 9, -8.87508080766577324539e+2L), +rb5u = LD80C(0xe796e1d38c8c70a9, 10, -1.85271506669474503781e+3L), +rb6u = LD80C(0xbaf655a76e0ab3b5, 10, -1.49569795581333675349e+3L), +rb7u = LD80C(0x95d21e3e75503c21, 8, -2.99641547972948019157e+2L), +sb1u = LD80C(0x814487ed823c8cbd, 5, 3.23169247732868256569e+1L), +sb2u = LD80C(0xbe4bfbb1301304be, 8, 3.80593618534539961773e+2L), +sb3u = LD80C(0x809c4ade46b927c7, 11, 2.05776827838541292848e+3L), +sb4u = LD80C(0xa55284359f3395a8, 12, 5.29031455540062116327e+3L), +sb5u = LD80C(0xbcfa72da9b820874, 12, 6.04730608102312640462e+3L), +sb6u = LD80C(0x9d09a35988934631, 11, 2.51260238030767176221e+3L), +sb7u = LD80C(0xd675bbe542c159fa, 7, 2.14459898308561015684e+2L); +#define rb0 (rb0u.e) +#define rb1 (rb1u.e) +#define rb2 (rb2u.e) +#define rb3 (rb3u.e) +#define rb4 (rb4u.e) +#define rb5 (rb5u.e) +#define rb6 (rb6u.e) +#define rb7 (rb7u.e) +#define sb1 (sb1u.e) +#define sb2 (sb2u.e) +#define sb3 (sb3u.e) +#define sb4 (sb4u.e) +#define sb5 (sb5u.e) +#define sb6 (sb6u.e) +#define sb7 (sb7u.e) +/* + * Domain [7,108], range ~[-4.422e-22,4.422e-22]: + * |log(x*erfc(x)) + x**2 + 0.5625 - rc(x)/sc(x)| < 2**-70.938 + */ +static const union IEEEl2bits +/* err = -4.422092275318925082e-22 -70.937689 */ +rc0u = LD80C(0xa1a091cf437a17ad, -7, -9.86494292470008707260e-3L), +rc1u = LD80C(0xbe79c5a978122b00, -1, -7.44045595049165939261e-1L), +rc2u = LD80C(0xdb26f9bbe31a2794, 3, -1.36970155085888424425e+1L), +rc3u = LD80C(0xb5f69a38f5747ac8, 6, -9.09816453742625888546e+1L), +rc4u = LD80C(0xd79676d970d0a21a, 7, -2.15587750997584074147e+2L), +rc5u = LD80C(0xfe528153c45ec97c, 6, -1.27161142938347796666e+2L), +sc1u = LD80C(0xc5e8cd46d5604a96, 4, 2.47386727842204312937e+1L), +sc2u = LD80C(0xc5f0f5a5484520eb, 7, 1.97941248254913378865e+2L), +sc3u = LD80C(0x964e3c7b34db9170, 9, 6.01222441484087787522e+2L), +sc4u = LD80C(0x99be1b89faa0596a, 9, 6.14970430845978077827e+2L), +sc5u = LD80C(0xf80dfcbf37ffc5ea, 6, 1.24027318931184605891e+2L); +#define rc0 (rc0u.e) +#define rc1 (rc1u.e) +#define rc2 (rc2u.e) +#define rc3 (rc3u.e) +#define rc4 (rc4u.e) +#define rc5 (rc5u.e) +#define sc1 (sc1u.e) +#define sc2 (sc2u.e) +#define sc3 (sc3u.e) +#define sc4 (sc4u.e) +#define sc5 (sc5u.e) + +long double +erfl(long double x) +{ + long double ax,R,S,P,Q,s,y,z,r; + uint64_t lx; + int32_t i; + uint16_t hx; + + EXTRACT_LDBL80_WORDS(hx, lx, x); + + if((hx & 0x7fff) == 0x7fff) { /* erfl(nan)=nan */ + i = (hx>>15)<<1; + return (1-i)+one/x; /* erfl(+-inf)=+-1 */ + } + + ENTERI(); + + ax = fabsl(x); + if(ax < 0.84375) { + if(ax < 0x1p-34L) { + if(ax < 0x1p-16373L) + RETURNI((8*x+efx8*x)/8); /* avoid spurious underflow */ + RETURNI(x + efx*x); + } + z = x*x; + r = pp0+z*(pp1+z*(pp2+z*(pp3+z*(pp4+z*pp5)))); + s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*(qq5+z*qq6))))); + y = r/s; + RETURNI(x + x*y); + } + if(ax < 1.25) { + s = ax-one; + P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*(pa6+s*pa7)))))); + Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*(qa6+s*qa7)))))); + if(x>=0) RETURNI(erx + P/Q); else RETURNI(-erx - P/Q); + } + if(ax >= 7) { /* inf>|x|>= 7 */ + if(x>=0) RETURNI(one-tiny); else RETURNI(tiny-one); + } + s = one/(ax*ax); + if(ax < 2.85715) { /* |x| < 2.85715 */ + R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(ra5+s*(ra6+s*(ra7+ + s*(ra8+s*ra9)))))))); + S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(sa5+s*(sa6+s*(sa7+ + s*(sa8+s*sa9)))))))); + } else { /* |x| >= 2.85715 */ + R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(rb5+s*(rb6+s*rb7)))))); + S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(sb5+s*(sb6+s*sb7)))))); + } + z=(float)ax; + r=expl(-z*z-0.5625)*expl((z-ax)*(z+ax)+R/S); + if(x>=0) RETURNI(one-r/ax); else RETURNI(r/ax-one); +} + +long double +erfcl(long double x) +{ + long double ax,R,S,P,Q,s,y,z,r; + uint64_t lx; + uint16_t hx; + + EXTRACT_LDBL80_WORDS(hx, lx, x); + + if((hx & 0x7fff) == 0x7fff) { /* erfcl(nan)=nan */ + /* erfcl(+-inf)=0,2 */ + return ((hx>>15)<<1)+one/x; + } + + ENTERI(); + + ax = fabsl(x); + if(ax < 0.84375L) { + if(ax < 0x1p-34L) + RETURNI(one-x); + z = x*x; + r = pp0+z*(pp1+z*(pp2+z*(pp3+z*(pp4+z*pp5)))); + s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*(qq5+z*qq6))))); + y = r/s; + if(ax < 0.25L) { /* x<1/4 */ + RETURNI(one-(x+x*y)); + } else { + r = x*y; + r += (x-half); + RETURNI(half - r); + } + } + if(ax < 1.25L) { + s = ax-one; + P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*(pa6+s*pa7)))))); + Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*(qa6+s*qa7)))))); + if(x>=0) { + z = one-erx; RETURNI(z - P/Q); + } else { + z = (erx+P/Q); RETURNI(one+z); + } + } + + if(ax < 108) { /* |x| < 108 */ + s = one/(ax*ax); + if(ax < 2.85715) { /* |x| < 2.85715 */ + R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(ra5+s*(ra6+s*(ra7+ + s*(ra8+s*ra9)))))))); + S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(sa5+s*(sa6+s*(sa7+ + s*(sa8+s*sa9)))))))); + } else if(ax < 7) { /* | |x| < 7 */ + R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(rb5+s*(rb6+s*rb7)))))); + S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(sb5+s*(sb6+s*sb7)))))); + } else { + if(x < -7) RETURNI(two-tiny);/* x < -7 */ + R=rc0+s*(rc1+s*(rc2+s*(rc3+s*(rc4+s*rc5)))); + S=one+s*(sc1+s*(sc2+s*(sc3+s*(sc4+s*sc5)))); + } + z = (float)ax; + r = expl(-z*z-0.5625)*expl((z-ax)*(z+ax)+R/S); + if(x>0) RETURNI(r/ax); else RETURNI(two-r/ax); + } else { + if(x>0) RETURNI(tiny*tiny); else RETURNI(two-tiny); + } +} diff --git a/lib/msun/man/erf.3 b/lib/msun/man/erf.3 index 46886b0506a..a9a3e0a84ab 100644 --- a/lib/msun/man/erf.3 +++ b/lib/msun/man/erf.3 @@ -28,14 +28,16 @@ .\" from: @(#)erf.3 6.4 (Berkeley) 4/20/91 .\" $FreeBSD$ .\" -.Dd April 20, 1991 +.Dd July 13, 2014 .Dt ERF 3 .Os .Sh NAME .Nm erf , .Nm erff , +.Nm erfl , .Nm erfc , -.Nm erfcf +.Nm erfcf , +.Nm erfcl .Nd error function operators .Sh LIBRARY .Lb libm @@ -45,18 +47,23 @@ .Fn erf "double x" .Ft float .Fn erff "float x" +.Ft "long double" +.Fn erfl "long double x" .Ft double .Fn erfc "double x" .Ft float .Fn erfcf "float x" +.Ft "long double" +.Fn erfcl "long double x" .Sh DESCRIPTION These functions calculate the error function of .Fa x . .Pp The -.Fn erf -and the -.Fn erff +.Fn erf , +.Fn erff , +and +.Fn erfl functions calculate the error function of x; where .Bd -ragged -offset indent .if n \{\ @@ -69,9 +76,10 @@ erf\|(x) := .Ed .Pp The -.Fn erfc -and the -.Fn erfcf +.Fn erfc , +.Fn erfcf , +and +.Fn erfcl functions calculate the complementary error function of .Fa x ; that is @@ -79,9 +87,6 @@ that is subtracts the result of the error function .Fn erf x from 1.0. -This is useful, since for large -.Fa x -places disappear. .Sh SEE ALSO .Xr math 3 .Sh HISTORY diff --git a/lib/msun/sparc64/fenv.h b/lib/msun/sparc64/fenv.h index d17361fef45..0faf08d450b 100644 --- a/lib/msun/sparc64/fenv.h +++ b/lib/msun/sparc64/fenv.h @@ -108,9 +108,9 @@ fesetexceptflag(const fexcept_t *__flagp, int __excepts) } /* - * In contrast with the ia64 platform, it seems to be worthwhile to - * inline this function on sparc64 even when the arguments are not - * compile-time constants. Perhaps this depends on the register window. + * It seems to be worthwhile to inline this function even when the + * arguments are not compile-time constants. Perhaps this depends + * on the register window. */ __fenv_static inline int feraiseexcept(int __excepts) diff --git a/lib/msun/src/e_pow.c b/lib/msun/src/e_pow.c index 7607a4a7265..d54af9d6806 100644 --- a/lib/msun/src/e_pow.c +++ b/lib/msun/src/e_pow.c @@ -19,20 +19,20 @@ __FBSDID("$FreeBSD$"); * 1. Compute and return log2(x) in two pieces: * log2(x) = w1 + w2, * where w1 has 53-24 = 29 bit trailing zeros. - * 2. Perform y*log2(x) = n+y' by simulating muti-precision + * 2. Perform y*log2(x) = n+y' by simulating multi-precision * arithmetic, where |y'|<=0.5. * 3. Return x**y = 2**n*exp(y'*log2) * * Special cases: * 1. (anything) ** 0 is 1 * 2. (anything) ** 1 is itself - * 3. (anything) ** NAN is NAN + * 3. (anything) ** NAN is NAN except 1 ** NAN = 1 * 4. NAN ** (anything except 0) is NAN * 5. +-(|x| > 1) ** +INF is +INF * 6. +-(|x| > 1) ** -INF is +0 * 7. +-(|x| < 1) ** +INF is +0 * 8. +-(|x| < 1) ** -INF is +INF - * 9. +-1 ** +-INF is NAN + * 9. +-1 ** +-INF is 1 * 10. +0 ** (+anything except 0, NAN) is +0 * 11. -0 ** (+anything except 0, NAN, odd integer) is +0 * 12. +0 ** (-anything except 0, NAN) is +INF @@ -141,7 +141,7 @@ __ieee754_pow(double x, double y) if(ly==0) { if (iy==0x7ff00000) { /* y is +-inf */ if(((ix-0x3ff00000)|lx)==0) - return one; /* (-1)**+-inf is NaN */ + return one; /* (-1)**+-inf is 1 */ else if (ix >= 0x3ff00000)/* (|x|>1)**+-inf = inf,0 */ return (hy>=0)? y: zero; else /* (|x|<1)**-,+inf = inf,0 */ diff --git a/lib/msun/src/imprecise.c b/lib/msun/src/imprecise.c index 5bd3d642955..92fb2d06e98 100644 --- a/lib/msun/src/imprecise.c +++ b/lib/msun/src/imprecise.c @@ -60,7 +60,5 @@ DECLARE_WEAK(powl); long double imprecise_ ## f ## l(long double v) { return f(v); }\ DECLARE_WEAK(f ## l) -DECLARE_IMPRECISE(erfc); -DECLARE_IMPRECISE(erf); DECLARE_IMPRECISE(lgamma); DECLARE_IMPRECISE(tgamma); diff --git a/lib/msun/src/math.h b/lib/msun/src/math.h index fc4becc9840..32d01da4878 100644 --- a/lib/msun/src/math.h +++ b/lib/msun/src/math.h @@ -69,10 +69,6 @@ extern const union __nan_un { #define math_errhandling MATH_ERREXCEPT #define FP_FAST_FMAF 1 -#ifdef __ia64__ -#define FP_FAST_FMA 1 -#define FP_FAST_FMAL 1 -#endif /* Symbolic constants to classify floating point numbers. */ #define FP_INFINITE 0x01 @@ -453,6 +449,8 @@ long double ceill(long double); long double copysignl(long double, long double) __pure2; long double coshl(long double); long double cosl(long double); +long double erfcl(long double); +long double erfl(long double); long double exp2l(long double); long double expl(long double); long double expm1l(long double); @@ -513,8 +511,6 @@ __END_DECLS */ __BEGIN_DECLS -long double erfcl(long double); -long double erfl(long double); long double lgammal(long double); long double powl(long double, long double); long double tgammal(long double); diff --git a/lib/msun/src/s_erf.c b/lib/msun/src/s_erf.c index 854767bc913..e1d63bca819 100644 --- a/lib/msun/src/s_erf.c +++ b/lib/msun/src/s_erf.c @@ -111,18 +111,25 @@ __FBSDID("$FreeBSD$"); #include "math.h" #include "math_private.h" +/* XXX Prevent compilers from erroneously constant folding: */ +static const volatile double tiny= 1e-300; + static const double -tiny = 1e-300, -half= 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ -one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ -two = 2.00000000000000000000e+00, /* 0x40000000, 0x00000000 */ - /* c = (float)0.84506291151 */ +half= 0.5, +one = 1, +two = 2, +/* c = (float)0.84506291151 */ erx = 8.45062911510467529297e-01, /* 0x3FEB0AC1, 0x60000000 */ /* - * Coefficients for approximation to erf on [0,0.84375] + * In the domain [0, 2**-28], only the first term in the power series + * expansion of erf(x) is used. The magnitude of the first neglected + * terms is less than 2**-84. */ efx = 1.28379167095512586316e-01, /* 0x3FC06EBA, 0x8214DB69 */ efx8= 1.02703333676410069053e+00, /* 0x3FF06EBA, 0x8214DB69 */ +/* + * Coefficients for approximation to erf on [0,0.84375] + */ pp0 = 1.28379167095512558561e-01, /* 0x3FC06EBA, 0x8214DB68 */ pp1 = -3.25042107247001499370e-01, /* 0xBFD4CD7D, 0x691CB913 */ pp2 = -2.84817495755985104766e-02, /* 0xBF9D2A51, 0xDBD7194F */ @@ -134,7 +141,7 @@ qq3 = 5.08130628187576562776e-03, /* 0x3F74D022, 0xC4D36B0F */ qq4 = 1.32494738004321644526e-04, /* 0x3F215DC9, 0x221C1A10 */ qq5 = -3.96022827877536812320e-06, /* 0xBED09C43, 0x42A26120 */ /* - * Coefficients for approximation to erf in [0.84375,1.25] + * Coefficients for approximation to erf in [0.84375,1.25] */ pa0 = -2.36211856075265944077e-03, /* 0xBF6359B8, 0xBEF77538 */ pa1 = 4.14856118683748331666e-01, /* 0x3FDA8D00, 0xAD92B34D */ @@ -150,7 +157,7 @@ qa4 = 1.26171219808761642112e-01, /* 0x3FC02660, 0xE763351F */ qa5 = 1.36370839120290507362e-02, /* 0x3F8BEDC2, 0x6B51DD1C */ qa6 = 1.19844998467991074170e-02, /* 0x3F888B54, 0x5735151D */ /* - * Coefficients for approximation to erfc in [1.25,1/0.35] + * Coefficients for approximation to erfc in [1.25,1/0.35] */ ra0 = -9.86494403484714822705e-03, /* 0xBF843412, 0x600D6435 */ ra1 = -6.93858572707181764372e-01, /* 0xBFE63416, 0xE4BA7360 */ @@ -169,7 +176,7 @@ sa6 = 1.08635005541779435134e+02, /* 0x405B28A3, 0xEE48AE2C */ sa7 = 6.57024977031928170135e+00, /* 0x401A47EF, 0x8E484A93 */ sa8 = -6.04244152148580987438e-02, /* 0xBFAEEFF2, 0xEE749A62 */ /* - * Coefficients for approximation to erfc in [1/.35,28] + * Coefficients for approximation to erfc in [1/.35,28] */ rb0 = -9.86494292470009928597e-03, /* 0xBF843412, 0x39E86F4A */ rb1 = -7.99283237680523006574e-01, /* 0xBFE993BA, 0x70C285DE */ @@ -222,15 +229,12 @@ erf(double x) x = fabs(x); s = one/(x*x); if(ix< 0x4006DB6E) { /* |x| < 1/0.35 */ - R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( - ra5+s*(ra6+s*ra7)))))); - S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( - sa5+s*(sa6+s*(sa7+s*sa8))))))); + R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(ra5+s*(ra6+s*ra7)))))); + S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(sa5+s*(sa6+s*(sa7+ + s*sa8))))))); } else { /* |x| >= 1/0.35 */ - R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( - rb5+s*rb6))))); - S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( - sb5+s*(sb6+s*sb7)))))); + R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(rb5+s*rb6))))); + S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(sb5+s*(sb6+s*sb7)))))); } z = x; SET_LOW_WORD(z,0); @@ -238,6 +242,10 @@ erf(double x) if(hx>=0) return one-r/x; else return r/x-one; } +#if (LDBL_MANT_DIG == 53) +__weak_reference(erf, erfl); +#endif + double erfc(double x) { @@ -279,23 +287,23 @@ erfc(double x) x = fabs(x); s = one/(x*x); if(ix< 0x4006DB6D) { /* |x| < 1/.35 ~ 2.857143*/ - R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( - ra5+s*(ra6+s*ra7)))))); - S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( - sa5+s*(sa6+s*(sa7+s*sa8))))))); + R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(ra5+s*(ra6+s*ra7)))))); + S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(sa5+s*(sa6+s*(sa7+ + s*sa8))))))); } else { /* |x| >= 1/.35 ~ 2.857143 */ if(hx<0&&ix>=0x40180000) return two-tiny;/* x < -6 */ - R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( - rb5+s*rb6))))); - S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( - sb5+s*(sb6+s*sb7)))))); + R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(rb5+s*rb6))))); + S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(sb5+s*(sb6+s*sb7)))))); } z = x; SET_LOW_WORD(z,0); - r = __ieee754_exp(-z*z-0.5625)* - __ieee754_exp((z-x)*(z+x)+R/S); + r = __ieee754_exp(-z*z-0.5625)*__ieee754_exp((z-x)*(z+x)+R/S); if(hx>0) return r/x; else return two-r/x; } else { if(hx>0) return tiny*tiny; else return two-tiny; } } + +#if (LDBL_MANT_DIG == 53) +__weak_reference(erfc, erfcl); +#endif diff --git a/lib/msun/src/s_erff.c b/lib/msun/src/s_erff.c index b97ca1d1235..d6cfbd22767 100644 --- a/lib/msun/src/s_erff.c +++ b/lib/msun/src/s_erff.c @@ -19,64 +19,63 @@ __FBSDID("$FreeBSD$"); #include "math.h" #include "math_private.h" +/* XXX Prevent compilers from erroneously constant folding: */ +static const volatile float tiny = 1e-30; + static const float -tiny = 1e-30, -half= 5.0000000000e-01, /* 0x3F000000 */ -one = 1.0000000000e+00, /* 0x3F800000 */ -two = 2.0000000000e+00, /* 0x40000000 */ +half= 0.5, +one = 1, +two = 2, +erx = 8.42697144e-01, /* 0x3f57bb00 */ /* - * Coefficients for approximation to erf on [0,0.84375] + * In the domain [0, 2**-14], only the first term in the power series + * expansion of erf(x) is used. The magnitude of the first neglected + * terms is less than 2**-42. */ -efx = 1.2837916613e-01, /* 0x3e0375d4 */ -efx8= 1.0270333290e+00, /* 0x3f8375d4 */ +efx = 1.28379166e-01, /* 0x3e0375d4 */ +efx8= 1.02703333e+00, /* 0x3f8375d4 */ /* - * Domain [0, 0.84375], range ~[-5.4446e-10,5.5197e-10]: - * |(erf(x) - x)/x - p(x)/q(x)| < 2**-31. + * Domain [0, 0.84375], range ~[-5.4419e-10, 5.5179e-10]: + * |(erf(x) - x)/x - pp(x)/qq(x)| < 2**-31 */ -pp0 = 1.28379166e-01F, /* 0x1.06eba8p-3 */ -pp1 = -3.36030394e-01F, /* -0x1.58185ap-2 */ -pp2 = -1.86260219e-03F, /* -0x1.e8451ep-10 */ -qq1 = 3.12324286e-01F, /* 0x1.3fd1f0p-2 */ -qq2 = 2.16070302e-02F, /* 0x1.620274p-6 */ -qq3 = -1.98859419e-03F, /* -0x1.04a626p-9 */ +pp0 = 1.28379166e-01, /* 0x3e0375d4 */ +pp1 = -3.36030394e-01, /* 0xbeac0c2d */ +pp2 = -1.86261395e-03, /* 0xbaf422f4 */ +qq1 = 3.12324315e-01, /* 0x3e9fe8f9 */ +qq2 = 2.16070414e-02, /* 0x3cb10140 */ +qq3 = -1.98859372e-03, /* 0xbb025311 */ /* - * Domain [0.84375, 1.25], range ~[-1.953e-11,1.940e-11]: - * |(erf(x) - erx) - p(x)/q(x)| < 2**-36. + * Domain [0.84375, 1.25], range ~[-1.023e-9, 1.023e-9]: + * |(erf(x) - erx) - pa(x)/qa(x)| < 2**-31 */ -erx = 8.42697144e-01F, /* 0x1.af7600p-1. erf(1) rounded to 16 bits. */ -pa0 = 3.64939137e-06F, /* 0x1.e9d022p-19 */ -pa1 = 4.15109694e-01F, /* 0x1.a91284p-2 */ -pa2 = -1.65179938e-01F, /* -0x1.5249dcp-3 */ -pa3 = 1.10914491e-01F, /* 0x1.c64e46p-4 */ -qa1 = 6.02074385e-01F, /* 0x1.344318p-1 */ -qa2 = 5.35934687e-01F, /* 0x1.126608p-1 */ -qa3 = 1.68576106e-01F, /* 0x1.593e6ep-3 */ -qa4 = 5.62181212e-02F, /* 0x1.cc89f2p-5 */ +pa0 = 3.65041046e-06, /* 0x3674f993 */ +pa1 = 4.15109307e-01, /* 0x3ed48935 */ +pa2 = -2.09395722e-01, /* 0xbe566bd5 */ +pa3 = 8.67677554e-02, /* 0x3db1b34b */ +qa1 = 4.95560974e-01, /* 0x3efdba2b */ +qa2 = 3.71248513e-01, /* 0x3ebe1449 */ +qa3 = 3.92478965e-02, /* 0x3d20c267 */ /* - * Domain [1.25,1/0.35], range ~[-7.043e-10,7.457e-10]: - * |log(x*erfc(x)) + x**2 + 0.5625 - r(x)/s(x)| < 2**-30 + * Domain [1.25,1/0.35], range ~[-4.821e-9, 4.927e-9]: + * |log(x*erfc(x)) + x**2 + 0.5625 - ra(x)/sa(x)| < 2**-28 */ -ra0 = -9.87132732e-03F, /* -0x1.4376b2p-7 */ -ra1 = -5.53605914e-01F, /* -0x1.1b723cp-1 */ -ra2 = -2.17589188e+00F, /* -0x1.1683a0p+1 */ -ra3 = -1.43268085e+00F, /* -0x1.6ec42cp+0 */ -sa1 = 5.45995426e+00F, /* 0x1.5d6fe4p+2 */ -sa2 = 6.69798088e+00F, /* 0x1.acabb8p+2 */ -sa3 = 1.43113089e+00F, /* 0x1.6e5e98p+0 */ -sa4 = -5.77397496e-02F, /* -0x1.d90108p-5 */ +ra0 = -9.88156721e-03, /* 0xbc21e64c */ +ra1 = -5.43658376e-01, /* 0xbf0b2d32 */ +ra2 = -1.66828310e+00, /* 0xbfd58a4d */ +ra3 = -6.91554189e-01, /* 0xbf3109b2 */ +sa1 = 4.48581553e+00, /* 0x408f8bcd */ +sa2 = 4.10799170e+00, /* 0x408374ab */ +sa3 = 5.53855181e-01, /* 0x3f0dc974 */ /* - * Domain [1/0.35, 11], range ~[-2.264e-13,2.336e-13]: - * |log(x*erfc(x)) + x**2 + 0.5625 - r(x)/s(x)| < 2**-42 + * Domain [2.85715, 11], range ~[-1.484e-9, 1.505e-9]: + * |log(x*erfc(x)) + x**2 + 0.5625 - rb(x)/sb(x)| < 2**-30 */ -rb0 = -9.86494310e-03F, /* -0x1.434124p-7 */ -rb1 = -6.25171244e-01F, /* -0x1.401672p-1 */ -rb2 = -6.16498327e+00F, /* -0x1.8a8f16p+2 */ -rb3 = -1.66696873e+01F, /* -0x1.0ab70ap+4 */ -rb4 = -9.53764343e+00F, /* -0x1.313460p+3 */ -sb1 = 1.26884899e+01F, /* 0x1.96081cp+3 */ -sb2 = 4.51839523e+01F, /* 0x1.6978bcp+5 */ -sb3 = 4.72810211e+01F, /* 0x1.7a3f88p+5 */ -sb4 = 8.93033314e+00F; /* 0x1.1dc54ap+3 */ +rb0 = -9.86496918e-03, /* 0xbc21a0ae */ +rb1 = -5.48049808e-01, /* 0xbf0c4cfe */ +rb2 = -1.84115684e+00, /* 0xbfebab07 */ +sb1 = 4.87132740e+00, /* 0x409be1ea */ +sb2 = 3.04982710e+00, /* 0x4043305e */ +sb3 = -7.61900663e-01; /* 0xbf430bec */ float erff(float x) @@ -85,9 +84,9 @@ erff(float x) float R,S,P,Q,s,y,z,r; GET_FLOAT_WORD(hx,x); ix = hx&0x7fffffff; - if(ix>=0x7f800000) { /* erf(nan)=nan */ + if(ix>=0x7f800000) { /* erff(nan)=nan */ i = ((u_int32_t)hx>>31)<<1; - return (float)(1-i)+one/x; /* erf(+-inf)=+-1 */ + return (float)(1-i)+one/x; /* erff(+-inf)=+-1 */ } if(ix < 0x3f580000) { /* |x|<0.84375 */ @@ -105,7 +104,7 @@ erff(float x) if(ix < 0x3fa00000) { /* 0.84375 <= |x| < 1.25 */ s = fabsf(x)-one; P = pa0+s*(pa1+s*(pa2+s*pa3)); - Q = one+s*(qa1+s*(qa2+s*(qa3+s*qa4))); + Q = one+s*(qa1+s*(qa2+s*qa3)); if(hx>=0) return erx + P/Q; else return -erx - P/Q; } if (ix >= 0x40800000) { /* inf>|x|>=4 */ @@ -113,12 +112,12 @@ erff(float x) } x = fabsf(x); s = one/(x*x); - if(ix< 0x4036DB6E) { /* |x| < 1/0.35 */ + if(ix< 0x4036db8c) { /* |x| < 2.85715 ~ 1/0.35 */ R=ra0+s*(ra1+s*(ra2+s*ra3)); - S=one+s*(sa1+s*(sa2+s*(sa3+s*sa4))); - } else { /* |x| >= 1/0.35 */ - R=rb0+s*(rb1+s*(rb2+s*(rb3+s*rb4))); - S=one+s*(sb1+s*(sb2+s*(sb3+s*sb4))); + S=one+s*(sa1+s*(sa2+s*sa3)); + } else { /* |x| >= 2.85715 ~ 1/0.35 */ + R=rb0+s*(rb1+s*rb2); + S=one+s*(sb1+s*(sb2+s*sb3)); } SET_FLOAT_WORD(z,hx&0xffffe000); r = expf(-z*z-0.5625F)*expf((z-x)*(z+x)+R/S); @@ -132,8 +131,8 @@ erfcf(float x) float R,S,P,Q,s,y,z,r; GET_FLOAT_WORD(hx,x); ix = hx&0x7fffffff; - if(ix>=0x7f800000) { /* erfc(nan)=nan */ - /* erfc(+-inf)=0,2 */ + if(ix>=0x7f800000) { /* erfcf(nan)=nan */ + /* erfcf(+-inf)=0,2 */ return (float)(((u_int32_t)hx>>31)<<1)+one/x; } @@ -155,7 +154,7 @@ erfcf(float x) if(ix < 0x3fa00000) { /* 0.84375 <= |x| < 1.25 */ s = fabsf(x)-one; P = pa0+s*(pa1+s*(pa2+s*pa3)); - Q = one+s*(qa1+s*(qa2+s*(qa3+s*qa4))); + Q = one+s*(qa1+s*(qa2+s*qa3)); if(hx>=0) { z = one-erx; return z - P/Q; } else { @@ -165,13 +164,13 @@ erfcf(float x) if (ix < 0x41300000) { /* |x|<11 */ x = fabsf(x); s = one/(x*x); - if(ix< 0x4036DB6D) { /* |x| < 1/.35 ~ 2.857143*/ - R=ra0+s*(ra1+s*(ra2+s*ra3)); - S=one+s*(sa1+s*(sa2+s*(sa3+s*sa4))); - } else { /* |x| >= 1/.35 ~ 2.857143 */ + if(ix< 0x4036db8c) { /* |x| < 2.85715 ~ 1/.35 */ + R=ra0+s*(ra1+s*(ra2+s*ra3)); + S=one+s*(sa1+s*(sa2+s*sa3)); + } else { /* |x| >= 2.85715 ~ 1/.35 */ if(hx<0&&ix>=0x40a00000) return two-tiny;/* x < -5 */ - R=rb0+s*(rb1+s*(rb2+s*(rb3+s*rb4))); - S=one+s*(sb1+s*(sb2+s*(sb3+s*sb4))); + R=rb0+s*(rb1+s*rb2); + S=one+s*(sb1+s*(sb2+s*sb3)); } SET_FLOAT_WORD(z,hx&0xffffe000); r = expf(-z*z-0.5625F)*expf((z-x)*(z+x)+R/S); diff --git a/lib/ncurses/Makefile b/lib/ncurses/Makefile index 822905f44dc..05cd7a29bb2 100644 --- a/lib/ncurses/Makefile +++ b/lib/ncurses/Makefile @@ -1,11 +1,6 @@ # $FreeBSD$ -.include - -SUBDIR= ncurses form menu panel - -.if ${MK_NCURSESW} != "no" -SUBDIR+= ncursesw formw menuw panelw -.endif +SUBDIR= ncurses form menu panel \ + ncursesw formw menuw panelw .include diff --git a/lib/ncurses/form/Makefile.depend b/lib/ncurses/form/Makefile.depend index c3295ff8e98..bca73681e3e 100644 --- a/lib/ncurses/form/Makefile.depend +++ b/lib/ncurses/form/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/ncurses/formw/Makefile.depend b/lib/ncurses/formw/Makefile.depend index d56ffbbe742..63cf5597f68 100644 --- a/lib/ncurses/formw/Makefile.depend +++ b/lib/ncurses/formw/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/ncurses/menu/Makefile.depend b/lib/ncurses/menu/Makefile.depend index 5c8368f7d87..01b1fd029b0 100644 --- a/lib/ncurses/menu/Makefile.depend +++ b/lib/ncurses/menu/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/ncurses/menuw/Makefile.depend b/lib/ncurses/menuw/Makefile.depend index 49f188286e3..1033d6e31f4 100644 --- a/lib/ncurses/menuw/Makefile.depend +++ b/lib/ncurses/menuw/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/ncurses/ncurses/Makefile b/lib/ncurses/ncurses/Makefile index 3821d4635b8..31c68cdb782 100644 --- a/lib/ncurses/ncurses/Makefile +++ b/lib/ncurses/ncurses/Makefile @@ -55,7 +55,7 @@ HAVE_TERMIOS_H= 1 HAVE_TERMIO_H= 0 HAVE_VSSCANF= 1 HEADER_STDBOOL= 1 -# XXX amd64, ia64 1L and int +# XXX amd64 1L and int ONEUL= 1UL TYPEOF_CHTYPE= long TYPEOF_MMASK_T= long diff --git a/lib/ncurses/ncurses/Makefile.depend b/lib/ncurses/ncurses/Makefile.depend index 871dd718ac1..919abe588b1 100644 --- a/lib/ncurses/ncurses/Makefile.depend +++ b/lib/ncurses/ncurses/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/ncurses/ncursesw/Makefile.depend b/lib/ncurses/ncursesw/Makefile.depend index 445c456bc4f..8990db97ebf 100644 --- a/lib/ncurses/ncursesw/Makefile.depend +++ b/lib/ncurses/ncursesw/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/ncurses/panel/Makefile.depend b/lib/ncurses/panel/Makefile.depend index 2359930f70f..4e0baeb686c 100644 --- a/lib/ncurses/panel/Makefile.depend +++ b/lib/ncurses/panel/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/ncurses/panelw/Makefile.depend b/lib/ncurses/panelw/Makefile.depend index 2ec647289e6..fa115192faf 100644 --- a/lib/ncurses/panelw/Makefile.depend +++ b/lib/ncurses/panelw/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/libexec/atf/Makefile b/libexec/atf/Makefile index 6749db5fce9..db7554d9dda 100644 --- a/libexec/atf/Makefile +++ b/libexec/atf/Makefile @@ -25,6 +25,6 @@ # # $FreeBSD$ -SUBDIR= atf-check tests +SUBDIR= atf-check atf-sh tests .include diff --git a/libexec/atf/Makefile.inc b/libexec/atf/Makefile.inc index 392bbb23b23..2521be6af73 100644 --- a/libexec/atf/Makefile.inc +++ b/libexec/atf/Makefile.inc @@ -28,3 +28,5 @@ CFLAGS+= -DHAVE_CONFIG_H WARNS?= 3 + +.include "../Makefile.inc" diff --git a/libexec/atf/atf-check/Makefile b/libexec/atf/atf-check/Makefile index 093de06ed53..fa7fabe8ddc 100644 --- a/libexec/atf/atf-check/Makefile +++ b/libexec/atf/atf-check/Makefile @@ -31,18 +31,17 @@ ATF= ${.CURDIR:H:H:H}/contrib/atf .PATH: ${ATF}/atf-sh -BINDIR= /usr/libexec PROG_CXX= atf-check SRCS= atf-check.cpp MAN= atf-check.1 CFLAGS+= -I${ATF} -DPADD+= ${LIBATF_CXX} ${LIBATF_C} - LDFLAGS+= -L${.OBJDIR}/../../../lib/atf/libatf-c++ LDFLAGS+= -L${.OBJDIR}/../../../lib/atf/libatf-c +DPADD+= ${LIBATF_CXX} ${LIBATF_C} LDADD+= -latf-c++ -latf-c +USEPRIVATELIB= atf-c++ atf-c .if ${MK_TESTS} != "no" SUBDIR+= tests diff --git a/share/mk/bsd.dtrace.mk b/libexec/atf/atf-sh/Makefile similarity index 53% rename from share/mk/bsd.dtrace.mk rename to libexec/atf/atf-sh/Makefile index 518de30ff33..3f461fdbe9a 100644 --- a/share/mk/bsd.dtrace.mk +++ b/libexec/atf/atf-sh/Makefile @@ -1,60 +1,55 @@ +#- +# Copyright (c) 2011 Google, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE 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$ -# -# Copyright (c) 2010 The FreeBSD Foundation -# All rights reserved. -# -# This software was developed by Rui Paulo 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. -# -# -# The only variable that you should define on your Makefile is 'DTRACEOBJS'. -# You must include this file before bsd.lib.mk or bsd.prog.mk. -# -.if defined(WITH_DTRACE) +.include +.include -CFLAGS+=-DWITH_DTRACE -DTRACEHEADERS=${DTRACEOBJS:S/o$/h/} -DTRACESRCS=${DTRACEOBJS:S/o$/d/} -CLEANFILES+=${DTRACEOBJS} ${DTRACEHEADERS} +ATF= ${.CURDIR:H:H:H}/contrib/atf +.PATH: ${ATF}/atf-sh -DPADD+=${LIBELF} -LDADD+=-lelf +PROG_CXX= atf-sh +SRCS= atf-sh.cpp +MAN= atf-sh.1 atf-sh-api.3 -.if defined(PROG) -_DTRACELINKING=${OBJS} -OBJS+=${DTRACEOBJS} -.else -_DTRACELINKING=${SOBJS} -SOBJS+=${DTRACEOBJS} +CFLAGS+= -DHAVE_CONFIG_H +CFLAGS+= -I${ATF} + +DPADD+= ${LIBATF_C} ${LIBATF_CXX} +LDADD+= -latf-c++ -latf-c +USEPRIVATELIB= atf-c++ atf-c + +FILESGROUPS= SUBR + +SUBRDIR= ${SHAREDIR}/atf +SUBR= libatf-sh.subr + +.if ${MK_TESTS} != "no" +SUBDIR+= tests .endif -${DTRACEOBJS}: - -beforedepend: - ${DTRACE} -C -h -s ${DTRACESRCS} -beforelinking: - ${DTRACE} -G -s ${DTRACESRCS} ${_DTRACELINKING:S/${DTRACEOBJS}//} - -.endif +.include "../../../lib/atf/common.mk" +.include diff --git a/libexec/atf/atf-sh/Makefile.depend b/libexec/atf/atf-sh/Makefile.depend new file mode 100644 index 00000000000..72e04cf1a78 --- /dev/null +++ b/libexec/atf/atf-sh/Makefile.depend @@ -0,0 +1,24 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DIRDEPS = \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/atf/libatf-c \ + lib/atf/libatf-c++ \ + lib/libc \ + lib/libc++ \ + lib/libcompiler_rt \ + lib/libcxxrt \ + lib/msun \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/libexec/atf/atf-sh/tests/Makefile b/libexec/atf/atf-sh/tests/Makefile new file mode 100644 index 00000000000..e71b6b53a6b --- /dev/null +++ b/libexec/atf/atf-sh/tests/Makefile @@ -0,0 +1,31 @@ +# $FreeBSD$ + +.include + +TESTSDIR= ${TESTSBASE}/libexec/atf/atf-sh + +ATF= ${.CURDIR:H:H:H:H}/contrib/atf +.PATH: ${ATF}/atf-sh + +ATF_TESTS_SH+= atf_check_test +ATF_TESTS_SH+= config_test +ATF_TESTS_SH+= integration_test +ATF_TESTS_SH+= normalize_test +ATF_TESTS_SH+= tc_test +ATF_TESTS_SH+= tp_test + +integration_test: Makefile +ATF_TESTS_SH_SED_integration_test= \ + -e 's,atf_check,PATH=/usr/libexec:$${PATH} atf_check,g' \ + -e 's,/usr/bin/env *atf-sh,/usr/libexec/atf-sh,g' + +SCRIPTS+= misc_helpers +SCRIPTSDIR_misc_helpers=${TESTSDIR} +CLEANFILES+= misc_helpers misc_helpers.tmp +misc_helpers: misc_helpers.sh + echo '#! /usr/libexec/atf-sh' >${.TARGET}.tmp + cat ${.ALLSRC} >>${.TARGET}.tmp + chmod +x ${.TARGET}.tmp + mv ${.TARGET}.tmp ${.TARGET} + +.include diff --git a/libexec/bootpd/bootpd.8 b/libexec/bootpd/bootpd.8 index 78afa37756b..d1248002532 100644 --- a/libexec/bootpd/bootpd.8 +++ b/libexec/bootpd/bootpd.8 @@ -279,7 +279,7 @@ DHCP Options and BOOTP Vendor Extensions .El .Sh AUTHORS This distribution is currently maintained by -.An Walter L. Wimer Aq walt+@cmu.edu . +.An Walter L. Wimer Aq Mt walt+@cmu.edu . .Pp The original BOOTP server was created by .An Bill Croft @@ -299,12 +299,12 @@ Enhancements and bug-fixes have been contributed by: (in alphabetical order) .Pp .An -split -.An Danny Backx Aq db@sunbim.be -.An John Brezak Aq brezak@ch.hp.com -.An Frank da Cruz Aq fdc@cc.columbia.edu -.An David R. Linn Aq drl@vuse.vanderbilt.edu -.An Jim McKim Aq mckim@lerc.nasa.gov -.An Gordon W. Ross Aq gwr@mc.com -.An Jason Zions Aq jazz@hal.com . +.An Danny Backx Aq Mt db@sunbim.be +.An John Brezak Aq Mt brezak@ch.hp.com +.An Frank da Cruz Aq Mt fdc@cc.columbia.edu +.An David R. Linn Aq Mt drl@vuse.vanderbilt.edu +.An Jim McKim Aq Mt mckim@lerc.nasa.gov +.An Gordon W. Ross Aq Mt gwr@mc.com +.An Jason Zions Aq Mt jazz@hal.com . .Sh BUGS Individual host entries must not exceed 1024 characters. diff --git a/libexec/bootpd/tools/bootptest/bootptest.8 b/libexec/bootpd/tools/bootptest/bootptest.8 index 888ff227f12..4ba27244ba5 100644 --- a/libexec/bootpd/tools/bootptest/bootptest.8 +++ b/libexec/bootpd/tools/bootptest/bootptest.8 @@ -62,7 +62,7 @@ utility is a combination of original and derived works. The main program module .Pq Pa bootptest.c is original work by -.An "Gordon W. Ross" Aq gwr@mc.com . +.An Gordon W. Ross Aq Mt gwr@mc.com . The packet printing module .Pq Pa print\-bootp.c is a slightly modified diff --git a/libexec/mail.local/Makefile b/libexec/mail.local/Makefile index 3e59609e893..dff4238aebf 100644 --- a/libexec/mail.local/Makefile +++ b/libexec/mail.local/Makefile @@ -9,6 +9,8 @@ SRCS= mail.local.c MAN= mail.local.8 CFLAGS+=-I${SENDMAIL_DIR}/include -I. +NO_PIE= yes + WARNS?= 2 WFORMAT=0 diff --git a/libexec/mknetid/mknetid.8 b/libexec/mknetid/mknetid.8 index e70dc0038d9..08b8e74c844 100644 --- a/libexec/mknetid/mknetid.8 +++ b/libexec/mknetid/mknetid.8 @@ -149,4 +149,4 @@ the default netid database file .Xr yp 8 , .Xr yp_mkdb 8 .Sh AUTHORS -.An Bill Paul Aq wpaul@ctr.columbia.edu +.An Bill Paul Aq Mt wpaul@ctr.columbia.edu diff --git a/libexec/mknetid/netid.5 b/libexec/mknetid/netid.5 index 011d8f507ec..b2ec827b28c 100644 --- a/libexec/mknetid/netid.5 +++ b/libexec/mknetid/netid.5 @@ -88,4 +88,4 @@ unix.jodie@kaka 0:jodie .Xr mknetid 8 , .Xr yp 8 .Sh AUTHORS -.An Mats O Jansson Aq moj@stacken.kth.se +.An Mats O Jansson Aq Mt moj@stacken.kth.se diff --git a/libexec/pppoed/pppoed.8 b/libexec/pppoed/pppoed.8 index 2f783535b76..6841bfda473 100644 --- a/libexec/pppoed/pppoed.8 +++ b/libexec/pppoed/pppoed.8 @@ -206,7 +206,7 @@ and the following to The .Nm utility was written by -.An Brian Somers Aq brian@Awfulhak.org +.An Brian Somers Aq Mt brian@Awfulhak.org and first appeared in .Fx 3.4 . .Sh BUGS diff --git a/libexec/revnetgroup/revnetgroup.8 b/libexec/revnetgroup/revnetgroup.8 index f48c327508d..a17d9669e9d 100644 --- a/libexec/revnetgroup/revnetgroup.8 +++ b/libexec/revnetgroup/revnetgroup.8 @@ -156,4 +156,4 @@ master server .Xr yp 8 , .Xr yp_mkdb 8 .Sh AUTHORS -.An Bill Paul Aq wpaul@ctr.columbia.edu +.An Bill Paul Aq Mt wpaul@ctr.columbia.edu diff --git a/libexec/rtld-elf/Makefile b/libexec/rtld-elf/Makefile index 21e2219d372..48e86f77ca9 100644 --- a/libexec/rtld-elf/Makefile +++ b/libexec/rtld-elf/Makefile @@ -78,5 +78,11 @@ beforeinstall: .PATH: ${.CURDIR}/${RTLD_ARCH} +NO_PIE= yes + +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include .include diff --git a/libexec/rtld-elf/Makefile.depend b/libexec/rtld-elf/Makefile.depend index ea133a6ca5b..c4bbe3a972b 100644 --- a/libexec/rtld-elf/Makefile.depend +++ b/libexec/rtld-elf/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ include \ include/xlocale \ lib/libc \ diff --git a/libexec/rtld-elf/arm/rtld_start.S b/libexec/rtld-elf/arm/rtld_start.S index 7a4fae4f017..c48280815c3 100644 --- a/libexec/rtld-elf/arm/rtld_start.S +++ b/libexec/rtld-elf/arm/rtld_start.S @@ -77,7 +77,7 @@ __FBSDID("$FreeBSD$"); * lr = &GOT[2] */ _rtld_bind_start: - stmdb sp!,{r0-r4,sl,fp} + stmdb sp!,{r0-r5,sl,fp} sub r1, ip, lr /* r1 = 4 * (n + 1) */ sub r1, r1, #4 /* r1 = 4 * n */ @@ -86,11 +86,14 @@ _rtld_bind_start: ldr r0, [lr, #-4] /* get obj ptr from GOT[1] */ mov r4, ip /* save GOT location */ + mov r5, sp /* Save the stack pointer */ + bic sp, sp, #7 /* Align the stack pointer */ bl _rtld_bind /* Call the binder */ + mov sp, r5 /* Restore the old stack pointer */ str r0, [r4] /* save address in GOT */ mov ip, r0 /* save new address */ - ldmia sp!,{r0-r4,sl,fp,lr} /* restore the stack */ + ldmia sp!,{r0-r5,sl,fp,lr} /* restore the stack */ mov pc, ip /* jump to the new address */ diff --git a/libexec/rtld-elf/ia64/Makefile.inc b/libexec/rtld-elf/ia64/Makefile.inc deleted file mode 100644 index e8c0da7a1d7..00000000000 --- a/libexec/rtld-elf/ia64/Makefile.inc +++ /dev/null @@ -1 +0,0 @@ -# $FreeBSD$ diff --git a/libexec/rtld-elf/ia64/reloc.c b/libexec/rtld-elf/ia64/reloc.c deleted file mode 100644 index 1a41cb3cf8d..00000000000 --- a/libexec/rtld-elf/ia64/reloc.c +++ /dev/null @@ -1,658 +0,0 @@ -/*- - * Copyright 1996, 1997, 1998, 1999 John D. Polstra. - * 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. - * - * $FreeBSD$ - */ - -/* - * Dynamic linker for ELF. - * - * John Polstra . - */ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "debug.h" -#include "rtld.h" - -extern Elf_Dyn _DYNAMIC; - -/* - * Macros for loading/storing unaligned 64-bit values. These are - * needed because relocations can point to unaligned data. This - * occurs in the DWARF2 exception frame tables generated by the - * compiler, for instance. - * - * We don't use these when relocating jump slots and GOT entries, - * since they are guaranteed to be aligned. - * - * XXX dfr stub for now. - */ -#define load64(p) (*(u_int64_t *) (p)) -#define store64(p, v) (*(u_int64_t *) (p) = (v)) - -/* Allocate an @fptr. */ - -#define FPTR_CHUNK_SIZE 64 - -struct fptr_chunk { - struct fptr fptrs[FPTR_CHUNK_SIZE]; -}; - -static struct fptr_chunk first_chunk; -static struct fptr_chunk *current_chunk = &first_chunk; -static struct fptr *next_fptr = &first_chunk.fptrs[0]; -static struct fptr *last_fptr = &first_chunk.fptrs[FPTR_CHUNK_SIZE]; - -/* - * We use static storage initially so that we don't have to call - * malloc during init_rtld(). - */ -static struct fptr * -alloc_fptr(Elf_Addr target, Elf_Addr gp) -{ - struct fptr* fptr; - - if (next_fptr == last_fptr) { - current_chunk = xmalloc(sizeof(struct fptr_chunk)); - next_fptr = ¤t_chunk->fptrs[0]; - last_fptr = ¤t_chunk->fptrs[FPTR_CHUNK_SIZE]; - } - fptr = next_fptr; - next_fptr++; - fptr->target = target; - fptr->gp = gp; - return fptr; -} - -static struct fptr ** -alloc_fptrs(Obj_Entry *obj, bool mapped) -{ - struct fptr **fptrs; - size_t fbytes; - - fbytes = obj->dynsymcount * sizeof(struct fptr *); - - /* - * Avoid malloc, if requested. Happens when relocating - * rtld itself on startup. - */ - if (mapped) { - fptrs = mmap(NULL, fbytes, PROT_READ|PROT_WRITE, - MAP_ANON, -1, 0); - if (fptrs == MAP_FAILED) - fptrs = NULL; - } else { - fptrs = xcalloc(1, fbytes); - } - - /* - * This assertion is necessary to guarantee function pointer - * uniqueness - */ - assert(fptrs != NULL); - - return (obj->priv = fptrs); -} - -static void -free_fptrs(Obj_Entry *obj, bool mapped) -{ - struct fptr **fptrs; - size_t fbytes; - - fptrs = obj->priv; - if (fptrs == NULL) - return; - - fbytes = obj->dynsymcount * sizeof(struct fptr *); - if (mapped) - munmap(fptrs, fbytes); - else - free(fptrs); - obj->priv = NULL; -} - -/* Relocate a non-PLT object with addend. */ -static int -reloc_non_plt_obj(Obj_Entry *obj_rtld, Obj_Entry *obj, const Elf_Rela *rela, - SymCache *cache, int flags, RtldLockState *lockstate) -{ - struct fptr **fptrs; - Elf_Addr *where = (Elf_Addr *) (obj->relocbase + rela->r_offset); - - switch (ELF_R_TYPE(rela->r_info)) { - case R_IA_64_REL64LSB: - /* - * We handle rtld's relocations in rtld_start.S - */ - if (obj != obj_rtld) - store64(where, - load64(where) + (Elf_Addr) obj->relocbase); - break; - - case R_IA_64_DIR64LSB: { - const Elf_Sym *def; - const Obj_Entry *defobj; - Elf_Addr target; - - def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, - flags, cache, lockstate); - if (def == NULL) - return -1; - - target = (def->st_shndx != SHN_UNDEF) - ? (Elf_Addr)(defobj->relocbase + def->st_value) : 0; - store64(where, target + rela->r_addend); - break; - } - - case R_IA_64_FPTR64LSB: { - /* - * We have to make sure that all @fptr references to - * the same function are identical so that code can - * compare function pointers. - */ - const Elf_Sym *def; - const Obj_Entry *defobj; - struct fptr *fptr = 0; - Elf_Addr target, gp; - int sym_index; - - def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, - SYMLOOK_IN_PLT | flags, cache, lockstate); - if (def == NULL) { - /* - * XXX r_debug_state is problematic and find_symdef() - * returns NULL for it. This probably has something to - * do with symbol versioning (r_debug_state is in the - * symbol map). If we return -1 in that case we abort - * relocating rtld, which typically is fatal. So, for - * now just skip the symbol when we're relocating - * rtld. We don't care about r_debug_state unless we - * are being debugged. - */ - if (obj != obj_rtld) - return -1; - break; - } - - if (def->st_shndx != SHN_UNDEF) { - target = (Elf_Addr)(defobj->relocbase + def->st_value); - gp = (Elf_Addr)defobj->pltgot; - - /* rtld is allowed to reference itself only */ - assert(!obj->rtld || obj == defobj); - fptrs = defobj->priv; - if (fptrs == NULL) - fptrs = alloc_fptrs((Obj_Entry *) defobj, - obj->rtld); - - sym_index = def - defobj->symtab; - - /* - * Find the @fptr, using fptrs as a helper. - */ - if (fptrs) - fptr = fptrs[sym_index]; - if (!fptr) { - fptr = alloc_fptr(target, gp); - if (fptrs) - fptrs[sym_index] = fptr; - } - } else - fptr = NULL; - - store64(where, (Elf_Addr)fptr); - break; - } - - case R_IA_64_IPLTLSB: { - /* - * Relocation typically used to populate C++ virtual function - * tables. It creates a 128-bit function descriptor at the - * specified memory address. - */ - const Elf_Sym *def; - const Obj_Entry *defobj; - struct fptr *fptr; - Elf_Addr target, gp; - - def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, - flags, cache, lockstate); - if (def == NULL) - return -1; - - if (def->st_shndx != SHN_UNDEF) { - target = (Elf_Addr)(defobj->relocbase + def->st_value); - gp = (Elf_Addr)defobj->pltgot; - } else { - target = 0; - gp = 0; - } - - fptr = (void*)where; - store64(&fptr->target, target); - store64(&fptr->gp, gp); - break; - } - - case R_IA_64_DTPMOD64LSB: { - const Elf_Sym *def; - const Obj_Entry *defobj; - - def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, - flags, cache, lockstate); - if (def == NULL) - return -1; - - store64(where, defobj->tlsindex); - break; - } - - case R_IA_64_DTPREL64LSB: { - const Elf_Sym *def; - const Obj_Entry *defobj; - - def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, - flags, cache, lockstate); - if (def == NULL) - return -1; - - store64(where, def->st_value + rela->r_addend); - break; - } - - case R_IA_64_TPREL64LSB: { - const Elf_Sym *def; - const Obj_Entry *defobj; - - def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, - flags, cache, lockstate); - if (def == NULL) - return -1; - - /* - * We lazily allocate offsets for static TLS as we - * see the first relocation that references the - * TLS block. This allows us to support (small - * amounts of) static TLS in dynamically loaded - * modules. If we run out of space, we generate an - * error. - */ - if (!defobj->tls_done) { - if (!allocate_tls_offset((Obj_Entry*) defobj)) { - _rtld_error("%s: No space available for static " - "Thread Local Storage", obj->path); - return -1; - } - } - - store64(where, defobj->tlsoffset + def->st_value + rela->r_addend); - break; - } - - case R_IA_64_NONE: - break; - - default: - _rtld_error("%s: Unsupported relocation type %u" - " in non-PLT relocations\n", obj->path, - (unsigned int)ELF_R_TYPE(rela->r_info)); - return -1; - } - - return(0); -} - -/* Process the non-PLT relocations. */ -int -reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags, - RtldLockState *lockstate) -{ - const Elf_Rel *rellim; - const Elf_Rel *rel; - const Elf_Rela *relalim; - const Elf_Rela *rela; - SymCache *cache; - int bytes = obj->dynsymcount * sizeof(SymCache); - int r = -1; - - /* - * The dynamic loader may be called from a thread, we have - * limited amounts of stack available so we cannot use alloca(). - */ - cache = mmap(NULL, bytes, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0); - if (cache == MAP_FAILED) - cache = NULL; - - /* Perform relocations without addend if there are any: */ - rellim = (const Elf_Rel *) ((caddr_t) obj->rel + obj->relsize); - for (rel = obj->rel; obj->rel != NULL && rel < rellim; rel++) { - Elf_Rela locrela; - - locrela.r_info = rel->r_info; - locrela.r_offset = rel->r_offset; - locrela.r_addend = 0; - if (reloc_non_plt_obj(obj_rtld, obj, &locrela, cache, flags, - lockstate)) - goto done; - } - - /* Perform relocations with addend if there are any: */ - relalim = (const Elf_Rela *) ((caddr_t) obj->rela + obj->relasize); - for (rela = obj->rela; obj->rela != NULL && rela < relalim; rela++) { - if (reloc_non_plt_obj(obj_rtld, obj, rela, cache, flags, - lockstate)) - goto done; - } - - r = 0; -done: - if (cache) - munmap(cache, bytes); - - /* - * Release temporarily mapped fptrs if relocating - * rtld object itself. A new table will be created - * in make_function_pointer using malloc when needed. - */ - if (obj->rtld && obj->priv) - free_fptrs(obj, true); - - return (r); -} - -/* Process the PLT relocations. */ -int -reloc_plt(Obj_Entry *obj) -{ - /* All PLT relocations are the same kind: Elf_Rel or Elf_Rela. */ - if (obj->pltrelsize != 0) { - const Elf_Rel *rellim; - const Elf_Rel *rel; - - rellim = (const Elf_Rel *) - ((char *)obj->pltrel + obj->pltrelsize); - for (rel = obj->pltrel; rel < rellim; rel++) { - Elf_Addr *where; - - assert(ELF_R_TYPE(rel->r_info) == R_IA_64_IPLTLSB); - - /* Relocate the @fptr pointing into the PLT. */ - where = (Elf_Addr *)(obj->relocbase + rel->r_offset); - *where += (Elf_Addr)obj->relocbase; - } - } else { - const Elf_Rela *relalim; - const Elf_Rela *rela; - - relalim = (const Elf_Rela *) - ((char *)obj->pltrela + obj->pltrelasize); - for (rela = obj->pltrela; rela < relalim; rela++) { - Elf_Addr *where; - - assert(ELF_R_TYPE(rela->r_info) == R_IA_64_IPLTLSB); - - /* Relocate the @fptr pointing into the PLT. */ - where = (Elf_Addr *)(obj->relocbase + rela->r_offset); - *where += (Elf_Addr)obj->relocbase; - } - } - return 0; -} - -int -reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) -{ - - /* XXX not implemented */ - return (0); -} - -int -reloc_gnu_ifunc(Obj_Entry *obj, int flags, - struct Struct_RtldLockState *lockstate) -{ - - /* XXX not implemented */ - return (0); -} - -/* Relocate the jump slots in an object. */ -int -reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockState *lockstate) -{ - if (obj->jmpslots_done) - return 0; - /* All PLT relocations are the same kind: Elf_Rel or Elf_Rela. */ - if (obj->pltrelsize != 0) { - const Elf_Rel *rellim; - const Elf_Rel *rel; - - rellim = (const Elf_Rel *) - ((char *)obj->pltrel + obj->pltrelsize); - for (rel = obj->pltrel; rel < rellim; rel++) { - Elf_Addr *where; - const Elf_Sym *def; - const Obj_Entry *defobj; - - assert(ELF_R_TYPE(rel->r_info) == R_IA_64_IPLTLSB); - where = (Elf_Addr *)(obj->relocbase + rel->r_offset); - def = find_symdef(ELF_R_SYM(rel->r_info), obj, - &defobj, SYMLOOK_IN_PLT | flags, NULL, lockstate); - if (def == NULL) - return -1; - reloc_jmpslot(where, - (Elf_Addr)(defobj->relocbase - + def->st_value), - defobj, obj, rel); - } - } else { - const Elf_Rela *relalim; - const Elf_Rela *rela; - - relalim = (const Elf_Rela *) - ((char *)obj->pltrela + obj->pltrelasize); - for (rela = obj->pltrela; rela < relalim; rela++) { - Elf_Addr *where; - const Elf_Sym *def; - const Obj_Entry *defobj; - - where = (Elf_Addr *)(obj->relocbase + rela->r_offset); - def = find_symdef(ELF_R_SYM(rela->r_info), obj, - &defobj, SYMLOOK_IN_PLT | flags, NULL, lockstate); - if (def == NULL) - return -1; - reloc_jmpslot(where, - (Elf_Addr)(defobj->relocbase - + def->st_value), - defobj, obj, (Elf_Rel *)rela); - } - } - obj->jmpslots_done = true; - return 0; -} - -/* Fixup the jump slot at "where" to transfer control to "target". */ -Elf_Addr -reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const Obj_Entry *obj, - const Obj_Entry *refobj, const Elf_Rel *rel) -{ - Elf_Addr stubaddr; - - dbg(" reloc_jmpslot: where=%p, target=%p, gp=%p", - (void *)where, (void *)target, (void *)obj->pltgot); - stubaddr = *where; - if (stubaddr != target) { - - /* - * Point this @fptr directly at the target. Update the - * gp value first so that we don't break another cpu - * which is currently executing the PLT entry. - */ - where[1] = (Elf_Addr) obj->pltgot; - ia64_mf(); - where[0] = target; - ia64_mf(); - } - - /* - * The caller needs an @fptr for the adjusted entry. The PLT - * entry serves this purpose nicely. - */ - return (Elf_Addr) where; -} - -/* - * XXX ia64 doesn't seem to have copy relocations. - * - * Returns 0 on success, -1 on failure. - */ -int -do_copy_relocations(Obj_Entry *dstobj) -{ - - return 0; -} - -/* - * Return the @fptr representing a given function symbol. - */ -void * -make_function_pointer(const Elf_Sym *sym, const Obj_Entry *obj) -{ - struct fptr **fptrs = obj->priv; - int index = sym - obj->symtab; - - if (!fptrs) { - /* - * This should only happen for something like - * dlsym("dlopen"). Actually, I'm not sure it can ever - * happen. - */ - fptrs = alloc_fptrs((Obj_Entry *) obj, false); - } - if (!fptrs[index]) { - Elf_Addr target, gp; - target = (Elf_Addr) (obj->relocbase + sym->st_value); - gp = (Elf_Addr) obj->pltgot; - fptrs[index] = alloc_fptr(target, gp); - } - return fptrs[index]; -} - -void -call_initfini_pointer(const Obj_Entry *obj, Elf_Addr target) -{ - struct fptr fptr; - - fptr.gp = (Elf_Addr) obj->pltgot; - fptr.target = target; - dbg(" initfini: target=%p, gp=%p", - (void *) fptr.target, (void *) fptr.gp); - ((InitFunc) &fptr)(); -} - -void -call_init_pointer(const Obj_Entry *obj, Elf_Addr target) -{ - struct fptr fptr; - - fptr.gp = (Elf_Addr) obj->pltgot; - fptr.target = target; - dbg(" initfini: target=%p, gp=%p", - (void *) fptr.target, (void *) fptr.gp); - ((InitArrFunc) &fptr)(main_argc, main_argv, environ); -} - -/* Initialize the special PLT entries. */ -void -init_pltgot(Obj_Entry *obj) -{ - const Elf_Dyn *dynp; - Elf_Addr *pltres = 0; - - /* - * When there are no PLT relocations, the DT_IA_64_PLT_RESERVE entry - * is bogus. Do not setup the BOR pointers in that case. An example - * of where this happens is /usr/lib/libxpg4.so.3. - */ - if (obj->pltrelasize == 0 && obj->pltrelsize == 0) - return; - - /* - * Find the PLT RESERVE section. - */ - for (dynp = obj->dynamic; dynp->d_tag != DT_NULL; dynp++) { - if (dynp->d_tag == DT_IA_64_PLT_RESERVE) - pltres = (u_int64_t *) - (obj->relocbase + dynp->d_un.d_ptr); - } - if (!pltres) - errx(1, "Can't find DT_IA_64_PLT_RESERVE entry"); - - /* - * The PLT RESERVE section is used to get values to pass to - * _rtld_bind when lazy binding. - */ - pltres[0] = (Elf_Addr) obj; - pltres[1] = FPTR_TARGET(_rtld_bind_start); - pltres[2] = FPTR_GP(_rtld_bind_start); -} - -void -allocate_initial_tls(Obj_Entry *list) -{ - void *tpval; - - /* - * Fix the size of the static TLS block by using the maximum - * offset allocated so far and adding a bit for dynamic modules to - * use. - */ - tls_static_space = tls_last_offset + tls_last_size + RTLD_STATIC_TLS_EXTRA; - - tpval = allocate_tls(list, NULL, TLS_TCB_SIZE, 16); - __asm __volatile("mov r13 = %0" :: "r"(tpval)); -} - -void *__tls_get_addr(unsigned long module, unsigned long offset) -{ - register Elf_Addr** tp __asm__("r13"); - - return tls_get_addr_common(tp, module, offset); -} diff --git a/libexec/rtld-elf/ia64/rtld_machdep.h b/libexec/rtld-elf/ia64/rtld_machdep.h deleted file mode 100644 index 4a68ff79d1a..00000000000 --- a/libexec/rtld-elf/ia64/rtld_machdep.h +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * Copyright (c) 1999, 2000 John D. Polstra. - * 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 RTLD_MACHDEP_H -#define RTLD_MACHDEP_H 1 - -#include -#include - -/* - * Macros for cracking ia64 function pointers. - */ -struct fptr { - Elf_Addr target; - Elf_Addr gp; -}; - -#define FPTR_TARGET(f) (((struct fptr *) (f))->target) -#define FPTR_GP(f) (((struct fptr *) (f))->gp) - -/* Return the address of the .dynamic section in the dynamic linker. */ -#define rtld_dynamic(obj) (&_DYNAMIC) - -struct Struct_Obj_Entry; - -Elf_Addr reloc_jmpslot(Elf_Addr *, Elf_Addr, const struct Struct_Obj_Entry *, - const struct Struct_Obj_Entry *, const Elf_Rel *); -void *make_function_pointer(const Elf_Sym *, const struct Struct_Obj_Entry *); -void call_initfini_pointer(const struct Struct_Obj_Entry *, Elf_Addr); -void call_init_pointer(const struct Struct_Obj_Entry *, Elf_Addr); - -#define TLS_TCB_SIZE 16 - -#define round(size, align) \ - (((size) + (align) - 1) & ~((align) - 1)) -#define calculate_first_tls_offset(size, align) \ - round(TLS_TCB_SIZE, align) -#define calculate_tls_offset(prev_offset, prev_size, size, align) \ - round(prev_offset + prev_size, align) -#define calculate_tls_end(off, size) ((off) + (size)) - -extern void *__tls_get_addr(unsigned long module, unsigned long offset); - -#define RTLD_DEFAULT_STACK_PF_EXEC 0 -#define RTLD_DEFAULT_STACK_EXEC 0 - -#endif diff --git a/libexec/rtld-elf/ia64/rtld_start.S b/libexec/rtld-elf/ia64/rtld_start.S deleted file mode 100644 index f41e5e51bd2..00000000000 --- a/libexec/rtld-elf/ia64/rtld_start.S +++ /dev/null @@ -1,252 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: rtld_start.S,v 1.1 1996/12/16 20:38:09 cgd Exp */ - -/* - * Copyright 1996 Matt Thomas - * Copyright 2000 John D. Polstra - * 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. The name of the author may not 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 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 - -ENTRY(_rtld_start, 0) - alloc r2=ar.pfs,3,0,3,0 - ;; -1: mov r14=ip // calculate gp - addl r3=@gprel(1b),r0 - ;; - sub gp=r14,r3 - ;; - .section .sdata -2: data4 @ltv(1b) // unrelocated address of 1b - .align 8 - .previous - add r15=@gprel(2b),gp - ;; - ld8 r15=[r15] - ;; - sub out0=r14,r15 // out0 is image base address - br.call.sptk.many rp=_rtld_reloc // fixup image - - add sp=-16,sp // 16 bytes for us, 16 for _rtld - ;; - mov out0=in0 - add out1=16,sp // address for exit proc - add out2=24,sp // address for obj_main - - br.call.sptk.many rp=_rtld // r8=_rtld(sp, &exit_proc, &obj_main) - - add r16=16,sp // address for exit proc - ;; - ld8 r15=[r16] // read exit proc - add sp=16,sp // readjust stack - mov b7=r8 // address of real _start - ;; - alloc r2=ar.pfs,0,0,3,0 // dump register frame - mov out2=r15 - ;; - br.call.sptk.many rp=b7 // transfer to main program - br.call.sptk.many rp=exit // die -END(_rtld_start) - -/* - * _rtld_bind_start: lookup a lazy binding and transfer to real target - * - * Arguments: - * r1 gp value for rtld - * r15 Index in plt - * r16 Obj_Entry of caller - * in0-in7 Arguments for target procedure - * rp Return address back to caller - */ -ENTRY(_rtld_bind_start, 0) -{ .mii - alloc loc0=ar.pfs,8,6,3,0 // space to save r8-r11 - add r17=16-8*16,sp // leave 16 bytes for _rtld_bind - add r18=32-8*16,sp - ;; -} { .mii - mov loc2=r8 // structure return address - add sp=-8*16,sp // space to save f8-f15 - mov loc1=rp - ;; -} { .mii - stf.spill [r17]=f8,32 // save float arguments - mov loc3=r9 // language specific - mov loc4=r10 // language specific -} { .mii - stf.spill [r18]=f9,32 - mov loc5=r11 // language specific - shl out1=r15,4 // 16 * index - ;; -} { .mmi - stf.spill [r17]=f10,32 - stf.spill [r18]=f11,32 - mov out0=r16 // Obj_Entry for caller - ;; -} { .mmi - stf.spill [r17]=f12,32 - stf.spill [r18]=f13,32 - shladd out1=r15,3,out1 // rela offset = 24 * index - ;; -} { .mmb - stf.spill [r17]=f14,32 - stf.spill [r18]=f15,32 - br.call.sptk.many rp=_rtld_bind -} { .mii - ld8 r14=[r8],8 // target address - add r17=16,sp - add r18=32,sp - ;; -} { .mii - ld8 r1=[r8] // target gp - mov ar.pfs=loc0 // clean up - mov rp=loc1 -} { .mmi - ldf.fill f8=[r17],32 // restore float arguments - ldf.fill f9=[r18],32 - mov r8=loc2 // restore structure pointer - ;; -} { .mmi - ldf.fill f10=[r17],32 - ldf.fill f11=[r18],32 - mov r9=loc3 - ;; -} { .mmi - ldf.fill f12=[r17],32 - ldf.fill f13=[r18],32 - mov r10=loc4 - ;; -} { .mmi - ldf.fill f14=[r17],32 - ldf.fill f15=[r18],32 - mov r11=loc5 - ;; -} { .mii - nop.m 0 - mov b7=r14 - add sp=8*16,sp - ;; -} { .mib - alloc r14=ar.pfs,0,0,8,0 // drop our register frame - nop.i 0 - br.sptk.many b7 // jump to target -} -END(_rtld_bind_start) - -#define DT_NULL 0 /* Terminating entry. */ -#define DT_RELA 7 /* Address of ElfNN_Rela relocations. */ -#define DT_RELASZ 8 /* Total size of ElfNN_Rela relocations. */ -#define DT_RELAENT 9 /* Size of each ElfNN_Rela relocation entry. */ - -#define R_IA_64_NONE 0 /* None */ -#define R_IA_64_DIR64LSB 0x27 /* word64 LSB S + A */ -#define R_IA_64_REL64LSB 0x6f /* word64 LSB BD + A */ - -/* - * _rtld_reloc: relocate the rtld image, apart from @fptrs. - * - * Assumes that rtld was linked at zero and that we only need to - * handle REL64LSB and DIR64LSB relocations. - * - * Arguments: - * r1 gp value for rtld - * in0 rtld base address - */ -STATIC_ENTRY(_rtld_reloc, 1) - alloc loc0=ar.pfs,1,2,0,0 - mov loc1=rp - ;; - movl r15=@gprel(_DYNAMIC) // find _DYNAMIC etc. - ;; - add r15=r15,gp // relocate _DYNAMIC etc. - ;; -1: ld8 r16=[r15],8 // read r15->d_tag - ;; - ld8 r17=[r15],8 // and r15->d_val - ;; - cmp.eq p6,p0=DT_NULL,r16 // done? -(p6) br.cond.dpnt.few 2f - ;; - cmp.eq p6,p0=DT_RELA,r16 - ;; -(p6) add r18=r17,in0 // found rela section - ;; - cmp.eq p6,p0=DT_RELASZ,r16 - ;; -(p6) mov r19=r17 // found rela size - ;; - cmp.eq p6,p0=DT_RELAENT,r16 - ;; -(p6) mov r22=r17 // found rela entry size - ;; - br.sptk.few 1b - -2: - ld8 r15=[r18],8 // read r_offset - ;; - ld8 r16=[r18],8 // read r_info - add r15=r15,in0 // relocate r_offset - ;; - ld8 r17=[r18],8 // read r_addend - sub r19=r19,r22 // update relasz - - extr.u r23=r16,0,32 // ELF64_R_TYPE(r16) - ;; - cmp.eq p6,p0=R_IA_64_NONE,r23 -(p6) br.cond.dpnt.few 3f - ;; - cmp.eq p6,p0=R_IA_64_DIR64LSB,r23 - ;; -(p6) br.cond.dptk.few 4f - ;; - cmp.eq p6,p0=R_IA_64_REL64LSB,r23 - ;; -(p6) br.cond.dptk.few 4f - ;; - -3: cmp.ltu p6,p0=0,r19 // more? -(p6) br.cond.dptk.few 2b // loop - - mov r8=0 // success return value - ;; - br.cond.sptk.few 9f // done - -4: - ld8 r16=[r15] // read value - ;; - add r16=r16,in0 // relocate it - ;; - st8 [r15]=r16 // and store it back - br.cond.sptk.few 3b - -9: - mov ar.pfs=loc0 - mov rp=loc1 - ;; - br.ret.sptk.few rp - -END(_rtld_reloc) diff --git a/libexec/rtld-elf/libmap.c b/libexec/rtld-elf/libmap.c index 2e1f3c6a151..8b5faf889ed 100644 --- a/libexec/rtld-elf/libmap.c +++ b/libexec/rtld-elf/libmap.c @@ -80,7 +80,7 @@ lm_init(char *libmap_override) if (libmap_override) { /* - * Do some character replacement to make $LIBMAP look + * Do some character replacement to make $LDLIBMAP look * like a text file, then parse it. */ libmap_override = xstrdup(libmap_override); @@ -94,8 +94,8 @@ lm_init(char *libmap_override) break; } } - lmc_parse(p, strlen(p)); - free(p); + lmc_parse(libmap_override, p - libmap_override); + free(libmap_override); } return (lm_count == 0); diff --git a/libexec/rtld-elf/rtld.1 b/libexec/rtld-elf/rtld.1 index 703a462e8d6..a8e9d680d25 100644 --- a/libexec/rtld-elf/rtld.1 +++ b/libexec/rtld-elf/rtld.1 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 28, 2012 +.Dd June 20, 2014 .Dt RTLD 1 .Os .Sh NAME @@ -192,6 +192,13 @@ the directories specified by will be searched first followed by the set of built-in standard directories. This variable is unset for set-user-ID and set-group-ID programs. +.Ev LD_LIBRARY_PATH_FDS +A colon separated list of file descriptor numbers for library directories. +This is intended for use within +.Xr capsicum 4 +sandboxes, when global namespaces such as the filesystem are unavailable. +It is consulted just after LD_LIBRARY_PATH. +This variable is unset for set-user-ID and set-group-ID programs. .It Ev LD_BIND_NOW When set to a nonempty string, causes .Nm @@ -260,7 +267,6 @@ If set, .Nm will log events such as the loading and unloading of shared objects via .Xr utrace 2 . -.Pp .It Ev LD_LOADFLTR If set, .Nm @@ -283,6 +289,7 @@ The libmap configuration file for 32-bit binaries on 64-bit system. .Sh SEE ALSO .Xr ld 1 , .Xr ldd 1 , +.Xr capsicum 4 , .Xr elf 5 , .Xr libmap.conf 5 , .Xr ldconfig 8 diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 443767d99ba..03c92d0a327 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -94,7 +94,7 @@ static bool donelist_check(DoneList *, const Obj_Entry *); static void errmsg_restore(char *); static char *errmsg_save(void); static void *fill_search_info(const char *, size_t, void *); -static char *find_library(const char *, const Obj_Entry *); +static char *find_library(const char *, const Obj_Entry *, int *); static const char *gethints(bool); static void init_dag(Obj_Entry *); static void init_pagesizes(Elf_Auxinfo **aux_info); @@ -119,6 +119,7 @@ static void objlist_push_head(Objlist *, Obj_Entry *); static void objlist_push_tail(Objlist *, Obj_Entry *); static void objlist_put_after(Objlist *, Obj_Entry *, Obj_Entry *); static void objlist_remove(Objlist *, Obj_Entry *); +static int parse_libdir(const char *); static void *path_enumerate(const char *, path_enum_proc, void *); static int relocate_object_dag(Obj_Entry *root, bool bind_now, Obj_Entry *rtldobj, int flags, RtldLockState *lockstate); @@ -133,6 +134,7 @@ static int rtld_dirname_abs(const char *, char *); static void *rtld_dlopen(const char *name, int fd, int mode); static void rtld_exit(void); static char *search_library_path(const char *, const char *); +static char *search_library_pathfds(const char *, const char *, int *); static const void **get_program_var_addr(const char *, RtldLockState *); static void set_program_var(const char *, const void *); static int symlook_default(SymLook *, const Obj_Entry *refobj); @@ -178,6 +180,7 @@ static bool dangerous_ld_env; /* True if environment variables have been static char *ld_bind_now; /* Environment variable for immediate binding */ static char *ld_debug; /* Environment variable for debugging */ static char *ld_library_path; /* Environment variable for search path */ +static char *ld_library_dirs; /* Environment variable for library descriptors */ static char *ld_preload; /* Environment variable for libraries to load first */ static char *ld_elf_hints_path; /* Environment variable for alternative hints path */ @@ -401,7 +404,8 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) */ if (!trust) { if (unsetenv(LD_ "PRELOAD") || unsetenv(LD_ "LIBMAP") || - unsetenv(LD_ "LIBRARY_PATH") || unsetenv(LD_ "LIBMAP_DISABLE") || + unsetenv(LD_ "LIBRARY_PATH") || unsetenv(LD_ "LIBRARY_PATH_FDS") || + unsetenv(LD_ "LIBMAP_DISABLE") || unsetenv(LD_ "DEBUG") || unsetenv(LD_ "ELF_HINTS_PATH") || unsetenv(LD_ "LOADFLTR") || unsetenv(LD_ "LIBRARY_PATH_RPATH")) { _rtld_error("environment corrupt; aborting"); @@ -412,6 +416,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) libmap_disable = getenv(LD_ "LIBMAP_DISABLE") != NULL; libmap_override = getenv(LD_ "LIBMAP"); ld_library_path = getenv(LD_ "LIBRARY_PATH"); + ld_library_dirs = getenv(LD_ "LIBRARY_PATH_FDS"); ld_preload = getenv(LD_ "PRELOAD"); ld_elf_hints_path = getenv(LD_ "ELF_HINTS_PATH"); ld_loadfltr = getenv(LD_ "LOADFLTR") != NULL; @@ -1417,6 +1422,7 @@ gnu_hash(const char *s) return (h & 0xffffffff); } + /* * Find the library with the given name, and return its full pathname. * The returned string is dynamically allocated. Generates an error @@ -1425,6 +1431,10 @@ gnu_hash(const char *s) * If the second argument is non-NULL, then it refers to an already- * loaded shared object, whose library search path will be searched. * + * If a library is successfully located via LD_LIBRARY_PATH_FDS, its + * descriptor (which is close-on-exec) will be passed out via the third + * argument. + * * The search order is: * DT_RPATH in the referencing file _unless_ DT_RUNPATH is present (1) * DT_RPATH of the main object if DSO without defined DT_RUNPATH (1) @@ -1437,7 +1447,7 @@ gnu_hash(const char *s) * (1) Handled in digest_dynamic2 - rpath left NULL if runpath defined. */ static char * -find_library(const char *xname, const Obj_Entry *refobj) +find_library(const char *xname, const Obj_Entry *refobj, int *fdp) { char *pathname; char *name; @@ -1474,6 +1484,7 @@ find_library(const char *xname, const Obj_Entry *refobj) if ((pathname = search_library_path(name, ld_library_path)) != NULL || (refobj != NULL && (pathname = search_library_path(name, refobj->rpath)) != NULL) || + (pathname = search_library_pathfds(name, ld_library_dirs, fdp)) != NULL || (pathname = search_library_path(name, gethints(false))) != NULL || (pathname = search_library_path(name, STANDARD_LIBRARY_PATH)) != NULL) return (pathname); @@ -1486,6 +1497,7 @@ find_library(const char *xname, const Obj_Entry *refobj) (pathname = search_library_path(name, ld_library_path)) != NULL || (objgiven && (pathname = search_library_path(name, refobj->runpath)) != NULL) || + (pathname = search_library_pathfds(name, ld_library_dirs, fdp)) != NULL || (pathname = search_library_path(name, gethints(nodeflib))) != NULL || (objgiven && !nodeflib && (pathname = search_library_path(name, STANDARD_LIBRARY_PATH)) != NULL)) @@ -1790,6 +1802,11 @@ init_rtld(caddr_t mapbase, Elf_Auxinfo **aux_info) const Elf_Dyn *dyn_soname; const Elf_Dyn *dyn_runpath; +#ifdef RTLD_INIT_PAGESIZES_EARLY + /* The page size is required by the dynamic memory allocator. */ + init_pagesizes(aux_info); +#endif + /* * Conjure up an Obj_Entry structure for the dynamic linker. * @@ -1826,8 +1843,10 @@ init_rtld(caddr_t mapbase, Elf_Auxinfo **aux_info) /* Now that non-local variables can be accesses, copy out obj_rtld. */ memcpy(&obj_rtld, &objtmp, sizeof(obj_rtld)); +#ifndef RTLD_INIT_PAGESIZES_EARLY /* The page size is required by the dynamic memory allocator. */ init_pagesizes(aux_info); +#endif if (aux_info[AT_OSRELDATE] != NULL) osreldate = aux_info[AT_OSRELDATE]->a_un.a_val; @@ -2085,29 +2104,34 @@ load_object(const char *name, int fd_u, const Obj_Entry *refobj, int flags) struct stat sb; char *path; + fd = -1; if (name != NULL) { for (obj = obj_list->next; obj != NULL; obj = obj->next) { if (object_match_name(obj, name)) return (obj); } - path = find_library(name, refobj); + path = find_library(name, refobj, &fd); if (path == NULL) return (NULL); } else path = NULL; - /* - * If we didn't find a match by pathname, or the name is not - * supplied, open the file and check again by device and inode. - * This avoids false mismatches caused by multiple links or ".." - * in pathnames. - * - * To avoid a race, we open the file and use fstat() rather than - * using stat(). - */ - fd = -1; - if (fd_u == -1) { + if (fd >= 0) { + /* + * search_library_pathfds() opens a fresh file descriptor for the + * library, so there is no need to dup(). + */ + } else if (fd_u == -1) { + /* + * If we didn't find a match by pathname, or the name is not + * supplied, open the file and check again by device and inode. + * This avoids false mismatches caused by multiple links or ".." + * in pathnames. + * + * To avoid a race, we open the file and use fstat() rather than + * using stat(). + */ if ((fd = open(path, O_RDONLY | O_CLOEXEC)) == -1) { _rtld_error("Cannot open \"%s\"", path); free(path); @@ -2745,6 +2769,69 @@ search_library_path(const char *name, const char *path) return (p); } + +/* + * Finds the library with the given name using the directory descriptors + * listed in the LD_LIBRARY_PATH_FDS environment variable. + * + * Returns a freshly-opened close-on-exec file descriptor for the library, + * or -1 if the library cannot be found. + */ +static char * +search_library_pathfds(const char *name, const char *path, int *fdp) +{ + char *envcopy, *fdstr, *found, *last_token; + size_t len; + int dirfd, fd; + + dbg("%s('%s', '%s', fdp)\n", __func__, name, path); + + /* Don't load from user-specified libdirs into setuid binaries. */ + if (!trust) + return (NULL); + + /* We can't do anything if LD_LIBRARY_PATH_FDS isn't set. */ + if (path == NULL) + return (NULL); + + /* LD_LIBRARY_PATH_FDS only works with relative paths. */ + if (name[0] == '/') { + dbg("Absolute path (%s) passed to %s", name, __func__); + return (NULL); + } + + /* + * Use strtok_r() to walk the FD:FD:FD list. This requires a local + * copy of the path, as strtok_r rewrites separator tokens + * with '\0'. + */ + found = NULL; + envcopy = xstrdup(path); + for (fdstr = strtok_r(envcopy, ":", &last_token); fdstr != NULL; + fdstr = strtok_r(NULL, ":", &last_token)) { + dirfd = parse_libdir(fdstr); + if (dirfd < 0) + break; + fd = openat(dirfd, name, O_RDONLY | O_CLOEXEC); + if (fd >= 0) { + *fdp = fd; + len = strlen(fdstr) + strlen(name) + 3; + found = xmalloc(len); + if (rtld_snprintf(found, len, "#%d/%s", dirfd, name) < 0) { + _rtld_error("error generating '%d/%s'", + dirfd, name); + die(); + } + dbg("open('%s') => %d", found, fd); + break; + } + } + free(envcopy); + + return (found); +} + + int dlclose(void *handle) { @@ -2997,9 +3084,7 @@ do_dlsym(void *handle, const char *name, void *retaddr, const Ver_Entry *ve, const Elf_Sym *def; SymLook req; RtldLockState lockstate; -#ifndef __ia64__ tls_index ti; -#endif int res; def = NULL; @@ -3104,24 +3189,17 @@ do_dlsym(void *handle, const char *name, void *retaddr, const Ver_Entry *ve, /* * The value required by the caller is derived from the value - * of the symbol. For the ia64 architecture, we need to - * construct a function descriptor which the caller can use to - * call the function with the right 'gp' value. For other - * architectures and for non-functions, the value is simply - * the relocated value of the symbol. + * of the symbol. this is simply the relocated value of the + * symbol. */ if (ELF_ST_TYPE(def->st_info) == STT_FUNC) return (make_function_pointer(def, defobj)); else if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) return (rtld_resolve_ifunc(defobj, def)); else if (ELF_ST_TYPE(def->st_info) == STT_TLS) { -#ifdef __ia64__ - return (__tls_get_addr(defobj->tlsindex, def->st_value)); -#else ti.ti_module = defobj->tlsindex; ti.ti_offset = def->st_value; return (__tls_get_addr(&ti)); -#endif } else return (defobj->relocbase + def->st_value); } @@ -4254,7 +4332,7 @@ tls_get_addr_common(Elf_Addr **dtvp, int index, size_t offset) return (tls_get_addr_slow(dtvp, index, offset)); } -#if defined(__arm__) || defined(__ia64__) || defined(__mips__) || defined(__powerpc__) +#if defined(__arm__) || defined(__mips__) || defined(__powerpc__) /* * Allocate Static TLS using the Variant I method. @@ -4835,6 +4913,36 @@ symlook_init_from_req(SymLook *dst, const SymLook *src) dst->lockstate = src->lockstate; } + +/* + * Parse a file descriptor number without pulling in more of libc (e.g. atoi). + */ +static int +parse_libdir(const char *str) +{ + static const int RADIX = 10; /* XXXJA: possibly support hex? */ + const char *orig; + int fd; + char c; + + orig = str; + fd = 0; + for (c = *str; c != '\0'; c = *++str) { + if (c < '0' || c > '9') + return (-1); + + fd *= RADIX; + fd += c - '0'; + } + + /* Make sure we actually parsed something. */ + if (str == orig) { + _rtld_error("failed to parse directory FD from '%s'", str); + return (-1); + } + return (fd); +} + /* * Overrides for libc_pic-provided functions. */ diff --git a/libexec/rtld-elf/rtld_lock.c b/libexec/rtld-elf/rtld_lock.c index d1563e54a84..ea16c4d4e12 100644 --- a/libexec/rtld-elf/rtld_lock.c +++ b/libexec/rtld-elf/rtld_lock.c @@ -365,8 +365,19 @@ _rtld_atfork_pre(int *locks) { RtldLockState ls[2]; + if (locks == NULL) + return; + + /* + * Warning: this does not work with the rtld compat locks + * above, since the thread signal mask is corrupted (set to + * all signals blocked) if two locks are taken in write mode. + * The caller of the _rtld_atfork_pre() must provide the + * working implementation of the locks, and libthr locks are + * fine. + */ wlock_acquire(rtld_phdr_lock, &ls[0]); - rlock_acquire(rtld_bind_lock, &ls[1]); + wlock_acquire(rtld_bind_lock, &ls[1]); /* XXXKIB: I am really sorry for this. */ locks[0] = ls[1].lockstate; @@ -378,6 +389,9 @@ _rtld_atfork_post(int *locks) { RtldLockState ls[2]; + if (locks == NULL) + return; + bzero(ls, sizeof(ls)); ls[0].lockstate = locks[2]; ls[1].lockstate = locks[0]; diff --git a/libexec/rtld-elf/rtld_printf.c b/libexec/rtld-elf/rtld_printf.c index eb4514a3902..9d945dc3b26 100644 --- a/libexec/rtld-elf/rtld_printf.c +++ b/libexec/rtld-elf/rtld_printf.c @@ -428,6 +428,18 @@ reswitch: switch (ch = (u_char)*fmt++) { #undef PCHAR } +int +rtld_snprintf(char *buf, size_t bufsize, const char *fmt, ...) +{ + va_list ap; + int retval; + + va_start(ap, fmt); + retval = rtld_vsnprintf(buf, bufsize, fmt, ap); + va_end(ap); + return (retval); +} + int rtld_vsnprintf(char *buf, size_t bufsize, const char *fmt, va_list ap) { diff --git a/libexec/rtld-elf/rtld_printf.h b/libexec/rtld-elf/rtld_printf.h index 6125732cb6a..aaf2971accd 100644 --- a/libexec/rtld-elf/rtld_printf.h +++ b/libexec/rtld-elf/rtld_printf.h @@ -31,6 +31,8 @@ #include #include +int rtld_snprintf(char *buf, size_t bufsize, const char *fmt, ...) + __printflike(3, 4); int rtld_vsnprintf(char *buf, size_t bufsize, const char *fmt, va_list ap); int rtld_vfdprintf(int fd, const char *fmt, va_list ap); int rtld_fdprintf(int fd, const char *fmt, ...) __printflike(2, 3); diff --git a/libexec/rtld-elf/tests/Makefile b/libexec/rtld-elf/tests/Makefile new file mode 100644 index 00000000000..5e57f60f3f5 --- /dev/null +++ b/libexec/rtld-elf/tests/Makefile @@ -0,0 +1,14 @@ +# $FreeBSD$ + +.include + +TESTSDIR= ${TESTSBASE}/libexec/rtld-elf +SUBDIR+= libpythagoras target + +.PATH: ${.CURDIR:H:H:H:H}/tests + +ATF_TESTS_C= ld_library_pathfds + +CFLAGS+= -DTESTSDIR="\"${TESTSDIR}\"" + +.include diff --git a/libexec/rtld-elf/tests/ld_library_pathfds.c b/libexec/rtld-elf/tests/ld_library_pathfds.c new file mode 100644 index 00000000000..274b5e82020 --- /dev/null +++ b/libexec/rtld-elf/tests/ld_library_pathfds.c @@ -0,0 +1,220 @@ +/*- + * Copyright 2014 Jonathan Anderson. + * 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. + * + * $FreeBSD$ + */ + +#include +#include +#include + + +struct descriptors { + int binary; + int testdir; + int root; + int etc; + int usr; +}; + +static void setup(struct descriptors *); +static void expect_success(int binary, char *pathfds); +static void expect_missing_library(int binary, char *pathfds); + +static void try_to_run(int binary, int expected_exit_status, + char * const *env, const char *expected_out, const char *expected_err); +static int opendir(const char *name); +static int opendirat(int parent, const char *name); + + +ATF_TC_WITHOUT_HEAD(missing_library); +ATF_TC_BODY(missing_library, tc) +{ + struct descriptors files; + + setup(&files); + expect_missing_library(files.binary, NULL); +} + + +ATF_TC_WITHOUT_HEAD(wrong_library_directories); +ATF_TC_BODY(wrong_library_directories, tc) +{ + struct descriptors files; + char *pathfds; + + setup(&files); + ATF_REQUIRE( + asprintf(&pathfds, "LD_LIBRARY_PATH_FDS=%d", files.etc) > 0); + + expect_missing_library(files.binary, pathfds); +} + + +ATF_TC_WITHOUT_HEAD(bad_library_directories); +ATF_TC_BODY(bad_library_directories, tc) +{ + struct descriptors files; + char *pathfds; + + setup(&files); + ATF_REQUIRE(asprintf(&pathfds, "::", files.etc) > 0); + + expect_missing_library(files.binary, pathfds); +} + + +ATF_TC_WITHOUT_HEAD(single_library_directory); +ATF_TC_BODY(single_library_directory, tc) +{ + struct descriptors files; + char *pathfds; + + setup(&files); + ATF_REQUIRE( + asprintf(&pathfds, "LD_LIBRARY_PATH_FDS=%d", files.testdir) > 0); + + expect_success(files.binary, pathfds); +} + + +ATF_TC_WITHOUT_HEAD(first_library_directory); +ATF_TC_BODY(first_library_directory, tc) +{ + struct descriptors files; + char *pathfds; + + setup(&files); + ATF_REQUIRE( + asprintf(&pathfds, "LD_LIBRARY_PATH_FDS=%d:%d", + files.testdir, files.etc) > 0); + + expect_success(files.binary, pathfds); +} + + +ATF_TC_WITHOUT_HEAD(middle_library_directory); +ATF_TC_BODY(middle_library_directory, tc) +{ + struct descriptors files; + char *pathfds; + + setup(&files); + ATF_REQUIRE( + asprintf(&pathfds, "LD_LIBRARY_PATH_FDS=%d:%d:%d", + files.root, files.testdir, files.usr) > 0); + + expect_success(files.binary, pathfds); +} + + +ATF_TC_WITHOUT_HEAD(last_library_directory); +ATF_TC_BODY(last_library_directory, tc) +{ + struct descriptors files; + char *pathfds; + + setup(&files); + ATF_REQUIRE( + asprintf(&pathfds, "LD_LIBRARY_PATH_FDS=%d:%d", + files.root, files.testdir) > 0); + + expect_success(files.binary, pathfds); +} + + + +/* Register test cases with ATF. */ +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, missing_library); + ATF_TP_ADD_TC(tp, wrong_library_directories); + ATF_TP_ADD_TC(tp, bad_library_directories); + ATF_TP_ADD_TC(tp, single_library_directory); + ATF_TP_ADD_TC(tp, first_library_directory); + ATF_TP_ADD_TC(tp, middle_library_directory); + ATF_TP_ADD_TC(tp, last_library_directory); + + return atf_no_error(); +} + + +static void +setup(struct descriptors *dp) +{ + + ATF_REQUIRE((dp->testdir = opendir(TESTSDIR)) >= 0); + ATF_REQUIRE( + (dp->binary = openat(dp->testdir, "target", O_RDONLY)) >= 0); + + ATF_REQUIRE((dp->root = opendir("/")) >= 0); + ATF_REQUIRE((dp->etc = opendirat(dp->root, "etc")) >= 0); + ATF_REQUIRE((dp->usr = opendirat(dp->root, "usr")) >= 0); +} + +static void +expect_success(int binary, char *pathfds) +{ + char * const env[] = { pathfds, NULL }; + try_to_run(binary, 0, env, "the hypotenuse of 3 and 4 is 5\n", ""); +} + +static void +expect_missing_library(int binary, char *pathfds) +{ + char * const env[] = { pathfds, NULL }; + try_to_run(binary, 1, env, "", + "Shared object \"libpythagoras.so.0\" not found," + " required by \"target\"\n"); +} + + +static void +try_to_run(int binary, int exit_status, char * const *env, + const char *expected_out, const char *expected_err) +{ + pid_t child = atf_utils_fork(); + + if (child == 0) { + char * const args[] = { "target", NULL }; + + fexecve(binary, args, env); + atf_tc_fail("fexecve() failed"); + } + + atf_utils_wait(child, exit_status, expected_out, expected_err); +} + + +static int +opendir(const char *name) +{ + return open(name, O_RDONLY | O_DIRECTORY); +} + +static int +opendirat(int parent, const char *name) +{ + return openat(parent, name, O_RDONLY | O_DIRECTORY); +} diff --git a/libexec/rtld-elf/tests/libpythagoras/Makefile b/libexec/rtld-elf/tests/libpythagoras/Makefile new file mode 100644 index 00000000000..09b67c9baf1 --- /dev/null +++ b/libexec/rtld-elf/tests/libpythagoras/Makefile @@ -0,0 +1,16 @@ +# $FreeBSD$ + +.include + +LIB= pythagoras +SHLIB_MAJOR= 0 + +LIBDIR= ${TESTSBASE}${TESTSDIR}/libexec/rtld-elf +SHLIBDIR= ${TESTSBASE}${TESTSDIR}/libexec/rtld-elf + +SRCS= pythagoras.c + +DPADD= ${LIBM} +LDADD= -lm + +.include diff --git a/sys/ia64/include/vdso.h b/libexec/rtld-elf/tests/libpythagoras/pythagoras.c similarity index 83% rename from sys/ia64/include/vdso.h rename to libexec/rtld-elf/tests/libpythagoras/pythagoras.c index 4571daa299d..c7fa604b41a 100644 --- a/sys/ia64/include/vdso.h +++ b/libexec/rtld-elf/tests/libpythagoras/pythagoras.c @@ -1,5 +1,5 @@ /*- - * Copyright 2012 Konstantin Belousov . + * Copyright 2014 Jonathan Anderson. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -25,17 +25,18 @@ * $FreeBSD$ */ -#ifndef _IA64_VDSO_H -#define _IA64_VDSO_H +#include +#include -#define VDSO_TIMEHANDS_MD \ - uint32_t th_res[8]; +#include "pythagoras.h" -#ifdef _KERNEL -#ifdef COMPAT_FREEBSD32 +double +pythagorean_theorem(double a, double b) +{ -#define VDSO_TIMEHANDS_MD32 VDSO_TIMEHANDS_MD - -#endif -#endif -#endif + if (a <= 0 || b <= 0) { + errno = ERANGE; + return (-1.0); + } + return (sqrt(pow(a, 2) + pow(b, 2))); +} diff --git a/sys/boot/ia64/common/autoload.c b/libexec/rtld-elf/tests/libpythagoras/pythagoras.h similarity index 90% rename from sys/boot/ia64/common/autoload.c rename to libexec/rtld-elf/tests/libpythagoras/pythagoras.h index ea334b97e41..ef5379c3f61 100644 --- a/sys/boot/ia64/common/autoload.c +++ b/libexec/rtld-elf/tests/libpythagoras/pythagoras.h @@ -1,11 +1,10 @@ /*- - * Copyright (c) 2006 Marcel Moolenaar + * Copyright 2014 Jonathan Anderson. * 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 @@ -22,14 +21,8 @@ * 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 -__FBSDID("$FreeBSD$"); - -int -ia64_autoload(void) -{ - - return (0); -} +double pythagorean_theorem(double, double); diff --git a/libexec/rtld-elf/tests/target/Makefile b/libexec/rtld-elf/tests/target/Makefile new file mode 100644 index 00000000000..0ae8c1d8b7b --- /dev/null +++ b/libexec/rtld-elf/tests/target/Makefile @@ -0,0 +1,13 @@ +# $FreeBSD$ + +.include + +PROG= target +BINDIR= ${TESTSBASE}${TESTSDIR}/libexec/rtld-elf + +CFLAGS+= -I${.CURDIR}/../libpythagoras +LDADD= -L${.OBJDIR}/../libpythagoras -lpythagoras + +MAN= + +.include diff --git a/lib/libc/ia64/gen/fpgetround.c b/libexec/rtld-elf/tests/target/target.c similarity index 84% rename from lib/libc/ia64/gen/fpgetround.c rename to libexec/rtld-elf/tests/target/target.c index 6f5e8cc86c4..e88b89956ef 100644 --- a/lib/libc/ia64/gen/fpgetround.c +++ b/libexec/rtld-elf/tests/target/target.c @@ -1,11 +1,10 @@ -/* - * Copyright (c) 2003 Marcel Moolenaar +/*- + * Copyright 2014 Jonathan Anderson. * 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 @@ -26,14 +25,15 @@ * $FreeBSD$ */ -#include -#include +#include "pythagoras.h" -fp_rnd_t -fpgetround(void) +#include + +int +main(int argc, char *argv[]) { - uint64_t fpsr; + float hypotenuse = pythagorean_theorem(3, 4); + printf("the hypotenuse of 3 and 4 is %d\n", (int) hypotenuse); - __asm __volatile("mov %0=ar.fpsr" : "=r"(fpsr)); - return ((fp_rnd_t)((fpsr >> 10) & 3)); + return 0; } diff --git a/libexec/save-entropy/save-entropy.sh b/libexec/save-entropy/save-entropy.sh index e96b543a76b..880a988404d 100755 --- a/libexec/save-entropy/save-entropy.sh +++ b/libexec/save-entropy/save-entropy.sh @@ -42,6 +42,8 @@ elif [ -r /etc/rc.conf ]; then . /etc/rc.conf 2>/dev/null fi +[ $(/sbin/sysctl -n security.jail.jailed) = 0 ] || exit 0 + case ${entropy_dir} in [Nn][Oo]) exit 0 diff --git a/libexec/smrsh/Makefile b/libexec/smrsh/Makefile index ae86155d0d0..9f0bfd454ed 100644 --- a/libexec/smrsh/Makefile +++ b/libexec/smrsh/Makefile @@ -9,6 +9,8 @@ SRCS= smrsh.c MAN= smrsh.8 CFLAGS+=-I${SENDMAIL_DIR}/src -I${SENDMAIL_DIR}/include -I. +NO_PIE= yes + LIBSMDIR= ${.OBJDIR}/../../lib/libsm LIBSM= ${LIBSMDIR}/libsm.a diff --git a/libexec/telnetd/Makefile b/libexec/telnetd/Makefile index 99f023f263f..f80bf5c92dc 100644 --- a/libexec/telnetd/Makefile +++ b/libexec/telnetd/Makefile @@ -20,6 +20,8 @@ WFORMAT?= 0 CFLAGS+= -DLINEMODE -DUSE_TERMIO -DDIAGNOSTICS -DOLD_ENVIRON \ -DENV_HACK -DSTREAMSPTY +NO_PIE= yes + .if ${MK_INET6_SUPPORT} != "no" CFLAGS+= -DINET6 .endif @@ -28,11 +30,9 @@ CFLAGS+= -I${TELNETDIR} LIBTELNET= ${.OBJDIR}/../../lib/libtelnet/libtelnet.a -DPADD= ${LIBUTIL} ${LIBTERMCAP} ${LIBTELNET} -LDADD= -lutil -ltermcap ${LIBTELNET} +DPADD= ${LIBUTIL} ${LIBTERMCAPW} ${LIBTELNET} +LDADD= -lutil -ltermcapw ${LIBTELNET} -# XXX for src/release/picobsd -.if !defined(RELEASE_CRUNCH) .if ${MK_OPENSSL} != "no" SRCS+= authenc.c CFLAGS+= -DAUTHENTICATION -DENCRYPTION @@ -45,6 +45,5 @@ CFLAGS+= -DKRB5 -DFORWARD -Dnet_write=telnet_net_write DPADD+= ${LIBKRB5} ${LIBHX509} ${LIBASN1} ${LIBROKEN} ${LIBCOM_ERR} LDADD+= -lkrb5 -lhx509 -lasn1 -lroken -lcom_err .endif -.endif .include diff --git a/libexec/telnetd/Makefile.depend b/libexec/telnetd/Makefile.depend index e2ee38e3ec4..ccb80ea9211 100644 --- a/libexec/telnetd/Makefile.depend +++ b/libexec/telnetd/Makefile.depend @@ -25,7 +25,6 @@ DIRDEPS = \ lib/libtelnet \ lib/libthr \ lib/libutil \ - lib/ncurses/ncurses \ lib/ncurses/ncursesw \ secure/lib/libcrypto \ diff --git a/libexec/ypxfr/ypxfr.8 b/libexec/ypxfr/ypxfr.8 index 281e31a5754..3e0758649f4 100644 --- a/libexec/ypxfr/ypxfr.8 +++ b/libexec/ypxfr/ypxfr.8 @@ -305,4 +305,4 @@ domain. .Xr yppush 8 , .Xr ypserv 8 .Sh AUTHORS -.An Bill Paul Aq wpaul@ctr.columbia.edu +.An Bill Paul Aq Mt wpaul@ctr.columbia.edu diff --git a/pkgs/pseudo/lib/Makefile.depend b/pkgs/pseudo/lib/Makefile.depend index 756ac3d477c..027f820e741 100644 --- a/pkgs/pseudo/lib/Makefile.depend +++ b/pkgs/pseudo/lib/Makefile.depend @@ -33,6 +33,7 @@ DIRDEPS = \ lib/libcompat \ lib/libcompiler_rt \ lib/libcrypt \ + lib/libcuse \ lib/libcxxrt \ lib/libdevinfo \ lib/libdevstat \ diff --git a/pkgs/pseudo/libexec/Makefile.depend b/pkgs/pseudo/libexec/Makefile.depend index cb3866817eb..a7c9ee4e874 100644 --- a/pkgs/pseudo/libexec/Makefile.depend +++ b/pkgs/pseudo/libexec/Makefile.depend @@ -6,6 +6,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ libexec/atf/atf-check \ + libexec/atf/atf-sh \ libexec/atrun \ libexec/bootpd/bootpgw \ libexec/bootpd/tools/bootpef \ diff --git a/pkgs/pseudo/the-lot/Makefile.depend b/pkgs/pseudo/the-lot/Makefile.depend index 0b53ddf9b93..ad51546fd5d 100644 --- a/pkgs/pseudo/the-lot/Makefile.depend +++ b/pkgs/pseudo/the-lot/Makefile.depend @@ -7,7 +7,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ pkgs/pseudo/kernel \ pkgs/pseudo/toolchain \ - pkgs/pseudo/toolchain.host \ pkgs/pseudo/userland \ .include diff --git a/pkgs/pseudo/usr.bin/Makefile.depend b/pkgs/pseudo/usr.bin/Makefile.depend index cdfdc1a5f05..2eef3c06374 100644 --- a/pkgs/pseudo/usr.bin/Makefile.depend +++ b/pkgs/pseudo/usr.bin/Makefile.depend @@ -13,7 +13,6 @@ DIRDEPS = \ usr.bin/atf/atf-config \ usr.bin/atf/atf-report \ usr.bin/atf/atf-run \ - usr.bin/atf/atf-sh \ usr.bin/atf/atf-version \ usr.bin/atm/sscop \ usr.bin/awk \ @@ -202,6 +201,7 @@ DIRDEPS = \ usr.bin/telnet \ usr.bin/tftp \ usr.bin/time \ + usr.bin/timeout \ usr.bin/tip/tip \ usr.bin/top \ usr.bin/touch \ @@ -231,6 +231,7 @@ DIRDEPS = \ usr.bin/vi \ usr.bin/vis \ usr.bin/vmstat \ + usr.bin/vtfontcvt \ usr.bin/w \ usr.bin/wall \ usr.bin/wc \ diff --git a/pkgs/pseudo/usr.sbin/Makefile.depend b/pkgs/pseudo/usr.sbin/Makefile.depend index dc697725481..9887c361092 100644 --- a/pkgs/pseudo/usr.sbin/Makefile.depend +++ b/pkgs/pseudo/usr.sbin/Makefile.depend @@ -54,6 +54,7 @@ DIRDEPS = \ usr.sbin/bsnmpd/modules/snmp_atm \ usr.sbin/bsnmpd/modules/snmp_bridge \ usr.sbin/bsnmpd/modules/snmp_hostres \ + usr.sbin/bsnmpd/modules/snmp_lm75 \ usr.sbin/bsnmpd/modules/snmp_mibII \ usr.sbin/bsnmpd/modules/snmp_pf \ usr.sbin/bsnmpd/modules/snmp_target \ diff --git a/release/Makefile b/release/Makefile index 92075f8365a..6b4517dc437 100644 --- a/release/Makefile +++ b/release/Makefile @@ -100,6 +100,9 @@ CLEANFILES= packagesystem *.txz MANIFEST system ${IMAGES} CLEANFILES+= ${I}.xz . endfor .endif +.if defined(WITH_DVD) && !empty(WITH_DVD) +CLEANFILES+= pkg-stage +.endif CLEANDIRS= dist ftp release bootonly dvd beforeclean: chflags -R noschg . @@ -151,11 +154,14 @@ system: packagesystem # Install system mkdir -p release cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ - DESTDIR=${.OBJDIR}/release WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1 \ - WITHOUT_PROFILE=1 WITHOUT_SENDMAIL=1 WITHOUT_ATF=1 WITHOUT_LIB32=1 + DESTDIR=${.OBJDIR}/release MK_RESCUE=no MK_KERNEL_SYMBOLS=no \ + MK_PROFILE=no MK_SENDMAIL=no MK_TESTS=no MK_LIB32=no \ + MK_DEBUG_FILES=no # Copy distfiles mkdir -p release/usr/freebsd-dist - cp *.txz MANIFEST release/usr/freebsd-dist + for dist in MANIFEST $$(ls *.txz | grep -v -- '-dbg'); \ + do cp $${dist} release/usr/freebsd-dist; \ + done # Copy documentation, if generated .if !defined(NODOC) cp reldoc/* release @@ -172,12 +178,12 @@ bootonly: packagesystem # Install system mkdir -p bootonly cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ - DESTDIR=${.OBJDIR}/bootonly WITHOUT_AMD=1 WITHOUT_AT=1 \ - WITHOUT_GAMES=1 WITHOUT_GROFF=1 \ - WITHOUT_INSTALLLIB=1 WITHOUT_LIB32=1 WITHOUT_MAIL=1 \ - WITHOUT_NCP=1 WITHOUT_TOOLCHAIN=1 WITHOUT_PROFILE=1 \ - WITHOUT_INSTALLIB=1 WITHOUT_RESCUE=1 WITHOUT_DICT=1 \ - WITHOUT_KERNEL_SYMBOLS=1 + DESTDIR=${.OBJDIR}/bootonly MK_AMD=no MK_AT=no \ + MK_GAMES=no MK_GROFF=no \ + MK_INSTALLLIB=no MK_LIB32=no MK_MAIL=no \ + MK_NCP=no MK_TOOLCHAIN=no MK_PROFILE=no \ + MK_INSTALLIB=no MK_RESCUE=no MK_DICT=no \ + MK_KERNEL_SYMBOLS=no MK_TESTS=no MK_DEBUG_FILES=no # Copy manifest only (no distfiles) to get checksums mkdir -p bootonly/usr/freebsd-dist cp MANIFEST bootonly/usr/freebsd-dist @@ -196,10 +202,13 @@ dvd: # Install system mkdir -p ${.TARGET} cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ - DESTDIR=${.OBJDIR}/${.TARGET} WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1 + DESTDIR=${.OBJDIR}/${.TARGET} MK_RESCUE=no MK_KERNEL_SYMBOLS=no \ + MK_TESTS=no MK_DEBUG_FILES=no # Copy distfiles mkdir -p ${.TARGET}/usr/freebsd-dist - cp *.txz MANIFEST ${.TARGET}/usr/freebsd-dist + for dist in MANIFEST $$(ls *.txz | grep -v -- '-dbg'); \ + do cp $${dist} ${.TARGET}/usr/freebsd-dist; \ + done # Copy documentation, if generated .if !defined(NODOC) cp reldoc/* ${.TARGET} diff --git a/release/amd64/make-memstick.sh b/release/amd64/make-memstick.sh index e10b892eeb2..6c289e093b8 100755 --- a/release/amd64/make-memstick.sh +++ b/release/amd64/make-memstick.sh @@ -29,20 +29,13 @@ if [ -e ${2} ]; then fi echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab -makefs -B little -o label=FreeBSD_Install ${2} ${1} +makefs -B little -o label=FreeBSD_Install ${2}.part ${1} if [ $? -ne 0 ]; then echo "makefs failed" exit 1 fi rm ${1}/etc/fstab -unit=$(mdconfig -a -t vnode -f ${2}) -if [ $? -ne 0 ]; then - echo "mdconfig failed" - exit 1 -fi -gpart create -s BSD ${unit} -gpart bootcode -b ${1}/boot/boot ${unit} -gpart add -t freebsd-ufs ${unit} -mdconfig -d -u ${unit} +mkimg -s gpt -b ${1}/boot/pmbr -p efi:=${1}/boot/boot1.efifat -p freebsd-boot:=${1}/boot/gptboot -p freebsd-ufs:=${2}.part -p freebsd-swap::1M -o ${2} +rm ${2}.part diff --git a/release/amd64/make-uefi-memstick.sh b/release/amd64/make-uefi-memstick.sh deleted file mode 100755 index 6c289e093b8..00000000000 --- a/release/amd64/make-uefi-memstick.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -# -# This script generates a "memstick image" (image that can be copied to a -# USB memory stick) from a directory tree. Note that the script does not -# clean up after itself very well for error conditions on purpose so the -# problem can be diagnosed (full filesystem most likely but ...). -# -# Usage: make-memstick.sh -# -# $FreeBSD$ -# - -PATH=/bin:/usr/bin:/sbin:/usr/sbin -export PATH - -if [ $# -ne 2 ]; then - echo "make-memstick.sh /path/to/directory /path/to/image/file" - exit 1 -fi - -if [ ! -d ${1} ]; then - echo "${1} must be a directory" - exit 1 -fi - -if [ -e ${2} ]; then - echo "won't overwrite ${2}" - exit 1 -fi - -echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab -makefs -B little -o label=FreeBSD_Install ${2}.part ${1} -if [ $? -ne 0 ]; then - echo "makefs failed" - exit 1 -fi -rm ${1}/etc/fstab - -mkimg -s gpt -b ${1}/boot/pmbr -p efi:=${1}/boot/boot1.efifat -p freebsd-boot:=${1}/boot/gptboot -p freebsd-ufs:=${2}.part -p freebsd-swap::1M -o ${2} -rm ${2}.part - diff --git a/release/amd64/mkisoimages-uefi.sh b/release/amd64/mkisoimages-uefi.sh deleted file mode 100644 index 2b89d89cda2..00000000000 --- a/release/amd64/mkisoimages-uefi.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh -# -# Module: mkisoimages.sh -# Author: Jordan K Hubbard -# Date: 22 June 2001 -# -# $FreeBSD$ -# -# This script is used by release/Makefile to build the (optional) ISO images -# for a FreeBSD release. It is considered architecture dependent since each -# platform has a slightly unique way of making bootable CDs. This script -# is also allowed to generate any number of images since that is more of -# publishing decision than anything else. -# -# Usage: -# -# mkisoimages.sh [-b] image-label image-name base-bits-dir [extra-bits-dir] -# -# Where -b is passed if the ISO image should be made "bootable" by -# whatever standards this architecture supports (may be unsupported), -# image-label is the ISO image label, image-name is the filename of the -# resulting ISO image, base-bits-dir contains the image contents and -# extra-bits-dir, if provided, contains additional files to be merged -# into base-bits-dir as part of making the image. - -if [ "x$1" = "x-b" ]; then - # This is highly x86-centric and will be used directly below. - bootable="-o bootimage=i386;$4/boot/cdboot -o no-emul-boot" - - # Make EFI system partition (should be done with makefs in the future) - dd if=/dev/zero of=efiboot.img bs=4k count=100 - device=`mdconfig -a -t vnode -f efiboot.img` - newfs_msdos -F 12 -m 0xf8 /dev/$device - mkdir efi - mount -t msdosfs /dev/$device efi - mkdir -p efi/efi/boot - cp ${4}/boot/loader.efi efi/efi/boot/bootx64.efi - umount efi - rmdir efi - mdconfig -d -u $device - bootable="-o bootimage=i386;efiboot.img -o no-emul-boot $bootable" - - shift -else - bootable="" -fi - -if [ $# -lt 3 ]; then - echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]' - exit 1 -fi - -LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift -NAME=$1; shift - -publisher="The FreeBSD Project. http://www.FreeBSD.org/" -echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab -makefs -t cd9660 $bootable -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $* -rm $1/etc/fstab -rm -f efiboot.img diff --git a/release/amd64/mkisoimages.sh b/release/amd64/mkisoimages.sh index e4093d74e4c..2b89d89cda2 100644 --- a/release/amd64/mkisoimages.sh +++ b/release/amd64/mkisoimages.sh @@ -26,6 +26,20 @@ if [ "x$1" = "x-b" ]; then # This is highly x86-centric and will be used directly below. bootable="-o bootimage=i386;$4/boot/cdboot -o no-emul-boot" + + # Make EFI system partition (should be done with makefs in the future) + dd if=/dev/zero of=efiboot.img bs=4k count=100 + device=`mdconfig -a -t vnode -f efiboot.img` + newfs_msdos -F 12 -m 0xf8 /dev/$device + mkdir efi + mount -t msdosfs /dev/$device efi + mkdir -p efi/efi/boot + cp ${4}/boot/loader.efi efi/efi/boot/bootx64.efi + umount efi + rmdir efi + mdconfig -d -u $device + bootable="-o bootimage=i386;efiboot.img -o no-emul-boot $bootable" + shift else bootable="" @@ -43,3 +57,4 @@ publisher="The FreeBSD Project. http://www.FreeBSD.org/" echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab makefs -t cd9660 $bootable -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $* rm $1/etc/fstab +rm -f efiboot.img diff --git a/release/arm/release.sh b/release/arm/release.sh index c2b2a1b3075..479b8e53d04 100755 --- a/release/arm/release.sh +++ b/release/arm/release.sh @@ -94,7 +94,7 @@ install_uboot() { main() { # Build the 'xdev' target for crochet. eval chroot ${CHROOTDIR} make -C /usr/src \ - ${XDEV_FLAGS} XDEV=${XDEV} XDEV_ARCH=${XDEV_ARCH} \ + ${XDEV_FLAGS} TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \ ${WORLD_FLAGS} xdev # Run the ldconfig(8) startup script so /var/run/ld-elf*.so.hints @@ -111,6 +111,9 @@ main() { BATCH=1 FORCE_PKG_REGISTER=1 install clean distclean done + 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 diff --git a/release/doc/README b/release/doc/README index 93cc12b4015..a46779d78f1 100644 --- a/release/doc/README +++ b/release/doc/README @@ -99,10 +99,10 @@ element will be included. For example: SPARC64-specific text -The currently-supported architectures are amd64, arm, i386, ia64, -pc98, powerpc, and sparc64. An element may appear for multiple -architectures by specifying a comma-separated list of architectures -(i.e. arch="sparc64,ia64"). +The currently-supported architectures are amd64, arm, i386, pc98, +powerpc and sparc64. An element may appear for multiple architectures +by specifying a comma-separated list of architectures +(i.e. arch="sparc64,amd64"). When creating a translation, make a new directory under this directory with a language code (paralleling the DocProj directory diff --git a/release/doc/en_US.ISO8859-1/hardware/article.xml b/release/doc/en_US.ISO8859-1/hardware/article.xml index 6255d97ad5e..8919eefd7de 100644 --- a/release/doc/en_US.ISO8859-1/hardware/article.xml +++ b/release/doc/en_US.ISO8859-1/hardware/article.xml @@ -129,10 +129,10 @@ &intel; EM64T is an extended version of IA-32 (x86) and - different from &intel; IA-64 (Itanium) architecture, which - &os;/ia64 supports. Some &intel;'s old documentation refers - to &intel; EM64T as 64-bit extension technology - or IA-32e. + different from &intel; IA-64 (Itanium) architecture. Some + &intel;'s old documentation refers to &intel; EM64T as + 64-bit extension technology or + IA-32e. Both Uniprocessor (UP) and Symmetric Multi-processor (SMP) configurations are supported. @@ -232,41 +232,6 @@ more information. - - ia64 - - Currently supported processors are the &itanium; - and the &itanium; - 2. - - Supported chipsets include: - - - - HP zx1 - - - - &intel; 460GX - - - - &intel; E8870 - - - - Both Uniprocessor (UP) and Symmetric Multi-processor (SMP) - configurations are supported. - - Most devices that can be found in or are compatible with - &arch.ia64; machines are fully supported. The notable - exception is the VGA console. The &os; support for VGA - consoles is at this time too much based on PC hardware and not - all &arch.ia64; machines have chipsets that provide sufficient - PC legacy support. As such &man.syscons.4; can not be enabled - and the use of a serial console is required. - - pc98 @@ -651,9 +616,8 @@ Disk Controllers - [&arch.amd64;, &arch.i386;, &arch.ia64;, &arch.pc98;, - &arch.sparc64;] IDE/ATA controllers (&man.ata.4; - driver) + [&arch.amd64;, &arch.i386;, &arch.pc98;, &arch.sparc64;] + IDE/ATA controllers (&man.ata.4; driver) [&arch.pc98;] IDE/ATA controllers (wdc driver) @@ -944,6 +908,8 @@ &hwlist.vr; + &hwlist.vte; + &hwlist.vx; &hwlist.vxge; @@ -1122,8 +1088,8 @@ [&arch.i386;] DigiBoard intelligent serial cards (digi driver) - [&arch.amd64;, &arch.i386;, &arch.ia64;] PCI-Based - multi-port serial boards (&man.puc.4; driver) + [&arch.amd64;, &arch.i386;] PCI-Based multi-port serial + boards (&man.puc.4; driver) @@ -1144,10 +1110,6 @@ 4-port serial and dual port RS232/422/485 - - [&arch.ia64;] Diva Serial (GSP) Multiport UART - - [&arch.amd64;, &arch.i386;] Dolphin Peripherals 4025/4035/4036 @@ -1426,7 +1388,7 @@ USB Devices - [&arch.amd64;, &arch.i386;, &arch.ia64;, &arch.pc98;] A + [&arch.amd64;, &arch.i386;, &arch.pc98;] A range of USB peripherals are supported; devices known to work are listed in this section. Owing to the generic nature of most USB devices, with some exceptions any device of a given @@ -1434,14 +1396,14 @@ here. - [&arch.amd64;, &arch.i386;, &arch.ia64;, &arch.pc98;] + [&arch.amd64;, &arch.i386;, &arch.pc98;] USB Ethernet adapters can be found in the section listing Ethernet interfaces. - [&arch.amd64;, &arch.i386;, &arch.ia64;, &arch.pc98;] + [&arch.amd64;, &arch.i386;, &arch.pc98;] USB Bluetooth adapters can be found in Bluetooth section. @@ -1449,14 +1411,14 @@ &hwlist.uhci; - [&arch.amd64;, &arch.i386;, &arch.ia64;, &arch.pc98;] USB + [&arch.amd64;, &arch.i386;, &arch.pc98;] USB 2.0 controllers using the EHCI interface (&man.ehci.4; driver) - [&arch.amd64;, &arch.i386;, &arch.ia64;, &arch.pc98;] + [&arch.amd64;, &arch.i386;, &arch.pc98;] Hubs - [&arch.amd64;, &arch.i386;, &arch.ia64;, &arch.pc98;] + [&arch.amd64;, &arch.i386;, &arch.pc98;] Keyboards (&man.ukbd.4; driver) [&arch.amd64;, &arch.i386;, &arch.pc98;] @@ -1488,7 +1450,7 @@ &hwlist.umodem; - [&arch.amd64;, &arch.i386;, &arch.ia64;, &arch.pc98;] Mice + [&arch.amd64;, &arch.i386;, &arch.pc98;] Mice (&man.ums.4; driver) &hwlist.ulpt; @@ -1567,7 +1529,7 @@ found at http://www.x.org/. - [&arch.amd64;, &arch.i386;, &arch.ia64;, &arch.pc98;] + [&arch.amd64;, &arch.i386;, &arch.pc98;] Keyboards including: @@ -1586,12 +1548,12 @@ - [&arch.amd64;, &arch.i386;, &arch.ia64;, &arch.pc98;] + [&arch.amd64;, &arch.i386;, &arch.pc98;] USB keyboards (&man.ukbd.4; driver) - [&arch.amd64;, &arch.i386;, &arch.ia64;, &arch.pc98;] + [&arch.amd64;, &arch.i386;, &arch.pc98;] Pointing devices including: @@ -1611,7 +1573,7 @@ - [&arch.amd64;, &arch.i386;, &arch.ia64;, &arch.pc98;] + [&arch.amd64;, &arch.i386;, &arch.pc98;] USB mice (&man.ums.4; driver) diff --git a/release/doc/en_US.ISO8859-1/readme/article.xml b/release/doc/en_US.ISO8859-1/readme/article.xml index 73c6e46cf5d..bfd6aef9447 100644 --- a/release/doc/en_US.ISO8859-1/readme/article.xml +++ b/release/doc/en_US.ISO8859-1/readme/article.xml @@ -35,6 +35,7 @@ 2011 2012 2013 + 2014 The &os; Documentation Project @@ -67,7 +68,6 @@ &os; is an operating system based on 4.4 BSD Lite for AMD64 and Intel EM64T based PC hardware (&arch.amd64;), Intel, AMD, Cyrix or NexGen x86 based PC hardware (&arch.i386;), - Intel Itanium Processor based computers (&arch.ia64;), NEC PC-9801/9821 series PCs and compatibles (&arch.pc98;), and &ultrasparc; machines (&arch.sparc64;). Versions for the &arm; (&arch.arm;), &mips; (&arch.mips;), and @@ -325,7 +325,7 @@ On platforms that support &man.bsdinstall.8; (currently - &arch.amd64;, &arch.i386;, &arch.ia64;, &arch.pc98;, and &arch.sparc64;), these documents are generally available via the + &arch.amd64;, &arch.i386;, &arch.pc98;, and &arch.sparc64;), these documents are generally available via the Documentation menu during installation. Once the system is installed, you can revisit this menu by re-running the &man.bsdinstall.8; utility. diff --git a/release/doc/en_US.ISO8859-1/relnotes/article.xml b/release/doc/en_US.ISO8859-1/relnotes/article.xml index b987fed58af..1a8d36fb02e 100644 --- a/release/doc/en_US.ISO8859-1/relnotes/article.xml +++ b/release/doc/en_US.ISO8859-1/relnotes/article.xml @@ -108,10 +108,6 @@ Kernel Changes - The VT kernel - configuration file has been added, which enables the new - vt console driver. - Support for GPS ports has been added to &man.uhso.4;. @@ -155,6 +151,28 @@ &man.mrsas.4;. + A kernel bug that inhibited proper + functionality of the dev.cpu.0.freq + &man.sysctl.8; on &intel; processors with Turbo + Boost ™ enabled has been fixed. + + The IMAGACT_BINMISC + kernel configuration option has been enabled by default, + which enables application execution through emulators, such + as Qemu. + + Support for the &man.cxgbe.4; Terminator 5 + (T5) 10G/40G cards has been added to &man.netmap.4;. + + The VT kernel + configuration file has been removed, and the &man.vt.4; + driver is included in the GENERIC kernel. + To enable &man.vt.4;, enter set kern.vty=vt + at the &man.loader.8; prompt during boot, or add + kern.vty=vt to &man.loader.conf.5; and + reboot the system. + Virtualization support @@ -182,6 +200,15 @@ The &man.virtio_random.4; driver has been added to harvest entropy from the host system. + + Support for running a &os;/&arch.amd64; + Xen guest instance as + PVH guest has been added. + PVH mode, short for Para-Virtualized + Hardware, uses para-virtualized drivers for boot + and I/O, and uses hardware virtualization extensions for all + other tasks, without the need for emulation. @@ -200,6 +227,12 @@ Hardware Support + The &man.asmc.4; driver has been updated + to support the &apple; MacMini 3,1. + + Support for &os;/ia64 has been dropped + as of &os; 11. + Multimedia Support @@ -229,6 +262,10 @@ The &man.ath.hal.4; driver has been updated to support the Atheros AR1111 chipset. + + Support for the &intel; + Centrino™ Wireless-N 105 chipset has been + added. @@ -243,7 +280,9 @@ Disks and Storage -   + Support for the + disklabel64 partitioning scheme has been + added to &man.gpart.8;. @@ -306,6 +345,26 @@ to filter by &man.jail.8; ID or name, in followup to the &man.ps.1; change in r265229. + The Blowfish &man.crypt.3; default format + has been changed to + $2b$. + + The &man.pmcstat.8; utility has been + updated to include a new flag, -l, which + ends event collection after the specified number of + seconds. + + The default &man.newsyslog.conf.5; now + includes files in the + /etc/newsyslog.conf.d/ and + /usr/local/etc/newsyslog.conf.d/ + directories by default for &man.newsyslog.8;. + + The &man.readline.3; library is now + statically linked in software within the base system, and the + shared library is no longer installed, allowing the Ports + Collection to use a modern version of the library. + <filename>/etc/rc.d</filename> Scripts @@ -332,9 +391,6 @@ &man.jemalloc.3; has been updated to version 3.5.0. - Sendmail - has been updated from 8.14.7 to 8.14.8. - bmake has been updated to version 20140101. @@ -350,6 +406,12 @@ LLVM and Clang have been updated to version 3.4. + + Sendmail + has been updated from 8.14.7 to 8.14.9. + + OpenSSL has + been updated to version 1.0.1h. diff --git a/release/doc/share/examples/Makefile.relnotesng b/release/doc/share/examples/Makefile.relnotesng index 4f97ee5a1b7..9607e283a07 100644 --- a/release/doc/share/examples/Makefile.relnotesng +++ b/release/doc/share/examples/Makefile.relnotesng @@ -6,7 +6,7 @@ # the build tree. # -ARCHS= amd64 ia64 i386 pc98 powerpc sparc64 +ARCHS= amd64 i386 pc98 powerpc sparc64 MULTITEXTS= UNITEXTS= hardware readme relnotes errata diff --git a/release/doc/share/misc/dev.archlist.txt b/release/doc/share/misc/dev.archlist.txt index ad7a6afa4ba..6872ec0c007 100644 --- a/release/doc/share/misc/dev.archlist.txt +++ b/release/doc/share/misc/dev.archlist.txt @@ -35,43 +35,43 @@ # Empty lines, and lines beginning with "#" are ignored. # [,...] # -aac i386,ia64,amd64 +aac i386,amd64 adv i386,pc98,amd64 adw i386,pc98,amd64 aha i386 ahb i386 -ahd i386,sparc64,ia64,amd64 +ahd i386,sparc64,amd64 aic i386,pc98,amd64 amd i386,pc98,amd64 arcmsr i386,amd64 asr i386 ath i386,pc98,amd64,sparc64 -aue i386,pc98,ia64,amd64,powerpc +aue i386,pc98,amd64,powerpc axe i386,pc98,amd64,powerpc bce i386,amd64 -bge i386,pc98,sparc64,ia64,amd64 +bge i386,pc98,sparc64,amd64 bktr i386,pc98 bt i386,amd64 bxe i386,amd64 -cdce i386,pc98,ia64,amd64,powerpc -ciss i386,ia64,amd64 +cdce i386,pc98,amd64,powerpc +ciss i386,amd64 ce i386,pc98 cm i386 cnw i386,pc98,amd64 cp i386,pc98 ct pc98 ctau i386 -cue i386,pc98,ia64,amd64,powerpc +cue i386,pc98,amd64,powerpc cx i386 cxgb i386,amd64 -de i386,pc98,ia64,amd64 -dpt i386,ia64,amd64 +de i386,pc98,amd64 +dpt i386,amd64 ed i386,pc98 ep i386,pc98,amd64 esp sparc64 ex i386,amd64 fe i386,pc98,amd64 -fwohci i386,sparc64,ia64,amd64,powerpc +fwohci i386,sparc64,amd64,powerpc hifn i386,pc98,amd64 hpt27xx i386,amd64 hptiop i386,amd64 @@ -79,15 +79,15 @@ hptmv i386,amd64 hptrr i386,amd64 ida i386 ie i386 -iir i386,ia64,amd64 +iir i386,amd64 ips i386,amd64 isci i386,amd64 ixgb i386,amd64 -kue i386,pc98,ia64,amd64,powerpc +kue i386,pc98,amd64,powerpc lge i386,pc98,amd64 -mfi i386,ia64,amd64 -mlx i386,ia64,amd64 -mly i386,ia64,amd64 +mfi i386,amd64 +mlx i386,amd64 +mly i386,amd64 msk i386,amd64 mxge i386,amd64 my i386,pc98 @@ -99,9 +99,9 @@ ng_ubt i386,pc98,amd64 nsp i386,pc98 nxge i386,amd64 oce i386,amd64 -ohci i386,pc98,ia64,amd64,powerpc +ohci i386,pc98,amd64,powerpc oltr i386 -pcn i386,pc98,ia64,amd64 +pcn i386,pc98,amd64 pst i386 qlxgb amd64 qlxgbe amd64 @@ -113,7 +113,7 @@ rue i386,pc98,amd64 rum i386,amd64 run i386,amd64 safe i386,pc98,amd64 -sbp i386,sparc64,ia64,amd64 +sbp i386,sparc64,amd64 sfgxe amd64 sn i386,amd64 snc pc98 @@ -160,7 +160,7 @@ ubser i386,pc98,amd64 ucycom i386,pc98,amd64 udav i386,pc98,amd64 uftdi i386,pc98,amd64 -uhci i386,pc98,ia64,amd64,powerpc +uhci i386,pc98,amd64,powerpc ulpt i386,pc98,amd64,powerpc umass i386,pc98,amd64,powerpc umodem i386,pc98,amd64 @@ -170,7 +170,7 @@ urio i386,pc98,amd64,powerpc uvisor i386,pc98,amd64 uvscom i386,pc98,amd64 vpo i386 -vx i386,pc98,ia64,amd64 +vx i386,pc98,amd64 vxge i386,amd64 wb i386,pc98,amd64 xe i386,amd64 diff --git a/release/doc/share/xml/release.ent b/release/doc/share/xml/release.ent index 2c36985d023..bdd58b70bd6 100644 --- a/release/doc/share/xml/release.ent +++ b/release/doc/share/xml/release.ent @@ -65,7 +65,6 @@ - diff --git a/release/doc/share/xml/sponsor.ent b/release/doc/share/xml/sponsor.ent index 6e01090d343..6e35b8e4868 100644 --- a/release/doc/share/xml/sponsor.ent +++ b/release/doc/share/xml/sponsor.ent @@ -10,13 +10,18 @@ + + + + + - + diff --git a/release/ia64/make-memstick.sh b/release/ia64/make-memstick.sh deleted file mode 100755 index c9ff580d2f8..00000000000 --- a/release/ia64/make-memstick.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# -# This script generates a "memstick image" (image that can be copied to a -# USB memory stick) from a directory tree. Note that the script does not -# clean up after itself very well for error conditions on purpose so the -# problem can be diagnosed (full filesystem most likely but ...). -# -# Usage: make-memstick.sh -# -# $FreeBSD$ -# - -PATH=/bin:/usr/bin:/sbin:/usr/sbin -export PATH - -BLOCKSIZE=10240 - -if [ $# -ne 2 ]; then - echo "make-memstick.sh /path/to/directory /path/to/image/file" - exit 1 -fi - -if [ ! -d ${1} ]; then - echo "${1} must be a directory" - exit 1 -fi - -if [ -e ${2} ]; then - echo "won't overwrite ${2}" - exit 1 -fi - -makefs -B little ${2} ${1} -if [ $? -ne 0 ]; then - echo "makefs failed" - exit 1 -fi - diff --git a/release/ia64/mkisoimages.sh b/release/ia64/mkisoimages.sh deleted file mode 100644 index 20b01539235..00000000000 --- a/release/ia64/mkisoimages.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/sh -# -# Module: mkisoimages.sh -# Author: Jordan K Hubbard -# Date: 22 June 2001 -# -# $FreeBSD$ -# -# This script is used by release/Makefile to build the (optional) ISO images -# for a FreeBSD release. It is considered architecture dependent since each -# platform has a slightly unique way of making bootable CDs. This script -# is also allowed to generate any number of images since that is more of -# publishing decision than anything else. -# -# Usage: -# -# mkisoimages.sh [-b] image-label image-name base-bits-dir [extra-bits-dir] -# -# Where -b is passed if the ISO image should be made "bootable" by -# whatever standards this architecture supports (may be unsupported), -# image-label is the ISO image label, image-name is the filename of the -# resulting ISO image, base-bits-dir contains the image contents and -# extra-bits-dir, if provided, contains additional files to be merged -# into base-bits-dir as part of making the image. - -set -e - -if [ "x$1" = "x-b" ]; then - bootable=yes - shift -else - bootable=no -fi - -if [ $# -lt 3 ]; then - echo usage: $0 '[-b] label iso-name base-dir [extra-dir]' - exit 1 -fi - -LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift -NAME=$1; shift -BASE=$1; shift - -EFIPART=efipart.sys - -# To create a bootable CD under EFI, the boot image should be an EFI -# system partition. -if [ $bootable = yes ]; then - EFISZ=65536 - MNT=/mnt - dd if=/dev/zero of=$EFIPART count=$EFISZ - md=`mdconfig -a -t vnode -f $EFIPART` - newfs_msdos -F 12 -S 512 -h 4 -o 0 -s $EFISZ -u 16 $md - mount -t msdosfs /dev/$md $MNT - mkdir -p $MNT/efi/boot $MNT/boot $MNT/boot/kernel - cp -R $BASE/boot/defaults $MNT/boot - cp $BASE/boot/kernel/kernel $MNT/boot/kernel - if [ -s $BASE/boot/kernel/ispfw.ko ]; then - cp $BASE/boot/kernel/ispfw.ko $MNT/boot/kernel - fi - cp $BASE/boot/device.hints $MNT/boot - cp $BASE/boot/loader.* $MNT/boot - if [ -s $BASE/boot/mfsroot.gz ]; then - cp $BASE/boot/mfsroot.gz $MNT/boot - fi - cp $BASE/boot/color.4th $MNT/boot - cp $BASE/boot/support.4th $MNT/boot - cp $BASE/boot/check-password.4th $MNT/boot - cp $BASE/boot/screen.4th $MNT/boot - mv $MNT/boot/loader.efi $MNT/efi/boot/bootia64.efi - echo kern.cam.boot_delay=\"3000\" >> $MNT/boot/loader.conf - echo vfs.root.mountfrom=\"cd9660:iso9660/$LABEL\" >> $MNT/boot/loader.conf - umount $MNT - mdconfig -d -u $md - BOOTOPTS="-o bootimage=i386;$EFIPART -o no-emul-boot" -else - BOOTOPTS="" -fi - -publisher="The FreeBSD Project. http://www.FreeBSD.org/" -echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $BASE/etc/fstab -makefs -t cd9660 $BOOTOPTS -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $BASE $* -rm $BASE/etc/fstab -rm -f $EFIPART -exit 0 diff --git a/release/picobsd/bridge/crunch.conf b/release/picobsd/bridge/crunch.conf index c525ee12085..fce2897306b 100644 --- a/release/picobsd/bridge/crunch.conf +++ b/release/picobsd/bridge/crunch.conf @@ -31,6 +31,7 @@ buildopts -DWITHOUT_PAM -DRELEASE_CRUNCH -DPPP_NO_NETGRAPH buildopts -DTRACEROUTE_NO_IPSEC -DNO_INET6 +buildopts -DWITHOUT_KERBEROS -DWITHOUT_OPENSSL # Directories where to look for sources of various binaries. # @__CWD__@ is a magic keyword in the picobsd's (Makefile.conf) diff --git a/release/picobsd/build/picobsd b/release/picobsd/build/picobsd index 7d4813e096d..19a98394927 100755 --- a/release/picobsd/build/picobsd +++ b/release/picobsd/build/picobsd @@ -164,13 +164,11 @@ set_defaults() { # no arguments create_includes_and_libraries2() { # opt_dir opt_target local no log "create_includes_and_libraries2() for ${SRC} $1" - if [ ${OSVERSION} -ge 600000 ] ; then - no="-DNO_CLEAN -DNO_PROFILE -DNO_GAMES -DNO_LIBC_R" # WITHOUT_CDDL=1" - no="$no -DWITHOUT_CASPER" - no="$no -DMALLOC_PRODUCTION" - else - no="-DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R" - fi + + no="-DNO_CLEAN -DNO_PROFILE -DNO_GAMES -DNO_LIBC_R" # WITHOUT_CDDL=1" + no="$no -DWITHOUT_CASPER" + no="$no -DMALLOC_PRODUCTION" + ( cd ${SRC}; # make -DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R -DPICOBSD buildworld if [ -d "$1" ] ; then @@ -178,6 +176,7 @@ create_includes_and_libraries2() { # opt_dir opt_target else export MAKEOBJDIRPREFIX=${l_objtree} make ${o_par} $no toolchain + # XXX do we need any of these ? eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV` [ ${o_arch} != `uname -m` ] && \ @@ -186,48 +185,6 @@ create_includes_and_libraries2() { # opt_dir opt_target ) } -# entry for 4.x and earlier trees -create_includes_and_libraries() { - local e i - - log "create_includes_and_libraries() for ${SRC}" - # Optionally creates include directory and libraries. - mkdir -p ${l_usrtree}/include # the include directory... - mkdir -p ${l_usrtree}/share/misc # a few things go here - mkdir -p ${l_usrtree}/lib # libraries - mkdir -p ${l_usrtree}/sbin # some binaries - # override variables for ownershiip and destinations - # BINOWN:BINGRP are also used for include files - (cd ${SRC}; \ - BINOWN=`id -un` BINGRP=`id -gn` \ - DESTDIR=${l_usrtree}/.. \ - make -m ${SRC}/share/mk includes ) || fail $? includes - # Pick up the correct headers for libraries. - CFLAGS="-nostdinc -I${l_usrtree}/include" ; export CFLAGS - - (cd ${SRC} - # $e is the invocation of make with correct environment - # XXX check the NO* options below, maybe system dependent. - e="MAKEOBJDIRPREFIX=${l_objtree}/picobsd/libraries \ - BINOWN=`id -un` BINGRP=`id -gn` \ - DESTDIR=${l_usrtree}/.. \ - make -m ${SRC}/share/mk \ - -DNOHTML -DNOINFO -DNOMAN -DNOSHARE -DNOFSCHG " - log "do a 'make obj' in a few places." - # This is very version-specific... The following works for 5.0 - for i in lib secure/lib gnu/lib \ - gnu/usr.bin/perl usr.bin/lex usr.sbin/config ; do - (cd ${i}; eval $e obj) - done - log "now make the static libraries" - eval $e -DNOPROFILE -DNOPIC libraries - (cd ${SRC}/usr.sbin/config - eval $e # build binary - eval $e install # install it - ) - ) || fail $? "libraries" - log "Libraries done" -} # set_type [the_site] looks in user or system directories # for the directory named as the first argument, reads the configuration @@ -964,11 +921,11 @@ fill_floppy_image() { dd of=${BUILDDIR}/${c_img} oseek=1 obs=788 conv=notrunc 2>/dev/null log "done disk image" # XXX (log "Fixing permissions"; cd ${dst}; chown -R root *) + df -ik ${dst} | colrm 70 > .build.reply # leave build stuff if verbose [ ${o_verbose} -gt 0 ] && return rm -rf ${BUILDDIR}/floppy.tree || true # cleanup - # df -ik ${dst} | colrm 70 > .build.reply rm -rf ${dst} rm ${BUILDDIR}/${c_fs} # rm ${BUILDDIR}/kernel.gz @@ -991,12 +948,14 @@ set_build_parameters() { set `grep "#define[\t ]__FreeBSD_version" ${SRC}/sys/sys/param.h` OSVERSION=$3 log "OSVERSION is ${OSVERSION}" - if [ ${OSVERSION} -ge 500035 ] ; then + export MAKEOBJDIRPREFIX=${l_objtree} export TARGET_ARCH=${o_arch} TARGET=${o_arch} # XXX 20131001 see if CLANG fixes the build export WITHOUT_CLANG_IS_CC=yes + export WITHOUT_CLANG_BOOTSTRAP=yes export WITH_GCC=yes + export WITH_GCC_BOOTSTRAP=yes export WITH_GNUCXX=yes export WITHOUT_CLANG=yes export WITHOUT_ICONV=yes @@ -1008,26 +967,12 @@ set_build_parameters() { eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V BINMAKE`\"" [ "$BINMAKE" = "" ] && \ eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V SUB_MAKE`\"" - fi if [ "${o_init_src}" != "" ] ; then - if [ ${OSVERSION} -lt 500035 ] ; then - create_includes_and_libraries - else - create_includes_and_libraries2 - fi + create_includes_and_libraries2 else eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV` fi - if [ ${OSVERSION} -lt 500035 ] ; then - # Create the right LIBS and CFLAGS for further builds. - # and build the config program - LIBS="-L${l_usrtree}/lib" - CFLAGS="-nostdinc -I${l_usrtree}/include" - export LIBS CFLAGS - CONFIG=${l_usrtree}/sbin/config - export CONFIG - fi # if we have o_objdir, find where bin/ is if [ ! -z "${o_objdir}" ] ; then @@ -1047,14 +992,18 @@ set_build_parameters() { # Main entry of the script. Initialize variables, parse command line # arguments. -# o_par="-j 8" # parallel make and other make options set_defaults while [ true ]; do log "Parsing $1" case $1 in + -j) + o_par="-j $2" + shift + ;; + --par) - o_par="-j 8" + o_par="-j 8" # watch out, this might be too large ;; --src) # set the source path instead of /usr/src diff --git a/release/picobsd/floppy.tree/etc/ttys b/release/picobsd/floppy.tree/etc/ttys index 09f42fb2ef8..1daea68d131 100644 --- a/release/picobsd/floppy.tree/etc/ttys +++ b/release/picobsd/floppy.tree/etc/ttys @@ -32,4 +32,4 @@ ttyp6 none network secure ttyp7 none network secure ttyp8 none network secure ttyp9 none network secure -ttyu0 "/usr/libexec/getty std.9600" dialup on secure +ttyu0 "/usr/libexec/getty 3wire" dialup on secure diff --git a/release/picobsd/mfs_tree/etc/gettytab b/release/picobsd/mfs_tree/etc/gettytab index 09173321819..c444276663c 100644 --- a/release/picobsd/mfs_tree/etc/gettytab +++ b/release/picobsd/mfs_tree/etc/gettytab @@ -4,12 +4,15 @@ default:\ :cb:ce:ck:lc:fd#1000:cl:im=\r\nPicoBSD (%h) (%t)\r\n\r\n:sp#1200: -P|Pc|Pc console:\ +# 20140527 add nc (no carrier) to the pc console entry to fix +# devices with no handshake after svn 264175 (this also affects bhyve) +P|Pc|Pc console|3wire:\ + :nc:\ :ht:np:sp#115200: # Fixed speed entries 2|std.9600|9600-baud:\ - :np:sp#9600: + :nc:np:sp#9600: g|std.19200|19200-baud:\ :np:sp#19200: std.38400|38400-baud:\ diff --git a/release/picobsd/qemu/crunch.conf b/release/picobsd/qemu/crunch.conf index 3b0434006bc..58a5544f405 100644 --- a/release/picobsd/qemu/crunch.conf +++ b/release/picobsd/qemu/crunch.conf @@ -31,6 +31,7 @@ buildopts -DWITHOUT_PAM -DRELEASE_CRUNCH -DPPP_NO_NETGRAPH buildopts -DTRACEROUTE_NO_IPSEC -DNO_INET6 +buildopts -DWITHOUT_KERBEROS -DWITHOUT_OPENSSL # Directories where to look for sources of various binaries. # @__CWD__@ is a magic keyword in the picobsd's (Makefile.conf) diff --git a/release/scripts/FreeBSD_install_cdrom.conf b/release/scripts/FreeBSD_install_cdrom.conf index 44554b1141c..7a6d7878a62 100644 --- a/release/scripts/FreeBSD_install_cdrom.conf +++ b/release/scripts/FreeBSD_install_cdrom.conf @@ -10,3 +10,7 @@ FreeBSD_install_cdrom: { enabled: yes } +FreeBSD: { + enabled: no +} + diff --git a/release/scripts/mm-mtree.sh b/release/scripts/mm-mtree.sh index 644f309f3c0..ef971027d45 100755 --- a/release/scripts/mm-mtree.sh +++ b/release/scripts/mm-mtree.sh @@ -5,7 +5,7 @@ # This script is intended to be used as part of the release building # process to generate the /var/db/mergemaster.mtree file relevant to # the source tree used to create the release so that users can make -# use of mergemaster's -U option to update their files after csup'ing +# use of mergemaster's -U option to update their files after updating # to -stable. # Copyright 2009 Douglas Barton diff --git a/release/scripts/pkg-stage.sh b/release/scripts/pkg-stage.sh index 2281435aff4..6d02ac630f2 100755 --- a/release/scripts/pkg-stage.sh +++ b/release/scripts/pkg-stage.sh @@ -5,7 +5,7 @@ set -e -export ASSUME_ALWAYS_YES=1 +export ASSUME_ALWAYS_YES="YES" export PKG_DBDIR="/tmp/pkg" export PERMISSIVE="YES" export REPO_AUTOUPDATE="NO" @@ -40,7 +40,10 @@ if [ ! -x /usr/local/sbin/pkg ]; then /usr/bin/make -C /usr/ports/ports-mgmt/pkg install clean fi -export PKG_ABI=$(pkg -vv | grep ^ABI | awk '{print $3}') +PKG_ABI=$(pkg -vv | grep ^ABI | awk '{print $3}') +PKG_ABI="${PKG_ABI%\";}" +PKG_ABI="${PKG_ABI#\"}" +export PKG_ABI export PKG_CACHEDIR="dvd/packages/${PKG_ABI}" /bin/mkdir -p ${PKG_CACHEDIR} diff --git a/rescue/rescue/Makefile b/rescue/rescue/Makefile index fc778f0aa28..16ee20c6154 100644 --- a/rescue/rescue/Makefile +++ b/rescue/rescue/Makefile @@ -1,9 +1,9 @@ #$FreeBSD$ # @(#)Makefile 8.1 (Berkeley) 6/2/93 -MAN= - .include + +MAN= MK_SSP= no PROG= rescue @@ -52,7 +52,7 @@ CRUNCH_SRCDIRS+= bin CRUNCH_PROGS_bin= cat chflags chio chmod cp date dd df echo \ ed expr getfacl hostname kenv kill ln ls mkdir mv \ pkill ps pwd realpath rm rmdir setfacl sh stty sync test -CRUNCH_LIBS+= -lcrypt -ledit -ljail -lkvm -ll -ltermcap -lutil +CRUNCH_LIBS+= -lcrypt -ledit -ljail -lkvm -ll -ltermcapw -lutil CRUNCH_BUILDTOOLS+= bin/sh # Additional options for specific programs @@ -118,11 +118,15 @@ CRUNCH_PROGS_sbin+= zpool # crunchgen does not like C++ programs; this should be fixed someday # CRUNCH_PROGS+= devd -CRUNCH_LIBS+= -lalias -lcam -lcurses -ldevstat -lipsec +CRUNCH_LIBS+= -lalias -lcam -lncursesw -ldevstat -lipsec .if ${MK_ZFS} != "no" CRUNCH_LIBS+= -lavl -lzfs_core -lzfs -lnvpair -lpthread -luutil -lumem .endif -CRUNCH_LIBS+= -lgeom -lbsdxml -lkiconv -lmd -lsbuf -lufs -lz +CRUNCH_LIBS+= -lgeom -lbsdxml -lkiconv +.if ${MK_OPENSSL} == "no" +CRUNCH_LIBS+= -lmd +.endif +CRUNCH_LIBS+= -lsbuf -lufs -lz .if ${MACHINE_CPUARCH} == "i386" CRUNCH_PROGS_sbin+= bsdlabel sconfig fdisk @@ -136,10 +140,6 @@ CRUNCH_PROGS_sbin+= bsdlabel CRUNCH_SRCDIR_fdisk= $(.CURDIR)/../../sbin/fdisk_pc98 .endif -.if ${MACHINE_CPUARCH} == "ia64" -CRUNCH_PROGS_sbin+= mca -.endif - .if ${MACHINE_CPUARCH} == "sparc64" CRUNCH_PROGS_sbin+= bsdlabel sunlabel .endif @@ -191,10 +191,11 @@ CRUNCH_ALIAS_xz= unxz lzma unlzma xzcat lzcat CRUNCH_LIBS+= -llzma CRUNCH_PROGS_usr.bin+= tar -CRUNCH_LIBS+= -larchive -lmd +CRUNCH_LIBS+= -larchive .if ${MK_OPENSSL} != "no" CRUNCH_LIBS+= -lcrypto .endif +CRUNCH_LIBS+= -lmd CRUNCH_PROGS_usr.bin+= vi CRUNCH_ALIAS_vi= ex @@ -216,3 +217,4 @@ CRUNCH_LIBS+= -lm .include .include + diff --git a/sbin/Makefile.ia64 b/sbin/Makefile.ia64 deleted file mode 100644 index c1e6a417ac8..00000000000 --- a/sbin/Makefile.ia64 +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD$ - -SUBDIR += mca diff --git a/sbin/adjkerntz/adjkerntz.8 b/sbin/adjkerntz/adjkerntz.8 index 6f0f15e49b9..1bd1391b8cc 100644 --- a/sbin/adjkerntz/adjkerntz.8 +++ b/sbin/adjkerntz/adjkerntz.8 @@ -190,4 +190,4 @@ The utility appeared in .Fx 1.0 . .Sh AUTHORS -.An Andrey A. Chernov Aq ache@astral.msk.su +.An Andrey A. Chernov Aq Mt ache@astral.msk.su diff --git a/sbin/atm/atmconfig/Makefile.depend b/sbin/atm/atmconfig/Makefile.depend index d0b9730ddd5..42e50670ff6 100644 --- a/sbin/atm/atmconfig/Makefile.depend +++ b/sbin/atm/atmconfig/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/sbin/atm/atmconfig/atmconfig.8 b/sbin/atm/atmconfig/atmconfig.8 index 1ff76a100cd..c8a740cea59 100644 --- a/sbin/atm/atmconfig/atmconfig.8 +++ b/sbin/atm/atmconfig/atmconfig.8 @@ -316,4 +316,4 @@ List all NATM routes. .Xr natmip 4 , .Xr atm 8 .Sh AUTHORS -.An Hartmut Brandt Aq harti@FreeBSD.org +.An Hartmut Brandt Aq Mt harti@FreeBSD.org diff --git a/sbin/bsdlabel/bsdlabel.8 b/sbin/bsdlabel/bsdlabel.8 index d31187be1e7..e0f3752c295 100644 --- a/sbin/bsdlabel/bsdlabel.8 +++ b/sbin/bsdlabel/bsdlabel.8 @@ -109,7 +109,7 @@ argument forces .Nm to use a layout suitable for a different architecture. Current valid values are -.Cm i386 , amd64 , ia64 , +.Cm i386 , amd64 , and .Cm pc98 . If this option is omitted, diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c index ce5d375f318..b99c2791859 100644 --- a/sbin/bsdlabel/bsdlabel.c +++ b/sbin/bsdlabel/bsdlabel.c @@ -165,7 +165,6 @@ main(int argc, char *argv[]) case 'm': if (!strcmp(optarg, "i386") || !strcmp(optarg, "amd64") || - !strcmp(optarg, "ia64") || !strcmp(optarg, "pc98")) { labelsoffset = 1; labeloffset = 0; diff --git a/sbin/camcontrol/Makefile b/sbin/camcontrol/Makefile index 68633757c3d..4f11f195db5 100644 --- a/sbin/camcontrol/Makefile +++ b/sbin/camcontrol/Makefile @@ -3,7 +3,7 @@ PROG= camcontrol SRCS= camcontrol.c util.c .if !defined(RELEASE_CRUNCH) -SRCS+= fwdownload.c modeedit.c progress.c +SRCS+= fwdownload.c modeedit.c persist.c progress.c .else CFLAGS+= -DMINIMALISTIC .endif diff --git a/sbin/camcontrol/camcontrol.8 b/sbin/camcontrol/camcontrol.8 index 856edc41c8d..0c42564dfc4 100644 --- a/sbin/camcontrol/camcontrol.8 +++ b/sbin/camcontrol/camcontrol.8 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 6, 2013 +.Dd November 20, 2013 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -269,6 +269,21 @@ .Op Fl U Ar pwd .Op Fl y .Nm +.Ic persist +.Op device id +.Op generic args +.Aq Fl i Ar action | Fl o Ar action +.Op Fl a +.Op Fl I Ar trans_id +.Op Fl k Ar key +.Op Fl K Ar sa_key +.Op Fl p +.Op Fl R Ar rel_tgt_port +.Op Fl s Ar scope +.Op Fl S +.Op Fl T Ar res_type +.Op Fl U +.Nm .Ic help .Sh DESCRIPTION The @@ -1473,6 +1488,276 @@ to output a line for every firmware segment that is sent to the device by the fwdownload command -- the same as the ones shown in simulation mode. .El +.It Ic persist +Persistent reservation support. +Persistent reservations are a way to reserve a particular +.Tn SCSI +LUN for use by one or more +.Tn SCSI +initiators. +If the +.Fl i +option is specified, +.Nm +will issue the +.Tn SCSI +PERSISTENT RESERVE IN +command using the requested service action. +If the +.Fl o +option is specified, +.Nm +will issue the +.Tn SCSI +PERSISTENT RESERVE OUT +command using the requested service action. +One of those two options is required. +.Pp +Persistent reservations are complex, and fully explaining them is outside +the scope of this manual. +Please visit +http://www.t10.org +and download the latest SPC spec for a full explanation of persistent +reservations. +.Bl -tag -width 8n +.It Fl i Ar mode +Specify the service action for the PERSISTENT RESERVE IN command. +Supported service actions: +.Bl -tag -width 19n +.It read_keys +Report the current persistent reservation generation (PRgeneration) and any +registered keys. +.It read_reservation +Report the persistent reservation, if any. +.It report_capabilities +Report the persistent reservation capabilities of the LUN. +.It read_full_status +Report the full status of persistent reservations on the LUN. +.El +.It Fl o Ar mode +Specify the service action for the PERSISTENT RESERVE OUT command. +For service actions like register that are components of other service +action names, the entire name must be specified. +Otherwise, enough of the service action name must be specified to +distinguish it from other possible service actions. +Supported service actions: +.Bl -tag -width 15n +.It register +Register a reservation key with the LUN or unregister a reservation key. +To register a key, specify the requested key as the Service Action +Reservation Key. +To unregister a key, specify the previously registered key as the +Reservation Key. +To change a key, specify the old key as the Reservation Key and the new +key as the Service Action Reservation Key. +.It register_ignore +This is similar to the register subcommand, except that the Reservation Key +is ignored. +The Service Action Reservation Key will overwrite any previous key +registered for the initiator. +.It reserve +Create a reservation. +A key must be registered with the LUN before the LUN can be reserved, and +it must be specified as the Reservation Key. +The type of reservation must also be specified. +The scope defaults to LUN scope (LU_SCOPE), but may be changed. +.It release +Release a reservation. +The Reservation Key must be specified. +.It clear +Release a reservation and remove all keys from the device. +The Reservation Key must be specified. +.It preempt +Remove a reservation belonging to another initiator. +The Reservation Key must be specified. +The Service Action Reservation Key may be specified, depending on the +operation being performed. +.It preempt_abort +Remove a reservation belonging to another initiator and abort all +outstanding commands from that initiator. +The Reservation Key must be specified. +The Service Action Reservation Key may be specified, depending on the +operation being performed. +.It register_move +Register another initiator with the LUN, and establish a reservation on the +LUN for that initiator. +The Reservation Key and Service Action Reservation Key must be specified. +.It replace_lost +Replace Lost Reservation information. +.El +.It Fl a +Set the All Target Ports (ALL_TG_PT) bit. +This requests that the key registration be applied to all target ports and +not just the particular target port that receives the command. +This only applies to the register and register_ignore actions. +.It Fl I Ar tid +Specify a Transport ID. +This only applies to the Register and Register and Move service actions for +Persistent Reserve Out. +Multiple Transport IDs may be specified with multiple +.Fl I +arguments. +With the Register service action, specifying one or more Transport IDs +implicitly enables the +.Fl S +option which turns on the SPEC_I_PT bit. +Transport IDs generally have the format protocol,id. +.Bl -tag -width 5n +.It SAS +A SAS Transport ID consists of +.Dq sas, +followed by a 64-bit SAS address. +For example: +.Pp +.Dl sas,0x1234567812345678 +.It FC +A Fibre Channel Transport ID consists of +.Dq fcp, +followed by a 64-bit Fibre Channel World Wide Name. +For example: +.Pp +.Dl fcp,0x1234567812345678 +.It SPI +A Parallel SCSI address consists of +.Dq spi, +followed by a SCSI target ID and a relative target port identifier. +For example: +.Pp +.Dl spi,4,1 +.It 1394 +An IEEE 1394 (Firewire) Transport ID consists of +.Dq sbp, +followed by a 64-bit EUI-64 IEEE 1394 node unique identifier. +For example: +.Pp +.Dl sbp,0x1234567812345678 +.It RDMA +A SCSI over RDMA Transport ID consists of +.Dq srp, +followed by a 128-bit RDMA initiator port identifier. +The port identifier must be exactly 32 or 34 (if the leading 0x is +included) hexadecimal digits. +Only hexadecimal (base 16) numbers are supported. +For example: +.Pp +.Dl srp,0x12345678123456781234567812345678 +.It iSCSI +An iSCSI Transport ID consists an iSCSI name and optionally a separator and +iSCSI session ID. +For example, if only the iSCSI name is specified: +.Pp +.Dl iqn.2012-06.com.example:target0 +.Pp +If the iSCSI separator and initiator session ID are specified: +.Pp +.Dl iqn.2012-06.com.example:target0,i,0x123 +.It PCIe +A SCSI over PCIe Transport ID consists of +.Dq sop, +followed by a PCIe Routing ID. +The Routing ID consists of a bus, device and function or in the alternate +form, a bus and function. +The bus must be in the range of 0 to 255 inclusive and the device must be +in the range of 0 to 31 inclusive. +The function must be in the range of 0 to 7 inclusive if the standard form +is used, and in the range of 0 to 255 inclusive if the alternate form is +used. +For example, if a bus, device and function are specified for the standard +Routing ID form: +.Pp +.Dl sop,4,5,1 +.Pp +If the alternate Routing ID form is used: +.Pp +.Dl sop,4,1 +.El +.It Fl k Ar key +Specify the Reservation Key. +This may be in decimal, octal or hexadecimal format. +The value is zero by default if not otherwise specified. +The value must be between 0 and 2^64 - 1, inclusive. +.It Fl K Ar key +Specify the Service Action Reservation Key. +This may be in decimal, octal or hexadecimal format. +The value is zero by default if not otherwise specified. +The value must be between 0 and 2^64 - 1, inclusive. +.It Fl p +Enable the Activate Persist Through Power Loss bit. +This is only used for the register and register_ignore actions. +This requests that the reservation persist across power loss events. +.It Fl s Ar scope +Specify the scope of the reservation. +The scope may be specified by name or by number. +The scope is ignored for register, register_ignore and clear. +If the desired scope isn't available by name, you may specify the number. +.Bl -tag -width 7n +.It lun +LUN scope (0x00). +This encompasses the entire LUN. +.It extent +Extent scope (0x01). +.It element +Element scope (0x02). +.El +.It Fl R Ar rtp +Specify the Relative Target Port. +This only applies to the Register and Move service action of the Persistent +Reserve Out command. +.It Fl S +Enable the SPEC_I_PT bit. +This only applies to the Register service action of Persistent Reserve Out. +You must also specify at least one Transport ID with +.Fl I +if this option is set. +If you specify a Transport ID, this option is automatically set. +It is an error to specify this option for any service action other than +Register. +.It Fl T Ar type +Specify the reservation type. +The reservation type may be specified by name or by number. +If the desired reservation type isn't available by name, you may specify +the number. +Supported reservation type names: +.Bl -tag -width 11n +.It read_shared +Read Shared mode. +.It wr_ex +Write Exclusive mode. +May also be specified as +.Dq write_exclusive . +.It rd_ex +Read Exclusive mode. +May also be specified as +.Dq read_exclusive . +.It ex_ac +Exclusive access mode. +May also be specified as +.Dq exclusive_access . +.It wr_ex_ro +Write Exclusive Registrants Only mode. +May also be specified as +.Dq write_exclusive_reg_only . +.It ex_ac_ro +Exclusive Access Registrants Only mode. +May also be specified as +.Dq exclusive_access_reg_only . +.It wr_ex_ar +Write Exclusive All Registrants mode. +May also be specified as +.Dq write_exclusive_all_regs . +.It ex_ac_ar +Exclusive Access All Registrants mode. +May also be specified as +.Dq exclusive_access_all_regs . +.El +.It Fl U +Specify that the target should unregister the initiator that sent +the Register and Move request. +By default, the target will not unregister the initiator that sends the +Register and Move request. +This option only applies to the Register and Move service action of the +Persistent Reserve Out command. +.El .It Ic help Print out verbose usage information. .El @@ -1639,6 +1924,66 @@ power-on or hardware reset! .Pp .Em DO NOT use this on a device which has an active filesystem! +.Pp +.Bd -literal -offset indent +camcontrol persist da0 -v -i read_keys +.Ed +.Pp +This will read any persistent reservation keys registered with da0, and +display any errors encountered when sending the PERSISTENT RESERVE IN +.Tn SCSI +command. +.Bd -literal -offset indent +camcontrol persist da0 -v -o register -a -K 0x12345678 +.Ed +.Pp +This will register the persistent reservation key 0x12345678 with da0, +apply that registration to all ports on da0, and display any errors that +occur when sending the PERSISTENT RESERVE OUT command. +.Bd -literal -offset indent +camcontrol persist da0 -v -o reserve -s lun -k 0x12345678 -T ex_ac +.Ed +.Pp +This will reserve da0 for the exlusive use of the initiator issuing the +command. +The scope of the reservation is the entire LUN. +Any errors sending the PERSISTENT RESERVE OUT command will be displayed. +.Bd -literal -offset indent +camcontrol persist da0 -v -i read_full +.Ed +.Pp +This will display the full status of all reservations on da0 and print out +status if there are any errors. +.Bd -literal -offset indent +camcontrol persist da0 -v -o release -k 0x12345678 -T ex_ac +.Ed +.Pp +This will release a reservation on da0 of the type ex_ac +(Exclusive Access). +The Reservation Key for this registration is 0x12345678. +Any errors that occur will be displayed. +.Bd -literal -offset indent +camcontrol persist da0 -v -o register -K 0x12345678 -S \e + -I sas,0x1234567812345678 -I sas,0x8765432187654321 +.Ed +.Pp +This will register the key 0x12345678 with da0, specifying that it applies +to the SAS initiators with SAS addresses 0x1234567812345678 and +0x8765432187654321. +.Bd -literal -offset indent +camcontrol persist da0 -v -o register_move -k 0x87654321 \e + -K 0x12345678 -U -p -R 2 -I fcp,0x1234567812345678 +.Ed +.Pp +This will move the registration from the current initiator, whose +Registration Key is 0x87654321, to the Fibre Channel initiator with the +Fiber Channel World Wide Node Name 0x1234567812345678. +A new registration key, 0x12345678, will be registered for the initiator +with the Fibre Channel World Wide Node Name 0x1234567812345678, and the +current initiator will be unregistered from the target. +The reservation will be moved to relative target port 2 on the target +device. +The registration will persist across power losses. .Sh SEE ALSO .Xr cam 3 , .Xr cam_cdbparse 3 , @@ -1666,7 +2011,7 @@ and first appeared in in .Fx 2.0.5 . .Sh AUTHORS -.An Kenneth Merry Aq ken@FreeBSD.org +.An Kenneth Merry Aq Mt ken@FreeBSD.org .Sh BUGS The code that parses the generic command line arguments does not know that some of the subcommands take multiple arguments. diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c index 6783bd3204c..12a0e5c5684 100644 --- a/sbin/camcontrol/camcontrol.c +++ b/sbin/camcontrol/camcontrol.c @@ -96,6 +96,7 @@ typedef enum { CAM_CMD_SECURITY = 0x0000001d, CAM_CMD_HPA = 0x0000001e, CAM_CMD_SANITIZE = 0x0000001f, + CAM_CMD_PERSIST = 0x00000020 } cam_cmdmask; typedef enum { @@ -218,6 +219,7 @@ static struct camcontrol_opts option_table[] = { {"fwdownload", CAM_CMD_DOWNLOAD_FW, CAM_ARG_NONE, "f:ys"}, {"security", CAM_CMD_SECURITY, CAM_ARG_NONE, "d:e:fh:k:l:qs:T:U:y"}, {"hpa", CAM_CMD_HPA, CAM_ARG_NONE, "Pflp:qs:U:y"}, + {"persist", CAM_CMD_PERSIST, CAM_ARG_NONE, "ai:I:k:K:o:ps:ST:U"}, #endif /* MINIMALISTIC */ {"help", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, {"-?", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, @@ -225,12 +227,6 @@ static struct camcontrol_opts option_table[] = { {NULL, 0, 0, NULL} }; -typedef enum { - CC_OR_NOT_FOUND, - CC_OR_AMBIGUOUS, - CC_OR_FOUND -} camcontrol_optret; - struct cam_devitem { struct device_match_result dev_match; int num_periphs; @@ -7826,6 +7822,9 @@ usage(int printlong) " [-U ] [-y]\n" " camcontrol hpa [dev_id][generic args] [-f] [-l] [-P] [-p pwd]\n" " [-q] [-s max_sectors] [-U pwd] [-y]\n" +" camcontrol persist [dev_id][generic args] <-i action|-o action>\n" +" [-a][-I tid][-k key][-K sa_key][-p][-R rtp]\n" +" [-s scope][-S][-T type][-U]\n" #endif /* MINIMALISTIC */ " camcontrol help\n"); if (!printlong) @@ -7862,8 +7861,9 @@ usage(int printlong) "idle send the ATA IDLE command to the named device\n" "standby send the ATA STANDBY command to the named device\n" "sleep send the ATA SLEEP command to the named device\n" -"fwdownload program firmware of the named device with the given image" +"fwdownload program firmware of the named device with the given image\n" "security report or send ATA security commands to the named device\n" +"persist send the SCSI PERSISTENT RESERVE IN or OUT commands\n" "help this message\n" "Device Identifiers:\n" "bus:target specify the bus and target, lun defaults to 0\n" @@ -7998,6 +7998,22 @@ usage(int printlong) " device\n" "-U pwd unlock the HPA configuration of the device\n" "-y don't ask any questions\n" +"persist arguments:\n" +"-i action specify read_keys, read_reservation, report_cap, or\n" +" read_full_status\n" +"-o action specify register, register_ignore, reserve, release,\n" +" clear, preempt, preempt_abort, register_move, replace_lost\n" +"-a set the All Target Ports (ALL_TG_PT) bit\n" +"-I tid specify a Transport ID, e.g.: sas,0x1234567812345678\n" +"-k key specify the Reservation Key\n" +"-K sa_key specify the Service Action Reservation Key\n" +"-p set the Activate Persist Through Power Loss bit\n" +"-R rtp specify the Relative Target Port\n" +"-s scope specify the scope: lun, extent, element or a number\n" +"-S specify Transport ID for register, requires -I\n" +"-T res_type specify the reservation type: read_shared, wr_ex, rd_ex,\n" +" ex_ac, wr_ex_ro, ex_ac_ro, wr_ex_ar, ex_ac_ar\n" +"-U unregister the current initiator for register_move\n" ); #endif /* MINIMALISTIC */ } @@ -8332,6 +8348,11 @@ main(int argc, char **argv) error = scsisanitize(cam_dev, argc, argv, combinedopt, retry_count, timeout); break; + case CAM_CMD_PERSIST: + error = scsipersist(cam_dev, argc, argv, combinedopt, + retry_count, timeout, arglist & CAM_ARG_VERBOSE, + arglist & CAM_ARG_ERR_RECOVER); + break; #endif /* MINIMALISTIC */ case CAM_CMD_USAGE: usage(1); diff --git a/sbin/camcontrol/camcontrol.h b/sbin/camcontrol/camcontrol.h index 616236a8b76..7c249bfbcfa 100644 --- a/sbin/camcontrol/camcontrol.h +++ b/sbin/camcontrol/camcontrol.h @@ -30,6 +30,13 @@ #ifndef _CAMCONTROL_H #define _CAMCONTROL_H + +typedef enum { + CC_OR_NOT_FOUND, + CC_OR_AMBIGUOUS, + CC_OR_FOUND +} camcontrol_optret; + /* * get_hook: Structure for evaluating args in a callback. */ @@ -56,6 +63,9 @@ void mode_list(struct cam_device *device, int page_control, int dbd, int retry_count, int timeout); int scsidoinquiry(struct cam_device *device, int argc, char **argv, char *combinedopt, int retry_count, int timeout); +int scsipersist(struct cam_device *device, int argc, char **argv, + char *combinedopt, int retry_count, int timeout, int verbose, + int err_recover); char *cget(void *hook, char *name); int iget(void *hook, char *name); void arg_put(void *hook, int letter, void *arg, int count, char *name); diff --git a/sbin/camcontrol/persist.c b/sbin/camcontrol/persist.c new file mode 100644 index 00000000000..bcc1073d2c0 --- /dev/null +++ b/sbin/camcontrol/persist.c @@ -0,0 +1,966 @@ +/*- + * Copyright (c) 2013 Spectra Logic Corporation + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + * + * Authors: Ken Merry (Spectra Logic Corporation) + */ +/* + * SCSI Persistent Reservation support for camcontrol(8). + */ + +#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 "camcontrol.h" + +struct persist_transport_id { + struct scsi_transportid_header *hdr; + unsigned int alloc_len; + STAILQ_ENTRY(persist_transport_id) links; +}; + +/* + * Service Actions for PERSISTENT RESERVE IN. + */ +static struct scsi_nv persist_in_actions[] = { + { "read_keys", SPRI_RK }, + { "read_reservation", SPRI_RR }, + { "report_capabilities", SPRI_RC }, + { "read_full_status", SPRI_RS } +}; + +/* + * Service Actions for PERSISTENT RESERVE OUT. + */ +static struct scsi_nv persist_out_actions[] = { + { "register", SPRO_REGISTER }, + { "reserve", SPRO_RESERVE }, + { "release" , SPRO_RELEASE }, + { "clear", SPRO_CLEAR }, + { "preempt", SPRO_PREEMPT }, + { "preempt_abort", SPRO_PRE_ABO }, + { "register_ignore", SPRO_REG_IGNO }, + { "register_move", SPRO_REG_MOVE }, + { "replace_lost", SPRO_REPL_LOST_RES } +}; + +/* + * Known reservation scopes. As of SPC-4, only LU_SCOPE is used in the + * spec. The others are obsolete. + */ +static struct scsi_nv persist_scope_table[] = { + { "lun", SPR_LU_SCOPE }, + { "extent", SPR_EXTENT_SCOPE }, + { "element", SPR_ELEMENT_SCOPE } +}; + +/* + * Reservation types. The longer name for a given reservation type is + * listed first, so that it makes more sense when we print out the + * reservation type. We step through the table linearly when looking for + * the text name for a particular numeric reservation type value. + */ +static struct scsi_nv persist_type_table[] = { + { "read_shared", SPR_TYPE_RD_SHARED }, + { "write_exclusive", SPR_TYPE_WR_EX }, + { "wr_ex", SPR_TYPE_WR_EX }, + { "read_exclusive", SPR_TYPE_RD_EX }, + { "rd_ex", SPR_TYPE_RD_EX }, + { "exclusive_access", SPR_TYPE_EX_AC }, + { "ex_ac", SPR_TYPE_EX_AC }, + { "write_exclusive_reg_only", SPR_TYPE_WR_EX_RO }, + { "wr_ex_ro", SPR_TYPE_WR_EX_RO }, + { "exclusive_access_reg_only", SPR_TYPE_EX_AC_RO }, + { "ex_ac_ro", SPR_TYPE_EX_AC_RO }, + { "write_exclusive_all_regs", SPR_TYPE_WR_EX_AR }, + { "wr_ex_ar", SPR_TYPE_WR_EX_AR }, + { "exclusive_access_all_regs", SPR_TYPE_EX_AC_AR }, + { "ex_ac_ar", SPR_TYPE_EX_AC_AR } +}; + +/* + * Print out the standard scope/type field. + */ +static void +persist_print_scopetype(uint8_t scopetype) +{ + const char *tmpstr; + int num_entries; + + num_entries = sizeof(persist_scope_table) / + sizeof(persist_scope_table[0]); + tmpstr = scsi_nv_to_str(persist_scope_table, num_entries, + scopetype & SPR_SCOPE_MASK); + fprintf(stdout, "Scope: %s (%#x)\n", (tmpstr != NULL) ? tmpstr : + "Unknown", (scopetype & SPR_SCOPE_MASK) >> SPR_SCOPE_SHIFT); + + num_entries = sizeof(persist_type_table) / + sizeof(persist_type_table[0]); + tmpstr = scsi_nv_to_str(persist_type_table, num_entries, + scopetype & SPR_TYPE_MASK); + fprintf(stdout, "Type: %s (%#x)\n", (tmpstr != NULL) ? tmpstr : + "Unknown", scopetype & SPR_TYPE_MASK); +} + +static void +persist_print_transportid(uint8_t *buf, uint32_t len) +{ + struct sbuf *sb; + + sb = sbuf_new_auto(); + if (sb == NULL) + fprintf(stderr, "Unable to allocate sbuf\n"); + + scsi_transportid_sbuf(sb, (struct scsi_transportid_header *)buf, len); + + sbuf_finish(sb); + + fprintf(stdout, "%s\n", sbuf_data(sb)); + + sbuf_delete(sb); +} + +/* + * Print out a persistent reservation. This is used with the READ + * RESERVATION (0x01) service action of the PERSISTENT RESERVE IN command. + */ +static void +persist_print_res(struct scsi_per_res_in_header *hdr, uint32_t valid_len) +{ + uint32_t length; + struct scsi_per_res_in_rsrv *res; + + length = scsi_4btoul(hdr->length); + length = MIN(length, valid_len); + + res = (struct scsi_per_res_in_rsrv *)hdr; + + if (length < sizeof(res->data) - sizeof(res->data.extent_length)) { + if (length == 0) + fprintf(stdout, "No reservations.\n"); + else + warnx("unable to print reservation, only got %u " + "valid bytes", length); + return; + } + fprintf(stdout, "PRgeneration: %#x\n", + scsi_4btoul(res->header.generation)); + fprintf(stdout, "Reservation Key: %#jx\n", + (uintmax_t)scsi_8btou64(res->data.reservation)); + fprintf(stdout, "Scope address: %#x\n", + scsi_4btoul(res->data.scope_addr)); + + persist_print_scopetype(res->data.scopetype); + + fprintf(stdout, "Extent length: %u\n", + scsi_2btoul(res->data.extent_length)); +} + +/* + * Print out persistent reservation keys. This is used with the READ KEYS + * service action of the PERSISTENT RESERVE IN command. + */ +static void +persist_print_keys(struct scsi_per_res_in_header *hdr, uint32_t valid_len) +{ + uint32_t length, num_keys, i; + struct scsi_per_res_key *key; + + length = scsi_4btoul(hdr->length); + length = MIN(length, valid_len); + + num_keys = length / sizeof(*key); + + fprintf(stdout, "PRgeneration: %#x\n", scsi_4btoul(hdr->generation)); + fprintf(stdout, "%u key%s%s\n", num_keys, (num_keys == 1) ? "" : "s", + (num_keys == 0) ? "." : ":"); + + for (i = 0, key = (struct scsi_per_res_key *)&hdr[1]; i < num_keys; + i++, key++) { + fprintf(stdout, "%u: %#jx\n", i, + (uintmax_t)scsi_8btou64(key->key)); + } +} + +/* + * Print out persistent reservation capabilities. This is used with the + * REPORT CAPABILITIES service action of the PERSISTENT RESERVE IN command. + */ +static void +persist_print_cap(struct scsi_per_res_cap *cap, uint32_t valid_len) +{ + uint32_t length; + int check_type_mask = 0; + + length = scsi_2btoul(cap->length); + length = MIN(length, valid_len); + + if (length < __offsetof(struct scsi_per_res_cap, type_mask)) { + fprintf(stdout, "Insufficient data (%u bytes) to report " + "full capabilities\n", length); + return; + } + if (length >= __offsetof(struct scsi_per_res_cap, reserved)) + check_type_mask = 1; + + fprintf(stdout, "Replace Lost Reservation Capable (RLR_C): %d\n", + (cap->flags1 & SPRI_RLR_C) ? 1 : 0); + fprintf(stdout, "Compatible Reservation Handling (CRH): %d\n", + (cap->flags1 & SPRI_CRH) ? 1 : 0); + fprintf(stdout, "Specify Initiator Ports Capable (SIP_C): %d\n", + (cap->flags1 & SPRI_SIP_C) ? 1 : 0); + fprintf(stdout, "All Target Ports Capable (ATP_C): %d\n", + (cap->flags1 & SPRI_ATP_C) ? 1 : 0); + fprintf(stdout, "Persist Through Power Loss Capable (PTPL_C): %d\n", + (cap->flags1 & SPRI_PTPL_C) ? 1 : 0); + fprintf(stdout, "ALLOW COMMANDS field: (%#x)\n", + (cap->flags2 & SPRI_ALLOW_CMD_MASK) >> SPRI_ALLOW_CMD_SHIFT); + /* + * These cases are cut-and-pasted from SPC4r36l. There is no + * succinct way to describe these otherwise, and even with the + * verbose description, the user will probably have to refer to + * the spec to fully understand what is going on. + */ + switch (cap->flags2 & SPRI_ALLOW_CMD_MASK) { + case SPRI_ALLOW_1: + fprintf(stdout, +" The device server allows the TEST UNIT READY command through Write\n" +" Exclusive type reservations and Exclusive Access type reservations\n" +" and does not provide information about whether the following commands\n" +" are allowed through Write Exclusive type reservations:\n" +" a) the MODE SENSE command, READ ATTRIBUTE command, READ BUFFER\n" +" command, RECEIVE COPY RESULTS command, RECEIVE DIAGNOSTIC\n" +" RESULTS command, REPORT SUPPORTED OPERATION CODES command,\n" +" and REPORT SUPPORTED TASK MANAGEMENT FUNCTION command; and\n" +" b) the READ DEFECT DATA command (see SBC-3).\n"); + break; + case SPRI_ALLOW_2: + fprintf(stdout, +" The device server allows the TEST UNIT READY command through Write\n" +" Exclusive type reservations and Exclusive Access type reservations\n" +" and does not allow the following commands through Write Exclusive type\n" +" reservations:\n" +" a) the MODE SENSE command, READ ATTRIBUTE command, READ BUFFER\n" +" command, RECEIVE DIAGNOSTIC RESULTS command, REPORT SUPPORTED\n" +" OPERATION CODES command, and REPORT SUPPORTED TASK MANAGEMENT\n" +" FUNCTION command; and\n" +" b) the READ DEFECT DATA command.\n" +" The device server does not allow the RECEIVE COPY RESULTS command\n" +" through Write Exclusive type reservations or Exclusive Access type\n" +" reservations.\n"); + break; + case SPRI_ALLOW_3: + fprintf(stdout, +" The device server allows the TEST UNIT READY command through Write\n" +" Exclusive type reservations and Exclusive Access type reservations\n" +" and allows the following commands through Write Exclusive type\n" +" reservations:\n" +" a) the MODE SENSE command, READ ATTRIBUTE command, READ BUFFER\n" +" command, RECEIVE DIAGNOSTIC RESULTS command, REPORT SUPPORTED\n" +" OPERATION CODES command, and REPORT SUPPORTED TASK MANAGEMENT\n" +" FUNCTION command; and\n" +" b) the READ DEFECT DATA command.\n" +" The device server does not allow the RECEIVE COPY RESULTS command\n" +" through Write Exclusive type reservations or Exclusive Access type\n" +" reservations.\n"); + break; + case SPRI_ALLOW_4: + fprintf(stdout, +" The device server allows the TEST UNIT READY command and the RECEIVE\n" +" COPY RESULTS command through Write Exclusive type reservations and\n" +" Exclusive Access type reservations and allows the following commands\n" +" through Write Exclusive type reservations:\n" +" a) the MODE SENSE command, READ ATTRIBUTE command, READ BUFFER\n" +" command, RECEIVE DIAGNOSTIC RESULTS command, REPORT SUPPORTED\n" +" OPERATION CODES command, and REPORT SUPPORTED TASK MANAGEMENT\n" +" FUNCTION command; and\n" +" b) the READ DEFECT DATA command.\n"); + break; + case SPRI_ALLOW_NA: + fprintf(stdout, +" No information is provided about whether certain commands are allowed\n" +" through certain types of persistent reservations.\n"); + break; + default: + fprintf(stdout, +" Unknown ALLOW COMMANDS value %#x\n", + (cap->flags2 & SPRI_ALLOW_CMD_MASK) >> + SPRI_ALLOW_CMD_SHIFT); + break; + } + fprintf(stdout, "Persist Through Power Loss Activated (PTPL_A): %d\n", + (cap->flags2 & SPRI_PTPL_A) ? 1 : 0); + if ((check_type_mask != 0) + && (cap->flags2 & SPRI_TMV)) { + fprintf(stdout, "Supported Persistent Reservation Types:\n"); + fprintf(stdout, " Write Exclusive - All Registrants " + "(WR_EX_AR): %d\n", + (cap->type_mask[0] & SPRI_TM_WR_EX_AR)? 1 : 0); + fprintf(stdout, " Exclusive Access - Registrants Only " + "(EX_AC_RO): %d\n", + (cap->type_mask[0] & SPRI_TM_EX_AC_RO) ? 1 : 0); + fprintf(stdout, " Write Exclusive - Registrants Only " + "(WR_EX_RO): %d\n", + (cap->type_mask[0] & SPRI_TM_WR_EX_RO)? 1 : 0); + fprintf(stdout, " Exclusive Access (EX_AC): %d\n", + (cap->type_mask[0] & SPRI_TM_EX_AC) ? 1 : 0); + fprintf(stdout, " Write Exclusive (WR_EX): %d\n", + (cap->type_mask[0] & SPRI_TM_WR_EX) ? 1 : 0); + fprintf(stdout, " Exclusive Access - All Registrants " + "(EX_AC_AR): %d\n", + (cap->type_mask[1] & SPRI_TM_EX_AC_AR) ? 1 : 0); + } else { + fprintf(stdout, "Persistent Reservation Type Mask is NOT " + "valid\n"); + } + + +} + +static void +persist_print_full(struct scsi_per_res_in_header *hdr, uint32_t valid_len) +{ + uint32_t length, len_to_go = 0; + struct scsi_per_res_in_full_desc *desc; + uint8_t *cur_pos; + int i; + + length = scsi_4btoul(hdr->length); + length = MIN(length, valid_len); + + if (length < sizeof(*desc)) { + if (length == 0) + fprintf(stdout, "No reservations.\n"); + else + warnx("unable to print reservation, only got %u " + "valid bytes", length); + return; + } + + fprintf(stdout, "PRgeneration: %#x\n", scsi_4btoul(hdr->generation)); + cur_pos = (uint8_t *)&hdr[1]; + for (len_to_go = length, i = 0, + desc = (struct scsi_per_res_in_full_desc *)cur_pos; + len_to_go >= sizeof(*desc); + desc = (struct scsi_per_res_in_full_desc *)cur_pos, i++) { + uint32_t additional_length, cur_length; + + + fprintf(stdout, "Reservation Key: %#jx\n", + (uintmax_t)scsi_8btou64(desc->res_key.key)); + fprintf(stdout, "All Target Ports (ALL_TG_PT): %d\n", + (desc->flags & SPRI_FULL_ALL_TG_PT) ? 1 : 0); + fprintf(stdout, "Reservation Holder (R_HOLDER): %d\n", + (desc->flags & SPRI_FULL_R_HOLDER) ? 1 : 0); + + if (desc->flags & SPRI_FULL_R_HOLDER) + persist_print_scopetype(desc->scopetype); + + if ((desc->flags & SPRI_FULL_ALL_TG_PT) == 0) + fprintf(stdout, "Relative Target Port ID: %#x\n", + scsi_2btoul(desc->rel_trgt_port_id)); + + additional_length = scsi_4btoul(desc->additional_length); + + persist_print_transportid(desc->transport_id, + additional_length); + + cur_length = sizeof(*desc) + additional_length; + len_to_go -= cur_length; + cur_pos += cur_length; + } +} + +int +scsipersist(struct cam_device *device, int argc, char **argv, char *combinedopt, + int retry_count, int timeout, int verbosemode, int err_recover) +{ + union ccb *ccb = NULL; + int c, in = 0, out = 0; + int action = -1, num_ids = 0; + int error = 0; + uint32_t res_len = 0; + unsigned long rel_tgt_port = 0; + uint8_t *res_buf = NULL; + int scope = SPR_LU_SCOPE, res_type = 0, key_set = 0, sa_key_set = 0; + struct persist_transport_id *id, *id2; + STAILQ_HEAD(, persist_transport_id) transport_id_list; + uint64_t key = 0, sa_key = 0; + struct scsi_nv *table = NULL; + size_t table_size = 0, id_len = 0; + uint32_t valid_len = 0; + int all_tg_pt = 0, aptpl = 0, spec_i_pt = 0, unreg = 0,rel_port_set = 0; + + STAILQ_INIT(&transport_id_list); + + ccb = cam_getccb(device); + if (ccb == NULL) { + warnx("%s: error allocating CCB", __func__); + error = 1; + goto bailout; + } + + bzero(&(&ccb->ccb_h)[1], + sizeof(union ccb) - sizeof(struct ccb_hdr)); + + while ((c = getopt(argc, argv, combinedopt)) != -1) { + switch (c) { + case 'a': + all_tg_pt = 1; + break; + case 'I': { + int error_str_len = 128; + char error_str[error_str_len]; + char *id_str; + + id = malloc(sizeof(*id)); + if (id == NULL) { + warnx("%s: error allocating %zu bytes", + __func__, sizeof(*id)); + error = 1; + goto bailout; + } + bzero(id, sizeof(*id)); + + id_str = strdup(optarg); + if (id_str == NULL) { + warnx("%s: error duplicating string %s", + __func__, optarg); + free(id); + error = 1; + goto bailout; + } + error = scsi_parse_transportid(id_str, &id->hdr, + &id->alloc_len, error_str, error_str_len); + if (error != 0) { + warnx("%s", error_str); + error = 1; + free(id); + free(id_str); + goto bailout; + } + free(id_str); + + STAILQ_INSERT_TAIL(&transport_id_list, id, links); + num_ids++; + id_len += id->alloc_len; + break; + } + case 'k': + case 'K': { + char *endptr; + uint64_t tmpval; + + tmpval = strtoumax(optarg, &endptr, 0); + if (*endptr != '\0') { + warnx("%s: invalid key argument %s", __func__, + optarg); + error = 1; + goto bailout; + } + if (c == 'k') { + key = tmpval; + key_set = 1; + } else { + sa_key = tmpval; + sa_key_set = 1; + } + break; + } + case 'i': + case 'o': { + scsi_nv_status status; + int table_entry = 0; + + if (c == 'i') { + in = 1; + table = persist_in_actions; + table_size = sizeof(persist_in_actions) / + sizeof(persist_in_actions[0]); + } else { + out = 1; + table = persist_out_actions; + table_size = sizeof(persist_out_actions) / + sizeof(persist_out_actions[0]); + } + + if ((in + out) > 1) { + warnx("%s: only one in (-i) or out (-o) " + "action is allowed", __func__); + error = 1; + goto bailout; + } + + status = scsi_get_nv(table, table_size, optarg, + &table_entry,SCSI_NV_FLAG_IG_CASE); + if (status == SCSI_NV_FOUND) + action = table[table_entry].value; + else { + warnx("%s: %s %s option %s", __func__, + (status == SCSI_NV_AMBIGUOUS) ? + "ambiguous" : "invalid", in ? "in" : + "out", optarg); + error = 1; + goto bailout; + } + break; + } + case 'p': + aptpl = 1; + break; + case 'R': { + char *endptr; + + rel_tgt_port = strtoul(optarg, &endptr, 0); + if (*endptr != '\0') { + warnx("%s: invalid relative target port %s", + __func__, optarg); + error = 1; + goto bailout; + } + rel_port_set = 1; + break; + } + case 's': { + size_t scope_size; + struct scsi_nv *scope_table = NULL; + scsi_nv_status status; + int table_entry = 0; + char *endptr; + + /* + * First check to see if the user gave us a numeric + * argument. If so, we'll try using it. + */ + if (isdigit(optarg[0])) { + scope = strtol(optarg, &endptr, 0); + if (*endptr != '\0') { + warnx("%s: invalid scope %s", + __func__, optarg); + error = 1; + goto bailout; + } + scope = (scope << SPR_SCOPE_SHIFT) & + SPR_SCOPE_MASK; + break; + } + + scope_size = sizeof(persist_scope_table) / + sizeof(persist_scope_table[0]); + scope_table = persist_scope_table; + status = scsi_get_nv(scope_table, scope_size, optarg, + &table_entry,SCSI_NV_FLAG_IG_CASE); + if (status == SCSI_NV_FOUND) + scope = scope_table[table_entry].value; + else { + warnx("%s: %s scope %s", __func__, + (status == SCSI_NV_AMBIGUOUS) ? + "ambiguous" : "invalid", optarg); + error = 1; + goto bailout; + } + break; + } + case 'S': + spec_i_pt = 1; + break; + case 'T': { + size_t res_type_size; + struct scsi_nv *rtype_table = NULL; + scsi_nv_status status; + char *endptr; + int table_entry = 0; + + /* + * First check to see if the user gave us a numeric + * argument. If so, we'll try using it. + */ + if (isdigit(optarg[0])) { + res_type = strtol(optarg, &endptr, 0); + if (*endptr != '\0') { + warnx("%s: invalid reservation type %s", + __func__, optarg); + error = 1; + goto bailout; + } + break; + } + + res_type_size = sizeof(persist_type_table) / + sizeof(persist_type_table[0]); + rtype_table = persist_type_table; + status = scsi_get_nv(rtype_table, res_type_size, + optarg, &table_entry, + SCSI_NV_FLAG_IG_CASE); + if (status == SCSI_NV_FOUND) + res_type = rtype_table[table_entry].value; + else { + warnx("%s: %s reservation type %s", __func__, + (status == SCSI_NV_AMBIGUOUS) ? + "ambiguous" : "invalid", optarg); + error = 1; + goto bailout; + } + break; + } + case 'U': + unreg = 1; + break; + default: + break; + } + } + + if ((in + out) != 1) { + warnx("%s: you must specify one of -i or -o", __func__); + error = 1; + goto bailout; + } + + /* + * Note that we don't really try to figure out whether the user + * needs to specify one or both keys. There are a number of + * scenarios, and sometimes 0 is a valid and desired value. + */ + if (in != 0) { + switch (action) { + case SPRI_RK: + case SPRI_RR: + case SPRI_RS: + /* + * Allocate the maximum length possible for these + * service actions. According to the spec, the + * target is supposed to return the available + * length in the header, regardless of the + * allocation length. In practice, though, with + * the READ FULL STATUS (SPRI_RS) service action, + * some Seagate drives (in particular a + * Constellation ES, ) + * don't return the available length if you only + * allocate the length of the header. So just + * allocate the maximum here so we don't miss + * anything. + */ + res_len = SPRI_MAX_LEN; + break; + case SPRI_RC: + res_len = sizeof(struct scsi_per_res_cap); + break; + default: + /* In theory we should catch this above */ + warnx("%s: invalid action %d", __func__, action); + error = 1; + goto bailout; + break; + } + } else { + + /* + * XXX KDM need to add length for transport IDs for the + * register and move service action and the register + * service action with the SPEC_I_PT bit set. + */ + if (action == SPRO_REG_MOVE) { + if (num_ids != 1) { + warnx("%s: register and move requires a " + "single transport ID (-I)", __func__); + error = 1; + goto bailout; + } + if (rel_port_set == 0) { + warnx("%s: register and move requires a " + "relative target port (-R)", __func__); + error = 1; + goto bailout; + } + res_len = sizeof(struct scsi_per_res_reg_move) + id_len; + } else { + res_len = sizeof(struct scsi_per_res_out_parms); + if ((action == SPRO_REGISTER) + && (num_ids != 0)) { + /* + * If the user specifies any IDs with the + * register service action, turn on the + * spec_i_pt bit. + */ + spec_i_pt = 1; + res_len += id_len; + res_len += + sizeof(struct scsi_per_res_out_trans_ids); + } + } + } +retry: + if (res_buf != NULL) { + free(res_buf); + res_buf = NULL; + } + res_buf = malloc(res_len); + if (res_buf == NULL) { + warn("%s: error allocating %d bytes", __func__, res_len); + error = 1; + goto bailout; + } + bzero(res_buf, res_len); + + if (in != 0) { + scsi_persistent_reserve_in(&ccb->csio, + /*retries*/ retry_count, + /*cbfcnp*/ NULL, + /*tag_action*/ MSG_SIMPLE_Q_TAG, + /*service_action*/ action, + /*data_ptr*/ res_buf, + /*dxfer_len*/ res_len, + /*sense_len*/ SSD_FULL_SIZE, + /*timeout*/ timeout ? timeout :5000); + + } else { + switch (action) { + case SPRO_REGISTER: + if (spec_i_pt != 0) { + struct scsi_per_res_out_trans_ids *id_hdr; + uint8_t *bufptr; + + bufptr = res_buf + + sizeof(struct scsi_per_res_out_parms) + + sizeof(struct scsi_per_res_out_trans_ids); + STAILQ_FOREACH(id, &transport_id_list, links) { + bcopy(id->hdr, bufptr, id->alloc_len); + bufptr += id->alloc_len; + } + id_hdr = (struct scsi_per_res_out_trans_ids *) + (res_buf + + sizeof(struct scsi_per_res_out_parms)); + scsi_ulto4b(id_len, id_hdr->additional_length); + } + case SPRO_REG_IGNO: + case SPRO_PREEMPT: + case SPRO_PRE_ABO: + case SPRO_RESERVE: + case SPRO_RELEASE: + case SPRO_CLEAR: + case SPRO_REPL_LOST_RES: { + struct scsi_per_res_out_parms *parms; + + parms = (struct scsi_per_res_out_parms *)res_buf; + + scsi_u64to8b(key, parms->res_key.key); + scsi_u64to8b(sa_key, parms->serv_act_res_key); + if (spec_i_pt != 0) + parms->flags |= SPR_SPEC_I_PT; + if (all_tg_pt != 0) + parms->flags |= SPR_ALL_TG_PT; + if (aptpl != 0) + parms->flags |= SPR_APTPL; + break; + } + case SPRO_REG_MOVE: { + struct scsi_per_res_reg_move *reg_move; + uint8_t *bufptr; + + reg_move = (struct scsi_per_res_reg_move *)res_buf; + + scsi_u64to8b(key, reg_move->res_key.key); + scsi_u64to8b(sa_key, reg_move->serv_act_res_key); + if (unreg != 0) + reg_move->flags |= SPR_REG_MOVE_UNREG; + if (aptpl != 0) + reg_move->flags |= SPR_REG_MOVE_APTPL; + scsi_ulto2b(rel_tgt_port, reg_move->rel_trgt_port_id); + id = STAILQ_FIRST(&transport_id_list); + /* + * This shouldn't happen, since we already checked + * the number of IDs above. + */ + if (id == NULL) { + warnx("%s: No transport IDs found!", __func__); + error = 1; + goto bailout; + } + bufptr = (uint8_t *)®_move[1]; + bcopy(id->hdr, bufptr, id->alloc_len); + scsi_ulto4b(id->alloc_len, + reg_move->transport_id_length); + break; + } + default: + break; + } + scsi_persistent_reserve_out(&ccb->csio, + /*retries*/ retry_count, + /*cbfcnp*/ NULL, + /*tag_action*/ MSG_SIMPLE_Q_TAG, + /*service_action*/ action, + /*scope*/ scope, + /*res_type*/ res_type, + /*data_ptr*/ res_buf, + /*dxfer_len*/ res_len, + /*sense_len*/ SSD_FULL_SIZE, + /*timeout*/ timeout ?timeout :5000); + } + + /* Disable freezing the device queue */ + ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; + + if (err_recover != 0) + ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; + + if (cam_send_ccb(device, ccb) < 0) { + warn("error sending PERSISTENT RESERVE %s", (in != 0) ? + "IN" : "OUT"); + + if (verbosemode != 0) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + } + + error = 1; + goto bailout; + } + + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + if (verbosemode != 0) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + } + error = 1; + goto bailout; + } + + if (in == 0) + goto bailout; + + valid_len = res_len - ccb->csio.resid; + + switch (action) { + case SPRI_RK: + case SPRI_RR: + case SPRI_RS: { + struct scsi_per_res_in_header *hdr; + uint32_t hdr_len; + + if (valid_len < sizeof(*hdr)) { + warnx("%s: only got %d valid bytes, need %zd", + __func__, valid_len, sizeof(*hdr)); + error = 1; + goto bailout; + } + hdr = (struct scsi_per_res_in_header *)res_buf; + hdr_len = scsi_4btoul(hdr->length); + + if (hdr_len > (res_len - sizeof(*hdr))) { + res_len = hdr_len + sizeof(*hdr); + goto retry; + } + + if (action == SPRI_RK) { + persist_print_keys(hdr, valid_len); + } else if (action == SPRI_RR) { + persist_print_res(hdr, valid_len); + } else { + persist_print_full(hdr, valid_len); + } + break; + } + case SPRI_RC: { + struct scsi_per_res_cap *cap; + uint32_t cap_len; + + if (valid_len < sizeof(*cap)) { + warnx("%s: only got %u valid bytes, need %zd", + __func__, valid_len, sizeof(*cap)); + error = 1; + goto bailout; + } + cap = (struct scsi_per_res_cap *)res_buf; + cap_len = scsi_2btoul(cap->length); + if (cap_len != sizeof(*cap)) { + /* + * We should be able to deal with this, + * it's just more trouble. + */ + warnx("%s: reported size %u is different " + "than expected size %zd", __func__, + cap_len, sizeof(*cap)); + } + + /* + * If there is more data available, grab it all, + * even though we don't really know what to do with + * the extra data since it obviously wasn't in the + * spec when this code was written. + */ + if (cap_len > res_len) { + res_len = cap_len; + goto retry; + } + persist_print_cap(cap, valid_len); + break; + } + default: + break; + } + +bailout: + free(res_buf); + + if (ccb != NULL) + cam_freeccb(ccb); + + STAILQ_FOREACH_SAFE(id, &transport_id_list, links, id2) { + STAILQ_REMOVE(&transport_id_list, id, persist_transport_id, + links); + free(id); + } + return (error); +} diff --git a/sbin/casperd/casperd.8 b/sbin/casperd/casperd.8 index ebe560dbb9e..d60b9f3fe29 100644 --- a/sbin/casperd/casperd.8 +++ b/sbin/casperd/casperd.8 @@ -122,5 +122,5 @@ daemon exits 0 on success, and >0 if an error occurs. The .Nm was implemented by -.An Pawel Jakub Dawidek Aq pawel@dawidek.net +.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net under sponsorship from the FreeBSD Foundation. diff --git a/sbin/dhclient/bpf.c b/sbin/dhclient/bpf.c index 7c2e53116cd..78b9eb624e8 100644 --- a/sbin/dhclient/bpf.c +++ b/sbin/dhclient/bpf.c @@ -43,8 +43,6 @@ #include __FBSDID("$FreeBSD$"); -#include - #include "dhcpd.h" #include "privsep.h" #include diff --git a/sbin/dhclient/dhclient-script.8 b/sbin/dhclient/dhclient-script.8 index fdb46a7774b..2fae9f67cbe 100644 --- a/sbin/dhclient/dhclient-script.8 +++ b/sbin/dhclient/dhclient-script.8 @@ -273,7 +273,7 @@ but current scripts do not do this. The original version of .Nm was written for the Internet Software Consortium by -.An Ted Lemon Aq mellon@fugue.com +.An Ted Lemon Aq Mt mellon@fugue.com in cooperation with Vixie Enterprises. .Pp The @@ -281,7 +281,7 @@ The implementation of .Nm was written by -.An Kenneth R. Westerback Aq krw@openbsd.org . +.An Kenneth R. Westerback Aq Mt krw@openbsd.org . .Sh BUGS If more than one interface is being used, there is no obvious way to avoid clashes between server-supplied configuration parameters - for diff --git a/sbin/dhclient/dhclient.8 b/sbin/dhclient/dhclient.8 index d2b8f437f7d..c6940da8963 100644 --- a/sbin/dhclient/dhclient.8 +++ b/sbin/dhclient/dhclient.8 @@ -188,9 +188,9 @@ The .Nm utility was written by -.An Ted Lemon Aq mellon@fugue.com +.An Ted Lemon Aq Mt mellon@fugue.com and -.An Elliot Poger Aq elliot@poger.com . +.An Elliot Poger Aq Mt elliot@poger.com . .Pp The current implementation was reworked by -.An Henning Brauer Aq henning@openbsd.org . +.An Henning Brauer Aq Mt henning@openbsd.org . diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index c43bda9f480..22b21f1da68 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -56,8 +56,6 @@ #include __FBSDID("$FreeBSD$"); -#include - #include "dhcpd.h" #include "privsep.h" diff --git a/sbin/dhclient/dhclient.conf.5 b/sbin/dhclient/dhclient.conf.5 index 167239ef63c..3b6ae044343 100644 --- a/sbin/dhclient/dhclient.conf.5 +++ b/sbin/dhclient/dhclient.conf.5 @@ -537,8 +537,8 @@ The .Xr dhclient 8 utility was written by -.An Ted Lemon Aq mellon@vix.com +.An Ted Lemon Aq Mt mellon@vix.com under a contract with Vixie Labs. .Pp The current implementation was reworked by -.An Henning Brauer Aq henning@openbsd.org . +.An Henning Brauer Aq Mt henning@openbsd.org . diff --git a/sbin/dhclient/dhclient.leases.5 b/sbin/dhclient/dhclient.leases.5 index b1f0f3d8bd5..f48b106287c 100644 --- a/sbin/dhclient/dhclient.leases.5 +++ b/sbin/dhclient/dhclient.leases.5 @@ -88,8 +88,8 @@ The .Xr dhclient 8 utility was written by -.An Ted Lemon Aq mellon@vix.com +.An Ted Lemon Aq Mt mellon@vix.com under a contract with Vixie Labs. .Pp The current implementation was reworked by -.An Henning Brauer Aq henning@openbsd.org . +.An Henning Brauer Aq Mt henning@openbsd.org . diff --git a/sbin/dhclient/dhcp-options.5 b/sbin/dhclient/dhcp-options.5 index 1405839a9f2..4b65fa72308 100644 --- a/sbin/dhclient/dhcp-options.5 +++ b/sbin/dhclient/dhcp-options.5 @@ -603,8 +603,8 @@ The .Xr dhcpd 8 utility was written by -.An Ted Lemon Aq mellon@vix.com +.An Ted Lemon Aq Mt mellon@vix.com under a contract with Vixie Labs. .Pp The current implementation was reworked by -.An Henning Brauer Aq henning@openbsd.org . +.An Henning Brauer Aq Mt henning@openbsd.org . diff --git a/sbin/etherswitchcfg/etherswitchcfg.c b/sbin/etherswitchcfg/etherswitchcfg.c index dd68e67c4ec..f7f117ae3e2 100644 --- a/sbin/etherswitchcfg/etherswitchcfg.c +++ b/sbin/etherswitchcfg/etherswitchcfg.c @@ -235,6 +235,8 @@ set_port_media(struct cfg *cfg, char *argv[]) p.es_ifmr.ifm_count = IFMEDIAREQ_NULISTENTRIES; if (ioctl(cfg->fd, IOETHERSWITCHGETPORT, &p) != 0) err(EX_OSERR, "ioctl(IOETHERSWITCHGETPORT)"); + if (p.es_ifmr.ifm_count == 0) + return; subtype = get_media_subtype(IFM_TYPE(ifm_ulist[0]), argv[1]); p.es_ifr.ifr_media = (p.es_ifmr.ifm_current & IFM_IMASK) | IFM_TYPE(ifm_ulist[0]) | subtype; diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c index 34b96efd286..819c1c72a85 100644 --- a/sbin/fdisk/fdisk.c +++ b/sbin/fdisk/fdisk.c @@ -507,7 +507,6 @@ print_part(const struct dos_partition *partp) static void init_boot(void) { -#ifndef __ia64__ const char *fname; int fdesc, n; struct stat sb; @@ -529,15 +528,6 @@ init_boot(void) err(1, "%s", fname); if (n != mboot.bootinst_size) errx(1, "%s: short read", fname); -#else - if (mboot.bootinst != NULL) - free(mboot.bootinst); - mboot.bootinst_size = secsize; - if ((mboot.bootinst = malloc(mboot.bootinst_size)) == NULL) - errx(1, "unable to allocate boot block buffer"); - memset(mboot.bootinst, 0, mboot.bootinst_size); - le16enc(&mboot.bootinst[DOSMAGICOFFSET], DOSMAGIC); -#endif } diff --git a/sbin/ffsinfo/ffsinfo.8 b/sbin/ffsinfo/ffsinfo.8 index 9753cf7c0cf..d3c8e9f4ff0 100644 --- a/sbin/ffsinfo/ffsinfo.8 +++ b/sbin/ffsinfo/ffsinfo.8 @@ -134,9 +134,9 @@ The utility first appeared in .Fx 4.4 . .Sh AUTHORS -.An Christoph Herrmann Aq chm@FreeBSD.org -.An Thomas-Henning von Kamptz Aq tomsoft@FreeBSD.org -.An The GROWFS team Aq growfs@Tomsoft.COM +.An Christoph Herrmann Aq Mt chm@FreeBSD.org +.An Thomas-Henning von Kamptz Aq Mt tomsoft@FreeBSD.org +.An The GROWFS team Aq Mt growfs@Tomsoft.COM .Sh BUGS Snapshots are handled like plain files. They should get their own level to provide for independent control of the diff --git a/sbin/fsck/Makefile b/sbin/fsck/Makefile index 22de03c4da7..d0c45dbfd79 100644 --- a/sbin/fsck/Makefile +++ b/sbin/fsck/Makefile @@ -5,4 +5,6 @@ PROG= fsck SRCS= fsck.c fsutil.c preen.c MAN= fsck.8 +NO_PIE= yes + .include diff --git a/sbin/fsck/fsck.8 b/sbin/fsck/fsck.8 index 3fa113afe0c..5d2a019ddbf 100644 --- a/sbin/fsck/fsck.8 +++ b/sbin/fsck/fsck.8 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 25, 2009 +.Dd May 23, 2014 .Dt FSCK 8 .Os .Sh NAME @@ -111,6 +111,18 @@ The disk drive containing each file system is inferred from the shortest prefix of the device name that ends in a digit; the remaining characters are assumed to be the partition and slice designators. .Pp +If the +.Fl t +or +.Fl T +flags are not specified, +.Nm +will attempt to determine the file system type and call the +appropriated file system check utility. +Failure to detect the file system type will cause +.Nm +to fail with a message that the partition has an unknown file system type. +.Pp The options are as follows: .Bl -tag -width indent .It Fl C diff --git a/sbin/fsck_msdosfs/check.c b/sbin/fsck_msdosfs/check.c index 1fb005ddd8d..083389e0993 100644 --- a/sbin/fsck_msdosfs/check.c +++ b/sbin/fsck_msdosfs/check.c @@ -142,7 +142,7 @@ checkfilesys(const char *fname) goto out; /* now write the FATs */ - if (mod & FSFATMOD) { + if (mod & (FSFATMOD|FSFIXFAT)) { if (ask(1, "Update FATs")) { mod |= writefat(dosfs, &boot, fat, mod & FSFIXFAT); if (mod & FSFATAL) diff --git a/sbin/fsck_msdosfs/dir.c b/sbin/fsck_msdosfs/dir.c index 008d0b3398f..e8d6475736c 100644 --- a/sbin/fsck_msdosfs/dir.c +++ b/sbin/fsck_msdosfs/dir.c @@ -206,7 +206,7 @@ static char longName[DOSLONGNAMELEN] = ""; static u_char *buffer = NULL; static u_char *delbuf = NULL; -struct dosDirEntry *rootDir; +static struct dosDirEntry *rootDir; static struct dosDirEntry *lostDir; /* @@ -419,13 +419,14 @@ checksize(struct bootblock *boot, struct fatEntry *fat, u_char *p, fullpath(dir)); if (ask(1, "Drop superfluous clusters")) { cl_t cl; - u_int32_t sz = 0; + u_int32_t sz, len; - for (cl = dir->head; (sz += boot->ClusterSize) < - dir->size;) + for (cl = dir->head, len = sz = 0; + (sz += boot->ClusterSize) < dir->size; len++) cl = fat[cl].next; clearchain(boot, fat, fat[cl].next); fat[cl].next = CLUST_EOF; + fat[dir->head].length = len; return FSFATMOD; } else return FSERROR; diff --git a/sbin/fsck_msdosfs/ext.h b/sbin/fsck_msdosfs/ext.h index 681cde998e2..ef9c420c90d 100644 --- a/sbin/fsck_msdosfs/ext.h +++ b/sbin/fsck_msdosfs/ext.h @@ -26,7 +26,7 @@ */ #ifndef EXT_H -#define EXT_H +#define EXT_H #include @@ -43,8 +43,6 @@ extern int preen; /* we are preening */ extern int rdonly; /* device is opened read only (supersedes above) */ extern int skipclean; /* skip clean file systems if preening */ -extern struct dosDirEntry *rootDir; - /* * function declarations */ @@ -71,8 +69,8 @@ int checkfilesys(const char *); #define FSFATMOD 4 /* The FAT was modified */ #define FSERROR 8 /* Some unrecovered error remains */ #define FSFATAL 16 /* Some unrecoverable error occurred */ -#define FSDIRTY 32 /* File system is dirty */ -#define FSFIXFAT 64 /* Fix file system FAT */ +#define FSDIRTY 32 /* File system is dirty */ +#define FSFIXFAT 64 /* Fix file system FAT */ /* * read a boot block in a machine independent fashion and translate diff --git a/sbin/fsck_msdosfs/fat.c b/sbin/fsck_msdosfs/fat.c index d2d144449ec..b509c50246a 100644 --- a/sbin/fsck_msdosfs/fat.c +++ b/sbin/fsck_msdosfs/fat.c @@ -242,7 +242,7 @@ readfat(int fs, struct bootblock *boot, u_int no, struct fatEntry **fp) ret |= FSDIRTY; else { /* just some odd byte sequence in FAT */ - + switch (boot->ClustMask) { case CLUST32_MASK: pwarn("%s (%02x%02x%02x%02x%02x%02x%02x%02x)\n", @@ -262,7 +262,7 @@ readfat(int fs, struct bootblock *boot, u_int no, struct fatEntry **fp) break; } - + if (ask(1, "Correct")) ret |= FSFIXFAT; } @@ -436,7 +436,15 @@ tryclear(struct bootblock *boot, struct fatEntry *fat, cl_t head, cl_t *truncp) clearchain(boot, fat, head); return FSFATMOD; } else if (ask(0, "Truncate")) { + uint32_t len; + cl_t p; + + for (p = head, len = 0; + p >= CLUST_FIRST && p < boot->NumClusters; + p = fat[p].next, len++) + continue; *truncp = CLUST_EOF; + fat[head].length = len; return FSFATMOD; } else return FSERROR; @@ -465,7 +473,8 @@ checkfat(struct bootblock *boot, struct fatEntry *fat) /* follow the chain and mark all clusters on the way */ for (len = 0, p = head; - p >= CLUST_FIRST && p < boot->NumClusters; + p >= CLUST_FIRST && p < boot->NumClusters && + fat[p].head != head; p = fat[p].next) { fat[p].head = head; len++; @@ -486,10 +495,10 @@ checkfat(struct bootblock *boot, struct fatEntry *fat) continue; /* follow the chain to its end (hopefully) */ - for (p = head; + for (len = fat[head].length, p = head; (n = fat[p].next) >= CLUST_FIRST && n < boot->NumClusters; p = n) - if (fat[n].head != head) + if (fat[n].head != head || len-- < 2) break; if (n >= CLUST_EOFS) continue; @@ -497,14 +506,20 @@ checkfat(struct bootblock *boot, struct fatEntry *fat) if (n == CLUST_FREE || n >= CLUST_RSRVD) { pwarn("Cluster chain starting at %u ends with cluster marked %s\n", head, rsrvdcltype(n)); +clear: ret |= tryclear(boot, fat, head, &fat[p].next); continue; } if (n < CLUST_FIRST || n >= boot->NumClusters) { pwarn("Cluster chain starting at %u ends with cluster out of range (%u)\n", - head, n); - ret |= tryclear(boot, fat, head, &fat[p].next); - continue; + head, n); + goto clear; + } + if (head == fat[n].head) { + pwarn("Cluster chain starting at %u loops at cluster %u\n", + + head, p); + goto clear; } pwarn("Cluster chains starting at %u and %u are linked at cluster %u\n", head, fat[n].head, n); @@ -621,13 +636,15 @@ writefat(int fs, struct bootblock *boot, struct fatEntry *fat, int correct_fat) default: if (fat[cl].next == CLUST_FREE) boot->NumFree++; - if (cl + 1 < boot->NumClusters - && fat[cl + 1].next == CLUST_FREE) - boot->NumFree++; *p++ = (u_char)fat[cl].next; - *p++ = (u_char)((fat[cl].next >> 8) & 0xf) - |(u_char)(fat[cl+1].next << 4); - *p++ = (u_char)(fat[++cl].next >> 4); + *p = (u_char)((fat[cl].next >> 8) & 0xf); + cl++; + if (cl >= boot->NumClusters) + break; + if (fat[cl].next == CLUST_FREE) + boot->NumFree++; + *p++ |= (u_char)(fat[cl + 1].next << 4); + *p++ = (u_char)(fat[cl + 1].next >> 4); break; } } @@ -653,7 +670,7 @@ checklost(int dosfs, struct bootblock *boot, struct fatEntry *fat) cl_t head; int mod = FSOK; int ret; - + for (head = CLUST_FIRST; head < boot->NumClusters; head++) { /* find next untravelled chain */ if (fat[head].head != head @@ -677,8 +694,9 @@ checklost(int dosfs, struct bootblock *boot, struct fatEntry *fat) if (boot->bpbFSInfo) { ret = 0; - if (boot->FSFree != boot->NumFree) { - pwarn("Free space in FSInfo block (%d) not correct (%d)\n", + if (boot->FSFree != 0xffffffffU && + boot->FSFree != boot->NumFree) { + pwarn("Free space in FSInfo block (%u) not correct (%u)\n", boot->FSFree, boot->NumFree); if (ask(1, "Fix")) { boot->FSFree = boot->NumFree; diff --git a/sbin/fsdb/Makefile b/sbin/fsdb/Makefile index f921e89828c..21ac09f9c66 100644 --- a/sbin/fsdb/Makefile +++ b/sbin/fsdb/Makefile @@ -9,8 +9,8 @@ SRCS= fsdb.c fsdbutil.c \ pass5.c setup.c utilities.c ffs_subr.c ffs_tables.c globs.c CFLAGS+= -I${.CURDIR}/../fsck_ffs WARNS?= 2 -LDADD= -ledit -ltermcap -DPADD= ${LIBEDIT} ${LIBTERMCAP} +LDADD= -ledit -ltermcapw +DPADD= ${LIBEDIT} ${LIBTERMCAPW} .PATH: ${.CURDIR}/../fsck_ffs ${.CURDIR}/../../sys/ufs/ffs .include diff --git a/sbin/fsdb/Makefile.depend b/sbin/fsdb/Makefile.depend index 6bb45ddb04c..6653b3c047e 100644 --- a/sbin/fsdb/Makefile.depend +++ b/sbin/fsdb/Makefile.depend @@ -12,7 +12,7 @@ DIRDEPS = \ lib/libcompiler_rt \ lib/libedit \ lib/libufs \ - lib/ncurses/ncurses \ + lib/ncurses/ncursesw \ .include diff --git a/sbin/fsirand/fsirand.8 b/sbin/fsirand/fsirand.8 index 3156787a8bd..f3fbd8d6c15 100644 --- a/sbin/fsirand/fsirand.8 +++ b/sbin/fsirand/fsirand.8 @@ -107,7 +107,7 @@ A version first appeared in .Fx 2.2.5 . .Sh AUTHORS -.An Todd C. Miller Aq Todd.Miller@courtesan.com +.An Todd C. Miller Aq Mt Todd.Miller@courtesan.com .Sh CAVEATS Since .Nm diff --git a/sbin/gbde/gbde.8 b/sbin/gbde/gbde.8 index efd3156b4da..47c2e2118d3 100644 --- a/sbin/gbde/gbde.8 +++ b/sbin/gbde/gbde.8 @@ -243,14 +243,14 @@ To destroy all copies of the masterkey: This software was developed for the .Fx Project by -.An "Poul-Henning Kamp" +.An Poul-Henning Kamp and NAI Labs, the Security Research Division of Network Associates, Inc.\& under DARPA/SPAWAR contract N66001-01-C-8035 .Pq Dq CBOSS , as part of the DARPA CHATS research program. .Sh AUTHORS -.An "Poul-Henning Kamp" Aq phk@FreeBSD.org +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org .Sh BUGS The cryptographic algorithms and the overall design have not been attacked mercilessly for over 10 years by a gang of cryptoanalysts. diff --git a/sbin/geom/class/cache/gcache.8 b/sbin/geom/class/cache/gcache.8 index b9f03bd7f3a..b0f1c7abf1f 100644 --- a/sbin/geom/class/cache/gcache.8 +++ b/sbin/geom/class/cache/gcache.8 @@ -189,4 +189,4 @@ The utility appeared in .Fx 7.0 . .Sh AUTHORS -.An Ruslan Ermilov Aq ru@FreeBSD.org +.An Ruslan Ermilov Aq Mt ru@FreeBSD.org diff --git a/sbin/geom/class/concat/gconcat.8 b/sbin/geom/class/concat/gconcat.8 index b797a1c24dc..d874b087b64 100644 --- a/sbin/geom/class/concat/gconcat.8 +++ b/sbin/geom/class/concat/gconcat.8 @@ -194,4 +194,4 @@ The utility appeared in .Fx 5.3 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org diff --git a/sbin/geom/class/eli/geli.8 b/sbin/geom/class/eli/geli.8 index 55cf844f6f7..c435859ea02 100644 --- a/sbin/geom/class/eli/geli.8 +++ b/sbin/geom/class/eli/geli.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 1, 2013 +.Dd June 18, 2014 .Dt GELI 8 .Os .Sh NAME @@ -331,7 +331,7 @@ key length. .It Nm AES-XTS .Em 128 , 256 -.It Nm AES-CBC , Nm Camilla-CBC +.It Nm AES-CBC , Nm Camellia-CBC .Em 128 , 192, 256 @@ -353,13 +353,14 @@ because encryption/decryption which requires an initialization vector is done per sector; fewer sectors means less computational work. .It Fl V Ar version Metadata version to use. -This option is helpful when creating provider that may be used by older +This option is helpful when creating a provider that may be used by older .Nm FreeBSD/GELI versions. Consult the .Sx HISTORY section to find which metadata version is supported by which FreeBSD version. -Note that using older metadata version may limit numer of features available. +Note that using an older version of metadata may limit the number of +features available. .El .It Cm attach Attach the given provider. @@ -619,7 +620,7 @@ devices. .El .It Cm resume Resume previously suspended device. -The caller must ensure that executing this subcommand doesn't access the +The caller must ensure that executing this subcommand does not access the suspended device, leading to a deadlock. For example suspending a device which contains the file system where the .Nm @@ -823,7 +824,7 @@ Enter passphrase: .Pp Create an encrypted provider, but use two User Keys: one for your employee and one for you as the company's security officer -(so it's not a tragedy if the employee +(so it is not a tragedy if the employee .Qq accidentally forgets his passphrase): .Bd -literal -offset indent @@ -1052,6 +1053,8 @@ metadata version supported by the given FreeBSD version: .It Li 8.2 Ta 5 .Pp .It Li 9.0 Ta 6 +.Pp +.It Li 10.0 Ta 7 .El .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org diff --git a/sbin/geom/class/journal/gjournal.8 b/sbin/geom/class/journal/gjournal.8 index edef9023eb5..6eb8cde821a 100644 --- a/sbin/geom/class/journal/gjournal.8 +++ b/sbin/geom/class/journal/gjournal.8 @@ -343,4 +343,4 @@ The utility appeared in .Fx 7.0 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org diff --git a/sbin/geom/class/label/glabel.8 b/sbin/geom/class/label/glabel.8 index c1c7bc40d8d..c950e26b35a 100644 --- a/sbin/geom/class/label/glabel.8 +++ b/sbin/geom/class/label/glabel.8 @@ -130,8 +130,26 @@ GPT UUIDs (directory .Pa /dev/gptid/ ) . .El .Pp -Generic labels are created in the directory -.Pa /dev/label/ . +Generic disk ID strings are exported as labels in the format +.Pa /dev/diskid/GEOM_CLASS-ident +e.g. +.Pa /dev/diskid/DISK-6QG3Z026 . +.Pp +Generic labels created and managed solely by +.Xr glabel 8 +are created in the +.Pa /dev/label/ +directory. +.Pp +Note that for all label types, nested GEOM classes will cause additional +device nodes to be created, with context-specific data appended to their +names. E.g. for every node like +.Pa /dev/label/bigdisk +there will be additional entries for any partitions which the device +contains, like +.Pa /dev/label/bigdiskp1 +and +.Pa /dev/label/bigdiskp1a . .Pp The first argument to .Nm @@ -205,6 +223,19 @@ This can be set to a number between 0 and 2 inclusive. If set to 0 minimal debug information is printed, and if set to 2 the maximum amount of debug information is printed. .El +.Bl -tag -width indent +.It Va kern.geom.label.*.enable : No 1 +Most +.Nm LABEL +providers implement a +.Xr sysctl 8 +flag and a tunable variable named in the above format. This flag +controls if the label provider will be active, tasting devices +and creating label nodes in the +.Xr devfs 5 +tree. It is sometimes desirable to disable certain label types if +they conflict with other classes in complex GEOM topologies. +.El .Sh EXIT STATUS Exit status is 0 on success, and 1 if the command fails. .Sh EXAMPLES @@ -241,4 +272,4 @@ The utility appeared in .Fx 5.3 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org diff --git a/sbin/geom/class/mirror/gmirror.8 b/sbin/geom/class/mirror/gmirror.8 index bca5bdba974..fb501ca3de6 100644 --- a/sbin/geom/class/mirror/gmirror.8 +++ b/sbin/geom/class/mirror/gmirror.8 @@ -376,7 +376,7 @@ The utility appeared in .Fx 5.3 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org .Sh BUGS There should be a way to change a component's priority inside a running mirror. .Pp diff --git a/sbin/geom/class/mountver/gmountver.8 b/sbin/geom/class/mountver/gmountver.8 index 02d77dbffd9..c9a9c0ac831 100644 --- a/sbin/geom/class/mountver/gmountver.8 +++ b/sbin/geom/class/mountver/gmountver.8 @@ -127,4 +127,4 @@ The utility appeared in .Fx 9.0 . .Sh AUTHORS -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org +.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org diff --git a/sbin/geom/class/multipath/gmultipath.8 b/sbin/geom/class/multipath/gmultipath.8 index 81b85ddbd64..07ac01ed6dc 100644 --- a/sbin/geom/class/multipath/gmultipath.8 +++ b/sbin/geom/class/multipath/gmultipath.8 @@ -360,6 +360,6 @@ GEOM_MULTIPATH: da2 added to FRED .Xr mount 8 , .Xr newfs 8 , .Xr sysctl 8 -.Sh AUTHOR -.An Matthew Jacob Aq mjacob@FreeBSD.org -.An Alexander Motin Aq mav@FreeBSD.org +.Sh AUTHORS +.An Matthew Jacob Aq Mt mjacob@FreeBSD.org +.An Alexander Motin Aq Mt mav@FreeBSD.org diff --git a/sbin/geom/class/nop/gnop.8 b/sbin/geom/class/nop/gnop.8 index 2bcbef30d4f..4770090dd70 100644 --- a/sbin/geom/class/nop/gnop.8 +++ b/sbin/geom/class/nop/gnop.8 @@ -176,4 +176,4 @@ The utility appeared in .Fx 5.3 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org diff --git a/sbin/geom/class/part/gpart.8 b/sbin/geom/class/part/gpart.8 index 194a19fdf46..0e3ed7f96b9 100644 --- a/sbin/geom/class/part/gpart.8 +++ b/sbin/geom/class/part/gpart.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 2, 2014 +.Dd July 1, 2014 .Dt GPART 8 .Os .Sh NAME @@ -491,6 +491,12 @@ called Requires the .Cm GEOM_PART_BSD kernel option. +.It Cm BSD64 +64-bit implementation of BSD disklabel used in DragonFlyBSD to subdivide MBR +or GPT partitions. +Requires the +.Cm GEOM_PART_BSD64 +kernel option. .It Cm LDM The Logical Disk Manager is an implementation of volume manager for Microsoft Windows NT. @@ -544,8 +550,20 @@ The .Nm utility also allows the user to specify scheme-specific partition types for partition types that do not have symbolic names. -Symbolic names currently understood are: -.Bl -tag -width ".Cm ms-ldm-metadata" +Symbolic names currently understood and used by +.Fx +are: +.Bl -tag -width ".Cm dragonfly-disklabel64" +.It Cm apple-boot +The system partition dedicated to storing boot loaders on some Apple +systems. +The scheme-specific types are +.Qq Li "!171" +for MBR, +.Qq Li "!Apple_Bootstrap" +for APM, and +.Qq Li "!426f6f74-0000-11aa-aa11-00306543ecac" +for GPT. .It Cm bios-boot The system partition dedicated to second stage of the boot loader program. Usually it is used by the GRUB 2 loader for GPT partitioning schemes. @@ -557,16 +575,6 @@ Interface (EFI). In such cases, the GPT partitioning scheme is used and the actual partition type for the system partition can also be specified as .Qq Li "!c12a7328-f81f-11d2-ba4b-00a0c93ec93b" . -.It Cm fat16 -A partition that contains a FAT16 filesystem. -The scheme-specific type is -.Qq Li "!6" -for MBR. -.It Cm fat32 -A partition that contains a FAT32 filesystem. -The scheme-specific type is -.Qq Li "!11" -for MBR. .It Cm freebsd A .Fx @@ -625,6 +633,145 @@ The scheme-specific types are for APM, .Qq Li "!516e7cba-6ecf-11d6-8ff8-00022d09712b" for GPT, and 0x0904 for VTOC8. +.El +.Pp +Another symbolic names that can be used with +.Cm gpart +utility are: +.Bl -tag -width ".Cm dragonfly-disklabel64" +.It Cm apple-boot +An Apple Mac OS X partition dedicated to bootloader. +The scheme-specific types are +.Qq Li "!Apple_Bootstrap" +for APM and +.Qq Li "!426f6f74-0000-11aa-aa11-00306543ecac" +for GPT. +.It Cm apple-hfs +An Apple Mac OS X partition that contains a HFS or HFS+ filesystem. +The scheme-specific types are +.Qq Li "!Apple_HFS" +for APM and +.Qq Li "!48465300-0000-11aa-aa11-00306543ecac" +for GPT. +.It Cm apple-label +An Apple Mac OS X partition dedicated to partition metadata that descibes +disk device. +The scheme-specific type is +.Qq Li "!4c616265-6c00-11aa-aa11-00306543ecac" +for GPT. +.It Cm apple-raid +An Apple Mac OS X partition used in a software RAID configuration. +The scheme-specific type is +.Qq Li "!52414944-0000-11aa-aa11-00306543ecac" +for GPT. +.It Cm apple-raid-offline +An Apple Mac OS X partition used in a software RAID configuration. +The scheme-specific type is +.Qq Li "!52414944-5f4f-11aa-aa11-00306543ecac" +for GPT. +.It Cm apple-tv-recovery +An Apple Mac OS X partition used by Apple TV. +The scheme-specific type is +.Qq Li "!5265636f-7665-11aa-aa11-00306543ecac" +for GPT. +.It Cm apple-ufs +An Apple Mac OS X partition that contains a UFS filesystem. +The scheme-specific types are +.Qq Li "!Apple_UNIX_SVR2" +for APM and +.Qq Li "!55465300-0000-11aa-aa11-00306543ecac" +for GPT. +.It Cm dragonfly-label32 +A DragonFlyBSD partition subdivided into filesystems with a +.Bx +disklabel. +The scheme-specific type is +.Qq Li "!9d087404-1ca5-11dc-8817-01301bb8a9f5" +for GPT. +.It Cm dragonfly-label64 +A DragonFlyBSD partition subdivided into filesystems with a +disklabel64. +The scheme-specific type is +.Qq Li "!3d48ce54-1d16-11dc-8696-01301bb8a9f5" +for GPT. +.It Cm dragonfly-legacy +A legacy partition type used in DragonFlyBSD. +The scheme-specific type is +.Qq Li "!bd215ab2-1d16-11dc-8696-01301bb8a9f5" +for GPT. +.It Cm dragonfly-ccd +A DragonFlyBSD partition used with Concatenated Disk driver. +The scheme-specific type is +.Qq Li "!dbd5211b-1ca5-11dc-8817-01301bb8a9f5" +for GPT. +.It Cm dragonfly-hammer +A DragonFlyBSD partition that contains a Hammer filesystem. +The scheme-specific type is +.Qq Li "!61dc63ac-6e38-11dc-8513-01301bb8a9f5" +for GPT. +.It Cm dragonfly-hammer2 +A DragonFlyBSD partition that contains a Hammer2 filesystem. +The scheme-specific type is +.Qq Li "!5cbb9ad1-862d-11dc-a94d-01301bb8a9f5" +for GPT. +.It Cm dragonfly-swap +A DragonFlyBSD partition dedicated to swap space. +The scheme-specific type is +.Qq Li "!9d58fdbd-1ca5-11dc-8817-01301bb8a9f5" +for GPT. +.It Cm dragonfly-ufs +A DragonFlyBSD partition that contains an UFS1 filesystem. +The scheme-specific type is +.Qq Li "!9d94ce7c-1ca5-11dc-8817-01301bb8a9f5" +for GPT. +.It Cm dragonfly-vinum +A DragonFlyBSD partition used with Logical Volume Manager. +The scheme-specific type is +.Qq Li "!9dd4478f-1ca5-11dc-8817-01301bb8a9f5" +for GPT. +.It Cm ebr +A partition subdivided into filesystems with a EBR. +The scheme-specific type is +.Qq Li "!5" +for MBR. +.It Cm fat16 +A partition that contains a FAT16 filesystem. +The scheme-specific type is +.Qq Li "!6" +for MBR. +.It Cm fat32 +A partition that contains a FAT32 filesystem. +The scheme-specific type is +.Qq Li "!11" +for MBR. +.It Cm linux-data +A Linux partition that contains some filesystem with data. +The scheme-specific types are +.Qq Li "!131" +for MBR and +.Qq Li "!0fc63daf-8483-4772-8e79-3d69d8477de4" +for GPT. +.It Cm linux-lvm +A Linux partition dedicated to Logical Volume Manager. +The scheme-specific types are +.Qq Li "!142" +for MBR and +.Qq Li "!e6d6d379-f507-44c2-a23c-238f2a3df928" +for GPT. +.It Cm linux-raid +A Linux partition used in a software RAID configuration. +The scheme-specific types are +.Qq Li "!253" +for MBR and +.Qq Li "!a19d880f-05fc-4d3b-a006-743f0f84911e" +for GPT. +.It Cm linux-swap +A Linux partition dedicated to swap space. +The scheme-specific types are +.Qq Li "!130" +for MBR and +.Qq Li "!0657fd6d-a4ab-43c4-84e5-0933c84b4f4f" +for GPT. .It Cm mbr A partition that is sub-partitioned by a Master Boot Record (MBR). This type is known as @@ -652,11 +799,73 @@ A partition that contains Logical Disk Manager (LDM) database. The scheme-specific type is .Qq Li "!5808c8aa-7e8f-42e0-85d2-e1e90434cfb3" for GPT. +.It Cm netbsd-ccd +A NetBSD partition used with Concatenated Disk driver. +The scheme-specific type is +.Qq Li "!2db519c4-b10f-11dc-b99b-0019d1879648" +for GPT. +.It Cm netbsd-cgd +An encrypted NetBSD partition. +The scheme-specific type is +.Qq Li "!2db519ec-b10f-11dc-b99b-0019d1879648" +for GPT. +.It Cm netbsd-ffs +A NetBSD partition that contains an UFS filesystem. +The scheme-specific type is +.Qq Li "!49f48d5a-b10e-11dc-b99b-0019d1879648" +for GPT. +.It Cm netbsd-lfs +A NetBSD partition that contains an LFS filesystem. +The scheme-specific type is +.Qq Li "!49f48d82-b10e-11dc-b99b-0019d1879648" +for GPT. +.It Cm netbsd-raid +A NetBSD partition used in a software RAID configuration. +The scheme-specific type is +.Qq Li "!49f48daa-b10e-11dc-b99b-0019d1879648" +for GPT. +.It Cm netbsd-swap +A NetBSD partition dedicated to swap space. +The scheme-specific type is +.Qq Li "!49f48d32-b10e-11dc-b99b-0019d1879648" +for GPT. .It Cm ntfs A partition that contains a NTFS or exFAT filesystem. The scheme-specific type is .Qq Li "!7" for MBR. +.It Cm prep-boot +The system partition dedicated to storing boot loaders on some PowerPC systems, +notably those made by IBM. +The scheme-specific types are +.Qq Li "!65" +for MBR and +.Qq Li "!0x9e1a2d38-c612-4316-aa26-8b49521e5a8b" +for GPT. +.It Cm vmware-vmfs +A partition that contains a VMware File System (VMFS). +The scheme-specific types are +.Qq Li "!251" +for MBR and +.Qq Li "!aa31e02a-400f-11db-9590-000c2911d1b8" +for GPT. +.It Cm vmware-vmkdiag +A partition that contains a VMware diagostic filesystem. +The scheme-specific types are +.Qq Li "!252" +for MBR and +.Qq Li "!9d275380-40ad-11db-bf97-000c2911d1b8" +for GPT. +.It Cm vmware-reserved +A VMware reserved partition. +The scheme-specific type is +.Qq Li "!9198effc-31c0-11db-8f-78-000c2911d1b8" +for GPT. +.It Cm vmware-vsanhdr +A partition claimed by VMware VSAN. +The scheme-specific type is +.Qq Li "!381cfccc-7288-11e0-92ee-000c2911d0b2" +for GPT. .El .Sh ATTRIBUTES The scheme-specific attributes for EBR: @@ -828,7 +1037,7 @@ Instead, the 800 KBytes bootstrap code image should be written with the .Cm gpart bootcode command to a partition of type -.Cm freebsd-boot , +.Cm apple-boot , which should also be 800 KB in size. .Sh OPERATIONAL FLAGS Actions other than the @@ -1097,4 +1306,4 @@ The utility appeared in .Fx 7.0 . .Sh AUTHORS -.An Marcel Moolenaar Aq marcel@FreeBSD.org +.An Marcel Moolenaar Aq Mt marcel@FreeBSD.org diff --git a/sbin/geom/class/raid/graid.8 b/sbin/geom/class/raid/graid.8 index 47d7fa2c869..496e44e4ed4 100644 --- a/sbin/geom/class/raid/graid.8 +++ b/sbin/geom/class/raid/graid.8 @@ -320,5 +320,5 @@ The utility appeared in .Fx 9.0 . .Sh AUTHORS -.An Alexander Motin Aq mav@FreeBSD.org -.An M. Warner Losh Aq imp@FreeBSD.org +.An Alexander Motin Aq Mt mav@FreeBSD.org +.An M. Warner Losh Aq Mt imp@FreeBSD.org diff --git a/sbin/geom/class/raid3/graid3.8 b/sbin/geom/class/raid3/graid3.8 index a82d3882e8a..426c94d1752 100644 --- a/sbin/geom/class/raid3/graid3.8 +++ b/sbin/geom/class/raid3/graid3.8 @@ -248,7 +248,7 @@ The utility appeared in .Fx 5.3 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org .Sh BUGS There should be a section with an implementation description. .Pp diff --git a/sbin/geom/class/sched/gsched.8 b/sbin/geom/class/sched/gsched.8 index ae04865a21b..facb5c18440 100644 --- a/sbin/geom/class/sched/gsched.8 +++ b/sbin/geom/class/sched/gsched.8 @@ -158,5 +158,5 @@ The utility first appeared in .Fx 8.1 . .Sh AUTHORS -.An Fabio Checconi Aq fabio@FreeBSD.org -.An Luigi Rizzo Aq luigi@FreeBSD.org +.An Fabio Checconi Aq Mt fabio@FreeBSD.org +.An Luigi Rizzo Aq Mt luigi@FreeBSD.org diff --git a/sbin/geom/class/shsec/gshsec.8 b/sbin/geom/class/shsec/gshsec.8 index f72c31c784c..dcfd2b39790 100644 --- a/sbin/geom/class/shsec/gshsec.8 +++ b/sbin/geom/class/shsec/gshsec.8 @@ -127,4 +127,4 @@ The utility appeared in .Fx 5.4 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org diff --git a/sbin/geom/class/stripe/geom_stripe.c b/sbin/geom/class/stripe/geom_stripe.c index 2e9e3db130b..1fb16e98c7e 100644 --- a/sbin/geom/class/stripe/geom_stripe.c +++ b/sbin/geom/class/stripe/geom_stripe.c @@ -62,7 +62,7 @@ struct g_command class_commands[] = { { 's', "stripesize", GSTRIPE_STRIPESIZE, G_TYPE_NUMBER }, G_OPT_SENTINEL }, - "[-hv] [-s stripesize] name prov prov ..." + "[-v] [-s stripesize] name prov prov ..." }, { "destroy", G_FLAG_VERBOSE, NULL, { diff --git a/sbin/geom/class/stripe/gstripe.8 b/sbin/geom/class/stripe/gstripe.8 index 33ef30bf85c..f1f34fe1060 100644 --- a/sbin/geom/class/stripe/gstripe.8 +++ b/sbin/geom/class/stripe/gstripe.8 @@ -240,4 +240,4 @@ The utility appeared in .Fx 5.3 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org diff --git a/sbin/geom/class/virstor/gvirstor.8 b/sbin/geom/class/virstor/gvirstor.8 index 0273cb41aab..bf04c1bb2c2 100644 --- a/sbin/geom/class/virstor/gvirstor.8 +++ b/sbin/geom/class/virstor/gvirstor.8 @@ -293,7 +293,7 @@ and all their structures will be physically allocated at the start of the first virstor component. This could have a significant impact on file system performance .Pq which can in some rare cases be even positive . -.Sh AUTHOR -.An Ivan Voras Aq ivoras@FreeBSD.org +.Sh AUTHORS +.An Ivan Voras Aq Mt ivoras@FreeBSD.org .Pp Sponsored by Google Summer of Code 2006. diff --git a/sbin/geom/core/geom.8 b/sbin/geom/core/geom.8 index 6e79880ef62..ab960ff9e07 100644 --- a/sbin/geom/core/geom.8 +++ b/sbin/geom/core/geom.8 @@ -203,4 +203,4 @@ The utility appeared in .Fx 5.3 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org diff --git a/sbin/ggate/ggatec/ggatec.8 b/sbin/ggate/ggatec/ggatec.8 index 09f0444fa6a..72ae4c5a9c3 100644 --- a/sbin/ggate/ggatec/ggatec.8 +++ b/sbin/ggate/ggatec/ggatec.8 @@ -178,4 +178,4 @@ client# mount_cd9660 /dev/ggate0 /cdrom The .Nm utility as well as this manual page was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org . +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org . diff --git a/sbin/ggate/ggated/ggated.8 b/sbin/ggate/ggated/ggated.8 index 3024a04230d..3560fe0bc9b 100644 --- a/sbin/ggate/ggated/ggated.8 +++ b/sbin/ggate/ggated/ggated.8 @@ -108,4 +108,4 @@ Export CD-ROM device and a file: The .Nm utility as well as this manual page was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org . +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org . diff --git a/sbin/ggate/ggatel/ggatel.8 b/sbin/ggate/ggatel/ggatel.8 index 236e550811e..1463426f238 100644 --- a/sbin/ggate/ggatel/ggatel.8 +++ b/sbin/ggate/ggatel/ggatel.8 @@ -152,4 +152,4 @@ ggatel destroy -u 5 The .Nm utility as well as this manual page was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org . +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org . diff --git a/sbin/growfs/growfs.8 b/sbin/growfs/growfs.8 index 9d62a83b974..0dab89f3594 100644 --- a/sbin/growfs/growfs.8 +++ b/sbin/growfs/growfs.8 @@ -118,10 +118,10 @@ utility first appeared in The ability to resize mounted filesystems was added in .Fx 10.0 . .Sh AUTHORS -.An Christoph Herrmann Aq chm@FreeBSD.org -.An Thomas-Henning von Kamptz Aq tomsoft@FreeBSD.org -.An The GROWFS team Aq growfs@Tomsoft.COM -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org +.An Christoph Herrmann Aq Mt chm@FreeBSD.org +.An Thomas-Henning von Kamptz Aq Mt tomsoft@FreeBSD.org +.An The GROWFS team Aq Mt growfs@Tomsoft.COM +.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org .Sh CAVEATS When expanding a file system mounted read-write, any writes to that file system will be temporarily suspended until the expansion is finished. diff --git a/sbin/gvinum/Makefile b/sbin/gvinum/Makefile index c9716e94670..1b5f948ce89 100644 --- a/sbin/gvinum/Makefile +++ b/sbin/gvinum/Makefile @@ -7,8 +7,8 @@ MAN= gvinum.8 WARNS?= 2 CFLAGS+= -I${.CURDIR}/../../sys -I${DESTDIR}/${INCLUDEDIR}/edit -DPADD= ${LIBEDIT} ${LIBTERMCAP} ${LIBDEVSTAT} ${LIBKVM} ${LIBGEOM} -LDADD= -ledit -ltermcap -ldevstat -lkvm -lgeom +DPADD= ${LIBEDIT} ${LIBTERMCAPW} ${LIBDEVSTAT} ${LIBKVM} ${LIBGEOM} +LDADD= -ledit -ltermcapw -ldevstat -lkvm -lgeom .PATH: ${.CURDIR}/../../sys/geom/vinum diff --git a/sbin/gvinum/Makefile.depend b/sbin/gvinum/Makefile.depend index e67cb4a72ca..95ff20cc34c 100644 --- a/sbin/gvinum/Makefile.depend +++ b/sbin/gvinum/Makefile.depend @@ -17,7 +17,7 @@ DIRDEPS = \ lib/libgeom \ lib/libkvm \ lib/libsbuf \ - lib/ncurses/ncurses \ + lib/ncurses/ncursesw \ .include diff --git a/sbin/gvinum/gvinum.8 b/sbin/gvinum/gvinum.8 index 703a81056f7..a8a448c8ff4 100644 --- a/sbin/gvinum/gvinum.8 +++ b/sbin/gvinum/gvinum.8 @@ -395,9 +395,9 @@ and through the 2007 Google Summer of Code program. The documentation have been updated to reflect the new functionality. .Sh AUTHORS -.An Lukas Ertl Aq le@FreeBSD.org -.An Chris Jones Aq soc-cjones@FreeBSD.org -.An Ulf Lilleengen Aq lulf@FreeBSD.org +.An Lukas Ertl Aq Mt le@FreeBSD.org +.An Chris Jones Aq Mt soc-cjones@FreeBSD.org +.An Ulf Lilleengen Aq Mt lulf@FreeBSD.org .Sh BUGS Currently, .Nm diff --git a/sbin/hastctl/hastctl.8 b/sbin/hastctl/hastctl.8 index bdca80d721a..397d4cfec0a 100644 --- a/sbin/hastctl/hastctl.8 +++ b/sbin/hastctl/hastctl.8 @@ -224,5 +224,5 @@ nodeB# application_start The .Nm was developed by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org under sponsorship of the FreeBSD Foundation. diff --git a/sbin/hastd/hast.conf.5 b/sbin/hastd/hast.conf.5 index 3d921e46c03..c7e2e33ec09 100644 --- a/sbin/hastd/hast.conf.5 +++ b/sbin/hastd/hast.conf.5 @@ -445,5 +445,5 @@ resource tank { The .Nm was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org under sponsorship of the FreeBSD Foundation. diff --git a/sbin/hastd/hastd.8 b/sbin/hastd/hastd.8 index 68c98cbc6ff..e30a11a4633 100644 --- a/sbin/hastd/hastd.8 +++ b/sbin/hastd/hastd.8 @@ -228,5 +228,5 @@ nodeA# mount -o noatime /dev/hast/shared /shared The .Nm was developed by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org under sponsorship of the FreeBSD Foundation. diff --git a/sbin/ifconfig/af_inet6.c b/sbin/ifconfig/af_inet6.c index b4db0f174cd..d2e65e4dc96 100644 --- a/sbin/ifconfig/af_inet6.c +++ b/sbin/ifconfig/af_inet6.c @@ -42,6 +42,7 @@ static const char rcsid[] = #include #include #include +#include #include #include @@ -98,20 +99,21 @@ static void setip6lifetime(const char *cmd, const char *val, int s, const struct afswtch *afp) { - time_t newval, t; + struct timespec now; + time_t newval; char *ep; - t = time(NULL); + clock_gettime(CLOCK_MONOTONIC_FAST, &now); newval = (time_t)strtoul(val, &ep, 0); if (val == ep) errx(1, "invalid %s", cmd); if (afp->af_af != AF_INET6) errx(1, "%s not allowed for the AF", cmd); if (strcmp(cmd, "vltime") == 0) { - in6_addreq.ifra_lifetime.ia6t_expire = t + newval; + in6_addreq.ifra_lifetime.ia6t_expire = now.tv_sec + newval; in6_addreq.ifra_lifetime.ia6t_vltime = newval; } else if (strcmp(cmd, "pltime") == 0) { - in6_addreq.ifra_lifetime.ia6t_preferred = t + newval; + in6_addreq.ifra_lifetime.ia6t_preferred = now.tv_sec + newval; in6_addreq.ifra_lifetime.ia6t_pltime = newval; } } @@ -172,9 +174,11 @@ in6_status(int s __unused, const struct ifaddrs *ifa) int s6; u_int32_t flags6; struct in6_addrlifetime lifetime; - time_t t = time(NULL); + struct timespec now; int error; + clock_gettime(CLOCK_MONOTONIC_FAST, &now); + memset(&null_sin, 0, sizeof(null_sin)); sin = (struct sockaddr_in6 *)ifa->ifa_addr; @@ -258,15 +262,15 @@ in6_status(int s __unused, const struct ifaddrs *ifa) if (ip6lifetime && (lifetime.ia6t_preferred || lifetime.ia6t_expire)) { printf("pltime "); if (lifetime.ia6t_preferred) { - printf("%s ", lifetime.ia6t_preferred < t - ? "0" : sec2str(lifetime.ia6t_preferred - t)); + printf("%s ", lifetime.ia6t_preferred < now.tv_sec + ? "0" : sec2str(lifetime.ia6t_preferred - now.tv_sec)); } else printf("infty "); printf("vltime "); if (lifetime.ia6t_expire) { - printf("%s ", lifetime.ia6t_expire < t - ? "0" : sec2str(lifetime.ia6t_expire - t)); + printf("%s ", lifetime.ia6t_expire < now.tv_sec + ? "0" : sec2str(lifetime.ia6t_expire - now.tv_sec)); } else printf("infty "); } diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8 index 8116cb7feb5..5bf590d047d 100644 --- a/sbin/ifconfig/ifconfig.8 +++ b/sbin/ifconfig/ifconfig.8 @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd October 21, 2013 +.Dd June 5, 2014 .Dt IFCONFIG 8 .Os .Sh NAME @@ -141,13 +141,13 @@ The link-level .Pq Dq link address is specified as a series of colon-separated hex digits. -This can be used to -e.g.,\& set a new MAC address on an ethernet interface, though the -mechanism used is not ethernet-specific. +This can be used to, for example, +set a new MAC address on an Ethernet interface, though the +mechanism used is not Ethernet specific. If the interface is already up when this option is used, it will be briefly brought down and then brought back up again in order to ensure that the receive -filter in the underlying ethernet hardware is properly reprogrammed. +filter in the underlying Ethernet hardware is properly reprogrammed. .It Ar address_family Specify the address family @@ -169,6 +169,18 @@ and .Dq lladdr are synonyms for .Dq link . +When using the +.Fl l +flag, the +.Dq ether +address family has special meaning and is no longer synonymous with +.Dq link +or +.Dq lladdr . +Specifying +.Fl l Dq ether +will list only Ethernet interfaces, excluding all other interface types, +including the loopback interface. .It Ar dest_address Specify the address of the correspondent on the other end of a point to point link. @@ -649,7 +661,8 @@ Clear a flag .Cm defaultif . .It Cm ifdisabled Set a flag to disable all of IPv6 network communications on the -specified interface. Note that if there are already configured IPv6 +specified interface. +Note that if there are already configured IPv6 addresses on that interface, all of them are marked as .Dq tentative and DAD will be performed when this flag is cleared. @@ -666,9 +679,11 @@ Set a flag to enable Neighbor Unreachability Detection. Clear a flag .Cm nud . .It Cm no_prefer_iface -Set a flag to not prefer address on the interface as candidates of the -source address for outgoing packets, even when the interface is -outgoing interface. +Set a flag to not honor rule 5 of source address selection in RFC 3484. +In practice this means the address on the outgoing interface will not be +preferred, effectively yielding the decision to the address selection +policy table, configurable with +.Xr ip6addrctl 8 . .It Cm -no_prefer_iface Clear a flag .Cm no_prefer_iface . @@ -1075,7 +1090,8 @@ specifies the number of beacon intervals between DTIM and must be in the range 1 to 15. By default DTIM is 1 (i.e., DTIM occurs at each beacon). .It Cm quiet -Enable the use of quiet IE. Hostap will use this to silence other +Enable the use of quiet IE. +Hostap will use this to silence other stations to reduce interference for radar detection when operating on 5GHz frequency and doth support is enabled. Use @@ -1090,9 +1106,11 @@ scheduled quiet intervals defined by Quiet element. Set the QUIET .Ar count to the number of TBTTs until the beacon interval during which the -next quiet interval shall start. A value of 1 indicates the quiet +next quiet interval shall start. +A value of 1 indicates the quiet interval will start during the beacon interval starting at the next -TBTT. A value 0 is reserved. +TBTT. +A value 0 is reserved. .It Cm quiet_offset Ar offset Set the QUIET .Ar offset @@ -2317,7 +2335,6 @@ src/dst address for IPv4 or IPv6. .It Cm l4 src/dst port for TCP/UDP/SCTP. .El -.Pp .El .Pp The following parameters are specific to IP tunnel interfaces, @@ -2342,7 +2359,8 @@ Another name for the parameter. .It Cm accept_rev_ethip_ver Set a flag to accept both correct EtherIP packets and ones -with reversed version field. Enabled by default. +with reversed version field. +Enabled by default. This is for backward compatibility with .Fx 6.1 , 6.2, 6.3, 7.0, and 7.1. @@ -2351,7 +2369,8 @@ Clear a flag .Cm accept_rev_ethip_ver . .It Cm send_rev_ethip_ver Set a flag to send EtherIP packets with reversed version -field intentionally. Disabled by default. +field intentionally. +Disabled by default. This is for backward compatibility with .Fx 6.1 , 6.2, 6.3, 7.0, and 7.1. @@ -2434,7 +2453,7 @@ pseudo-interface. The .Xr vlan 4 interface is assigned a -copy of the parent interface's flags and the parent's ethernet address. +copy of the parent interface's flags and the parent's Ethernet address. The .Cm vlandev and @@ -2554,6 +2573,11 @@ The .Fl l flag may be used to list all available interfaces on the system, with no other additional information. +If an +.Ar address_family +is specified, only interfaces of that type will be listed. +.Fl l Dq ether +will list only Ethernet adapters, excluding the loopback interface. Use of this flag is mutually exclusive with all other flags and commands, except for .Fl d diff --git a/sbin/ipf/ipf/Makefile b/sbin/ipf/ipf/Makefile index c3938c63af6..73888b29ba6 100644 --- a/sbin/ipf/ipf/Makefile +++ b/sbin/ipf/ipf/Makefile @@ -39,4 +39,6 @@ DPADD+= ${LIBPCAP} LDADD+= -lpcap .endif +NO_PIE= yes + .include diff --git a/sbin/ipf/ipfstat/Makefile b/sbin/ipf/ipfstat/Makefile index a33c5df38d8..c2b422df42f 100644 --- a/sbin/ipf/ipfstat/Makefile +++ b/sbin/ipf/ipfstat/Makefile @@ -8,4 +8,6 @@ MAN= ipfstat.8 DPADD+= ${LIBCURSES} LDADD+= -lcurses +NO_PIE= yes + .include diff --git a/sbin/ipf/ipftest/Makefile b/sbin/ipf/ipftest/Makefile index 32b074cb93f..57f3c4e7de8 100644 --- a/sbin/ipf/ipftest/Makefile +++ b/sbin/ipf/ipftest/Makefile @@ -32,6 +32,8 @@ CLEANFILES+= ipnat.tab.c ipnat.tab.h CLEANFILES+= ippool_y.c ippool_l.c CLEANFILES+= ippool.tab.c ippool.tab.h +NO_PIE= yes + ipnat_y.c: ipnat_y.y ${YACC} -b ipnat -d ${.ALLSRC} sed -e 's/yy/ipnat_yy/g' \ diff --git a/sbin/ipf/ipmon/Makefile b/sbin/ipf/ipmon/Makefile index 3639f8733c1..2ecfed1aa1b 100644 --- a/sbin/ipf/ipmon/Makefile +++ b/sbin/ipf/ipmon/Makefile @@ -11,6 +11,8 @@ DPSRCS+= ${GENHDRS} CLEANFILES+= ${GENHDRS} ipmon_y.c ipmon_l.c +NO_PIE= yes + ipmon_y.c: ipmon_y.y ${YACC} -d ${.ALLSRC} sed -e 's/yy/ipmon_yy/g' \ diff --git a/sbin/ipf/ipnat/Makefile b/sbin/ipf/ipnat/Makefile index 1c017e182cb..aafb0147ec5 100644 --- a/sbin/ipf/ipnat/Makefile +++ b/sbin/ipf/ipnat/Makefile @@ -11,6 +11,8 @@ DPSRCS+= ${GENHDRS} CLEANFILES+= ${GENHDRS} ipnat_y.c ipnat_l.c +NO_PIE= yes + ipnat_y.c: ipnat_y.y ${YACC} -d ${.ALLSRC} sed -e 's/yy/ipnat_yy/g' \ diff --git a/sbin/ipf/ippool/Makefile b/sbin/ipf/ippool/Makefile index 6e3f85da847..bb7e9ceb24b 100644 --- a/sbin/ipf/ippool/Makefile +++ b/sbin/ipf/ippool/Makefile @@ -10,6 +10,8 @@ DPSRCS+= ${GENHDRS} CLEANFILES+= ${GENHDRS} ippool_y.c ippool_l.c +NO_PIE= yes + ippool_y.c: ippool_y.y ${YACC} -d ${.ALLSRC} sed -e 's/yy/ippool_yy/g' \ diff --git a/sbin/ipf/ipresend/Makefile b/sbin/ipf/ipresend/Makefile index 5e0ac15cbb1..492451cebfc 100644 --- a/sbin/ipf/ipresend/Makefile +++ b/sbin/ipf/ipresend/Makefile @@ -4,6 +4,8 @@ PROG= ipresend SRCS= ipresend.c ip.c resend.c sbpf.c sock.c 44arp.c MAN= ipresend.1 +NO_PIE= yes + .PATH: ${.CURDIR}/../../../contrib/ipfilter/ipsend .include diff --git a/sbin/ipfw/dummynet.c b/sbin/ipfw/dummynet.c index 28dc2c77a02..cb6285323ee 100644 --- a/sbin/ipfw/dummynet.c +++ b/sbin/ipfw/dummynet.c @@ -56,6 +56,7 @@ static struct _s_x dummynet_params[] = { { "sched_mask", TOK_SCHED_MASK }, { "flow_mask", TOK_FLOW_MASK }, { "droptail", TOK_DROPTAIL }, + { "ecn", TOK_ECN }, { "red", TOK_RED }, { "gred", TOK_GRED }, { "bw", TOK_BW }, @@ -239,7 +240,7 @@ print_flowset_parms(struct dn_fs *fs, char *prefix) else plr[0] = '\0'; - if (fs->flags & DN_IS_RED) /* RED parameters */ + if (fs->flags & DN_IS_RED) { /* RED parameters */ sprintf(red, "\n\t %cRED w_q %f min_th %d max_th %d max_p %f", (fs->flags & DN_IS_GENTLE_RED) ? 'G' : ' ', @@ -247,7 +248,9 @@ print_flowset_parms(struct dn_fs *fs, char *prefix) fs->min_th, fs->max_th, 1.0 * fs->max_p / (double)(1 << SCALE_RED)); - else + if (fs->flags & DN_IS_ECN) + strncat(red, " (ecn)", 6); + } else sprintf(red, "droptail"); if (prefix[0]) { @@ -1046,13 +1049,17 @@ ipfw_config_pipe(int ac, char **av) } if ((end = strsep(&av[0], "/"))) { double max_p = strtod(end, NULL); - if (max_p > 1 || max_p <= 0) - errx(EX_DATAERR, "0 < max_p <= 1"); + if (max_p > 1 || max_p < 0) + errx(EX_DATAERR, "0 <= max_p <= 1"); fs->max_p = (int)(max_p * (1 << SCALE_RED)); } ac--; av++; break; + case TOK_ECN: + fs->flags |= DN_IS_ECN; + break; + case TOK_DROPTAIL: NEED(fs, "droptail is only for flowsets"); fs->flags &= ~(DN_IS_RED|DN_IS_GENTLE_RED); @@ -1175,13 +1182,20 @@ ipfw_config_pipe(int ac, char **av) errx(EX_DATAERR, "2 <= queue size <= %ld", limit); } + if ((fs->flags & DN_IS_ECN) && !(fs->flags & DN_IS_RED)) + errx(EX_USAGE, "enable red/gred for ECN"); + if (fs->flags & DN_IS_RED) { size_t len; int lookup_depth, avg_pkt_size; - if (fs->min_th >= fs->max_th) + if (!(fs->flags & DN_IS_ECN) && (fs->min_th >= fs->max_th)) errx(EX_DATAERR, "min_th %d must be < than max_th %d", fs->min_th, fs->max_th); + else if ((fs->flags & DN_IS_ECN) && (fs->min_th > fs->max_th)) + errx(EX_DATAERR, "min_th %d must be =< than max_th %d", + fs->min_th, fs->max_th); + if (fs->max_th == 0) errx(EX_DATAERR, "max_th must be > 0"); diff --git a/sbin/ipfw/ipfw.8 b/sbin/ipfw/ipfw.8 index bc8d8197ae3..5b56b39c84e 100644 --- a/sbin/ipfw/ipfw.8 +++ b/sbin/ipfw/ipfw.8 @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 25, 2012 +.Dd May 31, 2014 .Dt IPFW 8 .Os .Sh NAME @@ -1583,7 +1583,6 @@ followed by the number of significant bits. For example, an address with 33 significant bits could be specified as: .Pp .Dl "MAC 10:20:30:40:50:60/33 any" -.Pp .It An ampersand .Pq & @@ -2441,22 +2440,23 @@ and control the maximum lengths that can be specified. .Pp .It Cm red | gred Ar w_q Ns / Ns Ar min_th Ns / Ns Ar max_th Ns / Ns Ar max_p +[ecn] Make use of the RED (Random Early Detection) queue management algorithm. .Ar w_q and .Ar max_p are floating -point numbers between 0 and 1 (0 not included), while +point numbers between 0 and 1 (inclusive), while .Ar min_th and .Ar max_th are integer numbers specifying thresholds for queue management (thresholds are computed in bytes if the queue has been defined in bytes, in slots otherwise). -The +The two parameters can also be of the same value if needed. The .Nm dummynet -also supports the gentle RED variant (gred). -Three +also supports the gentle RED variant (gred) and ECN (Explicit Congestion +Notification) as optional. Three .Xr sysctl 8 variables can be used to control the RED behaviour: .Bl -tag -width indent @@ -3385,7 +3385,7 @@ options have been added by various developer over the years. .Pp .An -nosplit In-kernel NAT support written by -.An Paolo Pisati Aq piso@FreeBSD.org +.An Paolo Pisati Aq Mt piso@FreeBSD.org as part of a Summer of Code 2005 project. .Pp SCTP diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index 98b25b320c0..25d6afd5feb 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -4389,7 +4389,7 @@ table_list(uint16_t num, int need_header) addr6 = &xent->k.addr6; - if (IN6_IS_ADDR_V4COMPAT(addr6)) { + if ((xent->flags & IPFW_TCF_INET) != 0) { /* IPv4 address */ inet_ntop(AF_INET, &addr6->s6_addr32[3], tbuf, sizeof(tbuf)); } else { diff --git a/sbin/ipfw/ipfw2.h b/sbin/ipfw/ipfw2.h index 6e895b8627b..2301c40f2b7 100644 --- a/sbin/ipfw/ipfw2.h +++ b/sbin/ipfw/ipfw2.h @@ -165,6 +165,7 @@ enum tokens { TOK_BURST, TOK_RED, TOK_GRED, + TOK_ECN, TOK_DROPTAIL, TOK_PROTO, /* dummynet tokens */ diff --git a/sbin/kldconfig/kldconfig.8 b/sbin/kldconfig/kldconfig.8 index 18fbaf609ac..3cc288f5a36 100644 --- a/sbin/kldconfig/kldconfig.8 +++ b/sbin/kldconfig/kldconfig.8 @@ -105,4 +105,4 @@ The utility first appeared in .Fx 4.4 . .Sh AUTHORS -.An Peter Pentchev Aq roam@FreeBSD.org +.An Peter Pentchev Aq Mt roam@FreeBSD.org diff --git a/sbin/kldload/kldload.8 b/sbin/kldload/kldload.8 index ee913ed638a..b84b8630999 100644 --- a/sbin/kldload/kldload.8 +++ b/sbin/kldload/kldload.8 @@ -126,4 +126,4 @@ replacing the .Nm lkm interface. .Sh AUTHORS -.An Doug Rabson Aq dfr@FreeBSD.org +.An Doug Rabson Aq Mt dfr@FreeBSD.org diff --git a/sbin/kldstat/kldstat.8 b/sbin/kldstat/kldstat.8 index bebabe8bff5..b892ef67829 100644 --- a/sbin/kldstat/kldstat.8 +++ b/sbin/kldstat/kldstat.8 @@ -74,4 +74,4 @@ replacing the .Nm lkm interface. .Sh AUTHORS -.An Doug Rabson Aq dfr@FreeBSD.org +.An Doug Rabson Aq Mt dfr@FreeBSD.org diff --git a/sbin/kldunload/kldunload.8 b/sbin/kldunload/kldunload.8 index 0a7937c5ebc..5e371e6fc5a 100644 --- a/sbin/kldunload/kldunload.8 +++ b/sbin/kldunload/kldunload.8 @@ -78,4 +78,4 @@ replacing the .Nm lkm interface. .Sh AUTHORS -.An Doug Rabson Aq dfr@FreeBSD.org +.An Doug Rabson Aq Mt dfr@FreeBSD.org diff --git a/sbin/md5/md5.1 b/sbin/md5/md5.1 index 04efa3750d0..e191cd16015 100644 --- a/sbin/md5/md5.1 +++ b/sbin/md5/md5.1 @@ -1,5 +1,5 @@ .\" $FreeBSD$ -.Dd July 31, 2012 +.Dd May 17, 2014 .Dt MD5 1 .Os .Sh NAME @@ -63,12 +63,12 @@ concerned, and should not be relied upon to produce unique outputs. This also means that .Tn MD5 should not be used as part of a cryptographic signature scheme. -At the current time (2009-01-06) there is no publicly known method to +At the current time (2014-05-17) there is no publicly known method to .Dq reverse MD5, i.e., to find an input given a hash value. .Pp .Tn SHA-1 -currently (2009-01-06) has no known collisions, but an attack has been +currently (2014-05-17) has no known collisions, but an attack has been found which is faster than a brute-force search, placing the security of .Tn SHA-1 in doubt. @@ -83,15 +83,15 @@ The hexadecimal checksum of each file listed on the command line is printed after the options are processed. .Bl -tag -width indent .It Fl c Ar string -Compare files to this md5 string. -(Note that this option is not yet useful if multiple files are specified.) +Compare the digest of the file against this string. +.Pq Note that this option is not yet useful if multiple files are specified. .It Fl s Ar string Print a checksum of the given .Ar string . .It Fl p Echo stdin to stdout and append the checksum to stdout. .It Fl q -Quiet mode - only the checksum is printed out. +Quiet mode \(em only the checksum is printed out. Overrides the .Fl r option. @@ -114,7 +114,9 @@ and .Nm rmd160 utilities exit 0 on success, 1 if at least one of the input files could not be read, -and 2 if at least one file does not have the same hash as the -c option. +and 2 if at least one file does not have the same hash as the +.Fl c +option. .Sh SEE ALSO .Xr cksum 1 , .Xr md5 3 , @@ -152,4 +154,4 @@ This program is placed in the public domain for free general use by RSA Data Security. .Pp Support for SHA-1 and RIPEMD-160 has been added by -.An Oliver Eikemeier Aq eik@FreeBSD.org . +.An Oliver Eikemeier Aq Mt eik@FreeBSD.org . diff --git a/sbin/mdconfig/mdconfig.8 b/sbin/mdconfig/mdconfig.8 index 6b52bec7830..04d3391c0b1 100644 --- a/sbin/mdconfig/mdconfig.8 +++ b/sbin/mdconfig/mdconfig.8 @@ -319,5 +319,4 @@ combo. The .Nm utility was written by -.An Poul-Henning Kamp -.Aq phk@FreeBSD.org . +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . diff --git a/sbin/mount/mount.conf.8 b/sbin/mount/mount.conf.8 index c3296c363ea..45b8257ebae 100644 --- a/sbin/mount/mount.conf.8 +++ b/sbin/mount/mount.conf.8 @@ -247,6 +247,6 @@ The root mount logic in the kernel which parses .Pa /.mount.conf was written by -.An Marcel Moolenaar Aq marcel@FreeBSD.org . +.An Marcel Moolenaar Aq Mt marcel@FreeBSD.org . This man page was written by -.An Craig Rodrigues Aq rodrigc@FreeBSD.org . +.An Craig Rodrigues Aq Mt rodrigc@FreeBSD.org . diff --git a/sbin/mount_cd9660/mount_cd9660.8 b/sbin/mount_cd9660/mount_cd9660.8 index b4716862bfd..974ab3b1349 100644 --- a/sbin/mount_cd9660/mount_cd9660.8 +++ b/sbin/mount_cd9660/mount_cd9660.8 @@ -147,7 +147,7 @@ utility first appeared in .Bx 4.4 . .Pp The Unicode conversion routine was added by -.An Ryuichiro Imura Aq imura@ryu16.org +.An Ryuichiro Imura Aq Mt imura@ryu16.org in 2003. .Sh BUGS POSIX device node mapping is currently not supported. diff --git a/sbin/mount_fusefs/mount_fusefs.8 b/sbin/mount_fusefs/mount_fusefs.8 index 7c8bb67a777..3e11cf19bd8 100644 --- a/sbin/mount_fusefs/mount_fusefs.8 +++ b/sbin/mount_fusefs/mount_fusefs.8 @@ -151,7 +151,6 @@ Do not refuse unmounting if there are secondary mounts .It Cm push_symlinks_in Prefix absolute symlinks with the mountpoint .El -.Pp .El .Pp Besides the above mount options, there is a set of pseudo-mount options which diff --git a/sbin/mount_msdosfs/mount_msdosfs.8 b/sbin/mount_msdosfs/mount_msdosfs.8 index e7bc764eaf0..ae69aeb52e4 100644 --- a/sbin/mount_msdosfs/mount_msdosfs.8 +++ b/sbin/mount_msdosfs/mount_msdosfs.8 @@ -213,8 +213,8 @@ of the more aptly-named .Nm . .Pp The character code conversion routine was added by -.An Ryuichiro Imura Aq imura@ryu16.org -at 2003. +.An Ryuichiro Imura Aq Mt imura@ryu16.org +in 2003. .Sh CAVEATS The use of the .Fl 9 diff --git a/sbin/mount_unionfs/mount_unionfs.8 b/sbin/mount_unionfs/mount_unionfs.8 index b613a94414b..075eff184ee 100644 --- a/sbin/mount_unionfs/mount_unionfs.8 +++ b/sbin/mount_unionfs/mount_unionfs.8 @@ -342,9 +342,9 @@ because this is identical to using .An -nosplit In .Fx 7.0 , -.An Masanori OZAWA Aq ozawa@ongs.co.jp +.An Masanori OZAWA Aq Mt ozawa@ongs.co.jp reimplemented handling of locking, whiteout, and file mode bits, and -.An Hiroki Sato Aq hrs@FreeBSD.org +.An Hiroki Sato Aq Mt hrs@FreeBSD.org wrote about the changes in this manual page. .Sh BUGS THIS FILE SYSTEM TYPE IS NOT YET FULLY SUPPORTED (READ: IT DOESN'T WORK) @@ -357,7 +357,7 @@ BATTERIES NOT INCLUDED. .Pp This code also needs an owner in order to be less dangerous - serious hackers can apply by sending mail to -.Aq freebsd-fs@FreeBSD.org +.Aq Mt freebsd-fs@FreeBSD.org and announcing their intent to take it over. .Pp diff --git a/sbin/natd/natd.8 b/sbin/natd/natd.8 index b4b37ed1fb5..7ccfbf7578b 100644 --- a/sbin/natd/natd.8 +++ b/sbin/natd/natd.8 @@ -585,7 +585,6 @@ in the file or using the command .Pp .Dl "sysctl net.inet.ip.forwarding=1" -.Pp .It If you use the .Fl interface @@ -813,19 +812,19 @@ are forwarded to the appropriate router on that interface. This program is the result of the efforts of many people at different times: .Pp -.An Archie Cobbs Aq archie@FreeBSD.org +.An Archie Cobbs Aq Mt archie@FreeBSD.org (divert sockets) -.An Charles Mott Aq cm@linktel.net +.An Charles Mott Aq Mt cm@linktel.net (packet aliasing) -.An Eivind Eklund Aq perhaps@yes.no +.An Eivind Eklund Aq Mt perhaps@yes.no (IRC support & misc additions) -.An Ari Suutari Aq suutari@iki.fi +.An Ari Suutari Aq Mt suutari@iki.fi (natd) -.An Dru Nelson Aq dnelson@redwoodsoft.com +.An Dru Nelson Aq Mt dnelson@redwoodsoft.com (early PPTP support) -.An Brian Somers Aq brian@awfulhak.org +.An Brian Somers Aq Mt brian@awfulhak.org (glue) -.An Ruslan Ermilov Aq ru@FreeBSD.org +.An Ruslan Ermilov Aq Mt ru@FreeBSD.org (natd, packet aliasing, glue) -.An Poul-Henning Kamp Aq phk@FreeBSD.org +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org (multiple instances) diff --git a/sbin/newfs_msdos/newfs_msdos.8 b/sbin/newfs_msdos/newfs_msdos.8 index 1627f2de2cd..d61043a57bd 100644 --- a/sbin/newfs_msdos/newfs_msdos.8 +++ b/sbin/newfs_msdos/newfs_msdos.8 @@ -238,4 +238,4 @@ The utility first appeared in .Fx 3.0 . .Sh AUTHORS -.An Robert Nordier Aq rnordier@FreeBSD.org . +.An Robert Nordier Aq Mt rnordier@FreeBSD.org diff --git a/sbin/newfs_nandfs/newfs_nandfs.8 b/sbin/newfs_nandfs/newfs_nandfs.8 index 6997430d723..7a630bbbf89 100644 --- a/sbin/newfs_nandfs/newfs_nandfs.8 +++ b/sbin/newfs_nandfs/newfs_nandfs.8 @@ -72,5 +72,5 @@ The .Nm utility first appeared in .Fx 10.0 . -.Sh AUTHOR +.Sh AUTHORS .An Grzegorz Bernacki diff --git a/sbin/nos-tun/nos-tun.8 b/sbin/nos-tun/nos-tun.8 index 405d43007b6..8ea6d5c15fa 100644 --- a/sbin/nos-tun/nos-tun.8 +++ b/sbin/nos-tun/nos-tun.8 @@ -82,11 +82,11 @@ tunnel source 192.168.56.45 .Ed .Sh AUTHORS .An -nosplit -.An Nickolay N. Dudorov Aq nnd@itfs.nsk.su +.An Nickolay N. Dudorov Aq Mt nnd@itfs.nsk.su wrote the program, -.An Poul-Henning Kamp Aq phk@FreeBSD.org +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org wrote the man-page. -.An Isao SEKI Aq iseki@gongon.com +.An Isao SEKI Aq Mt iseki@gongon.com added a new flag, IP protocol number. .Sh BUGS We do not allow for setting our source address for multihomed machines. diff --git a/sbin/nvmecontrol/nvmecontrol.8 b/sbin/nvmecontrol/nvmecontrol.8 index 010f10680a5..3b4b5c23aef 100644 --- a/sbin/nvmecontrol/nvmecontrol.8 +++ b/sbin/nvmecontrol/nvmecontrol.8 @@ -124,7 +124,7 @@ nvme0 controller and activate it on the next reset. .An -nosplit .Nm was developed by Intel and originally written by -.An Jim Harris Aq jimharris@FreeBSD.org . +.An Jim Harris Aq Mt jimharris@FreeBSD.org . .Pp This man page was written by -.An Jim Harris Aq jimharris@FreeBSD.org . +.An Jim Harris Aq Mt jimharris@FreeBSD.org . diff --git a/sbin/pfctl/pfctl.8 b/sbin/pfctl/pfctl.8 index 5c0e7b37f4d..5908cf1a8e5 100644 --- a/sbin/pfctl/pfctl.8 +++ b/sbin/pfctl/pfctl.8 @@ -317,7 +317,6 @@ To kill a state with ID 4823e84500000018 created from a backup firewall with hostid 00000002 use: .Pp .Dl # pfctl -k id -k 4823e84500000018/2 -.Pp .It Fl m Merge in explicitly given options without resetting those which are omitted. diff --git a/sbin/ping6/ping6.c b/sbin/ping6/ping6.c index 01e29a194e3..b963de17689 100644 --- a/sbin/ping6/ping6.c +++ b/sbin/ping6/ping6.c @@ -1090,8 +1090,14 @@ main(int argc, char *argv[]) /* signal handling */ if (seenalrm) { /* last packet sent, timeout reached? */ - if (npackets && ntransmitted >= npackets) - break; + if (npackets && ntransmitted >= npackets) { + struct timeval zerotime = {0, 0}; + itimer.it_value = zerotime; + itimer.it_interval = zerotime; + (void)setitimer(ITIMER_REAL, &itimer, NULL); + seenalrm = 0; /* clear flag */ + continue; + } retransmit(); seenalrm = 0; continue; diff --git a/sbin/rcorder/Makefile b/sbin/rcorder/Makefile index b71aa4b83d3..dc48b4cae91 100644 --- a/sbin/rcorder/Makefile +++ b/sbin/rcorder/Makefile @@ -14,6 +14,8 @@ CFLAGS+= -DORDER -I. SRCS+= util.h CLEANFILES+= util.h +NO_PIE= yes + util.h: ln -sf ${.CURDIR}/../../lib/libutil/libutil.h ${.TARGET} diff --git a/sbin/rcorder/rcorder.8 b/sbin/rcorder/rcorder.8 index b43383a5b6f..995ef684bb8 100644 --- a/sbin/rcorder/rcorder.8 +++ b/sbin/rcorder/rcorder.8 @@ -165,9 +165,9 @@ utility first appeared in .Sh AUTHORS .An -nosplit Written by -.An Perry E. Metzger Aq perry@piermont.com +.An Perry E. Metzger Aq Mt perry@piermont.com and -.An Matthew R. Green Aq mrg@eterna.com.au . +.An Matthew R. Green Aq Mt mrg@eterna.com.au . .Sh BUGS The .Dq Li REQUIRE diff --git a/sbin/reboot/boot_i386.8 b/sbin/reboot/boot_i386.8 index e21e53f2803..d860423f471 100644 --- a/sbin/reboot/boot_i386.8 +++ b/sbin/reboot/boot_i386.8 @@ -113,7 +113,6 @@ boot device, as a hint about available boot files. .Ic ?\& may also be specified as the last segment of a path, in which case the listing will be of the relevant subdirectory.) -.Pp .It Xo .Sm off .Ar bios_drive : interface ( unit , Oo Ar slice , Oc Ar part ) diff --git a/sbin/reboot/nextboot.8 b/sbin/reboot/nextboot.8 index eb383197ae8..7d4135298ac 100644 --- a/sbin/reboot/nextboot.8 +++ b/sbin/reboot/nextboot.8 @@ -118,7 +118,7 @@ appeared in .Fx 5.0 . .Sh AUTHORS This manual page was written by -.An Gordon Tetlow Aq gordon@FreeBSD.org . +.An Gordon Tetlow Aq Mt gordon@FreeBSD.org . .Sh BUGS The .Nm diff --git a/sbin/recoverdisk/recoverdisk.1 b/sbin/recoverdisk/recoverdisk.1 index b3924c55471..fd42f65ad5f 100644 --- a/sbin/recoverdisk/recoverdisk.1 +++ b/sbin/recoverdisk/recoverdisk.1 @@ -137,9 +137,9 @@ utility first appeared in .Sh AUTHORS .An -nosplit The original implementation was done by -.An Poul-Henning Kamp Aq phk@FreeBSD.org +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org with minor improvements from -.An Ulrich Sp\(:orlein Aq uqs@FreeBSD.org . +.An Ulrich Sp\(:orlein Aq Mt uqs@FreeBSD.org . .Pp This manual page was written by .An Ulrich Sp\(:orlein . diff --git a/sbin/sconfig/sconfig.8 b/sbin/sconfig/sconfig.8 index 3fe7abcff68..aa52b646b76 100644 --- a/sbin/sconfig/sconfig.8 +++ b/sbin/sconfig/sconfig.8 @@ -595,7 +595,7 @@ versions of the utility are not fully compatible. .\"-------------------------------------------------------------- .Sh AUTHORS -.An Cronyx Engineering Aq info@cronyx.ru +.An Cronyx Engineering Aq Mt info@cronyx.ru .Pp .Pa http://www.cronyx.ru .\"-------------------------------------------------------------- diff --git a/sbin/setkey/setkey.8 b/sbin/setkey/setkey.8 index 19a916447c3..4306ec22f8b 100644 --- a/sbin/setkey/setkey.8 +++ b/sbin/setkey/setkey.8 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 13, 2006 +.Dd July 25, 2014 .Dt SETKEY 8 .Os .\" @@ -514,7 +514,7 @@ the SA from the key exchange daemon. A value of .Li default tells the kernel to use the system wide default protocol -e.g.\& the one from the +e.g.,\& the one from the .Li esp_trans_deflev sysctl variable, when the kernel processes the packet. A value of @@ -627,7 +627,7 @@ des-deriv 64 ipsec-ciph-des-derived-01 3des-deriv 192 no document rijndael-cbc 128/192/256 rfc3602 aes-ctr 160/224/288 draft-ietf-ipsec-ciph-aes-ctr-03 -camllia-cbc 128/192/256 rfc4312 +camellia-cbc 128/192/256 rfc4312 .Ed .Pp Note that the first 128/192/256 bits of a key for @@ -656,47 +656,46 @@ des-cbc encryption algorithm. .Bd -literal -offset indent add 3ffe:501:4819::1 3ffe:501:481d::1 esp 123457 -E des-cbc 0x3ffe05014819ffff ; - +.Pp .Ed .\" Add an authentication SA between two FQDN specified hosts: .Bd -literal -offset indent add -6 myhost.example.com yourhost.example.com ah 123456 -A hmac-sha1 "AH SA configuration!" ; - +.Pp .Ed Use both ESP and AH between two numerically specified hosts: .Bd -literal -offset indent add 10.0.11.41 10.0.11.33 esp 0x10001 -E des-cbc 0x3ffe05014819ffff -A hmac-md5 "authentication!!" ; - +.Pp .Ed Get the SA information associated with first example above: .Bd -literal -offset indent get 3ffe:501:4819::1 3ffe:501:481d::1 ah 123456 ; - +.Pp .Ed Flush all entries from the database: .Bd -literal -offset indent flush ; - +.Pp .Ed Dump the ESP entries from the database: .Bd -literal -offset indent dump esp ; - +.Pp .Ed Add a security policy between two networks that uses ESP in tunnel mode: .Bd -literal -offset indent spdadd 10.0.11.41/32[21] 10.0.11.33/32[any] any -P out ipsec esp/tunnel/192.168.0.1-192.168.1.2/require ; - +.Pp .Ed Use TCP MD5 between two numerically specified hosts: .Bd -literal -offset indent add 10.1.10.34 10.1.10.36 tcp 0x1000 -A tcp-md5 "TCP-MD5 BGP secret" ; - .Ed .\" .Sh SEE ALSO diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index a86d659cb04..13596450d2e 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -710,9 +710,10 @@ show_var(int *oid, int nlen) warnx("malloc failed"); return (1); } + ctltype = (kind & CTLTYPE); len = j; i = sysctl(oid, nlen, val, &len, 0, 0); - if (i || !len) { + if (i != 0 || (len == 0 && ctltype != CTLTYPE_STRING)) { free(oval); return (1); } @@ -724,7 +725,6 @@ show_var(int *oid, int nlen) } val[len] = '\0'; p = val; - ctltype = (kind & CTLTYPE); sign = ctl_sign[ctltype]; intlen = ctl_size[ctltype]; diff --git a/secure/lib/libcrypt/crypt-blowfish.c b/secure/lib/libcrypt/crypt-blowfish.c index 47d6a16051e..35fb5818b6a 100644 --- a/secure/lib/libcrypt/crypt-blowfish.c +++ b/secure/lib/libcrypt/crypt-blowfish.c @@ -149,7 +149,7 @@ crypt_blowfish(const char *key, const char *salt) char arounds[3]; /* Defaults */ - minr = 'a'; + minr = 'b'; logr = BCRYPT_MINLOGROUNDS; rounds = 1U << logr; diff --git a/secure/lib/libcrypto/Makefile.inc b/secure/lib/libcrypto/Makefile.inc index cf01d055ec3..8fb841b23dd 100644 --- a/secure/lib/libcrypto/Makefile.inc +++ b/secure/lib/libcrypto/Makefile.inc @@ -3,8 +3,8 @@ .include # OpenSSL version used for manual page generation -OPENSSL_VER= 1.0.1g -OPENSSL_DATE= 2014-04-07 +OPENSSL_VER= 1.0.1h +OPENSSL_DATE= 2014-06-05 LCRYPTO_SRC= ${.CURDIR}/../../../crypto/openssl LCRYPTO_DOC= ${.CURDIR}/../../../crypto/openssl/doc diff --git a/secure/lib/libcrypto/man/ASN1_OBJECT_new.3 b/secure/lib/libcrypto/man/ASN1_OBJECT_new.3 index 6713aa9a0fd..b9c86e880f7 100644 --- a/secure/lib/libcrypto/man/ASN1_OBJECT_new.3 +++ b/secure/lib/libcrypto/man/ASN1_OBJECT_new.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ASN1_OBJECT_new 3" -.TH ASN1_OBJECT_new 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH ASN1_OBJECT_new 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/ASN1_STRING_length.3 b/secure/lib/libcrypto/man/ASN1_STRING_length.3 index 98df09f01b8..6e0d228c6a4 100644 --- a/secure/lib/libcrypto/man/ASN1_STRING_length.3 +++ b/secure/lib/libcrypto/man/ASN1_STRING_length.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ASN1_STRING_length 3" -.TH ASN1_STRING_length 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH ASN1_STRING_length 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/ASN1_STRING_new.3 b/secure/lib/libcrypto/man/ASN1_STRING_new.3 index 56f305044ca..badbba16dc0 100644 --- a/secure/lib/libcrypto/man/ASN1_STRING_new.3 +++ b/secure/lib/libcrypto/man/ASN1_STRING_new.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ASN1_STRING_new 3" -.TH ASN1_STRING_new 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH ASN1_STRING_new 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/ASN1_STRING_print_ex.3 b/secure/lib/libcrypto/man/ASN1_STRING_print_ex.3 index e52b8777107..1426345e2ff 100644 --- a/secure/lib/libcrypto/man/ASN1_STRING_print_ex.3 +++ b/secure/lib/libcrypto/man/ASN1_STRING_print_ex.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ASN1_STRING_print_ex 3" -.TH ASN1_STRING_print_ex 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH ASN1_STRING_print_ex 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/ASN1_generate_nconf.3 b/secure/lib/libcrypto/man/ASN1_generate_nconf.3 index 649a334327a..61bb3c04938 100644 --- a/secure/lib/libcrypto/man/ASN1_generate_nconf.3 +++ b/secure/lib/libcrypto/man/ASN1_generate_nconf.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ASN1_generate_nconf 3" -.TH ASN1_generate_nconf 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH ASN1_generate_nconf 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BIO_ctrl.3 b/secure/lib/libcrypto/man/BIO_ctrl.3 index 8ced53a10f4..4be51052c00 100644 --- a/secure/lib/libcrypto/man/BIO_ctrl.3 +++ b/secure/lib/libcrypto/man/BIO_ctrl.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BIO_ctrl 3" -.TH BIO_ctrl 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BIO_ctrl 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BIO_f_base64.3 b/secure/lib/libcrypto/man/BIO_f_base64.3 index b66dbc53d76..ac14a73ca92 100644 --- a/secure/lib/libcrypto/man/BIO_f_base64.3 +++ b/secure/lib/libcrypto/man/BIO_f_base64.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BIO_f_base64 3" -.TH BIO_f_base64 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BIO_f_base64 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BIO_f_buffer.3 b/secure/lib/libcrypto/man/BIO_f_buffer.3 index b2316500cdb..071f33f1db7 100644 --- a/secure/lib/libcrypto/man/BIO_f_buffer.3 +++ b/secure/lib/libcrypto/man/BIO_f_buffer.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BIO_f_buffer 3" -.TH BIO_f_buffer 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BIO_f_buffer 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BIO_f_cipher.3 b/secure/lib/libcrypto/man/BIO_f_cipher.3 index 8b29830667f..37d7b93e5d1 100644 --- a/secure/lib/libcrypto/man/BIO_f_cipher.3 +++ b/secure/lib/libcrypto/man/BIO_f_cipher.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BIO_f_cipher 3" -.TH BIO_f_cipher 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BIO_f_cipher 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BIO_f_md.3 b/secure/lib/libcrypto/man/BIO_f_md.3 index 8a0bdbe9618..20ef45f4bb5 100644 --- a/secure/lib/libcrypto/man/BIO_f_md.3 +++ b/secure/lib/libcrypto/man/BIO_f_md.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BIO_f_md 3" -.TH BIO_f_md 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BIO_f_md 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BIO_f_null.3 b/secure/lib/libcrypto/man/BIO_f_null.3 index 3e093cd8402..ed6d5f99e6e 100644 --- a/secure/lib/libcrypto/man/BIO_f_null.3 +++ b/secure/lib/libcrypto/man/BIO_f_null.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BIO_f_null 3" -.TH BIO_f_null 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BIO_f_null 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BIO_f_ssl.3 b/secure/lib/libcrypto/man/BIO_f_ssl.3 index 9f510fbefe2..0bd6b148fe6 100644 --- a/secure/lib/libcrypto/man/BIO_f_ssl.3 +++ b/secure/lib/libcrypto/man/BIO_f_ssl.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BIO_f_ssl 3" -.TH BIO_f_ssl 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BIO_f_ssl 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BIO_find_type.3 b/secure/lib/libcrypto/man/BIO_find_type.3 index 072d8f450a8..573498ab128 100644 --- a/secure/lib/libcrypto/man/BIO_find_type.3 +++ b/secure/lib/libcrypto/man/BIO_find_type.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BIO_find_type 3" -.TH BIO_find_type 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BIO_find_type 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BIO_new.3 b/secure/lib/libcrypto/man/BIO_new.3 index 9ad1dbc080e..0b69ef46864 100644 --- a/secure/lib/libcrypto/man/BIO_new.3 +++ b/secure/lib/libcrypto/man/BIO_new.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BIO_new 3" -.TH BIO_new 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BIO_new 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BIO_new_CMS.3 b/secure/lib/libcrypto/man/BIO_new_CMS.3 index 45a1a0e2b3b..04f95ba509d 100644 --- a/secure/lib/libcrypto/man/BIO_new_CMS.3 +++ b/secure/lib/libcrypto/man/BIO_new_CMS.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BIO_new_CMS 3" -.TH BIO_new_CMS 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BIO_new_CMS 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BIO_push.3 b/secure/lib/libcrypto/man/BIO_push.3 index 12612fe0dc5..07542feab23 100644 --- a/secure/lib/libcrypto/man/BIO_push.3 +++ b/secure/lib/libcrypto/man/BIO_push.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BIO_push 3" -.TH BIO_push 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BIO_push 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BIO_read.3 b/secure/lib/libcrypto/man/BIO_read.3 index b67a0932b12..fa105146972 100644 --- a/secure/lib/libcrypto/man/BIO_read.3 +++ b/secure/lib/libcrypto/man/BIO_read.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BIO_read 3" -.TH BIO_read 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BIO_read 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BIO_s_accept.3 b/secure/lib/libcrypto/man/BIO_s_accept.3 index 556d027d331..c60982b58e9 100644 --- a/secure/lib/libcrypto/man/BIO_s_accept.3 +++ b/secure/lib/libcrypto/man/BIO_s_accept.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BIO_s_accept 3" -.TH BIO_s_accept 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BIO_s_accept 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BIO_s_bio.3 b/secure/lib/libcrypto/man/BIO_s_bio.3 index 381e33ad072..4891302e741 100644 --- a/secure/lib/libcrypto/man/BIO_s_bio.3 +++ b/secure/lib/libcrypto/man/BIO_s_bio.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BIO_s_bio 3" -.TH BIO_s_bio 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BIO_s_bio 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BIO_s_connect.3 b/secure/lib/libcrypto/man/BIO_s_connect.3 index 72b1b65bb6b..74b6d2d4d6e 100644 --- a/secure/lib/libcrypto/man/BIO_s_connect.3 +++ b/secure/lib/libcrypto/man/BIO_s_connect.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BIO_s_connect 3" -.TH BIO_s_connect 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BIO_s_connect 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BIO_s_fd.3 b/secure/lib/libcrypto/man/BIO_s_fd.3 index 0417515a71c..16b20e0a52e 100644 --- a/secure/lib/libcrypto/man/BIO_s_fd.3 +++ b/secure/lib/libcrypto/man/BIO_s_fd.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BIO_s_fd 3" -.TH BIO_s_fd 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BIO_s_fd 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BIO_s_file.3 b/secure/lib/libcrypto/man/BIO_s_file.3 index ae9dc8f2474..337f2b2f5aa 100644 --- a/secure/lib/libcrypto/man/BIO_s_file.3 +++ b/secure/lib/libcrypto/man/BIO_s_file.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BIO_s_file 3" -.TH BIO_s_file 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BIO_s_file 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BIO_s_mem.3 b/secure/lib/libcrypto/man/BIO_s_mem.3 index 734c9dd6f10..b91155103ff 100644 --- a/secure/lib/libcrypto/man/BIO_s_mem.3 +++ b/secure/lib/libcrypto/man/BIO_s_mem.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BIO_s_mem 3" -.TH BIO_s_mem 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BIO_s_mem 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BIO_s_null.3 b/secure/lib/libcrypto/man/BIO_s_null.3 index f5c4fc3e449..9b89c30fc15 100644 --- a/secure/lib/libcrypto/man/BIO_s_null.3 +++ b/secure/lib/libcrypto/man/BIO_s_null.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BIO_s_null 3" -.TH BIO_s_null 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BIO_s_null 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BIO_s_socket.3 b/secure/lib/libcrypto/man/BIO_s_socket.3 index 0db55e9b6ed..7a197b6d950 100644 --- a/secure/lib/libcrypto/man/BIO_s_socket.3 +++ b/secure/lib/libcrypto/man/BIO_s_socket.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BIO_s_socket 3" -.TH BIO_s_socket 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BIO_s_socket 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BIO_set_callback.3 b/secure/lib/libcrypto/man/BIO_set_callback.3 index 3cd176711ee..398e64bc3fb 100644 --- a/secure/lib/libcrypto/man/BIO_set_callback.3 +++ b/secure/lib/libcrypto/man/BIO_set_callback.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BIO_set_callback 3" -.TH BIO_set_callback 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BIO_set_callback 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BIO_should_retry.3 b/secure/lib/libcrypto/man/BIO_should_retry.3 index 87ccc2c9c78..9da1ab94b0a 100644 --- a/secure/lib/libcrypto/man/BIO_should_retry.3 +++ b/secure/lib/libcrypto/man/BIO_should_retry.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BIO_should_retry 3" -.TH BIO_should_retry 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BIO_should_retry 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BN_BLINDING_new.3 b/secure/lib/libcrypto/man/BN_BLINDING_new.3 index 3f81f1a4048..a65ab189fde 100644 --- a/secure/lib/libcrypto/man/BN_BLINDING_new.3 +++ b/secure/lib/libcrypto/man/BN_BLINDING_new.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BN_BLINDING_new 3" -.TH BN_BLINDING_new 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BN_BLINDING_new 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BN_CTX_new.3 b/secure/lib/libcrypto/man/BN_CTX_new.3 index 44f8042b0f1..f878dd233b6 100644 --- a/secure/lib/libcrypto/man/BN_CTX_new.3 +++ b/secure/lib/libcrypto/man/BN_CTX_new.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BN_CTX_new 3" -.TH BN_CTX_new 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BN_CTX_new 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BN_CTX_start.3 b/secure/lib/libcrypto/man/BN_CTX_start.3 index 2bc289316b5..658d761e376 100644 --- a/secure/lib/libcrypto/man/BN_CTX_start.3 +++ b/secure/lib/libcrypto/man/BN_CTX_start.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BN_CTX_start 3" -.TH BN_CTX_start 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BN_CTX_start 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BN_add.3 b/secure/lib/libcrypto/man/BN_add.3 index e54b16f062a..ac4a815cbc9 100644 --- a/secure/lib/libcrypto/man/BN_add.3 +++ b/secure/lib/libcrypto/man/BN_add.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BN_add 3" -.TH BN_add 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BN_add 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BN_add_word.3 b/secure/lib/libcrypto/man/BN_add_word.3 index 13ffa0678fc..7cf46cf1623 100644 --- a/secure/lib/libcrypto/man/BN_add_word.3 +++ b/secure/lib/libcrypto/man/BN_add_word.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BN_add_word 3" -.TH BN_add_word 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BN_add_word 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BN_bn2bin.3 b/secure/lib/libcrypto/man/BN_bn2bin.3 index 12e59a80ac4..2e378aa8337 100644 --- a/secure/lib/libcrypto/man/BN_bn2bin.3 +++ b/secure/lib/libcrypto/man/BN_bn2bin.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BN_bn2bin 3" -.TH BN_bn2bin 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BN_bn2bin 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BN_cmp.3 b/secure/lib/libcrypto/man/BN_cmp.3 index 5cb7ca1d227..7a1b11ff06b 100644 --- a/secure/lib/libcrypto/man/BN_cmp.3 +++ b/secure/lib/libcrypto/man/BN_cmp.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BN_cmp 3" -.TH BN_cmp 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BN_cmp 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BN_copy.3 b/secure/lib/libcrypto/man/BN_copy.3 index 0cbc34f730b..78a053a024c 100644 --- a/secure/lib/libcrypto/man/BN_copy.3 +++ b/secure/lib/libcrypto/man/BN_copy.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BN_copy 3" -.TH BN_copy 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BN_copy 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BN_generate_prime.3 b/secure/lib/libcrypto/man/BN_generate_prime.3 index 4a527d30b2d..88e6573e6a3 100644 --- a/secure/lib/libcrypto/man/BN_generate_prime.3 +++ b/secure/lib/libcrypto/man/BN_generate_prime.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BN_generate_prime 3" -.TH BN_generate_prime 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BN_generate_prime 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BN_mod_inverse.3 b/secure/lib/libcrypto/man/BN_mod_inverse.3 index b1a31ec16ee..3ca39e3c600 100644 --- a/secure/lib/libcrypto/man/BN_mod_inverse.3 +++ b/secure/lib/libcrypto/man/BN_mod_inverse.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BN_mod_inverse 3" -.TH BN_mod_inverse 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BN_mod_inverse 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BN_mod_mul_montgomery.3 b/secure/lib/libcrypto/man/BN_mod_mul_montgomery.3 index 0a9f5efc716..65f3750cc18 100644 --- a/secure/lib/libcrypto/man/BN_mod_mul_montgomery.3 +++ b/secure/lib/libcrypto/man/BN_mod_mul_montgomery.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BN_mod_mul_montgomery 3" -.TH BN_mod_mul_montgomery 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BN_mod_mul_montgomery 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BN_mod_mul_reciprocal.3 b/secure/lib/libcrypto/man/BN_mod_mul_reciprocal.3 index b237d57e2ea..5a0b52df934 100644 --- a/secure/lib/libcrypto/man/BN_mod_mul_reciprocal.3 +++ b/secure/lib/libcrypto/man/BN_mod_mul_reciprocal.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BN_mod_mul_reciprocal 3" -.TH BN_mod_mul_reciprocal 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BN_mod_mul_reciprocal 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BN_new.3 b/secure/lib/libcrypto/man/BN_new.3 index 0bcf4209be0..1f10a0b3a16 100644 --- a/secure/lib/libcrypto/man/BN_new.3 +++ b/secure/lib/libcrypto/man/BN_new.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BN_new 3" -.TH BN_new 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BN_new 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BN_num_bytes.3 b/secure/lib/libcrypto/man/BN_num_bytes.3 index a9e8fe4e83c..0daa1dbe717 100644 --- a/secure/lib/libcrypto/man/BN_num_bytes.3 +++ b/secure/lib/libcrypto/man/BN_num_bytes.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BN_num_bytes 3" -.TH BN_num_bytes 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BN_num_bytes 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BN_rand.3 b/secure/lib/libcrypto/man/BN_rand.3 index 56cd91c98c7..936c48f4c43 100644 --- a/secure/lib/libcrypto/man/BN_rand.3 +++ b/secure/lib/libcrypto/man/BN_rand.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BN_rand 3" -.TH BN_rand 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BN_rand 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BN_set_bit.3 b/secure/lib/libcrypto/man/BN_set_bit.3 index 26738c36ad7..b3001ce4c11 100644 --- a/secure/lib/libcrypto/man/BN_set_bit.3 +++ b/secure/lib/libcrypto/man/BN_set_bit.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BN_set_bit 3" -.TH BN_set_bit 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BN_set_bit 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BN_swap.3 b/secure/lib/libcrypto/man/BN_swap.3 index 376a062b6b0..201c9d8c42b 100644 --- a/secure/lib/libcrypto/man/BN_swap.3 +++ b/secure/lib/libcrypto/man/BN_swap.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BN_swap 3" -.TH BN_swap 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BN_swap 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/BN_zero.3 b/secure/lib/libcrypto/man/BN_zero.3 index 7cb8a798ac6..9cd0d6c19fd 100644 --- a/secure/lib/libcrypto/man/BN_zero.3 +++ b/secure/lib/libcrypto/man/BN_zero.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BN_zero 3" -.TH BN_zero 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH BN_zero 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/CMS_add0_cert.3 b/secure/lib/libcrypto/man/CMS_add0_cert.3 index a18a84be66c..4903530f822 100644 --- a/secure/lib/libcrypto/man/CMS_add0_cert.3 +++ b/secure/lib/libcrypto/man/CMS_add0_cert.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CMS_add0_cert 3" -.TH CMS_add0_cert 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CMS_add0_cert 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/CMS_add1_recipient_cert.3 b/secure/lib/libcrypto/man/CMS_add1_recipient_cert.3 index 548ea8aa7e4..da6657ec20c 100644 --- a/secure/lib/libcrypto/man/CMS_add1_recipient_cert.3 +++ b/secure/lib/libcrypto/man/CMS_add1_recipient_cert.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CMS_add1_recipient_cert 3" -.TH CMS_add1_recipient_cert 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CMS_add1_recipient_cert 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/CMS_compress.3 b/secure/lib/libcrypto/man/CMS_compress.3 index 7cc15d96c96..57756153e5e 100644 --- a/secure/lib/libcrypto/man/CMS_compress.3 +++ b/secure/lib/libcrypto/man/CMS_compress.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CMS_compress 3" -.TH CMS_compress 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CMS_compress 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/CMS_decrypt.3 b/secure/lib/libcrypto/man/CMS_decrypt.3 index 1d694a3b60c..c3bb343c4f1 100644 --- a/secure/lib/libcrypto/man/CMS_decrypt.3 +++ b/secure/lib/libcrypto/man/CMS_decrypt.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CMS_decrypt 3" -.TH CMS_decrypt 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CMS_decrypt 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -156,7 +156,21 @@ function or errors about unknown algorithms will occur. .PP Although the recipients certificate is not needed to decrypt the data it is needed to locate the appropriate (of possible several) recipients in the \s-1CMS\s0 -structure. If \fBcert\fR is set to \s-1NULL\s0 all possible recipients are tried. +structure. +.PP +If \fBcert\fR is set to \s-1NULL\s0 all possible recipients are tried. This case however +is problematic. To thwart the \s-1MMA\s0 attack (Bleichenbacher's attack on +\&\s-1PKCS\s0 #1 v1.5 \s-1RSA\s0 padding) all recipients are tried whether they succeed or +not. If no recipient succeeds then a random symmetric key is used to decrypt +the content: this will typically output garbage and may (but is not guaranteed +to) ultimately return a padding error only. If \fICMS_decrypt()\fR just returned an +error when all recipient encrypted keys failed to decrypt an attacker could +use this in a timing attack. If the special flag \fB\s-1CMS_DEBUG_DECRYPT\s0\fR is set +then the above behaviour is modified and an error \fBis\fR returned if no +recipient encrypted key can be decrypted \fBwithout\fR generating a random +content encryption key. Applications should use this flag with +\&\fBextreme caution\fR especially in automated gateways as it can leave them +open to attack. .PP It is possible to determine the correct recipient key by other means (for example looking them up in a database) and setting them in the \s-1CMS\s0 structure diff --git a/secure/lib/libcrypto/man/CMS_encrypt.3 b/secure/lib/libcrypto/man/CMS_encrypt.3 index eb35a82f7e1..fb76dcce07f 100644 --- a/secure/lib/libcrypto/man/CMS_encrypt.3 +++ b/secure/lib/libcrypto/man/CMS_encrypt.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CMS_encrypt 3" -.TH CMS_encrypt 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CMS_encrypt 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/CMS_final.3 b/secure/lib/libcrypto/man/CMS_final.3 index 872355a0783..8900389a0ed 100644 --- a/secure/lib/libcrypto/man/CMS_final.3 +++ b/secure/lib/libcrypto/man/CMS_final.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CMS_final 3" -.TH CMS_final 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CMS_final 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/CMS_get0_RecipientInfos.3 b/secure/lib/libcrypto/man/CMS_get0_RecipientInfos.3 index 8e0a818a1a0..dd8266b711d 100644 --- a/secure/lib/libcrypto/man/CMS_get0_RecipientInfos.3 +++ b/secure/lib/libcrypto/man/CMS_get0_RecipientInfos.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CMS_get0_RecipientInfos 3" -.TH CMS_get0_RecipientInfos 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CMS_get0_RecipientInfos 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/CMS_get0_SignerInfos.3 b/secure/lib/libcrypto/man/CMS_get0_SignerInfos.3 index ba3ef987bae..016f1842fc0 100644 --- a/secure/lib/libcrypto/man/CMS_get0_SignerInfos.3 +++ b/secure/lib/libcrypto/man/CMS_get0_SignerInfos.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CMS_get0_SignerInfos 3" -.TH CMS_get0_SignerInfos 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CMS_get0_SignerInfos 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/CMS_get0_type.3 b/secure/lib/libcrypto/man/CMS_get0_type.3 index 664675a6960..3fa2bdbe522 100644 --- a/secure/lib/libcrypto/man/CMS_get0_type.3 +++ b/secure/lib/libcrypto/man/CMS_get0_type.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CMS_get0_type 3" -.TH CMS_get0_type 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CMS_get0_type 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/CMS_get1_ReceiptRequest.3 b/secure/lib/libcrypto/man/CMS_get1_ReceiptRequest.3 index 7f703ef49e6..3a746142e22 100644 --- a/secure/lib/libcrypto/man/CMS_get1_ReceiptRequest.3 +++ b/secure/lib/libcrypto/man/CMS_get1_ReceiptRequest.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CMS_get1_ReceiptRequest 3" -.TH CMS_get1_ReceiptRequest 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CMS_get1_ReceiptRequest 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/CMS_sign.3 b/secure/lib/libcrypto/man/CMS_sign.3 index c473a471aa3..5936b2913b4 100644 --- a/secure/lib/libcrypto/man/CMS_sign.3 +++ b/secure/lib/libcrypto/man/CMS_sign.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CMS_sign 3" -.TH CMS_sign 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CMS_sign 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/CMS_sign_add1_signer.3 b/secure/lib/libcrypto/man/CMS_sign_add1_signer.3 index 79d7534de89..cd42f73d754 100644 --- a/secure/lib/libcrypto/man/CMS_sign_add1_signer.3 +++ b/secure/lib/libcrypto/man/CMS_sign_add1_signer.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CMS_sign_add1_signer 3" -.TH CMS_sign_add1_signer 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CMS_sign_add1_signer 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/CMS_sign_receipt.3 b/secure/lib/libcrypto/man/CMS_sign_receipt.3 index 05414199b7a..4c73d60e59e 100644 --- a/secure/lib/libcrypto/man/CMS_sign_receipt.3 +++ b/secure/lib/libcrypto/man/CMS_sign_receipt.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CMS_sign_receipt 3" -.TH CMS_sign_receipt 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CMS_sign_receipt 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/CMS_uncompress.3 b/secure/lib/libcrypto/man/CMS_uncompress.3 index 3406dcd8ac1..7691da8bff1 100644 --- a/secure/lib/libcrypto/man/CMS_uncompress.3 +++ b/secure/lib/libcrypto/man/CMS_uncompress.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CMS_uncompress 3" -.TH CMS_uncompress 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CMS_uncompress 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/CMS_verify.3 b/secure/lib/libcrypto/man/CMS_verify.3 index 03ac0c578b9..4205f977cf8 100644 --- a/secure/lib/libcrypto/man/CMS_verify.3 +++ b/secure/lib/libcrypto/man/CMS_verify.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CMS_verify 3" -.TH CMS_verify 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CMS_verify 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/CMS_verify_receipt.3 b/secure/lib/libcrypto/man/CMS_verify_receipt.3 index 0df10f2daf9..7d2a2be18b6 100644 --- a/secure/lib/libcrypto/man/CMS_verify_receipt.3 +++ b/secure/lib/libcrypto/man/CMS_verify_receipt.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CMS_verify_receipt 3" -.TH CMS_verify_receipt 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CMS_verify_receipt 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/CONF_modules_free.3 b/secure/lib/libcrypto/man/CONF_modules_free.3 index 530bc0ea7db..50584922d57 100644 --- a/secure/lib/libcrypto/man/CONF_modules_free.3 +++ b/secure/lib/libcrypto/man/CONF_modules_free.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CONF_modules_free 3" -.TH CONF_modules_free 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CONF_modules_free 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -164,7 +164,7 @@ None of the functions return a value. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIconf\fR\|(5), \fIOPENSSL_config\fR\|(3), -\&\fICONF_modules_load_file\fR\|(3), \fICONF_modules_load_file\fR\|(3) +\&\fICONF_modules_load_file\fR\|(3) .SH "HISTORY" .IX Header "HISTORY" \&\fICONF_modules_free()\fR, \fICONF_modules_unload()\fR, and \fICONF_modules_finish()\fR diff --git a/secure/lib/libcrypto/man/CONF_modules_load_file.3 b/secure/lib/libcrypto/man/CONF_modules_load_file.3 index bd581ca379b..14110898180 100644 --- a/secure/lib/libcrypto/man/CONF_modules_load_file.3 +++ b/secure/lib/libcrypto/man/CONF_modules_load_file.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CONF_modules_load_file 3" -.TH CONF_modules_load_file 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CONF_modules_load_file 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -178,7 +178,7 @@ return value of the failing module (this will always be zero or negative). .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIconf\fR\|(5), \fIOPENSSL_config\fR\|(3), -\&\fICONF_free\fR\|(3), \fICONF_free\fR\|(3), \fIerr\fR\|(3),\fIerr\fR\|(3) +\&\fICONF_free\fR\|(3), \fIerr\fR\|(3) .SH "HISTORY" .IX Header "HISTORY" CONF_modules_load_file and CONF_modules_load first appeared in OpenSSL 0.9.7. diff --git a/secure/lib/libcrypto/man/CRYPTO_set_ex_data.3 b/secure/lib/libcrypto/man/CRYPTO_set_ex_data.3 index b0518b92511..0caf575254a 100644 --- a/secure/lib/libcrypto/man/CRYPTO_set_ex_data.3 +++ b/secure/lib/libcrypto/man/CRYPTO_set_ex_data.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CRYPTO_set_ex_data 3" -.TH CRYPTO_set_ex_data 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CRYPTO_set_ex_data 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/DH_generate_key.3 b/secure/lib/libcrypto/man/DH_generate_key.3 index e4d689050f4..076185c57e3 100644 --- a/secure/lib/libcrypto/man/DH_generate_key.3 +++ b/secure/lib/libcrypto/man/DH_generate_key.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "DH_generate_key 3" -.TH DH_generate_key 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH DH_generate_key 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/DH_generate_parameters.3 b/secure/lib/libcrypto/man/DH_generate_parameters.3 index 6bda3d29fe1..9b257c1bd40 100644 --- a/secure/lib/libcrypto/man/DH_generate_parameters.3 +++ b/secure/lib/libcrypto/man/DH_generate_parameters.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "DH_generate_parameters 3" -.TH DH_generate_parameters 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH DH_generate_parameters 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/DH_get_ex_new_index.3 b/secure/lib/libcrypto/man/DH_get_ex_new_index.3 index e9b20cb2843..0a3f49be92d 100644 --- a/secure/lib/libcrypto/man/DH_get_ex_new_index.3 +++ b/secure/lib/libcrypto/man/DH_get_ex_new_index.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "DH_get_ex_new_index 3" -.TH DH_get_ex_new_index 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH DH_get_ex_new_index 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/DH_new.3 b/secure/lib/libcrypto/man/DH_new.3 index 662415b887a..2b6e703c9dd 100644 --- a/secure/lib/libcrypto/man/DH_new.3 +++ b/secure/lib/libcrypto/man/DH_new.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "DH_new 3" -.TH DH_new 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH DH_new 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/DH_set_method.3 b/secure/lib/libcrypto/man/DH_set_method.3 index 57e8c436c28..98d0a8b7071 100644 --- a/secure/lib/libcrypto/man/DH_set_method.3 +++ b/secure/lib/libcrypto/man/DH_set_method.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "DH_set_method 3" -.TH DH_set_method 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH DH_set_method 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/DH_size.3 b/secure/lib/libcrypto/man/DH_size.3 index 185d553002c..fe8b762724d 100644 --- a/secure/lib/libcrypto/man/DH_size.3 +++ b/secure/lib/libcrypto/man/DH_size.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "DH_size 3" -.TH DH_size 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH DH_size 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/DSA_SIG_new.3 b/secure/lib/libcrypto/man/DSA_SIG_new.3 index 67c5d071845..bf44edbf580 100644 --- a/secure/lib/libcrypto/man/DSA_SIG_new.3 +++ b/secure/lib/libcrypto/man/DSA_SIG_new.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "DSA_SIG_new 3" -.TH DSA_SIG_new 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH DSA_SIG_new 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/DSA_do_sign.3 b/secure/lib/libcrypto/man/DSA_do_sign.3 index 5fe53f8a345..05ed9bb38d4 100644 --- a/secure/lib/libcrypto/man/DSA_do_sign.3 +++ b/secure/lib/libcrypto/man/DSA_do_sign.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "DSA_do_sign 3" -.TH DSA_do_sign 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH DSA_do_sign 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/DSA_dup_DH.3 b/secure/lib/libcrypto/man/DSA_dup_DH.3 index dd1fc6d5bbc..6e3bdb5b1a0 100644 --- a/secure/lib/libcrypto/man/DSA_dup_DH.3 +++ b/secure/lib/libcrypto/man/DSA_dup_DH.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "DSA_dup_DH 3" -.TH DSA_dup_DH 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH DSA_dup_DH 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/DSA_generate_key.3 b/secure/lib/libcrypto/man/DSA_generate_key.3 index 453a962ad88..e26bce14f3c 100644 --- a/secure/lib/libcrypto/man/DSA_generate_key.3 +++ b/secure/lib/libcrypto/man/DSA_generate_key.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "DSA_generate_key 3" -.TH DSA_generate_key 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH DSA_generate_key 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/DSA_generate_parameters.3 b/secure/lib/libcrypto/man/DSA_generate_parameters.3 index f2368c536f3..91088490db4 100644 --- a/secure/lib/libcrypto/man/DSA_generate_parameters.3 +++ b/secure/lib/libcrypto/man/DSA_generate_parameters.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "DSA_generate_parameters 3" -.TH DSA_generate_parameters 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH DSA_generate_parameters 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/DSA_get_ex_new_index.3 b/secure/lib/libcrypto/man/DSA_get_ex_new_index.3 index 2c35fab1371..5bf8cb5508d 100644 --- a/secure/lib/libcrypto/man/DSA_get_ex_new_index.3 +++ b/secure/lib/libcrypto/man/DSA_get_ex_new_index.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "DSA_get_ex_new_index 3" -.TH DSA_get_ex_new_index 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH DSA_get_ex_new_index 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/DSA_new.3 b/secure/lib/libcrypto/man/DSA_new.3 index 7eb69d9aa3e..d393c7a305f 100644 --- a/secure/lib/libcrypto/man/DSA_new.3 +++ b/secure/lib/libcrypto/man/DSA_new.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "DSA_new 3" -.TH DSA_new 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH DSA_new 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/DSA_set_method.3 b/secure/lib/libcrypto/man/DSA_set_method.3 index af8d5d95a07..5c21c97ebe2 100644 --- a/secure/lib/libcrypto/man/DSA_set_method.3 +++ b/secure/lib/libcrypto/man/DSA_set_method.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "DSA_set_method 3" -.TH DSA_set_method 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH DSA_set_method 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/DSA_sign.3 b/secure/lib/libcrypto/man/DSA_sign.3 index 8bf56b96660..4c2b6f0a93c 100644 --- a/secure/lib/libcrypto/man/DSA_sign.3 +++ b/secure/lib/libcrypto/man/DSA_sign.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "DSA_sign 3" -.TH DSA_sign 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH DSA_sign 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/DSA_size.3 b/secure/lib/libcrypto/man/DSA_size.3 index fc17496a051..60f85281f3f 100644 --- a/secure/lib/libcrypto/man/DSA_size.3 +++ b/secure/lib/libcrypto/man/DSA_size.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "DSA_size 3" -.TH DSA_size 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH DSA_size 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/ERR_GET_LIB.3 b/secure/lib/libcrypto/man/ERR_GET_LIB.3 index 3ea1840f7f1..27b7202de23 100644 --- a/secure/lib/libcrypto/man/ERR_GET_LIB.3 +++ b/secure/lib/libcrypto/man/ERR_GET_LIB.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ERR_GET_LIB 3" -.TH ERR_GET_LIB 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH ERR_GET_LIB 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/ERR_clear_error.3 b/secure/lib/libcrypto/man/ERR_clear_error.3 index d539953d0a9..9b0c35b5f9b 100644 --- a/secure/lib/libcrypto/man/ERR_clear_error.3 +++ b/secure/lib/libcrypto/man/ERR_clear_error.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ERR_clear_error 3" -.TH ERR_clear_error 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH ERR_clear_error 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/ERR_error_string.3 b/secure/lib/libcrypto/man/ERR_error_string.3 index bb8a3c49528..670034f1169 100644 --- a/secure/lib/libcrypto/man/ERR_error_string.3 +++ b/secure/lib/libcrypto/man/ERR_error_string.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ERR_error_string 3" -.TH ERR_error_string 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH ERR_error_string 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/ERR_get_error.3 b/secure/lib/libcrypto/man/ERR_get_error.3 index 84cb8851808..21559a079e1 100644 --- a/secure/lib/libcrypto/man/ERR_get_error.3 +++ b/secure/lib/libcrypto/man/ERR_get_error.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ERR_get_error 3" -.TH ERR_get_error 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH ERR_get_error 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/ERR_load_crypto_strings.3 b/secure/lib/libcrypto/man/ERR_load_crypto_strings.3 index a24326efc9b..f98a8f681d6 100644 --- a/secure/lib/libcrypto/man/ERR_load_crypto_strings.3 +++ b/secure/lib/libcrypto/man/ERR_load_crypto_strings.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ERR_load_crypto_strings 3" -.TH ERR_load_crypto_strings 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH ERR_load_crypto_strings 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/ERR_load_strings.3 b/secure/lib/libcrypto/man/ERR_load_strings.3 index 8b97e55b212..a545361f66e 100644 --- a/secure/lib/libcrypto/man/ERR_load_strings.3 +++ b/secure/lib/libcrypto/man/ERR_load_strings.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ERR_load_strings 3" -.TH ERR_load_strings 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH ERR_load_strings 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/ERR_print_errors.3 b/secure/lib/libcrypto/man/ERR_print_errors.3 index 7af9f7460db..00f65751695 100644 --- a/secure/lib/libcrypto/man/ERR_print_errors.3 +++ b/secure/lib/libcrypto/man/ERR_print_errors.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ERR_print_errors 3" -.TH ERR_print_errors 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH ERR_print_errors 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/ERR_put_error.3 b/secure/lib/libcrypto/man/ERR_put_error.3 index 214fea48a21..2d73735ab7f 100644 --- a/secure/lib/libcrypto/man/ERR_put_error.3 +++ b/secure/lib/libcrypto/man/ERR_put_error.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ERR_put_error 3" -.TH ERR_put_error 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH ERR_put_error 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/ERR_remove_state.3 b/secure/lib/libcrypto/man/ERR_remove_state.3 index f784f555207..602179f7e85 100644 --- a/secure/lib/libcrypto/man/ERR_remove_state.3 +++ b/secure/lib/libcrypto/man/ERR_remove_state.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ERR_remove_state 3" -.TH ERR_remove_state 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH ERR_remove_state 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/ERR_set_mark.3 b/secure/lib/libcrypto/man/ERR_set_mark.3 index e18fc1fefe1..9aa4ea58e1c 100644 --- a/secure/lib/libcrypto/man/ERR_set_mark.3 +++ b/secure/lib/libcrypto/man/ERR_set_mark.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ERR_set_mark 3" -.TH ERR_set_mark 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH ERR_set_mark 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/EVP_BytesToKey.3 b/secure/lib/libcrypto/man/EVP_BytesToKey.3 index 8c8e0910829..0890ae16041 100644 --- a/secure/lib/libcrypto/man/EVP_BytesToKey.3 +++ b/secure/lib/libcrypto/man/EVP_BytesToKey.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EVP_BytesToKey 3" -.TH EVP_BytesToKey 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH EVP_BytesToKey 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/EVP_DigestInit.3 b/secure/lib/libcrypto/man/EVP_DigestInit.3 index 45c9c2a6186..b1b51d00ca0 100644 --- a/secure/lib/libcrypto/man/EVP_DigestInit.3 +++ b/secure/lib/libcrypto/man/EVP_DigestInit.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EVP_DigestInit 3" -.TH EVP_DigestInit 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH EVP_DigestInit 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/EVP_DigestSignInit.3 b/secure/lib/libcrypto/man/EVP_DigestSignInit.3 index fbabcf3db1f..3e0a3bf89aa 100644 --- a/secure/lib/libcrypto/man/EVP_DigestSignInit.3 +++ b/secure/lib/libcrypto/man/EVP_DigestSignInit.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EVP_DigestSignInit 3" -.TH EVP_DigestSignInit 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH EVP_DigestSignInit 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/EVP_DigestVerifyInit.3 b/secure/lib/libcrypto/man/EVP_DigestVerifyInit.3 index 72bb52a0bee..d2822b3a6d2 100644 --- a/secure/lib/libcrypto/man/EVP_DigestVerifyInit.3 +++ b/secure/lib/libcrypto/man/EVP_DigestVerifyInit.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EVP_DigestVerifyInit 3" -.TH EVP_DigestVerifyInit 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH EVP_DigestVerifyInit 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/EVP_EncryptInit.3 b/secure/lib/libcrypto/man/EVP_EncryptInit.3 index 56f02dfd79f..3ea9ab24348 100644 --- a/secure/lib/libcrypto/man/EVP_EncryptInit.3 +++ b/secure/lib/libcrypto/man/EVP_EncryptInit.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EVP_EncryptInit 3" -.TH EVP_EncryptInit 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH EVP_EncryptInit 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/EVP_OpenInit.3 b/secure/lib/libcrypto/man/EVP_OpenInit.3 index 44f3b42d7a2..ca2cc2b8ccd 100644 --- a/secure/lib/libcrypto/man/EVP_OpenInit.3 +++ b/secure/lib/libcrypto/man/EVP_OpenInit.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EVP_OpenInit 3" -.TH EVP_OpenInit 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH EVP_OpenInit 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 b/secure/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 index e732f1ff167..edfa80f6f9c 100644 --- a/secure/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 +++ b/secure/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EVP_PKEY_CTX_ctrl 3" -.TH EVP_PKEY_CTX_ctrl 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH EVP_PKEY_CTX_ctrl 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/EVP_PKEY_CTX_new.3 b/secure/lib/libcrypto/man/EVP_PKEY_CTX_new.3 index 90862e235d1..8a75d8eb436 100644 --- a/secure/lib/libcrypto/man/EVP_PKEY_CTX_new.3 +++ b/secure/lib/libcrypto/man/EVP_PKEY_CTX_new.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EVP_PKEY_CTX_new 3" -.TH EVP_PKEY_CTX_new 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH EVP_PKEY_CTX_new 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/EVP_PKEY_cmp.3 b/secure/lib/libcrypto/man/EVP_PKEY_cmp.3 index a867a5981cf..dde77313bbc 100644 --- a/secure/lib/libcrypto/man/EVP_PKEY_cmp.3 +++ b/secure/lib/libcrypto/man/EVP_PKEY_cmp.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EVP_PKEY_cmp 3" -.TH EVP_PKEY_cmp 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH EVP_PKEY_cmp 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/EVP_PKEY_decrypt.3 b/secure/lib/libcrypto/man/EVP_PKEY_decrypt.3 index 946b119865f..79237356f13 100644 --- a/secure/lib/libcrypto/man/EVP_PKEY_decrypt.3 +++ b/secure/lib/libcrypto/man/EVP_PKEY_decrypt.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EVP_PKEY_decrypt 3" -.TH EVP_PKEY_decrypt 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH EVP_PKEY_decrypt 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/EVP_PKEY_derive.3 b/secure/lib/libcrypto/man/EVP_PKEY_derive.3 index 57fbe073985..43b23433eb2 100644 --- a/secure/lib/libcrypto/man/EVP_PKEY_derive.3 +++ b/secure/lib/libcrypto/man/EVP_PKEY_derive.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EVP_PKEY_derive 3" -.TH EVP_PKEY_derive 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH EVP_PKEY_derive 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/EVP_PKEY_encrypt.3 b/secure/lib/libcrypto/man/EVP_PKEY_encrypt.3 index b6ba20b938a..832c817b303 100644 --- a/secure/lib/libcrypto/man/EVP_PKEY_encrypt.3 +++ b/secure/lib/libcrypto/man/EVP_PKEY_encrypt.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EVP_PKEY_encrypt 3" -.TH EVP_PKEY_encrypt 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH EVP_PKEY_encrypt 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/EVP_PKEY_get_default_digest.3 b/secure/lib/libcrypto/man/EVP_PKEY_get_default_digest.3 index 5768b48622d..4ab5d924583 100644 --- a/secure/lib/libcrypto/man/EVP_PKEY_get_default_digest.3 +++ b/secure/lib/libcrypto/man/EVP_PKEY_get_default_digest.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EVP_PKEY_get_default_digest 3" -.TH EVP_PKEY_get_default_digest 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH EVP_PKEY_get_default_digest 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/EVP_PKEY_keygen.3 b/secure/lib/libcrypto/man/EVP_PKEY_keygen.3 index 3e49d4532b0..6c2a9792cdf 100644 --- a/secure/lib/libcrypto/man/EVP_PKEY_keygen.3 +++ b/secure/lib/libcrypto/man/EVP_PKEY_keygen.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EVP_PKEY_keygen 3" -.TH EVP_PKEY_keygen 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH EVP_PKEY_keygen 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/EVP_PKEY_new.3 b/secure/lib/libcrypto/man/EVP_PKEY_new.3 index 4148228d236..66902d7461c 100644 --- a/secure/lib/libcrypto/man/EVP_PKEY_new.3 +++ b/secure/lib/libcrypto/man/EVP_PKEY_new.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EVP_PKEY_new 3" -.TH EVP_PKEY_new 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH EVP_PKEY_new 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/EVP_PKEY_print_private.3 b/secure/lib/libcrypto/man/EVP_PKEY_print_private.3 index 35581fc745f..dac12c58fa0 100644 --- a/secure/lib/libcrypto/man/EVP_PKEY_print_private.3 +++ b/secure/lib/libcrypto/man/EVP_PKEY_print_private.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EVP_PKEY_print_private 3" -.TH EVP_PKEY_print_private 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH EVP_PKEY_print_private 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/EVP_PKEY_set1_RSA.3 b/secure/lib/libcrypto/man/EVP_PKEY_set1_RSA.3 index e776f5da9cb..0b7d19cc7ad 100644 --- a/secure/lib/libcrypto/man/EVP_PKEY_set1_RSA.3 +++ b/secure/lib/libcrypto/man/EVP_PKEY_set1_RSA.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EVP_PKEY_set1_RSA 3" -.TH EVP_PKEY_set1_RSA 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH EVP_PKEY_set1_RSA 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/EVP_PKEY_sign.3 b/secure/lib/libcrypto/man/EVP_PKEY_sign.3 index 6b78ab21118..b353260c847 100644 --- a/secure/lib/libcrypto/man/EVP_PKEY_sign.3 +++ b/secure/lib/libcrypto/man/EVP_PKEY_sign.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EVP_PKEY_sign 3" -.TH EVP_PKEY_sign 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH EVP_PKEY_sign 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/EVP_PKEY_verify.3 b/secure/lib/libcrypto/man/EVP_PKEY_verify.3 index d724fd6373c..73099847256 100644 --- a/secure/lib/libcrypto/man/EVP_PKEY_verify.3 +++ b/secure/lib/libcrypto/man/EVP_PKEY_verify.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EVP_PKEY_verify 3" -.TH EVP_PKEY_verify 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH EVP_PKEY_verify 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/EVP_PKEY_verify_recover.3 b/secure/lib/libcrypto/man/EVP_PKEY_verify_recover.3 index 9d4500f598e..5469cfde64b 100644 --- a/secure/lib/libcrypto/man/EVP_PKEY_verify_recover.3 +++ b/secure/lib/libcrypto/man/EVP_PKEY_verify_recover.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EVP_PKEY_verify_recover 3" -.TH EVP_PKEY_verify_recover 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH EVP_PKEY_verify_recover 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/EVP_SealInit.3 b/secure/lib/libcrypto/man/EVP_SealInit.3 index a9cfc1cc44e..6c9c8b57419 100644 --- a/secure/lib/libcrypto/man/EVP_SealInit.3 +++ b/secure/lib/libcrypto/man/EVP_SealInit.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EVP_SealInit 3" -.TH EVP_SealInit 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH EVP_SealInit 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/EVP_SignInit.3 b/secure/lib/libcrypto/man/EVP_SignInit.3 index 060d6a24831..5a513ddec57 100644 --- a/secure/lib/libcrypto/man/EVP_SignInit.3 +++ b/secure/lib/libcrypto/man/EVP_SignInit.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EVP_SignInit 3" -.TH EVP_SignInit 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH EVP_SignInit 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/EVP_VerifyInit.3 b/secure/lib/libcrypto/man/EVP_VerifyInit.3 index 84581250a4f..776bc587c03 100644 --- a/secure/lib/libcrypto/man/EVP_VerifyInit.3 +++ b/secure/lib/libcrypto/man/EVP_VerifyInit.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EVP_VerifyInit 3" -.TH EVP_VerifyInit 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH EVP_VerifyInit 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/OBJ_nid2obj.3 b/secure/lib/libcrypto/man/OBJ_nid2obj.3 index 033c72a82a2..a47ffb21f10 100644 --- a/secure/lib/libcrypto/man/OBJ_nid2obj.3 +++ b/secure/lib/libcrypto/man/OBJ_nid2obj.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "OBJ_nid2obj 3" -.TH OBJ_nid2obj 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH OBJ_nid2obj 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/OPENSSL_Applink.3 b/secure/lib/libcrypto/man/OPENSSL_Applink.3 index 7f08b92e181..1dd5138ec54 100644 --- a/secure/lib/libcrypto/man/OPENSSL_Applink.3 +++ b/secure/lib/libcrypto/man/OPENSSL_Applink.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "OPENSSL_Applink 3" -.TH OPENSSL_Applink 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH OPENSSL_Applink 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 b/secure/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 index a1732c2489a..02f47a7289e 100644 --- a/secure/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 +++ b/secure/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "OPENSSL_VERSION_NUMBER 3" -.TH OPENSSL_VERSION_NUMBER 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH OPENSSL_VERSION_NUMBER 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/OPENSSL_config.3 b/secure/lib/libcrypto/man/OPENSSL_config.3 index 76a84647ecb..e4f9e4bbf30 100644 --- a/secure/lib/libcrypto/man/OPENSSL_config.3 +++ b/secure/lib/libcrypto/man/OPENSSL_config.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "OPENSSL_config 3" -.TH OPENSSL_config 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH OPENSSL_config 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -197,7 +197,7 @@ Neither \fIOPENSSL_config()\fR nor \fIOPENSSL_no_config()\fR return a value. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIconf\fR\|(5), \fICONF_load_modules_file\fR\|(3), -\&\fICONF_modules_free\fR\|(3),\fICONF_modules_free\fR\|(3) +\&\fICONF_modules_free\fR\|(3) .SH "HISTORY" .IX Header "HISTORY" \&\fIOPENSSL_config()\fR and \fIOPENSSL_no_config()\fR first appeared in OpenSSL 0.9.7 diff --git a/secure/lib/libcrypto/man/OPENSSL_ia32cap.3 b/secure/lib/libcrypto/man/OPENSSL_ia32cap.3 index c531af6e88d..7b94a5975cd 100644 --- a/secure/lib/libcrypto/man/OPENSSL_ia32cap.3 +++ b/secure/lib/libcrypto/man/OPENSSL_ia32cap.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "OPENSSL_ia32cap 3" -.TH OPENSSL_ia32cap 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH OPENSSL_ia32cap 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/OPENSSL_load_builtin_modules.3 b/secure/lib/libcrypto/man/OPENSSL_load_builtin_modules.3 index 6042f916d0b..4e1c8a906ea 100644 --- a/secure/lib/libcrypto/man/OPENSSL_load_builtin_modules.3 +++ b/secure/lib/libcrypto/man/OPENSSL_load_builtin_modules.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "OPENSSL_load_builtin_modules 3" -.TH OPENSSL_load_builtin_modules 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH OPENSSL_load_builtin_modules 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 b/secure/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 index 2c9f0aeb782..4f89c70dcf8 100644 --- a/secure/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 +++ b/secure/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "OpenSSL_add_all_algorithms 3" -.TH OpenSSL_add_all_algorithms 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH OpenSSL_add_all_algorithms 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/PEM_write_bio_CMS_stream.3 b/secure/lib/libcrypto/man/PEM_write_bio_CMS_stream.3 index 1cd87bc7adf..cbcbd0d13f7 100644 --- a/secure/lib/libcrypto/man/PEM_write_bio_CMS_stream.3 +++ b/secure/lib/libcrypto/man/PEM_write_bio_CMS_stream.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "PEM_write_bio_CMS_stream 3" -.TH PEM_write_bio_CMS_stream 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH PEM_write_bio_CMS_stream 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3 b/secure/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3 index a6e99a147ea..2ec83aacd10 100644 --- a/secure/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3 +++ b/secure/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "PEM_write_bio_PKCS7_stream 3" -.TH PEM_write_bio_PKCS7_stream 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH PEM_write_bio_PKCS7_stream 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/PKCS12_create.3 b/secure/lib/libcrypto/man/PKCS12_create.3 index f3a4bc73220..104d37cd31d 100644 --- a/secure/lib/libcrypto/man/PKCS12_create.3 +++ b/secure/lib/libcrypto/man/PKCS12_create.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "PKCS12_create 3" -.TH PKCS12_create 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH PKCS12_create 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/PKCS12_parse.3 b/secure/lib/libcrypto/man/PKCS12_parse.3 index 8915196ceeb..d4312f5e56f 100644 --- a/secure/lib/libcrypto/man/PKCS12_parse.3 +++ b/secure/lib/libcrypto/man/PKCS12_parse.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "PKCS12_parse 3" -.TH PKCS12_parse 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH PKCS12_parse 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/PKCS7_decrypt.3 b/secure/lib/libcrypto/man/PKCS7_decrypt.3 index 64da5364d2e..82fa6413fbf 100644 --- a/secure/lib/libcrypto/man/PKCS7_decrypt.3 +++ b/secure/lib/libcrypto/man/PKCS7_decrypt.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "PKCS7_decrypt 3" -.TH PKCS7_decrypt 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH PKCS7_decrypt 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/PKCS7_encrypt.3 b/secure/lib/libcrypto/man/PKCS7_encrypt.3 index 3b508d3c63b..8970a3f1588 100644 --- a/secure/lib/libcrypto/man/PKCS7_encrypt.3 +++ b/secure/lib/libcrypto/man/PKCS7_encrypt.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "PKCS7_encrypt 3" -.TH PKCS7_encrypt 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH PKCS7_encrypt 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/PKCS7_sign.3 b/secure/lib/libcrypto/man/PKCS7_sign.3 index b0d03cfb9c5..97f78b74682 100644 --- a/secure/lib/libcrypto/man/PKCS7_sign.3 +++ b/secure/lib/libcrypto/man/PKCS7_sign.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "PKCS7_sign 3" -.TH PKCS7_sign 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH PKCS7_sign 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/PKCS7_sign_add_signer.3 b/secure/lib/libcrypto/man/PKCS7_sign_add_signer.3 index 132fba8d464..e58f8dede80 100644 --- a/secure/lib/libcrypto/man/PKCS7_sign_add_signer.3 +++ b/secure/lib/libcrypto/man/PKCS7_sign_add_signer.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "PKCS7_sign_add_signer 3" -.TH PKCS7_sign_add_signer 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH PKCS7_sign_add_signer 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/PKCS7_verify.3 b/secure/lib/libcrypto/man/PKCS7_verify.3 index d24cdb71322..4ecbb0ae1c3 100644 --- a/secure/lib/libcrypto/man/PKCS7_verify.3 +++ b/secure/lib/libcrypto/man/PKCS7_verify.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "PKCS7_verify 3" -.TH PKCS7_verify 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH PKCS7_verify 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/RAND_add.3 b/secure/lib/libcrypto/man/RAND_add.3 index 591cc301ff9..f0ce8db05c3 100644 --- a/secure/lib/libcrypto/man/RAND_add.3 +++ b/secure/lib/libcrypto/man/RAND_add.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "RAND_add 3" -.TH RAND_add 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH RAND_add 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/RAND_bytes.3 b/secure/lib/libcrypto/man/RAND_bytes.3 index 1db9a342fba..a8bccd00097 100644 --- a/secure/lib/libcrypto/man/RAND_bytes.3 +++ b/secure/lib/libcrypto/man/RAND_bytes.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "RAND_bytes 3" -.TH RAND_bytes 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH RAND_bytes 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/RAND_cleanup.3 b/secure/lib/libcrypto/man/RAND_cleanup.3 index 255f5dc9ddf..804f64a2377 100644 --- a/secure/lib/libcrypto/man/RAND_cleanup.3 +++ b/secure/lib/libcrypto/man/RAND_cleanup.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "RAND_cleanup 3" -.TH RAND_cleanup 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH RAND_cleanup 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/RAND_egd.3 b/secure/lib/libcrypto/man/RAND_egd.3 index 4539f38fec7..75ea9890b23 100644 --- a/secure/lib/libcrypto/man/RAND_egd.3 +++ b/secure/lib/libcrypto/man/RAND_egd.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "RAND_egd 3" -.TH RAND_egd 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH RAND_egd 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/RAND_load_file.3 b/secure/lib/libcrypto/man/RAND_load_file.3 index c643bc3d533..78ba3ffb046 100644 --- a/secure/lib/libcrypto/man/RAND_load_file.3 +++ b/secure/lib/libcrypto/man/RAND_load_file.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "RAND_load_file 3" -.TH RAND_load_file 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH RAND_load_file 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/RAND_set_rand_method.3 b/secure/lib/libcrypto/man/RAND_set_rand_method.3 index c739fe4f7a5..3a21c326394 100644 --- a/secure/lib/libcrypto/man/RAND_set_rand_method.3 +++ b/secure/lib/libcrypto/man/RAND_set_rand_method.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "RAND_set_rand_method 3" -.TH RAND_set_rand_method 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH RAND_set_rand_method 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/RSA_blinding_on.3 b/secure/lib/libcrypto/man/RSA_blinding_on.3 index af1dfa4e3ba..eb1ba809c37 100644 --- a/secure/lib/libcrypto/man/RSA_blinding_on.3 +++ b/secure/lib/libcrypto/man/RSA_blinding_on.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "RSA_blinding_on 3" -.TH RSA_blinding_on 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH RSA_blinding_on 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/RSA_check_key.3 b/secure/lib/libcrypto/man/RSA_check_key.3 index ed81f83a6d5..8484fe53597 100644 --- a/secure/lib/libcrypto/man/RSA_check_key.3 +++ b/secure/lib/libcrypto/man/RSA_check_key.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "RSA_check_key 3" -.TH RSA_check_key 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH RSA_check_key 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/RSA_generate_key.3 b/secure/lib/libcrypto/man/RSA_generate_key.3 index 9bbac655937..c42db003ed9 100644 --- a/secure/lib/libcrypto/man/RSA_generate_key.3 +++ b/secure/lib/libcrypto/man/RSA_generate_key.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "RSA_generate_key 3" -.TH RSA_generate_key 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH RSA_generate_key 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/RSA_get_ex_new_index.3 b/secure/lib/libcrypto/man/RSA_get_ex_new_index.3 index 2b76a7bc0ea..99544674ac7 100644 --- a/secure/lib/libcrypto/man/RSA_get_ex_new_index.3 +++ b/secure/lib/libcrypto/man/RSA_get_ex_new_index.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "RSA_get_ex_new_index 3" -.TH RSA_get_ex_new_index 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH RSA_get_ex_new_index 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/RSA_new.3 b/secure/lib/libcrypto/man/RSA_new.3 index d7803e53d21..29a8b5010ea 100644 --- a/secure/lib/libcrypto/man/RSA_new.3 +++ b/secure/lib/libcrypto/man/RSA_new.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "RSA_new 3" -.TH RSA_new 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH RSA_new 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 b/secure/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 index 19d2fe0cc88..13776cf6d8c 100644 --- a/secure/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 +++ b/secure/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "RSA_padding_add_PKCS1_type_1 3" -.TH RSA_padding_add_PKCS1_type_1 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH RSA_padding_add_PKCS1_type_1 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/RSA_print.3 b/secure/lib/libcrypto/man/RSA_print.3 index aa49ccdaf6d..03fc1b60751 100644 --- a/secure/lib/libcrypto/man/RSA_print.3 +++ b/secure/lib/libcrypto/man/RSA_print.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "RSA_print 3" -.TH RSA_print 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH RSA_print 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/RSA_private_encrypt.3 b/secure/lib/libcrypto/man/RSA_private_encrypt.3 index 26972510daf..fd21c6dba54 100644 --- a/secure/lib/libcrypto/man/RSA_private_encrypt.3 +++ b/secure/lib/libcrypto/man/RSA_private_encrypt.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "RSA_private_encrypt 3" -.TH RSA_private_encrypt 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH RSA_private_encrypt 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/RSA_public_encrypt.3 b/secure/lib/libcrypto/man/RSA_public_encrypt.3 index c11020a97da..32306e2d85b 100644 --- a/secure/lib/libcrypto/man/RSA_public_encrypt.3 +++ b/secure/lib/libcrypto/man/RSA_public_encrypt.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "RSA_public_encrypt 3" -.TH RSA_public_encrypt 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH RSA_public_encrypt 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/RSA_set_method.3 b/secure/lib/libcrypto/man/RSA_set_method.3 index acde271fdfe..a6f6feab46c 100644 --- a/secure/lib/libcrypto/man/RSA_set_method.3 +++ b/secure/lib/libcrypto/man/RSA_set_method.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "RSA_set_method 3" -.TH RSA_set_method 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH RSA_set_method 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/RSA_sign.3 b/secure/lib/libcrypto/man/RSA_sign.3 index 41f17b7b2de..cf12aeafb36 100644 --- a/secure/lib/libcrypto/man/RSA_sign.3 +++ b/secure/lib/libcrypto/man/RSA_sign.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "RSA_sign 3" -.TH RSA_sign 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH RSA_sign 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3 b/secure/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3 index 22ef0803879..bb55a61fa02 100644 --- a/secure/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3 +++ b/secure/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "RSA_sign_ASN1_OCTET_STRING 3" -.TH RSA_sign_ASN1_OCTET_STRING 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH RSA_sign_ASN1_OCTET_STRING 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/RSA_size.3 b/secure/lib/libcrypto/man/RSA_size.3 index b4545931390..2479c3872bf 100644 --- a/secure/lib/libcrypto/man/RSA_size.3 +++ b/secure/lib/libcrypto/man/RSA_size.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "RSA_size 3" -.TH RSA_size 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH RSA_size 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/SMIME_read_CMS.3 b/secure/lib/libcrypto/man/SMIME_read_CMS.3 index 380b2e29bdb..d4489347623 100644 --- a/secure/lib/libcrypto/man/SMIME_read_CMS.3 +++ b/secure/lib/libcrypto/man/SMIME_read_CMS.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SMIME_read_CMS 3" -.TH SMIME_read_CMS 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SMIME_read_CMS 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/SMIME_read_PKCS7.3 b/secure/lib/libcrypto/man/SMIME_read_PKCS7.3 index d1f4324ff5d..be12a0d2527 100644 --- a/secure/lib/libcrypto/man/SMIME_read_PKCS7.3 +++ b/secure/lib/libcrypto/man/SMIME_read_PKCS7.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SMIME_read_PKCS7 3" -.TH SMIME_read_PKCS7 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SMIME_read_PKCS7 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/SMIME_write_CMS.3 b/secure/lib/libcrypto/man/SMIME_write_CMS.3 index 0d6008f3895..b5af40b192f 100644 --- a/secure/lib/libcrypto/man/SMIME_write_CMS.3 +++ b/secure/lib/libcrypto/man/SMIME_write_CMS.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SMIME_write_CMS 3" -.TH SMIME_write_CMS 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SMIME_write_CMS 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/SMIME_write_PKCS7.3 b/secure/lib/libcrypto/man/SMIME_write_PKCS7.3 index b8e16facc56..2fde51a7844 100644 --- a/secure/lib/libcrypto/man/SMIME_write_PKCS7.3 +++ b/secure/lib/libcrypto/man/SMIME_write_PKCS7.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SMIME_write_PKCS7 3" -.TH SMIME_write_PKCS7 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SMIME_write_PKCS7 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 b/secure/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 index 9caeb807db5..09aea7eb7a7 100644 --- a/secure/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 +++ b/secure/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "X509_NAME_ENTRY_get_object 3" -.TH X509_NAME_ENTRY_get_object 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH X509_NAME_ENTRY_get_object 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -191,7 +191,7 @@ set first so the relevant field information can be looked up internally. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIERR_get_error\fR\|(3), \fId2i_X509_NAME\fR\|(3), -\&\fIOBJ_nid2obj\fR\|(3),\fIOBJ_nid2obj\fR\|(3) +\&\fIOBJ_nid2obj\fR\|(3) .SH "HISTORY" .IX Header "HISTORY" \&\s-1TBA\s0 diff --git a/secure/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 b/secure/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 index b5cdb9e67ac..00084a17e13 100644 --- a/secure/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 +++ b/secure/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "X509_NAME_add_entry_by_txt 3" -.TH X509_NAME_add_entry_by_txt 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH X509_NAME_add_entry_by_txt 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 b/secure/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 index 54d5da773aa..f4070a97dee 100644 --- a/secure/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 +++ b/secure/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "X509_NAME_get_index_by_NID 3" -.TH X509_NAME_get_index_by_NID 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH X509_NAME_get_index_by_NID 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/X509_NAME_print_ex.3 b/secure/lib/libcrypto/man/X509_NAME_print_ex.3 index 344023699af..2dd5b49cd09 100644 --- a/secure/lib/libcrypto/man/X509_NAME_print_ex.3 +++ b/secure/lib/libcrypto/man/X509_NAME_print_ex.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "X509_NAME_print_ex 3" -.TH X509_NAME_print_ex 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH X509_NAME_print_ex 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/X509_STORE_CTX_get_error.3 b/secure/lib/libcrypto/man/X509_STORE_CTX_get_error.3 index fd85a5f94d3..d9a4a614644 100644 --- a/secure/lib/libcrypto/man/X509_STORE_CTX_get_error.3 +++ b/secure/lib/libcrypto/man/X509_STORE_CTX_get_error.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "X509_STORE_CTX_get_error 3" -.TH X509_STORE_CTX_get_error 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH X509_STORE_CTX_get_error 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 b/secure/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 index 776908d392d..905b633b194 100644 --- a/secure/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 +++ b/secure/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "X509_STORE_CTX_get_ex_new_index 3" -.TH X509_STORE_CTX_get_ex_new_index 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH X509_STORE_CTX_get_ex_new_index 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -143,7 +143,7 @@ X509_STORE_CTX_get_ex_new_index, X509_STORE_CTX_set_ex_data, X509_STORE_CTX_get_ \& \& int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *d, int idx, void *arg); \& -\& char *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *d, int idx); +\& void *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *d, int idx); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" diff --git a/secure/lib/libcrypto/man/X509_STORE_CTX_new.3 b/secure/lib/libcrypto/man/X509_STORE_CTX_new.3 index 9b58257ad8f..d06b6995347 100644 --- a/secure/lib/libcrypto/man/X509_STORE_CTX_new.3 +++ b/secure/lib/libcrypto/man/X509_STORE_CTX_new.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "X509_STORE_CTX_new 3" -.TH X509_STORE_CTX_new 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH X509_STORE_CTX_new 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 b/secure/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 index e2cc27b4395..903e4ec17a1 100644 --- a/secure/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 +++ b/secure/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "X509_STORE_CTX_set_verify_cb 3" -.TH X509_STORE_CTX_set_verify_cb 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH X509_STORE_CTX_set_verify_cb 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 b/secure/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 index 61b1e55cc3c..6cee4dc8328 100644 --- a/secure/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 +++ b/secure/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "X509_STORE_set_verify_cb_func 3" -.TH X509_STORE_set_verify_cb_func 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH X509_STORE_set_verify_cb_func 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 b/secure/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 index 157d153bed5..81fb9541884 100644 --- a/secure/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 +++ b/secure/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "X509_VERIFY_PARAM_set_flags 3" -.TH X509_VERIFY_PARAM_set_flags 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH X509_VERIFY_PARAM_set_flags 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/X509_new.3 b/secure/lib/libcrypto/man/X509_new.3 index d784dd4b307..4e9cc3a0374 100644 --- a/secure/lib/libcrypto/man/X509_new.3 +++ b/secure/lib/libcrypto/man/X509_new.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "X509_new 3" -.TH X509_new 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH X509_new 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/X509_verify_cert.3 b/secure/lib/libcrypto/man/X509_verify_cert.3 index cb440064bee..f63d10bb938 100644 --- a/secure/lib/libcrypto/man/X509_verify_cert.3 +++ b/secure/lib/libcrypto/man/X509_verify_cert.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "X509_verify_cert 3" -.TH X509_verify_cert 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH X509_verify_cert 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/bio.3 b/secure/lib/libcrypto/man/bio.3 index 8a52ca173a0..0845386ae05 100644 --- a/secure/lib/libcrypto/man/bio.3 +++ b/secure/lib/libcrypto/man/bio.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "bio 3" -.TH bio 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH bio 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/blowfish.3 b/secure/lib/libcrypto/man/blowfish.3 index ab8af93d9b3..d13db52039b 100644 --- a/secure/lib/libcrypto/man/blowfish.3 +++ b/secure/lib/libcrypto/man/blowfish.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "blowfish 3" -.TH blowfish 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH blowfish 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/bn.3 b/secure/lib/libcrypto/man/bn.3 index ef8f044303e..471cc7cfbce 100644 --- a/secure/lib/libcrypto/man/bn.3 +++ b/secure/lib/libcrypto/man/bn.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "bn 3" -.TH bn 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH bn 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/bn_internal.3 b/secure/lib/libcrypto/man/bn_internal.3 index a52dd7bb803..05d1dfad89c 100644 --- a/secure/lib/libcrypto/man/bn_internal.3 +++ b/secure/lib/libcrypto/man/bn_internal.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "bn_internal 3" -.TH bn_internal 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH bn_internal 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/buffer.3 b/secure/lib/libcrypto/man/buffer.3 index 7eb02d0df5c..c69e8e805da 100644 --- a/secure/lib/libcrypto/man/buffer.3 +++ b/secure/lib/libcrypto/man/buffer.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "buffer 3" -.TH buffer 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH buffer 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/crypto.3 b/secure/lib/libcrypto/man/crypto.3 index 5b2a4e6f7e9..9fa177552e7 100644 --- a/secure/lib/libcrypto/man/crypto.3 +++ b/secure/lib/libcrypto/man/crypto.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "crypto 3" -.TH crypto 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH crypto 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/d2i_ASN1_OBJECT.3 b/secure/lib/libcrypto/man/d2i_ASN1_OBJECT.3 index 88cdf0ddeab..dce2fc6615b 100644 --- a/secure/lib/libcrypto/man/d2i_ASN1_OBJECT.3 +++ b/secure/lib/libcrypto/man/d2i_ASN1_OBJECT.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "d2i_ASN1_OBJECT 3" -.TH d2i_ASN1_OBJECT 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH d2i_ASN1_OBJECT 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/d2i_DHparams.3 b/secure/lib/libcrypto/man/d2i_DHparams.3 index 5a4c77e8805..9ea1042f9b7 100644 --- a/secure/lib/libcrypto/man/d2i_DHparams.3 +++ b/secure/lib/libcrypto/man/d2i_DHparams.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "d2i_DHparams 3" -.TH d2i_DHparams 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH d2i_DHparams 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/d2i_DSAPublicKey.3 b/secure/lib/libcrypto/man/d2i_DSAPublicKey.3 index 4293fd133b8..7e53fca7ec5 100644 --- a/secure/lib/libcrypto/man/d2i_DSAPublicKey.3 +++ b/secure/lib/libcrypto/man/d2i_DSAPublicKey.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "d2i_DSAPublicKey 3" -.TH d2i_DSAPublicKey 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH d2i_DSAPublicKey 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/d2i_PKCS8PrivateKey.3 b/secure/lib/libcrypto/man/d2i_PKCS8PrivateKey.3 index 50a47b1c3ac..3f590c673ca 100644 --- a/secure/lib/libcrypto/man/d2i_PKCS8PrivateKey.3 +++ b/secure/lib/libcrypto/man/d2i_PKCS8PrivateKey.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "d2i_PKCS8PrivateKey 3" -.TH d2i_PKCS8PrivateKey 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH d2i_PKCS8PrivateKey 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/d2i_RSAPublicKey.3 b/secure/lib/libcrypto/man/d2i_RSAPublicKey.3 index ffb78d808a3..3417c06bee2 100644 --- a/secure/lib/libcrypto/man/d2i_RSAPublicKey.3 +++ b/secure/lib/libcrypto/man/d2i_RSAPublicKey.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "d2i_RSAPublicKey 3" -.TH d2i_RSAPublicKey 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH d2i_RSAPublicKey 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/d2i_X509.3 b/secure/lib/libcrypto/man/d2i_X509.3 index 076bd767584..4f310627069 100644 --- a/secure/lib/libcrypto/man/d2i_X509.3 +++ b/secure/lib/libcrypto/man/d2i_X509.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "d2i_X509 3" -.TH d2i_X509 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH d2i_X509 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/d2i_X509_ALGOR.3 b/secure/lib/libcrypto/man/d2i_X509_ALGOR.3 index e619ff3375d..d423f18d27c 100644 --- a/secure/lib/libcrypto/man/d2i_X509_ALGOR.3 +++ b/secure/lib/libcrypto/man/d2i_X509_ALGOR.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "d2i_X509_ALGOR 3" -.TH d2i_X509_ALGOR 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH d2i_X509_ALGOR 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/d2i_X509_CRL.3 b/secure/lib/libcrypto/man/d2i_X509_CRL.3 index 040db55e899..8a432d35f50 100644 --- a/secure/lib/libcrypto/man/d2i_X509_CRL.3 +++ b/secure/lib/libcrypto/man/d2i_X509_CRL.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "d2i_X509_CRL 3" -.TH d2i_X509_CRL 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH d2i_X509_CRL 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/d2i_X509_NAME.3 b/secure/lib/libcrypto/man/d2i_X509_NAME.3 index d040e23955f..41b8a5259e8 100644 --- a/secure/lib/libcrypto/man/d2i_X509_NAME.3 +++ b/secure/lib/libcrypto/man/d2i_X509_NAME.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "d2i_X509_NAME 3" -.TH d2i_X509_NAME 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH d2i_X509_NAME 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/d2i_X509_REQ.3 b/secure/lib/libcrypto/man/d2i_X509_REQ.3 index d42e4e9a455..9da6593d404 100644 --- a/secure/lib/libcrypto/man/d2i_X509_REQ.3 +++ b/secure/lib/libcrypto/man/d2i_X509_REQ.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "d2i_X509_REQ 3" -.TH d2i_X509_REQ 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH d2i_X509_REQ 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/d2i_X509_SIG.3 b/secure/lib/libcrypto/man/d2i_X509_SIG.3 index 81caddba158..9611a32a05d 100644 --- a/secure/lib/libcrypto/man/d2i_X509_SIG.3 +++ b/secure/lib/libcrypto/man/d2i_X509_SIG.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "d2i_X509_SIG 3" -.TH d2i_X509_SIG 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH d2i_X509_SIG 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/des.3 b/secure/lib/libcrypto/man/des.3 index 47750ad7a85..5c42a238c8c 100644 --- a/secure/lib/libcrypto/man/des.3 +++ b/secure/lib/libcrypto/man/des.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "des 3" -.TH des 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH des 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/dh.3 b/secure/lib/libcrypto/man/dh.3 index 0ff7b3ade27..f1fe77818ea 100644 --- a/secure/lib/libcrypto/man/dh.3 +++ b/secure/lib/libcrypto/man/dh.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "dh 3" -.TH dh 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH dh 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/dsa.3 b/secure/lib/libcrypto/man/dsa.3 index 17dbf4d540e..18092aedecc 100644 --- a/secure/lib/libcrypto/man/dsa.3 +++ b/secure/lib/libcrypto/man/dsa.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "dsa 3" -.TH dsa 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH dsa 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/ecdsa.3 b/secure/lib/libcrypto/man/ecdsa.3 index 9f128b35990..db65c67e358 100644 --- a/secure/lib/libcrypto/man/ecdsa.3 +++ b/secure/lib/libcrypto/man/ecdsa.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ecdsa 3" -.TH ecdsa 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH ecdsa 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/engine.3 b/secure/lib/libcrypto/man/engine.3 index 8df4f817b1d..367fd3eadd5 100644 --- a/secure/lib/libcrypto/man/engine.3 +++ b/secure/lib/libcrypto/man/engine.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "engine 3" -.TH engine 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH engine 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/err.3 b/secure/lib/libcrypto/man/err.3 index 825025a5d2f..45a841b401a 100644 --- a/secure/lib/libcrypto/man/err.3 +++ b/secure/lib/libcrypto/man/err.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "err 3" -.TH err 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH err 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/evp.3 b/secure/lib/libcrypto/man/evp.3 index 601acfbf8ce..0ef7d3383aa 100644 --- a/secure/lib/libcrypto/man/evp.3 +++ b/secure/lib/libcrypto/man/evp.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "evp 3" -.TH evp 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH evp 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/hmac.3 b/secure/lib/libcrypto/man/hmac.3 index 1a4cb13ebc6..7346143b27f 100644 --- a/secure/lib/libcrypto/man/hmac.3 +++ b/secure/lib/libcrypto/man/hmac.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "hmac 3" -.TH hmac 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH hmac 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/i2d_CMS_bio_stream.3 b/secure/lib/libcrypto/man/i2d_CMS_bio_stream.3 index 0b30e870e10..737310146b1 100644 --- a/secure/lib/libcrypto/man/i2d_CMS_bio_stream.3 +++ b/secure/lib/libcrypto/man/i2d_CMS_bio_stream.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "i2d_CMS_bio_stream 3" -.TH i2d_CMS_bio_stream 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH i2d_CMS_bio_stream 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/i2d_PKCS7_bio_stream.3 b/secure/lib/libcrypto/man/i2d_PKCS7_bio_stream.3 index 7c124ae4df5..bb39f02f63b 100644 --- a/secure/lib/libcrypto/man/i2d_PKCS7_bio_stream.3 +++ b/secure/lib/libcrypto/man/i2d_PKCS7_bio_stream.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "i2d_PKCS7_bio_stream 3" -.TH i2d_PKCS7_bio_stream 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH i2d_PKCS7_bio_stream 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/lh_stats.3 b/secure/lib/libcrypto/man/lh_stats.3 index 88bc2c5f47b..8c703398b81 100644 --- a/secure/lib/libcrypto/man/lh_stats.3 +++ b/secure/lib/libcrypto/man/lh_stats.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "lh_stats 3" -.TH lh_stats 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH lh_stats 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/lhash.3 b/secure/lib/libcrypto/man/lhash.3 index 00bb9f4b506..789e40dcc00 100644 --- a/secure/lib/libcrypto/man/lhash.3 +++ b/secure/lib/libcrypto/man/lhash.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "lhash 3" -.TH lhash 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH lhash 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/md5.3 b/secure/lib/libcrypto/man/md5.3 index c07ceb140d0..8f61087e1c1 100644 --- a/secure/lib/libcrypto/man/md5.3 +++ b/secure/lib/libcrypto/man/md5.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "md5 3" -.TH md5 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH md5 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/mdc2.3 b/secure/lib/libcrypto/man/mdc2.3 index 9aaaf862e1b..3664ac8a8b5 100644 --- a/secure/lib/libcrypto/man/mdc2.3 +++ b/secure/lib/libcrypto/man/mdc2.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "mdc2 3" -.TH mdc2 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH mdc2 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/pem.3 b/secure/lib/libcrypto/man/pem.3 index 4f39fcb83fc..01fc4b02802 100644 --- a/secure/lib/libcrypto/man/pem.3 +++ b/secure/lib/libcrypto/man/pem.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "pem 3" -.TH pem 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH pem 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/rand.3 b/secure/lib/libcrypto/man/rand.3 index aa8fc897b93..3170b05835a 100644 --- a/secure/lib/libcrypto/man/rand.3 +++ b/secure/lib/libcrypto/man/rand.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "rand 3" -.TH rand 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH rand 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/rc4.3 b/secure/lib/libcrypto/man/rc4.3 index 2768dedc994..a471c202ffb 100644 --- a/secure/lib/libcrypto/man/rc4.3 +++ b/secure/lib/libcrypto/man/rc4.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "rc4 3" -.TH rc4 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH rc4 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/ripemd.3 b/secure/lib/libcrypto/man/ripemd.3 index 71013d3fc37..a6b1c77522d 100644 --- a/secure/lib/libcrypto/man/ripemd.3 +++ b/secure/lib/libcrypto/man/ripemd.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ripemd 3" -.TH ripemd 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH ripemd 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/rsa.3 b/secure/lib/libcrypto/man/rsa.3 index 3fc065e0109..280cd6a691e 100644 --- a/secure/lib/libcrypto/man/rsa.3 +++ b/secure/lib/libcrypto/man/rsa.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "rsa 3" -.TH rsa 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH rsa 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/sha.3 b/secure/lib/libcrypto/man/sha.3 index 8592f82a245..0ccb186eb38 100644 --- a/secure/lib/libcrypto/man/sha.3 +++ b/secure/lib/libcrypto/man/sha.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "sha 3" -.TH sha 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH sha 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/threads.3 b/secure/lib/libcrypto/man/threads.3 index bf7bc540957..97c76c26de3 100644 --- a/secure/lib/libcrypto/man/threads.3 +++ b/secure/lib/libcrypto/man/threads.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "threads 3" -.TH threads 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH threads 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/ui.3 b/secure/lib/libcrypto/man/ui.3 index 3d2ac921c54..ae1348ec7d0 100644 --- a/secure/lib/libcrypto/man/ui.3 +++ b/secure/lib/libcrypto/man/ui.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ui 3" -.TH ui 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH ui 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/ui_compat.3 b/secure/lib/libcrypto/man/ui_compat.3 index fe0fdf29d3f..d232fa824c4 100644 --- a/secure/lib/libcrypto/man/ui_compat.3 +++ b/secure/lib/libcrypto/man/ui_compat.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ui_compat 3" -.TH ui_compat 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH ui_compat 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/x509.3 b/secure/lib/libcrypto/man/x509.3 index bde9527016e..f1ac6a0231b 100644 --- a/secure/lib/libcrypto/man/x509.3 +++ b/secure/lib/libcrypto/man/x509.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "x509 3" -.TH x509 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH x509 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/opensslconf-ia64.h b/secure/lib/libcrypto/opensslconf-ia64.h deleted file mode 100644 index f3abe66fc6d..00000000000 --- a/secure/lib/libcrypto/opensslconf-ia64.h +++ /dev/null @@ -1,224 +0,0 @@ -/* $FreeBSD$ */ -/* opensslconf.h */ -/* WARNING: Generated automatically from opensslconf.h.in by Configure. */ - -/* OpenSSL was configured with the following options: */ -#ifndef OPENSSL_DOING_MAKEDEPEND - - -#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 -# define OPENSSL_NO_EC_NISTP_64_GCC_128 -#endif -#ifndef OPENSSL_NO_GMP -# define OPENSSL_NO_GMP -#endif -#ifndef OPENSSL_NO_JPAKE -# define OPENSSL_NO_JPAKE -#endif -#ifndef OPENSSL_NO_KRB5 -# define OPENSSL_NO_KRB5 -#endif -#ifndef OPENSSL_NO_MD2 -# define OPENSSL_NO_MD2 -#endif -#ifndef OPENSSL_NO_SCTP -# define OPENSSL_NO_SCTP -#endif -#ifndef OPENSSL_NO_STORE -# define OPENSSL_NO_STORE -#endif - -#endif /* OPENSSL_DOING_MAKEDEPEND */ - -#ifndef OPENSSL_THREADS -# define OPENSSL_THREADS -#endif -#ifndef OPENSSL_NO_ASM -# define OPENSSL_NO_ASM -#endif -#ifndef OPENSSL_NO_STATIC_ENGINE -# define OPENSSL_NO_STATIC_ENGINE -#endif - -/* The OPENSSL_NO_* macros are also defined as NO_* if the application - asks for it. This is a transient feature that is provided for those - who haven't had the time to do the appropriate changes in their - applications. */ -#ifdef OPENSSL_ALGORITHM_DEFINES -# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128) -# define NO_EC_NISTP_64_GCC_128 -# endif -# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP) -# define NO_GMP -# endif -# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE) -# define NO_JPAKE -# endif -# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5) -# define NO_KRB5 -# endif -# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2) -# define NO_MD2 -# endif -# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP) -# define NO_SCTP -# endif -# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) -# define NO_STORE -# endif -#endif - -/* crypto/opensslconf.h.in */ - -/* Generate 80386 code? */ -#undef I386_ONLY - -#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ -#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) -#define ENGINESDIR "/usr/lib/engines" -#define OPENSSLDIR "/etc/ssl" -#endif -#endif - -#undef OPENSSL_UNISTD -#define OPENSSL_UNISTD - -#undef OPENSSL_EXPORT_VAR_AS_FUNCTION - -#if defined(HEADER_IDEA_H) && !defined(IDEA_INT) -#define IDEA_INT unsigned int -#endif - -#if defined(HEADER_MD2_H) && !defined(MD2_INT) -#define MD2_INT unsigned int -#endif - -#if defined(HEADER_RC2_H) && !defined(RC2_INT) -/* I need to put in a mod for the alpha - eay */ -#define RC2_INT unsigned int -#endif - -#if defined(HEADER_RC4_H) -#if !defined(RC4_INT) -/* using int types make the structure larger but make the code faster - * on most boxes I have tested - up to %20 faster. */ -/* - * I don't know what does "most" mean, but declaring "int" is a must on: - * - Intel P6 because partial register stalls are very expensive; - * - elder Alpha because it lacks byte load/store instructions; - */ -#define RC4_INT unsigned int -#endif -#if !defined(RC4_CHUNK) -/* - * This enables code handling data aligned at natural CPU word - * boundary. See crypto/rc4/rc4_enc.c for further details. - */ -#undef RC4_CHUNK -#endif -#endif - -#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) -/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a - * %20 speed up (longs are 8 bytes, int's are 4). */ -#ifndef DES_LONG -#define DES_LONG unsigned int -#endif -#endif - -#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) -#define CONFIG_HEADER_BN_H -#undef BN_LLONG - -/* Should we define BN_DIV2W here? */ - -/* Only one for the following should be defined */ -#define SIXTY_FOUR_BIT_LONG -#undef SIXTY_FOUR_BIT -#undef THIRTY_TWO_BIT -#endif - -#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) -#define CONFIG_HEADER_RC4_LOCL_H -/* if this is defined data[i] is used instead of *data, this is a %20 - * speedup on x86 */ -#undef RC4_INDEX -#endif - -#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) -#define CONFIG_HEADER_BF_LOCL_H -#undef BF_PTR -#endif /* HEADER_BF_LOCL_H */ - -#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) -#define CONFIG_HEADER_DES_LOCL_H -#ifndef DES_DEFAULT_OPTIONS -/* the following is tweaked from a config script, that is why it is a - * protected undef/define */ -#ifndef DES_PTR -#define DES_PTR -#endif - -/* This helps C compiler generate the correct code for multiple functional - * units. It reduces register dependancies at the expense of 2 more - * registers */ -#ifndef DES_RISC1 -#undef DES_RISC1 -#endif - -#ifndef DES_RISC2 -#define DES_RISC2 -#endif - -#if defined(DES_RISC1) && defined(DES_RISC2) -YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! -#endif - -/* Unroll the inner loop, this sometimes helps, sometimes hinders. - * Very mucy CPU dependant */ -#ifndef DES_UNROLL -#undef DES_UNROLL -#endif - -/* These default values were supplied by - * Peter Gutman - * They are only used if nothing else has been defined */ -#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) -/* Special defines which change the way the code is built depending on the - CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find - even newer MIPS CPU's, but at the moment one size fits all for - optimization options. Older Sparc's work better with only UNROLL, but - there's no way to tell at compile time what it is you're running on */ - -#if defined( sun ) /* Newer Sparc's */ -# define DES_PTR -# define DES_RISC1 -# define DES_UNROLL -#elif defined( __ultrix ) /* Older MIPS */ -# define DES_PTR -# define DES_RISC2 -# define DES_UNROLL -#elif defined( __osf1__ ) /* Alpha */ -# define DES_PTR -# define DES_RISC2 -#elif defined ( _AIX ) /* RS6000 */ - /* Unknown */ -#elif defined( __hpux ) /* HP-PA */ - /* Unknown */ -#elif defined( __aux ) /* 68K */ - /* Unknown */ -#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ -# define DES_UNROLL -#elif defined( __sgi ) /* Newer MIPS */ -# define DES_PTR -# define DES_RISC2 -# define DES_UNROLL -#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ -# define DES_PTR -# define DES_RISC1 -# define DES_UNROLL -#endif /* Systems-specific speed defines */ -#endif - -#endif /* DES_DEFAULT_OPTIONS */ -#endif /* HEADER_DES_LOCL_H */ diff --git a/secure/lib/libssl/man/SSL_CIPHER_get_name.3 b/secure/lib/libssl/man/SSL_CIPHER_get_name.3 index a00439d3ca4..7ee97977806 100644 --- a/secure/lib/libssl/man/SSL_CIPHER_get_name.3 +++ b/secure/lib/libssl/man/SSL_CIPHER_get_name.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CIPHER_get_name 3" -.TH SSL_CIPHER_get_name 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CIPHER_get_name 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_COMP_add_compression_method.3 b/secure/lib/libssl/man/SSL_COMP_add_compression_method.3 index 1b3a4f406b3..835116c35bd 100644 --- a/secure/lib/libssl/man/SSL_COMP_add_compression_method.3 +++ b/secure/lib/libssl/man/SSL_COMP_add_compression_method.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_COMP_add_compression_method 3" -.TH SSL_COMP_add_compression_method 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_COMP_add_compression_method 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 b/secure/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 index 9c213deecd7..2d62aaa51e0 100644 --- a/secure/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 +++ b/secure/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_add_extra_chain_cert 3" -.TH SSL_CTX_add_extra_chain_cert 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_add_extra_chain_cert 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_add_session.3 b/secure/lib/libssl/man/SSL_CTX_add_session.3 index 78c937c76b2..752ef36cff4 100644 --- a/secure/lib/libssl/man/SSL_CTX_add_session.3 +++ b/secure/lib/libssl/man/SSL_CTX_add_session.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_add_session 3" -.TH SSL_CTX_add_session 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_add_session 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_ctrl.3 b/secure/lib/libssl/man/SSL_CTX_ctrl.3 index ecc0ca44de6..24c943c8e61 100644 --- a/secure/lib/libssl/man/SSL_CTX_ctrl.3 +++ b/secure/lib/libssl/man/SSL_CTX_ctrl.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_ctrl 3" -.TH SSL_CTX_ctrl 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_ctrl 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_flush_sessions.3 b/secure/lib/libssl/man/SSL_CTX_flush_sessions.3 index dbc551b6749..59290257d3c 100644 --- a/secure/lib/libssl/man/SSL_CTX_flush_sessions.3 +++ b/secure/lib/libssl/man/SSL_CTX_flush_sessions.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_flush_sessions 3" -.TH SSL_CTX_flush_sessions 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_flush_sessions 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_free.3 b/secure/lib/libssl/man/SSL_CTX_free.3 index 2e20c505883..5efdabba64f 100644 --- a/secure/lib/libssl/man/SSL_CTX_free.3 +++ b/secure/lib/libssl/man/SSL_CTX_free.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_free 3" -.TH SSL_CTX_free 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_free 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_get_ex_new_index.3 b/secure/lib/libssl/man/SSL_CTX_get_ex_new_index.3 index 6ad1c02b7f7..14f68d6bf5d 100644 --- a/secure/lib/libssl/man/SSL_CTX_get_ex_new_index.3 +++ b/secure/lib/libssl/man/SSL_CTX_get_ex_new_index.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_get_ex_new_index 3" -.TH SSL_CTX_get_ex_new_index 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_get_ex_new_index 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_get_verify_mode.3 b/secure/lib/libssl/man/SSL_CTX_get_verify_mode.3 index 93fffa969a0..1c31370e36f 100644 --- a/secure/lib/libssl/man/SSL_CTX_get_verify_mode.3 +++ b/secure/lib/libssl/man/SSL_CTX_get_verify_mode.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_get_verify_mode 3" -.TH SSL_CTX_get_verify_mode 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_get_verify_mode 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_load_verify_locations.3 b/secure/lib/libssl/man/SSL_CTX_load_verify_locations.3 index 62dc775e866..8ec3c9570ff 100644 --- a/secure/lib/libssl/man/SSL_CTX_load_verify_locations.3 +++ b/secure/lib/libssl/man/SSL_CTX_load_verify_locations.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_load_verify_locations 3" -.TH SSL_CTX_load_verify_locations 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_load_verify_locations 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_new.3 b/secure/lib/libssl/man/SSL_CTX_new.3 index e0b5816d29f..d7157cf05ef 100644 --- a/secure/lib/libssl/man/SSL_CTX_new.3 +++ b/secure/lib/libssl/man/SSL_CTX_new.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_new 3" -.TH SSL_CTX_new 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_new 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_sess_number.3 b/secure/lib/libssl/man/SSL_CTX_sess_number.3 index bc6d065bdb8..f0b66a31c61 100644 --- a/secure/lib/libssl/man/SSL_CTX_sess_number.3 +++ b/secure/lib/libssl/man/SSL_CTX_sess_number.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_sess_number 3" -.TH SSL_CTX_sess_number 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_sess_number 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 b/secure/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 index e4129c389da..d9317299681 100644 --- a/secure/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 +++ b/secure/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_sess_set_cache_size 3" -.TH SSL_CTX_sess_set_cache_size 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_sess_set_cache_size 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 b/secure/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 index a8ed4155d5b..b35640c2e6f 100644 --- a/secure/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 +++ b/secure/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_sess_set_get_cb 3" -.TH SSL_CTX_sess_set_get_cb 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_sess_set_get_cb 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_sessions.3 b/secure/lib/libssl/man/SSL_CTX_sessions.3 index de442fb8728..9fa3ce27989 100644 --- a/secure/lib/libssl/man/SSL_CTX_sessions.3 +++ b/secure/lib/libssl/man/SSL_CTX_sessions.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_sessions 3" -.TH SSL_CTX_sessions 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_sessions 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_set_cert_store.3 b/secure/lib/libssl/man/SSL_CTX_set_cert_store.3 index 41a9166ab78..be092fc381c 100644 --- a/secure/lib/libssl/man/SSL_CTX_set_cert_store.3 +++ b/secure/lib/libssl/man/SSL_CTX_set_cert_store.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_set_cert_store 3" -.TH SSL_CTX_set_cert_store 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_set_cert_store 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 b/secure/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 index 5aefc2e9db8..3cf56439c56 100644 --- a/secure/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 +++ b/secure/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_set_cert_verify_callback 3" -.TH SSL_CTX_set_cert_verify_callback 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_set_cert_verify_callback 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_set_cipher_list.3 b/secure/lib/libssl/man/SSL_CTX_set_cipher_list.3 index 893c256b433..4582ed2b19f 100644 --- a/secure/lib/libssl/man/SSL_CTX_set_cipher_list.3 +++ b/secure/lib/libssl/man/SSL_CTX_set_cipher_list.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_set_cipher_list 3" -.TH SSL_CTX_set_cipher_list 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_set_cipher_list 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_set_client_CA_list.3 b/secure/lib/libssl/man/SSL_CTX_set_client_CA_list.3 index e652dbff1d9..dd5ffeed7c4 100644 --- a/secure/lib/libssl/man/SSL_CTX_set_client_CA_list.3 +++ b/secure/lib/libssl/man/SSL_CTX_set_client_CA_list.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_set_client_CA_list 3" -.TH SSL_CTX_set_client_CA_list 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_set_client_CA_list 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 b/secure/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 index e2a2f48097a..f1ffac8b9f8 100644 --- a/secure/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 +++ b/secure/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_set_client_cert_cb 3" -.TH SSL_CTX_set_client_cert_cb 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_set_client_cert_cb 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 b/secure/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 index 3649687b281..faff1275637 100644 --- a/secure/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 +++ b/secure/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_set_default_passwd_cb 3" -.TH SSL_CTX_set_default_passwd_cb 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_set_default_passwd_cb 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_set_generate_session_id.3 b/secure/lib/libssl/man/SSL_CTX_set_generate_session_id.3 index 67fe7c6a1a1..b75db37b39d 100644 --- a/secure/lib/libssl/man/SSL_CTX_set_generate_session_id.3 +++ b/secure/lib/libssl/man/SSL_CTX_set_generate_session_id.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_set_generate_session_id 3" -.TH SSL_CTX_set_generate_session_id 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_set_generate_session_id 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_set_info_callback.3 b/secure/lib/libssl/man/SSL_CTX_set_info_callback.3 index 108db434abe..6866ec3dc0e 100644 --- a/secure/lib/libssl/man/SSL_CTX_set_info_callback.3 +++ b/secure/lib/libssl/man/SSL_CTX_set_info_callback.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_set_info_callback 3" -.TH SSL_CTX_set_info_callback 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_set_info_callback 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_set_max_cert_list.3 b/secure/lib/libssl/man/SSL_CTX_set_max_cert_list.3 index a39299359a1..a9f4f912f7c 100644 --- a/secure/lib/libssl/man/SSL_CTX_set_max_cert_list.3 +++ b/secure/lib/libssl/man/SSL_CTX_set_max_cert_list.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_set_max_cert_list 3" -.TH SSL_CTX_set_max_cert_list 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_set_max_cert_list 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_set_mode.3 b/secure/lib/libssl/man/SSL_CTX_set_mode.3 index 58a1500b48a..a35503975fb 100644 --- a/secure/lib/libssl/man/SSL_CTX_set_mode.3 +++ b/secure/lib/libssl/man/SSL_CTX_set_mode.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_set_mode 3" -.TH SSL_CTX_set_mode 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_set_mode 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_set_msg_callback.3 b/secure/lib/libssl/man/SSL_CTX_set_msg_callback.3 index d0e3f3805fd..58540289aa4 100644 --- a/secure/lib/libssl/man/SSL_CTX_set_msg_callback.3 +++ b/secure/lib/libssl/man/SSL_CTX_set_msg_callback.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_set_msg_callback 3" -.TH SSL_CTX_set_msg_callback 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_set_msg_callback 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -139,8 +139,8 @@ SSL_CTX_set_msg_callback, SSL_CTX_set_msg_callback_arg, SSL_set_msg_callback, SS \& void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); \& void SSL_CTX_set_msg_callback_arg(SSL_CTX *ctx, void *arg); \& -\& void SSL_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); -\& void SSL_set_msg_callback_arg(SSL_CTX *ctx, void *arg); +\& void SSL_set_msg_callback(SSL *ssl, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); +\& void SSL_set_msg_callback_arg(SSL *ssl, void *arg); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" diff --git a/secure/lib/libssl/man/SSL_CTX_set_options.3 b/secure/lib/libssl/man/SSL_CTX_set_options.3 index 566348d7a57..50bcaa7d295 100644 --- a/secure/lib/libssl/man/SSL_CTX_set_options.3 +++ b/secure/lib/libssl/man/SSL_CTX_set_options.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_set_options 3" -.TH SSL_CTX_set_options 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_set_options 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -226,6 +226,11 @@ Disables a countermeasure against a \s-1SSL\s0 3.0/TLS 1.0 protocol vulnerability affecting \s-1CBC\s0 ciphers, which cannot be handled by some broken \s-1SSL\s0 implementations. This option has no effect for connections using other ciphers. +.IP "\s-1SSL_OP_TLSEXT_PADDING\s0" 4 +.IX Item "SSL_OP_TLSEXT_PADDING" +Adds a padding extension to ensure the ClientHello size is never between +256 and 511 bytes in length. This is needed as a workaround for some +implementations. .IP "\s-1SSL_OP_ALL\s0" 4 .IX Item "SSL_OP_ALL" All of the above bug workarounds. diff --git a/secure/lib/libssl/man/SSL_CTX_set_psk_client_callback.3 b/secure/lib/libssl/man/SSL_CTX_set_psk_client_callback.3 index 3a01f97982f..7535bf4dd1e 100644 --- a/secure/lib/libssl/man/SSL_CTX_set_psk_client_callback.3 +++ b/secure/lib/libssl/man/SSL_CTX_set_psk_client_callback.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_set_psk_client_callback 3" -.TH SSL_CTX_set_psk_client_callback 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_set_psk_client_callback 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 b/secure/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 index 157a5c73499..20f519c9bf6 100644 --- a/secure/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 +++ b/secure/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_set_quiet_shutdown 3" -.TH SSL_CTX_set_quiet_shutdown 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_set_quiet_shutdown 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 b/secure/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 index ddfac024fab..554e1f5d5af 100644 --- a/secure/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 +++ b/secure/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_set_session_cache_mode 3" -.TH SSL_CTX_set_session_cache_mode 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_set_session_cache_mode 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_set_session_id_context.3 b/secure/lib/libssl/man/SSL_CTX_set_session_id_context.3 index 5f26b1681f6..f1eb254e72f 100644 --- a/secure/lib/libssl/man/SSL_CTX_set_session_id_context.3 +++ b/secure/lib/libssl/man/SSL_CTX_set_session_id_context.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_set_session_id_context 3" -.TH SSL_CTX_set_session_id_context 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_set_session_id_context 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_set_ssl_version.3 b/secure/lib/libssl/man/SSL_CTX_set_ssl_version.3 index 344c33fd35e..546b3d332f6 100644 --- a/secure/lib/libssl/man/SSL_CTX_set_ssl_version.3 +++ b/secure/lib/libssl/man/SSL_CTX_set_ssl_version.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_set_ssl_version 3" -.TH SSL_CTX_set_ssl_version 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_set_ssl_version 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_set_timeout.3 b/secure/lib/libssl/man/SSL_CTX_set_timeout.3 index b694ea6e5d9..24c22536b09 100644 --- a/secure/lib/libssl/man/SSL_CTX_set_timeout.3 +++ b/secure/lib/libssl/man/SSL_CTX_set_timeout.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_set_timeout 3" -.TH SSL_CTX_set_timeout 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_set_timeout 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 b/secure/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 index 56ddc504ae6..08866465540 100644 --- a/secure/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 +++ b/secure/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_set_tmp_dh_callback 3" -.TH SSL_CTX_set_tmp_dh_callback 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_set_tmp_dh_callback 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 b/secure/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 index 4253c2c8e7f..52167a92012 100644 --- a/secure/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 +++ b/secure/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_set_tmp_rsa_callback 3" -.TH SSL_CTX_set_tmp_rsa_callback 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_set_tmp_rsa_callback 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_set_verify.3 b/secure/lib/libssl/man/SSL_CTX_set_verify.3 index 5ed2335d632..09bc4be1dec 100644 --- a/secure/lib/libssl/man/SSL_CTX_set_verify.3 +++ b/secure/lib/libssl/man/SSL_CTX_set_verify.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_set_verify 3" -.TH SSL_CTX_set_verify 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_set_verify 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_use_certificate.3 b/secure/lib/libssl/man/SSL_CTX_use_certificate.3 index 7f46b48e849..c2348fc74a7 100644 --- a/secure/lib/libssl/man/SSL_CTX_use_certificate.3 +++ b/secure/lib/libssl/man/SSL_CTX_use_certificate.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_use_certificate 3" -.TH SSL_CTX_use_certificate 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_use_certificate 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_CTX_use_psk_identity_hint.3 b/secure/lib/libssl/man/SSL_CTX_use_psk_identity_hint.3 index 0b6966d3b0b..a5ae5f91ebc 100644 --- a/secure/lib/libssl/man/SSL_CTX_use_psk_identity_hint.3 +++ b/secure/lib/libssl/man/SSL_CTX_use_psk_identity_hint.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_CTX_use_psk_identity_hint 3" -.TH SSL_CTX_use_psk_identity_hint 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_CTX_use_psk_identity_hint 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_SESSION_free.3 b/secure/lib/libssl/man/SSL_SESSION_free.3 index 067ba8f840b..a4101e5eda7 100644 --- a/secure/lib/libssl/man/SSL_SESSION_free.3 +++ b/secure/lib/libssl/man/SSL_SESSION_free.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_SESSION_free 3" -.TH SSL_SESSION_free 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_SESSION_free 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 b/secure/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 index 886ff888ced..31f174954dc 100644 --- a/secure/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 +++ b/secure/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_SESSION_get_ex_new_index 3" -.TH SSL_SESSION_get_ex_new_index 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_SESSION_get_ex_new_index 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_SESSION_get_time.3 b/secure/lib/libssl/man/SSL_SESSION_get_time.3 index b53b8b6d3be..d42d2219165 100644 --- a/secure/lib/libssl/man/SSL_SESSION_get_time.3 +++ b/secure/lib/libssl/man/SSL_SESSION_get_time.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_SESSION_get_time 3" -.TH SSL_SESSION_get_time 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_SESSION_get_time 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_accept.3 b/secure/lib/libssl/man/SSL_accept.3 index 09910156c04..79e5193c4ea 100644 --- a/secure/lib/libssl/man/SSL_accept.3 +++ b/secure/lib/libssl/man/SSL_accept.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_accept 3" -.TH SSL_accept 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_accept 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_alert_type_string.3 b/secure/lib/libssl/man/SSL_alert_type_string.3 index 181a2c3360f..6383b608adf 100644 --- a/secure/lib/libssl/man/SSL_alert_type_string.3 +++ b/secure/lib/libssl/man/SSL_alert_type_string.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_alert_type_string 3" -.TH SSL_alert_type_string 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_alert_type_string 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_clear.3 b/secure/lib/libssl/man/SSL_clear.3 index 36c9a46aa5e..eafd97cd4ff 100644 --- a/secure/lib/libssl/man/SSL_clear.3 +++ b/secure/lib/libssl/man/SSL_clear.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_clear 3" -.TH SSL_clear 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_clear 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_connect.3 b/secure/lib/libssl/man/SSL_connect.3 index cbecfcddf3e..9703367653e 100644 --- a/secure/lib/libssl/man/SSL_connect.3 +++ b/secure/lib/libssl/man/SSL_connect.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_connect 3" -.TH SSL_connect 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_connect 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_do_handshake.3 b/secure/lib/libssl/man/SSL_do_handshake.3 index 4781a36c626..a26b6c94745 100644 --- a/secure/lib/libssl/man/SSL_do_handshake.3 +++ b/secure/lib/libssl/man/SSL_do_handshake.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_do_handshake 3" -.TH SSL_do_handshake 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_do_handshake 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_free.3 b/secure/lib/libssl/man/SSL_free.3 index 67a2cac9d41..471e7ab7085 100644 --- a/secure/lib/libssl/man/SSL_free.3 +++ b/secure/lib/libssl/man/SSL_free.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_free 3" -.TH SSL_free 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_free 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_get_SSL_CTX.3 b/secure/lib/libssl/man/SSL_get_SSL_CTX.3 index 528dd6b32ff..4541f4d2ed6 100644 --- a/secure/lib/libssl/man/SSL_get_SSL_CTX.3 +++ b/secure/lib/libssl/man/SSL_get_SSL_CTX.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_get_SSL_CTX 3" -.TH SSL_get_SSL_CTX 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_get_SSL_CTX 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_get_ciphers.3 b/secure/lib/libssl/man/SSL_get_ciphers.3 index 1b5db8e2b0a..4c5ef0879b5 100644 --- a/secure/lib/libssl/man/SSL_get_ciphers.3 +++ b/secure/lib/libssl/man/SSL_get_ciphers.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_get_ciphers 3" -.TH SSL_get_ciphers 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_get_ciphers 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_get_client_CA_list.3 b/secure/lib/libssl/man/SSL_get_client_CA_list.3 index 2f7e7abfcdc..e5f9a9947d0 100644 --- a/secure/lib/libssl/man/SSL_get_client_CA_list.3 +++ b/secure/lib/libssl/man/SSL_get_client_CA_list.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_get_client_CA_list 3" -.TH SSL_get_client_CA_list 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_get_client_CA_list 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_get_current_cipher.3 b/secure/lib/libssl/man/SSL_get_current_cipher.3 index 31ae13e5f0d..d04f13633a4 100644 --- a/secure/lib/libssl/man/SSL_get_current_cipher.3 +++ b/secure/lib/libssl/man/SSL_get_current_cipher.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_get_current_cipher 3" -.TH SSL_get_current_cipher 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_get_current_cipher 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_get_default_timeout.3 b/secure/lib/libssl/man/SSL_get_default_timeout.3 index 575e4871e60..88ea7573057 100644 --- a/secure/lib/libssl/man/SSL_get_default_timeout.3 +++ b/secure/lib/libssl/man/SSL_get_default_timeout.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_get_default_timeout 3" -.TH SSL_get_default_timeout 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_get_default_timeout 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_get_error.3 b/secure/lib/libssl/man/SSL_get_error.3 index 3ce3c22dd19..760af98d458 100644 --- a/secure/lib/libssl/man/SSL_get_error.3 +++ b/secure/lib/libssl/man/SSL_get_error.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_get_error 3" -.TH SSL_get_error 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_get_error 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 b/secure/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 index 0eebf322375..71d554c35ea 100644 --- a/secure/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 +++ b/secure/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_get_ex_data_X509_STORE_CTX_idx 3" -.TH SSL_get_ex_data_X509_STORE_CTX_idx 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_get_ex_data_X509_STORE_CTX_idx 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_get_ex_new_index.3 b/secure/lib/libssl/man/SSL_get_ex_new_index.3 index 425f4a96f31..05d0625c020 100644 --- a/secure/lib/libssl/man/SSL_get_ex_new_index.3 +++ b/secure/lib/libssl/man/SSL_get_ex_new_index.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_get_ex_new_index 3" -.TH SSL_get_ex_new_index 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_get_ex_new_index 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_get_fd.3 b/secure/lib/libssl/man/SSL_get_fd.3 index 17f33b0f016..bcaaa8e0afd 100644 --- a/secure/lib/libssl/man/SSL_get_fd.3 +++ b/secure/lib/libssl/man/SSL_get_fd.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_get_fd 3" -.TH SSL_get_fd 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_get_fd 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_get_peer_cert_chain.3 b/secure/lib/libssl/man/SSL_get_peer_cert_chain.3 index 0478af6ab26..0303b846a9b 100644 --- a/secure/lib/libssl/man/SSL_get_peer_cert_chain.3 +++ b/secure/lib/libssl/man/SSL_get_peer_cert_chain.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_get_peer_cert_chain 3" -.TH SSL_get_peer_cert_chain 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_get_peer_cert_chain 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -136,11 +136,11 @@ SSL_get_peer_cert_chain \- get the X509 certificate chain of the peer .Vb 1 \& #include \& -\& STACKOF(X509) *SSL_get_peer_cert_chain(const SSL *ssl); +\& STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *ssl); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" -\&\fISSL_get_peer_cert_chain()\fR returns a pointer to \s-1STACKOF\s0(X509) certificates +\&\fISSL_get_peer_cert_chain()\fR returns a pointer to \s-1STACK_OF\s0(X509) certificates forming the certificate chain of the peer. If called on the client side, the stack also contains the peer's certificate; if called on the server side, the peer's certificate must be obtained separately using @@ -151,7 +151,7 @@ If the peer did not present a certificate, \s-1NULL\s0 is returned. The peer certificate chain is not necessarily available after reusing a session, in which case a \s-1NULL\s0 pointer is returned. .PP -The reference count of the \s-1STACKOF\s0(X509) object is not incremented. +The reference count of the \s-1STACK_OF\s0(X509) object is not incremented. If the corresponding session is freed, the pointer must not be used any longer. .SH "RETURN VALUES" @@ -161,8 +161,8 @@ The following return values can occur: .IX Item "NULL" No certificate was presented by the peer or no connection was established or the certificate chain is no longer available when a session is reused. -.IP "Pointer to a \s-1STACKOF\s0(X509)" 4 -.IX Item "Pointer to a STACKOF(X509)" +.IP "Pointer to a \s-1STACK_OF\s0(X509)" 4 +.IX Item "Pointer to a STACK_OF(X509)" The return value points to the certificate chain presented by the peer. .SH "SEE ALSO" .IX Header "SEE ALSO" diff --git a/secure/lib/libssl/man/SSL_get_peer_certificate.3 b/secure/lib/libssl/man/SSL_get_peer_certificate.3 index 27fe076477f..5e9604fce9e 100644 --- a/secure/lib/libssl/man/SSL_get_peer_certificate.3 +++ b/secure/lib/libssl/man/SSL_get_peer_certificate.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_get_peer_certificate 3" -.TH SSL_get_peer_certificate 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_get_peer_certificate 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_get_psk_identity.3 b/secure/lib/libssl/man/SSL_get_psk_identity.3 index fe26830b3c2..11c7d981879 100644 --- a/secure/lib/libssl/man/SSL_get_psk_identity.3 +++ b/secure/lib/libssl/man/SSL_get_psk_identity.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_get_psk_identity 3" -.TH SSL_get_psk_identity 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_get_psk_identity 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_get_rbio.3 b/secure/lib/libssl/man/SSL_get_rbio.3 index ddc71214e58..34f5c886e7d 100644 --- a/secure/lib/libssl/man/SSL_get_rbio.3 +++ b/secure/lib/libssl/man/SSL_get_rbio.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_get_rbio 3" -.TH SSL_get_rbio 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_get_rbio 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_get_session.3 b/secure/lib/libssl/man/SSL_get_session.3 index dfc35bd4e8b..b8b14abcc4e 100644 --- a/secure/lib/libssl/man/SSL_get_session.3 +++ b/secure/lib/libssl/man/SSL_get_session.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_get_session 3" -.TH SSL_get_session 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_get_session 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_get_verify_result.3 b/secure/lib/libssl/man/SSL_get_verify_result.3 index 8e7b2e29bd2..c31cbe7fdb1 100644 --- a/secure/lib/libssl/man/SSL_get_verify_result.3 +++ b/secure/lib/libssl/man/SSL_get_verify_result.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_get_verify_result 3" -.TH SSL_get_verify_result 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_get_verify_result 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_get_version.3 b/secure/lib/libssl/man/SSL_get_version.3 index a81a2e9a147..b0789e469a1 100644 --- a/secure/lib/libssl/man/SSL_get_version.3 +++ b/secure/lib/libssl/man/SSL_get_version.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_get_version 3" -.TH SSL_get_version 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_get_version 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_library_init.3 b/secure/lib/libssl/man/SSL_library_init.3 index 1da471386f1..80b04c1da50 100644 --- a/secure/lib/libssl/man/SSL_library_init.3 +++ b/secure/lib/libssl/man/SSL_library_init.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_library_init 3" -.TH SSL_library_init 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_library_init 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_load_client_CA_file.3 b/secure/lib/libssl/man/SSL_load_client_CA_file.3 index 9df33b36cba..06baac98ed0 100644 --- a/secure/lib/libssl/man/SSL_load_client_CA_file.3 +++ b/secure/lib/libssl/man/SSL_load_client_CA_file.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_load_client_CA_file 3" -.TH SSL_load_client_CA_file 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_load_client_CA_file 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_new.3 b/secure/lib/libssl/man/SSL_new.3 index 4ae53af072d..f3daedd20b9 100644 --- a/secure/lib/libssl/man/SSL_new.3 +++ b/secure/lib/libssl/man/SSL_new.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_new 3" -.TH SSL_new 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_new 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_pending.3 b/secure/lib/libssl/man/SSL_pending.3 index cdbd1f6c664..d4bc050fb4e 100644 --- a/secure/lib/libssl/man/SSL_pending.3 +++ b/secure/lib/libssl/man/SSL_pending.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_pending 3" -.TH SSL_pending 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_pending 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_read.3 b/secure/lib/libssl/man/SSL_read.3 index 9c1656609d1..6411d54e8f0 100644 --- a/secure/lib/libssl/man/SSL_read.3 +++ b/secure/lib/libssl/man/SSL_read.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_read 3" -.TH SSL_read 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_read 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_rstate_string.3 b/secure/lib/libssl/man/SSL_rstate_string.3 index 89b83632e96..7235fd413d5 100644 --- a/secure/lib/libssl/man/SSL_rstate_string.3 +++ b/secure/lib/libssl/man/SSL_rstate_string.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_rstate_string 3" -.TH SSL_rstate_string 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_rstate_string 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_session_reused.3 b/secure/lib/libssl/man/SSL_session_reused.3 index 2cbdb8ac29c..8999288775e 100644 --- a/secure/lib/libssl/man/SSL_session_reused.3 +++ b/secure/lib/libssl/man/SSL_session_reused.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_session_reused 3" -.TH SSL_session_reused 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_session_reused 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_set_bio.3 b/secure/lib/libssl/man/SSL_set_bio.3 index 8ef2c3c58d7..bc2090cc94e 100644 --- a/secure/lib/libssl/man/SSL_set_bio.3 +++ b/secure/lib/libssl/man/SSL_set_bio.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_set_bio 3" -.TH SSL_set_bio 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_set_bio 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_set_connect_state.3 b/secure/lib/libssl/man/SSL_set_connect_state.3 index 645fa0e6cd3..8eb30ec7d95 100644 --- a/secure/lib/libssl/man/SSL_set_connect_state.3 +++ b/secure/lib/libssl/man/SSL_set_connect_state.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_set_connect_state 3" -.TH SSL_set_connect_state 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_set_connect_state 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_set_fd.3 b/secure/lib/libssl/man/SSL_set_fd.3 index 95f09b675ee..6b2b1380cdf 100644 --- a/secure/lib/libssl/man/SSL_set_fd.3 +++ b/secure/lib/libssl/man/SSL_set_fd.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_set_fd 3" -.TH SSL_set_fd 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_set_fd 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_set_session.3 b/secure/lib/libssl/man/SSL_set_session.3 index 63d914d3377..1611fa55712 100644 --- a/secure/lib/libssl/man/SSL_set_session.3 +++ b/secure/lib/libssl/man/SSL_set_session.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_set_session 3" -.TH SSL_set_session 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_set_session 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_set_shutdown.3 b/secure/lib/libssl/man/SSL_set_shutdown.3 index 20de221aa18..9f23b547e4a 100644 --- a/secure/lib/libssl/man/SSL_set_shutdown.3 +++ b/secure/lib/libssl/man/SSL_set_shutdown.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_set_shutdown 3" -.TH SSL_set_shutdown 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_set_shutdown 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_set_verify_result.3 b/secure/lib/libssl/man/SSL_set_verify_result.3 index 01727c9014a..b558d4ea5e2 100644 --- a/secure/lib/libssl/man/SSL_set_verify_result.3 +++ b/secure/lib/libssl/man/SSL_set_verify_result.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_set_verify_result 3" -.TH SSL_set_verify_result 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_set_verify_result 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_shutdown.3 b/secure/lib/libssl/man/SSL_shutdown.3 index 70fb3e7bf8f..dbec86da627 100644 --- a/secure/lib/libssl/man/SSL_shutdown.3 +++ b/secure/lib/libssl/man/SSL_shutdown.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_shutdown 3" -.TH SSL_shutdown 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_shutdown 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_state_string.3 b/secure/lib/libssl/man/SSL_state_string.3 index baa1fd8b3a2..4bd05adf0c8 100644 --- a/secure/lib/libssl/man/SSL_state_string.3 +++ b/secure/lib/libssl/man/SSL_state_string.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_state_string 3" -.TH SSL_state_string 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_state_string 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_want.3 b/secure/lib/libssl/man/SSL_want.3 index 73e1954e375..cd7dfd2162e 100644 --- a/secure/lib/libssl/man/SSL_want.3 +++ b/secure/lib/libssl/man/SSL_want.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_want 3" -.TH SSL_want 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_want 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/SSL_write.3 b/secure/lib/libssl/man/SSL_write.3 index 2aaf2837895..cfaf21a05d3 100644 --- a/secure/lib/libssl/man/SSL_write.3 +++ b/secure/lib/libssl/man/SSL_write.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SSL_write 3" -.TH SSL_write 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SSL_write 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/d2i_SSL_SESSION.3 b/secure/lib/libssl/man/d2i_SSL_SESSION.3 index 289adf2a3a9..68eaa3c3fc3 100644 --- a/secure/lib/libssl/man/d2i_SSL_SESSION.3 +++ b/secure/lib/libssl/man/d2i_SSL_SESSION.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "d2i_SSL_SESSION 3" -.TH d2i_SSL_SESSION 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH d2i_SSL_SESSION 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libssl/man/ssl.3 b/secure/lib/libssl/man/ssl.3 index 040268181af..623022f6766 100644 --- a/secure/lib/libssl/man/ssl.3 +++ b/secure/lib/libssl/man/ssl.3 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ssl 3" -.TH ssl 3 "2014-04-07" "1.0.1g" "OpenSSL" +.TH ssl 3 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/libexec/sftp-server/Makefile.depend b/secure/libexec/sftp-server/Makefile.depend index 277d93412b9..6a5cf9c35ef 100644 --- a/secure/libexec/sftp-server/Makefile.depend +++ b/secure/libexec/sftp-server/Makefile.depend @@ -10,7 +10,6 @@ DIRDEPS = \ include/xlocale \ kerberos5/lib/libasn1 \ kerberos5/lib/libheimbase \ - kerberos5/lib/libheimipcc \ kerberos5/lib/libhx509 \ kerberos5/lib/libkrb5 \ kerberos5/lib/libroken \ @@ -21,7 +20,6 @@ DIRDEPS = \ lib/libcompiler_rt \ lib/libcrypt \ lib/libgssapi \ - lib/libldns \ lib/libmd \ lib/libpam/libpam \ lib/libthr \ diff --git a/secure/libexec/ssh-keysign/Makefile.depend b/secure/libexec/ssh-keysign/Makefile.depend index 277d93412b9..6a5cf9c35ef 100644 --- a/secure/libexec/ssh-keysign/Makefile.depend +++ b/secure/libexec/ssh-keysign/Makefile.depend @@ -10,7 +10,6 @@ DIRDEPS = \ include/xlocale \ kerberos5/lib/libasn1 \ kerberos5/lib/libheimbase \ - kerberos5/lib/libheimipcc \ kerberos5/lib/libhx509 \ kerberos5/lib/libkrb5 \ kerberos5/lib/libroken \ @@ -21,7 +20,6 @@ DIRDEPS = \ lib/libcompiler_rt \ lib/libcrypt \ lib/libgssapi \ - lib/libldns \ lib/libmd \ lib/libpam/libpam \ lib/libthr \ diff --git a/secure/libexec/ssh-pkcs11-helper/Makefile.depend b/secure/libexec/ssh-pkcs11-helper/Makefile.depend index 277d93412b9..6a5cf9c35ef 100644 --- a/secure/libexec/ssh-pkcs11-helper/Makefile.depend +++ b/secure/libexec/ssh-pkcs11-helper/Makefile.depend @@ -10,7 +10,6 @@ DIRDEPS = \ include/xlocale \ kerberos5/lib/libasn1 \ kerberos5/lib/libheimbase \ - kerberos5/lib/libheimipcc \ kerberos5/lib/libhx509 \ kerberos5/lib/libkrb5 \ kerberos5/lib/libroken \ @@ -21,7 +20,6 @@ DIRDEPS = \ lib/libcompiler_rt \ lib/libcrypt \ lib/libgssapi \ - lib/libldns \ lib/libmd \ lib/libpam/libpam \ lib/libthr \ diff --git a/secure/usr.bin/openssl/man/CA.pl.1 b/secure/usr.bin/openssl/man/CA.pl.1 index 943abf39f6d..12de6cf3f40 100644 --- a/secure/usr.bin/openssl/man/CA.pl.1 +++ b/secure/usr.bin/openssl/man/CA.pl.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CA.PL 1" -.TH CA.PL 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CA.PL 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/asn1parse.1 b/secure/usr.bin/openssl/man/asn1parse.1 index 913dcd743a6..4925ca412a1 100644 --- a/secure/usr.bin/openssl/man/asn1parse.1 +++ b/secure/usr.bin/openssl/man/asn1parse.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ASN1PARSE 1" -.TH ASN1PARSE 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH ASN1PARSE 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/ca.1 b/secure/usr.bin/openssl/man/ca.1 index 623f976695b..cd9990dafdc 100644 --- a/secure/usr.bin/openssl/man/ca.1 +++ b/secure/usr.bin/openssl/man/ca.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CA 1" -.TH CA 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CA 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/ciphers.1 b/secure/usr.bin/openssl/man/ciphers.1 index ae4d2fc3ebe..74b67178c21 100644 --- a/secure/usr.bin/openssl/man/ciphers.1 +++ b/secure/usr.bin/openssl/man/ciphers.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CIPHERS 1" -.TH CIPHERS 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CIPHERS 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/cms.1 b/secure/usr.bin/openssl/man/cms.1 index 0e3c654929d..d77ae2800d9 100644 --- a/secure/usr.bin/openssl/man/cms.1 +++ b/secure/usr.bin/openssl/man/cms.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CMS 1" -.TH CMS 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CMS 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -210,6 +210,10 @@ actual \s-1CMS\s0 type is EnvelopedData. decrypt mail using the supplied certificate and private key. Expects an encrypted mail message in \s-1MIME\s0 format for the input file. The decrypted mail is written to the output file. +.IP "\fB\-debug_decrypt\fR" 4 +.IX Item "-debug_decrypt" +this option sets the \fB\s-1CMS_DEBUG_DECRYPT\s0\fR flag. This option should be used +with caution: see the notes section below. .IP "\fB\-sign\fR" 4 .IX Item "-sign" sign mail using the supplied certificate and private key. Input file is @@ -510,6 +514,16 @@ and no longer \s-1DER\s0. Streaming is supported for the \fB\-encrypt\fR operati Streaming is always used for the \fB\-sign\fR operation with detached data but since the content is no longer part of the \s-1CMS\s0 structure the encoding remains \s-1DER\s0. +.PP +If the \fB\-decrypt\fR option is used without a recipient certificate then an +attempt is made to locate the recipient by trying each potential recipient +in turn using the supplied private key. To thwart the \s-1MMA\s0 attack +(Bleichenbacher's attack on \s-1PKCS\s0 #1 v1.5 \s-1RSA\s0 padding) all recipients are +tried whether they succeed or not and if no recipients match the message +is \*(L"decrypted\*(R" using a random key which will typically output garbage. +The \fB\-debug_decrypt\fR option can be used to disable the \s-1MMA\s0 attack protection +and return an error if no recipient can be found: this option should be used +with caution. For a fuller description see \fICMS_decrypt\fR\|(3)). .SH "EXIT CODES" .IX Header "EXIT CODES" .IP "0" 4 diff --git a/secure/usr.bin/openssl/man/crl.1 b/secure/usr.bin/openssl/man/crl.1 index 44b444d141f..f902d90881f 100644 --- a/secure/usr.bin/openssl/man/crl.1 +++ b/secure/usr.bin/openssl/man/crl.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CRL 1" -.TH CRL 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CRL 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/crl2pkcs7.1 b/secure/usr.bin/openssl/man/crl2pkcs7.1 index 546923621bf..880d2a837c8 100644 --- a/secure/usr.bin/openssl/man/crl2pkcs7.1 +++ b/secure/usr.bin/openssl/man/crl2pkcs7.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CRL2PKCS7 1" -.TH CRL2PKCS7 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH CRL2PKCS7 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/dgst.1 b/secure/usr.bin/openssl/man/dgst.1 index 64f91e99121..93b40263eb2 100644 --- a/secure/usr.bin/openssl/man/dgst.1 +++ b/secure/usr.bin/openssl/man/dgst.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "DGST 1" -.TH DGST 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH DGST 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/dhparam.1 b/secure/usr.bin/openssl/man/dhparam.1 index ca841e61e5d..35d7117965b 100644 --- a/secure/usr.bin/openssl/man/dhparam.1 +++ b/secure/usr.bin/openssl/man/dhparam.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "DHPARAM 1" -.TH DHPARAM 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH DHPARAM 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/dsa.1 b/secure/usr.bin/openssl/man/dsa.1 index caa015b61e2..e2f43f9d31a 100644 --- a/secure/usr.bin/openssl/man/dsa.1 +++ b/secure/usr.bin/openssl/man/dsa.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "DSA 1" -.TH DSA 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH DSA 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/dsaparam.1 b/secure/usr.bin/openssl/man/dsaparam.1 index a4e9f500ec7..e1bab9dcd35 100644 --- a/secure/usr.bin/openssl/man/dsaparam.1 +++ b/secure/usr.bin/openssl/man/dsaparam.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "DSAPARAM 1" -.TH DSAPARAM 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH DSAPARAM 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/ec.1 b/secure/usr.bin/openssl/man/ec.1 index 22bf1212308..0c7ac21b1ef 100644 --- a/secure/usr.bin/openssl/man/ec.1 +++ b/secure/usr.bin/openssl/man/ec.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EC 1" -.TH EC 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH EC 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/ecparam.1 b/secure/usr.bin/openssl/man/ecparam.1 index f9bdf1bcd44..f09eb4629db 100644 --- a/secure/usr.bin/openssl/man/ecparam.1 +++ b/secure/usr.bin/openssl/man/ecparam.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ECPARAM 1" -.TH ECPARAM 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH ECPARAM 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/enc.1 b/secure/usr.bin/openssl/man/enc.1 index fcb69aa1d68..eb1902728e8 100644 --- a/secure/usr.bin/openssl/man/enc.1 +++ b/secure/usr.bin/openssl/man/enc.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ENC 1" -.TH ENC 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH ENC 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -311,6 +311,10 @@ unsupported options (for example \fBopenssl enc \-help\fR) includes a list of ciphers, supported by your versesion of OpenSSL, including ones provided by configured engines. .PP +The \fBenc\fR program does not support authenticated encryption modes +like \s-1CCM\s0 and \s-1GCM\s0. The utility does not store or retrieve the +authentication tag. +.PP .Vb 1 \& base64 Base 64 \& diff --git a/secure/usr.bin/openssl/man/errstr.1 b/secure/usr.bin/openssl/man/errstr.1 index fc69b8e2d8d..e2bb048bf14 100644 --- a/secure/usr.bin/openssl/man/errstr.1 +++ b/secure/usr.bin/openssl/man/errstr.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ERRSTR 1" -.TH ERRSTR 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH ERRSTR 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/gendsa.1 b/secure/usr.bin/openssl/man/gendsa.1 index 7a70b6c972c..a1312785f9d 100644 --- a/secure/usr.bin/openssl/man/gendsa.1 +++ b/secure/usr.bin/openssl/man/gendsa.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "GENDSA 1" -.TH GENDSA 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH GENDSA 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/genpkey.1 b/secure/usr.bin/openssl/man/genpkey.1 index 7fbe3aa540e..5ebcd80389e 100644 --- a/secure/usr.bin/openssl/man/genpkey.1 +++ b/secure/usr.bin/openssl/man/genpkey.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "GENPKEY 1" -.TH GENPKEY 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH GENPKEY 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/genrsa.1 b/secure/usr.bin/openssl/man/genrsa.1 index 940b191ee1d..20dce213f59 100644 --- a/secure/usr.bin/openssl/man/genrsa.1 +++ b/secure/usr.bin/openssl/man/genrsa.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "GENRSA 1" -.TH GENRSA 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH GENRSA 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/nseq.1 b/secure/usr.bin/openssl/man/nseq.1 index 101fc5eb41e..9aa88e6c868 100644 --- a/secure/usr.bin/openssl/man/nseq.1 +++ b/secure/usr.bin/openssl/man/nseq.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "NSEQ 1" -.TH NSEQ 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH NSEQ 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/ocsp.1 b/secure/usr.bin/openssl/man/ocsp.1 index ed0429b451d..8225e971726 100644 --- a/secure/usr.bin/openssl/man/ocsp.1 +++ b/secure/usr.bin/openssl/man/ocsp.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "OCSP 1" -.TH OCSP 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH OCSP 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/openssl.1 b/secure/usr.bin/openssl/man/openssl.1 index 3d79f80e4e6..52e984a871c 100644 --- a/secure/usr.bin/openssl/man/openssl.1 +++ b/secure/usr.bin/openssl/man/openssl.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "OPENSSL 1" -.TH OPENSSL 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH OPENSSL 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/passwd.1 b/secure/usr.bin/openssl/man/passwd.1 index b7abfddc6a2..f9245851b4b 100644 --- a/secure/usr.bin/openssl/man/passwd.1 +++ b/secure/usr.bin/openssl/man/passwd.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "PASSWD 1" -.TH PASSWD 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH PASSWD 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/pkcs12.1 b/secure/usr.bin/openssl/man/pkcs12.1 index 96d664a98b1..d51abed889b 100644 --- a/secure/usr.bin/openssl/man/pkcs12.1 +++ b/secure/usr.bin/openssl/man/pkcs12.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "PKCS12 1" -.TH PKCS12 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH PKCS12 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/pkcs7.1 b/secure/usr.bin/openssl/man/pkcs7.1 index b23d1866b2b..7755980d69a 100644 --- a/secure/usr.bin/openssl/man/pkcs7.1 +++ b/secure/usr.bin/openssl/man/pkcs7.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "PKCS7 1" -.TH PKCS7 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH PKCS7 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/pkcs8.1 b/secure/usr.bin/openssl/man/pkcs8.1 index 2204b8d4a5e..84747b7e173 100644 --- a/secure/usr.bin/openssl/man/pkcs8.1 +++ b/secure/usr.bin/openssl/man/pkcs8.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "PKCS8 1" -.TH PKCS8 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH PKCS8 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/pkey.1 b/secure/usr.bin/openssl/man/pkey.1 index d5a0b99a485..a5d80d2eac6 100644 --- a/secure/usr.bin/openssl/man/pkey.1 +++ b/secure/usr.bin/openssl/man/pkey.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "PKEY 1" -.TH PKEY 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH PKEY 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/pkeyparam.1 b/secure/usr.bin/openssl/man/pkeyparam.1 index cf29b1efa17..f56ce5a2742 100644 --- a/secure/usr.bin/openssl/man/pkeyparam.1 +++ b/secure/usr.bin/openssl/man/pkeyparam.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "PKEYPARAM 1" -.TH PKEYPARAM 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH PKEYPARAM 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/pkeyutl.1 b/secure/usr.bin/openssl/man/pkeyutl.1 index 7f1142dc655..dde13bb3753 100644 --- a/secure/usr.bin/openssl/man/pkeyutl.1 +++ b/secure/usr.bin/openssl/man/pkeyutl.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "PKEYUTL 1" -.TH PKEYUTL 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH PKEYUTL 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/rand.1 b/secure/usr.bin/openssl/man/rand.1 index cd5975ef649..6bbd75a92bd 100644 --- a/secure/usr.bin/openssl/man/rand.1 +++ b/secure/usr.bin/openssl/man/rand.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "RAND 1" -.TH RAND 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH RAND 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/req.1 b/secure/usr.bin/openssl/man/req.1 index f5fca096b33..c70a78e52e9 100644 --- a/secure/usr.bin/openssl/man/req.1 +++ b/secure/usr.bin/openssl/man/req.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "REQ 1" -.TH REQ 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH REQ 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/rsa.1 b/secure/usr.bin/openssl/man/rsa.1 index d38f61bf024..55141b7d5ce 100644 --- a/secure/usr.bin/openssl/man/rsa.1 +++ b/secure/usr.bin/openssl/man/rsa.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "RSA 1" -.TH RSA 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH RSA 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/rsautl.1 b/secure/usr.bin/openssl/man/rsautl.1 index 8b62ce8f1a7..c09e4729241 100644 --- a/secure/usr.bin/openssl/man/rsautl.1 +++ b/secure/usr.bin/openssl/man/rsautl.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "RSAUTL 1" -.TH RSAUTL 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH RSAUTL 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/s_client.1 b/secure/usr.bin/openssl/man/s_client.1 index a190b498323..8473cc1581a 100644 --- a/secure/usr.bin/openssl/man/s_client.1 +++ b/secure/usr.bin/openssl/man/s_client.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "S_CLIENT 1" -.TH S_CLIENT 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH S_CLIENT 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/s_server.1 b/secure/usr.bin/openssl/man/s_server.1 index 9928407a861..b81481df036 100644 --- a/secure/usr.bin/openssl/man/s_server.1 +++ b/secure/usr.bin/openssl/man/s_server.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "S_SERVER 1" -.TH S_SERVER 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH S_SERVER 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -170,6 +170,7 @@ s_server \- SSL/TLS server program [\fB\-no_ssl3\fR] [\fB\-no_tls1\fR] [\fB\-no_dhe\fR] +[\fB\-no_ecdhe\fR] [\fB\-bugs\fR] [\fB\-hack\fR] [\fB\-www\fR] @@ -241,6 +242,10 @@ a static set of parameters hard coded into the s_server program will be used. .IX Item "-no_dhe" if this option is set then no \s-1DH\s0 parameters will be loaded effectively disabling the ephemeral \s-1DH\s0 cipher suites. +.IP "\fB\-no_ecdhe\fR" 4 +.IX Item "-no_ecdhe" +if this option is set then no \s-1ECDH\s0 parameters will be loaded effectively +disabling the ephemeral \s-1ECDH\s0 cipher suites. .IP "\fB\-no_tmp_rsa\fR" 4 .IX Item "-no_tmp_rsa" certain export cipher suites sometimes use a temporary \s-1RSA\s0 key, this option diff --git a/secure/usr.bin/openssl/man/s_time.1 b/secure/usr.bin/openssl/man/s_time.1 index 9b1c5444fe6..1cd08608f2f 100644 --- a/secure/usr.bin/openssl/man/s_time.1 +++ b/secure/usr.bin/openssl/man/s_time.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "S_TIME 1" -.TH S_TIME 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH S_TIME 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/sess_id.1 b/secure/usr.bin/openssl/man/sess_id.1 index d36aaf2427c..d16fb997a20 100644 --- a/secure/usr.bin/openssl/man/sess_id.1 +++ b/secure/usr.bin/openssl/man/sess_id.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SESS_ID 1" -.TH SESS_ID 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SESS_ID 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/smime.1 b/secure/usr.bin/openssl/man/smime.1 index c686dfbe535..a50c5b7fc12 100644 --- a/secure/usr.bin/openssl/man/smime.1 +++ b/secure/usr.bin/openssl/man/smime.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SMIME 1" -.TH SMIME 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SMIME 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -264,7 +264,7 @@ triple \s-1DES\s0 (168 bits) \- \fB\-des3\fR, example \fB\-aes_128_cbc\fR. See \fBenc\fR for list of ciphers supported by your version of OpenSSL. .Sp -If not specified 40 bit \s-1RC2\s0 is used. Only used with \fB\-encrypt\fR. +If not specified triple \s-1DES\s0 is used. Only used with \fB\-encrypt\fR. .IP "\fB\-nointern\fR" 4 .IX Item "-nointern" when verifying a message normally certificates (if any) included in diff --git a/secure/usr.bin/openssl/man/speed.1 b/secure/usr.bin/openssl/man/speed.1 index 33eaded438e..094620fb201 100644 --- a/secure/usr.bin/openssl/man/speed.1 +++ b/secure/usr.bin/openssl/man/speed.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SPEED 1" -.TH SPEED 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SPEED 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/spkac.1 b/secure/usr.bin/openssl/man/spkac.1 index 7c33ec54632..bbd61b88256 100644 --- a/secure/usr.bin/openssl/man/spkac.1 +++ b/secure/usr.bin/openssl/man/spkac.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "SPKAC 1" -.TH SPKAC 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH SPKAC 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/ts.1 b/secure/usr.bin/openssl/man/ts.1 index c8e72e0173e..ffa5294c264 100644 --- a/secure/usr.bin/openssl/man/ts.1 +++ b/secure/usr.bin/openssl/man/ts.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "TS 1" -.TH TS 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH TS 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/tsget.1 b/secure/usr.bin/openssl/man/tsget.1 index 77f548b353f..e3d9ec888e8 100644 --- a/secure/usr.bin/openssl/man/tsget.1 +++ b/secure/usr.bin/openssl/man/tsget.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "TSGET 1" -.TH TSGET 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH TSGET 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/verify.1 b/secure/usr.bin/openssl/man/verify.1 index 890c35e0c7f..81d3f3e6a6c 100644 --- a/secure/usr.bin/openssl/man/verify.1 +++ b/secure/usr.bin/openssl/man/verify.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "VERIFY 1" -.TH VERIFY 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH VERIFY 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -152,6 +152,7 @@ verify \- Utility to verify certificates. [\fB\-untrusted file\fR] [\fB\-help\fR] [\fB\-issuer_checks\fR] +[\fB\-attime timestamp\fR] [\fB\-verbose\fR] [\fB\-\fR] [certificates] @@ -195,6 +196,11 @@ current certificate. This shows why each candidate issuer certificate was rejected. The presence of rejection messages does not itself imply that anything is wrong; during the normal verification process, several rejections may take place. +.IP "\fB\-attime timestamp\fR" 4 +.IX Item "-attime timestamp" +Perform validation checks using time specified by \fBtimestamp\fR and not +current system time. \fBtimestamp\fR is the number of seconds since +01.01.1970 (\s-1UNIX\s0 time). .IP "\fB\-policy arg\fR" 4 .IX Item "-policy arg" Enable policy processing and add \fBarg\fR to the user-initial-policy-set (see @@ -447,7 +453,7 @@ does not permit certificate signing. an application specific error. Unused. .SH "BUGS" .IX Header "BUGS" -Although the issuer checks are a considerably improvement over the old technique they still +Although the issuer checks are a considerable improvement over the old technique they still suffer from limitations in the underlying X509_LOOKUP \s-1API\s0. One consequence of this is that trusted certificates with matching subject name must either appear in a file (as specified by the \&\fB\-CAfile\fR option) or a directory (as specified by \fB\-CApath\fR. If they occur in both then only diff --git a/secure/usr.bin/openssl/man/version.1 b/secure/usr.bin/openssl/man/version.1 index 6757ca3b0e2..5c10b1c963f 100644 --- a/secure/usr.bin/openssl/man/version.1 +++ b/secure/usr.bin/openssl/man/version.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "VERSION 1" -.TH VERSION 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH VERSION 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -140,6 +140,7 @@ version \- print OpenSSL version information [\fB\-o\fR] [\fB\-f\fR] [\fB\-p\fR] +[\fB\-d\fR] .SH "DESCRIPTION" .IX Header "DESCRIPTION" This command is used to print out version information about OpenSSL. @@ -157,8 +158,8 @@ the date the current version of OpenSSL was built. .IP "\fB\-o\fR" 4 .IX Item "-o" option information: various options set when the library was built. -.IP "\fB\-c\fR" 4 -.IX Item "-c" +.IP "\fB\-f\fR" 4 +.IX Item "-f" compilation flags. .IP "\fB\-p\fR" 4 .IX Item "-p" diff --git a/secure/usr.bin/openssl/man/x509.1 b/secure/usr.bin/openssl/man/x509.1 index 14cc7f42827..5b0617c9489 100644 --- a/secure/usr.bin/openssl/man/x509.1 +++ b/secure/usr.bin/openssl/man/x509.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "X509 1" -.TH X509 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH X509 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/usr.bin/openssl/man/x509v3_config.1 b/secure/usr.bin/openssl/man/x509v3_config.1 index e1f37c6408d..6a24214a031 100644 --- a/secure/usr.bin/openssl/man/x509v3_config.1 +++ b/secure/usr.bin/openssl/man/x509v3_config.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "X509V3_CONFIG 1" -.TH X509V3_CONFIG 1 "2014-04-07" "1.0.1g" "OpenSSL" +.TH X509V3_CONFIG 1 "2014-06-05" "1.0.1h" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -533,7 +533,6 @@ Examples: \& nameConstraints=permitted;email:.somedomain.com \& \& nameConstraints=excluded;email:.com -\&issuingDistributionPoint = idp_section .Ve .SS "\s-1OCSP\s0 No Check" .IX Subsection "OCSP No Check" diff --git a/secure/usr.bin/scp/Makefile.depend b/secure/usr.bin/scp/Makefile.depend index 277d93412b9..6a5cf9c35ef 100644 --- a/secure/usr.bin/scp/Makefile.depend +++ b/secure/usr.bin/scp/Makefile.depend @@ -10,7 +10,6 @@ DIRDEPS = \ include/xlocale \ kerberos5/lib/libasn1 \ kerberos5/lib/libheimbase \ - kerberos5/lib/libheimipcc \ kerberos5/lib/libhx509 \ kerberos5/lib/libkrb5 \ kerberos5/lib/libroken \ @@ -21,7 +20,6 @@ DIRDEPS = \ lib/libcompiler_rt \ lib/libcrypt \ lib/libgssapi \ - lib/libldns \ lib/libmd \ lib/libpam/libpam \ lib/libthr \ diff --git a/secure/usr.bin/sftp/Makefile b/secure/usr.bin/sftp/Makefile index 15dcaa52061..bb1c325ed85 100644 --- a/secure/usr.bin/sftp/Makefile +++ b/secure/usr.bin/sftp/Makefile @@ -11,8 +11,8 @@ CFLAGS+=-I${SSHDIR} -include ssh_namespace.h SRCS+= roaming_dummy.c .endif -DPADD= ${LIBSSH} ${LIBEDIT} ${LIBNCURSES} -LDADD= -lssh -ledit -lncurses +DPADD= ${LIBSSH} ${LIBEDIT} ${LIBNCURSESW} +LDADD= -lssh -ledit -lncursesw USEPRIVATELIB= ssh .if ${MK_LDNS} != "no" diff --git a/secure/usr.bin/sftp/Makefile.depend b/secure/usr.bin/sftp/Makefile.depend index 2a5eb5d4204..99872e52973 100644 --- a/secure/usr.bin/sftp/Makefile.depend +++ b/secure/usr.bin/sftp/Makefile.depend @@ -10,7 +10,6 @@ DIRDEPS = \ include/xlocale \ kerberos5/lib/libasn1 \ kerberos5/lib/libheimbase \ - kerberos5/lib/libheimipcc \ kerberos5/lib/libhx509 \ kerberos5/lib/libkrb5 \ kerberos5/lib/libroken \ @@ -22,13 +21,12 @@ DIRDEPS = \ lib/libcrypt \ lib/libedit \ lib/libgssapi \ - lib/libldns \ lib/libmd \ lib/libpam/libpam \ lib/libthr \ lib/libutil \ lib/libz \ - lib/ncurses/ncurses \ + lib/ncurses/ncursesw \ secure/lib/libcrypto \ secure/lib/libssh \ diff --git a/secure/usr.bin/ssh-add/Makefile.depend b/secure/usr.bin/ssh-add/Makefile.depend index 277d93412b9..6a5cf9c35ef 100644 --- a/secure/usr.bin/ssh-add/Makefile.depend +++ b/secure/usr.bin/ssh-add/Makefile.depend @@ -10,7 +10,6 @@ DIRDEPS = \ include/xlocale \ kerberos5/lib/libasn1 \ kerberos5/lib/libheimbase \ - kerberos5/lib/libheimipcc \ kerberos5/lib/libhx509 \ kerberos5/lib/libkrb5 \ kerberos5/lib/libroken \ @@ -21,7 +20,6 @@ DIRDEPS = \ lib/libcompiler_rt \ lib/libcrypt \ lib/libgssapi \ - lib/libldns \ lib/libmd \ lib/libpam/libpam \ lib/libthr \ diff --git a/secure/usr.bin/ssh-agent/Makefile.depend b/secure/usr.bin/ssh-agent/Makefile.depend index 277d93412b9..6a5cf9c35ef 100644 --- a/secure/usr.bin/ssh-agent/Makefile.depend +++ b/secure/usr.bin/ssh-agent/Makefile.depend @@ -10,7 +10,6 @@ DIRDEPS = \ include/xlocale \ kerberos5/lib/libasn1 \ kerberos5/lib/libheimbase \ - kerberos5/lib/libheimipcc \ kerberos5/lib/libhx509 \ kerberos5/lib/libkrb5 \ kerberos5/lib/libroken \ @@ -21,7 +20,6 @@ DIRDEPS = \ lib/libcompiler_rt \ lib/libcrypt \ lib/libgssapi \ - lib/libldns \ lib/libmd \ lib/libpam/libpam \ lib/libthr \ diff --git a/secure/usr.bin/ssh-keygen/Makefile.depend b/secure/usr.bin/ssh-keygen/Makefile.depend index 277d93412b9..6281708625e 100644 --- a/secure/usr.bin/ssh-keygen/Makefile.depend +++ b/secure/usr.bin/ssh-keygen/Makefile.depend @@ -10,7 +10,6 @@ DIRDEPS = \ include/xlocale \ kerberos5/lib/libasn1 \ kerberos5/lib/libheimbase \ - kerberos5/lib/libheimipcc \ kerberos5/lib/libhx509 \ kerberos5/lib/libkrb5 \ kerberos5/lib/libroken \ diff --git a/secure/usr.bin/ssh-keyscan/Makefile.depend b/secure/usr.bin/ssh-keyscan/Makefile.depend index 277d93412b9..6a5cf9c35ef 100644 --- a/secure/usr.bin/ssh-keyscan/Makefile.depend +++ b/secure/usr.bin/ssh-keyscan/Makefile.depend @@ -10,7 +10,6 @@ DIRDEPS = \ include/xlocale \ kerberos5/lib/libasn1 \ kerberos5/lib/libheimbase \ - kerberos5/lib/libheimipcc \ kerberos5/lib/libhx509 \ kerberos5/lib/libkrb5 \ kerberos5/lib/libroken \ @@ -21,7 +20,6 @@ DIRDEPS = \ lib/libcompiler_rt \ lib/libcrypt \ lib/libgssapi \ - lib/libldns \ lib/libmd \ lib/libpam/libpam \ lib/libthr \ diff --git a/secure/usr.bin/ssh/Makefile.depend b/secure/usr.bin/ssh/Makefile.depend index c8445146b34..1021c1d581b 100644 --- a/secure/usr.bin/ssh/Makefile.depend +++ b/secure/usr.bin/ssh/Makefile.depend @@ -12,7 +12,6 @@ DIRDEPS = \ include/xlocale \ kerberos5/lib/libasn1 \ kerberos5/lib/libheimbase \ - kerberos5/lib/libheimipcc \ kerberos5/lib/libhx509 \ kerberos5/lib/libkrb5 \ kerberos5/lib/libroken \ diff --git a/secure/usr.sbin/sshd/Makefile.depend b/secure/usr.sbin/sshd/Makefile.depend index f6a63fe8e9d..5f689ae7cc5 100644 --- a/secure/usr.sbin/sshd/Makefile.depend +++ b/secure/usr.sbin/sshd/Makefile.depend @@ -24,7 +24,6 @@ DIRDEPS = \ lib/libcompiler_rt \ lib/libcrypt \ lib/libgssapi \ - lib/libldns \ lib/libmd \ lib/libpam/libpam \ lib/libthr \ diff --git a/share/Makefile b/share/Makefile index 604e4169313..63c18bb6464 100644 --- a/share/Makefile +++ b/share/Makefile @@ -28,6 +28,7 @@ SUBDIR= ${_colldef} \ termcap \ ${_tests} \ ${_timedef} \ + ${_vt} \ ${_zoneinfo} # NB: keep these sorted by MK_* knobs @@ -85,6 +86,10 @@ _syscons= syscons _tests= tests .endif +.if ${MK_VT} != "no" +_vt= vt +.endif + .if ${MK_ZONEINFO} != "no" _zoneinfo= zoneinfo .endif diff --git a/share/dict/freebsd b/share/dict/freebsd index c97170f3cc0..2321038fa38 100644 --- a/share/dict/freebsd +++ b/share/dict/freebsd @@ -79,7 +79,6 @@ ISBN ISDN ISP Iomega -Itanium JDK JRE JSP diff --git a/share/dtrace/hotopen b/share/dtrace/hotopen index 1570006a309..ba2777cfe89 100755 --- a/share/dtrace/hotopen +++ b/share/dtrace/hotopen @@ -1,40 +1,39 @@ -#!/bin/sh -# -# Copyright (c) 2012 George V. Neville-Neil -# 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$ -# -# The hotopen D script periodically outputs table of which UIDs -# are opening files. This is a very quick way to find out if -# a paritcular user is thrashing a system with rapid calls to -# open/close. -# -# Usage: hotopen -# +#!/usr/sbin/dtrace -s +/* + * Copyright (c) 2012 George V. Neville-Neil + * 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$ + * + * The hotopen D script periodically outputs table of which UIDs + * are opening files. This is a very quick way to find out if + * a paritcular user is thrashing a system with rapid calls to + * open/close. + * + * Usage: hotopen + */ -/usr/sbin/dtrace -n ' #pragma D option quiet BEGIN { @@ -55,4 +54,3 @@ tick-1sec trunc(@files); output = 0; } -' diff --git a/share/dtrace/nfsattrstats b/share/dtrace/nfsattrstats index 364a39af725..63ca9318cca 100755 --- a/share/dtrace/nfsattrstats +++ b/share/dtrace/nfsattrstats @@ -1,42 +1,42 @@ -#!/bin/sh -# -# Copyright (c) 2012 Robert N. M. Watson -# All rights reserved. -# -# This software was developed at the University of Cambridge Computer -# Laboratory with support from a grant from Google, 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. -# -# 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 creates a trace of NFS RPCs, NFS attribute cache -# activity, and NFS access cache activity, along with the system call -# that instigated the activity. Notice that NFS events may happen -# outside of the context of a system call, most likely due to the VM -# system paging from NFS, in which case the system call name is -# reported as "-" +#!/usr/sbin/dtrace -s +/* + * Copyright (c) 2012 Robert N. M. Watson + * All rights reserved. + * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, 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. + * + * 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 creates a trace of NFS RPCs, NFS attribute cache + * activity, and NFS access cache activity, along with the system call + * that instigated the activity. Notice that NFS events may happen + * outside of the context of a system call, most likely due to the VM + * system paging from NFS, in which case the system call name is + * reported as "-" + */ -/usr/sbin/dtrace -n ' #pragma D option quiet dtrace:::BEGIN @@ -71,4 +71,3 @@ nfsclient::: printf("%s\t%s\t%s\t%s\n", probemod, stringof(arg0), execname, self->syscallname); } -' diff --git a/share/dtrace/nfsclienttime b/share/dtrace/nfsclienttime index 335f067b385..2422305d893 100755 --- a/share/dtrace/nfsclienttime +++ b/share/dtrace/nfsclienttime @@ -1,46 +1,45 @@ -#!/bin/sh -# -# Copyright (c) 2012 Robert N. M. Watson -# All rights reserved. -# -# This software was developed at the University of Cambridge Computer -# Laboratory with support from a grant from Google, 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. -# -# 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 measures all time spent waiting on RPC replies for each -# system call, and then generates a histogram of those times sorted by -# system call name. -# -# Currently only supports NFSv3 -# -# Usage: nfsclienttime -# -# Press Ctrl-C to exit and display statistics. -# +#!/usr/sbin/dtrace -s +/* + * Copyright (c) 2012 Robert N. M. Watson + * All rights reserved. + * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, 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. + * + * 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 measures all time spent waiting on RPC replies for each + * system call, and then generates a histogram of those times sorted by + * system call name. + * + * Currently only supports NFSv3 + * + * Usage: nfsclienttime + * + * Press Ctrl-C to exit and display statistics. + */ -/usr/sbin/dtrace -n ' #pragma D option quiet dtrace:::BEGIN @@ -71,4 +70,3 @@ syscall:::return @syscalls[probefunc] = quantize(self->count); } -' diff --git a/share/examples/Makefile b/share/examples/Makefile index dcc3256d2d2..79de48eb312 100644 --- a/share/examples/Makefile +++ b/share/examples/Makefile @@ -10,7 +10,6 @@ LDIRS= BSD_daemon \ bhyve \ bootforth \ csh \ - cvsup \ diskless \ drivers \ etc \ @@ -52,10 +51,6 @@ XFILES= BSD_daemon/FreeBSD.pfa \ bootforth/menuconf.4th \ bootforth/screen.4th \ csh/dot.cshrc \ - cvsup/README \ - cvsup/cvs-supfile \ - cvsup/stable-supfile \ - cvsup/standard-supfile \ diskless/ME \ diskless/README.BOOTP \ diskless/README.TEMPLATING \ diff --git a/share/examples/bhyve/vmrun.sh b/share/examples/bhyve/vmrun.sh index 0714b7f6ceb..33d0db9ffc1 100755 --- a/share/examples/bhyve/vmrun.sh +++ b/share/examples/bhyve/vmrun.sh @@ -78,8 +78,8 @@ isofile=${DEFAULT_ISOFILE} memsize=${DEFAULT_MEMSIZE} console=${DEFAULT_CONSOLE} cpus=${DEFAULT_CPUS} -virtio_diskdev=${DEFAULT_VIRTIO_DISK} -tapdev=${DEFAULT_TAPDEV} +tap_total=0 +disk_total=0 apic_opt="" gdbport=0 loader_opt="" @@ -96,7 +96,8 @@ while getopts ac:C:d:e:g:hH:iI:m:t: c ; do console=${OPTARG} ;; d) - virtio_diskdev=${OPTARG} + eval "disk_dev${disk_total}=\"${OPTARG}\"" + disk_total=$(($disk_total + 1)) ;; e) loader_opt="${loader_opt} -e ${OPTARG}" @@ -117,7 +118,8 @@ while getopts ac:C:d:e:g:hH:iI:m:t: c ; do memsize=${OPTARG} ;; t) - tapdev=${OPTARG} + eval "tap_dev${tap_total}=\"${OPTARG}\"" + tap_total=$(($tap_total + 1)) ;; *) usage @@ -125,6 +127,16 @@ while getopts ac:C:d:e:g:hH:iI:m:t: c ; do esac done +if [ $tap_total -eq 0 ] ; then + tap_total=1 + tap_dev0="${DEFAULT_TAPDEV}" +fi +if [ $disk_total -eq 0 ] ; then + disk_total=1 + disk_dev0="${DEFAULT_VIRTIO_DISK}" + +fi + shift $((${OPTIND} - 1)) if [ $# -ne 1 ]; then @@ -136,29 +148,35 @@ if [ -n "${host_base}" ]; then loader_opt="${loader_opt} -h ${host_base}" fi -# Create the virtio diskdev file if needed -if [ ! -f ${virtio_diskdev} ]; then - echo "virtio disk device file \"${virtio_diskdev}\" does not exist." - echo "Creating it ..." - truncate -s 8G ${virtio_diskdev} > /dev/null -fi +make_and_check_diskdev() +{ + local virtio_diskdev="$1" + # Create the virtio diskdev file if needed + if [ ! -f ${virtio_diskdev} ]; then + echo "virtio disk device file \"${virtio_diskdev}\" does not exist." + echo "Creating it ..." + truncate -s 8G ${virtio_diskdev} > /dev/null + fi -if [ ! -r ${virtio_diskdev} ]; then - echo "virtio disk device file \"${virtio_diskdev}\" is not readable" - exit 1 -fi + if [ ! -r ${virtio_diskdev} ]; then + echo "virtio disk device file \"${virtio_diskdev}\" is not readable" + exit 1 + fi -if [ ! -w ${virtio_diskdev} ]; then - echo "virtio disk device file \"${virtio_diskdev}\" is not writable" - exit 1 -fi + if [ ! -w ${virtio_diskdev} ]; then + echo "virtio disk device file \"${virtio_diskdev}\" is not writable" + exit 1 + fi +} echo "Launching virtual machine \"$vmname\" ..." +virtio_diskdev="$disk_dev0" + while [ 1 ]; do ${BHYVECTL} --vm=${vmname} --destroy > /dev/null 2>&1 - file ${virtio_diskdev} | grep ": x86 boot sector" > /dev/null + file ${virtio_diskdev} | grep "boot sector" > /dev/null rc=$? if [ $rc -ne 0 ]; then file ${virtio_diskdev} | grep ": Unix Fast File sys" > /dev/null @@ -189,12 +207,33 @@ while [ 1 ]; do break fi + # + # Build up args for additional tap and disk devices now. + # + nextslot=2 # slot 0 is hostbridge, slot 1 is lpc + devargs="" # accumulate disk/tap args here + i=0 + while [ $i -lt $tap_total ] ; do + eval "tapname=\$tap_dev${i}" + devargs="$devargs -s $nextslot:0,virtio-net,${tapname} " + nextslot=$(($nextslot + 1)) + i=$(($i + 1)) + done + + i=0 + while [ $i -lt $disk_total ] ; do + eval "disk=\$disk_dev${i}" + make_and_check_diskdev "${disk}" + devargs="$devargs -s $nextslot:0,virtio-blk,${disk} " + nextslot=$(($nextslot + 1)) + i=$(($i + 1)) + done + ${FBSDRUN} -c ${cpus} -m ${memsize} ${apic_opt} -A -H -P \ -g ${gdbport} \ -s 0:0,hostbridge \ -s 1:0,lpc \ - -s 2:0,virtio-net,${tapdev} \ - -s 3:0,virtio-blk,${virtio_diskdev} \ + ${devargs} \ -l com1,${console} \ ${installer_opt} \ ${vmname} diff --git a/share/examples/cvsup/README b/share/examples/cvsup/README deleted file mode 100644 index 0bf29327c95..00000000000 --- a/share/examples/cvsup/README +++ /dev/null @@ -1,41 +0,0 @@ -# $FreeBSD$ - -BEWARE, CVS is deprecated and no longer supported by the FreeBSD project. - -The primary development work happens in Subversion and is temporarily -exported to the legacy CVS system with significant time delays. - -You should NOT set up a new consumer of FreeBSD source code via CVS. -Please see: -http://www.freebsd.org/doc/handbook/svn.html -http://www.freebsd.org/doc/handbook/svn-mirrors.html - -This directory contains sample "supfiles" for obtaining and updating -the FreeBSD sources via the Internet. These supfiles will work -with CVSup version 14.0 or later. For general information on CVSup -itself, please see http://www.freebsd.org/doc/handbook/cvsup.html - -To maintain the sources for the FreeBSD-current release, use: - - standard-supfile Main source tree - -To maintain the sources for the FreeBSD-stable release, use: - - stable-supfile Main source tree - -To maintain a copy of the CVS repository containing all versions of -FreeBSD, use: - - cvs-supfile Main source tree collection - -IMPORTANT: Before you use any of the supfiles in this directory, -you will need to edit in an appropriate "host" setting. See: - - http://www.freebsd.org/doc/handbook/mirrors.html - -for an up-to-date list of public CVSup mirror sites. - -To prevent CVSup from updating particular directories and files, use -this file: - - refuse diff --git a/share/examples/cvsup/cvs-supfile b/share/examples/cvsup/cvs-supfile deleted file mode 100644 index b501272a56c..00000000000 --- a/share/examples/cvsup/cvs-supfile +++ /dev/null @@ -1,79 +0,0 @@ -# $FreeBSD$ -# -# BEWARE, CVS is deprecated and no longer supported by the FreeBSD project. -# -# The primary development work happens in Subversion and is temporarily -# exported to the legacy CVS system with significant time delays. -# -# You should NOT set up a new consumer of FreeBSD source code via CVS. -# Please see: -# http://www.freebsd.org/doc/handbook/svn.html -# http://www.freebsd.org/doc/handbook/svn-mirrors.html -# -# csup (CVS Update Protocol) allows you to download the latest CVS -# tree (or any branch of development therefrom) to your system easily -# and efficiently -# -# To keep your CVS tree up-to-date run: -# -# csup cvs-supfile -# -# Note that this only updates the tree contents and does not -# update what is actually installed. -# -# You may wish to change some of the settings in this file to better -# suit your system: -# -# host=CHANGE_THIS.FreeBSD.org -# This specifies the server host which will supply the -# file updates. You must change it to one of the CVSup -# mirror sites listed in the FreeBSD Handbook at -# http://www.freebsd.org/doc/handbook/cvsup.html#CVSUP-MIRRORS. -# You can override this setting on the command line -# with cvsup's "-h host" option. -# -# base=/var/db -# This specifies the root where csup will store information -# about the collections you have transferred to your system. -# A setting of "/var/db" will generate this information in -# /var/db/sup. You can override the "base" setting on the -# command line with cvsup's "-b base" option. This directory -# must exist in order to run CVSup. -# -# prefix=/home/ncvs -# This specifies where to place the requested files. A -# setting of "/home/ncvs" will place all of the files -# requested in /home/ncvs (e.g., "/home/ncvs/src/bin"). -# The prefix directory must exist in order to run CVSup. - -# Defaults that apply to all the collections -# -# IMPORTANT: Change the next line to use one of the CVSup mirror sites -# listed at http://www.freebsd.org/doc/handbook/cvsup.html#CVSUP-MIRRORS. -*default host=CHANGE_THIS.FreeBSD.org -*default base=/var/db -*default prefix=/home/ncvs -*default release=cvs -*default delete use-rel-suffix - -# If you seem to be limited by CPU rather than network or disk bandwidth, try -# commenting out the following line. (Normally, today's CPUs are fast enough -# that you want to run compression.) -*default compress - -## Main Source Tree. -# -# The easiest way to get the main source tree is to use the "src-all" -# mega-collection. It includes all of the individual "src-*" collections. -src-all - -## Projects -# -# This collection retrieves the projects tree of the FreeBSD -# repository -projects-all - -## CVSROOT control files -# -# This is to get the control files that cvs(1) needs and the commit logs. -cvsroot-all diff --git a/share/examples/cvsup/stable-supfile b/share/examples/cvsup/stable-supfile deleted file mode 100644 index b520f8d4194..00000000000 --- a/share/examples/cvsup/stable-supfile +++ /dev/null @@ -1,74 +0,0 @@ -# $FreeBSD$ -# -# BEWARE, CVS is deprecated and no longer supported by the FreeBSD project. -# -# The primary development work happens in Subversion and is temporarily -# exported to the legacy CVS system with significant time delays. -# -# You should NOT set up a new consumer of FreeBSD source code via CVS. -# Please see: -# http://www.freebsd.org/doc/handbook/svn.html -# http://www.freebsd.org/doc/handbook/svn-mirrors.html -# -# csup (CVS Update Protocol) allows you to download the latest CVS -# tree (or any branch of development therefrom) to your system easily -# and efficiently -# -# To keep your CVS tree up-to-date run: -# -# csup stable-supfile -# -# Note that this only updates the tree contents and does not -# update what is actually installed. -# -# You may wish to change some of the settings in this file to better -# suit your system: -# -# host=CHANGE_THIS.FreeBSD.org -# This specifies the server host which will supply the -# file updates. You must change it to one of the CVSup -# mirror sites listed in the FreeBSD Handbook at -# http://www.freebsd.org/doc/handbook/cvsup.html#CVSUP-MIRRORS. -# You can override this setting on the command line -# with cvsup's "-h host" option. -# -# base=/var/db -# This specifies the root where csup will store information -# about the collections you have transferred to your system. -# A setting of "/var/db" will generate this information in -# /var/db/sup. You can override the "base" setting on the -# command line with cvsup's "-b base" option. This directory -# must exist in order to run CVSup. -# -# prefix=/usr -# This specifies where to place the requested files. A -# setting of "/usr" will place all of the files requested -# in "/usr/src" (e.g., "/usr/src/bin", "/usr/src/lib"). -# The prefix directory must exist in order to run CVSup. -# - -# Defaults that apply to all the collections -# -# IMPORTANT: Change the next line to use one of the CVSup mirror sites -# listed at http://www.freebsd.org/doc/handbook/cvsup.html#CVSUP-MIRRORS. -*default host=CHANGE_THIS.FreeBSD.org -*default base=/var/db -*default prefix=/usr -# The following line is for 9-stable. If you want 8-stable, 7-stable, -# 6-stable, 5-stable, 4-stable, 3-stable, or 2.2-stable, change to "RELENG_8", -# "RELENG_7", "RELENG_6", "RELENG_5", "RELENG_4", "RELENG_3", or -# "RELENG_2_2" respectively. -*default release=cvs tag=RELENG_9 -*default delete use-rel-suffix - -# If you seem to be limited by CPU rather than network or disk bandwidth, try -# commenting out the following line. (Normally, today's CPUs are fast enough -# that you want to run compression.) -*default compress - -## Main Source Tree. -# -# The easiest way to get the main source tree is to use the "src-all" -# mega-collection. It includes all of the individual "src-*" collections. -# Please note: If you want to track -STABLE, leave this uncommented. -src-all diff --git a/share/examples/cvsup/standard-supfile b/share/examples/cvsup/standard-supfile deleted file mode 100644 index 94eec5ee6ca..00000000000 --- a/share/examples/cvsup/standard-supfile +++ /dev/null @@ -1,68 +0,0 @@ -# $FreeBSD$ -# -# BEWARE, CVS is deprecated and no longer supported by the FreeBSD project. -# -# The primary development work happens in Subversion and is temporarily -# exported to the legacy CVS system with significant time delays. -# -# You should NOT set up a new consumer of FreeBSD source code via CVS. -# Please see: -# http://www.freebsd.org/doc/handbook/svn.html -# http://www.freebsd.org/doc/handbook/svn-mirrors.html -# -# csup (CVS Update Protocol) allows you to download the latest CVS -# tree (or any branch of development therefrom) to your system easily -# and efficiently -# -# To keep your CVS tree up-to-date run: -# -# csup standard-supfile -# -# Note that this only updates the tree contents and does not -# update what is actually installed. -# -# You may wish to change some of the settings in this file to better -# suit your system: -# -# host=CHANGE_THIS.FreeBSD.org -# This specifies the server host which will supply the -# file updates. You must change it to one of the CVSup -# mirror sites listed in the FreeBSD Handbook at -# http://www.freebsd.org/doc/handbook/cvsup.html#CVSUP-MIRRORS. -# You can override this setting on the command line -# with cvsup's "-h host" option. -# -# base=/var/db -# This specifies the root where csup will store information -# about the collections you have transferred to your system. -# A setting of "/var/db" will generate this information in -# /var/db/sup. You can override the "base" setting on the -# command line with cvsup's "-b base" option. This directory -# must exist in order to run CVSup. -# -# prefix=/usr -# This specifies where to place the requested files. A -# setting of "/usr" will place all of the files requested -# in "/usr/src" (e.g., "/usr/src/bin", "/usr/src/lib"). -# The prefix directory must exist in order to run CVSup. - -# Defaults that apply to all the collections -# -# IMPORTANT: Change the next line to use one of the CVSup mirror sites -# listed at http://www.freebsd.org/doc/handbook/cvsup.html#CVSUP-MIRRORS. -*default host=CHANGE_THIS.FreeBSD.org -*default base=/var/db -*default prefix=/usr -*default release=cvs tag=. -*default delete use-rel-suffix - -# If you seem to be limited by CPU rather than network or disk bandwidth, try -# commenting out the following line. (Normally, today's CPUs are fast enough -# that you want to run compression.) -*default compress - -## Main Source Tree. -# -# The easiest way to get the main source tree is to use the "src-all" -# mega-collection. It includes all of the individual "src-*" collections. -src-all diff --git a/share/examples/etc/make.conf b/share/examples/etc/make.conf index 5a529331976..ca0ea36a77a 100644 --- a/share/examples/etc/make.conf +++ b/share/examples/etc/make.conf @@ -40,7 +40,6 @@ # (VIA CPUs) c7, c3-2, c3 # AMD64 architecture: amdfam10, opteron-sse3, athlon64-sse3, k8-sse3, # opteron, athlon64, k8, core2, nocona -# Intel ia64 architecture: itanium2, itanium # SPARC-V9 architecture: v9 (generic 64-bit V9), ultrasparc (default # if omitted), ultrasparc3 # Additionally the following CPU types are recognized by clang: @@ -185,18 +184,6 @@ #ENABLE_SUID_K5SU= # # -# CVSup update flags. Edit SUPFILE settings to reflect whichever distribution -# file(s) you use on your site (see /usr/share/examples/cvsup/README for more -# information on CVSup and these files). To use, do "make update" in /usr/src. -# -#SUP_UPDATE= -# -#SUP= /usr/bin/csup -#SUPFLAGS= -L 2 -#SUPHOST= cvsup.uk.FreeBSD.org -#SUPFILE= /usr/share/examples/cvsup/standard-supfile -#PORTSSUPFILE= /usr/share/examples/cvsup/ports-supfile -# # top(1) uses a hash table for the user names. The size of this hash # can be tuned to match the number of local users. The table size should # be a prime number approximately twice as large as the number of lines in diff --git a/share/examples/mdoc/example.1 b/share/examples/mdoc/example.1 index a578502fafb..dde029ec4a9 100644 --- a/share/examples/mdoc/example.1 +++ b/share/examples/mdoc/example.1 @@ -150,6 +150,6 @@ manual page example first appeared in .Sh AUTHORS This manual page was written by -.An Mike Pritchard Aq mpp@FreeBSD.org . +.An Mike Pritchard Aq Mt mpp@FreeBSD.org . .Sh BUGS The actual code for this command is vaporware. diff --git a/share/examples/mdoc/example.3 b/share/examples/mdoc/example.3 index bbdd068e8ea..fc3b0fd2ba6 100644 --- a/share/examples/mdoc/example.3 +++ b/share/examples/mdoc/example.3 @@ -330,6 +330,6 @@ manual page example first appeared in .Sh AUTHORS This manual page was written by -.An Mike Pritchard Aq mpp@FreeBSD.org . +.An Mike Pritchard Aq Mt mpp@FreeBSD.org . .Sh BUGS The actual code for this function is vaporware. diff --git a/share/examples/mdoc/example.4 b/share/examples/mdoc/example.4 index c39e4865a9a..e5c8a1fe035 100644 --- a/share/examples/mdoc/example.4 +++ b/share/examples/mdoc/example.4 @@ -120,6 +120,6 @@ manual page example first appeared in .At v6 . .Sh AUTHORS This manual page was written by -.An Mike Pritchard Aq mpp@FreeBSD.org . +.An Mike Pritchard Aq Mt mpp@FreeBSD.org . .Sh BUGS The actual code for this device driver is vaporware. diff --git a/share/examples/mdoc/example.9 b/share/examples/mdoc/example.9 index 0fb5a1006f7..97b57ffbc18 100644 --- a/share/examples/mdoc/example.9 +++ b/share/examples/mdoc/example.9 @@ -338,6 +338,6 @@ manual page example first appeared in .Sh AUTHORS This manual page was written by -.An Giorgos Keramidas Aq keramida@FreeBSD.org . +.An Giorgos Keramidas Aq Mt keramida@FreeBSD.org . .Sh BUGS The actual code for this function is vaporware. diff --git a/share/examples/scsi_target/scsi_target.8 b/share/examples/scsi_target/scsi_target.8 index 677e2b4ae6f..4cb6442ee52 100644 --- a/share/examples/scsi_target/scsi_target.8 +++ b/share/examples/scsi_target/scsi_target.8 @@ -155,4 +155,4 @@ and was written by It was rewritten for .Fx 5.0 by -.An Nate Lawson Aq nate@root.org . +.An Nate Lawson Aq Mt nate@root.org . diff --git a/share/i18n/csmapper/BIG5/Makefile.depend b/share/i18n/csmapper/BIG5/Makefile.depend index e914153843a..ceb19005d2d 100644 --- a/share/i18n/csmapper/BIG5/Makefile.depend +++ b/share/i18n/csmapper/BIG5/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ usr.bin/mkcsmapper_static.host \ diff --git a/share/i18n/csmapper/CNS/Makefile.depend b/share/i18n/csmapper/CNS/Makefile.depend index e914153843a..ceb19005d2d 100644 --- a/share/i18n/csmapper/CNS/Makefile.depend +++ b/share/i18n/csmapper/CNS/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ usr.bin/mkcsmapper_static.host \ diff --git a/share/i18n/csmapper/CP/Makefile.depend b/share/i18n/csmapper/CP/Makefile.depend index e914153843a..ceb19005d2d 100644 --- a/share/i18n/csmapper/CP/Makefile.depend +++ b/share/i18n/csmapper/CP/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ usr.bin/mkcsmapper_static.host \ diff --git a/share/i18n/csmapper/GB/Makefile.depend b/share/i18n/csmapper/GB/Makefile.depend index e914153843a..ceb19005d2d 100644 --- a/share/i18n/csmapper/GB/Makefile.depend +++ b/share/i18n/csmapper/GB/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ usr.bin/mkcsmapper_static.host \ diff --git a/share/i18n/csmapper/JIS/Makefile.depend b/share/i18n/csmapper/JIS/Makefile.depend index e914153843a..ceb19005d2d 100644 --- a/share/i18n/csmapper/JIS/Makefile.depend +++ b/share/i18n/csmapper/JIS/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ usr.bin/mkcsmapper_static.host \ diff --git a/share/i18n/csmapper/KAZAKH/Makefile.depend b/share/i18n/csmapper/KAZAKH/Makefile.depend index e914153843a..ceb19005d2d 100644 --- a/share/i18n/csmapper/KAZAKH/Makefile.depend +++ b/share/i18n/csmapper/KAZAKH/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ usr.bin/mkcsmapper_static.host \ diff --git a/share/i18n/csmapper/KOI/Makefile.depend b/share/i18n/csmapper/KOI/Makefile.depend index e914153843a..ceb19005d2d 100644 --- a/share/i18n/csmapper/KOI/Makefile.depend +++ b/share/i18n/csmapper/KOI/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ usr.bin/mkcsmapper_static.host \ diff --git a/share/i18n/csmapper/KS/Makefile.depend b/share/i18n/csmapper/KS/Makefile.depend index e914153843a..ceb19005d2d 100644 --- a/share/i18n/csmapper/KS/Makefile.depend +++ b/share/i18n/csmapper/KS/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ usr.bin/mkcsmapper_static.host \ diff --git a/share/i18n/csmapper/MISC/Makefile.depend b/share/i18n/csmapper/MISC/Makefile.depend index e914153843a..ceb19005d2d 100644 --- a/share/i18n/csmapper/MISC/Makefile.depend +++ b/share/i18n/csmapper/MISC/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ usr.bin/mkcsmapper_static.host \ diff --git a/share/i18n/csmapper/Makefile.depend b/share/i18n/csmapper/Makefile.depend index 4a9b0208178..29100ce9257 100644 --- a/share/i18n/csmapper/Makefile.depend +++ b/share/i18n/csmapper/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ share/i18n/csmapper/APPLE \ share/i18n/csmapper/AST \ share/i18n/csmapper/BIG5 \ diff --git a/share/i18n/csmapper/TCVN/Makefile.depend b/share/i18n/csmapper/TCVN/Makefile.depend index e914153843a..ceb19005d2d 100644 --- a/share/i18n/csmapper/TCVN/Makefile.depend +++ b/share/i18n/csmapper/TCVN/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ usr.bin/mkcsmapper_static.host \ diff --git a/share/i18n/esdb/Makefile.depend b/share/i18n/esdb/Makefile.depend index c9404d610d7..82d12ce9488 100644 --- a/share/i18n/esdb/Makefile.depend +++ b/share/i18n/esdb/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ share/i18n/esdb/APPLE \ share/i18n/esdb/AST \ share/i18n/esdb/BIG5 \ diff --git a/share/man/man1/builtin.1 b/share/man/man1/builtin.1 index 72b016bcd20..1eda275ae2a 100644 --- a/share/man/man1/builtin.1 +++ b/share/man/man1/builtin.1 @@ -329,4 +329,4 @@ manual page first appeared in .Fx 3.4 . .Sh AUTHORS This manual page was written by -.An Sheldon Hearn Aq sheldonh@FreeBSD.org . +.An Sheldon Hearn Aq Mt sheldonh@FreeBSD.org . diff --git a/share/man/man3/ATOMIC_VAR_INIT.3 b/share/man/man3/ATOMIC_VAR_INIT.3 index e2fc5c0e7cc..f6c0a5da21a 100644 --- a/share/man/man3/ATOMIC_VAR_INIT.3 +++ b/share/man/man3/ATOMIC_VAR_INIT.3 @@ -297,5 +297,5 @@ These macros attempt to conform to These macros appeared in .Fx 10.0 . .Sh AUTHORS -.An Ed Schouten Aq ed@FreeBSD.org , -.An David Chisnall Aq theraven@FreeBSD.org +.An Ed Schouten Aq Mt ed@FreeBSD.org +.An David Chisnall Aq Mt theraven@FreeBSD.org diff --git a/share/man/man3/Makefile b/share/man/man3/Makefile index f0cbf0ecd9f..1213a7a56e4 100644 --- a/share/man/man3/Makefile +++ b/share/man/man3/Makefile @@ -68,7 +68,9 @@ MLINKS+= queue.3 LIST_EMPTY.3 \ queue.3 LIST_ENTRY.3 \ queue.3 LIST_FIRST.3 \ queue.3 LIST_FOREACH.3 \ + queue.3 LIST_FOREACH_FROM.3 \ queue.3 LIST_FOREACH_SAFE.3 \ + queue.3 LIST_FOREACH_FROM_SAFE.3 \ queue.3 LIST_HEAD.3 \ queue.3 LIST_HEAD_INITIALIZER.3 \ queue.3 LIST_INIT.3 \ @@ -83,7 +85,9 @@ MLINKS+= queue.3 LIST_EMPTY.3 \ queue.3 SLIST_ENTRY.3 \ queue.3 SLIST_FIRST.3 \ queue.3 SLIST_FOREACH.3 \ + queue.3 SLIST_FOREACH_FROM.3 \ queue.3 SLIST_FOREACH_SAFE.3 \ + queue.3 SLIST_FOREACH_FROM_SAFE.3 \ queue.3 SLIST_HEAD.3 \ queue.3 SLIST_HEAD_INITIALIZER.3 \ queue.3 SLIST_INIT.3 \ @@ -99,7 +103,9 @@ MLINKS+= queue.3 LIST_EMPTY.3 \ queue.3 STAILQ_ENTRY.3 \ queue.3 STAILQ_FIRST.3 \ queue.3 STAILQ_FOREACH.3 \ + queue.3 STAILQ_FOREACH_FROM.3 \ queue.3 STAILQ_FOREACH_SAFE.3 \ + queue.3 STAILQ_FOREACH_FROM_SAFE.3 \ queue.3 STAILQ_HEAD.3 \ queue.3 STAILQ_HEAD_INITIALIZER.3 \ queue.3 STAILQ_INIT.3 \ @@ -117,9 +123,13 @@ MLINKS+= queue.3 LIST_EMPTY.3 \ queue.3 TAILQ_ENTRY.3 \ queue.3 TAILQ_FIRST.3 \ queue.3 TAILQ_FOREACH.3 \ + queue.3 TAILQ_FOREACH_FROM.3 \ queue.3 TAILQ_FOREACH_REVERSE.3 \ + queue.3 TAILQ_FOREACH_REVERSE_FROM.3 \ queue.3 TAILQ_FOREACH_REVERSE_SAFE.3 \ + queue.3 TAILQ_FOREACH_REVERSE_FROM_SAFE.3 \ queue.3 TAILQ_FOREACH_SAFE.3 \ + queue.3 TAILQ_FOREACH_FROM_SAFE.3 \ queue.3 TAILQ_HEAD.3 \ queue.3 TAILQ_HEAD_INITIALIZER.3 \ queue.3 TAILQ_INIT.3 \ diff --git a/share/man/man3/pthread_affinity_np.3 b/share/man/man3/pthread_affinity_np.3 index 359ce9543ca..5f867f99612 100644 --- a/share/man/man3/pthread_affinity_np.3 +++ b/share/man/man3/pthread_affinity_np.3 @@ -148,8 +148,6 @@ The and .Nm pthread_setaffinity_np functions were written by -.An David Xu -.Aq davidxu@FreeBSD.org , +.An David Xu Aq Mt davidxu@FreeBSD.org , and this manpage was written by -.An Xin LI -.Aq delphij@FreeBSD.org . +.An Xin LI Aq Mt delphij@FreeBSD.org . diff --git a/share/man/man3/pthread_atfork.3 b/share/man/man3/pthread_atfork.3 index 125bb430316..2e783caccd5 100644 --- a/share/man/man3/pthread_atfork.3 +++ b/share/man/man3/pthread_atfork.3 @@ -113,5 +113,4 @@ function is expected to conform to .St -p1003.1 . .Sh AUTHORS This manpage was written by -.An Alex Vasylenko -.Aq lxv@omut.org . +.An Alex Vasylenko Aq Mt lxv@omut.org . diff --git a/share/man/man3/pthread_attr_affinity_np.3 b/share/man/man3/pthread_attr_affinity_np.3 index fa1e6bb1b94..ee63e7d71e1 100644 --- a/share/man/man3/pthread_attr_affinity_np.3 +++ b/share/man/man3/pthread_attr_affinity_np.3 @@ -156,6 +156,6 @@ The and .Nm pthread_attr_setaffinity_np functions were written by -.An David Xu Aq davidxu@FreeBSD.org , +.An David Xu Aq Mt davidxu@FreeBSD.org , and this manpage was written by -.An Xin LI Aq delphij@FreeBSD.org . +.An Xin LI Aq Mt delphij@FreeBSD.org . diff --git a/share/man/man3/pthread_attr_get_np.3 b/share/man/man3/pthread_attr_get_np.3 index 774be8f0287..e43bcf30e41 100644 --- a/share/man/man3/pthread_attr_get_np.3 +++ b/share/man/man3/pthread_attr_get_np.3 @@ -112,5 +112,4 @@ thread ID. The .Fn pthread_attr_get_np function and this manual page were written by -.An Alexey Zelkin -.Aq phantom@FreeBSD.org . +.An Alexey Zelkin Aq Mt phantom@FreeBSD.org . diff --git a/share/man/man3/pthread_attr_setcreatesuspend_np.3 b/share/man/man3/pthread_attr_setcreatesuspend_np.3 index 92c2fe0a705..75408ccefc6 100644 --- a/share/man/man3/pthread_attr_setcreatesuspend_np.3 +++ b/share/man/man3/pthread_attr_setcreatesuspend_np.3 @@ -69,4 +69,4 @@ is invalid. .Xr pthread_resume_np 3 .Sh AUTHORS This manual page was written by -.An Alexey Zelkin Aq phantom@FreeBSD.org . +.An Alexey Zelkin Aq Mt phantom@FreeBSD.org . diff --git a/share/man/man3/pthread_cancel.3 b/share/man/man3/pthread_cancel.3 index 7ac5f9de2b0..e737f5e3642 100644 --- a/share/man/man3/pthread_cancel.3 +++ b/share/man/man3/pthread_cancel.3 @@ -74,7 +74,7 @@ function conforms to .St -p1003.1-96 . .Sh AUTHORS This manual page was written by -.An David Leonard Aq d@openbsd.org +.An David Leonard Aq Mt d@openbsd.org for the .Ox implementation of diff --git a/share/man/man3/pthread_getcpuclockid.3 b/share/man/man3/pthread_getcpuclockid.3 index 94a99ffbe32..de0e6bcfd5e 100644 --- a/share/man/man3/pthread_getcpuclockid.3 +++ b/share/man/man3/pthread_getcpuclockid.3 @@ -81,4 +81,4 @@ The function first appeared in .Fx 10.0 . .Sh AUTHORS -.An David Xu Aq davidxu@FreeBSD.org +.An David Xu Aq Mt davidxu@FreeBSD.org diff --git a/share/man/man3/pthread_getthreadid_np.3 b/share/man/man3/pthread_getthreadid_np.3 index bd28c6b5bf2..a912e7d42ef 100644 --- a/share/man/man3/pthread_getthreadid_np.3 +++ b/share/man/man3/pthread_getthreadid_np.3 @@ -53,4 +53,4 @@ None. .Xr pthread_self 3 .Sh AUTHORS This manual page was written by -.An Jung-uk Kim Aq jkim@FreeBSD.org . +.An Jung-uk Kim Aq Mt jkim@FreeBSD.org . diff --git a/share/man/man3/pthread_main_np.3 b/share/man/man3/pthread_main_np.3 index 43d72920140..81669b78609 100644 --- a/share/man/man3/pthread_main_np.3 +++ b/share/man/man3/pthread_main_np.3 @@ -57,4 +57,4 @@ and \-1 if the thread's initialization has not yet completed. .Xr pthread_self 3 .Sh AUTHORS This manual page was written by -.An Alexey Zelkin Aq phantom@FreeBSD.org . +.An Alexey Zelkin Aq Mt phantom@FreeBSD.org . diff --git a/share/man/man3/pthread_multi_np.3 b/share/man/man3/pthread_multi_np.3 index 9a42a99585b..c790d358ca3 100644 --- a/share/man/man3/pthread_multi_np.3 +++ b/share/man/man3/pthread_multi_np.3 @@ -63,4 +63,4 @@ functions always return 0. .Xr pthread_suspend_all_np 3 .Sh AUTHORS This manual page was written by -.An Alexey Zelkin Aq phantom@FreeBSD.org . +.An Alexey Zelkin Aq Mt phantom@FreeBSD.org . diff --git a/share/man/man3/pthread_resume_all_np.3 b/share/man/man3/pthread_resume_all_np.3 index 4c63c3bf4c3..0ac6736a9b7 100644 --- a/share/man/man3/pthread_resume_all_np.3 +++ b/share/man/man3/pthread_resume_all_np.3 @@ -48,4 +48,4 @@ and resumes those which were previously suspended. .Xr pthread_suspend_np 3 .Sh AUTHORS This manual page was written by -.An Alexey Zelkin Aq phantom@FreeBSD.org . +.An Alexey Zelkin Aq Mt phantom@FreeBSD.org . diff --git a/share/man/man3/pthread_resume_np.3 b/share/man/man3/pthread_resume_np.3 index 08f7cb96f10..c8444d2dabc 100644 --- a/share/man/man3/pthread_resume_np.3 +++ b/share/man/man3/pthread_resume_np.3 @@ -69,4 +69,4 @@ argument. .Xr pthread_suspend_np 3 .Sh AUTHORS This manual page was written by -.An Alexey Zelkin Aq phantom@FreeBSD.org . +.An Alexey Zelkin Aq Mt phantom@FreeBSD.org . diff --git a/share/man/man3/pthread_set_name_np.3 b/share/man/man3/pthread_set_name_np.3 index aad2fd6c63a..e3029398bb0 100644 --- a/share/man/man3/pthread_set_name_np.3 +++ b/share/man/man3/pthread_set_name_np.3 @@ -49,4 +49,4 @@ Because of the debugging nature of this function, all errors that may appear inside are silently ignored. .Sh AUTHORS This manual page was written by -.An Alexey Zelkin Aq phantom@FreeBSD.org . +.An Alexey Zelkin Aq Mt phantom@FreeBSD.org . diff --git a/share/man/man3/pthread_suspend_all_np.3 b/share/man/man3/pthread_suspend_all_np.3 index fdeab1970fc..9daedbf7b06 100644 --- a/share/man/man3/pthread_suspend_all_np.3 +++ b/share/man/man3/pthread_suspend_all_np.3 @@ -50,4 +50,4 @@ function. .Xr pthread_suspend_np 3 .Sh AUTHORS This manual page was written by -.An Alexey Zelkin Aq phantom@FreeBSD.org . +.An Alexey Zelkin Aq Mt phantom@FreeBSD.org . diff --git a/share/man/man3/pthread_suspend_np.3 b/share/man/man3/pthread_suspend_np.3 index 43d2b7ddea9..32138a15a10 100644 --- a/share/man/man3/pthread_suspend_np.3 +++ b/share/man/man3/pthread_suspend_np.3 @@ -67,4 +67,4 @@ argument. .Xr pthread_suspend_all_np 3 .Sh AUTHORS This manual page was written by -.An Alexey Zelkin Aq phantom@FreeBSD.org . +.An Alexey Zelkin Aq Mt phantom@FreeBSD.org . diff --git a/share/man/man3/pthread_switch_add_np.3 b/share/man/man3/pthread_switch_add_np.3 index 0c420727184..e3400e79033 100644 --- a/share/man/man3/pthread_switch_add_np.3 +++ b/share/man/man3/pthread_switch_add_np.3 @@ -84,4 +84,4 @@ function. .Xr pthread_create 3 .Sh AUTHORS This manual page was written by -.An Alexey Zelkin Aq phantom@FreeBSD.org . +.An Alexey Zelkin Aq Mt phantom@FreeBSD.org . diff --git a/share/man/man3/pthread_testcancel.3 b/share/man/man3/pthread_testcancel.3 index 007c768a94b..ef6a1c11bd9 100644 --- a/share/man/man3/pthread_testcancel.3 +++ b/share/man/man3/pthread_testcancel.3 @@ -236,7 +236,7 @@ The standard allows implementations to make many more functions cancellation points. .Sh AUTHORS This manual page was written by -.An David Leonard Aq d@openbsd.org +.An David Leonard Aq Mt d@openbsd.org for the .Ox implementation of diff --git a/share/man/man3/siginfo.3 b/share/man/man3/siginfo.3 index 225576627b4..0d4e59480ad 100644 --- a/share/man/man3/siginfo.3 +++ b/share/man/man3/siginfo.3 @@ -337,4 +337,4 @@ can be generated as of .Fx 9.0 . .Sh AUTHORS This manual page was written by -.An "David Xu" Aq davidxu@FreeBSD.org . +.An David Xu Aq Mt davidxu@FreeBSD.org . diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index b0f8e572ca2..ac2cabbdf4e 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -207,6 +207,7 @@ MAN= aac.4 \ ipwfw.4 \ isci.4 \ iscsi_initiator.4 \ + ismt.4 \ isp.4 \ ispfw.4 \ iwi.4 \ @@ -228,6 +229,7 @@ MAN= aac.4 \ led.4 \ lge.4 \ ${_linux.4} \ + lm75.4 \ lmc.4 \ lo.4 \ lp.4 \ @@ -564,6 +566,7 @@ MAN= aac.4 \ ${_vmx.4} \ vpo.4 \ vr.4 \ + vt.4 \ vte.4 \ ${_vtnet.4} \ ${_vxge.4} \ diff --git a/share/man/man4/aac.4 b/share/man/man4/aac.4 index d0f370163b8..e0ffcaa5407 100644 --- a/share/man/man4/aac.4 +++ b/share/man/man4/aac.4 @@ -289,10 +289,8 @@ The driver first appeared in .Fx 4.3 . .Sh AUTHORS -.An Mike Smith -.Aq msmith@FreeBSD.org -.An Scott Long -.Aq scottl@FreeBSD.org +.An Mike Smith Aq Mt msmith@FreeBSD.org +.An Scott Long Aq Mt scottl@FreeBSD.org .Sh BUGS This driver is not compatible with Dell controllers that have version 1.x firmware. diff --git a/share/man/man4/aacraid.4 b/share/man/man4/aacraid.4 index 5d22ac27131..2ca830dd24e 100644 --- a/share/man/man4/aacraid.4 +++ b/share/man/man4/aacraid.4 @@ -128,11 +128,8 @@ and are also queued for retrieval by a management application. .Xr scsi 4 , .Xr kldload 8 .Sh AUTHORS -.An Achim Leubner -.Aq achim@FreeBSD.org -.An Ed Maste -.Aq emaste@FreeBSD.org -.An Scott Long -.Aq scottl@FreeBSD.org +.An Achim Leubner Aq Mt achim@FreeBSD.org +.An Ed Maste Aq Mt emaste@FreeBSD.org +.An Scott Long Aq Mt scottl@FreeBSD.org .Sh BUGS The controller is not actually paused on suspend/resume. diff --git a/share/man/man4/acpi.4 b/share/man/man4/acpi.4 index 1e06d685446..8196c43b584 100644 --- a/share/man/man4/acpi.4 +++ b/share/man/man4/acpi.4 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 16, 2012 +.Dd June 23, 2014 .Dt ACPI 4 .Os .Sh NAME @@ -61,6 +61,9 @@ If the default settings are not optimal, the following sysctls can be used to modify or monitor .Nm behavior. +Note that some variables will be available only if the given hardware supports +them (such as +.Va hw.acpi.acline ) . .Bl -tag -width indent .It Va debug.acpi.enable_debug_objects Enable dumping Debug objects without @@ -84,8 +87,7 @@ To enable ACPI CPU idling control, should be set to .Li acpi if it is listed in -.Va machdep.idle_available -. +.Va machdep.idle_available . .It Va hw.acpi.cpu.cx_supported List of supported CPU idle states and their transition latency in microseconds. @@ -578,7 +580,7 @@ and .Xr iasl 8 utilities and some ACPI knowledge. .Sh COMPATIBILITY -ACPI is only found and supported on i386/ia32, ia64, and amd64. +ACPI is only found and supported on i386/ia32 and amd64. .Sh SEE ALSO .Xr kenv 1 , .Xr acpi_thermal 4 , @@ -607,16 +609,16 @@ The following people made notable contributions to the ACPI subsystem in .Fx : .An Michael Smith , -.An Takanori Watanabe Aq takawata@jp.FreeBSD.org , -.An Mitsuru IWASAKI Aq iwasaki@jp.FreeBSD.org , +.An Takanori Watanabe Aq Mt takawata@jp.FreeBSD.org , +.An Mitsuru IWASAKI Aq Mt iwasaki@jp.FreeBSD.org , .An Munehiro Matsuda , .An Nate Lawson , the ACPI-jp mailing list at -.Aq acpi-jp@jp.FreeBSD.org , +.Aq Mt acpi-jp@jp.FreeBSD.org , and many other contributors. .Pp This manual page was written by -.An Michael Smith Aq msmith@FreeBSD.org . +.An Michael Smith Aq Mt msmith@FreeBSD.org . .Sh BUGS Many BIOS versions have serious bugs that may cause system instability, break suspend/resume, or prevent devices from operating properly due to diff --git a/share/man/man4/acpi_asus.4 b/share/man/man4/acpi_asus.4 index 1921adc771a..124999a72cc 100644 --- a/share/man/man4/acpi_asus.4 +++ b/share/man/man4/acpi_asus.4 @@ -175,7 +175,7 @@ driver first appeared in The .Nm driver and this manual page were written by -.An Philip Paeps Aq philip@FreeBSD.org . +.An Philip Paeps Aq Mt philip@FreeBSD.org . .Pp Inspiration came from the .Em acpi4asus project diff --git a/share/man/man4/acpi_asus_wmi.4 b/share/man/man4/acpi_asus_wmi.4 index 129894be128..9949b3b63bc 100644 --- a/share/man/man4/acpi_asus_wmi.4 +++ b/share/man/man4/acpi_asus_wmi.4 @@ -87,4 +87,4 @@ The driver first appeared in .Fx 10.0 . .Sh AUTHORS -.An Alexander Motin Aq mav@FreeBSD.org . +.An Alexander Motin Aq Mt mav@FreeBSD.org diff --git a/share/man/man4/acpi_dock.4 b/share/man/man4/acpi_dock.4 index 1fda11d3c09..db23b3b7f21 100644 --- a/share/man/man4/acpi_dock.4 +++ b/share/man/man4/acpi_dock.4 @@ -59,4 +59,4 @@ device driver first appeared in The .Nm device driver was written by -.An Mitsuru IWASAKI Aq iwasaki@FreeBSD.org . +.An Mitsuru IWASAKI Aq Mt iwasaki@FreeBSD.org . diff --git a/share/man/man4/acpi_fujitsu.4 b/share/man/man4/acpi_fujitsu.4 index ef72fee4ba0..5a827182361 100644 --- a/share/man/man4/acpi_fujitsu.4 +++ b/share/man/man4/acpi_fujitsu.4 @@ -166,10 +166,10 @@ driver first appeared in The .Nm driver was written by -.An Sean Bullington Aq shegget@gmail.com , -.An Anish Mistry Aq mistry.7@osu.edu , +.An Sean Bullington Aq Mt shegget@gmail.com , +.An Anish Mistry Aq Mt mistry.7@osu.edu , and -.An Marc Santcroos Aq marks@ripe.net . +.An Marc Santcroos Aq Mt marks@ripe.net . .Pp This manual page was written by -.An Philip Paeps Aq philip@FreeBSD.org . +.An Philip Paeps Aq Mt philip@FreeBSD.org . diff --git a/share/man/man4/acpi_hp.4 b/share/man/man4/acpi_hp.4 index 028d19a491c..2ea74cf0204 100644 --- a/share/man/man4/acpi_hp.4 +++ b/share/man/man4/acpi_hp.4 @@ -261,7 +261,7 @@ device driver first appeared in The .Nm driver was written by -.An Michael Gmelin Aq freebsd@grem.de . +.An Michael Gmelin Aq Mt freebsd@grem.de . .Pp It has been inspired by hp-wmi driver, which implements a subset of these features (hotkeys) on Linux. @@ -275,7 +275,7 @@ http://www.microsoft.com/whdc/system/pnppwr/wmi/wmi-acpi.mspx .El .Pp This manual page was written by -.An Michael Gmelin Aq freebsd@grem.de . +.An Michael Gmelin Aq Mt freebsd@grem.de . .Sh BUGS This driver is experimental and has only been tested on i386 on an HP Compaq 8510p which featured all supported wireless devices (WWAN/BT/WLAN). diff --git a/share/man/man4/acpi_ibm.4 b/share/man/man4/acpi_ibm.4 index 4aa6d9fa5c0..d5662073e42 100644 --- a/share/man/man4/acpi_ibm.4 +++ b/share/man/man4/acpi_ibm.4 @@ -476,10 +476,10 @@ device driver first appeared in The .Nm driver was written by -.An Takanori Watanabe Aq takawata@FreeBSD.org +.An Takanori Watanabe Aq Mt takawata@FreeBSD.org and later mostly rewritten by -.An Markus Brueffer Aq markus@FreeBSD.org . +.An Markus Brueffer Aq Mt markus@FreeBSD.org . This manual page was written by -.An Christian Brueffer Aq brueffer@FreeBSD.org +.An Christian Brueffer Aq Mt brueffer@FreeBSD.org and -.An Markus Brueffer Aq markus@FreeBSD.org . +.An Markus Brueffer Aq Mt markus@FreeBSD.org . diff --git a/share/man/man4/acpi_panasonic.4 b/share/man/man4/acpi_panasonic.4 index 5458a3162ea..9ea36e45fed 100644 --- a/share/man/man4/acpi_panasonic.4 +++ b/share/man/man4/acpi_panasonic.4 @@ -173,6 +173,6 @@ driver first appeared in The .Nm driver and this manual page were written by -.An OGAWA Takaya Aq t\-ogawa@triaez.kaisei.org +.An OGAWA Takaya Aq Mt t-ogawa@triaez.kaisei.org and -.An TAKAHASHI Yoshihiro Aq nyan@FreeBSD.org . +.An TAKAHASHI Yoshihiro Aq Mt nyan@FreeBSD.org . diff --git a/share/man/man4/acpi_rapidstart.4 b/share/man/man4/acpi_rapidstart.4 index fa246f6c771..0bfa1bd12ca 100644 --- a/share/man/man4/acpi_rapidstart.4 +++ b/share/man/man4/acpi_rapidstart.4 @@ -81,4 +81,4 @@ driver first appeared in The .Nm driver was written by -.An Takanori Watanabe Aq takawata@FreeBSD.org . +.An Takanori Watanabe Aq Mt takawata@FreeBSD.org . diff --git a/share/man/man4/acpi_sony.4 b/share/man/man4/acpi_sony.4 index f0fb0e0835f..c40ffcf1173 100644 --- a/share/man/man4/acpi_sony.4 +++ b/share/man/man4/acpi_sony.4 @@ -79,4 +79,4 @@ driver first appeared in The .Nm driver was written by -.An Takanori Watanabe Aq takawata@FreeBSD.org . +.An Takanori Watanabe Aq Mt takawata@FreeBSD.org . diff --git a/share/man/man4/acpi_toshiba.4 b/share/man/man4/acpi_toshiba.4 index 134ecc8d302..3bf19d41bdb 100644 --- a/share/man/man4/acpi_toshiba.4 +++ b/share/man/man4/acpi_toshiba.4 @@ -123,6 +123,6 @@ driver first appeared in The .Nm driver was written by -.An Hiroyuki Aizu Aq aizu@navi.org . +.An Hiroyuki Aizu Aq Mt aizu@navi.org . This manual page was written by -.An Philip Paeps Aq philip@FreeBSD.org . +.An Philip Paeps Aq Mt philip@FreeBSD.org . diff --git a/share/man/man4/acpi_video.4 b/share/man/man4/acpi_video.4 index c28678479e7..2bdd3fb2d18 100644 --- a/share/man/man4/acpi_video.4 +++ b/share/man/man4/acpi_video.4 @@ -78,9 +78,9 @@ driver first appeared in The .Nm driver was written by -.An Taku YAMAMOTO Aq taku@cent.saitama-u.ac.jp . +.An Taku YAMAMOTO Aq Mt taku@cent.saitama-u.ac.jp . This manual page was written by -.An Mark Santcroos Aq marks@ripe.net . +.An Mark Santcroos Aq Mt marks@ripe.net . .Sh BUGS Some systems only perform output switching via SMM even though they export the proper information via ACPI. diff --git a/share/man/man4/acpi_wmi.4 b/share/man/man4/acpi_wmi.4 index 28bd0da2ec8..fffb680e1ff 100644 --- a/share/man/man4/acpi_wmi.4 +++ b/share/man/man4/acpi_wmi.4 @@ -85,7 +85,7 @@ device driver first appeared in The .Nm driver was written by -.An Michael Gmelin Aq freebsd@grem.de . +.An Michael Gmelin Aq Mt freebsd@grem.de . .Pp Work has been inspired by the Linux acpi-wmi driver written by Carlos Corbacho. .Pp @@ -93,4 +93,4 @@ See http://www.microsoft.com/whdc/system/pnppwr/wmi/wmi-acpi.mspx for the specification of ACPI-WMI. .Pp This manual page was written by -.An Michael Gmelin Aq freebsd@grem.de . +.An Michael Gmelin Aq Mt freebsd@grem.de . diff --git a/share/man/man4/ada.4 b/share/man/man4/ada.4 index 760fa6649ae..433a5476244 100644 --- a/share/man/man4/ada.4 +++ b/share/man/man4/ada.4 @@ -154,4 +154,4 @@ The driver first appeared in .Fx 8.0 . .Sh AUTHORS -.An Alexander Motin Aq mav@FreeBSD.org +.An Alexander Motin Aq Mt mav@FreeBSD.org diff --git a/share/man/man4/ae.4 b/share/man/man4/ae.4 index 6bfe9d66bdf..c7cf25eec59 100644 --- a/share/man/man4/ae.4 +++ b/share/man/man4/ae.4 @@ -137,8 +137,7 @@ instead. The .Nm driver and this manual page was written by -.An Stanislav Sedov -.Aq stas@FreeBSD.org . +.An Stanislav Sedov Aq Mt stas@FreeBSD.org . It first appeared in .Fx 7.1 . .Sh BUGS diff --git a/share/man/man4/aesni.4 b/share/man/man4/aesni.4 index 0001ca274f8..3a8e101ec22 100644 --- a/share/man/man4/aesni.4 +++ b/share/man/man4/aesni.4 @@ -87,7 +87,7 @@ driver first appeared in The .Nm driver was written by -.An Konstantin Belousov Aq kib@FreeBSD.org . +.An Konstantin Belousov Aq Mt kib@FreeBSD.org . The key schedule calculation code was adopted from the sample provided by Intel and used in the analogous .Ox diff --git a/share/man/man4/age.4 b/share/man/man4/age.4 index 28e52c22451..054627fec4e 100644 --- a/share/man/man4/age.4 +++ b/share/man/man4/age.4 @@ -181,7 +181,6 @@ Display lots of useful MAC counters maintained in the driver. The .Nm driver was written by -.An Pyun YongHyeon -.Aq yongari@FreeBSD.org . +.An Pyun YongHyeon Aq Mt yongari@FreeBSD.org . It first appeared in .Fx 7.1 . diff --git a/share/man/man4/ahci.4 b/share/man/man4/ahci.4 index 1019e6dc270..67ead8dcfc3 100644 --- a/share/man/man4/ahci.4 +++ b/share/man/man4/ahci.4 @@ -181,4 +181,4 @@ The driver first appeared in .Fx 8.0 . .Sh AUTHORS -.An Alexander Motin Aq mav@FreeBSD.org . +.An Alexander Motin Aq Mt mav@FreeBSD.org diff --git a/share/man/man4/aibs.4 b/share/man/man4/aibs.4 index b955f0f094d..c760465ae63 100644 --- a/share/man/man4/aibs.4 +++ b/share/man/man4/aibs.4 @@ -194,7 +194,7 @@ driver was written for and .Fx by -.An Constantine A. Murenin Aq cnst@FreeBSD.org , +.An Constantine A. Murenin Aq Mt cnst@FreeBSD.org , Raouf Boutaba Research Group, David R. Cheriton School of Computer Science, University of Waterloo. diff --git a/share/man/man4/alc.4 b/share/man/man4/alc.4 index 9fe3c291e7b..0c6af6aed0b 100644 --- a/share/man/man4/alc.4 +++ b/share/man/man4/alc.4 @@ -162,7 +162,6 @@ a change takes effect. The .Nm driver was written by -.An Pyun YongHyeon -.Aq yongari@FreeBSD.org . +.An Pyun YongHyeon Aq Mt yongari@FreeBSD.org . It first appeared in .Fx 8.0 . diff --git a/share/man/man4/ale.4 b/share/man/man4/ale.4 index d5102a157e8..85fc6e24424 100644 --- a/share/man/man4/ale.4 +++ b/share/man/man4/ale.4 @@ -156,7 +156,6 @@ a change takes effect. The .Nm driver was written by -.An Pyun YongHyeon -.Aq yongari@FreeBSD.org . +.An Pyun YongHyeon Aq Mt yongari@FreeBSD.org . It first appeared in .Fx 7.1 . diff --git a/share/man/man4/alpm.4 b/share/man/man4/alpm.4 index 43ee4596178..5bfa8774a81 100644 --- a/share/man/man4/alpm.4 +++ b/share/man/man4/alpm.4 @@ -57,6 +57,6 @@ manual page first appeared in .Sh AUTHORS This manual page was written by -.An Nicolas Souchu Aq nsouch@FreeBSD.org +.An Nicolas Souchu Aq Mt nsouch@FreeBSD.org . .Sh BUGS Only polling mode is supported. diff --git a/share/man/man4/amdpm.4 b/share/man/man4/amdpm.4 index f791a28ba28..9f6ab7cc233 100644 --- a/share/man/man4/amdpm.4 +++ b/share/man/man4/amdpm.4 @@ -67,6 +67,6 @@ Based heavily on the driver by .An Nicolas Souchu . This manual page was written by -.An Murray Stokely Aq murray@FreeBSD.org . +.An Murray Stokely Aq Mt murray@FreeBSD.org . .Sh BUGS Only polling mode is supported. diff --git a/share/man/man4/amdsbwd.4 b/share/man/man4/amdsbwd.4 index cfb2f79624d..429ca44499b 100644 --- a/share/man/man4/amdsbwd.4 +++ b/share/man/man4/amdsbwd.4 @@ -69,6 +69,6 @@ and The .Nm driver was written by -.An Andriy Gapon Aq avg@FreeBSD.org . +.An Andriy Gapon Aq Mt avg@FreeBSD.org . This manual page was written by -.An Andriy Gapon Aq avg@FreeBSD.org . +.An Andriy Gapon Aq Mt avg@FreeBSD.org . diff --git a/share/man/man4/amdsmb.4 b/share/man/man4/amdsmb.4 index c038584082f..93018d81ee8 100644 --- a/share/man/man4/amdsmb.4 +++ b/share/man/man4/amdsmb.4 @@ -51,4 +51,4 @@ driver first appeared in The .Nm driver was written by -.An Ruslan Ermilov Aq ru@FreeBSD.org . +.An Ruslan Ermilov Aq Mt ru@FreeBSD.org . diff --git a/share/man/man4/amdtemp.4 b/share/man/man4/amdtemp.4 index 52444f539a9..86b7a4069bf 100644 --- a/share/man/man4/amdtemp.4 +++ b/share/man/man4/amdtemp.4 @@ -91,9 +91,9 @@ The driver first appeared in .Fx 7.1 . .Sh AUTHORS -.An Rui Paulo Aq rpaulo@FreeBSD.org -.An Norikatsu Shigemura Aq nork@FreeBSD.org -.An Jung-uk Kim Aq jkim@FreeBSD.org +.An Rui Paulo Aq Mt rpaulo@FreeBSD.org +.An Norikatsu Shigemura Aq Mt nork@FreeBSD.org +.An Jung-uk Kim Aq Mt jkim@FreeBSD.org .Sh CAVEATS For Family 10h and later processors, .Do diff --git a/share/man/man4/amr.4 b/share/man/man4/amr.4 index ad94ffe2c8d..1a38ee98cad 100644 --- a/share/man/man4/amr.4 +++ b/share/man/man4/amr.4 @@ -233,9 +233,9 @@ An I/O error has occurred. The .Nm driver was written by -.An Mike Smith Aq msmith@FreeBSD.org . +.An Mike Smith Aq Mt msmith@FreeBSD.org . .Pp This manual page was written by -.An Mike Smith Aq msmith@FreeBSD.org +.An Mike Smith Aq Mt msmith@FreeBSD.org and -.An Jeroen Ruigrok van der Werven Aq asmodai@FreeBSD.org . +.An Jeroen Ruigrok van der Werven Aq Mt asmodai@FreeBSD.org . diff --git a/share/man/man4/an.4 b/share/man/man4/an.4 index 608a4edf9a0..dd21376269d 100644 --- a/share/man/man4/an.4 +++ b/share/man/man4/an.4 @@ -141,4 +141,4 @@ device driver first appeared in The .Nm driver was written by -.An Bill Paul Aq wpaul@ee.columbia.edu . +.An Bill Paul Aq Mt wpaul@ee.columbia.edu . diff --git a/share/man/man4/aout.4 b/share/man/man4/aout.4 index e44362ec280..8e7b02b886f 100644 --- a/share/man/man4/aout.4 +++ b/share/man/man4/aout.4 @@ -40,7 +40,7 @@ executable format was used before the release of Since i386 was the only supported architecture at that time, .Xr a.out 5 executables can only be activated on platforms that support -execution of i386 code, such as i386, amd64 and (partially) ia64. +execution of i386 code, such as i386 and amd64. .Pp To add kernel support for old syscalls and old syscall invocation methods, place the following options in the kernel configuration file: @@ -141,6 +141,6 @@ it was superseded by The .Nm manual page was written by -.An Konstantin Belousov Aq kib@FreeBSD.org . +.An Konstantin Belousov Aq Mt kib@FreeBSD.org . .Sh BUGS On 64bit architectures, not all wrappers for older syscalls are implemented. diff --git a/share/man/man4/arcmsr.4 b/share/man/man4/arcmsr.4 index 1d4d650702a..b34bbd747f8 100644 --- a/share/man/man4/arcmsr.4 +++ b/share/man/man4/arcmsr.4 @@ -163,7 +163,7 @@ driver first appeared in .Fx 5.4 . .Sh AUTHORS The driver was written by -.An Erich Chen Aq erich@areca.com.tw . +.An Erich Chen Aq Mt erich@areca.com.tw . .Sh BUGS The driver has been tested on i386 and amd64. It likely requires additional diff --git a/share/man/man4/asmc.4 b/share/man/man4/asmc.4 index 6ad37442e0c..c74dc9ea015 100644 --- a/share/man/man4/asmc.4 +++ b/share/man/man4/asmc.4 @@ -155,9 +155,8 @@ The driver first appeared in .Fx 8.0 . .Sh AUTHORS -.An -nosplit -.An Rui Paulo Aq rpaulo@FreeBSD.org -(Google Summer of Code project). +.An Rui Paulo Aq Mt rpaulo@FreeBSD.org +(Google Summer of Code project) .Sh BUGS Support for the latest models was never tested and is most likely not fully working. diff --git a/share/man/man4/asr.4 b/share/man/man4/asr.4 index 955eb0f3655..9311d64a977 100644 --- a/share/man/man4/asr.4 +++ b/share/man/man4/asr.4 @@ -108,8 +108,8 @@ The .Nm driver was kindly donated by Adaptec and is maintained by -.An Mark Salyzyn Aq mark_salyzyn@adaptec.com . +.An Mark Salyzyn Aq Mt mark_salyzyn@adaptec.com . This manual page was written by .An Mark Salyzyn and fixed up by -.An Jeroen Ruigrok van der Werven Aq asmodai@FreeBSD.org . +.An Jeroen Ruigrok van der Werven Aq Mt asmodai@FreeBSD.org . diff --git a/share/man/man4/ata.4 b/share/man/man4/ata.4 index a1cbad39e55..4b53bf795e6 100644 --- a/share/man/man4/ata.4 +++ b/share/man/man4/ata.4 @@ -267,7 +267,5 @@ It was turned into a interface module in .Fx 9.0 . .Sh AUTHORS -.An Alexander Motin -.Aq mav@FreeBSD.org , -.An S\(/oren Schmidt -.Aq sos@FreeBSD.org +.An Alexander Motin Aq Mt mav@FreeBSD.org +.An S\(/oren Schmidt Aq Mt sos@FreeBSD.org diff --git a/share/man/man4/atkbd.4 b/share/man/man4/atkbd.4 index 17ccef5435a..202963a3035 100644 --- a/share/man/man4/atkbd.4 +++ b/share/man/man4/atkbd.4 @@ -223,8 +223,8 @@ driver first appeared in The .Nm driver was written by -.An S\(/oren Schmidt Aq sos@FreeBSD.org +.An S\(/oren Schmidt Aq Mt sos@FreeBSD.org and -.An Kazutaka Yokota Aq yokota@FreeBSD.org . +.An Kazutaka Yokota Aq Mt yokota@FreeBSD.org . This manual page was written by .An Kazutaka Yokota . diff --git a/share/man/man4/atkbdc.4 b/share/man/man4/atkbdc.4 index 46d30c1ec24..d0fc50d145a 100644 --- a/share/man/man4/atkbdc.4 +++ b/share/man/man4/atkbdc.4 @@ -116,4 +116,4 @@ It is based on the kbdio module in The kbdio module, the .Nm driver and this manual page were written by -.An Kazutaka Yokota Aq yokota@FreeBSD.org . +.An Kazutaka Yokota Aq Mt yokota@FreeBSD.org . diff --git a/share/man/man4/atp.4 b/share/man/man4/atp.4 index f7827988ca3..6309d09b97d 100644 --- a/share/man/man4/atp.4 +++ b/share/man/man4/atp.4 @@ -154,4 +154,4 @@ types. The .Nm driver was written by -.An Rohit Grover Aq rgrover1@gmail.com . +.An Rohit Grover Aq Mt rgrover1@gmail.com . diff --git a/share/man/man4/attimer.4 b/share/man/man4/attimer.4 index 751b9ea1a20..097e0733597 100644 --- a/share/man/man4/attimer.4 +++ b/share/man/man4/attimer.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 14, 2010 +.Dd May 26, 2014 .Dt ATTIMER 4 .Os .Sh NAME @@ -37,38 +37,48 @@ The following tunables are settable from the .Xr loader 8 : .Bl -ohang .It Va hint.attimer. Ns Ar X Ns Va .clock -controls event timers functionality support. Setting to 0, disables it. -Default value is 1. +controls support for the event timer functionality. +Setting this value to +.Dv 0 +disables it. +The default value is +.Dv 1 . .It Va hint.attimer. Ns Ar X Ns Va .timecounter -controls time counter functionality support. Setting to 0, disables it. -Default value is 1. +controls support for the time counter functionality. +Setting this value to +.Dv 0 +disables it. +The default value is +.Dv 1 . .It Va hw.i8254.freq -allows to override default counter frequency. -The same value is also available in run-time via +allows overriding the default counter frequency. +The same value is also available at run-time via the .Va machdep.i8254_freq sysctl. .El .Sh DESCRIPTION This driver uses i8254 Programmable Interval Timer (AT Timer) hardware -to supply kernel with one time counter and one event timer, and generate -sound tones for system speaker. +to supply the kernel with one timecounter and one event timer, and to generate +sound tones for the system speaker. This hardware includes three channels. -Each channel includes 16bit counter, counting down with known, +Each channel includes a 16 bit counter which decreases with a known, platform-dependent frequency. Counters can operate in several different modes, including periodic and one-shot. -Output of each channel has platform-defined wiring: one channel is wired +The output of each channel has platform-defined wiring: one channel is wired to the interrupt controller and may be used as event timer, one channel is -wired to speaker and used to generate sound tones, and one timer is reserved +wired to the speaker and used to generate sound tones, and one timer is reserved for platform purposes. .Pp -Driver uses single hardware channel to provide both time counter and event +The +.Nm +driver uses a single hardware channel to provide both time counter and event timer functionality. -To make it possible, respective counter must be running in periodic more. -As result, one-shot event timer mode supported only when time counter +To make this possible, the respective counter must be running in periodic mode. +As a result, the one-shot event timer mode is supported only when time counter functionality is disabled. .Pp -Event timer provided by the driver is irrelevant to CPU power states. +The event timer provided by the driver is irrelevant to CPU power states. .Sh SEE ALSO .Xr apic 4 , .Xr atrtc 4 , diff --git a/share/man/man4/audit.4 b/share/man/man4/audit.4 index 8fbce7db4ea..9f3f17f0ff6 100644 --- a/share/man/man4/audit.4 +++ b/share/man/man4/audit.4 @@ -123,7 +123,7 @@ The Basic Security Module (BSM) interface to audit records and audit event stream format were defined by Sun Microsystems. .Pp This manual page was written by -.An Robert Watson Aq rwatson@FreeBSD.org . +.An Robert Watson Aq Mt rwatson@FreeBSD.org . .Sh BUGS The .Fx diff --git a/share/man/man4/auditpipe.4 b/share/man/man4/auditpipe.4 index 19db8565b70..af20f803629 100644 --- a/share/man/man4/auditpipe.4 +++ b/share/man/man4/auditpipe.4 @@ -234,7 +234,7 @@ Support for kernel audit first appeared in .Fx 6.2 . .Sh AUTHORS The audit pipe facility was designed and implemented by -.An Robert Watson Aq rwatson@FreeBSD.org . +.An Robert Watson Aq Mt rwatson@FreeBSD.org . .Pp The Basic Security Module (BSM) interface to audit records and audit event stream format were defined by Sun Microsystems. diff --git a/share/man/man4/aue.4 b/share/man/man4/aue.4 index c708c8948fd..cfb59296ea5 100644 --- a/share/man/man4/aue.4 +++ b/share/man/man4/aue.4 @@ -202,4 +202,4 @@ device driver first appeared in The .Nm driver was written by -.An Bill Paul Aq wpaul@ee.columbia.edu . +.An Bill Paul Aq Mt wpaul@ee.columbia.edu . diff --git a/share/man/man4/axe.4 b/share/man/man4/axe.4 index 65e1887de27..06241a691a9 100644 --- a/share/man/man4/axe.4 +++ b/share/man/man4/axe.4 @@ -255,4 +255,4 @@ device driver first appeared in The .Nm driver was written by -.An Bill Paul Aq wpaul@windriver.com . +.An Bill Paul Aq Mt wpaul@windriver.com . diff --git a/share/man/man4/axge.4 b/share/man/man4/axge.4 index 33f7db3188f..d89ea8cd24f 100644 --- a/share/man/man4/axge.4 +++ b/share/man/man4/axge.4 @@ -137,14 +137,15 @@ The device driver first appeared in .Fx 10.1 . .Sh AUTHORS +.An -nosplit The .Nm driver was written by -.An Kevin Lo Aq kevlo@FreeBSD.org +.An Kevin Lo Aq Mt kevlo@FreeBSD.org and -.An Li-Wen Hsu Aq lwhsu@FreeBSD.org . +.An Li-Wen Hsu Aq Mt lwhsu@FreeBSD.org . This manual page was adapted by -.An Mark Johnston Aq markj@FreeBSD.org +.An Mark Johnston Aq Mt markj@FreeBSD.org from the .Xr axe 4 manual page. diff --git a/share/man/man4/bce.4 b/share/man/man4/bce.4 index 004ffa30f2a..9d7fc9dd19c 100644 --- a/share/man/man4/bce.4 +++ b/share/man/man4/bce.4 @@ -411,7 +411,7 @@ For support questions please contact your QLogic approved reseller or QLogic Technical Support at .Pa http://support.qlogic.com , or by E-mail at -.Aq support@qlogic.com . +.Aq Mt support@qlogic.com . .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , @@ -429,4 +429,4 @@ device driver first appeared in The .Nm driver was written by -.An David Christensen Aq davidch@broadcom.com . +.An David Christensen Aq Mt davidch@broadcom.com . diff --git a/share/man/man4/bge.4 b/share/man/man4/bge.4 index dc31ff6695a..474b48fa5ff 100644 --- a/share/man/man4/bge.4 +++ b/share/man/man4/bge.4 @@ -261,4 +261,4 @@ device driver first appeared in The .Nm driver was written by -.An Bill Paul Aq wpaul@windriver.com . +.An Bill Paul Aq Mt wpaul@windriver.com . diff --git a/share/man/man4/bhyve.4 b/share/man/man4/bhyve.4 index cdfc1e294d8..4947ecfc903 100644 --- a/share/man/man4/bhyve.4 +++ b/share/man/man4/bhyve.4 @@ -58,9 +58,9 @@ and was developed at NetApp Inc. .Nm was developed by .An -nosplit -.An "Peter Grehan" Aq grehan@FreeBSD.org +.An Peter Grehan Aq Mt grehan@FreeBSD.org and -.An "Neel Natu" Aq neel@FreeBSD.org +.An Neel Natu Aq Mt neel@FreeBSD.org at NetApp Inc. .Sh BUGS .Nm diff --git a/share/man/man4/bktr.4 b/share/man/man4/bktr.4 index 59136bff593..5590b4a9fb1 100644 --- a/share/man/man4/bktr.4 +++ b/share/man/man4/bktr.4 @@ -257,10 +257,10 @@ driver first appeared in .Sh AUTHORS .An -nosplit This driver is based on the work of -.An Jim Lowe Aq james@miller.cs.uwm.edu , -.An Mark Tinguely Aq tinguely@plains.nodak.edu , -.An Amancio Hasty Aq hasty@star-gate.com , -.An Roger Hardiman Aq roger@FreeBSD.org +.An Jim Lowe Aq Mt james@miller.cs.uwm.edu , +.An Mark Tinguely Aq Mt tinguely@plains.nodak.edu , +.An Amancio Hasty Aq Mt hasty@star-gate.com , +.An Roger Hardiman Aq Mt roger@FreeBSD.org and a bunch of other people. Support for Pinnacle PCTV Rave cards was added by -.An Branko Lankester Aq branko@euro.net . +.An Branko Lankester Aq Mt branko@euro.net . diff --git a/share/man/man4/bridge.4 b/share/man/man4/bridge.4 index ec54666c53c..cecffc595e0 100644 --- a/share/man/man4/bridge.4 +++ b/share/man/man4/bridge.4 @@ -500,20 +500,17 @@ driver first appeared in The .Nm bridge driver was originally written by -.An Jason L. Wright -.Aq jason@thought.net +.An Jason L. Wright Aq Mt jason@thought.net as part of an undergraduate independent study at the University of North Carolina at Greensboro. .Pp This version of the .Nm driver has been heavily modified from the original version by -.An Jason R. Thorpe -.Aq thorpej@wasabisystems.com . +.An Jason R. Thorpe Aq Mt thorpej@wasabisystems.com . .Pp Rapid Spanning Tree Protocol (RSTP) support was added by -.An Andrew Thompson -.Aq thompsa@FreeBSD.org . +.An Andrew Thompson Aq Mt thompsa@FreeBSD.org . .Sh BUGS The .Nm diff --git a/share/man/man4/bwn.4 b/share/man/man4/bwn.4 index 4aa75fda494..3dc43b4bfd0 100644 --- a/share/man/man4/bwn.4 +++ b/share/man/man4/bwn.4 @@ -146,8 +146,7 @@ driver first appeared in The .Nm driver was written by -.An Weongyo Jeong -.Aq weongyo@FreeBSD.org . +.An Weongyo Jeong Aq Mt weongyo@FreeBSD.org . .\".Sh BUGS .\"Some card based on the BCM4306 and BCM4309 chips do not work properly .\"on channel 1, 2 and 3. diff --git a/share/man/man4/bxe.4 b/share/man/man4/bxe.4 index 0067385b7cb..cdc23f570a0 100644 --- a/share/man/man4/bxe.4 +++ b/share/man/man4/bxe.4 @@ -320,7 +320,7 @@ For support questions please contact your QLogic approved reseller or QLogic Technical Support at .Pa http://support.qlogic.com , or by E-mail at -.Aq support@qlogic.com . +.Aq Mt support@qlogic.com . .Sh SEE ALSO .Xr netstat 1 , .Xr altq 4 , @@ -338,7 +338,7 @@ device driver first appeared in The .Nm driver was written by -.An Eric Davis Aq edavis@broadcom.com , -.An David Christensen Aq davidch@broadcom.com , +.An Eric Davis Aq Mt edavis@broadcom.com , +.An David Christensen Aq Mt davidch@broadcom.com , and -.An Gary Zambrano Aq zambrano@broadcom.com . +.An Gary Zambrano Aq Mt zambrano@broadcom.com . diff --git a/share/man/man4/capsicum.4 b/share/man/man4/capsicum.4 index 9009d3ff4b4..9290cbcf032 100644 --- a/share/man/man4/capsicum.4 +++ b/share/man/man4/capsicum.4 @@ -116,15 +116,15 @@ and was developed at the University of Cambridge. .Nm was developed by .An -nosplit -.An "Robert Watson" Aq rwatson@FreeBSD.org +.An Robert Watson Aq Mt rwatson@FreeBSD.org and -.An "Jonathan Anderson" Aq jonathan@FreeBSD.org +.An Jonathan Anderson Aq Mt jonathan@FreeBSD.org at the University of Cambridge, and -.An "Ben Laurie" Aq benl@FreeBSD.org +.An Ben Laurie Aq Mt benl@FreeBSD.org and -.An "Kris Kennaway" Aq kris@FreeBSD.org +.An Kris Kennaway Aq Mt kris@FreeBSD.org at Google, Inc., and -.An "Pawel Jakub Dawidek" Aq pawel@dawidek.net . +.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net . .Sh BUGS .Nm is considered experimental in diff --git a/share/man/man4/carp.4 b/share/man/man4/carp.4 index 84e87d6edee..ca52ba2f7b8 100644 --- a/share/man/man4/carp.4 +++ b/share/man/man4/carp.4 @@ -210,17 +210,18 @@ Enable it on both hosts A and B: .Pp Assume that host A is the preferred master and we are running the 192.168.1.0/24 prefix on em0 and 192.168.2.0/24 on em1. -This is the setup for host A: +This is the setup for host A (advskew is above 0 so it could be overwritten +in the emergency situation from the other host): .Bd -literal -offset indent -ifconfig em0 vhid 1 pass mekmitasdigoat 192.168.1.1/24 -ifconfig em1 vhid 2 pass mekmitasdigoat 192.168.2.1/24 +ifconfig em0 vhid 1 advskew 100 pass mekmitasdigoat 192.168.1.1/24 +ifconfig em1 vhid 2 advskew 100 pass mekmitasdigoat 192.168.2.1/24 .Ed .Pp The setup for host B is identical, but it has a higher .Cm advskew : .Bd -literal -offset indent -ifconfig em0 vhid 1 advskew 100 pass mekmitasdigoat 192.168.1.1/24 -ifconfig em1 vhid 2 advskew 100 pass mekmitasdigoat 192.168.2.1/24 +ifconfig em0 vhid 1 advskew 200 pass mekmitasdigoat 192.168.1.1/24 +ifconfig em1 vhid 2 advskew 200 pass mekmitasdigoat 192.168.2.1/24 .Ed .Pp When one of the physical interfaces of host A fails, @@ -246,9 +247,9 @@ preempt host A on both interfaces instead of just the failed one. .\"out slightly less frequently. .\".Bd -literal -offset indent .\"ifconfig carp0 create -.\"ifconfig carp0 vhid 1 pass mekmitasdigoat 192.168.1.10/24 +.\"ifconfig carp0 vhid 1 advskew 100 pass mekmitasdigoat 192.168.1.10/24 .\"ifconfig carp1 create -.\"ifconfig carp1 vhid 2 advskew 100 pass mekmitasdigoat 192.168.1.10/24 +.\"ifconfig carp1 vhid 2 advskew 200 pass mekmitasdigoat 192.168.1.10/24 .\".Ed .\".Pp .\"The configuration for host B is identical, except the @@ -256,9 +257,9 @@ preempt host A on both interfaces instead of just the failed one. .\"is on virtual host 1 rather than virtual host 2. .\".Bd -literal -offset indent .\"ifconfig carp0 create -.\"ifconfig carp0 vhid 1 advskew 100 pass mekmitasdigoat 192.168.1.10/24 +.\"ifconfig carp0 vhid 1 advskew 200 pass mekmitasdigoat 192.168.1.10/24 .\"ifconfig carp1 create -.\"ifconfig carp1 vhid 2 pass mekmitasdigoat 192.168.1.10/24 +.\"ifconfig carp1 vhid 2 advskew 100 pass mekmitasdigoat 192.168.1.10/24 .\".Ed .\".Pp .\"Finally, the ARP balancing feature must be enabled on both hosts: diff --git a/share/man/man4/cas.4 b/share/man/man4/cas.4 index 36a5ab19d55..6fbbfcfcf29 100644 --- a/share/man/man4/cas.4 +++ b/share/man/man4/cas.4 @@ -152,8 +152,7 @@ and supports the same set of controllers but is otherwise unrelated. The .Nm driver was written by -.An Marius Strobl -.Aq marius@FreeBSD.org +.An Marius Strobl Aq Mt marius@FreeBSD.org based on the .Xr gem 4 driver. diff --git a/share/man/man4/cc_cdg.4 b/share/man/man4/cc_cdg.4 index c111bd46ed4..38f8ed397de 100644 --- a/share/man/man4/cc_cdg.4 +++ b/share/man/man4/cc_cdg.4 @@ -145,11 +145,11 @@ http://caia.swin.edu.au/urp/newtcp/ The .Nm congestion control module was written by -.An David Hayes Aq david.hayes@ieee.org . +.An David Hayes Aq Mt david.hayes@ieee.org . This manual page was written by -.An Lawrence Stewart Aq lstewart@FreeBSD.org +.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org and -.An Grenville Armitage Aq garmitage@swin.edu.au . +.An Grenville Armitage Aq Mt garmitage@swin.edu.au . .Sh BUGS The underlying algorithm and parameter values are still a work in progress and may not be optimal for some network scenarios. diff --git a/share/man/man4/cc_chd.4 b/share/man/man4/cc_chd.4 index 39cdef3b601..963d89247fd 100644 --- a/share/man/man4/cc_chd.4 +++ b/share/man/man4/cc_chd.4 @@ -125,4 +125,4 @@ http://caia.swin.edu.au/urp/newtcp/ The .Nm congestion control module and this manual page were written by -.An David Hayes Aq david.hayes@ieee.org . +.An David Hayes Aq Mt david.hayes@ieee.org . diff --git a/share/man/man4/cc_cubic.4 b/share/man/man4/cc_cubic.4 index 771f2643b9b..75df183fa16 100644 --- a/share/man/man4/cc_cubic.4 +++ b/share/man/man4/cc_cubic.4 @@ -109,6 +109,6 @@ http://caia.swin.edu.au/urp/newtcp/ The .Nm congestion control module and this manual page were written by -.An Lawrence Stewart Aq lstewart@FreeBSD.org +.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org and -.An David Hayes Aq david.hayes@ieee.org . +.An David Hayes Aq Mt david.hayes@ieee.org . diff --git a/share/man/man4/cc_hd.4 b/share/man/man4/cc_hd.4 index d0acb34c05e..497e61616a0 100644 --- a/share/man/man4/cc_hd.4 +++ b/share/man/man4/cc_hd.4 @@ -117,4 +117,4 @@ http://caia.swin.edu.au/urp/newtcp/ The .Nm congestion control module and this manual page were written by -.An David Hayes Aq david.hayes@ieee.org . +.An David Hayes Aq Mt david.hayes@ieee.org . diff --git a/share/man/man4/cc_htcp.4 b/share/man/man4/cc_htcp.4 index 45d00186c87..0e141bb79a7 100644 --- a/share/man/man4/cc_htcp.4 +++ b/share/man/man4/cc_htcp.4 @@ -126,11 +126,11 @@ http://caia.swin.edu.au/urp/newtcp/ The .Nm congestion control module was written by -.An James Healy Aq jimmy@deefa.com +.An James Healy Aq Mt jimmy@deefa.com and -.An Lawrence Stewart Aq lstewart@FreeBSD.org . +.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org . .Pp This manual page was written by -.An Lawrence Stewart Aq lstewart@FreeBSD.org +.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org and -.An David Hayes Aq david.hayes@ieee.org . +.An David Hayes Aq Mt david.hayes@ieee.org . diff --git a/share/man/man4/cc_newreno.4 b/share/man/man4/cc_newreno.4 index fe4c3db306b..b00f18f93ce 100644 --- a/share/man/man4/cc_newreno.4 +++ b/share/man/man4/cc_newreno.4 @@ -73,10 +73,10 @@ http://caia.swin.edu.au/urp/newtcp/ The .Nm congestion control module was written by -.An James Healy Aq jimmy@deefa.com , -.An Lawrence Stewart Aq lstewart@FreeBSD.org +.An James Healy Aq Mt jimmy@deefa.com , +.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org and -.An David Hayes Aq david.hayes@ieee.org . +.An David Hayes Aq Mt david.hayes@ieee.org . .Pp This manual page was written by -.An Lawrence Stewart Aq lstewart@FreeBSD.org . +.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org . diff --git a/share/man/man4/cc_vegas.4 b/share/man/man4/cc_vegas.4 index a7397d58d20..45b4b624401 100644 --- a/share/man/man4/cc_vegas.4 +++ b/share/man/man4/cc_vegas.4 @@ -133,4 +133,4 @@ http://caia.swin.edu.au/urp/newtcp/ The .Nm congestion control module and this manual page were written by -.An David Hayes Aq david.hayes@ieee.org . +.An David Hayes Aq Mt david.hayes@ieee.org . diff --git a/share/man/man4/cdce.4 b/share/man/man4/cdce.4 index e055e1b96f6..d38a9698f59 100644 --- a/share/man/man4/cdce.4 +++ b/share/man/man4/cdce.4 @@ -139,15 +139,15 @@ and The .Nm driver was written by -.An Craig Boston Aq craig@tobuj.gank.org +.An Craig Boston Aq Mt craig@tobuj.gank.org based on the .Xr aue 4 driver written by -.An Bill Paul Aq wpaul@windriver.com +.An Bill Paul Aq Mt wpaul@windriver.com and ported to .Ox by -.An Daniel Hartmeier Aq dhartmei@openbsd.org . +.An Daniel Hartmeier Aq Mt dhartmei@openbsd.org . .Sh CAVEATS Many USB devices notoriously fail to report their class and interfaces correctly. diff --git a/share/man/man4/ch.4 b/share/man/man4/ch.4 index d097d54ab6e..121199b4c66 100644 --- a/share/man/man4/ch.4 +++ b/share/man/man4/ch.4 @@ -340,13 +340,13 @@ driver appeared in The .Nm driver was written by -.An Jason R. Thorpe Aq thorpej@and.com +.An Jason R. Thorpe Aq Mt thorpej@and.com for And Communications, .Pa http://www.and.com/ . It was added to the system by -.An Stefan Grefen Aq grefen@goofy.zdv.uni-mainz.de +.An Stefan Grefen Aq Mt grefen@goofy.zdv.uni-mainz.de who apparently had such a device. It was ported to CAM by -.An Kenneth Merry Aq ken@FreeBSD.org . +.An Kenneth Merry Aq Mt ken@FreeBSD.org . It was updated to support volume tags by -.An Hans Huebner Aq hans@artcom.de . +.An Hans Huebner Aq Mt hans@artcom.de . diff --git a/share/man/man4/ciss.4 b/share/man/man4/ciss.4 index 284944bd177..f79efe89a22 100644 --- a/share/man/man4/ciss.4 +++ b/share/man/man4/ciss.4 @@ -184,7 +184,7 @@ HP Modular Smart Array 500 (MSA500) The .Nm driver was written by -.An Mike Smith Aq msmith@FreeBSD.org . +.An Mike Smith Aq Mt msmith@FreeBSD.org . .Pp This manual page is based on his comments and was written by -.An Tom Rhodes Aq trhodes@FreeBSD.org . +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org . diff --git a/share/man/man4/cm.4 b/share/man/man4/cm.4 index bbeee52f953..a933918e9fa 100644 --- a/share/man/man4/cm.4 +++ b/share/man/man4/cm.4 @@ -145,18 +145,18 @@ The device was ported from .Nx by -.An Max Khon Aq fjoe@FreeBSD.org +.An Max Khon Aq Mt fjoe@FreeBSD.org and first appeared in .Fx 4.6 . This manual page first appeared in .Fx 5.3 . .Sh AUTHORS This manual page was written by -.An Tom Rhodes Aq trhodes@FreeBSD.org . +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org . The .Sx IMPLEMENTATION NOTES section was submitted by -.An Max Khon Aq fjoe@FreeBSD.org +.An Max Khon Aq Mt fjoe@FreeBSD.org and originated from .Nx . .Sh BUGS diff --git a/share/man/man4/cmx.4 b/share/man/man4/cmx.4 index 844e6c446e5..38ae4661789 100644 --- a/share/man/man4/cmx.4 +++ b/share/man/man4/cmx.4 @@ -103,11 +103,11 @@ driver first appeared in The .Nm driver was written by -.An Daniel Roethlisberger Aq daniel@roe.ch , +.An Daniel Roethlisberger Aq Mt daniel@roe.ch , originally based on the Linux driver v1.1.0 by -.An Omnikey GmbH Aq www.omnikey.com . +.An Omnikey GmbH Lk www.omnikey.com . Early testing and bug fixes by -.An Marcin Cieslak Aq saper@system.pl . +.An Marcin Cieslak Aq Mt saper@system.pl . .Sh BUGS .An -nosplit The way the diff --git a/share/man/man4/coretemp.4 b/share/man/man4/coretemp.4 index efae020a152..91a975861a0 100644 --- a/share/man/man4/coretemp.4 +++ b/share/man/man4/coretemp.4 @@ -68,7 +68,7 @@ driver first appeared in The .Nm driver was written by -.An Rui Paulo Aq rpaulo@FreeBSD.org +.An Rui Paulo Aq Mt rpaulo@FreeBSD.org as part of a Google Summer of Code project. This manual page was written by -.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . +.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org . diff --git a/share/man/man4/cpuctl.4 b/share/man/man4/cpuctl.4 index ed80f8aae1c..470734b719a 100644 --- a/share/man/man4/cpuctl.4 +++ b/share/man/man4/cpuctl.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 30, 2009 +.Dd June 20, 2014 .Dt CPUCTL 4 .Os .Sh NAME @@ -65,7 +65,7 @@ All of the supported operations are invoked using the .Xr ioctl 2 system call. Currently, the following ioctls are defined: -.Bl -tag -width CPUCTL_UPDATE +.Bl -tag -width CPUCTL_CPUID_COUNT .It Dv CPUCTL_RDMSR Fa cpuctl_msr_args_t *args .It Dv CPUCTL_WRMSR Fa cpuctl_msr_args_t *args Read/write CPU machine specific register. @@ -87,20 +87,59 @@ Set/clear MSR bits according to the mask given in the field. .It Dv CPUCTL_CPUID Fa cpuctl_cpuid_args_t *args Retrieve CPUID information. -Arguments are supplied in -the following struct: +Arguments are supplied in the following structure: .Bd -literal typedef struct { - int level; /* CPUID level */ + int level; /* CPUID level */ uint32_t data[4]; } cpuctl_cpuid_args_t; .Ed -.Pp +It is equivalent to the +.Dv CPUCTL_CPUID_COUNT +request with +.Va level_type +set to 0. +.It Dv CPUCTL_CPUID_COUNT Fa cpuctl_cpuid_count_args_t *args +Retrieve CPUID information. +Arguments are supplied in the following structure: +.Bd -literal +typedef struct { + int level; /* CPUID level */ + int level_type; /* CPUID level type */ + uint32_t data[4]; +} cpuctl_cpuid_count_args_t; +.Ed The .Va level -field indicates the CPUID level to retrieve information for, while the +field indicates the CPUID level to retrieve, +it is loaded into the +.Va %eax +register before the CPUID instruction is executed, +The +.Va level_type +field indicates the CPUID level type to retrieve, +it is loaded into the +.Va %ecx +register. +.Pp +The .Va data field is used to store the received CPUID data. +That is, +.Va data[0] +contains the value of +.Va %eax +register after the CPUID instruction is executed, +.Va data[1] +is for +.Va %ebx , +.Va data[2] +for +.Va %ecx , +and +.Va data[3] +for +.Va %edx . .It Dv CPUCTL_UPDATE cpuctl_update_args_t *args Update CPU firmware (microcode). The structure is defined in @@ -149,6 +188,6 @@ driver first appeared in The .Nm module and this manual page were written by -.An Stanislav Sedov Aq stas@FreeBSD.org . +.An Stanislav Sedov Aq Mt stas@FreeBSD.org . .Sh BUGS Yes, probably, report if any. diff --git a/share/man/man4/ctl.4 b/share/man/man4/ctl.4 index 7122a92b0ab..51fd0a53602 100644 --- a/share/man/man4/ctl.4 +++ b/share/man/man4/ctl.4 @@ -90,4 +90,4 @@ subsystem first appeared in The .Nm subsystem was written by -.An Kenneth Merry Aq ken@FreeBSD.org . +.An Kenneth Merry Aq Mt ken@FreeBSD.org . diff --git a/share/man/man4/cue.4 b/share/man/man4/cue.4 index a27653cffa8..0ed9e8d7eb6 100644 --- a/share/man/man4/cue.4 +++ b/share/man/man4/cue.4 @@ -110,4 +110,4 @@ device driver first appeared in The .Nm driver was written by -.An Bill Paul Aq wpaul@ee.columbia.edu . +.An Bill Paul Aq Mt wpaul@ee.columbia.edu . diff --git a/share/man/man4/cxgb.4 b/share/man/man4/cxgb.4 index 97f72b570d9..5df049fc14d 100644 --- a/share/man/man4/cxgb.4 +++ b/share/man/man4/cxgb.4 @@ -110,7 +110,7 @@ go to the Chelsio support website at: If an issue is identified with the released source code on the supported kernel with a supported adapter, email the specific information related to the issue to -.Aq support@chelsio.com . +.Aq Mt support@chelsio.com . .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , @@ -129,6 +129,6 @@ and The .Nm driver was written by -.An Kip Macy Aq kmacy@FreeBSD.org +.An Kip Macy Aq Mt kmacy@FreeBSD.org with substantial support from -.An Scott Long Aq scottl@FreeBSD.org . +.An Scott Long Aq Mt scottl@FreeBSD.org . diff --git a/share/man/man4/cxgbe.4 b/share/man/man4/cxgbe.4 index af6a6a0c4f6..215a1948381 100644 --- a/share/man/man4/cxgbe.4 +++ b/share/man/man4/cxgbe.4 @@ -292,7 +292,7 @@ go to the Chelsio support website at: .Pp If an issue is identified with this driver with a supported adapter, email all the specific information related to the issue to -.Aq support@chelsio.com . +.Aq Mt support@chelsio.com . .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , @@ -314,4 +314,4 @@ and The .Nm driver was written by -.An Navdeep Parhar Aq np@FreeBSD.org . +.An Navdeep Parhar Aq Mt np@FreeBSD.org . diff --git a/share/man/man4/dc.4 b/share/man/man4/dc.4 index cc6250c2c2e..ba033cf2e25 100644 --- a/share/man/man4/dc.4 +++ b/share/man/man4/dc.4 @@ -383,7 +383,7 @@ device driver first appeared in The .Nm driver was written by -.An Bill Paul Aq wpaul@ee.columbia.edu . +.An Bill Paul Aq Mt wpaul@ee.columbia.edu . .Sh BUGS The Macronix application notes claim that in order to put the chips in normal operation, the driver must write a certain magic diff --git a/share/man/man4/dcons.4 b/share/man/man4/dcons.4 index 91bb4b45916..3f33dd214ef 100644 --- a/share/man/man4/dcons.4 +++ b/share/man/man4/dcons.4 @@ -119,7 +119,7 @@ dcons_gdb="1" .Xr dconschat 8 , .Xr fwcontrol 8 .Sh AUTHORS -.An Hidetoshi Shimokawa Aq simokawa@FreeBSD.org +.An Hidetoshi Shimokawa Aq Mt simokawa@FreeBSD.org .Sh BUGS This driver is .Ud diff --git a/share/man/man4/dcons_crom.4 b/share/man/man4/dcons_crom.4 index b9c5ca09deb..eca479d5f99 100644 --- a/share/man/man4/dcons_crom.4 +++ b/share/man/man4/dcons_crom.4 @@ -51,7 +51,7 @@ This address is supposed to be used by .Xr dconschat 8 , .Xr fwcontrol 8 .Sh AUTHORS -.An Hidetoshi Shimokawa Aq simokawa@FreeBSD.org +.An Hidetoshi Shimokawa Aq Mt simokawa@FreeBSD.org .Sh BUGS If you load .Pa dcons_crom.ko diff --git a/share/man/man4/ddb.4 b/share/man/man4/ddb.4 index 01f5135f58e..15ff4f74272 100644 --- a/share/man/man4/ddb.4 +++ b/share/man/man4/ddb.4 @@ -60,7 +60,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 30, 2013 +.Dd July 15, 2014 .Dt DDB 4 .Os .Sh NAME @@ -572,17 +572,26 @@ Dump data about APIC IDT vector mappings. Show breakpoints set with the "break" command. .\" .Pp -.It Ic show Cm buffer -Show buffer structure of +.It Ic show Cm bio Ar addr +Show information about the bio structure +.Vt struct bio +present at +.Ar addr . +See the +.Pa sys/bio.h +header file and +.Xr g_bio 9 +for more details on the exact meaning of the structure fields. +.\" +.Pp +.It Ic show Cm buffer Ar addr +Show information about the buf structure .Vt struct buf -type. -Such a structure is used within the -.Fx -kernel for the I/O subsystem -implementation. -For an exact interpretation of the output, please see the +present at +.Ar addr . +See the .Pa sys/buf.h -header file. +header file for more details on the exact meaning of the structure fields. .\" .Pp .It Ic show Cm cbstat @@ -1115,7 +1124,7 @@ abbreviations. .It Ic capture status .Nm supports a basic output capture facility, which can be used to retrieve the -results of debugging commands from userpsace using +results of debugging commands from userspace using .Xr sysctl 2 . .Ic capture on enables output capture; @@ -1420,7 +1429,7 @@ diagnose problems. Other bus' bridge chipsets may be able to generate NMI using bus specific methods. .Sh FILES -Header files mention in this manual page can be found below +Header files mentioned in this manual page can be found below .Pa /usr/include directory. .Pp diff --git a/share/man/man4/divert.4 b/share/man/man4/divert.4 index d22275ec630..d8296995ca9 100644 --- a/share/man/man4/divert.4 +++ b/share/man/man4/divert.4 @@ -175,7 +175,7 @@ that was not associated with any interface. .Xr ipfw 4 , .Xr ipfw 8 .Sh AUTHORS -.An Archie Cobbs Aq archie@FreeBSD.org , +.An Archie Cobbs Aq Mt archie@FreeBSD.org , Whistle Communications Corp. .Sh BUGS This is an attempt to provide a clean way for user mode processes diff --git a/share/man/man4/dummynet.4 b/share/man/man4/dummynet.4 index a5d0e6c8d05..65571b3dde1 100644 --- a/share/man/man4/dummynet.4 +++ b/share/man/man4/dummynet.4 @@ -69,7 +69,7 @@ facility was initially implemented as a testing tool for .Tn TCP congestion control by -.An Luigi Rizzo Aq luigi@iet.unipi.it , +.An Luigi Rizzo Aq Mt luigi@iet.unipi.it , as described on ACM Computer Communication Review, Jan.97 issue. Later it has been modified to work at the .Tn IP diff --git a/share/man/man4/em.4 b/share/man/man4/em.4 index 9c95286736f..ab50ab13a4e 100644 --- a/share/man/man4/em.4 +++ b/share/man/man4/em.4 @@ -260,7 +260,7 @@ go to the Intel support website at: If an issue is identified with the released source code on the supported kernel with a supported adapter, email the specific information related to the issue to -.Aq freebsd@intel.com . +.Aq Mt freebsd@intel.com . .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , @@ -280,7 +280,7 @@ device driver first appeared in The .Nm driver was written by -.An Intel Corporation Aq freebsd@intel.com . +.An Intel Corporation Aq Mt freebsd@intel.com . .Sh BUGS Hardware-assisted VLAN processing is disabled by default. You can enable it on an diff --git a/share/man/man4/esp.4 b/share/man/man4/esp.4 index 6ebc85b3112..ccb574ce5e9 100644 --- a/share/man/man4/esp.4 +++ b/share/man/man4/esp.4 @@ -102,11 +102,9 @@ The driver was ported to .Fx by -.An Scott Long -.Aq scottl@FreeBSD.org +.An Scott Long Aq Mt scottl@FreeBSD.org and later on considerably improved by -.An Marius Strobl -.Aq marius@FreeBSD.org . +.An Marius Strobl Aq Mt marius@FreeBSD.org . .Sh BUGS The .Nm diff --git a/share/man/man4/est.4 b/share/man/man4/est.4 index 9f60206edac..0dc4922fb99 100644 --- a/share/man/man4/est.4 +++ b/share/man/man4/est.4 @@ -91,7 +91,6 @@ The valid frequencies that are allowed by this CPU and their step values. .It dev.est.0.freq_settings: 2201/45000 2200/45000 2000/39581 1900/37387 1800/34806 1700/32703 1600/30227 1500/28212 1400/25828 1300/23900 1200/21613 1100/19775 1000/17582 900/15437 800/13723 -.Pp .El .Sh DIAGNOSTICS .Bl -diag @@ -118,4 +117,4 @@ is only found on supported Intel CPUs. .Re .Sh AUTHORS This manual page was written by -.An Sean Bruno Aq sbruno@FreeBSD.org . +.An Sean Bruno Aq Mt sbruno@FreeBSD.org . diff --git a/share/man/man4/et.4 b/share/man/man4/et.4 index 9b994701742..7a0a92e7d53 100644 --- a/share/man/man4/et.4 +++ b/share/man/man4/et.4 @@ -177,10 +177,10 @@ release to include it was The .Nm driver was written by -.An Sepherosa Ziehau Aq sepherosa@gmail.com +.An Sepherosa Ziehau Aq Mt sepherosa@gmail.com for .Dx . It was ported to .Fx by -.An Xin LI Aq delphij@FreeBSD.org . +.An Xin LI Aq Mt delphij@FreeBSD.org . diff --git a/share/man/man4/fatm.4 b/share/man/man4/fatm.4 index 51dc6fc0eb7..c59ff338b64 100644 --- a/share/man/man4/fatm.4 +++ b/share/man/man4/fatm.4 @@ -103,7 +103,7 @@ fatm0: mem 0xd5800000-0xd59fffff irq 9 at device 9.0 on pci0 .Xr natmip 4 , .Xr utopia 4 .Sh AUTHORS -.An Harti Brandt Aq harti@FreeBSD.org +.An Harti Brandt Aq Mt harti@FreeBSD.org .Sh BUGS These cards can CBR shape a single VCC only. It is currently possible to diff --git a/share/man/man4/ffclock.4 b/share/man/man4/ffclock.4 index 9110c167ceb..992610dc28d 100644 --- a/share/man/man4/ffclock.4 +++ b/share/man/man4/ffclock.4 @@ -118,12 +118,12 @@ Feed-forward clock support first appeared in .Sh AUTHORS .An -nosplit The feed-forward clock support was written by -.An Julien Ridoux Aq jridoux@unimelb.edu.au +.An Julien Ridoux Aq Mt jridoux@unimelb.edu.au in collaboration with -.An Darryl Veitch Aq dveitch@unimelb.edu.au +.An Darryl Veitch Aq Mt dveitch@unimelb.edu.au at the University of Melbourne under sponsorship from the FreeBSD Foundation. .Pp This manual page was written by -.An Julien Ridoux Aq jridoux@unimelb.edu.au +.An Julien Ridoux Aq Mt jridoux@unimelb.edu.au and -.An Lawrence Stewart Aq lstewart@FreeBSD.org . +.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org . diff --git a/share/man/man4/full.4 b/share/man/man4/full.4 index a71eb926361..1cd3f1a0402 100644 --- a/share/man/man4/full.4 +++ b/share/man/man4/full.4 @@ -44,4 +44,4 @@ However, it will always be full when writing to it. .Xr zero 4 .Sh Author This device and man page was written by -.An Eitan Adler Aq eadler@FreeBSD.org . +.An Eitan Adler Aq Mt eadler@FreeBSD.org . diff --git a/share/man/man4/gbde.4 b/share/man/man4/gbde.4 index 2b868e55548..ada799729ca 100644 --- a/share/man/man4/gbde.4 +++ b/share/man/man4/gbde.4 @@ -301,4 +301,4 @@ under DARPA/SPAWAR contract N66001-01-C-8035 as part of the DARPA CHATS research program. .Sh AUTHORS -.An "Poul-Henning Kamp" Aq phk@FreeBSD.org +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org diff --git a/share/man/man4/gdb.4 b/share/man/man4/gdb.4 index f81ef402a0e..dc733821dc7 100644 --- a/share/man/man4/gdb.4 +++ b/share/man/man4/gdb.4 @@ -578,7 +578,7 @@ message to remind you to remove it again. .Xr kldload 8 .Sh AUTHORS This man page was written by -.An "Greg Lehey" Aq grog@FreeBSD.org . +.An Greg Lehey Aq Mt grog@FreeBSD.org . .Sh BUGS The .Xr gdb 1 diff --git a/share/man/man4/gem.4 b/share/man/man4/gem.4 index e4ebeb0ca6d..44e06251ea6 100644 --- a/share/man/man4/gem.4 +++ b/share/man/man4/gem.4 @@ -133,16 +133,12 @@ The driver was written for .Nx by -.An Eduardo Horvath -.Aq eeh@NetBSD.org . +.An Eduardo Horvath Aq Mt eeh@NetBSD.org . It was ported to .Fx by -.An Thomas Moestl -.Aq tmm@FreeBSD.org +.An Thomas Moestl Aq Mt tmm@FreeBSD.org and later on improved by -.An Marius Strobl -.Aq marius@FreeBSD.org . +.An Marius Strobl Aq Mt marius@FreeBSD.org . The man page was written by -.An Thomas Klausner -.Aq wiz@NetBSD.org . +.An Thomas Klausner Aq Mt wiz@NetBSD.org . diff --git a/share/man/man4/geom.4 b/share/man/man4/geom.4 index 3cfc28383d1..c881f476ed0 100644 --- a/share/man/man4/geom.4 +++ b/share/man/man4/geom.4 @@ -481,4 +481,4 @@ in .Fx never succeeded. .Sh AUTHORS -.An "Poul-Henning Kamp" Aq phk@FreeBSD.org +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org diff --git a/share/man/man4/geom_fox.4 b/share/man/man4/geom_fox.4 index 8010d24d4d0..55d84f143e7 100644 --- a/share/man/man4/geom_fox.4 +++ b/share/man/man4/geom_fox.4 @@ -181,9 +181,9 @@ da2.fox N/A da2 The .Nm driver was written by -.An "Poul-Henning Kamp" Aq phk@FreeBSD.org . +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . This manual page was written by -.An "Wilko Bulte" Aq wilko@FreeBSD.org . +.An Wilko Bulte Aq Mt wilko@FreeBSD.org . .Sh CAVEATS The .Nm diff --git a/share/man/man4/geom_linux_lvm.4 b/share/man/man4/geom_linux_lvm.4 index 7dee047512d..2e1c8aa07ad 100644 --- a/share/man/man4/geom_linux_lvm.4 +++ b/share/man/man4/geom_linux_lvm.4 @@ -85,4 +85,4 @@ Consumers: The .Nm driver was written by -.An "Andrew Thompson" Aq thompsa@FreeBSD.org . +.An Andrew Thompson Aq Mt thompsa@FreeBSD.org . diff --git a/share/man/man4/geom_map.4 b/share/man/man4/geom_map.4 index 6af91be5d82..51b15c79f8d 100644 --- a/share/man/man4/geom_map.4 +++ b/share/man/man4/geom_map.4 @@ -208,4 +208,4 @@ hint.map.5.name="config" The .Nm driver was written by -.An "Aleksandr Rybalko" Aq ray@ddteam.net . +.An Aleksandr Rybalko Aq Mt ray@ddteam.net . diff --git a/share/man/man4/geom_uncompress.4 b/share/man/man4/geom_uncompress.4 index 6e848d430fa..0682c690fe3 100644 --- a/share/man/man4/geom_uncompress.4 +++ b/share/man/man4/geom_uncompress.4 @@ -100,8 +100,8 @@ Consumers: The .Nm driver was written by -.An "Maxim Sobolev" Aq sobomax@FreeBSD.org +.An Maxim Sobolev Aq Mt sobomax@FreeBSD.org and -.An "Aleksandr Rybalko" Aq ray@FreeBSD.org . +.An Aleksandr Rybalko Aq Mt ray@FreeBSD.org . This manual page was written by -.An "Luiz Otavio O Souza" Aq loos@FreeBSD.org . +.An Luiz Otavio O Souza Aq Mt loos@FreeBSD.org . diff --git a/share/man/man4/geom_uzip.4 b/share/man/man4/geom_uzip.4 index 8d27673614b..3344f8fe7ae 100644 --- a/share/man/man4/geom_uzip.4 +++ b/share/man/man4/geom_uzip.4 @@ -100,6 +100,6 @@ Consumers: The .Nm driver was written by -.An "Max Khon" Aq fjoe@FreeBSD.org . +.An Max Khon Aq Mt fjoe@FreeBSD.org . This manual page was written by -.An "Ceri Davies" Aq ceri@FreeBSD.org . +.An Ceri Davies Aq Mt ceri@FreeBSD.org . diff --git a/share/man/man4/gpio.4 b/share/man/man4/gpio.4 index 119f9384c2c..0e2c8cdb142 100644 --- a/share/man/man4/gpio.4 +++ b/share/man/man4/gpio.4 @@ -142,4 +142,4 @@ manual page first appeared in .Sh AUTHORS This manual page was written by -.An Sean Bruno Aq sbruno@FreeBSD.org . +.An Sean Bruno Aq Mt sbruno@FreeBSD.org . diff --git a/share/man/man4/gpioiic.4 b/share/man/man4/gpioiic.4 index 20750969852..2a9c8efee54 100644 --- a/share/man/man4/gpioiic.4 +++ b/share/man/man4/gpioiic.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 13, 2014 +.Dd May 14, 2014 .Dt GPIOIIC 4 .Os .Sh NAME @@ -164,7 +164,7 @@ Optional, defaults to 1. The .Nm manual page first appeared in -.Fx 11.0 . +.Fx 10.1 . .Sh AUTHORS This manual page was written by diff --git a/share/man/man4/gpioled.4 b/share/man/man4/gpioled.4 index 4f428f6adb2..6d1b41ec396 100644 --- a/share/man/man4/gpioled.4 +++ b/share/man/man4/gpioled.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 13, 2014 +.Dd May 14, 2014 .Dt GPIOLED 4 .Os .Sh NAME @@ -149,7 +149,7 @@ to create for The .Nm manual page first appeared in -.Fx 11.0 . +.Fx 10.1 . .Sh AUTHORS This manual page was written by diff --git a/share/man/man4/gre.4 b/share/man/man4/gre.4 index a9267c97c40..72bb5104d06 100644 --- a/share/man/man4/gre.4 +++ b/share/man/man4/gre.4 @@ -306,7 +306,7 @@ A description of GRE encapsulation can be found in RFC 1701 and RFC 1702. .Pp A description of MOBILE encapsulation can be found in RFC 2004. .Sh AUTHORS -.An Heiko W.Rupp Aq hwr@pilhuhn.de +.An Heiko W.Rupp Aq Mt hwr@pilhuhn.de .Sh BUGS The .Fn compute_route diff --git a/share/man/man4/h_ertt.4 b/share/man/man4/h_ertt.4 index 3dbedab451a..84b68a6d44d 100644 --- a/share/man/man4/h_ertt.4 +++ b/share/man/man4/h_ertt.4 @@ -135,7 +135,7 @@ http://caia.swin.edu.au/urp/newtcp/ The .Nm Khelp module and this manual page were written by -.An David Hayes Aq david.hayes@ieee.org . +.An David Hayes Aq Mt david.hayes@ieee.org . .Sh BUGS The module maintains enhanced RTT estimates for all new TCP connections created after the time at which the module was loaded. diff --git a/share/man/man4/hatm.4 b/share/man/man4/hatm.4 index 59de800438e..e6e1714ea3f 100644 --- a/share/man/man4/hatm.4 +++ b/share/man/man4/hatm.4 @@ -264,7 +264,7 @@ hatm0: ForeRunnerHE 622, Rev. D, S/N 2949834, MAC=00:20:48:2d:02:ca .Xr ifconfig 8 , .Xr route 8 .Sh AUTHORS -.An Harti Brandt Aq harti@FreeBSD.org +.An Harti Brandt Aq Mt harti@FreeBSD.org .Sh CAVEATS When putting a HE155 into a 64-bit 66MHz PCI slot the machine may hang. This occurs very early in the POST so that even the display does not turn on. diff --git a/share/man/man4/hme.4 b/share/man/man4/hme.4 index 2bdc72a6af4..f75ee452be1 100644 --- a/share/man/man4/hme.4 +++ b/share/man/man4/hme.4 @@ -147,5 +147,4 @@ version to include it was The .Nm driver was written by -.An Paul Kranenburg -.Aq pk@NetBSD.org . +.An Paul Kranenburg Aq Mt pk@NetBSD.org . diff --git a/share/man/man4/hpt27xx.4 b/share/man/man4/hpt27xx.4 index 01f9ba56364..4ad5eaf1cff 100644 --- a/share/man/man4/hpt27xx.4 +++ b/share/man/man4/hpt27xx.4 @@ -97,5 +97,5 @@ The device driver was written by .An HighPoint Technologies, Inc. . This manual page was written by -.An Xin LI Aq delphij@FreeBSD.org +.An Xin LI Aq Mt delphij@FreeBSD.org for iXsystems, Inc. diff --git a/share/man/man4/hptnr.4 b/share/man/man4/hptnr.4 index e441b3ada2d..47b69187489 100644 --- a/share/man/man4/hptnr.4 +++ b/share/man/man4/hptnr.4 @@ -88,5 +88,5 @@ The device driver was written by .An HighPoint Technologies, Inc. . This manual page was written by -.An Xin LI Aq delphij@FreeBSD.org +.An Xin LI Aq Mt delphij@FreeBSD.org for iXsystems, Inc. diff --git a/share/man/man4/hv_ata_pci_disengage.4 b/share/man/man4/hv_ata_pci_disengage.4 index b8699f7b0b1..2123e8b7655 100644 --- a/share/man/man4/hv_ata_pci_disengage.4 +++ b/share/man/man4/hv_ata_pci_disengage.4 @@ -87,4 +87,4 @@ Microsoft Corporation, and Network Appliance Incorporated. support for .Nm was first added by -.An Microsoft BSD Integration Services Team Aq bsdic@microsoft.com . +.An Microsoft BSD Integration Services Team Aq Mt bsdic@microsoft.com . diff --git a/share/man/man4/hv_kvp.4 b/share/man/man4/hv_kvp.4 index afd3e321f16..269eef728d7 100644 --- a/share/man/man4/hv_kvp.4 +++ b/share/man/man4/hv_kvp.4 @@ -93,4 +93,4 @@ Incorporated, Microsoft Corporation and Network Appliance Incorporated. support for .Nm was first added by -.An Microsoft BSD Integration Services Team Aq bsdic@microsoft.com . +.An Microsoft BSD Integration Services Team Aq Mt bsdic@microsoft.com . diff --git a/share/man/man4/hv_netvsc.4 b/share/man/man4/hv_netvsc.4 index ed04e9d4506..31325bb9e73 100644 --- a/share/man/man4/hv_netvsc.4 +++ b/share/man/man4/hv_netvsc.4 @@ -80,4 +80,4 @@ Microsoft Corporation, and Network Appliance Incorporated. support for .Nm was first added by -.An Microsoft BSD Integration Services Team Aq bsdic@microsoft.com . +.An Microsoft BSD Integration Services Team Aq Mt bsdic@microsoft.com . diff --git a/share/man/man4/hv_storvsc.4 b/share/man/man4/hv_storvsc.4 index 57b6127924e..54805f101aa 100644 --- a/share/man/man4/hv_storvsc.4 +++ b/share/man/man4/hv_storvsc.4 @@ -86,4 +86,4 @@ Microsoft Corporation, and Network Appliance Incorporated. support for .Nm was first added by -.An Microsoft BSD Integration Services Team Aq bsdic@microsoft.com . +.An Microsoft BSD Integration Services Team Aq Mt bsdic@microsoft.com . diff --git a/share/man/man4/hv_utils.4 b/share/man/man4/hv_utils.4 index 844e5993353..82439eaa674 100644 --- a/share/man/man4/hv_utils.4 +++ b/share/man/man4/hv_utils.4 @@ -82,4 +82,4 @@ Microsoft Corporation, and Network Appliance Incorporated. support for .Nm was first added by -.An Microsoft BSD Integration Services Team Aq bsdic@microsoft.com . +.An Microsoft BSD Integration Services Team Aq Mt bsdic@microsoft.com . diff --git a/share/man/man4/hv_vmbus.4 b/share/man/man4/hv_vmbus.4 index 873cb28e2dd..daafd5d505f 100644 --- a/share/man/man4/hv_vmbus.4 +++ b/share/man/man4/hv_vmbus.4 @@ -90,4 +90,4 @@ Microsoft Corporation, and Network Appliance Incorporated. support for .Nm was first added by -.An Microsoft BSD Integration Services Team Aq bsdic@microsoft.com . +.An Microsoft BSD Integration Services Team Aq Mt bsdic@microsoft.com . diff --git a/share/man/man4/hwpmc.4 b/share/man/man4/hwpmc.4 index b0c393049cc..5777cdd4264 100644 --- a/share/man/man4/hwpmc.4 +++ b/share/man/man4/hwpmc.4 @@ -780,8 +780,7 @@ driver first appeared in The .Nm driver was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . .Sh BUGS The driver samples the state of the kernel's logical processor support at the time of initialization (i.e., at module load time). diff --git a/share/man/man4/ichsmb.4 b/share/man/man4/ichsmb.4 index a415941b600..5fded279dbf 100644 --- a/share/man/man4/ichsmb.4 +++ b/share/man/man4/ichsmb.4 @@ -54,4 +54,4 @@ device contained in the Intel 82801AA (ICH), 82801AB (ICH0), .Xr smb 4 , .Xr smbus 4 .Sh AUTHORS -.An Archie L. Cobbs Aq archie@FreeBSD.org +.An Archie L. Cobbs Aq Mt archie@FreeBSD.org diff --git a/share/man/man4/ichwd.4 b/share/man/man4/ichwd.4 index 25b6dbb52e7..35a5f7f1a6e 100644 --- a/share/man/man4/ichwd.4 +++ b/share/man/man4/ichwd.4 @@ -83,8 +83,8 @@ driver first appeared in The .Nm driver was written by -.An Wm. Daryl Hawkins Aq dhawkins@tamu.edu +.An Wm. Daryl Hawkins Aq Mt dhawkins@tamu.edu of Texas A&M University and -.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . +.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org . This manual page was written by -.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . +.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org . diff --git a/share/man/man4/ida.4 b/share/man/man4/ida.4 index 01e0267cd24..52f4bf21bde 100644 --- a/share/man/man4/ida.4 +++ b/share/man/man4/ida.4 @@ -77,8 +77,8 @@ Pass-through should only be used to a device that is otherwise quiescent. The .Nm driver was written by -.An Jonathan Lemon Aq jlemon@FreeBSD.org +.An Jonathan Lemon Aq Mt jlemon@FreeBSD.org and -.An Matthew N. Dodd Aq mdodd@FreeBSD.org . +.An Matthew N. Dodd Aq Mt mdodd@FreeBSD.org . This manual page was written by -.An Tom Rhodes Aq trhodes@FreeBSD.org . +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org . diff --git a/share/man/man4/igb.4 b/share/man/man4/igb.4 index 5c857c8a925..cd916b01732 100644 --- a/share/man/man4/igb.4 +++ b/share/man/man4/igb.4 @@ -205,7 +205,7 @@ go to the Intel support website at: If an issue is identified with the released source code on the supported kernel with a supported adapter, email the specific information related to the issue to -.Aq freebsd@intel.com . +.Aq Mt freebsd@intel.com . .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , @@ -225,4 +225,4 @@ device driver first appeared in The .Nm driver was written by -.An Intel Corporation Aq freebsd@intel.com . +.An Intel Corporation Aq Mt freebsd@intel.com . diff --git a/share/man/man4/iic.4 b/share/man/man4/iic.4 index 9f410a3f5a9..d82f5745cc3 100644 --- a/share/man/man4/iic.4 +++ b/share/man/man4/iic.4 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 6, 2006 +.Dd June 24, 2014 .Dt IIC 4 .Os .Sh NAME @@ -51,12 +51,20 @@ following ioctls: Sends the start condition to the slave specified by the .Va slave element to the bus. +The +.Va slave +element consists of a 7-bit address and a read/write bit +(i.e., 7-bit address << 1 | r/w). +If the read/write bit is set a read operation is initiated, if the read/write +bit is cleared a write operation is initiated. All other elements are ignored. .It Dv I2CRPTSTART .Pq Vt "struct iiccmd" Sends the repeated start condition to the slave specified by the .Va slave element to the bus. +The slave address should be specified as in +.Dv I2CSTART . All other elements are ignored. .It Dv I2CSTOP No argument is passed. @@ -115,10 +123,15 @@ is set in Otherwise the transfer is a write transfer. The .Va slave -element specifies the 7-bit address for the transfer. +element specifies the 7-bit address with the read/write bit for the transfer. +The read/write bit will be handled by the iicbus stack based on the specified +transfer operation. The .Va len -element is the length of the data. +element is the number of +.Pq Vt "struct iic_msg" +messages encoded on +.Pq Vt "struct iic_rdwr_data" . The .Va buf element is a buffer for that data. diff --git a/share/man/man4/iicbus.4 b/share/man/man4/iicbus.4 index f9e5c58d467..4bbc846a529 100644 --- a/share/man/man4/iicbus.4 +++ b/share/man/man4/iicbus.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 6, 1998 +.Dd June 24, 2014 .Dt IICBUS 4 .Os .Sh NAME @@ -104,6 +104,8 @@ Some I2C interfaces are available: .It Sy bktr Ta "Brooktree848 video chipset, hardware and software master-only interface" .El .Sh SEE ALSO +.Xr bktr 4 , +.Xr iic 4 , .Xr iicbb 4 , .Xr lpbb 4 , .Xr pcf 4 diff --git a/share/man/man4/iir.4 b/share/man/man4/iir.4 index a7608b2ece7..d9e4309771c 100644 --- a/share/man/man4/iir.4 +++ b/share/man/man4/iir.4 @@ -69,9 +69,9 @@ The .Nm driver is supported and maintained by .An -nosplit -.An Achim Leubner Aq Achim_Leubner@adaptec.com . +.An Achim Leubner Aq Mt Achim_Leubner@adaptec.com . .Pp This manual page was written by -.An Tom Rhodes Aq trhodes@FreeBSD.org +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org and is based on information supplied by the driver authors and the website of -.An Mike Smith Aq msmith@FreeBSD.org . +.An Mike Smith Aq Mt msmith@FreeBSD.org . diff --git a/share/man/man4/inet.4 b/share/man/man4/inet.4 index 238cdbdb4ad..0b7a108db52 100644 --- a/share/man/man4/inet.4 +++ b/share/man/man4/inet.4 @@ -56,10 +56,9 @@ protocol. Internet addresses are four byte quantities, stored in network standard format (on little endian machines, such as the .Tn alpha , -.Tn amd64 , -.Tn i386 +.Tn amd64 and -.Tn ia64 +.Tn i386 these are word and byte reversed). The include file .In netinet/in.h diff --git a/share/man/man4/intpm.4 b/share/man/man4/intpm.4 index 5e015a8f371..c9cf47e1962 100644 --- a/share/man/man4/intpm.4 +++ b/share/man/man4/intpm.4 @@ -54,7 +54,7 @@ driver first appeared in .Sh AUTHORS This manual page was written by -.An Takanori Watanabe Aq takawata@shidahara1.planet.sci.kobe-u.ac.jp . +.An Takanori Watanabe Aq Mt takawata@shidahara1.planet.sci.kobe-u.ac.jp . .Sh BUGS This device requires IRQ 9 exclusively. To use this, you should enable diff --git a/share/man/man4/ipmi.4 b/share/man/man4/ipmi.4 index 25dc341aed1..9516d31ddb6 100644 --- a/share/man/man4/ipmi.4 +++ b/share/man/man4/ipmi.4 @@ -192,9 +192,9 @@ driver first appeared in The .Nm driver was written by -.An Doug Ambrisko Aq ambrisko@FreeBSD.org . +.An Doug Ambrisko Aq Mt ambrisko@FreeBSD.org . This manual page was written by -.An Tom Rhodes Aq trhodes@FreeBSD.org . +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org . .Sh BUGS Not all features of the MontaVista driver are supported. .Pp diff --git a/share/man/man4/ips.4 b/share/man/man4/ips.4 index 0a38d5b4471..b22b91ca5f4 100644 --- a/share/man/man4/ips.4 +++ b/share/man/man4/ips.4 @@ -198,7 +198,7 @@ driver was written by .An -nosplit .An David Jefferys and -.An Scott Long Aq scottl@FreeBSD.org . +.An Scott Long Aq Mt scottl@FreeBSD.org . .Pp This manual page was written by -.An Tom Rhodes Aq trhodes@FreeBSD.org . +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org . diff --git a/share/man/man4/ipw.4 b/share/man/man4/ipw.4 index 9becdfa3a51..9dfbd6dce52 100644 --- a/share/man/man4/ipw.4 +++ b/share/man/man4/ipw.4 @@ -152,4 +152,4 @@ This should not happen. The original .Nm driver was written by -.An Damien Bergamini Aq damien.bergamini@free.fr . +.An Damien Bergamini Aq Mt damien.bergamini@free.fr . diff --git a/share/man/man4/isci.4 b/share/man/man4/isci.4 index 1d9353d1ea2..06e249b6dfc 100644 --- a/share/man/man4/isci.4 +++ b/share/man/man4/isci.4 @@ -105,9 +105,11 @@ and 9.1. The .Nm driver was developed by Intel and originally written by -.An Jim Harris Aq jimharris@FreeBSD.org -with contributions from Sohaib Ahsan and input from -.An Scott Long Aq scottl@FreeBSD.org . +.An Jim Harris Aq Mt jimharris@FreeBSD.org +with contributions from +.An Sohaib Ahsan +and input from +.An Scott Long Aq Mt scottl@FreeBSD.org . .Pp This man page was written by -.An Jim Harris Aq jimharris@FreeBSD.org . +.An Jim Harris Aq Mt jimharris@FreeBSD.org . diff --git a/share/man/man4/ismt.4 b/share/man/man4/ismt.4 new file mode 100644 index 00000000000..63a39527880 --- /dev/null +++ b/share/man/man4/ismt.4 @@ -0,0 +1,59 @@ +.\" +.\" Copyright (c) 2014 Intel Corporation +.\" 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, +.\" without modification. +.\" 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 Intel Corporation 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 COPYRIGHT HOLDERS AND CONTRIBUTORS +.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR +.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +.\" HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. +.\" +.\" ismt driver man page. +.\" +.\" Author: Jim Harris +.\" +.\" $FreeBSD$ +.\" +.Dd May 9, 2014 +.Dt ISMT 4 +.Os +.Sh NAME +.Nm ismt +.Nd Intel SMBus Message Transport (SMBus 2.0) driver +.Sh SYNOPSIS +.Cd device pci +.Cd device smbus +.Cd device smb +.Cd device ismt +.Sh DESCRIPTION +This driver provides access to the SMBus 2.0 controller device contained +in the Intel Atom S1200 and C2000 CPUs. +.Sh SEE ALSO +.Xr smb 4 , +.Xr smbus 4 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 11.0 . +.Sh AUTHORS +.An Jim Harris Aq Mt jimharris@FreeBSD.org diff --git a/share/man/man4/iwi.4 b/share/man/man4/iwi.4 index 97ff634f4c7..683f49655eb 100644 --- a/share/man/man4/iwi.4 +++ b/share/man/man4/iwi.4 @@ -157,4 +157,4 @@ This should not happen. The original .Nm driver was written by -.An Damien Bergamini Aq damien.bergamini@free.fr +.An Damien Bergamini Aq Mt damien.bergamini@free.fr . diff --git a/share/man/man4/iwn.4 b/share/man/man4/iwn.4 index 611482040e7..0a824e7c847 100644 --- a/share/man/man4/iwn.4 +++ b/share/man/man4/iwn.4 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 9, 2014 +.Dd May 28, 2014 .Dt IWN 4 .Os .Sh NAME @@ -92,6 +92,7 @@ driver provides support for: .It Intel Centrino Advanced-N + WiMAX 6250 .It Intel Centrino Ultimate-N 6300 .It Intel Centrino Wireless-N 100 +.It Intel Centrino Wireless-N 105 .It Intel Centrino Wireless-N 130 .It Intel Centrino Wireless-N 1000 .It Intel Centrino Wireless-N 1030 @@ -191,4 +192,4 @@ This should not happen. The original .Nm driver was written by -.An Damien Bergamini Aq damien.bergamini@free.fr . +.An Damien Bergamini Aq Mt damien.bergamini@free.fr . diff --git a/share/man/man4/ixgb.4 b/share/man/man4/ixgb.4 index 59d164825c4..b1e9af34698 100644 --- a/share/man/man4/ixgb.4 +++ b/share/man/man4/ixgb.4 @@ -102,7 +102,7 @@ go to the Intel support website at: If an issue is identified with the released source code on the supported kernel with a supported adapter, email the specific information related to the issue to -.Aq freebsd@intel.com . +.Aq Mt freebsd@intel.com . .Sh SEE ALSO .Xr arp 4 , .Xr em 4 , @@ -122,4 +122,4 @@ and The .Nm driver was written by -.An Intel Corporation Aq freebsd@intel.com . +.An Intel Corporation Aq Mt freebsd@intel.com . diff --git a/share/man/man4/ixgbe.4 b/share/man/man4/ixgbe.4 index be056d3b97a..99c1cc7f8e2 100644 --- a/share/man/man4/ixgbe.4 +++ b/share/man/man4/ixgbe.4 @@ -105,7 +105,7 @@ go to the Intel support website at: If an issue is identified with the released source code on the supported kernel with a supported adapter, email the specific information related to the issue to -.Aq freebsd@intel.com . +.Aq Mt freebsd@intel.com . .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , @@ -123,4 +123,4 @@ device driver first appeared in The .Nm driver was written by -.An Intel Corporation Aq freebsd@intel.com . +.An Intel Corporation Aq Mt freebsd@intel.com . diff --git a/share/man/man4/jme.4 b/share/man/man4/jme.4 index e17a797b63e..513c253e15f 100644 --- a/share/man/man4/jme.4 +++ b/share/man/man4/jme.4 @@ -165,8 +165,7 @@ a change takes effect. The .Nm driver was written by -.An Pyun YongHyeon -.Aq yongari@FreeBSD.org . +.An Pyun YongHyeon Aq Mt yongari@FreeBSD.org . It first appeared in .Fx 7.1 . .Sh CAVEATS diff --git a/share/man/man4/joy.4 b/share/man/man4/joy.4 index 4de2f5a6ee4..566dc73fe11 100644 --- a/share/man/man4/joy.4 +++ b/share/man/man4/joy.4 @@ -116,4 +116,4 @@ The driver appeared in .Fx 2.0.5 . .Sh AUTHORS -.An Jean-Marc Zucconi Aq jmz@cabri.obs-besancon.fr +.An Jean-Marc Zucconi Aq Mt jmz@cabri.obs-besancon.fr diff --git a/share/man/man4/kbdmux.4 b/share/man/man4/kbdmux.4 index 72b588906a1..a909ba9e880 100644 --- a/share/man/man4/kbdmux.4 +++ b/share/man/man4/kbdmux.4 @@ -41,7 +41,7 @@ The module was implemented in .Fx 6.0 . .Sh AUTHORS -.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com +.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com .Sh CAVEATS The .Nm diff --git a/share/man/man4/keyboard.4 b/share/man/man4/keyboard.4 index 8cff2924e8f..4a71aa3828f 100644 --- a/share/man/man4/keyboard.4 +++ b/share/man/man4/keyboard.4 @@ -167,4 +167,4 @@ The .Xr kbdcontrol 1 utility also allows changing these values at runtime. .Sh AUTHORS -.An S\(/oren Schmidt Aq sos@FreeBSD.org +.An S\(/oren Schmidt Aq Mt sos@FreeBSD.org diff --git a/share/man/man4/kld.4 b/share/man/man4/kld.4 index de991c40ffd..185389a4944 100644 --- a/share/man/man4/kld.4 +++ b/share/man/man4/kld.4 @@ -146,7 +146,7 @@ facility provided by The .Nm facility was originally implemented by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . .Sh BUGS If a module B, is dependent on another module A, but is not compiled with module A as a dependency, then diff --git a/share/man/man4/ksyms.4 b/share/man/man4/ksyms.4 index 5c1dae002e2..6ce42ea6205 100644 --- a/share/man/man4/ksyms.4 +++ b/share/man/man4/ksyms.4 @@ -130,8 +130,7 @@ to support The .Nm driver was written by -.An Stacey Son -.Aq sson@FreeBSD.org . +.An Stacey Son Aq Mt sson@FreeBSD.org . .Sh BUGS Because files can be dynamically linked into the kernel at any time the symbol information can vary. When you open the diff --git a/share/man/man4/kue.4 b/share/man/man4/kue.4 index c9a8ad71090..c5353198e68 100644 --- a/share/man/man4/kue.4 +++ b/share/man/man4/kue.4 @@ -134,7 +134,7 @@ device driver first appeared in The .Nm driver was written by -.An Bill Paul Aq wpaul@ee.columbia.edu . +.An Bill Paul Aq Mt wpaul@ee.columbia.edu . .Sh BUGS The .Nm diff --git a/share/man/man4/lagg.4 b/share/man/man4/lagg.4 index bb2cfc6c016..392f5f73cdc 100644 --- a/share/man/man4/lagg.4 +++ b/share/man/man4/lagg.4 @@ -190,7 +190,7 @@ The driver was written under the name .Nm trunk by -.An Reyk Floeter Aq reyk@openbsd.org . +.An Reyk Floeter Aq Mt reyk@openbsd.org . The LACP implementation was written by .An YAMAMOTO Takashi for diff --git a/share/man/man4/le.4 b/share/man/man4/le.4 index 0a1823d3031..0316e468739 100644 --- a/share/man/man4/le.4 +++ b/share/man/man4/le.4 @@ -427,7 +427,7 @@ driver which first appeared in The .Nm driver was ported by -.An "Marius Strobl" Aq marius@FreeBSD.org . +.An Marius Strobl Aq Mt marius@FreeBSD.org . .\" .Sh BUGS .\" The Am7990 Revision C chips have a bug which causes garbage to be inserted .\" in front of the received packet occasionally. diff --git a/share/man/man4/led.4 b/share/man/man4/led.4 index b31a083c034..0fe4af0c742 100644 --- a/share/man/man4/led.4 +++ b/share/man/man4/led.4 @@ -182,12 +182,9 @@ driver first appeared in .Sh AUTHORS .An -nosplit This software was written by -.An Poul-Henning Kamp -.Aq phk@FreeBSD.org . +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . .Pp This manual page was written by -.An Sergey A. Osokin -.Aq osa@FreeBSD.org +.An Sergey A. Osokin Aq Mt osa@FreeBSD.org and -.An Poul-Henning Kamp -.Aq phk@FreeBSD.org . +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . diff --git a/share/man/man4/lge.4 b/share/man/man4/lge.4 index 89510f2c214..734eb4a8ae4 100644 --- a/share/man/man4/lge.4 +++ b/share/man/man4/lge.4 @@ -154,4 +154,4 @@ device driver first appeared in The .Nm driver was written by -.An Bill Paul Aq william.paul@windriver.com . +.An Bill Paul Aq Mt william.paul@windriver.com . diff --git a/share/man/man4/lm75.4 b/share/man/man4/lm75.4 new file mode 100644 index 00000000000..d137eb063a6 --- /dev/null +++ b/share/man/man4/lm75.4 @@ -0,0 +1,191 @@ +.\" +.\" 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 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. +.\" +.\" $FreeBSD$ +.\" +.Dd May 11, 2014 +.Dt LM75 4 +.Os +.Sh NAME +.Nm lm75 +.Nd lm75 i2c digital temperature sensor driver +.Sh SYNOPSIS +.Cd "device iic" +.Cd "device iicbus" +.Cd "device lm75" +.Sh DESCRIPTION +The +.Nm +driver provides access to sensor data and configuration over the +.Xr iicbus 4 . +.Pp +It provides an easy and simple way to check the functionality of an i2c bus +as it provides read and write access to the +.Nm +configuration register. +.Pp +The access to +.Nm +data is made via the +.Xr sysctl 8 +interface: +.Bd -literal +dev.lm75.0.%desc: LM75 temperature sensor +dev.lm75.0.%driver: lm75 +dev.lm75.0.%location: addr=0x49 +dev.lm75.0.%pnpinfo: name=lm750 compat=national,lm75 +dev.lm75.0.%parent: iicbus3 +dev.lm75.0.temperature: 27.1C +dev.lm75.0.thyst: 75.0C +dev.lm75.0.tos: 80.0C +dev.lm75.0.faults: 1 +dev.lm75.0.mode: comparator +dev.lm75.0.polarity: active-low +dev.lm75.0.shutdown: 0 +.Ed +.Bl -tag -width ".Va dev.lm75.%d.temperature" +.It Va dev.lm75.%d.temperature +Is the read-only value of the current temperature read by the sensor. +.It Va dev.lm75.%d.thyst +Sets the hysteresis temperature. +Once the temperature gets over the overtemperature shutdown value (tos) +it needs to drop below the hysteresis temperature to disable the output +(interrupt) pin again. +.It Va dev.lm75.%d.tos +Sets the overtemperature shutdown value. +Once the temperature gets over this value the output pin will be enabled. +The way the output (interrupt) pin works, depends on the mode configuration. +.It Va dev.lm75.%d.faults +Is the number of faults that must occur consecutively to activate the +interrupt (output) pin. +It can be set to 1, 2, 4, and 6. +.It Va dev.lm75.%d.mode +Sets the operation mode for the sensor interrupt pin. +It can be set to 'comparator' (default) or 'interrupt'. +.It Va dev.lm75.%d.polarity +Sets the polarity of the sensor interrupt pin. +It can be set to 'active-low' (default) or 'active-high'. +Please note that the output pin is an open-drain output and it needs a +proper pull-up resistor to work. +.It Va dev.lm75.%d.shutdown +When set to '1' it shuts down the sensor. +The temperature conversion stops but the sensor remains with its i2c bus +active, i.e., it can be woken up by setting this option to '0' again. +.El +.Pp +Please check the +.Nm +datasheet for more details. +.Pp +When used together with +.Xr snmp_lm75 3 +it allows the monitoring of +.Nm +temperature data over SNMP. +.Pp +The +.Nm +driver supports both the low and the high resolution models. +.Pp +The low resolution model (lm75) provides a 9 bit output with the LSB +representing 0.5C. +.Pp +The high resolution model (lm75a) provides an 11 bit output with the LSB +representing 0.125C. +.Pp +The driver tries to auto-detect the +.Nm +model, but the detection of some +.Nm +clones may not work reliably. +.Pp +On a +.Xr device.hints 5 +based system, like +.Li MIPS , +these values are configurable for +.Nm : +.Bl -tag -width ".Va hint.lm75.%d.addr" +.It Va hint.lm75.%d.at +Is the +.Xr iicbus 4 +you are attaching to. +.It Va hint.lm75.%d.addr +Is the +.Nm +i2c address on the +.Xr iicbus 4 . +.El +.Pp +On a +.Xr FDT 4 +based system, like +.Li ARM , +the DTS part for a +.Nm +device usually looks like: +.Bd -literal +i2c { + + ... + + lm750 { + compatible = "national,lm75"; + i2c-address = <0x49>; + }; +}; +.Ed +.Pp +Where: +.Bl -tag -width ".Va i2c-address" +.It Va compatible +Should always be set to "national,lm75". +.It Va i2c-address +The +.Va i2c-address +property indicates which i2c address the +.Nm +is wired at. +.Nm +temperature sensors can be wired to 8 different addresses, allowing up to 8 +sensors on the same +.Xr iicbus 4 . +.El +.Sh SEE ALSO +.Xr snmp_lm75 3 , +.Xr fdt 4 , +.Xr iic 4 , +.Xr iicbus 4 , +.Xr sysctl 8 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 11.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver and this manual page were written by +.An Luiz Otavio O Souza Aq Mt loos@FreeBSD.org . diff --git a/share/man/man4/lmc.4 b/share/man/man4/lmc.4 index ee29aeeef9f..e07875acea0 100644 --- a/share/man/man4/lmc.4 +++ b/share/man/man4/lmc.4 @@ -761,4 +761,4 @@ rewrote everything and now feels responsible for it. .\" .Sh AUTHORS .\" -.An "David Boggs" Aq boggs@boggs.palo-alto.ca.us +.An David Boggs Aq Mt boggs@boggs.palo-alto.ca.us diff --git a/share/man/man4/mac_bsdextended.4 b/share/man/man4/mac_bsdextended.4 index 23b89c04d04..ca0296226e8 100644 --- a/share/man/man4/mac_bsdextended.4 +++ b/share/man/man4/mac_bsdextended.4 @@ -139,7 +139,7 @@ and was developed by the Project. .Pp The "match first case" and logging capabilities were later added by -.An Tom Rhodes Aq trhodes@FreeBSD.org . +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org . .Sh AUTHORS This software was contributed to the .Fx diff --git a/share/man/man4/man4.arm/ti_adc.4 b/share/man/man4/man4.arm/ti_adc.4 index b10760a4c06..7c70c27383d 100644 --- a/share/man/man4/man4.arm/ti_adc.4 +++ b/share/man/man4/man4.arm/ti_adc.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 21, 2014 +.Dd June 1, 2014 .Dt TI_ADC 4 .Os .Sh NAME @@ -78,8 +78,17 @@ dev.ti_adc.0.ain.6.enable: 1 dev.ti_adc.0.ain.6.open_delay: 0 dev.ti_adc.0.ain.6.samples_avg: 4 dev.ti_adc.0.ain.6.input: 2308 +dev.ti_adc.0.ain.7.enable: 1 +dev.ti_adc.0.ain.7.open_delay: 0 +dev.ti_adc.0.ain.7.samples_avg: 0 +dev.ti_adc.0.ain.7.input: 3812 .Ed .Pp +On Beaglebone-black the analog input 7 is connected to the 3V3B rail through +a voltage divisor (2:1). +The 3V3B voltage rail comes from the TL5209 LDO regulator which is limited +to 500mA maximum. +.Pp Global settings: .Bl -tag -width ".Va dev.ti_adc.0.clockdiv" .It Va dev.ti_adc.0.clockdiv @@ -112,8 +121,8 @@ It is made of a 12 bit value (0 ~ 4095). The .Nm driver first appeared in -.Fx 11.0 . +.Fx 10.1 . .Sh AUTHORS .An -nosplit The driver and this manual page was written by -.An Luiz Otavio O Souza Aq loos@FreeBSD.org +.An Luiz Otavio O Souza Aq Mt loos@FreeBSD.org . diff --git a/share/man/man4/man4.i386/CPU_ELAN.4 b/share/man/man4/man4.i386/CPU_ELAN.4 index 4a0611f23f2..5405743ef32 100644 --- a/share/man/man4/man4.i386/CPU_ELAN.4 +++ b/share/man/man4/man4.i386/CPU_ELAN.4 @@ -156,4 +156,4 @@ The code first appeared in .Fx 4.7 . .Sh AUTHORS -.An "Poul-Henning Kamp" Aq phk@FreeBSD.org +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org diff --git a/share/man/man4/man4.i386/ct.4 b/share/man/man4/man4.i386/ct.4 index ac8d6c2ae1e..28208a16893 100644 --- a/share/man/man4/man4.i386/ct.4 +++ b/share/man/man4/man4.i386/ct.4 @@ -150,13 +150,13 @@ and ported for It first appeared in .Fx 4.4 . .Sh AUTHORS +.An -nosplit The .Nm driver was written by .An Naofumi HONDA . .Pp This manual page was written by -.An -nosplit -.An Noriaki MITSUNAGA Aq non@FreeBSD.org +.An Noriaki MITSUNAGA Aq Mt non@FreeBSD.org and -.An Hideyuki KURASHINA Aq rushani@FreeBSD.org . +.An Hideyuki KURASHINA Aq Mt rushani@FreeBSD.org . diff --git a/share/man/man4/man4.i386/fe.4 b/share/man/man4/man4.i386/fe.4 index 22bbf2a6a64..b313edb52bc 100644 --- a/share/man/man4/man4.i386/fe.4 +++ b/share/man/man4/man4.i386/fe.4 @@ -259,7 +259,7 @@ driver appeared in The .Nm driver was originally written and contributed by -.An M. Sekiguchi Aq seki@sysrap.cs.fujitsu.co.jp , +.An M. Sekiguchi Aq Mt seki@sysrap.cs.fujitsu.co.jp , following the .Nm ed driver written by @@ -267,7 +267,7 @@ driver written by PC card support in .Nm is written by -.An Hidetoshi Kimura Aq h-kimura@tokyo.se.fujitsu.co.jp . +.An Hidetoshi Kimura Aq Mt h-kimura@tokyo.se.fujitsu.co.jp . This manual page was written by .An M. Sekiguchi . .Pp diff --git a/share/man/man4/man4.i386/glxiic.4 b/share/man/man4/man4.i386/glxiic.4 index 30d3ffe98de..2f259d1f009 100644 --- a/share/man/man4/man4.i386/glxiic.4 +++ b/share/man/man4/man4.i386/glxiic.4 @@ -103,4 +103,4 @@ device driver and manual page first appeared in The .Nm device driver and manual page were written by -.An Henrik Brix Andersen Aq brix@FreeBSD.org . +.An Henrik Brix Andersen Aq Mt brix@FreeBSD.org . diff --git a/share/man/man4/man4.i386/glxsb.4 b/share/man/man4/man4.i386/glxsb.4 index fb2669f1047..a77b475e1dd 100644 --- a/share/man/man4/man4.i386/glxsb.4 +++ b/share/man/man4/man4.i386/glxsb.4 @@ -94,4 +94,4 @@ by It was ported to .Fx by -.An Patrick Lamaiziere Aq patfbsd@davenulle.org . +.An Patrick Lamaiziere Aq Mt patfbsd@davenulle.org . diff --git a/share/man/man4/man4.i386/longrun.4 b/share/man/man4/man4.i386/longrun.4 index b9bfc66c5e2..865bb8d35bc 100644 --- a/share/man/man4/man4.i386/longrun.4 +++ b/share/man/man4/man4.i386/longrun.4 @@ -62,6 +62,6 @@ The Transmeta(TM) Crusoe(TM) LongRun(TM) support first appeared in .Sh AUTHORS .An -nosplit LongRun support and this manual page were written by -.An Tamotsu HATTORI Aq athlete@kta.att.ne.jp +.An Tamotsu HATTORI Aq Mt athlete@kta.att.ne.jp and -.An Mitsuru IWASAKI Aq iwasaki@FreeBSD.org . +.An Mitsuru IWASAKI Aq Mt iwasaki@FreeBSD.org . diff --git a/share/man/man4/man4.i386/pae.4 b/share/man/man4/man4.i386/pae.4 index 718e2b2e20c..55c2aa62cce 100644 --- a/share/man/man4/man4.i386/pae.4 +++ b/share/man/man4/man4.i386/pae.4 @@ -69,7 +69,7 @@ option first appeared in and .Fx 5.1 . .Sh AUTHORS -.An Jake Burkholder Aq jake@FreeBSD.org +.An Jake Burkholder Aq Mt jake@FreeBSD.org .Sh BUGS Since KLD modules are not compiled with the same options headers that the kernel is compiled with, diff --git a/share/man/man4/man4.i386/pbio.4 b/share/man/man4/man4.i386/pbio.4 index f4fbf3b4652..d04eb325d16 100644 --- a/share/man/man4/man4.i386/pbio.4 +++ b/share/man/man4/man4.i386/pbio.4 @@ -179,7 +179,7 @@ The device was first used under .Fx 4.1 . .Sh AUTHORS -.An "Diomidis D. Spinellis" Aq dds@aueb.gr +.An Diomidis D. Spinellis Aq Mt dds@aueb.gr .Sh BUGS One of the .Tn PCL-724 diff --git a/share/man/man4/man4.i386/smapi.4 b/share/man/man4/man4.i386/smapi.4 index 8af17fa0a82..116c40197ca 100644 --- a/share/man/man4/man4.i386/smapi.4 +++ b/share/man/man4/man4.i386/smapi.4 @@ -146,8 +146,8 @@ Finally a length field which is comprised of Byte, Word, or Double Word. The .Nm driver was written by -.An Matthew N. Dodd Aq mdodd@FreeBSD.org . +.An Matthew N. Dodd Aq Mt mdodd@FreeBSD.org . This manual page was written by -.An Tom Rhodes Aq trhodes@FreeBSD.org +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org and -.An Matthew N. Dodd Aq mdodd@FreeBSD.org . +.An Matthew N. Dodd Aq Mt mdodd@FreeBSD.org . diff --git a/share/man/man4/man4.i386/snc.4 b/share/man/man4/man4.i386/snc.4 index 66b45247822..6f826907352 100644 --- a/share/man/man4/man4.i386/snc.4 +++ b/share/man/man4/man4.i386/snc.4 @@ -122,16 +122,16 @@ driver was ported from .Nx by .An -nosplit -.An Motomichi Matsuzaki Aq mzaki@e-mail.ne.jp +.An Motomichi Matsuzaki Aq Mt mzaki@e-mail.ne.jp and -.An Hiroshi Yamashita Aq bluemoon@msj.biglobe.ne.jp . +.An Hiroshi Yamashita Aq Mt bluemoon@msj.biglobe.ne.jp . It first appeared in .Fx 4.2 . This manual page first appeared in .Fx 5.3 . .Sh AUTHORS This manual page was written by -.An Tom Rhodes Aq trhodes@FreeBSD.org . +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org . .Sh BUGS Currently the .Nm diff --git a/share/man/man4/man4.i386/vpd.4 b/share/man/man4/man4.i386/vpd.4 index 7ed2063a6fa..ba7acd4aea2 100644 --- a/share/man/man4/man4.i386/vpd.4 +++ b/share/man/man4/man4.i386/vpd.4 @@ -87,4 +87,4 @@ driver first appeared in The .Nm driver and this manual page were written by -.An Matthew N. Dodd Aq mdodd@FreeBSD.org . +.An Matthew N. Dodd Aq Mt mdodd@FreeBSD.org . diff --git a/share/man/man4/man4.i386/vx.4 b/share/man/man4/man4.i386/vx.4 index ab0472b6868..e3c1ae47026 100644 --- a/share/man/man4/man4.i386/vx.4 +++ b/share/man/man4/man4.i386/vx.4 @@ -114,7 +114,7 @@ driver, from which it inherits most of its limitations. The .Nm device driver and this manual page were written by -.An Fred Gray Aq fgray@rice.edu , +.An Fred Gray Aq Mt fgray@rice.edu , based on the work of .An Herb Peyerl and with the assistance of numerous others. diff --git a/share/man/man4/man4.powerpc/adb.4 b/share/man/man4/man4.powerpc/adb.4 index eb34ecaf0c4..05a17a49b24 100644 --- a/share/man/man4/man4.powerpc/adb.4 +++ b/share/man/man4/man4.powerpc/adb.4 @@ -66,5 +66,4 @@ device driver appeared in The .Nm driver was written by -.An Nathan Whitehorn -.Aq nwhitehorn@FreeBSD.org . +.An Nathan Whitehorn Aq Mt nwhitehorn@FreeBSD.org . diff --git a/share/man/man4/man4.powerpc/akbd.4 b/share/man/man4/man4.powerpc/akbd.4 index e56676a76a2..2ecaaefd102 100644 --- a/share/man/man4/man4.powerpc/akbd.4 +++ b/share/man/man4/man4.powerpc/akbd.4 @@ -101,5 +101,4 @@ device driver appeared in The .Nm driver was written by -.An Nathan Whitehorn -.Aq nwhitehorn@FreeBSD.org . +.An Nathan Whitehorn Aq Mt nwhitehorn@FreeBSD.org . diff --git a/share/man/man4/man4.powerpc/ams.4 b/share/man/man4/man4.powerpc/ams.4 index 15560cf3d9e..00ce975bac8 100644 --- a/share/man/man4/man4.powerpc/ams.4 +++ b/share/man/man4/man4.powerpc/ams.4 @@ -83,5 +83,4 @@ device driver appeared in The .Nm driver was written by -.An Nathan Whitehorn -.Aq nwhitehorn@FreeBSD.org . +.An Nathan Whitehorn Aq Mt nwhitehorn@FreeBSD.org . diff --git a/share/man/man4/man4.powerpc/bm.4 b/share/man/man4/man4.powerpc/bm.4 index 9d6a0297014..850d3070abe 100644 --- a/share/man/man4/man4.powerpc/bm.4 +++ b/share/man/man4/man4.powerpc/bm.4 @@ -80,8 +80,6 @@ device driver appeared in The .Nm driver was written by -.An Nathan Whitehorn -.Aq nwhitehorn@FreeBSD.org +.An Nathan Whitehorn Aq Mt nwhitehorn@FreeBSD.org based on work by -.An Peter Grehan -.Aq grehan@FreeBSD.org . +.An Peter Grehan Aq Mt grehan@FreeBSD.org . diff --git a/share/man/man4/man4.powerpc/cuda.4 b/share/man/man4/man4.powerpc/cuda.4 index f1faaf2d291..021b6a18d94 100644 --- a/share/man/man4/man4.powerpc/cuda.4 +++ b/share/man/man4/man4.powerpc/cuda.4 @@ -72,8 +72,8 @@ and then in The .Nm driver was written by -.An Michael Lorenz -.Aq macallan@NetBSD.org -and ported to FreeBSD by -.An Nathan Whitehorn -.Aq nwhitehorn@FreeBSD.org . +.An Michael Lorenz Aq Mt macallan@NetBSD.org +and ported to +.Fx +by +.An Nathan Whitehorn Aq Mt nwhitehorn@FreeBSD.org . diff --git a/share/man/man4/man4.powerpc/pmu.4 b/share/man/man4/man4.powerpc/pmu.4 index ab998772a6f..30b2762fac0 100644 --- a/share/man/man4/man4.powerpc/pmu.4 +++ b/share/man/man4/man4.powerpc/pmu.4 @@ -109,8 +109,8 @@ and then in The .Nm driver was written by -.An Michael Lorenz -.Aq macallan@NetBSD.org -and ported to FreeBSD by -.An Nathan Whitehorn -.Aq nwhitehorn@FreeBSD.org . +.An Michael Lorenz Aq Mt macallan@NetBSD.org +and ported to +.Fx +by +.An Nathan Whitehorn Aq Mt nwhitehorn@FreeBSD.org . diff --git a/share/man/man4/man4.powerpc/powermac_nvram.4 b/share/man/man4/man4.powerpc/powermac_nvram.4 index 9aae9204adb..9547bc8ce88 100644 --- a/share/man/man4/man4.powerpc/powermac_nvram.4 +++ b/share/man/man4/man4.powerpc/powermac_nvram.4 @@ -62,4 +62,4 @@ driver first appeared in The .Nm driver was written by -.An Maxim Sobolev Aq sobomax@FreeBSD.org . +.An Maxim Sobolev Aq Mt sobomax@FreeBSD.org . diff --git a/share/man/man4/man4.powerpc/smu.4 b/share/man/man4/man4.powerpc/smu.4 index 2550a0df673..2e10160ee07 100644 --- a/share/man/man4/man4.powerpc/smu.4 +++ b/share/man/man4/man4.powerpc/smu.4 @@ -121,5 +121,4 @@ device driver appeared in The .Nm driver was written by -.An Nathan Whitehorn -.Aq nwhitehorn@FreeBSD.org . +.An Nathan Whitehorn Aq Mt nwhitehorn@FreeBSD.org . diff --git a/share/man/man4/man4.powerpc/snd_ai2s.4 b/share/man/man4/man4.powerpc/snd_ai2s.4 index 472a518b79e..93566001a5c 100644 --- a/share/man/man4/man4.powerpc/snd_ai2s.4 +++ b/share/man/man4/man4.powerpc/snd_ai2s.4 @@ -79,10 +79,10 @@ and then in The .Nm driver was written by -.An Tsubai Masanari -.Aq tsubai@netbsd.org , -and ported to FreeBSD by -.An Marco Trillo -.Aq marcotrillo@gmail.com . +.An Tsubai Masanari Aq Mt tsubai@netbsd.org , +and ported to +.Fx +by +.An Marco Trillo Aq Mt marcotrillo@gmail.com . .Sh BUGS Recording and operation with non-44.1 Khz audio are not currently supported. diff --git a/share/man/man4/man4.powerpc/snd_davbus.4 b/share/man/man4/man4.powerpc/snd_davbus.4 index e220de27c35..9949f9b8b50 100644 --- a/share/man/man4/man4.powerpc/snd_davbus.4 +++ b/share/man/man4/man4.powerpc/snd_davbus.4 @@ -75,7 +75,6 @@ device driver appeared in The .Nm driver was written by -.An Marco Trillo -.Aq marcotrillo@gmail.com . +.An Marco Trillo Aq Mt marcotrillo@gmail.com . .Sh BUGS Recording is not currently supported. diff --git a/share/man/man4/man4.sparc64/auxio.4 b/share/man/man4/man4.sparc64/auxio.4 index fb3cdbdf202..9c5bbe154d5 100644 --- a/share/man/man4/man4.sparc64/auxio.4 +++ b/share/man/man4/man4.sparc64/auxio.4 @@ -77,4 +77,4 @@ driver was written by and ported to .Fx by -.An Pyun YongHyeon Aq yongari@FreeBSD.org . +.An Pyun YongHyeon Aq Mt yongari@FreeBSD.org . diff --git a/share/man/man4/man4.sparc64/central.4 b/share/man/man4/man4.sparc64/central.4 index 3fa09bdca0f..fcde31da131 100644 --- a/share/man/man4/man4.sparc64/central.4 +++ b/share/man/man4/man4.sparc64/central.4 @@ -57,4 +57,4 @@ driver first appeared in The .Nm driver was written by -.An "Jake Burkholder" Aq jake@FreeBSD.org . +.An Jake Burkholder Aq Mt jake@FreeBSD.org . diff --git a/share/man/man4/man4.sparc64/clkbrd.4 b/share/man/man4/man4.sparc64/clkbrd.4 index ad74ee288ef..677648ff49e 100644 --- a/share/man/man4/man4.sparc64/clkbrd.4 +++ b/share/man/man4/man4.sparc64/clkbrd.4 @@ -79,10 +79,10 @@ version to include it was The .Nm driver was written by -.An "Jason L. Wright" +.An Jason L. Wright and ported to .Fx by -.An "Marius Strobl" Aq marius@FreeBSD.org . +.An Marius Strobl Aq Mt marius@FreeBSD.org . .Sh CAVEATS Hardware management functionality is not implemented. diff --git a/share/man/man4/man4.sparc64/creator.4 b/share/man/man4/man4.sparc64/creator.4 index 5d7205be72e..64035a7daf3 100644 --- a/share/man/man4/man4.sparc64/creator.4 +++ b/share/man/man4/man4.sparc64/creator.4 @@ -79,7 +79,7 @@ version to include it was The .Nm driver was written by -.An "Jake Burkholder" Aq jake@FreeBSD.org +.An Jake Burkholder Aq Mt jake@FreeBSD.org roughly based on the .Ox driver written by diff --git a/share/man/man4/man4.sparc64/ebus.4 b/share/man/man4/man4.sparc64/ebus.4 index 2dd9807a200..26b67447a60 100644 --- a/share/man/man4/man4.sparc64/ebus.4 +++ b/share/man/man4/man4.sparc64/ebus.4 @@ -115,8 +115,8 @@ version to include it was The .Nm driver was written by -.An "Matthew R. Green" +.An Matthew R. Green and ported to .Fx by -.An "Thomas Moestl" Aq tmm@FreeBSD.org . +.An Thomas Moestl Aq Mt tmm@FreeBSD.org . diff --git a/share/man/man4/man4.sparc64/eeprom.4 b/share/man/man4/man4.sparc64/eeprom.4 index 58af4e892ec..8d7c3a57df5 100644 --- a/share/man/man4/man4.sparc64/eeprom.4 +++ b/share/man/man4/man4.sparc64/eeprom.4 @@ -123,8 +123,8 @@ driver first appeared in The .Nm driver was written by -.An "Thomas Moestl" Aq tmm@FreeBSD.org +.An Thomas Moestl Aq Mt tmm@FreeBSD.org based on the .Nx sparc64 clock code written by -.An "Paul Kranenburg" . +.An Paul Kranenburg . diff --git a/share/man/man4/man4.sparc64/fhc.4 b/share/man/man4/man4.sparc64/fhc.4 index 378737060f3..1cd12e982f1 100644 --- a/share/man/man4/man4.sparc64/fhc.4 +++ b/share/man/man4/man4.sparc64/fhc.4 @@ -79,4 +79,4 @@ driver first appeared in The .Nm driver was written by -.An "Jake Burkholder" Aq jake@FreeBSD.org . +.An Jake Burkholder Aq Mt jake@FreeBSD.org . diff --git a/share/man/man4/man4.sparc64/machfb.4 b/share/man/man4/man4.sparc64/machfb.4 index c42eb9b08b9..9e65222b194 100644 --- a/share/man/man4/man4.sparc64/machfb.4 +++ b/share/man/man4/man4.sparc64/machfb.4 @@ -171,10 +171,10 @@ version to include it was The .Nm driver was written by -.An "Marius Strobl" Aq marius@FreeBSD.org +.An Marius Strobl Aq Mt marius@FreeBSD.org based on the .Nx driver written by -.An "Bang Jun-Young" . +.An Bang Jun-Young . .Sh CAVEATS Font loading and mode switching are not implemented. diff --git a/share/man/man4/man4.sparc64/ofw_console.4 b/share/man/man4/man4.sparc64/ofw_console.4 index 9a4513b1050..f21b977b4d2 100644 --- a/share/man/man4/man4.sparc64/ofw_console.4 +++ b/share/man/man4/man4.sparc64/ofw_console.4 @@ -93,7 +93,7 @@ driver first appeared in The .Nm driver was written by -.An "Benno Rice" Aq benno@FreeBSD.org . +.An Benno Rice Aq Mt benno@FreeBSD.org . .Sh CAVEATS Since the Open Firmware will handle BREAK (or Stop-A) diff --git a/share/man/man4/man4.sparc64/openfirm.4 b/share/man/man4/man4.sparc64/openfirm.4 index 4b6bde78943..bee4915b5f1 100644 --- a/share/man/man4/man4.sparc64/openfirm.4 +++ b/share/man/man4/man4.sparc64/openfirm.4 @@ -278,7 +278,7 @@ The interface was ported to .Fx by -.An "Thomas Moestl" Aq tmm@FreeBSD.org . +.An Thomas Moestl Aq Mt tmm@FreeBSD.org . .Sh CAVEATS Due to limitations within .Tn Open Firmware diff --git a/share/man/man4/man4.sparc64/openprom.4 b/share/man/man4/man4.sparc64/openprom.4 index 38a2291f098..8acdb14995d 100644 --- a/share/man/man4/man4.sparc64/openprom.4 +++ b/share/man/man4/man4.sparc64/openprom.4 @@ -222,7 +222,7 @@ interface was The .Nm interface was written by -.An "Jake Burkholder" Aq jake@FreeBSD.org . +.An Jake Burkholder Aq Mt jake@FreeBSD.org . .Sh CAVEATS Due to limitations within .Tn Open Firmware diff --git a/share/man/man4/man4.sparc64/rtc.4 b/share/man/man4/man4.sparc64/rtc.4 index 9117bf325b7..34bd865bbc5 100644 --- a/share/man/man4/man4.sparc64/rtc.4 +++ b/share/man/man4/man4.sparc64/rtc.4 @@ -85,4 +85,4 @@ driver first appeared in The .Nm driver was written by -.An "Marius Strobl" Aq marius@FreeBSD.org . +.An Marius Strobl Aq Mt marius@FreeBSD.org . diff --git a/share/man/man4/man4.sparc64/sbus.4 b/share/man/man4/man4.sparc64/sbus.4 index 7955727994b..17ab18da487 100644 --- a/share/man/man4/man4.sparc64/sbus.4 +++ b/share/man/man4/man4.sparc64/sbus.4 @@ -72,8 +72,8 @@ version to include it was The .Nm driver was written by -.An "Paul Kranenburg" +.An Paul Kranenburg and ported to .Fx by -.An "Thomas Moestl" Aq tmm@FreeBSD.org . +.An Thomas Moestl Aq Mt tmm@FreeBSD.org . diff --git a/share/man/man4/man4.sparc64/snd_audiocs.4 b/share/man/man4/man4.sparc64/snd_audiocs.4 index 5fcc44ab56c..13b4c22c332 100644 --- a/share/man/man4/man4.sparc64/snd_audiocs.4 +++ b/share/man/man4/man4.sparc64/snd_audiocs.4 @@ -80,8 +80,7 @@ device driver first appeared in The .Nm driver was ported by -.An Pyun YongHyeon -.Aq yongari@FreeBSD.org +.An Pyun YongHyeon Aq Mt yongari@FreeBSD.org from the .Ox driver written by diff --git a/share/man/man4/md.4 b/share/man/man4/md.4 index 49b0069d8e7..af91e58eaa2 100644 --- a/share/man/man4/md.4 +++ b/share/man/man4/md.4 @@ -110,5 +110,4 @@ driver in The .Nm driver was written by -.An Poul-Henning Kamp -.Aq phk@FreeBSD.org . +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . diff --git a/share/man/man4/meteor.4 b/share/man/man4/meteor.4 index 77765defcde..c9381733a86 100644 --- a/share/man/man4/meteor.4 +++ b/share/man/man4/meteor.4 @@ -865,8 +865,8 @@ invalid meteor_counts structure pointer. .El .El .Sh AUTHORS -.An Jim Lowe Aq james@miller.cs.uwm.edu , -.An Mark Tinguely Aq tinguely@plains.nodak.edu +.An Jim Lowe Aq Mt james@miller.cs.uwm.edu +.An Mark Tinguely Aq Mt tinguely@plains.nodak.edu .Sh BUGS The .Nm diff --git a/share/man/man4/mfi.4 b/share/man/man4/mfi.4 index a6d6278f1e6..c20d9bd0900 100644 --- a/share/man/man4/mfi.4 +++ b/share/man/man4/mfi.4 @@ -143,6 +143,6 @@ driver first appeared in The .Nm driver and this manual page were written by -.An Scott Long Aq scottl@FreeBSD.org . +.An Scott Long Aq Mt scottl@FreeBSD.org . .Sh BUGS The driver does not support big-endian architectures at this time. diff --git a/share/man/man4/miibus.4 b/share/man/man4/miibus.4 index 2affa560042..6152095fc3b 100644 --- a/share/man/man4/miibus.4 +++ b/share/man/man4/miibus.4 @@ -185,4 +185,4 @@ driver first appeared in .Fx 3.3 . .Sh AUTHORS This manual page was written by -.An Tom Rhodes Aq trhodes@FreeBSD.org . +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org . diff --git a/share/man/man4/mk48txx.4 b/share/man/man4/mk48txx.4 index 303ccc960cf..30385934f5e 100644 --- a/share/man/man4/mk48txx.4 +++ b/share/man/man4/mk48txx.4 @@ -216,13 +216,10 @@ The driver was written for .Nx by -.An Paul Kranenburg -.Aq pk@NetBSD.org . +.An Paul Kranenburg Aq Mt pk@NetBSD.org . It was ported to .Fx by -.An Thomas Moestl -.Aq tmm@FreeBSD.org +.An Thomas Moestl Aq Mt tmm@FreeBSD.org and later on improved by -.An Marius Strobl -.Aq marius@FreeBSD.org . +.An Marius Strobl Aq Mt marius@FreeBSD.org . diff --git a/share/man/man4/mlx.4 b/share/man/man4/mlx.4 index 696d04812e5..332a5f91679 100644 --- a/share/man/man4/mlx.4 +++ b/share/man/man4/mlx.4 @@ -238,15 +238,12 @@ or in the driver. The .Nm driver was written by -.An Michael Smith -.Aq msmith@FreeBSD.org . +.An Michael Smith Aq Mt msmith@FreeBSD.org . .Pp This manual page was written by -.An Jeroen Ruigrok van der Werven -.Aq asmodai@FreeBSD.org +.An Jeroen Ruigrok van der Werven Aq Mt asmodai@FreeBSD.org and -.An Michael Smith -.Aq msmith@FreeBSD.org . +.An Michael Smith Aq Mt msmith@FreeBSD.org . .Sh BUGS The driver does not yet support EISA adapters. The DEC KZPSC has insufficient flash ROM to hold any reasonably recent firmware. diff --git a/share/man/man4/mly.4 b/share/man/man4/mly.4 index 3affcacbd3c..0a701762d41 100644 --- a/share/man/man4/mly.4 +++ b/share/man/man4/mly.4 @@ -260,12 +260,10 @@ These events report controller status changes. The .Nm driver was written by -.An Michael Smith -.Aq msmith@FreeBSD.org . +.An Michael Smith Aq Mt msmith@FreeBSD.org . .Pp This manual page was written by -.An Michael Smith -.Aq msmith@FreeBSD.org . +.An Michael Smith Aq Mt msmith@FreeBSD.org . .Sh BUGS The driver does not yet provide an external management interface. .Pp diff --git a/share/man/man4/mn.4 b/share/man/man4/mn.4 index 0b88f2fb926..aac7f96e7f9 100644 --- a/share/man/man4/mn.4 +++ b/share/man/man4/mn.4 @@ -52,4 +52,4 @@ driver first appeared in The .Nm driver was written by -.An Poul-Henning Kamp Aq phk@FreeBSD.org . +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . diff --git a/share/man/man4/mod_cc.4 b/share/man/man4/mod_cc.4 index 204537faa36..4b08a6d9cff 100644 --- a/share/man/man4/mod_cc.4 +++ b/share/man/man4/mod_cc.4 @@ -106,12 +106,12 @@ http://caia.swin.edu.au/urp/newtcp/ The .Nm facility was written by -.An Lawrence Stewart Aq lstewart@FreeBSD.org , -.An James Healy Aq jimmy@deefa.com +.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org , +.An James Healy Aq Mt jimmy@deefa.com and -.An David Hayes Aq david.hayes@ieee.org . +.An David Hayes Aq Mt david.hayes@ieee.org . .Pp This manual page was written by -.An David Hayes Aq david.hayes@ieee.org +.An David Hayes Aq Mt david.hayes@ieee.org and -.An Lawrence Stewart Aq lstewart@FreeBSD.org . +.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org . diff --git a/share/man/man4/mouse.4 b/share/man/man4/mouse.4 index 816936af6a3..1cf7aa2fe51 100644 --- a/share/man/man4/mouse.4 +++ b/share/man/man4/mouse.4 @@ -400,4 +400,4 @@ USB mouse device .\".Sh HISTORY .Sh AUTHORS This manual page was written by -.An Kazutaka Yokota Aq yokota@FreeBSD.org . +.An Kazutaka Yokota Aq Mt yokota@FreeBSD.org . diff --git a/share/man/man4/mpr.4 b/share/man/man4/mpr.4 index 4a42fa136d1..c85be675838 100644 --- a/share/man/man4/mpr.4 +++ b/share/man/man4/mpr.4 @@ -220,10 +220,10 @@ The .Nm driver was originally written by .An -nosplit -.An Scott Long Aq scottl@FreeBSD.org . +.An Scott Long Aq Mt scottl@FreeBSD.org . It has been improved and tested by LSI Corporation. .Pp This man page was written by -.An Ken Merry Aq ken@FreeBSD.org +.An Ken Merry Aq Mt ken@FreeBSD.org with additional input from -.An Stephen McConnell Aq stephen.mcconnell@lsi.com . +.An Stephen McConnell Aq Mt stephen.mcconnell@lsi.com . diff --git a/share/man/man4/mps.4 b/share/man/man4/mps.4 index 6840c2183cc..deeca95886e 100644 --- a/share/man/man4/mps.4 +++ b/share/man/man4/mps.4 @@ -210,10 +210,10 @@ driver first appeared in The .Nm driver was originally written by -.An Scott Long Aq scottl@FreeBSD.org . +.An Scott Long Aq Mt scottl@FreeBSD.org . It has been improved and tested by LSI Logic Corporation. This man page was written by -.An Ken Merry Aq ken@FreeBSD.org . +.An Ken Merry Aq Mt ken@FreeBSD.org . .Sh BUGS This driver has a couple of known shortcomings: .Bl -bullet -compact diff --git a/share/man/man4/mpt.4 b/share/man/man4/mpt.4 index 9d62d17c63d..d514cc93718 100644 --- a/share/man/man4/mpt.4 +++ b/share/man/man4/mpt.4 @@ -178,9 +178,9 @@ by .An Greg Ansley and marginally improved upon by -.An Matt Jacob Aq mjacob@FreeBSD.org . +.An Matt Jacob Aq Mt mjacob@FreeBSD.org . .Pp -.An Justin Gibbs Aq gibbs@FreeBSD.org +.An Justin Gibbs Aq Mt gibbs@FreeBSD.org and -.An Scott Long Aq scottl@FreeBSD.org +.An Scott Long Aq Mt scottl@FreeBSD.org have made more substantial improvements. diff --git a/share/man/man4/mrsas.4 b/share/man/man4/mrsas.4 index 60c144ecb41..70cafca9bf5 100644 --- a/share/man/man4/mrsas.4 +++ b/share/man/man4/mrsas.4 @@ -207,7 +207,7 @@ variable, where X is the adapter number, either in or via .Xr sysctl 8 . The following bits have the described effects: -.Bl -tag -offset indent +.Bl -tag -width indent -offset indent .It 0x01 Enable informational prints. .It 0x02 @@ -321,7 +321,7 @@ management interface .Xr mfi 4 , .Xr pci 4 , .Xr device.hints 5 , -.Xt camcontrol 8 +.Xr camcontrol 8 .Sh HISTORY The .Nm @@ -377,7 +377,7 @@ This is the 12Gb/s MegaRAID HBA card which has device id 0x005F. The .Nm driver and this manual page were written by -.An Kashyap Desai Aq Kashyap.Desai@lsi.com . +.An Kashyap Desai Aq Mt Kashyap.Desai@lsi.com . .Sh TODO The driver does not support big-endian architectures at this time. .Pp diff --git a/share/man/man4/msk.4 b/share/man/man4/msk.4 index 200c6f7f3e5..6c2a030dfc1 100644 --- a/share/man/man4/msk.4 +++ b/share/man/man4/msk.4 @@ -243,8 +243,7 @@ a change takes effect. The .Nm driver was written by -.An Pyun YongHyeon -.Aq yongari@FreeBSD.org +.An Pyun YongHyeon Aq Mt yongari@FreeBSD.org and it is based on .Xr sk 4 and Marvell's diff --git a/share/man/man4/mvs.4 b/share/man/man4/mvs.4 index be8c3eab913..167992e6cf9 100644 --- a/share/man/man4/mvs.4 +++ b/share/man/man4/mvs.4 @@ -175,4 +175,4 @@ The driver first appeared in .Fx 8.1 . .Sh AUTHORS -.An Alexander Motin Aq mav@FreeBSD.org +.An Alexander Motin Aq Mt mav@FreeBSD.org diff --git a/share/man/man4/mxge.4 b/share/man/man4/mxge.4 index 5a353fbf423..3e54062fd21 100644 --- a/share/man/man4/mxge.4 +++ b/share/man/man4/mxge.4 @@ -131,7 +131,6 @@ both be capable of MSI-X. Older Myri10GE NICs can be field upgraded to add MSI-X using the "10G NIC Tool Kit" for FreeBSD which is available from .Pa http://www.myri.com/scs/download-10g-tools.html . -.Pp .It Va hw.mxge.rss_hashtype This value determines how incoming traffic is steered to different slices. @@ -167,7 +166,7 @@ go to the Myricom support website at: If an issue is identified with the released source code on the supported kernel with a supported adapter, email the specific information related to the issue to -.Aq help@myri.com . +.Aq Mt help@myri.com . .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , @@ -183,4 +182,4 @@ device driver first appeared in The .Nm driver was written by -.An Andrew Gallatin Aq gallatin@FreeBSD.org . +.An Andrew Gallatin Aq Mt gallatin@FreeBSD.org . diff --git a/share/man/man4/my.4 b/share/man/man4/my.4 index 28b67ddbd85..b1ca8043afc 100644 --- a/share/man/man4/my.4 +++ b/share/man/man4/my.4 @@ -83,7 +83,7 @@ The driver was written by Myson Technology Inc. .Pp This manual page was written by -.An Hiten M. Pandya Aq hmp@FreeBSD.org . +.An Hiten M. Pandya Aq Mt hmp@FreeBSD.org . .Sh BUGS The .Nm diff --git a/share/man/man4/nand.4 b/share/man/man4/nand.4 index d23e292fac7..4371e38c8f9 100644 --- a/share/man/man4/nand.4 +++ b/share/man/man4/nand.4 @@ -131,7 +131,8 @@ The .Nm framework support first appeared in .Fx 10.0 . -.Sh AUTHOR +.Sh AUTHORS +.An -nosplit The .Nm framework was designed and developed by diff --git a/share/man/man4/nandsim.4 b/share/man/man4/nandsim.4 index ebb54527f50..bf8d624eeb8 100644 --- a/share/man/man4/nandsim.4 +++ b/share/man/man4/nandsim.4 @@ -83,7 +83,8 @@ The .Nm support first appeared in .Fx 10.0 . -.Sh AUTHOR +.Sh AUTHORS +.An -nosplit The .Nm kernel driver was developed by diff --git a/share/man/man4/ncv.4 b/share/man/man4/ncv.4 index 8ab719921b8..01cdc93f530 100644 --- a/share/man/man4/ncv.4 +++ b/share/man/man4/ncv.4 @@ -128,6 +128,6 @@ The driver was written by .An Naofumi Honda . This manual page was written by -.An Tom Rhodes Aq trhodes@FreeBSD.org +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org and -.An Noriaki Mitsunaga Aq non@FreeBSD.org . +.An Noriaki Mitsunaga Aq Mt non@FreeBSD.org . diff --git a/share/man/man4/ndis.4 b/share/man/man4/ndis.4 index 874a843f977..5e1c29485ff 100644 --- a/share/man/man4/ndis.4 +++ b/share/man/man4/ndis.4 @@ -150,4 +150,4 @@ device driver first appeared in The .Nm driver was written by -.An Bill Paul Aq wpaul@windriver.com . +.An Bill Paul Aq Mt wpaul@windriver.com . diff --git a/share/man/man4/netgraph.4 b/share/man/man4/netgraph.4 index 90fc77e4f52..b1a55ad8c3d 100644 --- a/share/man/man4/netgraph.4 +++ b/share/man/man4/netgraph.4 @@ -1479,6 +1479,6 @@ It first made its debut in the main tree in .Fx 3.4 . .Sh AUTHORS .An -nosplit -.An Julian Elischer Aq julian@FreeBSD.org , +.An Julian Elischer Aq Mt julian@FreeBSD.org , with contributions by -.An Archie Cobbs Aq archie@FreeBSD.org . +.An Archie Cobbs Aq Mt archie@FreeBSD.org . diff --git a/share/man/man4/netmap.4 b/share/man/man4/netmap.4 index 1b2dc7a23da..1943ebc95ba 100644 --- a/share/man/man4/netmap.4 +++ b/share/man/man4/netmap.4 @@ -612,9 +612,9 @@ In the example below, "netmap:foo" is any valid netmap port name. .Bl -tag -width XXXXX .It NR_REG_ALL_NIC "netmap:foo" (default) all hardware ring pairs -.It NR_REG_SW_NIC "netmap:foo^" +.It NR_REG_SW "netmap:foo^" the ``host rings'', connecting to the host stack. -.It NR_RING_NIC_SW "netmap:foo+ +.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 @@ -639,7 +639,7 @@ or 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_SYNC +.Va NETMAP_NO_TX_POLL to the value written to .Va nr_ringid. When this feature is used, @@ -679,13 +679,13 @@ 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_SYNC flag to +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_SYNC flag to +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_SYNC and NETMAP_DO_RX_SYNC +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 diff --git a/share/man/man4/nfe.4 b/share/man/man4/nfe.4 index 45dd380bb02..29342111079 100644 --- a/share/man/man4/nfe.4 +++ b/share/man/man4/nfe.4 @@ -189,15 +189,12 @@ and then in The .Nm driver was written by -.An Jonathan Gray -.Aq jsg@openbsd.org +.An Jonathan Gray Aq Mt jsg@openbsd.org and -.An Damien Bergamini -.Aq damien@openbsd.org . +.An Damien Bergamini Aq Mt damien@openbsd.org . The .Nm driver was ported to .Fx by -.An Shigeaki Tagashira -.Aq shigeaki@se.hiroshima-u.ac.jp . +.An Shigeaki Tagashira Aq Mt shigeaki@se.hiroshima-u.ac.jp . diff --git a/share/man/man4/nfsmb.4 b/share/man/man4/nfsmb.4 index d6f39cec7fc..f3022191ea8 100644 --- a/share/man/man4/nfsmb.4 +++ b/share/man/man4/nfsmb.4 @@ -51,4 +51,4 @@ driver first appeared in The .Nm driver was written by -.An Ruslan Ermilov Aq ru@FreeBSD.org . +.An Ruslan Ermilov Aq Mt ru@FreeBSD.org . diff --git a/share/man/man4/ng_UI.4 b/share/man/man4/ng_UI.4 index 30f7c4898ef..f00cb63f117 100644 --- a/share/man/man4/ng_UI.4 +++ b/share/man/man4/ng_UI.4 @@ -90,4 +90,4 @@ The node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Julian Elischer Aq julian@FreeBSD.org +.An Julian Elischer Aq Mt julian@FreeBSD.org diff --git a/share/man/man4/ng_async.4 b/share/man/man4/ng_async.4 index ffd9a385d46..cf38b2ed842 100644 --- a/share/man/man4/ng_async.4 +++ b/share/man/man4/ng_async.4 @@ -143,7 +143,6 @@ This command returns a containing node statistics for packet, octet, and error counts. .It Dv NGM_ASYNC_CMD_CLR_STATS Pq Ic clrstats Clears the node statistics. -.Pp .El .Sh SHUTDOWN This node shuts down upon receipt of a @@ -170,4 +169,4 @@ The node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Archie Cobbs Aq archie@FreeBSD.org +.An Archie Cobbs Aq Mt archie@FreeBSD.org diff --git a/share/man/man4/ng_atm.4 b/share/man/man4/ng_atm.4 index c11b9111a91..9c073343748 100644 --- a/share/man/man4/ng_atm.4 +++ b/share/man/man4/ng_atm.4 @@ -403,4 +403,4 @@ panics if set. .Xr ng_ether 4 , .Xr ngctl 8 .Sh AUTHORS -.An Harti Brandt Aq harti@FreeBSD.org +.An Harti Brandt Aq Mt harti@FreeBSD.org diff --git a/share/man/man4/ng_atmllc.4 b/share/man/man4/ng_atmllc.4 index 50131a2c41d..3c7cfa947fc 100644 --- a/share/man/man4/ng_atmllc.4 +++ b/share/man/man4/ng_atmllc.4 @@ -93,4 +93,4 @@ control message, or when all hooks have been disconnected. .%O RFC 1483 .Re .Sh AUTHORS -.An Benno Rice Aq benno@FreeBSD.org +.An Benno Rice Aq Mt benno@FreeBSD.org diff --git a/share/man/man4/ng_bluetooth.4 b/share/man/man4/ng_bluetooth.4 index c956dd06a3e..b19dee157ae 100644 --- a/share/man/man4/ng_bluetooth.4 +++ b/share/man/man4/ng_bluetooth.4 @@ -109,4 +109,4 @@ The module was implemented in .Fx 5.0 . .Sh AUTHORS -.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com +.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com diff --git a/share/man/man4/ng_bpf.4 b/share/man/man4/ng_bpf.4 index 44a51e37f40..0edb4996aee 100644 --- a/share/man/man4/ng_bpf.4 +++ b/share/man/man4/ng_bpf.4 @@ -180,7 +180,7 @@ The node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Archie Cobbs Aq archie@FreeBSD.org +.An Archie Cobbs Aq Mt archie@FreeBSD.org .Sh BUGS When built as a loadable kernel module, this module includes the file .Pa net/bpf_filter.c . diff --git a/share/man/man4/ng_bridge.4 b/share/man/man4/ng_bridge.4 index 4899937a634..9b3e600c644 100644 --- a/share/man/man4/ng_bridge.4 +++ b/share/man/man4/ng_bridge.4 @@ -139,7 +139,6 @@ The determines how quickly a host must jump from one link to another before we declare a loopback condition. The default is one second. -.Pp .It Dv NGM_BRIDGE_GET_CONFIG Pq Ic getconfig Returns the current configuration as a .Dv "struct ng_bridge_config" . @@ -210,4 +209,4 @@ The node type was implemented in .Fx 4.2 . .Sh AUTHORS -.An Archie Cobbs Aq archie@FreeBSD.org +.An Archie Cobbs Aq Mt archie@FreeBSD.org diff --git a/share/man/man4/ng_bt3c.4 b/share/man/man4/ng_bt3c.4 index b6c3ba7243a..9cff66bc159 100644 --- a/share/man/man4/ng_bt3c.4 +++ b/share/man/man4/ng_bt3c.4 @@ -122,8 +122,8 @@ The node type was implemented in .Fx 5.0 . .Sh AUTHORS -.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com +.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com .Sh BUGS The driver is based on information obtained from -.An Jose Orlando Pereira Aq jop@di.uminho.pt +.An Jose Orlando Pereira Aq Mt jop@di.uminho.pt and disassembled the W2K driver. diff --git a/share/man/man4/ng_btsocket.4 b/share/man/man4/ng_btsocket.4 index 12f28448ef6..103497af254 100644 --- a/share/man/man4/ng_btsocket.4 +++ b/share/man/man4/ng_btsocket.4 @@ -348,7 +348,7 @@ The module was implemented in .Fx 5.0 . .Sh AUTHORS -.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com +.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com .Sh BUGS Most likely. Please report if found. diff --git a/share/man/man4/ng_car.4 b/share/man/man4/ng_car.4 index 348b03d64d6..ade46498fa6 100644 --- a/share/man/man4/ng_car.4 +++ b/share/man/man4/ng_car.4 @@ -208,7 +208,7 @@ SEQ .%O RFC 2698 .Re .Sh AUTHORS -.An Nuno Antunes Aq nuno.antunes@gmail.com -.An Alexander Motin Aq mav@FreeBSD.org +.An Nuno Antunes Aq Mt nuno.antunes@gmail.com +.An Alexander Motin Aq Mt mav@FreeBSD.org .Sh BUGS At this moment only DROP and FORWARD actions are implemented. diff --git a/share/man/man4/ng_ccatm.4 b/share/man/man4/ng_ccatm.4 index f643d726d55..3d6778fa25d 100644 --- a/share/man/man4/ng_ccatm.4 +++ b/share/man/man4/ng_ccatm.4 @@ -206,7 +206,6 @@ struct ngm_ccatm_port { uint32_t port; }; .Ed -.Pp .It Dv NGM_CCATM_START Pq Ic start Start processing on the port. The argument is a @@ -321,4 +320,4 @@ Return extended status information from the node. .Xr ng_uni 4 , .Xr ngctl 8 .Sh AUTHORS -.An Harti Brandt Aq harti@FreeBSD.org +.An Harti Brandt Aq Mt harti@FreeBSD.org diff --git a/share/man/man4/ng_cisco.4 b/share/man/man4/ng_cisco.4 index 143ecdb521b..3904176855b 100644 --- a/share/man/man4/ng_cisco.4 +++ b/share/man/man4/ng_cisco.4 @@ -175,8 +175,8 @@ The node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Julian Elischer Aq julian@FreeBSD.org , -.An Archie Cobbs Aq archie@FreeBSD.org +.An Julian Elischer Aq Mt julian@FreeBSD.org +.An Archie Cobbs Aq Mt archie@FreeBSD.org .Sh BUGS Not all of the functionality has been implemented. For example, diff --git a/share/man/man4/ng_deflate.4 b/share/man/man4/ng_deflate.4 index dbf3c562f18..92710b4afed 100644 --- a/share/man/man4/ng_deflate.4 +++ b/share/man/man4/ng_deflate.4 @@ -151,7 +151,7 @@ control message, or when hook have been disconnected. .%O RFC 1661 .Re .Sh AUTHORS -.An Alexander Motin Aq mav@alkar.net +.An Alexander Motin Aq Mt mav@alkar.net .Sh BUGS Due to nature of netgraph PPP implementation there are possible race conditions between data packet and ResetAck CCP packet in case of packet loss. As result, diff --git a/share/man/man4/ng_device.4 b/share/man/man4/ng_device.4 index a03a03b6b0c..5374e646dbe 100644 --- a/share/man/man4/ng_device.4 +++ b/share/man/man4/ng_device.4 @@ -92,5 +92,5 @@ The node type was first implemented in .Fx 5.0 . .Sh AUTHORS -.An Mark Santcroos Aq marks@ripe.net -.An Gleb Smirnoff Aq glebius@FreeBSD.org +.An Mark Santcroos Aq Mt marks@ripe.net +.An Gleb Smirnoff Aq Mt glebius@FreeBSD.org diff --git a/share/man/man4/ng_echo.4 b/share/man/man4/ng_echo.4 index f502c621ac0..ac05d54cae0 100644 --- a/share/man/man4/ng_echo.4 +++ b/share/man/man4/ng_echo.4 @@ -70,4 +70,4 @@ The node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Julian Elischer Aq julian@FreeBSD.org +.An Julian Elischer Aq Mt julian@FreeBSD.org diff --git a/share/man/man4/ng_etf.4 b/share/man/man4/ng_etf.4 index a35f4fa565b..5e78b3d0bab 100644 --- a/share/man/man4/ng_etf.4 +++ b/share/man/man4/ng_etf.4 @@ -151,4 +151,4 @@ The node type was implemented in .Fx 5.0 . .Sh AUTHORS -.An Julian Elischer Aq julian@FreeBSD.org +.An Julian Elischer Aq Mt julian@FreeBSD.org diff --git a/share/man/man4/ng_ether.4 b/share/man/man4/ng_ether.4 index 610a8af8ae2..6d579e8b9f5 100644 --- a/share/man/man4/ng_ether.4 +++ b/share/man/man4/ng_ether.4 @@ -224,8 +224,8 @@ ngctl connect fxp0: lower upper left .Xr ngctl 8 , .Xr nghook 8 .Sh AUTHORS -.An Julian Elischer Aq julian@FreeBSD.org -.An Archie Cobbs Aq archie@FreeBSD.org +.An Julian Elischer Aq Mt julian@FreeBSD.org +.An Archie Cobbs Aq Mt archie@FreeBSD.org .Sh BUGS The automatic KLD module loading mechanism that works for most other Netgraph node types does not work for the diff --git a/share/man/man4/ng_ether_echo.4 b/share/man/man4/ng_ether_echo.4 index 2f9dd38aa41..e86c3a931e4 100644 --- a/share/man/man4/ng_ether_echo.4 +++ b/share/man/man4/ng_ether_echo.4 @@ -74,4 +74,4 @@ The node type was implemented in .Fx 8.0 . .Sh AUTHORS -.An Julian Elischer Aq julian@FreeBSD.org +.An Julian Elischer Aq Mt julian@FreeBSD.org diff --git a/share/man/man4/ng_frame_relay.4 b/share/man/man4/ng_frame_relay.4 index 576fdfe3e8e..7f7f0251ba6 100644 --- a/share/man/man4/ng_frame_relay.4 +++ b/share/man/man4/ng_frame_relay.4 @@ -87,7 +87,7 @@ The node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Julian Elischer Aq julian@FreeBSD.org +.An Julian Elischer Aq Mt julian@FreeBSD.org .Sh BUGS Technically, frames on DLCI X should not be transmitted to the switch until the LMI protocol entity on both ends has configured DLCI X as active. diff --git a/share/man/man4/ng_gif.4 b/share/man/man4/ng_gif.4 index 2f360c0fb46..dcda5e651f1 100644 --- a/share/man/man4/ng_gif.4 +++ b/share/man/man4/ng_gif.4 @@ -123,4 +123,4 @@ interface to standard output decoded in hex and ASCII: .Xr ngctl 8 , .Xr nghook 8 .Sh AUTHORS -.An Brooks Davis Aq brooks@FreeBSD.org +.An Brooks Davis Aq Mt brooks@FreeBSD.org diff --git a/share/man/man4/ng_gif_demux.4 b/share/man/man4/ng_gif_demux.4 index b245e09fa29..e827659b8f5 100644 --- a/share/man/man4/ng_gif_demux.4 +++ b/share/man/man4/ng_gif_demux.4 @@ -104,4 +104,4 @@ This node type supports only the generic control messages. .Xr ngctl 8 , .Xr nghook 8 .Sh AUTHORS -.An Brooks Davis Aq brooks@FreeBSD.org +.An Brooks Davis Aq Mt brooks@FreeBSD.org diff --git a/share/man/man4/ng_h4.4 b/share/man/man4/ng_h4.4 index a3b99ed9ace..bb539a230eb 100644 --- a/share/man/man4/ng_h4.4 +++ b/share/man/man4/ng_h4.4 @@ -115,7 +115,7 @@ The node type was implemented in .Fx 5.0 . .Sh AUTHORS -.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com +.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com .Sh BUGS This node still uses .Xr spltty 9 diff --git a/share/man/man4/ng_hci.4 b/share/man/man4/ng_hci.4 index 7ef7fcba061..d5727ef83ea 100644 --- a/share/man/man4/ng_hci.4 +++ b/share/man/man4/ng_hci.4 @@ -381,7 +381,7 @@ The node type was implemented in .Fx 5.0 . .Sh AUTHORS -.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com +.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com .Sh BUGS Most likely. Please report if found. diff --git a/share/man/man4/ng_hole.4 b/share/man/man4/ng_hole.4 index 4d0c0773f2b..227170d422e 100644 --- a/share/man/man4/ng_hole.4 +++ b/share/man/man4/ng_hole.4 @@ -88,4 +88,4 @@ The node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Julian Elischer Aq julian@FreeBSD.org +.An Julian Elischer Aq Mt julian@FreeBSD.org diff --git a/share/man/man4/ng_hub.4 b/share/man/man4/ng_hub.4 index da687239e7f..bdd3f42daad 100644 --- a/share/man/man4/ng_hub.4 +++ b/share/man/man4/ng_hub.4 @@ -72,4 +72,4 @@ The node type appeared in .Fx 5.3 . .Sh AUTHORS -.An Ruslan Ermilov Aq ru@FreeBSD.org +.An Ruslan Ermilov Aq Mt ru@FreeBSD.org diff --git a/share/man/man4/ng_iface.4 b/share/man/man4/ng_iface.4 index 270aa4fd142..66de96eba4a 100644 --- a/share/man/man4/ng_iface.4 +++ b/share/man/man4/ng_iface.4 @@ -163,4 +163,4 @@ The node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Archie Cobbs Aq archie@FreeBSD.org +.An Archie Cobbs Aq Mt archie@FreeBSD.org diff --git a/share/man/man4/ng_ip_input.4 b/share/man/man4/ng_ip_input.4 index 430f43c6eaa..0c4cbafd2f4 100644 --- a/share/man/man4/ng_ip_input.4 +++ b/share/man/man4/ng_ip_input.4 @@ -95,7 +95,7 @@ The node type was implemented in .Fx 5.0 . .Sh AUTHORS -.An Brooks Davis Aq brooks@FreeBSD.org +.An Brooks Davis Aq Mt brooks@FreeBSD.org .Sh BUGS The .Nm diff --git a/share/man/man4/ng_ipfw.4 b/share/man/man4/ng_ipfw.4 index 9a9099efd75..19e8f741888 100644 --- a/share/man/man4/ng_ipfw.4 +++ b/share/man/man4/ng_ipfw.4 @@ -114,4 +114,4 @@ node type was implemented in The .Nm ipfw node was written by -.An "Gleb Smirnoff" Aq glebius@FreeBSD.org . +.An Gleb Smirnoff Aq Mt glebius@FreeBSD.org . diff --git a/share/man/man4/ng_ksocket.4 b/share/man/man4/ng_ksocket.4 index ff67028beff..0590bbf91f3 100644 --- a/share/man/man4/ng_ksocket.4 +++ b/share/man/man4/ng_ksocket.4 @@ -239,4 +239,4 @@ The node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Archie Cobbs Aq archie@FreeBSD.org +.An Archie Cobbs Aq Mt archie@FreeBSD.org diff --git a/share/man/man4/ng_l2cap.4 b/share/man/man4/ng_l2cap.4 index ba5df7d9c03..63b2ede785a 100644 --- a/share/man/man4/ng_l2cap.4 +++ b/share/man/man4/ng_l2cap.4 @@ -416,7 +416,7 @@ The node type was implemented in .Fx 5.0 . .Sh AUTHORS -.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com +.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com .Sh BUGS Most likely. Please report if found. diff --git a/share/man/man4/ng_l2tp.4 b/share/man/man4/ng_l2tp.4 index fc5ed07167d..11f3c5e515b 100644 --- a/share/man/man4/ng_l2tp.4 +++ b/share/man/man4/ng_l2tp.4 @@ -326,4 +326,4 @@ The node type was developed at Packet Design, LLC, .Pa http://www.packetdesign.com/ . .Sh AUTHORS -.An Archie Cobbs Aq archie@packetdesign.com +.An Archie Cobbs Aq Mt archie@packetdesign.com diff --git a/share/man/man4/ng_lmi.4 b/share/man/man4/ng_lmi.4 index 53787176825..21a96d1628b 100644 --- a/share/man/man4/ng_lmi.4 +++ b/share/man/man4/ng_lmi.4 @@ -135,4 +135,4 @@ The node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Julian Elischer Aq julian@FreeBSD.org +.An Julian Elischer Aq Mt julian@FreeBSD.org diff --git a/share/man/man4/ng_mppc.4 b/share/man/man4/ng_mppc.4 index e7eeedfb478..0d4d674aa09 100644 --- a/share/man/man4/ng_mppc.4 +++ b/share/man/man4/ng_mppc.4 @@ -185,7 +185,7 @@ option. .%O RFC 2637 .Re .Sh AUTHORS -.An Archie Cobbs Aq archie@FreeBSD.org +.An Archie Cobbs Aq Mt archie@FreeBSD.org .Sh BUGS In PPP, encryption should be handled by the Encryption Control Protocol (ECP) rather than CCP. diff --git a/share/man/man4/ng_nat.4 b/share/man/man4/ng_nat.4 index 9b3b3fc0185..e0d056d2152 100644 --- a/share/man/man4/ng_nat.4 +++ b/share/man/man4/ng_nat.4 @@ -347,4 +347,4 @@ The node type was implemented in .Fx 6.0 . .Sh AUTHORS -.An Gleb Smirnoff Aq glebius@FreeBSD.org +.An Gleb Smirnoff Aq Mt glebius@FreeBSD.org diff --git a/share/man/man4/ng_netflow.4 b/share/man/man4/ng_netflow.4 index 3c710dc1a4e..fb7e1faafad 100644 --- a/share/man/man4/ng_netflow.4 +++ b/share/man/man4/ng_netflow.4 @@ -335,13 +335,13 @@ SEQ The .Nm node type was written by -.An Gleb Smirnoff Aq glebius@FreeBSD.org , -.An Alexander Motin Aq mav@FreeBSD.org , -.An Alexander Chernikov Aq melifaro@ipfw.ru . +.An Gleb Smirnoff Aq Mt glebius@FreeBSD.org , +.An Alexander Motin Aq Mt mav@FreeBSD.org , +.An Alexander Chernikov Aq Mt melifaro@ipfw.ru . The initial code was based on .Nm ng_ipacct written by -.An Roman V. Palagin Aq romanp@unshadow.net . +.An Roman V. Palagin Aq Mt romanp@unshadow.net . .Sh BUGS Cache snapshot obtained via .Dv NGM_NETFLOW_SHOW diff --git a/share/man/man4/ng_one2many.4 b/share/man/man4/ng_one2many.4 index 288ea186878..845254e1906 100644 --- a/share/man/man4/ng_one2many.4 +++ b/share/man/man4/ng_one2many.4 @@ -268,11 +268,9 @@ node type was implemented in The .Nm one2many netgraph node (with round-robin algorithm) was written by -.An Archie Cobbs -.Aq archie@FreeBSD.org . +.An Archie Cobbs Aq Mt archie@FreeBSD.org . The all algorithm was added by -.An Rogier R. Mulhuijzen -.Aq drwilco@drwilco.net . +.An Rogier R. Mulhuijzen Aq Mt drwilco@drwilco.net . .Sh BUGS More transmit and link failure algorithms should be supported. A good candidate is Cisco's Etherchannel. diff --git a/share/man/man4/ng_patch.4 b/share/man/man4/ng_patch.4 index db7ede54025..52658ac1051 100644 --- a/share/man/man4/ng_patch.4 +++ b/share/man/man4/ng_patch.4 @@ -218,9 +218,11 @@ The node type was implemented in .Fx 8.1 . .Sh AUTHORS -.An "Maxim Ignatenko" Aq gelraen.ua@gmail.com . +.An Maxim Ignatenko Aq Mt gelraen.ua@gmail.com +.Pp +.An -nosplit This manual page was written by -.An "Vadim Goncharov" Aq vadimnuclight@tpu.ru . +.An Vadim Goncharov Aq Mt vadimnuclight@tpu.ru . .Sh BUGS Node blindly tries to apply every patching operation to each packet (except those which offset if greater than length of the packet), diff --git a/share/man/man4/ng_ppp.4 b/share/man/man4/ng_ppp.4 index d69a59f3f8f..89e662cf81f 100644 --- a/share/man/man4/ng_ppp.4 +++ b/share/man/man4/ng_ppp.4 @@ -385,7 +385,6 @@ struct ng_ppp_node_conf { struct ng_ppp_link_conf links[NG_PPP_MAX_LINKS]; }; .Ed -.Pp .It Dv NGM_PPP_GET_CONFIG Pq Ic getconfig Returns the current configuration as a .Dv "struct ng_ppp_node_conf" . @@ -458,4 +457,4 @@ The node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Archie Cobbs Aq archie@FreeBSD.org +.An Archie Cobbs Aq Mt archie@FreeBSD.org diff --git a/share/man/man4/ng_pppoe.4 b/share/man/man4/ng_pppoe.4 index a124d6770b7..c2cf63f06de 100644 --- a/share/man/man4/ng_pppoe.4 +++ b/share/man/man4/ng_pppoe.4 @@ -504,4 +504,4 @@ The node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Julian Elischer Aq julian@FreeBSD.org +.An Julian Elischer Aq Mt julian@FreeBSD.org diff --git a/share/man/man4/ng_pptpgre.4 b/share/man/man4/ng_pptpgre.4 index 3e26f9cc024..fccecf85430 100644 --- a/share/man/man4/ng_pptpgre.4 +++ b/share/man/man4/ng_pptpgre.4 @@ -169,7 +169,7 @@ The node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Archie Cobbs Aq archie@FreeBSD.org +.An Archie Cobbs Aq Mt archie@FreeBSD.org .Sh BUGS The node should not expect incoming GRE packets to have an IP header. This behavior is inherited from the (converse) behavior of raw IP sockets. diff --git a/share/man/man4/ng_pred1.4 b/share/man/man4/ng_pred1.4 index fed3fdca8d0..7befbbccd00 100644 --- a/share/man/man4/ng_pred1.4 +++ b/share/man/man4/ng_pred1.4 @@ -138,7 +138,7 @@ control message, or when hook have been disconnected. .%O RFC 1661 .Re .Sh AUTHORS -.An Alexander Motin Aq mav@alkar.net +.An Alexander Motin Aq Mt mav@alkar.net .Sh BUGS Due to nature of netgraph PPP implementation there are possible race conditions between data packet and ResetAck CCP packet in case of packet loss. As result, diff --git a/share/man/man4/ng_rfc1490.4 b/share/man/man4/ng_rfc1490.4 index de45fb7dab1..51baa9e26a6 100644 --- a/share/man/man4/ng_rfc1490.4 +++ b/share/man/man4/ng_rfc1490.4 @@ -136,6 +136,6 @@ The node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Julian Elischer Aq julian@FreeBSD.org +.An Julian Elischer Aq Mt julian@FreeBSD.org .Sh BUGS Not all of RFC 1490 is implemented. diff --git a/share/man/man4/ng_socket.4 b/share/man/man4/ng_socket.4 index 84ddd1561bc..d05802b0862 100644 --- a/share/man/man4/ng_socket.4 +++ b/share/man/man4/ng_socket.4 @@ -179,7 +179,7 @@ The node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Julian Elischer Aq julian@FreeBSD.org +.An Julian Elischer Aq Mt julian@FreeBSD.org .Sh BUGS It is not possible to reject the connection of a hook, though any data received on that hook can certainly be ignored. diff --git a/share/man/man4/ng_split.4 b/share/man/man4/ng_split.4 index 4062ca25fbf..827ecb65500 100644 --- a/share/man/man4/ng_split.4 +++ b/share/man/man4/ng_split.4 @@ -84,5 +84,5 @@ but incorporated into in .Fx 5.0 . .Sh AUTHORS -.An Julian Elischer Aq julian@FreeBSD.org -.An Vitaly V. Belekhov Aq vitaly@riss-telecom.ru +.An Julian Elischer Aq Mt julian@FreeBSD.org +.An Vitaly V. Belekhov Aq Mt vitaly@riss-telecom.ru diff --git a/share/man/man4/ng_sppp.4 b/share/man/man4/ng_sppp.4 index d23268f7f14..685d45f1500 100644 --- a/share/man/man4/ng_sppp.4 +++ b/share/man/man4/ng_sppp.4 @@ -169,4 +169,4 @@ It was included to the system since .Fx 5.3 . .Sh AUTHORS Copyright (C) 2003-2004 -.An Roman Kurakin Aq rik@cronyx.ru . +.An Roman Kurakin Aq Mt rik@cronyx.ru diff --git a/share/man/man4/ng_sscfu.4 b/share/man/man4/ng_sscfu.4 index c44c1f43095..2c444dacd58 100644 --- a/share/man/man4/ng_sscfu.4 +++ b/share/man/man4/ng_sscfu.4 @@ -158,4 +158,4 @@ If the node has not been enabled, 0 is returned. .Xr ng_sscop 4 , .Xr ngctl 8 .Sh AUTHORS -.An Harti Brandt Aq harti@FreeBSD.org +.An Harti Brandt Aq Mt harti@FreeBSD.org diff --git a/share/man/man4/ng_sscop.4 b/share/man/man4/ng_sscop.4 index 5496a379b94..c98a4346258 100644 --- a/share/man/man4/ng_sscop.4 +++ b/share/man/man4/ng_sscop.4 @@ -400,4 +400,4 @@ were disabled. .Xr ng_sscfu 4 , .Xr ngctl 8 .Sh AUTHORS -.An Harti Brandt Aq harti@FreeBSD.org +.An Harti Brandt Aq Mt harti@FreeBSD.org diff --git a/share/man/man4/ng_tag.4 b/share/man/man4/ng_tag.4 index 70bd2347025..6aac9fa97ed 100644 --- a/share/man/man4/ng_tag.4 +++ b/share/man/man4/ng_tag.4 @@ -329,7 +329,7 @@ The node type was implemented in .Fx 6.2 . .Sh AUTHORS -.An Vadim Goncharov Aq vadimnuclight@tpu.ru +.An Vadim Goncharov Aq Mt vadimnuclight@tpu.ru .Sh BUGS For manipulating any tags with data payload (that is, all tags with non-zero .Va tag_len ) diff --git a/share/man/man4/ng_tcpmss.4 b/share/man/man4/ng_tcpmss.4 index 240d97579c1..e13c562e3ee 100644 --- a/share/man/man4/ng_tcpmss.4 +++ b/share/man/man4/ng_tcpmss.4 @@ -119,7 +119,7 @@ The node type was implemented in .Fx 6.0 . .Sh AUTHORS -.An Alexey Popov Aq lollypop@flexuser.ru -.An Gleb Smirnoff Aq glebius@FreeBSD.org +.An Alexey Popov Aq Mt lollypop@flexuser.ru +.An Gleb Smirnoff Aq Mt glebius@FreeBSD.org .Sh BUGS When running on SMP, system statistics may be broken. diff --git a/share/man/man4/ng_tee.4 b/share/man/man4/ng_tee.4 index e86209df842..426aaf99d01 100644 --- a/share/man/man4/ng_tee.4 +++ b/share/man/man4/ng_tee.4 @@ -131,4 +131,4 @@ The node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Julian Elischer Aq julian@FreeBSD.org +.An Julian Elischer Aq Mt julian@FreeBSD.org diff --git a/share/man/man4/ng_tty.4 b/share/man/man4/ng_tty.4 index 3add57cdc2c..c8d5b37e95c 100644 --- a/share/man/man4/ng_tty.4 +++ b/share/man/man4/ng_tty.4 @@ -116,8 +116,8 @@ The node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Archie Cobbs Aq archie@FreeBSD.org -.An Andrew Thompson Aq thompsa@FreeBSD.org +.An Archie Cobbs Aq Mt archie@FreeBSD.org +.An Andrew Thompson Aq Mt thompsa@FreeBSD.org .Sh BUGS The serial driver code also has a notion of a .Dq hot character . diff --git a/share/man/man4/ng_ubt.4 b/share/man/man4/ng_ubt.4 index ef8a57ea706..0036fa8cfd0 100644 --- a/share/man/man4/ng_ubt.4 +++ b/share/man/man4/ng_ubt.4 @@ -118,7 +118,7 @@ The node type was implemented in .Fx 5.0 . .Sh AUTHORS -.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com +.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com .Sh BUGS Isochronous USB transfers are broken. This means that the USB device will not be able to transfer SCO data (voice). diff --git a/share/man/man4/ng_uni.4 b/share/man/man4/ng_uni.4 index a2e3c458220..da7028b0e01 100644 --- a/share/man/man4/ng_uni.4 +++ b/share/man/man4/ng_uni.4 @@ -404,7 +404,7 @@ The .Nm uni netgraph node and this manual page were written by -.An Harti Brandt Aq harti@FreeBSD.org +.An Harti Brandt Aq Mt harti@FreeBSD.org .Sh BUGS .Bl -bullet -compact .It diff --git a/share/man/man4/ng_vjc.4 b/share/man/man4/ng_vjc.4 index 83f02694767..bc4d562cd8b 100644 --- a/share/man/man4/ng_vjc.4 +++ b/share/man/man4/ng_vjc.4 @@ -217,7 +217,7 @@ The node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Archie Cobbs Aq archie@FreeBSD.org +.An Archie Cobbs Aq Mt archie@FreeBSD.org .Sh BUGS As the initialization routine in the kernel implementation of Van Jacobson compression initializes both compression and decompression diff --git a/share/man/man4/ng_vlan.4 b/share/man/man4/ng_vlan.4 index 1efacccc808..7b225fdef06 100644 --- a/share/man/man4/ng_vlan.4 +++ b/share/man/man4/ng_vlan.4 @@ -142,4 +142,4 @@ The node type appeared in .Fx 4.10 . .Sh AUTHORS -.An Ruslan Ermilov Aq ru@FreeBSD.org +.An Ruslan Ermilov Aq Mt ru@FreeBSD.org diff --git a/share/man/man4/ngatmbase.4 b/share/man/man4/ngatmbase.4 index fd885ee5179..0227b44347b 100644 --- a/share/man/man4/ngatmbase.4 +++ b/share/man/man4/ngatmbase.4 @@ -131,4 +131,4 @@ returns an appropriate error code. .Xr ng_sscop 4 , .Xr ng_uni 4 .Sh AUTHORS -.An Harti Brandt Aq harti@FreeBSD.org +.An Harti Brandt Aq Mt harti@FreeBSD.org diff --git a/share/man/man4/nge.4 b/share/man/man4/nge.4 index ec02052601c..227cffbcb3c 100644 --- a/share/man/man4/nge.4 +++ b/share/man/man4/nge.4 @@ -224,4 +224,4 @@ device driver first appeared in The .Nm driver was written by -.An Bill Paul Aq wpaul@bsdi.com . +.An Bill Paul Aq Mt wpaul@bsdi.com . diff --git a/share/man/man4/nsp.4 b/share/man/man4/nsp.4 index 7ff7fe17625..86e3330405c 100644 --- a/share/man/man4/nsp.4 +++ b/share/man/man4/nsp.4 @@ -91,8 +91,8 @@ driver was written by .An Naofumi HONDA . .Pp This manual page was written by -.An Noriaki MITSUNAGA Aq non@FreeBSD.org +.An Noriaki MITSUNAGA Aq Mt non@FreeBSD.org and -.An Hideyuki KURASHINA Aq rushani@FreeBSD.org . +.An Hideyuki KURASHINA Aq Mt rushani@FreeBSD.org . .Sh BUGS SMIT mode is only supported under OLDCARD now. diff --git a/share/man/man4/ntb.4 b/share/man/man4/ntb.4 index ac16c61ebe0..ada350aae71 100644 --- a/share/man/man4/ntb.4 +++ b/share/man/man4/ntb.4 @@ -94,7 +94,7 @@ variable. The .Nm driver was developed by Intel and originally written by -.An Carl Delsey Aq carl@FreeBSD.org. +.An Carl Delsey Aq Mt carl@FreeBSD.org . .Sh BUGS If the driver is unloaded, it cannot be reloaded without a system reboot. .Pp diff --git a/share/man/man4/nvd.4 b/share/man/man4/nvd.4 index 0874ad5e70d..f5210bf4a14 100644 --- a/share/man/man4/nvd.4 +++ b/share/man/man4/nvd.4 @@ -90,8 +90,8 @@ driver first appeared in The .Nm driver was developed by Intel and originally written by -.An Jim Harris Aq jimharris@FreeBSD.org , +.An Jim Harris Aq Mt jimharris@FreeBSD.org , with contributions from Joe Golio at EMC. .Pp This man page was written by -.An Jim Harris Aq jimharris@FreeBSD.org . +.An Jim Harris Aq Mt jimharris@FreeBSD.org . diff --git a/share/man/man4/nvme.4 b/share/man/man4/nvme.4 index cb95aafb64a..068b006b954 100644 --- a/share/man/man4/nvme.4 +++ b/share/man/man4/nvme.4 @@ -85,7 +85,6 @@ the format .Pa /dev/nvmeXnsY . Note that the NVM Express specification starts numbering namespaces at 1, not 0, and this driver follows that convention. -.El .Sh CONFIGURATION By default, .Nm @@ -165,8 +164,10 @@ driver first appeared in The .Nm driver was developed by Intel and originally written by -.An Jim Harris Aq jimharris@FreeBSD.org , -with contributions from Joe Golio at EMC. +.An Jim Harris Aq Mt jimharris@FreeBSD.org , +with contributions from +.An Joe Golio +at EMC. .Pp This man page was written by -.An Jim Harris Aq jimharris@FreeBSD.org . +.An Jim Harris Aq Mt jimharris@FreeBSD.org . diff --git a/share/man/man4/nvram2env.4 b/share/man/man4/nvram2env.4 index 36423fb96f9..b9b03115e98 100644 --- a/share/man/man4/nvram2env.4 +++ b/share/man/man4/nvram2env.4 @@ -113,6 +113,4 @@ hint.nvram.1.base=0x1cff8000 first appeared in .Fx 9.0 . .Sh AUTHORS -.An -nosplit -.Nm -.An Aleksandr Rybalko Aq ray@ddteam.net . +.An Aleksandr Rybalko Aq Mt ray@ddteam.net diff --git a/share/man/man4/nxge.4 b/share/man/man4/nxge.4 index 8d94afc599b..7d18c787a71 100644 --- a/share/man/man4/nxge.4 +++ b/share/man/man4/nxge.4 @@ -79,7 +79,7 @@ For troubleshooting tips and FAQs, please visit .Pa http://trac.neterion.com/cgi-bin/trac.cgi/wiki/TitleIndex?anonymous . .Pp For any issues please send an email to -.Aq support@neterion.com . +.Aq Mt support@neterion.com . .Sh SEE ALSO .Xr arp 4 , .Xr netintro 4 , @@ -93,5 +93,4 @@ device driver first appeared in The .Nm driver was written by -.An Neterion -.Aq support@neterion.com . +.An Neterion Aq Mt support@neterion.com . diff --git a/share/man/man4/ohci.4 b/share/man/man4/ohci.4 index 4a60c8bea5f..b89eeb774f3 100644 --- a/share/man/man4/ohci.4 +++ b/share/man/man4/ohci.4 @@ -72,7 +72,7 @@ device driver first appeared in The .Nm driver was written by -.An Lennart Augustsson Aq augustss@carlstedt.se +.An Lennart Augustsson Aq Mt augustss@carlstedt.se for the .Nx project. diff --git a/share/man/man4/orm.4 b/share/man/man4/orm.4 index 2922cb68ead..ede8c7573a4 100644 --- a/share/man/man4/orm.4 +++ b/share/man/man4/orm.4 @@ -41,7 +41,7 @@ top of an option ROM. .Sh AUTHORS This manual page was written by -.An Nikolai Saoukh Aq nms@otdel-1.org . +.An Nikolai Saoukh Aq Mt nms@otdel-1.org . .Sh BUGS Due to the implementation of the resource manager, other drivers cannot attach to the option ROM address range. diff --git a/share/man/man4/padlock.4 b/share/man/man4/padlock.4 index 2a74f63939c..ad648af9d94 100644 --- a/share/man/man4/padlock.4 +++ b/share/man/man4/padlock.4 @@ -87,11 +87,11 @@ release to include it was The .Nm driver with AES encryption support was written by -.An Jason Wright Aq jason@OpenBSD.org . +.An Jason Wright Aq Mt jason@OpenBSD.org . It was ported to .Fx and then extended to support SHA1 and SHA256 by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org . +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org . This manual page was written by -.An Christian Brueffer Aq brueffer@FreeBSD.org . +.An Christian Brueffer Aq Mt brueffer@FreeBSD.org . diff --git a/share/man/man4/pass.4 b/share/man/man4/pass.4 index 7819ea369b8..7280de1a2df 100644 --- a/share/man/man4/pass.4 +++ b/share/man/man4/pass.4 @@ -112,7 +112,7 @@ None. The CAM passthrough driver first appeared in .Fx 3.0 . .Sh AUTHORS -.An Kenneth Merry Aq ken@FreeBSD.org +.An Kenneth Merry Aq Mt ken@FreeBSD.org .Sh BUGS It might be nice to have a way to asynchronously send CCBs through the passthrough driver. diff --git a/share/man/man4/patm.4 b/share/man/man4/patm.4 index 443b9f7a8d4..4f7a10438f4 100644 --- a/share/man/man4/patm.4 +++ b/share/man/man4/patm.4 @@ -159,7 +159,7 @@ Thanks to Christian Bucari from ProSum for lending two of these cards to enable the development of this driver. Thanks also for answering my questions. .Sh AUTHORS -.An Harti Brandt Aq harti@FreeBSD.org +.An Harti Brandt Aq Mt harti@FreeBSD.org .Sh CAVEATS The card fails to generate an interrupt if a cell is received in AAL0 mode that has the MSB of the PTI field cleared. diff --git a/share/man/man4/pci.4 b/share/man/man4/pci.4 index c79626f57bd..b1a056b970a 100644 --- a/share/man/man4/pci.4 +++ b/share/man/man4/pci.4 @@ -331,7 +331,7 @@ Support for device listing and matching was re-implemented by Kenneth Merry, and first appeared in .Fx 3.0 . .Sh AUTHORS -.An Kenneth Merry Aq ken@FreeBSD.org +.An Kenneth Merry Aq Mt ken@FreeBSD.org .Sh BUGS It is not possible for users to specify an accurate offset into the device list without calling the diff --git a/share/man/man4/pcm.4 b/share/man/man4/pcm.4 index c92b1e68a09..78ab5b246ba 100644 --- a/share/man/man4/pcm.4 +++ b/share/man/man4/pcm.4 @@ -780,14 +780,14 @@ The API evolved from the VOXWARE standard which later became OSS standard. .Sh AUTHORS .An -nosplit -.An Luigi Rizzo Aq luigi@iet.unipi.it +.An Luigi Rizzo Aq Mt luigi@iet.unipi.it initially wrote the .Nm pcm device driver and this manual page. -.An Cameron Grant Aq gandalf@vilnya.demon.co.uk +.An Cameron Grant Aq Mt gandalf@vilnya.demon.co.uk later revised the device driver for .Fx 4.0 . -.An Seigo Tanimura Aq tanimura@r.dl.itc.u-tokyo.ac.jp +.An Seigo Tanimura Aq Mt tanimura@r.dl.itc.u-tokyo.ac.jp revised this manual page. It was then rewritten for .Fx 5.2 . diff --git a/share/man/man4/pcn.4 b/share/man/man4/pcn.4 index b86e4fb4f11..619f2079259 100644 --- a/share/man/man4/pcn.4 +++ b/share/man/man4/pcn.4 @@ -188,4 +188,4 @@ device driver first appeared in The .Nm driver was written by -.An Bill Paul Aq wpaul@osd.bsdi.com . +.An Bill Paul Aq Mt wpaul@osd.bsdi.com . diff --git a/share/man/man4/polling.4 b/share/man/man4/polling.4 index 6abc37cbb34..2d9018cb3de 100644 --- a/share/man/man4/polling.4 +++ b/share/man/man4/polling.4 @@ -219,4 +219,4 @@ and .Fx 5.0 . .Sh AUTHORS Device polling was written by -.An Luigi Rizzo Aq luigi@iet.unipi.it . +.An Luigi Rizzo Aq Mt luigi@iet.unipi.it . diff --git a/share/man/man4/procdesc.4 b/share/man/man4/procdesc.4 index e6895b0d68e..ec8c827f29e 100644 --- a/share/man/man4/procdesc.4 +++ b/share/man/man4/procdesc.4 @@ -77,13 +77,13 @@ and was developed at the University of Cambridge. .Nm was developed by .An -nosplit -.An "Robert Watson" Aq rwatson@FreeBSD.org +.An Robert Watson Aq Mt rwatson@FreeBSD.org and -.An "Jonathan Anderson" Aq jonathan@FreeBSD.org +.An Jonathan Anderson Aq Mt jonathan@FreeBSD.org at the University of Cambridge, and -.An "Ben Laurie" Aq benl@FreeBSD.org +.An Ben Laurie Aq Mt benl@FreeBSD.org and -.An "Kris Kennaway" Aq kris@FreeBSD.org +.An Kris Kennaway Aq Mt kris@FreeBSD.org at Google, Inc. .Sh BUGS .Nm diff --git a/share/man/man4/proto.4 b/share/man/man4/proto.4 index f0fd60a8858..ead546b2320 100644 --- a/share/man/man4/proto.4 +++ b/share/man/man4/proto.4 @@ -76,6 +76,7 @@ with .Pa pci::: representing the location of the PCI device in the PCI hierarchy. A location includes: +.Pp .Bl -tag -width XXXXXX -compact .It The PCI domain number @@ -101,11 +102,17 @@ representing I/O port or memory mapped I/O space (resp.) .Sh EXAMPLES A single function PCI device in domain 0, on bus 1, in slot 2 and having a single memory mapped I/O region will have the following device special files: -.Bl -tag -compact +.Pp +.Bl -tag -width XXXXXX -compact .It Pa /dev/proto/pci0:1:2:0/10.mem .It Pa /dev/proto/pci0:1:2:0/pcicfg .El -.\" +.\" +.Sh AUTHORS +The +.Nm +device driver and this manual page were written by +.An Marcel Moolenaar Aq Mt marcel@xcllnt.net . .Sh SECURITY CONSIDERATIONS Because programs have direct access to the hardware, the .Nm @@ -126,9 +133,3 @@ The details of how a program can set up and initiate DMA still need to be fleshed out. .Pp Support for non-PCI devices has not been implemented yet. -.\" -.Sh AUTHORS -The -.Nm -device driver and this manual page were written by -.An Marcel Moolenaar Aq marcel@xcllnt.net . diff --git a/share/man/man4/psm.4 b/share/man/man4/psm.4 index 6ecb65c8597..866e44747ef 100644 --- a/share/man/man4/psm.4 +++ b/share/man/man4/psm.4 @@ -833,7 +833,7 @@ and to name the few. .Pp This manual page was written by -.An Kazutaka Yokota Aq yokota@FreeBSD.org . +.An Kazutaka Yokota Aq Mt yokota@FreeBSD.org . .Sh CAVEATS Many pad devices behave as if the first (left) button were pressed if the user `taps' the surface of the pad. diff --git a/share/man/man4/pst.4 b/share/man/man4/pst.4 index 3ce95d85889..54975773131 100644 --- a/share/man/man4/pst.4 +++ b/share/man/man4/pst.4 @@ -72,5 +72,4 @@ driver first appeared in The .Nm driver and man page was written by -.An S\(/oren Schmidt -.Aq sos@FreeBSD.org . +.An S\(/oren Schmidt Aq Mt sos@FreeBSD.org . diff --git a/share/man/man4/qlxgb.4 b/share/man/man4/qlxgb.4 index c76386f540a..c1e87e307d8 100644 --- a/share/man/man4/qlxgb.4 +++ b/share/man/man4/qlxgb.4 @@ -72,7 +72,7 @@ For support questions please contact your QLogic approved reseller or QLogic Technical Support at .Pa http://support.qlogic.com , or by E-mail at -.Aq support@qlogic.com . +.Aq Mt support@qlogic.com . .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , diff --git a/share/man/man4/qlxgbe.4 b/share/man/man4/qlxgbe.4 index 888a5751157..32b7d34af85 100644 --- a/share/man/man4/qlxgbe.4 +++ b/share/man/man4/qlxgbe.4 @@ -70,7 +70,7 @@ For support questions please contact your QLogic approved reseller or QLogic Technical Support at .Pa http://support.qlogic.com , or by E-mail at -.Aq support@qlogic.com . +.Aq Mt support@qlogic.com . .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , diff --git a/share/man/man4/qlxge.4 b/share/man/man4/qlxge.4 index 01d2c059575..21e6ce16c48 100644 --- a/share/man/man4/qlxge.4 +++ b/share/man/man4/qlxge.4 @@ -70,7 +70,7 @@ For support questions please contact your QLogic approved reseller or QLogic Technical Support at .Pa http://support.qlogic.com , or by E-mail at -.Aq support@qlogic.com . +.Aq Mt support@qlogic.com . .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , diff --git a/share/man/man4/ral.4 b/share/man/man4/ral.4 index f2a2bd18590..c99902aca12 100644 --- a/share/man/man4/ral.4 +++ b/share/man/man4/ral.4 @@ -271,7 +271,7 @@ Support for the RT3090 chipset was added in The original .Nm driver was written by -.An Damien Bergamini Aq damien@openbsd.org . +.An Damien Bergamini Aq Mt damien@openbsd.org . .Sh CAVEATS The .Nm diff --git a/share/man/man4/rc.4 b/share/man/man4/rc.4 index 60c4fa501f0..c2ab34a8bc0 100644 --- a/share/man/man4/rc.4 +++ b/share/man/man4/rc.4 @@ -109,7 +109,7 @@ This manual page first appeared in .Fx 5.3 . .Sh AUTHORS This manual page was written by -.An Tom Rhodes Aq trhodes@FreeBSD.org . +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org . .Sh BUGS The .Nm diff --git a/share/man/man4/re.4 b/share/man/man4/re.4 index bd720f47fc1..e5fc7b05a0d 100644 --- a/share/man/man4/re.4 +++ b/share/man/man4/re.4 @@ -253,7 +253,7 @@ device driver first appeared in The .Nm driver was written by -.An Bill Paul Aq wpaul@windriver.com . +.An Bill Paul Aq Mt wpaul@windriver.com . .Sh BUGS The Xterasys XN-152 32-bit PCI NIC, which uses the RTL8169 MAC and Marvell 88E1000 PHY, has a defect that causes DMA corruption diff --git a/share/man/man4/rights.4 b/share/man/man4/rights.4 index 5819677db20..476b15bad1d 100644 --- a/share/man/man4/rights.4 +++ b/share/man/man4/rights.4 @@ -667,8 +667,8 @@ Project. .Sh AUTHORS .An -nosplit This manual page was created by -.An Pawel Jakub Dawidek Aq pawel@dawidek.net +.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net under sponsorship from the FreeBSD Foundation based on the .Xr cap_new 2 manual page by -.An "Robert Watson" Aq rwatson@FreeBSD.org . +.An Robert Watson Aq Mt rwatson@FreeBSD.org . diff --git a/share/man/man4/rl.4 b/share/man/man4/rl.4 index 583274bf832..0de968fb6c6 100644 --- a/share/man/man4/rl.4 +++ b/share/man/man4/rl.4 @@ -273,7 +273,7 @@ device driver first appeared in The .Nm driver was written by -.An Bill Paul Aq wpaul@ctr.columbia.edu . +.An Bill Paul Aq Mt wpaul@ctr.columbia.edu . .Sh BUGS Since outbound packets must be longword aligned, the transmit routine has to copy an unaligned packet into an mbuf cluster buffer diff --git a/share/man/man4/rp.4 b/share/man/man4/rp.4 index a894f1242c7..d8a130c810b 100644 --- a/share/man/man4/rp.4 +++ b/share/man/man4/rp.4 @@ -169,15 +169,15 @@ Off Off Off Off 380-3C3 .It Pa /dev/ttyR[0-4][0-9a-f] .El .Sh AUTHORS -.An Theodore Ts'o Aq tytso@mit.edu +.An Theodore Ts'o Aq Mt tytso@mit.edu .Pp This driver was written under contract for Comtrol Corporation. For dealer, distributor and other information regarding Comtrol .Tn RocketPort , contact Comtrol Corporation at (800) 926-6876 or send email to -.Aq info@comtrol.com . +.Aq Mt info@comtrol.com . To report bugs for this driver, please send email to -.Aq bug-bsdi-rocketport@comtrol.com . +.Aq Mt bug-bsdi-rocketport@comtrol.com . .Sh BUGS If incoming software flow control is enabled on a 486 or Pentium machine, and the flow control is very heavily exercised, on rare occasions diff --git a/share/man/man4/rsu.4 b/share/man/man4/rsu.4 index e26e3588fe8..be4aad9b9cc 100644 --- a/share/man/man4/rsu.4 +++ b/share/man/man4/rsu.4 @@ -171,9 +171,9 @@ driver first appeared in The .Nm driver was written by -.An Damien Bergamini Aq damien@openbsd.org +.An Damien Bergamini Aq Mt damien@openbsd.org and ported by -.An Rui Paulo Aq rpaulo@freebsd.org . +.An Rui Paulo Aq Mt rpaulo@freebsd.org . .Sh CAVEATS The .Nm diff --git a/share/man/man4/rue.4 b/share/man/man4/rue.4 index 06f91e8a0a0..7450ccf9761 100644 --- a/share/man/man4/rue.4 +++ b/share/man/man4/rue.4 @@ -151,4 +151,4 @@ device driver first appeared in The .Nm driver was written by -.An Shunsuke Akiyama Aq akiyama@FreeBSD.org . +.An Shunsuke Akiyama Aq Mt akiyama@FreeBSD.org . diff --git a/share/man/man4/rum.4 b/share/man/man4/rum.4 index 6e456894175..3abcbcad876 100644 --- a/share/man/man4/rum.4 +++ b/share/man/man4/rum.4 @@ -175,12 +175,13 @@ The driver first appeared in .Ox 4.0 . .Sh AUTHORS +.An -nosplit The original .Nm driver was written by -.An Niall O'Higgins Aq niallo@openbsd.org +.An Niall O'Higgins Aq Mt niallo@openbsd.org and -.An Damien Bergamini Aq damien@openbsd.org . +.An Damien Bergamini Aq Mt damien@openbsd.org . .Sh BUGS Host AP mode doesn't support client power save. Clients using power save mode will experience diff --git a/share/man/man4/run.4 b/share/man/man4/run.4 index f86a2968653..52ce5442bc7 100644 --- a/share/man/man4/run.4 +++ b/share/man/man4/run.4 @@ -244,7 +244,7 @@ driver first appeared in The .Nm driver was written by -.An Damien Bergamini Aq damien@openbsd.org . +.An Damien Bergamini Aq Mt damien@openbsd.org . .Sh CAVEATS The .Nm diff --git a/share/man/man4/scc.4 b/share/man/man4/scc.4 index b08b3f8dbac..80072f55d69 100644 --- a/share/man/man4/scc.4 +++ b/share/man/man4/scc.4 @@ -72,4 +72,4 @@ device driver first appeared in The .Nm driver and this manual page were written by -.An Marcel Moolenaar Aq marcel@xcllnt.net . +.An Marcel Moolenaar Aq Mt marcel@xcllnt.net . diff --git a/share/man/man4/sched_ule.4 b/share/man/man4/sched_ule.4 index 42dee4de8a6..7ba18d361a3 100644 --- a/share/man/man4/sched_ule.4 +++ b/share/man/man4/sched_ule.4 @@ -72,5 +72,4 @@ The scheduler first appeared in .Fx 5.1 . .Sh AUTHORS -.An Jeff Roberson -.Aq jeff@FreeBSD.org +.An Jeff Roberson Aq Mt jeff@FreeBSD.org diff --git a/share/man/man4/screen.4 b/share/man/man4/screen.4 index 0b6ac2d9313..2e08d28e975 100644 --- a/share/man/man4/screen.4 +++ b/share/man/man4/screen.4 @@ -238,4 +238,4 @@ SGR E[nm Set character attributes: -- note: the first E in the sequences stands for ESC (0x1b) .Ed .Sh AUTHORS -.An S\(/oren Schmidt Aq sos@FreeBSD.org +.An S\(/oren Schmidt Aq Mt sos@FreeBSD.org diff --git a/share/man/man4/scsi.4 b/share/man/man4/scsi.4 index 868430708ea..7c786ea8888 100644 --- a/share/man/man4/scsi.4 +++ b/share/man/man4/scsi.4 @@ -351,4 +351,4 @@ The .Nm .Tn ATA support was added by -.An Alexander Motin Aq mav@FreeBSD.org . +.An Alexander Motin Aq Mt mav@FreeBSD.org . diff --git a/share/man/man4/sdhci.4 b/share/man/man4/sdhci.4 index 6adfd81a382..8fd16ff8a84 100644 --- a/share/man/man4/sdhci.4 +++ b/share/man/man4/sdhci.4 @@ -80,7 +80,7 @@ TI PCIXX21/XX11 .%T "SD Specifications, Part 2, SD Host Controller, Simplified Specification" .Re .Sh AUTHORS -.An Alexander Motin Aq mav@FreeBSD.org . +.An Alexander Motin Aq Mt mav@FreeBSD.org .Sh BUGS Many of existing SD controller chips have some nonstandard requirements, proprietary registers and hardware bugs, requiring additional handling. diff --git a/share/man/man4/send.4 b/share/man/man4/send.4 index 3f90eafe44f..4af510aa729 100644 --- a/share/man/man4/send.4 +++ b/share/man/man4/send.4 @@ -206,7 +206,7 @@ The module first appeared in .Fx 9.0 . .Sh AUTHORS -.An Ana Kukec Aq anchie@FreeBSD.org , +.An Ana Kukec Aq Mt anchie@FreeBSD.org , University of Zagreb .Sh BUGS Due to the lack of NDP locking, it is currently not possible to unload the diff --git a/share/man/man4/sf.4 b/share/man/man4/sf.4 index 80ba44e19bf..a32df916887 100644 --- a/share/man/man4/sf.4 +++ b/share/man/man4/sf.4 @@ -206,4 +206,4 @@ device driver first appeared in The .Nm driver was written by -.An Bill Paul Aq wpaul@ctr.columbia.edu . +.An Bill Paul Aq Mt wpaul@ctr.columbia.edu . diff --git a/share/man/man4/sge.4 b/share/man/man4/sge.4 index 70d839e6adc..0322169b6e7 100644 --- a/share/man/man4/sge.4 +++ b/share/man/man4/sge.4 @@ -112,10 +112,8 @@ SiS191 Fast/Gigabit Ethernet controller The .Nm driver was written by -.An Alexander Pohoyda -.Aq alexander.pohoyda@gmx.net . +.An Alexander Pohoyda Aq Mt alexander.pohoyda@gmx.net . And enhanced by -.An Nikolay Denev -.Aq ndenev@gmail.com . +.An Nikolay Denev Aq Mt ndenev@gmail.com . It first appeared in .Fx 8.1 . diff --git a/share/man/man4/si.4 b/share/man/man4/si.4 index 5eb7629d979..1f008859702 100644 --- a/share/man/man4/si.4 +++ b/share/man/man4/si.4 @@ -144,22 +144,22 @@ locked termios state devices for dialout ports .Sh HISTORY This driver is loosely based on driver code originating at Specialix, which was ported to run on BSDI by -.An Andy Rutter Aq andy@specialix.co.uk . +.An Andy Rutter Aq Mt andy@specialix.co.uk . The System V driver source is/was available by ftp from .Sy ftp.specialix.co.uk . .Pp This driver is not supported by Specialix International. .Sh AUTHORS .An -nosplit -.An Peter Wemm Aq peter@netplex.com.au +.An Peter Wemm Aq Mt peter@netplex.com.au obtained the code from .An Andy Rutter and ported it to .Fx and threw the man page together. -.An Bruce Evans Aq bde@zeta.org.au +.An Bruce Evans Aq Mt bde@zeta.org.au provided a large amount of assistance during porting. -.An Nick Sayer Aq nick@specialix.com +.An Nick Sayer Aq Mt nick@specialix.com wrote the EISA, PCI and SX portions. .Sh BUGS The interrupt tuning rate is not believed to be optimal at this time for diff --git a/share/man/man4/siba.4 b/share/man/man4/siba.4 index 288a13f1a14..6f855d413f8 100644 --- a/share/man/man4/siba.4 +++ b/share/man/man4/siba.4 @@ -81,10 +81,8 @@ device driver first appeared in The .Nm driver was written by -.An Bruce M. Simpson -.Aq bms@FreeBSD.org +.An Bruce M. Simpson Aq Mt bms@FreeBSD.org and -.An Weongyo Jeong -.Aq weongyo@FreeBSD.org . +.An Weongyo Jeong Aq Mt weongyo@FreeBSD.org . .Sh CAVEATS Host mode is not supported at this moment. diff --git a/share/man/man4/siftr.4 b/share/man/man4/siftr.4 index ab92f77b94e..4f29c115f34 100644 --- a/share/man/man4/siftr.4 +++ b/share/man/man4/siftr.4 @@ -642,12 +642,12 @@ http://caia.swin.edu.au/freebsd/etcp09/ .An -nosplit .Nm was written by -.An Lawrence Stewart Aq lstewart@FreeBSD.org +.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org and -.An James Healy Aq jimmy@deefa.com . +.An James Healy Aq Mt jimmy@deefa.com . .Pp This manual page was written by -.An Lawrence Stewart Aq lstewart@FreeBSD.org . +.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org . .Sh BUGS Current known limitations and any relevant workarounds are outlined below: .Bl -dash diff --git a/share/man/man4/siis.4 b/share/man/man4/siis.4 index 366c3ccc539..4bf97c22e3c 100644 --- a/share/man/man4/siis.4 +++ b/share/man/man4/siis.4 @@ -138,4 +138,4 @@ The driver first appeared in .Fx 8.0 . .Sh AUTHORS -.An Alexander Motin Aq mav@FreeBSD.org . +.An Alexander Motin Aq Mt mav@FreeBSD.org diff --git a/share/man/man4/sis.4 b/share/man/man4/sis.4 index 414f0d8d726..66eadc5c286 100644 --- a/share/man/man4/sis.4 +++ b/share/man/man4/sis.4 @@ -223,4 +223,4 @@ device driver first appeared in The .Nm driver was written by -.An Bill Paul Aq wpaul@ee.columbia.edu . +.An Bill Paul Aq Mt wpaul@ee.columbia.edu . diff --git a/share/man/man4/sk.4 b/share/man/man4/sk.4 index 18e53a94945..d78eafeb134 100644 --- a/share/man/man4/sk.4 +++ b/share/man/man4/sk.4 @@ -238,4 +238,4 @@ device driver first appeared in The .Nm driver was written by -.An Bill Paul Aq wpaul@ctr.columbia.edu . +.An Bill Paul Aq Mt wpaul@ctr.columbia.edu . diff --git a/share/man/man4/smp.4 b/share/man/man4/smp.4 index 1dfd283e45d..a1b8c09f313 100644 --- a/share/man/man4/smp.4 +++ b/share/man/man4/smp.4 @@ -39,7 +39,7 @@ kernel implements symmetric multi-processor support. Support for multi-processor systems is present for all Tier-1 architectures on .Fx . -Currently, this includes amd64, i386, ia64, and sparc64. +Currently, this includes amd64, i386 and sparc64. Support is enabled using .Cd options SMP . It is permissible to use the SMP kernel configuration on non-SMP equipped @@ -158,6 +158,6 @@ in .Bsx . .Pp .Fx 5.0 -also introduced support for SMP on the ia64 and sparc64 architectures. +also introduced support for SMP on the sparc64 architecture. .Sh AUTHORS -.An Steve Passe Aq fsmp@FreeBSD.org +.An Steve Passe Aq Mt fsmp@FreeBSD.org diff --git a/share/man/man4/snd_ad1816.4 b/share/man/man4/snd_ad1816.4 index 3d2cb0c444a..2bc5a46aa56 100644 --- a/share/man/man4/snd_ad1816.4 +++ b/share/man/man4/snd_ad1816.4 @@ -76,6 +76,6 @@ The device driver first appeared in .Fx 4.0 . .Sh AUTHORS -.An "Cameron Grant" Aq cg@FreeBSD.org -.An "Luigi Rizzo" Aq luigi@FreeBSD.org +.An Cameron Grant Aq Mt cg@FreeBSD.org +.An Luigi Rizzo Aq Mt luigi@FreeBSD.org .An "Hannu Savolainen" diff --git a/share/man/man4/snd_als4000.4 b/share/man/man4/snd_als4000.4 index a13779a2904..fbf63f4a5de 100644 --- a/share/man/man4/snd_als4000.4 +++ b/share/man/man4/snd_als4000.4 @@ -67,4 +67,4 @@ The device driver first appeared in .Fx 4.4 . .Sh AUTHORS -.An "Orion Hodson" Aq oho@acm.org +.An Orion Hodson Aq Mt oho@acm.org diff --git a/share/man/man4/snd_atiixp.4 b/share/man/man4/snd_atiixp.4 index ba02da648bd..45c65f98498 100644 --- a/share/man/man4/snd_atiixp.4 +++ b/share/man/man4/snd_atiixp.4 @@ -89,7 +89,7 @@ device driver first appeared in .Fx 6.1 . .Sh AUTHORS This manual page was written by -.An Joel Dahl Aq joel@FreeBSD.org . +.An Joel Dahl Aq Mt joel@FreeBSD.org . .Sh BUGS The .Nm diff --git a/share/man/man4/snd_cmi.4 b/share/man/man4/snd_cmi.4 index d6dc088215c..35aded63bbd 100644 --- a/share/man/man4/snd_cmi.4 +++ b/share/man/man4/snd_cmi.4 @@ -73,4 +73,4 @@ The device driver first appeared in .Fx 4.3 . .Sh AUTHORS -.An "Orion Hodson" Aq O.Hodson@cs.ucl.ac.uk +.An Orion Hodson Aq Mt O.Hodson@cs.ucl.ac.uk diff --git a/share/man/man4/snd_cs4281.4 b/share/man/man4/snd_cs4281.4 index 2b94174dde5..ee7b4ddc089 100644 --- a/share/man/man4/snd_cs4281.4 +++ b/share/man/man4/snd_cs4281.4 @@ -67,4 +67,4 @@ The device driver first appeared in .Fx 4.3 . .Sh AUTHORS -.An "Orion Hodson" Aq O.Hodson@cs.ucl.ac.uk +.An Orion Hodson Aq Mt O.Hodson@cs.ucl.ac.uk diff --git a/share/man/man4/snd_csa.4 b/share/man/man4/snd_csa.4 index 36a6857e8ff..ed0fb76dd00 100644 --- a/share/man/man4/snd_csa.4 +++ b/share/man/man4/snd_csa.4 @@ -95,4 +95,4 @@ The device driver first appeared in .Fx 4.0 . .Sh AUTHORS -.An Seigo Tanimura Aq tanimura@r.dl.itc.u-tokyo.ac.jp +.An Seigo Tanimura Aq Mt tanimura@r.dl.itc.u-tokyo.ac.jp diff --git a/share/man/man4/snd_ds1.4 b/share/man/man4/snd_ds1.4 index d6919244c80..2d3491366ff 100644 --- a/share/man/man4/snd_ds1.4 +++ b/share/man/man4/snd_ds1.4 @@ -69,4 +69,4 @@ The device driver first appeared in .Fx 4.1 . .Sh AUTHORS -.An "Cameron Grant" Aq cg@FreeBSD.org +.An Cameron Grant Aq Mt cg@FreeBSD.org diff --git a/share/man/man4/snd_emu10k1.4 b/share/man/man4/snd_emu10k1.4 index 3052f1238bb..1d4a8603a4e 100644 --- a/share/man/man4/snd_emu10k1.4 +++ b/share/man/man4/snd_emu10k1.4 @@ -75,8 +75,8 @@ The device driver first appeared in .Fx 4.1 . .Sh AUTHORS -.An "David O'Brien" Aq obrien@FreeBSD.org -.An "Orlando Bassotto" Aq orlando.bassotto@ieo-research.it -.An "Cameron Grant" Aq cg@FreeBSD.org +.An David O'Brien Aq Mt obrien@FreeBSD.org +.An Orlando Bassotto Aq Mt orlando.bassotto@ieo-research.it +.An Cameron Grant Aq Mt cg@FreeBSD.org .Sh BUGS Fancy features like DD5.1 output are not supported. diff --git a/share/man/man4/snd_emu10kx.4 b/share/man/man4/snd_emu10kx.4 index 72568c3ffec..690727416f5 100644 --- a/share/man/man4/snd_emu10kx.4 +++ b/share/man/man4/snd_emu10kx.4 @@ -275,11 +275,11 @@ device driver first appeared in The PCM part of the driver is based on the .Xr snd_emu10k1 4 SB Live!\& driver by -.An Cameron Grant Aq cg@FreeBSD.org . +.An Cameron Grant Aq Mt cg@FreeBSD.org . The MIDI interface is based on the .Xr snd_emu10k1 4 MIDI interface code by -.An Mathew Kanner Aq matk@FreeBSD.org . +.An Mathew Kanner Aq Mt matk@FreeBSD.org . The .Nm device driver and this manual page were written by diff --git a/share/man/man4/snd_envy24.4 b/share/man/man4/snd_envy24.4 index 30f13341c45..5844d920cf0 100644 --- a/share/man/man4/snd_envy24.4 +++ b/share/man/man4/snd_envy24.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 30, 2006 +.Dd June 1, 2014 .Dt SND_ENVY24 4 .Os .Sh NAME @@ -65,6 +65,8 @@ M-Audio Delta Dio 2496 .It Terratec DMX 6fire .El +Only analog playback is supported. +Recording and other features of these cards are not supported. .Sh SEE ALSO .Xr sound 4 .Sh HISTORY @@ -79,4 +81,4 @@ The driver was written by .An Katsurajima Naoto . This manual page was written by -.An Alexander Leidinger Aq netchild@FreeBSD.org . +.An Alexander Leidinger Aq Mt netchild@FreeBSD.org . diff --git a/share/man/man4/snd_envy24ht.4 b/share/man/man4/snd_envy24ht.4 index 807ba6219da..086d5cd8110 100644 --- a/share/man/man4/snd_envy24ht.4 +++ b/share/man/man4/snd_envy24ht.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 28, 2007 +.Dd June 1, 2014 .Dt SND_ENVY24HT 4 .Os .Sh NAME @@ -85,6 +85,8 @@ Terratec PHASE 22 .It Terratec PHASE 28 .El +Only analog playback is supported. +Recording and other features of these cards are not supported. .Sh SEE ALSO .Xr sound 4 .Sh HISTORY @@ -102,4 +104,4 @@ based upon the .Xr snd_envy24 4 driver. This manual page was written by -.An Alexander Leidinger Aq netchild@FreeBSD.org . +.An Alexander Leidinger Aq Mt netchild@FreeBSD.org . diff --git a/share/man/man4/snd_es137x.4 b/share/man/man4/snd_es137x.4 index 9602fcec96e..d00ea5fb9a3 100644 --- a/share/man/man4/snd_es137x.4 +++ b/share/man/man4/snd_es137x.4 @@ -111,7 +111,7 @@ The device driver first appeared in .Fx 4.0 . .Sh AUTHORS -.An "Russell Cattelan" Aq cattelan@thebarn.com -.An "Cameron Grant" Aq cg@FreeBSD.org -.An "Joachim Kuebart" -.An "Jonathan Noack" Aq noackjr@alumni.rice.edu +.An Russell Cattelan Aq Mt cattelan@thebarn.com +.An Cameron Grant Aq Mt cg@FreeBSD.org +.An Joachim Kuebart +.An Jonathan Noack Aq Mt noackjr@alumni.rice.edu diff --git a/share/man/man4/snd_ess.4 b/share/man/man4/snd_ess.4 index bd0d6d75ec0..2b033313008 100644 --- a/share/man/man4/snd_ess.4 +++ b/share/man/man4/snd_ess.4 @@ -68,5 +68,5 @@ The device driver first appeared in .Fx 4.1 . .Sh AUTHORS -.An "Cameron Grant" Aq cg@FreeBSD.org -.An "Luigi Rizzo" Aq luigi@FreeBSD.org +.An Cameron Grant Aq Mt cg@FreeBSD.org +.An Luigi Rizzo Aq Mt luigi@FreeBSD.org diff --git a/share/man/man4/snd_fm801.4 b/share/man/man4/snd_fm801.4 index 0e6650451d5..48807ec3a2f 100644 --- a/share/man/man4/snd_fm801.4 +++ b/share/man/man4/snd_fm801.4 @@ -69,7 +69,7 @@ device driver first appeared in .Fx 4.2 . .Sh AUTHORS This manual page was written by -.An Joel Dahl Aq joel@FreeBSD.org . +.An Joel Dahl Aq Mt joel@FreeBSD.org . .Sh BUGS The Forte Media FM801 chipset is a sort of PCI bridge, not an actual sound controller, making it possible to have soundless support. diff --git a/share/man/man4/snd_gusc.4 b/share/man/man4/snd_gusc.4 index 99df5403e15..1ad73cfef4b 100644 --- a/share/man/man4/snd_gusc.4 +++ b/share/man/man4/snd_gusc.4 @@ -91,7 +91,7 @@ The device driver first appeared in .Fx 4.0 . .Sh AUTHORS -.An Ville-Pertti Keinonen Aq will@iki.fi -.An Seigo Tanimura Aq tanimura@r.dl.itc.u-tokyo.ac.jp +.An Ville-Pertti Keinonen Aq Mt will@iki.fi +.An Seigo Tanimura Aq Mt tanimura@r.dl.itc.u-tokyo.ac.jp .Sh BUGS Recording pcm sound data is not supported yet. diff --git a/share/man/man4/snd_hda.4 b/share/man/man4/snd_hda.4 index 91e599d65da..cdb2a620dbc 100644 --- a/share/man/man4/snd_hda.4 +++ b/share/man/man4/snd_hda.4 @@ -605,15 +605,15 @@ device driver first appeared in The .Nm driver was written by -.An Stephane E. Potvin Aq sepotvin@videotron.ca , -.An Ariff Abdullah Aq ariff@FreeBSD.org +.An Stephane E. Potvin Aq Mt sepotvin@videotron.ca , +.An Ariff Abdullah Aq Mt ariff@FreeBSD.org and -.An Alexander Motin Aq mav@FreeBSD.org . +.An Alexander Motin Aq Mt mav@FreeBSD.org . This manual page was written by -.An Joel Dahl Aq joel@FreeBSD.org , -.An Alexander Motin Aq mav@FreeBSD.org +.An Joel Dahl Aq Mt joel@FreeBSD.org , +.An Alexander Motin Aq Mt mav@FreeBSD.org and -.An Giorgos Keramidas Aq keramida@FreeBSD.org . +.An Giorgos Keramidas Aq Mt keramida@FreeBSD.org . .Sh BUGS Some Hardware/OEM vendors tend to screw up BIOS settings or use custom unusual CODEC wiring that create problems to the driver. diff --git a/share/man/man4/snd_ich.4 b/share/man/man4/snd_ich.4 index c4359c85acc..528d28cb52e 100644 --- a/share/man/man4/snd_ich.4 +++ b/share/man/man4/snd_ich.4 @@ -108,4 +108,4 @@ device driver first appeared in .Fx 4.2 . .Sh AUTHORS This manual page was written by -.An Jorge Mario G. Mazo Aq jgutie11@eafit.edu.co . +.An Jorge Mario G. Mazo Aq Mt jgutie11@eafit.edu.co . diff --git a/share/man/man4/snd_maestro.4 b/share/man/man4/snd_maestro.4 index d630a3324f9..eb74709e98a 100644 --- a/share/man/man4/snd_maestro.4 +++ b/share/man/man4/snd_maestro.4 @@ -75,4 +75,4 @@ device driver first appeared in .Fx 4.2 . .Sh AUTHORS This manual page was written by -.An Jorge Mario G. Mazo Aq jgutie11@eafit.edu.co . +.An Jorge Mario G. Mazo Aq Mt jgutie11@eafit.edu.co . diff --git a/share/man/man4/snd_maestro3.4 b/share/man/man4/snd_maestro3.4 index 4fadd0453ca..fa61a5b6f37 100644 --- a/share/man/man4/snd_maestro3.4 +++ b/share/man/man4/snd_maestro3.4 @@ -90,5 +90,5 @@ The driver first appeared in .Fx 4.3 . .Sh AUTHORS -.An Scott Long Aq scottl@FreeBSD.org -.An Darrel Anderson Aq anderson@cs.duke.edu +.An Scott Long Aq Mt scottl@FreeBSD.org +.An Darrel Anderson Aq Mt anderson@cs.duke.edu diff --git a/share/man/man4/snd_mss.4 b/share/man/man4/snd_mss.4 index 76ef18339c6..1baf1989d23 100644 --- a/share/man/man4/snd_mss.4 +++ b/share/man/man4/snd_mss.4 @@ -113,4 +113,4 @@ device driver first appeared in .Fx 2.2.6 . .Sh AUTHORS This manual page was written by -.An Joel Dahl Aq joel@FreeBSD.org . +.An Joel Dahl Aq Mt joel@FreeBSD.org . diff --git a/share/man/man4/snd_neomagic.4 b/share/man/man4/snd_neomagic.4 index 430220c2315..2865bbba344 100644 --- a/share/man/man4/snd_neomagic.4 +++ b/share/man/man4/snd_neomagic.4 @@ -71,4 +71,4 @@ device driver first appeared in .Fx 4.0 . .Sh AUTHORS This manual page was written by -.An Joel Dahl Aq joel@FreeBSD.org . +.An Joel Dahl Aq Mt joel@FreeBSD.org . diff --git a/share/man/man4/snd_sbc.4 b/share/man/man4/snd_sbc.4 index 8b53c8eb9ea..227080c65be 100644 --- a/share/man/man4/snd_sbc.4 +++ b/share/man/man4/snd_sbc.4 @@ -129,4 +129,4 @@ The device driver first appeared in .Fx 4.0 . .Sh AUTHORS -.An Seigo Tanimura Aq tanimura@r.dl.itc.u-tokyo.ac.jp +.An Seigo Tanimura Aq Mt tanimura@r.dl.itc.u-tokyo.ac.jp diff --git a/share/man/man4/snd_solo.4 b/share/man/man4/snd_solo.4 index 55e12fc002c..c694cc5c78b 100644 --- a/share/man/man4/snd_solo.4 +++ b/share/man/man4/snd_solo.4 @@ -63,4 +63,4 @@ The device driver first appeared in .Fx 4.1 . .Sh AUTHORS -.An "Cameron Grant" Aq cg@FreeBSD.org +.An Cameron Grant Aq Mt cg@FreeBSD.org diff --git a/share/man/man4/snd_spicds.4 b/share/man/man4/snd_spicds.4 index 7b95b8689bd..aea0c56e093 100644 --- a/share/man/man4/snd_spicds.4 +++ b/share/man/man4/snd_spicds.4 @@ -86,4 +86,4 @@ based upon the .Xr snd_envy24 4 driver. This manual page was written by -.An Alexander Leidinger Aq netchild@FreeBSD.org . +.An Alexander Leidinger Aq Mt netchild@FreeBSD.org . diff --git a/share/man/man4/snd_t4dwave.4 b/share/man/man4/snd_t4dwave.4 index ef916659115..c96eefb1b6d 100644 --- a/share/man/man4/snd_t4dwave.4 +++ b/share/man/man4/snd_t4dwave.4 @@ -74,4 +74,4 @@ device driver first appeared in .Fx 4.0 . .Sh AUTHORS This manual page was written by -.An Joel Dahl Aq joel@FreeBSD.org . +.An Joel Dahl Aq Mt joel@FreeBSD.org . diff --git a/share/man/man4/snd_uaudio.4 b/share/man/man4/snd_uaudio.4 index b045851692b..d1049471a7b 100644 --- a/share/man/man4/snd_uaudio.4 +++ b/share/man/man4/snd_uaudio.4 @@ -86,7 +86,7 @@ This manual page was adopted from and modified for .Fx by -.An Hiten Pandya Aq hmp@FreeBSD.org . +.An Hiten Pandya Aq Mt hmp@FreeBSD.org . .Sh BUGS The .Tn PCM diff --git a/share/man/man4/snd_via8233.4 b/share/man/man4/snd_via8233.4 index 377fbd3ee0b..5637701beb3 100644 --- a/share/man/man4/snd_via8233.4 +++ b/share/man/man4/snd_via8233.4 @@ -95,7 +95,7 @@ device driver first appeared in .Fx 4.7 . .Sh AUTHORS This manual page was written by -.An Joel Dahl Aq joel@FreeBSD.org . +.An Joel Dahl Aq Mt joel@FreeBSD.org . .Sh BUGS The .Nm diff --git a/share/man/man4/snd_via82c686.4 b/share/man/man4/snd_via82c686.4 index 183684ec117..85c6c18e0b8 100644 --- a/share/man/man4/snd_via82c686.4 +++ b/share/man/man4/snd_via82c686.4 @@ -68,4 +68,4 @@ device driver first appeared in .Fx 4.2 . .Sh AUTHORS This manual page was written by -.An Joel Dahl Aq joel@FreeBSD.org . +.An Joel Dahl Aq Mt joel@FreeBSD.org . diff --git a/share/man/man4/snd_vibes.4 b/share/man/man4/snd_vibes.4 index 716a65cd299..9db6f0fe5b6 100644 --- a/share/man/man4/snd_vibes.4 +++ b/share/man/man4/snd_vibes.4 @@ -68,4 +68,4 @@ device driver first appeared in .Fx 4.4 . .Sh AUTHORS This manual page was written by -.An Joel Dahl Aq joel@FreeBSD.org . +.An Joel Dahl Aq Mt joel@FreeBSD.org . diff --git a/share/man/man4/snp.4 b/share/man/man4/snp.4 index 2545164436a..48e10a951b9 100644 --- a/share/man/man4/snp.4 +++ b/share/man/man4/snp.4 @@ -83,12 +83,13 @@ the .Nm driver was rewritten to work with the replaced TTY subsystem. .Sh AUTHORS +.An -nosplit The author of the current implementation is -.An Ed Schouten Aq ed@FreeBSD.org . +.An Ed Schouten Aq Mt ed@FreeBSD.org . Previous versions of .Nm were based on code written by -.An Ugen J.S. Antsilevich Aq ugen@NetVision.net.il . +.An Ugen J.S. Antsilevich Aq Mt ugen@NetVision.net.il . .Sh BUGS This version of .Nm diff --git a/share/man/man4/spic.4 b/share/man/man4/spic.4 index a398007f88e..5bbf53bb8be 100644 --- a/share/man/man4/spic.4 +++ b/share/man/man4/spic.4 @@ -57,5 +57,5 @@ The device driver first appeared in .Fx 4.6 . .Sh AUTHORS -.An Nick Sayer Aq nsayer@FreeBSD.org -.An Will Andrews Aq will@FreeBSD.org +.An Nick Sayer Aq Mt nsayer@FreeBSD.org +.An Will Andrews Aq Mt will@FreeBSD.org diff --git a/share/man/man4/spkr.4 b/share/man/man4/spkr.4 index 1f39a1eec0e..c1f0894cd5d 100644 --- a/share/man/man4/spkr.4 +++ b/share/man/man4/spkr.4 @@ -222,10 +222,10 @@ The device appeared in .Fx 1.0 . .Sh AUTHORS -.An Eric S. Raymond Aq esr@snark.thyrsus.com +.An Eric S. Raymond Aq Mt esr@snark.thyrsus.com , June 1990 -.Sh "PORTED BY" -.An Andrew A. Chernov Aq ache@astral.msk.su +.Sh PORTED BY +.An Andrew A. Chernov Aq Mt ache@astral.msk.su .Sh BUGS Due to roundoff in the pitch tables and slop in the tone-generation and timer hardware (neither of which was designed for precision), neither pitch accuracy diff --git a/share/man/man4/splash.4 b/share/man/man4/splash.4 index 2a9a2970c05..6cbccf3d966 100644 --- a/share/man/man4/splash.4 +++ b/share/man/man4/splash.4 @@ -259,24 +259,24 @@ driver first appeared in The .Nm driver and this manual page were written by -.An Kazutaka Yokota Aq yokota@FreeBSD.org . +.An Kazutaka Yokota Aq Mt yokota@FreeBSD.org . The .Pa splash_bmp module was written by -.An Michael Smith Aq msmith@FreeBSD.org +.An Michael Smith Aq Mt msmith@FreeBSD.org and .An Kazutaka Yokota . The .Pa splash_pcx module was written by -.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org +.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org based on the .Pa splash_bmp code. The .Pa splash_txt module was written by -.An Antony Mawer Aq antony@mawer.org +.An Antony Mawer Aq Mt antony@mawer.org based on the .Pa splash_bmp code, with some additional inspiration from the diff --git a/share/man/man4/sppp.4 b/share/man/man4/sppp.4 index 519120f4fda..00700d8bcb9 100644 --- a/share/man/man4/sppp.4 +++ b/share/man/man4/sppp.4 @@ -204,9 +204,8 @@ take place. The original implementation of .Nm was written in 1994 at Cronyx Ltd., Moscow by -.An Serge Vakulenko Aq vak@cronyx.ru . -.An J\(:org Wunsch -.Aq joerg_wunsch@uriah.heep.sax.de +.An Serge Vakulenko Aq Mt vak@cronyx.ru . +.An J\(:org Wunsch Aq Mt joerg_wunsch@uriah.heep.sax.de rewrote a large part in 1997 in order to fully implement the state machine as described in RFC 1661, so it could also be used for dialup lines. diff --git a/share/man/man4/ste.4 b/share/man/man4/ste.4 index 22982b1db22..60f7e4336d0 100644 --- a/share/man/man4/ste.4 +++ b/share/man/man4/ste.4 @@ -201,4 +201,4 @@ device driver first appeared in The .Nm driver was written by -.An Bill Paul Aq wpaul@ee.columbia.edu . +.An Bill Paul Aq Mt wpaul@ee.columbia.edu . diff --git a/share/man/man4/stge.4 b/share/man/man4/stge.4 index bfcaab0533c..527d241aa81 100644 --- a/share/man/man4/stge.4 +++ b/share/man/man4/stge.4 @@ -192,11 +192,9 @@ and first appeared in The .Nx version was written by -.An Jason R. Thorpe -.Aq thorpej@NetBSD.org . +.An Jason R. Thorpe Aq Mt thorpej@NetBSD.org . .Sh AUTHORS The .Nm driver was ported by -.An Pyun YongHyeon -.Aq yongari@FreeBSD.org . +.An Pyun YongHyeon Aq Mt yongari@FreeBSD.org . diff --git a/share/man/man4/syncache.4 b/share/man/man4/syncache.4 index 45dcf2c9b8b..b212b12cde9 100644 --- a/share/man/man4/syncache.4 +++ b/share/man/man4/syncache.4 @@ -212,4 +212,4 @@ then further extended here. The .Nm code and manual page were written by -.An Jonathan Lemon Aq jlemon@FreeBSD.org . +.An Jonathan Lemon Aq Mt jlemon@FreeBSD.org . diff --git a/share/man/man4/syscons.4 b/share/man/man4/syscons.4 index d9400c91fbc..8653c79d125 100644 --- a/share/man/man4/syscons.4 +++ b/share/man/man4/syscons.4 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 11, 2009 +.Dd July 3, 2014 .Dt SYSCONS 4 .Os .Sh NAME @@ -62,6 +62,10 @@ In .Pa /boot/device.hints : .Cd hint.sc.0.at="isa" .Cd hint.sc.0.vesa_mode=0x103 +.Pp +In +.Pa /boot/loader.conf : +.Cd kern.vty=sc .Sh DESCRIPTION The .Nm @@ -403,7 +407,9 @@ option too. The following driver flags can be used to control the .Nm driver. -They can be set either in +Driver flags can be set with the +.Cd hint.sc.0.flags +tunable, either in .Pa /boot/device.hints , or else at the loader prompt (see .Xr loader 8 ) . @@ -446,6 +452,26 @@ This option instructs the syscons driver to periodically scan for a keyboard device if it is not currently attached to one. Otherwise, the driver only probes for a keyboard once during bootup. .El +.Ss Loader Tunables +These settings can be entered at the +.Xr loader 8 +prompt or in +.Xr loader.conf 5 . +.Bl -tag -width indent +.It Va kern.vty +When both +.Nm +and +.Xr vt 4 +have been compiled into the kernel, the one to use for the system console can +be selected by setting this variable to +.Ql sc +or +.Ql vt . +If not set, +.Nm +provides the default system console. +.El .Sh FILES .Bl -tag -width /usr/share/syscons/xxxxyyyyzzz -compact .It Pa /dev/console @@ -533,6 +559,7 @@ to the kernel. .Xr splash 4 , .Xr ukbd 4 , .Xr vga 4 , +.Xr vt 4 , .Xr kbdmap 5 , .Xr rc.conf 5 , .Xr ttys 5 , @@ -550,9 +577,9 @@ driver first appeared in The .Nm driver was written by -.An S\(/oren Schmidt Aq sos@FreeBSD.org . +.An S\(/oren Schmidt Aq Mt sos@FreeBSD.org . This manual page was written by -.An Kazutaka Yokota Aq yokota@FreeBSD.org . +.An Kazutaka Yokota Aq Mt yokota@FreeBSD.org . .Sh CAVEATS The amount of data that is possible to insert from the cut buffer is limited by the diff --git a/share/man/man4/sysmouse.4 b/share/man/man4/sysmouse.4 index a02ffaa7d13..e0329509f85 100644 --- a/share/man/man4/sysmouse.4 +++ b/share/man/man4/sysmouse.4 @@ -441,7 +441,6 @@ The field holds the click count: the number of times the user has clicked the button successively. -.Pp .El .El .Sh FILES @@ -468,6 +467,6 @@ driver first appeared in .An -nosplit This manual page was written by -.An John-Mark Gurney Aq jmg@FreeBSD.org +.An John-Mark Gurney Aq Mt jmg@FreeBSD.org and -.An Kazutaka Yokota Aq yokota@FreeBSD.org . +.An Kazutaka Yokota Aq Mt yokota@FreeBSD.org . diff --git a/share/man/man4/targ.4 b/share/man/man4/targ.4 index 6c61735ff37..45d5e59990b 100644 --- a/share/man/man4/targ.4 +++ b/share/man/man4/targ.4 @@ -139,7 +139,7 @@ It was rewritten for .Fx 5.0 by -.An Nate Lawson Aq nate@root.org . +.An Nate Lawson Aq Mt nate@root.org . .Sh BUGS Currently, only the .Xr ahc 4 diff --git a/share/man/man4/tdfx.4 b/share/man/man4/tdfx.4 index b785c75ad86..2a09a71cf6c 100644 --- a/share/man/man4/tdfx.4 +++ b/share/man/man4/tdfx.4 @@ -80,14 +80,14 @@ and was originally developed for Linux kernel 2.0.x, later written for .Sh AUTHORS .An -nosplit The driver was developed by -.An Coleman Kane Aq cokane@micro.ti.com +.An Coleman Kane Aq Mt cokane@micro.ti.com after the linux version of this driver by .An Darryll Straus , .An John Taylor , .An Jens Axboe , -.An Carlo Wood Aq carlo@alinoe.com +.An Carlo Wood Aq Mt carlo@alinoe.com and -.An Joseph Kain Aq joseph@3dfx.com +.An Joseph Kain Aq Mt joseph@3dfx.com to be directly compatible with it and support the many GLIDE based games available for Linux and .Ux . diff --git a/share/man/man4/ti.4 b/share/man/man4/ti.4 index f4154591907..a589ec048eb 100644 --- a/share/man/man4/ti.4 +++ b/share/man/man4/ti.4 @@ -416,10 +416,10 @@ device driver first appeared in The .Nm driver was written by -.An Bill Paul Aq wpaul@bsdi.com . +.An Bill Paul Aq Mt wpaul@bsdi.com . The header splitting firmware modifications, character .Xr ioctl 2 interface and debugging support were written by -.An Kenneth Merry Aq ken@FreeBSD.org . +.An Kenneth Merry Aq Mt ken@FreeBSD.org . Initial zero copy support was written by -.An Andrew Gallatin Aq gallatin@FreeBSD.org . +.An Andrew Gallatin Aq Mt gallatin@FreeBSD.org . diff --git a/share/man/man4/tl.4 b/share/man/man4/tl.4 index 0716ce08029..d971dcd6c1d 100644 --- a/share/man/man4/tl.4 +++ b/share/man/man4/tl.4 @@ -182,4 +182,4 @@ device driver first appeared in The .Nm driver was written by -.An Bill Paul Aq wpaul@ctr.columbia.edu . +.An Bill Paul Aq Mt wpaul@ctr.columbia.edu . diff --git a/share/man/man4/trm.4 b/share/man/man4/trm.4 index 6180c9423d3..6d88720ccd0 100644 --- a/share/man/man4/trm.4 +++ b/share/man/man4/trm.4 @@ -104,4 +104,4 @@ of Tekram Technology, and ported to .Fx 5.0 by -.An Olivier Houchard Aq cognet@FreeBSD.org . +.An Olivier Houchard Aq Mt cognet@FreeBSD.org . diff --git a/share/man/man4/tty.4 b/share/man/man4/tty.4 index 70e5da2fc85..ec6d9f155ac 100644 --- a/share/man/man4/tty.4 +++ b/share/man/man4/tty.4 @@ -127,7 +127,6 @@ Before .Fx 8.0 , it would change to the new line discipline pointed to by .Fa ldisc . -.Pp .It Dv TIOCGETD Fa int *ldisc Return the current line discipline in the integer pointed to by .Fa ldisc . diff --git a/share/man/man4/twa.4 b/share/man/man4/twa.4 index 32cccfc37e9..dbafe91885c 100644 --- a/share/man/man4/twa.4 +++ b/share/man/man4/twa.4 @@ -132,4 +132,4 @@ messages, the quantity of which varies depending on the value assigned to The .Nm driver and manpage were written by -.An Vinod Kashyap Aq vkashyap@FreeBSD.org . +.An Vinod Kashyap Aq Mt vkashyap@FreeBSD.org . diff --git a/share/man/man4/twe.4 b/share/man/man4/twe.4 index fc73a012cb4..9f2eadfb266 100644 --- a/share/man/man4/twe.4 +++ b/share/man/man4/twe.4 @@ -258,15 +258,12 @@ and outstanding commands were restarted. The .Nm driver and manual page were written by -.An Michael Smith -.Aq msmith@FreeBSD.org . +.An Michael Smith Aq Mt msmith@FreeBSD.org . .Pp Extensive work done on the driver by -.An Vinod Kashyap -.Aq vkashyap@FreeBSD.org +.An Vinod Kashyap Aq Mt vkashyap@FreeBSD.org and -.An Paul Saab -.Aq ps@FreeBSD.org . +.An Paul Saab Aq Mt ps@FreeBSD.org . .Sh BUGS The controller cannot handle I/O transfers that are not aligned to a 512-byte boundary. diff --git a/share/man/man4/tws.4 b/share/man/man4/tws.4 index 3f2ab6608f8..40e49bd8812 100644 --- a/share/man/man4/tws.4 +++ b/share/man/man4/tws.4 @@ -114,5 +114,5 @@ The driver was written by .An Manjunath Ranganathaiah for LSI and this manual page was written by -.An Xin LI Aq delphij@FreeBSD.org +.An Xin LI Aq Mt delphij@FreeBSD.org for iXsystems, Inc. diff --git a/share/man/man4/u3g.4 b/share/man/man4/u3g.4 index d83f1575a31..0663a9af30a 100644 --- a/share/man/man4/u3g.4 +++ b/share/man/man4/u3g.4 @@ -111,15 +111,16 @@ driver appeared in is based on the .Xr uark 4 driver, and written by -.An Andrea Guzzo Aq aguzzo@anywi.com +.An Andrea Guzzo Aq Mt aguzzo@anywi.com in September 2008. .Sh AUTHORS +.An -nosplit The .Nm driver was written by -.An Andrea Guzzo Aq aguzzo@anywi.com +.An Andrea Guzzo Aq Mt aguzzo@anywi.com and -.An Nick Hibma Aq n_hibma@FreeBSD.org . +.An Nick Hibma Aq Mt n_hibma@FreeBSD.org . Hardware for testing was provided by AnyWi Technologies, Leiden, NL. .Sh BUGS The automatic mode switch from disk mode to modem mode does not work unless diff --git a/share/man/man4/uark.4 b/share/man/man4/uark.4 index a4e2e5664f5..b130ff16548 100644 --- a/share/man/man4/uark.4 +++ b/share/man/man4/uark.4 @@ -75,8 +75,7 @@ release to include it was The .Nm driver was written by -.An Jonathan Gray -.Aq jsg@openbsd.org . +.An Jonathan Gray Aq Mt jsg@openbsd.org . .Sh CAVEATS Setting hardware flow control is not currently supported. It is not yet known how to ask the hardware to send a break. diff --git a/share/man/man4/uart.4 b/share/man/man4/uart.4 index 644c37dfb55..748d6cb7a7d 100644 --- a/share/man/man4/uart.4 +++ b/share/man/man4/uart.4 @@ -178,4 +178,4 @@ device driver first appeared in The .Nm device driver and this manual page were written by -.An Marcel Moolenaar Aq marcel@xcllnt.net . +.An Marcel Moolenaar Aq Mt marcel@xcllnt.net . diff --git a/share/man/man4/uath.4 b/share/man/man4/uath.4 index e93094e4148..07cdc280db1 100644 --- a/share/man/man4/uath.4 +++ b/share/man/man4/uath.4 @@ -175,11 +175,11 @@ driver first appeared in The .Nm driver was written by -.An Weongyo Jeong Aq weongyo@FreeBSD.org +.An Weongyo Jeong Aq Mt weongyo@FreeBSD.org and -.An Sam Leffler Aq sam@FreeBSD.org . +.An Sam Leffler Aq Mt sam@FreeBSD.org . It is distantly related to a driver written by -.An Damien Bergamini Aq damien@openbsd.org . +.An Damien Bergamini Aq Mt damien@openbsd.org . .Sh CAVEATS Atheros proprietary 108 Mbps mode (aka Super AG mode) is not supported. .Pp diff --git a/share/man/man4/ubsa.4 b/share/man/man4/ubsa.4 index df9002cb9c4..12a18f00750 100644 --- a/share/man/man4/ubsa.4 +++ b/share/man/man4/ubsa.4 @@ -96,14 +96,14 @@ The manual page was adopted from .Nx by -.An Tom Rhodes Aq trhodes@FreeBSD.org +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org in April 2002 and modified for the .Nm driver by -.An Alexander Kabaev Aq kan@FreeBSD.org +.An Alexander Kabaev Aq Mt kan@FreeBSD.org in October 2002. .Sh AUTHORS The .Nm driver was written by -.An Alexander Kabaev Aq kan@FreeBSD.org . +.An Alexander Kabaev Aq Mt kan@FreeBSD.org . diff --git a/share/man/man4/ubtbcmfw.4 b/share/man/man4/ubtbcmfw.4 index 8451c6f7a48..0337124e238 100644 --- a/share/man/man4/ubtbcmfw.4 +++ b/share/man/man4/ubtbcmfw.4 @@ -102,7 +102,7 @@ The driver was implemented in .Fx 5.0 . .Sh AUTHORS -.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com +.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com .Sh BUGS Most likely. Please report if found. diff --git a/share/man/man4/ucom.4 b/share/man/man4/ucom.4 index 8898872fab8..9be02942432 100644 --- a/share/man/man4/ucom.4 +++ b/share/man/man4/ucom.4 @@ -94,7 +94,7 @@ in March of 2002. This manual page was adopted from .Nx by -.An Tom Rhodes Aq trhodes@FreeBSD.org +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org in April 2002. .Sh BUGS Prior to diff --git a/share/man/man4/ucycom.4 b/share/man/man4/ucycom.4 index 063d419ccf6..8ec0a4812c2 100644 --- a/share/man/man4/ucycom.4 +++ b/share/man/man4/ucycom.4 @@ -84,4 +84,4 @@ driver first appeared in The .Nm driver and this manual page were written by -.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . +.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org . diff --git a/share/man/man4/udav.4 b/share/man/man4/udav.4 index 4d90236d912..5f6c80c5590 100644 --- a/share/man/man4/udav.4 +++ b/share/man/man4/udav.4 @@ -98,4 +98,4 @@ device driver first appeared in The .Nm driver was written by -.An Shingo WATANABE Aq nabe@nabechan.org . +.An Shingo WATANABE Aq Mt nabe@nabechan.org . diff --git a/share/man/man4/udbp.4 b/share/man/man4/udbp.4 index 45afd790ae4..b455901043a 100644 --- a/share/man/man4/udbp.4 +++ b/share/man/man4/udbp.4 @@ -115,10 +115,10 @@ driver first appeared in The .Nm driver was written by -.An Doug Ambrisko Aq ambrisko@whistle.com , -.An Julian Elischer Aq julian@FreeBSD.org +.An Doug Ambrisko Aq Mt ambrisko@whistle.com , +.An Julian Elischer Aq Mt julian@FreeBSD.org and -.An Nick Hibma Aq n_hibma@FreeBSD.org . +.An Nick Hibma Aq Mt n_hibma@FreeBSD.org . .Pp This manual page was written by -.An Nick Hibma Aq n_hibma@FreeBSD.org . +.An Nick Hibma Aq Mt n_hibma@FreeBSD.org . diff --git a/share/man/man4/udplite.4 b/share/man/man4/udplite.4 index 37fcf121b4d..5d06b144098 100644 --- a/share/man/man4/udplite.4 +++ b/share/man/man4/udplite.4 @@ -35,7 +35,7 @@ .In sys/socket.h .In netinet/udplite.h .Ft int -.Fn socket AF_INET SOCK_STREAM IPPROTO_UDPLITE +.Fn socket AF_INET SOCK_DGRAM IPPROTO_UDPLITE .Sh DESCRIPTION The .Tn UDP-Lite @@ -52,7 +52,7 @@ supports a number of socket options which can be set with .Xr setsockopt 2 and tested with .Xr getsockopt 2 : -.Bl -tag -width ".Dv SCTP_SET_PEER_PRIMARY_ADDR" +.Bl -tag -width ".Dv UDPLITE_SEND_CSCOV" .It Dv UDPLITE_SEND_CSCOV This option sets the sender checksum coverage. A value of zero indicates that the entire packet diff --git a/share/man/man4/uep.4 b/share/man/man4/uep.4 index 74b65f37b23..231abb7deb4 100644 --- a/share/man/man4/uep.4 +++ b/share/man/man4/uep.4 @@ -71,7 +71,7 @@ creates a blocking pseudo\-device file, The .Nm driver was written by -.An Gleb Smirnoff Aq glebius@FreeBSD.org +.An Gleb Smirnoff Aq Mt glebius@FreeBSD.org . .Sh BUGS .Nm can't act like diff --git a/share/man/man4/ufm.4 b/share/man/man4/ufm.4 index 7ae11bd6112..a06d45cfd35 100644 --- a/share/man/man4/ufm.4 +++ b/share/man/man4/ufm.4 @@ -80,6 +80,6 @@ blocking device node The .Nm driver was written by -.An M. Warner Losh Aq imp@FreeBSD.org +.An M. Warner Losh Aq Mt imp@FreeBSD.org for .Fx . diff --git a/share/man/man4/ugen.4 b/share/man/man4/ugen.4 index 07b07daf277..875abb48f28 100644 --- a/share/man/man4/ugen.4 +++ b/share/man/man4/ugen.4 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 22, 2012 +.Dd May 16, 2014 .Dt UGEN 4 .Os .Sh NAME @@ -292,10 +292,10 @@ and should be set to .Dv USB_CURRENT_ALT_INDEX . .Sh FILES -.Bl -tag -width ".Pa /dev/ugen Ns Ar N Ns Pa \&. Ns Ar EE" -compact -.It Pa /dev/ugen Ns Ar N Ns Pa \&. Ns Ar EE +.Bl -tag -width ".Pa /dev/ugen Ns Ar N Ns Pa \&. Ns Ar E" -compact +.It Pa /dev/ugen Ns Ar N Ns Pa \&. Ns Ar E Endpoint -.Ar EE +.Ar E of device .Ar N . .El diff --git a/share/man/man4/uhci.4 b/share/man/man4/uhci.4 index 6c8b65937c4..9fcd4d48428 100644 --- a/share/man/man4/uhci.4 +++ b/share/man/man4/uhci.4 @@ -62,7 +62,7 @@ device driver first appeared in The .Nm driver was written by -.An Lennart Augustsson Aq augustss@carlstedt.se +.An Lennart Augustsson Aq Mt augustss@carlstedt.se for the .Nx project. diff --git a/share/man/man4/uhid.4 b/share/man/man4/uhid.4 index b6274ba83e9..fc90fff4035 100644 --- a/share/man/man4/uhid.4 +++ b/share/man/man4/uhid.4 @@ -143,5 +143,5 @@ appeared in This manual page was adopted from .Nx by -.An Tom Rhodes Aq trhodes@FreeBSD.org +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org in April 2002. diff --git a/share/man/man4/uhso.4 b/share/man/man4/uhso.4 index cc2e9ae0537..37f7dc352a6 100644 --- a/share/man/man4/uhso.4 +++ b/share/man/man4/uhso.4 @@ -139,4 +139,4 @@ AT_OWANCALL=1,0,1 The .Nm driver was written by -.An Fredrik Lindberg Aq fli@shapeshifter.se . +.An Fredrik Lindberg Aq Mt fli@shapeshifter.se . diff --git a/share/man/man4/ukbd.4 b/share/man/man4/ukbd.4 index 71ee348e071..3a3125d74ed 100644 --- a/share/man/man4/ukbd.4 +++ b/share/man/man4/ukbd.4 @@ -157,15 +157,15 @@ driver to the kernel. The .Nm driver was written by -.An Lennart Augustsson Aq augustss@cs.chalmers.se +.An Lennart Augustsson Aq Mt augustss@cs.chalmers.se for .Nx and was substantially rewritten for .Fx by -.An Kazutaka YOKOTA Aq yokota@zodiac.mech.utsunomiya-u.ac.jp . +.An Kazutaka YOKOTA Aq Mt yokota@zodiac.mech.utsunomiya-u.ac.jp . .Pp This manual page was written by -.An Nick Hibma Aq n_hibma@FreeBSD.org +.An Nick Hibma Aq Mt n_hibma@FreeBSD.org with a large amount of input from -.An Kazutaka YOKOTA Aq yokota@zodiac.mech.utsunomiya-u.ac.jp . +.An Kazutaka YOKOTA Aq Mt yokota@zodiac.mech.utsunomiya-u.ac.jp . diff --git a/share/man/man4/ulpt.4 b/share/man/man4/ulpt.4 index cd3b300fe89..894211bf6ff 100644 --- a/share/man/man4/ulpt.4 +++ b/share/man/man4/ulpt.4 @@ -106,5 +106,5 @@ appeared in This manual page was adopted from .Nx by -.An Tom Rhodes Aq trhodes@FreeBSD.org +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org in April 2002. diff --git a/share/man/man4/umass.4 b/share/man/man4/umass.4 index e57849e200e..b4c08d72170 100644 --- a/share/man/man4/umass.4 +++ b/share/man/man4/umass.4 @@ -254,9 +254,9 @@ when using The .Nm driver was written by -.An MAEKAWA Masahide Aq bishop@rr.iij4u.or.jp +.An MAEKAWA Masahide Aq Mt bishop@rr.iij4u.or.jp and -.An Nick Hibma Aq n_hibma@FreeBSD.org . +.An Nick Hibma Aq Mt n_hibma@FreeBSD.org . .Pp This manual page was written by -.An Nick Hibma Aq n_hibma@FreeBSD.org . +.An Nick Hibma Aq Mt n_hibma@FreeBSD.org . diff --git a/share/man/man4/umcs.4 b/share/man/man4/umcs.4 index fc96ad2ad91..f94e359aadb 100644 --- a/share/man/man4/umcs.4 +++ b/share/man/man4/umcs.4 @@ -94,8 +94,7 @@ appeared in ports since December of 2010. The .Nm driver was written by -.An Lev Serebryakov -.Aq lev@FreeBSD.org . +.An Lev Serebryakov Aq Mt lev@FreeBSD.org . .Sh BUGS This driver doesn't support access to any fine tunes of chip, like RS522/RS485 mode, non-standard baudrates, etc. diff --git a/share/man/man4/umct.4 b/share/man/man4/umct.4 index e40e146b2c3..00e4e09e20c 100644 --- a/share/man/man4/umct.4 +++ b/share/man/man4/umct.4 @@ -91,11 +91,11 @@ appeared in It is loosely based on the .Xr ubsa 4 driver by -.An Alexander Kabaev Aq kan@FreeBSD.org +.An Alexander Kabaev Aq Mt kan@FreeBSD.org with documentation from -.An Wolfgang Grandeggar Aq wolfgang@cec.ch . +.An Wolfgang Grandeggar Aq Mt wolfgang@cec.ch . .Sh AUTHORS The .Nm driver was written by -.An Scott Long Aq scottl@FreeBSD.org . +.An Scott Long Aq Mt scottl@FreeBSD.org . diff --git a/share/man/man4/umodem.4 b/share/man/man4/umodem.4 index 71827dbc960..480b453f532 100644 --- a/share/man/man4/umodem.4 +++ b/share/man/man4/umodem.4 @@ -108,7 +108,7 @@ appeared in This manual page was adopted from .Nx by -.An Tom Rhodes Aq trhodes@FreeBSD.org +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org in April 2002. .Sh BUGS Only modems with multiplexed commands and data are supported diff --git a/share/man/man4/ums.4 b/share/man/man4/ums.4 index 6c052a1858c..83aeeda7ad6 100644 --- a/share/man/man4/ums.4 +++ b/share/man/man4/ums.4 @@ -99,15 +99,15 @@ as in X change it to: The .Nm driver was written by -.An Lennart Augustsson Aq augustss@cs.chalmers.se +.An Lennart Augustsson Aq Mt augustss@cs.chalmers.se for .Nx and was adopted for .Fx by -.An MAEKAWA Masahide Aq bishop@rr.iij4u.or.jp . +.An MAEKAWA Masahide Aq Mt bishop@rr.iij4u.or.jp . .Pp This manual page was written by -.An Nick Hibma Aq n_hibma@FreeBSD.org +.An Nick Hibma Aq Mt n_hibma@FreeBSD.org with input from -.An Kazutaka YOKOTA Aq yokota@zodiac.mech.utsunomiya-u.ac.jp . +.An Kazutaka YOKOTA Aq Mt yokota@zodiac.mech.utsunomiya-u.ac.jp . diff --git a/share/man/man4/upgt.4 b/share/man/man4/upgt.4 index 7b8143888ab..c7d3ee52ad3 100644 --- a/share/man/man4/upgt.4 +++ b/share/man/man4/upgt.4 @@ -209,7 +209,7 @@ driver first appeared in The .Nm driver was written by -.An Marcus Glocker Aq mglocker@openbsd.org . +.An Marcus Glocker Aq Mt mglocker@openbsd.org . .Pp The hardware specification was reverse engineered by the people at .Pa http://www.prism54.org . diff --git a/share/man/man4/uplcom.4 b/share/man/man4/uplcom.4 index 7c2bce07754..6ed2038da1f 100644 --- a/share/man/man4/uplcom.4 +++ b/share/man/man4/uplcom.4 @@ -193,5 +193,5 @@ appeared in This manual page was adopted from .Nx by -.An Tom Rhodes Aq trhodes@FreeBSD.org +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org in April 2002. diff --git a/share/man/man4/ural.4 b/share/man/man4/ural.4 index 4ae6c18ebcf..1563fde2096 100644 --- a/share/man/man4/ural.4 +++ b/share/man/man4/ural.4 @@ -158,7 +158,7 @@ driver first appeared in The original .Nm driver was written by -.An Damien Bergamini Aq damien.bergamini@free.fr +.An Damien Bergamini Aq Mt damien.bergamini@free.fr . .Sh BUGS Host AP mode doesn't support client power save. Clients using power save mode will experience diff --git a/share/man/man4/urio.4 b/share/man/man4/urio.4 index 68a4964cab3..30048c14f16 100644 --- a/share/man/man4/urio.4 +++ b/share/man/man4/urio.4 @@ -122,9 +122,9 @@ CFLAGS="-I/usr/include/dev/usb" ./configure \\ The .Nm driver was written by -.An Iwasa Kazmi Aq kzmi@ca2.so-net.ne.jp +.An Iwasa Kazmi Aq Mt kzmi@ca2.so-net.ne.jp for .Fx . .Pp This manual page was written by -.An Dirk-Willem van Gulik Aq dirkx@webweaving.org . +.An Dirk-Willem van Gulik Aq Mt dirkx@webweaving.org . diff --git a/share/man/man4/urtw.4 b/share/man/man4/urtw.4 index 58f291ffcd4..a67235eb5f3 100644 --- a/share/man/man4/urtw.4 +++ b/share/man/man4/urtw.4 @@ -122,5 +122,4 @@ device driver first appeared in The .Nm driver was written by -.An Weongyo Jeong -.Aq weongyo@FreeBSD.org . +.An Weongyo Jeong Aq Mt weongyo@FreeBSD.org . diff --git a/share/man/man4/urtwn.4 b/share/man/man4/urtwn.4 index da1db76cb41..223dbbc2d59 100644 --- a/share/man/man4/urtwn.4 +++ b/share/man/man4/urtwn.4 @@ -150,7 +150,7 @@ and The .Nm driver was written by -.An Damien Bergamini Aq damien@openbsd.org . +.An Damien Bergamini Aq Mt damien@openbsd.org . .Sh CAVEATS The .Nm diff --git a/share/man/man4/usb.4 b/share/man/man4/usb.4 index f64d8b8c810..4db0d73a8a4 100644 --- a/share/man/man4/usb.4 +++ b/share/man/man4/usb.4 @@ -175,8 +175,11 @@ module complies with the USB 2.0 standard. .Sh HISTORY The .Nm -module has been inspired by the NetBSD USB stack initially written by -Lennart Augustsson. The +module has been inspired by the +.Nx +USB stack initially written by +.An Lennart Augustsson . +The .Nm module was written by -.An Hans Petter Selasky Aq hselasky@FreeBSD.org . +.An Hans Petter Selasky Aq Mt hselasky@FreeBSD.org . diff --git a/share/man/man4/usb_quirk.4 b/share/man/man4/usb_quirk.4 index eb45eaa6e08..9352e7660b4 100644 --- a/share/man/man4/usb_quirk.4 +++ b/share/man/man4/usb_quirk.4 @@ -191,6 +191,6 @@ The module appeared in .Fx 8.0 , and was written by -.An Hans Petter Selasky Aq hselasky@FreeBSD.org . +.An Hans Petter Selasky Aq Mt hselasky@FreeBSD.org . This manual page was written by -.An Nick Hibma Aq n_hibma@FreeBSD.org . +.An Nick Hibma Aq Mt n_hibma@FreeBSD.org . diff --git a/share/man/man4/usb_template.4 b/share/man/man4/usb_template.4 index 331ece97a3d..e4dba2cf74a 100644 --- a/share/man/man4/usb_template.4 +++ b/share/man/man4/usb_template.4 @@ -80,4 +80,4 @@ module complies to the USB 1.0, 2.0 and 3.0 standard. The .Nm module was written by -.An Hans Petter Selasky Aq hselasky@FreeBSD.org . +.An Hans Petter Selasky Aq Mt hselasky@FreeBSD.org . diff --git a/share/man/man4/uslcom.4 b/share/man/man4/uslcom.4 index d043cb2f20f..01eb93dc4bb 100644 --- a/share/man/man4/uslcom.4 +++ b/share/man/man4/uslcom.4 @@ -209,4 +209,4 @@ release to include it was The .Nm driver was written by -.An Jonathan Gray Aq jsg@openbsd.org . +.An Jonathan Gray Aq Mt jsg@openbsd.org . diff --git a/share/man/man4/utopia.4 b/share/man/man4/utopia.4 index 00020ea76ac..b3c0e5b9c2f 100644 --- a/share/man/man4/utopia.4 +++ b/share/man/man4/utopia.4 @@ -193,4 +193,4 @@ may be needed for interworking with public networks. .Xr patm 4 , .Xr utopia 9 .Sh AUTHORS -.An Harti Brandt Aq harti@FreeBSD.org +.An Harti Brandt Aq Mt harti@FreeBSD.org diff --git a/share/man/man4/uvisor.4 b/share/man/man4/uvisor.4 index 2397e4522f2..254e9b5b2d9 100644 --- a/share/man/man4/uvisor.4 +++ b/share/man/man4/uvisor.4 @@ -131,7 +131,7 @@ in August 2002. This manual page was adopted from .Nx by -.An Tom Rhodes Aq trhodes@FreeBSD.org +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org at that time. .Sh BUGS The code to provide multiple diff --git a/share/man/man4/uvscom.4 b/share/man/man4/uvscom.4 index be40518c20e..fb8ada7aa26 100644 --- a/share/man/man4/uvscom.4 +++ b/share/man/man4/uvscom.4 @@ -91,5 +91,5 @@ and later in This manual page was adopted from .Nx by -.An Tom Rhodes Aq trhodes@FreeBSD.org +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org in April 2002. diff --git a/share/man/man4/vale.4 b/share/man/man4/vale.4 index a52b137b276..4eeab1ae1cc 100644 --- a/share/man/man4/vale.4 +++ b/share/man/man4/vale.4 @@ -90,7 +90,6 @@ The maximum number of packets processed internally in each iteration. Defaults to 1024, use lower values to trade latency with throughput. -.Pp .It dev.netmap.verbose Set to non-zero values to enable in-kernel diagnostics. .El diff --git a/share/man/man4/vga.4 b/share/man/man4/vga.4 index b102d2f6f5d..cf4179b72bf 100644 --- a/share/man/man4/vga.4 +++ b/share/man/man4/vga.4 @@ -178,8 +178,8 @@ driver first appeared in The .Nm driver was written by -.An S\(/oren Schmidt Aq sos@FreeBSD.org +.An S\(/oren Schmidt Aq Mt sos@FreeBSD.org and -.An Kazutaka Yokota Aq yokota@FreeBSD.org . +.An Kazutaka Yokota Aq Mt yokota@FreeBSD.org . This manual page was written by .An Kazutaka Yokota . diff --git a/share/man/man4/vge.4 b/share/man/man4/vge.4 index f8fd8f77499..7363b95a46e 100644 --- a/share/man/man4/vge.4 +++ b/share/man/man4/vge.4 @@ -222,4 +222,4 @@ device driver first appeared in The .Nm driver was written by -.An Bill Paul Aq wpaul@windriver.com . +.An Bill Paul Aq Mt wpaul@windriver.com . diff --git a/share/man/man4/viapm.4 b/share/man/man4/viapm.4 index 851c1fc7922..a155e91f823 100644 --- a/share/man/man4/viapm.4 +++ b/share/man/man4/viapm.4 @@ -67,6 +67,6 @@ manual page first appeared in .Sh AUTHORS This manual page was written by -.An Nicolas Souchu Aq nsouch@FreeBSD.org . +.An Nicolas Souchu Aq Mt nsouch@FreeBSD.org . .Sh BUGS Only polling mode is supported. diff --git a/share/man/man4/viawd.4 b/share/man/man4/viawd.4 index 47473cf395e..e579bf0887a 100644 --- a/share/man/man4/viawd.4 +++ b/share/man/man4/viawd.4 @@ -76,4 +76,4 @@ driver first appeared in The .Nm driver and this manual page were written by -.An Fabien Thomas Aq fabient@FreeBSD.org . +.An Fabien Thomas Aq Mt fabient@FreeBSD.org . diff --git a/share/man/man4/virtio.4 b/share/man/man4/virtio.4 index 10ebf209bb1..8a0cbc6eb5d 100644 --- a/share/man/man4/virtio.4 +++ b/share/man/man4/virtio.4 @@ -94,4 +94,4 @@ Support for VirtIO first appeared in .An -nosplit .Fx support for VirtIO was first added by -.An Bryan Venteicher Aq bryanv@FreeBSD.org . +.An Bryan Venteicher Aq Mt bryanv@FreeBSD.org . diff --git a/share/man/man4/virtio_balloon.4 b/share/man/man4/virtio_balloon.4 index 450b5cdfce9..b7ce0ed13cb 100644 --- a/share/man/man4/virtio_balloon.4 +++ b/share/man/man4/virtio_balloon.4 @@ -59,6 +59,6 @@ The hypervisor can later signal the balloon to return the memory. The .Nm driver was written by -.An Bryan Venteicher Aq bryanv@FreeBSD.org . +.An Bryan Venteicher Aq Mt bryanv@FreeBSD.org . It first appeared in .Fx 9.0 . diff --git a/share/man/man4/virtio_blk.4 b/share/man/man4/virtio_blk.4 index eb5fded32d3..579fb4a9745 100644 --- a/share/man/man4/virtio_blk.4 +++ b/share/man/man4/virtio_blk.4 @@ -87,6 +87,6 @@ be toggled between writethrough and writeback. The .Nm driver was written by -.An Bryan Venteicher Aq bryanv@FreeBSD.org . +.An Bryan Venteicher Aq Mt bryanv@FreeBSD.org . It first appeared in .Fx 9.0 . diff --git a/share/man/man4/virtio_random.4 b/share/man/man4/virtio_random.4 index a20e868d744..5ce7d17ffb0 100644 --- a/share/man/man4/virtio_random.4 +++ b/share/man/man4/virtio_random.4 @@ -58,4 +58,4 @@ hypervisor to the guest. The .Nm driver was written by -.An Bryan Venteicher Aq bryanv@FreeBSD.org . +.An Bryan Venteicher Aq Mt bryanv@FreeBSD.org . diff --git a/share/man/man4/virtio_scsi.4 b/share/man/man4/virtio_scsi.4 index b136de6ba97..f65f8b7b3f5 100644 --- a/share/man/man4/virtio_scsi.4 +++ b/share/man/man4/virtio_scsi.4 @@ -87,6 +87,6 @@ Enable tracing prints. The .Nm driver was written by -.An Bryan Venteicher Aq bryanv@FreeBSD.org . +.An Bryan Venteicher Aq Mt bryanv@FreeBSD.org . It first appeared in .Fx 10.0 . diff --git a/share/man/man4/vkbd.4 b/share/man/man4/vkbd.4 index debdd3eea52..78110a6107b 100644 --- a/share/man/man4/vkbd.4 +++ b/share/man/man4/vkbd.4 @@ -136,7 +136,7 @@ The module was implemented in .Fx 6.0 . .Sh AUTHORS -.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com +.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com .Sh CAVEATS The .Nm diff --git a/share/man/man4/vmx.4 b/share/man/man4/vmx.4 index 0598aa898a8..974c3f840a9 100644 --- a/share/man/man4/vmx.4 +++ b/share/man/man4/vmx.4 @@ -148,7 +148,7 @@ The driver was ported from .Ox and significantly rewritten by -.An Bryan Venteicher Aq bryanv@freebsd.org . +.An Bryan Venteicher Aq Mt bryanv@freebsd.org . The .Ox driver was written by diff --git a/share/man/man4/vr.4 b/share/man/man4/vr.4 index 1390cc998de..da4ee5bcbc1 100644 --- a/share/man/man4/vr.4 +++ b/share/man/man4/vr.4 @@ -203,7 +203,7 @@ device driver first appeared in The .Nm driver was written by -.An Bill Paul Aq wpaul@ctr.columbia.edu . +.An Bill Paul Aq Mt wpaul@ctr.columbia.edu . .Sh BUGS The .Nm diff --git a/share/man/man4/vt.4 b/share/man/man4/vt.4 new file mode 100644 index 00000000000..0cd42fd20ef --- /dev/null +++ b/share/man/man4/vt.4 @@ -0,0 +1,266 @@ +.\" Copyright (c) 2014 Warren Block +.\" 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 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 AUTHORS 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 July 2, 2014 +.Dt "VIRTUAL TERMINALS" 4 +.Os +.Sh NAME +.Nm vt +.Nd virtual terminal console driver +.Sh SYNOPSIS +.Cd "options TERMINAL_KERN_ATTR=_attribute_" +.Cd "options TERMINAL_NORM_ATTR=_attribute_" +.Cd "options VT_MAXWINDOWS=N" +.Cd "options VT_ALT_TO_ESC_HACK=1" +.Cd "options VT_TWOBUTTON_MOUSE" +.Cd "options VT_FB_DEFAULT_WIDTH=X" +.Cd "options VT_FB_DEFAULT_HEIGHT=Y" +.Cd "options SC_NO_CUTPASTE" +.Cd "device vt" +.Pp +In +.Xr loader.conf 5 : +.Cd hw.vga.textmode=1 +.Cd kern.vty=vt +.Sh DESCRIPTION +The +.Nm +device provides multiple virtual terminals with an extensive feature +set: +.Bl -item -offset indent +.It +Unicode UTF-8 text with double-width characters. +.It +Large font maps in graphics mode, including support for Asian +character sets. +.It +Graphics-mode consoles. +.It +Integration with +KMS +.Pq Kernel Mode Setting +video drivers for switching between the +.Em X Window System +and virtual terminals. +.El +.Ss Virtual Terminals +Multiple virtual terminals are provided on a single computer. +Up to sixteen virtual terminals can be defined. +A single virtual terminal is connected to the screen and keyboard +at a time. +Key combinations are used to select a virtual terminal. +Alt-F1 through Alt-F12 correspond to the first twelve virtual terminals. +If more than twelve virtual terminals are created, Shift-Alt-F1 through +Shift-Alt-F4 are used to switch to the additional terminals. +.Ss Copying and Pasting Text with a Mouse +Copying and pasting text from the screen with a mouse is supported. +Press and hold down mouse button 1, usually the left button, while +moving the mouse to select text. +Selected text is highlighted with reversed foreground and background +colors. +To select more text after releasing mouse button 1, press mouse button +3, usually the right button. +To paste text that has been selected, press mouse button 2, usually the +middle button. +The text is entered as if it were typed at the keyboard. +The +.Dv VT_TWOBUTTON_MOUSE +kernel option can be used with mice that only have two buttons. +Setting this option makes the second mouse button into the +paste button. +See +.Xr moused 8 +for more information. +.Ss Scrolling Back +Output that has scrolled off the screen can be reviewed by pressing the +Scroll Lock key, then scrolling up and down with the arrow keys. +The Page Up and Page Down keys scroll up or down a full screen at a +time. +The Home and End keys jump to the beginning or end of the scrollback +buffer. +When finished reviewing, press the Scroll Lock key again to return to +normal use. +.Sh DRIVER CONFIGURATION +.Ss Kernel Configuration Options +These kernel options control the +.Nm +driver. +.Bl -tag -width MAXCONS +.It Dv TERMINAL_NORM_ATTR= Ns Pa attribute +.It Dv TERMINAL_KERN_ATTR= Ns Pa attribute +These options allow changing the default colors used for normal and kernel +text. +Available colors are defined in +.In sys/terminal.h . +See +.Sx EXAMPLES +below. +.It Dv VT_MAXWINDOWS=N +Set the number of virtual terminals to be created to +.Fa N . +The value defaults to 12. +.It Dv VT_ALT_TO_ESC_HACK=1 +When the Alt key is held down while pressing another key, send an ESC +sequence instead of the Alt key. +.It Dv VT_TWOBUTTON_MOUSE +If defined, swap the functions of mouse buttons 2 and 3. +In effect, this makes the right-hand mouse button perform a paste. +These options are checked in the order shown. +.It Dv SC_NO_CUTPASTE +Disable mouse support. +.It VT_FB_DEFAULT_WIDTH=X +Set the default width to +.Fa X . +.It VT_FB_DEFAULT_HEIGHT=Y +Set the default height to +.Fa Y . +.El +.Sh BACKWARDS COMPATIBILITY +Several options are provided for compatibility with the previous +console device, +.Xr sc 4 . +These options will be removed in a future +.Fx +version. +.Bl -column -offset indent ".Sy vt VT_TWOBUTTON_MOUSE" ".Sy SC_TWOBUTTON_MOUSE" +.It Sy vt Option Name Ta Sy sc Option Name +.It Dv TERMINAL_KERN_ATTR Ta Dv SC_KERNEL_CONS_ATTR +.It Dv TERMINAL_NORM_ATTR Ta Dv SC_NORM_ATTR +.It Dv VT_TWOBUTTON_MOUSE Ta Dv SC_TWOBUTTON_MOUSE +.It Dv VT_MAXWINDOWS Ta Dv MAXCONS +.It none Ta Dv SC_NO_CUTPASTE +.El +.Sh START-UP OPERATION WITH X86 BIOS SYSTEMS +The computer BIOS starts in text mode, and +the +.Fx +.Xr loader 8 +runs, loading the kernel. +If +.Va hw.vga.textmode +is set, the system remains in text mode. +Otherwise, +.Nm +switches to 640x480x16 VGA mode using +.Cm vt_vga . +If a KMS +.Pq Kernel Mode Switching +video driver is available, the display is switched to high resolution +and the KMS driver takes over. +When a KMS driver is not available, +.Cm vt_vga +remains active. +.Sh LOADER TUNABLES +These settings can be entered at the +.Xr loader 8 +prompt or in +.Xr loader.conf 5 . +.Bl -tag -width indent +.It Va hw.vga.textmode +Set to 1 to use virtual terminals in text mode instead of graphics mode. +Features that require graphics mode, like loadable fonts, will be +disabled. +.It Va kern.vty +When both +.Nm +and +.Xr sc 4 have been compiled into the kernel, the one to use for the +system console can be selected by setting this value to +.Ql vt +or +.Ql sc . +If this value is not set, +.Xr sc 4 +is used. +.El +.Sh FILES +.Bl -tag -width /usr/share/syscons/keymaps/* -compact +.It Pa /dev/console +.It Pa /dev/consolectl +.It Pa /dev/ttyv* +virtual terminals +.It Pa /etc/ttys +terminal initialization information +.El +.Sh EXAMPLES +This example changes the default color of normal text to green on a +black background, or black on a green background when reversed. +Note that white space cannot be used inside the attribute string +because of the current implementation of +.Xr config 8 . +.Pp +.Dl "options TERMINAL_NORM_ATTR=(FG_GREEN|BG_BLACK)" +.Pp +This line changes the default color of kernel messages to be bright red +on a black background, or black on a bright red background when reversed. +.Pp +.Dl "options TERMINAL_KERN_ATTR=(FG_LIGHTRED|BG_BLACK)" +.Sh SEE ALSO +.Xr kbdcontrol 1 , +.Xr login 1 , +.Xr vidcontrol 1 , +.Xr atkbd 4 , +.Xr atkbdc 4 , +.Xr keyboard 4 , +.Xr screen 4 , +.Xr splash 4 , +.Xr syscons 4 , +.Xr ukbd 4 , +.Xr vga 4 , +.Xr kbdmap 5 , +.Xr rc.conf 5 , +.Xr ttys 5 , +.Xr config 8 , +.Xr getty 8 , +.Xr kbdmux 8 , +.Xr kldload 8 , +.Xr moused 8 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 9.3 . +.Sh AUTHORS +.An -nosplit +The +.Nm +device driver was developed by +.An Ed Schouten Aq Mt ed@FreeBSD.org , +.An Ed Maste Aq Mt emaste@FreeBSD.org , +and +.An Aleksandr Rybalko Aq Mt ray@FreeBSD.org , +with sponsorship provided by the +.Fx +Foundation. +This manual page was written by +.An Warren Block Aq Mt wblock@FreeBSD.org . +.Sh CAVEATS +Paste buffer size is limited by the system value +.Brq Dv MAX_INPUT , +the number of bytes that can be stored in the terminal +input queue, usually 1024 bytes +(see +.Xr termios 4 ) . diff --git a/share/man/man4/vte.4 b/share/man/man4/vte.4 index 18b39d0b948..23080a0e278 100644 --- a/share/man/man4/vte.4 +++ b/share/man/man4/vte.4 @@ -146,7 +146,6 @@ Show hardware MAC statistics maintained in driver. The .Nm driver was written by -.An Pyun YongHyeon -.Aq yongari@FreeBSD.org . +.An Pyun YongHyeon Aq Mt yongari@FreeBSD.org . It first appeared in .Fx 8.3 . diff --git a/share/man/man4/vtnet.4 b/share/man/man4/vtnet.4 index d3d7bc81d5c..8825049ad6a 100644 --- a/share/man/man4/vtnet.4 +++ b/share/man/man4/vtnet.4 @@ -105,7 +105,7 @@ The default value is 0. The .Nm driver was written by -.An Bryan Venteicher Aq bryanv@FreeBSD.org . +.An Bryan Venteicher Aq Mt bryanv@FreeBSD.org . It first appeared in .Fx 9.0 . .Sh CAVEATS diff --git a/share/man/man4/vxge.4 b/share/man/man4/vxge.4 index fdca8e2b65f..b21c3501f80 100644 --- a/share/man/man4/vxge.4 +++ b/share/man/man4/vxge.4 @@ -98,7 +98,7 @@ For troubleshooting tips and FAQs, please visit .Pa http://trac.neterion.com/cgi-bin/trac.cgi/wiki/TitleIndex?anonymous . .Pp For any issues please send an email to -.Aq support@neterion.com . +.Aq Mt support@neterion.com . .Sh SEE ALSO .Xr arp 8 , .Xr ifconfig 8 @@ -106,5 +106,4 @@ For any issues please send an email to The .Nm driver was written by -.An Neterion -.Aq support@neterion.com . +.An Neterion Aq Mt support@neterion.com . diff --git a/share/man/man4/watchdog.4 b/share/man/man4/watchdog.4 index 4d953d6957e..cb592f58cf5 100644 --- a/share/man/man4/watchdog.4 +++ b/share/man/man4/watchdog.4 @@ -137,11 +137,11 @@ code first appeared in The .Nm facility was written by -.An Poul-Henning Kamp Aq phk@FreeBSD.org . +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . The software watchdog code and this manual page were written by -.An Sean Kelly Aq smkelly@FreeBSD.org . +.An Sean Kelly Aq Mt smkelly@FreeBSD.org . Some contributions were made by -.An Jeff Roberson Aq jeff@FreeBSD.org . +.An Jeff Roberson Aq Mt jeff@FreeBSD.org . .Sh BUGS The .Dv WD_PASSIVE diff --git a/share/man/man4/wb.4 b/share/man/man4/wb.4 index 22a670651ac..b0b4e784226 100644 --- a/share/man/man4/wb.4 +++ b/share/man/man4/wb.4 @@ -180,7 +180,7 @@ device driver first appeared in The .Nm driver was written by -.An Bill Paul Aq wpaul@ctr.columbia.edu . +.An Bill Paul Aq Mt wpaul@ctr.columbia.edu . .Sh BUGS The Winbond chip seems to behave strangely in some cases when the link partner switches modes. diff --git a/share/man/man4/wbwd.4 b/share/man/man4/wbwd.4 index 49290ff2ef3..058a407bc6f 100644 --- a/share/man/man4/wbwd.4 +++ b/share/man/man4/wbwd.4 @@ -110,4 +110,4 @@ driver first appeared in .Sh AUTHORS .An -nosplit This manual page was written by -.An Bjoern A. Zeeb Aq bz@FreeBSD.org . +.An Bjoern A. Zeeb Aq Mt bz@FreeBSD.org . diff --git a/share/man/man4/wi.4 b/share/man/man4/wi.4 index 92dedff7a1d..0e55e7b21e6 100644 --- a/share/man/man4/wi.4 +++ b/share/man/man4/wi.4 @@ -330,7 +330,7 @@ device driver first appeared in The original .Nm driver was written by -.An Bill Paul Aq wpaul@ctr.columbia.edu . +.An Bill Paul Aq Mt wpaul@ctr.columbia.edu . This man page comes from .Ox . .Sh CAVEATS diff --git a/share/man/man4/wlan.4 b/share/man/man4/wlan.4 index 76e797cc51c..16d1f2e47da 100644 --- a/share/man/man4/wlan.4 +++ b/share/man/man4/wlan.4 @@ -216,4 +216,4 @@ and then rewrote it to support multi-mode devices, add the extensible frameworks for cryptographic, authentication, and access control plugins. This manual page was written by -.An Tom Rhodes Aq trhodes@FreeBSD.org . +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org . diff --git a/share/man/man4/wpi.4 b/share/man/man4/wpi.4 index f1bc15ed674..f2d4251e5e1 100644 --- a/share/man/man4/wpi.4 +++ b/share/man/man4/wpi.4 @@ -132,8 +132,8 @@ The original driver was written for .Ox by -.An Damien Bergamini Aq damien.bergamini@free.fr . -.An Benjamin Close Aq benjsc@FreeBSD.org +.An Damien Bergamini Aq Mt damien.bergamini@free.fr . +.An Benjamin Close Aq Mt benjsc@FreeBSD.org ported .Nm to diff --git a/share/man/man4/wsp.4 b/share/man/man4/wsp.4 index a74097c7486..24c9b77efb1 100644 --- a/share/man/man4/wsp.4 +++ b/share/man/man4/wsp.4 @@ -87,4 +87,4 @@ types. The .Nm driver was written by -.An Huang Wen Hui Aq huanghwh@gmail.com +.An Huang Wen Hui Aq Mt huanghwh@gmail.com . diff --git a/share/man/man4/xe.4 b/share/man/man4/xe.4 index 0935884badc..51240d2cfa0 100644 --- a/share/man/man4/xe.4 +++ b/share/man/man4/xe.4 @@ -154,11 +154,11 @@ driver first appeared in The .Nm device driver was written by -.An Scott Mitchell Aq rsm@FreeBSD.org . +.An Scott Mitchell Aq Mt rsm@FreeBSD.org . This manual page was written by -.An Scott Mitchell Aq rsm@FreeBSD.org , +.An Scott Mitchell Aq Mt rsm@FreeBSD.org , and -.An Tom Rhodes Aq trhodes@FreeBSD.org . +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org . .Sh BUGS Supported devices will fail to attach on some machines using the .Tn NEWCARD diff --git a/share/man/man4/xen.4 b/share/man/man4/xen.4 index e053fc53580..83b3d122685 100644 --- a/share/man/man4/xen.4 +++ b/share/man/man4/xen.4 @@ -159,16 +159,16 @@ first appeared in .An -nosplit .Fx support for Xen was first added by -.An Kip Macy Aq kmacy@FreeBSD.org +.An Kip Macy Aq Mt kmacy@FreeBSD.org and -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . Further refinements were made by -.An Justin Gibbs Aq gibbs@FreeBSD.org , -.An Adrian Chadd Aq adrian@FreeBSD.org , +.An Justin Gibbs Aq Mt gibbs@FreeBSD.org , +.An Adrian Chadd Aq Mt adrian@FreeBSD.org , and -.An Colin Percival Aq cperciva@FreeBSD.org . +.An Colin Percival Aq Mt cperciva@FreeBSD.org . This manual page was written by -.An Robert Watson Aq rwatson@FreeBSD.org . +.An Robert Watson Aq Mt rwatson@FreeBSD.org . .Sh BUGS .Fx is only able to run as a Xen guest (DomU) and not as a Xen host (Dom0). diff --git a/share/man/man4/xl.4 b/share/man/man4/xl.4 index d10d270be01..81cf711a446 100644 --- a/share/man/man4/xl.4 +++ b/share/man/man4/xl.4 @@ -267,4 +267,4 @@ device driver first appeared in The .Nm driver was written by -.An Bill Paul Aq wpaul@ctr.columbia.edu . +.An Bill Paul Aq Mt wpaul@ctr.columbia.edu . diff --git a/share/man/man4/xnb.4 b/share/man/man4/xnb.4 index 9c65636a6c8..a0c1c60ac52 100644 --- a/share/man/man4/xnb.4 +++ b/share/man/man4/xnb.4 @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 6, 2012 +.Dd June 6, 2014 .Dt XNB 4 .Os .Sh NAME @@ -97,14 +97,13 @@ The device driver first appeared in .Fx 10.0 . .Sh AUTHORS +.An -nosplit The .Nm driver was written by -.An Alan Somers -.Aq alans@spectralogic.com +.An Alan Somers Aq Mt alans@spectralogic.com and -.An John Suykerbuyk -.Aq johns@spectralogic.com . +.An John Suykerbuyk Aq Mt johns@spectralogic.com . .Sh CAVEATS Packets sent through Xennet pass over shared memory, so the protocol includes no form of link-layer checksum or CRC. @@ -116,7 +115,9 @@ machine. However, when a Xennet interface is bridged to a physical interface, a correct checksum must be attached to any packets bound for that physical interface. -Currently, FreeBSD lacks any mechanism for an ethernet device to +Currently, +.Fx +lacks any mechanism for an Ethernet device to inform the OS that newly received packets are valid even though their checksums are not. So if the netfront driver is configured to offload checksum calculations, diff --git a/share/man/man4/xpt.4 b/share/man/man4/xpt.4 index e670acb199c..c15ca4b55c4 100644 --- a/share/man/man4/xpt.4 +++ b/share/man/man4/xpt.4 @@ -105,4 +105,4 @@ None. The CAM transport layer driver first appeared in .Fx 3.0 . .Sh AUTHORS -.An Kenneth Merry Aq ken@FreeBSD.org +.An Kenneth Merry Aq Mt ken@FreeBSD.org diff --git a/share/man/man4/zyd.4 b/share/man/man4/zyd.4 index 5a1f0a5a662..178adfb3a6e 100644 --- a/share/man/man4/zyd.4 +++ b/share/man/man4/zyd.4 @@ -175,10 +175,10 @@ This should not happen. The original .Nm driver was written by -.An Florian Stoehr Aq ich@florian-stoehr.de , -.An Damien Bergamini Aq damien@openbsd.org , +.An Florian Stoehr Aq Mt ich@florian-stoehr.de , +.An Damien Bergamini Aq Mt damien@openbsd.org , and -.An Jonathan Gray Aq jsg@openbsd.org . +.An Jonathan Gray Aq Mt jsg@openbsd.org . .Sh CAVEATS The .Nm diff --git a/share/man/man5/bluetooth.device.conf.5 b/share/man/man5/bluetooth.device.conf.5 index d8abb9ec85e..ea3553b0740 100644 --- a/share/man/man5/bluetooth.device.conf.5 +++ b/share/man/man5/bluetooth.device.conf.5 @@ -183,4 +183,4 @@ second USB Bluetooth device. .Xr hcsecd 8 , .Xr l2control 8 .Sh AUTHORS -.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com +.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com diff --git a/share/man/man5/bluetooth.hosts.5 b/share/man/man5/bluetooth.hosts.5 index bda4d920496..3afa145d055 100644 --- a/share/man/man5/bluetooth.hosts.5 +++ b/share/man/man5/bluetooth.hosts.5 @@ -60,4 +60,4 @@ delimiter, newline, or comment character. .Sh SEE ALSO .Xr bluetooth 3 .Sh AUTHORS -.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com +.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com diff --git a/share/man/man5/bluetooth.protocols.5 b/share/man/man5/bluetooth.protocols.5 index 64a7dd56367..2968fa39991 100644 --- a/share/man/man5/bluetooth.protocols.5 +++ b/share/man/man5/bluetooth.protocols.5 @@ -59,4 +59,4 @@ character other than a field delimiter, newline, or comment character. .Sh SEE ALSO .Xr bluetooth 3 .Sh AUTHORS -.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com +.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com diff --git a/share/man/man5/boot.config.5 b/share/man/man5/boot.config.5 index 681fc3aa765..f2d7e2db4a7 100644 --- a/share/man/man5/boot.config.5 +++ b/share/man/man5/boot.config.5 @@ -100,4 +100,4 @@ will do both of the above. .Xr loader 8 .Sh AUTHORS This manual page was written by -.An Daniel Gerzo Aq danger@FreeBSD.org . +.An Daniel Gerzo Aq Mt danger@FreeBSD.org . diff --git a/share/man/man5/devfs.5 b/share/man/man5/devfs.5 index 5ee1621fd1a..073f0a58aed 100644 --- a/share/man/man5/devfs.5 +++ b/share/man/man5/devfs.5 @@ -145,4 +145,4 @@ manual page first appeared in The .Nm manual page was written by -.An Mike Pritchard Aq mpp@FreeBSD.org . +.An Mike Pritchard Aq Mt mpp@FreeBSD.org . diff --git a/share/man/man5/devfs.conf.5 b/share/man/man5/devfs.conf.5 index 8e53735aab9..834d6e768e9 100644 --- a/share/man/man5/devfs.conf.5 +++ b/share/man/man5/devfs.conf.5 @@ -135,4 +135,4 @@ perm cd0 0660 .Xr chown 8 .Sh AUTHORS This manual page was written by -.An "Roland Smith" Aq rsmith@xs4all.nl . +.An Roland Smith Aq Mt rsmith@xs4all.nl . diff --git a/share/man/man5/devfs.rules.5 b/share/man/man5/devfs.rules.5 index 603189e2e01..b8016dbf801 100644 --- a/share/man/man5/devfs.rules.5 +++ b/share/man/man5/devfs.rules.5 @@ -124,4 +124,4 @@ group, a similar rule may be used: .Xr devfs 8 .Sh AUTHORS This manual page was written by -.An "Roland Smith" Aq rsmith@xs4all.nl . +.An Roland Smith Aq Mt rsmith@xs4all.nl . diff --git a/share/man/man5/elf.5 b/share/man/man5/elf.5 index b68363ef12c..a72eed6a1f9 100644 --- a/share/man/man5/elf.5 +++ b/share/man/man5/elf.5 @@ -1305,8 +1305,7 @@ ELF in itself first appeared in The ELF format is an adopted standard. .Sh AUTHORS This manual page was written by -.An Jeroen Ruigrok van der Werven -.Aq asmodai@FreeBSD.org +.An Jeroen Ruigrok van der Werven Aq Mt asmodai@FreeBSD.org with inspiration from BSDi's .Bsx .Xr elf 5 diff --git a/share/man/man5/ext2fs.5 b/share/man/man5/ext2fs.5 index 536561b1a4b..00be16f750a 100644 --- a/share/man/man5/ext2fs.5 +++ b/share/man/man5/ext2fs.5 @@ -80,4 +80,4 @@ and others in the Project made modifications. .Pp This manual page was written by -.An Craig Rodrigues Aq rodrigc@FreeBSD.org . +.An Craig Rodrigues Aq Mt rodrigc@FreeBSD.org . diff --git a/share/man/man5/fdescfs.5 b/share/man/man5/fdescfs.5 index f7232085895..30e72a5f3b1 100644 --- a/share/man/man5/fdescfs.5 +++ b/share/man/man5/fdescfs.5 @@ -120,7 +120,7 @@ manual page first appeared in The .Nm manual page was written by -.An Mike Pritchard Aq mpp@FreeBSD.org , +.An Mike Pritchard Aq Mt mpp@FreeBSD.org , and was based on the manual page written by .An Jan-Simon Pendry . diff --git a/share/man/man5/freebsd-update.conf.5 b/share/man/man5/freebsd-update.conf.5 index f9f7a562fa4..498fa15e685 100644 --- a/share/man/man5/freebsd-update.conf.5 +++ b/share/man/man5/freebsd-update.conf.5 @@ -230,4 +230,4 @@ configuration file. .Xr sha256 1 , .Xr freebsd-update 8 .Sh AUTHORS -.An Colin Percival Aq cperciva@FreeBSD.org +.An Colin Percival Aq Mt cperciva@FreeBSD.org diff --git a/share/man/man5/libmap.conf.5 b/share/man/man5/libmap.conf.5 index b97160faa07..f59bc071ff5 100644 --- a/share/man/man5/libmap.conf.5 +++ b/share/man/man5/libmap.conf.5 @@ -174,7 +174,8 @@ The mechanism first appeared in .Fx 5.1 . .Sh AUTHORS +.An -nosplit This manual page was written by -.An Matthew N. Dodd Aq winter@jurai.net +.An Matthew N. Dodd Aq Mt winter@jurai.net and extensively rewritten by -.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . +.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org . diff --git a/share/man/man5/mailer.conf.5 b/share/man/man5/mailer.conf.5 index 3f48eda1a95..dc55ae773e4 100644 --- a/share/man/man5/mailer.conf.5 +++ b/share/man/man5/mailer.conf.5 @@ -153,7 +153,7 @@ send-mail /usr/local/bin/mini_sendmail -srelayhost appeared in .Nx 1.4 . .Sh AUTHORS -.An Perry E. Metzger Aq perry@piermont.com +.An Perry E. Metzger Aq Mt perry@piermont.com .Sh BUGS The entire reason this program exists is a crock. Instead, a command diff --git a/share/man/man5/make.conf.5 b/share/man/man5/make.conf.5 index 441de4b0a17..e70574963f1 100644 --- a/share/man/man5/make.conf.5 +++ b/share/man/man5/make.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 2, 2014 +.Dd May 17, 2014 .Dt MAKE.CONF 5 .Os .Sh NAME @@ -145,7 +145,7 @@ are not supported. is provided as a set of .Xr cc 1 settings suggested by -.An "Bruce Evans" Aq bde@FreeBSD.org +.An Bruce Evans Aq Mt bde@FreeBSD.org for developing and testing changes. They can be used, if set, by: .Bd -literal -offset indent @@ -658,6 +658,14 @@ for simple printers, or for postscript or graphics printers with a ghostscript filter, or both. .El +.Ss "BUILDING PORTS" +Several make variables can be set that affect the building of ports. +These variables and their effects are documented in +.Xr ports 7 , +.Pa ${PORTSDIR}/Mk/* +and the +.Fx +Porter's Handbook. .Sh FILES .Bl -tag -width ".Pa /usr/share/examples/etc/make.conf" -compact .It Pa /etc/make.conf @@ -684,7 +692,7 @@ file appeared sometime before .Sh AUTHORS This manual page was written by -.An Mike W. Meyer Aq mwm@mired.org . +.An Mike W. Meyer Aq Mt mwm@mired.org . .Sh CAVEATS Note, that .Ev MAKEOBJDIRPREFIX diff --git a/share/man/man5/mqueuefs.5 b/share/man/man5/mqueuefs.5 index 2431267a8e3..dedec109cef 100644 --- a/share/man/man5/mqueuefs.5 +++ b/share/man/man5/mqueuefs.5 @@ -121,4 +121,4 @@ To see the queue's attributes, just read the file: .Xr umount 8 .Sh AUTHORS This manual page was written by -.An "David Xu" Aq davidxu@FreeBSD.org . +.An David Xu Aq Mt davidxu@FreeBSD.org . diff --git a/share/man/man5/msdosfs.5 b/share/man/man5/msdosfs.5 index 70cfe50794d..ff1df4ba525 100644 --- a/share/man/man5/msdosfs.5 +++ b/share/man/man5/msdosfs.5 @@ -66,4 +66,4 @@ directory layout. .Xr umount 8 .Sh AUTHORS This manual page was written by -.An Tom Rhodes Aq trhodes@FreeBSD.org . +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org . diff --git a/share/man/man5/nandfs.5 b/share/man/man5/nandfs.5 index 2ef3259f591..9084b898683 100644 --- a/share/man/man5/nandfs.5 +++ b/share/man/man5/nandfs.5 @@ -114,15 +114,18 @@ code diverged significantly and is by no means compatible with NILFS. .Pp The NAND Flash file system first appeared in .Fx 10.0 . -.Sh AUTHOR +.Sh AUTHORS +.An -nosplit The NAND FS was written by -.An Grzegorz Bernacki with the help of +.An Grzegorz Bernacki +with the help of .An Mateusz Guzik , based on the NetBSD code created by .An Reinoud Zandijk . Additional help and support by .An Lukasz Plachno , -.An Jan Sieka and +.An Jan Sieka +and .An Lukasz Wojcik . This manual page was written by .An Rafal Jaworowski . diff --git a/share/man/man5/nsmb.conf.5 b/share/man/man5/nsmb.conf.5 index 7e48f60ac0e..9f76e787982 100644 --- a/share/man/man5/nsmb.conf.5 +++ b/share/man/man5/nsmb.conf.5 @@ -147,6 +147,6 @@ smbutil crypt .Sh AUTHORS This manual page was written by .An -nosplit -.An Sergey Osokin Aq osa@FreeBSD.org +.An Sergey Osokin Aq Mt osa@FreeBSD.org and -.An Tom Rhodes Aq trhodes@FreeBSD.org . +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org . diff --git a/share/man/man5/nsswitch.conf.5 b/share/man/man5/nsswitch.conf.5 index 80b6cb212fb..b1fbbd489e5 100644 --- a/share/man/man5/nsswitch.conf.5 +++ b/share/man/man5/nsswitch.conf.5 @@ -373,8 +373,7 @@ It was imported from the Project, where it appeared first in .Nx 1.4 . .Sh AUTHORS -Luke Mewburn -.Aq lukem@netbsd.org +.An Luke Mewburn Aq Mt lukem@netbsd.org wrote this freely distributable name-service switch implementation, using ideas from the .Tn ULTRIX diff --git a/share/man/man5/nullfs.5 b/share/man/man5/nullfs.5 index 653711b12bb..3f691e49914 100644 --- a/share/man/man5/nullfs.5 +++ b/share/man/man5/nullfs.5 @@ -72,4 +72,4 @@ kernel implementation was written by .An John Heideman . .Pp This manual page was written by -.An Daniel Gerzo Aq danger@FreeBSD.org . +.An Daniel Gerzo Aq Mt danger@FreeBSD.org . diff --git a/share/man/man5/passwd.5 b/share/man/man5/passwd.5 index fa41c7b657e..c1f23499f44 100644 --- a/share/man/man5/passwd.5 +++ b/share/man/man5/passwd.5 @@ -31,7 +31,7 @@ .\" From: @(#)passwd.5 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd June 23, 2012 +.Dd May 29, 2014 .Dt PASSWD 5 .Os .Sh NAME @@ -125,19 +125,29 @@ Routines that manipulate these files will often return only one of the multiple entries, and that one by random selection. .Pp -The login name must never begin with a hyphen -.Pq Ql - ; -also, it is strongly -suggested that neither upper-case characters or dots -.Pq Ql \&. -be part -of the name, as this tends to confuse mailers. +The login name must not begin with a hyphen +.Pq Ql \&- , +and cannot contain 8-bit characters, tabs or spaces, or any of these +symbols: +.Ql \&,:+&#%^\&(\&)!@~*?<>=|\e\\&/" . +The dollar symbol +.Pq Ql \&$ +is allowed only as the last character for use with Samba. No field may contain a colon .Pq Ql \&: as this has been used historically to separate the fields in the user database. .Pp +Case is significant. +Login names +.Ql Lrrr +and +.Ql lrrr +represent different users. +Be aware of this when interoperating with systems that do not have +case-sensitive login names. +.Pp In the .Nm master.passwd file, diff --git a/share/man/man5/periodic.conf.5 b/share/man/man5/periodic.conf.5 index b4629a8dc2c..83897c15262 100644 --- a/share/man/man5/periodic.conf.5 +++ b/share/man/man5/periodic.conf.5 @@ -973,4 +973,4 @@ The file appeared in .Fx 4.1 . .Sh AUTHORS -.An Brian Somers Aq brian@Awfulhak.org +.An Brian Somers Aq Mt brian@Awfulhak.org diff --git a/share/man/man5/pf.conf.5 b/share/man/man5/pf.conf.5 index 83fc7c5609c..eff90866a76 100644 --- a/share/man/man5/pf.conf.5 +++ b/share/man/man5/pf.conf.5 @@ -342,7 +342,6 @@ set limit states 10000 .Pp With 9000 state table entries, the timeout values are scaled to 50% (tcp.first 60, tcp.established 43200). -.Pp .It Ar set loginterface Enable collection of packet and byte count statistics for the given interface or interface group. @@ -362,7 +361,6 @@ One can disable the loginterface using: .Bd -literal -offset indent set loginterface none .Ed -.Pp .It Ar set limit Sets hard limits on the memory pools used by the packet filter. See @@ -415,7 +413,6 @@ Various limits can be combined on a single line: .Bd -literal -offset indent set limit { states 20000, frags 20000, src-nodes 2000 } .Ed -.Pp .It Ar set ruleset-optimization .Bl -tag -width xxxxxxxx -compact .It Ar none @@ -481,7 +478,6 @@ For example: .Bd -literal -offset indent set optimization aggressive .Ed -.Pp .It Ar set block-policy The .Ar block-policy @@ -573,7 +569,6 @@ ruleset finishes loading. For example: .Pp .Dl set fingerprints \&"/etc/pf.os.devel\&" -.Pp .It Ar set skip on Aq Ar ifspec List interfaces for which packets should not be filtered. Packets passing in or out on such interfaces are passed as if pf was @@ -583,7 +578,6 @@ packet filtering is not desired and can have unexpected effects. For example: .Pp .Dl set skip on lo0 -.Pp .It Ar set debug Set the debug .Ar level @@ -693,7 +687,6 @@ are received. The .Ar fragment crop reassembly mechanism does not yet work with NAT. -.Pp .It Ar fragment drop-ovl This option is similar to the .Ar fragment crop diff --git a/share/man/man5/portindex.5 b/share/man/man5/portindex.5 index a3f856fef2c..c997a256167 100644 --- a/share/man/man5/portindex.5 +++ b/share/man/man5/portindex.5 @@ -97,4 +97,4 @@ vim-6.3.15|/usr/ports/editors/vim|/usr/local|Vi "workalike", with many additiona This manual page was written by .An Paul Armstrong and -.An Thomas Abthorpe Aq tabthorpe@FreeBSD.org . +.An Thomas Abthorpe Aq Mt tabthorpe@FreeBSD.org . diff --git a/share/man/man5/portsnap.conf.5 b/share/man/man5/portsnap.conf.5 index 07685b2b0ef..f679edab300 100644 --- a/share/man/man5/portsnap.conf.5 +++ b/share/man/man5/portsnap.conf.5 @@ -144,4 +144,4 @@ Default location of the portsnap configuration file. .Xr portsnap 8 , .Xr sha256 8 .Sh AUTHORS -.An Colin Percival Aq cperciva@FreeBSD.org +.An Colin Percival Aq Mt cperciva@FreeBSD.org diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index 2dd713bd40b..c87de447bce 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -1498,7 +1498,6 @@ interface as described in RFC 4941. This is the IPv6 equivalent of .Va network_interfaces . Normally manual configuration of this variable is not needed. -.Pp .It Va ipv6_cpe_wanif .Pq Vt str If the variable is set to an interface name, diff --git a/share/man/man5/reiserfs.5 b/share/man/man5/reiserfs.5 index c610f5e3722..254afb7b240 100644 --- a/share/man/man5/reiserfs.5 +++ b/share/man/man5/reiserfs.5 @@ -74,10 +74,10 @@ The ReiserFS kernel implementation was written by and ported to .Fx by -.An Jean-S\['e]bastien P\['e]dron Aq dumbbell@FreeBSD.org . +.An Jean-S\['e]bastien P\['e]dron Aq Mt dumbbell@FreeBSD.org . .Pp This manual page was written by -.An Craig Rodrigues Aq rodrigc@FreeBSD.org . +.An Craig Rodrigues Aq Mt rodrigc@FreeBSD.org . .Sh CAVEATS Currently, only read-only access is supported for ReiserFS volumes, writing to a volume is not supported. diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index 885ffcea258..3c3c9cfc1ea 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: head/tools/build/options/makeman 255964 2013-10-01 07:22:04Z des .\" $FreeBSD$ -.Dd April 13, 2014 +.Dd July 16, 2014 .Dt SRC.CONF 5 .Os .Sh NAME @@ -125,25 +125,23 @@ Set to not build audit support into system programs. Set to not build .Xr authpf 8 . .It Va WITHOUT_BINUTILS -.\" from FreeBSD: head/tools/build/options/WITHOUT_BINUTILS 255974 2013-10-01 17:40:56Z emaste -Set to not install binutils (as, c++-filt, gconv, -ld, nm, objcopy, objdump, readelf, size and strip). +.\" from FreeBSD: head/tools/build/options/WITHOUT_BINUTILS 266158 2014-05-15 16:51:45Z brooks +Set to not build or install binutils (as, c++-filt, gconv, +ld, nm, objcopy, objdump, readelf, size and strip) as part +of the normal system build. +The resulting system cannot build programs from source. +.It Va WITHOUT_BINUTILS_BOOTSTRAP +.\" from FreeBSD: head/tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP 264660 2014-04-18 17:03:58Z imp +Set to not build binutils (as, c++-filt, gconv, +ld, nm, objcopy, objdump, readelf, size and strip) +as part of the bootstrap process. .Bf -symbolic -The option does not generally work for build targets, unless some alternative -toolchain is enabled. +The option does not work for build targets unless some alternative +toolchain is provided. .Ef .It Va WITHOUT_BLUETOOTH .\" from FreeBSD: head/tools/build/options/WITHOUT_BLUETOOTH 156932 2006-03-21 07:50:50Z ru Set to not build Bluetooth related kernel modules, programs and libraries. -.It Va WITHOUT_BMAKE -.\" from FreeBSD: head/tools/build/options/WITHOUT_BMAKE 263089 2014-03-12 11:53:35Z jmmv -Set to not build and install the portable BSD make (bmake) as -.Xr make 1 -instead of the traditional FreeBSD make. -This build option is temporary. -It allows developers to switch to the traditional FreeBSD make in order to -work out any remaining kinks or issues. -This option will be removed in due time. .It Va WITHOUT_BOOT .\" from FreeBSD: head/tools/build/options/WITHOUT_BOOT 156932 2006-03-21 07:50:50Z ru Set to not build the boot blocks and loader. @@ -196,11 +194,11 @@ When set, it also enforces the following options: .Va WITHOUT_ZFS .El .It Va WITHOUT_CLANG -.\" from FreeBSD: head/tools/build/options/WITHOUT_CLANG 208971 2010-06-10 06:20:26Z ed -Set to not build the Clang C/C++ compiler. +.\" from FreeBSD: head/tools/build/options/WITHOUT_CLANG 264660 2014-04-18 17:03:58Z imp +Set to not build the Clang C/C++ compiler during the regular phase of the build. .Pp It is a default setting on -arm/armeb, ia64/ia64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32 and sparc64/sparc64. +arm/armeb, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32 and sparc64/sparc64. When set, it also enforces the following options: .Pp .Bl -item -compact @@ -210,8 +208,23 @@ When set, it also enforces the following options: .Va WITHOUT_CLANG_FULL .El .It Va WITH_CLANG -.\" from FreeBSD: head/tools/build/options/WITH_CLANG 221730 2011-05-10 11:14:40Z ru -Set to build the Clang C/C++ compiler. +.\" from FreeBSD: head/tools/build/options/WITH_CLANG 264660 2014-04-18 17:03:58Z imp +Set to build the Clang C/C++ compiler during the normal phase of the build. +.Pp +It is a default setting on +amd64/amd64, arm/arm, arm/armv6, arm/armv6hf, i386/i386, pc98/i386, powerpc/powerpc and powerpc/powerpc64. +.It Va WITHOUT_CLANG_BOOTSTRAP +.\" from FreeBSD: head/tools/build/options/WITHOUT_CLANG_BOOTSTRAP 264660 2014-04-18 17:03:58Z imp +Set to not build the Clang C/C++ compiler during the bootstrap phase of the build. +You must enable wither gcc or clang bootstrap to be able to build the system, +unless an alternative compiiler is provided via +XCC. +.Pp +It is a default setting on +arm/armeb, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32 and sparc64/sparc64. +.It Va WITH_CLANG_BOOTSTRAP +.\" from FreeBSD: head/tools/build/options/WITH_CLANG_BOOTSTRAP 264660 2014-04-18 17:03:58Z imp +Set to build the Clang C/C++ compiler during the bootstrap phase of the build. .Pp It is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv6hf, i386/i386, pc98/i386, powerpc/powerpc and powerpc/powerpc64. @@ -224,7 +237,7 @@ Set to avoid building the ARCMigrate, Rewriter and StaticAnalyzer components of the Clang C/C++ compiler. .Pp It is a default setting on -arm/arm, arm/armeb, arm/armv6, arm/armv6hf, ia64/ia64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32 and sparc64/sparc64. +arm/arm, arm/armeb, arm/armv6, arm/armv6hf, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32 and sparc64/sparc64. .It Va WITH_CLANG_FULL .\" from FreeBSD: head/tools/build/options/WITH_CLANG_FULL 246259 2013-02-02 22:28:29Z dim Set to build the ARCMigrate, Rewriter and StaticAnalyzer components of the @@ -241,7 +254,7 @@ and .Pa /usr/bin/cpp . .Pp It is a default setting on -arm/armeb, ia64/ia64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64. +arm/armeb, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64. .It Va WITH_CLANG_IS_CC .\" from FreeBSD: head/tools/build/options/WITH_CLANG_IS_CC 235342 2012-05-12 16:12:36Z gjb Set to install the Clang C/C++ compiler as @@ -257,9 +270,29 @@ amd64/amd64, arm/arm, arm/armv6, arm/armv6hf, i386/i386 and pc98/i386. Set to not build .Xr cpp 1 . .It Va WITHOUT_CROSS_COMPILER -.\" from FreeBSD: head/tools/build/options/WITHOUT_CROSS_COMPILER 250659 2013-05-15 14:30:03Z brooks -Set to not build a cross compiler in the cross-tools stage of -buildworld, buildkernel, etc. +.\" from FreeBSD: head/tools/build/options/WITHOUT_CROSS_COMPILER 264660 2014-04-18 17:03:58Z imp +Set to not build any cross compiler in the cross-tools stage of buildworld. +If you are compiling a different version of +.Fx +than what is installed on the system, you will need to provide an alternate +compiler with XCC to ensure success. +If you are compiling with an identical version of +.Fx +to the host, this option may be safely used. +This option may also be safe when the host version of +.Fx +is close to the sources being built, but all bets are off if there have +been any changes to the toolchain between the versions. +When set, it also enforces the following options: +.Pp +.Bl -item -compact +.It +.Va WITHOUT_BINUTILS_BOOTSTRAP +.It +.Va WITHOUT_CLANG_BOOTSTRAP +.It +.Va WITHOUT_GCC_BOOTSTRAP +.El .It Va WITHOUT_CRYPT .\" from FreeBSD: head/tools/build/options/WITHOUT_CRYPT 156932 2006-03-21 07:50:50Z ru Set to not build any crypto code. @@ -313,6 +346,8 @@ When set, it also enforces the following options: .It .Va WITHOUT_CLANG_FULL .It +.Va WITHOUT_GNUCXX +.It .Va WITHOUT_GROFF .El .It Va WITH_DEBUG_FILES @@ -329,6 +364,10 @@ Set to not build the Webster dictionary files. .It Va WITHOUT_DMAGENT .\" from FreeBSD: head/tools/build/options/WITHOUT_DMAGENT 262335 2014-02-22 13:05:23Z bapt Set to not build dma Mail Transport Agent +.It Va WITHOUT_DOCCOMPRESS +.\" from FreeBSD: head/tools/build/options/WITHOUT_DOCCOMPRESS 266752 2014-05-27 15:52:27Z gjb +Set to not to install compressed system documentation. +Only the uncompressed version will be installed. .It Va WITHOUT_DYNAMICROOT .\" from FreeBSD: head/tools/build/options/WITHOUT_DYNAMICROOT 156932 2006-03-21 07:50:50Z ru Set this if you do not want to link @@ -341,6 +380,9 @@ dynamically. Set to build .Xr ed 1 without support for encryption/decryption. +.It Va WITH_EISA +.\" from FreeBSD: head/tools/build/options/WITH_EISA 264654 2014-04-18 16:53:06Z imp +Set to build EISA kernel modules. .It Va WITHOUT_EXAMPLES .\" from FreeBSD: head/tools/build/options/WITHOUT_EXAMPLES 156938 2006-03-21 09:06:24Z ru Set to avoid installing examples to @@ -353,16 +395,15 @@ This includes the device tree compiler (dtc) and libfdt support library. .\" from FreeBSD: head/tools/build/options/WITHOUT_FLOPPY 221540 2011-05-06 19:13:03Z ru Set to not build or install programs for operating floppy disk driver. +.It Va WITH_FMAKE +.\" from FreeBSD: head/tools/build/options/WITH_FMAKE 266752 2014-05-27 15:52:27Z gjb +Causes the old FreeBSD +.Xr make 1 +program to be built and installed as fmake. .It Va WITHOUT_FMTREE .\" from FreeBSD: head/tools/build/options/WITHOUT_FMTREE 261299 2014-01-30 21:37:43Z brooks Set to not build and install .Pa /usr/sbin/fmtree . -.It Va WITHOUT_FORMAT_EXTENSIONS -.\" from FreeBSD: head/tools/build/options/WITHOUT_FORMAT_EXTENSIONS 250658 2013-05-15 13:04:10Z brooks -Set to not enable -.Fl fformat-extensions -when compiling the kernel. -Also disables all format checking. .It Va WITHOUT_FORTH .\" from FreeBSD: head/tools/build/options/WITHOUT_FORTH 156932 2006-03-21 07:50:50Z ru Set to build bootloaders without Forth support. @@ -379,17 +420,32 @@ Set to not build .\" from FreeBSD: head/tools/build/options/WITHOUT_GAMES 156932 2006-03-21 07:50:50Z ru Set to not build games. .It Va WITHOUT_GCC -.\" from FreeBSD: head/tools/build/options/WITHOUT_GCC 255326 2013-09-06 20:49:48Z zeising -Set to not build and install gcc and g++. +.\" from FreeBSD: head/tools/build/options/WITHOUT_GCC 264660 2014-04-18 17:03:58Z imp +Set to not build and install gcc and g++ as part of the normal build process. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv6hf and i386/i386. +amd64/amd64, arm/arm, arm/armv6, arm/armv6hf, i386/i386 and pc98/i386. .It Va WITH_GCC .\" from FreeBSD: head/tools/build/options/WITH_GCC 255326 2013-09-06 20:49:48Z zeising Set to build and install gcc and g++. .Pp It is a default setting on -arm/armeb, ia64/ia64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, pc98/i386, powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64. +arm/armeb, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64. +.It Va WITHOUT_GCC_BOOTSTRAP +.\" from FreeBSD: head/tools/build/options/WITHOUT_GCC_BOOTSTRAP 264660 2014-04-18 17:03:58Z imp +Set to not build gcc and g++ as part of the bootstrap process. +You must enable wither gcc or clang bootstrap to be able to build the system, +unless an alternative compiiler is provided via +XCC. +.Pp +It is a default setting on +amd64/amd64, arm/arm, arm/armv6, arm/armv6hf, i386/i386 and pc98/i386. +.It Va WITH_GCC_BOOTSTRAP +.\" from FreeBSD: head/tools/build/options/WITH_GCC_BOOTSTRAP 264660 2014-04-18 17:03:58Z imp +Set to build gcc and g++ as part of the bootstrap process. +.Pp +It is a default setting on +arm/armeb, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64. .It Va WITHOUT_GCOV .\" from FreeBSD: head/tools/build/options/WITHOUT_GCOV 156932 2006-03-21 07:50:50Z ru Set to not build the @@ -426,7 +482,11 @@ Build the GNU C++ stack (g++, libstdc++). This is the default on platforms where gcc is the system compiler. .Pp It is a default setting on -arm/armeb, ia64/ia64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64. +arm/armeb, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64. +.It Va WITHOUT_GNU_GREP_COMPAT +.\" from FreeBSD: head/tools/build/options/WITHOUT_GNU_GREP_COMPAT 266752 2014-05-27 15:52:27Z gjb +Set this option to omit the gnu extentions to grep from being included in +BSD grep. .It Va WITHOUT_GNU_SUPPORT .\" from FreeBSD: head/tools/build/options/WITHOUT_GNU_SUPPORT 156932 2006-03-21 07:50:50Z ru Set to build some programs without optional GNU support. @@ -438,6 +498,10 @@ Set to not build GPIB bus support. Set to not build .Xr gpioctl 8 as part of the base system. +.It Va WITHOUT_GPL_DTC +.\" from FreeBSD: head/tools/build/options/WITHOUT_GPL_DTC 264515 2014-04-15 20:41:55Z imp +Set to build the BSD licensed version of the device tree compiler, instead of the +GPL'd one from elinux.org. .It Va WITHOUT_GROFF .\" from FreeBSD: head/tools/build/options/WITHOUT_GROFF 218941 2011-02-22 08:13:49Z uqs Set to not build @@ -483,9 +547,9 @@ Set to build libraries, programs, and kernel modules without IPv6 support. .It Va WITHOUT_INET_SUPPORT .\" from FreeBSD: head/tools/build/options/WITHOUT_INET_SUPPORT 221266 2011-04-30 17:58:28Z bz Set to build libraries, programs, and kernel modules without IPv4 support. -.It Va WITHOUT_INFO -.\" from FreeBSD: head/tools/build/options/WITHOUT_INFO 156932 2006-03-21 07:50:50Z ru -Set to not make or install +.It Va WITH_INFO +.\" from FreeBSD: head/tools/build/options/WITH_INFO 268496 2014-07-10 15:05:41Z bapt +Set to make or install .Xr info 5 files. .It Va WITHOUT_INSTALLLIB @@ -546,12 +610,6 @@ Set to build some programs without Kerberos support, like .Xr sshd 8 , and .Xr telnetd 8 . -.It Va WITHOUT_KERNEL_SYMBOLS -.\" from FreeBSD: head/tools/build/options/WITHOUT_KERNEL_SYMBOLS 222189 2011-05-22 18:23:17Z imp -Set to not install kernel symbol files. -.Bf -symbolic -This option is recommended for those people who have small root partitions. -.Ef .It Va WITHOUT_KVM .\" from FreeBSD: head/tools/build/options/WITHOUT_KVM 174550 2007-12-12 16:43:17Z ru Set to not build the @@ -679,6 +737,10 @@ When set, the following options are also in effect: .Va WITH_MAN_UTILS is set explicitly) .El +.It Va WITHOUT_MANCOMPRESS +.\" from FreeBSD: head/tools/build/options/WITHOUT_MANCOMPRESS 266752 2014-05-27 15:52:27Z gjb +Set to not to install compressed man pages. +Only the uncompressed versions will be installed. .It Va WITHOUT_MAN_UTILS .\" from FreeBSD: head/tools/build/options/WITHOUT_MAN_UTILS 208322 2010-05-20 00:07:21Z jkim Set to not build utilities for manual pages, @@ -692,11 +754,6 @@ and related support files. .It Va WITH_NAND .\" from FreeBSD: head/tools/build/options/WITH_NAND 235537 2012-05-17 10:11:18Z gber Set to build the NAND Flash components. -.It Va WITHOUT_NCURSESW -.\" from FreeBSD: head/tools/build/options/WITHOUT_NCURSESW 261300 2014-01-30 21:41:25Z brooks -Set to not build or depend on the -.Nm libncursesw -library. .It Va WITHOUT_NDIS .\" from FreeBSD: head/tools/build/options/WITHOUT_NDIS 183242 2008-09-21 22:02:26Z sam Set to not build programs and libraries @@ -758,6 +815,9 @@ and related programs. Set to build the .Dq "OpenFabrics Enterprise Distribution" Infiniband software stack. +.It Va WITH_OPENLDAP +.\" from FreeBSD: head/tools/build/options/WITH_OPENLDAP 264902 2014-04-24 23:17:31Z imp +Enable building openldap support for kerberos. .It Va WITHOUT_OPENSSH .\" from FreeBSD: head/tools/build/options/WITHOUT_OPENSSH 156932 2006-03-21 07:50:50Z ru Set to not build OpenSSH. @@ -825,6 +885,9 @@ When set, it also enforces the following options: .It .Va WITHOUT_AUTHPF .El +.It Va WITH_PIE +.\" from FreeBSD: head/tools/build/options/WITH_PIE 267233 2014-06-08 17:29:31Z bdrewery +Enable building of Position-Independent Executables (PIEs). .It Va WITHOUT_PKGBOOTSTRAP .\" from FreeBSD: head/tools/build/options/WITHOUT_PKGBOOTSTRAP 258924 2013-12-04 15:58:42Z bdrewery Set to not build @@ -936,6 +999,9 @@ and related programs. .It Va WITHOUT_SYMVER .\" from FreeBSD: head/tools/build/options/WITHOUT_SYMVER 169649 2007-05-17 05:03:24Z deischen Set to disable symbol versioning when building shared libraries. +.It Va WITHOUT_SYSCALL_COMPAT +.\" from FreeBSD: head/tools/build/options/WITHOUT_SYSCALL_COMPAT 265826 2014-05-10 16:37:28Z imp +Do not include some compatible syscall wrappers in libc. .It Va WITHOUT_SYSCONS .\" from FreeBSD: head/tools/build/options/WITHOUT_SYSCONS 156932 2006-03-21 07:50:50Z ru Set to not build @@ -957,14 +1023,16 @@ Set to not build and install Set to not build .Xr telnet 8 and related programs. -.It Va WITH_TESTS -.\" from FreeBSD: head/tools/build/options/WITH_TESTS 264408 2014-04-13 11:29:52Z jmmv -Set to install the +.It Va WITHOUT_TESTS +.\" from FreeBSD: head/tools/build/options/WITHOUT_TESTS 268778 2014-07-16 21:40:11Z jmmv +Set to not build nor install the .Fx -Test Suite. +Test Suite in +.Pa /usr/tests/ . See .Xr tests 7 for more details. +This also disables the build of all test-related dependencies, including ATF. .It Va WITHOUT_TEXTPROC .\" from FreeBSD: head/tools/build/options/WITHOUT_TEXTPROC 183242 2008-09-21 22:02:26Z sam Set to not build @@ -1020,6 +1088,20 @@ Set to not build user accounting tools such as .Xr lastlogin 8 and .Xr utx 8 . +.It Va WITHOUT_VI +.\" from FreeBSD: head/tools/build/options/WITHOUT_VI 264903 2014-04-24 23:17:40Z imp +Set to not build and install vi, view, ex and related programs. +.It Va WITHOUT_VT +.\" from FreeBSD: head/tools/build/options/WITHOUT_VT 268022 2014-06-30 00:20:12Z emaste +Set to not build +.Xr vt 4 +support files (fonts and keymaps). +.It Va WITHOUT_WARNS +.\" from FreeBSD: head/tools/build/options/WITHOUT_WARNS 265830 2014-05-10 16:37:53Z imp +Set this to not add warning flags to the compiler invocations. +Useful as a temporary workaround when code enters the tree +which triggers warnings in environments that differ from the +original develoepr. .It Va WITHOUT_WIRELESS .\" from FreeBSD: head/tools/build/options/WITHOUT_WIRELESS 183242 2008-09-21 22:02:26Z sam Set to not build programs used for 802.11 wireless networks; especially diff --git a/share/man/man5/tmpfs.5 b/share/man/man5/tmpfs.5 index 78568d2253a..9cce1fba868 100644 --- a/share/man/man5/tmpfs.5 +++ b/share/man/man5/tmpfs.5 @@ -129,7 +129,7 @@ driver first appeared in The .Nm kernel implementation was written by -.An Julio M. Merino Vidal Aq jmmv@NetBSD.org +.An Julio M. Merino Vidal Aq Mt jmmv@NetBSD.org as a Google SoC project. .Pp .An Rohit Jalan @@ -139,6 +139,6 @@ to .Fx . .Pp This manual page was written by -.An Xin LI Aq delphij@FreeBSD.org . +.An Xin LI Aq Mt delphij@FreeBSD.org . .Sh BUGS Some file system mount time options may not be well-supported. diff --git a/share/man/man7/build.7 b/share/man/man7/build.7 index 76a2fa6e1ad..a2172ed3316 100644 --- a/share/man/man7/build.7 +++ b/share/man/man7/build.7 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 27, 2014 +.Dd June 25, 2014 .Dt BUILD 7 .Os .Sh NAME @@ -40,8 +40,7 @@ normally and .Pa /usr/ports . These directories may be initially empty or non-existent until updated with -.Xr csup 1 , -.Xr svn 1 , +.Xr svn 1 or .Xr portsnap 8 . Directory @@ -415,6 +414,12 @@ If set, this variable supplies a list of additional directories relative to the root of the source tree to build as part of the .Cm everything target. +.It Va LOCAL_ITOOLS +If set, this variable supplies a list of additional tools that are used by the +.Cm installworld +and +.Cm distributeworld +targets. .It Va LOCAL_LIB_DIRS If set, this variable supplies a list of additional directories relative to the root of the source tree to build as part of the @@ -610,7 +615,6 @@ make TARGET=sparc64 DESTDIR=/clients/sparc64 installworld .Ed .Sh SEE ALSO .Xr cc 1 , -.Xr csup 1 , .Xr install 1 , .Xr make 1 , .Xr svn 1 , @@ -624,4 +628,4 @@ make TARGET=sparc64 DESTDIR=/clients/sparc64 installworld .Xr reboot 8 , .Xr shutdown 8 .Sh AUTHORS -.An Mike W. Meyer Aq mwm@mired.org . +.An Mike W. Meyer Aq Mt mwm@mired.org diff --git a/share/man/man7/c99.7 b/share/man/man7/c99.7 index 43ef6750cd6..fcf14769d0e 100644 --- a/share/man/man7/c99.7 +++ b/share/man/man7/c99.7 @@ -180,4 +180,4 @@ This manual page first appeared in .Fx 9.0 . .Sh AUTHORS This manual page was originally written by -.An Gabor Kovesdan Aq gabor@FreeBSD.org . +.An Gabor Kovesdan Aq Mt gabor@FreeBSD.org . diff --git a/share/man/man7/development.7 b/share/man/man7/development.7 index 18b98131fc4..65fe008ad12 100644 --- a/share/man/man7/development.7 +++ b/share/man/man7/development.7 @@ -467,14 +467,14 @@ operations you do will be done as The .Nm manual page was originally written by -.An Matthew Dillon Aq dillon@FreeBSD.org +.An Matthew Dillon Aq Mt dillon@FreeBSD.org and first appeared in .Fx 5.0 , December 2002. It was since extensively modified by -.An Eitan Adler Aq eadler@FreeBSD.org +.An Eitan Adler Aq Mt eadler@FreeBSD.org to reflect the repository conversion from -.Xr cvs +.Xr cvs 1 to -.Xr svn . +.Xr svn 1 . diff --git a/share/man/man7/hier.7 b/share/man/man7/hier.7 index 1722ea37b35..782517cefc9 100644 --- a/share/man/man7/hier.7 +++ b/share/man/man7/hier.7 @@ -28,7 +28,7 @@ .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd December 25, 2013 +.Dd July 25, 2014 .Dt HIER 7 .Os .Sh NAME @@ -86,10 +86,6 @@ see .Xr rc 8 .It Pa bluetooth/ bluetooth configuration files -.It Pa gnats/ -gnats configuration files; -see -.Xr send-pr 1 .It Pa localtime local timezone information; see @@ -226,6 +222,8 @@ WaveLAN driver .El .It Pa fs/ .Bl -tag -width ".Pa kerberos5/" -compact +.It Pa cd9660/ +iso9660 file system .It Pa fdescfs/ per-process file descriptors file system .It Pa fifofs/ @@ -265,11 +263,6 @@ STRIPE GEOM class .Pp .It Pa isc/ ISC utility library libisc include files -.It Pa isofs/ -.Bl -tag -width ".Pa kerberos5/" -compact -.It Pa cd9660/ -iso9660 file system -.El .It Pa libmilter/ C include files for libmilter, the @@ -279,6 +272,10 @@ mail filter API machine-specific C include files .It Pa net/ miscellaneous network C include files +.It Pa net80211/ +C include files for 802.11 wireless networking; +see +.Xr net80211 4 .It Pa netinet/ C include files for Internet standard protocols; see diff --git a/share/man/man7/ports.7 b/share/man/man7/ports.7 index 04ffa7f8a49..a73914bbe86 100644 --- a/share/man/man7/ports.7 +++ b/share/man/man7/ports.7 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 18, 2012 +.Dd June 6, 2014 .Dt PORTS 7 .Os .Sh NAME @@ -458,7 +458,7 @@ If defined, only operate on a port if it requires interaction. If defined, only operate on a port if it can be installed 100% automatically. .It Va DISABLE_VULNERABILITIES If defined, disable check for security vulnerabilities using -.Xr portaudit 1 Pq Pa ports/ports-mgmt/portaudit +.Xr pkg-audit 8 when installing new ports. .It Va NO_IGNORE If defined, allow installation of ports marked as @@ -486,6 +486,44 @@ have been configured will have a uniquely named sub-directory, containing a single file .Pa options . .El +.Sh MAKE VARIABLES +The following list provides a name and short description for many of the +variables that are used when building ports. +More information on these and other related variables may be found in +.Pa ${PORTSDIR}/Mk/* +and the +.Fx +Porter's Handbook. +.Bl -tag -width ".Va OVERRIDE_LINUX_BASE_PORT" +.It Va WITH_OPENSSL_PORT +.Pq Vt bool +If set, causes ports that make use of OpenSSL to use the OpenSSL from +ports +.Pq if available +instead of the OpenSSL from the base system. +.It Va WITH_DEBUG +.Pq Vt bool +If set, debugging symbols are installed for ports binaries. +.It Va WITH_DEBUG_PORTS +A list of origins for which to set +.Va WITH_DEBUG_PORTS . +.It Va WITH_SSP_PORTS +.Pq Vt bool +If set, enables +.Fl fstack-protector +for most ports. +.It Va WITH_GHOSTSCRIPT_VER +If set, the version of ghostscript to be used by ports. +.It Va OVERRIDE_LINUX_BASE_PORT +The default linux base to use. +.It Va WITH_CCACHE_BUILD +.Pq Vt bool +If set, enables the use of +.Xr ccache 1 +for building ports. +.It Va CCACHE_DIR +Which directory to use for the ccache data. +.El .Sh FILES .Bl -tag -width ".Pa /usr/ports/Mk/bsd.port.mk" -compact .It Pa /usr/ports @@ -495,12 +533,13 @@ The big Kahuna. .El .Sh SEE ALSO .Xr make 1 , +.Xr make.conf 5 , .Xr pkg 8 , .Xr portsnap 8 .Pp The following are part of the ports collection: .Pp -.Xr portaudit 1 , +.Xr pkg 7 , .Xr portlint 1 .Rs .%B "The FreeBSD Handbook" diff --git a/share/man/man7/release.7 b/share/man/man7/release.7 index f3f897ec540..8fc75f3da4e 100644 --- a/share/man/man7/release.7 +++ b/share/man/man7/release.7 @@ -636,10 +636,10 @@ and .An Poul-Henning Kamp . .Pp This manual page was originally written by -.An Murray Stokely Aq murray@FreeBSD.org . +.An Murray Stokely Aq Mt murray@FreeBSD.org . .Pp It was updated by -.An Nathan Whitehorn Aq nwhitehorn@FreeBSD.org +.An Nathan Whitehorn Aq Mt nwhitehorn@FreeBSD.org to include the .Fa generate-release.sh script used for the @@ -647,7 +647,7 @@ script used for the release cycle. .Pp It was later updated by -.An Glen Barber Aq gjb@FreeBSD.org +.An Glen Barber Aq Mt gjb@FreeBSD.org to include the .Fa release.sh script used for the diff --git a/share/man/man7/sdoc.7 b/share/man/man7/sdoc.7 index a3c000dff3c..d678c97e281 100644 --- a/share/man/man7/sdoc.7 +++ b/share/man/man7/sdoc.7 @@ -237,5 +237,7 @@ The manual page first appeared in .Fx 5.0 . .Sh AUTHORS -.An "Tim Fraser, NAI Labs CBOSS project." Aq tfraser@tislabs.com -.An "Brian Feldman, NAI Labs CBOSS project." Aq bfeldman@tislabs.com +.An Tim Fraser Aq Mt tfraser@tislabs.com , +NAI Labs CBOSS project +.An Brian Feldman Aq Mt bfeldman@tislabs.com , +NAI Labs CBOSS project diff --git a/share/man/man7/sprog.7 b/share/man/man7/sprog.7 index cde04b2f7cb..f5a2d9ca4ec 100644 --- a/share/man/man7/sprog.7 +++ b/share/man/man7/sprog.7 @@ -173,8 +173,8 @@ properly beforehand. .Xr strlcpy 3 .Sh AUTHORS .An -nosplit -.An Eric Melville Aq eric@FreeBSD.org +.An Eric Melville Aq Mt eric@FreeBSD.org originally wrote this document based on a chapter of the .%B "FreeBSD Developer's Handbook" written by -.An Murray Stokely Aq murray@FreeBSD.org . +.An Murray Stokely Aq Mt murray@FreeBSD.org . diff --git a/share/man/man7/tests.7 b/share/man/man7/tests.7 index f7d0611fb94..e8e216aafc2 100644 --- a/share/man/man7/tests.7 +++ b/share/man/man7/tests.7 @@ -195,7 +195,7 @@ For more details please refer to: .It .Lk http://lists.freebsd.org/ "FreeBSD Mailing Lists" .It -.Lk http://www.freebsd.org/send-pr.html "Submit a FreeBSD Problem Report" +.Lk http://www.freebsd.org/support.html "Problem Reporting" .El .Sh FILES .Bl -tag -compact -width usrXlocalXetcXkyuaXkyuaXconfXX diff --git a/share/man/man7/tuning.7 b/share/man/man7/tuning.7 index 5e228dd907d..baf0bcc650f 100644 --- a/share/man/man7/tuning.7 +++ b/share/man/man7/tuning.7 @@ -778,4 +778,4 @@ in .Fx 4.3 , May 2001. The manual page was greatly modified by -.An Eitan Adler Aq eadler@FreeBSD.org +.An Eitan Adler Aq Mt eadler@FreeBSD.org . diff --git a/share/man/man8/hv_kvp_daemon.8 b/share/man/man8/hv_kvp_daemon.8 index a7171530c64..a095fe8f132 100644 --- a/share/man/man8/hv_kvp_daemon.8 +++ b/share/man/man8/hv_kvp_daemon.8 @@ -93,4 +93,4 @@ Microsoft Corporation, and Network Appliance Incorporated. support for .Nm was first added by -.An Microsoft BSD Integration Services Team Aq bsdic@microsoft.com . +.An Microsoft BSD Integration Services Team Aq Mt bsdic@microsoft.com . diff --git a/share/man/man8/nanobsd.8 b/share/man/man8/nanobsd.8 index 0309c4e424c..ef23aa81d9a 100644 --- a/share/man/man8/nanobsd.8 +++ b/share/man/man8/nanobsd.8 @@ -332,6 +332,6 @@ utility first appeared in .An -nosplit .Nm NanoBSD was developed by -.An Poul-Henning Kamp Aq phk@FreeBSD.org . +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . This manual page was written by -.An Daniel Gerzo Aq danger@FreeBSD.org . +.An Daniel Gerzo Aq Mt danger@FreeBSD.org . diff --git a/share/man/man8/picobsd.8 b/share/man/man8/picobsd.8 index e117fe447e8..4d4daa1020b 100644 --- a/share/man/man8/picobsd.8 +++ b/share/man/man8/picobsd.8 @@ -650,13 +650,13 @@ already exists on disk (e.g.\& as a result of a previous update). .Xr swapon 8 .Sh AUTHORS .An -nosplit -.An Andrzej Bialecki Aq abial@FreeBSD.org , +.An Andrzej Bialecki Aq Mt abial@FreeBSD.org , with subsequent work on the scripts by -.An Luigi Rizzo Aq luigi@iet.unipi.it +.An Luigi Rizzo Aq Mt luigi@iet.unipi.it and others. Man page and .Pa Makefiles created by -.An Greg Lehey Aq grog@lemis.com . +.An Greg Lehey Aq Mt grog@lemis.com . .Sh BUGS Documentation is still incomplete. diff --git a/share/man/man8/rescue.8 b/share/man/man8/rescue.8 index 29218874d67..299bdfcc6d5 100644 --- a/share/man/man8/rescue.8 +++ b/share/man/man8/rescue.8 @@ -145,13 +145,13 @@ utilities first appeared in The .Nm system was written by -.An Tim Kientzle Aq kientzle@FreeBSD.org , +.An Tim Kientzle Aq Mt kientzle@FreeBSD.org , based on ideas taken from .Nx . This manual page was written by -.An Simon L. Nielsen Aq simon@FreeBSD.org , +.An Simon L. Nielsen Aq Mt simon@FreeBSD.org , based on text by -.An Tim Kientzle Aq kientzle@FreeBSD.org . +.An Tim Kientzle Aq Mt kientzle@FreeBSD.org . .Sh BUGS Most of the .Nm diff --git a/share/man/man9/BUF_ISLOCKED.9 b/share/man/man9/BUF_ISLOCKED.9 index 597038881fc..2471db978d9 100644 --- a/share/man/man9/BUF_ISLOCKED.9 +++ b/share/man/man9/BUF_ISLOCKED.9 @@ -66,4 +66,4 @@ The lock is not held by anyone. .Xr lockmgr 9 .Sh AUTHORS This manual page was written by -.An Attilio Rao Aq attilio@FreeBSD.org . +.An Attilio Rao Aq Mt attilio@FreeBSD.org . diff --git a/share/man/man9/BUF_LOCK.9 b/share/man/man9/BUF_LOCK.9 index ca414ecdbaa..9676af83efa 100644 --- a/share/man/man9/BUF_LOCK.9 +++ b/share/man/man9/BUF_LOCK.9 @@ -72,4 +72,4 @@ information on non-zero return values. .Xr lockmgr 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/BUF_LOCKFREE.9 b/share/man/man9/BUF_LOCKFREE.9 index d356f0d8be4..1226ceadacd 100644 --- a/share/man/man9/BUF_LOCKFREE.9 +++ b/share/man/man9/BUF_LOCKFREE.9 @@ -60,4 +60,4 @@ The buffer whose lock is to be destroyed. .Xr lockdestroy 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/BUF_LOCKINIT.9 b/share/man/man9/BUF_LOCKINIT.9 index 286e7f8db2a..98d3b2aa114 100644 --- a/share/man/man9/BUF_LOCKINIT.9 +++ b/share/man/man9/BUF_LOCKINIT.9 @@ -59,4 +59,4 @@ The buffer whose lock it to be initialized. .Xr lockmgr 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/BUF_RECURSED.9 b/share/man/man9/BUF_RECURSED.9 index 2e369ea69e0..fccf83f40e9 100644 --- a/share/man/man9/BUF_RECURSED.9 +++ b/share/man/man9/BUF_RECURSED.9 @@ -62,4 +62,4 @@ for details. .Xr lockmgr 9 .Sh AUTHORS This manual page was written by -.An Attilio Rao Aq attilio@FreeBSD.org . +.An Attilio Rao Aq Mt attilio@FreeBSD.org . diff --git a/share/man/man9/BUF_TIMELOCK.9 b/share/man/man9/BUF_TIMELOCK.9 index 31ca2007c9d..151e7f5251b 100644 --- a/share/man/man9/BUF_TIMELOCK.9 +++ b/share/man/man9/BUF_TIMELOCK.9 @@ -80,4 +80,4 @@ for details on non-zero return values. .Xr lockmgr 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/BUF_UNLOCK.9 b/share/man/man9/BUF_UNLOCK.9 index 0b6b0b35080..e305a5d7f5c 100644 --- a/share/man/man9/BUF_UNLOCK.9 +++ b/share/man/man9/BUF_UNLOCK.9 @@ -61,4 +61,4 @@ The buffer must already be locked. .Xr lockmgr 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/BUS_CONFIG_INTR.9 b/share/man/man9/BUS_CONFIG_INTR.9 index a3b4c543c91..8a45b53e314 100644 --- a/share/man/man9/BUS_CONFIG_INTR.9 +++ b/share/man/man9/BUS_CONFIG_INTR.9 @@ -102,5 +102,4 @@ method first appeared in .\" .Sh AUTHORS This manual page was written by -.An Marcel Moolenaar -.Aq marcel@xcllnt.net . +.An Marcel Moolenaar Aq Mt marcel@xcllnt.net . diff --git a/share/man/man9/BUS_SETUP_INTR.9 b/share/man/man9/BUS_SETUP_INTR.9 index 8264a999a5f..eab62e39ecc 100644 --- a/share/man/man9/BUS_SETUP_INTR.9 +++ b/share/man/man9/BUS_SETUP_INTR.9 @@ -205,12 +205,10 @@ otherwise an appropriate error is returned. .Sh AUTHORS .An -nosplit This manual page was written by -.An Jeroen Ruigrok van der Werven -.Aq asmodai@FreeBSD.org +.An Jeroen Ruigrok van der Werven Aq Mt asmodai@FreeBSD.org based on the manual pages for .Fn BUS_CREATE_INTR and .Fn BUS_CONNECT_INTR written by -.An Doug Rabson -.Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/share/man/man9/CTASSERT.9 b/share/man/man9/CTASSERT.9 index 4885d4248b8..6211c2e5095 100644 --- a/share/man/man9/CTASSERT.9 +++ b/share/man/man9/CTASSERT.9 @@ -66,5 +66,4 @@ structure is 16 bytes. .Xr KASSERT 9 .Sh AUTHORS This manual page was written by -.An Hiten M. Pandya -.Aq hmp@FreeBSD.org . +.An Hiten M. Pandya Aq Mt hmp@FreeBSD.org . diff --git a/share/man/man9/DB_COMMAND.9 b/share/man/man9/DB_COMMAND.9 index 179f3f3181a..bf3faea6926 100644 --- a/share/man/man9/DB_COMMAND.9 +++ b/share/man/man9/DB_COMMAND.9 @@ -103,8 +103,8 @@ Calling my command with address 0x1000 db> .Ef .Ed -.Sh "SEE ALSO" +.Sh SEE ALSO .Xr ddb 4 -.Sh AUTHOR +.Sh AUTHORS This manual page was written by -.An Guillaume Ballet Aq gballet@gmail.com . +.An Guillaume Ballet Aq Mt gballet@gmail.com . diff --git a/share/man/man9/DECLARE_GEOM_CLASS.9 b/share/man/man9/DECLARE_GEOM_CLASS.9 index 01f074d86fc..a6dc969e098 100644 --- a/share/man/man9/DECLARE_GEOM_CLASS.9 +++ b/share/man/man9/DECLARE_GEOM_CLASS.9 @@ -176,4 +176,4 @@ DECLARE_GEOM_CLASS(example_class, g_example); .Sh AUTHORS .An -nosplit This manual page was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org . +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org . diff --git a/share/man/man9/DECLARE_MODULE.9 b/share/man/man9/DECLARE_MODULE.9 index d33c18ed608..b5c85772c29 100644 --- a/share/man/man9/DECLARE_MODULE.9 +++ b/share/man/man9/DECLARE_MODULE.9 @@ -107,6 +107,6 @@ enumeration .Sh AUTHORS .An -nosplit This manual page was written by -.An Alexander Langer Aq alex@FreeBSD.org , +.An Alexander Langer Aq Mt alex@FreeBSD.org , inspired by the KLD Facility Programming Tutorial by -.An Andrew Reiter Aq arr@watson.org . +.An Andrew Reiter Aq Mt arr@watson.org . diff --git a/share/man/man9/DEVICE_ATTACH.9 b/share/man/man9/DEVICE_ATTACH.9 index ccb9f27b693..12cce747a33 100644 --- a/share/man/man9/DEVICE_ATTACH.9 +++ b/share/man/man9/DEVICE_ATTACH.9 @@ -68,4 +68,4 @@ Zero is returned on success, otherwise an appropriate error is returned. .Xr DEVICE_SHUTDOWN 9 .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/share/man/man9/DEVICE_IDENTIFY.9 b/share/man/man9/DEVICE_IDENTIFY.9 index 4257407eac8..6f0011a1954 100644 --- a/share/man/man9/DEVICE_IDENTIFY.9 +++ b/share/man/man9/DEVICE_IDENTIFY.9 @@ -91,4 +91,4 @@ foo_identify(driver_t *driver, device_t parent) .Xr DEVICE_SHUTDOWN 9 .Sh AUTHORS This manual page was written by -.An Alexander Langer Aq alex@FreeBSD.org . +.An Alexander Langer Aq Mt alex@FreeBSD.org . diff --git a/share/man/man9/DEV_MODULE.9 b/share/man/man9/DEV_MODULE.9 index 28465b3f8da..e28b245ea63 100644 --- a/share/man/man9/DEV_MODULE.9 +++ b/share/man/man9/DEV_MODULE.9 @@ -102,4 +102,4 @@ DEV_MODULE(foo, foo_load, NULL); .Xr module 9 .Sh AUTHORS This manual page was written by -.An Alexander Langer Aq alex@FreeBSD.org . +.An Alexander Langer Aq Mt alex@FreeBSD.org . diff --git a/share/man/man9/DRIVER_MODULE.9 b/share/man/man9/DRIVER_MODULE.9 index 274fdcceed9..af03ef926ef 100644 --- a/share/man/man9/DRIVER_MODULE.9 +++ b/share/man/man9/DRIVER_MODULE.9 @@ -147,4 +147,4 @@ for a specific pass level. .Xr SYSINIT 9 .Sh AUTHORS This manual page was written by -.An Alexander Langer Aq alex@FreeBSD.org . +.An Alexander Langer Aq Mt alex@FreeBSD.org . diff --git a/share/man/man9/EVENTHANDLER.9 b/share/man/man9/EVENTHANDLER.9 index fc22d5e0a6a..711c6efaa44 100644 --- a/share/man/man9/EVENTHANDLER.9 +++ b/share/man/man9/EVENTHANDLER.9 @@ -334,4 +334,4 @@ facility first appeared in .Fx 4.0 . .Sh AUTHORS This manual page was written by -.An Joseph Koshy Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/share/man/man9/KASSERT.9 b/share/man/man9/KASSERT.9 index 62c97c44bd5..0c6898a7799 100644 --- a/share/man/man9/KASSERT.9 +++ b/share/man/man9/KASSERT.9 @@ -83,5 +83,4 @@ vput(vp) .Xr panic 9 .Sh AUTHORS This manual page was written by -.An Jonathan M. Bresler -.Aq jmb@FreeBSD.org . +.An Jonathan M. Bresler Aq Mt jmb@FreeBSD.org . diff --git a/share/man/man9/LOCK_PROFILING.9 b/share/man/man9/LOCK_PROFILING.9 index d64b3286e7a..2b7777882cc 100644 --- a/share/man/man9/LOCK_PROFILING.9 +++ b/share/man/man9/LOCK_PROFILING.9 @@ -134,16 +134,16 @@ Generalized lock profiling support appeared in The .Nm MUTEX_PROFILING code was written by -.An Eivind Eklund Aq eivind@FreeBSD.org , -.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org +.An Eivind Eklund Aq Mt eivind@FreeBSD.org , +.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org and -.An Robert Watson Aq rwatson@FreeBSD.org . +.An Robert Watson Aq Mt rwatson@FreeBSD.org . The .Nm code was written by -.An Kip Macy Aq kmacy@FreeBSD.org . +.An Kip Macy Aq Mt kmacy@FreeBSD.org . This manual page was written by -.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . +.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org . .Sh NOTES The .Dv LOCK_PROFILING diff --git a/share/man/man9/MODULE_DEPEND.9 b/share/man/man9/MODULE_DEPEND.9 index c0a8fdd44c9..b8e3104e3be 100644 --- a/share/man/man9/MODULE_DEPEND.9 +++ b/share/man/man9/MODULE_DEPEND.9 @@ -77,4 +77,4 @@ MODULE_DEPEND(foo, bar, 1, 3, 4); .Sh AUTHORS .An -nosplit This manual page was written by -.An Alexander Langer Aq alex@FreeBSD.org . +.An Alexander Langer Aq Mt alex@FreeBSD.org . diff --git a/share/man/man9/MODULE_VERSION.9 b/share/man/man9/MODULE_VERSION.9 index 2f284b874b9..e791ded652d 100644 --- a/share/man/man9/MODULE_VERSION.9 +++ b/share/man/man9/MODULE_VERSION.9 @@ -56,4 +56,4 @@ MODULE_VERSION(foo, 1); .Sh AUTHORS .An -nosplit This manual page was written by -.An Alexander Langer Aq alex@FreeBSD.org . +.An Alexander Langer Aq Mt alex@FreeBSD.org . diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 453f3c0850d..bfdcc0c6032 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -112,6 +112,7 @@ MAN= accept_filter.9 \ fail.9 \ fetch.9 \ firmware.9 \ + fpu_kern.9 \ g_access.9 \ g_attach.9 \ g_bio.9 \ @@ -187,6 +188,7 @@ MAN= accept_filter.9 \ osd.9 \ panic.9 \ pbuf.9 \ + PCBGROUP.9 \ p_candebug.9 \ p_cansee.9 \ pci.9 \ @@ -211,12 +213,13 @@ MAN= accept_filter.9 \ pmap_object_init_pt.9 \ pmap_page_exists_quick.9 \ pmap_page_init.9 \ - pmap_page_protect.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 \ @@ -355,7 +358,6 @@ MAN= accept_filter.9 \ VOP_GETACL.9 \ VOP_GETEXTATTR.9 \ VOP_GETPAGES.9 \ - VOP_GETVOBJECT.9 \ VOP_INACTIVE.9 \ VOP_IOCTL.9 \ VOP_LINK.9 \ @@ -382,7 +384,6 @@ MAN= accept_filter.9 \ vrele.9 \ vslock.9 \ watchdog.9 \ - zero_copy.9 \ zone.9 MLINKS= unr.9 alloc_unr.9 \ @@ -670,6 +671,12 @@ MLINKS+=fetch.9 fubyte.9 \ fetch.9 fuword16.9 \ fetch.9 fuword32.9 \ fetch.9 fuword64.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_clone_bio.9 \ g_bio.9 g_destroy_bio.9 \ @@ -918,10 +925,12 @@ MLINKS+=\ 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 \ @@ -1035,12 +1044,10 @@ MLINKS+=pfil.9 pfil_add_hook.9 \ pfil.9 pfil_hook_get.9 \ pfil.9 pfil_remove_hook.9 MLINKS+=pfind.9 zpfind.9 -MLINKS+=pmap_clear_modify.9 pmap_clear_reference.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_modified.9 -MLINKS+=pmap_page_protect.9 pmap_protect.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 @@ -1260,15 +1267,41 @@ MLINKS+=sleepqueue.9 init_sleepqueues.9 \ sleepqueue.9 sleepq_timedwait_sig.9 \ sleepqueue.9 sleepq_wait.9 \ sleepqueue.9 sleepq_wait_sig.9 -MLINKS+=socket.9 sobind.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 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 \ @@ -1525,8 +1558,6 @@ 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_GETVOBJECT.9 VOP_CREATEVOBJECT.9 \ - VOP_GETVOBJECT.9 VOP_DESTROYVOBJECT.9 MLINKS+=VOP_INACTIVE.9 VOP_RECLAIM.9 MLINKS+=VOP_LOCK.9 vn_lock.9 \ VOP_LOCK.9 VOP_ISLOCKED.9 \ @@ -1540,7 +1571,6 @@ MLINKS+=vref.9 VREF.9 MLINKS+=vrele.9 vput.9 \ vrele.9 vunref.9 MLINKS+=vslock.9 vsunlock.9 -MLINKS+=zero_copy.9 zero_copy_sockets.9 MLINKS+=zone.9 uma.9 \ zone.9 uma_zalloc.9 \ zone.9 uma_zalloc_arg.9 \ diff --git a/share/man/man9/PCBGROUP.9 b/share/man/man9/PCBGROUP.9 new file mode 100644 index 00000000000..85d1bc011f3 --- /dev/null +++ b/share/man/man9/PCBGROUP.9 @@ -0,0 +1,221 @@ +.\" Copyright (c) 2014 Adrian Chadd +.\" 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. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" 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 July 23, 2014 +.Dt PCBGROUP 9 +.Os +.Sh NAME +.Nm PCBGROUP +.Nd Distributed Protocol Control Block Groups +.Sh SYNOPSIS +.Cd "options PCBGROUP" +.Pp +.In sys/param.h +.In netinet/in.h +.In netinet/in_pcb.h +.Ft void +.Fo in_pcbgroup_init +.Fa "struct inpcbinfo *pcbinfo" "u_int hashfields" "int hash_nelements" +.Fc +.Ft void +.Fn in_pcbgroup_destroy "struct inpcbinfo *pcbinfo" +.Ft struct inpcbgroup * +.Fo in_pcbgroup_byhash +.Fa "struct inpcbinfo *pcbinfo" "u_int hashtype" "uint32_t hash" +.Fc +.Ft struct inpcbgroup * +.Fn in_pcbgroup_byinpcb "struct inpcb *inp" +.Ft void +.Fn in_pcbgroup_update "struct inpcb *inp" +.Ft void +.Fn in_pcbgroup_update_mbuf "struct inpcb *inp" "struct mbuf *m" +.Ft void +.Fn in_pcbgroup_remove "struct inpcb *inp" +.Ft int +.Fn in_pcbgroup_enabled "struct inpcbinfo *pcbinfo" +.In netinet6/in6_pcb.h +.Ft struct inpcbgroup * +.Fo in6_pcbgroup_byhash +.Fa "struct inpcbinfo *pcbinfo" "u_int hashtype" "uint32_t hash" +.Fc +.Sh DESCRIPTION +This implementation introduces notions of affinity +for connections and distribute work so as to reduce lock contention, +with hardware work distribution strategies +such as RSS. +In this construction, connection groups supplement, rather than replace, +existing reservation tables for protocol 4-tuples, offering CPU-affine +lookup tables with minimal cache line migration and lock contention +during steady state operation. +.Pp +Internet protocols like UDP and TCP register to use connection groups +by providing an ipi_hashfields value other than IPI_HASHFIELDS_NONE. +This indicates to the connection group code whether a 2-tuple or +4-tuple is used as an argument to hashes that assign a connection to +a particular group. +This must be aligned with any hardware-offloaded distribution model, +such as RSS or similar approaches taken in embedded network boards. +Wildcard sockets require special handling, as in Willmann 2006, and +are shared between connection groups while being protected by +group-local locks. +Connection establishment and teardown can be signficantly more +expensive than without connection groups, but that steady-state +processing can be significantly faster. +.Pp +Enabling PCBGROUP in the kernel only provides the infrastructure +required to create and manage multiple PCB groups. +An implementation needs to fill in a few functions to provide PCB +group hash information in order for PCBs to be placed in a PCB group. +.Ss Operation +By default, each PCB info block (struct pcbinfo) has a single hash for +all PCB entries for the given protocol with a single lock protecting it. +This can be a significant source of lock contention on SMP hardware. +When a PCBGROUP is created, an array of separate hash tables are +created, each with its own lock. +A separate table for wildcard PCBs is provided. +By default, a PCBGROUP table is created for each available CPU. +The PCBGROUP code attempts to calculate a hash value from the given +PCB or mbuf when looking up a PCBGROUP. +While processing a received frame, +.Fn in_pcbgroup_byhash +can be used in conjunction with either a hardware-provided hash +value +.Po +eg the +.Xr RSS 9 +calculated hash value provided by some NICs +.Pc +or a software-provided hash value in order to choose a PCBGROUP +table to query. +A single table lock is held while performing a wildcard match. +However, all of the table locks are acquired before modifying the +wildcard table. +The PCBGROUP tables operate in conjunction with the normal single PCB list +in a PCB info block. +Thus, inserting and removing a PCB will still incur the same costs +as without PCBGROUP. +A protocol which uses PCBGROUP should fall back to the normal PCB list +lookup if a call to the PCBGROUP layer does not yield a lookup hit. +.Ss Usage +Initialize a PCBGROUP in a PCB info block +.Pq Vt "struct pcbinfo" +by calling +.Fn in_pcbgroup_init . +.Pp +Add a connection to a PCBGROUP with +.Fn in_pcbgroup_update . +Connections are removed by with +.Fn in_pcbgroup_remove . +These in turn will determine which PCBGROUP bucket the given PCB +is placed into and calculate the hash value appropriately. +.Pp +Wildcard PCBs are hashed differently and placed in a single wildcard +PCB list. +If +.Xr RSS 9 +is enabled and in use, RSS-aware wildcard PCBs are placed in a single +PCBGROUP based on RSS information. +Protocols may look up the PCB entry in a PCBGROUP by using the lookup +functions +.Fn in_pcbgroup_byhash +and +.Fn in_pcbgroup_byinpcb . +.Sh IMPLEMENTATION NOTES +The PCB code in +.Pa sys/netinet +and +.Pa sys/netinet6 +is aware of PCBGROUP and will call into the PCBGROUP code to do +PCBGROUP assignment and lookup, preferring a PCBGROUP lookup to the +default global PCB info table. +.Pp +An implementor wishing to experiment or modify the PCBGROUP assignment +should modify this set of functions: +.Bl -tag -width "12345678" -offset indent +.It Fn in_pcbgroup_getbucket No and Fn in6_pcbgroup_getbucket +Map a given 32 bit hash value to a PCBGROUP. +By default this is hash % number_of_pcbgroups. +However, this distribution may not align with NIC receive queues or +the +.Xr netisr 9 +configuration. +.It Fn in_pcbgroup_byhash No and Fn in6_pcbgroup_byhash +Map a 32 bit hash value and a hash type identifier to a PCBGROUP. +By default, this simply returns NULL. +This function is used by the +.Xr mbuf 9 +receive path in +.Pa sys/netinet/in_pcb.c +to map an mbuf to a PCBGROUP. +.It Fn in_pcbgroup_bytuple No and Fn in6_pcbgroup_bytuple +Map the source and destination address and port details to a PCBGROUP. +By default, this does a very simple XOR hash. +This function is used by both the PCB lookup code and as a fallback in +the +.Xr mbuf 9 +receive path in +.Pa sys/netinet/in_pcb.c . +.El +.Sh SEE ALSO +.Xr mbuf 9 , +.Xr netisr 9 , +.Xr RSS 9 +.Rs +.%A Paul Willmann +.%A Scott Rixner +.%A Alan L. Cox +.%T "An Evaluation of Network Stack Parallelization Strategies in Modern Operating Systems" +.%J "2006 USENIX Annual Technical Conference" +.%D 2006 +.%U http://www.ece.rice.edu/~willmann/pubs/paranet_usenix.pdf +.Re +.Sh HISTORY +PCBGROUP first appeared in +.Fx 9.0 . +.Sh AUTHORS +.An -nosplit +The PCBGROUP implementation was written by +.An Robert N. M. Watson Aq Mt rwatson@FreeBSD.org +under contract to Juniper Networks, Inc. +.Pp +This manual page written by +.An Adrian Chadd Aq Mt adrian@FreeBSD.org . +.Sh NOTES +The +.Xr RSS 9 +implementation currently uses +.Ic #ifdef +blocks to tie into PCBGROUP. +This is a sign that a more abstract programming API is needed. +.Pp +There is currently no support for re-balancing the PCBGROUP assignment, +nor is there any support for overriding which PCBGROUP a socket/PCB +should be in. +.Pp +No statistics are kept to indicate how often PCBGROUP lookups +succeed or fail. diff --git a/share/man/man9/SDT.9 b/share/man/man9/SDT.9 index 1f821cf8d90..91bf4b1caf7 100644 --- a/share/man/man9/SDT.9 +++ b/share/man/man9/SDT.9 @@ -278,9 +278,9 @@ SDT_PROBE_DEFINE1_XLATE(ip, , , receive, "struct icmp *", DTrace and the .Nm framework were originally ported to FreeBSD from Solaris by -.An John Birrell Aq jb@FreeBSD.org . +.An John Birrell Aq Mt jb@FreeBSD.org . This manual page was written by -.An Mark Johnston Aq markj@FreeBSD.org . +.An Mark Johnston Aq Mt markj@FreeBSD.org . .Sh BUGS The .Nm diff --git a/share/man/man9/SYSCALL_MODULE.9 b/share/man/man9/SYSCALL_MODULE.9 index 973adebf2cf..b803bcec11e 100644 --- a/share/man/man9/SYSCALL_MODULE.9 +++ b/share/man/man9/SYSCALL_MODULE.9 @@ -81,4 +81,4 @@ A minimal example for a syscall module can be found in .Pa /usr/share/examples/kld/syscall/module/syscall.c .Sh AUTHORS This manual page was written by -.An Alexander Langer Aq alex@FreeBSD.org . +.An Alexander Langer Aq Mt alex@FreeBSD.org . diff --git a/share/man/man9/SYSINIT.9 b/share/man/man9/SYSINIT.9 index 1837d25d484..28701f25f03 100644 --- a/share/man/man9/SYSINIT.9 +++ b/share/man/man9/SYSINIT.9 @@ -157,7 +157,7 @@ framework first appeared in The .Nm framework was written by -.An Terrence Lambert Aq terry@FreeBSD.org . +.An Terrence Lambert Aq Mt terry@FreeBSD.org . .Pp This manual page was written by -.An Hiten Pandya Aq hmp@FreeBSD.org . +.An Hiten Pandya Aq Mt hmp@FreeBSD.org . diff --git a/share/man/man9/VFS_SET.9 b/share/man/man9/VFS_SET.9 index 25acc86bd6c..c35935e6c47 100644 --- a/share/man/man9/VFS_SET.9 +++ b/share/man/man9/VFS_SET.9 @@ -108,4 +108,4 @@ VFS_SET(myfs_vfsops, myfs, 0); .Xr vfs_modevent 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/VOP_GETVOBJECT.9 b/share/man/man9/VOP_GETVOBJECT.9 deleted file mode 100644 index 47741d1225b..00000000000 --- a/share/man/man9/VOP_GETVOBJECT.9 +++ /dev/null @@ -1,113 +0,0 @@ -.\" -*- nroff -*- -.\" -.\" Copyright (c) 2000 Boris Popov -.\" -.\" 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 DEVELOPERS ``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 DEVELOPERS 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 10, 2000 -.Dt VOP_CREATEVOBJECT 9 -.Os -.Sh NAME -.Nm VOP_CREATEVOBJECT , -.Nm VOP_DESTROYVOBJECT , -.Nm VOP_GETVOBJECT -.Nd VM object interaction -.Sh SYNOPSIS -.In sys/param.h -.In sys/vnode.h -.Ft int -.Fn VOP_CREATEVOBJECT "struct vnode *vp" "struct ucred *cred" "struct thread *td" -.Ft int -.Fn VOP_DESTROYVOBJECT "struct vnode *vp" -.Ft int -.Fn VOP_GETVOBJECT "struct vnode *vp" "struct vm_object **objpp" -.Sh DESCRIPTION -These calls are used to control the association of a VM object -with a particular vnode. -.Pp -The arguments specific to these functions are: -.Bl -tag -width objpp -.It Fa vp -The vnode of the file. -.It Fa objpp -The VM object being returned, or -.Dv NULL -if the caller wants to test for the existence -of the VM object. -.El -.Pp -.Xr VFS 9 -invokes -.Fn VOP_CREATEVOBJECT -when it needs to create a VM object for the given -.Xr vnode 9 . -File system code may pass this call down to the underlying file system. -This VOP can be called multiple times, -and file system code should ignore any additional calls, -exiting with a zero return code. -.Pp -.Fn VOP_DESTROYVOBJECT -is called when a -.Xr vnode 9 -is recycled. -.Pp -.Fn VOP_GETVOBJECT -should be used by all kernel code to get a VM object. -.\" XXX What is the next sentence trying to tell people? -The returned VM object may belong to a different file system in the case -of stacked mounts. -.Pp -.Xr VFS 9 -has three functions which perform standard operations by creating -and destroying VM objects. -These functions are: -.Fn vop_stdcreatevobject , -.Fn vop_stddestroyvobject -and -.Fn vop_stdgetvobject . -.Pp -.Em Note : -a -.Xr vnode 9 -should be locked on entry and must be left locked on exit. -.Sh RETURN VALUES -The -.Fn VOP_CREATEVOBJECT , -.Fn VOP_DESTROYVOBJECT -and -.Fn VOP_GETVOBJECT -functions return zero on success, or a non-zero value on failure. -Zero is returned on success, otherwise an error is returned. -.Sh EXAMPLES -.\" XXX Why is this code here when it does not use the functions -.\" described in this manual page? -By default, file systems leave VM object handling to the -.Fn vop_std* -functions. -.Sh SEE ALSO -.Xr vnode 9 , -.Xr VOP_GETPAGES 9 , -.Xr VOP_PUTPAGES 9 -.Sh AUTHORS -This manual page was written by -.An Boris Popov . diff --git a/share/man/man9/VOP_INACTIVE.9 b/share/man/man9/VOP_INACTIVE.9 index 2f1e4ed60bd..6c71d03659c 100644 --- a/share/man/man9/VOP_INACTIVE.9 +++ b/share/man/man9/VOP_INACTIVE.9 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 24, 1996 +.Dd July 27, 2014 .Dt VOP_INACTIVE 9 .Os .Sh NAME @@ -63,17 +63,14 @@ is called when a vnode is being reused for a different file system. Any file system specific resources associated with the vnode should be freed. .Sh LOCKS -For VOP_INACTIVE, the +For both +.Fn VOP_INACTIVE +and +.Fn VOP_RECLAIM , +the .Fa vp -will be locked on entry. -Your VOP_INACTIVE code -must unlock the -.Fa vp -prior to returning. -.Pp -For VOP_RECLAIM, the -.Fa vp -will not be locked on entry and should be left unlocked on return. +will be exclusively locked on entry, and must be left exclusively +locked on return. .Sh SEE ALSO .Xr vnode 9 .Sh AUTHORS diff --git a/share/man/man9/alq.9 b/share/man/man9/alq.9 index 65c2d07d93e..b8b0c237b06 100644 --- a/share/man/man9/alq.9 +++ b/share/man/man9/alq.9 @@ -431,11 +431,11 @@ Asynchronous Logging Queues (ALQ) facility first appeared in The .Nm facility was written by -.An Jeffrey Roberson Aq jeff@FreeBSD.org +.An Jeffrey Roberson Aq Mt jeff@FreeBSD.org and extended by -.An Lawrence Stewart Aq lstewart@freebsd.org . +.An Lawrence Stewart Aq Mt lstewart@freebsd.org . .Pp This manual page was written by -.An Hiten Pandya Aq hmp@FreeBSD.org +.An Hiten Pandya Aq Mt hmp@FreeBSD.org and revised by -.An Lawrence Stewart Aq lstewart@freebsd.org . +.An Lawrence Stewart Aq Mt lstewart@freebsd.org . diff --git a/share/man/man9/atomic.9 b/share/man/man9/atomic.9 index 44d800e8bec..a9ce842b183 100644 --- a/share/man/man9/atomic.9 +++ b/share/man/man9/atomic.9 @@ -169,10 +169,6 @@ On the .Tn i386 architecture, the cache coherency model requires that the hardware perform this task, thus the atomic operations are atomic across multiple processors. -On the -.Tn ia64 -architecture, coherency is only guaranteed for pages that are configured to -using a caching policy of either uncached or write back. .Ss Semantics This section describes the semantics of each operation using a C like notation. .Bl -hang diff --git a/share/man/man9/bus_activate_resource.9 b/share/man/man9/bus_activate_resource.9 index eb5b3e824e7..12d202c8d74 100644 --- a/share/man/man9/bus_activate_resource.9 +++ b/share/man/man9/bus_activate_resource.9 @@ -90,4 +90,4 @@ Zero is returned on success, otherwise an error is returned. .Xr driver 9 .Sh AUTHORS This manual page was written by -.An Warner Losh Aq imp@FreeBSD.org . +.An Warner Losh Aq Mt imp@FreeBSD.org . diff --git a/share/man/man9/bus_alloc_resource.9 b/share/man/man9/bus_alloc_resource.9 index 388a7f3123a..78959a02a1c 100644 --- a/share/man/man9/bus_alloc_resource.9 +++ b/share/man/man9/bus_alloc_resource.9 @@ -178,6 +178,6 @@ should be saved in the softc of the device after these calls. .Sh AUTHORS .An -nosplit This manual page was written by -.An Alexander Langer Aq alex@big.endian.de +.An Alexander Langer Aq Mt alex@big.endian.de with parts by -.An Warner Losh Aq imp@FreeBSD.org . +.An Warner Losh Aq Mt imp@FreeBSD.org . diff --git a/share/man/man9/bus_child_present.9 b/share/man/man9/bus_child_present.9 index 12577ad3d54..4ba967ad6e0 100644 --- a/share/man/man9/bus_child_present.9 +++ b/share/man/man9/bus_child_present.9 @@ -84,4 +84,4 @@ if (bus_child_present(dev)) .Xr driver 9 .Sh AUTHORS This manual page was written by -.An Warner Losh Aq imp@FreeBSD.org . +.An Warner Losh Aq Mt imp@FreeBSD.org . diff --git a/share/man/man9/bus_release_resource.9 b/share/man/man9/bus_release_resource.9 index 35e70d994a1..731eda3b975 100644 --- a/share/man/man9/bus_release_resource.9 +++ b/share/man/man9/bus_release_resource.9 @@ -103,4 +103,4 @@ The kernel will panic, if it cannot release the resource. .Xr driver 9 .Sh AUTHORS This manual page was written by -.An Alexander Langer Aq alex@big.endian.de . +.An Alexander Langer Aq Mt alex@big.endian.de . diff --git a/share/man/man9/bus_set_resource.9 b/share/man/man9/bus_set_resource.9 index cda47b62b68..2eb24bf5db1 100644 --- a/share/man/man9/bus_set_resource.9 +++ b/share/man/man9/bus_set_resource.9 @@ -93,4 +93,4 @@ Zero is returned on success, otherwise an error is returned. .Xr driver 9 .Sh AUTHORS This manual page was written by -.An Warner Losh Aq imp@FreeBSD.org . +.An Warner Losh Aq Mt imp@FreeBSD.org . diff --git a/share/man/man9/cd.9 b/share/man/man9/cd.9 index 4ed2d52a531..364a605ed8d 100644 --- a/share/man/man9/cd.9 +++ b/share/man/man9/cd.9 @@ -116,8 +116,8 @@ manual page first appeared in .An -nosplit This manual page was written by -.An John-Mark Gurney Aq jmg@FreeBSD.org . +.An John-Mark Gurney Aq Mt jmg@FreeBSD.org . It was updated for CAM and .Fx 3.0 by -.An Kenneth Merry Aq ken@FreeBSD.org . +.An Kenneth Merry Aq Mt ken@FreeBSD.org . diff --git a/share/man/man9/config_intrhook.9 b/share/man/man9/config_intrhook.9 index 083a2a2a375..60bf9d84858 100644 --- a/share/man/man9/config_intrhook.9 +++ b/share/man/man9/config_intrhook.9 @@ -100,6 +100,6 @@ with the CAM subsystem, but are available for any driver to use. .Sh AUTHORS .An -nosplit The functions were written by -.An Justin Gibbs Aq gibbs@FreeBSD.org . +.An Justin Gibbs Aq Mt gibbs@FreeBSD.org . This manual page was written by -.An M. Warner Losh Aq imp@FreeBSD.org . +.An M. Warner Losh Aq Mt imp@FreeBSD.org . diff --git a/share/man/man9/crypto.9 b/share/man/man9/crypto.9 index c9a999691cf..8ed30d9cdd4 100644 --- a/share/man/man9/crypto.9 +++ b/share/man/man9/crypto.9 @@ -648,7 +648,7 @@ most of the framework code The cryptographic framework first appeared in .Ox 2.7 and was written by -.An "Angelos D. Keromytis" Aq angelos@openbsd.org . +.An Angelos D. Keromytis Aq Mt angelos@openbsd.org . .Sh BUGS The framework currently assumes that all the algorithms in a .Fn crypto_newsession diff --git a/share/man/man9/devstat.9 b/share/man/man9/devstat.9 index 7ed7ec13975..ad1393415a5 100644 --- a/share/man/man9/devstat.9 +++ b/share/man/man9/devstat.9 @@ -431,7 +431,7 @@ The statistics system appeared in .Fx 3.0 . .Sh AUTHORS -.An Kenneth Merry Aq ken@FreeBSD.org +.An Kenneth Merry Aq Mt ken@FreeBSD.org .Sh BUGS There may be a need for .Fn spl diff --git a/share/man/man9/domain.9 b/share/man/man9/domain.9 index e07bdedff60..14ae52b04bb 100644 --- a/share/man/man9/domain.9 +++ b/share/man/man9/domain.9 @@ -111,7 +111,7 @@ struct protosw { pr_slowtimo_t *pr_slowtimo; /* slow timeout (500ms) */ pr_drain_t *pr_drain; /* flush any excess space possible */ - struct pr_usrreqs *pr_usrreqs; /* supersedes pr_usrreq() */ + struct pr_usrreqs *pr_usrreqs; /* user-protocol hook */ }; .Ed .Pp @@ -240,4 +240,4 @@ types if the domain has a default raw protocol. .Xr socket 2 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/eventtimers.9 b/share/man/man9/eventtimers.9 index 0c28d76b01c..09cd8b3e661 100644 --- a/share/man/man9/eventtimers.9 +++ b/share/man/man9/eventtimers.9 @@ -250,4 +250,4 @@ timer hardware access. .Sh SEE ALSO .Xr eventtimers 4 .Sh AUTHORS -.An Alexander Motin Aq mav@FreeBSD.org +.An Alexander Motin Aq Mt mav@FreeBSD.org diff --git a/share/man/man9/fail.9 b/share/man/man9/fail.9 index 6a3d815d6c7..8dbba1b568c 100644 --- a/share/man/man9/fail.9 +++ b/share/man/man9/fail.9 @@ -191,7 +191,7 @@ Return 5 once, when pid 1234 executes the fail point. .Sh AUTHORS .An -nosplit This manual page was written by -.An Zach Loafman Aq zml@FreeBSD.org . +.An Zach Loafman Aq Mt zml@FreeBSD.org . .Sh CAVEATS It is easy to shoot yourself in the foot by setting fail points too aggressively or setting too many in combination. diff --git a/share/man/man9/firmware.9 b/share/man/man9/firmware.9 index 48119213e23..f8c8b322d90 100644 --- a/share/man/man9/firmware.9 +++ b/share/man/man9/firmware.9 @@ -269,4 +269,4 @@ system was introduced in .Fx 6.1 . .Sh AUTHORS This manual page was written by -.An Max Laier Aq mlaier@FreeBSD.org . +.An Max Laier Aq Mt mlaier@FreeBSD.org . diff --git a/share/man/man9/fpu_kern.9 b/share/man/man9/fpu_kern.9 new file mode 100644 index 00000000000..207e5e80542 --- /dev/null +++ b/share/man/man9/fpu_kern.9 @@ -0,0 +1,195 @@ +.\" Copyright (c) 2014 +.\" Konstantin Belousov . 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. +.\" +.\" $FreeBSD$ +.\" +.Dd June 23, 2014 +.Dt FPU_KERN 9 +.Os +.Sh NAME +.Nm fpu_kern +.Nd "facility to use the FPU in the kernel" +.Sh SYNOPSIS +.Ft struct fpu_kern_ctx * +.Fn fpu_kern_alloc_ctx "u_int flags" +.Ft void +.Fn fpu_kern_free_ctx "struct fpu_kern_ctx *ctx" +.Ft int +.Fn fpu_kern_enter "struct thread *td" "struct fpu_kern_ctx *ctx" "u_int flags" +.Ft int +.Fn fpu_kern_leave "struct thread *td" "struct fpu_kern_ctx *ctx" +.Ft int +.Fn fpu_kern_thread "u_int flags" +.Ft int +.Fn is_fpu_kern_thread "u_int flags" +.Sh DESCRIPTION +The +.Nm +family of functions allows the use of FPU hardware in kernel code. +Modern FPUs are not limited to providing hardware implementation for +floating point arithmetic; they offer advanced accelerators for cryptography +and other computational-intensive algorithms. +These facilities share registers with the FPU hardware. +.Pp +Typical kernel code does not need access to the FPU. +Saving a large register file on each entry to the kernel would waste +time. +When kernel code uses the FPU, the current FPU state must be saved to +avoid corrupting the user-mode state, and vice versa. +.Pp +The management of the save and restore is automatic. +The processor catches accesses to the FPU registers +when the non-current context tries to access them. +Explicit calls are required for the allocation of the save area and +the notification of the start and end of the code using the FPU. +.Pp +The +.Fn fpu_kern_alloc_ctx +function allocates the memory used by +.Nm +to track the use of the FPU hardware state and the related software state. +The +.Fn fpu_kern_alloc_ctx +function requires the +.Fa flags +argument, which currently accepts the following flags: +.Bl -tag -width ".Dv FPU_KERN_NOWAIT" -offset indent +.It Dv FPU_KERN_NOWAIT +Do not wait for the available memory if the request could not be satisfied +without sleep. +.It 0 +No special handling is required. +.El +.Pp +The function returns the allocated context area, or +.Va NULL +if the allocation failed. +.Pp +The +.Fn fpu_kern_free_ctx +function frees the context previously allocated by +.Fn fpu_kern_alloc_ctx . +.Pp +The +.Fn fpu_kern_enter +function designates the start of the region of kernel code where the +use of the FPU is allowed. +Its arguments are: +.Bl -tag -width ".Fa ctx" -offset indent +.It Fa td +Currently must be +.Va curthread . +.It Fa ctx +The context save area previously allocated by +.Fn fpu_kern_alloc_ctx +and not currently in use by another call to +.Fn fpu_kern_enter . +.It Fa flags +This argument currently accepts the following flags: +.Bl -tag -width ".Dv FPU_KERN_NORMAL" -offset indent +.It Dv FPU_KERN_NORMAL +Indicates that the caller intends to access the full FPU state. +Must be specified currently. +.It Dv FPU_KERN_KTHR +Indicates that no saving of the current FPU state should be performed, +if the thread called +.Xr fpu_kern_thread 9 +function. +This is intended to minimize code duplication in callers which +could be used from both kernel thread and syscall contexts. +The +.Fn fpu_kern_leave +function correctly handles such contexts. +.El +.El +.Pp +The function does not sleep or block. +It could cause the +.Nm Device Not Available +exception during execution, and on the first FPU access after the +function returns, as well as after each context switch +(see Intel Software Developer Manual for the reference). +Currently, no errors are defined which can be returned by +.Fn fpu_kern_enter +to the caller. +.Pp +The +.Fn fpu_kern_leave +function ends the region started by +.Fn fpu_kern_enter . +The uses of FPU in the kernel after the call to +.Fn fpu_kern_leave +are erronous until the next call to +.Fn fpu_kern_enter +is performed. +The function takes the +.Fa td +thread argument, which currently must be +.Va curthread , +and the +.Fa ctx +context pointer, previously passed to +.Fn fpu_kern_enter . +After the function returns, the context may be freed or reused +by other invocation of +.Fn fpu_kern_enter . +There are no errors defined for the function, it always returns 0. +.Pp +The +.Fn fpu_kern_thread +function provides an optimization for threads which never leave to +the usermode. +Such thread can reuse the usermode save area for the FPU state, +which is allowed by the function call. +There is no flags defined for the function, and no error states +that the function returns. +.Pp +The +.Fn is_fpu_kern_thread +function returns the boolean indicating whether the current thread +entered the mode enabled by +.Fn fpu_kern_thread . +There is currently no flags defined for the function, the return +value is true if the current thread have the permanent FPU save area, +and false otherwise. +.Sh NOTES +The +.Nm +is currently implemented only for the i386 and amd64 architectures. +.Pp +There is no way to handle floating point exceptions raised from +kernel mode. +.Pp +The unused +.Fa flags +arguments +to the +.Nm +functions are to be extended to allow specification of the +set of the FPU hardware state used by the code region. +This would allow optimizations of saving and restoring the state. +.Sh AUTHORS +The +.Nm +facitily and this manual page were written by +.An Konstantin Belousov Aq Mt kib@FreeBSD.org . diff --git a/share/man/man9/g_access.9 b/share/man/man9/g_access.9 index 95ad1da91a3..fcfc8695858 100644 --- a/share/man/man9/g_access.9 +++ b/share/man/man9/g_access.9 @@ -162,4 +162,4 @@ Any other error that can be returned by the provider's access method. .Sh AUTHORS .An -nosplit This manual page was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org . +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org . diff --git a/share/man/man9/g_attach.9 b/share/man/man9/g_attach.9 index 4bf7d9c5149..c5cdf5a8e95 100644 --- a/share/man/man9/g_attach.9 +++ b/share/man/man9/g_attach.9 @@ -138,4 +138,4 @@ The operation creates a topology loop. .Sh AUTHORS .An -nosplit This manual page was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org . +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org . diff --git a/share/man/man9/g_bio.9 b/share/man/man9/g_bio.9 index e7351b8054e..e3ac64e94e8 100644 --- a/share/man/man9/g_bio.9 +++ b/share/man/man9/g_bio.9 @@ -274,4 +274,4 @@ example_start(struct bio *bp) .Sh AUTHORS .An -nosplit This manual page was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org . +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org . diff --git a/share/man/man9/g_consumer.9 b/share/man/man9/g_consumer.9 index e30fb80280b..1cdcacd8d97 100644 --- a/share/man/man9/g_consumer.9 +++ b/share/man/man9/g_consumer.9 @@ -134,4 +134,4 @@ some_function(struct g_geom *mygeom, struct g_provider *pp) .Sh AUTHORS .An -nosplit This manual page was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org . +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org . diff --git a/share/man/man9/g_data.9 b/share/man/man9/g_data.9 index f5cd6961a04..724854e23dc 100644 --- a/share/man/man9/g_data.9 +++ b/share/man/man9/g_data.9 @@ -119,4 +119,4 @@ An I/O error occurred while reading from or writing to the consumer. .Sh AUTHORS .An -nosplit This manual page was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org . +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org . diff --git a/share/man/man9/g_event.9 b/share/man/man9/g_event.9 index 380caa82a0b..0bdd0ab6688 100644 --- a/share/man/man9/g_event.9 +++ b/share/man/man9/g_event.9 @@ -186,4 +186,4 @@ and there was insufficient memory. .Sh AUTHORS .An -nosplit This manual page was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org . +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org . diff --git a/share/man/man9/g_geom.9 b/share/man/man9/g_geom.9 index 2f4599d60ba..2b4aac84ce9 100644 --- a/share/man/man9/g_geom.9 +++ b/share/man/man9/g_geom.9 @@ -203,4 +203,4 @@ destroy_example_geom(struct g_geom *gp) .Sh AUTHORS .An -nosplit This manual page was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org . +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org . diff --git a/share/man/man9/g_provider.9 b/share/man/man9/g_provider.9 index 05e4addabf3..b22ae0bc904 100644 --- a/share/man/man9/g_provider.9 +++ b/share/man/man9/g_provider.9 @@ -142,4 +142,4 @@ create_example_provider(struct g_geom *gp) .Sh AUTHORS .An -nosplit This manual page was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org . +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org . diff --git a/share/man/man9/g_provider_by_name.9 b/share/man/man9/g_provider_by_name.9 index 58da421a243..56dd303298b 100644 --- a/share/man/man9/g_provider_by_name.9 +++ b/share/man/man9/g_provider_by_name.9 @@ -74,4 +74,4 @@ if there is no such provider. .Sh AUTHORS .An -nosplit This manual page was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org . +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org . diff --git a/share/man/man9/g_wither_geom.9 b/share/man/man9/g_wither_geom.9 index 8ced94948dd..337d9628d6d 100644 --- a/share/man/man9/g_wither_geom.9 +++ b/share/man/man9/g_wither_geom.9 @@ -83,4 +83,4 @@ The topology lock has to be held. .Sh AUTHORS .An -nosplit This manual page was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org . +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org . diff --git a/share/man/man9/get_cyclecount.9 b/share/man/man9/get_cyclecount.9 index eabaeb1fa80..ed57e4e065e 100644 --- a/share/man/man9/get_cyclecount.9 +++ b/share/man/man9/get_cyclecount.9 @@ -78,11 +78,6 @@ processors use the .Li TSC register. .Pp -The -.Tn IA64 -processors use the -.Li AR.ITC -register. .Sh SEE ALSO .Xr binuptime 9 .Sh HISTORY @@ -92,4 +87,4 @@ function first appeared in .Fx 5.0 . .Sh AUTHORS This manual page was written by -.An Mark Murray Aq markm@FreeBSD.org . +.An Mark Murray Aq Mt markm@FreeBSD.org . diff --git a/share/man/man9/getnewvnode.9 b/share/man/man9/getnewvnode.9 index 2e81212630f..57ecc986c7c 100644 --- a/share/man/man9/getnewvnode.9 +++ b/share/man/man9/getnewvnode.9 @@ -66,4 +66,4 @@ returns 0 on success. There are currently no failure conditions - that do not result in a panic. .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/groupmember.9 b/share/man/man9/groupmember.9 index 0d3629a1ad4..84d57e63208 100644 --- a/share/man/man9/groupmember.9 +++ b/share/man/man9/groupmember.9 @@ -57,4 +57,4 @@ If the is found, 1 is returned; otherwise, 0 is returned. .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/hhook.9 b/share/man/man9/hhook.9 index ca6b4940fa3..f572fd2778d 100644 --- a/share/man/man9/hhook.9 +++ b/share/man/man9/hhook.9 @@ -374,9 +374,9 @@ http://caia.swin.edu.au/urp/newtcp/ The .Nm framework was written by -.An Lawrence Stewart Aq lstewart@FreeBSD.org . +.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org . .Pp This manual page was written by -.An David Hayes Aq david.hayes@ieee.org +.An David Hayes Aq Mt david.hayes@ieee.org and -.An Lawrence Stewart Aq lstewart@FreeBSD.org . +.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org . diff --git a/share/man/man9/ieee80211_radiotap.9 b/share/man/man9/ieee80211_radiotap.9 index cea2eb4e7f1..3a670071051 100644 --- a/share/man/man9/ieee80211_radiotap.9 +++ b/share/man/man9/ieee80211_radiotap.9 @@ -297,6 +297,6 @@ definitions first appeared in .Sh AUTHORS .An -nosplit The original version of this manual page was written by -.An Bruce M. Simpson Aq bms@FreeBSD.org +.An Bruce M. Simpson Aq Mt bms@FreeBSD.org and -.An Darron Broad Aq darron@kewl.org . +.An Darron Broad Aq Mt darron@kewl.org . diff --git a/share/man/man9/ifnet.9 b/share/man/man9/ifnet.9 index f1d3e471bc6..29df470334f 100644 --- a/share/man/man9/ifnet.9 +++ b/share/man/man9/ifnet.9 @@ -1370,7 +1370,6 @@ function is called to perform the operation; qq.v. .It Dv SIOCDIFADDR The socket's protocol control routine is called to implement the requested action. -.Pp .El .El .Pp diff --git a/share/man/man9/insmntque.9 b/share/man/man9/insmntque.9 index e2bf0d577b7..ae94d901b75 100644 --- a/share/man/man9/insmntque.9 +++ b/share/man/man9/insmntque.9 @@ -92,4 +92,4 @@ even if the file system is being unmounted. .Xr vgone 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/kernel_mount.9 b/share/man/man9/kernel_mount.9 index 4164e5b9c8d..10fb353fc4b 100644 --- a/share/man/man9/kernel_mount.9 +++ b/share/man/man9/kernel_mount.9 @@ -206,6 +206,6 @@ appeared in The .Fn kernel_mount family of functions and API was developed by -.An Poul-Henning Kamp Aq phk@FreeBSD.org . +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . This manual page was written by -.An Tom Rhodes Aq trhodes@FreeBSD.org . +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org . diff --git a/share/man/man9/khelp.9 b/share/man/man9/khelp.9 index 2f3f0e1284d..667bccc3642 100644 --- a/share/man/man9/khelp.9 +++ b/share/man/man9/khelp.9 @@ -430,9 +430,9 @@ http://caia.swin.edu.au/urp/newtcp/ The .Nm framework was written by -.An Lawrence Stewart Aq lstewart@FreeBSD.org . +.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org . .Pp This manual page was written by -.An David Hayes Aq david.hayes@ieee.org +.An David Hayes Aq Mt david.hayes@ieee.org and -.An Lawrence Stewart Aq lstewart@FreeBSD.org . +.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org . diff --git a/share/man/man9/kqueue.9 b/share/man/man9/kqueue.9 index 29ae5f7a76a..28aadee776b 100644 --- a/share/man/man9/kqueue.9 +++ b/share/man/man9/kqueue.9 @@ -463,4 +463,4 @@ by .Sh AUTHORS This manual page was written by -.An John-Mark Gurney Aq jmg@FreeBSD.org . +.An John-Mark Gurney Aq Mt jmg@FreeBSD.org . diff --git a/share/man/man9/kthread.9 b/share/man/man9/kthread.9 index 25a20cecf9e..b7c0388bf8b 100644 --- a/share/man/man9/kthread.9 +++ b/share/man/man9/kthread.9 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 24, 2010 +.Dd July 15, 2014 .Dt KTHREAD 9 .Os .Sh NAME @@ -275,7 +275,7 @@ buf_daemon() bufdaemonthread, SHUTDOWN_PRI_LAST); ... for (;;) { - kthread_suspend_check(bufdaemonthread); + kthread_suspend_check(); ... } } diff --git a/share/man/man9/lock.9 b/share/man/man9/lock.9 index cb77686140b..22fa2f7de41 100644 --- a/share/man/man9/lock.9 +++ b/share/man/man9/lock.9 @@ -397,4 +397,4 @@ will be the result of trying. .Xr VOP_PRINT 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/mbchain.9 b/share/man/man9/mbchain.9 index 4e05e7ad3ec..3603ba18899 100644 --- a/share/man/man9/mbchain.9 +++ b/share/man/man9/mbchain.9 @@ -219,4 +219,4 @@ mb_done(mbp); .Xr mdchain 9 .Sh AUTHORS This manual page was written by -.An Boris Popov Aq bp@FreeBSD.org . +.An Boris Popov Aq Mt bp@FreeBSD.org . diff --git a/share/man/man9/mbpool.9 b/share/man/man9/mbpool.9 index 600c37179fb..e9cd7a244e4 100644 --- a/share/man/man9/mbpool.9 +++ b/share/man/man9/mbpool.9 @@ -255,7 +255,7 @@ the number of buffers on the free list. .Sh SEE ALSO .Xr mbuf 9 .Sh AUTHORS -.An Harti Brandt Aq harti@FreeBSD.org +.An Harti Brandt Aq Mt harti@FreeBSD.org .Sh CAVEATS The function .Fn mbp_sync diff --git a/share/man/man9/mbuf.9 b/share/man/man9/mbuf.9 index 9b75c6136b7..8b01b77abc3 100644 --- a/share/man/man9/mbuf.9 +++ b/share/man/man9/mbuf.9 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 30, 2014 +.Dd June 5, 2014 .Dt MBUF 9 .Os .\" @@ -209,24 +209,26 @@ The flag bits are defined as follows: .Bd -literal /* mbuf flags */ -#define M_EXT 0x0001 /* has associated external storage */ -#define M_PKTHDR 0x0002 /* start of record */ -#define M_EOR 0x0004 /* end of record */ -#define M_RDONLY 0x0008 /* associated data marked read-only */ -#define M_PROTO1 0x0010 /* protocol-specific */ -#define M_PROTO2 0x0020 /* protocol-specific */ -#define M_PROTO3 0x0040 /* protocol-specific */ -#define M_PROTO4 0x0080 /* protocol-specific */ -#define M_PROTO5 0x0100 /* protocol-specific */ -#define M_PROTO6 0x4000 /* protocol-specific (avoid M_BCAST conflict) */ -#define M_FREELIST 0x8000 /* mbuf is on the free list */ +#define M_EXT 0x00000001 /* has associated external storage */ +#define M_PKTHDR 0x00000002 /* start of record */ +#define M_EOR 0x00000004 /* end of record */ +#define M_RDONLY 0x00000008 /* associated data marked read-only */ +#define M_PROTO1 0x00001000 /* protocol-specific */ +#define M_PROTO2 0x00002000 /* protocol-specific */ +#define M_PROTO3 0x00004000 /* protocol-specific */ +#define M_PROTO4 0x00008000 /* protocol-specific */ +#define M_PROTO5 0x00010000 /* protocol-specific */ +#define M_PROTO6 0x00020000 /* protocol-specific */ +#define M_PROTO7 0x00040000 /* protocol-specific */ +#define M_PROTO8 0x00080000 /* protocol-specific */ +#define M_PROTO9 0x00100000 /* protocol-specific */ +#define M_PROTO10 0x00200000 /* protocol-specific */ +#define M_PROTO11 0x00400000 /* protocol-specific */ +#define M_PROTO12 0x00800000 /* protocol-specific */ /* mbuf pkthdr flags (also stored in m_flags) */ -#define M_BCAST 0x0200 /* send/received as link-level broadcast */ -#define M_MCAST 0x0400 /* send/received as link-level multicast */ -#define M_FRAG 0x0800 /* packet is fragment of larger packet */ -#define M_FIRSTFRAG 0x1000 /* packet is first fragment */ -#define M_LASTFRAG 0x2000 /* packet is last fragment */ +#define M_BCAST 0x00000010 /* send/received as link-level broadcast */ +#define M_MCAST 0x00000020 /* send/received as link-level multicast */ .Ed .Pp The available @@ -251,10 +253,10 @@ The available external buffer types are defined as follows: #define EXT_JUMBO16 5 /* jumbo cluster 16184 bytes */ #define EXT_PACKET 6 /* mbuf+cluster from packet zone */ #define EXT_MBUF 7 /* external mbuf reference (M_IOVEC) */ -#define EXT_NET_DRV 100 /* custom ext_buf provided by net driver(s) */ -#define EXT_MOD_TYPE 200 /* custom module's ext_buf type */ -#define EXT_DISPOSABLE 300 /* can throw this buffer away w/page flipping */ -#define EXT_EXTREF 400 /* has externally maintained ref_cnt ptr */ +#define EXT_NET_DRV 252 /* custom ext_buf provided by net driver(s) */ +#define EXT_MOD_TYPE 253 /* custom module's ext_buf type */ +#define EXT_DISPOSABLE 254 /* can throw this buffer away w/page flipping */ +#define EXT_EXTREF 255 /* has externally maintained ref_cnt ptr */ .Ed .Pp If the diff --git a/share/man/man9/mbuf_tags.9 b/share/man/man9/mbuf_tags.9 index cab22a00f7f..c812a3f25bd 100644 --- a/share/man/man9/mbuf_tags.9 +++ b/share/man/man9/mbuf_tags.9 @@ -283,4 +283,4 @@ Inlined functions are defined in The packet tags first appeared in .Ox 2.9 and were written by -.An Angelos D. Keromytis Aq angelos@openbsd.org . +.An Angelos D. Keromytis Aq Mt angelos@openbsd.org . diff --git a/share/man/man9/mdchain.9 b/share/man/man9/mdchain.9 index 5b0bf4ace4f..ed25c1eb6f2 100644 --- a/share/man/man9/mdchain.9 +++ b/share/man/man9/mdchain.9 @@ -208,4 +208,4 @@ mb_done(mdp); .Xr mbuf 9 .Sh AUTHORS This manual page was written by -.An Boris Popov Aq bp@FreeBSD.org . +.An Boris Popov Aq Mt bp@FreeBSD.org . diff --git a/share/man/man9/memguard.9 b/share/man/man9/memguard.9 index 9ce773a3cfa..42678c05223 100644 --- a/share/man/man9/memguard.9 +++ b/share/man/man9/memguard.9 @@ -196,13 +196,13 @@ first appeared in .An -nosplit .Nm was originally written by -.An Bosko Milekic Aq bmilekic@FreeBSD.org . +.An Bosko Milekic Aq Mt bmilekic@FreeBSD.org . This manual page was originally written by -.An Christian Brueffer Aq brueffer@FreeBSD.org . +.An Christian Brueffer Aq Mt brueffer@FreeBSD.org . Additions have been made by -.An Matthew Fleming Aq mdf@FreeBSD.org +.An Matthew Fleming Aq Mt mdf@FreeBSD.org and -.An Gleb Smirnoff Aq glebius@FreeBSD.org +.An Gleb Smirnoff Aq Mt glebius@FreeBSD.org to both the implementation and the documentation. .Sh BUGS It is not possible to guard allocations that really expect themselves to be diff --git a/share/man/man9/microtime.9 b/share/man/man9/microtime.9 index 3288578e173..f5ea65d1fc3 100644 --- a/share/man/man9/microtime.9 +++ b/share/man/man9/microtime.9 @@ -118,4 +118,4 @@ but have existed in other incarnations since .Bx 4.4 . .Sh AUTHORS This manual page was written by -.An Kelly Yancey Aq kbyanc@posi.net . +.An Kelly Yancey Aq Mt kbyanc@posi.net . diff --git a/share/man/man9/microuptime.9 b/share/man/man9/microuptime.9 index 5a9a71befd4..048143dcb80 100644 --- a/share/man/man9/microuptime.9 +++ b/share/man/man9/microuptime.9 @@ -120,4 +120,4 @@ execution time. .Xr tvtohz 9 .Sh AUTHORS This manual page was written by -.An Kelly Yancey Aq kbyanc@posi.net . +.An Kelly Yancey Aq Mt kbyanc@posi.net . diff --git a/share/man/man9/mod_cc.9 b/share/man/man9/mod_cc.9 index d753a3c125d..12bc9be38f6 100644 --- a/share/man/man9/mod_cc.9 +++ b/share/man/man9/mod_cc.9 @@ -322,12 +322,12 @@ http://caia.swin.edu.au/urp/newtcp/ The .Nm framework was written by -.An Lawrence Stewart Aq lstewart@FreeBSD.org , -.An James Healy Aq jimmy@deefa.com +.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org , +.An James Healy Aq Mt jimmy@deefa.com and -.An David Hayes Aq david.hayes@ieee.org . +.An David Hayes Aq Mt david.hayes@ieee.org . .Pp This manual page was written by -.An David Hayes Aq david.hayes@ieee.org +.An David Hayes Aq Mt david.hayes@ieee.org and -.An Lawrence Stewart Aq lstewart@FreeBSD.org . +.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org . diff --git a/share/man/man9/module.9 b/share/man/man9/module.9 index bd072a92dee..274b3b45024 100644 --- a/share/man/man9/module.9 +++ b/share/man/man9/module.9 @@ -118,4 +118,4 @@ DECLARE_MODULE(foo, mod_data, SI_SUB_EXEC, SI_ORDER_ANY); .Pa /usr/share/examples/kld .Sh AUTHORS This manual page was written by -.An Alexander Langer Aq alex@FreeBSD.org . +.An Alexander Langer Aq Mt alex@FreeBSD.org . diff --git a/share/man/man9/namei.9 b/share/man/man9/namei.9 index 95c20a322c7..0bd827f2cd5 100644 --- a/share/man/man9/namei.9 +++ b/share/man/man9/namei.9 @@ -347,9 +347,9 @@ An attempt is made to modify a file or directory on a read-only file system. .Sh AUTHORS .An -nosplit This manual page was written by -.An Eivind Eklund Aq eivind@FreeBSD.org +.An Eivind Eklund Aq Mt eivind@FreeBSD.org and later significantly revised by -.An Hiten M. Pandya Aq hmp@FreeBSD.org . +.An Hiten M. Pandya Aq Mt hmp@FreeBSD.org . .Sh BUGS The .Dv LOCKPARENT diff --git a/share/man/man9/osd.9 b/share/man/man9/osd.9 index ba9c632e1d0..e8260fe4633 100644 --- a/share/man/man9/osd.9 +++ b/share/man/man9/osd.9 @@ -384,7 +384,7 @@ Object Specific Data (OSD) facility first appeared in The .Nm facility was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org . +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org . .Pp This manual page was written by -.An Lawrence Stewart Aq lstewart@FreeBSD.org . +.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org . diff --git a/share/man/man9/pbuf.9 b/share/man/man9/pbuf.9 index 4329ac9c84f..6cf6d3944bf 100644 --- a/share/man/man9/pbuf.9 +++ b/share/man/man9/pbuf.9 @@ -129,4 +129,4 @@ In the case of can also be returned indicating that there are no buffers available. .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/pci.9 b/share/man/man9/pci.9 index 28bae85ff23..411c11a57cf 100644 --- a/share/man/man9/pci.9 +++ b/share/man/man9/pci.9 @@ -695,10 +695,11 @@ space on the target architecture. .%O ISBN 0-201-30974-2 .Re .Sh AUTHORS +.An -nosplit This manual page was written by -.An Bruce M Simpson Aq bms@FreeBSD.org +.An Bruce M Simpson Aq Mt bms@FreeBSD.org and -.An John Baldwin Aq jhb@FreeBSD.org . +.An John Baldwin Aq Mt jhb@FreeBSD.org . .Sh BUGS The kernel PCI code has a number of references to .Dq "slot numbers" . diff --git a/share/man/man9/pfind.9 b/share/man/man9/pfind.9 index dfd15b8dcf7..5a3f5caf134 100644 --- a/share/man/man9/pfind.9 +++ b/share/man/man9/pfind.9 @@ -85,4 +85,4 @@ on failure. .Xr pgfind 9 .Sh AUTHORS This manual page was written by -.An Evan Sarmiento Aq kaworu@sektor7.ath.cx . +.An Evan Sarmiento Aq Mt kaworu@sektor7.ath.cx . diff --git a/share/man/man9/pgfind.9 b/share/man/man9/pgfind.9 index a3049876d72..5a2cf289f64 100644 --- a/share/man/man9/pgfind.9 +++ b/share/man/man9/pgfind.9 @@ -62,4 +62,4 @@ structure on successful completion. .Xr pfind 9 .Sh AUTHORS This manual page was written by -.An Evan Sarmiento Aq kaworu@sektor7.ath.cx . +.An Evan Sarmiento Aq Mt kaworu@sektor7.ath.cx . diff --git a/share/man/man9/pmap.9 b/share/man/man9/pmap.9 index aa6d4a3dd1c..63b8f2a86d3 100644 --- a/share/man/man9/pmap.9 +++ b/share/man/man9/pmap.9 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 21, 2003 +.Dd July 18, 2014 .Dt PMAP 9 .Os .Sh NAME @@ -91,7 +91,6 @@ operation. .Xr pmap_activate 9 , .Xr pmap_change_wiring 9 , .Xr pmap_clear_modify 9 , -.Xr pmap_clear_reference 9 , .Xr pmap_copy 9 , .Xr pmap_copy_page 9 , .Xr pmap_enter 9 , @@ -107,7 +106,6 @@ operation. .Xr pmap_object_init_pt 9 , .Xr pmap_page_exists_quick 9 , .Xr pmap_page_init 9 , -.Xr pmap_page_protect 9 , .Xr pmap_pinit 9 , .Xr pmap_pinit0 9 , .Xr pmap_pinit2 9 , @@ -119,7 +117,8 @@ operation. .Xr pmap_remove_all 9 , .Xr pmap_remove_pages 9 , .Xr pmap_resident_count 9 , -.Xr pmap_ts_modified 9 , +.Xr pmap_ts_referenced 9 , +.Xr pmap_unwire 9 , .Xr pmap_wired_count 9 , .Xr pmap_zero_area 9 , .Xr pmap_zero_idle 9 , @@ -127,4 +126,4 @@ operation. .Xr vm_map 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/pmap_activate.9 b/share/man/man9/pmap_activate.9 index 840d8a19c27..8d9f0504c02 100644 --- a/share/man/man9/pmap_activate.9 +++ b/share/man/man9/pmap_activate.9 @@ -48,4 +48,4 @@ accessed. .Xr pmap 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/pmap_change_wiring.9 b/share/man/man9/pmap_change_wiring.9 index f3952f89b6c..4fd09f216d3 100644 --- a/share/man/man9/pmap_change_wiring.9 +++ b/share/man/man9/pmap_change_wiring.9 @@ -65,4 +65,4 @@ function. .Xr pmap 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/pmap_clear_modify.9 b/share/man/man9/pmap_clear_modify.9 index 002300b5625..a873c91df9a 100644 --- a/share/man/man9/pmap_clear_modify.9 +++ b/share/man/man9/pmap_clear_modify.9 @@ -25,12 +25,11 @@ .\" .\" $FreeBSD$ .\" -.Dd July 21, 2003 +.Dd July 17, 2014 .Dt PMAP_CLEAR_MODIFY 9 .Os .Sh NAME -.Nm pmap_clear_modify , -.Nm pmap_clear_reference +.Nm pmap_clear_modify .Nd set information about physical pages .Sh SYNOPSIS .In sys/param.h @@ -38,8 +37,6 @@ .In vm/pmap.h .Ft void .Fn pmap_clear_modify "vm_page_t m" -.Ft void -.Fn pmap_clear_reference "vm_page_t m" .Sh DESCRIPTION The .Fn pmap_clear_modify @@ -47,17 +44,9 @@ function clears the .Dq modified bit on the physical page .Fa m . -.Pp -The -.Fn pmap_clear_reference -function clears the -.Dq referenced -bit on the physical page -.Fa m . .Sh SEE ALSO .Xr pmap 9 , -.Xr pmap_is_modified 9 , -.Xr pmap_ts_referenced 9 +.Xr pmap_is_modified 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/pmap_copy.9 b/share/man/man9/pmap_copy.9 index 1541fa5e09b..4899b6d970c 100644 --- a/share/man/man9/pmap_copy.9 +++ b/share/man/man9/pmap_copy.9 @@ -81,4 +81,4 @@ routine only operates upon a single page. .Xr pmap 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/pmap_enter.9 b/share/man/man9/pmap_enter.9 index 2e524532b11..69e0650c6ef 100644 --- a/share/man/man9/pmap_enter.9 +++ b/share/man/man9/pmap_enter.9 @@ -65,4 +65,4 @@ specification to make the requested entry at the time it is called. .Xr pmap 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/pmap_extract.9 b/share/man/man9/pmap_extract.9 index 0622b65ccd3..d2154ebe8a0 100644 --- a/share/man/man9/pmap_extract.9 +++ b/share/man/man9/pmap_extract.9 @@ -90,6 +90,6 @@ be returned. The .Fn pmap_extract_and_hold function was implemented by -.An Alan L. Cox Aq alc@imimic.com . +.An Alan L. Cox Aq Mt alc@imimic.com . This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/pmap_growkernel.9 b/share/man/man9/pmap_growkernel.9 index f038fb53d93..1385ddcb127 100644 --- a/share/man/man9/pmap_growkernel.9 +++ b/share/man/man9/pmap_growkernel.9 @@ -48,4 +48,4 @@ It will allocate more page entries if required. .Xr pmap 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/pmap_init.9 b/share/man/man9/pmap_init.9 index 1a8d74c94a0..b377208231d 100644 --- a/share/man/man9/pmap_init.9 +++ b/share/man/man9/pmap_init.9 @@ -62,4 +62,4 @@ excessive numbers of PV entries. .Xr pmap 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/pmap_is_modified.9 b/share/man/man9/pmap_is_modified.9 index 591a9853940..66493cda651 100644 --- a/share/man/man9/pmap_is_modified.9 +++ b/share/man/man9/pmap_is_modified.9 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 21, 2003 +.Dd July 17, 2014 .Dt PMAP_IS_MODIFIED 9 .Os .Sh NAME @@ -64,8 +64,7 @@ necessary that 0 only be returned when there are no remaining reference bits set on the page. .Sh SEE ALSO .Xr pmap 9 , -.Xr pmap_clear_modify 9 , -.Xr pmap_clear_reference 9 +.Xr pmap_clear_modify 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/pmap_is_prefaultable.9 b/share/man/man9/pmap_is_prefaultable.9 index c6f28709b66..9c3a7490e73 100644 --- a/share/man/man9/pmap_is_prefaultable.9 +++ b/share/man/man9/pmap_is_prefaultable.9 @@ -54,4 +54,4 @@ This is a helper function which is called by .Xr vm_fault_prefault 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/pmap_map.9 b/share/man/man9/pmap_map.9 index 2c472fe97b4..f813a217ce9 100644 --- a/share/man/man9/pmap_map.9 +++ b/share/man/man9/pmap_map.9 @@ -77,4 +77,4 @@ is returned. .Xr pmap 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/pmap_mincore.9 b/share/man/man9/pmap_mincore.9 index d0e45ea5db3..383387cfdb4 100644 --- a/share/man/man9/pmap_mincore.9 +++ b/share/man/man9/pmap_mincore.9 @@ -71,4 +71,4 @@ return .Xr pmap 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/pmap_object_init_pt.9 b/share/man/man9/pmap_object_init_pt.9 index 90ae75f4462..f87c8a9fc56 100644 --- a/share/man/man9/pmap_object_init_pt.9 +++ b/share/man/man9/pmap_object_init_pt.9 @@ -70,4 +70,4 @@ startup, and immediately following a call to .Xr vm_map 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/pmap_page_exists_quick.9 b/share/man/man9/pmap_page_exists_quick.9 index 8db25801440..cc377ab7793 100644 --- a/share/man/man9/pmap_page_exists_quick.9 +++ b/share/man/man9/pmap_page_exists_quick.9 @@ -63,4 +63,4 @@ is one of the first 16 PVs linked from the page .Xr pmap 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/pmap_page_init.9 b/share/man/man9/pmap_page_init.9 index 65f72ec850e..d6787e36aa1 100644 --- a/share/man/man9/pmap_page_init.9 +++ b/share/man/man9/pmap_page_init.9 @@ -48,4 +48,4 @@ queue management lists. .Xr pmap_pinit 9 .Sh AUTHORS This manual page was written by -.An Hiten Pandya Aq hmp@FreeBSD.org . +.An Hiten Pandya Aq Mt hmp@FreeBSD.org . diff --git a/share/man/man9/pmap_pinit.9 b/share/man/man9/pmap_pinit.9 index d52172934c3..f001e745474 100644 --- a/share/man/man9/pmap_pinit.9 +++ b/share/man/man9/pmap_pinit.9 @@ -64,4 +64,4 @@ until further notice. .Xr pmap_growkernel 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/pmap_page_protect.9 b/share/man/man9/pmap_protect.9 similarity index 87% rename from share/man/man9/pmap_page_protect.9 rename to share/man/man9/pmap_protect.9 index f77d57def77..659dc6db6a2 100644 --- a/share/man/man9/pmap_page_protect.9 +++ b/share/man/man9/pmap_protect.9 @@ -25,11 +25,10 @@ .\" .\" $FreeBSD$ .\" -.Dd July 21, 2003 +.Dd July 18, 2014 .Dt PMAP_PROTECT 9 .Os .Sh NAME -.Nm pmap_page_protect , .Nm pmap_protect .Nd set physical page protection .Sh SYNOPSIS @@ -37,20 +36,11 @@ .In vm/vm.h .In vm/pmap.h .Ft void -.Fn pmap_page_protect "vm_page_t m" "vm_prot_t prot" -.Ft void .Fo pmap_protect -.Fa "pmap_t pmap" "vm_offset_t sva" "vm_offset_t eva" "vm_prot_t pr" +.Fa "pmap_t pmap" "vm_offset_t sva" "vm_offset_t eva" "vm_prot_t prot" .Fc .Sh DESCRIPTION The -.Fn pmap_page_protect -function lowers the physical page permissions to -.Fa prot -for all mappings of a given page -.Fa m . -.Pp -The .Fn pmap_protect function sets the physical page permissions to .Fa prot @@ -64,4 +54,4 @@ and .Xr pmap 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/pmap_qenter.9 b/share/man/man9/pmap_qenter.9 index b148b69f694..a5a94d49701 100644 --- a/share/man/man9/pmap_qenter.9 +++ b/share/man/man9/pmap_qenter.9 @@ -76,4 +76,4 @@ function is intended to remove such temporary mappings. .Xr pmap 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/pmap_release.9 b/share/man/man9/pmap_release.9 index ef296416180..b328bd852c8 100644 --- a/share/man/man9/pmap_release.9 +++ b/share/man/man9/pmap_release.9 @@ -55,4 +55,4 @@ no longer contains any valid mappings. .Xr pmap_pinit 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/pmap_remove.9 b/share/man/man9/pmap_remove.9 index 12664dce74a..4426f0de7d4 100644 --- a/share/man/man9/pmap_remove.9 +++ b/share/man/man9/pmap_remove.9 @@ -81,4 +81,4 @@ more quickly than would be the case for calling .Fn pmap 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/pmap_resident_count.9 b/share/man/man9/pmap_resident_count.9 index bf39548cea0..343dc7cc5cf 100644 --- a/share/man/man9/pmap_resident_count.9 +++ b/share/man/man9/pmap_resident_count.9 @@ -71,4 +71,4 @@ which are currently wired into in main memory. .Xr pmap 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/pmap_unwire.9 b/share/man/man9/pmap_unwire.9 new file mode 100644 index 00000000000..8451383e444 --- /dev/null +++ b/share/man/man9/pmap_unwire.9 @@ -0,0 +1,66 @@ +.\" +.\" Copyright (c) 2014 Alan L. Cox +.\" 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 July 17, 2014 +.Dt PMAP_UNWIRE 9 +.Os +.Sh NAME +.Nm pmap_unwire +.Nd unwire a range of virtual pages +.Sh SYNOPSIS +.In sys/param.h +.In vm/vm.h +.In vm/pmap.h +.Ft void +.Fo pmap_unwire +.Fa "pmap_t pmap" "vm_offset_t start" "vm_offset_t end" +.Fc +.Sh DESCRIPTION +.Pp +The function +.Fn pmap_unwire +removes the wired attribute from each of the virtual-to-physical page mappings +within the virtual address range from +.Fa start +to +.Fa end +of the physical map +.Fa pmap . +Every valid mapping within that range is required to have the wired attribute +set. +Invalid mappings are ignored, since they cannot have the wired attribute set. +.Sh NOTES +Only the function +.Xr pmap_enter 9 +can be used to set the wired attribute of a virtual-to-physical page mapping. +.Sh SEE ALSO +.Xr pmap 9 , +.Xr pmap_enter 9 , +.Xr pmap_wired_count 9 +.Sh AUTHORS +This manual page was written by +.An Alan L. Cox Aq alc@rice.edu . diff --git a/share/man/man9/pmap_zero_page.9 b/share/man/man9/pmap_zero_page.9 index 541eef06104..519e76b1871 100644 --- a/share/man/man9/pmap_zero_page.9 +++ b/share/man/man9/pmap_zero_page.9 @@ -69,4 +69,4 @@ This function is required to be implemented for each architecture supported by .Xr pmap 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/pseudofs.9 b/share/man/man9/pseudofs.9 index 5d394961dc5..98ccc6cae7b 100644 --- a/share/man/man9/pseudofs.9 +++ b/share/man/man9/pseudofs.9 @@ -67,4 +67,4 @@ module appeared in The .Nm module and this manual page were written by -.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . +.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org . diff --git a/share/man/man9/redzone.9 b/share/man/man9/redzone.9 index 98723c7b7ac..6328236ced5 100644 --- a/share/man/man9/redzone.9 +++ b/share/man/man9/redzone.9 @@ -114,7 +114,7 @@ Free backtrace: first appeared in .Fx 7.0 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org .Sh BUGS Currently, .Nm diff --git a/share/man/man9/resource_int_value.9 b/share/man/man9/resource_int_value.9 index e82853513c1..710e97e91b3 100644 --- a/share/man/man9/resource_int_value.9 +++ b/share/man/man9/resource_int_value.9 @@ -76,4 +76,4 @@ Inappropriate resource type. .Xr driver 9 .Sh AUTHORS This manual page was written by -.An Warner Losh Aq imp@FreeBSD.org . +.An Warner Losh Aq Mt imp@FreeBSD.org . diff --git a/share/man/man9/rman.9 b/share/man/man9/rman.9 index d9a20920da3..a14f68680f7 100644 --- a/share/man/man9/rman.9 +++ b/share/man/man9/rman.9 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 29, 2011 +.Dd July 15, 2014 .Dt RMAN 9 .Os .Sh NAME @@ -141,13 +141,11 @@ represented by a 16-bit flag register, as follows. #define RF_ALLOCATED 0x0001 /* resource has been reserved */ #define RF_ACTIVE 0x0002 /* resource allocation has been activated */ #define RF_SHAREABLE 0x0004 /* resource permits contemporaneous sharing */ -#define RF_TIMESHARE 0x0008 /* resource permits time-division sharing */ -#define RF_WANTED 0x0010 /* somebody is waiting for this resource */ #define RF_FIRSTSHARE 0x0020 /* first in sharing list */ #define RF_PREFETCHABLE 0x0040 /* resource is prefetchable */ .Ed .Pp -The remainder of the flag bits are used to represent the desired alignment +Bits 15:10 of the flag register are used to represent the desired alignment of the resource within the region. .Pp The @@ -299,12 +297,9 @@ The .Fa bound argument must be a power of two. It may be set to zero to specify no boundary restriction. -The default behavior is to allocate an exclusive segment, unless the +A shared segment will be allocated if the .Dv RF_SHAREABLE -or -.Dv RF_TIMESHARE -flags are set, in which case a shared -segment will be allocated. +flag is set, otherwise an exclusive segment will be allocated. If this shared segment already exists, the caller has its device added to the list of consumers. .Pp @@ -469,4 +464,4 @@ function returns a pointer to the device which reserved the resource .Xr mutex 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/sbuf.9 b/share/man/man9/sbuf.9 index d8acbaff0ce..495726c5fb1 100644 --- a/share/man/man9/sbuf.9 +++ b/share/man/man9/sbuf.9 @@ -551,15 +551,15 @@ family of functions first appeared in The .Nm family of functions was designed by -.An Poul-Henning Kamp Aq phk@FreeBSD.org +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org and implemented by -.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . +.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org . Additional improvements were suggested by -.An Justin T. Gibbs Aq gibbs@FreeBSD.org . +.An Justin T. Gibbs Aq Mt gibbs@FreeBSD.org . Auto-extend support added by -.An Kelly Yancey Aq kbyanc@FreeBSD.org . +.An Kelly Yancey Aq Mt kbyanc@FreeBSD.org . Drain functionality added by -.An Matthew Fleming Aq mdf@FreeBSD.org . +.An Matthew Fleming Aq Mt mdf@FreeBSD.org . .Pp This manual page was written by -.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . +.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org . diff --git a/share/man/man9/selrecord.9 b/share/man/man9/selrecord.9 index f7a0113fc41..aafbe4b3d96 100644 --- a/share/man/man9/selrecord.9 +++ b/share/man/man9/selrecord.9 @@ -121,6 +121,6 @@ but consumers should not generally rely on this feature. .Sh AUTHORS .An -nosplit This manual page was written by -.An Chad David Aq davidc@FreeBSD.org +.An Chad David Aq Mt davidc@FreeBSD.org and -.An Alfred Perlstein Aq alfred@FreeBSD.org . +.An Alfred Perlstein Aq Mt alfred@FreeBSD.org . diff --git a/share/man/man9/signal.9 b/share/man/man9/signal.9 index c61ceb653ce..a2e54fef012 100644 --- a/share/man/man9/signal.9 +++ b/share/man/man9/signal.9 @@ -435,4 +435,4 @@ returns either a valid signal number or zero. .Xr psignal 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@FreeBSD.org . +.An Chad David Aq Mt davidc@FreeBSD.org . diff --git a/share/man/man9/sleep.9 b/share/man/man9/sleep.9 index e0225ee98a4..bd421eaf6ba 100644 --- a/share/man/man9/sleep.9 +++ b/share/man/man9/sleep.9 @@ -383,4 +383,4 @@ function appeared in .Sh AUTHORS .An -nosplit This manual page was written by -.An J\(:org Wunsch Aq joerg@FreeBSD.org . +.An J\(:org Wunsch Aq Mt joerg@FreeBSD.org . diff --git a/share/man/man9/socket.9 b/share/man/man9/socket.9 index f2cb5bae5b0..4b3e2cbd466 100644 --- a/share/man/man9/socket.9 +++ b/share/man/man9/socket.9 @@ -1,5 +1,6 @@ .\"- .\" Copyright (c) 2006 Robert N. M. Watson +.\" Copyright (c) 2014 Benjamin J. Kaduk .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -25,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 12, 2013 +.Dd May 26, 2014 .Dt SOCKET 9 .Os .Sh NAME @@ -34,6 +35,12 @@ .Sh SYNOPSIS .In sys/socket.h .In sys/socketvar.h +.Ft void +.Fn soabort "struct socket *so" +.Ft int +.Fn soaccept "struct socket *so" "struct sockaddr **nam" +.Ft int +.Fn socheckuid "struct socket *so" "uid_t uid" .Ft int .Fn sobind "struct socket *so" "struct sockaddr *nam" "struct thread *td" .Ft void @@ -46,21 +53,97 @@ .Fa "struct ucred *cred" "struct thread *td" .Fc .Ft int -.Fn sogetopt "struct socket *so" "struct sockopt *sopt" +.Fn sodisconnect "struct socket *so" +.Ft struct sockaddr * +.Fn sodupsockaddr "const struct sockaddr *sa" "int mflags" +.Ft void +.Fn sofree "struct socket *so" +.Ft void +.Fn sohasoutofband "struct socket *so" +.Ft int +.Fn solisten "struct socket *so" "int backlog" "struct thread *td" +.Ft void +.Fn solisten_proto "struct socket *so" "int backlog" +.Ft int +.Fn solisten_proto_check "struct socket *so" +.Ft struct socket * +.Fn sonewconn "struct socket *head" "int connstatus" +.Ft int +.Fo sopoll +.Fa "struct socket *so" "int events" "struct ucred *active_cred" +.Fa "struct thread *td" +.Fc +.Ft int +.Fo sopoll_generic +.Fa "struct socket *so" "int events" "struct ucred *active_cred" +.Fa "struct thread *td" +.Fc .Ft int .Fo soreceive .Fa "struct socket *so" "struct sockaddr **psa" "struct uio *uio" .Fa "struct mbuf **mp0" "struct mbuf **controlp" "int *flagsp" .Fc .Ft int -.Fn sosetopt "struct socket *so" "struct sockopt *sopt" +.Fo soreceive_stream +.Fa "struct socket *so" "struct sockaddr **paddr" +.Fa "struct uio *uio" "struct mbuf **mp0" "struct mbuf **controlp" +.Fa "int *flagsp" +.Fc +.Ft int +.Fo soreceive_dgram +.Fa "struct socket *so" "struct sockaddr **paddr" +.Fa "struct uio *uio" "struct mbuf **mp0" "struct mbuf **controlp" +.Fa "int *flagsp" +.Fc +.Ft int +.Fo soreceive_generic +.Fa "struct socket *so" "struct sockaddr **paddr" +.Fa "struct uio *uio" "struct mbuf **mp0" "struct mbuf **controlp" +.Fa "int *flagsp" +.Fc +.Ft int +.Fn soreserve "struct socket *so" "u_long sndcc" "u_long rcvcc" +.Ft void +.Fn sorflush "struct socket *so" .Ft int .Fo sosend .Fa "struct socket *so" "struct sockaddr *addr" "struct uio *uio" .Fa "struct mbuf *top" "struct mbuf *control" "int flags" "struct thread *td" .Fc .Ft int +.Fo sosend_dgram +.Fa "struct socket *so" "struct sockaddr *addr" +.Fa "struct uio *uio" "struct mbuf *top" "struct mbuf *control" +.Fa "int flags" "struct thread *td" +.Fc +.Ft int +.Fo sosend_generic +.Fa "struct socket *so" "struct sockaddr *addr" +.Fa "struct uio *uio" "struct mbuf *top" "struct mbuf *control" +.Fa "int flags" "struct thread *td" +.Fc +.Ft int .Fn soshutdown "struct socket *so" "int how" +.Ft void +.Fn sotoxsocket "struct socket *so" "struct xsocket *xso" +.Ft void +.Fn soupcall_clear "struct socket *so" "int which" +.Ft void +.Fo soupcall_set +.Fa "struct socket *so" "int which" +.Fa "int (*func)(struct socket *, void *, int)" "void *arg" +.Fc +.Ft void +.Fn sowakeup "struct socket *so" "struct sockbuf *sb" +.In sys/sockopt.h +.Ft int +.Fn sosetopt "struct socket *so" "struct sockopt *sopt" +.Ft int +.Fn sogetopt "struct socket *so" "struct sockopt *sopt" +.Ft int +.Fn sooptcopyin "struct sockopt *sopt" "void *buf" "size_t len" "size_t minlen" +.Ft int +.Fn sooptcopyout "struct sockopt *sopt" "const void *buf" "size_t len" .Sh DESCRIPTION The kernel .Nm @@ -75,6 +158,11 @@ While the user API operates on file descriptors, the kernel interfaces operate directly on .Vt "struct socket" pointers. +Some portions of the kernel API exist only to implement the user API, +and are not expected to be used by kernel code. +The portions of the socket API used by socket consumers and +implementations of network protocols will differ; some routines +are only useful for protocol implementors. .Pp Except where otherwise indicated, .Nm @@ -107,6 +195,31 @@ Sockets may be closed and freed using .Fn soclose , which has similar semantics to .Xr close 2 . +.Pp +In certain circumstances, it is appropriate to destroy a socket without +waiting for it to disconnect, for which +.Fn soabort +is used. +This is only appropriate for incoming connections which are in a +partially connected state. +It must be called on an unreferenced socket, by the thread which +removed the socket from its listen queue, to prevent races. +It will call into protocol code, so no socket locks may be held +over the call. +The caller of +.Fn soabort +is responsible for setting the VNET context. +The normal path to freeing a socket is +.Fn sofree , +which handles reference counting on the socket. +It should be called whenever a reference is released, and also whenever +reference flags are cleared in socket or protocol code. +Calls to +.Fn sofree +should not be made from outside the socket layer; outside callers +should use +.Fn soclose +instead. .Ss Connections and Addresses The .Fn sobind @@ -146,12 +259,19 @@ fails, the caller must manually clear the .Dv SS_ISCONNECTING flag. .Pp +A call to +.Fn sodisconnect +disconnects the socket without closing it. +.Pp The .Fn soshutdown function is equivalent to the .Xr shutdown 2 system call, and causes part or all of a connection on a socket to be closed down. +.Pp +Sockets are transitioned from non-listening status to listening with +.Fn solisten . .Ss Socket Options The .Fn sogetopt @@ -195,6 +315,60 @@ Kernel space pointer to the argument value for the socket option. .It Va sopt_valsize Size of the argument value in bytes. .El +.Ss Socket Upcalls +In order for the owner of a socket to be notified when the socket +is ready to send or receive data, an upcall may be registered on +the socket. +The upcall is a function that will be called by the socket framework +when a socket buffer associated with the given socket is ready for +reading or writing. +.Fn soupcall_set +is used to register a socket upcall. +The function +.Va func +is registered, and the pointer +.Va arg +will be passed as its second argument when it is called by the framework. +The possible values for +.Va which +are +.Dv SO_RCV +and +.Dv SO_SND , +which register upcalls for receive and send events, respectively. +The upcall function +.Fn func +must return either +.Dv SU_OK +or +.Dv SU_ISCONNECTED , +depending on whether or not a call to +.Xr soisconnected +should be made by the socket framework after the upcall returns. +The upcall +.Va func +cannot call +.Xr soisconnected +itself due to lock ordering with the socket buffer lock. +Only +.Dv SO_RCV +upcalls should return +.Dv SU_ISCONNECTED . +When a +.Dv SO_RCV +upcall returns +.Dv SU_ISCONNECTED , +the upcall will be removed from the socket. +.Pp +Upcalls are removed from their socket by +.Fn soupcall_clear . +The +.Va which +argument again specifies whether the sending or receiving upcall is to +be cleared, with +.Dv SO_RCV +or +.Dv SO_SND . .Ss Socket I/O The .Fn soreceive @@ -217,7 +391,7 @@ If is .Pf non- Dv NULL , only the -.Pf uio_resid +.Fa uio_resid of .Fa uio is used. @@ -281,6 +455,121 @@ context, or with a mutex held, will wish to use non-blocking sockets and pass the .Dv MSG_DONTWAIT flag in order to prevent these functions from sleeping. +.Pp +A socket can be queried for readability, writability, out-of-band data, +or end-of-file using +.Fn sopoll . +The possible values for +.Va events +are as for +.Xr poll 2 , +with symbolic values +.Dv POLLIN , +.Dv POLLPRI , +.Dv POLLOUT , +.Dv POLLRDNORM , +.Dv POLLWRNORM , +.Dv POLLRDBAND , +and +.Dv POLLINGEOF +taken from +.In sys/poll.h . +.Pp +Calls to +.Fn soaccept +pass through to the protocol's accept routine to accept an incoming connection. +.Ss Socket Utility Functions +The uid of a socket's credential may be compared against a +.Va uid +with +.Fn socheckuid . +.Pp +A copy of an existing +.Vt struct sockaddr +may be made using +.Fn sodupsockaddr . +.Pp +Protocol implementations notify the socket layer of the arrival of +out-of-band data using +.Fn sohasoutofband , +so that the socket layer can notify socket consumers of the available data. +.Pp +An +.Dq external-format +version of a +.Vt struct socket +can be created using +.Fn sotoxsocket , +suitable for isolating user code from changes in the kernel structure. +.Ss Protocol Implementations +Protocols must supply an implementation for +.Fn solisten ; +such protocol implementations can call back into the socket layer using +.Fn solisten_proto_check +and +.Fn solisten_proto +to check and set the socket-layer listen state. +These callbacks are provided so that the protocol implementation +can order the socket layer and protocol locks as necessary. +Protocols must supply an implementation of +.Fn soreceive ; +the functions +.Fn soreceive_stream , +.Fn soreceive_dgram , +and +.Fn soreceive_generic +are supplied for use by such implementations. +.Pp +Protocol implementations can use +.Fn sonewconn +to create a socket and attach protocol state to that socket. +This can be used to create new sockets available for +.Fn soaccept +on a listen socket. +The returned socket has a reference count of zero. +.Pp +Protocols must supply an implementation for +.Fn sopoll ; +.Fn sopoll_generic +is provided for the use by protocol implementations. +.Pp +The functions +.Fn sosend_dgram +and +.Fn sosend_generic +are supplied to assist in protocol implementations of +.Fn sosend . +.Pp +When a protocol creates a new socket structure, it is necessary to +reserve socket buffer space for that socket, by calling +.Fn soreserve . +The rough inverse of this reservation is performed by +.Fn sorflush , +which is called automatically by the socket framework. +.Pp +When a protocol needs to wake up threads waiting for the socket to +become ready to read or write, variants of +.Fn sowakeup +are used. +The +.Fn sowakeup +function should not be called directly by protocol code, instead use the +wrappers +.Fn sorwakeup , +.Fn sorwakeup_locked , +.Fn sowwakeup , +and +.Fn sowwakeup_locked +for readers and writers, with the corresponding socket buffer lock +not already locked, or already held, respectively. +.Pp +The functions +.Fn sooptcopyin +and +.Fn sooptcopyout +are useful for transferring +.Vt struct sockopt +data between user and kernel code. .Sh SEE ALSO .Xr bind 2 , .Xr close 2 , @@ -304,7 +593,9 @@ This manual page was introduced in .Fx 7.0 . .Sh AUTHORS This manual page was written by -.An Robert Watson . +.An Robert Watson +and +.An Benjamin Kaduk . .Sh BUGS The use of explicitly passed credentials, credentials hung from explicitly passed threads, the credential on diff --git a/share/man/man9/sysctl_add_oid.9 b/share/man/man9/sysctl_add_oid.9 index bffc6dbb412..5f67552b01b 100644 --- a/share/man/man9/sysctl_add_oid.9 +++ b/share/man/man9/sysctl_add_oid.9 @@ -527,7 +527,7 @@ newtree.newint These functions first appeared in .Fx 4.2 . .Sh AUTHORS -.An Andrzej Bialecki Aq abial@FreeBSD.org +.An Andrzej Bialecki Aq Mt abial@FreeBSD.org .Sh BUGS Sharing nodes between many code sections causes interdependencies that sometimes may lock the resources. diff --git a/share/man/man9/sysctl_ctx_init.9 b/share/man/man9/sysctl_ctx_init.9 index cbca5c61932..b3c0d3b6f01 100644 --- a/share/man/man9/sysctl_ctx_init.9 +++ b/share/man/man9/sysctl_ctx_init.9 @@ -233,7 +233,7 @@ and then proceeds to free the older entries (in this case the nodes). These functions first appeared in .Fx 4.2 . .Sh AUTHORS -.An Andrzej Bialecki Aq abial@FreeBSD.org +.An Andrzej Bialecki Aq Mt abial@FreeBSD.org .Sh BUGS The current removal algorithm is somewhat heavy. In the worst case, diff --git a/share/man/man9/taskqueue.9 b/share/man/man9/taskqueue.9 index 910b33eee0f..662a9d58809 100644 --- a/share/man/man9/taskqueue.9 +++ b/share/man/man9/taskqueue.9 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 24, 2014 +.Dd May 24, 2014 .Dt TASKQUEUE 9 .Os .Sh NAME @@ -68,6 +68,11 @@ struct timeout_task; .Fn taskqueue_create_fast "const char *name" "int mflags" "taskqueue_enqueue_fn enqueue" "void *context" .Ft int .Fn taskqueue_start_threads "struct taskqueue **tqp" "int count" "int pri" "const char *name" "..." +.Ft int +.Fo taskqueue_start_threads_pinned +.Fa "struct taskqueue **tqp" "int count" "int pri" "int cpu_id" +.Fa "const char *name" "..." +.Fc .Ft void .Fn taskqueue_set_callback "struct taskqueue *queue" "enum taskqueue_callback_type cb_type" "taskqueue_callback_fn callback" "void *context" .Ft void @@ -145,7 +150,14 @@ Any tasks that are on the queue will be executed at this time after which the thread servicing the queue will be signaled that it should exit. .Pp Once a taskqueue has been created, its threads should be started using -.Fn taskqueue_start_threads . +.Fn taskqueue_start_threads +or +.Fn taskqueue_start_threads_pinned . +.Fn taskqueue_start_threads_pinned +takes a +.Va cpu_id +argument which will cause the threads which are started for the taskqueue +to be pinned to run on the given CPU. Callbacks may optionally be registered using .Fn taskqueue_set_callback . Currently, callbacks may be registered for the following purposes: diff --git a/share/man/man9/timeout.9 b/share/man/man9/timeout.9 index 178250caefc..7d97db6075b 100644 --- a/share/man/man9/timeout.9 +++ b/share/man/man9/timeout.9 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 23, 2013 +.Dd July 17, 2014 .Dt TIMEOUT 9 .Os .Sh NAME @@ -371,6 +371,10 @@ Specifies relative event time precision as binary logarithm of time interval divided by acceptable time deviation: 1 -- 1/2, 2 -- 1/4, etc. Smaller value allows to aggregate more events in one timer interrupt to reduce processing overhead and power consumption. +.It Dv C_HARDCLOCK +Align the timeouts, if possible, to +.Fn hardclock +calls. .El .Pp The functions diff --git a/share/man/man9/tvtohz.9 b/share/man/man9/tvtohz.9 index 672aaf9dbbe..cf07d603a79 100644 --- a/share/man/man9/tvtohz.9 +++ b/share/man/man9/tvtohz.9 @@ -55,4 +55,4 @@ function first appeared in .Fx 3.0 .Sh AUTHORS This manual page was written by -.An Kelly Yancey Aq kbyanc@posi.net . +.An Kelly Yancey Aq Mt kbyanc@posi.net . diff --git a/share/man/man9/ucred.9 b/share/man/man9/ucred.9 index a44e0d77d78..e8b26d653fb 100644 --- a/share/man/man9/ucred.9 +++ b/share/man/man9/ucred.9 @@ -233,4 +233,4 @@ accepts a target process, not a target thread, for access control purposes. .Xr uihold 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/uidinfo.9 b/share/man/man9/uidinfo.9 index 8a3d708bc46..4dc93d2bfed 100644 --- a/share/man/man9/uidinfo.9 +++ b/share/man/man9/uidinfo.9 @@ -106,4 +106,4 @@ returns a pointer to an initialized structure, and should not fail. .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/usbdi.9 b/share/man/man9/usbdi.9 index 03cc3057b82..283cda05d7e 100644 --- a/share/man/man9/usbdi.9 +++ b/share/man/man9/usbdi.9 @@ -507,7 +507,7 @@ This flag causes a failing USB transfer to remain first in the PIPE queue except in the case of "xfer->error" equal to "USB_ERR_CANCELLED". No other USB transfers in the affected PIPE queue will be started until either: -.Bl -tag -width "1" +.Bl -tag -width "X" .It 1 The failing USB transfer is stopped using "usbd_transfer_stop()". .It 2 @@ -638,4 +638,4 @@ module has been inspired by the NetBSD USB stack initially written by Lennart Augustsson. The .Nm usb module was written by -.An Hans Petter Selasky Aq hselasky@FreeBSD.org . +.An Hans Petter Selasky Aq Mt hselasky@FreeBSD.org . diff --git a/share/man/man9/utopia.9 b/share/man/man9/utopia.9 index a7d02c19bee..99be5fa809b 100644 --- a/share/man/man9/utopia.9 +++ b/share/man/man9/utopia.9 @@ -350,4 +350,4 @@ Update the statistics with counters read from the chip. .Sh SEE ALSO .Xr utopia 4 .Sh AUTHORS -.An Harti Brandt Aq harti@FreeBSD.org +.An Harti Brandt Aq Mt harti@FreeBSD.org diff --git a/share/man/man9/vaccess_acl_nfs4.9 b/share/man/man9/vaccess_acl_nfs4.9 index 27b4cfa644b..c7293619a34 100644 --- a/share/man/man9/vaccess_acl_nfs4.9 +++ b/share/man/man9/vaccess_acl_nfs4.9 @@ -123,7 +123,7 @@ appropriate privileges or to the owner of a file or other resource. Current implementation of .Fn vaccess_acl_nfs4 was written by -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org . +.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org . .Sh BUGS This manual page should include a full description of the NFSv4 ACL evaluation algorithm, or cross reference another page that does. diff --git a/share/man/man9/vflush.9 b/share/man/man9/vflush.9 index 94485f92579..280088f9926 100644 --- a/share/man/man9/vflush.9 +++ b/share/man/man9/vflush.9 @@ -78,4 +78,4 @@ will be returned. .Xr vrele 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vfs_busy.9 b/share/man/man9/vfs_busy.9 index 30fe79bf122..8b9ba86d2ba 100644 --- a/share/man/man9/vfs_busy.9 +++ b/share/man/man9/vfs_busy.9 @@ -88,4 +88,4 @@ is set). .Xr vfs_unbusy 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vfs_getnewfsid.9 b/share/man/man9/vfs_getnewfsid.9 index b6f12382fe1..f43800c41a5 100644 --- a/share/man/man9/vfs_getnewfsid.9 +++ b/share/man/man9/vfs_getnewfsid.9 @@ -74,4 +74,4 @@ xxx_mount(struct mount *mp, char *path, caddr_t data, .Xr vfs_getvfs 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vfs_getopt.9 b/share/man/man9/vfs_getopt.9 index 09db47c7929..1675fef8f6e 100644 --- a/share/man/man9/vfs_getopt.9 +++ b/share/man/man9/vfs_getopt.9 @@ -240,6 +240,6 @@ if the option was not found. .Sh AUTHORS .An -nosplit This manual page was written by -.An Chad David Aq davidc@FreeBSD.org +.An Chad David Aq Mt davidc@FreeBSD.org and -.An Ruslan Ermilov Aq ru@FreeBSD.org . +.An Ruslan Ermilov Aq Mt ru@FreeBSD.org . diff --git a/share/man/man9/vfs_getvfs.9 b/share/man/man9/vfs_getvfs.9 index c563adcddca..93df89f7070 100644 --- a/share/man/man9/vfs_getvfs.9 +++ b/share/man/man9/vfs_getvfs.9 @@ -74,4 +74,4 @@ if ((mp = vfs_getvfs(&fhp->fh_fsid)) == NULL) { .Xr vfs_getnewfsid 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vfs_mountedfrom.9 b/share/man/man9/vfs_mountedfrom.9 index 10ad32816f7..d0d7542630f 100644 --- a/share/man/man9/vfs_mountedfrom.9 +++ b/share/man/man9/vfs_mountedfrom.9 @@ -52,4 +52,4 @@ is the device that contains the file system, but in the case of a pseudo file system it could be a descriptive name like "devfs" or "procfs". .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vfs_rootmountalloc.9 b/share/man/man9/vfs_rootmountalloc.9 index ecad73e3af2..6453849f1e9 100644 --- a/share/man/man9/vfs_rootmountalloc.9 +++ b/share/man/man9/vfs_rootmountalloc.9 @@ -63,4 +63,4 @@ or invalid. .Xr vfsconf 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vfs_timestamp.9 b/share/man/man9/vfs_timestamp.9 index 455d6f6ba42..0103779402c 100644 --- a/share/man/man9/vfs_timestamp.9 +++ b/share/man/man9/vfs_timestamp.9 @@ -60,4 +60,4 @@ seconds and nanoseconds, maximum precision. .El .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vfs_unbusy.9 b/share/man/man9/vfs_unbusy.9 index 5d0b4e5d780..13cea5eba67 100644 --- a/share/man/man9/vfs_unbusy.9 +++ b/share/man/man9/vfs_unbusy.9 @@ -55,4 +55,4 @@ The mount point to unbusy. .Xr vfs_busy 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vfsconf.9 b/share/man/man9/vfsconf.9 index 83a66210e22..7e129c07ff0 100644 --- a/share/man/man9/vfsconf.9 +++ b/share/man/man9/vfsconf.9 @@ -148,4 +148,4 @@ whatever the case. .Xr VFS_SET 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vgone.9 b/share/man/man9/vgone.9 index 12715e133dd..dc10cda76e7 100644 --- a/share/man/man9/vgone.9 +++ b/share/man/man9/vgone.9 @@ -60,4 +60,4 @@ exclusively locked. .Xr vnode 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vhold.9 b/share/man/man9/vhold.9 index cb1f35d1df3..503ce29c564 100644 --- a/share/man/man9/vhold.9 +++ b/share/man/man9/vhold.9 @@ -80,4 +80,4 @@ expect the interlock to already be held. .Xr vnode 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vinvalbuf.9 b/share/man/man9/vinvalbuf.9 index f3e627a8f3d..260eb6f39b3 100644 --- a/share/man/man9/vinvalbuf.9 +++ b/share/man/man9/vinvalbuf.9 @@ -114,4 +114,4 @@ set in .Xr VOP_FSYNC 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vm_fault_prefault.9 b/share/man/man9/vm_fault_prefault.9 index dcc7e7abfa3..39138e88a1a 100644 --- a/share/man/man9/vm_fault_prefault.9 +++ b/share/man/man9/vm_fault_prefault.9 @@ -69,4 +69,4 @@ helper function to determine if a page may be prefaulted into physical memory. .Xr pmap_is_prefaultable 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/vm_map.9 b/share/man/man9/vm_map.9 index f45be0b055e..a5ba60a189e 100644 --- a/share/man/man9/vm_map.9 +++ b/share/man/man9/vm_map.9 @@ -347,4 +347,4 @@ is backed by a .Xr vm_map_wire 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/vm_map_check_protection.9 b/share/man/man9/vm_map_check_protection.9 index abaf6d0301e..1d475249d0c 100644 --- a/share/man/man9/vm_map_check_protection.9 +++ b/share/man/man9/vm_map_check_protection.9 @@ -67,4 +67,4 @@ or if any other error occurred, the value FALSE is returned. .Xr vm_map_protect 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/vm_map_create.9 b/share/man/man9/vm_map_create.9 index 0574f396f82..11ba8ac84d8 100644 --- a/share/man/man9/vm_map_create.9 +++ b/share/man/man9/vm_map_create.9 @@ -63,4 +63,4 @@ Otherwise, it returns .Xr vm_map_init 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/vm_map_delete.9 b/share/man/man9/vm_map_delete.9 index e884f366aaa..8eea565a04d 100644 --- a/share/man/man9/vm_map_delete.9 +++ b/share/man/man9/vm_map_delete.9 @@ -65,4 +65,4 @@ function always returns .Xr vm_map_remove 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/vm_map_entry_resize_free.9 b/share/man/man9/vm_map_entry_resize_free.9 index eaaec650fb6..9e70a8d757b 100644 --- a/share/man/man9/vm_map_entry_resize_free.9 +++ b/share/man/man9/vm_map_entry_resize_free.9 @@ -240,5 +240,4 @@ tree-based free space algorithm was added in .Fx 5.3 . .Sh AUTHORS The tree-based free space algorithm and this manual page were written by -.An Mark W. Krentel -.Aq krentel@dreamscape.com . +.An Mark W. Krentel Aq Mt krentel@dreamscape.com . diff --git a/share/man/man9/vm_map_find.9 b/share/man/man9/vm_map_find.9 index 106854eca75..031be99b767 100644 --- a/share/man/man9/vm_map_find.9 +++ b/share/man/man9/vm_map_find.9 @@ -158,4 +158,4 @@ will be returned. .Xr vm_map_lock 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/vm_map_findspace.9 b/share/man/man9/vm_map_findspace.9 index a12e7896157..29d465bd358 100644 --- a/share/man/man9/vm_map_findspace.9 +++ b/share/man/man9/vm_map_findspace.9 @@ -75,4 +75,4 @@ otherwise, the value 1 is returned. .Xr vm_map_lock 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/vm_map_inherit.9 b/share/man/man9/vm_map_inherit.9 index fb5a9d5ff37..f8416c722cd 100644 --- a/share/man/man9/vm_map_inherit.9 +++ b/share/man/man9/vm_map_inherit.9 @@ -82,4 +82,4 @@ will be returned. .Xr fork 2 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/vm_map_init.9 b/share/man/man9/vm_map_init.9 index c65f611fbb8..25b8aeb39f2 100644 --- a/share/man/man9/vm_map_init.9 +++ b/share/man/man9/vm_map_init.9 @@ -56,4 +56,4 @@ It is called during early system initialization. .Xr vm_map 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/vm_map_insert.9 b/share/man/man9/vm_map_insert.9 index 8f3b52e78c9..20e062b446a 100644 --- a/share/man/man9/vm_map_insert.9 +++ b/share/man/man9/vm_map_insert.9 @@ -90,4 +90,4 @@ overlaps the end of the map. .Xr vm_map 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/vm_map_lock.9 b/share/man/man9/vm_map_lock.9 index 70957092660..0f26412871f 100644 --- a/share/man/man9/vm_map_lock.9 +++ b/share/man/man9/vm_map_lock.9 @@ -110,4 +110,4 @@ Currently, all of the locking macros implement their locks as sleep locks. .Xr vm_map 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/vm_map_lookup.9 b/share/man/man9/vm_map_lookup.9 index 759b5f6673f..a28613fafdf 100644 --- a/share/man/man9/vm_map_lookup.9 +++ b/share/man/man9/vm_map_lookup.9 @@ -85,4 +85,4 @@ arguments appropriately for the hypothetical page fault. .Xr vm_map 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/vm_map_madvise.9 b/share/man/man9/vm_map_madvise.9 index 97ba6040de8..dc283ebbb8b 100644 --- a/share/man/man9/vm_map_madvise.9 +++ b/share/man/man9/vm_map_madvise.9 @@ -74,4 +74,4 @@ is returned. .Xr vm_map 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/vm_map_max.9 b/share/man/man9/vm_map_max.9 index e694983ba6a..92d574dbeed 100644 --- a/share/man/man9/vm_map_max.9 +++ b/share/man/man9/vm_map_max.9 @@ -63,4 +63,4 @@ returns a pointer to the physical map associated with the virtual map .Xr vm_map 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/vm_map_protect.9 b/share/man/man9/vm_map_protect.9 index 8976781297e..c4b5a738abe 100644 --- a/share/man/man9/vm_map_protect.9 +++ b/share/man/man9/vm_map_protect.9 @@ -90,4 +90,4 @@ is returned. .Xr vm_map 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/vm_map_remove.9 b/share/man/man9/vm_map_remove.9 index 53da53349bb..79c67822817 100644 --- a/share/man/man9/vm_map_remove.9 +++ b/share/man/man9/vm_map_remove.9 @@ -66,4 +66,4 @@ always returns .Xr vm_map_delete 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/vm_map_simplify_entry.9 b/share/man/man9/vm_map_simplify_entry.9 index 8bb5484b4cb..3c7a1f87df3 100644 --- a/share/man/man9/vm_map_simplify_entry.9 +++ b/share/man/man9/vm_map_simplify_entry.9 @@ -58,4 +58,4 @@ possibly extended. .Xr vm_map_remove 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/vm_map_stack.9 b/share/man/man9/vm_map_stack.9 index e237c063d59..4036efb4f04 100644 --- a/share/man/man9/vm_map_stack.9 +++ b/share/man/man9/vm_map_stack.9 @@ -129,4 +129,4 @@ function previously located in the file .Xr vm_map_insert 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/vm_map_submap.9 b/share/man/man9/vm_map_submap.9 index 704151aa5fc..6f29d6b90b3 100644 --- a/share/man/man9/vm_map_submap.9 +++ b/share/man/man9/vm_map_submap.9 @@ -92,4 +92,4 @@ backing object was specified. .Xr vm_map_find 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/vm_map_sync.9 b/share/man/man9/vm_map_sync.9 index 0ee12193d12..dd487df273c 100644 --- a/share/man/man9/vm_map_sync.9 +++ b/share/man/man9/vm_map_sync.9 @@ -78,4 +78,4 @@ or if an entry could not be found for the given start address. .Xr vm_map 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/vm_map_wire.9 b/share/man/man9/vm_map_wire.9 index 12bb3f675ae..f112f344e6b 100644 --- a/share/man/man9/vm_map_wire.9 +++ b/share/man/man9/vm_map_wire.9 @@ -111,4 +111,4 @@ is returned. .Xr vm_map 9 .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@spc.org . +.An Bruce M Simpson Aq Mt bms@spc.org . diff --git a/share/man/man9/vm_page_aflag.9 b/share/man/man9/vm_page_aflag.9 index 4500bd2d69c..0d0bdeb5508 100644 --- a/share/man/man9/vm_page_aflag.9 +++ b/share/man/man9/vm_page_aflag.9 @@ -97,4 +97,4 @@ and bits are only valid for the managed pages. .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vm_page_alloc.9 b/share/man/man9/vm_page_alloc.9 index 3109a3fae49..082574f4d15 100644 --- a/share/man/man9/vm_page_alloc.9 +++ b/share/man/man9/vm_page_alloc.9 @@ -136,4 +136,4 @@ unless is set. .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vm_page_bits.9 b/share/man/man9/vm_page_bits.9 index 79d568552cc..43b54dcf93b 100644 --- a/share/man/man9/vm_page_bits.9 +++ b/share/man/man9/vm_page_bits.9 @@ -164,4 +164,4 @@ clears all of the dirty bits in a page. None of these functions are allowed to block. .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vm_page_cache.9 b/share/man/man9/vm_page_cache.9 index 0379e8c7a9c..58bf43c992a 100644 --- a/share/man/man9/vm_page_cache.9 +++ b/share/man/man9/vm_page_cache.9 @@ -48,4 +48,4 @@ to the cache queue will fail. If the page is dirty the system will panic. .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vm_page_deactivate.9 b/share/man/man9/vm_page_deactivate.9 index 30bb7fa11ac..fff5ea9b549 100644 --- a/share/man/man9/vm_page_deactivate.9 +++ b/share/man/man9/vm_page_deactivate.9 @@ -47,4 +47,4 @@ unmanaged and is not wired. .Xr vm_page_wire 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vm_page_dontneed.9 b/share/man/man9/vm_page_dontneed.9 index 99baa330816..b30df14c701 100644 --- a/share/man/man9/vm_page_dontneed.9 +++ b/share/man/man9/vm_page_dontneed.9 @@ -56,4 +56,4 @@ ones from the queues as their pages are released. .Xr vm_page_deactivate 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vm_page_free.9 b/share/man/man9/vm_page_free.9 index a78e577adbd..7df970cf6da 100644 --- a/share/man/man9/vm_page_free.9 +++ b/share/man/man9/vm_page_free.9 @@ -95,4 +95,4 @@ returns 1 if it is able to free the page; otherwise, 0 is returned. .Xr vm_page_wire 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vm_page_grab.9 b/share/man/man9/vm_page_grab.9 index ff9aae902de..d19289ae945 100644 --- a/share/man/man9/vm_page_grab.9 +++ b/share/man/man9/vm_page_grab.9 @@ -81,4 +81,4 @@ always returns the page. .Xr vm_page_alloc 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vm_page_hold.9 b/share/man/man9/vm_page_hold.9 index 183fa4020d5..971d6c2d5da 100644 --- a/share/man/man9/vm_page_hold.9 +++ b/share/man/man9/vm_page_hold.9 @@ -72,4 +72,4 @@ page daemon. .Xr vm_page_wire 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vm_page_insert.9 b/share/man/man9/vm_page_insert.9 index 53f1eba8293..ce2c6ae9196 100644 --- a/share/man/man9/vm_page_insert.9 +++ b/share/man/man9/vm_page_insert.9 @@ -93,4 +93,4 @@ For example, if the page size is 4096 bytes, and the address in the object is 81944, the page index is 20. .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vm_page_lookup.9 b/share/man/man9/vm_page_lookup.9 index 7f8cd5e1dd7..a268617e358 100644 --- a/share/man/man9/vm_page_lookup.9 +++ b/share/man/man9/vm_page_lookup.9 @@ -60,4 +60,4 @@ is returned if successful; otherwise, is returned. .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vm_page_rename.9 b/share/man/man9/vm_page_rename.9 index bb8591fae3a..64f6409b186 100644 --- a/share/man/man9/vm_page_rename.9 +++ b/share/man/man9/vm_page_rename.9 @@ -69,4 +69,4 @@ at which the new page should be inserted. .El .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vm_page_wire.9 b/share/man/man9/vm_page_wire.9 index f988dd96e46..4722f71bdc6 100644 --- a/share/man/man9/vm_page_wire.9 +++ b/share/man/man9/vm_page_wire.9 @@ -64,4 +64,4 @@ is set) then the page is left on .Dv PQ_NONE . .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vm_set_page_size.9 b/share/man/man9/vm_set_page_size.9 index 7f211d1bffc..09afaba8341 100644 --- a/share/man/man9/vm_set_page_size.9 +++ b/share/man/man9/vm_set_page_size.9 @@ -59,4 +59,4 @@ is not a power of two, the system will panic. must be called prior to any page size dependent functions. .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/vn_fullpath.9 b/share/man/man9/vn_fullpath.9 index eff2105f83a..50c35c979f8 100644 --- a/share/man/man9/vn_fullpath.9 +++ b/share/man/man9/vn_fullpath.9 @@ -122,4 +122,4 @@ otherwise, an error number is returned. .Xr free 9 .Sh AUTHORS This manual page was written by -.An Robert Watson Aq rwatson@FreeBSD.org . +.An Robert Watson Aq Mt rwatson@FreeBSD.org . diff --git a/share/man/man9/vn_isdisk.9 b/share/man/man9/vn_isdisk.9 index 59096347526..76cdf96810c 100644 --- a/share/man/man9/vn_isdisk.9 +++ b/share/man/man9/vn_isdisk.9 @@ -70,4 +70,4 @@ is returned and will contain the error number. .Sh AUTHORS This manual page was written by -.An Chad David Aq davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca . diff --git a/share/man/man9/watchdog.9 b/share/man/man9/watchdog.9 index 2df9fd6e450..e43e739016f 100644 --- a/share/man/man9/watchdog.9 +++ b/share/man/man9/watchdog.9 @@ -78,4 +78,4 @@ behaviour is recommended. The .Nm facility and this manual page was written -.An Poul-Henning Kamp Aq phk@FreeBSD.org . +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . diff --git a/share/man/man9/zero_copy.9 b/share/man/man9/zero_copy.9 deleted file mode 100644 index 27498ffcaa3..00000000000 --- a/share/man/man9/zero_copy.9 +++ /dev/null @@ -1,171 +0,0 @@ -.\" -.\" Copyright (c) 2002 Kenneth D. Merry. -.\" 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, -.\" without modification, immediately at the beginning of the file. -.\" 2. The name of the author may not be used to endorse or promote products -.\" derived from this software without specific prior written permission. -.\" -.\" 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 October 23, 2012 -.Dt ZERO_COPY 9 -.Os -.Sh NAME -.Nm zero_copy , -.Nm zero_copy_sockets -.Nd "zero copy sockets code" -.Sh SYNOPSIS -.Cd "options SOCKET_SEND_COW" -.Cd "options SOCKET_RECV_PFLIP" -.Sh DESCRIPTION -The -.Fx -kernel includes a facility for eliminating data copies on -socket reads and writes. -.Pp -This code is collectively known as the zero copy sockets code, because during -normal network I/O, data will not be copied by the CPU at all. -Rather it -will be DMAed from the user's buffer to the NIC (for sends), or DMAed from -the NIC to a buffer that will then be given to the user (receives). -.Pp -The zero copy sockets code uses the standard socket read and write -semantics, and therefore has some limitations and restrictions that -programmers should be aware of when trying to take advantage of this -functionality. -.Pp -For sending data, there are no special requirements or capabilities that -the sending NIC must have. -The data written to the socket, though, must be -at least a page in size and page aligned in order to be mapped into the -kernel. -If it does not meet the page size and alignment constraints, it -will be copied into the kernel, as is normally the case with socket I/O. -.Pp -The user should be careful not to overwrite buffers that have been written -to the socket before the data has been freed by the kernel, and the -copy-on-write mapping cleared. -If a buffer is overwritten before it has -been given up by the kernel, the data will be copied, and no savings in CPU -utilization and memory bandwidth utilization will be realized. -.Pp -The -.Xr socket 2 -API does not really give the user any indication of when his data has -actually been sent over the wire, or when the data has been freed from -kernel buffers. -For protocols like TCP, the data will be kept around in -the kernel until it has been acknowledged by the other side; it must be -kept until the acknowledgement is received in case retransmission is required. -.Pp -From an application standpoint, the best way to guarantee that the data has -been sent out over the wire and freed by the kernel (for TCP-based sockets) -is to set a socket buffer size (see the -.Dv SO_SNDBUF -socket option in the -.Xr setsockopt 2 -manual page) appropriate for the application and network environment and then -make sure you have sent out twice as much data as the socket buffer size -before reusing a buffer. -For TCP, the send and receive socket buffer sizes -generally directly correspond to the TCP window size. -.Pp -For receiving data, in order to take advantage of the zero copy receive -code, the user must have a NIC that is configured for an MTU greater than -the architecture page size. -(E.g., for i386 it would be 4KB.) -Additionally, in order for zero copy receive to work, -packet payloads must be at least a page in size and page aligned. -.Pp -Achieving page aligned payloads requires a NIC that can split an incoming -packet into multiple buffers. -It also generally requires some sort of -intelligence on the NIC to make sure that the payload starts in its own -buffer. -This is called -.Dq "header splitting" . -Currently the only NICs with -support for header splitting are Alteon Tigon 2 based boards running -slightly modified firmware. -The -.Fx -.Xr ti 4 -driver includes modified firmware for Tigon 2 boards only. -Header -splitting code can be written, however, for any NIC that allows putting -received packets into multiple buffers and that has enough programmability -to determine that the header should go into one buffer and the payload into -another. -.Pp -You can also do a form of header splitting that does not require any NIC -modifications if your NIC is at least capable of splitting packets into -multiple buffers. -This requires that you optimize the NIC driver for your -most common packet header size. -If that size (ethernet + IP + TCP headers) -is generally 66 bytes, for instance, you would set the first buffer in a -set for a particular packet to be 66 bytes long, and then subsequent -buffers would be a page in size. -For packets that have headers that are -exactly 66 bytes long, your payload will be page aligned. -.Pp -The other requirement for zero copy receive to work is that the buffer that -is the destination for the data read from a socket must be at least a page -in size and page aligned. -.Pp -Obviously the requirements for receive side zero copy are impossible to -meet without NIC hardware that is programmable enough to do header -splitting of some sort. -Since most NICs are not that programmable, or their -manufacturers will not share the source code to their firmware, this approach -to zero copy receive is not widely useful. -.Pp -There are other approaches, such as RDMA and TCP Offload, that may -potentially help alleviate the CPU overhead associated with copying data -out of the kernel. -Most known techniques require some sort of support at -the NIC level to work, and describing such techniques is beyond the scope -of this manual page. -.Pp -The zero copy send and zero copy receive code can be individually turned -off via the -.Va kern.ipc.zero_copy.send -and -.Va kern.ipc.zero_copy.receive -.Nm sysctl -variables respectively. -.Sh SEE ALSO -.Xr sendfile 2 , -.Xr socket 2 , -.Xr ti 4 -.Sh HISTORY -The zero copy sockets code first appeared in -.Fx 5.0 , -although it has -been in existence in patch form since at least mid-1999. -.Sh AUTHORS -.An -nosplit -The zero copy sockets code was originally written by -.An Andrew Gallatin Aq gallatin@FreeBSD.org -and substantially modified and updated by -.An Kenneth Merry Aq ken@FreeBSD.org . -.Sh BUGS -The COW based send mechanism is not safe and may result in kernel crashes. diff --git a/share/man/man9/zone.9 b/share/man/man9/zone.9 index d0af88ec268..ed5939b0f31 100644 --- a/share/man/man9/zone.9 +++ b/share/man/man9/zone.9 @@ -366,10 +366,10 @@ to function as a slab allocator. The zone allocator was written by .An John S. Dyson . The zone allocator was rewritten in large parts by -.An Jeff Roberson Aq jeff@FreeBSD.org +.An Jeff Roberson Aq Mt jeff@FreeBSD.org to function as a slab allocator. .Pp This manual page was written by -.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . +.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org . Changes for UMA by -.An Jeroen Ruigrok van der Werven Aq asmodai@FreeBSD.org . +.An Jeroen Ruigrok van der Werven Aq Mt asmodai@FreeBSD.org . diff --git a/share/misc/bsd-family-tree b/share/misc/bsd-family-tree index a1d3d12bfa9..930c91da4f4 100644 --- a/share/misc/bsd-family-tree +++ b/share/misc/bsd-family-tree @@ -296,14 +296,14 @@ FreeBSD 5.2 | | | | | | | | | | *--FreeBSD | | NetBSD 6.1.3 | | | 10.0 | | | | | - | | | NetBSD 6.1.4 | DragonFly 3.6.1 - | | | | | - | | | | | - | | | | DragonFly 3.6.2 - | | | | | - | | | | | - | | | | | + | | | | | DragonFly 3.6.1 + | | | | | | + | | | | | | + | | | | | DragonFly 3.6.2 + | | | NetBSD 6.1.4 | | | | | | | + | | | OpenBSD 5.5 | + | | | | DragonFly 3.8.0 | | | | | | | | | | | | | | | @@ -638,6 +638,8 @@ DragonFly 3.6.1 2014-02-22 [DFB] DragonFly 3.6.2 2014-04-10 [DFB] NetBSD 6.0.5 2014-04-19 [NDB] NetBSD 6.1.4 2014-04-19 [NDB] +OpenBSD 5.5 2014-05-01 [OBD] +DragonFly 3.8.0 2014-06-04 [DFB] Bibliography ------------------------ diff --git a/share/misc/committers-doc.dot b/share/misc/committers-doc.dot index 49b6e07482f..42ab60b1a7f 100644 --- a/share/misc/committers-doc.dot +++ b/share/misc/committers-doc.dot @@ -51,6 +51,7 @@ node [color=lightblue2, style=filled, bgcolor=black]; # Current doc committers go here. Try to keep things sorted. ale [label="Alex Dupre\nale@FreeBSD.org\n2003/12/22"] +allanjude [label="Allan Jude\nallanjude@FreeBSD.org\n2014/05/17"] bcr [label="Benedict Reuschling\nbcr@FreeBSD.org\n2009/12/24"] blackend [label="Marc Fonvieille\nblackend@FreeBSD.org\n2002/06/16"] brd [label="Brad Davis\nbrd@FreeBSD.org\n2005/06/01"] @@ -100,6 +101,7 @@ bcr -> eadler bcr -> dru bcr -> crees bcr -> jgh +bcr -> allanjude blackend -> ale @@ -116,6 +118,8 @@ den -> marck delphij -> chinsan delphij -> loader +eadler -> allanjude + gabor -> pgj gabor -> manolis gabor -> taras @@ -176,4 +180,5 @@ trhodes -> danger trhodes -> jcamou wblock -> jgh +wblock -> allanjude } diff --git a/share/misc/committers-ports.dot b/share/misc/committers-ports.dot index 778d86b8049..02c303ed979 100644 --- a/share/misc/committers-ports.dot +++ b/share/misc/committers-ports.dot @@ -183,6 +183,7 @@ rene [label="Rene Ladan\nrene@FreeBSD.org\n2010/04/11"] riggs [label="Thomas Zander\nriggs@FreeBSD.org\n2014/01/09"] rm [label="Ruslan Makhmatkhanov\nrm@FreeBSD.org\n2011/11/06"] rnoland [label="Robert Noland\nrnoland@FreeBSD.org\n2008/07/21"] +robak [label="Bartek Rutkowski\nrobak@FreeBSD.org\n2014/06/10"] rodrigo [label="Rodrigo Osorio\nrodrigo@FreeBSD.org\n2014/01/15"] romain [label="Romain Tartiere\nromain@FreeBSD.org\n2010/01/24"] sahil [label="Sahil Tandon\nsahil@FreeBSD.org\n2010/04/11"] @@ -416,6 +417,8 @@ marcus -> bland marcus -> eik marcus -> jmallett +marino -> robak + makc -> bf makc -> jhale makc -> rakuco @@ -524,6 +527,7 @@ steve -> netchild swills -> feld swills -> milki swills -> pclin +swills -> robak swills -> xmj tabthorpe -> ashish diff --git a/share/misc/committers-src.dot b/share/misc/committers-src.dot index 3ea6b0bedf0..891efa31d3a 100644 --- a/share/misc/committers-src.dot +++ b/share/misc/committers-src.dot @@ -241,6 +241,7 @@ philip [label="Philip Paeps\nphilip@FreeBSD.org\n2004/01/21"] phk [label="Poul-Henning Kamp\nphk@FreeBSD.org\n1994/02/21"] pho [label="Peter Holm\npho@FreeBSD.org\n2008/11/16"] pjd [label="Pawel Jakub Dawidek\npjd@FreeBSD.org\n2004/02/02"] +pkelsey [label="Patrick Kelsey\pkelsey@FreeBSD.org\n2014/05/29"] pluknet [label="Sergey Kandaurov\npluknet@FreeBSD.org\n2010/10/05"] ps [label="Paul Saab\nps@FreeBSD.org\n2000/02/23"] qingli [label="Qing Li\nqingli@FreeBSD.org\n2005/04/13"] @@ -270,6 +271,7 @@ sephe [label="Sepherosa Ziehau\nsephe@FreeBSD.org\n2007/03/28"] sepotvin [label="Stephane E. Potvin\nsepotvin@FreeBSD.org\n2007/02/15"] simon [label="Simon L. Nielsen\nsimon@FreeBSD.org\n2006/03/07"] sjg [label="Simon J. Gerraty\nsjg@FreeBSD.org\n2012/10/23"] +slm [label="Stephen McConnell\nslm@FreeBSD.org\n2014/05/07"] smh [label="Steven Hartland\nsmh@FreeBSD.org\n2012/11/12"] sobomax [label="Maxim Sobolev\nsobomax@FreeBSD.org\n2001/07/25"] sos [label="Soren Schmidt\nsos@FreeBSD.org\n????/??/??"] @@ -508,6 +510,8 @@ jkoshy -> rstone jlemon -> bmilekic jlemon -> brooks +jmallett -> pkelsey + joerg -> brian joerg -> eik joerg -> jmg @@ -525,6 +529,7 @@ julian -> mp kan -> kib ken -> asomers +ken -> slm kib -> ae kib -> dchagin @@ -664,6 +669,7 @@ scottl -> jimharris scottl -> pjd scottl -> sah scottl -> sbruno +scottl -> slm scottl -> yongari sheldonh -> dwmalone diff --git a/share/misc/organization.dot b/share/misc/organization.dot index 84b90141079..ece8a0d015e 100644 --- a/share/misc/organization.dot +++ b/share/misc/organization.dot @@ -25,13 +25,13 @@ _misc [label="Miscellaneous Hats"] # Development teams go here alphabetically sorted -core [label="Core Team\ncore@FreeBSD.org\ntabthorpe, gavin, jhb, kib,\ntheraven, hrs, peter, miwi"] -coresecretary [label="Core Team Secretary\ncore-secretary@FreeBSD.org\npgj"] +core [label="Core Team\ncore@FreeBSD.org\nbapt, emaste, gavin,\nglebius, gnn, hrs,\npeter, rwatson, theraven"] +coresecretary [label="Core Team Secretary\ncore-secretary@FreeBSD.org\nmatthew"] doccommitters [label="Doc/www Committers\ndoc-committers@FreeBSD.org"] doceng [label="Documentation Engineering Team\ndoceng@FreeBSD.org\ngjb, blackend,\ngabor, hrs"] portscommitters [label="Ports Committers\nports-committers@FreeBSD.org"] -portmgr [label="Port Management Team\nportmgr@FreeBSD.org\ntabthorpe, marcus, bapt,\nerwin, bdrewery,\nitetcu, miwi"] -portmgrsecretary [label="Port Management Team Secretary\nportmgr-secretary@FreeBSD.org\ntabthorpe"] +portmgr [label="Port Management Team\nportmgr@FreeBSD.org\nantoine, bapt, bdrewery,\ndecke, erwin, mat,\nmiwi, swills, tabthorpe"] +portmgrsecretary [label="Port Management Team Secretary\nportmgr-secretary@FreeBSD.org\nculot"] re [label="Primary Release Engineering Team\nre@FreeBSD.org\nkib, blackend, jpaetzel, hrs, kensmith"] secteam [label="Security Team\nsecteam@FreeBSD.org\nsimon, qingli, delphij,\nremko, philip, stas, cperciva,\ncsjp, rwatson, miwi, bz"] portssecteam [label="Ports Security Team\nports-secteam@FreeBSD.org\nmiwi, rea, swills, wxs,\njgh, sbz, eadler, zi, remko, simon"] diff --git a/share/mk/Makefile b/share/mk/Makefile index ca3d8b3cff7..cd69ca83f10 100644 --- a/share/mk/Makefile +++ b/share/mk/Makefile @@ -11,7 +11,6 @@ FILES= \ bsd.crunchgen.mk \ bsd.dep.mk \ bsd.doc.mk \ - bsd.dtrace.mk \ bsd.endian.mk \ bsd.files.mk \ bsd.incs.mk \ @@ -42,9 +41,7 @@ FILES= \ sys.mk \ version_gen.awk -# Installed for the moment, but not may not be in the future. -#FILES+= src.opts.mk - +NO_OBJ= FILESDIR= ${BINDIR}/mk .if ${MK_TESTS} != "no" @@ -54,6 +51,4 @@ FILES+= suite.test.mk FILES+= tap.test.mk .endif -UPDATE_DEPENDFILE= no - .include diff --git a/share/mk/atf.test.mk b/share/mk/atf.test.mk index 1be7244acfc..f7d66bfd7ad 100644 --- a/share/mk/atf.test.mk +++ b/share/mk/atf.test.mk @@ -72,6 +72,7 @@ MAN.${_T}?= # empty SRCS.${_T}?= ${_T}.c DPADD.${_T}+= ${LIBATF_C} LDADD.${_T}+= -latf-c +USEPRIVATELIB+= atf-c TEST_INTERFACE.${_T}= atf .endfor .endif @@ -85,6 +86,7 @@ MAN.${_T}?= # empty SRCS.${_T}?= ${_T}${CXX_SUFFIX:U.cc} DPADD.${_T}+= ${LIBATF_CXX} ${LIBATF_C} LDADD.${_T}+= -latf-c++ -latf-c +USEPRIVATELIB+= atf-c++ TEST_INTERFACE.${_T}= atf .endfor .endif @@ -96,10 +98,15 @@ _TESTS+= ${ATF_TESTS_SH} SCRIPTSDIR_${_T}= ${TESTSDIR} TEST_INTERFACE.${_T}= atf CLEANFILES+= ${_T} ${_T}.tmp +# TODO(jmmv): It seems to me that this SED and SRC functionality should +# exist in bsd.prog.mk along the support for SCRIPTS. Move it there if +# this proves to be useful within the tests. +ATF_TESTS_SH_SED_${_T}?= # empty ATF_TESTS_SH_SRC_${_T}?= ${_T}.sh ${_T}: ${ATF_TESTS_SH_SRC_${_T}} - echo '#! /usr/bin/atf-sh' > ${.TARGET}.tmp - cat ${.ALLSRC} >> ${.TARGET}.tmp + echo '#! /usr/libexec/atf-sh' > ${.TARGET}.tmp + cat ${.ALLSRC:N*Makefile*} \ + | sed ${ATF_TESTS_SH_SED_${_T}} >>${.TARGET}.tmp chmod +x ${.TARGET}.tmp mv ${.TARGET}.tmp ${.TARGET} .endfor diff --git a/share/mk/bsd.README b/share/mk/bsd.README index 9740dac629c..954984e040f 100644 --- a/share/mk/bsd.README +++ b/share/mk/bsd.README @@ -231,7 +231,9 @@ LDADD Additional loader objects. Usually used for libraries. LDADD=-lutil -lcompat -LDFLAGS Additional loader flags. +LDFLAGS Additional loader flags. Passed to the loader via CC, + since that's used to link programs as well, so loader + specific flags need to be prefixed with -Wl, to work. LINKS The list of binary links; should be full pathnames, the linked-to file coming first, followed by the linked diff --git a/share/mk/bsd.compiler.mk b/share/mk/bsd.compiler.mk index ca15d656596..933d540b18e 100644 --- a/share/mk/bsd.compiler.mk +++ b/share/mk/bsd.compiler.mk @@ -1,39 +1,55 @@ # $FreeBSD$ +# Setup variables for the compiler +# +# COMPILTER_TYPE is the major type of compiler. Currently gcc and clang support +# automatic detetion. Other compiler types can be shoe-horned in, but require explicit +# setting of the compiler type. The compiler type can also be set explicitly if, say, +# you install gcc as clang... +# +# COMPILER_VERSION is a numeric constant equal to major * 10000 + minor * 100 + tiny. It +# too can be overriden on the command line. When testing it, be sure to make sure that you +# are limiting the test to a specific compiler. Testing against 30300 for gcc likely isn't +# what you wanted (since versions of gcc prior to 4.2 likely have no prayer of working). +# +# COMPILER_FEATURES will contain one or more of the following, based on compiler support +# for that feature: c++11 (supports full (or nearly full) C++11 programming environment). +# +# This file may be included multiple times, but only has effect the first time. +# + .if !target(____) ____: .if ${MACHINE} == "common" COMPILER_TYPE= none +COMPILER_VERSION= 0 +.else +_v!= ${CC} --version 2>/dev/null || echo 0.0.0 .endif .if !defined(COMPILER_TYPE) -. if ${CC:T:Mgcc*} +. if ${CC:T:M*gcc*} COMPILER_TYPE:= gcc -. elif ${CC:T:Mclang} +. elif ${CC:T:M*clang*} +COMPILER_TYPE:= clang +. elif ${_v:Mgcc} +COMPILER_TYPE:= gcc +. elif ${_v:M\(GCC\)} +COMPILER_TYPE:= gcc +. elif ${_v:Mclang} COMPILER_TYPE:= clang . else -_COMPILER_VERSION!= ${CC} --version -. if ${_COMPILER_VERSION:Mgcc} -COMPILER_TYPE:= gcc -. elif ${_COMPILER_VERSION:M\(GCC\)} -COMPILER_TYPE:= gcc -. elif ${_COMPILER_VERSION:Mclang} -COMPILER_TYPE:= clang -. else .error Unable to determine compiler type for ${CC}. Consider setting COMPILER_TYPE. -. endif -. undef _COMPILER_VERSION . endif .endif +.if !defined(COMPILER_VERSION) +COMPILER_VERSION!=echo ${_v:M[1-9].[0-9]*} | awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}' +.endif +.undef _v .if ${COMPILER_TYPE} == "clang" COMPILER_FEATURES= c++11 -.if !defined(_COMPILER_VERSION) -_COMPILER_VERSION!= ${CC} --version -.endif -# some warnings are version specific -COMPILER_VERSION:= ${_COMPILER_VERSION:M[1-9].[0-9]*} .else COMPILER_FEATURES= .endif diff --git a/share/mk/bsd.cpu.mk b/share/mk/bsd.cpu.mk index 553351c5201..f786109cdfd 100644 --- a/share/mk/bsd.cpu.mk +++ b/share/mk/bsd.cpu.mk @@ -10,8 +10,6 @@ _CPUCFLAGS = MACHINE_CPU = i486 . elif ${MACHINE_CPUARCH} == "amd64" MACHINE_CPU = amd64 sse2 sse mmx -. elif ${MACHINE_CPUARCH} == "ia64" -MACHINE_CPU = itanium . elif ${MACHINE_CPUARCH} == "powerpc" MACHINE_CPU = aim . elif ${MACHINE_CPUARCH} == "sparc64" @@ -234,10 +232,6 @@ MACHINE_CPU = ssse3 sse3 MACHINE_CPU = sse3 . endif MACHINE_CPU += amd64 sse2 sse mmx -. elif ${MACHINE_CPUARCH} == "ia64" -. if ${CPUTYPE} == "itanium" -MACHINE_CPU = itanium -. endif . elif ${MACHINE_ARCH} == "powerpc" . if ${CPUTYPE} == "e500" MACHINE_CPU = booke @@ -266,3 +260,4 @@ CFLAGS += ${_CPUCFLAGS} # Add in any architecture-specific CFLAGS. # These come from make.conf or the command line or the environment. CFLAGS += ${CFLAGS.${MACHINE_ARCH}} +CXXFLAGS += ${CXXFLAGS.${MACHINE_ARCH}} diff --git a/share/mk/bsd.crunchgen.mk b/share/mk/bsd.crunchgen.mk index cc7f0210264..0f0edd3c22f 100644 --- a/share/mk/bsd.crunchgen.mk +++ b/share/mk/bsd.crunchgen.mk @@ -106,11 +106,12 @@ $(CONF): Makefile .endfor .endfor +CRUNCHGEN?= crunchgen # XXX Make sure we don't pass -P to crunchgen(1). .MAKEFLAGS:= ${.MAKEFLAGS:N-P} .ORDER: $(OUTPUTS) objs -$(OUTPUTS): $(CONF) - MAKE=${MAKE} MAKEOBJDIRPREFIX=${CRUNCHOBJS} crunchgen -fq -m $(OUTMK) \ +$(OUTPUTS): $(CONF) .META + MAKE=${MAKE} MAKEOBJDIRPREFIX=${CRUNCHOBJS} ${CRUNCHGEN} -fq -m $(OUTMK) \ -c $(OUTC) $(CONF) $(PROG): $(OUTPUTS) objs diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk index 64e0d3ca529..a38c718a2f4 100644 --- a/share/mk/bsd.dep.mk +++ b/share/mk/bsd.dep.mk @@ -78,10 +78,11 @@ ${_S:R}.o: ${_S} .endfor .endif +# Lexical analyzers .for _LSRC in ${SRCS:M*.l:N*/*} .for _LC in ${_LSRC:R}.c ${_LC}: ${_LSRC} - ${LEX} -t ${LFLAGS} ${.ALLSRC} > ${.TARGET} + ${LEX} ${LFLAGS} -o${.TARGET} ${.ALLSRC} .if !exists(${.OBJDIR}/${DEPENDFILE}) ${_LC:R}.o: ${_LC} .endif @@ -90,6 +91,7 @@ CLEANFILES+= ${_LC} .endfor .endfor +# Yacc grammars .for _YSRC in ${SRCS:M*.y:N*/*} .for _YC in ${_YSRC:R}.c SRCS:= ${SRCS:S/${_YSRC}/${_YC}/} @@ -117,6 +119,30 @@ ${_YC:R}.o: ${_YC} .endif .endfor .endfor + +# DTrace probe definitions +# libelf is currently needed for drti.o +.if ${SRCS:M*.d} +LDFLAGS+= -lelf +LDADD+= ${LIBELF} +CFLAGS+= -D_DTRACE_VERSION=1 +.endif +.for _DSRC in ${SRCS:M*.d:N*/*} +.for _D in ${_DSRC:R} +${_D}.h: ${_DSRC} + ${DTRACE} -xnolibs -h -s ${.ALLSRC} +SRCS:= ${SRCS:S/${_DSRC}/${_D}.h/} +${_D}.o: ${_D}.h ${_DSRC} ${OBJS} ${SOBJS} + ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${_DSRC} \ + ${OBJS:S/${_D}.o//} ${SOBJS:S/${_D}.o//} +CLEANFILES+= ${_D}.h ${_D}.o +.if defined(PROG) +OBJS+= ${_D}.o +.else +SOBJS+= ${_D}.o +.endif +.endfor +.endfor .endif .if defined(.PARSEDIR) diff --git a/share/mk/bsd.doc.mk b/share/mk/bsd.doc.mk index 49b2d9b85fa..836ace9568c 100644 --- a/share/mk/bsd.doc.mk +++ b/share/mk/bsd.doc.mk @@ -19,7 +19,7 @@ # # MACROS Macro packages used to build the document. [not set] # -# NO_DOCCOMPRESS If you do not want formatted troff documents to be +# WITHOUT_DOCCOMPRESS If you do not want formatted troff documents to be # compressed when they are installed. [not set] # # PRINTERDEVICE Indicates which output formats will be generated @@ -87,7 +87,7 @@ DCOMPRESS_CMD?= ${COMPRESS_CMD} DFILE.html= ${DOC}.html .endfor .for _dev in ${PRINTERDEVICE:Nhtml} -.if defined(NO_DOCCOMPRESS) +.if ${MK_DOCCOMPRESS} == "no" DFILE.${_dev}= ${DOC}.${_dev} .else DFILE.${_dev}= ${DOC}.${_dev}${DCOMPRESS_EXT} @@ -117,7 +117,7 @@ print: ${DFILE.${_dev}} .endfor print: .for _dev in ${PRINTERDEVICE} -.if defined(NO_DOCCOMPRESS) +.if ${MK_DOCCOMPRESS} == "no" ${LPR} ${DFILE.${_dev}} .else ${DCOMPRESS_CMD} -d ${DFILE.${_dev}} | ${LPR} @@ -164,7 +164,7 @@ CLEANFILES+= _stamp.extra ${DFILE.${_dev}}: _stamp.extra .endif ${DFILE.${_dev}}: ${SRCS} -.if defined(NO_DOCCOMPRESS) +.if ${MK_DOCCOMPRESS} == "no" ${ROFF.${_dev}} ${.ALLSRC:N_stamp.extra} > ${.TARGET} .else ${ROFF.${_dev}} ${.ALLSRC:N_stamp.extra} | ${DCOMPRESS_CMD} > ${.TARGET} diff --git a/share/mk/bsd.endian.mk b/share/mk/bsd.endian.mk index 15306a072a5..565d1aa0479 100644 --- a/share/mk/bsd.endian.mk +++ b/share/mk/bsd.endian.mk @@ -2,7 +2,6 @@ .if ${MACHINE_ARCH} == "amd64" || \ ${MACHINE_ARCH} == "i386" || \ - ${MACHINE_ARCH} == "ia64" || \ ${MACHINE_ARCH} == "arm" || \ ${MACHINE_ARCH} == "armv6" || \ ${MACHINE_ARCH} == "armv6hf" || \ diff --git a/share/mk/bsd.files.mk b/share/mk/bsd.files.mk index b0a1f121d36..ef9ba6a8226 100644 --- a/share/mk/bsd.files.mk +++ b/share/mk/bsd.files.mk @@ -4,13 +4,14 @@ .error bsd.files.mk cannot be included directly. .endif +.if !target(____) +____: + FILESGROUPS?= FILES -.if !target(buildfiles) .for group in ${FILESGROUPS} buildfiles: ${${group}} .endfor -.endif all: buildfiles @@ -87,3 +88,5 @@ buildfiles: stage_as .endif .endif .endif + +.endif # !target(____) diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 4782545bfda..8e7dc3de680 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -45,7 +45,8 @@ STRIP?= -s .if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \ empty(DEBUG_FLAGS:M-gdwarf*) -CFLAGS+= -g +SHARED_CFLAGS+= -g +SHARED_CXXFLAGS+= -g CTFFLAGS+= -g .endif @@ -162,6 +163,7 @@ LDFLAGS+= -L${_SHLIBDIRPREFIX}${LIBPRIVATEDIR} -rpath ${LIBPRIVATEDIR} .if defined(LIB) && !empty(LIB) || defined(SHLIB_NAME) OBJS+= ${SRCS:N*.h:R:S/$/.o/} +NOPATH_FILES+= ${OBJS} .endif .if defined(LIB) && !empty(LIB) @@ -183,6 +185,7 @@ lib${LIB}.a: ${OBJS} ${STATICOBJS} .if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB) _LIBS+= lib${LIB}_p.a POBJS+= ${OBJS:.o=.po} ${STATICOBJS:.o=.po} +NOPATH_FILES+= ${POBJS} lib${LIB}_p.a: ${POBJS} @${ECHO} building profiled ${LIB} library @@ -198,6 +201,7 @@ lib${LIB}_p.a: ${POBJS} .if defined(SHLIB_NAME) || \ defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) SOBJS+= ${OBJS:.o=.So} +NOPATH_FILES+= ${SOBJS} .endif .if defined(SHLIB_NAME) @@ -286,6 +290,7 @@ lib${LIB}_pic.a: ${SOBJS} LINTLIB= llib-l${LIB}.ln _LIBS+= ${LINTLIB} LINTOBJS+= ${SRCS:M*.c:.c=.ln} +NOPATH_FILES+= ${LINTOBJS} ${LINTLIB}: ${LINTOBJS} @${ECHO} building lint library ${.TARGET} @@ -468,6 +473,10 @@ clean: .endif .endif +.if !empty(_LIBS) +NOPATH_FILES+= ${_LIBS} +.endif + .include .include diff --git a/share/mk/bsd.libnames.mk b/share/mk/bsd.libnames.mk index 3594b75cff8..0f616002664 100644 --- a/share/mk/bsd.libnames.mk +++ b/share/mk/bsd.libnames.mk @@ -13,8 +13,8 @@ LIBCRT0?= ${DESTDIR}${LIBDIR}/crt0.o LIBALIAS?= ${DESTDIR}${LIBDIR}/libalias.a LIBARCHIVE?= ${DESTDIR}${LIBDIR}/libarchive.a LIBASN1?= ${DESTDIR}${LIBDIR}/libasn1.a -LIBATF_C?= ${DESTDIR}${LIBDIR}/libatf-c.a -LIBATF_CXX?= ${DESTDIR}${LIBDIR}/libatf-c++.a +LIBATF_C?= ${DESTDIR}${LIBPRIVATEDIR}/libatf-c.a +LIBATF_CXX?= ${DESTDIR}${LIBPRIVATEDIR}/libatf-c++.a LIBATM?= ${DESTDIR}${LIBDIR}/libatm.a LIBAUDITD?= ${DESTDIR}${LIBDIR}/libauditd.a LIBAVL?= ${DESTDIR}${LIBDIR}/libavl.a @@ -57,7 +57,6 @@ LIBGNUREGEX?= ${DESTDIR}${LIBDIR}/libgnuregex.a LIBGSSAPI?= ${DESTDIR}${LIBDIR}/libgssapi.a LIBGSSAPI_KRB5?= ${DESTDIR}${LIBDIR}/libgssapi_krb5.a LIBHDB?= ${DESTDIR}${LIBDIR}/libhdb.a -LIBHISTORY?= ${DESTDIR}${LIBDIR}/libhistory.a LIBHEIMBASE?= ${DESTDIR}${LIBDIR}/libheimbase.a LIBHEIMIPCC?= ${DESTDIR}${LIBPRIVATEDIR}/libheimipcc.a LIBHEIMIPCS?= ${DESTDIR}${LIBPRIVATEDIR}/libheimipcs.a @@ -127,7 +126,6 @@ LIBPROC?= ${DESTDIR}${LIBDIR}/libproc.a LIBPROCSTAT?= ${DESTDIR}${LIBDIR}/libprocstat.a LIBPTHREAD?= ${DESTDIR}${LIBDIR}/libpthread.a LIBRADIUS?= ${DESTDIR}${LIBDIR}/libradius.a -LIBREADLINE?= ${DESTDIR}${LIBDIR}/libreadline.a LIBROKEN?= ${DESTDIR}${LIBDIR}/libroken.a LIBRPCSVC?= ${DESTDIR}${LIBDIR}/librpcsvc.a LIBRPCSEC_GSS?= ${DESTDIR}${LIBDIR}/librpcsec_gss.a diff --git a/share/mk/bsd.mkopt.mk b/share/mk/bsd.mkopt.mk index 3f22bc8aac9..c3054cdb777 100644 --- a/share/mk/bsd.mkopt.mk +++ b/share/mk/bsd.mkopt.mk @@ -42,7 +42,7 @@ MK_${var}:= yes # .for var in ${__DEFAULT_NO_OPTIONS} .if !defined(MK_${var}) -.if defined(WITH_${var}) && !defined(WITHOUT_${var}) # WITHOUT aways wins +.if defined(WITH_${var}) && !defined(WITHOUT_${var}) # WITHOUT always wins MK_${var}:= yes .else MK_${var}:= no diff --git a/share/mk/bsd.obj.mk b/share/mk/bsd.obj.mk index 3937a42f02f..c5b4636444a 100644 --- a/share/mk/bsd.obj.mk +++ b/share/mk/bsd.obj.mk @@ -128,8 +128,9 @@ cleanobj: clean cleandepend @if [ -L ${.CURDIR}/obj ]; then rm -f ${.CURDIR}/obj; fi # Tell bmake not to look for generated files via .PATH -.if !empty(CLEANFILES) -.NOPATH: ${CLEANFILES:N*\**} +NOPATH_FILES+= ${CLEANFILES} +.if !empty(NOPATH_FILES) +.NOPATH: ${NOPATH_FILES} .endif .if !target(clean) diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk index 5f6a4db0edf..38d1c2314de 100644 --- a/share/mk/bsd.opts.mk +++ b/share/mk/bsd.opts.mk @@ -40,12 +40,17 @@ ____: # that haven't been converted over. # -# Only these options are used by bsd.*.mk. Most seem legit, except maybe -# OPENSSH. +# Only these options are used by bsd.*.mk. KERBEROS and OPENSSH are +# unforutnately needed to support statically linking the entire +# tree. su(1) wouldn't link since it depends on PAM which depends on +# ssh libraries when building with OPENSSH, and likewise for KERBEROS. + +# All other variables used to build /usr/src live in src.opts.mk +# and variables from both files are documented in src.conf(5). __DEFAULT_YES_OPTIONS = \ ASSERT_DEBUG \ - INFO \ + DOCCOMPRESS \ INSTALLLIB \ KERBEROS \ MAN \ @@ -56,12 +61,15 @@ __DEFAULT_YES_OPTIONS = \ PROFILE \ SSP \ SYMVER \ - TOOLCHAIN + TOOLCHAIN \ + WARNS __DEFAULT_NO_OPTIONS = \ CTF \ DEBUG_FILES \ - INSTALL_AS_USER + INSTALL_AS_USER \ + INFO \ + PIE # meta mode related @@ -84,7 +92,8 @@ __DEFAULT_NO_OPTIONS += \ DEBUG_FILES \ INSTALLLIB \ MAN \ - PROFILE + PROFILE \ + WARNS .if defined(NO_${var}) # This warning may be premature... #.warning "NO_${var} is defined, but deprecated. Please use MK_${var}=no instead." diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index 606bb3c90fb..0e53e6881d2 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -122,7 +122,7 @@ .if !target(____) ____: -.include +.include # options now here or src.opts.mk .if !defined(_WITHOUT_SRCCONF) diff --git a/share/mk/bsd.pkg.mk b/share/mk/bsd.pkg.mk deleted file mode 100644 index 3d1ca42e935..00000000000 --- a/share/mk/bsd.pkg.mk +++ /dev/null @@ -1,48 +0,0 @@ -# $FreeBSD$ - -WRKDIR=${.OBJDIR} -.if ${.OBJDIR} == ${.CURDIR} -WRKDIR=${.CURDIR}/work -.endif -NO_WRKSUBDIR=YES -NO_CHECKSUM=YES -NO_BUILD=YES - -fetch: -extract: -patch: -configure: -build: - -.if target(____) -clean: do-clean -.if ${CANONICALOBJDIR} != ${.CURDIR} && exists(${CANONICALOBJDIR}/) - @rm -rf ${CANONICALOBJDIR} -.else - @if [ -L ${.CURDIR}/obj ]; then rm -f ${.CURDIR}/obj; fi -.if defined(CLEANFILES) && !empty(CLEANFILES) - rm -f ${CLEANFILES} -.endif -.if defined(CLEANDIRS) && !empty(CLEANDIRS) - rm -rf ${CLEANDIRS} -.endif -.endif -.endif - -.if !target(beforeinstall) -beforeinstall: -.endif -.if !target(afterinstall) -afterinstall: -.endif - -install: install-message check-categories check-conflicts \ - run-depends lib-depends pre-install pre-install-script \ - generate-plist check-already-installed \ - check-umask install-mtree pre-su-install \ - pre-su-install-script \ - beforeinstall realinstall afterinstall \ - add-plist-info post-install post-install-script \ - compress-man run-ldconfig fake-pkg - -.include diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 976794d5cad..f6d2f208f5a 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -11,6 +11,18 @@ CFLAGS+=${COPTS} .endif +.if ${MK_PIE} != "no" && (!defined(NO_PIE) || ${NO_PIE} == "no") +.if !defined(RESCUE) && !defined(NO_SHARED) +CFLAGS+= -fPIE -pie +LDFLAGS+= -pie +.elif defined(NO_SHARED) +.if ${NO_SHARED} == "no" || ${NO_SHARED} == "NO" +CFLAGS+= -fPIE -pie +LDFLAGS+= -pie +.endif +.endif +.endif + .if ${MK_ASSERT_DEBUG} == "no" CFLAGS+= -DNDEBUG NO_WERROR= @@ -177,7 +189,7 @@ _EXTRADEPEND: .endif .else echo ${PROG}: ${LIBC} ${DPADD} >> ${DEPENDFILE} -.if defined(PROG_CXX) && !defined(EARLY_BUILD) +.if defined(PROG_CXX) .if ${COMPILER_TYPE} == "clang" && empty(CXXFLAGS:M-stdlib=libstdc++) echo ${PROG}: ${LIBCPLUSPLUS} >> ${DEPENDFILE} .else @@ -285,7 +297,3 @@ ${OBJS}: ${SRCS:M*.h} .include .include - -.if defined(PORTNAME) -.include -.endif diff --git a/share/mk/bsd.subdir.mk b/share/mk/bsd.subdir.mk index 072c76c3945..9312e7f842d 100644 --- a/share/mk/bsd.subdir.mk +++ b/share/mk/bsd.subdir.mk @@ -56,15 +56,15 @@ _SUBDIR: .USE .MAKE .if defined(SUBDIR) && !empty(SUBDIR) && !defined(NO_SUBDIR) @${_+_}set -e; for entry in ${SUBDIR:N.WAIT}; do \ if test -d ${.CURDIR}/$${entry}.${MACHINE_ARCH}; then \ - ${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH} (${.TARGET:realinstall=install})"; \ + ${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH} (${.TARGET:S,realinstall,install,:S,^_sub.,,})"; \ edir=$${entry}.${MACHINE_ARCH}; \ cd ${.CURDIR}/$${edir}; \ else \ - ${ECHODIR} "===> ${DIRPRFX}$$entry (${.TARGET:realinstall=install})"; \ + ${ECHODIR} "===> ${DIRPRFX}$$entry (${.TARGET:S,realinstall,install,:S,^_sub.,,})"; \ edir=$${entry}; \ cd ${.CURDIR}/$${edir}; \ fi; \ - ${MAKE} ${.TARGET:realinstall=install} \ + ${MAKE} ${.TARGET:S,realinstall,install,:S,^_sub.,,} \ DIRPRFX=${DIRPRFX}$$edir/; \ done .endif @@ -89,7 +89,12 @@ __subdir_targets= __subdir_targets+= .WAIT .else __subdir_targets+= ${__target}_subdir_${__dir} -${__target}_subdir_${__dir}: .MAKE +__deps= +.for __dep in ${SUBDIR_DEPEND_${__dir}} +__deps+= ${__target}_subdir_${__dep} +.endfor +${__target}_subdir_${__dir}: .MAKE ${__deps} +.if !defined(NO_SUBDIR) @${_+_}set -e; \ if test -d ${.CURDIR}/${__dir}.${MACHINE_ARCH}; then \ ${ECHODIR} "===> ${DIRPRFX}${__dir}.${MACHINE_ARCH} (${__target:realinstall=install})"; \ @@ -103,10 +108,12 @@ ${__target}_subdir_${__dir}: .MAKE ${MAKE} ${__target:realinstall=install} \ DIRPRFX=${DIRPRFX}$$edir/ .endif +.endif .endfor ${__target}: ${__subdir_targets} .else -${__target}: _SUBDIR +${__target}: _sub.${__target} +_sub.${__target}: _SUBDIR .endif .endfor @@ -114,11 +121,14 @@ ${__target}: _SUBDIR .for __stage in build install ${__stage}${__target}: .if make(${__stage}${__target}) -${__stage}${__target}: _SUBDIR +${__stage}${__target}: _sub.${__stage}${__target} +_sub.${__stage}${__target}: _SUBDIR .endif .endfor +.if !target(${__target}) ${__target}: .MAKE ${_+_}set -e; cd ${.CURDIR}; ${MAKE} build${__target}; ${MAKE} install${__target} +.endif .endfor .endif diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 97ca9632aa9..a84d23d05ce 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -4,7 +4,7 @@ # sources. # Enable various levels of compiler warning checks. These may be -# overridden (e.g. if using a non-gcc compiler) by defining NO_WARNS. +# overridden (e.g. if using a non-gcc compiler) by defining MK_WARNS=no. # for GCC: http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc/Warning-Options.html @@ -65,8 +65,8 @@ CWARNFLAGS+= -Wno-pointer-sign # is set to low values, these have to be disabled explicitly. .if ${WARNS} <= 6 CWARNFLAGS.clang+= -Wno-empty-body -Wno-string-plus-int -.if ${COMPILER_VERSION} > 3.3 -CWARNFLAGS.clang+= -Wno-unused-const-variable +.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} > 30300 +CWARNFLAGS.clang+= -Wno-unused-const-variable .endif .endif # WARNS <= 6 .if ${WARNS} <= 3 @@ -126,55 +126,37 @@ CFLAGS.clang+= -fno-dwarf2-cfi-asm # but not yet. CXXFLAGS.clang+= -Wno-c++11-extensions -.if ${MK_SSP} != "no" && ${MACHINE_CPUARCH} != "ia64" && \ +.if ${MK_SSP} != "no" && \ ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" # Don't use -Wstack-protector as it breaks world with -Werror. SSP_CFLAGS?= -fstack-protector CFLAGS+= ${SSP_CFLAGS} -.endif # SSP && !IA64 && !ARM && !MIPS +.endif # SSP && !ARM && !MIPS # Allow user-specified additional warning flags, plus compiler specific flag overrides. -# Unless we're early in the build, in which case don't (which is lame, this should -# be handled by NO_WARNS which needs to migrate to something else. -.if !defined(NO_WARNS) && !defined(EARLY_BUILD) +# Unless we've overriden this... +.if ${MK_WARNS} != "no" CFLAGS+= ${CWARNFLAGS} ${CWARNFLAGS.${COMPILER_TYPE}} .endif -# Not sure this is 100% kosher, but I think that EARLY_BUILD must be only -# defined when we're not building programs that use the CFLAGS.foo feature. -.if !defined(EARLY_BUILD) CFLAGS+= ${CFLAGS.${COMPILER_TYPE}} CXXFLAGS+= ${CXXFLAGS.${COMPILER_TYPE}} -.endif # Tell bmake not to mistake standard targets for things to be searched for # or expect to ever be up-to-date. PHONY_NOTMAIN = afterdepend afterinstall all beforedepend beforeinstall \ beforelinking build build-tools buildfiles buildincludes \ checkdpadd clean cleandepend cleandir cleanobj configure \ - depend dependall distclean distribute exe extract \ + depend dependall distclean distribute exe \ html includes install installfiles installincludes lint \ obj objlink objs objwarn realall realdepend \ realinstall regress subdir-all subdir-depend subdir-install \ tags whereobj -.if defined(PORTNAME) -PHONY_NOTMAIN+= fetch patch -.endif - -.if defined(.PARSEDIR) # we don't want ${PROG} to be PHONY .PHONY: ${PHONY_NOTMAIN:N${PROG:U}} -.else -.PHONY: ${PHONY_NOTMAIN} -.endif .NOTMAIN: ${PHONY_NOTMAIN:Nall} -.if !defined(.PARSEDIR) -# this is a no-op -.WAIT: -.endif - .if ${MK_STAGING} != "no" .if defined(_SKIP_BUILD) || (!make(all) && !make(clean*)) _SKIP_STAGING?= yes diff --git a/share/mk/bsd.test.mk b/share/mk/bsd.test.mk index f05a0ee2df5..9c1667ae594 100644 --- a/share/mk/bsd.test.mk +++ b/share/mk/bsd.test.mk @@ -27,6 +27,15 @@ TESTS_SUBDIRS?= # List of variables to pass to the tests at run-time via the environment. TESTS_ENV?= +# Force all tests in a separate distribution file. +# +# We want this to be the case even when the distribution name is already +# overriden. For example: we want the tests for programs in the 'games' +# distribution to end up in the 'tests' distribution; the test programs +# themselves have all the necessary logic to detect that the games are not +# installed and thus won't cause false negatives. +DISTRIBUTION:= tests + # Ordered list of directories to construct the PATH for the tests. TESTS_PATH+= ${DESTDIR}/bin ${DESTDIR}/sbin \ ${DESTDIR}/usr/bin ${DESTDIR}/usr/sbin @@ -51,8 +60,7 @@ SUBDIR+= ${TESTS_SUBDIRS} # it is rare for test cases to have man pages .if !defined(MAN) -NO_MAN=yes -.export NO_MAN +MAN= .endif # tell progs.mk we might want to install things @@ -89,9 +97,8 @@ MK_STAGING= no .if !empty(PROGS) || !empty(PROGS_CXX) || !empty(SCRIPTS) .include -.elif !empty(FILES) -.include .endif +.include .if !defined(PROG) && ${MK_STAGING} != "no" .if !defined(_SKIP_BUILD) diff --git a/share/mk/local.dirdeps.mk b/share/mk/local.dirdeps.mk index c9c089a3896..5fefd03a640 100644 --- a/share/mk/local.dirdeps.mk +++ b/share/mk/local.dirdeps.mk @@ -1,7 +1,7 @@ .if !target(_DIRDEP_USE) # we are the 1st makefile -.if !defined(MK_CTF) +.if !defined(MK_CLANG) .include "${SRCTOP}/share/mk/src.opts.mk" .endif diff --git a/share/mk/local.init.mk b/share/mk/local.init.mk index f6a29377d9a..1f77c00880c 100644 --- a/share/mk/local.init.mk +++ b/share/mk/local.init.mk @@ -2,7 +2,7 @@ .include "src.opts.mk" .if defined(.PARSEDIR) -.if ${.MAKE.MODE:Mmeta*} != "" +.if ${.MAKE.MODE:Unormal:Mmeta*} != "" .if !empty(SUBDIR) && !defined(LIB) && !defined(PROG) && ${.MAKE.MAKEFILES:M*bsd.prog.mk} == "" .if ${.MAKE.MODE:Mleaf*} != "" # we only want leaf dirs to build in meta mode... and we are not one diff --git a/share/mk/local.sys.mk b/share/mk/local.sys.mk index 8fe01956168..2fe3d8fb997 100644 --- a/share/mk/local.sys.mk +++ b/share/mk/local.sys.mk @@ -1,6 +1,17 @@ WITH_INSTALL_AS_USER= yes .if defined(.PARSEDIR) # bmake +.if !defined(_TARGETS) +# some things we do only once +_TARGETS := ${.TARGETS} +.export _TARGETS +.endif +.if ${_TARGETS:Mbuildworld} +WITHOUT_STAGING= +WITHOUT_SYSROOT= +UPDATE_DEPENDFILE=NO +NO_AUTO_OBJ= +.endif SRCCONF:= ${.PARSEDIR}/src.conf # ensure we are self contained __MAKE_CONF:= ${SRCCONF} @@ -83,9 +94,8 @@ MACHINE_ARCH:= ${MACHINE_ARCH} MACHINE_ARCH:= ${MACHINE_ARCH.${MACHINE}} .endif -.if !defined(_TARGETS) -# some things we do only once -_TARGETS := ${.TARGETS} +.if ${.MAKE.LEVEL} == 0 +# 1st time only .-include .if !empty(OBJROOT) .if ${OBJROOT:M*/} != "" @@ -160,6 +170,9 @@ MKOBJDIRS=auto .ifndef WITHOUT_META_MODE WITH_META_MODE= yes +.ifndef WITHOUT_SYSROOT +WITH_SYSROOT= yes +.endif .ifndef WITHOUT_STAGING WITH_STAGING= yes .ifndef WITHOUT_STAGING_PROG @@ -198,7 +211,7 @@ STAGE_ROOT?= ${OBJROOT}stage .endif .endif -.if !empty(STAGE_ROOT) +.if !empty(STAGE_ROOT) && !defined(WITHOUT_STAGING) .if ${MACHINE} == "host" STAGE_MACHINE= ${HOST_TARGET} .else @@ -225,10 +238,6 @@ STAGED_INCLUDE_DIR= ${STAGE_OBJTOP}/usr/include .endif .endif # EARLY_BUILD for host -.if ${USE_META:Uyes} == "yes" -.include "meta.sys.mk" -.endif - # this is sufficient for most of the tree. .MAKE.DEPENDFILE_DEFAULT = ${.MAKE.DEPENDFILE_PREFIX} @@ -241,6 +250,8 @@ STAGED_INCLUDE_DIR= ${STAGE_OBJTOP}/usr/include .include "sys.dependfile.mk" +.include "meta.sys.mk" + .if ${.MAKE.LEVEL} > 0 && ${MACHINE} == "host" && ${.MAKE.DEPENDFILE:E} != "host" # we can use this but should not update it. UPDATE_DEPENDFILE= NO diff --git a/share/mk/meta.autodep.mk b/share/mk/meta.autodep.mk index 57d01807880..64bc30bd475 100644 --- a/share/mk/meta.autodep.mk +++ b/share/mk/meta.autodep.mk @@ -1,4 +1,4 @@ -# $Id: meta.autodep.mk,v 1.32 2012/11/13 00:44:26 sjg Exp $ +# $Id: meta.autodep.mk,v 1.36 2014/08/02 23:10:29 sjg Exp $ # # @(#) Copyright (c) 2010, Simon J. Gerraty @@ -120,7 +120,7 @@ FORCE_DPADD += ${_nonlibs:@x@${DPADD:M*/$x}@} # some makefiles and/or targets contain # circular dependencies if you dig too deep # (as meta mode is apt to do) -# so we provide a means of supressing them. +# so we provide a means of suppressing them. # the input to the loop below is target: dependency # with just one dependency per line. # Also some targets are not really local, or use random names. @@ -137,7 +137,7 @@ SUPPRESS_DEPEND += \ # the double $$ defers initial evaluation # if necessary, we fake .po dependencies, just so the result # in Makefile.depend* is stable -# The current objdir may be refered to in various ways +# The current objdir may be referred to in various ways OBJDIR_REFS += ${.OBJDIR} ${.OBJDIR:tA} ${_OBJDIR} ${RELOBJTOP}/${RELDIR} _depend = .depend # it would be nice to be able to get .SUFFIXES as ${.SUFFIXES} @@ -254,6 +254,9 @@ ${_DEPENDFILE}: ${_depend} ${.PARSEDIR}/gendirdeps.mk ${META2DEPS} $${.MAKE.MET .endif .if ${_bootstrap_dirdeps} == "yes" +.if ${BUILD_AT_LEVEL0:Uno} == "no" +DIRDEPS+= ${RELDIR}.${TARGET_SPEC:U${MACHINE}} +.endif # make sure this is included at least once .include .else diff --git a/share/mk/meta.sys.mk b/share/mk/meta.sys.mk index 379e3385f3f..666ef7191fa 100644 --- a/share/mk/meta.sys.mk +++ b/share/mk/meta.sys.mk @@ -1,4 +1,4 @@ -# $Id: meta.sys.mk,v 1.14 2011/10/02 00:40:56 sjg Exp $ +# $Id: meta.sys.mk,v 1.19 2014/08/02 23:16:02 sjg Exp $ # # @(#) Copyright (c) 2010, Simon J. Gerraty @@ -106,7 +106,13 @@ _metaError: .NOMETA .NOTMAIN # Are we, after all, in meta mode? .if ${.MAKE.MODE:Mmeta*} != "" -MKDEP = meta.autodep +MKDEP_MK = meta.autodep.mk + +# if we think we are updating dependencies, +# then filemon had better be present +.if ${UPDATE_DEPENDFILE:Uyes:tl} != "no" && !exists(/dev/filemon) +.error ${.newline}ERROR: The filemon module (/dev/filemon) is not loaded. +.endif .if ${.MAKE.LEVEL} == 0 # make sure dirdeps target exists and do it first @@ -121,19 +127,11 @@ dirdeps: # tell dirdeps.mk what we want BUILD_AT_LEVEL0 = no .endif - -.if ${.MAKE.DEPENDFILE:E} == ${MACHINE} +.if ${.TARGETS:Nall} == "" # it works best if we do everything via sub-makes BUILD_AT_LEVEL0 ?= no .endif -BUILD_AT_LEVEL0 ?= yes -.endif - -# if we think we are updating dependencies, -# then filemon had better be present -.if ${UPDATE_DEPENDFILE:Uyes:tl} != "no" && !exists(/dev/filemon) -.error ${.newline}ERROR: The filemon module (/dev/filemon) is not loaded. -.endif .endif .endif +.endif diff --git a/share/mk/plain.test.mk b/share/mk/plain.test.mk index 99685ef1d96..f26bab3e42e 100644 --- a/share/mk/plain.test.mk +++ b/share/mk/plain.test.mk @@ -57,7 +57,8 @@ CLEANFILES+= ${_T} ${_T}.tmp PLAIN_TESTS_SH_SED_${_T}?= # empty PLAIN_TESTS_SH_SRC_${_T}?= ${_T}.sh ${_T}: ${PLAIN_TESTS_SH_SRC_${_T}} - cat ${.ALLSRC} | sed ${PLAIN_TESTS_SH_SED_${_T}} >${.TARGET}.tmp + cat ${.ALLSRC:N*Makefile*} \ + | sed ${PLAIN_TESTS_SH_SED_${_T}} >${.TARGET}.tmp chmod +x ${.TARGET}.tmp mv ${.TARGET}.tmp ${.TARGET} .endfor diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 336d7009f1f..fa116b261bc 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -24,23 +24,14 @@ # # Makefiles should never test WITH_FOO or WITHOUT_FOO directly (although an # exception is made for _WITHOUT_SRCONF which turns off this mechanism -# completely). +# completely inside bsd.*.mk files). # .if !target(____) ____: -# Compat -- needed still? .include -# Allow user to configure things, but in the future this will move -# elsehwere... - -SRCCONF?= /etc/src.conf -.if exists(${SRCCONF}) || ${SRCCONF} != "/etc/src.conf" -.include "${SRCCONF}" -.endif - # # Define MK_* variables (which are either "yes" or "no") for users # to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the @@ -77,6 +68,7 @@ __DEFAULT_YES_OPTIONS = \ CROSS_COMPILER \ CRYPT \ CTM \ + CUSE \ CXX \ DICT \ DMAGENT \ @@ -86,7 +78,6 @@ __DEFAULT_YES_OPTIONS = \ FDT \ FLOPPY \ FMTREE \ - FORMAT_EXTENSIONS \ FORTH \ FP_LIBC \ FREEBSD_UPDATE \ @@ -107,7 +98,6 @@ __DEFAULT_YES_OPTIONS = \ IPFW \ JAIL \ KDUMP \ - KERNEL_SYMBOLS \ KVM \ LDNS \ LDNS_UTILS \ @@ -123,7 +113,6 @@ __DEFAULT_YES_OPTIONS = \ MAIL \ MAILWRAPPER \ MAKE \ - NCURSESW \ NDIS \ NETCAT \ NETGRAPH \ @@ -155,11 +144,13 @@ __DEFAULT_YES_OPTIONS = \ SYSINSTALL \ TCSH \ TELNET \ + TESTS \ TEXTPROC \ UNBOUND \ USB \ UTMPX \ VI \ + VT \ WIRELESS \ WPA_SUPPLICANT_EAPOL \ ZFS \ @@ -169,6 +160,7 @@ __DEFAULT_NO_OPTIONS = \ BSD_GREP \ CLANG_EXTRAS \ EISA \ + FMAKE \ HESIOD \ LLDB \ NAND \ @@ -179,7 +171,6 @@ __DEFAULT_NO_OPTIONS = \ SORT_THREADS \ SVN \ SYSROOT \ - TESTS \ USB_GADGET_EXAMPLES # @@ -215,18 +206,11 @@ __DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL CLANG_BOOTSTRAP .if ${__T} == "amd64" || ${__T} == "arm" || ${__T} == "armv6" || \ ${__T} == "armv6hf" || ${__T} == "i386" __DEFAULT_YES_OPTIONS+=CLANG_IS_CC -__DEFAULT_NO_OPTIONS+=GNUCXX -# The pc98 bootloader requires gcc to build and so we must leave gcc enabled -# for pc98 for now. -.if ${__TT} == "pc98" -__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP -.else -__DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP -.endif +__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 GNUCXX GCC_BOOTSTRAP +__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX .endif .include @@ -286,6 +270,7 @@ MK_KERBEROS:= no .if ${MK_CXX} == "no" MK_CLANG:= no MK_GROFF:= no +MK_GNUCXX:= no .endif .if ${MK_MAIL} == "no" diff --git a/share/mk/src.sys.mk b/share/mk/src.sys.mk new file mode 100644 index 00000000000..4bd22e5e80e --- /dev/null +++ b/share/mk/src.sys.mk @@ -0,0 +1,13 @@ +# $FreeBSD$ + +# Note: This file is also duplicated in the sys/conf/kern.pre.mk so +# it will always grab SRCCONF, even if it isn't being built in-tree +# to preserve historical (and useful) behavior. Changes here need to +# be reflected there so SRCCONF isn't included multiple times. + +# Allow user to configure things that only effect src tree builds. +SRCCONF?= /etc/src.conf +.if (exists(${SRCCONF}) || ${SRCCONF} != "/etc/src.conf") && !target(_srcconf_included_) +.sinclude "${SRCCONF}" +_srcconf_included_: .NOTMAIN +.endif diff --git a/share/mk/sys.dependfile.mk b/share/mk/sys.dependfile.mk index 42cec61fce1..e915082e778 100644 --- a/share/mk/sys.dependfile.mk +++ b/share/mk/sys.dependfile.mk @@ -1,4 +1,4 @@ -# $Id: sys.dependfile.mk,v 1.5 2013/03/08 00:59:21 sjg Exp $ +# $Id: sys.dependfile.mk,v 1.6 2014/08/02 18:02:06 sjg Exp $ # # @(#) Copyright (c) 2012, Simon J. Gerraty # @@ -25,6 +25,12 @@ # All depend file names should start with this .MAKE.DEPENDFILE_PREFIX ?= Makefile.depend +.if !empty(.MAKE.DEPENDFILE) && \ + ${.MAKE.DEPENDFILE:M${.MAKE.DEPENDFILE_PREFIX}*} == "" +# let us do our thing below... +.undef .MAKE.DEPENDFILE +.endif + # The order of preference: we will use the first one of these we find. # It usually makes sense to order from most specific to least. .MAKE.DEPENDFILE_PREFERENCE ?= \ diff --git a/share/mk/sys.mk b/share/mk/sys.mk index 2f84319b84c..f63d829e556 100644 --- a/share/mk/sys.mk +++ b/share/mk/sys.mk @@ -16,10 +16,6 @@ unix ?= We run FreeBSD, not UNIX. MACHINE_CPUARCH=${MACHINE_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb|hf)?/arm/:C/powerpc64/powerpc/} .endif -# Set any local definitions first. Place this early, but it needs -# MACHINE_CPUARCH to be defined. -.sinclude - # If the special target .POSIX appears (without prerequisites or # commands) before the first noncomment line in the makefile, make shall # process the makefile as specified by the Posix 1003.2 specification. @@ -74,10 +70,6 @@ CTFMERGE ?= ctfmerge DTRACE ?= dtrace .if defined(CFLAGS) && (${CFLAGS:M-g} != "") CTFFLAGS += -g -.else -# XXX: What to do here? Is removing the CFLAGS part completely ok here? -# For now comment it out to not compile with -g unconditionally. -#CFLAGS += -g .endif CXX ?= c++ @@ -125,7 +117,8 @@ LEX ?= lex LFLAGS ?= LD ?= ld -LDFLAGS ?= +LDFLAGS ?= # LDFLAGS is for CC, +_LDFLAGS = ${LDFLAGS:S/-Wl,//g} # strip -Wl, for LD LINT ?= lint LINTFLAGS ?= -cghapbx @@ -318,12 +311,21 @@ YFLAGS ?= -d rm -f ${.PREFIX}.tmp.c ${CTFCONVERT_CMD} -# FreeBSD build pollution. Hide it in the non-POSIX part of the ifdef. +# Set any local definitions first. Place this early, but it needs +# MACHINE_CPUARCH to be defined. +.sinclude + +# Pull in global settings. __MAKE_CONF?=/etc/make.conf .if exists(${__MAKE_CONF}) .include "${__MAKE_CONF}" .endif +# Setup anything for the FreeBSD source build, if we're building +# inside the source tree. Needs to be after make.conf, but before +# local stuff. +.sinclude + .if defined(__MAKE_SHELL) && !empty(__MAKE_SHELL) SHELL= ${__MAKE_SHELL} .SHELL: path=${__MAKE_SHELL} @@ -338,11 +340,7 @@ SHELL= ${__MAKE_SHELL} # Toggle on warnings .WARN: dirsyntax -.endif - -.endif - -.if defined(.PARSEDIR) +.else # is bmake # Tell bmake to expand -V VAR by default .MAKE.EXPAND_VARIABLES= yes @@ -359,7 +357,8 @@ SHELL= ${__MAKE_SHELL} echoFlag=v errFlag=e \ path=${__MAKE_SHELL:U/bin/sh} .endif - -.endif +.endif # bmake .include + +.endif # ! Posix diff --git a/share/mk/tap.test.mk b/share/mk/tap.test.mk index 4c056616c4c..058ebdfeae9 100644 --- a/share/mk/tap.test.mk +++ b/share/mk/tap.test.mk @@ -66,7 +66,7 @@ TAP_TESTS_PERL_SRC_${_T}?= ${_T}.pl ${_T}: ${TAP_TESTS_PERL_SRC_${_T}} { \ echo '#! ${TAP_PERL_INTERPRETER}'; \ - cat ${.ALLSRC} | sed ${TAP_TESTS_PERL_SED_${_T}}; \ + cat ${.ALLSRC:N*Makefile*} | sed ${TAP_TESTS_PERL_SED_${_T}}; \ } >${.TARGET}.tmp chmod +x ${.TARGET}.tmp mv ${.TARGET}.tmp ${.TARGET} diff --git a/share/termcap/termcap.src b/share/termcap/termcap.src index 23536f60526..08a1c8333c4 100644 --- a/share/termcap/termcap.src +++ b/share/termcap/termcap.src @@ -36,7 +36,7 @@ # John Kunze, Berkeley # Craig Leres, Berkeley # -# Please submit changes with send-pr(1). +# Please submit changes via https://bugs.freebsd.org/submit/ # # << EOH - after reordering, above header lines survive and this line dies >> # diff --git a/share/vt/Makefile b/share/vt/Makefile new file mode 100644 index 00000000000..97146ca1620 --- /dev/null +++ b/share/vt/Makefile @@ -0,0 +1,5 @@ +# $FreeBSD$ + +SUBDIR= fonts keymaps + +.include diff --git a/share/vt/fonts/Makefile b/share/vt/fonts/Makefile new file mode 100644 index 00000000000..05e99a5fe6b --- /dev/null +++ b/share/vt/fonts/Makefile @@ -0,0 +1,21 @@ +# $FreeBSD$ + +FILES= gallant.fnt \ + vgarom-8x8.fnt \ + vgarom-8x14.fnt \ + vgarom-8x16.fnt \ + vgarom-thin-8x8.fnt \ + vgarom-thin-8x16.fnt + +CLEANFILES+= ${FILES} + +.SUFFIXES: .fnt .fnt.uu .hex +.hex.fnt: + vtfontcvt ${.IMPSRC} ${.TARGET} + +.fnt.uu.fnt: + uudecode -p < ${.IMPSRC} > ${.TARGET} + +FILESDIR= ${SHAREDIR}/vt/fonts + +.include diff --git a/share/vt/fonts/gallant.fnt.uu b/share/vt/fonts/gallant.fnt.uu new file mode 100644 index 00000000000..84f30a13b34 --- /dev/null +++ b/share/vt/fonts/gallant.fnt.uu @@ -0,0 +1,192 @@ +# $FreeBSD$ +begin 644 gallant.fnt +M5D9.5#`P,#(,%@``````OP````(````````````````````````````````` +M```````````````````````````````````````````````&``8`!@`&``8` +M!@`&``8`!@`&``8```````8`!@```````````````````!F`&8`9@!F`&8`9 +M@````````````````````````````````````````````S`#,`,P!F`?\!_P +M#,`,P!F`&8!_P'_`,P!F`&8````````````````````&`!^`/\!FX&9@9@`^ +M`!^`!\`&8`9@9F!_P#^`!@```````````````````#A@1,!$P$6`.8`#``,` +M!@`,``P`&<`:(#(@,B!AP```````````````````!P`/@!C`&,`8P`^`'@`^ +M`'<`8V!AX&'`88`_X!Y@```````````````````,`!X`'@`&``8`#``8`!`` +M``````````````````````````````````````#``8`#@`,`!P`&``8`!@`& +M``8`!P`#``.``8``P```````````````````,``8`!P`#``.``8`!@`&``8` +M!@`.``P`'``8`#````````````````````````````````\`!@!F8';@&8`` +M`!F`=N!F8`8`#P`````````````````````````````````&``8`!@`&`'_@ +M?^`&``8`!@`&```````````````````````````````````````````````` +M````#``>`!X`!@`&``P`&``0``````````````````````````````!_X'_@ +M```````````````````````````````````````````````````````````, +M`!X`'@`,`````````````````````&``P`#``8`!@`,``P`&``P`#``8`!@` +M,``P`&`````````````````````'``^`$8`0P##`,,`PP##`,,`PP##`,(`8 +M@!\`#@````````````````````(`!@`.`!X`-@`&``8`!@`&``8`!@`&``8` +M!@`_P```````````````````'P`_@&'`0,``P`#``,`!@`,`!@`,`!@`,"!_ +MX'_@```````````````````/@!_`(.!`8`!@`.`'P`_``.``8`!@0&!@0#^` +M'P````````````````````&``X`#@`6`!8`)@`F`$8`1@"&`/^!_X`&``8`! +M@```````````````````#\`/P!``$``@`#^`,<``X`!@`&``8$!@8&`PP!^` +M```````````````````'``P`&``P`#``8`!G@&_`<.!@8&!@8&!P0#^`'P`` +M`````````````````!_@/^!@0`!``,``@`"``8`!``$``P`"``(`!@`$```` +M````````````````#P`1@##`,,`PP!B`#0`&``L`$8`PP##`,,`8@`\````` +M```````````````/@!'`(.!@8&!@8&!PX#]@'F``8`#``,`!@`<`/``````` +M```````````````````````````,`!X`'@`,```````,`!X`'@`,```````` +M````````````````````````````#``>`!X`#```````#``>`!X`!@`&``P` +M&``0`````````````````````&`!P`<`'@!X`'@`'@`'``'``&`````````` +M````````````````````````````?\!_P`````!_P'_````````````````` +M`````````````````````&``.``>``>``>`!X`>`'@`X`&`````````````` +M```````/`!^`.<`@P`#``,`!@`,`!@`,``P```````P`#``````````````` +M``````````````^`/\`P8&!@9R!OH&R@;*!GX&``,``_X`_@```````````` +M```````&``8`"P`+``D`$8`1@!"`/\`@P"!`0&!`8.#P```````````````` +M`````/\`8(!@P&#`8,!A@'^`8,!@8&!@8&!@8&#`_X`````````````````` +M````#\`08"`@(`!@`&``8`!@`&``8``@`#`@&$`/@``````````````````` +M``#_`&'`8,!@8&!@8&!@8&!@8&!@8&!@8$!A@/X````````````````````` +M`'_`,$`P0#``,``P@#^`,(`P`#``,``P(#`@?^`````````````````````` +M?\`P0#!`,``P`#"`/X`P@#``,``P`#``,`!X```````````````````````/ +MP!!@("`@`&``8`!@`&``8?!@8"!@,&`88`^``````````````````````/#P +M8&!@8&!@8&!@8'_@8&!@8&!@8&!@8&!@\/``````````````````````'X`& +M``8`!@`&``8`!@`&``8`!@`&``8`!@`?@``````````````````````?@`8` +M!@`&``8`!@`&``8`!@`&``8`!@`&``8`!@`&``0`.``P`````````/#@88!C +M`&8`;`!X`'@`?`!N`&<`8X!AP&#@\'``````````````````````>``P`#`` +M,``P`#``,``P`#``,``P`#`@,"!_X`````````````````````#@<&#@<.!P +MX'#@66!98%E@36!.8$Y@1&!$8.3P`````````````````````,!P8"!P('@@ +M6"!,($8@1R!#($&@0.!`X$!@X#``````````````````````#P`1P"#`(&!@ +M8&!@8&!@8&!@8&`@0#!`&(`/``````````````````````!_@##`,&`P8#!@ +M,,`W@#``,``P`#``,``P`'@```````````````````````\`$<`@P"!@8&!@ +M8&!@8&!@8&!@,$`X0!^`#@`?`".0`>``````````````_P!A@&#`8,!@P&"` +M?P!\`&X`9P!C@&'`8.#P<``````````````````````?X#!@8"!@('``/``> +M``>``<``X$!@0&!@P'^``````````````````````'_@1B`&``8`!@`&``8` +M!@`&``8`!@`&``8`'X``````````````````````\'!@(&`@8"!@(&`@8"!@ +M(&`@8"!@('!`/\`?@`````````````````````#@X&!`,(`P@#"`&0`9`!D` +M#``.``X`!``$``0``````````````````````/[P9B!F(&8@=B!W0#-`-T`[ +MP#N`&8`9@!F`&8``````````````````````\'!@(#!`.(`8@`T`!@`&``L` +M$8`1P"#`0&#@\`````````````````````#P<&`@,$`8@!B`#0`&``8`!@`& +M``8`!@`&``\``````````````````````#_@(,``P`&``8`#``,`!@`&``P` +M#``8`!@@/^````````````````````?`!\`&``8`!@`&``8`!@`&``8`!@`& +M``8`!\`'P```````````````````8`!@`#``,``8`!@`#``,``8``P`#``&` +M`8``P`#```````````````````!\`'P`#``,``P`#``,``P`#``,``P`#``, +M`'P`?`````````````````````0`#@`;`#&`8,`````````````````````` +M```````````````````````````````````````````````````````````` +M``````#_X/_@```````````!``,`!@`&``>`!X`#```````````````````` +M```````````````````````````````````/@!C`$,`#P!S`,,`PP##`.<`> +MX```````````````````(`!@`.``8`!@`&>`;\!PX&!@8&!@8&!@<&!XP$^` +M````````````````````````````````'X`QP"#`8`!@`&``8`!P0##`'X`` +M``````````````````!@`.``8`!@`&`/8#'@(.!@8&!@8&!@8'#@.6`><``` +M``````````````````````````````\`,,!@8&!@?^!@`&``,``88`^````` +M```````````````#@`3`!,`,``P`#``,`!^`#``,``P`#``,``P`'@`````` +M```````````````````````````?(#'@8,!@P&#`,8`_`&``?\`_X"!@0"!` +M('_`/X``````$``P`'``,``P`#>`.<`PP##`,,`PP##`,,`PP'G@```````` +M``````````````8`!@``````'@`&``8`!@`&``8`!@`&``8`'X`````````` +M`````````````,``P``````#P`#``,``P`#``,``P`#``,``P"#`,,`X@!\` +M#@``````8`#@`&``8`!@`&'`8P!F`'P`>`!\`&X`9P!C@/'@```````````` +M```````>``8`!@`&``8`!@`&``8`!@`&``8`!@`&``8`'X`````````````` +M``````````````````#=P&[@9F!F8&9@9F!F8&9@9F#O<``````````````` +M`````````````````">`><`PP##`,,`PP##`,,`PP'G@```````````````` +M````````````````#X`1P"#@8&!@8&!@8&!P0#B`'P`````````````````` +M``````````````#O@''`8.!@8&!@8&!@8&!`<(!_`&``8`!@`&``\``````` +M``````````````\@$>`@X&!@8&!@8&!@<&`XX!_@`&``8`!@`&``\``````` +M``````````````````````````````````` +M```````````?P##`,$`X`!X`!X`!P"#`,,`_@``````````````````````` +M``0`!``,`'_`#``,``P`#``,``P`#"`.0`>````````````````````````` +M````````>>`PP##`,,`PP##`,,`PP#G`'F`````````````````````````` +M``````#P<&`@,$`P0!B`&(`-``T`!@`&```````````````````````````` +M`````/]P9B!F(&8@-T`[0#M`&8`9@!F````````````````````````````` +M````^/!P0#B`'0`.``<`"X`1P"#@\?`````````````````````````````` +M``#P\&`@,$`P0!B`&(`-``T`!@`&``0`#``(`'@`<``````````````````` +M`'_@8.!!P`.`!P`.`!P`."!P8'_@```````````````````!P`,``P`!@`&` +M`8`#``<``P`!@`&``8`#``,``<````````````````````8`!@`&``8`!@`& +M``8`!@`&``8`!@`&``8`!@`&``8`!@`&``8`!@``````.``,``P`&``8`!@` +M#``.``P`&``8`!@`#``,`#@````````````````````````````````````` +M````'"`^8#;`9\!#@```````````````````JJ!54*J@55"JH%50JJ!54*J@ +M55"JH%50JJ!54*J@55"JH%50JJ!54*J@55`````````&``8```````8`!@`& +M``8`!@`&``8`!@`&``8`!@````````````````````$``0`#``(`'P`W@"6` +M9`!L`&@`>(`Y@!\`$``P`"``(``````````&``P`$``0`#``,``P`#X`?``8 +M`!@`&``8`#\@/^`QP```````````````````````````8"!W0#N`$<`PP##` +M.(`=P"[@0&```````````````````````````/!P8"`P0!B`&(`-``8`/\`& +M`#_`!@`&``8`#P````````````````````8`!@`&``8`!@`&``8`!@`&```` +M```&``8`!@`&``8`!@`&``8`!@``````#^`88#`@."`>`!^`,`0P`;`!L`&P`;`!L`&P`;````````` +M````````````````````````````````!@`/``\`!@`````````````````` +M``````````````````````````````````````````````````(``P`!@`F` +M!P`````````&``X`#@`&``8`!@`&``8`#P`````````````````````````` +M``````````<`"X`1P##`,,`X@!T`#@``````/^!_P``````````````````` +M`````````````````````&8`,P`9@`S`"(`1`"(`1``````````````````` +M`!@`.``X`!@`&"`88!C`&8`_0`;`#<`9P#+`9,!'X`#``,`````````````` +M&``X`#@`&``8(!A@&,`9@#_`!^`/8!I@,,!A@$,``^`#X``````````````X +M`'P`3``,`!@@#&!,P'V`.T`&P`W`&<`RP&3`1^``P`#````````````````` +M```#``,```````,``P`&``P`&``P`#``,$`YP!^`#P```````````!P`#P`# +M@`8`!@`+``L`"0`1@!&`$(`_P"#`($!`8$!@X/```````````````X`/`!P` +M!@`&``L`"P`)`!&`$8`0@#_`(,`@0$!@0&#@\``````````````&``\`&8`& +M``8`"P`+``D`$8`1@!"`/\`@P"!`0&!`8.#P``````````````S`'X`S``8` +M!@`+``L`"0`1@!&`$(`_P"#`($!`8$!@X/``````````````&8`9@```!@`& +M``L`"P`)`!&`$8`0@#_`(,`@0$!@0&#@\``````````````&``\`&8`/``8` +M"P`+``D`$8`1@!"`/\`@P"!`0&!`8.#P``````````````````````_@#B`6 +M(!8`%@`60"?`)D`^`"8`1@!&$$80Y_``````````````````````#\`08"`@ +M(`!@`&``8`!@`&``8``@`#`@&$`/@`(``P`!@`F`!P`<``\``X!_P#!`,$`P +M`#``,(`_@#"`,``P`#``,"`P('_@``````````````.`#P`<`'_`,$`P0#`` +M,``P@#^`,(`P`#``,``P(#`@?^``````````````!@`/`!F`?\`P0#!`,``P +M`#"`/X`P@#``,``P`#`@,"!_X``````````````9@!F```!_P#!`,$`P`#`` +M,(`_@#"`,``P`#``,"`P('_@`````````````!P`#P`#@!^`!@`&``8`!@`& +M``8`!@`&``8`!@`&``8`'X```````````````X`/`!P`'X`&``8`!@`&``8` +M!@`&``8`!@`&``8`!@`?@``````````````&``\`&8`?@`8`!@`&``8`!@`& +M``8`!@`&``8`!@`&`!^``````````````!F`&8```!^`!@`&``8`!@`&``8` +M!@`&``8`!@`&``8`'X``````````````````````_P!AP&#`8&!@8&!@^&#X +M8&!@8&!@8&!`88#^```````````````,P!^`,P#`<&`@<"!X(%@@3"!&($<@ +M0R!!H$#@0.!`8.`P`````````````!P`#P`#@`\`$<`@P"!@8&!@8&!@8&!@ +M8&!@($`P0!B`#P```````````````X`/`!P`#P`1P"#`(&!@8&!@8&!@8&!@ +M8&`@0#!`&(`/```````````````&``\`&8`/`!'`(,`@8&!@8&!@8&!@8&!@ +M8"!`,$`8@`\```````````````S`'X`S``\`$<`@P"!@8&!@8&!@8&!@8&!@ +M($`P0!B`#P``````````````&8`9@```#P`1P"#`(&!@8&!@8&!@8&!@8&`@ +M0#!`&(`/`````````````````````````````````&!@,,`9@`\`!@`/`!F` +M,,!@8```````````````````````8`_`$<`AP"'@8V!C8&9@;&!L8'A@.$`P +M0#B`;P``````````````'``/``.`\'!@(&`@8"!@(&`@8"!@(&`@8"!@('!` +M/\`?@``````````````#@`\`'`#P<&`@8"!@(&`@8"!@(&`@8"!@(&`@<$`_ +MP!^```````````````8`#P`9@/!P8"!@(&`@8"!@(&`@8"!@(&`@8"!P0#_` +M'X``````````````&8`9@```\'!@(&`@8"!@(&`@8"!@(&`@8"!@('!`/\`? +M@``````````````#@`\`'`#P<&`@,$`8@!B`#0`&``8`!@`&``8`!@`&``\` +M`````````````````````'@`,``P`#^`,,`P8#!@,&`P8##`/X`P`#``>``` +M``````````````````\`&8`9@#&`,8`S@#8`-@`V`#.`,<`PX#1@-F!WP``` +M```````````````````<``\``X````^`&,`0P`/`',`PP##`,,`YP![@```` +M``````````````````.`#P`<````#X`8P!#``\`X``````` +M```````````````,P!^`,P````^`&,`0P`/`',`PP##`,,`YP![@```````` +M`````````````!F`&8``````#X`8P!#``\`X``````````` +M`````````````````````!^`-D`F8`Y@/^!F`&8`9@!G8#_````````````` +M````````````````````'X`QP"#`8`!@`&``8`!P0##`'X`"``,``8`)@`<` +M````````'``/``.````/`##`8&!@8'_@8`!@`#``&&`/@``````````````` +M```````#@`\`'`````\`,,!@8&!@?^!@`&``,``88`^````````````````` +M``````8`#P`9@```#P`PP&!@8&!_X&``8``P`!A@#X`````````````````` +M````&8`9@``````/`##`8&!@8'_@8`!@`#``&&`/@``````````````````` +M```<``\``X```!X`!@`&``8`!@`&``8`!@`&`!^````````````````````` +M``.`#P`<````'@`&``8`!@`&``8`!@`&``8`'X`````````````````````` +M!@`/`!F````>``8`!@`&``8`!@`&``8`!@`?@``````````````````````9 +M@!F``````!X`!@`&``8`!@`&``8`!@`&`!^````````````````````PP!^` +M!@`?`#&``<`/P!#@(.!@8&!@8&!P0#B`'P``````````````````````#,`? +M@#,````G@'G`,,`PP##`,,`PP##`,,!YX``````````````````````<``\` +M`X````^`$<`@X&!@8&!@8&!@<$`X@!\```````````````````````.`#P`< +M````#X`1P"#@8&!@8&!@8&!P0#B`'P``````````````````````!@`/`!F` +M```/@!'`(.!@8&!@8&!@8'!`.(`?```````````````````````,P!^`,P`` +M``^`$<`@X&!@8&!@8&!@<$`X@!\``````````````````````!F`&8`````` +M#X`1P"#@8&!@8&!@8&!P0#B`'P`````````````````````````````````& +M``8``````'_@?^``````!@`&``````````````````````````````````_@ +M$<`AX&-@9F!F8&Q@>$`X@'\``````````````````````!P`#P`#@```>>`P +MP##`,,`PP##`,,`PP#G`'F```````````````````````X`/`!P```!YX##` +M,,`PP##`,,`PP##`.<`>8``````````````````````&``\`&8```'G@,,`P +MP##`,,`PP##`,,`YP!Y@`````````````````````!F`&8``````>>`PP##` +M,,`PP##`,,`PP#G`'F```````````````````````X`/`!P```#P\&`@,$`P +M0!B`&(`-``T`!@`&``0`#``(`'@`<```````X`!@`&``8`!@`&^`< diff --git a/share/vt/keymaps/pl.kbd b/share/vt/keymaps/pl.kbd new file mode 100644 index 00000000000..ebbf8e9e408 --- /dev/null +++ b/share/vt/keymaps/pl.kbd @@ -0,0 +1,116 @@ +# Polish ISO-8859-2 keymap by Krzysztof Mlynarski (17:46 27-04-1996 MET DST) +# (krzysio@hydra.mimuw.edu.pl) +# $FreeBSD$ +# alt +# scan cntrl alt alt cntrl lock +# code base shift cntrl shift alt shift cntrl shift state +# ------------------------------------------------------------------ + 000 nop nop nop nop nop nop nop nop O + 001 esc esc esc esc esc esc debug esc O + 002 '1' '!' nop nop '1' '!' nop nop O + 003 '2' '@' nul nul '2' '@' nul nul O + 004 '3' '#' nop nop '3' '#' nop nop O + 005 '4' '$' nop nop '4' '$' nop nop O + 006 '5' '%' nop nop '5' '%' nop nop O + 007 '6' '^' rs rs '6' '^' rs rs O + 008 '7' '&' nop nop '7' '&' nop nop O + 009 '8' '*' nop nop '8' '*' nop nop O + 010 '9' '(' nop nop '9' '(' nop nop O + 011 '0' ')' nop nop '0' ')' nop nop O + 012 '-' '_' us us '-' '_' us us O + 013 '=' '+' nop nop '=' '+' nop nop O + 014 bs bs del del bs bs del del O + 015 ht btab nop nop ht btab nop nop O + 016 'q' 'Q' dc1 dc1 'q' 'Q' dc1 dc1 C + 017 'w' 'W' etb etb 'w' 'W' etb etb C + 018 'e' 'E' enq enq 281 280 enq enq C + 019 'r' 'R' dc2 dc2 'r' 'R' dc2 dc2 C + 020 't' 'T' dc4 dc4 't' 'T' dc4 dc4 C + 021 'y' 'Y' em em 'y' 'Y' em em C + 022 'u' 'U' nak nak 'u' 'U' nak nak C + 023 'i' 'I' ht ht 'i' 'I' ht ht C + 024 'o' 'O' si si 243 211 si si C + 025 'p' 'P' dle dle 'p' 'P' dle dle C + 026 '[' '{' esc esc '[' '{' esc esc O + 027 ']' '}' gs gs ']' '}' gs gs O + 028 cr cr nl nl cr cr nl nl O + 029 lctrl lctrl lctrl lctrl lctrl lctrl lctrl lctrl O + 030 'a' 'A' soh soh 261 260 soh soh C + 031 's' 'S' dc3 dc3 347 346 dc3 dc3 C + 032 'd' 'D' eot eot 'd' 'D' eot eot C + 033 'f' 'F' ack ack 'f' 'F' ack ack C + 034 'g' 'G' bel bel 'g' 'G' bel bel C + 035 'h' 'H' bs bs 'h' 'H' bs bs C + 036 'j' 'J' nl nl 'j' 'J' nl nl C + 037 'k' 'K' vt vt 'k' 'K' vt vt C + 038 'l' 'L' ff ff 322 321 ff ff C + 039 ';' ':' nop nop ';' ':' nop nop O + 040 ''' '"' nop nop ''' '"' nop nop O + 041 '`' '~' nop nop '`' '~' nop nop O + 042 lshift lshift lshift lshift lshift lshift lshift lshift O + 043 '\' '|' fs fs '\' '|' fs fs O + 044 'z' 'Z' sub sub 380 379 sub sub C + 045 'x' 'X' can can 378 377 can can C + 046 'c' 'C' etx etx 263 262 etx etx C + 047 'v' 'V' syn syn 'v' 'V' syn syn C + 048 'b' 'B' stx stx 'b' 'B' stx stx C + 049 'n' 'N' so so 324 323 so so C + 050 'm' 'M' cr cr 'm' 'M' cr cr C + 051 ',' '<' nop nop ',' '<' nop nop O + 052 '.' '>' nop nop '.' '>' nop nop O + 053 '/' '?' nop nop '/' '?' nop nop O + 054 rshift rshift rshift rshift rshift rshift rshift rshift O + 055 '*' '*' '*' '*' '*' '*' '*' '*' O + 056 lalt lalt lalt lalt lalt lalt lalt lalt O + 057 ' ' ' ' nul ' ' ' ' ' ' susp ' ' O + 058 clock clock clock clock clock clock clock clock O + 059 fkey01 fkey13 fkey25 fkey37 scr01 scr11 scr01 scr11 O + 060 fkey02 fkey14 fkey26 fkey38 scr02 scr12 scr02 scr12 O + 061 fkey03 fkey15 fkey27 fkey39 scr03 scr13 scr03 scr13 O + 062 fkey04 fkey16 fkey28 fkey40 scr04 scr14 scr04 scr14 O + 063 fkey05 fkey17 fkey29 fkey41 scr05 scr15 scr05 scr15 O + 064 fkey06 fkey18 fkey30 fkey42 scr06 scr16 scr06 scr16 O + 065 fkey07 fkey19 fkey31 fkey43 scr07 scr07 scr07 scr07 O + 066 fkey08 fkey20 fkey32 fkey44 scr08 scr08 scr08 scr08 O + 067 fkey09 fkey21 fkey33 fkey45 scr09 scr09 scr09 scr09 O + 068 fkey10 fkey22 fkey34 fkey46 scr10 scr10 scr10 scr10 O + 069 nlock nlock nlock nlock nlock nlock nlock nlock O + 070 slock slock slock slock slock slock slock slock O + 071 fkey49 '7' '7' '7' '7' '7' '7' '7' N + 072 fkey50 '8' '8' '8' '8' '8' '8' '8' N + 073 fkey51 '9' '9' '9' '9' '9' '9' '9' N + 074 fkey52 '-' '-' '-' '-' '-' '-' '-' N + 075 fkey53 '4' '4' '4' '4' '4' '4' '4' N + 076 fkey54 '5' '5' '5' '5' '5' '5' '5' N + 077 fkey55 '6' '6' '6' '6' '6' '6' '6' N + 078 fkey56 '+' '+' '+' '+' '+' '+' '+' N + 079 fkey57 '1' '1' '1' '1' '1' '1' '1' N + 080 fkey58 '2' '2' '2' '2' '2' '2' '2' N + 081 fkey59 '3' '3' '3' '3' '3' '3' '3' N + 082 fkey60 '0' '0' '0' '0' '0' '0' '0' N + 083 del '.' '.' '.' '.' '.' boot boot N + 084 nop nop nop nop nop nop nop nop O + 085 nop nop nop nop nop nop nop nop O + 086 nop nop nop nop nop nop nop nop O + 087 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O + 088 fkey12 fkey24 fkey36 fkey48 scr12 scr12 scr12 scr12 O + 089 cr cr cr cr cr cr cr cr O + 090 rctrl rctrl rctrl rctrl rctrl rctrl rctrl rctrl O + 091 '/' '/' '/' '/' '/' '/' '/' '/' O + 092 nscr pscr debug debug nop nop nop nop O + 093 ralt ralt ralt ralt ralt ralt ralt ralt O + 094 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 O + 095 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 O + 096 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 O + 097 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 O + 098 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 O + 099 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 O + 100 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 O + 101 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 O + 102 fkey60 paste fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 O + 103 fkey61 fkey61 fkey61 fkey61 fkey61 fkey61 boot fkey61 O + 104 slock saver slock saver susp nop susp nop O + 105 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 O + 106 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 O + 107 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 O + 108 nop nop nop nop nop nop nop nop O diff --git a/share/vt/keymaps/ua.kbd b/share/vt/keymaps/ua.kbd new file mode 100644 index 00000000000..a93800fe520 --- /dev/null +++ b/share/vt/keymaps/ua.kbd @@ -0,0 +1,242 @@ +# $FreeBSD$ +# alt +# scan cntrl alt alt cntrl lock +# code base shift cntrl shift alt shift cntrl shift state +# ------------------------------------------------------------------ + 000 nop nop nop nop nop nop nop nop O + 001 esc esc esc esc esc esc debug nop O + 002 '1' '!' nop nop '1' '!' nop nop O + 003 '2' '@' nul nul '2' '"' nul nul O + 004 '3' '#' nop nop '3' '/' nop nop O + 005 '4' '$' nop nop '4' '$' nop nop O + 006 '5' '%' nop nop '5' ':' nop nop O + 007 '6' '^' rs rs '6' ',' rs rs O + 008 '7' '&' nop nop '7' '.' nop nop O + 009 '8' '*' nop nop '8' ';' nop nop O + 010 '9' '(' nop nop '9' '?' nop nop O + 011 '0' ')' nop nop '0' '%' nop nop O + 012 '-' '_' ns ns '-' '_' ns ns O + 013 '=' '+' nop nop '=' '+' nop nop O + 014 bs bs del del bs bs del del O + 015 ht btab nop nop btab btab nop nop O + 016 'q' 'Q' dc1 dc1 1081 1049 dc1 dc1 C + 017 'w' 'W' etb etb 1094 1062 etb etb C + 018 'e' 'E' enq enq 1091 1059 enq enq C + 019 'r' 'R' dc2 dc2 1082 1050 dc2 dc2 C + 020 't' 'T' dc4 dc4 1077 1045 dc4 dc4 C + 021 'y' 'Y' em em 1085 1053 em em C + 022 'u' 'U' nak nak 1075 1043 nak nak C + 023 'i' 'I' ht ht 1096 1064 ht ht C + 024 'o' 'O' si si 1097 1065 si si C + 025 'p' 'P' dle dle 1079 1047 dle dle C + 026 '[' '{' esc esc 1093 1061 esc esc O + 027 ']' '}' gs gs 1111 1031 1098 1066 O + 028 cr cr nl nl cr cr nl nl O + 029 lctrl lctrl lctrl lctrl lctrl lctrl lctrl lctrl O + 030 'a' 'A' soh soh 1092 1060 soh soh C + 031 's' 'S' dc3 dc3 1110 1030 1099 1067 C + 032 'd' 'D' eot eot 1074 1042 eot eot C + 033 'f' 'F' ack ack 1072 1040 ack ack C + 034 'g' 'G' bel bel 1087 1055 bel bel C + 035 'h' 'H' bs bs 1088 1056 bs bs C + 036 'j' 'J' nl nl 1086 1054 nl nl C + 037 'k' 'K' vt vt 1083 1051 vt vt C + 038 'l' 'L' ff ff 1076 1044 ff ff C + 039 ';' ':' nop nop 1078 1046 nop nop O + 040 ''' '"' nop nop 1108 1028 1101 1069 O + 041 '`' '~' nop nop 1169 1168 1105 1025 O + 042 lshift lshift lshift lshift lshift lshift lshift lshift O + 043 '\' '|' fs fs '\' '|' fs fs O + 044 'z' 'Z' sub sub 1103 1071 sub sub C + 045 'x' 'X' can can 1095 1063 can can C + 046 'c' 'C' etx etx 1089 1057 etx etx C + 047 'v' 'V' syn syn 1084 1052 syn syn C + 048 'b' 'B' stx stx 1080 1048 stx stx C + 049 'n' 'N' so so 1090 1058 so so C + 050 'm' 'M' cr cr 1100 1068 cr cr C + 051 ',' '<' nop nop 1073 1041 nop nop O + 052 '.' '>' nop nop 1102 1070 nop nop O + 053 '/' '?' nop nop '/' '?' nop nop O + 054 rshift rshift rshift rshift rshift rshift rshift rshift O + 055 '*' '*' nl nl '*' '*' nl nl O + 056 lalt lalt lalt lalt lalt lalt lalt lalt O + 057 ' ' ' ' nul ' ' ' ' ' ' susp ' ' O + 058 alock clock clock clock clock clock clock clock O + 059 fkey01 fkey13 fkey25 fkey37 scr01 scr11 scr01 scr11 O + 060 fkey02 fkey14 fkey26 fkey38 scr02 scr12 scr02 scr12 O + 061 fkey03 fkey15 fkey27 fkey39 scr03 scr13 fkey90 scr13 O + 062 fkey04 fkey16 fkey28 fkey40 scr04 scr14 fkey91 scr14 O + 063 fkey05 fkey17 fkey29 fkey41 scr05 scr15 fkey92 scr15 O + 064 fkey06 fkey18 fkey30 fkey42 scr06 scr16 scr06 scr16 O + 065 fkey07 fkey19 fkey31 fkey43 scr07 scr07 scr07 scr07 O + 066 fkey08 fkey20 fkey32 fkey44 scr08 scr08 scr08 scr08 O + 067 fkey09 fkey21 fkey33 fkey45 scr09 scr09 scr09 scr09 O + 068 fkey10 fkey22 fkey34 fkey46 scr10 scr10 scr10 scr10 O + 069 nlock nlock nlock nlock nlock nlock nlock nlock O + 070 slock slock slock slock slock slock slock slock O + 071 fkey49 '7' '7' '7' '7' '7' '7' '7' N + 072 fkey50 '8' '8' '8' '8' '8' '8' '8' N + 073 fkey51 '9' '9' '9' '9' '9' '9' '9' N + 074 fkey52 '-' '-' '-' '-' '-' '-' '-' N + 075 fkey53 '4' '4' '4' '4' '4' '4' '4' N + 076 fkey54 '5' '5' '5' '5' '5' '5' '5' N + 077 fkey55 '6' '6' '6' '6' '6' '6' '6' N + 078 fkey56 '+' '+' '+' '+' '+' '+' '+' N + 079 fkey57 '1' '1' '1' '1' '1' '1' '1' N + 080 fkey58 '2' '2' '2' '2' '2' '2' '2' N + 081 fkey59 '3' '3' '3' '3' '3' '3' '3' N + 082 fkey60 '0' '0' '0' '0' '0' '0' '0' N + 083 del '.' '.' '.' '.' '.' boot boot N + 084 alock alock alock alock alock alock alock alock O + 085 nop nop nop nop nop nop nop nop O + 086 nop nop nop nop nop nop nop nop O + 087 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O + 088 fkey12 fkey24 fkey36 fkey48 scr12 scr12 scr12 scr12 O + 089 cr cr nl nl cr cr nl nl O + 090 rctrl rctrl rctrl rctrl rctrl rctrl rctrl rctrl O + 091 '/' '/' '/' '/' '/' '/' '/' '/' O + 092 nscr pscr debug nop nop nop nop nop O + 093 ralt ralt ralt ralt ralt ralt ralt ralt O + 094 fkey49 fkey49 fkey69 fkey49 fkey49 fkey49 fkey49 fkey49 O + 095 fkey50 fkey50 fkey70 fkey50 fkey50 fkey50 fkey50 fkey50 O + 096 fkey51 fkey51 fkey71 fkey51 fkey51 fkey51 fkey51 fkey51 O + 097 fkey53 fkey53 fkey73 fkey53 fkey53 fkey53 fkey53 fkey53 O + 098 fkey55 fkey55 fkey75 fkey55 fkey55 fkey55 fkey55 fkey55 O + 099 fkey57 fkey57 fkey77 fkey57 fkey57 fkey57 fkey57 fkey57 O + 100 fkey58 fkey58 fkey78 fkey58 fkey58 fkey58 fkey58 fkey58 O + 101 fkey59 fkey59 fkey79 fkey59 fkey59 fkey59 fkey59 fkey59 O + 102 fkey60 paste fkey80 fkey60 fkey60 fkey60 fkey60 fkey60 O + 103 del del fkey81 del fkey61 fkey61 boot boot O + 104 slock slock slock slock slock slock slock slock O + 105 meta fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 O + 106 meta fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 O + 107 meta fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 O + 108 nop nop nop nop nop nop nop nop O + 109 nop nop nop nop nop nop nop nop O + 110 nop nop nop nop nop nop nop nop O + 111 nop nop nop nop nop nop nop nop O + 112 nop nop nop nop nop nop nop nop O + 113 nop nop nop nop nop nop nop nop O + 114 nop nop nop nop nop nop nop nop O + 115 nop nop nop nop nop nop nop nop O + 116 nop nop nop nop nop nop nop nop O + 117 nop nop nop nop nop nop nop nop O + 118 nop nop nop nop nop nop nop nop O + 119 nop nop nop nop nop nop nop nop O + 120 nop nop nop nop nop nop nop nop O + 121 nop nop nop nop nop nop nop nop O + 122 nop nop nop nop nop nop nop nop O + 123 nop nop nop nop nop nop nop nop O + 124 nop nop nop nop nop nop nop nop O + 125 nop nop nop nop nop nop nop nop O + 126 nop nop nop nop nop nop nop nop O + 127 nop nop nop nop nop nop nop nop O +# + 128 nop nop nop nop nop nop nop nop O + 129 esc esc esc esc esc esc debug esc O + 130 '1' '!' nop nop '1' '!' nop nop O + 131 '2' '"' nul nul '2' '@' nul nul O + 132 '3' '/' nop nop '3' '#' nop nop O + 133 '4' '$' nop nop '4' '$' nop nop O + 134 '5' ':' nop nop '5' '%' nop nop O + 135 '6' ',' rs rs '6' '^' rs rs O + 136 '7' '.' nop nop '7' '&' nop nop O + 137 '8' ';' nop nop '8' '*' nop nop O + 138 '9' '?' nop nop '9' '(' nop nop O + 139 '0' '%' nop nop '0' ')' nop nop O + 140 '-' '_' ns ns '-' '_' ns ns O + 141 '=' '+' nop nop '=' '+' nop nop O + 142 bs bs del del bs bs del del O + 143 ht btab nop nop btab btab nop nop O + 144 1081 1049 dc1 dc1 'q' 'Q' dc1 dc1 C + 145 1094 1062 etb etb 'w' 'W' etb etb C + 146 1091 1059 enq enq 'e' 'E' enq enq C + 147 1082 1050 dc2 dc2 'r' 'R' dc2 dc2 C + 148 1077 1045 dc4 dc4 't' 'T' dc4 dc4 C + 149 1085 1053 em em 'y' 'Y' em em C + 150 1075 1043 nak nak 'u' 'U' nak nak C + 151 1096 1064 ht ht 'i' 'I' ht ht C + 152 1097 1065 si si 'o' 'O' si si C + 153 1079 1047 dle dle 'p' 'P' dle dle C + 154 1093 1061 esc esc '[' '{' esc esc C + 155 1111 1031 gs gs ']' '}' 1098 1066 C + 156 cr cr nl nl cr cr nl nl O + 157 lctrl lctrl lctrl lctrl lctrl lctrl lctrl lctrl O + 158 1092 1060 soh soh 'a' 'A' soh soh C + 159 1110 1030 dc3 dc3 's' 'S' 1099 1067 C + 160 1074 1042 eot eot 'd' 'D' eot eot C + 161 1072 1040 ack ack 'f' 'F' ack ack C + 162 1087 1055 bel bel 'g' 'G' bel bel C + 163 1088 1056 bs bs 'h' 'H' bs bs C + 164 1086 1054 nl nl 'j' 'J' nl nl C + 165 1083 1051 vt vt 'k' 'K' vt vt C + 166 1076 1044 ff ff 'l' 'L' ff ff C + 167 1078 1046 nop nop ';' ':' nop nop C + 168 1108 1028 nop nop ''' '"' 1101 1069 C + 169 1169 1168 nop nop '`' '~' 1105 1025 C + 170 lshift lshift lshift lshift lshift lshift lshift lshift O + 171 '\' '|' fs fs '\' '|' fs fs O + 172 1103 1071 sub sub 'z' 'Z' sub sub C + 173 1095 1063 can can 'x' 'X' can can C + 174 1089 1057 etx etx 'c' 'C' etx etx C + 175 1084 1052 syn syn 'v' 'V' syn syn C + 176 1080 1048 stx stx 'b' 'B' stx stx C + 177 1090 1058 so so 'n' 'N' so so C + 178 1100 1068 cr cr 'm' 'M' cr cr C + 179 1073 1041 nop nop ',' '<' nop nop C + 180 1102 1070 nop nop '.' '>' nop nop C + 181 '/' '?' nop nop '/' '?' nop nop O + 182 rshift rshift rshift rshift rshift rshift rshift rshift O + 183 '*' '*' nl nl '*' '*' nl nl O + 184 lalt lalt lalt lalt lalt lalt lalt lalt O + 185 ' ' ' ' nul ' ' ' ' ' ' ' ' susp O + 186 alock clock clock clock clock clock clock clock O + 187 fkey01 fkey13 fkey25 fkey37 scr01 scr11 scr01 scr11 O + 188 fkey02 fkey14 fkey26 fkey38 scr02 scr12 scr02 scr12 O + 189 fkey03 fkey15 fkey27 fkey39 scr03 scr13 fkey90 scr13 O + 190 fkey04 fkey16 fkey28 fkey40 scr04 scr14 fkey91 scr14 O + 191 fkey05 fkey17 fkey29 fkey41 scr05 scr15 fkey92 scr15 O + 192 fkey06 fkey18 fkey30 fkey42 scr06 scr16 scr06 scr16 O + 193 fkey07 fkey19 fkey31 fkey43 scr07 scr07 scr07 scr07 O + 194 fkey08 fkey20 fkey32 fkey44 scr08 scr08 scr08 scr08 O + 195 fkey09 fkey21 fkey33 fkey45 scr09 scr09 scr09 scr09 O + 196 fkey10 fkey22 fkey34 fkey46 scr10 scr10 scr10 scr10 O + 197 nlock nlock nlock nlock nlock nlock nlock nlock O + 198 slock slock slock slock slock slock slock slock O + 199 fkey49 '7' '7' '7' '7' '7' '7' '7' N + 200 fkey50 '8' '8' '8' '8' '8' '8' '8' N + 201 fkey51 '9' '9' '9' '9' '9' '9' '9' N + 202 fkey52 '-' '-' '-' '-' '-' '-' '-' N + 203 fkey53 '4' '4' '4' '4' '4' '4' '4' N + 204 fkey54 '5' '5' '5' '5' '5' '5' '5' N + 205 fkey55 '6' '6' '6' '6' '6' '6' '6' N + 206 fkey56 '+' '+' '+' '+' '+' '+' '+' N + 207 fkey57 '1' '1' '1' '1' '1' '1' '1' N + 208 fkey58 '2' '2' '2' '2' '2' '2' '2' N + 209 fkey59 '3' '3' '3' '3' '3' '3' '3' N + 210 fkey60 '0' '0' '0' '0' '0' '0' '0' N + 211 del '.' '.' '.' '.' '.' boot boot N + 212 alock alock alock alock alock alock alock alock O + 213 nop nop nop nop nop nop nop nop O + 214 nop nop nop nop nop nop nop nop O + 215 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O + 216 fkey12 fkey24 fkey36 fkey48 scr12 scr12 scr12 scr12 O + 217 cr cr nl nl cr cr nl nl O + 218 rctrl rctrl rctrl rctrl rctrl rctrl rctrl rctrl O + 219 '/' '/' '/' '/' '/' '/' '/' '/' O + 220 nscr pscr debug nop nop nop nop nop O + 221 ralt ralt ralt ralt ralt ralt ralt ralt O + 222 fkey49 fkey49 fkey69 fkey49 fkey49 fkey49 fkey49 fkey49 O + 223 fkey50 fkey50 fkey70 fkey50 fkey50 fkey50 fkey50 fkey50 O + 224 fkey51 fkey51 fkey71 fkey51 fkey51 fkey51 fkey51 fkey51 O + 225 fkey53 fkey53 fkey73 fkey53 fkey53 fkey53 fkey53 fkey53 O + 226 fkey55 fkey55 fkey75 fkey55 fkey55 fkey55 fkey55 fkey55 O + 227 fkey57 fkey57 fkey77 fkey57 fkey57 fkey57 fkey57 fkey57 O + 228 fkey58 fkey58 fkey78 fkey58 fkey58 fkey58 fkey58 fkey58 O + 229 fkey59 fkey59 fkey79 fkey59 fkey59 fkey59 fkey59 fkey59 O + 230 fkey60 paste fkey80 fkey60 fkey60 fkey60 fkey60 fkey60 O + 231 del del fkey81 del fkey61 fkey61 boot boot O + 232 slock slock slock slock slock slock slock slock O + 233 meta fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 O + 234 meta fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 O + 235 meta fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 O diff --git a/share/vt/keymaps/ua.shift.alt.kbd b/share/vt/keymaps/ua.shift.alt.kbd new file mode 100644 index 00000000000..edf1f2592ef --- /dev/null +++ b/share/vt/keymaps/ua.shift.alt.kbd @@ -0,0 +1,254 @@ +# $FreeBSD$ +# +# keyboard mapping for both Ukrainian and Russian languages, koi8-u charset. +# by sia@lot.cs.kiev.ua +# based on ru.koi8-r.kbd by ache@FreeBSD.org +# some additions by petr@i.am and kunia@i.am +# +# it has 'i', 'ye','yi',"g'" at positions of '-','=','\','`'; +# ->`1234567890-=\<- +# ->1234567890<- +# Lwin,Rwin=Meta, Menu=Screensaver +# PrScr=NextScreen, Shift+PrScr=PrevScreen +# Shift+Insert=paste +# alt +# scan cntrl alt alt cntrl lock +# code base shift cntrl shift alt shift cntrl shift state +# ------------------------------------------------------------------ + 000 nop nop nop nop nop nop nop nop O + 001 esc esc nop nop esc esc debug nop O + 002 '1' '!' nop nop '1' '!' nop nop O + 003 '2' '@' nul nul '2' '"' 9472 9472 O + 004 '3' '#' nop nop '3' ''' nop nop O + 005 '4' '$' nop nop '4' ';' nop nop O + 006 '5' '%' nop nop '5' ':' nop nop O + 007 '6' '^' rs rs '6' ',' 183 183 O + 008 '7' '&' nop nop '7' '.' nop nop O + 009 '8' '*' nop nop '8' '*' nop nop O + 010 '9' '(' nop nop '9' '(' nop nop O + 011 '0' ')' nop nop '0' ')' nop nop O + 012 '-' '_' ns ns 1110 1030 247 247 O + 013 '=' '+' nop nop 1108 1028 nop nop O + 014 bs bs del del bs bs 1066 1066 O + 015 ht btab nop nop ht btab nop nop O + 016 'q' 'Q' dc1 dc1 1081 1049 9618 9618 C + 017 'w' 'W' etb etb 1094 1062 8776 8776 C + 018 'e' 'E' enq enq 1091 1059 9496 9496 C + 019 'r' 'R' dc2 dc2 1082 1050 9619 9619 C + 020 't' 'T' dc4 dc4 1077 1045 9632 9632 C + 021 'y' 'Y' em em 1085 1053 8805 8805 C + 022 'u' 'U' nak nak 1075 1043 8729 8729 C + 023 'i' 'I' ht ht 1096 1064 9524 9524 C + 024 'o' 'O' si si 1097 1065 9616 9616 C + 025 'p' 'P' dle dle 1079 1047 9617 9617 C + 026 '[' '{' esc esc 1093 1061 8993 8993 O + 027 ']' '}' gs gs 1098 1066 178 178 O + 028 cr cr nl nl cr cr 9532 9532 O + 029 lctrl lctrl lctrl lctrl lctrl lctrl lctrl lctrl O + 030 'a' 'A' soh soh 1092 1060 9474 9474 C + 031 's' 'S' dc3 dc3 1099 1067 8992 8992 C + 032 'd' 'D' eot eot 1074 1042 9492 9492 C + 033 'f' 'F' ack ack 1072 1040 9500 9500 C + 034 'g' 'G' bel bel 1087 1055 9508 9508 C + 035 'h' 'H' bs bs 1088 1056 9516 9516 C + 036 'j' 'J' nl nl 1086 1054 9532 9532 C + 037 'k' 'K' vt vt 1083 1051 9600 9600 C + 038 'l' 'L' ff ff 1076 1044 9604 9604 C + 039 ';' ':' nop nop 1078 1046 nop nop O + 040 ''' '"' nop nop 1101 1069 nop nop O + 041 '`' '~' nop nop 1169 1168 nop nop O + 042 lshift lshift lshift lshift lshift lshift lshift lshift O + 043 '\' '|' fs fs 1111 1031 176 176 O + 044 'z' 'Z' sub sub 1103 1071 160 160 C + 045 'x' 'X' can can 1095 1063 8804 8804 C + 046 'c' 'C' etx etx 1089 1057 9488 9488 C + 047 'v' 'V' syn syn 1084 1052 8730 8730 C + 048 'b' 'B' stx stx 1080 1048 9484 9484 C + 049 'n' 'N' so so 1090 1058 9612 9612 C + 050 'm' 'M' cr cr 1100 1068 9608 9608 C + 051 ',' '<' nop nop 1073 1041 nop nop O + 052 '.' '>' nop nop 1102 1070 nop nop O + 053 '/' '?' nop nop 1105 1025 nop nop O + 054 rshift rshift rshift rshift rshift rshift rshift rshift O + 055 '*' '*' nl nl '*' '*' 9532 9532 O + 056 lalt lalt lalt lalt lalt lalt lalt lalt O + 057 ' ' ' ' ' ' ' ' ' ' ' ' 9552 9552 O + 058 alock clock clock clock clock clock clock clock O + 059 fkey01 fkey13 fkey25 fkey37 scr01 scr11 scr01 scr11 O + 060 fkey02 fkey14 fkey26 fkey38 scr02 scr12 scr02 scr12 O + 061 fkey03 fkey15 fkey27 fkey39 scr03 scr13 scr03 scr13 O + 062 fkey04 fkey16 fkey28 fkey40 scr04 scr14 scr04 scr14 O + 063 fkey05 fkey17 fkey29 fkey41 scr05 scr15 scr05 scr15 O + 064 fkey06 fkey18 fkey30 fkey42 scr06 scr16 scr06 scr16 O + 065 fkey07 fkey19 fkey31 fkey43 scr07 scr07 scr07 scr07 O + 066 fkey08 fkey20 fkey32 fkey44 scr08 scr08 scr08 scr08 O + 067 fkey09 fkey21 fkey33 fkey45 scr09 scr09 scr09 scr09 O + 068 fkey10 fkey22 fkey34 fkey46 scr10 scr10 scr10 scr10 O + 069 nlock nlock nlock nlock nlock nlock nlock nlock O + 070 slock slock slock slock slock slock slock slock O + 071 fkey49 '7' '7' '7' 1031 1031 1031 1031 N + 072 fkey50 '8' '8' '8' 9574 9574 9574 9574 N + 073 fkey51 '9' '9' '9' 9575 9575 9575 9575 N + 074 fkey52 '-' '-' '-' 1169 1169 1169 1169 N + 075 fkey53 '4' '4' '4' 1028 1028 1028 1028 N + 076 fkey48 '5' '5' '5' 9571 9571 9571 9571 N + 077 fkey55 '6' '6' '6' 1030 1030 1030 1030 N + 078 fkey56 '+' '+' '+' 9562 9562 9562 9562 N + 079 fkey57 '1' '1' '1' 9568 9568 9568 9568 N + 080 fkey58 '2' '2' '2' 9569 9569 9569 9569 N + 081 fkey59 '3' '3' '3' 1025 1025 1025 1025 N + 082 fkey60 '0' '0' '0' 9567 9567 9567 9567 N + 083 fkey54 '.' del del 1066 1066 boot halt N + 084 alock alock alock alock alock alock alock alock O + 085 nop nop nop nop nop nop nop nop O + 086 nop nop nop nop nop nop nop nop O + 087 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O + 088 fkey12 fkey24 fkey36 fkey48 scr12 scr12 scr12 scr12 O + 089 cr cr nl nl 9608 9608 9532 9532 O + 090 alock rctrl rctrl rctrl rctrl rctrl rctrl rctrl O + 091 '/' '/' nop nop 9566 9566 nop nop O + 092 nscr pscr debug nop nop nop nop nop O + 093 ralt ralt ralt ralt ralt ralt ralt ralt O + 094 fkey49 fkey49 fkey69 fkey49 fkey49 fkey49 fkey49 fkey49 O + 095 fkey50 fkey50 fkey70 fkey50 fkey50 fkey50 fkey50 fkey50 O + 096 fkey51 fkey51 fkey71 fkey51 fkey51 fkey51 fkey51 fkey51 O + 097 fkey53 fkey53 fkey73 fkey53 fkey53 fkey53 fkey53 fkey53 O + 098 fkey55 fkey55 fkey75 fkey55 fkey55 fkey55 fkey55 fkey55 O + 099 fkey57 fkey57 fkey77 fkey57 fkey57 fkey57 fkey57 fkey57 O + 100 fkey58 fkey58 fkey78 fkey58 fkey58 fkey58 fkey58 fkey58 O + 101 fkey59 fkey59 fkey79 fkey59 fkey59 fkey59 fkey59 fkey59 O + 102 fkey60 paste fkey80 fkey60 fkey60 fkey60 fkey60 fkey60 O + 103 del del fkey81 del fkey61 fkey61 boot pdwn O + 104 slock saver slock saver susp nop susp nop O + 105 meta fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 O + 106 meta fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 O + 107 saver fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 O + 108 nop nop nop nop nop nop nop nop O + 109 nop nop nop nop nop nop nop nop O + 110 nop nop nop nop nop nop nop nop O + 111 nop nop nop nop nop nop nop nop O + 112 nop nop nop nop nop nop nop nop O + 113 nop nop nop nop nop nop nop nop O + 114 nop nop nop nop nop nop nop nop O + 115 nop nop nop nop nop nop nop nop O + 116 nop nop nop nop nop nop nop nop O + 117 nop nop nop nop nop nop nop nop O + 118 nop nop nop nop nop nop nop nop O + 119 nop nop nop nop nop nop nop nop O + 120 nop nop nop nop nop nop nop nop O + 121 nop nop nop nop nop nop nop nop O + 122 nop nop nop nop nop nop nop nop O + 123 nop nop nop nop nop nop nop nop O + 124 nop nop nop nop nop nop nop nop O + 125 nop nop nop nop nop nop nop nop O + 126 nop nop nop nop nop nop nop nop O + 127 nop nop nop nop nop nop nop nop O + 128 nop nop nop nop nop nop nop nop O + 129 esc esc nop nop esc esc debug nop O + 130 '1' '!' nop nop '1' '!' nop nop O + 131 '2' '"' nul nul '2' '@' 9472 9472 O + 132 '3' ''' nop nop '3' '#' nop nop O + 133 '4' ';' nop nop '4' '$' nop nop O + 134 '5' ':' nop nop '5' '%' nop nop O + 135 '6' ',' rs rs '6' '^' 183 183 O + 136 '7' '.' nop nop '7' '&' nop nop O + 137 '8' '*' nop nop '8' '*' nop nop O + 138 '9' '(' nop nop '9' '(' nop nop O + 139 '0' ')' nop nop '0' ')' nop nop O + 140 1110 1030 ns ns '-' '_' 247 247 O + 141 1108 1028 nop nop '=' '+' nop nop O + 142 bs bs del del bs bs 1066 1066 O + 143 ht btab nop nop ht btab nop nop O + 144 1081 1049 dc1 dc1 'q' 'Q' 9618 9618 C + 145 1094 1062 etb etb 'w' 'W' 8776 8776 C + 146 1091 1059 enq enq 'e' 'E' 9496 9496 C + 147 1082 1050 dc2 dc2 'r' 'R' 9619 9619 C + 148 1077 1045 dc4 dc4 't' 'T' 9632 9632 C + 149 1085 1053 em em 'y' 'Y' 8805 8805 C + 150 1075 1043 nak nak 'u' 'U' 8729 8729 C + 151 1096 1064 ht ht 'i' 'I' 9524 9524 C + 152 1097 1065 si si 'o' 'O' 9616 9616 C + 153 1079 1047 dle dle 'p' 'P' 9617 9617 C + 154 1093 1061 esc esc '[' '{' 8993 8993 C + 155 1098 1066 gs gs ']' '}' 178 178 C + 156 cr cr nl nl cr cr 9532 9532 O + 157 lctrl lctrl lctrl lctrl lctrl lctrl lctrl lctrl O + 158 1092 1060 soh soh 'a' 'A' 9474 9474 C + 159 1099 1067 dc3 dc3 's' 'S' 8992 8992 C + 160 1074 1042 eot eot 'd' 'D' 9492 9492 C + 161 1072 1040 ack ack 'f' 'F' 9500 9500 C + 162 1087 1055 bel bel 'g' 'G' 9508 9508 C + 163 1088 1056 bs bs 'h' 'H' 9516 9516 C + 164 1086 1054 nl nl 'j' 'J' 9532 9532 C + 165 1083 1051 vt vt 'k' 'K' 9600 9600 C + 166 1076 1044 ff ff 'l' 'L' 9604 9604 C + 167 1078 1046 nop nop ';' ':' nop nop C + 168 1101 1069 nop nop ''' '"' nop nop C + 169 1169 1168 nop nop '`' '~' nop nop C + 170 lshift lshift lshift lshift lshift lshift lshift lshift O + 171 1111 1031 fs fs '\' '|' 176 176 O + 172 1103 1071 sub sub 'z' 'Z' 160 160 C + 173 1095 1063 can can 'x' 'X' 8804 8804 C + 174 1089 1057 etx etx 'c' 'C' 9488 9488 C + 175 1084 1052 syn syn 'v' 'V' 8730 8730 C + 176 1080 1048 stx stx 'b' 'B' 9484 9484 C + 177 1090 1058 so so 'n' 'N' 9612 9612 C + 178 1100 1068 cr cr 'm' 'M' 9608 9608 C + 179 1073 1041 nop nop ',' '<' nop nop C + 180 1102 1070 nop nop '.' '>' nop nop C + 181 1105 1025 nop nop '/' '?' nop nop O + 182 rshift rshift rshift rshift rshift rshift rshift rshift O + 183 '*' '*' nl nl '*' '*' 9532 9532 O + 184 lalt lalt lalt lalt lalt lalt lalt lalt O + 185 ' ' ' ' ' ' ' ' ' ' ' ' 9552 9552 O + 186 alock clock clock clock clock clock clock clock O + 187 fkey01 fkey13 fkey25 fkey37 scr01 scr11 scr01 scr11 O + 188 fkey02 fkey14 fkey26 fkey38 scr02 scr12 scr02 scr12 O + 189 fkey03 fkey15 fkey27 fkey39 scr03 scr13 scr03 scr13 O + 190 fkey04 fkey16 fkey28 fkey40 scr04 scr14 scr04 scr14 O + 191 fkey05 fkey17 fkey29 fkey41 scr05 scr15 scr05 scr15 O + 192 fkey06 fkey18 fkey30 fkey42 scr06 scr16 scr06 scr16 O + 193 fkey07 fkey19 fkey31 fkey43 scr07 scr07 scr07 scr07 O + 194 fkey08 fkey20 fkey32 fkey44 scr08 scr08 scr08 scr08 O + 195 fkey09 fkey21 fkey33 fkey45 scr09 scr09 scr09 scr09 O + 196 fkey10 fkey22 fkey34 fkey46 scr10 scr10 scr10 scr10 O + 197 nlock nlock nlock nlock nlock nlock nlock nlock O + 198 slock slock slock slock slock slock slock slock O + 199 fkey49 '7' '7' '7' 1031 1031 1031 1031 N + 200 fkey50 '8' '8' '8' 9574 9574 9574 9574 N + 201 fkey51 '9' '9' '9' 9575 9575 9575 9575 N + 202 fkey52 '-' '-' '-' 1169 1169 1169 1169 N + 203 fkey53 '4' '4' '4' 1028 1028 1028 1028 N + 204 fkey48 '5' '5' '5' 9571 9571 9571 9571 N + 205 fkey55 '6' '6' '6' 1030 1030 1030 1030 N + 206 fkey56 '+' '+' '+' 9562 9562 9562 9562 N + 207 fkey57 '1' '1' '1' 9568 9568 9568 9568 N + 208 fkey58 '2' '2' '2' 9569 9569 9569 9569 N + 209 fkey59 '3' '3' '3' 1025 1025 1025 1025 N + 210 fkey60 '0' '0' '0' 9567 9567 9567 9567 N + 211 del '.' del del 1066 1066 boot halt N + 212 alock alock alock alock alock alock alock alock O + 213 nop nop nop nop nop nop nop nop O + 214 nop nop nop nop nop nop nop nop O + 215 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O + 216 fkey12 fkey24 fkey36 fkey48 scr12 scr12 scr12 scr12 O + 217 cr cr nl nl 9608 9608 9532 9532 O + 218 alock rctrl rctrl rctrl rctrl rctrl rctrl rctrl O + 219 '/' '/' nop nop 9566 9566 nop nop O + 220 nscr pscr debug nop nop nop nop nop O + 221 ralt ralt ralt ralt ralt ralt ralt ralt O + 222 fkey49 fkey49 fkey69 fkey49 fkey49 fkey49 fkey49 fkey49 O + 223 fkey50 fkey50 fkey70 fkey50 fkey50 fkey50 fkey50 fkey50 O + 224 fkey51 fkey51 fkey71 fkey51 fkey51 fkey51 fkey51 fkey51 O + 225 fkey53 fkey53 fkey73 fkey53 fkey53 fkey53 fkey53 fkey53 O + 226 fkey55 fkey55 fkey75 fkey55 fkey55 fkey55 fkey55 fkey55 O + 227 fkey57 fkey57 fkey77 fkey57 fkey57 fkey57 fkey57 fkey57 O + 228 fkey58 fkey58 fkey78 fkey58 fkey58 fkey58 fkey58 fkey58 O + 229 fkey59 fkey59 fkey79 fkey59 fkey59 fkey59 fkey59 fkey59 O + 230 fkey60 paste fkey80 fkey60 fkey60 fkey60 fkey60 fkey60 O + 231 del del fkey81 del fkey61 fkey61 boot pdwn O + 232 slock saver slock saver susp nop susp nop O + 233 meta fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 O + 234 meta fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 O + 235 saver fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 O + 236 nop nop nop nop nop nop nop nop O diff --git a/sys/Makefile b/sys/Makefile index 47fd4629fb0..dc1d5e98432 100644 --- a/sys/Makefile +++ b/sys/Makefile @@ -1,12 +1,5 @@ # $FreeBSD$ -.include - -# The boot loader -.if ${MK_BOOT} != "no" -SUBDIR= boot -.endif - # Directories to include in cscope name file and TAGS. CSCOPEDIRS= boot bsm cam cddl compat conf contrib crypto ddb dev fs gdb \ geom gnu isa kern libkern modules net net80211 \ @@ -15,7 +8,7 @@ CSCOPEDIRS= boot bsm cam cddl compat conf contrib crypto ddb dev fs gdb \ pci rpc security sys ufs vm xdr xen ${CSCOPE_ARCHDIR} .if !defined(CSCOPE_ARCHDIR) .if defined(ALL_ARCH) -CSCOPE_ARCHDIR = amd64 arm i386 ia64 mips pc98 powerpc sparc64 x86 +CSCOPE_ARCHDIR = amd64 arm i386 mips pc98 powerpc sparc64 x86 .else CSCOPE_ARCHDIR = ${MACHINE} .if ${MACHINE} != ${MACHINE_CPUARCH} @@ -27,12 +20,6 @@ CSCOPE_ARCHDIR += x86 .endif .endif -# Loadable kernel modules - -.if defined(MODULES_WITH_WORLD) -SUBDIR+=modules -.endif - HTAGSFLAGS+= -at `awk -F= '/^RELEASE *=/{release=$2}; END {print "FreeBSD", release, "kernel"}' < conf/newvers.sh` # You need the devel/cscope port for this. @@ -47,6 +34,25 @@ ${.CURDIR}/cscope.files: .PHONY cscope-clean: rm -f cscope.files cscope.out cscope.in.out cscope.po.out +# +# Installs SCM hooks to update the cscope database every time the source tree +# is updated. +# cscope understands incremental updates, so it's considerably faster when only +# a few files have changed. +# +HG_DIR=${.CURDIR}/../.hg +HG_HOOK=if [ \$$HG_ERROR -eq 0 ]; then cd sys && make -m ../share/mk cscope; fi +cscope-hook: + @if [ -d ${HG_DIR} ]; then \ + if [ "`grep hooks ${HG_DIR}/hgrc`" = "" ]; then \ + echo "[hooks]" >> ${HG_DIR}/hgrc; \ + echo "update = ${HG_HOOK}" >> ${HG_DIR}/hgrc; \ + echo "Hook installed in ${HG_DIR}/hgrc"; \ + else \ + echo "Mercurial update hook already exists."; \ + fi; \ + fi + # You need the devel/global and one of editor/emacs* ports for that. TAGS ${.CURDIR}/TAGS: ${.CURDIR}/cscope.files rm -f ${.CURDIR}/TAGS @@ -63,4 +69,20 @@ glimpse: glimpse-clean: cd ${.CURDIR}; rm -f .glimpse_* +.if !(make(cscope) || make(cscope-clean) || make(cscope-hook) || make(TAGS) || \ + make(glimpse) || make(glimpse-clean)) +.include + +# The boot loader +.if ${MK_BOOT} != "no" +SUBDIR= boot +.endif + +# Loadable kernel modules + +.if defined(MODULES_WITH_WORLD) +SUBDIR+=modules +.endif + .include +.endif diff --git a/sys/amd64/acpica/acpi_machdep.c b/sys/amd64/acpica/acpi_machdep.c index e5dd4c306d1..049b51bb4e9 100644 --- a/sys/amd64/acpica/acpi_machdep.c +++ b/sys/amd64/acpica/acpi_machdep.c @@ -45,9 +45,8 @@ __FBSDID("$FreeBSD$"); #include int acpi_resume_beep; -TUNABLE_INT("debug.acpi.resume_beep", &acpi_resume_beep); -SYSCTL_INT(_debug_acpi, OID_AUTO, resume_beep, CTLFLAG_RW, &acpi_resume_beep, - 0, "Beep the PC speaker when resuming"); +SYSCTL_INT(_debug_acpi, OID_AUTO, resume_beep, CTLFLAG_RWTUN, + &acpi_resume_beep, 0, "Beep the PC speaker when resuming"); int acpi_reset_video; TUNABLE_INT("hw.acpi.reset_video", &acpi_reset_video); diff --git a/sys/amd64/acpica/acpi_wakecode.S b/sys/amd64/acpica/acpi_wakecode.S index c4b0dcdfd50..a4c559fc891 100644 --- a/sys/amd64/acpica/acpi_wakecode.S +++ b/sys/amd64/acpica/acpi_wakecode.S @@ -148,9 +148,9 @@ wakeup_32: mov $bootdata32 - bootgdt, %eax mov %ax, %ds - /* Turn on the PAE and PSE bits for when paging is enabled */ + /* Turn on the PAE bit for when paging is enabled */ mov %cr4, %eax - orl $(CR4_PAE | CR4_PSE), %eax + orl $CR4_PAE, %eax mov %eax, %cr4 /* diff --git a/sys/amd64/amd64/amd64_mem.c b/sys/amd64/amd64/amd64_mem.c index e77a96f3f55..29cf2c03d82 100644 --- a/sys/amd64/amd64/amd64_mem.c +++ b/sys/amd64/amd64/amd64_mem.c @@ -69,7 +69,6 @@ static char *mem_owner_bios = "BIOS"; (((curr) & ~MDF_ATTRMASK) | ((new) & MDF_ATTRMASK)) static int mtrrs_disabled; -TUNABLE_INT("machdep.disable_mtrrs", &mtrrs_disabled); SYSCTL_INT(_machdep, OID_AUTO, disable_mtrrs, CTLFLAG_RDTUN, &mtrrs_disabled, 0, "Disable amd64 MTRRs."); diff --git a/sys/amd64/amd64/db_disasm.c b/sys/amd64/amd64/db_disasm.c index a8d91ebaeb1..7e7a2ad56fe 100644 --- a/sys/amd64/amd64/db_disasm.c +++ b/sys/amd64/amd64/db_disasm.c @@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$"); #define R 5 /* register, in 'reg' field */ #define Rw 6 /* word register, in 'reg' field */ #define Rq 39 /* quad register, in 'reg' field */ +#define Rv 40 /* register in 'r/m' field */ #define Ri 7 /* register in instruction */ #define S 8 /* segment reg, in 'reg' field */ #define Si 9 /* segment reg, in instruction */ @@ -628,6 +629,17 @@ static const struct inst db_Grp5[] = { { "", TRUE, NONE, 0, 0 } }; +static const struct inst db_Grp9b[] = { + { "", TRUE, NONE, 0, 0 }, + { "", TRUE, NONE, 0, 0 }, + { "", TRUE, NONE, 0, 0 }, + { "", TRUE, NONE, 0, 0 }, + { "", TRUE, NONE, 0, 0 }, + { "", TRUE, NONE, 0, 0 }, + { "rdrand",TRUE, LONG, op1(Rv), 0 }, + { "rdseed",TRUE, LONG, op1(Rv), 0 } +}; + static const struct inst db_inst_table[256] = { /*00*/ { "add", TRUE, BYTE, op2(R, E), 0 }, /*01*/ { "add", TRUE, LONG, op2(R, E), 0 }, @@ -1300,7 +1312,13 @@ db_disasm(loc, altfmt) i_size = ip->i_size; i_mode = ip->i_mode; - if (ip->i_extra == db_Grp1 || ip->i_extra == db_Grp2 || + if (ip->i_extra == db_Grp9 && f_mod(rex, regmodrm) == 3) { + ip = &db_Grp9b[f_reg(rex, regmodrm)]; + i_name = ip->i_name; + i_size = ip->i_size; + i_mode = ip->i_mode; + } + else if (ip->i_extra == db_Grp1 || ip->i_extra == db_Grp2 || ip->i_extra == db_Grp6 || ip->i_extra == db_Grp7 || ip->i_extra == db_Grp8 || ip->i_extra == db_Grp9 || ip->i_extra == db_Grp15) { @@ -1373,6 +1391,46 @@ db_disasm(loc, altfmt) i_size = NONE; i_mode = 0; break; + case 0xd8: + i_name = "vmrun"; + i_size = NONE; + i_mode = 0; + break; + case 0xd9: + i_name = "vmmcall"; + i_size = NONE; + i_mode = 0; + break; + case 0xda: + i_name = "vmload"; + i_size = NONE; + i_mode = 0; + break; + case 0xdb: + i_name = "vmsave"; + i_size = NONE; + i_mode = 0; + break; + case 0xdc: + i_name = "stgi"; + i_size = NONE; + i_mode = 0; + break; + case 0xdd: + i_name = "clgi"; + i_size = NONE; + i_mode = 0; + break; + case 0xde: + i_name = "skinit"; + i_size = NONE; + i_mode = 0; + break; + case 0xdf: + i_name = "invlpga"; + i_size = NONE; + i_mode = 0; + break; case 0xf8: i_name = "swapgs"; i_size = NONE; @@ -1511,6 +1569,10 @@ db_disasm(loc, altfmt) db_printf("%s", db_reg[rex != 0 ? 1 : 0][(rex & REX_R) ? QUAD : LONG][f_rm(rex, inst)]); break; + case Rv: + db_printf("%s", db_reg[rex != 0 ? 1 : 0][(size == LONG && (rex & REX_W)) ? QUAD : size][f_rm(rex, regmodrm)]); + break; + case S: db_printf("%s", db_seg_reg[f_reg(rex, regmodrm)]); break; diff --git a/sys/amd64/amd64/exception.S b/sys/amd64/amd64/exception.S index d4e58b1cecb..2a908a980f8 100644 --- a/sys/amd64/amd64/exception.S +++ b/sys/amd64/amd64/exception.S @@ -228,7 +228,7 @@ alltraps_pushregs_no_rdi: .type calltrap,@function calltrap: movq %rsp,%rdi - call trap + call trap_check MEXITCOUNT jmp doreti /* Handle any pending ASTs */ @@ -721,21 +721,38 @@ ld_fsbase: pushfq cli movl $MSR_GSBASE,%ecx + /* Save current kernel %gs base into %r12d:%r13d */ rdmsr + movl %eax,%r12d + movl %edx,%r13d .globl ld_gs ld_gs: movw %si,%gs + /* Save user %gs base into %r14d:%r15d */ + rdmsr + movl %eax,%r14d + movl %edx,%r15d + /* Restore kernel %gs base */ + movl %r12d,%eax + movl %r13d,%edx wrmsr popfq + /* + * Restore user %gs base, either from PCB if used for TLS, or + * from the previously saved msr read. + */ + movl $MSR_KGSBASE,%ecx cmpw $KUG32SEL,%si jne 1f - movl $MSR_KGSBASE,%ecx movl PCB_GSBASE(%r8),%eax movl PCB_GSBASE+4(%r8),%edx + jmp ld_gsbase +1: + movl %r14d,%eax + movl %r15d,%edx .globl ld_gsbase ld_gsbase: - wrmsr -1: + wrmsr /* May trap if non-canonical, but only for TLS. */ .globl ld_es ld_es: movw TF_ES(%rsp),%es diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c index fe10a81600d..0f4b2b52aee 100644 --- a/sys/amd64/amd64/fpu.c +++ b/sys/amd64/amd64/fpu.c @@ -199,6 +199,10 @@ fpuinit_bsp1(void) TUNABLE_ULONG_FETCH("hw.xsave_mask", &xsave_mask_user); xsave_mask_user |= XFEATURE_ENABLED_X87 | XFEATURE_ENABLED_SSE; xsave_mask &= xsave_mask_user; + if ((xsave_mask & XFEATURE_AVX512) != XFEATURE_AVX512) + xsave_mask &= ~XFEATURE_AVX512; + if ((xsave_mask & XFEATURE_MPX) != XFEATURE_MPX) + xsave_mask &= ~XFEATURE_MPX; cpuid_count(0xd, 0x1, cp); if ((cp[0] & CPUID_EXTSTATE_XSAVEOPT) != 0) { @@ -886,6 +890,7 @@ static MALLOC_DEFINE(M_FPUKERN_CTX, "fpukern_ctx", "Kernel contexts for FPU state"); #define FPU_KERN_CTX_FPUINITDONE 0x01 +#define FPU_KERN_CTX_DUMMY 0x02 /* avoided save for the kern thread */ struct fpu_kern_ctx { struct savefpu *prev; @@ -929,6 +934,10 @@ fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags) { struct pcb *pcb; + if ((flags & FPU_KERN_KTHR) != 0 && is_fpu_kern_thread(0)) { + ctx->flags = FPU_KERN_CTX_DUMMY; + return (0); + } pcb = td->td_pcb; KASSERT(!PCB_USER_FPU(pcb) || pcb->pcb_save == get_pcb_user_save_pcb(pcb), ("mangled pcb_save")); @@ -948,6 +957,9 @@ fpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx) { struct pcb *pcb; + if (is_fpu_kern_thread(0) && (ctx->flags & FPU_KERN_CTX_DUMMY) != 0) + return (0); + KASSERT((ctx->flags & FPU_KERN_CTX_DUMMY) == 0, ("dummy ctx")); pcb = td->td_pcb; critical_enter(); if (curthread == PCPU_GET(fpcurthread)) diff --git a/sys/amd64/amd64/identcpu.c b/sys/amd64/amd64/identcpu.c index fc97acc26da..96d911a97d2 100644 --- a/sys/amd64/amd64/identcpu.c +++ b/sys/amd64/amd64/identcpu.c @@ -385,11 +385,11 @@ printcpuinfo(void) } if (cpu_stdext_feature != 0) { - printf("\n Standard Extended Features=0x%b", + printf("\n Structured Extended Features=0x%b", cpu_stdext_feature, "\020" /* RDFSBASE/RDGSBASE/WRFSBASE/WRGSBASE */ - "\001GSFSBASE" + "\001FSGSBASE" "\002TSCADJ" /* Bit Manipulation Instructions */ "\004BMI1" @@ -401,17 +401,27 @@ printcpuinfo(void) "\010SMEP" /* Bit Manipulation Instructions */ "\011BMI2" - "\012ENHMOVSB" + "\012ERMS" /* Invalidate Processor Context ID */ "\013INVPCID" /* Restricted Transactional Memory */ "\014RTM" + /* Intel Memory Protection Extensions */ + "\017MPX" + /* AVX512 Foundation */ + "\021AVX512F" /* Enhanced NRBG */ "\023RDSEED" /* ADCX + ADOX */ "\024ADX" /* Supervisor Mode Access Prevention */ "\025SMAP" + "\030CLFLUSHOPT" + "\032PROCTRACE" + "\033AVX512PF" + "\034AVX512ER" + "\035AVX512CD" + "\036SHA" ); } diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index cc2b581b624..f02045d6414 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -675,8 +675,7 @@ cpu_halt(void) void (*cpu_idle_hook)(sbintime_t) = NULL; /* ACPI idle hook. */ static int cpu_ident_amdc1e = 0; /* AMD C1E supported. */ static int idle_mwait = 1; /* Use MONITOR/MWAIT for short idle. */ -TUNABLE_INT("machdep.idle_mwait", &idle_mwait); -SYSCTL_INT(_machdep, OID_AUTO, idle_mwait, CTLFLAG_RW, &idle_mwait, +SYSCTL_INT(_machdep, OID_AUTO, idle_mwait, CTLFLAG_RWTUN, &idle_mwait, 0, "Use MONITOR/MWAIT for short idle"); #define STATE_RUNNING 0x0 @@ -1147,7 +1146,7 @@ struct soft_segment_descriptor gdt_segs[] = { .ssd_gran = 1 }, /* GPROC0_SEL 9 Proc 0 Tss Descriptor */ { .ssd_base = 0x0, - .ssd_limit = sizeof(struct amd64tss) + IOPAGES * PAGE_SIZE - 1, + .ssd_limit = sizeof(struct amd64tss) + IOPERM_BITMAP_SIZE - 1, .ssd_type = SDT_SYSTSS, .ssd_dpl = SEL_KPL, .ssd_p = 1, @@ -1955,6 +1954,14 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) */ clock_init(); + /* + * Use vt(4) by default for UEFI boot (during the sc(4)/vt(4) + * transition). + */ + if (kmdp != NULL && preload_search_info(kmdp, + MODINFO_METADATA | MODINFOMD_EFI_MAP) != NULL) + vty_set_preferred(VTY_VT); + /* * Initialize the console before we print anything out. */ @@ -2003,8 +2010,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) common_tss[0].tss_ist2 = (long) np; /* Set the IO permission bitmap (empty due to tss seg limit) */ - common_tss[0].tss_iobase = sizeof(struct amd64tss) + - IOPAGES * PAGE_SIZE; + common_tss[0].tss_iobase = sizeof(struct amd64tss) + IOPERM_BITMAP_SIZE; gsel_tss = GSEL(GPROC0_SEL, SEL_KPL); ltr(gsel_tss); @@ -2138,7 +2144,9 @@ makectx(struct trapframe *tf, struct pcb *pcb) int ptrace_set_pc(struct thread *td, unsigned long addr) { + td->td_frame->tf_rip = addr; + set_pcb_flags(td->td_pcb, PCB_FULL_IRET); return (0); } @@ -2238,8 +2246,8 @@ set_regs(struct thread *td, struct reg *regs) tp->tf_fs = regs->r_fs; tp->tf_gs = regs->r_gs; tp->tf_flags = TF_HASSEGS; - set_pcb_flags(td->td_pcb, PCB_FULL_IRET); } + set_pcb_flags(td->td_pcb, PCB_FULL_IRET); return (0); } diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 484fc061e00..9b12449ef19 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -125,9 +125,7 @@ static u_long *ipi_hardclock_counts[MAXCPU]; #endif /* Default cpu_ops implementation. */ -struct cpu_ops cpu_ops = { - .ipi_vectored = lapic_ipi_vectored -}; +struct cpu_ops cpu_ops; extern inthand_t IDTVEC(fast_syscall), IDTVEC(fast_syscall32); @@ -637,7 +635,7 @@ init_secondary(void) common_tss[cpu] = common_tss[0]; common_tss[cpu].tss_rsp0 = 0; /* not used until after switch */ common_tss[cpu].tss_iobase = sizeof(struct amd64tss) + - IOPAGES * PAGE_SIZE; + IOPERM_BITMAP_SIZE; common_tss[cpu].tss_ist1 = (long)&doublefault_stack[PAGE_SIZE]; /* The NMI stack runs on IST2. */ @@ -1125,7 +1123,7 @@ ipi_send_cpu(int cpu, u_int ipi) if (old_pending) return; } - cpu_ops.ipi_vectored(ipi, cpu_apic_ids[cpu]); + lapic_ipi_vectored(ipi, cpu_apic_ids[cpu]); } /* @@ -1395,7 +1393,7 @@ ipi_all_but_self(u_int ipi) CPU_OR_ATOMIC(&ipi_nmi_pending, &other_cpus); CTR2(KTR_SMP, "%s: ipi: %x", __func__, ipi); - cpu_ops.ipi_vectored(ipi, APIC_IPI_DEST_OTHERS); + lapic_ipi_vectored(ipi, APIC_IPI_DEST_OTHERS); } int diff --git a/sys/amd64/amd64/mp_watchdog.c b/sys/amd64/amd64/mp_watchdog.c index b1799a20b3d..b03d2614d9b 100644 --- a/sys/amd64/amd64/mp_watchdog.c +++ b/sys/amd64/amd64/mp_watchdog.c @@ -68,8 +68,7 @@ static int watchdog_dontfire = 1; static int watchdog_timer = -1; static int watchdog_nmi = 1; -TUNABLE_INT("debug.watchdog", &watchdog_cpu); -SYSCTL_INT(_debug, OID_AUTO, watchdog_nmi, CTLFLAG_RW, &watchdog_nmi, 0, +SYSCTL_INT(_debug, OID_AUTO, watchdog_nmi, CTLFLAG_RWTUN, &watchdog_nmi, 0, "IPI the boot processor with an NMI to enter the debugger"); static struct callout watchdog_callout; diff --git a/sys/amd64/amd64/mpboot.S b/sys/amd64/amd64/mpboot.S index ec30c72ecb9..c4b6537d27e 100644 --- a/sys/amd64/amd64/mpboot.S +++ b/sys/amd64/amd64/mpboot.S @@ -90,9 +90,9 @@ protmode: mov $bootdata-gdt, %eax mov %ax, %ds - /* Turn on the PAE, PSE and PGE bits for when paging is enabled */ + /* Turn on the PAE bit for when paging is enabled */ mov %cr4, %eax - orl $(CR4_PAE | CR4_PSE), %eax + orl $CR4_PAE, %eax mov %eax, %cr4 /* diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 84962d81439..5696f675c2f 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -332,8 +332,8 @@ SYSCTL_INT(_vm_pmap, OID_AUTO, pat_works, CTLFLAG_RD, &pat_works, 1, "Is page attribute table fully functional?"); static int pg_ps_enabled = 1; -SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RDTUN, &pg_ps_enabled, 0, - "Are large page mappings enabled?"); +SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, + &pg_ps_enabled, 0, "Are large page mappings enabled?"); #define PAT_INDEX_SIZE 8 static int pat_index[PAT_INDEX_SIZE]; /* cache mode to PAT index conversion */ @@ -368,8 +368,8 @@ static int pmap_flags = PMAP_PDE_SUPERPAGE; /* flags for x86 pmaps */ static struct unrhdr pcid_unr; static struct mtx pcid_mtx; int pmap_pcid_enabled = 0; -SYSCTL_INT(_vm_pmap, OID_AUTO, pcid_enabled, CTLFLAG_RDTUN, &pmap_pcid_enabled, - 0, "Is TLB Context ID enabled ?"); +SYSCTL_INT(_vm_pmap, OID_AUTO, pcid_enabled, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, + &pmap_pcid_enabled, 0, "Is TLB Context ID enabled ?"); int invpcid_works = 0; SYSCTL_INT(_vm_pmap, OID_AUTO, invpcid_works, CTLFLAG_RD, &invpcid_works, 0, "Is the invpcid instruction available ?"); @@ -390,6 +390,11 @@ SYSCTL_PROC(_vm_pmap, OID_AUTO, pcid_save_cnt, CTLTYPE_U64 | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, 0, pmap_pcid_save_cnt_proc, "QU", "Count of saved TLB context on switch"); +/* pmap_copy_pages() over non-DMAP */ +static struct mtx cpage_lock; +static vm_offset_t cpage_a; +static vm_offset_t cpage_b; + /* * Crashdump maps. */ @@ -826,7 +831,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr) /* XXX do %cr0 as well */ - load_cr4(rcr4() | CR4_PGE | CR4_PSE); + load_cr4(rcr4() | CR4_PGE); load_cr3(KPML4phys); if (cpu_stdext_feature & CPUID_STDEXT_SMEP) load_cr4(rcr4() | CR4_SMEP); @@ -1055,6 +1060,10 @@ pmap_init(void) M_WAITOK | M_ZERO); for (i = 0; i < pv_npg; i++) TAILQ_INIT(&pv_table[i].pv_list); + + mtx_init(&cpage_lock, "cpage", NULL, MTX_DEF); + cpage_a = kva_alloc(PAGE_SIZE); + cpage_b = kva_alloc(PAGE_SIZE); } static SYSCTL_NODE(_vm_pmap, OID_AUTO, pde, CTLFLAG_RD, 0, @@ -2868,7 +2877,7 @@ free_pv_chunk(struct pv_chunk *pc) /* entire chunk is free, return it */ m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pc)); dump_drop_page(m->phys_addr); - vm_page_unwire(m, 0); + vm_page_unwire(m, PQ_INACTIVE); vm_page_free(m); } @@ -4428,9 +4437,7 @@ pmap_enter_object(pmap_t pmap, vm_offset_t start, vm_offset_t end, while (m != NULL && (diff = m->pindex - m_start->pindex) < psize) { va = start + ptoa(diff); if ((va & PDRMASK) == 0 && va + NBPDR <= end && - (VM_PAGE_TO_PHYS(m) & PDRMASK) == 0 && - pmap_ps_enabled(pmap) && - vm_reserv_level_iffullpop(m) == 0 && + m->psind == 1 && pmap_ps_enabled(pmap) && pmap_enter_pde(pmap, va, m, prot, &lock)) m = &m[NBPDR / PAGE_SIZE - 1]; else @@ -4737,6 +4744,102 @@ pmap_change_wiring(pmap_t pmap, vm_offset_t va, boolean_t wired) PMAP_UNLOCK(pmap); } +/* + * Clear the wired attribute from the mappings for the specified range of + * addresses in the given pmap. Every valid mapping within that range + * must have the wired attribute set. In contrast, invalid mappings + * cannot have the wired attribute set, so they are ignored. + * + * The wired attribute of the page table entry is not a hardware feature, + * so there is no need to invalidate any TLB entries. + */ +void +pmap_unwire(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) +{ + vm_offset_t va_next; + pml4_entry_t *pml4e; + pdp_entry_t *pdpe; + pd_entry_t *pde; + pt_entry_t *pte, PG_V; + boolean_t pv_lists_locked; + + PG_V = pmap_valid_bit(pmap); + pv_lists_locked = FALSE; +resume: + PMAP_LOCK(pmap); + for (; sva < eva; sva = va_next) { + pml4e = pmap_pml4e(pmap, sva); + if ((*pml4e & PG_V) == 0) { + va_next = (sva + NBPML4) & ~PML4MASK; + if (va_next < sva) + va_next = eva; + continue; + } + pdpe = pmap_pml4e_to_pdpe(pml4e, sva); + if ((*pdpe & PG_V) == 0) { + va_next = (sva + NBPDP) & ~PDPMASK; + if (va_next < sva) + va_next = eva; + continue; + } + va_next = (sva + NBPDR) & ~PDRMASK; + if (va_next < sva) + va_next = eva; + pde = pmap_pdpe_to_pde(pdpe, sva); + if ((*pde & PG_V) == 0) + continue; + if ((*pde & PG_PS) != 0) { + if ((*pde & PG_W) == 0) + panic("pmap_unwire: pde %#jx is missing PG_W", + (uintmax_t)*pde); + + /* + * Are we unwiring the entire large page? If not, + * demote the mapping and fall through. + */ + if (sva + NBPDR == va_next && eva >= va_next) { + atomic_clear_long(pde, PG_W); + pmap->pm_stats.wired_count -= NBPDR / + PAGE_SIZE; + continue; + } else { + if (!pv_lists_locked) { + pv_lists_locked = TRUE; + if (!rw_try_rlock(&pvh_global_lock)) { + PMAP_UNLOCK(pmap); + rw_rlock(&pvh_global_lock); + /* Repeat sva. */ + goto resume; + } + } + if (!pmap_demote_pde(pmap, pde, sva)) + panic("pmap_unwire: demotion failed"); + } + } + if (va_next > eva) + va_next = eva; + for (pte = pmap_pde_to_pte(pde, sva); sva != va_next; pte++, + sva += PAGE_SIZE) { + if ((*pte & PG_V) == 0) + continue; + if ((*pte & PG_W) == 0) + panic("pmap_unwire: pte %#jx is missing PG_W", + (uintmax_t)*pte); + + /* + * PG_W must be cleared atomically. Although the pmap + * lock synchronizes access to PG_W, another processor + * could be setting PG_M and/or PG_A concurrently. + */ + atomic_clear_long(pte, PG_W); + pmap->pm_stats.wired_count--; + } + } + if (pv_lists_locked) + rw_runlock(&pvh_global_lock); + PMAP_UNLOCK(pmap); +} + /* * Copy the range specified by src_addr/len * from the source map to the range dst_addr/len @@ -4970,19 +5073,66 @@ pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, vm_page_t mb[], vm_offset_t b_offset, int xfersize) { void *a_cp, *b_cp; + vm_page_t m_a, m_b; + vm_paddr_t p_a, p_b; + pt_entry_t *pte; vm_offset_t a_pg_offset, b_pg_offset; int cnt; + boolean_t pinned; + /* + * NB: The sequence of updating a page table followed by accesses + * to the corresponding pages used in the !DMAP case is subject to + * the situation described in the "AMD64 Architecture Programmer's + * Manual Volume 2: System Programming" rev. 3.23, "7.3.1 Special + * Coherency Considerations". Therefore, issuing the INVLPG right + * after modifying the PTE bits is crucial. + */ + pinned = FALSE; while (xfersize > 0) { a_pg_offset = a_offset & PAGE_MASK; - cnt = min(xfersize, PAGE_SIZE - a_pg_offset); - a_cp = (char *)PHYS_TO_DMAP(ma[a_offset >> PAGE_SHIFT]-> - phys_addr) + a_pg_offset; + m_a = ma[a_offset >> PAGE_SHIFT]; + p_a = m_a->phys_addr; b_pg_offset = b_offset & PAGE_MASK; + m_b = mb[b_offset >> PAGE_SHIFT]; + p_b = m_b->phys_addr; + cnt = min(xfersize, PAGE_SIZE - a_pg_offset); cnt = min(cnt, PAGE_SIZE - b_pg_offset); - b_cp = (char *)PHYS_TO_DMAP(mb[b_offset >> PAGE_SHIFT]-> - phys_addr) + b_pg_offset; + if (__predict_false(p_a < DMAP_MIN_ADDRESS || + p_a > DMAP_MIN_ADDRESS + dmaplimit)) { + mtx_lock(&cpage_lock); + sched_pin(); + pinned = TRUE; + pte = vtopte(cpage_a); + *pte = p_a | X86_PG_A | X86_PG_V | + pmap_cache_bits(kernel_pmap, m_a->md.pat_mode, 0); + invlpg(cpage_a); + a_cp = (char *)cpage_a + a_pg_offset; + } else { + a_cp = (char *)PHYS_TO_DMAP(p_a) + a_pg_offset; + } + if (__predict_false(p_b < DMAP_MIN_ADDRESS || + p_b > DMAP_MIN_ADDRESS + dmaplimit)) { + if (!pinned) { + mtx_lock(&cpage_lock); + sched_pin(); + pinned = TRUE; + } + pte = vtopte(cpage_b); + *pte = p_b | X86_PG_A | X86_PG_M | X86_PG_RW | + X86_PG_V | pmap_cache_bits(kernel_pmap, + m_b->md.pat_mode, 0); + invlpg(cpage_b); + b_cp = (char *)cpage_b + b_pg_offset; + } else { + b_cp = (char *)PHYS_TO_DMAP(p_b) + b_pg_offset; + } bcopy(a_cp, b_cp, cnt); + if (__predict_false(pinned)) { + sched_unpin(); + mtx_unlock(&cpage_lock); + pinned = FALSE; + } a_offset += cnt; b_offset += cnt; xfersize -= cnt; diff --git a/sys/amd64/amd64/sys_machdep.c b/sys/amd64/amd64/sys_machdep.c index 26f38a234ac..37935cffb05 100644 --- a/sys/amd64/amd64/sys_machdep.c +++ b/sys/amd64/amd64/sys_machdep.c @@ -73,7 +73,6 @@ static void max_ldt_segment_init(void *arg __unused) { - TUNABLE_INT_FETCH("machdep.max_ldt_segment", &max_ldt_segment); if (max_ldt_segment <= 0) max_ldt_segment = 1; if (max_ldt_segment > MAX_LD) @@ -338,7 +337,6 @@ amd64_set_ioperm(td, uap) char *iomap; struct amd64tss *tssp; struct system_segment_descriptor *tss_sd; - u_long *addr; struct pcb *pcb; if ((error = priv_check(td, PRIV_IO)) != 0) @@ -358,12 +356,8 @@ amd64_set_ioperm(td, uap) if (pcb->pcb_tssp == NULL) { tssp = (struct amd64tss *)kmem_malloc(kernel_arena, ctob(IOPAGES+1), M_WAITOK); - if (tssp == NULL) - return (ENOMEM); iomap = (char *)&tssp[1]; - addr = (u_long *)iomap; - for (i = 0; i < (ctob(IOPAGES) + 1) / sizeof(u_long); i++) - *addr++ = ~0; + memset(iomap, 0xff, IOPERM_BITMAP_SIZE); critical_enter(); /* Takes care of tss_rsp0. */ memcpy(tssp, &common_tss[PCPU_GET(cpuid)], @@ -465,12 +459,7 @@ user_ldt_alloc(struct proc *p, int force) new_ldt = malloc(sizeof(struct proc_ldt), M_SUBPROC, M_WAITOK); new_ldt->ldt_base = (caddr_t)kmem_malloc(kernel_arena, max_ldt_segment * sizeof(struct user_segment_descriptor), - M_WAITOK); - if (new_ldt->ldt_base == NULL) { - FREE(new_ldt, M_SUBPROC); - mtx_lock(&dt_lock); - return (NULL); - } + M_WAITOK | M_ZERO); new_ldt->ldt_refcnt = 1; sldt.ssd_base = (uint64_t)new_ldt->ldt_base; sldt.ssd_limit = max_ldt_segment * diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 9f3ac4f8c8b..f6459f48cf8 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -95,31 +95,10 @@ PMC_SOFT_DEFINE( , , page_fault, write); #ifdef KDTRACE_HOOKS #include - -/* - * This is a hook which is initialised by the dtrace module - * to handle traps which might occur during DTrace probe - * execution. - */ -dtrace_trap_func_t dtrace_trap_func; - -dtrace_doubletrap_func_t dtrace_doubletrap_func; - -/* - * This is a hook which is initialised by the systrace module - * when it is loaded. This keeps the DTrace syscall provider - * implementation opaque. - */ -systrace_probe_func_t systrace_probe_func; - -/* - * These hooks are necessary for the pid and usdt providers. - */ -dtrace_pid_probe_ptr_t dtrace_pid_probe_ptr; -dtrace_return_probe_ptr_t dtrace_return_probe_ptr; #endif -extern void trap(struct trapframe *frame); +extern void __noinline trap(struct trapframe *frame); +extern void trap_check(struct trapframe *frame); extern void syscall(struct trapframe *frame); void dblfault_handler(struct trapframe *frame); @@ -165,20 +144,18 @@ static char *trap_msg[] = { #ifdef KDB static int kdb_on_nmi = 1; -SYSCTL_INT(_machdep, OID_AUTO, kdb_on_nmi, CTLFLAG_RW, +SYSCTL_INT(_machdep, OID_AUTO, kdb_on_nmi, CTLFLAG_RWTUN, &kdb_on_nmi, 0, "Go to KDB on NMI"); -TUNABLE_INT("machdep.kdb_on_nmi", &kdb_on_nmi); #endif static int panic_on_nmi = 1; -SYSCTL_INT(_machdep, OID_AUTO, panic_on_nmi, CTLFLAG_RW, +SYSCTL_INT(_machdep, OID_AUTO, panic_on_nmi, CTLFLAG_RWTUN, &panic_on_nmi, 0, "Panic on NMI"); -TUNABLE_INT("machdep.panic_on_nmi", &panic_on_nmi); static int prot_fault_translation; -SYSCTL_INT(_machdep, OID_AUTO, prot_fault_translation, CTLFLAG_RW, +SYSCTL_INT(_machdep, OID_AUTO, prot_fault_translation, CTLFLAG_RWTUN, &prot_fault_translation, 0, "Select signal to deliver on protection fault"); static int uprintf_signal; -SYSCTL_INT(_machdep, OID_AUTO, uprintf_signal, CTLFLAG_RW, +SYSCTL_INT(_machdep, OID_AUTO, uprintf_signal, CTLFLAG_RWTUN, &uprintf_signal, 0, "Print debugging information on trap signal to ctty"); @@ -242,18 +219,6 @@ trap(struct trapframe *frame) goto out; } -#ifdef KDTRACE_HOOKS - /* - * A trap can occur while DTrace executes a probe. Before - * executing the probe, DTrace blocks re-scheduling and sets - * a flag in its per-cpu flags to indicate that it doesn't - * want to fault. On returning from the probe, the no-fault - * flag is cleared and finally re-scheduling is enabled. - */ - if (dtrace_trap_func != NULL && (*dtrace_trap_func)(frame, type)) - goto out; -#endif - if ((frame->tf_rflags & PSL_I) == 0) { /* * Buggy application or kernel code has disabled @@ -337,6 +302,10 @@ trap(struct trapframe *frame) i = SIGBUS; ucode = BUS_OBJERR; break; + case T_ALIGNFLT: + i = SIGBUS; + ucode = BUS_ADRALN; + break; case T_DOUBLEFLT: /* double fault */ default: i = SIGBUS; @@ -636,6 +605,21 @@ trap(struct trapframe *frame) return; } +/* + * Ensure that we ignore any DTrace-induced faults. This function cannot + * be instrumented, so it cannot generate such faults itself. + */ +void +trap_check(struct trapframe *frame) +{ + +#ifdef KDTRACE_HOOKS + if (dtrace_trap_func != NULL && (*dtrace_trap_func)(frame)) + return; +#endif + trap(frame); +} + static int trap_pfault(frame, usermode) struct trapframe *frame; diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index 1c21758ba9f..42698896b40 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -21,7 +21,7 @@ cpu HAMMER ident GENERIC -makeoptions DEBUG=-g +makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols makeoptions WITH_CTF=1 # Run ctfconvert(1) for DTrace support options SCHED_ULE # ULE scheduler @@ -184,6 +184,11 @@ device splash # Splash screen and screen saver support device sc options SC_PIXEL_MODE # add support for the raster text mode +# vt is the new video console driver +device vt +device vt_vga +device vt_efifb + device agp # support several AGP chipsets # PCCARD (PCMCIA) support diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES index 61372f5342b..8866e762c2c 100644 --- a/sys/amd64/conf/NOTES +++ b/sys/amd64/conf/NOTES @@ -248,6 +248,10 @@ 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 @@ -646,6 +650,3 @@ options VM_KMEM_SIZE_SCALE # Enable NDIS binary driver support options NDISAPI device ndis - -# Module to enable execution of application via emulators like QEMU -options IMAGACT_BINMISC diff --git a/sys/amd64/conf/VT b/sys/amd64/conf/VT deleted file mode 100644 index c11f1afa442..00000000000 --- a/sys/amd64/conf/VT +++ /dev/null @@ -1,15 +0,0 @@ -# VT -- kernel config using the vt(9) system console instead of legacy syscons -# -# For more information see https://wiki.freebsd.org/Newcons -# -# $FreeBSD$ - -include GENERIC -ident VT - -nodevice sc -nodevice vga - -device vt -device vt_vga -device vt_efifb diff --git a/sys/amd64/include/cpu.h b/sys/amd64/include/cpu.h index 3c5d5df86fc..eb9bef8f2e7 100644 --- a/sys/amd64/include/cpu.h +++ b/sys/amd64/include/cpu.h @@ -63,7 +63,6 @@ struct cpu_ops { void (*cpu_init)(void); void (*cpu_resume)(void); - void (*ipi_vectored)(u_int, int); }; extern struct cpu_ops cpu_ops; diff --git a/sys/amd64/include/fpu.h b/sys/amd64/include/fpu.h index ef5d6236f67..be1bdc6c5d7 100644 --- a/sys/amd64/include/fpu.h +++ b/sys/amd64/include/fpu.h @@ -84,6 +84,7 @@ void fpu_save_area_reset(struct savefpu *fsa); */ #define FPU_KERN_NORMAL 0x0000 #define FPU_KERN_NOWAIT 0x0001 +#define FPU_KERN_KTHR 0x0002 #endif diff --git a/sys/amd64/include/param.h b/sys/amd64/include/param.h index 3d4722b1f0c..7dcd7dd7e64 100644 --- a/sys/amd64/include/param.h +++ b/sys/amd64/include/param.h @@ -120,6 +120,12 @@ #define MAXPAGESIZES 3 /* maximum number of supported page sizes */ #define IOPAGES 2 /* pages of i/o permission bitmap */ +/* + * I/O permission bitmap has a bit for each I/O port plus an additional + * byte at the end with all bits set. See section "I/O Permission Bit Map" + * in the Intel SDM for more details. + */ +#define IOPERM_BITMAP_SIZE (IOPAGES * PAGE_SIZE + 1) #ifndef KSTACK_PAGES #define KSTACK_PAGES 4 /* pages of kstack (with pcb) */ diff --git a/sys/amd64/include/vmm.h b/sys/amd64/include/vmm.h index 68240b9d131..63a9b3fdde0 100644 --- a/sys/amd64/include/vmm.h +++ b/sys/amd64/include/vmm.h @@ -29,14 +29,78 @@ #ifndef _VMM_H_ #define _VMM_H_ +#include + enum vm_suspend_how { VM_SUSPEND_NONE, VM_SUSPEND_RESET, VM_SUSPEND_POWEROFF, VM_SUSPEND_HALT, + VM_SUSPEND_TRIPLEFAULT, VM_SUSPEND_LAST }; +/* + * Identifiers for architecturally defined registers. + */ +enum vm_reg_name { + VM_REG_GUEST_RAX, + VM_REG_GUEST_RBX, + VM_REG_GUEST_RCX, + VM_REG_GUEST_RDX, + VM_REG_GUEST_RSI, + VM_REG_GUEST_RDI, + VM_REG_GUEST_RBP, + VM_REG_GUEST_R8, + VM_REG_GUEST_R9, + VM_REG_GUEST_R10, + VM_REG_GUEST_R11, + VM_REG_GUEST_R12, + VM_REG_GUEST_R13, + VM_REG_GUEST_R14, + VM_REG_GUEST_R15, + VM_REG_GUEST_CR0, + VM_REG_GUEST_CR3, + VM_REG_GUEST_CR4, + VM_REG_GUEST_DR7, + VM_REG_GUEST_RSP, + VM_REG_GUEST_RIP, + VM_REG_GUEST_RFLAGS, + VM_REG_GUEST_ES, + VM_REG_GUEST_CS, + VM_REG_GUEST_SS, + VM_REG_GUEST_DS, + VM_REG_GUEST_FS, + VM_REG_GUEST_GS, + VM_REG_GUEST_LDTR, + VM_REG_GUEST_TR, + VM_REG_GUEST_IDTR, + VM_REG_GUEST_GDTR, + VM_REG_GUEST_EFER, + VM_REG_GUEST_CR2, + VM_REG_GUEST_PDPTE0, + VM_REG_GUEST_PDPTE1, + VM_REG_GUEST_PDPTE2, + VM_REG_GUEST_PDPTE3, + VM_REG_LAST +}; + +enum x2apic_state { + X2APIC_DISABLED, + X2APIC_ENABLED, + X2APIC_STATE_LAST +}; + +#define VM_INTINFO_VECTOR(info) ((info) & 0xff) +#define VM_INTINFO_DEL_ERRCODE 0x800 +#define VM_INTINFO_RSVD 0x7ffff000 +#define VM_INTINFO_VALID 0x80000000 +#define VM_INTINFO_TYPE 0x700 +#define VM_INTINFO_HWINTR (0 << 8) +#define VM_INTINFO_NMI (2 << 8) +#define VM_INTINFO_HWEXCEPTION (3 << 8) +#define VM_INTINFO_SWINTR (4 << 8) + #ifdef _KERNEL #define VM_MAX_NAMELEN 32 @@ -52,10 +116,9 @@ struct vioapic; struct vlapic; struct vmspace; struct vm_object; +struct vm_guest_paging; struct pmap; -enum x2apic_state; - typedef int (*vmm_init_func_t)(int ipinum); typedef int (*vmm_cleanup_func_t)(void); typedef void (*vmm_resume_func_t)(void); @@ -104,6 +167,7 @@ extern struct vmm_ops vmm_ops_amd; int vm_create(const char *name, struct vm **retvm); void vm_destroy(struct vm *vm); +int vm_reinit(struct vm *vm); const char *vm_name(struct vm *vm); int vm_malloc(struct vm *vm, vm_paddr_t gpa, size_t len); int vm_map_mmio(struct vm *vm, vm_paddr_t gpa, size_t len, vm_paddr_t hpa); @@ -139,10 +203,13 @@ int vm_set_capability(struct vm *vm, int vcpu, int type, int val); int vm_get_x2apic_state(struct vm *vm, int vcpu, enum x2apic_state *state); int vm_set_x2apic_state(struct vm *vm, int vcpu, enum x2apic_state state); int vm_apicid2vcpuid(struct vm *vm, int apicid); -void vm_activate_cpu(struct vm *vm, int vcpu); +int vm_activate_cpu(struct vm *vm, int vcpu); cpuset_t vm_active_cpus(struct vm *vm); +cpuset_t vm_suspended_cpus(struct vm *vm); struct vm_exit *vm_exitinfo(struct vm *vm, int vcpuid); void vm_exit_suspended(struct vm *vm, int vcpuid, uint64_t rip); +void vm_exit_rendezvous(struct vm *vm, int vcpuid, uint64_t rip); +void vm_exit_astpending(struct vm *vm, int vcpuid, uint64_t rip); /* * Rendezvous all vcpus specified in 'dest' and execute 'func(arg)'. @@ -203,6 +270,14 @@ vcpu_is_running(struct vm *vm, int vcpu, int *hostcpu) return (vcpu_get_state(vm, vcpu, hostcpu) == VCPU_RUNNING); } +#ifdef _SYS_PROC_H_ +static int __inline +vcpu_should_yield(struct vm *vm, int vcpu) +{ + return (curthread->td_flags & (TDF_ASTPENDING | TDF_NEEDRESCHED)); +} +#endif + void *vcpu_stats(struct vm *vm, int vcpu); void vcpu_notify_event(struct vm *vm, int vcpuid, bool lapic_intr); struct vmspace *vm_get_vmspace(struct vm *vm); @@ -225,64 +300,67 @@ struct vatpit *vm_atpit(struct vm *vm); int vm_inject_exception(struct vm *vm, int vcpuid, struct vm_exception *vme); /* - * Returns 0 if there is no exception pending for this vcpu. Returns 1 if an - * exception is pending and also updates 'vme'. The pending exception is - * cleared when this function returns. + * This function is called after a VM-exit that occurred during exception or + * interrupt delivery through the IDT. The format of 'intinfo' is described + * in Figure 15-1, "EXITINTINFO for All Intercepts", APM, Vol 2. * - * This function should only be called in the context of the thread that is - * executing this vcpu. + * If a VM-exit handler completes the event delivery successfully then it + * should call vm_exit_intinfo() to extinguish the pending event. For e.g., + * if the task switch emulation is triggered via a task gate then it should + * call this function with 'intinfo=0' to indicate that the external event + * is not pending anymore. + * + * Return value is 0 on success and non-zero on failure. */ -int vm_exception_pending(struct vm *vm, int vcpuid, struct vm_exception *vme); - -void vm_inject_gp(struct vm *vm, int vcpuid); /* general protection fault */ -void vm_inject_ud(struct vm *vm, int vcpuid); /* undefined instruction fault */ - -#endif /* KERNEL */ - -#include - -#define VM_MAXCPU 16 /* maximum virtual cpus */ +int vm_exit_intinfo(struct vm *vm, int vcpuid, uint64_t intinfo); /* - * Identifiers for architecturally defined registers. + * This function is called before every VM-entry to retrieve a pending + * event that should be injected into the guest. This function combines + * nested events into a double or triple fault. + * + * Returns 0 if there are no events that need to be injected into the guest + * and non-zero otherwise. */ -enum vm_reg_name { - VM_REG_GUEST_RAX, - VM_REG_GUEST_RBX, - VM_REG_GUEST_RCX, - VM_REG_GUEST_RDX, - VM_REG_GUEST_RSI, - VM_REG_GUEST_RDI, - VM_REG_GUEST_RBP, - VM_REG_GUEST_R8, - VM_REG_GUEST_R9, - VM_REG_GUEST_R10, - VM_REG_GUEST_R11, - VM_REG_GUEST_R12, - VM_REG_GUEST_R13, - VM_REG_GUEST_R14, - VM_REG_GUEST_R15, - VM_REG_GUEST_CR0, - VM_REG_GUEST_CR3, - VM_REG_GUEST_CR4, - VM_REG_GUEST_DR7, - VM_REG_GUEST_RSP, - VM_REG_GUEST_RIP, - VM_REG_GUEST_RFLAGS, - VM_REG_GUEST_ES, - VM_REG_GUEST_CS, - VM_REG_GUEST_SS, - VM_REG_GUEST_DS, - VM_REG_GUEST_FS, - VM_REG_GUEST_GS, - VM_REG_GUEST_LDTR, - VM_REG_GUEST_TR, - VM_REG_GUEST_IDTR, - VM_REG_GUEST_GDTR, - VM_REG_GUEST_EFER, - VM_REG_LAST +int vm_entry_intinfo(struct vm *vm, int vcpuid, uint64_t *info); + +int vm_get_intinfo(struct vm *vm, int vcpuid, uint64_t *info1, uint64_t *info2); + +enum vm_reg_name vm_segment_name(int seg_encoding); + +struct vm_copyinfo { + uint64_t gpa; + size_t len; + void *hva; + void *cookie; }; +/* + * Set up 'copyinfo[]' to copy to/from guest linear address space starting + * at 'gla' and 'len' bytes long. The 'prot' should be set to PROT_READ for + * a copyin or PROT_WRITE for a copyout. + * + * Returns 0 on success. + * Returns 1 if an exception was injected into the guest. + * Returns -1 otherwise. + * + * The 'copyinfo[]' can be passed to 'vm_copyin()' or 'vm_copyout()' only if + * the return value is 0. The 'copyinfo[]' resources should be freed by calling + * 'vm_copy_teardown()' after the copy is done. + */ +int vm_copy_setup(struct vm *vm, int vcpuid, struct vm_guest_paging *paging, + uint64_t gla, size_t len, int prot, struct vm_copyinfo *copyinfo, + int num_copyinfo); +void vm_copy_teardown(struct vm *vm, int vcpuid, struct vm_copyinfo *copyinfo, + int num_copyinfo); +void vm_copyin(struct vm *vm, int vcpuid, struct vm_copyinfo *copyinfo, + void *kaddr, size_t len); +void vm_copyout(struct vm *vm, int vcpuid, const void *kaddr, + struct vm_copyinfo *copyinfo, size_t len); +#endif /* KERNEL */ + +#define VM_MAXCPU 16 /* maximum virtual cpus */ + /* * Identifiers for optional vmm capabilities */ @@ -295,12 +373,11 @@ enum vm_cap_type { VM_CAP_MAX }; -enum x2apic_state { - X2APIC_DISABLED, - X2APIC_ENABLED, - X2APIC_STATE_LAST +enum vm_intr_trigger { + EDGE_TRIGGER, + LEVEL_TRIGGER }; - + /* * The 'access' field has the format specified in Table 21-2 of the Intel * Architecture Manual vol 3b. @@ -313,6 +390,82 @@ struct seg_desc { uint32_t limit; uint32_t access; }; +#define SEG_DESC_TYPE(access) ((access) & 0x001f) +#define SEG_DESC_DPL(access) (((access) >> 5) & 0x3) +#define SEG_DESC_PRESENT(access) (((access) & 0x0080) ? 1 : 0) +#define SEG_DESC_DEF32(access) (((access) & 0x4000) ? 1 : 0) +#define SEG_DESC_GRANULARITY(access) (((access) & 0x8000) ? 1 : 0) +#define SEG_DESC_UNUSABLE(access) (((access) & 0x10000) ? 1 : 0) + +enum vm_cpu_mode { + CPU_MODE_REAL, + CPU_MODE_PROTECTED, + CPU_MODE_COMPATIBILITY, /* IA-32E mode (CS.L = 0) */ + CPU_MODE_64BIT, /* IA-32E mode (CS.L = 1) */ +}; + +enum vm_paging_mode { + PAGING_MODE_FLAT, + PAGING_MODE_32, + PAGING_MODE_PAE, + PAGING_MODE_64, +}; + +struct vm_guest_paging { + uint64_t cr3; + int cpl; + enum vm_cpu_mode cpu_mode; + enum vm_paging_mode paging_mode; +}; + +/* + * The data structures 'vie' and 'vie_op' are meant to be opaque to the + * consumers of instruction decoding. The only reason why their contents + * need to be exposed is because they are part of the 'vm_exit' structure. + */ +struct vie_op { + uint8_t op_byte; /* actual opcode byte */ + uint8_t op_type; /* type of operation (e.g. MOV) */ + uint16_t op_flags; +}; + +#define VIE_INST_SIZE 15 +struct vie { + uint8_t inst[VIE_INST_SIZE]; /* instruction bytes */ + uint8_t num_valid; /* size of the instruction */ + uint8_t num_processed; + + uint8_t addrsize:4, opsize:4; /* address and operand sizes */ + uint8_t rex_w:1, /* REX prefix */ + rex_r:1, + rex_x:1, + rex_b:1, + rex_present:1, + opsize_override:1, /* Operand size override */ + addrsize_override:1; /* Address size override */ + + uint8_t mod:2, /* ModRM byte */ + reg:4, + rm:4; + + uint8_t ss:2, /* SIB byte */ + index:4, + base:4; + + uint8_t disp_bytes; + uint8_t imm_bytes; + + uint8_t scale; + int base_register; /* VM_REG_GUEST_xyz */ + int index_register; /* VM_REG_GUEST_xyz */ + + int64_t displacement; /* optional addr displacement */ + int64_t immediate; /* optional immediate operand */ + + uint8_t decoded; /* set to 1 if successfully decoded */ + + struct vie_op op; /* opcode description */ +}; enum vm_exitcode { VM_EXITCODE_INOUT, @@ -330,22 +483,55 @@ enum vm_exitcode { VM_EXITCODE_RENDEZVOUS, VM_EXITCODE_IOAPIC_EOI, VM_EXITCODE_SUSPENDED, + VM_EXITCODE_INOUT_STR, + VM_EXITCODE_TASK_SWITCH, VM_EXITCODE_MAX }; +struct vm_inout { + uint16_t bytes:3; /* 1 or 2 or 4 */ + uint16_t in:1; + uint16_t string:1; + uint16_t rep:1; + uint16_t port; + uint32_t eax; /* valid for out */ +}; + +struct vm_inout_str { + struct vm_inout inout; /* must be the first element */ + struct vm_guest_paging paging; + uint64_t rflags; + uint64_t cr0; + uint64_t index; + uint64_t count; /* rep=1 (%rcx), rep=0 (1) */ + int addrsize; + enum vm_reg_name seg_name; + struct seg_desc seg_desc; +}; + +enum task_switch_reason { + TSR_CALL, + TSR_IRET, + TSR_JMP, + TSR_IDT_GATE, /* task gate in IDT */ +}; + +struct vm_task_switch { + uint16_t tsssel; /* new TSS selector */ + int ext; /* task switch due to external event */ + uint32_t errcode; + int errcode_valid; /* push 'errcode' on the new stack */ + enum task_switch_reason reason; + struct vm_guest_paging paging; +}; + struct vm_exit { enum vm_exitcode exitcode; int inst_length; /* 0 means unknown */ uint64_t rip; union { - struct { - uint16_t bytes:3; /* 1 or 2 or 4 */ - uint16_t in:1; /* out is 0, in is 1 */ - uint16_t string:1; - uint16_t rep:1; - uint16_t port; - uint32_t eax; /* valid for out */ - } inout; + struct vm_inout inout; + struct vm_inout_str inout_str; struct { uint64_t gpa; int fault_type; @@ -353,9 +539,8 @@ struct vm_exit { struct { uint64_t gpa; uint64_t gla; - uint64_t cr3; - enum vie_cpu_mode cpu_mode; - enum vie_paging_mode paging_mode; + int cs_d; /* CS.D */ + struct vm_guest_paging paging; struct vie vie; } inst_emul; /* @@ -394,7 +579,38 @@ struct vm_exit { struct { enum vm_suspend_how how; } suspended; + struct vm_task_switch task_switch; } u; }; +/* APIs to inject faults into the guest */ +void vm_inject_fault(void *vm, int vcpuid, int vector, int errcode_valid, + int errcode); + +static void __inline +vm_inject_ud(void *vm, int vcpuid) +{ + vm_inject_fault(vm, vcpuid, IDT_UD, 0, 0); +} + +static void __inline +vm_inject_gp(void *vm, int vcpuid) +{ + vm_inject_fault(vm, vcpuid, IDT_GP, 1, 0); +} + +static void __inline +vm_inject_ac(void *vm, int vcpuid, int errcode) +{ + vm_inject_fault(vm, vcpuid, IDT_AC, 1, errcode); +} + +static void __inline +vm_inject_ss(void *vm, int vcpuid, int errcode) +{ + vm_inject_fault(vm, vcpuid, IDT_SS, 1, errcode); +} + +void vm_inject_pf(void *vm, int vcpuid, int error_code, uint64_t cr2); + #endif /* _VMM_H_ */ diff --git a/sys/amd64/include/vmm_dev.h b/sys/amd64/include/vmm_dev.h index fcd437f0198..e4d839ef654 100644 --- a/sys/amd64/include/vmm_dev.h +++ b/sys/amd64/include/vmm_dev.h @@ -84,6 +84,11 @@ struct vm_isa_irq { int ioapic_irq; }; +struct vm_isa_irq_trigger { + int atpic_irq; + enum vm_intr_trigger trigger; +}; + struct vm_capability { int cpuid; enum vm_cap_type captype; @@ -163,6 +168,33 @@ struct vm_suspend { enum vm_suspend_how how; }; +struct vm_gla2gpa { + int vcpuid; /* inputs */ + int prot; /* PROT_READ or PROT_WRITE */ + uint64_t gla; + struct vm_guest_paging paging; + int fault; /* outputs */ + uint64_t gpa; +}; + +struct vm_activate_cpu { + int vcpuid; +}; + +struct vm_cpuset { + int which; + int cpusetsize; + cpuset_t *cpus; +}; +#define VM_ACTIVE_CPUS 0 +#define VM_SUSPENDED_CPUS 1 + +struct vm_intinfo { + int vcpuid; + uint64_t info1; + uint64_t info2; +}; + enum { /* general routines */ IOCNUM_ABIVERS = 0, @@ -170,11 +202,13 @@ enum { IOCNUM_SET_CAPABILITY = 2, IOCNUM_GET_CAPABILITY = 3, IOCNUM_SUSPEND = 4, + IOCNUM_REINIT = 5, /* memory apis */ IOCNUM_MAP_MEMORY = 10, IOCNUM_GET_MEMORY_SEG = 11, IOCNUM_GET_GPA_PMAP = 12, + IOCNUM_GLA2GPA = 13, /* register/state accessors */ IOCNUM_SET_REGISTER = 20, @@ -183,6 +217,8 @@ enum { IOCNUM_GET_SEGMENT_DESCRIPTOR = 23, /* interrupt injection */ + IOCNUM_GET_INTINFO = 28, + IOCNUM_SET_INTINFO = 29, IOCNUM_INJECT_EXCEPTION = 30, IOCNUM_LAPIC_IRQ = 31, IOCNUM_INJECT_NMI = 32, @@ -213,12 +249,19 @@ enum { IOCNUM_ISA_ASSERT_IRQ = 80, IOCNUM_ISA_DEASSERT_IRQ = 81, IOCNUM_ISA_PULSE_IRQ = 82, + IOCNUM_ISA_SET_IRQ_TRIGGER = 83, + + /* vm_cpuset */ + IOCNUM_ACTIVATE_CPU = 90, + IOCNUM_GET_CPUSET = 91, }; #define VM_RUN \ _IOWR('v', IOCNUM_RUN, struct vm_run) #define VM_SUSPEND \ _IOW('v', IOCNUM_SUSPEND, struct vm_suspend) +#define VM_REINIT \ + _IO('v', IOCNUM_REINIT) #define VM_MAP_MEMORY \ _IOWR('v', IOCNUM_MAP_MEMORY, struct vm_memory_segment) #define VM_GET_MEMORY_SEG \ @@ -253,6 +296,8 @@ enum { _IOW('v', IOCNUM_ISA_DEASSERT_IRQ, struct vm_isa_irq) #define VM_ISA_PULSE_IRQ \ _IOW('v', IOCNUM_ISA_PULSE_IRQ, struct vm_isa_irq) +#define VM_ISA_SET_IRQ_TRIGGER \ + _IOW('v', IOCNUM_ISA_SET_IRQ_TRIGGER, struct vm_isa_irq_trigger) #define VM_SET_CAPABILITY \ _IOW('v', IOCNUM_SET_CAPABILITY, struct vm_capability) #define VM_GET_CAPABILITY \ @@ -281,4 +326,14 @@ enum { _IOR('v', IOCNUM_GET_HPET_CAPABILITIES, struct vm_hpet_cap) #define VM_GET_GPA_PMAP \ _IOWR('v', IOCNUM_GET_GPA_PMAP, struct vm_gpa_pte) +#define VM_GLA2GPA \ + _IOWR('v', IOCNUM_GLA2GPA, struct vm_gla2gpa) +#define VM_ACTIVATE_CPU \ + _IOW('v', IOCNUM_ACTIVATE_CPU, struct vm_activate_cpu) +#define VM_GET_CPUS \ + _IOW('v', IOCNUM_GET_CPUSET, struct vm_cpuset) +#define VM_SET_INTINFO \ + _IOW('v', IOCNUM_SET_INTINFO, struct vm_intinfo) +#define VM_GET_INTINFO \ + _IOWR('v', IOCNUM_GET_INTINFO, struct vm_intinfo) #endif diff --git a/sys/amd64/include/vmm_instruction_emul.h b/sys/amd64/include/vmm_instruction_emul.h index 0901aa21fac..bbd3d88d9cf 100644 --- a/sys/amd64/include/vmm_instruction_emul.h +++ b/sys/amd64/include/vmm_instruction_emul.h @@ -29,63 +29,7 @@ #ifndef _VMM_INSTRUCTION_EMUL_H_ #define _VMM_INSTRUCTION_EMUL_H_ -enum vie_cpu_mode { - CPU_MODE_COMPATIBILITY, /* IA-32E mode (CS.L = 0) */ - CPU_MODE_64BIT, /* IA-32E mode (CS.L = 1) */ -}; - -enum vie_paging_mode { - PAGING_MODE_FLAT, - PAGING_MODE_32, - PAGING_MODE_PAE, - PAGING_MODE_64, -}; - -/* - * The data structures 'vie' and 'vie_op' are meant to be opaque to the - * consumers of instruction decoding. The only reason why their contents - * need to be exposed is because they are part of the 'vm_exit' structure. - */ -struct vie_op { - uint8_t op_byte; /* actual opcode byte */ - uint8_t op_type; /* type of operation (e.g. MOV) */ - uint16_t op_flags; -}; - -#define VIE_INST_SIZE 15 -struct vie { - uint8_t inst[VIE_INST_SIZE]; /* instruction bytes */ - uint8_t num_valid; /* size of the instruction */ - uint8_t num_processed; - - uint8_t rex_w:1, /* REX prefix */ - rex_r:1, - rex_x:1, - rex_b:1, - rex_present:1; - - uint8_t mod:2, /* ModRM byte */ - reg:4, - rm:4; - - uint8_t ss:2, /* SIB byte */ - index:4, - base:4; - - uint8_t disp_bytes; - uint8_t imm_bytes; - - uint8_t scale; - int base_register; /* VM_REG_GUEST_xyz */ - int index_register; /* VM_REG_GUEST_xyz */ - - int64_t displacement; /* optional addr displacement */ - int64_t immediate; /* optional immediate operand */ - - uint8_t decoded; /* set to 1 if successfully decoded */ - - struct vie_op op; /* opcode description */ -}; +#include /* * Callback functions to read and write memory regions. @@ -108,8 +52,26 @@ typedef int (*mem_region_write_t)(void *vm, int cpuid, uint64_t gpa, * s */ int vmm_emulate_instruction(void *vm, int cpuid, uint64_t gpa, struct vie *vie, - mem_region_read_t mrr, mem_region_write_t mrw, - void *mrarg); + struct vm_guest_paging *paging, mem_region_read_t mrr, + mem_region_write_t mrw, void *mrarg); + +int vie_update_register(void *vm, int vcpuid, enum vm_reg_name reg, + uint64_t val, int size); + +/* + * Returns 1 if an alignment check exception should be injected and 0 otherwise. + */ +int vie_alignment_check(int cpl, int operand_size, uint64_t cr0, + uint64_t rflags, uint64_t gla); + +/* Returns 1 if the 'gla' is not canonical and 0 otherwise. */ +int vie_canonical_check(enum vm_cpu_mode cpu_mode, uint64_t gla); + +uint64_t vie_size2mask(int size); + +int vie_calculate_gla(enum vm_cpu_mode cpu_mode, enum vm_reg_name seg, + struct seg_desc *desc, uint64_t off, int length, int addrsize, int prot, + uint64_t *gla); #ifdef _KERNEL /* @@ -118,8 +80,18 @@ int vmm_emulate_instruction(void *vm, int cpuid, uint64_t gpa, struct vie *vie, * 'vie' must be initialized before calling 'vmm_fetch_instruction()' */ int vmm_fetch_instruction(struct vm *vm, int cpuid, - uint64_t rip, int inst_length, uint64_t cr3, - enum vie_paging_mode paging_mode, struct vie *vie); + struct vm_guest_paging *guest_paging, + uint64_t rip, int inst_length, struct vie *vie); + +/* + * Translate the guest linear address 'gla' to a guest physical address. + * + * Returns 0 on success and '*gpa' contains the result of the translation. + * Returns 1 if an exception was injected into the guest. + * Returns -1 otherwise. + */ +int vmm_gla2gpa(struct vm *vm, int vcpuid, struct vm_guest_paging *paging, + uint64_t gla, int prot, uint64_t *gpa); void vie_init(struct vie *vie); @@ -136,7 +108,7 @@ void vie_init(struct vie *vie); */ #define VIE_INVALID_GLA (1UL << 63) /* a non-canonical address */ int vmm_decode_instruction(struct vm *vm, int cpuid, uint64_t gla, - enum vie_cpu_mode cpu_mode, struct vie *vie); + enum vm_cpu_mode cpu_mode, int csd, struct vie *vie); #endif /* _KERNEL */ #endif /* _VMM_INSTRUCTION_EMUL_H_ */ diff --git a/sys/amd64/pci/pci_cfgreg.c b/sys/amd64/pci/pci_cfgreg.c index 706fdd381ac..0039008b345 100644 --- a/sys/amd64/pci/pci_cfgreg.c +++ b/sys/amd64/pci/pci_cfgreg.c @@ -65,7 +65,6 @@ static int pcie_minbus, pcie_maxbus; static uint32_t pcie_badslots; static struct mtx pcicfg_mtx; static int mcfg_enable = 1; -TUNABLE_INT("hw.pci.mcfg", &mcfg_enable); SYSCTL_INT(_hw_pci, OID_AUTO, mcfg, CTLFLAG_RDTUN, &mcfg_enable, 0, "Enable support for PCI-e memory mapped config access"); diff --git a/sys/amd64/vmm/intel/vmcs.c b/sys/amd64/vmm/intel/vmcs.c index 1ddefe0d683..51e5c2c06f0 100644 --- a/sys/amd64/vmm/intel/vmcs.c +++ b/sys/amd64/vmm/intel/vmcs.c @@ -103,6 +103,14 @@ vmcs_field_encoding(int ident) return (VMCS_GUEST_LDTR_SELECTOR); case VM_REG_GUEST_EFER: return (VMCS_GUEST_IA32_EFER); + case VM_REG_GUEST_PDPTE0: + return (VMCS_GUEST_PDPTE0); + case VM_REG_GUEST_PDPTE1: + return (VMCS_GUEST_PDPTE1); + case VM_REG_GUEST_PDPTE2: + return (VMCS_GUEST_PDPTE2); + case VM_REG_GUEST_PDPTE3: + return (VMCS_GUEST_PDPTE3); default: return (-1); } @@ -231,7 +239,7 @@ vmcs_setreg(struct vmcs *vmcs, int running, int ident, uint64_t val) } int -vmcs_setdesc(struct vmcs *vmcs, int seg, struct seg_desc *desc) +vmcs_setdesc(struct vmcs *vmcs, int running, int seg, struct seg_desc *desc) { int error; uint32_t base, limit, access; @@ -240,7 +248,8 @@ vmcs_setdesc(struct vmcs *vmcs, int seg, struct seg_desc *desc) if (error != 0) panic("vmcs_setdesc: invalid segment register %d", seg); - VMPTRLD(vmcs); + if (!running) + VMPTRLD(vmcs); if ((error = vmwrite(base, desc->base)) != 0) goto done; @@ -252,12 +261,13 @@ vmcs_setdesc(struct vmcs *vmcs, int seg, struct seg_desc *desc) goto done; } done: - VMCLEAR(vmcs); + if (!running) + VMCLEAR(vmcs); return (error); } int -vmcs_getdesc(struct vmcs *vmcs, int seg, struct seg_desc *desc) +vmcs_getdesc(struct vmcs *vmcs, int running, int seg, struct seg_desc *desc) { int error; uint32_t base, limit, access; @@ -267,7 +277,8 @@ vmcs_getdesc(struct vmcs *vmcs, int seg, struct seg_desc *desc) if (error != 0) panic("vmcs_getdesc: invalid segment register %d", seg); - VMPTRLD(vmcs); + if (!running) + VMPTRLD(vmcs); if ((error = vmread(base, &u64)) != 0) goto done; desc->base = u64; @@ -282,7 +293,8 @@ vmcs_getdesc(struct vmcs *vmcs, int seg, struct seg_desc *desc) desc->access = u64; } done: - VMCLEAR(vmcs); + if (!running) + VMCLEAR(vmcs); return (error); } diff --git a/sys/amd64/vmm/intel/vmcs.h b/sys/amd64/vmm/intel/vmcs.h index 9cde99903f5..4e9557c39b9 100644 --- a/sys/amd64/vmm/intel/vmcs.h +++ b/sys/amd64/vmm/intel/vmcs.h @@ -49,9 +49,9 @@ int vmcs_set_msr_save(struct vmcs *vmcs, u_long g_area, u_int g_count); int vmcs_init(struct vmcs *vmcs); int vmcs_getreg(struct vmcs *vmcs, int running, int ident, uint64_t *rv); int vmcs_setreg(struct vmcs *vmcs, int running, int ident, uint64_t val); -int vmcs_getdesc(struct vmcs *vmcs, int ident, +int vmcs_getdesc(struct vmcs *vmcs, int running, int ident, struct seg_desc *desc); -int vmcs_setdesc(struct vmcs *vmcs, int ident, +int vmcs_setdesc(struct vmcs *vmcs, int running, int ident, struct seg_desc *desc); static __inline uint64_t @@ -346,6 +346,9 @@ vmcs_write(uint32_t encoding, uint64_t val) #define VMCS_INTR_T_HWINTR (0 << 8) #define VMCS_INTR_T_NMI (2 << 8) #define VMCS_INTR_T_HWEXCEPTION (3 << 8) +#define VMCS_INTR_T_SWINTR (4 << 8) +#define VMCS_INTR_T_PRIV_SWEXCEPTION (5 << 8) +#define VMCS_INTR_T_SWEXCEPTION (6 << 8) #define VMCS_INTR_DEL_ERRCODE (1 << 11) /* diff --git a/sys/amd64/vmm/intel/vmx.c b/sys/amd64/vmm/intel/vmx.c index 767bcc5132d..54b2998396b 100644 --- a/sys/amd64/vmm/intel/vmx.c +++ b/sys/amd64/vmm/intel/vmx.c @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "vmm_host.h" #include "vmm_ioport.h" #include "vmm_ipi.h" @@ -82,7 +83,9 @@ __FBSDID("$FreeBSD$"); (PROCBASED_SECONDARY_CONTROLS | \ PROCBASED_IO_EXITING | \ PROCBASED_MSR_BITMAPS | \ - PROCBASED_CTLS_WINDOW_SETTING) + PROCBASED_CTLS_WINDOW_SETTING | \ + PROCBASED_CR8_LOAD_EXITING | \ + PROCBASED_CR8_STORE_EXITING) #define PROCBASED_CTLS_ZERO_SETTING \ (PROCBASED_CR3_LOAD_EXITING | \ PROCBASED_CR3_STORE_EXITING | \ @@ -185,6 +188,8 @@ SYSCTL_UINT(_hw_vmm_vmx, OID_AUTO, vpid_alloc_failed, CTLFLAG_RD, */ #define APIC_ACCESS_ADDRESS 0xFFFFF000 +static int vmx_getdesc(void *arg, int vcpu, int reg, struct seg_desc *desc); +static int vmx_getreg(void *arg, int vcpu, int reg, uint64_t *retval); static void vmx_inject_pir(struct vlapic *vlapic); #ifdef KTR @@ -509,6 +514,15 @@ static void vmx_enable(void *arg __unused) { int error; + uint64_t feature_control; + + feature_control = rdmsr(MSR_IA32_FEATURE_CONTROL); + if ((feature_control & IA32_FEATURE_CONTROL_LOCK) == 0 || + (feature_control & IA32_FEATURE_CONTROL_VMX_EN) == 0) { + wrmsr(MSR_IA32_FEATURE_CONTROL, + feature_control | IA32_FEATURE_CONTROL_VMX_EN | + IA32_FEATURE_CONTROL_LOCK); + } load_cr4(rcr4() | CR4_VMXE); @@ -530,7 +544,7 @@ static int vmx_init(int ipinum) { int error, use_tpr_shadow; - uint64_t fixed0, fixed1, feature_control; + uint64_t basic, fixed0, fixed1, feature_control; uint32_t tmp, procbased2_vid_bits; /* CPUID.1:ECX[bit 5] must be 1 for processor to support VMX */ @@ -544,12 +558,23 @@ vmx_init(int ipinum) * are set (bits 0 and 2 respectively). */ feature_control = rdmsr(MSR_IA32_FEATURE_CONTROL); - if ((feature_control & IA32_FEATURE_CONTROL_LOCK) == 0 || + if ((feature_control & IA32_FEATURE_CONTROL_LOCK) == 1 && (feature_control & IA32_FEATURE_CONTROL_VMX_EN) == 0) { printf("vmx_init: VMX operation disabled by BIOS\n"); return (ENXIO); } + /* + * Verify capabilities MSR_VMX_BASIC: + * - bit 54 indicates support for INS/OUTS decoding + */ + basic = rdmsr(MSR_VMX_BASIC); + if ((basic & (1UL << 54)) == 0) { + printf("vmx_init: processor does not support desired basic " + "capabilities\n"); + return (EINVAL); + } + /* Check support for primary processor-based VM-execution controls */ error = vmx_set_ctlreg(MSR_VMX_PROCBASED_CTLS, MSR_VMX_TRUE_PROCBASED_CTLS, @@ -690,6 +715,13 @@ vmx_init(int ipinum) procbased_ctls2 |= procbased2_vid_bits; procbased_ctls2 &= ~PROCBASED2_VIRTUALIZE_X2APIC_MODE; + /* + * No need to emulate accesses to %CR8 if virtual + * interrupt delivery is enabled. + */ + procbased_ctls &= ~PROCBASED_CR8_LOAD_EXITING; + procbased_ctls &= ~PROCBASED_CR8_STORE_EXITING; + /* * Check for Posted Interrupts only if Virtual Interrupt * Delivery is enabled. @@ -942,7 +974,7 @@ vmx_vminit(struct vm *vm, pmap_t pmap) vmx->cap[i].proc_ctls = procbased_ctls; vmx->cap[i].proc_ctls2 = procbased_ctls2; - vmx->state[i].lastcpu = -1; + vmx->state[i].lastcpu = NOCPU; vmx->state[i].vpid = vpid[i]; msr_save_area_init(vmx->guest_msrs[i], &guest_msr_count); @@ -1015,27 +1047,37 @@ vmx_astpending_trace(struct vmx *vmx, int vcpu, uint64_t rip) } static VMM_STAT_INTEL(VCPU_INVVPID_SAVED, "Number of vpid invalidations saved"); +static VMM_STAT_INTEL(VCPU_INVVPID_DONE, "Number of vpid invalidations done"); -static void -vmx_set_pcpu_defaults(struct vmx *vmx, int vcpu, pmap_t pmap) +/* + * Invalidate guest mappings identified by its vpid from the TLB. + */ +static __inline void +vmx_invvpid(struct vmx *vmx, int vcpu, pmap_t pmap, int running) { struct vmxstate *vmxstate; struct invvpid_desc invvpid_desc; vmxstate = &vmx->state[vcpu]; - if (vmxstate->lastcpu == curcpu) + if (vmxstate->vpid == 0) return; - vmxstate->lastcpu = curcpu; + if (!running) { + /* + * Set the 'lastcpu' to an invalid host cpu. + * + * This will invalidate TLB entries tagged with the vcpu's + * vpid the next time it runs via vmx_set_pcpu_defaults(). + */ + vmxstate->lastcpu = NOCPU; + return; + } - vmm_stat_incr(vmx->vm, vcpu, VCPU_MIGRATIONS, 1); - - vmcs_write(VMCS_HOST_TR_BASE, vmm_get_host_trbase()); - vmcs_write(VMCS_HOST_GDTR_BASE, vmm_get_host_gdtrbase()); - vmcs_write(VMCS_HOST_GS_BASE, vmm_get_host_gsbase()); + KASSERT(curthread->td_critnest > 0, ("%s: vcpu %d running outside " + "critical section", __func__, vcpu)); /* - * If we are using VPIDs then invalidate all mappings tagged with 'vpid' + * Invalidate all mappings tagged with 'vpid' * * We do this because this vcpu was executing on a different host * cpu when it last ran. We do not track whether it invalidated @@ -1049,25 +1091,43 @@ vmx_set_pcpu_defaults(struct vmx *vmx, int vcpu, pmap_t pmap) * Note also that this will invalidate mappings tagged with 'vpid' * for "all" EP4TAs. */ - if (vmxstate->vpid != 0) { - if (pmap->pm_eptgen == vmx->eptgen[curcpu]) { - invvpid_desc._res1 = 0; - invvpid_desc._res2 = 0; - invvpid_desc.vpid = vmxstate->vpid; - invvpid_desc.linear_addr = 0; - invvpid(INVVPID_TYPE_SINGLE_CONTEXT, invvpid_desc); - } else { - /* - * The invvpid can be skipped if an invept is going to - * be performed before entering the guest. The invept - * will invalidate combined mappings tagged with - * 'vmx->eptp' for all vpids. - */ - vmm_stat_incr(vmx->vm, vcpu, VCPU_INVVPID_SAVED, 1); - } + if (pmap->pm_eptgen == vmx->eptgen[curcpu]) { + invvpid_desc._res1 = 0; + invvpid_desc._res2 = 0; + invvpid_desc.vpid = vmxstate->vpid; + invvpid_desc.linear_addr = 0; + invvpid(INVVPID_TYPE_SINGLE_CONTEXT, invvpid_desc); + vmm_stat_incr(vmx->vm, vcpu, VCPU_INVVPID_DONE, 1); + } else { + /* + * The invvpid can be skipped if an invept is going to + * be performed before entering the guest. The invept + * will invalidate combined mappings tagged with + * 'vmx->eptp' for all vpids. + */ + vmm_stat_incr(vmx->vm, vcpu, VCPU_INVVPID_SAVED, 1); } } +static void +vmx_set_pcpu_defaults(struct vmx *vmx, int vcpu, pmap_t pmap) +{ + struct vmxstate *vmxstate; + + vmxstate = &vmx->state[vcpu]; + if (vmxstate->lastcpu == curcpu) + return; + + vmxstate->lastcpu = curcpu; + + vmm_stat_incr(vmx->vm, vcpu, VCPU_MIGRATIONS, 1); + + vmcs_write(VMCS_HOST_TR_BASE, vmm_get_host_trbase()); + vmcs_write(VMCS_HOST_GDTR_BASE, vmm_get_host_gdtrbase()); + vmcs_write(VMCS_HOST_GS_BASE, vmm_get_host_gsbase()); + vmx_invvpid(vmx, vcpu, pmap, 1); +} + /* * We depend on 'procbased_ctls' to have the Interrupt Window Exiting bit set. */ @@ -1151,24 +1211,32 @@ vmx_inject_nmi(struct vmx *vmx, int vcpu) static void vmx_inject_interrupts(struct vmx *vmx, int vcpu, struct vlapic *vlapic) { - struct vm_exception exc; int vector, need_nmi_exiting, extint_pending; - uint64_t rflags; + uint64_t rflags, entryinfo; uint32_t gi, info; - if (vm_exception_pending(vmx->vm, vcpu, &exc)) { - KASSERT(exc.vector >= 0 && exc.vector < 32, - ("%s: invalid exception vector %d", __func__, exc.vector)); + if (vm_entry_intinfo(vmx->vm, vcpu, &entryinfo)) { + KASSERT((entryinfo & VMCS_INTR_VALID) != 0, ("%s: entry " + "intinfo is not valid: %#lx", __func__, entryinfo)); info = vmcs_read(VMCS_ENTRY_INTR_INFO); KASSERT((info & VMCS_INTR_VALID) == 0, ("%s: cannot inject " - "pending exception %d: %#x", __func__, exc.vector, info)); + "pending exception: %#lx/%#x", __func__, entryinfo, info)); - info = exc.vector | VMCS_INTR_T_HWEXCEPTION | VMCS_INTR_VALID; - if (exc.error_code_valid) { - info |= VMCS_INTR_DEL_ERRCODE; - vmcs_write(VMCS_ENTRY_EXCEPTION_ERROR, exc.error_code); + info = entryinfo; + vector = info & 0xff; + if (vector == IDT_BP || vector == IDT_OF) { + /* + * VT-x requires #BP and #OF to be injected as software + * exceptions. + */ + info &= ~VMCS_INTR_T_MASK; + info |= VMCS_INTR_T_SWEXCEPTION; } + + if (info & VMCS_INTR_DEL_ERRCODE) + vmcs_write(VMCS_ENTRY_EXCEPTION_ERROR, entryinfo >> 32); + vmcs_write(VMCS_ENTRY_INTR_INFO, info); } @@ -1226,12 +1294,28 @@ vmx_inject_interrupts(struct vmx *vmx, int vcpu, struct vlapic *vlapic) /* Ask the local apic for a vector to inject */ if (!vlapic_pending_intr(vlapic, &vector)) return; + + /* + * From the Intel SDM, Volume 3, Section "Maskable + * Hardware Interrupts": + * - maskable interrupt vectors [16,255] can be delivered + * through the local APIC. + */ + KASSERT(vector >= 16 && vector <= 255, + ("invalid vector %d from local APIC", vector)); } else { /* Ask the legacy pic for a vector to inject */ vatpic_pending_intr(vmx->vm, &vector); - } - KASSERT(vector >= 32 && vector <= 255, ("invalid vector %d", vector)); + /* + * From the Intel SDM, Volume 3, Section "Maskable + * Hardware Interrupts": + * - maskable interrupt vectors [0,255] can be delivered + * through the INTR pin. + */ + KASSERT(vector >= 0 && vector <= 255, + ("invalid vector %d from INTR", vector)); + } /* Check RFLAGS.IF and the interruptibility state of the guest */ rflags = vmcs_read(VMCS_GUEST_RFLAGS); @@ -1279,9 +1363,13 @@ vmx_inject_interrupts(struct vmx *vmx, int vcpu, struct vlapic *vlapic) * have posted another one. If that is the case, set * the Interrupt Window Exiting execution control so * we can inject that one too. + * + * Also, interrupt window exiting allows us to inject any + * pending APIC vector that was preempted by the ExtINT + * as soon as possible. This applies both for the software + * emulated vlapic and the hardware assisted virtual APIC. */ - if (vm_extint_pending(vmx->vm, vcpu)) - vmx_set_int_window_exiting(vmx, vcpu); + vmx_set_int_window_exiting(vmx, vcpu); } VCPU_CTR1(vmx->vm, vcpu, "Injecting hwintr at vector %d", vector); @@ -1327,6 +1415,16 @@ vmx_clear_nmi_blocking(struct vmx *vmx, int vcpuid) vmcs_write(VMCS_GUEST_INTERRUPTIBILITY, gi); } +static void +vmx_assert_nmi_blocking(struct vmx *vmx, int vcpuid) +{ + uint32_t gi; + + gi = vmcs_read(VMCS_GUEST_INTERRUPTIBILITY); + KASSERT(gi & VMCS_INTERRUPTIBILITY_NMI_BLOCKING, + ("NMI blocking is not in effect %#x", gi)); +} + static int vmx_emulate_xsetbv(struct vmx *vmx, int vcpu, struct vm_exit *vmexit) { @@ -1366,8 +1464,30 @@ vmx_emulate_xsetbv(struct vmx *vmx, int vcpu, struct vm_exit *vmexit) return (HANDLED); } - if ((xcrval & (XFEATURE_ENABLED_AVX | XFEATURE_ENABLED_SSE)) == - XFEATURE_ENABLED_AVX) { + /* AVX (YMM_Hi128) requires SSE. */ + if (xcrval & XFEATURE_ENABLED_AVX && + (xcrval & XFEATURE_AVX) != XFEATURE_AVX) { + vm_inject_gp(vmx->vm, vcpu); + return (HANDLED); + } + + /* + * AVX512 requires base AVX (YMM_Hi128) as well as OpMask, + * ZMM_Hi256, and Hi16_ZMM. + */ + if (xcrval & XFEATURE_AVX512 && + (xcrval & (XFEATURE_AVX512 | XFEATURE_AVX)) != + (XFEATURE_AVX512 | XFEATURE_AVX)) { + vm_inject_gp(vmx->vm, vcpu); + return (HANDLED); + } + + /* + * Intel MPX requires both bound register state flags to be + * set. + */ + if (((xcrval & XFEATURE_ENABLED_BNDREGS) != 0) != + ((xcrval & XFEATURE_ENABLED_BNDCSR) != 0)) { vm_inject_gp(vmx->vm, vcpu); return (HANDLED); } @@ -1381,97 +1501,130 @@ vmx_emulate_xsetbv(struct vmx *vmx, int vcpu, struct vm_exit *vmexit) return (HANDLED); } -static int -vmx_emulate_cr_access(struct vmx *vmx, int vcpu, uint64_t exitqual) +static uint64_t +vmx_get_guest_reg(struct vmx *vmx, int vcpu, int ident) { - int cr, vmcs_guest_cr, vmcs_shadow_cr; - uint64_t crval, regval, ones_mask, zeros_mask; const struct vmxctx *vmxctx; - /* We only handle mov to %cr0 or %cr4 at this time */ + vmxctx = &vmx->ctx[vcpu]; + + switch (ident) { + case 0: + return (vmxctx->guest_rax); + case 1: + return (vmxctx->guest_rcx); + case 2: + return (vmxctx->guest_rdx); + case 3: + return (vmxctx->guest_rbx); + case 4: + return (vmcs_read(VMCS_GUEST_RSP)); + case 5: + return (vmxctx->guest_rbp); + case 6: + return (vmxctx->guest_rsi); + case 7: + return (vmxctx->guest_rdi); + case 8: + return (vmxctx->guest_r8); + case 9: + return (vmxctx->guest_r9); + case 10: + return (vmxctx->guest_r10); + case 11: + return (vmxctx->guest_r11); + case 12: + return (vmxctx->guest_r12); + case 13: + return (vmxctx->guest_r13); + case 14: + return (vmxctx->guest_r14); + case 15: + return (vmxctx->guest_r15); + default: + panic("invalid vmx register %d", ident); + } +} + +static void +vmx_set_guest_reg(struct vmx *vmx, int vcpu, int ident, uint64_t regval) +{ + struct vmxctx *vmxctx; + + vmxctx = &vmx->ctx[vcpu]; + + switch (ident) { + case 0: + vmxctx->guest_rax = regval; + break; + case 1: + vmxctx->guest_rcx = regval; + break; + case 2: + vmxctx->guest_rdx = regval; + break; + case 3: + vmxctx->guest_rbx = regval; + break; + case 4: + vmcs_write(VMCS_GUEST_RSP, regval); + break; + case 5: + vmxctx->guest_rbp = regval; + break; + case 6: + vmxctx->guest_rsi = regval; + break; + case 7: + vmxctx->guest_rdi = regval; + break; + case 8: + vmxctx->guest_r8 = regval; + break; + case 9: + vmxctx->guest_r9 = regval; + break; + case 10: + vmxctx->guest_r10 = regval; + break; + case 11: + vmxctx->guest_r11 = regval; + break; + case 12: + vmxctx->guest_r12 = regval; + break; + case 13: + vmxctx->guest_r13 = regval; + break; + case 14: + vmxctx->guest_r14 = regval; + break; + case 15: + vmxctx->guest_r15 = regval; + break; + default: + panic("invalid vmx register %d", ident); + } +} + +static int +vmx_emulate_cr0_access(struct vmx *vmx, int vcpu, uint64_t exitqual) +{ + uint64_t crval, regval; + + /* We only handle mov to %cr0 at this time */ if ((exitqual & 0xf0) != 0x00) return (UNHANDLED); - cr = exitqual & 0xf; - if (cr != 0 && cr != 4) - return (UNHANDLED); + regval = vmx_get_guest_reg(vmx, vcpu, (exitqual >> 8) & 0xf); - regval = 0; /* silence gcc */ - vmxctx = &vmx->ctx[vcpu]; + vmcs_write(VMCS_CR0_SHADOW, regval); - /* - * We must use vmcs_write() directly here because vmcs_setreg() will - * call vmclear(vmcs) as a side-effect which we certainly don't want. - */ - switch ((exitqual >> 8) & 0xf) { - case 0: - regval = vmxctx->guest_rax; - break; - case 1: - regval = vmxctx->guest_rcx; - break; - case 2: - regval = vmxctx->guest_rdx; - break; - case 3: - regval = vmxctx->guest_rbx; - break; - case 4: - regval = vmcs_read(VMCS_GUEST_RSP); - break; - case 5: - regval = vmxctx->guest_rbp; - break; - case 6: - regval = vmxctx->guest_rsi; - break; - case 7: - regval = vmxctx->guest_rdi; - break; - case 8: - regval = vmxctx->guest_r8; - break; - case 9: - regval = vmxctx->guest_r9; - break; - case 10: - regval = vmxctx->guest_r10; - break; - case 11: - regval = vmxctx->guest_r11; - break; - case 12: - regval = vmxctx->guest_r12; - break; - case 13: - regval = vmxctx->guest_r13; - break; - case 14: - regval = vmxctx->guest_r14; - break; - case 15: - regval = vmxctx->guest_r15; - break; - } + crval = regval | cr0_ones_mask; + crval &= ~cr0_zeros_mask; + vmcs_write(VMCS_GUEST_CR0, crval); - if (cr == 0) { - ones_mask = cr0_ones_mask; - zeros_mask = cr0_zeros_mask; - vmcs_guest_cr = VMCS_GUEST_CR0; - vmcs_shadow_cr = VMCS_CR0_SHADOW; - } else { - ones_mask = cr4_ones_mask; - zeros_mask = cr4_zeros_mask; - vmcs_guest_cr = VMCS_GUEST_CR4; - vmcs_shadow_cr = VMCS_CR4_SHADOW; - } - vmcs_write(vmcs_shadow_cr, regval); - - crval = regval | ones_mask; - crval &= ~zeros_mask; - vmcs_write(vmcs_guest_cr, crval); - - if (cr == 0 && regval & CR0_PG) { + if (regval & CR0_PG) { uint64_t efer, entry_ctls; /* @@ -1492,17 +1645,82 @@ vmx_emulate_cr_access(struct vmx *vmx, int vcpu, uint64_t exitqual) return (HANDLED); } -static enum vie_cpu_mode -vmx_cpu_mode(void) +static int +vmx_emulate_cr4_access(struct vmx *vmx, int vcpu, uint64_t exitqual) { + uint64_t crval, regval; - if (vmcs_read(VMCS_GUEST_IA32_EFER) & EFER_LMA) - return (CPU_MODE_64BIT); - else - return (CPU_MODE_COMPATIBILITY); + /* We only handle mov to %cr4 at this time */ + if ((exitqual & 0xf0) != 0x00) + return (UNHANDLED); + + regval = vmx_get_guest_reg(vmx, vcpu, (exitqual >> 8) & 0xf); + + vmcs_write(VMCS_CR4_SHADOW, regval); + + crval = regval | cr4_ones_mask; + crval &= ~cr4_zeros_mask; + vmcs_write(VMCS_GUEST_CR4, crval); + + return (HANDLED); } -static enum vie_paging_mode +static int +vmx_emulate_cr8_access(struct vmx *vmx, int vcpu, uint64_t exitqual) +{ + struct vlapic *vlapic; + uint64_t cr8; + int regnum; + + /* We only handle mov %cr8 to/from a register at this time. */ + if ((exitqual & 0xe0) != 0x00) { + return (UNHANDLED); + } + + vlapic = vm_lapic(vmx->vm, vcpu); + regnum = (exitqual >> 8) & 0xf; + if (exitqual & 0x10) { + cr8 = vlapic_get_cr8(vlapic); + vmx_set_guest_reg(vmx, vcpu, regnum, cr8); + } else { + cr8 = vmx_get_guest_reg(vmx, vcpu, regnum); + vlapic_set_cr8(vlapic, cr8); + } + + return (HANDLED); +} + +/* + * From section "Guest Register State" in the Intel SDM: CPL = SS.DPL + */ +static int +vmx_cpl(void) +{ + uint32_t ssar; + + ssar = vmcs_read(VMCS_GUEST_SS_ACCESS_RIGHTS); + return ((ssar >> 5) & 0x3); +} + +static enum vm_cpu_mode +vmx_cpu_mode(void) +{ + uint32_t csar; + + if (vmcs_read(VMCS_GUEST_IA32_EFER) & EFER_LMA) { + csar = vmcs_read(VMCS_GUEST_CS_ACCESS_RIGHTS); + if (csar & 0x2000) + return (CPU_MODE_64BIT); /* CS.L = 1 */ + else + return (CPU_MODE_COMPATIBILITY); + } else if (vmcs_read(VMCS_GUEST_CR0) & CR0_PE) { + return (CPU_MODE_PROTECTED); + } else { + return (CPU_MODE_REAL); + } +} + +static enum vm_paging_mode vmx_paging_mode(void) { @@ -1516,6 +1734,104 @@ vmx_paging_mode(void) return (PAGING_MODE_PAE); } +static uint64_t +inout_str_index(struct vmx *vmx, int vcpuid, int in) +{ + uint64_t val; + int error; + enum vm_reg_name reg; + + reg = in ? VM_REG_GUEST_RDI : VM_REG_GUEST_RSI; + error = vmx_getreg(vmx, vcpuid, reg, &val); + KASSERT(error == 0, ("%s: vmx_getreg error %d", __func__, error)); + return (val); +} + +static uint64_t +inout_str_count(struct vmx *vmx, int vcpuid, int rep) +{ + uint64_t val; + int error; + + if (rep) { + error = vmx_getreg(vmx, vcpuid, VM_REG_GUEST_RCX, &val); + KASSERT(!error, ("%s: vmx_getreg error %d", __func__, error)); + } else { + val = 1; + } + return (val); +} + +static int +inout_str_addrsize(uint32_t inst_info) +{ + uint32_t size; + + size = (inst_info >> 7) & 0x7; + switch (size) { + case 0: + return (2); /* 16 bit */ + case 1: + return (4); /* 32 bit */ + case 2: + return (8); /* 64 bit */ + default: + panic("%s: invalid size encoding %d", __func__, size); + } +} + +static void +inout_str_seginfo(struct vmx *vmx, int vcpuid, uint32_t inst_info, int in, + struct vm_inout_str *vis) +{ + int error, s; + + if (in) { + vis->seg_name = VM_REG_GUEST_ES; + } else { + s = (inst_info >> 15) & 0x7; + vis->seg_name = vm_segment_name(s); + } + + error = vmx_getdesc(vmx, vcpuid, vis->seg_name, &vis->seg_desc); + KASSERT(error == 0, ("%s: vmx_getdesc error %d", __func__, error)); + + /* XXX modify svm.c to update bit 16 of seg_desc.access (unusable) */ +} + +static void +vmx_paging_info(struct vm_guest_paging *paging) +{ + paging->cr3 = vmcs_guest_cr3(); + paging->cpl = vmx_cpl(); + paging->cpu_mode = vmx_cpu_mode(); + paging->paging_mode = vmx_paging_mode(); +} + +static void +vmexit_inst_emul(struct vm_exit *vmexit, uint64_t gpa, uint64_t gla) +{ + struct vm_guest_paging *paging; + uint32_t csar; + + paging = &vmexit->u.inst_emul.paging; + + vmexit->exitcode = VM_EXITCODE_INST_EMUL; + vmexit->u.inst_emul.gpa = gpa; + vmexit->u.inst_emul.gla = gla; + vmx_paging_info(paging); + switch (paging->cpu_mode) { + case CPU_MODE_PROTECTED: + case CPU_MODE_COMPATIBILITY: + csar = vmcs_read(VMCS_GUEST_CS_ACCESS_RIGHTS); + vmexit->u.inst_emul.cs_d = SEG_DESC_DEF32(csar); + break; + default: + vmexit->u.inst_emul.cs_d = 0; + break; + } +} + static int ept_fault_type(uint64_t ept_qual) { @@ -1707,12 +2023,8 @@ vmx_handle_apic_access(struct vmx *vmx, int vcpuid, struct vm_exit *vmexit) } if (allowed) { - vmexit->exitcode = VM_EXITCODE_INST_EMUL; - vmexit->u.inst_emul.gpa = DEFAULT_APIC_BASE + offset; - vmexit->u.inst_emul.gla = VIE_INVALID_GLA; - vmexit->u.inst_emul.cr3 = vmcs_guest_cr3(); - vmexit->u.inst_emul.cpu_mode = vmx_cpu_mode(); - vmexit->u.inst_emul.paging_mode = vmx_paging_mode(); + vmexit_inst_emul(vmexit, DEFAULT_APIC_BASE + offset, + VIE_INVALID_GLA); } /* @@ -1726,14 +2038,37 @@ vmx_handle_apic_access(struct vmx *vmx, int vcpuid, struct vm_exit *vmexit) return (UNHANDLED); } +static enum task_switch_reason +vmx_task_switch_reason(uint64_t qual) +{ + int reason; + + reason = (qual >> 30) & 0x3; + switch (reason) { + case 0: + return (TSR_CALL); + case 1: + return (TSR_IRET); + case 2: + return (TSR_JMP); + case 3: + return (TSR_IDT_GATE); + default: + panic("%s: invalid reason %d", __func__, reason); + } +} + static int vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_exit *vmexit) { - int error, handled; + int error, handled, in; struct vmxctx *vmxctx; struct vlapic *vlapic; - uint32_t eax, ecx, edx, idtvec_info, idtvec_err, intr_info, reason; - uint64_t qual, gpa; + struct vm_inout_str *vis; + struct vm_task_switch *ts; + uint32_t eax, ecx, edx, idtvec_info, idtvec_err, intr_info, inst_info; + uint32_t intr_type, reason; + uint64_t exitintinfo, qual, gpa; bool retu; CTASSERT((PINBASED_CTLS_ONE_SETTING & PINBASED_VIRTUAL_NMI) != 0); @@ -1749,49 +2084,112 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_exit *vmexit) vmm_stat_incr(vmx->vm, vcpu, VMEXIT_COUNT, 1); /* - * VM exits that could be triggered during event injection on the - * previous VM entry need to be handled specially by re-injecting - * the event. + * VM exits that can be triggered during event delivery need to + * be handled specially by re-injecting the event if the IDT + * vectoring information field's valid bit is set. * * See "Information for VM Exits During Event Delivery" in Intel SDM * for details. */ - switch (reason) { - case EXIT_REASON_EPT_FAULT: - case EXIT_REASON_EPT_MISCONFIG: - case EXIT_REASON_APIC_ACCESS: - case EXIT_REASON_TASK_SWITCH: - case EXIT_REASON_EXCEPTION: - idtvec_info = vmcs_idt_vectoring_info(); - if (idtvec_info & VMCS_IDT_VEC_VALID) { - idtvec_info &= ~(1 << 12); /* clear undefined bit */ - vmcs_write(VMCS_ENTRY_INTR_INFO, idtvec_info); - if (idtvec_info & VMCS_IDT_VEC_ERRCODE_VALID) { - idtvec_err = vmcs_idt_vectoring_err(); - vmcs_write(VMCS_ENTRY_EXCEPTION_ERROR, - idtvec_err); - } - /* - * If 'virtual NMIs' are being used and the VM-exit - * happened while injecting an NMI during the previous - * VM-entry, then clear "blocking by NMI" in the Guest - * Interruptibility-state. - */ - if ((idtvec_info & VMCS_INTR_T_MASK) == - VMCS_INTR_T_NMI) { - vmx_clear_nmi_blocking(vmx, vcpu); - } + idtvec_info = vmcs_idt_vectoring_info(); + if (idtvec_info & VMCS_IDT_VEC_VALID) { + idtvec_info &= ~(1 << 12); /* clear undefined bit */ + exitintinfo = idtvec_info; + if (idtvec_info & VMCS_IDT_VEC_ERRCODE_VALID) { + idtvec_err = vmcs_idt_vectoring_err(); + exitintinfo |= (uint64_t)idtvec_err << 32; + } + error = vm_exit_intinfo(vmx->vm, vcpu, exitintinfo); + KASSERT(error == 0, ("%s: vm_set_intinfo error %d", + __func__, error)); + + /* + * If 'virtual NMIs' are being used and the VM-exit + * happened while injecting an NMI during the previous + * VM-entry, then clear "blocking by NMI" in the + * Guest Interruptibility-State so the NMI can be + * reinjected on the subsequent VM-entry. + * + * However, if the NMI was being delivered through a task + * gate, then the new task must start execution with NMIs + * blocked so don't clear NMI blocking in this case. + */ + intr_type = idtvec_info & VMCS_INTR_T_MASK; + if (intr_type == VMCS_INTR_T_NMI) { + if (reason != EXIT_REASON_TASK_SWITCH) + vmx_clear_nmi_blocking(vmx, vcpu); + else + vmx_assert_nmi_blocking(vmx, vcpu); + } + + /* + * Update VM-entry instruction length if the event being + * delivered was a software interrupt or software exception. + */ + if (intr_type == VMCS_INTR_T_SWINTR || + intr_type == VMCS_INTR_T_PRIV_SWEXCEPTION || + intr_type == VMCS_INTR_T_SWEXCEPTION) { vmcs_write(VMCS_ENTRY_INST_LENGTH, vmexit->inst_length); } - default: - idtvec_info = 0; - break; } switch (reason) { + case EXIT_REASON_TASK_SWITCH: + ts = &vmexit->u.task_switch; + ts->tsssel = qual & 0xffff; + ts->reason = vmx_task_switch_reason(qual); + ts->ext = 0; + ts->errcode_valid = 0; + vmx_paging_info(&ts->paging); + /* + * If the task switch was due to a CALL, JMP, IRET, software + * interrupt (INT n) or software exception (INT3, INTO), + * then the saved %rip references the instruction that caused + * the task switch. The instruction length field in the VMCS + * is valid in this case. + * + * In all other cases (e.g., NMI, hardware exception) the + * saved %rip is one that would have been saved in the old TSS + * had the task switch completed normally so the instruction + * length field is not needed in this case and is explicitly + * set to 0. + */ + if (ts->reason == TSR_IDT_GATE) { + KASSERT(idtvec_info & VMCS_IDT_VEC_VALID, + ("invalid idtvec_info %#x for IDT task switch", + idtvec_info)); + intr_type = idtvec_info & VMCS_INTR_T_MASK; + if (intr_type != VMCS_INTR_T_SWINTR && + intr_type != VMCS_INTR_T_SWEXCEPTION && + intr_type != VMCS_INTR_T_PRIV_SWEXCEPTION) { + /* Task switch triggered by external event */ + ts->ext = 1; + vmexit->inst_length = 0; + if (idtvec_info & VMCS_IDT_VEC_ERRCODE_VALID) { + ts->errcode_valid = 1; + ts->errcode = vmcs_idt_vectoring_err(); + } + } + } + vmexit->exitcode = VM_EXITCODE_TASK_SWITCH; + VCPU_CTR4(vmx->vm, vcpu, "task switch reason %d, tss 0x%04x, " + "%s errcode 0x%016lx", ts->reason, ts->tsssel, + ts->ext ? "external" : "internal", + ((uint64_t)ts->errcode << 32) | ts->errcode_valid); + break; case EXIT_REASON_CR_ACCESS: vmm_stat_incr(vmx->vm, vcpu, VMEXIT_CR_ACCESS, 1); - handled = vmx_emulate_cr_access(vmx, vcpu, qual); + switch (qual & 0xf) { + case 0: + handled = vmx_emulate_cr0_access(vmx, vcpu, qual); + break; + case 4: + handled = vmx_emulate_cr4_access(vmx, vcpu, qual); + break; + case 8: + handled = vmx_emulate_cr8_access(vmx, vcpu, qual); + break; + } break; case EXIT_REASON_RDMSR: vmm_stat_incr(vmx->vm, vcpu, VMEXIT_RDMSR, 1); @@ -1889,15 +2287,22 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_exit *vmexit) vmm_stat_incr(vmx->vm, vcpu, VMEXIT_INOUT, 1); vmexit->exitcode = VM_EXITCODE_INOUT; vmexit->u.inout.bytes = (qual & 0x7) + 1; - vmexit->u.inout.in = (qual & 0x8) ? 1 : 0; + vmexit->u.inout.in = in = (qual & 0x8) ? 1 : 0; vmexit->u.inout.string = (qual & 0x10) ? 1 : 0; vmexit->u.inout.rep = (qual & 0x20) ? 1 : 0; vmexit->u.inout.port = (uint16_t)(qual >> 16); vmexit->u.inout.eax = (uint32_t)(vmxctx->guest_rax); - error = emulate_ioport(vmx->vm, vcpu, vmexit); - if (error == 0) { - handled = 1; - vmxctx->guest_rax = vmexit->u.inout.eax; + if (vmexit->u.inout.string) { + inst_info = vmcs_read(VMCS_EXIT_INSTRUCTION_INFO); + vmexit->exitcode = VM_EXITCODE_INOUT_STR; + vis = &vmexit->u.inout_str; + vmx_paging_info(&vis->paging); + vis->rflags = vmcs_read(VMCS_GUEST_RFLAGS); + vis->cr0 = vmcs_read(VMCS_GUEST_CR0); + vis->index = inout_str_index(vmx, vcpu, in); + vis->count = inout_str_count(vmx, vcpu, vis->inout.rep); + vis->addrsize = inout_str_addrsize(inst_info); + inout_str_seginfo(vmx, vcpu, inst_info, in, vis); } break; case EXIT_REASON_CPUID: @@ -1917,6 +2322,7 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_exit *vmexit) * the guest. * * See "Resuming Guest Software after Handling an Exception". + * See "Information for VM Exits Due to Vectored Events". */ if ((idtvec_info & VMCS_IDT_VEC_VALID) == 0 && (intr_info & 0xff) != IDT_DF && @@ -1943,12 +2349,7 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_exit *vmexit) vmexit->u.paging.fault_type = ept_fault_type(qual); vmm_stat_incr(vmx->vm, vcpu, VMEXIT_NESTED_FAULT, 1); } else if (ept_emulation_fault(qual)) { - vmexit->exitcode = VM_EXITCODE_INST_EMUL; - vmexit->u.inst_emul.gpa = gpa; - vmexit->u.inst_emul.gla = vmcs_gla(); - vmexit->u.inst_emul.cr3 = vmcs_guest_cr3(); - vmexit->u.inst_emul.cpu_mode = vmx_cpu_mode(); - vmexit->u.inst_emul.paging_mode = vmx_paging_mode(); + vmexit_inst_emul(vmexit, gpa, vmcs_gla()); vmm_stat_incr(vmx->vm, vcpu, VMEXIT_INST_EMUL, 1); } /* @@ -2022,32 +2423,7 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_exit *vmexit) return (handled); } -static __inline int -vmx_exit_astpending(struct vmx *vmx, int vcpu, struct vm_exit *vmexit) -{ - - vmexit->rip = vmcs_guest_rip(); - vmexit->inst_length = 0; - vmexit->exitcode = VM_EXITCODE_BOGUS; - vmx_astpending_trace(vmx, vcpu, vmexit->rip); - vmm_stat_incr(vmx->vm, vcpu, VMEXIT_ASTPENDING, 1); - - return (HANDLED); -} - -static __inline int -vmx_exit_rendezvous(struct vmx *vmx, int vcpu, struct vm_exit *vmexit) -{ - - vmexit->rip = vmcs_guest_rip(); - vmexit->inst_length = 0; - vmexit->exitcode = VM_EXITCODE_RENDEZVOUS; - vmm_stat_incr(vmx->vm, vcpu, VMEXIT_RENDEZVOUS, 1); - - return (UNHANDLED); -} - -static __inline int +static __inline void vmx_exit_inst_error(struct vmxctx *vmxctx, int rc, struct vm_exit *vmexit) { @@ -2071,8 +2447,6 @@ vmx_exit_inst_error(struct vmxctx *vmxctx, int rc, struct vm_exit *vmexit) default: panic("vm_exit_inst_error: vmx_enter_guest returned %d", rc); } - - return (UNHANDLED); } /* @@ -2145,6 +2519,8 @@ vmx_run(void *arg, int vcpu, register_t startrip, pmap_t pmap, vmcs_write(VMCS_GUEST_RIP, startrip); vmx_set_pcpu_defaults(vmx, vcpu, pmap); do { + handled = UNHANDLED; + /* * Interrupts are disabled from this point on until the * guest starts executing. This is done for the following @@ -2164,26 +2540,33 @@ vmx_run(void *arg, int vcpu, register_t startrip, pmap_t pmap, * pmap_invalidate_ept(). */ disable_intr(); + vmx_inject_interrupts(vmx, vcpu, vlapic); + + /* + * Check for vcpu suspension after injecting events because + * vmx_inject_interrupts() can suspend the vcpu due to a + * triple fault. + */ if (vcpu_suspended(suspend_cookie)) { enable_intr(); vm_exit_suspended(vmx->vm, vcpu, vmcs_guest_rip()); - handled = UNHANDLED; break; } if (vcpu_rendezvous_pending(rendezvous_cookie)) { enable_intr(); - handled = vmx_exit_rendezvous(vmx, vcpu, vmexit); + vm_exit_rendezvous(vmx->vm, vcpu, vmcs_guest_rip()); break; } - if (curthread->td_flags & (TDF_ASTPENDING | TDF_NEEDRESCHED)) { + if (vcpu_should_yield(vm, vcpu)) { enable_intr(); - handled = vmx_exit_astpending(vmx, vcpu, vmexit); + vm_exit_astpending(vmx->vm, vcpu, vmcs_guest_rip()); + vmx_astpending_trace(vmx, vcpu, vmexit->rip); + handled = HANDLED; break; } - vmx_inject_interrupts(vmx, vcpu, vlapic); vmx_run_trace(vmx, vcpu); rc = vmx_enter_guest(vmxctx, vmx, launched); @@ -2199,7 +2582,7 @@ vmx_run(void *arg, int vcpu, register_t startrip, pmap_t pmap, handled = vmx_exit_process(vmx, vcpu, vmexit); } else { enable_intr(); - handled = vmx_exit_inst_error(vmxctx, rc, vmexit); + vmx_exit_inst_error(vmxctx, rc, vmexit); } launched = 1; vmx_exit_trace(vmx, vcpu, rip, exit_reason, handled); @@ -2277,6 +2660,8 @@ vmxctx_regptr(struct vmxctx *vmxctx, int reg) return (&vmxctx->guest_r14); case VM_REG_GUEST_R15: return (&vmxctx->guest_r15); + case VM_REG_GUEST_CR2: + return (&vmxctx->guest_cr2); default: break; } @@ -2349,6 +2734,7 @@ vmx_setreg(void *arg, int vcpu, int reg, uint64_t val) { int error, hostcpu, running, shadow; uint64_t ctls; + pmap_t pmap; struct vmx *vmx = arg; running = vcpu_is_running(vmx->vm, vcpu, &hostcpu); @@ -2386,6 +2772,18 @@ vmx_setreg(void *arg, int vcpu, int reg, uint64_t val) error = vmcs_setreg(&vmx->vmcs[vcpu], running, VMCS_IDENT(shadow), val); } + + if (reg == VM_REG_GUEST_CR3) { + /* + * Invalidate the guest vcpu's TLB mappings to emulate + * the behavior of updating %cr3. + * + * XXX the processor retains global mappings when %cr3 + * is updated but vmx_invvpid() does not. + */ + pmap = vmx->ctx[vcpu].pmap; + vmx_invvpid(vmx, vcpu, pmap, running); + } } return (error); @@ -2394,17 +2792,27 @@ vmx_setreg(void *arg, int vcpu, int reg, uint64_t val) static int vmx_getdesc(void *arg, int vcpu, int reg, struct seg_desc *desc) { + int hostcpu, running; struct vmx *vmx = arg; - return (vmcs_getdesc(&vmx->vmcs[vcpu], reg, desc)); + running = vcpu_is_running(vmx->vm, vcpu, &hostcpu); + if (running && hostcpu != curcpu) + panic("vmx_getdesc: %s%d is running", vm_name(vmx->vm), vcpu); + + return (vmcs_getdesc(&vmx->vmcs[vcpu], running, reg, desc)); } static int vmx_setdesc(void *arg, int vcpu, int reg, struct seg_desc *desc) { + int hostcpu, running; struct vmx *vmx = arg; - return (vmcs_setdesc(&vmx->vmcs[vcpu], reg, desc)); + running = vcpu_is_running(vmx->vm, vcpu, &hostcpu); + if (running && hostcpu != curcpu) + panic("vmx_setdesc: %s%d is running", vm_name(vmx->vm), vcpu); + + return (vmcs_setdesc(&vmx->vmcs[vcpu], running, reg, desc)); } static int diff --git a/sys/amd64/vmm/intel/vmx.h b/sys/amd64/vmm/intel/vmx.h index c21c979cc22..208fceed9b2 100644 --- a/sys/amd64/vmm/intel/vmx.h +++ b/sys/amd64/vmm/intel/vmx.h @@ -67,7 +67,7 @@ struct vmxctx { int inst_fail_status; /* - * The pmap needs to be deactivated in vmx_exit_guest() + * The pmap needs to be deactivated in vmx_enter_guest() * so keep a copy of the 'pmap' in each vmxctx. */ struct pmap *pmap; @@ -121,10 +121,11 @@ CTASSERT((offsetof(struct vmx, pir_desc[0]) & 63) == 0); #define VMX_VMLAUNCH_ERROR 2 #define VMX_INVEPT_ERROR 3 int vmx_enter_guest(struct vmxctx *ctx, struct vmx *vmx, int launched); -void vmx_exit_guest(void); void vmx_call_isr(uintptr_t entry); u_long vmx_fix_cr0(u_long cr0); u_long vmx_fix_cr4(u_long cr4); +extern char vmx_exit_guest[]; + #endif diff --git a/sys/amd64/vmm/intel/vmx_support.S b/sys/amd64/vmm/intel/vmx_support.S index 1d78021a61e..840b7e0619c 100644 --- a/sys/amd64/vmm/intel/vmx_support.S +++ b/sys/amd64/vmm/intel/vmx_support.S @@ -37,6 +37,10 @@ #define LK #endif +/* Be friendly to DTrace FBT's prologue/epilogue pattern matching */ +#define VENTER push %rbp ; mov %rsp,%rbp +#define VLEAVE pop %rbp + /* * Assumes that %rdi holds a pointer to the 'vmxctx'. * @@ -98,6 +102,7 @@ * Interrupts must be disabled on entry. */ ENTRY(vmx_enter_guest) + VENTER /* * Save host state before doing anything else. */ @@ -183,14 +188,17 @@ inst_error: LK btrl %r10d, PM_ACTIVE(%r11) VMX_HOST_RESTORE + VLEAVE ret -END(vmx_enter_guest) /* - * void vmx_exit_guest(void) - * %rsp points to the struct vmxctx + * Non-error VM-exit from the guest. Make this a label so it can + * be used by C code when setting up the VMCS. + * The VMCS-restored %rsp points to the struct vmxctx */ -ENTRY(vmx_exit_guest) + ALIGN_TEXT + .globl vmx_exit_guest +vmx_exit_guest: /* * Save guest state that is not automatically saved in the vmcs. */ @@ -229,8 +237,9 @@ ENTRY(vmx_exit_guest) * value of VMX_GUEST_VMEXIT. */ movl $VMX_GUEST_VMEXIT, %eax + VLEAVE ret -END(vmx_exit_guest) +END(vmx_enter_guest) /* * %rdi = interrupt handler entry point @@ -239,6 +248,7 @@ END(vmx_exit_guest) * instruction in Intel SDM, Vol 2. */ ENTRY(vmx_call_isr) + VENTER mov %rsp, %r11 /* save %rsp */ and $~0xf, %rsp /* align on 16-byte boundary */ pushq $KERNEL_SS /* %ss */ @@ -247,5 +257,6 @@ ENTRY(vmx_call_isr) pushq $KERNEL_CS /* %cs */ cli /* disable interrupts */ callq *%rdi /* push %rip and call isr */ + VLEAVE ret END(vmx_call_isr) diff --git a/sys/amd64/vmm/io/vatpic.c b/sys/amd64/vmm/io/vatpic.c index 66905e70bce..ee6fc84f90c 100644 --- a/sys/amd64/vmm/io/vatpic.c +++ b/sys/amd64/vmm/io/vatpic.c @@ -446,6 +446,43 @@ vatpic_pulse_irq(struct vm *vm, int irq) return (vatpic_set_irqstate(vm, irq, IRQSTATE_PULSE)); } +int +vatpic_set_irq_trigger(struct vm *vm, int irq, enum vm_intr_trigger trigger) +{ + struct vatpic *vatpic; + + if (irq < 0 || irq > 15) + return (EINVAL); + + /* + * See comment in vatpic_elc_handler. These IRQs must be + * edge triggered. + */ + if (trigger == LEVEL_TRIGGER) { + switch (irq) { + case 0: + case 1: + case 2: + case 8: + case 13: + return (EINVAL); + } + } + + vatpic = vm_atpic(vm); + + VATPIC_LOCK(vatpic); + + if (trigger == LEVEL_TRIGGER) + vatpic->elc[irq >> 3] |= 1 << (irq & 0x7); + else + vatpic->elc[irq >> 3] &= ~(1 << (irq & 0x7)); + + VATPIC_UNLOCK(vatpic); + + return (0); +} + void vatpic_pending_intr(struct vm *vm, int *vecptr) { @@ -554,6 +591,7 @@ vatpic_write(struct vatpic *vatpic, struct atpic *atpic, bool in, int port, int error; uint8_t val; + error = 0; val = *eax; VATPIC_LOCK(vatpic); diff --git a/sys/amd64/vmm/io/vatpic.h b/sys/amd64/vmm/io/vatpic.h index d4d6b26cfa5..84d5651dd4c 100644 --- a/sys/amd64/vmm/io/vatpic.h +++ b/sys/amd64/vmm/io/vatpic.h @@ -49,6 +49,7 @@ int vatpic_elc_handler(void *vm, int vcpuid, bool in, int port, int bytes, int vatpic_assert_irq(struct vm *vm, int irq); int vatpic_deassert_irq(struct vm *vm, int irq); int vatpic_pulse_irq(struct vm *vm, int irq); +int vatpic_set_irq_trigger(struct vm *vm, int irq, enum vm_intr_trigger trigger); void vatpic_pending_intr(struct vm *vm, int *vecptr); void vatpic_intr_accepted(struct vm *vm, int vector); diff --git a/sys/amd64/vmm/io/vlapic.c b/sys/amd64/vmm/io/vlapic.c index d93641c19b4..3c9346334f5 100644 --- a/sys/amd64/vmm/io/vlapic.c +++ b/sys/amd64/vmm/io/vlapic.c @@ -906,6 +906,46 @@ vlapic_calcdest(struct vm *vm, cpuset_t *dmask, uint32_t dest, bool phys, static VMM_STAT_ARRAY(IPIS_SENT, VM_MAXCPU, "ipis sent to vcpu"); +static void +vlapic_set_tpr(struct vlapic *vlapic, uint8_t val) +{ + struct LAPIC *lapic = vlapic->apic_page; + + lapic->tpr = val; + vlapic_update_ppr(vlapic); +} + +static uint8_t +vlapic_get_tpr(struct vlapic *vlapic) +{ + struct LAPIC *lapic = vlapic->apic_page; + + return (lapic->tpr); +} + +void +vlapic_set_cr8(struct vlapic *vlapic, uint64_t val) +{ + uint8_t tpr; + + if (val & ~0xf) { + vm_inject_gp(vlapic->vm, vlapic->vcpuid); + return; + } + + tpr = val << 4; + vlapic_set_tpr(vlapic, tpr); +} + +uint64_t +vlapic_get_cr8(struct vlapic *vlapic) +{ + uint8_t tpr; + + tpr = vlapic_get_tpr(vlapic); + return (tpr >> 4); +} + int vlapic_icrlo_write_handler(struct vlapic *vlapic, bool *retu) { @@ -1004,11 +1044,7 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic, bool *retu) if (vlapic2->boot_state != BS_SIPI) return (0); - /* - * XXX this assumes that the startup IPI always succeeds - */ vlapic2->boot_state = BS_RUNNING; - vm_activate_cpu(vlapic2->vm, dest); *retu = true; vmexit = vm_exitinfo(vlapic->vm, vlapic->vcpuid); @@ -1188,7 +1224,7 @@ vlapic_read(struct vlapic *vlapic, int mmio_access, uint64_t offset, *data = lapic->version; break; case APIC_OFFSET_TPR: - *data = lapic->tpr; + *data = vlapic_get_tpr(vlapic); break; case APIC_OFFSET_APR: *data = lapic->apr; @@ -1309,8 +1345,7 @@ vlapic_write(struct vlapic *vlapic, int mmio_access, uint64_t offset, vlapic_id_write_handler(vlapic); break; case APIC_OFFSET_TPR: - lapic->tpr = data & 0xff; - vlapic_update_ppr(vlapic); + vlapic_set_tpr(vlapic, data & 0xff); break; case APIC_OFFSET_EOI: vlapic_process_eoi(vlapic); diff --git a/sys/amd64/vmm/io/vlapic.h b/sys/amd64/vmm/io/vlapic.h index 3195cc6f1fd..0e68b2fe824 100644 --- a/sys/amd64/vmm/io/vlapic.h +++ b/sys/amd64/vmm/io/vlapic.h @@ -92,6 +92,9 @@ void vlapic_reset_tmr(struct vlapic *vlapic); void vlapic_set_tmr_level(struct vlapic *vlapic, uint32_t dest, bool phys, int delmode, int vector); +void vlapic_set_cr8(struct vlapic *vlapic, uint64_t val); +uint64_t vlapic_get_cr8(struct vlapic *vlapic); + /* APIC write handlers */ void vlapic_id_write_handler(struct vlapic *vlapic); void vlapic_ldr_write_handler(struct vlapic *vlapic); diff --git a/sys/amd64/vmm/vmm.c b/sys/amd64/vmm/vmm.c index 9aed5f5bb0b..397035a71de 100644 --- a/sys/amd64/vmm/vmm.c +++ b/sys/amd64/vmm/vmm.c @@ -62,7 +62,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include "vmm_ioport.h" #include "vmm_ktr.h" #include "vmm_host.h" #include "vmm_mem.h" @@ -82,25 +84,32 @@ __FBSDID("$FreeBSD$"); struct vlapic; +/* + * Initialization: + * (a) allocated when vcpu is created + * (i) initialized when vcpu is created and when it is reinitialized + * (o) initialized the first time the vcpu is created + * (x) initialized before use + */ struct vcpu { - int flags; - enum vcpu_state state; - struct mtx mtx; - int hostcpu; /* host cpuid this vcpu last ran on */ - uint64_t guest_msrs[VMM_MSR_NUM]; - struct vlapic *vlapic; - int vcpuid; - struct savefpu *guestfpu; /* guest fpu state */ - uint64_t guest_xcr0; - void *stats; - struct vm_exit exitinfo; - enum x2apic_state x2apic_state; - int nmi_pending; - int extint_pending; - struct vm_exception exception; - int exception_pending; + struct mtx mtx; /* (o) protects 'state' and 'hostcpu' */ + enum vcpu_state state; /* (o) vcpu state */ + int hostcpu; /* (o) vcpu's host cpu */ + struct vlapic *vlapic; /* (i) APIC device model */ + enum x2apic_state x2apic_state; /* (i) APIC mode */ + uint64_t exitintinfo; /* (i) events pending at VM exit */ + int nmi_pending; /* (i) NMI pending */ + int extint_pending; /* (i) INTR pending */ + struct vm_exception exception; /* (x) exception collateral */ + int exception_pending; /* (i) exception pending */ + struct savefpu *guestfpu; /* (a,i) guest fpu state */ + uint64_t guest_xcr0; /* (i) guest %xcr0 register */ + void *stats; /* (a,i) statistics */ + uint64_t guest_msrs[VMM_MSR_NUM]; /* (i) emulated MSRs */ + struct vm_exit exitinfo; /* (x) exit reason and collateral */ }; +#define vcpu_lock_initialized(v) mtx_initialized(&((v)->mtx)) #define vcpu_lock_init(v) mtx_init(&((v)->mtx), "vcpu lock", 0, MTX_SPIN) #define vcpu_lock(v) mtx_lock_spin(&((v)->mtx)) #define vcpu_unlock(v) mtx_unlock_spin(&((v)->mtx)) @@ -114,36 +123,33 @@ struct mem_seg { }; #define VM_MAX_MEMORY_SEGMENTS 2 +/* + * Initialization: + * (o) initialized the first time the VM is created + * (i) initialized when VM is created and when it is reinitialized + * (x) initialized before use + */ struct vm { - void *cookie; /* processor-specific data */ - void *iommu; /* iommu-specific data */ - struct vhpet *vhpet; /* virtual HPET */ - struct vioapic *vioapic; /* virtual ioapic */ - struct vatpic *vatpic; /* virtual atpic */ - struct vatpit *vatpit; /* virtual atpit */ - struct vmspace *vmspace; /* guest's address space */ - struct vcpu vcpu[VM_MAXCPU]; - int num_mem_segs; - struct mem_seg mem_segs[VM_MAX_MEMORY_SEGMENTS]; - char name[VM_MAX_NAMELEN]; - - /* - * Set of active vcpus. - * An active vcpu is one that has been started implicitly (BSP) or - * explicitly (AP) by sending it a startup ipi. - */ - volatile cpuset_t active_cpus; - - struct mtx rendezvous_mtx; - cpuset_t rendezvous_req_cpus; - cpuset_t rendezvous_done_cpus; - void *rendezvous_arg; + void *cookie; /* (i) cpu-specific data */ + void *iommu; /* (x) iommu-specific data */ + struct vhpet *vhpet; /* (i) virtual HPET */ + struct vioapic *vioapic; /* (i) virtual ioapic */ + struct vatpic *vatpic; /* (i) virtual atpic */ + struct vatpit *vatpit; /* (i) virtual atpit */ + volatile cpuset_t active_cpus; /* (i) active vcpus */ + int suspend; /* (i) stop VM execution */ + volatile cpuset_t suspended_cpus; /* (i) suspended vcpus */ + volatile cpuset_t halted_cpus; /* (x) cpus in a hard halt */ + cpuset_t rendezvous_req_cpus; /* (x) rendezvous requested */ + cpuset_t rendezvous_done_cpus; /* (x) rendezvous finished */ + void *rendezvous_arg; /* (x) rendezvous func/arg */ vm_rendezvous_func_t rendezvous_func; - - int suspend; - volatile cpuset_t suspended_cpus; - - volatile cpuset_t halted_cpus; + struct mtx rendezvous_mtx; /* (o) rendezvous lock */ + int num_mem_segs; /* (o) guest memory segments */ + struct mem_seg mem_segs[VM_MAX_MEMORY_SEGMENTS]; + struct vmspace *vmspace; /* (o) guest's address space */ + char name[VM_MAX_NAMELEN]; /* (o) virtual machine name */ + struct vcpu vcpu[VM_MAXCPU]; /* (i) guest vcpus */ }; static int vmm_initialized; @@ -194,7 +200,6 @@ SYSCTL_NODE(_hw, OID_AUTO, vmm, CTLFLAG_RW, NULL, NULL); * interrupts disabled. */ static int halt_detection_enabled = 1; -TUNABLE_INT("hw.vmm.halt_detection", &halt_detection_enabled); SYSCTL_INT(_hw_vmm, OID_AUTO, halt_detection, CTLFLAG_RDTUN, &halt_detection_enabled, 0, "Halt VM if all vcpus execute HLT with interrupts disabled"); @@ -204,31 +209,47 @@ SYSCTL_INT(_hw_vmm, OID_AUTO, ipinum, CTLFLAG_RD, &vmm_ipinum, 0, "IPI vector used for vcpu notifications"); static void -vcpu_cleanup(struct vm *vm, int i) +vcpu_cleanup(struct vm *vm, int i, bool destroy) { struct vcpu *vcpu = &vm->vcpu[i]; VLAPIC_CLEANUP(vm->cookie, vcpu->vlapic); - vmm_stat_free(vcpu->stats); - fpu_save_area_free(vcpu->guestfpu); + if (destroy) { + vmm_stat_free(vcpu->stats); + fpu_save_area_free(vcpu->guestfpu); + } } static void -vcpu_init(struct vm *vm, uint32_t vcpu_id) +vcpu_init(struct vm *vm, int vcpu_id, bool create) { struct vcpu *vcpu; - + + KASSERT(vcpu_id >= 0 && vcpu_id < VM_MAXCPU, + ("vcpu_init: invalid vcpu %d", vcpu_id)); + vcpu = &vm->vcpu[vcpu_id]; - vcpu_lock_init(vcpu); - vcpu->hostcpu = NOCPU; - vcpu->vcpuid = vcpu_id; + if (create) { + KASSERT(!vcpu_lock_initialized(vcpu), ("vcpu %d already " + "initialized", vcpu_id)); + vcpu_lock_init(vcpu); + vcpu->state = VCPU_IDLE; + vcpu->hostcpu = NOCPU; + vcpu->guestfpu = fpu_save_area_alloc(); + vcpu->stats = vmm_stat_alloc(); + } + vcpu->vlapic = VLAPIC_INIT(vm->cookie, vcpu_id); vm_set_x2apic_state(vm, vcpu_id, X2APIC_DISABLED); + vcpu->exitintinfo = 0; + vcpu->nmi_pending = 0; + vcpu->extint_pending = 0; + vcpu->exception_pending = 0; vcpu->guest_xcr0 = XFEATURE_ENABLED_X87; - vcpu->guestfpu = fpu_save_area_alloc(); fpu_save_area_reset(vcpu->guestfpu); - vcpu->stats = vmm_stat_alloc(); + vmm_stat_init(vcpu->stats); + guest_msrs_init(vm, vcpu_id); } struct vm_exit * @@ -333,15 +354,33 @@ static moduledata_t vmm_kmod = { DECLARE_MODULE(vmm, vmm_kmod, SI_SUB_SMP + 1, SI_ORDER_ANY); MODULE_VERSION(vmm, 1); +static void +vm_init(struct vm *vm, bool create) +{ + int i; + + vm->cookie = VMINIT(vm, vmspace_pmap(vm->vmspace)); + vm->iommu = NULL; + vm->vioapic = vioapic_init(vm); + vm->vhpet = vhpet_init(vm); + vm->vatpic = vatpic_init(vm); + vm->vatpit = vatpit_init(vm); + + CPU_ZERO(&vm->active_cpus); + + vm->suspend = 0; + CPU_ZERO(&vm->suspended_cpus); + + for (i = 0; i < VM_MAXCPU; i++) + vcpu_init(vm, i, create); +} + int vm_create(const char *name, struct vm **retvm) { - int i; struct vm *vm; struct vmspace *vmspace; - const int BSP = 0; - /* * If vmm.ko could not be successfully initialized then don't attempt * to create the virtual machine. @@ -358,20 +397,11 @@ vm_create(const char *name, struct vm **retvm) vm = malloc(sizeof(struct vm), M_VM, M_WAITOK | M_ZERO); strcpy(vm->name, name); + vm->num_mem_segs = 0; vm->vmspace = vmspace; mtx_init(&vm->rendezvous_mtx, "vm rendezvous lock", 0, MTX_DEF); - vm->cookie = VMINIT(vm, vmspace_pmap(vmspace)); - vm->vioapic = vioapic_init(vm); - vm->vhpet = vhpet_init(vm); - vm->vatpic = vatpic_init(vm); - vm->vatpit = vatpit_init(vm); - for (i = 0; i < VM_MAXCPU; i++) { - vcpu_init(vm, i); - guest_msrs_init(vm, i); - } - - vm_activate_cpu(vm, BSP); + vm_init(vm, true); *retvm = vm; return (0); @@ -387,8 +417,8 @@ vm_free_mem_seg(struct vm *vm, struct mem_seg *seg) bzero(seg, sizeof(*seg)); } -void -vm_destroy(struct vm *vm) +static void +vm_cleanup(struct vm *vm, bool destroy) { int i; @@ -402,21 +432,48 @@ vm_destroy(struct vm *vm) vatpic_cleanup(vm->vatpic); vioapic_cleanup(vm->vioapic); - for (i = 0; i < vm->num_mem_segs; i++) - vm_free_mem_seg(vm, &vm->mem_segs[i]); - - vm->num_mem_segs = 0; - for (i = 0; i < VM_MAXCPU; i++) - vcpu_cleanup(vm, i); - - VMSPACE_FREE(vm->vmspace); + vcpu_cleanup(vm, i, destroy); VMCLEANUP(vm->cookie); + if (destroy) { + for (i = 0; i < vm->num_mem_segs; i++) + vm_free_mem_seg(vm, &vm->mem_segs[i]); + + vm->num_mem_segs = 0; + + VMSPACE_FREE(vm->vmspace); + vm->vmspace = NULL; + } +} + +void +vm_destroy(struct vm *vm) +{ + vm_cleanup(vm, true); free(vm, M_VM); } +int +vm_reinit(struct vm *vm) +{ + int error; + + /* + * A virtual machine can be reset only if all vcpus are suspended. + */ + if (CPU_CMP(&vm->suspended_cpus, &vm->active_cpus) == 0) { + vm_cleanup(vm, false); + vm_init(vm, false); + error = 0; + } else { + error = EBUSY; + } + + return (error); +} + const char * vm_name(struct vm *vm) { @@ -1048,6 +1105,10 @@ vm_handle_hlt(struct vm *vm, int vcpuid, bool intr_disabled, bool *retu) } } + /* Don't go to sleep if the vcpu thread needs to yield */ + if (vcpu_should_yield(vm, vcpuid)) + break; + /* * Some Linux guests implement "halt" by having all vcpus * execute HLT with interrupts disabled. 'halted_cpus' keeps @@ -1071,7 +1132,11 @@ vm_handle_hlt(struct vm *vm, int vcpuid, bool intr_disabled, bool *retu) t = ticks; vcpu_require_state_locked(vcpu, VCPU_SLEEPING); - msleep_spin(vcpu, &vcpu->mtx, wmesg, 0); + /* + * XXX msleep_spin() cannot be interrupted by signals so + * wake up periodically to check pending signals. + */ + msleep_spin(vcpu, &vcpu->mtx, wmesg, hz); vcpu_require_state_locked(vcpu, VCPU_FROZEN); vmm_stat_incr(vm, vcpuid, VCPU_IDLE_TICKS, ticks - t); } @@ -1131,34 +1196,36 @@ vm_handle_inst_emul(struct vm *vm, int vcpuid, bool *retu) struct vie *vie; struct vcpu *vcpu; struct vm_exit *vme; - int error, inst_length; - uint64_t rip, gla, gpa, cr3; - enum vie_cpu_mode cpu_mode; - enum vie_paging_mode paging_mode; + uint64_t gla, gpa; + struct vm_guest_paging *paging; mem_region_read_t mread; mem_region_write_t mwrite; + enum vm_cpu_mode cpu_mode; + int cs_d, error; vcpu = &vm->vcpu[vcpuid]; vme = &vcpu->exitinfo; - rip = vme->rip; - inst_length = vme->inst_length; - gla = vme->u.inst_emul.gla; gpa = vme->u.inst_emul.gpa; - cr3 = vme->u.inst_emul.cr3; - cpu_mode = vme->u.inst_emul.cpu_mode; - paging_mode = vme->u.inst_emul.paging_mode; + cs_d = vme->u.inst_emul.cs_d; vie = &vme->u.inst_emul.vie; + paging = &vme->u.inst_emul.paging; + cpu_mode = paging->cpu_mode; vie_init(vie); /* Fetch, decode and emulate the faulting instruction */ - if (vmm_fetch_instruction(vm, vcpuid, rip, inst_length, cr3, - paging_mode, vie) != 0) + error = vmm_fetch_instruction(vm, vcpuid, paging, vme->rip, + vme->inst_length, vie); + if (error == 1) + return (0); /* Resume guest to handle page fault */ + else if (error == -1) return (EFAULT); + else if (error != 0) + panic("%s: vmm_fetch_instruction error %d", __func__, error); - if (vmm_decode_instruction(vm, vcpuid, gla, cpu_mode, vie) != 0) + if (vmm_decode_instruction(vm, vcpuid, gla, cpu_mode, cs_d, vie) != 0) return (EFAULT); /* return to userland unless this is an in-kernel emulated device */ @@ -1176,8 +1243,8 @@ vm_handle_inst_emul(struct vm *vm, int vcpuid, bool *retu) return (0); } - error = vmm_emulate_instruction(vm, vcpuid, gpa, vie, mread, mwrite, - retu); + error = vmm_emulate_instruction(vm, vcpuid, gpa, vie, paging, + mread, mwrite, retu); return (error); } @@ -1276,6 +1343,32 @@ vm_exit_suspended(struct vm *vm, int vcpuid, uint64_t rip) vmexit->u.suspended.how = vm->suspend; } +void +vm_exit_rendezvous(struct vm *vm, int vcpuid, uint64_t rip) +{ + struct vm_exit *vmexit; + + KASSERT(vm->rendezvous_func != NULL, ("rendezvous not in progress")); + + vmexit = vm_exitinfo(vm, vcpuid); + vmexit->rip = rip; + vmexit->inst_length = 0; + vmexit->exitcode = VM_EXITCODE_RENDEZVOUS; + vmm_stat_incr(vm, vcpuid, VMEXIT_RENDEZVOUS, 1); +} + +void +vm_exit_astpending(struct vm *vm, int vcpuid, uint64_t rip) +{ + struct vm_exit *vmexit; + + vmexit = vm_exitinfo(vm, vcpuid); + vmexit->rip = rip; + vmexit->inst_length = 0; + vmexit->exitcode = VM_EXITCODE_BOGUS; + vmm_stat_incr(vm, vcpuid, VMEXIT_ASTPENDING, 1); +} + int vm_run(struct vm *vm, struct vm_run *vmrun) { @@ -1293,6 +1386,12 @@ vm_run(struct vm *vm, struct vm_run *vmrun) if (vcpuid < 0 || vcpuid >= VM_MAXCPU) return (EINVAL); + if (!CPU_ISSET(vcpuid, &vm->active_cpus)) + return (EINVAL); + + if (CPU_ISSET(vcpuid, &vm->suspended_cpus)) + return (EINVAL); + rptr = &vm->rendezvous_func; sptr = &vm->suspend; pmap = vmspace_pmap(vm->vmspace); @@ -1348,6 +1447,10 @@ vm_run(struct vm *vm, struct vm_run *vmrun) case VM_EXITCODE_INST_EMUL: error = vm_handle_inst_emul(vm, vcpuid, &retu); break; + case VM_EXITCODE_INOUT: + case VM_EXITCODE_INOUT_STR: + error = vm_handle_inout(vm, vcpuid, vme, &retu); + break; default: retu = true; /* handled in userland */ break; @@ -1364,6 +1467,202 @@ vm_run(struct vm *vm, struct vm_run *vmrun) return (error); } +int +vm_exit_intinfo(struct vm *vm, int vcpuid, uint64_t info) +{ + struct vcpu *vcpu; + int type, vector; + + if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + return (EINVAL); + + vcpu = &vm->vcpu[vcpuid]; + + if (info & VM_INTINFO_VALID) { + type = info & VM_INTINFO_TYPE; + vector = info & 0xff; + if (type == VM_INTINFO_NMI && vector != IDT_NMI) + return (EINVAL); + if (type == VM_INTINFO_HWEXCEPTION && vector >= 32) + return (EINVAL); + if (info & VM_INTINFO_RSVD) + return (EINVAL); + } else { + info = 0; + } + VCPU_CTR2(vm, vcpuid, "%s: info1(%#lx)", __func__, info); + vcpu->exitintinfo = info; + return (0); +} + +enum exc_class { + EXC_BENIGN, + EXC_CONTRIBUTORY, + EXC_PAGEFAULT +}; + +#define IDT_VE 20 /* Virtualization Exception (Intel specific) */ + +static enum exc_class +exception_class(uint64_t info) +{ + int type, vector; + + KASSERT(info & VM_INTINFO_VALID, ("intinfo must be valid: %#lx", info)); + type = info & VM_INTINFO_TYPE; + vector = info & 0xff; + + /* Table 6-4, "Interrupt and Exception Classes", Intel SDM, Vol 3 */ + switch (type) { + case VM_INTINFO_HWINTR: + case VM_INTINFO_SWINTR: + case VM_INTINFO_NMI: + return (EXC_BENIGN); + default: + /* + * Hardware exception. + * + * SVM and VT-x use identical type values to represent NMI, + * hardware interrupt and software interrupt. + * + * SVM uses type '3' for all exceptions. VT-x uses type '3' + * for exceptions except #BP and #OF. #BP and #OF use a type + * value of '5' or '6'. Therefore we don't check for explicit + * values of 'type' to classify 'intinfo' into a hardware + * exception. + */ + break; + } + + switch (vector) { + case IDT_PF: + case IDT_VE: + return (EXC_PAGEFAULT); + case IDT_DE: + case IDT_TS: + case IDT_NP: + case IDT_SS: + case IDT_GP: + return (EXC_CONTRIBUTORY); + default: + return (EXC_BENIGN); + } +} + +static int +nested_fault(struct vm *vm, int vcpuid, uint64_t info1, uint64_t info2, + uint64_t *retinfo) +{ + enum exc_class exc1, exc2; + int type1, vector1; + + KASSERT(info1 & VM_INTINFO_VALID, ("info1 %#lx is not valid", info1)); + KASSERT(info2 & VM_INTINFO_VALID, ("info2 %#lx is not valid", info2)); + + /* + * If an exception occurs while attempting to call the double-fault + * handler the processor enters shutdown mode (aka triple fault). + */ + type1 = info1 & VM_INTINFO_TYPE; + vector1 = info1 & 0xff; + if (type1 == VM_INTINFO_HWEXCEPTION && vector1 == IDT_DF) { + VCPU_CTR2(vm, vcpuid, "triple fault: info1(%#lx), info2(%#lx)", + info1, info2); + vm_suspend(vm, VM_SUSPEND_TRIPLEFAULT); + *retinfo = 0; + return (0); + } + + /* + * Table 6-5 "Conditions for Generating a Double Fault", Intel SDM, Vol3 + */ + exc1 = exception_class(info1); + exc2 = exception_class(info2); + if ((exc1 == EXC_CONTRIBUTORY && exc2 == EXC_CONTRIBUTORY) || + (exc1 == EXC_PAGEFAULT && exc2 != EXC_BENIGN)) { + /* Convert nested fault into a double fault. */ + *retinfo = IDT_DF; + *retinfo |= VM_INTINFO_VALID | VM_INTINFO_HWEXCEPTION; + *retinfo |= VM_INTINFO_DEL_ERRCODE; + } else { + /* Handle exceptions serially */ + *retinfo = info2; + } + return (1); +} + +static uint64_t +vcpu_exception_intinfo(struct vcpu *vcpu) +{ + uint64_t info = 0; + + if (vcpu->exception_pending) { + info = vcpu->exception.vector & 0xff; + info |= VM_INTINFO_VALID | VM_INTINFO_HWEXCEPTION; + if (vcpu->exception.error_code_valid) { + info |= VM_INTINFO_DEL_ERRCODE; + info |= (uint64_t)vcpu->exception.error_code << 32; + } + } + return (info); +} + +int +vm_entry_intinfo(struct vm *vm, int vcpuid, uint64_t *retinfo) +{ + struct vcpu *vcpu; + uint64_t info1, info2; + int valid; + + KASSERT(vcpuid >= 0 && vcpuid < VM_MAXCPU, ("invalid vcpu %d", vcpuid)); + + vcpu = &vm->vcpu[vcpuid]; + + info1 = vcpu->exitintinfo; + vcpu->exitintinfo = 0; + + info2 = 0; + if (vcpu->exception_pending) { + info2 = vcpu_exception_intinfo(vcpu); + vcpu->exception_pending = 0; + VCPU_CTR2(vm, vcpuid, "Exception %d delivered: %#lx", + vcpu->exception.vector, info2); + } + + if ((info1 & VM_INTINFO_VALID) && (info2 & VM_INTINFO_VALID)) { + valid = nested_fault(vm, vcpuid, info1, info2, retinfo); + } else if (info1 & VM_INTINFO_VALID) { + *retinfo = info1; + valid = 1; + } else if (info2 & VM_INTINFO_VALID) { + *retinfo = info2; + valid = 1; + } else { + valid = 0; + } + + if (valid) { + VCPU_CTR4(vm, vcpuid, "%s: info1(%#lx), info2(%#lx), " + "retinfo(%#lx)", __func__, info1, info2, *retinfo); + } + + return (valid); +} + +int +vm_get_intinfo(struct vm *vm, int vcpuid, uint64_t *info1, uint64_t *info2) +{ + struct vcpu *vcpu; + + if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + return (EINVAL); + + vcpu = &vm->vcpu[vcpuid]; + *info1 = vcpu->exitintinfo; + *info2 = vcpu_exception_intinfo(vcpu); + return (0); +} + int vm_inject_exception(struct vm *vm, int vcpuid, struct vm_exception *exception) { @@ -1375,6 +1674,14 @@ vm_inject_exception(struct vm *vm, int vcpuid, struct vm_exception *exception) if (exception->vector < 0 || exception->vector >= 32) return (EINVAL); + /* + * A double fault exception should never be injected directly into + * the guest. It is a derived exception that results from specific + * combinations of nested faults. + */ + if (exception->vector == IDT_DF) + return (EINVAL); + vcpu = &vm->vcpu[vcpuid]; if (vcpu->exception_pending) { @@ -1390,32 +1697,21 @@ vm_inject_exception(struct vm *vm, int vcpuid, struct vm_exception *exception) return (0); } -int -vm_exception_pending(struct vm *vm, int vcpuid, struct vm_exception *exception) -{ - struct vcpu *vcpu; - int pending; - - KASSERT(vcpuid >= 0 && vcpuid < VM_MAXCPU, ("invalid vcpu %d", vcpuid)); - - vcpu = &vm->vcpu[vcpuid]; - pending = vcpu->exception_pending; - if (pending) { - vcpu->exception_pending = 0; - *exception = vcpu->exception; - VCPU_CTR1(vm, vcpuid, "Exception %d delivered", - exception->vector); - } - return (pending); -} - -static void -vm_inject_fault(struct vm *vm, int vcpuid, struct vm_exception *exception) +void +vm_inject_fault(void *vmarg, int vcpuid, int vector, int errcode_valid, + int errcode) { + struct vm_exception exception; struct vm_exit *vmexit; + struct vm *vm; int error; - error = vm_inject_exception(vm, vcpuid, exception); + vm = vmarg; + + exception.vector = vector; + exception.error_code = errcode; + exception.error_code_valid = errcode_valid; + error = vm_inject_exception(vm, vcpuid, &exception); KASSERT(error == 0, ("vm_inject_exception error %d", error)); /* @@ -1430,26 +1726,19 @@ vm_inject_fault(struct vm *vm, int vcpuid, struct vm_exception *exception) } void -vm_inject_gp(struct vm *vm, int vcpuid) +vm_inject_pf(void *vmarg, int vcpuid, int error_code, uint64_t cr2) { - struct vm_exception gpf = { - .vector = IDT_GP, - .error_code_valid = 1, - .error_code = 0 - }; + struct vm *vm; + int error; - vm_inject_fault(vm, vcpuid, &gpf); -} + vm = vmarg; + VCPU_CTR2(vm, vcpuid, "Injecting page fault: error_code %#x, cr2 %#lx", + error_code, cr2); -void -vm_inject_ud(struct vm *vm, int vcpuid) -{ - struct vm_exception udf = { - .vector = IDT_UD, - .error_code_valid = 0 - }; + error = vm_set_register(vm, vcpuid, VM_REG_GUEST_CR2, cr2); + KASSERT(error == 0, ("vm_set_register(cr2) error %d", error)); - vm_inject_fault(vm, vcpuid, &udf); + vm_inject_fault(vm, vcpuid, IDT_PF, 1, error_code); } static VMM_STAT(VCPU_NMI_COUNT, "number of NMIs delivered to vcpu"); @@ -1684,17 +1973,19 @@ vcpu_get_state(struct vm *vm, int vcpuid, int *hostcpu) return (state); } -void +int vm_activate_cpu(struct vm *vm, int vcpuid) { - KASSERT(vcpuid >= 0 && vcpuid < VM_MAXCPU, - ("vm_activate_cpu: invalid vcpuid %d", vcpuid)); - KASSERT(!CPU_ISSET(vcpuid, &vm->active_cpus), - ("vm_activate_cpu: vcpuid %d is already active", vcpuid)); + if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + return (EINVAL); + + if (CPU_ISSET(vcpuid, &vm->active_cpus)) + return (EBUSY); VCPU_CTR0(vm, vcpuid, "activated"); CPU_SET_ATOMIC(vcpuid, &vm->active_cpus); + return (0); } cpuset_t @@ -1704,6 +1995,13 @@ vm_active_cpus(struct vm *vm) return (vm->active_cpus); } +cpuset_t +vm_suspended_cpus(struct vm *vm) +{ + + return (vm->suspended_cpus); +} + void * vcpu_stats(struct vm *vm, int vcpuid) { @@ -1856,3 +2154,142 @@ vm_atpit(struct vm *vm) { return (vm->vatpit); } + +enum vm_reg_name +vm_segment_name(int seg) +{ + static enum vm_reg_name seg_names[] = { + VM_REG_GUEST_ES, + VM_REG_GUEST_CS, + VM_REG_GUEST_SS, + VM_REG_GUEST_DS, + VM_REG_GUEST_FS, + VM_REG_GUEST_GS + }; + + KASSERT(seg >= 0 && seg < nitems(seg_names), + ("%s: invalid segment encoding %d", __func__, seg)); + return (seg_names[seg]); +} + +void +vm_copy_teardown(struct vm *vm, int vcpuid, struct vm_copyinfo *copyinfo, + int num_copyinfo) +{ + int idx; + + for (idx = 0; idx < num_copyinfo; idx++) { + if (copyinfo[idx].cookie != NULL) + vm_gpa_release(copyinfo[idx].cookie); + } + bzero(copyinfo, num_copyinfo * sizeof(struct vm_copyinfo)); +} + +int +vm_copy_setup(struct vm *vm, int vcpuid, struct vm_guest_paging *paging, + uint64_t gla, size_t len, int prot, struct vm_copyinfo *copyinfo, + int num_copyinfo) +{ + int error, idx, nused; + size_t n, off, remaining; + void *hva, *cookie; + uint64_t gpa; + + bzero(copyinfo, sizeof(struct vm_copyinfo) * num_copyinfo); + + nused = 0; + remaining = len; + while (remaining > 0) { + KASSERT(nused < num_copyinfo, ("insufficient vm_copyinfo")); + error = vmm_gla2gpa(vm, vcpuid, paging, gla, prot, &gpa); + if (error) + return (error); + off = gpa & PAGE_MASK; + n = min(remaining, PAGE_SIZE - off); + copyinfo[nused].gpa = gpa; + copyinfo[nused].len = n; + remaining -= n; + gla += n; + nused++; + } + + for (idx = 0; idx < nused; idx++) { + hva = vm_gpa_hold(vm, copyinfo[idx].gpa, copyinfo[idx].len, + prot, &cookie); + if (hva == NULL) + break; + copyinfo[idx].hva = hva; + copyinfo[idx].cookie = cookie; + } + + if (idx != nused) { + vm_copy_teardown(vm, vcpuid, copyinfo, num_copyinfo); + return (-1); + } else { + return (0); + } +} + +void +vm_copyin(struct vm *vm, int vcpuid, struct vm_copyinfo *copyinfo, void *kaddr, + size_t len) +{ + char *dst; + int idx; + + dst = kaddr; + idx = 0; + while (len > 0) { + bcopy(copyinfo[idx].hva, dst, copyinfo[idx].len); + len -= copyinfo[idx].len; + dst += copyinfo[idx].len; + idx++; + } +} + +void +vm_copyout(struct vm *vm, int vcpuid, const void *kaddr, + struct vm_copyinfo *copyinfo, size_t len) +{ + const char *src; + int idx; + + src = kaddr; + idx = 0; + while (len > 0) { + bcopy(src, copyinfo[idx].hva, copyinfo[idx].len); + len -= copyinfo[idx].len; + src += copyinfo[idx].len; + idx++; + } +} + +/* + * Return the amount of in-use and wired memory for the VM. Since + * these are global stats, only return the values with for vCPU 0 + */ +VMM_STAT_DECLARE(VMM_MEM_RESIDENT); +VMM_STAT_DECLARE(VMM_MEM_WIRED); + +static void +vm_get_rescnt(struct vm *vm, int vcpu, struct vmm_stat_type *stat) +{ + + if (vcpu == 0) { + vmm_stat_set(vm, vcpu, VMM_MEM_RESIDENT, + PAGE_SIZE * vmspace_resident_count(vm->vmspace)); + } +} + +static void +vm_get_wiredcnt(struct vm *vm, int vcpu, struct vmm_stat_type *stat) +{ + + if (vcpu == 0) { + vmm_stat_set(vm, vcpu, VMM_MEM_WIRED, + PAGE_SIZE * pmap_wired_count(vmspace_pmap(vm->vmspace))); + } +} + +VMM_STAT_FUNC(VMM_MEM_RESIDENT, "Resident memory", vm_get_rescnt); +VMM_STAT_FUNC(VMM_MEM_WIRED, "Wired memory", vm_get_wiredcnt); diff --git a/sys/amd64/vmm/vmm_dev.c b/sys/amd64/vmm/vmm_dev.c index 3112c52c97a..a85109edaa1 100644 --- a/sys/amd64/vmm/vmm_dev.c +++ b/sys/amd64/vmm/vmm_dev.c @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include "vmm_lapic.h" @@ -145,7 +146,8 @@ static int vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, struct thread *td) { - int error, vcpu, state_changed; + int error, vcpu, state_changed, size; + cpuset_t *cpuset; struct vmmdev_softc *sc; struct vm_memory_segment *seg; struct vm_register *vmreg; @@ -156,6 +158,7 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, struct vm_lapic_msi *vmmsi; struct vm_ioapic_irq *ioapic_irq; struct vm_isa_irq *isa_irq; + struct vm_isa_irq_trigger *isa_irq_trigger; struct vm_capability *vmcap; struct vm_pptdev *pptdev; struct vm_pptdev_mmio *pptmmio; @@ -167,6 +170,10 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, struct vm_x2apic *x2apic; struct vm_gpa_pte *gpapte; struct vm_suspend *vmsuspend; + struct vm_gla2gpa *gg; + struct vm_activate_cpu *vac; + struct vm_cpuset *vm_cpuset; + struct vm_intinfo *vmii; sc = vmmdev_lookup2(cdev); if (sc == NULL) @@ -191,6 +198,10 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, case VM_PPTDEV_MSI: case VM_PPTDEV_MSIX: case VM_SET_X2APIC_STATE: + case VM_GLA2GPA: + case VM_ACTIVATE_CPU: + case VM_SET_INTINFO: + case VM_GET_INTINFO: /* * XXX fragile, handle with care * Assumes that the first field of the ioctl data is the vcpu. @@ -212,6 +223,7 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, case VM_BIND_PPTDEV: case VM_UNBIND_PPTDEV: case VM_MAP_MEMORY: + case VM_REINIT: /* * ioctls that operate on the entire virtual machine must * prevent all vcpus from running. @@ -245,6 +257,9 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, vmsuspend = (struct vm_suspend *)data; error = vm_suspend(sc->vm, vmsuspend->how); break; + case VM_REINIT: + error = vm_reinit(sc->vm); + break; case VM_STAT_DESC: { statdesc = (struct vm_stat_desc *)data; error = vmm_stat_desc_copy(statdesc->index, @@ -346,6 +361,11 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, if (error == 0 && isa_irq->ioapic_irq != -1) error = vioapic_pulse_irq(sc->vm, isa_irq->ioapic_irq); break; + case VM_ISA_SET_IRQ_TRIGGER: + isa_irq_trigger = (struct vm_isa_irq_trigger *)data; + error = vatpic_set_irq_trigger(sc->vm, + isa_irq_trigger->atpic_irq, isa_irq_trigger->trigger); + break; case VM_MAP_MEMORY: seg = (struct vm_memory_segment *)data; error = vm_malloc(sc->vm, seg->gpa, seg->len); @@ -409,6 +429,59 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, case VM_GET_HPET_CAPABILITIES: error = vhpet_getcap((struct vm_hpet_cap *)data); break; + case VM_GLA2GPA: { + CTASSERT(PROT_READ == VM_PROT_READ); + CTASSERT(PROT_WRITE == VM_PROT_WRITE); + CTASSERT(PROT_EXEC == VM_PROT_EXECUTE); + gg = (struct vm_gla2gpa *)data; + error = vmm_gla2gpa(sc->vm, gg->vcpuid, &gg->paging, gg->gla, + gg->prot, &gg->gpa); + KASSERT(error == 0 || error == 1 || error == -1, + ("%s: vmm_gla2gpa unknown error %d", __func__, error)); + if (error >= 0) { + /* + * error = 0: the translation was successful + * error = 1: a fault was injected into the guest + */ + gg->fault = error; + error = 0; + } else { + error = EFAULT; + } + break; + } + case VM_ACTIVATE_CPU: + vac = (struct vm_activate_cpu *)data; + error = vm_activate_cpu(sc->vm, vac->vcpuid); + break; + case VM_GET_CPUS: + error = 0; + vm_cpuset = (struct vm_cpuset *)data; + size = vm_cpuset->cpusetsize; + if (size < sizeof(cpuset_t) || size > CPU_MAXSIZE / NBBY) { + error = ERANGE; + break; + } + cpuset = malloc(size, M_TEMP, M_WAITOK | M_ZERO); + if (vm_cpuset->which == VM_ACTIVE_CPUS) + *cpuset = vm_active_cpus(sc->vm); + else if (vm_cpuset->which == VM_SUSPENDED_CPUS) + *cpuset = vm_suspended_cpus(sc->vm); + else + error = EINVAL; + if (error == 0) + error = copyout(cpuset, vm_cpuset->cpus, size); + free(cpuset, M_TEMP); + break; + case VM_SET_INTINFO: + vmii = (struct vm_intinfo *)data; + error = vm_exit_intinfo(sc->vm, vmii->vcpuid, vmii->info1); + break; + case VM_GET_INTINFO: + vmii = (struct vm_intinfo *)data; + error = vm_get_intinfo(sc->vm, vmii->vcpuid, &vmii->info1, + &vmii->info2); + break; default: error = ENOTTY; break; diff --git a/sys/amd64/vmm/vmm_host.c b/sys/amd64/vmm/vmm_host.c index 2763e046242..9e5b96618c3 100644 --- a/sys/amd64/vmm/vmm_host.c +++ b/sys/amd64/vmm/vmm_host.c @@ -66,11 +66,16 @@ vmm_host_state_init(void) * XSAVE. Only permit a guest to use XSAVE features supported * by the host. This ensures that the FPU state used by the * guest is always a subset of the saved guest FPU state. + * + * In addition, only permit known XSAVE features where the + * rules for which features depend on other features is known + * to properly emulate xsetbv. */ if (vmm_host_cr4 & CR4_XSAVE) { vmm_xsave_limits.xsave_enabled = 1; vmm_host_xcr0 = rxcr(0); - vmm_xsave_limits.xcr0_allowed = vmm_host_xcr0; + vmm_xsave_limits.xcr0_allowed = vmm_host_xcr0 & + (XFEATURE_AVX | XFEATURE_MPX | XFEATURE_AVX512); cpuid_count(0xd, 0x0, regs); vmm_xsave_limits.xsave_max_size = regs[1]; diff --git a/sys/amd64/vmm/vmm_instruction_emul.c b/sys/amd64/vmm/vmm_instruction_emul.c index f7d109cb87c..2e77ece9674 100644 --- a/sys/amd64/vmm/vmm_instruction_emul.c +++ b/sys/amd64/vmm/vmm_instruction_emul.c @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -43,12 +44,19 @@ __FBSDID("$FreeBSD$"); #else /* !_KERNEL */ #include #include +#include #include +#include #include +#define KASSERT(exp,msg) assert((exp)) #endif /* _KERNEL */ +#include +#include +#include + /* struct vie_op.op_type */ enum { VIE_OP_TYPE_NONE = 0, @@ -58,12 +66,16 @@ enum { VIE_OP_TYPE_AND, VIE_OP_TYPE_OR, VIE_OP_TYPE_TWO_BYTE, + VIE_OP_TYPE_PUSH, + VIE_OP_TYPE_CMP, VIE_OP_TYPE_LAST }; /* struct vie_op.op_flags */ -#define VIE_OP_F_IMM (1 << 0) /* immediate operand present */ -#define VIE_OP_F_IMM8 (1 << 1) /* 8-bit immediate operand */ +#define VIE_OP_F_IMM (1 << 0) /* 16/32-bit immediate operand */ +#define VIE_OP_F_IMM8 (1 << 1) /* 8-bit immediate operand */ +#define VIE_OP_F_MOFFSET (1 << 2) /* 16/32/64-bit immediate moffset */ +#define VIE_OP_F_NO_MODRM (1 << 3) static const struct vie_op two_byte_opcodes[256] = { [0xB6] = { @@ -81,6 +93,10 @@ static const struct vie_op one_byte_opcodes[256] = { .op_byte = 0x0F, .op_type = VIE_OP_TYPE_TWO_BYTE }, + [0x3B] = { + .op_byte = 0x3B, + .op_type = VIE_OP_TYPE_CMP, + }, [0x88] = { .op_byte = 0x88, .op_type = VIE_OP_TYPE_MOV, @@ -97,6 +113,22 @@ static const struct vie_op one_byte_opcodes[256] = { .op_byte = 0x8B, .op_type = VIE_OP_TYPE_MOV, }, + [0xA1] = { + .op_byte = 0xA1, + .op_type = VIE_OP_TYPE_MOV, + .op_flags = VIE_OP_F_MOFFSET | VIE_OP_F_NO_MODRM, + }, + [0xA3] = { + .op_byte = 0xA3, + .op_type = VIE_OP_TYPE_MOV, + .op_flags = VIE_OP_F_MOFFSET | VIE_OP_F_NO_MODRM, + }, + [0xC6] = { + /* XXX Group 11 extended opcode - not just MOV */ + .op_byte = 0xC6, + .op_type = VIE_OP_TYPE_MOV, + .op_flags = VIE_OP_F_IMM8, + }, [0xC7] = { .op_byte = 0xC7, .op_type = VIE_OP_TYPE_MOV, @@ -118,6 +150,11 @@ static const struct vie_op one_byte_opcodes[256] = { .op_type = VIE_OP_TYPE_OR, .op_flags = VIE_OP_F_IMM8, }, + [0xFF] = { + /* XXX Group 5 extended opcode - not just PUSH */ + .op_byte = 0xFF, + .op_type = VIE_OP_TYPE_PUSH, + } }; /* struct vie.mod */ @@ -168,18 +205,15 @@ vie_read_register(void *vm, int vcpuid, enum vm_reg_name reg, uint64_t *rval) return (error); } -static int -vie_read_bytereg(void *vm, int vcpuid, struct vie *vie, uint8_t *rval) +static void +vie_calc_bytereg(struct vie *vie, enum vm_reg_name *reg, int *lhbr) { - uint64_t val; - int error, rshift; - enum vm_reg_name reg; - - rshift = 0; - reg = gpr_map[vie->reg]; + *lhbr = 0; + *reg = gpr_map[vie->reg]; /* - * 64-bit mode imposes limitations on accessing legacy byte registers. + * 64-bit mode imposes limitations on accessing legacy high byte + * registers (lhbr). * * The legacy high-byte registers cannot be addressed if the REX * prefix is present. In this case the values 4, 5, 6 and 7 of the @@ -191,21 +225,60 @@ vie_read_bytereg(void *vm, int vcpuid, struct vie *vie, uint8_t *rval) */ if (!vie->rex_present) { if (vie->reg & 0x4) { - /* - * Obtain the value of %ah by reading %rax and shifting - * right by 8 bits (same for %bh, %ch and %dh). - */ - rshift = 8; - reg = gpr_map[vie->reg & 0x3]; + *lhbr = 1; + *reg = gpr_map[vie->reg & 0x3]; } } +} +static int +vie_read_bytereg(void *vm, int vcpuid, struct vie *vie, uint8_t *rval) +{ + uint64_t val; + int error, lhbr; + enum vm_reg_name reg; + + vie_calc_bytereg(vie, ®, &lhbr); error = vm_get_register(vm, vcpuid, reg, &val); - *rval = val >> rshift; + + /* + * To obtain the value of a legacy high byte register shift the + * base register right by 8 bits (%ah = %rax >> 8). + */ + if (lhbr) + *rval = val >> 8; + else + *rval = val; return (error); } static int +vie_write_bytereg(void *vm, int vcpuid, struct vie *vie, uint8_t byte) +{ + uint64_t origval, val, mask; + int error, lhbr; + enum vm_reg_name reg; + + vie_calc_bytereg(vie, ®, &lhbr); + error = vm_get_register(vm, vcpuid, reg, &origval); + if (error == 0) { + val = byte; + mask = 0xff; + if (lhbr) { + /* + * Shift left by 8 to store 'byte' in a legacy high + * byte register. + */ + val <<= 8; + mask <<= 8; + } + val |= origval & ~mask; + error = vm_set_register(vm, vcpuid, reg, val); + } + return (error); +} + +int vie_update_register(void *vm, int vcpuid, enum vm_reg_name reg, uint64_t val, int size) { @@ -235,16 +308,52 @@ vie_update_register(void *vm, int vcpuid, enum vm_reg_name reg, } /* - * The following simplifying assumptions are made during emulation: - * - * - guest is in 64-bit mode - * - default address size is 64-bits - * - default operand size is 32-bits - * - * - operand size override is not supported - * - * - address size override is not supported + * Return the status flags that would result from doing (x - y). */ +static u_long +getcc16(uint16_t x, uint16_t y) +{ + u_long rflags; + + __asm __volatile("sub %1,%2; pushfq; popq %0" : + "=r" (rflags) : "m" (y), "r" (x)); + return (rflags); +} + +static u_long +getcc32(uint32_t x, uint32_t y) +{ + u_long rflags; + + __asm __volatile("sub %1,%2; pushfq; popq %0" : + "=r" (rflags) : "m" (y), "r" (x)); + return (rflags); +} + +static u_long +getcc64(uint64_t x, uint64_t y) +{ + u_long rflags; + + __asm __volatile("sub %1,%2; pushfq; popq %0" : + "=r" (rflags) : "m" (y), "r" (x)); + return (rflags); +} + +static u_long +getcc(int opsize, uint64_t x, uint64_t y) +{ + KASSERT(opsize == 2 || opsize == 4 || opsize == 8, + ("getcc: invalid operand size %d", opsize)); + + if (opsize == 2) + return (getcc16(x, y)); + else if (opsize == 4) + return (getcc32(x, y)); + else + return (getcc64(x, y)); +} + static int emulate_mov(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, mem_region_read_t memread, mem_region_write_t memwrite, void *arg) @@ -254,7 +363,7 @@ emulate_mov(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, uint8_t byte; uint64_t val; - size = 4; + size = vie->opsize; error = EINVAL; switch (vie->op.op_byte) { @@ -264,7 +373,7 @@ emulate_mov(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, * 88/r: mov r/m8, r8 * REX + 88/r: mov r/m8, r8 (%ah, %ch, %dh, %bh not available) */ - size = 1; + size = 1; /* override for byte operation */ error = vie_read_bytereg(vm, vcpuid, vie, &byte); if (error == 0) error = memwrite(vm, vcpuid, gpa, byte, size, arg); @@ -272,11 +381,10 @@ emulate_mov(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, case 0x89: /* * MOV from reg (ModRM:reg) to mem (ModRM:r/m) + * 89/r: mov r/m16, r16 * 89/r: mov r/m32, r32 * REX.W + 89/r mov r/m64, r64 */ - if (vie->rex_w) - size = 8; reg = gpr_map[vie->reg]; error = vie_read_register(vm, vcpuid, reg, &val); if (error == 0) { @@ -285,38 +393,72 @@ emulate_mov(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, } break; case 0x8A: + /* + * MOV byte from mem (ModRM:r/m) to reg (ModRM:reg) + * 8A/r: mov r8, r/m8 + * REX + 8A/r: mov r8, r/m8 + */ + size = 1; /* override for byte operation */ + error = memread(vm, vcpuid, gpa, &val, size, arg); + if (error == 0) + error = vie_write_bytereg(vm, vcpuid, vie, val); + break; case 0x8B: /* * MOV from mem (ModRM:r/m) to reg (ModRM:reg) - * 8A/r: mov r/m8, r8 - * REX + 8A/r: mov r/m8, r8 + * 8B/r: mov r16, r/m16 * 8B/r: mov r32, r/m32 * REX.W 8B/r: mov r64, r/m64 */ - if (vie->op.op_byte == 0x8A) - size = 1; - else if (vie->rex_w) - size = 8; error = memread(vm, vcpuid, gpa, &val, size, arg); if (error == 0) { reg = gpr_map[vie->reg]; error = vie_update_register(vm, vcpuid, reg, val, size); } break; + case 0xA1: + /* + * MOV from seg:moffset to AX/EAX/RAX + * A1: mov AX, moffs16 + * A1: mov EAX, moffs32 + * REX.W + A1: mov RAX, moffs64 + */ + error = memread(vm, vcpuid, gpa, &val, size, arg); + if (error == 0) { + reg = VM_REG_GUEST_RAX; + error = vie_update_register(vm, vcpuid, reg, val, size); + } + break; + case 0xA3: + /* + * MOV from AX/EAX/RAX to seg:moffset + * A3: mov moffs16, AX + * A3: mov moffs32, EAX + * REX.W + A3: mov moffs64, RAX + */ + error = vie_read_register(vm, vcpuid, VM_REG_GUEST_RAX, &val); + if (error == 0) { + val &= size2mask[size]; + error = memwrite(vm, vcpuid, gpa, val, size, arg); + } + break; + case 0xC6: + /* + * MOV from imm8 to mem (ModRM:r/m) + * C6/0 mov r/m8, imm8 + * REX + C6/0 mov r/m8, imm8 + */ + size = 1; /* override for byte operation */ + error = memwrite(vm, vcpuid, gpa, vie->immediate, size, arg); + break; case 0xC7: /* - * MOV from imm32 to mem (ModRM:r/m) + * MOV from imm16/imm32 to mem (ModRM:r/m) + * C7/0 mov r/m16, imm16 * C7/0 mov r/m32, imm32 * REX.W + C7/0 mov r/m64, imm32 (sign-extended to 64-bits) */ - val = vie->immediate; /* already sign-extended */ - - if (vie->rex_w) - size = 8; - - if (size != 8) - val &= size2mask[size]; - + val = vie->immediate & size2mask[size]; error = memwrite(vm, vcpuid, gpa, val, size, arg); break; default: @@ -326,17 +468,6 @@ emulate_mov(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, return (error); } -/* - * The following simplifying assumptions are made during emulation: - * - * - guest is in 64-bit mode - * - default address size is 64-bits - * - default operand size is 32-bits - * - * - operand size override is not supported - * - * - address size override is not supported - */ static int emulate_movx(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, mem_region_read_t memread, mem_region_write_t memwrite, @@ -346,7 +477,7 @@ emulate_movx(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, enum vm_reg_name reg; uint64_t val; - size = 4; + size = vie->opsize; error = EINVAL; switch (vie->op.op_byte) { @@ -355,8 +486,9 @@ emulate_movx(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, * MOV and zero extend byte from mem (ModRM:r/m) to * reg (ModRM:reg). * - * 0F B6/r movzx r/m8, r32 - * REX.W + 0F B6/r movzx r/m8, r64 + * 0F B6/r movzx r16, r/m8 + * 0F B6/r movzx r32, r/m8 + * REX.W + 0F B6/r movzx r64, r/m8 */ /* get the first operand */ @@ -367,8 +499,8 @@ emulate_movx(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, /* get the second operand */ reg = gpr_map[vie->reg]; - if (vie->rex_w) - size = 8; + /* zero-extend byte */ + val = (uint8_t)val; /* write the result */ error = vie_update_register(vm, vcpuid, reg, val, size); @@ -378,8 +510,9 @@ emulate_movx(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, * MOV and sign extend byte from mem (ModRM:r/m) to * reg (ModRM:reg). * - * 0F BE/r movsx r/m8, r32 - * REX.W + 0F BE/r movsx r/m8, r64 + * 0F BE/r movsx r16, r/m8 + * 0F BE/r movsx r32, r/m8 + * REX.W + 0F BE/r movsx r64, r/m8 */ /* get the first operand */ @@ -390,9 +523,6 @@ emulate_movx(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, /* get the second operand */ reg = gpr_map[vie->reg]; - if (vie->rex_w) - size = 8; - /* sign extend byte */ val = (int8_t)val; @@ -413,7 +543,7 @@ emulate_and(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, enum vm_reg_name reg; uint64_t val1, val2; - size = 4; + size = vie->opsize; error = EINVAL; switch (vie->op.op_byte) { @@ -422,11 +552,10 @@ emulate_and(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, * AND reg (ModRM:reg) and mem (ModRM:r/m) and store the * result in reg. * + * 23/r and r16, r/m16 * 23/r and r32, r/m32 * REX.W + 23/r and r64, r/m64 */ - if (vie->rex_w) - size = 8; /* get the first operand */ reg = gpr_map[vie->reg]; @@ -448,8 +577,9 @@ emulate_and(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, * AND mem (ModRM:r/m) with immediate and store the * result in mem. * - * 81/ and r/m32, imm32 - * REX.W + 81/ and r/m64, imm32 sign-extended to 64 + * 81 /4 and r/m16, imm16 + * 81 /4 and r/m32, imm32 + * REX.W + 81 /4 and r/m64, imm32 sign-extended to 64 * * Currently, only the AND operation of the 0x81 opcode * is implemented (ModRM:reg = b100). @@ -457,9 +587,6 @@ emulate_and(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, if ((vie->reg & 7) != 4) break; - if (vie->rex_w) - size = 8; - /* get the first operand */ error = memread(vm, vcpuid, gpa, &val1, size, arg); if (error) @@ -485,7 +612,7 @@ emulate_or(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, int error, size; uint64_t val1; - size = 4; + size = vie->opsize; error = EINVAL; switch (vie->op.op_byte) { @@ -494,8 +621,9 @@ emulate_or(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, * OR mem (ModRM:r/m) with immediate and store the * result in mem. * - * 83/ OR r/m32, imm8 sign-extended to 32 - * REX.W + 83/ OR r/m64, imm8 sign-extended to 64 + * 83 /1 OR r/m16, imm8 sign-extended to 16 + * 83 /1 OR r/m32, imm8 sign-extended to 32 + * REX.W + 83/1 OR r/m64, imm8 sign-extended to 64 * * Currently, only the OR operation of the 0x83 opcode * is implemented (ModRM:reg = b001). @@ -503,9 +631,6 @@ emulate_or(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, if ((vie->reg & 7) != 1) break; - if (vie->rex_w) - size = 8; - /* get the first operand */ error = memread(vm, vcpuid, gpa, &val1, size, arg); if (error) @@ -524,10 +649,167 @@ emulate_or(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, return (error); } +#define RFLAGS_STATUS_BITS (PSL_C | PSL_PF | PSL_AF | PSL_Z | PSL_N | PSL_V) + +static int +emulate_cmp(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, + mem_region_read_t memread, mem_region_write_t memwrite, void *arg) +{ + int error, size; + uint64_t op1, op2, rflags, rflags2; + enum vm_reg_name reg; + + size = vie->opsize; + switch (vie->op.op_byte) { + case 0x3B: + /* + * 3B/r CMP r16, r/m16 + * 3B/r CMP r32, r/m32 + * REX.W + 3B/r CMP r64, r/m64 + * + * Compare first operand (reg) with second operand (r/m) and + * set status flags in EFLAGS register. The comparison is + * performed by subtracting the second operand from the first + * operand and then setting the status flags. + */ + + /* Get the first operand */ + reg = gpr_map[vie->reg]; + error = vie_read_register(vm, vcpuid, reg, &op1); + if (error) + return (error); + + /* Get the second operand */ + error = memread(vm, vcpuid, gpa, &op2, size, arg); + if (error) + return (error); + + break; + default: + return (EINVAL); + } + rflags2 = getcc(size, op1, op2); + error = vie_read_register(vm, vcpuid, VM_REG_GUEST_RFLAGS, &rflags); + if (error) + return (error); + rflags &= ~RFLAGS_STATUS_BITS; + rflags |= rflags2 & RFLAGS_STATUS_BITS; + + error = vie_update_register(vm, vcpuid, VM_REG_GUEST_RFLAGS, rflags, 8); + return (error); +} + +static int +emulate_push(void *vm, int vcpuid, uint64_t mmio_gpa, struct vie *vie, + struct vm_guest_paging *paging, mem_region_read_t memread, + mem_region_write_t memwrite, void *arg) +{ +#ifdef _KERNEL + struct vm_copyinfo copyinfo[2]; +#else + struct iovec copyinfo[2]; +#endif + struct seg_desc ss_desc; + uint64_t cr0, rflags, rsp, stack_gla, val; + int error, size, stackaddrsize; + + /* + * Table A-6, "Opcode Extensions", Intel SDM, Vol 2. + * + * PUSH is part of the group 5 extended opcodes and is identified + * by ModRM:reg = b110. + */ + if ((vie->reg & 7) != 6) + return (EINVAL); + + size = vie->opsize; + /* + * From "Address-Size Attributes for Stack Accesses", Intel SDL, Vol 1 + */ + if (paging->cpu_mode == CPU_MODE_REAL) { + stackaddrsize = 2; + } else if (paging->cpu_mode == CPU_MODE_64BIT) { + /* + * "Stack Manipulation Instructions in 64-bit Mode", SDM, Vol 3 + * - Stack pointer size is always 64-bits. + * - PUSH/POP of 32-bit values is not possible in 64-bit mode. + * - 16-bit PUSH/POP is supported by using the operand size + * override prefix (66H). + */ + stackaddrsize = 8; + size = vie->opsize_override ? 2 : 8; + } else { + /* + * In protected or compability mode the 'B' flag in the + * stack-segment descriptor determines the size of the + * stack pointer. + */ + error = vm_get_seg_desc(vm, vcpuid, VM_REG_GUEST_SS, &ss_desc); + KASSERT(error == 0, ("%s: error %d getting SS descriptor", + __func__, error)); + if (SEG_DESC_DEF32(ss_desc.access)) + stackaddrsize = 4; + else + stackaddrsize = 2; + } + + error = vie_read_register(vm, vcpuid, VM_REG_GUEST_CR0, &cr0); + KASSERT(error == 0, ("%s: error %d getting cr0", __func__, error)); + + error = vie_read_register(vm, vcpuid, VM_REG_GUEST_RFLAGS, &rflags); + KASSERT(error == 0, ("%s: error %d getting rflags", __func__, error)); + + error = vie_read_register(vm, vcpuid, VM_REG_GUEST_RSP, &rsp); + KASSERT(error == 0, ("%s: error %d getting rsp", __func__, error)); + + rsp -= size; + if (vie_calculate_gla(paging->cpu_mode, VM_REG_GUEST_SS, &ss_desc, + rsp, size, stackaddrsize, PROT_WRITE, &stack_gla)) { + vm_inject_ss(vm, vcpuid, 0); + return (0); + } + + if (vie_canonical_check(paging->cpu_mode, stack_gla)) { + vm_inject_ss(vm, vcpuid, 0); + return (0); + } + + if (vie_alignment_check(paging->cpl, size, cr0, rflags, stack_gla)) { + vm_inject_ac(vm, vcpuid, 0); + return (0); + } + + error = vm_copy_setup(vm, vcpuid, paging, stack_gla, size, PROT_WRITE, + copyinfo, nitems(copyinfo)); + if (error == -1) { + /* + * XXX cannot return a negative error value here because it + * ends up being the return value of the VM_RUN() ioctl and + * is interpreted as a pseudo-error (for e.g. ERESTART). + */ + return (EFAULT); + } else if (error == 1) { + /* Resume guest execution to handle page fault */ + return (0); + } + + error = memread(vm, vcpuid, mmio_gpa, &val, size, arg); + if (error == 0) { + vm_copyout(vm, vcpuid, &val, copyinfo, size); + error = vie_update_register(vm, vcpuid, VM_REG_GUEST_RSP, rsp, + stackaddrsize); + KASSERT(error == 0, ("error %d updating rsp", error)); + } +#ifdef _KERNEL + vm_copy_teardown(vm, vcpuid, copyinfo, nitems(copyinfo)); +#endif + return (error); +} + int vmm_emulate_instruction(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, - mem_region_read_t memread, mem_region_write_t memwrite, - void *memarg) + struct vm_guest_paging *paging, mem_region_read_t memread, + mem_region_write_t memwrite, void *memarg) { int error; @@ -535,6 +817,14 @@ vmm_emulate_instruction(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, return (EINVAL); switch (vie->op.op_type) { + case VIE_OP_TYPE_PUSH: + error = emulate_push(vm, vcpuid, gpa, vie, paging, memread, + memwrite, memarg); + break; + case VIE_OP_TYPE_CMP: + error = emulate_cmp(vm, vcpuid, gpa, vie, + memread, memwrite, memarg); + break; case VIE_OP_TYPE_MOV: error = emulate_mov(vm, vcpuid, gpa, vie, memread, memwrite, memarg); @@ -560,6 +850,156 @@ vmm_emulate_instruction(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, return (error); } +int +vie_alignment_check(int cpl, int size, uint64_t cr0, uint64_t rf, uint64_t gla) +{ + KASSERT(size == 1 || size == 2 || size == 4 || size == 8, + ("%s: invalid size %d", __func__, size)); + KASSERT(cpl >= 0 && cpl <= 3, ("%s: invalid cpl %d", __func__, cpl)); + + if (cpl != 3 || (cr0 & CR0_AM) == 0 || (rf & PSL_AC) == 0) + return (0); + + return ((gla & (size - 1)) ? 1 : 0); +} + +int +vie_canonical_check(enum vm_cpu_mode cpu_mode, uint64_t gla) +{ + uint64_t mask; + + if (cpu_mode != CPU_MODE_64BIT) + return (0); + + /* + * The value of the bit 47 in the 'gla' should be replicated in the + * most significant 16 bits. + */ + mask = ~((1UL << 48) - 1); + if (gla & (1UL << 47)) + return ((gla & mask) != mask); + else + return ((gla & mask) != 0); +} + +uint64_t +vie_size2mask(int size) +{ + KASSERT(size == 1 || size == 2 || size == 4 || size == 8, + ("vie_size2mask: invalid size %d", size)); + return (size2mask[size]); +} + +int +vie_calculate_gla(enum vm_cpu_mode cpu_mode, enum vm_reg_name seg, + struct seg_desc *desc, uint64_t offset, int length, int addrsize, + int prot, uint64_t *gla) +{ + uint64_t firstoff, low_limit, high_limit, segbase; + int glasize, type; + + KASSERT(seg >= VM_REG_GUEST_ES && seg <= VM_REG_GUEST_GS, + ("%s: invalid segment %d", __func__, seg)); + KASSERT(length == 1 || length == 2 || length == 4 || length == 8, + ("%s: invalid operand size %d", __func__, length)); + KASSERT((prot & ~(PROT_READ | PROT_WRITE)) == 0, + ("%s: invalid prot %#x", __func__, prot)); + + firstoff = offset; + if (cpu_mode == CPU_MODE_64BIT) { + KASSERT(addrsize == 4 || addrsize == 8, ("%s: invalid address " + "size %d for cpu_mode %d", __func__, addrsize, cpu_mode)); + glasize = 8; + } else { + KASSERT(addrsize == 2 || addrsize == 4, ("%s: invalid address " + "size %d for cpu mode %d", __func__, addrsize, cpu_mode)); + glasize = 4; + /* + * If the segment selector is loaded with a NULL selector + * then the descriptor is unusable and attempting to use + * it results in a #GP(0). + */ + if (SEG_DESC_UNUSABLE(desc->access)) + return (-1); + + /* + * The processor generates a #NP exception when a segment + * register is loaded with a selector that points to a + * descriptor that is not present. If this was the case then + * it would have been checked before the VM-exit. + */ + KASSERT(SEG_DESC_PRESENT(desc->access), + ("segment %d not present: %#x", seg, desc->access)); + + /* + * The descriptor type must indicate a code/data segment. + */ + type = SEG_DESC_TYPE(desc->access); + KASSERT(type >= 16 && type <= 31, ("segment %d has invalid " + "descriptor type %#x", seg, type)); + + if (prot & PROT_READ) { + /* #GP on a read access to a exec-only code segment */ + if ((type & 0xA) == 0x8) + return (-1); + } + + if (prot & PROT_WRITE) { + /* + * #GP on a write access to a code segment or a + * read-only data segment. + */ + if (type & 0x8) /* code segment */ + return (-1); + + if ((type & 0xA) == 0) /* read-only data seg */ + return (-1); + } + + /* + * 'desc->limit' is fully expanded taking granularity into + * account. + */ + if ((type & 0xC) == 0x4) { + /* expand-down data segment */ + low_limit = desc->limit + 1; + high_limit = SEG_DESC_DEF32(desc->access) ? + 0xffffffff : 0xffff; + } else { + /* code segment or expand-up data segment */ + low_limit = 0; + high_limit = desc->limit; + } + + while (length > 0) { + offset &= vie_size2mask(addrsize); + if (offset < low_limit || offset > high_limit) + return (-1); + offset++; + length--; + } + } + + /* + * In 64-bit mode all segments except %fs and %gs have a segment + * base address of 0. + */ + if (cpu_mode == CPU_MODE_64BIT && seg != VM_REG_GUEST_FS && + seg != VM_REG_GUEST_GS) { + segbase = 0; + } else { + segbase = desc->base; + } + + /* + * Truncate 'firstoff' to the effective address size before adding + * it to the segment base. + */ + firstoff &= vie_size2mask(addrsize); + *gla = (segbase + firstoff) & vie_size2mask(glasize); + return (0); +} + #ifdef _KERNEL void vie_init(struct vie *vie) @@ -572,28 +1012,86 @@ vie_init(struct vie *vie) } static int -gla2gpa(struct vm *vm, uint64_t gla, uint64_t ptpphys, - uint64_t *gpa, enum vie_paging_mode paging_mode) +pf_error_code(int usermode, int prot, int rsvd, uint64_t pte) { - int nlevels, ptpshift, ptpindex; - uint64_t *ptpbase, pte, pgsize; + int error_code = 0; + + if (pte & PG_V) + error_code |= PGEX_P; + if (prot & VM_PROT_WRITE) + error_code |= PGEX_W; + if (usermode) + error_code |= PGEX_U; + if (rsvd) + error_code |= PGEX_RSV; + if (prot & VM_PROT_EXECUTE) + error_code |= PGEX_I; + + return (error_code); +} + +static void +ptp_release(void **cookie) +{ + if (*cookie != NULL) { + vm_gpa_release(*cookie); + *cookie = NULL; + } +} + +static void * +ptp_hold(struct vm *vm, vm_paddr_t ptpphys, size_t len, void **cookie) +{ + void *ptr; + + ptp_release(cookie); + ptr = vm_gpa_hold(vm, ptpphys, len, VM_PROT_RW, cookie); + return (ptr); +} + +int +vmm_gla2gpa(struct vm *vm, int vcpuid, struct vm_guest_paging *paging, + uint64_t gla, int prot, uint64_t *gpa) +{ + int nlevels, pfcode, ptpshift, ptpindex, retval, usermode, writable; + u_int retries; + uint64_t *ptpbase, ptpphys, pte, pgsize; uint32_t *ptpbase32, pte32; void *cookie; - if (paging_mode == PAGING_MODE_FLAT) { - *gpa = gla; - return (0); + usermode = (paging->cpl == 3 ? 1 : 0); + writable = prot & VM_PROT_WRITE; + cookie = NULL; + retval = 0; + retries = 0; +restart: + ptpphys = paging->cr3; /* root of the page tables */ + ptp_release(&cookie); + if (retries++ > 0) + maybe_yield(); + + if (vie_canonical_check(paging->cpu_mode, gla)) { + /* + * XXX assuming a non-stack reference otherwise a stack fault + * should be generated. + */ + vm_inject_gp(vm, vcpuid); + goto fault; } - if (paging_mode == PAGING_MODE_32) { + if (paging->paging_mode == PAGING_MODE_FLAT) { + *gpa = gla; + goto done; + } + + if (paging->paging_mode == PAGING_MODE_32) { nlevels = 2; while (--nlevels >= 0) { /* Zero out the lower 12 bits. */ ptpphys &= ~0xfff; - ptpbase32 = vm_gpa_hold(vm, ptpphys, PAGE_SIZE, - VM_PROT_READ, &cookie); - + ptpbase32 = ptp_hold(vm, ptpphys, PAGE_SIZE, &cookie); + if (ptpbase32 == NULL) goto error; @@ -603,29 +1101,55 @@ gla2gpa(struct vm *vm, uint64_t gla, uint64_t ptpphys, pte32 = ptpbase32[ptpindex]; - vm_gpa_release(cookie); + if ((pte32 & PG_V) == 0 || + (usermode && (pte32 & PG_U) == 0) || + (writable && (pte32 & PG_RW) == 0)) { + pfcode = pf_error_code(usermode, prot, 0, + pte32); + vm_inject_pf(vm, vcpuid, pfcode, gla); + goto fault; + } - if ((pte32 & PG_V) == 0) - goto error; + /* + * Emulate the x86 MMU's management of the accessed + * and dirty flags. While the accessed flag is set + * at every level of the page table, the dirty flag + * is only set at the last level providing the guest + * physical address. + */ + if ((pte32 & PG_A) == 0) { + if (atomic_cmpset_32(&ptpbase32[ptpindex], + pte32, pte32 | PG_A) == 0) { + goto restart; + } + } - if (pte32 & PG_PS) + /* XXX must be ignored if CR4.PSE=0 */ + if (nlevels > 0 && (pte32 & PG_PS) != 0) break; ptpphys = pte32; } + /* Set the dirty bit in the page table entry if necessary */ + if (writable && (pte32 & PG_M) == 0) { + if (atomic_cmpset_32(&ptpbase32[ptpindex], + pte32, pte32 | PG_M) == 0) { + goto restart; + } + } + /* Zero out the lower 'ptpshift' bits */ pte32 >>= ptpshift; pte32 <<= ptpshift; *gpa = pte32 | (gla & (pgsize - 1)); - return (0); + goto done; } - if (paging_mode == PAGING_MODE_PAE) { - /* Zero out the lower 5 bits and the upper 12 bits */ - ptpphys >>= 5; ptpphys <<= 17; ptpphys >>= 12; + if (paging->paging_mode == PAGING_MODE_PAE) { + /* Zero out the lower 5 bits and the upper 32 bits */ + ptpphys &= 0xffffffe0UL; - ptpbase = vm_gpa_hold(vm, ptpphys, sizeof(*ptpbase) * 4, - VM_PROT_READ, &cookie); + ptpbase = ptp_hold(vm, ptpphys, sizeof(*ptpbase) * 4, &cookie); if (ptpbase == NULL) goto error; @@ -633,10 +1157,11 @@ gla2gpa(struct vm *vm, uint64_t gla, uint64_t ptpphys, pte = ptpbase[ptpindex]; - vm_gpa_release(cookie); - - if ((pte & PG_V) == 0) - goto error; + if ((pte & PG_V) == 0) { + pfcode = pf_error_code(usermode, prot, 0, pte); + vm_inject_pf(vm, vcpuid, pfcode, gla); + goto fault; + } ptpphys = pte; @@ -647,8 +1172,7 @@ gla2gpa(struct vm *vm, uint64_t gla, uint64_t ptpphys, /* Zero out the lower 12 bits and the upper 12 bits */ ptpphys >>= 12; ptpphys <<= 24; ptpphys >>= 12; - ptpbase = vm_gpa_hold(vm, ptpphys, PAGE_SIZE, VM_PROT_READ, - &cookie); + ptpbase = ptp_hold(vm, ptpphys, PAGE_SIZE, &cookie); if (ptpbase == NULL) goto error; @@ -658,71 +1182,73 @@ gla2gpa(struct vm *vm, uint64_t gla, uint64_t ptpphys, pte = ptpbase[ptpindex]; - vm_gpa_release(cookie); + if ((pte & PG_V) == 0 || + (usermode && (pte & PG_U) == 0) || + (writable && (pte & PG_RW) == 0)) { + pfcode = pf_error_code(usermode, prot, 0, pte); + vm_inject_pf(vm, vcpuid, pfcode, gla); + goto fault; + } - if ((pte & PG_V) == 0) - goto error; + /* Set the accessed bit in the page table entry */ + if ((pte & PG_A) == 0) { + if (atomic_cmpset_64(&ptpbase[ptpindex], + pte, pte | PG_A) == 0) { + goto restart; + } + } - if (pte & PG_PS) { - if (pgsize > 1 * GB) - goto error; - else - break; + if (nlevels > 0 && (pte & PG_PS) != 0) { + if (pgsize > 1 * GB) { + pfcode = pf_error_code(usermode, prot, 1, pte); + vm_inject_pf(vm, vcpuid, pfcode, gla); + goto fault; + } + break; } ptpphys = pte; } + /* Set the dirty bit in the page table entry if necessary */ + if (writable && (pte & PG_M) == 0) { + if (atomic_cmpset_64(&ptpbase[ptpindex], pte, pte | PG_M) == 0) + goto restart; + } + /* Zero out the lower 'ptpshift' bits and the upper 12 bits */ pte >>= ptpshift; pte <<= (ptpshift + 12); pte >>= 12; *gpa = pte | (gla & (pgsize - 1)); - return (0); - +done: + ptp_release(&cookie); + return (retval); error: - return (-1); + retval = -1; + goto done; +fault: + retval = 1; + goto done; } int -vmm_fetch_instruction(struct vm *vm, int cpuid, uint64_t rip, int inst_length, - uint64_t cr3, enum vie_paging_mode paging_mode, - struct vie *vie) +vmm_fetch_instruction(struct vm *vm, int vcpuid, struct vm_guest_paging *paging, + uint64_t rip, int inst_length, struct vie *vie) { - int n, err, prot; - uint64_t gpa, off; - void *hpa, *cookie; + struct vm_copyinfo copyinfo[2]; + int error, prot; - /* - * XXX cache previously fetched instructions using 'rip' as the tag - */ - - prot = VM_PROT_READ | VM_PROT_EXECUTE; if (inst_length > VIE_INST_SIZE) panic("vmm_fetch_instruction: invalid length %d", inst_length); - /* Copy the instruction into 'vie' */ - while (vie->num_valid < inst_length) { - err = gla2gpa(vm, rip, cr3, &gpa, paging_mode); - if (err) - break; - - off = gpa & PAGE_MASK; - n = min(inst_length - vie->num_valid, PAGE_SIZE - off); - - if ((hpa = vm_gpa_hold(vm, gpa, n, prot, &cookie)) == NULL) - break; - - bcopy(hpa, &vie->inst[vie->num_valid], n); - - vm_gpa_release(cookie); - - rip += n; - vie->num_valid += n; + prot = PROT_READ | PROT_EXEC; + error = vm_copy_setup(vm, vcpuid, paging, rip, inst_length, prot, + copyinfo, nitems(copyinfo)); + if (error == 0) { + vm_copyin(vm, vcpuid, copyinfo, vie->inst, inst_length); + vm_copy_teardown(vm, vcpuid, copyinfo, nitems(copyinfo)); + vie->num_valid = inst_length; } - - if (vie->num_valid == inst_length) - return (0); - else - return (-1); + return (error); } static int @@ -744,24 +1270,65 @@ vie_advance(struct vie *vie) } static int -decode_rex(struct vie *vie) +decode_prefixes(struct vie *vie, enum vm_cpu_mode cpu_mode, int cs_d) { uint8_t x; - if (vie_peek(vie, &x)) - return (-1); + while (1) { + if (vie_peek(vie, &x)) + return (-1); - if (x >= 0x40 && x <= 0x4F) { - vie->rex_present = 1; - - vie->rex_w = x & 0x8 ? 1 : 0; - vie->rex_r = x & 0x4 ? 1 : 0; - vie->rex_x = x & 0x2 ? 1 : 0; - vie->rex_b = x & 0x1 ? 1 : 0; + if (x == 0x66) + vie->opsize_override = 1; + else if (x == 0x67) + vie->addrsize_override = 1; + else + break; vie_advance(vie); } + /* + * From section 2.2.1, "REX Prefixes", Intel SDM Vol 2: + * - Only one REX prefix is allowed per instruction. + * - The REX prefix must immediately precede the opcode byte or the + * escape opcode byte. + * - If an instruction has a mandatory prefix (0x66, 0xF2 or 0xF3) + * the mandatory prefix must come before the REX prefix. + */ + if (cpu_mode == CPU_MODE_64BIT && x >= 0x40 && x <= 0x4F) { + vie->rex_present = 1; + vie->rex_w = x & 0x8 ? 1 : 0; + vie->rex_r = x & 0x4 ? 1 : 0; + vie->rex_x = x & 0x2 ? 1 : 0; + vie->rex_b = x & 0x1 ? 1 : 0; + vie_advance(vie); + } + + /* + * Section "Operand-Size And Address-Size Attributes", Intel SDM, Vol 1 + */ + if (cpu_mode == CPU_MODE_64BIT) { + /* + * Default address size is 64-bits and default operand size + * is 32-bits. + */ + vie->addrsize = vie->addrsize_override ? 4 : 8; + if (vie->rex_w) + vie->opsize = 8; + else if (vie->opsize_override) + vie->opsize = 2; + else + vie->opsize = 4; + } else if (cs_d) { + /* Default address and operand sizes are 32-bits */ + vie->addrsize = vie->addrsize_override ? 2 : 4; + vie->opsize = vie->opsize_override ? 2 : 4; + } else { + /* Default address and operand sizes are 16-bits */ + vie->addrsize = vie->addrsize_override ? 4 : 2; + vie->opsize = vie->opsize_override ? 4 : 2; + } return (0); } @@ -804,10 +1371,16 @@ decode_opcode(struct vie *vie) } static int -decode_modrm(struct vie *vie, enum vie_cpu_mode cpu_mode) +decode_modrm(struct vie *vie, enum vm_cpu_mode cpu_mode) { uint8_t x; + if (cpu_mode == CPU_MODE_REAL) + return (-1); + + if (vie->op.op_flags & VIE_OP_F_NO_MODRM) + return (0); + if (vie_peek(vie, &x)) return (-1); @@ -986,20 +1559,32 @@ decode_immediate(struct vie *vie) union { char buf[4]; int8_t signed8; + int16_t signed16; int32_t signed32; } u; /* Figure out immediate operand size (if any) */ - if (vie->op.op_flags & VIE_OP_F_IMM) - vie->imm_bytes = 4; - else if (vie->op.op_flags & VIE_OP_F_IMM8) + if (vie->op.op_flags & VIE_OP_F_IMM) { + /* + * Section 2.2.1.5 "Immediates", Intel SDM: + * In 64-bit mode the typical size of immediate operands + * remains 32-bits. When the operand size if 64-bits, the + * processor sign-extends all immediates to 64-bits prior + * to their use. + */ + if (vie->opsize == 4 || vie->opsize == 8) + vie->imm_bytes = 4; + else + vie->imm_bytes = 2; + } else if (vie->op.op_flags & VIE_OP_F_IMM8) { vie->imm_bytes = 1; + } if ((n = vie->imm_bytes) == 0) return (0); - if (n != 1 && n != 4) - panic("decode_immediate: invalid imm_bytes %d", n); + KASSERT(n == 1 || n == 2 || n == 4, + ("%s: invalid number of immediate bytes: %d", __func__, n)); for (i = 0; i < n; i++) { if (vie_peek(vie, &x)) @@ -1008,12 +1593,47 @@ decode_immediate(struct vie *vie) u.buf[i] = x; vie_advance(vie); } - - if (n == 1) - vie->immediate = u.signed8; /* sign-extended */ - else - vie->immediate = u.signed32; /* sign-extended */ + /* sign-extend the immediate value before use */ + if (n == 1) + vie->immediate = u.signed8; + else if (n == 2) + vie->immediate = u.signed16; + else + vie->immediate = u.signed32; + + return (0); +} + +static int +decode_moffset(struct vie *vie) +{ + int i, n; + uint8_t x; + union { + char buf[8]; + uint64_t u64; + } u; + + if ((vie->op.op_flags & VIE_OP_F_MOFFSET) == 0) + return (0); + + /* + * Section 2.2.1.4, "Direct Memory-Offset MOVs", Intel SDM: + * The memory offset size follows the address-size of the instruction. + */ + n = vie->addrsize; + KASSERT(n == 2 || n == 4 || n == 8, ("invalid moffset bytes: %d", n)); + + u.u64 = 0; + for (i = 0; i < n; i++) { + if (vie_peek(vie, &x)) + return (-1); + + u.buf[i] = x; + vie_advance(vie); + } + vie->displacement = u.u64; return (0); } @@ -1038,7 +1658,7 @@ static int verify_gla(struct vm *vm, int cpuid, uint64_t gla, struct vie *vie) { int error; - uint64_t base, idx; + uint64_t base, idx, gla2; /* Skip 'gla' verification */ if (gla == VIE_INVALID_GLA) @@ -1071,11 +1691,14 @@ verify_gla(struct vm *vm, int cpuid, uint64_t gla, struct vie *vie) } } - if (base + vie->scale * idx + vie->displacement != gla) { + /* XXX assuming that the base address of the segment is 0 */ + gla2 = base + vie->scale * idx + vie->displacement; + gla2 &= size2mask[vie->addrsize]; + if (gla != gla2) { printf("verify_gla mismatch: " "base(0x%0lx), scale(%d), index(0x%0lx), " - "disp(0x%0lx), gla(0x%0lx)\n", - base, vie->scale, idx, vie->displacement, gla); + "disp(0x%0lx), gla(0x%0lx), gla2(0x%0lx)\n", + base, vie->scale, idx, vie->displacement, gla, gla2); return (-1); } @@ -1084,13 +1707,11 @@ verify_gla(struct vm *vm, int cpuid, uint64_t gla, struct vie *vie) int vmm_decode_instruction(struct vm *vm, int cpuid, uint64_t gla, - enum vie_cpu_mode cpu_mode, struct vie *vie) + enum vm_cpu_mode cpu_mode, int cs_d, struct vie *vie) { - if (cpu_mode == CPU_MODE_64BIT) { - if (decode_rex(vie)) - return (-1); - } + if (decode_prefixes(vie, cpu_mode, cs_d)) + return (-1); if (decode_opcode(vie)) return (-1); @@ -1103,10 +1724,13 @@ vmm_decode_instruction(struct vm *vm, int cpuid, uint64_t gla, if (decode_displacement(vie)) return (-1); - + if (decode_immediate(vie)) return (-1); + if (decode_moffset(vie)) + return (-1); + if (verify_inst_length(vie)) return (-1); diff --git a/sys/amd64/vmm/vmm_ioport.c b/sys/amd64/vmm/vmm_ioport.c index eae45cc5cf8..4ce1403477f 100644 --- a/sys/amd64/vmm/vmm_ioport.c +++ b/sys/amd64/vmm/vmm_ioport.c @@ -33,11 +33,16 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include +#include +#include #include "vatpic.h" #include "vatpit.h" #include "vmm_ioport.h" +#include "vmm_ktr.h" #define MAX_IOPORTS 1280 @@ -55,31 +60,63 @@ ioport_handler_func_t ioport_handler[MAX_IOPORTS] = { [IO_ELCR2] = vatpic_elc_handler, }; -int -emulate_ioport(struct vm *vm, int vcpuid, struct vm_exit *vmexit) +#ifdef KTR +static const char * +inout_instruction(struct vm_exit *vmexit) +{ + int index; + + static const char *iodesc[] = { + "outb", "outw", "outl", + "inb", "inw", "inl", + "outsb", "outsw", "outsd" + "insb", "insw", "insd", + }; + + switch (vmexit->u.inout.bytes) { + case 1: + index = 0; + break; + case 2: + index = 1; + break; + default: + index = 2; + break; + } + + if (vmexit->u.inout.in) + index += 3; + + if (vmexit->u.inout.string) + index += 6; + + KASSERT(index < nitems(iodesc), ("%s: invalid index %d", + __func__, index)); + + return (iodesc[index]); +} +#endif /* KTR */ + +static int +emulate_inout_port(struct vm *vm, int vcpuid, struct vm_exit *vmexit, + bool *retu) { ioport_handler_func_t handler; uint32_t mask, val; int error; + error = 0; + *retu = true; + if (vmexit->u.inout.port >= MAX_IOPORTS) - return (-1); + goto done; handler = ioport_handler[vmexit->u.inout.port]; if (handler == NULL) - return (-1); + goto done; - switch (vmexit->u.inout.bytes) { - case 1: - mask = 0xff; - break; - case 2: - mask = 0xffff; - break; - default: - mask = 0xffffffff; - break; - } + mask = vie_size2mask(vmexit->u.inout.bytes); if (!vmexit->u.inout.in) { val = vmexit->u.inout.eax & mask; @@ -88,10 +125,47 @@ emulate_ioport(struct vm *vm, int vcpuid, struct vm_exit *vmexit) error = (*handler)(vm, vcpuid, vmexit->u.inout.in, vmexit->u.inout.port, vmexit->u.inout.bytes, &val); - if (!error && vmexit->u.inout.in) { - vmexit->u.inout.eax &= ~mask; - vmexit->u.inout.eax |= val & mask; + if (!error) { + *retu = false; + if (vmexit->u.inout.in) { + vmexit->u.inout.eax &= ~mask; + vmexit->u.inout.eax |= val & mask; + error = vm_set_register(vm, vcpuid, + VM_REG_GUEST_RAX, vmexit->u.inout.eax); + KASSERT(error == 0, ("emulate_ioport: error %d " + "setting guest rax register", error)); + } } +done: + return (error); +} + +static int +emulate_inout_str(struct vm *vm, int vcpuid, struct vm_exit *vmexit, bool *retu) +{ + *retu = true; + return (0); /* Return to userspace to finish emulation */ +} + +int +vm_handle_inout(struct vm *vm, int vcpuid, struct vm_exit *vmexit, bool *retu) +{ + int bytes, error; + + bytes = vmexit->u.inout.bytes; + KASSERT(bytes == 1 || bytes == 2 || bytes == 4, + ("vm_handle_inout: invalid operand size %d", bytes)); + + if (vmexit->u.inout.string) + error = emulate_inout_str(vm, vcpuid, vmexit, retu); + else + error = emulate_inout_port(vm, vcpuid, vmexit, retu); + + VCPU_CTR4(vm, vcpuid, "%s%s 0x%04x: %s", + vmexit->u.inout.rep ? "rep " : "", + inout_instruction(vmexit), + vmexit->u.inout.port, + error ? "error" : (*retu ? "userspace" : "handled")); return (error); } diff --git a/sys/amd64/vmm/vmm_ioport.h b/sys/amd64/vmm/vmm_ioport.h index 02e543a913d..84a4cf1754b 100644 --- a/sys/amd64/vmm/vmm_ioport.h +++ b/sys/amd64/vmm/vmm_ioport.h @@ -32,6 +32,6 @@ typedef int (*ioport_handler_func_t)(void *vm, int vcpuid, bool in, int port, int bytes, uint32_t *val); -int emulate_ioport(struct vm *vm, int vcpuid, struct vm_exit *vmexit); +int vm_handle_inout(struct vm *vm, int vcpuid, struct vm_exit *vme, bool *retu); #endif /* _VMM_IOPORT_H_ */ diff --git a/sys/amd64/vmm/vmm_ktr.h b/sys/amd64/vmm/vmm_ktr.h index 9fb46d80beb..61ff53f47fe 100644 --- a/sys/amd64/vmm/vmm_ktr.h +++ b/sys/amd64/vmm/vmm_ktr.h @@ -48,6 +48,10 @@ CTR4(KTR_VMM, "vm %s[%d]: " format, vm_name((vm)), (vcpuid), (p1), (p2)) #define VCPU_CTR3(vm, vcpuid, format, p1, p2, p3) \ CTR5(KTR_VMM, "vm %s[%d]: " format, vm_name((vm)), (vcpuid), (p1), (p2), (p3)) +#define VCPU_CTR4(vm, vcpuid, format, p1, p2, p3, p4) \ +CTR6(KTR_VMM, "vm %s[%d]: " format, vm_name((vm)), (vcpuid), \ + (p1), (p2), (p3), (p4)) + #define VM_CTR0(vm, format) \ CTR1(KTR_VMM, "vm %s: " format, vm_name((vm))) diff --git a/sys/amd64/vmm/vmm_stat.c b/sys/amd64/vmm/vmm_stat.c index e3d699923c0..9ecf9afd8a8 100644 --- a/sys/amd64/vmm/vmm_stat.c +++ b/sys/amd64/vmm/vmm_stat.c @@ -52,8 +52,10 @@ static struct vmm_stat_type *vsttab[MAX_VMM_STAT_ELEMS]; static MALLOC_DEFINE(M_VMM_STAT, "vmm stat", "vmm stat"); +#define vst_size ((size_t)vst_num_elems * sizeof(uint64_t)) + void -vmm_stat_init(void *arg) +vmm_stat_register(void *arg) { struct vmm_stat_type *vst = arg; @@ -81,12 +83,21 @@ vmm_stat_init(void *arg) int vmm_stat_copy(struct vm *vm, int vcpu, int *num_stats, uint64_t *buf) { - int i; + struct vmm_stat_type *vst; uint64_t *stats; + int i; if (vcpu < 0 || vcpu >= VM_MAXCPU) return (EINVAL); - + + /* Let stats functions update their counters */ + for (i = 0; i < vst_num_types; i++) { + vst = vsttab[i]; + if (vst->func != NULL) + (*vst->func)(vm, vcpu, vst); + } + + /* Copy over the stats */ stats = vcpu_stats(vm, vcpu); for (i = 0; i < vst_num_elems; i++) buf[i] = stats[i]; @@ -97,11 +108,15 @@ vmm_stat_copy(struct vm *vm, int vcpu, int *num_stats, uint64_t *buf) void * vmm_stat_alloc(void) { - u_long size; - - size = vst_num_elems * sizeof(uint64_t); - return (malloc(size, M_VMM_STAT, M_ZERO | M_WAITOK)); + return (malloc(vst_size, M_VMM_STAT, M_WAITOK)); +} + +void +vmm_stat_init(void *vp) +{ + + bzero(vp, vst_size); } void diff --git a/sys/amd64/vmm/vmm_stat.h b/sys/amd64/vmm/vmm_stat.h index 9110c8f0f0e..1640ba37e02 100644 --- a/sys/amd64/vmm/vmm_stat.h +++ b/sys/amd64/vmm/vmm_stat.h @@ -42,20 +42,28 @@ enum vmm_stat_scope { VMM_STAT_SCOPE_AMD, /* AMD SVM specific statistic */ }; +struct vmm_stat_type; +typedef void (*vmm_stat_func_t)(struct vm *vm, int vcpu, + struct vmm_stat_type *stat); + struct vmm_stat_type { int index; /* position in the stats buffer */ int nelems; /* standalone or array */ const char *desc; /* description of statistic */ + vmm_stat_func_t func; enum vmm_stat_scope scope; }; -void vmm_stat_init(void *arg); +void vmm_stat_register(void *arg); -#define VMM_STAT_DEFINE(type, nelems, desc, scope) \ +#define VMM_STAT_FDEFINE(type, nelems, desc, func, scope) \ struct vmm_stat_type type[1] = { \ - { -1, nelems, desc, scope } \ + { -1, nelems, desc, func, scope } \ }; \ - SYSINIT(type##_stat, SI_SUB_KLD, SI_ORDER_ANY, vmm_stat_init, type) + SYSINIT(type##_stat, SI_SUB_KLD, SI_ORDER_ANY, vmm_stat_register, type) + +#define VMM_STAT_DEFINE(type, nelems, desc, scope) \ + VMM_STAT_FDEFINE(type, nelems, desc, NULL, scope) #define VMM_STAT_DECLARE(type) \ extern struct vmm_stat_type type[1] @@ -67,10 +75,14 @@ void vmm_stat_init(void *arg); #define VMM_STAT_AMD(type, desc) \ VMM_STAT_DEFINE(type, 1, desc, VMM_STAT_SCOPE_AMD) +#define VMM_STAT_FUNC(type, desc, func) \ + VMM_STAT_FDEFINE(type, 1, desc, func, VMM_STAT_SCOPE_ANY) + #define VMM_STAT_ARRAY(type, nelems, desc) \ VMM_STAT_DEFINE(type, nelems, desc, VMM_STAT_SCOPE_ANY) void *vmm_stat_alloc(void); +void vmm_stat_init(void *vp); void vmm_stat_free(void *vp); /* @@ -92,8 +104,21 @@ vmm_stat_array_incr(struct vm *vm, int vcpu, struct vmm_stat_type *vst, stats[vst->index + statidx] += x; #endif } - +static void __inline +vmm_stat_array_set(struct vm *vm, int vcpu, struct vmm_stat_type *vst, + int statidx, uint64_t val) +{ +#ifdef VMM_KEEP_STATS + uint64_t *stats; + + stats = vcpu_stats(vm, vcpu); + + if (vst->index >= 0 && statidx < vst->nelems) + stats[vst->index + statidx] = val; +#endif +} + static void __inline vmm_stat_incr(struct vm *vm, int vcpu, struct vmm_stat_type *vst, uint64_t x) { @@ -103,6 +128,15 @@ vmm_stat_incr(struct vm *vm, int vcpu, struct vmm_stat_type *vst, uint64_t x) #endif } +static void __inline +vmm_stat_set(struct vm *vm, int vcpu, struct vmm_stat_type *vst, uint64_t val) +{ + +#ifdef VMM_KEEP_STATS + vmm_stat_array_set(vm, vcpu, vst, 0, val); +#endif +} + VMM_STAT_DECLARE(VCPU_MIGRATIONS); VMM_STAT_DECLARE(VMEXIT_COUNT); VMM_STAT_DECLARE(VMEXIT_EXTINT); diff --git a/sys/amd64/vmm/x86.c b/sys/amd64/vmm/x86.c index 3e7a4be2813..ef1557f8552 100644 --- a/sys/amd64/vmm/x86.c +++ b/sys/amd64/vmm/x86.c @@ -241,6 +241,26 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, /* leaf 0 */ if (*ecx == 0) { + cpuid_count(*eax, *ecx, regs); + + /* Only leaf 0 is supported */ + regs[0] = 0; + + /* + * Expose known-safe features. + */ + regs[1] &= (CPUID_STDEXT_FSGSBASE | + CPUID_STDEXT_BMI1 | CPUID_STDEXT_HLE | + CPUID_STDEXT_AVX2 | CPUID_STDEXT_BMI2 | + CPUID_STDEXT_ERMS | CPUID_STDEXT_RTM | + CPUID_STDEXT_AVX512F | + CPUID_STDEXT_AVX512PF | + CPUID_STDEXT_AVX512ER | + CPUID_STDEXT_AVX512CD); + regs[2] = 0; + regs[3] = 0; + + /* Advertise INVPCID if it is enabled. */ error = vm_get_capability(vm, vcpu_id, VM_CAP_ENABLE_INVPCID, &enable_invpcid); if (error == 0 && enable_invpcid) diff --git a/sys/arm/allwinner/a10_machdep.c b/sys/arm/allwinner/a10_machdep.c index c0a6ac86ab4..718ced77dba 100644 --- a/sys/arm/allwinner/a10_machdep.c +++ b/sys/arm/allwinner/a10_machdep.c @@ -45,30 +45,31 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include vm_offset_t -initarm_lastaddr(void) +platform_lastaddr(void) { return (arm_devmap_lastaddr()); } void -initarm_early_init(void) +platform_probe_and_attach(void) { } void -initarm_gpio_init(void) +platform_gpio_init(void) { } void -initarm_late_init(void) +platform_late_init(void) { } @@ -83,7 +84,7 @@ initarm_late_init(void) * perhaps a 1MB block would be more appropriate. */ int -initarm_devmap_init(void) +platform_devmap_init(void) { arm_devmap_add_entry(0x01C00000, 0x00400000); /* 4MB */ diff --git a/sys/arm/arm/bus_space_generic.c b/sys/arm/arm/bus_space_generic.c index 8d272c40602..35052ecf990 100644 --- a/sys/arm/arm/bus_space_generic.c +++ b/sys/arm/arm/bus_space_generic.c @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include /* Prototypes for all the bus_space structure functions */ @@ -110,5 +111,16 @@ generic_bs_barrier(void *t, bus_space_handle_t bsh, bus_size_t offset, bus_size_t len, int flags) { - /* Nothing to do. */ + /* + * dsb() will drain the L1 write buffer and establish a memory access + * barrier point on platforms where that has meaning. On a write we + * also need to drain the L2 write buffer, because most on-chip memory + * mapped devices are downstream of the L2 cache. Note that this needs + * to be done even for memory mapped as Device type, because while + * Device memory is not cached, writes to it are still buffered. + */ + dsb(); + if (flags & BUS_SPACE_BARRIER_WRITE) { + cpu_l2cache_drain_writebuf(); + } } diff --git a/sys/arm/arm/busdma_machdep-v6.c b/sys/arm/arm/busdma_machdep-v6.c index 6cbcae439c5..e868d9c1594 100644 --- a/sys/arm/arm/busdma_machdep-v6.c +++ b/sys/arm/arm/busdma_machdep-v6.c @@ -64,7 +64,10 @@ __FBSDID("$FreeBSD$"); #include #define MAX_BPAGES 64 -#define BUS_DMA_COULD_BOUNCE BUS_DMA_BUS3 +#define MAX_DMA_SEGMENTS 4096 +#define BUS_DMA_EXCL_BOUNCE BUS_DMA_BUS2 +#define BUS_DMA_ALIGN_BOUNCE BUS_DMA_BUS3 +#define BUS_DMA_COULD_BOUNCE (BUS_DMA_EXCL_BOUNCE | BUS_DMA_ALIGN_BOUNCE) #define BUS_DMA_MIN_ALLOC_COMP BUS_DMA_BUS4 struct bounce_zone; @@ -94,15 +97,6 @@ struct bus_dma_tag { */ struct arm32_dma_range *ranges; int _nranges; - /* - * Most tags need one or two segments, and can use the local tagsegs - * array. For tags with a larger limit, we'll allocate a bigger array - * on first use. - */ - bus_dma_segment_t *segments; - bus_dma_segment_t tagsegs[2]; - - }; struct bounce_page { @@ -143,9 +137,40 @@ struct bounce_zone { static struct mtx bounce_lock; static int total_bpages; static int busdma_zonecount; +static uint32_t tags_total; +static uint32_t maps_total; +static uint32_t maps_dmamem; +static uint32_t maps_coherent; +static uint64_t maploads_total; +static uint64_t maploads_bounced; +static uint64_t maploads_coherent; +static uint64_t maploads_dmamem; +static uint64_t maploads_mbuf; +static uint64_t maploads_physmem; + static STAILQ_HEAD(, bounce_zone) bounce_zone_list; SYSCTL_NODE(_hw, OID_AUTO, busdma, CTLFLAG_RD, 0, "Busdma parameters"); +SYSCTL_UINT(_hw_busdma, OID_AUTO, tags_total, CTLFLAG_RD, &tags_total, 0, + "Number of active tags"); +SYSCTL_UINT(_hw_busdma, OID_AUTO, maps_total, CTLFLAG_RD, &maps_total, 0, + "Number of active maps"); +SYSCTL_UINT(_hw_busdma, OID_AUTO, maps_dmamem, CTLFLAG_RD, &maps_dmamem, 0, + "Number of active maps for bus_dmamem_alloc buffers"); +SYSCTL_UINT(_hw_busdma, OID_AUTO, maps_coherent, CTLFLAG_RD, &maps_coherent, 0, + "Number of active maps with BUS_DMA_COHERENT flag set"); +SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_total, CTLFLAG_RD, &maploads_total, 0, + "Number of load operations performed"); +SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_bounced, CTLFLAG_RD, &maploads_bounced, 0, + "Number of load operations that used bounce buffers"); +SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_coherent, CTLFLAG_RD, &maploads_dmamem, 0, + "Number of load operations on BUS_DMA_COHERENT memory"); +SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_dmamem, CTLFLAG_RD, &maploads_dmamem, 0, + "Number of load operations on bus_dmamem_alloc buffers"); +SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_mbuf, CTLFLAG_RD, &maploads_mbuf, 0, + "Number of load operations for mbufs"); +SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_physmem, CTLFLAG_RD, &maploads_physmem, 0, + "Number of load operations on physical buffers"); SYSCTL_INT(_hw_busdma, OID_AUTO, total_bpages, CTLFLAG_RD, &total_bpages, 0, "Total bounce pages"); @@ -160,7 +185,10 @@ struct bus_dmamap { void *callback_arg; int flags; #define DMAMAP_COHERENT (1 << 0) +#define DMAMAP_DMAMEM_ALLOC (1 << 1) +#define DMAMAP_MBUF (1 << 2) STAILQ_ENTRY(bus_dmamap) links; + bus_dma_segment_t *segments; int sync_count; struct sync_list slist[]; }; @@ -177,7 +205,6 @@ static bus_addr_t add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, vm_offset_t vaddr, bus_addr_t addr, bus_size_t size); static void free_bounce_page(bus_dma_tag_t dmat, struct bounce_page *bpage); -int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr, bus_size_t size, int coherent); static void _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, bus_size_t buflen, int flags); static void _bus_dmamap_count_phys(bus_dma_tag_t dmat, bus_dmamap_t map, @@ -224,24 +251,142 @@ busdma_init(void *dummy) /* * This init historically used SI_SUB_VM, but now the init code requires * malloc(9) using M_DEVBUF memory, which is set up later than SI_SUB_VM, by - * SI_SUB_KMEM and SI_ORDER_SECOND, so we'll go right after that by using - * SI_SUB_KMEM and SI_ORDER_THIRD. + * SI_SUB_KMEM and SI_ORDER_THIRD, so we'll go right after that by using + * SI_SUB_KMEM and SI_ORDER_FOURTH. */ -SYSINIT(busdma, SI_SUB_KMEM, SI_ORDER_THIRD, busdma_init, NULL); +SYSINIT(busdma, SI_SUB_KMEM, SI_ORDER_FOURTH, busdma_init, NULL); -static __inline int -_bus_dma_can_bounce(vm_offset_t lowaddr, vm_offset_t highaddr) +/* + * This routine checks the exclusion zone constraints from a tag against the + * physical RAM available on the machine. If a tag specifies an exclusion zone + * but there's no RAM in that zone, then we avoid allocating resources to bounce + * a request, and we can use any memory allocator (as opposed to needing + * kmem_alloc_contig() just because it can allocate pages in an address range). + * + * Most tags have BUS_SPACE_MAXADDR or BUS_SPACE_MAXADDR_32BIT (they are the + * same value on 32-bit architectures) as their lowaddr constraint, and we can't + * possibly have RAM at an address higher than the highest address we can + * express, so we take a fast out. + */ +static int +exclusion_bounce_check(vm_offset_t lowaddr, vm_offset_t highaddr) { int i; + + if (lowaddr >= BUS_SPACE_MAXADDR) + return (0); + for (i = 0; phys_avail[i] && phys_avail[i + 1]; i += 2) { - if ((lowaddr >= phys_avail[i] && lowaddr <= phys_avail[i + 1]) - || (lowaddr < phys_avail[i] && - highaddr > phys_avail[i])) + if ((lowaddr >= phys_avail[i] && lowaddr < phys_avail[i + 1]) || + (lowaddr < phys_avail[i] && highaddr >= phys_avail[i])) return (1); } return (0); } +/* + * Return true if the tag has an exclusion zone that could lead to bouncing. + */ +static __inline int +exclusion_bounce(bus_dma_tag_t dmat) +{ + + return (dmat->flags & BUS_DMA_EXCL_BOUNCE); +} + +/* + * Return true if the given address does not fall on the alignment boundary. + */ +static __inline int +alignment_bounce(bus_dma_tag_t dmat, bus_addr_t addr) +{ + + return (addr & (dmat->alignment - 1)); +} + +/* + * Return true if the DMA should bounce because the start or end does not fall + * on a cacheline boundary (which would require a partial cacheline flush). + * COHERENT memory doesn't trigger cacheline flushes. Memory allocated by + * bus_dmamem_alloc() is always aligned to cacheline boundaries, and there's a + * strict rule that such memory cannot be accessed by the CPU while DMA is in + * progress (or by multiple DMA engines at once), so that it's always safe to do + * full cacheline flushes even if that affects memory outside the range of a + * given DMA operation that doesn't involve the full allocated buffer. If we're + * mapping an mbuf, that follows the same rules as a buffer we allocated. + */ +static __inline int +cacheline_bounce(bus_dmamap_t map, bus_addr_t addr, bus_size_t size) +{ + + if (map->flags & (DMAMAP_DMAMEM_ALLOC | DMAMAP_COHERENT | DMAMAP_MBUF)) + return (0); + return ((addr | size) & arm_dcache_align_mask); +} + +/* + * Return true if we might need to bounce the DMA described by addr and size. + * + * This is used to quick-check whether we need to do the more expensive work of + * checking the DMA page-by-page looking for alignment and exclusion bounces. + * + * Note that the addr argument might be either virtual or physical. It doesn't + * matter because we only look at the low-order bits, which are the same in both + * address spaces. + */ +static __inline int +might_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t addr, + bus_size_t size) +{ + return ((dmat->flags & BUS_DMA_EXCL_BOUNCE) || + alignment_bounce(dmat, addr) || + cacheline_bounce(map, addr, size)); +} + +/* + * Return true if we must bounce the DMA described by paddr and size. + * + * Bouncing can be triggered by DMA that doesn't begin and end on cacheline + * boundaries, or doesn't begin on an alignment boundary, or falls within the + * exclusion zone of any tag in the ancestry chain. + * + * For exclusions, walk the chain of tags comparing paddr to the exclusion zone + * within each tag. If the tag has a filter function, use it to decide whether + * the DMA needs to bounce, otherwise any DMA within the zone bounces. + */ +static int +must_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t paddr, + bus_size_t size) +{ + + if (cacheline_bounce(map, paddr, size)) + return (1); + + /* + * The tag already contains ancestors' alignment restrictions so this + * check doesn't need to be inside the loop. + */ + if (alignment_bounce(dmat, paddr)) + return (1); + + /* + * Even though each tag has an exclusion zone that is a superset of its + * own and all its ancestors' exclusions, the exclusion zone of each tag + * up the chain must be checked within the loop, because the busdma + * rules say the filter function is called only when the address lies + * within the low-highaddr range of the tag that filterfunc belongs to. + */ + while (dmat != NULL && exclusion_bounce(dmat)) { + if ((paddr >= dmat->lowaddr && paddr <= dmat->highaddr) && + (dmat->filter == NULL || + dmat->filter(dmat->filterarg, paddr) != 0)) + return (1); + dmat = dmat->parent; + } + + return (0); +} + static __inline struct arm32_dma_range * _bus_dma_inrange(struct arm32_dma_range *ranges, int nranges, bus_addr_t curaddr) @@ -258,35 +403,6 @@ _bus_dma_inrange(struct arm32_dma_range *ranges, int nranges, return (NULL); } -/* - * Return true if a match is made. - * - * To find a match walk the chain of bus_dma_tag_t's looking for 'paddr'. - * - * If paddr is within the bounds of the dma tag then call the filter callback - * to check for a match, if there is no filter callback then assume a match. - */ -int -run_filter(bus_dma_tag_t dmat, bus_addr_t paddr, bus_size_t size, int coherent) -{ - int retval; - - retval = 0; - - do { - if (((paddr > dmat->lowaddr && paddr <= dmat->highaddr) - || ((paddr & (dmat->alignment - 1)) != 0) || - (!coherent && (size & arm_dcache_align_mask)) || - (!coherent && (paddr & arm_dcache_align_mask))) - && (dmat->filter == NULL - || (*dmat->filter)(dmat->filterarg, paddr) != 0)) - retval = 1; - - dmat = dmat->parent; - } while (retval == 0 && dmat != NULL); - return (retval); -} - /* * Convenience function for manipulating driver locks from busdma (during * busdma_swi, for example). Drivers that don't provide their own locks @@ -384,34 +500,21 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, newtag->lockfunc = dflt_lock; newtag->lockfuncarg = NULL; } - /* - * If all the segments we need fit into the local tagsegs array, set the - * pointer now. Otherwise NULL the pointer and an array of segments - * will be allocated later, on first use. We don't pre-allocate now - * because some tags exist just to pass contraints to children in the - * device hierarchy, and they tend to use BUS_SPACE_UNRESTRICTED and we - * sure don't want to try to allocate an array for that. - */ - if (newtag->nsegments <= nitems(newtag->tagsegs)) - newtag->segments = newtag->tagsegs; - else - newtag->segments = NULL; /* Take into account any restrictions imposed by our parent tag */ if (parent != NULL) { newtag->lowaddr = MIN(parent->lowaddr, newtag->lowaddr); newtag->highaddr = MAX(parent->highaddr, newtag->highaddr); + newtag->alignment = MAX(parent->alignment, newtag->alignment); + newtag->flags |= parent->flags & BUS_DMA_COULD_BOUNCE; if (newtag->boundary == 0) newtag->boundary = parent->boundary; else if (parent->boundary != 0) newtag->boundary = MIN(parent->boundary, newtag->boundary); - if ((newtag->filter != NULL) || - ((parent->flags & BUS_DMA_COULD_BOUNCE) != 0)) - newtag->flags |= BUS_DMA_COULD_BOUNCE; if (newtag->filter == NULL) { /* - * Short circuit looking at our parent directly + * Short circuit to looking at our parent directly * since we have encapsulated all of its information */ newtag->filter = parent->filter; @@ -422,9 +525,10 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, atomic_add_int(&parent->ref_count, 1); } - if (_bus_dma_can_bounce(newtag->lowaddr, newtag->highaddr) - || newtag->alignment > 1) - newtag->flags |= BUS_DMA_COULD_BOUNCE; + if (exclusion_bounce_check(newtag->lowaddr, newtag->highaddr)) + newtag->flags |= BUS_DMA_EXCL_BOUNCE; + if (alignment_bounce(newtag, 1)) + newtag->flags |= BUS_DMA_ALIGN_BOUNCE; /* * Any request can auto-bounce due to cacheline alignment, in addition @@ -463,6 +567,7 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, if (error != 0) { free(newtag, M_DEVBUF); } else { + atomic_add_32(&tags_total, 1); *dmat = newtag; } CTR4(KTR_BUSDMA, "%s returned tag %p tag flags 0x%x error %d", @@ -492,9 +597,7 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat) parent = dmat->parent; atomic_subtract_int(&dmat->ref_count, 1); if (dmat->ref_count == 0) { - if (dmat->segments != NULL && - dmat->segments != dmat->tagsegs) - free(dmat->segments, M_DEVBUF); + atomic_subtract_32(&tags_total, 1); free(dmat, M_DEVBUF); /* * Last reference count, so @@ -534,8 +637,8 @@ static int allocate_bz_and_pages(bus_dma_tag_t dmat, bus_dmamap_t mapp) maxpages = MAX_BPAGES; else maxpages = 2 * bz->map_count; - if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0 - || (bz->map_count > 0 && bz->total_bpages < maxpages)) { + if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0 || + (bz->map_count > 0 && bz->total_bpages < maxpages)) { int pages; pages = atop(roundup2(dmat->maxsize, PAGE_SIZE)) + 1; @@ -551,6 +654,31 @@ static int allocate_bz_and_pages(bus_dma_tag_t dmat, bus_dmamap_t mapp) return (0); } +static bus_dmamap_t +allocate_map(bus_dma_tag_t dmat, int mflags) +{ + int mapsize, segsize; + bus_dmamap_t map; + + /* + * Allocate the map. The map structure ends with an embedded + * variable-sized array of sync_list structures. Following that + * we allocate enough extra space to hold the array of bus_dma_segments. + */ + KASSERT(dmat->nsegments <= MAX_DMA_SEGMENTS, + ("cannot allocate %u dma segments (max is %u)", + dmat->nsegments, MAX_DMA_SEGMENTS)); + segsize = sizeof(struct bus_dma_segment) * dmat->nsegments; + mapsize = sizeof(*map) + sizeof(struct sync_list) * dmat->nsegments; + map = malloc(mapsize + segsize, M_DEVBUF, mflags | M_ZERO); + if (map == NULL) { + CTR3(KTR_BUSDMA, "%s: tag %p error %d", __func__, dmat, ENOMEM); + return (NULL); + } + map->segments = (bus_dma_segment_t *)((uintptr_t)map + mapsize); + return (map); +} + /* * Allocate a handle for mapping from kva/uva/physical * address space into bus device space. @@ -558,41 +686,32 @@ static int allocate_bz_and_pages(bus_dma_tag_t dmat, bus_dmamap_t mapp) int bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) { - int mapsize; + bus_dmamap_t map; int error = 0; - mapsize = sizeof(**mapp) + (sizeof(struct sync_list) * dmat->nsegments); - *mapp = (bus_dmamap_t)malloc(mapsize, M_DEVBUF, M_NOWAIT | M_ZERO); - if (*mapp == NULL) { + *mapp = map = allocate_map(dmat, M_NOWAIT); + if (map == NULL) { CTR3(KTR_BUSDMA, "%s: tag %p error %d", __func__, dmat, ENOMEM); return (ENOMEM); } - (*mapp)->sync_count = 0; - if (dmat->segments == NULL) { - dmat->segments = (bus_dma_segment_t *)malloc( - sizeof(bus_dma_segment_t) * dmat->nsegments, M_DEVBUF, - M_NOWAIT); - if (dmat->segments == NULL) { - CTR3(KTR_BUSDMA, "%s: tag %p error %d", - __func__, dmat, ENOMEM); - free(*mapp, M_DEVBUF); - *mapp = NULL; - return (ENOMEM); - } - } /* - * Bouncing might be required if the driver asks for an active - * exclusion region, a data alignment that is stricter than 1, and/or - * an active address boundary. + * Bouncing might be required if the driver asks for an exclusion + * region, a data alignment that is stricter than 1, or DMA that begins + * or ends with a partial cacheline. Whether bouncing will actually + * happen can't be known until mapping time, but we need to pre-allocate + * resources now because we might not be allowed to at mapping time. */ - error = allocate_bz_and_pages(dmat, *mapp); + error = allocate_bz_and_pages(dmat, map); if (error != 0) { - free(*mapp, M_DEVBUF); + free(map, M_DEVBUF); *mapp = NULL; return (error); } - return (error); + if (map->flags & DMAMAP_COHERENT) + atomic_add_32(&maps_coherent, 1); + atomic_add_32(&maps_total, 1); + return (0); } /* @@ -609,6 +728,9 @@ bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map) } if (dmat->bounce_zone) dmat->bounce_zone->map_count--; + if (map->flags & DMAMAP_COHERENT) + atomic_subtract_32(&maps_coherent, 1); + atomic_subtract_32(&maps_total, 1); free(map, M_DEVBUF); dmat->map_count--; CTR2(KTR_BUSDMA, "%s: tag %p error 0", __func__, dmat); @@ -627,58 +749,33 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, { busdma_bufalloc_t ba; struct busdma_bufzone *bufzone; + bus_dmamap_t map; vm_memattr_t memattr; int mflags; - int mapsize; - int error; if (flags & BUS_DMA_NOWAIT) mflags = M_NOWAIT; else mflags = M_WAITOK; + if (flags & BUS_DMA_ZERO) + mflags |= M_ZERO; - /* ARM non-snooping caches need a map for the VA cache sync structure */ - - mapsize = sizeof(**mapp) + (sizeof(struct sync_list) * dmat->nsegments); - *mapp = (bus_dmamap_t)malloc(mapsize, M_DEVBUF, M_NOWAIT | M_ZERO); - if (*mapp == NULL) { + *mapp = map = allocate_map(dmat, mflags); + if (map == NULL) { CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", __func__, dmat, dmat->flags, ENOMEM); return (ENOMEM); } + map->flags = DMAMAP_DMAMEM_ALLOC; - (*mapp)->sync_count = 0; - /* We may need bounce pages, even for allocated memory */ - error = allocate_bz_and_pages(dmat, *mapp); - if (error != 0) { - free(*mapp, M_DEVBUF); - *mapp = NULL; - return (error); - } - - if (dmat->segments == NULL) { - dmat->segments = (bus_dma_segment_t *)malloc( - sizeof(bus_dma_segment_t) * dmat->nsegments, M_DEVBUF, - mflags); - if (dmat->segments == NULL) { - CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", - __func__, dmat, dmat->flags, ENOMEM); - free(*mapp, M_DEVBUF); - *mapp = NULL; - return (ENOMEM); - } - } - - if (flags & BUS_DMA_ZERO) - mflags |= M_ZERO; + /* Choose a busdma buffer allocator based on memory type flags. */ if (flags & BUS_DMA_COHERENT) { memattr = VM_MEMATTR_UNCACHEABLE; ba = coherent_allocator; - (*mapp)->flags |= DMAMAP_COHERENT; + map->flags |= DMAMAP_COHERENT; } else { memattr = VM_MEMATTR_DEFAULT; ba = standard_allocator; - (*mapp)->flags = 0; } /* @@ -702,7 +799,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, * constraints is something that only the contig allocator can fulfill. */ if (bufzone != NULL && dmat->alignment <= bufzone->size && - !_bus_dma_can_bounce(dmat->lowaddr, dmat->highaddr)) { + !exclusion_bounce(dmat)) { *vaddr = uma_zalloc(bufzone->umazone, mflags); } else if (dmat->nsegments >= btoc(dmat->maxsize) && dmat->alignment <= PAGE_SIZE && dmat->boundary == 0) { @@ -718,12 +815,14 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, if (*vaddr == NULL) { CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", __func__, dmat, dmat->flags, ENOMEM); - free(*mapp, M_DEVBUF); + free(map, M_DEVBUF); *mapp = NULL; return (ENOMEM); - } else if ((uintptr_t)*vaddr & (dmat->alignment - 1)) { - printf("bus_dmamem_alloc failed to align memory properly.\n"); } + if (map->flags & DMAMAP_COHERENT) + atomic_add_32(&maps_coherent, 1); + atomic_add_32(&maps_dmamem, 1); + atomic_add_32(&maps_total, 1); dmat->map_count++; CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", @@ -751,12 +850,16 @@ bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) bufzone = busdma_bufalloc_findzone(ba, dmat->maxsize); if (bufzone != NULL && dmat->alignment <= bufzone->size && - !_bus_dma_can_bounce(dmat->lowaddr, dmat->highaddr)) + !exclusion_bounce(dmat)) uma_zfree(bufzone->umazone, vaddr); else kmem_free(kernel_arena, (vm_offset_t)vaddr, dmat->maxsize); dmat->map_count--; + if (map->flags & DMAMAP_COHERENT) + atomic_subtract_32(&maps_coherent, 1); + atomic_subtract_32(&maps_total, 1); + atomic_subtract_32(&maps_dmamem, 1); free(map, M_DEVBUF); CTR3(KTR_BUSDMA, "%s: tag %p flags 0x%x", __func__, dmat, dmat->flags); } @@ -780,8 +883,7 @@ _bus_dmamap_count_phys(bus_dma_tag_t dmat, bus_dmamap_t map, vm_paddr_t buf, curaddr = buf; while (buflen != 0) { sgsize = MIN(buflen, dmat->maxsegsz); - if (run_filter(dmat, curaddr, sgsize, - map->flags & DMAMAP_COHERENT) != 0) { + if (must_bounce(dmat, map, curaddr, sgsize) != 0) { sgsize = MIN(sgsize, PAGE_SIZE); map->pagesneeded++; } @@ -817,10 +919,9 @@ _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, paddr = pmap_kextract(vaddr); else paddr = pmap_extract(map->pmap, vaddr); - if (run_filter(dmat, paddr, - min(vendaddr - vaddr, - (PAGE_SIZE - ((vm_offset_t)vaddr & PAGE_MASK))), - map->flags & DMAMAP_COHERENT) != 0) { + if (must_bounce(dmat, map, paddr, + min(vendaddr - vaddr, (PAGE_SIZE - ((vm_offset_t)vaddr & + PAGE_MASK)))) != 0) { map->pagesneeded++; } vaddr += (PAGE_SIZE - ((vm_offset_t)vaddr & PAGE_MASK)); @@ -934,12 +1035,15 @@ _bus_dmamap_load_phys(bus_dma_tag_t dmat, int error; if (segs == NULL) - segs = dmat->segments; + segs = map->segments; - if (((map->flags & DMAMAP_COHERENT) == 0) || - (dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) { + maploads_total++; + maploads_physmem++; + + if (might_bounce(dmat, map, buflen, buflen)) { _bus_dmamap_count_phys(dmat, map, buf, buflen, flags); if (map->pagesneeded != 0) { + maploads_bounced++; error = _bus_dmamap_reserve_pages(dmat, map, flags); if (error) return (error); @@ -949,10 +1053,8 @@ _bus_dmamap_load_phys(bus_dma_tag_t dmat, while (buflen > 0) { curaddr = buf; sgsize = MIN(buflen, dmat->maxsegsz); - if ((((map->flags & DMAMAP_COHERENT) == 0) || - ((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0)) && - map->pagesneeded != 0 && run_filter(dmat, curaddr, - sgsize, map->flags & DMAMAP_COHERENT)) { + if (map->pagesneeded != 0 && must_bounce(dmat, map, curaddr, + sgsize)) { sgsize = MIN(sgsize, PAGE_SIZE); curaddr = add_bounce_page(dmat, map, 0, curaddr, sgsize); @@ -1004,15 +1106,26 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dmat, struct sync_list *sl; int error; + maploads_total++; + if (map->flags & DMAMAP_COHERENT) + maploads_coherent++; + if (map->flags & DMAMAP_DMAMEM_ALLOC) + maploads_dmamem++; + if (segs == NULL) - segs = dmat->segments; + segs = map->segments; + + if (flags & BUS_DMA_LOAD_MBUF) { + maploads_mbuf++; + map->flags |= DMAMAP_MBUF; + } map->pmap = pmap; - if (!(map->flags & DMAMAP_COHERENT) || - (dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) { + if (might_bounce(dmat, map, (bus_addr_t)buf, buflen)) { _bus_dmamap_count_pages(dmat, map, buf, buflen, flags); if (map->pagesneeded != 0) { + maploads_bounced++; error = _bus_dmamap_reserve_pages(dmat, map, flags); if (error) return (error); @@ -1040,10 +1153,8 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dmat, if (buflen < sgsize) sgsize = buflen; - if ((((map->flags & DMAMAP_COHERENT) == 0) || - ((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0)) && - map->pagesneeded != 0 && run_filter(dmat, curaddr, - sgsize, map->flags & DMAMAP_COHERENT)) { + if (map->pagesneeded != 0 && must_bounce(dmat, map, curaddr, + sgsize)) { curaddr = add_bounce_page(dmat, map, vaddr, curaddr, sgsize); } else { @@ -1100,7 +1211,7 @@ _bus_dmamap_complete(bus_dma_tag_t dmat, bus_dmamap_t map, { if (segs == NULL) - segs = dmat->segments; + segs = map->segments; return (segs); } @@ -1126,6 +1237,7 @@ _bus_dmamap_unload(bus_dma_tag_t dmat, bus_dmamap_t map) map->pagesneeded = 0; } map->sync_count = 0; + map->flags &= ~DMAMAP_MBUF; } #ifdef notyetbounceuser @@ -1204,12 +1316,12 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op) while (bpage != NULL) { if (bpage->datavaddr != 0) bcopy((void *)bpage->datavaddr, - (void *)bpage->vaddr, - bpage->datacount); + (void *)bpage->vaddr, + bpage->datacount); else physcopyout(bpage->dataaddr, - (void *)bpage->vaddr, - bpage->datacount); + (void *)bpage->vaddr, + bpage->datacount); cpu_dcache_wb_range((vm_offset_t)bpage->vaddr, bpage->datacount); l2cache_wb_range((vm_offset_t)bpage->vaddr, @@ -1251,12 +1363,12 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op) l2cache_inv_range(startv, startp, len); if (bpage->datavaddr != 0) bcopy((void *)bpage->vaddr, - (void *)bpage->datavaddr, - bpage->datacount); + (void *)bpage->datavaddr, + bpage->datacount); else physcopyin((void *)bpage->vaddr, - bpage->dataaddr, - bpage->datacount); + bpage->dataaddr, + bpage->datacount); bpage = STAILQ_NEXT(bpage, links); } dmat->bounce_zone->total_bounced++; @@ -1345,8 +1457,8 @@ alloc_bounce_zone(bus_dma_tag_t dmat) /* Check to see if we already have a suitable zone */ STAILQ_FOREACH(bz, &bounce_zone_list, links) { - if ((dmat->alignment <= bz->alignment) - && (dmat->lowaddr >= bz->lowaddr)) { + if ((dmat->alignment <= bz->alignment) && + (dmat->lowaddr >= bz->lowaddr)) { dmat->bounce_zone = bz; return (0); } @@ -1397,7 +1509,7 @@ alloc_bounce_zone(bus_dma_tag_t dmat) SYSCTL_ADD_INT(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, "total_bounced", CTLFLAG_RD, &bz->total_bounced, 0, - "Total bounce requests"); + "Total bounce requests (pages bounced)"); SYSCTL_ADD_INT(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, "total_deferred", CTLFLAG_RD, &bz->total_deferred, 0, @@ -1424,15 +1536,12 @@ alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages) struct bounce_page *bpage; bpage = (struct bounce_page *)malloc(sizeof(*bpage), M_DEVBUF, - M_NOWAIT | M_ZERO); + M_NOWAIT | M_ZERO); if (bpage == NULL) break; bpage->vaddr = (vm_offset_t)contigmalloc(PAGE_SIZE, M_DEVBUF, - M_NOWAIT, 0ul, - bz->lowaddr, - PAGE_SIZE, - 0); + M_NOWAIT, 0ul, bz->lowaddr, PAGE_SIZE, 0); if (bpage->vaddr == 0) { free(bpage, M_DEVBUF); break; @@ -1538,7 +1647,7 @@ free_bounce_page(bus_dma_tag_t dmat, struct bounce_page *bpage) if (reserve_bounce_pages(map->dmat, map, 1) == 0) { STAILQ_REMOVE_HEAD(&bounce_map_waitinglist, links); STAILQ_INSERT_TAIL(&bounce_map_callbacklist, - map, links); + map, links); busdma_swi_pending = 1; bz->total_deferred++; swi_sched(vm_ih, 0); @@ -1558,10 +1667,10 @@ busdma_swi(void) STAILQ_REMOVE_HEAD(&bounce_map_callbacklist, links); mtx_unlock(&bounce_lock); dmat = map->dmat; - (dmat->lockfunc)(dmat->lockfuncarg, BUS_DMA_LOCK); + dmat->lockfunc(dmat->lockfuncarg, BUS_DMA_LOCK); bus_dmamap_load_mem(map->dmat, map, &map->mem, map->callback, - map->callback_arg, BUS_DMA_WAITOK); - (dmat->lockfunc)(dmat->lockfuncarg, BUS_DMA_UNLOCK); + map->callback_arg, BUS_DMA_WAITOK); + dmat->lockfunc(dmat->lockfuncarg, BUS_DMA_UNLOCK); mtx_lock(&bounce_lock); } mtx_unlock(&bounce_lock); diff --git a/sys/arm/arm/busdma_machdep.c b/sys/arm/arm/busdma_machdep.c index 8ef8e03e7d8..57b58fcfa75 100644 --- a/sys/arm/arm/busdma_machdep.c +++ b/sys/arm/arm/busdma_machdep.c @@ -276,10 +276,10 @@ busdma_init(void *dummy) /* * This init historically used SI_SUB_VM, but now the init code requires * malloc(9) using M_DEVBUF memory, which is set up later than SI_SUB_VM, by - * SI_SUB_KMEM and SI_ORDER_SECOND, so we'll go right after that by using - * SI_SUB_KMEM and SI_ORDER_THIRD. + * SI_SUB_KMEM and SI_ORDER_THIRD, so we'll go right after that by using + * SI_SUB_KMEM and SI_ORDER_FOURTH. */ -SYSINIT(busdma, SI_SUB_KMEM, SI_ORDER_THIRD, busdma_init, NULL); +SYSINIT(busdma, SI_SUB_KMEM, SI_ORDER_FOURTH, busdma_init, NULL); /* * End block of code useful to transplant to other implementations. diff --git a/sys/arm/arm/cpufunc.c b/sys/arm/arm/cpufunc.c index 3d29d713a66..07090d29141 100644 --- a/sys/arm/arm/cpufunc.c +++ b/sys/arm/arm/cpufunc.c @@ -150,6 +150,7 @@ struct cpu_functions arm9_cpufuncs = { (void *)cpufunc_nullop, /* l2cache_wbinv_range */ (void *)cpufunc_nullop, /* l2cache_inv_range */ (void *)cpufunc_nullop, /* l2cache_wb_range */ + (void *)cpufunc_nullop, /* l2cache_drain_writebuf */ /* Other functions */ @@ -214,6 +215,7 @@ struct cpu_functions armv5_ec_cpufuncs = { (void *)cpufunc_nullop, /* l2cache_wbinv_range */ (void *)cpufunc_nullop, /* l2cache_inv_range */ (void *)cpufunc_nullop, /* l2cache_wb_range */ + (void *)cpufunc_nullop, /* l2cache_drain_writebuf */ /* Other functions */ @@ -276,6 +278,7 @@ struct cpu_functions sheeva_cpufuncs = { sheeva_l2cache_wbinv_range, /* l2cache_wbinv_range */ sheeva_l2cache_inv_range, /* l2cache_inv_range */ sheeva_l2cache_wb_range, /* l2cache_wb_range */ + (void *)cpufunc_nullop, /* l2cache_drain_writebuf */ /* Other functions */ @@ -338,6 +341,7 @@ struct cpu_functions arm10_cpufuncs = { (void *)cpufunc_nullop, /* l2cache_wbinv_range */ (void *)cpufunc_nullop, /* l2cache_inv_range */ (void *)cpufunc_nullop, /* l2cache_wb_range */ + (void *)cpufunc_nullop, /* l2cache_drain_writebuf */ /* Other functions */ @@ -365,13 +369,13 @@ struct cpu_functions pj4bv7_cpufuncs = { /* CPU functions */ cpufunc_id, /* id */ - arm11_drain_writebuf, /* cpwait */ + armv7_drain_writebuf, /* cpwait */ /* MMU functions */ cpufunc_control, /* control */ cpufunc_domains, /* Domain */ - pj4b_setttb, /* Setttb */ + armv7_setttb, /* Setttb */ cpufunc_faultstatus, /* Faultstatus */ cpufunc_faultaddress, /* Faultaddress */ @@ -401,13 +405,14 @@ struct cpu_functions pj4bv7_cpufuncs = { (void *)cpufunc_nullop, /* l2cache_wbinv_range */ (void *)cpufunc_nullop, /* l2cache_inv_range */ (void *)cpufunc_nullop, /* l2cache_wb_range */ + (void *)cpufunc_nullop, /* l2cache_drain_writebuf */ /* Other functions */ - pj4b_drain_readbuf, /* flush_prefetchbuf */ - arm11_drain_writebuf, /* drain_writebuf */ - pj4b_flush_brnchtgt_all, /* flush_brnchtgt_C */ - pj4b_flush_brnchtgt_va, /* flush_brnchtgt_E */ + cpufunc_nullop, /* flush_prefetchbuf */ + armv7_drain_writebuf, /* drain_writebuf */ + cpufunc_nullop, /* flush_brnchtgt_C */ + (void *)cpufunc_nullop, /* flush_brnchtgt_E */ (void *)cpufunc_nullop, /* sleep */ @@ -416,7 +421,7 @@ struct cpu_functions pj4bv7_cpufuncs = { cpufunc_null_fixup, /* dataabt_fixup */ cpufunc_null_fixup, /* prefetchabt_fixup */ - arm11_context_switch, /* context_switch */ + armv7_context_switch, /* context_switch */ pj4bv7_setup /* cpu setup */ }; @@ -466,6 +471,7 @@ struct cpu_functions xscale_cpufuncs = { (void *)cpufunc_nullop, /* l2cache_wbinv_range */ (void *)cpufunc_nullop, /* l2cache_inv_range */ (void *)cpufunc_nullop, /* l2cache_wb_range */ + (void *)cpufunc_nullop, /* l2cache_drain_writebuf */ /* Other functions */ @@ -530,6 +536,7 @@ struct cpu_functions xscalec3_cpufuncs = { xscalec3_l2cache_purge_rng, /* l2cache_wbinv_range */ xscalec3_l2cache_flush_rng, /* l2cache_inv_range */ xscalec3_l2cache_clean_rng, /* l2cache_wb_range */ + (void *)cpufunc_nullop, /* l2cache_drain_writebuf */ /* Other functions */ @@ -593,6 +600,7 @@ struct cpu_functions fa526_cpufuncs = { (void *)cpufunc_nullop, /* l2cache_wbinv_range */ (void *)cpufunc_nullop, /* l2cache_inv_range */ (void *)cpufunc_nullop, /* l2cache_wb_range */ + (void *)cpufunc_nullop, /* l2cache_drain_writebuf */ /* Other functions */ @@ -656,6 +664,7 @@ struct cpu_functions arm1136_cpufuncs = { (void *)cpufunc_nullop, /* l2cache_wbinv_range */ (void *)cpufunc_nullop, /* l2cache_inv_range */ (void *)cpufunc_nullop, /* l2cache_wb_range */ + (void *)cpufunc_nullop, /* l2cache_drain_writebuf */ /* Other functions */ @@ -718,6 +727,7 @@ struct cpu_functions arm1176_cpufuncs = { (void *)cpufunc_nullop, /* l2cache_wbinv_range */ (void *)cpufunc_nullop, /* l2cache_inv_range */ (void *)cpufunc_nullop, /* l2cache_wb_range */ + (void *)cpufunc_nullop, /* l2cache_drain_writebuf */ /* Other functions */ @@ -789,6 +799,7 @@ struct cpu_functions cortexa_cpufuncs = { (void *)cpufunc_nullop, /* l2cache_wbinv_range */ (void *)cpufunc_nullop, /* l2cache_inv_range */ (void *)cpufunc_nullop, /* l2cache_wb_range */ + (void *)cpufunc_nullop, /* l2cache_drain_writebuf */ /* Other functions */ @@ -1387,6 +1398,53 @@ arm10_setup(args) } #endif /* CPU_ARM9E || CPU_ARM10 */ +#if defined(CPU_ARM1136) || defined(CPU_ARM1176) \ + || defined(CPU_MV_PJ4B) \ + || defined(CPU_CORTEXA) || defined(CPU_KRAIT) +static __inline void +cpu_scc_setup_ccnt(void) +{ +/* This is how you give userland access to the CCNT and PMCn + * registers. + * BEWARE! This gives write access also, which may not be what + * you want! + */ +#ifdef _PMC_USER_READ_WRITE_ +#if defined(CPU_ARM1136) || defined(CPU_ARM1176) + /* Use the Secure User and Non-secure Access Validation Control Register + * to allow userland access + */ + __asm volatile ("mcr p15, 0, %0, c15, c9, 0\n\t" + : + : "r"(0x00000001)); +#else + /* Set PMUSERENR[0] to allow userland access */ + __asm volatile ("mcr p15, 0, %0, c9, c14, 0\n\t" + : + : "r"(0x00000001)); +#endif +#endif +#if defined(CPU_ARM1136) || defined(CPU_ARM1176) + /* Set PMCR[2,0] to enable counters and reset CCNT */ + __asm volatile ("mcr p15, 0, %0, c15, c12, 0\n\t" + : + : "r"(0x00000005)); +#else + /* Set up the PMCCNTR register as a cyclecounter: + * Set PMINTENCLR to 0xFFFFFFFF to block interrupts + * Set PMCR[2,0] to enable counters and reset CCNT + * Set PMCNTENSET to 0x80000000 to enable CCNT */ + __asm volatile ("mcr p15, 0, %0, c9, c14, 2\n\t" + "mcr p15, 0, %1, c9, c12, 0\n\t" + "mcr p15, 0, %2, c9, c12, 1\n\t" + : + : "r"(0xFFFFFFFF), + "r"(0x00000005), + "r"(0x80000000)); +#endif +} +#endif + #if defined(CPU_ARM1136) || defined(CPU_ARM1176) struct cpu_option arm11_options[] = { { "cpu.cache", BIC, OR, (CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE) }, @@ -1490,6 +1548,8 @@ arm11x6_setup(char *args) /* And again. */ cpu_idcache_wbinv_all(); + + cpu_scc_setup_ccnt(); } #endif /* CPU_ARM1136 || CPU_ARM1176 */ @@ -1524,6 +1584,8 @@ pj4bv7_setup(args) /* And again. */ cpu_idcache_wbinv_all(); + + cpu_scc_setup_ccnt(); } #endif /* CPU_MV_PJ4B */ @@ -1571,6 +1633,8 @@ cortexa_setup(char *args) #ifdef SMP armv7_auxctrl((1 << 6) | (1 << 0), (1 << 6) | (1 << 0)); /* Enable SMP + TLB broadcasting */ #endif + + cpu_scc_setup_ccnt(); } #endif /* CPU_CORTEXA */ diff --git a/sys/arm/arm/cpufunc_asm_armv7.S b/sys/arm/arm/cpufunc_asm_armv7.S index 45f4593cff5..71e9ca5d8d1 100644 --- a/sys/arm/arm/cpufunc_asm_armv7.S +++ b/sys/arm/arm/cpufunc_asm_armv7.S @@ -319,6 +319,10 @@ ENTRY(armv7_auxctrl) RET END(armv7_auxctrl) +/* + * Invalidate all I+D+branch cache. Used by startup code, which counts + * on the fact that only r0-r3,ip are modified and no stack space is used. + */ ENTRY(armv7_idcache_inv_all) mov r0, #0 mcr p15, 2, r0, c0, c0, 0 @ set cache level to L1 diff --git a/sys/arm/arm/cpufunc_asm_pj4b.S b/sys/arm/arm/cpufunc_asm_pj4b.S index d8d400c856c..97b7586f836 100644 --- a/sys/arm/arm/cpufunc_asm_pj4b.S +++ b/sys/arm/arm/cpufunc_asm_pj4b.S @@ -37,38 +37,6 @@ __FBSDID("$FreeBSD$"); .Lpj4b_sf_ctrl_reg: .word 0xf1021820 - -ENTRY(pj4b_setttb) - /* Cache synchronization is not required as this core has PIPT caches */ - mcr p15, 0, r1, c7, c10, 4 /* drain the write buffer */ -#ifdef SMP - orr r0, r0, #2 /* Set TTB shared memory flag */ -#endif - mcr p15, 0, r0, c2, c0, 0 /* load new TTB */ - mcr p15, 0, r0, c8, c7, 0 /* invalidate I+D TLBs */ - RET -END(pj4b_setttb) - -ENTRY(pj4b_drain_readbuf) - mcr p15, 0, r0, c7, c5, 4 /* flush prefetch buffers */ - RET -END(pj4b_drain_readbuf) - -ENTRY(pj4b_flush_brnchtgt_all) - mcr p15, 0, r0, c7, c5, 6 /* flush entrie branch target cache */ - RET -END(pj4b_flush_brnchtgt_all) - -ENTRY(pj4b_flush_brnchtgt_va) - mcr p15, 0, r0, c7, c5, 7 /* flush branch target cache by VA */ - RET -END(pj4b_flush_brnchtgt_va) - -ENTRY(get_core_id) - mrc p15, 0, r0, c0, c0, 5 - RET -END(get_core_id) - ENTRY(pj4b_config) /* Set Auxiliary Debug Modes Control 0 register */ diff --git a/sys/arm/arm/dump_machdep.c b/sys/arm/arm/dump_machdep.c index f37346c3d00..b5a37f2a52e 100644 --- a/sys/arm/arm/dump_machdep.c +++ b/sys/arm/arm/dump_machdep.c @@ -50,8 +50,7 @@ __FBSDID("$FreeBSD$"); CTASSERT(sizeof(struct kerneldumpheader) == 512); int do_minidump = 1; -TUNABLE_INT("debug.minidump", &do_minidump); -SYSCTL_INT(_debug, OID_AUTO, minidump, CTLFLAG_RW, &do_minidump, 0, +SYSCTL_INT(_debug, OID_AUTO, minidump, CTLFLAG_RWTUN, &do_minidump, 0, "Enable mini crash dumps"); /* @@ -272,7 +271,7 @@ foreach_chunk(callback_t cb, void *arg) return (seqnr); } -void +int dumpsys(struct dumperinfo *di) { Elf_Ehdr ehdr; @@ -283,7 +282,7 @@ dumpsys(struct dumperinfo *di) if (do_minidump) { minidumpsys(di); - return; + return (0); } bzero(&ehdr, sizeof(ehdr)); @@ -369,7 +368,7 @@ dumpsys(struct dumperinfo *di) /* Signal completion, signoff and exit stage left. */ dump_write(di, NULL, 0, 0, 0); printf("\nDump complete\n"); - return; + return (0); fail: if (error < 0) @@ -381,4 +380,5 @@ dumpsys(struct dumperinfo *di) printf("\nDump failed. Partition too small.\n"); else printf("\n** DUMP FAILED (ERROR %d) **\n", error); + return (error); } diff --git a/sys/arm/arm/gic.c b/sys/arm/arm/gic.c index 9472edb92a7..06c4b879658 100644 --- a/sys/arm/arm/gic.c +++ b/sys/arm/arm/gic.c @@ -83,6 +83,8 @@ __FBSDID("$FreeBSD$"); #define GICC_ABPR 0x001C /* v1 ICCABPR */ #define GICC_IIDR 0x00FC /* v1 ICCIIDR*/ +#define GIC_LAST_IPI 15 /* Irqs 0-15 are IPIs. */ + /* First bit is a polarity bit (0 - low, 1 - high) */ #define GICD_ICFGR_POL_LOW (0 << 0) #define GICD_ICFGR_POL_HIGH (1 << 0) @@ -164,8 +166,9 @@ gic_init_secondary(void) /* Enable interrupt distribution */ gic_d_write_4(GICD_CTLR, 0x01); - /* Activate IRQ 29, ie private timer IRQ*/ + /* Activate IRQ 29-30, ie private timer (secure & non-secure) IRQs */ gic_d_write_4(GICD_ISENABLER(29 >> 5), (1UL << (29 & 0x1F))); + gic_d_write_4(GICD_ISENABLER(30 >> 5), (1UL << (30 & 0x1F))); } static int @@ -268,6 +271,8 @@ gic_post_filter(void *arg) { uintptr_t irq = (uintptr_t) arg; + if (irq > GIC_LAST_IPI) + arm_irq_memory_barrier(irq); gic_c_write_4(GICC_EOIR, irq); } @@ -284,13 +289,13 @@ arm_get_next_irq(int last_irq) * have this information later. */ - if ((active_irq & 0x3ff) < 16) + if ((active_irq & 0x3ff) <= GIC_LAST_IPI) gic_c_write_4(GICC_EOIR, active_irq); active_irq &= 0x3FF; if (active_irq == 0x3FF) { if (last_irq == -1) - printf("Spurious interrupt detected [0x%08x]\n", active_irq); + printf("Spurious interrupt detected\n"); return -1; } @@ -309,6 +314,8 @@ void arm_unmask_irq(uintptr_t nb) { + if (nb > GIC_LAST_IPI) + arm_irq_memory_barrier(nb); gic_d_write_4(GICD_ISENABLER(nb >> 5), (1UL << (nb & 0x1F))); } diff --git a/sys/arm/arm/intr.c b/sys/arm/arm/intr.c index ac93cbdfeb1..ba151276d33 100644 --- a/sys/arm/arm/intr.c +++ b/sys/arm/arm/intr.c @@ -149,3 +149,67 @@ arm_irq_handler(struct trapframe *frame) } } } + +/* + * arm_irq_memory_barrier() + * + * Ensure all writes to device memory have reached devices before proceeding. + * + * This is intended to be called from the post-filter and post-thread routines + * of an interrupt controller implementation. A peripheral device driver should + * use bus_space_barrier() if it needs to ensure a write has reached the + * hardware for some reason other than clearing interrupt conditions. + * + * The need for this function arises from the ARM weak memory ordering model. + * Writes to locations mapped with the Device attribute bypass any caches, but + * are buffered. Multiple writes to the same device will be observed by that + * device in the order issued by the cpu. Writes to different devices may + * appear at those devices in a different order than issued by the cpu. That + * is, if the cpu writes to device A then device B, the write to device B could + * complete before the write to device A. + * + * Consider a typical device interrupt handler which services the interrupt and + * writes to a device status-acknowledge register to clear the interrupt before + * returning. That write is posted to the L2 controller which "immediately" + * places it in a store buffer and automatically drains that buffer. This can + * be less immediate than you'd think... There may be no free slots in the store + * buffers, so an existing buffer has to be drained first to make room. The + * target bus may be busy with other traffic (such as DMA for various devices), + * delaying the drain of the store buffer for some indeterminate time. While + * all this delay is happening, execution proceeds on the CPU, unwinding its way + * out of the interrupt call stack to the point where the interrupt driver code + * is ready to EOI and unmask the interrupt. The interrupt controller may be + * accessed via a faster bus than the hardware whose handler just ran; the write + * to unmask and EOI the interrupt may complete quickly while the device write + * to ack and clear the interrupt source is still lingering in a store buffer + * waiting for access to a slower bus. With the interrupt unmasked at the + * interrupt controller but still active at the device, as soon as interrupts + * are enabled on the core the device re-interrupts immediately: now you've got + * a spurious interrupt on your hands. + * + * The right way to fix this problem is for every device driver to use the + * proper bus_space_barrier() calls in its interrupt handler. For ARM a single + * barrier call at the end of the handler would work. This would have to be + * done to every driver in the system, not just arm-specific drivers. + * + * Another potential fix is to map all device memory as Strongly-Ordered rather + * than Device memory, which takes the store buffers out of the picture. This + * has a pretty big impact on overall system performance, because each strongly + * ordered memory access causes all L2 store buffers to be drained. + * + * A compromise solution is to have the interrupt controller implementation call + * this function to establish a barrier between writes to the interrupt-source + * device and writes to the interrupt controller device. + * + * This takes the interrupt number as an argument, and currently doesn't use it. + * The plan is that maybe some day there is a way to flag certain interrupts as + * "memory barrier safe" and we can avoid this overhead with them. + */ +void +arm_irq_memory_barrier(uintptr_t irq) +{ + + dsb(); + cpu_l2cache_drain_writebuf(); +} + diff --git a/sys/arm/arm/locore.S b/sys/arm/arm/locore.S index ad4204b8262..1376e88a928 100644 --- a/sys/arm/arm/locore.S +++ b/sys/arm/arm/locore.S @@ -82,7 +82,7 @@ ASENTRY_NP(_start) mov r9, r0 /* 0 or boot mode from boot2 */ mov r8, r1 /* Save Machine type */ mov ip, r2 /* Save meta data */ - mov fp, r3 /* Future expantion */ + mov fp, r3 /* Future expansion */ /* Make sure interrupts are disabled. */ mrs r7, cpsr @@ -166,9 +166,32 @@ Lunmapped: ldr r1, [r0, #4] sub r0, r1, r2 +#ifndef _ARM_ARCH_6 + /* + * Some of the older ports (the various XScale, mostly) assume + * that the memory before the kernel is mapped, and use it for + * the various stacks, page tables, etc. For those CPUs, map the + * 64 first MB of RAM, as it used to be. + */ /* * Map PA == VA - */ + */ + ldr r5, =PHYSADDR + mov r1, r5 + mov r2, r5 + /* Map 64MiB, preserved over calls to build_pagetables */ + mov r3, #64 + bl build_pagetables + + /* Create the kernel map to jump to */ + mov r1, r5 + ldr r2, =(KERNBASE) + bl build_pagetables + ldr r5, =(KERNPHYSADDR) +#else + /* + * Map PA == VA + */ /* Find the start kernels load address */ adr r5, _start ldr r2, =(L1_S_OFFSET) @@ -183,6 +206,7 @@ Lunmapped: mov r1, r5 ldr r2, =(KERNVIRTADDR) bl build_pagetables +#endif #if defined(SOCDEV_PA) && defined(SOCDEV_VA) /* Create the custom map */ @@ -353,24 +377,24 @@ ASENTRY_NP(mpentry) orr r7, r7, #(I32_bit|F32_bit) msr cpsr_c, r7 - - adr r7, Ltag - bic r7, r7, #0xf0000000 - orr r7, r7, #PHYSADDR - - /* Disable MMU for a while */ + /* Disable MMU. It should be disabled already, but make sure. */ mrc p15, 0, r2, c1, c0, 0 bic r2, r2, #(CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_DC_ENABLE |\ CPU_CONTROL_WBUF_ENABLE) bic r2, r2, #(CPU_CONTROL_IC_ENABLE) bic r2, r2, #(CPU_CONTROL_BPRD_ENABLE) mcr p15, 0, r2, c1, c0, 0 + nop + nop + nop + CPWAIT(r0) - nop - nop - nop +#if defined(ARM_MMU_V6) + bl armv6_idcache_inv_all /* Modifies r0 only */ +#elif defined(ARM_MMU_V7) + bl armv7_idcache_inv_all /* Modifies r0-r3, ip */ +#endif -Ltag: ldr r0, Lstartup_pagetable_secondary bic r0, r0, #0xf0000000 orr r0, r0, #PHYSADDR @@ -389,7 +413,10 @@ Ltag: mrc p15, 0, r0, c1, c0, 0 orr r0, r0, #CPU_CONTROL_V6_EXTPAGE orr r0, r0, #CPU_CONTROL_AF_ENABLE - orr r0, r0, #(CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_DC_ENABLE) + orr r0, r0, #(CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_DC_ENABLE |\ + CPU_CONTROL_WBUF_ENABLE) + orr r0, r0, #(CPU_CONTROL_IC_ENABLE) + orr r0, r0, #(CPU_CONTROL_BPRD_ENABLE) mcr p15, 0, r0, c1, c0, 0 nop nop diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c index 0490be73917..b61d5552ff7 100644 --- a/sys/arm/arm/machdep.c +++ b/sys/arm/arm/machdep.c @@ -98,6 +98,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -424,24 +425,20 @@ void cpu_idle(int busy) { - CTR2(KTR_SPARE2, "cpu_idle(%d) at %d", - busy, curcpu); + CTR2(KTR_SPARE2, "cpu_idle(%d) at %d", busy, curcpu); + spinlock_enter(); #ifndef NO_EVENTTIMERS - if (!busy) { - critical_enter(); + if (!busy) cpu_idleclock(); - } #endif if (!sched_runnable()) cpu_sleep(0); #ifndef NO_EVENTTIMERS - if (!busy) { + if (!busy) cpu_activeclock(); - critical_exit(); - } #endif - CTR2(KTR_SPARE2, "cpu_idle(%d) at %d done", - busy, curcpu); + spinlock_exit(); + CTR2(KTR_SPARE2, "cpu_idle(%d) at %d done", busy, curcpu); } int @@ -1095,7 +1092,7 @@ initarm(struct arm_boot_params *abp) EXFLAG_NODUMP | EXFLAG_NOALLOC); /* Platform-specific initialisation */ - initarm_early_init(); + platform_probe_and_attach(); pcpu0_init(); @@ -1211,9 +1208,9 @@ initarm(struct arm_boot_params *abp) VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE, PTE_CACHE); /* Establish static device mappings. */ - err_devmap = initarm_devmap_init(); + err_devmap = platform_devmap_init(); arm_devmap_bootstrap(l1pagetable, NULL); - vm_max_kernel_address = initarm_lastaddr(); + vm_max_kernel_address = platform_lastaddr(); cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL * 2)) | DOMAIN_CLIENT); pmap_pa = kernel_l1pt.pv_pa; @@ -1233,7 +1230,7 @@ initarm(struct arm_boot_params *abp) */ OF_interpret("perform-fixup", 0); - initarm_gpio_init(); + platform_gpio_init(); cninit(); @@ -1251,7 +1248,7 @@ initarm(struct arm_boot_params *abp) printf("WARNING: could not fully configure devmap, error=%d\n", err_devmap); - initarm_late_init(); + platform_late_init(); /* * Pages were allocated during the secondary bootstrap for the diff --git a/sys/arm/arm/pl310.c b/sys/arm/arm/pl310.c index 83e690711b4..cf19d6c4be1 100644 --- a/sys/arm/arm/pl310.c +++ b/sys/arm/arm/pl310.c @@ -349,6 +349,18 @@ pl310_inv_range(vm_paddr_t start, vm_size_t size) PL310_UNLOCK(pl310_softc); } +static void +pl310_drain_writebuf(void) +{ + + if ((pl310_softc == NULL) || !pl310_softc->sc_enabled) + return; + + PL310_LOCK(pl310_softc); + pl310_cache_sync(); + PL310_UNLOCK(pl310_softc); +} + static void pl310_set_way_sizes(struct pl310_softc *sc) { @@ -484,6 +496,7 @@ pl310_attach(device_t dev) cpufuncs.cf_l2cache_wbinv_range = pl310_wbinv_range; cpufuncs.cf_l2cache_inv_range = pl310_inv_range; cpufuncs.cf_l2cache_wb_range = pl310_wb_range; + cpufuncs.cf_l2cache_drain_writebuf = pl310_drain_writebuf; return (0); } diff --git a/sys/arm/arm/platform.c b/sys/arm/arm/platform.c new file mode 100644 index 00000000000..8dcccc7714a --- /dev/null +++ b/sys/arm/arm/platform.c @@ -0,0 +1,179 @@ +/*- + * Copyright (c) 2005 Peter Grehan + * Copyright (c) 2009 Nathan Whitehorn + * 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$"); + +/* + * Dispatch platform calls to the appropriate platform implementation + * through a previously registered kernel object. + */ + +#define _ARM32_BUS_DMA_PRIVATE +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "platform_if.h" + +static platform_def_t *plat_def_impl; +static platform_t plat_obj; +static struct kobj_ops plat_kernel_kops; +static struct platform_kobj plat_kernel_obj; + +static char plat_name[64]; +SYSCTL_STRING(_hw, OID_AUTO, platform, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, plat_name, 0, + "Platform currently in use"); + +/* + * Platform install routines. Highest priority wins, using the same + * algorithm as bus attachment. + */ +SET_DECLARE(platform_set, platform_def_t); + +void +platform_probe_and_attach(void) +{ + platform_def_t **platpp, *platp; + int prio, best_prio; + + plat_obj = &plat_kernel_obj; + best_prio = 0; + + /* + * We are unable to use TUNABLE_STR as the read will happen + * well after this function has returned. + */ + TUNABLE_STR_FETCH("hw.platform", plat_name, sizeof(plat_name)); + + /* + * Try to locate the best platform kobj + */ + SET_FOREACH(platpp, platform_set) { + platp = *platpp; + + /* + * Take care of compiling the selected class, and + * then statically initialise the MMU object + */ + kobj_class_compile_static(platp, &plat_kernel_kops); + kobj_init_static((kobj_t)plat_obj, platp); + + plat_obj->cls = platp; + + prio = PLATFORM_PROBE(plat_obj); + + /* Check for errors */ + if (prio > 0) + continue; + + /* + * Check if this module was specifically requested through + * the loader tunable we provide. + */ + if (strcmp(platp->name,plat_name) == 0) { + plat_def_impl = platp; + break; + } + + /* Otherwise, see if it is better than our current best */ + if (plat_def_impl == NULL || prio > best_prio) { + best_prio = prio; + plat_def_impl = platp; + } + + /* + * We can't free the KOBJ, since it is static. Reset the ops + * member of this class so that we can come back later. + */ + platp->ops = NULL; + } + + if (plat_def_impl == NULL) + panic("No platform module found!"); + + /* + * Recompile to make sure we ended with the + * correct one, and then attach. + */ + + kobj_class_compile_static(plat_def_impl, &plat_kernel_kops); + kobj_init_static((kobj_t)plat_obj, plat_def_impl); + + strlcpy(plat_name,plat_def_impl->name,sizeof(plat_name)); + + PLATFORM_ATTACH(plat_obj); +} + +int +platform_devmap_init(void) +{ + + return PLATFORM_DEVMAP_INIT(plat_obj); +} + +vm_offset_t +platform_lastaddr(void) +{ + + return PLATFORM_LASTADDR(plat_obj); +} + +void +platform_gpio_init(void) +{ + + PLATFORM_GPIO_INIT(plat_obj); +} + +void +platform_late_init(void) +{ + + PLATFORM_LATE_INIT(plat_obj); +} + diff --git a/sys/arm/arm/platform_if.m b/sys/arm/arm/platform_if.m new file mode 100644 index 00000000000..8eaa3d3031b --- /dev/null +++ b/sys/arm/arm/platform_if.m @@ -0,0 +1,116 @@ +#- +# Copyright (c) 2009 Nathan Whitehorn +# 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 + +/** + * @defgroup PLATFORM platform - KObj methods for ARM platform + * implementations + * @brief A set of methods required by all platform implementations. + * These are used to bring up secondary CPUs, supply the physical memory + * map, etc. + *@{ + */ + +INTERFACE platform; + +# +# Default implementations +# +CODE { + static void platform_null_attach(platform_t plat) + { + return; + } +}; + +/** + * @brief Probe for whether we are on this platform, returning the standard + * newbus probe codes. If we have Open Firmware or a flattened device tree, + * it is guaranteed to be available at this point. + */ +METHOD int probe { + platform_t _plat; +}; + +/** + * @brief Attach this platform module. This happens before the MMU is online, + * so the platform module can install its own high-priority MMU module at + * this point. + */ +METHOD int attach { + platform_t _plat; +} DEFAULT platform_null_attach; + +/** + * @brief Called as one of the last steps of early virtual memory + * initialization, shortly before the new page tables are installed. + */ +METHOD int devmap_init { + platform_t _plat; +}; + +/** + * @brief Called after devmap_init(), and must return the address of the + * first byte of unusable KVA space. This allows a platform to carve out + * of the top of the KVA space whatever reserves it needs for things like + * static device mapping, and this is called to get the value before + * calling pmap_bootstrap() which uses the value to size the available KVA. + */ +METHOD vm_offset_t lastaddr { + platform_t _plat; +}; + +/** + * @brief Called after the static device mappings are established and just + * before cninit(). The intention is that the routine can do any hardware + * setup (such as gpio or pinmux) necessary to make the console functional. + */ +METHOD void gpio_init { + platform_t _plat; +}; + +/** + * @brief Called just after cninit(). This is the first of the init + * routines that can use printf() and expect the output to appear on + * a standard console. + */ +METHOD void late_init { + platform_t _plat; +}; + diff --git a/sys/arm/arm/pmap-v6.c b/sys/arm/arm/pmap-v6.c index cde208b730b..0d26f466b0b 100644 --- a/sys/arm/arm/pmap-v6.c +++ b/sys/arm/arm/pmap-v6.c @@ -381,7 +381,8 @@ struct l2_dtable { /* pmap_kenter_internal flags */ #define KENTER_CACHE 0x1 -#define KENTER_USER 0x2 +#define KENTER_DEVICE 0x2 +#define KENTER_USER 0x4 /* * Given an L1 table index, calculate the corresponding l2_dtable index @@ -463,8 +464,8 @@ static const uint32_t pc_freemask[_NPCM] = { static SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); /* Superpages utilization enabled = 1 / disabled = 0 */ -static int sp_enabled = 0; -SYSCTL_INT(_vm_pmap, OID_AUTO, sp_enabled, CTLFLAG_RDTUN, &sp_enabled, 0, +static int sp_enabled = 1; +SYSCTL_INT(_vm_pmap, OID_AUTO, sp_enabled, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &sp_enabled, 0, "Are large page mappings enabled?"); SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_count, CTLFLAG_RD, &pv_entry_count, 0, @@ -2401,12 +2402,17 @@ pmap_kenter_internal(vm_offset_t va, vm_offset_t pa, int flags) ptep = &l2b->l2b_kva[l2pte_index(va)]; opte = *ptep; + if (flags & KENTER_CACHE) + *ptep = L2_S_PROTO | l2s_mem_types[PTE_CACHE] | pa | L2_S_REF; + else if (flags & KENTER_DEVICE) + *ptep = L2_S_PROTO | l2s_mem_types[PTE_DEVICE] | pa | L2_S_REF; + else + *ptep = L2_S_PROTO | l2s_mem_types[PTE_NOCACHE] | pa | L2_S_REF; + if (flags & KENTER_CACHE) { - *ptep = L2_S_PROTO | pa | pte_l2_s_cache_mode | L2_S_REF; pmap_set_prot(ptep, VM_PROT_READ | VM_PROT_WRITE, flags & KENTER_USER); } else { - *ptep = L2_S_PROTO | pa | L2_S_REF; pmap_set_prot(ptep, VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE, 0); } @@ -2444,11 +2450,7 @@ void pmap_kenter_device(vm_offset_t va, vm_paddr_t pa) { - /* - * XXX - Need a way for kenter_internal to handle PTE_DEVICE mapping as - * a potentially different thing than PTE_NOCACHE. - */ - pmap_kenter_internal(va, pa, 0); + pmap_kenter_internal(va, pa, KENTER_DEVICE); } void @@ -2750,16 +2752,6 @@ pmap_change_attr(vm_offset_t sva, vm_size_t len, int mode) offset = sva & PAGE_MASK; size = roundup(offset + len, PAGE_SIZE); -#ifdef checkit - /* - * Only supported on kernel virtual addresses, including the direct - * map but excluding the recursive map. - */ - if (base < DMAP_MIN_ADDRESS) { - PMAP_UNLOCK(kernel_pmap); - return (EINVAL); - } -#endif for (tmpva = base; tmpva < base + size; ) { next_bucket = L2_NEXT_BUCKET(tmpva); if (next_bucket > base + size) @@ -2850,11 +2842,11 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) * Are we protecting the entire large page? If not, * demote the mapping and fall through. */ - if (sva + L1_S_SIZE == L2_NEXT_BUCKET(sva) && - eva >= L2_NEXT_BUCKET(sva)) { + if (sva + L1_S_SIZE == next_bucket && + eva >= next_bucket) { l1pd &= ~(L1_S_PROT_MASK | L1_S_XN); if (!(prot & VM_PROT_EXECUTE)) - *pl1pd |= L1_S_XN; + l1pd |= L1_S_XN; /* * At this point we are always setting * write-protect bit. @@ -3226,8 +3218,7 @@ pmap_enter_object(pmap_t pmap, vm_offset_t start, vm_offset_t end, while (m != NULL && (diff = m->pindex - m_start->pindex) < psize) { va = start + ptoa(diff); if ((va & L1_S_OFFSET) == 0 && L2_NEXT_BUCKET(va) <= end && - (VM_PAGE_TO_PHYS(m) & L1_S_OFFSET) == 0 && - sp_enabled && vm_reserv_level_iffullpop(m) == 0 && + m->psind == 1 && sp_enabled && pmap_enter_section(pmap, va, m, prot)) m = &m[L1_S_SIZE / PAGE_SIZE - 1]; else @@ -3311,6 +3302,79 @@ pmap_change_wiring(pmap_t pmap, vm_offset_t va, boolean_t wired) PMAP_UNLOCK(pmap); } +/* + * Clear the wired attribute from the mappings for the specified range of + * addresses in the given pmap. Every valid mapping within that range + * must have the wired attribute set. In contrast, invalid mappings + * cannot have the wired attribute set, so they are ignored. + * + * XXX Wired mappings of unmanaged pages cannot be counted by this pmap + * implementation. + */ +void +pmap_unwire(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) +{ + struct l2_bucket *l2b; + struct md_page *pvh; + pd_entry_t l1pd; + pt_entry_t *ptep, pte; + pv_entry_t pv; + vm_offset_t next_bucket; + vm_paddr_t pa; + vm_page_t m; + + rw_wlock(&pvh_global_lock); + PMAP_LOCK(pmap); + while (sva < eva) { + next_bucket = L2_NEXT_BUCKET(sva); + l1pd = pmap->pm_l1->l1_kva[L1_IDX(sva)]; + if ((l1pd & L1_TYPE_MASK) == L1_S_PROTO) { + pa = l1pd & L1_S_FRAME; + m = PHYS_TO_VM_PAGE(pa); + KASSERT(m != NULL && (m->oflags & VPO_UNMANAGED) == 0, + ("pmap_unwire: unmanaged 1mpage %p", m)); + pvh = pa_to_pvh(pa); + pv = pmap_find_pv(pvh, pmap, trunc_1mpage(sva)); + if ((pv->pv_flags & PVF_WIRED) == 0) + panic("pmap_unwire: pv %p isn't wired", pv); + + /* + * Are we unwiring the entire large page? If not, + * demote the mapping and fall through. + */ + if (sva + L1_S_SIZE == next_bucket && + eva >= next_bucket) { + pv->pv_flags &= ~PVF_WIRED; + pmap->pm_stats.wired_count -= L2_PTE_NUM_TOTAL; + sva = next_bucket; + continue; + } else if (!pmap_demote_section(pmap, sva)) + panic("pmap_unwire: demotion failed"); + } + if (next_bucket > eva) + next_bucket = eva; + l2b = pmap_get_l2_bucket(pmap, sva); + if (l2b == NULL) { + sva = next_bucket; + continue; + } + for (ptep = &l2b->l2b_kva[l2pte_index(sva)]; sva < next_bucket; + sva += PAGE_SIZE, ptep++) { + if ((pte = *ptep) == 0 || + (m = PHYS_TO_VM_PAGE(l2pte_pa(pte))) == NULL || + (m->oflags & VPO_UNMANAGED) != 0) + continue; + pv = pmap_find_pv(&m->md, pmap, sva); + if ((pv->pv_flags & PVF_WIRED) == 0) + panic("pmap_unwire: pv %p isn't wired", pv); + pv->pv_flags &= ~PVF_WIRED; + pmap->pm_stats.wired_count--; + } + } + rw_wunlock(&pvh_global_lock); + PMAP_UNLOCK(pmap); +} + /* * Copy the range specified by src_addr/len @@ -4221,7 +4285,7 @@ pmap_free_pv_chunk(struct pv_chunk *pc) /* entire chunk is free, return it */ m = PHYS_TO_VM_PAGE(pmap_kextract((vm_offset_t)pc)); pmap_qremove((vm_offset_t)pc, 1); - vm_page_unwire(m, 0); + vm_page_unwire(m, PQ_INACTIVE); vm_page_free(m); pmap_ptelist_free(&pv_vafree, (vm_offset_t)pc); @@ -4314,7 +4378,7 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) { struct l2_bucket *l2b; vm_offset_t next_bucket; - pd_entry_t *pl1pd, l1pd; + pd_entry_t l1pd; pt_entry_t *ptep; u_int total; u_int mappings, is_exec, is_refd; @@ -4329,11 +4393,12 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) PMAP_LOCK(pmap); total = 0; while (sva < eva) { + next_bucket = L2_NEXT_BUCKET(sva); + /* * Check for large page. */ - pl1pd = &pmap->pm_l1->l1_kva[L1_IDX(sva)]; - l1pd = *pl1pd; + l1pd = pmap->pm_l1->l1_kva[L1_IDX(sva)]; if ((l1pd & L1_TYPE_MASK) == L1_S_PROTO) { KASSERT((l1pd & L1_S_DOM_MASK) != L1_S_DOM(PMAP_DOMAIN_KERNEL), ("pmap_remove: " @@ -4342,21 +4407,20 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) * Are we removing the entire large page? If not, * demote the mapping and fall through. */ - if (sva + L1_S_SIZE == L2_NEXT_BUCKET(sva) && - eva >= L2_NEXT_BUCKET(sva)) { + if (sva + L1_S_SIZE == next_bucket && + eva >= next_bucket) { pmap_remove_section(pmap, sva); - sva = L2_NEXT_BUCKET(sva); + sva = next_bucket; continue; } else if (!pmap_demote_section(pmap, sva)) { /* The large page mapping was destroyed. */ - sva = L2_NEXT_BUCKET(sva); + sva = next_bucket; continue; } } /* * Do one L2 bucket's worth at a time. */ - next_bucket = L2_NEXT_BUCKET(sva); if (next_bucket > eva) next_bucket = eva; @@ -4855,7 +4919,7 @@ pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, int advice) { struct l2_bucket *l2b; struct pv_entry *pve; - pd_entry_t *pl1pd, l1pd; + pd_entry_t l1pd; pt_entry_t *ptep, opte, pte; vm_offset_t next_bucket; vm_page_t m; @@ -4868,8 +4932,7 @@ pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, int advice) next_bucket = L2_NEXT_BUCKET(sva); if (next_bucket < sva) next_bucket = eva; - pl1pd = &pmap->pm_l1->l1_kva[L1_IDX(sva)]; - l1pd = *pl1pd; + l1pd = pmap->pm_l1->l1_kva[L1_IDX(sva)]; if ((l1pd & L1_TYPE_MASK) == L1_S_PROTO) { if (pmap == pmap_kernel()) continue; diff --git a/sys/arm/arm/pmap.c b/sys/arm/arm/pmap.c index b014447d5ad..8244b67a426 100644 --- a/sys/arm/arm/pmap.c +++ b/sys/arm/arm/pmap.c @@ -3034,7 +3034,14 @@ pmap_remove_all(vm_page_t m) if (TAILQ_EMPTY(&m->md.pv_list)) return; rw_wlock(&pvh_global_lock); - pmap_remove_write(m); + + /* + * XXX This call shouldn't exist. Iterating over the PV list twice, + * once in pmap_clearbit() and again below, is both unnecessary and + * inefficient. The below code should itself write back the cache + * entry before it destroys the mapping. + */ + pmap_clearbit(m, PVF_WRITE); curpm = vmspace_pmap(curproc->p_vmspace); while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) { if (flush == FALSE && (pv->pv_pmap == curpm || @@ -3043,7 +3050,7 @@ pmap_remove_all(vm_page_t m) PMAP_LOCK(pv->pv_pmap); /* - * Cached contents were written-back in pmap_remove_write(), + * Cached contents were written-back in pmap_clearbit(), * but we still have to invalidate the cache entry to make * sure stale data are not retrieved when another page will be * mapped under this virtual address. @@ -3563,6 +3570,52 @@ pmap_change_wiring(pmap_t pmap, vm_offset_t va, boolean_t wired) PMAP_UNLOCK(pmap); } +/* + * Clear the wired attribute from the mappings for the specified range of + * addresses in the given pmap. Every valid mapping within that range + * must have the wired attribute set. In contrast, invalid mappings + * cannot have the wired attribute set, so they are ignored. + * + * XXX Wired mappings of unmanaged pages cannot be counted by this pmap + * implementation. + */ +void +pmap_unwire(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) +{ + struct l2_bucket *l2b; + pt_entry_t *ptep, pte; + pv_entry_t pv; + vm_offset_t next_bucket; + vm_page_t m; + + rw_wlock(&pvh_global_lock); + PMAP_LOCK(pmap); + while (sva < eva) { + next_bucket = L2_NEXT_BUCKET(sva); + if (next_bucket > eva) + next_bucket = eva; + l2b = pmap_get_l2_bucket(pmap, sva); + if (l2b == NULL) { + sva = next_bucket; + continue; + } + for (ptep = &l2b->l2b_kva[l2pte_index(sva)]; sva < next_bucket; + sva += PAGE_SIZE, ptep++) { + if ((pte = *ptep) == 0 || + (m = PHYS_TO_VM_PAGE(l2pte_pa(pte))) == NULL || + (m->oflags & VPO_UNMANAGED) != 0) + continue; + pv = pmap_find_pv(m, pmap, sva); + if ((pv->pv_flags & PVF_WIRED) == 0) + panic("pmap_unwire: pv %p isn't wired", pv); + pv->pv_flags &= ~PVF_WIRED; + pmap->pm_stats.wired_count--; + } + } + rw_wunlock(&pvh_global_lock); + PMAP_UNLOCK(pmap); +} + /* * Copy the range specified by src_addr/len diff --git a/sys/arm/at91/at91_machdep.c b/sys/arm/at91/at91_machdep.c index 76310baf5e2..3da9e187c4d 100644 --- a/sys/arm/at91/at91_machdep.c +++ b/sys/arm/at91/at91_machdep.c @@ -126,7 +126,7 @@ const struct arm_devmap_entry at91_devmap[] = { 0xfff00000, 0x00100000, VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, /* There's a notion that we should do the rest of these lazily. */ /* @@ -150,7 +150,7 @@ const struct arm_devmap_entry at91_devmap[] = { AT91RM92_OHCI_BASE, 0x00100000, VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { /* CompactFlash controller. Portion of EBI CS4 1MB */ @@ -158,7 +158,7 @@ const struct arm_devmap_entry at91_devmap[] = { AT91RM92_CF_BASE, 0x00100000, VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, /* * The next two should be good for the 9260, 9261 and 9G20 since @@ -170,7 +170,7 @@ const struct arm_devmap_entry at91_devmap[] = { AT91SAM9G20_OHCI_BASE, 0x00100000, VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { /* EBI CS3 256MB */ @@ -178,7 +178,7 @@ const struct arm_devmap_entry at91_devmap[] = { AT91SAM9G20_NAND_BASE, AT91SAM9G20_NAND_SIZE, VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, /* * The next should be good for the 9G45. @@ -189,7 +189,7 @@ const struct arm_devmap_entry at91_devmap[] = { AT91SAM9G45_OHCI_BASE, 0x00100000, VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { 0, 0, 0, 0, 0, } }; diff --git a/sys/arm/at91/board_tsc4370.c b/sys/arm/at91/board_tsc4370.c index ba9b3ecaa5c..c898518623f 100644 --- a/sys/arm/at91/board_tsc4370.c +++ b/sys/arm/at91/board_tsc4370.c @@ -332,19 +332,19 @@ set_mac_from_idprom(void) DEVOFFSET_BSO_SIGNATURE + sizeof(sig), &dev_offset, sizeof(dev_offset)); if (status == -1) - return -1;; + return -1; /* Check for the boot section signature. */ status = eeprom_read(EE_DEV_ADDR, dev_offset + OFFSET_BS_SIGNATURE, &sig, sizeof(sig)); if ((status == -1) || (sig != BS_SIGNATURE)) - return -1;; + return -1; } dev_offset += OFFSET_EUI64; /* Read the EUI64 from the device. */ if (eeprom_read(EE_DEV_ADDR, dev_offset, eui64, sizeof(eui64)) == -1) - return -1;; + return -1; /* Transcribe the EUI-64 to a MAC-48. * diff --git a/sys/arm/at91/if_ate.c b/sys/arm/at91/if_ate.c index 100b7be19c5..6b2eabc54cc 100644 --- a/sys/arm/at91/if_ate.c +++ b/sys/arm/at91/if_ate.c @@ -671,7 +671,6 @@ ate_deactivate(struct ate_softc *sc) bus_dmamem_free(sc->rx_tag, sc->rx_buf[i], sc->rx_map[i]); sc->rx_buf[i] = NULL; - sc->rx_map[i] = NULL; } bus_dma_tag_destroy(sc->rx_tag); } diff --git a/sys/arm/at91/if_macb.c b/sys/arm/at91/if_macb.c index 1a46adc5250..a60cddfaf2b 100644 --- a/sys/arm/at91/if_macb.c +++ b/sys/arm/at91/if_macb.c @@ -258,14 +258,14 @@ macb_free_desc_dma_tx(struct macb_softc *sc) /* TX descriptor ring. */ if (sc->dmatag_data_tx != NULL) { - if (sc->dmamap_ring_tx != NULL) + if (sc->ring_paddr_tx != 0) bus_dmamap_unload(sc->dmatag_data_tx, sc->dmamap_ring_tx); - if (sc->dmamap_ring_tx != NULL && sc->desc_tx != NULL) + if (sc->desc_tx != NULL) bus_dmamem_free(sc->dmatag_data_tx, sc->desc_tx, sc->dmamap_ring_tx); - sc->dmamap_ring_tx = NULL; - sc->dmamap_ring_tx = NULL; + sc->ring_paddr_tx = 0; + sc->desc_tx = NULL; bus_dma_tag_destroy(sc->dmatag_data_tx); sc->dmatag_data_tx = NULL; } @@ -389,15 +389,14 @@ macb_free_desc_dma_rx(struct macb_softc *sc) } /* RX descriptor ring. */ if (sc->dmatag_data_rx != NULL) { - if (sc->dmamap_ring_rx != NULL) + if (sc->ring_paddr_rx != 0) bus_dmamap_unload(sc->dmatag_data_rx, sc->dmamap_ring_rx); - if (sc->dmamap_ring_rx != NULL && - sc->desc_rx != NULL) + if (sc->desc_rx != NULL) bus_dmamem_free(sc->dmatag_data_rx, sc->desc_rx, sc->dmamap_ring_rx); + sc->ring_paddr_rx = 0; sc->desc_rx = NULL; - sc->dmamap_ring_rx = NULL; bus_dma_tag_destroy(sc->dmatag_data_rx); sc->dmatag_data_rx = NULL; } diff --git a/sys/arm/broadcom/bcm2835/bcm2835_bsc.c b/sys/arm/broadcom/bcm2835/bcm2835_bsc.c index 33e4769e173..1e486a4d83e 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_bsc.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_bsc.c @@ -407,7 +407,7 @@ bcm_bsc_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs) for (i = 0; i < nmsgs; i++) { /* Write the slave address. */ - BCM_BSC_WRITE(sc, BCM_BSC_SLAVE, msgs[i].slave); + BCM_BSC_WRITE(sc, BCM_BSC_SLAVE, msgs[i].slave >> 1); /* Write the data length. */ BCM_BSC_WRITE(sc, BCM_BSC_DLEN, msgs[i].len); diff --git a/sys/arm/broadcom/bcm2835/bcm2835_fbd.c b/sys/arm/broadcom/bcm2835/bcm2835_fbd.c index cf7cecd6c4a..ed625bc0f8f 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_fbd.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_fbd.c @@ -99,7 +99,6 @@ struct bcmsc_softc { struct bcm_fb_config* fb_config; bus_addr_t fb_config_phys; struct intr_config_hook init_hook; - }; static int bcm_fb_probe(device_t); @@ -167,14 +166,10 @@ bcm_fb_init(void *arg) fb_config->xoffset, fb_config->yoffset, fb_config->bpp); - device_printf(sc->dev, "pitch %d, base 0x%08x, screen_size %d\n", fb_config->pitch, fb_config->base, fb_config->screen_size); - - - info = malloc(sizeof(struct fb_info), M_DEVBUF, M_WAITOK | M_ZERO); info->fb_name = device_get_nameunit(sc->dev); @@ -199,8 +194,6 @@ bcm_fb_init(void *arg) device_printf(sc->dev, "Failed to attach fbd device\n"); return; } - - } else { device_printf(sc->dev, "Failed to set framebuffer info\n"); return; @@ -273,7 +266,6 @@ bcm_fb_attach(device_t dev) return (ENXIO); } - static void bcm_fb_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int err) { diff --git a/sys/arm/broadcom/bcm2835/bcm2835_intr.c b/sys/arm/broadcom/bcm2835/bcm2835_intr.c index 4a94c699d37..7a06eb0162d 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_intr.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_intr.c @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #define BANK1_END (BANK1_START + 32 - 1) #define BANK2_START (BANK1_START + 32) #define BANK2_END (BANK2_START + 32 - 1) +#define BANK3_START (BANK2_START + 32) #define IS_IRQ_BASIC(n) (((n) >= 0) && ((n) < BANK1_START)) #define IS_IRQ_BANK1(n) (((n) >= BANK1_START) && ((n) <= BANK1_END)) @@ -150,29 +151,36 @@ arm_get_next_irq(int last_irq) /* Sanity check */ if (irq < 0) irq = 0; - + /* TODO: should we mask last_irq? */ - pending = intc_read_4(INTC_PENDING_BASIC); - while (irq < BANK1_START) { - if (pending & (1 << irq)) - return irq; - irq++; + if (irq < BANK1_START) { + pending = intc_read_4(INTC_PENDING_BASIC); + if ((pending & 0xFF) == 0) { + irq = BANK1_START; /* skip to next bank */ + } else do { + if (pending & (1 << irq)) + return irq; + irq++; + } while (irq < BANK1_START); } - - pending = intc_read_4(INTC_PENDING_BANK1); - while (irq < BANK2_START) { - if (pending & (1 << IRQ_BANK1(irq))) - return irq; - irq++; + if (irq < BANK2_START) { + pending = intc_read_4(INTC_PENDING_BANK1); + if (pending == 0) { + irq = BANK2_START; /* skip to next bank */ + } else do { + if (pending & (1 << IRQ_BANK1(irq))) + return irq; + irq++; + } while (irq < BANK2_START); } - - pending = intc_read_4(INTC_PENDING_BANK2); - while (irq <= BANK2_END) { - if (pending & (1 << IRQ_BANK2(irq))) - return irq; - irq++; + if (irq < BANK3_START) { + pending = intc_read_4(INTC_PENDING_BANK2); + if (pending != 0) do { + if (pending & (1 << IRQ_BANK2(irq))) + return irq; + irq++; + } while (irq < BANK3_START); } - return (-1); } diff --git a/sys/arm/broadcom/bcm2835/bcm2835_machdep.c b/sys/arm/broadcom/bcm2835/bcm2835_machdep.c index 0f13a79bf93..0571c55208b 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_machdep.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_machdep.c @@ -54,31 +54,24 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include -vm_offset_t -initarm_lastaddr(void) +#include "platform_if.h" + +static vm_offset_t +bcm2835_lastaddr(platform_t plat) { return (arm_devmap_lastaddr()); } -void -initarm_early_init(void) -{ - -} - -void -initarm_gpio_init(void) -{ -} - -void -initarm_late_init(void) +static void +bcm2835_late_init(platform_t plat) { phandle_t system; pcell_t cells[2]; @@ -101,8 +94,8 @@ initarm_late_init(void) * All on-chip peripherals exist in a 16MB range starting at 0x20000000. * Map the entire range using 1MB section mappings. */ -int -initarm_devmap_init(void) +static int +bcm2835_devmap_init(platform_t plat) { arm_devmap_add_entry(0x20000000, 0x01000000); @@ -129,4 +122,13 @@ cpu_reset() bcmwd_watchdog_reset(); while (1); } +static platform_method_t bcm2835_methods[] = { + PLATFORMMETHOD(platform_devmap_init, bcm2835_devmap_init), + PLATFORMMETHOD(platform_lastaddr, bcm2835_lastaddr), + PLATFORMMETHOD(platform_late_init, bcm2835_late_init), + + PLATFORMMETHOD_END, +}; + +FDT_PLATFORM_DEF(bcm2835, "bcm2835", 0, "raspberrypi,model-b"); diff --git a/sys/arm/broadcom/bcm2835/files.bcm2835 b/sys/arm/broadcom/bcm2835/files.bcm2835 index 1bb1cf6793c..865f2d02b5b 100644 --- a/sys/arm/broadcom/bcm2835/files.bcm2835 +++ b/sys/arm/broadcom/bcm2835/files.bcm2835 @@ -13,7 +13,6 @@ arm/broadcom/bcm2835/bcm2835_sdhci.c optional sdhci arm/broadcom/bcm2835/bcm2835_spi.c optional bcm2835_spi arm/broadcom/bcm2835/bcm2835_systimer.c standard arm/broadcom/bcm2835/bcm2835_wdog.c standard -dev/usb/controller/dwc_otg_fdt.c optional dwcotg arm/arm/bus_space-v6.c standard arm/arm/bus_space_generic.c standard diff --git a/sys/arm/cavium/cns11xx/econa_machdep.c b/sys/arm/cavium/cns11xx/econa_machdep.c index 708109be633..b2c388f0435 100644 --- a/sys/arm/cavium/cns11xx/econa_machdep.c +++ b/sys/arm/cavium/cns11xx/econa_machdep.c @@ -112,7 +112,7 @@ static const struct arm_devmap_entry econa_devmap[] = { ECONA_SDRAM_BASE, /*physical*/ ECONA_SDRAM_SIZE, /*size*/ VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, /* * Map the on-board devices VA == PA so that we can access them @@ -127,7 +127,7 @@ static const struct arm_devmap_entry econa_devmap[] = { ECONA_IO_BASE, /*physical*/ ECONA_IO_SIZE, /*size*/ VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { /* @@ -137,7 +137,7 @@ static const struct arm_devmap_entry econa_devmap[] = { ECONA_OHCI_PBASE, /*physical*/ ECONA_USB_SIZE, /*size*/ VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { /* @@ -147,7 +147,7 @@ static const struct arm_devmap_entry econa_devmap[] = { ECONA_CFI_PBASE, /*physical*/ ECONA_CFI_SIZE, VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { 0, diff --git a/sys/arm/cavium/cns11xx/if_ece.c b/sys/arm/cavium/cns11xx/if_ece.c index 657f6f337aa..0ba2d774dc9 100644 --- a/sys/arm/cavium/cns11xx/if_ece.c +++ b/sys/arm/cavium/cns11xx/if_ece.c @@ -565,13 +565,15 @@ ece_free_desc_dma_tx(struct ece_softc *sc) } } - if (sc->dmamap_ring_tx) { + if (sc->ring_paddr_tx) { bus_dmamap_unload(sc->dmatag_data_tx, sc->dmamap_ring_tx); - if (sc->desc_tx) { - bus_dmamem_free(sc->dmatag_data_tx, - sc->desc_tx, sc->dmamap_ring_tx); - } - sc->dmamap_ring_tx = 0; + sc->ring_paddr_tx = 0; + } + + if (sc->desc_tx) { + bus_dmamem_free(sc->dmatag_data_tx, + sc->desc_tx, sc->dmamap_ring_tx); + sc->desc_tx = NULL; } if (sc->dmatag_data_tx) { @@ -679,18 +681,24 @@ ece_free_desc_dma_rx(struct ece_softc *sc) for (i = 0; i < ECE_MAX_RX_BUFFERS; i++) { if (sc->rx_desc[i].buff) { m_freem(sc->rx_desc[i].buff); - sc->rx_desc[i].buff= 0; + sc->rx_desc[i].buff = NULL; } } - if (sc->dmatag_data_rx) { + if (sc->ring_paddr_rx) { bus_dmamap_unload(sc->dmatag_data_rx, sc->dmamap_ring_rx); + sc->ring_paddr_rx = 0; + } + + if (sc->desc_rx) { bus_dmamem_free(sc->dmatag_data_rx, sc->desc_rx, sc->dmamap_ring_rx); + sc->desc_rx = NULL; + } + + if (sc->dmatag_data_rx) { bus_dma_tag_destroy(sc->dmatag_data_rx); - sc->dmatag_data_rx = 0; - sc->dmamap_ring_rx = 0; - sc->desc_rx = 0; + sc->dmatag_data_rx = NULL; } if (sc->dmatag_ring_rx) { @@ -699,7 +707,7 @@ ece_free_desc_dma_rx(struct ece_softc *sc) sc->rx_desc[i].dmamap); bus_dmamap_destroy(sc->dmatag_ring_rx, sc->rx_sparemap); bus_dma_tag_destroy(sc->dmatag_ring_rx); - sc->dmatag_ring_rx = 0; + sc->dmatag_ring_rx = NULL; } } diff --git a/sys/arm/conf/AC100 b/sys/arm/conf/AC100 deleted file mode 100644 index 3612cbcbcb9..00000000000 --- a/sys/arm/conf/AC100 +++ /dev/null @@ -1,98 +0,0 @@ -# -# Custom kernel for Toshiba AC100 -# -# $FreeBSD$ -# - -ident AC100 -include "../tegra/std.tegra2" - -makeoptions MODULES_OVERRIDE="" - -makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols -makeoptions WERROR="-Werror" - -#options SCHED_ULE # ULE scheduler -options SCHED_4BSD # 4BSD scheduler -options INET # InterNETworking -#options INET6 # IPv6 communications protocols -options FFS # Berkeley Fast Filesystem -#options NFSCL # Network Filesystem Client -#options NFSLOCKD # Network Lock Manager -#options NFS_ROOT # NFS usable as /, requires NFSCLIENT -#options BOOTP -#options BOOTP_NFSROOT -#options BOOTP_NFSV3 -#options BOOTP_WIRED_TO=mge0 - -options TMPFS # Efficient memory filesystem -options GEOM_PART_BSD # BSD partition scheme -options GEOM_PART_MBR # MBR partition scheme -options GEOM_PART_GPT -options ROOTDEVNAME=\"ufs:/dev/da0p1\" - -options SYSVSHM # SYSV-style shared memory -options SYSVMSG # SYSV-style message queues -options SYSVSEM # SYSV-style semaphores -options _KPOSIX_PRIORITY_SCHEDULING # Posix P1003_1B real-time extensions -options MUTEX_NOINLINE -options RWLOCK_NOINLINE -options NO_FFS_SNAPSHOT -options NO_SWAPPING - -#options SMP - -# Debugging -options VERBOSE_SYSINIT -#options ALT_BREAK_TO_DEBUGGER -options DDB -options GDB -options DIAGNOSTIC -options INVARIANTS # Enable calls of extra sanity checking -options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS -options KDB -options KDB_TRACE -#options KTR -#options KTR_VERBOSE=0 -#options KTR_ENTRIES=16384 -#options KTR_MASK=(KTR_SPARE2) -#options KTR_COMPILE=KTR_ALL -options WITNESS # Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed -#options WITNESS_KDB -options MUTEX_DEBUG - -# Pseudo devices -device random -device pty -device loop -device md - -# USB -#options USB_DEBUG # enable debug msgs -#device usb -#device ehci -#device umass -#device scbus -#device pass -#device da - -# SATA -#device ata -#device mvs - -# Serial ports -device uart - -# I2C (TWSI) -#device iic -#device iicbus - -#Network -device ether - -#FDT -options FDT -options FDT_DTB_STATIC -makeoptions FDT_DTS_FILE=tegra20-paz00.dts - diff --git a/sys/arm/conf/APALIS-IMX6 b/sys/arm/conf/APALIS-IMX6 new file mode 100644 index 00000000000..137677f1b40 --- /dev/null +++ b/sys/arm/conf/APALIS-IMX6 @@ -0,0 +1,31 @@ +# Kernel configuration for Toradex Apalis i.MX6 +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# +# $FreeBSD$ + +#NO_UNIVERSE + +include "IMX6" +ident APALIS-IMX6 + +makeoptions MODULES_OVERRIDE="" +makeoptions WITHOUT_MODULES="ahc" + +# Flattened Device Tree +options FDT +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=apalis-imx6.dts diff --git a/sys/arm/conf/ARNDALE b/sys/arm/conf/ARNDALE index da4c598e385..964f9e40041 100644 --- a/sys/arm/conf/ARNDALE +++ b/sys/arm/conf/ARNDALE @@ -19,7 +19,7 @@ #NO_UNIVERSE -include "EXYNOS5250.common" +include "EXYNOS5250" ident ARNDALE #FDT diff --git a/sys/arm/conf/ARNDALE-OCTA b/sys/arm/conf/ARNDALE-OCTA new file mode 100644 index 00000000000..ad937ee5a66 --- /dev/null +++ b/sys/arm/conf/ARNDALE-OCTA @@ -0,0 +1,28 @@ +# Kernel configuration for Arndale Octa Board (Exynos 5420) +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# +# $FreeBSD$ + +#NO_UNIVERSE + +include "EXYNOS5420" +ident ARNDALE-OCTA + +#FDT +options FDT +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=exynos5420-arndale-octa.dts diff --git a/sys/arm/conf/BEAGLEBONE b/sys/arm/conf/BEAGLEBONE index 5b63db9e73d..43c49553788 100644 --- a/sys/arm/conf/BEAGLEBONE +++ b/sys/arm/conf/BEAGLEBONE @@ -50,10 +50,11 @@ options SYSVSEM # SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # Posix P1003_1B real-time extensions options KBD_INSTALL_CDEV # install a CDEV entry in /dev options PREEMPTION +options PLATFORM options FREEBSD_BOOT_LOADER options VFP # vfp/neon -# Debugging +# Debugging for use in -current makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols options BREAK_TO_DEBUGGER #options VERBOSE_SYSINIT # Enable verbose sysinit messages @@ -78,12 +79,17 @@ options NFSLOCKD #options BOOTP_NFSV3 #options BOOTP_WIRED_TO=cpsw0 - -# MMC/SD/SDIO card slot support +# MMC/SD/SDIO Card slot support device mmc # mmc/sd bus device mmcsd # mmc/sd flash cards device sdhci # mmc/sd host controller +# I2C support +device iicbus +device iic +device ti_i2c +device am335x_pmic # AM335x Power Management IC (TPC65217) + # Boot device is 2nd slice on MMC/SD card options ROOTDEVNAME=\"ufs:mmcsd0s2\" @@ -95,12 +101,6 @@ device snp device md device random # Entropy device -# I2C support -device iicbus -device iic -device ti_i2c -device am335x_pmic # AM335x Power Management IC (TPC65217) - # GPIO device gpio device gpioled @@ -110,7 +110,7 @@ device ti_adc # USB support device usb -options USB_HOST_ALIGN=64 # Cacheline size is 64 on AM335x. +options USB_HOST_ALIGN=64 # Align usb buffers to cache line size. options USB_DEBUG #options USB_REQ_DEBUG #options USB_VERBOSE @@ -127,7 +127,7 @@ device smscphy device cpsw device bpf -# USB ethernet support, requires miibus +# USB Ethernet support, requires miibus device miibus device axe # ASIX Electronics USB Ethernet diff --git a/sys/arm/conf/CHROMEBOOK b/sys/arm/conf/CHROMEBOOK index ea69035f332..d187f1f43f8 100644 --- a/sys/arm/conf/CHROMEBOOK +++ b/sys/arm/conf/CHROMEBOOK @@ -1,4 +1,4 @@ -# Kernel configuration for Samsung Chromebook (Exynos5 Dual machine). +# Kernel configuration for Chromebook (Exynos5 Dual machine). # # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: @@ -17,7 +17,7 @@ # # $FreeBSD$ -include "EXYNOS5250.common" +include "EXYNOS5250" ident CHROMEBOOK hints "CHROMEBOOK.hints" @@ -34,5 +34,3 @@ device ukbd #FDT options FDT -options FDT_DTB_STATIC -makeoptions FDT_DTS_FILE=exynos5250-chromebook.dts diff --git a/sys/arm/conf/CHROMEBOOK-SNOW b/sys/arm/conf/CHROMEBOOK-SNOW new file mode 100644 index 00000000000..eaab60e1c75 --- /dev/null +++ b/sys/arm/conf/CHROMEBOOK-SNOW @@ -0,0 +1,28 @@ +# Kernel configuration for Samsung Chromebook (Exynos5 Dual machine). +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# +# $FreeBSD$ + +#NO_UNIVERSE + +include "CHROMEBOOK" +ident CHROMEBOOK-SNOW + +#FDT +options FDT +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=exynos5250-chromebook-snow.dts diff --git a/sys/arm/conf/CHROMEBOOK-SPRING b/sys/arm/conf/CHROMEBOOK-SPRING new file mode 100644 index 00000000000..b2f00bce1a0 --- /dev/null +++ b/sys/arm/conf/CHROMEBOOK-SPRING @@ -0,0 +1,28 @@ +# Kernel configuration for HP Chromebook 11 (Exynos5 Dual machine). +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# +# $FreeBSD$ + +#NO_UNIVERSE + +include "CHROMEBOOK" +ident CHROMEBOOK-SPRING + +#FDT +options FDT +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=exynos5250-chromebook-spring.dts diff --git a/sys/arm/conf/EXYNOS5250.common b/sys/arm/conf/EXYNOS5.common similarity index 97% rename from sys/arm/conf/EXYNOS5250.common rename to sys/arm/conf/EXYNOS5.common index 474cb6bed6f..8886b46654e 100644 --- a/sys/arm/conf/EXYNOS5250.common +++ b/sys/arm/conf/EXYNOS5.common @@ -1,4 +1,4 @@ -# Kernel configuration for Samsung Exynos 5250 boards. +# Kernel configuration for Samsung Exynos 5 SoC. # # For more information on this file, please read the config(5) manual page, # and/or the handbook section on Kernel Configuration Files: @@ -17,8 +17,6 @@ # # $FreeBSD$ -include "../samsung/exynos/std.exynos5" - makeoptions MODULES_OVERRIDE="" makeoptions WITHOUT_MODULES="ahc" @@ -31,6 +29,7 @@ options INET # InterNETworking options INET6 # IPv6 communications protocols options GEOM_PART_BSD # BSD partition scheme options GEOM_PART_MBR # MBR partition scheme +options GEOM_PART_GPT # GUID partition tables options TMPFS # Efficient memory filesystem options FFS # Berkeley Fast Filesystem options SOFTUPDATES @@ -52,6 +51,8 @@ options PREEMPTION options FREEBSD_BOOT_LOADER options VFP # vfp/neon +options SMP + # Debugging makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols options BREAK_TO_DEBUGGER @@ -83,8 +84,6 @@ device sdhci # generic sdhci options ROOTDEVNAME=\"ufs:/dev/da0\" -#options SMP - # Pseudo devices device loop diff --git a/sys/arm/conf/EXYNOS5250 b/sys/arm/conf/EXYNOS5250 new file mode 100644 index 00000000000..156d8564eba --- /dev/null +++ b/sys/arm/conf/EXYNOS5250 @@ -0,0 +1,25 @@ +# Kernel configuration for Samsung Exynos 5250 boards. +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# +# $FreeBSD$ + +ident EXYNOS5250 +include "EXYNOS5.common" +include "../samsung/exynos/std.exynos5250" + +#FDT +options FDT diff --git a/sys/arm/conf/EXYNOS5420 b/sys/arm/conf/EXYNOS5420 new file mode 100644 index 00000000000..0f2c2c780a8 --- /dev/null +++ b/sys/arm/conf/EXYNOS5420 @@ -0,0 +1,25 @@ +# Kernel configuration for Samsung Exynos 5420 boards. +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# +# $FreeBSD$ + +ident EXYNOS5420 +include "EXYNOS5.common" +include "../samsung/exynos/std.exynos5420" + +#FDT +options FDT diff --git a/sys/arm/conf/IMX6 b/sys/arm/conf/IMX6 index 47819c419d0..7aacff23c47 100644 --- a/sys/arm/conf/IMX6 +++ b/sys/arm/conf/IMX6 @@ -82,6 +82,9 @@ device miibus # Required for ethernet device bpf # Berkeley packet filter (required for DHCP) #device iomux # IO Multiplexor +# General-purpose input/output +device gpio + # Serial (COM) ports device uart # Multi-uart driver @@ -106,7 +109,7 @@ device u3g # USB modems #device ukbd # Allow keyboard like HIDs to control console #device ums # USB mouse -# USB Ethernet, requires miibus +# USB Ethernet, requires miibus #device aue # ADMtek USB Ethernet #device axe # ASIX Electronics USB Ethernet #device cdce # Generic USB over Ethernet @@ -151,8 +154,8 @@ options FREEBSD_BOOT_LOADER # Process metadata passed from loader(8) # SoC-specific devices device ffec # Freescale Fast Ethernet Controller -#device fsliic # Freescale i2c/iic (not ready yet) -#device iic # iic protocol -#device iicbus # iic bus +device fsliic # Freescale i2c/iic +device iic # iic protocol +device iicbus # iic bus #device imxwdt # Watchdog. WARNING: can't be disabled!!! diff --git a/sys/arm/conf/PANDABOARD b/sys/arm/conf/PANDABOARD index 2a35b48de0b..473b47138d7 100644 --- a/sys/arm/conf/PANDABOARD +++ b/sys/arm/conf/PANDABOARD @@ -12,31 +12,27 @@ # latest information. # # An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # # $FreeBSD$ ident PANDABOARD - - # This probably wants to move somewhere else. Maybe we can create a basic # OMAP4340 config, then make a PANDABOARD config that includes the basic one, # adds the start addresses and custom devices plus pulls in this hints file. -hints "PANDABOARD.hints" +hints "PANDABOARD.hints" -include "../ti/omap4/pandaboard/std.pandaboard" +include "../ti/omap4/pandaboard/std.pandaboard" #To statically compile in device wiring instead of /boot/device.hints makeoptions MODULES_OVERRIDE="" makeoptions WITHOUT_MODULES="ahc" -makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols options HZ=100 - options SCHED_4BSD # 4BSD scheduler options INET # InterNETworking #options INET6 # IPv6 communications protocols @@ -44,16 +40,6 @@ options FFS # Berkeley Fast Filesystem options SOFTUPDATES # Enable FFS soft updates support options UFS_ACL # Support for access control lists options UFS_DIRHASH # Improve performance on big directories -device snp -options BREAK_TO_DEBUGGER - -options NFSCL -options NFS_ROOT # NFS usable as /, requires NFSCLIENT -#options BOOTP_NFSROOT -#options BOOTP_COMPAT -#options BOOTP -#options BOOTP_NFSV3 -#options BOOTP_WIRED_TO=ue0 options GEOM_PART_BSD # BSD partition scheme options GEOM_PART_MBR # MBR partition scheme options TMPFS # Efficient memory filesystem @@ -69,9 +55,34 @@ options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # Posix P1003_1B real-time extensions options KBD_INSTALL_CDEV # install a CDEV entry in /dev -options FREEBSD_BOOT_LOADER - options PREEMPTION +options PLATFORM +options FREEBSD_BOOT_LOADER +options VFP # vfp/neon +options SMP # Enable multiple cores + +# Debugging for use in -current +makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols +options BREAK_TO_DEBUGGER +#options VERBOSE_SYSINIT # Enable verbose sysinit messages +options KDB +options DDB # Enable the kernel debugger +#options INVARIANTS # Enable calls of extra sanity checking +#options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS +#options WITNESS # Enable checks to detect deadlocks and cycles +#options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed +#options DIAGNOSTIC + +# NFS support +options NFSCL + +# NFS root +options NFS_ROOT # NFS usable as /, requires NFSCLIENT +#options BOOTP_NFSROOT +#options BOOTP_COMPAT +#options BOOTP +#options BOOTP_NFSV3 +#options BOOTP_WIRED_TO=ue0 # MMC/SD/SDIO Card slot support device mmc # mmc/sd bus @@ -83,41 +94,28 @@ device iicbus device iic device ti_i2c -device loop -device ether -device mii -device smc -device smcphy +# Console and misc device uart device uart_ns8250 - -device gpio - device pty - -device pl310 # PL310 L2 cache controller -# Debugging for use in -current -#options VERBOSE_SYSINIT # Enable verbose sysinit messages -options KDB -options DDB # Enable the kernel debugger -#options INVARIANTS # Enable calls of extra sanity checking -#options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS -#options WITNESS # Enable checks to detect deadlocks and cycles -#options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed -#options DIAGNOSTIC - +device snp device md +device random # Entropy device +device pl310 # PL310 L2 cache controller + +# GPIO +device gpio # The following enables MFS as root, this seems similar to an initramfs or initrd # as used in Linux. #options MD_ROOT #options MD_ROOT_SIZE=7560 -device random # Entropy device + # USB support -options USB_HOST_ALIGN=64 # Align usb buffers to cache line size. device usb +options USB_HOST_ALIGN=64 # Align usb buffers to cache line size. options USB_DEBUG #options USB_REQ_DEBUG #options USB_VERBOSE @@ -127,12 +125,19 @@ device umass device scbus # SCSI bus (required for SCSI) device da # Direct Access (disks) +# Ethernet +device loop +device ether +device mii +device smc +device smcphy +device bpf # USB Ethernet support, requires miibus device miibus #device axe # ASIX Electronics USB Ethernet device smsc # SMSC LAN95xx USB Ethernet -device bpf + # OMAP-specific devices device ti_sdma @@ -144,6 +149,3 @@ device twl_clks options FDT options FDT_DTB_STATIC makeoptions FDT_DTS_FILE=pandaboard.dts - -options VFP # vfp/neon -options SMP # Enable multiple cores diff --git a/sys/arm/conf/RADXA b/sys/arm/conf/RADXA index 997efc37877..ad5eadfae41 100644 --- a/sys/arm/conf/RADXA +++ b/sys/arm/conf/RADXA @@ -18,106 +18,12 @@ # # $FreeBSD$ +#NO_UNIVERSE + +include "RK3188" ident RADXA -include "../rockchip/std.rk30xx" - -makeoptions MODULES_OVERRIDE="" -makeoptions WITHOUT_MODULES="ahc" - -options HZ=100 -options SCHED_4BSD # 4BSD scheduler -options INET # InterNETworking -options INET6 # IPv6 communications protocols -options FFS # Berkeley Fast Filesystem -options SOFTUPDATES # Enable FFS soft updates support -options UFS_ACL # Support for access control lists -options UFS_DIRHASH # Improve performance on big directories -options GEOM_PART_BSD # BSD partition scheme -options GEOM_PART_MBR # MBR partition scheme -options TMPFS # Efficient memory filesystem -options MSDOSFS # MSDOS Filesystem -options CD9660 # ISO 9660 Filesystem -options PROCFS # Process filesystem (requires PSEUDOFS) -options PSEUDOFS # Pseudo-filesystem framework -options COMPAT_43 # Compatible with BSD 4.3 [KEEP THIS!] -options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI -options KTRACE # ktrace(1) support -options SYSVSHM # SYSV-style shared memory -options SYSVMSG # SYSV-style message queues -options SYSVSEM # SYSV-style semaphores -options _KPOSIX_PRIORITY_SCHEDULING # Posix P1003_1B real-time extensions -options KBD_INSTALL_CDEV # install a CDEV entry in /dev -options PREEMPTION -options FREEBSD_BOOT_LOADER -options VFP # vfp/neon - -# Debugging -makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols -options BREAK_TO_DEBUGGER -#options VERBOSE_SYSINIT # Enable verbose sysinit messages -options KDB -options DDB # Enable the kernel debugger -#options INVARIANTS # Enable calls of extra sanity checking -#options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS -options WITNESS # Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed -options DIAGNOSTIC - -# NFS support -#options NFSCL -#options NFSSERVER # Network Filesystem Server -#options NFSCLIENT # Network Filesystem Client - -# MMC/SD/SDIO card slot support -#device mmc # mmc/sd bus -#device mmcsd # mmc/sd flash cards - -# Boot device is 2nd slice on MMC/SD card -options ROOTDEVNAME=\"ufs:/dev/da0s2\" - -# Console and misc -device uart -device uart_ns8250 -device pty -device snp -device md -device random # Entropy device - -# I2C support -#device iicbus -#device iic - -# GPIO -device gpio - -device scbus # SCSI bus (required for SCSI) -device da # Direct Access (disks) -device pass - -# USB support -options USB_HOST_ALIGN=32 # Align usb buffers to cache line size. -device usb -options USB_DEBUG -#options USB_REQ_DEBUG -#options USB_VERBOSE -device dwcotg # DWC OTG controller - -device umass - -# Ethernet -device loop -device ether -device mii -device smscphy -device bpf - -# USB ethernet support, requires miibus -device miibus -device udav - # Flattened Device Tree options FDT options FDT_DTB_STATIC makeoptions FDT_DTS_FILE=rk3188-radxa.dts - diff --git a/sys/arm/conf/RADXA-LITE b/sys/arm/conf/RADXA-LITE new file mode 100644 index 00000000000..c07462d9b58 --- /dev/null +++ b/sys/arm/conf/RADXA-LITE @@ -0,0 +1,29 @@ +# RADXA-LITE -- Custom configuration for the RADXA LITE ARM development +# platform, check out http://www.radxa.com +# +# For more information on this file, please read the handbook section on +# Kernel Configuration Files: +# +# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# +# $FreeBSD$ + +#NO_UNIVERSE + +include "RK3188" +ident RADXA-LITE + +# Flattened Device Tree +options FDT +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=rk3188-radxa-lite.dts diff --git a/sys/arm/conf/RK3188 b/sys/arm/conf/RK3188 new file mode 100644 index 00000000000..e321f2ab66f --- /dev/null +++ b/sys/arm/conf/RK3188 @@ -0,0 +1,128 @@ +# Kernel configuration for Rockchip RK3188 systems. +# +# For more information on this file, please read the handbook section on +# Kernel Configuration Files: +# +# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# +# $FreeBSD$ + +ident RK3188 + +include "../rockchip/std.rk30xx" + +options HZ=100 +options SCHED_4BSD # 4BSD scheduler +options INET # InterNETworking +options INET6 # IPv6 communications protocols +options FFS # Berkeley Fast Filesystem +options SOFTUPDATES # Enable FFS soft updates support +options UFS_ACL # Support for access control lists +options UFS_DIRHASH # Improve performance on big directories +options GEOM_PART_BSD # BSD partition scheme +options GEOM_PART_MBR # MBR partition scheme +options TMPFS # Efficient memory filesystem +options MSDOSFS # MSDOS Filesystem +options CD9660 # ISO 9660 Filesystem +options PROCFS # Process filesystem (requires PSEUDOFS) +options PSEUDOFS # Pseudo-filesystem framework +options COMPAT_43 # Compatible with BSD 4.3 [KEEP THIS!] +options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI +options KTRACE # ktrace(1) support +options SYSVSHM # SYSV-style shared memory +options SYSVMSG # SYSV-style message queues +options SYSVSEM # SYSV-style semaphores +options _KPOSIX_PRIORITY_SCHEDULING # Posix P1003_1B real-time extensions +options KBD_INSTALL_CDEV # install a CDEV entry in /dev +options PREEMPTION +options FREEBSD_BOOT_LOADER +options VFP # vfp/neon +options SMP # Enable multiple cores + +# Debugging +makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols +options BREAK_TO_DEBUGGER +#options VERBOSE_SYSINIT # Enable verbose sysinit messages +options KDB +options DDB # Enable the kernel debugger +#options INVARIANTS # Enable calls of extra sanity checking +#options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS +options WITNESS # Enable checks to detect deadlocks and cycles +options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed +options DIAGNOSTIC + +# NFS support +#options NFSCL +#options NFSSERVER # Network Filesystem Server +#options NFSCLIENT # Network Filesystem Client + +# MMC/SD/SDIO card slot support +#device mmc # mmc/sd bus +#device mmcsd # mmc/sd flash cards + +# Boot device is 2nd slice on USB +options ROOTDEVNAME=\"ufs:/dev/da0s2\" + +# Console and misc +device uart +device uart_ns8250 +device pty +device snp +device md +device random # Entropy device + +# I2C support +#device iicbus +#device iic + +# GPIO +device gpio + +device scbus # SCSI bus (required for SCSI) +device da # Direct Access (disks) +device pass + +# USB support +options USB_HOST_ALIGN=32 # Align usb buffers to cache line size. +device usb +options USB_DEBUG +#options USB_REQ_DEBUG +#options USB_VERBOSE +device dwcotg # DWC OTG controller + +device umass + +# Ethernet +device loop +device ether +device mii +device bpf + +# Wireless NIC cards +options IEEE80211_DEBUG +options IEEE80211_AMPDU_AGE +options IEEE80211_SUPPORT_MESH +options IEEE80211_SUPPORT_TDMA +device wlan # 802.11 support +device wlan_wep # 802.11 WEP support +device wlan_ccmp # 802.11 CCMP support +device wlan_tkip # 802.11 TKIP support +device urtwn +device urtwnfw +device firmware # Used by the above + +# USB ethernet support, requires miibus +device miibus +device udav + +options FDT # Configure using FDT/DTB data. diff --git a/sys/arm/conf/RPI-B b/sys/arm/conf/RPI-B index c2b8e0d8ee7..57775d1a71c 100644 --- a/sys/arm/conf/RPI-B +++ b/sys/arm/conf/RPI-B @@ -59,6 +59,7 @@ options KBD_INSTALL_CDEV # install a CDEV entry in /dev #options ROOTDEVNAME=\"ufs:mmcsd0s2\" options PREEMPTION +options PLATFORM device bpf device loop diff --git a/sys/arm/conf/VYBRID b/sys/arm/conf/VYBRID index 43cdac5940c..ca2d93d8e09 100644 --- a/sys/arm/conf/VYBRID +++ b/sys/arm/conf/VYBRID @@ -141,6 +141,10 @@ device bpf # Berkeley packet filter device sound +# SPI +device spibus +device vf_spi + # Framebuffer device vt device kbdmux diff --git a/sys/arm/conf/ZEDBOARD b/sys/arm/conf/ZEDBOARD index 99a2272b75e..9b079af359f 100644 --- a/sys/arm/conf/ZEDBOARD +++ b/sys/arm/conf/ZEDBOARD @@ -59,7 +59,7 @@ options VFP # vfp/neon options SMP # Symmetric MultiProcessor Kernel # Debugging -makeoptions DEBUG=-g +makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols options DDB options KDB # options BREAK_TO_DEBUGGER diff --git a/sys/arm/freescale/imx/files.imx51 b/sys/arm/freescale/imx/files.imx51 index 49aeceb6d04..17ae33ed17d 100644 --- a/sys/arm/freescale/imx/files.imx51 +++ b/sys/arm/freescale/imx/files.imx51 @@ -22,7 +22,7 @@ arm/freescale/imx/tzic.c standard arm/freescale/imx/imx51_iomux.c optional iomux # GPIO -arm/freescale/imx/imx51_gpio.c optional gpio +arm/freescale/imx/imx_gpio.c optional gpio # Generic Periodic Timer arm/freescale/imx/imx_gpt.c standard @@ -44,7 +44,7 @@ dev/usb/controller/ehci_imx.c optional ehci arm/freescale/imx/imx_wdog.c optional imxwdt # i2c -arm/freescale/imx/i2c.c optional fsliic +arm/freescale/imx/imx_i2c.c optional fsliic # IPU - Image Processing Unit (frame buffer also) arm/freescale/imx/imx51_ipuv3.c optional sc diff --git a/sys/arm/freescale/imx/files.imx53 b/sys/arm/freescale/imx/files.imx53 index ef594a73bfe..301ea784c14 100644 --- a/sys/arm/freescale/imx/files.imx53 +++ b/sys/arm/freescale/imx/files.imx53 @@ -25,7 +25,7 @@ arm/freescale/imx/tzic.c standard arm/freescale/imx/imx51_iomux.c optional iomux # GPIO -arm/freescale/imx/imx51_gpio.c optional gpio +arm/freescale/imx/imx_gpio.c optional gpio # Generic Periodic Timer arm/freescale/imx/imx_gpt.c standard @@ -47,7 +47,7 @@ dev/usb/controller/ehci_imx.c optional ehci arm/freescale/imx/imx_wdog.c optional imxwdt # i2c -arm/freescale/imx/i2c.c optional fsliic +arm/freescale/imx/imx_i2c.c optional fsliic # IPU - Image Processing Unit (frame buffer also) arm/freescale/imx/imx51_ipuv3.c optional sc diff --git a/sys/arm/freescale/imx/files.imx6 b/sys/arm/freescale/imx/files.imx6 index be9b8a3970b..0074be55bd2 100644 --- a/sys/arm/freescale/imx/files.imx6 +++ b/sys/arm/freescale/imx/files.imx6 @@ -26,6 +26,8 @@ arm/freescale/imx/imx6_mp.c optional smp arm/freescale/imx/imx6_pl310.c standard arm/freescale/imx/imx_machdep.c standard arm/freescale/imx/imx_gpt.c standard +arm/freescale/imx/imx_gpio.c optional gpio +arm/freescale/imx/imx_i2c.c optional fsliic # # Optional devices. @@ -50,8 +52,5 @@ arm/freescale/imx/imx6_usbphy.c optional ehci # Not ready yet... # #arm/freescale/imx/imx51_iomux.c optional iomux -#arm/freescale/imx/imx51_gpio.c optional gpio #dev/ata/chipsets/ata-fsl.c optional imxata -#arm/freescale/imx/i2c.c optional fsliic #arm/freescale/imx/imx51_ipuv3.c optional sc - diff --git a/sys/arm/freescale/imx/imx51_machdep.c b/sys/arm/freescale/imx/imx51_machdep.c index 53a722ada30..8ab6541e2e4 100644 --- a/sys/arm/freescale/imx/imx51_machdep.c +++ b/sys/arm/freescale/imx/imx51_machdep.c @@ -39,18 +39,19 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include vm_offset_t -initarm_lastaddr(void) +platform_lastaddr(void) { return (arm_devmap_lastaddr()); } void -initarm_early_init(void) +platform_probe_and_attach(void) { /* XXX - Get rid of this stuff soon. */ @@ -59,13 +60,13 @@ initarm_early_init(void) } void -initarm_gpio_init(void) +platform_gpio_init(void) { } void -initarm_late_init(void) +platform_late_init(void) { } @@ -78,7 +79,7 @@ initarm_late_init(void) * Notably missing are entries for GPU, IPU, in general anything video related. */ int -initarm_devmap_init(void) +platform_devmap_init(void) { arm_devmap_add_entry(0x70000000, 0x00100000); diff --git a/sys/arm/freescale/imx/imx53_machdep.c b/sys/arm/freescale/imx/imx53_machdep.c index 50d8d5240ba..ebf09d9af8b 100644 --- a/sys/arm/freescale/imx/imx53_machdep.c +++ b/sys/arm/freescale/imx/imx53_machdep.c @@ -39,17 +39,19 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include + #include vm_offset_t -initarm_lastaddr(void) +platform_lastaddr(void) { return (arm_devmap_lastaddr()); } void -initarm_early_init(void) +platform_probe_and_attach(void) { /* XXX - Get rid of this stuff soon. */ @@ -58,13 +60,13 @@ initarm_early_init(void) } void -initarm_gpio_init(void) +platform_gpio_init(void) { } void -initarm_late_init(void) +platform_late_init(void) { } @@ -77,7 +79,7 @@ initarm_late_init(void) * Notably missing are entries for GPU, IPU, in general anything video related. */ int -initarm_devmap_init(void) +platform_devmap_init(void) { arm_devmap_add_entry(0x50000000, 0x00100000); diff --git a/sys/arm/freescale/imx/imx6_anatop.c b/sys/arm/freescale/imx/imx6_anatop.c index b1757fbdf1a..30978381b8f 100644 --- a/sys/arm/freescale/imx/imx6_anatop.c +++ b/sys/arm/freescale/imx/imx6_anatop.c @@ -375,12 +375,12 @@ cpufreq_initialize(struct imx6_anatop_softc *sc) "CPU frequency"); SYSCTL_ADD_PROC(NULL, SYSCTL_STATIC_CHILDREN(_hw_imx6), - OID_AUTO, "cpu_minmhz", CTLTYPE_INT | CTLFLAG_RWTUN, sc, 0, - cpufreq_sysctl_minmhz, "IU", "Minimum CPU frequency"); + OID_AUTO, "cpu_minmhz", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NOFETCH, + sc, 0, cpufreq_sysctl_minmhz, "IU", "Minimum CPU frequency"); SYSCTL_ADD_PROC(NULL, SYSCTL_STATIC_CHILDREN(_hw_imx6), - OID_AUTO, "cpu_maxmhz", CTLTYPE_INT | CTLFLAG_RWTUN, sc, 0, - cpufreq_sysctl_maxmhz, "IU", "Maximum CPU frequency"); + OID_AUTO, "cpu_maxmhz", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NOFETCH, + sc, 0, cpufreq_sysctl_maxmhz, "IU", "Maximum CPU frequency"); SYSCTL_ADD_INT(NULL, SYSCTL_STATIC_CHILDREN(_hw_imx6), OID_AUTO, "cpu_maxmhz_hw", CTLFLAG_RD, &sc->cpu_maxmhz_hw, 0, @@ -413,9 +413,6 @@ cpufreq_initialize(struct imx6_anatop_softc *sc) sc->cpu_maxmhz_hw = imx6_ocotp_mhz_tab[cfg3speed]; sc->cpu_maxmhz = sc->cpu_maxmhz_hw; - TUNABLE_INT_FETCH("hw.imx6.cpu_overclock_enable", - &sc->cpu_overclock_enable); - TUNABLE_INT_FETCH("hw.imx6.cpu_minmhz", &sc->cpu_minmhz); op = cpufreq_nearest_oppt(sc, sc->cpu_minmhz); sc->cpu_minmhz = op->mhz; diff --git a/sys/arm/freescale/imx/imx6_machdep.c b/sys/arm/freescale/imx/imx6_machdep.c index c1074d02e95..eb69eda0f2c 100644 --- a/sys/arm/freescale/imx/imx6_machdep.c +++ b/sys/arm/freescale/imx/imx6_machdep.c @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -46,14 +47,14 @@ __FBSDID("$FreeBSD$"); #include vm_offset_t -initarm_lastaddr(void) +platform_lastaddr(void) { return (arm_devmap_lastaddr()); } void -initarm_early_init(void) +platform_probe_and_attach(void) { /* Inform the MPCore timer driver that its clock is variable. */ @@ -61,13 +62,13 @@ initarm_early_init(void) } void -initarm_gpio_init(void) +platform_gpio_init(void) { } void -initarm_late_init(void) +platform_late_init(void) { } @@ -89,7 +90,7 @@ initarm_late_init(void) * as OCRAM that probably shouldn't be mapped as PTE_DEVICE memory. */ int -initarm_devmap_init(void) +platform_devmap_init(void) { const uint32_t IMX6_ARMMP_PHYS = 0x00a00000; const uint32_t IMX6_ARMMP_SIZE = 0x00100000; diff --git a/sys/arm/freescale/imx/imx6_mp.c b/sys/arm/freescale/imx/imx6_mp.c index dfa435bc149..e6366dd9b8a 100644 --- a/sys/arm/freescale/imx/imx6_mp.c +++ b/sys/arm/freescale/imx/imx6_mp.c @@ -162,7 +162,7 @@ platform_mp_start_ap(void) ( 1 << (SRC_CONTROL_C1RST_SHIFT - 1 + i))); } - bus_space_write_4(fdtbus_bs_tag, src, 0, val); + bus_space_write_4(fdtbus_bs_tag, src, SRC_CONTROL_REG, val); armv7_sev(); diff --git a/sys/arm/freescale/imx/imx51_gpio.c b/sys/arm/freescale/imx/imx_gpio.c similarity index 97% rename from sys/arm/freescale/imx/imx51_gpio.c rename to sys/arm/freescale/imx/imx_gpio.c index 1c1eed18875..95e24ca0378 100644 --- a/sys/arm/freescale/imx/imx51_gpio.c +++ b/sys/arm/freescale/imx/imx_gpio.c @@ -102,6 +102,13 @@ struct imx51_gpio_softc { struct gpio_pin gpio_pins[NGPIO]; }; +static struct ofw_compat_data compat_data[] = { + {"fsl,imx6q-gpio", 1}, + {"fsl,imx53-gpio", 1}, + {"fsl,imx51-gpio", 1}, + {NULL, 0} +}; + static struct resource_spec imx_gpio_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, { SYS_RES_IRQ, 0, RF_ACTIVE }, @@ -355,7 +362,7 @@ imx51_gpio_intr(void *arg) sc = arg; input = READ4(sc, IMX_GPIO_ISR_REG); value = input & READ4(sc, IMX_GPIO_IMR_REG); - WRITE4(sc, IMX_GPIO_DR_REG, input); + WRITE4(sc, IMX_GPIO_ISR_REG, input); if (!value) goto intr_done; @@ -373,9 +380,8 @@ imx51_gpio_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (ofw_bus_is_compatible(dev, "fsl,imx51-gpio") || - ofw_bus_is_compatible(dev, "fsl,imx53-gpio")) { - device_set_desc(dev, "i.MX515 GPIO Controller"); + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data != 0) { + device_set_desc(dev, "Freescale i.MX GPIO Controller"); return (BUS_PROBE_DEFAULT); } diff --git a/sys/arm/freescale/imx/i2c.c b/sys/arm/freescale/imx/imx_i2c.c similarity index 97% rename from sys/arm/freescale/imx/i2c.c rename to sys/arm/freescale/imx/imx_i2c.c index dd74a7dd847..3c192ead291 100644 --- a/sys/arm/freescale/imx/i2c.c +++ b/sys/arm/freescale/imx/imx_i2c.c @@ -86,6 +86,12 @@ __FBSDID("$FreeBSD$"); #define debugf(fmt, args...) #endif +static struct ofw_compat_data compat_data[] = { + {"fsl,imx6q-i2c", 1}, + {"fsl,imx-i2c", 1}, + {NULL, 0} +}; + struct i2c_softc { device_t dev; device_t iicbus; @@ -227,7 +233,7 @@ i2c_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (!ofw_bus_is_compatible(dev, "fsl,imx-i2c")) + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) return (ENXIO); sc = device_get_softc(dev); @@ -246,7 +252,7 @@ i2c_probe(device_t dev) /* Enable I2C */ i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN); bus_release_resource(dev, SYS_RES_MEMORY, sc->rid, sc->res); - device_set_desc(dev, "I2C bus controller"); + device_set_desc(dev, "Freescale i.MX I2C bus controller"); return (BUS_PROBE_DEFAULT); } diff --git a/sys/arm/freescale/imx/imx_sdhci.c b/sys/arm/freescale/imx/imx_sdhci.c index a476cb75cee..f7394d55881 100644 --- a/sys/arm/freescale/imx/imx_sdhci.c +++ b/sys/arm/freescale/imx/imx_sdhci.c @@ -153,7 +153,7 @@ static struct ofw_compat_data compat_data[] = { {"fsl,imx53-esdhc", HWTYPE_ESDHC}, {"fsl,imx51-esdhc", HWTYPE_ESDHC}, {NULL, HWTYPE_NONE}, -};; +}; static void imx_sdhc_set_clock(struct imx_sdhci_softc *sc, int enable); static void imx_sdhci_r1bfix_func(void *arg); diff --git a/sys/arm/freescale/vybrid/files.vybrid b/sys/arm/freescale/vybrid/files.vybrid index 81928c3fb5f..572a3ef1c4b 100644 --- a/sys/arm/freescale/vybrid/files.vybrid +++ b/sys/arm/freescale/vybrid/files.vybrid @@ -23,6 +23,7 @@ arm/freescale/vybrid/vf_src.c standard arm/freescale/vybrid/vf_edma.c standard arm/freescale/vybrid/vf_dmamux.c standard arm/freescale/vybrid/vf_port.c standard +arm/freescale/vybrid/vf_adc.c standard arm/freescale/vybrid/vf_i2c.c optional iicbus arm/freescale/vybrid/vf_tcon.c optional vt arm/freescale/vybrid/vf_dcu4.c optional vt @@ -31,4 +32,5 @@ arm/freescale/vybrid/vf_ehci.c optional ehci arm/freescale/vybrid/vf_gpio.c optional gpio arm/freescale/vybrid/vf_uart.c optional uart arm/freescale/vybrid/vf_sai.c optional sound +arm/freescale/vybrid/vf_spi.c optional vf_spi dev/ffec/if_ffec.c optional ffec diff --git a/sys/arm/freescale/vybrid/vf_adc.c b/sys/arm/freescale/vybrid/vf_adc.c new file mode 100644 index 00000000000..f497ec09f8b --- /dev/null +++ b/sys/arm/freescale/vybrid/vf_adc.c @@ -0,0 +1,245 @@ +/*- + * Copyright (c) 2014 Ruslan Bukin + * 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. + */ + +/* + * Vybrid Family 12-bit Analog to Digital Converter (ADC) + * Chapter 37, Vybrid Reference Manual, Rev. 5, 07/2013 + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#define ADC_HC0 0x00 /* Ctrl reg for hardware triggers */ +#define ADC_HC1 0x04 /* Ctrl reg for hardware triggers */ +#define HC_AIEN (1 << 7) /* Conversion Complete Int Control */ +#define HC_ADCH_M 0x1f /* Input Channel Select Mask */ +#define HC_ADCH_S 0 /* Input Channel Select Shift */ +#define ADC_HS 0x08 /* Status register for HW triggers */ +#define HS_COCO0 (1 << 0) /* Conversion Complete Flag */ +#define HS_COCO1 (1 << 1) /* Conversion Complete Flag */ +#define ADC_R0 0x0C /* Data result reg for HW triggers */ +#define ADC_R1 0x10 /* Data result reg for HW triggers */ +#define ADC_CFG 0x14 /* Configuration register */ +#define CFG_OVWREN (1 << 16) /* Data Overwrite Enable */ +#define CFG_AVGS_M 0x3 /* Hardware Average select Mask */ +#define CFG_AVGS_S 14 /* Hardware Average select Shift */ +#define CFG_ADTRG (1 << 13) /* Conversion Trigger Select */ +#define CFG_REFSEL_M 0x3 /* Voltage Reference Select Mask */ +#define CFG_REFSEL_S 11 /* Voltage Reference Select Shift */ +#define CFG_ADHSC (1 << 10) /* High Speed Configuration */ +#define CFG_ADSTS_M 0x3 /* Defines the sample time duration */ +#define CFG_ADSTS_S 8 /* Defines the sample time duration */ +#define CFG_ADLPC (1 << 7) /* Low-Power Configuration */ +#define CFG_ADIV_M 0x3 /* Clock Divide Select */ +#define CFG_ADIV_S 5 /* Clock Divide Select */ +#define CFG_ADLSMP (1 << 4) /* Long Sample Time Configuration */ +#define CFG_MODE_M 0x3 /* Conversion Mode Selection Mask */ +#define CFG_MODE_S 2 /* Conversion Mode Selection Shift */ +#define CFG_MODE_12 0x2 /* 12-bit mode */ +#define CFG_ADICLK_M 0x3 /* Input Clock Select Mask */ +#define CFG_ADICLK_S 0 /* Input Clock Select Shift */ +#define ADC_GC 0x18 /* General control register */ +#define GC_CAL (1 << 7) /* Calibration */ +#define GC_ADCO (1 << 6) /* Continuous Conversion Enable */ +#define GC_AVGE (1 << 5) /* Hardware average enable */ +#define GC_ACFE (1 << 4) /* Compare Function Enable */ +#define GC_ACFGT (1 << 3) /* Compare Function Greater Than En */ +#define GC_ACREN (1 << 2) /* Compare Function Range En */ +#define GC_DMAEN (1 << 1) /* DMA Enable */ +#define GC_ADACKEN (1 << 0) /* Asynchronous clock output enable */ +#define ADC_GS 0x1C /* General status register */ +#define GS_AWKST (1 << 2) /* Asynchronous wakeup int status */ +#define GS_CALF (1 << 1) /* Calibration Failed Flag */ +#define GS_ADACT (1 << 0) /* Conversion Active */ +#define ADC_CV 0x20 /* Compare value register */ +#define CV_CV2_M 0xfff /* Compare Value 2 Mask */ +#define CV_CV2_S 16 /* Compare Value 2 Shift */ +#define CV_CV1_M 0xfff /* Compare Value 1 Mask */ +#define CV_CV1_S 0 /* Compare Value 1 Shift */ +#define ADC_OFS 0x24 /* Offset correction value register */ +#define OFS_SIGN 12 /* Sign bit */ +#define OFS_M 0xfff /* Offset value Mask */ +#define OFS_S 0 /* Offset value Shift */ +#define ADC_CAL 0x28 /* Calibration value register */ +#define CAL_CODE_M 0xf /* Calibration Result Value Mask */ +#define CAL_CODE_S 0 /* Calibration Result Value Shift */ +#define ADC_PCTL 0x30 /* Pin control register */ + +struct adc_softc { + struct resource *res[2]; + bus_space_tag_t bst; + bus_space_handle_t bsh; + void *ih; +}; + +struct adc_softc *adc_sc; + +static struct resource_spec adc_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { SYS_RES_IRQ, 0, RF_ACTIVE }, + { -1, 0 } +}; + +static int +adc_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "fsl,mvf600-adc")) + return (ENXIO); + + device_set_desc(dev, "Vybrid Family " + "12-bit Analog to Digital Converter"); + return (BUS_PROBE_DEFAULT); +} + +static void +adc_intr(void *arg) +{ + struct adc_softc *sc; + + sc = arg; + + /* Conversation complete */ +} + +uint32_t +adc_read(void) +{ + struct adc_softc *sc; + + sc = adc_sc; + if (sc == NULL) + return (0); + + return (READ4(sc, ADC_R0)); +} + +uint32_t +adc_enable(int channel) +{ + struct adc_softc *sc; + int reg; + + sc = adc_sc; + if (sc == NULL) + return (1); + + reg = READ4(sc, ADC_HC0); + reg &= ~(HC_ADCH_M << HC_ADCH_S); + reg |= (channel << HC_ADCH_S); + WRITE4(sc, ADC_HC0, reg); + + return (0); +} + +static int +adc_attach(device_t dev) +{ + struct adc_softc *sc; + int err; + int reg; + + sc = device_get_softc(dev); + + if (bus_alloc_resources(dev, adc_spec, sc->res)) { + device_printf(dev, "could not allocate resources\n"); + return (ENXIO); + } + + /* Memory interface */ + sc->bst = rman_get_bustag(sc->res[0]); + sc->bsh = rman_get_bushandle(sc->res[0]); + + adc_sc = sc; + + /* Setup interrupt handler */ + err = bus_setup_intr(dev, sc->res[1], INTR_TYPE_BIO | INTR_MPSAFE, + NULL, adc_intr, sc, &sc->ih); + if (err) { + device_printf(dev, "Unable to alloc interrupt resource.\n"); + return (ENXIO); + } + + /* Configure 12-bit mode */ + reg = READ4(sc, ADC_CFG); + reg &= ~(CFG_MODE_M << CFG_MODE_S); + reg |= (CFG_MODE_12 << CFG_MODE_S); /* 12bit */ + WRITE4(sc, ADC_CFG, reg); + + /* Configure for continuous conversion */ + reg = READ4(sc, ADC_GC); + reg |= (GC_ADCO | GC_AVGE); + WRITE4(sc, ADC_GC, reg); + + /* Disable interrupts */ + reg = READ4(sc, ADC_HC0); + reg &= HC_AIEN; + WRITE4(sc, ADC_HC0, reg); + + return (0); +} + +static device_method_t adc_methods[] = { + DEVMETHOD(device_probe, adc_probe), + DEVMETHOD(device_attach, adc_attach), + { 0, 0 } +}; + +static driver_t adc_driver = { + "adc", + adc_methods, + sizeof(struct adc_softc), +}; + +static devclass_t adc_devclass; + +DRIVER_MODULE(adc, simplebus, adc_driver, adc_devclass, 0, 0); diff --git a/sys/boot/ia64/ski/delay.c b/sys/arm/freescale/vybrid/vf_adc.h similarity index 91% rename from sys/boot/ia64/ski/delay.c rename to sys/arm/freescale/vybrid/vf_adc.h index 2389603edb4..efb231f70a8 100644 --- a/sys/boot/ia64/ski/delay.c +++ b/sys/arm/freescale/vybrid/vf_adc.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2001 Doug Rabson + * Copyright (c) 2014 Ruslan Bukin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -22,13 +22,9 @@ * 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 -__FBSDID("$FreeBSD$"); - -void -delay(int usecs) -{ - return; -} +uint32_t adc_read(void); +uint32_t adc_enable(int); diff --git a/sys/arm/freescale/vybrid/vf_gpio.c b/sys/arm/freescale/vybrid/vf_gpio.c index 11db7951c72..686e05c5b91 100644 --- a/sys/arm/freescale/vybrid/vf_gpio.c +++ b/sys/arm/freescale/vybrid/vf_gpio.c @@ -242,7 +242,7 @@ vf_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val) return (EINVAL); GPIO_LOCK(sc); - *val = (READ4(sc, GPIO_PDOR(i)) & (1 << (i % 32))); + *val = (READ4(sc, GPIO_PDIR(i)) & (1 << (i % 32))) ? 1 : 0; GPIO_UNLOCK(sc); return (0); diff --git a/sys/arm/freescale/vybrid/vf_i2c.c b/sys/arm/freescale/vybrid/vf_i2c.c index 67254b4a0be..2eb67264a19 100644 --- a/sys/arm/freescale/vybrid/vf_i2c.c +++ b/sys/arm/freescale/vybrid/vf_i2c.c @@ -30,7 +30,7 @@ */ /* - * This driver is based on the I2C driver for IMX (imx/i2c.c). + * This driver is based on the I2C driver for i.MX */ #include diff --git a/sys/arm/freescale/vybrid/vf_machdep.c b/sys/arm/freescale/vybrid/vf_machdep.c index 29e7355ada1..76018dd7d7b 100644 --- a/sys/arm/freescale/vybrid/vf_machdep.c +++ b/sys/arm/freescale/vybrid/vf_machdep.c @@ -41,36 +41,37 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include vm_offset_t -initarm_lastaddr(void) +platform_lastaddr(void) { return (arm_devmap_lastaddr()); } void -initarm_early_init(void) +platform_probe_and_attach(void) { } void -initarm_gpio_init(void) +platform_gpio_init(void) { } void -initarm_late_init(void) +platform_late_init(void) { } int -initarm_devmap_init(void) +platform_devmap_init(void) { arm_devmap_add_entry(0x40000000, 0x100000); diff --git a/sys/arm/freescale/vybrid/vf_port.c b/sys/arm/freescale/vybrid/vf_port.c index 0e1a2db084a..1cc83edbb86 100644 --- a/sys/arm/freescale/vybrid/vf_port.c +++ b/sys/arm/freescale/vybrid/vf_port.c @@ -165,7 +165,7 @@ port_setup(int pnum, enum ev_type pevt, void (*ih)(void *), void *ih_user) val = PCR_INT_FE; break; case INT_EITHER_EDGE: - val = PCR_INT_RE; + val = PCR_INT_EE; break; case INT_LOGIC_ONE: val = PCR_INT_LO; diff --git a/sys/arm/freescale/vybrid/vf_spi.c b/sys/arm/freescale/vybrid/vf_spi.c new file mode 100644 index 00000000000..222b96f8921 --- /dev/null +++ b/sys/arm/freescale/vybrid/vf_spi.c @@ -0,0 +1,293 @@ +/*- + * Copyright (c) 2014 Ruslan Bukin + * 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. + */ + +/* + * Vybrid Family Serial Peripheral Interface (SPI) + * Chapter 47, Vybrid Reference Manual, Rev. 5, 07/2013 + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "spibus_if.h" + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#define SPI_FIFO_SIZE 4 + +#define SPI_MCR 0x00 /* Module Configuration */ +#define MCR_MSTR (1 << 31) /* Master/Slave Mode Select */ +#define MCR_CONT_SCKE (1 << 30) /* Continuous SCK Enable */ +#define MCR_FRZ (1 << 27) /* Freeze */ +#define MCR_PCSIS_S 16 /* Peripheral Chip Select */ +#define MCR_PCSIS_M 0x3f +#define MCR_MDIS (1 << 14) /* Module Disable */ +#define MCR_CLR_TXF (1 << 11) /* Clear TX FIFO */ +#define MCR_CLR_RXF (1 << 10) /* Clear RX FIFO */ +#define MCR_HALT (1 << 0) /* Starts and stops SPI transfers */ +#define SPI_TCR 0x08 /* Transfer Count */ +#define SPI_CTAR0 0x0C /* Clock and Transfer Attributes */ +#define SPI_CTAR0_SLAVE 0x0C /* Clock and Transfer Attributes */ +#define SPI_CTAR1 0x10 /* Clock and Transfer Attributes */ +#define SPI_CTAR2 0x14 /* Clock and Transfer Attributes */ +#define SPI_CTAR3 0x18 /* Clock and Transfer Attributes */ +#define CTAR_FMSZ_M 0xf +#define CTAR_FMSZ_S 27 /* Frame Size */ +#define CTAR_FMSZ_8 0x7 /* 8 bits */ +#define CTAR_CPOL (1 << 26) /* Clock Polarity */ +#define CTAR_CPHA (1 << 25) /* Clock Phase */ +#define CTAR_LSBFE (1 << 24) /* Less significant bit first */ +#define CTAR_PCSSCK_M 0x3 +#define CTAR_PCSSCK_S 22 /* PCS to SCK Delay Prescaler */ +#define CTAR_PBR_M 0x3 +#define CTAR_PBR_S 16 /* Baud Rate Prescaler */ +#define CTAR_PBR_7 0x3 /* Divide by 7 */ +#define CTAR_CSSCK_M 0xf +#define CTAR_CSSCK_S 12 /* PCS to SCK Delay Scaler */ +#define CTAR_BR_M 0xf +#define CTAR_BR_S 0 /* Baud Rate Scaler */ +#define SPI_SR 0x2C /* Status Register */ +#define SR_TCF (1 << 31) /* Transfer Complete Flag */ +#define SR_EOQF (1 << 28) /* End of Queue Flag */ +#define SR_TFFF (1 << 25) /* Transmit FIFO Fill Flag */ +#define SR_RFDF (1 << 17) /* Receive FIFO Drain Flag */ +#define SPI_RSER 0x30 /* DMA/Interrupt Select */ +#define RSER_EOQF_RE (1 << 28) /* Finished Request Enable */ +#define SPI_PUSHR 0x34 /* PUSH TX FIFO In Master Mode */ +#define PUSHR_CONT (1 << 31) /* Continuous Peripheral CS */ +#define PUSHR_EOQ (1 << 27) /* End Of Queue */ +#define PUSHR_CTCNT (1 << 26) /* Clear Transfer Counter */ +#define PUSHR_PCS_M 0x3f +#define PUSHR_PCS_S 16 /* Select PCS signals */ + +#define SPI_PUSHR_SLAVE 0x34 /* PUSH TX FIFO Register In Slave Mode */ +#define SPI_POPR 0x38 /* POP RX FIFO Register */ +#define SPI_TXFR0 0x3C /* Transmit FIFO Registers */ +#define SPI_TXFR1 0x40 +#define SPI_TXFR2 0x44 +#define SPI_TXFR3 0x48 +#define SPI_RXFR0 0x7C /* Receive FIFO Registers */ +#define SPI_RXFR1 0x80 +#define SPI_RXFR2 0x84 +#define SPI_RXFR3 0x88 + +struct spi_softc { + struct resource *res[2]; + bus_space_tag_t bst; + bus_space_handle_t bsh; + void *ih; +}; + +static struct resource_spec spi_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { SYS_RES_IRQ, 0, RF_ACTIVE }, + { -1, 0 } +}; + +static int +spi_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "fsl,mvf600-spi")) + return (ENXIO); + + device_set_desc(dev, "Vybrid Family Serial Peripheral Interface"); + return (BUS_PROBE_DEFAULT); +} + +static int +spi_attach(device_t dev) +{ + struct spi_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + + if (bus_alloc_resources(dev, spi_spec, sc->res)) { + device_printf(dev, "could not allocate resources\n"); + return (ENXIO); + } + + /* Memory interface */ + sc->bst = rman_get_bustag(sc->res[0]); + sc->bsh = rman_get_bushandle(sc->res[0]); + + reg = READ4(sc, SPI_MCR); + reg |= MCR_MSTR; + reg &= ~(MCR_CONT_SCKE | MCR_MDIS | MCR_FRZ); + reg &= ~(MCR_PCSIS_M << MCR_PCSIS_S); + reg |= (MCR_PCSIS_M << MCR_PCSIS_S); /* PCS Active low */ + reg |= (MCR_CLR_TXF | MCR_CLR_RXF); + WRITE4(sc, SPI_MCR, reg); + + reg = READ4(sc, SPI_RSER); + reg |= RSER_EOQF_RE; + WRITE4(sc, SPI_RSER, reg); + + reg = READ4(sc, SPI_MCR); + reg &= ~MCR_HALT; + WRITE4(sc, SPI_MCR, reg); + + reg = READ4(sc, SPI_CTAR0); + reg &= ~(CTAR_FMSZ_M << CTAR_FMSZ_S); + reg |= (CTAR_FMSZ_8 << CTAR_FMSZ_S); + /* + * TODO: calculate BR + * SCK baud rate = ( fsys / PBR ) * (1 + DBR) / BR + * + * reg &= ~(CTAR_BR_M << CTAR_BR_S); + */ + reg &= ~CTAR_CPOL; /* Polarity */ + reg |= CTAR_CPHA; + /* + * Set LSB (Less significant bit first) + * must be used for some applications, e.g. some LCDs + */ + reg |= CTAR_LSBFE; + WRITE4(sc, SPI_CTAR0, reg); + + reg = READ4(sc, SPI_CTAR0); + reg &= ~(CTAR_PBR_M << CTAR_PBR_S); + reg |= (CTAR_PBR_7 << CTAR_PBR_S); + WRITE4(sc, SPI_CTAR0, reg); + + device_add_child(dev, "spibus", 0); + return (bus_generic_attach(dev)); +} + +static int +spi_txrx(struct spi_softc *sc, uint8_t *out_buf, + uint8_t *in_buf, int bufsz, int cs) +{ + uint32_t reg, wreg; + uint32_t txcnt; + uint32_t i; + + txcnt = 0; + + for (i = 0; i < bufsz; i++) { + txcnt++; + wreg = out_buf[i]; + wreg |= PUSHR_CONT; + wreg |= (cs << PUSHR_PCS_S); + if (i == 0) + wreg |= PUSHR_CTCNT; + if (i == (bufsz - 1) || txcnt == SPI_FIFO_SIZE) + wreg |= PUSHR_EOQ; + WRITE4(sc, SPI_PUSHR, wreg); + + if (i == (bufsz - 1) || txcnt == SPI_FIFO_SIZE) { + txcnt = 0; + + /* Wait last entry in a queue to be transmitted */ + while((READ4(sc, SPI_SR) & SR_EOQF) == 0) + continue; + + reg = READ4(sc, SPI_SR); + reg |= (SR_TCF | SR_EOQF); + WRITE4(sc, SPI_SR, reg); + } + + /* Wait until RX FIFO is empty */ + while((READ4(sc, SPI_SR) & SR_RFDF) == 0) + continue; + + in_buf[i] = READ1(sc, SPI_POPR); + } + + return (0); +} + +static int +spi_transfer(device_t dev, device_t child, struct spi_command *cmd) +{ + struct spi_softc *sc; + uint32_t cs; + + sc = device_get_softc(dev); + + KASSERT(cmd->tx_cmd_sz == cmd->rx_cmd_sz, + ("%s: TX/RX command sizes should be equal", __func__)); + KASSERT(cmd->tx_data_sz == cmd->rx_data_sz, + ("%s: TX/RX data sizes should be equal", __func__)); + + /* get the proper chip select */ + spibus_get_cs(child, &cs); + + /* Command */ + spi_txrx(sc, cmd->tx_cmd, cmd->rx_cmd, cmd->tx_cmd_sz, cs); + + /* Data */ + spi_txrx(sc, cmd->tx_data, cmd->rx_data, cmd->tx_data_sz, cs); + + return (0); +} + +static device_method_t spi_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, spi_probe), + DEVMETHOD(device_attach, spi_attach), + /* SPI interface */ + DEVMETHOD(spibus_transfer, spi_transfer), + { 0, 0 } +}; + +static driver_t spi_driver = { + "spi", + spi_methods, + sizeof(struct spi_softc), +}; + +static devclass_t spi_devclass; + +DRIVER_MODULE(spi, simplebus, spi_driver, spi_devclass, 0, 0); diff --git a/sys/arm/include/atomic.h b/sys/arm/include/atomic.h index d1684987348..02be1bdff55 100644 --- a/sys/arm/include/atomic.h +++ b/sys/arm/include/atomic.h @@ -58,9 +58,9 @@ #define dsb() __asm __volatile("mcr p15, 0, %0, c7, c10, 4" : : "r" (0) : "memory") #define dmb() __asm __volatile("mcr p15, 0, %0, c7, c10, 5" : : "r" (0) : "memory") #else -#define isb() -#define dsb() -#define dmb() +#define isb() __asm __volatile("mcr p15, 0, %0, c7, c5, 4" : : "r" (0) : "memory") +#define dsb() __asm __volatile("mcr p15, 0, %0, c7, c10, 4" : : "r" (0) : "memory") +#define dmb() dsb() #endif #define mb() dmb() diff --git a/sys/arm/include/cpu.h b/sys/arm/include/cpu.h index c6f708824bb..dd7b6acce3e 100644 --- a/sys/arm/include/cpu.h +++ b/sys/arm/include/cpu.h @@ -14,11 +14,35 @@ void swi_vm(void *); static __inline uint64_t get_cyclecount(void) { +/* This '#if' asks the question 'Does CP15/SCC include performance counters?' */ +#if defined(CPU_ARM1136) || defined(CPU_ARM1176) \ + || defined(CPU_MV_PJ4B) \ + || defined(CPU_CORTEXA) || defined(CPU_KRAIT) + uint32_t ccnt; + uint64_t ccnt64; + + /* + * Read PMCCNTR. Curses! Its only 32 bits. + * TODO: Fix this by catching overflow with interrupt? + */ +/* The ARMv6 vs ARMv7 divide is going to need a better way of + * distinguishing between them. + */ +#if defined(CPU_ARM1136) || defined(CPU_ARM1176) + /* ARMv6 - Earlier model SCCs */ + __asm __volatile("mrc p15, 0, %0, c15, c12, 1": "=r" (ccnt)); +#else + /* ARMv7 - Later model SCCs */ + __asm __volatile("mrc p15, 0, %0, c9, c13, 0": "=r" (ccnt)); +#endif + ccnt64 = (uint64_t)ccnt; + return (ccnt64); +#else /* No performance counters, so use binuptime(9). This is slooooow */ struct bintime bt; binuptime(&bt); return ((uint64_t)bt.sec << 56 | bt.frac >> 8); - +#endif } #endif diff --git a/sys/arm/include/cpufunc.h b/sys/arm/include/cpufunc.h index c2a96a81507..e66e7a3744a 100644 --- a/sys/arm/include/cpufunc.h +++ b/sys/arm/include/cpufunc.h @@ -151,6 +151,7 @@ struct cpu_functions { void (*cf_l2cache_wbinv_range) (vm_offset_t, vm_size_t); void (*cf_l2cache_inv_range) (vm_offset_t, vm_size_t); void (*cf_l2cache_wb_range) (vm_offset_t, vm_size_t); + void (*cf_l2cache_drain_writebuf) (void); /* Other functions */ @@ -252,6 +253,7 @@ void tlb_broadcast(int); #define cpu_l2cache_wb_range(a, s) cpufuncs.cf_l2cache_wb_range((a), (s)) #define cpu_l2cache_inv_range(a, s) cpufuncs.cf_l2cache_inv_range((a), (s)) #define cpu_l2cache_wbinv_range(a, s) cpufuncs.cf_l2cache_wbinv_range((a), (s)) +#define cpu_l2cache_drain_writebuf() cpufuncs.cf_l2cache_drain_writebuf() #define cpu_flush_prefetchbuf() cpufuncs.cf_flush_prefetchbuf() #define cpu_drain_writebuf() cpufuncs.cf_drain_writebuf() @@ -389,13 +391,6 @@ void arm11_tlb_flushD_SE (u_int va); void arm11_drain_writebuf (void); -void pj4b_setttb (u_int); - -void pj4b_drain_readbuf (void); -void pj4b_flush_brnchtgt_all (void); -void pj4b_flush_brnchtgt_va (u_int); -void pj4b_sleep (int); - void armv6_icache_sync_all (void); void armv6_icache_sync_range (vm_offset_t, vm_size_t); @@ -430,8 +425,6 @@ u_int armv7_auxctrl (u_int, u_int); void pj4bv7_setup (char *string); void pj4b_config (void); -int get_core_id (void); - void armadaxp_idcache_wbinv_all (void); void cortexa_setup (char *); diff --git a/sys/arm/include/devmap.h b/sys/arm/include/devmap.h index e205d9b8539..3c230144727 100644 --- a/sys/arm/include/devmap.h +++ b/sys/arm/include/devmap.h @@ -45,7 +45,7 @@ struct arm_devmap_entry { * Return the lowest KVA address used in any entry in the registered devmap * table. This works with whatever table is registered, including the internal * table used by arm_devmap_add_entry() if that routine was used. Platforms can - * implement initarm_lastaddr() by calling this if static device mappings are + * implement platform_lastaddr() by calling this if static device mappings are * their only use of high KVA space. */ vm_offset_t arm_devmap_lastaddr(void); diff --git a/sys/arm/include/elf.h b/sys/arm/include/elf.h index 91086f85785..9b18646d187 100644 --- a/sys/arm/include/elf.h +++ b/sys/arm/include/elf.h @@ -55,6 +55,9 @@ __ElfType(Auxinfo); #define ELF_MACHINE_OK(x) ((x) == EM_ARM) +/* Unwind info section type */ +#define PT_ARM_EXIDX (PT_LOPROC + 1) + /* * Relocation types. */ diff --git a/sys/arm/include/intr.h b/sys/arm/include/intr.h index 49d6c0594d3..e2d0feb3c62 100644 --- a/sys/arm/include/intr.h +++ b/sys/arm/include/intr.h @@ -79,6 +79,8 @@ extern void (*arm_post_filter)(void *); extern int (*arm_config_irq)(int irq, enum intr_trigger trig, enum intr_polarity pol); +void arm_irq_memory_barrier(uintptr_t); + void gic_init_secondary(void); #endif /* _MACHINE_INTR_H */ diff --git a/sys/arm/include/machdep.h b/sys/arm/include/machdep.h index 8c7aaab3f35..907270ebd2a 100644 --- a/sys/arm/include/machdep.h +++ b/sys/arm/include/machdep.h @@ -34,40 +34,6 @@ 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); -/* - * Initialization functions called by the common initarm() function in - * arm/machdep.c (but not necessarily from the custom initarm() functions of - * older code). - * - * - initarm_early_init() is called very early, after parsing the boot params - * and after physical memory has been located and sized. - * - * - initarm_devmap_init() is called as one of the last steps of early virtual - * memory initialization, shortly before the new page tables are installed. - * - * - initarm_lastaddr() is called after initarm_devmap_init(), and must return - * the address of the first byte of unusable KVA space. This allows a - * platform to carve out of the top of the KVA space whatever reserves it - * needs for things like static device mapping, and this is called to get the - * value before calling pmap_bootstrap() which uses the value to size the - * available KVA. - * - * - initarm_gpio_init() is called after the static device mappings are - * established and just before cninit(). The intention is that the routine - * can do any hardware setup (such as gpio or pinmux) necessary to make the - * console functional. - * - * - initarm_late_init() is called just after cninit(). This is the first of - * the init routines that can use printf() and expect the output to appear on - * a standard console. - * - */ -void initarm_early_init(void); -int initarm_devmap_init(void); -vm_offset_t initarm_lastaddr(void); -void initarm_gpio_init(void); -void initarm_late_init(void); - /* Board-specific attributes */ void board_set_serial(uint64_t); void board_set_revision(uint32_t); diff --git a/lib/libc/ia64/sys/Ovfork.S b/sys/arm/include/platform.h similarity index 80% rename from lib/libc/ia64/sys/Ovfork.S rename to sys/arm/include/platform.h index 6eb69583f7e..d4db0e1fd4c 100644 --- a/lib/libc/ia64/sys/Ovfork.S +++ b/sys/arm/include/platform.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2000 Doug Rabson + * Copyright (c) 2014 Andrew Turner * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -22,16 +22,17 @@ * 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 -__FBSDID("$FreeBSD$"); +#ifndef _MACHINE_PLATFORM_H_ +#define _MACHINE_PLATFORM_H_ -#include "SYS.h" +void platform_probe_and_attach(void); +int platform_devmap_init(void); +vm_offset_t platform_lastaddr(void); +void platform_gpio_init(void); +void platform_late_init(void); -SYSCALL(vfork) - cmp.ne p7,p0=ret1,r0 /* ret1!=0 for child */ - ;; -(p7) mov ret0=r0 - br.ret.sptk.few rp -END(__sys_vfork) +#endif /* _MACHINE_PLATFORM_H_ */ diff --git a/sys/arm/include/platformvar.h b/sys/arm/include/platformvar.h new file mode 100644 index 00000000000..cfee255c627 --- /dev/null +++ b/sys/arm/include/platformvar.h @@ -0,0 +1,107 @@ +/*- + * Copyright (c) 2005 Peter Grehan + * 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 _MACHINE_PLATFORMVAR_H_ +#define _MACHINE_PLATFORMVAR_H_ + +/* + * An ARM platform implementation is declared with a kernel object and + * an associated method table, similar to a device driver. + * + * e.g. + * + * static platform_method_t bcm2835_methods[] = { + * PLATFORMMETHOD(platform_probe, bcm2835_probe), + * ... + * PLATFORMMETHOD_END + * }; + * + * static platform_def_t bcm3835_platform = { + * "bcm2835", + * bcm2835_methods, + * sizeof(bcm2835_platform_softc), // or 0 if no softc + * }; + * + * PLATFORM_DEF(bcm2835_platform); + */ + +#include +#include + +struct platform_kobj { + /* + * A platform instance is a kernel object + */ + KOBJ_FIELDS; + + /* Platform class, for access to class specific data */ + struct kobj_class *cls; +}; + +typedef struct platform_kobj *platform_t; +typedef struct kobj_class platform_def_t; +#define platform_method_t kobj_method_t + +#define PLATFORMMETHOD KOBJMETHOD +#define PLATFORMMETHOD_END KOBJMETHOD_END + +#define PLATFORM_DEF(name) DATA_SET(platform_set, name) + +#ifdef FDT +struct fdt_platform_class { + KOBJ_CLASS_FIELDS; + + const char *fdt_compatible; +}; + +typedef struct fdt_platform_class fdt_platform_def_t; + +extern platform_method_t fdt_platform_methods[]; + +#define FDT_PLATFORM_DEF2(NAME, VAR_NAME, NAME_STR, size, compatible) \ +static fdt_platform_def_t VAR_NAME ## _fdt_platform = { \ + .name = NAME_STR, \ + .methods = fdt_platform_methods, \ + .fdt_compatible = compatible, \ +}; \ +static kobj_class_t VAR_NAME ## _baseclasses[] = \ + { (kobj_class_t)&VAR_NAME ## _fdt_platform, NULL }; \ +static platform_def_t VAR_NAME ## _platform = { \ + NAME_STR, \ + NAME ## _methods, \ + size, \ + VAR_NAME ## _baseclasses, \ +}; \ +DATA_SET(platform_set, VAR_NAME ## _platform) + +#define FDT_PLATFORM_DEF(NAME, NAME_STR, size, compatible) \ + FDT_PLATFORM_DEF2(NAME, NAME, NAME_STR, size, compatible) + +#endif + +#endif /* _MACHINE_PLATFORMVAR_H_ */ diff --git a/sys/arm/include/ucontext.h b/sys/arm/include/ucontext.h index cebf2ada2c2..afcd88ded7a 100644 --- a/sys/arm/include/ucontext.h +++ b/sys/arm/include/ucontext.h @@ -97,12 +97,4 @@ typedef struct { #define _UC_SETSTACK 0x00020000 #define _UC_CLRSTACK 0x00040000 -#define _UC_MACHINE_PAD 3 /* Padding appended to ucontext_t */ - -#define _UC_MACHINE_SP(uc) ((uc)->uc_mcontext.__gregs[_REG_SP]) -#define _UC_MACHINE_PC(uc) ((uc)->uc_mcontext.__gregs[_REG_PC]) -#define _UC_MACHINE_INTRV(uc) ((uc)->uc_mcontext.__gregs[_REG_R0]) - -#define _UC_MACHINE_SET_PC(uc, pc) _UC_MACHINE_PC(uc) = (pc) - #endif /* !_MACHINE_MCONTEXT_H_ */ diff --git a/sys/arm/lpc/lpc_gpio.c b/sys/arm/lpc/lpc_gpio.c index 9c13d62598b..b2310cb0a2d 100644 --- a/sys/arm/lpc/lpc_gpio.c +++ b/sys/arm/lpc/lpc_gpio.c @@ -504,7 +504,7 @@ lpc_gpio_get_state(device_t dev, int pin, int *state) } void -platform_gpio_init() +lpc_gpio_init() { bus_space_tag_t bst; bus_space_handle_t bsh; diff --git a/sys/arm/lpc/lpc_machdep.c b/sys/arm/lpc/lpc_machdep.c index 0cdfd038f73..ecef7db5677 100644 --- a/sys/arm/lpc/lpc_machdep.c +++ b/sys/arm/lpc/lpc_machdep.c @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -60,29 +61,29 @@ __FBSDID("$FreeBSD$"); #include vm_offset_t -initarm_lastaddr(void) +platform_lastaddr(void) { return (arm_devmap_lastaddr()); } void -initarm_early_init(void) +platform_probe_and_attach(void) { } void -initarm_gpio_init(void) +platform_gpio_init(void) { /* * Set initial values of GPIO output ports */ - platform_gpio_init(); + lpc_gpio_init(); } void -initarm_late_init(void) +platform_late_init(void) { } @@ -92,7 +93,7 @@ initarm_late_init(void) * dts file when this code was converted to arm_devmap_add_entry(). */ int -initarm_devmap_init(void) +platform_devmap_init(void) { arm_devmap_add_entry(LPC_DEV_PHYS_BASE, LPC_DEV_SIZE); diff --git a/sys/arm/lpc/lpcvar.h b/sys/arm/lpc/lpcvar.h index a0b3651bb1d..ed05320ca9d 100644 --- a/sys/arm/lpc/lpcvar.h +++ b/sys/arm/lpc/lpcvar.h @@ -38,7 +38,7 @@ uint32_t lpc_pwr_read(device_t, int); void lpc_pwr_write(device_t, int, uint32_t); /* GPIO */ -void platform_gpio_init(void); +void lpc_gpio_init(void); int lpc_gpio_set_flags(device_t, int, int); int lpc_gpio_set_state(device_t, int, int); int lpc_gpio_get_state(device_t, int, int *); diff --git a/sys/arm/mv/armadaxp/armadaxp_mp.c b/sys/arm/mv/armadaxp/armadaxp_mp.c index 004f8db8a3c..6e93d35486d 100644 --- a/sys/arm/mv/armadaxp/armadaxp_mp.c +++ b/sys/arm/mv/armadaxp/armadaxp_mp.c @@ -37,6 +37,8 @@ #include #include +#include + #include #include #include @@ -97,14 +99,14 @@ platform_mp_init_secondary(void) } void mptramp(void); - - +void mptramp_end(void); +extern vm_offset_t mptramp_pmu_boot; void platform_mp_start_ap(void) { uint32_t reg, *src, *dst, cpu_num, div_val, cputype; - vm_offset_t smp_boot; + vm_offset_t smp_boot, pmu_boot_off; /* * Initialization procedure depends on core revision, * in this step CHIP ID is checked to choose proper procedure @@ -115,8 +117,14 @@ platform_mp_start_ap(void) smp_boot = kva_alloc(PAGE_SIZE); pmap_kenter_nocache(smp_boot, 0xffff0000); dst = (uint32_t *) smp_boot; + /* + * Set the PA of CPU0 Boot Address Redirect register used in + * mptramp according to the actual SoC registers' base address. + */ + pmu_boot_off = (CPU_PMU(0) - MV_BASE) + CPU_PMU_BOOT; + mptramp_pmu_boot = fdt_immr_pa + pmu_boot_off; - for (src = (uint32_t *)mptramp; src < (uint32_t *)mpentry; + for (src = (uint32_t *)mptramp; src < (uint32_t *)mptramp_end; src++, dst++) { *dst = *src; } diff --git a/sys/arm/mv/armadaxp/mptramp.S b/sys/arm/mv/armadaxp/mptramp.S index 4d657e41b47..056f5889dd9 100644 --- a/sys/arm/mv/armadaxp/mptramp.S +++ b/sys/arm/mv/armadaxp/mptramp.S @@ -29,6 +29,8 @@ __FBSDID("$FreeBSD$"); +.global _C_LABEL(mptramp_pmu_boot) + ASENTRY_NP(mptramp) mov r0, #0 mcr p15, 0, r0, c7, c7, 0 @@ -44,13 +46,16 @@ ASENTRY_NP(mptramp) /* Read boot address for CPU */ mov r1, #0x100 mul r2, r0, r1 - ldr r1, Lpmureg + ldr r1, mptramp_pmu_boot add r0, r2, r1 ldr r1, [r0], #0x00 mov pc, r1 -Lpmureg: - .word 0xd0022124 +_C_LABEL(mptramp_pmu_boot): + .word 0x0 + END(mptramp) + .global _C_LABEL(mptramp_end) +_C_LABEL(mptramp_end): diff --git a/sys/arm/mv/gpio.c b/sys/arm/mv/gpio.c index 1bdb81b588f..171e880adfc 100644 --- a/sys/arm/mv/gpio.c +++ b/sys/arm/mv/gpio.c @@ -74,6 +74,7 @@ static uint32_t gpio_setup[MV_GPIO_MAX_NPINS]; static int mv_gpio_probe(device_t); static int mv_gpio_attach(device_t); static int mv_gpio_intr(void *); +static int mv_gpio_init(void); static void mv_gpio_intr_handler(int pin); static uint32_t mv_gpio_reg_read(uint32_t reg); @@ -201,7 +202,7 @@ mv_gpio_attach(device_t dev) } } - return (platform_gpio_init()); + return (mv_gpio_init()); } static int @@ -604,8 +605,8 @@ mv_handle_gpios_prop(phandle_t ctrl, pcell_t *gpios, int len) #define MAX_PINS_PER_NODE 5 #define GPIOS_PROP_CELLS 4 -int -platform_gpio_init(void) +static int +mv_gpio_init(void) { phandle_t child, parent, root, ctrl; pcell_t gpios[MAX_PINS_PER_NODE * GPIOS_PROP_CELLS]; diff --git a/sys/arm/mv/mv_localbus.c b/sys/arm/mv/mv_localbus.c index 0882ad4c191..8d91c41a401 100644 --- a/sys/arm/mv/mv_localbus.c +++ b/sys/arm/mv/mv_localbus.c @@ -477,7 +477,7 @@ fdt_localbus_devmap(phandle_t dt_node, struct arm_devmap_entry *fdt_devmap, fdt_devmap[j].pd_pa = offset; fdt_devmap[j].pd_size = size; fdt_devmap[j].pd_prot = VM_PROT_READ | VM_PROT_WRITE; - fdt_devmap[j].pd_cache = PTE_NOCACHE; + fdt_devmap[j].pd_cache = PTE_DEVICE; /* Copy data to structure used by localbus driver */ localbus_banks[bank].va = fdt_devmap[j].pd_va; diff --git a/sys/arm/mv/mv_machdep.c b/sys/arm/mv/mv_machdep.c index 7c0e7c108ec..edd08340a10 100644 --- a/sys/arm/mv/mv_machdep.c +++ b/sys/arm/mv/mv_machdep.c @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include /* XXX */ #include /* XXX eventually this should be eliminated */ @@ -201,14 +202,14 @@ platform_mpp_init(void) } vm_offset_t -initarm_lastaddr(void) +platform_lastaddr(void) { return (fdt_immr_va); } void -initarm_early_init(void) +platform_probe_and_attach(void) { if (fdt_immr_addr(MV_BASE) != 0) @@ -216,7 +217,7 @@ initarm_early_init(void) } void -initarm_gpio_init(void) +platform_gpio_init(void) { /* @@ -228,7 +229,7 @@ initarm_gpio_init(void) } void -initarm_late_init(void) +platform_late_init(void) { /* * Re-initialise decode windows @@ -284,7 +285,7 @@ platform_sram_devmap(struct arm_devmap_entry *map) map->pd_pa = base; map->pd_size = size; map->pd_prot = VM_PROT_READ | VM_PROT_WRITE; - map->pd_cache = PTE_NOCACHE; + map->pd_cache = PTE_DEVICE; return (0); out: @@ -297,7 +298,7 @@ platform_sram_devmap(struct arm_devmap_entry *map) * Supply a default do-nothing implementation of mv_pci_devmap() via a weak * alias. Many Marvell platforms don't support a PCI interface, but to support * those that do, we end up with a reference to this function below, in - * initarm_devmap_init(). If "device pci" appears in the kernel config, the + * platform_devmap_init(). If "device pci" appears in the kernel config, the * real implementation of this function in arm/mv/mv_pci.c overrides the weak * alias defined here. */ @@ -321,7 +322,7 @@ __weak_reference(mv_default_fdt_pci_devmap, mv_pci_devmap); * Construct pmap_devmap[] with DT-derived config data. */ int -initarm_devmap_init(void) +platform_devmap_init(void) { phandle_t root, child; pcell_t bank_count; @@ -350,7 +351,7 @@ initarm_devmap_init(void) fdt_devmap[i].pd_pa = fdt_immr_pa; fdt_devmap[i].pd_size = fdt_immr_size; fdt_devmap[i].pd_prot = VM_PROT_READ | VM_PROT_WRITE; - fdt_devmap[i].pd_cache = PTE_NOCACHE; + fdt_devmap[i].pd_cache = PTE_DEVICE; i++; /* diff --git a/sys/arm/mv/mv_pci.c b/sys/arm/mv/mv_pci.c index be4ccc9d2fb..012b31bac04 100644 --- a/sys/arm/mv/mv_pci.c +++ b/sys/arm/mv/mv_pci.c @@ -235,14 +235,14 @@ mv_pci_devmap(phandle_t node, struct arm_devmap_entry *devmap, vm_offset_t io_va devmap->pd_pa = io_space.base_parent; devmap->pd_size = io_space.len; devmap->pd_prot = VM_PROT_READ | VM_PROT_WRITE; - devmap->pd_cache = PTE_NOCACHE; + devmap->pd_cache = PTE_DEVICE; devmap++; devmap->pd_va = (mem_va ? mem_va : mem_space.base_parent); devmap->pd_pa = mem_space.base_parent; devmap->pd_size = mem_space.len; devmap->pd_prot = VM_PROT_READ | VM_PROT_WRITE; - devmap->pd_cache = PTE_NOCACHE; + devmap->pd_cache = PTE_DEVICE; return (0); } diff --git a/sys/arm/mv/mvvar.h b/sys/arm/mv/mvvar.h index 0b72dcb7ab5..a9b2bb0611d 100644 --- a/sys/arm/mv/mvvar.h +++ b/sys/arm/mv/mvvar.h @@ -82,7 +82,6 @@ void mv_gpio_intr_mask(int pin); void mv_gpio_intr_unmask(int pin); void mv_gpio_out(uint32_t pin, uint8_t val, uint8_t enable); uint8_t mv_gpio_in(uint32_t pin); -int platform_gpio_init(void); int soc_decode_win(void); void soc_id(uint32_t *dev, uint32_t *rev); diff --git a/sys/arm/mv/orion/db88f5xxx.c b/sys/arm/mv/orion/db88f5xxx.c index 0762df50985..f59d511f4d0 100644 --- a/sys/arm/mv/orion/db88f5xxx.c +++ b/sys/arm/mv/orion/db88f5xxx.c @@ -84,42 +84,42 @@ const struct pmap_devmap pmap_devmap[] = { MV_PHYS_BASE, MV_SIZE, VM_PROT_READ | VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { /* PCIE I/O */ MV_PCIE_IO_BASE, MV_PCIE_IO_PHYS_BASE, MV_PCIE_IO_SIZE, VM_PROT_READ | VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { /* PCIE Memory */ MV_PCIE_MEM_BASE, MV_PCIE_MEM_PHYS_BASE, MV_PCIE_MEM_SIZE, VM_PROT_READ | VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { /* PCI I/O */ MV_PCI_IO_BASE, MV_PCI_IO_PHYS_BASE, MV_PCI_IO_SIZE, VM_PROT_READ | VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { /* PCI Memory */ MV_PCI_MEM_BASE, MV_PCI_MEM_PHYS_BASE, MV_PCI_MEM_SIZE, VM_PROT_READ | VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { /* 7-seg LED */ MV_DEV_CS0_BASE, MV_DEV_CS0_PHYS_BASE, MV_DEV_CS0_SIZE, VM_PROT_READ | VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { 0, 0, 0, 0, 0, } }; diff --git a/sys/arm/rockchip/files.rk30xx b/sys/arm/rockchip/files.rk30xx index 98e3d413757..bfbf7617657 100644 --- a/sys/arm/rockchip/files.rk30xx +++ b/sys/arm/rockchip/files.rk30xx @@ -18,4 +18,4 @@ arm/rockchip/rk30xx_pmu.c standard arm/rockchip/rk30xx_grf.c standard arm/rockchip/rk30xx_wdog.c standard arm/rockchip/rk30xx_gpio.c optional gpio -dev/usb/controller/dwc_otg_fdt.c optional dwcotg +arm/rockchip/rk30xx_mp.c optional smp diff --git a/sys/arm/rockchip/rk30xx_gpio.c b/sys/arm/rockchip/rk30xx_gpio.c index 4965735a6af..3ecedda2cb4 100644 --- a/sys/arm/rockchip/rk30xx_gpio.c +++ b/sys/arm/rockchip/rk30xx_gpio.c @@ -96,7 +96,7 @@ struct gpio_ctrl_entry { }; int rk30_gpios_prop_handle(phandle_t ctrl, pcell_t *gpios, int len); -int platform_gpio_init(void); +static int rk30_gpio_init(void); struct gpio_ctrl_entry gpio_controllers[] = { { "rockchip,rk30xx-gpio", &rk30_gpios_prop_handle }, @@ -509,7 +509,7 @@ rk30_gpio_attach(device_t dev) rk30_gpio_sc = sc; - platform_gpio_init(); + rk30_gpio_init(); return (bus_generic_attach(dev)); @@ -619,8 +619,8 @@ rk30_gpios_prop_handle(phandle_t ctrl, pcell_t *gpios, int len) #define MAX_PINS_PER_NODE 5 #define GPIOS_PROP_CELLS 4 -int -platform_gpio_init(void) +static int +rk30_gpio_init(void) { phandle_t child, parent, root, ctrl; pcell_t gpios[MAX_PINS_PER_NODE * GPIOS_PROP_CELLS]; diff --git a/sys/arm/rockchip/rk30xx_machdep.c b/sys/arm/rockchip/rk30xx_machdep.c index 0cb9bca6871..8a21883a223 100644 --- a/sys/arm/rockchip/rk30xx_machdep.c +++ b/sys/arm/rockchip/rk30xx_machdep.c @@ -46,31 +46,32 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include vm_offset_t -initarm_lastaddr(void) +platform_lastaddr(void) { return (arm_devmap_lastaddr()); } void -initarm_early_init(void) +platform_probe_and_attach(void) { } void -initarm_gpio_init(void) +platform_gpio_init(void) { } void -initarm_late_init(void) +platform_late_init(void) { /* Enable cache */ @@ -82,9 +83,10 @@ initarm_late_init(void) * Set up static device mappings. */ int -initarm_devmap_init(void) +platform_devmap_init(void) { + arm_devmap_add_entry(0x10000000, 0x00200000); arm_devmap_add_entry(0x20000000, 0x00100000); return (0); diff --git a/sys/arm/rockchip/rk30xx_mp.c b/sys/arm/rockchip/rk30xx_mp.c new file mode 100644 index 00000000000..54457a357f9 --- /dev/null +++ b/sys/arm/rockchip/rk30xx_mp.c @@ -0,0 +1,192 @@ +/*- + * Copyright (c) 2014 Ganbold Tsagaankhuu + * 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 +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define SCU_PHYSBASE 0x1013c000 +#define SCU_SIZE 0x100 + +#define SCU_CONTROL_REG 0x00 +#define SCU_CONTROL_ENABLE (1 << 0) +#define SCU_STANDBY_EN (1 << 5) +#define SCU_CONFIG_REG 0x04 +#define SCU_CONFIG_REG_NCPU_MASK 0x03 +#define SCU_CPUPOWER_REG 0x08 +#define SCU_INV_TAGS_REG 0x0c + +#define SCU_FILTER_START_REG 0x10 +#define SCU_FILTER_END_REG 0x14 +#define SCU_SECURE_ACCESS_REG 0x18 +#define SCU_NONSECURE_ACCESS_REG 0x1c + +#define IMEM_PHYSBASE 0x10080000 +#define IMEM_SIZE 0x20 + +#define PMU_PHYSBASE 0x20004000 +#define PMU_SIZE 0x100 +#define PMU_PWRDN_CON 0x08 +#define PMU_PWRDN_SCU (1 << 4) + +extern char *mpentry_addr; +static void rk30xx_boot2(void); + +static void +rk30xx_boot2(void) +{ + + __asm __volatile( + "ldr pc, 1f\n" + ".globl mpentry_addr\n" + "mpentry_addr:\n" + "1: .space 4\n"); +} + +void +platform_mp_init_secondary(void) +{ + + gic_init_secondary(); +} + +void +platform_mp_setmaxid(void) +{ + bus_space_handle_t scu; + int ncpu; + uint32_t val; + + if (mp_ncpus != 0) + return; + + if (bus_space_map(fdtbus_bs_tag, SCU_PHYSBASE, SCU_SIZE, 0, &scu) != 0) + panic("Could not map the SCU"); + + val = bus_space_read_4(fdtbus_bs_tag, scu, SCU_CONFIG_REG); + ncpu = (val & SCU_CONFIG_REG_NCPU_MASK) + 1; + bus_space_unmap(fdtbus_bs_tag, scu, SCU_SIZE); + + mp_ncpus = ncpu; + mp_maxid = ncpu - 1; +} + +int +platform_mp_probe(void) +{ + + if (mp_ncpus == 0) + platform_mp_setmaxid(); + + return (mp_ncpus > 1); +} + +void +platform_mp_start_ap(void) +{ + bus_space_handle_t scu; + bus_space_handle_t imem; + bus_space_handle_t pmu; + uint32_t val; + int i; + + if (bus_space_map(fdtbus_bs_tag, SCU_PHYSBASE, SCU_SIZE, 0, &scu) != 0) + panic("Could not map the SCU"); + if (bus_space_map(fdtbus_bs_tag, IMEM_PHYSBASE, + IMEM_SIZE, 0, &imem) != 0) + panic("Could not map the IMEM"); + if (bus_space_map(fdtbus_bs_tag, PMU_PHYSBASE, PMU_SIZE, 0, &pmu) != 0) + panic("Could not map the PMU"); + + /* + * Invalidate SCU cache tags. The 0x0000ffff constant invalidates all + * ways on all cores 0-3. Per the ARM docs, it's harmless to write to + * the bits for cores that are not present. + */ + bus_space_write_4(fdtbus_bs_tag, scu, SCU_INV_TAGS_REG, 0x0000ffff); + + /* Make sure all cores except the first are off */ + val = bus_space_read_4(fdtbus_bs_tag, pmu, PMU_PWRDN_CON); + for (i = 1; i < mp_ncpus; i++) + val |= 1 << i; + bus_space_write_4(fdtbus_bs_tag, pmu, PMU_PWRDN_CON, val); + + /* Enable SCU power domain */ + val = bus_space_read_4(fdtbus_bs_tag, pmu, PMU_PWRDN_CON); + val &= ~PMU_PWRDN_SCU; + bus_space_write_4(fdtbus_bs_tag, pmu, PMU_PWRDN_CON, val); + + /* Enable SCU */ + val = bus_space_read_4(fdtbus_bs_tag, scu, SCU_CONTROL_REG); + bus_space_write_4(fdtbus_bs_tag, scu, SCU_CONTROL_REG, + val | SCU_CONTROL_ENABLE); + + /* + * Cores will execute the code which resides at the start of + * the on-chip bootram/sram after power-on. This sram region + * should be reserved and the trampoline code that directs + * the core to the real startup code in ram should be copied + * into this sram region. + * + * First set boot function for the sram code. + */ + mpentry_addr = (char *)pmap_kextract((vm_offset_t)mpentry); + + /* Copy trampoline to sram, that runs during startup of the core */ + bus_space_write_region_4(fdtbus_bs_tag, imem, 0, + (uint32_t *)&rk30xx_boot2, 8); + + cpu_idcache_wbinv_all(); + cpu_l2cache_wbinv_all(); + + /* Start all cores */ + val = bus_space_read_4(fdtbus_bs_tag, pmu, PMU_PWRDN_CON); + for (i = 1; i < mp_ncpus; i++) + val &= ~(1 << i); + bus_space_write_4(fdtbus_bs_tag, pmu, PMU_PWRDN_CON, val); + + armv7_sev(); + + bus_space_unmap(fdtbus_bs_tag, scu, SCU_SIZE); + bus_space_unmap(fdtbus_bs_tag, imem, IMEM_SIZE); + bus_space_unmap(fdtbus_bs_tag, pmu, PMU_SIZE); +} + +void +platform_ipi_send(cpuset_t cpus, u_int ipi) +{ + + pic_ipi_send(cpus, ipi); +} diff --git a/sys/arm/s3c2xx0/s3c24x0_machdep.c b/sys/arm/s3c2xx0/s3c24x0_machdep.c index 73b60ea2da1..5264e7a805d 100644 --- a/sys/arm/s3c2xx0/s3c24x0_machdep.c +++ b/sys/arm/s3c2xx0/s3c24x0_machdep.c @@ -130,42 +130,42 @@ static const struct arm_devmap_entry s3c24x0_devmap[] = { _A(S3C24X0_CLKMAN_PA_BASE), _S(S3C24X0_CLKMAN_SIZE), VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { _A(S3C24X0_GPIO_BASE), _A(S3C24X0_GPIO_PA_BASE), _S(S3C2410_GPIO_SIZE), VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { _A(S3C24X0_INTCTL_BASE), _A(S3C24X0_INTCTL_PA_BASE), _S(S3C24X0_INTCTL_SIZE), VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { _A(S3C24X0_TIMER_BASE), _A(S3C24X0_TIMER_PA_BASE), _S(S3C24X0_TIMER_SIZE), VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { _A(S3C24X0_UART0_BASE), _A(S3C24X0_UART0_PA_BASE), _S(S3C24X0_UART_PA_BASE(3) - S3C24X0_UART0_PA_BASE), VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { _A(S3C24X0_WDT_BASE), _A(S3C24X0_WDT_PA_BASE), _S(S3C24X0_WDT_SIZE), VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { 0, diff --git a/sys/arm/samsung/exynos/chrome_ec.c b/sys/arm/samsung/exynos/chrome_ec.c index 5ef64ee1699..ef64c1ac4ec 100644 --- a/sys/arm/samsung/exynos/chrome_ec.c +++ b/sys/arm/samsung/exynos/chrome_ec.c @@ -60,12 +60,11 @@ __FBSDID("$FreeBSD$"); #include -/* TODO: export to DTS */ -#define OUR_GPIO 177 -#define EC_GPIO 168 - struct ec_softc { device_t dev; + int have_arbitrator; + pcell_t our_gpio; + pcell_t ec_gpio; }; struct ec_softc *ec_sc; @@ -82,17 +81,24 @@ bus_claim(struct ec_softc *sc) device_t gpio_dev; int status; + if (sc->our_gpio == 0 || sc->ec_gpio == 0) { + device_printf(sc->dev, "i2c arbitrator is not configured\n"); + return (1); + } + gpio_dev = devclass_get_device(devclass_find("gpio"), 0); - if (gpio_dev == NULL) { + if (gpio_dev == NULL) { device_printf(sc->dev, "cant find gpio_dev\n"); return (1); } /* Say we want the bus */ - GPIO_PIN_SET(gpio_dev, OUR_GPIO, GPIO_PIN_LOW); + GPIO_PIN_SET(gpio_dev, sc->our_gpio, GPIO_PIN_LOW); + + /* TODO(imax): insert a delay to allow EC to react. */ /* Check EC decision */ - GPIO_PIN_GET(gpio_dev, EC_GPIO, &status); + GPIO_PIN_GET(gpio_dev, sc->ec_gpio, &status); if (status == 1) { /* Okay. We have bus */ @@ -108,13 +114,18 @@ bus_release(struct ec_softc *sc) { device_t gpio_dev; + if (sc->our_gpio == 0 || sc->ec_gpio == 0) { + device_printf(sc->dev, "i2c arbitrator is not configured\n"); + return (1); + } + gpio_dev = devclass_get_device(devclass_find("gpio"), 0); - if (gpio_dev == NULL) { + if (gpio_dev == NULL) { device_printf(sc->dev, "cant find gpio_dev\n"); return (1); } - GPIO_PIN_SET(gpio_dev, OUR_GPIO, GPIO_PIN_HIGH); + GPIO_PIN_SET(gpio_dev, sc->our_gpio, GPIO_PIN_HIGH); return (0); } @@ -154,7 +165,7 @@ ec_command(uint8_t cmd, uint8_t *dout, uint8_t dout_len, int i; msg_dout = malloc(dout_len + 4, M_DEVBUF, M_NOWAIT); - msg_dinp = malloc(dinp_len + 4, M_DEVBUF, M_NOWAIT); + msg_dinp = malloc(dinp_len + 3, M_DEVBUF, M_NOWAIT); if (ec_sc == NULL) return (-1); @@ -173,7 +184,7 @@ ec_command(uint8_t cmd, uint8_t *dout, uint8_t dout_len, struct iic_msg msgs[] = { { 0x1e, IIC_M_WR, dout_len + 4, msg_dout, }, - { 0x1e, IIC_M_RD, dinp_len + 4, msg_dinp, }, + { 0x1e, IIC_M_RD, dinp_len + 3, msg_dinp, }, }; ret = iicbus_transfer(sc->dev, msgs, 2); @@ -185,7 +196,7 @@ ec_command(uint8_t cmd, uint8_t *dout, uint8_t dout_len, } for (i = 0; i < dinp_len; i++) { - dinp[i] = msg_dinp[i + 3]; + dinp[i] = msg_dinp[i + 2]; }; free(msg_dout, M_DEVBUF); @@ -209,6 +220,28 @@ int ec_hello(void) return (0); } +static void +configure_i2c_arbitrator(struct ec_softc *sc) +{ + phandle_t arbitrator; + + /* TODO(imax): look for compatible entry instead of hard-coded path */ + arbitrator = OF_finddevice("/i2c-arbitrator"); + if (arbitrator > 0 && + OF_hasprop(arbitrator, "freebsd,our-gpio") && + OF_hasprop(arbitrator, "freebsd,ec-gpio")) { + sc->have_arbitrator = 1; + OF_getencprop(arbitrator, "freebsd,our-gpio", + &sc->our_gpio, sizeof(sc->our_gpio)); + OF_getencprop(arbitrator, "freebsd,ec-gpio", + &sc->ec_gpio, sizeof(sc->ec_gpio)); + } else { + sc->have_arbitrator = 0; + sc->our_gpio = 0; + sc->ec_gpio = 0; + } +} + static int ec_attach(device_t dev) { @@ -219,6 +252,8 @@ ec_attach(device_t dev) ec_sc = sc; + configure_i2c_arbitrator(sc); + /* * Claim the bus. * @@ -227,7 +262,7 @@ ec_attach(device_t dev) * */ - if (bus_claim(sc) != 0) { + if (sc->have_arbitrator && bus_claim(sc) != 0) { return (ENXIO); } @@ -241,7 +276,9 @@ ec_detach(device_t dev) sc = device_get_softc(dev); - bus_release(sc); + if (sc->have_arbitrator) { + bus_release(sc); + } return (0); } diff --git a/sys/arm/samsung/exynos/chrome_kb.c b/sys/arm/samsung/exynos/chrome_kb.c index 1ce028117c8..d5d55e9233d 100644 --- a/sys/arm/samsung/exynos/chrome_kb.c +++ b/sys/arm/samsung/exynos/chrome_kb.c @@ -105,9 +105,6 @@ __FBSDID("$FreeBSD$"); #define CKB_FLAG_POLLING 0x2 #define KBD_DRIVER_NAME "ckbd" -/* TODO: take interrupt from DTS */ -#define KB_GPIO_INT 146 - struct ckb_softc { keyboard_t sc_kbd; keymap_t sc_keymap; @@ -130,8 +127,11 @@ struct ckb_softc { int flag; int rows; int cols; + int gpio; device_t dev; + device_t gpio_dev; struct thread *sc_poll_thread; + uint16_t *keymap; uint8_t *scan_local; uint8_t *scan; @@ -198,7 +198,7 @@ static int ckb_intr(keyboard_t *kbd, void *arg) { - return (0); + return (0); } /* lock the access to the keyboard, not used */ @@ -206,7 +206,7 @@ static int ckb_lock(keyboard_t *kbd, int lock) { - return (1); + return (1); } /* clear the internal state of the keyboard */ @@ -308,20 +308,33 @@ ckb_read(keyboard_t *kbd, int wait) return (0); } -int scantokey(int i, int j); - -int -scantokey(int i, int j) +static uint16_t +keymap_read(struct ckb_softc *sc, int col, int row) { - int k; - for (k = 0; k < KEYMAP_LEN; k++) - if ((keymap[k].col == i) && (keymap[k].row == j)) - return (keymap[k].key); + KASSERT(sc->keymap != NULL, "keymap_read: no keymap"); + if (col >= 0 && col < sc->cols && + row >= 0 && row < sc->rows) { + return sc->keymap[row * sc->cols + col]; + } return (0); } +static int +keymap_write(struct ckb_softc *sc, int col, int row, uint16_t key) +{ + + KASSERT(sc->keymap != NULL, "keymap_write: no keymap"); + if (col >= 0 && col < sc->cols && + row >= 0 && row < sc->rows) { + sc->keymap[row * sc->cols + col] = key; + return (0); + } + + return (-1); +} + /* read char from the keyboard */ static uint32_t ckb_read_char_locked(keyboard_t *kbd, int wait) @@ -331,6 +344,7 @@ ckb_read_char_locked(keyboard_t *kbd, int wait) uint16_t key; int oldbit; int newbit; + int status; sc = kbd->kb_data; @@ -347,7 +361,21 @@ ckb_read_char_locked(keyboard_t *kbd, int wait) }; if (sc->sc_flags & CKB_FLAG_POLLING) { - /* TODO */ + for (;;) { + GPIO_PIN_GET(sc->gpio_dev, sc->gpio, &status); + if (status == 0) { + if (ec_command(EC_CMD_MKBP_STATE, sc->scan, + sc->cols, + sc->scan, sc->cols)) { + return (NOKEY); + } + break; + } + if (!wait) { + return (NOKEY); + } + DELAY(1000); + } }; for (i = 0; i < sc->cols; i++) { @@ -358,7 +386,7 @@ ckb_read_char_locked(keyboard_t *kbd, int wait) if (oldbit == newbit) continue; - key = scantokey(i,j); + key = keymap_read(sc, i, j); if (key == 0) { continue; }; @@ -651,27 +679,109 @@ dummy_kbd_configure(int flags) KEYBOARD_DRIVER(ckbd, ckbdsw, dummy_kbd_configure); +/* + * Parses 'keymap' into sc->keymap. + * Requires sc->cols and sc->rows to be set. + */ +static int +parse_keymap(struct ckb_softc *sc, pcell_t *keymap, size_t len) +{ + int i; + + sc->keymap = malloc(sc->cols * sc->rows * sizeof(sc->keymap[0]), + M_DEVBUF, M_NOWAIT | M_ZERO); + if (sc->keymap == NULL) { + return (ENOMEM); + } + + for (i = 0; i < len; i++) { + /* + * Return value is ignored, we just write whatever fits into + * specified number of rows and columns and silently ignore + * everything else. + * Keymap entries follow this format: 0xRRCCKKKK + * RR - row number, CC - column number, KKKK - key code + */ + keymap_write(sc, (keymap[i] >> 16) & 0xff, + (keymap[i] >> 24) & 0xff, + keymap[i] & 0xffff); + } + + return (0); +} + +/* Allocates a new array for keymap and returns it in 'keymap'. */ +static int +read_keymap(phandle_t node, const char *prop, pcell_t **keymap, size_t *len) +{ + + if ((*len = OF_getproplen(node, prop)) <= 0) { + return (ENXIO); + } + if ((*keymap = malloc(*len, M_DEVBUF, M_NOWAIT)) == NULL) { + return (ENOMEM); + } + if (OF_getencprop(node, prop, *keymap, *len) != *len) { + return (ENXIO); + } + return (0); +} + static int parse_dts(struct ckb_softc *sc) { phandle_t node; pcell_t dts_value; - int len; + pcell_t *keymap; + int len, ret; + const char *keymap_prop = NULL; if ((node = ofw_bus_get_node(sc->dev)) == -1) return (ENXIO); - if ((len = OF_getproplen(node, "keypad,num-rows")) <= 0) + if ((len = OF_getproplen(node, "google,key-rows")) <= 0) return (ENXIO); - OF_getprop(node, "keypad,num-rows", &dts_value, len); + OF_getprop(node, "google,key-rows", &dts_value, len); sc->rows = fdt32_to_cpu(dts_value); - if ((len = OF_getproplen(node, "keypad,num-columns")) <= 0) + if ((len = OF_getproplen(node, "google,key-columns")) <= 0) return (ENXIO); - OF_getprop(node, "keypad,num-columns", &dts_value, len); + OF_getprop(node, "google,key-columns", &dts_value, len); sc->cols = fdt32_to_cpu(dts_value); - if ((sc->rows == 0) || (sc->cols == 0)) + if ((len = OF_getproplen(node, "freebsd,intr-gpio")) <= 0) + return (ENXIO); + OF_getprop(node, "freebsd,intr-gpio", &dts_value, len); + sc->gpio = fdt32_to_cpu(dts_value); + + if (OF_hasprop(node, "freebsd,keymap")) { + keymap_prop = "freebsd,keymap"; + device_printf(sc->dev, "using FreeBSD-specific keymap from FDT\n"); + } else if (OF_hasprop(node, "linux,keymap")) { + keymap_prop = "linux,keymap"; + device_printf(sc->dev, "using Linux keymap from FDT\n"); + } else { + device_printf(sc->dev, "using built-in keymap\n"); + } + + if (keymap_prop != NULL) { + if ((ret = read_keymap(node, keymap_prop, &keymap, &len))) { + device_printf(sc->dev, + "failed to read keymap from FDT: %d\n", ret); + return (ret); + } + ret = parse_keymap(sc, keymap, len); + free(keymap, M_DEVBUF); + if (ret) { + return (ret); + } + } else { + if ((ret = parse_keymap(sc, default_keymap, KEYMAP_LEN))) { + return (ret); + } + } + + if ((sc->rows == 0) || (sc->cols == 0) || (sc->gpio == 0)) return (ENXIO); return (0); @@ -706,17 +816,23 @@ chrome_kb_attach(device_t dev) sc = device_get_softc(dev); sc->dev = dev; + sc->keymap = NULL; if ((error = parse_dts(sc)) != 0) return error; + sc->gpio_dev = devclass_get_device(devclass_find("gpio"), 0); + if (sc->gpio_dev == NULL) { + device_printf(sc->dev, "Can't find gpio device.\n"); + return (ENXIO); + } + #if 0 device_printf(sc->dev, "Keyboard matrix [%dx%d]\n", sc->cols, sc->rows); #endif - /* TODO: take interrupt from DTS */ - pad_setup_intr(KB_GPIO_INT, ckb_ec_intr, sc); + pad_setup_intr(sc->gpio, ckb_ec_intr, sc); kbd = &sc->sc_kbd; rid = 0; @@ -765,7 +881,8 @@ chrome_kb_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (ofw_bus_is_compatible(dev, "google,cros-ec-keyb")) { + if (ofw_bus_is_compatible(dev, "google,cros-ec-keyb") || + ofw_bus_is_compatible(dev, "google,mkbp-keyb")) { device_set_desc(dev, "Chrome EC Keyboard"); return (BUS_PROBE_DEFAULT); } @@ -773,9 +890,24 @@ chrome_kb_probe(device_t dev) return (ENXIO); } +static int +chrome_kb_detach(device_t dev) +{ + struct ckb_softc *sc; + + sc = device_get_softc(dev); + + if (sc->keymap != NULL) { + free(sc->keymap, M_DEVBUF); + } + + return 0; +} + static device_method_t chrome_kb_methods[] = { DEVMETHOD(device_probe, chrome_kb_probe), DEVMETHOD(device_attach, chrome_kb_attach), + DEVMETHOD(device_detach, chrome_kb_detach), { 0, 0 } }; diff --git a/sys/arm/samsung/exynos/chrome_kb.h b/sys/arm/samsung/exynos/chrome_kb.h index 3903a9be830..6ff03861b32 100644 --- a/sys/arm/samsung/exynos/chrome_kb.h +++ b/sys/arm/samsung/exynos/chrome_kb.h @@ -26,97 +26,93 @@ * $FreeBSD$ */ -void ckb_ec_intr(void *); +#include -struct key { - uint8_t row; - uint8_t col; - uint8_t key; -}; +void ckb_ec_intr(void *); #define KEYMAP_LEN 75 -struct key keymap[KEYMAP_LEN] = { - { 0x00, 0x01, 0x7d }, /* lmeta */ - { 0x00, 0x02, 0x3b }, /* F1 */ - { 0x00, 0x03, 0x30 }, /* B */ - { 0x00, 0x04, 0x44 }, /* F10 */ - { 0x00, 0x06, 0x31 }, /* N */ - { 0x00, 0x08, 0x0d }, /* = */ - { 0x00, 0x0a, 0x64 }, /* ralt */ +pcell_t default_keymap[KEYMAP_LEN] = { + 0x0001007d, /* lmeta */ + 0x0002003b, /* F1 */ + 0x00030030, /* B */ + 0x00040044, /* F10 */ + 0x00060031, /* N */ + 0x0008000d, /* = */ + 0x000a0064, /* ralt */ - { 0x01, 0x01, 0x01 }, /* escape */ - { 0x01, 0x02, 0x3e }, /* F4 */ - { 0x01, 0x03, 0x22 }, /* G */ - { 0x01, 0x04, 0x41 }, /* F7 */ - { 0x01, 0x06, 0x23 }, /* H */ - { 0x01, 0x08, 0x28 }, /* ' */ - { 0x01, 0x09, 0x43 }, /* F9 */ - { 0x01, 0x0b, 0x0e }, /* backspace */ + 0x01010001, /* escape */ + 0x0102003e, /* F4 */ + 0x01030022, /* G */ + 0x01040041, /* F7 */ + 0x01060023, /* H */ + 0x01080028, /* ' */ + 0x01090043, /* F9 */ + 0x010b000e, /* backspace */ - { 0x02, 0x00, 0x1d }, /* lctrl */ - { 0x02, 0x01, 0x0f }, /* tab */ - { 0x02, 0x02, 0x3d }, /* F3 */ - { 0x02, 0x03, 0x14 }, /* t */ - { 0x02, 0x04, 0x40 }, /* F6 */ - { 0x02, 0x05, 0x1b }, /* ] */ - { 0x02, 0x06, 0x15 }, /* y */ - { 0x02, 0x07, 0x56 }, /* 102nd */ - { 0x02, 0x08, 0x1a }, /* [ */ - { 0x02, 0x09, 0x42 }, /* F8 */ + 0x0200001d, /* lctrl */ + 0x0201000f, /* tab */ + 0x0202003d, /* F3 */ + 0x02030014, /* t */ + 0x02040040, /* F6 */ + 0x0205001b, /* ] */ + 0x02060015, /* y */ + 0x02070056, /* 102nd */ + 0x0208001a, /* [ */ + 0x02090042, /* F8 */ - { 0x03, 0x01, 0x29 }, /* grave */ - { 0x03, 0x02, 0x3c }, /* F2 */ - { 0x03, 0x03, 0x06 }, /* 5 */ - { 0x03, 0x04, 0x3f }, /* F5 */ - { 0x03, 0x06, 0x07 }, /* 6 */ - { 0x03, 0x08, 0x0c }, /* - */ - { 0x03, 0x0b, 0x2b }, /* \ */ + 0x03010029, /* grave */ + 0x0302003c, /* F2 */ + 0x03030006, /* 5 */ + 0x0304003f, /* F5 */ + 0x03060007, /* 6 */ + 0x0308000c, /* - */ + 0x030b002b, /* \ */ - { 0x04, 0x00, 0x61 }, /* rctrl */ - { 0x04, 0x01, 0x1e }, /* a */ - { 0x04, 0x02, 0x20 }, /* d */ - { 0x04, 0x03, 0x21 }, /* f */ - { 0x04, 0x04, 0x1f }, /* s */ - { 0x04, 0x05, 0x25 }, /* k */ - { 0x04, 0x06, 0x24 }, /* j */ - { 0x04, 0x08, 0x27 }, /* ; */ - { 0x04, 0x09, 0x26 }, /* l */ - { 0x04, 0x0a, 0x2b }, /* \ */ - { 0x04, 0x0b, 0x1c }, /* enter */ + 0x04000061, /* rctrl */ + 0x0401001e, /* a */ + 0x04020020, /* d */ + 0x04030021, /* f */ + 0x0404001f, /* s */ + 0x04050025, /* k */ + 0x04060024, /* j */ + 0x04080027, /* ; */ + 0x04090026, /* l */ + 0x040a002b, /* \ */ + 0x040b001c, /* enter */ - { 0x05, 0x01, 0x2c }, /* z */ - { 0x05, 0x02, 0x2e }, /* c */ - { 0x05, 0x03, 0x2f }, /* v */ - { 0x05, 0x04, 0x2d }, /* x */ - { 0x05, 0x05, 0x33 }, /* , */ - { 0x05, 0x06, 0x32 }, /* m */ - { 0x05, 0x07, 0x2a }, /* lsh */ - { 0x05, 0x08, 0x35 }, /* / */ - { 0x05, 0x09, 0x34 }, /* . */ - { 0x05, 0x0B, 0x39 }, /* space */ + 0x0501002c, /* z */ + 0x0502002e, /* c */ + 0x0503002f, /* v */ + 0x0504002d, /* x */ + 0x05050033, /* , */ + 0x05060032, /* m */ + 0x0507002a, /* lsh */ + 0x05080035, /* / */ + 0x05090034, /* . */ + 0x050B0039, /* space */ - { 0x06, 0x01, 0x02 }, /* 1 */ - { 0x06, 0x02, 0x04 }, /* 3 */ - { 0x06, 0x03, 0x05 }, /* 4 */ - { 0x06, 0x04, 0x03 }, /* 2 */ - { 0x06, 0x05, 0x09 }, /* 8 */ - { 0x06, 0x06, 0x08 }, /* 7 */ - { 0x06, 0x08, 0x0b }, /* 0 */ - { 0x06, 0x09, 0x0a }, /* 9 */ - { 0x06, 0x0a, 0x38 }, /* lalt */ - { 0x06, 0x0b, 0x64 }, /* down */ - { 0x06, 0x0c, 0x62 }, /* right */ + 0x06010002, /* 1 */ + 0x06020004, /* 3 */ + 0x06030005, /* 4 */ + 0x06040003, /* 2 */ + 0x06050009, /* 8 */ + 0x06060008, /* 7 */ + 0x0608000b, /* 0 */ + 0x0609000a, /* 9 */ + 0x060a0038, /* lalt */ + 0x060b0064, /* down */ + 0x060c0062, /* right */ - { 0x07, 0x01, 0x10 }, /* q */ - { 0x07, 0x02, 0x12 }, /* e */ - { 0x07, 0x03, 0x13 }, /* r */ - { 0x07, 0x04, 0x11 }, /* w */ - { 0x07, 0x05, 0x17 }, /* i */ - { 0x07, 0x06, 0x16 }, /* u */ - { 0x07, 0x07, 0x36 }, /* rsh */ - { 0x07, 0x08, 0x19 }, /* p */ - { 0x07, 0x09, 0x18 }, /* o */ - { 0x07, 0x0b, 0x5F }, /* up */ - { 0x07, 0x0c, 0x61 }, /* left */ + 0x07010010, /* q */ + 0x07020012, /* e */ + 0x07030013, /* r */ + 0x07040011, /* w */ + 0x07050017, /* i */ + 0x07060016, /* u */ + 0x07070036, /* rsh */ + 0x07080019, /* p */ + 0x07090018, /* o */ + 0x070b005F, /* up */ + 0x070c0061, /* left */ }; diff --git a/sys/arm/samsung/exynos/exynos5_combiner.c b/sys/arm/samsung/exynos/exynos5_combiner.c index e7bb8961d76..bb18a1b512a 100644 --- a/sys/arm/samsung/exynos/exynos5_combiner.c +++ b/sys/arm/samsung/exynos/exynos5_combiner.c @@ -57,7 +57,6 @@ __FBSDID("$FreeBSD$"); #include #define NGRP 32 -#define ITABLE_LEN 24 #define IESR(n) (0x10 * n + 0x0) /* Interrupt enable set */ #define IECR(n) (0x10 * n + 0x4) /* Interrupt enable clear */ @@ -118,7 +117,7 @@ struct combiner_entry { char *source_name; }; -static struct combiner_entry interrupt_table[ITABLE_LEN] = { +static struct combiner_entry interrupt_table[] = { { 63, 1, "EINT[15]" }, { 63, 0, "EINT[14]" }, { 62, 1, "EINT[13]" }, @@ -143,8 +142,116 @@ static struct combiner_entry interrupt_table[ITABLE_LEN] = { { 55, 4, "MCT_G1" }, { 55, 3, "MCT_G0" }, { 55, 0, "EINT[0]" }, + { 54, 7, "CPU_nCNTVIRQ[1]" }, + { 54, 6, "CPU_nCTIIRQ[1]" }, + { 54, 5, "CPU_nCNTPSIRQ[1]" }, + { 54, 4, "CPU_nPMUIRQ[1]" }, + { 54, 3, "CPU_nCNTPNSIRQ[1]" }, + { 54, 2, "CPU_PARITYFAILSCU[1]" }, + { 54, 1, "CPU_nCNTHPIRQ[1]" }, + { 54, 0, "PARITYFAIL[1]" }, + { 53, 1, "CPU_nIRQ[1]" }, + { 52, 0, "CPU_nIRQ[0]" }, + { 51, 7, "CPU_nRAMERRIRQ" }, + { 51, 6, "CPU_nAXIERRIRQ" }, + { 51, 4, "INT_COMB_ISP_GIC" }, + { 51, 3, "INT_COMB_IOP_GIC" }, + { 51, 2, "CCI_nERRORIRQ" }, + { 51, 1, "INT_COMB_ARMISP_GIC" }, + { 51, 0, "INT_COMB_ARMIOP_GIC" }, + { 50, 7, "DISP1[3]" }, + { 50, 6, "DISP1[2]" }, + { 50, 5, "DISP1[1]" }, + { 50, 4, "DISP1[0]" }, + { 49, 3, "SSCM_PULSE_IRQ_C2CIF[1]" }, + { 49, 2, "SSCM_PULSE_IRQ_C2CIF[0]" }, + { 49, 1, "SSCM_IRQ_C2CIF[1]" }, + { 49, 0, "SSCM_IRQ_C2CIF[0]" }, + { 48, 3, "PEREV_M1_CDREX" }, + { 48, 2, "PEREV_M0_CDREX" }, + { 48, 1, "PEREV_A1_CDREX" }, + { 48, 0, "PEREV_A0_CDREX" }, + { 47, 3, "MDMA0_ABORT" }, + /* 46 is fully reserved */ + { 45, 1, "MDMA1_ABORT" }, + /* 44 is fully reserved */ + { 43, 7, "SYSMMU_DRCISP[1]" }, + { 43, 6, "SYSMMU_DRCISP[0]" }, + { 43, 1, "SYSMMU_ODC[1]" }, + { 43, 0, "SYSMMU_ODC[0]" }, + { 42, 7, "SYSMMU_ISP[1]" }, + { 42, 6, "SYSMMU_ISP[0]" }, + { 42, 5, "SYSMMU_DIS0[1]" }, + { 42, 4, "SYSMMU_DIS0[0]" }, + { 42, 3, "DP1" }, + { 41, 5, "SYSMMU_DIS1[1]" }, + { 41, 4, "SYSMMU_DIS1[0]" }, + { 40, 6, "SYSMMU_MFCL[1]" }, + { 40, 5, "SYSMMU_MFCL[0]" }, + { 39, 5, "SYSMMU_TV_M0[1]" }, + { 39, 4, "SYSMMU_TV_M0[0]" }, + { 39, 3, "SYSMMU_MDMA1[1]" }, + { 39, 2, "SYSMMU_MDMA1[0]" }, + { 39, 1, "SYSMMU_MDMA0[1]" }, + { 39, 0, "SYSMMU_MDMA0[0]" }, + { 38, 7, "SYSMMU_SSS[1]" }, + { 38, 6, "SYSMMU_SSS[0]" }, + { 38, 5, "SYSMMU_RTIC[1]" }, + { 38, 4, "SYSMMU_RTIC[0]" }, + { 38, 3, "SYSMMU_MFCR[1]" }, + { 38, 2, "SYSMMU_MFCR[0]" }, + { 38, 1, "SYSMMU_ARM[1]" }, + { 38, 0, "SYSMMU_ARM[0]" }, + { 37, 7, "SYSMMU_3DNR[1]" }, + { 37, 6, "SYSMMU_3DNR[0]" }, + { 37, 5, "SYSMMU_MCUISP[1]" }, + { 37, 4, "SYSMMU_MCUISP[0]" }, + { 37, 3, "SYSMMU_SCALERCISP[1]" }, + { 37, 2, "SYSMMU_SCALERCISP[0]" }, + { 37, 1, "SYSMMU_FDISP[1]" }, + { 37, 0, "SYSMMU_FDISP[0]" }, + { 36, 7, "MCUIOP_CTIIRQ" }, + { 36, 6, "MCUIOP_PMUIRQ" }, + { 36, 5, "MCUISP_CTIIRQ" }, + { 36, 4, "MCUISP_PMUIRQ" }, + { 36, 3, "SYSMMU_JPEGX[1]" }, + { 36, 2, "SYSMMU_JPEGX[0]" }, + { 36, 1, "SYSMMU_ROTATOR[1]" }, + { 36, 0, "SYSMMU_ROTATOR[0]" }, + { 35, 7, "SYSMMU_SCALERPISP[1]" }, + { 35, 6, "SYSMMU_SCALERPISP[0]" }, + { 35, 5, "SYSMMU_FIMC_LITE0[1]" }, + { 35, 4, "SYSMMU_FIMC_LITE0[0]" }, + { 35, 3, "SYSMMU_DISP1_M0[1]" }, + { 35, 2, "SYSMMU_DISP1_M0[0]" }, + { 35, 1, "SYSMMU_FIMC_LITE2[1]" }, + { 35, 0, "SYSMMU_FIMC_LITE2[0]" }, + { 34, 7, "SYSMMU_GSCL3[1]" }, + { 34, 6, "SYSMMU_GSCL3[0]" }, + { 34, 5, "SYSMMU_GSCL2[1]" }, + { 34, 4, "SYSMMU_GSCL2[0]" }, + { 34, 3, "SYSMMU_GSCL1[1]" }, + { 34, 2, "SYSMMU_GSCL1[0]" }, + { 34, 1, "SYSMMU_GSCL0[1]" }, + { 34, 0, "SYSMMU_GSCL0[0]" }, + { 33, 7, "CPU_nCNTVIRQ[0]" }, + { 33, 6, "CPU_nCNTPSIRQ[0]" }, + { 33, 5, "CPU_nCNTPSNIRQ[0]" }, + { 33, 4, "CPU_nCNTHPIRQ[0]" }, + { 33, 3, "CPU_nCTIIRQ[0]" }, + { 33, 2, "CPU_nPMUIRQ[0]" }, + { 33, 1, "CPU_PARITYFAILSCU[0]" }, + { 33, 0, "CPU_PARITYFAIL0" }, + { 32, 7, "TZASC_XR1BXW" }, + { 32, 6, "TZASC_XR1BXR" }, + { 32, 5, "TZASC_XLBXW" }, + { 32, 4, "TZASC_XLBXR" }, + { 32, 3, "TZASC_DRBXW" }, + { 32, 2, "TZASC_DRBXR" }, + { 32, 1, "TZASC_CBXW" }, + { 32, 0, "TZASC_CBXR" }, - /* TODO: add groups 54-32 */ + { -1, -1, NULL }, }; struct combined_intr { @@ -212,7 +319,7 @@ combiner_setup_intr(char *source_name, void (*ih)(void *), void *ih_user) entry = NULL; - for (i = 0; i < ITABLE_LEN; i++) { + for (i = 0; i < NGRP && interrupt_table[i].bit != -1; i++) { if (strcmp(interrupt_table[i].source_name, source_name) == 0) { entry = &interrupt_table[i]; } diff --git a/sys/arm/samsung/exynos/exynos5_ehci.c b/sys/arm/samsung/exynos/exynos5_ehci.c index 7dacafa72a0..84e4c5f05b6 100644 --- a/sys/arm/samsung/exynos/exynos5_ehci.c +++ b/sys/arm/samsung/exynos/exynos5_ehci.c @@ -179,10 +179,44 @@ gpio_ctrl(struct exynos_ehci_softc *esc, int dir, int power) return (0); } +static int +reset_hsic_hub(struct exynos_ehci_softc *esc, phandle_t hub) +{ + device_t gpio_dev; + pcell_t pin; + + /* TODO(imax): check that hub is compatible with "smsc,usb3503" */ + if (!OF_hasprop(hub, "freebsd,reset-gpio")) { + device_printf(esc->dev, + "cannot detect reset GPIO pin for HSIC hub\n"); + return (1); + } + + if (OF_getencprop(hub, "freebsd,reset-gpio", &pin, sizeof(pin)) < 0) { + device_printf(esc->dev, + "failed to decode reset GPIO pin number for HSIC hub\n"); + return (1); + } + + /* Get the GPIO device, we need this to give power to USB */ + gpio_dev = devclass_get_device(devclass_find("gpio"), 0); + if (gpio_dev == NULL) { + device_printf(esc->dev, "cant find gpio_dev\n"); + return (1); + } + + GPIO_PIN_SET(gpio_dev, pin, GPIO_PIN_LOW); + DELAY(100); + GPIO_PIN_SET(gpio_dev, pin, GPIO_PIN_HIGH); + + return (0); +} + static int phy_init(struct exynos_ehci_softc *esc) { int reg; + phandle_t hub; gpio_ctrl(esc, GPIO_INPUT, 1); @@ -212,6 +246,10 @@ phy_init(struct exynos_ehci_softc *esc) reg &= ~(HOST_CTRL_RESET_LINK); bus_space_write_4(esc->host_bst, esc->host_bsh, 0x0, reg); + if ((hub = OF_finddevice("/hsichub")) != 0) { + reset_hsic_hub(esc, hub); + } + gpio_ctrl(esc, GPIO_OUTPUT, 1); return (0); diff --git a/sys/arm/samsung/exynos/exynos5_i2c.c b/sys/arm/samsung/exynos/exynos5_i2c.c index bf7548fad83..ef63a7e7f5f 100644 --- a/sys/arm/samsung/exynos/exynos5_i2c.c +++ b/sys/arm/samsung/exynos/exynos5_i2c.c @@ -372,6 +372,13 @@ i2c_read(device_t dev, char *buf, int len, mtx_lock(&sc->mutex); /* dummy read */ + clear_ipend(sc); + error = wait_for_iif(sc); + if (error) { + DPRINTF("cant i2c read: iif error\n"); + mtx_unlock(&sc->mutex); + return (error); + } READ1(sc, I2CDS); DPRINTF("Read "); diff --git a/sys/arm/samsung/exynos/exynos5_machdep.c b/sys/arm/samsung/exynos/exynos5_machdep.c index c10ccab809e..9e99f68b11e 100644 --- a/sys/arm/samsung/exynos/exynos5_machdep.c +++ b/sys/arm/samsung/exynos/exynos5_machdep.c @@ -41,38 +41,42 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include vm_offset_t -initarm_lastaddr(void) +platform_lastaddr(void) { return (arm_devmap_lastaddr()); } void -initarm_early_init(void) +platform_probe_and_attach(void) { } void -initarm_gpio_init(void) +platform_gpio_init(void) { } void -initarm_late_init(void) +platform_late_init(void) { } int -initarm_devmap_init(void) +platform_devmap_init(void) { + /* CHIP ID */ + arm_devmap_add_entry(0x10000000, 0x100000); + /* UART */ arm_devmap_add_entry(0x12C00000, 0x100000); diff --git a/sys/arm/samsung/exynos/exynos5_mp.c b/sys/arm/samsung/exynos/exynos5_mp.c index 7b97a6e12d4..aaeaf8059a1 100644 --- a/sys/arm/samsung/exynos/exynos5_mp.c +++ b/sys/arm/samsung/exynos/exynos5_mp.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013 Ruslan Bukin + * Copyright (c) 2013-2014 Ruslan Bukin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,7 +37,34 @@ __FBSDID("$FreeBSD$"); #include #include -#define EXYNOS_SYSRAM 0x02020000 +#define EXYNOS_CHIPID 0x10000000 + +#define EXYNOS5250_SOC_ID 0x43520000 +#define EXYNOS5420_SOC_ID 0xE5420000 +#define EXYNOS5_SOC_ID_MASK 0xFFFFF000 + +#define EXYNOS_SYSRAM 0x02020000 +#define EXYNOS5420_SYSRAM_NS (EXYNOS_SYSRAM + 0x53000 + 0x1c) + +#define EXYNOS_PMU_BASE 0x10040000 +#define CORE_CONFIG(n) (0x2000 + (0x80 * (n))) +#define CORE_STATUS(n) (CORE_CONFIG(n) + 0x4) +#define CORE_PWR_EN 0x3 + +static int +exynos_get_soc_id(void) +{ + bus_addr_t chipid; + int reg; + + if (bus_space_map(fdtbus_bs_tag, EXYNOS_CHIPID, + 0x1000, 0, &chipid) != 0) + panic("Couldn't map chipid\n"); + reg = bus_space_read_4(fdtbus_bs_tag, chipid, 0x0); + bus_space_unmap(fdtbus_bs_tag, chipid, 0x1000); + + return (reg & EXYNOS5_SOC_ID_MASK); +} void platform_mp_init_secondary(void) @@ -50,27 +77,58 @@ void platform_mp_setmaxid(void) { - mp_maxid = 1; + if (exynos_get_soc_id() == EXYNOS5420_SOC_ID) + mp_ncpus = 4; + else + mp_ncpus = 2; + + mp_maxid = mp_ncpus - 1; } int platform_mp_probe(void) { - mp_ncpus = 2; - return (1); + return (mp_ncpus > 1); } void platform_mp_start_ap(void) { - bus_addr_t sysram; - int err; + bus_addr_t sysram, pmu; + int err, i, j; + int status; + int reg; - err = bus_space_map(fdtbus_bs_tag, EXYNOS_SYSRAM, 0x100, 0, &sysram); + err = bus_space_map(fdtbus_bs_tag, EXYNOS_PMU_BASE, 0x20000, 0, &pmu); + if (err != 0) + panic("Couldn't map pmu\n"); + + if (exynos_get_soc_id() == EXYNOS5420_SOC_ID) + reg = EXYNOS5420_SYSRAM_NS; + else + reg = EXYNOS_SYSRAM; + + err = bus_space_map(fdtbus_bs_tag, reg, 0x100, 0, &sysram); if (err != 0) panic("Couldn't map sysram\n"); + /* Give power to CPUs */ + for (i = 1; i < mp_ncpus; i++) { + bus_space_write_4(fdtbus_bs_tag, pmu, CORE_CONFIG(i), + CORE_PWR_EN); + + for (j = 10; j >= 0; j--) { + status = bus_space_read_4(fdtbus_bs_tag, pmu, + CORE_STATUS(i)); + if ((status & CORE_PWR_EN) == CORE_PWR_EN) + break; + DELAY(10); + if (j == 0) + printf("Can't power on CPU%d\n", i); + } + } + bus_space_write_4(fdtbus_bs_tag, sysram, 0x0, pmap_kextract((vm_offset_t)mpentry)); @@ -79,6 +137,7 @@ platform_mp_start_ap(void) armv7_sev(); bus_space_unmap(fdtbus_bs_tag, sysram, 0x100); + bus_space_unmap(fdtbus_bs_tag, pmu, 0x20000); } void diff --git a/sys/arm/samsung/exynos/exynos5_pad.c b/sys/arm/samsung/exynos/exynos5_pad.c index f9f38d019cd..10e1a25d1a4 100644 --- a/sys/arm/samsung/exynos/exynos5_pad.c +++ b/sys/arm/samsung/exynos/exynos5_pad.c @@ -223,7 +223,7 @@ get_bank(int gpio_number, struct gpio_bank *bank, int *pin_shift) for (i = 0; i < NGRP; i++) { ngpio = gpio_map[i].ngpio; - if ((n + ngpio) >= gpio_number) { + if ((n + ngpio) > gpio_number) { *bank = gpio_map[i]; *pin_shift = (gpio_number - n); return (0); diff --git a/sys/arm/samsung/exynos/uart.c b/sys/arm/samsung/exynos/exynos_uart.c similarity index 97% rename from sys/arm/samsung/exynos/uart.c rename to sys/arm/samsung/exynos/exynos_uart.c index eef99ff808b..78bc085f63b 100644 --- a/sys/arm/samsung/exynos/uart.c +++ b/sys/arm/samsung/exynos/exynos_uart.c @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "uart_if.h" @@ -286,8 +286,13 @@ s3c2410_bus_setsig(struct uart_softc *sc, int sig) static int s3c2410_bus_receive(struct uart_softc *sc) { + struct uart_bas *bas; + + bas = &sc->sc_bas; + while (bus_space_read_4(bas->bst, bas->bsh, + SSCOM_UFSTAT) & UFSTAT_RXCOUNT) + uart_rx_put(sc, uart_getreg(&sc->sc_bas, SSCOM_URXH)); - uart_rx_put(sc, uart_getreg(&sc->sc_bas, SSCOM_URXH)); return (0); } diff --git a/sys/arm/samsung/exynos/uart.h b/sys/arm/samsung/exynos/exynos_uart.h similarity index 100% rename from sys/arm/samsung/exynos/uart.h rename to sys/arm/samsung/exynos/exynos_uart.h diff --git a/sys/arm/samsung/exynos/files.exynos5 b/sys/arm/samsung/exynos/files.exynos5 index 2bd3a16be89..90e1c9bca28 100644 --- a/sys/arm/samsung/exynos/files.exynos5 +++ b/sys/arm/samsung/exynos/files.exynos5 @@ -19,7 +19,7 @@ arm/samsung/exynos/exynos5_common.c standard arm/samsung/exynos/exynos5_machdep.c standard arm/samsung/exynos/exynos5_combiner.c standard arm/samsung/exynos/exynos5_pad.c optional gpio -arm/samsung/exynos/uart.c optional uart +arm/samsung/exynos/exynos_uart.c optional uart arm/samsung/exynos/exynos5_ehci.c optional ehci arm/samsung/exynos/exynos5_fimd.c optional vt arm/samsung/exynos/exynos5_i2c.c optional iicbus diff --git a/sys/arm/samsung/exynos/std.exynos5 b/sys/arm/samsung/exynos/std.exynos5250 similarity index 100% rename from sys/arm/samsung/exynos/std.exynos5 rename to sys/arm/samsung/exynos/std.exynos5250 diff --git a/sys/arm/samsung/exynos/std.exynos5420 b/sys/arm/samsung/exynos/std.exynos5420 new file mode 100644 index 00000000000..c6468e7d3b8 --- /dev/null +++ b/sys/arm/samsung/exynos/std.exynos5420 @@ -0,0 +1,21 @@ +# $FreeBSD$ + +makeoption ARM_LITTLE_ENDIAN + +cpu CPU_CORTEXA +machine arm armv6 + +options PHYSADDR=0x20000000 + +makeoptions KERNPHYSADDR=0x20f00000 +options KERNPHYSADDR=0x20f00000 + +makeoptions KERNVIRTADDR=0xc0f00000 +options KERNVIRTADDR=0xc0f00000 + +options ARM_L2_PIPT + +options IPI_IRQ_START=0 +options IPI_IRQ_END=15 + +files "../samsung/exynos/files.exynos5" diff --git a/sys/arm/tegra/files.tegra2 b/sys/arm/tegra/files.tegra2 deleted file mode 100644 index ce2c5a10c73..00000000000 --- a/sys/arm/tegra/files.tegra2 +++ /dev/null @@ -1,18 +0,0 @@ -# $FreeBSD$ - -arm/arm/bus_space_asm_generic.S standard -arm/arm/bus_space_generic.c standard -arm/arm/bus_space-v6.c standard -arm/arm/cpufunc_asm_armv5.S standard -arm/arm/cpufunc_asm_arm11.S standard -arm/arm/cpufunc_asm_armv7.S standard - -arm/arm/gic.c standard -arm/arm/mpcore_timer.c standard - -arm/tegra/tegra2_common.c standard -arm/tegra/tegra2_machdep.c standard - -kern/kern_clocksource.c standard - -dev/uart/uart_dev_ns8250.c optional uart diff --git a/sys/arm/tegra/std.tegra2 b/sys/arm/tegra/std.tegra2 deleted file mode 100644 index e8d5524c75e..00000000000 --- a/sys/arm/tegra/std.tegra2 +++ /dev/null @@ -1,14 +0,0 @@ -# nVidia Tegra 2 common options -#$FreeBSD$ - -cpu CPU_CORTEXA -machine arm armv6 - -options PHYSADDR=0x00000000 - -makeoptions KERNPHYSADDR=0x00200000 -options KERNPHYSADDR=0x00200000 -makeoptions KERNVIRTADDR=0xc0200000 -options KERNVIRTADDR=0xc0200000 - -files "../tegra/files.tegra2" diff --git a/sys/arm/tegra/tegra2_machdep.c b/sys/arm/tegra/tegra2_machdep.c deleted file mode 100644 index bd639aec1e2..00000000000 --- a/sys/arm/tegra/tegra2_machdep.c +++ /dev/null @@ -1,149 +0,0 @@ -/*- - * Copyright (c) 2011 Damjan Marion. - * 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. - * - * 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. - * - * from: FreeBSD: //depot/projects/arm/src/sys/arm/mv/mv_machdep.c - */ - -#include "opt_ddb.h" -#include "opt_platform.h" - -#include -__FBSDID("$FreeBSD$"); - -#define _ARM32_BUS_DMA_PRIVATE -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include - -#define TEGRA2_CLK_RST_PA_BASE 0x60006000 - -#define TEGRA2_CLK_RST_OSC_FREQ_DET_REG 0x58 -#define TEGRA2_CLK_RST_OSC_FREQ_DET_STAT_REG 0x5C -#define OSC_FREQ_DET_TRIG (1U<<31) -#define OSC_FREQ_DET_BUSY (1U<<31) - -#if 0 -static int -tegra2_osc_freq_detect(void) -{ - bus_space_handle_t bsh; - uint32_t c; - uint32_t r=0; - int i=0; - - struct { - uint32_t val; - uint32_t freq; - } freq_det_cnts[] = { - { 732, 12000000 }, - { 794, 13000000 }, - {1172, 19200000 }, - {1587, 26000000 }, - { -1, 0 }, - }; - - printf("Measuring...\n"); - bus_space_map(fdtbus_bs_tag,TEGRA2_CLK_RST_PA_BASE, 0x1000, 0, &bsh); - - bus_space_write_4(fdtbus_bs_tag, bsh, TEGRA2_CLK_RST_OSC_FREQ_DET_REG, - OSC_FREQ_DET_TRIG | 1 ); - do {} while (bus_space_read_4(fdtbus_bs_tag, bsh, - TEGRA2_CLK_RST_OSC_FREQ_DET_STAT_REG) & OSC_FREQ_DET_BUSY); - - c = bus_space_read_4(fdtbus_bs_tag, bsh, TEGRA2_CLK_RST_OSC_FREQ_DET_STAT_REG); - - while (freq_det_cnts[i].val > 0) { - if (((freq_det_cnts[i].val - 3) < c) && (c < (freq_det_cnts[i].val + 3))) - r = freq_det_cnts[i].freq; - i++; - } - printf("c=%u r=%u\n",c,r ); - bus_space_free(fdtbus_bs_tag, bsh, 0x1000); - return r; -} -#endif - -vm_offset_t -initarm_lastaddr(void) -{ - - return (arm_devmap_lastaddr()); -} - -void -initarm_early_init(void) -{ -} - -void -initarm_gpio_init(void) -{ -} - -void -initarm_late_init(void) -{ -} - -/* - * Add a static mapping for the register range that includes the debug uart. - * It's not clear this is needed, but the original code established this mapping - * before conversion to the newer arm_devmap_add_entry() routine. - */ -int -initarm_devmap_init(void) -{ - - arm_devmap_add_entry(0x70000000, 0x00100000); - return (0); -} - -struct arm32_dma_range * -bus_dma_get_range(void) -{ - - return (NULL); -} - -int -bus_dma_get_range_nb(void) -{ - - return (0); -} - diff --git a/sys/arm/ti/aintc.c b/sys/arm/ti/aintc.c index 659db15c820..213a1d366c7 100644 --- a/sys/arm/ti/aintc.c +++ b/sys/arm/ti/aintc.c @@ -180,5 +180,7 @@ arm_mask_irq(uintptr_t nb) void arm_unmask_irq(uintptr_t nb) { + + arm_irq_memory_barrier(nb); aintc_write_4(INTC_MIR_CLEAR(nb >> 5), (1UL << (nb & 0x1F))); } diff --git a/sys/arm/ti/am335x/am335x_lcd.c b/sys/arm/ti/am335x/am335x_lcd.c index 0f36513733f..b4e18b16c47 100644 --- a/sys/arm/ti/am335x/am335x_lcd.c +++ b/sys/arm/ti/am335x/am335x_lcd.c @@ -223,7 +223,7 @@ am335x_lcd_sysctl_backlight(SYSCTL_HANDLER_ARGS) int error; int backlight; - backlight = sc->sc_backlight;; + backlight = sc->sc_backlight; error = sysctl_handle_int(oidp, &backlight, 0, req); if (error != 0 || req->newptr == NULL) diff --git a/sys/arm/ti/am335x/am335x_prcm.c b/sys/arm/ti/am335x/am335x_prcm.c index 325a83885f2..7537a33fc47 100644 --- a/sys/arm/ti/am335x/am335x_prcm.c +++ b/sys/arm/ti/am335x/am335x_prcm.c @@ -190,7 +190,7 @@ static int am335x_clk_pruss_activate(struct ti_clock_dev *clkdev); .clk_get_source_freq = am335x_clk_hsmmc_get_source_freq \ } -struct ti_clock_dev ti_clk_devmap[] = { +struct ti_clock_dev ti_am335x_clk_devmap[] = { /* System clocks */ { .id = SYS_CLK, .clk_activate = NULL, diff --git a/sys/arm/ti/am335x/am335x_pwm.c b/sys/arm/ti/am335x/am335x_pwm.c index bf9f7c5b4b8..b544d643562 100644 --- a/sys/arm/ti/am335x/am335x_pwm.c +++ b/sys/arm/ti/am335x/am335x_pwm.c @@ -29,10 +29,11 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include #include +#include +#include #include +#include #include #include #include @@ -53,12 +54,13 @@ __FBSDID("$FreeBSD$"); /* In ticks */ #define DEFAULT_PWM_PERIOD 1000 +#define PWM_CLOCK 100000000UL #define PWM_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define PWM_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) #define PWM_LOCK_INIT(_sc) mtx_init(&(_sc)->sc_mtx, \ device_get_nameunit(_sc->sc_dev), "am335x_pwm softc", MTX_DEF) -#define PWM_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_mtx); +#define PWM_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_mtx) static struct resource_spec am335x_pwm_mem_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, /* PWMSS */ @@ -170,6 +172,8 @@ static struct resource_spec am335x_pwm_mem_spec[] = { static device_probe_t am335x_pwm_probe; static device_attach_t am335x_pwm_attach; static device_detach_t am335x_pwm_detach; + +static int am335x_pwm_clkdiv[8] = { 1, 2, 4, 8, 16, 32, 64, 128 }; struct am335x_pwm_softc { device_t sc_dev; @@ -177,6 +181,10 @@ struct am335x_pwm_softc { struct resource *sc_mem_res[4]; int sc_id; /* sysctl for configuration */ + int sc_pwm_clkdiv; + int sc_pwm_freq; + struct sysctl_oid *sc_clkdiv_oid; + struct sysctl_oid *sc_freq_oid; struct sysctl_oid *sc_period_oid; struct sysctl_oid *sc_chanA_oid; struct sysctl_oid *sc_chanB_oid; @@ -241,6 +249,98 @@ am335x_pwm_config_ecas(int unit, int period, int duty) return (0); } +static void +am335x_pwm_freq(struct am335x_pwm_softc *sc) +{ + int clkdiv; + + clkdiv = am335x_pwm_clkdiv[sc->sc_pwm_clkdiv]; + sc->sc_pwm_freq = PWM_CLOCK / (1 * clkdiv) / sc->sc_pwm_period; +} + +static int +am335x_pwm_sysctl_freq(SYSCTL_HANDLER_ARGS) +{ + int clkdiv, error, freq, i, period; + struct am335x_pwm_softc *sc; + uint32_t reg; + + sc = (struct am335x_pwm_softc *)arg1; + + PWM_LOCK(sc); + freq = sc->sc_pwm_freq; + PWM_UNLOCK(sc); + + error = sysctl_handle_int(oidp, &freq, sizeof(freq), req); + if (error != 0 || req->newptr == NULL) + return (error); + + if (freq > PWM_CLOCK) + freq = PWM_CLOCK; + + PWM_LOCK(sc); + if (freq != sc->sc_pwm_freq) { + for (i = nitems(am335x_pwm_clkdiv) - 1; i >= 0; i--) { + clkdiv = am335x_pwm_clkdiv[i]; + period = PWM_CLOCK / clkdiv / freq; + if (period > USHRT_MAX) + break; + sc->sc_pwm_clkdiv = i; + sc->sc_pwm_period = period; + } + /* Reset the duty cycle settings. */ + sc->sc_pwm_dutyA = 0; + sc->sc_pwm_dutyB = 0; + EPWM_WRITE2(sc, EPWM_CMPA, sc->sc_pwm_dutyA); + EPWM_WRITE2(sc, EPWM_CMPB, sc->sc_pwm_dutyB); + /* Update the clkdiv settings. */ + reg = EPWM_READ2(sc, EPWM_TBCTL); + reg &= ~TBCTL_CLKDIV_MASK; + reg |= TBCTL_CLKDIV(sc->sc_pwm_clkdiv); + EPWM_WRITE2(sc, EPWM_TBCTL, reg); + /* Update the period settings. */ + EPWM_WRITE2(sc, EPWM_TBPRD, sc->sc_pwm_period - 1); + am335x_pwm_freq(sc); + } + PWM_UNLOCK(sc); + + return (0); +} + +static int +am335x_pwm_sysctl_clkdiv(SYSCTL_HANDLER_ARGS) +{ + int error, i, clkdiv; + struct am335x_pwm_softc *sc; + uint32_t reg; + + sc = (struct am335x_pwm_softc *)arg1; + + PWM_LOCK(sc); + clkdiv = am335x_pwm_clkdiv[sc->sc_pwm_clkdiv]; + PWM_UNLOCK(sc); + + error = sysctl_handle_int(oidp, &clkdiv, sizeof(clkdiv), req); + if (error != 0 || req->newptr == NULL) + return (error); + + PWM_LOCK(sc); + if (clkdiv != am335x_pwm_clkdiv[sc->sc_pwm_clkdiv]) { + for (i = 0; i < nitems(am335x_pwm_clkdiv); i++) + if (clkdiv >= am335x_pwm_clkdiv[i]) + sc->sc_pwm_clkdiv = i; + + reg = EPWM_READ2(sc, EPWM_TBCTL); + reg &= ~TBCTL_CLKDIV_MASK; + reg |= TBCTL_CLKDIV(sc->sc_pwm_clkdiv); + EPWM_WRITE2(sc, EPWM_TBCTL, reg); + am335x_pwm_freq(sc); + } + PWM_UNLOCK(sc); + + return (0); +} + static int am335x_pwm_sysctl_duty(SYSCTL_HANDLER_ARGS) { @@ -292,15 +392,19 @@ am335x_pwm_sysctl_period(SYSCTL_HANDLER_ARGS) if (period < 1) return (EINVAL); - if ((period < sc->sc_pwm_dutyA) || (period < sc->sc_pwm_dutyB)) { - device_printf(sc->sc_dev, "Period can't be less then duty cycle\n"); - return (EINVAL); - } - + if (period > USHRT_MAX) + period = USHRT_MAX; PWM_LOCK(sc); + /* Reset the duty cycle settings. */ + sc->sc_pwm_dutyA = 0; + sc->sc_pwm_dutyB = 0; + EPWM_WRITE2(sc, EPWM_CMPA, sc->sc_pwm_dutyA); + EPWM_WRITE2(sc, EPWM_CMPB, sc->sc_pwm_dutyB); + /* Update the period settings. */ sc->sc_pwm_period = period; EPWM_WRITE2(sc, EPWM_TBPRD, period - 1); + am335x_pwm_freq(sc); PWM_UNLOCK(sc); return (error); @@ -360,6 +464,14 @@ am335x_pwm_attach(device_t dev) ctx = device_get_sysctl_ctx(sc->sc_dev); tree = device_get_sysctl_tree(sc->sc_dev); + sc->sc_clkdiv_oid = SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "clkdiv", CTLTYPE_INT | CTLFLAG_RW, sc, 0, + am335x_pwm_sysctl_clkdiv, "I", "PWM clock prescaler"); + + sc->sc_freq_oid = SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "freq", CTLTYPE_INT | CTLFLAG_RW, sc, 0, + am335x_pwm_sysctl_freq, "I", "PWM frequency"); + sc->sc_period_oid = SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "period", CTLTYPE_INT | CTLFLAG_RW, sc, 0, am335x_pwm_sysctl_period, "I", "PWM period"); @@ -372,7 +484,6 @@ am335x_pwm_attach(device_t dev) "dutyB", CTLTYPE_INT | CTLFLAG_RW, sc, 0, am335x_pwm_sysctl_duty, "I", "Channel B duty cycles"); - /* CONFIGURE EPWM1 */ reg = EPWM_READ2(sc, EPWM_TBCTL); reg &= ~(TBCTL_CLKDIV_MASK | TBCTL_HSPCLKDIV_MASK); @@ -381,6 +492,7 @@ am335x_pwm_attach(device_t dev) sc->sc_pwm_period = DEFAULT_PWM_PERIOD; sc->sc_pwm_dutyA = 0; sc->sc_pwm_dutyB = 0; + am335x_pwm_freq(sc); EPWM_WRITE2(sc, EPWM_TBPRD, sc->sc_pwm_period - 1); EPWM_WRITE2(sc, EPWM_CMPA, sc->sc_pwm_dutyA); diff --git a/sys/arm/ti/am335x/am335x_scm_padconf.c b/sys/arm/ti/am335x/am335x_scm_padconf.c index 7d4a9866d78..91b68560ed4 100644 --- a/sys/arm/ti/am335x/am335x_scm_padconf.c +++ b/sys/arm/ti/am335x/am335x_scm_padconf.c @@ -84,7 +84,7 @@ const struct ti_scm_padstate ti_padstate_devmap[] = { { .state = NULL } }; -const struct ti_scm_padconf ti_padconf_devmap[] = { +const static struct ti_scm_padconf ti_padconf_devmap[] = { _PIN(0x800, "GPMC_AD0", 32, 7,"gpmc_ad0", "mmc1_dat0", NULL, NULL, NULL, NULL, NULL, "gpio1_0"), _PIN(0x804, "GPMC_AD1", 33, 7,"gpmc_ad1", "mmc1_dat1", NULL, NULL, NULL, NULL, NULL, "gpio1_1"), _PIN(0x808, "GPMC_AD2", 34, 7,"gpmc_ad2", "mmc1_dat2", NULL, NULL, NULL, NULL, NULL, "gpio1_2"), diff --git a/sys/arm/ti/omap4/omap4_prcm_clks.c b/sys/arm/ti/omap4/omap4_prcm_clks.c index 7fa59b3c8bf..589f15696e2 100644 --- a/sys/arm/ti/omap4/omap4_prcm_clks.c +++ b/sys/arm/ti/omap4/omap4_prcm_clks.c @@ -256,7 +256,7 @@ static int omap4_clk_get_arm_fclk_freq(struct ti_clock_dev *clkdev, unsigned int } -struct ti_clock_dev ti_clk_devmap[] = { +struct ti_clock_dev ti_omap4_clk_devmap[] = { /* System clocks */ { .id = SYS_CLK, diff --git a/sys/arm/ti/omap4/omap4_scm_padconf.c b/sys/arm/ti/omap4/omap4_scm_padconf.c index fce5ba2d52a..4bf7e3e86f5 100644 --- a/sys/arm/ti/omap4/omap4_scm_padconf.c +++ b/sys/arm/ti/omap4/omap4_scm_padconf.c @@ -142,7 +142,7 @@ const struct ti_scm_padstate ti_padstate_devmap[] = { /* * Table 18-10, p. 3470 */ -const struct ti_scm_padconf ti_padconf_devmap[] = { +const static struct ti_scm_padconf ti_padconf_devmap[] = { _PINDEF(0x0040, "c12", 0, 0, "gpmc_ad0", "sdmmc2_dat0", NULL, NULL, NULL, NULL, NULL, NULL), _PINDEF(0x0042, "d12", 0, 0, "gpmc_ad1", "sdmmc2_dat1", NULL, NULL, NULL, NULL, NULL, NULL), _PINDEF(0x0044, "c13", 0, 0, "gpmc_ad2", "sdmmc2_dat2", NULL, NULL, NULL, NULL, NULL, NULL), diff --git a/sys/arm/ti/ti_adc.c b/sys/arm/ti/ti_adc.c index af7d6d0022d..c5710d74b22 100644 --- a/sys/arm/ti/ti_adc.c +++ b/sys/arm/ti/ti_adc.c @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include -/* Define our 7 steps, one for each input channel. */ +/* Define our 8 steps, one for each input channel. */ static struct ti_adc_input ti_adc_inputs[TI_ADC_NPINS] = { { .stepconfig = ADC_STEPCFG1, .stepdelay = ADC_STEPDLY1 }, { .stepconfig = ADC_STEPCFG2, .stepdelay = ADC_STEPDLY2 }, @@ -59,6 +59,7 @@ static struct ti_adc_input ti_adc_inputs[TI_ADC_NPINS] = { { .stepconfig = ADC_STEPCFG5, .stepdelay = ADC_STEPDLY5 }, { .stepconfig = ADC_STEPCFG6, .stepdelay = ADC_STEPDLY6 }, { .stepconfig = ADC_STEPCFG7, .stepdelay = ADC_STEPDLY7 }, + { .stepconfig = ADC_STEPCFG8, .stepdelay = ADC_STEPDLY8 }, }; static int ti_adc_samples[5] = { 0, 2, 4, 8, 16 }; diff --git a/sys/arm/ti/ti_adcreg.h b/sys/arm/ti/ti_adcreg.h index ffc15a2e712..1772f25db47 100644 --- a/sys/arm/ti/ti_adcreg.h +++ b/sys/arm/ti/ti_adcreg.h @@ -81,6 +81,8 @@ #define ADC_STEPDLY6 0x090 #define ADC_STEPCFG7 0x094 #define ADC_STEPDLY7 0x098 +#define ADC_STEPCFG8 0x09c +#define ADC_STEPDLY8 0x0a0 #define ADC_STEP_DIFF_CNTRL (1 << 25) #define ADC_STEP_RFM_MSK 0x01800000 #define ADC_STEP_RFM_SHIFT 23 diff --git a/sys/arm/ti/ti_adcvar.h b/sys/arm/ti/ti_adcvar.h index 912a78cf881..409ec7b8580 100644 --- a/sys/arm/ti/ti_adcvar.h +++ b/sys/arm/ti/ti_adcvar.h @@ -29,7 +29,7 @@ #ifndef _TI_ADCVAR_H_ #define _TI_ADCVAR_H_ -#define TI_ADC_NPINS 7 +#define TI_ADC_NPINS 8 #define ADC_READ4(_sc, reg) bus_read_4((_sc)->sc_mem_res, reg) #define ADC_WRITE4(_sc, reg, value) \ diff --git a/sys/arm/ti/ti_gpio.c b/sys/arm/ti/ti_gpio.c index a6bf0943c37..619d75be0aa 100644 --- a/sys/arm/ti/ti_gpio.c +++ b/sys/arm/ti/ti_gpio.c @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -130,24 +131,102 @@ __FBSDID("$FreeBSD$"); #endif /* Other SoC Specific definitions */ -#if defined(SOC_OMAP3) -#define MAX_GPIO_BANKS 6 -#define FIRST_GPIO_BANK 1 -#define INTR_PER_BANK 1 -#define TI_GPIO_REV 0x00000025 -#elif defined(SOC_OMAP4) -#define MAX_GPIO_BANKS 6 -#define FIRST_GPIO_BANK 1 -#define INTR_PER_BANK 1 -#define TI_GPIO_REV 0x50600801 -#elif defined(SOC_TI_AM335X) -#define MAX_GPIO_BANKS 4 -#define FIRST_GPIO_BANK 0 -#define INTR_PER_BANK 2 -#define TI_GPIO_REV 0x50600801 -#endif +#define OMAP3_MAX_GPIO_BANKS 6 +#define OMAP3_FIRST_GPIO_BANK 1 +#define OMAP3_INTR_PER_BANK 1 +#define OMAP3_GPIO_REV 0x00000025 +#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 MAX_GPIO_INTRS MAX_GPIO_BANKS * INTR_PER_BANK +#define MAX_GPIO_BANKS 6 +/* Maximum GPIOS possible, max of *_MAX_GPIO_BANKS * *_INTR_PER_BANK */ +#define MAX_GPIO_INTRS 8 + +static u_int +ti_max_gpio_banks(void) +{ + switch(ti_chip()) { +#ifdef SOC_OMAP3 + case CHIP_OMAP_3: + return (OMAP3_MAX_GPIO_BANKS); +#endif +#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_OMAP3 + case CHIP_OMAP_3: + return (OMAP3_MAX_GPIO_BANKS * OMAP3_INTR_PER_BANK); +#endif +#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_OMAP3 + case CHIP_OMAP_3: + return (OMAP3_FIRST_GPIO_BANK); +#endif +#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_OMAP3 + case CHIP_OMAP_3: + return (OMAP3_GPIO_REV); +#endif +#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 @@ -301,7 +380,7 @@ ti_gpio_pin_max(device_t dev, int *maxpin) /* Calculate how many valid banks we have and then multiply that by 32 to * give use the total number of pins. */ - for (i = 0; i < MAX_GPIO_BANKS; i++) { + for (i = 0; i < ti_max_gpio_banks(); i++) { if (sc->sc_mem_res[i] != NULL) banks++; } @@ -340,7 +419,7 @@ ti_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps) TI_GPIO_LOCK(sc); /* Sanity check the pin number is valid */ - if ((bank >= MAX_GPIO_BANKS) || (sc->sc_mem_res[bank] == NULL)) { + if ((bank >= ti_max_gpio_banks()) || (sc->sc_mem_res[bank] == NULL)) { TI_GPIO_UNLOCK(sc); return (EINVAL); } @@ -378,7 +457,7 @@ ti_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags) TI_GPIO_LOCK(sc); /* Sanity check the pin number is valid */ - if ((bank >= MAX_GPIO_BANKS) || (sc->sc_mem_res[bank] == NULL)) { + if ((bank >= ti_max_gpio_banks()) || (sc->sc_mem_res[bank] == NULL)) { TI_GPIO_UNLOCK(sc); return (EINVAL); } @@ -415,7 +494,7 @@ ti_gpio_pin_getname(device_t dev, uint32_t pin, char *name) TI_GPIO_LOCK(sc); /* Sanity check the pin number is valid */ - if ((bank >= MAX_GPIO_BANKS) || (sc->sc_mem_res[bank] == NULL)) { + if ((bank >= ti_max_gpio_banks()) || (sc->sc_mem_res[bank] == NULL)) { TI_GPIO_UNLOCK(sc); return (EINVAL); } @@ -469,7 +548,7 @@ ti_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) TI_GPIO_LOCK(sc); /* Sanity check the pin number is valid */ - if ((bank >= MAX_GPIO_BANKS) || (sc->sc_mem_res[bank] == NULL)) { + if ((bank >= ti_max_gpio_banks()) || (sc->sc_mem_res[bank] == NULL)) { TI_GPIO_UNLOCK(sc); return (EINVAL); } @@ -517,7 +596,7 @@ ti_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value) TI_GPIO_LOCK(sc); /* Sanity check the pin number is valid */ - if ((bank >= MAX_GPIO_BANKS) || (sc->sc_mem_res[bank] == NULL)) { + if ((bank >= ti_max_gpio_banks()) || (sc->sc_mem_res[bank] == NULL)) { TI_GPIO_UNLOCK(sc); return (EINVAL); } @@ -556,7 +635,7 @@ ti_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *value) TI_GPIO_LOCK(sc); /* Sanity check the pin number is valid */ - if ((bank >= MAX_GPIO_BANKS) || (sc->sc_mem_res[bank] == NULL)) { + if ((bank >= ti_max_gpio_banks()) || (sc->sc_mem_res[bank] == NULL)) { TI_GPIO_UNLOCK(sc); return (EINVAL); } @@ -598,7 +677,7 @@ ti_gpio_pin_toggle(device_t dev, uint32_t pin) TI_GPIO_LOCK(sc); /* Sanity check the pin number is valid */ - if ((bank >= MAX_GPIO_BANKS) || (sc->sc_mem_res[bank] == NULL)) { + if ((bank >= ti_max_gpio_banks()) || (sc->sc_mem_res[bank] == NULL)) { TI_GPIO_UNLOCK(sc); return (EINVAL); } @@ -669,7 +748,7 @@ ti_gpio_attach_intr(device_t dev) struct ti_gpio_softc *sc; sc = device_get_softc(dev); - for (i = 0; i < MAX_GPIO_INTRS; i++) { + for (i = 0; i < ti_max_gpio_intrs(); i++) { if (sc->sc_irq_res[i] == NULL) break; @@ -696,7 +775,7 @@ ti_gpio_detach_intr(device_t dev) /* Teardown our interrupt handlers. */ sc = device_get_softc(dev); - for (i = 0; i < MAX_GPIO_INTRS; i++) { + for (i = 0; i < ti_max_gpio_intrs(); i++) { if (sc->sc_irq_res[i] == NULL) break; @@ -719,7 +798,7 @@ ti_gpio_bank_init(device_t dev, int bank) sc = device_get_softc(dev); /* Enable the interface and functional clocks for the module. */ - ti_prcm_clk_enable(GPIO0_CLK + FIRST_GPIO_BANK + bank); + ti_prcm_clk_enable(GPIO0_CLK + ti_first_gpio_bank() + bank); /* * Read the revision number of the module. TI don't publish the @@ -729,7 +808,7 @@ ti_gpio_bank_init(device_t dev, int bank) sc->sc_revision[bank] = ti_gpio_read_4(sc, bank, TI_GPIO_REVISION); /* Check the revision. */ - if (sc->sc_revision[bank] != TI_GPIO_REV) { + if (sc->sc_revision[bank] != ti_gpio_rev()) { device_printf(dev, "Warning: could not determine the revision " "of %u GPIO module (revision:0x%08x)\n", bank, sc->sc_revision[bank]); @@ -806,7 +885,7 @@ ti_gpio_attach(device_t dev) * pins are configured which would result in less power used if the GPIO * pins weren't used ... */ - for (i = 0; i < MAX_GPIO_BANKS; i++) { + 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); @@ -850,7 +929,7 @@ ti_gpio_detach(device_t dev) KASSERT(mtx_initialized(&sc->sc_mtx), ("gpio mutex not initialized")); /* Disable all interrupts */ - for (i = 0; i < MAX_GPIO_BANKS; i++) { + for (i = 0; i < ti_max_gpio_banks(); i++) { if (sc->sc_mem_res[i] != NULL) ti_gpio_intr_clr(sc, i, 0xffffffff); } diff --git a/sys/arm/ti/ti_i2c.c b/sys/arm/ti/ti_i2c.c index 089c2def192..e76ab112d0c 100644 --- a/sys/arm/ti/ti_i2c.c +++ b/sys/arm/ti/ti_i2c.c @@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -91,7 +92,6 @@ struct ti_i2c_softc volatile uint16_t sc_stat_flags; /* contains the status flags last IRQ */ - uint16_t sc_i2c_addr; uint16_t sc_rev; }; @@ -106,21 +106,23 @@ struct ti_i2c_clock_config uint8_t hssclh; /* High Speed mode SCL high time */ }; -static struct ti_i2c_clock_config ti_i2c_clock_configs[] = { - #if defined(SOC_OMAP4) +static struct ti_i2c_clock_config ti_omap4_i2c_clock_configs[] = { { IIC_SLOW, 100000, 23, 13, 15, 0, 0}, { IIC_FAST, 400000, 9, 5, 7, 0, 0}, { IIC_FASTEST, 3310000, 1, 113, 115, 7, 10}, -#elif defined(SOC_TI_AM335X) + { -1, 0 } +}; +#endif + +#if defined(SOC_TI_AM335X) +static struct ti_i2c_clock_config ti_am335x_i2c_clock_configs[] = { { IIC_SLOW, 100000, 3, 53, 55, 0, 0}, { IIC_FAST, 400000, 3, 8, 10, 0, 0}, { IIC_FASTEST, 400000, 3, 8, 10, 0, 0}, /* This might be higher */ -#else -#error "TI I2C driver is not supported on this SoC" -#endif { -1, 0 } }; +#endif #define TI_I2C_REV1 0x003C /* OMAP3 */ @@ -280,7 +282,20 @@ ti_i2c_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr) struct ti_i2c_clock_config *clkcfg; uint16_t con_reg; - clkcfg = ti_i2c_clock_configs; + switch (ti_chip()) { +#ifdef SOC_OMAP4 + case CHIP_OMAP_4: + clkcfg = ti_omap4_i2c_clock_configs; + break; +#endif +#ifdef SOC_TI_AM335X + case CHIP_AM335X: + clkcfg = ti_am335x_i2c_clock_configs; + break; +#endif + default: + panic("Unknown Ti SoC, unable to reset the i2c"); + } while (clkcfg->speed != -1) { if (clkcfg->speed == speed) break; @@ -294,10 +309,6 @@ ti_i2c_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr) TI_I2C_LOCK(sc); - if (oldaddr) - *oldaddr = sc->sc_i2c_addr; - sc->sc_i2c_addr = addr; - /* First disable the controller while changing the clocks */ con_reg = ti_i2c_read_reg(sc, I2C_REG_CON); ti_i2c_write_reg(sc, I2C_REG_CON, 0x0000); @@ -309,9 +320,6 @@ ti_i2c_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr) ti_i2c_write_reg(sc, I2C_REG_SCLL, clkcfg->scll | (clkcfg->hsscll<<8)); ti_i2c_write_reg(sc, I2C_REG_SCLH, clkcfg->sclh | (clkcfg->hssclh<<8)); - /* Set the remote slave address */ - ti_i2c_write_reg(sc, I2C_REG_SA, addr); - /* Check if we are dealing with high speed mode */ if ((clkcfg->hsscll + clkcfg->hssclh) > 0) con_reg = I2C_CON_OPMODE_HS; @@ -323,7 +331,7 @@ ti_i2c_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr) TI_I2C_UNLOCK(sc); - return 0; + return (IIC_ENOADDR); } /** @@ -755,7 +763,7 @@ ti_i2c_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs) } /* set the slave address */ - ti_i2c_write_reg(sc, I2C_REG_SA, msgs[i].slave); + ti_i2c_write_reg(sc, I2C_REG_SA, msgs[i].slave >> 1); /* perform the read or write */ if (msgs[i].flags & IIC_M_RD) { diff --git a/sys/arm/ti/ti_machdep.c b/sys/arm/ti/ti_machdep.c index 6b8b2ffad06..0f32ae1fbc2 100644 --- a/sys/arm/ti/ti_machdep.c +++ b/sys/arm/ti/ti_machdep.c @@ -51,44 +51,40 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include "platform_if.h" + void (*ti_cpu_reset)(void) = NULL; -vm_offset_t -initarm_lastaddr(void) +static vm_offset_t +ti_lastaddr(platform_t plat) { return (arm_devmap_lastaddr()); } -void -initarm_early_init(void) -{ -} - -void -initarm_gpio_init(void) -{ -} - -void -initarm_late_init(void) -{ -} - /* * Construct static devmap entries to map out the most frequently used * peripherals using 1mb section mappings. */ -int -initarm_devmap_init(void) -{ #if defined(SOC_OMAP4) +static int +ti_omap4_devmap_init(platform_t plat) +{ arm_devmap_add_entry(0x48000000, 0x01000000); /*16mb L4_PER devices */ arm_devmap_add_entry(0x4A000000, 0x01000000); /*16mb L4_CFG devices */ -#elif defined(SOC_TI_AM335X) + return (0); +} +#endif + +#if defined(SOC_TI_AM335X) +static int +ti_am335x_devmap_init(platform_t plat) +{ + arm_devmap_add_entry(0x44C00000, 0x00400000); /* 4mb L4_WKUP devices*/ arm_devmap_add_entry(0x47400000, 0x00100000); /* 1mb USB */ arm_devmap_add_entry(0x47800000, 0x00100000); /* 1mb mmchs2 */ @@ -96,11 +92,9 @@ initarm_devmap_init(void) arm_devmap_add_entry(0x49000000, 0x00100000); /* 1mb edma3 */ arm_devmap_add_entry(0x49800000, 0x00300000); /* 3mb edma3 */ arm_devmap_add_entry(0x4A000000, 0x01000000); /*16mb L4_FAST devices*/ -#else -#error "Unknown SoC" -#endif return (0); } +#endif struct arm32_dma_range * bus_dma_get_range(void) @@ -126,3 +120,24 @@ cpu_reset() printf("Reset failed!\n"); while (1); } + +#if defined(SOC_OMAP4) +static platform_method_t omap4_methods[] = { + PLATFORMMETHOD(platform_devmap_init, ti_omap4_devmap_init), + PLATFORMMETHOD(platform_lastaddr, ti_lastaddr), + + PLATFORMMETHOD_END, +}; +FDT_PLATFORM_DEF(omap4, "omap4", 0, "ti,omap4430"); +#endif + +#if defined(SOC_TI_AM335X) +static platform_method_t am335x_methods[] = { + PLATFORMMETHOD(platform_devmap_init, ti_am335x_devmap_init), + PLATFORMMETHOD(platform_lastaddr, ti_lastaddr), + + PLATFORMMETHOD_END, +}; + +FDT_PLATFORM_DEF(am335x, "am335x", 0, "ti,am335x"); +#endif diff --git a/sys/arm/ti/ti_prcm.c b/sys/arm/ti/ti_prcm.c index 89a23772711..3c073f995a6 100644 --- a/sys/arm/ti/ti_prcm.c +++ b/sys/arm/ti/ti_prcm.c @@ -57,16 +57,18 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include /** - * ti_clk_devmap - Array of clock devices, should be defined one per SoC + * ti_*_clk_devmap - Array of clock devices, should be defined one per SoC * * This array is typically defined in one of the targeted *_prcm_clk.c * files and is specific to the given SoC platform. Each entry in the array * corresponds to an individual clock device. */ -extern struct ti_clock_dev ti_clk_devmap[]; +extern struct ti_clock_dev ti_omap4_clk_devmap[]; +extern struct ti_clock_dev ti_am335x_clk_devmap[]; /** * ti_prcm_clk_dev - returns a pointer to the clock device with given id @@ -90,7 +92,21 @@ ti_prcm_clk_dev(clk_ident_t clk) * loop for this, but this function should only called when a driver is * being activated so IMHO not a big issue. */ - clk_dev = &(ti_clk_devmap[0]); + clk_dev = NULL; + switch(ti_chip()) { +#ifdef SOC_OMAP4 + case CHIP_OMAP_4: + clk_dev = &(ti_omap4_clk_devmap[0]); + break; +#endif +#ifdef SOC_TI_AM335X + case CHIP_AM335X: + clk_dev = &(ti_am335x_clk_devmap[0]); + break; +#endif + } + if (clk_dev == NULL) + panic("No clock devmap found"); while (clk_dev->id != INVALID_CLK_IDENT) { if (clk_dev->id == clk) { return (clk_dev); diff --git a/sys/arm/versatile/versatile_clcd.c b/sys/arm/versatile/versatile_clcd.c index 1dd777821b0..804c24f46f5 100644 --- a/sys/arm/versatile/versatile_clcd.c +++ b/sys/arm/versatile/versatile_clcd.c @@ -363,8 +363,6 @@ versatile_clcdc_attach(device_t dev) fail: if (sc->fb_base) bus_dmamem_free(sc->dma_tag, sc->fb_base, sc->dma_map); - if (sc->dma_map) - bus_dmamap_destroy(sc->dma_tag, sc->dma_map); if (sc->dma_tag) bus_dma_tag_destroy(sc->dma_tag); return (err); diff --git a/sys/arm/versatile/versatile_machdep.c b/sys/arm/versatile/versatile_machdep.c index 0be0ad51027..ef531e142e5 100644 --- a/sys/arm/versatile/versatile_machdep.c +++ b/sys/arm/versatile/versatile_machdep.c @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -58,25 +59,25 @@ __FBSDID("$FreeBSD$"); #define DEVMAP_BOOTSTRAP_MAP_START 0xE0000000 vm_offset_t -initarm_lastaddr(void) +platform_lastaddr(void) { return (DEVMAP_BOOTSTRAP_MAP_START); } void -initarm_early_init(void) +platform_probe_and_attach(void) { } void -initarm_gpio_init(void) +platform_gpio_init(void) { } void -initarm_late_init(void) +platform_late_init(void) { } @@ -91,7 +92,7 @@ static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = { * Construct pmap_devmap[] with DT-derived config data. */ int -initarm_devmap_init(void) +platform_devmap_init(void) { int i = 0; fdt_devmap[i].pd_va = 0xf0100000; diff --git a/sys/arm/xilinx/zy7_machdep.c b/sys/arm/xilinx/zy7_machdep.c index e7ffaa49ca7..5fb5788028c 100644 --- a/sys/arm/xilinx/zy7_machdep.c +++ b/sys/arm/xilinx/zy7_machdep.c @@ -51,31 +51,32 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include void (*zynq7_cpu_reset)(void); vm_offset_t -initarm_lastaddr(void) +platform_lastaddr(void) { return (arm_devmap_lastaddr()); } void -initarm_early_init(void) +platform_probe_and_attach(void) { } void -initarm_gpio_init(void) +platform_gpio_init(void) { } void -initarm_late_init(void) +platform_late_init(void) { } @@ -85,7 +86,7 @@ initarm_late_init(void) * nice efficient 1MB section mappings. */ int -initarm_devmap_init(void) +platform_devmap_init(void) { arm_devmap_add_entry(ZYNQ7_PSIO_HWBASE, ZYNQ7_PSIO_SIZE); diff --git a/sys/arm/xilinx/zy7_slcr.c b/sys/arm/xilinx/zy7_slcr.c index e448d76edb6..5dc15d1b1d6 100644 --- a/sys/arm/xilinx/zy7_slcr.c +++ b/sys/arm/xilinx/zy7_slcr.c @@ -71,12 +71,14 @@ extern void (*zynq7_cpu_reset); #define ZSLCR_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) #define ZSLCR_LOCK_INIT(sc) \ mtx_init(&(sc)->sc_mtx, device_get_nameunit((sc)->dev), \ - "zy7_slcr", MTX_SPIN) + "zy7_slcr", MTX_DEF) #define ZSLCR_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); #define RD4(sc, off) (bus_read_4((sc)->mem_res, (off))) #define WR4(sc, off, val) (bus_write_4((sc)->mem_res, (off), (val))) +#define ZYNQ_DEFAULT_PS_CLK_FREQUENCY 33333333 /* 33.3 Mhz */ + SYSCTL_NODE(_hw, OID_AUTO, zynq, CTLFLAG_RD, 0, "Xilinx Zynq-7000"); @@ -84,7 +86,7 @@ static char zynq_bootmode[64]; SYSCTL_STRING(_hw_zynq, OID_AUTO, bootmode, CTLFLAG_RD, zynq_bootmode, 0, "Zynq boot mode"); -static char zynq_pssid[80]; +static char zynq_pssid[100]; SYSCTL_STRING(_hw_zynq, OID_AUTO, pssid, CTLFLAG_RD, zynq_pssid, 0, "Zynq PSS IDCODE"); @@ -92,6 +94,22 @@ static uint32_t zynq_reboot_status; SYSCTL_INT(_hw_zynq, OID_AUTO, reboot_status, CTLFLAG_RD, &zynq_reboot_status, 0, "Zynq REBOOT_STATUS register"); +static int ps_clk_frequency; +SYSCTL_INT(_hw_zynq, OID_AUTO, ps_clk_frequency, CTLFLAG_RD, &ps_clk_frequency, + 0, "Zynq PS_CLK Frequency"); + +static int io_pll_frequency; +SYSCTL_INT(_hw_zynq, OID_AUTO, io_pll_frequency, CTLFLAG_RD, &io_pll_frequency, + 0, "Zynq IO PLL Frequency"); + +static int arm_pll_frequency; +SYSCTL_INT(_hw_zynq, OID_AUTO, arm_pll_frequency, CTLFLAG_RD, + &arm_pll_frequency, 0, "Zynq ARM PLL Frequency"); + +static int ddr_pll_frequency; +SYSCTL_INT(_hw_zynq, OID_AUTO, ddr_pll_frequency, CTLFLAG_RD, + &ddr_pll_frequency, 0, "Zynq DDR PLL Frequency"); + static void zy7_slcr_unlock(struct zy7_slcr_softc *sc) { @@ -189,6 +207,54 @@ zy7_slcr_postload_pl(int en_level_shifters) ZSLCR_UNLOCK(sc); } +/* Override cgem_set_refclk() in gigabit ethernet driver + * (sys/dev/cadence/if_cgem.c). This function is called to + * request a change in the gem's reference clock speed. + */ +int +cgem_set_ref_clk(int unit, int frequency) +{ + struct zy7_slcr_softc *sc = zy7_slcr_softc_p; + int div0, div1; + + if (!sc) + return (-1); + + /* Find suitable divisor pairs. Round result to nearest khz + * to test for match. + */ + for (div1 = 1; div1 <= ZY7_SLCR_GEM_CLK_CTRL_DIVISOR1_MAX; div1++) { + div0 = (io_pll_frequency + div1 * frequency / 2) / + div1 / frequency; + if (div0 > 0 && div0 <= ZY7_SLCR_GEM_CLK_CTRL_DIVISOR_MAX && + ((io_pll_frequency / div0 / div1) + 500) / 1000 == + (frequency + 500) / 1000) + break; + } + + if (div1 > ZY7_SLCR_GEM_CLK_CTRL_DIVISOR1_MAX) + return (-1); + + ZSLCR_LOCK(sc); + + /* Unlock SLCR registers. */ + zy7_slcr_unlock(sc); + + /* Modify GEM reference clock. */ + WR4(sc, unit ? ZY7_SLCR_GEM1_CLK_CTRL : ZY7_SLCR_GEM0_CLK_CTRL, + (div1 << ZY7_SLCR_GEM_CLK_CTRL_DIVISOR1_SHIFT) | + (div0 << ZY7_SLCR_GEM_CLK_CTRL_DIVISOR_SHIFT) | + ZY7_SLCR_GEM_CLK_CTRL_SRCSEL_IO_PLL | + ZY7_SLCR_GEM_CLK_CTRL_CLKACT); + + /* Lock SLCR registers. */ + zy7_slcr_lock(sc); + + ZSLCR_UNLOCK(sc); + + return (0); +} + static int zy7_slcr_probe(device_t dev) { @@ -208,8 +274,13 @@ zy7_slcr_attach(device_t dev) { struct zy7_slcr_softc *sc = device_get_softc(dev); int rid; + phandle_t node; + pcell_t cell; uint32_t bootmode; uint32_t pss_idcode; + uint32_t arm_pll_ctrl; + uint32_t ddr_pll_ctrl; + uint32_t io_pll_ctrl; static char *bootdev_names[] = { "JTAG", "Quad-SPI", "NOR", "(3?)", "NAND", "SD Card", "(6?)", "(7?)" @@ -260,6 +331,53 @@ zy7_slcr_attach(device_t dev) zynq_reboot_status = RD4(sc, ZY7_SLCR_REBOOT_STAT); + /* Derive PLL frequencies from PS_CLK. */ + node = ofw_bus_get_node(dev); + if (OF_getprop(node, "clock-frequency", &cell, sizeof(cell)) > 0) + ps_clk_frequency = fdt32_to_cpu(cell); + else + ps_clk_frequency = ZYNQ_DEFAULT_PS_CLK_FREQUENCY; + + arm_pll_ctrl = RD4(sc, ZY7_SLCR_ARM_PLL_CTRL); + ddr_pll_ctrl = RD4(sc, ZY7_SLCR_DDR_PLL_CTRL); + io_pll_ctrl = RD4(sc, ZY7_SLCR_IO_PLL_CTRL); + + /* Determine ARM PLL frequency. */ + if (((arm_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_QUAL) == 0 && + (arm_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_FORCE) != 0) || + ((arm_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_QUAL) != 0 && + (bootmode & ZY7_SLCR_BOOT_MODE_PLL_BYPASS) != 0)) + /* PLL is bypassed. */ + arm_pll_frequency = ps_clk_frequency; + else + arm_pll_frequency = ps_clk_frequency * + ((arm_pll_ctrl & ZY7_SLCR_PLL_CTRL_FDIV_MASK) >> + ZY7_SLCR_PLL_CTRL_FDIV_SHIFT); + + /* Determine DDR PLL frequency. */ + if (((ddr_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_QUAL) == 0 && + (ddr_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_FORCE) != 0) || + ((ddr_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_QUAL) != 0 && + (bootmode & ZY7_SLCR_BOOT_MODE_PLL_BYPASS) != 0)) + /* PLL is bypassed. */ + ddr_pll_frequency = ps_clk_frequency; + else + ddr_pll_frequency = ps_clk_frequency * + ((ddr_pll_ctrl & ZY7_SLCR_PLL_CTRL_FDIV_MASK) >> + ZY7_SLCR_PLL_CTRL_FDIV_SHIFT); + + /* Determine IO PLL frequency. */ + if (((io_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_QUAL) == 0 && + (io_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_FORCE) != 0) || + ((io_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_QUAL) != 0 && + (bootmode & ZY7_SLCR_BOOT_MODE_PLL_BYPASS) != 0)) + /* PLL is bypassed. */ + io_pll_frequency = ps_clk_frequency; + else + io_pll_frequency = ps_clk_frequency * + ((io_pll_ctrl & ZY7_SLCR_PLL_CTRL_FDIV_MASK) >> + ZY7_SLCR_PLL_CTRL_FDIV_SHIFT); + /* Lock SLCR registers. */ zy7_slcr_lock(sc); diff --git a/sys/arm/xilinx/zy7_slcr.h b/sys/arm/xilinx/zy7_slcr.h index af30b0984f7..70c46619312 100644 --- a/sys/arm/xilinx/zy7_slcr.h +++ b/sys/arm/xilinx/zy7_slcr.h @@ -126,6 +126,18 @@ #define ZY7_SLCR_GEM1_RCLK_CTRL 0x013c #define ZY7_SLCR_GEM0_CLK_CTRL 0x0140 #define ZY7_SLCR_GEM1_CLK_CTRL 0x0144 +#define ZY7_SLCR_GEM_CLK_CTRL_DIVISOR1_MASK (0x3f<<20) +#define ZY7_SLCR_GEM_CLK_CTRL_DIVISOR1_SHIFT 20 +#define ZY7_SLCR_GEM_CLK_CTRL_DIVISOR1_MAX 0x3f +#define ZY7_SLCR_GEM_CLK_CTRL_DIVISOR_MASK (0x3f<<8) +#define ZY7_SLCR_GEM_CLK_CTRL_DIVISOR_SHIFT 8 +#define ZY7_SLCR_GEM_CLK_CTRL_DIVISOR_MAX 0x3f +#define ZY7_SLCR_GEM_CLK_CTRL_SRCSEL_MASK (7<<4) +#define ZY7_SLCR_GEM_CLK_CTRL_SRCSEL_IO_PLL (0<<4) +#define ZY7_SLCR_GEM_CLK_CTRL_SRCSEL_ARM_PLL (2<<4) +#define ZY7_SLCR_GEM_CLK_CTRL_SRCSEL_DDR_PLL (3<<4) +#define ZY7_SLCR_GEM_CLK_CTRL_SRCSEL_EMIO_CLK (4<<4) +#define ZY7_SLCR_GEM_CLK_CTRL_CLKACT 1 #define ZY7_SLCR_SMC_CLK_CTRL 0x0148 #define ZY7_SLCR_LQSPI_CLK_CTRL 0x014c #define ZY7_SLCR_SDIO_CLK_CTRL 0x0150 @@ -274,6 +286,7 @@ #ifdef _KERNEL extern void zy7_slcr_preload_pl(void); -extern void zy7_slcr_postload_pl(int); +extern void zy7_slcr_postload_pl(int en_level_shifters); +extern int cgem_set_ref_clk(int unit, int frequency); #endif #endif /* _ZY7_SLCR_H_ */ diff --git a/sys/arm/xscale/i80321/ep80219_machdep.c b/sys/arm/xscale/i80321/ep80219_machdep.c index 3112fe4a27c..bf3e49ada30 100644 --- a/sys/arm/xscale/i80321/ep80219_machdep.c +++ b/sys/arm/xscale/i80321/ep80219_machdep.c @@ -130,21 +130,21 @@ static const struct arm_devmap_entry ep80219_devmap[] = { IQ80321_OBIO_BASE, IQ80321_OBIO_SIZE, VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { IQ80321_IOW_VBASE, VERDE_OUT_XLATE_IO_WIN0_BASE, VERDE_OUT_XLATE_IO_WIN_SIZE, VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { IQ80321_80321_VBASE, VERDE_PMMR_BASE, VERDE_PMMR_SIZE, VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { 0, @@ -341,6 +341,10 @@ initarm(struct arm_boot_params *abp) * Prepare the list of physical memory available to the vm subsystem. */ arm_physmem_hardware_region(IQ80321_SDRAM_START, memsize); + arm_physmem_exclude_region(freemem_pt, KERNPHYSADDR - + freemem_pt, EXFLAG_NOALLOC); + arm_physmem_exclude_region(freemempos, KERNPHYSADDR - 0x100000 - + freemempos, EXFLAG_NOALLOC); arm_physmem_exclude_region(abp->abp_physaddr, virtual_avail - KERNVIRTADDR, EXFLAG_NOALLOC); arm_physmem_init_kernel_globals(); diff --git a/sys/arm/xscale/i80321/iq31244_machdep.c b/sys/arm/xscale/i80321/iq31244_machdep.c index 38827297d17..9c119ed25bc 100644 --- a/sys/arm/xscale/i80321/iq31244_machdep.c +++ b/sys/arm/xscale/i80321/iq31244_machdep.c @@ -128,14 +128,14 @@ static const struct arm_devmap_entry iq80321_devmap[] = { IQ80321_OBIO_BASE, IQ80321_OBIO_SIZE, VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { IQ80321_IOW_VBASE, VERDE_OUT_XLATE_IO_WIN0_BASE, VERDE_OUT_XLATE_IO_WIN_SIZE, VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { @@ -143,7 +143,7 @@ static const struct arm_devmap_entry iq80321_devmap[] = { VERDE_PMMR_BASE, VERDE_PMMR_SIZE, VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { 0, @@ -343,6 +343,10 @@ initarm(struct arm_boot_params *abp) * Prepare the list of physical memory available to the vm subsystem. */ arm_physmem_hardware_region(SDRAM_START, memsize); + arm_physmem_exclude_region(freemem_pt, KERNPHYSADDR - + freemem_pt, EXFLAG_NOALLOC); + arm_physmem_exclude_region(freemempos, KERNPHYSADDR - 0x100000 - + freemempos, EXFLAG_NOALLOC); arm_physmem_exclude_region(abp->abp_physaddr, virtual_avail - KERNVIRTADDR, EXFLAG_NOALLOC); arm_physmem_init_kernel_globals(); diff --git a/sys/arm/xscale/i8134x/crb_machdep.c b/sys/arm/xscale/i8134x/crb_machdep.c index 98e1ca6c830..195304485bf 100644 --- a/sys/arm/xscale/i8134x/crb_machdep.c +++ b/sys/arm/xscale/i8134x/crb_machdep.c @@ -124,7 +124,7 @@ static const struct arm_devmap_entry iq81342_devmap[] = { IOP34X_HWADDR, IOP34X_SIZE, VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { /* @@ -135,14 +135,14 @@ static const struct arm_devmap_entry iq81342_devmap[] = { IOP34X_PCIX_OIOBAR &~ (0x100000 - 1), 0x100000, VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { IOP34X_PCE1_VADDR, IOP34X_PCE1, IOP34X_PCE1_SIZE, VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { 0, @@ -323,6 +323,10 @@ initarm(struct arm_boot_params *abp) * Prepare the list of physical memory available to the vm subsystem. */ arm_physmem_hardware_region(SDRAM_START, memsize); + arm_physmem_exclude_region(freemem_pt, KERNPHYSADDR - + freemem_pt, EXFLAG_NOALLOC); + arm_physmem_exclude_region(freemempos, KERNPHYSADDR - 0x100000 - + freemempos, EXFLAG_NOALLOC); arm_physmem_exclude_region(abp->abp_physaddr, virtual_avail - KERNVIRTADDR, EXFLAG_NOALLOC); arm_physmem_init_kernel_globals(); diff --git a/sys/arm/xscale/ixp425/avila_machdep.c b/sys/arm/xscale/ixp425/avila_machdep.c index 2ef2adce12c..cd5bb06e03b 100644 --- a/sys/arm/xscale/ixp425/avila_machdep.c +++ b/sys/arm/xscale/ixp425/avila_machdep.c @@ -118,31 +118,31 @@ struct pv_addr minidataclean; static const struct arm_devmap_entry ixp425_devmap[] = { /* Physical/Virtual address for I/O space */ { IXP425_IO_VBASE, IXP425_IO_HWBASE, IXP425_IO_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + VM_PROT_READ|VM_PROT_WRITE, PTE_DEVICE, }, /* Expansion Bus */ { IXP425_EXP_VBASE, IXP425_EXP_HWBASE, IXP425_EXP_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + VM_PROT_READ|VM_PROT_WRITE, PTE_DEVICE, }, /* CFI Flash on the Expansion Bus */ { IXP425_EXP_BUS_CS0_VBASE, IXP425_EXP_BUS_CS0_HWBASE, - IXP425_EXP_BUS_CS0_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + IXP425_EXP_BUS_CS0_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_DEVICE, }, /* IXP425 PCI Configuration */ { IXP425_PCI_VBASE, IXP425_PCI_HWBASE, IXP425_PCI_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + VM_PROT_READ|VM_PROT_WRITE, PTE_DEVICE, }, /* SDRAM Controller */ { IXP425_MCU_VBASE, IXP425_MCU_HWBASE, IXP425_MCU_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + VM_PROT_READ|VM_PROT_WRITE, PTE_DEVICE, }, /* PCI Memory Space */ { IXP425_PCI_MEM_VBASE, IXP425_PCI_MEM_HWBASE, IXP425_PCI_MEM_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + VM_PROT_READ|VM_PROT_WRITE, PTE_DEVICE, }, /* Q-Mgr Memory Space */ { IXP425_QMGR_VBASE, IXP425_QMGR_HWBASE, IXP425_QMGR_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + VM_PROT_READ|VM_PROT_WRITE, PTE_DEVICE, }, { 0 }, }; @@ -151,45 +151,45 @@ static const struct arm_devmap_entry ixp425_devmap[] = { static const struct arm_devmap_entry ixp435_devmap[] = { /* Physical/Virtual address for I/O space */ { IXP425_IO_VBASE, IXP425_IO_HWBASE, IXP425_IO_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + VM_PROT_READ|VM_PROT_WRITE, PTE_DEVICE, }, { IXP425_EXP_VBASE, IXP425_EXP_HWBASE, IXP425_EXP_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + VM_PROT_READ|VM_PROT_WRITE, PTE_DEVICE, }, /* IXP425 PCI Configuration */ { IXP425_PCI_VBASE, IXP425_PCI_HWBASE, IXP425_PCI_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + VM_PROT_READ|VM_PROT_WRITE, PTE_DEVICE, }, /* DDRII Controller NB: mapped same place as IXP425 */ { IXP425_MCU_VBASE, IXP435_MCU_HWBASE, IXP425_MCU_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + VM_PROT_READ|VM_PROT_WRITE, PTE_DEVICE, }, /* PCI Memory Space */ { IXP425_PCI_MEM_VBASE, IXP425_PCI_MEM_HWBASE, IXP425_PCI_MEM_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + VM_PROT_READ|VM_PROT_WRITE, PTE_DEVICE, }, /* Q-Mgr Memory Space */ { IXP425_QMGR_VBASE, IXP425_QMGR_HWBASE, IXP425_QMGR_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + VM_PROT_READ|VM_PROT_WRITE, PTE_DEVICE, }, /* CFI Flash on the Expansion Bus */ { IXP425_EXP_BUS_CS0_VBASE, IXP425_EXP_BUS_CS0_HWBASE, - IXP425_EXP_BUS_CS0_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + IXP425_EXP_BUS_CS0_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_DEVICE, }, /* USB1 Memory Space */ { IXP435_USB1_VBASE, IXP435_USB1_HWBASE, IXP435_USB1_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + VM_PROT_READ|VM_PROT_WRITE, PTE_DEVICE, }, /* USB2 Memory Space */ { IXP435_USB2_VBASE, IXP435_USB2_HWBASE, IXP435_USB2_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + VM_PROT_READ|VM_PROT_WRITE, PTE_DEVICE, }, /* GPS Memory Space */ { CAMBRIA_GPS_VBASE, CAMBRIA_GPS_HWBASE, CAMBRIA_GPS_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + VM_PROT_READ|VM_PROT_WRITE, PTE_DEVICE, }, /* RS485 Memory Space */ { CAMBRIA_RS485_VBASE, CAMBRIA_RS485_HWBASE, CAMBRIA_RS485_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + VM_PROT_READ|VM_PROT_WRITE, PTE_DEVICE, }, { 0 } }; @@ -413,6 +413,10 @@ initarm(struct arm_boot_params *abp) * Prepare the list of physical memory available to the vm subsystem. */ arm_physmem_hardware_region(PHYSADDR, memsize); + arm_physmem_exclude_region(freemem_pt, KERNPHYSADDR - + freemem_pt, EXFLAG_NOALLOC); + arm_physmem_exclude_region(freemempos, KERNPHYSADDR - 0x100000 - + freemempos, EXFLAG_NOALLOC); arm_physmem_exclude_region(abp->abp_physaddr, virtual_avail - KERNVIRTADDR, EXFLAG_NOALLOC); arm_physmem_init_kernel_globals(); diff --git a/sys/arm/xscale/ixp425/if_npe.c b/sys/arm/xscale/ixp425/if_npe.c index aae31a009eb..d1ef51cf812 100644 --- a/sys/arm/xscale/ixp425/if_npe.c +++ b/sys/arm/xscale/ixp425/if_npe.c @@ -255,9 +255,8 @@ static SYSCTL_NODE(_hw, OID_AUTO, npe, CTLFLAG_RD, 0, "IXP4XX NPE driver parameters"); static int npe_debug = 0; -SYSCTL_INT(_hw_npe, OID_AUTO, debug, CTLFLAG_RW, &npe_debug, +SYSCTL_INT(_hw_npe, OID_AUTO, debug, CTLFLAG_RWTUN, &npe_debug, 0, "IXP4XX NPE network interface debug msgs"); -TUNABLE_INT("hw.npe.debug", &npe_debug); #define DPRINTF(sc, fmt, ...) do { \ if (sc->sc_debug) device_printf(sc->sc_dev, fmt, __VA_ARGS__); \ } while (0) @@ -265,18 +264,15 @@ TUNABLE_INT("hw.npe.debug", &npe_debug); if (sc->sc_debug >= n) device_printf(sc->sc_dev, fmt, __VA_ARGS__);\ } while (0) static int npe_tickinterval = 3; /* npe_tick frequency (secs) */ -SYSCTL_INT(_hw_npe, OID_AUTO, tickinterval, CTLFLAG_RD, &npe_tickinterval, +SYSCTL_INT(_hw_npe, OID_AUTO, tickinterval, CTLFLAG_RDTUN, &npe_tickinterval, 0, "periodic work interval (secs)"); -TUNABLE_INT("hw.npe.tickinterval", &npe_tickinterval); static int npe_rxbuf = 64; /* # rx buffers to allocate */ -SYSCTL_INT(_hw_npe, OID_AUTO, rxbuf, CTLFLAG_RD, &npe_rxbuf, +SYSCTL_INT(_hw_npe, OID_AUTO, rxbuf, CTLFLAG_RDTUN, &npe_rxbuf, 0, "rx buffers allocated"); -TUNABLE_INT("hw.npe.rxbuf", &npe_rxbuf); static int npe_txbuf = 128; /* # tx buffers to allocate */ -SYSCTL_INT(_hw_npe, OID_AUTO, txbuf, CTLFLAG_RD, &npe_txbuf, +SYSCTL_INT(_hw_npe, OID_AUTO, txbuf, CTLFLAG_RDTUN, &npe_txbuf, 0, "tx buffers allocated"); -TUNABLE_INT("hw.npe.txbuf", &npe_txbuf); static int unit2npeid(int unit) diff --git a/sys/arm/xscale/ixp425/ixp425_npe.c b/sys/arm/xscale/ixp425/ixp425_npe.c index 0ccc7d0cb7f..6dbce4ccb95 100644 --- a/sys/arm/xscale/ixp425/ixp425_npe.c +++ b/sys/arm/xscale/ixp425/ixp425_npe.c @@ -181,9 +181,8 @@ typedef struct { } IxNpeDlNpeMgrStateInfoBlock; static int npe_debug = 0; -SYSCTL_INT(_debug, OID_AUTO, ixp425npe, CTLFLAG_RW, &npe_debug, +SYSCTL_INT(_debug, OID_AUTO, ixp425npe, CTLFLAG_RWTUN, &npe_debug, 0, "IXP4XX NPE debug msgs"); -TUNABLE_INT("debug.ixp425npe", &npe_debug); #define DPRINTF(dev, fmt, ...) do { \ if (npe_debug) device_printf(dev, fmt, __VA_ARGS__); \ } while (0) diff --git a/sys/arm/xscale/ixp425/ixp425_qmgr.c b/sys/arm/xscale/ixp425/ixp425_qmgr.c index b6fe434564e..cb6c8defc94 100644 --- a/sys/arm/xscale/ixp425/ixp425_qmgr.c +++ b/sys/arm/xscale/ixp425/ixp425_qmgr.c @@ -159,10 +159,9 @@ struct ixpqmgr_softc { uint32_t aqmFreeSramAddress; /* SRAM free space */ }; -static int qmgr_debug = 0; -SYSCTL_INT(_debug, OID_AUTO, qmgr, CTLFLAG_RW, &qmgr_debug, +static int qmgr_debug; +SYSCTL_INT(_debug, OID_AUTO, qmgr, CTLFLAG_RWTUN, &qmgr_debug, 0, "IXP4XX Q-Manager debug msgs"); -TUNABLE_INT("debug.qmgr", &qmgr_debug); #define DPRINTF(dev, fmt, ...) do { \ if (qmgr_debug) printf(fmt, __VA_ARGS__); \ } while (0) diff --git a/sys/arm/xscale/pxa/pxa_machdep.c b/sys/arm/xscale/pxa/pxa_machdep.c index 2e235f0123e..130e0f383a9 100644 --- a/sys/arm/xscale/pxa/pxa_machdep.c +++ b/sys/arm/xscale/pxa/pxa_machdep.c @@ -129,7 +129,7 @@ static const struct arm_devmap_entry pxa_devmap[] = { PXA2X0_PERIPH_START, PXA250_PERIPH_END - PXA2X0_PERIPH_START, VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, + PTE_DEVICE, }, { 0, 0, 0, 0, 0, } }; @@ -335,6 +335,10 @@ initarm(struct arm_boot_params *abp) if (memsize[j] > 0) arm_physmem_hardware_region(memstart[j], memsize[j]); } + arm_physmem_exclude_region(freemem_pt, KERNPHYSADDR - + freemem_pt, EXFLAG_NOALLOC); + arm_physmem_exclude_region(freemempos, KERNPHYSADDR - 0x100000 - + freemempos, EXFLAG_NOALLOC); arm_physmem_exclude_region(abp->abp_physaddr, virtual_avail - KERNVIRTADDR, EXFLAG_NOALLOC); arm_physmem_init_kernel_globals(); diff --git a/sys/boot/Makefile.ia64 b/sys/boot/Makefile.ia64 deleted file mode 100644 index 256201d4f94..00000000000 --- a/sys/boot/Makefile.ia64 +++ /dev/null @@ -1,4 +0,0 @@ -# $FreeBSD$ - -SUBDIR+= efi -SUBDIR+= zfs diff --git a/sys/boot/amd64/boot1.efi/Makefile b/sys/boot/amd64/boot1.efi/Makefile index 641861ed00a..3e3bc9fcc82 100644 --- a/sys/boot/amd64/boot1.efi/Makefile +++ b/sys/boot/amd64/boot1.efi/Makefile @@ -77,7 +77,7 @@ CLEANFILES= boot1.efifat beforedepend ${OBJS}: machine x86 -CLEANFILES+= machine x86 +CLEANFILES+= machine x86 boot1.efi machine: ln -sf ${.CURDIR}/../../../amd64/include machine diff --git a/sys/boot/amd64/efi/bootinfo.c b/sys/boot/amd64/efi/bootinfo.c index bf11f5b73b2..db82b241df5 100644 --- a/sys/boot/amd64/efi/bootinfo.c +++ b/sys/boot/amd64/efi/bootinfo.c @@ -225,8 +225,15 @@ bi_load_efi_data(struct preloaded_file *kfp) struct efi_map_header *efihdr; struct efi_fb efifb; - if (efi_find_framebuffer(&efifb) == 0) + if (efi_find_framebuffer(&efifb) == 0) { + printf("EFI framebuffer information:\n"); + printf("addr, size 0x%lx, 0x%lx\n", efifb.fb_addr, efifb.fb_size); + printf("dimensions %d x %d\n", efifb.fb_width, efifb.fb_height); + printf("stride %d\n", efifb.fb_stride); + printf("masks 0x%08x, 0x%08x, 0x%08x, 0x%08x\n", efifb.fb_mask_red, efifb.fb_mask_green, efifb.fb_mask_blue, efifb.fb_mask_reserved); + file_addmetadata(kfp, MODINFOMD_EFI_FB, sizeof(efifb), &efifb); + } efisz = (sizeof(struct efi_map_header) + 0xf) & ~0xf; diff --git a/sys/boot/amd64/efi/main.c b/sys/boot/amd64/efi/main.c index d1ea9c3f00b..2262a1d0314 100644 --- a/sys/boot/amd64/efi/main.c +++ b/sys/boot/amd64/efi/main.c @@ -124,7 +124,7 @@ main(int argc, CHAR16 *argv[]) archsw.arch_copyout = x86_efi_copyout; archsw.arch_readin = x86_efi_readin; - interact(); /* doesn't return */ + interact(NULL); /* doesn't return */ return (EFI_SUCCESS); /* keep compiler happy */ } diff --git a/sys/boot/arm/at91/boot0/main.c b/sys/boot/arm/at91/boot0/main.c index 4bc7fc6ea90..36dfe821444 100644 --- a/sys/boot/arm/at91/boot0/main.c +++ b/sys/boot/arm/at91/boot0/main.c @@ -30,6 +30,8 @@ typedef void fn_t(void); +int main(void); + int main(void) { diff --git a/sys/boot/arm/at91/boot0iic/main.c b/sys/boot/arm/at91/boot0iic/main.c index 7d0e9d319e7..2a81b937ae6 100644 --- a/sys/boot/arm/at91/boot0iic/main.c +++ b/sys/boot/arm/at91/boot0iic/main.c @@ -28,6 +28,8 @@ #include "lib.h" #include "at91rm9200_lowlevel.h" +int main(void); + int main(void) { diff --git a/sys/boot/arm/at91/boot0spi/main.c b/sys/boot/arm/at91/boot0spi/main.c index 4d03b26fe0d..cac037b5b0a 100644 --- a/sys/boot/arm/at91/boot0spi/main.c +++ b/sys/boot/arm/at91/boot0spi/main.c @@ -31,7 +31,9 @@ #define OFFSET 0 -void +int main(void); + +int main(void) { int len, i, j, off, sec; @@ -59,4 +61,5 @@ main(void) continue; printf("Done\n"); reset(); + return (1); } diff --git a/sys/boot/arm/at91/boot2/boot2.c b/sys/boot/arm/at91/boot2/boot2.c index c3629a522c7..1e17ab21c14 100644 --- a/sys/boot/arm/at91/boot2/boot2.c +++ b/sys/boot/arm/at91/boot2/boot2.c @@ -77,7 +77,7 @@ extern uint32_t _end; #define OPT_CHECK(opt) ((opts) & OPT_SET(opt)) static const char optstr[NOPT] = "agnrsv"; -static const unsigned char flags[NOPT] = { +static const unsigned char bootflags[NOPT] = { RBX_ASKNAME, RBX_GDB, RBX_NOINTR, @@ -93,6 +93,7 @@ static char kname[1024]; static uint32_t opts; static uint8_t dsk_meta; +int main(void); static void load(void); static int parse(void); static int dskread(void *, unsigned, unsigned); @@ -190,6 +191,7 @@ main(void) else load(); } + return (1); } static void @@ -263,7 +265,7 @@ parse() for (i = 0; c != optstr[i]; i++) if (i == NOPT - 1) return -1; - opts ^= OPT_SET(flags[i]); + opts ^= OPT_SET(bootflags[i]); } } else { arg--; diff --git a/sys/boot/arm/at91/bootiic/main.c b/sys/boot/arm/at91/bootiic/main.c index b2b6e39041e..86368358ce8 100644 --- a/sys/boot/arm/at91/bootiic/main.c +++ b/sys/boot/arm/at91/bootiic/main.c @@ -28,6 +28,8 @@ #include "emac.h" #include "lib.h" +int main(void); + /* * .KB_C_FN_DEFINITION_START * int main(void) diff --git a/sys/boot/arm/at91/bootspi/main.c b/sys/boot/arm/at91/bootspi/main.c index c15dabc636f..cb9d1dbc422 100644 --- a/sys/boot/arm/at91/bootspi/main.c +++ b/sys/boot/arm/at91/bootspi/main.c @@ -43,6 +43,8 @@ #include "spi_flash.h" #include "ee.h" +int main(void); + int main(void) { diff --git a/sys/boot/arm/at91/libat91/emac.c b/sys/boot/arm/at91/libat91/emac.c index 2ec715fb78e..509d535ed97 100644 --- a/sys/boot/arm/at91/libat91/emac.c +++ b/sys/boot/arm/at91/libat91/emac.c @@ -96,7 +96,8 @@ GetServerAddress(void) memcpy(p_ARP->target_ip, serverIPAddr, 4); // wait until transmit is available - while (!(*AT91C_EMAC_TSR & AT91C_EMAC_BNQ)) ; + while (!(*AT91C_EMAC_TSR & AT91C_EMAC_BNQ)) + continue; *AT91C_EMAC_TSR |= AT91C_EMAC_COMP; *AT91C_EMAC_TAR = (unsigned)transmitBuffer; @@ -157,7 +158,8 @@ Send_TFTP_Packet(char *tftpData, unsigned tftpLength) udpHdr->udp_cksum = SWAP16(t_checksum); - while (!(*AT91C_EMAC_TSR & AT91C_EMAC_BNQ)) ; + while (!(*AT91C_EMAC_TSR & AT91C_EMAC_BNQ)) + continue; *AT91C_EMAC_TSR |= AT91C_EMAC_COMP; *AT91C_EMAC_TAR = (unsigned)tftpSendPacket; diff --git a/sys/boot/arm/at91/libat91/mci_device.h b/sys/boot/arm/at91/libat91/mci_device.h index 903454c2c0f..c2b75ad70be 100644 --- a/sys/boot/arm/at91/libat91/mci_device.h +++ b/sys/boot/arm/at91/libat91/mci_device.h @@ -90,6 +90,8 @@ typedef struct _AT91S_MciDevice { volatile unsigned char state; unsigned char SDCard_bus_width; + unsigned char IsSDv2; + unsigned char IsSDHC; unsigned int RCA; // RCA unsigned int READ_BL_LEN; #ifdef REPORT_SIZE @@ -202,7 +204,9 @@ typedef struct _AT91S_MciDevice MMC_MAXLAT) #define GO_INACTIVE_STATE_CMD \ (15 | MMC_RSPTYP_NO) - +#define SD_SEND_IF_COND_CMD \ + (8 | MMC_TRCMD_NO | MMC_SPCMD_NONE | MMC_RSPTYP_48 | \ + MMC_MAXLAT) //*------------------------------------------------ //* Class 2 commands: Block oriented Read commands //*------------------------------------------------ @@ -264,7 +268,7 @@ typedef struct _AT91S_MciDevice #define SDCARD_STATUS_CMD (13 | MMC_SPCMD_NONE | MMC_RSPTYP_48 | MMC_TRCMD_NO | MMC_MAXLAT) #define SDCARD_SEND_NUM_WR_BLOCKS_CMD (22 | MMC_SPCMD_NONE | MMC_RSPTYP_48 | MMC_TRCMD_NO | MMC_MAXLAT) #define SDCARD_SET_WR_BLK_ERASE_COUNT_CMD (23 | MMC_SPCMD_NONE | MMC_RSPTYP_48 | MMC_TRCMD_NO | MMC_MAXLAT) -#define SDCARD_APP_OP_COND_CMD (41 | MMC_SPCMD_NONE | MMC_RSPTYP_48 | MMC_TRCMD_NO ) +#define SDCARD_APP_OP_COND_CMD (41 | MMC_SPCMD_NONE | MMC_RSPTYP_48 | MMC_TRCMD_NO | MMC_MAXLAT) #define SDCARD_SET_CLR_CARD_DETECT_CMD (42 | MMC_SPCMD_NONE | MMC_RSPTYP_48 | MMC_TRCMD_NO | MMC_MAXLAT) #define SDCARD_SEND_SCR_CMD (51 | MMC_SPCMD_NONE | MMC_RSPTYP_48 | MMC_TRCMD_NO | MMC_MAXLAT) @@ -306,7 +310,8 @@ typedef struct _AT91S_MciDevice #define AT91C_VDD_33_34 (1 << 21) #define AT91C_VDD_34_35 (1 << 22) #define AT91C_VDD_35_36 (1 << 23) -#define AT91C_CARD_POWER_UP_BUSY (1U << 31) +#define AT91C_CCS (1 << 30) +#define AT91C_CARD_POWER_UP_DONE (1U << 31) #define AT91C_MMC_HOST_VOLTAGE_RANGE (AT91C_VDD_27_28 | AT91C_VDD_28_29 | \ AT91C_VDD_29_30 | AT91C_VDD_30_31 | AT91C_VDD_31_32 | AT91C_VDD_32_33) diff --git a/sys/boot/arm/at91/libat91/sd-card.c b/sys/boot/arm/at91/libat91/sd-card.c index acc8e335ad4..803d782d97a 100644 --- a/sys/boot/arm/at91/libat91/sd-card.c +++ b/sys/boot/arm/at91/libat91/sd-card.c @@ -47,35 +47,38 @@ #include "lib.h" #include "sd-card.h" -#define AT91C_MCI_TIMEOUT 1000000 /* For AT91F_MCIDeviceWaitReady */ -#define BUFFER_SIZE_MCI_DEVICE 512 -#define MASTER_CLOCK 60000000 +#define AT91C_MCI_TIMEOUT 1000000 /* For AT91F_MCIDeviceWaitReady */ +#define SD_BLOCK_SIZE 512 //* Global Variables -AT91S_MciDevice MCI_Device; -char Buffer[BUFFER_SIZE_MCI_DEVICE]; +static AT91S_MciDevice MCI_Device; /****************************************************************************** **Error return codes ******************************************************************************/ -#define MCI_UNSUPP_SIZE_ERROR 5 +#define MCI_UNSUPP_SIZE_ERROR 5 #define MCI_UNSUPP_OFFSET_ERROR 6 //*---------------------------------------------------------------------------- //* \fn MCIDeviceWaitReady //* \brief Wait for MCI Device ready //*---------------------------------------------------------------------------- -static void +static unsigned int MCIDeviceWaitReady(unsigned int timeout) { - volatile int status; - + volatile unsigned int status; + int waitfor; + + if (MCI_Device.state == AT91C_MCI_RX_SINGLE_BLOCK) + waitfor = AT91C_MCI_RXBUFF; + else + waitfor = AT91C_MCI_NOTBUSY; do { status = AT91C_BASE_MCI->MCI_SR; timeout--; } - while( !(status & AT91C_MCI_NOTBUSY) && (timeout>0) ); + while( !(status & waitfor) && (timeout>0) ); status = AT91C_BASE_MCI->MCI_SR; @@ -92,25 +95,39 @@ MCIDeviceWaitReady(unsigned int timeout) AT91C_BASE_PDC_MCI->PDC_PTCR = AT91C_PDC_RXTDIS; MCI_Device.state = AT91C_MCI_IDLE; } // End of if AT91C_MCI_RXBUFF + + //printf("WaitReady returning status %x\n", status); + + return status; } static inline unsigned int -swap(unsigned int a) +swap(unsigned int v) { - return (((a & 0xff) << 24) | ((a & 0xff00) << 8) | ((a & 0xff0000) >> 8) - | ((a & 0xff000000) >> 24)); + unsigned int t1; + + __asm __volatile("eor %1, %0, %0, ror #16\n" + "bic %1, %1, #0x00ff0000\n" + "mov %0, %0, ror #8\n" + "eor %0, %0, %1, lsr #8\n" + : "+r" (v), "=r" (t1)); + + return (v); } -static inline void +inline static unsigned int wait_ready() { int status; + int timeout = AT91C_MCI_TIMEOUT; // wait for CMDRDY Status flag to read the response do { status = AT91C_BASE_MCI->MCI_SR; - } while( !(status & AT91C_MCI_CMDRDY) ); + } while( !(status & AT91C_MCI_CMDRDY) && (--timeout > 0) ); + + return status; } //*---------------------------------------------------------------------------- @@ -122,18 +139,24 @@ MCI_SendCommand( unsigned int Cmd, unsigned int Arg) { - unsigned int error; + unsigned int error; + unsigned int errorMask = AT91C_MCI_SR_ERROR; + unsigned int opcode = Cmd & 0x3F; + + //printf("SendCmd %d (%x) arg %x\n", opcode, Cmd, Arg); + + // Don't check response CRC on ACMD41 (R3 response type). + + if (opcode == 41) + errorMask &= ~AT91C_MCI_RCRCE; AT91C_BASE_MCI->MCI_ARGR = Arg; AT91C_BASE_MCI->MCI_CMDR = Cmd; -// printf("CMDR %x ARG %x\n", Cmd, Arg); - wait_ready(); - // Test error ==> if crc error and response R3 ==> don't check error - error = (AT91C_BASE_MCI->MCI_SR) & AT91C_MCI_SR_ERROR; - if (error != 0) { - if (error != AT91C_MCI_RCRCE) - return (1); + error = wait_ready(); + + if ((error & errorMask) != 0) { + return (1); } return 0; } @@ -146,93 +169,97 @@ static unsigned int MCI_GetStatus() { if (MCI_SendCommand(SEND_STATUS_CMD, MCI_Device.RCA << 16)) - return AT91C_CMD_SEND_ERROR; + return 0; return (AT91C_BASE_MCI->MCI_RSPR[0]); + } //*---------------------------------------------------------------------------- //* \fn MCI_ReadBlock -//* \brief Read an ENTIRE block or PARTIAL block +//* \brief Start the read for a single 512-byte block //*---------------------------------------------------------------------------- static int -MCI_ReadBlock(int src, unsigned int *dataBuffer, int sizeToRead) +MCI_StartReadBlock(unsigned blknum, void *dataBuffer) { -// unsigned log2sl = MCI_Device.READ_BL_LEN; -// unsigned sectorLength = 1 << log2sl; - unsigned sectorLength = 512; - - /////////////////////////////////////////////////////////////////////// - if (MCI_Device.state != AT91C_MCI_IDLE) - return 1; - - if ((MCI_GetStatus() & AT91C_SR_READY_FOR_DATA) == 0) - return 1; - - /////////////////////////////////////////////////////////////////////// - // Init Mode Register - AT91C_BASE_MCI->MCI_MR |= ((sectorLength << 16) | AT91C_MCI_PDCMODE); + AT91C_BASE_MCI->MCI_MR |= ((SD_BLOCK_SIZE << 16) | AT91C_MCI_PDCMODE); - sizeToRead = sizeToRead / 4; - + // (PDC) Receiver Transfer Enable AT91C_BASE_PDC_MCI->PDC_PTCR = (AT91C_PDC_TXTDIS | AT91C_PDC_RXTDIS); AT91C_BASE_PDC_MCI->PDC_RPR = (unsigned int)dataBuffer; - AT91C_BASE_PDC_MCI->PDC_RCR = sizeToRead; + AT91C_BASE_PDC_MCI->PDC_RCR = SD_BLOCK_SIZE / 4;; + AT91C_BASE_PDC_MCI->PDC_PTCR = AT91C_PDC_RXTEN; + + // SDHC wants block offset, non-HC wants byte offset. + if (!MCI_Device.IsSDHC) + blknum *= SD_BLOCK_SIZE; // Send the Read single block command - if (MCI_SendCommand(READ_SINGLE_BLOCK_CMD, src)) + if (MCI_SendCommand(READ_SINGLE_BLOCK_CMD, blknum)) { return AT91C_READ_ERROR; + } MCI_Device.state = AT91C_MCI_RX_SINGLE_BLOCK; - // Enable AT91C_MCI_RXBUFF Interrupt - AT91C_BASE_MCI->MCI_IER = AT91C_MCI_RXBUFF; - - // (PDC) Receiver Transfer Enable - AT91C_BASE_PDC_MCI->PDC_PTCR = AT91C_PDC_RXTEN; - return 0; } +//*---------------------------------------------------------------------------- +//* \fn MCI_readblocks +//* \brief Read one or more blocks +//*---------------------------------------------------------------------------- int -MCI_read(char* dest, unsigned source, unsigned length) +MCI_readblocks(char* dest, unsigned blknum, unsigned blkcount) { -// unsigned log2sl = MCI_Device.READ_BL_LEN; -// unsigned sectorLength = 1 << log2sl; - unsigned sectorLength = 512; - int sizeToRead; + unsigned int status; unsigned int *walker; - //As long as there is data to read - while (length) - { - if (length > sectorLength) - sizeToRead = sectorLength; - else - sizeToRead = length; - - MCIDeviceWaitReady(AT91C_MCI_TIMEOUT); - //Do the reading - if (MCI_ReadBlock(source, - (unsigned int*)dest, sizeToRead)) - return -1; - - //* Wait MCI Device Ready - MCIDeviceWaitReady(AT91C_MCI_TIMEOUT); - - // Fix erratum in MCI part - for (walker = (unsigned int *)dest; - walker < (unsigned int *)(dest + sizeToRead); walker++) - *walker = swap(*walker); - - //Update counters & pointers - length -= sizeToRead; - dest += sizeToRead; - source += sizeToRead; + if (MCI_Device.state != AT91C_MCI_IDLE) { + return 1; } + if ((MCI_GetStatus() & AT91C_SR_READY_FOR_DATA) == 0) { + return 1; + } + + // As long as there is data to read + while (blkcount) + { + //Do the reading + if (MCI_StartReadBlock(blknum, dest)) + return -1; + + // Wait MCI Device Ready + status = MCIDeviceWaitReady(AT91C_MCI_TIMEOUT); + if (status & AT91C_MCI_SR_ERROR) + return 1; + + // Fix erratum in MCI part - endian-swap all data. + for (walker = (unsigned int *)dest; + walker < (unsigned int *)(dest + SD_BLOCK_SIZE); walker++) + *walker = swap(*walker); + + // Update counters & pointers + ++blknum; + --blkcount; + dest += SD_BLOCK_SIZE; + } + + return 0; } +//*---------------------------------------------------------------------------- +//* \fn MCI_read +//* \brief Legacy read function, takes byte offset and length but was always +//* used to read full blocks; interface preserved for existing boot code. +//*---------------------------------------------------------------------------- +int +MCI_read(char* dest, unsigned byteoffset, unsigned length) +{ + return MCI_readblocks(dest, + byteoffset/SD_BLOCK_SIZE, length/SD_BLOCK_SIZE); +} + //*---------------------------------------------------------------------------- //* \fn MCI_SDCard_SendAppCommand //* \brief Specific function to send a specific command to the SDCard @@ -242,15 +269,11 @@ MCI_SDCard_SendAppCommand( unsigned int Cmd_App, unsigned int Arg) { - // Send the CMD55 for application specific command - AT91C_BASE_MCI->MCI_ARGR = (MCI_Device.RCA << 16 ); - AT91C_BASE_MCI->MCI_CMDR = APP_CMD; + int status; - wait_ready(); - // if an error occurs - if (AT91C_BASE_MCI->MCI_SR & AT91C_MCI_SR_ERROR) - return (1); - return (MCI_SendCommand(Cmd_App,Arg)); + if ((status = MCI_SendCommand(APP_CMD, (MCI_Device.RCA << 16))) == 0) + status = MCI_SendCommand(Cmd_App,Arg); + return status; } //*---------------------------------------------------------------------------- @@ -260,12 +283,11 @@ MCI_SDCard_SendAppCommand( static int MCI_GetCSD(unsigned int rca, unsigned int *response) { - - if (MCI_SendCommand(SEND_CSD_CMD, (rca << 16))) + if (MCI_SendCommand(SEND_CSD_CMD, (rca << 16))) return 1; response[0] = AT91C_BASE_MCI->MCI_RSPR[0]; - response[1] = AT91C_BASE_MCI->MCI_RSPR[1]; + response[1] = AT91C_BASE_MCI->MCI_RSPR[1]; response[2] = AT91C_BASE_MCI->MCI_RSPR[2]; response[3] = AT91C_BASE_MCI->MCI_RSPR[3]; @@ -274,22 +296,64 @@ MCI_GetCSD(unsigned int rca, unsigned int *response) //*---------------------------------------------------------------------------- //* \fn MCI_SDCard_GetOCR -//* \brief Asks to all cards to send their operations conditions +//* \brief Wait for card to power up and determine whether it's SDHC or not. //*---------------------------------------------------------------------------- static int MCI_SDCard_GetOCR() { - unsigned int response=0x0; + unsigned int response; + unsigned int arg = AT91C_MMC_HOST_VOLTAGE_RANGE; + int timeout = AT91C_MCI_TIMEOUT; - // The RCA to be used for CMD55 in Idle state shall be the card's default RCA=0x0000. - MCI_Device.RCA = 0x0; - - while( (response & AT91C_CARD_POWER_UP_BUSY) != AT91C_CARD_POWER_UP_BUSY ) { - if (MCI_SDCard_SendAppCommand(SDCARD_APP_OP_COND_CMD, - AT91C_MMC_HOST_VOLTAGE_RANGE)) - return 1; - response = AT91C_BASE_MCI->MCI_RSPR[0]; + // Force card to idle state. + + MCI_SendCommand(GO_IDLE_STATE_CMD, AT91C_NO_ARGUMENT); + + // Begin probe for SDHC by sending CMD8; only v2.0 cards respond to it. + // + // Arg is vvpp where vv is voltage range and pp is an arbitrary bit + // pattern that gets echoed back in the response. The only voltage + // ranges defined are: + // 0x01 = 2.7 - 3.6 + // 0x02 = "reserved for low voltage" whatever that means. + // + // If the card fails to respond then it's not v2.0. If it responds by + // echoing back exactly the arg we sent, then it's a v2.0 card and can + // run at our voltage. That means that when we send the ACMD41 (in + // MCI_SDCard_GetOCR) we can include the HCS bit to inquire about SDHC. + + if (MCI_SendCommand(SD_SEND_IF_COND_CMD, 0x01AA) == 0) { + MCI_Device.IsSDv2 = (AT91C_BASE_MCI->MCI_RSPR[0] == 0x01AA); } + + // If we've determined the card supports v2.0 functionality, set the + // HCS/CCS bit to indicate that we support SDHC. This will cause a + // v2.0 card to report whether it is SDHC in the ACMD41 response. + + if (MCI_Device.IsSDv2) { + arg |= AT91C_CCS; + } + + // The RCA to be used for CMD55 in Idle state shall be the card's + // default RCA=0x0000. + + MCI_Device.RCA = 0x0; + + // Repeat ACMD41 until the card comes out of power-up-busy state. + + do { + if (MCI_SDCard_SendAppCommand(SDCARD_APP_OP_COND_CMD, arg)) { + return 1; + } + response = AT91C_BASE_MCI->MCI_RSPR[0]; + } while (!(response & AT91C_CARD_POWER_UP_DONE) && (--timeout > 0)); + + // A v2.0 card sets CCS (card capacity status) in the response if it's SDHC. + + if (MCI_Device.IsSDv2) { + MCI_Device.IsSDHC = ((response & AT91C_CCS) == AT91C_CCS); + } + return (0); } @@ -304,7 +368,7 @@ MCI_SDCard_GetCID(unsigned int *response) return 1; response[0] = AT91C_BASE_MCI->MCI_RSPR[0]; - response[1] = AT91C_BASE_MCI->MCI_RSPR[1]; + response[1] = AT91C_BASE_MCI->MCI_RSPR[1]; response[2] = AT91C_BASE_MCI->MCI_RSPR[2]; response[3] = AT91C_BASE_MCI->MCI_RSPR[3]; @@ -312,47 +376,62 @@ MCI_SDCard_GetCID(unsigned int *response) } //*---------------------------------------------------------------------------- -//* \fn MCI_SDCard_SetBusWidth -//* \brief Set bus width for SDCard +//* \fn sdcard_4wire +//* \brief Set bus width to 1-bit or 4-bit according to the parm. +//* +//* Unlike most functions in this file, the return value from this one is +//* bool-ish; returns 0 on failure, 1 on success. //*---------------------------------------------------------------------------- -static int -MCI_SDCard_SetBusWidth() +int +sdcard_use4wire(int use4wire) { volatile int ret_value; - char bus_width; do { ret_value=MCI_GetStatus(); } while((ret_value > 0) && ((ret_value & AT91C_SR_READY_FOR_DATA) == 0)); - // Select Card - MCI_SendCommand(SEL_DESEL_CARD_CMD, (MCI_Device.RCA)<<16); + // If going to 4-wire mode, ask the card to turn off the DAT3 card detect + // pullup resistor, if going to 1-wire ask it to turn it back on. - // Set bus width for Sdcard - if (MCI_Device.SDCard_bus_width == AT91C_MCI_SCDBUS) - bus_width = AT91C_BUS_WIDTH_4BITS; - else - bus_width = AT91C_BUS_WIDTH_1BIT; + ret_value = MCI_SDCard_SendAppCommand(SDCARD_SET_CLR_CARD_DETECT_CMD, + use4wire ? 0 : 1); + if (ret_value != AT91C_CMD_SEND_OK) + return 0; - if (MCI_SDCard_SendAppCommand( - SDCARD_SET_BUS_WIDTH_CMD,bus_width) != AT91C_CMD_SEND_OK) - return 1; + // Ask the card to go into the requested mode. - return 0; + ret_value = MCI_SDCard_SendAppCommand(SDCARD_SET_BUS_WIDTH_CMD, + use4wire ? AT91C_BUS_WIDTH_4BITS : + AT91C_BUS_WIDTH_1BIT); + if (ret_value != AT91C_CMD_SEND_OK) + return 0; + + // Set the MCI device to match the mode we set in the card. + + if (use4wire) { + MCI_Device.SDCard_bus_width = AT91C_BUS_WIDTH_4BITS; + AT91C_BASE_MCI->MCI_SDCR |= AT91C_MCI_SCDBUS; + } else { + MCI_Device.SDCard_bus_width = AT91C_BUS_WIDTH_1BIT; + AT91C_BASE_MCI->MCI_SDCR &= ~AT91C_MCI_SCDBUS; + } + + return 1; } //*---------------------------------------------------------------------------- -//* \fn main -//* \brief main function +//* \fn sdcard_init +//* \brief get the mci device ready to read from an SD or SDHC card. +//* +//* Unlike most functions in this file, the return value from this one is +//* bool-ish; returns 0 on failure, 1 on success. //*---------------------------------------------------------------------------- int sdcard_init(void) { unsigned int tab_response[4]; -#ifdef REPORT_SIZE - unsigned int mult,blocknr; -#endif int i; // Init MCI for MMC and SDCard interface @@ -362,51 +441,77 @@ sdcard_init(void) // Init Device Structure MCI_Device.state = AT91C_MCI_IDLE; - MCI_Device.SDCard_bus_width = AT91C_MCI_SCDBUS; + MCI_Device.SDCard_bus_width = 0; + MCI_Device.IsSDv2 = 0; + MCI_Device.IsSDHC = 0; - //* Reset the MCI - AT91C_BASE_MCI->MCI_CR = AT91C_MCI_MCIEN | AT91C_MCI_PWSEN; + // Reset the MCI and set the bus speed. + // Using MCK/230 gives a legal (under 400khz) bus speed for the card id + // sequence for all reasonable master clock speeds. + + AT91C_BASE_MCI->MCI_CR = AT91C_MCI_MCIDIS | 0x80; AT91C_BASE_MCI->MCI_IDR = 0xFFFFFFFF; AT91C_BASE_MCI->MCI_DTOR = AT91C_MCI_DTOR_1MEGA_CYCLES; - AT91C_BASE_MCI->MCI_MR = AT91C_MCI_PDCMODE; - AT91C_BASE_MCI->MCI_SDCR = AT91C_MCI_SDCARD_4BITS_SLOTA; - MCI_SendCommand(GO_IDLE_STATE_CMD, AT91C_NO_ARGUMENT); + AT91C_BASE_MCI->MCI_MR = AT91C_MCI_PDCMODE | 114; /* clkdiv 114 = MCK/230 */ + AT91C_BASE_MCI->MCI_SDCR = AT91C_MCI_MMC_SLOTA; + AT91C_BASE_MCI->MCI_CR = AT91C_MCI_MCIEN|AT91C_MCI_PWSEN; + + // Wait for the card to come out of power-up-busy state by repeatedly + // sending ACMD41. This also probes for SDHC versus standard cards. for (i = 0; i < 100; i++) { - if (!MCI_SDCard_GetOCR(&MCI_Device)) + if (MCI_SDCard_GetOCR() == 0) break; - printf("."); + if ((i & 0x01) == 0) { + printf("."); + } } if (i >= 100) return 0; + if (MCI_SDCard_GetCID(tab_response)) return 0; + + // Tell the card to set its address, and remember the result. + if (MCI_SendCommand(SET_RELATIVE_ADDR_CMD, 0)) return 0; - MCI_Device.RCA = (AT91C_BASE_MCI->MCI_RSPR[0] >> 16); + + // After sending CMD3 (set addr) we can increase the clock to full speed. + // Using MCK/4 gives a legal (under 25mhz) bus speed for all reasonable + // master clock speeds. + + AT91C_BASE_MCI->MCI_MR = AT91C_MCI_PDCMODE | 1; /* clkdiv 1 = MCK/4 */ + if (MCI_GetCSD(MCI_Device.RCA,tab_response)) return 0; MCI_Device.READ_BL_LEN = (tab_response[1] >> CSD_1_RD_B_LEN_S) & CSD_1_RD_B_LEN_M; + #ifdef REPORT_SIZE - // compute MULT - mult = 1 << ( ((tab_response[2] >> CSD_2_C_SIZE_M_S) & - CSD_2_C_SIZE_M_M) + 2 ); - // compute MSB of C_SIZE - blocknr = ((tab_response[1] >> CSD_1_CSIZE_H_S) & - CSD_1_CSIZE_H_M) << 2; - // compute MULT * (LSB of C-SIZE + MSB already computed + 1) = BLOCKNR - blocknr = mult * ((blocknr + ((tab_response[2] >> CSD_2_CSIZE_L_S) & - CSD_2_CSIZE_L_M)) + 1); - MCI_Device.Memory_Capacity = (1 << MCI_Device.READ_BL_LEN) * blocknr; + { + unsigned int mult,blocknr; + // compute MULT + mult = 1 << ( ((tab_response[2] >> CSD_2_C_SIZE_M_S) & + CSD_2_C_SIZE_M_M) + 2 ); + // compute MSB of C_SIZE + blocknr = ((tab_response[1] >> CSD_1_CSIZE_H_S) & + CSD_1_CSIZE_H_M) << 2; + // compute MULT * (LSB of C-SIZE + MSB already computed + 1) = BLOCKNR + blocknr = mult * ((blocknr + ((tab_response[2] >> CSD_2_CSIZE_L_S) & + CSD_2_CSIZE_L_M)) + 1); + MCI_Device.Memory_Capacity = (1 << MCI_Device.READ_BL_LEN) * blocknr; + printf("Found SD card %u bytes\n", MCI_Device.Memory_Capacity); + } #endif - if (MCI_SDCard_SetBusWidth()) + + // Select card and set block length for following transfers. + + if (MCI_SendCommand(SEL_DESEL_CARD_CMD, (MCI_Device.RCA)<<16)) return 0; - if (MCI_SendCommand(SET_BLOCKLEN_CMD, 1 << MCI_Device.READ_BL_LEN)) + if (MCI_SendCommand(SET_BLOCKLEN_CMD, SD_BLOCK_SIZE)) return 0; -#ifdef REPORT_SIZE - printf("Found SD card %u bytes\n", MCI_Device.Memory_Capacity); -#endif + return 1; } diff --git a/sys/boot/arm/at91/libat91/sd-card.h b/sys/boot/arm/at91/libat91/sd-card.h index 0a3ce696925..378ad017890 100644 --- a/sys/boot/arm/at91/libat91/sd-card.h +++ b/sys/boot/arm/at91/libat91/sd-card.h @@ -30,9 +30,35 @@ #ifndef __SD_CARD_H #define __SD_CARD_H -int MCI_write (unsigned dest, char* source, unsigned length); -int MCI_read (char* dest, unsigned source, unsigned length); +/* MCI_read() is the original read function, taking a byte offset and byte + * count. It is preserved to support existing customized boot code that still + * refers to it; it will work fine even on SDHC cards as long as the kernel and + * the metadata for locating it all exist within the first 4GB of the card. + * + * MCI_readblocks() is the new read function, taking offset and length in terms + * of block counts (where the SD spec defines a block as 512 bytes), allowing + * the kernel and filesystem metadata to be located anywhere on an SDHC card. + * + * Returns 0 on success, non-zero on failure. + */ + +int MCI_read (char* dest, unsigned bytenum, unsigned length); +int MCI_readblocks (char* dest, unsigned blknum, unsigned blkcount); + +/* sdcard_init() - get things set up to read from an SD or SDHC card. + * + * Returns 0 on failure, non-zero on success. + */ + int sdcard_init(void); +/* By default sdcard_init() sets things up for a 1-wire interface to the + * SD card. Calling sdcard_4wire(true) after sdcard_init() allows customized + * boot code to change to 4-bit transfers when the hardware supports it. + * + * Returns 0 on failure, non-zero on success. + */ +int sdcard_use4wire(int use4wire); + #endif diff --git a/sys/boot/common/Makefile.inc b/sys/boot/common/Makefile.inc index 2a4d561d444..5aae7548c4c 100644 --- a/sys/boot/common/Makefile.inc +++ b/sys/boot/common/Makefile.inc @@ -7,8 +7,6 @@ SRCS+= module.c panic.c .if ${MACHINE} == "i386" || ${MACHINE_CPUARCH} == "amd64" SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c SRCS+= load_elf64.c load_elf64_obj.c reloc_elf64.c -.elif ${MACHINE_CPUARCH} == "ia64" -SRCS+= load_elf64.c load_elf64_obj.c reloc_elf64.c .elif ${MACHINE} == "pc98" SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c .elif ${MACHINE_CPUARCH} == "arm" diff --git a/sys/boot/common/bootstrap.h b/sys/boot/common/bootstrap.h index c9bcc52755f..3d76540826e 100644 --- a/sys/boot/common/bootstrap.h +++ b/sys/boot/common/bootstrap.h @@ -59,7 +59,7 @@ extern char command_errbuf[]; /* XXX blah, length */ #define CMD_ERROR 1 /* interp.c */ -void interact(void); +void interact(const char *rc); int include(const char *filename); /* interp_backslash.c */ @@ -69,7 +69,7 @@ char *backslash(char *str); int parse(int *argc, char ***argv, char *str); /* interp_forth.c */ -void bf_init(void); +void bf_init(const char *rc); int bf_run(char *line); /* boot.c */ diff --git a/sys/boot/common/interp.c b/sys/boot/common/interp.c index 61251ba226d..6866643eeac 100644 --- a/sys/boot/common/interp.c +++ b/sys/boot/common/interp.c @@ -90,7 +90,7 @@ perform(int argc, char *argv[]) * Interactive mode */ void -interact(void) +interact(const char *rc) { static char input[256]; /* big enough? */ #ifndef BOOT_FORTH @@ -99,15 +99,18 @@ interact(void) #endif #ifdef BOOT_FORTH - bf_init(); + bf_init((rc) ? "" : NULL); #endif - /* - * Read our default configuration - */ - if (include("/boot/loader.rc") != CMD_OK) - include("/boot/boot.conf"); + if (rc == NULL) { + /* Read our default configuration. */ + if (include("/boot/loader.rc") != CMD_OK) + include("/boot/boot.conf"); + } else if (*rc != '\0') + include(rc); + printf("\n"); + /* * Before interacting, we might want to autoboot. */ diff --git a/sys/boot/common/interp_forth.c b/sys/boot/common/interp_forth.c index 1c37e2b0beb..37b377b0ee5 100644 --- a/sys/boot/common/interp_forth.c +++ b/sys/boot/common/interp_forth.c @@ -241,7 +241,7 @@ bf_command(FICL_VM *vm) * Initialise the Forth interpreter, create all our commands as words. */ void -bf_init(void) +bf_init(const char *rc) { struct bootblk_command **cmdp; char create_buf[41]; /* 31 characters-long builtins */ @@ -271,13 +271,20 @@ bf_init(void) ficlSetEnv(bf_sys, "loader_version", (bootprog_rev[0] - '0') * 10 + (bootprog_rev[2] - '0')); + pInterp = ficlLookup(bf_sys, "interpret"); + /* try to load and run init file if present */ - if ((fd = open("/boot/boot.4th", O_RDONLY)) != -1) { - (void)ficlExecFD(bf_vm, fd); - close(fd); + if (rc == NULL) + rc = "/boot/boot.4th"; + if (*rc != '\0') { + fd = open(rc, O_RDONLY); + if (fd != -1) { + (void)ficlExecFD(bf_vm, fd); + close(fd); + } } - /* Do this last, so /boot/boot.4th can change it */ + /* Do this again, so that interpret can be redefined. */ pInterp = ficlLookup(bf_sys, "interpret"); } diff --git a/sys/boot/efi/include/amd64/pe.h b/sys/boot/efi/include/amd64/pe.h index 11204647697..f8033c55ac5 100644 --- a/sys/boot/efi/include/amd64/pe.h +++ b/sys/boot/efi/include/amd64/pe.h @@ -498,7 +498,6 @@ typedef struct _IMAGE_BASE_RELOCATION { #define IMAGE_REL_BASED_HIGHLOW 3 #define IMAGE_REL_BASED_HIGHADJ 4 #define IMAGE_REL_BASED_MIPS_JMPADDR 5 -#define IMAGE_REL_BASED_IA64_IMM64 9 #define IMAGE_REL_BASED_DIR64 10 // diff --git a/sys/boot/efi/include/efiapi.h b/sys/boot/efi/include/efiapi.h index 187fe294b58..b955338296b 100644 --- a/sys/boot/efi/include/efiapi.h +++ b/sys/boot/efi/include/efiapi.h @@ -314,10 +314,6 @@ EFI_STATUS #define EFI_IMAGE_MACHINE_IA32 0x014c #endif -#if !defined(EFI_IMAGE_MACHINE_IA64) -#define EFI_IMAGE_MACHINE_IA64 0x0200 -#endif - #if !defined(EFI_IMAGE_MACHINE_EBC) #define EFI_IMAGE_MACHINE_EBC 0x0EBC #endif diff --git a/sys/boot/efi/include/i386/pe.h b/sys/boot/efi/include/i386/pe.h index 0381a44066d..e2ae25c3ddf 100644 --- a/sys/boot/efi/include/i386/pe.h +++ b/sys/boot/efi/include/i386/pe.h @@ -498,7 +498,6 @@ typedef struct _IMAGE_BASE_RELOCATION { #define IMAGE_REL_BASED_HIGHLOW 3 #define IMAGE_REL_BASED_HIGHADJ 4 #define IMAGE_REL_BASED_MIPS_JMPADDR 5 -#define IMAGE_REL_BASED_IA64_IMM64 9 #define IMAGE_REL_BASED_DIR64 10 // diff --git a/sys/boot/efi/include/ia64/efibind.h b/sys/boot/efi/include/ia64/efibind.h deleted file mode 100644 index 21f0d25d70e..00000000000 --- a/sys/boot/efi/include/ia64/efibind.h +++ /dev/null @@ -1,219 +0,0 @@ -/* $FreeBSD$ */ -/*++ - -Copyright (c) 1999 - 2003 Intel Corporation. All rights reserved -This software and associated documentation (if any) is furnished -under a license and may only be used or copied in accordance -with the terms of the license. Except as permitted by such -license, no part of this software or documentation may be -reproduced, stored in a retrieval system, or transmitted in any -form or by any means without the express written consent of -Intel Corporation. - -Module Name: - - efefind.h - -Abstract: - - EFI to compile bindings - - - - -Revision History - ---*/ - -#pragma pack() - - -#ifdef __FreeBSD__ -#include -#else -// -// Basic int types of various widths -// - -#if (__STDC_VERSION__ < 199901L ) - - // No ANSI C 1999/2000 stdint.h integer width declarations - - #if _MSC_EXTENSIONS - - // Use Microsoft C compiler integer width declarations - - typedef unsigned __int64 uint64_t; - typedef __int64 int64_t; - typedef unsigned __int32 uint32_t; - typedef __int32 int32_t; - typedef unsigned __int16 uint16_t; - typedef __int16 int16_t; - typedef unsigned __int8 uint8_t; - typedef __int8 int8_t; - #else - #ifdef UNIX_LP64 - - // Use LP64 programming model from C_FLAGS for integer width declarations - - typedef unsigned long uint64_t; - typedef long int64_t; - typedef unsigned int uint32_t; - typedef int int32_t; - typedef unsigned short uint16_t; - typedef short int16_t; - typedef unsigned char uint8_t; - typedef char int8_t; - #else - - // Assume P64 programming model from C_FLAGS for integer width declarations - - typedef unsigned long long uint64_t; - typedef long long int64_t; - typedef unsigned int uint32_t; - typedef int int32_t; - typedef unsigned short uint16_t; - typedef short int16_t; - typedef unsigned char uint8_t; - typedef char int8_t; - #endif - #endif -#endif -#endif /* __FreeBSD__ */ - -// -// Basic EFI types of various widths -// - - -typedef uint64_t UINT64; -typedef int64_t INT64; -typedef uint32_t UINT32; -typedef int32_t INT32; -typedef uint16_t UINT16; -typedef int16_t INT16; -typedef uint8_t UINT8; -typedef int8_t INT8; - - -#undef VOID -#define VOID void - - -typedef int64_t INTN; -typedef uint64_t UINTN; - -//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// BugBug: Code to debug -// -#define BIT63 0x8000000000000000 - -#define PLATFORM_IOBASE_ADDRESS (0xffffc000000 | BIT63) -#define PORT_TO_MEMD(_Port) (PLATFORM_IOBASE_ADDRESS | ( ( ( (_Port) & 0xfffc) << 10 ) | ( (_Port) & 0x0fff) ) ) - -// -// Macro's with casts make this much easier to use and read. -// -#define PORT_TO_MEM8D(_Port) (*(UINT8 *)(PORT_TO_MEMD(_Port))) -#define POST_CODE(_Data) (PORT_TO_MEM8D(0x80) = (_Data)) -// -// BugBug: End Debug Code!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -#define EFIERR(a) (0x8000000000000000 | a) -#define EFI_ERROR_MASK 0x8000000000000000 -#define EFIERR_OEM(a) (0xc000000000000000 | a) - -#define BAD_POINTER 0xFBFBFBFBFBFBFBFB -#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF - -#pragma intrinsic (__break) -#define BREAKPOINT() __break(0) - -// -// Pointers must be aligned to these address to function -// you will get an alignment fault if this value is less than 8 -// -#define MIN_ALIGNMENT_SIZE 8 - -#define ALIGN_VARIABLE(Value , Adjustment) \ - (UINTN) Adjustment = 0; \ - if((UINTN)Value % MIN_ALIGNMENT_SIZE) \ - (UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value % MIN_ALIGNMENT_SIZE); \ - Value = (UINTN)Value + (UINTN)Adjustment - -// -// Define macros to create data structure signatures. -// - -#define EFI_SIGNATURE_16(A,B) ((A) | (B<<8)) -#define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16)) -#define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32)) - -// -// EFIAPI - prototype calling convention for EFI function pointers -// BOOTSERVICE - prototype for implementation of a boot service interface -// RUNTIMESERVICE - prototype for implementation of a runtime service interface -// RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service -// RUNTIME_CODE - pragma macro for declaring runtime code -// - -#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options - #if _MSC_EXTENSIONS - #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler - #else - #define EFIAPI // Substitute expresion to force C calling convention - #endif -#endif - -#define BOOTSERVICE -#define RUNTIMESERVICE -#define RUNTIMEFUNCTION - -#define RUNTIME_CODE(a) alloc_text("rtcode", a) -#define BEGIN_RUNTIME_DATA() data_seg("rtdata") -#define END_RUNTIME_DATA() data_seg() - -#define VOLATILE volatile - -// -// BugBug: Need to find out if this is portable accross compliers. -// -void __mfa (void); -#pragma intrinsic (__mfa) -#define MEMORY_FENCE() __mfa() - -#ifdef EFI_NO_INTERFACE_DECL - #define EFI_FORWARD_DECLARATION(x) - #define EFI_INTERFACE_DECL(x) -#else - #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x - #define EFI_INTERFACE_DECL(x) typedef struct x -#endif - -// -// When build similiar to FW, then link everything together as -// one big module. -// - -#define EFI_DRIVER_ENTRY_POINT(InitFunction) - -#define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \ - (_if)->LoadInternal(type, name, entry) -// entry(NULL, ST) - -#ifdef __FreeBSD__ -#define INTERFACE_DECL(x) struct x -#else -// -// Some compilers don't support the forward reference construct: -// typedef struct XXXXX -// -// The following macro provide a workaround for such cases. -// -#ifdef NO_INTERFACE_DECL -#define INTERFACE_DECL(x) -#else -#define INTERFACE_DECL(x) typedef struct x -#endif -#endif diff --git a/sys/boot/efi/include/ia64/pe.h b/sys/boot/efi/include/ia64/pe.h deleted file mode 100644 index 24480a5b3ce..00000000000 --- a/sys/boot/efi/include/ia64/pe.h +++ /dev/null @@ -1,637 +0,0 @@ -/* $FreeBSD$ */ -/* - PE32+ header file - */ -#ifndef _PE_H -#define _PE_H - -#define IMAGE_DOS_SIGNATURE 0x5A4D // MZ -#define IMAGE_OS2_SIGNATURE 0x454E // NE -#define IMAGE_OS2_SIGNATURE_LE 0x454C // LE -#define IMAGE_NT_SIGNATURE 0x00004550 // PE00 -#define IMAGE_EDOS_SIGNATURE 0x44454550 // PEED - -/***************************************************************************** - * The following stuff comes from winnt.h from the ia64sdk, plus the Plabel for - * loading EM executables. - *****************************************************************************/ -// -// Intel IA64 specific -// - -#define IMAGE_REL_BASED_IA64_IMM64 9 -#define IMAGE_REL_BASED_IA64_DIR64 10 - -struct Plabel { - UINT64 EntryPoint; - UINT64 NewGP; -}; - -typedef struct _IMAGE_DOS_HEADER { // DOS .EXE header - UINT16 e_magic; // Magic number - UINT16 e_cblp; // Bytes on last page of file - UINT16 e_cp; // Pages in file - UINT16 e_crlc; // Relocations - UINT16 e_cparhdr; // Size of header in paragraphs - UINT16 e_minalloc; // Minimum extra paragraphs needed - UINT16 e_maxalloc; // Maximum extra paragraphs needed - UINT16 e_ss; // Initial (relative) SS value - UINT16 e_sp; // Initial SP value - UINT16 e_csum; // Checksum - UINT16 e_ip; // Initial IP value - UINT16 e_cs; // Initial (relative) CS value - UINT16 e_lfarlc; // File address of relocation table - UINT16 e_ovno; // Overlay number - UINT16 e_res[4]; // Reserved words - UINT16 e_oemid; // OEM identifier (for e_oeminfo) - UINT16 e_oeminfo; // OEM information; e_oemid specific - UINT16 e_res2[10]; // Reserved words - UINT32 e_lfanew; // File address of new exe header - } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER; - -typedef struct _IMAGE_OS2_HEADER { // OS/2 .EXE header - UINT16 ne_magic; // Magic number - UINT8 ne_ver; // Version number - UINT8 ne_rev; // Revision number - UINT16 ne_enttab; // Offset of Entry Table - UINT16 ne_cbenttab; // Number of bytes in Entry Table - UINT32 ne_crc; // Checksum of whole file - UINT16 ne_flags; // Flag UINT16 - UINT16 ne_autodata; // Automatic data segment number - UINT16 ne_heap; // Initial heap allocation - UINT16 ne_stack; // Initial stack allocation - UINT32 ne_csip; // Initial CS:IP setting - UINT32 ne_sssp; // Initial SS:SP setting - UINT16 ne_cseg; // Count of file segments - UINT16 ne_cmod; // Entries in Module Reference Table - UINT16 ne_cbnrestab; // Size of non-resident name table - UINT16 ne_segtab; // Offset of Segment Table - UINT16 ne_rsrctab; // Offset of Resource Table - UINT16 ne_restab; // Offset of resident name table - UINT16 ne_modtab; // Offset of Module Reference Table - UINT16 ne_imptab; // Offset of Imported Names Table - UINT32 ne_nrestab; // Offset of Non-resident Names Table - UINT16 ne_cmovent; // Count of movable entries - UINT16 ne_align; // Segment alignment shift count - UINT16 ne_cres; // Count of resource segments - UINT8 ne_exetyp; // Target Operating system - UINT8 ne_flagsothers; // Other .EXE flags - UINT16 ne_pretthunks; // offset to return thunks - UINT16 ne_psegrefbytes; // offset to segment ref. bytes - UINT16 ne_swaparea; // Minimum code swap area size - UINT16 ne_expver; // Expected Windows version number - } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER; - -// -// File header format. -// - -typedef struct _IMAGE_FILE_HEADER { - UINT16 Machine; - UINT16 NumberOfSections; - UINT32 TimeDateStamp; - UINT32 PointerToSymbolTable; - UINT32 NumberOfSymbols; - UINT16 SizeOfOptionalHeader; - UINT16 Characteristics; -} IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER; - -#define IMAGE_SIZEOF_FILE_HEADER 20 - -#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 // Relocation info stripped from file. -#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 // File is executable (i.e. no unresolved externel references). -#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 // Line nunbers stripped from file. -#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 // Local symbols stripped from file. -#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 // Bytes of machine word are reversed. -#define IMAGE_FILE_32BIT_MACHINE 0x0100 // 32 bit word machine. -#define IMAGE_FILE_DEBUG_STRIPPED 0x0200 // Debugging info stripped from file in .DBG file -#define IMAGE_FILE_SYSTEM 0x1000 // System File. -#define IMAGE_FILE_DLL 0x2000 // File is a DLL. -#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 // Bytes of machine word are reversed. - -#define IMAGE_FILE_MACHINE_UNKNOWN 0 -#define IMAGE_FILE_MACHINE_I386 0x14c // Intel 386. -#define IMAGE_FILE_MACHINE_R3000 0x162 // MIPS little-endian, 0540 big-endian -#define IMAGE_FILE_MACHINE_R4000 0x166 // MIPS little-endian -#define IMAGE_FILE_MACHINE_ALPHA 0x184 // Alpha_AXP -#define IMAGE_FILE_MACHINE_POWERPC 0x1F0 // IBM PowerPC Little-Endian -#define IMAGE_FILE_MACHINE_TAHOE 0x7cc // Intel EM machine -// -// Directory format. -// - -typedef struct _IMAGE_DATA_DIRECTORY { - UINT32 VirtualAddress; - UINT32 Size; -} IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY; - -#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16 - - -typedef struct _IMAGE_ROM_OPTIONAL_HEADER { - UINT16 Magic; - UINT8 MajorLinkerVersion; - UINT8 MinorLinkerVersion; - UINT32 SizeOfCode; - UINT32 SizeOfInitializedData; - UINT32 SizeOfUninitializedData; - UINT32 AddressOfEntryPoint; - UINT32 BaseOfCode; - UINT32 BaseOfData; - UINT32 BaseOfBss; - UINT32 GprMask; - UINT32 CprMask[4]; - UINT32 GpValue; -} IMAGE_ROM_OPTIONAL_HEADER, *PIMAGE_ROM_OPTIONAL_HEADER; - -typedef struct _IMAGE_OPTIONAL_HEADER { - UINT16 Magic; - UINT8 MajorLinkerVersion; - UINT8 MinorLinkerVersion; - UINT32 SizeOfCode; - UINT32 SizeOfInitializedData; - UINT32 SizeOfUninitializedData; - UINT32 AddressOfEntryPoint; - UINT32 BaseOfCode; - // UINT32 BaseOfData; - UINT64 ImageBase; - UINT32 SectionAlignment; - UINT32 FileAlignment; - UINT16 MajorOperatingSystemVersion; - UINT16 MinorOperatingSystemVersion; - UINT16 MajorImageVersion; - UINT16 MinorImageVersion; - UINT16 MajorSubsystemVersion; - UINT16 MinorSubsystemVersion; - UINT32 Win32VersionValue; - UINT32 SizeOfImage; - UINT32 SizeOfHeaders; - UINT32 CheckSum; - UINT16 Subsystem; - UINT16 DllCharacteristics; - UINT64 SizeOfStackReserve; - UINT64 SizeOfStackCommit; - UINT64 SizeOfHeapReserve; - UINT64 SizeOfHeapCommit; - UINT32 LoaderFlags; - UINT32 NumberOfRvaAndSizes; - IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; -} IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER; - - -#define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56 -#define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28 -#define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224 -#define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 244 - -#define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b -#define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b -#define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107 - -typedef struct _IMAGE_NT_HEADERS { - UINT32 Signature; - IMAGE_FILE_HEADER FileHeader; - IMAGE_OPTIONAL_HEADER OptionalHeader; -} IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS; - -typedef struct _IMAGE_ROM_HEADERS { - IMAGE_FILE_HEADER FileHeader; - IMAGE_ROM_OPTIONAL_HEADER OptionalHeader; -} IMAGE_ROM_HEADERS, *PIMAGE_ROM_HEADERS; - -#define IMAGE_FIRST_SECTION( ntheader ) ((PIMAGE_SECTION_HEADER) \ - ((UINT32)ntheader + \ - FIELD_OFFSET( IMAGE_NT_HEADERS, OptionalHeader ) + \ - ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader \ - )) - - -// Subsystem Values - -#define IMAGE_SUBSYSTEM_UNKNOWN 0 // Unknown subsystem. -#define IMAGE_SUBSYSTEM_NATIVE 1 // Image doesn't require a subsystem. -#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 // Image runs in the Windows GUI subsystem. -#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 // Image runs in the Windows character subsystem. -#define IMAGE_SUBSYSTEM_OS2_CUI 5 // image runs in the OS/2 character subsystem. -#define IMAGE_SUBSYSTEM_POSIX_CUI 7 // image run in the Posix character subsystem. - - -// Directory Entries - -#define IMAGE_DIRECTORY_ENTRY_EXPORT 0 // Export Directory -#define IMAGE_DIRECTORY_ENTRY_IMPORT 1 // Import Directory -#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2 // Resource Directory -#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3 // Exception Directory -#define IMAGE_DIRECTORY_ENTRY_SECURITY 4 // Security Directory -#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5 // Base Relocation Table -#define IMAGE_DIRECTORY_ENTRY_DEBUG 6 // Debug Directory -#define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7 // Description String -#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 // Machine Value (MIPS GP) -#define IMAGE_DIRECTORY_ENTRY_TLS 9 // TLS Directory -#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10 // Load Configuration Directory - -// -// Section header format. -// - -#define IMAGE_SIZEOF_SHORT_NAME 8 - -typedef struct _IMAGE_SECTION_HEADER { - UINT8 Name[IMAGE_SIZEOF_SHORT_NAME]; - union { - UINT32 PhysicalAddress; - UINT32 VirtualSize; - } Misc; - UINT32 VirtualAddress; - UINT32 SizeOfRawData; - UINT32 PointerToRawData; - UINT32 PointerToRelocations; - UINT32 PointerToLinenumbers; - UINT16 NumberOfRelocations; - UINT16 NumberOfLinenumbers; - UINT32 Characteristics; -} IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER; - -#define IMAGE_SIZEOF_SECTION_HEADER 40 - -#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 // Reserved. - -#define IMAGE_SCN_CNT_CODE 0x00000020 // Section contains code. -#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 // Section contains initialized data. -#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 // Section contains uninitialized data. - -#define IMAGE_SCN_LNK_OTHER 0x00000100 // Reserved. -#define IMAGE_SCN_LNK_INFO 0x00000200 // Section contains comments or some other type of information. -#define IMAGE_SCN_LNK_REMOVE 0x00000800 // Section contents will not become part of image. -#define IMAGE_SCN_LNK_COMDAT 0x00001000 // Section contents comdat. - -#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 // -#define IMAGE_SCN_ALIGN_2BYTES 0x00200000 // -#define IMAGE_SCN_ALIGN_4BYTES 0x00300000 // -#define IMAGE_SCN_ALIGN_8BYTES 0x00400000 // -#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 // Default alignment if no others are specified. -#define IMAGE_SCN_ALIGN_32BYTES 0x00600000 // -#define IMAGE_SCN_ALIGN_64BYTES 0x00700000 // - -#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 // Section can be discarded. -#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 // Section is not cachable. -#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 // Section is not pageable. -#define IMAGE_SCN_MEM_SHARED 0x10000000 // Section is shareable. -#define IMAGE_SCN_MEM_EXECUTE 0x20000000 // Section is executable. -#define IMAGE_SCN_MEM_READ 0x40000000 // Section is readable. -#define IMAGE_SCN_MEM_WRITE 0x80000000 // Section is writeable. - -// -// Symbol format. -// - - -#define IMAGE_SIZEOF_SYMBOL 18 - -// -// Section values. -// -// Symbols have a section number of the section in which they are -// defined. Otherwise, section numbers have the following meanings: -// - -#define IMAGE_SYM_UNDEFINED (UINT16)0 // Symbol is undefined or is common. -#define IMAGE_SYM_ABSOLUTE (UINT16)-1 // Symbol is an absolute value. -#define IMAGE_SYM_DEBUG (UINT16)-2 // Symbol is a special debug item. - -// -// Type (fundamental) values. -// - -#define IMAGE_SYM_TYPE_NULL 0 // no type. -#define IMAGE_SYM_TYPE_VOID 1 // -#define IMAGE_SYM_TYPE_CHAR 2 // type character. -#define IMAGE_SYM_TYPE_SHORT 3 // type short integer. -#define IMAGE_SYM_TYPE_INT 4 // -#define IMAGE_SYM_TYPE_LONG 5 // -#define IMAGE_SYM_TYPE_FLOAT 6 // -#define IMAGE_SYM_TYPE_DOUBLE 7 // -#define IMAGE_SYM_TYPE_STRUCT 8 // -#define IMAGE_SYM_TYPE_UNION 9 // -#define IMAGE_SYM_TYPE_ENUM 10 // enumeration. -#define IMAGE_SYM_TYPE_MOE 11 // member of enumeration. -#define IMAGE_SYM_TYPE_BYTE 12 // -#define IMAGE_SYM_TYPE_WORD 13 // -#define IMAGE_SYM_TYPE_UINT 14 // -#define IMAGE_SYM_TYPE_DWORD 15 // - -// -// Type (derived) values. -// - -#define IMAGE_SYM_DTYPE_NULL 0 // no derived type. -#define IMAGE_SYM_DTYPE_POINTER 1 // pointer. -#define IMAGE_SYM_DTYPE_FUNCTION 2 // function. -#define IMAGE_SYM_DTYPE_ARRAY 3 // array. - -// -// Storage classes. -// - -#define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1 -#define IMAGE_SYM_CLASS_NULL 0 -#define IMAGE_SYM_CLASS_AUTOMATIC 1 -#define IMAGE_SYM_CLASS_EXTERNAL 2 -#define IMAGE_SYM_CLASS_STATIC 3 -#define IMAGE_SYM_CLASS_REGISTER 4 -#define IMAGE_SYM_CLASS_EXTERNAL_DEF 5 -#define IMAGE_SYM_CLASS_LABEL 6 -#define IMAGE_SYM_CLASS_UNDEFINED_LABEL 7 -#define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8 -#define IMAGE_SYM_CLASS_ARGUMENT 9 -#define IMAGE_SYM_CLASS_STRUCT_TAG 10 -#define IMAGE_SYM_CLASS_MEMBER_OF_UNION 11 -#define IMAGE_SYM_CLASS_UNION_TAG 12 -#define IMAGE_SYM_CLASS_TYPE_DEFINITION 13 -#define IMAGE_SYM_CLASS_UNDEFINED_STATIC 14 -#define IMAGE_SYM_CLASS_ENUM_TAG 15 -#define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16 -#define IMAGE_SYM_CLASS_REGISTER_PARAM 17 -#define IMAGE_SYM_CLASS_BIT_FIELD 18 -#define IMAGE_SYM_CLASS_BLOCK 100 -#define IMAGE_SYM_CLASS_FUNCTION 101 -#define IMAGE_SYM_CLASS_END_OF_STRUCT 102 -#define IMAGE_SYM_CLASS_FILE 103 -// new -#define IMAGE_SYM_CLASS_SECTION 104 -#define IMAGE_SYM_CLASS_WEAK_EXTERNAL 105 - -// type packing constants - -#define N_BTMASK 017 -#define N_TMASK 060 -#define N_TMASK1 0300 -#define N_TMASK2 0360 -#define N_BTSHFT 4 -#define N_TSHIFT 2 - -// MACROS - -// -// Communal selection types. -// - -#define IMAGE_COMDAT_SELECT_NODUPLICATES 1 -#define IMAGE_COMDAT_SELECT_ANY 2 -#define IMAGE_COMDAT_SELECT_SAME_SIZE 3 -#define IMAGE_COMDAT_SELECT_EXACT_MATCH 4 -#define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5 - -#define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1 -#define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2 -#define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3 - - -// -// Relocation format. -// - -typedef struct _IMAGE_RELOCATION { - UINT32 VirtualAddress; - UINT32 SymbolTableIndex; - UINT16 Type; -} IMAGE_RELOCATION; - -#define IMAGE_SIZEOF_RELOCATION 10 - -// -// I386 relocation types. -// - -#define IMAGE_REL_I386_ABSOLUTE 0 // Reference is absolute, no relocation is necessary -#define IMAGE_REL_I386_DIR16 01 // Direct 16-bit reference to the symbols virtual address -#define IMAGE_REL_I386_REL16 02 // PC-relative 16-bit reference to the symbols virtual address -#define IMAGE_REL_I386_DIR32 06 // Direct 32-bit reference to the symbols virtual address -#define IMAGE_REL_I386_DIR32NB 07 // Direct 32-bit reference to the symbols virtual address, base not included -#define IMAGE_REL_I386_SEG12 011 // Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address -#define IMAGE_REL_I386_SECTION 012 -#define IMAGE_REL_I386_SECREL 013 -#define IMAGE_REL_I386_REL32 024 // PC-relative 32-bit reference to the symbols virtual address - -// -// MIPS relocation types. -// - -#define IMAGE_REL_MIPS_ABSOLUTE 0 // Reference is absolute, no relocation is necessary -#define IMAGE_REL_MIPS_REFHALF 01 -#define IMAGE_REL_MIPS_REFWORD 02 -#define IMAGE_REL_MIPS_JMPADDR 03 -#define IMAGE_REL_MIPS_REFHI 04 -#define IMAGE_REL_MIPS_REFLO 05 -#define IMAGE_REL_MIPS_GPREL 06 -#define IMAGE_REL_MIPS_LITERAL 07 -#define IMAGE_REL_MIPS_SECTION 012 -#define IMAGE_REL_MIPS_SECREL 013 -#define IMAGE_REL_MIPS_REFWORDNB 042 -#define IMAGE_REL_MIPS_PAIR 045 - -// -// Alpha Relocation types. -// - -#define IMAGE_REL_ALPHA_ABSOLUTE 0x0 -#define IMAGE_REL_ALPHA_REFLONG 0x1 -#define IMAGE_REL_ALPHA_REFQUAD 0x2 -#define IMAGE_REL_ALPHA_GPREL32 0x3 -#define IMAGE_REL_ALPHA_LITERAL 0x4 -#define IMAGE_REL_ALPHA_LITUSE 0x5 -#define IMAGE_REL_ALPHA_GPDISP 0x6 -#define IMAGE_REL_ALPHA_BRADDR 0x7 -#define IMAGE_REL_ALPHA_HINT 0x8 -#define IMAGE_REL_ALPHA_INLINE_REFLONG 0x9 -#define IMAGE_REL_ALPHA_REFHI 0xA -#define IMAGE_REL_ALPHA_REFLO 0xB -#define IMAGE_REL_ALPHA_PAIR 0xC -#define IMAGE_REL_ALPHA_MATCH 0xD -#define IMAGE_REL_ALPHA_SECTION 0xE -#define IMAGE_REL_ALPHA_SECREL 0xF -#define IMAGE_REL_ALPHA_REFLONGNB 0x10 - -// -// IBM PowerPC relocation types. -// - -#define IMAGE_REL_PPC_ABSOLUTE 0x0000 // NOP -#define IMAGE_REL_PPC_ADDR64 0x0001 // 64-bit address -#define IMAGE_REL_PPC_ADDR32 0x0002 // 32-bit address -#define IMAGE_REL_PPC_ADDR24 0x0003 // 26-bit address, shifted left 2 (branch absolute) -#define IMAGE_REL_PPC_ADDR16 0x0004 // 16-bit address -#define IMAGE_REL_PPC_ADDR14 0x0005 // 16-bit address, shifted left 2 (load doubleword) -#define IMAGE_REL_PPC_REL24 0x0006 // 26-bit PC-relative offset, shifted left 2 (branch relative) -#define IMAGE_REL_PPC_REL14 0x0007 // 16-bit PC-relative offset, shifted left 2 (br cond relative) -#define IMAGE_REL_PPC_TOCREL16 0x0008 // 16-bit offset from TOC base -#define IMAGE_REL_PPC_TOCREL14 0x0009 // 16-bit offset from TOC base, shifted left 2 (load doubleword) - -#define IMAGE_REL_PPC_ADDR32NB 0x000A // 32-bit addr w/o image base -#define IMAGE_REL_PPC_SECREL 0x000B // va of containing section (as in an image sectionhdr) -#define IMAGE_REL_PPC_SECTION 0x000C // sectionheader number -#define IMAGE_REL_PPC_IFGLUE 0x000D // substitute TOC restore instruction iff symbol is glue code -#define IMAGE_REL_PPC_IMGLUE 0x000E // symbol is glue code; virtual address is TOC restore instruction - -#define IMAGE_REL_PPC_TYPEMASK 0x00FF // mask to isolate above values in IMAGE_RELOCATION.Type - -// Flag bits in IMAGE_RELOCATION.TYPE - -#define IMAGE_REL_PPC_NEG 0x0100 // subtract reloc value rather than adding it -#define IMAGE_REL_PPC_BRTAKEN 0x0200 // fix branch prediction bit to predict branch taken -#define IMAGE_REL_PPC_BRNTAKEN 0x0400 // fix branch prediction bit to predict branch not taken -#define IMAGE_REL_PPC_TOCDEFN 0x0800 // toc slot defined in file (or, data in toc) - -// -// Based relocation format. -// - -typedef struct _IMAGE_BASE_RELOCATION { - UINT32 VirtualAddress; - UINT32 SizeOfBlock; -// UINT16 TypeOffset[1]; -} IMAGE_BASE_RELOCATION, *PIMAGE_BASE_RELOCATION; - -#define IMAGE_SIZEOF_BASE_RELOCATION 8 - -// -// Based relocation types. -// - -#define IMAGE_REL_BASED_ABSOLUTE 0 -#define IMAGE_REL_BASED_HIGH 1 -#define IMAGE_REL_BASED_LOW 2 -#define IMAGE_REL_BASED_HIGHLOW 3 -#define IMAGE_REL_BASED_HIGHADJ 4 -#define IMAGE_REL_BASED_MIPS_JMPADDR 5 -#define IMAGE_REL_BASED_IA64_IMM64 9 -#define IMAGE_REL_BASED_DIR64 10 - -// -// Line number format. -// - -typedef struct _IMAGE_LINENUMBER { - union { - UINT32 SymbolTableIndex; // Symbol table index of function name if Linenumber is 0. - UINT32 VirtualAddress; // Virtual address of line number. - } Type; - UINT16 Linenumber; // Line number. -} IMAGE_LINENUMBER; - -#define IMAGE_SIZEOF_LINENUMBER 6 - -// -// Archive format. -// - -#define IMAGE_ARCHIVE_START_SIZE 8 -#define IMAGE_ARCHIVE_START "!\n" -#define IMAGE_ARCHIVE_END "`\n" -#define IMAGE_ARCHIVE_PAD "\n" -#define IMAGE_ARCHIVE_LINKER_MEMBER "/ " -#define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// " - -typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER { - UINT8 Name[16]; // File member name - `/' terminated. - UINT8 Date[12]; // File member date - decimal. - UINT8 UserID[6]; // File member user id - decimal. - UINT8 GroupID[6]; // File member group id - decimal. - UINT8 Mode[8]; // File member mode - octal. - UINT8 Size[10]; // File member size - decimal. - UINT8 EndHeader[2]; // String to end header. -} IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER; - -#define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60 - -// -// DLL support. -// - -// -// Export Format -// - -typedef struct _IMAGE_EXPORT_DIRECTORY { - UINT32 Characteristics; - UINT32 TimeDateStamp; - UINT16 MajorVersion; - UINT16 MinorVersion; - UINT32 Name; - UINT32 Base; - UINT32 NumberOfFunctions; - UINT32 NumberOfNames; - UINT32 AddressOfFunctions; - UINT32 AddressOfNames; - UINT32 AddressOfNameOrdinals; -} IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY; - -// -// Import Format -// - -typedef struct _IMAGE_IMPORT_BY_NAME { - UINT16 Hint; - UINT8 Name[1]; -} IMAGE_IMPORT_BY_NAME, *PIMAGE_IMPORT_BY_NAME; - -typedef struct _IMAGE_THUNK_DATA { - union { - UINT32 Function; - UINT32 Ordinal; - PIMAGE_IMPORT_BY_NAME AddressOfData; - } u1; -} IMAGE_THUNK_DATA, *PIMAGE_THUNK_DATA; - -#define IMAGE_ORDINAL_FLAG 0x80000000 -#define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0) -#define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff) - -typedef struct _IMAGE_IMPORT_DESCRIPTOR { - UINT32 Characteristics; - UINT32 TimeDateStamp; - UINT32 ForwarderChain; - UINT32 Name; - PIMAGE_THUNK_DATA FirstThunk; -} IMAGE_IMPORT_DESCRIPTOR, *PIMAGE_IMPORT_DESCRIPTOR; - -#define IMAGE_DEBUG_TYPE_CODEVIEW 2 - -typedef struct { - UINT32 Characteristics; - UINT32 TimeDateStamp; - UINT16 MajorVersion; - UINT16 MinorVersion; - UINT32 Type; - UINT32 SizeOfData; - UINT32 RVA; - UINT32 FileOffset; -} IMAGE_DEBUG_DIRECTORY_ENTRY; - -#define CODEVIEW_SIGNATURE_NB10 0x3031424E // "NB10" - -typedef struct { - UINT32 Signature; // "NB10" - UINT32 Unknown; - UINT32 Unknown2; - UINT32 Unknown3; - // - // Filename of .PDB goes here - // -} EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY; - -#define CODEVIEW_SIGNATURE_RSDS 0x53445352 // "RSDS" - -typedef struct { - UINT32 Signature; // "RSDS" - UINT32 Unknown; - UINT32 Unknown2; - UINT32 Unknown3; - UINT32 Unknown4; - UINT32 Unknown5; - // - // Filename of .PDB goes here - // -} EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY; - -#endif diff --git a/sys/boot/efi/libefi/Makefile b/sys/boot/efi/libefi/Makefile index df37f31b8d0..60cb43f0274 100644 --- a/sys/boot/efi/libefi/Makefile +++ b/sys/boot/efi/libefi/Makefile @@ -16,4 +16,8 @@ CFLAGS+= -I${.CURDIR}/../../../../lib/libstand # Pick up the bootstrap header for some interface items CFLAGS+= -I${.CURDIR}/../../common + +# Suppress warning from clang for FreeBSD %b and %D formats +CFLAGS+= -fformat-extensions + .include diff --git a/sys/boot/fdt/dts/Makefile b/sys/boot/fdt/dts/Makefile new file mode 100644 index 00000000000..66f65a712fe --- /dev/null +++ b/sys/boot/fdt/dts/Makefile @@ -0,0 +1,5 @@ +# $FreeBSD$ + +SUBDIR=arm mips powerpc + +.include diff --git a/sys/boot/fdt/dts/Makefile.inc b/sys/boot/fdt/dts/Makefile.inc new file mode 100644 index 00000000000..4454755dc81 --- /dev/null +++ b/sys/boot/fdt/dts/Makefile.inc @@ -0,0 +1,10 @@ +# $FreeBSD$ + +SYSDIR?=${.CURDIR}/../../../.. + +test-dts: +.for dts in ${DTS} + @env MACHINE=`basename ${.CURDIR}` ${SYSDIR}/tools/fdt/make_dtb.sh ${SYSDIR} ${dts} /tmp + +.endfor + diff --git a/sys/boot/fdt/dts/arm/Makefile b/sys/boot/fdt/dts/arm/Makefile new file mode 100644 index 00000000000..03d156d9477 --- /dev/null +++ b/sys/boot/fdt/dts/arm/Makefile @@ -0,0 +1,7 @@ +# $FreeBSD$ + +DTS!=ls *.dts + +all: test-dts + +.include diff --git a/sys/boot/fdt/dts/arm/apalis-imx6.dts b/sys/boot/fdt/dts/arm/apalis-imx6.dts new file mode 100644 index 00000000000..0806f4e3981 --- /dev/null +++ b/sys/boot/fdt/dts/arm/apalis-imx6.dts @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2014 Ruslan Bukin + * 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$ + */ + +/dts-v1/; +/include/ "imx6.dtsi" + +/ { + #address-cells = <1>; + #size-cells = <1>; + + model = "Toradex Apalis i.MX6"; + compatible = "toradex,imx6q-apalis", "fsl,imx6q"; + + memory { + reg = <0x10000000 0x40000000>; /* RAM 1GB */ + }; + + SOC: soc@00000000 { + aips@02000000 { /* AIPS1 */ + iomux@020e0000 { status = "okay"; }; + gpio@0209c000 { status = "okay"; }; + gpio@020a0000 { status = "okay"; }; + gpio@020a4000 { status = "okay"; }; + gpio@020a8000 { status = "okay"; }; + gpio@020ac000 { status = "okay"; }; + gpio@020b0000 { status = "okay"; }; + gpio@020b4000 { status = "okay"; }; + console:serial@02020000 { status = "okay"; }; + serial@021e8000 { status = "disabled"; }; + serial@021ec000 { status = "disabled"; }; + serial@021f0000 { status = "disabled"; }; + serial@021f4000 { status = "disabled"; }; + usbphy@020c9000 { status = "okay"; }; + usbphy@020ca000 { status = "okay"; }; + ecspi@02008000 { status = "okay"; }; + ssi@02028000 { status = "okay"; }; + sdma@020ec000 { status = "okay"; }; + }; + aips@02100000 { /* AIPS2 */ + ethernet@02188000 { + status = "okay"; + phy-mode = "rgmii"; + phy-disable-preamble; + }; + usb@02184000 { status = "okay"; }; + usb@02184200 { status = "okay"; }; + usb@02184400 { status = "disabled"; }; + usb@02184600 { status = "disabled"; }; + usdhc@02190000 { status = "disabled"; }; + usdhc@02194000 { status = "okay"; }; + usdhc@02198000 { status = "disabled"; }; + usdhc@0219c000 { status = "disabled"; }; + audmux@021d8000 { status = "okay"; }; + }; + }; + + chosen { + stdin = &console; + stdout = &console; + }; +}; diff --git a/sys/boot/fdt/dts/arm/beaglebone-black.dts b/sys/boot/fdt/dts/arm/beaglebone-black.dts index 0efae4da548..3c9a0f1e53b 100644 --- a/sys/boot/fdt/dts/arm/beaglebone-black.dts +++ b/sys/boot/fdt/dts/arm/beaglebone-black.dts @@ -149,7 +149,7 @@ i2c@44e0b000 { pmic@24 { compatible = "ti,am335x-pmic"; - reg = <0x24>; + reg = <0x48>; }; }; }; diff --git a/sys/boot/fdt/dts/arm/beaglebone.dts b/sys/boot/fdt/dts/arm/beaglebone.dts index 3f8e02294f7..83b948f8694 100644 --- a/sys/boot/fdt/dts/arm/beaglebone.dts +++ b/sys/boot/fdt/dts/arm/beaglebone.dts @@ -133,7 +133,7 @@ i2c@44e0b000 { pmic@24 { compatible = "ti,am335x-pmic"; - reg = <0x24>; + reg = <0x48>; }; }; }; diff --git a/sys/boot/fdt/dts/arm/digi-ccwmx53.dts b/sys/boot/fdt/dts/arm/digi-ccwmx53.dts index 554f2623436..f101c5a27da 100644 --- a/sys/boot/fdt/dts/arm/digi-ccwmx53.dts +++ b/sys/boot/fdt/dts/arm/digi-ccwmx53.dts @@ -37,7 +37,7 @@ / { model = "Digi ConnectCore Wi-i.MX53"; - compatible = "digi,imx53-ccwm53"; + compatible = "digi,imx53-ccwm53", "fsl,imx53"; memory { /* RAM 512M */ diff --git a/sys/boot/fdt/dts/arm/efikamx.dts b/sys/boot/fdt/dts/arm/efikamx.dts index 22b455b5a53..e077fb78ad0 100644 --- a/sys/boot/fdt/dts/arm/efikamx.dts +++ b/sys/boot/fdt/dts/arm/efikamx.dts @@ -36,7 +36,7 @@ / { model = "Genesi Efika MX"; - compatible = "genesi,imx51-efikamx"; + compatible = "genesi,imx51-efikamx", "fsl,imx51"; memory { /* RAM 512M */ diff --git a/sys/boot/fdt/dts/arm/exynos5.dtsi b/sys/boot/fdt/dts/arm/exynos5.dtsi new file mode 100644 index 00000000000..553129959f0 --- /dev/null +++ b/sys/boot/fdt/dts/arm/exynos5.dtsi @@ -0,0 +1,284 @@ +/*- + * Copyright (c) 2013-2014 Ruslan Bukin + * 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$ + */ + +/ { + compatible = "samsung,exynos5"; + #address-cells = <1>; + #size-cells = <1>; + interrupt-parent = <&GIC>; + + aliases { + soc = &SOC; + serial0 = &serial0; + serial1 = &serial1; + serial2 = &serial2; + serial3 = &serial3; + clk0 = &clk0; + dp0 = &dp0; + fimd0 = &fimd0; + }; + + SOC: Exynos5@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + ranges; + bus-frequency = <0>; + + GIC: interrupt-controller@10481000 { + compatible = "arm,gic"; + reg = < 0x10481000 0x1000 >, /* Distributor Registers */ + < 0x10482000 0x2000 >; /* CPU Interface Registers */ + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <1>; + }; + + combiner: interrupt-controller@10440000 { + compatible = "exynos,combiner"; + reg = <0x10440000 0x1000>; + interrupts = < 32 33 34 35 36 37 38 39 + 40 41 42 43 44 45 46 47 + 48 49 50 51 52 53 54 55 + 56 57 58 59 60 61 62 63 >; + interrupt-parent = <&GIC>; + }; + + clk0: clk@10010000 { + compatible = "exynos,clk"; + reg = < 0x10020000 0x20000 >; + }; + + mct { + compatible = "exynos,mct"; + reg = < 0x101C0000 0x1000 >; + clock-frequency = <24000000>; + }; + + generic_timer { + compatible = "arm,armv7-timer"; + clock-frequency = <24000000>; + interrupts = < 29 30 27 26 >; + interrupt-parent = <&GIC>; + }; + + pwm { + compatible = "samsung,s3c24x0-timer"; + reg = <0x12DD0000 0x1000>; + interrupts = < 71 >; + interrupt-parent = <&GIC>; + clock-frequency = <24000000>; + }; + + pad0: pad@11400000 { + compatible = "exynos,pad"; + status = "disabled"; + reg = <0x11400000 0x1000>, /* gpio left */ + <0x13400000 0x1000>, /* gpio right */ + <0x10D10000 0x1000>, /* gpio c2c */ + <0x03860000 0x1000>; + interrupts = < 78 77 82 79 >; + interrupt-parent = <&GIC>; + }; + + usb@12110000 { + compatible = "exynos,usb-ehci", "usb-ehci"; + reg = <0x12110000 0x1000>, /* EHCI */ + <0x12130000 0x1000>, /* EHCI host ctrl */ + <0x10040000 0x1000>, /* Power */ + <0x10050230 0x10>; /* Sysreg */ + interrupts = < 103 >; + interrupt-parent = <&GIC>; + }; + + usb@12120000 { + compatible = "exynos,usb-ohci", "usb-ohci"; + status = "disabled"; + reg = <0x12120000 0x10000>; + interrupts = < 103 >; + interrupt-parent = <&GIC>; + }; + + sdhci@12200000 { + compatible = "sdhci_generic"; + status = "disabled"; + reg = <0x12200000 0x1000>; + interrupts = <107>; + interrupt-parent = <&GIC>; + max-frequency = <24000000>; /* TODO: verify freq */ + }; + + sdhci@12210000 { + compatible = "sdhci_generic"; + status = "disabled"; + reg = <0x12210000 0x1000>; + interrupts = <108>; + interrupt-parent = <&GIC>; + max-frequency = <24000000>; + }; + + sdhci@12220000 { + compatible = "sdhci_generic"; + status = "disabled"; + reg = <0x12220000 0x1000>; + interrupts = <109>; + interrupt-parent = <&GIC>; + max-frequency = <24000000>; + }; + + sdhci@12230000 { + compatible = "sdhci_generic"; + status = "disabled"; + reg = <0x12230000 0x1000>; + interrupts = <110>; + interrupt-parent = <&GIC>; + max-frequency = <24000000>; + }; + + serial0: serial@12C00000 { + compatible = "exynos"; + status = "disabled"; + reg = <0x12C00000 0x100>; + interrupts = < 83 >; + interrupt-parent = <&GIC>; + clock-frequency = < 100000000 >; + current-speed = <115200>; + }; + + serial1: serial@12C10000 { + compatible = "exynos"; + status = "disabled"; + reg = <0x12C10000 0x100>; + interrupts = < 84 >; + interrupt-parent = <&GIC>; + clock-frequency = < 100000000 >; + current-speed = <115200>; + }; + + serial2: serial@12C20000 { + compatible = "exynos"; + status = "disabled"; + reg = <0x12C20000 0x100>; + interrupts = < 85 >; + interrupt-parent = <&GIC>; + clock-frequency = < 100000000 >; + current-speed = <115200>; + }; + + serial3: serial@12C30000 { + compatible = "exynos"; + status = "disabled"; + reg = <0x12C30000 0x100>; + interrupts = < 86 >; + interrupt-parent = <&GIC>; + clock-frequency = < 100000000 >; + current-speed = <115200>; + }; + + i2c0: i2c@12C60000 { + compatible = "exynos,i2c"; + status = "disabled"; + reg = <0x12C60000 0x10000>; + interrupts = < 88 >; + interrupt-parent = <&GIC>; + }; + + i2c1: i2c@12C70000 { + compatible = "exynos,i2c"; + status = "disabled"; + reg = <0x12C70000 0x10000>; + interrupts = < 89 >; + interrupt-parent = <&GIC>; + }; + + i2c2: i2c@12C80000 { + compatible = "exynos,i2c"; + status = "disabled"; + reg = <0x12C80000 0x10000>; + interrupts = < 90 >; + interrupt-parent = <&GIC>; + }; + + i2c3: i2c@12C90000 { + compatible = "exynos,i2c"; + status = "disabled"; + reg = <0x12C90000 0x10000>; + interrupts = < 91 >; + interrupt-parent = <&GIC>; + }; + + i2c4: i2c@12CA0000 { + compatible = "exynos,i2c"; + status = "disabled"; + reg = <0x12CA0000 0x10000>; + interrupts = < 92 >; + interrupt-parent = <&GIC>; + }; + + i2c5: i2c@12CB0000 { + compatible = "exynos,i2c"; + status = "disabled"; + reg = <0x12CB0000 0x10000>; + interrupts = < 93 >; + interrupt-parent = <&GIC>; + }; + + i2c6: i2c@12CC0000 { + compatible = "exynos,i2c"; + status = "disabled"; + reg = <0x12CC0000 0x10000>; + interrupts = < 94 >; + interrupt-parent = <&GIC>; + }; + + i2c7: i2c@12CD0000 { + compatible = "exynos,i2c"; + status = "disabled"; + reg = <0x12CD0000 0x10000>; + interrupts = < 95 >; + interrupt-parent = <&GIC>; + }; + + fimd0: fimd@14400000 { + compatible = "exynos,fimd"; + status = "disabled"; + reg = < 0x14400000 0x10000 >, /* fimd */ + < 0x14420000 0x10000 >, /* disp */ + < 0x10050000 0x220 >; /* sysreg */ + interrupt-parent = <&GIC>; + }; + + dp0: dp@145B0000 { + compatible = "exynos,dp"; + status = "disabled"; + reg = < 0x145B0000 0x10000 >, + < 0x10040720 0x10 >; /* PHY */ + interrupt-parent = <&GIC>; + }; + }; +}; diff --git a/sys/boot/fdt/dts/arm/exynos5250-arndale.dts b/sys/boot/fdt/dts/arm/exynos5250-arndale.dts index c693a309752..81d1817fc83 100644 --- a/sys/boot/fdt/dts/arm/exynos5250-arndale.dts +++ b/sys/boot/fdt/dts/arm/exynos5250-arndale.dts @@ -44,6 +44,10 @@ status = "okay"; }; + serial2: serial@12C20000 { + status = "okay"; + }; + }; chosen { diff --git a/sys/boot/fdt/dts/arm/exynos5250-chromebook.dts b/sys/boot/fdt/dts/arm/exynos5250-chromebook-snow.dts similarity index 90% rename from sys/boot/fdt/dts/arm/exynos5250-chromebook.dts rename to sys/boot/fdt/dts/arm/exynos5250-chromebook-snow.dts index 051b9d471c9..c8ef54aea04 100644 --- a/sys/boot/fdt/dts/arm/exynos5250-chromebook.dts +++ b/sys/boot/fdt/dts/arm/exynos5250-chromebook-snow.dts @@ -59,12 +59,18 @@ }; keyboard-controller { - compatible = "google,cros-ec-keyb"; - keypad,num-rows = <8>; - keypad,num-columns = <13>; + compatible = "google,mkbp-keyb"; + google,key-rows = <8>; + google,key-columns = <13>; + freebsd,intr-gpio = <146>; }; }; + i2c-arbitrator { + freebsd,our-gpio = <177>; + freebsd,ec-gpio = <168>; + }; + chosen { stdin = &serial2; stdout = &serial2; diff --git a/sys/ia64/include/runq.h b/sys/boot/fdt/dts/arm/exynos5250-chromebook-spring.dts similarity index 58% rename from sys/ia64/include/runq.h rename to sys/boot/fdt/dts/arm/exynos5250-chromebook-spring.dts index c2486d1b0b4..c0e42858069 100644 --- a/sys/ia64/include/runq.h +++ b/sys/boot/fdt/dts/arm/exynos5250-chromebook-spring.dts @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2001 Jake Burkholder + * Copyright (c) 2014 Ruslan Bukin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * 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 + * 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) @@ -26,40 +26,53 @@ * $FreeBSD$ */ -#ifndef _MACHINE_RUNQ_H_ -#define _MACHINE_RUNQ_H_ +/dts-v1/; -#define RQB_LEN (1UL) /* Number of priority status words. */ -#define RQB_L2BPW (6UL) /* Log2(sizeof(rqb_word_t) * NBBY)). */ -#define RQB_BPW (1UL<> RQB_L2BPW) +/ { + model = "HP Chromebook 11"; -#define RQB_FFS(word) (__ffsl(word) - 1) + memory { + device_type = "memory"; + reg = < 0x40000000 0x80000000 >; /* 2G */ + }; -/* - * Type of run queue status word. - */ -typedef uint64_t rqb_word_t; + SOC: Exynos5@0 { -static __inline uint64_t -__popcnt(uint64_t bits) -{ - uint64_t result; + pad0: pad@11400000 { + status = "okay"; + }; - __asm __volatile("popcnt %0=%1" : "=r" (result) : "r" (bits)); - return result; -} + fimd0: fimd@14400000 { + status = "okay"; + panel-size = < 1366 768 >; + panel-hsync = < 80 32 48 >; + panel-vsync = < 14 5 3 >; + panel-clk-div = < 17 >; + panel-backlight-pin = < 25 >; + }; -static __inline int -__ffsl(u_long mask) -{ + i2c4: i2c@12CA0000 { + status = "okay"; + }; - if (__predict_false(mask == 0ul)) - return (0); - return (__popcnt(mask ^ (mask - 1))); -} + keyboard-controller { + compatible = "google,mkbp-keyb"; + google,key-rows = <8>; + google,key-columns = <13>; + freebsd,intr-gpio = <146>; + }; + }; -#endif + chosen { + stdin = &serial2; + stdout = &serial2; + }; + + hsichub@13400000 { + compatible = "smsc,usb3503"; + freebsd,reset-gpio = <172>; + }; +}; diff --git a/sys/boot/fdt/dts/arm/exynos5250.dtsi b/sys/boot/fdt/dts/arm/exynos5250.dtsi index 3d2e6bcd2e7..fd500658421 100644 --- a/sys/boot/fdt/dts/arm/exynos5250.dtsi +++ b/sys/boot/fdt/dts/arm/exynos5250.dtsi @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013 Ruslan Bukin + * Copyright (c) 2013-2014 Ruslan Bukin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,248 +26,27 @@ * $FreeBSD$ */ -/ { - compatible = "samsung,exynos5250"; - #address-cells = <1>; - #size-cells = <1>; - interrupt-parent = <&GIC>; +/include/ "exynos5.dtsi" - aliases { - soc = &SOC; - serial0 = &serial0; - serial1 = &serial1; - clk0 = &clk0; - dp0 = &dp0; - fimd0 = &fimd0; - }; +/ { + compatible = "samsung,exynos5250", "samsung,exynos5"; SOC: Exynos5@0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "simple-bus"; - ranges; - bus-frequency = <0>; - - GIC: interrupt-controller@10481000 { - compatible = "arm,gic"; - reg = < 0x10481000 0x1000 >, /* Distributor Registers */ - < 0x10482000 0x2000 >; /* CPU Interface Registers */ - interrupt-controller; - #address-cells = <0>; - #interrupt-cells = <1>; - }; - - combiner: interrupt-controller@10440000 { - compatible = "exynos,combiner"; - reg = <0x10440000 0x1000>; - interrupts = < 32 33 34 35 36 37 38 39 - 40 41 42 43 44 45 46 47 - 48 49 50 51 52 53 54 55 - 56 57 58 59 60 61 62 63 >; - interrupt-parent = <&GIC>; - }; - - clk0: clk@10010000 { - compatible = "exynos,clk"; - reg = < 0x10020000 0x20000 >; - }; - - mct { - compatible = "exynos,mct"; - reg = < 0x101C0000 0x1000 >; - clock-frequency = <24000000>; - }; - - generic_timer { - compatible = "arm,armv7-timer"; - clock-frequency = <24000000>; - interrupts = < 29 30 27 26 >; - interrupt-parent = <&GIC>; - }; - - pwm { - compatible = "samsung,s3c24x0-timer"; - reg = <0x12DD0000 0x1000>; - interrupts = < 71 >; - interrupt-parent = <&GIC>; - clock-frequency = <24000000>; - }; - - pad0: pad@11400000 { - compatible = "exynos,pad"; - status = "disabled"; - reg = <0x11400000 0x1000>, /* gpio left */ - <0x13400000 0x1000>, /* gpio right */ - <0x10D10000 0x1000>, /* gpio c2c */ - <0x03860000 0x1000>; - interrupts = < 78 77 82 79 >; - interrupt-parent = <&GIC>; - }; - - usb@12110000 { - compatible = "exynos,usb-ehci", "usb-ehci"; - reg = <0x12110000 0x1000>, /* EHCI */ - <0x12130000 0x1000>, /* EHCI host ctrl */ - <0x10040000 0x1000>, /* Power */ - <0x10050230 0x10>; /* Sysreg */ - interrupts = < 103 >; - interrupt-parent = <&GIC>; - }; - - usb@12120000 { - compatible = "exynos,usb-ohci", "usb-ohci"; - reg = <0x12120000 0x10000>; - interrupts = < 103 >; - interrupt-parent = <&GIC>; - }; - - sdhci@12200000 { - compatible = "sdhci_generic"; - reg = <0x12200000 0x1000>; - interrupts = <107>; - interrupt-parent = <&GIC>; - max-frequency = <24000000>; /* TODO: verify freq */ - }; - - sdhci@12210000 { - compatible = "sdhci_generic"; - reg = <0x12210000 0x1000>; - interrupts = <108>; - interrupt-parent = <&GIC>; - max-frequency = <24000000>; - }; - - sdhci@12220000 { - compatible = "sdhci_generic"; - reg = <0x12220000 0x1000>; - interrupts = <109>; - interrupt-parent = <&GIC>; - max-frequency = <24000000>; - }; - - sdhci@12230000 { - compatible = "sdhci_generic"; - reg = <0x12230000 0x1000>; - interrupts = <110>; - interrupt-parent = <&GIC>; - max-frequency = <24000000>; - }; serial0: serial@12C00000 { - compatible = "exynos"; - reg = <0x12C00000 0x100>; - interrupts = < 83 >; - interrupt-parent = <&GIC>; clock-frequency = < 100000000 >; - current-speed = <115200>; }; serial1: serial@12C10000 { - compatible = "exynos"; - reg = <0x12C10000 0x100>; - interrupts = < 84 >; - interrupt-parent = <&GIC>; clock-frequency = < 100000000 >; - current-speed = <115200>; }; serial2: serial@12C20000 { - compatible = "exynos"; - reg = <0x12C20000 0x100>; - interrupts = < 85 >; - interrupt-parent = <&GIC>; clock-frequency = < 100000000 >; - current-speed = <115200>; }; serial3: serial@12C30000 { - compatible = "exynos"; - reg = <0x12C30000 0x100>; - interrupts = < 86 >; - interrupt-parent = <&GIC>; clock-frequency = < 100000000 >; - current-speed = <115200>; - }; - - i2c0: i2c@12C60000 { - compatible = "exynos,i2c"; - status = "disabled"; - reg = <0x12C60000 0x10000>; - interrupts = < 88 >; - interrupt-parent = <&GIC>; - }; - - i2c1: i2c@12C70000 { - compatible = "exynos,i2c"; - status = "disabled"; - reg = <0x12C70000 0x10000>; - interrupts = < 89 >; - interrupt-parent = <&GIC>; - }; - - i2c2: i2c@12C80000 { - compatible = "exynos,i2c"; - status = "disabled"; - reg = <0x12C80000 0x10000>; - interrupts = < 90 >; - interrupt-parent = <&GIC>; - }; - - i2c3: i2c@12C90000 { - compatible = "exynos,i2c"; - status = "disabled"; - reg = <0x12C90000 0x10000>; - interrupts = < 91 >; - interrupt-parent = <&GIC>; - }; - - i2c4: i2c@12CA0000 { - compatible = "exynos,i2c"; - status = "disabled"; - reg = <0x12CA0000 0x10000>; - interrupts = < 92 >; - interrupt-parent = <&GIC>; - }; - - i2c5: i2c@12CB0000 { - compatible = "exynos,i2c"; - status = "disabled"; - reg = <0x12CB0000 0x10000>; - interrupts = < 93 >; - interrupt-parent = <&GIC>; - }; - - i2c6: i2c@12CC0000 { - compatible = "exynos,i2c"; - status = "disabled"; - reg = <0x12CC0000 0x10000>; - interrupts = < 94 >; - interrupt-parent = <&GIC>; - }; - - i2c7: i2c@12CD0000 { - compatible = "exynos,i2c"; - status = "disabled"; - reg = <0x12CD0000 0x10000>; - interrupts = < 95 >; - interrupt-parent = <&GIC>; - }; - - fimd0: fimd@14400000 { - compatible = "exynos,fimd"; - status = "disabled"; - reg = < 0x14400000 0x10000 >, /* fimd */ - < 0x14420000 0x10000 >, /* disp */ - < 0x10050000 0x220 >; /* sysreg */ - interrupt-parent = <&GIC>; - }; - - dp0: dp@145B0000 { - compatible = "exynos,dp"; - status = "disabled"; - reg = < 0x145B0000 0x10000 >, - < 0x10040720 0x10 >; /* PHY */ - interrupt-parent = <&GIC>; }; }; }; diff --git a/sys/boot/ia64/ski/exit.c b/sys/boot/fdt/dts/arm/exynos5420-arndale-octa.dts similarity index 74% rename from sys/boot/ia64/ski/exit.c rename to sys/boot/fdt/dts/arm/exynos5420-arndale-octa.dts index aeac67c4934..e1d788dfabe 100644 --- a/sys/boot/ia64/ski/exit.c +++ b/sys/boot/fdt/dts/arm/exynos5420-arndale-octa.dts @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2000 Doug Rabson + * Copyright (c) 2014 Ruslan Bukin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * 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 + * 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) @@ -22,21 +22,30 @@ * 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 -__FBSDID("$FreeBSD$"); +/dts-v1/; -#include -#include -#include -#include -#include +/include/ "exynos5420.dtsi" -#include "libski.h" +/ { + model = "Arndale Octa Board"; -void -exit(int code) -{ - ssc(code, 0, 0, 0, SSC_EXIT); -} + memory { + device_type = "memory"; + reg = < 0x20000000 0x40000000 >; /* 1G */ + }; + + SOC: Exynos5@0 { + serial3: serial@12C30000 { + status = "okay"; + }; + }; + + chosen { + stdin = &serial3; + stdout = &serial3; + }; +}; diff --git a/lib/libc/ia64/gen/fpsetmask.c b/sys/boot/fdt/dts/arm/exynos5420.dtsi similarity index 70% rename from lib/libc/ia64/gen/fpsetmask.c rename to sys/boot/fdt/dts/arm/exynos5420.dtsi index d959dc6281a..8fdff7ea9b2 100644 --- a/lib/libc/ia64/gen/fpsetmask.c +++ b/sys/boot/fdt/dts/arm/exynos5420.dtsi @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2001 Doug Rabson + * Copyright (c) 2014 Ruslan Bukin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * 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 + * 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) @@ -22,23 +22,31 @@ * 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 -__FBSDID("$FreeBSD$"); +/include/ "exynos5.dtsi" -#include -#include +/ { + compatible = "samsung,exynos5420", "samsung,exynos5"; -fp_except_t -fpsetmask(fp_except_t mask) -{ - u_int64_t fpsr; - u_int64_t oldmask; + SOC: Exynos5@0 { - __asm __volatile("mov %0=ar.fpsr" : "=r" (fpsr)); - oldmask = ~fpsr & 0x3d; - fpsr = (fpsr & ~0x3d) | (~mask & 0x3d); - __asm __volatile("mov ar.fpsr=%0" :: "r" (fpsr)); - return (oldmask); -} + serial0: serial@12C00000 { + clock-frequency = < 50000000 >; + }; + + serial1: serial@12C10000 { + clock-frequency = < 50000000 >; + }; + + serial2: serial@12C20000 { + clock-frequency = < 50000000 >; + }; + + serial3: serial@12C30000 { + clock-frequency = < 50000000 >; + }; + }; +}; diff --git a/sys/boot/fdt/dts/arm/imx6.dtsi b/sys/boot/fdt/dts/arm/imx6.dtsi index d89a1a5e4fe..f7e739b3a8b 100644 --- a/sys/boot/fdt/dts/arm/imx6.dtsi +++ b/sys/boot/fdt/dts/arm/imx6.dtsi @@ -102,6 +102,20 @@ interrupts = <119 120>; }; + /* System Reset Controller */ + src: src@4006E000 { + compatible = "fsl,imx6-src"; + reg = <0x020D8000 0x100>; + }; + + sdma: sdma@020ec000 { + compatible = "fsl,imx6q-sdma"; + reg = <0x020ec000 0x4000>; + interrupt-parent = <&gic>; + interrupts = <34>; + status = "disabled"; + }; + anatop: anatop@020c8000 { compatible = "fsl,imx6q-anatop"; reg = <0x020c8000 0x1000>; @@ -115,87 +129,95 @@ interrupt-parent = <&gic>; interrupts = <87>; }; -// iomux@73fa8000 { -// compatible = "fsl,imx51-iomux"; -// reg = <0x73fa8000 0x4000>; -// interrupt-parent = <&gic>; interrupts = <7>; -// status = "disabled"; -// }; + iomux@020e0000 { + compatible = "fsl,imx6q-iomux"; + reg = <0x020e0000 0x4000>; + interrupt-parent = <&gic>; + interrupts = <32>; + status = "disabled"; + }; gpio1: gpio@0209c000 { compatible = "fsl,imx6q-gpio", "fsl,imx35-gpio"; reg = <0x0209c000 0x4000>; - interrupts = <0 66 0x04 0 67 0x04>; + interrupts = < 98 99 >; gpio-controller; #gpio-cells = <2>; interrupt-controller; #interrupt-cells = <2>; + status = "disabled"; }; - + gpio2: gpio@020a0000 { compatible = "fsl,imx6q-gpio", "fsl,imx35-gpio"; reg = <0x020a0000 0x4000>; - interrupts = <0 68 0x04 0 69 0x04>; + interrupts = < 100 101 >; gpio-controller; #gpio-cells = <2>; interrupt-controller; #interrupt-cells = <2>; + status = "disabled"; }; - + gpio3: gpio@020a4000 { compatible = "fsl,imx6q-gpio", "fsl,imx35-gpio"; reg = <0x020a4000 0x4000>; - interrupts = <0 70 0x04 0 71 0x04>; + interrupts = < 102 103 >; gpio-controller; #gpio-cells = <2>; interrupt-controller; #interrupt-cells = <2>; + status = "disabled"; }; - + gpio4: gpio@020a8000 { compatible = "fsl,imx6q-gpio", "fsl,imx35-gpio"; reg = <0x020a8000 0x4000>; - interrupts = <0 72 0x04 0 73 0x04>; + interrupts = < 104 105 >; gpio-controller; #gpio-cells = <2>; interrupt-controller; #interrupt-cells = <2>; + status = "disabled"; }; - + gpio5: gpio@020ac000 { compatible = "fsl,imx6q-gpio", "fsl,imx35-gpio"; reg = <0x020ac000 0x4000>; - interrupts = <0 74 0x04 0 75 0x04>; + interrupts = < 106 107 >; gpio-controller; #gpio-cells = <2>; interrupt-controller; #interrupt-cells = <2>; + status = "disabled"; }; - + gpio6: gpio@020b0000 { compatible = "fsl,imx6q-gpio", "fsl,imx35-gpio"; reg = <0x020b0000 0x4000>; - interrupts = <0 76 0x04 0 77 0x04>; + interrupts = < 108 109 >; gpio-controller; #gpio-cells = <2>; interrupt-controller; #interrupt-cells = <2>; + status = "disabled"; }; - + gpio7: gpio@020b4000 { compatible = "fsl,imx6q-gpio", "fsl,imx35-gpio"; reg = <0x020b4000 0x4000>; - interrupts = <0 78 0x04 0 79 0x04>; + interrupts = < 110 111 >; gpio-controller; #gpio-cells = <2>; interrupt-controller; #interrupt-cells = <2>; + status = "disabled"; }; uart1: serial@02020000 { compatible = "fsl,imx6q-uart"; reg = <0x02020000 0x4000>; - interrupt-parent = <&gic>; + interrupt-parent = <&gic>; interrupts = <58>; clock-frequency = <80000000>; status = "disabled"; @@ -204,7 +226,7 @@ uart2: serial@021e8000 { compatible = "fsl,imx6q-uart"; reg = <0x021e8000 0x4000>; - interrupt-parent = <&gic>; + interrupt-parent = <&gic>; interrupts = <59>; clock-frequency = <80000000>; status = "disabled"; @@ -213,7 +235,7 @@ uart3: serial@021ec000 { compatible = "fsl,imx6q-uart"; reg = <0x021ec000 0x4000>; - interrupt-parent = <&gic>; + interrupt-parent = <&gic>; interrupts = <60>; clock-frequency = <80000000>; status = "disabled"; @@ -222,7 +244,7 @@ uart4: serial@021f0000 { compatible = "fsl,imx6q-uart"; reg = <0x021f0000 0x4000>; - interrupt-parent = <&gic>; + interrupt-parent = <&gic>; interrupts = <61>; clock-frequency = <80000000>; status = "disabled"; @@ -231,7 +253,7 @@ uart5: serial@021f4000 { compatible = "fsl,imx6q-uart"; reg = <0x021f4000 0x4000>; - interrupt-parent = <&gic>; + interrupt-parent = <&gic>; interrupts = <62>; clock-frequency = <80000000>; status = "disabled"; @@ -243,14 +265,69 @@ interrupts = <44>; status = "disabled"; }; - + usbphy2: usbphy@020ca000 { compatible = "fsl,imx6q-usbphy", "fsl,imx23-usbphy"; reg = <0x020ca000 0x1000>; interrupts = <45>; status = "disabled"; }; - + + ecspi1: ecspi@02008000 { + compatible = "fsl,imx6q-ecspi"; + reg = <0x02008000 0x4000>; + interrupts = < 63 >; + status = "disabled"; + }; + + ecspi2: ecspi@0200C000 { + compatible = "fsl,imx6q-ecspi"; + reg = <0x0200C000 0x4000>; + interrupts = < 64 >; + status = "disabled"; + }; + + ecspi3: ecspi@02010000 { + compatible = "fsl,imx6q-ecspi"; + reg = <0x02010000 0x4000>; + interrupts = < 65 >; + status = "disabled"; + }; + + ecspi4: ecspi@02014000 { + compatible = "fsl,imx6q-ecspi"; + reg = <0x02014000 0x4000>; + interrupts = < 66 >; + status = "disabled"; + }; + + ecspi5: ecspi@02018000 { + compatible = "fsl,imx6q-ecspi"; + reg = <0x02018000 0x4000>; + interrupts = < 67 >; + status = "disabled"; + }; + + ssi1: ssi@02028000 { + compatible = "fsl,imx6q-ssi"; + reg = <0x02028000 0x4000>; + interrupts = < 78 >; + status = "disabled"; + }; + + ssi2: ssi@0202C000 { + compatible = "fsl,imx6q-ssi"; + reg = <0x0202C000 0x4000>; + interrupts = < 79 >; + status = "disabled"; + }; + + ssi3: ssi@02030000 { + compatible = "fsl,imx6q-ssi"; + reg = <0x02030000 0x4000>; + interrupts = < 80 >; + status = "disabled"; + }; }; aips@02100000 { /* AIPS2 */ @@ -261,13 +338,34 @@ reg = <0x02100000 0x00100000>; ranges; + i2c1: i2c@021a0000 { + compatible = "fsl,imx6q-i2c"; + reg = <0x021a0000 0x4000>; + interrupts = < 68 >; + status = "disabled"; + }; + + i2c2: i2c@021a4000 { + compatible = "fsl,imx6q-i2c"; + reg = <0x021a4000 0x4000>; + interrupts = < 69 >; + status = "disabled"; + }; + + i2c3: i2c@021ac000 { + compatible = "fsl,imx6q-i2c"; + reg = <0x021a8000 0x4000>; + interrupts = < 70 >; + status = "disabled"; + }; + fec1: ethernet@02188000 { compatible = "fsl,imx6q-fec"; reg = <0x02188000 0x4000>; interrupts = <150 151>; status = "disabled"; }; - + usbotg1: usb@02184000 { compatible = "fsl,imx6q-usb", "fsl,imx27-usb"; reg = <0x02184000 0x200>; @@ -276,7 +374,7 @@ fsl,usbmisc = <&usbmisc 0>; status = "disabled"; }; - + usbh1: usb@02184200 { compatible = "fsl,imx6q-usb", "fsl,imx27-usb"; reg = <0x02184200 0x200>; @@ -285,7 +383,7 @@ fsl,usbmisc = <&usbmisc 1>; status = "disabled"; }; - + usbh2: usb@02184400 { compatible = "fsl,imx6q-usb", "fsl,imx27-usb"; reg = <0x02184400 0x200>; @@ -293,7 +391,7 @@ fsl,usbmisc = <&usbmisc 2>; status = "disabled"; }; - + usbh3: usb@02184600 { compatible = "fsl,imx6q-usb", "fsl,imx27-usb"; reg = <0x02184600 0x200>; @@ -301,7 +399,7 @@ fsl,usbmisc = <&usbmisc 3>; status = "disabled"; }; - + usbmisc: usbmisc@02184800 { #index-cells = <1>; compatible = "fsl,imx6q-usbmisc"; @@ -352,6 +450,12 @@ compatible = "fsl,imx6q-ocotp"; reg = <0x021bc000 0x4000>; }; + + audmux: audmux@021d8000 { + compatible = "fsl,imx6q-audmux"; + reg = <0x021d8000 0x4000>; + status = "disabled"; + }; }; }; }; diff --git a/lib/csu/ia64/crtn.S b/sys/boot/fdt/dts/arm/rk3188-radxa-lite.dts similarity index 76% rename from lib/csu/ia64/crtn.S rename to sys/boot/fdt/dts/arm/rk3188-radxa-lite.dts index 681fba38c9b..8f8977683e6 100644 --- a/lib/csu/ia64/crtn.S +++ b/sys/boot/fdt/dts/arm/rk3188-radxa-lite.dts @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2001 Peter Wemm + * Copyright (c) 2014 Ganbold Tsagaankhuu * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,19 +26,34 @@ * $FreeBSD$ */ -#include -__FBSDID("$FreeBSD$"); +/dts-v1/; - .file "crtn.S" +/include/ "rk3188.dtsi" - .section .init,"ax",@progbits - .regstk 0,2,0,0 - mov b0=loc0 /* Recover return addr */ - mov ar.pfs=loc1 - br.ret.sptk.many b0 +/ { + model = "Radxa RadxaRock Lite"; + + memory { + device_type = "memory"; + reg = < 0x60000000 0x40000000 >; /* 1GB RAM */ + }; + + aliases { + soc = &SOC; + }; + + SOC: rk3188 { + + uart2: serial@20064000 { + status = "okay"; + }; + + }; + + chosen { + bootargs = "-v"; + stdin = &uart2; + stdout = &uart2; + }; +}; - .section .fini,"ax",@progbits - .regstk 0,2,0,0 - mov b0=loc0 /* Recover return addr */ - mov ar.pfs=loc1 - br.ret.sptk.many b0 diff --git a/sys/boot/fdt/dts/arm/wandboard-dual.dts b/sys/boot/fdt/dts/arm/wandboard-dual.dts index 65a88c42fca..e9461b66af4 100644 --- a/sys/boot/fdt/dts/arm/wandboard-dual.dts +++ b/sys/boot/fdt/dts/arm/wandboard-dual.dts @@ -44,11 +44,14 @@ SOC: soc@00000000 { aips@02000000 { /* AIPS1 */ -// iomux@73fa8000 { status = "disabled"; }; -// gpio@0209C000 { status = "disabled"; }; -// gpio@020A0000 { status = "disabled"; }; -// gpio@020A4000 { status = "disabled"; }; -// gpio@020A8000 { status = "disabled"; }; + iomux@020e0000 { status = "disabled"; }; + gpio@0209c000 { status = "okay"; }; + gpio@020a0000 { status = "okay"; }; + gpio@020a4000 { status = "okay"; }; + gpio@020a8000 { status = "okay"; }; + gpio@020ac000 { status = "okay"; }; + gpio@020b0000 { status = "okay"; }; + gpio@020b4000 { status = "okay"; }; console:serial@02020000 { status = "okay"; }; serial@021e8000 { status = "disabled"; }; serial@021ec000 { status = "disabled"; }; @@ -58,7 +61,7 @@ usbphy@020ca000 { status = "okay"; }; }; aips@02100000 { /* AIPS2 */ - ethernet@02188000 { + ethernet@02188000 { status = "okay"; phy-mode = "rgmii"; phy-disable-preamble; diff --git a/sys/boot/fdt/dts/arm/wandboard-quad.dts b/sys/boot/fdt/dts/arm/wandboard-quad.dts index 71c51560a51..56c1eb14812 100644 --- a/sys/boot/fdt/dts/arm/wandboard-quad.dts +++ b/sys/boot/fdt/dts/arm/wandboard-quad.dts @@ -44,11 +44,14 @@ SOC: soc@00000000 { aips@02000000 { /* AIPS1 */ -// iomux@73fa8000 { status = "disabled"; }; -// gpio@0209C000 { status = "disabled"; }; -// gpio@020A0000 { status = "disabled"; }; -// gpio@020A4000 { status = "disabled"; }; -// gpio@020A8000 { status = "disabled"; }; + iomux@020e0000 { status = "disabled"; }; + gpio@0209c000 { status = "okay"; }; + gpio@020a0000 { status = "okay"; }; + gpio@020a4000 { status = "okay"; }; + gpio@020a8000 { status = "okay"; }; + gpio@020ac000 { status = "okay"; }; + gpio@020b0000 { status = "okay"; }; + gpio@020b4000 { status = "okay"; }; console:serial@02020000 { status = "okay"; }; serial@021e8000 { status = "disabled"; }; serial@021ec000 { status = "disabled"; }; @@ -58,7 +61,7 @@ usbphy@020ca000 { status = "okay"; }; }; aips@02100000 { /* AIPS2 */ - ethernet@02188000 { + ethernet@02188000 { status = "okay"; phy-mode = "rgmii"; phy-disable-preamble; diff --git a/sys/boot/fdt/dts/arm/wandboard-solo.dts b/sys/boot/fdt/dts/arm/wandboard-solo.dts index 70e05e0a80f..3a7139b8f71 100644 --- a/sys/boot/fdt/dts/arm/wandboard-solo.dts +++ b/sys/boot/fdt/dts/arm/wandboard-solo.dts @@ -44,11 +44,14 @@ SOC: soc@00000000 { aips@02000000 { /* AIPS1 */ -// iomux@73fa8000 { status = "disabled"; }; -// gpio@0209C000 { status = "disabled"; }; -// gpio@020A0000 { status = "disabled"; }; -// gpio@020A4000 { status = "disabled"; }; -// gpio@020A8000 { status = "disabled"; }; + iomux@020e0000 { status = "disabled"; }; + gpio@0209c000 { status = "okay"; }; + gpio@020a0000 { status = "okay"; }; + gpio@020a4000 { status = "okay"; }; + gpio@020a8000 { status = "okay"; }; + gpio@020ac000 { status = "okay"; }; + gpio@020b0000 { status = "okay"; }; + gpio@020b4000 { status = "okay"; }; console:serial@02020000 { status = "okay"; }; serial@021e8000 { status = "disabled"; }; serial@021ec000 { status = "disabled"; }; @@ -58,7 +61,7 @@ usbphy@020ca000 { status = "okay"; }; }; aips@02100000 { /* AIPS2 */ - ethernet@02188000 { + ethernet@02188000 { status = "okay"; phy-mode = "rgmii"; phy-disable-preamble; diff --git a/sys/boot/fdt/dts/arm/zedboard.dts b/sys/boot/fdt/dts/arm/zedboard.dts index 2d9fccdeac2..7277308c876 100644 --- a/sys/boot/fdt/dts/arm/zedboard.dts +++ b/sys/boot/fdt/dts/arm/zedboard.dts @@ -63,6 +63,7 @@ slcr: slcr@7000 { compatible = "xlnx,zy7_slcr"; reg = <0x0 0x1000>; + clock-frequency = <33333333>; // 33Mhz PS_CLK }; // Interrupt controller @@ -175,6 +176,7 @@ reg = <0xb000 0x1000>; interrupts = <54 55>; interrupt-parent = <&GIC>; + ref-clock-num = <0>; }; // SDIO diff --git a/sys/boot/fdt/dts/mips/Makefile b/sys/boot/fdt/dts/mips/Makefile new file mode 100644 index 00000000000..03d156d9477 --- /dev/null +++ b/sys/boot/fdt/dts/mips/Makefile @@ -0,0 +1,7 @@ +# $FreeBSD$ + +DTS!=ls *.dts + +all: test-dts + +.include diff --git a/sys/boot/fdt/dts/mips/beri-netfpga.dts b/sys/boot/fdt/dts/mips/beri-netfpga.dts index c0fdf23a3e5..605392192d1 100644 --- a/sys/boot/fdt/dts/mips/beri-netfpga.dts +++ b/sys/boot/fdt/dts/mips/beri-netfpga.dts @@ -135,13 +135,14 @@ ethernet@7f005000 { compatible = "netfpag10g,nf10bmac"; - // TX, RX, LOOP - reg = <0x7f005010 0xc - 0x7f005020 0xc - 0x7f005030 0x4>; + // LOOP, TX, RX, INTR + reg = <0x7f005000 0x20 + 0x7f005020 0x30 + 0x7f005050 0x30 + 0x7f005100 0x10>; // RX - #interrupts = <1>; - #interrupt-parent = <&beripic>; + interrupts = <1>; + interrupt-parent = <&beripic>; }; }; diff --git a/sys/boot/fdt/dts/mips/beripad-de4.dts b/sys/boot/fdt/dts/mips/beripad-de4.dts index 4a13622b00a..e98f5e65945 100644 --- a/sys/boot/fdt/dts/mips/beripad-de4.dts +++ b/sys/boot/fdt/dts/mips/beripad-de4.dts @@ -222,7 +222,7 @@ }; usb@0x7f100000 { - compatible = "philips,isp1761"; + compatible = "nxp,usb-isp1761"; reg = <0x7f100000 0x40000 0x7f140000 0x4>; // IRQ 4 is DC, IRQ 5 is HC. @@ -253,14 +253,5 @@ sri-cambridge,fileio = "rw"; sri-cambridge,devname = "de4tempfan"; }; - - avgen@0x7f100000 { - compatible = "sri-cambridge,avgen"; - reg = <0x7f100000 0x40000>; - sri-cambridge,width = <4>; - sri-cambridge,fileio = "r"; - sri-cambridge,devname = "usbmem"; - }; - }; }; diff --git a/sys/boot/fdt/dts/powerpc/Makefile b/sys/boot/fdt/dts/powerpc/Makefile new file mode 100644 index 00000000000..03d156d9477 --- /dev/null +++ b/sys/boot/fdt/dts/powerpc/Makefile @@ -0,0 +1,7 @@ +# $FreeBSD$ + +DTS!=ls *.dts + +all: test-dts + +.include diff --git a/sys/boot/fdt/dts/arm/p2041rdb.dts b/sys/boot/fdt/dts/powerpc/p2041rdb.dts similarity index 100% rename from sys/boot/fdt/dts/arm/p2041rdb.dts rename to sys/boot/fdt/dts/powerpc/p2041rdb.dts diff --git a/sys/boot/fdt/dts/arm/p3041ds.dts b/sys/boot/fdt/dts/powerpc/p3041ds.dts similarity index 100% rename from sys/boot/fdt/dts/arm/p3041ds.dts rename to sys/boot/fdt/dts/powerpc/p3041ds.dts diff --git a/sys/boot/fdt/dts/arm/p5020ds.dts b/sys/boot/fdt/dts/powerpc/p5020ds.dts similarity index 100% rename from sys/boot/fdt/dts/arm/p5020ds.dts rename to sys/boot/fdt/dts/powerpc/p5020ds.dts diff --git a/sys/boot/fdt/fdt_loader_cmd.c b/sys/boot/fdt/fdt_loader_cmd.c index b54a6b45e4a..24c6382ce08 100644 --- a/sys/boot/fdt/fdt_loader_cmd.c +++ b/sys/boot/fdt/fdt_loader_cmd.c @@ -233,7 +233,7 @@ fdt_load_dtb_addr(struct fdt_header *header) { int err; - debugf("fdt_load_dtb_addr(0x%p)\n", header); + debugf("fdt_load_dtb_addr(%p)\n", header); fdtp_size = fdt_totalsize(header); err = fdt_check_header(header); @@ -321,7 +321,7 @@ fdt_setup_fdtp() if (*p == '\0') { if (fdt_load_dtb_addr(hdr) == 0) { printf("Using DTB provided by U-Boot at " - "address 0x%p.\n", hdr); + "address %p.\n", hdr); return (0); } } diff --git a/sys/boot/ficl/ia64/sysdep.c b/sys/boot/ficl/ia64/sysdep.c deleted file mode 100644 index 00b0d4acf0e..00000000000 --- a/sys/boot/ficl/ia64/sysdep.c +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************* -** s y s d e p . c -** Forth Inspired Command Language -** Author: John Sadler (john_sadler@alum.mit.edu) -** Created: 16 Oct 1997 -** Implementations of FICL external interface functions... -** -*******************************************************************/ - -/* $FreeBSD$ */ - -#ifdef TESTMAIN -#include -#include -#else -#include -#endif -#include "ficl.h" - -/* -******************* FreeBSD P O R T B E G I N S H E R E ******************** Michael Smith -*/ - -#if PORTABLE_LONGMULDIV == 0 -DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y) -{ - DPUNS q; - u_int64_t qx; - - qx = (u_int64_t)x * (u_int64_t) y; - - q.hi = (u_int32_t)( qx >> 32 ); - q.lo = (u_int32_t)( qx & 0xFFFFFFFFL); - - return q; -} - -UNSQR ficlLongDiv(DPUNS q, FICL_UNS y) -{ - UNSQR result; - u_int64_t qx, qh; - - qh = q.hi; - qx = (qh << 32) | q.lo; - - result.quot = qx / y; - result.rem = qx % y; - - return result; -} -#endif - -void ficlTextOut(FICL_VM *pVM, char *msg, int fNewline) -{ - IGNORE(pVM); - - while(*msg != 0) - putchar(*(msg++)); - if (fNewline) - putchar('\n'); - - return; -} - -void *ficlMalloc (size_t size) -{ - return malloc(size); -} - -void *ficlRealloc (void *p, size_t size) -{ - return realloc(p, size); -} - -void ficlFree (void *p) -{ - free(p); -} - - -/* -** Stub function for dictionary access control - does nothing -** by default, user can redefine to guarantee exclusive dict -** access to a single thread for updates. All dict update code -** is guaranteed to be bracketed as follows: -** ficlLockDictionary(TRUE); -** -** ficlLockDictionary(FALSE); -** -** Returns zero if successful, nonzero if unable to acquire lock -** befor timeout (optional - could also block forever) -*/ -#if FICL_MULTITHREAD -int ficlLockDictionary(short fLock) -{ - IGNORE(fLock); - return 0; -} -#endif /* FICL_MULTITHREAD */ - - diff --git a/sys/boot/ficl/ia64/sysdep.h b/sys/boot/ficl/ia64/sysdep.h deleted file mode 100644 index 08bc0e1f4d0..00000000000 --- a/sys/boot/ficl/ia64/sysdep.h +++ /dev/null @@ -1,434 +0,0 @@ -/******************************************************************* - s y s d e p . h -** Forth Inspired Command Language -** Author: John Sadler (john_sadler@alum.mit.edu) -** Created: 16 Oct 1997 -** Ficl system dependent types and prototypes... -** -** Note: Ficl also depends on the use of "assert" when -** FICL_ROBUST is enabled. This may require some consideration -** in firmware systems since assert often -** assumes stderr/stdout. -** $Id: sysdep.h,v 1.11 2001/12/05 07:21:34 jsadler Exp $ -*******************************************************************/ -/* -** Copyright (c) 1997-2001 John Sadler (john_sadler@alum.mit.edu) -** All rights reserved. -** -** Get the latest Ficl release at http://ficl.sourceforge.net -** -** I am interested in hearing from anyone who uses ficl. If you have -** a problem, a success story, a defect, an enhancement request, or -** if you would like to contribute to the ficl release, please -** contact me by email at the address above. -** -** L I C E N S E and D I S C L A I M E R -** -** 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. -** -** $Id: sysdep.h,v 1.6 2001-04-26 21:41:55-07 jsadler Exp jsadler $ -*/ - -/* $FreeBSD$ */ - -#if !defined (__SYSDEP_H__) -#define __SYSDEP_H__ - -#include - -#include /* size_t, NULL */ -#include -#include - -#if !defined IGNORE /* Macro to silence unused param warnings */ -#define IGNORE(x) &x -#endif - -/* -** TRUE and FALSE for C boolean operations, and -** portable 32 bit types for CELLs -** -*/ -#if !defined TRUE -#define TRUE 1 -#endif -#if !defined FALSE -#define FALSE 0 -#endif - -/* -** System dependent data type declarations... -*/ -#if !defined INT32 -#define INT32 int -#endif - -#if !defined UNS32 -#define UNS32 unsigned int -#endif - -#if !defined UNS16 -#define UNS16 unsigned short -#endif - -#if !defined UNS8 -#define UNS8 unsigned char -#endif - -#if !defined NULL -#define NULL ((void *)0) -#endif - -/* -** FICL_UNS and FICL_INT must have the same size as a void* on -** the target system. A CELL is a union of void*, FICL_UNS, and -** FICL_INT. -** (11/2000: same for FICL_FLOAT) -*/ -#if !defined FICL_INT -#define FICL_INT long -#endif - -#if !defined FICL_UNS -#define FICL_UNS unsigned long -#endif - -#if !defined FICL_FLOAT -#define FICL_FLOAT float -#endif - -/* -** Ficl presently supports values of 32 and 64 for BITS_PER_CELL -*/ -#if !defined BITS_PER_CELL -#define BITS_PER_CELL 64 -#endif - -#if ((BITS_PER_CELL != 32) && (BITS_PER_CELL != 64)) - Error! -#endif - -typedef struct -{ - FICL_UNS hi; - FICL_UNS lo; -} DPUNS; - -typedef struct -{ - FICL_UNS quot; - FICL_UNS rem; -} UNSQR; - -typedef struct -{ - FICL_INT hi; - FICL_INT lo; -} DPINT; - -typedef struct -{ - FICL_INT quot; - FICL_INT rem; -} INTQR; - - -/* -** B U I L D C O N T R O L S -*/ - -#if !defined (FICL_MINIMAL) -#define FICL_MINIMAL 0 -#endif -#if (FICL_MINIMAL) -#define FICL_WANT_SOFTWORDS 0 -#define FICL_WANT_FILE 0 -#define FICL_WANT_FLOAT 0 -#define FICL_WANT_USER 0 -#define FICL_WANT_LOCALS 0 -#define FICL_WANT_DEBUGGER 0 -#define FICL_WANT_OOP 0 -#define FICL_PLATFORM_EXTEND 0 -#define FICL_MULTITHREAD 0 -#define FICL_ROBUST 0 -#define FICL_EXTENDED_PREFIX 0 -#endif - -/* -** FICL_PLATFORM_EXTEND -** Includes words defined in ficlCompilePlatform -*/ -#if !defined (FICL_PLATFORM_EXTEND) -#define FICL_PLATFORM_EXTEND 1 -#endif - - -/* -** FICL_WANT_FILE -** Includes the FILE and FILE-EXT wordset and associated code. Turn this off if you do not -** have a filesystem! -** Contributed by Larry Hastings -*/ -#if !defined (FICL_WANT_FILE) -#define FICL_WANT_FILE 0 -#endif - -/* -** FICL_WANT_FLOAT -** Includes a floating point stack for the VM, and words to do float operations. -** Contributed by Guy Carver -*/ -#if !defined (FICL_WANT_FLOAT) -#define FICL_WANT_FLOAT 0 -#endif - -/* -** FICL_WANT_DEBUGGER -** Inludes a simple source level debugger -*/ -#if !defined (FICL_WANT_DEBUGGER) -#define FICL_WANT_DEBUGGER 1 -#endif - -/* -** FICL_EXTENDED_PREFIX enables a bunch of extra prefixes in prefix.c and prefix.fr (if -** included as part of softcore.c) -*/ -#if !defined FICL_EXTENDED_PREFIX -#define FICL_EXTENDED_PREFIX 0 -#endif - -/* -** User variables: per-instance variables bound to the VM. -** Kinda like thread-local storage. Could be implemented in a -** VM private dictionary, but I've chosen the lower overhead -** approach of an array of CELLs instead. -*/ -#if !defined FICL_WANT_USER -#define FICL_WANT_USER 1 -#endif - -#if !defined FICL_USER_CELLS -#define FICL_USER_CELLS 16 -#endif - -/* -** FICL_WANT_LOCALS controls the creation of the LOCALS wordset and -** a private dictionary for local variable compilation. -*/ -#if !defined FICL_WANT_LOCALS -#define FICL_WANT_LOCALS 1 -#endif - -/* Max number of local variables per definition */ -#if !defined FICL_MAX_LOCALS -#define FICL_MAX_LOCALS 16 -#endif - -/* -** FICL_WANT_OOP -** Inludes object oriented programming support (in softwords) -** OOP support requires locals and user variables! -*/ -#if !(FICL_WANT_LOCALS) || !(FICL_WANT_USER) -#if !defined (FICL_WANT_OOP) -#define FICL_WANT_OOP 0 -#endif -#endif - -#if !defined (FICL_WANT_OOP) -#define FICL_WANT_OOP 1 -#endif - -/* -** FICL_WANT_SOFTWORDS -** Controls inclusion of all softwords in softcore.c -*/ -#if !defined (FICL_WANT_SOFTWORDS) -#define FICL_WANT_SOFTWORDS 1 -#endif - -/* -** FICL_MULTITHREAD enables dictionary mutual exclusion -** wia the ficlLockDictionary system dependent function. -** Note: this implementation is experimental and poorly -** tested. Further, it's unnecessary unless you really -** intend to have multiple SESSIONS (poor choice of name -** on my part) - that is, threads that modify the dictionary -** at the same time. -*/ -#if !defined FICL_MULTITHREAD -#define FICL_MULTITHREAD 0 -#endif - -/* -** PORTABLE_LONGMULDIV causes ficlLongMul and ficlLongDiv to be -** defined in C in sysdep.c. Use this if you cannot easily -** generate an inline asm definition -*/ -#if !defined (PORTABLE_LONGMULDIV) -#define PORTABLE_LONGMULDIV 0 -#endif - -/* -** INLINE_INNER_LOOP causes the inner interpreter to be inline code -** instead of a function call. This is mainly because MS VC++ 5 -** chokes with an internal compiler error on the function version. -** in release mode. Sheesh. -*/ -#if !defined INLINE_INNER_LOOP -#if defined _DEBUG -#define INLINE_INNER_LOOP 0 -#else -#define INLINE_INNER_LOOP 1 -#endif -#endif - -/* -** FICL_ROBUST enables bounds checking of stacks and the dictionary. -** This will detect stack over and underflows and dictionary overflows. -** Any exceptional condition will result in an assertion failure. -** (As generated by the ANSI assert macro) -** FICL_ROBUST == 1 --> stack checking in the outer interpreter -** FICL_ROBUST == 2 also enables checking in many primitives -*/ - -#if !defined FICL_ROBUST -#define FICL_ROBUST 2 -#endif - -/* -** FICL_DEFAULT_STACK Specifies the default size (in CELLs) of -** a new virtual machine's stacks, unless overridden at -** create time. -*/ -#if !defined FICL_DEFAULT_STACK -#define FICL_DEFAULT_STACK 128 -#endif - -/* -** FICL_DEFAULT_DICT specifies the number of CELLs to allocate -** for the system dictionary by default. The value -** can be overridden at startup time as well. -** FICL_DEFAULT_ENV specifies the number of cells to allot -** for the environment-query dictionary. -*/ -#if !defined FICL_DEFAULT_DICT -#define FICL_DEFAULT_DICT 12288 -#endif - -#if !defined FICL_DEFAULT_ENV -#define FICL_DEFAULT_ENV 260 -#endif - -/* -** FICL_DEFAULT_VOCS specifies the maximum number of wordlists in -** the dictionary search order. See Forth DPANS sec 16.3.3 -** (file://dpans16.htm#16.3.3) -*/ -#if !defined FICL_DEFAULT_VOCS -#define FICL_DEFAULT_VOCS 16 -#endif - -/* -** FICL_MAX_PARSE_STEPS controls the size of an array in the FICL_SYSTEM structure -** that stores pointers to parser extension functions. I would never expect to have -** more than 8 of these, so that's the default limit. Too many of these functions -** will probably exact a nasty performance penalty. -*/ -#if !defined FICL_MAX_PARSE_STEPS -#define FICL_MAX_PARSE_STEPS 8 -#endif - -/* -** FICL_ALIGN is the power of two to which the dictionary -** pointer address must be aligned. This value is usually -** either 1 or 2, depending on the memory architecture -** of the target system; 2 is safe on any 16 or 32 bit -** machine. 3 would be appropriate for a 64 bit machine. -*/ -#if !defined FICL_ALIGN -#define FICL_ALIGN 3 -#define FICL_ALIGN_ADD ((1 << FICL_ALIGN) - 1) -#endif - -/* -** System dependent routines -- -** edit the implementations in sysdep.c to be compatible -** with your runtime environment... -** ficlTextOut sends a NULL terminated string to the -** default output device - used for system error messages -** ficlMalloc and ficlFree have the same semantics as malloc and free -** in standard C -** ficlLongMul multiplies two UNS32s and returns a 64 bit unsigned -** product -** ficlLongDiv divides an UNS64 by an UNS32 and returns UNS32 quotient -** and remainder -*/ -struct vm; -void ficlTextOut(struct vm *pVM, char *msg, int fNewline); -void *ficlMalloc (size_t size); -void ficlFree (void *p); -void *ficlRealloc(void *p, size_t size); -/* -** Stub function for dictionary access control - does nothing -** by default, user can redefine to guarantee exclusive dict -** access to a single thread for updates. All dict update code -** must be bracketed as follows: -** ficlLockDictionary(TRUE); -** -** ficlLockDictionary(FALSE); -** -** Returns zero if successful, nonzero if unable to acquire lock -** before timeout (optional - could also block forever) -** -** NOTE: this function must be implemented with lock counting -** semantics: nested calls must behave properly. -*/ -#if FICL_MULTITHREAD -int ficlLockDictionary(short fLock); -#else -#define ficlLockDictionary(x) 0 /* ignore */ -#endif - -/* -** 64 bit integer math support routines: multiply two UNS32s -** to get a 64 bit product, & divide the product by an UNS32 -** to get an UNS32 quotient and remainder. Much easier in asm -** on a 32 bit CPU than in C, which usually doesn't support -** the double length result (but it should). -*/ -DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y); -UNSQR ficlLongDiv(DPUNS q, FICL_UNS y); - - -/* -** FICL_HAVE_FTRUNCATE indicates whether the current OS supports -** the ftruncate() function (available on most UNIXes). This -** function is necessary to provide the complete File-Access wordset. -*/ -#if !defined (FICL_HAVE_FTRUNCATE) -#define FICL_HAVE_FTRUNCATE 0 -#endif - - -#endif /*__SYSDEP_H__*/ diff --git a/sys/boot/ficl/loader.c b/sys/boot/ficl/loader.c index f39b1eb660d..349a7c66d1c 100644 --- a/sys/boot/ficl/loader.c +++ b/sys/boot/ficl/loader.c @@ -800,15 +800,9 @@ void ficlCompilePlatform(FICL_SYSTEM *pSys) ficlSetEnv(pSys, "arch-pc98", FICL_TRUE); #elif defined(__i386__) ficlSetEnv(pSys, "arch-i386", FICL_TRUE); - ficlSetEnv(pSys, "arch-ia64", FICL_FALSE); - ficlSetEnv(pSys, "arch-powerpc", FICL_FALSE); -#elif defined(__ia64__) - ficlSetEnv(pSys, "arch-i386", FICL_FALSE); - ficlSetEnv(pSys, "arch-ia64", FICL_TRUE); ficlSetEnv(pSys, "arch-powerpc", FICL_FALSE); #elif defined(__powerpc__) ficlSetEnv(pSys, "arch-i386", FICL_FALSE); - ficlSetEnv(pSys, "arch-ia64", FICL_FALSE); ficlSetEnv(pSys, "arch-powerpc", FICL_TRUE); #endif diff --git a/sys/boot/forth/brand.4th b/sys/boot/forth/brand.4th index b6f22c8f436..28d3c5c1d26 100644 --- a/sys/boot/forth/brand.4th +++ b/sys/boot/forth/brand.4th @@ -56,6 +56,8 @@ variable brandY \ NAME DESCRIPTION \ fbsd FreeBSD logo \ +\ NOTE: Setting `loader_brand' to the value of an existing function +\ (such as "mycustom-brand") will cause that symbol to be executed. \ NOTE: Setting `loader_brand' to an undefined value (such as "none") will \ prevent any brand from being drawn. \ @@ -87,5 +89,14 @@ variable brandY 2drop exit then + \ if it refers to a raw symbol then run that function + sfind if + brandX @ brandY @ + 2 roll + execute + else + drop + then + 2drop ; diff --git a/sys/boot/forth/loader.conf b/sys/boot/forth/loader.conf index 3f31b7a8ebe..241b14aaf97 100644 --- a/sys/boot/forth/loader.conf +++ b/sys/boot/forth/loader.conf @@ -134,6 +134,7 @@ module_path="/boot/modules" # Set the module search path #vfs.root.mountfrom="" # Specify root partition in a way the # kernel understands #vm.kmem_size="" # Sets the size of kernel memory (bytes) +#debug.kdb.break_to_debugger="0" # Allow console to break into debugger. #debug.ktr.cpumask="0xf" # Bitmask of CPUs to enable KTR on #debug.ktr.mask="0x1200" # Bitmask of KTR events to enable #debug.ktr.verbose="1" # Enable console dump of KTR events diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile index fa8c29d33a8..e52060d0679 100644 --- a/sys/boot/i386/boot2/Makefile +++ b/sys/boot/i386/boot2/Makefile @@ -22,6 +22,8 @@ BOOT2_UFS?= UFS1_AND_UFS2 #BOOT2_UFS?= UFS2_ONLY #BOOT2_UFS?= UFS1_ONLY +NO_PIE= yes + CFLAGS= -Os \ -fomit-frame-pointer \ -mrtd \ diff --git a/sys/boot/i386/boot2/boot2.c b/sys/boot/i386/boot2/boot2.c index 6998026d618..cd384e56589 100644 --- a/sys/boot/i386/boot2/boot2.c +++ b/sys/boot/i386/boot2/boot2.c @@ -34,9 +34,22 @@ __FBSDID("$FreeBSD$"); #include "boot2.h" #include "lib.h" +/* Define to 0 to omit serial support */ +#ifndef SERIAL +#define SERIAL 1 +#endif + #define IO_KEYBOARD 1 #define IO_SERIAL 2 +#if SERIAL +#define DO_KBD (ioctrl & IO_KEYBOARD) +#define DO_SIO (ioctrl & IO_SERIAL) +#else +#define DO_KBD (1) +#define DO_SIO (0) +#endif + #define SECOND 18 /* Circa that many ticks in a second. */ #define RBX_ASKNAME 0x0 /* -a */ @@ -131,9 +144,11 @@ static struct dsk { static char cmd[512], cmddup[512], knamebuf[1024]; static const char *kname; static uint32_t opts; -static int comspeed = SIOSPD; static struct bootinfo bootinfo; +#if SERIAL +static int comspeed = SIOSPD; static uint8_t ioctrl = IO_KEYBOARD; +#endif void exit(int); static void load(void); @@ -276,7 +291,7 @@ main(void) "boot: ", dsk.drive & DRV_MASK, dev_nm[dsk.type], dsk.unit, 'a' + dsk.part, kname); - if (ioctrl & IO_SERIAL) + if (DO_SIO) sio_flush(); if (!autoboot || keyhit(3*SECOND)) getstr(); @@ -398,6 +413,7 @@ parse() } printf("Keyboard: %s\n", cp); continue; +#if SERIAL } else if (c == 'S') { j = 0; while ((unsigned int)(i = *arg++ - '0') <= 9) @@ -407,18 +423,21 @@ parse() break; } /* Fall through to error below ('S' not in optstr[]). */ +#endif } for (i = 0; c != optstr[i]; i++) if (i == NOPT - 1) return -1; opts ^= OPT_SET(flags[i]); } +#if SERIAL ioctrl = OPT_CHECK(RBX_DUAL) ? (IO_SERIAL|IO_KEYBOARD) : OPT_CHECK(RBX_SERIAL) ? IO_SERIAL : IO_KEYBOARD; - if (ioctrl & IO_SERIAL) { + if (DO_SIO) { if (sio_init(115200 / comspeed) != 0) ioctrl &= ~IO_SERIAL; } +#endif } else { for (q = arg--; *q && *q != '('; q++); if (*q) { @@ -626,9 +645,9 @@ keyhit(unsigned ticks) static int xputc(int c) { - if (ioctrl & IO_KEYBOARD) + if (DO_KBD) putc(c); - if (ioctrl & IO_SERIAL) + if (DO_SIO) sio_putc(c); return c; } @@ -648,9 +667,9 @@ xgetc(int fn) if (OPT_CHECK(RBX_NOINTR)) return 0; for (;;) { - if (ioctrl & IO_KEYBOARD && getc(1)) + if (DO_KBD && getc(1)) return fn ? 1 : getc(0); - if (ioctrl & IO_SERIAL && sio_ischar()) + if (DO_SIO && sio_ischar()) return fn ? 1 : sio_getc(); if (fn) return 0; diff --git a/sys/boot/i386/btx/btx/Makefile b/sys/boot/i386/btx/btx/Makefile index 0f5a468ba62..55756e0fa08 100644 --- a/sys/boot/i386/btx/btx/Makefile +++ b/sys/boot/i386/btx/btx/Makefile @@ -5,6 +5,8 @@ INTERNALPROG= MAN= SRCS= btx.S +NO_PIE= yes + .if defined(BOOT_BTX_NOHANG) BOOT_BTX_FLAGS=0x1 .else diff --git a/sys/boot/i386/btx/btxldr/Makefile b/sys/boot/i386/btx/btxldr/Makefile index 7e57ca3fc6a..68089346ded 100644 --- a/sys/boot/i386/btx/btxldr/Makefile +++ b/sys/boot/i386/btx/btxldr/Makefile @@ -5,6 +5,8 @@ INTERNALPROG= MAN= SRCS= btxldr.S +NO_PIE= yes + CFLAGS+=-DLOADER_ADDRESS=${LOADER_ADDRESS} CFLAGS+=-I${.CURDIR}/../../common diff --git a/sys/boot/i386/btx/lib/Makefile b/sys/boot/i386/btx/lib/Makefile index c66f0fcc516..caec3eb6821 100644 --- a/sys/boot/i386/btx/lib/Makefile +++ b/sys/boot/i386/btx/lib/Makefile @@ -7,4 +7,6 @@ SRCS= btxcsu.S btxsys.s btxv86.s CFLAGS+=-I${.CURDIR}/../../common LDFLAGS=-Wl,-r +NO_PIE= yes + .include diff --git a/sys/boot/i386/gptboot/gptboot.8 b/sys/boot/i386/gptboot/gptboot.8 index 9bc655a1b9a..a7afd81d908 100644 --- a/sys/boot/i386/gptboot/gptboot.8 +++ b/sys/boot/i386/gptboot/gptboot.8 @@ -241,5 +241,5 @@ gpart set -a bootonce -i 2 ada0 .Nm appeared in FreeBSD 7.1. .Sh AUTHORS -.An -This manual page written by Warren Block . +This manual page written by +.An Warren Block Aq wblock@FreeBSD.org . diff --git a/sys/boot/i386/libi386/Makefile b/sys/boot/i386/libi386/Makefile index e40f8b6bb1b..6b7e056d7d1 100644 --- a/sys/boot/i386/libi386/Makefile +++ b/sys/boot/i386/libi386/Makefile @@ -55,6 +55,9 @@ CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../common \ # the location of libstand CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ +# Suppress warning from clang for FreeBSD %b and %D formats +CFLAGS+= -fformat-extensions + .if ${MACHINE_CPUARCH} == "amd64" CLEANFILES+= machine machine: diff --git a/sys/boot/i386/libi386/amd64_tramp.S b/sys/boot/i386/libi386/amd64_tramp.S index ff12c661d94..fe0cf83c9d8 100644 --- a/sys/boot/i386/libi386/amd64_tramp.S +++ b/sys/boot/i386/libi386/amd64_tramp.S @@ -84,7 +84,7 @@ amd64_tramp: /* Turn on PAE */ movl %cr4, %eax - orl $(CR4_PAE | CR4_PSE), %eax + orl $CR4_PAE, %eax movl %eax, %cr4 /* Set %cr3 for PT4 */ diff --git a/sys/boot/i386/libi386/libi386.h b/sys/boot/i386/libi386/libi386.h index f7dc3790ca0..24d6f56b8d7 100644 --- a/sys/boot/i386/libi386/libi386.h +++ b/sys/boot/i386/libi386/libi386.h @@ -121,4 +121,5 @@ int bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip, vm_offset_t *modulep, vm_offset_t *kernend); int bi_load64(char *args, vm_offset_t *modulep, vm_offset_t *kernend); +char *pxe_default_rc(void); void pxe_enable(void *pxeinfo); diff --git a/sys/boot/i386/libi386/pxe.c b/sys/boot/i386/libi386/pxe.c index 49814ddf9db..1b255e9f5a2 100644 --- a/sys/boot/i386/libi386/pxe.c +++ b/sys/boot/i386/libi386/pxe.c @@ -301,10 +301,6 @@ pxe_open(struct open_file *f, ...) bcopy(&rootpath[i], &temp[0], strlen(&rootpath[i])+1); bcopy(&temp[0], &rootpath[0], strlen(&rootpath[i])+1); } - printf("pxe_open: server addr: %s\n", inet_ntoa(rootip)); - printf("pxe_open: server path: %s\n", rootpath); - printf("pxe_open: gateway ip: %s\n", inet_ntoa(gateip)); - setenv("boot.netif.ip", inet_ntoa(myip), 1); setenv("boot.netif.netmask", intoa(netmask), 1); setenv("boot.netif.gateway", inet_ntoa(gateip), 1); @@ -312,9 +308,24 @@ pxe_open(struct open_file *f, ...) sprintf(temp, "%6D", bootplayer.CAddr, ":"); setenv("boot.netif.hwaddr", temp, 1); } +#ifdef LOADER_NFS_SUPPORT + printf("pxe_open: server addr: %s\n", inet_ntoa(rootip)); + printf("pxe_open: server path: %s\n", rootpath); + printf("pxe_open: gateway ip: %s\n", inet_ntoa(gateip)); + setenv("boot.nfsroot.server", inet_ntoa(rootip), 1); setenv("boot.nfsroot.path", rootpath, 1); +#else + setenv("boot.netif.server", inet_ntoa(rootip), 1); +#endif setenv("dhcp.host-name", hostname, 1); + + sprintf(temp, "%08X", ntohl(myip.s_addr)); + setenv("pxeboot.ip", temp, 1); + if (bootplayer.Hardware == ETHER_TYPE) { + sprintf(temp, "%6D", bootplayer.CAddr, "-"); + setenv("pxeboot.hwaddr", temp, 1); + } } } pxe_opens++; @@ -694,3 +705,26 @@ readudp(struct iodesc *h, void *pkt, size_t len, time_t timeout) uh->uh_sport = udpread_p->s_port; return udpread_p->buffer_size; } + +char * +pxe_default_rc(void) +{ + char *rc; + size_t count, rcsz; + + /* XXX It may not be a good idea to modify the PXE boot file. */ + rc = (char *)bootplayer.bootfile; + rcsz = sizeof(bootplayer.bootfile); + + /* Ignore how we define rc and rcsz above -- it can change. */ + if (rcsz < 6) + return (NULL); + if (*rc == '\0') { + strncpy(rc, "pxeboot", rcsz); + rc[rcsz - 1] = '\0'; + } + count = strlen(rc); + strncat(rc, ".4th", rcsz - count - 1); + printf("PXE: loading Forth from %s\n", rc); + return (rc); +} diff --git a/sys/boot/i386/loader/Makefile b/sys/boot/i386/loader/Makefile index b33101283b4..f6913140786 100644 --- a/sys/boot/i386/loader/Makefile +++ b/sys/boot/i386/loader/Makefile @@ -8,6 +8,8 @@ PROG= ${LOADER}.sym INTERNALPROG= NEWVERSWHAT?= "bootstrap loader" x86 +NO_PIE= yes + # architecture-specific loader code SRCS= main.c conf.c vers.c @@ -132,6 +134,6 @@ LDADD= ${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBSTAND} beforedepend ${OBJS}: machine CLEANFILES+= machine CFLAGS+= -DLOADER_PREFER_AMD64 -machine: +machine: .NOPATH ln -sf ${.CURDIR}/../../../i386/include machine .endif diff --git a/sys/boot/i386/loader/main.c b/sys/boot/i386/loader/main.c index 84ae7131bbb..13f93350127 100644 --- a/sys/boot/i386/loader/main.c +++ b/sys/boot/i386/loader/main.c @@ -192,7 +192,12 @@ main(void) bios_getsmap(); - interact(); /* doesn't return */ +#ifdef LOADER_TFTP_SUPPORT + if (kargs->bootflags & KARGS_FLAGS_PXE) + interact(pxe_default_rc()); + else +#endif + interact(NULL); /* if we ever get here, it is an error */ return (1); diff --git a/sys/boot/ia64/Makefile b/sys/boot/ia64/Makefile deleted file mode 100644 index 5f24fb2dc67..00000000000 --- a/sys/boot/ia64/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD$ - -SUBDIR= common efi - -# In the ski sub-directory, one can build a loader for use under Ski. -# Ski is an Itanium simulator, originally developed by HP. It's not -# supported anymore in FreeBSD, but left for reference and education. -# SUBDIR += ski - -.include diff --git a/sys/boot/ia64/Makefile.inc b/sys/boot/ia64/Makefile.inc deleted file mode 100644 index e63fb546473..00000000000 --- a/sys/boot/ia64/Makefile.inc +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD$ - -BINDIR?= /boot - -# Options used when building standalone components -CFLAGS+= -ffreestanding -fshort-wchar -Wformat -LDFLAGS+= -nostdlib - -.include "../Makefile.inc" diff --git a/sys/boot/ia64/common/Makefile b/sys/boot/ia64/common/Makefile deleted file mode 100644 index ef2737f4cd2..00000000000 --- a/sys/boot/ia64/common/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -# $FreeBSD$ - -.include -MK_SSP= no - -LIB= ia64 -INTERNALLIB= - -SRCS= autoload.c bootinfo.c copy.c devicename.c exec.c icache.c - -CFLAGS+= -I${.CURDIR}/../../efi/include -CFLAGS+= -I${.CURDIR}/../../efi/include/${MACHINE_CPUARCH} -CFLAGS+= -I${.CURDIR}/../../.. -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand - -.if ${MK_FORTH} != "no" -BOOT_FORTH= yes -CFLAGS+= -DBOOT_FORTH -CFLAGS+= -I${.CURDIR}/../../ficl -CFLAGS+= -I${.CURDIR}/../../ficl/${MACHINE_CPUARCH} -.endif - -.PATH: ${.CURDIR}/../../common -.include "${.CURDIR}/../../common/Makefile.inc" - -CFLAGS+= -I${.CURDIR}/../../common - -FILES+= loader.help -CLEANFILES+= loader.help -loader.help: help.common - cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk \ - > ${.TARGET} - -.PATH: ${.CURDIR}/../../forth -FILES+= loader.4th support.4th loader.conf -FILES+= screen.4th frames.4th -FILES+= beastie.4th brand.4th check-password.4th color.4th delay.4th -FILES+= menu.4th menu-commands.4th menusets.4th shortcuts.4th version.4th -.if !exists(${DESTDIR}/boot/loader.rc) -FILES+= loader.rc -.endif -.if !exists(${DESTDIR}/boot/menu.rc) -FILES+= menu.rc -.endif -FILESDIR_loader.conf= /boot/defaults - -.include diff --git a/sys/boot/ia64/common/bootinfo.c b/sys/boot/ia64/common/bootinfo.c deleted file mode 100644 index 04e8ba25c32..00000000000 --- a/sys/boot/ia64/common/bootinfo.c +++ /dev/null @@ -1,296 +0,0 @@ -/*- - * Copyright (c) 1998 Michael Smith - * Copyright (c) 2006 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 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 "libia64.h" - -static const char howto_switches[] = "aCdrgDmphsv"; -static int howto_masks[] = { - RB_ASKNAME, RB_CDROM, RB_KDB, RB_DFLTROOT, RB_GDB, RB_MULTIPLE, - RB_MUTE, RB_PAUSE, RB_SERIAL, RB_SINGLE, RB_VERBOSE -}; - -int -bi_getboothowto(char *kargs) -{ - const char *sw; - char *opts; - int howto, i; - - howto = 0; - - /* Get the boot options from the environment first. */ - for (i = 0; howto_names[i].ev != NULL; i++) { - if (getenv(howto_names[i].ev) != NULL) - howto |= howto_names[i].mask; - } - - /* Parse kargs */ - if (kargs == NULL) - return (howto); - - opts = strchr(kargs, '-'); - while (opts != NULL) { - while (*(++opts) != '\0') { - sw = strchr(howto_switches, *opts); - if (sw == NULL) - break; - howto |= howto_masks[sw - howto_switches]; - } - opts = strchr(opts, '-'); - } - - return (howto); -} - -/* - * Copy the environment into the load area starting at (addr). - * Each variable is formatted as =, with a single nul - * separating each variable, and a double nul terminating the environment. - */ -vm_offset_t -bi_copyenv(vm_offset_t start) -{ - struct env_var *ep; - vm_offset_t addr, last; - size_t len; - - addr = last = start; - - /* Traverse the environment. */ - for (ep = environ; ep != NULL; ep = ep->ev_next) { - len = strlen(ep->ev_name); - if (ia64_copyin(ep->ev_name, addr, len) != len) - break; - addr += len; - if (ia64_copyin("=", addr, 1) != 1) - break; - addr++; - if (ep->ev_value != NULL) { - len = strlen(ep->ev_value); - if (ia64_copyin(ep->ev_value, addr, len) != len) - break; - addr += len; - } - if (ia64_copyin("", addr, 1) != 1) - break; - last = ++addr; - } - - if (ia64_copyin("", last++, 1) != 1) - last = start; - return(last); -} - -/* - * Copy module-related data into the load area, where it can be - * used as a directory for loaded modules. - * - * Module data is presented in a self-describing format. Each datum - * is preceded by a 32-bit identifier and a 32-bit size field. - * - * Currently, the following data are saved: - * - * MOD_NAME (variable) module name (string) - * MOD_TYPE (variable) module type (string) - * MOD_ARGS (variable) module parameters (string) - * MOD_ADDR sizeof(vm_offset_t) module load address - * MOD_SIZE sizeof(size_t) module size - * MOD_METADATA (variable) type-specific metadata - */ -#define COPY32(v, a) { \ - u_int32_t x = (v); \ - ia64_copyin(&x, a, sizeof(x)); \ - a += sizeof(x); \ -} - -#define MOD_STR(t, a, s) { \ - COPY32(t, a); \ - COPY32(strlen(s) + 1, a); \ - ia64_copyin(s, a, strlen(s) + 1); \ - a += roundup(strlen(s) + 1, sizeof(u_int64_t));\ -} - -#define MOD_NAME(a, s) MOD_STR(MODINFO_NAME, a, s) -#define MOD_TYPE(a, s) MOD_STR(MODINFO_TYPE, a, s) -#define MOD_ARGS(a, s) MOD_STR(MODINFO_ARGS, a, s) - -#define MOD_VAR(t, a, s) { \ - COPY32(t, a); \ - COPY32(sizeof(s), a); \ - ia64_copyin(&s, a, sizeof(s)); \ - a += roundup(sizeof(s), sizeof(u_int64_t)); \ -} - -#define MOD_ADDR(a, s) MOD_VAR(MODINFO_ADDR, a, s) -#define MOD_SIZE(a, s) MOD_VAR(MODINFO_SIZE, a, s) - -#define MOD_METADATA(a, mm) { \ - COPY32(MODINFO_METADATA | mm->md_type, a); \ - COPY32(mm->md_size, a); \ - ia64_copyin(mm->md_data, a, mm->md_size); \ - a += roundup(mm->md_size, sizeof(u_int64_t));\ -} - -#define MOD_END(a) { \ - COPY32(MODINFO_END, a); \ - COPY32(0, a); \ -} - -vm_offset_t -bi_copymodules(vm_offset_t addr) -{ - struct preloaded_file *fp; - struct file_metadata *md; - - /* Start with the first module on the list, should be the kernel. */ - for (fp = file_findfile(NULL, NULL); fp != NULL; fp = fp->f_next) { - /* The name field must come first. */ - MOD_NAME(addr, fp->f_name); - MOD_TYPE(addr, fp->f_type); - if (fp->f_args) - MOD_ARGS(addr, fp->f_args); - MOD_ADDR(addr, fp->f_addr); - MOD_SIZE(addr, fp->f_size); - for (md = fp->f_metadata; md != NULL; md = md->md_next) { - if (!(md->md_type & MODINFOMD_NOCOPY)) - MOD_METADATA(addr, md); - } - } - MOD_END(addr); - return(addr); -} - -/* - * Load the information expected by the kernel. - * - * - The kernel environment is copied into kernel space. - * - Module metadata are formatted and placed in kernel space. - */ -int -ia64_bootinfo(struct preloaded_file *fp, struct bootinfo **res) -{ - struct bootinfo bi; - struct preloaded_file *xp; - struct file_metadata *md; - struct devdesc *rootdev; - char *rootdevname; - vm_offset_t addr, ssym, esym; - int error; - - *res = NULL; - bzero(&bi, sizeof(struct bootinfo)); - bi.bi_magic = BOOTINFO_MAGIC; - bi.bi_version = 1; - bi.bi_boothowto = bi_getboothowto(fp->f_args); - - /* - * Allow the environment variable 'rootdev' to override the supplied - * device. This should perhaps go to MI code and/or have $rootdev - * tested/set by MI code before launching the kernel. - */ - rootdevname = getenv("rootdev"); - ia64_getdev((void**)&rootdev, rootdevname, NULL); - if (rootdev != NULL) { - /* Try reading /etc/fstab to select the root device. */ - getrootmount(ia64_fmtdev(rootdev)); - free(rootdev); - } - - md = file_findmetadata(fp, MODINFOMD_SSYM); - ssym = (md != NULL) ? *((vm_offset_t *)&(md->md_data)) : 0; - md = file_findmetadata(fp, MODINFOMD_ESYM); - esym = (md != NULL) ? *((vm_offset_t *)&(md->md_data)) : 0; - if (ssym != 0 && esym != 0) { - bi.bi_symtab = ssym; - bi.bi_esymtab = esym; - } - - /* Find the last module in the chain. */ - addr = 0; - for (xp = file_findfile(NULL, NULL); xp != NULL; xp = xp->f_next) { - if (addr < (xp->f_addr + xp->f_size)) - addr = xp->f_addr + xp->f_size; - } - - addr = (addr + 15) & ~15; - - /* Copy module list and metadata. */ - bi.bi_modulep = addr; - addr = bi_copymodules(addr); - if (addr <= bi.bi_modulep) { - addr = bi.bi_modulep; - bi.bi_modulep = 0; - } - - addr = (addr + 15) & ~15; - - /* Copy our environment. */ - bi.bi_envp = addr; - addr = bi_copyenv(addr); - if (addr <= bi.bi_envp) { - addr = bi.bi_envp; - bi.bi_envp = 0; - } - - addr = (addr + 15) & ~15; - bi.bi_kernend = addr; - - error = ia64_platform_bootinfo(&bi, res); - if (error) - return (error); - - if (IS_LEGACY_KERNEL()) { - if (*res == NULL) - return (EDOOFUS); - - bcopy(&bi, *res, sizeof(bi)); - return (0); - } - - bi.bi_pbvm_pgtbl = (uintptr_t)ia64_pgtbl; - bi.bi_pbvm_pgtblsz = ia64_pgtblsz; - ia64_copyin((void *)bi.bi_memmap, addr, bi.bi_memmap_size); - bi.bi_memmap = addr; - addr = (addr + bi.bi_memmap_size + 15) & ~15; - bi.bi_kernend = addr + sizeof(bi); - ia64_copyin(&bi, addr, sizeof(bi)); - *res = (void *)addr; - return (0); -} diff --git a/sys/boot/ia64/common/copy.c b/sys/boot/ia64/common/copy.c deleted file mode 100644 index b14386ebf4f..00000000000 --- a/sys/boot/ia64/common/copy.c +++ /dev/null @@ -1,217 +0,0 @@ -/*- - * Copyright (c) 2006 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 -#include -#include - -#include "libia64.h" - -u_int ia64_legacy_kernel; - -uint64_t *ia64_pgtbl; -uint32_t ia64_pgtblsz; - -static int -pgtbl_extend(u_int idx) -{ - vm_paddr_t pa; - uint64_t *pgtbl; - uint32_t pgtblsz; - u_int pot; - - pgtblsz = (idx + 1) << 3; - - /* The minimum size is 4KB. */ - if (pgtblsz < 4096) - pgtblsz = 4096; - - /* Find the next higher power of 2. */ - pgtblsz--; - for (pot = 1; pot < 32; pot <<= 1) - pgtblsz = pgtblsz | (pgtblsz >> pot); - pgtblsz++; - - /* The maximum size is 1MB. */ - if (pgtblsz > 1048576) - return (ENOMEM); - - /* Make sure the size is a valid (mappable) page size. */ - if (pgtblsz == 32*1024 || pgtblsz == 128*1024 || pgtblsz == 512*1024) - pgtblsz <<= 1; - - /* Allocate naturally aligned memory. */ - pa = ia64_platform_alloc(0, pgtblsz); - if (pa == ~0UL) - return (ENOMEM); - pgtbl = (void *)pa; - - /* Initialize new page table. */ - if (ia64_pgtbl != NULL && ia64_pgtbl != pgtbl) - bcopy(ia64_pgtbl, pgtbl, ia64_pgtblsz); - bzero(pgtbl + (ia64_pgtblsz >> 3), pgtblsz - ia64_pgtblsz); - - if (ia64_pgtbl != NULL && ia64_pgtbl != pgtbl) - ia64_platform_free(0, (uintptr_t)ia64_pgtbl, ia64_pgtblsz); - - ia64_pgtbl = pgtbl; - ia64_pgtblsz = pgtblsz; - return (0); -} - -void * -ia64_va2pa(vm_offset_t va, size_t *len) -{ - uint64_t pa, pte; - u_int idx, ofs; - int error; - - /* Backward compatibility. */ - if (va >= IA64_RR_BASE(7)) { - ia64_legacy_kernel = 1; - pa = IA64_RR_MASK(va); - return ((void *)pa); - } - - if (va < IA64_PBVM_BASE) { - error = EINVAL; - goto fail; - } - - ia64_legacy_kernel = 0; - - idx = (va - IA64_PBVM_BASE) >> IA64_PBVM_PAGE_SHIFT; - if (idx >= (ia64_pgtblsz >> 3)) { - error = pgtbl_extend(idx); - if (error) - goto fail; - } - - ofs = va & IA64_PBVM_PAGE_MASK; - pte = ia64_pgtbl[idx]; - if ((pte & PTE_PRESENT) == 0) { - pa = ia64_platform_alloc(va - ofs, IA64_PBVM_PAGE_SIZE); - if (pa == ~0UL) { - error = ENOMEM; - goto fail; - } - pte = PTE_AR_RWX | PTE_DIRTY | PTE_ACCESSED | PTE_PRESENT; - pte |= (pa & PTE_PPN_MASK); - ia64_pgtbl[idx] = pte; - } - pa = (pte & PTE_PPN_MASK) + ofs; - - /* We can not cross page boundaries (in general). */ - if (*len + ofs > IA64_PBVM_PAGE_SIZE) - *len = IA64_PBVM_PAGE_SIZE - ofs; - - return ((void *)pa); - - fail: - *len = 0; - return (NULL); -} - -ssize_t -ia64_copyin(const void *src, vm_offset_t va, size_t len) -{ - void *pa; - ssize_t res; - size_t sz; - - res = 0; - while (len > 0) { - sz = len; - pa = ia64_va2pa(va, &sz); - if (sz == 0) - break; - bcopy(src, pa, sz); - len -= sz; - res += sz; - va += sz; - } - return (res); -} - -ssize_t -ia64_copyout(vm_offset_t va, void *dst, size_t len) -{ - void *pa; - ssize_t res; - size_t sz; - - res = 0; - while (len > 0) { - sz = len; - pa = ia64_va2pa(va, &sz); - if (sz == 0) - break; - bcopy(pa, dst, sz); - len -= sz; - res += sz; - va += sz; - } - return (res); -} - -uint64_t -ia64_loadaddr(u_int type, void *data, uint64_t addr) -{ - uint64_t align; - - /* - * Align ELF objects at PBVM page boundaries. Align all other - * objects at cache line boundaries for good measure. - */ - align = (type == LOAD_ELF) ? IA64_PBVM_PAGE_SIZE : CACHE_LINE_SIZE; - return ((addr + align - 1) & ~(align - 1)); -} - -ssize_t -ia64_readin(int fd, vm_offset_t va, size_t len) -{ - void *pa; - ssize_t res, s; - size_t sz; - - res = 0; - while (len > 0) { - sz = len; - pa = ia64_va2pa(va, &sz); - if (sz == 0) - break; - s = read(fd, pa, sz); - if (s <= 0) - break; - len -= s; - res += s; - va += s; - } - return (res); -} diff --git a/sys/boot/ia64/common/devicename.c b/sys/boot/ia64/common/devicename.c deleted file mode 100644 index 08d9b54c531..00000000000 --- a/sys/boot/ia64/common/devicename.c +++ /dev/null @@ -1,169 +0,0 @@ -/*- - * Copyright (c) 1998 Michael Smith - * Copyright (c) 2006 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 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 "bootstrap.h" - -#include -#include - -static int ia64_parsedev(struct devdesc **, const char *, const char **); - -/* - * Point (dev) at an allocated device specifier for the device matching the - * path in (devspec). If it contains an explicit device specification, - * use that. If not, use the default device. - */ -int -ia64_getdev(void **vdev, const char *devspec, const char **path) -{ - struct devdesc **dev = (struct devdesc **)vdev; - int rv; - - /* - * If it looks like this is just a path and no device, then - * use the current device instead. - */ - if (devspec == NULL || *devspec == '/' || !strchr(devspec, ':')) { - rv = ia64_parsedev(dev, getenv("currdev"), NULL); - if (rv == 0 && path != NULL) - *path = devspec; - return (rv); - } - - /* Parse the device name off the beginning of the devspec. */ - return (ia64_parsedev(dev, devspec, path)); -} - -/* - * Point (dev) at an allocated device specifier matching the string version - * at the beginning of (devspec). Return a pointer to the remaining - * text in (path). - * - * In all cases, the beginning of (devspec) is compared to the names - * of known devices in the device switch, and then any following text - * is parsed according to the rules applied to the device type. - * - * For disk-type devices, the syntax is: - * - * fs: - */ -static int -ia64_parsedev(struct devdesc **dev, const char *devspec, const char **path) -{ - struct devdesc *idev; - struct devsw *dv; - char *cp; - const char *np; - int i, err; - - /* minimum length check */ - if (strlen(devspec) < 2) - return (EINVAL); - - /* look for a device that matches */ - for (i = 0; devsw[i] != NULL; i++) { - dv = devsw[i]; - if (!strncmp(devspec, dv->dv_name, strlen(dv->dv_name))) - break; - } - if (devsw[i] == NULL) - return (ENOENT); - - idev = malloc(sizeof(struct devdesc)); - if (idev == NULL) - return (ENOMEM); - - idev->d_dev = dv; - idev->d_type = dv->dv_type; - idev->d_unit = -1; - - err = 0; - np = devspec + strlen(dv->dv_name); - if (*np != '\0' && *np != ':') { - idev->d_unit = strtol(np, &cp, 0); - if (cp == np) { - idev->d_unit = -1; - free(idev); - return (EUNIT); - } - } - if (*cp != '\0' && *cp != ':') { - free(idev); - return (EINVAL); - } - - if (path != NULL) - *path = (*cp == 0) ? cp : cp + 1; - if (dev != NULL) - *dev = idev; - else - free(idev); - return (0); -} - -char * -ia64_fmtdev(void *vdev) -{ - struct devdesc *dev = (struct devdesc *)vdev; - static char buf[32]; /* XXX device length constant? */ - - switch(dev->d_type) { - case DEVT_NONE: - strcpy(buf, "(no device)"); - break; - - default: - sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit); - break; - } - - return(buf); -} - -/* - * Set currdev to suit the value being supplied in (value) - */ -int -ia64_setcurrdev(struct env_var *ev, int flags, const void *value) -{ - struct devdesc *ncurr; - int rv; - - rv = ia64_parsedev(&ncurr, value, NULL); - if (rv != 0) - return(rv); - - free(ncurr); - env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); - return (0); -} diff --git a/sys/boot/ia64/common/exec.c b/sys/boot/ia64/common/exec.c deleted file mode 100644 index b721f97b43a..00000000000 --- a/sys/boot/ia64/common/exec.c +++ /dev/null @@ -1,268 +0,0 @@ -/*- - * Copyright (c) 2006 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 -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include "libia64.h" - -static u_int itr_idx = 0; -static u_int dtr_idx = 0; - -static vm_offset_t ia64_text_start; -static size_t ia64_text_size; - -static vm_offset_t ia64_data_start; -static size_t ia64_data_size; - -static int elf64_exec(struct preloaded_file *amp); -static int elf64_obj_exec(struct preloaded_file *amp); - -static struct file_format ia64_elf = { - elf64_loadfile, - elf64_exec -}; -static struct file_format ia64_elf_obj = { - elf64_obj_loadfile, - elf64_obj_exec -}; - -struct file_format *file_formats[] = { - &ia64_elf, - &ia64_elf_obj, - NULL -}; - -static u_int -sz2shft(vm_offset_t ofs, vm_size_t sz) -{ - vm_size_t s; - u_int shft; - - shft = 12; /* Start with 4K */ - s = 1 << shft; - while (s <= sz) { - shft++; - s <<= 1; - } - do { - shft--; - s >>= 1; - } while (ofs & (s - 1)); - - return (shft); -} - -/* - * Entered with psr.ic and psr.i both zero. - */ -static void -enter_kernel(uint64_t start, struct bootinfo *bi) -{ - - __asm __volatile("srlz.i;;"); - __asm __volatile("mov cr.ipsr=%0" - :: "r"(IA64_PSR_IC - | IA64_PSR_DT - | IA64_PSR_RT - | IA64_PSR_IT - | IA64_PSR_BN)); - __asm __volatile("mov cr.iip=%0" :: "r"(start)); - __asm __volatile("mov cr.ifs=r0;;"); - __asm __volatile("mov ar.rsc=0;; flushrs;;"); - __asm __volatile("mov r8=%0" :: "r" (bi)); - __asm __volatile("rfi;;"); - - /* NOTREACHED */ -} - -static u_int -mmu_wire(vm_offset_t va, vm_paddr_t pa, u_int pgshft, u_int acc) -{ - pt_entry_t pte; - - /* Round up to the smallest possible page size. */ - if (pgshft < 12) - pgshft = 12; - /* Truncate to the largest possible page size (256MB). */ - if (pgshft > 28) - pgshft = 28; - /* Round down to a valid (mappable) page size. */ - if (pgshft > 14 && (pgshft & 1) != 0) - pgshft--; - - pte = PTE_PRESENT | PTE_MA_WB | PTE_ACCESSED | PTE_DIRTY | - PTE_PL_KERN | (acc & PTE_AR_MASK) | (pa & PTE_PPN_MASK); - - __asm __volatile("mov cr.ifa=%0" :: "r"(va)); - __asm __volatile("mov cr.itir=%0" :: "r"(pgshft << 2)); - __asm __volatile("srlz.d;;"); - - __asm __volatile("ptr.d %0,%1" :: "r"(va), "r"(pgshft << 2)); - __asm __volatile("srlz.d;;"); - __asm __volatile("itr.d dtr[%0]=%1" :: "r"(dtr_idx), "r"(pte)); - __asm __volatile("srlz.d;;"); - dtr_idx++; - - if (acc == PTE_AR_RWX || acc == PTE_AR_RX) { - __asm __volatile("ptr.i %0,%1;;" :: "r"(va), "r"(pgshft << 2)); - __asm __volatile("srlz.i;;"); - __asm __volatile("itr.i itr[%0]=%1;;" :: "r"(itr_idx), "r"(pte)); - __asm __volatile("srlz.i;;"); - itr_idx++; - } - - return (pgshft); -} - -static void -mmu_setup_legacy(uint64_t entry) -{ - - /* - * Region 6 is direct mapped UC and region 7 is direct mapped - * WC. The details of this is controlled by the Alt {I,D}TLB - * handlers. Here we just make sure that they have the largest - * possible page size to minimise TLB usage. - */ - ia64_set_rr(IA64_RR_BASE(6), (6 << 8) | (28 << 2)); - ia64_set_rr(IA64_RR_BASE(7), (7 << 8) | (28 << 2)); - __asm __volatile("srlz.i;;"); - - mmu_wire(entry, IA64_RR_MASK(entry), 28, PTE_AR_RWX); -} - -static void -mmu_setup_paged(struct bootinfo *bi) -{ - void *pa; - size_t sz; - u_int shft; - - ia64_set_rr(IA64_RR_BASE(IA64_PBVM_RR), - (IA64_PBVM_RR << 8) | (IA64_PBVM_PAGE_SHIFT << 2)); - __asm __volatile("srlz.i;;"); - - /* Wire the PBVM page table. */ - mmu_wire(IA64_PBVM_PGTBL, (uintptr_t)ia64_pgtbl, - sz2shft(IA64_PBVM_PGTBL, ia64_pgtblsz), PTE_AR_RW); - - /* Wire as much of the text segment as we can. */ - sz = ia64_text_size; /* XXX */ - pa = ia64_va2pa(ia64_text_start, &ia64_text_size); - ia64_text_size = sz; /* XXX */ - shft = sz2shft(ia64_text_start, ia64_text_size); - shft = mmu_wire(ia64_text_start, (uintptr_t)pa, shft, PTE_AR_RWX); - ia64_copyin(&shft, (uintptr_t)&bi->bi_text_mapped, 4); - - /* Wire as much of the data segment as well. */ - sz = ia64_data_size; /* XXX */ - pa = ia64_va2pa(ia64_data_start, &ia64_data_size); - ia64_data_size = sz; /* XXX */ - shft = sz2shft(ia64_data_start, ia64_data_size); - shft = mmu_wire(ia64_data_start, (uintptr_t)pa, shft, PTE_AR_RW); - ia64_copyin(&shft, (uintptr_t)&bi->bi_data_mapped, 4); - - /* Update the bootinfo with the number of TRs used. */ - ia64_copyin(&itr_idx, (uintptr_t)&bi->bi_itr_used, 4); - ia64_copyin(&dtr_idx, (uintptr_t)&bi->bi_dtr_used, 4); -} - -static int -elf64_exec(struct preloaded_file *fp) -{ - struct bootinfo *bi; - struct file_metadata *md; - Elf_Ehdr *hdr; - int error; - - md = file_findmetadata(fp, MODINFOMD_ELFHDR); - if (md == NULL) - return (EINVAL); - - error = ia64_bootinfo(fp, &bi); - if (error) - return (error); - - hdr = (Elf_Ehdr *)&(md->md_data); - printf("Entering %s at 0x%lx...\n", fp->f_name, hdr->e_entry); - - error = ia64_platform_enter(fp->f_name); - if (error) - return (error); - - __asm __volatile("rsm psr.ic|psr.i;;"); - __asm __volatile("srlz.i;;"); - - if (IS_LEGACY_KERNEL()) - mmu_setup_legacy(hdr->e_entry); - else - mmu_setup_paged(bi); - - enter_kernel(hdr->e_entry, bi); - /* NOTREACHED */ - return (EDOOFUS); -} - -static int -elf64_obj_exec(struct preloaded_file *fp) -{ - - printf("%s called for preloaded file %p (=%s):\n", __func__, fp, - fp->f_name); - return (ENOSYS); -} - -void -ia64_loadseg(Elf_Ehdr *eh, Elf_Phdr *ph, uint64_t delta) -{ - - if (eh->e_type != ET_EXEC) - return; - - if (ph->p_flags & PF_X) { - ia64_text_start = ph->p_vaddr + delta; - ia64_text_size = ph->p_memsz; - - ia64_sync_icache(ia64_text_start, ia64_text_size); - } else { - ia64_data_start = ph->p_vaddr + delta; - ia64_data_size = ph->p_memsz; - } -} - diff --git a/sys/boot/ia64/common/icache.c b/sys/boot/ia64/common/icache.c deleted file mode 100644 index 77a35d705b7..00000000000 --- a/sys/boot/ia64/common/icache.c +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * Copyright (c) 2011 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 -#include - -#include "libia64.h" - -void -ia64_sync_icache(vm_offset_t va, size_t sz) -{ - uintptr_t pa; - size_t cnt, max; - - while (sz > 0) { - max = sz; - pa = (uintptr_t)ia64_va2pa(va, &max); - for (cnt = 0; cnt < max; cnt += 32) - ia64_fc_i(pa + cnt); - ia64_sync_i(); - va += max; - sz -= max; - } - ia64_srlz_i(); -} diff --git a/sys/boot/ia64/common/libia64.h b/sys/boot/ia64/common/libia64.h deleted file mode 100644 index 4bc76384dc3..00000000000 --- a/sys/boot/ia64/common/libia64.h +++ /dev/null @@ -1,75 +0,0 @@ -/*- - * Copyright (c) 2006 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. - * - * $FreeBSD$ - */ - -#ifndef _LIBIA64_H_ -#define _LIBIA64_H_ - -#include -#include -#include - -#define IS_LEGACY_KERNEL() (ia64_legacy_kernel) - -/* - * Portability functions provided by the loader - * implementation specific to the platform. - */ -vm_paddr_t ia64_platform_alloc(vm_offset_t, vm_size_t); -void ia64_platform_free(vm_offset_t, vm_paddr_t, vm_size_t); -int ia64_platform_bootinfo(struct bootinfo *, struct bootinfo **); -int ia64_platform_enter(const char *); - -/* - * Functions and variables provided by the ia64 common code - * and shared by all loader implementations. - */ -extern u_int ia64_legacy_kernel; - -extern uint64_t *ia64_pgtbl; -extern uint32_t ia64_pgtblsz; - -int ia64_autoload(void); -int ia64_bootinfo(struct preloaded_file *, struct bootinfo **); -uint64_t ia64_loadaddr(u_int, void *, uint64_t); -#ifdef __elfN -void ia64_loadseg(Elf_Ehdr *, Elf_Phdr *, uint64_t); -#else -void ia64_loadseg(void *, void *, uint64_t); -#endif - -ssize_t ia64_copyin(const void *, vm_offset_t, size_t); -ssize_t ia64_copyout(vm_offset_t, void *, size_t); -void ia64_sync_icache(vm_offset_t, size_t); -ssize_t ia64_readin(int, vm_offset_t, size_t); -void *ia64_va2pa(vm_offset_t, size_t *); - -char *ia64_fmtdev(struct devdesc *); -int ia64_getdev(void **, const char *, const char **); -int ia64_setcurrdev(struct env_var *, int, const void *); - -#endif /* !_LIBIA64_H_ */ diff --git a/sys/boot/ia64/efi/Makefile b/sys/boot/ia64/efi/Makefile deleted file mode 100644 index fc11d6e8d65..00000000000 --- a/sys/boot/ia64/efi/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -# $FreeBSD$ - -MAN= - -.include -MK_SSP= no - -PROG= loader.sym -INTERNALPROG= -SRCS= conf.c efimd.c main.c pal.S start.S vers.c - -.PATH: ${.CURDIR}/../../../${MACHINE_CPUARCH}/${MACHINE_CPUARCH} - -CFLAGS+= -I${.CURDIR}/../common -CFLAGS+= -I${.CURDIR}/../../common -CFLAGS+= -I${.CURDIR}/../../efi/include -CFLAGS+= -I${.CURDIR}/../../efi/include/${MACHINE_CPUARCH} -CFLAGS+= -I${.CURDIR}/../../.. -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand - -LDSCRIPT= ${.CURDIR}/ldscript.${MACHINE_CPUARCH} -LDFLAGS= -Wl,-T${LDSCRIPT} -shared -symbolic - -${PROG}: ${LDSCRIPT} - -NEWVERSWHAT= "EFI boot" ${MACHINE_CPUARCH} - -vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version - sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} - -OBJCOPY?= objcopy -OBJDUMP?= objdump - -FILES= loader.efi -FILESMODE_loader.efi= ${BINMODE} - -loader.efi: loader.sym - if [ `${OBJDUMP} -t ${.ALLSRC} | fgrep '*UND*' | wc -l` != 0 ]; then \ - ${OBJDUMP} -t ${.ALLSRC} | fgrep '*UND*'; \ - rm ${.ALLSRC}; \ - exit 1; \ - fi - ${OBJCOPY} -j .data -j .dynamic -j .dynstr -j .dynsym -j .hash \ - -j .rela.dyn -j .reloc -j .sdata -j .text \ - --target=efi-app-${MACHINE_CPUARCH} ${.ALLSRC} ${.TARGET} - -CLEANFILES= vers.c loader.efi - -LIBIA64= ${.OBJDIR}/../common/libia64.a -LIBEFI= ${.OBJDIR}/../../efi/libefi/libefi.a -.if ${MK_FORTH} != "no" -LIBFICL= ${.OBJDIR}/../../ficl/libficl.a -.endif - -DPADD= ${LIBIA64} ${LIBFICL} ${LIBEFI} ${LIBSTAND} -LDADD= -Wl,--whole-archive ${LIBIA64} -Wl,--no-whole-archive \ - ${LIBFICL} ${LIBEFI} -lstand - -.include diff --git a/sys/boot/ia64/efi/conf.c b/sys/boot/ia64/efi/conf.c deleted file mode 100644 index 0e0d1299567..00000000000 --- a/sys/boot/ia64/efi/conf.c +++ /dev/null @@ -1,82 +0,0 @@ -/*- - * Copyright (c) 1997 - * Matthias Drochner. 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 for the NetBSD Project - * by Matthias Drochner. - * 4. The name of the author may not 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 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: conf.c,v 1.2 1997/03/22 09:03:29 thorpej Exp $ - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include - -/* - * We could use linker sets for some or all of these, but - * then we would have to control what ended up linked into - * the bootstrap. So it's easier to conditionalise things - * here. - * - * XXX rename these arrays to be consistent and less namespace-hostile - */ - -/* Exported for libstand */ -struct devsw *devsw[] = { - &efipart_dev, - &efinet_dev, - NULL -}; - -struct fs_ops *file_system[] = { - &dosfs_fsops, - &ufs_fsops, - &cd9660_fsops, - &nfs_fsops, - &gzipfs_fsops, - NULL -}; - -struct netif_driver *netif_drivers[] = { - &efinetif, - NULL -}; - -/* - * Consoles - * - * We don't prototype these in efiboot.h because they require - * data structures from bootstrap.h as well. - */ -extern struct console efi_console; - -struct console *consoles[] = { - &efi_console, - NULL -}; diff --git a/sys/boot/ia64/efi/efimd.c b/sys/boot/ia64/efi/efimd.c deleted file mode 100644 index 0b29e1280ce..00000000000 --- a/sys/boot/ia64/efi/efimd.c +++ /dev/null @@ -1,264 +0,0 @@ -/*- - * Copyright (c) 2004, 2006 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 - -#include -#include - -#include - -#define EFI_INTEL_FPSWA \ - {0xc41b6531,0x97b9,0x11d3,{0x9a,0x29,0x00,0x90,0x27,0x3f,0xc1,0x4d}} - -static EFI_GUID fpswa_guid = EFI_INTEL_FPSWA; - -/* DIG64 Headless Console & Debug Port Table. */ -#define HCDP_TABLE_GUID \ - {0xf951938d,0x620b,0x42ef,{0x82,0x79,0xa8,0x4b,0x79,0x61,0x78,0x98}} - -static EFI_GUID hcdp_guid = HCDP_TABLE_GUID; - -static EFI_MEMORY_DESCRIPTOR *memmap; -static UINTN memmapsz; -static UINTN mapkey; -static UINTN descsz; -static UINT32 descver; - -#define IA64_EFI_CHUNK_SIZE (32 * 1048576) -static vm_paddr_t ia64_efi_chunk; - -#define IA64_EFI_PGTBLSZ_MAX 1048576 -static vm_paddr_t ia64_efi_pgtbl; -static vm_size_t ia64_efi_pgtblsz; - -/* Don't allocate memory below the boundary */ -#define IA64_EFI_ALLOC_BOUNDARY 1048576 - -static int -ia64_efi_memmap_update(void) -{ - EFI_STATUS status; - - if (memmap != NULL) { - free(memmap); - memmap = NULL; - } - - memmapsz = 0; - BS->GetMemoryMap(&memmapsz, NULL, &mapkey, &descsz, &descver); - if (memmapsz == 0) - return (FALSE); - memmap = malloc(memmapsz); - if (memmap == NULL) - return (FALSE); - - status = BS->GetMemoryMap(&memmapsz, memmap, &mapkey, &descsz, - &descver); - if (EFI_ERROR(status)) { - free(memmap); - memmap = NULL; - return (FALSE); - } - - return (TRUE); -} - -/* - * Returns 0 on failure. Successful allocations return an address - * larger or equal to IA64_EFI_ALLOC_BOUNDARY. - */ -static vm_paddr_t -ia64_efi_alloc(vm_size_t sz) -{ - EFI_PHYSICAL_ADDRESS pa; - EFI_MEMORY_DESCRIPTOR *mm; - uint8_t *mmiter, *mmiterend; - vm_size_t memsz; - UINTN npgs; - EFI_STATUS status; - - /* We can't allocate less than a page */ - if (sz < EFI_PAGE_SIZE) - return (0); - - /* The size must be a power of 2. */ - if (sz & (sz - 1)) - return (0); - - if (!ia64_efi_memmap_update()) - return (0); - - mmiter = (void *)memmap; - mmiterend = mmiter + memmapsz; - for (; mmiter < mmiterend; mmiter += descsz) { - mm = (void *)mmiter; - if (mm->Type != EfiConventionalMemory) - continue; - memsz = mm->NumberOfPages * EFI_PAGE_SIZE; - if (mm->PhysicalStart + memsz <= IA64_EFI_ALLOC_BOUNDARY) - continue; - /* - * XXX We really should make sure the memory is local to the - * BSP. - */ - pa = (mm->PhysicalStart < IA64_EFI_ALLOC_BOUNDARY) ? - IA64_EFI_ALLOC_BOUNDARY : mm->PhysicalStart; - pa = (pa + sz - 1) & ~(sz - 1); - if (pa + sz > mm->PhysicalStart + memsz) - continue; - - npgs = EFI_SIZE_TO_PAGES(sz); - status = BS->AllocatePages(AllocateAddress, EfiLoaderData, - npgs, &pa); - if (!EFI_ERROR(status)) - return (pa); - } - - printf("%s: unable to allocate %lx bytes\n", __func__, sz); - return (0); -} - -vm_paddr_t -ia64_platform_alloc(vm_offset_t va, vm_size_t sz) -{ - vm_paddr_t pa; - - if (va == 0) { - /* Page table itself. */ - if (sz > IA64_EFI_PGTBLSZ_MAX) - return (~0UL); - if (ia64_efi_pgtbl == 0) - ia64_efi_pgtbl = ia64_efi_alloc(IA64_EFI_PGTBLSZ_MAX); - if (ia64_efi_pgtbl != 0) - ia64_efi_pgtblsz = sz; - return (ia64_efi_pgtbl); - } else if (va < IA64_PBVM_BASE) { - /* Should not happen. */ - return (~0UL); - } - - /* Loader virtual memory page. */ - va -= IA64_PBVM_BASE; - - /* Allocate a big chunk that can be wired with a single PTE. */ - if (ia64_efi_chunk == 0) - ia64_efi_chunk = ia64_efi_alloc(IA64_EFI_CHUNK_SIZE); - if (va < IA64_EFI_CHUNK_SIZE) - return (ia64_efi_chunk + va); - - /* Allocate a page at a time when we go beyond the chunk. */ - pa = ia64_efi_alloc(sz); - return ((pa == 0) ? ~0UL : pa); -} - -void -ia64_platform_free(vm_offset_t va, vm_paddr_t pa, vm_size_t sz) -{ - - BS->FreePages(pa, sz >> EFI_PAGE_SHIFT); -} - -int -ia64_platform_bootinfo(struct bootinfo *bi, struct bootinfo **res) -{ - VOID *fpswa; - EFI_HANDLE handle; - EFI_STATUS status; - UINTN sz; - - bi->bi_systab = (uint64_t)ST; - bi->bi_hcdp = (uint64_t)efi_get_table(&hcdp_guid); - - sz = sizeof(EFI_HANDLE); - status = BS->LocateHandle(ByProtocol, &fpswa_guid, 0, &sz, &handle); - if (status == 0) - status = BS->HandleProtocol(handle, &fpswa_guid, &fpswa); - bi->bi_fpswa = (status == 0) ? (uint64_t)fpswa : 0; - - if (!ia64_efi_memmap_update()) - return (ENOMEM); - - bi->bi_memmap = (uint64_t)memmap; - bi->bi_memmap_size = memmapsz; - bi->bi_memdesc_size = descsz; - bi->bi_memdesc_version = descver; - - if (IS_LEGACY_KERNEL()) - *res = malloc(sizeof(**res)); - - return (0); -} - -int -ia64_platform_enter(const char *kernel) -{ - EFI_STATUS status; - - status = BS->ExitBootServices(IH, mapkey); - if (EFI_ERROR(status)) { - printf("%s: ExitBootServices() returned 0x%lx\n", __func__, - (long)status); - return (EINVAL); - } - - return (0); -} - -COMMAND_SET(pbvm, "pbvm", "show PBVM details", command_pbvm); - -static int -command_pbvm(int argc, char *argv[]) -{ - uint64_t limit, pg, start; - u_int idx; - - printf("Page table @ %p, size %x\n", ia64_pgtbl, ia64_pgtblsz); - - if (ia64_pgtbl == NULL) - return (0); - - limit = ~0; - start = ~0; - idx = 0; - while (ia64_pgtbl[idx] != 0) { - pg = ia64_pgtbl[idx]; - if (pg != limit) { - if (start != ~0) - printf("%#lx-%#lx\n", start, limit); - start = pg; - } - limit = pg + IA64_PBVM_PAGE_SIZE; - idx++; - } - if (start != ~0) - printf("%#lx-%#lx\n", start, limit); - - return (0); -} diff --git a/sys/boot/ia64/efi/ldscript.ia64 b/sys/boot/ia64/efi/ldscript.ia64 deleted file mode 100644 index 0d7901fe75a..00000000000 --- a/sys/boot/ia64/efi/ldscript.ia64 +++ /dev/null @@ -1,73 +0,0 @@ -/* $FreeBSD$ */ -OUTPUT_FORMAT("elf64-ia64-freebsd", "elf64-ia64-freebsd", "elf64-ia64-freebsd") -OUTPUT_ARCH(ia64) -ENTRY(_start_plabel) -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = 0; - ImageBase = .; - . = SIZEOF_HEADERS; - . = ALIGN(4096); - .text : { - *(.text .stub .text.* .gnu.linkonce.t.*) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - *(.plt) - } =0x00300000010070000002000001000400 - . = ALIGN(4096); - __start_set_Xcommand_set = .; - set_Xcommand_set : { *(set_Xcommand_set) } - __stop_set_Xcommand_set = .; - .data : { - *(.rodata .rodata.* .gnu.linkonce.r.*) - *(.rodata1) - *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) - *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) - *(.opd) - *(.data .data.* .gnu.linkonce.d.*) - *(.data1) - *(.plabel) - *(.dynbss) - *(.bss .bss.* .gnu.linkonce.b.*) - *(COMMON) - } - .IA_64.unwind_info : { *(.IA_64.unwind_info* .gnu.linkonce.ia64unwi.*) } - .IA_64.unwind : { *(.IA_64.unwind* .gnu.linkonce.ia64unw.*) } - . = ALIGN(4096); - __gp = .; - .sdata : { - *(.got.plt .got) - *(.IA_64.pltoff) - *(.sdata .sdata.* .gnu.linkonce.s.*) - *(dynsbss) - *(.sbss .sbss.* .gnu.linkonce.sb.*) - *(.scommon) - } - . = ALIGN(4096); - .dynamic : { *(.dynamic) } - . = ALIGN(4096); - .rela.dyn : { - *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) - *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) - *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) - *(.rela.got) - *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) - *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) - *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) - *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) - *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) - *(.rela.plt) - *(.rela.IA_64.pltoff) - *(.relaset_*) - *(.rela.dyn .rela.dyn.*) - } - . = ALIGN(4096); - .reloc : { *(.reloc) } - . = ALIGN(4096); - .hash : { *(.hash) } - . = ALIGN(4096); - .dynsym : { *(.dynsym) } - . = ALIGN(4096); - .dynstr : { *(.dynstr) } -} diff --git a/sys/boot/ia64/efi/main.c b/sys/boot/ia64/efi/main.c deleted file mode 100644 index ec12b4266a0..00000000000 --- a/sys/boot/ia64/efi/main.c +++ /dev/null @@ -1,618 +0,0 @@ -/*- - * Copyright (c) 1998 Michael Smith - * Copyright (c) 1998,2000 Doug Rabson - * 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 - -/* DIG64 Headless Console & Debug Port Table. */ -#define HCDP_TABLE_GUID \ - {0xf951938d,0x620b,0x42ef,{0x82,0x79,0xa8,0x4b,0x79,0x61,0x78,0x98}} - -extern char bootprog_name[]; -extern char bootprog_rev[]; -extern char bootprog_date[]; -extern char bootprog_maker[]; - -struct arch_switch archsw; /* MI/MD interface boundary */ - -extern u_int64_t ia64_pal_entry; - -EFI_GUID acpi = ACPI_TABLE_GUID; -EFI_GUID acpi20 = ACPI_20_TABLE_GUID; -EFI_GUID devid = DEVICE_PATH_PROTOCOL; -EFI_GUID hcdp = HCDP_TABLE_GUID; -EFI_GUID imgid = LOADED_IMAGE_PROTOCOL; -EFI_GUID mps = MPS_TABLE_GUID; -EFI_GUID netid = EFI_SIMPLE_NETWORK_PROTOCOL; -EFI_GUID sal = SAL_SYSTEM_TABLE_GUID; -EFI_GUID smbios = SMBIOS_TABLE_GUID; - -static void -find_pal_proc(void) -{ - int i; - struct sal_system_table *saltab = 0; - static int sizes[6] = { - 48, 32, 16, 32, 16, 16 - }; - u_int8_t *p; - - saltab = efi_get_table(&sal); - if (saltab == NULL) { - printf("Can't find SAL System Table\n"); - return; - } - - if (memcmp(saltab->sal_signature, "SST_", 4)) { - printf("Bad signature for SAL System Table\n"); - return; - } - - p = (u_int8_t *) (saltab + 1); - for (i = 0; i < saltab->sal_entry_count; i++) { - if (*p == 0) { - struct sal_entrypoint_descriptor *dp; - dp = (struct sal_entrypoint_descriptor *) p; - ia64_pal_entry = dp->sale_pal_proc; - return; - } - p += sizes[*p]; - } - - printf("Can't find PAL proc\n"); - return; -} - -static int -usc2cmp(CHAR16 *s1, CHAR16 *s2) -{ - - while (*s1 == *s2++) { - if (*s1++ == 0) - return (0); - } - return (*s1 - *(s2 - 1)); -} - -static char * -get_dev_option(int argc, CHAR16 *argv[]) -{ - static char dev[32]; - CHAR16 *arg; - char *devp; - int i, j; - - devp = NULL; - for (i = 0; i < argc; i++) { - if (usc2cmp(argv[i], L"-dev") == 0 && i < argc - 1) { - arg = argv[i + 1]; - j = 0; - while (j < sizeof(dev) && *arg != 0) - dev[j++] = *arg++; - if (j == sizeof(dev)) - j--; - dev[j] = '\0'; - devp = dev; - break; - } - } - - return (devp); -} - -EFI_STATUS -main(int argc, CHAR16 *argv[]) -{ - struct devdesc currdev; - EFI_LOADED_IMAGE *img; - char *dev; - int i; - - /* - * XXX Chicken-and-egg problem; we want to have console output - * early, but some console attributes may depend on reading from - * eg. the boot device, which we can't do yet. We can use - * printf() etc. once this is done. - */ - cons_probe(); - - printf("\n%s, Revision %s\n", bootprog_name, bootprog_rev); - - find_pal_proc(); - - /* - * March through the device switch probing for things. - */ - for (i = 0; devsw[i] != NULL; i++) - if (devsw[i]->dv_init != NULL) - (devsw[i]->dv_init)(); - - /* - * Disable the watchdog timer. By default the boot manager sets - * the timer to 5 minutes before invoking a boot option. If we - * want to return to the boot manager, we have to disable the - * watchdog timer and since we're an interactive program, we don't - * want to wait until the user types "quit". The timer may have - * fired by then. We don't care if this fails. It does not prevent - * normal functioning in any way... - */ - BS->SetWatchdogTimer(0, 0, 0, NULL); - - /* Get our loaded image protocol interface structure. */ - BS->HandleProtocol(IH, &imgid, (VOID**)&img); - - bzero(&currdev, sizeof(currdev)); - efi_handle_lookup(img->DeviceHandle, &currdev.d_dev, &currdev.d_unit); - currdev.d_type = currdev.d_dev->dv_type; - - env_setenv("loaddev", EV_VOLATILE, ia64_fmtdev(&currdev), env_noset, - env_nounset); - - dev = get_dev_option(argc, argv); - if (dev == NULL) - dev = ia64_fmtdev(&currdev); - - env_setenv("currdev", EV_VOLATILE, dev, ia64_setcurrdev, env_nounset); - - setenv("LINES", "24", 1); /* optional */ - - archsw.arch_autoload = ia64_autoload; - archsw.arch_copyin = ia64_copyin; - archsw.arch_copyout = ia64_copyout; - archsw.arch_getdev = ia64_getdev; - archsw.arch_loadaddr = ia64_loadaddr; - archsw.arch_loadseg = ia64_loadseg; - archsw.arch_readin = ia64_readin; - - interact(); /* doesn't return */ - - return (EFI_SUCCESS); /* keep compiler happy */ -} - -COMMAND_SET(quit, "quit", "exit the loader", command_quit); - -static int -command_quit(int argc, char *argv[]) -{ - exit(0); - /* NOTREACHED */ - return (CMD_OK); -} - -COMMAND_SET(reboot, "reboot", "reboot the system", command_reboot); - -static int -command_reboot(int argc, char *argv[]) -{ - - RS->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL); - /* NOTREACHED */ - return (CMD_OK); -} - -COMMAND_SET(memmap, "memmap", "print memory map", command_memmap); - -static int -command_memmap(int argc, char *argv[]) -{ - UINTN sz; - EFI_MEMORY_DESCRIPTOR *map, *p; - UINTN key, dsz; - UINT32 dver; - EFI_STATUS status; - int i, ndesc; - static char *types[] = { - "Reserved", - "LoaderCode", - "LoaderData", - "BootServicesCode", - "BootServicesData", - "RuntimeServicesCode", - "RuntimeServicesData", - "ConventionalMemory", - "UnusableMemory", - "ACPIReclaimMemory", - "ACPIMemoryNVS", - "MemoryMappedIO", - "MemoryMappedIOPortSpace", - "PalCode" - }; - - sz = 0; - status = BS->GetMemoryMap(&sz, 0, &key, &dsz, &dver); - if (status != EFI_BUFFER_TOO_SMALL) { - printf("Can't determine memory map size\n"); - return CMD_ERROR; - } - map = malloc(sz); - status = BS->GetMemoryMap(&sz, map, &key, &dsz, &dver); - if (EFI_ERROR(status)) { - printf("Can't read memory map\n"); - return CMD_ERROR; - } - - ndesc = sz / dsz; - printf("%23s %12s %12s %8s %4s\n", - "Type", "Physical", "Virtual", "#Pages", "Attr"); - - for (i = 0, p = map; i < ndesc; - i++, p = NextMemoryDescriptor(p, dsz)) { - printf("%23s %012lx %012lx %08lx ", - types[p->Type], - p->PhysicalStart, - p->VirtualStart, - p->NumberOfPages); - if (p->Attribute & EFI_MEMORY_UC) - printf("UC "); - if (p->Attribute & EFI_MEMORY_WC) - printf("WC "); - if (p->Attribute & EFI_MEMORY_WT) - printf("WT "); - if (p->Attribute & EFI_MEMORY_WB) - printf("WB "); - if (p->Attribute & EFI_MEMORY_UCE) - printf("UCE "); - if (p->Attribute & EFI_MEMORY_WP) - printf("WP "); - if (p->Attribute & EFI_MEMORY_RP) - printf("RP "); - if (p->Attribute & EFI_MEMORY_XP) - printf("XP "); - if (p->Attribute & EFI_MEMORY_RUNTIME) - printf("RUNTIME"); - printf("\n"); - } - - return CMD_OK; -} - -COMMAND_SET(configuration, "configuration", - "print configuration tables", command_configuration); - -static const char * -guid_to_string(EFI_GUID *guid) -{ - static char buf[40]; - - sprintf(buf, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", - guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], - guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4], - guid->Data4[5], guid->Data4[6], guid->Data4[7]); - return (buf); -} - -static int -command_configuration(int argc, char *argv[]) -{ - int i; - - printf("NumberOfTableEntries=%ld\n", ST->NumberOfTableEntries); - for (i = 0; i < ST->NumberOfTableEntries; i++) { - EFI_GUID *guid; - - printf(" "); - guid = &ST->ConfigurationTable[i].VendorGuid; - if (!memcmp(guid, &mps, sizeof(EFI_GUID))) - printf("MPS Table"); - else if (!memcmp(guid, &acpi, sizeof(EFI_GUID))) - printf("ACPI Table"); - else if (!memcmp(guid, &acpi20, sizeof(EFI_GUID))) - printf("ACPI 2.0 Table"); - else if (!memcmp(guid, &smbios, sizeof(EFI_GUID))) - printf("SMBIOS Table"); - else if (!memcmp(guid, &sal, sizeof(EFI_GUID))) - printf("SAL System Table"); - else if (!memcmp(guid, &hcdp, sizeof(EFI_GUID))) - printf("DIG64 HCDP Table"); - else - printf("Unknown Table (%s)", guid_to_string(guid)); - printf(" at %p\n", ST->ConfigurationTable[i].VendorTable); - } - - return CMD_OK; -} - -COMMAND_SET(sal, "sal", "print SAL System Table", command_sal); - -static int -command_sal(int argc, char *argv[]) -{ - int i; - struct sal_system_table *saltab = 0; - static int sizes[6] = { - 48, 32, 16, 32, 16, 16 - }; - u_int8_t *p; - - saltab = efi_get_table(&sal); - if (saltab == NULL) { - printf("Can't find SAL System Table\n"); - return CMD_ERROR; - } - - if (memcmp(saltab->sal_signature, "SST_", 4)) { - printf("Bad signature for SAL System Table\n"); - return CMD_ERROR; - } - - printf("SAL Revision %x.%02x\n", - saltab->sal_rev[1], - saltab->sal_rev[0]); - printf("SAL A Version %x.%02x\n", - saltab->sal_a_version[1], - saltab->sal_a_version[0]); - printf("SAL B Version %x.%02x\n", - saltab->sal_b_version[1], - saltab->sal_b_version[0]); - - p = (u_int8_t *) (saltab + 1); - for (i = 0; i < saltab->sal_entry_count; i++) { - printf(" Desc %d", *p); - if (*p == 0) { - struct sal_entrypoint_descriptor *dp; - dp = (struct sal_entrypoint_descriptor *) p; - printf("\n"); - printf(" PAL Proc at 0x%lx\n", - dp->sale_pal_proc); - printf(" SAL Proc at 0x%lx\n", - dp->sale_sal_proc); - printf(" SAL GP at 0x%lx\n", - dp->sale_sal_gp); - } else if (*p == 1) { - struct sal_memory_descriptor *dp; - dp = (struct sal_memory_descriptor *) p; - printf(" Type %d.%d, ", - dp->sale_memory_type[0], - dp->sale_memory_type[1]); - printf("Address 0x%lx, ", - dp->sale_physical_address); - printf("Length 0x%x\n", - dp->sale_length); - } else if (*p == 5) { - struct sal_ap_wakeup_descriptor *dp; - dp = (struct sal_ap_wakeup_descriptor *) p; - printf("\n"); - printf(" Mechanism %d\n", dp->sale_mechanism); - printf(" Vector 0x%lx\n", dp->sale_vector); - } else - printf("\n"); - - p += sizes[*p]; - } - - return CMD_OK; -} - -int -print_trs(int type) -{ - struct ia64_pal_result res; - int i, maxtr; - struct { - pt_entry_t pte; - uint64_t itir; - uint64_t ifa; - struct ia64_rr rr; - } buf; - static const char *psnames[] = { - "1B", "2B", "4B", "8B", - "16B", "32B", "64B", "128B", - "256B", "512B", "1K", "2K", - "4K", "8K", "16K", "32K", - "64K", "128K", "256K", "512K", - "1M", "2M", "4M", "8M", - "16M", "32M", "64M", "128M", - "256M", "512M", "1G", "2G" - }; - static const char *manames[] = { - "WB", "bad", "bad", "bad", - "UC", "UCE", "WC", "NaT", - }; - - res = ia64_call_pal_static(PAL_VM_SUMMARY, 0, 0, 0); - if (res.pal_status != 0) { - printf("Can't get VM summary\n"); - return CMD_ERROR; - } - - if (type == 0) - maxtr = (res.pal_result[0] >> 40) & 0xff; - else - maxtr = (res.pal_result[0] >> 32) & 0xff; - - printf("%d translation registers\n", maxtr); - - pager_open(); - pager_output("TR# RID Virtual Page Physical Page PgSz ED AR PL D A MA P KEY\n"); - for (i = 0; i <= maxtr; i++) { - char lbuf[128]; - - bzero(&buf, sizeof(buf)); - res = ia64_call_pal_stacked(PAL_VM_TR_READ, i, type, - (u_int64_t) &buf); - if (res.pal_status != 0) - break; - - /* Only display valid translations */ - if ((buf.ifa & 1) == 0) - continue; - - if (!(res.pal_result[0] & 1)) - buf.pte &= ~PTE_AR_MASK; - if (!(res.pal_result[0] & 2)) - buf.pte &= ~PTE_PL_MASK; - if (!(res.pal_result[0] & 4)) - buf.pte &= ~PTE_DIRTY; - if (!(res.pal_result[0] & 8)) - buf.pte &= ~PTE_MA_MASK; - sprintf(lbuf, "%03d %06x %013lx %013lx %4s %d %d %d %d %d " - "%-3s %d %06x\n", i, buf.rr.rr_rid, buf.ifa >> 12, - (buf.pte & PTE_PPN_MASK) >> 12, - psnames[(buf.itir & ITIR_PS_MASK) >> 2], - (buf.pte & PTE_ED) ? 1 : 0, - (int)(buf.pte & PTE_AR_MASK) >> 9, - (int)(buf.pte & PTE_PL_MASK) >> 7, - (buf.pte & PTE_DIRTY) ? 1 : 0, - (buf.pte & PTE_ACCESSED) ? 1 : 0, - manames[(buf.pte & PTE_MA_MASK) >> 2], - (buf.pte & PTE_PRESENT) ? 1 : 0, - (int)((buf.itir & ITIR_KEY_MASK) >> 8)); - pager_output(lbuf); - } - pager_close(); - - if (res.pal_status != 0) { - printf("Error while getting TR contents\n"); - return CMD_ERROR; - } - return CMD_OK; -} - -COMMAND_SET(itr, "itr", "print instruction TRs", command_itr); - -static int -command_itr(int argc, char *argv[]) -{ - return print_trs(0); -} - -COMMAND_SET(dtr, "dtr", "print data TRs", command_dtr); - -static int -command_dtr(int argc, char *argv[]) -{ - return print_trs(1); -} - -COMMAND_SET(hcdp, "hcdp", "Dump HCDP info", command_hcdp); - -static char * -hcdp_string(char *s, u_int len) -{ - static char buffer[256]; - - memcpy(buffer, s, len); - buffer[len] = 0; - return (buffer); -} - -static int -command_hcdp(int argc, char *argv[]) -{ - struct dig64_hcdp_table *tbl; - struct dig64_hcdp_entry *ent; - struct dig64_gas *gas; - int i; - - tbl = efi_get_table(&hcdp); - if (tbl == NULL) { - printf("No HCDP table present\n"); - return (CMD_OK); - } - if (memcmp(tbl->signature, HCDP_SIGNATURE, sizeof(tbl->signature))) { - printf("HCDP table has invalid signature\n"); - return (CMD_OK); - } - if (tbl->length < sizeof(*tbl) - sizeof(*tbl->entry)) { - printf("HCDP table too short\n"); - return (CMD_OK); - } - printf("HCDP table at 0x%016lx\n", (u_long)tbl); - printf("Signature = %s\n", hcdp_string(tbl->signature, 4)); - printf("Length = %u\n", tbl->length); - printf("Revision = %u\n", tbl->revision); - printf("Checksum = %u\n", tbl->checksum); - printf("OEM Id = %s\n", hcdp_string(tbl->oem_id, 6)); - printf("Table Id = %s\n", hcdp_string(tbl->oem_tbl_id, 8)); - printf("OEM rev = %u\n", tbl->oem_rev); - printf("Creator Id = %s\n", hcdp_string(tbl->creator_id, 4)); - printf("Creator rev= %u\n", tbl->creator_rev); - printf("Entries = %u\n", tbl->entries); - for (i = 0; i < tbl->entries; i++) { - ent = tbl->entry + i; - printf("Entry #%d:\n", i + 1); - printf(" Type = %u\n", ent->type); - printf(" Databits = %u\n", ent->databits); - printf(" Parity = %u\n", ent->parity); - printf(" Stopbits = %u\n", ent->stopbits); - printf(" PCI seg = %u\n", ent->pci_segment); - printf(" PCI bus = %u\n", ent->pci_bus); - printf(" PCI dev = %u\n", ent->pci_device); - printf(" PCI func = %u\n", ent->pci_function); - printf(" Interrupt = %u\n", ent->interrupt); - printf(" PCI flag = %u\n", ent->pci_flag); - printf(" Baudrate = %lu\n", - ((u_long)ent->baud_high << 32) + (u_long)ent->baud_low); - gas = &ent->address; - printf(" Addr space= %u\n", gas->addr_space); - printf(" Bit width = %u\n", gas->bit_width); - printf(" Bit offset= %u\n", gas->bit_offset); - printf(" Address = 0x%016lx\n", - ((u_long)gas->addr_high << 32) + (u_long)gas->addr_low); - printf(" PCI type = %u\n", ent->pci_devid); - printf(" PCI vndr = %u\n", ent->pci_vendor); - printf(" IRQ = %u\n", ent->irq); - printf(" PClock = %u\n", ent->pclock); - printf(" PCI iface = %u\n", ent->pci_interface); - } - printf("\n"); - return (CMD_OK); -} - -COMMAND_SET(about, "about", "about the loader", command_about); - -extern uint64_t _start_plabel[]; - -static int -command_about(int argc, char *argv[]) -{ - EFI_LOADED_IMAGE *img; - - printf("%s\n", bootprog_name); - printf("revision %s\n", bootprog_rev); - printf("built by %s\n", bootprog_maker); - printf("built on %s\n", bootprog_date); - - printf("\n"); - - BS->HandleProtocol(IH, &imgid, (VOID**)&img); - printf("image loaded at %p\n", img->ImageBase); - printf("entry at %#lx (%#lx)\n", _start_plabel[0], _start_plabel[1]); -} diff --git a/sys/boot/ia64/efi/start.S b/sys/boot/ia64/efi/start.S deleted file mode 100644 index 9d28a968993..00000000000 --- a/sys/boot/ia64/efi/start.S +++ /dev/null @@ -1,290 +0,0 @@ -/*- - * Copyright (c) 2001 Doug Rabson - * 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$ - */ - - .text - -#include - -#define EFI_SUCCESS 0 -#define EFI_LOAD_ERROR 1 -#define EFI_BUFFER_TOO_SMALL 5 - -#define DT_NULL 0 /* Terminating entry. */ -#define DT_PLTRELSZ 2 /* Total size in bytes of PLT relocations. */ -#define DT_SYMTAB 6 /* Address of symbol table. */ -#define DT_RELA 7 /* Address of ElfNN_Rela relocations. */ -#define DT_RELASZ 8 /* Total size of ElfNN_Rela relocations. */ -#define DT_RELAENT 9 /* Size of each ElfNN_Rela relocation entry. */ -#define DT_SYMENT 11 /* Size of each symbol table entry. */ -#define DT_JMPREL 23 /* Address of PLT relocations. */ - -#define R_IA_64_NONE 0 /* None */ -#define R_IA_64_DIR64LSB 0x27 /* word64 LSB S + A */ -#define R_IA_64_FPTR64LSB 0x47 /* word64 LSB @fptr(S + A) */ -#define R_IA_64_REL32LSB 0x6d /* word32 LSB BD + A */ -#define R_IA_64_REL64LSB 0x6f /* word64 LSB BD + A */ -#define R_IA_64_IPLTLSB 0x81 /* function descriptor LSB speciaal */ - -ENTRY(_start, 2) - alloc loc0=ar.pfs,2,3,3,0 - mov loc1=rp - movl loc2=@gprel(ImageBase) - ;; - add loc2=gp,loc2 - ;; - mov out0=loc2 - mov out1=in1 - ;; - br.call.sptk.few rp=_reloc // relocate image - - cmp.ne p6,p0=EFI_SUCCESS,r8 // did it work? -(p6) br.cond.dpnt.few 9f - - mov out0=in0 // image_handle - mov out1=in1 // system_table - br.call.sptk.few rp=efi_main -9: - mov ar.pfs=loc0 - mov rp=loc1 - ;; - br.ret.sptk.few rp -END(_start) - - // PLABEL for PE32+ - .section .plabel, "a" - .align 16 - .global _start_plabel -_start_plabel: - data16 @iplt(_start) - .previous - - // A PE32+ relocation entry for the plabel - .section .reloc, "a" - data4 _start_plabel - data4 12 - data2 (10 << 12) + 0 - data2 (10 << 12) + 8 - .previous - -// in0: image base -// in1: system table -// -// XXX Assumes PLT relocations are of type Elf_Rela -// -// r2 = address of fptr_storage -// r3 = address of fptr_storage_end -// r4 = address of first free fptr -// -// r15 = r_offset -// r16 = r_info -OR- d_tag -// r17 = r_addend -OR- d_val (=d_ptr) -// r18 = address of .rela dynamic section -// r19 = size of .rela section -// r20 = size of .rela element (Elf_Rela) -// r21 = address of first PLT relocation -// r22 = size of PLT relocations -// r23 = relocation type -// r24 = address of symbol -// r28 = R_IA_64_IPLTLSB -// f8 = address of symbol table -// f9 = size of symtab element - -STATIC_ENTRY(_reloc, 2) - alloc loc0=ar.pfs,2,2,0,0 - ;; - mov loc1=rp - movl r29=@gprel(_DYNAMIC) // find _DYNAMIC etc. - ;; - add r15=r29,gp - movl r29=@gprel(fptr_storage) - ;; - add r2=r29,gp - movl r29=@gprel(fptr_storage_end) - ;; - add r3=r29,gp - mov r4=r2 - mov r19=0 - mov r22=0 - mov r20=24 - mov r28=R_IA_64_IPLTLSB - ;; -1: - ld8 r16=[r15],8 // read r15->d_tag - ;; - ld8 r17=[r15],8 // and r15->d_val - ;; - cmp.eq p6,p0=DT_NULL,r16 // done? -(p6) br.cond.dpnt.few 2f - ;; - cmp.eq p6,p0=DT_RELA,r16 // rela section? - ;; -(p6) add r18=r17,in0 - cmp.eq p6,p0=DT_RELASZ,r16 // rela section size? - ;; -(p6) mov r19=r17 - cmp.eq p6,p0=DT_RELAENT,r16 // rela entry size? - ;; -(p6) mov r20=r17 - cmp.eq p6,p0=DT_JMPREL,r16 // PLT relocs? - ;; -(p6) add r21=r17,in0 - cmp.eq p6,p0=DT_PLTRELSZ,r16 // PLT relocs size? - ;; -(p6) mov r22=r17 - cmp.eq p6,p0=DT_SYMTAB,r16 // symbol table? - ;; -(p6) add r29=r17,in0 - ;; -(p6) setf.sig f8=r29 - cmp.eq p6,p0=DT_SYMENT,r16 // symbol entry size? - ;; -(p6) setf.sig f9=r17 - br.dptk 1b - -2: - cmp.lt p6,p0=0,r19 -(p6) br.cond.dptk 3f - ;; - mov r19=r22 - mov r18=r21 - mov r21=0 - mov r22=0 - ;; - cmp.lt p6,p0=0,r19 -(p6) br.cond.dptk 3f - ;; - mov r8=EFI_SUCCESS - br.dptk 9f -3: - ld8 r29=[r18],8 // read r_offset - ;; - ld8 r16=[r18],8 // read r_info - add r15=r29,in0 // relocate r_offset - ;; - ld8 r17=[r18],8 // read r_addend - sub r19=r19,r20 // update relasz - extr.u r23=r16,0,32 // ELF64_R_TYPE(r16) - ;; - cmp.eq p6,p0=R_IA_64_NONE,r23 -(p6) br.cond.dpnt.few 2b - ;; - cmp.eq p6,p0=R_IA_64_REL32LSB,r23 -(p6) br.cond.dptk.few 3f - ;; - cmp.eq p6,p0=R_IA_64_REL64LSB,r23 -(p6) br.cond.dptk.few 4f - ;; - extr.u r29=r16,32,32 // ELF64_R_SYM(r16) - ;; - setf.sig f10=r29 // so we can multiply - ;; - xma.lu f10=f10,f9,f8 // f10=symtab + r_sym*syment - ;; - getf.sig r29=f10 - ;; - add r29=8,r29 // address of st_value - ;; - ld8 r29=[r29] // read symbol value - ;; - add r24=r29,in0 // relocate symbol value - ;; - cmp.eq p6,p0=R_IA_64_DIR64LSB,r23 -(p6) br.cond.dptk.few 5f - ;; - cmp.eq p6,p0=R_IA_64_FPTR64LSB,r23 -(p6) br.cond.dptk.few 6f - ;; - cmp.ne p6,p0=r28,r23 // IPLTLSB -(p6) br.cond.dptk.few 2b - - // IPLTLSB - add r29=r24,r17 // S + A - ;; - st8 [r15]=r29,8 // fdesc:FP - ;; - st8 [r15]=gp // fdesc:GP - br.cond.sptk.few 2b - - // REL32LSB -3: - add r29=in0,r17 - ;; - st4 [r15]=r29 - br.cond.sptk.few 2b - - // REL64LSB -4: - add r29=in0,r17 // BD + A - ;; - st8 [r15]=r29 // word64 - br.cond.sptk.few 2b - - // DIR64LSB -5: - add r29=r24,r17 // S + A - ;; - st8 [r15]=r29 // word64 - br.cond.sptk.few 2b - -6: - mov r29=r2 // FPTR64LSB - ;; -7: - cmp.geu p6,p0=r29,r4 // end of fptrs? -(p6) br.cond.dpnt.few 8f // can't find existing fptr - ld8 r17=[r29] // read function from fptr - ;; - cmp.eq p6,p0=r24,r17 // same function? - ;; -(p6) st8 [r15]=r29 // reuse fptr -(p6) br.cond.sptk.few 2b // done - add r29=16,r29 // next fptr - br.sptk.few 7b -8: - mov r8=EFI_BUFFER_TOO_SMALL // failure return value - cmp.geu p6,p0=r4,r3 // space left? -(p6) br.cond.dpnt.few 9f // bail out - st8 [r15]=r4 // install fptr - ;; - st8 [r4]=r24,8 // write fptr address - ;; - st8 [r4]=gp,8 // write fptr gp - br.cond.sptk.few 2b - -9: - mov ar.pfs=loc0 - mov rp=loc1 - ;; - br.ret.sptk.few rp -END(_reloc) - - .data - .align 16 -fptr_storage: - .space 1024*16 // XXX -fptr_storage_end: diff --git a/sys/boot/ia64/efi/version b/sys/boot/ia64/efi/version deleted file mode 100644 index 4f4203a7a05..00000000000 --- a/sys/boot/ia64/efi/version +++ /dev/null @@ -1,27 +0,0 @@ -$FreeBSD$ - -NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this -file is important. Make sure the current version number is on line 6. - -3.2: Various fixes to libstand, in particular dosfs. -3.1: Add the about, reboot and pbvm commands. - I-cache coherency is maintained. -3.0: Add support for PBVM. -2.2: Create direct mapping based on start address instead of mapping - first 256M. -2.1: Add support for "-dev " argument parsing. -2.0: Provide devices based on the block I/O protocol, rather than the - simple file services protocol. Use the FreeBSD file system code - on top of those devices to access files. -1.2: Restructured. Has some user visible differences. -1.1: Pass the HCDP table address to the kernel via bootinfo if one - is present in the EFI system table. -1.0: Don't map the I/O port range. We expect the kernel to do it. It - was done in the loader as a debugging aid and not intended as a - service/feature. -0.3: Pass the physical address of the bootinfo block in register r8 - to the kernel. Continue to put it at the fixed address for now. -0.2: Much improved version. Significant is the support for passing - the FPSWA interface pointer to the kernel. -0.1: Initial EFI version, germinated from the NetBSD i386 - standalone, but enormously modified. diff --git a/sys/boot/ia64/ski/Makefile b/sys/boot/ia64/ski/Makefile deleted file mode 100644 index 06201265f90..00000000000 --- a/sys/boot/ia64/ski/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -# $FreeBSD$ - -MAN= - -.include -MK_SSP= no - -PROG= skiload -STRIP= # We must not strip skiload at install time. - -SRCS= acpi_stub.c conf.c delay.c efi_stub.c exit.c main.c \ - pal_stub.S sal_stub.c skiconsole.c skifs.c skimd.c \ - ssc.c start.S time.c vers.c - -CFLAGS+= -I${.CURDIR}/../common -CFLAGS+= -I${.CURDIR}/../../common -CFLAGS+= -I${.CURDIR}/../../.. -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand - -LDSCRIPT= ${.CURDIR}/ldscript.${MACHINE_CPUARCH} -LDFLAGS= -Wl,-T${LDSCRIPT} - -NEWVERSWHAT= "SKI boot" ${MACHINE_CPUARCH} - -vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version - sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} - -CLEANFILES= vers.c - -LIBIA64= ${.OBJDIR}/../common/libia64.a -.if ${MK_FORTH} != "no" -LIBFICL= ${.OBJDIR}/../../ficl/libficl.a -.endif - -DPADD= ${LIBIA64} ${LIBFICL} ${LIBSTAND} -LDADD= -Wl,--whole-archive ${LIBIA64} -Wl,--no-whole-archive \ - ${LIBFICL} -lstand - -.include diff --git a/sys/boot/ia64/ski/acpi_stub.c b/sys/boot/ia64/ski/acpi_stub.c deleted file mode 100644 index b16bb0a6b43..00000000000 --- a/sys/boot/ia64/ski/acpi_stub.c +++ /dev/null @@ -1,183 +0,0 @@ -/*- - * Copyright (c) 2003 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 - -#define APIC_IO_SAPIC 6 -#define APIC_LOCAL_SAPIC 7 - -#pragma pack(1) - -typedef struct /* LOCAL SAPIC */ -{ - ACPI_SUBTABLE_HEADER Header; - UINT8 ProcessorId; /* ACPI processor id */ - UINT8 LocalSapicId; /* Processor local SAPIC id */ - UINT8 LocalSapicEid; /* Processor local SAPIC eid */ - UINT8 Reserved[3]; - UINT32 ProcessorEnabled: 1; - UINT32 FlagsReserved: 31; -} LOCAL_SAPIC; - -typedef struct /* IO SAPIC */ -{ - ACPI_SUBTABLE_HEADER Header; - UINT8 IoSapicId; /* I/O SAPIC ID */ - UINT8 Reserved; /* reserved - must be zero */ - UINT32 Vector; /* interrupt base */ - UINT64 IoSapicAddress; /* SAPIC's physical address */ -} IO_SAPIC; - -/* - */ - -struct { - ACPI_TABLE_MADT MADT; - ACPI_MADT_LOCAL_SAPIC cpu0; - ACPI_MADT_LOCAL_SAPIC cpu1; - ACPI_MADT_LOCAL_SAPIC cpu2; - ACPI_MADT_LOCAL_SAPIC cpu3; - ACPI_MADT_IO_SAPIC sapic; -} apic = { - /* Header. */ - { - ACPI_SIG_MADT, /* Signature. */ - sizeof(apic), /* Length of table. */ - 0, /* ACPI minor revision. */ - 0, /* Checksum. */ - "FBSD", /* OEM Id. */ - "SKI", /* OEM table Id. */ - 0, /* OEM revision. */ - "FBSD", /* ASL compiler Id. */ - 0, /* ASL revision. */ - 0xfee00000, - }, - /* cpu0. */ - { - APIC_LOCAL_SAPIC, /* Type. */ - sizeof(apic.cpu0), /* Length. */ - 0, /* ACPI processor id */ - 0, /* Processor local SAPIC id */ - 0, /* Processor local SAPIC eid */ - { 0, 0, 0 }, - 1, /* FL: Enabled. */ - }, - /* cpu1. */ - { - APIC_LOCAL_SAPIC, /* Type. */ - sizeof(apic.cpu1), /* Length. */ - 1, /* ACPI processor id */ - 0, /* Processor local SAPIC id */ - 1, /* Processor local SAPIC eid */ - { 0, 0, 0 }, - 1, /* FL: Enabled. */ - }, - /* cpu2. */ - { - APIC_LOCAL_SAPIC, /* Type. */ - sizeof(apic.cpu2), /* Length. */ - 2, /* ACPI processor id */ - 1, /* Processor local SAPIC id */ - 0, /* Processor local SAPIC eid */ - { 0, 0, 0 }, - 0, /* FL: Enabled. */ - }, - /* cpu3. */ - { - APIC_LOCAL_SAPIC, /* Type. */ - sizeof(apic.cpu3), /* Length. */ - 3, /* ACPI processor id */ - 1, /* Processor local SAPIC id */ - 1, /* Processor local SAPIC eid */ - { 0, 0, 0 }, - 0, /* FL: Enabled. */ - }, - /* sapic. */ - { - APIC_IO_SAPIC, /* Type. */ - sizeof(apic.sapic), /* Length. */ - 4, /* IO SAPIC id. */ - 0, - 16, /* Interrupt base. */ - 0xfec00000 /* IO SAPIC address. */ - } -}; - -struct { - ACPI_TABLE_HEADER Header; - UINT64 apic_tbl; -} xsdt = { - { - ACPI_SIG_XSDT, /* Signature. */ - sizeof(xsdt), /* Length of table. */ - 0, /* ACPI minor revision. */ - 0, /* XXX checksum. */ - "FBSD", /* OEM Id. */ - "SKI", /* OEM table Id. */ - 0, /* OEM revision. */ - "FBSD", /* ASL compiler Id. */ - 0 /* ASL revision. */ - }, - 0UL /* XXX APIC table address. */ -}; - -ACPI_TABLE_RSDP acpi_root = { - ACPI_SIG_RSDP, - 0, /* XXX checksum. */ - "FBSD", - 2, /* ACPI Rev 2.0. */ - 0UL, - sizeof(xsdt), /* XSDT length. */ - 0UL, /* XXX PA of XSDT. */ - 0, /* XXX Extended checksum. */ -}; - -static void -cksum(void *addr, int sz, UINT8 *sum) -{ - UINT8 *p, s; - - p = addr; - s = 0; - while (sz--) - s += *p++; - *sum = -s; -} - -void -acpi_stub_init(void) -{ - acpi_root.XsdtPhysicalAddress = (UINT64)&xsdt; - cksum(&acpi_root, 20, &acpi_root.Checksum); - cksum(&acpi_root, sizeof(acpi_root), &acpi_root.ExtendedChecksum); - - cksum(&apic, sizeof(apic), &apic.MADT.Header.Checksum); - xsdt.apic_tbl = (UINT32)&apic; - cksum(&xsdt, sizeof(xsdt), &xsdt.Header.Checksum); -} diff --git a/sys/boot/ia64/ski/conf.c b/sys/boot/ia64/ski/conf.c deleted file mode 100644 index 3ee3b33460b..00000000000 --- a/sys/boot/ia64/ski/conf.c +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * Copyright (c) 1997 - * Matthias Drochner. 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 for the NetBSD Project - * by Matthias Drochner. - * 4. The name of the author may not 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 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: conf.c,v 1.2 1997/03/22 09:03:29 thorpej Exp $ - */ - -#include -__FBSDID("$FreeBSD$"); - -#include - -#include "libski.h" - -/* - * We could use linker sets for some or all of these, but - * then we would have to control what ended up linked into - * the bootstrap. So it's easier to conditionalise things - * here. - * - * XXX rename these arrays to be consistent and less namespace-hostile - */ - -/* Exported for libstand */ -struct devsw *devsw[] = { - &skifs_dev, - NULL -}; - -struct fs_ops *file_system[] = { - &ski_fsops, - &ufs_fsops, - &gzipfs_fsops, - NULL -}; - -/* - * Consoles - * - * We don't prototype these in libski.h because they require - * data structures from bootstrap.h as well. - */ -extern struct console ski_console; - -struct console *consoles[] = { - &ski_console, - NULL -}; diff --git a/sys/boot/ia64/ski/efi_stub.c b/sys/boot/ia64/ski/efi_stub.c deleted file mode 100644 index 7236c696a89..00000000000 --- a/sys/boot/ia64/ski/efi_stub.c +++ /dev/null @@ -1,259 +0,0 @@ -/*- - * Copyright (c) 2003,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 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 -#include -#include -#include -#include "libski.h" - -extern void acpi_root; -extern void sal_systab; - -struct efi_cfgtbl efi_cfgtab[] = { - { EFI_TABLE_ACPI20, (intptr_t)&acpi_root }, - { EFI_TABLE_SAL, (intptr_t)&sal_systab } -}; - -static efi_status GetTime(struct efi_tm *, struct efi_tmcap *); -static efi_status SetTime(struct efi_tm *); -static efi_status GetWakeupTime(uint8_t *, uint8_t *, struct efi_tm *); -static efi_status SetWakeupTime(uint8_t, struct efi_tm *); - -static efi_status SetVirtualAddressMap(u_long, u_long, uint32_t, - struct efi_md*); -static efi_status ConvertPointer(u_long, void **); - -static efi_status GetVariable(efi_char *, struct uuid *, uint32_t *, u_long *, - void *); -static efi_status GetNextVariableName(u_long *, efi_char *, struct uuid *); -static efi_status SetVariable(efi_char *, struct uuid *, uint32_t, u_long, - void *); - -static efi_status GetNextHighMonotonicCount(uint32_t *); -static efi_status ResetSystem(enum efi_reset, efi_status, u_long, efi_char *); - -struct efi_rt efi_rttab = { - /* Header. */ - { 0, /* XXX Signature */ - 0, /* XXX Revision */ - 0, /* XXX HeaderSize */ - 0, /* XXX CRC32 */ - }, - - /* Time services */ - GetTime, - SetTime, - GetWakeupTime, - SetWakeupTime, - - /* Virtual memory services */ - SetVirtualAddressMap, - ConvertPointer, - - /* Variable services */ - GetVariable, - GetNextVariableName, - SetVariable, - - /* Misc */ - GetNextHighMonotonicCount, - ResetSystem -}; - -struct efi_systbl efi_systab = { - /* Header. */ - { EFI_SYSTBL_SIG, - 0, /* XXX Revision */ - 0, /* XXX HeaderSize */ - 0, /* XXX CRC32 */ - }, - - /* Firmware info. */ - L"FreeBSD", 0, 0, - - /* Console stuff. */ - NULL, NULL, - NULL, NULL, - NULL, NULL, - - /* Services (runtime first). */ - (intptr_t)&efi_rttab, - NULL, - - /* Configuration tables. */ - sizeof(efi_cfgtab)/sizeof(struct efi_cfgtbl), - (intptr_t)efi_cfgtab -}; - -static efi_status -unsupported(const char *func) -{ - printf("EFI: %s not supported\n", func); - return ((1UL << 63) + 3); -} - -static efi_status -GetTime(struct efi_tm *time, struct efi_tmcap *caps) -{ - uint32_t comps[8]; - - ssc((uint64_t)comps, 0, 0, 0, SSC_GET_RTC); - time->tm_year = comps[0] + 1900; - time->tm_mon = comps[1] + 1; - time->tm_mday = comps[2]; - time->tm_hour = comps[3]; - time->tm_min = comps[4]; - time->tm_sec = comps[5]; - time->__pad1 = time->__pad2 = 0; - time->tm_nsec = 0; - time->tm_tz = 0; - time->tm_dst = 0; - return (0); -} - -static efi_status -SetTime(struct efi_tm *time) -{ - return (0); -} - -static efi_status -GetWakeupTime(uint8_t *enabled, uint8_t *pending, struct efi_tm *time) -{ - return (unsupported(__func__)); -} - -static efi_status -SetWakeupTime(uint8_t enable, struct efi_tm *time) -{ - return (unsupported(__func__)); -} - -static void -Reloc(void *addr, uint64_t delta) -{ - uint64_t **fpp = addr; - - *fpp[0] += delta; - *fpp[1] += delta; - *fpp += delta >> 3; -} - -static efi_status -SetVirtualAddressMap(u_long mapsz, u_long descsz, uint32_t version, - struct efi_md *memmap) -{ - uint64_t delta; - - delta = (uintptr_t)memmap->md_virt - memmap->md_phys; - Reloc(&efi_rttab.rt_gettime, delta); - Reloc(&efi_rttab.rt_settime, delta); - return (0); /* Hah... */ -} - -static efi_status -ConvertPointer(u_long debug, void **addr) -{ - return (unsupported(__func__)); -} - -static efi_status -GetVariable(efi_char *name, struct uuid *vendor, uint32_t *attrs, - u_long *datasz, void *data) -{ - return (unsupported(__func__)); -} - -static efi_status -GetNextVariableName(u_long *namesz, efi_char *name, struct uuid *vendor) -{ - return (unsupported(__func__)); -} - -static efi_status -SetVariable(efi_char *name, struct uuid *vendor, uint32_t attrs, u_long datasz, - void *data) -{ - return (unsupported(__func__)); -} - -static efi_status -GetNextHighMonotonicCount(uint32_t *high) -{ - static uint32_t counter = 0; - - *high = counter++; - return (0); -} - -static efi_status -ResetSystem(enum efi_reset type, efi_status status, u_long datasz, - efi_char *data) -{ - return (unsupported(__func__)); -} - -void -efi_stub_init(struct bootinfo *bi) -{ - static struct efi_md memmap[4]; - - /* Describe the SKI memory map. */ - bi->bi_memmap = (uintptr_t)(void *)memmap; - bi->bi_memmap_size = sizeof(memmap); - bi->bi_memdesc_size = sizeof(struct efi_md); - bi->bi_memdesc_version = 1; - - memmap[0].md_type = EFI_MD_TYPE_PALCODE; - memmap[0].md_phys = 0x100000; - memmap[0].md_virt = NULL; - memmap[0].md_pages = (1L*1024*1024)>>12; - memmap[0].md_attr = EFI_MD_ATTR_WB | EFI_MD_ATTR_RT; - - memmap[1].md_type = EFI_MD_TYPE_FREE; - memmap[1].md_phys = 4L*1024*1024; - memmap[1].md_virt = NULL; - memmap[1].md_pages = (128L*1024*1024)>>12; - memmap[1].md_attr = EFI_MD_ATTR_WB; - - memmap[2].md_type = EFI_MD_TYPE_FREE; - memmap[2].md_phys = 4L*1024*1024*1024; - memmap[2].md_virt = NULL; - memmap[2].md_pages = (64L*1024*1024)>>12; - memmap[2].md_attr = EFI_MD_ATTR_WB; - - memmap[3].md_type = EFI_MD_TYPE_IOPORT; - memmap[3].md_phys = 0xffffc000000; - memmap[3].md_virt = NULL; - memmap[3].md_pages = (64L*1024*1024)>>12; - memmap[3].md_attr = EFI_MD_ATTR_UC; - - bi->bi_systab = (u_int64_t)&efi_systab; -} diff --git a/sys/boot/ia64/ski/ldscript.ia64 b/sys/boot/ia64/ski/ldscript.ia64 deleted file mode 100644 index e7a303f574b..00000000000 --- a/sys/boot/ia64/ski/ldscript.ia64 +++ /dev/null @@ -1,61 +0,0 @@ -/* $FreeBSD$ */ -OUTPUT_FORMAT("elf64-ia64-freebsd", "elf64-ia64-freebsd", "elf64-ia64-freebsd") -OUTPUT_ARCH(ia64) -ENTRY(_start) -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = 0x100000; - .text : { - *(.text .stub .text.* .gnu.linkonce.t.*) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - *(.plt) - } =0x00300000010070000002000001000400 - __start_set_Xcommand_set = .; - set_Xcommand_set : { *(set_Xcommand_set) } - __stop_set_Xcommand_set = .; - .data : { - *(.rodata .rodata.* .gnu.linkonce.r.*) - *(.rodata1) - *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) - *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) - *(.opd) - *(.data .data.* .gnu.linkonce.d.*) - *(.data1) - *(.plabel) - *(.dynbss) - *(.bss .bss.* .gnu.linkonce.b.*) - *(COMMON) - } - .IA_64.unwind_info : { *(.IA_64.unwind_info* .gnu.linkonce.ia64unwi.*) } - .IA_64.unwind : { *(.IA_64.unwind* .gnu.linkonce.ia64unw.*) } - __gp = .; - .sdata : { - *(.got.plt .got) - *(.IA_64.pltoff) - *(.sdata .sdata.* .gnu.linkonce.s.*) - *(dynsbss) - *(.sbss .sbss.* .gnu.linkonce.sb.*) - *(.scommon) - } - .dynamic : { *(.dynamic) } - .rela : { - *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) - *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) - *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) - *(.rela.got) - *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) - *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) - *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) - *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) - *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) - *(.rela.plt) - *(.rela.IA_64.pltoff) - *(.relaset_*) - *(.rela.dyn .rela.dyn.*) - } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } -} diff --git a/sys/boot/ia64/ski/libski.h b/sys/boot/ia64/ski/libski.h deleted file mode 100644 index 0e7fbc60578..00000000000 --- a/sys/boot/ia64/ski/libski.h +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * Copyright (c) 2001 Doug Rabson - * 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$ - */ - -#define MAXDEV 31 /* maximum number of distinct devices */ - -typedef unsigned long physaddr_t; - -/* exported devices XXX rename? */ -extern struct devsw skifs_dev; -extern struct devsw ski_disk; -extern struct netif_driver ski_net; - -/* Wrapper over SKI filesystems. */ -extern struct fs_ops ski_fsops; - -/* this is in startup code */ -extern void delay(int); -extern void reboot(void); - -extern int ski_boot(void); - -struct bootinfo; -struct preloaded_file; - -#define SSC_CONSOLE_INIT 20 -#define SSC_GETCHAR 21 -#define SSC_PUTCHAR 31 -#define SSC_OPEN 50 -#define SSC_CLOSE 51 -#define SSC_READ 52 -#define SSC_WRITE 53 -#define SSC_GET_COMPLETION 54 -#define SSC_WAIT_COMPLETION 55 -#define SSC_GET_RTC 65 -#define SSC_EXIT 66 -#define SSC_LOAD_SYMBOLS 69 -#define SSC_SAL_SET_VECTORS 120 - -u_int64_t ssc(u_int64_t in0, u_int64_t in1, u_int64_t in2, u_int64_t in3, - int which); diff --git a/sys/boot/ia64/ski/main.c b/sys/boot/ia64/ski/main.c deleted file mode 100644 index 5a00d1c4313..00000000000 --- a/sys/boot/ia64/ski/main.c +++ /dev/null @@ -1,121 +0,0 @@ -/*- - * Copyright (c) 1998 Michael Smith - * Copyright (c) 1998,2000 Doug Rabson - * 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 "libski.h" - -extern char bootprog_name[]; -extern char bootprog_rev[]; -extern char bootprog_date[]; -extern char bootprog_maker[]; - -struct devdesc currdev; /* our current device */ -struct arch_switch archsw; /* MI/MD interface boundary */ - -void -ski_main(void) -{ - static char malloc[512*1024]; - int i; - - /* - * initialise the heap as early as possible. Once this is done, - * alloc() is usable. The stack is buried inside us, so this is - * safe. - */ - setheap((void *)malloc, (void *)(malloc + 512*1024)); - - /* - * XXX Chicken-and-egg problem; we want to have console output - * early, but some console attributes may depend on reading from - * eg. the boot device, which we can't do yet. We can use - * printf() etc. once this is done. - */ - cons_probe(); - - /* - * March through the device switch probing for things. - */ - for (i = 0; devsw[i] != NULL; i++) - if (devsw[i]->dv_init != NULL) - (devsw[i]->dv_init)(); - - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); -#if 0 - printf("Memory: %ld k\n", memsize() / 1024); -#endif - - /* XXX presumes that biosdisk is first in devsw */ - currdev.d_dev = devsw[0]; - currdev.d_type = currdev.d_dev->dv_type; - currdev.d_unit = 0; - -#if 0 - /* Create arc-specific variables */ - bootfile = GetEnvironmentVariable(ARCENV_BOOTFILE); - if (bootfile) - setenv("bootfile", bootfile, 1); -#endif - - env_setenv("currdev", EV_VOLATILE, ia64_fmtdev(&currdev), - ia64_setcurrdev, env_nounset); - env_setenv("loaddev", EV_VOLATILE, ia64_fmtdev(&currdev), env_noset, - env_nounset); - - setenv("LINES", "24", 1); /* optional */ - - archsw.arch_autoload = ia64_autoload; - archsw.arch_copyin = ia64_copyin; - archsw.arch_copyout = ia64_copyout; - archsw.arch_getdev = ia64_getdev; - archsw.arch_loadaddr = ia64_loadaddr; - archsw.arch_loadseg = ia64_loadseg; - archsw.arch_readin = ia64_readin; - - interact(); /* doesn't return */ - - exit(0); -} - -COMMAND_SET(quit, "quit", "exit the loader", command_quit); - -static int -command_quit(int argc, char *argv[]) -{ - exit(0); - return (CMD_OK); -} diff --git a/sys/boot/ia64/ski/pal_stub.S b/sys/boot/ia64/ski/pal_stub.S deleted file mode 100644 index 81fbd080e3f..00000000000 --- a/sys/boot/ia64/ski/pal_stub.S +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * Copyright (c) 2003 Marcel Moolenaar - * Copyright (c) 2001 Doug Rabson - * 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 - - .text -ENTRY(PalProc, 0) - cmp.eq p6,p0=6,r28 // PAL_PTCE_INFO -(p6) br.cond.dptk pal_ptce_info - ;; - cmp.eq p6,p0=8,r28 // PAL_VM_SUMMARY -(p6) br.cond.dptk pal_vm_summary - ;; - cmp.eq p6,p0=14,r28 // PAL_FREQ_RATIOS -(p6) br.cond.dptk pal_freq_ratios - ;; - cmp.eq p6,p0=29,r28 // PAL_HALT_LIGHT -(p6) br.cond.dptk pal_halt_light - ;; - mov r15=66 // EXIT - break.i 0x80000 // SSC - ;; -pal_ptce_info: - mov r8=0 - mov r9=0 // base - movl r10=0x0000000100000001 // loop counts (outer|inner) - mov r11=0x0000000000000000 // loop strides (outer|inner) - br.sptk b0 -pal_vm_summary: - mov r8=0 - movl r9=(8<<40)|(8<<32) // VM info 1 - mov r10=(18<<8)|(41<<0) // VM info 2 - mov r11=0 - br.sptk b0 -pal_freq_ratios: - mov r8=0 - movl r9=0x0000000B00000002 // processor ratio 11/2 - movl r10=0x0000000100000001 // bus ratio 1/1 - movl r11=0x0000000B00000002 // ITC ratio 11/2 - br.sptk b0 -pal_halt_light: - mov r8=0 - mov r9=0 - mov r10=0 - mov r11=0 - br.sptk b0 -END(PalProc) diff --git a/sys/boot/ia64/ski/sal_stub.c b/sys/boot/ia64/ski/sal_stub.c deleted file mode 100644 index 1ebbb4cc24b..00000000000 --- a/sys/boot/ia64/ski/sal_stub.c +++ /dev/null @@ -1,118 +0,0 @@ -/*- - * Copyright (c) 2003 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 -#include -#include -#include -#include "libski.h" - -extern void PalProc(void); -static sal_entry_t SalProc; - -struct { - struct sal_system_table header; - struct sal_entrypoint_descriptor entry; - struct sal_ap_wakeup_descriptor wakeup; -} sal_systab = { - /* Header. */ - { - SAL_SIGNATURE, - sizeof(sal_systab), - { 00, 03 }, /* Revision 3.0. */ - 2, /* Number of decsriptors. */ - 0, /* XXX checksum. */ - { 0 }, - { 00, 00 }, /* XXX SAL_A version. */ - { 00, 00 }, /* XXX SAL_B version. */ - "FreeBSD", - "Ski loader", - { 0 } - }, - /* Entrypoint. */ - { - 0, /* Type=entrypoint descr. */ - { 0 }, - 0, /* XXX PalProc. */ - 0, /* XXX SalProc. */ - 0, /* XXX SalProc GP. */ - { 0 } - }, - /* AP wakeup. */ - { - 5, /* Type=AP wakeup descr. */ - 0, /* External interrupt. */ - { 0 }, - 255 /* Wakeup vector. */ - } -}; - -static inline void -puts(const char *s) -{ - s = (const char *)((7UL << 61) | (u_long)s); - while (*s) - ski_cons_putchar(*s++); -} - -static struct ia64_sal_result -SalProc(u_int64_t a1, u_int64_t a2, u_int64_t a3, u_int64_t a4, u_int64_t a5, - u_int64_t a6, u_int64_t a7, u_int64_t a8) -{ - struct ia64_sal_result res; - - res.sal_status = -3; - res.sal_result[0] = 0; - res.sal_result[1] = 0; - res.sal_result[2] = 0; - - if (a1 == SAL_FREQ_BASE) { - res.sal_status = 0; - res.sal_result[0] = 133338184; - } else if (a1 == SAL_SET_VECTORS) { - /* XXX unofficial SSC function. */ - ssc(a2, a3, a4, a5, SSC_SAL_SET_VECTORS); - } else if (a1 != SAL_GET_STATE_INFO_SIZE) { - puts("SAL: unimplemented function called\n"); - } - - return (res); -} - -void -sal_stub_init(void) -{ - struct ia64_fdesc *fd; - - fd = (void*)PalProc; - sal_systab.entry.sale_pal_proc = fd->func; - fd = (void*)SalProc; - sal_systab.entry.sale_sal_proc = fd->func; - sal_systab.entry.sale_sal_gp = fd->gp; -} diff --git a/sys/boot/ia64/ski/skiconsole.c b/sys/boot/ia64/ski/skiconsole.c deleted file mode 100644 index e5cea3dc993..00000000000 --- a/sys/boot/ia64/ski/skiconsole.c +++ /dev/null @@ -1,96 +0,0 @@ -/*- - * Copyright (c) 2000 Doug Rabson - * 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 "bootstrap.h" -#include "libski.h" - -static void -ski_cons_probe(struct console *cp) -{ - cp->c_flags |= C_PRESENTIN | C_PRESENTOUT; -} - -static int -ski_cons_init(int arg) -{ - ssc(0, 0, 0, 0, SSC_CONSOLE_INIT); - return 0; -} - -void -ski_cons_putchar(int c) -{ - ssc(c, 0, 0, 0, SSC_PUTCHAR); -} - -static int pollchar = -1; - -int -ski_cons_getchar() -{ - int c; - - if (pollchar > 0) { - c = pollchar; - pollchar = -1; - return c; - } - - do { - c = ssc(0, 0, 0, 0, SSC_GETCHAR); - } while (c == 0); - - return c; -} - -int -ski_cons_poll() -{ - int c; - if (pollchar > 0) - return 1; - c = ssc(0, 0, 0, 0, SSC_GETCHAR); - if (!c) - return 0; - pollchar = c; - return 1; -} - -struct console ski_console = { - "ski", - "ia64 SKI console", - 0, - ski_cons_probe, - ski_cons_init, - ski_cons_putchar, - ski_cons_getchar, - ski_cons_poll -}; diff --git a/sys/boot/ia64/ski/skifs.c b/sys/boot/ia64/ski/skifs.c deleted file mode 100644 index 72276feba6c..00000000000 --- a/sys/boot/ia64/ski/skifs.c +++ /dev/null @@ -1,194 +0,0 @@ -/*- - * Copyright (c) 2001 Doug Rabson - * 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 "libski.h" - -struct disk_req { - unsigned long addr; - unsigned len; -}; - -struct disk_stat { - int fd; - unsigned count; -}; - -static int -skifs_open(const char *path, struct open_file *f) -{ - int fd; - - /* - * Skip leading '/' so that our pretend filesystem starts in - * the current working directory. - */ - while (*path == '/') - path++; - - fd = ssc((u_int64_t) path, 1, 0, 0, SSC_OPEN); - if (fd > 0) { - f->f_fsdata = (void*)(u_int64_t) fd; - return 0; - } - return ENOENT; -} - -static int -skifs_close(struct open_file *f) -{ - ssc((u_int64_t) f->f_fsdata, 0, 0, 0, SSC_CLOSE); - return 0; -} - -static int -skifs_read(struct open_file *f, void *buf, size_t size, size_t *resid) -{ - struct disk_req req; - struct disk_stat stat; - - req.len = size; - req.addr = (u_int64_t) buf; - ssc((u_int64_t) f->f_fsdata, 1, (u_int64_t) &req, f->f_offset, SSC_READ); - stat.fd = (u_int64_t) f->f_fsdata; - ssc((u_int64_t)&stat, 0, 0, 0, SSC_WAIT_COMPLETION); - - *resid = size - stat.count; - f->f_offset += stat.count; - return 0; -} - -static off_t -skifs_seek(struct open_file *f, off_t offset, int where) -{ - u_int64_t base; - - switch (where) { - case SEEK_SET: - base = 0; - break; - - case SEEK_CUR: - base = f->f_offset; - break; - - case SEEK_END: - printf("can't find end of file in SKI\n"); - base = f->f_offset; - break; - } - - f->f_offset = base + offset; - return base; -} - -static int -skifs_stat(struct open_file *f, struct stat *sb) -{ - bzero(sb, sizeof(*sb)); - sb->st_mode = S_IFREG | S_IRUSR; - return 0; -} - -static int -skifs_readdir(struct open_file *f, struct dirent *d) -{ - return ENOENT; -} - -struct fs_ops ski_fsops = { - "fs", - skifs_open, - skifs_close, - skifs_read, - null_write, - skifs_seek, - skifs_stat, - skifs_readdir -}; - -static int -skifs_dev_init(void) -{ - return 0; -} - -/* - * Print information about disks - */ -static void -skifs_dev_print(int verbose) -{ -} - -/* - * Attempt to open the disk described by (dev) for use by (f). - * - * Note that the philosophy here is "give them exactly what - * they ask for". This is necessary because being too "smart" - * about what the user might want leads to complications. - * (eg. given no slice or partition value, with a disk that is - * sliced - are they after the first BSD slice, or the DOS - * slice before it?) - */ -static int -skifs_dev_open(struct open_file *f, ...) -{ - return 0; -} - -static int -skifs_dev_close(struct open_file *f) -{ - - return 0; -} - -static int -skifs_dev_strategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, size_t *rsize) -{ - return 0; -} - -struct devsw skifs_dev = { - "fs", - DEVT_DISK, - skifs_dev_init, - skifs_dev_strategy, - skifs_dev_open, - skifs_dev_close, - noioctl, - skifs_dev_print -}; diff --git a/sys/boot/ia64/ski/skiload.cmd b/sys/boot/ia64/ski/skiload.cmd deleted file mode 100644 index 48b77e1e40b..00000000000 --- a/sys/boot/ia64/ski/skiload.cmd +++ /dev/null @@ -1,16 +0,0 @@ -# $FreeBSD$ -iar -fr -pa -b enter_kernel -c -b printf -c -b rp -c -b ssc -c -b rp -c -bD -s 11 diff --git a/sys/boot/ia64/ski/skimd.c b/sys/boot/ia64/ski/skimd.c deleted file mode 100644 index baa31382a95..00000000000 --- a/sys/boot/ia64/ski/skimd.c +++ /dev/null @@ -1,82 +0,0 @@ -/*- - * Copyright (c) 2006 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 - -#include - -#include "libski.h" - -extern void acpi_stub_init(void); -extern void efi_stub_init(struct bootinfo *); -extern void sal_stub_init(void); - -vm_paddr_t -ia64_platform_alloc(vm_offset_t va, vm_size_t sz __unused) -{ - vm_paddr_t pa; - - if (va == 0) - pa = 2 * 1024 * 1024; - else - pa = (va - IA64_PBVM_BASE) + (32 * 1024 * 1024); - - return (pa); -} - -void -ia64_platform_free(vm_offset_t va __unused, vm_paddr_t pa __unused, - vm_size_t sz __unused) -{ -} - -int -ia64_platform_bootinfo(struct bootinfo *bi, struct bootinfo **res) -{ - static struct bootinfo bootinfo; - - efi_stub_init(bi); - sal_stub_init(); - acpi_stub_init(); - - if (IS_LEGACY_KERNEL()) - *res = &bootinfo; - - return (0); -} - -int -ia64_platform_enter(const char *kernel) -{ - - while (*kernel == '/') - kernel++; - ssc(0, (uint64_t)kernel, 0, 0, SSC_LOAD_SYMBOLS); - return (0); -} diff --git a/sys/boot/ia64/ski/ssc.c b/sys/boot/ia64/ski/ssc.c deleted file mode 100644 index e1f871c4d5c..00000000000 --- a/sys/boot/ia64/ski/ssc.c +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * Copyright (c) 2001 Doug Rabson - * 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 "libski.h" - -/* - * Ugh... Work around a bug in the Linux version of ski for SSC_GET_RTC. The - * PSR.dt register is not preserved properly and causes further memory - * references to be done without translation. All we need to do is preserve - * PSR.dt across the SSC call. We do this by saving and restoring psr.l - * completely. - */ -u_int64_t -ssc(u_int64_t in0, u_int64_t in1, u_int64_t in2, u_int64_t in3, int which) -{ - register u_int64_t psr; - register u_int64_t ret0 __asm("r8"); - - __asm __volatile("mov %0=psr;;" : "=r"(psr)); - __asm __volatile("mov r15=%1\n\t" - "break 0x80000;;" - : "=r"(ret0) - : "r"(which), "r"(in0), "r"(in1), "r"(in2), "r"(in3)); - __asm __volatile("mov psr.l=%0;; srlz.d" :: "r"(psr)); - return ret0; -} diff --git a/sys/boot/ia64/ski/start.S b/sys/boot/ia64/ski/start.S deleted file mode 100644 index 0bd10e928d0..00000000000 --- a/sys/boot/ia64/ski/start.S +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * Copyright (c) 2003 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. - * - * $FreeBSD$ - */ - -#define STACKSIZE 16384 -#define FPSR_DEFAULT 0x0009804c0270033f - - .text - .global _start - .proc _start -_start: -{ .mlx - mov ar.rsc=0 - movl gp=__gp - ;; -} -{ .mlx - add r2=@gprel(stack),gp - movl r14=FPSR_DEFAULT - ;; -} -{ .mib - mov ar.bspstore=r2 - add r12=STACKSIZE-16,r2 - bsw.1 - ;; -} -{ .mmb - mov ar.rsc=3 - mov ar.fpsr=r14 - br.sptk ski_main - ;; -} - .endp _start - - .data - .align 16 -stack: .skip STACKSIZE diff --git a/sys/boot/ia64/ski/time.c b/sys/boot/ia64/ski/time.c deleted file mode 100644 index 7aa71202d10..00000000000 --- a/sys/boot/ia64/ski/time.c +++ /dev/null @@ -1,174 +0,0 @@ -/*- - * Copyright (c) 1999, 2000 - * Intel Corporation. - * 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 Intel Corporation and - * its contributors. - * - * 4. Neither the name of Intel Corporation or its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION 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 INTEL CORPORATION 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 "libski.h" - -/* -// Accurate only for the past couple of centuries; -// that will probably do. -// -// (#defines From FreeBSD 3.2 lib/libc/stdtime/tzfile.h) -*/ - -#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) -#define SECSPERHOUR ( 60*60 ) -#define SECSPERDAY (24 * SECSPERHOUR) - -struct ssc_time { - int Year; - int Month; - int Day; - int Hour; - int Minute; - int Second; - int Msec; - int Wday; -}; - -time_t -EfiTimeToUnixTime(struct ssc_time *ETime) -{ - /* - // These arrays give the cumulative number of days up to the first of the - // month number used as the index (1 -> 12) for regular and leap years. - // The value at index 13 is for the whole year. - */ - static time_t CumulativeDays[2][14] = { - {0, - 0, - 31, - 31 + 28, - 31 + 28 + 31, - 31 + 28 + 31 + 30, - 31 + 28 + 31 + 30 + 31, - 31 + 28 + 31 + 30 + 31 + 30, - 31 + 28 + 31 + 30 + 31 + 30 + 31, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31 }, - {0, - 0, - 31, - 31 + 29, - 31 + 29 + 31, - 31 + 29 + 31 + 30, - 31 + 29 + 31 + 30 + 31, - 31 + 29 + 31 + 30 + 31 + 30, - 31 + 29 + 31 + 30 + 31 + 30 + 31, - 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31, - 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30, - 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31, - 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30, - 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31 }}; - - time_t UTime; - int Year; - - ETime->Year += 1900; - - /* - // Do a santity check - */ - if ( ETime->Year < 1998 || ETime->Year > 2099 || - ETime->Month == 0 || ETime->Month > 12 || - ETime->Day == 0 || ETime->Month > 31 || - ETime->Hour > 23 || - ETime->Minute > 59 || - ETime->Second > 59 ) { - return (0); - } - - /* - // Years - */ - UTime = 0; - for (Year = 1970; Year != ETime->Year; ++Year) { - UTime += (CumulativeDays[isleap(Year)][13] * SECSPERDAY); - } - - /* - // UTime should now be set to 00:00:00 on Jan 1 of the file's year. - // - // Months - */ - UTime += (CumulativeDays[isleap(ETime->Year)][ETime->Month] * SECSPERDAY); - - /* - // UTime should now be set to 00:00:00 on the first of the file's month and year - // - // Days -- Don't count the file's day - */ - UTime += (((ETime->Day > 0) ? ETime->Day-1:0) * SECSPERDAY); - - /* - // Hours - */ - UTime += (ETime->Hour * SECSPERHOUR); - - /* - // Minutes - */ - UTime += (ETime->Minute * 60); - - /* - // Seconds - */ - UTime += ETime->Second; - - return UTime; -} - -time_t -time(time_t *tloc) -{ - struct ssc_time time; - - ssc((u_int64_t) &time, 0, 0, 0, SSC_GET_RTC); - - return *tloc = EfiTimeToUnixTime(&time); -} diff --git a/sys/boot/ia64/ski/version b/sys/boot/ia64/ski/version deleted file mode 100644 index a5b40f5de17..00000000000 --- a/sys/boot/ia64/ski/version +++ /dev/null @@ -1,12 +0,0 @@ -$FreeBSD$ - -NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this -file is important. Make sure the current version number is on line 6. - -2.0: Add support for PBVM. -1.2: Restructured. Has some user visible differences. Due to code - sharing, has been given the same version number as the EFI - loader. -0.2: Pass the address of the bootinfo block to the kernel in register - r8. Keep it at the hardwired address for now. -0.1: Initial SKI version. diff --git a/sys/boot/libstand32/Makefile b/sys/boot/libstand32/Makefile index 56f7d153678..30b9ca92ea1 100644 --- a/sys/boot/libstand32/Makefile +++ b/sys/boot/libstand32/Makefile @@ -60,12 +60,10 @@ SRCS+= ntoh.c # string functions from libc .PATH: ${LIBC}/string -.if ${MACHINE_CPUARCH} != "ia64" SRCS+= bcmp.c bcopy.c bzero.c ffs.c memccpy.c memchr.c memcmp.c memcpy.c \ memmove.c memset.c qdivrem.c strcat.c strchr.c strcmp.c strcpy.c \ strcspn.c strlen.c strncat.c strncmp.c strncpy.c strpbrk.c \ strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c -.endif .if ${MACHINE_CPUARCH} == "arm" .PATH: ${LIBC}/arm/gen @@ -85,17 +83,6 @@ SRCS+= aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S SRCS+= aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S .endif -.endif -.if ${MACHINE_CPUARCH} == "ia64" -.PATH: ${LIBC}/ia64/string -SRCS+= bcmp.c bcopy.S bzero.S ffs.S memccpy.c memchr.c memcmp.c memcpy.S \ - memmove.S memset.c strcat.c strchr.c strcmp.c strcpy.c strcspn.c \ - strlen.c strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \ - strspn.c strstr.c strtok.c swab.c - -.PATH: ${LIBC}/ia64/gen -SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S -SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S .endif .if ${MACHINE_CPUARCH} == "powerpc" .PATH: ${LIBC}/quad @@ -186,11 +173,8 @@ SRCS+= nandfs.c .include .if ${MACHINE_CPUARCH} == "amd64" +CLEANFILES+= machine beforedepend ${OBJS}: machine -cleandepend: cleanmachine -cleanmachine: - rm -f machine - machine: - ln -s ${.CURDIR}/../../i386/include machine + ln -fs ${.CURDIR}/../../i386/include machine .endif diff --git a/sys/boot/mips/beri/boot2/Makefile b/sys/boot/mips/beri/boot2/Makefile index 325edbcdbe5..b4258c0c030 100644 --- a/sys/boot/mips/beri/boot2/Makefile +++ b/sys/boot/mips/beri/boot2/Makefile @@ -32,6 +32,8 @@ BINDIR?= /boot INSTALLFLAGS= -b +NO_PIE= yes + LOADERS= flashboot jtagboot FILES= ${LOADERS} ${LOADERS:S/$/.md5/} @@ -71,7 +73,7 @@ LDFLAGS= -nostdlib \ CFLAGS+= -I${.CURDIR}/../common flashboot.elf: relocate.o start.o boot2.o altera_jtag_uart.o cfi.o sdcard.o - ${LD} ${LDFLAGS} -T ${.CURDIR}/flashboot.ldscript -o ${.TARGET} \ + ${LD} ${_LDFLAGS} -T ${.CURDIR}/flashboot.ldscript -o ${.TARGET} \ ${.ALLSRC} ${LIBSTAND} flashboot: flashboot.elf objcopy -S -O binary ${.TARGET}.elf ${.TARGET} @@ -79,7 +81,7 @@ flashboot.md5: flashboot md5 flashboot > flashboot.md5 jtagboot: start.o boot2.o altera_jtag_uart.o cfi.o sdcard.o - ${LD} ${LDFLAGS} -T ${.CURDIR}/jtagboot.ldscript -o ${.TARGET} \ + ${LD} ${_LDFLAGS} -T ${.CURDIR}/jtagboot.ldscript -o ${.TARGET} \ ${.ALLSRC} ${LIBSTAND} jtagboot.md5: jtagboot md5 jtagboot > jtagboot.md5 diff --git a/sys/boot/mips/beri/loader/Makefile b/sys/boot/mips/beri/loader/Makefile index fed224712cc..3a751894f65 100644 --- a/sys/boot/mips/beri/loader/Makefile +++ b/sys/boot/mips/beri/loader/Makefile @@ -36,6 +36,8 @@ PROG?= loader NEWVERSWHAT= "BERI loader" ${MACHINE_CPUARCH} INSTALLFLAGS= -b +NO_PIE= yes + # Architecture-specific loader code SRCS= start.S \ main.c \ @@ -136,6 +138,17 @@ FILES+= loader.rc FILES+= menu.rc .endif +.if defined(LOADER_USB_SUPPORT) +# Do garbage collection +CFLAGS+= -ffunction-sections -fdata-sections +CFLAGS+= -Wl,--gc-sections +# Link USB BOOT library +LDADD+= ${.OBJDIR}/../../../usb/libusbboot.a +CFLAGS+= -I${.CURDIR}/../../../usb +# Define USB SUPPORT +CFLAGS+= -DLOADER_USB_SUPPORT +.endif + all: loader .include diff --git a/sys/boot/mips/beri/loader/loader.ldscript b/sys/boot/mips/beri/loader/loader.ldscript index 769bbbe15bc..4d1c82ddd4f 100644 --- a/sys/boot/mips/beri/loader/loader.ldscript +++ b/sys/boot/mips/beri/loader/loader.ldscript @@ -58,11 +58,16 @@ SECTIONS . += SIZEOF_HEADERS; .text ALIGN(0x8): { - start.o(.text) - *(EXCLUDE_FILE (start.o) .text) + start.o(.text*) + *(EXCLUDE_FILE (start.o) .text*) + *(.rodata*) + + __start_set_Xcommand_set = .; + KEEP(*(set_Xcommand_set)) + __stop_set_Xcommand_set = .; } - .data ALIGN(0x8): { *(.data)} - .bss ALIGN(0x8): { *(.bss) } + .data ALIGN(0x8): { *(.data*)} + .bss ALIGN(0x8): { *(.bss*) } __heap = ALIGN(0x8); /* 64-bit aligned heap pointer */ __data_end = .; diff --git a/sys/boot/mips/beri/loader/main.c b/sys/boot/mips/beri/loader/main.c index 81d3248de46..8253fb261d2 100644 --- a/sys/boot/mips/beri/loader/main.c +++ b/sys/boot/mips/beri/loader/main.c @@ -43,12 +43,19 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef LOADER_USB_SUPPORT +#include +#endif + static int __elfN(exec)(struct preloaded_file *); static void extract_currdev(struct bootinfo *); struct devsw *devsw[] = { &beri_cfi_disk, &beri_sdcard_disk, +#ifdef LOADER_USB_SUPPORT + &umass_disk, +#endif NULL }; @@ -144,7 +151,7 @@ main(int argc, char *argv[], char *envv[], struct bootinfo *bootinfop) printf("bootpath=\"%s\"\n", bootpath); #endif - interact(); + interact(NULL); return (0); } @@ -215,13 +222,25 @@ time(time_t *tloc) } /* - * Delay - presumably in usecs? + * Delay - in usecs + * + * NOTE: We are assuming that the CPU is running at 100MHz. */ void delay(int usecs) { - register_t t; + uint32_t delta; + uint32_t curr; + uint32_t last; - t = cp0_count_get() + usecs * 100; - while (cp0_count_get() < t); + last = cp0_count_get(); + while (usecs > 0) { + curr = cp0_count_get(); + delta = curr - last; + while (usecs > 0 && delta >= 100) { + usecs--; + last += 100; + delta -= 100; + } + } } diff --git a/sys/boot/ofw/common/main.c b/sys/boot/ofw/common/main.c index 940ca63b726..eb8ae0c08c8 100644 --- a/sys/boot/ofw/common/main.c +++ b/sys/boot/ofw/common/main.c @@ -162,7 +162,7 @@ main(int (*openfirm)(void *)) archsw.arch_readin = ofw_readin; archsw.arch_autoload = ofw_autoload; - interact(); /* doesn't return */ + interact(NULL); /* doesn't return */ OF_exit(); diff --git a/sys/boot/pc98/boot2/Makefile b/sys/boot/pc98/boot2/Makefile index 88076a8e5af..1657cad2b48 100644 --- a/sys/boot/pc98/boot2/Makefile +++ b/sys/boot/pc98/boot2/Makefile @@ -3,8 +3,10 @@ .include # XXX: clang can compile the boot code just fine, but boot2 gets too big -CC:= gcc -COMPILER_TYPE:= gcc +#CC:= gcc +#COMPILER_TYPE:= gcc + +NO_PIE= yes FILES= boot boot1 boot2 @@ -24,10 +26,7 @@ BOOT2_UFS?= UFS1_AND_UFS2 #BOOT2_UFS?= UFS1_ONLY CFLAGS= -Os \ - -fno-guess-branch-probability \ -fomit-frame-pointer \ - -fno-unit-at-a-time \ - -mno-align-long-strings \ -mrtd \ -mregparm=3 \ -D${BOOT2_UFS} \ @@ -44,7 +43,10 @@ CFLAGS= -Os \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ -Winline -CFLAGS.gcc+= --param max-inline-insns-single=100 +CFLAGS.gcc+= -fno-guess-branch-probability \ + -fno-unit-at-a-time \ + -mno-align-long-strings \ + --param max-inline-insns-single=100 # Set machine type to PC98_SYSTEM_PARAMETER #CFLAGS+= -DSET_MACHINE_TYPE @@ -52,6 +54,8 @@ CFLAGS.gcc+= --param max-inline-insns-single=100 # Initialize the bi_bios_geom using the BIOS geometry #CFLAGS+= -DGET_BIOSGEOM +CFLAGS.clang+=${CLANG_OPT_SMALL} + LD_FLAGS=-static -N --gc-sections # Pick up ../Makefile.inc early. @@ -110,3 +114,6 @@ boot2.h: boot1.out REL1=`printf "%d" ${REL1}` > ${.TARGET} .include + +# XXX: clang integrated-as doesn't grok .codeNN directives yet +CFLAGS+= ${CLANG_NO_IAS} diff --git a/sys/boot/pc98/boot2/boot2.c b/sys/boot/pc98/boot2/boot2.c index 3d3e5d28671..69a422e5cb4 100644 --- a/sys/boot/pc98/boot2/boot2.c +++ b/sys/boot/pc98/boot2/boot2.c @@ -36,9 +36,22 @@ __FBSDID("$FreeBSD$"); #include "boot2.h" #include "lib.h" +/* Define to 0 to omit serial support */ +#ifndef SERIAL +#define SERIAL 0 +#endif + #define IO_KEYBOARD 1 #define IO_SERIAL 2 +#if SERIAL +#define DO_KBD (ioctrl & IO_KEYBOARD) +#define DO_SIO (ioctrl & IO_SERIAL) +#else +#define DO_KBD (1) +#define DO_SIO (0) +#endif + #define SECOND 1 /* Circa that many ticks in a second. */ #define RBX_ASKNAME 0x0 /* -a */ @@ -133,9 +146,11 @@ static struct dsk { static char cmd[512], cmddup[512], knamebuf[1024]; static const char *kname; static uint32_t opts; -static int comspeed = SIOSPD; static struct bootinfo bootinfo; +#if SERIAL +static int comspeed = SIOSPD; static uint8_t ioctrl = IO_KEYBOARD; +#endif void exit(int); static void load(void); @@ -415,7 +430,7 @@ main(void) "boot: ", dsk.unit, dev_nm[dsk.type], dsk.unit, 'a' + dsk.part, kname); - if (ioctrl & IO_SERIAL) + if (DO_SIO) sio_flush(); if (!autoboot || keyhit(3*SECOND)) getstr(); @@ -537,6 +552,7 @@ parse() } printf("Keyboard: %s\n", cp); continue; +#if SERIAL } else if (c == 'S') { j = 0; while ((unsigned int)(i = *arg++ - '0') <= 9) @@ -546,18 +562,21 @@ parse() break; } /* Fall through to error below ('S' not in optstr[]). */ +#endif } for (i = 0; c != optstr[i]; i++) if (i == NOPT - 1) return -1; opts ^= OPT_SET(flags[i]); } +#if SERIAL ioctrl = OPT_CHECK(RBX_DUAL) ? (IO_SERIAL|IO_KEYBOARD) : OPT_CHECK(RBX_SERIAL) ? IO_SERIAL : IO_KEYBOARD; - if (ioctrl & IO_SERIAL) { + if (DO_SIO) { if (sio_init(115200 / comspeed) != 0) ioctrl &= ~IO_SERIAL; } +#endif } else { for (q = arg--; *q && *q != '('; q++); if (*q) { @@ -780,9 +799,9 @@ keyhit(unsigned sec) static int xputc(int c) { - if (ioctrl & IO_KEYBOARD) + if (DO_KBD) putc(c); - if (ioctrl & IO_SERIAL) + if (DO_SIO) sio_putc(c); return c; } @@ -805,9 +824,9 @@ xgetc(int fn) if (OPT_CHECK(RBX_NOINTR)) return 0; for (;;) { - if (ioctrl & IO_KEYBOARD && getc(1)) + if (DO_KBD && getc(1)) return fn ? 1 : getc(0); - if (ioctrl & IO_SERIAL && sio_ischar()) + if (DO_SIO && sio_ischar()) return fn ? 1 : sio_getc(); if (fn) return 0; diff --git a/sys/boot/pc98/btx/lib/Makefile b/sys/boot/pc98/btx/lib/Makefile index e5876bc1371..9e2b8c6f5d1 100644 --- a/sys/boot/pc98/btx/lib/Makefile +++ b/sys/boot/pc98/btx/lib/Makefile @@ -7,4 +7,6 @@ SRCS= btxcsu.S btxsys.s btxv86.s CFLAGS+=-I${.CURDIR}/../../../i386/common LDFLAGS=-Wl,-r +NO_PIE= yes + .include diff --git a/sys/boot/pc98/loader/Makefile b/sys/boot/pc98/loader/Makefile index 7ab13a189dd..f18db055f54 100644 --- a/sys/boot/pc98/loader/Makefile +++ b/sys/boot/pc98/loader/Makefile @@ -8,6 +8,8 @@ PROG= ${LOADER}.sym INTERNALPROG= NEWVERSWHAT= "bootstrap loader" pc98 +NO_PIE= yes + # architecture-specific loader code SRCS= main.c conf.c vers.c .PATH: ${.CURDIR}/../../i386/loader diff --git a/sys/boot/pc98/loader/main.c b/sys/boot/pc98/loader/main.c index 75690c720d7..da9bca55fba 100644 --- a/sys/boot/pc98/loader/main.c +++ b/sys/boot/pc98/loader/main.c @@ -193,7 +193,7 @@ main(void) extract_currdev(); /* set $currdev and $loaddev */ setenv("LINES", "24", 1); /* optional */ - interact(); /* doesn't return */ + interact(NULL); /* doesn't return */ /* if we ever get here, it is an error */ return (1); diff --git a/sys/boot/powerpc/ps3/main.c b/sys/boot/powerpc/ps3/main.c index 64bd7e9f9a2..86ce62ebfac 100644 --- a/sys/boot/powerpc/ps3/main.c +++ b/sys/boot/powerpc/ps3/main.c @@ -145,7 +145,7 @@ main(void) setenv("LINES", "24", 1); setenv("hw.platform", "ps3", 1); - interact(); /* doesn't return */ + interact(NULL); /* doesn't return */ return (0); } diff --git a/sys/boot/sparc64/boot1/Makefile b/sys/boot/sparc64/boot1/Makefile index 5150c3b5f85..c867a616294 100644 --- a/sys/boot/sparc64/boot1/Makefile +++ b/sys/boot/sparc64/boot1/Makefile @@ -7,6 +7,8 @@ FILES?= boot1 SRCS= _start.s boot1.c CLEANFILES=${FILES} boot1.aout +NO_PIE= yes + BOOTBLOCKBASE= 0x4000 CFLAGS.clang+=-mcmodel=small diff --git a/sys/boot/sparc64/loader/Makefile b/sys/boot/sparc64/loader/Makefile index d7266ad0878..00c37dc4095 100644 --- a/sys/boot/sparc64/loader/Makefile +++ b/sys/boot/sparc64/loader/Makefile @@ -7,6 +7,8 @@ PROG?= loader NEWVERSWHAT?= "bootstrap loader" sparc64 INSTALLFLAGS= -b +NO_PIE= yes + # Architecture-specific loader code SRCS= locore.S main.c metadata.c vers.c diff --git a/sys/boot/sparc64/loader/main.c b/sys/boot/sparc64/loader/main.c index 1cdcaeec38f..44c4d212a52 100644 --- a/sys/boot/sparc64/loader/main.c +++ b/sys/boot/sparc64/loader/main.c @@ -897,7 +897,7 @@ main(int (*openfirm)(void *)) printf("bootpath=\"%s\"\n", bootpath); /* Give control to the machine independent loader code. */ - interact(); + interact(NULL); return (1); } diff --git a/sys/boot/uboot/common/main.c b/sys/boot/uboot/common/main.c index 16cea239578..288a02d14ce 100644 --- a/sys/boot/uboot/common/main.c +++ b/sys/boot/uboot/common/main.c @@ -492,7 +492,7 @@ main(void) archsw.arch_readin = uboot_readin; archsw.arch_autoload = uboot_autoload; - interact(); /* doesn't return */ + interact(NULL); /* doesn't return */ return (0); } diff --git a/sys/boot/usb/Makefile b/sys/boot/usb/Makefile index 3e8c83e1373..cd4dec000a6 100644 --- a/sys/boot/usb/Makefile +++ b/sys/boot/usb/Makefile @@ -30,6 +30,7 @@ S=${.CURDIR}/../.. .PATH: \ ${.CURDIR} \ + ${.CURDIR}/storage \ ${S}/dev/usb \ ${S}/dev/usb/controller \ ${S}/dev/usb/serial \ @@ -39,7 +40,7 @@ S=${.CURDIR}/../.. LIB= usbboot INTERNALLIB= OBJCOPY?= objcopy -SYSCC?= cc +SYSCC?= /usr/bin/cc CFLAGS+= -DBOOTPROG=\"usbloader\" CFLAGS+= -DUSB_GLOBAL_INCLUDE_FILE=\"bsd_global.h\" @@ -49,7 +50,12 @@ CFLAGS+= -Wformat -Wall CFLAGS+= -I${S} CFLAGS+= -I${T} CFLAGS+= -I${.CURDIR} +CFLAGS+= -I${.CURDIR}/../common CFLAGS+= -g +CFLAGS+= -DUSB_MSCTEST_BULK_SIZE=65536 +CFLAGS+= -DUSB_POOL_SIZE=131072 +CFLAGS+= -fno-pic +CFLAGS+= -DHAVE_ENDIAN_DEFS .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" CFLAGS+= -march=i386 @@ -58,6 +64,9 @@ CFLAGS.gcc+= -mpreferred-stack-boundary=2 .if ${MACHINE_CPUARCH} == "amd64" CFLAGS+= -m32 .endif +.if ${MACHINE_CPUARCH} == "mips" +CFLAGS+= -mno-abicalls +.endif # # Single threaded BSD kernel @@ -77,19 +86,66 @@ SRCS+= usb_busdma_loader.c # # USB controller drivers # -SRCS+= at91dci.c -SRCS+= atmegadci.c -SRCS+= avr32dci.c -SRCS+= dwc_otg.c -SRCS+= ehci.c -SRCS+= musb_otg.c -SRCS+= ohci.c -SRCS+= uhci.c -SRCS+= uss820dci.c -SRCS+= xhci.c + SRCS+= usb_controller.c -CFLAGS += -DUSB_PROBE_LIST="\"xhci\", \"ehci\", \"uhci\", \"ohci\"" +.if defined(HAVE_AT91DCI) +CFLAGS += -DUSB_PCI_PROBE_LIST="\"at91dci\"" +SRCS+= at91dci.c +.endif + +.if defined(HAVE_ATMEGADCI) +CFLAGS += -DUSB_PCI_PROBE_LIST="\"atmegadci\"" +SRCS+= atmegadci.c +.endif + +.if defined(HAVE_AVR32DCI) +CFLAGS += -DUSB_PCI_PROBE_LIST="\"avr32dci\"" +SRCS+= avr32dci.c +.endif + +.if defined(HAVE_DWCOTG) +CFLAGS += -DUSB_PCI_PROBE_LIST="\"dwcotg\"" +SRCS+= dwcotg.c +.endif + +.if defined(HAVE_MUSBOTG) +CFLAGS += -DUSB_PCI_PROBE_LIST="\"musbotg\"" +SRCS+= musbotg.c +.endif + +.if defined(HAVE_EHCI) +CFLAGS += -DUSB_PCI_PROBE_LIST="\"ehci\"" +SRCS+= ehci.c +.endif + +.if defined(HAVE_OHCI) +CFLAGS += -DUSB_PCI_PROBE_LIST="\"ohci\"" +SRCS+= ohci.c +.endif + +.if defined(HAVE_UHCI) +CFLAGS += -DUSB_PCI_PROBE_LIST="\"uhci\"" +SRCS+= uhci.c +.endif + +.if defined(HAVE_XHCI) +CFLAGS += -DUSB_PCI_PROBE_LIST="\"xhci\"" +SRCS+= xhci.c +.endif + +.if defined(HAVE_USS820DCI) +CFLAGS += -DUSB_PCI_PROBE_LIST="\"uss820dci\"" +SRCS+= uss820dci.c +.endif + +.if defined(HAVE_SAF1761OTG) +CFLAGS += -DUSB_PCI_PROBE_LIST="\"saf1761otg\"" +CFLAGS += -DUSB_PCI_MEMORY_ADDRESS=0x900000007f100000ULL +CFLAGS += -DUSB_PCI_MEMORY_SIZE=0x40000U +SRCS+= saf1761_otg.c +SRCS+= saf1761_otg_boot.c +.endif # # USB core and templates @@ -119,6 +175,15 @@ SRCS+= usb_template_audio.c SRCS+= sysinit_data.c SRCS+= sysuninit_data.c +# +# USB mass storage support +# +SRCS+= umass_common.c + +.if defined(HAVE_UMASS_LOADER) +SRCS+= umass_loader.c +.endif + CLEANFILES+= sysinit CLEANFILES+= sysinit.bin CLEANFILES+= sysinit_data.c diff --git a/sys/boot/usb/bsd_kernel.c b/sys/boot/usb/bsd_kernel.c index d3daa63f26f..d41b9f4dc0d 100644 --- a/sys/boot/usb/bsd_kernel.c +++ b/sys/boot/usb/bsd_kernel.c @@ -380,8 +380,10 @@ device_get_parent(device_t dev) } void -device_set_interrupt(device_t dev, intr_fn_t *fn, void *arg) +device_set_interrupt(device_t dev, driver_filter_t *filter, + driver_intr_t *fn, void *arg) { + dev->dev_irq_filter = filter; dev->dev_irq_fn = fn; dev->dev_irq_arg = arg; } @@ -395,8 +397,16 @@ device_run_interrupts(device_t parent) return; TAILQ_FOREACH(child, &parent->dev_children, dev_link) { - if (child->dev_irq_fn != NULL) - (child->dev_irq_fn) (child->dev_irq_arg); + int status; + if (child->dev_irq_filter != NULL) + status = child->dev_irq_filter(child->dev_irq_arg); + else + status = FILTER_SCHEDULE_THREAD; + + if (status == FILTER_SCHEDULE_THREAD) { + if (child->dev_irq_fn != NULL) + (child->dev_irq_fn) (child->dev_irq_arg); + } } } @@ -1081,6 +1091,7 @@ usb_proc_mwait(struct usb_process *up, void *_pm0, void *_pm1) * SYSTEM attach *------------------------------------------------------------------------*/ +#ifdef USB_PCI_PROBE_LIST static device_method_t pci_methods[] = { DEVMETHOD_END }; @@ -1095,9 +1106,7 @@ static devclass_t pci_devclass; DRIVER_MODULE(pci, pci, pci_driver, pci_devclass, 0, 0); static const char *usb_pci_devices[] = { -#ifdef USB_PROBE_LIST - USB_PROBE_LIST -#endif + USB_PCI_PROBE_LIST }; #define USB_PCI_USB_MAX (sizeof(usb_pci_devices) / sizeof(void *)) @@ -1140,11 +1149,13 @@ usb_pci_mod_unload(void *arg) device_delete_child(NULL, usb_pci_root); } SYSUNINIT(usb_pci_mod_unload, SI_SUB_RUN_SCHEDULER, SI_ORDER_MIDDLE, usb_pci_mod_unload, 0); +#endif /*------------------------------------------------------------------------* * MALLOC API *------------------------------------------------------------------------*/ +#ifndef HAVE_MALLOC #define USB_POOL_ALIGN 8 static uint8_t usb_pool[USB_POOL_SIZE] __aligned(USB_POOL_ALIGN); @@ -1173,7 +1184,7 @@ usb_malloc(unsigned long size) } if (hdr) { - printf("MALLOC: Entries = %d; Remainder = %d; Size = %d\n", + DPRINTF("MALLOC: Entries = %d; Remainder = %d; Size = %d\n", (int)usb_pool_entries, (int)usb_pool_rem, (int)size); TAILQ_REMOVE(&malloc_head, hdr, entry); @@ -1187,7 +1198,7 @@ usb_malloc(unsigned long size) usb_pool_rem -= size; usb_pool_entries++; - printf("MALLOC: Entries = %d; Remainder = %d; Size = %d\n", + DPRINTF("MALLOC: Entries = %d; Remainder = %d; Size = %d\n", (int)usb_pool_entries, (int)usb_pool_rem, (int)size); memset(hdr + 1, 0, hdr->size - sizeof(*hdr)); @@ -1209,6 +1220,7 @@ usb_free(void *arg) TAILQ_INSERT_TAIL(&malloc_head, hdr, entry); } +#endif char * usb_strdup(const char *str) @@ -1218,7 +1230,7 @@ usb_strdup(const char *str) len = 1 + strlen(str); - tmp = usb_malloc(len); + tmp = malloc(len,XXX,XXX); if (tmp == NULL) return (NULL); diff --git a/sys/boot/usb/bsd_kernel.h b/sys/boot/usb/bsd_kernel.h index e9d9602fb44..975211e95b9 100644 --- a/sys/boot/usb/bsd_kernel.h +++ b/sys/boot/usb/bsd_kernel.h @@ -28,7 +28,8 @@ #define _BSD_KERNEL_H_ #define _KERNEL -#define __FreeBSD_version 1000000 +#undef __FreeBSD_version +#define __FreeBSD_version 1100000 #include #include @@ -37,6 +38,7 @@ #define isalpha(x) (((x) >= 'a' && (x) <= 'z') || ((x) >= 'A' && (x) <= 'Z')) #define isdigit(x) ((x) >= '0' && (x) <= '9') #define panic(...) do { printf("USB PANIC: " __VA_ARGS__); while (1) ; } while (0) +#define rebooting 0 #define M_USB 0 #define M_USBDEV 0 #define USB_PROC_MAX 3 @@ -92,10 +94,14 @@ SYSINIT_ENTRY(uniq##_entry, "sysuninit", (subs), \ #define BUS_SPACE_BARRIER_READ 0x01 #define BUS_SPACE_BARRIER_WRITE 0x02 #define hz 1000 +#undef PAGE_SIZE #define PAGE_SIZE 4096 +#undef MIN #define MIN(a,b) (((a) < (b)) ? (a) : (b)) +#undef MAX #define MAX(a,b) (((a) > (b)) ? (a) : (b)) #define MTX_DEF 0 +#define MTX_SPIN 0 #define MTX_RECURSE 0 #define SX_DUPOK 0 #define SX_NOWITNESS 0 @@ -103,10 +109,15 @@ SYSINIT_ENTRY(uniq##_entry, "sysuninit", (subs), \ #define cold 0 #define BUS_PROBE_GENERIC 0 #define CALLOUT_RETURNUNLOCKED 0x1 +#undef va_list #define va_list __builtin_va_list +#undef va_size #define va_size(type) __builtin_va_size(type) +#undef va_start #define va_start(ap, last) __builtin_va_start(ap, last) +#undef va_end #define va_end(ap) __builtin_va_end(ap) +#undef va_arg #define va_arg(ap, type) __builtin_va_arg((ap), type) #define DEVICE_ATTACH(dev, ...) \ (((device_attach_t *)(device_get_method(dev, "device_attach")))(dev,## __VA_ARGS__)) @@ -149,38 +160,46 @@ struct thread; struct malloc_type; struct usb_process; +#ifndef HAVE_STANDARD_DEFS +#define _UINT8_T_DECLARED typedef unsigned char uint8_t; +#define _INT8_T_DECLARED typedef signed char int8_t; - +#define _UINT16_T_DECLARED typedef unsigned short uint16_t; +#define _INT16_T_DECLARED typedef signed short int16_t; - +#define _UINT32_T_DECLARED typedef unsigned int uint32_t; +#define _INT32_T_DECLARED typedef signed int int32_t; - +#define _UINT64_T_DECLARED typedef unsigned long long uint64_t; +#define _INT16_T_DECLARED typedef signed long long int64_t; -typedef unsigned long bus_addr_t; -typedef unsigned long bus_size_t; - -typedef unsigned long size_t; -typedef unsigned long u_long; - -typedef void *bus_dmamap_t; -typedef void *bus_dma_tag_t; - -typedef void *bus_space_tag_t; -typedef uint8_t *bus_space_handle_t; - typedef uint16_t uid_t; typedef uint16_t gid_t; typedef uint16_t mode_t; typedef uint8_t *caddr_t; -typedef unsigned long __uintptr_t; +#define _UINTPTR_T_DECLARED typedef unsigned long uintptr_t; +#define _SIZE_T_DECLARED +typedef unsigned long size_t; +typedef unsigned long u_long; +#endif + +typedef unsigned long bus_addr_t; +typedef unsigned long bus_size_t; + +typedef void *bus_dmamap_t; +typedef void *bus_dma_tag_t; + +typedef void *bus_space_tag_t; +typedef uint8_t *bus_space_handle_t; + /* SYSINIT API */ #include @@ -201,6 +220,8 @@ struct mtx { void mtx_init(struct mtx *, const char *, const char *, int); void mtx_lock(struct mtx *); void mtx_unlock(struct mtx *); +#define mtx_lock_spin(x) mtx_lock(x) +#define mtx_unlock_spin(x) mtx_unlock(x) int mtx_owned(struct mtx *); void mtx_destroy(struct mtx *); @@ -266,7 +287,11 @@ struct module_data; typedef struct driver driver_t; typedef struct devclass *devclass_t; typedef struct device *device_t; -typedef void (intr_fn_t)(void *arg); +typedef void (driver_intr_t)(void *arg); +typedef int (driver_filter_t)(void *arg); +#define FILTER_STRAY 0x01 +#define FILTER_HANDLED 0x02 +#define FILTER_SCHEDULE_THREAD 0x04 typedef int device_attach_t (device_t dev); typedef int device_detach_t (device_t dev); @@ -294,7 +319,8 @@ struct device { const struct module_data *dev_module; void *dev_sc; void *dev_aux; - intr_fn_t *dev_irq_fn; + driver_filter_t *dev_irq_filter; + driver_intr_t *dev_irq_fn; void *dev_irq_arg; uint16_t dev_unit; @@ -341,7 +367,7 @@ const char *device_get_nameunit(device_t dev); printf("%s: " fmt, device_get_nameunit(dev),## __VA_ARGS__) device_t device_add_child(device_t dev, const char *name, int unit); void device_quiet(device_t dev); -void device_set_interrupt(device_t dev, intr_fn_t *fn, void *arg); +void device_set_interrupt(device_t dev, driver_filter_t *, driver_intr_t *, void *); void device_run_interrupts(device_t parent); void device_set_ivars(device_t dev, void *ivars); void *device_get_ivars(device_t dev); @@ -406,9 +432,11 @@ size_t strlen(const char *s); /* MALLOC API */ +#undef malloc #define malloc(s,x,f) usb_malloc(s) void *usb_malloc(size_t); +#undef free #define free(p,x) usb_free(p) void usb_free(void *); @@ -417,6 +445,8 @@ char *usb_strdup(const char *str); /* ENDIANNESS */ +#ifndef HAVE_ENDIAN_DEFS + /* Assume little endian */ #define htole64(x) ((uint64_t)(x)) @@ -431,6 +461,10 @@ char *usb_strdup(const char *str); #define be32toh(x) ((uint32_t)(x)) #define htobe32(x) ((uint32_t)(x)) +#else +#include +#endif + /* USB */ typedef int usb_handle_request_t (device_t dev, const void *req, void **pptr, uint16_t *plen, uint16_t offset, uint8_t *pstate); diff --git a/sys/boot/usb/bsd_usbloader_test.c b/sys/boot/usb/bsd_usbloader_test.c index 929e2e99b64..8744e2e7635 100644 --- a/sys/boot/usb/bsd_usbloader_test.c +++ b/sys/boot/usb/bsd_usbloader_test.c @@ -26,6 +26,7 @@ #include #include +#include #include extern int usleep(int); @@ -36,6 +37,20 @@ extern void usb_uninit(void); #define hz 1000 +#ifdef HAVE_MALLOC +void * +usb_malloc(size_t size) +{ + return (malloc(size)); +} + +void +usb_free(void *ptr) +{ + free(ptr); +} +#endif + void DELAY(unsigned int delay) { diff --git a/sys/boot/usb/storage/umass_common.c b/sys/boot/usb/storage/umass_common.c new file mode 100644 index 00000000000..b9c7e0d37a1 --- /dev/null +++ b/sys/boot/usb/storage/umass_common.c @@ -0,0 +1,87 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 2014 Hans Petter Selasky + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * 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 USB_GLOBAL_INCLUDE_FILE + +#include "umass_common.h" + +struct usb_attach_arg umass_uaa; + +static device_probe_t umass_probe; +static device_attach_t umass_attach; +static device_detach_t umass_detach; + +static devclass_t umass_devclass; + +static device_method_t umass_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, umass_probe), + DEVMETHOD(device_attach, umass_attach), + DEVMETHOD(device_detach, umass_detach), + + DEVMETHOD_END +}; + +static driver_t umass_driver = { + .name = "umass", + .methods = umass_methods, +}; + +DRIVER_MODULE(umass, uhub, umass_driver, umass_devclass, NULL, 0); + +static int +umass_probe(device_t dev) +{ + struct usb_attach_arg *uaa = device_get_ivars(dev); + + if (uaa->usb_mode != USB_MODE_HOST || + uaa->info.bInterfaceClass != UICLASS_MASS || + uaa->info.bInterfaceSubClass != UISUBCLASS_SCSI || + uaa->info.bInterfaceProtocol != UIPROTO_MASS_BBB || + device_get_unit(dev) != 0) + return (ENXIO); + return (0); +} + +static int +umass_attach(device_t dev) +{ + struct usb_attach_arg *uaa = device_get_ivars(dev); + umass_uaa = *uaa; + return (0); /* success */ +} + +static int +umass_detach(device_t dev) +{ + memset(&umass_uaa, 0, sizeof(umass_uaa)); + return (0); +} diff --git a/sys/ia64/include/bus_dma.h b/sys/boot/usb/storage/umass_common.h similarity index 73% rename from sys/ia64/include/bus_dma.h rename to sys/boot/usb/storage/umass_common.h index 0a80f2fd56d..a8ffd4987eb 100644 --- a/sys/ia64/include/bus_dma.h +++ b/sys/boot/usb/storage/umass_common.h @@ -1,7 +1,12 @@ +/* $FreeBSD$ */ /*- - * Copyright (c) 2005 Scott Long + * Copyright (c) 2014 Hans Petter Selasky * All rights reserved. * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -23,11 +28,14 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* $FreeBSD$ */ -#ifndef _IA64_BUS_DMA_H_ -#define _IA64_BUS_DMA_H_ +#ifndef _UMASS_COMMON_H_ +#define _UMASS_COMMON_H_ -#include +struct usb_attach_arg; +struct devsw; -#endif /* _IA64_BUS_DMA_H_ */ +extern struct usb_attach_arg umass_uaa; +extern struct devsw umass_disk; + +#endif /* _UMASS_COMMON_H_ */ diff --git a/sys/boot/usb/storage/umass_loader.c b/sys/boot/usb/storage/umass_loader.c new file mode 100644 index 00000000000..cba82ae7d77 --- /dev/null +++ b/sys/boot/usb/storage/umass_loader.c @@ -0,0 +1,197 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 2014 Hans Petter Selasky + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * 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 + +#define HAVE_STANDARD_DEFS + +#include USB_GLOBAL_INCLUDE_FILE + +#include "umass_common.h" + +static int umass_disk_init(void); +static int umass_disk_open(struct open_file *,...); +static int umass_disk_close(struct open_file *); +static void umass_disk_cleanup(void); +static int umass_disk_strategy(void *, int, daddr_t, size_t, char *, size_t *); +static void umass_disk_print(int); + +struct devsw umass_disk = { + .dv_name = "umass", + .dv_type = DEVT_DISK, + .dv_init = umass_disk_init, + .dv_strategy = umass_disk_strategy, + .dv_open = umass_disk_open, + .dv_close = umass_disk_close, + .dv_ioctl = noioctl, + .dv_print = umass_disk_print, + .dv_cleanup = umass_disk_cleanup, +}; + +static int +umass_disk_init(void) +{ + uint32_t time; + + usb_init(); + usb_needs_explore_all(); + + /* wait 8 seconds for a USB mass storage device to appear */ + for (time = 0; time < (8 * hz); time++) { + usb_idle(); + delay(1000000 / hz); + time++; + callout_process(1); + if (umass_uaa.device != NULL) + return (0); + } + return (0); +} + +static int +umass_disk_strategy(void *devdata, int flag, daddr_t dblk, size_t size, + char *buf, size_t *rsizep) +{ + if (umass_uaa.device == NULL) + return (ENXIO); + if (rsizep != NULL) + *rsizep = 0; + + if (flag == F_WRITE) { + if (usb_msc_write_10(umass_uaa.device, 0, dblk, size >> 9, buf) != 0) + return (EINVAL); + } else if (flag == F_READ) { + if (usb_msc_read_10(umass_uaa.device, 0, dblk, size >> 9, buf) != 0) + return (EINVAL); + } else { + return (EROFS); + } + + if (rsizep != NULL) + *rsizep = size; + return (0); +} + +static int +umass_disk_open_sub(struct disk_devdesc *dev) +{ + uint32_t nblock; + uint32_t blocksize; + + if (usb_msc_read_capacity(umass_uaa.device, 0, &nblock, &blocksize) != 0) + return (EINVAL); + + return (disk_open(dev, ((uint64_t)nblock + 1) * (uint64_t)blocksize, blocksize, 0)); +} + +static int +umass_disk_open(struct open_file *f,...) +{ + va_list ap; + struct disk_devdesc *dev; + + va_start(ap, f); + dev = va_arg(ap, struct disk_devdesc *); + va_end(ap); + + if (umass_uaa.device == NULL) + return (ENXIO); + if (dev->d_unit != 0) + return (EIO); + return (umass_disk_open_sub(dev)); +} + +static int +umass_disk_close(struct open_file *f) +{ + struct disk_devdesc *dev; + + dev = (struct disk_devdesc *)f->f_devdata; + return (disk_close(dev)); +} + +static void +umass_disk_print(int verbose) +{ + struct disk_devdesc dev; + + memset(&dev, 0, sizeof(dev)); + + pager_output(" umass0 UMASS device\n"); + dev.d_dev = &umass_disk; + dev.d_unit = 0; + dev.d_slice = -1; + dev.d_partition = -1; + + if (umass_disk_open_sub(&dev) == 0) { + disk_print(&dev, " umass0", verbose); + disk_close(&dev); + } +} + +static void +umass_disk_cleanup(void) +{ + disk_cleanup(&umass_disk); + + usb_uninit(); +} + + +/* USB specific functions */ + +extern void callout_process(int); +extern void usb_idle(void); +extern void usb_init(void); +extern void usb_uninit(void); + +void +DELAY(unsigned int usdelay) +{ + delay(usdelay); +} + +int +pause(const char *what, int timeout) +{ + if (timeout == 0) + timeout = 1; + + delay((1000000 / hz) * timeout); + + return (0); +} diff --git a/sys/boot/usb/usb_busdma_loader.c b/sys/boot/usb/usb_busdma_loader.c index c7d1ecb71d2..ad7180bc9e3 100644 --- a/sys/boot/usb/usb_busdma_loader.c +++ b/sys/boot/usb/usb_busdma_loader.c @@ -211,13 +211,13 @@ usb_pc_alloc_mem(struct usb_page_cache *pc, struct usb_page *pg, /* allocate zeroed memory */ if (align != 1) { - ptr = usb_malloc(size + align); + ptr = malloc(size + align, XXX, XXX); if (ptr == NULL) goto error; rem = (-((uintptr_t)ptr)) & (align - 1); } else { - ptr = usb_malloc(size); + ptr = malloc(size, XXX, XXX); if (ptr == NULL) goto error; rem = 0; @@ -258,7 +258,7 @@ void usb_pc_free_mem(struct usb_page_cache *pc) { if (pc != NULL && pc->buffer != NULL) { - usb_free(pc->tag); + free(pc->tag, XXX); pc->buffer = NULL; } } diff --git a/sys/boot/userboot/libstand/Makefile b/sys/boot/userboot/libstand/Makefile index 042b6a36a5e..692aa5af30e 100644 --- a/sys/boot/userboot/libstand/Makefile +++ b/sys/boot/userboot/libstand/Makefile @@ -69,18 +69,6 @@ SRCS+= bcmp.c bcopy.c bzero.c ffs.c memccpy.c memchr.c memcmp.c memcpy.c \ .PATH: ${LIBC}/arm/gen SRCS+= divsi3.S .endif -.if ${MACHINE_CPUARCH} == "ia64" -.PATH: ${LIBC}/ia64/string -SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \ - memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \ - strcmp.c strcpy.c strcspn.c strlen.c \ - strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \ - strspn.c strstr.c strtok.c swab.c - -.PATH: ${LIBC}/ia64/gen -SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S -SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S -.endif .if ${MACHINE_CPUARCH} == "powerpc" .PATH: ${LIBC}/libc/quad SRCS+= ashldi3.c ashrdi3.c diff --git a/sys/boot/userboot/test/test.c b/sys/boot/userboot/test/test.c index 36258a7a4df..d7ec3e4b5e9 100644 --- a/sys/boot/userboot/test/test.c +++ b/sys/boot/userboot/test/test.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -292,6 +293,7 @@ test_copyin(void *arg, const void *from, uint64_t to, size_t size) if (to + size > image_size) size = image_size - to; memcpy(&image[to], from, size); + return(0); } int @@ -304,6 +306,7 @@ test_copyout(void *arg, uint64_t from, void *to, size_t size) if (from + size > image_size) size = image_size - from; memcpy(to, &image[from], size); + return(0); } void @@ -333,7 +336,7 @@ test_setgdt(void *arg, uint64_t v, size_t sz) void test_exec(void *arg, uint64_t pc) { - printf("Execute at 0x%llx\n", pc); + printf("Execute at 0x%"PRIu64"\n", pc); test_exit(arg, 0); } @@ -411,7 +414,7 @@ void usage() { - printf("usage: %s [-d ] [-h \n"); + printf("usage: [-d ] [-h \n"); exit(1); } diff --git a/sys/boot/userboot/userboot/main.c b/sys/boot/userboot/userboot/main.c index c9353ab7a04..d4cefff4225 100644 --- a/sys/boot/userboot/userboot/main.c +++ b/sys/boot/userboot/userboot/main.c @@ -141,7 +141,7 @@ loader_main(struct loader_callbacks *cb, void *arg, int version, int ndisks) if (setjmp(jb)) return; - interact(); /* doesn't return */ + interact(NULL); /* doesn't return */ exit(0); } diff --git a/sys/boot/zfs/zfsimpl.c b/sys/boot/zfs/zfsimpl.c index b240b9662f2..16b57c7a615 100644 --- a/sys/boot/zfs/zfsimpl.c +++ b/sys/boot/zfs/zfsimpl.c @@ -56,6 +56,7 @@ static const char *features_for_read[] = { "org.illumos:lz4_compress", "com.delphix:hole_birth", "com.delphix:extensible_dataset", + "com.delphix:embedded_data", NULL }; @@ -1133,6 +1134,34 @@ zio_read(const spa_t *spa, const blkptr_t *bp, void *buf) void *pbuf; int i, error; + /* + * Process data embedded in block pointer + */ + if (BP_IS_EMBEDDED(bp)) { + ASSERT(BPE_GET_ETYPE(bp) == BP_EMBEDDED_TYPE_DATA); + + size = BPE_GET_PSIZE(bp); + ASSERT(size <= BPE_PAYLOAD_SIZE); + + if (cpfunc != ZIO_COMPRESS_OFF) + pbuf = zfs_alloc(size); + else + pbuf = buf; + + decode_embedded_bp_compressed(bp, pbuf); + error = 0; + + if (cpfunc != ZIO_COMPRESS_OFF) { + error = zio_decompress_data(cpfunc, pbuf, + size, buf, BP_GET_LSIZE(bp)); + zfs_free(pbuf, size); + } + if (error != 0) + printf("ZFS: i/o error - unable to decompress block pointer data, error %d\n", + error); + return (error); + } + error = EIO; for (i = 0; i < SPA_DVAS_PER_BP; i++) { diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c index c30be2d8113..9c99e88140b 100644 --- a/sys/cam/ata/ata_da.c +++ b/sys/cam/ata/ata_da.c @@ -546,30 +546,22 @@ static int ada_write_cache = ADA_DEFAULT_WRITE_CACHE; static SYSCTL_NODE(_kern_cam, OID_AUTO, ada, CTLFLAG_RD, 0, "CAM Direct Access Disk driver"); -SYSCTL_INT(_kern_cam_ada, OID_AUTO, legacy_aliases, CTLFLAG_RW, +SYSCTL_INT(_kern_cam_ada, OID_AUTO, legacy_aliases, CTLFLAG_RWTUN, &ada_legacy_aliases, 0, "Create legacy-like device aliases"); -TUNABLE_INT("kern.cam.ada.legacy_aliases", &ada_legacy_aliases); -SYSCTL_INT(_kern_cam_ada, OID_AUTO, retry_count, CTLFLAG_RW, +SYSCTL_INT(_kern_cam_ada, OID_AUTO, retry_count, CTLFLAG_RWTUN, &ada_retry_count, 0, "Normal I/O retry count"); -TUNABLE_INT("kern.cam.ada.retry_count", &ada_retry_count); -SYSCTL_INT(_kern_cam_ada, OID_AUTO, default_timeout, CTLFLAG_RW, +SYSCTL_INT(_kern_cam_ada, OID_AUTO, default_timeout, CTLFLAG_RWTUN, &ada_default_timeout, 0, "Normal I/O timeout (in seconds)"); -TUNABLE_INT("kern.cam.ada.default_timeout", &ada_default_timeout); -SYSCTL_INT(_kern_cam_ada, OID_AUTO, send_ordered, CTLFLAG_RW, +SYSCTL_INT(_kern_cam_ada, OID_AUTO, send_ordered, CTLFLAG_RWTUN, &ada_send_ordered, 0, "Send Ordered Tags"); -TUNABLE_INT("kern.cam.ada.send_ordered", &ada_send_ordered); -SYSCTL_INT(_kern_cam_ada, OID_AUTO, spindown_shutdown, CTLFLAG_RW, +SYSCTL_INT(_kern_cam_ada, OID_AUTO, spindown_shutdown, CTLFLAG_RWTUN, &ada_spindown_shutdown, 0, "Spin down upon shutdown"); -TUNABLE_INT("kern.cam.ada.spindown_shutdown", &ada_spindown_shutdown); -SYSCTL_INT(_kern_cam_ada, OID_AUTO, spindown_suspend, CTLFLAG_RW, +SYSCTL_INT(_kern_cam_ada, OID_AUTO, spindown_suspend, CTLFLAG_RWTUN, &ada_spindown_suspend, 0, "Spin down upon suspend"); -TUNABLE_INT("kern.cam.ada.spindown_suspend", &ada_spindown_suspend); -SYSCTL_INT(_kern_cam_ada, OID_AUTO, read_ahead, CTLFLAG_RW, +SYSCTL_INT(_kern_cam_ada, OID_AUTO, read_ahead, CTLFLAG_RWTUN, &ada_read_ahead, 0, "Enable disk read-ahead"); -TUNABLE_INT("kern.cam.ada.read_ahead", &ada_read_ahead); -SYSCTL_INT(_kern_cam_ada, OID_AUTO, write_cache, CTLFLAG_RW, +SYSCTL_INT(_kern_cam_ada, OID_AUTO, write_cache, CTLFLAG_RWTUN, &ada_write_cache, 0, "Enable disk write cache"); -TUNABLE_INT("kern.cam.ada.write_cache", &ada_write_cache); /* * ADA_ORDEREDTAG_INTERVAL determines how often, relative @@ -727,12 +719,12 @@ adastrategy(struct bio *bp) /* * Place it in the queue of disk activities for this disk */ - if (bp->bio_cmd == BIO_DELETE && - (softc->flags & ADA_FLAG_CAN_TRIM)) { - if (ADA_SIO) - bioq_disksort(&softc->trim_queue, bp); - else - bioq_insert_tail(&softc->trim_queue, bp); + if (bp->bio_cmd == BIO_DELETE) { + KASSERT((softc->flags & ADA_FLAG_CAN_TRIM) || + ((softc->flags & ADA_FLAG_CAN_CFA) && + !(softc->flags & ADA_FLAG_CAN_48BIT)), + ("BIO_DELETE but no supported TRIM method.")); + bioq_disksort(&softc->trim_queue, bp); } else { if (ADA_SIO) bioq_disksort(&softc->bio_queue, bp); @@ -1386,6 +1378,96 @@ adaregister(struct cam_periph *periph, void *arg) return(CAM_REQ_CMP); } +static void +ada_dsmtrim(struct ada_softc *softc, struct bio *bp, struct ccb_ataio *ataio) +{ + struct trim_request *req = &softc->trim_req; + uint64_t lastlba = (uint64_t)-1; + int c, lastcount = 0, off, ranges = 0; + + bzero(req, sizeof(*req)); + TAILQ_INIT(&req->bps); + do { + uint64_t lba = bp->bio_pblkno; + int count = bp->bio_bcount / softc->params.secsize; + + bioq_remove(&softc->trim_queue, bp); + + /* Try to extend the previous range. */ + if (lba == lastlba) { + c = min(count, ATA_DSM_RANGE_MAX - lastcount); + lastcount += c; + off = (ranges - 1) * ATA_DSM_RANGE_SIZE; + req->data[off + 6] = lastcount & 0xff; + req->data[off + 7] = + (lastcount >> 8) & 0xff; + count -= c; + lba += c; + } + + while (count > 0) { + c = min(count, ATA_DSM_RANGE_MAX); + off = ranges * ATA_DSM_RANGE_SIZE; + req->data[off + 0] = lba & 0xff; + req->data[off + 1] = (lba >> 8) & 0xff; + req->data[off + 2] = (lba >> 16) & 0xff; + req->data[off + 3] = (lba >> 24) & 0xff; + req->data[off + 4] = (lba >> 32) & 0xff; + req->data[off + 5] = (lba >> 40) & 0xff; + req->data[off + 6] = c & 0xff; + req->data[off + 7] = (c >> 8) & 0xff; + lba += c; + count -= c; + lastcount = c; + ranges++; + /* + * Its the caller's responsibility to ensure the + * request will fit so we don't need to check for + * overrun here + */ + } + lastlba = lba; + TAILQ_INSERT_TAIL(&req->bps, bp, bio_queue); + bp = bioq_first(&softc->trim_queue); + if (bp == NULL || + bp->bio_bcount / softc->params.secsize > + (softc->trim_max_ranges - ranges) * ATA_DSM_RANGE_MAX) + break; + } while (1); + cam_fill_ataio(ataio, + ada_retry_count, + adadone, + CAM_DIR_OUT, + 0, + req->data, + ((ranges + ATA_DSM_BLK_RANGES - 1) / + ATA_DSM_BLK_RANGES) * ATA_DSM_BLK_SIZE, + ada_default_timeout * 1000); + ata_48bit_cmd(ataio, ATA_DATA_SET_MANAGEMENT, + ATA_DSM_TRIM, 0, (ranges + ATA_DSM_BLK_RANGES - + 1) / ATA_DSM_BLK_RANGES); +} + +static void +ada_cfaerase(struct ada_softc *softc, struct bio *bp, struct ccb_ataio *ataio) +{ + uint64_t lba = bp->bio_pblkno; + uint16_t count = bp->bio_bcount / softc->params.secsize; + + cam_fill_ataio(ataio, + ada_retry_count, + adadone, + CAM_DIR_NONE, + 0, + NULL, + 0, + ada_default_timeout*1000); + + if (count >= 256) + count = 0; + ata_28bit_cmd(ataio, ATA_CFA_ERASE, 0, lba, count); +} + static void adastart(struct cam_periph *periph, union ccb *start_ccb) { @@ -1403,76 +1485,15 @@ adastart(struct cam_periph *periph, union ccb *start_ccb) /* Run TRIM if not running yet. */ if (!softc->trim_running && (bp = bioq_first(&softc->trim_queue)) != 0) { - struct trim_request *req = &softc->trim_req; - struct bio *bp1; - uint64_t lastlba = (uint64_t)-1; - int c, lastcount = 0, off, ranges = 0; - + if (softc->flags & ADA_FLAG_CAN_TRIM) { + ada_dsmtrim(softc, bp, ataio); + } else if ((softc->flags & ADA_FLAG_CAN_CFA) && + !(softc->flags & ADA_FLAG_CAN_48BIT)) { + ada_cfaerase(softc, bp, ataio); + } else { + panic("adastart: BIO_DELETE without method, not possible."); + } softc->trim_running = 1; - bzero(req, sizeof(*req)); - TAILQ_INIT(&req->bps); - bp1 = bp; - do { - uint64_t lba = bp1->bio_pblkno; - int count = bp1->bio_bcount / - softc->params.secsize; - - bioq_remove(&softc->trim_queue, bp1); - - /* Try to extend the previous range. */ - if (lba == lastlba) { - c = min(count, ATA_DSM_RANGE_MAX - lastcount); - lastcount += c; - off = (ranges - 1) * ATA_DSM_RANGE_SIZE; - req->data[off + 6] = lastcount & 0xff; - req->data[off + 7] = - (lastcount >> 8) & 0xff; - count -= c; - lba += c; - } - - while (count > 0) { - c = min(count, ATA_DSM_RANGE_MAX); - off = ranges * ATA_DSM_RANGE_SIZE; - req->data[off + 0] = lba & 0xff; - req->data[off + 1] = (lba >> 8) & 0xff; - req->data[off + 2] = (lba >> 16) & 0xff; - req->data[off + 3] = (lba >> 24) & 0xff; - req->data[off + 4] = (lba >> 32) & 0xff; - req->data[off + 5] = (lba >> 40) & 0xff; - req->data[off + 6] = c & 0xff; - req->data[off + 7] = (c >> 8) & 0xff; - lba += c; - count -= c; - lastcount = c; - ranges++; - /* - * Its the caller's responsibility to ensure the - * request will fit so we don't need to check for - * overrun here - */ - } - lastlba = lba; - TAILQ_INSERT_TAIL(&req->bps, bp1, bio_queue); - bp1 = bioq_first(&softc->trim_queue); - if (bp1 == NULL || - bp1->bio_bcount / softc->params.secsize > - (softc->trim_max_ranges - ranges) * - ATA_DSM_RANGE_MAX) - break; - } while (1); - cam_fill_ataio(ataio, - ada_retry_count, - adadone, - CAM_DIR_OUT, - 0, - req->data, - ((ranges + ATA_DSM_BLK_RANGES - 1) / - ATA_DSM_BLK_RANGES) * ATA_DSM_BLK_SIZE, - ada_default_timeout * 1000); - ata_48bit_cmd(ataio, ATA_DATA_SET_MANAGEMENT, - ATA_DSM_TRIM, 0, (ranges + ATA_DSM_BLK_RANGES - - 1) / ATA_DSM_BLK_RANGES); start_ccb->ccb_h.ccb_state = ADA_CCB_TRIM; start_ccb->ccb_h.flags |= CAM_UNLOCKED; goto out; @@ -1607,25 +1628,6 @@ adastart(struct cam_periph *periph, union ccb *start_ccb) } break; } - case BIO_DELETE: - { - uint64_t lba = bp->bio_pblkno; - uint16_t count = bp->bio_bcount / softc->params.secsize; - - cam_fill_ataio(ataio, - ada_retry_count, - adadone, - CAM_DIR_NONE, - 0, - NULL, - 0, - ada_default_timeout*1000); - - if (count >= 256) - count = 0; - ata_28bit_cmd(ataio, ATA_CFA_ERASE, 0, lba, count); - break; - } case BIO_FLUSH: cam_fill_ataio(ataio, 1, diff --git a/sys/cam/ata/ata_pmp.c b/sys/cam/ata/ata_pmp.c index bd4d25a67de..fab0e6f1f57 100644 --- a/sys/cam/ata/ata_pmp.c +++ b/sys/cam/ata/ata_pmp.c @@ -139,15 +139,12 @@ static int pmp_hide_special = PMP_DEFAULT_HIDE_SPECIAL; static SYSCTL_NODE(_kern_cam, OID_AUTO, pmp, CTLFLAG_RD, 0, "CAM Direct Access Disk driver"); -SYSCTL_INT(_kern_cam_pmp, OID_AUTO, retry_count, CTLFLAG_RW, +SYSCTL_INT(_kern_cam_pmp, OID_AUTO, retry_count, CTLFLAG_RWTUN, &pmp_retry_count, 0, "Normal I/O retry count"); -TUNABLE_INT("kern.cam.pmp.retry_count", &pmp_retry_count); -SYSCTL_INT(_kern_cam_pmp, OID_AUTO, default_timeout, CTLFLAG_RW, +SYSCTL_INT(_kern_cam_pmp, OID_AUTO, default_timeout, CTLFLAG_RWTUN, &pmp_default_timeout, 0, "Normal I/O timeout (in seconds)"); -TUNABLE_INT("kern.cam.pmp.default_timeout", &pmp_default_timeout); -SYSCTL_INT(_kern_cam_pmp, OID_AUTO, hide_special, CTLFLAG_RW, +SYSCTL_INT(_kern_cam_pmp, OID_AUTO, hide_special, CTLFLAG_RWTUN, &pmp_hide_special, 0, "Hide extra ports"); -TUNABLE_INT("kern.cam.pmp.hide_special", &pmp_hide_special); static struct periph_driver pmpdriver = { diff --git a/sys/cam/cam.c b/sys/cam/cam.c index f608d6f8872..939dd76c306 100644 --- a/sys/cam/cam.c +++ b/sys/cam/cam.c @@ -116,7 +116,6 @@ SYSCTL_NODE(_kern, OID_AUTO, cam, CTLFLAG_RD, 0, "CAM Subsystem"); #endif int cam_sort_io_queues = CAM_DEFAULT_SORT_IO_QUEUES; -TUNABLE_INT("kern.cam.sort_io_queues", &cam_sort_io_queues); SYSCTL_INT(_kern_cam, OID_AUTO, sort_io_queues, CTLFLAG_RWTUN, &cam_sort_io_queues, 0, "Sort IO queues to try and optimise disk access patterns"); #endif diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c index 1628ab0d1f5..2e23996966a 100644 --- a/sys/cam/cam_periph.c +++ b/sys/cam/cam_periph.c @@ -597,7 +597,7 @@ cam_periph_invalidate(struct cam_periph *periph) return; CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph invalidated\n")); - if (periph->flags & CAM_PERIPH_ANNOUNCED) + if ((periph->flags & CAM_PERIPH_ANNOUNCED) && !rebooting) xpt_denounce_periph(periph); periph->flags |= CAM_PERIPH_INVALID; periph->flags &= ~CAM_PERIPH_NEW_DEV_FOUND; @@ -663,9 +663,9 @@ camperiphfree(struct cam_periph *periph) xpt_remove_periph(periph); xpt_unlock_buses(); - if (periph->flags & CAM_PERIPH_ANNOUNCED) { + if ((periph->flags & CAM_PERIPH_ANNOUNCED) && !rebooting) xpt_print(periph->path, "Periph destroyed\n"); - } else + else CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n")); if (periph->flags & CAM_PERIPH_NEW_DEV_FOUND) { diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index bfad6dd95cb..4a8f14b0f73 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -149,7 +149,6 @@ typedef int xpt_pdrvfunc_t (struct periph_driver **pdrv, void *arg); /* Transport layer configuration information */ static struct xpt_softc xsoftc; -TUNABLE_INT("kern.cam.boot_delay", &xsoftc.boot_delay); SYSCTL_INT(_kern_cam, OID_AUTO, boot_delay, CTLFLAG_RDTUN, &xsoftc.boot_delay, 0, "Bus registration wait time"); @@ -163,7 +162,6 @@ static struct cam_doneq cam_doneqs[MAXCPU]; static int cam_num_doneqs; static struct proc *cam_proc; -TUNABLE_INT("kern.cam.num_doneqs", &cam_num_doneqs); SYSCTL_INT(_kern_cam, OID_AUTO, num_doneqs, CTLFLAG_RDTUN, &cam_num_doneqs, 0, "Number of completion queues/threads"); @@ -197,12 +195,10 @@ static struct cdevsw xpt_cdevsw = { /* Storage for debugging datastructures */ struct cam_path *cam_dpath; u_int32_t cam_dflags = CAM_DEBUG_FLAGS; -TUNABLE_INT("kern.cam.dflags", &cam_dflags); -SYSCTL_UINT(_kern_cam, OID_AUTO, dflags, CTLFLAG_RW, +SYSCTL_UINT(_kern_cam, OID_AUTO, dflags, CTLFLAG_RWTUN, &cam_dflags, 0, "Enabled debug flags"); u_int32_t cam_debug_delay = CAM_DEBUG_DELAY; -TUNABLE_INT("kern.cam.debug_delay", &cam_debug_delay); -SYSCTL_UINT(_kern_cam, OID_AUTO, debug_delay, CTLFLAG_RW, +SYSCTL_UINT(_kern_cam, OID_AUTO, debug_delay, CTLFLAG_RWTUN, &cam_debug_delay, 0, "Delay in us after each debug message"); /* Our boot-time initialization hook */ diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index 1e9a952eaed..f3dbc183bf5 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -82,20 +82,6 @@ __FBSDID("$FreeBSD$"); struct ctl_softc *control_softc = NULL; -/* - * The default is to run with CTL_DONE_THREAD turned on. Completed - * transactions are queued for processing by the CTL work thread. When - * CTL_DONE_THREAD is not defined, completed transactions are processed in - * the caller's context. - */ -#define CTL_DONE_THREAD - -/* - * Use the serial number and device ID provided by the backend, rather than - * making up our own. - */ -#define CTL_USE_BACKEND_SN - /* * Size and alignment macros needed for Copan-specific HA hardware. These * can go away when the HA code is re-written, and uses busdma for any @@ -296,8 +282,10 @@ static struct scsi_control_page control_page_default = { /*rlec*/0, /*queue_flags*/0, /*eca_and_aen*/0, - /*reserved*/0, - /*aen_holdoff_period*/{0, 0} + /*flags4*/SCP_TAS, + /*aen_holdoff_period*/{0, 0}, + /*busy_timeout_period*/{0, 0}, + /*extended_selftest_completion_time*/{0, 0} }; static struct scsi_control_page control_page_changeable = { @@ -306,8 +294,10 @@ static struct scsi_control_page control_page_changeable = { /*rlec*/SCP_DSENSE, /*queue_flags*/0, /*eca_and_aen*/0, - /*reserved*/0, - /*aen_holdoff_period*/{0, 0} + /*flags4*/0, + /*aen_holdoff_period*/{0, 0}, + /*busy_timeout_period*/{0, 0}, + /*extended_selftest_completion_time*/{0, 0} }; @@ -321,20 +311,19 @@ static int ctl_is_single = 1; static int index_to_aps_page; SYSCTL_NODE(_kern_cam, OID_AUTO, ctl, CTLFLAG_RD, 0, "CAM Target Layer"); -static int worker_threads = 1; -TUNABLE_INT("kern.cam.ctl.worker_threads", &worker_threads); +static int worker_threads = -1; SYSCTL_INT(_kern_cam_ctl, OID_AUTO, worker_threads, CTLFLAG_RDTUN, &worker_threads, 1, "Number of worker threads"); static int verbose = 0; -TUNABLE_INT("kern.cam.ctl.verbose", &verbose); SYSCTL_INT(_kern_cam_ctl, OID_AUTO, verbose, CTLFLAG_RWTUN, &verbose, 0, "Show SCSI errors returned to initiator"); /* - * Serial number (0x80), device id (0x83), supported pages (0x00), - * Block limits (0xB0) and Logical Block Provisioning (0xB2) + * Supported pages (0x00), Serial number (0x80), Device ID (0x83), + * SCSI Ports (0x88), Third-party Copy (0x8F), Block limits (0xB0) and + * Logical Block Provisioning (0xB2) */ -#define SCSI_EVPD_NUM_SUPPORTED_PAGES 5 +#define SCSI_EVPD_NUM_SUPPORTED_PAGES 7 static void ctl_isc_event_handler(ctl_ha_channel chanel, ctl_ha_event event, int param); @@ -345,12 +334,10 @@ static int ctl_open(struct cdev *dev, int flags, int fmt, struct thread *td); static int ctl_close(struct cdev *dev, int flags, int fmt, struct thread *td); static void ctl_ioctl_online(void *arg); static void ctl_ioctl_offline(void *arg); -static int ctl_ioctl_targ_enable(void *arg, struct ctl_id targ_id); -static int ctl_ioctl_targ_disable(void *arg, struct ctl_id targ_id); static int ctl_ioctl_lun_enable(void *arg, struct ctl_id targ_id, int lun_id); static int ctl_ioctl_lun_disable(void *arg, struct ctl_id targ_id, int lun_id); static int ctl_ioctl_do_datamove(struct ctl_scsiio *ctsio); -static int ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio, int have_lock); +static int ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio); static int ctl_ioctl_submit_wait(union ctl_io *io); static void ctl_ioctl_datamove(union ctl_io *io); static void ctl_ioctl_done(union ctl_io *io); @@ -362,8 +349,8 @@ static int ctl_ioctl_fill_ooa(struct ctl_lun *lun, uint32_t *cur_fill_num, struct ctl_ooa_entry *kern_entries); static int ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td); -uint32_t ctl_get_resindex(struct ctl_nexus *nexus); -uint32_t ctl_port_idx(int port_num); +static uint32_t ctl_map_lun(int port_num, uint32_t lun); +static uint32_t ctl_map_lun_back(int port_num, uint32_t lun); #ifdef unused static union ctl_io *ctl_malloc_io(ctl_io_type io_type, uint32_t targ_port, uint32_t targ_target, uint32_t targ_lun, @@ -392,6 +379,8 @@ static void ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg); static int ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, int alloc_len); static int ctl_inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len); static int ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len); +static int ctl_inquiry_evpd_scsi_ports(struct ctl_scsiio *ctsio, + int alloc_len); static int ctl_inquiry_evpd_block_limits(struct ctl_scsiio *ctsio, int alloc_len); static int ctl_inquiry_evpd_lbp(struct ctl_scsiio *ctsio, int alloc_len); @@ -406,7 +395,7 @@ static ctl_action ctl_check_ooa(struct ctl_lun *lun, union ctl_io *pending_io, static int ctl_check_blocked(struct ctl_lun *lun); static int ctl_scsiio_lun_check(struct ctl_softc *ctl_softc, struct ctl_lun *lun, - struct ctl_cmd_entry *entry, + const struct ctl_cmd_entry *entry, struct ctl_scsiio *ctsio); //static int ctl_check_rtr(union ctl_io *pending_io, struct ctl_softc *softc); static void ctl_failover(void); @@ -420,7 +409,9 @@ static int ctl_target_reset(struct ctl_softc *ctl_softc, union ctl_io *io, static int ctl_lun_reset(struct ctl_lun *lun, union ctl_io *io, ctl_ua_type ua_type); static int ctl_abort_task(union ctl_io *io); -static void ctl_run_task_queue(struct ctl_softc *ctl_softc); +static int ctl_abort_task_set(union ctl_io *io); +static int ctl_i_t_nexus_reset(union ctl_io *io); +static void ctl_run_task(union ctl_io *io); #ifdef CTL_IO_DELAY static void ctl_datamove_timer_wakeup(void *arg); static void ctl_done_timer_wakeup(void *arg); @@ -437,8 +428,19 @@ static int ctl_datamove_remote_xfer(union ctl_io *io, unsigned command, ctl_ha_dt_cb callback); static void ctl_datamove_remote_read(union ctl_io *io); static void ctl_datamove_remote(union ctl_io *io); -static int ctl_process_done(union ctl_io *io, int have_lock); +static int ctl_process_done(union ctl_io *io); +static void ctl_lun_thread(void *arg); static void ctl_work_thread(void *arg); +static void ctl_enqueue_incoming(union ctl_io *io); +static void ctl_enqueue_rtr(union ctl_io *io); +static void ctl_enqueue_done(union ctl_io *io); +static void ctl_enqueue_isc(union ctl_io *io); +static const struct ctl_cmd_entry * + ctl_get_cmd_entry(struct ctl_scsiio *ctsio); +static const struct ctl_cmd_entry * + ctl_validate_command(struct ctl_scsiio *ctsio); +static int ctl_cmd_applicable(uint8_t lun_type, + const struct ctl_cmd_entry *entry); /* * Load the serialization table. This isn't very pretty, but is probably @@ -460,6 +462,7 @@ static struct cdevsw ctl_cdevsw = { MALLOC_DEFINE(M_CTL, "ctlmem", "Memory used for CTL"); +MALLOC_DEFINE(M_CTLIO, "ctlio", "Memory used for CTL requests"); static int ctl_module_event_handler(module_t, int /*modeventtype_t*/, void *); @@ -472,6 +475,11 @@ static moduledata_t ctl_moduledata = { DECLARE_MODULE(ctl, ctl_moduledata, SI_SUB_CONFIGURE, SI_ORDER_THIRD); MODULE_VERSION(ctl, 1); +static struct ctl_frontend ioctl_frontend = +{ + .name = "ioctl", +}; + static void ctl_isc_handler_finish_xfer(struct ctl_softc *ctl_softc, union ctl_ha_msg *msg_info) @@ -496,8 +504,7 @@ ctl_isc_handler_finish_xfer(struct ctl_softc *ctl_softc, sizeof(ctsio->sense_data)); memcpy(&ctsio->io_hdr.ctl_private[CTL_PRIV_LBA_LEN].bytes, &msg_info->scsi.lbalen, sizeof(msg_info->scsi.lbalen)); - STAILQ_INSERT_TAIL(&ctl_softc->isc_queue, &ctsio->io_hdr, links); - ctl_wakeup_thread(); + ctl_enqueue_isc((union ctl_io *)ctsio); } static void @@ -543,8 +550,7 @@ ctl_isc_handler_finish_ser_only(struct ctl_softc *ctl_softc, } #endif ctsio->io_hdr.msg_type = CTL_MSG_FINISH_IO; - STAILQ_INSERT_TAIL(&ctl_softc->isc_queue, &ctsio->io_hdr, links); - ctl_wakeup_thread(); + ctl_enqueue_isc((union ctl_io *)ctsio); } /* @@ -579,7 +585,6 @@ ctl_isc_event_handler(ctl_ha_channel channel, ctl_ha_event event, int param) isc_status); return; } - mtx_lock(&ctl_softc->ctl_lock); switch (msg_info.hdr.msg_type) { case CTL_MSG_SERIALIZE: @@ -592,7 +597,6 @@ ctl_isc_event_handler(ctl_ha_channel channel, ctl_ha_event event, int param) "ctl_io!\n"); /* Bad Juju */ /* Need to set busy and send msg back */ - mtx_unlock(&ctl_softc->ctl_lock); msg_info.hdr.msg_type = CTL_MSG_BAD_JUJU; msg_info.hdr.status = CTL_SCSI_ERROR; msg_info.scsi.scsi_status = SCSI_STATUS_BUSY; @@ -634,18 +638,14 @@ ctl_isc_event_handler(ctl_ha_channel channel, ctl_ha_event event, int param) memcpy(io->scsiio.cdb, msg_info.scsi.cdb, CTL_MAX_CDBLEN); if (ctl_softc->ha_mode == CTL_HA_MODE_XFER) { - struct ctl_cmd_entry *entry; - uint8_t opcode; + const struct ctl_cmd_entry *entry; - opcode = io->scsiio.cdb[0]; - entry = &ctl_cmd_table[opcode]; + entry = ctl_get_cmd_entry(&io->scsiio); io->io_hdr.flags &= ~CTL_FLAG_DATA_MASK; io->io_hdr.flags |= entry->flags & CTL_FLAG_DATA_MASK; } - STAILQ_INSERT_TAIL(&ctl_softc->isc_queue, - &io->io_hdr, links); - ctl_wakeup_thread(); + ctl_enqueue_isc(io); break; /* Performed on the Originating SC, XFER mode only */ @@ -749,11 +749,8 @@ ctl_isc_event_handler(ctl_ha_channel channel, ctl_ha_event event, int param) * the full S/G list. Queue processing in the thread. * Otherwise wait for the next piece. */ - if (msg_info.dt.sg_last != 0) { - STAILQ_INSERT_TAIL(&ctl_softc->isc_queue, - &io->io_hdr, links); - ctl_wakeup_thread(); - } + if (msg_info.dt.sg_last != 0) + ctl_enqueue_isc(io); break; } /* Performed on the Serializing (primary) SC, XFER mode only */ @@ -779,10 +776,7 @@ ctl_isc_event_handler(ctl_ha_channel channel, ctl_ha_event event, int param) io->scsiio.residual = msg_info.scsi.residual; memcpy(&io->scsiio.sense_data,&msg_info.scsi.sense_data, sizeof(io->scsiio.sense_data)); - - STAILQ_INSERT_TAIL(&ctl_softc->isc_queue, - &io->io_hdr, links); - ctl_wakeup_thread(); + ctl_enqueue_isc(io); break; } @@ -791,7 +785,6 @@ ctl_isc_event_handler(ctl_ha_channel channel, ctl_ha_event event, int param) io = msg_info.hdr.original_sc; if (io == NULL) { printf("%s: Major Bummer\n", __func__); - mtx_unlock(&ctl_softc->ctl_lock); return; } else { #if 0 @@ -800,9 +793,7 @@ ctl_isc_event_handler(ctl_ha_channel channel, ctl_ha_event event, int param) } io->io_hdr.msg_type = CTL_MSG_R2R; io->io_hdr.serializing_sc = msg_info.hdr.serializing_sc; - STAILQ_INSERT_TAIL(&ctl_softc->isc_queue, - &io->io_hdr, links); - ctl_wakeup_thread(); + ctl_enqueue_isc(io); break; /* @@ -839,9 +830,7 @@ ctl_isc_event_handler(ctl_ha_channel channel, ctl_ha_event event, int param) /* io = msg_info.hdr.serializing_sc; */ io->io_hdr.msg_type = CTL_MSG_BAD_JUJU; - STAILQ_INSERT_TAIL(&ctl_softc->isc_queue, - &io->io_hdr, links); - ctl_wakeup_thread(); + ctl_enqueue_isc(io); break; /* Handle resets sent from the other side */ @@ -855,7 +844,6 @@ ctl_isc_event_handler(ctl_ha_channel channel, ctl_ha_event event, int param) /* Bad Juju */ /* should I just call the proper reset func here??? */ - mtx_unlock(&ctl_softc->ctl_lock); goto bailout; } ctl_zero_io((union ctl_io *)taskio); @@ -872,10 +860,7 @@ ctl_isc_event_handler(ctl_ha_channel channel, ctl_ha_event event, int param) cs_prof_gettime(&taskio->io_hdr.start_ticks); #endif #endif /* CTL_TIME_IO */ - STAILQ_INSERT_TAIL(&ctl_softc->task_queue, - &taskio->io_hdr, links); - ctl_softc->flags |= CTL_FLAG_TASK_PENDING; - ctl_wakeup_thread(); + ctl_run_task((union ctl_io *)taskio); break; } /* Persistent Reserve action which needs attention */ @@ -887,15 +872,12 @@ ctl_isc_event_handler(ctl_ha_channel channel, ctl_ha_event event, int param) "ctl_io!\n"); /* Bad Juju */ /* Need to set busy and send msg back */ - mtx_unlock(&ctl_softc->ctl_lock); goto bailout; } ctl_zero_io((union ctl_io *)presio); presio->io_hdr.msg_type = CTL_MSG_PERS_ACTION; presio->pr_msg = msg_info.pr; - STAILQ_INSERT_TAIL(&ctl_softc->isc_queue, - &presio->io_hdr, links); - ctl_wakeup_thread(); + ctl_enqueue_isc((union ctl_io *)presio); break; case CTL_MSG_SYNC_FE: rcv_sync_msg = 1; @@ -908,23 +890,21 @@ ctl_isc_event_handler(ctl_ha_channel channel, ctl_ha_event event, int param) struct copan_aps_subpage *current_sp; uint32_t targ_lun; - targ_lun = msg_info.hdr.nexus.targ_lun; - if (msg_info.hdr.nexus.lun_map_fn != NULL) - targ_lun = msg_info.hdr.nexus.lun_map_fn(msg_info.hdr.nexus.lun_map_arg, targ_lun); - + targ_lun = msg_info.hdr.nexus.targ_mapped_lun; lun = ctl_softc->ctl_luns[targ_lun]; + mtx_lock(&lun->lun_lock); page_index = &lun->mode_pages.index[index_to_aps_page]; current_sp = (struct copan_aps_subpage *) (page_index->page_data + (page_index->page_len * CTL_PAGE_CURRENT)); current_sp->lock_active = msg_info.aps.lock_flag; + mtx_unlock(&lun->lun_lock); break; } default: printf("How did I get here?\n"); } - mtx_unlock(&ctl_softc->ctl_lock); } else if (event == CTL_HA_EVT_MSG_SENT) { if (param != CTL_HA_STATUS_SUCCESS) { printf("Bad status from ctl_ha_msg_send status %d\n", @@ -960,8 +940,7 @@ ctl_init(void) { struct ctl_softc *softc; struct ctl_io_pool *internal_pool, *emergency_pool, *other_pool; - struct ctl_frontend *fe; - struct ctl_lun *lun; + struct ctl_port *port; uint8_t sc_id =0; int i, error, retval; //int isc_retval; @@ -1040,22 +1019,11 @@ ctl_init(void) softc->target.wwid[1] = 0x87654321; STAILQ_INIT(&softc->lun_list); STAILQ_INIT(&softc->pending_lun_queue); - STAILQ_INIT(&softc->task_queue); - STAILQ_INIT(&softc->incoming_queue); - STAILQ_INIT(&softc->rtr_queue); - STAILQ_INIT(&softc->done_queue); - STAILQ_INIT(&softc->isc_queue); STAILQ_INIT(&softc->fe_list); + STAILQ_INIT(&softc->port_list); STAILQ_INIT(&softc->be_list); STAILQ_INIT(&softc->io_pools); - lun = &softc->lun; - - /* - * We don't bother calling these with ctl_lock held here, because, - * in theory, no one else can try to do anything while we're in our - * module init routine. - */ if (ctl_pool_create(softc, CTL_POOL_INTERNAL, CTL_POOL_ENTRIES_INTERNAL, &internal_pool)!= 0){ printf("ctl: can't allocate %d entry internal pool, " @@ -1085,76 +1053,65 @@ ctl_init(void) softc->emergency_pool = emergency_pool; softc->othersc_pool = other_pool; - /* - * We used to allocate a processor LUN here. The new scheme is to - * just let the user allocate LUNs as he sees fit. - */ -#if 0 - mtx_lock(&softc->ctl_lock); - ctl_alloc_lun(softc, lun, /*be_lun*/NULL, /*target*/softc->target); - mtx_unlock(&softc->ctl_lock); -#endif - - if (worker_threads > MAXCPU || worker_threads == 0) { - printf("invalid kern.cam.ctl.worker_threads value; " - "setting to 1"); - worker_threads = 1; - } else if (worker_threads < 0) { - if (mp_ncpus > 2) { - /* - * Using more than two worker threads actually hurts - * performance due to lock contention. - */ - worker_threads = 2; - } else { - worker_threads = 1; - } - } + if (worker_threads <= 0) + worker_threads = max(1, mp_ncpus / 4); + if (worker_threads > CTL_MAX_THREADS) + worker_threads = CTL_MAX_THREADS; for (i = 0; i < worker_threads; i++) { - error = kproc_kthread_add(ctl_work_thread, softc, - &softc->work_thread, NULL, 0, 0, "ctl", "work%d", i); + struct ctl_thread *thr = &softc->threads[i]; + + mtx_init(&thr->queue_lock, "CTL queue mutex", NULL, MTX_DEF); + thr->ctl_softc = softc; + STAILQ_INIT(&thr->incoming_queue); + STAILQ_INIT(&thr->rtr_queue); + STAILQ_INIT(&thr->done_queue); + STAILQ_INIT(&thr->isc_queue); + + error = kproc_kthread_add(ctl_work_thread, thr, + &softc->ctl_proc, &thr->thread, 0, 0, "ctl", "work%d", i); if (error != 0) { printf("error creating CTL work thread!\n"); - mtx_lock(&softc->ctl_lock); - ctl_free_lun(lun); - mtx_unlock(&softc->ctl_lock); ctl_pool_free(internal_pool); ctl_pool_free(emergency_pool); ctl_pool_free(other_pool); return (error); } } + error = kproc_kthread_add(ctl_lun_thread, softc, + &softc->ctl_proc, NULL, 0, 0, "ctl", "lun"); + if (error != 0) { + printf("error creating CTL lun thread!\n"); + ctl_pool_free(internal_pool); + ctl_pool_free(emergency_pool); + ctl_pool_free(other_pool); + return (error); + } if (bootverbose) printf("ctl: CAM Target Layer loaded\n"); - /* - * Initialize the initiator and portname mappings - */ - memset(softc->wwpn_iid, 0, sizeof(softc->wwpn_iid)); - /* * Initialize the ioctl front end. */ - fe = &softc->ioctl_info.fe; - sprintf(softc->ioctl_info.port_name, "CTL ioctl"); - fe->port_type = CTL_PORT_IOCTL; - fe->num_requested_ctl_io = 100; - fe->port_name = softc->ioctl_info.port_name; - fe->port_online = ctl_ioctl_online; - fe->port_offline = ctl_ioctl_offline; - fe->onoff_arg = &softc->ioctl_info; - fe->targ_enable = ctl_ioctl_targ_enable; - fe->targ_disable = ctl_ioctl_targ_disable; - fe->lun_enable = ctl_ioctl_lun_enable; - fe->lun_disable = ctl_ioctl_lun_disable; - fe->targ_lun_arg = &softc->ioctl_info; - fe->fe_datamove = ctl_ioctl_datamove; - fe->fe_done = ctl_ioctl_done; - fe->max_targets = 15; - fe->max_target_id = 15; + ctl_frontend_register(&ioctl_frontend); + port = &softc->ioctl_info.port; + port->frontend = &ioctl_frontend; + sprintf(softc->ioctl_info.port_name, "ioctl"); + port->port_type = CTL_PORT_IOCTL; + port->num_requested_ctl_io = 100; + port->port_name = softc->ioctl_info.port_name; + port->port_online = ctl_ioctl_online; + port->port_offline = ctl_ioctl_offline; + port->onoff_arg = &softc->ioctl_info; + port->lun_enable = ctl_ioctl_lun_enable; + port->lun_disable = ctl_ioctl_lun_disable; + port->targ_lun_arg = &softc->ioctl_info; + port->fe_datamove = ctl_ioctl_datamove; + port->fe_done = ctl_ioctl_done; + port->max_targets = 15; + port->max_target_id = 15; - if (ctl_frontend_register(&softc->ioctl_info.fe, + if (ctl_port_register(&softc->ioctl_info.port, (softc->flags & CTL_FLAG_MASTER_SHELF)) != 0) { printf("ctl: ioctl front end registration failed, will " "continue anyway\n"); @@ -1180,7 +1137,7 @@ ctl_shutdown(void) softc = (struct ctl_softc *)control_softc; - if (ctl_frontend_deregister(&softc->ioctl_info.fe) != 0) + if (ctl_port_deregister(&softc->ioctl_info.port) != 0) printf("ctl: ioctl front end deregistration failed\n"); mtx_lock(&softc->ctl_lock); @@ -1195,6 +1152,8 @@ ctl_shutdown(void) mtx_unlock(&softc->ctl_lock); + ctl_frontend_deregister(&ioctl_frontend); + /* * This will rip the rug out from under any FETDs or anyone else * that has a pool allocated. Since we increment our module @@ -1208,6 +1167,7 @@ ctl_shutdown(void) #if 0 ctl_shutdown_thread(softc->work_thread); + mtx_destroy(&softc->queue_lock); #endif mtx_destroy(&softc->pool_lock); @@ -1258,7 +1218,7 @@ int ctl_port_enable(ctl_port_type port_type) { struct ctl_softc *softc; - struct ctl_frontend *fe; + struct ctl_port *port; if (ctl_is_single == 0) { union ctl_ha_msg msg_info; @@ -1287,13 +1247,13 @@ ctl_port_enable(ctl_port_type port_type) softc = control_softc; - STAILQ_FOREACH(fe, &softc->fe_list, links) { - if (port_type & fe->port_type) + STAILQ_FOREACH(port, &softc->port_list, links) { + if (port_type & port->port_type) { #if 0 - printf("port %d\n", fe->targ_port); + printf("port %d\n", port->targ_port); #endif - ctl_frontend_online(fe); + ctl_port_online(port); } } @@ -1304,13 +1264,13 @@ int ctl_port_disable(ctl_port_type port_type) { struct ctl_softc *softc; - struct ctl_frontend *fe; + struct ctl_port *port; softc = control_softc; - STAILQ_FOREACH(fe, &softc->fe_list, links) { - if (port_type & fe->port_type) - ctl_frontend_offline(fe); + STAILQ_FOREACH(port, &softc->port_list, links) { + if (port_type & port->port_type) + ctl_port_offline(port); } return (0); @@ -1328,7 +1288,7 @@ ctl_port_list(struct ctl_port_entry *entries, int num_entries_alloced, ctl_port_type port_type, int no_virtual) { struct ctl_softc *softc; - struct ctl_frontend *fe; + struct ctl_port *port; int entries_dropped, entries_filled; int retval; int i; @@ -1341,14 +1301,14 @@ ctl_port_list(struct ctl_port_entry *entries, int num_entries_alloced, i = 0; mtx_lock(&softc->ctl_lock); - STAILQ_FOREACH(fe, &softc->fe_list, links) { + STAILQ_FOREACH(port, &softc->port_list, links) { struct ctl_port_entry *entry; - if ((fe->port_type & port_type) == 0) + if ((port->port_type & port_type) == 0) continue; if ((no_virtual != 0) - && (fe->virtual_port != 0)) + && (port->virtual_port != 0)) continue; if (entries_filled >= num_entries_alloced) { @@ -1357,13 +1317,13 @@ ctl_port_list(struct ctl_port_entry *entries, int num_entries_alloced, } entry = &entries[i]; - entry->port_type = fe->port_type; - strlcpy(entry->port_name, fe->port_name, + entry->port_type = port->port_type; + strlcpy(entry->port_name, port->port_name, sizeof(entry->port_name)); - entry->physical_port = fe->physical_port; - entry->virtual_port = fe->virtual_port; - entry->wwnn = fe->wwnn; - entry->wwpn = fe->wwpn; + entry->physical_port = port->physical_port; + entry->virtual_port = port->virtual_port; + entry->wwnn = port->wwnn; + entry->wwpn = port->wwpn; i++; entries_filled++; @@ -1402,32 +1362,24 @@ ctl_ioctl_offline(void *arg) /* * Remove an initiator by port number and initiator ID. - * Returns 0 for success, 1 for failure. + * Returns 0 for success, -1 for failure. */ int -ctl_remove_initiator(int32_t targ_port, uint32_t iid) +ctl_remove_initiator(struct ctl_port *port, int iid) { - struct ctl_softc *softc; - - softc = control_softc; + struct ctl_softc *softc = control_softc; mtx_assert(&softc->ctl_lock, MA_NOTOWNED); - if ((targ_port < 0) - || (targ_port > CTL_MAX_PORTS)) { - printf("%s: invalid port number %d\n", __func__, targ_port); - return (1); - } if (iid > CTL_MAX_INIT_PER_PORT) { printf("%s: initiator ID %u > maximun %u!\n", __func__, iid, CTL_MAX_INIT_PER_PORT); - return (1); + return (-1); } mtx_lock(&softc->ctl_lock); - - softc->wwpn_iid[targ_port][iid].in_use = 0; - + port->wwpn_iid[iid].in_use--; + port->wwpn_iid[iid].last_use = time_uptime; mtx_unlock(&softc->ctl_lock); return (0); @@ -1435,41 +1387,91 @@ ctl_remove_initiator(int32_t targ_port, uint32_t iid) /* * Add an initiator to the initiator map. - * Returns 0 for success, 1 for failure. + * Returns iid for success, < 0 for failure. */ int -ctl_add_initiator(uint64_t wwpn, int32_t targ_port, uint32_t iid) +ctl_add_initiator(struct ctl_port *port, int iid, uint64_t wwpn, char *name) { - struct ctl_softc *softc; - int retval; - - softc = control_softc; + struct ctl_softc *softc = control_softc; + time_t best_time; + int i, best; mtx_assert(&softc->ctl_lock, MA_NOTOWNED); - retval = 0; - - if ((targ_port < 0) - || (targ_port > CTL_MAX_PORTS)) { - printf("%s: invalid port number %d\n", __func__, targ_port); - return (1); - } - if (iid > CTL_MAX_INIT_PER_PORT) { - printf("%s: WWPN %#jx initiator ID %u > maximun %u!\n", + if (iid >= CTL_MAX_INIT_PER_PORT) { + printf("%s: WWPN %#jx initiator ID %u > maximum %u!\n", __func__, wwpn, iid, CTL_MAX_INIT_PER_PORT); - return (1); + free(name, M_CTL); + return (-1); } mtx_lock(&softc->ctl_lock); - if (softc->wwpn_iid[targ_port][iid].in_use != 0) { + if (iid < 0 && (wwpn != 0 || name != NULL)) { + for (i = 0; i < CTL_MAX_INIT_PER_PORT; i++) { + if (wwpn != 0 && wwpn == port->wwpn_iid[i].wwpn) { + iid = i; + break; + } + if (name != NULL && port->wwpn_iid[i].name != NULL && + strcmp(name, port->wwpn_iid[i].name) == 0) { + iid = i; + break; + } + } + } + + if (iid < 0) { + for (i = 0; i < CTL_MAX_INIT_PER_PORT; i++) { + if (port->wwpn_iid[i].in_use == 0 && + port->wwpn_iid[i].wwpn == 0 && + port->wwpn_iid[i].name == NULL) { + iid = i; + break; + } + } + } + + if (iid < 0) { + best = -1; + best_time = INT32_MAX; + for (i = 0; i < CTL_MAX_INIT_PER_PORT; i++) { + if (port->wwpn_iid[i].in_use == 0) { + if (port->wwpn_iid[i].last_use < best_time) { + best = i; + best_time = port->wwpn_iid[i].last_use; + } + } + } + iid = best; + } + + if (iid < 0) { + mtx_unlock(&softc->ctl_lock); + free(name, M_CTL); + return (-2); + } + + if (port->wwpn_iid[iid].in_use > 0 && (wwpn != 0 || name != NULL)) { /* - * We don't treat this as an error. + * This is not an error yet. */ - if (softc->wwpn_iid[targ_port][iid].wwpn == wwpn) { - printf("%s: port %d iid %u WWPN %#jx arrived again?\n", - __func__, targ_port, iid, (uintmax_t)wwpn); - goto bailout; + if (wwpn != 0 && wwpn == port->wwpn_iid[iid].wwpn) { +#if 0 + printf("%s: port %d iid %u WWPN %#jx arrived" + " again\n", __func__, port->targ_port, + iid, (uintmax_t)wwpn); +#endif + goto take; + } + if (name != NULL && port->wwpn_iid[iid].name != NULL && + strcmp(name, port->wwpn_iid[iid].name) == 0) { +#if 0 + printf("%s: port %d iid %u name '%s' arrived" + " again\n", __func__, port->targ_port, + iid, name); +#endif + goto take; } /* @@ -1477,42 +1479,80 @@ ctl_add_initiator(uint64_t wwpn, int32_t targ_port, uint32_t iid) * driver is telling us we have a new WWPN for this * initiator ID, so we pretty much need to use it. */ - printf("%s: port %d iid %u WWPN %#jx arrived, WWPN %#jx is " - "still at that address\n", __func__, targ_port, iid, - (uintmax_t)wwpn, - (uintmax_t)softc->wwpn_iid[targ_port][iid].wwpn); + printf("%s: port %d iid %u WWPN %#jx '%s' arrived," + " but WWPN %#jx '%s' is still at that address\n", + __func__, port->targ_port, iid, wwpn, name, + (uintmax_t)port->wwpn_iid[iid].wwpn, + port->wwpn_iid[iid].name); /* * XXX KDM clear have_ca and ua_pending on each LUN for * this initiator. */ } - softc->wwpn_iid[targ_port][iid].in_use = 1; - softc->wwpn_iid[targ_port][iid].iid = iid; - softc->wwpn_iid[targ_port][iid].wwpn = wwpn; - softc->wwpn_iid[targ_port][iid].port = targ_port; - -bailout: - +take: + free(port->wwpn_iid[iid].name, M_CTL); + port->wwpn_iid[iid].name = name; + port->wwpn_iid[iid].wwpn = wwpn; + port->wwpn_iid[iid].in_use++; mtx_unlock(&softc->ctl_lock); - return (retval); -} - -/* - * XXX KDM should we pretend to do something in the target/lun - * enable/disable functions? - */ -static int -ctl_ioctl_targ_enable(void *arg, struct ctl_id targ_id) -{ - return (0); + return (iid); } static int -ctl_ioctl_targ_disable(void *arg, struct ctl_id targ_id) +ctl_create_iid(struct ctl_port *port, int iid, uint8_t *buf) { - return (0); + int len; + + switch (port->port_type) { + case CTL_PORT_FC: + { + struct scsi_transportid_fcp *id = + (struct scsi_transportid_fcp *)buf; + if (port->wwpn_iid[iid].wwpn == 0) + return (0); + memset(id, 0, sizeof(*id)); + id->format_protocol = SCSI_PROTO_FC; + scsi_u64to8b(port->wwpn_iid[iid].wwpn, id->n_port_name); + return (sizeof(*id)); + } + case CTL_PORT_ISCSI: + { + struct scsi_transportid_iscsi_port *id = + (struct scsi_transportid_iscsi_port *)buf; + if (port->wwpn_iid[iid].name == NULL) + return (0); + memset(id, 0, 256); + id->format_protocol = SCSI_TRN_ISCSI_FORMAT_PORT | + SCSI_PROTO_ISCSI; + len = strlcpy(id->iscsi_name, port->wwpn_iid[iid].name, 252) + 1; + len = roundup2(min(len, 252), 4); + scsi_ulto2b(len, id->additional_length); + return (sizeof(*id) + len); + } + case CTL_PORT_SAS: + { + struct scsi_transportid_sas *id = + (struct scsi_transportid_sas *)buf; + if (port->wwpn_iid[iid].wwpn == 0) + return (0); + memset(id, 0, sizeof(*id)); + id->format_protocol = SCSI_PROTO_SAS; + scsi_u64to8b(port->wwpn_iid[iid].wwpn, id->sas_address); + return (sizeof(*id)); + } + default: + { + struct scsi_transportid_spi *id = + (struct scsi_transportid_spi *)buf; + memset(id, 0, sizeof(*id)); + id->format_protocol = SCSI_PROTO_SPI; + scsi_ulto2b(iid, id->scsi_addr); + scsi_ulto2b(port->targ_port, id->rel_trgt_port_id); + return (sizeof(*id)); + } + } } static int @@ -1699,7 +1739,7 @@ ctl_ioctl_do_datamove(struct ctl_scsiio *ctsio) * (SER_ONLY mode). */ static int -ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio, int have_lock) +ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio) { struct ctl_softc *ctl_softc; union ctl_ha_msg msg_info; @@ -1708,12 +1748,8 @@ ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio, int have_lock) uint32_t targ_lun; ctl_softc = control_softc; - if (have_lock == 0) - mtx_lock(&ctl_softc->ctl_lock); - targ_lun = ctsio->io_hdr.nexus.targ_lun; - if (ctsio->io_hdr.nexus.lun_map_fn != NULL) - targ_lun = ctsio->io_hdr.nexus.lun_map_fn(ctsio->io_hdr.nexus.lun_map_arg, targ_lun); + targ_lun = ctsio->io_hdr.nexus.targ_mapped_lun; lun = ctl_softc->ctl_luns[targ_lun]; if (lun==NULL) { @@ -1742,12 +1778,11 @@ ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio, int have_lock) if (ctl_ha_msg_send(CTL_HA_CHAN_CTL, &msg_info, sizeof(msg_info), 0 ) > CTL_HA_STATUS_SUCCESS) { } - if (have_lock == 0) - mtx_unlock(&ctl_softc->ctl_lock); return(1); } + mtx_lock(&lun->lun_lock); TAILQ_INSERT_TAIL(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); switch (ctl_check_ooa(lun, (union ctl_io *)ctsio, @@ -1762,8 +1797,7 @@ ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio, int have_lock) case CTL_ACTION_SKIP: if (ctl_softc->ha_mode == CTL_HA_MODE_XFER) { ctsio->io_hdr.flags |= CTL_FLAG_IS_WAS_ON_RTR; - STAILQ_INSERT_TAIL(&ctl_softc->rtr_queue, - &ctsio->io_hdr, links); + ctl_enqueue_rtr((union ctl_io *)ctsio); } else { /* send msg back to other side */ @@ -1858,8 +1892,7 @@ ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio, int have_lock) } break; } - if (have_lock == 0) - mtx_unlock(&ctl_softc->ctl_lock); + mtx_unlock(&lun->lun_lock); return (retval); } @@ -2018,8 +2051,7 @@ ctl_ioctl_fill_ooa(struct ctl_lun *lun, uint32_t *cur_fill_num, retval = 0; - mtx_assert(&control_softc->ctl_lock, MA_OWNED); - + mtx_lock(&lun->lun_lock); for (io = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); (io != NULL); (*cur_fill_num)++, io = (union ctl_io *)TAILQ_NEXT(&io->io_hdr, ooa_links)) { @@ -2056,6 +2088,7 @@ ctl_ioctl_fill_ooa(struct ctl_lun *lun, uint32_t *cur_fill_num, if (io->io_hdr.flags & CTL_FLAG_DMA_QUEUED) entry->cmd_flags |= CTL_OOACMD_FLAG_DMA_QUEUED; } + mtx_unlock(&lun->lun_lock); return (retval); } @@ -2080,40 +2113,40 @@ ctl_copyin_alloc(void *user_addr, int len, char *error_str, } static void -ctl_free_args(int num_be_args, struct ctl_be_arg *be_args) +ctl_free_args(int num_args, struct ctl_be_arg *args) { int i; - if (be_args == NULL) + if (args == NULL) return; - for (i = 0; i < num_be_args; i++) { - free(be_args[i].kname, M_CTL); - free(be_args[i].kvalue, M_CTL); + for (i = 0; i < num_args; i++) { + free(args[i].kname, M_CTL); + free(args[i].kvalue, M_CTL); } - free(be_args, M_CTL); + free(args, M_CTL); } static struct ctl_be_arg * -ctl_copyin_args(int num_be_args, struct ctl_be_arg *be_args, +ctl_copyin_args(int num_args, struct ctl_be_arg *uargs, char *error_str, size_t error_str_len) { struct ctl_be_arg *args; int i; - args = ctl_copyin_alloc(be_args, num_be_args * sizeof(*be_args), + args = ctl_copyin_alloc(uargs, num_args * sizeof(*args), error_str, error_str_len); if (args == NULL) goto bailout; - for (i = 0; i < num_be_args; i++) { + for (i = 0; i < num_args; i++) { args[i].kname = NULL; args[i].kvalue = NULL; } - for (i = 0; i < num_be_args; i++) { + for (i = 0; i < num_args; i++) { uint8_t *tmpptr; args[i].kname = ctl_copyin_alloc(args[i].name, @@ -2127,31 +2160,43 @@ ctl_copyin_args(int num_be_args, struct ctl_be_arg *be_args, goto bailout; } - args[i].kvalue = NULL; - - tmpptr = ctl_copyin_alloc(args[i].value, - args[i].vallen, error_str, error_str_len); - if (tmpptr == NULL) - goto bailout; - - args[i].kvalue = tmpptr; - - if ((args[i].flags & CTL_BEARG_ASCII) - && (tmpptr[args[i].vallen - 1] != '\0')) { - snprintf(error_str, error_str_len, "Argument %d " - "value is not NUL-terminated", i); - goto bailout; + if (args[i].flags & CTL_BEARG_RD) { + tmpptr = ctl_copyin_alloc(args[i].value, + args[i].vallen, error_str, error_str_len); + if (tmpptr == NULL) + goto bailout; + if ((args[i].flags & CTL_BEARG_ASCII) + && (tmpptr[args[i].vallen - 1] != '\0')) { + snprintf(error_str, error_str_len, "Argument " + "%d value is not NUL-terminated", i); + goto bailout; + } + args[i].kvalue = tmpptr; + } else { + args[i].kvalue = malloc(args[i].vallen, + M_CTL, M_WAITOK | M_ZERO); } } return (args); bailout: - ctl_free_args(num_be_args, args); + ctl_free_args(num_args, args); return (NULL); } +static void +ctl_copyout_args(int num_args, struct ctl_be_arg *args) +{ + int i; + + for (i = 0; i < num_args; i++) { + if (args[i].flags & CTL_BEARG_WR) + copyout(args[i].kvalue, args[i].value, args[i].vallen); + } +} + /* * Escape characters that are illegal or not recommended in XML. */ @@ -2207,14 +2252,14 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, * to this FETD. */ if ((softc->ioctl_info.flags & CTL_IOCTL_FLAG_ENABLED) == 0) { - retval = -EPERM; + retval = EPERM; break; } - io = ctl_alloc_io(softc->ioctl_info.fe.ctl_pool_ref); + io = ctl_alloc_io(softc->ioctl_info.port.ctl_pool_ref); if (io == NULL) { printf("ctl_ioctl: can't allocate ctl_io!\n"); - retval = -ENOSPC; + retval = ENOSPC; break; } @@ -2235,7 +2280,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, /* * The user sets the initiator ID, target and LUN IDs. */ - io->io_hdr.nexus.targ_port = softc->ioctl_info.fe.targ_port; + io->io_hdr.nexus.targ_port = softc->ioctl_info.port.targ_port; io->io_hdr.flags |= CTL_FLAG_USER_REQ; if ((io->io_hdr.io_type == CTL_IO_SCSI) && (io->scsiio.tag_type != CTL_TAG_UNTAGGED)) @@ -2258,20 +2303,20 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, case CTL_ENABLE_PORT: case CTL_DISABLE_PORT: case CTL_SET_PORT_WWNS: { - struct ctl_frontend *fe; + struct ctl_port *port; struct ctl_port_entry *entry; entry = (struct ctl_port_entry *)addr; mtx_lock(&softc->ctl_lock); - STAILQ_FOREACH(fe, &softc->fe_list, links) { + STAILQ_FOREACH(port, &softc->port_list, links) { int action, done; action = 0; done = 0; if ((entry->port_type == CTL_PORT_NONE) - && (entry->targ_port == fe->targ_port)) { + && (entry->targ_port == port->targ_port)) { /* * If the user only wants to enable or * disable or set WWNs on a specific port, @@ -2279,7 +2324,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, */ action = 1; done = 1; - } else if (entry->port_type & fe->port_type) { + } else if (entry->port_type & port->port_type) { /* * Compare the user's type mask with the * particular frontend type to see if we @@ -2314,21 +2359,21 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, STAILQ_FOREACH(lun, &softc->lun_list, links) { - fe->lun_enable(fe->targ_lun_arg, + port->lun_enable(port->targ_lun_arg, lun->target, lun->lun); } - ctl_frontend_online(fe); + ctl_port_online(port); } else if (cmd == CTL_DISABLE_PORT) { struct ctl_lun *lun; - ctl_frontend_offline(fe); + ctl_port_offline(port); STAILQ_FOREACH(lun, &softc->lun_list, links) { - fe->lun_disable( - fe->targ_lun_arg, + port->lun_disable( + port->targ_lun_arg, lun->target, lun->lun); } @@ -2337,7 +2382,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, mtx_lock(&softc->ctl_lock); if (cmd == CTL_SET_PORT_WWNS) - ctl_frontend_set_wwns(fe, + ctl_port_set_wwns(port, (entry->flags & CTL_PORT_WWNN_VALID) ? 1 : 0, entry->wwnn, (entry->flags & CTL_PORT_WWPN_VALID) ? @@ -2350,7 +2395,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, break; } case CTL_GET_PORT_LIST: { - struct ctl_frontend *fe; + struct ctl_port *port; struct ctl_port_list *list; int i; @@ -2370,7 +2415,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, list->dropped_num = 0; i = 0; mtx_lock(&softc->ctl_lock); - STAILQ_FOREACH(fe, &softc->fe_list, links) { + STAILQ_FOREACH(port, &softc->port_list, links) { struct ctl_port_entry entry, *list_entry; if (list->fill_num >= list->alloc_num) { @@ -2378,15 +2423,15 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, continue; } - entry.port_type = fe->port_type; - strlcpy(entry.port_name, fe->port_name, + entry.port_type = port->port_type; + strlcpy(entry.port_name, port->port_name, sizeof(entry.port_name)); - entry.targ_port = fe->targ_port; - entry.physical_port = fe->physical_port; - entry.virtual_port = fe->virtual_port; - entry.wwnn = fe->wwnn; - entry.wwpn = fe->wwpn; - if (fe->status & CTL_PORT_STATUS_ONLINE) + entry.targ_port = port->targ_port; + entry.physical_port = port->physical_port; + entry.virtual_port = port->virtual_port; + entry.wwnn = port->wwnn; + entry.wwpn = port->wwpn; + if (port->status & CTL_PORT_STATUS_ONLINE) entry.online = 1; else entry.online = 0; @@ -2428,6 +2473,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, mtx_lock(&softc->ctl_lock); printf("Dumping OOA queues:\n"); STAILQ_FOREACH(lun, &softc->lun_list, links) { + mtx_lock(&lun->lun_lock); for (io = (union ctl_io *)TAILQ_FIRST( &lun->ooa_queue); io != NULL; io = (union ctl_io *)TAILQ_NEXT(&io->io_hdr, @@ -2449,6 +2495,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, sbuf_finish(&sb); printf("%s\n", sbuf_data(&sb)); } + mtx_unlock(&lun->lun_lock); } printf("OOA queues dump done\n"); mtx_unlock(&softc->ctl_lock); @@ -2564,15 +2611,16 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, ooa_info->status = CTL_OOA_INVALID_LUN; break; } - + mtx_lock(&lun->lun_lock); + mtx_unlock(&softc->ctl_lock); ooa_info->num_entries = 0; for (io = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); io != NULL; io = (union ctl_io *)TAILQ_NEXT( &io->io_hdr, ooa_links)) { ooa_info->num_entries++; } + mtx_unlock(&lun->lun_lock); - mtx_unlock(&softc->ctl_lock); ooa_info->status = CTL_OOA_SUCCESS; break; @@ -2690,6 +2738,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, delay_info->status = CTL_DELAY_STATUS_INVALID_LUN; } else { lun = softc->ctl_luns[delay_info->lun_id]; + mtx_lock(&lun->lun_lock); delay_info->status = CTL_DELAY_STATUS_OK; @@ -2722,6 +2771,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, CTL_DELAY_STATUS_INVALID_LOC; break; } + mtx_unlock(&lun->lun_lock); } mtx_unlock(&softc->ctl_lock); @@ -2744,7 +2794,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, softc->flags |= CTL_FLAG_REAL_SYNC; break; default: - retval = -EINVAL; + retval = EINVAL; break; } mtx_unlock(&softc->ctl_lock); @@ -2782,12 +2832,13 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, * in the set case, hopefully the user won't do something * silly. */ + mtx_lock(&lun->lun_lock); + mtx_unlock(&softc->ctl_lock); if (cmd == CTL_GETSYNC) sync_info->sync_interval = lun->sync_interval; else lun->sync_interval = sync_info->sync_interval; - - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); sync_info->status = CTL_GS_SYNC_OK; @@ -2848,6 +2899,8 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, retval = EINVAL; break; } + mtx_lock(&lun->lun_lock); + mtx_unlock(&softc->ctl_lock); /* * We could do some checking here to verify the validity @@ -2870,7 +2923,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, err_desc->serial = lun->error_serial; lun->error_serial++; - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); break; } case CTL_ERROR_INJECT_DELETE: { @@ -2890,6 +2943,8 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, retval = EINVAL; break; } + mtx_lock(&lun->lun_lock); + mtx_unlock(&softc->ctl_lock); STAILQ_FOREACH_SAFE(desc, &lun->error_list, links, desc2) { if (desc->serial != delete_desc->serial) continue; @@ -2899,7 +2954,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, free(desc, M_CTL); delete_done = 1; } - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); if (delete_done == 0) { printf("%s: CTL_ERROR_INJECT_DELETE: can't find " "error serial %ju on LUN %u\n", __func__, @@ -2910,22 +2965,11 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, break; } case CTL_DUMP_STRUCTS: { - int i, j, k; + int i, j, k, idx; + struct ctl_port *port; struct ctl_frontend *fe; - printf("CTL IID to WWPN map start:\n"); - for (i = 0; i < CTL_MAX_PORTS; i++) { - for (j = 0; j < CTL_MAX_INIT_PER_PORT; j++) { - if (softc->wwpn_iid[i][j].in_use == 0) - continue; - - printf("port %d iid %u WWPN %#jx\n", - softc->wwpn_iid[i][j].port, - softc->wwpn_iid[i][j].iid, - (uintmax_t)softc->wwpn_iid[i][j].wwpn); - } - } - printf("CTL IID to WWPN map end\n"); + mtx_lock(&softc->ctl_lock); printf("CTL Persistent Reservation information start:\n"); for (i = 0; i < CTL_MAX_LUNS; i++) { struct ctl_lun *lun; @@ -2938,36 +2982,48 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, for (j = 0; j < (CTL_MAX_PORTS * 2); j++) { for (k = 0; k < CTL_MAX_INIT_PER_PORT; k++){ - if (lun->per_res[j+k].registered == 0) + idx = j * CTL_MAX_INIT_PER_PORT + k; + if (lun->per_res[idx].registered == 0) continue; - printf("LUN %d port %d iid %d key " + printf(" LUN %d port %d iid %d key " "%#jx\n", i, j, k, (uintmax_t)scsi_8btou64( - lun->per_res[j+k].res_key.key)); + lun->per_res[idx].res_key.key)); } } } printf("CTL Persistent Reservation information end\n"); - printf("CTL Frontends:\n"); + printf("CTL Ports:\n"); + STAILQ_FOREACH(port, &softc->port_list, links) { + printf(" Port %d '%s' Frontend '%s' Type %u pp %d vp %d WWNN " + "%#jx WWPN %#jx\n", port->targ_port, port->port_name, + port->frontend->name, port->port_type, + port->physical_port, port->virtual_port, + (uintmax_t)port->wwnn, (uintmax_t)port->wwpn); + for (j = 0; j < CTL_MAX_INIT_PER_PORT; j++) { + if (port->wwpn_iid[j].in_use == 0 && + port->wwpn_iid[j].wwpn == 0 && + port->wwpn_iid[j].name == NULL) + continue; + + printf(" iid %u use %d WWPN %#jx '%s'\n", + j, port->wwpn_iid[j].in_use, + (uintmax_t)port->wwpn_iid[j].wwpn, + port->wwpn_iid[j].name); + } + } + printf("CTL Port information end\n"); + mtx_unlock(&softc->ctl_lock); /* * XXX KDM calling this without a lock. We'd likely want * to drop the lock before calling the frontend's dump * routine anyway. */ + printf("CTL Frontends:\n"); STAILQ_FOREACH(fe, &softc->fe_list, links) { - printf("Frontend %s Type %u pport %d vport %d WWNN " - "%#jx WWPN %#jx\n", fe->port_name, fe->port_type, - fe->physical_port, fe->virtual_port, - (uintmax_t)fe->wwnn, (uintmax_t)fe->wwpn); - - /* - * Frontends are not required to support the dump - * routine. - */ - if (fe->fe_dump == NULL) - continue; - - fe->fe_dump(); + printf(" Frontend '%s'\n", fe->name); + if (fe->fe_dump != NULL) + fe->fe_dump(); } printf("CTL Frontend information end\n"); break; @@ -3002,6 +3058,8 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, retval = backend->ioctl(dev, cmd, addr, flag, td); if (lun_req->num_be_args > 0) { + ctl_copyout_args(lun_req->num_be_args, + lun_req->kern_be_args); ctl_free_args(lun_req->num_be_args, lun_req->kern_be_args); } @@ -3011,7 +3069,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct sbuf *sb; struct ctl_lun *lun; struct ctl_lun_list *list; - struct ctl_be_lun_option *opt; + struct ctl_option *opt; list = (struct ctl_lun_list *)addr; @@ -3052,8 +3110,8 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, sbuf_printf(sb, "\n"); mtx_lock(&softc->ctl_lock); - STAILQ_FOREACH(lun, &softc->lun_list, links) { + mtx_lock(&lun->lun_lock); retval = sbuf_printf(sb, "\n", (uintmax_t)lun->lun); @@ -3064,7 +3122,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, if (retval != 0) break; - retval = sbuf_printf(sb, "%s" + retval = sbuf_printf(sb, "\t%s" "\n", (lun->backend == NULL) ? "none" : lun->backend->name); @@ -3072,7 +3130,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, if (retval != 0) break; - retval = sbuf_printf(sb, "%d\n", + retval = sbuf_printf(sb, "\t%d\n", lun->be_lun->lun_type); if (retval != 0) @@ -3085,20 +3143,20 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, continue; } - retval = sbuf_printf(sb, "%ju\n", + retval = sbuf_printf(sb, "\t%ju\n", (lun->be_lun->maxlba > 0) ? lun->be_lun->maxlba + 1 : 0); if (retval != 0) break; - retval = sbuf_printf(sb, "%u\n", + retval = sbuf_printf(sb, "\t%u\n", lun->be_lun->blocksize); if (retval != 0) break; - retval = sbuf_printf(sb, ""); + retval = sbuf_printf(sb, "\t"); if (retval != 0) break; @@ -3114,7 +3172,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, if (retval != 0) break; - retval = sbuf_printf(sb, ""); + retval = sbuf_printf(sb, "\t"); if (retval != 0) break; @@ -3135,7 +3193,8 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, break; } STAILQ_FOREACH(opt, &lun->be_lun->options, links) { - retval = sbuf_printf(sb, "<%s>%s", opt->name, opt->value, opt->name); + retval = sbuf_printf(sb, "\t<%s>%s\n", + opt->name, opt->value, opt->name); if (retval != 0) break; } @@ -3144,7 +3203,10 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, if (retval != 0) break; + mtx_unlock(&lun->lun_lock); } + if (lun != NULL) + mtx_unlock(&lun->lun_lock); mtx_unlock(&softc->ctl_lock); if ((retval != 0) @@ -3174,22 +3236,157 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, ci = (struct ctl_iscsi *)addr; - mtx_lock(&softc->ctl_lock); - STAILQ_FOREACH(fe, &softc->fe_list, links) { - if (strcmp(fe->port_name, "iscsi") == 0) - break; - } - mtx_unlock(&softc->ctl_lock); - + fe = ctl_frontend_find("iscsi"); if (fe == NULL) { ci->status = CTL_ISCSI_ERROR; - snprintf(ci->error_str, sizeof(ci->error_str), "Backend \"iscsi\" not found."); + snprintf(ci->error_str, sizeof(ci->error_str), + "Frontend \"iscsi\" not found."); break; } retval = fe->ioctl(dev, cmd, addr, flag, td); break; } + case CTL_PORT_REQ: { + struct ctl_req *req; + struct ctl_frontend *fe; + + req = (struct ctl_req *)addr; + + fe = ctl_frontend_find(req->driver); + if (fe == NULL) { + req->status = CTL_LUN_ERROR; + snprintf(req->error_str, sizeof(req->error_str), + "Frontend \"%s\" not found.", req->driver); + break; + } + if (req->num_args > 0) { + req->kern_args = ctl_copyin_args(req->num_args, + req->args, req->error_str, sizeof(req->error_str)); + if (req->kern_args == NULL) { + req->status = CTL_LUN_ERROR; + break; + } + } + + retval = fe->ioctl(dev, cmd, addr, flag, td); + + if (req->num_args > 0) { + ctl_copyout_args(req->num_args, req->kern_args); + ctl_free_args(req->num_args, req->kern_args); + } + break; + } + case CTL_PORT_LIST: { + struct sbuf *sb; + struct ctl_port *port; + struct ctl_lun_list *list; + struct ctl_option *opt; + + list = (struct ctl_lun_list *)addr; + + sb = sbuf_new(NULL, NULL, list->alloc_len, SBUF_FIXEDLEN); + if (sb == NULL) { + list->status = CTL_LUN_LIST_ERROR; + snprintf(list->error_str, sizeof(list->error_str), + "Unable to allocate %d bytes for LUN list", + list->alloc_len); + break; + } + + sbuf_printf(sb, "\n"); + + mtx_lock(&softc->ctl_lock); + STAILQ_FOREACH(port, &softc->port_list, links) { + retval = sbuf_printf(sb, "\n", + (uintmax_t)port->targ_port); + + /* + * Bail out as soon as we see that we've overfilled + * the buffer. + */ + if (retval != 0) + break; + + retval = sbuf_printf(sb, "\t%s" + "\n", port->frontend->name); + if (retval != 0) + break; + + retval = sbuf_printf(sb, "\t%d\n", + port->port_type); + if (retval != 0) + break; + + retval = sbuf_printf(sb, "\t%s\n", + (port->status & CTL_PORT_STATUS_ONLINE) ? "YES" : "NO"); + if (retval != 0) + break; + + retval = sbuf_printf(sb, "\t%s\n", + port->port_name); + if (retval != 0) + break; + + retval = sbuf_printf(sb, "\t%d\n", + port->physical_port); + if (retval != 0) + break; + + retval = sbuf_printf(sb, "\t%d\n", + port->virtual_port); + if (retval != 0) + break; + + retval = sbuf_printf(sb, "\t%#jx\n", + (uintmax_t)port->wwnn); + if (retval != 0) + break; + + retval = sbuf_printf(sb, "\t%#jx\n", + (uintmax_t)port->wwpn); + if (retval != 0) + break; + + if (port->port_info != NULL) { + retval = port->port_info(port->onoff_arg, sb); + if (retval != 0) + break; + } + STAILQ_FOREACH(opt, &port->options, links) { + retval = sbuf_printf(sb, "\t<%s>%s\n", + opt->name, opt->value, opt->name); + if (retval != 0) + break; + } + + retval = sbuf_printf(sb, "\n"); + if (retval != 0) + break; + } + mtx_unlock(&softc->ctl_lock); + + if ((retval != 0) + || ((retval = sbuf_printf(sb, "\n")) != 0)) { + retval = 0; + sbuf_delete(sb); + list->status = CTL_LUN_LIST_NEED_MORE_SPACE; + snprintf(list->error_str, sizeof(list->error_str), + "Out of space, %d bytes is too small", + list->alloc_len); + break; + } + + sbuf_finish(sb); + + retval = copyout(sbuf_data(sb), list->lun_xml, + sbuf_len(sb) + 1); + + list->fill_len = sbuf_len(sb) + 1; + list->status = CTL_LUN_LIST_OK; + sbuf_delete(sb); + break; + } default: { /* XXX KDM should we fix this? */ #if 0 @@ -3215,7 +3412,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, if (found == 0) { printf("ctl: unknown ioctl command %#lx or backend " "%d\n", cmd, type); - retval = -EINVAL; + retval = EINVAL; break; } retval = backend->ioctl(dev, cmd, addr, flag, td); @@ -3254,6 +3451,35 @@ ctl_port_idx(int port_num) return(port_num - CTL_MAX_PORTS); } +static uint32_t +ctl_map_lun(int port_num, uint32_t lun_id) +{ + struct ctl_port *port; + + port = control_softc->ctl_ports[ctl_port_idx(port_num)]; + if (port == NULL) + return (UINT32_MAX); + if (port->lun_map == NULL) + return (lun_id); + return (port->lun_map(port->targ_lun_arg, lun_id)); +} + +static uint32_t +ctl_map_lun_back(int port_num, uint32_t lun_id) +{ + struct ctl_port *port; + uint32_t i; + + port = control_softc->ctl_ports[ctl_port_idx(port_num)]; + if (port->lun_map == NULL) + return (lun_id); + for (i = 0; i < CTL_MAX_LUNS; i++) { + if (port->lun_map(port->targ_lun_arg, i) == lun_id) + return (i); + } + return (UINT32_MAX); +} + /* * Note: This only works for bitmask sizes that are at least 32 bits, and * that are a power of 2. @@ -3380,7 +3606,7 @@ ctl_pool_create(struct ctl_softc *ctl_softc, ctl_pool_type pool_type, pool = (struct ctl_io_pool *)malloc(sizeof(*pool), M_CTL, M_NOWAIT | M_ZERO); if (pool == NULL) { - retval = -ENOMEM; + retval = ENOMEM; goto bailout; } @@ -3403,7 +3629,7 @@ ctl_pool_create(struct ctl_softc *ctl_softc, ctl_pool_type pool_type, * tracking. */ for (i = 0; i < total_ctl_io; i++) { - cur_io = (union ctl_io *)malloc(sizeof(*cur_io), M_CTL, + cur_io = (union ctl_io *)malloc(sizeof(*cur_io), M_CTLIO, M_NOWAIT); if (cur_io == NULL) { retval = ENOMEM; @@ -3422,7 +3648,7 @@ ctl_pool_create(struct ctl_softc *ctl_softc, ctl_pool_type pool_type, links); STAILQ_REMOVE(&pool->free_queue, &cur_io->io_hdr, ctl_io_hdr, links); - free(cur_io, M_CTL); + free(cur_io, M_CTLIO); } free(pool, M_CTL); @@ -3442,7 +3668,6 @@ ctl_pool_create(struct ctl_softc *ctl_softc, ctl_pool_type pool_type, #if 0 if ((pool_type != CTL_POOL_EMERGENCY) && (pool_type != CTL_POOL_INTERNAL) - && (pool_type != CTL_POOL_IOCTL) && (pool_type != CTL_POOL_4OTHERSC)) MOD_INC_USE_COUNT; #endif @@ -3463,7 +3688,7 @@ ctl_pool_acquire(struct ctl_io_pool *pool) mtx_assert(&pool->ctl_softc->pool_lock, MA_OWNED); if (pool->flags & CTL_POOL_FLAG_INVALID) - return (-EINVAL); + return (EINVAL); pool->refcount++; @@ -3484,7 +3709,7 @@ ctl_pool_release(struct ctl_io_pool *pool) while ((io = (union ctl_io *)STAILQ_FIRST(&pool->free_queue)) != NULL) { STAILQ_REMOVE(&pool->free_queue, &io->io_hdr, ctl_io_hdr, links); - free(io, M_CTL); + free(io, M_CTLIO); } STAILQ_REMOVE(&ctl_softc->io_pools, pool, ctl_io_pool, links); @@ -3496,7 +3721,7 @@ ctl_pool_release(struct ctl_io_pool *pool) #if 0 if ((pool->type != CTL_POOL_EMERGENCY) && (pool->type != CTL_POOL_INTERNAL) - && (pool->type != CTL_POOL_IOCTL)) + && (pool->type != CTL_POOL_4OTHERSC)) MOD_DEC_USE_COUNT; #endif @@ -3588,7 +3813,7 @@ ctl_alloc_io(void *pool_ref) * The emergency pool (if it exists) didn't have one, so try an * atomic (i.e. nonblocking) malloc and see if we get lucky. */ - io = (union ctl_io *)malloc(sizeof(*io), M_CTL, M_NOWAIT); + io = (union ctl_io *)malloc(sizeof(*io), M_CTLIO, M_NOWAIT); if (io != NULL) { /* * If the emergency pool exists but is empty, add this @@ -3626,49 +3851,9 @@ ctl_free_io(union ctl_io *io) */ if (io->io_hdr.pool != NULL) { struct ctl_io_pool *pool; -#if 0 - struct ctl_softc *ctl_softc; - union ctl_io *tmp_io; - unsigned long xflags; - int i; - - ctl_softc = control_softc; -#endif pool = (struct ctl_io_pool *)io->io_hdr.pool; - mtx_lock(&pool->ctl_softc->pool_lock); -#if 0 - save_flags(xflags); - - for (i = 0, tmp_io = (union ctl_io *)STAILQ_FIRST( - &ctl_softc->task_queue); tmp_io != NULL; i++, - tmp_io = (union ctl_io *)STAILQ_NEXT(&tmp_io->io_hdr, - links)) { - if (tmp_io == io) { - printf("%s: %p is still on the task queue!\n", - __func__, tmp_io); - printf("%s: (%d): type %d " - "msg %d cdb %x iptl: " - "%d:%d:%d:%d tag 0x%04x " - "flg %#lx\n", - __func__, i, - tmp_io->io_hdr.io_type, - tmp_io->io_hdr.msg_type, - tmp_io->scsiio.cdb[0], - tmp_io->io_hdr.nexus.initid.id, - tmp_io->io_hdr.nexus.targ_port, - tmp_io->io_hdr.nexus.targ_target.id, - tmp_io->io_hdr.nexus.targ_lun, - (tmp_io->io_hdr.io_type == - CTL_IO_TASK) ? - tmp_io->taskio.tag_num : - tmp_io->scsiio.tag_num, - xflags); - panic("I/O still on the task queue!"); - } - } -#endif io->io_hdr.io_type = 0xff; STAILQ_INSERT_TAIL(&pool->free_queue, &io->io_hdr, links); pool->total_freed++; @@ -3680,7 +3865,7 @@ ctl_free_io(union ctl_io *io) * Otherwise, just free it. We probably malloced it and * the emergency pool wasn't available. */ - free(io, M_CTL); + free(io, M_CTLIO); } } @@ -4242,8 +4427,12 @@ ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *ctl_lun, struct ctl_be_lun *const be_lun, struct ctl_id target_id) { struct ctl_lun *nlun, *lun; - struct ctl_frontend *fe; + struct ctl_port *port; + struct scsi_vpd_id_descriptor *desc; + struct scsi_vpd_id_t10 *t10id; + const char *eui, *naa, *scsiname, *vendor; int lun_number, i, lun_malloced; + int devidlen, idlen1, idlen2 = 0, len; if (be_lun == NULL) return (EINVAL); @@ -4275,6 +4464,69 @@ ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *ctl_lun, if (lun_malloced) lun->flags = CTL_LUN_MALLOCED; + /* Generate LUN ID. */ + devidlen = max(CTL_DEVID_MIN_LEN, + strnlen(be_lun->device_id, CTL_DEVID_LEN)); + idlen1 = sizeof(*t10id) + devidlen; + len = sizeof(struct scsi_vpd_id_descriptor) + idlen1; + scsiname = ctl_get_opt(&be_lun->options, "scsiname"); + if (scsiname != NULL) { + idlen2 = roundup2(strlen(scsiname) + 1, 4); + len += sizeof(struct scsi_vpd_id_descriptor) + idlen2; + } + eui = ctl_get_opt(&be_lun->options, "eui"); + if (eui != NULL) { + len += sizeof(struct scsi_vpd_id_descriptor) + 8; + } + naa = ctl_get_opt(&be_lun->options, "naa"); + if (naa != NULL) { + len += sizeof(struct scsi_vpd_id_descriptor) + 8; + } + lun->lun_devid = malloc(sizeof(struct ctl_devid) + len, + M_CTL, M_WAITOK | M_ZERO); + lun->lun_devid->len = len; + desc = (struct scsi_vpd_id_descriptor *)lun->lun_devid->data; + desc->proto_codeset = SVPD_ID_CODESET_ASCII; + desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN | SVPD_ID_TYPE_T10; + desc->length = idlen1; + t10id = (struct scsi_vpd_id_t10 *)&desc->identifier[0]; + memset(t10id->vendor, ' ', sizeof(t10id->vendor)); + if ((vendor = ctl_get_opt(&be_lun->options, "vendor")) == NULL) { + strncpy((char *)t10id->vendor, CTL_VENDOR, sizeof(t10id->vendor)); + } else { + strncpy(t10id->vendor, vendor, + min(sizeof(t10id->vendor), strlen(vendor))); + } + strncpy((char *)t10id->vendor_spec_id, + (char *)be_lun->device_id, devidlen); + if (scsiname != NULL) { + desc = (struct scsi_vpd_id_descriptor *)(&desc->identifier[0] + + desc->length); + desc->proto_codeset = SVPD_ID_CODESET_UTF8; + desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN | + SVPD_ID_TYPE_SCSI_NAME; + desc->length = idlen2; + strlcpy(desc->identifier, scsiname, idlen2); + } + if (eui != NULL) { + desc = (struct scsi_vpd_id_descriptor *)(&desc->identifier[0] + + desc->length); + desc->proto_codeset = SVPD_ID_CODESET_BINARY; + desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN | + SVPD_ID_TYPE_EUI64; + desc->length = 8; + scsi_u64to8b(strtouq(eui, NULL, 0), desc->identifier); + } + if (naa != NULL) { + desc = (struct scsi_vpd_id_descriptor *)(&desc->identifier[0] + + desc->length); + desc->proto_codeset = SVPD_ID_CODESET_BINARY; + desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN | + SVPD_ID_TYPE_NAA; + desc->length = 8; + scsi_u64to8b(strtouq(naa, NULL, 0), desc->identifier); + } + mtx_lock(&ctl_softc->ctl_lock); /* * See if the caller requested a particular LUN number. If so, see @@ -4318,6 +4570,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *ctl_lun, } ctl_set_mask(ctl_softc->ctl_lun_mask, lun_number); + mtx_init(&lun->lun_lock, "CTL LUN", NULL, MTX_DEF); lun->target = target_id; lun->lun = lun_number; lun->be_lun = be_lun; @@ -4343,6 +4596,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *ctl_lun, TAILQ_INIT(&lun->ooa_queue); TAILQ_INIT(&lun->blocked_queue); STAILQ_INIT(&lun->error_list); + ctl_tpc_init(lun); /* * Initialize the mode page index. @@ -4353,7 +4607,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *ctl_lun, * Set the poweron UA for all initiators on this LUN only. */ for (i = 0; i < CTL_MAX_INITIATORS; i++) - lun->pending_sense[i].ua_pending = CTL_UA_POWERON; + lun->pending_ua[i] = CTL_UA_POWERON; /* * Now, before we insert this lun on the lun list, set the lun @@ -4361,7 +4615,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *ctl_lun, */ STAILQ_FOREACH(nlun, &ctl_softc->lun_list, links) { for (i = 0; i < CTL_MAX_INITIATORS; i++) { - nlun->pending_sense[i].ua_pending |= CTL_UA_LUN_CHANGE; + nlun->pending_ua[i] |= CTL_UA_LUN_CHANGE; } } @@ -4390,35 +4644,17 @@ ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *ctl_lun, * already. Enable the target ID if it hasn't been enabled, and * enable this particular LUN. */ - STAILQ_FOREACH(fe, &ctl_softc->fe_list, links) { + STAILQ_FOREACH(port, &ctl_softc->port_list, links) { int retval; - /* - * XXX KDM this only works for ONE TARGET ID. We'll need - * to do things differently if we go to a multiple target - * ID scheme. - */ - if ((fe->status & CTL_PORT_STATUS_TARG_ONLINE) == 0) { - - retval = fe->targ_enable(fe->targ_lun_arg, target_id); - if (retval != 0) { - printf("ctl_alloc_lun: FETD %s port %d " - "returned error %d for targ_enable on " - "target %ju\n", fe->port_name, - fe->targ_port, retval, - (uintmax_t)target_id.id); - } else - fe->status |= CTL_PORT_STATUS_TARG_ONLINE; - } - - retval = fe->lun_enable(fe->targ_lun_arg, target_id,lun_number); + retval = port->lun_enable(port->targ_lun_arg, target_id,lun_number); if (retval != 0) { printf("ctl_alloc_lun: FETD %s port %d returned error " "%d for lun_enable on target %ju lun %d\n", - fe->port_name, fe->targ_port, retval, + port->port_name, port->targ_port, retval, (uintmax_t)target_id.id, lun_number); } else - fe->status |= CTL_PORT_STATUS_LUN_ONLINE; + port->status |= CTL_PORT_STATUS_LUN_ONLINE; } return (0); } @@ -4434,10 +4670,9 @@ ctl_free_lun(struct ctl_lun *lun) { struct ctl_softc *softc; #if 0 - struct ctl_frontend *fe; + struct ctl_port *port; #endif struct ctl_lun *nlun; - union ctl_io *io, *next_io; int i; softc = lun->ctl_softc; @@ -4450,49 +4685,8 @@ ctl_free_lun(struct ctl_lun *lun) softc->ctl_luns[lun->lun] = NULL; - if (TAILQ_FIRST(&lun->ooa_queue) != NULL) { - printf("ctl_free_lun: aieee!! freeing a LUN with " - "outstanding I/O!!\n"); - } - - /* - * If we have anything pending on the RtR queue, remove it. - */ - for (io = (union ctl_io *)STAILQ_FIRST(&softc->rtr_queue); io != NULL; - io = next_io) { - uint32_t targ_lun; - - next_io = (union ctl_io *)STAILQ_NEXT(&io->io_hdr, links); - targ_lun = io->io_hdr.nexus.targ_lun; - if (io->io_hdr.nexus.lun_map_fn != NULL) - targ_lun = io->io_hdr.nexus.lun_map_fn(io->io_hdr.nexus.lun_map_arg, targ_lun); - if ((io->io_hdr.nexus.targ_target.id == lun->target.id) - && (targ_lun == lun->lun)) - STAILQ_REMOVE(&softc->rtr_queue, &io->io_hdr, - ctl_io_hdr, links); - } - - /* - * Then remove everything from the blocked queue. - */ - for (io = (union ctl_io *)TAILQ_FIRST(&lun->blocked_queue); io != NULL; - io = next_io) { - next_io = (union ctl_io *)TAILQ_NEXT(&io->io_hdr,blocked_links); - TAILQ_REMOVE(&lun->blocked_queue, &io->io_hdr, blocked_links); - io->io_hdr.flags &= ~CTL_FLAG_BLOCKED; - } - - /* - * Now clear out the OOA queue, and free all the I/O. - * XXX KDM should we notify the FETD here? We probably need to - * quiesce the LUN before deleting it. - */ - for (io = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); io != NULL; - io = next_io) { - next_io = (union ctl_io *)TAILQ_NEXT(&io->io_hdr, ooa_links); - TAILQ_REMOVE(&lun->ooa_queue, &io->io_hdr, ooa_links); - ctl_free_io(io); - } + if (!TAILQ_EMPTY(&lun->ooa_queue)) + panic("Freeing a LUN %p with outstanding I/O!!\n", lun); softc->num_luns--; @@ -4500,7 +4694,7 @@ ctl_free_lun(struct ctl_lun *lun) * XXX KDM this scheme only works for a single target/multiple LUN * setup. It needs to be revamped for a multiple target scheme. * - * XXX KDM this results in fe->lun_disable() getting called twice, + * XXX KDM this results in port->lun_disable() getting called twice, * once when ctl_disable_lun() is called, and a second time here. * We really need to re-think the LUN disable semantics. There * should probably be several steps/levels to LUN removal: @@ -4512,37 +4706,37 @@ ctl_free_lun(struct ctl_lun *lun) * the front end ports, at least for individual LUNs. */ #if 0 - STAILQ_FOREACH(fe, &softc->fe_list, links) { + STAILQ_FOREACH(port, &softc->port_list, links) { int retval; - retval = fe->lun_disable(fe->targ_lun_arg, lun->target, + retval = port->lun_disable(port->targ_lun_arg, lun->target, lun->lun); if (retval != 0) { printf("ctl_free_lun: FETD %s port %d returned error " "%d for lun_disable on target %ju lun %jd\n", - fe->port_name, fe->targ_port, retval, + port->port_name, port->targ_port, retval, (uintmax_t)lun->target.id, (intmax_t)lun->lun); } if (STAILQ_FIRST(&softc->lun_list) == NULL) { - fe->status &= ~CTL_PORT_STATUS_LUN_ONLINE; + port->status &= ~CTL_PORT_STATUS_LUN_ONLINE; - retval = fe->targ_disable(fe->targ_lun_arg,lun->target); + retval = port->targ_disable(port->targ_lun_arg,lun->target); if (retval != 0) { printf("ctl_free_lun: FETD %s port %d " "returned error %d for targ_disable on " - "target %ju\n", fe->port_name, - fe->targ_port, retval, + "target %ju\n", port->port_name, + port->targ_port, retval, (uintmax_t)lun->target.id); } else - fe->status &= ~CTL_PORT_STATUS_TARG_ONLINE; + port->status &= ~CTL_PORT_STATUS_TARG_ONLINE; - if ((fe->status & CTL_PORT_STATUS_TARG_ONLINE) != 0) + if ((port->status & CTL_PORT_STATUS_TARG_ONLINE) != 0) continue; #if 0 - fe->port_offline(fe->onoff_arg); - fe->status &= ~CTL_PORT_STATUS_ONLINE; + port->port_offline(port->onoff_arg); + port->status &= ~CTL_PORT_STATUS_ONLINE; #endif } } @@ -4554,12 +4748,15 @@ ctl_free_lun(struct ctl_lun *lun) atomic_subtract_int(&lun->be_lun->be->num_luns, 1); lun->be_lun->lun_shutdown(lun->be_lun->be_lun); + ctl_tpc_shutdown(lun); + mtx_destroy(&lun->lun_lock); + free(lun->lun_devid, M_CTL); if (lun->flags & CTL_LUN_MALLOCED) free(lun, M_CTL); STAILQ_FOREACH(nlun, &softc->lun_list, links) { for (i = 0; i < CTL_MAX_INITIATORS; i++) { - nlun->pending_sense[i].ua_pending |= CTL_UA_LUN_CHANGE; + nlun->pending_ua[i] |= CTL_UA_LUN_CHANGE; } } @@ -4582,15 +4779,12 @@ ctl_create_lun(struct ctl_be_lun *be_lun) int ctl_add_lun(struct ctl_be_lun *be_lun) { - struct ctl_softc *ctl_softc; - - ctl_softc = control_softc; + struct ctl_softc *ctl_softc = control_softc; mtx_lock(&ctl_softc->ctl_lock); STAILQ_INSERT_TAIL(&ctl_softc->pending_lun_queue, be_lun, links); mtx_unlock(&ctl_softc->ctl_lock); - - ctl_wakeup_thread(); + wakeup(&ctl_softc->pending_lun_queue); return (0); } @@ -4599,7 +4793,7 @@ int ctl_enable_lun(struct ctl_be_lun *be_lun) { struct ctl_softc *ctl_softc; - struct ctl_frontend *fe, *nfe; + struct ctl_port *port, *nport; struct ctl_lun *lun; int retval; @@ -4608,18 +4802,21 @@ ctl_enable_lun(struct ctl_be_lun *be_lun) lun = (struct ctl_lun *)be_lun->ctl_lun; mtx_lock(&ctl_softc->ctl_lock); + mtx_lock(&lun->lun_lock); if ((lun->flags & CTL_LUN_DISABLED) == 0) { /* * eh? Why did we get called if the LUN is already * enabled? */ + mtx_unlock(&lun->lun_lock); mtx_unlock(&ctl_softc->ctl_lock); return (0); } lun->flags &= ~CTL_LUN_DISABLED; + mtx_unlock(&lun->lun_lock); - for (fe = STAILQ_FIRST(&ctl_softc->fe_list); fe != NULL; fe = nfe) { - nfe = STAILQ_NEXT(fe, links); + for (port = STAILQ_FIRST(&ctl_softc->port_list); port != NULL; port = nport) { + nport = STAILQ_NEXT(port, links); /* * Drop the lock while we call the FETD's enable routine. @@ -4627,18 +4824,18 @@ ctl_enable_lun(struct ctl_be_lun *be_lun) * case of the internal initiator frontend. */ mtx_unlock(&ctl_softc->ctl_lock); - retval = fe->lun_enable(fe->targ_lun_arg, lun->target,lun->lun); + retval = port->lun_enable(port->targ_lun_arg, lun->target,lun->lun); mtx_lock(&ctl_softc->ctl_lock); if (retval != 0) { printf("%s: FETD %s port %d returned error " "%d for lun_enable on target %ju lun %jd\n", - __func__, fe->port_name, fe->targ_port, retval, + __func__, port->port_name, port->targ_port, retval, (uintmax_t)lun->target.id, (intmax_t)lun->lun); } #if 0 else { /* NOTE: TODO: why does lun enable affect port status? */ - fe->status |= CTL_PORT_STATUS_LUN_ONLINE; + port->status |= CTL_PORT_STATUS_LUN_ONLINE; } #endif } @@ -4652,7 +4849,7 @@ int ctl_disable_lun(struct ctl_be_lun *be_lun) { struct ctl_softc *ctl_softc; - struct ctl_frontend *fe; + struct ctl_port *port; struct ctl_lun *lun; int retval; @@ -4661,14 +4858,16 @@ ctl_disable_lun(struct ctl_be_lun *be_lun) lun = (struct ctl_lun *)be_lun->ctl_lun; mtx_lock(&ctl_softc->ctl_lock); - + mtx_lock(&lun->lun_lock); if (lun->flags & CTL_LUN_DISABLED) { + mtx_unlock(&lun->lun_lock); mtx_unlock(&ctl_softc->ctl_lock); return (0); } lun->flags |= CTL_LUN_DISABLED; + mtx_unlock(&lun->lun_lock); - STAILQ_FOREACH(fe, &ctl_softc->fe_list, links) { + STAILQ_FOREACH(port, &ctl_softc->port_list, links) { mtx_unlock(&ctl_softc->ctl_lock); /* * Drop the lock before we call the frontend's disable @@ -4677,13 +4876,13 @@ ctl_disable_lun(struct ctl_be_lun *be_lun) * XXX KDM what happens if the frontend list changes while * we're traversing it? It's unlikely, but should be handled. */ - retval = fe->lun_disable(fe->targ_lun_arg, lun->target, + retval = port->lun_disable(port->targ_lun_arg, lun->target, lun->lun); mtx_lock(&ctl_softc->ctl_lock); if (retval != 0) { printf("ctl_alloc_lun: FETD %s port %d returned error " "%d for lun_disable on target %ju lun %jd\n", - fe->port_name, fe->targ_port, retval, + port->port_name, port->targ_port, retval, (uintmax_t)lun->target.id, (intmax_t)lun->lun); } } @@ -4703,9 +4902,9 @@ ctl_start_lun(struct ctl_be_lun *be_lun) lun = (struct ctl_lun *)be_lun->ctl_lun; - mtx_lock(&ctl_softc->ctl_lock); + mtx_lock(&lun->lun_lock); lun->flags &= ~CTL_LUN_STOPPED; - mtx_unlock(&ctl_softc->ctl_lock); + mtx_unlock(&lun->lun_lock); return (0); } @@ -4720,9 +4919,9 @@ ctl_stop_lun(struct ctl_be_lun *be_lun) lun = (struct ctl_lun *)be_lun->ctl_lun; - mtx_lock(&ctl_softc->ctl_lock); + mtx_lock(&lun->lun_lock); lun->flags |= CTL_LUN_STOPPED; - mtx_unlock(&ctl_softc->ctl_lock); + mtx_unlock(&lun->lun_lock); return (0); } @@ -4737,9 +4936,9 @@ ctl_lun_offline(struct ctl_be_lun *be_lun) lun = (struct ctl_lun *)be_lun->ctl_lun; - mtx_lock(&ctl_softc->ctl_lock); + mtx_lock(&lun->lun_lock); lun->flags |= CTL_LUN_OFFLINE; - mtx_unlock(&ctl_softc->ctl_lock); + mtx_unlock(&lun->lun_lock); return (0); } @@ -4754,9 +4953,9 @@ ctl_lun_online(struct ctl_be_lun *be_lun) lun = (struct ctl_lun *)be_lun->ctl_lun; - mtx_lock(&ctl_softc->ctl_lock); + mtx_lock(&lun->lun_lock); lun->flags &= ~CTL_LUN_OFFLINE; - mtx_unlock(&ctl_softc->ctl_lock); + mtx_unlock(&lun->lun_lock); return (0); } @@ -4771,13 +4970,13 @@ ctl_invalidate_lun(struct ctl_be_lun *be_lun) lun = (struct ctl_lun *)be_lun->ctl_lun; - mtx_lock(&ctl_softc->ctl_lock); + mtx_lock(&lun->lun_lock); /* * The LUN needs to be disabled before it can be marked invalid. */ if ((lun->flags & CTL_LUN_DISABLED) == 0) { - mtx_unlock(&ctl_softc->ctl_lock); + mtx_unlock(&lun->lun_lock); return (-1); } /* @@ -4790,9 +4989,13 @@ ctl_invalidate_lun(struct ctl_be_lun *be_lun) * If we have something in the OOA queue, we'll free it when the * last I/O completes. */ - if (TAILQ_FIRST(&lun->ooa_queue) == NULL) + if (TAILQ_EMPTY(&lun->ooa_queue)) { + mtx_unlock(&lun->lun_lock); + mtx_lock(&ctl_softc->ctl_lock); ctl_free_lun(lun); - mtx_unlock(&ctl_softc->ctl_lock); + mtx_unlock(&ctl_softc->ctl_lock); + } else + mtx_unlock(&lun->lun_lock); return (0); } @@ -4806,9 +5009,9 @@ ctl_lun_inoperable(struct ctl_be_lun *be_lun) ctl_softc = control_softc; lun = (struct ctl_lun *)be_lun->ctl_lun; - mtx_lock(&ctl_softc->ctl_lock); + mtx_lock(&lun->lun_lock); lun->flags |= CTL_LUN_INOPERABLE; - mtx_unlock(&ctl_softc->ctl_lock); + mtx_unlock(&lun->lun_lock); return (0); } @@ -4822,9 +5025,9 @@ ctl_lun_operable(struct ctl_be_lun *be_lun) ctl_softc = control_softc; lun = (struct ctl_lun *)be_lun->ctl_lun; - mtx_lock(&ctl_softc->ctl_lock); + mtx_lock(&lun->lun_lock); lun->flags &= ~CTL_LUN_INOPERABLE; - mtx_unlock(&ctl_softc->ctl_lock); + mtx_unlock(&lun->lun_lock); return (0); } @@ -4844,6 +5047,7 @@ ctl_lun_power_lock(struct ctl_be_lun *be_lun, struct ctl_nexus *nexus, mtx_lock(&softc->ctl_lock); lun = (struct ctl_lun *)be_lun->ctl_lun; + mtx_lock(&lun->lun_lock); page_index = NULL; for (i = 0; i < CTL_NUM_MODE_PAGES; i++) { @@ -4857,6 +5061,7 @@ ctl_lun_power_lock(struct ctl_be_lun *be_lun, struct ctl_nexus *nexus, } if (page_index == NULL) { + mtx_unlock(&lun->lun_lock); mtx_unlock(&softc->ctl_lock); printf("%s: APS subpage not found for lun %ju!\n", __func__, (uintmax_t)lun->lun); @@ -4867,6 +5072,7 @@ ctl_lun_power_lock(struct ctl_be_lun *be_lun, struct ctl_nexus *nexus, && (softc->aps_locked_lun != lun->lun)) { printf("%s: attempt to lock LUN %llu when %llu is already " "locked\n"); + mtx_unlock(&lun->lun_lock); mtx_unlock(&softc->ctl_lock); return (1); } @@ -4903,11 +5109,13 @@ ctl_lun_power_lock(struct ctl_be_lun *be_lun, struct ctl_nexus *nexus, if (isc_retval > CTL_HA_STATUS_SUCCESS) { printf("%s: APS (lock=%d) error returned from " "ctl_ha_msg_send: %d\n", __func__, lock, isc_retval); + mtx_unlock(&lun->lun_lock); mtx_unlock(&softc->ctl_lock); return (1); } } + mtx_unlock(&lun->lun_lock); mtx_unlock(&softc->ctl_lock); return (0); @@ -4922,14 +5130,14 @@ ctl_lun_capacity_changed(struct ctl_be_lun *be_lun) softc = control_softc; - mtx_lock(&softc->ctl_lock); - lun = (struct ctl_lun *)be_lun->ctl_lun; - for (i = 0; i < CTL_MAX_INITIATORS; i++) - lun->pending_sense[i].ua_pending |= CTL_UA_CAPACITY_CHANGED; + mtx_lock(&lun->lun_lock); - mtx_unlock(&softc->ctl_lock); + for (i = 0; i < CTL_MAX_INITIATORS; i++) + lun->pending_ua[i] |= CTL_UA_CAPACITY_CHANGED; + + mtx_unlock(&lun->lun_lock); } /* @@ -4970,7 +5178,8 @@ ctl_config_move_done(union ctl_io *io) /*sks_valid*/ 1, /*retry_count*/ io->io_hdr.port_status); - free(io->scsiio.kern_data_ptr, M_CTL); + if (io->io_hdr.flags & CTL_FLAG_ALLOCATED) + free(io->scsiio.kern_data_ptr, M_CTL); ctl_done(io); goto bailout; } @@ -4983,7 +5192,8 @@ ctl_config_move_done(union ctl_io *io) * S/G list. If we start using S/G lists for config data, * we'll need to know how to clean them up here as well. */ - free(io->scsiio.kern_data_ptr, M_CTL); + if (io->io_hdr.flags & CTL_FLAG_ALLOCATED) + free(io->scsiio.kern_data_ptr, M_CTL); /* Hopefully the user has already set the status... */ ctl_done(io); } else { @@ -5010,6 +5220,31 @@ ctl_config_move_done(union ctl_io *io) return (retval); } +/* + * This gets called by a backend driver when it is done with a + * data_submit method. + */ +void +ctl_data_submit_done(union ctl_io *io) +{ + /* + * If the IO_CONT flag is set, we need to call the supplied + * function to continue processing the I/O, instead of completing + * the I/O just yet. + * + * If there is an error, though, we don't want to keep processing. + * Instead, just send status back to the initiator. + */ + if ((io->io_hdr.flags & CTL_FLAG_IO_CONT) && + (io->io_hdr.flags & CTL_FLAG_ABORT) == 0 && + ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || + (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { + io->scsiio.io_cont(io); + return; + } + ctl_done(io); +} + /* * This gets called by a backend driver when it is done with a * configuration write. @@ -5060,50 +5295,11 @@ ctl_scsi_release(struct ctl_scsiio *ctsio) ctl_softc = control_softc; switch (ctsio->cdb[0]) { - case RELEASE: { - struct scsi_release *cdb; - - cdb = (struct scsi_release *)ctsio->cdb; - if ((cdb->byte2 & 0x1f) != 0) { - ctl_set_invalid_field(ctsio, - /*sks_valid*/ 1, - /*command*/ 1, - /*field*/ 1, - /*bit_valid*/ 0, - /*bit*/ 0); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } - break; - } case RELEASE_10: { struct scsi_release_10 *cdb; cdb = (struct scsi_release_10 *)ctsio->cdb; - if ((cdb->byte2 & SR10_EXTENT) != 0) { - ctl_set_invalid_field(ctsio, - /*sks_valid*/ 1, - /*command*/ 1, - /*field*/ 1, - /*bit_valid*/ 1, - /*bit*/ 0); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - - } - - if ((cdb->byte2 & SR10_3RDPTY) != 0) { - ctl_set_invalid_field(ctsio, - /*sks_valid*/ 1, - /*command*/ 1, - /*field*/ 1, - /*bit_valid*/ 1, - /*bit*/ 4); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } - if (cdb->byte2 & SR10_LONGID) longid = 1; else @@ -5143,7 +5339,7 @@ ctl_scsi_release(struct ctl_scsiio *ctsio) if (length > 0) thirdparty_id = scsi_8btou64(ctsio->kern_data_ptr); - mtx_lock(&ctl_softc->ctl_lock); + mtx_lock(&lun->lun_lock); /* * According to SPC, it is not an error for an intiator to attempt @@ -5161,6 +5357,8 @@ ctl_scsi_release(struct ctl_scsiio *ctsio) } } + mtx_unlock(&lun->lun_lock); + ctsio->scsi_status = SCSI_STATUS_OK; ctsio->io_hdr.status = CTL_SUCCESS; @@ -5169,8 +5367,6 @@ ctl_scsi_release(struct ctl_scsiio *ctsio) ctsio->io_hdr.flags &= ~CTL_FLAG_ALLOCATED; } - mtx_unlock(&ctl_softc->ctl_lock); - ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } @@ -5197,49 +5393,11 @@ ctl_scsi_reserve(struct ctl_scsiio *ctsio) ctl_softc = control_softc; switch (ctsio->cdb[0]) { - case RESERVE: { - struct scsi_reserve *cdb; - - cdb = (struct scsi_reserve *)ctsio->cdb; - if ((cdb->byte2 & 0x1f) != 0) { - ctl_set_invalid_field(ctsio, - /*sks_valid*/ 1, - /*command*/ 1, - /*field*/ 1, - /*bit_valid*/ 0, - /*bit*/ 0); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } - resv_id = cdb->resv_id; - length = scsi_2btoul(cdb->length); - break; - } case RESERVE_10: { struct scsi_reserve_10 *cdb; cdb = (struct scsi_reserve_10 *)ctsio->cdb; - if ((cdb->byte2 & SR10_EXTENT) != 0) { - ctl_set_invalid_field(ctsio, - /*sks_valid*/ 1, - /*command*/ 1, - /*field*/ 1, - /*bit_valid*/ 1, - /*bit*/ 0); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } - if ((cdb->byte2 & SR10_3RDPTY) != 0) { - ctl_set_invalid_field(ctsio, - /*sks_valid*/ 1, - /*command*/ 1, - /*field*/ 1, - /*bit_valid*/ 1, - /*bit*/ 4); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } if (cdb->byte2 & SR10_LONGID) longid = 1; else @@ -5278,7 +5436,7 @@ ctl_scsi_reserve(struct ctl_scsiio *ctsio) if (length > 0) thirdparty_id = scsi_8btou64(ctsio->kern_data_ptr); - mtx_lock(&ctl_softc->ctl_lock); + mtx_lock(&lun->lun_lock); if (lun->flags & CTL_LUN_RESERVED) { if ((ctsio->io_hdr.nexus.initid.id != lun->rsv_nexus.initid.id) || (ctsio->io_hdr.nexus.targ_port != lun->rsv_nexus.targ_port) @@ -5297,13 +5455,13 @@ ctl_scsi_reserve(struct ctl_scsiio *ctsio) ctsio->io_hdr.status = CTL_SUCCESS; bailout: + mtx_unlock(&lun->lun_lock); + if (ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) { free(ctsio->kern_data_ptr, M_CTL); ctsio->io_hdr.flags &= ~CTL_FLAG_ALLOCATED; } - mtx_unlock(&ctl_softc->ctl_lock); - ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } @@ -5352,35 +5510,6 @@ ctl_start_stop(struct ctl_scsiio *ctsio) return (CTL_RETVAL_COMPLETE); } - /* - * We don't support the power conditions field. We need to check - * this prior to checking the load/eject and start/stop bits. - */ - if ((cdb->how & SSS_PC_MASK) != SSS_PC_START_VALID) { - ctl_set_invalid_field(ctsio, - /*sks_valid*/ 1, - /*command*/ 1, - /*field*/ 4, - /*bit_valid*/ 1, - /*bit*/ 4); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } - - /* - * Media isn't removable, so we can't load or eject it. - */ - if ((cdb->how & SSS_LOEJ) != 0) { - ctl_set_invalid_field(ctsio, - /*sks_valid*/ 1, - /*command*/ 1, - /*field*/ 4, - /*bit_valid*/ 1, - /*bit*/ 1); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } - if ((lun->flags & CTL_LUN_PR_RESERVED) && ((cdb->how & SSS_START)==0)) { uint32_t residx; @@ -5412,7 +5541,7 @@ ctl_start_stop(struct ctl_scsiio *ctsio) * Figure out a reasonable way to port this? */ #ifdef NEEDTOPORT - mtx_lock(&ctl_softc->ctl_lock); + mtx_lock(&lun->lun_lock); if (((cdb->byte2 & SSS_ONOFFLINE) == 0) && (lun->flags & CTL_LUN_OFFLINE)) { @@ -5420,11 +5549,11 @@ ctl_start_stop(struct ctl_scsiio *ctsio) * If the LUN is offline, and the on/offline bit isn't set, * reject the start or stop. Otherwise, let it through. */ - mtx_unlock(&ctl_softc->ctl_lock); + mtx_unlock(&lun->lun_lock); ctl_set_lun_not_ready(ctsio); ctl_done((union ctl_io *)ctsio); } else { - mtx_unlock(&ctl_softc->ctl_lock); + mtx_unlock(&lun->lun_lock); #endif /* NEEDTOPORT */ /* * This could be a start or a stop when we're online, @@ -5478,7 +5607,6 @@ ctl_sync_cache(struct ctl_scsiio *ctsio) struct ctl_softc *ctl_softc; uint64_t starting_lba; uint32_t block_count; - int reladr, immed; int retval; CTL_DEBUG_PRINT(("ctl_sync_cache\n")); @@ -5486,20 +5614,12 @@ ctl_sync_cache(struct ctl_scsiio *ctsio) lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; ctl_softc = control_softc; retval = 0; - reladr = 0; - immed = 0; switch (ctsio->cdb[0]) { case SYNCHRONIZE_CACHE: { struct scsi_sync_cache *cdb; cdb = (struct scsi_sync_cache *)ctsio->cdb; - if (cdb->byte2 & SSC_RELADR) - reladr = 1; - - if (cdb->byte2 & SSC_IMMED) - immed = 1; - starting_lba = scsi_4btoul(cdb->begin_lba); block_count = scsi_2btoul(cdb->lb_count); break; @@ -5508,12 +5628,6 @@ ctl_sync_cache(struct ctl_scsiio *ctsio) struct scsi_sync_cache_16 *cdb; cdb = (struct scsi_sync_cache_16 *)ctsio->cdb; - if (cdb->byte2 & SSC_RELADR) - reladr = 1; - - if (cdb->byte2 & SSC_IMMED) - immed = 1; - starting_lba = scsi_8btou64(cdb->begin_lba); block_count = scsi_4btoul(cdb->lb_count); break; @@ -5525,41 +5639,6 @@ ctl_sync_cache(struct ctl_scsiio *ctsio) break; /* NOTREACHED */ } - if (immed) { - /* - * We don't support the immediate bit. Since it's in the - * same place for the 10 and 16 byte SYNCHRONIZE CACHE - * commands, we can just return the same error in either - * case. - */ - ctl_set_invalid_field(ctsio, - /*sks_valid*/ 1, - /*command*/ 1, - /*field*/ 1, - /*bit_valid*/ 1, - /*bit*/ 1); - ctl_done((union ctl_io *)ctsio); - goto bailout; - } - - if (reladr) { - /* - * We don't support the reladr bit either. It can only be - * used with linked commands, and we don't support linked - * commands. Since the bit is in the same place for the - * 10 and 16 byte SYNCHRONIZE CACHE * commands, we can - * just return the same error in either case. - */ - ctl_set_invalid_field(ctsio, - /*sks_valid*/ 1, - /*command*/ 1, - /*field*/ 1, - /*bit_valid*/ 1, - /*bit*/ 0); - ctl_done((union ctl_io *)ctsio); - goto bailout; - } - /* * We check the LBA and length, but don't do anything with them. * A SYNCHRONIZE CACHE will cause the entire cache for this lun to @@ -5585,14 +5664,14 @@ ctl_sync_cache(struct ctl_scsiio *ctsio) * Check to see whether we're configured to send the SYNCHRONIZE * CACHE command directly to the back end. */ - mtx_lock(&ctl_softc->ctl_lock); + mtx_lock(&lun->lun_lock); if ((ctl_softc->flags & CTL_FLAG_REAL_SYNC) && (++(lun->sync_count) >= lun->sync_interval)) { lun->sync_count = 0; - mtx_unlock(&ctl_softc->ctl_lock); + mtx_unlock(&lun->lun_lock); retval = lun->backend->config_write((union ctl_io *)ctsio); } else { - mtx_unlock(&ctl_softc->ctl_lock); + mtx_unlock(&lun->lun_lock); ctl_set_success(ctsio); ctl_done((union ctl_io *)ctsio); } @@ -5685,9 +5764,9 @@ ctl_format(struct ctl_scsiio *ctsio) * get them to issue a command that will basically make them think * they're blowing away the media. */ - mtx_lock(&ctl_softc->ctl_lock); + mtx_lock(&lun->lun_lock); lun->flags &= ~CTL_LUN_INOPERABLE; - mtx_unlock(&ctl_softc->ctl_lock); + mtx_unlock(&lun->lun_lock); ctsio->scsi_status = SCSI_STATUS_OK; ctsio->io_hdr.status = CTL_SUCCESS; @@ -5702,24 +5781,96 @@ ctl_format(struct ctl_scsiio *ctsio) return (CTL_RETVAL_COMPLETE); } +int +ctl_read_buffer(struct ctl_scsiio *ctsio) +{ + struct scsi_read_buffer *cdb; + struct ctl_lun *lun; + int buffer_offset, len; + static uint8_t descr[4]; + static uint8_t echo_descr[4] = { 0 }; + + CTL_DEBUG_PRINT(("ctl_read_buffer\n")); + + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + cdb = (struct scsi_read_buffer *)ctsio->cdb; + + if (lun->flags & CTL_LUN_PR_RESERVED) { + uint32_t residx; + + /* + * XXX KDM need a lock here. + */ + residx = ctl_get_resindex(&ctsio->io_hdr.nexus); + if ((lun->res_type == SPR_TYPE_EX_AC + && residx != lun->pr_res_idx) + || ((lun->res_type == SPR_TYPE_EX_AC_RO + || lun->res_type == SPR_TYPE_EX_AC_AR) + && !lun->per_res[residx].registered)) { + ctl_set_reservation_conflict(ctsio); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + } + + if ((cdb->byte2 & RWB_MODE) != RWB_MODE_DATA && + (cdb->byte2 & RWB_MODE) != RWB_MODE_ECHO_DESCR && + (cdb->byte2 & RWB_MODE) != RWB_MODE_DESCR) { + ctl_set_invalid_field(ctsio, + /*sks_valid*/ 1, + /*command*/ 1, + /*field*/ 1, + /*bit_valid*/ 1, + /*bit*/ 4); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + + len = scsi_3btoul(cdb->length); + buffer_offset = scsi_3btoul(cdb->offset); + + if (buffer_offset + len > sizeof(lun->write_buffer)) { + ctl_set_invalid_field(ctsio, + /*sks_valid*/ 1, + /*command*/ 1, + /*field*/ 6, + /*bit_valid*/ 0, + /*bit*/ 0); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + + if ((cdb->byte2 & RWB_MODE) == RWB_MODE_DESCR) { + descr[0] = 0; + scsi_ulto3b(sizeof(lun->write_buffer), &descr[1]); + ctsio->kern_data_ptr = descr; + len = min(len, sizeof(descr)); + } else if ((cdb->byte2 & RWB_MODE) == RWB_MODE_ECHO_DESCR) { + ctsio->kern_data_ptr = echo_descr; + len = min(len, sizeof(echo_descr)); + } else + ctsio->kern_data_ptr = lun->write_buffer + buffer_offset; + ctsio->kern_data_len = len; + ctsio->kern_total_len = len; + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + ctsio->kern_sg_entries = 0; + ctsio->be_move_done = ctl_config_move_done; + ctl_datamove((union ctl_io *)ctsio); + + return (CTL_RETVAL_COMPLETE); +} + int ctl_write_buffer(struct ctl_scsiio *ctsio) { struct scsi_write_buffer *cdb; - struct copan_page_header *header; struct ctl_lun *lun; - struct ctl_softc *ctl_softc; int buffer_offset, len; - int retval; - - header = NULL; - - retval = CTL_RETVAL_COMPLETE; CTL_DEBUG_PRINT(("ctl_write_buffer\n")); lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctl_softc = control_softc; cdb = (struct scsi_write_buffer *)ctsio->cdb; if ((cdb->byte2 & RWB_MODE) != RWB_MODE_DATA) { @@ -5732,21 +5883,11 @@ ctl_write_buffer(struct ctl_scsiio *ctsio) ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } - if (cdb->buffer_id != 0) { - ctl_set_invalid_field(ctsio, - /*sks_valid*/ 1, - /*command*/ 1, - /*field*/ 2, - /*bit_valid*/ 0, - /*bit*/ 0); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } len = scsi_3btoul(cdb->length); buffer_offset = scsi_3btoul(cdb->offset); - if (len > sizeof(lun->write_buffer)) { + if (buffer_offset + len > sizeof(lun->write_buffer)) { ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 1, @@ -5757,23 +5898,12 @@ ctl_write_buffer(struct ctl_scsiio *ctsio) return (CTL_RETVAL_COMPLETE); } - if (buffer_offset != 0) { - ctl_set_invalid_field(ctsio, - /*sks_valid*/ 1, - /*command*/ 1, - /*field*/ 3, - /*bit_valid*/ 0, - /*bit*/ 0); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } - /* * If we've got a kernel request that hasn't been malloced yet, * malloc it and tell the caller the data buffer is here. */ if ((ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) == 0) { - ctsio->kern_data_ptr = lun->write_buffer; + ctsio->kern_data_ptr = lun->write_buffer + buffer_offset; ctsio->kern_data_len = len; ctsio->kern_total_len = len; ctsio->kern_data_resid = 0; @@ -5795,7 +5925,7 @@ int ctl_write_same(struct ctl_scsiio *ctsio) { struct ctl_lun *lun; - struct ctl_lba_len_flags lbalen; + struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t num_blocks; int len, retval; @@ -5888,11 +6018,10 @@ ctl_write_same(struct ctl_scsiio *ctsio) return (CTL_RETVAL_COMPLETE); } - lbalen.lba = lba; - lbalen.len = num_blocks; - lbalen.flags = byte2; - memcpy(ctsio->io_hdr.ctl_private[CTL_PRIV_LBA_LEN].bytes, &lbalen, - sizeof(lbalen)); + lbalen = (struct ctl_lba_len_flags *)&ctsio->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]; + lbalen->lba = lba; + lbalen->len = num_blocks; + lbalen->flags = byte2; retval = lun->backend->config_write((union ctl_io *)ctsio); return (retval); @@ -5903,7 +6032,7 @@ ctl_unmap(struct ctl_scsiio *ctsio) { struct ctl_lun *lun; struct scsi_unmap *cdb; - struct ctl_ptr_len_flags ptrlen; + struct ctl_ptr_len_flags *ptrlen; struct scsi_unmap_header *hdr; struct scsi_unmap_desc *buf, *end; uint64_t lba; @@ -5958,11 +6087,10 @@ ctl_unmap(struct ctl_scsiio *ctsio) buf = (struct scsi_unmap_desc *)(hdr + 1); end = buf + len / sizeof(*buf); - ptrlen.ptr = (void *)buf; - ptrlen.len = len; - ptrlen.flags = byte2; - memcpy(ctsio->io_hdr.ctl_private[CTL_PRIV_LBA_LEN].bytes, &ptrlen, - sizeof(ptrlen)); + ptrlen = (struct ctl_ptr_len_flags *)&ctsio->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]; + ptrlen->ptr = (void *)buf; + ptrlen->len = len; + ptrlen->flags = byte2; for (; buf < end; buf++) { lba = scsi_8btou64(buf->lba); @@ -6017,7 +6145,7 @@ ctl_control_page_handler(struct ctl_scsiio *ctsio, softc = control_softc; - mtx_lock(&softc->ctl_lock); + mtx_lock(&lun->lun_lock); if (((current_cp->rlec & SCP_DSENSE) == 0) && ((user_cp->rlec & SCP_DSENSE) != 0)) { /* @@ -6109,11 +6237,10 @@ ctl_control_page_handler(struct ctl_scsiio *ctsio, if (i == initidx) continue; - lun->pending_sense[i].ua_pending |= - CTL_UA_MODE_CHANGE; + lun->pending_ua[i] |= CTL_UA_MODE_CHANGE; } } - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); return (0); } @@ -6692,6 +6819,24 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) else control_dev = 0; + if (lun->flags & CTL_LUN_PR_RESERVED) { + uint32_t residx; + + /* + * XXX KDM need a lock here. + */ + residx = ctl_get_resindex(&ctsio->io_hdr.nexus); + if ((lun->res_type == SPR_TYPE_EX_AC + && residx != lun->pr_res_idx) + || ((lun->res_type == SPR_TYPE_EX_AC_RO + || lun->res_type == SPR_TYPE_EX_AC_AR) + && !lun->per_res[residx].registered)) { + ctl_set_reservation_conflict(ctsio); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + } + switch (ctsio->cdb[0]) { case MODE_SENSE_6: { struct scsi_mode_sense_6 *cdb; @@ -6986,6 +7131,7 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) ctsio->scsi_status = SCSI_STATUS_OK; + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; ctsio->be_move_done = ctl_config_move_done; ctl_datamove((union ctl_io *)ctsio); @@ -7045,13 +7191,14 @@ ctl_read_capacity(struct ctl_scsiio *ctsio) ctsio->scsi_status = SCSI_STATUS_OK; + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; ctsio->be_move_done = ctl_config_move_done; ctl_datamove((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } -static int +int ctl_read_capacity_16(struct ctl_scsiio *ctsio) { struct scsi_read_capacity_16 *cdb; @@ -7107,6 +7254,7 @@ ctl_read_capacity_16(struct ctl_scsiio *ctsio) ctsio->scsi_status = SCSI_STATUS_OK; + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; ctsio->be_move_done = ctl_config_move_done; ctl_datamove((union ctl_io *)ctsio); @@ -7114,50 +7262,20 @@ ctl_read_capacity_16(struct ctl_scsiio *ctsio) } int -ctl_service_action_in(struct ctl_scsiio *ctsio) -{ - struct scsi_service_action_in *cdb; - int retval; - - CTL_DEBUG_PRINT(("ctl_service_action_in\n")); - - cdb = (struct scsi_service_action_in *)ctsio->cdb; - - retval = CTL_RETVAL_COMPLETE; - - switch (cdb->service_action) { - case SRC16_SERVICE_ACTION: - retval = ctl_read_capacity_16(ctsio); - break; - default: - ctl_set_invalid_field(/*ctsio*/ ctsio, - /*sks_valid*/ 1, - /*command*/ 1, - /*field*/ 1, - /*bit_valid*/ 1, - /*bit*/ 4); - ctl_done((union ctl_io *)ctsio); - break; - } - - return (retval); -} - -int -ctl_maintenance_in(struct ctl_scsiio *ctsio) +ctl_report_tagret_port_groups(struct ctl_scsiio *ctsio) { struct scsi_maintenance_in *cdb; int retval; - int alloc_len, total_len = 0; - int num_target_port_groups, single; + int alloc_len, ext, total_len = 0, g, p, pc, pg; + int num_target_port_groups, num_target_ports, single; struct ctl_lun *lun; struct ctl_softc *softc; + struct ctl_port *port; struct scsi_target_group_data *rtg_ptr; - struct scsi_target_port_group_descriptor *tpg_desc_ptr1, *tpg_desc_ptr2; - struct scsi_target_port_descriptor *tp_desc_ptr1_1, *tp_desc_ptr1_2, - *tp_desc_ptr2_1, *tp_desc_ptr2_2; + struct scsi_target_group_data_extended *rtg_ext_ptr; + struct scsi_target_port_group_descriptor *tpg_desc; - CTL_DEBUG_PRINT(("ctl_maintenance_in\n")); + CTL_DEBUG_PRINT(("ctl_report_tagret_port_groups\n")); cdb = (struct scsi_maintenance_in *)ctsio->cdb; softc = control_softc; @@ -7165,31 +7283,48 @@ ctl_maintenance_in(struct ctl_scsiio *ctsio) retval = CTL_RETVAL_COMPLETE; - if ((cdb->byte2 & SERVICE_ACTION_MASK) != SA_RPRT_TRGT_GRP) { + switch (cdb->byte2 & STG_PDF_MASK) { + case STG_PDF_LENGTH: + ext = 0; + break; + case STG_PDF_EXTENDED: + ext = 1; + break; + default: ctl_set_invalid_field(/*ctsio*/ ctsio, /*sks_valid*/ 1, /*command*/ 1, - /*field*/ 1, + /*field*/ 2, /*bit_valid*/ 1, - /*bit*/ 4); + /*bit*/ 5); ctl_done((union ctl_io *)ctsio); return(retval); } - mtx_lock(&softc->ctl_lock); single = ctl_is_single; + if (single) + num_target_port_groups = 1; + else + num_target_port_groups = NUM_TARGET_PORT_GROUPS; + num_target_ports = 0; + mtx_lock(&softc->ctl_lock); + STAILQ_FOREACH(port, &softc->port_list, links) { + if ((port->status & CTL_PORT_STATUS_ONLINE) == 0) + continue; + if (ctl_map_lun_back(port->targ_port, lun->lun) >= CTL_MAX_LUNS) + continue; + num_target_ports++; + } mtx_unlock(&softc->ctl_lock); - if (single) - num_target_port_groups = NUM_TARGET_PORT_GROUPS - 1; + if (ext) + total_len = sizeof(struct scsi_target_group_data_extended); else - num_target_port_groups = NUM_TARGET_PORT_GROUPS; - - total_len = sizeof(struct scsi_target_group_data) + - sizeof(struct scsi_target_port_group_descriptor) * + total_len = sizeof(struct scsi_target_group_data); + total_len += sizeof(struct scsi_target_port_group_descriptor) * num_target_port_groups + - sizeof(struct scsi_target_port_descriptor) * - NUM_PORTS_PER_GRP * num_target_port_groups; + sizeof(struct scsi_target_port_descriptor) * + num_target_ports * num_target_port_groups; alloc_len = scsi_4btoul(cdb->length); @@ -7209,77 +7344,53 @@ ctl_maintenance_in(struct ctl_scsiio *ctsio) ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; - rtg_ptr = (struct scsi_target_group_data *)ctsio->kern_data_ptr; - - tpg_desc_ptr1 = &rtg_ptr->groups[0]; - tp_desc_ptr1_1 = &tpg_desc_ptr1->descriptors[0]; - tp_desc_ptr1_2 = (struct scsi_target_port_descriptor *) - &tp_desc_ptr1_1->desc_list[0]; - - if (single == 0) { - tpg_desc_ptr2 = (struct scsi_target_port_group_descriptor *) - &tp_desc_ptr1_2->desc_list[0]; - tp_desc_ptr2_1 = &tpg_desc_ptr2->descriptors[0]; - tp_desc_ptr2_2 = (struct scsi_target_port_descriptor *) - &tp_desc_ptr2_1->desc_list[0]; - } else { - tpg_desc_ptr2 = NULL; - tp_desc_ptr2_1 = NULL; - tp_desc_ptr2_2 = NULL; - } - - scsi_ulto4b(total_len - 4, rtg_ptr->length); - if (single == 0) { - if (ctsio->io_hdr.nexus.targ_port < CTL_MAX_PORTS) { - if (lun->flags & CTL_LUN_PRIMARY_SC) { - tpg_desc_ptr1->pref_state = TPG_PRIMARY; - tpg_desc_ptr2->pref_state = - TPG_ASYMMETRIC_ACCESS_NONOPTIMIZED; - } else { - tpg_desc_ptr1->pref_state = - TPG_ASYMMETRIC_ACCESS_NONOPTIMIZED; - tpg_desc_ptr2->pref_state = TPG_PRIMARY; - } - } else { - if (lun->flags & CTL_LUN_PRIMARY_SC) { - tpg_desc_ptr1->pref_state = - TPG_ASYMMETRIC_ACCESS_NONOPTIMIZED; - tpg_desc_ptr2->pref_state = TPG_PRIMARY; - } else { - tpg_desc_ptr1->pref_state = TPG_PRIMARY; - tpg_desc_ptr2->pref_state = - TPG_ASYMMETRIC_ACCESS_NONOPTIMIZED; - } - } + if (ext) { + rtg_ext_ptr = (struct scsi_target_group_data_extended *) + ctsio->kern_data_ptr; + scsi_ulto4b(total_len - 4, rtg_ext_ptr->length); + rtg_ext_ptr->format_type = 0x10; + rtg_ext_ptr->implicit_transition_time = 0; + tpg_desc = &rtg_ext_ptr->groups[0]; } else { - tpg_desc_ptr1->pref_state = TPG_PRIMARY; + rtg_ptr = (struct scsi_target_group_data *) + ctsio->kern_data_ptr; + scsi_ulto4b(total_len - 4, rtg_ptr->length); + tpg_desc = &rtg_ptr->groups[0]; } - tpg_desc_ptr1->support = 0; - tpg_desc_ptr1->target_port_group[1] = 1; - tpg_desc_ptr1->status = TPG_IMPLICIT; - tpg_desc_ptr1->target_port_count= NUM_PORTS_PER_GRP; - if (single == 0) { - tpg_desc_ptr2->support = 0; - tpg_desc_ptr2->target_port_group[1] = 2; - tpg_desc_ptr2->status = TPG_IMPLICIT; - tpg_desc_ptr2->target_port_count = NUM_PORTS_PER_GRP; - - tp_desc_ptr1_1->relative_target_port_identifier[1] = 1; - tp_desc_ptr1_2->relative_target_port_identifier[1] = 2; - - tp_desc_ptr2_1->relative_target_port_identifier[1] = 9; - tp_desc_ptr2_2->relative_target_port_identifier[1] = 10; - } else { - if (ctsio->io_hdr.nexus.targ_port < CTL_MAX_PORTS) { - tp_desc_ptr1_1->relative_target_port_identifier[1] = 1; - tp_desc_ptr1_2->relative_target_port_identifier[1] = 2; - } else { - tp_desc_ptr1_1->relative_target_port_identifier[1] = 9; - tp_desc_ptr1_2->relative_target_port_identifier[1] = 10; + pg = ctsio->io_hdr.nexus.targ_port / CTL_MAX_PORTS; + mtx_lock(&softc->ctl_lock); + for (g = 0; g < num_target_port_groups; g++) { + if (g == pg) + tpg_desc->pref_state = TPG_PRIMARY | + TPG_ASYMMETRIC_ACCESS_OPTIMIZED; + else + tpg_desc->pref_state = + TPG_ASYMMETRIC_ACCESS_NONOPTIMIZED; + tpg_desc->support = TPG_AO_SUP; + if (!single) + tpg_desc->support |= TPG_AN_SUP; + scsi_ulto2b(g + 1, tpg_desc->target_port_group); + tpg_desc->status = TPG_IMPLICIT; + pc = 0; + STAILQ_FOREACH(port, &softc->port_list, links) { + if ((port->status & CTL_PORT_STATUS_ONLINE) == 0) + continue; + if (ctl_map_lun_back(port->targ_port, lun->lun) >= + CTL_MAX_LUNS) + continue; + p = port->targ_port % CTL_MAX_PORTS + g * CTL_MAX_PORTS; + scsi_ulto2b(p, tpg_desc->descriptors[pc]. + relative_target_port_identifier); + pc++; } + tpg_desc->target_port_count = pc; + tpg_desc = (struct scsi_target_port_group_descriptor *) + &tpg_desc->descriptors[pc]; } + mtx_unlock(&softc->ctl_lock); + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; ctsio->be_move_done = ctl_config_move_done; CTL_DEBUG_PRINT(("buf = %x %x %x %x %x %x %x %x\n", @@ -7292,6 +7403,270 @@ ctl_maintenance_in(struct ctl_scsiio *ctsio) return(retval); } +int +ctl_report_supported_opcodes(struct ctl_scsiio *ctsio) +{ + struct ctl_lun *lun; + struct scsi_report_supported_opcodes *cdb; + const struct ctl_cmd_entry *entry, *sentry; + struct scsi_report_supported_opcodes_all *all; + struct scsi_report_supported_opcodes_descr *descr; + struct scsi_report_supported_opcodes_one *one; + int retval; + int alloc_len, total_len; + int opcode, service_action, i, j, num; + + CTL_DEBUG_PRINT(("ctl_report_supported_opcodes\n")); + + cdb = (struct scsi_report_supported_opcodes *)ctsio->cdb; + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + + retval = CTL_RETVAL_COMPLETE; + + opcode = cdb->requested_opcode; + service_action = scsi_2btoul(cdb->requested_service_action); + switch (cdb->options & RSO_OPTIONS_MASK) { + case RSO_OPTIONS_ALL: + num = 0; + for (i = 0; i < 256; i++) { + entry = &ctl_cmd_table[i]; + if (entry->flags & CTL_CMD_FLAG_SA5) { + for (j = 0; j < 32; j++) { + sentry = &((const struct ctl_cmd_entry *) + entry->execute)[j]; + if (ctl_cmd_applicable( + lun->be_lun->lun_type, sentry)) + num++; + } + } else { + if (ctl_cmd_applicable(lun->be_lun->lun_type, + entry)) + num++; + } + } + total_len = sizeof(struct scsi_report_supported_opcodes_all) + + num * sizeof(struct scsi_report_supported_opcodes_descr); + break; + case RSO_OPTIONS_OC: + if (ctl_cmd_table[opcode].flags & CTL_CMD_FLAG_SA5) { + ctl_set_invalid_field(/*ctsio*/ ctsio, + /*sks_valid*/ 1, + /*command*/ 1, + /*field*/ 2, + /*bit_valid*/ 1, + /*bit*/ 2); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + total_len = sizeof(struct scsi_report_supported_opcodes_one) + 32; + break; + case RSO_OPTIONS_OC_SA: + if ((ctl_cmd_table[opcode].flags & CTL_CMD_FLAG_SA5) == 0 || + service_action >= 32) { + ctl_set_invalid_field(/*ctsio*/ ctsio, + /*sks_valid*/ 1, + /*command*/ 1, + /*field*/ 2, + /*bit_valid*/ 1, + /*bit*/ 2); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + total_len = sizeof(struct scsi_report_supported_opcodes_one) + 32; + break; + default: + ctl_set_invalid_field(/*ctsio*/ ctsio, + /*sks_valid*/ 1, + /*command*/ 1, + /*field*/ 2, + /*bit_valid*/ 1, + /*bit*/ 2); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + + alloc_len = scsi_4btoul(cdb->length); + + ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); + + ctsio->kern_sg_entries = 0; + + if (total_len < alloc_len) { + ctsio->residual = alloc_len - total_len; + ctsio->kern_data_len = total_len; + ctsio->kern_total_len = total_len; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + + switch (cdb->options & RSO_OPTIONS_MASK) { + case RSO_OPTIONS_ALL: + all = (struct scsi_report_supported_opcodes_all *) + ctsio->kern_data_ptr; + num = 0; + for (i = 0; i < 256; i++) { + entry = &ctl_cmd_table[i]; + if (entry->flags & CTL_CMD_FLAG_SA5) { + for (j = 0; j < 32; j++) { + sentry = &((const struct ctl_cmd_entry *) + entry->execute)[j]; + if (!ctl_cmd_applicable( + lun->be_lun->lun_type, sentry)) + continue; + descr = &all->descr[num++]; + descr->opcode = i; + scsi_ulto2b(j, descr->service_action); + descr->flags = RSO_SERVACTV; + scsi_ulto2b(sentry->length, + descr->cdb_length); + } + } else { + if (!ctl_cmd_applicable(lun->be_lun->lun_type, + entry)) + continue; + descr = &all->descr[num++]; + descr->opcode = i; + scsi_ulto2b(0, descr->service_action); + descr->flags = 0; + scsi_ulto2b(entry->length, descr->cdb_length); + } + } + scsi_ulto4b( + num * sizeof(struct scsi_report_supported_opcodes_descr), + all->length); + break; + case RSO_OPTIONS_OC: + one = (struct scsi_report_supported_opcodes_one *) + ctsio->kern_data_ptr; + entry = &ctl_cmd_table[opcode]; + goto fill_one; + case RSO_OPTIONS_OC_SA: + one = (struct scsi_report_supported_opcodes_one *) + ctsio->kern_data_ptr; + entry = &ctl_cmd_table[opcode]; + entry = &((const struct ctl_cmd_entry *) + entry->execute)[service_action]; +fill_one: + if (ctl_cmd_applicable(lun->be_lun->lun_type, entry)) { + one->support = 3; + scsi_ulto2b(entry->length, one->cdb_length); + one->cdb_usage[0] = opcode; + memcpy(&one->cdb_usage[1], entry->usage, + entry->length - 1); + } else + one->support = 1; + break; + } + + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + + ctl_datamove((union ctl_io *)ctsio); + return(retval); +} + +int +ctl_report_supported_tmf(struct ctl_scsiio *ctsio) +{ + struct ctl_lun *lun; + struct scsi_report_supported_tmf *cdb; + struct scsi_report_supported_tmf_data *data; + int retval; + int alloc_len, total_len; + + CTL_DEBUG_PRINT(("ctl_report_supported_tmf\n")); + + cdb = (struct scsi_report_supported_tmf *)ctsio->cdb; + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + + retval = CTL_RETVAL_COMPLETE; + + total_len = sizeof(struct scsi_report_supported_tmf_data); + alloc_len = scsi_4btoul(cdb->length); + + ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); + + ctsio->kern_sg_entries = 0; + + if (total_len < alloc_len) { + ctsio->residual = alloc_len - total_len; + ctsio->kern_data_len = total_len; + ctsio->kern_total_len = total_len; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + + data = (struct scsi_report_supported_tmf_data *)ctsio->kern_data_ptr; + data->byte1 |= RST_ATS | RST_ATSS | RST_CTSS | RST_LURS | RST_TRS; + data->byte2 |= RST_ITNRS; + + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + + ctl_datamove((union ctl_io *)ctsio); + return (retval); +} + +int +ctl_report_timestamp(struct ctl_scsiio *ctsio) +{ + struct ctl_lun *lun; + struct scsi_report_timestamp *cdb; + struct scsi_report_timestamp_data *data; + struct timeval tv; + int64_t timestamp; + int retval; + int alloc_len, total_len; + + CTL_DEBUG_PRINT(("ctl_report_timestamp\n")); + + cdb = (struct scsi_report_timestamp *)ctsio->cdb; + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + + retval = CTL_RETVAL_COMPLETE; + + total_len = sizeof(struct scsi_report_timestamp_data); + alloc_len = scsi_4btoul(cdb->length); + + ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); + + ctsio->kern_sg_entries = 0; + + if (total_len < alloc_len) { + ctsio->residual = alloc_len - total_len; + ctsio->kern_data_len = total_len; + ctsio->kern_total_len = total_len; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + + data = (struct scsi_report_timestamp_data *)ctsio->kern_data_ptr; + scsi_ulto2b(sizeof(*data) - 2, data->length); + data->origin = RTS_ORIG_OUTSIDE; + getmicrotime(&tv); + timestamp = (int64_t)tv.tv_sec * 1000 + tv.tv_usec / 1000; + scsi_ulto4b(timestamp >> 16, data->timestamp); + scsi_ulto2b(timestamp & 0xffff, &data->timestamp[4]); + + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + + ctl_datamove((union ctl_io *)ctsio); + return (retval); +} + int ctl_persistent_reserve_in(struct ctl_scsiio *ctsio) { @@ -7312,7 +7687,7 @@ ctl_persistent_reserve_in(struct ctl_scsiio *ctsio) lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; retry: - mtx_lock(&softc->ctl_lock); + mtx_lock(&lun->lun_lock); switch (cdb->action) { case SPRI_RK: /* read keys */ total_len = sizeof(struct scsi_per_res_in_keys) + @@ -7329,19 +7704,14 @@ ctl_persistent_reserve_in(struct ctl_scsiio *ctsio) total_len = sizeof(struct scsi_per_res_cap); break; case SPRI_RS: /* read full status */ + total_len = sizeof(struct scsi_per_res_in_header) + + (sizeof(struct scsi_per_res_in_full_desc) + 256) * + lun->pr_key_count; + break; default: - mtx_unlock(&softc->ctl_lock); - ctl_set_invalid_field(ctsio, - /*sks_valid*/ 1, - /*command*/ 1, - /*field*/ 1, - /*bit_valid*/ 1, - /*bit*/ 0); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - break; /* NOTREACHED */ + panic("Invalid PR type %x", cdb->action); } - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); @@ -7359,7 +7729,7 @@ ctl_persistent_reserve_in(struct ctl_scsiio *ctsio) ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; - mtx_lock(&softc->ctl_lock); + mtx_lock(&lun->lun_lock); switch (cdb->action) { case SPRI_RK: { // read keys struct scsi_per_res_in_keys *res_keys; @@ -7377,7 +7747,7 @@ ctl_persistent_reserve_in(struct ctl_scsiio *ctsio) if (total_len != (sizeof(struct scsi_per_res_in_keys) + (lun->pr_key_count * sizeof(struct scsi_per_res_key)))){ - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); free(ctsio->kern_data_ptr, M_CTL); printf("%s: reservation length changed, retrying\n", __func__); @@ -7452,7 +7822,7 @@ ctl_persistent_reserve_in(struct ctl_scsiio *ctsio) * command active right now.) */ if (tmp_len != total_len) { - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); free(ctsio->kern_data_ptr, M_CTL); printf("%s: reservation status changed, retrying\n", __func__); @@ -7484,7 +7854,7 @@ ctl_persistent_reserve_in(struct ctl_scsiio *ctsio) res_cap = (struct scsi_per_res_cap *)ctsio->kern_data_ptr; scsi_ulto2b(sizeof(*res_cap), res_cap->length); - res_cap->flags2 |= SPRI_TMV; + res_cap->flags2 |= SPRI_TMV | SPRI_ALLOW_3; type_mask = SPRI_TM_WR_EX_AR | SPRI_TM_EX_AC_RO | SPRI_TM_WR_EX_RO | @@ -7494,7 +7864,62 @@ ctl_persistent_reserve_in(struct ctl_scsiio *ctsio) scsi_ulto2b(type_mask, res_cap->type_mask); break; } - case SPRI_RS: //read full status + case SPRI_RS: { // read full status + struct scsi_per_res_in_full *res_status; + struct scsi_per_res_in_full_desc *res_desc; + struct ctl_port *port; + int i, len; + + res_status = (struct scsi_per_res_in_full*)ctsio->kern_data_ptr; + + /* + * We had to drop the lock to allocate our buffer, which + * leaves time for someone to come in with another + * persistent reservation. (That is unlikely, though, + * since this should be the only persistent reservation + * command active right now.) + */ + if (total_len < (sizeof(struct scsi_per_res_in_header) + + (sizeof(struct scsi_per_res_in_full_desc) + 256) * + lun->pr_key_count)){ + mtx_unlock(&lun->lun_lock); + free(ctsio->kern_data_ptr, M_CTL); + printf("%s: reservation length changed, retrying\n", + __func__); + goto retry; + } + + scsi_ulto4b(lun->PRGeneration, res_status->header.generation); + + res_desc = &res_status->desc[0]; + for (i = 0; i < 2*CTL_MAX_INITIATORS; i++) { + if (!lun->per_res[i].registered) + continue; + + memcpy(&res_desc->res_key, &lun->per_res[i].res_key.key, + sizeof(res_desc->res_key)); + if ((lun->flags & CTL_LUN_PR_RESERVED) && + (lun->pr_res_idx == i || + lun->pr_res_idx == CTL_PR_ALL_REGISTRANTS)) { + res_desc->flags = SPRI_FULL_R_HOLDER; + res_desc->scopetype = lun->res_type; + } + scsi_ulto2b(i / CTL_MAX_INIT_PER_PORT, + res_desc->rel_trgt_port_id); + len = 0; + port = softc->ctl_ports[i / CTL_MAX_INIT_PER_PORT]; + if (port != NULL) + len = ctl_create_iid(port, + i % CTL_MAX_INIT_PER_PORT, + res_desc->transport_id); + scsi_ulto4b(len, res_desc->additional_length); + res_desc = (struct scsi_per_res_in_full_desc *) + &res_desc->transport_id[len]; + } + scsi_ulto4b((uint8_t *)res_desc - (uint8_t *)&res_status->desc[0], + res_status->header.length); + break; + } default: /* * This is a bug, because we just checked for this above, @@ -7503,8 +7928,9 @@ ctl_persistent_reserve_in(struct ctl_scsiio *ctsio) panic("Invalid PR type %x", cdb->action); break; /* NOTREACHED */ } - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; ctsio->be_move_done = ctl_config_move_done; CTL_DEBUG_PRINT(("buf = %x %x %x %x %x %x %x %x\n", @@ -7534,13 +7960,13 @@ ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, uint64_t res_key, retval = 0; + mtx_lock(&lun->lun_lock); if (sa_res_key == 0) { - mtx_lock(&softc->ctl_lock); if (lun->pr_res_idx == CTL_PR_ALL_REGISTRANTS) { /* validate scope and type */ if ((cdb->scope_type & SPR_SCOPE_MASK) != SPR_LU_SCOPE) { - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); ctl_set_invalid_field(/*ctsio*/ ctsio, /*sks_valid*/ 1, /*command*/ 1, @@ -7552,7 +7978,7 @@ ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, uint64_t res_key, } if (type>8 || type==2 || type==4 || type==0) { - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); ctl_set_invalid_field(/*ctsio*/ ctsio, /*sks_valid*/ 1, /*command*/ 1, @@ -7576,12 +8002,11 @@ ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, uint64_t res_key, if (!persis_offset && i pending_sense[i].ua_pending |= + lun->pending_ua[i] |= CTL_UA_REG_PREEMPT; else if (persis_offset && i >= persis_offset) - lun->pending_sense[i-persis_offset - ].ua_pending |= + lun->pending_ua[i-persis_offset] |= CTL_UA_REG_PREEMPT; lun->per_res[i].registered = 0; memset(&lun->per_res[i].res_key, 0, @@ -7594,7 +8019,6 @@ ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, uint64_t res_key, && lun->res_type != SPR_TYPE_EX_AC_AR) lun->pr_res_idx = residx; - mtx_unlock(&softc->ctl_lock); /* send msg to other side */ persis_io.hdr.nexus = ctsio->io_hdr.nexus; persis_io.hdr.msg_type = CTL_MSG_PERS_ACTION; @@ -7613,7 +8037,7 @@ ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, uint64_t res_key, } } else { /* not all registrants */ - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); free(ctsio->kern_data_ptr, M_CTL); ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, @@ -7628,7 +8052,6 @@ ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, uint64_t res_key, || !(lun->flags & CTL_LUN_PR_RESERVED)) { int found = 0; - mtx_lock(&softc->ctl_lock); if (res_key == sa_res_key) { /* special case */ /* @@ -7640,7 +8063,7 @@ ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, uint64_t res_key, * zero I'll take that approach since this has * to do with the sa_res_key. */ - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); free(ctsio->kern_data_ptr, M_CTL); ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, @@ -7665,17 +8088,14 @@ ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, uint64_t res_key, sizeof(struct scsi_per_res_key)); lun->pr_key_count--; - if (!persis_offset - && i < CTL_MAX_INITIATORS) - lun->pending_sense[i].ua_pending |= - CTL_UA_REG_PREEMPT; - else if (persis_offset - && i >= persis_offset) - lun->pending_sense[i-persis_offset].ua_pending|= + if (!persis_offset && i < CTL_MAX_INITIATORS) + lun->pending_ua[i] |= CTL_UA_REG_PREEMPT; + else if (persis_offset && i >= persis_offset) + lun->pending_ua[i-persis_offset] |= CTL_UA_REG_PREEMPT; } - mtx_unlock(&softc->ctl_lock); if (!found) { + mtx_unlock(&lun->lun_lock); free(ctsio->kern_data_ptr, M_CTL); ctl_set_reservation_conflict(ctsio); ctl_done((union ctl_io *)ctsio); @@ -7705,6 +8125,7 @@ ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, uint64_t res_key, /* validate scope and type */ if ((cdb->scope_type & SPR_SCOPE_MASK) != SPR_LU_SCOPE) { + mtx_unlock(&lun->lun_lock); ctl_set_invalid_field(/*ctsio*/ ctsio, /*sks_valid*/ 1, /*command*/ 1, @@ -7716,6 +8137,7 @@ ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, uint64_t res_key, } if (type>8 || type==2 || type==4 || type==0) { + mtx_unlock(&lun->lun_lock); ctl_set_invalid_field(/*ctsio*/ ctsio, /*sks_valid*/ 1, /*command*/ 1, @@ -7760,27 +8182,23 @@ ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, uint64_t res_key, if (!persis_offset && i < CTL_MAX_INITIATORS) - lun->pending_sense[i - ].ua_pending |= + lun->pending_ua[i] |= CTL_UA_REG_PREEMPT; else if (persis_offset && i >= persis_offset) - lun->pending_sense[ - i-persis_offset].ua_pending |= + lun->pending_ua[i-persis_offset] |= CTL_UA_REG_PREEMPT; } else if (type != lun->res_type && (lun->res_type == SPR_TYPE_WR_EX_RO || lun->res_type ==SPR_TYPE_EX_AC_RO)){ if (!persis_offset && i < CTL_MAX_INITIATORS) - lun->pending_sense[i - ].ua_pending |= + lun->pending_ua[i] |= CTL_UA_RES_RELEASE; else if (persis_offset && i >= persis_offset) - lun->pending_sense[ - i-persis_offset - ].ua_pending |= + lun->pending_ua[ + i-persis_offset] |= CTL_UA_RES_RELEASE; } } @@ -7790,8 +8208,7 @@ ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, uint64_t res_key, && lun->res_type != SPR_TYPE_EX_AC_AR) lun->pr_res_idx = residx; else - lun->pr_res_idx = - CTL_PR_ALL_REGISTRANTS; + lun->pr_res_idx = CTL_PR_ALL_REGISTRANTS; persis_io.hdr.nexus = ctsio->io_hdr.nexus; persis_io.hdr.msg_type = CTL_MSG_PERS_ACTION; @@ -7814,7 +8231,6 @@ ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, uint64_t res_key, * remove registrants */ int found=0; - mtx_lock(&softc->ctl_lock); for (i=0; i < 2*CTL_MAX_INITIATORS; i++) { if (memcmp(param->serv_act_res_key, @@ -7830,23 +8246,21 @@ ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, uint64_t res_key, if (!persis_offset && i < CTL_MAX_INITIATORS) - lun->pending_sense[i].ua_pending |= + lun->pending_ua[i] |= CTL_UA_REG_PREEMPT; else if (persis_offset && i >= persis_offset) - lun->pending_sense[ - i-persis_offset].ua_pending |= + lun->pending_ua[i-persis_offset] |= CTL_UA_REG_PREEMPT; } if (!found) { - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); free(ctsio->kern_data_ptr, M_CTL); ctl_set_reservation_conflict(ctsio); ctl_done((union ctl_io *)ctsio); return (1); } - mtx_unlock(&softc->ctl_lock); persis_io.hdr.nexus = ctsio->io_hdr.nexus; persis_io.hdr.msg_type = CTL_MSG_PERS_ACTION; persis_io.pr.pr_info.action = CTL_PR_PREEMPT; @@ -7866,6 +8280,7 @@ ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, uint64_t res_key, } lun->PRGeneration++; + mtx_unlock(&lun->lun_lock); return (retval); } @@ -7897,11 +8312,10 @@ ctl_pro_preempt_other(struct ctl_lun *lun, union ctl_ha_msg *msg) if (!persis_offset && i < CTL_MAX_INITIATORS) - lun->pending_sense[i].ua_pending |= + lun->pending_ua[i] |= CTL_UA_REG_PREEMPT; else if (persis_offset && i >= persis_offset) - lun->pending_sense[i - - persis_offset].ua_pending |= + lun->pending_ua[i - persis_offset] |= CTL_UA_REG_PREEMPT; lun->per_res[i].registered = 0; memset(&lun->per_res[i].res_key, 0, @@ -7928,12 +8342,11 @@ ctl_pro_preempt_other(struct ctl_lun *lun, union ctl_ha_msg *msg) if (!persis_offset && i < persis_offset) - lun->pending_sense[i].ua_pending |= + lun->pending_ua[i] |= CTL_UA_REG_PREEMPT; else if (persis_offset && i >= persis_offset) - lun->pending_sense[i - - persis_offset].ua_pending |= + lun->pending_ua[i - persis_offset] |= CTL_UA_REG_PREEMPT; } } @@ -7956,25 +8369,22 @@ ctl_pro_preempt_other(struct ctl_lun *lun, union ctl_ha_msg *msg) lun->pr_key_count--; if (!persis_offset && i < CTL_MAX_INITIATORS) - lun->pending_sense[i].ua_pending |= + lun->pending_ua[i] |= CTL_UA_REG_PREEMPT; else if (persis_offset && i >= persis_offset) - lun->pending_sense[i - - persis_offset].ua_pending |= + lun->pending_ua[i - persis_offset] |= CTL_UA_REG_PREEMPT; } else if (msg->pr.pr_info.res_type != lun->res_type && (lun->res_type == SPR_TYPE_WR_EX_RO || lun->res_type == SPR_TYPE_EX_AC_RO)) { if (!persis_offset && i < persis_offset) - lun->pending_sense[i - ].ua_pending |= + lun->pending_ua[i] |= CTL_UA_RES_RELEASE; else if (persis_offset && i >= persis_offset) - lun->pending_sense[i - - persis_offset].ua_pending |= + lun->pending_ua[i - persis_offset] |= CTL_UA_RES_RELEASE; } } @@ -8048,28 +8458,6 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) } } - switch (cdb->action & SPRO_ACTION_MASK) { - case SPRO_REGISTER: - case SPRO_RESERVE: - case SPRO_RELEASE: - case SPRO_CLEAR: - case SPRO_PREEMPT: - case SPRO_REG_IGNO: - break; - case SPRO_REG_MOVE: - case SPRO_PRE_ABO: - default: - ctl_set_invalid_field(/*ctsio*/ ctsio, - /*sks_valid*/ 1, - /*command*/ 1, - /*field*/ 1, - /*bit_valid*/ 1, - /*bit*/ 0); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - break; /* NOTREACHED */ - } - param_len = scsi_4btoul(cdb->length); if ((ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) == 0) { @@ -8097,7 +8485,7 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) * This must be done for all other service actions */ if ((cdb->action & SPRO_ACTION_MASK) != SPRO_REG_IGNO) { - mtx_lock(&softc->ctl_lock); + mtx_lock(&lun->lun_lock); if (lun->per_res[residx].registered) { if (memcmp(param->res_key.key, lun->per_res[residx].res_key.key, @@ -8108,7 +8496,7 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) * the one the initiator previously * registered. */ - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); free(ctsio->kern_data_ptr, M_CTL); ctl_set_reservation_conflict(ctsio); ctl_done((union ctl_io *)ctsio); @@ -8118,7 +8506,7 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) /* * We are not registered */ - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); free(ctsio->kern_data_ptr, M_CTL); ctl_set_reservation_conflict(ctsio); ctl_done((union ctl_io *)ctsio); @@ -8128,13 +8516,13 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) * We are not registered and trying to register but * the register key isn't zero. */ - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); free(ctsio->kern_data_ptr, M_CTL); ctl_set_reservation_conflict(ctsio); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); } switch (cdb->action & SPRO_ACTION_MASK) { @@ -8173,7 +8561,7 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) return (CTL_RETVAL_COMPLETE); } - mtx_lock(&softc->ctl_lock); + mtx_lock(&lun->lun_lock); /* * The initiator wants to clear the @@ -8184,7 +8572,7 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) && (cdb->action & SPRO_ACTION_MASK) == SPRO_REGISTER) || ((cdb->action & SPRO_ACTION_MASK) == SPRO_REG_IGNO && !lun->per_res[residx].registered)) { - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); goto done; } @@ -8213,8 +8601,7 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) i+persis_offset].registered == 0) continue; - lun->pending_sense[i - ].ua_pending |= + lun->pending_ua[i] |= CTL_UA_RES_RELEASE; } } @@ -8236,7 +8623,6 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) printf("CTL:Persis Out error returned from " "ctl_ha_msg_send %d\n", isc_retval); } - mtx_unlock(&softc->ctl_lock); } else /* sa_res_key != 0 */ { /* @@ -8260,7 +8646,6 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) memcpy(persis_io.pr.pr_info.sa_res_key, param->serv_act_res_key, sizeof(param->serv_act_res_key)); - mtx_unlock(&softc->ctl_lock); if ((isc_retval=ctl_ha_msg_send(CTL_HA_CHAN_CTL, &persis_io, sizeof(persis_io), 0)) > CTL_HA_STATUS_SUCCESS) { @@ -8269,6 +8654,7 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) } } lun->PRGeneration++; + mtx_unlock(&lun->lun_lock); break; } @@ -8276,7 +8662,7 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) #if 0 printf("Reserve executed type %d\n", type); #endif - mtx_lock(&softc->ctl_lock); + mtx_lock(&lun->lun_lock); if (lun->flags & CTL_LUN_PR_RESERVED) { /* * if this isn't the reservation holder and it's @@ -8286,13 +8672,13 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) if ((lun->pr_res_idx != residx && lun->pr_res_idx != CTL_PR_ALL_REGISTRANTS) || lun->res_type != type) { - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); free(ctsio->kern_data_ptr, M_CTL); ctl_set_reservation_conflict(ctsio); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); } else /* create a reservation */ { /* * If it's not an "all registrants" type record @@ -8307,7 +8693,7 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) lun->flags |= CTL_LUN_PR_RESERVED; lun->res_type = type; - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); /* send msg to other side */ persis_io.hdr.nexus = ctsio->io_hdr.nexus; @@ -8325,10 +8711,10 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) break; case SPRO_RELEASE: - mtx_lock(&softc->ctl_lock); + mtx_lock(&lun->lun_lock); if ((lun->flags & CTL_LUN_PR_RESERVED) == 0) { /* No reservation exists return good status */ - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); goto done; } /* @@ -8340,12 +8726,12 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) * not a res holder return good status but * do nothing */ - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); goto done; } if (lun->res_type != type) { - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); free(ctsio->kern_data_ptr, M_CTL); ctl_set_illegal_pr_release(ctsio); ctl_done((union ctl_io *)ctsio); @@ -8373,13 +8759,13 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) if (lun->per_res[i+persis_offset].registered == 0) continue; - lun->pending_sense[i].ua_pending |= + lun->pending_ua[i] |= CTL_UA_RES_RELEASE; } lun->per_res[residx].registered = 1; } - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); /* Send msg to other side */ persis_io.hdr.nexus = ctsio->io_hdr.nexus; persis_io.hdr.msg_type = CTL_MSG_PERS_ACTION; @@ -8394,7 +8780,7 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) case SPRO_CLEAR: /* send msg to other side */ - mtx_lock(&softc->ctl_lock); + mtx_lock(&lun->lun_lock); lun->flags &= ~CTL_LUN_PR_RESERVED; lun->res_type = 0; lun->pr_key_count = 0; @@ -8408,18 +8794,18 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) for (i=0; i < 2*CTL_MAX_INITIATORS; i++) if (lun->per_res[i].registered) { if (!persis_offset && i < CTL_MAX_INITIATORS) - lun->pending_sense[i].ua_pending |= + lun->pending_ua[i] |= CTL_UA_RES_PREEMPT; else if (persis_offset && i >= persis_offset) - lun->pending_sense[i-persis_offset - ].ua_pending |= CTL_UA_RES_PREEMPT; + lun->pending_ua[i-persis_offset] |= + CTL_UA_RES_PREEMPT; memset(&lun->per_res[i].res_key, 0, sizeof(struct scsi_per_res_key)); lun->per_res[i].registered = 0; } lun->PRGeneration++; - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); persis_io.hdr.nexus = ctsio->io_hdr.nexus; persis_io.hdr.msg_type = CTL_MSG_PERS_ACTION; persis_io.pr.pr_info.action = CTL_PR_CLEAR; @@ -8439,19 +8825,8 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) return (CTL_RETVAL_COMPLETE); break; } - case SPRO_REG_MOVE: - case SPRO_PRE_ABO: default: - free(ctsio->kern_data_ptr, M_CTL); - ctl_set_invalid_field(/*ctsio*/ ctsio, - /*sks_valid*/ 1, - /*command*/ 1, - /*field*/ 1, - /*bit_valid*/ 1, - /*bit*/ 0); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - break; /* NOTREACHED */ + panic("Invalid PR type %x", cdb->action); } done: @@ -8478,12 +8853,9 @@ ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg) softc = control_softc; - mtx_lock(&softc->ctl_lock); - - targ_lun = msg->hdr.nexus.targ_lun; - if (msg->hdr.nexus.lun_map_fn != NULL) - targ_lun = msg->hdr.nexus.lun_map_fn(msg->hdr.nexus.lun_map_arg, targ_lun); + targ_lun = msg->hdr.nexus.targ_mapped_lun; lun = softc->ctl_luns[targ_lun]; + mtx_lock(&lun->lun_lock); switch(msg->pr.pr_info.action) { case CTL_PR_REG_KEY: if (!lun->per_res[msg->pr.pr_info.residx].registered) { @@ -8524,8 +8896,7 @@ ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg) persis_offset].registered == 0) continue; - lun->pending_sense[i - ].ua_pending |= + lun->pending_ua[i] |= CTL_UA_RES_RELEASE; } } @@ -8556,7 +8927,7 @@ ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg) && lun->res_type != SPR_TYPE_WR_EX) { for (i = 0; i < CTL_MAX_INITIATORS; i++) if (lun->per_res[i+persis_offset].registered) - lun->pending_sense[i].ua_pending |= + lun->pending_ua[i] |= CTL_UA_RES_RELEASE; } @@ -8579,11 +8950,10 @@ ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg) continue; if (!persis_offset && i < CTL_MAX_INITIATORS) - lun->pending_sense[i].ua_pending |= - CTL_UA_RES_PREEMPT; + lun->pending_ua[i] |= CTL_UA_RES_PREEMPT; else if (persis_offset && i >= persis_offset) - lun->pending_sense[i-persis_offset].ua_pending|= + lun->pending_ua[i-persis_offset] |= CTL_UA_RES_PREEMPT; memset(&lun->per_res[i].res_key, 0, sizeof(struct scsi_per_res_key)); @@ -8593,17 +8963,17 @@ ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg) break; } - mtx_unlock(&softc->ctl_lock); + mtx_unlock(&lun->lun_lock); } int ctl_read_write(struct ctl_scsiio *ctsio) { struct ctl_lun *lun; - struct ctl_lba_len lbalen; + struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t num_blocks; - int reladdr, fua, dpo, ebp; + int fua, dpo; int retval; int isread; @@ -8611,10 +8981,8 @@ ctl_read_write(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_read_write: command: %#x\n", ctsio->cdb[0])); - reladdr = 0; fua = 0; dpo = 0; - ebp = 0; retval = CTL_RETVAL_COMPLETE; @@ -8662,17 +9030,11 @@ ctl_read_write(struct ctl_scsiio *ctsio) cdb = (struct scsi_rw_10 *)ctsio->cdb; - if (cdb->byte2 & SRW10_RELADDR) - reladdr = 1; if (cdb->byte2 & SRW10_FUA) fua = 1; if (cdb->byte2 & SRW10_DPO) dpo = 1; - if ((cdb->opcode == WRITE_10) - && (cdb->byte2 & SRW10_EBP)) - ebp = 1; - lba = scsi_4btoul(cdb->addr); num_blocks = scsi_2btoul(cdb->length); break; @@ -8702,8 +9064,6 @@ ctl_read_write(struct ctl_scsiio *ctsio) cdb = (struct scsi_rw_12 *)ctsio->cdb; - if (cdb->byte2 & SRW12_RELADDR) - reladdr = 1; if (cdb->byte2 & SRW12_FUA) fua = 1; if (cdb->byte2 & SRW12_DPO) @@ -8731,8 +9091,6 @@ ctl_read_write(struct ctl_scsiio *ctsio) cdb = (struct scsi_rw_16 *)ctsio->cdb; - if (cdb->byte2 & SRW12_RELADDR) - reladdr = 1; if (cdb->byte2 & SRW12_FUA) fua = 1; if (cdb->byte2 & SRW12_DPO) @@ -8772,20 +9130,6 @@ ctl_read_write(struct ctl_scsiio *ctsio) * getting it to do write-through for a particular transaction may * not be possible. */ - /* - * We don't support relative addressing. That also requires - * supporting linked commands, which we don't do. - */ - if (reladdr != 0) { - ctl_set_invalid_field(ctsio, - /*sks_valid*/ 1, - /*command*/ 1, - /*field*/ 1, - /*bit_valid*/ 1, - /*bit*/ 0); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } /* * The first check is to make sure we're in bounds, the second @@ -8811,10 +9155,14 @@ ctl_read_write(struct ctl_scsiio *ctsio) return (CTL_RETVAL_COMPLETE); } - lbalen.lba = lba; - lbalen.len = num_blocks; - memcpy(ctsio->io_hdr.ctl_private[CTL_PRIV_LBA_LEN].bytes, &lbalen, - sizeof(lbalen)); + lbalen = (struct ctl_lba_len_flags *) + &ctsio->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]; + lbalen->lba = lba; + lbalen->len = num_blocks; + lbalen->flags = isread ? CTL_LLF_READ : CTL_LLF_WRITE; + + ctsio->kern_total_len = num_blocks * lun->be_lun->blocksize; + ctsio->kern_rel_offset = 0; CTL_DEBUG_PRINT(("ctl_read_write: calling data_submit()\n")); @@ -8823,6 +9171,228 @@ ctl_read_write(struct ctl_scsiio *ctsio) return (retval); } +static int +ctl_cnw_cont(union ctl_io *io) +{ + struct ctl_scsiio *ctsio; + struct ctl_lun *lun; + struct ctl_lba_len_flags *lbalen; + int retval; + + ctsio = &io->scsiio; + ctsio->io_hdr.status = CTL_STATUS_NONE; + ctsio->io_hdr.flags &= ~CTL_FLAG_IO_CONT; + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + lbalen = (struct ctl_lba_len_flags *) + &ctsio->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]; + lbalen->flags = CTL_LLF_WRITE; + + CTL_DEBUG_PRINT(("ctl_cnw_cont: calling data_submit()\n")); + retval = lun->backend->data_submit((union ctl_io *)ctsio); + return (retval); +} + +int +ctl_cnw(struct ctl_scsiio *ctsio) +{ + struct ctl_lun *lun; + struct ctl_lba_len_flags *lbalen; + uint64_t lba; + uint32_t num_blocks; + int fua, dpo; + int retval; + + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + + CTL_DEBUG_PRINT(("ctl_cnw: command: %#x\n", ctsio->cdb[0])); + + fua = 0; + dpo = 0; + + retval = CTL_RETVAL_COMPLETE; + + switch (ctsio->cdb[0]) { + case COMPARE_AND_WRITE: { + struct scsi_compare_and_write *cdb; + + cdb = (struct scsi_compare_and_write *)ctsio->cdb; + + if (cdb->byte2 & SRW10_FUA) + fua = 1; + if (cdb->byte2 & SRW10_DPO) + dpo = 1; + lba = scsi_8btou64(cdb->addr); + num_blocks = cdb->length; + break; + } + default: + /* + * We got a command we don't support. This shouldn't + * happen, commands should be filtered out above us. + */ + ctl_set_invalid_opcode(ctsio); + ctl_done((union ctl_io *)ctsio); + + return (CTL_RETVAL_COMPLETE); + break; /* NOTREACHED */ + } + + /* + * XXX KDM what do we do with the DPO and FUA bits? FUA might be + * interesting for us, but if RAIDCore is in write-back mode, + * getting it to do write-through for a particular transaction may + * not be possible. + */ + + /* + * The first check is to make sure we're in bounds, the second + * check is to catch wrap-around problems. If the lba + num blocks + * is less than the lba, then we've wrapped around and the block + * range is invalid anyway. + */ + if (((lba + num_blocks) > (lun->be_lun->maxlba + 1)) + || ((lba + num_blocks) < lba)) { + ctl_set_lba_out_of_range(ctsio); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + + /* + * According to SBC-3, a transfer length of 0 is not an error. + */ + if (num_blocks == 0) { + ctl_set_success(ctsio); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + + ctsio->kern_total_len = 2 * num_blocks * lun->be_lun->blocksize; + ctsio->kern_rel_offset = 0; + + /* + * Set the IO_CONT flag, so that if this I/O gets passed to + * ctl_data_submit_done(), it'll get passed back to + * ctl_ctl_cnw_cont() for further processing. + */ + ctsio->io_hdr.flags |= CTL_FLAG_IO_CONT; + ctsio->io_cont = ctl_cnw_cont; + + lbalen = (struct ctl_lba_len_flags *) + &ctsio->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]; + lbalen->lba = lba; + lbalen->len = num_blocks; + lbalen->flags = CTL_LLF_COMPARE; + + CTL_DEBUG_PRINT(("ctl_cnw: calling data_submit()\n")); + retval = lun->backend->data_submit((union ctl_io *)ctsio); + return (retval); +} + +int +ctl_verify(struct ctl_scsiio *ctsio) +{ + struct ctl_lun *lun; + struct ctl_lba_len_flags *lbalen; + uint64_t lba; + uint32_t num_blocks; + int bytchk, dpo; + int retval; + + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + + CTL_DEBUG_PRINT(("ctl_verify: command: %#x\n", ctsio->cdb[0])); + + bytchk = 0; + dpo = 0; + retval = CTL_RETVAL_COMPLETE; + + switch (ctsio->cdb[0]) { + case VERIFY_10: { + struct scsi_verify_10 *cdb; + + cdb = (struct scsi_verify_10 *)ctsio->cdb; + if (cdb->byte2 & SVFY_BYTCHK) + bytchk = 1; + if (cdb->byte2 & SVFY_DPO) + dpo = 1; + lba = scsi_4btoul(cdb->addr); + num_blocks = scsi_2btoul(cdb->length); + break; + } + case VERIFY_12: { + struct scsi_verify_12 *cdb; + + cdb = (struct scsi_verify_12 *)ctsio->cdb; + if (cdb->byte2 & SVFY_BYTCHK) + bytchk = 1; + if (cdb->byte2 & SVFY_DPO) + dpo = 1; + lba = scsi_4btoul(cdb->addr); + num_blocks = scsi_4btoul(cdb->length); + break; + } + case VERIFY_16: { + struct scsi_rw_16 *cdb; + + cdb = (struct scsi_rw_16 *)ctsio->cdb; + if (cdb->byte2 & SVFY_BYTCHK) + bytchk = 1; + if (cdb->byte2 & SVFY_DPO) + dpo = 1; + lba = scsi_8btou64(cdb->addr); + num_blocks = scsi_4btoul(cdb->length); + break; + } + default: + /* + * We got a command we don't support. This shouldn't + * happen, commands should be filtered out above us. + */ + ctl_set_invalid_opcode(ctsio); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + + /* + * The first check is to make sure we're in bounds, the second + * check is to catch wrap-around problems. If the lba + num blocks + * is less than the lba, then we've wrapped around and the block + * range is invalid anyway. + */ + if (((lba + num_blocks) > (lun->be_lun->maxlba + 1)) + || ((lba + num_blocks) < lba)) { + ctl_set_lba_out_of_range(ctsio); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + + /* + * According to SBC-3, a transfer length of 0 is not an error. + */ + if (num_blocks == 0) { + ctl_set_success(ctsio); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + + lbalen = (struct ctl_lba_len_flags *) + &ctsio->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]; + lbalen->lba = lba; + lbalen->len = num_blocks; + if (bytchk) { + lbalen->flags = CTL_LLF_COMPARE; + ctsio->kern_total_len = num_blocks * lun->be_lun->blocksize; + } else { + lbalen->flags = CTL_LLF_VERIFY; + ctsio->kern_total_len = 0; + } + ctsio->kern_rel_offset = 0; + + CTL_DEBUG_PRINT(("ctl_verify: calling data_submit()\n")); + retval = lun->backend->data_submit((union ctl_io *)ctsio); + return (retval); +} + int ctl_report_luns(struct ctl_scsiio *ctsio) { @@ -8897,9 +9467,7 @@ ctl_report_luns(struct ctl_scsiio *ctsio) mtx_lock(&control_softc->ctl_lock); for (targ_lun_id = 0, num_filled = 0; targ_lun_id < CTL_MAX_LUNS && num_filled < num_luns; targ_lun_id++) { - lun_id = targ_lun_id; - if (ctsio->io_hdr.nexus.lun_map_fn != NULL) - lun_id = ctsio->io_hdr.nexus.lun_map_fn(ctsio->io_hdr.nexus.lun_map_arg, lun_id); + lun_id = ctl_map_lun(ctsio->io_hdr.nexus.targ_port, targ_lun_id); if (lun_id >= CTL_MAX_LUNS) continue; lun = control_softc->ctl_luns[lun_id]; @@ -8951,9 +9519,11 @@ ctl_report_luns(struct ctl_scsiio *ctsio) * case, we shouldn't clear any pending lun change unit * attention. */ - if (request_lun != NULL) - lun->pending_sense[initidx].ua_pending &= - ~CTL_UA_LUN_CHANGE; + if (request_lun != NULL) { + mtx_lock(&lun->lun_lock); + lun->pending_ua[initidx] &= ~CTL_UA_LUN_CHANGE; + mtx_unlock(&lun->lun_lock); + } } mtx_unlock(&control_softc->ctl_lock); @@ -8992,6 +9562,7 @@ ctl_report_luns(struct ctl_scsiio *ctsio) */ ctsio->scsi_status = SCSI_STATUS_OK; + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; ctsio->be_move_done = ctl_config_move_done; ctl_datamove((union ctl_io *)ctsio); @@ -9051,7 +9622,8 @@ ctl_request_sense(struct ctl_scsiio *ctsio) * Check for pending sense, and then for pending unit attentions. * Pending sense gets returned first, then pending unit attentions. */ - mtx_lock(&lun->ctl_softc->ctl_lock); + mtx_lock(&lun->lun_lock); +#ifdef CTL_WITH_CA if (ctl_is_set(lun->have_ca, initidx)) { scsi_sense_data_type stored_format; @@ -9059,8 +9631,7 @@ ctl_request_sense(struct ctl_scsiio *ctsio) * Check to see which sense format was used for the stored * sense data. */ - stored_format = scsi_sense_type( - &lun->pending_sense[initidx].sense); + stored_format = scsi_sense_type(&lun->pending_sense[initidx]); /* * If the user requested a different sense format than the @@ -9075,32 +9646,34 @@ ctl_request_sense(struct ctl_scsiio *ctsio) if ((stored_format == SSD_TYPE_FIXED) && (sense_format == SSD_TYPE_DESC)) ctl_sense_to_desc((struct scsi_sense_data_fixed *) - &lun->pending_sense[initidx].sense, + &lun->pending_sense[initidx], (struct scsi_sense_data_desc *)sense_ptr); else if ((stored_format == SSD_TYPE_DESC) && (sense_format == SSD_TYPE_FIXED)) ctl_sense_to_fixed((struct scsi_sense_data_desc *) - &lun->pending_sense[initidx].sense, + &lun->pending_sense[initidx], (struct scsi_sense_data_fixed *)sense_ptr); else - memcpy(sense_ptr, &lun->pending_sense[initidx].sense, + memcpy(sense_ptr, &lun->pending_sense[initidx], ctl_min(sizeof(*sense_ptr), - sizeof(lun->pending_sense[initidx].sense))); + sizeof(lun->pending_sense[initidx]))); ctl_clear_mask(lun->have_ca, initidx); have_error = 1; - } else if (lun->pending_sense[initidx].ua_pending != CTL_UA_NONE) { + } else +#endif + if (lun->pending_ua[initidx] != CTL_UA_NONE) { ctl_ua_type ua_type; - ua_type = ctl_build_ua(lun->pending_sense[initidx].ua_pending, + ua_type = ctl_build_ua(lun->pending_ua[initidx], sense_ptr, sense_format); if (ua_type != CTL_UA_NONE) { have_error = 1; /* We're reporting this UA, so clear it */ - lun->pending_sense[initidx].ua_pending &= ~ua_type; + lun->pending_ua[initidx] &= ~ua_type; } } - mtx_unlock(&lun->ctl_softc->ctl_lock); + mtx_unlock(&lun->lun_lock); /* * We already have a pending error, return it. @@ -9118,7 +9691,7 @@ ctl_request_sense(struct ctl_scsiio *ctsio) * parameter data. */ ctsio->sense_len = 0; - + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; ctsio->be_move_done = ctl_config_move_done; ctl_datamove((union ctl_io *)ctsio); @@ -9147,6 +9720,7 @@ ctl_request_sense(struct ctl_scsiio *ctsio) * autosense in this case. We're reporting sense as parameter data. */ ctsio->sense_len = 0; + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; ctsio->be_move_done = ctl_config_move_done; ctl_datamove((union ctl_io *)ctsio); @@ -9163,7 +9737,7 @@ ctl_tur(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_tur\n")); if (lun == NULL) - return (-EINVAL); + return (EINVAL); ctsio->scsi_status = SCSI_STATUS_OK; ctsio->io_hdr.status = CTL_SUCCESS; @@ -9227,13 +9801,18 @@ ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, int alloc_len) pages->page_list[1] = SVPD_UNIT_SERIAL_NUMBER; /* Device Identification */ pages->page_list[2] = SVPD_DEVICE_ID; + /* SCSI Ports */ + pages->page_list[3] = SVPD_SCSI_PORTS; + /* Third-party Copy */ + pages->page_list[4] = SVPD_SCSI_TPC; /* Block limits */ - pages->page_list[3] = SVPD_BLOCK_LIMITS; + pages->page_list[5] = SVPD_BLOCK_LIMITS; /* Logical Block Provisioning */ - pages->page_list[4] = SVPD_LBP; + pages->page_list[6] = SVPD_LBP; ctsio->scsi_status = SCSI_STATUS_OK; + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; ctsio->be_move_done = ctl_config_move_done; ctl_datamove((union ctl_io *)ctsio); @@ -9245,9 +9824,6 @@ ctl_inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len) { struct scsi_vpd_unit_serial_number *sn_ptr; struct ctl_lun *lun; -#ifndef CTL_USE_BACKEND_SN - char tmpstr[32]; -#endif lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; @@ -9281,7 +9857,6 @@ ctl_inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len) sn_ptr->page_code = SVPD_UNIT_SERIAL_NUMBER; sn_ptr->length = ctl_min(sizeof(*sn_ptr) - 4, CTL_SN_LEN); -#ifdef CTL_USE_BACKEND_SN /* * If we don't have a LUN, we just leave the serial number as * all spaces. @@ -9291,17 +9866,9 @@ ctl_inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len) strncpy((char *)sn_ptr->serial_num, (char *)lun->be_lun->serial_num, CTL_SN_LEN); } -#else - /* - * Note that we're using a non-unique serial number here, - */ - snprintf(tmpstr, sizeof(tmpstr), "MYSERIALNUMIS000"); - memset(sn_ptr->serial_num, 0x20, sizeof(sn_ptr->serial_num)); - strncpy(sn_ptr->serial_num, tmpstr, ctl_min(CTL_SN_LEN, - ctl_min(sizeof(tmpstr), sizeof(*sn_ptr) - 4))); -#endif ctsio->scsi_status = SCSI_STATUS_OK; + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; ctsio->be_move_done = ctl_config_move_done; ctl_datamove((union ctl_io *)ctsio); @@ -9313,45 +9880,38 @@ static int ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len) { struct scsi_vpd_device_id *devid_ptr; - struct scsi_vpd_id_descriptor *desc, *desc1; - struct scsi_vpd_id_descriptor *desc2, *desc3; /* for types 4h and 5h */ - struct scsi_vpd_id_t10 *t10id; + struct scsi_vpd_id_descriptor *desc; struct ctl_softc *ctl_softc; struct ctl_lun *lun; - struct ctl_frontend *fe; -#ifndef CTL_USE_BACKEND_SN - char tmpstr[32]; -#endif /* CTL_USE_BACKEND_SN */ - int devid_len; + struct ctl_port *port; + int data_len; + uint8_t proto; ctl_softc = control_softc; - mtx_lock(&ctl_softc->ctl_lock); - fe = ctl_softc->ctl_ports[ctl_port_idx(ctsio->io_hdr.nexus.targ_port)]; - mtx_unlock(&ctl_softc->ctl_lock); - - if (fe->devid != NULL) - return ((fe->devid)(ctsio, alloc_len)); - + port = ctl_softc->ctl_ports[ctl_port_idx(ctsio->io_hdr.nexus.targ_port)]; lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - devid_len = sizeof(struct scsi_vpd_device_id) + - sizeof(struct scsi_vpd_id_descriptor) + - sizeof(struct scsi_vpd_id_t10) + CTL_DEVID_LEN + - sizeof(struct scsi_vpd_id_descriptor) + CTL_WWPN_LEN + - sizeof(struct scsi_vpd_id_descriptor) + + data_len = sizeof(struct scsi_vpd_device_id) + + sizeof(struct scsi_vpd_id_descriptor) + sizeof(struct scsi_vpd_id_rel_trgt_port_id) + - sizeof(struct scsi_vpd_id_descriptor) + + sizeof(struct scsi_vpd_id_descriptor) + sizeof(struct scsi_vpd_id_trgt_port_grp_id); + if (lun && lun->lun_devid) + data_len += lun->lun_devid->len; + if (port->port_devid) + data_len += port->port_devid->len; + if (port->target_devid) + data_len += port->target_devid->len; - ctsio->kern_data_ptr = malloc(devid_len, M_CTL, M_WAITOK | M_ZERO); + ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); devid_ptr = (struct scsi_vpd_device_id *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; - if (devid_len < alloc_len) { - ctsio->residual = alloc_len - devid_len; - ctsio->kern_data_len = devid_len; - ctsio->kern_total_len = devid_len; + if (data_len < alloc_len) { + ctsio->residual = alloc_len - data_len; + ctsio->kern_data_len = data_len; + ctsio->kern_total_len = data_len; } else { ctsio->residual = 0; ctsio->kern_data_len = alloc_len; @@ -9361,15 +9921,6 @@ ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len) ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; - desc = (struct scsi_vpd_id_descriptor *)devid_ptr->desc_list; - t10id = (struct scsi_vpd_id_t10 *)&desc->identifier[0]; - desc1 = (struct scsi_vpd_id_descriptor *)(&desc->identifier[0] + - sizeof(struct scsi_vpd_id_t10) + CTL_DEVID_LEN); - desc2 = (struct scsi_vpd_id_descriptor *)(&desc1->identifier[0] + - CTL_WWPN_LEN); - desc3 = (struct scsi_vpd_id_descriptor *)(&desc2->identifier[0] + - sizeof(struct scsi_vpd_id_rel_trgt_port_id)); - /* * The control device is always connected. The disk device, on the * other hand, may not be online all the time. @@ -9379,115 +9930,187 @@ ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len) lun->be_lun->lun_type; else devid_ptr->device = (SID_QUAL_LU_OFFLINE << 5) | T_DIRECT; - devid_ptr->page_code = SVPD_DEVICE_ID; + scsi_ulto2b(data_len - 4, devid_ptr->length); - scsi_ulto2b(devid_len - 4, devid_ptr->length); - - mtx_lock(&ctl_softc->ctl_lock); - - /* - * For Fibre channel, - */ - if (fe->port_type == CTL_PORT_FC) - { - desc->proto_codeset = (SCSI_PROTO_FC << 4) | - SVPD_ID_CODESET_ASCII; - desc1->proto_codeset = (SCSI_PROTO_FC << 4) | - SVPD_ID_CODESET_BINARY; - } + if (port->port_type == CTL_PORT_FC) + proto = SCSI_PROTO_FC << 4; + else if (port->port_type == CTL_PORT_ISCSI) + proto = SCSI_PROTO_ISCSI << 4; else - { - desc->proto_codeset = (SCSI_PROTO_SPI << 4) | - SVPD_ID_CODESET_ASCII; - desc1->proto_codeset = (SCSI_PROTO_SPI << 4) | - SVPD_ID_CODESET_BINARY; - } - desc2->proto_codeset = desc3->proto_codeset = desc1->proto_codeset; - mtx_unlock(&ctl_softc->ctl_lock); + proto = SCSI_PROTO_SPI << 4; + desc = (struct scsi_vpd_id_descriptor *)devid_ptr->desc_list; /* * We're using a LUN association here. i.e., this device ID is a * per-LUN identifier. */ - desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN | SVPD_ID_TYPE_T10; - desc->length = sizeof(*t10id) + CTL_DEVID_LEN; - strncpy((char *)t10id->vendor, CTL_VENDOR, sizeof(t10id->vendor)); - - /* - * desc1 is for the WWPN which is a port asscociation. - */ - desc1->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT | SVPD_ID_TYPE_NAA; - desc1->length = CTL_WWPN_LEN; - /* XXX Call Reggie's get_WWNN func here then add port # to the end */ - /* For testing just create the WWPN */ -#if 0 - ddb_GetWWNN((char *)desc1->identifier); - - /* NOTE: if the port is 0 or 8 we don't want to subtract 1 */ - /* This is so Copancontrol will return something sane */ - if (ctsio->io_hdr.nexus.targ_port!=0 && - ctsio->io_hdr.nexus.targ_port!=8) - desc1->identifier[7] += ctsio->io_hdr.nexus.targ_port-1; - else - desc1->identifier[7] += ctsio->io_hdr.nexus.targ_port; -#endif - - be64enc(desc1->identifier, fe->wwpn); - - /* - * desc2 is for the Relative Target Port(type 4h) identifier - */ - desc2->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT - | SVPD_ID_TYPE_RELTARG; - desc2->length = 4; -//#if 0 - /* NOTE: if the port is 0 or 8 we don't want to subtract 1 */ - /* This is so Copancontrol will return something sane */ - if (ctsio->io_hdr.nexus.targ_port!=0 && - ctsio->io_hdr.nexus.targ_port!=8) - desc2->identifier[3] = ctsio->io_hdr.nexus.targ_port - 1; - else - desc2->identifier[3] = ctsio->io_hdr.nexus.targ_port; -//#endif - - /* - * desc3 is for the Target Port Group(type 5h) identifier - */ - desc3->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT - | SVPD_ID_TYPE_TPORTGRP; - desc3->length = 4; - if (ctsio->io_hdr.nexus.targ_port < CTL_MAX_PORTS || ctl_is_single) - desc3->identifier[3] = 1; - else - desc3->identifier[3] = 2; - -#ifdef CTL_USE_BACKEND_SN - /* - * If we've actually got a backend, copy the device id from the - * per-LUN data. Otherwise, set it to all spaces. - */ - if (lun != NULL) { - /* - * Copy the backend's LUN ID. - */ - strncpy((char *)t10id->vendor_spec_id, - (char *)lun->be_lun->device_id, CTL_DEVID_LEN); - } else { - /* - * No backend, set this to spaces. - */ - memset(t10id->vendor_spec_id, 0x20, CTL_DEVID_LEN); + if (lun && lun->lun_devid) { + memcpy(desc, lun->lun_devid->data, lun->lun_devid->len); + desc = (struct scsi_vpd_id_descriptor *)((uint8_t *)desc + + lun->lun_devid->len); + } + + /* + * This is for the WWPN which is a port association. + */ + if (port->port_devid) { + memcpy(desc, port->port_devid->data, port->port_devid->len); + desc = (struct scsi_vpd_id_descriptor *)((uint8_t *)desc + + port->port_devid->len); + } + + /* + * This is for the Relative Target Port(type 4h) identifier + */ + desc->proto_codeset = proto | SVPD_ID_CODESET_BINARY; + desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT | + SVPD_ID_TYPE_RELTARG; + desc->length = 4; + scsi_ulto2b(ctsio->io_hdr.nexus.targ_port, &desc->identifier[2]); + desc = (struct scsi_vpd_id_descriptor *)(&desc->identifier[0] + + sizeof(struct scsi_vpd_id_rel_trgt_port_id)); + + /* + * This is for the Target Port Group(type 5h) identifier + */ + desc->proto_codeset = proto | SVPD_ID_CODESET_BINARY; + desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT | + SVPD_ID_TYPE_TPORTGRP; + desc->length = 4; + scsi_ulto2b(ctsio->io_hdr.nexus.targ_port / CTL_MAX_PORTS + 1, + &desc->identifier[2]); + desc = (struct scsi_vpd_id_descriptor *)(&desc->identifier[0] + + sizeof(struct scsi_vpd_id_trgt_port_grp_id)); + + /* + * This is for the Target identifier + */ + if (port->target_devid) { + memcpy(desc, port->target_devid->data, port->target_devid->len); } -#else - snprintf(tmpstr, sizeof(tmpstr), "MYDEVICEIDIS%4d", - (lun != NULL) ? (int)lun->lun : 0); - strncpy(t10id->vendor_spec_id, tmpstr, ctl_min(CTL_DEVID_LEN, - sizeof(tmpstr))); -#endif ctsio->scsi_status = SCSI_STATUS_OK; + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + ctl_datamove((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); +} + +static int +ctl_inquiry_evpd_scsi_ports(struct ctl_scsiio *ctsio, int alloc_len) +{ + struct ctl_softc *softc = control_softc; + struct scsi_vpd_scsi_ports *sp; + struct scsi_vpd_port_designation *pd; + struct scsi_vpd_port_designation_cont *pdc; + struct ctl_lun *lun; + struct ctl_port *port; + int data_len, num_target_ports, iid_len, id_len, g, pg, p; + int num_target_port_groups, single; + + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + + single = ctl_is_single; + if (single) + num_target_port_groups = 1; + else + num_target_port_groups = NUM_TARGET_PORT_GROUPS; + num_target_ports = 0; + iid_len = 0; + id_len = 0; + mtx_lock(&softc->ctl_lock); + STAILQ_FOREACH(port, &softc->port_list, links) { + if ((port->status & CTL_PORT_STATUS_ONLINE) == 0) + continue; + if (lun != NULL && + ctl_map_lun_back(port->targ_port, lun->lun) >= + CTL_MAX_LUNS) + continue; + num_target_ports++; + if (port->init_devid) + iid_len += port->init_devid->len; + if (port->port_devid) + id_len += port->port_devid->len; + } + mtx_unlock(&softc->ctl_lock); + + data_len = sizeof(struct scsi_vpd_scsi_ports) + num_target_port_groups * + num_target_ports * (sizeof(struct scsi_vpd_port_designation) + + sizeof(struct scsi_vpd_port_designation_cont)) + iid_len + id_len; + ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); + sp = (struct scsi_vpd_scsi_ports *)ctsio->kern_data_ptr; + ctsio->kern_sg_entries = 0; + + if (data_len < alloc_len) { + ctsio->residual = alloc_len - data_len; + ctsio->kern_data_len = data_len; + ctsio->kern_total_len = data_len; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + ctsio->kern_sg_entries = 0; + + /* + * The control device is always connected. The disk device, on the + * other hand, may not be online all the time. Need to change this + * to figure out whether the disk device is actually online or not. + */ + if (lun != NULL) + sp->device = (SID_QUAL_LU_CONNECTED << 5) | + lun->be_lun->lun_type; + else + sp->device = (SID_QUAL_LU_OFFLINE << 5) | T_DIRECT; + + sp->page_code = SVPD_SCSI_PORTS; + scsi_ulto2b(data_len - sizeof(struct scsi_vpd_scsi_ports), + sp->page_length); + pd = &sp->design[0]; + + mtx_lock(&softc->ctl_lock); + if (softc->flags & CTL_FLAG_MASTER_SHELF) + pg = 0; + else + pg = 1; + for (g = 0; g < num_target_port_groups; g++) { + STAILQ_FOREACH(port, &softc->port_list, links) { + if ((port->status & CTL_PORT_STATUS_ONLINE) == 0) + continue; + if (lun != NULL && + ctl_map_lun_back(port->targ_port, lun->lun) >= + CTL_MAX_LUNS) + continue; + p = port->targ_port % CTL_MAX_PORTS + g * CTL_MAX_PORTS; + scsi_ulto2b(p, pd->relative_port_id); + if (port->init_devid && g == pg) { + iid_len = port->init_devid->len; + memcpy(pd->initiator_transportid, + port->init_devid->data, port->init_devid->len); + } else + iid_len = 0; + scsi_ulto2b(iid_len, pd->initiator_transportid_length); + pdc = (struct scsi_vpd_port_designation_cont *) + (&pd->initiator_transportid[iid_len]); + if (port->port_devid && g == pg) { + id_len = port->port_devid->len; + memcpy(pdc->target_port_descriptors, + port->port_devid->data, port->port_devid->len); + } else + id_len = 0; + scsi_ulto2b(id_len, pdc->target_port_descriptors_length); + pd = (struct scsi_vpd_port_designation *) + ((uint8_t *)pdc->target_port_descriptors + id_len); + } + } + mtx_unlock(&softc->ctl_lock); + + ctsio->scsi_status = SCSI_STATUS_OK; + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; ctsio->be_move_done = ctl_config_move_done; ctl_datamove((union ctl_io *)ctsio); @@ -9502,7 +10125,6 @@ ctl_inquiry_evpd_block_limits(struct ctl_scsiio *ctsio, int alloc_len) int bs; lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - bs = lun->be_lun->blocksize; ctsio->kern_data_ptr = malloc(sizeof(*bl_ptr), M_CTL, M_WAITOK | M_ZERO); bl_ptr = (struct scsi_vpd_block_limits *)ctsio->kern_data_ptr; @@ -9534,15 +10156,20 @@ ctl_inquiry_evpd_block_limits(struct ctl_scsiio *ctsio, int alloc_len) bl_ptr->page_code = SVPD_BLOCK_LIMITS; scsi_ulto2b(sizeof(*bl_ptr), bl_ptr->page_length); + bl_ptr->max_cmp_write_len = 0xff; scsi_ulto4b(0xffffffff, bl_ptr->max_txfer_len); - scsi_ulto4b(MAXPHYS / bs, bl_ptr->opt_txfer_len); - if (lun->be_lun->flags & CTL_LUN_FLAG_UNMAP) { - scsi_ulto4b(0xffffffff, bl_ptr->max_unmap_lba_cnt); - scsi_ulto4b(0xffffffff, bl_ptr->max_unmap_blk_cnt); + if (lun != NULL) { + bs = lun->be_lun->blocksize; + scsi_ulto4b(MAXPHYS / bs, bl_ptr->opt_txfer_len); + if (lun->be_lun->flags & CTL_LUN_FLAG_UNMAP) { + scsi_ulto4b(0xffffffff, bl_ptr->max_unmap_lba_cnt); + scsi_ulto4b(0xffffffff, bl_ptr->max_unmap_blk_cnt); + } } scsi_u64to8b(UINT64_MAX, bl_ptr->max_write_same_length); ctsio->scsi_status = SCSI_STATUS_OK; + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; ctsio->be_move_done = ctl_config_move_done; ctl_datamove((union ctl_io *)ctsio); @@ -9554,10 +10181,8 @@ ctl_inquiry_evpd_lbp(struct ctl_scsiio *ctsio, int alloc_len) { struct scsi_vpd_logical_block_prov *lbp_ptr; struct ctl_lun *lun; - int bs; lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - bs = lun->be_lun->blocksize; ctsio->kern_data_ptr = malloc(sizeof(*lbp_ptr), M_CTL, M_WAITOK | M_ZERO); lbp_ptr = (struct scsi_vpd_logical_block_prov *)ctsio->kern_data_ptr; @@ -9588,10 +10213,11 @@ ctl_inquiry_evpd_lbp(struct ctl_scsiio *ctsio, int alloc_len) lbp_ptr->device = (SID_QUAL_LU_OFFLINE << 5) | T_DIRECT; lbp_ptr->page_code = SVPD_LBP; - if (lun->be_lun->flags & CTL_LUN_FLAG_UNMAP) + if (lun != NULL && lun->be_lun->flags & CTL_LUN_FLAG_UNMAP) lbp_ptr->flags = SVPD_LBP_UNMAP | SVPD_LBP_WS16 | SVPD_LBP_WS10; ctsio->scsi_status = SCSI_STATUS_OK; + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; ctsio->be_move_done = ctl_config_move_done; ctl_datamove((union ctl_io *)ctsio); @@ -9622,6 +10248,12 @@ ctl_inquiry_evpd(struct ctl_scsiio *ctsio) case SVPD_DEVICE_ID: retval = ctl_inquiry_evpd_devid(ctsio, alloc_len); break; + case SVPD_SCSI_PORTS: + retval = ctl_inquiry_evpd_scsi_ports(ctsio, alloc_len); + break; + case SVPD_SCSI_TPC: + retval = ctl_inquiry_evpd_tpc(ctsio, alloc_len); + break; case SVPD_BLOCK_LIMITS: retval = ctl_inquiry_evpd_block_limits(ctsio, alloc_len); break; @@ -9650,8 +10282,9 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio) struct scsi_inquiry *cdb; struct ctl_softc *ctl_softc; struct ctl_lun *lun; + char *val; uint32_t alloc_len; - int is_fc; + ctl_port_type port_type; ctl_softc = control_softc; @@ -9660,13 +10293,10 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio) * We treat the ioctl front end, and any SCSI adapters, as packetized * SCSI front ends. */ - mtx_lock(&ctl_softc->ctl_lock); - if (ctl_softc->ctl_ports[ctl_port_idx(ctsio->io_hdr.nexus.targ_port)]->port_type != - CTL_PORT_FC) - is_fc = 0; - else - is_fc = 1; - mtx_unlock(&ctl_softc->ctl_lock); + port_type = ctl_softc->ctl_ports[ + ctl_port_idx(ctsio->io_hdr.nexus.targ_port)]->port_type; + if (port_type == CTL_PORT_IOCTL || port_type == CTL_PORT_INTERNAL) + port_type = CTL_PORT_SCSI; lun = ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_inquiry *)ctsio->cdb; @@ -9745,7 +10375,7 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio) inq_ptr->device = (SID_QUAL_BAD_LU << 5) | T_NODEVICE; /* RMB in byte 2 is 0 */ - inq_ptr->version = SCSI_REV_SPC3; + inq_ptr->version = SCSI_REV_SPC4; /* * According to SAM-3, even if a device only supports a single @@ -9770,17 +10400,18 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("additional_length = %d\n", inq_ptr->additional_length)); - inq_ptr->spc3_flags = SPC3_SID_TPGS_IMPLICIT; + inq_ptr->spc3_flags = SPC3_SID_3PC; + if (!ctl_is_single) + inq_ptr->spc3_flags |= SPC3_SID_TPGS_IMPLICIT; /* 16 bit addressing */ - if (is_fc == 0) + if (port_type == CTL_PORT_SCSI) inq_ptr->spc2_flags = SPC2_SID_ADDR16; /* XXX set the SID_MultiP bit here if we're actually going to respond on multiple ports */ inq_ptr->spc2_flags |= SPC2_SID_MultiP; /* 16 bit data bus, synchronous transfers */ - /* XXX these flags don't apply for FC */ - if (is_fc == 0) + if (port_type == CTL_PORT_SCSI) inq_ptr->flags = SID_WBus16 | SID_Sync; /* * XXX KDM do we want to support tagged queueing on the control @@ -9794,10 +10425,17 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio) * We have 8 bytes for the vendor name, and 16 bytes for the device * name and 4 bytes for the revision. */ - strncpy(inq_ptr->vendor, CTL_VENDOR, sizeof(inq_ptr->vendor)); + if (lun == NULL || (val = ctl_get_opt(&lun->be_lun->options, + "vendor")) == NULL) { + strcpy(inq_ptr->vendor, CTL_VENDOR); + } else { + memset(inq_ptr->vendor, ' ', sizeof(inq_ptr->vendor)); + strncpy(inq_ptr->vendor, val, + min(sizeof(inq_ptr->vendor), strlen(val))); + } if (lun == NULL) { strcpy(inq_ptr->product, CTL_DIRECT_PRODUCT); - } else { + } else if ((val = ctl_get_opt(&lun->be_lun->options, "product")) == NULL) { switch (lun->be_lun->lun_type) { case T_DIRECT: strcpy(inq_ptr->product, CTL_DIRECT_PRODUCT); @@ -9809,13 +10447,24 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio) strcpy(inq_ptr->product, CTL_UNKNOWN_PRODUCT); break; } + } else { + memset(inq_ptr->product, ' ', sizeof(inq_ptr->product)); + strncpy(inq_ptr->product, val, + min(sizeof(inq_ptr->product), strlen(val))); } /* * XXX make this a macro somewhere so it automatically gets * incremented when we make changes. */ - strncpy(inq_ptr->revision, "0001", sizeof(inq_ptr->revision)); + if (lun == NULL || (val = ctl_get_opt(&lun->be_lun->options, + "revision")) == NULL) { + strncpy(inq_ptr->revision, "0001", sizeof(inq_ptr->revision)); + } else { + memset(inq_ptr->revision, ' ', sizeof(inq_ptr->revision)); + strncpy(inq_ptr->revision, val, + min(sizeof(inq_ptr->revision), strlen(val))); + } /* * For parallel SCSI, we support double transition and single @@ -9823,33 +10472,36 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio) * and Selection) and Information Unit transfers on both the * control and array devices. */ - if (is_fc == 0) + if (port_type == CTL_PORT_SCSI) inq_ptr->spi3data = SID_SPI_CLOCK_DT_ST | SID_SPI_QAS | SID_SPI_IUS; - /* SAM-3 */ - scsi_ulto2b(0x0060, inq_ptr->version1); - /* SPC-3 (no version claimed) XXX should we claim a version? */ - scsi_ulto2b(0x0300, inq_ptr->version2); - if (is_fc) { + /* SAM-5 (no version claimed) */ + scsi_ulto2b(0x00A0, inq_ptr->version1); + /* SPC-4 (no version claimed) */ + scsi_ulto2b(0x0460, inq_ptr->version2); + if (port_type == CTL_PORT_FC) { /* FCP-2 ANSI INCITS.350:2003 */ scsi_ulto2b(0x0917, inq_ptr->version3); - } else { + } else if (port_type == CTL_PORT_SCSI) { /* SPI-4 ANSI INCITS.362:200x */ scsi_ulto2b(0x0B56, inq_ptr->version3); + } else if (port_type == CTL_PORT_ISCSI) { + /* iSCSI (no version claimed) */ + scsi_ulto2b(0x0960, inq_ptr->version3); + } else if (port_type == CTL_PORT_SAS) { + /* SAS (no version claimed) */ + scsi_ulto2b(0x0BE0, inq_ptr->version3); } if (lun == NULL) { - /* SBC-2 (no version claimed) XXX should we claim a version? */ - scsi_ulto2b(0x0320, inq_ptr->version4); + /* SBC-3 (no version claimed) */ + scsi_ulto2b(0x04C0, inq_ptr->version4); } else { switch (lun->be_lun->lun_type) { case T_DIRECT: - /* - * SBC-2 (no version claimed) XXX should we claim a - * version? - */ - scsi_ulto2b(0x0320, inq_ptr->version4); + /* SBC-3 (no version claimed) */ + scsi_ulto2b(0x04C0, inq_ptr->version4); break; case T_PROCESSOR: default: @@ -9859,6 +10511,7 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio) ctsio->scsi_status = SCSI_STATUS_OK; if (ctsio->kern_data_len > 0) { + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; ctsio->be_move_done = ctl_config_move_done; ctl_datamove((union ctl_io *)ctsio); } else { @@ -9928,6 +10581,15 @@ ctl_get_lba_len(union ctl_io *io, uint64_t *lba, uint32_t *len) return (1); switch (io->scsiio.cdb[0]) { + case COMPARE_AND_WRITE: { + struct scsi_compare_and_write *cdb; + + cdb = (struct scsi_compare_and_write *)io->scsiio.cdb; + + *lba = scsi_8btou64(cdb->addr); + *len = cdb->length; + break; + } case READ_6: case WRITE_6: { struct scsi_rw_6 *cdb; @@ -10016,6 +10678,33 @@ ctl_get_lba_len(union ctl_io *io, uint64_t *lba, uint32_t *len) *len = scsi_4btoul(cdb->length); break; } + case VERIFY_10: { + struct scsi_verify_10 *cdb; + + cdb = (struct scsi_verify_10 *)io->scsiio.cdb; + + *lba = scsi_4btoul(cdb->addr); + *len = scsi_2btoul(cdb->length); + break; + } + case VERIFY_12: { + struct scsi_verify_12 *cdb; + + cdb = (struct scsi_verify_12 *)io->scsiio.cdb; + + *lba = scsi_4btoul(cdb->addr); + *len = scsi_4btoul(cdb->length); + break; + } + case VERIFY_16: { + struct scsi_verify_16 *cdb; + + cdb = (struct scsi_verify_16 *)io->scsiio.cdb; + + *lba = scsi_8btou64(cdb->addr); + *len = scsi_4btoul(cdb->length); + break; + } default: return (1); break; /* NOTREACHED */ @@ -10060,7 +10749,7 @@ ctl_extent_check(union ctl_io *io1, union ctl_io *io2) static ctl_action ctl_check_for_blockage(union ctl_io *pending_io, union ctl_io *ooa_io) { - struct ctl_cmd_entry *pending_entry, *ooa_entry; + const struct ctl_cmd_entry *pending_entry, *ooa_entry; ctl_serialize_action *serialize_row; /* @@ -10133,8 +10822,8 @@ ctl_check_for_blockage(union ctl_io *pending_io, union ctl_io *ooa_io) || (ooa_io->scsiio.tag_type == CTL_TAG_ORDERED))) return (CTL_ACTION_BLOCK); - pending_entry = &ctl_cmd_table[pending_io->scsiio.cdb[0]]; - ooa_entry = &ctl_cmd_table[ooa_io->scsiio.cdb[0]]; + pending_entry = ctl_get_cmd_entry(&pending_io->scsiio); + ooa_entry = ctl_get_cmd_entry(&ooa_io->scsiio); serialize_row = ctl_serialize_table[ooa_entry->seridx]; @@ -10173,7 +10862,7 @@ ctl_check_ooa(struct ctl_lun *lun, union ctl_io *pending_io, union ctl_io *ooa_io; ctl_action action; - mtx_assert(&control_softc->ctl_lock, MA_OWNED); + mtx_assert(&lun->lun_lock, MA_OWNED); /* * Run back along the OOA queue, starting with the current @@ -10221,7 +10910,7 @@ ctl_check_blocked(struct ctl_lun *lun) { union ctl_io *cur_blocked, *next_blocked; - mtx_assert(&control_softc->ctl_lock, MA_OWNED); + mtx_assert(&lun->lun_lock, MA_OWNED); /* * Run forward from the head of the blocked queue, checking each @@ -10264,9 +10953,8 @@ ctl_check_blocked(struct ctl_lun *lun) case CTL_ACTION_PASS: case CTL_ACTION_SKIP: { struct ctl_softc *softc; - struct ctl_cmd_entry *entry; + const struct ctl_cmd_entry *entry; uint32_t initidx; - uint8_t opcode; int isc_retval; /* @@ -10303,8 +10991,7 @@ ctl_check_blocked(struct ctl_lun *lun) } break; } - opcode = cur_blocked->scsiio.cdb[0]; - entry = &ctl_cmd_table[opcode]; + entry = ctl_get_cmd_entry(&cur_blocked->scsiio); softc = control_softc; initidx = ctl_get_initindex(&cur_blocked->io_hdr.nexus); @@ -10321,28 +11008,9 @@ ctl_check_blocked(struct ctl_lun *lun) &cur_blocked->scsiio) == 0) { cur_blocked->io_hdr.flags |= CTL_FLAG_IS_WAS_ON_RTR; - STAILQ_INSERT_TAIL(&lun->ctl_softc->rtr_queue, - &cur_blocked->io_hdr, links); - /* - * In the non CTL_DONE_THREAD case, we need - * to wake up the work thread here. When - * we're processing completed requests from - * the work thread context, we'll pop back - * around and end up pulling things off the - * RtR queue. When we aren't processing - * things from the work thread context, - * though, we won't ever check the RtR queue. - * So we need to wake up the thread to clear - * things off the queue. Otherwise this - * transaction will just sit on the RtR queue - * until a new I/O comes in. (Which may or - * may not happen...) - */ -#ifndef CTL_DONE_THREAD - ctl_wakeup_thread(); -#endif + ctl_enqueue_rtr(cur_blocked); } else - ctl_done_lock(cur_blocked, /*have_lock*/ 1); + ctl_done(cur_blocked); break; } default: @@ -10371,12 +11039,14 @@ ctl_check_blocked(struct ctl_lun *lun) */ static int ctl_scsiio_lun_check(struct ctl_softc *ctl_softc, struct ctl_lun *lun, - struct ctl_cmd_entry *entry, struct ctl_scsiio *ctsio) + const struct ctl_cmd_entry *entry, struct ctl_scsiio *ctsio) { int retval; retval = 0; + mtx_assert(&lun->lun_lock, MA_OWNED); + /* * If this shelf is a secondary shelf controller, we have to reject * any media access commands. @@ -10468,7 +11138,7 @@ static void ctl_failover_io(union ctl_io *io, int have_lock) { ctl_set_busy(&io->scsiio); - ctl_done_lock(io, have_lock); + ctl_done(io); } static void @@ -10492,6 +11162,8 @@ ctl_failover(void) * We'll either abort them or delete them below, depending on * which HA mode we're in. */ +#ifdef notyet + mtx_lock(&ctl_softc->queue_lock); for (io = (union ctl_io *)STAILQ_FIRST(&ctl_softc->rtr_queue); io != NULL; io = next_io) { next_io = (union ctl_io *)STAILQ_NEXT(&io->io_hdr, links); @@ -10499,6 +11171,8 @@ ctl_failover(void) STAILQ_REMOVE(&ctl_softc->rtr_queue, &io->io_hdr, ctl_io_hdr, links); } + mtx_unlock(&ctl_softc->queue_lock); +#endif for (lun_idx=0; lun_idx < ctl_softc->num_luns; lun_idx++) { lun = ctl_softc->ctl_luns[lun_idx]; @@ -10606,8 +11280,7 @@ ctl_failover(void) CTL_FLAG_FAILOVER; } else { ctl_set_busy(&pending_io->scsiio); - ctl_done_lock(pending_io, - /*have_lock*/1); + ctl_done(pending_io); } } @@ -10615,7 +11288,7 @@ ctl_failover(void) * Build Unit Attention */ for (i = 0; i < CTL_MAX_INITIATORS; i++) { - lun->pending_sense[i].ua_pending |= + lun->pending_ua[i] |= CTL_UA_ASYM_ACC_CHANGE; } } else if (((lun->flags & CTL_LUN_PRIMARY_SC) == 0) @@ -10639,8 +11312,7 @@ ctl_failover(void) CTL_FLAG_IS_WAS_ON_RTR) == 0) { pending_io->io_hdr.flags |= CTL_FLAG_IS_WAS_ON_RTR; - STAILQ_INSERT_TAIL(&ctl_softc->rtr_queue, - &pending_io->io_hdr, links); + ctl_enqueue_rtr(pending_io); } #if 0 else @@ -10683,22 +11355,18 @@ ctl_failover(void) case CTL_ACTION_SKIP: pending_io->io_hdr.flags |= CTL_FLAG_IS_WAS_ON_RTR; - STAILQ_INSERT_TAIL( - &ctl_softc->rtr_queue, - &pending_io->io_hdr, links); + ctl_enqueue_rtr(pending_io); break; case CTL_ACTION_OVERLAP: ctl_set_overlapped_cmd( (struct ctl_scsiio *)pending_io); - ctl_done_lock(pending_io, - /*have_lock*/ 1); + ctl_done(pending_io); break; case CTL_ACTION_OVERLAP_TAG: ctl_set_overlapped_tag( (struct ctl_scsiio *)pending_io, pending_io->scsiio.tag_num & 0xff); - ctl_done_lock(pending_io, - /*have_lock*/ 1); + ctl_done(pending_io); break; case CTL_ACTION_ERROR: default: @@ -10706,8 +11374,7 @@ ctl_failover(void) (struct ctl_scsiio *)pending_io, 0, // sks_valid 0); //retry count - ctl_done_lock(pending_io, - /*have_lock*/ 1); + ctl_done(pending_io); break; } } @@ -10716,7 +11383,7 @@ ctl_failover(void) * Build Unit Attention */ for (i = 0; i < CTL_MAX_INITIATORS; i++) { - lun->pending_sense[i].ua_pending |= + lun->pending_ua[i] |= CTL_UA_ASYM_ACC_CHANGE; } } else { @@ -10732,8 +11399,7 @@ static int ctl_scsiio_precheck(struct ctl_softc *ctl_softc, struct ctl_scsiio *ctsio) { struct ctl_lun *lun; - struct ctl_cmd_entry *entry; - uint8_t opcode; + const struct ctl_cmd_entry *entry; uint32_t initidx, targ_lun; int retval; @@ -10741,13 +11407,7 @@ ctl_scsiio_precheck(struct ctl_softc *ctl_softc, struct ctl_scsiio *ctsio) lun = NULL; - opcode = ctsio->cdb[0]; - - mtx_lock(&ctl_softc->ctl_lock); - - targ_lun = ctsio->io_hdr.nexus.targ_lun; - if (ctsio->io_hdr.nexus.lun_map_fn != NULL) - targ_lun = ctsio->io_hdr.nexus.lun_map_fn(ctsio->io_hdr.nexus.lun_map_arg, targ_lun); + targ_lun = ctsio->io_hdr.nexus.targ_mapped_lun; if ((targ_lun < CTL_MAX_LUNS) && (ctl_softc->ctl_luns[targ_lun] != NULL)) { lun = ctl_softc->ctl_luns[targ_lun]; @@ -10765,13 +11425,27 @@ ctl_scsiio_precheck(struct ctl_softc *ctl_softc, struct ctl_scsiio *ctsio) if (lun->be_lun->lun_type == T_PROCESSOR) { ctsio->io_hdr.flags |= CTL_FLAG_CONTROL_DEV; } + + /* + * Every I/O goes into the OOA queue for a + * particular LUN, and stays there until completion. + */ + mtx_lock(&lun->lun_lock); + TAILQ_INSERT_TAIL(&lun->ooa_queue, &ctsio->io_hdr, + ooa_links); } } else { ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr = NULL; ctsio->io_hdr.ctl_private[CTL_PRIV_BACKEND_LUN].ptr = NULL; } - entry = &ctl_cmd_table[opcode]; + /* Get command entry and return error if it is unsuppotyed. */ + entry = ctl_validate_command(ctsio); + if (entry == NULL) { + if (lun) + mtx_unlock(&lun->lun_lock); + return (retval); + } ctsio->io_hdr.flags &= ~CTL_FLAG_DATA_MASK; ctsio->io_hdr.flags |= entry->flags & CTL_FLAG_DATA_MASK; @@ -10784,66 +11458,42 @@ ctl_scsiio_precheck(struct ctl_softc *ctl_softc, struct ctl_scsiio *ctsio) * it on the rtr queue. */ if (lun == NULL) { - if (entry->flags & CTL_CMD_FLAG_OK_ON_ALL_LUNS) - goto queue_rtr; + if (entry->flags & CTL_CMD_FLAG_OK_ON_ALL_LUNS) { + ctsio->io_hdr.flags |= CTL_FLAG_IS_WAS_ON_RTR; + ctl_enqueue_rtr((union ctl_io *)ctsio); + return (retval); + } ctl_set_unsupported_lun(ctsio); - mtx_unlock(&ctl_softc->ctl_lock); ctl_done((union ctl_io *)ctsio); CTL_DEBUG_PRINT(("ctl_scsiio_precheck: bailing out due to invalid LUN\n")); - goto bailout; + return (retval); } else { - /* - * Every I/O goes into the OOA queue for a particular LUN, and - * stays there until completion. - */ - TAILQ_INSERT_TAIL(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); - /* * Make sure we support this particular command on this LUN. * e.g., we don't support writes to the control LUN. */ - switch (lun->be_lun->lun_type) { - case T_PROCESSOR: - if (((entry->flags & CTL_CMD_FLAG_OK_ON_PROC) == 0) - && ((entry->flags & CTL_CMD_FLAG_OK_ON_ALL_LUNS) - == 0)) { - ctl_set_invalid_opcode(ctsio); - mtx_unlock(&ctl_softc->ctl_lock); - ctl_done((union ctl_io *)ctsio); - goto bailout; - } - break; - case T_DIRECT: - if (((entry->flags & CTL_CMD_FLAG_OK_ON_SLUN) == 0) - && ((entry->flags & CTL_CMD_FLAG_OK_ON_ALL_LUNS) - == 0)){ - ctl_set_invalid_opcode(ctsio); - mtx_unlock(&ctl_softc->ctl_lock); - ctl_done((union ctl_io *)ctsio); - goto bailout; - } - break; - default: - printf("Unsupported CTL LUN type %d\n", - lun->be_lun->lun_type); - panic("Unsupported CTL LUN type %d\n", - lun->be_lun->lun_type); - break; /* NOTREACHED */ + if (!ctl_cmd_applicable(lun->be_lun->lun_type, entry)) { + mtx_unlock(&lun->lun_lock); + ctl_set_invalid_opcode(ctsio); + ctl_done((union ctl_io *)ctsio); + return (retval); } } initidx = ctl_get_initindex(&ctsio->io_hdr.nexus); +#ifdef CTL_WITH_CA /* * If we've got a request sense, it'll clear the contingent * allegiance condition. Otherwise, if we have a CA condition for * this initiator, clear it, because it sent down a command other * than request sense. */ - if ((opcode != REQUEST_SENSE) + if ((ctsio->cdb[0] != REQUEST_SENSE) && (ctl_is_set(lun->have_ca, initidx))) ctl_clear_mask(lun->have_ca, initidx); +#endif /* * If the command has this flag set, it handles its own unit @@ -10870,7 +11520,7 @@ ctl_scsiio_precheck(struct ctl_softc *ctl_softc, struct ctl_scsiio *ctsio) if ((entry->flags & CTL_CMD_FLAG_NO_SENSE) == 0) { ctl_ua_type ua_type; - ua_type = lun->pending_sense[initidx].ua_pending; + ua_type = lun->pending_ua[initidx]; if (ua_type != CTL_UA_NONE) { scsi_sense_data_type sense_format; @@ -10888,20 +11538,19 @@ ctl_scsiio_precheck(struct ctl_softc *ctl_softc, struct ctl_scsiio *ctsio) ctsio->io_hdr.status = CTL_SCSI_ERROR | CTL_AUTOSENSE; ctsio->sense_len = SSD_FULL_SIZE; - lun->pending_sense[initidx].ua_pending &= - ~ua_type; - mtx_unlock(&ctl_softc->ctl_lock); + lun->pending_ua[initidx] &= ~ua_type; + mtx_unlock(&lun->lun_lock); ctl_done((union ctl_io *)ctsio); - goto bailout; + return (retval); } } } if (ctl_scsiio_lun_check(ctl_softc, lun, entry, ctsio) != 0) { - mtx_unlock(&ctl_softc->ctl_lock); + mtx_unlock(&lun->lun_lock); ctl_done((union ctl_io *)ctsio); - goto bailout; + return (retval); } /* @@ -10937,7 +11586,7 @@ ctl_scsiio_precheck(struct ctl_softc *ctl_softc, struct ctl_scsiio *ctsio) CTL_HA_STATUS_SUCCESS) { printf("CTL:precheck, ctl_ha_msg_send returned %d\n", isc_retval); - printf("CTL:opcode is %x\n",opcode); + printf("CTL:opcode is %x\n", ctsio->cdb[0]); } else { #if 0 printf("CTL:Precheck sent msg, opcode is %x\n",opcode); @@ -10951,7 +11600,8 @@ ctl_scsiio_precheck(struct ctl_softc *ctl_softc, struct ctl_scsiio *ctsio) * so that we have an idea of what we're waiting for from * the other side. */ - goto bailout_unlock; + mtx_unlock(&lun->lun_lock); + return (retval); } switch (ctl_check_ooa(lun, (union ctl_io *)ctsio, @@ -10961,59 +11611,115 @@ ctl_scsiio_precheck(struct ctl_softc *ctl_softc, struct ctl_scsiio *ctsio) ctsio->io_hdr.flags |= CTL_FLAG_BLOCKED; TAILQ_INSERT_TAIL(&lun->blocked_queue, &ctsio->io_hdr, blocked_links); - goto bailout_unlock; - break; /* NOTREACHED */ + mtx_unlock(&lun->lun_lock); + return (retval); case CTL_ACTION_PASS: case CTL_ACTION_SKIP: - goto queue_rtr; - break; /* NOTREACHED */ + ctsio->io_hdr.flags |= CTL_FLAG_IS_WAS_ON_RTR; + mtx_unlock(&lun->lun_lock); + ctl_enqueue_rtr((union ctl_io *)ctsio); + break; case CTL_ACTION_OVERLAP: + mtx_unlock(&lun->lun_lock); ctl_set_overlapped_cmd(ctsio); - mtx_unlock(&ctl_softc->ctl_lock); ctl_done((union ctl_io *)ctsio); - goto bailout; - break; /* NOTREACHED */ + break; case CTL_ACTION_OVERLAP_TAG: + mtx_unlock(&lun->lun_lock); ctl_set_overlapped_tag(ctsio, ctsio->tag_num & 0xff); - mtx_unlock(&ctl_softc->ctl_lock); ctl_done((union ctl_io *)ctsio); - goto bailout; - break; /* NOTREACHED */ + break; case CTL_ACTION_ERROR: default: + mtx_unlock(&lun->lun_lock); ctl_set_internal_failure(ctsio, /*sks_valid*/ 0, /*retry_count*/ 0); - mtx_unlock(&ctl_softc->ctl_lock); ctl_done((union ctl_io *)ctsio); - goto bailout; - break; /* NOTREACHED */ + break; } - - goto bailout_unlock; - -queue_rtr: - ctsio->io_hdr.flags |= CTL_FLAG_IS_WAS_ON_RTR; - STAILQ_INSERT_TAIL(&ctl_softc->rtr_queue, &ctsio->io_hdr, links); - -bailout_unlock: - mtx_unlock(&ctl_softc->ctl_lock); - -bailout: return (retval); } +const struct ctl_cmd_entry * +ctl_get_cmd_entry(struct ctl_scsiio *ctsio) +{ + const struct ctl_cmd_entry *entry; + int service_action; + + entry = &ctl_cmd_table[ctsio->cdb[0]]; + if (entry->flags & CTL_CMD_FLAG_SA5) { + service_action = ctsio->cdb[1] & SERVICE_ACTION_MASK; + entry = &((const struct ctl_cmd_entry *) + entry->execute)[service_action]; + } + return (entry); +} + +const struct ctl_cmd_entry * +ctl_validate_command(struct ctl_scsiio *ctsio) +{ + const struct ctl_cmd_entry *entry; + int i; + uint8_t diff; + + entry = ctl_get_cmd_entry(ctsio); + if (entry->execute == NULL) { + ctl_set_invalid_opcode(ctsio); + ctl_done((union ctl_io *)ctsio); + return (NULL); + } + KASSERT(entry->length > 0, + ("Not defined length for command 0x%02x/0x%02x", + ctsio->cdb[0], ctsio->cdb[1])); + for (i = 1; i < entry->length; i++) { + diff = ctsio->cdb[i] & ~entry->usage[i - 1]; + if (diff == 0) + continue; + ctl_set_invalid_field(ctsio, + /*sks_valid*/ 1, + /*command*/ 1, + /*field*/ i, + /*bit_valid*/ 1, + /*bit*/ fls(diff) - 1); + ctl_done((union ctl_io *)ctsio); + return (NULL); + } + return (entry); +} + +static int +ctl_cmd_applicable(uint8_t lun_type, const struct ctl_cmd_entry *entry) +{ + + switch (lun_type) { + case T_PROCESSOR: + if (((entry->flags & CTL_CMD_FLAG_OK_ON_PROC) == 0) && + ((entry->flags & CTL_CMD_FLAG_OK_ON_ALL_LUNS) == 0)) + return (0); + break; + case T_DIRECT: + if (((entry->flags & CTL_CMD_FLAG_OK_ON_SLUN) == 0) && + ((entry->flags & CTL_CMD_FLAG_OK_ON_ALL_LUNS) == 0)) + return (0); + break; + default: + return (0); + } + return (1); +} + static int ctl_scsiio(struct ctl_scsiio *ctsio) { int retval; - struct ctl_cmd_entry *entry; + const struct ctl_cmd_entry *entry; retval = CTL_RETVAL_COMPLETE; CTL_DEBUG_PRINT(("ctl_scsiio cdb[0]=%02X\n", ctsio->cdb[0])); - entry = &ctl_cmd_table[ctsio->cdb[0]]; + entry = ctl_get_cmd_entry(ctsio); /* * If this I/O has been aborted, just send it straight to @@ -11069,8 +11775,10 @@ ctl_target_reset(struct ctl_softc *ctl_softc, union ctl_io *io, } retval = 0; + mtx_lock(&ctl_softc->ctl_lock); STAILQ_FOREACH(lun, &ctl_softc->lun_list, links) retval += ctl_lun_reset(lun, io, ua_type); + mtx_unlock(&ctl_softc->ctl_lock); return (retval); } @@ -11105,6 +11813,7 @@ ctl_lun_reset(struct ctl_lun *lun, union ctl_io *io, ctl_ua_type ua_type) #endif int i; + mtx_lock(&lun->lun_lock); /* * Run through the OOA queue and abort each I/O. */ @@ -11113,7 +11822,7 @@ ctl_lun_reset(struct ctl_lun *lun, union ctl_io *io, ctl_ua_type ua_type) #endif for (xio = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); xio != NULL; xio = (union ctl_io *)TAILQ_NEXT(&xio->io_hdr, ooa_links)) { - xio->io_hdr.flags |= CTL_FLAG_ABORT; + xio->io_hdr.flags |= CTL_FLAG_ABORT | CTL_FLAG_ABORT_STATUS; } /* @@ -11124,7 +11833,7 @@ ctl_lun_reset(struct ctl_lun *lun, union ctl_io *io, ctl_ua_type ua_type) for (i = 0; i < CTL_MAX_INITIATORS; i++) { if (initindex == i) continue; - lun->pending_sense[i].ua_pending |= ua_type; + lun->pending_ua[i] |= ua_type; } #endif @@ -11139,10 +11848,116 @@ ctl_lun_reset(struct ctl_lun *lun, union ctl_io *io, ctl_ua_type ua_type) lun->flags &= ~CTL_LUN_RESERVED; for (i = 0; i < CTL_MAX_INITIATORS; i++) { +#ifdef CTL_WITH_CA ctl_clear_mask(lun->have_ca, i); - lun->pending_sense[i].ua_pending |= ua_type; +#endif + lun->pending_ua[i] |= ua_type; + } + mtx_unlock(&lun->lun_lock); + + return (0); +} + +static int +ctl_abort_tasks_lun(struct ctl_lun *lun, uint32_t targ_port, uint32_t init_id, + int other_sc) +{ + union ctl_io *xio; + int found; + + mtx_assert(&lun->lun_lock, MA_OWNED); + + /* + * Run through the OOA queue and attempt to find the given I/O. + * The target port, initiator ID, tag type and tag number have to + * match the values that we got from the initiator. If we have an + * untagged command to abort, simply abort the first untagged command + * we come to. We only allow one untagged command at a time of course. + */ + for (xio = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); xio != NULL; + xio = (union ctl_io *)TAILQ_NEXT(&xio->io_hdr, ooa_links)) { + + if ((targ_port == UINT32_MAX || + targ_port == xio->io_hdr.nexus.targ_port) && + (init_id == UINT32_MAX || + init_id == xio->io_hdr.nexus.initid.id)) { + if (targ_port != xio->io_hdr.nexus.targ_port || + init_id != xio->io_hdr.nexus.initid.id) + xio->io_hdr.flags |= CTL_FLAG_ABORT_STATUS; + xio->io_hdr.flags |= CTL_FLAG_ABORT; + found = 1; + if (!other_sc && !(lun->flags & CTL_LUN_PRIMARY_SC)) { + union ctl_ha_msg msg_info; + + msg_info.hdr.nexus = xio->io_hdr.nexus; + msg_info.task.task_action = CTL_TASK_ABORT_TASK; + msg_info.task.tag_num = xio->scsiio.tag_num; + msg_info.task.tag_type = xio->scsiio.tag_type; + msg_info.hdr.msg_type = CTL_MSG_MANAGE_TASKS; + msg_info.hdr.original_sc = NULL; + msg_info.hdr.serializing_sc = NULL; + ctl_ha_msg_send(CTL_HA_CHAN_CTL, + (void *)&msg_info, sizeof(msg_info), 0); + } + } + } + return (found); +} + +static int +ctl_abort_task_set(union ctl_io *io) +{ + struct ctl_softc *softc = control_softc; + struct ctl_lun *lun; + uint32_t targ_lun; + + /* + * Look up the LUN. + */ + targ_lun = io->io_hdr.nexus.targ_mapped_lun; + mtx_lock(&softc->ctl_lock); + if ((targ_lun < CTL_MAX_LUNS) && (softc->ctl_luns[targ_lun] != NULL)) + lun = softc->ctl_luns[targ_lun]; + else { + mtx_unlock(&softc->ctl_lock); + return (1); } + mtx_lock(&lun->lun_lock); + mtx_unlock(&softc->ctl_lock); + if (io->taskio.task_action == CTL_TASK_ABORT_TASK_SET) { + ctl_abort_tasks_lun(lun, io->io_hdr.nexus.targ_port, + io->io_hdr.nexus.initid.id, + (io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC) != 0); + } else { /* CTL_TASK_CLEAR_TASK_SET */ + ctl_abort_tasks_lun(lun, UINT32_MAX, UINT32_MAX, + (io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC) != 0); + } + mtx_unlock(&lun->lun_lock); + return (0); +} + +static int +ctl_i_t_nexus_reset(union ctl_io *io) +{ + struct ctl_softc *softc = control_softc; + struct ctl_lun *lun; + uint32_t initindex; + + initindex = ctl_get_initindex(&io->io_hdr.nexus); + mtx_lock(&softc->ctl_lock); + STAILQ_FOREACH(lun, &softc->lun_list, links) { + mtx_lock(&lun->lun_lock); + ctl_abort_tasks_lun(lun, io->io_hdr.nexus.targ_port, + io->io_hdr.nexus.initid.id, + (io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC) != 0); +#ifdef CTL_WITH_CA + ctl_clear_mask(lun->have_ca, initindex); +#endif + lun->pending_ua[initindex] |= CTL_UA_I_T_NEXUS_LOSS; + mtx_unlock(&lun->lun_lock); + } + mtx_unlock(&softc->ctl_lock); return (0); } @@ -11165,20 +11980,23 @@ ctl_abort_task(union ctl_io *io) /* * Look up the LUN. */ - targ_lun = io->io_hdr.nexus.targ_lun; - if (io->io_hdr.nexus.lun_map_fn != NULL) - targ_lun = io->io_hdr.nexus.lun_map_fn(io->io_hdr.nexus.lun_map_arg, targ_lun); + targ_lun = io->io_hdr.nexus.targ_mapped_lun; + mtx_lock(&ctl_softc->ctl_lock); if ((targ_lun < CTL_MAX_LUNS) && (ctl_softc->ctl_luns[targ_lun] != NULL)) lun = ctl_softc->ctl_luns[targ_lun]; - else - goto bailout; + else { + mtx_unlock(&ctl_softc->ctl_lock); + return (1); + } #if 0 printf("ctl_abort_task: called for lun %lld, tag %d type %d\n", lun->lun, io->taskio.tag_num, io->taskio.tag_type); #endif + mtx_lock(&lun->lun_lock); + mtx_unlock(&ctl_softc->ctl_lock); /* * Run through the OOA queue and attempt to find the given I/O. * The target port, initiator ID, tag type and tag number have to @@ -11270,8 +12088,7 @@ ctl_abort_task(union ctl_io *io) } } } - -bailout: + mtx_unlock(&lun->lun_lock); if (found == 0) { /* @@ -11288,166 +12105,123 @@ ctl_abort_task(union ctl_io *io) io->io_hdr.nexus.targ_lun, io->taskio.tag_num, io->taskio.tag_type); #endif - return (1); - } else - return (0); + } + return (0); } -/* - * This routine cannot block! It must be callable from an interrupt - * handler as well as from the work thread. - */ static void -ctl_run_task_queue(struct ctl_softc *ctl_softc) +ctl_run_task(union ctl_io *io) { - union ctl_io *io, *next_io; + struct ctl_softc *ctl_softc = control_softc; + int retval = 1; + const char *task_desc; - mtx_assert(&ctl_softc->ctl_lock, MA_OWNED); + CTL_DEBUG_PRINT(("ctl_run_task\n")); - CTL_DEBUG_PRINT(("ctl_run_task_queue\n")); + KASSERT(io->io_hdr.io_type == CTL_IO_TASK, + ("ctl_run_task: Unextected io_type %d\n", + io->io_hdr.io_type)); - for (io = (union ctl_io *)STAILQ_FIRST(&ctl_softc->task_queue); - io != NULL; io = next_io) { - int retval; - const char *task_desc; - - next_io = (union ctl_io *)STAILQ_NEXT(&io->io_hdr, links); - - retval = 0; - - switch (io->io_hdr.io_type) { - case CTL_IO_TASK: { - task_desc = ctl_scsi_task_string(&io->taskio); - if (task_desc != NULL) { + task_desc = ctl_scsi_task_string(&io->taskio); + if (task_desc != NULL) { #ifdef NEEDTOPORT - csevent_log(CSC_CTL | CSC_SHELF_SW | - CTL_TASK_REPORT, - csevent_LogType_Trace, - csevent_Severity_Information, - csevent_AlertLevel_Green, - csevent_FRU_Firmware, - csevent_FRU_Unknown, - "CTL: received task: %s",task_desc); + csevent_log(CSC_CTL | CSC_SHELF_SW | + CTL_TASK_REPORT, + csevent_LogType_Trace, + csevent_Severity_Information, + csevent_AlertLevel_Green, + csevent_FRU_Firmware, + csevent_FRU_Unknown, + "CTL: received task: %s",task_desc); #endif - } else { + } else { #ifdef NEEDTOPORT - csevent_log(CSC_CTL | CSC_SHELF_SW | - CTL_TASK_REPORT, - csevent_LogType_Trace, - csevent_Severity_Information, - csevent_AlertLevel_Green, - csevent_FRU_Firmware, - csevent_FRU_Unknown, - "CTL: received unknown task " - "type: %d (%#x)", - io->taskio.task_action, - io->taskio.task_action); + csevent_log(CSC_CTL | CSC_SHELF_SW | + CTL_TASK_REPORT, + csevent_LogType_Trace, + csevent_Severity_Information, + csevent_AlertLevel_Green, + csevent_FRU_Firmware, + csevent_FRU_Unknown, + "CTL: received unknown task " + "type: %d (%#x)", + io->taskio.task_action, + io->taskio.task_action); #endif - } - switch (io->taskio.task_action) { - case CTL_TASK_ABORT_TASK: - retval = ctl_abort_task(io); - break; - case CTL_TASK_ABORT_TASK_SET: - break; - case CTL_TASK_CLEAR_ACA: - break; - case CTL_TASK_CLEAR_TASK_SET: - break; - case CTL_TASK_LUN_RESET: { - struct ctl_lun *lun; - uint32_t targ_lun; - int retval; - - targ_lun = io->io_hdr.nexus.targ_lun; - if (io->io_hdr.nexus.lun_map_fn != NULL) - targ_lun = io->io_hdr.nexus.lun_map_fn(io->io_hdr.nexus.lun_map_arg, targ_lun); - - if ((targ_lun < CTL_MAX_LUNS) - && (ctl_softc->ctl_luns[targ_lun] != NULL)) - lun = ctl_softc->ctl_luns[targ_lun]; - else { - retval = 1; - break; - } - - if (!(io->io_hdr.flags & - CTL_FLAG_FROM_OTHER_SC)) { - union ctl_ha_msg msg_info; - - io->io_hdr.flags |= - CTL_FLAG_SENT_2OTHER_SC; - msg_info.hdr.msg_type = - CTL_MSG_MANAGE_TASKS; - msg_info.hdr.nexus = io->io_hdr.nexus; - msg_info.task.task_action = - CTL_TASK_LUN_RESET; - msg_info.hdr.original_sc = NULL; - msg_info.hdr.serializing_sc = NULL; - if (CTL_HA_STATUS_SUCCESS != - ctl_ha_msg_send(CTL_HA_CHAN_CTL, - (void *)&msg_info, - sizeof(msg_info), 0)) { - } - } - - retval = ctl_lun_reset(lun, io, - CTL_UA_LUN_RESET); - break; - } - case CTL_TASK_TARGET_RESET: - retval = ctl_target_reset(ctl_softc, io, - CTL_UA_TARG_RESET); - break; - case CTL_TASK_BUS_RESET: - retval = ctl_bus_reset(ctl_softc, io); - break; - case CTL_TASK_PORT_LOGIN: - break; - case CTL_TASK_PORT_LOGOUT: - break; - default: - printf("ctl_run_task_queue: got unknown task " - "management event %d\n", - io->taskio.task_action); - break; - } - if (retval == 0) - io->io_hdr.status = CTL_SUCCESS; - else - io->io_hdr.status = CTL_ERROR; - - STAILQ_REMOVE(&ctl_softc->task_queue, &io->io_hdr, - ctl_io_hdr, links); - /* - * This will queue this I/O to the done queue, but the - * work thread won't be able to process it until we - * return and the lock is released. - */ - ctl_done_lock(io, /*have_lock*/ 1); - break; - } - default: { - - printf("%s: invalid I/O type %d msg %d cdb %x" - " iptl: %ju:%d:%ju:%d tag 0x%04x\n", - __func__, io->io_hdr.io_type, - io->io_hdr.msg_type, io->scsiio.cdb[0], - (uintmax_t)io->io_hdr.nexus.initid.id, - io->io_hdr.nexus.targ_port, - (uintmax_t)io->io_hdr.nexus.targ_target.id, - io->io_hdr.nexus.targ_lun /* XXX */, - (io->io_hdr.io_type == CTL_IO_TASK) ? - io->taskio.tag_num : io->scsiio.tag_num); - STAILQ_REMOVE(&ctl_softc->task_queue, &io->io_hdr, - ctl_io_hdr, links); - ctl_free_io(io); - break; - } - } } + switch (io->taskio.task_action) { + case CTL_TASK_ABORT_TASK: + retval = ctl_abort_task(io); + break; + case CTL_TASK_ABORT_TASK_SET: + case CTL_TASK_CLEAR_TASK_SET: + retval = ctl_abort_task_set(io); + break; + case CTL_TASK_CLEAR_ACA: + break; + case CTL_TASK_I_T_NEXUS_RESET: + retval = ctl_i_t_nexus_reset(io); + break; + case CTL_TASK_LUN_RESET: { + struct ctl_lun *lun; + uint32_t targ_lun; - ctl_softc->flags &= ~CTL_FLAG_TASK_PENDING; + targ_lun = io->io_hdr.nexus.targ_mapped_lun; + mtx_lock(&ctl_softc->ctl_lock); + if ((targ_lun < CTL_MAX_LUNS) + && (ctl_softc->ctl_luns[targ_lun] != NULL)) + lun = ctl_softc->ctl_luns[targ_lun]; + else { + mtx_unlock(&ctl_softc->ctl_lock); + retval = 1; + break; + } + + if (!(io->io_hdr.flags & + CTL_FLAG_FROM_OTHER_SC)) { + union ctl_ha_msg msg_info; + + io->io_hdr.flags |= + CTL_FLAG_SENT_2OTHER_SC; + msg_info.hdr.msg_type = + CTL_MSG_MANAGE_TASKS; + msg_info.hdr.nexus = io->io_hdr.nexus; + msg_info.task.task_action = + CTL_TASK_LUN_RESET; + msg_info.hdr.original_sc = NULL; + msg_info.hdr.serializing_sc = NULL; + if (CTL_HA_STATUS_SUCCESS != + ctl_ha_msg_send(CTL_HA_CHAN_CTL, + (void *)&msg_info, + sizeof(msg_info), 0)) { + } + } + + retval = ctl_lun_reset(lun, io, + CTL_UA_LUN_RESET); + mtx_unlock(&ctl_softc->ctl_lock); + break; + } + case CTL_TASK_TARGET_RESET: + retval = ctl_target_reset(ctl_softc, io, CTL_UA_TARG_RESET); + break; + case CTL_TASK_BUS_RESET: + retval = ctl_bus_reset(ctl_softc, io); + break; + case CTL_TASK_PORT_LOGIN: + break; + case CTL_TASK_PORT_LOGOUT: + break; + default: + printf("ctl_run_task: got unknown task management event %d\n", + io->taskio.task_action); + break; + } + if (retval == 0) + io->io_hdr.status = CTL_SUCCESS; + else + io->io_hdr.status = CTL_ERROR; + ctl_done(io); } /* @@ -11464,52 +12238,44 @@ ctl_handle_isc(union ctl_io *io) ctl_softc = control_softc; - targ_lun = io->io_hdr.nexus.targ_lun; - if (io->io_hdr.nexus.lun_map_fn != NULL) - targ_lun = io->io_hdr.nexus.lun_map_fn(io->io_hdr.nexus.lun_map_arg, targ_lun); + targ_lun = io->io_hdr.nexus.targ_mapped_lun; lun = ctl_softc->ctl_luns[targ_lun]; switch (io->io_hdr.msg_type) { case CTL_MSG_SERIALIZE: - free_io = ctl_serialize_other_sc_cmd(&io->scsiio, - /*have_lock*/ 0); + free_io = ctl_serialize_other_sc_cmd(&io->scsiio); break; case CTL_MSG_R2R: { - uint8_t opcode; - struct ctl_cmd_entry *entry; + const struct ctl_cmd_entry *entry; /* * This is only used in SER_ONLY mode. */ free_io = 0; - opcode = io->scsiio.cdb[0]; - entry = &ctl_cmd_table[opcode]; - mtx_lock(&ctl_softc->ctl_lock); + entry = ctl_get_cmd_entry(&io->scsiio); + mtx_lock(&lun->lun_lock); if (ctl_scsiio_lun_check(ctl_softc, lun, entry, (struct ctl_scsiio *)io) != 0) { - ctl_done_lock(io, /*have_lock*/ 1); - mtx_unlock(&ctl_softc->ctl_lock); + mtx_unlock(&lun->lun_lock); + ctl_done(io); break; } io->io_hdr.flags |= CTL_FLAG_IS_WAS_ON_RTR; - STAILQ_INSERT_TAIL(&ctl_softc->rtr_queue, - &io->io_hdr, links); - mtx_unlock(&ctl_softc->ctl_lock); + mtx_unlock(&lun->lun_lock); + ctl_enqueue_rtr(io); break; } case CTL_MSG_FINISH_IO: if (ctl_softc->ha_mode == CTL_HA_MODE_XFER) { free_io = 0; - ctl_done_lock(io, /*have_lock*/ 0); + ctl_done(io); } else { free_io = 1; - mtx_lock(&ctl_softc->ctl_lock); + mtx_lock(&lun->lun_lock); TAILQ_REMOVE(&lun->ooa_queue, &io->io_hdr, ooa_links); - STAILQ_REMOVE(&ctl_softc->task_queue, - &io->io_hdr, ctl_io_hdr, links); ctl_check_blocked(lun); - mtx_unlock(&ctl_softc->ctl_lock); + mtx_unlock(&lun->lun_lock); } break; case CTL_MSG_PERS_ACTION: @@ -11519,7 +12285,7 @@ ctl_handle_isc(union ctl_io *io) break; case CTL_MSG_BAD_JUJU: free_io = 0; - ctl_done_lock(io, /*have_lock*/ 0); + ctl_done(io); break; case CTL_MSG_DATAMOVE: /* Only used in XFER mode */ @@ -11550,9 +12316,8 @@ ctl_handle_isc(union ctl_io *io) static ctl_lun_error_pattern ctl_cmd_pattern_match(struct ctl_scsiio *ctsio, struct ctl_error_desc *desc) { - struct ctl_cmd_entry *entry; + const struct ctl_cmd_entry *entry; ctl_lun_error_pattern filtered_pattern, pattern; - uint8_t opcode; pattern = desc->error_pattern; @@ -11567,8 +12332,7 @@ ctl_cmd_pattern_match(struct ctl_scsiio *ctsio, struct ctl_error_desc *desc) if ((pattern & CTL_LUN_PAT_MASK) == CTL_LUN_PAT_ANY) return (CTL_LUN_PAT_ANY); - opcode = ctsio->cdb[0]; - entry = &ctl_cmd_table[opcode]; + entry = ctl_get_cmd_entry(ctsio); filtered_pattern = entry->pattern & pattern; @@ -11616,7 +12380,7 @@ ctl_inject_error(struct ctl_lun *lun, union ctl_io *io) { struct ctl_error_desc *desc, *desc2; - mtx_assert(&control_softc->ctl_lock, MA_OWNED); + mtx_assert(&lun->lun_lock, MA_OWNED); STAILQ_FOREACH_SAFE(desc, &lun->error_list, links, desc2) { ctl_lun_error_pattern pattern; @@ -11732,7 +12496,6 @@ ctl_datamove(union ctl_io *io) } #endif /* CTL_TIME_IO */ - mtx_lock(&control_softc->ctl_lock); #ifdef CTL_IO_DELAY if (io->io_hdr.flags & CTL_FLAG_DELAY_DONE) { struct ctl_lun *lun; @@ -11757,31 +12520,10 @@ ctl_datamove(union ctl_io *io) if (lun->delay_info.datamove_type == CTL_DELAY_TYPE_ONESHOT) lun->delay_info.datamove_delay = 0; - mtx_unlock(&control_softc->ctl_lock); return; } } #endif - /* - * If we have any pending task management commands, process them - * first. This is necessary to eliminate a race condition with the - * FETD: - * - * - FETD submits a task management command, like an abort. - * - Back end calls fe_datamove() to move the data for the aborted - * command. The FETD can't really accept it, but if it did, it - * would end up transmitting data for a command that the initiator - * told us to abort. - * - * We close the race by processing all pending task management - * commands here (we can't block!), and then check this I/O to see - * if it has been aborted. If so, return it to the back end with - * bad status, so the back end can say return an error to the back end - * and then when the back end returns an error, we can return the - * aborted command to the FETD, so it can clean up its resources. - */ - if (control_softc->flags & CTL_FLAG_TASK_PENDING) - ctl_run_task_queue(control_softc); /* * This command has been aborted. Set the port status, so we fail @@ -11793,9 +12535,7 @@ ctl_datamove(union ctl_io *io) io->io_hdr.nexus.targ_port, (uintmax_t)io->io_hdr.nexus.targ_target.id, io->io_hdr.nexus.targ_lun); - io->io_hdr.status = CTL_CMD_ABORTED; io->io_hdr.port_status = 31337; - mtx_unlock(&control_softc->ctl_lock); /* * Note that the backend, in this case, will get the * callback in its context. In other cases it may get @@ -11961,7 +12701,7 @@ ctl_datamove(union ctl_io *io) } io->io_hdr.flags &= ~CTL_FLAG_IO_ACTIVE; if (io->io_hdr.flags & CTL_FLAG_FAILOVER) - ctl_failover_io(io, /*have_lock*/ 1); + ctl_failover_io(io, /*have_lock*/ 0); } else { @@ -11971,7 +12711,6 @@ ctl_datamove(union ctl_io *io) */ fe_datamove = control_softc->ctl_ports[ctl_port_idx(io->io_hdr.nexus.targ_port)]->fe_datamove; - mtx_unlock(&control_softc->ctl_lock); fe_datamove(io); } @@ -12551,36 +13290,24 @@ ctl_datamove_remote(union ctl_io *io) /* * Note that we look for an aborted I/O here, but don't do some of - * the other checks that ctl_datamove() normally does. We don't - * need to run the task queue, because this I/O is on the ISC - * queue, which is executed by the work thread after the task queue. + * the other checks that ctl_datamove() normally does. * We don't need to run the datamove delay code, since that should * have been done if need be on the other controller. */ - mtx_lock(&softc->ctl_lock); - if (io->io_hdr.flags & CTL_FLAG_ABORT) { - printf("%s: tag 0x%04x on (%d:%d:%d:%d) aborted\n", __func__, io->scsiio.tag_num, io->io_hdr.nexus.initid.id, io->io_hdr.nexus.targ_port, io->io_hdr.nexus.targ_target.id, io->io_hdr.nexus.targ_lun); - io->io_hdr.status = CTL_CMD_ABORTED; io->io_hdr.port_status = 31338; - - mtx_unlock(&softc->ctl_lock); - ctl_send_datamove_done(io, /*have_lock*/ 0); - return; } if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT) { - mtx_unlock(&softc->ctl_lock); ctl_datamove_remote_write(io); } else if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_IN){ - mtx_unlock(&softc->ctl_lock); ctl_datamove_remote_read(io); } else { union ctl_ha_msg msg; @@ -12616,12 +13343,9 @@ ctl_datamove_remote(union ctl_io *io) io->io_hdr.flags &= ~CTL_FLAG_IO_ACTIVE; if (io->io_hdr.flags & CTL_FLAG_FAILOVER) { ctl_failover_io(io, /*have_lock*/ 1); - mtx_unlock(&softc->ctl_lock); return; } - mtx_unlock(&softc->ctl_lock); - if (ctl_ha_msg_send(CTL_HA_CHAN_CTL, &msg, sizeof(msg), 0) > CTL_HA_STATUS_SUCCESS) { /* XXX KDM what to do if this fails? */ @@ -12632,7 +13356,7 @@ ctl_datamove_remote(union ctl_io *io) } static int -ctl_process_done(union ctl_io *io, int have_lock) +ctl_process_done(union ctl_io *io) { struct ctl_lun *lun; struct ctl_softc *ctl_softc; @@ -12703,17 +13427,13 @@ ctl_process_done(union ctl_io *io, int have_lock) lun = (struct ctl_lun *)io->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; if (lun == NULL) { CTL_DEBUG_PRINT(("NULL LUN for lun %d\n", - io->io_hdr.nexus.targ_lun)); + io->io_hdr.nexus.targ_mapped_lun)); fe_done(io); goto bailout; } ctl_softc = lun->ctl_softc; - /* - * Remove this from the OOA queue. - */ - if (have_lock == 0) - mtx_lock(&ctl_softc->ctl_lock); + mtx_lock(&lun->lun_lock); /* * Check to see if we have any errors to inject here. We only @@ -12729,134 +13449,39 @@ ctl_process_done(union ctl_io *io, int have_lock) * * XXX KDM should we also track I/O latency? */ - if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS) { - uint32_t blocksize; + if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS && + io->io_hdr.io_type == CTL_IO_SCSI) { #ifdef CTL_TIME_IO struct bintime cur_bt; #endif + int type; - if ((lun->be_lun != NULL) - && (lun->be_lun->blocksize != 0)) - blocksize = lun->be_lun->blocksize; + if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == + CTL_FLAG_DATA_IN) + type = CTL_STATS_READ; + else if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == + CTL_FLAG_DATA_OUT) + type = CTL_STATS_WRITE; else - blocksize = 512; - - switch (io->io_hdr.io_type) { - case CTL_IO_SCSI: { - int isread; - struct ctl_lba_len lbalen; - - isread = 0; - switch (io->scsiio.cdb[0]) { - case READ_6: - case READ_10: - case READ_12: - case READ_16: - isread = 1; - /* FALLTHROUGH */ - case WRITE_6: - case WRITE_10: - case WRITE_12: - case WRITE_16: - case WRITE_VERIFY_10: - case WRITE_VERIFY_12: - case WRITE_VERIFY_16: - memcpy(&lbalen, io->io_hdr.ctl_private[ - CTL_PRIV_LBA_LEN].bytes, sizeof(lbalen)); - - if (isread) { - lun->stats.ports[targ_port].bytes[CTL_STATS_READ] += - lbalen.len * blocksize; - lun->stats.ports[targ_port].operations[CTL_STATS_READ]++; + type = CTL_STATS_NO_IO; + lun->stats.ports[targ_port].bytes[type] += + io->scsiio.kern_total_len; + lun->stats.ports[targ_port].operations[type]++; #ifdef CTL_TIME_IO - bintime_add( - &lun->stats.ports[targ_port].dma_time[CTL_STATS_READ], - &io->io_hdr.dma_bt); - lun->stats.ports[targ_port].num_dmas[CTL_STATS_READ] += - io->io_hdr.num_dmas; - getbintime(&cur_bt); - bintime_sub(&cur_bt, - &io->io_hdr.start_bt); - - bintime_add( - &lun->stats.ports[targ_port].time[CTL_STATS_READ], - &cur_bt); - -#if 0 - cs_prof_gettime(&cur_ticks); - lun->stats.time[CTL_STATS_READ] += - cur_ticks - - io->io_hdr.start_ticks; + bintime_add(&lun->stats.ports[targ_port].dma_time[type], + &io->io_hdr.dma_bt); + lun->stats.ports[targ_port].num_dmas[type] += + io->io_hdr.num_dmas; + getbintime(&cur_bt); + bintime_sub(&cur_bt, &io->io_hdr.start_bt); + bintime_add(&lun->stats.ports[targ_port].time[type], &cur_bt); #endif -#if 0 - lun->stats.time[CTL_STATS_READ] += - jiffies - io->io_hdr.start_time; -#endif -#endif /* CTL_TIME_IO */ - } else { - lun->stats.ports[targ_port].bytes[CTL_STATS_WRITE] += - lbalen.len * blocksize; - lun->stats.ports[targ_port].operations[ - CTL_STATS_WRITE]++; - -#ifdef CTL_TIME_IO - bintime_add( - &lun->stats.ports[targ_port].dma_time[CTL_STATS_WRITE], - &io->io_hdr.dma_bt); - lun->stats.ports[targ_port].num_dmas[CTL_STATS_WRITE] += - io->io_hdr.num_dmas; - getbintime(&cur_bt); - bintime_sub(&cur_bt, - &io->io_hdr.start_bt); - - bintime_add( - &lun->stats.ports[targ_port].time[CTL_STATS_WRITE], - &cur_bt); -#if 0 - cs_prof_gettime(&cur_ticks); - lun->stats.ports[targ_port].time[CTL_STATS_WRITE] += - cur_ticks - - io->io_hdr.start_ticks; - lun->stats.ports[targ_port].time[CTL_STATS_WRITE] += - jiffies - io->io_hdr.start_time; -#endif -#endif /* CTL_TIME_IO */ - } - break; - default: - lun->stats.ports[targ_port].operations[CTL_STATS_NO_IO]++; - -#ifdef CTL_TIME_IO - bintime_add( - &lun->stats.ports[targ_port].dma_time[CTL_STATS_NO_IO], - &io->io_hdr.dma_bt); - lun->stats.ports[targ_port].num_dmas[CTL_STATS_NO_IO] += - io->io_hdr.num_dmas; - getbintime(&cur_bt); - bintime_sub(&cur_bt, &io->io_hdr.start_bt); - - bintime_add(&lun->stats.ports[targ_port].time[CTL_STATS_NO_IO], - &cur_bt); - -#if 0 - cs_prof_gettime(&cur_ticks); - lun->stats.ports[targ_port].time[CTL_STATS_NO_IO] += - cur_ticks - - io->io_hdr.start_ticks; - lun->stats.ports[targ_port].time[CTL_STATS_NO_IO] += - jiffies - io->io_hdr.start_time; -#endif -#endif /* CTL_TIME_IO */ - break; - } - break; - } - default: - break; - } } + /* + * Remove this from the OOA queue. + */ TAILQ_REMOVE(&lun->ooa_queue, &io->io_hdr, ooa_links); /* @@ -12870,8 +13495,13 @@ ctl_process_done(union ctl_io *io, int have_lock) * left on its OOA queue. */ if ((lun->flags & CTL_LUN_INVALID) - && (TAILQ_FIRST(&lun->ooa_queue) == NULL)) + && TAILQ_EMPTY(&lun->ooa_queue)) { + mtx_unlock(&lun->lun_lock); + mtx_lock(&ctl_softc->ctl_lock); ctl_free_lun(lun); + mtx_unlock(&ctl_softc->ctl_lock); + } else + mtx_unlock(&lun->lun_lock); /* * If this command has been aborted, make sure we set the status @@ -12879,7 +13509,7 @@ ctl_process_done(union ctl_io *io, int have_lock) * whatever it needs to do to clean up its state. */ if (io->io_hdr.flags & CTL_FLAG_ABORT) - io->io_hdr.status = CTL_CMD_ABORTED; + ctl_set_task_aborted(&io->scsiio); /* * We print out status for every task management command. For SCSI @@ -12916,8 +13546,6 @@ ctl_process_done(union ctl_io *io, int have_lock) if ((time_uptime - ctl_softc->last_print_jiffies) <= 0){ ctl_softc->skipped_prints++; - if (have_lock == 0) - mtx_unlock(&ctl_softc->ctl_lock); } else { uint32_t skipped_prints; @@ -12926,8 +13554,6 @@ ctl_process_done(union ctl_io *io, int have_lock) ctl_softc->skipped_prints = 0; ctl_softc->last_print_jiffies = time_uptime; - if (have_lock == 0) - mtx_unlock(&ctl_softc->ctl_lock); if (skipped_prints > 0) { #ifdef NEEDTOPORT csevent_log(CSC_CTL | CSC_SHELF_SW | @@ -12944,21 +13570,14 @@ ctl_process_done(union ctl_io *io, int have_lock) if (bootverbose || verbose > 0) ctl_io_error_print(io, NULL); } - } else { - if (have_lock == 0) - mtx_unlock(&ctl_softc->ctl_lock); } break; } case CTL_IO_TASK: - if (have_lock == 0) - mtx_unlock(&ctl_softc->ctl_lock); if (bootverbose || verbose > 0) ctl_io_error_print(io, NULL); break; default: - if (have_lock == 0) - mtx_unlock(&ctl_softc->ctl_lock); break; } @@ -13017,6 +13636,7 @@ ctl_process_done(union ctl_io *io, int have_lock) return (CTL_RETVAL_COMPLETE); } +#ifdef CTL_WITH_CA /* * Front end should call this if it doesn't do autosense. When the request * sense comes back in from the initiator, we'll dequeue this and send it. @@ -13046,8 +13666,7 @@ ctl_queue_sense(union ctl_io *io) * information. */ targ_lun = io->io_hdr.nexus.targ_lun; - if (io->io_hdr.nexus.lun_map_fn != NULL) - targ_lun = io->io_hdr.nexus.lun_map_fn(io->io_hdr.nexus.lun_map_arg, targ_lun); + targ_lun = ctl_map_lun(io->io_hdr.nexus.targ_port, targ_lun); if ((targ_lun < CTL_MAX_LUNS) && (ctl_softc->ctl_luns[targ_lun] != NULL)) lun = ctl_softc->ctl_luns[targ_lun]; @@ -13056,16 +13675,20 @@ ctl_queue_sense(union ctl_io *io) initidx = ctl_get_initindex(&io->io_hdr.nexus); + mtx_lock(&lun->lun_lock); /* * Already have CA set for this LUN...toss the sense information. */ - if (ctl_is_set(lun->have_ca, initidx)) + if (ctl_is_set(lun->have_ca, initidx)) { + mtx_unlock(&lun->lun_lock); goto bailout; + } - memcpy(&lun->pending_sense[initidx].sense, &io->scsiio.sense_data, - ctl_min(sizeof(lun->pending_sense[initidx].sense), + memcpy(&lun->pending_sense[initidx], &io->scsiio.sense_data, + ctl_min(sizeof(lun->pending_sense[initidx]), sizeof(io->scsiio.sense_data))); ctl_set_mask(lun->have_ca, initidx); + mtx_unlock(&lun->lun_lock); bailout: mtx_unlock(&ctl_softc->ctl_lock); @@ -13074,6 +13697,7 @@ ctl_queue_sense(union ctl_io *io) return (CTL_RETVAL_COMPLETE); } +#endif /* * Primary command inlet from frontend ports. All SCSI and task I/O @@ -13093,42 +13717,19 @@ ctl_queue(union ctl_io *io) getbintime(&io->io_hdr.start_bt); #endif /* CTL_TIME_IO */ - mtx_lock(&ctl_softc->ctl_lock); + /* Map FE-specific LUN ID into global one. */ + io->io_hdr.nexus.targ_mapped_lun = + ctl_map_lun(io->io_hdr.nexus.targ_port, io->io_hdr.nexus.targ_lun); switch (io->io_hdr.io_type) { case CTL_IO_SCSI: - STAILQ_INSERT_TAIL(&ctl_softc->incoming_queue, &io->io_hdr, - links); - break; case CTL_IO_TASK: - STAILQ_INSERT_TAIL(&ctl_softc->task_queue, &io->io_hdr, links); - /* - * Set the task pending flag. This is necessary to close a - * race condition with the FETD: - * - * - FETD submits a task management command, like an abort. - * - Back end calls fe_datamove() to move the data for the - * aborted command. The FETD can't really accept it, but - * if it did, it would end up transmitting data for a - * command that the initiator told us to abort. - * - * We close the race condition by setting the flag here, - * and checking it in ctl_datamove(), before calling the - * FETD's fe_datamove routine. If we've got a task - * pending, we run the task queue and then check to see - * whether our particular I/O has been aborted. - */ - ctl_softc->flags |= CTL_FLAG_TASK_PENDING; + ctl_enqueue_incoming(io); break; default: - mtx_unlock(&ctl_softc->ctl_lock); printf("ctl_queue: unknown I/O type %d\n", io->io_hdr.io_type); - return (-EINVAL); - break; /* NOTREACHED */ + return (EINVAL); } - mtx_unlock(&ctl_softc->ctl_lock); - - ctl_wakeup_thread(); return (CTL_RETVAL_COMPLETE); } @@ -13140,23 +13741,17 @@ ctl_done_timer_wakeup(void *arg) union ctl_io *io; io = (union ctl_io *)arg; - ctl_done_lock(io, /*have_lock*/ 0); + ctl_done(io); } #endif /* CTL_IO_DELAY */ void -ctl_done_lock(union ctl_io *io, int have_lock) +ctl_done(union ctl_io *io) { struct ctl_softc *ctl_softc; -#ifndef CTL_DONE_THREAD - union ctl_io *xio; -#endif /* !CTL_DONE_THREAD */ ctl_softc = control_softc; - if (have_lock == 0) - mtx_lock(&ctl_softc->ctl_lock); - /* * Enable this to catch duplicate completion issues. */ @@ -13187,11 +13782,8 @@ ctl_done_lock(union ctl_io *io, int have_lock) * This is an internal copy of an I/O, and should not go through * the normal done processing logic. */ - if (io->io_hdr.flags & CTL_FLAG_INT_COPY) { - if (have_lock == 0) - mtx_unlock(&ctl_softc->ctl_lock); + if (io->io_hdr.flags & CTL_FLAG_INT_COPY) return; - } /* * We need to send a msg to the serializing shelf to finish the IO @@ -13236,38 +13828,12 @@ ctl_done_lock(union ctl_io *io, int have_lock) ctl_done_timer_wakeup, io); if (lun->delay_info.done_type == CTL_DELAY_TYPE_ONESHOT) lun->delay_info.done_delay = 0; - if (have_lock == 0) - mtx_unlock(&ctl_softc->ctl_lock); return; } } #endif /* CTL_IO_DELAY */ - STAILQ_INSERT_TAIL(&ctl_softc->done_queue, &io->io_hdr, links); - -#ifdef CTL_DONE_THREAD - if (have_lock == 0) - mtx_unlock(&ctl_softc->ctl_lock); - - ctl_wakeup_thread(); -#else /* CTL_DONE_THREAD */ - for (xio = (union ctl_io *)STAILQ_FIRST(&ctl_softc->done_queue); - xio != NULL; - xio =(union ctl_io *)STAILQ_FIRST(&ctl_softc->done_queue)) { - - STAILQ_REMOVE_HEAD(&ctl_softc->done_queue, links); - - ctl_process_done(xio, /*have_lock*/ 1); - } - if (have_lock == 0) - mtx_unlock(&ctl_softc->ctl_lock); -#endif /* CTL_DONE_THREAD */ -} - -void -ctl_done(union ctl_io *io) -{ - ctl_done_lock(io, /*have_lock*/ 0); + ctl_enqueue_done(io); } int @@ -13291,24 +13857,18 @@ ctl_isc(struct ctl_scsiio *ctsio) static void ctl_work_thread(void *arg) { - struct ctl_softc *softc; + struct ctl_thread *thr = (struct ctl_thread *)arg; + struct ctl_softc *softc = thr->ctl_softc; union ctl_io *io; - struct ctl_be_lun *be_lun; int retval; CTL_DEBUG_PRINT(("ctl_work_thread starting\n")); - softc = (struct ctl_softc *)arg; - if (softc == NULL) - return; - - mtx_lock(&softc->ctl_lock); for (;;) { retval = 0; /* * We handle the queues in this order: - * - task management * - ISC * - done queue (to free up resources, unblock other commands) * - RtR queue @@ -13317,84 +13877,128 @@ ctl_work_thread(void *arg) * If those queues are empty, we break out of the loop and * go to sleep. */ - io = (union ctl_io *)STAILQ_FIRST(&softc->task_queue); + mtx_lock(&thr->queue_lock); + io = (union ctl_io *)STAILQ_FIRST(&thr->isc_queue); if (io != NULL) { - ctl_run_task_queue(softc); - continue; - } - io = (union ctl_io *)STAILQ_FIRST(&softc->isc_queue); - if (io != NULL) { - STAILQ_REMOVE_HEAD(&softc->isc_queue, links); + STAILQ_REMOVE_HEAD(&thr->isc_queue, links); + mtx_unlock(&thr->queue_lock); ctl_handle_isc(io); continue; } - io = (union ctl_io *)STAILQ_FIRST(&softc->done_queue); + io = (union ctl_io *)STAILQ_FIRST(&thr->done_queue); if (io != NULL) { - STAILQ_REMOVE_HEAD(&softc->done_queue, links); + STAILQ_REMOVE_HEAD(&thr->done_queue, links); /* clear any blocked commands, call fe_done */ - mtx_unlock(&softc->ctl_lock); - /* - * XXX KDM - * Call this without a lock for now. This will - * depend on whether there is any way the FETD can - * sleep or deadlock if called with the CTL lock - * held. - */ - retval = ctl_process_done(io, /*have_lock*/ 0); - mtx_lock(&softc->ctl_lock); + mtx_unlock(&thr->queue_lock); + retval = ctl_process_done(io); + continue; + } + io = (union ctl_io *)STAILQ_FIRST(&thr->incoming_queue); + if (io != NULL) { + STAILQ_REMOVE_HEAD(&thr->incoming_queue, links); + mtx_unlock(&thr->queue_lock); + if (io->io_hdr.io_type == CTL_IO_TASK) + ctl_run_task(io); + else + ctl_scsiio_precheck(softc, &io->scsiio); continue; } if (!ctl_pause_rtr) { - io = (union ctl_io *)STAILQ_FIRST(&softc->rtr_queue); + io = (union ctl_io *)STAILQ_FIRST(&thr->rtr_queue); if (io != NULL) { - STAILQ_REMOVE_HEAD(&softc->rtr_queue, links); - mtx_unlock(&softc->ctl_lock); + STAILQ_REMOVE_HEAD(&thr->rtr_queue, links); + mtx_unlock(&thr->queue_lock); retval = ctl_scsiio(&io->scsiio); if (retval != CTL_RETVAL_COMPLETE) CTL_DEBUG_PRINT(("ctl_scsiio failed\n")); - mtx_lock(&softc->ctl_lock); continue; } } - io = (union ctl_io *)STAILQ_FIRST(&softc->incoming_queue); - if (io != NULL) { - STAILQ_REMOVE_HEAD(&softc->incoming_queue, links); - mtx_unlock(&softc->ctl_lock); - ctl_scsiio_precheck(softc, &io->scsiio); - mtx_lock(&softc->ctl_lock); - continue; - } - /* - * We might want to move this to a separate thread, so that - * configuration requests (in this case LUN creations) - * won't impact the I/O path. - */ + + /* Sleep until we have something to do. */ + mtx_sleep(thr, &thr->queue_lock, PDROP | PRIBIO, "-", 0); + } +} + +static void +ctl_lun_thread(void *arg) +{ + struct ctl_softc *softc = (struct ctl_softc *)arg; + struct ctl_be_lun *be_lun; + int retval; + + CTL_DEBUG_PRINT(("ctl_lun_thread starting\n")); + + for (;;) { + retval = 0; + mtx_lock(&softc->ctl_lock); be_lun = STAILQ_FIRST(&softc->pending_lun_queue); if (be_lun != NULL) { STAILQ_REMOVE_HEAD(&softc->pending_lun_queue, links); mtx_unlock(&softc->ctl_lock); ctl_create_lun(be_lun); - mtx_lock(&softc->ctl_lock); continue; } - /* XXX KDM use the PDROP flag?? */ /* Sleep until we have something to do. */ - mtx_sleep(softc, &softc->ctl_lock, PRIBIO, "-", 0); - - /* Back to the top of the loop to see what woke us up. */ - continue; + mtx_sleep(&softc->pending_lun_queue, &softc->ctl_lock, + PDROP | PRIBIO, "-", 0); } } -void -ctl_wakeup_thread() +static void +ctl_enqueue_incoming(union ctl_io *io) { - struct ctl_softc *softc; + struct ctl_softc *softc = control_softc; + struct ctl_thread *thr; + u_int idx; - softc = control_softc; + idx = (io->io_hdr.nexus.targ_port * 127 + + io->io_hdr.nexus.initid.id) % worker_threads; + thr = &softc->threads[idx]; + mtx_lock(&thr->queue_lock); + STAILQ_INSERT_TAIL(&thr->incoming_queue, &io->io_hdr, links); + mtx_unlock(&thr->queue_lock); + wakeup(thr); +} - wakeup_one(softc); +static void +ctl_enqueue_rtr(union ctl_io *io) +{ + struct ctl_softc *softc = control_softc; + struct ctl_thread *thr; + + thr = &softc->threads[io->io_hdr.nexus.targ_mapped_lun % worker_threads]; + mtx_lock(&thr->queue_lock); + STAILQ_INSERT_TAIL(&thr->rtr_queue, &io->io_hdr, links); + mtx_unlock(&thr->queue_lock); + wakeup(thr); +} + +static void +ctl_enqueue_done(union ctl_io *io) +{ + struct ctl_softc *softc = control_softc; + struct ctl_thread *thr; + + thr = &softc->threads[io->io_hdr.nexus.targ_mapped_lun % worker_threads]; + mtx_lock(&thr->queue_lock); + STAILQ_INSERT_TAIL(&thr->done_queue, &io->io_hdr, links); + mtx_unlock(&thr->queue_lock); + wakeup(thr); +} + +static void +ctl_enqueue_isc(union ctl_io *io) +{ + struct ctl_softc *softc = control_softc; + struct ctl_thread *thr; + + thr = &softc->threads[io->io_hdr.nexus.targ_mapped_lun % worker_threads]; + mtx_lock(&thr->queue_lock); + STAILQ_INSERT_TAIL(&thr->isc_queue, &io->io_hdr, links); + mtx_unlock(&thr->queue_lock); + wakeup(thr); } /* Initialization and failover */ diff --git a/sys/cam/ctl/ctl.h b/sys/cam/ctl/ctl.h index 07c82bac1bf..0525a51d24a 100644 --- a/sys/cam/ctl/ctl.h +++ b/sys/cam/ctl/ctl.h @@ -53,6 +53,7 @@ typedef enum { CTL_PORT_IOCTL = 0x04, CTL_PORT_INTERNAL = 0x08, CTL_PORT_ISCSI = 0x10, + CTL_PORT_SAS = 0x20, CTL_PORT_ALL = 0xff, CTL_PORT_ISC = 0x100 // FC port for inter-shelf communication } ctl_port_type; @@ -96,12 +97,15 @@ union ctl_modepage_info { /* * Device ID length, for VPD page 0x83. */ -#define CTL_DEVID_LEN 16 +#define CTL_DEVID_LEN 64 +#define CTL_DEVID_MIN_LEN 16 /* * WWPN length, for VPD page 0x83. */ #define CTL_WWPN_LEN 8 +#define CTL_DRIVER_NAME_LEN 32 + /* * Unit attention types. ASC/ASCQ values for these should be placed in * ctl_build_ua. These are also listed in order of reporting priority. @@ -112,38 +116,24 @@ typedef enum { CTL_UA_POWERON = 0x0001, CTL_UA_BUS_RESET = 0x0002, CTL_UA_TARG_RESET = 0x0004, - CTL_UA_LUN_RESET = 0x0008, - CTL_UA_LUN_CHANGE = 0x0010, - CTL_UA_MODE_CHANGE = 0x0020, - CTL_UA_LOG_CHANGE = 0x0040, - CTL_UA_LVD = 0x0080, - CTL_UA_SE = 0x0100, - CTL_UA_RES_PREEMPT = 0x0200, - CTL_UA_RES_RELEASE = 0x0400, - CTL_UA_REG_PREEMPT = 0x0800, - CTL_UA_ASYM_ACC_CHANGE = 0x1000, - CTL_UA_CAPACITY_CHANGED = 0x2000 + CTL_UA_I_T_NEXUS_LOSS = 0x0008, + CTL_UA_LUN_RESET = 0x0010, + CTL_UA_LUN_CHANGE = 0x0020, + CTL_UA_MODE_CHANGE = 0x0030, + CTL_UA_LOG_CHANGE = 0x0080, + CTL_UA_LVD = 0x0100, + CTL_UA_SE = 0x0200, + CTL_UA_RES_PREEMPT = 0x0400, + CTL_UA_RES_RELEASE = 0x0800, + CTL_UA_REG_PREEMPT = 0x1000, + CTL_UA_ASYM_ACC_CHANGE = 0x2000, + CTL_UA_CAPACITY_CHANGED = 0x4000 } ctl_ua_type; #ifdef _KERNEL MALLOC_DECLARE(M_CTL); -typedef enum { - CTL_THREAD_NONE = 0x00, - CTL_THREAD_WAKEUP = 0x01 -} ctl_thread_flags; - -struct ctl_thread { - void (*thread_func)(void *arg); - void *arg; - struct cv wait_queue; - const char *thread_name; - ctl_thread_flags thread_flags; - struct completion *thread_event; - struct task_struct *task; -}; - struct ctl_page_index; #ifdef SYSCTL_DECL /* from sysctl.h */ @@ -195,20 +185,27 @@ int ctl_debugconf_sp_select_handler(struct ctl_scsiio *ctsio, int ctl_config_move_done(union ctl_io *io); void ctl_datamove(union ctl_io *io); void ctl_done(union ctl_io *io); +void ctl_data_submit_done(union ctl_io *io); void ctl_config_write_done(union ctl_io *io); -#if 0 -int ctl_thread(void *arg); -#endif -void ctl_wakeup_thread(void); -#if 0 -struct ctl_thread *ctl_create_thread(void (*thread_func) - (void *thread_arg), void *thread_arg, const char *thread_name); -void ctl_signal_thread(struct ctl_thread *thread); -void ctl_shutdown_thread(struct ctl_thread *thread); -#endif void ctl_portDB_changed(int portnum); void ctl_init_isc_msg(void); +/* + * KPI to manipulate LUN/port options + */ + +struct ctl_option { + STAILQ_ENTRY(ctl_option) links; + char *name; + char *value; +}; +typedef STAILQ_HEAD(ctl_options, ctl_option) ctl_options_t; + +struct ctl_be_arg; +void ctl_init_opts(ctl_options_t *opts, int num_args, struct ctl_be_arg *args); +void ctl_free_opts(ctl_options_t *opts); +char * ctl_get_opt(ctl_options_t *opts, const char *name); + #endif /* _KERNEL */ #endif /* _CTL_H_ */ diff --git a/sys/cam/ctl/ctl_backend.c b/sys/cam/ctl/ctl_backend.c index 5234c4a3207..0e1a76c5d97 100644 --- a/sys/cam/ctl/ctl_backend.c +++ b/sys/cam/ctl/ctl_backend.c @@ -173,6 +173,49 @@ ctl_backend_find(char *backend_name) return (NULL); } -/* - * vim: ts=8 - */ +void +ctl_init_opts(ctl_options_t *opts, int num_args, struct ctl_be_arg *args) +{ + struct ctl_option *opt; + int i; + + STAILQ_INIT(opts); + for (i = 0; i < num_args; i++) { + if ((args[i].flags & CTL_BEARG_RD) == 0) + continue; + if ((args[i].flags & CTL_BEARG_ASCII) == 0) + continue; + opt = malloc(sizeof(*opt), M_CTL, M_WAITOK); + opt->name = malloc(strlen(args[i].kname) + 1, M_CTL, M_WAITOK); + strcpy(opt->name, args[i].kname); + opt->value = malloc(strlen(args[i].kvalue) + 1, M_CTL, M_WAITOK); + strcpy(opt->value, args[i].kvalue); + STAILQ_INSERT_TAIL(opts, opt, links); + } +} + +void +ctl_free_opts(ctl_options_t *opts) +{ + struct ctl_option *opt; + + while ((opt = STAILQ_FIRST(opts)) != NULL) { + STAILQ_REMOVE_HEAD(opts, links); + free(opt->name, M_CTL); + free(opt->value, M_CTL); + free(opt, M_CTL); + } +} + +char * +ctl_get_opt(ctl_options_t *opts, const char *name) +{ + struct ctl_option *opt; + + STAILQ_FOREACH(opt, opts, links) { + if (strcmp(opt->name, name) == 0) { + return (opt->value); + } + } + return (NULL); +} diff --git a/sys/cam/ctl/ctl_backend.h b/sys/cam/ctl/ctl_backend.h index ad93119afc9..c2066c52746 100644 --- a/sys/cam/ctl/ctl_backend.h +++ b/sys/cam/ctl/ctl_backend.h @@ -180,12 +180,6 @@ typedef void (*be_lun_config_t)(void *be_lun, * The links field is for CTL internal use only, and should not be used by * the backend. */ -struct ctl_be_lun_option { - STAILQ_ENTRY(ctl_be_lun_option) links; - char *name; - char *value; -}; - struct ctl_be_lun { uint8_t lun_type; /* passed to CTL */ ctl_backend_lun_flags flags; /* passed to CTL */ @@ -202,7 +196,7 @@ struct ctl_be_lun { be_lun_config_t lun_config_status; /* passed to CTL */ struct ctl_backend_driver *be; /* passed to CTL */ void *ctl_lun; /* used by CTL */ - STAILQ_HEAD(, ctl_be_lun_option) options; /* passed to CTL */ + ctl_options_t options; /* passed to CTL */ STAILQ_ENTRY(ctl_be_lun) links; /* used by CTL */ }; diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index 4856b45cd15..528fb71781b 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -92,9 +92,11 @@ __FBSDID("$FreeBSD$"); * The idea here is that we'll allocate enough S/G space to hold a 1MB * I/O. If we get an I/O larger than that, we'll split it. */ -#define CTLBLK_MAX_IO_SIZE (1024 * 1024) +#define CTLBLK_HALF_IO_SIZE (512 * 1024) +#define CTLBLK_MAX_IO_SIZE (CTLBLK_HALF_IO_SIZE * 2) #define CTLBLK_MAX_SEG MAXPHYS -#define CTLBLK_MAX_SEGS MAX(CTLBLK_MAX_IO_SIZE / CTLBLK_MAX_SEG, 1) +#define CTLBLK_HALF_SEGS MAX(CTLBLK_HALF_IO_SIZE / CTLBLK_MAX_SEG, 1) +#define CTLBLK_MAX_SEGS (CTLBLK_HALF_SEGS * 2) #ifdef CTLBLK_DEBUG #define DPRINTF(fmt, args...) \ @@ -103,6 +105,11 @@ __FBSDID("$FreeBSD$"); #define DPRINTF(fmt, args...) do {} while(0) #endif +#define PRIV(io) \ + ((struct ctl_ptr_len_flags *)&(io)->io_hdr.ctl_private[CTL_PRIV_BACKEND]) +#define ARGS(io) \ + ((struct ctl_lba_len_flags *)&(io)->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]) + SDT_PROVIDER_DEFINE(cbb); typedef enum { @@ -153,7 +160,6 @@ struct ctl_be_block_lun { cbb_dispatch_t dispatch; cbb_dispatch_t lun_flush; cbb_dispatch_t unmap; - struct mtx lock; uma_zone_t lun_zone; uint64_t size_blocks; uint64_t size_bytes; @@ -172,6 +178,8 @@ struct ctl_be_block_lun { STAILQ_HEAD(, ctl_io_hdr) input_queue; STAILQ_HEAD(, ctl_io_hdr) config_write_queue; STAILQ_HEAD(, ctl_io_hdr) datamove_queue; + struct mtx_padalign io_lock; + struct mtx_padalign queue_lock; }; /* @@ -212,10 +220,9 @@ struct ctl_be_block_io { }; static int cbb_num_threads = 14; -TUNABLE_INT("kern.cam.ctl.block.num_threads", &cbb_num_threads); SYSCTL_NODE(_kern_cam_ctl, OID_AUTO, block, CTLFLAG_RD, 0, "CAM Target Layer Block Backend"); -SYSCTL_INT(_kern_cam_ctl_block, OID_AUTO, num_threads, CTLFLAG_RW, +SYSCTL_INT(_kern_cam_ctl_block, OID_AUTO, num_threads, CTLFLAG_RWTUN, &cbb_num_threads, 0, "Number of threads per backing file"); static struct ctl_be_block_io *ctl_alloc_beio(struct ctl_be_block_softc *softc); @@ -309,6 +316,13 @@ ctl_free_beio(struct ctl_be_block_io *beio) uma_zfree(beio->lun->lun_zone, beio->sg_segs[i].addr); beio->sg_segs[i].addr = NULL; + + /* For compare we had two equal S/G lists. */ + if (ARGS(beio->io)->flags & CTL_LLF_COMPARE) { + uma_zfree(beio->lun->lun_zone, + beio->sg_segs[i + CTLBLK_HALF_SEGS].addr); + beio->sg_segs[i + CTLBLK_HALF_SEGS].addr = NULL; + } } if (duplicate_free > 0) { @@ -322,28 +336,13 @@ ctl_free_beio(struct ctl_be_block_io *beio) static void ctl_complete_beio(struct ctl_be_block_io *beio) { - union ctl_io *io; - int io_len; - - io = beio->io; - - if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS) - io_len = beio->io_len; - else - io_len = 0; - - devstat_end_transaction(beio->lun->disk_stats, - /*bytes*/ io_len, - beio->ds_tag_type, - beio->ds_trans_type, - /*now*/ NULL, - /*then*/&beio->ds_t0); + union ctl_io *io = beio->io; if (beio->beio_cont != NULL) { beio->beio_cont(beio); } else { ctl_free_beio(beio); - ctl_done(io); + ctl_data_submit_done(io); } } @@ -352,13 +351,13 @@ ctl_be_block_move_done(union ctl_io *io) { struct ctl_be_block_io *beio; struct ctl_be_block_lun *be_lun; + struct ctl_lba_len_flags *lbalen; #ifdef CTL_TIME_IO struct bintime cur_bt; -#endif - - beio = (struct ctl_be_block_io *) - io->io_hdr.ctl_private[CTL_PRIV_BACKEND].ptr; +#endif + int i; + beio = (struct ctl_be_block_io *)PRIV(io)->ptr; be_lun = beio->lun; DPRINTF("entered\n"); @@ -369,16 +368,37 @@ ctl_be_block_move_done(union ctl_io *io) bintime_add(&io->io_hdr.dma_bt, &cur_bt); io->io_hdr.num_dmas++; #endif + io->scsiio.kern_rel_offset += io->scsiio.kern_data_len; /* * We set status at this point for read commands, and write * commands with errors. */ - if ((beio->bio_cmd == BIO_READ) - && (io->io_hdr.port_status == 0) - && ((io->io_hdr.flags & CTL_FLAG_ABORT) == 0) - && ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE)) - ctl_set_success(&io->scsiio); + if ((io->io_hdr.port_status == 0) && + ((io->io_hdr.flags & CTL_FLAG_ABORT) == 0) && + ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE)) { + lbalen = ARGS(beio->io); + if (lbalen->flags & CTL_LLF_READ) { + ctl_set_success(&io->scsiio); + } else if (lbalen->flags & CTL_LLF_COMPARE) { + /* We have two data blocks ready for comparison. */ + for (i = 0; i < beio->num_segs; i++) { + if (memcmp(beio->sg_segs[i].addr, + beio->sg_segs[i + CTLBLK_HALF_SEGS].addr, + beio->sg_segs[i].len) != 0) + break; + } + if (i < beio->num_segs) + ctl_set_sense(&io->scsiio, + /*current_error*/ 1, + /*sense_key*/ SSD_KEY_MISCOMPARE, + /*asc*/ 0x1D, + /*ascq*/ 0x00, + SSD_ELEM_NONE); + else + ctl_set_success(&io->scsiio); + } + } else if ((io->io_hdr.port_status != 0) && ((io->io_hdr.flags & CTL_FLAG_ABORT) == 0) && ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE)) { @@ -414,14 +434,14 @@ ctl_be_block_move_done(union ctl_io *io) * This move done routine is generally called in the SIM's * interrupt context, and therefore we cannot block. */ - mtx_lock(&be_lun->lock); + mtx_lock(&be_lun->queue_lock); /* * XXX KDM make sure that links is okay to use at this point. * Otherwise, we either need to add another field to ctl_io_hdr, * or deal with resource allocation here. */ STAILQ_INSERT_TAIL(&be_lun->datamove_queue, &io->io_hdr, links); - mtx_unlock(&be_lun->lock); + mtx_unlock(&be_lun->queue_lock); taskqueue_enqueue(be_lun->io_taskqueue, &be_lun->io_task); @@ -443,7 +463,7 @@ ctl_be_block_biodone(struct bio *bio) DPRINTF("entered\n"); error = bio->bio_error; - mtx_lock(&be_lun->lock); + mtx_lock(&be_lun->io_lock); if (error != 0) beio->num_errors++; @@ -461,7 +481,7 @@ ctl_be_block_biodone(struct bio *bio) */ if ((beio->send_complete == 0) || (beio->num_bios_done < beio->num_bios_sent)) { - mtx_unlock(&be_lun->lock); + mtx_unlock(&be_lun->io_lock); return; } @@ -469,7 +489,10 @@ ctl_be_block_biodone(struct bio *bio) * At this point, we've verified that we are the last I/O to * complete, so it's safe to drop the lock. */ - mtx_unlock(&be_lun->lock); + devstat_end_transaction(beio->lun->disk_stats, beio->io_len, + beio->ds_tag_type, beio->ds_trans_type, + /*now*/ NULL, /*then*/&beio->ds_t0); + mtx_unlock(&be_lun->io_lock); /* * If there are any errors from the backing device, we fail the @@ -490,12 +513,13 @@ ctl_be_block_biodone(struct bio *bio) } /* - * If this is a write, a flush or a delete, we're all done. + * If this is a write, a flush, a delete or verify, we're all done. * If this is a read, we can now send the data to the user. */ if ((beio->bio_cmd == BIO_WRITE) || (beio->bio_cmd == BIO_FLUSH) - || (beio->bio_cmd == BIO_DELETE)) { + || (beio->bio_cmd == BIO_DELETE) + || (ARGS(io)->flags & CTL_LLF_VERIFY)) { ctl_set_success(&io->scsiio); ctl_complete_beio(beio); } else { @@ -510,15 +534,18 @@ static void ctl_be_block_flush_file(struct ctl_be_block_lun *be_lun, struct ctl_be_block_io *beio) { - union ctl_io *io; + union ctl_io *io = beio->io; struct mount *mountpoint; int error, lock_flags; DPRINTF("entered\n"); - io = beio->io; + binuptime(&beio->ds_t0); + mtx_lock(&be_lun->io_lock); + devstat_start_transaction(beio->lun->disk_stats, &beio->ds_t0); + mtx_unlock(&be_lun->io_lock); - (void) vn_start_write(be_lun->vn, &mountpoint, V_WAIT); + (void) vn_start_write(be_lun->vn, &mountpoint, V_WAIT); if (MNT_SHARED_WRITES(mountpoint) || ((mountpoint == NULL) @@ -529,14 +556,17 @@ ctl_be_block_flush_file(struct ctl_be_block_lun *be_lun, vn_lock(be_lun->vn, lock_flags | LK_RETRY); - binuptime(&beio->ds_t0); - devstat_start_transaction(beio->lun->disk_stats, &beio->ds_t0); - error = VOP_FSYNC(be_lun->vn, MNT_WAIT, curthread); VOP_UNLOCK(be_lun->vn, 0); vn_finished_write(mountpoint); + mtx_lock(&be_lun->io_lock); + devstat_end_transaction(beio->lun->disk_stats, beio->io_len, + beio->ds_tag_type, beio->ds_trans_type, + /*now*/ NULL, /*then*/&beio->ds_t0); + mtx_unlock(&be_lun->io_lock); + if (error == 0) ctl_set_success(&io->scsiio); else { @@ -571,18 +601,14 @@ ctl_be_block_dispatch_file(struct ctl_be_block_lun *be_lun, io = beio->io; flags = beio->bio_flags; + bzero(&xuio, sizeof(xuio)); if (beio->bio_cmd == BIO_READ) { SDT_PROBE(cbb, kernel, read, file_start, 0, 0, 0, 0, 0); + xuio.uio_rw = UIO_READ; } else { SDT_PROBE(cbb, kernel, write, file_start, 0, 0, 0, 0, 0); - } - - bzero(&xuio, sizeof(xuio)); - if (beio->bio_cmd == BIO_READ) - xuio.uio_rw = UIO_READ; - else xuio.uio_rw = UIO_WRITE; - + } xuio.uio_offset = beio->io_offset; xuio.uio_resid = beio->io_len; xuio.uio_segflg = UIO_SYSSPACE; @@ -595,12 +621,14 @@ ctl_be_block_dispatch_file(struct ctl_be_block_lun *be_lun, xiovec->iov_len = beio->sg_segs[i].len; } + binuptime(&beio->ds_t0); + mtx_lock(&be_lun->io_lock); + devstat_start_transaction(beio->lun->disk_stats, &beio->ds_t0); + mtx_unlock(&be_lun->io_lock); + if (beio->bio_cmd == BIO_READ) { vn_lock(be_lun->vn, LK_SHARED | LK_RETRY); - binuptime(&beio->ds_t0); - devstat_start_transaction(beio->lun->disk_stats, &beio->ds_t0); - /* * UFS pays attention to IO_DIRECT for reads. If the * DIRECTIO option is configured into the kernel, it calls @@ -625,6 +653,7 @@ ctl_be_block_dispatch_file(struct ctl_be_block_lun *be_lun, (IO_DIRECT|IO_SYNC) : 0, file_data->cred); VOP_UNLOCK(be_lun->vn, 0); + SDT_PROBE(cbb, kernel, read, file_done, 0, 0, 0, 0, 0); } else { struct mount *mountpoint; int lock_flags; @@ -640,9 +669,6 @@ ctl_be_block_dispatch_file(struct ctl_be_block_lun *be_lun, vn_lock(be_lun->vn, lock_flags | LK_RETRY); - binuptime(&beio->ds_t0); - devstat_start_transaction(beio->lun->disk_stats, &beio->ds_t0); - /* * UFS pays attention to IO_DIRECT for writes. The write * is done asynchronously. (Normally the write would just @@ -666,8 +692,15 @@ ctl_be_block_dispatch_file(struct ctl_be_block_lun *be_lun, VOP_UNLOCK(be_lun->vn, 0); vn_finished_write(mountpoint); + SDT_PROBE(cbb, kernel, write, file_done, 0, 0, 0, 0, 0); } + mtx_lock(&be_lun->io_lock); + devstat_end_transaction(beio->lun->disk_stats, beio->io_len, + beio->ds_tag_type, beio->ds_trans_type, + /*now*/ NULL, /*then*/&beio->ds_t0); + mtx_unlock(&be_lun->io_lock); + /* * If we got an error, set the sense data to "MEDIUM ERROR" and * return the I/O to the user. @@ -689,15 +722,96 @@ ctl_be_block_dispatch_file(struct ctl_be_block_lun *be_lun, } /* - * If this is a write, we're all done. + * If this is a write or a verify, we're all done. * If this is a read, we can now send the data to the user. */ - if (beio->bio_cmd == BIO_WRITE) { + if ((beio->bio_cmd == BIO_WRITE) || + (ARGS(io)->flags & CTL_LLF_VERIFY)) { ctl_set_success(&io->scsiio); - SDT_PROBE(cbb, kernel, write, file_done, 0, 0, 0, 0, 0); ctl_complete_beio(beio); } else { +#ifdef CTL_TIME_IO + getbintime(&io->io_hdr.dma_start_bt); +#endif + ctl_datamove(io); + } +} + +static void +ctl_be_block_dispatch_zvol(struct ctl_be_block_lun *be_lun, + struct ctl_be_block_io *beio) +{ + struct ctl_be_block_devdata *dev_data; + union ctl_io *io; + struct uio xuio; + struct iovec *xiovec; + int flags; + int error, i; + + DPRINTF("entered\n"); + + dev_data = &be_lun->backend.dev; + io = beio->io; + flags = beio->bio_flags; + + bzero(&xuio, sizeof(xuio)); + if (beio->bio_cmd == BIO_READ) { + SDT_PROBE(cbb, kernel, read, file_start, 0, 0, 0, 0, 0); + xuio.uio_rw = UIO_READ; + } else { + SDT_PROBE(cbb, kernel, write, file_start, 0, 0, 0, 0, 0); + xuio.uio_rw = UIO_WRITE; + } + xuio.uio_offset = beio->io_offset; + xuio.uio_resid = beio->io_len; + xuio.uio_segflg = UIO_SYSSPACE; + xuio.uio_iov = beio->xiovecs; + xuio.uio_iovcnt = beio->num_segs; + xuio.uio_td = curthread; + + for (i = 0, xiovec = xuio.uio_iov; i < xuio.uio_iovcnt; i++, xiovec++) { + xiovec->iov_base = beio->sg_segs[i].addr; + xiovec->iov_len = beio->sg_segs[i].len; + } + + binuptime(&beio->ds_t0); + mtx_lock(&be_lun->io_lock); + devstat_start_transaction(beio->lun->disk_stats, &beio->ds_t0); + mtx_unlock(&be_lun->io_lock); + + if (beio->bio_cmd == BIO_READ) { + error = (*dev_data->csw->d_read)(dev_data->cdev, &xuio, 0); SDT_PROBE(cbb, kernel, read, file_done, 0, 0, 0, 0, 0); + } else { + error = (*dev_data->csw->d_write)(dev_data->cdev, &xuio, 0); + SDT_PROBE(cbb, kernel, write, file_done, 0, 0, 0, 0, 0); + } + + mtx_lock(&be_lun->io_lock); + devstat_end_transaction(beio->lun->disk_stats, beio->io_len, + beio->ds_tag_type, beio->ds_trans_type, + /*now*/ NULL, /*then*/&beio->ds_t0); + mtx_unlock(&be_lun->io_lock); + + /* + * If we got an error, set the sense data to "MEDIUM ERROR" and + * return the I/O to the user. + */ + if (error != 0) { + ctl_set_medium_error(&io->scsiio); + ctl_complete_beio(beio); + return; + } + + /* + * If this is a write or a verify, we're all done. + * If this is a read, we can now send the data to the user. + */ + if ((beio->bio_cmd == BIO_WRITE) || + (ARGS(io)->flags & CTL_LLF_VERIFY)) { + ctl_set_success(&io->scsiio); + ctl_complete_beio(beio); + } else { #ifdef CTL_TIME_IO getbintime(&io->io_hdr.dma_start_bt); #endif @@ -739,7 +853,9 @@ ctl_be_block_flush_dev(struct ctl_be_block_lun *be_lun, beio->send_complete = 1; binuptime(&beio->ds_t0); + mtx_lock(&be_lun->io_lock); devstat_start_transaction(be_lun->disk_stats, &beio->ds_t0); + mtx_unlock(&be_lun->io_lock); (*dev_data->csw->d_strategy)(bio); } @@ -770,11 +886,11 @@ ctl_be_block_unmap_dev_range(struct ctl_be_block_lun *be_lun, off += bio->bio_length; len -= bio->bio_length; - mtx_lock(&be_lun->lock); + mtx_lock(&be_lun->io_lock); beio->num_bios_sent++; if (last && len == 0) beio->send_complete = 1; - mtx_unlock(&be_lun->lock); + mtx_unlock(&be_lun->io_lock); (*dev_data->csw->d_strategy)(bio); } @@ -786,7 +902,7 @@ ctl_be_block_unmap_dev(struct ctl_be_block_lun *be_lun, { union ctl_io *io; struct ctl_be_block_devdata *dev_data; - struct ctl_ptr_len_flags ptrlen; + struct ctl_ptr_len_flags *ptrlen; struct scsi_unmap_desc *buf, *end; uint64_t len; @@ -796,14 +912,15 @@ ctl_be_block_unmap_dev(struct ctl_be_block_lun *be_lun, DPRINTF("entered\n"); binuptime(&beio->ds_t0); + mtx_lock(&be_lun->io_lock); devstat_start_transaction(be_lun->disk_stats, &beio->ds_t0); + mtx_unlock(&be_lun->io_lock); if (beio->io_offset == -1) { beio->io_len = 0; - memcpy(&ptrlen, io->io_hdr.ctl_private[CTL_PRIV_LBA_LEN].bytes, - sizeof(ptrlen)); - buf = (struct scsi_unmap_desc *)ptrlen.ptr; - end = buf + ptrlen.len / sizeof(*buf); + ptrlen = (struct ctl_ptr_len_flags *)&io->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]; + buf = (struct scsi_unmap_desc *)ptrlen->ptr; + end = buf + ptrlen->len / sizeof(*buf); for (; buf < end; buf++) { len = (uint64_t)scsi_4btoul(buf->length) * be_lun->blocksize; @@ -821,6 +938,7 @@ static void ctl_be_block_dispatch_dev(struct ctl_be_block_lun *be_lun, struct ctl_be_block_io *beio) { + TAILQ_HEAD(, bio) queue = TAILQ_HEAD_INITIALIZER(queue); int i; struct bio *bio; struct ctl_be_block_devdata *dev_data; @@ -841,14 +959,6 @@ ctl_be_block_dispatch_dev(struct ctl_be_block_lun *be_lun, max_iosize = DFLTPHYS; cur_offset = beio->io_offset; - - /* - * XXX KDM need to accurately reflect the number of I/Os outstanding - * to a device. - */ - binuptime(&beio->ds_t0); - devstat_start_transaction(be_lun->disk_stats, &beio->ds_t0); - for (i = 0; i < beio->num_segs; i++) { size_t cur_size; uint8_t *cur_ptr; @@ -876,32 +986,23 @@ ctl_be_block_dispatch_dev(struct ctl_be_block_lun *be_lun, cur_ptr += bio->bio_length; cur_size -= bio->bio_length; - /* - * Make sure we set the complete bit just before we - * issue the last bio so we don't wind up with a - * race. - * - * Use the LUN mutex here instead of a combination - * of atomic variables for simplicity. - * - * XXX KDM we could have a per-IO lock, but that - * would cause additional per-IO setup and teardown - * overhead. Hopefully there won't be too much - * contention on the LUN lock. - */ - mtx_lock(&be_lun->lock); - + TAILQ_INSERT_TAIL(&queue, bio, bio_queue); beio->num_bios_sent++; - - if ((i == beio->num_segs - 1) - && (cur_size == 0)) - beio->send_complete = 1; - - mtx_unlock(&be_lun->lock); - - (*dev_data->csw->d_strategy)(bio); } } + binuptime(&beio->ds_t0); + mtx_lock(&be_lun->io_lock); + devstat_start_transaction(be_lun->disk_stats, &beio->ds_t0); + beio->send_complete = 1; + mtx_unlock(&be_lun->io_lock); + + /* + * Fire off all allocated requests! + */ + while ((bio = TAILQ_FIRST(&queue)) != NULL) { + TAILQ_REMOVE(&queue, bio, bio_queue); + (*dev_data->csw->d_strategy)(bio); + } } static void @@ -911,8 +1012,9 @@ ctl_be_block_cw_done_ws(struct ctl_be_block_io *beio) io = beio->io; ctl_free_beio(beio); - if (((io->io_hdr.status & CTL_STATUS_MASK) != CTL_STATUS_NONE) - && ((io->io_hdr.status & CTL_STATUS_MASK) != CTL_SUCCESS)) { + if ((io->io_hdr.flags & CTL_FLAG_ABORT) || + ((io->io_hdr.status & CTL_STATUS_MASK) != CTL_STATUS_NONE && + (io->io_hdr.status & CTL_STATUS_MASK) != CTL_SUCCESS)) { ctl_config_write_done(io); return; } @@ -926,20 +1028,19 @@ ctl_be_block_cw_dispatch_ws(struct ctl_be_block_lun *be_lun, { struct ctl_be_block_io *beio; struct ctl_be_block_softc *softc; - struct ctl_lba_len_flags lbalen; + struct ctl_lba_len_flags *lbalen; uint64_t len_left, lba; int i, seglen; uint8_t *buf, *end; DPRINTF("entered\n"); - beio = io->io_hdr.ctl_private[CTL_PRIV_BACKEND].ptr; + beio = (struct ctl_be_block_io *)PRIV(io)->ptr; softc = be_lun->softc; - memcpy(&lbalen, io->io_hdr.ctl_private[CTL_PRIV_LBA_LEN].bytes, - sizeof(lbalen)); + lbalen = ARGS(beio->io); - if (lbalen.flags & ~(SWS_LBDATA | SWS_UNMAP) || - (lbalen.flags & SWS_UNMAP && be_lun->unmap == NULL)) { + if (lbalen->flags & ~(SWS_LBDATA | SWS_UNMAP) || + (lbalen->flags & SWS_UNMAP && be_lun->unmap == NULL)) { ctl_free_beio(beio); ctl_set_invalid_field(&io->scsiio, /*sks_valid*/ 1, @@ -975,9 +1076,9 @@ ctl_be_block_cw_dispatch_ws(struct ctl_be_block_lun *be_lun, break; } - if (lbalen.flags & SWS_UNMAP) { - beio->io_offset = lbalen.lba * be_lun->blocksize; - beio->io_len = (uint64_t)lbalen.len * be_lun->blocksize; + if (lbalen->flags & SWS_UNMAP) { + beio->io_offset = lbalen->lba * be_lun->blocksize; + beio->io_len = (uint64_t)lbalen->len * be_lun->blocksize; beio->bio_cmd = BIO_DELETE; beio->ds_trans_type = DEVSTAT_FREE; @@ -989,9 +1090,9 @@ ctl_be_block_cw_dispatch_ws(struct ctl_be_block_lun *be_lun, beio->ds_trans_type = DEVSTAT_WRITE; DPRINTF("WRITE SAME at LBA %jx len %u\n", - (uintmax_t)lbalen.lba, lbalen.len); + (uintmax_t)lbalen->lba, lbalen->len); - len_left = (uint64_t)lbalen.len * be_lun->blocksize; + len_left = (uint64_t)lbalen->len * be_lun->blocksize; for (i = 0, lba = 0; i < CTLBLK_MAX_SEGS && len_left > 0; i++) { /* @@ -1012,21 +1113,19 @@ ctl_be_block_cw_dispatch_ws(struct ctl_be_block_lun *be_lun, end = buf + seglen; for (; buf < end; buf += be_lun->blocksize) { memcpy(buf, io->scsiio.kern_data_ptr, be_lun->blocksize); - if (lbalen.flags & SWS_LBDATA) - scsi_ulto4b(lbalen.lba + lba, buf); + if (lbalen->flags & SWS_LBDATA) + scsi_ulto4b(lbalen->lba + lba, buf); lba++; } } - beio->io_offset = lbalen.lba * be_lun->blocksize; + beio->io_offset = lbalen->lba * be_lun->blocksize; beio->io_len = lba * be_lun->blocksize; /* We can not do all in one run. Correct and schedule rerun. */ if (len_left > 0) { - lbalen.lba += lba; - lbalen.len -= lba; - memcpy(io->io_hdr.ctl_private[CTL_PRIV_LBA_LEN].bytes, &lbalen, - sizeof(lbalen)); + lbalen->lba += lba; + lbalen->len -= lba; beio->beio_cont = ctl_be_block_cw_done_ws; } @@ -1039,16 +1138,15 @@ ctl_be_block_cw_dispatch_unmap(struct ctl_be_block_lun *be_lun, { struct ctl_be_block_io *beio; struct ctl_be_block_softc *softc; - struct ctl_ptr_len_flags ptrlen; + struct ctl_ptr_len_flags *ptrlen; DPRINTF("entered\n"); - beio = io->io_hdr.ctl_private[CTL_PRIV_BACKEND].ptr; + beio = (struct ctl_be_block_io *)PRIV(io)->ptr; softc = be_lun->softc; - memcpy(&ptrlen, io->io_hdr.ctl_private[CTL_PRIV_LBA_LEN].bytes, - sizeof(ptrlen)); + ptrlen = (struct ctl_ptr_len_flags *)&io->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]; - if (ptrlen.flags != 0 || be_lun->unmap == NULL) { + if (ptrlen->flags != 0 || be_lun->unmap == NULL) { ctl_free_beio(beio); ctl_set_invalid_field(&io->scsiio, /*sks_valid*/ 0, @@ -1090,8 +1188,7 @@ ctl_be_block_cw_dispatch_unmap(struct ctl_be_block_lun *be_lun, beio->bio_cmd = BIO_DELETE; beio->ds_trans_type = DEVSTAT_FREE; - DPRINTF("WRITE SAME at LBA %jx len %u\n", - (uintmax_t)lbalen.lba, lbalen.len); + DPRINTF("UNMAP\n"); be_lun->unmap(be_lun, beio); } @@ -1120,7 +1217,7 @@ ctl_be_block_cw_dispatch(struct ctl_be_block_lun *be_lun, beio->io = io; beio->lun = be_lun; beio->beio_cont = ctl_be_block_cw_done; - io->io_hdr.ctl_private[CTL_PRIV_BACKEND].ptr = beio; + PRIV(io)->ptr = (void *)beio; switch (io->scsiio.cdb[0]) { case SYNCHRONIZE_CACHE: @@ -1158,24 +1255,24 @@ ctl_be_block_next(struct ctl_be_block_io *beio) io = beio->io; be_lun = beio->lun; ctl_free_beio(beio); - if (((io->io_hdr.status & CTL_STATUS_MASK) != CTL_STATUS_NONE) - && ((io->io_hdr.status & CTL_STATUS_MASK) != CTL_SUCCESS)) { - ctl_done(io); + if ((io->io_hdr.flags & CTL_FLAG_ABORT) || + ((io->io_hdr.status & CTL_STATUS_MASK) != CTL_STATUS_NONE && + (io->io_hdr.status & CTL_STATUS_MASK) != CTL_SUCCESS)) { + ctl_data_submit_done(io); return; } - io->scsiio.kern_rel_offset += io->scsiio.kern_data_len; io->io_hdr.status &= ~CTL_STATUS_MASK; io->io_hdr.status |= CTL_STATUS_NONE; - mtx_lock(&be_lun->lock); + mtx_lock(&be_lun->queue_lock); /* * XXX KDM make sure that links is okay to use at this point. * Otherwise, we either need to add another field to ctl_io_hdr, * or deal with resource allocation here. */ STAILQ_INSERT_TAIL(&be_lun->input_queue, &io->io_hdr, links); - mtx_unlock(&be_lun->lock); + mtx_unlock(&be_lun->queue_lock); taskqueue_enqueue(be_lun->io_taskqueue, &be_lun->io_task); } @@ -1186,24 +1283,27 @@ ctl_be_block_dispatch(struct ctl_be_block_lun *be_lun, { struct ctl_be_block_io *beio; struct ctl_be_block_softc *softc; - struct ctl_lba_len lbalen; - uint64_t len_left, lbaoff; + struct ctl_lba_len_flags *lbalen; + struct ctl_ptr_len_flags *bptrlen; + uint64_t len_left, lbas; int i; softc = be_lun->softc; DPRINTF("entered\n"); - if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_IN) { - SDT_PROBE(cbb, kernel, read, start, 0, 0, 0, 0, 0); - } else { + lbalen = ARGS(io); + if (lbalen->flags & CTL_LLF_WRITE) { SDT_PROBE(cbb, kernel, write, start, 0, 0, 0, 0, 0); + } else { + SDT_PROBE(cbb, kernel, read, start, 0, 0, 0, 0, 0); } beio = ctl_alloc_beio(softc); beio->io = io; beio->lun = be_lun; - io->io_hdr.ctl_private[CTL_PRIV_BACKEND].ptr = beio; + bptrlen = PRIV(io); + bptrlen->ptr = (void *)beio; /* * If the I/O came down with an ordered or head of queue tag, set @@ -1234,28 +1334,25 @@ ctl_be_block_dispatch(struct ctl_be_block_lun *be_lun, break; } - /* - * This path handles read and write only. The config write path - * handles flush operations. - */ - if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_IN) { - beio->bio_cmd = BIO_READ; - beio->ds_trans_type = DEVSTAT_READ; - } else { + if (lbalen->flags & CTL_LLF_WRITE) { beio->bio_cmd = BIO_WRITE; beio->ds_trans_type = DEVSTAT_WRITE; + } else { + beio->bio_cmd = BIO_READ; + beio->ds_trans_type = DEVSTAT_READ; } - memcpy(&lbalen, io->io_hdr.ctl_private[CTL_PRIV_LBA_LEN].bytes, - sizeof(lbalen)); DPRINTF("%s at LBA %jx len %u @%ju\n", (beio->bio_cmd == BIO_READ) ? "READ" : "WRITE", - (uintmax_t)lbalen.lba, lbalen.len, lbaoff); - lbaoff = io->scsiio.kern_rel_offset / be_lun->blocksize; - beio->io_offset = (lbalen.lba + lbaoff) * be_lun->blocksize; - beio->io_len = MIN((lbalen.len - lbaoff) * be_lun->blocksize, - CTLBLK_MAX_IO_SIZE); - beio->io_len -= beio->io_len % be_lun->blocksize; + (uintmax_t)lbalen->lba, lbalen->len, bptrlen->len); + if (lbalen->flags & CTL_LLF_COMPARE) + lbas = CTLBLK_HALF_IO_SIZE; + else + lbas = CTLBLK_MAX_IO_SIZE; + lbas = MIN(lbalen->len - bptrlen->len, lbas / be_lun->blocksize); + beio->io_offset = (lbalen->lba + bptrlen->len) * be_lun->blocksize; + beio->io_len = lbas * be_lun->blocksize; + bptrlen->len += lbas; for (i = 0, len_left = beio->io_len; len_left > 0; i++) { KASSERT(i < CTLBLK_MAX_SEGS, ("Too many segs (%d >= %d)", @@ -1270,14 +1367,25 @@ ctl_be_block_dispatch(struct ctl_be_block_lun *be_lun, DPRINTF("segment %d addr %p len %zd\n", i, beio->sg_segs[i].addr, beio->sg_segs[i].len); + /* Set up second segment for compare operation. */ + if (lbalen->flags & CTL_LLF_COMPARE) { + beio->sg_segs[i + CTLBLK_HALF_SEGS].len = + beio->sg_segs[i].len; + beio->sg_segs[i + CTLBLK_HALF_SEGS].addr = + uma_zalloc(be_lun->lun_zone, M_WAITOK); + } + beio->num_segs++; len_left -= beio->sg_segs[i].len; } - if (io->scsiio.kern_rel_offset + beio->io_len < - io->scsiio.kern_total_len) + if (bptrlen->len < lbalen->len) beio->beio_cont = ctl_be_block_next; io->scsiio.be_move_done = ctl_be_block_move_done; - io->scsiio.kern_data_ptr = (uint8_t *)beio->sg_segs; + /* For compare we have separate S/G lists for read and datamove. */ + if (lbalen->flags & CTL_LLF_COMPARE) + io->scsiio.kern_data_ptr = (uint8_t *)&beio->sg_segs[CTLBLK_HALF_SEGS]; + else + io->scsiio.kern_data_ptr = (uint8_t *)beio->sg_segs; io->scsiio.kern_data_len = beio->io_len; io->scsiio.kern_data_resid = 0; io->scsiio.kern_sg_entries = beio->num_segs; @@ -1312,7 +1420,7 @@ ctl_be_block_worker(void *context, int pending) DPRINTF("entered\n"); - mtx_lock(&be_lun->lock); + mtx_lock(&be_lun->queue_lock); for (;;) { io = (union ctl_io *)STAILQ_FIRST(&be_lun->datamove_queue); if (io != NULL) { @@ -1323,14 +1431,13 @@ ctl_be_block_worker(void *context, int pending) STAILQ_REMOVE(&be_lun->datamove_queue, &io->io_hdr, ctl_io_hdr, links); - mtx_unlock(&be_lun->lock); + mtx_unlock(&be_lun->queue_lock); - beio = (struct ctl_be_block_io *) - io->io_hdr.ctl_private[CTL_PRIV_BACKEND].ptr; + beio = (struct ctl_be_block_io *)PRIV(io)->ptr; be_lun->dispatch(be_lun, beio); - mtx_lock(&be_lun->lock); + mtx_lock(&be_lun->queue_lock); continue; } io = (union ctl_io *)STAILQ_FIRST(&be_lun->config_write_queue); @@ -1341,11 +1448,11 @@ ctl_be_block_worker(void *context, int pending) STAILQ_REMOVE(&be_lun->config_write_queue, &io->io_hdr, ctl_io_hdr, links); - mtx_unlock(&be_lun->lock); + mtx_unlock(&be_lun->queue_lock); ctl_be_block_cw_dispatch(be_lun, io); - mtx_lock(&be_lun->lock); + mtx_lock(&be_lun->queue_lock); continue; } io = (union ctl_io *)STAILQ_FIRST(&be_lun->input_queue); @@ -1354,7 +1461,7 @@ ctl_be_block_worker(void *context, int pending) STAILQ_REMOVE(&be_lun->input_queue, &io->io_hdr, ctl_io_hdr, links); - mtx_unlock(&be_lun->lock); + mtx_unlock(&be_lun->queue_lock); /* * We must drop the lock, since this routine and @@ -1362,7 +1469,7 @@ ctl_be_block_worker(void *context, int pending) */ ctl_be_block_dispatch(be_lun, io); - mtx_lock(&be_lun->lock); + mtx_lock(&be_lun->queue_lock); continue; } @@ -1372,7 +1479,7 @@ ctl_be_block_worker(void *context, int pending) */ break; } - mtx_unlock(&be_lun->lock); + mtx_unlock(&be_lun->queue_lock); } /* @@ -1383,15 +1490,11 @@ ctl_be_block_worker(void *context, int pending) static int ctl_be_block_submit(union ctl_io *io) { - struct ctl_lba_len lbalen; struct ctl_be_block_lun *be_lun; struct ctl_be_lun *ctl_be_lun; - int retval; DPRINTF("entered\n"); - retval = CTL_RETVAL_COMPLETE; - ctl_be_lun = (struct ctl_be_lun *)io->io_hdr.ctl_private[ CTL_PRIV_BACKEND_LUN].ptr; be_lun = (struct ctl_be_block_lun *)ctl_be_lun->be_lun; @@ -1402,23 +1505,19 @@ ctl_be_block_submit(union ctl_io *io) KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, ("Non-SCSI I/O (type " "%#x) encountered", io->io_hdr.io_type)); - memcpy(&lbalen, io->io_hdr.ctl_private[CTL_PRIV_LBA_LEN].bytes, - sizeof(lbalen)); - io->scsiio.kern_total_len = lbalen.len * be_lun->blocksize; - io->scsiio.kern_rel_offset = 0; + PRIV(io)->len = 0; - mtx_lock(&be_lun->lock); + mtx_lock(&be_lun->queue_lock); /* * XXX KDM make sure that links is okay to use at this point. * Otherwise, we either need to add another field to ctl_io_hdr, * or deal with resource allocation here. */ STAILQ_INSERT_TAIL(&be_lun->input_queue, &io->io_hdr, links); - mtx_unlock(&be_lun->lock); - + mtx_unlock(&be_lun->queue_lock); taskqueue_enqueue(be_lun->io_taskqueue, &be_lun->io_task); - return (retval); + return (CTL_RETVAL_COMPLETE); } static int @@ -1561,14 +1660,17 @@ ctl_be_block_open_dev(struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req) params = &req->reqdata.create; be_lun->dev_type = CTL_BE_BLOCK_DEV; - be_lun->dispatch = ctl_be_block_dispatch_dev; - be_lun->lun_flush = ctl_be_block_flush_dev; - be_lun->unmap = ctl_be_block_unmap_dev; be_lun->backend.dev.cdev = be_lun->vn->v_rdev; be_lun->backend.dev.csw = dev_refthread(be_lun->backend.dev.cdev, &be_lun->backend.dev.dev_ref); if (be_lun->backend.dev.csw == NULL) panic("Unable to retrieve device switch"); + if (strcmp(be_lun->backend.dev.csw->d_name, "zvol") == 0) + be_lun->dispatch = ctl_be_block_dispatch_zvol; + else + be_lun->dispatch = ctl_be_block_dispatch_dev; + be_lun->lun_flush = ctl_be_block_flush_dev; + be_lun->unmap = ctl_be_block_unmap_dev; error = VOP_GETATTR(be_lun->vn, &vattr, NOCRED); if (error) { @@ -1821,27 +1923,28 @@ ctl_be_block_create(struct ctl_be_block_softc *softc, struct ctl_lun_req *req) { struct ctl_be_block_lun *be_lun; struct ctl_lun_create_params *params; - struct ctl_be_arg *file_arg; + char num_thread_str[16]; char tmpstr[32]; + char *value; int retval, num_threads, unmap; - int i; + int tmp_num_threads; params = &req->reqdata.create; retval = 0; num_threads = cbb_num_threads; - file_arg = NULL; - be_lun = malloc(sizeof(*be_lun), M_CTLBLK, M_ZERO | M_WAITOK); be_lun->softc = softc; STAILQ_INIT(&be_lun->input_queue); STAILQ_INIT(&be_lun->config_write_queue); STAILQ_INIT(&be_lun->datamove_queue); - STAILQ_INIT(&be_lun->ctl_be_lun.options); sprintf(be_lun->lunname, "cblk%d", softc->num_luns); - mtx_init(&be_lun->lock, be_lun->lunname, NULL, MTX_DEF); + mtx_init(&be_lun->io_lock, "cblk io lock", NULL, MTX_DEF); + mtx_init(&be_lun->queue_lock, "cblk queue lock", NULL, MTX_DEF); + ctl_init_opts(&be_lun->ctl_be_lun.options, + req->num_be_args, req->kern_be_args); be_lun->lun_zone = uma_zcreate(be_lun->lunname, CTLBLK_MAX_SEG, NULL, NULL, NULL, NULL, /*align*/ 0, /*flags*/0); @@ -1858,24 +1961,13 @@ ctl_be_block_create(struct ctl_be_block_softc *softc, struct ctl_lun_req *req) be_lun->ctl_be_lun.lun_type = T_DIRECT; if (be_lun->ctl_be_lun.lun_type == T_DIRECT) { - for (i = 0; i < req->num_be_args; i++) { - if (strcmp(req->kern_be_args[i].kname, "file") == 0) { - file_arg = &req->kern_be_args[i]; - break; - } - } - - if (file_arg == NULL) { + value = ctl_get_opt(&be_lun->ctl_be_lun.options, "file"); + if (value == NULL) { snprintf(req->error_str, sizeof(req->error_str), "%s: no file argument specified", __func__); goto bailout_error; } - - be_lun->dev_path = malloc(file_arg->vallen, M_CTLBLK, - M_WAITOK | M_ZERO); - - strlcpy(be_lun->dev_path, (char *)file_arg->kvalue, - file_arg->vallen); + be_lun->dev_path = strdup(value, M_CTLBLK); retval = ctl_be_block_open(softc, be_lun, req); if (retval != 0) { @@ -1914,50 +2006,27 @@ ctl_be_block_create(struct ctl_be_block_softc *softc, struct ctl_lun_req *req) * XXX This searching loop might be refactored to be combined with * the loop above, */ - unmap = 0; - for (i = 0; i < req->num_be_args; i++) { - if (strcmp(req->kern_be_args[i].kname, "num_threads") == 0) { - struct ctl_be_arg *thread_arg; - char num_thread_str[16]; - int tmp_num_threads; + value = ctl_get_opt(&be_lun->ctl_be_lun.options, "num_threads"); + if (value != NULL) { + tmp_num_threads = strtol(value, NULL, 0); - - thread_arg = &req->kern_be_args[i]; - - strlcpy(num_thread_str, (char *)thread_arg->kvalue, - min(thread_arg->vallen, - sizeof(num_thread_str))); - - tmp_num_threads = strtol(num_thread_str, NULL, 0); - - /* - * We don't let the user specify less than one - * thread, but hope he's clueful enough not to - * specify 1000 threads. - */ - if (tmp_num_threads < 1) { - snprintf(req->error_str, sizeof(req->error_str), - "%s: invalid number of threads %s", - __func__, num_thread_str); - goto bailout_error; - } - - num_threads = tmp_num_threads; - } else if (strcmp(req->kern_be_args[i].kname, "unmap") == 0 && - strcmp(req->kern_be_args[i].kvalue, "on") == 0) { - unmap = 1; - } else if (strcmp(req->kern_be_args[i].kname, "file") != 0 && - strcmp(req->kern_be_args[i].kname, "dev") != 0) { - struct ctl_be_lun_option *opt; - - opt = malloc(sizeof(*opt), M_CTLBLK, M_WAITOK); - opt->name = malloc(strlen(req->kern_be_args[i].kname) + 1, M_CTLBLK, M_WAITOK); - strcpy(opt->name, req->kern_be_args[i].kname); - opt->value = malloc(strlen(req->kern_be_args[i].kvalue) + 1, M_CTLBLK, M_WAITOK); - strcpy(opt->value, req->kern_be_args[i].kvalue); - STAILQ_INSERT_TAIL(&be_lun->ctl_be_lun.options, opt, links); + /* + * We don't let the user specify less than one + * thread, but hope he's clueful enough not to + * specify 1000 threads. + */ + if (tmp_num_threads < 1) { + snprintf(req->error_str, sizeof(req->error_str), + "%s: invalid number of threads %s", + __func__, num_thread_str); + goto bailout_error; } + num_threads = tmp_num_threads; } + unmap = 0; + value = ctl_get_opt(&be_lun->ctl_be_lun.options, "unmap"); + if (value != NULL && strcmp(value, "on") == 0) + unmap = 1; be_lun->flags = CTL_BE_BLOCK_LUN_UNCONFIGURED; be_lun->ctl_be_lun.flags = CTL_LUN_FLAG_PRIMARY; @@ -2113,9 +2182,16 @@ ctl_be_block_create(struct ctl_be_block_softc *softc, struct ctl_lun_req *req) bailout_error: req->status = CTL_LUN_ERROR; + if (be_lun->io_taskqueue != NULL) + taskqueue_free(be_lun->io_taskqueue); ctl_be_block_close(be_lun); - - free(be_lun->dev_path, M_CTLBLK); + if (be_lun->dev_path != NULL) + free(be_lun->dev_path, M_CTLBLK); + if (be_lun->lun_zone != NULL) + uma_zdestroy(be_lun->lun_zone); + ctl_free_opts(&be_lun->ctl_be_lun.options); + mtx_destroy(&be_lun->queue_lock); + mtx_destroy(&be_lun->io_lock); free(be_lun, M_CTLBLK); return (retval); @@ -2201,8 +2277,10 @@ ctl_be_block_rm(struct ctl_be_block_softc *softc, struct ctl_lun_req *req) uma_zdestroy(be_lun->lun_zone); + ctl_free_opts(&be_lun->ctl_be_lun.options); free(be_lun->dev_path, M_CTLBLK); - + mtx_destroy(&be_lun->queue_lock); + mtx_destroy(&be_lun->io_lock); free(be_lun, M_CTLBLK); req->status = CTL_LUN_OK; @@ -2449,10 +2527,10 @@ ctl_be_block_config_write(union ctl_io *io) * user asked to be synced out. When they issue a sync * cache command, we'll sync out the whole thing. */ - mtx_lock(&be_lun->lock); + mtx_lock(&be_lun->queue_lock); STAILQ_INSERT_TAIL(&be_lun->config_write_queue, &io->io_hdr, links); - mtx_unlock(&be_lun->lock); + mtx_unlock(&be_lun->queue_lock); taskqueue_enqueue(be_lun->io_taskqueue, &be_lun->io_task); break; case START_STOP_UNIT: { @@ -2517,7 +2595,7 @@ ctl_be_block_lun_info(void *be_lun, struct sbuf *sb) lun = (struct ctl_be_block_lun *)be_lun; retval = 0; - retval = sbuf_printf(sb, ""); + retval = sbuf_printf(sb, "\t"); if (retval != 0) goto bailout; @@ -2527,26 +2605,7 @@ ctl_be_block_lun_info(void *be_lun, struct sbuf *sb) if (retval != 0) goto bailout; - retval = sbuf_printf(sb, ""); - - /* - * For processor devices, we don't have a path variable. - */ - if ((retval != 0) - || (lun->dev_path == NULL)) - goto bailout; - - retval = sbuf_printf(sb, ""); - - if (retval != 0) - goto bailout; - - retval = ctl_sbuf_printf_esc(sb, lun->dev_path); - - if (retval != 0) - goto bailout; - - retval = sbuf_printf(sb, "\n"); + retval = sbuf_printf(sb, "\n"); bailout: @@ -2562,7 +2621,7 @@ ctl_be_block_init(void) softc = &backend_block_softc; retval = 0; - mtx_init(&softc->lock, "ctlblk", NULL, MTX_DEF); + mtx_init(&softc->lock, "ctlblock", NULL, MTX_DEF); beio_zone = uma_zcreate("beio", sizeof(struct ctl_be_block_io), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); STAILQ_INIT(&softc->disk_list); diff --git a/sys/cam/ctl/ctl_backend_ramdisk.c b/sys/cam/ctl/ctl_backend_ramdisk.c index 57c470e9ce3..6613e8e8656 100644 --- a/sys/cam/ctl/ctl_backend_ramdisk.c +++ b/sys/cam/ctl/ctl_backend_ramdisk.c @@ -84,7 +84,7 @@ struct ctl_be_ramdisk_lun { struct taskqueue *io_taskqueue; struct task io_task; STAILQ_HEAD(, ctl_io_hdr) cont_queue; - struct mtx lock; + struct mtx_padalign queue_lock; }; struct ctl_be_ramdisk_softc { @@ -150,7 +150,7 @@ ctl_backend_ramdisk_init(void) memset(softc, 0, sizeof(*softc)); - mtx_init(&softc->lock, "ramdisk", NULL, MTX_DEF); + mtx_init(&softc->lock, "ctlramdisk", NULL, MTX_DEF); STAILQ_INIT(&softc->lun_list); softc->rd_size = 1024 * 1024; @@ -241,11 +241,11 @@ ctl_backend_ramdisk_move_done(union ctl_io *io) if ((io->io_hdr.port_status == 0) && ((io->io_hdr.flags & CTL_FLAG_ABORT) == 0) && ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE)) { - if (io->scsiio.kern_rel_offset < io->scsiio.kern_total_len) { - mtx_lock(&be_lun->lock); + if (io->io_hdr.ctl_private[CTL_PRIV_BACKEND].integer > 0) { + mtx_lock(&be_lun->queue_lock); STAILQ_INSERT_TAIL(&be_lun->cont_queue, &io->io_hdr, links); - mtx_unlock(&be_lun->lock); + mtx_unlock(&be_lun->queue_lock); taskqueue_enqueue(be_lun->io_taskqueue, &be_lun->io_task); return (0); @@ -267,27 +267,27 @@ ctl_backend_ramdisk_move_done(union ctl_io *io) /*retry_count*/ io->io_hdr.port_status); } - ctl_done(io); + ctl_data_submit_done(io); return(0); } static int ctl_backend_ramdisk_submit(union ctl_io *io) { - struct ctl_lba_len lbalen; struct ctl_be_lun *ctl_be_lun; + struct ctl_lba_len_flags *lbalen; ctl_be_lun = (struct ctl_be_lun *)io->io_hdr.ctl_private[ CTL_PRIV_BACKEND_LUN].ptr; - - memcpy(&lbalen, io->io_hdr.ctl_private[CTL_PRIV_LBA_LEN].bytes, - sizeof(lbalen)); - io->scsiio.be_move_done = ctl_backend_ramdisk_move_done; - io->scsiio.kern_total_len = lbalen.len * ctl_be_lun->blocksize; - io->scsiio.kern_rel_offset = 0; - io->scsiio.kern_data_resid = 0; + lbalen = (struct ctl_lba_len_flags *)&io->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]; + if (lbalen->flags & CTL_LLF_VERIFY) { + ctl_set_success(&io->scsiio); + ctl_data_submit_done(io); + return (CTL_RETVAL_COMPLETE); + } + io->io_hdr.ctl_private[CTL_PRIV_BACKEND].integer = + lbalen->len * ctl_be_lun->blocksize; ctl_backend_ramdisk_continue(io); - return (CTL_RETVAL_COMPLETE); } @@ -302,7 +302,7 @@ ctl_backend_ramdisk_continue(union ctl_io *io) #endif softc = &rd_softc; - len = io->scsiio.kern_total_len - io->scsiio.kern_rel_offset; + len = io->io_hdr.ctl_private[CTL_PRIV_BACKEND].integer; #ifdef CTL_RAMDISK_PAGES sg_filled = min(btoc(len), softc->num_pages); if (sg_filled > 1) { @@ -328,9 +328,12 @@ ctl_backend_ramdisk_continue(union ctl_io *io) io->scsiio.kern_data_ptr = softc->ramdisk_buffer; #endif /* CTL_RAMDISK_PAGES */ + io->scsiio.be_move_done = ctl_backend_ramdisk_move_done; + io->scsiio.kern_data_resid = 0; io->scsiio.kern_data_len = len_filled; io->scsiio.kern_sg_entries = sg_filled; io->io_hdr.flags |= CTL_FLAG_ALLOCATED; + io->io_hdr.ctl_private[CTL_PRIV_BACKEND].integer -= len_filled; #ifdef CTL_TIME_IO getbintime(&io->io_hdr.dma_start_bt); #endif @@ -347,18 +350,18 @@ ctl_backend_ramdisk_worker(void *context, int pending) be_lun = (struct ctl_be_ramdisk_lun *)context; softc = be_lun->softc; - mtx_lock(&be_lun->lock); + mtx_lock(&be_lun->queue_lock); for (;;) { io = (union ctl_io *)STAILQ_FIRST(&be_lun->cont_queue); if (io != NULL) { STAILQ_REMOVE(&be_lun->cont_queue, &io->io_hdr, ctl_io_hdr, links); - mtx_unlock(&be_lun->lock); + mtx_unlock(&be_lun->queue_lock); ctl_backend_ramdisk_continue(io); - mtx_lock(&be_lun->lock); + mtx_lock(&be_lun->queue_lock); continue; } @@ -368,7 +371,7 @@ ctl_backend_ramdisk_worker(void *context, int pending) */ break; } - mtx_unlock(&be_lun->lock); + mtx_unlock(&be_lun->queue_lock); } static int @@ -502,7 +505,8 @@ ctl_backend_ramdisk_rm(struct ctl_be_ramdisk_softc *softc, if (retval == 0) { taskqueue_drain(be_lun->io_taskqueue, &be_lun->io_task); taskqueue_free(be_lun->io_taskqueue); - mtx_destroy(&be_lun->lock); + ctl_free_opts(&be_lun->ctl_be_lun.options); + mtx_destroy(&be_lun->queue_lock); free(be_lun, M_RAMDISK); } @@ -523,8 +527,9 @@ ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc *softc, struct ctl_be_ramdisk_lun *be_lun; struct ctl_lun_create_params *params; uint32_t blocksize; + char *value; char tmpstr[32]; - int i, retval, unmap; + int retval, unmap; retval = 0; params = &req->reqdata.create; @@ -543,7 +548,8 @@ ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc *softc, goto bailout_error; } sprintf(be_lun->lunname, "cram%d", softc->num_luns); - STAILQ_INIT(&be_lun->ctl_be_lun.options); + ctl_init_opts(&be_lun->ctl_be_lun.options, + req->num_be_args, req->kern_be_args); if (params->flags & CTL_LUN_FLAG_DEV_TYPE) be_lun->ctl_be_lun.lun_type = params->device_type; @@ -581,21 +587,9 @@ ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc *softc, be_lun->softc = softc; unmap = 0; - for (i = 0; i < req->num_be_args; i++) { - if (strcmp(req->kern_be_args[i].kname, "unmap") == 0 && - strcmp(req->kern_be_args[i].kvalue, "on") == 0) { - unmap = 1; - } else { - struct ctl_be_lun_option *opt; - - opt = malloc(sizeof(*opt), M_RAMDISK, M_WAITOK); - opt->name = malloc(strlen(req->kern_be_args[i].kname) + 1, M_RAMDISK, M_WAITOK); - strcpy(opt->name, req->kern_be_args[i].kname); - opt->value = malloc(strlen(req->kern_be_args[i].kvalue) + 1, M_RAMDISK, M_WAITOK); - strcpy(opt->value, req->kern_be_args[i].kvalue); - STAILQ_INSERT_TAIL(&be_lun->ctl_be_lun.options, opt, links); - } - } + value = ctl_get_opt(&be_lun->ctl_be_lun.options, "unmap"); + if (value != NULL && strcmp(value, "on") == 0) + unmap = 1; be_lun->flags = CTL_BE_RAMDISK_LUN_UNCONFIGURED; be_lun->ctl_be_lun.flags = CTL_LUN_FLAG_PRIMARY; @@ -646,7 +640,7 @@ ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc *softc, } STAILQ_INIT(&be_lun->cont_queue); - mtx_init(&be_lun->lock, "CTL ramdisk", NULL, MTX_DEF); + mtx_init(&be_lun->queue_lock, "cram queue lock", NULL, MTX_DEF); TASK_INIT(&be_lun->io_task, /*priority*/0, ctl_backend_ramdisk_worker, be_lun); @@ -728,7 +722,8 @@ ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc *softc, if (be_lun->io_taskqueue != NULL) { taskqueue_free(be_lun->io_taskqueue); } - mtx_destroy(&be_lun->lock); + ctl_free_opts(&be_lun->ctl_be_lun.options); + mtx_destroy(&be_lun->queue_lock); free(be_lun, M_RAMDISK); } @@ -820,7 +815,7 @@ ctl_backend_ramdisk_lun_shutdown(void *be_lun) if (lun->flags & CTL_BE_RAMDISK_LUN_WAITING) { wakeup(lun); } else { - STAILQ_REMOVE(&softc->lun_list, be_lun, ctl_be_ramdisk_lun, + STAILQ_REMOVE(&softc->lun_list, lun, ctl_be_ramdisk_lun, links); softc->num_luns--; do_free = 1; diff --git a/sys/cam/ctl/ctl_cmd_table.c b/sys/cam/ctl/ctl_cmd_table.c index 145ddb46ccd..1240f2a88a3 100644 --- a/sys/cam/ctl/ctl_cmd_table.c +++ b/sys/cam/ctl/ctl_cmd_table.c @@ -58,16 +58,437 @@ #include /* - * Whenever support for a new command is added, it should be added to this - * table. + * Whenever support for a new command is added, it should be added to these + * tables. */ -struct ctl_cmd_entry ctl_cmd_table[] = + +/* 5E PERSISTENT RESERVE IN */ +const struct ctl_cmd_entry ctl_cmd_table_5e[32] = +{ +/* 00 READ KEYS */ +{ctl_persistent_reserve_in, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | + CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_IN | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_LUN_PAT_NONE, + 10, { 0x00, 0, 0, 0, 0, 0, 0xff, 0xff, 0x07}}, + +/* 01 READ RESERVATION */ +{ctl_persistent_reserve_in, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | + CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_IN | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_LUN_PAT_NONE, + 10, { 0x01, 0, 0, 0, 0, 0, 0xff, 0xff, 0x07}}, + +/* 02 REPORT CAPABILITIES */ +{ctl_persistent_reserve_in, CTL_SERIDX_INQ, CTL_CMD_FLAG_ALLOW_ON_RESV | + CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_IN | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_LUN_PAT_NONE, + 10, { 0x02, 0, 0, 0, 0, 0, 0xff, 0xff, 0x07}}, + +/* 03 READ FULL STATUS */ +{ctl_persistent_reserve_in, CTL_SERIDX_INQ, CTL_CMD_FLAG_ALLOW_ON_RESV | + CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_IN | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_LUN_PAT_NONE, + 10, { 0x03, 0, 0, 0, 0, 0, 0xff, 0xff, 0x07}}, + +/* 04-1f */ +}; + +/* 5F PERSISTENT RESERVE OUT */ +const struct ctl_cmd_entry ctl_cmd_table_5f[32] = +{ +/* 00 REGISTER */ +{ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | + CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_OUT | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_LUN_PAT_NONE, + 10, { 0x00, 0xff, 0, 0, 0xff, 0xff, 0xff, 0xff, 0x07}}, + +/* 01 RESERVE */ +{ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | + CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_OUT | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_LUN_PAT_NONE, + 10, { 0x01, 0xff, 0, 0, 0xff, 0xff, 0xff, 0xff, 0x07}}, + +/* 02 RELEASE */ +{ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | + CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_OUT | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_LUN_PAT_NONE, + 10, { 0x02, 0xff, 0, 0, 0xff, 0xff, 0xff, 0xff, 0x07}}, + +/* 03 CLEAR */ +{ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | + CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_OUT | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_LUN_PAT_NONE, + 10, { 0x03, 0xff, 0, 0, 0xff, 0xff, 0xff, 0xff, 0x07}}, + +/* 04 PREEMPT */ +{ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | + CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_OUT | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_LUN_PAT_NONE, + 10, { 0x04, 0xff, 0, 0, 0xff, 0xff, 0xff, 0xff, 0x07}}, + +/* 05 PREEMPT AND ABORT */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 06 REGISTER AND IGNORE EXISTING KEY */ +{ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | + CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_OUT | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_LUN_PAT_NONE, + 10, { 0x06, 0xff, 0, 0, 0xff, 0xff, 0xff, 0xff, 0x07}}, + +/* 07 REGISTER AND MOVE */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 08-1f */ +}; + +/* 83 EXTENDED COPY */ +const struct ctl_cmd_entry ctl_cmd_table_83[32] = +{ +/* 00 EXTENDED COPY (LID1) */ +{ctl_extended_copy_lid1, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_FLAG_DATA_OUT, + CTL_LUN_PAT_NONE, + 16, { 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, + +/* 01 EXTENDED COPY (LID4) */ +{ctl_extended_copy_lid4, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_FLAG_DATA_OUT, + CTL_LUN_PAT_NONE, + 16, { 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, + +/* 02 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 03 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 04 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 05 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 06 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 07 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 08 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 09 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0A */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0B */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0C */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0D */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0E */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0F */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 10 POPULATE TOKEN */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 11 WRITE USING TOKEN */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 12 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 13 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 14 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 15 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 16 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 17 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 18 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 19 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 1A */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 1B */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 1C COPY OPERATION ABORT */ +{ctl_copy_operation_abort, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_FLAG_DATA_NONE, + CTL_LUN_PAT_NONE, + 16, { 0x1c, 0xff, 0xff, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x07}}, +}; + +/* 84 RECEIVE COPY STATUS */ +const struct ctl_cmd_entry ctl_cmd_table_84[32] = +{ +/* 00 RECEIVE COPY STATUS (LID1) */ +{ctl_receive_copy_status_lid1, CTL_SERIDX_RD_CAP, + CTL_CMD_FLAG_OK_ON_BOTH | + CTL_FLAG_DATA_IN, + CTL_LUN_PAT_NONE, + 16, {0x00, 0xff, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, + +/* 01 RECEIVE COPY DATA (LID1) */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 02 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 03 RECEIVE COPY OPERATING PARAMETERS */ +{ctl_receive_copy_operating_parameters, CTL_SERIDX_RD_CAP, + CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_IN, + CTL_LUN_PAT_NONE, + 16, {0x03, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, + +/* 04 RECEIVE COPY FAILURE DETAILS (LID1) */ +{ctl_receive_copy_failure_details, CTL_SERIDX_RD_CAP, + CTL_CMD_FLAG_OK_ON_BOTH | + CTL_FLAG_DATA_IN, + CTL_LUN_PAT_NONE, + 16, {0x04, 0xff, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, + +/* 05 RECEIVE COPY STATUS (LID4) */ +{ctl_receive_copy_status_lid4, CTL_SERIDX_RD_CAP, + CTL_CMD_FLAG_OK_ON_BOTH | + CTL_FLAG_DATA_IN, + CTL_LUN_PAT_NONE, + 16, {0x05, 0xff, 0xff, 0xff, 0xff, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, + +/* 06 RECEIVE COPY DATA (LID4)*/ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 07 RECEIVE ROD TOKEN INFORMATION */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 08 REPORT ALL ROD TOKENS */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, +}; + +/* 9E SERVICE ACTION IN(16) */ +const struct ctl_cmd_entry ctl_cmd_table_9e[32] = +{ +/* 00 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 01 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 02 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 03 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 04 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 05 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 06 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 07 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 08 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 09 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0A */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0B */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0C */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0D */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0E */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0F */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 10 */ +{ctl_read_capacity_16, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_SLUN | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_IN | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_LUN_PAT_READCAP, + 16, {0x10, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, + +/* 11-1f */ +}; + +/* A3 MAINTENANCE IN */ +const struct ctl_cmd_entry ctl_cmd_table_a3[32] = +{ +/* 00 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 01 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 02 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 03 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 04 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 05 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 06 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 07 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 08 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 09 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0A REPORT TARGET PORT GROUPS */ +{ctl_report_tagret_port_groups, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_IN, + CTL_LUN_PAT_NONE, + 12, {0x0a, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, + +/* 0B */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0C REPORT SUPPORTED_OPCODES */ +{ctl_report_supported_opcodes, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_IN, + CTL_LUN_PAT_NONE, + 12, {0x0c, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, + +/* 0D REPORT SUPPORTED_TASK MANAGEMENT FUNCTIONS */ +{ctl_report_supported_tmf, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_IN, + CTL_LUN_PAT_NONE, + 12, {0x0d, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, + +/* 0E */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0F REPORT TIMESTAMP */ +{ctl_report_timestamp, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_IN, + CTL_LUN_PAT_NONE, + 12, {0x0f, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, + +/* 10-1f */ +}; + +const struct ctl_cmd_entry ctl_cmd_table[256] = { /* 00 TEST UNIT READY */ {ctl_tur, CTL_SERIDX_TUR, CTL_CMD_FLAG_OK_ON_BOTH | CTL_FLAG_DATA_NONE | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, - CTL_LUN_PAT_TUR}, + CTL_LUN_PAT_TUR, 6, {0, 0, 0, 0, 0x07}}, /* 01 REWIND */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -85,13 +506,13 @@ struct ctl_cmd_entry ctl_cmd_table[] = CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, - CTL_LUN_PAT_NONE}, + CTL_LUN_PAT_NONE, 6, {0x01, 0, 0, 0xff, 0x07}}, /* 04 FORMAT UNIT */ {ctl_format, CTL_SERIDX_FORMAT, CTL_CMD_FLAG_OK_ON_SLUN | CTL_CMD_FLAG_OK_ON_INOPERABLE | CTL_FLAG_DATA_OUT, - CTL_LUN_PAT_NONE}, + CTL_LUN_PAT_NONE, 6, {0xff, 0, 0, 0, 0x07}}, /* 05 READ BLOCK LIMITS */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -106,7 +527,7 @@ struct ctl_cmd_entry ctl_cmd_table[] = {ctl_read_write, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_SLUN | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, - CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE}, + CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE, 6, {0x1f, 0xff, 0xff, 0xff, 0x07}}, /* 09 */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -114,7 +535,7 @@ struct ctl_cmd_entry ctl_cmd_table[] = /* 0A WRITE(6) */ {ctl_read_write, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_SLUN | CTL_FLAG_DATA_OUT, - CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE}, + CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE, 6, {0x1f, 0xff, 0xff, 0xff, 0x07}}, /* 0B SEEK(6) */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -147,7 +568,7 @@ struct ctl_cmd_entry ctl_cmd_table[] = CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, - CTL_LUN_PAT_NONE}, + CTL_LUN_PAT_NONE, 6, {0xe1, 0xff, 0xff, 0xff, 0x07}}, /* 13 */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -161,25 +582,25 @@ struct ctl_cmd_entry ctl_cmd_table[] = CTL_CMD_FLAG_OK_ON_INOPERABLE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT, - CTL_LUN_PAT_NONE}, + CTL_LUN_PAT_NONE, 6, {0x11, 0, 0, 0xff, 0x07}}, /* 16 RESERVE(6) */ -{ctl_scsi_reserve, CTL_SERIDX_RESV, CTL_CMD_FLAG_ALLOW_ON_RESV | +{ctl_scsi_reserve, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT, - CTL_LUN_PAT_NONE}, + CTL_LUN_PAT_NONE, 6, {0, 0, 0, 0, 0x07}}, /* 17 RELEASE(6) */ -{ctl_scsi_release, CTL_SERIDX_REL, CTL_CMD_FLAG_ALLOW_ON_RESV | +{ctl_scsi_release, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_NONE, - CTL_LUN_PAT_NONE}, + CTL_LUN_PAT_NONE, 6, {0, 0, 0, 0, 0x07}}, /* 18 COPY */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -192,8 +613,9 @@ struct ctl_cmd_entry ctl_cmd_table[] = CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | CTL_CMD_FLAG_OK_ON_SECONDARY | - CTL_FLAG_DATA_IN, - CTL_LUN_PAT_NONE}, + CTL_FLAG_DATA_IN | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_LUN_PAT_NONE, 6, {0x08, 0xff, 0, 0xff, 0x07}}, /* 1B START STOP UNIT */ {ctl_start_stop, CTL_SERIDX_START, CTL_CMD_FLAG_OK_ON_SLUN | @@ -202,7 +624,7 @@ struct ctl_cmd_entry ctl_cmd_table[] = CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_FLAG_DATA_NONE | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, - CTL_LUN_PAT_NONE}, + CTL_LUN_PAT_NONE, 6, {0x01, 0, 0, 0x03, 0x07}}, /* 1C RECEIVE DIAGNOSTIC RESULTS */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -238,7 +660,7 @@ struct ctl_cmd_entry ctl_cmd_table[] = CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, - CTL_LUN_PAT_READCAP}, + CTL_LUN_PAT_READCAP, 10, {0, 0, 0, 0, 0, 0, 0, 0, 0x07}}, /* 26 */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -250,14 +672,16 @@ struct ctl_cmd_entry ctl_cmd_table[] = {ctl_read_write, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_SLUN | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, - CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE}, + CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE, + 10, {0x18, 0xff, 0xff, 0xff, 0xff, 0, 0xff, 0xff, 0x07}}, /* 29 READ GENERATION */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 2A WRITE(10) */ {ctl_read_write, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_SLUN| CTL_FLAG_DATA_OUT, - CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE}, + CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE, + 10, {0x18, 0xff, 0xff, 0xff, 0xff, 0, 0xff, 0xff, 0x07}}, /* 2B SEEK(10) */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -270,10 +694,15 @@ struct ctl_cmd_entry ctl_cmd_table[] = /* 2E WRITE AND VERIFY(10) */ {ctl_read_write, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_SLUN| CTL_FLAG_DATA_OUT, - CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE}, + CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE, + 10, {0x10, 0xff, 0xff, 0xff, 0xff, 0, 0xff, 0xff, 0x07}}, /* 2F VERIFY(10) */ -{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, +{ctl_verify, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_SLUN | + CTL_FLAG_DATA_OUT | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE, + 10, {0x16, 0xff, 0xff, 0xff, 0xff, 0, 0xff, 0xff, 0x07}}, /* 30 SEARCH DATA HIGH(10) */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -293,7 +722,8 @@ struct ctl_cmd_entry ctl_cmd_table[] = /* 35 SYNCHRONIZE CACHE(10) */ {ctl_sync_cache, CTL_SERIDX_START, CTL_CMD_FLAG_OK_ON_SLUN | CTL_FLAG_DATA_NONE, - CTL_LUN_PAT_NONE}, + CTL_LUN_PAT_NONE, + 10, {0, 0xff, 0xff, 0xff, 0xff, 0, 0xff, 0xff, 0x07}}, /* 36 LOCK UNLOCK CACHE(10) */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -311,12 +741,17 @@ struct ctl_cmd_entry ctl_cmd_table[] = {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 3B WRITE BUFFER */ -{ctl_write_buffer, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_PROC | - CTL_FLAG_DATA_OUT, - CTL_LUN_PAT_NONE}, +{ctl_write_buffer, CTL_SERIDX_MD_SEL, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_FLAG_DATA_OUT, + CTL_LUN_PAT_NONE, + 10, {0x1f, 0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07}}, /* 3C READ BUFFER */ -{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, +{ctl_read_buffer, CTL_SERIDX_MD_SNS, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_FLAG_DATA_IN | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_LUN_PAT_NONE, + 10, {0x1f, 0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07}}, /* 3D UPDATE BLOCK */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -333,11 +768,13 @@ struct ctl_cmd_entry ctl_cmd_table[] = /* 41 WRITE SAME(10) */ {ctl_write_same, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_SLUN | CTL_FLAG_DATA_OUT, - CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE}, + CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE, + 10, {0x0a, 0xff, 0xff, 0xff, 0xff, 0, 0xff, 0xff, 0x07}}, /* 42 READ SUB-CHANNEL / UNMAP */ {ctl_unmap, CTL_SERIDX_UNMAP, CTL_CMD_FLAG_OK_ON_SLUN | CTL_FLAG_DATA_OUT, - CTL_LUN_PAT_WRITE}, + CTL_LUN_PAT_WRITE, + 10, {0, 0, 0, 0, 0, 0, 0xff, 0xff, 0x07}}, /* 43 READ TOC/PMA/ATIP */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -399,25 +836,25 @@ struct ctl_cmd_entry ctl_cmd_table[] = CTL_CMD_FLAG_OK_ON_INOPERABLE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT, - CTL_LUN_PAT_NONE}, + CTL_LUN_PAT_NONE, 10, {0x11, 0, 0, 0, 0, 0, 0xff, 0xff, 0x07} }, /* 56 RESERVE(10) */ -{ctl_scsi_reserve, CTL_SERIDX_RESV, CTL_CMD_FLAG_ALLOW_ON_RESV | +{ctl_scsi_reserve, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT, - CTL_LUN_PAT_NONE}, + CTL_LUN_PAT_NONE, 10, {0x02, 0, 0xff, 0, 0, 0, 0xff, 0xff, 0x07} }, /* 57 RELEASE(10) */ -{ctl_scsi_release, CTL_SERIDX_REL, CTL_CMD_FLAG_ALLOW_ON_RESV | +{ctl_scsi_release, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT, - CTL_LUN_PAT_NONE}, + CTL_LUN_PAT_NONE, 10, {0x02, 0, 0xff, 0, 0, 0, 0xff, 0xff, 0x07} }, /* 58 REPAIR TRACK */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -430,8 +867,9 @@ struct ctl_cmd_entry ctl_cmd_table[] = CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | CTL_CMD_FLAG_OK_ON_SECONDARY | - CTL_FLAG_DATA_IN, - CTL_LUN_PAT_NONE}, + CTL_FLAG_DATA_IN | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_LUN_PAT_NONE, 10, {0x18, 0xff, 0, 0, 0, 0, 0xff, 0xff, 0x07} }, /* 5B CLOSE TRACK/SESSION */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -443,29 +881,13 @@ struct ctl_cmd_entry ctl_cmd_table[] = {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 5E PERSISTENT RESERVE IN */ -{ctl_persistent_reserve_in, CTL_SERIDX_PRES_IN, CTL_CMD_FLAG_ALLOW_ON_RESV | - CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | - CTL_CMD_FLAG_OK_ON_SECONDARY | - CTL_FLAG_DATA_IN | - CTL_CMD_FLAG_ALLOW_ON_PR_RESV, +{__DECONST(ctl_opfunc *, ctl_cmd_table_5e), CTL_SERIDX_INVLD, CTL_CMD_FLAG_SA5, CTL_LUN_PAT_NONE}, -//{ctl_persistent_reserve_in, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE}, - /* 5F PERSISTENT RESERVE OUT */ -{ctl_persistent_reserve_out, CTL_SERIDX_PRES_OUT, CTL_CMD_FLAG_ALLOW_ON_RESV | - CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE| - CTL_CMD_FLAG_OK_ON_SECONDARY | - CTL_FLAG_DATA_OUT | - CTL_CMD_FLAG_ALLOW_ON_PR_RESV, +{__DECONST(ctl_opfunc *, ctl_cmd_table_5f), CTL_SERIDX_INVLD, CTL_CMD_FLAG_SA5, CTL_LUN_PAT_NONE}, -//{ctl_persistent_reserve_out, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE}, - /* 60 */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -572,10 +994,12 @@ struct ctl_cmd_entry ctl_cmd_table[] = {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 83 EXTENDED COPY */ -{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, +{__DECONST(ctl_opfunc *, ctl_cmd_table_83), CTL_SERIDX_INVLD, CTL_CMD_FLAG_SA5, + CTL_LUN_PAT_NONE}, /* 84 RECEIVE COPY RESULTS */ -{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, +{__DECONST(ctl_opfunc *, ctl_cmd_table_84), CTL_SERIDX_INVLD, CTL_CMD_FLAG_SA5, + CTL_LUN_PAT_NONE}, /* 85 */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -589,14 +1013,21 @@ struct ctl_cmd_entry ctl_cmd_table[] = /* 88 READ(16) */ {ctl_read_write, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_SLUN | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, - CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE}, + CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE, + 16, {0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, -/* 89 */ -{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, +/* 89 COMPARE AND WRITE */ +{ctl_cnw, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_SLUN| CTL_FLAG_DATA_OUT, + CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE, + 16, {0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0, 0, 0, 0xff, 0, 0x07}}, /* 8A WRITE(16) */ {ctl_read_write, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_SLUN| CTL_FLAG_DATA_OUT, - CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE}, + CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE, + 16, {0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, /* 8B */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -609,10 +1040,17 @@ struct ctl_cmd_entry ctl_cmd_table[] = /* 8E WRITE AND VERIFY(16) */ {ctl_read_write, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_SLUN| CTL_FLAG_DATA_OUT, - CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE}, + CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE, + 16, {0x10, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, /* 8F VERIFY(16) */ -{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, +{ctl_verify, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_SLUN | + CTL_FLAG_DATA_OUT | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE, + 16, {0x16, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, /* 90 PRE-FETCH(16) */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -620,7 +1058,9 @@ struct ctl_cmd_entry ctl_cmd_table[] = /* 91 SYNCHRONIZE CACHE(16) */ {ctl_sync_cache, CTL_SERIDX_START, CTL_CMD_FLAG_OK_ON_SLUN | CTL_FLAG_DATA_NONE, - CTL_LUN_PAT_NONE}, + CTL_LUN_PAT_NONE, + 16, {0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, /* 92 LOCK UNLOCK CACHE(16) */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -628,7 +1068,9 @@ struct ctl_cmd_entry ctl_cmd_table[] = /* 93 WRITE SAME(16) */ {ctl_write_same, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_SLUN | CTL_FLAG_DATA_OUT, - CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE}, + CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE, + 16, {0x0a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, /* 94 */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -661,14 +1103,8 @@ struct ctl_cmd_entry ctl_cmd_table[] = {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 9E SERVICE ACTION IN(16) */ -/* XXX KDM not all service actions will be read capacity!! */ -{ctl_service_action_in, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_SLUN | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | - CTL_CMD_FLAG_OK_ON_SECONDARY | - CTL_FLAG_DATA_IN | - CTL_CMD_FLAG_ALLOW_ON_PR_RESV, - CTL_LUN_PAT_READCAP}, +{__DECONST(ctl_opfunc *, ctl_cmd_table_9e), CTL_SERIDX_INVLD, CTL_CMD_FLAG_SA5, + CTL_LUN_PAT_NONE}, /* 9F SERVICE ACTION OUT(16) */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -683,7 +1119,8 @@ struct ctl_cmd_entry ctl_cmd_table[] = CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, - CTL_LUN_PAT_NONE}, + CTL_LUN_PAT_NONE, + 12, {0, 0xff, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, /* A1 BLANK */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -691,15 +1128,11 @@ struct ctl_cmd_entry ctl_cmd_table[] = /* A2 SEND EVENT */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, -/* A3 MAINTENANCE (IN) Service Action - (0A) REPORT TARGET PORT GROUP */ -{ctl_maintenance_in, CTL_SERIDX_MAIN_IN, CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | - CTL_CMD_FLAG_OK_ON_SECONDARY | - CTL_FLAG_DATA_IN, +/* A3 MAINTENANCE IN */ +{__DECONST(ctl_opfunc *, ctl_cmd_table_a3), CTL_SERIDX_INVLD, CTL_CMD_FLAG_SA5, CTL_LUN_PAT_NONE}, -/* A4 MAINTENANCE (OUT) */ +/* A4 MAINTENANCE OUT */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* A5 MOVE MEDIUM */ @@ -714,14 +1147,16 @@ struct ctl_cmd_entry ctl_cmd_table[] = /* A8 READ(12) */ {ctl_read_write, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_SLUN | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, - CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE}, + CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE, + 12, {0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, /* A9 PLAY TRACK RELATIVE(12) */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* AA WRITE(12) */ {ctl_read_write, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_SLUN| CTL_FLAG_DATA_OUT, - CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE}, + CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE, + 12, {0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, /* AB SERVICE ACTION IN(12) */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -734,10 +1169,15 @@ struct ctl_cmd_entry ctl_cmd_table[] = /* AE WRITE AND VERIFY(12) */ {ctl_read_write, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_SLUN| CTL_FLAG_DATA_OUT, - CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE}, + CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE, + 12, {0x10, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, /* AF VERIFY(12) */ -{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, +{ctl_verify, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_SLUN | + CTL_FLAG_DATA_OUT | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE, + 12, {0x16, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, /* B0 SEARCH DATA HIGH(12) */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -769,43 +1209,51 @@ struct ctl_cmd_entry ctl_cmd_table[] = /* B9 READ CD MSF */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, -/* BA REDUNDANCY GROUP (IN) */ +/* BA REDUNDANCY GROUP IN */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, -/* BB REDUNDANCY GROUP (OUT) */ +/* BB REDUNDANCY GROUP OUT */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, -/* BC SPARE (IN) */ +/* BC SPARE IN */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, -/* BD SPARE (OUT) */ +/* BD SPARE OUT */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, -/* BE VOLUME SET (IN) */ +/* BE VOLUME SET IN */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, -/* BF VOLUME SET (OUT) */ +/* BF VOLUME SET OUT */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* C0 - ISC_SEND_MSG_SHORT */ //{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE}, {ctl_isc, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_PROC | CTL_FLAG_DATA_NONE, - CTL_LUN_PAT_NONE}, + CTL_LUN_PAT_NONE, + 16, {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}, /* C1 - ISC_SEND_MSG */ //{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE}, {ctl_isc, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_PROC | CTL_FLAG_DATA_OUT, - CTL_LUN_PAT_NONE}, + CTL_LUN_PAT_NONE, + 16, {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}, /* C2 - ISC_WRITE */ //{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE}, {ctl_isc, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_PROC | CTL_FLAG_DATA_OUT, - CTL_LUN_PAT_NONE}, + CTL_LUN_PAT_NONE, + 16, {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}, /* C3 - ISC_READ */ //{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE}, {ctl_isc, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_PROC | CTL_FLAG_DATA_IN, - CTL_LUN_PAT_NONE}, + CTL_LUN_PAT_NONE, + 16, {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}, /* C4 */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, diff --git a/sys/cam/ctl/ctl_error.c b/sys/cam/ctl/ctl_error.c index 4425b2d608a..6ecb54bee75 100644 --- a/sys/cam/ctl/ctl_error.c +++ b/sys/cam/ctl/ctl_error.c @@ -401,6 +401,11 @@ ctl_build_ua(ctl_ua_type ua_type, struct scsi_sense_data *sense, asc = 0x29; ascq = 0x03; break; + case CTL_UA_I_T_NEXUS_LOSS: + /* 29h/07h I_T NEXUS LOSS OCCURRED */ + asc = 0x29; + ascq = 0x07; + break; case CTL_UA_LUN_RESET: /* 29h/00h POWER ON, RESET, OR BUS DEVICE RESET OCCURRED */ /* @@ -789,6 +794,18 @@ ctl_set_busy(struct ctl_scsiio *ctsio) ctsio->io_hdr.status = CTL_SCSI_ERROR; } +void +ctl_set_task_aborted(struct ctl_scsiio *ctsio) +{ + struct scsi_sense_data *sense; + + sense = &ctsio->sense_data; + memset(sense, 0, sizeof(*sense)); + ctsio->scsi_status = SCSI_STATUS_TASK_ABORTED; + ctsio->sense_len = 0; + ctsio->io_hdr.status = CTL_CMD_ABORTED; +} + void ctl_set_success(struct ctl_scsiio *ctsio) { diff --git a/sys/cam/ctl/ctl_error.h b/sys/cam/ctl/ctl_error.h index 1d8bd9b7d1b..62596d0a1a4 100644 --- a/sys/cam/ctl/ctl_error.h +++ b/sys/cam/ctl/ctl_error.h @@ -80,6 +80,7 @@ void ctl_set_data_phase_error(struct ctl_scsiio *ctsio); void ctl_set_reservation_conflict(struct ctl_scsiio *ctsio); void ctl_set_queue_full(struct ctl_scsiio *ctsio); void ctl_set_busy(struct ctl_scsiio *ctsio); +void ctl_set_task_aborted(struct ctl_scsiio *ctsio); void ctl_set_success(struct ctl_scsiio *ctsio); #endif /* _CTL_ERROR_H_ */ diff --git a/sys/cam/ctl/ctl_frontend.c b/sys/cam/ctl/ctl_frontend.c index 2bc6ade4641..34b4a9ef587 100644 --- a/sys/cam/ctl/ctl_frontend.c +++ b/sys/cam/ctl/ctl_frontend.c @@ -66,7 +66,77 @@ __FBSDID("$FreeBSD$"); extern struct ctl_softc *control_softc; int -ctl_frontend_register(struct ctl_frontend *fe, int master_shelf) +ctl_frontend_register(struct ctl_frontend *fe) +{ + struct ctl_frontend *fe_tmp; + + KASSERT(control_softc != NULL, ("CTL is not initialized")); + + /* + * Sanity check, make sure this isn't a duplicate registration. + */ + mtx_lock(&control_softc->ctl_lock); + STAILQ_FOREACH(fe_tmp, &control_softc->fe_list, links) { + if (strcmp(fe_tmp->name, fe->name) == 0) { + mtx_unlock(&control_softc->ctl_lock); + return (-1); + } + } + mtx_unlock(&control_softc->ctl_lock); + STAILQ_INIT(&fe->port_list); + + /* + * Call the frontend's initialization routine. + */ + if (fe->init != NULL) + fe->init(); + + mtx_lock(&control_softc->ctl_lock); + control_softc->num_frontends++; + STAILQ_INSERT_TAIL(&control_softc->fe_list, fe, links); + mtx_unlock(&control_softc->ctl_lock); + return (0); +} + +int +ctl_frontend_deregister(struct ctl_frontend *fe) +{ + + if (!STAILQ_EMPTY(&fe->port_list)) + return (-1); + + mtx_lock(&control_softc->ctl_lock); + STAILQ_REMOVE(&control_softc->fe_list, fe, ctl_frontend, links); + control_softc->num_frontends--; + mtx_unlock(&control_softc->ctl_lock); + + /* + * Call the frontend's shutdown routine. + */ + if (fe->shutdown != NULL) + fe->shutdown(); + return (0); +} + +struct ctl_frontend * +ctl_frontend_find(char *frontend_name) +{ + struct ctl_softc *ctl_softc = control_softc; + struct ctl_frontend *fe; + + mtx_lock(&ctl_softc->ctl_lock); + STAILQ_FOREACH(fe, &ctl_softc->fe_list, links) { + if (strcmp(fe->name, frontend_name) == 0) { + mtx_unlock(&ctl_softc->ctl_lock); + return (fe); + } + } + mtx_unlock(&ctl_softc->ctl_lock); + return (NULL); +} + +int +ctl_port_register(struct ctl_port *port, int master_shelf) { struct ctl_io_pool *pool; int port_num; @@ -80,13 +150,24 @@ ctl_frontend_register(struct ctl_frontend *fe, int master_shelf) port_num = ctl_ffz(&control_softc->ctl_port_mask, CTL_MAX_PORTS); if ((port_num == -1) || (ctl_set_mask(&control_softc->ctl_port_mask, port_num) == -1)) { - fe->targ_port = -1; + port->targ_port = -1; mtx_unlock(&control_softc->ctl_lock); return (1); } - control_softc->num_frontends++; - + control_softc->num_ports++; mtx_unlock(&control_softc->ctl_lock); + + /* + * Initialize the initiator and portname mappings + */ + port->max_initiators = CTL_MAX_INIT_PER_PORT; + port->wwpn_iid = malloc(sizeof(*port->wwpn_iid) * port->max_initiators, + M_CTL, M_NOWAIT | M_ZERO); + if (port->wwpn_iid == NULL) { + retval = ENOMEM; + goto error; + } + /* * We add 20 to whatever the caller requests, so he doesn't get * burned by queueing things back to the pending sense queue. In @@ -95,90 +176,137 @@ ctl_frontend_register(struct ctl_frontend *fe, int master_shelf) * pending sense queue on the next command, whether or not it is * a REQUEST SENSE. */ - retval = ctl_pool_create(control_softc, - (fe->port_type != CTL_PORT_IOCTL) ? - CTL_POOL_FETD : CTL_POOL_IOCTL, - fe->num_requested_ctl_io + 20, &pool); + retval = ctl_pool_create(control_softc, CTL_POOL_FETD, + port->num_requested_ctl_io + 20, &pool); if (retval != 0) { - fe->targ_port = -1; + free(port->wwpn_iid, M_CTL); +error: + port->targ_port = -1; mtx_lock(&control_softc->ctl_lock); ctl_clear_mask(&control_softc->ctl_port_mask, port_num); mtx_unlock(&control_softc->ctl_lock); return (retval); } + port->ctl_pool_ref = pool; + + if (port->options.stqh_first == NULL) + STAILQ_INIT(&port->options); mtx_lock(&control_softc->ctl_lock); - - /* For now assume master shelf */ - //fe->targ_port = port_num; - fe->targ_port = port_num + (master_shelf!=0 ? 0 : CTL_MAX_PORTS); - fe->max_initiators = CTL_MAX_INIT_PER_PORT; - STAILQ_INSERT_TAIL(&control_softc->fe_list, fe, links); - control_softc->ctl_ports[port_num] = fe; - + port->targ_port = port_num + (master_shelf != 0 ? 0 : CTL_MAX_PORTS); + STAILQ_INSERT_TAIL(&port->frontend->port_list, port, fe_links); + STAILQ_INSERT_TAIL(&control_softc->port_list, port, links); + control_softc->ctl_ports[port_num] = port; mtx_unlock(&control_softc->ctl_lock); - fe->ctl_pool_ref = pool; - return (retval); } int -ctl_frontend_deregister(struct ctl_frontend *fe) +ctl_port_deregister(struct ctl_port *port) { struct ctl_io_pool *pool; - int port_num; - int retval; + int port_num, retval, i; retval = 0; - pool = (struct ctl_io_pool *)fe->ctl_pool_ref; + pool = (struct ctl_io_pool *)port->ctl_pool_ref; - if (fe->targ_port == -1) { + if (port->targ_port == -1) { retval = 1; goto bailout; } mtx_lock(&control_softc->ctl_lock); - STAILQ_REMOVE(&control_softc->fe_list, fe, ctl_frontend, links); - control_softc->num_frontends--; - port_num = (fe->targ_port < CTL_MAX_PORTS) ? fe->targ_port : - fe->targ_port - CTL_MAX_PORTS; + STAILQ_REMOVE(&control_softc->port_list, port, ctl_port, links); + STAILQ_REMOVE(&port->frontend->port_list, port, ctl_port, fe_links); + control_softc->num_ports--; + port_num = (port->targ_port < CTL_MAX_PORTS) ? port->targ_port : + port->targ_port - CTL_MAX_PORTS; ctl_clear_mask(&control_softc->ctl_port_mask, port_num); control_softc->ctl_ports[port_num] = NULL; mtx_unlock(&control_softc->ctl_lock); ctl_pool_free(pool); + ctl_free_opts(&port->options); + + free(port->port_devid, M_CTL); + port->port_devid = NULL; + free(port->target_devid, M_CTL); + port->target_devid = NULL; + free(port->init_devid, M_CTL); + port->init_devid = NULL; + for (i = 0; i < port->max_initiators; i++) + free(port->wwpn_iid[i].name, M_CTL); + free(port->wwpn_iid, M_CTL); bailout: return (retval); } void -ctl_frontend_set_wwns(struct ctl_frontend *fe, int wwnn_valid, uint64_t wwnn, +ctl_port_set_wwns(struct ctl_port *port, int wwnn_valid, uint64_t wwnn, int wwpn_valid, uint64_t wwpn) { - if (wwnn_valid) - fe->wwnn = wwnn; + struct scsi_vpd_id_descriptor *desc; + int len, proto; - if (wwpn_valid) - fe->wwpn = wwpn; + if (port->port_type == CTL_PORT_FC) + proto = SCSI_PROTO_FC << 4; + else if (port->port_type == CTL_PORT_ISCSI) + proto = SCSI_PROTO_ISCSI << 4; + else + proto = SCSI_PROTO_SPI << 4; + + if (wwnn_valid) { + port->wwnn = wwnn; + + free(port->target_devid, M_CTL); + + len = sizeof(struct scsi_vpd_device_id) + CTL_WWPN_LEN; + port->target_devid = malloc(sizeof(struct ctl_devid) + len, + M_CTL, M_WAITOK | M_ZERO); + port->target_devid->len = len; + desc = (struct scsi_vpd_id_descriptor *)port->target_devid->data; + desc->proto_codeset = proto | SVPD_ID_CODESET_BINARY; + desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_TARGET | + SVPD_ID_TYPE_NAA; + desc->length = CTL_WWPN_LEN; + scsi_u64to8b(port->wwnn, desc->identifier); + } + + if (wwpn_valid) { + port->wwpn = wwpn; + + free(port->port_devid, M_CTL); + + len = sizeof(struct scsi_vpd_device_id) + CTL_WWPN_LEN; + port->port_devid = malloc(sizeof(struct ctl_devid) + len, + M_CTL, M_WAITOK | M_ZERO); + port->port_devid->len = len; + desc = (struct scsi_vpd_id_descriptor *)port->port_devid->data; + desc->proto_codeset = proto | SVPD_ID_CODESET_BINARY; + desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT | + SVPD_ID_TYPE_NAA; + desc->length = CTL_WWPN_LEN; + scsi_u64to8b(port->wwpn, desc->identifier); + } } void -ctl_frontend_online(struct ctl_frontend *fe) +ctl_port_online(struct ctl_port *port) { - fe->port_online(fe->onoff_arg); + port->port_online(port->onoff_arg); /* XXX KDM need a lock here? */ - fe->status |= CTL_PORT_STATUS_ONLINE; + port->status |= CTL_PORT_STATUS_ONLINE; } void -ctl_frontend_offline(struct ctl_frontend *fe) +ctl_port_offline(struct ctl_port *port) { - fe->port_offline(fe->onoff_arg); + port->port_offline(port->onoff_arg); /* XXX KDM need a lock here? */ - fe->status &= ~CTL_PORT_STATUS_ONLINE; + port->status &= ~CTL_PORT_STATUS_ONLINE; } /* diff --git a/sys/cam/ctl/ctl_frontend.h b/sys/cam/ctl/ctl_frontend.h index 23f91b4a810..825ff50a0bc 100644 --- a/sys/cam/ctl/ctl_frontend.h +++ b/sys/cam/ctl/ctl_frontend.h @@ -46,12 +46,46 @@ typedef enum { CTL_PORT_STATUS_LUN_ONLINE = 0x04 } ctl_port_status; +typedef int (*fe_init_t)(void); +typedef void (*fe_shutdown_t)(void); typedef void (*port_func_t)(void *onoff_arg); -typedef int (*targ_func_t)(void *arg, struct ctl_id targ_id); +typedef int (*port_info_func_t)(void *onoff_arg, struct sbuf *sb); typedef int (*lun_func_t)(void *arg, struct ctl_id targ_id, int lun_id); +typedef uint32_t (*lun_map_func_t)(void *arg, uint32_t lun_id); typedef int (*fe_ioctl_t)(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td); -typedef int (*fe_devid_t)(struct ctl_scsiio *ctsio, int alloc_len); + +#define CTL_FRONTEND_DECLARE(name, driver) \ + static int name ## _modevent(module_t mod, int type, void *data) \ + { \ + switch (type) { \ + case MOD_LOAD: \ + ctl_frontend_register( \ + (struct ctl_frontend *)data); \ + break; \ + case MOD_UNLOAD: \ + printf(#name " module unload - not possible for this module type\n"); \ + return EINVAL; \ + default: \ + return EOPNOTSUPP; \ + } \ + return 0; \ + } \ + static moduledata_t name ## _mod = { \ + #name, \ + name ## _modevent, \ + (void *)&driver \ + }; \ + DECLARE_MODULE(name, name ## _mod, SI_SUB_CONFIGURE, SI_ORDER_FOURTH); \ + MODULE_DEPEND(name, ctl, 1, 1, 1); \ + MODULE_DEPEND(name, cam, 1, 1, 1) + +struct ctl_wwpn_iid { + int in_use; + time_t last_use; + uint64_t wwpn; + char *name; +}; /* * The ctl_frontend structure is the registration mechanism between a FETD @@ -105,30 +139,6 @@ typedef int (*fe_devid_t)(struct ctl_scsiio *ctsio, int alloc_len); * and port_offline(). This is specified by the * FETD. * - * targ_enable(): This function is called, with targ_lun_arg and a - * target ID as its arguments, by CTL when it wants - * the FETD to enable a particular target. targ_enable() - * will always be called for a particular target ID - * before any LUN is enabled for that target. If the - * FETD does not support enabling targets, but rather - * LUNs, it should ignore this call and return 0. If - * the FETD does support enabling targets, it should - * return 0 for success and non-zero if it cannot - * enable the given target. - * - * TODO: Add the ability to specify a WWID here. - * - * targ_disable(): This function is called, with targ_lun_arg and a - * target ID as its arguments, by CTL when it wants - * the FETD to disable a particular target. - * targ_disable() will always be called for a - * particular target ID after all LUNs are disabled - * on that particular target. If the FETD does not - * support enabling targets, it should ignore this - * call and return 0. If the FETD does support - * enabling targets, it should return 0 for success, - * and non-zero if it cannot disable the given target. - * * lun_enable(): This function is called, with targ_lun_arg, a target * ID and a LUN ID as its arguments, by CTL when it * wants the FETD to enable a particular LUN. If the @@ -203,7 +213,8 @@ typedef int (*fe_devid_t)(struct ctl_scsiio *ctsio, int alloc_len); * links: Linked list pointers, used by CTL. The FETD * shouldn't touch this field. */ -struct ctl_frontend { +struct ctl_port { + struct ctl_frontend *frontend; ctl_port_type port_type; /* passed to CTL */ int num_requested_ctl_io; /* passed to CTL */ char *port_name; /* passed to CTL */ @@ -211,25 +222,38 @@ struct ctl_frontend { int virtual_port; /* passed to CTL */ port_func_t port_online; /* passed to CTL */ port_func_t port_offline; /* passed to CTL */ + port_info_func_t port_info; /* passed to CTL */ void *onoff_arg; /* passed to CTL */ - targ_func_t targ_enable; /* passed to CTL */ - targ_func_t targ_disable; /* passed to CTL */ lun_func_t lun_enable; /* passed to CTL */ lun_func_t lun_disable; /* passed to CTL */ - fe_ioctl_t ioctl; /* passed to CTL */ - fe_devid_t devid; /* passed to CTL */ + lun_map_func_t lun_map; /* passed to CTL */ void *targ_lun_arg; /* passed to CTL */ void (*fe_datamove)(union ctl_io *io); /* passed to CTL */ void (*fe_done)(union ctl_io *io); /* passed to CTL */ - void (*fe_dump)(void); /* passed to CTL */ int max_targets; /* passed to CTL */ int max_target_id; /* passed to CTL */ int32_t targ_port; /* passed back to FETD */ void *ctl_pool_ref; /* passed back to FETD */ uint32_t max_initiators; /* passed back to FETD */ + struct ctl_wwpn_iid *wwpn_iid; /* used by CTL */ uint64_t wwnn; /* set by CTL before online */ uint64_t wwpn; /* set by CTL before online */ ctl_port_status status; /* used by CTL */ + ctl_options_t options; /* passed to CTL */ + struct ctl_devid *port_devid; /* passed to CTL */ + struct ctl_devid *target_devid; /* passed to CTL */ + struct ctl_devid *init_devid; /* passed to CTL */ + STAILQ_ENTRY(ctl_port) fe_links; /* used by CTL */ + STAILQ_ENTRY(ctl_port) links; /* used by CTL */ +}; + +struct ctl_frontend { + char name[CTL_DRIVER_NAME_LEN]; /* passed to CTL */ + fe_init_t init; /* passed to CTL */ + fe_ioctl_t ioctl; /* passed to CTL */ + void (*fe_dump)(void); /* passed to CTL */ + fe_shutdown_t shutdown; /* passed to CTL */ + STAILQ_HEAD(, ctl_port) port_list; /* used by CTL */ STAILQ_ENTRY(ctl_frontend) links; /* used by CTL */ }; @@ -237,7 +261,7 @@ struct ctl_frontend { * This may block until resources are allocated. Called at FETD module load * time. Returns 0 for success, non-zero for failure. */ -int ctl_frontend_register(struct ctl_frontend *fe, int master_SC); +int ctl_frontend_register(struct ctl_frontend *fe); /* * Called at FETD module unload time. @@ -245,21 +269,38 @@ int ctl_frontend_register(struct ctl_frontend *fe, int master_SC); */ int ctl_frontend_deregister(struct ctl_frontend *fe); +/* + * Find the frontend by its name. Returns NULL if not found. + */ +struct ctl_frontend * ctl_frontend_find(char *frontend_name); + +/* + * This may block until resources are allocated. Called at FETD module load + * time. Returns 0 for success, non-zero for failure. + */ +int ctl_port_register(struct ctl_port *port, int master_SC); + +/* + * Called at FETD module unload time. + * Returns 0 for success, non-zero for failure. + */ +int ctl_port_deregister(struct ctl_port *port); + /* * Called to set the WWNN and WWPN for a particular frontend. */ -void ctl_frontend_set_wwns(struct ctl_frontend *fe, int wwnn_valid, +void ctl_port_set_wwns(struct ctl_port *port, int wwnn_valid, uint64_t wwnn, int wwpn_valid, uint64_t wwpn); /* * Called to bring a particular frontend online. */ -void ctl_frontend_online(struct ctl_frontend *fe); +void ctl_port_online(struct ctl_port *fe); /* * Called to take a particular frontend offline. */ -void ctl_frontend_offline(struct ctl_frontend *fe); +void ctl_port_offline(struct ctl_port *fe); /* * This routine queues I/O and task management requests from the FETD to the @@ -280,21 +321,18 @@ int ctl_queue(union ctl_io *io); int ctl_queue_sense(union ctl_io *io); /* - * This routine adds an initiator to CTL's port database. The WWPN should - * be the FC WWPN, if available. The targ_port field should be the same as - * the targ_port passed back from CTL in the ctl_frontend structure above. + * This routine adds an initiator to CTL's port database. + * The iid field should be the same as the iid passed in the nexus of each + * ctl_io from this initiator. + * The WWPN should be the FC WWPN, if available. + */ +int ctl_add_initiator(struct ctl_port *port, int iid, uint64_t wwpn, char *name); + +/* + * This routine will remove an initiator from CTL's port database. * The iid field should be the same as the iid passed in the nexus of each * ctl_io from this initiator. */ -int ctl_add_initiator(uint64_t wwpn, int32_t targ_port, uint32_t iid); - -/* - * This routine will remove an initiator from CTL's port database. The - * targ_port field should be the same as the targ_port passed back in the - * ctl_frontend structure above. The iid field should be the same as the - * iid passed in the nexus of each ctl_io from this initiator. - */ -int -ctl_remove_initiator(int32_t targ_port, uint32_t iid); +int ctl_remove_initiator(struct ctl_port *port, int iid); #endif /* _CTL_FRONTEND_H_ */ diff --git a/sys/cam/ctl/ctl_frontend_cam_sim.c b/sys/cam/ctl/ctl_frontend_cam_sim.c index 37366e56854..72f8dd81c8b 100644 --- a/sys/cam/ctl/ctl_frontend_cam_sim.c +++ b/sys/cam/ctl/ctl_frontend_cam_sim.c @@ -74,13 +74,12 @@ struct cfcs_io { }; struct cfcs_softc { - struct ctl_frontend fe; + struct ctl_port port; char port_name[32]; struct cam_sim *sim; struct cam_devq *devq; struct cam_path *path; struct mtx lock; - char lock_desc[32]; uint64_t wwnn; uint64_t wwpn; uint32_t cur_tag_num; @@ -97,12 +96,9 @@ struct cfcs_softc { CAM_SENSE_PHYS) int cfcs_init(void); -void cfcs_shutdown(void); static void cfcs_poll(struct cam_sim *sim); static void cfcs_online(void *arg); static void cfcs_offline(void *arg); -static int cfcs_targ_enable(void *arg, struct ctl_id targ_id); -static int cfcs_targ_disable(void *arg, struct ctl_id targ_id); static int cfcs_lun_enable(void *arg, struct ctl_id target_id, int lun_id); static int cfcs_lun_disable(void *arg, struct ctl_id target_id, int lun_id); static void cfcs_datamove(union ctl_io *io); @@ -124,25 +120,19 @@ SYSCTL_NODE(_kern_cam, OID_AUTO, ctl2cam, CTLFLAG_RD, 0, SYSCTL_INT(_kern_cam_ctl2cam, OID_AUTO, max_sense, CTLFLAG_RW, &cfcs_max_sense, 0, "Maximum sense data size"); -static int cfcs_module_event_handler(module_t, int /*modeventtype_t*/, void *); - -static moduledata_t cfcs_moduledata = { - "ctlcfcs", - cfcs_module_event_handler, - NULL +static struct ctl_frontend cfcs_frontend = +{ + .name = "camsim", + .init = cfcs_init, }; - -DECLARE_MODULE(ctlcfcs, cfcs_moduledata, SI_SUB_CONFIGURE, SI_ORDER_FOURTH); -MODULE_VERSION(ctlcfcs, 1); -MODULE_DEPEND(ctlcfi, ctl, 1, 1, 1); -MODULE_DEPEND(ctlcfi, cam, 1, 1, 1); +CTL_FRONTEND_DECLARE(ctlcfcs, cfcs_frontend); int cfcs_init(void) { struct cfcs_softc *softc; struct ccb_setasync csa; - struct ctl_frontend *fe; + struct ctl_port *port; #ifdef NEEDTOPORT char wwnn[8]; #endif @@ -151,34 +141,32 @@ cfcs_init(void) softc = &cfcs_softc; retval = 0; bzero(softc, sizeof(*softc)); - sprintf(softc->lock_desc, "ctl2cam"); - mtx_init(&softc->lock, softc->lock_desc, NULL, MTX_DEF); - fe = &softc->fe; + mtx_init(&softc->lock, "ctl2cam", NULL, MTX_DEF); + port = &softc->port; - fe->port_type = CTL_PORT_INTERNAL; + port->frontend = &cfcs_frontend; + port->port_type = CTL_PORT_INTERNAL; /* XXX KDM what should the real number be here? */ - fe->num_requested_ctl_io = 4096; - snprintf(softc->port_name, sizeof(softc->port_name), "ctl2cam"); - fe->port_name = softc->port_name; - fe->port_online = cfcs_online; - fe->port_offline = cfcs_offline; - fe->onoff_arg = softc; - fe->targ_enable = cfcs_targ_enable; - fe->targ_disable = cfcs_targ_disable; - fe->lun_enable = cfcs_lun_enable; - fe->lun_disable = cfcs_lun_disable; - fe->targ_lun_arg = softc; - fe->fe_datamove = cfcs_datamove; - fe->fe_done = cfcs_done; + port->num_requested_ctl_io = 4096; + snprintf(softc->port_name, sizeof(softc->port_name), "camsim"); + port->port_name = softc->port_name; + port->port_online = cfcs_online; + port->port_offline = cfcs_offline; + port->onoff_arg = softc; + port->lun_enable = cfcs_lun_enable; + port->lun_disable = cfcs_lun_disable; + port->targ_lun_arg = softc; + port->fe_datamove = cfcs_datamove; + port->fe_done = cfcs_done; /* XXX KDM what should we report here? */ /* XXX These should probably be fetched from CTL. */ - fe->max_targets = 1; - fe->max_target_id = 15; + port->max_targets = 1; + port->max_target_id = 15; - retval = ctl_frontend_register(fe, /*master_SC*/ 1); + retval = ctl_port_register(port, /*master_SC*/ 1); if (retval != 0) { - printf("%s: ctl_frontend_register() failed with error %d!\n", + printf("%s: ctl_port_register() failed with error %d!\n", __func__, retval); mtx_destroy(&softc->lock); return (retval); @@ -190,30 +178,29 @@ cfcs_init(void) #ifdef NEEDTOPORT ddb_GetWWNN((char *)wwnn); softc->wwnn = be64dec(wwnn); - softc->wwpn = softc->wwnn + (softc->fe.targ_port & 0xff); + softc->wwpn = softc->wwnn + (softc->port.targ_port & 0xff); #endif /* * If the CTL frontend didn't tell us what our WWNN/WWPN is, go * ahead and set something random. */ - if (fe->wwnn == 0) { + if (port->wwnn == 0) { uint64_t random_bits; arc4rand(&random_bits, sizeof(random_bits), 0); softc->wwnn = (random_bits & 0x0000000fffffff00ULL) | /* Company ID */ 0x5000000000000000ULL | /* NL-Port */ 0x0300; - softc->wwpn = softc->wwnn + fe->targ_port + 1; - fe->wwnn = softc->wwnn; - fe->wwpn = softc->wwpn; + softc->wwpn = softc->wwnn + port->targ_port + 1; + ctl_port_set_wwns(port, true, softc->wwnn, true, softc->wwpn); } else { - softc->wwnn = fe->wwnn; - softc->wwpn = fe->wwpn; + softc->wwnn = port->wwnn; + softc->wwpn = port->wwpn; } mtx_lock(&softc->lock); - softc->devq = cam_simq_alloc(fe->num_requested_ctl_io); + softc->devq = cam_simq_alloc(port->num_requested_ctl_io); if (softc->devq == NULL) { printf("%s: error allocating devq\n", __func__); retval = ENOMEM; @@ -222,7 +209,7 @@ cfcs_init(void) softc->sim = cam_sim_alloc(cfcs_action, cfcs_poll, softc->port_name, softc, /*unit*/ 0, &softc->lock, 1, - fe->num_requested_ctl_io, softc->devq); + port->num_requested_ctl_io, softc->devq); if (softc->sim == NULL) { printf("%s: error allocating SIM\n", __func__); retval = ENOMEM; @@ -273,26 +260,6 @@ cfcs_poll(struct cam_sim *sim) } -void -cfcs_shutdown(void) -{ - -} - -static int -cfcs_module_event_handler(module_t mod, int what, void *arg) -{ - - switch (what) { - case MOD_LOAD: - return (cfcs_init()); - case MOD_UNLOAD: - return (EBUSY); - default: - return (EOPNOTSUPP); - } -} - static void cfcs_onoffline(void *arg, int online) { @@ -335,18 +302,6 @@ cfcs_offline(void *arg) cfcs_onoffline(arg, /*online*/ 0); } -static int -cfcs_targ_enable(void *arg, struct ctl_id targ_id) -{ - return (0); -} - -static int -cfcs_targ_disable(void *arg, struct ctl_id targ_id) -{ - return (0); -} - static int cfcs_lun_enable(void *arg, struct ctl_id target_id, int lun_id) { @@ -505,6 +460,10 @@ cfcs_done(union ctl_io *io) union ccb *ccb; ccb = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr; + if (ccb == NULL) { + ctl_free_io(io); + return; + } /* * At this point we should have status. If we don't, that's a bug. @@ -586,7 +545,7 @@ cfcs_action(struct cam_sim *sim, union ccb *ccb) return; } - io = ctl_alloc_io(softc->fe.ctl_pool_ref); + io = ctl_alloc_io(softc->port.ctl_pool_ref); if (io == NULL) { printf("%s: can't allocate ctl_io\n", __func__); ccb->ccb_h.status = CAM_BUSY | CAM_DEV_QFRZN; @@ -605,7 +564,7 @@ cfcs_action(struct cam_sim *sim, union ccb *ccb) */ io->io_hdr.io_type = CTL_IO_SCSI; io->io_hdr.nexus.initid.id = 1; - io->io_hdr.nexus.targ_port = softc->fe.targ_port; + io->io_hdr.nexus.targ_port = softc->port.targ_port; /* * XXX KDM how do we handle target IDs? */ @@ -681,7 +640,7 @@ cfcs_action(struct cam_sim *sim, union ccb *ccb) return; } - io = ctl_alloc_io(softc->fe.ctl_pool_ref); + io = ctl_alloc_io(softc->port.ctl_pool_ref); if (io == NULL) { ccb->ccb_h.status = CAM_BUSY | CAM_DEV_QFRZN; xpt_freeze_devq(ccb->ccb_h.path, 1); @@ -696,7 +655,7 @@ cfcs_action(struct cam_sim *sim, union ccb *ccb) io->io_hdr.io_type = CTL_IO_TASK; io->io_hdr.nexus.initid.id = 1; - io->io_hdr.nexus.targ_port = softc->fe.targ_port; + io->io_hdr.nexus.targ_port = softc->port.targ_port; io->io_hdr.nexus.targ_target.id = ccb->ccb_h.target_id; io->io_hdr.nexus.targ_lun = ccb->ccb_h.target_lun; io->taskio.task_action = CTL_TASK_ABORT_TASK; @@ -753,7 +712,7 @@ cfcs_action(struct cam_sim *sim, union ccb *ccb) fc->bitrate = 800000; fc->wwnn = softc->wwnn; fc->wwpn = softc->wwpn; - fc->port = softc->fe.targ_port; + fc->port = softc->port.targ_port; fc->valid |= CTS_FC_VALID_WWNN | CTS_FC_VALID_WWPN | CTS_FC_VALID_PORT; ccb->ccb_h.status = CAM_REQ_CMP; @@ -776,7 +735,7 @@ cfcs_action(struct cam_sim *sim, union ccb *ccb) return; } - io = ctl_alloc_io(softc->fe.ctl_pool_ref); + io = ctl_alloc_io(softc->port.ctl_pool_ref); if (io == NULL) { ccb->ccb_h.status = CAM_BUSY | CAM_DEV_QFRZN; xpt_freeze_devq(ccb->ccb_h.path, 1); @@ -786,12 +745,13 @@ cfcs_action(struct cam_sim *sim, union ccb *ccb) ctl_zero_io(io); /* Save pointers on both sides */ - io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = ccb; + if (ccb->ccb_h.func_code == XPT_RESET_DEV) + io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = ccb; ccb->ccb_h.io_ptr = io; io->io_hdr.io_type = CTL_IO_TASK; io->io_hdr.nexus.initid.id = 0; - io->io_hdr.nexus.targ_port = softc->fe.targ_port; + io->io_hdr.nexus.targ_port = softc->port.targ_port; io->io_hdr.nexus.targ_target.id = ccb->ccb_h.target_id; io->io_hdr.nexus.targ_lun = ccb->ccb_h.target_lun; if (ccb->ccb_h.func_code == XPT_RESET_BUS) @@ -845,7 +805,7 @@ cfcs_action(struct cam_sim *sim, union ccb *ccb) cpi->transport_version = 0; cpi->xport_specific.fc.wwnn = softc->wwnn; cpi->xport_specific.fc.wwpn = softc->wwpn; - cpi->xport_specific.fc.port = softc->fe.targ_port; + cpi->xport_specific.fc.port = softc->port.targ_port; cpi->xport_specific.fc.bitrate = 8 * 1000 * 1000; cpi->ccb_h.status = CAM_REQ_CMP; break; diff --git a/sys/cam/ctl/ctl_frontend_internal.c b/sys/cam/ctl/ctl_frontend_internal.c index 85eec748221..ac972f30642 100644 --- a/sys/cam/ctl/ctl_frontend_internal.c +++ b/sys/cam/ctl/ctl_frontend_internal.c @@ -173,7 +173,7 @@ typedef enum { } cfi_flags; struct cfi_softc { - struct ctl_frontend fe; + struct ctl_port port; char fe_name[40]; struct mtx lock; cfi_flags flags; @@ -192,8 +192,6 @@ int cfi_init(void); void cfi_shutdown(void) __unused; static void cfi_online(void *arg); static void cfi_offline(void *arg); -static int cfi_targ_enable(void *arg, struct ctl_id targ_id); -static int cfi_targ_disable(void *arg, struct ctl_id targ_id); static int cfi_lun_enable(void *arg, struct ctl_id target_id, int lun_id); static int cfi_lun_disable(void *arg, struct ctl_id target_id, int lun_id); static void cfi_datamove(union ctl_io *io); @@ -216,28 +214,24 @@ static void cfi_metatask_io_done(union ctl_io *io); static void cfi_err_recovery_done(union ctl_io *io); static void cfi_lun_io_done(union ctl_io *io); -static int cfi_module_event_handler(module_t, int /*modeventtype_t*/, void *); - -static moduledata_t cfi_moduledata = { - "ctlcfi", - cfi_module_event_handler, - NULL +static struct ctl_frontend cfi_frontend = +{ + .name = "kernel", + .init = cfi_init, + .shutdown = cfi_shutdown, }; - -DECLARE_MODULE(ctlcfi, cfi_moduledata, SI_SUB_CONFIGURE, SI_ORDER_FOURTH); -MODULE_VERSION(ctlcfi, 1); -MODULE_DEPEND(ctlcfi, ctl, 1, 1, 1); +CTL_FRONTEND_DECLARE(ctlcfi, cfi_frontend); int cfi_init(void) { struct cfi_softc *softc; - struct ctl_frontend *fe; + struct ctl_port *port; int retval; softc = &fetd_internal_softc; - fe = &softc->fe; + port = &softc->port; retval = 0; @@ -254,24 +248,23 @@ cfi_init(void) STAILQ_INIT(&softc->lun_list); STAILQ_INIT(&softc->metatask_list); - sprintf(softc->fe_name, "CTL internal"); - fe->port_type = CTL_PORT_INTERNAL; - fe->num_requested_ctl_io = 100; - fe->port_name = softc->fe_name; - fe->port_online = cfi_online; - fe->port_offline = cfi_offline; - fe->onoff_arg = softc; - fe->targ_enable = cfi_targ_enable; - fe->targ_disable = cfi_targ_disable; - fe->lun_enable = cfi_lun_enable; - fe->lun_disable = cfi_lun_disable; - fe->targ_lun_arg = softc; - fe->fe_datamove = cfi_datamove; - fe->fe_done = cfi_done; - fe->max_targets = 15; - fe->max_target_id = 15; + sprintf(softc->fe_name, "kernel"); + port->frontend = &cfi_frontend; + port->port_type = CTL_PORT_INTERNAL; + port->num_requested_ctl_io = 100; + port->port_name = softc->fe_name; + port->port_online = cfi_online; + port->port_offline = cfi_offline; + port->onoff_arg = softc; + port->lun_enable = cfi_lun_enable; + port->lun_disable = cfi_lun_disable; + port->targ_lun_arg = softc; + port->fe_datamove = cfi_datamove; + port->fe_done = cfi_done; + port->max_targets = 15; + port->max_target_id = 15; - if (ctl_frontend_register(fe, (softc->flags & CTL_FLAG_MASTER_SHELF)) != 0) + if (ctl_port_register(port, (softc->flags & CTL_FLAG_MASTER_SHELF)) != 0) { printf("%s: internal frontend registration failed\n", __func__); return (0); @@ -295,27 +288,13 @@ cfi_shutdown(void) /* * XXX KDM need to clear out any I/O pending on each LUN. */ - if (ctl_frontend_deregister(&softc->fe) != 0) + if (ctl_port_deregister(&softc->port) != 0) printf("%s: ctl_frontend_deregister() failed\n", __func__); uma_zdestroy(cfi_lun_zone); uma_zdestroy(cfi_metatask_zone); } -static int -cfi_module_event_handler(module_t mod, int what, void *arg) -{ - - switch (what) { - case MOD_LOAD: - return (cfi_init()); - case MOD_UNLOAD: - return (EBUSY); - default: - return (EOPNOTSUPP); - } -} - static void cfi_online(void *arg) { @@ -346,18 +325,6 @@ cfi_offline(void *arg) softc->flags &= ~CFI_ONLINE; } -static int -cfi_targ_enable(void *arg, struct ctl_id targ_id) -{ - return (0); -} - -static int -cfi_targ_disable(void *arg, struct ctl_id targ_id) -{ - return (0); -} - static int cfi_lun_enable(void *arg, struct ctl_id target_id, int lun_id) { @@ -734,7 +701,7 @@ cfi_init_io(union ctl_io *io, struct cfi_lun *lun, struct cfi_lun_io *lun_io; io->io_hdr.nexus.initid.id = 7; - io->io_hdr.nexus.targ_port = lun->softc->fe.targ_port; + io->io_hdr.nexus.targ_port = lun->softc->port.targ_port; io->io_hdr.nexus.targ_target.id = lun->target_id.id; io->io_hdr.nexus.targ_lun = lun->lun_id; io->io_hdr.retries = retries; @@ -795,7 +762,7 @@ cfi_done(union ctl_io *io) union ctl_io *new_io; struct cfi_lun_io *new_lun_io; - new_io = ctl_alloc_io(softc->fe.ctl_pool_ref); + new_io = ctl_alloc_io(softc->port.ctl_pool_ref); if (new_io == NULL) { printf("%s: unable to allocate ctl_io for " "error recovery\n", __func__); @@ -1001,7 +968,7 @@ cfi_lun_probe(struct cfi_lun *lun, int have_lock) struct cfi_lun_io *lun_io; union ctl_io *io; - io = ctl_alloc_io(lun->softc->fe.ctl_pool_ref); + io = ctl_alloc_io(lun->softc->port.ctl_pool_ref); if (io == NULL) { printf("%s: unable to alloc ctl_io for target %ju " "lun %d probe\n", __func__, @@ -1048,7 +1015,7 @@ cfi_lun_probe(struct cfi_lun *lun, int have_lock) uint8_t *dataptr; union ctl_io *io; - io = ctl_alloc_io(lun->softc->fe.ctl_pool_ref); + io = ctl_alloc_io(lun->softc->port.ctl_pool_ref); if (io == NULL) { printf("%s: unable to alloc ctl_io for target %ju " "lun %d probe\n", __func__, @@ -1429,7 +1396,7 @@ cfi_action(struct cfi_metatask *metatask) if (SID_TYPE(&lun->inq_data) != T_DIRECT) continue; da_luns++; - io = ctl_alloc_io(softc->fe.ctl_pool_ref); + io = ctl_alloc_io(softc->port.ctl_pool_ref); if (io != NULL) { ios_allocated++; STAILQ_INSERT_TAIL(&tmp_io_list, &io->io_hdr, @@ -1583,7 +1550,7 @@ cfi_action(struct cfi_metatask *metatask) } - io = ctl_alloc_io(softc->fe.ctl_pool_ref); + io = ctl_alloc_io(softc->port.ctl_pool_ref); if (io == NULL) { metatask->status = CFI_MT_ERROR; metatask->taskinfo.bbrread.status = CFI_BBR_NO_MEM; diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index fbe46b40a5c..8953ece5fd0 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -85,19 +85,15 @@ static uma_zone_t cfiscsi_data_wait_zone; SYSCTL_NODE(_kern_cam_ctl, OID_AUTO, iscsi, CTLFLAG_RD, 0, "CAM Target Layer iSCSI Frontend"); static int debug = 3; -TUNABLE_INT("kern.cam.ctl.iscsi.debug", &debug); SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO, debug, CTLFLAG_RWTUN, &debug, 1, "Enable debug messages"); static int ping_timeout = 5; -TUNABLE_INT("kern.cam.ctl.iscsi.ping_timeout", &ping_timeout); SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO, ping_timeout, CTLFLAG_RWTUN, &ping_timeout, 5, "Interval between ping (NOP-Out) requests, in seconds"); static int login_timeout = 60; -TUNABLE_INT("kern.cam.ctl.iscsi.login_timeout", &login_timeout); SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO, login_timeout, CTLFLAG_RWTUN, &login_timeout, 60, "Time to wait for ctld(8) to finish Login Phase, in seconds"); static int maxcmdsn_delta = 256; -TUNABLE_INT("kern.cam.ctl.iscsi.maxcmdsn_delta", &maxcmdsn_delta); SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO, maxcmdsn_delta, CTLFLAG_RWTUN, &maxcmdsn_delta, 256, "Number of commands the initiator can send " "without confirmation"); @@ -149,18 +145,16 @@ SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO, maxcmdsn_delta, CTLFLAG_RWTUN, int cfiscsi_init(void); static void cfiscsi_online(void *arg); static void cfiscsi_offline(void *arg); -static int cfiscsi_targ_enable(void *arg, struct ctl_id targ_id); -static int cfiscsi_targ_disable(void *arg, struct ctl_id targ_id); +static int cfiscsi_info(void *arg, struct sbuf *sb); static int cfiscsi_lun_enable(void *arg, struct ctl_id target_id, int lun_id); static int cfiscsi_lun_disable(void *arg, struct ctl_id target_id, int lun_id); +static uint32_t cfiscsi_lun_map(void *arg, uint32_t lun); static int cfiscsi_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td); -static int cfiscsi_devid(struct ctl_scsiio *ctsio, int alloc_len); static void cfiscsi_datamove(union ctl_io *io); static void cfiscsi_done(union ctl_io *io); -static uint32_t cfiscsi_map_lun(void *arg, uint32_t lun); static bool cfiscsi_pdu_update_cmdsn(const struct icl_pdu *request); static void cfiscsi_pdu_handle_nop_out(struct icl_pdu *request); static void cfiscsi_pdu_handle_scsi_command(struct icl_pdu *request); @@ -170,23 +164,21 @@ static void cfiscsi_pdu_handle_logout_request(struct icl_pdu *request); static void cfiscsi_session_terminate(struct cfiscsi_session *cs); static struct cfiscsi_target *cfiscsi_target_find(struct cfiscsi_softc *softc, const char *name); +static struct cfiscsi_target *cfiscsi_target_find_or_create( + struct cfiscsi_softc *softc, const char *name, const char *alias); static void cfiscsi_target_release(struct cfiscsi_target *ct); static void cfiscsi_session_delete(struct cfiscsi_session *cs); static struct cfiscsi_softc cfiscsi_softc; extern struct ctl_softc *control_softc; -static int cfiscsi_module_event_handler(module_t, int /*modeventtype_t*/, void *); - -static moduledata_t cfiscsi_moduledata = { - "ctlcfiscsi", - cfiscsi_module_event_handler, - NULL +static struct ctl_frontend cfiscsi_frontend = +{ + .name = "iscsi", + .init = cfiscsi_init, + .ioctl = cfiscsi_ioctl, }; - -DECLARE_MODULE(ctlcfiscsi, cfiscsi_moduledata, SI_SUB_CONFIGURE, SI_ORDER_FOURTH); -MODULE_VERSION(ctlcfiscsi, 1); -MODULE_DEPEND(ctlcfiscsi, ctl, 1, 1, 1); +CTL_FRONTEND_DECLARE(ctlcfiscsi, cfiscsi_frontend); MODULE_DEPEND(ctlcfiscsi, icl, 1, 1, 1); static struct icl_pdu * @@ -547,7 +539,7 @@ cfiscsi_pdu_handle_scsi_command(struct icl_pdu *request) cfiscsi_session_terminate(cs); return; } - io = ctl_alloc_io(cs->cs_target->ct_softc->fe.ctl_pool_ref); + io = ctl_alloc_io(cs->cs_target->ct_port.ctl_pool_ref); if (io == NULL) { CFISCSI_SESSION_WARN(cs, "can't allocate ctl_io; " "dropping connection"); @@ -559,11 +551,9 @@ cfiscsi_pdu_handle_scsi_command(struct icl_pdu *request) io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = request; io->io_hdr.io_type = CTL_IO_SCSI; io->io_hdr.nexus.initid.id = cs->cs_ctl_initid; - io->io_hdr.nexus.targ_port = cs->cs_target->ct_softc->fe.targ_port; + io->io_hdr.nexus.targ_port = cs->cs_target->ct_port.targ_port; io->io_hdr.nexus.targ_target.id = 0; io->io_hdr.nexus.targ_lun = cfiscsi_decode_lun(bhssc->bhssc_lun); - io->io_hdr.nexus.lun_map_fn = cfiscsi_map_lun; - io->io_hdr.nexus.lun_map_arg = cs; io->scsiio.tag_num = bhssc->bhssc_initiator_task_tag; switch ((bhssc->bhssc_flags & BHSSC_FLAGS_ATTR)) { case BHSSC_FLAGS_ATTR_UNTAGGED: @@ -613,7 +603,7 @@ cfiscsi_pdu_handle_task_request(struct icl_pdu *request) cs = PDU_SESSION(request); bhstmr = (struct iscsi_bhs_task_management_request *)request->ip_bhs; - io = ctl_alloc_io(cs->cs_target->ct_softc->fe.ctl_pool_ref); + io = ctl_alloc_io(cs->cs_target->ct_port.ctl_pool_ref); if (io == NULL) { CFISCSI_SESSION_WARN(cs, "can't allocate ctl_io;" "dropping connection"); @@ -625,11 +615,9 @@ cfiscsi_pdu_handle_task_request(struct icl_pdu *request) io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = request; io->io_hdr.io_type = CTL_IO_TASK; io->io_hdr.nexus.initid.id = cs->cs_ctl_initid; - io->io_hdr.nexus.targ_port = cs->cs_target->ct_softc->fe.targ_port; + io->io_hdr.nexus.targ_port = cs->cs_target->ct_port.targ_port; io->io_hdr.nexus.targ_target.id = 0; io->io_hdr.nexus.targ_lun = cfiscsi_decode_lun(bhstmr->bhstmr_lun); - io->io_hdr.nexus.lun_map_fn = cfiscsi_map_lun; - io->io_hdr.nexus.lun_map_arg = cs; io->taskio.tag_type = CTL_TAG_SIMPLE; /* XXX */ switch (bhstmr->bhstmr_function & ~0x80) { @@ -640,6 +628,12 @@ cfiscsi_pdu_handle_task_request(struct icl_pdu *request) io->taskio.task_action = CTL_TASK_ABORT_TASK; io->taskio.tag_num = bhstmr->bhstmr_referenced_task_tag; break; + case BHSTMR_FUNCTION_ABORT_TASK_SET: +#if 0 + CFISCSI_SESSION_DEBUG(cs, "BHSTMR_FUNCTION_ABORT_TASK_SET"); +#endif + io->taskio.task_action = CTL_TASK_ABORT_TASK_SET; + break; case BHSTMR_FUNCTION_LOGICAL_UNIT_RESET: #if 0 CFISCSI_SESSION_DEBUG(cs, "BHSTMR_FUNCTION_LOGICAL_UNIT_RESET"); @@ -737,12 +731,15 @@ cfiscsi_handle_data_segment(struct icl_pdu *request, struct cfiscsi_data_wait *c buffer_offset = ntohl(bhsdo->bhsdo_buffer_offset); else buffer_offset = 0; + len = icl_pdu_data_segment_length(request); /* * Make sure the offset, as sent by the initiator, matches the offset * we're supposed to be at in the scatter-gather list. */ - if (buffer_offset != + if (buffer_offset > + io->scsiio.kern_rel_offset + io->scsiio.ext_data_filled || + buffer_offset + len <= io->scsiio.kern_rel_offset + io->scsiio.ext_data_filled) { CFISCSI_SESSION_WARN(cs, "received bad buffer offset %zd, " "expected %zd; dropping connection", buffer_offset, @@ -758,8 +755,8 @@ cfiscsi_handle_data_segment(struct icl_pdu *request, struct cfiscsi_data_wait *c * to buffer_offset, which is the offset within the task (SCSI * command). */ - off = 0; - len = icl_pdu_data_segment_length(request); + off = io->scsiio.kern_rel_offset + io->scsiio.ext_data_filled - + buffer_offset; /* * Iterate over the scatter/gather segments, filling them with data @@ -816,12 +813,8 @@ cfiscsi_handle_data_segment(struct icl_pdu *request, struct cfiscsi_data_wait *c * This obviously can only happen with SCSI Command PDU. */ if ((request->ip_bhs->bhs_opcode & ~ISCSI_BHS_OPCODE_IMMEDIATE) == - ISCSI_BHS_OPCODE_SCSI_COMMAND) { - CFISCSI_SESSION_DEBUG(cs, "received too much immediate " - "data: got %zd bytes, expected %zd", - icl_pdu_data_segment_length(request), off); + ISCSI_BHS_OPCODE_SCSI_COMMAND) return (true); - } CFISCSI_SESSION_WARN(cs, "received too much data: got %zd bytes, " "expected %zd; dropping connection", @@ -1043,71 +1036,61 @@ cfiscsi_callout(void *context) static void cfiscsi_session_terminate_tasks(struct cfiscsi_session *cs) { - struct cfiscsi_data_wait *cdw, *tmpcdw; + struct cfiscsi_data_wait *cdw; union ctl_io *io; - int error; + int error, last; -#ifdef notyet - io = ctl_alloc_io(cs->cs_target->ct_softc->fe.ctl_pool_ref); + io = ctl_alloc_io(cs->cs_target->ct_port.ctl_pool_ref); if (io == NULL) { CFISCSI_SESSION_WARN(cs, "can't allocate ctl_io"); return; } ctl_zero_io(io); - io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = NULL; + io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = cs; io->io_hdr.io_type = CTL_IO_TASK; io->io_hdr.nexus.initid.id = cs->cs_ctl_initid; - io->io_hdr.nexus.targ_port = cs->cs_target->ct_softc->fe.targ_port; + io->io_hdr.nexus.targ_port = cs->cs_target->ct_port.targ_port; io->io_hdr.nexus.targ_target.id = 0; - io->io_hdr.nexus.targ_lun = lun; + io->io_hdr.nexus.targ_lun = 0; io->taskio.tag_type = CTL_TAG_SIMPLE; /* XXX */ - io->taskio.task_action = CTL_TASK_ABORT_TASK_SET; + io->taskio.task_action = CTL_TASK_I_T_NEXUS_RESET; + refcount_acquire(&cs->cs_outstanding_ctl_pdus); error = ctl_queue(io); if (error != CTL_RETVAL_COMPLETE) { CFISCSI_SESSION_WARN(cs, "ctl_queue() failed; error %d", error); + refcount_release(&cs->cs_outstanding_ctl_pdus); ctl_free_io(io); } -#else - /* - * CTL doesn't currently support CTL_TASK_ABORT_TASK_SET, so instead - * just iterate over tasks that are waiting for something - data - and - * terminate those. - */ + CFISCSI_SESSION_LOCK(cs); - TAILQ_FOREACH_SAFE(cdw, - &cs->cs_waiting_for_data_out, cdw_next, tmpcdw) { - io = ctl_alloc_io(cs->cs_target->ct_softc->fe.ctl_pool_ref); - if (io == NULL) { - CFISCSI_SESSION_WARN(cs, "can't allocate ctl_io"); - return; - } - ctl_zero_io(io); - io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = NULL; - io->io_hdr.io_type = CTL_IO_TASK; - io->io_hdr.nexus.initid.id = cs->cs_ctl_initid; - io->io_hdr.nexus.targ_port = - cs->cs_target->ct_softc->fe.targ_port; - io->io_hdr.nexus.targ_target.id = 0; - //io->io_hdr.nexus.targ_lun = lun; /* Not needed? */ - io->taskio.tag_type = CTL_TAG_SIMPLE; /* XXX */ - io->taskio.task_action = CTL_TASK_ABORT_TASK; - io->taskio.tag_num = cdw->cdw_initiator_task_tag; - error = ctl_queue(io); - if (error != CTL_RETVAL_COMPLETE) { - CFISCSI_SESSION_WARN(cs, "ctl_queue() failed; error %d", error); - ctl_free_io(io); - return; - } -#if 0 - CFISCSI_SESSION_DEBUG(cs, "removing csw for initiator task tag " - "0x%x", cdw->cdw_initiator_task_tag); -#endif - cdw->cdw_ctl_io->scsiio.be_move_done(cdw->cdw_ctl_io); + while ((cdw = TAILQ_FIRST(&cs->cs_waiting_for_data_out)) != NULL) { TAILQ_REMOVE(&cs->cs_waiting_for_data_out, cdw, cdw_next); + CFISCSI_SESSION_UNLOCK(cs); + /* + * Set nonzero port status; this prevents backends from + * assuming that the data transfer actually succeeded + * and writing uninitialized data to disk. + */ + cdw->cdw_ctl_io->scsiio.io_hdr.port_status = 42; + cdw->cdw_ctl_io->scsiio.be_move_done(cdw->cdw_ctl_io); uma_zfree(cfiscsi_data_wait_zone, cdw); + CFISCSI_SESSION_LOCK(cs); } CFISCSI_SESSION_UNLOCK(cs); -#endif + + /* + * Wait for CTL to terminate all the tasks. + */ + for (;;) { + refcount_acquire(&cs->cs_outstanding_ctl_pdus); + last = refcount_release(&cs->cs_outstanding_ctl_pdus); + if (last != 0) + break; + CFISCSI_SESSION_WARN(cs, "waiting for CTL to terminate tasks, " + "%d remaining", cs->cs_outstanding_ctl_pdus); + tsleep(__DEVOLATILE(void *, &cs->cs_outstanding_ctl_pdus), + 0, "cfiscsi_terminate", hz / 100); + } } static void @@ -1124,21 +1107,22 @@ cfiscsi_maintenance_thread(void *arg) CFISCSI_SESSION_UNLOCK(cs); if (cs->cs_terminating) { - cfiscsi_session_terminate_tasks(cs); - callout_drain(&cs->cs_callout); + /* + * We used to wait up to 30 seconds to deliver queued + * PDUs to the initiator. We also tried hard to deliver + * SCSI Responses for the aborted PDUs. We don't do + * that anymore. We might need to revisit that. + */ + callout_drain(&cs->cs_callout); icl_conn_shutdown(cs->cs_conn); icl_conn_close(cs->cs_conn); - cs->cs_terminating++; - /* - * XXX: We used to wait up to 30 seconds to deliver queued PDUs - * to the initiator. We also tried hard to deliver SCSI Responses - * for the aborted PDUs. We don't do that anymore. We might need - * to revisit that. + * At this point ICL receive thread is no longer + * running; no new tasks can be queued. */ - + cfiscsi_session_terminate_tasks(cs); cfiscsi_session_delete(cs); kthread_exit(); return; @@ -1151,9 +1135,9 @@ static void cfiscsi_session_terminate(struct cfiscsi_session *cs) { - if (cs->cs_terminating != 0) + if (cs->cs_terminating) return; - cs->cs_terminating = 1; + cs->cs_terminating = true; cv_signal(&cs->cs_maintenance_cv); #ifdef ICL_KERNEL_PROXY cv_signal(&cs->cs_login_cv); @@ -1163,41 +1147,25 @@ cfiscsi_session_terminate(struct cfiscsi_session *cs) static int cfiscsi_session_register_initiator(struct cfiscsi_session *cs) { - int error, i; - struct cfiscsi_softc *softc; + struct cfiscsi_target *ct; + char *name; + int i; KASSERT(cs->cs_ctl_initid == -1, ("already registered")); - softc = &cfiscsi_softc; - - mtx_lock(&softc->lock); - for (i = 0; i < softc->max_initiators; i++) { - if (softc->ctl_initids[i] == 0) - break; - } - if (i == softc->max_initiators) { - CFISCSI_SESSION_WARN(cs, "too many concurrent sessions (%d)", - softc->max_initiators); - mtx_unlock(&softc->lock); - return (1); - } - softc->ctl_initids[i] = 1; - mtx_unlock(&softc->lock); - -#if 0 - CFISCSI_SESSION_DEBUG(cs, "adding initiator id %d, max %d", - i, softc->max_initiators); -#endif - cs->cs_ctl_initid = i; - error = ctl_add_initiator(0x0, softc->fe.targ_port, cs->cs_ctl_initid); - if (error != 0) { - CFISCSI_SESSION_WARN(cs, "ctl_add_initiator failed with error %d", error); - mtx_lock(&softc->lock); - softc->ctl_initids[cs->cs_ctl_initid] = 0; - mtx_unlock(&softc->lock); + ct = cs->cs_target; + name = strdup(cs->cs_initiator_id, M_CTL); + i = ctl_add_initiator(&ct->ct_port, -1, 0, name); + if (i < 0) { + CFISCSI_SESSION_WARN(cs, "ctl_add_initiator failed with error %d", + i); cs->cs_ctl_initid = -1; return (1); } + cs->cs_ctl_initid = i; +#if 0 + CFISCSI_SESSION_DEBUG(cs, "added initiator id %d", i); +#endif return (0); } @@ -1206,21 +1174,15 @@ static void cfiscsi_session_unregister_initiator(struct cfiscsi_session *cs) { int error; - struct cfiscsi_softc *softc; if (cs->cs_ctl_initid == -1) return; - softc = &cfiscsi_softc; - - error = ctl_remove_initiator(softc->fe.targ_port, cs->cs_ctl_initid); + error = ctl_remove_initiator(&cs->cs_target->ct_port, cs->cs_ctl_initid); if (error != 0) { CFISCSI_SESSION_WARN(cs, "ctl_remove_initiator failed with error %d", error); } - mtx_lock(&softc->lock); - softc->ctl_initids[cs->cs_ctl_initid] = 0; - mtx_unlock(&softc->lock); cs->cs_ctl_initid = -1; } @@ -1304,7 +1266,6 @@ int cfiscsi_init(void) { struct cfiscsi_softc *softc; - struct ctl_frontend *fe; int retval; softc = &cfiscsi_softc; @@ -1318,62 +1279,11 @@ cfiscsi_init(void) TAILQ_INIT(&softc->sessions); TAILQ_INIT(&softc->targets); - fe = &softc->fe; - fe->port_type = CTL_PORT_ISCSI; - /* XXX KDM what should the real number be here? */ - fe->num_requested_ctl_io = 4096; - snprintf(softc->port_name, sizeof(softc->port_name), "iscsi"); - fe->port_name = softc->port_name; - fe->port_online = cfiscsi_online; - fe->port_offline = cfiscsi_offline; - fe->onoff_arg = softc; - fe->targ_enable = cfiscsi_targ_enable; - fe->targ_disable = cfiscsi_targ_disable; - fe->lun_enable = cfiscsi_lun_enable; - fe->lun_disable = cfiscsi_lun_disable; - fe->targ_lun_arg = softc; - fe->ioctl = cfiscsi_ioctl; - fe->devid = cfiscsi_devid; - fe->fe_datamove = cfiscsi_datamove; - fe->fe_done = cfiscsi_done; - - /* XXX KDM what should we report here? */ - /* XXX These should probably be fetched from CTL. */ - fe->max_targets = 1; - fe->max_target_id = 15; - - retval = ctl_frontend_register(fe, /*master_SC*/ 1); - if (retval != 0) { - CFISCSI_WARN("ctl_frontend_register() failed with error %d", - retval); - retval = 1; - goto bailout; - } - - softc->max_initiators = fe->max_initiators; - cfiscsi_data_wait_zone = uma_zcreate("cfiscsi_data_wait", sizeof(struct cfiscsi_data_wait), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); return (0); - -bailout: - return (retval); -} - -static int -cfiscsi_module_event_handler(module_t mod, int what, void *arg) -{ - - switch (what) { - case MOD_LOAD: - return (cfiscsi_init()); - case MOD_UNLOAD: - return (EBUSY); - default: - return (EOPNOTSUPP); - } } #ifdef ICL_KERNEL_PROXY @@ -1400,10 +1310,23 @@ static void cfiscsi_online(void *arg) { struct cfiscsi_softc *softc; + struct cfiscsi_target *ct; + int online; - softc = (struct cfiscsi_softc *)arg; + ct = (struct cfiscsi_target *)arg; + softc = ct->ct_softc; + + mtx_lock(&softc->lock); + if (ct->ct_online) { + mtx_unlock(&softc->lock); + return; + } + ct->ct_online = 1; + online = softc->online++; + mtx_unlock(&softc->lock); + if (online > 0) + return; - softc->online = 1; #ifdef ICL_KERNEL_PROXY if (softc->listener != NULL) icl_listen_free(softc->listener); @@ -1415,16 +1338,28 @@ static void cfiscsi_offline(void *arg) { struct cfiscsi_softc *softc; + struct cfiscsi_target *ct; struct cfiscsi_session *cs; + int online; - softc = (struct cfiscsi_softc *)arg; - - softc->online = 0; + ct = (struct cfiscsi_target *)arg; + softc = ct->ct_softc; mtx_lock(&softc->lock); - TAILQ_FOREACH(cs, &softc->sessions, cs_next) - cfiscsi_session_terminate(cs); + if (!ct->ct_online) { + mtx_unlock(&softc->lock); + return; + } + ct->ct_online = 0; + online = --softc->online; + + TAILQ_FOREACH(cs, &softc->sessions, cs_next) { + if (cs->cs_target == ct) + cfiscsi_session_terminate(cs); + } mtx_unlock(&softc->lock); + if (online > 0) + return; #ifdef ICL_KERNEL_PROXY icl_listen_free(softc->listener); @@ -1433,24 +1368,21 @@ cfiscsi_offline(void *arg) } static int -cfiscsi_targ_enable(void *arg, struct ctl_id targ_id) +cfiscsi_info(void *arg, struct sbuf *sb) { + struct cfiscsi_target *ct = (struct cfiscsi_target *)arg; + int retval; - return (0); -} - -static int -cfiscsi_targ_disable(void *arg, struct ctl_id targ_id) -{ - - return (0); + retval = sbuf_printf(sb, "\t%d\n", + ct->ct_state); + return (retval); } static void cfiscsi_ioctl_handoff(struct ctl_iscsi *ci) { struct cfiscsi_softc *softc; - struct cfiscsi_session *cs; + struct cfiscsi_session *cs, *cs2; struct cfiscsi_target *ct; struct ctl_iscsi_handoff_params *cihp; int error; @@ -1462,13 +1394,6 @@ cfiscsi_ioctl_handoff(struct ctl_iscsi *ci) cihp->initiator_name, cihp->initiator_addr, cihp->target_name); - if (softc->online == 0) { - ci->status = CTL_ISCSI_ERROR; - snprintf(ci->error_str, sizeof(ci->error_str), - "%s: port offline", __func__); - return; - } - ct = cfiscsi_target_find(softc, cihp->target_name); if (ct == NULL) { ci->status = CTL_ISCSI_ERROR; @@ -1477,6 +1402,14 @@ cfiscsi_ioctl_handoff(struct ctl_iscsi *ci) return; } + if (ct->ct_online == 0) { + ci->status = CTL_ISCSI_ERROR; + snprintf(ci->error_str, sizeof(ci->error_str), + "%s: port offline", __func__); + cfiscsi_target_release(ct); + return; + } + #ifdef ICL_KERNEL_PROXY if (cihp->socket > 0 && cihp->connection_id > 0) { snprintf(ci->error_str, sizeof(ci->error_str), @@ -1537,13 +1470,44 @@ cfiscsi_ioctl_handoff(struct ctl_iscsi *ci) cihp->initiator_addr, sizeof(cs->cs_initiator_addr)); strlcpy(cs->cs_initiator_alias, cihp->initiator_alias, sizeof(cs->cs_initiator_alias)); + memcpy(cs->cs_initiator_isid, + cihp->initiator_isid, sizeof(cs->cs_initiator_isid)); + snprintf(cs->cs_initiator_id, sizeof(cs->cs_initiator_id), + "%s,i,0x%02x%02x%02x%02x%02x%02x", cs->cs_initiator_name, + cihp->initiator_isid[0], cihp->initiator_isid[1], + cihp->initiator_isid[2], cihp->initiator_isid[3], + cihp->initiator_isid[4], cihp->initiator_isid[5]); + + refcount_acquire(&cs->cs_outstanding_ctl_pdus); +restart: + if (!cs->cs_terminating) { + mtx_lock(&softc->lock); + TAILQ_FOREACH(cs2, &softc->sessions, cs_next) { + if (cs2 != cs && cs2->cs_tasks_aborted == false && + cs->cs_target == cs2->cs_target && + cs->cs_portal_group_tag == cs2->cs_portal_group_tag && + strcmp(cs->cs_initiator_id, cs2->cs_initiator_id) == 0) { + cfiscsi_session_terminate(cs2); + mtx_unlock(&softc->lock); + pause("cfiscsi_reinstate", 1); + goto restart; + } + } + mtx_unlock(&softc->lock); + } + + /* + * Register initiator with CTL. + */ + cfiscsi_session_register_initiator(cs); #ifdef ICL_KERNEL_PROXY if (cihp->socket > 0) { #endif error = icl_conn_handoff(cs->cs_conn, cihp->socket); if (error != 0) { - cfiscsi_session_delete(cs); + cfiscsi_session_terminate(cs); + refcount_release(&cs->cs_outstanding_ctl_pdus); ci->status = CTL_ISCSI_ERROR; snprintf(ci->error_str, sizeof(ci->error_str), "%s: icl_conn_handoff failed with error %d", @@ -1554,11 +1518,6 @@ cfiscsi_ioctl_handoff(struct ctl_iscsi *ci) } #endif - /* - * Register initiator with CTL. - */ - cfiscsi_session_register_initiator(cs); - #ifdef ICL_KERNEL_PROXY cs->cs_login_phase = false; @@ -1573,6 +1532,7 @@ cfiscsi_ioctl_handoff(struct ctl_iscsi *ci) } #endif + refcount_release(&cs->cs_outstanding_ctl_pdus); ci->status = CTL_ISCSI_OK; } @@ -1971,11 +1931,181 @@ cfiscsi_ioctl_receive(struct ctl_iscsi *ci) #endif /* !ICL_KERNEL_PROXY */ +static void +cfiscsi_ioctl_port_create(struct ctl_req *req) +{ + struct cfiscsi_target *ct; + struct ctl_port *port; + const char *target, *alias, *tag; + struct scsi_vpd_id_descriptor *desc; + ctl_options_t opts; + int retval, len, idlen; + + ctl_init_opts(&opts, req->num_args, req->kern_args); + target = ctl_get_opt(&opts, "cfiscsi_target"); + alias = ctl_get_opt(&opts, "cfiscsi_target_alias"); + tag = ctl_get_opt(&opts, "cfiscsi_portal_group_tag"); + if (target == NULL || tag == NULL) { + req->status = CTL_LUN_ERROR; + snprintf(req->error_str, sizeof(req->error_str), + "Missing required argument"); + ctl_free_opts(&opts); + return; + } + ct = cfiscsi_target_find_or_create(&cfiscsi_softc, target, alias); + if (ct == NULL) { + req->status = CTL_LUN_ERROR; + snprintf(req->error_str, sizeof(req->error_str), + "failed to create target \"%s\"", target); + ctl_free_opts(&opts); + return; + } + if (ct->ct_state == CFISCSI_TARGET_STATE_ACTIVE) { + req->status = CTL_LUN_ERROR; + snprintf(req->error_str, sizeof(req->error_str), + "target \"%s\" already exist", target); + cfiscsi_target_release(ct); + ctl_free_opts(&opts); + return; + } + port = &ct->ct_port; + if (ct->ct_state == CFISCSI_TARGET_STATE_DYING) + goto done; + + port->frontend = &cfiscsi_frontend; + port->port_type = CTL_PORT_ISCSI; + /* XXX KDM what should the real number be here? */ + port->num_requested_ctl_io = 4096; + port->port_name = "iscsi"; + port->virtual_port = strtoul(tag, NULL, 0); + port->port_online = cfiscsi_online; + port->port_offline = cfiscsi_offline; + port->port_info = cfiscsi_info; + port->onoff_arg = ct; + port->lun_enable = cfiscsi_lun_enable; + port->lun_disable = cfiscsi_lun_disable; + port->lun_map = cfiscsi_lun_map; + port->targ_lun_arg = ct; + port->fe_datamove = cfiscsi_datamove; + port->fe_done = cfiscsi_done; + + /* XXX KDM what should we report here? */ + /* XXX These should probably be fetched from CTL. */ + port->max_targets = 1; + port->max_target_id = 15; + + port->options = opts; + STAILQ_INIT(&opts); + + /* Generate Port ID. */ + idlen = strlen(target) + strlen(",t,0x0001") + 1; + idlen = roundup2(idlen, 4); + len = sizeof(struct scsi_vpd_device_id) + idlen; + port->port_devid = malloc(sizeof(struct ctl_devid) + len, + M_CTL, M_WAITOK | M_ZERO); + port->port_devid->len = len; + desc = (struct scsi_vpd_id_descriptor *)port->port_devid->data; + desc->proto_codeset = (SCSI_PROTO_ISCSI << 4) | SVPD_ID_CODESET_UTF8; + desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT | + SVPD_ID_TYPE_SCSI_NAME; + desc->length = idlen; + snprintf(desc->identifier, idlen, "%s,t,0x%4.4x", + target, port->virtual_port); + + /* Generate Target ID. */ + idlen = strlen(target) + 1; + idlen = roundup2(idlen, 4); + len = sizeof(struct scsi_vpd_device_id) + idlen; + port->target_devid = malloc(sizeof(struct ctl_devid) + len, + M_CTL, M_WAITOK | M_ZERO); + port->target_devid->len = len; + desc = (struct scsi_vpd_id_descriptor *)port->target_devid->data; + desc->proto_codeset = (SCSI_PROTO_ISCSI << 4) | SVPD_ID_CODESET_UTF8; + desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_TARGET | + SVPD_ID_TYPE_SCSI_NAME; + desc->length = idlen; + strlcpy(desc->identifier, target, idlen); + + retval = ctl_port_register(port, /*master_SC*/ 1); + if (retval != 0) { + ctl_free_opts(&port->options); + cfiscsi_target_release(ct); + free(port->port_devid, M_CFISCSI); + free(port->target_devid, M_CFISCSI); + req->status = CTL_LUN_ERROR; + snprintf(req->error_str, sizeof(req->error_str), + "ctl_frontend_register() failed with error %d", retval); + return; + } +done: + ct->ct_state = CFISCSI_TARGET_STATE_ACTIVE; + req->status = CTL_LUN_OK; + memcpy(req->kern_args[0].kvalue, &port->targ_port, + sizeof(port->targ_port)); //XXX +} + +static void +cfiscsi_ioctl_port_remove(struct ctl_req *req) +{ + struct cfiscsi_target *ct; + const char *target; + ctl_options_t opts; + + ctl_init_opts(&opts, req->num_args, req->kern_args); + target = ctl_get_opt(&opts, "cfiscsi_target"); + if (target == NULL) { + ctl_free_opts(&opts); + req->status = CTL_LUN_ERROR; + snprintf(req->error_str, sizeof(req->error_str), + "Missing required argument"); + return; + } + ct = cfiscsi_target_find(&cfiscsi_softc, target); + if (ct == NULL) { + ctl_free_opts(&opts); + req->status = CTL_LUN_ERROR; + snprintf(req->error_str, sizeof(req->error_str), + "can't find target \"%s\"", target); + return; + } + if (ct->ct_state != CFISCSI_TARGET_STATE_ACTIVE) { + ctl_free_opts(&opts); + req->status = CTL_LUN_ERROR; + snprintf(req->error_str, sizeof(req->error_str), + "target \"%s\" is already dying", target); + return; + } + ctl_free_opts(&opts); + + ct->ct_state = CFISCSI_TARGET_STATE_DYING; + ctl_port_offline(&ct->ct_port); + cfiscsi_target_release(ct); + cfiscsi_target_release(ct); +} + static int cfiscsi_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { struct ctl_iscsi *ci; + struct ctl_req *req; + + if (cmd == CTL_PORT_REQ) { + req = (struct ctl_req *)addr; + switch (req->reqtype) { + case CTL_REQ_CREATE: + cfiscsi_ioctl_port_create(req); + break; + case CTL_REQ_REMOVE: + cfiscsi_ioctl_port_remove(req); + break; + default: + req->status = CTL_LUN_ERROR; + snprintf(req->error_str, sizeof(req->error_str), + "Unsupported request type %d", req->reqtype); + } + return (0); + } if (cmd != CTL_ISCSI) return (ENOTTY); @@ -2028,135 +2158,6 @@ cfiscsi_ioctl(struct cdev *dev, return (0); } -static int -cfiscsi_devid(struct ctl_scsiio *ctsio, int alloc_len) -{ - struct cfiscsi_session *cs; - struct scsi_vpd_device_id *devid_ptr; - struct scsi_vpd_id_descriptor *desc, *desc1; - struct scsi_vpd_id_descriptor *desc2, *desc3; /* for types 4h and 5h */ - struct scsi_vpd_id_t10 *t10id; - struct ctl_lun *lun; - const struct icl_pdu *request; - size_t devid_len, wwpn_len; - - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - request = ctsio->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr; - cs = PDU_SESSION(request); - - wwpn_len = strlen(cs->cs_target->ct_name); - wwpn_len += strlen(",t,0x01"); - wwpn_len += 1; /* '\0' */ - if ((wwpn_len % 4) != 0) - wwpn_len += (4 - (wwpn_len % 4)); - - devid_len = sizeof(struct scsi_vpd_device_id) + - sizeof(struct scsi_vpd_id_descriptor) + - sizeof(struct scsi_vpd_id_t10) + CTL_DEVID_LEN + - sizeof(struct scsi_vpd_id_descriptor) + wwpn_len + - sizeof(struct scsi_vpd_id_descriptor) + - sizeof(struct scsi_vpd_id_rel_trgt_port_id) + - sizeof(struct scsi_vpd_id_descriptor) + - sizeof(struct scsi_vpd_id_trgt_port_grp_id); - - ctsio->kern_data_ptr = malloc(devid_len, M_CTL, M_WAITOK | M_ZERO); - devid_ptr = (struct scsi_vpd_device_id *)ctsio->kern_data_ptr; - ctsio->kern_sg_entries = 0; - - if (devid_len < alloc_len) { - ctsio->residual = alloc_len - devid_len; - ctsio->kern_data_len = devid_len; - ctsio->kern_total_len = devid_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } - ctsio->kern_data_resid = 0; - ctsio->kern_rel_offset = 0; - ctsio->kern_sg_entries = 0; - - desc = (struct scsi_vpd_id_descriptor *)devid_ptr->desc_list; - t10id = (struct scsi_vpd_id_t10 *)&desc->identifier[0]; - desc1 = (struct scsi_vpd_id_descriptor *)(&desc->identifier[0] + - sizeof(struct scsi_vpd_id_t10) + CTL_DEVID_LEN); - desc2 = (struct scsi_vpd_id_descriptor *)(&desc1->identifier[0] + - wwpn_len); - desc3 = (struct scsi_vpd_id_descriptor *)(&desc2->identifier[0] + - sizeof(struct scsi_vpd_id_rel_trgt_port_id)); - - if (lun != NULL) - devid_ptr->device = (SID_QUAL_LU_CONNECTED << 5) | - lun->be_lun->lun_type; - else - devid_ptr->device = (SID_QUAL_LU_OFFLINE << 5) | T_DIRECT; - - devid_ptr->page_code = SVPD_DEVICE_ID; - - scsi_ulto2b(devid_len - 4, devid_ptr->length); - - /* - * We're using a LUN association here. i.e., this device ID is a - * per-LUN identifier. - */ - desc->proto_codeset = (SCSI_PROTO_ISCSI << 4) | SVPD_ID_CODESET_ASCII; - desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN | SVPD_ID_TYPE_T10; - desc->length = sizeof(*t10id) + CTL_DEVID_LEN; - strncpy((char *)t10id->vendor, CTL_VENDOR, sizeof(t10id->vendor)); - - /* - * If we've actually got a backend, copy the device id from the - * per-LUN data. Otherwise, set it to all spaces. - */ - if (lun != NULL) { - /* - * Copy the backend's LUN ID. - */ - strncpy((char *)t10id->vendor_spec_id, - (char *)lun->be_lun->device_id, CTL_DEVID_LEN); - } else { - /* - * No backend, set this to spaces. - */ - memset(t10id->vendor_spec_id, 0x20, CTL_DEVID_LEN); - } - - /* - * desc1 is for the WWPN which is a port asscociation. - */ - desc1->proto_codeset = (SCSI_PROTO_ISCSI << 4) | SVPD_ID_CODESET_UTF8; - desc1->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT | - SVPD_ID_TYPE_SCSI_NAME; - desc1->length = wwpn_len; - snprintf(desc1->identifier, wwpn_len, "%s,t,0x%x", - cs->cs_target->ct_name, cs->cs_portal_group_tag); - - /* - * desc2 is for the Relative Target Port(type 4h) identifier - */ - desc2->proto_codeset = (SCSI_PROTO_ISCSI << 4) | SVPD_ID_CODESET_BINARY; - desc2->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT | - SVPD_ID_TYPE_RELTARG; - desc2->length = 4; - desc2->identifier[3] = 1; - - /* - * desc3 is for the Target Port Group(type 5h) identifier - */ - desc3->proto_codeset = (SCSI_PROTO_ISCSI << 4) | SVPD_ID_CODESET_BINARY; - desc3->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT | - SVPD_ID_TYPE_TPORTGRP; - desc3->length = 4; - desc3->identifier[3] = 1; - - ctsio->scsi_status = SCSI_STATUS_OK; - - ctsio->be_move_done = ctl_config_move_done; - ctl_datamove((union ctl_io *)ctsio); - - return (CTL_RETVAL_COMPLETE); -} - static void cfiscsi_target_hold(struct cfiscsi_target *ct) { @@ -2174,6 +2175,12 @@ cfiscsi_target_release(struct cfiscsi_target *ct) if (refcount_release(&ct->ct_refcount)) { TAILQ_REMOVE(&softc->targets, ct, ct_next); mtx_unlock(&softc->lock); + if (ct->ct_state != CFISCSI_TARGET_STATE_INVALID) { + ct->ct_state = CFISCSI_TARGET_STATE_INVALID; + if (ctl_port_deregister(&ct->ct_port) != 0) + printf("%s: ctl_port_deregister() failed\n", + __func__); + } free(ct, M_CFISCSI); return; @@ -2188,7 +2195,8 @@ cfiscsi_target_find(struct cfiscsi_softc *softc, const char *name) mtx_lock(&softc->lock); TAILQ_FOREACH(ct, &softc->targets, ct_next) { - if (strcmp(name, ct->ct_name) != 0) + if (strcmp(name, ct->ct_name) != 0 || + ct->ct_state != CFISCSI_TARGET_STATE_ACTIVE) continue; cfiscsi_target_hold(ct); mtx_unlock(&softc->lock); @@ -2213,7 +2221,8 @@ cfiscsi_target_find_or_create(struct cfiscsi_softc *softc, const char *name, mtx_lock(&softc->lock); TAILQ_FOREACH(ct, &softc->targets, ct_next) { - if (strcmp(name, ct->ct_name) != 0) + if (strcmp(name, ct->ct_name) != 0 || + ct->ct_state == CFISCSI_TARGET_STATE_INVALID) continue; cfiscsi_target_hold(ct); mtx_unlock(&softc->lock); @@ -2222,7 +2231,7 @@ cfiscsi_target_find_or_create(struct cfiscsi_softc *softc, const char *name, } for (i = 0; i < CTL_MAX_LUNS; i++) - newct->ct_luns[i] = -1; + newct->ct_luns[i] = UINT32_MAX; strlcpy(newct->ct_name, name, sizeof(newct->ct_name)); if (alias != NULL) @@ -2239,22 +2248,16 @@ cfiscsi_target_find_or_create(struct cfiscsi_softc *softc, const char *name, * Takes LUN from the target space and returns LUN from the CTL space. */ static uint32_t -cfiscsi_map_lun(void *arg, uint32_t lun) +cfiscsi_lun_map(void *arg, uint32_t lun) { - struct cfiscsi_session *cs; - - cs = arg; + struct cfiscsi_target *ct = arg; if (lun >= CTL_MAX_LUNS) { CFISCSI_DEBUG("requested lun number %d is higher " "than maximum %d", lun, CTL_MAX_LUNS - 1); - return (0xffffffff); + return (UINT32_MAX); } - - if (cs->cs_target->ct_luns[lun] < 0) - return (0xffffffff); - - return (cs->cs_target->ct_luns[lun]); + return (ct->ct_luns[lun]); } static int @@ -2268,7 +2271,7 @@ cfiscsi_target_set_lun(struct cfiscsi_target *ct, return (-1); } - if (ct->ct_luns[lun_id] >= 0) { + if (ct->ct_luns[lun_id] < CTL_MAX_LUNS) { /* * CTL calls cfiscsi_lun_enable() twice for each LUN - once * when the LUN is created, and a second time just before @@ -2287,22 +2290,6 @@ cfiscsi_target_set_lun(struct cfiscsi_target *ct, #endif ct->ct_luns[lun_id] = ctl_lun_id; - cfiscsi_target_hold(ct); - - return (0); -} - -static int -cfiscsi_target_unset_lun(struct cfiscsi_target *ct, unsigned long lun_id) -{ - - if (ct->ct_luns[lun_id] < 0) { - CFISCSI_WARN("lun %ld not allocated", lun_id); - return (-1); - } - - ct->ct_luns[lun_id] = -1; - cfiscsi_target_release(ct); return (0); } @@ -2312,22 +2299,17 @@ cfiscsi_lun_enable(void *arg, struct ctl_id target_id, int lun_id) { struct cfiscsi_softc *softc; struct cfiscsi_target *ct; - struct ctl_be_lun_option *opt; - const char *target = NULL, *target_alias = NULL; + const char *target = NULL; const char *lun = NULL; unsigned long tmp; - softc = (struct cfiscsi_softc *)arg; + ct = (struct cfiscsi_target *)arg; + softc = ct->ct_softc; - STAILQ_FOREACH(opt, - &control_softc->ctl_luns[lun_id]->be_lun->options, links) { - if (strcmp(opt->name, "cfiscsi_target") == 0) - target = opt->value; - else if (strcmp(opt->name, "cfiscsi_target_alias") == 0) - target_alias = opt->value; - else if (strcmp(opt->name, "cfiscsi_lun") == 0) - lun = opt->value; - } + target = ctl_get_opt(&control_softc->ctl_luns[lun_id]->be_lun->options, + "cfiscsi_target"); + lun = ctl_get_opt(&control_softc->ctl_luns[lun_id]->be_lun->options, + "cfiscsi_lun"); if (target == NULL && lun == NULL) return (0); @@ -2338,15 +2320,11 @@ cfiscsi_lun_enable(void *arg, struct ctl_id target_id, int lun_id) return (0); } - ct = cfiscsi_target_find_or_create(softc, target, target_alias); - if (ct == NULL) { - CFISCSI_WARN("failed to create target \"%s\"", target); + if (strcmp(target, ct->ct_name) != 0) return (0); - } tmp = strtoul(lun, NULL, 10); cfiscsi_target_set_lun(ct, tmp, lun_id); - cfiscsi_target_release(ct); return (0); } @@ -2357,19 +2335,15 @@ cfiscsi_lun_disable(void *arg, struct ctl_id target_id, int lun_id) struct cfiscsi_target *ct; int i; - softc = (struct cfiscsi_softc *)arg; + ct = (struct cfiscsi_target *)arg; + softc = ct->ct_softc; mtx_lock(&softc->lock); - TAILQ_FOREACH(ct, &softc->targets, ct_next) { - for (i = 0; i < CTL_MAX_LUNS; i++) { - if (ct->ct_luns[i] < 0) - continue; - if (ct->ct_luns[i] != lun_id) - continue; - mtx_unlock(&softc->lock); - cfiscsi_target_unset_lun(ct, i); - return (0); - } + for (i = 0; i < CTL_MAX_LUNS; i++) { + if (ct->ct_luns[i] != lun_id) + continue; + ct->ct_luns[i] = UINT32_MAX; + break; } mtx_unlock(&softc->lock); return (0); @@ -2623,8 +2597,8 @@ cfiscsi_datamove_out(union ctl_io *io) cdw->cdw_target_transfer_tag = target_transfer_tag; cdw->cdw_initiator_task_tag = bhssc->bhssc_initiator_task_tag; - if (cs->cs_immediate_data && io->scsiio.kern_rel_offset == 0 && - icl_pdu_data_segment_length(request) > 0) { + if (cs->cs_immediate_data && io->scsiio.kern_rel_offset < + icl_pdu_data_segment_length(request)) { done = cfiscsi_handle_data_segment(request, cdw); if (done) { uma_zfree(cfiscsi_data_wait_zone, cdw); @@ -2725,6 +2699,17 @@ cfiscsi_scsi_command_done(union ctl_io *io) CFISCSI_SESSION_UNLOCK(cs); #endif + /* + * Do not return status for aborted commands. + * There are exceptions, but none supported by CTL yet. + */ + if ((io->io_hdr.flags & CTL_FLAG_ABORT) && + (io->io_hdr.flags & CTL_FLAG_ABORT_STATUS) == 0) { + ctl_free_io(io); + icl_pdu_free(request); + return; + } + response = cfiscsi_pdu_new_response(request, M_WAITOK); bhssr = (struct iscsi_bhs_scsi_response *)response->ip_bhs; bhssr->bhssr_opcode = ISCSI_BHS_OPCODE_SCSI_RESPONSE; @@ -2851,14 +2836,20 @@ cfiscsi_done(union ctl_io *io) KASSERT(((io->io_hdr.status & CTL_STATUS_MASK) != CTL_STATUS_NONE), ("invalid CTL status %#x", io->io_hdr.status)); - request = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr; - if (request == NULL) { + if (io->io_hdr.io_type == CTL_IO_TASK && + io->taskio.task_action == CTL_TASK_I_T_NEXUS_RESET) { /* * Implicit task termination has just completed; nothing to do. */ + cs = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr; + cs->cs_tasks_aborted = true; + refcount_release(&cs->cs_outstanding_ctl_pdus); + wakeup(__DEVOLATILE(void *, &cs->cs_outstanding_ctl_pdus)); + ctl_free_io(io); return; } + request = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr; cs = PDU_SESSION(request); refcount_release(&cs->cs_outstanding_ctl_pdus); diff --git a/sys/cam/ctl/ctl_frontend_iscsi.h b/sys/cam/ctl/ctl_frontend_iscsi.h index aca89f9dcfc..0ac0e98ce46 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.h +++ b/sys/cam/ctl/ctl_frontend_iscsi.h @@ -32,13 +32,20 @@ #ifndef CTL_FRONTEND_ISCSI_H #define CTL_FRONTEND_ISCSI_H +#define CFISCSI_TARGET_STATE_INVALID 0 +#define CFISCSI_TARGET_STATE_ACTIVE 1 +#define CFISCSI_TARGET_STATE_DYING 2 + struct cfiscsi_target { TAILQ_ENTRY(cfiscsi_target) ct_next; - int ct_luns[CTL_MAX_LUNS]; + uint32_t ct_luns[CTL_MAX_LUNS]; struct cfiscsi_softc *ct_softc; volatile u_int ct_refcount; char ct_name[CTL_ISCSI_NAME_LEN]; char ct_alias[CTL_ISCSI_ALIAS_LEN]; + int ct_state; + int ct_online; + struct ctl_port ct_port; }; struct cfiscsi_data_wait { @@ -72,13 +79,16 @@ struct cfiscsi_session { int cs_timeout; int cs_portal_group_tag; struct cv cs_maintenance_cv; - int cs_terminating; + bool cs_terminating; + bool cs_tasks_aborted; size_t cs_max_data_segment_length; size_t cs_max_burst_length; bool cs_immediate_data; char cs_initiator_name[CTL_ISCSI_NAME_LEN]; char cs_initiator_addr[CTL_ISCSI_ADDR_LEN]; char cs_initiator_alias[CTL_ISCSI_ALIAS_LEN]; + char cs_initiator_isid[6]; + char cs_initiator_id[CTL_ISCSI_NAME_LEN + 5 + 6 + 1]; unsigned int cs_id; int cs_ctl_initid; #ifdef ICL_KERNEL_PROXY @@ -96,15 +106,12 @@ struct icl_listen; #endif struct cfiscsi_softc { - struct ctl_frontend fe; struct mtx lock; char port_name[32]; int online; unsigned int last_session_id; TAILQ_HEAD(, cfiscsi_target) targets; TAILQ_HEAD(, cfiscsi_session) sessions; - char ctl_initids[CTL_MAX_INIT_PER_PORT]; - int max_initiators; #ifdef ICL_KERNEL_PROXY struct icl_listen *listener; struct cv accept_cv; diff --git a/sys/cam/ctl/ctl_io.h b/sys/cam/ctl/ctl_io.h index e018b3f8a5f..8f4ab92c330 100644 --- a/sys/cam/ctl/ctl_io.h +++ b/sys/cam/ctl/ctl_io.h @@ -96,6 +96,7 @@ typedef enum { CTL_FLAG_CONTROL_DEV = 0x00000080, /* processor device */ CTL_FLAG_ALLOCATED = 0x00000100, /* data space allocated */ CTL_FLAG_BLOCKED = 0x00000200, /* on the blocked queue */ + CTL_FLAG_ABORT_STATUS = 0x00000400, /* return TASK ABORTED status */ CTL_FLAG_ABORT = 0x00000800, /* this I/O should be aborted */ CTL_FLAG_DMA_INPROG = 0x00001000, /* DMA in progress */ CTL_FLAG_NO_DATASYNC = 0x00002000, /* don't cache flush data */ @@ -138,6 +139,10 @@ struct ctl_lba_len_flags { uint64_t lba; uint32_t len; uint32_t flags; +#define CTL_LLF_READ 0x10000000 +#define CTL_LLF_WRITE 0x20000000 +#define CTL_LLF_VERIFY 0x40000000 +#define CTL_LLF_COMPARE 0x80000000 }; struct ctl_ptr_len_flags { @@ -216,8 +221,7 @@ struct ctl_nexus { uint32_t targ_port; /* Target port, filled in by PORT */ struct ctl_id targ_target; /* Destination target */ uint32_t targ_lun; /* Destination lun */ - uint32_t (*lun_map_fn)(void *arg, uint32_t lun); - void *lun_map_arg; + uint32_t targ_mapped_lun; /* Destination lun CTL-wide */ }; typedef enum { @@ -361,6 +365,7 @@ typedef enum { CTL_TASK_ABORT_TASK_SET, CTL_TASK_CLEAR_ACA, CTL_TASK_CLEAR_TASK_SET, + CTL_TASK_I_T_NEXUS_RESET, CTL_TASK_LUN_RESET, CTL_TASK_TARGET_RESET, CTL_TASK_BUS_RESET, @@ -402,7 +407,7 @@ struct ctl_pr_info { ctl_pr_action action; uint8_t sa_res_key[8]; uint8_t res_type; - uint16_t residx; + uint32_t residx; }; struct ctl_ha_msg_hdr { diff --git a/sys/cam/ctl/ctl_ioctl.h b/sys/cam/ctl/ctl_ioctl.h index 93dc4920334..a90475b8fcf 100644 --- a/sys/cam/ctl/ctl_ioctl.h +++ b/sys/cam/ctl/ctl_ioctl.h @@ -70,7 +70,7 @@ /* * Maximum number of ports registered at one time. */ -#define CTL_MAX_PORTS 32 +#define CTL_MAX_PORTS 128 /* * Maximum number of initiators we support. @@ -594,6 +594,45 @@ struct ctl_lun_list { /* passed to userland */ }; +/* + * Port request interface: + * + * driver: This is required, and is NUL-terminated a string + * that is the name of the frontend, like "iscsi" . + * + * reqtype: The type of request, CTL_REQ_CREATE to create a + * port, CTL_REQ_REMOVE to delete a port. + * + * num_be_args: This is the number of frontend-specific arguments + * in the be_args array. + * + * be_args: This is an array of frontend-specific arguments. + * See above for a description of the fields in this + * structure. + * + * status: Status of the request. + * + * error_str: If the status is CTL_LUN_ERROR, this will + * contain a string describing the error. + * + * kern_be_args: For kernel use only. + */ +typedef enum { + CTL_REQ_CREATE, + CTL_REQ_REMOVE, + CTL_REQ_MODIFY, +} ctl_req_type; + +struct ctl_req { + char driver[CTL_DRIVER_NAME_LEN]; + ctl_req_type reqtype; + int num_args; + struct ctl_be_arg *args; + ctl_lun_status status; + char error_str[CTL_ERROR_STR_LEN]; + struct ctl_be_arg *kern_args; +}; + /* * iSCSI status * @@ -642,6 +681,7 @@ struct ctl_iscsi_handoff_params { char initiator_name[CTL_ISCSI_NAME_LEN]; char initiator_addr[CTL_ISCSI_ADDR_LEN]; char initiator_alias[CTL_ISCSI_ALIAS_LEN]; + uint8_t initiator_isid[6]; char target_name[CTL_ISCSI_NAME_LEN]; int socket; int portal_group_tag; @@ -789,6 +829,8 @@ struct ctl_iscsi { #define CTL_ERROR_INJECT_DELETE _IOW(CTL_MINOR, 0x23, struct ctl_error_desc) #define CTL_SET_PORT_WWNS _IOW(CTL_MINOR, 0x24, struct ctl_port_entry) #define CTL_ISCSI _IOWR(CTL_MINOR, 0x25, struct ctl_iscsi) +#define CTL_PORT_REQ _IOWR(CTL_MINOR, 0x26, struct ctl_req) +#define CTL_PORT_LIST _IOWR(CTL_MINOR, 0x27, struct ctl_lun_list) #endif /* _CTL_IOCTL_H_ */ diff --git a/sys/cam/ctl/ctl_private.h b/sys/cam/ctl/ctl_private.h index c742a9344e8..23298fa05d7 100644 --- a/sys/cam/ctl/ctl_private.h +++ b/sys/cam/ctl/ctl_private.h @@ -79,7 +79,6 @@ typedef enum { CTL_POOL_INTERNAL, CTL_POOL_FETD, CTL_POOL_EMERGENCY, - CTL_POOL_IOCTL, CTL_POOL_4OTHERSC } ctl_pool_type; @@ -110,7 +109,7 @@ typedef enum { struct ctl_ioctl_info { ctl_ioctl_flags flags; uint32_t cur_tag_num; - struct ctl_frontend fe; + struct ctl_port port; char port_name[24]; }; @@ -136,6 +135,7 @@ typedef enum { * * Note: "OK_ON_ALL_LUNS" == we don't have to have a lun configured * "OK_ON_BOTH" == we have to have a lun configured + * "SA5" == command has 5-bit service action at byte 1 */ typedef enum { CTL_CMD_FLAG_NONE = 0x0000, @@ -149,7 +149,8 @@ typedef enum { CTL_CMD_FLAG_OK_ON_INOPERABLE = 0x0800, CTL_CMD_FLAG_OK_ON_OFFLINE = 0x1000, CTL_CMD_FLAG_OK_ON_SECONDARY = 0x2000, - CTL_CMD_FLAG_ALLOW_ON_PR_RESV = 0x4000 + CTL_CMD_FLAG_ALLOW_ON_PR_RESV = 0x4000, + CTL_CMD_FLAG_SA5 = 0x8000 } ctl_cmd_flags; typedef enum { @@ -162,14 +163,10 @@ typedef enum { CTL_SERIDX_RQ_SNS, CTL_SERIDX_INQ, CTL_SERIDX_RD_CAP, - CTL_SERIDX_RESV, - CTL_SERIDX_REL, + CTL_SERIDX_RES, CTL_SERIDX_LOG_SNS, CTL_SERIDX_FORMAT, CTL_SERIDX_START, - CTL_SERIDX_PRES_IN, - CTL_SERIDX_PRES_OUT, - CTL_SERIDX_MAIN_IN, /* TBD: others to be filled in as needed */ CTL_SERIDX_COUNT, /* LAST, not a normal code, provides # codes */ CTL_SERIDX_INVLD = CTL_SERIDX_COUNT @@ -182,6 +179,9 @@ struct ctl_cmd_entry { ctl_seridx seridx; ctl_cmd_flags flags; ctl_lun_error_pattern pattern; + uint8_t length; /* CDB length */ + uint8_t usage[15]; /* Mask of allowed CDB bits + * after the opcode byte. */ }; typedef enum { @@ -332,11 +332,6 @@ struct ctl_mode_pages { struct ctl_page_index index[CTL_NUM_MODE_PAGES]; }; -struct ctl_pending_sense { - ctl_ua_type ua_pending; - struct scsi_sense_data sense; -}; - struct ctl_lun_delay_info { ctl_delay_type datamove_type; uint32_t datamove_delay; @@ -360,15 +355,20 @@ struct ctl_per_res_info { uint8_t registered; }; -#define CTL_PR_ALL_REGISTRANTS 0xFFFF -#define CTL_PR_NO_RESERVATION 0xFFF0 +#define CTL_PR_ALL_REGISTRANTS 0xFFFFFFFF +#define CTL_PR_NO_RESERVATION 0xFFFFFFF0 + +struct ctl_devid { + int len; + uint8_t data[]; +}; /* * For report target port groups. */ #define NUM_TARGET_PORT_GROUPS 2 -#define NUM_PORTS_PER_GRP 2 +struct tpc_list; struct ctl_lun { struct mtx lun_lock; struct ctl_id target; @@ -388,29 +388,38 @@ struct ctl_lun { STAILQ_ENTRY(ctl_lun) links; STAILQ_ENTRY(ctl_lun) run_links; struct ctl_nexus rsv_nexus; +#ifdef CTL_WITH_CA uint32_t have_ca[CTL_MAX_INITIATORS >> 5]; - struct ctl_pending_sense pending_sense[CTL_MAX_INITIATORS]; + struct scsi_sense_data pending_sense[CTL_MAX_INITIATORS]; +#endif + ctl_ua_type pending_ua[CTL_MAX_INITIATORS]; struct ctl_mode_pages mode_pages; struct ctl_lun_io_stats stats; struct ctl_per_res_info per_res[2*CTL_MAX_INITIATORS]; unsigned int PRGeneration; int pr_key_count; - uint16_t pr_res_idx; + uint32_t pr_res_idx; uint8_t res_type; - uint8_t write_buffer[524288]; + uint8_t write_buffer[262144]; + struct ctl_devid *lun_devid; + TAILQ_HEAD(tpc_lists, tpc_list) tpc_lists; }; typedef enum { - CTL_FLAG_TASK_PENDING = 0x01, CTL_FLAG_REAL_SYNC = 0x02, CTL_FLAG_MASTER_SHELF = 0x04 } ctl_gen_flags; -struct ctl_wwpn_iid { - int in_use; - uint64_t wwpn; - uint32_t iid; - int32_t port; +#define CTL_MAX_THREADS 16 + +struct ctl_thread { + struct mtx_padalign queue_lock; + struct ctl_softc *ctl_softc; + struct thread *thread; + STAILQ_HEAD(, ctl_io_hdr) incoming_queue; + STAILQ_HEAD(, ctl_io_hdr) rtr_queue; + STAILQ_HEAD(, ctl_io_hdr) done_queue; + STAILQ_HEAD(, ctl_io_hdr) isc_queue; }; struct ctl_softc { @@ -426,27 +435,22 @@ struct ctl_softc { struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; struct ctl_ioctl_info ioctl_info; - struct ctl_lun lun; struct ctl_io_pool *internal_pool; struct ctl_io_pool *emergency_pool; struct ctl_io_pool *othersc_pool; - struct proc *work_thread; + struct proc *ctl_proc; int targ_online; uint32_t ctl_lun_mask[CTL_MAX_LUNS >> 5]; struct ctl_lun *ctl_luns[CTL_MAX_LUNS]; - struct ctl_wwpn_iid wwpn_iid[CTL_MAX_PORTS][CTL_MAX_INIT_PER_PORT]; uint32_t ctl_port_mask; uint64_t aps_locked_lun; STAILQ_HEAD(, ctl_lun) lun_list; STAILQ_HEAD(, ctl_be_lun) pending_lun_queue; - STAILQ_HEAD(, ctl_io_hdr) task_queue; - STAILQ_HEAD(, ctl_io_hdr) incoming_queue; - STAILQ_HEAD(, ctl_io_hdr) rtr_queue; - STAILQ_HEAD(, ctl_io_hdr) done_queue; - STAILQ_HEAD(, ctl_io_hdr) isc_queue; uint32_t num_frontends; STAILQ_HEAD(, ctl_frontend) fe_list; - struct ctl_frontend *ctl_ports[CTL_MAX_PORTS]; + uint32_t num_ports; + STAILQ_HEAD(, ctl_port) port_list; + struct ctl_port *ctl_ports[CTL_MAX_PORTS]; uint32_t num_backends; STAILQ_HEAD(, ctl_backend_driver) be_list; struct mtx pool_lock; @@ -455,13 +459,16 @@ struct ctl_softc { STAILQ_HEAD(, ctl_io_pool) io_pools; time_t last_print_jiffies; uint32_t skipped_prints; + struct ctl_thread threads[CTL_MAX_THREADS]; }; #ifdef _KERNEL -extern struct ctl_cmd_entry ctl_cmd_table[]; +extern const struct ctl_cmd_entry ctl_cmd_table[256]; uint32_t ctl_get_initindex(struct ctl_nexus *nexus); +uint32_t ctl_get_resindex(struct ctl_nexus *nexus); +uint32_t ctl_port_idx(int port_num); int ctl_pool_create(struct ctl_softc *ctl_softc, ctl_pool_type pool_type, uint32_t total_ctl_io, struct ctl_io_pool **npool); void ctl_pool_free(struct ctl_io_pool *pool); @@ -470,24 +477,40 @@ int ctl_scsi_reserve(struct ctl_scsiio *ctsio); int ctl_start_stop(struct ctl_scsiio *ctsio); int ctl_sync_cache(struct ctl_scsiio *ctsio); int ctl_format(struct ctl_scsiio *ctsio); +int ctl_read_buffer(struct ctl_scsiio *ctsio); int ctl_write_buffer(struct ctl_scsiio *ctsio); int ctl_write_same(struct ctl_scsiio *ctsio); int ctl_unmap(struct ctl_scsiio *ctsio); int ctl_mode_select(struct ctl_scsiio *ctsio); int ctl_mode_sense(struct ctl_scsiio *ctsio); int ctl_read_capacity(struct ctl_scsiio *ctsio); -int ctl_service_action_in(struct ctl_scsiio *ctsio); +int ctl_read_capacity_16(struct ctl_scsiio *ctsio); int ctl_read_write(struct ctl_scsiio *ctsio); +int ctl_cnw(struct ctl_scsiio *ctsio); int ctl_report_luns(struct ctl_scsiio *ctsio); int ctl_request_sense(struct ctl_scsiio *ctsio); int ctl_tur(struct ctl_scsiio *ctsio); +int ctl_verify(struct ctl_scsiio *ctsio); int ctl_inquiry(struct ctl_scsiio *ctsio); int ctl_persistent_reserve_in(struct ctl_scsiio *ctsio); int ctl_persistent_reserve_out(struct ctl_scsiio *ctsio); -int ctl_maintenance_in(struct ctl_scsiio *ctsio); -void ctl_done_lock(union ctl_io *io, int have_lock); +int ctl_report_tagret_port_groups(struct ctl_scsiio *ctsio); +int ctl_report_supported_opcodes(struct ctl_scsiio *ctsio); +int ctl_report_supported_tmf(struct ctl_scsiio *ctsio); +int ctl_report_timestamp(struct ctl_scsiio *ctsio); int ctl_isc(struct ctl_scsiio *ctsio); +void ctl_tpc_init(struct ctl_lun *lun); +void ctl_tpc_shutdown(struct ctl_lun *lun); +int ctl_inquiry_evpd_tpc(struct ctl_scsiio *ctsio, int alloc_len); +int ctl_receive_copy_status_lid1(struct ctl_scsiio *ctsio); +int ctl_receive_copy_failure_details(struct ctl_scsiio *ctsio); +int ctl_receive_copy_status_lid4(struct ctl_scsiio *ctsio); +int ctl_receive_copy_operating_parameters(struct ctl_scsiio *ctsio); +int ctl_extended_copy_lid1(struct ctl_scsiio *ctsio); +int ctl_extended_copy_lid4(struct ctl_scsiio *ctsio); +int ctl_copy_operation_abort(struct ctl_scsiio *ctsio); + #endif /* _KERNEL */ #endif /* _CTL_PRIVATE_H_ */ diff --git a/sys/cam/ctl/ctl_ser_table.c b/sys/cam/ctl/ctl_ser_table.c index ee4f3044c07..c680fb530f6 100644 --- a/sys/cam/ctl/ctl_ser_table.c +++ b/sys/cam/ctl/ctl_ser_table.c @@ -60,23 +60,19 @@ static ctl_serialize_action ctl_serialize_table[CTL_SERIDX_COUNT][CTL_SERIDX_COUNT] = { -/**>IDX_ :: 2nd:TUR RD WRT UNM MDSN MDSL RQSN INQ RDCP RES REL LSNS FMT STR PRIN PROT MAININ*/ -/*TUR */{ pS, pS, pS, pS, bK, bK, bK, pS, pS, bK, bK, pS, bK, bK, bK, bK, bK}, -/*READ */{ pS, pS, xT, bK, bK, bK, bK, pS, pS, bK, bK, pS, bK, bK, bK, bK, bK}, -/*WRITE */{ pS, xT, xT, bK, bK, bK, bK, pS, pS, bK, bK, pS, bK, bK, bK, bK, bK}, -/*UNMAP */{ pS, bK, bK, pS, bK, bK, bK, pS, pS, bK, bK, pS, bK, bK, bK, bK, bK}, -/*MD_SNS */{ bK, bK, bK, bK, pS, bK, bK, pS, pS, bK, bK, pS, bK, bK, bK, bK, bK}, -/*MD_SEL */{ bK, bK, bK, bK, bK, bK, bK, pS, pS, bK, bK, pS, bK, bK, bK, bK, bK}, -/*RQ_SNS */{ pS, pS, pS, pS, pS, pS, bK, pS, pS, bK, bK, pS, bK, bK, bK, bK, bK}, -/*INQ */{ pS, pS, pS, pS, pS, pS, bK, pS, pS, bK, bK, pS, bK, bK, bK, bK, bK}, -/*RD_CAP */{ pS, pS, pS, pS, pS, pS, bK, pS, pS, bK, bK, pS, bK, bK, bK, bK, bK}, -/*RESV */{ bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK}, -/*REL */{ bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK}, -/*LOG_SNS */{ pS, pS, pS, pS, pS, bK, bK, pS, pS, bK, bK, pS, bK, bK, bK, bK, bK}, -/*FORMAT */{ pS, bK, bK, bK, bK, bK, pS, pS, bK, bK, bK, bK, bK, bK, bK, bK, bK}, -/*START */{ bK, bK, bK, bK, bK, bK, bK, pS, bK, bK, bK, bK, bK, bK, bK, bK, bK}, -/*PRES_IN */{ bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK}, -/*PRES_OUT*/{ bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK}, -/*MAIN_IN */{ bK, bK, bK, bK, bK, bK, bK, pS, bK, bK, bK, bK, bK, bK, bK, bK, pS} +/**>IDX_ :: 2nd:TUR RD WRT UNM MDSN MDSL RQSN INQ RDCP RES LSNS FMT STR*/ +/*TUR */{ pS, pS, pS, pS, bK, bK, bK, pS, pS, bK, pS, bK, bK}, +/*READ */{ pS, pS, xT, bK, bK, bK, bK, pS, pS, bK, pS, bK, bK}, +/*WRITE */{ pS, xT, xT, bK, bK, bK, bK, pS, pS, bK, pS, bK, bK}, +/*UNMAP */{ pS, bK, bK, pS, bK, bK, bK, pS, pS, bK, pS, bK, bK}, +/*MD_SNS */{ bK, bK, bK, bK, pS, bK, bK, pS, pS, bK, pS, bK, bK}, +/*MD_SEL */{ bK, bK, bK, bK, bK, bK, bK, pS, pS, bK, pS, bK, bK}, +/*RQ_SNS */{ pS, pS, pS, pS, pS, pS, bK, pS, pS, bK, pS, bK, bK}, +/*INQ */{ pS, pS, pS, pS, pS, pS, bK, pS, pS, pS, pS, bK, bK}, +/*RD_CAP */{ pS, pS, pS, pS, pS, pS, bK, pS, pS, pS, pS, bK, bK}, +/*RES */{ bK, bK, bK, bK, bK, bK, bK, pS, bK, bK, bK, bK, bK}, +/*LOG_SNS */{ pS, pS, pS, pS, pS, bK, bK, pS, pS, bK, pS, bK, bK}, +/*FORMAT */{ pS, bK, bK, bK, bK, bK, pS, pS, bK, bK, bK, bK, bK}, +/*START */{ bK, bK, bK, bK, bK, bK, bK, pS, bK, bK, bK, bK, bK}, }; diff --git a/sys/cam/ctl/ctl_tpc.c b/sys/cam/ctl/ctl_tpc.c new file mode 100644 index 00000000000..ad66ca9961b --- /dev/null +++ b/sys/cam/ctl/ctl_tpc.c @@ -0,0 +1,1370 @@ +/*- + * Copyright (c) 2014 Alexander Motin + * 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, + * without modification, immediately at the beginning of the file. + * 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 +#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 + +#define TPC_MAX_CSCDS 64 +#define TPC_MAX_SEGS 64 +#define TPC_MAX_SEG 0 +#define TPC_MAX_LIST 8192 +#define TPC_MAX_INLINE 0 +#define TPC_MAX_LISTS 255 +#define TPC_MAX_IO_SIZE (1024 * 1024) + +MALLOC_DEFINE(M_CTL_TPC, "ctltpc", "CTL TPC"); + +typedef enum { + TPC_ERR_RETRY = 0x000, + TPC_ERR_FAIL = 0x001, + TPC_ERR_MASK = 0x0ff, + TPC_ERR_NO_DECREMENT = 0x100 +} tpc_error_action; + +struct tpc_list; +TAILQ_HEAD(runl, tpc_io); +struct tpc_io { + union ctl_io *io; + uint64_t lun; + struct tpc_list *list; + struct runl run; + TAILQ_ENTRY(tpc_io) rlinks; + TAILQ_ENTRY(tpc_io) links; +}; + +struct tpc_list { + uint8_t service_action; + int init_port; + uint32_t init_idx; + uint32_t list_id; + uint8_t flags; + uint8_t *params; + struct scsi_ec_cscd *cscd; + struct scsi_ec_segment *seg[TPC_MAX_SEGS]; + uint8_t *inl; + int ncscd; + int nseg; + int leninl; + int curseg; + off_t curbytes; + int curops; + int stage; + uint8_t *buf; + int segbytes; + int tbdio; + int error; + int abort; + int completed; + TAILQ_HEAD(, tpc_io) allio; + struct scsi_sense_data sense_data; + uint8_t sense_len; + uint8_t scsi_status; + struct ctl_scsiio *ctsio; + struct ctl_lun *lun; + TAILQ_ENTRY(tpc_list) links; +}; + +void +ctl_tpc_init(struct ctl_lun *lun) +{ + + TAILQ_INIT(&lun->tpc_lists); +} + +void +ctl_tpc_shutdown(struct ctl_lun *lun) +{ + struct tpc_list *list; + + while ((list = TAILQ_FIRST(&lun->tpc_lists)) != NULL) { + TAILQ_REMOVE(&lun->tpc_lists, list, links); + KASSERT(list->completed, + ("Not completed TPC (%p) on shutdown", list)); + free(list, M_CTL); + } +} + +int +ctl_inquiry_evpd_tpc(struct ctl_scsiio *ctsio, int alloc_len) +{ + struct scsi_vpd_tpc *tpc_ptr; + struct scsi_vpd_tpc_descriptor *d_ptr; + struct scsi_vpd_tpc_descriptor_sc *sc_ptr; + struct scsi_vpd_tpc_descriptor_sc_descr *scd_ptr; + struct scsi_vpd_tpc_descriptor_pd *pd_ptr; + struct scsi_vpd_tpc_descriptor_sd *sd_ptr; + struct scsi_vpd_tpc_descriptor_sdid *sdid_ptr; + struct scsi_vpd_tpc_descriptor_gco *gco_ptr; + struct ctl_lun *lun; + int data_len; + + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + + data_len = sizeof(struct scsi_vpd_tpc) + + roundup2(sizeof(struct scsi_vpd_tpc_descriptor_sc) + + 2 * sizeof(struct scsi_vpd_tpc_descriptor_sc_descr) + 7, 4) + + sizeof(struct scsi_vpd_tpc_descriptor_pd) + + roundup2(sizeof(struct scsi_vpd_tpc_descriptor_sd) + 4, 4) + + roundup2(sizeof(struct scsi_vpd_tpc_descriptor_sdid) + 2, 4) + + sizeof(struct scsi_vpd_tpc_descriptor_gco); + + ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); + tpc_ptr = (struct scsi_vpd_tpc *)ctsio->kern_data_ptr; + ctsio->kern_sg_entries = 0; + + if (data_len < alloc_len) { + ctsio->residual = alloc_len - data_len; + ctsio->kern_data_len = data_len; + ctsio->kern_total_len = data_len; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + ctsio->kern_sg_entries = 0; + + /* + * The control device is always connected. The disk device, on the + * other hand, may not be online all the time. + */ + if (lun != NULL) + tpc_ptr->device = (SID_QUAL_LU_CONNECTED << 5) | + lun->be_lun->lun_type; + else + tpc_ptr->device = (SID_QUAL_LU_OFFLINE << 5) | T_DIRECT; + tpc_ptr->page_code = SVPD_SCSI_TPC; + scsi_ulto2b(data_len - 4, tpc_ptr->page_length); + + /* Supported commands */ + d_ptr = (struct scsi_vpd_tpc_descriptor *)&tpc_ptr->descr[0]; + sc_ptr = (struct scsi_vpd_tpc_descriptor_sc *)d_ptr; + scsi_ulto2b(SVPD_TPC_SC, sc_ptr->desc_type); + sc_ptr->list_length = 2 * sizeof(*scd_ptr) + 7; + scsi_ulto2b(roundup2(1 + sc_ptr->list_length, 4), sc_ptr->desc_length); + scd_ptr = &sc_ptr->descr[0]; + scd_ptr->opcode = EXTENDED_COPY; + scd_ptr->sa_length = 3; + scd_ptr->supported_service_actions[0] = EC_EC_LID1; + scd_ptr->supported_service_actions[1] = EC_EC_LID4; + scd_ptr->supported_service_actions[2] = EC_COA; + scd_ptr = (struct scsi_vpd_tpc_descriptor_sc_descr *) + &scd_ptr->supported_service_actions[scd_ptr->sa_length]; + scd_ptr->opcode = RECEIVE_COPY_STATUS; + scd_ptr->sa_length = 4; + scd_ptr->supported_service_actions[0] = RCS_RCS_LID1; + scd_ptr->supported_service_actions[1] = RCS_RCFD; + scd_ptr->supported_service_actions[2] = RCS_RCS_LID4; + scd_ptr->supported_service_actions[3] = RCS_RCOP; + + /* Parameter data. */ + d_ptr = (struct scsi_vpd_tpc_descriptor *) + (&d_ptr->parameters[0] + scsi_2btoul(d_ptr->desc_length)); + pd_ptr = (struct scsi_vpd_tpc_descriptor_pd *)d_ptr; + scsi_ulto2b(SVPD_TPC_PD, pd_ptr->desc_type); + scsi_ulto2b(sizeof(*pd_ptr) - 4, pd_ptr->desc_length); + scsi_ulto2b(TPC_MAX_CSCDS, pd_ptr->maximum_cscd_descriptor_count); + scsi_ulto2b(TPC_MAX_SEGS, pd_ptr->maximum_segment_descriptor_count); + scsi_ulto4b(TPC_MAX_LIST, pd_ptr->maximum_descriptor_list_length); + scsi_ulto4b(TPC_MAX_INLINE, pd_ptr->maximum_inline_data_length); + + /* Supported Descriptors */ + d_ptr = (struct scsi_vpd_tpc_descriptor *) + (&d_ptr->parameters[0] + scsi_2btoul(d_ptr->desc_length)); + sd_ptr = (struct scsi_vpd_tpc_descriptor_sd *)d_ptr; + scsi_ulto2b(SVPD_TPC_SD, sd_ptr->desc_type); + scsi_ulto2b(roundup2(sizeof(*sd_ptr) - 4 + 4, 4), sd_ptr->desc_length); + sd_ptr->list_length = 4; + sd_ptr->supported_descriptor_codes[0] = EC_SEG_B2B; + sd_ptr->supported_descriptor_codes[1] = EC_SEG_VERIFY; + sd_ptr->supported_descriptor_codes[2] = EC_SEG_REGISTER_KEY; + sd_ptr->supported_descriptor_codes[3] = EC_CSCD_ID; + + /* Supported CSCD Descriptor IDs */ + d_ptr = (struct scsi_vpd_tpc_descriptor *) + (&d_ptr->parameters[0] + scsi_2btoul(d_ptr->desc_length)); + sdid_ptr = (struct scsi_vpd_tpc_descriptor_sdid *)d_ptr; + scsi_ulto2b(SVPD_TPC_SDID, sdid_ptr->desc_type); + scsi_ulto2b(roundup2(sizeof(*sdid_ptr) - 4 + 2, 4), sdid_ptr->desc_length); + scsi_ulto2b(2, sdid_ptr->list_length); + scsi_ulto2b(0xffff, &sdid_ptr->supported_descriptor_ids[0]); + + /* General Copy Operations */ + d_ptr = (struct scsi_vpd_tpc_descriptor *) + (&d_ptr->parameters[0] + scsi_2btoul(d_ptr->desc_length)); + gco_ptr = (struct scsi_vpd_tpc_descriptor_gco *)d_ptr; + scsi_ulto2b(SVPD_TPC_GCO, gco_ptr->desc_type); + scsi_ulto2b(sizeof(*gco_ptr) - 4, gco_ptr->desc_length); + scsi_ulto4b(TPC_MAX_LISTS, gco_ptr->total_concurrent_copies); + scsi_ulto4b(TPC_MAX_LISTS, gco_ptr->maximum_identified_concurrent_copies); + scsi_ulto4b(TPC_MAX_SEG, gco_ptr->maximum_segment_length); + gco_ptr->data_segment_granularity = 0; + gco_ptr->inline_data_granularity = 0; + + ctsio->scsi_status = SCSI_STATUS_OK; + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + ctl_datamove((union ctl_io *)ctsio); + + return (CTL_RETVAL_COMPLETE); +} + +int +ctl_receive_copy_operating_parameters(struct ctl_scsiio *ctsio) +{ + struct ctl_lun *lun; + struct scsi_receive_copy_operating_parameters *cdb; + struct scsi_receive_copy_operating_parameters_data *data; + int retval; + int alloc_len, total_len; + + CTL_DEBUG_PRINT(("ctl_report_supported_tmf\n")); + + cdb = (struct scsi_receive_copy_operating_parameters *)ctsio->cdb; + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + + retval = CTL_RETVAL_COMPLETE; + + total_len = sizeof(*data) + 4; + alloc_len = scsi_4btoul(cdb->length); + + ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); + + ctsio->kern_sg_entries = 0; + + if (total_len < alloc_len) { + ctsio->residual = alloc_len - total_len; + ctsio->kern_data_len = total_len; + ctsio->kern_total_len = total_len; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + + data = (struct scsi_receive_copy_operating_parameters_data *)ctsio->kern_data_ptr; + scsi_ulto4b(sizeof(*data) - 4 + 4, data->length); + data->snlid = RCOP_SNLID; + scsi_ulto2b(TPC_MAX_CSCDS, data->maximum_cscd_descriptor_count); + scsi_ulto2b(TPC_MAX_SEGS, data->maximum_segment_descriptor_count); + scsi_ulto4b(TPC_MAX_LIST, data->maximum_descriptor_list_length); + scsi_ulto4b(TPC_MAX_SEG, data->maximum_segment_length); + scsi_ulto4b(TPC_MAX_INLINE, data->maximum_inline_data_length); + scsi_ulto4b(0, data->held_data_limit); + scsi_ulto4b(0, data->maximum_stream_device_transfer_size); + scsi_ulto2b(TPC_MAX_LISTS, data->total_concurrent_copies); + data->maximum_concurrent_copies = TPC_MAX_LISTS; + data->data_segment_granularity = 0; + data->inline_data_granularity = 0; + data->held_data_granularity = 0; + data->implemented_descriptor_list_length = 4; + data->list_of_implemented_descriptor_type_codes[0] = EC_SEG_B2B; + data->list_of_implemented_descriptor_type_codes[1] = EC_SEG_VERIFY; + data->list_of_implemented_descriptor_type_codes[2] = EC_SEG_REGISTER_KEY; + data->list_of_implemented_descriptor_type_codes[3] = EC_CSCD_ID; + + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + + ctl_datamove((union ctl_io *)ctsio); + return (retval); +} + +int +ctl_receive_copy_status_lid1(struct ctl_scsiio *ctsio) +{ + struct ctl_lun *lun; + struct scsi_receive_copy_status_lid1 *cdb; + struct scsi_receive_copy_status_lid1_data *data; + struct tpc_list *list; + struct tpc_list list_copy; + int retval; + int alloc_len, total_len; + uint32_t list_id; + + CTL_DEBUG_PRINT(("ctl_receive_copy_status_lid1\n")); + + cdb = (struct scsi_receive_copy_status_lid1 *)ctsio->cdb; + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + + retval = CTL_RETVAL_COMPLETE; + + list_id = cdb->list_identifier; + mtx_lock(&lun->lun_lock); + TAILQ_FOREACH(list, &lun->tpc_lists, links) { + if ((list->flags & EC_LIST_ID_USAGE_MASK) != + EC_LIST_ID_USAGE_NONE && list->list_id == list_id) + break; + } + if (list == NULL) { + mtx_unlock(&lun->lun_lock); + ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, + /*command*/ 1, /*field*/ 2, /*bit_valid*/ 0, + /*bit*/ 0); + ctl_done((union ctl_io *)ctsio); + return (retval); + } + list_copy = *list; + if (list->completed) { + TAILQ_REMOVE(&lun->tpc_lists, list, links); + free(list, M_CTL); + } + mtx_unlock(&lun->lun_lock); + + total_len = sizeof(*data); + alloc_len = scsi_4btoul(cdb->length); + + ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); + + ctsio->kern_sg_entries = 0; + + if (total_len < alloc_len) { + ctsio->residual = alloc_len - total_len; + ctsio->kern_data_len = total_len; + ctsio->kern_total_len = total_len; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + + data = (struct scsi_receive_copy_status_lid1_data *)ctsio->kern_data_ptr; + scsi_ulto4b(sizeof(*data) - 4, data->available_data); + if (list_copy.completed) { + if (list_copy.error || list_copy.abort) + data->copy_command_status = RCS_CCS_ERROR; + else + data->copy_command_status = RCS_CCS_COMPLETED; + } else + data->copy_command_status = RCS_CCS_INPROG; + scsi_ulto2b(list_copy.curseg, data->segments_processed); + if (list_copy.curbytes <= UINT32_MAX) { + data->transfer_count_units = RCS_TC_BYTES; + scsi_ulto4b(list_copy.curbytes, data->transfer_count); + } else { + data->transfer_count_units = RCS_TC_MBYTES; + scsi_ulto4b(list_copy.curbytes >> 20, data->transfer_count); + } + + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + + ctl_datamove((union ctl_io *)ctsio); + return (retval); +} + +int +ctl_receive_copy_failure_details(struct ctl_scsiio *ctsio) +{ + struct ctl_lun *lun; + struct scsi_receive_copy_failure_details *cdb; + struct scsi_receive_copy_failure_details_data *data; + struct tpc_list *list; + struct tpc_list list_copy; + int retval; + int alloc_len, total_len; + uint32_t list_id; + + CTL_DEBUG_PRINT(("ctl_receive_copy_failure_details\n")); + + cdb = (struct scsi_receive_copy_failure_details *)ctsio->cdb; + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + + retval = CTL_RETVAL_COMPLETE; + + list_id = cdb->list_identifier; + mtx_lock(&lun->lun_lock); + TAILQ_FOREACH(list, &lun->tpc_lists, links) { + if (list->completed && (list->flags & EC_LIST_ID_USAGE_MASK) != + EC_LIST_ID_USAGE_NONE && list->list_id == list_id) + break; + } + if (list == NULL) { + mtx_unlock(&lun->lun_lock); + ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, + /*command*/ 1, /*field*/ 2, /*bit_valid*/ 0, + /*bit*/ 0); + ctl_done((union ctl_io *)ctsio); + return (retval); + } + list_copy = *list; + TAILQ_REMOVE(&lun->tpc_lists, list, links); + free(list, M_CTL); + mtx_unlock(&lun->lun_lock); + + total_len = sizeof(*data) + list_copy.sense_len; + alloc_len = scsi_4btoul(cdb->length); + + ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); + + ctsio->kern_sg_entries = 0; + + if (total_len < alloc_len) { + ctsio->residual = alloc_len - total_len; + ctsio->kern_data_len = total_len; + ctsio->kern_total_len = total_len; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + + data = (struct scsi_receive_copy_failure_details_data *)ctsio->kern_data_ptr; + if (list_copy.completed && (list_copy.error || list_copy.abort)) { + scsi_ulto4b(sizeof(*data) - 4, data->available_data); + data->copy_command_status = RCS_CCS_ERROR; + } else + scsi_ulto4b(0, data->available_data); + scsi_ulto2b(list_copy.sense_len, data->sense_data_length); + memcpy(data->sense_data, &list_copy.sense_data, list_copy.sense_len); + + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + + ctl_datamove((union ctl_io *)ctsio); + return (retval); +} + +int +ctl_receive_copy_status_lid4(struct ctl_scsiio *ctsio) +{ + struct ctl_lun *lun; + struct scsi_receive_copy_status_lid4 *cdb; + struct scsi_receive_copy_status_lid4_data *data; + struct tpc_list *list; + struct tpc_list list_copy; + int retval; + int alloc_len, total_len; + uint32_t list_id; + + CTL_DEBUG_PRINT(("ctl_receive_copy_status_lid4\n")); + + cdb = (struct scsi_receive_copy_status_lid4 *)ctsio->cdb; + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + + retval = CTL_RETVAL_COMPLETE; + + list_id = scsi_4btoul(cdb->list_identifier); + mtx_lock(&lun->lun_lock); + TAILQ_FOREACH(list, &lun->tpc_lists, links) { + if ((list->flags & EC_LIST_ID_USAGE_MASK) != + EC_LIST_ID_USAGE_NONE && list->list_id == list_id) + break; + } + if (list == NULL) { + mtx_unlock(&lun->lun_lock); + ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, + /*command*/ 1, /*field*/ 2, /*bit_valid*/ 0, + /*bit*/ 0); + ctl_done((union ctl_io *)ctsio); + return (retval); + } + list_copy = *list; + if (list->completed) { + TAILQ_REMOVE(&lun->tpc_lists, list, links); + free(list, M_CTL); + } + mtx_unlock(&lun->lun_lock); + + total_len = sizeof(*data) + list_copy.sense_len; + alloc_len = scsi_4btoul(cdb->length); + + ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); + + ctsio->kern_sg_entries = 0; + + if (total_len < alloc_len) { + ctsio->residual = alloc_len - total_len; + ctsio->kern_data_len = total_len; + ctsio->kern_total_len = total_len; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + + data = (struct scsi_receive_copy_status_lid4_data *)ctsio->kern_data_ptr; + scsi_ulto4b(sizeof(*data) - 4, data->available_data); + data->response_to_service_action = list_copy.service_action; + if (list_copy.completed) { + if (list_copy.error) + data->copy_command_status = RCS_CCS_ERROR; + else if (list_copy.abort) + data->copy_command_status = RCS_CCS_ABORTED; + else + data->copy_command_status = RCS_CCS_COMPLETED; + } else + data->copy_command_status = RCS_CCS_INPROG_FG; + scsi_ulto2b(list_copy.curops, data->operation_counter); + scsi_ulto4b(UINT32_MAX, data->estimated_status_update_delay); + if (list_copy.curbytes <= UINT32_MAX) { + data->transfer_count_units = RCS_TC_BYTES; + scsi_ulto4b(list_copy.curbytes, data->transfer_count); + } else { + data->transfer_count_units = RCS_TC_MBYTES; + scsi_ulto4b(list_copy.curbytes >> 20, data->transfer_count); + } + scsi_ulto2b(list_copy.curseg, data->segments_processed); + data->sense_data_length = list_copy.sense_len; + memcpy(data->sense_data, &list_copy.sense_data, list_copy.sense_len); + + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + + ctl_datamove((union ctl_io *)ctsio); + return (retval); +} + +int +ctl_copy_operation_abort(struct ctl_scsiio *ctsio) +{ + struct ctl_lun *lun; + struct scsi_copy_operation_abort *cdb; + struct tpc_list *list; + int retval; + uint32_t list_id; + + CTL_DEBUG_PRINT(("ctl_copy_operation_abort\n")); + + cdb = (struct scsi_copy_operation_abort *)ctsio->cdb; + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + + retval = CTL_RETVAL_COMPLETE; + + list_id = scsi_4btoul(cdb->list_identifier); + mtx_lock(&lun->lun_lock); + TAILQ_FOREACH(list, &lun->tpc_lists, links) { + if ((list->flags & EC_LIST_ID_USAGE_MASK) != + EC_LIST_ID_USAGE_NONE && list->list_id == list_id) + break; + } + if (list == NULL) { + mtx_unlock(&lun->lun_lock); + ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, + /*command*/ 1, /*field*/ 2, /*bit_valid*/ 0, + /*bit*/ 0); + ctl_done((union ctl_io *)ctsio); + return (retval); + } + list->abort = 1; + mtx_unlock(&lun->lun_lock); + + ctl_set_success(ctsio); + ctl_done((union ctl_io *)ctsio); + return (retval); +} + +static uint64_t +tpc_resolve(struct tpc_list *list, uint16_t idx, uint32_t *ss) +{ + + if (idx == 0xffff) { + if (ss && list->lun->be_lun) + *ss = list->lun->be_lun->blocksize; + return (list->lun->lun); + } + if (idx >= list->ncscd) + return (UINT64_MAX); + return (tpcl_resolve(list->init_port, &list->cscd[idx], ss)); +} + +static int +tpc_process_b2b(struct tpc_list *list) +{ + struct scsi_ec_segment_b2b *seg; + struct scsi_ec_cscd_dtsp *sdstp, *ddstp; + struct tpc_io *tior, *tiow; + struct runl run, *prun; + uint64_t sl, dl; + off_t srclba, dstlba, numbytes, donebytes, roundbytes; + int numlba; + uint32_t srcblock, dstblock; + + if (list->stage == 1) { +complete: + while ((tior = TAILQ_FIRST(&list->allio)) != NULL) { + TAILQ_REMOVE(&list->allio, tior, links); + ctl_free_io(tior->io); + free(tior, M_CTL); + } + free(list->buf, M_CTL); + if (list->abort) { + ctl_set_task_aborted(list->ctsio); + return (CTL_RETVAL_ERROR); + } else if (list->error) { + ctl_set_sense(list->ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_COPY_ABORTED, + /*asc*/ 0x0d, /*ascq*/ 0x01, SSD_ELEM_NONE); + return (CTL_RETVAL_ERROR); + } else { + list->curbytes += list->segbytes; + return (CTL_RETVAL_COMPLETE); + } + } + + TAILQ_INIT(&list->allio); + seg = (struct scsi_ec_segment_b2b *)list->seg[list->curseg]; + sl = tpc_resolve(list, scsi_2btoul(seg->src_cscd), &srcblock); + dl = tpc_resolve(list, scsi_2btoul(seg->dst_cscd), &dstblock); + if (sl >= CTL_MAX_LUNS || dl >= CTL_MAX_LUNS) { + ctl_set_sense(list->ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_COPY_ABORTED, + /*asc*/ 0x08, /*ascq*/ 0x04, SSD_ELEM_NONE); + return (CTL_RETVAL_ERROR); + } + sdstp = &list->cscd[scsi_2btoul(seg->src_cscd)].dtsp; + if (scsi_3btoul(sdstp->block_length) != 0) + srcblock = scsi_3btoul(sdstp->block_length); + ddstp = &list->cscd[scsi_2btoul(seg->dst_cscd)].dtsp; + if (scsi_3btoul(ddstp->block_length) != 0) + dstblock = scsi_3btoul(ddstp->block_length); + numlba = scsi_2btoul(seg->number_of_blocks); + if (seg->flags & EC_SEG_DC) + numbytes = (off_t)numlba * dstblock; + else + numbytes = (off_t)numlba * srcblock; + srclba = scsi_8btou64(seg->src_lba); + dstlba = scsi_8btou64(seg->dst_lba); + +// printf("Copy %ju bytes from %ju @ %ju to %ju @ %ju\n", +// (uintmax_t)numbytes, sl, scsi_8btou64(seg->src_lba), +// dl, scsi_8btou64(seg->dst_lba)); + + if (numbytes == 0) + return (CTL_RETVAL_COMPLETE); + + if (numbytes % srcblock != 0 || numbytes % dstblock != 0) { + ctl_set_sense(list->ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_COPY_ABORTED, + /*asc*/ 0x26, /*ascq*/ 0x0A, SSD_ELEM_NONE); + return (CTL_RETVAL_ERROR); + } + + list->buf = malloc(numbytes, M_CTL, M_WAITOK); + list->segbytes = numbytes; + donebytes = 0; + TAILQ_INIT(&run); + prun = &run; + list->tbdio = 1; + while (donebytes < numbytes) { + roundbytes = MIN(numbytes - donebytes, TPC_MAX_IO_SIZE); + + tior = malloc(sizeof(*tior), M_CTL, M_WAITOK | M_ZERO); + TAILQ_INIT(&tior->run); + tior->list = list; + TAILQ_INSERT_TAIL(&list->allio, tior, links); + tior->io = tpcl_alloc_io(); + if (tior->io == NULL) { + list->error = 1; + goto complete; + } + ctl_scsi_read_write(tior->io, + /*data_ptr*/ &list->buf[donebytes], + /*data_len*/ roundbytes, + /*read_op*/ 1, + /*byte2*/ 0, + /*minimum_cdb_size*/ 0, + /*lba*/ srclba + donebytes / srcblock, + /*num_blocks*/ roundbytes / srcblock, + /*tag_type*/ CTL_TAG_SIMPLE, + /*control*/ 0); + tior->io->io_hdr.retries = 3; + tior->lun = sl; + tior->io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = tior; + + tiow = malloc(sizeof(*tior), M_CTL, M_WAITOK | M_ZERO); + TAILQ_INIT(&tiow->run); + tiow->list = list; + TAILQ_INSERT_TAIL(&list->allio, tiow, links); + tiow->io = tpcl_alloc_io(); + if (tiow->io == NULL) { + list->error = 1; + goto complete; + } + ctl_scsi_read_write(tiow->io, + /*data_ptr*/ &list->buf[donebytes], + /*data_len*/ roundbytes, + /*read_op*/ 0, + /*byte2*/ 0, + /*minimum_cdb_size*/ 0, + /*lba*/ dstlba + donebytes / dstblock, + /*num_blocks*/ roundbytes / dstblock, + /*tag_type*/ CTL_TAG_SIMPLE, + /*control*/ 0); + tiow->io->io_hdr.retries = 3; + tiow->lun = dl; + tiow->io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = tior; + + TAILQ_INSERT_TAIL(&tior->run, tiow, rlinks); + TAILQ_INSERT_TAIL(prun, tior, rlinks); + prun = &tior->run; + donebytes += roundbytes; + } + + while ((tior = TAILQ_FIRST(&run)) != NULL) { + TAILQ_REMOVE(&run, tior, rlinks); + if (tpcl_queue(tior->io, tior->lun) != CTL_RETVAL_COMPLETE) + panic("tpcl_queue() error"); + } + + list->stage++; + return (CTL_RETVAL_QUEUED); +} + +static int +tpc_process_verify(struct tpc_list *list) +{ + struct scsi_ec_segment_verify *seg; + struct tpc_io *tio; + uint64_t sl; + + if (list->stage == 1) { +complete: + while ((tio = TAILQ_FIRST(&list->allio)) != NULL) { + TAILQ_REMOVE(&list->allio, tio, links); + ctl_free_io(tio->io); + free(tio, M_CTL); + } + if (list->abort) { + ctl_set_task_aborted(list->ctsio); + return (CTL_RETVAL_ERROR); + } else if (list->error) { + ctl_set_sense(list->ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_COPY_ABORTED, + /*asc*/ 0x0d, /*ascq*/ 0x01, SSD_ELEM_NONE); + return (CTL_RETVAL_ERROR); + } else + return (CTL_RETVAL_COMPLETE); + } + + TAILQ_INIT(&list->allio); + seg = (struct scsi_ec_segment_verify *)list->seg[list->curseg]; + sl = tpc_resolve(list, scsi_2btoul(seg->src_cscd), NULL); + if (sl >= CTL_MAX_LUNS) { + ctl_set_sense(list->ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_COPY_ABORTED, + /*asc*/ 0x08, /*ascq*/ 0x04, SSD_ELEM_NONE); + return (CTL_RETVAL_ERROR); + } + +// printf("Verify %ju\n", sl); + + if ((seg->tur & 0x01) == 0) + return (CTL_RETVAL_COMPLETE); + + list->tbdio = 1; + tio = malloc(sizeof(*tio), M_CTL, M_WAITOK | M_ZERO); + TAILQ_INIT(&tio->run); + tio->list = list; + TAILQ_INSERT_TAIL(&list->allio, tio, links); + tio->io = tpcl_alloc_io(); + if (tio->io == NULL) { + list->error = 1; + goto complete; + } + ctl_scsi_tur(tio->io, /*tag_type*/ CTL_TAG_SIMPLE, /*control*/ 0); + tio->io->io_hdr.retries = 3; + tio->lun = sl; + tio->io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = tio; + list->stage++; + if (tpcl_queue(tio->io, tio->lun) != CTL_RETVAL_COMPLETE) + panic("tpcl_queue() error"); + return (CTL_RETVAL_QUEUED); +} + +static int +tpc_process_register_key(struct tpc_list *list) +{ + struct scsi_ec_segment_register_key *seg; + struct tpc_io *tio; + uint64_t dl; + int datalen; + + if (list->stage == 1) { +complete: + while ((tio = TAILQ_FIRST(&list->allio)) != NULL) { + TAILQ_REMOVE(&list->allio, tio, links); + ctl_free_io(tio->io); + free(tio, M_CTL); + } + free(list->buf, M_CTL); + if (list->abort) { + ctl_set_task_aborted(list->ctsio); + return (CTL_RETVAL_ERROR); + } else if (list->error) { + ctl_set_sense(list->ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_COPY_ABORTED, + /*asc*/ 0x0d, /*ascq*/ 0x01, SSD_ELEM_NONE); + return (CTL_RETVAL_ERROR); + } else + return (CTL_RETVAL_COMPLETE); + } + + TAILQ_INIT(&list->allio); + seg = (struct scsi_ec_segment_register_key *)list->seg[list->curseg]; + dl = tpc_resolve(list, scsi_2btoul(seg->dst_cscd), NULL); + if (dl >= CTL_MAX_LUNS) { + ctl_set_sense(list->ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_COPY_ABORTED, + /*asc*/ 0x08, /*ascq*/ 0x04, SSD_ELEM_NONE); + return (CTL_RETVAL_ERROR); + } + +// printf("Register Key %ju\n", dl); + + list->tbdio = 1; + tio = malloc(sizeof(*tio), M_CTL, M_WAITOK | M_ZERO); + TAILQ_INIT(&tio->run); + tio->list = list; + TAILQ_INSERT_TAIL(&list->allio, tio, links); + tio->io = tpcl_alloc_io(); + if (tio->io == NULL) { + list->error = 1; + goto complete; + } + datalen = sizeof(struct scsi_per_res_out_parms); + list->buf = malloc(datalen, M_CTL, M_WAITOK); + ctl_scsi_persistent_res_out(tio->io, + list->buf, datalen, SPRO_REGISTER, -1, + scsi_8btou64(seg->res_key), scsi_8btou64(seg->sa_res_key), + /*tag_type*/ CTL_TAG_SIMPLE, /*control*/ 0); + tio->io->io_hdr.retries = 3; + tio->lun = dl; + tio->io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = tio; + list->stage++; + if (tpcl_queue(tio->io, tio->lun) != CTL_RETVAL_COMPLETE) + panic("tpcl_queue() error"); + return (CTL_RETVAL_QUEUED); +} + +static void +tpc_process(struct tpc_list *list) +{ + struct ctl_lun *lun = list->lun; + struct scsi_ec_segment *seg; + struct ctl_scsiio *ctsio = list->ctsio; + int retval = CTL_RETVAL_COMPLETE; + +//printf("ZZZ %d cscd, %d segs\n", list->ncscd, list->nseg); + while (list->curseg < list->nseg) { + seg = list->seg[list->curseg]; + switch (seg->type_code) { + case EC_SEG_B2B: + retval = tpc_process_b2b(list); + break; + case EC_SEG_VERIFY: + retval = tpc_process_verify(list); + break; + case EC_SEG_REGISTER_KEY: + retval = tpc_process_register_key(list); + break; + default: + ctl_set_sense(ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_COPY_ABORTED, + /*asc*/ 0x26, /*ascq*/ 0x09, SSD_ELEM_NONE); + goto done; + } + if (retval == CTL_RETVAL_QUEUED) + return; + if (retval == CTL_RETVAL_ERROR) { + list->error = 1; + goto done; + } + list->curseg++; + list->stage = 0; + } + + ctl_set_success(ctsio); + +done: +//printf("ZZZ done\n"); + mtx_lock(&lun->lun_lock); + if ((list->flags & EC_LIST_ID_USAGE_MASK) == EC_LIST_ID_USAGE_NONE) { + TAILQ_REMOVE(&lun->tpc_lists, list, links); + free(list, M_CTL); + } else { + list->completed = 1; + list->sense_data = ctsio->sense_data; + list->sense_len = ctsio->sense_len; + list->scsi_status = ctsio->scsi_status; + } + mtx_unlock(&lun->lun_lock); + + ctl_done((union ctl_io *)ctsio); +} + +/* + * For any sort of check condition, busy, etc., we just retry. We do not + * decrement the retry count for unit attention type errors. These are + * normal, and we want to save the retry count for "real" errors. Otherwise, + * we could end up with situations where a command will succeed in some + * situations and fail in others, depending on whether a unit attention is + * pending. Also, some of our error recovery actions, most notably the + * LUN reset action, will cause a unit attention. + * + * We can add more detail here later if necessary. + */ +static tpc_error_action +tpc_checkcond_parse(union ctl_io *io) +{ + tpc_error_action error_action; + int error_code, sense_key, asc, ascq; + + /* + * Default to retrying the command. + */ + error_action = TPC_ERR_RETRY; + + scsi_extract_sense_len(&io->scsiio.sense_data, + io->scsiio.sense_len, + &error_code, + &sense_key, + &asc, + &ascq, + /*show_errors*/ 1); + + switch (error_code) { + case SSD_DEFERRED_ERROR: + case SSD_DESC_DEFERRED_ERROR: + error_action |= TPC_ERR_NO_DECREMENT; + break; + case SSD_CURRENT_ERROR: + case SSD_DESC_CURRENT_ERROR: + default: + switch (sense_key) { + case SSD_KEY_UNIT_ATTENTION: + error_action |= TPC_ERR_NO_DECREMENT; + break; + case SSD_KEY_HARDWARE_ERROR: + /* + * This is our generic "something bad happened" + * error code. It often isn't recoverable. + */ + if ((asc == 0x44) && (ascq == 0x00)) + error_action = TPC_ERR_FAIL; + break; + case SSD_KEY_NOT_READY: + /* + * If the LUN is powered down, there likely isn't + * much point in retrying right now. + */ + if ((asc == 0x04) && (ascq == 0x02)) + error_action = TPC_ERR_FAIL; + /* + * If the LUN is offline, there probably isn't much + * point in retrying, either. + */ + if ((asc == 0x04) && (ascq == 0x03)) + error_action = TPC_ERR_FAIL; + break; + } + } + return (error_action); +} + +static tpc_error_action +tpc_error_parse(union ctl_io *io) +{ + tpc_error_action error_action = TPC_ERR_RETRY; + + switch (io->io_hdr.io_type) { + case CTL_IO_SCSI: + switch (io->io_hdr.status & CTL_STATUS_MASK) { + case CTL_SCSI_ERROR: + switch (io->scsiio.scsi_status) { + case SCSI_STATUS_CHECK_COND: + error_action = tpc_checkcond_parse(io); + break; + default: + break; + } + break; + default: + break; + } + break; + case CTL_IO_TASK: + break; + default: + panic("%s: invalid ctl_io type %d\n", __func__, + io->io_hdr.io_type); + break; + } + return (error_action); +} + +void +tpc_done(union ctl_io *io) +{ + struct tpc_io *tio, *tior; + + /* + * Very minimal retry logic. We basically retry if we got an error + * back, and the retry count is greater than 0. If we ever want + * more sophisticated initiator type behavior, the CAM error + * recovery code in ../common might be helpful. + */ +// if ((io->io_hdr.status & CTL_STATUS_MASK) != CTL_SUCCESS) +// ctl_io_error_print(io, NULL); + tio = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr; + if (((io->io_hdr.status & CTL_STATUS_MASK) != CTL_SUCCESS) + && (io->io_hdr.retries > 0)) { + ctl_io_status old_status; + tpc_error_action error_action; + + error_action = tpc_error_parse(io); + switch (error_action & TPC_ERR_MASK) { + case TPC_ERR_FAIL: + break; + case TPC_ERR_RETRY: + default: + if ((error_action & TPC_ERR_NO_DECREMENT) == 0) + io->io_hdr.retries--; + old_status = io->io_hdr.status; + io->io_hdr.status = CTL_STATUS_NONE; + io->io_hdr.flags &= ~CTL_FLAG_ABORT; + io->io_hdr.flags &= ~CTL_FLAG_SENT_2OTHER_SC; + if (tpcl_queue(io, tio->lun) != CTL_RETVAL_COMPLETE) { + printf("%s: error returned from ctl_queue()!\n", + __func__); + io->io_hdr.status = old_status; + } else + return; + } + } + + if ((io->io_hdr.status & CTL_STATUS_MASK) != CTL_SUCCESS) + tio->list->error = 1; + else + atomic_add_int(&tio->list->curops, 1); + if (!tio->list->error && !tio->list->abort) { + while ((tior = TAILQ_FIRST(&tio->run)) != NULL) { + TAILQ_REMOVE(&tio->run, tior, rlinks); + atomic_add_int(&tio->list->tbdio, 1); + if (tpcl_queue(tior->io, tior->lun) != CTL_RETVAL_COMPLETE) + panic("tpcl_queue() error"); + } + } + if (atomic_fetchadd_int(&tio->list->tbdio, -1) == 1) + tpc_process(tio->list); +} + +int +ctl_extended_copy_lid1(struct ctl_scsiio *ctsio) +{ + struct scsi_extended_copy *cdb; + struct scsi_extended_copy_lid1_data *data; + struct ctl_lun *lun; + struct tpc_list *list, *tlist; + uint8_t *ptr; + char *value; + int len, off, lencscd, lenseg, leninl, nseg; + + CTL_DEBUG_PRINT(("ctl_extended_copy_lid1\n")); + + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + cdb = (struct scsi_extended_copy *)ctsio->cdb; + len = scsi_4btoul(cdb->length); + + if (len < sizeof(struct scsi_extended_copy_lid1_data) || + len > sizeof(struct scsi_extended_copy_lid1_data) + + TPC_MAX_LIST + TPC_MAX_INLINE) { + ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 1, + /*field*/ 9, /*bit_valid*/ 0, /*bit*/ 0); + goto done; + } + + /* + * If we've got a kernel request that hasn't been malloced yet, + * malloc it and tell the caller the data buffer is here. + */ + if ((ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) == 0) { + ctsio->kern_data_ptr = malloc(len, M_CTL, M_WAITOK); + ctsio->kern_data_len = len; + ctsio->kern_total_len = len; + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + ctsio->kern_sg_entries = 0; + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + ctl_datamove((union ctl_io *)ctsio); + + return (CTL_RETVAL_COMPLETE); + } + + data = (struct scsi_extended_copy_lid1_data *)ctsio->kern_data_ptr; + lencscd = scsi_2btoul(data->cscd_list_length); + lenseg = scsi_4btoul(data->segment_list_length); + leninl = scsi_4btoul(data->inline_data_length); + if (len < sizeof(struct scsi_extended_copy_lid1_data) + + lencscd + lenseg + leninl || + leninl > TPC_MAX_INLINE) { + ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 0, + /*field*/ 2, /*bit_valid*/ 0, /*bit*/ 0); + goto done; + } + if (lencscd > TPC_MAX_CSCDS * sizeof(struct scsi_ec_cscd)) { + ctl_set_sense(ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST, + /*asc*/ 0x26, /*ascq*/ 0x06, SSD_ELEM_NONE); + goto done; + } + if (lencscd + lenseg > TPC_MAX_LIST) { + ctl_set_param_len_error(ctsio); + goto done; + } + + list = malloc(sizeof(struct tpc_list), M_CTL, M_WAITOK | M_ZERO); + list->service_action = cdb->service_action; + value = ctl_get_opt(&lun->be_lun->options, "insecure_tpc"); + if (value != NULL && strcmp(value, "on") == 0) + list->init_port = -1; + else + list->init_port = ctsio->io_hdr.nexus.targ_port; + list->init_idx = ctl_get_resindex(&ctsio->io_hdr.nexus); + list->list_id = data->list_identifier; + list->flags = data->flags; + list->params = ctsio->kern_data_ptr; + list->cscd = (struct scsi_ec_cscd *)&data->data[0]; + ptr = &data->data[lencscd]; + for (nseg = 0, off = 0; off < lenseg; nseg++) { + if (nseg >= TPC_MAX_SEGS) { + free(list, M_CTL); + ctl_set_sense(ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST, + /*asc*/ 0x26, /*ascq*/ 0x08, SSD_ELEM_NONE); + goto done; + } + list->seg[nseg] = (struct scsi_ec_segment *)(ptr + off); + off += sizeof(struct scsi_ec_segment) + + scsi_2btoul(list->seg[nseg]->descr_length); + } + list->inl = &data->data[lencscd + lenseg]; + list->ncscd = lencscd / sizeof(struct scsi_ec_cscd); + list->nseg = nseg; + list->leninl = leninl; + list->ctsio = ctsio; + list->lun = lun; + mtx_lock(&lun->lun_lock); + if ((list->flags & EC_LIST_ID_USAGE_MASK) != EC_LIST_ID_USAGE_NONE) { + TAILQ_FOREACH(tlist, &lun->tpc_lists, links) { + if ((tlist->flags & EC_LIST_ID_USAGE_MASK) != + EC_LIST_ID_USAGE_NONE && + tlist->list_id == list->list_id) + break; + } + if (tlist != NULL && !tlist->completed) { + mtx_unlock(&lun->lun_lock); + free(list, M_CTL); + ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, + /*command*/ 0, /*field*/ 0, /*bit_valid*/ 0, + /*bit*/ 0); + goto done; + } + if (tlist != NULL) { + TAILQ_REMOVE(&lun->tpc_lists, tlist, links); + free(tlist, M_CTL); + } + } + TAILQ_INSERT_TAIL(&lun->tpc_lists, list, links); + mtx_unlock(&lun->lun_lock); + + tpc_process(list); + return (CTL_RETVAL_COMPLETE); + +done: + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); +} + +int +ctl_extended_copy_lid4(struct ctl_scsiio *ctsio) +{ + struct scsi_extended_copy *cdb; + struct scsi_extended_copy_lid4_data *data; + struct ctl_lun *lun; + struct tpc_list *list, *tlist; + uint8_t *ptr; + char *value; + int len, off, lencscd, lenseg, leninl, nseg; + + CTL_DEBUG_PRINT(("ctl_extended_copy_lid4\n")); + + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + cdb = (struct scsi_extended_copy *)ctsio->cdb; + len = scsi_4btoul(cdb->length); + + if (len < sizeof(struct scsi_extended_copy_lid4_data) || + len > sizeof(struct scsi_extended_copy_lid4_data) + + TPC_MAX_LIST + TPC_MAX_INLINE) { + ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 1, + /*field*/ 9, /*bit_valid*/ 0, /*bit*/ 0); + goto done; + } + + /* + * If we've got a kernel request that hasn't been malloced yet, + * malloc it and tell the caller the data buffer is here. + */ + if ((ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) == 0) { + ctsio->kern_data_ptr = malloc(len, M_CTL, M_WAITOK); + ctsio->kern_data_len = len; + ctsio->kern_total_len = len; + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + ctsio->kern_sg_entries = 0; + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + ctl_datamove((union ctl_io *)ctsio); + + return (CTL_RETVAL_COMPLETE); + } + + data = (struct scsi_extended_copy_lid4_data *)ctsio->kern_data_ptr; + lencscd = scsi_2btoul(data->cscd_list_length); + lenseg = scsi_2btoul(data->segment_list_length); + leninl = scsi_2btoul(data->inline_data_length); + if (len < sizeof(struct scsi_extended_copy_lid4_data) + + lencscd + lenseg + leninl || + leninl > TPC_MAX_INLINE) { + ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 0, + /*field*/ 2, /*bit_valid*/ 0, /*bit*/ 0); + goto done; + } + if (lencscd > TPC_MAX_CSCDS * sizeof(struct scsi_ec_cscd)) { + ctl_set_sense(ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST, + /*asc*/ 0x26, /*ascq*/ 0x06, SSD_ELEM_NONE); + goto done; + } + if (lencscd + lenseg > TPC_MAX_LIST) { + ctl_set_param_len_error(ctsio); + goto done; + } + + list = malloc(sizeof(struct tpc_list), M_CTL, M_WAITOK | M_ZERO); + list->service_action = cdb->service_action; + value = ctl_get_opt(&lun->be_lun->options, "insecure_tpc"); + if (value != NULL && strcmp(value, "on") == 0) + list->init_port = -1; + else + list->init_port = ctsio->io_hdr.nexus.targ_port; + list->init_idx = ctl_get_resindex(&ctsio->io_hdr.nexus); + list->list_id = scsi_4btoul(data->list_identifier); + list->flags = data->flags; + list->params = ctsio->kern_data_ptr; + list->cscd = (struct scsi_ec_cscd *)&data->data[0]; + ptr = &data->data[lencscd]; + for (nseg = 0, off = 0; off < lenseg; nseg++) { + if (nseg >= TPC_MAX_SEGS) { + free(list, M_CTL); + ctl_set_sense(ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST, + /*asc*/ 0x26, /*ascq*/ 0x08, SSD_ELEM_NONE); + goto done; + } + list->seg[nseg] = (struct scsi_ec_segment *)(ptr + off); + off += sizeof(struct scsi_ec_segment) + + scsi_2btoul(list->seg[nseg]->descr_length); + } + list->inl = &data->data[lencscd + lenseg]; + list->ncscd = lencscd / sizeof(struct scsi_ec_cscd); + list->nseg = nseg; + list->leninl = leninl; + list->ctsio = ctsio; + list->lun = lun; + mtx_lock(&lun->lun_lock); + if ((list->flags & EC_LIST_ID_USAGE_MASK) != EC_LIST_ID_USAGE_NONE) { + TAILQ_FOREACH(tlist, &lun->tpc_lists, links) { + if ((tlist->flags & EC_LIST_ID_USAGE_MASK) != + EC_LIST_ID_USAGE_NONE && + tlist->list_id == list->list_id) + break; + } + if (tlist != NULL && !tlist->completed) { + mtx_unlock(&lun->lun_lock); + free(list, M_CTL); + ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, + /*command*/ 0, /*field*/ 0, /*bit_valid*/ 0, + /*bit*/ 0); + goto done; + } + if (tlist != NULL) { + TAILQ_REMOVE(&lun->tpc_lists, tlist, links); + free(tlist, M_CTL); + } + } + TAILQ_INSERT_TAIL(&lun->tpc_lists, list, links); + mtx_unlock(&lun->lun_lock); + + tpc_process(list); + return (CTL_RETVAL_COMPLETE); + +done: + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); +} + diff --git a/sys/ia64/include/sigframe.h b/sys/cam/ctl/ctl_tpc.h similarity index 76% rename from sys/ia64/include/sigframe.h rename to sys/cam/ctl/ctl_tpc.h index d0e886e9bc9..ecbaec105d3 100644 --- a/sys/ia64/include/sigframe.h +++ b/sys/cam/ctl/ctl_tpc.h @@ -1,18 +1,16 @@ /*- - * Copyright (c) 1999 Marcel Moolenaar + * Copyright (c) 2014 Alexander Motin * 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 - * in this position and unchanged. + * notice, this list of conditions and the following disclaimer, + * without modification, immediately at the beginning of the file. * 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. The name of the author may not 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 @@ -28,12 +26,13 @@ * $FreeBSD$ */ -#ifndef _MACHINE_SIGFRAME_H_ -#define _MACHINE_SIGFRAME_H_ 1 +#ifndef _CTL_TPC_H +#define _CTL_TPC_H 1 -struct sigframe { - ucontext_t sf_uc; - siginfo_t sf_si; -}; +void tpc_done(union ctl_io *io); -#endif /* _MACHINE_SIGFRAME_H_ */ +uint64_t tpcl_resolve(int init_port, struct scsi_ec_cscd *cscd, uint32_t *ss); +union ctl_io * tpcl_alloc_io(void); +int tpcl_queue(union ctl_io *io, uint64_t lun); + +#endif /* _CTL_TPC_H */ diff --git a/sys/cam/ctl/ctl_tpc_local.c b/sys/cam/ctl/ctl_tpc_local.c new file mode 100644 index 00000000000..8fb797865ad --- /dev/null +++ b/sys/cam/ctl/ctl_tpc_local.c @@ -0,0 +1,387 @@ +/*- + * Copyright (c) 2014 Alexander Motin + * Copyright (c) 2004, 2005 Silicon Graphics International Corp. + * 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, + * without modification, immediately at the beginning of the file. + * 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 +#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 tpcl_softc { + struct ctl_port port; + int cur_tag_num; +}; + +extern struct ctl_softc *control_softc; +static struct tpcl_softc tpcl_softc; + +static int tpcl_init(void); +static void tpcl_shutdown(void); +static void tpcl_online(void *arg); +static void tpcl_offline(void *arg); +static int tpcl_lun_enable(void *arg, struct ctl_id target_id, int lun_id); +static int tpcl_lun_disable(void *arg, struct ctl_id target_id, int lun_id); +static void tpcl_datamove(union ctl_io *io); +static void tpcl_done(union ctl_io *io); + + +static struct ctl_frontend tpcl_frontend = +{ + .name = "tpc", + .init = tpcl_init, + .shutdown = tpcl_shutdown, +}; +CTL_FRONTEND_DECLARE(ctltpc, tpcl_frontend); + +static int +tpcl_init(void) +{ + struct ctl_softc *softc = control_softc; + struct tpcl_softc *tsoftc = &tpcl_softc; + struct ctl_port *port; + struct scsi_transportid_spi *tid; + int len; + + memset(tsoftc, 0, sizeof(*tsoftc)); + + port = &tsoftc->port; + port->frontend = &tpcl_frontend; + port->port_type = CTL_PORT_INTERNAL; + port->num_requested_ctl_io = 100; + port->port_name = "tpc"; + port->port_online = tpcl_online; + port->port_offline = tpcl_offline; + port->onoff_arg = tsoftc; + port->lun_enable = tpcl_lun_enable; + port->lun_disable = tpcl_lun_disable; + port->targ_lun_arg = tsoftc; + port->fe_datamove = tpcl_datamove; + port->fe_done = tpcl_done; + port->max_targets = 1; + port->max_target_id = 0; + port->max_initiators = 1; + + if (ctl_port_register(port, (softc->flags & CTL_FLAG_MASTER_SHELF)) != 0) + { + printf("%s: tpc frontend registration failed\n", __func__); + return (0); + } + + len = sizeof(struct scsi_transportid_spi); + port->init_devid = malloc(sizeof(struct ctl_devid) + len, + M_CTL, M_WAITOK | M_ZERO); + port->init_devid->len = len; + tid = (struct scsi_transportid_spi *)port->init_devid->data; + tid->format_protocol = SCSI_TRN_SPI_FORMAT_DEFAULT | SCSI_PROTO_SPI; + scsi_ulto2b(0, tid->scsi_addr); + scsi_ulto2b(port->targ_port, tid->rel_trgt_port_id); + + ctl_port_online(port); + return (0); +} + +void +tpcl_shutdown(void) +{ + struct tpcl_softc *tsoftc = &tpcl_softc; + struct ctl_port *port; + + port = &tsoftc->port; + ctl_port_offline(port); + if (ctl_port_deregister(&tsoftc->port) != 0) + printf("%s: ctl_frontend_deregister() failed\n", __func__); +} + +static void +tpcl_online(void *arg) +{ +} + +static void +tpcl_offline(void *arg) +{ +} + +static int +tpcl_lun_enable(void *arg, struct ctl_id target_id, int lun_id) +{ + + return (0); +} + +static int +tpcl_lun_disable(void *arg, struct ctl_id target_id, int lun_id) +{ + + return (0); +} + +static void +tpcl_datamove(union ctl_io *io) +{ + struct ctl_sg_entry *ext_sglist, *kern_sglist; + struct ctl_sg_entry ext_entry, kern_entry; + int ext_sg_entries, kern_sg_entries; + int ext_sg_start, ext_offset; + int len_to_copy, len_copied; + int kern_watermark, ext_watermark; + struct ctl_scsiio *ctsio; + int i, j; + + ext_sg_start = 0; + ext_offset = 0; + ext_sglist = NULL; + + CTL_DEBUG_PRINT(("%s\n", __func__)); + + ctsio = &io->scsiio; + + /* + * If this is the case, we're probably doing a BBR read and don't + * actually need to transfer the data. This will effectively + * bit-bucket the data. + */ + if (ctsio->ext_data_ptr == NULL) + goto bailout; + + /* + * To simplify things here, if we have a single buffer, stick it in + * a S/G entry and just make it a single entry S/G list. + */ + if (ctsio->io_hdr.flags & CTL_FLAG_EDPTR_SGLIST) { + int len_seen; + + ext_sglist = (struct ctl_sg_entry *)ctsio->ext_data_ptr; + ext_sg_entries = ctsio->ext_sg_entries; + ext_sg_start = 0; + ext_offset = 0; + len_seen = 0; + for (i = 0; i < ext_sg_entries; i++) { + if ((len_seen + ext_sglist[i].len) >= + ctsio->ext_data_filled) { + ext_sg_start = i; + ext_offset = ctsio->ext_data_filled - len_seen; + break; + } + len_seen += ext_sglist[i].len; + } + } else { + ext_sglist = &ext_entry; + ext_sglist->addr = ctsio->ext_data_ptr; + ext_sglist->len = ctsio->ext_data_len; + ext_sg_entries = 1; + ext_sg_start = 0; + ext_offset = ctsio->ext_data_filled; + } + + if (ctsio->kern_sg_entries > 0) { + kern_sglist = (struct ctl_sg_entry *)ctsio->kern_data_ptr; + kern_sg_entries = ctsio->kern_sg_entries; + } else { + kern_sglist = &kern_entry; + kern_sglist->addr = ctsio->kern_data_ptr; + kern_sglist->len = ctsio->kern_data_len; + kern_sg_entries = 1; + } + + kern_watermark = 0; + ext_watermark = ext_offset; + len_copied = 0; + for (i = ext_sg_start, j = 0; + i < ext_sg_entries && j < kern_sg_entries;) { + uint8_t *ext_ptr, *kern_ptr; + + len_to_copy = min(ext_sglist[i].len - ext_watermark, + kern_sglist[j].len - kern_watermark); + + ext_ptr = (uint8_t *)ext_sglist[i].addr; + ext_ptr = ext_ptr + ext_watermark; + if (io->io_hdr.flags & CTL_FLAG_BUS_ADDR) { + /* + * XXX KDM fix this! + */ + panic("need to implement bus address support"); +#if 0 + kern_ptr = bus_to_virt(kern_sglist[j].addr); +#endif + } else + kern_ptr = (uint8_t *)kern_sglist[j].addr; + kern_ptr = kern_ptr + kern_watermark; + + kern_watermark += len_to_copy; + ext_watermark += len_to_copy; + + if ((ctsio->io_hdr.flags & CTL_FLAG_DATA_MASK) == + CTL_FLAG_DATA_IN) { + CTL_DEBUG_PRINT(("%s: copying %d bytes to user\n", + __func__, len_to_copy)); + CTL_DEBUG_PRINT(("%s: from %p to %p\n", __func__, + kern_ptr, ext_ptr)); + memcpy(ext_ptr, kern_ptr, len_to_copy); + } else { + CTL_DEBUG_PRINT(("%s: copying %d bytes from user\n", + __func__, len_to_copy)); + CTL_DEBUG_PRINT(("%s: from %p to %p\n", __func__, + ext_ptr, kern_ptr)); + memcpy(kern_ptr, ext_ptr, len_to_copy); + } + + len_copied += len_to_copy; + + if (ext_sglist[i].len == ext_watermark) { + i++; + ext_watermark = 0; + } + + if (kern_sglist[j].len == kern_watermark) { + j++; + kern_watermark = 0; + } + } + + ctsio->ext_data_filled += len_copied; + + CTL_DEBUG_PRINT(("%s: ext_sg_entries: %d, kern_sg_entries: %d\n", + __func__, ext_sg_entries, kern_sg_entries)); + CTL_DEBUG_PRINT(("%s: ext_data_len = %d, kern_data_len = %d\n", + __func__, ctsio->ext_data_len, ctsio->kern_data_len)); + + /* XXX KDM set residual?? */ +bailout: + io->scsiio.be_move_done(io); +} + +static void +tpcl_done(union ctl_io *io) +{ + + tpc_done(io); +} + +uint64_t +tpcl_resolve(int init_port, struct scsi_ec_cscd *cscd, uint32_t *ss) +{ + struct ctl_softc *softc = control_softc; + struct scsi_ec_cscd_id *cscdid; + struct ctl_port *port; + struct ctl_lun *lun; + uint64_t lunid = UINT64_MAX, l; + int i; + + if (cscd->type_code != EC_CSCD_ID) + return (lunid); + + cscdid = (struct scsi_ec_cscd_id *)cscd; + mtx_lock(&softc->ctl_lock); + if (init_port >= 0) { + port = softc->ctl_ports[ctl_port_idx(init_port)]; + if (port == NULL || port->lun_map == NULL) + init_port = -1; + } + if (init_port < 0) { + STAILQ_FOREACH(lun, &softc->lun_list, links) { + if (lun->lun_devid == NULL) + continue; + if (scsi_devid_match(lun->lun_devid->data, + lun->lun_devid->len, &cscdid->codeset, + cscdid->length + 4) == 0) { + lunid = lun->lun; + if (ss && lun->be_lun) + *ss = lun->be_lun->blocksize; + break; + } + } + } else { + for (i = 0; i < CTL_MAX_LUNS; i++) { + l = port->lun_map(port->targ_lun_arg, i); + if (l >= CTL_MAX_LUNS) + continue; + lun = softc->ctl_luns[l]; + if (lun == NULL || lun->lun_devid == NULL) + continue; + if (scsi_devid_match(lun->lun_devid->data, + lun->lun_devid->len, &cscdid->codeset, + cscdid->length + 4) == 0) { + lunid = lun->lun; + if (ss && lun->be_lun) + *ss = lun->be_lun->blocksize; + break; + } + } + } + mtx_unlock(&softc->ctl_lock); + return (lunid); +}; + +union ctl_io * +tpcl_alloc_io(void) +{ + struct tpcl_softc *tsoftc = &tpcl_softc; + + return (ctl_alloc_io(tsoftc->port.ctl_pool_ref)); +}; + +int +tpcl_queue(union ctl_io *io, uint64_t lun) +{ + struct tpcl_softc *tsoftc = &tpcl_softc; + + io->io_hdr.nexus.initid.id = 0; + io->io_hdr.nexus.targ_port = tsoftc->port.targ_port; + io->io_hdr.nexus.targ_target.id = 0; + io->io_hdr.nexus.targ_lun = lun; + io->scsiio.tag_num = atomic_fetchadd_int(&tsoftc->cur_tag_num, 1); + io->scsiio.ext_data_filled = 0; + return (ctl_queue(io)); +} diff --git a/sys/cam/ctl/ctl_util.c b/sys/cam/ctl/ctl_util.c index 3ca0aa243fc..b32fbd83276 100644 --- a/sys/cam/ctl/ctl_util.c +++ b/sys/cam/ctl/ctl_util.c @@ -84,6 +84,7 @@ static struct ctl_task_desc ctl_task_table[] = { {CTL_TASK_ABORT_TASK_SET, "Abort Task Set"}, {CTL_TASK_CLEAR_ACA, "Clear ACA"}, {CTL_TASK_CLEAR_TASK_SET, "Clear Task Set"}, + {CTL_TASK_I_T_NEXUS_RESET, "I_T Nexus Reset"}, {CTL_TASK_LUN_RESET, "LUN Reset"}, {CTL_TASK_TARGET_RESET, "Target Reset"}, {CTL_TASK_BUS_RESET, "Bus Reset"}, diff --git a/sys/cam/ctl/scsi_ctl.c b/sys/cam/ctl/scsi_ctl.c index 2ed8d2800f0..3529683f620 100644 --- a/sys/cam/ctl/scsi_ctl.c +++ b/sys/cam/ctl/scsi_ctl.c @@ -77,7 +77,7 @@ typedef enum { } ctlfe_ccb_types; struct ctlfe_softc { - struct ctl_frontend fe; + struct ctl_port port; path_id_t path_id; u_int maxio; struct cam_sim *sim; @@ -198,7 +198,7 @@ MALLOC_DEFINE(M_CTLFE, "CAM CTL FE", "CAM CTL FE interface"); int ctlfeinitialize(void); void ctlfeshutdown(void); -static periph_init_t ctlfeinit; +static periph_init_t ctlfeperiphinit; static void ctlfeasync(void *callback_arg, uint32_t code, struct cam_path *path, void *arg); static periph_ctor_t ctlferegister; @@ -211,8 +211,6 @@ static void ctlfedone(struct cam_periph *periph, static void ctlfe_onoffline(void *arg, int online); static void ctlfe_online(void *arg); static void ctlfe_offline(void *arg); -static int ctlfe_targ_enable(void *arg, struct ctl_id targ_id); -static int ctlfe_targ_disable(void *arg, struct ctl_id targ_id); static int ctlfe_lun_enable(void *arg, struct ctl_id targ_id, int lun_id); static int ctlfe_lun_disable(void *arg, struct ctl_id targ_id, @@ -225,26 +223,18 @@ static void ctlfe_dump(void); static struct periph_driver ctlfe_driver = { - ctlfeinit, "ctl", + ctlfeperiphinit, "ctl", TAILQ_HEAD_INITIALIZER(ctlfe_driver.units), /*generation*/ 0 }; -static int ctlfe_module_event_handler(module_t, int /*modeventtype_t*/, void *); - -/* - * We're not using PERIPHDRIVER_DECLARE(), because it runs at SI_SUB_DRIVERS, - * and that happens before CTL gets initialised. - */ -static moduledata_t ctlfe_moduledata = { - "ctlfe", - ctlfe_module_event_handler, - NULL +static struct ctl_frontend ctlfe_frontend = +{ + .name = "camtarget", + .init = ctlfeinitialize, + .fe_dump = ctlfe_dump, + .shutdown = ctlfeshutdown, }; - -DECLARE_MODULE(ctlfe, ctlfe_moduledata, SI_SUB_CONFIGURE, SI_ORDER_FOURTH); -MODULE_VERSION(ctlfe, 1); -MODULE_DEPEND(ctlfe, ctl, 1, 1, 1); -MODULE_DEPEND(ctlfe, cam, 1, 1, 1); +CTL_FRONTEND_DECLARE(ctlfe, ctlfe_frontend); extern struct ctl_softc *control_softc; @@ -254,41 +244,29 @@ ctlfeshutdown(void) return; } +int +ctlfeinitialize(void) +{ + + STAILQ_INIT(&ctlfe_softc_list); + mtx_init(&ctlfe_list_mtx, ctlfe_mtx_desc, NULL, MTX_DEF); + periphdriver_register(&ctlfe_driver); + return (0); +} + void -ctlfeinit(void) +ctlfeperiphinit(void) { cam_status status; - STAILQ_INIT(&ctlfe_softc_list); - - mtx_init(&ctlfe_list_mtx, ctlfe_mtx_desc, NULL, MTX_DEF); - - KASSERT(control_softc != NULL, ("CTL is not initialized!")); - status = xpt_register_async(AC_PATH_REGISTERED | AC_PATH_DEREGISTERED | AC_CONTRACT, ctlfeasync, NULL, NULL); - if (status != CAM_REQ_CMP) { printf("ctl: Failed to attach async callback due to CAM " "status 0x%x!\n", status); } } -static int -ctlfe_module_event_handler(module_t mod, int what, void *arg) -{ - - switch (what) { - case MOD_LOAD: - periphdriver_register(&ctlfe_driver); - return (0); - case MOD_UNLOAD: - return (EBUSY); - default: - return (EOPNOTSUPP); - } -} - static void ctlfeasync(void *callback_arg, uint32_t code, struct cam_path *path, void *arg) { @@ -304,7 +282,7 @@ ctlfeasync(void *callback_arg, uint32_t code, struct cam_path *path, void *arg) */ switch (code) { case AC_PATH_REGISTERED: { - struct ctl_frontend *fe; + struct ctl_port *port; struct ctlfe_softc *bus_softc; struct ccb_pathinq *cpi; int retval; @@ -386,56 +364,56 @@ ctlfeasync(void *callback_arg, uint32_t code, struct cam_path *path, void *arg) MTX_DEF); STAILQ_INIT(&bus_softc->lun_softc_list); - fe = &bus_softc->fe; + port = &bus_softc->port; + port->frontend = &ctlfe_frontend; /* * XXX KDM should we be more accurate here ? */ if (cpi->transport == XPORT_FC) - fe->port_type = CTL_PORT_FC; + port->port_type = CTL_PORT_FC; + else if (cpi->transport == XPORT_SAS) + port->port_type = CTL_PORT_SAS; else - fe->port_type = CTL_PORT_SCSI; + port->port_type = CTL_PORT_SCSI; /* XXX KDM what should the real number be here? */ - fe->num_requested_ctl_io = 4096; + port->num_requested_ctl_io = 4096; snprintf(bus_softc->port_name, sizeof(bus_softc->port_name), "%s%d", cpi->dev_name, cpi->unit_number); /* * XXX KDM it would be nice to allocate storage in the * frontend structure itself. */ - fe->port_name = bus_softc->port_name; - fe->physical_port = cpi->unit_number; - fe->virtual_port = cpi->bus_id; - fe->port_online = ctlfe_online; - fe->port_offline = ctlfe_offline; - fe->onoff_arg = bus_softc; - fe->targ_enable = ctlfe_targ_enable; - fe->targ_disable = ctlfe_targ_disable; - fe->lun_enable = ctlfe_lun_enable; - fe->lun_disable = ctlfe_lun_disable; - fe->targ_lun_arg = bus_softc; - fe->fe_datamove = ctlfe_datamove_done; - fe->fe_done = ctlfe_datamove_done; - fe->fe_dump = ctlfe_dump; + port->port_name = bus_softc->port_name; + port->physical_port = cpi->unit_number; + port->virtual_port = cpi->bus_id; + port->port_online = ctlfe_online; + port->port_offline = ctlfe_offline; + port->onoff_arg = bus_softc; + port->lun_enable = ctlfe_lun_enable; + port->lun_disable = ctlfe_lun_disable; + port->targ_lun_arg = bus_softc; + port->fe_datamove = ctlfe_datamove_done; + port->fe_done = ctlfe_datamove_done; /* * XXX KDM the path inquiry doesn't give us the maximum * number of targets supported. */ - fe->max_targets = cpi->max_target; - fe->max_target_id = cpi->max_target; + port->max_targets = cpi->max_target; + port->max_target_id = cpi->max_target; /* * XXX KDM need to figure out whether we're the master or * slave. */ #ifdef CTLFEDEBUG - printf("%s: calling ctl_frontend_register() for %s%d\n", + printf("%s: calling ctl_port_register() for %s%d\n", __func__, cpi->dev_name, cpi->unit_number); #endif - retval = ctl_frontend_register(fe, /*master_SC*/ 1); + retval = ctl_port_register(port, /*master_SC*/ 1); if (retval != 0) { - printf("%s: ctl_frontend_register() failed with " + printf("%s: ctl_port_register() failed with " "error %d!\n", __func__, retval); mtx_destroy(&bus_softc->lun_softc_mtx); free(bus_softc, M_CTLFE); @@ -466,7 +444,7 @@ ctlfeasync(void *callback_arg, uint32_t code, struct cam_path *path, void *arg) * XXX KDM are we certain at this point that there * are no outstanding commands for this frontend? */ - ctl_frontend_deregister(&softc->fe); + ctl_port_deregister(&softc->port); mtx_destroy(&softc->lun_softc_mtx); free(softc, M_CTLFE); } @@ -508,18 +486,18 @@ ctlfeasync(void *callback_arg, uint32_t code, struct cam_path *path, void *arg) break; } if (dev_chg->arrived != 0) { - retval = ctl_add_initiator(dev_chg->wwpn, - softc->fe.targ_port, dev_chg->target); + retval = ctl_add_initiator(&softc->port, + dev_chg->target, dev_chg->wwpn, NULL); } else { - retval = ctl_remove_initiator( - softc->fe.targ_port, dev_chg->target); + retval = ctl_remove_initiator(&softc->port, + dev_chg->target); } - if (retval != 0) { + if (retval < 0) { printf("%s: could not %s port %d iid %u " "WWPN %#jx!\n", __func__, (dev_chg->arrived != 0) ? "add" : - "remove", softc->fe.targ_port, + "remove", softc->port.targ_port, dev_chg->target, (uintmax_t)dev_chg->wwpn); } @@ -826,8 +804,8 @@ ctlfestart(struct cam_periph *periph, union ccb *start_ccb) if (io == NULL) { scsi_status = SCSI_STATUS_BUSY; csio->sense_len = 0; - } else if ((io->io_hdr.status & CTL_STATUS_MASK) == - CTL_CMD_ABORTED) { + } else if ((io->io_hdr.flags & CTL_FLAG_ABORT) && + (io->io_hdr.flags & CTL_FLAG_ABORT_STATUS) == 0) { io->io_hdr.flags &= ~CTL_FLAG_STATUS_QUEUED; /* @@ -1206,7 +1184,7 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb) * Allocate a ctl_io, pass it to CTL, and wait for the * datamove or done. */ - io = ctl_alloc_io(bus_softc->fe.ctl_pool_ref); + io = ctl_alloc_io(bus_softc->port.ctl_pool_ref); if (io == NULL) { atio->ccb_h.flags &= ~CAM_DIR_MASK; atio->ccb_h.flags |= CAM_DIR_NONE; @@ -1239,7 +1217,7 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb) */ io->io_hdr.io_type = CTL_IO_SCSI; io->io_hdr.nexus.initid.id = atio->init_id; - io->io_hdr.nexus.targ_port = bus_softc->fe.targ_port; + io->io_hdr.nexus.targ_port = bus_softc->port.targ_port; io->io_hdr.nexus.targ_target.id = atio->ccb_h.target_id; io->io_hdr.nexus.targ_lun = atio->ccb_h.target_lun; io->scsiio.tag_num = atio->tag_id; @@ -1511,7 +1489,7 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb) "seq %#x\n", __func__, inot->ccb_h.status, inot->tag_id, inot->seq_id); - io = ctl_alloc_io(bus_softc->fe.ctl_pool_ref); + io = ctl_alloc_io(bus_softc->port.ctl_pool_ref); if (io != NULL) { int send_ctl_io; @@ -1522,7 +1500,7 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb) io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr =done_ccb; inot->ccb_h.io_ptr = io; io->io_hdr.nexus.initid.id = inot->initiator_id; - io->io_hdr.nexus.targ_port = bus_softc->fe.targ_port; + io->io_hdr.nexus.targ_port = bus_softc->port.targ_port; io->io_hdr.nexus.targ_target.id = inot->ccb_h.target_id; io->io_hdr.nexus.targ_lun = inot->ccb_h.target_lun; /* XXX KDM should this be the tag_id? */ @@ -1734,7 +1712,7 @@ ctlfe_onoffline(void *arg, int online) * This should be replaced later with ddb_GetWWNN, * or possibly a more centralized scheme. (It * would be nice to have the WWNN/WWPN for each - * port stored in the ctl_frontend structure.) + * port stored in the ctl_port structure.) */ #ifdef RANDOM_WWNN ccb->knob.xport_specific.fc.wwnn = @@ -1747,7 +1725,7 @@ ctlfe_onoffline(void *arg, int online) 0x0000000fffffff00ULL) | /* Company ID */ 0x5000ED5000000000ULL | /* NL-Port */ 0x3000 | - /* Port Num */ (bus_softc->fe.targ_port & 0xff); + /* Port Num */ (bus_softc->port.targ_port & 0xff); /* * This is a bit of an API break/reversal, but if @@ -1756,10 +1734,9 @@ ctlfe_onoffline(void *arg, int online) * using with the frontend code so it's reported * accurately. */ - bus_softc->fe.wwnn = - ccb->knob.xport_specific.fc.wwnn; - bus_softc->fe.wwpn = - ccb->knob.xport_specific.fc.wwpn; + ctl_port_set_wwns(&bus_softc->port, + true, ccb->knob.xport_specific.fc.wwnn, + true, ccb->knob.xport_specific.fc.wwpn); set_wwnn = 1; #else /* RANDOM_WWNN */ /* @@ -1767,18 +1744,17 @@ ctlfe_onoffline(void *arg, int online) * down to the SIM. Otherwise, record what the SIM * has reported. */ - if ((bus_softc->fe.wwnn != 0) - && (bus_softc->fe.wwpn != 0)) { + if ((bus_softc->port.wwnn != 0) + && (bus_softc->port.wwpn != 0)) { ccb->knob.xport_specific.fc.wwnn = - bus_softc->fe.wwnn; + bus_softc->port.wwnn; ccb->knob.xport_specific.fc.wwpn = - bus_softc->fe.wwpn; + bus_softc->port.wwpn; set_wwnn = 1; } else { - bus_softc->fe.wwnn = - ccb->knob.xport_specific.fc.wwnn; - bus_softc->fe.wwpn = - ccb->knob.xport_specific.fc.wwpn; + ctl_port_set_wwns(&bus_softc->port, + true, ccb->knob.xport_specific.fc.wwnn, + true, ccb->knob.xport_specific.fc.wwpn); } #endif /* RANDOM_WWNN */ @@ -1927,18 +1903,6 @@ ctlfe_offline(void *arg) xpt_free_path(path); } -static int -ctlfe_targ_enable(void *arg, struct ctl_id targ_id) -{ - return (0); -} - -static int -ctlfe_targ_disable(void *arg, struct ctl_id targ_id) -{ - return (0); -} - /* * This will get called to enable a LUN on every bus that is attached to * CTL. So we only need to create a path/periph for this particular bus. diff --git a/sys/cam/scsi/scsi_all.c b/sys/cam/scsi/scsi_all.c index ff9dc1711c0..8351aa80f37 100644 --- a/sys/cam/scsi/scsi_all.c +++ b/sys/cam/scsi/scsi_all.c @@ -44,11 +44,13 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #else #include #include #include #include +#include #endif #include @@ -471,7 +473,8 @@ static struct op_table_entry scsi_op_codes[] = { */ /* 88 MM O O O READ(16) */ { 0x88, D | T | W | O | B, "READ(16)" }, - /* 89 */ + /* 89 O COMPARE AND WRITE*/ + { 0x89, D, "COMPARE AND WRITE" }, /* 8A OM O O O WRITE(16) */ { 0x8A, D | T | W | O | B, "WRITE(16)" }, /* 8B O ORWRITE */ @@ -5458,6 +5461,989 @@ scsi_get_devid(struct scsi_vpd_device_id *id, uint32_t page_len, return (NULL); } +int +scsi_transportid_sbuf(struct sbuf *sb, struct scsi_transportid_header *hdr, + uint32_t valid_len) +{ + switch (hdr->format_protocol & SCSI_TRN_PROTO_MASK) { + case SCSI_PROTO_FC: { + struct scsi_transportid_fcp *fcp; + uint64_t n_port_name; + + fcp = (struct scsi_transportid_fcp *)hdr; + + n_port_name = scsi_8btou64(fcp->n_port_name); + + sbuf_printf(sb, "FCP address: 0x%.16jx",(uintmax_t)n_port_name); + break; + } + case SCSI_PROTO_SPI: { + struct scsi_transportid_spi *spi; + + spi = (struct scsi_transportid_spi *)hdr; + + sbuf_printf(sb, "SPI address: %u,%u", + scsi_2btoul(spi->scsi_addr), + scsi_2btoul(spi->rel_trgt_port_id)); + break; + } + case SCSI_PROTO_SSA: + /* + * XXX KDM there is no transport ID defined in SPC-4 for + * SSA. + */ + break; + case SCSI_PROTO_1394: { + struct scsi_transportid_1394 *sbp; + uint64_t eui64; + + sbp = (struct scsi_transportid_1394 *)hdr; + + eui64 = scsi_8btou64(sbp->eui64); + sbuf_printf(sb, "SBP address: 0x%.16jx", (uintmax_t)eui64); + break; + } + case SCSI_PROTO_RDMA: { + struct scsi_transportid_rdma *rdma; + unsigned int i; + + rdma = (struct scsi_transportid_rdma *)hdr; + + sbuf_printf(sb, "RDMA address: 0x"); + for (i = 0; i < sizeof(rdma->initiator_port_id); i++) + sbuf_printf(sb, "%02x", rdma->initiator_port_id[i]); + break; + } + case SCSI_PROTO_ISCSI: { + uint32_t add_len, i; + uint8_t *iscsi_name = NULL; + int nul_found = 0; + + sbuf_printf(sb, "iSCSI address: "); + if ((hdr->format_protocol & SCSI_TRN_FORMAT_MASK) == + SCSI_TRN_ISCSI_FORMAT_DEVICE) { + struct scsi_transportid_iscsi_device *dev; + + dev = (struct scsi_transportid_iscsi_device *)hdr; + + /* + * Verify how much additional data we really have. + */ + add_len = scsi_2btoul(dev->additional_length); + add_len = MIN(add_len, valid_len - + __offsetof(struct scsi_transportid_iscsi_device, + iscsi_name)); + iscsi_name = &dev->iscsi_name[0]; + + } else if ((hdr->format_protocol & SCSI_TRN_FORMAT_MASK) == + SCSI_TRN_ISCSI_FORMAT_PORT) { + struct scsi_transportid_iscsi_port *port; + + port = (struct scsi_transportid_iscsi_port *)hdr; + + add_len = scsi_2btoul(port->additional_length); + add_len = MIN(add_len, valid_len - + __offsetof(struct scsi_transportid_iscsi_port, + iscsi_name)); + iscsi_name = &port->iscsi_name[0]; + } else { + sbuf_printf(sb, "unknown format %x", + (hdr->format_protocol & + SCSI_TRN_FORMAT_MASK) >> + SCSI_TRN_FORMAT_SHIFT); + break; + } + if (add_len == 0) { + sbuf_printf(sb, "not enough data"); + break; + } + /* + * This is supposed to be a NUL-terminated ASCII + * string, but you never know. So we're going to + * check. We need to do this because there is no + * sbuf equivalent of strncat(). + */ + for (i = 0; i < add_len; i++) { + if (iscsi_name[i] == '\0') { + nul_found = 1; + break; + } + } + /* + * If there is a NUL in the name, we can just use + * sbuf_cat(). Otherwise we need to use sbuf_bcat(). + */ + if (nul_found != 0) + sbuf_cat(sb, iscsi_name); + else + sbuf_bcat(sb, iscsi_name, add_len); + break; + } + case SCSI_PROTO_SAS: { + struct scsi_transportid_sas *sas; + uint64_t sas_addr; + + sas = (struct scsi_transportid_sas *)hdr; + + sas_addr = scsi_8btou64(sas->sas_address); + sbuf_printf(sb, "SAS address: 0x%.16jx", (uintmax_t)sas_addr); + break; + } + case SCSI_PROTO_ADITP: + case SCSI_PROTO_ATA: + case SCSI_PROTO_UAS: + /* + * No Transport ID format for ADI, ATA or USB is defined in + * SPC-4. + */ + sbuf_printf(sb, "No known Transport ID format for protocol " + "%#x", hdr->format_protocol & SCSI_TRN_PROTO_MASK); + break; + case SCSI_PROTO_SOP: { + struct scsi_transportid_sop *sop; + struct scsi_sop_routing_id_norm *rid; + + sop = (struct scsi_transportid_sop *)hdr; + rid = (struct scsi_sop_routing_id_norm *)sop->routing_id; + + /* + * Note that there is no alternate format specified in SPC-4 + * for the PCIe routing ID, so we don't really have a way + * to know whether the second byte of the routing ID is + * a device and function or just a function. So we just + * assume bus,device,function. + */ + sbuf_printf(sb, "SOP Routing ID: %u,%u,%u", + rid->bus, rid->devfunc >> SCSI_TRN_SOP_DEV_SHIFT, + rid->devfunc & SCSI_TRN_SOP_FUNC_NORM_MAX); + break; + } + case SCSI_PROTO_NONE: + default: + sbuf_printf(sb, "Unknown protocol %#x", + hdr->format_protocol & SCSI_TRN_PROTO_MASK); + break; + } + + return (0); +} + +struct scsi_nv scsi_proto_map[] = { + { "fcp", SCSI_PROTO_FC }, + { "spi", SCSI_PROTO_SPI }, + { "ssa", SCSI_PROTO_SSA }, + { "sbp", SCSI_PROTO_1394 }, + { "1394", SCSI_PROTO_1394 }, + { "srp", SCSI_PROTO_RDMA }, + { "rdma", SCSI_PROTO_RDMA }, + { "iscsi", SCSI_PROTO_ISCSI }, + { "iqn", SCSI_PROTO_ISCSI }, + { "sas", SCSI_PROTO_SAS }, + { "aditp", SCSI_PROTO_ADITP }, + { "ata", SCSI_PROTO_ATA }, + { "uas", SCSI_PROTO_UAS }, + { "usb", SCSI_PROTO_UAS }, + { "sop", SCSI_PROTO_SOP } +}; + +const char * +scsi_nv_to_str(struct scsi_nv *table, int num_table_entries, uint64_t value) +{ + int i; + + for (i = 0; i < num_table_entries; i++) { + if (table[i].value == value) + return (table[i].name); + } + + return (NULL); +} + +/* + * Given a name/value table, find a value matching the given name. + * Return values: + * SCSI_NV_FOUND - match found + * SCSI_NV_AMBIGUOUS - more than one match, none of them exact + * SCSI_NV_NOT_FOUND - no match found + */ +scsi_nv_status +scsi_get_nv(struct scsi_nv *table, int num_table_entries, + char *name, int *table_entry, scsi_nv_flags flags) +{ + int i, num_matches = 0; + + for (i = 0; i < num_table_entries; i++) { + size_t table_len, name_len; + + table_len = strlen(table[i].name); + name_len = strlen(name); + + if ((((flags & SCSI_NV_FLAG_IG_CASE) != 0) + && (strncasecmp(table[i].name, name, name_len) == 0)) + || (((flags & SCSI_NV_FLAG_IG_CASE) == 0) + && (strncmp(table[i].name, name, name_len) == 0))) { + *table_entry = i; + + /* + * Check for an exact match. If we have the same + * number of characters in the table as the argument, + * and we already know they're the same, we have + * an exact match. + */ + if (table_len == name_len) + return (SCSI_NV_FOUND); + + /* + * Otherwise, bump up the number of matches. We'll + * see later how many we have. + */ + num_matches++; + } + } + + if (num_matches > 1) + return (SCSI_NV_AMBIGUOUS); + else if (num_matches == 1) + return (SCSI_NV_FOUND); + else + return (SCSI_NV_NOT_FOUND); +} + +/* + * Parse transport IDs for Fibre Channel, 1394 and SAS. Since these are + * all 64-bit numbers, the code is similar. + */ +int +scsi_parse_transportid_64bit(int proto_id, char *id_str, + struct scsi_transportid_header **hdr, + unsigned int *alloc_len, +#ifdef _KERNEL + struct malloc_type *type, int flags, +#endif + char *error_str, int error_str_len) +{ + uint64_t value; + char *endptr; + int retval; + size_t alloc_size; + + retval = 0; + + value = strtouq(id_str, &endptr, 0); + if (*endptr != '\0') { + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: error " + "parsing ID %s, 64-bit number required", + __func__, id_str); + } + retval = 1; + goto bailout; + } + + switch (proto_id) { + case SCSI_PROTO_FC: + alloc_size = sizeof(struct scsi_transportid_fcp); + break; + case SCSI_PROTO_1394: + alloc_size = sizeof(struct scsi_transportid_1394); + break; + case SCSI_PROTO_SAS: + alloc_size = sizeof(struct scsi_transportid_sas); + break; + default: + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: unsupoprted " + "protocol %d", __func__, proto_id); + } + retval = 1; + goto bailout; + break; /* NOTREACHED */ + } +#ifdef _KERNEL + *hdr = malloc(alloc_size, type, flags); +#else /* _KERNEL */ + *hdr = malloc(alloc_size); +#endif /*_KERNEL */ + if (*hdr == NULL) { + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: unable to " + "allocate %zu bytes", __func__, alloc_size); + } + retval = 1; + goto bailout; + } + + *alloc_len = alloc_size; + + bzero(*hdr, alloc_size); + + switch (proto_id) { + case SCSI_PROTO_FC: { + struct scsi_transportid_fcp *fcp; + + fcp = (struct scsi_transportid_fcp *)(*hdr); + fcp->format_protocol = SCSI_PROTO_FC | + SCSI_TRN_FCP_FORMAT_DEFAULT; + scsi_u64to8b(value, fcp->n_port_name); + break; + } + case SCSI_PROTO_1394: { + struct scsi_transportid_1394 *sbp; + + sbp = (struct scsi_transportid_1394 *)(*hdr); + sbp->format_protocol = SCSI_PROTO_1394 | + SCSI_TRN_1394_FORMAT_DEFAULT; + scsi_u64to8b(value, sbp->eui64); + break; + } + case SCSI_PROTO_SAS: { + struct scsi_transportid_sas *sas; + + sas = (struct scsi_transportid_sas *)(*hdr); + sas->format_protocol = SCSI_PROTO_SAS | + SCSI_TRN_SAS_FORMAT_DEFAULT; + scsi_u64to8b(value, sas->sas_address); + break; + } + default: + break; + } +bailout: + return (retval); +} + +/* + * Parse a SPI (Parallel SCSI) address of the form: id,rel_tgt_port + */ +int +scsi_parse_transportid_spi(char *id_str, struct scsi_transportid_header **hdr, + unsigned int *alloc_len, +#ifdef _KERNEL + struct malloc_type *type, int flags, +#endif + char *error_str, int error_str_len) +{ + unsigned long scsi_addr, target_port; + struct scsi_transportid_spi *spi; + char *tmpstr, *endptr; + int retval; + + retval = 0; + + tmpstr = strsep(&id_str, ","); + if (tmpstr == NULL) { + if (error_str != NULL) { + snprintf(error_str, error_str_len, + "%s: no ID found", __func__); + } + retval = 1; + goto bailout; + } + scsi_addr = strtoul(tmpstr, &endptr, 0); + if (*endptr != '\0') { + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: error " + "parsing SCSI ID %s, number required", + __func__, tmpstr); + } + retval = 1; + goto bailout; + } + + if (id_str == NULL) { + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: no relative " + "target port found", __func__); + } + retval = 1; + goto bailout; + } + + target_port = strtoul(id_str, &endptr, 0); + if (*endptr != '\0') { + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: error " + "parsing relative target port %s, number " + "required", __func__, id_str); + } + retval = 1; + goto bailout; + } +#ifdef _KERNEL + spi = malloc(sizeof(*spi), type, flags); +#else + spi = malloc(sizeof(*spi)); +#endif + if (spi == NULL) { + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: unable to " + "allocate %zu bytes", __func__, + sizeof(*spi)); + } + retval = 1; + goto bailout; + } + *alloc_len = sizeof(*spi); + bzero(spi, sizeof(*spi)); + + spi->format_protocol = SCSI_PROTO_SPI | SCSI_TRN_SPI_FORMAT_DEFAULT; + scsi_ulto2b(scsi_addr, spi->scsi_addr); + scsi_ulto2b(target_port, spi->rel_trgt_port_id); + + *hdr = (struct scsi_transportid_header *)spi; +bailout: + return (retval); +} + +/* + * Parse an RDMA/SRP Initiator Port ID string. This is 32 hexadecimal digits, + * optionally prefixed by "0x" or "0X". + */ +int +scsi_parse_transportid_rdma(char *id_str, struct scsi_transportid_header **hdr, + unsigned int *alloc_len, +#ifdef _KERNEL + struct malloc_type *type, int flags, +#endif + char *error_str, int error_str_len) +{ + struct scsi_transportid_rdma *rdma; + int retval; + size_t id_len, rdma_id_size; + uint8_t rdma_id[SCSI_TRN_RDMA_PORT_LEN]; + char *tmpstr; + unsigned int i, j; + + retval = 0; + id_len = strlen(id_str); + rdma_id_size = SCSI_TRN_RDMA_PORT_LEN; + + /* + * Check the size. It needs to be either 32 or 34 characters long. + */ + if ((id_len != (rdma_id_size * 2)) + && (id_len != ((rdma_id_size * 2) + 2))) { + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: RDMA ID " + "must be 32 hex digits (0x prefix " + "optional), only %zu seen", __func__, id_len); + } + retval = 1; + goto bailout; + } + + tmpstr = id_str; + /* + * If the user gave us 34 characters, the string needs to start + * with '0x'. + */ + if (id_len == ((rdma_id_size * 2) + 2)) { + if ((tmpstr[0] == '0') + && ((tmpstr[1] == 'x') || (tmpstr[1] == 'X'))) { + tmpstr += 2; + } else { + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: RDMA " + "ID prefix, if used, must be \"0x\", " + "got %s", __func__, tmpstr); + } + retval = 1; + goto bailout; + } + } + bzero(rdma_id, sizeof(rdma_id)); + + /* + * Convert ASCII hex into binary bytes. There is no standard + * 128-bit integer type, and so no strtou128t() routine to convert + * from hex into a large integer. In the end, we're not going to + * an integer, but rather to a byte array, so that and the fact + * that we require the user to give us 32 hex digits simplifies the + * logic. + */ + for (i = 0; i < (rdma_id_size * 2); i++) { + int cur_shift; + unsigned char c; + + /* Increment the byte array one for every 2 hex digits */ + j = i >> 1; + + /* + * The first digit in every pair is the most significant + * 4 bits. The second is the least significant 4 bits. + */ + if ((i % 2) == 0) + cur_shift = 4; + else + cur_shift = 0; + + c = tmpstr[i]; + /* Convert the ASCII hex character into a number */ + if (isdigit(c)) + c -= '0'; + else if (isalpha(c)) + c -= isupper(c) ? 'A' - 10 : 'a' - 10; + else { + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: " + "RDMA ID must be hex digits, got " + "invalid character %c", __func__, + tmpstr[i]); + } + retval = 1; + goto bailout; + } + /* + * The converted number can't be less than 0; the type is + * unsigned, and the subtraction logic will not give us + * a negative number. So we only need to make sure that + * the value is not greater than 0xf. (i.e. make sure the + * user didn't give us a value like "0x12jklmno"). + */ + if (c > 0xf) { + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: " + "RDMA ID must be hex digits, got " + "invalid character %c", __func__, + tmpstr[i]); + } + retval = 1; + goto bailout; + } + + rdma_id[j] |= c << cur_shift; + } + +#ifdef _KERNEL + rdma = malloc(sizeof(*rdma), type, flags); +#else + rdma = malloc(sizeof(*rdma)); +#endif + if (rdma == NULL) { + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: unable to " + "allocate %zu bytes", __func__, + sizeof(*rdma)); + } + retval = 1; + goto bailout; + } + *alloc_len = sizeof(*rdma); + bzero(rdma, sizeof(rdma)); + + rdma->format_protocol = SCSI_PROTO_RDMA | SCSI_TRN_RDMA_FORMAT_DEFAULT; + bcopy(rdma_id, rdma->initiator_port_id, SCSI_TRN_RDMA_PORT_LEN); + + *hdr = (struct scsi_transportid_header *)rdma; + +bailout: + return (retval); +} + +/* + * Parse an iSCSI name. The format is either just the name: + * + * iqn.2012-06.com.example:target0 + * or the name, separator and initiator session ID: + * + * iqn.2012-06.com.example:target0,i,0x123 + * + * The separator format is exact. + */ +int +scsi_parse_transportid_iscsi(char *id_str, struct scsi_transportid_header **hdr, + unsigned int *alloc_len, +#ifdef _KERNEL + struct malloc_type *type, int flags, +#endif + char *error_str, int error_str_len) +{ + size_t id_len, sep_len, id_size, name_len; + int is_full_id, retval; + unsigned int i, sep_pos, sep_found; + const char *sep_template = ",i,0x"; + const char *iqn_prefix = "iqn."; + struct scsi_transportid_iscsi_device *iscsi; + + is_full_id = 0; + retval = 0; + sep_found = 0; + + id_len = strlen(id_str); + sep_len = strlen(sep_template); + + /* + * The separator is defined as exactly ',i,0x'. Any other commas, + * or any other form, is an error. So look for a comma, and once + * we find that, the next few characters must match the separator + * exactly. Once we get through the separator, there should be at + * least one character. + */ + for (i = 0, sep_pos = 0; i < id_len; i++) { + if (sep_pos == 0) { + if (id_str[i] == sep_template[sep_pos]) + sep_pos++; + + continue; + } + if (sep_pos < sep_len) { + if (id_str[i] == sep_template[sep_pos]) { + sep_pos++; + continue; + } + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: " + "invalid separator in iSCSI name " + "\"%s\"", + __func__, id_str); + } + retval = 1; + goto bailout; + } else { + sep_found = 1; + break; + } + } + + /* + * Check to see whether we have a separator but no digits after it. + */ + if ((sep_pos != 0) + && (sep_found == 0)) { + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: no digits " + "found after separator in iSCSI name \"%s\"", + __func__, id_str); + } + retval = 1; + goto bailout; + } + + /* + * The incoming ID string has the "iqn." prefix stripped off. We + * need enough space for the base structure (the structures are the + * same for the two iSCSI forms), the prefix, the ID string and a + * terminating NUL. + */ + id_size = sizeof(*iscsi) + strlen(iqn_prefix) + id_len + 1; + +#ifdef _KERNEL + iscsi = malloc(id_size, type, flags); +#else + iscsi = malloc(id_size); +#endif + if (iscsi == NULL) { + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: unable to " + "allocate %zu bytes", __func__, id_size); + } + retval = 1; + goto bailout; + } + *alloc_len = id_size; + bzero(iscsi, id_size); + + iscsi->format_protocol = SCSI_PROTO_ISCSI; + if (sep_found == 0) + iscsi->format_protocol |= SCSI_TRN_ISCSI_FORMAT_DEVICE; + else + iscsi->format_protocol |= SCSI_TRN_ISCSI_FORMAT_PORT; + name_len = id_size - sizeof(*iscsi); + scsi_ulto2b(name_len, iscsi->additional_length); + snprintf(iscsi->iscsi_name, name_len, "%s%s", iqn_prefix, id_str); + + *hdr = (struct scsi_transportid_header *)iscsi; + +bailout: + return (retval); +} + +/* + * Parse a SCSI over PCIe (SOP) identifier. The Routing ID can either be + * of the form 'bus,device,function' or 'bus,function'. + */ +int +scsi_parse_transportid_sop(char *id_str, struct scsi_transportid_header **hdr, + unsigned int *alloc_len, +#ifdef _KERNEL + struct malloc_type *type, int flags, +#endif + char *error_str, int error_str_len) +{ + struct scsi_transportid_sop *sop; + unsigned long bus, device, function; + char *tmpstr, *endptr; + int retval, device_spec; + + retval = 0; + device_spec = 0; + device = 0; + + tmpstr = strsep(&id_str, ","); + if ((tmpstr == NULL) + || (*tmpstr == '\0')) { + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: no ID found", + __func__); + } + retval = 1; + goto bailout; + } + bus = strtoul(tmpstr, &endptr, 0); + if (*endptr != '\0') { + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: error " + "parsing PCIe bus %s, number required", + __func__, tmpstr); + } + retval = 1; + goto bailout; + } + if ((id_str == NULL) + || (*id_str == '\0')) { + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: no PCIe " + "device or function found", __func__); + } + retval = 1; + goto bailout; + } + tmpstr = strsep(&id_str, ","); + function = strtoul(tmpstr, &endptr, 0); + if (*endptr != '\0') { + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: error " + "parsing PCIe device/function %s, number " + "required", __func__, tmpstr); + } + retval = 1; + goto bailout; + } + /* + * Check to see whether the user specified a third value. If so, + * the second is the device. + */ + if (id_str != NULL) { + if (*id_str == '\0') { + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: " + "no PCIe function found", __func__); + } + retval = 1; + goto bailout; + } + device = function; + device_spec = 1; + function = strtoul(id_str, &endptr, 0); + if (*endptr != '\0') { + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: " + "error parsing PCIe function %s, " + "number required", __func__, id_str); + } + retval = 1; + goto bailout; + } + } + if (bus > SCSI_TRN_SOP_BUS_MAX) { + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: bus value " + "%lu greater than maximum %u", __func__, + bus, SCSI_TRN_SOP_BUS_MAX); + } + retval = 1; + goto bailout; + } + + if ((device_spec != 0) + && (device > SCSI_TRN_SOP_DEV_MASK)) { + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: device value " + "%lu greater than maximum %u", __func__, + device, SCSI_TRN_SOP_DEV_MAX); + } + retval = 1; + goto bailout; + } + + if (((device_spec != 0) + && (function > SCSI_TRN_SOP_FUNC_NORM_MAX)) + || ((device_spec == 0) + && (function > SCSI_TRN_SOP_FUNC_ALT_MAX))) { + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: function value " + "%lu greater than maximum %u", __func__, + function, (device_spec == 0) ? + SCSI_TRN_SOP_FUNC_ALT_MAX : + SCSI_TRN_SOP_FUNC_NORM_MAX); + } + retval = 1; + goto bailout; + } + +#ifdef _KERNEL + sop = malloc(sizeof(*sop), type, flags); +#else + sop = malloc(sizeof(*sop)); +#endif + if (sop == NULL) { + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: unable to " + "allocate %zu bytes", __func__, sizeof(*sop)); + } + retval = 1; + goto bailout; + } + *alloc_len = sizeof(*sop); + bzero(sop, sizeof(*sop)); + sop->format_protocol = SCSI_PROTO_SOP | SCSI_TRN_SOP_FORMAT_DEFAULT; + if (device_spec != 0) { + struct scsi_sop_routing_id_norm rid; + + rid.bus = bus; + rid.devfunc = (device << SCSI_TRN_SOP_DEV_SHIFT) | function; + bcopy(&rid, sop->routing_id, MIN(sizeof(rid), + sizeof(sop->routing_id))); + } else { + struct scsi_sop_routing_id_alt rid; + + rid.bus = bus; + rid.function = function; + bcopy(&rid, sop->routing_id, MIN(sizeof(rid), + sizeof(sop->routing_id))); + } + + *hdr = (struct scsi_transportid_header *)sop; +bailout: + return (retval); +} + +/* + * transportid_str: NUL-terminated string with format: protcol,id + * The ID is protocol specific. + * hdr: Storage will be allocated for the transport ID. + * alloc_len: The amount of memory allocated is returned here. + * type: Malloc bucket (kernel only). + * flags: Malloc flags (kernel only). + * error_str: If non-NULL, it will contain error information (without + * a terminating newline) if an error is returned. + * error_str_len: Allocated length of the error string. + * + * Returns 0 for success, non-zero for failure. + */ +int +scsi_parse_transportid(char *transportid_str, + struct scsi_transportid_header **hdr, + unsigned int *alloc_len, +#ifdef _KERNEL + struct malloc_type *type, int flags, +#endif + char *error_str, int error_str_len) +{ + char *tmpstr; + scsi_nv_status status; + int retval, num_proto_entries, table_entry; + + retval = 0; + table_entry = 0; + + /* + * We do allow a period as well as a comma to separate the protocol + * from the ID string. This is to accommodate iSCSI names, which + * start with "iqn.". + */ + tmpstr = strsep(&transportid_str, ",."); + if (tmpstr == NULL) { + if (error_str != NULL) { + snprintf(error_str, error_str_len, + "%s: transportid_str is NULL", __func__); + } + retval = 1; + goto bailout; + } + + num_proto_entries = sizeof(scsi_proto_map) / + sizeof(scsi_proto_map[0]); + status = scsi_get_nv(scsi_proto_map, num_proto_entries, tmpstr, + &table_entry, SCSI_NV_FLAG_IG_CASE); + if (status != SCSI_NV_FOUND) { + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: %s protocol " + "name %s", __func__, + (status == SCSI_NV_AMBIGUOUS) ? "ambiguous" : + "invalid", tmpstr); + } + retval = 1; + goto bailout; + } + switch (scsi_proto_map[table_entry].value) { + case SCSI_PROTO_FC: + case SCSI_PROTO_1394: + case SCSI_PROTO_SAS: + retval = scsi_parse_transportid_64bit( + scsi_proto_map[table_entry].value, transportid_str, hdr, + alloc_len, +#ifdef _KERNEL + type, flags, +#endif + error_str, error_str_len); + break; + case SCSI_PROTO_SPI: + retval = scsi_parse_transportid_spi(transportid_str, hdr, + alloc_len, +#ifdef _KERNEL + type, flags, +#endif + error_str, error_str_len); + break; + case SCSI_PROTO_RDMA: + retval = scsi_parse_transportid_rdma(transportid_str, hdr, + alloc_len, +#ifdef _KERNEL + type, flags, +#endif + error_str, error_str_len); + break; + case SCSI_PROTO_ISCSI: + retval = scsi_parse_transportid_iscsi(transportid_str, hdr, + alloc_len, +#ifdef _KERNEL + type, flags, +#endif + error_str, error_str_len); + break; + case SCSI_PROTO_SOP: + retval = scsi_parse_transportid_sop(transportid_str, hdr, + alloc_len, +#ifdef _KERNEL + type, flags, +#endif + error_str, error_str_len); + break; + case SCSI_PROTO_SSA: + case SCSI_PROTO_ADITP: + case SCSI_PROTO_ATA: + case SCSI_PROTO_UAS: + case SCSI_PROTO_NONE: + default: + /* + * There is no format defined for a Transport ID for these + * protocols. So even if the user gives us something, we + * have no way to turn it into a standard SCSI Transport ID. + */ + retval = 1; + if (error_str != NULL) { + snprintf(error_str, error_str_len, "%s: no Transport " + "ID format exists for protocol %s", + __func__, tmpstr); + } + goto bailout; + break; /* NOTREACHED */ + } +bailout: + return (retval); +} + void scsi_test_unit_ready(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), @@ -6409,6 +7395,63 @@ scsi_start_stop(struct ccb_scsiio *csio, u_int32_t retries, } +void +scsi_persistent_reserve_in(struct ccb_scsiio *csio, uint32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, int service_action, + uint8_t *data_ptr, uint32_t dxfer_len, int sense_len, + int timeout) +{ + struct scsi_per_res_in *scsi_cmd; + + scsi_cmd = (struct scsi_per_res_in *)&csio->cdb_io.cdb_bytes; + bzero(scsi_cmd, sizeof(*scsi_cmd)); + + scsi_cmd->opcode = PERSISTENT_RES_IN; + scsi_cmd->action = service_action; + scsi_ulto2b(dxfer_len, scsi_cmd->length); + + cam_fill_csio(csio, + retries, + cbfcnp, + /*flags*/CAM_DIR_IN, + tag_action, + data_ptr, + dxfer_len, + sense_len, + sizeof(*scsi_cmd), + timeout); +} + +void +scsi_persistent_reserve_out(struct ccb_scsiio *csio, uint32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, int service_action, + int scope, int res_type, uint8_t *data_ptr, + uint32_t dxfer_len, int sense_len, int timeout) +{ + struct scsi_per_res_out *scsi_cmd; + + scsi_cmd = (struct scsi_per_res_out *)&csio->cdb_io.cdb_bytes; + bzero(scsi_cmd, sizeof(*scsi_cmd)); + + scsi_cmd->opcode = PERSISTENT_RES_OUT; + scsi_cmd->action = service_action; + scsi_cmd->scope_type = scope | res_type; + scsi_ulto4b(dxfer_len, scsi_cmd->length); + + cam_fill_csio(csio, + retries, + cbfcnp, + /*flags*/CAM_DIR_OUT, + tag_action, + data_ptr, + dxfer_len, + sense_len, + sizeof(*scsi_cmd), + timeout); +} + /* * Try make as good a match as possible with * available sub drivers diff --git a/sys/cam/scsi/scsi_all.h b/sys/cam/scsi/scsi_all.h index 30b5ccb81cd..6a4467e5b2c 100644 --- a/sys/cam/scsi/scsi_all.h +++ b/sys/cam/scsi/scsi_all.h @@ -278,6 +278,7 @@ struct scsi_per_res_in #define SPRI_RS 0x03 u_int8_t reserved[5]; u_int8_t length[2]; +#define SPRI_MAX_LEN 0xffff u_int8_t control; }; @@ -302,13 +303,21 @@ struct scsi_per_res_cap { uint8_t length[2]; uint8_t flags1; -#define SPRI_CRH 0x10 -#define SPRI_SIP_C 0x08 -#define SPRI_ATP_C 0x04 -#define SPRI_PTPL_C 0x01 +#define SPRI_RLR_C 0x80 +#define SPRI_CRH 0x10 +#define SPRI_SIP_C 0x08 +#define SPRI_ATP_C 0x04 +#define SPRI_PTPL_C 0x01 uint8_t flags2; -#define SPRI_TMV 0x80 -#define SPRI_PTPL_A 0x01 +#define SPRI_TMV 0x80 +#define SPRI_ALLOW_CMD_MASK 0x70 +#define SPRI_ALLOW_CMD_SHIFT 4 +#define SPRI_ALLOW_NA 0x00 +#define SPRI_ALLOW_1 0x10 +#define SPRI_ALLOW_2 0x20 +#define SPRI_ALLOW_3 0x30 +#define SPRI_ALLOW_4 0x40 +#define SPRI_PTPL_A 0x01 uint8_t type_mask[2]; #define SPRI_TM_WR_EX_AR 0x8000 #define SPRI_TM_EX_AC_RO 0x4000 @@ -322,7 +331,7 @@ struct scsi_per_res_cap struct scsi_per_res_in_rsrv_data { uint8_t reservation[8]; - uint8_t obsolete1[4]; + uint8_t scope_addr[4]; uint8_t reserved; uint8_t scopetype; #define SPRT_WE 0x01 @@ -331,7 +340,7 @@ struct scsi_per_res_in_rsrv_data #define SPRT_EARO 0x06 #define SPRT_WEAR 0x07 #define SPRT_EAAR 0x08 - uint8_t obsolete2[2]; + uint8_t extent_length[2]; }; struct scsi_per_res_in_rsrv @@ -340,6 +349,26 @@ struct scsi_per_res_in_rsrv struct scsi_per_res_in_rsrv_data data; }; +struct scsi_per_res_in_full_desc +{ + struct scsi_per_res_key res_key; + uint8_t reserved1[4]; + uint8_t flags; +#define SPRI_FULL_ALL_TG_PT 0x02 +#define SPRI_FULL_R_HOLDER 0x01 + uint8_t scopetype; + uint8_t reserved2[4]; + uint8_t rel_trgt_port_id[2]; + uint8_t additional_length[4]; + uint8_t transport_id[]; +}; + +struct scsi_per_res_in_full +{ + struct scsi_per_res_in_header header; + struct scsi_per_res_in_full_desc desc[]; +}; + struct scsi_per_res_out { u_int8_t opcode; @@ -352,13 +381,20 @@ struct scsi_per_res_out #define SPRO_PRE_ABO 0x05 #define SPRO_REG_IGNO 0x06 #define SPRO_REG_MOVE 0x07 +#define SPRO_REPL_LOST_RES 0x08 #define SPRO_ACTION_MASK 0x1f u_int8_t scope_type; #define SPR_SCOPE_MASK 0xf0 +#define SPR_SCOPE_SHIFT 4 #define SPR_LU_SCOPE 0x00 +#define SPR_EXTENT_SCOPE 0x10 +#define SPR_ELEMENT_SCOPE 0x20 #define SPR_TYPE_MASK 0x0f +#define SPR_TYPE_RD_SHARED 0x00 #define SPR_TYPE_WR_EX 0x01 +#define SPR_TYPE_RD_EX 0x02 #define SPR_TYPE_EX_AC 0x03 +#define SPR_TYPE_SHARED 0x04 #define SPR_TYPE_WR_EX_RO 0x05 #define SPR_TYPE_EX_AC_RO 0x06 #define SPR_TYPE_WR_EX_AR 0x07 @@ -372,15 +408,139 @@ struct scsi_per_res_out_parms { struct scsi_per_res_key res_key; u_int8_t serv_act_res_key[8]; - u_int8_t obsolete1[4]; + u_int8_t scope_spec_address[4]; u_int8_t flags; #define SPR_SPEC_I_PT 0x08 #define SPR_ALL_TG_PT 0x04 #define SPR_APTPL 0x01 u_int8_t reserved1; - u_int8_t obsolete2[2]; + u_int8_t extent_length[2]; + u_int8_t transport_id_list[]; }; +struct scsi_per_res_out_trans_ids { + u_int8_t additional_length[4]; + u_int8_t transport_ids[]; +}; + +/* + * Used with REGISTER AND MOVE serivce action of the PERSISTENT RESERVE OUT + * command. + */ +struct scsi_per_res_reg_move +{ + struct scsi_per_res_key res_key; + u_int8_t serv_act_res_key[8]; + u_int8_t reserved; + u_int8_t flags; +#define SPR_REG_MOVE_UNREG 0x02 +#define SPR_REG_MOVE_APTPL 0x01 + u_int8_t rel_trgt_port_id[2]; + u_int8_t transport_id_length[4]; + u_int8_t transport_id[]; +}; + +struct scsi_transportid_header +{ + uint8_t format_protocol; +#define SCSI_TRN_FORMAT_MASK 0xc0 +#define SCSI_TRN_FORMAT_SHIFT 6 +#define SCSI_TRN_PROTO_MASK 0x0f +}; + +struct scsi_transportid_fcp +{ + uint8_t format_protocol; +#define SCSI_TRN_FCP_FORMAT_DEFAULT 0x00 + uint8_t reserved1[7]; + uint8_t n_port_name[8]; + uint8_t reserved2[8]; +}; + +struct scsi_transportid_spi +{ + uint8_t format_protocol; +#define SCSI_TRN_SPI_FORMAT_DEFAULT 0x00 + uint8_t reserved1; + uint8_t scsi_addr[2]; + uint8_t obsolete[2]; + uint8_t rel_trgt_port_id[2]; + uint8_t reserved2[16]; +}; + +struct scsi_transportid_1394 +{ + uint8_t format_protocol; +#define SCSI_TRN_1394_FORMAT_DEFAULT 0x00 + uint8_t reserved1[7]; + uint8_t eui64[8]; + uint8_t reserved2[8]; +}; + +struct scsi_transportid_rdma +{ + uint8_t format_protocol; +#define SCSI_TRN_RDMA_FORMAT_DEFAULT 0x00 + uint8_t reserved[7]; +#define SCSI_TRN_RDMA_PORT_LEN 16 + uint8_t initiator_port_id[SCSI_TRN_RDMA_PORT_LEN]; +}; + +struct scsi_transportid_iscsi_device +{ + uint8_t format_protocol; +#define SCSI_TRN_ISCSI_FORMAT_DEVICE 0x00 + uint8_t reserved; + uint8_t additional_length[2]; + uint8_t iscsi_name[]; +}; + +struct scsi_transportid_iscsi_port +{ + uint8_t format_protocol; +#define SCSI_TRN_ISCSI_FORMAT_PORT 0x40 + uint8_t reserved; + uint8_t additional_length[2]; + uint8_t iscsi_name[]; + /* + * Followed by a separator and iSCSI initiator session ID + */ +}; + +struct scsi_transportid_sas +{ + uint8_t format_protocol; +#define SCSI_TRN_SAS_FORMAT_DEFAULT 0x00 + uint8_t reserved1[3]; + uint8_t sas_address[8]; + uint8_t reserved2[12]; +}; + +struct scsi_sop_routing_id_norm { + uint8_t bus; + uint8_t devfunc; +#define SCSI_TRN_SOP_BUS_MAX 0xff +#define SCSI_TRN_SOP_DEV_MAX 0x1f +#define SCSI_TRN_SOP_DEV_MASK 0xf8 +#define SCSI_TRN_SOP_DEV_SHIFT 3 +#define SCSI_TRN_SOP_FUNC_NORM_MASK 0x07 +#define SCSI_TRN_SOP_FUNC_NORM_MAX 0x07 +}; + +struct scsi_sop_routing_id_alt { + uint8_t bus; + uint8_t function; +#define SCSI_TRN_SOP_FUNC_ALT_MAX 0xff +}; + +struct scsi_transportid_sop +{ + uint8_t format_protocol; +#define SCSI_TRN_SOP_FORMAT_DEFAULT 0x00 + uint8_t reserved1; + uint8_t routing_id[2]; + uint8_t reserved2[20]; +}; struct scsi_log_sense { @@ -470,15 +630,24 @@ struct scsi_control_page { #define SCP_QUEUE_ALG_MASK 0xF0 #define SCP_QUEUE_ALG_RESTRICTED 0x00 #define SCP_QUEUE_ALG_UNRESTRICTED 0x10 +#define SCP_NUAR 0x08 /*No UA on release*/ #define SCP_QUEUE_ERR 0x02 /*Queued I/O aborted for CACs*/ #define SCP_QUEUE_DQUE 0x01 /*Queued I/O disabled*/ u_int8_t eca_and_aen; #define SCP_EECA 0x80 /*Enable Extended CA*/ +#define SCP_RAC 0x40 /*Report a check*/ +#define SCP_SWP 0x08 /*Software Write Protect*/ #define SCP_RAENP 0x04 /*Ready AEN Permission*/ #define SCP_UAAENP 0x02 /*UA AEN Permission*/ #define SCP_EAENP 0x01 /*Error AEN Permission*/ - u_int8_t reserved; + u_int8_t flags4; +#define SCP_ATO 0x80 /*Application tag owner*/ +#define SCP_TAS 0x40 /*Task aborted status*/ +#define SCP_ATMPE 0x20 /*Application tag mode page*/ +#define SCP_RWWP 0x10 /*Reject write without prot*/ u_int8_t aen_holdoff_period[2]; + u_int8_t busy_timeout_period[2]; + u_int8_t extended_selftest_completion_time[2]; }; struct scsi_cache_page { @@ -597,21 +766,41 @@ struct scsi_info_exceptions_page { u_int8_t report_count[4]; }; +/* + * SCSI protocol identifier values, current as of SPC4r36l. + */ +#define SCSI_PROTO_FC 0x00 /* Fibre Channel */ +#define SCSI_PROTO_SPI 0x01 /* Parallel SCSI */ +#define SCSI_PROTO_SSA 0x02 /* Serial Storage Arch. */ +#define SCSI_PROTO_1394 0x03 /* IEEE 1394 (Firewire) */ +#define SCSI_PROTO_RDMA 0x04 /* SCSI RDMA Protocol */ +#define SCSI_PROTO_ISCSI 0x05 /* Internet SCSI */ +#define SCSI_PROTO_iSCSI 0x05 /* Internet SCSI */ +#define SCSI_PROTO_SAS 0x06 /* SAS Serial SCSI Protocol */ +#define SCSI_PROTO_ADT 0x07 /* Automation/Drive Int. Trans. Prot.*/ +#define SCSI_PROTO_ADITP 0x07 /* Automation/Drive Int. Trans. Prot.*/ +#define SCSI_PROTO_ATA 0x08 /* AT Attachment Interface */ +#define SCSI_PROTO_UAS 0x09 /* USB Atached SCSI */ +#define SCSI_PROTO_SOP 0x0a /* SCSI over PCI Express */ +#define SCSI_PROTO_NONE 0x0f /* No specific protocol */ + struct scsi_proto_specific_page { u_int8_t page_code; #define SPSP_PAGE_SAVABLE 0x80 /* Page is savable */ u_int8_t page_length; u_int8_t protocol; -#define SPSP_PROTO_FC 0x00 -#define SPSP_PROTO_SPI 0x01 -#define SPSP_PROTO_SSA 0x02 -#define SPSP_PROTO_1394 0x03 -#define SPSP_PROTO_RDMA 0x04 -#define SPSP_PROTO_ISCSI 0x05 -#define SPSP_PROTO_SAS 0x06 -#define SPSP_PROTO_ADT 0x07 -#define SPSP_PROTO_ATA 0x08 -#define SPSP_PROTO_NONE 0x0f +#define SPSP_PROTO_FC SCSI_PROTO_FC +#define SPSP_PROTO_SPI SCSI_PROTO_SPI +#define SPSP_PROTO_SSA SCSI_PROTO_SSA +#define SPSP_PROTO_1394 SCSI_PROTO_1394 +#define SPSP_PROTO_RDMA SCSI_PROTO_RDMA +#define SPSP_PROTO_ISCSI SCSI_PROTO_ISCSI +#define SPSP_PROTO_SAS SCSI_PROTO_SAS +#define SPSP_PROTO_ADT SCSI_PROTO_ADITP +#define SPSP_PROTO_ATA SCSI_PROTO_ATA +#define SPSP_PROTO_UAS SCSI_PROTO_UAS +#define SPSP_PROTO_SOP SCSI_PROTO_SOP +#define SPSP_PROTO_NONE SCSI_PROTO_NONE }; struct scsi_reserve @@ -746,12 +935,16 @@ struct scsi_read_buffer { u_int8_t opcode; u_int8_t byte2; -#define RWB_MODE 0x07 +#define RWB_MODE 0x1F #define RWB_MODE_HDR_DATA 0x00 #define RWB_MODE_VENDOR 0x01 #define RWB_MODE_DATA 0x02 +#define RWB_MODE_DESCR 0x03 #define RWB_MODE_DOWNLOAD 0x04 #define RWB_MODE_DOWNLOAD_SAVE 0x05 +#define RWB_MODE_ECHO 0x0A +#define RWB_MODE_ECHO_DESCR 0x0B +#define RWB_MODE_ERROR_HISTORY 0x1C u_int8_t buffer_id; u_int8_t offset[3]; u_int8_t length[3]; @@ -968,6 +1161,378 @@ struct scsi_maintenance_in uint8_t control; }; +struct scsi_report_supported_opcodes +{ + uint8_t opcode; + uint8_t service_action; + uint8_t options; +#define RSO_RCTD 0x80 +#define RSO_OPTIONS_MASK 0x07 +#define RSO_OPTIONS_ALL 0x00 +#define RSO_OPTIONS_OC 0x01 +#define RSO_OPTIONS_OC_SA 0x02 + uint8_t requested_opcode; + uint8_t requested_service_action[2]; + uint8_t length[4]; + uint8_t reserved1; + uint8_t control; +}; + +struct scsi_report_supported_opcodes_timeout +{ + uint8_t length[2]; + uint8_t reserved; + uint8_t cmd_specific; + uint8_t nominal_time[4]; + uint8_t recommended_time[4]; +}; + +struct scsi_report_supported_opcodes_descr +{ + uint8_t opcode; + uint8_t reserved; + uint8_t service_action[2]; + uint8_t reserved2; + uint8_t flags; +#define RSO_SERVACTV 0x01 +#define RSO_CTDP 0x02 + uint8_t cdb_length[2]; + struct scsi_report_supported_opcodes_timeout timeout[0]; +}; + +struct scsi_report_supported_opcodes_all +{ + uint8_t length[4]; + struct scsi_report_supported_opcodes_descr descr[0]; +}; + +struct scsi_report_supported_opcodes_one +{ + uint8_t reserved; + uint8_t support; +#define RSO_ONE_CTDP 0x80 + uint8_t cdb_length[2]; + uint8_t cdb_usage[]; +}; + +struct scsi_report_supported_tmf +{ + uint8_t opcode; + uint8_t service_action; + uint8_t reserved[4]; + uint8_t length[4]; + uint8_t reserved1; + uint8_t control; +}; + +struct scsi_report_supported_tmf_data +{ + uint8_t byte1; +#define RST_WAKES 0x01 +#define RST_TRS 0x02 +#define RST_QTS 0x04 +#define RST_LURS 0x08 +#define RST_CTSS 0x10 +#define RST_CACAS 0x20 +#define RST_ATSS 0x40 +#define RST_ATS 0x80 + uint8_t byte2; +#define RST_ITNRS 0x01 +#define RST_QTSS 0x02 +#define RST_QAES 0x04 + uint8_t reserved[2]; +}; + +struct scsi_report_timestamp +{ + uint8_t opcode; + uint8_t service_action; + uint8_t reserved[4]; + uint8_t length[4]; + uint8_t reserved1; + uint8_t control; +}; + +struct scsi_report_timestamp_data +{ + uint8_t length[2]; + uint8_t origin; +#define RTS_ORIG_MASK 0x00 +#define RTS_ORIG_ZERO 0x00 +#define RTS_ORIG_SET 0x02 +#define RTS_ORIG_OUTSIDE 0x03 + uint8_t reserved; + uint8_t timestamp[6]; + uint8_t reserve2[2]; +}; + +struct scsi_receive_copy_status_lid1 +{ + uint8_t opcode; + uint8_t service_action; +#define RCS_RCS_LID1 0x00 + uint8_t list_identifier; + uint8_t reserved[7]; + uint8_t length[4]; + uint8_t reserved1; + uint8_t control; +}; + +struct scsi_receive_copy_status_lid1_data +{ + uint8_t available_data[4]; + uint8_t copy_command_status; +#define RCS_CCS_INPROG 0x00 +#define RCS_CCS_COMPLETED 0x01 +#define RCS_CCS_ERROR 0x02 + uint8_t segments_processed[2]; + uint8_t transfer_count_units; +#define RCS_TC_BYTES 0x00 +#define RCS_TC_KBYTES 0x01 +#define RCS_TC_MBYTES 0x02 +#define RCS_TC_GBYTES 0x03 +#define RCS_TC_TBYTES 0x04 +#define RCS_TC_PBYTES 0x05 +#define RCS_TC_EBYTES 0x06 +#define RCS_TC_LBAS 0xf1 + uint8_t transfer_count[4]; +}; + +struct scsi_receive_copy_failure_details +{ + uint8_t opcode; + uint8_t service_action; +#define RCS_RCFD 0x04 + uint8_t list_identifier; + uint8_t reserved[7]; + uint8_t length[4]; + uint8_t reserved1; + uint8_t control; +}; + +struct scsi_receive_copy_failure_details_data +{ + uint8_t available_data[4]; + uint8_t reserved[52]; + uint8_t copy_command_status; + uint8_t reserved2; + uint8_t sense_data_length[2]; + uint8_t sense_data[]; +}; + +struct scsi_receive_copy_status_lid4 +{ + uint8_t opcode; + uint8_t service_action; +#define RCS_RCS_LID4 0x05 + uint8_t list_identifier[4]; + uint8_t reserved[4]; + uint8_t length[4]; + uint8_t reserved1; + uint8_t control; +}; + +struct scsi_receive_copy_status_lid4_data +{ + uint8_t available_data[4]; + uint8_t response_to_service_action; + uint8_t copy_command_status; +#define RCS_CCS_COMPLETED_PROD 0x03 +#define RCS_CCS_COMPLETED_RESID 0x04 +#define RCS_CCS_INPROG_FGBG 0x10 +#define RCS_CCS_INPROG_FG 0x11 +#define RCS_CCS_INPROG_BG 0x12 +#define RCS_CCS_ABORTED 0x60 + uint8_t operation_counter[2]; + uint8_t estimated_status_update_delay[4]; + uint8_t extended_copy_completion_status; + uint8_t length_of_the_sense_data_field; + uint8_t sense_data_length; + uint8_t transfer_count_units; + uint8_t transfer_count[8]; + uint8_t segments_processed[2]; + uint8_t reserved[2]; + uint8_t sense_data[]; +}; + +struct scsi_receive_copy_operating_parameters +{ + uint8_t opcode; + uint8_t service_action; +#define RCS_RCOP 0x03 + uint8_t reserved[8]; + uint8_t length[4]; + uint8_t reserved1; + uint8_t control; +}; + +struct scsi_receive_copy_operating_parameters_data +{ + uint8_t length[4]; + uint8_t snlid; +#define RCOP_SNLID 0x01 + uint8_t reserved[3]; + uint8_t maximum_cscd_descriptor_count[2]; + uint8_t maximum_segment_descriptor_count[2]; + uint8_t maximum_descriptor_list_length[4]; + uint8_t maximum_segment_length[4]; + uint8_t maximum_inline_data_length[4]; + uint8_t held_data_limit[4]; + uint8_t maximum_stream_device_transfer_size[4]; + uint8_t reserved2[2]; + uint8_t total_concurrent_copies[2]; + uint8_t maximum_concurrent_copies; + uint8_t data_segment_granularity; + uint8_t inline_data_granularity; + uint8_t held_data_granularity; + uint8_t reserved3[3]; + uint8_t implemented_descriptor_list_length; + uint8_t list_of_implemented_descriptor_type_codes[0]; +}; + +struct scsi_extended_copy +{ + uint8_t opcode; + uint8_t service_action; +#define EC_EC_LID1 0x00 +#define EC_EC_LID4 0x01 + uint8_t reserved[8]; + uint8_t length[4]; + uint8_t reserved1; + uint8_t control; +}; + +struct scsi_ec_cscd_dtsp +{ + uint8_t flags; +#define EC_CSCD_FIXED 0x01 +#define EC_CSCD_PAD 0x04 + uint8_t block_length[3]; +}; + +struct scsi_ec_cscd +{ + uint8_t type_code; +#define EC_CSCD_EXT 0xff + uint8_t luidt_pdt; +#define EC_LUIDT_MASK 0xc0 +#define EC_LUIDT_LUN 0x00 +#define EC_LUIDT_PROXY_TOKEN 0x40 + uint8_t relative_initiator_port[2]; + uint8_t cscd_params[24]; + struct scsi_ec_cscd_dtsp dtsp; +}; + +struct scsi_ec_cscd_id +{ + uint8_t type_code; +#define EC_CSCD_ID 0xe4 + uint8_t luidt_pdt; + uint8_t relative_initiator_port[2]; + uint8_t codeset; + uint8_t id_type; + uint8_t reserved; + uint8_t length; + uint8_t designator[20]; + struct scsi_ec_cscd_dtsp dtsp; +}; + +struct scsi_ec_segment +{ + uint8_t type_code; + uint8_t flags; +#define EC_SEG_DC 0x02 +#define EC_SEG_CAT 0x01 + uint8_t descr_length[2]; + uint8_t params[]; +}; + +struct scsi_ec_segment_b2b +{ + uint8_t type_code; +#define EC_SEG_B2B 0x02 + uint8_t flags; + uint8_t descr_length[2]; + uint8_t src_cscd[2]; + uint8_t dst_cscd[2]; + uint8_t reserved[2]; + uint8_t number_of_blocks[2]; + uint8_t src_lba[8]; + uint8_t dst_lba[8]; +}; + +struct scsi_ec_segment_verify +{ + uint8_t type_code; +#define EC_SEG_VERIFY 0x07 + uint8_t reserved; + uint8_t descr_length[2]; + uint8_t src_cscd[2]; + uint8_t reserved2[2]; + uint8_t tur; + uint8_t reserved3[3]; +}; + +struct scsi_ec_segment_register_key +{ + uint8_t type_code; +#define EC_SEG_REGISTER_KEY 0x14 + uint8_t reserved; + uint8_t descr_length[2]; + uint8_t reserved2[2]; + uint8_t dst_cscd[2]; + uint8_t res_key[8]; + uint8_t sa_res_key[8]; + uint8_t reserved3[4]; +}; + +struct scsi_extended_copy_lid1_data +{ + uint8_t list_identifier; + uint8_t flags; +#define EC_PRIORITY 0x07 +#define EC_LIST_ID_USAGE_MASK 0x18 +#define EC_LIST_ID_USAGE_FULL 0x08 +#define EC_LIST_ID_USAGE_NOHOLD 0x10 +#define EC_LIST_ID_USAGE_NONE 0x18 +#define EC_STR 0x20 + uint8_t cscd_list_length[2]; + uint8_t reserved[4]; + uint8_t segment_list_length[4]; + uint8_t inline_data_length[4]; + uint8_t data[]; +}; + +struct scsi_extended_copy_lid4_data +{ + uint8_t list_format; +#define EC_LIST_FORMAT 0x01 + uint8_t flags; + uint8_t header_cscd_list_length[2]; + uint8_t reserved[11]; + uint8_t flags2; +#define EC_IMMED 0x01 +#define EC_G_SENSE 0x02 + uint8_t header_cscd_type_code; + uint8_t reserved2[3]; + uint8_t list_identifier[4]; + uint8_t reserved3[18]; + uint8_t cscd_list_length[2]; + uint8_t segment_list_length[2]; + uint8_t inline_data_length[2]; + uint8_t data[]; +}; + +struct scsi_copy_operation_abort +{ + uint8_t opcode; + uint8_t service_action; +#define EC_COA 0x1c + uint8_t list_identifier[4]; + uint8_t reserved[9]; + uint8_t control; +}; + struct ata_pass_16 { u_int8_t opcode; u_int8_t protocol; @@ -1039,10 +1604,14 @@ struct ata_pass_16 { #define MODE_SENSE_10 0x5A #define PERSISTENT_RES_IN 0x5E #define PERSISTENT_RES_OUT 0x5F +#define EXTENDED_COPY 0x83 +#define RECEIVE_COPY_STATUS 0x84 #define ATA_PASS_16 0x85 #define READ_16 0x88 +#define COMPARE_AND_WRITE 0x89 #define WRITE_16 0x8A #define WRITE_VERIFY_16 0x8E +#define VERIFY_16 0x8F #define SYNCHRONIZE_CACHE_16 0x91 #define WRITE_SAME_16 0x93 #define SERVICE_ACTION_IN 0x9E @@ -1054,6 +1623,7 @@ struct ata_pass_16 { #define READ_12 0xA8 #define WRITE_12 0xAA #define WRITE_VERIFY_12 0xAE +#define VERIFY_12 0xAF #define READ_ELEMENT_STATUS 0xB8 #define READ_CD 0xBE @@ -1149,7 +1719,9 @@ struct scsi_inquiry_data #define SID_QUAL_IS_VENDOR_UNIQUE(inq_data) ((SID_QUAL(inq_data) & 0x08) != 0) u_int8_t dev_qual2; #define SID_QUAL2 0x7F -#define SID_IS_REMOVABLE(inq_data) (((inq_data)->dev_qual2 & 0x80) != 0) +#define SID_LU_CONG 0x40 +#define SID_RMB 0x80 +#define SID_IS_REMOVABLE(inq_data) (((inq_data)->dev_qual2 & SID_RMB) != 0) u_int8_t version; #define SID_ANSI_REV(inq_data) ((inq_data)->version & 0x07) #define SCSI_REV_0 0 @@ -1297,15 +1869,9 @@ struct scsi_vpd_device_id struct scsi_vpd_id_descriptor { u_int8_t proto_codeset; -#define SCSI_PROTO_FC 0x00 -#define SCSI_PROTO_SPI 0x01 -#define SCSI_PROTO_SSA 0x02 -#define SCSI_PROTO_1394 0x03 -#define SCSI_PROTO_RDMA 0x04 -#define SCSI_PROTO_ISCSI 0x05 -#define SCSI_PROTO_SAS 0x06 -#define SCSI_PROTO_ADT 0x07 -#define SCSI_PROTO_ATA 0x08 + /* + * See the SCSI_PROTO definitions above for the protocols. + */ #define SVPD_ID_PROTO_SHIFT 4 #define SVPD_ID_CODESET_BINARY 0x01 #define SVPD_ID_CODESET_ASCII 0x02 @@ -1447,12 +2013,114 @@ struct scsi_diag_page { uint8_t params[0]; }; +struct scsi_vpd_port_designation +{ + uint8_t reserved[2]; + uint8_t relative_port_id[2]; + uint8_t reserved2[2]; + uint8_t initiator_transportid_length[2]; + uint8_t initiator_transportid[0]; +}; + +struct scsi_vpd_port_designation_cont +{ + uint8_t reserved[2]; + uint8_t target_port_descriptors_length[2]; + struct scsi_vpd_id_descriptor target_port_descriptors[0]; +}; + +struct scsi_vpd_scsi_ports +{ + u_int8_t device; + u_int8_t page_code; +#define SVPD_SCSI_PORTS 0x88 + u_int8_t page_length[2]; + struct scsi_vpd_port_designation design[]; +}; + /* * ATA Information VPD Page based on * T10/2126-D Revision 04 */ #define SVPD_ATA_INFORMATION 0x89 + +struct scsi_vpd_tpc_descriptor +{ + uint8_t desc_type[2]; + uint8_t desc_length[2]; + uint8_t parameters[]; +}; + +struct scsi_vpd_tpc_descriptor_sc_descr +{ + uint8_t opcode; + uint8_t sa_length; + uint8_t supported_service_actions[0]; +}; + +struct scsi_vpd_tpc_descriptor_sc +{ + uint8_t desc_type[2]; +#define SVPD_TPC_SC 0x0001 + uint8_t desc_length[2]; + uint8_t list_length; + struct scsi_vpd_tpc_descriptor_sc_descr descr[]; +}; + +struct scsi_vpd_tpc_descriptor_pd +{ + uint8_t desc_type[2]; +#define SVPD_TPC_PD 0x0004 + uint8_t desc_length[2]; + uint8_t reserved[4]; + uint8_t maximum_cscd_descriptor_count[2]; + uint8_t maximum_segment_descriptor_count[2]; + uint8_t maximum_descriptor_list_length[4]; + uint8_t maximum_inline_data_length[4]; + uint8_t reserved2[12]; +}; + +struct scsi_vpd_tpc_descriptor_sd +{ + uint8_t desc_type[2]; +#define SVPD_TPC_SD 0x0008 + uint8_t desc_length[2]; + uint8_t list_length; + uint8_t supported_descriptor_codes[]; +}; + +struct scsi_vpd_tpc_descriptor_sdid +{ + uint8_t desc_type[2]; +#define SVPD_TPC_SDID 0x000C + uint8_t desc_length[2]; + uint8_t list_length[2]; + uint8_t supported_descriptor_ids[]; +}; + +struct scsi_vpd_tpc_descriptor_gco +{ + uint8_t desc_type[2]; +#define SVPD_TPC_GCO 0x8001 + uint8_t desc_length[2]; + uint8_t total_concurrent_copies[4]; + uint8_t maximum_identified_concurrent_copies[4]; + uint8_t maximum_segment_length[4]; + uint8_t data_segment_granularity; + uint8_t inline_data_granularity; + uint8_t reserved[18]; +}; + +struct scsi_vpd_tpc +{ + uint8_t device; + uint8_t page_code; +#define SVPD_SCSI_TPC 0x8F + uint8_t page_length[2]; + struct scsi_vpd_tpc_descriptor descr[]; +}; + /* * Block Device Characteristics VPD Page based on * T10/1799-D Revision 31 @@ -1637,8 +2305,9 @@ struct scsi_target_group { uint8_t opcode; uint8_t service_action; +#define STG_PDF_MASK 0xe0 #define STG_PDF_LENGTH 0x00 -#define RPL_PDF_EXTENDED 0x20 +#define STG_PDF_EXTENDED 0x20 uint8_t reserved1[4]; uint8_t length[4]; uint8_t reserved2; @@ -1688,7 +2357,7 @@ struct scsi_target_group_data { struct scsi_target_group_data_extended { uint8_t length[4]; /* length of returned data, in bytes */ - uint8_t format_type; /* STG_PDF_LENGTH or RPL_PDF_EXTENDED */ + uint8_t format_type; /* STG_PDF_LENGTH or STG_PDF_EXTENDED */ uint8_t implicit_transition_time; uint8_t reserved[2]; struct scsi_target_port_group_descriptor groups[]; @@ -2202,6 +2871,22 @@ typedef enum { SSS_FLAG_PRINT_COMMAND = 0x01 } scsi_sense_string_flags; +struct scsi_nv { + const char *name; + uint64_t value; +}; + +typedef enum { + SCSI_NV_FOUND, + SCSI_NV_AMBIGUOUS, + SCSI_NV_NOT_FOUND +} scsi_nv_status; + +typedef enum { + SCSI_NV_FLAG_NONE = 0x00, + SCSI_NV_FLAG_IG_CASE = 0x01 /* Case insensitive comparison */ +} scsi_nv_flags; + struct ccb_scsiio; struct cam_periph; union ccb; @@ -2343,6 +3028,64 @@ struct scsi_vpd_id_descriptor * scsi_get_devid(struct scsi_vpd_device_id *id, uint32_t len, scsi_devid_checkfn_t ck_fn); +int scsi_transportid_sbuf(struct sbuf *sb, + struct scsi_transportid_header *hdr, + uint32_t valid_len); + +const char * scsi_nv_to_str(struct scsi_nv *table, int num_table_entries, + uint64_t value); + +scsi_nv_status scsi_get_nv(struct scsi_nv *table, int num_table_entries, + char *name, int *table_entry, scsi_nv_flags flags); + +int scsi_parse_transportid_64bit(int proto_id, char *id_str, + struct scsi_transportid_header **hdr, + unsigned int *alloc_len, +#ifdef _KERNEL + struct malloc_type *type, int flags, +#endif + char *error_str, int error_str_len); + +int scsi_parse_transportid_spi(char *id_str, + struct scsi_transportid_header **hdr, + unsigned int *alloc_len, +#ifdef _KERNEL + struct malloc_type *type, int flags, +#endif + char *error_str, int error_str_len); + +int scsi_parse_transportid_rdma(char *id_str, + struct scsi_transportid_header **hdr, + unsigned int *alloc_len, +#ifdef _KERNEL + struct malloc_type *type, int flags, +#endif + char *error_str, int error_str_len); + +int scsi_parse_transportid_iscsi(char *id_str, + struct scsi_transportid_header **hdr, + unsigned int *alloc_len, +#ifdef _KERNEL + struct malloc_type *type, int flags, +#endif + char *error_str,int error_str_len); + +int scsi_parse_transportid_sop(char *id_str, + struct scsi_transportid_header **hdr, + unsigned int *alloc_len, +#ifdef _KERNEL + struct malloc_type *type, int flags, +#endif + char *error_str,int error_str_len); + +int scsi_parse_transportid(char *transportid_str, + struct scsi_transportid_header **hdr, + unsigned int *alloc_len, +#ifdef _KERNEL + struct malloc_type *type, int flags, +#endif + char *error_str, int error_str_len); + void scsi_test_unit_ready(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), @@ -2538,6 +3281,20 @@ void scsi_start_stop(struct ccb_scsiio *csio, u_int32_t retries, u_int8_t tag_action, int start, int load_eject, int immediate, u_int8_t sense_len, u_int32_t timeout); +void scsi_persistent_reserve_in(struct ccb_scsiio *csio, uint32_t retries, + void (*cbfcnp)(struct cam_periph *,union ccb *), + uint8_t tag_action, int service_action, + uint8_t *data_ptr, uint32_t dxfer_len, + int sense_len, int timeout); + +void scsi_persistent_reserve_out(struct ccb_scsiio *csio, uint32_t retries, + void (*cbfcnp)(struct cam_periph *, + union ccb *), + uint8_t tag_action, int service_action, + int scope, int res_type, uint8_t *data_ptr, + uint32_t dxfer_len, int sense_len, + int timeout); + int scsi_inquiry_match(caddr_t inqbuffer, caddr_t table_entry); int scsi_static_inquiry_match(caddr_t inqbuffer, caddr_t table_entry); diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index 81c29a6fb54..47a5a438d29 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -277,15 +277,12 @@ static int cd_retry_count = CD_DEFAULT_RETRY; static int cd_timeout = CD_DEFAULT_TIMEOUT; static SYSCTL_NODE(_kern_cam, OID_AUTO, cd, CTLFLAG_RD, 0, "CAM CDROM driver"); -SYSCTL_INT(_kern_cam_cd, OID_AUTO, poll_period, CTLFLAG_RW, +SYSCTL_INT(_kern_cam_cd, OID_AUTO, poll_period, CTLFLAG_RWTUN, &cd_poll_period, 0, "Media polling period in seconds"); -TUNABLE_INT("kern.cam.cd.poll_period", &cd_poll_period); -SYSCTL_INT(_kern_cam_cd, OID_AUTO, retry_count, CTLFLAG_RW, +SYSCTL_INT(_kern_cam_cd, OID_AUTO, retry_count, CTLFLAG_RWTUN, &cd_retry_count, 0, "Normal I/O retry count"); -TUNABLE_INT("kern.cam.cd.retry_count", &cd_retry_count); -SYSCTL_INT(_kern_cam_cd, OID_AUTO, timeout, CTLFLAG_RW, +SYSCTL_INT(_kern_cam_cd, OID_AUTO, timeout, CTLFLAG_RWTUN, &cd_timeout, 0, "Timeout, in us, for read operations"); -TUNABLE_INT("kern.cam.cd.timeout", &cd_timeout); static MALLOC_DEFINE(M_SCSICD, "scsi_cd", "scsi_cd buffers"); diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index de2035323b3..0b1f8d595e3 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -1188,18 +1188,14 @@ static int da_send_ordered = DA_DEFAULT_SEND_ORDERED; static SYSCTL_NODE(_kern_cam, OID_AUTO, da, CTLFLAG_RD, 0, "CAM Direct Access Disk driver"); -SYSCTL_INT(_kern_cam_da, OID_AUTO, poll_period, CTLFLAG_RW, +SYSCTL_INT(_kern_cam_da, OID_AUTO, poll_period, CTLFLAG_RWTUN, &da_poll_period, 0, "Media polling period in seconds"); -TUNABLE_INT("kern.cam.da.poll_period", &da_poll_period); -SYSCTL_INT(_kern_cam_da, OID_AUTO, retry_count, CTLFLAG_RW, +SYSCTL_INT(_kern_cam_da, OID_AUTO, retry_count, CTLFLAG_RWTUN, &da_retry_count, 0, "Normal I/O retry count"); -TUNABLE_INT("kern.cam.da.retry_count", &da_retry_count); -SYSCTL_INT(_kern_cam_da, OID_AUTO, default_timeout, CTLFLAG_RW, +SYSCTL_INT(_kern_cam_da, OID_AUTO, default_timeout, CTLFLAG_RWTUN, &da_default_timeout, 0, "Normal I/O timeout (in seconds)"); -TUNABLE_INT("kern.cam.da.default_timeout", &da_default_timeout); -SYSCTL_INT(_kern_cam_da, OID_AUTO, send_ordered, CTLFLAG_RW, +SYSCTL_INT(_kern_cam_da, OID_AUTO, send_ordered, CTLFLAG_RWTUN, &da_send_ordered, 0, "Send Ordered Tags"); -TUNABLE_INT("kern.cam.da.send_ordered", &da_send_ordered); /* * DA_ORDEREDTAG_INTERVAL determines how often, relative @@ -1383,10 +1379,7 @@ dastrategy(struct bio *bp) * Place it in the queue of disk activities for this disk */ if (bp->bio_cmd == BIO_DELETE) { - if (DA_SIO) - bioq_disksort(&softc->delete_queue, bp); - else - bioq_insert_tail(&softc->delete_queue, bp); + bioq_disksort(&softc->delete_queue, bp); } else if (DA_SIO) { bioq_disksort(&softc->bio_queue, bp); } else { @@ -2805,16 +2798,9 @@ cmd6workaround(union ccb *ccb) da_delete_method_desc[old_method], da_delete_method_desc[softc->delete_method]); - if (DA_SIO) { - while ((bp = bioq_takefirst(&softc->delete_run_queue)) - != NULL) - bioq_disksort(&softc->delete_queue, bp); - } else { - while ((bp = bioq_takefirst(&softc->delete_run_queue)) - != NULL) - bioq_insert_tail(&softc->delete_queue, bp); - } - bioq_insert_tail(&softc->delete_queue, + while ((bp = bioq_takefirst(&softc->delete_run_queue)) != NULL) + bioq_disksort(&softc->delete_queue, bp); + bioq_disksort(&softc->delete_queue, (struct bio *)ccb->ccb_h.ccb_bp); ccb->ccb_h.ccb_bp = NULL; return (0); diff --git a/sys/cam/scsi/scsi_da.h b/sys/cam/scsi/scsi_da.h index 4fbd7256af9..a27b17325b1 100644 --- a/sys/cam/scsi/scsi_da.h +++ b/sys/cam/scsi/scsi_da.h @@ -222,18 +222,49 @@ struct scsi_read_format_capacities uint8_t reserved1[3]; }; -struct scsi_verify +struct scsi_verify_10 { - uint8_t opcode; /* VERIFY */ + uint8_t opcode; /* VERIFY(10) */ uint8_t byte2; #define SVFY_LUN_MASK 0xE0 #define SVFY_RELADR 0x01 -#define SVFY_BYTECHK 0x02 +#define SVFY_BYTCHK 0x02 #define SVFY_DPO 0x10 uint8_t addr[4]; /* LBA to begin verification at */ - uint8_t reserved0[1]; - uint8_t len[2]; /* number of blocks to verify */ - uint8_t reserved1[3]; + uint8_t group; + uint8_t length[2]; /* number of blocks to verify */ + uint8_t control; +}; + +struct scsi_verify_12 +{ + uint8_t opcode; /* VERIFY(12) */ + uint8_t byte2; + uint8_t addr[4]; /* LBA to begin verification at */ + uint8_t length[4]; /* number of blocks to verify */ + uint8_t group; + uint8_t control; +}; + +struct scsi_verify_16 +{ + uint8_t opcode; /* VERIFY(16) */ + uint8_t byte2; + uint8_t addr[8]; /* LBA to begin verification at */ + uint8_t length[4]; /* number of blocks to verify */ + uint8_t group; + uint8_t control; +}; + +struct scsi_compare_and_write +{ + uint8_t opcode; /* COMPARE AND WRITE */ + uint8_t byte2; + uint8_t addr[8]; /* LBA to begin verification at */ + uint8_t reserved[3]; + uint8_t length; /* number of blocks */ + uint8_t group; + uint8_t control; }; struct scsi_write_and_verify diff --git a/sys/cam/scsi/scsi_enc_safte.c b/sys/cam/scsi/scsi_enc_safte.c index 8282d013bb5..89f70a5ada2 100644 --- a/sys/cam/scsi/scsi_enc_safte.c +++ b/sys/cam/scsi/scsi_enc_safte.c @@ -226,9 +226,8 @@ static char *safte_2little = "Too Little Data Returned (%d) at line %d\n"; int emulate_array_devices = 1; SYSCTL_DECL(_kern_cam_enc); -SYSCTL_INT(_kern_cam_enc, OID_AUTO, emulate_array_devices, CTLFLAG_RW, +SYSCTL_INT(_kern_cam_enc, OID_AUTO, emulate_array_devices, CTLFLAG_RWTUN, &emulate_array_devices, 0, "Emulate Array Devices for SAF-TE"); -TUNABLE_INT("kern.cam.enc.emulate_array_devices", &emulate_array_devices); static int safte_fill_read_buf_io(enc_softc_t *enc, struct enc_fsm_state *state, diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c index c1cd0f0bfdf..16b7b149036 100644 --- a/sys/cam/scsi/scsi_sa.c +++ b/sys/cam/scsi/scsi_sa.c @@ -445,9 +445,10 @@ static int sa_allow_io_split = SA_DEFAULT_IO_SPLIT; * is bad behavior, because it hides the true tape block size from the * application. */ -TUNABLE_INT("kern.cam.sa.allow_io_split", &sa_allow_io_split); static SYSCTL_NODE(_kern_cam, OID_AUTO, sa, CTLFLAG_RD, 0, "CAM Sequential Access Tape Driver"); +SYSCTL_INT(_kern_cam_sa, OID_AUTO, allow_io_split, CTLFLAG_RDTUN, + &sa_allow_io_split, 0, "Default I/O split value"); static struct periph_driver sadriver = { @@ -1494,7 +1495,7 @@ sasysctlinit(void *context, int pending) goto bailout; SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "allow_io_split", CTLTYPE_INT | CTLFLAG_RDTUN, + OID_AUTO, "allow_io_split", CTLTYPE_INT | CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &softc->allow_io_split, 0, "Allow Splitting I/O"); SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "maxio", CTLTYPE_INT | CTLFLAG_RD, diff --git a/sys/cam/scsi/scsi_sg.c b/sys/cam/scsi/scsi_sg.c index f1cb75bf283..3e80ac3e763 100644 --- a/sys/cam/scsi/scsi_sg.c +++ b/sys/cam/scsi/scsi_sg.c @@ -494,7 +494,7 @@ sgioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td) struct ccb_scsiio *csio; struct cam_periph *periph; struct sg_softc *softc; - struct sg_io_hdr req; + struct sg_io_hdr *req; int dir, error; periph = (struct cam_periph *)dev->si_drv1; @@ -507,40 +507,22 @@ sgioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td) error = 0; switch (cmd) { - case LINUX_SCSI_GET_BUS_NUMBER: { - int busno; - - busno = xpt_path_path_id(periph->path); - error = copyout(&busno, arg, sizeof(busno)); - break; - } - case LINUX_SCSI_GET_IDLUN: { - struct scsi_idlun idlun; - struct cam_sim *sim; - - idlun.dev_id = xpt_path_target_id(periph->path); - sim = xpt_path_sim(periph->path); - idlun.host_unique_id = sim->unit_number; - error = copyout(&idlun, arg, sizeof(idlun)); - break; - } case SG_GET_VERSION_NUM: - case LINUX_SG_GET_VERSION_NUM: - error = copyout(&sg_version, arg, sizeof(sg_version)); - break; - case SG_SET_TIMEOUT: - case LINUX_SG_SET_TIMEOUT: { - u_int user_timeout; + { + int *version = (int *)arg; - error = copyin(arg, &user_timeout, sizeof(u_int)); - if (error == 0) { - softc->sg_user_timeout = user_timeout; - softc->sg_timeout = user_timeout / SG_DEFAULT_HZ * hz; - } + *version = sg_version; + break; + } + case SG_SET_TIMEOUT: + { + u_int user_timeout = *(u_int *)arg; + + softc->sg_user_timeout = user_timeout; + softc->sg_timeout = user_timeout / SG_DEFAULT_HZ * hz; break; } case SG_GET_TIMEOUT: - case LINUX_SG_GET_TIMEOUT: /* * The value is returned directly to the syscall. */ @@ -548,17 +530,14 @@ sgioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td) error = 0; break; case SG_IO: - case LINUX_SG_IO: - error = copyin(arg, &req, sizeof(req)); - if (error) - break; + req = (struct sg_io_hdr *)arg; - if (req.cmd_len > IOCDBLEN) { + if (req->cmd_len > IOCDBLEN) { error = EINVAL; break; } - if (req.iovec_count != 0) { + if (req->iovec_count != 0) { error = EOPNOTSUPP; break; } @@ -566,14 +545,14 @@ sgioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td) ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); csio = &ccb->csio; - error = copyin(req.cmdp, &csio->cdb_io.cdb_bytes, - req.cmd_len); + error = copyin(req->cmdp, &csio->cdb_io.cdb_bytes, + req->cmd_len); if (error) { xpt_release_ccb(ccb); break; } - switch(req.dxfer_direction) { + switch(req->dxfer_direction) { case SG_DXFER_TO_DEV: dir = CAM_DIR_OUT; break; @@ -594,62 +573,64 @@ sgioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td) sgdone, dir|CAM_DEV_QFRZDIS, MSG_SIMPLE_Q_TAG, - req.dxferp, - req.dxfer_len, - req.mx_sb_len, - req.cmd_len, - req.timeout); + req->dxferp, + req->dxfer_len, + req->mx_sb_len, + req->cmd_len, + req->timeout); error = sgsendccb(periph, ccb); if (error) { - req.host_status = DID_ERROR; - req.driver_status = DRIVER_INVALID; + req->host_status = DID_ERROR; + req->driver_status = DRIVER_INVALID; xpt_release_ccb(ccb); break; } - req.status = csio->scsi_status; - req.masked_status = (csio->scsi_status >> 1) & 0x7f; - sg_scsiio_status(csio, &req.host_status, &req.driver_status); - req.resid = csio->resid; - req.duration = csio->ccb_h.timeout; - req.info = 0; + req->status = csio->scsi_status; + req->masked_status = (csio->scsi_status >> 1) & 0x7f; + sg_scsiio_status(csio, &req->host_status, &req->driver_status); + req->resid = csio->resid; + req->duration = csio->ccb_h.timeout; + req->info = 0; - error = copyout(&req, arg, sizeof(req)); - if ((error == 0) && (csio->ccb_h.status & CAM_AUTOSNS_VALID) - && (req.sbp != NULL)) { - req.sb_len_wr = req.mx_sb_len - csio->sense_resid; - error = copyout(&csio->sense_data, req.sbp, - req.sb_len_wr); + if ((csio->ccb_h.status & CAM_AUTOSNS_VALID) + && (req->sbp != NULL)) { + req->sb_len_wr = req->mx_sb_len - csio->sense_resid; + error = copyout(&csio->sense_data, req->sbp, + req->sb_len_wr); } xpt_release_ccb(ccb); break; case SG_GET_RESERVED_SIZE: - case LINUX_SG_GET_RESERVED_SIZE: { - int size = 32768; - - error = copyout(&size, arg, sizeof(size)); + { + int *size = (int *)arg; + *size = DFLTPHYS; break; } case SG_GET_SCSI_ID: - case LINUX_SG_GET_SCSI_ID: { - struct sg_scsi_id id; + struct sg_scsi_id *id = (struct sg_scsi_id *)arg; - id.host_no = cam_sim_path(xpt_path_sim(periph->path)); - id.channel = xpt_path_path_id(periph->path); - id.scsi_id = xpt_path_target_id(periph->path); - id.lun = xpt_path_lun_id(periph->path); - id.scsi_type = softc->pd_type; - id.h_cmd_per_lun = 1; - id.d_queue_depth = 1; - id.unused[0] = 0; - id.unused[1] = 0; + id->host_no = cam_sim_path(xpt_path_sim(periph->path)); + id->channel = xpt_path_path_id(periph->path); + id->scsi_id = xpt_path_target_id(periph->path); + id->lun = xpt_path_lun_id(periph->path); + id->scsi_type = softc->pd_type; + id->h_cmd_per_lun = 1; + id->d_queue_depth = 1; + id->unused[0] = 0; + id->unused[1] = 0; + break; + } - error = copyout(&id, arg, sizeof(id)); + case SG_GET_SG_TABLESIZE: + { + int *size = (int *)arg; + *size = 0; break; } @@ -664,7 +645,6 @@ sgioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td) case SG_GET_ACCESS_COUNT: case SG_SET_FORCE_LOW_DMA: case SG_GET_LOW_DMA: - case SG_GET_SG_TABLESIZE: case SG_SET_FORCE_PACK_ID: case SG_GET_PACK_ID: case SG_SET_RESERVED_SIZE: @@ -672,25 +652,6 @@ sgioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td) case SG_SET_COMMAND_Q: case SG_SET_DEBUG: case SG_NEXT_CMD_LEN: - case LINUX_SG_EMULATED_HOST: - case LINUX_SG_SET_TRANSFORM: - case LINUX_SG_GET_TRANSFORM: - case LINUX_SG_GET_NUM_WAITING: - case LINUX_SG_SCSI_RESET: - case LINUX_SG_GET_REQUEST_TABLE: - case LINUX_SG_SET_KEEP_ORPHAN: - case LINUX_SG_GET_KEEP_ORPHAN: - case LINUX_SG_GET_ACCESS_COUNT: - case LINUX_SG_SET_FORCE_LOW_DMA: - case LINUX_SG_GET_LOW_DMA: - case LINUX_SG_GET_SG_TABLESIZE: - case LINUX_SG_SET_FORCE_PACK_ID: - case LINUX_SG_GET_PACK_ID: - case LINUX_SG_SET_RESERVED_SIZE: - case LINUX_SG_GET_COMMAND_Q: - case LINUX_SG_SET_COMMAND_Q: - case LINUX_SG_SET_DEBUG: - case LINUX_SG_NEXT_CMD_LEN: default: #ifdef CAMDEBUG printf("sgioctl: rejecting cmd 0x%lx\n", cmd); @@ -729,6 +690,12 @@ sgwrite(struct cdev *dev, struct uio *uio, int ioflag) if (error) goto out_hdr; + /* XXX: We don't support SG 3.x read/write API. */ + if (hdr->reply_len < 0) { + error = ENODEV; + goto out_hdr; + } + ccb = xpt_alloc_ccb(); if (ccb == NULL) { error = ENOMEM; diff --git a/sys/cam/scsi/scsi_sg.h b/sys/cam/scsi/scsi_sg.h index 60dbbfe7c64..210eec5f4f4 100644 --- a/sys/cam/scsi/scsi_sg.h +++ b/sys/cam/scsi/scsi_sg.h @@ -8,31 +8,31 @@ #define _SCSI_SG_H #define SGIOC '"' -#define SG_SET_TIMEOUT _IO(SGIOC, 0x01) +#define SG_SET_TIMEOUT _IOW(SGIOC, 0x01, u_int) #define SG_GET_TIMEOUT _IO(SGIOC, 0x02) -#define SG_EMULATED_HOST _IO(SGIOC, 0x03) +#define SG_EMULATED_HOST _IOR(SGIOC, 0x03, int) #define SG_SET_TRANSFORM _IO(SGIOC, 0x04) #define SG_GET_TRANSFORM _IO(SGIOC, 0x05) -#define SG_GET_COMMAND_Q _IO(SGIOC, 0x70) -#define SG_SET_COMMAND_Q _IO(SGIOC, 0x71) -#define SG_GET_RESERVED_SIZE _IO(SGIOC, 0x72) -#define SG_SET_RESERVED_SIZE _IO(SGIOC, 0x75) -#define SG_GET_SCSI_ID _IO(SGIOC, 0x76) -#define SG_SET_FORCE_LOW_DMA _IO(SGIOC, 0x79) -#define SG_GET_LOW_DMA _IO(SGIOC, 0x7a) -#define SG_SET_FORCE_PACK_ID _IO(SGIOC, 0x7b) -#define SG_GET_PACK_ID _IO(SGIOC, 0x7c) -#define SG_GET_NUM_WAITING _IO(SGIOC, 0x7d) -#define SG_SET_DEBUG _IO(SGIOC, 0x7e) -#define SG_GET_SG_TABLESIZE _IO(SGIOC, 0x7f) -#define SG_GET_VERSION_NUM _IO(SGIOC, 0x82) -#define SG_NEXT_CMD_LEN _IO(SGIOC, 0x83) -#define SG_SCSI_RESET _IO(SGIOC, 0x84) -#define SG_IO _IO(SGIOC, 0x85) +#define SG_GET_COMMAND_Q _IOW(SGIOC, 0x70, int) +#define SG_SET_COMMAND_Q _IOR(SGIOC, 0x71, int) +#define SG_GET_RESERVED_SIZE _IOR(SGIOC, 0x72, int) +#define SG_SET_RESERVED_SIZE _IOW(SGIOC, 0x75, int) +#define SG_GET_SCSI_ID _IOR(SGIOC, 0x76, struct sg_scsi_id) +#define SG_SET_FORCE_LOW_DMA _IOW(SGIOC, 0x79, int) +#define SG_GET_LOW_DMA _IOR(SGIOC, 0x7a, int) +#define SG_SET_FORCE_PACK_ID _IOW(SGIOC, 0x7b, int) +#define SG_GET_PACK_ID _IOR(SGIOC, 0x7c, int) +#define SG_GET_NUM_WAITING _IOR(SGIOC, 0x7d, int) +#define SG_SET_DEBUG _IOW(SGIOC, 0x7e, int) +#define SG_GET_SG_TABLESIZE _IOR(SGIOC, 0x7f, int) +#define SG_GET_VERSION_NUM _IOR(SGIOC, 0x82, int) +#define SG_NEXT_CMD_LEN _IOW(SGIOC, 0x83, int) +#define SG_SCSI_RESET _IOW(SGIOC, 0x84, int) +#define SG_IO _IOWR(SGIOC, 0x85, struct sg_io_hdr) #define SG_GET_REQUEST_TABLE _IO(SGIOC, 0x86) -#define SG_SET_KEEP_ORPHAN _IO(SGIOC, 0x87) -#define SG_GET_KEEP_ORPHAN _IO(SGIOC, 0x88) -#define SG_GET_ACCESS_COUNT _IO(SGIOC, 0x89) +#define SG_SET_KEEP_ORPHAN _IOW(SGIOC, 0x87, int) +#define SG_GET_KEEP_ORPHAN _IOR(SGIOC, 0x88, int) +#define SG_GET_ACCESS_COUNT _IOR(SGIOC, 0x89, int) struct sg_io_hdr { int interface_id; @@ -59,6 +59,31 @@ struct sg_io_hdr { u_int info; }; +struct sg_io_hdr32 { + int interface_id; + int dxfer_direction; + u_char cmd_len; + u_char mx_sb_len; + u_short iovec_count; + u_int dxfer_len; + uint32_t dxferp; + uint32_t cmdp; + uint32_t sbp; + u_int timeout; + u_int flags; + int pack_id; + uint32_t usr_ptr; + u_char status; + u_char masked_status; + u_char msg_status; + u_char sb_len_wr; + u_short host_status; + u_short driver_status; + int resid; + u_int duration; + u_int info; +}; + #define SG_DXFER_NONE -1 #define SG_DXFER_TO_DEV -2 #define SG_DXFER_FROM_DEV -3 diff --git a/sys/cam/scsi/scsi_xpt.c b/sys/cam/scsi/scsi_xpt.c index 942f7121cf5..42b8774fd88 100644 --- a/sys/cam/scsi/scsi_xpt.c +++ b/sys/cam/scsi/scsi_xpt.c @@ -78,9 +78,8 @@ struct scsi_quirk_entry { #define SCSI_QUIRK(dev) ((struct scsi_quirk_entry *)((dev)->quirk)) static int cam_srch_hi = 0; -TUNABLE_INT("kern.cam.cam_srch_hi", &cam_srch_hi); static int sysctl_cam_search_luns(SYSCTL_HANDLER_ARGS); -SYSCTL_PROC(_kern_cam, OID_AUTO, cam_srch_hi, CTLTYPE_INT|CTLFLAG_RW, 0, 0, +SYSCTL_PROC(_kern_cam, OID_AUTO, cam_srch_hi, CTLTYPE_INT | CTLFLAG_RWTUN, 0, 0, sysctl_cam_search_luns, "I", "allow search above LUN 7 for SCSI3 and greater devices"); diff --git a/sys/cddl/boot/zfs/README b/sys/cddl/boot/zfs/README index f7c045dab5d..5f16d5cddf2 100644 --- a/sys/cddl/boot/zfs/README +++ b/sys/cddl/boot/zfs/README @@ -7,9 +7,10 @@ are used by the ZFS bootstrap: sha256.c checksum support lz4.c compression support lzjb.c compression support + blkptr.c ZFS embedded-data block pointers support zfssubr.c checksum, compression and raidz support zfsimpl.h mostly describing the physical layout -The files fletcher.c, lzjb.c and sha256.c are largely identical to the -ZFS base code (with write support removed) and could be shared but -that might complicate future imports from OpenSolaris. +The files fletcher.c, lzjb.c, lz4.c, sha256.c and blkptr.c are largely identical +to the ZFS base code (with write support removed) and could be shared but that +might complicate future imports from Illumos. diff --git a/sys/cddl/boot/zfs/blkptr.c b/sys/cddl/boot/zfs/blkptr.c new file mode 100644 index 00000000000..c36c59bbe88 --- /dev/null +++ b/sys/cddl/boot/zfs/blkptr.c @@ -0,0 +1,73 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2013 by Delphix. All rights reserved. + */ + +/* + * Embedded-data Block Pointers + * + * Normally, block pointers point (via their DVAs) to a block which holds data. + * If the data that we need to store is very small, this is an inefficient + * use of space, because a block must be at minimum 1 sector (typically 512 + * bytes or 4KB). Additionally, reading these small blocks tends to generate + * more random reads. + * + * Embedded-data Block Pointers allow small pieces of data (the "payload", + * up to 112 bytes) to be stored in the block pointer itself, instead of + * being pointed to. The "Pointer" part of this name is a bit of a + * misnomer, as nothing is pointed to. + * + * BP_EMBEDDED_TYPE_DATA block pointers allow highly-compressible data to + * be embedded in the block pointer. The logic for this is handled in + * the SPA, by the zio pipeline. Therefore most code outside the zio + * pipeline doesn't need special-cases to handle these block pointers. + * + * See spa.h for details on the exact layout of embedded block pointers. + */ + +/* + * buf must be at least BPE_GET_PSIZE(bp) bytes long (which will never be + * more than BPE_PAYLOAD_SIZE bytes). + */ +void +decode_embedded_bp_compressed(const blkptr_t *bp, void *buf) +{ + int psize; + uint8_t *buf8 = buf; + uint64_t w = 0; + const uint64_t *bp64 = (const uint64_t *)bp; + + ASSERT(BP_IS_EMBEDDED(bp)); + + psize = BPE_GET_PSIZE(bp); + + /* + * Decode the words of the block pointer into the byte array. + * Low bits of first word are the first byte (little endian). + */ + for (int i = 0; i < psize; i++) { + if (i % sizeof (w) == 0) { + /* beginning of a word */ + ASSERT3P(bp64, <, bp + 1); + w = *bp64; + bp64++; + if (!BPE_IS_PAYLOADWORD(bp, bp64)) + bp64++; + } + buf8[i] = BF64_GET(w, (i % sizeof (w)) * NBBY, NBBY); + } +} diff --git a/sys/cddl/boot/zfs/zfsimpl.h b/sys/cddl/boot/zfs/zfsimpl.h index 7bc4c433de1..98f54791ae2 100644 --- a/sys/cddl/boot/zfs/zfsimpl.h +++ b/sys/cddl/boot/zfs/zfsimpl.h @@ -55,9 +55,14 @@ /* * Copyright 2013 by Saso Kiselkov. All rights reserved. */ +/* + * Copyright (c) 2013 by Delphix. All rights reserved. + */ #define MAXNAMELEN 256 +#define _NOTE(s) + /* CRC64 table */ #define ZFS_CRC64_POLY 0xC96C5795D7870F42ULL /* ECMA-182, reflected form */ @@ -163,7 +168,7 @@ typedef struct zio_cksum { * +-------+-------+-------+-------+-------+-------+-------+-------+ * 5 |G| offset3 | * +-------+-------+-------+-------+-------+-------+-------+-------+ - * 6 |BDX|lvl| type | cksum | comp | PSIZE | LSIZE | + * 6 |BDX|lvl| type | cksum |E| comp| PSIZE | LSIZE | * +-------+-------+-------+-------+-------+-------+-------+-------+ * 7 | padding | * +-------+-------+-------+-------+-------+-------+-------+-------+ @@ -197,7 +202,8 @@ typedef struct zio_cksum { * G gang block indicator * B byteorder (endianness) * D dedup - * X unused + * X encryption (on version 30, which is not supported) + * E blkptr_t contains embedded data (see below) * lvl level of indirection * type DMU object type * phys birth txg of block allocation; zero if same as logical birth txg @@ -205,6 +211,100 @@ typedef struct zio_cksum { * fill count number of non-zero blocks under this bp * checksum[4] 256-bit checksum of the data this bp describes */ + +/* + * "Embedded" blkptr_t's don't actually point to a block, instead they + * have a data payload embedded in the blkptr_t itself. See the comment + * in blkptr.c for more details. + * + * The blkptr_t is laid out as follows: + * + * 64 56 48 40 32 24 16 8 0 + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 0 | payload | + * 1 | payload | + * 2 | payload | + * 3 | payload | + * 4 | payload | + * 5 | payload | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 6 |BDX|lvl| type | etype |E| comp| PSIZE| LSIZE | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 7 | payload | + * 8 | payload | + * 9 | payload | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * a | logical birth txg | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * b | payload | + * c | payload | + * d | payload | + * e | payload | + * f | payload | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * + * Legend: + * + * payload contains the embedded data + * B (byteorder) byteorder (endianness) + * D (dedup) padding (set to zero) + * X encryption (set to zero; see above) + * E (embedded) set to one + * lvl indirection level + * type DMU object type + * etype how to interpret embedded data (BP_EMBEDDED_TYPE_*) + * comp compression function of payload + * PSIZE size of payload after compression, in bytes + * LSIZE logical size of payload, in bytes + * note that 25 bits is enough to store the largest + * "normal" BP's LSIZE (2^16 * 2^9) in bytes + * log. birth transaction group in which the block was logically born + * + * Note that LSIZE and PSIZE are stored in bytes, whereas for non-embedded + * bp's they are stored in units of SPA_MINBLOCKSHIFT. + * Generally, the generic BP_GET_*() macros can be used on embedded BP's. + * The B, D, X, lvl, type, and comp fields are stored the same as with normal + * BP's so the BP_SET_* macros can be used with them. etype, PSIZE, LSIZE must + * be set with the BPE_SET_* macros. BP_SET_EMBEDDED() should be called before + * other macros, as they assert that they are only used on BP's of the correct + * "embedded-ness". + */ + +#define BPE_GET_ETYPE(bp) \ + (ASSERT(BP_IS_EMBEDDED(bp)), \ + BF64_GET((bp)->blk_prop, 40, 8)) +#define BPE_SET_ETYPE(bp, t) do { \ + ASSERT(BP_IS_EMBEDDED(bp)); \ + BF64_SET((bp)->blk_prop, 40, 8, t); \ +_NOTE(CONSTCOND) } while (0) + +#define BPE_GET_LSIZE(bp) \ + (ASSERT(BP_IS_EMBEDDED(bp)), \ + BF64_GET_SB((bp)->blk_prop, 0, 25, 0, 1)) +#define BPE_SET_LSIZE(bp, x) do { \ + ASSERT(BP_IS_EMBEDDED(bp)); \ + BF64_SET_SB((bp)->blk_prop, 0, 25, 0, 1, x); \ +_NOTE(CONSTCOND) } while (0) + +#define BPE_GET_PSIZE(bp) \ + (ASSERT(BP_IS_EMBEDDED(bp)), \ + BF64_GET_SB((bp)->blk_prop, 25, 7, 0, 1)) +#define BPE_SET_PSIZE(bp, x) do { \ + ASSERT(BP_IS_EMBEDDED(bp)); \ + BF64_SET_SB((bp)->blk_prop, 25, 7, 0, 1, x); \ +_NOTE(CONSTCOND) } while (0) + +typedef enum bp_embedded_type { + BP_EMBEDDED_TYPE_DATA, + BP_EMBEDDED_TYPE_RESERVED, /* Reserved for an unintegrated feature. */ + NUM_BP_EMBEDDED_TYPES = BP_EMBEDDED_TYPE_RESERVED +} bp_embedded_type_t; + +#define BPE_NUM_WORDS 14 +#define BPE_PAYLOAD_SIZE (BPE_NUM_WORDS * sizeof (uint64_t)) +#define BPE_IS_PAYLOADWORD(bp, wp) \ + ((wp) != &(bp)->blk_prop && (wp) != &(bp)->blk_birth) + #define SPA_BLKPTRSHIFT 7 /* blkptr_t is 128 bytes */ #define SPA_DVAS_PER_BP 3 /* Number of DVAs in a bp */ @@ -242,18 +342,22 @@ typedef struct blkptr { #define DVA_SET_GANG(dva, x) BF64_SET((dva)->dva_word[1], 63, 1, x) #define BP_GET_LSIZE(bp) \ - (BP_IS_HOLE(bp) ? 0 : \ + (BP_IS_EMBEDDED(bp) ? \ + (BPE_GET_ETYPE(bp) == BP_EMBEDDED_TYPE_DATA ? BPE_GET_LSIZE(bp) : 0): \ BF64_GET_SB((bp)->blk_prop, 0, SPA_LSIZEBITS, SPA_MINBLOCKSHIFT, 1)) -#define BP_SET_LSIZE(bp, x) \ - BF64_SET_SB((bp)->blk_prop, 0, SPA_LSIZEBITS, SPA_MINBLOCKSHIFT, 1, x) +#define BP_SET_LSIZE(bp, x) do { \ + ASSERT(!BP_IS_EMBEDDED(bp)); \ + BF64_SET_SB((bp)->blk_prop, \ + 0, SPA_LSIZEBITS, SPA_MINBLOCKSHIFT, 1, x); \ +_NOTE(CONSTCOND) } while (0) #define BP_GET_PSIZE(bp) \ BF64_GET_SB((bp)->blk_prop, 16, SPA_LSIZEBITS, SPA_MINBLOCKSHIFT, 1) #define BP_SET_PSIZE(bp, x) \ BF64_SET_SB((bp)->blk_prop, 16, SPA_LSIZEBITS, SPA_MINBLOCKSHIFT, 1, x) -#define BP_GET_COMPRESS(bp) BF64_GET((bp)->blk_prop, 32, 8) -#define BP_SET_COMPRESS(bp, x) BF64_SET((bp)->blk_prop, 32, 8, x) +#define BP_GET_COMPRESS(bp) BF64_GET((bp)->blk_prop, 32, 7) +#define BP_SET_COMPRESS(bp, x) BF64_SET((bp)->blk_prop, 32, 7, x) #define BP_GET_CHECKSUM(bp) BF64_GET((bp)->blk_prop, 40, 8) #define BP_SET_CHECKSUM(bp, x) BF64_SET((bp)->blk_prop, 40, 8, x) @@ -264,6 +368,8 @@ typedef struct blkptr { #define BP_GET_LEVEL(bp) BF64_GET((bp)->blk_prop, 56, 5) #define BP_SET_LEVEL(bp, x) BF64_SET((bp)->blk_prop, 56, 5, x) +#define BP_IS_EMBEDDED(bp) BF64_GET((bp)->blk_prop, 39, 1) + #define BP_GET_DEDUP(bp) BF64_GET((bp)->blk_prop, 62, 1) #define BP_SET_DEDUP(bp, x) BF64_SET((bp)->blk_prop, 62, 1, x) @@ -331,6 +437,11 @@ typedef struct blkptr { ZIO_SET_CHECKSUM(&(bp)->blk_cksum, 0, 0, 0, 0); \ } +#define BPE_NUM_WORDS 14 +#define BPE_PAYLOAD_SIZE (BPE_NUM_WORDS * sizeof (uint64_t)) +#define BPE_IS_PAYLOADWORD(bp, wp) \ + ((wp) != &(bp)->blk_prop && (wp) != &(bp)->blk_birth) + /* * Embedded checksum */ @@ -1341,3 +1452,5 @@ typedef struct spa { objset_phys_t spa_mos; /* MOS for this pool */ int spa_inited; /* initialized */ } spa_t; + +static void decode_embedded_bp_compressed(const blkptr_t *, void *); diff --git a/sys/cddl/boot/zfs/zfssubr.c b/sys/cddl/boot/zfs/zfssubr.c index 0f018487bca..a64f065ad16 100644 --- a/sys/cddl/boot/zfs/zfssubr.c +++ b/sys/cddl/boot/zfs/zfssubr.c @@ -30,9 +30,11 @@ static uint64_t zfs_crc64_table[256]; #define ECKSUM 666 -#define ASSERT(...) do { } while (0) -#define ASSERT3U(...) do { } while (0) -#define ASSERT3S(...) do { } while (0) +#define ASSERT3S(x, y, z) ((void)0) +#define ASSERT3U(x, y, z) ((void)0) +#define ASSERT3P(x, y, z) ((void)0) +#define ASSERT0(x) ((void)0) +#define ASSERT(x) ((void)0) #define panic(...) do { \ printf(__VA_ARGS__); \ @@ -82,6 +84,8 @@ typedef struct zio_checksum_info { const char *ci_name; /* descriptive name */ } zio_checksum_info_t; +#include "blkptr.c" + #include "fletcher.c" #include "sha256.c" diff --git a/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c b/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c index ba651099268..03993553f6a 100644 --- a/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c +++ b/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_KSTAT, "kstat_data", "Kernel statistics"); -SYSCTL_NODE(, OID_AUTO, kstat, CTLFLAG_RW, 0, "Kernel statistics"); +SYSCTL_ROOT_NODE(OID_AUTO, kstat, CTLFLAG_RW, 0, "Kernel statistics"); kstat_t * kstat_create(char *module, int instance, char *name, char *class, uchar_t type, diff --git a/sys/cddl/contrib/opensolaris/common/atomic/ia64/opensolaris_atomic.S b/sys/cddl/contrib/opensolaris/common/atomic/ia64/opensolaris_atomic.S deleted file mode 100644 index 4907ef69f70..00000000000 --- a/sys/cddl/contrib/opensolaris/common/atomic/ia64/opensolaris_atomic.S +++ /dev/null @@ -1,93 +0,0 @@ -/*- - * Copyright (c) 2007 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. - * - * $FreeBSD$ - */ - -#include - - .text - -/* - * uint32_t atomic_cas_32(volatile uint32_t *p, uint32_t cmp, uint32_t v) - */ -ENTRY(atomic_cas_32, 3) - mov ar.ccv = r33 - ;; - cmpxchg4.acq r8 = [r32], r34, ar.ccv - ;; - br.ret.sptk rp -END(atomic_cas_32) - -/* - * uint64_t atomic_cas_64(volatile uint64_t *p, uint64_t cmp, uint64_t v) - */ -ENTRY(atomic_cas_64, 3) - mov ar.ccv = r33 - ;; - cmpxchg8.acq r8 = [r32], r34, ar.ccv - ;; - br.ret.sptk rp -END(atomic_cas_64) - -/* - * uint64_t atomic_add_64_nv(volatile uint64_t *p, uint64_t v) - */ -ENTRY(atomic_add_64_nv, 2) -1: - ld8 r16 = [r32] - ;; - mov ar.ccv = r16 - add r8 = r16, r33 - ;; - cmpxchg8.acq r17 = [r32], r8, ar.ccv - ;; - cmp.eq p6, p7 = r16, r17 -(p6) br.ret.sptk rp -(p7) br.cond.spnt 1b -END(atomic_add_64_nv) - -/* - * uint8_t atomic_or_8_nv(volatile uint8_t *p, uint8_t v) - */ -ENTRY(atomic_or_8_nv, 2) -1: - ld1 r16 = [r32] - ;; - mov ar.ccv = r16 - or r8 = r16, r33 - ;; - cmpxchg1.acq r17 = [r32], r8, ar.ccv - ;; - cmp.eq p6, p7 = r16, r17 -(p6) br.ret.sptk rp -(p7) br.cond.spnt 1b -END(atomic_or_8_nv) - -ENTRY(membar_producer, 0) - mf - ;; - br.ret.sptk rp -END(membar_producer) diff --git a/sys/cddl/contrib/opensolaris/common/unicode/u8_textprep.c b/sys/cddl/contrib/opensolaris/common/unicode/u8_textprep.c index 07186b30c83..06c8a05506e 100644 --- a/sys/cddl/contrib/opensolaris/common/unicode/u8_textprep.c +++ b/sys/cddl/contrib/opensolaris/common/unicode/u8_textprep.c @@ -23,7 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" /* @@ -143,10 +142,10 @@ #define U8_16BIT_TABLE_INDICATOR (0x8000U) /* The following are some convenience macros. */ -#define U8_PUT_3BYTES_INTO_UTF32(u, b1, b2, b3) \ - (u) = ((uint32_t)(b1) & 0x0F) << 12 | ((uint32_t)(b2) & 0x3F) << 6 | \ - (uint32_t)(b3) & 0x3F; - +#define U8_PUT_3BYTES_INTO_UTF32(u, b1, b2, b3) \ + (u) = ((((uint32_t)(b1) & 0x0F) << 12) | \ + (((uint32_t)(b2) & 0x3F) << 6) | \ + ((uint32_t)(b3) & 0x3F)); #define U8_SIMPLE_SWAP(a, b, t) \ (t) = (a); \ (a) = (b); \ @@ -216,10 +215,10 @@ const int8_t u8_number_of_bytes[0x100] = { /* 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F */ I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, -/* 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F */ +/* 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F */ I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, -/* A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF */ +/* A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF */ I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, /* B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF */ diff --git a/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c b/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c index 5aa9d2b8cb0..65d285893e9 100644 --- a/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c +++ b/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c @@ -23,6 +23,7 @@ * Copyright (c) 2013 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. + * Copyright (c) 2014, Nexenta Systems, Inc. All rights reserved. */ #ifdef _KERNEL @@ -168,7 +169,7 @@ zpool_feature_init(void) zfeature_register(SPA_FEATURE_LZ4_COMPRESS, "org.illumos:lz4_compress", "lz4_compress", "LZ4 compression algorithm support.", B_FALSE, B_FALSE, - B_FALSE, NULL); + B_TRUE, NULL); zfeature_register(SPA_FEATURE_MULTI_VDEV_CRASH_DUMP, "com.joyent:multi_vdev_crash_dump", "multi_vdev_crash_dump", @@ -214,4 +215,9 @@ zpool_feature_init(void) "com.joyent:filesystem_limits", "filesystem_limits", "Filesystem and snapshot limits.", B_TRUE, B_FALSE, B_FALSE, filesystem_limits_deps); + + zfeature_register(SPA_FEATURE_EMBEDDED_DATA, + "com.delphix:embedded_data", "embedded_data", + "Blocks which compress very well use even less space.", + B_FALSE, B_TRUE, B_TRUE, NULL); } diff --git a/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h b/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h index 1f668a5b565..65016f1b5e2 100644 --- a/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h +++ b/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h @@ -47,6 +47,7 @@ typedef enum spa_feature { SPA_FEATURE_ENABLED_TXG, SPA_FEATURE_HOLE_BIRTH, SPA_FEATURE_EXTENSIBLE_DATASET, + SPA_FEATURE_EMBEDDED_DATA, SPA_FEATURE_BOOKMARKS, SPA_FEATURE_FS_SS_LIMIT, SPA_FEATURES @@ -67,7 +68,7 @@ typedef struct zfeature_info { const spa_feature_t *fi_depends; } zfeature_info_t; -typedef int (zfeature_func_t)(zfeature_info_t *fi, void *arg); +typedef int (zfeature_func_t)(zfeature_info_t *, void *); #define ZFS_FEATURE_DEBUG @@ -76,8 +77,8 @@ extern zfeature_info_t spa_feature_table[SPA_FEATURES]; extern boolean_t zfeature_is_valid_guid(const char *); extern boolean_t zfeature_is_supported(const char *); -extern int zfeature_lookup_name(const char *name, spa_feature_t *res); -extern boolean_t zfeature_depends_on(spa_feature_t fid, spa_feature_t check); +extern int zfeature_lookup_name(const char *, spa_feature_t *); +extern boolean_t zfeature_depends_on(spa_feature_t, spa_feature_t); extern void zpool_feature_init(void); diff --git a/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c b/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c index d44d6f408e1..62fed7b6ef2 100644 --- a/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c +++ b/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c @@ -19,6 +19,7 @@ * CDDL HEADER END */ /* + * Copyright 2013 Xin Li . All rights reserved. * Copyright 2013 Martin Matuska . All rights reserved. * Portions Copyright 2005, 2010, Oracle and/or its affiliates. * All rights reserved. @@ -51,8 +52,63 @@ zfs_cmd_compat_get(zfs_cmd_t *zc, caddr_t addr, const int cflag) zfs_cmd_v15_t *zc_c; zfs_cmd_v28_t *zc28_c; zfs_cmd_deadman_t *zcdm_c; + zfs_cmd_zcmd_t *zcmd_c; switch (cflag) { + case ZFS_CMD_COMPAT_ZCMD: + zcmd_c = (void *)addr; + /* zc */ + strlcpy(zc->zc_name, zcmd_c->zc_name, MAXPATHLEN); + strlcpy(zc->zc_value, zcmd_c->zc_value, MAXPATHLEN * 2); + strlcpy(zc->zc_string, zcmd_c->zc_string, MAXPATHLEN); + +#define ZCMD_COPY(field) zc->field = zcmd_c->field + ZCMD_COPY(zc_nvlist_src); + ZCMD_COPY(zc_nvlist_src_size); + ZCMD_COPY(zc_nvlist_dst); + ZCMD_COPY(zc_nvlist_dst_size); + ZCMD_COPY(zc_nvlist_dst_filled); + ZCMD_COPY(zc_pad2); + ZCMD_COPY(zc_history); + ZCMD_COPY(zc_guid); + ZCMD_COPY(zc_nvlist_conf); + ZCMD_COPY(zc_nvlist_conf_size); + ZCMD_COPY(zc_cookie); + ZCMD_COPY(zc_objset_type); + ZCMD_COPY(zc_perm_action); + ZCMD_COPY(zc_history_len); + ZCMD_COPY(zc_history_offset); + ZCMD_COPY(zc_obj); + ZCMD_COPY(zc_iflags); + ZCMD_COPY(zc_share); + ZCMD_COPY(zc_jailid); + ZCMD_COPY(zc_objset_stats); + + /* + * zc_begin_record, zc_inject_record didn't change in embedeed-data + * block pointers + * + * TODO: CTASSERT? + */ + ZCMD_COPY(zc_begin_record); + ZCMD_COPY(zc_inject_record); + + /* boolean_t -> uint32_t */ + zc->zc_defer_destroy = (uint32_t)(zcmd_c->zc_defer_destroy); + zc->zc_flags = 0; + + ZCMD_COPY(zc_action_handle); + ZCMD_COPY(zc_cleanup_fd); + ZCMD_COPY(zc_simple); + bcopy(zcmd_c->zc_pad, zc->zc_pad, sizeof(zc->zc_pad)); + ZCMD_COPY(zc_sendobj); + ZCMD_COPY(zc_fromobj); + ZCMD_COPY(zc_createtxg); + ZCMD_COPY(zc_stat); +#undef ZCMD_COPY + + break; + case ZFS_CMD_COMPAT_DEADMAN: zcdm_c = (void *)addr; /* zc */ @@ -79,7 +135,7 @@ zfs_cmd_compat_get(zfs_cmd_t *zc, caddr_t addr, const int cflag) zc->zc_objset_stats = zcdm_c->zc_objset_stats; zc->zc_begin_record = zcdm_c->zc_begin_record; zc->zc_defer_destroy = zcdm_c->zc_defer_destroy; - zc->zc_temphold = zcdm_c->zc_temphold; + (void)zcdm_c->zc_temphold; zc->zc_action_handle = zcdm_c->zc_action_handle; zc->zc_cleanup_fd = zcdm_c->zc_cleanup_fd; zc->zc_simple = zcdm_c->zc_simple; @@ -94,7 +150,7 @@ zfs_cmd_compat_get(zfs_cmd_t *zc, caddr_t addr, const int cflag) /* we always assume zc_nvlist_dst_filled is true */ zc->zc_nvlist_dst_filled = B_TRUE; - break; + break; case ZFS_CMD_COMPAT_V28: zc28_c = (void *)addr; @@ -123,7 +179,7 @@ zfs_cmd_compat_get(zfs_cmd_t *zc, caddr_t addr, const int cflag) zc->zc_objset_stats = zc28_c->zc_objset_stats; zc->zc_begin_record = zc28_c->zc_begin_record; zc->zc_defer_destroy = zc28_c->zc_defer_destroy; - zc->zc_temphold = zc28_c->zc_temphold; + (void)zc28_c->zc_temphold; zc->zc_action_handle = zc28_c->zc_action_handle; zc->zc_cleanup_fd = zc28_c->zc_cleanup_fd; zc->zc_simple = zc28_c->zc_simple; @@ -224,8 +280,63 @@ zfs_cmd_compat_put(zfs_cmd_t *zc, caddr_t addr, const int request, zfs_cmd_v15_t *zc_c; zfs_cmd_v28_t *zc28_c; zfs_cmd_deadman_t *zcdm_c; + zfs_cmd_zcmd_t *zcmd_c; switch (cflag) { + case ZFS_CMD_COMPAT_ZCMD: + zcmd_c = (void *)addr; + /* zc */ + strlcpy(zcmd_c->zc_name, zc->zc_name, MAXPATHLEN); + strlcpy(zcmd_c->zc_value, zc->zc_value, MAXPATHLEN * 2); + strlcpy(zcmd_c->zc_string, zc->zc_string, MAXPATHLEN); + +#define ZCMD_COPY(field) zcmd_c->field = zc->field + ZCMD_COPY(zc_nvlist_src); + ZCMD_COPY(zc_nvlist_src_size); + ZCMD_COPY(zc_nvlist_dst); + ZCMD_COPY(zc_nvlist_dst_size); + ZCMD_COPY(zc_nvlist_dst_filled); + ZCMD_COPY(zc_pad2); + ZCMD_COPY(zc_history); + ZCMD_COPY(zc_guid); + ZCMD_COPY(zc_nvlist_conf); + ZCMD_COPY(zc_nvlist_conf_size); + ZCMD_COPY(zc_cookie); + ZCMD_COPY(zc_objset_type); + ZCMD_COPY(zc_perm_action); + ZCMD_COPY(zc_history_len); + ZCMD_COPY(zc_history_offset); + ZCMD_COPY(zc_obj); + ZCMD_COPY(zc_iflags); + ZCMD_COPY(zc_share); + ZCMD_COPY(zc_jailid); + ZCMD_COPY(zc_objset_stats); + + /* + * zc_begin_record, zc_inject_record didn't change in embedeed-data + * block pointers + * + * TODO: CTASSERT? + */ + ZCMD_COPY(zc_begin_record); + ZCMD_COPY(zc_inject_record); + + /* boolean_t -> uint32_t */ + zcmd_c->zc_defer_destroy = (uint32_t)(zc->zc_defer_destroy); + zcmd_c->zc_temphold = 0; + + ZCMD_COPY(zc_action_handle); + ZCMD_COPY(zc_cleanup_fd); + ZCMD_COPY(zc_simple); + bcopy(zc->zc_pad, zcmd_c->zc_pad, sizeof(zcmd_c->zc_pad)); + ZCMD_COPY(zc_sendobj); + ZCMD_COPY(zc_fromobj); + ZCMD_COPY(zc_createtxg); + ZCMD_COPY(zc_stat); +#undef ZCMD_COPY + + break; + case ZFS_CMD_COMPAT_DEADMAN: zcdm_c = (void *)addr; @@ -252,7 +363,7 @@ zfs_cmd_compat_put(zfs_cmd_t *zc, caddr_t addr, const int request, zcdm_c->zc_objset_stats = zc->zc_objset_stats; zcdm_c->zc_begin_record = zc->zc_begin_record; zcdm_c->zc_defer_destroy = zc->zc_defer_destroy; - zcdm_c->zc_temphold = zc->zc_temphold; + zcdm_c->zc_temphold = 0; zcdm_c->zc_action_handle = zc->zc_action_handle; zcdm_c->zc_cleanup_fd = zc->zc_cleanup_fd; zcdm_c->zc_simple = zc->zc_simple; @@ -270,7 +381,7 @@ zfs_cmd_compat_put(zfs_cmd_t *zc, caddr_t addr, const int request, zc->zc_value + strlen(zc->zc_value) + 1, (MAXPATHLEN * 2) - strlen(zc->zc_value) - 1); #endif - break; + break; case ZFS_CMD_COMPAT_V28: zc28_c = (void *)addr; @@ -298,7 +409,7 @@ zfs_cmd_compat_put(zfs_cmd_t *zc, caddr_t addr, const int request, zc28_c->zc_objset_stats = zc->zc_objset_stats; zc28_c->zc_begin_record = zc->zc_begin_record; zc28_c->zc_defer_destroy = zc->zc_defer_destroy; - zc28_c->zc_temphold = zc->zc_temphold; + zc28_c->zc_temphold = 0; zc28_c->zc_action_handle = zc->zc_action_handle; zc28_c->zc_cleanup_fd = zc->zc_cleanup_fd; zc28_c->zc_simple = zc->zc_simple; @@ -586,6 +697,12 @@ zcmd_ioctl_compat(int fd, int request, zfs_cmd_t *zc, const int cflag) zp.zfs_cmd_size = sizeof(zfs_cmd_t); zp.zfs_ioctl_version = ZFS_IOCVER_CURRENT; return (ioctl(fd, ncmd, &zp)); + case ZFS_CMD_COMPAT_ZCMD: + ncmd = _IOWR('Z', request, struct zfs_iocparm); + zp.zfs_cmd = (uint64_t)zc; + zp.zfs_cmd_size = sizeof(zfs_cmd_zcmd_t); + zp.zfs_ioctl_version = ZFS_IOCVER_ZCMD; + return (ioctl(fd, ncmd, &zp)); case ZFS_CMD_COMPAT_LZC: ncmd = _IOWR('Z', request, struct zfs_cmd); return (ioctl(fd, ncmd, zc)); @@ -683,7 +800,8 @@ zfs_ioctl_compat_innvl(zfs_cmd_t *zc, nvlist_t * innvl, const int vec, char *poolname, *snapname; int err; - if (cflag == ZFS_CMD_COMPAT_NONE || cflag == ZFS_CMD_COMPAT_LZC) + if (cflag == ZFS_CMD_COMPAT_NONE || cflag == ZFS_CMD_COMPAT_LZC || + cflag == ZFS_CMD_COMPAT_ZCMD) goto out; switch (vec) { @@ -834,7 +952,8 @@ zfs_ioctl_compat_outnvl(zfs_cmd_t *zc, nvlist_t * outnvl, const int vec, { nvlist_t *tmpnvl; - if (cflag == ZFS_CMD_COMPAT_NONE || cflag == ZFS_CMD_COMPAT_LZC) + if (cflag == ZFS_CMD_COMPAT_NONE || cflag == ZFS_CMD_COMPAT_LZC || + cflag == ZFS_CMD_COMPAT_ZCMD) return (outnvl); switch (vec) { diff --git a/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.h b/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.h index 6e8d51d3763..bdcac6f9c3b 100644 --- a/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.h +++ b/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.h @@ -19,6 +19,7 @@ * CDDL HEADER END */ /* + * Copyright 2014 Xin Li . All rights reserved. * Copyright 2013 Martin Matuska . All rights reserved. * Use is subject to license terms. */ @@ -50,7 +51,8 @@ extern "C" { #define ZFS_IOCVER_DEADMAN 1 #define ZFS_IOCVER_LZC 2 #define ZFS_IOCVER_ZCMD 3 -#define ZFS_IOCVER_CURRENT ZFS_IOCVER_ZCMD +#define ZFS_IOCVER_EDBP 4 +#define ZFS_IOCVER_CURRENT ZFS_IOCVER_EDBP /* compatibility conversion flag */ #define ZFS_CMD_COMPAT_NONE 0 @@ -58,6 +60,7 @@ extern "C" { #define ZFS_CMD_COMPAT_V28 2 #define ZFS_CMD_COMPAT_DEADMAN 3 #define ZFS_CMD_COMPAT_LZC 4 +#define ZFS_CMD_COMPAT_ZCMD 5 #define ZFS_IOC_COMPAT_PASS 254 #define ZFS_IOC_COMPAT_FAIL 255 @@ -200,6 +203,49 @@ typedef struct zfs_cmd_deadman { zfs_stat_t zc_stat; } zfs_cmd_deadman_t; +typedef struct zfs_cmd_zcmd { + char zc_name[MAXPATHLEN]; /* name of pool or dataset */ + uint64_t zc_nvlist_src; /* really (char *) */ + uint64_t zc_nvlist_src_size; + uint64_t zc_nvlist_dst; /* really (char *) */ + uint64_t zc_nvlist_dst_size; + boolean_t zc_nvlist_dst_filled; /* put an nvlist in dst? */ + int zc_pad2; + + /* + * The following members are for legacy ioctls which haven't been + * converted to the new method. + */ + uint64_t zc_history; /* really (char *) */ + char zc_value[MAXPATHLEN * 2]; + char zc_string[MAXNAMELEN]; + uint64_t zc_guid; + uint64_t zc_nvlist_conf; /* really (char *) */ + uint64_t zc_nvlist_conf_size; + uint64_t zc_cookie; + uint64_t zc_objset_type; + uint64_t zc_perm_action; + uint64_t zc_history_len; + uint64_t zc_history_offset; + uint64_t zc_obj; + uint64_t zc_iflags; /* internal to zfs(7fs) */ + zfs_share_t zc_share; + uint64_t zc_jailid; + dmu_objset_stats_t zc_objset_stats; + struct drr_begin zc_begin_record; + zinject_record_t zc_inject_record; + boolean_t zc_defer_destroy; + boolean_t zc_temphold; + uint64_t zc_action_handle; + int zc_cleanup_fd; + uint8_t zc_simple; + uint8_t zc_pad[3]; /* alignment */ + uint64_t zc_sendobj; + uint64_t zc_fromobj; + uint64_t zc_createtxg; + zfs_stat_t zc_stat; +} zfs_cmd_zcmd_t; + #ifdef _KERNEL unsigned static long zfs_ioctl_v15_to_v28[] = { 0, /* 0 ZFS_IOC_POOL_CREATE */ diff --git a/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c b/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c index 141e2266367..bd023c70ef4 100644 --- a/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c +++ b/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. */ @@ -206,7 +206,18 @@ zfs_prop_init(void) { NULL } }; + static zprop_index_t redundant_metadata_table[] = { + { "all", ZFS_REDUNDANT_METADATA_ALL }, + { "most", ZFS_REDUNDANT_METADATA_MOST }, + { NULL } + }; + /* inherit index properties */ + zprop_register_index(ZFS_PROP_REDUNDANT_METADATA, "redundant_metadata", + ZFS_REDUNDANT_METADATA_ALL, + PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME, + "all | most", "REDUND_MD", + redundant_metadata_table); zprop_register_index(ZFS_PROP_SYNC, "sync", ZFS_SYNC_STANDARD, PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME, "standard | always | disabled", "SYNC", @@ -424,6 +435,8 @@ zfs_prop_init(void) PROP_READONLY, ZFS_TYPE_DATASET, "OBJSETID"); zprop_register_hidden(ZFS_PROP_INCONSISTENT, "inconsistent", PROP_TYPE_NUMBER, PROP_READONLY, ZFS_TYPE_DATASET, "INCONSISTENT"); + zprop_register_hidden(ZFS_PROP_PREV_SNAP, "prevsnap", PROP_TYPE_STRING, + PROP_READONLY, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME, "PREVSNAP"); /* oddball properties */ zprop_register_impl(ZFS_PROP_CREATION, "creation", PROP_TYPE_NUMBER, 0, diff --git a/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c b/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c index 72db8793711..a400f821e2e 100644 --- a/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c +++ b/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #include @@ -81,10 +81,14 @@ zpool_prop_init(void) ZFS_TYPE_POOL, "", "FREE"); zprop_register_number(ZPOOL_PROP_FREEING, "freeing", 0, PROP_READONLY, ZFS_TYPE_POOL, "", "FREEING"); + zprop_register_number(ZPOOL_PROP_LEAKED, "leaked", 0, PROP_READONLY, + ZFS_TYPE_POOL, "", "LEAKED"); zprop_register_number(ZPOOL_PROP_ALLOCATED, "allocated", 0, PROP_READONLY, ZFS_TYPE_POOL, "", "ALLOC"); zprop_register_number(ZPOOL_PROP_EXPANDSZ, "expandsize", 0, PROP_READONLY, ZFS_TYPE_POOL, "", "EXPANDSZ"); + zprop_register_number(ZPOOL_PROP_FRAGMENTATION, "fragmentation", 0, + PROP_READONLY, ZFS_TYPE_POOL, "", "FRAG"); zprop_register_number(ZPOOL_PROP_CAPACITY, "capacity", 0, PROP_READONLY, ZFS_TYPE_POOL, "", "CAP"); zprop_register_number(ZPOOL_PROP_GUID, "guid", 0, PROP_READONLY, diff --git a/sys/cddl/contrib/opensolaris/uts/common/Makefile.files b/sys/cddl/contrib/opensolaris/uts/common/Makefile.files index a652218b99e..4c7e225f0d3 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/Makefile.files +++ b/sys/cddl/contrib/opensolaris/uts/common/Makefile.files @@ -33,6 +33,7 @@ ZFS_COMMON_OBJS += \ arc.o \ bplist.o \ + blkptr.o \ bpobj.o \ bptree.o \ dbuf.o \ diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c index 73e404c7353..7855f91d4a2 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c @@ -22,13 +22,11 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * DTrace - Dynamic Tracing for Solaris * @@ -111,6 +109,7 @@ #include #include #include +#include "strtolctype.h" /* FreeBSD includes: */ #if !defined(sun) @@ -219,6 +218,7 @@ static dtrace_provider_t *dtrace_provider; /* provider list */ static dtrace_meta_t *dtrace_meta_pid; /* user-land meta provider */ static int dtrace_opens; /* number of opens */ static int dtrace_helpers; /* number of helpers */ +static int dtrace_getf; /* number of unpriv getf()s */ #if defined(sun) static void *dtrace_softstate; /* softstate pointer */ #endif @@ -236,7 +236,9 @@ static dtrace_ecb_t *dtrace_ecb_create_cache; /* cached created ECB */ static dtrace_genid_t dtrace_probegen; /* current probe generation */ static dtrace_helpers_t *dtrace_deferred_pid; /* deferred helper list */ static dtrace_enabling_t *dtrace_retained; /* list of retained enablings */ +static dtrace_genid_t dtrace_retained_gen; /* current retained enab gen */ static dtrace_dynvar_t dtrace_dynhash_sink; /* end of dynamic hash chains */ +static int dtrace_dynvar_failclean; /* dynvars failed to clean */ #if !defined(sun) static struct mtx dtrace_unr_mtx; MTX_SYSINIT(dtrace_unr_mtx, &dtrace_unr_mtx, "Unique resource identifier", MTX_DEF); @@ -468,8 +470,8 @@ static kmutex_t dtrace_errlock; * disallow all negative sizes. Ranges of size 0 are allowed. */ #define DTRACE_INRANGE(testaddr, testsz, baseaddr, basesz) \ - ((testaddr) - (baseaddr) < (basesz) && \ - (testaddr) + (testsz) - (baseaddr) <= (basesz) && \ + ((testaddr) - (uintptr_t)(baseaddr) < (basesz) && \ + (testaddr) + (testsz) - (uintptr_t)(baseaddr) <= (basesz) && \ (testaddr) + (testsz) >= (testaddr)) /* @@ -578,6 +580,8 @@ void dtrace_dynvar_clean(dtrace_dstate_t *); dtrace_dynvar_t *dtrace_dynvar(dtrace_dstate_t *, uint_t, dtrace_key_t *, size_t, dtrace_dynvar_op_t, dtrace_mstate_t *, dtrace_vstate_t *); uintptr_t dtrace_dif_varstr(uintptr_t, dtrace_state_t *, dtrace_mstate_t *); +static int dtrace_priv_proc(dtrace_state_t *); +static void dtrace_getf_barrier(void); /* * DTrace Probe Context Functions @@ -722,7 +726,7 @@ dtrace_canstore(uint64_t addr, size_t sz, dtrace_mstate_t *mstate, * up both thread-local variables and any global dynamically-allocated * variables. */ - if (DTRACE_INRANGE(addr, sz, (uintptr_t)vstate->dtvs_dynvars.dtds_base, + if (DTRACE_INRANGE(addr, sz, vstate->dtvs_dynvars.dtds_base, vstate->dtvs_dynvars.dtds_size)) { dtrace_dstate_t *dstate = &vstate->dtvs_dynvars; uintptr_t base = (uintptr_t)dstate->dtds_base + @@ -789,6 +793,7 @@ dtrace_canload(uint64_t addr, size_t sz, dtrace_mstate_t *mstate, dtrace_vstate_t *vstate) { volatile uintptr_t *illval = &cpu_core[curcpu].cpuc_dtrace_illval; + file_t *fp; /* * If we hold the privilege to read from kernel memory, then @@ -806,10 +811,104 @@ dtrace_canload(uint64_t addr, size_t sz, dtrace_mstate_t *mstate, /* * We're allowed to read from our own string table. */ - if (DTRACE_INRANGE(addr, sz, (uintptr_t)mstate->dtms_difo->dtdo_strtab, + if (DTRACE_INRANGE(addr, sz, mstate->dtms_difo->dtdo_strtab, mstate->dtms_difo->dtdo_strlen)) return (1); + if (vstate->dtvs_state != NULL && + dtrace_priv_proc(vstate->dtvs_state)) { + proc_t *p; + + /* + * When we have privileges to the current process, there are + * several context-related kernel structures that are safe to + * read, even absent the privilege to read from kernel memory. + * These reads are safe because these structures contain only + * state that (1) we're permitted to read, (2) is harmless or + * (3) contains pointers to additional kernel state that we're + * not permitted to read (and as such, do not present an + * opportunity for privilege escalation). Finally (and + * critically), because of the nature of their relation with + * the current thread context, the memory associated with these + * structures cannot change over the duration of probe context, + * and it is therefore impossible for this memory to be + * deallocated and reallocated as something else while it's + * being operated upon. + */ + if (DTRACE_INRANGE(addr, sz, curthread, sizeof (kthread_t))) + return (1); + + if ((p = curthread->t_procp) != NULL && DTRACE_INRANGE(addr, + sz, curthread->t_procp, sizeof (proc_t))) { + return (1); + } + + if (curthread->t_cred != NULL && DTRACE_INRANGE(addr, sz, + curthread->t_cred, sizeof (cred_t))) { + return (1); + } + +#if defined(sun) + if (p != NULL && p->p_pidp != NULL && DTRACE_INRANGE(addr, sz, + &(p->p_pidp->pid_id), sizeof (pid_t))) { + return (1); + } + + if (curthread->t_cpu != NULL && DTRACE_INRANGE(addr, sz, + curthread->t_cpu, offsetof(cpu_t, cpu_pause_thread))) { + return (1); + } +#endif + } + + if ((fp = mstate->dtms_getf) != NULL) { + uintptr_t psz = sizeof (void *); + vnode_t *vp; + vnodeops_t *op; + + /* + * When getf() returns a file_t, the enabling is implicitly + * granted the (transient) right to read the returned file_t + * as well as the v_path and v_op->vnop_name of the underlying + * vnode. These accesses are allowed after a successful + * getf() because the members that they refer to cannot change + * once set -- and the barrier logic in the kernel's closef() + * path assures that the file_t and its referenced vode_t + * cannot themselves be stale (that is, it impossible for + * either dtms_getf itself or its f_vnode member to reference + * freed memory). + */ + if (DTRACE_INRANGE(addr, sz, fp, sizeof (file_t))) + return (1); + + if ((vp = fp->f_vnode) != NULL) { +#if defined(sun) + if (DTRACE_INRANGE(addr, sz, &vp->v_path, psz)) + return (1); + if (vp->v_path != NULL && DTRACE_INRANGE(addr, sz, + vp->v_path, strlen(vp->v_path) + 1)) { + return (1); + } +#endif + + if (DTRACE_INRANGE(addr, sz, &vp->v_op, psz)) + return (1); + +#if defined(sun) + if ((op = vp->v_op) != NULL && + DTRACE_INRANGE(addr, sz, &op->vnop_name, psz)) { + return (1); + } + + if (op != NULL && op->vnop_name != NULL && + DTRACE_INRANGE(addr, sz, op->vnop_name, + strlen(op->vnop_name) + 1)) { + return (1); + } +#endif + } + } + DTRACE_CPUFLAG_SET(CPU_DTRACE_KPRIV); *illval = addr; return (0); @@ -868,6 +967,58 @@ dtrace_vcanload(void *src, dtrace_diftype_t *type, dtrace_mstate_t *mstate, return (dtrace_canload((uintptr_t)src, sz, mstate, vstate)); } +/* + * Convert a string to a signed integer using safe loads. + * + * NOTE: This function uses various macros from strtolctype.h to manipulate + * digit values, etc -- these have all been checked to ensure they make + * no additional function calls. + */ +static int64_t +dtrace_strtoll(char *input, int base, size_t limit) +{ + uintptr_t pos = (uintptr_t)input; + int64_t val = 0; + int x; + boolean_t neg = B_FALSE; + char c, cc, ccc; + uintptr_t end = pos + limit; + + /* + * Consume any whitespace preceding digits. + */ + while ((c = dtrace_load8(pos)) == ' ' || c == '\t') + pos++; + + /* + * Handle an explicit sign if one is present. + */ + if (c == '-' || c == '+') { + if (c == '-') + neg = B_TRUE; + c = dtrace_load8(++pos); + } + + /* + * Check for an explicit hexadecimal prefix ("0x" or "0X") and skip it + * if present. + */ + if (base == 16 && c == '0' && ((cc = dtrace_load8(pos + 1)) == 'x' || + cc == 'X') && isxdigit(ccc = dtrace_load8(pos + 2))) { + pos += 2; + c = ccc; + } + + /* + * Read in contiguous digits until the first non-digit character. + */ + for (; pos < end && c != '\0' && lisalnum(c) && (x = DIGIT(c)) < base; + c = dtrace_load8(++pos)) + val = val * base + x; + + return (neg ? -val : val); +} + /* * Compare two strings using safe loads. */ @@ -1189,8 +1340,7 @@ dtrace_priv_proc_common_zone(dtrace_state_t *state) */ ASSERT(s_cr != NULL); - if ((cr = CRED()) != NULL && - s_cr->cr_zone == cr->cr_zone) + if ((cr = CRED()) != NULL && s_cr->cr_zone == cr->cr_zone) return (1); return (0); @@ -1289,6 +1439,115 @@ dtrace_priv_kernel_destructive(dtrace_state_t *state) return (0); } +/* + * Determine if the dte_cond of the specified ECB allows for processing of + * the current probe to continue. Note that this routine may allow continued + * processing, but with access(es) stripped from the mstate's dtms_access + * field. + */ +static int +dtrace_priv_probe(dtrace_state_t *state, dtrace_mstate_t *mstate, + dtrace_ecb_t *ecb) +{ + dtrace_probe_t *probe = ecb->dte_probe; + dtrace_provider_t *prov = probe->dtpr_provider; + dtrace_pops_t *pops = &prov->dtpv_pops; + int mode = DTRACE_MODE_NOPRIV_DROP; + + ASSERT(ecb->dte_cond); + +#if defined(sun) + if (pops->dtps_mode != NULL) { + mode = pops->dtps_mode(prov->dtpv_arg, + probe->dtpr_id, probe->dtpr_arg); + + ASSERT((mode & DTRACE_MODE_USER) || + (mode & DTRACE_MODE_KERNEL)); + ASSERT((mode & DTRACE_MODE_NOPRIV_RESTRICT) || + (mode & DTRACE_MODE_NOPRIV_DROP)); + } + + /* + * If the dte_cond bits indicate that this consumer is only allowed to + * see user-mode firings of this probe, call the provider's dtps_mode() + * entry point to check that the probe was fired while in a user + * context. If that's not the case, use the policy specified by the + * provider to determine if we drop the probe or merely restrict + * operation. + */ + if (ecb->dte_cond & DTRACE_COND_USERMODE) { + ASSERT(mode != DTRACE_MODE_NOPRIV_DROP); + + if (!(mode & DTRACE_MODE_USER)) { + if (mode & DTRACE_MODE_NOPRIV_DROP) + return (0); + + mstate->dtms_access &= ~DTRACE_ACCESS_ARGS; + } + } +#endif + + /* + * This is more subtle than it looks. We have to be absolutely certain + * that CRED() isn't going to change out from under us so it's only + * legit to examine that structure if we're in constrained situations. + * Currently, the only times we'll this check is if a non-super-user + * has enabled the profile or syscall providers -- providers that + * allow visibility of all processes. For the profile case, the check + * above will ensure that we're examining a user context. + */ + if (ecb->dte_cond & DTRACE_COND_OWNER) { + cred_t *cr; + cred_t *s_cr = state->dts_cred.dcr_cred; + proc_t *proc; + + ASSERT(s_cr != NULL); + + if ((cr = CRED()) == NULL || + s_cr->cr_uid != cr->cr_uid || + s_cr->cr_uid != cr->cr_ruid || + s_cr->cr_uid != cr->cr_suid || + s_cr->cr_gid != cr->cr_gid || + s_cr->cr_gid != cr->cr_rgid || + s_cr->cr_gid != cr->cr_sgid || + (proc = ttoproc(curthread)) == NULL || + (proc->p_flag & SNOCD)) { + if (mode & DTRACE_MODE_NOPRIV_DROP) + return (0); + +#if defined(sun) + mstate->dtms_access &= ~DTRACE_ACCESS_PROC; +#endif + } + } + +#if defined(sun) + /* + * If our dte_cond is set to DTRACE_COND_ZONEOWNER and we are not + * in our zone, check to see if our mode policy is to restrict rather + * than to drop; if to restrict, strip away both DTRACE_ACCESS_PROC + * and DTRACE_ACCESS_ARGS + */ + if (ecb->dte_cond & DTRACE_COND_ZONEOWNER) { + cred_t *cr; + cred_t *s_cr = state->dts_cred.dcr_cred; + + ASSERT(s_cr != NULL); + + if ((cr = CRED()) == NULL || + s_cr->cr_zone->zone_id != cr->cr_zone->zone_id) { + if (mode & DTRACE_MODE_NOPRIV_DROP) + return (0); + + mstate->dtms_access &= + ~(DTRACE_ACCESS_PROC | DTRACE_ACCESS_ARGS); + } + } +#endif + + return (1); +} + /* * Note: not called from probe context. This function is called * asynchronously (and at a regular interval) from outside of probe context to @@ -1300,12 +1559,12 @@ dtrace_dynvar_clean(dtrace_dstate_t *dstate) { dtrace_dynvar_t *dirty; dtrace_dstate_percpu_t *dcpu; - int i, work = 0; + dtrace_dynvar_t **rinsep; + int i, j, work = 0; for (i = 0; i < NCPU; i++) { dcpu = &dstate->dtds_percpu[i]; - - ASSERT(dcpu->dtdsc_rinsing == NULL); + rinsep = &dcpu->dtdsc_rinsing; /* * If the dirty list is NULL, there is no dirty work to do. @@ -1313,14 +1572,62 @@ dtrace_dynvar_clean(dtrace_dstate_t *dstate) if (dcpu->dtdsc_dirty == NULL) continue; - /* - * If the clean list is non-NULL, then we're not going to do - * any work for this CPU -- it means that there has not been - * a dtrace_dynvar() allocation on this CPU (or from this CPU) - * since the last time we cleaned house. - */ - if (dcpu->dtdsc_clean != NULL) + if (dcpu->dtdsc_rinsing != NULL) { + /* + * If the rinsing list is non-NULL, then it is because + * this CPU was selected to accept another CPU's + * dirty list -- and since that time, dirty buffers + * have accumulated. This is a highly unlikely + * condition, but we choose to ignore the dirty + * buffers -- they'll be picked up a future cleanse. + */ continue; + } + + if (dcpu->dtdsc_clean != NULL) { + /* + * If the clean list is non-NULL, then we're in a + * situation where a CPU has done deallocations (we + * have a non-NULL dirty list) but no allocations (we + * also have a non-NULL clean list). We can't simply + * move the dirty list into the clean list on this + * CPU, yet we also don't want to allow this condition + * to persist, lest a short clean list prevent a + * massive dirty list from being cleaned (which in + * turn could lead to otherwise avoidable dynamic + * drops). To deal with this, we look for some CPU + * with a NULL clean list, NULL dirty list, and NULL + * rinsing list -- and then we borrow this CPU to + * rinse our dirty list. + */ + for (j = 0; j < NCPU; j++) { + dtrace_dstate_percpu_t *rinser; + + rinser = &dstate->dtds_percpu[j]; + + if (rinser->dtdsc_rinsing != NULL) + continue; + + if (rinser->dtdsc_dirty != NULL) + continue; + + if (rinser->dtdsc_clean != NULL) + continue; + + rinsep = &rinser->dtdsc_rinsing; + break; + } + + if (j == NCPU) { + /* + * We were unable to find another CPU that + * could accept this dirty list -- we are + * therefore unable to clean it now. + */ + dtrace_dynvar_failclean++; + continue; + } + } work = 1; @@ -1337,7 +1644,7 @@ dtrace_dynvar_clean(dtrace_dstate_t *dstate) * on a hash chain, either the dirty list or the * rinsing list for some CPU must be non-NULL.) */ - dcpu->dtdsc_rinsing = dirty; + *rinsep = dirty; dtrace_membar_producer(); } while (dtrace_casptr(&dcpu->dtdsc_dirty, dirty, NULL) != dirty); @@ -1768,7 +2075,7 @@ dtrace_dynvar(dtrace_dstate_t *dstate, uint_t nkeys, ASSERT(clean->dtdv_hashval == DTRACE_DYNHASH_FREE); /* - * Now we'll move the clean list to the free list. + * Now we'll move the clean list to our free list. * It's impossible for this to fail: the only way * the free list can be updated is through this * code path, and only one CPU can own the clean list. @@ -1781,6 +2088,7 @@ dtrace_dynvar(dtrace_dstate_t *dstate, uint_t nkeys, * owners of the clean lists out before resetting * the clean lists. */ + dcpu = &dstate->dtds_percpu[me]; rval = dtrace_casptr(&dcpu->dtdsc_free, NULL, clean); ASSERT(rval == NULL); goto retry; @@ -2907,7 +3215,7 @@ dtrace_dif_variable(dtrace_mstate_t *mstate, dtrace_state_t *state, uint64_t v, #endif case DIF_VAR_CURTHREAD: - if (!dtrace_priv_kernel(state)) + if (!dtrace_priv_proc(state)) return (0); return ((uint64_t)(uintptr_t)curthread); @@ -3263,6 +3571,463 @@ dtrace_dif_variable(dtrace_mstate_t *mstate, dtrace_state_t *state, uint64_t v, } } + +typedef enum dtrace_json_state { + DTRACE_JSON_REST = 1, + DTRACE_JSON_OBJECT, + DTRACE_JSON_STRING, + DTRACE_JSON_STRING_ESCAPE, + DTRACE_JSON_STRING_ESCAPE_UNICODE, + DTRACE_JSON_COLON, + DTRACE_JSON_COMMA, + DTRACE_JSON_VALUE, + DTRACE_JSON_IDENTIFIER, + DTRACE_JSON_NUMBER, + DTRACE_JSON_NUMBER_FRAC, + DTRACE_JSON_NUMBER_EXP, + DTRACE_JSON_COLLECT_OBJECT +} dtrace_json_state_t; + +/* + * This function possesses just enough knowledge about JSON to extract a single + * value from a JSON string and store it in the scratch buffer. It is able + * to extract nested object values, and members of arrays by index. + * + * elemlist is a list of JSON keys, stored as packed NUL-terminated strings, to + * be looked up as we descend into the object tree. e.g. + * + * foo[0].bar.baz[32] --> "foo" NUL "0" NUL "bar" NUL "baz" NUL "32" NUL + * with nelems = 5. + * + * The run time of this function must be bounded above by strsize to limit the + * amount of work done in probe context. As such, it is implemented as a + * simple state machine, reading one character at a time using safe loads + * until we find the requested element, hit a parsing error or run off the + * end of the object or string. + * + * As there is no way for a subroutine to return an error without interrupting + * clause execution, we simply return NULL in the event of a missing key or any + * other error condition. Each NULL return in this function is commented with + * the error condition it represents -- parsing or otherwise. + * + * The set of states for the state machine closely matches the JSON + * specification (http://json.org/). Briefly: + * + * DTRACE_JSON_REST: + * Skip whitespace until we find either a top-level Object, moving + * to DTRACE_JSON_OBJECT; or an Array, moving to DTRACE_JSON_VALUE. + * + * DTRACE_JSON_OBJECT: + * Locate the next key String in an Object. Sets a flag to denote + * the next String as a key string and moves to DTRACE_JSON_STRING. + * + * DTRACE_JSON_COLON: + * Skip whitespace until we find the colon that separates key Strings + * from their values. Once found, move to DTRACE_JSON_VALUE. + * + * DTRACE_JSON_VALUE: + * Detects the type of the next value (String, Number, Identifier, Object + * or Array) and routes to the states that process that type. Here we also + * deal with the element selector list if we are requested to traverse down + * into the object tree. + * + * DTRACE_JSON_COMMA: + * Skip whitespace until we find the comma that separates key-value pairs + * in Objects (returning to DTRACE_JSON_OBJECT) or values in Arrays + * (similarly DTRACE_JSON_VALUE). All following literal value processing + * states return to this state at the end of their value, unless otherwise + * noted. + * + * DTRACE_JSON_NUMBER, DTRACE_JSON_NUMBER_FRAC, DTRACE_JSON_NUMBER_EXP: + * Processes a Number literal from the JSON, including any exponent + * component that may be present. Numbers are returned as strings, which + * may be passed to strtoll() if an integer is required. + * + * DTRACE_JSON_IDENTIFIER: + * Processes a "true", "false" or "null" literal in the JSON. + * + * DTRACE_JSON_STRING, DTRACE_JSON_STRING_ESCAPE, + * DTRACE_JSON_STRING_ESCAPE_UNICODE: + * Processes a String literal from the JSON, whether the String denotes + * a key, a value or part of a larger Object. Handles all escape sequences + * present in the specification, including four-digit unicode characters, + * but merely includes the escape sequence without converting it to the + * actual escaped character. If the String is flagged as a key, we + * move to DTRACE_JSON_COLON rather than DTRACE_JSON_COMMA. + * + * DTRACE_JSON_COLLECT_OBJECT: + * This state collects an entire Object (or Array), correctly handling + * embedded strings. If the full element selector list matches this nested + * object, we return the Object in full as a string. If not, we use this + * state to skip to the next value at this level and continue processing. + * + * NOTE: This function uses various macros from strtolctype.h to manipulate + * digit values, etc -- these have all been checked to ensure they make + * no additional function calls. + */ +static char * +dtrace_json(uint64_t size, uintptr_t json, char *elemlist, int nelems, + char *dest) +{ + dtrace_json_state_t state = DTRACE_JSON_REST; + int64_t array_elem = INT64_MIN; + int64_t array_pos = 0; + uint8_t escape_unicount = 0; + boolean_t string_is_key = B_FALSE; + boolean_t collect_object = B_FALSE; + boolean_t found_key = B_FALSE; + boolean_t in_array = B_FALSE; + uint32_t braces = 0, brackets = 0; + char *elem = elemlist; + char *dd = dest; + uintptr_t cur; + + for (cur = json; cur < json + size; cur++) { + char cc = dtrace_load8(cur); + if (cc == '\0') + return (NULL); + + switch (state) { + case DTRACE_JSON_REST: + if (isspace(cc)) + break; + + if (cc == '{') { + state = DTRACE_JSON_OBJECT; + break; + } + + if (cc == '[') { + in_array = B_TRUE; + array_pos = 0; + array_elem = dtrace_strtoll(elem, 10, size); + found_key = array_elem == 0 ? B_TRUE : B_FALSE; + state = DTRACE_JSON_VALUE; + break; + } + + /* + * ERROR: expected to find a top-level object or array. + */ + return (NULL); + case DTRACE_JSON_OBJECT: + if (isspace(cc)) + break; + + if (cc == '"') { + state = DTRACE_JSON_STRING; + string_is_key = B_TRUE; + break; + } + + /* + * ERROR: either the object did not start with a key + * string, or we've run off the end of the object + * without finding the requested key. + */ + return (NULL); + case DTRACE_JSON_STRING: + if (cc == '\\') { + *dd++ = '\\'; + state = DTRACE_JSON_STRING_ESCAPE; + break; + } + + if (cc == '"') { + if (collect_object) { + /* + * We don't reset the dest here, as + * the string is part of a larger + * object being collected. + */ + *dd++ = cc; + collect_object = B_FALSE; + state = DTRACE_JSON_COLLECT_OBJECT; + break; + } + *dd = '\0'; + dd = dest; /* reset string buffer */ + if (string_is_key) { + if (dtrace_strncmp(dest, elem, + size) == 0) + found_key = B_TRUE; + } else if (found_key) { + if (nelems > 1) { + /* + * We expected an object, not + * this string. + */ + return (NULL); + } + return (dest); + } + state = string_is_key ? DTRACE_JSON_COLON : + DTRACE_JSON_COMMA; + string_is_key = B_FALSE; + break; + } + + *dd++ = cc; + break; + case DTRACE_JSON_STRING_ESCAPE: + *dd++ = cc; + if (cc == 'u') { + escape_unicount = 0; + state = DTRACE_JSON_STRING_ESCAPE_UNICODE; + } else { + state = DTRACE_JSON_STRING; + } + break; + case DTRACE_JSON_STRING_ESCAPE_UNICODE: + if (!isxdigit(cc)) { + /* + * ERROR: invalid unicode escape, expected + * four valid hexidecimal digits. + */ + return (NULL); + } + + *dd++ = cc; + if (++escape_unicount == 4) + state = DTRACE_JSON_STRING; + break; + case DTRACE_JSON_COLON: + if (isspace(cc)) + break; + + if (cc == ':') { + state = DTRACE_JSON_VALUE; + break; + } + + /* + * ERROR: expected a colon. + */ + return (NULL); + case DTRACE_JSON_COMMA: + if (isspace(cc)) + break; + + if (cc == ',') { + if (in_array) { + state = DTRACE_JSON_VALUE; + if (++array_pos == array_elem) + found_key = B_TRUE; + } else { + state = DTRACE_JSON_OBJECT; + } + break; + } + + /* + * ERROR: either we hit an unexpected character, or + * we reached the end of the object or array without + * finding the requested key. + */ + return (NULL); + case DTRACE_JSON_IDENTIFIER: + if (islower(cc)) { + *dd++ = cc; + break; + } + + *dd = '\0'; + dd = dest; /* reset string buffer */ + + if (dtrace_strncmp(dest, "true", 5) == 0 || + dtrace_strncmp(dest, "false", 6) == 0 || + dtrace_strncmp(dest, "null", 5) == 0) { + if (found_key) { + if (nelems > 1) { + /* + * ERROR: We expected an object, + * not this identifier. + */ + return (NULL); + } + return (dest); + } else { + cur--; + state = DTRACE_JSON_COMMA; + break; + } + } + + /* + * ERROR: we did not recognise the identifier as one + * of those in the JSON specification. + */ + return (NULL); + case DTRACE_JSON_NUMBER: + if (cc == '.') { + *dd++ = cc; + state = DTRACE_JSON_NUMBER_FRAC; + break; + } + + if (cc == 'x' || cc == 'X') { + /* + * ERROR: specification explicitly excludes + * hexidecimal or octal numbers. + */ + return (NULL); + } + + /* FALLTHRU */ + case DTRACE_JSON_NUMBER_FRAC: + if (cc == 'e' || cc == 'E') { + *dd++ = cc; + state = DTRACE_JSON_NUMBER_EXP; + break; + } + + if (cc == '+' || cc == '-') { + /* + * ERROR: expect sign as part of exponent only. + */ + return (NULL); + } + /* FALLTHRU */ + case DTRACE_JSON_NUMBER_EXP: + if (isdigit(cc) || cc == '+' || cc == '-') { + *dd++ = cc; + break; + } + + *dd = '\0'; + dd = dest; /* reset string buffer */ + if (found_key) { + if (nelems > 1) { + /* + * ERROR: We expected an object, not + * this number. + */ + return (NULL); + } + return (dest); + } + + cur--; + state = DTRACE_JSON_COMMA; + break; + case DTRACE_JSON_VALUE: + if (isspace(cc)) + break; + + if (cc == '{' || cc == '[') { + if (nelems > 1 && found_key) { + in_array = cc == '[' ? B_TRUE : B_FALSE; + /* + * If our element selector directs us + * to descend into this nested object, + * then move to the next selector + * element in the list and restart the + * state machine. + */ + while (*elem != '\0') + elem++; + elem++; /* skip the inter-element NUL */ + nelems--; + dd = dest; + if (in_array) { + state = DTRACE_JSON_VALUE; + array_pos = 0; + array_elem = dtrace_strtoll( + elem, 10, size); + found_key = array_elem == 0 ? + B_TRUE : B_FALSE; + } else { + found_key = B_FALSE; + state = DTRACE_JSON_OBJECT; + } + break; + } + + /* + * Otherwise, we wish to either skip this + * nested object or return it in full. + */ + if (cc == '[') + brackets = 1; + else + braces = 1; + *dd++ = cc; + state = DTRACE_JSON_COLLECT_OBJECT; + break; + } + + if (cc == '"') { + state = DTRACE_JSON_STRING; + break; + } + + if (islower(cc)) { + /* + * Here we deal with true, false and null. + */ + *dd++ = cc; + state = DTRACE_JSON_IDENTIFIER; + break; + } + + if (cc == '-' || isdigit(cc)) { + *dd++ = cc; + state = DTRACE_JSON_NUMBER; + break; + } + + /* + * ERROR: unexpected character at start of value. + */ + return (NULL); + case DTRACE_JSON_COLLECT_OBJECT: + if (cc == '\0') + /* + * ERROR: unexpected end of input. + */ + return (NULL); + + *dd++ = cc; + if (cc == '"') { + collect_object = B_TRUE; + state = DTRACE_JSON_STRING; + break; + } + + if (cc == ']') { + if (brackets-- == 0) { + /* + * ERROR: unbalanced brackets. + */ + return (NULL); + } + } else if (cc == '}') { + if (braces-- == 0) { + /* + * ERROR: unbalanced braces. + */ + return (NULL); + } + } else if (cc == '{') { + braces++; + } else if (cc == '[') { + brackets++; + } + + if (brackets == 0 && braces == 0) { + if (found_key) { + *dd = '\0'; + return (dest); + } + dd = dest; /* reset string buffer */ + state = DTRACE_JSON_COMMA; + } + break; + } + } + return (NULL); +} + /* * Emulate the execution of DTrace ID subroutines invoked by the call opcode. * Notice that we don't bother validating the proper number of arguments or @@ -4014,7 +4779,7 @@ dtrace_dif_subr(uint_t subr, uint_t rd, uint64_t *regs, int64_t index = (int64_t)tupregs[1].dttk_value; int64_t remaining = (int64_t)tupregs[2].dttk_value; size_t len = dtrace_strlen((char *)s, size); - int64_t i = 0; + int64_t i; if (!dtrace_canload(s, len + 1, mstate, vstate)) { regs[rd] = 0; @@ -4059,6 +4824,65 @@ dtrace_dif_subr(uint_t subr, uint_t rd, uint64_t *regs, break; } + case DIF_SUBR_JSON: { + uint64_t size = state->dts_options[DTRACEOPT_STRSIZE]; + uintptr_t json = tupregs[0].dttk_value; + size_t jsonlen = dtrace_strlen((char *)json, size); + uintptr_t elem = tupregs[1].dttk_value; + size_t elemlen = dtrace_strlen((char *)elem, size); + + char *dest = (char *)mstate->dtms_scratch_ptr; + char *elemlist = (char *)mstate->dtms_scratch_ptr + jsonlen + 1; + char *ee = elemlist; + int nelems = 1; + uintptr_t cur; + + if (!dtrace_canload(json, jsonlen + 1, mstate, vstate) || + !dtrace_canload(elem, elemlen + 1, mstate, vstate)) { + regs[rd] = 0; + break; + } + + if (!DTRACE_INSCRATCH(mstate, jsonlen + 1 + elemlen + 1)) { + DTRACE_CPUFLAG_SET(CPU_DTRACE_NOSCRATCH); + regs[rd] = 0; + break; + } + + /* + * Read the element selector and split it up into a packed list + * of strings. + */ + for (cur = elem; cur < elem + elemlen; cur++) { + char cc = dtrace_load8(cur); + + if (cur == elem && cc == '[') { + /* + * If the first element selector key is + * actually an array index then ignore the + * bracket. + */ + continue; + } + + if (cc == ']') + continue; + + if (cc == '.' || cc == '[') { + nelems++; + cc = '\0'; + } + + *ee++ = cc; + } + *ee++ = '\0'; + + if ((regs[rd] = (uintptr_t)dtrace_json(size, json, elemlist, + nelems, dest)) != 0) + mstate->dtms_scratch_ptr += jsonlen + 1; + break; + } + case DIF_SUBR_TOUPPER: case DIF_SUBR_TOLOWER: { uintptr_t s = tupregs[0].dttk_value; @@ -4368,6 +5192,28 @@ dtrace_dif_subr(uint_t subr, uint_t rd, uint64_t *regs, break; } + case DIF_SUBR_STRTOLL: { + uintptr_t s = tupregs[0].dttk_value; + uint64_t size = state->dts_options[DTRACEOPT_STRSIZE]; + int base = 10; + + if (nargs > 1) { + if ((base = tupregs[1].dttk_value) <= 1 || + base > ('z' - 'a' + 1) + ('9' - '0' + 1)) { + *flags |= CPU_DTRACE_ILLOP; + break; + } + } + + if (!dtrace_strcanload(s, size, mstate, vstate)) { + regs[rd] = INT64_MIN; + break; + } + + regs[rd] = dtrace_strtoll((char *)s, base, size); + break; + } + case DIF_SUBR_LLTOSTR: { int64_t i = (int64_t)tupregs[0].dttk_value; uint64_t val, digit; @@ -4577,11 +5423,32 @@ dtrace_dif_subr(uint_t subr, uint_t rd, uint64_t *regs, break; } + case DIF_SUBR_GETF: { + uintptr_t fd = tupregs[0].dttk_value; + struct filedesc *fdp; + file_t *fp; + + if (!dtrace_priv_proc(state)) { + regs[rd] = 0; + break; + } + fdp = curproc->p_fd; + FILEDESC_SLOCK(fdp); + fp = fget_locked(fdp, fd); + mstate->dtms_getf = fp; + regs[rd] = (uintptr_t)fp; + FILEDESC_SUNLOCK(fdp); + break; + } + case DIF_SUBR_CLEANPATH: { char *dest = (char *)mstate->dtms_scratch_ptr, c; uint64_t size = state->dts_options[DTRACEOPT_STRSIZE]; uintptr_t src = tupregs[0].dttk_value; int i = 0, j = 0; +#if defined(sun) + zone_t *z; +#endif if (!dtrace_strcanload(src, size, mstate, vstate)) { regs[rd] = 0; @@ -4680,6 +5547,25 @@ dtrace_dif_subr(uint_t subr, uint_t rd, uint64_t *regs, } while (c != '\0'); dest[j] = '\0'; + +#if defined(sun) + if (mstate->dtms_getf != NULL && + !(mstate->dtms_access & DTRACE_ACCESS_KERNEL) && + (z = state->dts_cred.dcr_cred->cr_zone) != kcred->cr_zone) { + /* + * If we've done a getf() as a part of this ECB and we + * don't have kernel access (and we're not in the global + * zone), check if the path we cleaned up begins with + * the zone's root path, and trim it off if so. Note + * that this is an output cleanliness issue, not a + * security issue: knowing one's zone root path does + * not enable privilege escalation. + */ + if (strstr(dest, z->zone_rootpath) == dest) + dest += strlen(z->zone_rootpath) - 1; + } +#endif + regs[rd] = (uintptr_t)dest; mstate->dtms_scratch_ptr += size; break; @@ -5153,102 +6039,95 @@ dtrace_dif_emulate(dtrace_difo_t *difo, dtrace_mstate_t *mstate, pc = DIF_INSTR_LABEL(instr); break; case DIF_OP_RLDSB: - if (!dtrace_canstore(regs[r1], 1, mstate, vstate)) { - *flags |= CPU_DTRACE_KPRIV; - *illval = regs[r1]; + if (!dtrace_canload(regs[r1], 1, mstate, vstate)) break; - } /*FALLTHROUGH*/ case DIF_OP_LDSB: regs[rd] = (int8_t)dtrace_load8(regs[r1]); break; case DIF_OP_RLDSH: - if (!dtrace_canstore(regs[r1], 2, mstate, vstate)) { - *flags |= CPU_DTRACE_KPRIV; - *illval = regs[r1]; + if (!dtrace_canload(regs[r1], 2, mstate, vstate)) break; - } /*FALLTHROUGH*/ case DIF_OP_LDSH: regs[rd] = (int16_t)dtrace_load16(regs[r1]); break; case DIF_OP_RLDSW: - if (!dtrace_canstore(regs[r1], 4, mstate, vstate)) { - *flags |= CPU_DTRACE_KPRIV; - *illval = regs[r1]; + if (!dtrace_canload(regs[r1], 4, mstate, vstate)) break; - } /*FALLTHROUGH*/ case DIF_OP_LDSW: regs[rd] = (int32_t)dtrace_load32(regs[r1]); break; case DIF_OP_RLDUB: - if (!dtrace_canstore(regs[r1], 1, mstate, vstate)) { - *flags |= CPU_DTRACE_KPRIV; - *illval = regs[r1]; + if (!dtrace_canload(regs[r1], 1, mstate, vstate)) break; - } /*FALLTHROUGH*/ case DIF_OP_LDUB: regs[rd] = dtrace_load8(regs[r1]); break; case DIF_OP_RLDUH: - if (!dtrace_canstore(regs[r1], 2, mstate, vstate)) { - *flags |= CPU_DTRACE_KPRIV; - *illval = regs[r1]; + if (!dtrace_canload(regs[r1], 2, mstate, vstate)) break; - } /*FALLTHROUGH*/ case DIF_OP_LDUH: regs[rd] = dtrace_load16(regs[r1]); break; case DIF_OP_RLDUW: - if (!dtrace_canstore(regs[r1], 4, mstate, vstate)) { - *flags |= CPU_DTRACE_KPRIV; - *illval = regs[r1]; + if (!dtrace_canload(regs[r1], 4, mstate, vstate)) break; - } /*FALLTHROUGH*/ case DIF_OP_LDUW: regs[rd] = dtrace_load32(regs[r1]); break; case DIF_OP_RLDX: - if (!dtrace_canstore(regs[r1], 8, mstate, vstate)) { - *flags |= CPU_DTRACE_KPRIV; - *illval = regs[r1]; + if (!dtrace_canload(regs[r1], 8, mstate, vstate)) break; - } /*FALLTHROUGH*/ case DIF_OP_LDX: regs[rd] = dtrace_load64(regs[r1]); break; case DIF_OP_ULDSB: + DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); regs[rd] = (int8_t) dtrace_fuword8((void *)(uintptr_t)regs[r1]); + DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); break; case DIF_OP_ULDSH: + DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); regs[rd] = (int16_t) dtrace_fuword16((void *)(uintptr_t)regs[r1]); + DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); break; case DIF_OP_ULDSW: + DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); regs[rd] = (int32_t) dtrace_fuword32((void *)(uintptr_t)regs[r1]); + DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); break; case DIF_OP_ULDUB: + DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); regs[rd] = dtrace_fuword8((void *)(uintptr_t)regs[r1]); + DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); break; case DIF_OP_ULDUH: + DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); regs[rd] = dtrace_fuword16((void *)(uintptr_t)regs[r1]); + DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); break; case DIF_OP_ULDUW: + DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); regs[rd] = dtrace_fuword32((void *)(uintptr_t)regs[r1]); + DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); break; case DIF_OP_ULDX: + DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); regs[rd] = dtrace_fuword64((void *)(uintptr_t)regs[r1]); + DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); break; case DIF_OP_RET: rval = regs[rd]; @@ -5930,7 +6809,7 @@ dtrace_action_chill(dtrace_mstate_t *mstate, hrtime_t val) if (dtrace_destructive_disallow) return; - flags = (volatile uint16_t *)&cpu_core[cpu->cpu_id].cpuc_dtrace_flags; + flags = (volatile uint16_t *)&cpu_core[curcpu].cpuc_dtrace_flags; now = dtrace_gethrtime(); @@ -6078,6 +6957,63 @@ dtrace_action_ustack(dtrace_mstate_t *mstate, dtrace_state_t *state, mstate->dtms_scratch_ptr = old; } +static void +dtrace_store_by_ref(dtrace_difo_t *dp, caddr_t tomax, size_t size, + size_t *valoffsp, uint64_t *valp, uint64_t end, int intuple, int dtkind) +{ + volatile uint16_t *flags; + uint64_t val = *valp; + size_t valoffs = *valoffsp; + + flags = (volatile uint16_t *)&cpu_core[curcpu].cpuc_dtrace_flags; + ASSERT(dtkind == DIF_TF_BYREF || dtkind == DIF_TF_BYUREF); + + /* + * If this is a string, we're going to only load until we find the zero + * byte -- after which we'll store zero bytes. + */ + if (dp->dtdo_rtype.dtdt_kind == DIF_TYPE_STRING) { + char c = '\0' + 1; + size_t s; + + for (s = 0; s < size; s++) { + if (c != '\0' && dtkind == DIF_TF_BYREF) { + c = dtrace_load8(val++); + } else if (c != '\0' && dtkind == DIF_TF_BYUREF) { + DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); + c = dtrace_fuword8((void *)(uintptr_t)val++); + DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); + if (*flags & CPU_DTRACE_FAULT) + break; + } + + DTRACE_STORE(uint8_t, tomax, valoffs++, c); + + if (c == '\0' && intuple) + break; + } + } else { + uint8_t c; + while (valoffs < end) { + if (dtkind == DIF_TF_BYREF) { + c = dtrace_load8(val++); + } else if (dtkind == DIF_TF_BYUREF) { + DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); + c = dtrace_fuword8((void *)(uintptr_t)val++); + DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); + if (*flags & CPU_DTRACE_FAULT) + break; + } + + DTRACE_STORE(uint8_t, tomax, + valoffs++, c); + } + } + + *valp = val; + *valoffsp = valoffs; +} + /* * If you're looking for the epicenter of DTrace, you just found it. This * is the function called by the provider to fire a probe -- from which all @@ -6180,6 +7116,8 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t arg1, uint64_t val = 0; mstate.dtms_present = DTRACE_MSTATE_ARGS | DTRACE_MSTATE_PROBE; + mstate.dtms_getf = NULL; + *flags &= ~CPU_DTRACE_ERROR; if (prov == dtrace_provider) { @@ -6713,7 +7651,8 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t arg1, ASSERT(0); } - if (dp->dtdo_rtype.dtdt_flags & DIF_TF_BYREF) { + if (dp->dtdo_rtype.dtdt_flags & DIF_TF_BYREF || + dp->dtdo_rtype.dtdt_flags & DIF_TF_BYUREF) { uintptr_t end = valoffs + size; if (tracememsize != 0 && @@ -6722,40 +7661,15 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t arg1, tracememsize = 0; } - if (!dtrace_vcanload((void *)(uintptr_t)val, + if (dp->dtdo_rtype.dtdt_flags & DIF_TF_BYREF && + !dtrace_vcanload((void *)(uintptr_t)val, &dp->dtdo_rtype, &mstate, vstate)) continue; - /* - * If this is a string, we're going to only - * load until we find the zero byte -- after - * which we'll store zero bytes. - */ - if (dp->dtdo_rtype.dtdt_kind == - DIF_TYPE_STRING) { - char c = '\0' + 1; - int intuple = act->dta_intuple; - size_t s; - - for (s = 0; s < size; s++) { - if (c != '\0') - c = dtrace_load8(val++); - - DTRACE_STORE(uint8_t, tomax, - valoffs++, c); - - if (c == '\0' && intuple) - break; - } - - continue; - } - - while (valoffs < end) { - DTRACE_STORE(uint8_t, tomax, valoffs++, - dtrace_load8(val++)); - } - + dtrace_store_by_ref(dp, tomax, size, &valoffs, + &val, end, act->dta_intuple, + dp->dtdo_rtype.dtdt_flags & DIF_TF_BYREF ? + DIF_TF_BYREF: DIF_TF_BYUREF); continue; } @@ -8853,6 +9767,20 @@ dtrace_difo_validate(dtrace_difo_t *dp, dtrace_vstate_t *vstate, uint_t nregs, subr == DIF_SUBR_COPYOUTSTR) { dp->dtdo_destructive = 1; } + + if (subr == DIF_SUBR_GETF) { + /* + * If we have a getf() we need to record that + * in our state. Note that our state can be + * NULL if this is a helper -- but in that + * case, the call to getf() is itself illegal, + * and will be caught (slightly later) when + * the helper is validated. + */ + if (vstate->dtvs_state != NULL) + vstate->dtvs_state->dts_getf++; + } + break; case DIF_OP_PUSHTR: if (type != DIF_TYPE_STRING && type != DIF_TYPE_CTF) @@ -8882,7 +9810,7 @@ dtrace_difo_validate(dtrace_difo_t *dp, dtrace_vstate_t *vstate, uint_t nregs, "expected 'ret' as last DIF instruction\n"); } - if (!(dp->dtdo_rtype.dtdt_flags & DIF_TF_BYREF)) { + if (!(dp->dtdo_rtype.dtdt_flags & (DIF_TF_BYREF | DIF_TF_BYUREF))) { /* * If we're not returning by reference, the size must be either * 0 or the size of one of the base types. @@ -8896,7 +9824,7 @@ dtrace_difo_validate(dtrace_difo_t *dp, dtrace_vstate_t *vstate, uint_t nregs, break; default: - err += efunc(dp->dtdo_len - 1, "bad return size"); + err += efunc(dp->dtdo_len - 1, "bad return size\n"); } } @@ -9132,7 +10060,9 @@ dtrace_difo_validate_helper(dtrace_difo_t *dp) subr == DIF_SUBR_INET_NTOA || subr == DIF_SUBR_INET_NTOA6 || subr == DIF_SUBR_INET_NTOP || + subr == DIF_SUBR_JSON || subr == DIF_SUBR_LLTOSTR || + subr == DIF_SUBR_STRTOLL || subr == DIF_SUBR_RINDEX || subr == DIF_SUBR_STRCHR || subr == DIF_SUBR_STRJOIN || @@ -11512,6 +12442,7 @@ dtrace_enabling_destroy(dtrace_enabling_t *enab) ASSERT(enab->dten_vstate->dtvs_state != NULL); ASSERT(enab->dten_vstate->dtvs_state->dts_nretained > 0); enab->dten_vstate->dtvs_state->dts_nretained--; + dtrace_retained_gen++; } if (enab->dten_prev == NULL) { @@ -11554,6 +12485,7 @@ dtrace_enabling_retain(dtrace_enabling_t *enab) return (ENOSPC); state->dts_nretained++; + dtrace_retained_gen++; if (dtrace_retained == NULL) { dtrace_retained = enab; @@ -11734,7 +12666,8 @@ dtrace_enabling_matchall(void) #if defined(sun) cred_t *cr = enab->dten_vstate->dtvs_state->dts_cred.dcr_cred; - if (INGLOBALZONE(curproc) || getzoneid() == crgetzoneid(cr)) + if (INGLOBALZONE(curproc) || + cr != NULL && getzoneid() == crgetzoneid(cr)) #endif (void) dtrace_enabling_match(enab, NULL); } @@ -11795,6 +12728,7 @@ dtrace_enabling_provide(dtrace_provider_t *prv) { int i, all = 0; dtrace_probedesc_t desc; + dtrace_genid_t gen; ASSERT(MUTEX_HELD(&dtrace_lock)); ASSERT(MUTEX_HELD(&dtrace_provider_lock)); @@ -11805,15 +12739,25 @@ dtrace_enabling_provide(dtrace_provider_t *prv) } do { - dtrace_enabling_t *enab = dtrace_retained; + dtrace_enabling_t *enab; void *parg = prv->dtpv_arg; - for (; enab != NULL; enab = enab->dten_next) { +retry: + gen = dtrace_retained_gen; + for (enab = dtrace_retained; enab != NULL; + enab = enab->dten_next) { for (i = 0; i < enab->dten_ndesc; i++) { desc = enab->dten_desc[i]->dted_probe; mutex_exit(&dtrace_lock); prv->dtpv_pops.dtps_provide(parg, &desc); mutex_enter(&dtrace_lock); + /* + * Process the retained enablings again if + * they have changed while we weren't holding + * dtrace_lock. + */ + if (gen != dtrace_retained_gen) + goto retry; } } } while (all && (prv = prv->dtpv_next) != NULL); @@ -12014,7 +12958,8 @@ dtrace_dof_copyin(uintptr_t uarg, int *errp) dof = kmem_alloc(hdr.dofh_loadsz, KM_SLEEP); - if (copyin((void *)uarg, dof, hdr.dofh_loadsz) != 0) { + if (copyin((void *)uarg, dof, hdr.dofh_loadsz) != 0 || + dof->dofh_loadsz != hdr.dofh_loadsz) { kmem_free(dof, hdr.dofh_loadsz); *errp = EFAULT; return (NULL); @@ -12824,6 +13769,13 @@ dtrace_dof_slurp(dof_hdr_t *dof, dtrace_vstate_t *vstate, cred_t *cr, } } + if (DOF_SEC_ISLOADABLE(sec->dofs_type) && + !(sec->dofs_flags & DOF_SECF_LOAD)) { + dtrace_dof_error(dof, "loadable section with load " + "flag unset"); + return (-1); + } + if (!(sec->dofs_flags & DOF_SECF_LOAD)) continue; /* just ignore non-loadable sections */ @@ -13758,6 +14710,24 @@ dtrace_state_go(dtrace_state_t *state, processorid_t *cpu) state->dts_activity = DTRACE_ACTIVITY_WARMUP; +#if defined(sun) + if (state->dts_getf != 0 && + !(state->dts_cred.dcr_visible & DTRACE_CRV_KERNEL)) { + /* + * We don't have kernel privs but we have at least one call + * to getf(); we need to bump our zone's count, and (if + * this is the first enabling to have an unprivileged call + * to getf()) we need to hook into closef(). + */ + state->dts_cred.dcr_cred->cr_zone->zone_dtrace_getf++; + + if (dtrace_getf++ == 0) { + ASSERT(dtrace_closef == NULL); + dtrace_closef = dtrace_getf_barrier; + } + } +#endif + /* * Now it's time to actually fire the BEGIN probe. We need to disable * interrupts here both to record the CPU on which we fired the BEGIN @@ -13874,6 +14844,26 @@ dtrace_state_stop(dtrace_state_t *state, processorid_t *cpu) state->dts_activity = DTRACE_ACTIVITY_STOPPED; dtrace_sync(); +#if defined(sun) + if (state->dts_getf != 0 && + !(state->dts_cred.dcr_visible & DTRACE_CRV_KERNEL)) { + /* + * We don't have kernel privs but we have at least one call + * to getf(); we need to lower our zone's count, and (if + * this is the last enabling to have an unprivileged call + * to getf()) we need to clear the closef() hook. + */ + ASSERT(state->dts_cred.dcr_cred->cr_zone->zone_dtrace_getf > 0); + ASSERT(dtrace_closef == dtrace_getf_barrier); + ASSERT(dtrace_getf > 0); + + state->dts_cred.dcr_cred->cr_zone->zone_dtrace_getf--; + + if (--dtrace_getf == 0) + dtrace_closef = NULL; + } +#endif + return (0); } @@ -15543,6 +16533,25 @@ dtrace_toxrange_add(uintptr_t base, uintptr_t limit) dtrace_toxranges++; } +static void +dtrace_getf_barrier() +{ +#if defined(sun) + /* + * When we have unprivileged (that is, non-DTRACE_CRV_KERNEL) enablings + * that contain calls to getf(), this routine will be called on every + * closef() before either the underlying vnode is released or the + * file_t itself is freed. By the time we are here, it is essential + * that the file_t can no longer be accessed from a call to getf() + * in probe context -- that assures that a dtrace_sync() can be used + * to clear out any enablings referring to the old structures. + */ + if (curthread->t_procp->p_zone->zone_dtrace_getf != 0 || + kcred->cr_zone->zone_dtrace_getf != 0) + dtrace_sync(); +#endif +} + /* * DTrace Driver Cookbook Functions */ @@ -15716,10 +16725,8 @@ dtrace_attach(dev_info_t *devi, ddi_attach_cmd_t cmd) #endif #if !defined(sun) -#if __FreeBSD_version >= 800039 static void dtrace_dtr(void *); #endif -#endif /*ARGSUSED*/ static int @@ -15742,30 +16749,11 @@ dtrace_open(struct cdev *dev, int oflags, int devtype, struct thread *td) * If this wasn't an open with the "helper" minor, then it must be * the "dtrace" minor. */ - ASSERT(getminor(*devp) == DTRACEMNRN_DTRACE); + if (getminor(*devp) == DTRACEMNRN_DTRACE) + return (ENXIO); #else cred_t *cred_p = NULL; - -#if __FreeBSD_version < 800039 - /* - * The first minor device is the one that is cloned so there is - * nothing more to do here. - */ - if (dev2unit(dev) == 0) - return 0; - - /* - * Devices are cloned, so if the DTrace state has already - * been allocated, that means this device belongs to a - * different client. Each client should open '/dev/dtrace' - * to get a cloned device. - */ - if (dev->si_drv1 != NULL) - return (EBUSY); -#endif - cred_p = dev->si_cred; -#endif /* * If no DTRACE_PRIV_* bits are set in the credential, then the @@ -15773,11 +16761,6 @@ dtrace_open(struct cdev *dev, int oflags, int devtype, struct thread *td) */ dtrace_cred2priv(cred_p, &priv, &uid, &zoneid); if (priv == DTRACE_PRIV_NONE) { -#if !defined(sun) -#if __FreeBSD_version < 800039 - /* Destroy the cloned device. */ - destroy_dev(dev); -#endif #endif return (EACCES); @@ -15810,29 +16793,19 @@ dtrace_open(struct cdev *dev, int oflags, int devtype, struct thread *td) state = dtrace_state_create(devp, cred_p); #else state = dtrace_state_create(dev); -#if __FreeBSD_version < 800039 - dev->si_drv1 = state; -#else devfs_set_cdevpriv(state, dtrace_dtr); -#endif #endif mutex_exit(&cpu_lock); if (state == NULL) { #if defined(sun) - if (--dtrace_opens == 0) + if (--dtrace_opens == 0 && dtrace_anon.dta_enabling == NULL) (void) kdi_dtrace_set(KDI_DTSET_DTRACE_DEACTIVATE); #else --dtrace_opens; #endif mutex_exit(&dtrace_lock); -#if !defined(sun) -#if __FreeBSD_version < 800039 - /* Destroy the cloned device. */ - destroy_dev(dev); -#endif -#endif return (EAGAIN); } @@ -15845,9 +16818,6 @@ dtrace_open(struct cdev *dev, int oflags, int devtype, struct thread *td) #if defined(sun) static int dtrace_close(dev_t dev, int flag, int otyp, cred_t *cred_p) -#elif __FreeBSD_version < 800039 -static int -dtrace_close(struct cdev *dev, int flags, int fmt __unused, struct thread *td) #else static void dtrace_dtr(void *data) @@ -15861,17 +16831,8 @@ dtrace_dtr(void *data) return (0); state = ddi_get_soft_state(dtrace_softstate, minor); -#else -#if __FreeBSD_version < 800039 - dtrace_state_t *state = dev->si_drv1; - - /* Check if this is not a cloned device. */ - if (dev2unit(dev) == 0) - return (0); #else dtrace_state_t *state = data; -#endif - #endif mutex_enter(&cpu_lock); @@ -15890,15 +16851,16 @@ dtrace_dtr(void *data) #if !defined(sun) kmem_free(state, 0); -#if __FreeBSD_version < 800039 - dev->si_drv1 = NULL; -#endif #endif } ASSERT(dtrace_opens > 0); #if defined(sun) - if (--dtrace_opens == 0) + /* + * Only relinquish control of the kernel debugger interface when there + * are no consumers and no anonymous enablings. + */ + if (--dtrace_opens == 0 && dtrace_anon.dta_enabling == NULL) (void) kdi_dtrace_set(KDI_DTSET_DTRACE_DEACTIVATE); #else --dtrace_opens; @@ -15907,12 +16869,7 @@ dtrace_dtr(void *data) mutex_exit(&dtrace_lock); mutex_exit(&cpu_lock); -#if __FreeBSD_version < 800039 - /* Schedule this cloned device to be destroyed. */ - destroy_dev_sched(dev); -#endif - -#if defined(sun) || __FreeBSD_version < 800039 +#if defined(sun) return (0); #endif } @@ -16801,6 +17758,9 @@ dtrace_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) dtrace_modload = NULL; dtrace_modunload = NULL; + ASSERT(dtrace_getf == 0); + ASSERT(dtrace_closef == NULL); + mutex_exit(&cpu_lock); if (dtrace_helptrace_enabled) { @@ -16949,24 +17909,14 @@ static d_ioctl_t dtrace_ioctl; static d_ioctl_t dtrace_ioctl_helper; static void dtrace_load(void *); static int dtrace_unload(void); -#if __FreeBSD_version < 800039 -static void dtrace_clone(void *, struct ucred *, char *, int , struct cdev **); -static struct clonedevs *dtrace_clones; /* Ptr to the array of cloned devices. */ -static eventhandler_tag eh_tag; /* Event handler tag. */ -#else static struct cdev *dtrace_dev; static struct cdev *helper_dev; -#endif void dtrace_invop_init(void); void dtrace_invop_uninit(void); static struct cdevsw dtrace_cdevsw = { .d_version = D_VERSION, -#if __FreeBSD_version < 800039 - .d_flags = D_TRACKCLOSE | D_NEEDMINOR, - .d_close = dtrace_close, -#endif .d_ioctl = dtrace_ioctl, .d_open = dtrace_open, .d_name = "dtrace", @@ -16979,9 +17929,6 @@ static struct cdevsw helper_cdevsw = { }; #include -#if __FreeBSD_version < 800039 -#include -#endif #include #include #include diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c index b1e65ac5b67..efb470b0d1d 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c @@ -28,9 +28,9 @@ * Use is subject to license terms. */ -#if defined(sun) -#pragma ident "%Z%%M% %I% %E% SMI" -#endif +/* + * Copyright (c) 2013, Joyent, Inc. All rights reserved. + */ #include #include @@ -63,6 +63,7 @@ #if !defined(sun) #include #include +#include #include #include #include @@ -2256,8 +2257,7 @@ fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag, fasttrap_probe_spec_t *probe; uint64_t noffs; size_t size; - int ret; - char *c; + int ret, err; if (copyin(&uprobe->ftps_noffs, &noffs, sizeof (uprobe->ftps_noffs))) @@ -2277,7 +2277,8 @@ fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag, probe = kmem_alloc(size, KM_SLEEP); - if (copyin(uprobe, probe, size) != 0) { + if (copyin(uprobe, probe, size) != 0 || + probe->ftps_noffs != noffs) { kmem_free(probe, size); return (EFAULT); } @@ -2286,18 +2287,16 @@ fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag, * Verify that the function and module strings contain no * funny characters. */ - for (c = &probe->ftps_func[0]; *c != '\0'; c++) { - if (*c < 0x20 || 0x7f <= *c) { - ret = EINVAL; - goto err; - } + if (u8_validate(probe->ftps_func, strlen(probe->ftps_func), + NULL, U8_VALIDATE_ENTIRE, &err) < 0) { + ret = EINVAL; + goto err; } - for (c = &probe->ftps_mod[0]; *c != '\0'; c++) { - if (*c < 0x20 || 0x7f <= *c) { - ret = EINVAL; - goto err; - } + if (u8_validate(probe->ftps_mod, strlen(probe->ftps_mod), + NULL, U8_VALIDATE_ENTIRE, &err) < 0) { + ret = EINVAL; + goto err; } #ifdef notyet diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/sdt_subr.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/sdt_subr.c index 66ff8a92a01..4d53e014c0a 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/sdt_subr.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/sdt_subr.c @@ -21,6 +21,7 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright (c) 2012, Joyent, Inc. All rights reserved. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -85,11 +86,11 @@ static dtrace_pattr_t xpv_attr = { sdt_provider_t sdt_providers[] = { { "vtrace", "__vtrace_", &vtrace_attr, 0 }, - { "sysinfo", "__cpu_sysinfo_", &info_attr, 0 }, - { "vminfo", "__cpu_vminfo_", &info_attr, 0 }, + { "sysinfo", "__cpu_sysinfo_", &info_attr, DTRACE_PRIV_USER }, + { "vminfo", "__cpu_vminfo_", &info_attr, DTRACE_PRIV_USER }, { "fpuinfo", "__fpuinfo_", &fpu_attr, 0 }, - { "sched", "__sched_", &stab_attr, 0 }, - { "proc", "__proc_", &stab_attr, 0 }, + { "sched", "__sched_", &stab_attr, DTRACE_PRIV_USER }, + { "proc", "__proc_", &stab_attr, DTRACE_PRIV_USER }, { "io", "__io_", &stab_attr, 0 }, { "mib", "__mib_", &stab_attr, 0 }, { "fsinfo", "__fsinfo_", &fsinfo_attr, 0 }, @@ -851,6 +852,20 @@ sdt_argdesc_t sdt_args[] = { { NULL } }; +/*ARGSUSED*/ +int +sdt_mode(void *arg, dtrace_id_t id, void *parg) +{ + /* + * We tell DTrace that we're in kernel mode, that the firing needs to + * be dropped for anything that doesn't have necessary privileges, and + * that it needs to be restricted for anything that has restricted + * (i.e., not all-zone) privileges. + */ + return (DTRACE_MODE_KERNEL | DTRACE_MODE_NOPRIV_DROP | + DTRACE_MODE_LIMITEDPRIV_RESTRICT); +} + /*ARGSUSED*/ void sdt_getargdesc(void *arg, dtrace_id_t id, void *parg, dtrace_argdesc_t *desc) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c index bc4989e32bd..354e4d6746c 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c @@ -20,9 +20,9 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright (c) 2014 by Saso Kiselkov. All rights reserved. - * Copyright 2013 Nexenta Systems, Inc. All rights reserved. + * Copyright 2014 Nexenta Systems, Inc. All rights reserved. */ /* @@ -104,7 +104,7 @@ * with the buffer may be evicted prior to the callback. The callback * must be made with *no locks held* (to prevent deadlock). Additionally, * the users of callbacks must ensure that their private data is - * protected from simultaneous callbacks from arc_buf_evict() + * protected from simultaneous callbacks from arc_clear_callback() * and arc_do_user_evicts(). * * Note that the majority of the performance stats are manipulated @@ -204,8 +204,6 @@ int zfs_arc_shrink_shift = 0; int zfs_arc_p_min_shift = 0; int zfs_disable_dup_eviction = 0; -TUNABLE_QUAD("vfs.zfs.arc_max", &zfs_arc_max); -TUNABLE_QUAD("vfs.zfs.arc_min", &zfs_arc_min); TUNABLE_QUAD("vfs.zfs.arc_meta_limit", &zfs_arc_meta_limit); SYSCTL_DECL(_vfs_zfs); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, arc_max, CTLFLAG_RDTUN, &zfs_arc_max, 0, @@ -782,7 +780,7 @@ typedef struct l2arc_read_callback { arc_buf_t *l2rcb_buf; /* read buffer */ spa_t *l2rcb_spa; /* spa */ blkptr_t l2rcb_bp; /* original blkptr */ - zbookmark_t l2rcb_zb; /* original bookmark */ + zbookmark_phys_t l2rcb_zb; /* original bookmark */ int l2rcb_flags; /* original flags */ enum zio_compress l2rcb_compress; /* applied compress */ } l2arc_read_callback_t; @@ -862,8 +860,10 @@ buf_discard_identity(arc_buf_hdr_t *hdr) } static arc_buf_hdr_t * -buf_hash_find(uint64_t spa, const dva_t *dva, uint64_t birth, kmutex_t **lockp) +buf_hash_find(uint64_t spa, const blkptr_t *bp, kmutex_t **lockp) { + const dva_t *dva = BP_IDENTITY(bp); + uint64_t birth = BP_PHYSICAL_BIRTH(bp); uint64_t idx = BUF_HASH_INDEX(spa, dva, birth); kmutex_t *hash_lock = BUF_HASH_LOCK(idx); arc_buf_hdr_t *buf; @@ -895,6 +895,8 @@ buf_hash_insert(arc_buf_hdr_t *buf, kmutex_t **lockp) arc_buf_hdr_t *fbuf; uint32_t i; + ASSERT(!DVA_IS_EMPTY(&buf->b_dva)); + ASSERT(buf->b_birth != 0); ASSERT(!HDR_IN_HASH_TABLE(buf)); *lockp = hash_lock; mutex_enter(hash_lock); @@ -1643,8 +1645,12 @@ arc_buf_data_free(arc_buf_t *buf, void (*free_func)(void *, size_t)) } } +/* + * Free up buf->b_data and if 'remove' is set, then pull the + * arc_buf_t off of the the arc_buf_hdr_t's list and free it. + */ static void -arc_buf_destroy(arc_buf_t *buf, boolean_t recycle, boolean_t all) +arc_buf_destroy(arc_buf_t *buf, boolean_t recycle, boolean_t remove) { arc_buf_t **bufp; @@ -1697,7 +1703,7 @@ arc_buf_destroy(arc_buf_t *buf, boolean_t recycle, boolean_t all) } /* only remove the buf if requested */ - if (!all) + if (!remove) return; /* remove the buf from the hdr list */ @@ -1744,6 +1750,8 @@ arc_hdr_destroy(arc_buf_hdr_t *hdr) list_remove(l2hdr->b_dev->l2ad_buflist, hdr); ARCSTAT_INCR(arcstat_l2_size, -hdr->b_size); ARCSTAT_INCR(arcstat_l2_asize, -l2hdr->b_asize); + vdev_space_update(l2hdr->b_dev->l2ad_vdev, + -l2hdr->b_asize, 0, 0); kmem_free(l2hdr, sizeof (l2arc_buf_hdr_t)); if (hdr->b_state == arc_l2c_only) l2arc_hdr_stat_remove(); @@ -2349,7 +2357,7 @@ arc_do_user_evicts(void) mutex_exit(&buf->b_evict_lock); if (buf->b_efunc != NULL) - VERIFY(buf->b_efunc(buf) == 0); + VERIFY0(buf->b_efunc(buf->b_private)); buf->b_efunc = NULL; buf->b_private = NULL; @@ -2983,10 +2991,10 @@ arc_getbuf_func(zio_t *zio, arc_buf_t *buf, void *arg) static void arc_read_done(zio_t *zio) { - arc_buf_hdr_t *hdr, *found; + arc_buf_hdr_t *hdr; arc_buf_t *buf; arc_buf_t *abuf; /* buffer we're assigning to callback */ - kmutex_t *hash_lock; + kmutex_t *hash_lock = NULL; arc_callback_t *callback_list, *acb; int freeable = FALSE; @@ -3001,12 +3009,22 @@ arc_read_done(zio_t *zio) * reason for it not to be found is if we were freed during the * read. */ - found = buf_hash_find(hdr->b_spa, &hdr->b_dva, hdr->b_birth, - &hash_lock); + if (HDR_IN_HASH_TABLE(hdr)) { + ASSERT3U(hdr->b_birth, ==, BP_PHYSICAL_BIRTH(zio->io_bp)); + ASSERT3U(hdr->b_dva.dva_word[0], ==, + BP_IDENTITY(zio->io_bp)->dva_word[0]); + ASSERT3U(hdr->b_dva.dva_word[1], ==, + BP_IDENTITY(zio->io_bp)->dva_word[1]); - ASSERT((found == NULL && HDR_FREED_IN_READ(hdr) && hash_lock == NULL) || - (found == hdr && DVA_EQUAL(&hdr->b_dva, BP_IDENTITY(zio->io_bp))) || - (found == hdr && HDR_L2_READING(hdr))); + arc_buf_hdr_t *found = buf_hash_find(hdr->b_spa, zio->io_bp, + &hash_lock); + + ASSERT((found == NULL && HDR_FREED_IN_READ(hdr) && + hash_lock == NULL) || + (found == hdr && + DVA_EQUAL(&hdr->b_dva, BP_IDENTITY(zio->io_bp))) || + (found == hdr && HDR_L2_READING(hdr))); + } hdr->b_flags &= ~ARC_L2_EVICTED; if (l2arc_noprefetch && (hdr->b_flags & ARC_PREFETCH)) @@ -3130,18 +3148,27 @@ arc_read_done(zio_t *zio) int arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, arc_done_func_t *done, void *private, zio_priority_t priority, int zio_flags, uint32_t *arc_flags, - const zbookmark_t *zb) + const zbookmark_phys_t *zb) { - arc_buf_hdr_t *hdr; + arc_buf_hdr_t *hdr = NULL; arc_buf_t *buf = NULL; - kmutex_t *hash_lock; + kmutex_t *hash_lock = NULL; zio_t *rzio; uint64_t guid = spa_load_guid(spa); + ASSERT(!BP_IS_EMBEDDED(bp) || + BPE_GET_ETYPE(bp) == BP_EMBEDDED_TYPE_DATA); + top: - hdr = buf_hash_find(guid, BP_IDENTITY(bp), BP_PHYSICAL_BIRTH(bp), - &hash_lock); - if (hdr && hdr->b_datacnt > 0) { + if (!BP_IS_EMBEDDED(bp)) { + /* + * Embedded BP's have no DVA and require no I/O to "read". + * Create an anonymous arc buf to back it. + */ + hdr = buf_hash_find(guid, bp, &hash_lock); + } + + if (hdr != NULL && hdr->b_datacnt > 0) { *arc_flags |= ARC_CACHED; @@ -3215,7 +3242,7 @@ arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, arc_done_func_t *done, done(NULL, buf, private); } else { uint64_t size = BP_GET_LSIZE(bp); - arc_callback_t *acb; + arc_callback_t *acb; vdev_t *vd = NULL; uint64_t addr = 0; boolean_t devw = B_FALSE; @@ -3224,15 +3251,17 @@ arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, arc_done_func_t *done, if (hdr == NULL) { /* this block is not in the cache */ - arc_buf_hdr_t *exists; + arc_buf_hdr_t *exists = NULL; arc_buf_contents_t type = BP_GET_BUFC_TYPE(bp); buf = arc_buf_alloc(spa, size, private, type); hdr = buf->b_hdr; - hdr->b_dva = *BP_IDENTITY(bp); - hdr->b_birth = BP_PHYSICAL_BIRTH(bp); - hdr->b_cksum0 = bp->blk_cksum.zc_word[0]; - exists = buf_hash_insert(hdr, &hash_lock); - if (exists) { + if (!BP_IS_EMBEDDED(bp)) { + hdr->b_dva = *BP_IDENTITY(bp); + hdr->b_birth = BP_PHYSICAL_BIRTH(bp); + hdr->b_cksum0 = bp->blk_cksum.zc_word[0]; + exists = buf_hash_insert(hdr, &hash_lock); + } + if (exists != NULL) { /* somebody beat us to the hash insert */ mutex_exit(hash_lock); buf_discard_identity(hdr); @@ -3304,7 +3333,8 @@ arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, arc_done_func_t *done, vd = NULL; } - mutex_exit(hash_lock); + if (hash_lock != NULL) + mutex_exit(hash_lock); /* * At this point, we have a level 1 cache miss. Try again in @@ -3312,7 +3342,7 @@ arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, arc_done_func_t *done, */ ASSERT3U(hdr->b_size, ==, size); DTRACE_PROBE4(arc__miss, arc_buf_hdr_t *, hdr, blkptr_t *, bp, - uint64_t, size, zbookmark_t *, zb); + uint64_t, size, zbookmark_phys_t *, zb); ARCSTAT_BUMP(arcstat_misses); ARCSTAT_CONDSTAT(!(hdr->b_flags & ARC_PREFETCH), demand, prefetch, hdr->b_type != ARC_BUFC_METADATA, @@ -3442,8 +3472,9 @@ arc_freed(spa_t *spa, const blkptr_t *bp) kmutex_t *hash_lock; uint64_t guid = spa_load_guid(spa); - hdr = buf_hash_find(guid, BP_IDENTITY(bp), BP_PHYSICAL_BIRTH(bp), - &hash_lock); + ASSERT(!BP_IS_EMBEDDED(bp)); + + hdr = buf_hash_find(guid, bp, &hash_lock); if (hdr == NULL) return; if (HDR_BUF_AVAILABLE(hdr)) { @@ -3461,16 +3492,25 @@ arc_freed(spa_t *spa, const blkptr_t *bp) } /* - * This is used by the DMU to let the ARC know that a buffer is - * being evicted, so the ARC should clean up. If this arc buf - * is not yet in the evicted state, it will be put there. + * Clear the user eviction callback set by arc_set_callback(), first calling + * it if it exists. Because the presence of a callback keeps an arc_buf cached + * clearing the callback may result in the arc_buf being destroyed. However, + * it will not result in the *last* arc_buf being destroyed, hence the data + * will remain cached in the ARC. We make a copy of the arc buffer here so + * that we can process the callback without holding any locks. + * + * It's possible that the callback is already in the process of being cleared + * by another thread. In this case we can not clear the callback. + * + * Returns B_TRUE if the callback was successfully called and cleared. */ -int -arc_buf_evict(arc_buf_t *buf) +boolean_t +arc_clear_callback(arc_buf_t *buf) { arc_buf_hdr_t *hdr; kmutex_t *hash_lock; - arc_buf_t **bufp; + arc_evict_func_t *efunc = buf->b_efunc; + void *private = buf->b_private; list_t *list, *evicted_list; kmutex_t *lock, *evicted_lock; @@ -3482,17 +3522,16 @@ arc_buf_evict(arc_buf_t *buf) */ ASSERT(buf->b_data == NULL); mutex_exit(&buf->b_evict_lock); - return (0); + return (B_FALSE); } else if (buf->b_data == NULL) { - arc_buf_t copy = *buf; /* structure assignment */ /* * We are on the eviction list; process this buffer now * but let arc_do_user_evicts() do the reaping. */ buf->b_efunc = NULL; mutex_exit(&buf->b_evict_lock); - VERIFY(copy.b_efunc(©) == 0); - return (1); + VERIFY0(efunc(private)); + return (B_TRUE); } hash_lock = HDR_LOCK(hdr); mutex_enter(hash_lock); @@ -3502,50 +3541,21 @@ arc_buf_evict(arc_buf_t *buf) ASSERT3U(refcount_count(&hdr->b_refcnt), <, hdr->b_datacnt); ASSERT(hdr->b_state == arc_mru || hdr->b_state == arc_mfu); - /* - * Pull this buffer off of the hdr - */ - bufp = &hdr->b_buf; - while (*bufp != buf) - bufp = &(*bufp)->b_next; - *bufp = buf->b_next; - - ASSERT(buf->b_data != NULL); - arc_buf_destroy(buf, FALSE, FALSE); - - if (hdr->b_datacnt == 0) { - arc_state_t *old_state = hdr->b_state; - arc_state_t *evicted_state; - - ASSERT(hdr->b_buf == NULL); - ASSERT(refcount_is_zero(&hdr->b_refcnt)); - - evicted_state = - (old_state == arc_mru) ? arc_mru_ghost : arc_mfu_ghost; - - get_buf_info(hdr, old_state, &list, &lock); - get_buf_info(hdr, evicted_state, &evicted_list, &evicted_lock); - mutex_enter(lock); - mutex_enter(evicted_lock); - - arc_change_state(evicted_state, hdr, hash_lock); - ASSERT(HDR_IN_HASH_TABLE(hdr)); - hdr->b_flags |= ARC_IN_HASH_TABLE; - hdr->b_flags &= ~ARC_BUF_AVAILABLE; - - mutex_exit(evicted_lock); - mutex_exit(lock); - } - mutex_exit(hash_lock); - mutex_exit(&buf->b_evict_lock); - - VERIFY(buf->b_efunc(buf) == 0); buf->b_efunc = NULL; buf->b_private = NULL; - buf->b_hdr = NULL; - buf->b_next = NULL; - kmem_cache_free(buf_cache, buf); - return (1); + + if (hdr->b_datacnt > 1) { + mutex_exit(&buf->b_evict_lock); + arc_buf_destroy(buf, FALSE, TRUE); + } else { + ASSERT(buf == hdr->b_buf); + hdr->b_flags |= ARC_BUF_AVAILABLE; + mutex_exit(&buf->b_evict_lock); + } + + mutex_exit(hash_lock); + VERIFY0(efunc(private)); + return (B_TRUE); } /* @@ -3674,6 +3684,8 @@ arc_release(arc_buf_t *buf, void *tag) if (l2hdr) { ARCSTAT_INCR(arcstat_l2_asize, -l2hdr->b_asize); + vdev_space_update(l2hdr->b_dev->l2ad_vdev, + -l2hdr->b_asize, 0, 0); trim_map_free(l2hdr->b_dev->l2ad_vdev, l2hdr->b_daddr, hdr->b_size, 0); kmem_free(l2hdr, sizeof (l2arc_buf_hdr_t)); @@ -3693,17 +3705,6 @@ arc_released(arc_buf_t *buf) return (released); } -int -arc_has_callback(arc_buf_t *buf) -{ - int callback; - - mutex_enter(&buf->b_evict_lock); - callback = (buf->b_efunc != NULL); - mutex_exit(&buf->b_evict_lock); - return (callback); -} - #ifdef ZFS_DEBUG int arc_referenced(arc_buf_t *buf) @@ -3767,7 +3768,7 @@ arc_write_done(zio_t *zio) ASSERT(hdr->b_acb == NULL); if (zio->io_error == 0) { - if (BP_IS_HOLE(zio->io_bp)) { + if (BP_IS_HOLE(zio->io_bp) || BP_IS_EMBEDDED(zio->io_bp)) { buf_discard_identity(hdr); } else { hdr->b_dva = *BP_IDENTITY(zio->io_bp); @@ -3779,10 +3780,10 @@ arc_write_done(zio_t *zio) } /* - * If the block to be written was all-zero, we may have - * compressed it away. In this case no write was performed - * so there will be no dva/birth/checksum. The buffer must - * therefore remain anonymous (and uncached). + * If the block to be written was all-zero or compressed enough to be + * embedded in the BP, no write was performed so there will be no + * dva/birth/checksum. The buffer must therefore remain anonymous + * (and uncached). */ if (!BUF_EMPTY(hdr)) { arc_buf_hdr_t *exists; @@ -3843,7 +3844,7 @@ arc_write(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, boolean_t l2arc_compress, const zio_prop_t *zp, arc_done_func_t *ready, arc_done_func_t *physdone, arc_done_func_t *done, void *private, zio_priority_t priority, - int zio_flags, const zbookmark_t *zb) + int zio_flags, const zbookmark_phys_t *zb) { arc_buf_hdr_t *hdr = buf->b_hdr; arc_write_callback_t *callback; @@ -4575,6 +4576,7 @@ l2arc_write_done(zio_t *zio) arc_buf_hdr_t *head, *ab, *ab_prev; l2arc_buf_hdr_t *abl2; kmutex_t *hash_lock; + int64_t bytes_dropped = 0; cb = zio->io_private; ASSERT(cb != NULL); @@ -4622,6 +4624,7 @@ l2arc_write_done(zio_t *zio) */ list_remove(buflist, ab); ARCSTAT_INCR(arcstat_l2_asize, -abl2->b_asize); + bytes_dropped += abl2->b_asize; ab->b_l2hdr = NULL; trim_map_free(abl2->b_dev->l2ad_vdev, abl2->b_daddr, ab->b_size, 0); @@ -4642,6 +4645,8 @@ l2arc_write_done(zio_t *zio) kmem_cache_free(hdr_cache, head); mutex_exit(&l2arc_buflist_mtx); + vdev_space_update(dev->l2ad_vdev, -bytes_dropped, 0, 0); + l2arc_do_free_on_write(); kmem_free(cb, sizeof (l2arc_write_callback_t)); @@ -4781,6 +4786,7 @@ l2arc_evict(l2arc_dev_t *dev, uint64_t distance, boolean_t all) arc_buf_hdr_t *ab, *ab_prev; kmutex_t *hash_lock; uint64_t taddr; + int64_t bytes_evicted = 0; buflist = dev->l2ad_buflist; @@ -4879,6 +4885,7 @@ l2arc_evict(l2arc_dev_t *dev, uint64_t distance, boolean_t all) if (ab->b_l2hdr != NULL) { abl2 = ab->b_l2hdr; ARCSTAT_INCR(arcstat_l2_asize, -abl2->b_asize); + bytes_evicted += abl2->b_asize; ab->b_l2hdr = NULL; kmem_free(abl2, sizeof (l2arc_buf_hdr_t)); ARCSTAT_INCR(arcstat_l2_size, -ab->b_size); @@ -4895,7 +4902,7 @@ l2arc_evict(l2arc_dev_t *dev, uint64_t distance, boolean_t all) } mutex_exit(&l2arc_buflist_mtx); - vdev_space_update(dev->l2ad_vdev, -(taddr - dev->l2ad_evict), 0, 0); + vdev_space_update(dev->l2ad_vdev, -bytes_evicted, 0, 0); dev->l2ad_evict = taddr; } @@ -5148,15 +5155,13 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz, ARCSTAT_INCR(arcstat_l2_write_bytes, write_asize); ARCSTAT_INCR(arcstat_l2_size, write_sz); ARCSTAT_INCR(arcstat_l2_asize, write_asize); - vdev_space_update(dev->l2ad_vdev, write_psize, 0, 0); + vdev_space_update(dev->l2ad_vdev, write_asize, 0, 0); /* * Bump device hand to the device start if it is approaching the end. * l2arc_evict() will already have evicted ahead for this case. */ if (dev->l2ad_hand >= (dev->l2ad_end - target_sz)) { - vdev_space_update(dev->l2ad_vdev, - dev->l2ad_end - dev->l2ad_hand, 0, 0); dev->l2ad_hand = dev->l2ad_start; dev->l2ad_evict = dev->l2ad_start; dev->l2ad_first = B_FALSE; @@ -5192,7 +5197,7 @@ static boolean_t l2arc_compress_buf(l2arc_buf_hdr_t *l2hdr) { void *cdata; - size_t csize, len; + size_t csize, len, rounded; ASSERT(l2hdr->b_compress == ZIO_COMPRESS_OFF); ASSERT(l2hdr->b_tmp_cdata != NULL); @@ -5200,7 +5205,13 @@ l2arc_compress_buf(l2arc_buf_hdr_t *l2hdr) len = l2hdr->b_asize; cdata = zio_data_buf_alloc(len); csize = zio_compress_data(ZIO_COMPRESS_LZ4, l2hdr->b_tmp_cdata, - cdata, l2hdr->b_asize, (size_t)(1ULL << l2hdr->b_dev->l2ad_vdev->vdev_ashift)); + cdata, l2hdr->b_asize); + + rounded = P2ROUNDUP(csize, (size_t)SPA_MINBLOCKSIZE); + if (rounded > csize) { + bzero((char *)cdata + csize, rounded - csize); + csize = rounded; + } if (csize == 0) { /* zero block, indicate that there's nothing to write */ diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/blkptr.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/blkptr.c new file mode 100644 index 00000000000..7e61dc96ff5 --- /dev/null +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/blkptr.c @@ -0,0 +1,119 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2013 by Delphix. All rights reserved. + */ + +#include +#include +#include + +/* + * Embedded-data Block Pointers + * + * Normally, block pointers point (via their DVAs) to a block which holds data. + * If the data that we need to store is very small, this is an inefficient + * use of space, because a block must be at minimum 1 sector (typically 512 + * bytes or 4KB). Additionally, reading these small blocks tends to generate + * more random reads. + * + * Embedded-data Block Pointers allow small pieces of data (the "payload", + * up to 112 bytes) to be stored in the block pointer itself, instead of + * being pointed to. The "Pointer" part of this name is a bit of a + * misnomer, as nothing is pointed to. + * + * BP_EMBEDDED_TYPE_DATA block pointers allow highly-compressible data to + * be embedded in the block pointer. The logic for this is handled in + * the SPA, by the zio pipeline. Therefore most code outside the zio + * pipeline doesn't need special-cases to handle these block pointers. + * + * See spa.h for details on the exact layout of embedded block pointers. + */ + +void +encode_embedded_bp_compressed(blkptr_t *bp, void *data, + enum zio_compress comp, int uncompressed_size, int compressed_size) +{ + uint64_t *bp64 = (uint64_t *)bp; + uint64_t w = 0; + uint8_t *data8 = data; + + ASSERT3U(compressed_size, <=, BPE_PAYLOAD_SIZE); + ASSERT(uncompressed_size == compressed_size || + comp != ZIO_COMPRESS_OFF); + ASSERT3U(comp, >=, ZIO_COMPRESS_OFF); + ASSERT3U(comp, <, ZIO_COMPRESS_FUNCTIONS); + + bzero(bp, sizeof (*bp)); + BP_SET_EMBEDDED(bp, B_TRUE); + BP_SET_COMPRESS(bp, comp); + BP_SET_BYTEORDER(bp, ZFS_HOST_BYTEORDER); + BPE_SET_LSIZE(bp, uncompressed_size); + BPE_SET_PSIZE(bp, compressed_size); + + /* + * Encode the byte array into the words of the block pointer. + * First byte goes into low bits of first word (little endian). + */ + for (int i = 0; i < compressed_size; i++) { + BF64_SET(w, (i % sizeof (w)) * NBBY, NBBY, data8[i]); + if (i % sizeof (w) == sizeof (w) - 1) { + /* we've reached the end of a word */ + ASSERT3P(bp64, <, bp + 1); + *bp64 = w; + bp64++; + if (!BPE_IS_PAYLOADWORD(bp, bp64)) + bp64++; + w = 0; + } + } + /* write last partial word */ + if (bp64 < (uint64_t *)(bp + 1)) + *bp64 = w; +} + +/* + * buf must be at least BPE_GET_PSIZE(bp) bytes long (which will never be + * more than BPE_PAYLOAD_SIZE bytes). + */ +void +decode_embedded_bp_compressed(const blkptr_t *bp, void *buf) +{ + int psize; + uint8_t *buf8 = buf; + uint64_t w = 0; + const uint64_t *bp64 = (const uint64_t *)bp; + + ASSERT(BP_IS_EMBEDDED(bp)); + + psize = BPE_GET_PSIZE(bp); + + /* + * Decode the words of the block pointer into the byte array. + * Low bits of first word are the first byte (little endian). + */ + for (int i = 0; i < psize; i++) { + if (i % sizeof (w) == 0) { + /* beginning of a word */ + ASSERT3P(bp64, <, bp + 1); + w = *bp64; + bp64++; + if (!BPE_IS_PAYLOADWORD(bp, bp64)) + bp64++; + } + buf8[i] = BF64_GET(w, (i % sizeof (w)) * NBBY, NBBY); + } +} diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c index 0fb597ba951..e75ae72f9e9 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c @@ -192,6 +192,13 @@ bpobj_close(bpobj_t *bpo) mutex_destroy(&bpo->bpo_lock); } +static boolean_t +bpobj_hasentries(bpobj_t *bpo) +{ + return (bpo->bpo_phys->bpo_num_blkptrs != 0 || + (bpo->bpo_havesubobj && bpo->bpo_phys->bpo_num_subobjs != 0)); +} + static int bpobj_iterate_impl(bpobj_t *bpo, bpobj_itor_t func, void *arg, dmu_tx_t *tx, boolean_t free) @@ -332,9 +339,11 @@ bpobj_iterate_impl(bpobj_t *bpo, bpobj_itor_t func, void *arg, dmu_tx_t *tx, out: /* If there are no entries, there should be no bytes. */ - ASSERT(bpo->bpo_phys->bpo_num_blkptrs > 0 || - (bpo->bpo_havesubobj && bpo->bpo_phys->bpo_num_subobjs > 0) || - bpo->bpo_phys->bpo_bytes == 0); + if (!bpobj_hasentries(bpo)) { + ASSERT0(bpo->bpo_phys->bpo_bytes); + ASSERT0(bpo->bpo_phys->bpo_comp); + ASSERT0(bpo->bpo_phys->bpo_uncomp); + } mutex_exit(&bpo->bpo_lock); return (err); @@ -377,7 +386,7 @@ bpobj_enqueue_subobj(bpobj_t *bpo, uint64_t subobj, dmu_tx_t *tx) VERIFY3U(0, ==, bpobj_open(&subbpo, bpo->bpo_os, subobj)); VERIFY3U(0, ==, bpobj_space(&subbpo, &used, &comp, &uncomp)); - if (used == 0) { + if (!bpobj_hasentries(&subbpo)) { /* No point in having an empty subobj. */ bpobj_close(&subbpo); bpobj_free(bpo->bpo_os, subobj, tx); @@ -453,13 +462,29 @@ bpobj_enqueue(bpobj_t *bpo, const blkptr_t *bp, dmu_tx_t *tx) ASSERT(!BP_IS_HOLE(bp)); ASSERT(bpo->bpo_object != dmu_objset_pool(bpo->bpo_os)->dp_empty_bpobj); + if (BP_IS_EMBEDDED(bp)) { + /* + * The bpobj will compress better without the payload. + * + * Note that we store EMBEDDED bp's because they have an + * uncompressed size, which must be accounted for. An + * alternative would be to add their size to bpo_uncomp + * without storing the bp, but that would create additional + * complications: bpo_uncomp would be inconsistent with the + * set of BP's stored, and bpobj_iterate() wouldn't visit + * all the space accounted for in the bpobj. + */ + bzero(&stored_bp, sizeof (stored_bp)); + stored_bp.blk_prop = bp->blk_prop; + stored_bp.blk_birth = bp->blk_birth; + } else if (!BP_GET_DEDUP(bp)) { + /* The bpobj will compress better without the checksum */ + bzero(&stored_bp.blk_cksum, sizeof (stored_bp.blk_cksum)); + } + /* We never need the fill count. */ stored_bp.blk_fill = 0; - /* The bpobj will compress better if we can leave off the checksum */ - if (!BP_GET_DEDUP(bp)) - bzero(&stored_bp.blk_cksum, sizeof (stored_bp.blk_cksum)); - mutex_enter(&bpo->bpo_lock); offset = bpo->bpo_phys->bpo_num_blkptrs * sizeof (stored_bp); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c index 83f365864de..c724ed07410 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c @@ -20,7 +20,7 @@ */ /* - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. */ #include @@ -102,13 +102,27 @@ bptree_free(objset_t *os, uint64_t obj, dmu_tx_t *tx) return (dmu_object_free(os, obj, tx)); } +boolean_t +bptree_is_empty(objset_t *os, uint64_t obj) +{ + dmu_buf_t *db; + bptree_phys_t *bt; + boolean_t rv; + + VERIFY0(dmu_bonus_hold(os, obj, FTAG, &db)); + bt = db->db_data; + rv = (bt->bt_begin == bt->bt_end); + dmu_buf_rele(db, FTAG); + return (rv); +} + void bptree_add(objset_t *os, uint64_t obj, blkptr_t *bp, uint64_t birth_txg, uint64_t bytes, uint64_t comp, uint64_t uncomp, dmu_tx_t *tx) { dmu_buf_t *db; bptree_phys_t *bt; - bptree_entry_phys_t bte; + bptree_entry_phys_t bte = { 0 }; /* * bptree objects are in the pool mos, therefore they can only be @@ -122,7 +136,6 @@ bptree_add(objset_t *os, uint64_t obj, blkptr_t *bp, uint64_t birth_txg, bte.be_birth_txg = birth_txg; bte.be_bp = *bp; - bzero(&bte.be_zb, sizeof (bte.be_zb)); dmu_write(os, obj, bt->bt_end * sizeof (bte), sizeof (bte), &bte, tx); dmu_buf_will_dirty(db, tx); @@ -136,7 +149,7 @@ bptree_add(objset_t *os, uint64_t obj, blkptr_t *bp, uint64_t birth_txg, /* ARGSUSED */ static int bptree_visit_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, - const zbookmark_t *zb, const dnode_phys_t *dnp, void *arg) + const zbookmark_phys_t *zb, const dnode_phys_t *dnp, void *arg) { int err; struct bptree_args *ba = arg; @@ -153,10 +166,27 @@ bptree_visit_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, return (err); } +/* + * If "free" is set: + * - It is assumed that "func" will be freeing the block pointers. + * - If "func" returns nonzero, the bookmark will be remembered and + * iteration will be restarted from this point on next invocation. + * - If an i/o error is encountered (e.g. "func" returns EIO or ECKSUM), + * bptree_iterate will remember the bookmark, continue traversing + * any additional entries, and return 0. + * + * If "free" is not set, traversal will stop and return an error if + * an i/o error is encountered. + * + * In either case, if zfs_free_leak_on_eio is set, i/o errors will be + * ignored and traversal will continue (i.e. TRAVERSE_HARD will be passed to + * traverse_dataset_destroyed()). + */ int bptree_iterate(objset_t *os, uint64_t obj, boolean_t free, bptree_itor_t func, void *arg, dmu_tx_t *tx) { + boolean_t ioerr = B_FALSE; int err; uint64_t i; dmu_buf_t *db; @@ -182,49 +212,82 @@ bptree_iterate(objset_t *os, uint64_t obj, boolean_t free, bptree_itor_t func, bptree_entry_phys_t bte; int flags = TRAVERSE_PREFETCH_METADATA | TRAVERSE_POST; - ASSERT(!free || i == ba.ba_phys->bt_begin); - err = dmu_read(os, obj, i * sizeof (bte), sizeof (bte), &bte, DMU_READ_NO_PREFETCH); if (err != 0) break; - if (zfs_recover) + if (zfs_free_leak_on_eio) flags |= TRAVERSE_HARD; + zfs_dbgmsg("bptree index %d: traversing from min_txg=%lld " + "bookmark %lld/%lld/%lld/%lld", + i, (longlong_t)bte.be_birth_txg, + (longlong_t)bte.be_zb.zb_objset, + (longlong_t)bte.be_zb.zb_object, + (longlong_t)bte.be_zb.zb_level, + (longlong_t)bte.be_zb.zb_blkid); err = traverse_dataset_destroyed(os->os_spa, &bte.be_bp, bte.be_birth_txg, &bte.be_zb, flags, bptree_visit_cb, &ba); if (free) { - if (err == ERESTART) { + /* + * The callback has freed the visited block pointers. + * Record our traversal progress on disk, either by + * updating this record's bookmark, or by logically + * removing this record by advancing bt_begin. + */ + if (err != 0) { /* save bookmark for future resume */ ASSERT3U(bte.be_zb.zb_objset, ==, ZB_DESTROYED_OBJSET); ASSERT0(bte.be_zb.zb_level); dmu_write(os, obj, i * sizeof (bte), sizeof (bte), &bte, tx); - break; - } - if (err != 0) { + if (err == EIO || err == ECKSUM || + err == ENXIO) { + /* + * Skip the rest of this tree and + * continue on to the next entry. + */ + err = 0; + ioerr = B_TRUE; + } else { + break; + } + } else if (ioerr) { /* - * We can not properly handle an i/o - * error, because the traversal code - * does not know how to resume from an - * arbitrary bookmark. + * This entry is finished, but there were + * i/o errors on previous entries, so we + * can't adjust bt_begin. Set this entry's + * be_birth_txg such that it will be + * treated as a no-op in future traversals. */ - zfs_panic_recover("error %u from " - "traverse_dataset_destroyed()", err); + bte.be_birth_txg = UINT64_MAX; + dmu_write(os, obj, i * sizeof (bte), + sizeof (bte), &bte, tx); } - ba.ba_phys->bt_begin++; - (void) dmu_free_range(os, obj, - i * sizeof (bte), sizeof (bte), tx); + if (!ioerr) { + ba.ba_phys->bt_begin++; + (void) dmu_free_range(os, obj, + i * sizeof (bte), sizeof (bte), tx); + } + } else if (err != 0) { + break; } } - ASSERT(!free || err != 0 || ba.ba_phys->bt_begin == ba.ba_phys->bt_end); + ASSERT(!free || err != 0 || ioerr || + ba.ba_phys->bt_begin == ba.ba_phys->bt_end); /* if all blocks are free there should be no used space */ if (ba.ba_phys->bt_begin == ba.ba_phys->bt_end) { + if (zfs_free_leak_on_eio) { + ba.ba_phys->bt_bytes = 0; + ba.ba_phys->bt_comp = 0; + ba.ba_phys->bt_uncomp = 0; + } + ASSERT0(ba.ba_phys->bt_bytes); ASSERT0(ba.ba_phys->bt_comp); ASSERT0(ba.ba_phys->bt_uncomp); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c index 7215194e082..b681ea4a605 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c @@ -40,6 +40,8 @@ #include #include #include +#include +#include #include /* @@ -179,8 +181,7 @@ dbuf_hash_insert(dmu_buf_impl_t *db) } /* - * Remove an entry from the hash table. This operation will - * fail if there are any existing holds on the db. + * Remove an entry from the hash table. It must be in the EVICTING state. */ static void dbuf_hash_remove(dmu_buf_impl_t *db) @@ -192,7 +193,7 @@ dbuf_hash_remove(dmu_buf_impl_t *db) dmu_buf_impl_t *dbf, **dbp; /* - * We musn't hold db_mtx to maintin lock ordering: + * We musn't hold db_mtx to maintain lock ordering: * DBUF_HASH_MUTEX > db_mtx. */ ASSERT(refcount_is_zero(&db->db_holds)); @@ -429,7 +430,6 @@ static void dbuf_set_data(dmu_buf_impl_t *db, arc_buf_t *buf) { ASSERT(MUTEX_HELD(&db->db_mtx)); - ASSERT(db->db_buf == NULL || !arc_has_callback(db->db_buf)); db->db_buf = buf; if (buf != NULL) { ASSERT(buf->b_data != NULL); @@ -519,7 +519,7 @@ static void dbuf_read_impl(dmu_buf_impl_t *db, zio_t *zio, uint32_t *flags) { dnode_t *dn; - zbookmark_t zb; + zbookmark_phys_t zb; uint32_t aflags = ARC_NOWAIT; DB_DNODE_ENTER(db); @@ -1351,6 +1351,12 @@ dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_t *tx) if (dr->dt.dl.dr_data != db->db_buf) VERIFY(arc_buf_remove_ref(dr->dt.dl.dr_data, db)); } + + if (db->db_level != 0) { + mutex_destroy(&dr->dt.di.dr_mtx); + list_destroy(&dr->dt.di.dr_children); + } + kmem_free(dr, sizeof (dbuf_dirty_record_t)); ASSERT(db->db_dirtycnt > 0); @@ -1435,6 +1441,38 @@ dbuf_fill_done(dmu_buf_impl_t *db, dmu_tx_t *tx) mutex_exit(&db->db_mtx); } +void +dmu_buf_write_embedded(dmu_buf_t *dbuf, void *data, + bp_embedded_type_t etype, enum zio_compress comp, + int uncompressed_size, int compressed_size, int byteorder, + dmu_tx_t *tx) +{ + dmu_buf_impl_t *db = (dmu_buf_impl_t *)dbuf; + struct dirty_leaf *dl; + dmu_object_type_t type; + + DB_DNODE_ENTER(db); + type = DB_DNODE(db)->dn_type; + DB_DNODE_EXIT(db); + + ASSERT0(db->db_level); + ASSERT(db->db_blkid != DMU_BONUS_BLKID); + + dmu_buf_will_not_fill(dbuf, tx); + + ASSERT3U(db->db_last_dirty->dr_txg, ==, tx->tx_txg); + dl = &db->db_last_dirty->dt.dl; + encode_embedded_bp_compressed(&dl->dr_overridden_by, + data, comp, uncompressed_size, compressed_size); + BPE_SET_ETYPE(&dl->dr_overridden_by, etype); + BP_SET_TYPE(&dl->dr_overridden_by, type); + BP_SET_LEVEL(&dl->dr_overridden_by, 0); + BP_SET_BYTEORDER(&dl->dr_overridden_by, byteorder); + + dl->dr_override_state = DR_OVERRIDDEN; + dl->dr_overridden_by.blk_birth = db->db_last_dirty->dr_txg; +} + /* * Directly assign a provided arc buf to a given dbuf if it's not referenced * by anybody except our caller. Otherwise copy arcbuf's contents to dbuf. @@ -1504,12 +1542,15 @@ dbuf_assign_arcbuf(dmu_buf_impl_t *db, arc_buf_t *buf, dmu_tx_t *tx) * when we are not holding the dn_dbufs_mtx, we can't clear the * entry in the dn_dbufs list. We have to wait until dbuf_destroy() * in this case. For callers from the DMU we will usually see: - * dbuf_clear()->arc_buf_evict()->dbuf_do_evict()->dbuf_destroy() + * dbuf_clear()->arc_clear_callback()->dbuf_do_evict()->dbuf_destroy() * For the arc callback, we will usually see: * dbuf_do_evict()->dbuf_clear();dbuf_destroy() * Sometimes, though, we will get a mix of these two: - * DMU: dbuf_clear()->arc_buf_evict() + * DMU: dbuf_clear()->arc_clear_callback() * ARC: dbuf_do_evict()->dbuf_destroy() + * + * This routine will dissociate the dbuf from the arc, by calling + * arc_clear_callback(), but will not evict the data from the ARC. */ void dbuf_clear(dmu_buf_impl_t *db) @@ -1517,7 +1558,7 @@ dbuf_clear(dmu_buf_impl_t *db) dnode_t *dn; dmu_buf_impl_t *parent = db->db_parent; dmu_buf_impl_t *dndb; - int dbuf_gone = FALSE; + boolean_t dbuf_gone = B_FALSE; ASSERT(MUTEX_HELD(&db->db_mtx)); ASSERT(refcount_is_zero(&db->db_holds)); @@ -1563,7 +1604,7 @@ dbuf_clear(dmu_buf_impl_t *db) } if (db->db_buf) - dbuf_gone = arc_buf_evict(db->db_buf); + dbuf_gone = arc_clear_callback(db->db_buf); if (!dbuf_gone) mutex_exit(&db->db_mtx); @@ -1731,8 +1772,7 @@ dbuf_create(dnode_t *dn, uint8_t level, uint64_t blkid, static int dbuf_do_evict(void *private) { - arc_buf_t *buf = private; - dmu_buf_impl_t *db = buf->b_private; + dmu_buf_impl_t *db = private; if (!MUTEX_HELD(&db->db_mtx)) mutex_enter(&db->db_mtx); @@ -1819,10 +1859,10 @@ dbuf_prefetch(dnode_t *dn, uint64_t blkid, zio_priority_t prio) } if (dbuf_findbp(dn, 0, blkid, TRUE, &db, &bp) == 0) { - if (bp && !BP_IS_HOLE(bp)) { + if (bp && !BP_IS_HOLE(bp) && !BP_IS_EMBEDDED(bp)) { dsl_dataset_t *ds = dn->dn_objset->os_dsl_dataset; uint32_t aflags = ARC_NOWAIT | ARC_PREFETCH; - zbookmark_t zb; + zbookmark_phys_t zb; SET_BOOKMARK(&zb, ds ? ds->ds_object : DMU_META_OBJSET, dn->dn_object, 0, blkid); @@ -2095,11 +2135,23 @@ dbuf_rele_and_unlock(dmu_buf_impl_t *db, void *tag) * block on-disk. If so, then we simply evict * ourselves. */ - if (!DBUF_IS_CACHEABLE(db) || - arc_buf_eviction_needed(db->db_buf)) + if (!DBUF_IS_CACHEABLE(db)) { + if (db->db_blkptr != NULL && + !BP_IS_HOLE(db->db_blkptr) && + !BP_IS_EMBEDDED(db->db_blkptr)) { + spa_t *spa = + dmu_objset_spa(db->db_objset); + blkptr_t bp = *db->db_blkptr; + dbuf_clear(db); + arc_freed(spa, &bp); + } else { + dbuf_clear(db); + } + } else if (arc_buf_eviction_needed(db->db_buf)) { dbuf_clear(db); - else + } else { mutex_exit(&db->db_mtx); + } } } else { mutex_exit(&db->db_mtx); @@ -2455,7 +2507,7 @@ dbuf_write_ready(zio_t *zio, arc_buf_t *buf, void *vdb) uint64_t fill = 0; int i; - ASSERT(db->db_blkptr == bp); + ASSERT3P(db->db_blkptr, ==, bp); DB_DNODE_ENTER(db); dn = DB_DNODE(db); @@ -2467,7 +2519,8 @@ dbuf_write_ready(zio_t *zio, arc_buf_t *buf, void *vdb) ASSERT((db->db_blkid != DMU_SPILL_BLKID && BP_GET_TYPE(bp) == dn->dn_type) || (db->db_blkid == DMU_SPILL_BLKID && - BP_GET_TYPE(bp) == dn->dn_bonustype)); + BP_GET_TYPE(bp) == dn->dn_bonustype) || + BP_IS_EMBEDDED(bp)); ASSERT(BP_GET_LEVEL(bp) == db->db_level); } @@ -2508,12 +2561,13 @@ dbuf_write_ready(zio_t *zio, arc_buf_t *buf, void *vdb) for (i = db->db.db_size >> SPA_BLKPTRSHIFT; i > 0; i--, ibp++) { if (BP_IS_HOLE(ibp)) continue; - fill += ibp->blk_fill; + fill += BP_GET_FILL(ibp); } } DB_DNODE_EXIT(db); - bp->blk_fill = fill; + if (!BP_IS_EMBEDDED(bp)) + bp->blk_fill = fill; mutex_exit(&db->db_mtx); } @@ -2625,7 +2679,8 @@ dbuf_write_done(zio_t *zio, arc_buf_t *buf, void *vdb) dn->dn_phys->dn_maxblkid >> (db->db_level * epbs)); ASSERT3U(BP_GET_LSIZE(db->db_blkptr), ==, db->db.db_size); - arc_set_callback(db->db_buf, dbuf_do_evict, db); + if (!arc_released(db->db_buf)) + arc_set_callback(db->db_buf, dbuf_do_evict, db); } DB_DNODE_EXIT(db); mutex_destroy(&dr->dt.di.dr_mtx); @@ -2688,7 +2743,7 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_buf_t *data, dmu_tx_t *tx) objset_t *os; dmu_buf_impl_t *parent = db->db_parent; uint64_t txg = tx->tx_txg; - zbookmark_t zb; + zbookmark_phys_t zb; zio_prop_t zp; zio_t *zio; int wp_flag = 0; @@ -2751,10 +2806,16 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_buf_t *data, dmu_tx_t *tx) dmu_write_policy(os, dn, db->db_level, wp_flag, &zp); DB_DNODE_EXIT(db); - if (db->db_level == 0 && dr->dt.dl.dr_override_state == DR_OVERRIDDEN) { - ASSERT(db->db_state != DB_NOFILL); + if (db->db_level == 0 && + dr->dt.dl.dr_override_state == DR_OVERRIDDEN) { + /* + * The BP for this block has been provided by open context + * (by dmu_sync() or dmu_buf_write_embedded()). + */ + void *contents = (data != NULL) ? data->b_data : NULL; + dr->dr_zio = zio_write(zio, os->os_spa, txg, - db->db_blkptr, data->b_data, arc_buf_size(data), &zp, + db->db_blkptr, contents, db->db.db_size, &zp, dbuf_write_override_ready, NULL, dbuf_write_override_done, dr, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, &zb); mutex_enter(&db->db_mtx); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c index 7863e6a6601..df5b77e14e8 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c @@ -44,8 +44,7 @@ int zfs_dedup_prefetch = 1; SYSCTL_DECL(_vfs_zfs); SYSCTL_NODE(_vfs_zfs, OID_AUTO, dedup, CTLFLAG_RW, 0, "ZFS DEDUP"); -TUNABLE_INT("vfs.zfs.dedup.prefetch", &zfs_dedup_prefetch); -SYSCTL_INT(_vfs_zfs_dedup, OID_AUTO, prefetch, CTLFLAG_RW, &zfs_dedup_prefetch, +SYSCTL_INT(_vfs_zfs_dedup, OID_AUTO, prefetch, CTLFLAG_RWTUN, &zfs_dedup_prefetch, 0, "Enable/disable prefetching of dedup-ed blocks which are going to be freed"); static const ddt_ops_t *ddt_ops[DDT_TYPES] = { diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c index 7da25c7eed9..e3558f8244a 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c @@ -20,10 +20,11 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. */ /* Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ /* Copyright (c) 2013, Joyent, Inc. All rights reserved. */ +/* Copyright (c) 2014, Nexenta Systems, Inc. All rights reserved. */ #include #include @@ -44,6 +45,7 @@ #include #include #include +#include #ifdef _KERNEL #include #include @@ -54,7 +56,6 @@ */ int zfs_nopwrite_enabled = 1; SYSCTL_DECL(_vfs_zfs); -TUNABLE_INT("vfs.zfs.nopwrite_enabled", &zfs_nopwrite_enabled); SYSCTL_INT(_vfs_zfs, OID_AUTO, nopwrite_enabled, CTLFLAG_RDTUN, &zfs_nopwrite_enabled, 0, "Enable nopwrite feature"); @@ -129,17 +130,13 @@ const dmu_object_byteswap_info_t dmu_ot_byteswap[DMU_BSWAP_NUMFUNCS] = { }; int -dmu_buf_hold(objset_t *os, uint64_t object, uint64_t offset, - void *tag, dmu_buf_t **dbp, int flags) +dmu_buf_hold_noread(objset_t *os, uint64_t object, uint64_t offset, + void *tag, dmu_buf_t **dbp) { dnode_t *dn; uint64_t blkid; dmu_buf_impl_t *db; int err; - int db_flags = DB_RF_CANFAIL; - - if (flags & DMU_READ_NO_PREFETCH) - db_flags |= DB_RF_NOPREFETCH; err = dnode_hold(os, object, FTAG, &dn); if (err) @@ -148,18 +145,37 @@ dmu_buf_hold(objset_t *os, uint64_t object, uint64_t offset, rw_enter(&dn->dn_struct_rwlock, RW_READER); db = dbuf_hold(dn, blkid, tag); rw_exit(&dn->dn_struct_rwlock); + dnode_rele(dn, FTAG); + if (db == NULL) { - err = SET_ERROR(EIO); - } else { + *dbp = NULL; + return (SET_ERROR(EIO)); + } + + *dbp = &db->db; + return (err); +} + +int +dmu_buf_hold(objset_t *os, uint64_t object, uint64_t offset, + void *tag, dmu_buf_t **dbp, int flags) +{ + int err; + int db_flags = DB_RF_CANFAIL; + + if (flags & DMU_READ_NO_PREFETCH) + db_flags |= DB_RF_NOPREFETCH; + + err = dmu_buf_hold_noread(os, object, offset, tag, dbp); + if (err == 0) { + dmu_buf_impl_t *db = (dmu_buf_impl_t *)(*dbp); err = dbuf_read(db, NULL, db_flags); - if (err) { + if (err != 0) { dbuf_rele(db, tag); - db = NULL; + *dbp = NULL; } } - dnode_rele(dn, FTAG); - *dbp = &db->db; /* NULL db plus first field offset is NULL */ return (err); } @@ -656,6 +672,12 @@ dmu_free_long_range_impl(objset_t *os, dnode_t *dn, uint64_t offset, dmu_tx_t *tx = dmu_tx_create(os); dmu_tx_hold_free(tx, dn->dn_object, chunk_begin, chunk_end - chunk_begin); + + /* + * Mark this transaction as typically resulting in a net + * reduction in space used. + */ + dmu_tx_mark_netfree(tx); err = dmu_tx_assign(tx, TXG_WAIT); if (err) { dmu_tx_abort(tx); @@ -707,6 +729,7 @@ dmu_free_long_object(objset_t *os, uint64_t object) tx = dmu_tx_create(os); dmu_tx_hold_bonus(tx, object); dmu_tx_hold_free(tx, object, 0, DMU_OBJECT_END); + dmu_tx_mark_netfree(tx); err = dmu_tx_assign(tx, TXG_WAIT); if (err == 0) { err = dmu_object_free(os, object, tx); @@ -855,6 +878,25 @@ dmu_prealloc(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, dmu_buf_rele_array(dbp, numbufs, FTAG); } +void +dmu_write_embedded(objset_t *os, uint64_t object, uint64_t offset, + void *data, uint8_t etype, uint8_t comp, int uncompressed_size, + int compressed_size, int byteorder, dmu_tx_t *tx) +{ + dmu_buf_t *db; + + ASSERT3U(etype, <, NUM_BP_EMBEDDED_TYPES); + ASSERT3U(comp, <, ZIO_COMPRESS_FUNCTIONS); + VERIFY0(dmu_buf_hold_noread(os, object, offset, + FTAG, &db)); + + dmu_buf_write_embedded(db, + data, (bp_embedded_type_t)etype, (enum zio_compress)comp, + uncompressed_size, compressed_size, byteorder, tx); + + dmu_buf_rele(db, FTAG); +} + /* * DMU support for xuio */ @@ -1332,7 +1374,7 @@ dmu_sync_ready(zio_t *zio, arc_buf_t *buf, void *varg) * block size still needs to be known for replay. */ BP_SET_LSIZE(bp, db->db_size); - } else { + } else if (!BP_IS_EMBEDDED(bp)) { ASSERT(BP_GET_LEVEL(bp) == 0); bp->blk_fill = 1; } @@ -1414,7 +1456,7 @@ dmu_sync_late_arrival_done(zio_t *zio) static int dmu_sync_late_arrival(zio_t *pio, objset_t *os, dmu_sync_cb_t *done, zgd_t *zgd, - zio_prop_t *zp, zbookmark_t *zb) + zio_prop_t *zp, zbookmark_phys_t *zb) { dmu_sync_arg_t *dsa; dmu_tx_t *tx; @@ -1475,7 +1517,7 @@ dmu_sync(zio_t *pio, uint64_t txg, dmu_sync_cb_t *done, zgd_t *zgd) dsl_dataset_t *ds = os->os_dsl_dataset; dbuf_dirty_record_t *dr; dmu_sync_arg_t *dsa; - zbookmark_t zb; + zbookmark_phys_t zb; zio_prop_t zp; dnode_t *dn; @@ -1603,9 +1645,15 @@ dmu_object_set_checksum(objset_t *os, uint64_t object, uint8_t checksum, { dnode_t *dn; - /* XXX assumes dnode_hold will not get an i/o error */ - (void) dnode_hold(os, object, FTAG, &dn); - ASSERT(checksum < ZIO_CHECKSUM_FUNCTIONS); + /* + * Send streams include each object's checksum function. This + * check ensures that the receiving system can understand the + * checksum function transmitted. + */ + ASSERT3U(checksum, <, ZIO_CHECKSUM_LEGACY_FUNCTIONS); + + VERIFY0(dnode_hold(os, object, FTAG, &dn)); + ASSERT3U(checksum, <, ZIO_CHECKSUM_FUNCTIONS); dn->dn_checksum = checksum; dnode_setdirty(dn, tx); dnode_rele(dn, FTAG); @@ -1617,19 +1665,29 @@ dmu_object_set_compress(objset_t *os, uint64_t object, uint8_t compress, { dnode_t *dn; - /* XXX assumes dnode_hold will not get an i/o error */ - (void) dnode_hold(os, object, FTAG, &dn); - ASSERT(compress < ZIO_COMPRESS_FUNCTIONS); + /* + * Send streams include each object's compression function. This + * check ensures that the receiving system can understand the + * compression function transmitted. + */ + ASSERT3U(compress, <, ZIO_COMPRESS_LEGACY_FUNCTIONS); + + VERIFY0(dnode_hold(os, object, FTAG, &dn)); dn->dn_compress = compress; dnode_setdirty(dn, tx); dnode_rele(dn, FTAG); } int zfs_mdcomp_disable = 0; -TUNABLE_INT("vfs.zfs.mdcomp_disable", &zfs_mdcomp_disable); -SYSCTL_INT(_vfs_zfs, OID_AUTO, mdcomp_disable, CTLFLAG_RW, +SYSCTL_INT(_vfs_zfs, OID_AUTO, mdcomp_disable, CTLFLAG_RWTUN, &zfs_mdcomp_disable, 0, "Disable metadata compression"); +/* + * When the "redundant_metadata" property is set to "most", only indirect + * blocks of this level and higher will have an additional ditto block. + */ +int zfs_redundant_metadata_most_ditto_level = 2; + void dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp, zio_prop_t *zp) { @@ -1656,8 +1714,16 @@ dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp, zio_prop_t *zp) * XXX -- we should design a compression algorithm * that specializes in arrays of bps. */ - compress = zfs_mdcomp_disable ? ZIO_COMPRESS_EMPTY : - ZIO_COMPRESS_LZJB; + boolean_t lz4_ac = spa_feature_is_active(os->os_spa, + SPA_FEATURE_LZ4_COMPRESS); + + if (zfs_mdcomp_disable) { + compress = ZIO_COMPRESS_EMPTY; + } else if (lz4_ac) { + compress = ZIO_COMPRESS_LZ4; + } else { + compress = ZIO_COMPRESS_LZJB; + } /* * Metadata always gets checksummed. If the data @@ -1669,6 +1735,13 @@ dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp, zio_prop_t *zp) if (zio_checksum_table[checksum].ci_correctable < 1 || zio_checksum_table[checksum].ci_eck) checksum = ZIO_CHECKSUM_FLETCHER_4; + + if (os->os_redundant_metadata == ZFS_REDUNDANT_METADATA_ALL || + (os->os_redundant_metadata == + ZFS_REDUNDANT_METADATA_MOST && + (level >= zfs_redundant_metadata_most_ditto_level || + DMU_OT_IS_METADATA(type) || (wp & WP_SPILL)))) + copies++; } else if (wp & WP_NOFILL) { ASSERT(level == 0); @@ -1716,7 +1789,7 @@ dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp, zio_prop_t *zp) zp->zp_compress = compress; zp->zp_type = (wp & WP_SPILL) ? dn->dn_bonustype : type; zp->zp_level = level; - zp->zp_copies = MIN(copies + ismd, spa_max_replication(os->os_spa)); + zp->zp_copies = MIN(copies, spa_max_replication(os->os_spa)); zp->zp_dedup = dedup; zp->zp_dedup_verify = dedup && dedup_verify; zp->zp_nopwrite = nopwrite; @@ -1776,7 +1849,7 @@ dmu_object_info_from_dnode(dnode_t *dn, dmu_object_info_t *doi) doi->doi_max_offset = (dn->dn_maxblkid + 1) * dn->dn_datablksz; doi->doi_fill_count = 0; for (int i = 0; i < dnp->dn_nblkptr; i++) - doi->doi_fill_count += dnp->dn_blkptr[i].blk_fill; + doi->doi_fill_count += BP_GET_FILL(&dnp->dn_blkptr[i]); mutex_exit(&dn->dn_mtx); rw_exit(&dn->dn_struct_rwlock); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_diff.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_diff.c index 7d5915926c9..39faeb5dae9 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_diff.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_diff.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #include @@ -130,7 +130,7 @@ report_dnode(struct diffarg *da, uint64_t object, dnode_phys_t *dnp) /* ARGSUSED */ static int diff_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, - const zbookmark_t *zb, const dnode_phys_t *dnp, void *arg) + const zbookmark_phys_t *zb, const dnode_phys_t *dnp, void *arg) { struct diffarg *da = arg; int err = 0; diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c index 0c4fe26e3ac..73b8e056cc8 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. */ @@ -115,13 +115,13 @@ dmu_objset_id(objset_t *os) return (ds ? ds->ds_object : 0); } -uint64_t +zfs_sync_type_t dmu_objset_syncprop(objset_t *os) { return (os->os_sync); } -uint64_t +zfs_logbias_op_t dmu_objset_logbias(objset_t *os) { return (os->os_logbias); @@ -229,6 +229,20 @@ sync_changed_cb(void *arg, uint64_t newval) zil_set_sync(os->os_zil, newval); } +static void +redundant_metadata_changed_cb(void *arg, uint64_t newval) +{ + objset_t *os = arg; + + /* + * Inheritance and range checking should have been done by now. + */ + ASSERT(newval == ZFS_REDUNDANT_METADATA_ALL || + newval == ZFS_REDUNDANT_METADATA_MOST); + + os->os_redundant_metadata = newval; +} + static void logbias_changed_cb(void *arg, uint64_t newval) { @@ -272,7 +286,7 @@ dmu_objset_open_impl(spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp, os->os_rootbp = bp; if (!BP_IS_HOLE(os->os_rootbp)) { uint32_t aflags = ARC_WAIT; - zbookmark_t zb; + zbookmark_phys_t zb; SET_BOOKMARK(&zb, ds ? ds->ds_object : DMU_META_OBJSET, ZB_ROOT_OBJECT, ZB_ROOT_LEVEL, ZB_ROOT_BLKID); @@ -324,7 +338,7 @@ dmu_objset_open_impl(spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp, * default (fletcher2/off). Snapshots don't need to know about * checksum/compression/copies. */ - if (ds) { + if (ds != NULL) { err = dsl_prop_register(ds, zfs_prop_to_name(ZFS_PROP_PRIMARYCACHE), primary_cache_changed_cb, os); @@ -364,6 +378,12 @@ dmu_objset_open_impl(spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp, zfs_prop_to_name(ZFS_PROP_SYNC), sync_changed_cb, os); } + if (err == 0) { + err = dsl_prop_register(ds, + zfs_prop_to_name( + ZFS_PROP_REDUNDANT_METADATA), + redundant_metadata_changed_cb, os); + } } if (err != 0) { VERIFY(arc_buf_remove_ref(os->os_phys_buf, @@ -371,15 +391,15 @@ dmu_objset_open_impl(spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp, kmem_free(os, sizeof (objset_t)); return (err); } - } else if (ds == NULL) { + } else { /* It's the meta-objset. */ os->os_checksum = ZIO_CHECKSUM_FLETCHER_4; os->os_compress = ZIO_COMPRESS_LZJB; os->os_copies = spa_max_replication(spa); os->os_dedup_checksum = ZIO_CHECKSUM_OFF; - os->os_dedup_verify = 0; - os->os_logbias = 0; - os->os_sync = 0; + os->os_dedup_verify = B_FALSE; + os->os_logbias = ZFS_LOGBIAS_LATENCY; + os->os_sync = ZFS_SYNC_STANDARD; os->os_primary_cache = ZFS_CACHE_ALL; os->os_secondary_cache = ZFS_CACHE_ALL; } @@ -415,17 +435,6 @@ dmu_objset_open_impl(spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp, &os->os_groupused_dnode); } - /* - * We should be the only thread trying to do this because we - * have ds_opening_lock - */ - if (ds) { - mutex_enter(&ds->ds_lock); - ASSERT(ds->ds_objset == NULL); - ds->ds_objset = os; - mutex_exit(&ds->ds_lock); - } - *osp = os; return (0); } @@ -436,11 +445,19 @@ dmu_objset_from_ds(dsl_dataset_t *ds, objset_t **osp) int err = 0; mutex_enter(&ds->ds_opening_lock); - *osp = ds->ds_objset; - if (*osp == NULL) { + if (ds->ds_objset == NULL) { + objset_t *os; err = dmu_objset_open_impl(dsl_dataset_get_spa(ds), - ds, dsl_dataset_get_blkptr(ds), osp); + ds, dsl_dataset_get_blkptr(ds), &os); + + if (err == 0) { + mutex_enter(&ds->ds_lock); + ASSERT(ds->ds_objset == NULL); + ds->ds_objset = os; + mutex_exit(&ds->ds_lock); + } } + *osp = ds->ds_objset; mutex_exit(&ds->ds_opening_lock); return (err); } @@ -622,6 +639,9 @@ dmu_objset_evict(objset_t *os) VERIFY0(dsl_prop_unregister(ds, zfs_prop_to_name(ZFS_PROP_SYNC), sync_changed_cb, os)); + VERIFY0(dsl_prop_unregister(ds, + zfs_prop_to_name(ZFS_PROP_REDUNDANT_METADATA), + redundant_metadata_changed_cb, os)); } VERIFY0(dsl_prop_unregister(ds, zfs_prop_to_name(ZFS_PROP_PRIMARYCACHE), @@ -812,7 +832,8 @@ dmu_objset_create(const char *name, dmu_objset_type_t type, uint64_t flags, doca.doca_type = type; return (dsl_sync_task(name, - dmu_objset_create_check, dmu_objset_create_sync, &doca, 5)); + dmu_objset_create_check, dmu_objset_create_sync, &doca, + 5, ZFS_SPACE_CHECK_NORMAL)); } typedef struct dmu_objset_clone_arg { @@ -911,7 +932,8 @@ dmu_objset_clone(const char *clone, const char *origin) doca.doca_cred = CRED(); return (dsl_sync_task(clone, - dmu_objset_clone_check, dmu_objset_clone_sync, &doca, 5)); + dmu_objset_clone_check, dmu_objset_clone_sync, &doca, + 5, ZFS_SPACE_CHECK_NORMAL)); } int @@ -963,6 +985,7 @@ dmu_objset_write_ready(zio_t *zio, arc_buf_t *abuf, void *arg) objset_t *os = arg; dnode_phys_t *dnp = &os->os_phys->os_meta_dnode; + ASSERT(!BP_IS_EMBEDDED(bp)); ASSERT3P(bp, ==, os->os_rootbp); ASSERT3U(BP_GET_TYPE(bp), ==, DMU_OT_OBJSET); ASSERT0(BP_GET_LEVEL(bp)); @@ -975,7 +998,7 @@ dmu_objset_write_ready(zio_t *zio, arc_buf_t *abuf, void *arg) */ bp->blk_fill = 0; for (int i = 0; i < dnp->dn_nblkptr; i++) - bp->blk_fill += dnp->dn_blkptr[i].blk_fill; + bp->blk_fill += BP_GET_FILL(&dnp->dn_blkptr[i]); } /* ARGSUSED */ @@ -1002,7 +1025,7 @@ void dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx) { int txgoff; - zbookmark_t zb; + zbookmark_phys_t zb; zio_prop_t zp; zio_t *zio; list_t *list; diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c index d3efa553e4b..7c5b5f3deff 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright (c) 2014, Joyent, Inc. All rights reserved. * Copyright (c) 2012, Martin Matuska . All rights reserved. */ @@ -49,7 +49,14 @@ #include #include #include +#include #include +#include + +#ifdef __FreeBSD__ +#undef dump_write +#define dump_write dmu_dump_write +#endif /* Set this tunable to TRUE to replace corrupt data with 0x2f5baddb10c */ int zfs_send_corrupt_data = B_FALSE; @@ -184,7 +191,7 @@ dump_free(dmu_sendarg_t *dsp, uint64_t object, uint64_t offset, } static int -dump_data(dmu_sendarg_t *dsp, dmu_object_type_t type, +dump_write(dmu_sendarg_t *dsp, dmu_object_type_t type, uint64_t object, uint64_t offset, int blksz, const blkptr_t *bp, void *data) { struct drr_write *drrw = &(dsp->dsa_drr->drr_u.drr_write); @@ -219,13 +226,22 @@ dump_data(dmu_sendarg_t *dsp, dmu_object_type_t type, drrw->drr_offset = offset; drrw->drr_length = blksz; drrw->drr_toguid = dsp->dsa_toguid; - drrw->drr_checksumtype = BP_GET_CHECKSUM(bp); - if (zio_checksum_table[drrw->drr_checksumtype].ci_dedup) - drrw->drr_checksumflags |= DRR_CHECKSUM_DEDUP; - DDK_SET_LSIZE(&drrw->drr_key, BP_GET_LSIZE(bp)); - DDK_SET_PSIZE(&drrw->drr_key, BP_GET_PSIZE(bp)); - DDK_SET_COMPRESS(&drrw->drr_key, BP_GET_COMPRESS(bp)); - drrw->drr_key.ddk_cksum = bp->blk_cksum; + if (BP_IS_EMBEDDED(bp)) { + /* + * There's no pre-computed checksum of embedded BP's, so + * (like fletcher4-checkummed blocks) userland will have + * to compute a dedup-capable checksum itself. + */ + drrw->drr_checksumtype = ZIO_CHECKSUM_OFF; + } else { + drrw->drr_checksumtype = BP_GET_CHECKSUM(bp); + if (zio_checksum_table[drrw->drr_checksumtype].ci_dedup) + drrw->drr_checksumflags |= DRR_CHECKSUM_DEDUP; + DDK_SET_LSIZE(&drrw->drr_key, BP_GET_LSIZE(bp)); + DDK_SET_PSIZE(&drrw->drr_key, BP_GET_PSIZE(bp)); + DDK_SET_COMPRESS(&drrw->drr_key, BP_GET_COMPRESS(bp)); + drrw->drr_key.ddk_cksum = bp->blk_cksum; + } if (dump_bytes(dsp, dsp->dsa_drr, sizeof (dmu_replay_record_t)) != 0) return (SET_ERROR(EINTR)); @@ -234,6 +250,43 @@ dump_data(dmu_sendarg_t *dsp, dmu_object_type_t type, return (0); } +static int +dump_write_embedded(dmu_sendarg_t *dsp, uint64_t object, uint64_t offset, + int blksz, const blkptr_t *bp) +{ + char buf[BPE_PAYLOAD_SIZE]; + struct drr_write_embedded *drrw = + &(dsp->dsa_drr->drr_u.drr_write_embedded); + + if (dsp->dsa_pending_op != PENDING_NONE) { + if (dump_bytes(dsp, dsp->dsa_drr, + sizeof (dmu_replay_record_t)) != 0) + return (EINTR); + dsp->dsa_pending_op = PENDING_NONE; + } + + ASSERT(BP_IS_EMBEDDED(bp)); + + bzero(dsp->dsa_drr, sizeof (dmu_replay_record_t)); + dsp->dsa_drr->drr_type = DRR_WRITE_EMBEDDED; + drrw->drr_object = object; + drrw->drr_offset = offset; + drrw->drr_length = blksz; + drrw->drr_toguid = dsp->dsa_toguid; + drrw->drr_compression = BP_GET_COMPRESS(bp); + drrw->drr_etype = BPE_GET_ETYPE(bp); + drrw->drr_lsize = BPE_GET_LSIZE(bp); + drrw->drr_psize = BPE_GET_PSIZE(bp); + + decode_embedded_bp_compressed(bp, buf); + + if (dump_bytes(dsp, dsp->dsa_drr, sizeof (dmu_replay_record_t)) != 0) + return (EINTR); + if (dump_bytes(dsp, buf, P2ROUNDUP(drrw->drr_psize, 8)) != 0) + return (EINTR); + return (0); +} + static int dump_spill(dmu_sendarg_t *dsp, uint64_t object, int blksz, void *data) { @@ -354,6 +407,33 @@ dump_dnode(dmu_sendarg_t *dsp, uint64_t object, dnode_phys_t *dnp) return (0); } +static boolean_t +backup_do_embed(dmu_sendarg_t *dsp, const blkptr_t *bp) +{ + if (!BP_IS_EMBEDDED(bp)) + return (B_FALSE); + + /* + * Compression function must be legacy, or explicitly enabled. + */ + if ((BP_GET_COMPRESS(bp) >= ZIO_COMPRESS_LEGACY_FUNCTIONS && + !(dsp->dsa_featureflags & DMU_BACKUP_FEATURE_EMBED_DATA_LZ4))) + return (B_FALSE); + + /* + * Embed type must be explicitly enabled. + */ + switch (BPE_GET_ETYPE(bp)) { + case BP_EMBEDDED_TYPE_DATA: + if (dsp->dsa_featureflags & DMU_BACKUP_FEATURE_EMBED_DATA) + return (B_TRUE); + break; + default: + return (B_FALSE); + } + return (B_FALSE); +} + #define BP_SPAN(dnp, level) \ (((uint64_t)dnp->dn_datablkszsec) << (SPA_MINBLOCKSHIFT + \ (level) * (dnp->dn_indblkshift - SPA_BLKPTRSHIFT))) @@ -361,7 +441,7 @@ dump_dnode(dmu_sendarg_t *dsp, uint64_t object, dnode_phys_t *dnp) /* ARGSUSED */ static int backup_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, - const zbookmark_t *zb, const dnode_phys_t *dnp, void *arg) + const zbookmark_phys_t *zb, const dnode_phys_t *dnp, void *arg) { dmu_sendarg_t *dsp = arg; dmu_object_type_t type = bp ? BP_GET_TYPE(bp) : DMU_OT_NONE; @@ -422,11 +502,17 @@ backup_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, err = dump_spill(dsp, zb->zb_object, blksz, abuf->b_data); (void) arc_buf_remove_ref(abuf, &abuf); + } else if (backup_do_embed(dsp, bp)) { + /* it's an embedded level-0 block of a regular object */ + int blksz = dnp->dn_datablkszsec << SPA_MINBLOCKSHIFT; + err = dump_write_embedded(dsp, zb->zb_object, + zb->zb_blkid * blksz, blksz, bp); } else { /* it's a level-0 block of a regular object */ uint32_t aflags = ARC_WAIT; arc_buf_t *abuf; int blksz = BP_GET_LSIZE(bp); + ASSERT3U(blksz, ==, dnp->dn_datablkszsec << SPA_MINBLOCKSHIFT); ASSERT0(zb->zb_level); if (arc_read(NULL, spa, bp, arc_getbuf_func, &abuf, ZIO_PRIORITY_ASYNC_READ, ZIO_FLAG_CANFAIL, @@ -445,7 +531,7 @@ backup_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, } } - err = dump_data(dsp, type, zb->zb_object, zb->zb_blkid * blksz, + err = dump_write(dsp, type, zb->zb_object, zb->zb_blkid * blksz, blksz, bp, abuf->b_data); (void) arc_buf_remove_ref(abuf, &abuf); } @@ -459,12 +545,11 @@ backup_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, */ static int dmu_send_impl(void *tag, dsl_pool_t *dp, dsl_dataset_t *ds, + zfs_bookmark_phys_t *fromzb, boolean_t is_clone, boolean_t embedok, #ifdef illumos - zfs_bookmark_phys_t *fromzb, boolean_t is_clone, int outfd, - vnode_t *vp, offset_t *off) + int outfd, vnode_t *vp, offset_t *off) #else - zfs_bookmark_phys_t *fromzb, boolean_t is_clone, int outfd, - struct file *fp, offset_t *off) + int outfd, struct file *fp, offset_t *off) #endif { objset_t *os; @@ -472,6 +557,7 @@ dmu_send_impl(void *tag, dsl_pool_t *dp, dsl_dataset_t *ds, dmu_sendarg_t *dsp; int err; uint64_t fromtxg = 0; + uint64_t featureflags = 0; err = dmu_objset_from_ds(ds, &os); if (err != 0) { @@ -494,13 +580,23 @@ dmu_send_impl(void *tag, dsl_pool_t *dp, dsl_dataset_t *ds, return (SET_ERROR(EINVAL)); } if (version >= ZPL_VERSION_SA) { - DMU_SET_FEATUREFLAGS( - drr->drr_u.drr_begin.drr_versioninfo, - DMU_BACKUP_FEATURE_SA_SPILL); + featureflags |= DMU_BACKUP_FEATURE_SA_SPILL; } } #endif + if (embedok && + spa_feature_is_active(dp->dp_spa, SPA_FEATURE_EMBEDDED_DATA)) { + featureflags |= DMU_BACKUP_FEATURE_EMBED_DATA; + if (spa_feature_is_active(dp->dp_spa, SPA_FEATURE_LZ4_COMPRESS)) + featureflags |= DMU_BACKUP_FEATURE_EMBED_DATA_LZ4; + } else { + embedok = B_FALSE; + } + + DMU_SET_FEATUREFLAGS(drr->drr_u.drr_begin.drr_versioninfo, + featureflags); + drr->drr_u.drr_begin.drr_creation_time = ds->ds_phys->ds_creation_time; drr->drr_u.drr_begin.drr_type = dmu_objset_type(os); @@ -533,6 +629,7 @@ dmu_send_impl(void *tag, dsl_pool_t *dp, dsl_dataset_t *ds, ZIO_SET_CHECKSUM(&dsp->dsa_zc, 0, 0, 0, 0); dsp->dsa_pending_op = PENDING_NONE; dsp->dsa_incremental = (fromzb != NULL); + dsp->dsa_featureflags = featureflags; mutex_enter(&ds->ds_sendstream_lock); list_insert_head(&ds->ds_sendstreams, dsp); @@ -585,9 +682,9 @@ dmu_send_impl(void *tag, dsl_pool_t *dp, dsl_dataset_t *ds, int dmu_send_obj(const char *pool, uint64_t tosnap, uint64_t fromsnap, #ifdef illumos - int outfd, vnode_t *vp, offset_t *off) + boolean_t embedok, int outfd, vnode_t *vp, offset_t *off) #else - int outfd, struct file *fp, offset_t *off) + boolean_t embedok, int outfd, struct file *fp, offset_t *off) #endif { dsl_pool_t *dp; @@ -622,10 +719,10 @@ dmu_send_obj(const char *pool, uint64_t tosnap, uint64_t fromsnap, zb.zbm_guid = fromds->ds_phys->ds_guid; is_clone = (fromds->ds_dir != ds->ds_dir); dsl_dataset_rele(fromds, FTAG); - err = dmu_send_impl(FTAG, dp, ds, &zb, is_clone, + err = dmu_send_impl(FTAG, dp, ds, &zb, is_clone, embedok, outfd, fp, off); } else { - err = dmu_send_impl(FTAG, dp, ds, NULL, B_FALSE, + err = dmu_send_impl(FTAG, dp, ds, NULL, B_FALSE, embedok, outfd, fp, off); } dsl_dataset_rele(ds, FTAG); @@ -633,7 +730,7 @@ dmu_send_obj(const char *pool, uint64_t tosnap, uint64_t fromsnap, } int -dmu_send(const char *tosnap, const char *fromsnap, +dmu_send(const char *tosnap, const char *fromsnap, boolean_t embedok, #ifdef illumos int outfd, vnode_t *vp, offset_t *off) #else @@ -704,10 +801,10 @@ dmu_send(const char *tosnap, const char *fromsnap, dsl_pool_rele(dp, FTAG); return (err); } - err = dmu_send_impl(FTAG, dp, ds, &zb, is_clone, + err = dmu_send_impl(FTAG, dp, ds, &zb, is_clone, embedok, outfd, fp, off); } else { - err = dmu_send_impl(FTAG, dp, ds, NULL, B_FALSE, + err = dmu_send_impl(FTAG, dp, ds, NULL, B_FALSE, embedok, outfd, fp, off); } if (owned) @@ -877,6 +974,7 @@ dmu_recv_begin_check(void *arg, dmu_tx_t *tx) uint64_t fromguid = drrb->drr_fromguid; int flags = drrb->drr_flags; int error; + uint64_t featureflags = DMU_GET_FEATUREFLAGS(drrb->drr_versioninfo); dsl_dataset_t *ds; const char *tofs = drba->drba_cookie->drc_tofs; @@ -890,11 +988,22 @@ dmu_recv_begin_check(void *arg, dmu_tx_t *tx) return (SET_ERROR(EINVAL)); /* Verify pool version supports SA if SA_SPILL feature set */ - if ((DMU_GET_FEATUREFLAGS(drrb->drr_versioninfo) & - DMU_BACKUP_FEATURE_SA_SPILL) && - spa_version(dp->dp_spa) < SPA_VERSION_SA) { + if ((featureflags & DMU_BACKUP_FEATURE_SA_SPILL) && + spa_version(dp->dp_spa) < SPA_VERSION_SA) + return (SET_ERROR(ENOTSUP)); + + /* + * The receiving code doesn't know how to translate a WRITE_EMBEDDED + * record to a plan WRITE record, so the pool must have the + * EMBEDDED_DATA feature enabled if the stream has WRITE_EMBEDDED + * records. Same with WRITE_EMBEDDED records that use LZ4 compression. + */ + if ((featureflags & DMU_BACKUP_FEATURE_EMBED_DATA) && + !spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_EMBEDDED_DATA)) + return (SET_ERROR(ENOTSUP)); + if ((featureflags & DMU_BACKUP_FEATURE_EMBED_DATA_LZ4) && + !spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_LZ4_COMPRESS)) return (SET_ERROR(ENOTSUP)); - } error = dsl_dataset_hold(dp, tofs, FTAG, &ds); if (error == 0) { @@ -1087,7 +1196,7 @@ dmu_recv_begin(char *tofs, char *tosnap, struct drr_begin *drrb, drba.drba_cred = CRED(); return (dsl_sync_task(tofs, dmu_recv_begin_check, dmu_recv_begin_sync, - &drba, 5)); + &drba, 5, ZFS_SPACE_CHECK_NORMAL)); } struct restorearg { @@ -1214,7 +1323,6 @@ backup_byteswap(dmu_replay_record_t *drr) break; case DRR_OBJECT: DO64(drr_object.drr_object); - /* DO64(drr_object.drr_allocation_txg); */ DO32(drr_object.drr_type); DO32(drr_object.drr_bonustype); DO32(drr_object.drr_blksz); @@ -1252,6 +1360,14 @@ backup_byteswap(dmu_replay_record_t *drr) DO64(drr_write_byref.drr_key.ddk_cksum.zc_word[3]); DO64(drr_write_byref.drr_key.ddk_prop); break; + case DRR_WRITE_EMBEDDED: + DO64(drr_write_embedded.drr_object); + DO64(drr_write_embedded.drr_offset); + DO64(drr_write_embedded.drr_length); + DO64(drr_write_embedded.drr_toguid); + DO32(drr_write_embedded.drr_lsize); + DO32(drr_write_embedded.drr_psize); + break; case DRR_FREE: DO64(drr_free.drr_object); DO64(drr_free.drr_offset); @@ -1439,7 +1555,7 @@ restore_write_byref(struct restorearg *ra, objset_t *os, int err; guid_map_entry_t gmesrch; guid_map_entry_t *gmep; - avl_index_t where; + avl_index_t where; objset_t *ref_os = NULL; dmu_buf_t *dbp; @@ -1462,8 +1578,9 @@ restore_write_byref(struct restorearg *ra, objset_t *os, ref_os = os; } - if (err = dmu_buf_hold(ref_os, drrwbr->drr_refobject, - drrwbr->drr_refoffset, FTAG, &dbp, DMU_READ_PREFETCH)) + err = dmu_buf_hold(ref_os, drrwbr->drr_refobject, + drrwbr->drr_refoffset, FTAG, &dbp, DMU_READ_PREFETCH); + if (err != 0) return (err); tx = dmu_tx_create(os); @@ -1482,6 +1599,48 @@ restore_write_byref(struct restorearg *ra, objset_t *os, return (0); } +static int +restore_write_embedded(struct restorearg *ra, objset_t *os, + struct drr_write_embedded *drrwnp) +{ + dmu_tx_t *tx; + int err; + void *data; + + if (drrwnp->drr_offset + drrwnp->drr_length < drrwnp->drr_offset) + return (EINVAL); + + if (drrwnp->drr_psize > BPE_PAYLOAD_SIZE) + return (EINVAL); + + if (drrwnp->drr_etype >= NUM_BP_EMBEDDED_TYPES) + return (EINVAL); + if (drrwnp->drr_compression >= ZIO_COMPRESS_FUNCTIONS) + return (EINVAL); + + data = restore_read(ra, P2ROUNDUP(drrwnp->drr_psize, 8)); + if (data == NULL) + return (ra->err); + + tx = dmu_tx_create(os); + + dmu_tx_hold_write(tx, drrwnp->drr_object, + drrwnp->drr_offset, drrwnp->drr_length); + err = dmu_tx_assign(tx, TXG_WAIT); + if (err != 0) { + dmu_tx_abort(tx); + return (err); + } + + dmu_write_embedded(os, drrwnp->drr_object, + drrwnp->drr_offset, data, drrwnp->drr_etype, + drrwnp->drr_compression, drrwnp->drr_lsize, drrwnp->drr_psize, + ra->byteswap ^ ZFS_HOST_BYTEORDER, tx); + + dmu_tx_commit(tx); + return (0); +} + static int restore_spill(struct restorearg *ra, objset_t *os, struct drr_spill *drrs) { @@ -1677,6 +1836,13 @@ dmu_recv_stream(dmu_recv_cookie_t *drc, struct file *fp, offset_t *voffp, ra.err = restore_write_byref(&ra, os, &drrwbr); break; } + case DRR_WRITE_EMBEDDED: + { + struct drr_write_embedded drrwe = + drr->drr_u.drr_write_embedded; + ra.err = restore_write_embedded(&ra, os, &drrwe); + break; + } case DRR_FREE: { struct drr_free drrf = drr->drr_u.drr_free; @@ -1915,7 +2081,7 @@ dmu_recv_existing_end(dmu_recv_cookie_t *drc) error = dsl_sync_task(drc->drc_tofs, dmu_recv_end_check, dmu_recv_end_sync, drc, - dmu_recv_end_modified_blocks); + dmu_recv_end_modified_blocks, ZFS_SPACE_CHECK_NORMAL); if (error != 0) dmu_recv_cleanup_ds(drc); @@ -1929,7 +2095,7 @@ dmu_recv_new_end(dmu_recv_cookie_t *drc) error = dsl_sync_task(drc->drc_tofs, dmu_recv_end_check, dmu_recv_end_sync, drc, - dmu_recv_end_modified_blocks); + dmu_recv_end_modified_blocks, ZFS_SPACE_CHECK_NORMAL); if (error != 0) { dmu_recv_cleanup_ds(drc); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c index 1f64d73acdd..fb1ec0755cf 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #include @@ -55,9 +55,10 @@ typedef struct traverse_data { uint64_t td_objset; blkptr_t *td_rootbp; uint64_t td_min_txg; - zbookmark_t *td_resume; + zbookmark_phys_t *td_resume; int td_flags; prefetch_data_t *td_pfd; + boolean_t td_paused; blkptr_cb_t *td_func; void *td_arg; } traverse_data_t; @@ -71,7 +72,7 @@ static int traverse_zil_block(zilog_t *zilog, blkptr_t *bp, void *arg, uint64_t claim_txg) { traverse_data_t *td = arg; - zbookmark_t zb; + zbookmark_phys_t zb; if (BP_IS_HOLE(bp)) return (0); @@ -95,7 +96,7 @@ traverse_zil_record(zilog_t *zilog, lr_t *lrc, void *arg, uint64_t claim_txg) if (lrc->lrc_txtype == TX_WRITE) { lr_write_t *lr = (lr_write_t *)lrc; blkptr_t *bp = &lr->lr_blkptr; - zbookmark_t zb; + zbookmark_phys_t zb; if (BP_IS_HOLE(bp)) return (0); @@ -149,7 +150,7 @@ typedef enum resume_skip { */ static resume_skip_t resume_skip_check(traverse_data_t *td, const dnode_phys_t *dnp, - const zbookmark_t *zb) + const zbookmark_phys_t *zb) { if (td->td_resume != NULL && !ZB_IS_ZERO(td->td_resume)) { /* @@ -163,7 +164,6 @@ resume_skip_check(traverse_data_t *td, const dnode_phys_t *dnp, * If we found the block we're trying to resume from, zero * the bookmark out to indicate that we have resumed. */ - ASSERT3U(zb->zb_object, <=, td->td_resume->zb_object); if (bcmp(zb, td->td_resume, sizeof (*zb)) == 0) { bzero(td->td_resume, sizeof (*zb)); if (td->td_flags & TRAVERSE_POST) @@ -173,17 +173,9 @@ resume_skip_check(traverse_data_t *td, const dnode_phys_t *dnp, return (RESUME_SKIP_NONE); } -static void -traverse_pause(traverse_data_t *td, const zbookmark_t *zb) -{ - ASSERT(td->td_resume != NULL); - ASSERT0(zb->zb_level); - bcopy(zb, td->td_resume, sizeof (*td->td_resume)); -} - static void traverse_prefetch_metadata(traverse_data_t *td, - const blkptr_t *bp, const zbookmark_t *zb) + const blkptr_t *bp, const zbookmark_phys_t *zb) { uint32_t flags = ARC_NOWAIT | ARC_PREFETCH; @@ -205,16 +197,25 @@ traverse_prefetch_metadata(traverse_data_t *td, ZIO_PRIORITY_ASYNC_READ, ZIO_FLAG_CANFAIL, &flags, zb); } +static boolean_t +prefetch_needed(prefetch_data_t *pfd, const blkptr_t *bp) +{ + ASSERT(pfd->pd_flags & TRAVERSE_PREFETCH_DATA); + if (BP_IS_HOLE(bp) || BP_IS_EMBEDDED(bp) || + BP_GET_TYPE(bp) == DMU_OT_INTENT_LOG) + return (B_FALSE); + return (B_TRUE); +} + static int traverse_visitbp(traverse_data_t *td, const dnode_phys_t *dnp, - const blkptr_t *bp, const zbookmark_t *zb) + const blkptr_t *bp, const zbookmark_phys_t *zb) { - zbookmark_t czb; - int err = 0, lasterr = 0; + zbookmark_phys_t czb; + int err = 0; arc_buf_t *buf = NULL; prefetch_data_t *pd = td->td_pfd; boolean_t hard = td->td_flags & TRAVERSE_HARD; - boolean_t pause = B_FALSE; switch (resume_skip_check(td, dnp, zb)) { case RESUME_SKIP_ALL: @@ -251,14 +252,7 @@ traverse_visitbp(traverse_data_t *td, const dnode_phys_t *dnp, return (0); } - if (BP_IS_HOLE(bp)) { - err = td->td_func(td->td_spa, NULL, bp, zb, dnp, td->td_arg); - return (err); - } - - if (pd && !pd->pd_exited && - ((pd->pd_flags & TRAVERSE_PREFETCH_DATA) || - BP_GET_TYPE(bp) == DMU_OT_DNODE || BP_GET_LEVEL(bp) > 0)) { + if (pd != NULL && !pd->pd_exited && prefetch_needed(pd, bp)) { mutex_enter(&pd->pd_mtx); ASSERT(pd->pd_blks_fetched >= 0); while (pd->pd_blks_fetched == 0 && !pd->pd_exited) @@ -268,13 +262,18 @@ traverse_visitbp(traverse_data_t *td, const dnode_phys_t *dnp, mutex_exit(&pd->pd_mtx); } + if (BP_IS_HOLE(bp)) { + err = td->td_func(td->td_spa, NULL, bp, zb, dnp, td->td_arg); + if (err != 0) + goto post; + return (0); + } + if (td->td_flags & TRAVERSE_PRE) { err = td->td_func(td->td_spa, NULL, bp, zb, dnp, td->td_arg); if (err == TRAVERSE_VISIT_NO_CHILDREN) return (0); - if (err == ERESTART) - pause = B_TRUE; /* handle pausing at a common point */ if (err != 0) goto post; } @@ -288,7 +287,7 @@ traverse_visitbp(traverse_data_t *td, const dnode_phys_t *dnp, err = arc_read(NULL, td->td_spa, bp, arc_getbuf_func, &buf, ZIO_PRIORITY_ASYNC_READ, ZIO_FLAG_CANFAIL, &flags, zb); if (err != 0) - return (err); + goto post; cbp = buf->b_data; for (i = 0; i < epb; i++) { @@ -304,11 +303,8 @@ traverse_visitbp(traverse_data_t *td, const dnode_phys_t *dnp, zb->zb_level - 1, zb->zb_blkid * epb + i); err = traverse_visitbp(td, dnp, &cbp[i], &czb); - if (err != 0) { - if (!hard) - break; - lasterr = err; - } + if (err != 0) + break; } } else if (BP_GET_TYPE(bp) == DMU_OT_DNODE) { uint32_t flags = ARC_WAIT; @@ -318,7 +314,7 @@ traverse_visitbp(traverse_data_t *td, const dnode_phys_t *dnp, err = arc_read(NULL, td->td_spa, bp, arc_getbuf_func, &buf, ZIO_PRIORITY_ASYNC_READ, ZIO_FLAG_CANFAIL, &flags, zb); if (err != 0) - return (err); + goto post; dnp = buf->b_data; for (i = 0; i < epb; i++) { @@ -330,11 +326,8 @@ traverse_visitbp(traverse_data_t *td, const dnode_phys_t *dnp, for (i = 0; i < epb; i++) { err = traverse_dnode(td, &dnp[i], zb->zb_objset, zb->zb_blkid * epb + i); - if (err != 0) { - if (!hard) - break; - lasterr = err; - } + if (err != 0) + break; } } else if (BP_GET_TYPE(bp) == DMU_OT_OBJSET) { uint32_t flags = ARC_WAIT; @@ -344,7 +337,7 @@ traverse_visitbp(traverse_data_t *td, const dnode_phys_t *dnp, err = arc_read(NULL, td->td_spa, bp, arc_getbuf_func, &buf, ZIO_PRIORITY_ASYNC_READ, ZIO_FLAG_CANFAIL, &flags, zb); if (err != 0) - return (err); + goto post; osp = buf->b_data; dnp = &osp->os_meta_dnode; @@ -359,19 +352,11 @@ traverse_visitbp(traverse_data_t *td, const dnode_phys_t *dnp, err = traverse_dnode(td, dnp, zb->zb_objset, DMU_META_DNODE_OBJECT); - if (err && hard) { - lasterr = err; - err = 0; - } if (err == 0 && arc_buf_size(buf) >= sizeof (objset_phys_t)) { dnp = &osp->os_groupused_dnode; err = traverse_dnode(td, dnp, zb->zb_objset, DMU_GROUPUSED_OBJECT); } - if (err && hard) { - lasterr = err; - err = 0; - } if (err == 0 && arc_buf_size(buf) >= sizeof (objset_phys_t)) { dnp = &osp->os_userused_dnode; err = traverse_dnode(td, dnp, zb->zb_objset, @@ -383,19 +368,37 @@ traverse_visitbp(traverse_data_t *td, const dnode_phys_t *dnp, (void) arc_buf_remove_ref(buf, &buf); post: - if (err == 0 && (td->td_flags & TRAVERSE_POST)) { + if (err == 0 && (td->td_flags & TRAVERSE_POST)) err = td->td_func(td->td_spa, NULL, bp, zb, dnp, td->td_arg); - if (err == ERESTART) - pause = B_TRUE; + + if (hard && (err == EIO || err == ECKSUM)) { + /* + * Ignore this disk error as requested by the HARD flag, + * and continue traversal. + */ + err = 0; } - if (pause && td->td_resume != NULL) { - ASSERT3U(err, ==, ERESTART); - ASSERT(!hard); - traverse_pause(td, zb); + /* + * If we are stopping here, set td_resume. + */ + if (td->td_resume != NULL && err != 0 && !td->td_paused) { + td->td_resume->zb_objset = zb->zb_objset; + td->td_resume->zb_object = zb->zb_object; + td->td_resume->zb_level = 0; + /* + * If we have stopped on an indirect block (e.g. due to + * i/o error), we have not visited anything below it. + * Set the bookmark to the first level-0 block that we need + * to visit. This way, the resuming code does not need to + * deal with resuming from indirect blocks. + */ + td->td_resume->zb_blkid = zb->zb_blkid << + (zb->zb_level * (dnp->dn_indblkshift - SPA_BLKPTRSHIFT)); + td->td_paused = B_TRUE; } - return (err != 0 ? err : lasterr); + return (err); } static void @@ -403,7 +406,7 @@ prefetch_dnode_metadata(traverse_data_t *td, const dnode_phys_t *dnp, uint64_t objset, uint64_t object) { int j; - zbookmark_t czb; + zbookmark_phys_t czb; for (j = 0; j < dnp->dn_nblkptr; j++) { SET_BOOKMARK(&czb, objset, object, dnp->dn_nlevels - 1, j); @@ -420,36 +423,27 @@ static int traverse_dnode(traverse_data_t *td, const dnode_phys_t *dnp, uint64_t objset, uint64_t object) { - int j, err = 0, lasterr = 0; - zbookmark_t czb; - boolean_t hard = (td->td_flags & TRAVERSE_HARD); + int j, err = 0; + zbookmark_phys_t czb; for (j = 0; j < dnp->dn_nblkptr; j++) { SET_BOOKMARK(&czb, objset, object, dnp->dn_nlevels - 1, j); err = traverse_visitbp(td, dnp, &dnp->dn_blkptr[j], &czb); - if (err != 0) { - if (!hard) - break; - lasterr = err; - } + if (err != 0) + break; } if (dnp->dn_flags & DNODE_FLAG_SPILL_BLKPTR) { SET_BOOKMARK(&czb, objset, object, 0, DMU_SPILL_BLKID); err = traverse_visitbp(td, dnp, &dnp->dn_spill, &czb); - if (err != 0) { - if (!hard) - return (err); - lasterr = err; - } } - return (err != 0 ? err : lasterr); + return (err); } /* ARGSUSED */ static int traverse_prefetcher(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, - const zbookmark_t *zb, const dnode_phys_t *dnp, void *arg) + const zbookmark_phys_t *zb, const dnode_phys_t *dnp, void *arg) { prefetch_data_t *pfd = arg; uint32_t aflags = ARC_NOWAIT | ARC_PREFETCH; @@ -458,10 +452,7 @@ traverse_prefetcher(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, if (pfd->pd_cancel) return (SET_ERROR(EINTR)); - if (BP_IS_HOLE(bp) || - !((pfd->pd_flags & TRAVERSE_PREFETCH_DATA) || - BP_GET_TYPE(bp) == DMU_OT_DNODE || BP_GET_LEVEL(bp) > 0) || - BP_GET_TYPE(bp) == DMU_OT_INTENT_LOG) + if (!prefetch_needed(pfd, bp)) return (0); mutex_enter(&pfd->pd_mtx); @@ -482,7 +473,7 @@ traverse_prefetch_thread(void *arg) { traverse_data_t *td_main = arg; traverse_data_t td = *td_main; - zbookmark_t czb; + zbookmark_phys_t czb; td.td_func = traverse_prefetcher; td.td_arg = td_main->td_pfd; @@ -504,12 +495,12 @@ traverse_prefetch_thread(void *arg) */ static int traverse_impl(spa_t *spa, dsl_dataset_t *ds, uint64_t objset, blkptr_t *rootbp, - uint64_t txg_start, zbookmark_t *resume, int flags, + uint64_t txg_start, zbookmark_phys_t *resume, int flags, blkptr_cb_t func, void *arg) { traverse_data_t td; prefetch_data_t pd = { 0 }; - zbookmark_t czb; + zbookmark_phys_t czb; int err; ASSERT(ds == NULL || objset == ds->ds_object); @@ -530,6 +521,7 @@ traverse_impl(spa_t *spa, dsl_dataset_t *ds, uint64_t objset, blkptr_t *rootbp, td.td_arg = arg; td.td_pfd = &pd; td.td_flags = flags; + td.td_paused = B_FALSE; pd.pd_blks_max = zfs_pd_blks_max; pd.pd_flags = flags; @@ -589,7 +581,7 @@ traverse_dataset(dsl_dataset_t *ds, uint64_t txg_start, int flags, int traverse_dataset_destroyed(spa_t *spa, blkptr_t *blkptr, - uint64_t txg_start, zbookmark_t *resume, int flags, + uint64_t txg_start, zbookmark_phys_t *resume, int flags, blkptr_cb_t func, void *arg) { return (traverse_impl(spa, NULL, ZB_DESTROYED_OBJSET, @@ -603,7 +595,7 @@ int traverse_pool(spa_t *spa, uint64_t txg_start, int flags, blkptr_cb_t func, void *arg) { - int err, lasterr = 0; + int err; uint64_t obj; dsl_pool_t *dp = spa_get_dsl(spa); objset_t *mos = dp->dp_meta_objset; @@ -616,16 +608,15 @@ traverse_pool(spa_t *spa, uint64_t txg_start, int flags, return (err); /* visit each dataset */ - for (obj = 1; err == 0 || (err != ESRCH && hard); + for (obj = 1; err == 0; err = dmu_object_next(mos, &obj, FALSE, txg_start)) { dmu_object_info_t doi; err = dmu_object_info(mos, obj, &doi); if (err != 0) { - if (!hard) - return (err); - lasterr = err; - continue; + if (hard) + continue; + break; } if (doi.doi_bonus_type == DMU_OT_DSL_DATASET) { @@ -636,23 +627,19 @@ traverse_pool(spa_t *spa, uint64_t txg_start, int flags, err = dsl_dataset_hold_obj(dp, obj, FTAG, &ds); dsl_pool_config_exit(dp, FTAG); if (err != 0) { - if (!hard) - return (err); - lasterr = err; - continue; + if (hard) + continue; + break; } if (ds->ds_phys->ds_prev_snap_txg > txg) txg = ds->ds_phys->ds_prev_snap_txg; err = traverse_dataset(ds, txg, flags, func, arg); dsl_dataset_rele(ds, FTAG); - if (err != 0) { - if (!hard) - return (err); - lasterr = err; - } + if (err != 0) + break; } } if (err == ESRCH) err = 0; - return (err != 0 ? err : lasterr); + return (err); } diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c index 1213d9137cf..ed9757ecd45 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #include @@ -583,6 +583,32 @@ dmu_tx_count_free(dmu_tx_hold_t *txh, uint64_t off, uint64_t len) txh->txh_space_tounref += unref; } +/* + * This function marks the transaction as being a "net free". The end + * result is that refquotas will be disabled for this transaction, and + * this transaction will be able to use half of the pool space overhead + * (see dsl_pool_adjustedsize()). Therefore this function should only + * be called for transactions that we expect will not cause a net increase + * in the amount of space used (but it's OK if that is occasionally not true). + */ +void +dmu_tx_mark_netfree(dmu_tx_t *tx) +{ + dmu_tx_hold_t *txh; + + txh = dmu_tx_hold_object_impl(tx, tx->tx_objset, + DMU_NEW_OBJECT, THT_FREE, 0, 0); + + /* + * Pretend that this operation will free 1GB of space. This + * should be large enough to cancel out the largest write. + * We don't want to use something like UINT64_MAX, because that would + * cause overflows when doing math with these values (e.g. in + * dmu_tx_try_assign()). + */ + txh->txh_space_tofree = txh->txh_space_tounref = 1024 * 1024 * 1024; +} + void dmu_tx_hold_free(dmu_tx_t *tx, uint64_t object, uint64_t off, uint64_t len) { diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c index d51a981c127..77100ef8d71 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c @@ -55,17 +55,13 @@ SYSCTL_DECL(_vfs_zfs); SYSCTL_INT(_vfs_zfs, OID_AUTO, prefetch_disable, CTLFLAG_RW, &zfs_prefetch_disable, 0, "Disable prefetch"); SYSCTL_NODE(_vfs_zfs, OID_AUTO, zfetch, CTLFLAG_RW, 0, "ZFS ZFETCH"); -TUNABLE_INT("vfs.zfs.zfetch.max_streams", &zfetch_max_streams); -SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, max_streams, CTLFLAG_RW, +SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, max_streams, CTLFLAG_RWTUN, &zfetch_max_streams, 0, "Max # of streams per zfetch"); -TUNABLE_INT("vfs.zfs.zfetch.min_sec_reap", &zfetch_min_sec_reap); -SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, min_sec_reap, CTLFLAG_RDTUN, +SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, min_sec_reap, CTLFLAG_RWTUN, &zfetch_min_sec_reap, 0, "Min time before stream reclaim"); -TUNABLE_INT("vfs.zfs.zfetch.block_cap", &zfetch_block_cap); -SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, block_cap, CTLFLAG_RDTUN, +SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, block_cap, CTLFLAG_RWTUN, &zfetch_block_cap, 0, "Max number of blocks to fetch at a time"); -TUNABLE_QUAD("vfs.zfs.zfetch.array_rd_sz", &zfetch_array_rd_sz); -SYSCTL_UQUAD(_vfs_zfs_zfetch, OID_AUTO, array_rd_sz, CTLFLAG_RDTUN, +SYSCTL_UQUAD(_vfs_zfs_zfetch, OID_AUTO, array_rd_sz, CTLFLAG_RWTUN, &zfetch_array_rd_sz, 0, "Number of bytes in a array_read at which we stop prefetching"); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c index fa976d09786..6efbffd56c0 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c @@ -1083,6 +1083,11 @@ dnode_hold_impl(objset_t *os, uint64_t object, int flag, } if (winner = dmu_buf_set_user(&db->db, children_dnodes, NULL, dnode_buf_pageout)) { + + for (i = 0; i < epb; i++) { + zrl_destroy(&dnh[i].dnh_zrlock); + } + kmem_free(children_dnodes, sizeof (dnode_children_t) + (epb - 1) * sizeof (dnode_handle_t)); children_dnodes = winner; @@ -1816,8 +1821,8 @@ dnode_next_offset_level(dnode_t *dn, int flags, uint64_t *offset, *offset = *offset >> span; for (i = BF64_GET(*offset, 0, epbs); i >= 0 && i < epb; i += inc) { - if (bp[i].blk_fill >= minfill && - bp[i].blk_fill <= maxfill && + if (BP_GET_FILL(&bp[i]) >= minfill && + BP_GET_FILL(&bp[i]) <= maxfill && (hole || bp[i].blk_birth > txg)) break; if (inc > 0 || *offset > 0) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c index 326e96cf976..aca4203180a 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c @@ -233,8 +233,6 @@ free_verify(dmu_buf_impl_t *db, uint64_t start, uint64_t end, dmu_tx_t *tx) } #endif -#define ALL -1 - static void free_children(dmu_buf_impl_t *db, uint64_t blkid, uint64_t nblks, dmu_tx_t *tx) @@ -362,7 +360,6 @@ dnode_sync_free_range_impl(dnode_t *dn, uint64_t blkid, uint64_t nblks, free_children(db, blkid, nblks, tx); dbuf_rele(db, FTAG); - } } @@ -479,8 +476,8 @@ dnode_undirty_dbufs(list_t *list) dr->dt.dl.dr_data == db->db_buf); dbuf_unoverride(dr); } else { - list_destroy(&dr->dt.di.dr_children); mutex_destroy(&dr->dt.di.dr_mtx); + list_destroy(&dr->dt.di.dr_children); } kmem_free(dr, sizeof (dbuf_dirty_record_t)); dbuf_rele_and_unlock(db, (void *)(uintptr_t)txg); @@ -594,11 +591,14 @@ dnode_sync(dnode_t *dn, dmu_tx_t *tx) dnp->dn_bonustype = dn->dn_bonustype; dnp->dn_bonuslen = dn->dn_bonuslen; } - ASSERT(dnp->dn_nlevels > 1 || BP_IS_HOLE(&dnp->dn_blkptr[0]) || + BP_IS_EMBEDDED(&dnp->dn_blkptr[0]) || BP_GET_LSIZE(&dnp->dn_blkptr[0]) == dnp->dn_datablkszsec << SPA_MINBLOCKSHIFT); + ASSERT(dnp->dn_nlevels < 2 || + BP_IS_HOLE(&dnp->dn_blkptr[0]) || + BP_GET_LSIZE(&dnp->dn_blkptr[0]) == 1 << dnp->dn_indblkshift); if (dn->dn_next_type[txgoff] != 0) { dnp->dn_type = dn->dn_type; diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c index 35e55ece4f4..21784630da6 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c @@ -13,7 +13,7 @@ * CDDL HEADER END */ /* - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013, 2014 by Delphix. All rights reserved. */ #include @@ -246,7 +246,8 @@ dsl_bookmark_create(nvlist_t *bmarks, nvlist_t *errors) dbca.dbca_errors = errors; return (dsl_sync_task(nvpair_name(pair), dsl_bookmark_create_check, - dsl_bookmark_create_sync, &dbca, fnvlist_num_pairs(bmarks))); + dsl_bookmark_create_sync, &dbca, + fnvlist_num_pairs(bmarks), ZFS_SPACE_CHECK_NORMAL)); } int @@ -448,7 +449,8 @@ dsl_bookmark_destroy(nvlist_t *bmarks, nvlist_t *errors) dbda.dbda_success = fnvlist_alloc(); rv = dsl_sync_task(nvpair_name(pair), dsl_bookmark_destroy_check, - dsl_bookmark_destroy_sync, &dbda, fnvlist_num_pairs(bmarks)); + dsl_bookmark_destroy_sync, &dbda, fnvlist_num_pairs(bmarks), + ZFS_SPACE_CHECK_RESERVED); fnvlist_free(dbda.dbda_success); return (rv); } diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c index 4172397225b..a97a10a4862 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2011 Martin Matuska - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013, 2014 by Delphix. All rights reserved. * Copyright (c) 2014, Joyent, Inc. All rights reserved. * Copyright (c) 2014 RackTop Systems. */ @@ -270,6 +270,7 @@ dsl_dataset_evict(dmu_buf_t *db, void *dsv) if (mutex_owned(&ds->ds_opening_lock)) mutex_exit(&ds->ds_opening_lock); mutex_destroy(&ds->ds_opening_lock); + mutex_destroy(&ds->ds_sendstream_lock); refcount_destroy(&ds->ds_longholds); kmem_free(ds, sizeof (dsl_dataset_t)); @@ -398,6 +399,7 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uint64_t dsobj, void *tag, if (err != 0) { mutex_destroy(&ds->ds_lock); mutex_destroy(&ds->ds_opening_lock); + mutex_destroy(&ds->ds_sendstream_lock); refcount_destroy(&ds->ds_longholds); bplist_destroy(&ds->ds_pending_deadlist); dsl_deadlist_close(&ds->ds_deadlist); @@ -454,6 +456,7 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uint64_t dsobj, void *tag, dsl_dir_rele(ds->ds_dir, ds); mutex_destroy(&ds->ds_lock); mutex_destroy(&ds->ds_opening_lock); + mutex_destroy(&ds->ds_sendstream_lock); refcount_destroy(&ds->ds_longholds); kmem_free(ds, sizeof (dsl_dataset_t)); if (err != 0) { @@ -1401,7 +1404,7 @@ dsl_dataset_snapshot(nvlist_t *snaps, nvlist_t *props, nvlist_t *errors) if (error == 0) { error = dsl_sync_task(firstname, dsl_dataset_snapshot_check, dsl_dataset_snapshot_sync, &ddsa, - fnvlist_num_pairs(snaps) * 3); + fnvlist_num_pairs(snaps) * 3, ZFS_SPACE_CHECK_NORMAL); } if (suspended != NULL) { @@ -1514,7 +1517,7 @@ dsl_dataset_snapshot_tmp(const char *fsname, const char *snapname, } error = dsl_sync_task(fsname, dsl_dataset_snapshot_tmp_check, - dsl_dataset_snapshot_tmp_sync, &ddsta, 3); + dsl_dataset_snapshot_tmp_sync, &ddsta, 3, ZFS_SPACE_CHECK_RESERVED); if (needsuspend) zil_resume(cookie); @@ -1603,6 +1606,12 @@ dsl_dataset_stats(dsl_dataset_t *ds, nvlist_t *nv) ds->ds_phys->ds_unique_bytes); get_clones_stat(ds, nv); } else { + if (ds->ds_prev != NULL && ds->ds_prev != dp->dp_origin_snap) { + char buf[MAXNAMELEN]; + dsl_dataset_name(ds->ds_prev, buf); + dsl_prop_nvlist_add_string(nv, ZFS_PROP_PREV_SNAP, buf); + } + dsl_dir_stats(ds->ds_dir, nv); } @@ -1701,7 +1710,7 @@ dsl_dataset_space(dsl_dataset_t *ds, else *availbytesp = 0; } - *usedobjsp = ds->ds_phys->ds_bp.blk_fill; + *usedobjsp = BP_GET_FILL(&ds->ds_phys->ds_bp); *availobjsp = DN_MAX_OBJECT - *usedobjsp; } @@ -1879,7 +1888,8 @@ dsl_dataset_rename_snapshot(const char *fsname, ddrsa.ddrsa_recursive = recursive; return (dsl_sync_task(fsname, dsl_dataset_rename_snapshot_check, - dsl_dataset_rename_snapshot_sync, &ddrsa, 1)); + dsl_dataset_rename_snapshot_sync, &ddrsa, + 1, ZFS_SPACE_CHECK_RESERVED)); } /* @@ -2054,7 +2064,8 @@ dsl_dataset_rollback(const char *fsname, void *owner, nvlist_t *result) ddra.ddra_result = result; return (dsl_sync_task(fsname, dsl_dataset_rollback_check, - dsl_dataset_rollback_sync, &ddra, 1)); + dsl_dataset_rollback_sync, &ddra, + 1, ZFS_SPACE_CHECK_RESERVED)); } struct promotenode { @@ -2575,7 +2586,8 @@ dsl_dataset_promote(const char *name, char *conflsnap) ddpa.cr = CRED(); return (dsl_sync_task(name, dsl_dataset_promote_check, - dsl_dataset_promote_sync, &ddpa, 2 + numsnaps)); + dsl_dataset_promote_sync, &ddpa, + 2 + numsnaps, ZFS_SPACE_CHECK_RESERVED)); } int @@ -2920,7 +2932,7 @@ dsl_dataset_set_refquota(const char *dsname, zprop_source_t source, ddsqra.ddsqra_value = refquota; return (dsl_sync_task(dsname, dsl_dataset_set_refquota_check, - dsl_dataset_set_refquota_sync, &ddsqra, 0)); + dsl_dataset_set_refquota_sync, &ddsqra, 0, ZFS_SPACE_CHECK_NONE)); } static int @@ -3035,7 +3047,8 @@ dsl_dataset_set_refreservation(const char *dsname, zprop_source_t source, ddsqra.ddsqra_value = refreservation; return (dsl_sync_task(dsname, dsl_dataset_set_refreservation_check, - dsl_dataset_set_refreservation_sync, &ddsqra, 0)); + dsl_dataset_set_refreservation_sync, &ddsqra, + 0, ZFS_SPACE_CHECK_NONE)); } /* diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c index 623eaab8543..bdedccf4d87 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. */ /* @@ -282,7 +282,7 @@ dsl_deleg_set(const char *ddname, nvlist_t *nvp, boolean_t unset) return (dsl_sync_task(ddname, dsl_deleg_check, unset ? dsl_deleg_unset_sync : dsl_deleg_set_sync, - &dda, fnvlist_num_pairs(nvp))); + &dda, fnvlist_num_pairs(nvp), ZFS_SPACE_CHECK_RESERVED)); } /* diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c index 639412cdeee..f8a4546535e 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2013 by Joyent, Inc. All rights reserved. */ @@ -506,7 +506,7 @@ dsl_destroy_snapshots_nvl(nvlist_t *snaps, boolean_t defer, error = dsl_sync_task(nvpair_name(pair), dsl_destroy_snapshot_check, dsl_destroy_snapshot_sync, - &dsda, 0); + &dsda, 0, ZFS_SPACE_CHECK_NONE); fnvlist_free(dsda.dsda_successful_snaps); return (error); @@ -534,12 +534,12 @@ struct killarg { /* ARGSUSED */ static int kill_blkptr(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, - const zbookmark_t *zb, const dnode_phys_t *dnp, void *arg) + const zbookmark_phys_t *zb, const dnode_phys_t *dnp, void *arg) { struct killarg *ka = arg; dmu_tx_t *tx = ka->tx; - if (BP_IS_HOLE(bp)) + if (BP_IS_HOLE(bp) || BP_IS_EMBEDDED(bp)) return (0); if (zb->zb_level == ZB_ZIL_LEVEL) { @@ -589,6 +589,7 @@ dsl_destroy_head_check_impl(dsl_dataset_t *ds, int expected_holds) uint64_t count; objset_t *mos; + ASSERT(!dsl_dataset_is_snapshot(ds)); if (dsl_dataset_is_snapshot(ds)) return (SET_ERROR(EINVAL)); @@ -711,7 +712,7 @@ dsl_destroy_head_sync_impl(dsl_dataset_t *ds, dmu_tx_t *tx) ds->ds_prev->ds_phys->ds_num_children == 2 && ds->ds_prev->ds_userrefs == 0); - /* Remove our reservation */ + /* Remove our reservation. */ if (ds->ds_reserved != 0) { dsl_dataset_set_refreservation_sync_impl(ds, (ZPROP_SRC_NONE | ZPROP_SRC_LOCAL | ZPROP_SRC_RECEIVED), @@ -898,7 +899,8 @@ dsl_destroy_head(const char *name) objset_t *os; error = dsl_sync_task(name, dsl_destroy_head_check, - dsl_destroy_head_begin_sync, &ddha, 0); + dsl_destroy_head_begin_sync, &ddha, + 0, ZFS_SPACE_CHECK_NONE); if (error != 0) return (error); @@ -922,7 +924,7 @@ dsl_destroy_head(const char *name) } return (dsl_sync_task(name, dsl_destroy_head_check, - dsl_destroy_head_sync, &ddha, 0)); + dsl_destroy_head_sync, &ddha, 0, ZFS_SPACE_CHECK_NONE)); } /* diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c index d61dbc17795..74daa537fd1 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c @@ -22,7 +22,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011 Pawel Jakub Dawidek . * All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. * Copyright (c) 2014 Joyent, Inc. All rights reserved. */ @@ -489,7 +489,7 @@ dsl_dir_init_fs_ss_count(dsl_dir_t *dd, dmu_tx_t *tx) zap_attribute_t *za; dsl_dataset_t *ds; - ASSERT(spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_FS_SS_LIMIT)); + ASSERT(spa_feature_is_active(dp->dp_spa, SPA_FEATURE_FS_SS_LIMIT)); ASSERT(dsl_pool_config_held(dp)); ASSERT(dmu_tx_is_syncing(tx)); @@ -549,6 +549,7 @@ dsl_dir_init_fs_ss_count(dsl_dir_t *dd, dmu_tx_t *tx) if (za->za_name[0] != '%') my_ss_cnt++; } + zap_cursor_fini(zc); dsl_dataset_rele(ds, FTAG); @@ -641,7 +642,8 @@ dsl_dir_activate_fs_ss_limit(const char *ddname) int error; error = dsl_sync_task(ddname, dsl_dir_actv_fs_ss_limit_check, - dsl_dir_actv_fs_ss_limit_sync, (void *)ddname, 0); + dsl_dir_actv_fs_ss_limit_sync, (void *)ddname, 0, + ZFS_SPACE_CHECK_RESERVED); if (error == EALREADY) error = 0; @@ -1495,7 +1497,7 @@ dsl_dir_set_quota(const char *ddname, zprop_source_t source, uint64_t quota) ddsqra.ddsqra_value = quota; return (dsl_sync_task(ddname, dsl_dir_set_quota_check, - dsl_dir_set_quota_sync, &ddsqra, 0)); + dsl_dir_set_quota_sync, &ddsqra, 0, ZFS_SPACE_CHECK_NONE)); } int @@ -1616,7 +1618,7 @@ dsl_dir_set_reservation(const char *ddname, zprop_source_t source, ddsqra.ddsqra_value = reservation; return (dsl_sync_task(ddname, dsl_dir_set_reservation_check, - dsl_dir_set_reservation_sync, &ddsqra, 0)); + dsl_dir_set_reservation_sync, &ddsqra, 0, ZFS_SPACE_CHECK_NONE)); } static dsl_dir_t * @@ -1717,7 +1719,7 @@ dsl_dir_rename_check(void *arg, dmu_tx_t *tx) } if (dmu_tx_is_syncing(tx)) { - if (spa_feature_is_enabled(dp->dp_spa, + if (spa_feature_is_active(dp->dp_spa, SPA_FEATURE_FS_SS_LIMIT)) { /* * Although this is the check function and we don't @@ -1745,8 +1747,11 @@ dsl_dir_rename_check(void *arg, dmu_tx_t *tx) err = zap_lookup(os, dd->dd_object, DD_FIELD_FILESYSTEM_COUNT, sizeof (fs_cnt), 1, &fs_cnt); - if (err != ENOENT && err != 0) + if (err != ENOENT && err != 0) { + dsl_dir_rele(newparent, FTAG); + dsl_dir_rele(dd, FTAG); return (err); + } /* * have to add 1 for the filesystem itself that we're @@ -1757,8 +1762,11 @@ dsl_dir_rename_check(void *arg, dmu_tx_t *tx) err = zap_lookup(os, dd->dd_object, DD_FIELD_SNAPSHOT_COUNT, sizeof (ss_cnt), 1, &ss_cnt); - if (err != ENOENT && err != 0) + if (err != ENOENT && err != 0) { + dsl_dir_rele(newparent, FTAG); + dsl_dir_rele(dd, FTAG); return (err); + } } /* no rename into our descendant */ @@ -1809,7 +1817,7 @@ dsl_dir_rename_sync(void *arg, dmu_tx_t *tx) * We already made sure the dd counts were initialized in the * check function. */ - if (spa_feature_is_enabled(dp->dp_spa, + if (spa_feature_is_active(dp->dp_spa, SPA_FEATURE_FS_SS_LIMIT)) { VERIFY0(zap_lookup(os, dd->dd_object, DD_FIELD_FILESYSTEM_COUNT, sizeof (fs_cnt), 1, @@ -1892,7 +1900,8 @@ dsl_dir_rename(const char *oldname, const char *newname) ddra.ddra_cred = CRED(); return (dsl_sync_task(oldname, - dsl_dir_rename_check, dsl_dir_rename_sync, &ddra, 3)); + dsl_dir_rename_check, dsl_dir_rename_sync, &ddra, + 3, ZFS_SPACE_CHECK_RESERVED)); } int diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c index 9fe1961f78e..ae2420b2396 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. */ @@ -46,6 +46,11 @@ #include #include +#ifdef __FreeBSD__ +#include +#include +#endif + /* * ZFS Write Throttle * ------------------ @@ -130,33 +135,79 @@ uint64_t zfs_delay_scale = 1000 * 1000 * 1000 / 2000; * per-pool basis using zfs.conf. */ +#ifdef __FreeBSD__ + +extern int zfs_vdev_async_write_active_max_dirty_percent; SYSCTL_DECL(_vfs_zfs); -#if 0 -TUNABLE_INT("vfs.zfs.no_write_throttle", &zfs_no_write_throttle); -SYSCTL_INT(_vfs_zfs, OID_AUTO, no_write_throttle, CTLFLAG_RDTUN, - &zfs_no_write_throttle, 0, ""); -TUNABLE_INT("vfs.zfs.write_limit_shift", &zfs_write_limit_shift); -SYSCTL_INT(_vfs_zfs, OID_AUTO, write_limit_shift, CTLFLAG_RDTUN, - &zfs_write_limit_shift, 0, "2^N of physical memory"); -SYSCTL_DECL(_vfs_zfs_txg); -TUNABLE_INT("vfs.zfs.txg.synctime_ms", &zfs_txg_synctime_ms); -SYSCTL_INT(_vfs_zfs_txg, OID_AUTO, synctime_ms, CTLFLAG_RDTUN, - &zfs_txg_synctime_ms, 0, "Target milliseconds to sync a txg"); -TUNABLE_QUAD("vfs.zfs.write_limit_min", &zfs_write_limit_min); -SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, write_limit_min, CTLFLAG_RDTUN, - &zfs_write_limit_min, 0, "Minimum write limit"); -TUNABLE_QUAD("vfs.zfs.write_limit_max", &zfs_write_limit_max); -SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, write_limit_max, CTLFLAG_RDTUN, - &zfs_write_limit_max, 0, "Maximum data payload per txg"); -TUNABLE_QUAD("vfs.zfs.write_limit_inflated", &zfs_write_limit_inflated); -SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, write_limit_inflated, CTLFLAG_RDTUN, - &zfs_write_limit_inflated, 0, "Maximum size of the dynamic write limit"); -TUNABLE_QUAD("vfs.zfs.write_limit_override", &zfs_write_limit_override); -SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, write_limit_override, CTLFLAG_RDTUN, - &zfs_write_limit_override, 0, - "Force a txg if dirty buffers exceed this value (bytes)"); +SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, dirty_data_max, CTLFLAG_RWTUN, + &zfs_dirty_data_max, 0, + "The maximum amount of dirty data in bytes after which new writes are " + "halted until space becomes available"); + +SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, dirty_data_max_max, CTLFLAG_RDTUN, + &zfs_dirty_data_max_max, 0, + "The absolute cap on dirty_data_max when auto calculating"); + +SYSCTL_INT(_vfs_zfs, OID_AUTO, dirty_data_max_percent, CTLFLAG_RDTUN, + &zfs_dirty_data_max_percent, 0, + "The percent of physical memory used to auto calculate dirty_data_max"); + +SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, dirty_data_sync, CTLFLAG_RWTUN, + &zfs_dirty_data_sync, 0, + "Force a txg if the number of dirty buffer bytes exceed this value"); + +static int sysctl_zfs_delay_min_dirty_percent(SYSCTL_HANDLER_ARGS); +/* No zfs_delay_min_dirty_percent tunable due to limit requirements */ +SYSCTL_PROC(_vfs_zfs, OID_AUTO, delay_min_dirty_percent, + CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, sizeof(int), + sysctl_zfs_delay_min_dirty_percent, "I", + "The limit of outstanding dirty data before transations are delayed"); + +static int sysctl_zfs_delay_scale(SYSCTL_HANDLER_ARGS); +/* No zfs_delay_scale tunable due to limit requirements */ +SYSCTL_PROC(_vfs_zfs, OID_AUTO, delay_scale, + CTLTYPE_U64 | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, sizeof(uint64_t), + sysctl_zfs_delay_scale, "QU", + "Controls how quickly the delay approaches infinity"); + +static int +sysctl_zfs_delay_min_dirty_percent(SYSCTL_HANDLER_ARGS) +{ + int val, err; + + val = zfs_delay_min_dirty_percent; + err = sysctl_handle_int(oidp, &val, 0, req); + if (err != 0 || req->newptr == NULL) + return (err); + + if (val < zfs_vdev_async_write_active_max_dirty_percent) + return (EINVAL); + + zfs_delay_min_dirty_percent = val; + + return (0); +} + +static int +sysctl_zfs_delay_scale(SYSCTL_HANDLER_ARGS) +{ + uint64_t val; + int err; + + val = zfs_delay_scale; + err = sysctl_handle_64(oidp, &val, 0, req); + if (err != 0 || req->newptr == NULL) + return (err); + + if (val > UINT64_MAX / zfs_dirty_data_max) + return (EINVAL); + + zfs_delay_scale = val; + + return (0); +} #endif hrtime_t zfs_throttle_delay = MSEC2NSEC(10); @@ -278,6 +329,13 @@ dsl_pool_open(dsl_pool_t *dp) dp->dp_meta_objset, obj)); } + /* + * Note: errors ignored, because the leak dir will not exist if we + * have not encountered a leak yet. + */ + (void) dsl_pool_open_special_dir(dp, LEAK_DIR_NAME, + &dp->dp_leak_dir); + if (spa_feature_is_active(dp->dp_spa, SPA_FEATURE_ASYNC_DESTROY)) { err = zap_lookup(dp->dp_meta_objset, DMU_POOL_DIRECTORY_OBJECT, DMU_POOL_BPTREE_OBJ, sizeof (uint64_t), 1, @@ -325,6 +383,8 @@ dsl_pool_close(dsl_pool_t *dp) dsl_dir_rele(dp->dp_mos_dir, dp); if (dp->dp_free_dir) dsl_dir_rele(dp->dp_free_dir, dp); + if (dp->dp_leak_dir) + dsl_dir_rele(dp->dp_leak_dir, dp); if (dp->dp_root_dir) dsl_dir_rele(dp->dp_root_dir, dp); @@ -631,17 +691,12 @@ dsl_pool_adjustedsize(dsl_pool_t *dp, boolean_t netfree) uint64_t space, resv; /* - * Reserve about 1.6% (1/64), or at least 32MB, for allocation - * efficiency. - * XXX The intent log is not accounted for, so it must fit - * within this slop. - * * If we're trying to assess whether it's OK to do a free, * cut the reservation in half to allow forward progress * (e.g. make it possible to rm(1) files from a full pool). */ space = spa_get_dspace(dp->dp_spa); - resv = MAX(space >> 6, SPA_MINDEVSIZE >> 1); + resv = spa_get_slop_space(dp->dp_spa); if (netfree) resv >>= 1; diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c index 54ea0f1a618..d0e3136a46e 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #include @@ -834,7 +834,7 @@ dsl_props_set(const char *dsname, zprop_source_t source, nvlist_t *props) nblks = 2 * fnvlist_num_pairs(props); return (dsl_sync_task(dsname, dsl_props_set_check, dsl_props_set_sync, - &dpsa, nblks)); + &dpsa, nblks, ZFS_SPACE_CHECK_RESERVED)); } typedef enum dsl_prop_getflags { diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c index c62be1adda8..daf87eee8ca 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. */ #include @@ -50,11 +50,10 @@ #include #endif -typedef int (scan_cb_t)(dsl_pool_t *, const blkptr_t *, const zbookmark_t *); +typedef int (scan_cb_t)(dsl_pool_t *, const blkptr_t *, + const zbookmark_phys_t *); -static scan_cb_t dsl_scan_defrag_cb; static scan_cb_t dsl_scan_scrub_cb; -static scan_cb_t dsl_scan_remove_cb; static void dsl_scan_cancel_sync(void *, dmu_tx_t *); static void dsl_scan_sync_state(dsl_scan_t *, dmu_tx_t *tx); @@ -68,35 +67,26 @@ unsigned int zfs_free_min_time_ms = 1000; /* min millisecs to free per txg */ unsigned int zfs_resilver_min_time_ms = 3000; /* min millisecs to resilver per txg */ boolean_t zfs_no_scrub_io = B_FALSE; /* set to disable scrub i/o */ -boolean_t zfs_no_scrub_prefetch = B_FALSE; /* set to disable srub prefetching */ +boolean_t zfs_no_scrub_prefetch = B_FALSE; /* set to disable scrub prefetch */ SYSCTL_DECL(_vfs_zfs); -TUNABLE_INT("vfs.zfs.top_maxinflight", &zfs_top_maxinflight); -SYSCTL_UINT(_vfs_zfs, OID_AUTO, top_maxinflight, CTLFLAG_RW, +SYSCTL_UINT(_vfs_zfs, OID_AUTO, top_maxinflight, CTLFLAG_RWTUN, &zfs_top_maxinflight, 0, "Maximum I/Os per top-level vdev"); -TUNABLE_INT("vfs.zfs.resilver_delay", &zfs_resilver_delay); -SYSCTL_UINT(_vfs_zfs, OID_AUTO, resilver_delay, CTLFLAG_RW, +SYSCTL_UINT(_vfs_zfs, OID_AUTO, resilver_delay, CTLFLAG_RWTUN, &zfs_resilver_delay, 0, "Number of ticks to delay resilver"); -TUNABLE_INT("vfs.zfs.scrub_delay", &zfs_scrub_delay); -SYSCTL_UINT(_vfs_zfs, OID_AUTO, scrub_delay, CTLFLAG_RW, +SYSCTL_UINT(_vfs_zfs, OID_AUTO, scrub_delay, CTLFLAG_RWTUN, &zfs_scrub_delay, 0, "Number of ticks to delay scrub"); -TUNABLE_INT("vfs.zfs.scan_idle", &zfs_scan_idle); -SYSCTL_UINT(_vfs_zfs, OID_AUTO, scan_idle, CTLFLAG_RW, +SYSCTL_UINT(_vfs_zfs, OID_AUTO, scan_idle, CTLFLAG_RWTUN, &zfs_scan_idle, 0, "Idle scan window in clock ticks"); -TUNABLE_INT("vfs.zfs.scan_min_time_ms", &zfs_scan_min_time_ms); -SYSCTL_UINT(_vfs_zfs, OID_AUTO, scan_min_time_ms, CTLFLAG_RW, +SYSCTL_UINT(_vfs_zfs, OID_AUTO, scan_min_time_ms, CTLFLAG_RWTUN, &zfs_scan_min_time_ms, 0, "Min millisecs to scrub per txg"); -TUNABLE_INT("vfs.zfs.free_min_time_ms", &zfs_free_min_time_ms); -SYSCTL_UINT(_vfs_zfs, OID_AUTO, free_min_time_ms, CTLFLAG_RW, +SYSCTL_UINT(_vfs_zfs, OID_AUTO, free_min_time_ms, CTLFLAG_RWTUN, &zfs_free_min_time_ms, 0, "Min millisecs to free per txg"); -TUNABLE_INT("vfs.zfs.resilver_min_time_ms", &zfs_resilver_min_time_ms); -SYSCTL_UINT(_vfs_zfs, OID_AUTO, resilver_min_time_ms, CTLFLAG_RW, +SYSCTL_UINT(_vfs_zfs, OID_AUTO, resilver_min_time_ms, CTLFLAG_RWTUN, &zfs_resilver_min_time_ms, 0, "Min millisecs to resilver per txg"); -TUNABLE_INT("vfs.zfs.no_scrub_io", &zfs_no_scrub_io); -SYSCTL_INT(_vfs_zfs, OID_AUTO, no_scrub_io, CTLFLAG_RW, +SYSCTL_INT(_vfs_zfs, OID_AUTO, no_scrub_io, CTLFLAG_RWTUN, &zfs_no_scrub_io, 0, "Disable scrub I/O"); -TUNABLE_INT("vfs.zfs.no_scrub_prefetch", &zfs_no_scrub_prefetch); -SYSCTL_INT(_vfs_zfs, OID_AUTO, no_scrub_prefetch, CTLFLAG_RW, +SYSCTL_INT(_vfs_zfs, OID_AUTO, no_scrub_prefetch, CTLFLAG_RWTUN, &zfs_no_scrub_prefetch, 0, "Disable scrub prefetching"); enum ddt_class zfs_scrub_ddt_class_max = DDT_CLASS_DUPLICATE; @@ -377,11 +367,11 @@ int dsl_scan_cancel(dsl_pool_t *dp) { return (dsl_sync_task(spa_name(dp->dp_spa), dsl_scan_cancel_check, - dsl_scan_cancel_sync, NULL, 3)); + dsl_scan_cancel_sync, NULL, 3, ZFS_SPACE_CHECK_RESERVED)); } static void dsl_scan_visitbp(blkptr_t *bp, - const zbookmark_t *zb, dnode_phys_t *dnp, arc_buf_t *pbuf, + const zbookmark_phys_t *zb, dnode_phys_t *dnp, arc_buf_t *pbuf, dsl_dataset_t *ds, dsl_scan_t *scn, dmu_objset_type_t ostype, dmu_tx_t *tx); static void dsl_scan_visitdnode(dsl_scan_t *, dsl_dataset_t *ds, @@ -421,7 +411,7 @@ dsl_scan_sync_state(dsl_scan_t *scn, dmu_tx_t *tx) } static boolean_t -dsl_scan_check_pause(dsl_scan_t *scn, const zbookmark_t *zb) +dsl_scan_check_pause(dsl_scan_t *scn, const zbookmark_phys_t *zb) { uint64_t elapsed_nanosecs; unsigned int mintime; @@ -479,7 +469,7 @@ dsl_scan_zil_block(zilog_t *zilog, blkptr_t *bp, void *arg, uint64_t claim_txg) dsl_pool_t *dp = zsa->zsa_dp; dsl_scan_t *scn = dp->dp_scan; zil_header_t *zh = zsa->zsa_zh; - zbookmark_t zb; + zbookmark_phys_t zb; if (BP_IS_HOLE(bp) || bp->blk_birth <= scn->scn_phys.scn_cur_min_txg) return (0); @@ -511,7 +501,7 @@ dsl_scan_zil_record(zilog_t *zilog, lr_t *lrc, void *arg, uint64_t claim_txg) zil_header_t *zh = zsa->zsa_zh; lr_write_t *lr = (lr_write_t *)lrc; blkptr_t *bp = &lr->lr_blkptr; - zbookmark_t zb; + zbookmark_phys_t zb; if (BP_IS_HOLE(bp) || bp->blk_birth <= scn->scn_phys.scn_cur_min_txg) @@ -561,7 +551,7 @@ static void dsl_scan_prefetch(dsl_scan_t *scn, arc_buf_t *buf, blkptr_t *bp, uint64_t objset, uint64_t object, uint64_t blkid) { - zbookmark_t czb; + zbookmark_phys_t czb; uint32_t flags = ARC_NOWAIT | ARC_PREFETCH; if (zfs_no_scrub_prefetch) @@ -580,7 +570,7 @@ dsl_scan_prefetch(dsl_scan_t *scn, arc_buf_t *buf, blkptr_t *bp, static boolean_t dsl_scan_check_resume(dsl_scan_t *scn, const dnode_phys_t *dnp, - const zbookmark_t *zb) + const zbookmark_phys_t *zb) { /* * We never skip over user/group accounting objects (obj<0) @@ -620,7 +610,7 @@ dsl_scan_check_resume(dsl_scan_t *scn, const dnode_phys_t *dnp, static int dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype, dnode_phys_t *dnp, const blkptr_t *bp, - const zbookmark_t *zb, dmu_tx_t *tx, arc_buf_t **bufp) + const zbookmark_phys_t *zb, dmu_tx_t *tx, arc_buf_t **bufp) { dsl_pool_t *dp = scn->scn_dp; int zio_flags = ZIO_FLAG_CANFAIL | ZIO_FLAG_SCAN_THREAD; @@ -643,7 +633,7 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype, zb->zb_object, zb->zb_blkid * epb + i); } for (i = 0, cbp = (*bufp)->b_data; i < epb; i++, cbp++) { - zbookmark_t czb; + zbookmark_phys_t czb; SET_BOOKMARK(&czb, zb->zb_objset, zb->zb_object, zb->zb_level - 1, @@ -727,7 +717,7 @@ dsl_scan_visitdnode(dsl_scan_t *scn, dsl_dataset_t *ds, int j; for (j = 0; j < dnp->dn_nblkptr; j++) { - zbookmark_t czb; + zbookmark_phys_t czb; SET_BOOKMARK(&czb, ds ? ds->ds_object : 0, object, dnp->dn_nlevels - 1, j); @@ -736,7 +726,7 @@ dsl_scan_visitdnode(dsl_scan_t *scn, dsl_dataset_t *ds, } if (dnp->dn_flags & DNODE_FLAG_SPILL_BLKPTR) { - zbookmark_t czb; + zbookmark_phys_t czb; SET_BOOKMARK(&czb, ds ? ds->ds_object : 0, object, 0, DMU_SPILL_BLKID); dsl_scan_visitbp(&dnp->dn_spill, @@ -749,7 +739,7 @@ dsl_scan_visitdnode(dsl_scan_t *scn, dsl_dataset_t *ds, * first 5; we want them to be useful. */ static void -dsl_scan_visitbp(blkptr_t *bp, const zbookmark_t *zb, +dsl_scan_visitbp(blkptr_t *bp, const zbookmark_phys_t *zb, dnode_phys_t *dnp, arc_buf_t *pbuf, dsl_dataset_t *ds, dsl_scan_t *scn, dmu_objset_type_t ostype, dmu_tx_t *tx) @@ -813,7 +803,7 @@ static void dsl_scan_visit_rootbp(dsl_scan_t *scn, dsl_dataset_t *ds, blkptr_t *bp, dmu_tx_t *tx) { - zbookmark_t zb; + zbookmark_phys_t zb; SET_BOOKMARK(&zb, ds ? ds->ds_object : DMU_META_OBJSET, ZB_ROOT_OBJECT, ZB_ROOT_LEVEL, ZB_ROOT_BLKID); @@ -1240,7 +1230,7 @@ dsl_scan_ddt_entry(dsl_scan_t *scn, enum zio_checksum checksum, const ddt_key_t *ddk = &dde->dde_key; ddt_phys_t *ddp = dde->dde_phys; blkptr_t bp; - zbookmark_t zb = { 0 }; + zbookmark_phys_t zb = { 0 }; if (scn->scn_phys.scn_state != DSS_SCANNING) return; @@ -1308,7 +1298,7 @@ dsl_scan_visit(dsl_scan_t *scn, dmu_tx_t *tx) * In case we were paused right at the end of the ds, zero the * bookmark so we don't think that we're still trying to resume. */ - bzero(&scn->scn_phys.scn_bookmark, sizeof (zbookmark_t)); + bzero(&scn->scn_phys.scn_bookmark, sizeof (zbookmark_phys_t)); /* keep pulling things out of the zap-object-as-queue */ while (zap_cursor_init(&zc, dp->dp_meta_objset, @@ -1389,7 +1379,7 @@ dsl_scan_active(dsl_scan_t *scn) if (spa_shutting_down(spa)) return (B_FALSE); if (scn->scn_phys.scn_state == DSS_SCANNING || - scn->scn_async_destroying) + (scn->scn_async_destroying && !scn->scn_async_stalled)) return (B_TRUE); if (spa_version(scn->scn_dp->dp_spa) >= SPA_VERSION_DEADLISTS) { @@ -1404,7 +1394,7 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *tx) { dsl_scan_t *scn = dp->dp_scan; spa_t *spa = dp->dp_spa; - int err; + int err = 0; /* * Check for scn_restart_txg before checking spa_load_state, so @@ -1422,7 +1412,10 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *tx) dsl_scan_setup_sync(&func, tx); } - if (!dsl_scan_active(scn) || + /* + * If the scan is inactive due to a stalled async destroy, try again. + */ + if ((!scn->scn_async_stalled && !dsl_scan_active(scn)) || spa_sync_pass(dp->dp_spa) > 1) return; @@ -1432,10 +1425,11 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *tx) spa->spa_scrub_active = B_TRUE; /* - * First process the free list. If we pause the free, don't do - * any scanning. This ensures that there is no free list when - * we are scanning, so the scan code doesn't have to worry about - * traversing it. + * First process the async destroys. If we pause, don't do + * any scrubbing or resilvering. This ensures that there are no + * async destroys while we are scanning, so the scan code doesn't + * have to worry about traversing it. It is also faster to free the + * blocks than to scrub them. */ if (spa_version(dp->dp_spa) >= SPA_VERSION_DEADLISTS) { scn->scn_is_bptree = B_FALSE; @@ -1445,48 +1439,96 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *tx) dsl_scan_free_block_cb, scn, tx); VERIFY3U(0, ==, zio_wait(scn->scn_zio_root)); - if (err == 0 && spa_feature_is_active(spa, - SPA_FEATURE_ASYNC_DESTROY)) { - ASSERT(scn->scn_async_destroying); - scn->scn_is_bptree = B_TRUE; - scn->scn_zio_root = zio_root(dp->dp_spa, NULL, - NULL, ZIO_FLAG_MUSTSUCCEED); - err = bptree_iterate(dp->dp_meta_objset, - dp->dp_bptree_obj, B_TRUE, dsl_scan_free_block_cb, - scn, tx); - VERIFY0(zio_wait(scn->scn_zio_root)); + if (err != 0 && err != ERESTART) + zfs_panic_recover("error %u from bpobj_iterate()", err); + } - if (err == 0) { - /* finished; deactivate async destroy feature */ - spa_feature_decr(spa, SPA_FEATURE_ASYNC_DESTROY, - tx); - ASSERT(!spa_feature_is_active(spa, - SPA_FEATURE_ASYNC_DESTROY)); - VERIFY0(zap_remove(dp->dp_meta_objset, - DMU_POOL_DIRECTORY_OBJECT, - DMU_POOL_BPTREE_OBJ, tx)); - VERIFY0(bptree_free(dp->dp_meta_objset, - dp->dp_bptree_obj, tx)); - dp->dp_bptree_obj = 0; - scn->scn_async_destroying = B_FALSE; - } + if (err == 0 && spa_feature_is_active(spa, SPA_FEATURE_ASYNC_DESTROY)) { + ASSERT(scn->scn_async_destroying); + scn->scn_is_bptree = B_TRUE; + scn->scn_zio_root = zio_root(dp->dp_spa, NULL, + NULL, ZIO_FLAG_MUSTSUCCEED); + err = bptree_iterate(dp->dp_meta_objset, + dp->dp_bptree_obj, B_TRUE, dsl_scan_free_block_cb, scn, tx); + VERIFY0(zio_wait(scn->scn_zio_root)); + + if (err == EIO || err == ECKSUM) { + err = 0; + } else if (err != 0 && err != ERESTART) { + zfs_panic_recover("error %u from " + "traverse_dataset_destroyed()", err); } - if (scn->scn_visited_this_txg) { - zfs_dbgmsg("freed %llu blocks in %llums from " - "free_bpobj/bptree txg %llu", - (longlong_t)scn->scn_visited_this_txg, - (longlong_t) - NSEC2MSEC(gethrtime() - scn->scn_sync_start_time), - (longlong_t)tx->tx_txg); - scn->scn_visited_this_txg = 0; - /* - * Re-sync the ddt so that we can further modify - * it when doing bprewrite. - */ - ddt_sync(spa, tx->tx_txg); + + /* + * If we didn't make progress, mark the async destroy as + * stalled, so that we will not initiate a spa_sync() on + * its behalf. + */ + scn->scn_async_stalled = (scn->scn_visited_this_txg == 0); + + if (bptree_is_empty(dp->dp_meta_objset, dp->dp_bptree_obj)) { + /* finished; deactivate async destroy feature */ + spa_feature_decr(spa, SPA_FEATURE_ASYNC_DESTROY, tx); + ASSERT(!spa_feature_is_active(spa, + SPA_FEATURE_ASYNC_DESTROY)); + VERIFY0(zap_remove(dp->dp_meta_objset, + DMU_POOL_DIRECTORY_OBJECT, + DMU_POOL_BPTREE_OBJ, tx)); + VERIFY0(bptree_free(dp->dp_meta_objset, + dp->dp_bptree_obj, tx)); + dp->dp_bptree_obj = 0; + scn->scn_async_destroying = B_FALSE; } - if (err == ERESTART) - return; + } + if (scn->scn_visited_this_txg) { + zfs_dbgmsg("freed %llu blocks in %llums from " + "free_bpobj/bptree txg %llu; err=%u", + (longlong_t)scn->scn_visited_this_txg, + (longlong_t) + NSEC2MSEC(gethrtime() - scn->scn_sync_start_time), + (longlong_t)tx->tx_txg, err); + scn->scn_visited_this_txg = 0; + + /* + * Write out changes to the DDT that may be required as a + * result of the blocks freed. This ensures that the DDT + * is clean when a scrub/resilver runs. + */ + ddt_sync(spa, tx->tx_txg); + } + if (err != 0) + return; + if (!scn->scn_async_destroying && zfs_free_leak_on_eio && + (dp->dp_free_dir->dd_phys->dd_used_bytes != 0 || + dp->dp_free_dir->dd_phys->dd_compressed_bytes != 0 || + dp->dp_free_dir->dd_phys->dd_uncompressed_bytes != 0)) { + /* + * We have finished background destroying, but there is still + * some space left in the dp_free_dir. Transfer this leaked + * space to the dp_leak_dir. + */ + if (dp->dp_leak_dir == NULL) { + rrw_enter(&dp->dp_config_rwlock, RW_WRITER, FTAG); + (void) dsl_dir_create_sync(dp, dp->dp_root_dir, + LEAK_DIR_NAME, tx); + VERIFY0(dsl_pool_open_special_dir(dp, + LEAK_DIR_NAME, &dp->dp_leak_dir)); + rrw_exit(&dp->dp_config_rwlock, FTAG); + } + dsl_dir_diduse_space(dp->dp_leak_dir, DD_USED_HEAD, + dp->dp_free_dir->dd_phys->dd_used_bytes, + dp->dp_free_dir->dd_phys->dd_compressed_bytes, + dp->dp_free_dir->dd_phys->dd_uncompressed_bytes, tx); + dsl_dir_diduse_space(dp->dp_free_dir, DD_USED_HEAD, + -dp->dp_free_dir->dd_phys->dd_used_bytes, + -dp->dp_free_dir->dd_phys->dd_compressed_bytes, + -dp->dp_free_dir->dd_phys->dd_uncompressed_bytes, tx); + } + if (!scn->scn_async_destroying) { + /* finished; verify that space accounting went to zero */ + ASSERT0(dp->dp_free_dir->dd_phys->dd_used_bytes); + ASSERT0(dp->dp_free_dir->dd_phys->dd_compressed_bytes); + ASSERT0(dp->dp_free_dir->dd_phys->dd_uncompressed_bytes); } if (scn->scn_phys.scn_state != DSS_SCANNING) @@ -1653,7 +1695,7 @@ dsl_scan_scrub_done(zio_t *zio) static int dsl_scan_scrub_cb(dsl_pool_t *dp, - const blkptr_t *bp, const zbookmark_t *zb) + const blkptr_t *bp, const zbookmark_phys_t *zb) { dsl_scan_t *scn = dp->dp_scan; size_t size = BP_GET_PSIZE(bp); @@ -1669,6 +1711,9 @@ dsl_scan_scrub_cb(dsl_pool_t *dp, count_block(dp->dp_blkstats, bp); + if (BP_IS_EMBEDDED(bp)) + return (0); + ASSERT(DSL_SCAN_IS_SCRUB_RESILVER(scn)); if (scn->scn_phys.scn_func == POOL_SCAN_SCRUB) { zio_flags |= ZIO_FLAG_SCRUB; @@ -1762,5 +1807,5 @@ dsl_scan(dsl_pool_t *dp, pool_scan_func_t func) (void) spa_vdev_state_exit(spa, NULL, 0); return (dsl_sync_task(spa_name(spa), dsl_scan_setup_check, - dsl_scan_setup_sync, &func, 0)); + dsl_scan_setup_sync, &func, 0, ZFS_SPACE_CHECK_NONE)); } diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c index 58f7d379528..8e09347678d 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #include @@ -64,7 +64,8 @@ dsl_null_checkfunc(void *arg, dmu_tx_t *tx) */ int dsl_sync_task(const char *pool, dsl_checkfunc_t *checkfunc, - dsl_syncfunc_t *syncfunc, void *arg, int blocks_modified) + dsl_syncfunc_t *syncfunc, void *arg, + int blocks_modified, zfs_space_check_t space_check) { spa_t *spa; dmu_tx_t *tx; @@ -84,6 +85,7 @@ dsl_sync_task(const char *pool, dsl_checkfunc_t *checkfunc, dst.dst_pool = dp; dst.dst_txg = dmu_tx_get_txg(tx); dst.dst_space = blocks_modified << DST_AVG_BLKSHIFT; + dst.dst_space_check = space_check; dst.dst_checkfunc = checkfunc != NULL ? checkfunc : dsl_null_checkfunc; dst.dst_syncfunc = syncfunc; dst.dst_arg = arg; @@ -117,13 +119,14 @@ dsl_sync_task(const char *pool, dsl_checkfunc_t *checkfunc, void dsl_sync_task_nowait(dsl_pool_t *dp, dsl_syncfunc_t *syncfunc, void *arg, - int blocks_modified, dmu_tx_t *tx) + int blocks_modified, zfs_space_check_t space_check, dmu_tx_t *tx) { dsl_sync_task_t *dst = kmem_zalloc(sizeof (*dst), KM_SLEEP); dst->dst_pool = dp; dst->dst_txg = dmu_tx_get_txg(tx); dst->dst_space = blocks_modified << DST_AVG_BLKSHIFT; + dst->dst_space_check = space_check; dst->dst_checkfunc = dsl_null_checkfunc; dst->dst_syncfunc = syncfunc; dst->dst_arg = arg; @@ -140,25 +143,34 @@ void dsl_sync_task_sync(dsl_sync_task_t *dst, dmu_tx_t *tx) { dsl_pool_t *dp = dst->dst_pool; - uint64_t quota, used; ASSERT0(dst->dst_error); /* - * Check for sufficient space. We just check against what's - * on-disk; we don't want any in-flight accounting to get in our - * way, because open context may have already used up various - * in-core limits (arc_tempreserve, dsl_pool_tempreserve). + * Check for sufficient space. + * + * When the sync task was created, the caller specified the + * type of space checking required. See the comment in + * zfs_space_check_t for details on the semantics of each + * type of space checking. + * + * We just check against what's on-disk; we don't want any + * in-flight accounting to get in our way, because open context + * may have already used up various in-core limits + * (arc_tempreserve, dsl_pool_tempreserve). */ - quota = dsl_pool_adjustedsize(dp, B_FALSE) - - metaslab_class_get_deferred(spa_normal_class(dp->dp_spa)); - used = dp->dp_root_dir->dd_phys->dd_used_bytes; - /* MOS space is triple-dittoed, so we multiply by 3. */ - if (dst->dst_space > 0 && used + dst->dst_space * 3 > quota) { - dst->dst_error = SET_ERROR(ENOSPC); - if (dst->dst_nowaiter) - kmem_free(dst, sizeof (*dst)); - return; + if (dst->dst_space_check != ZFS_SPACE_CHECK_NONE) { + uint64_t quota = dsl_pool_adjustedsize(dp, + dst->dst_space_check == ZFS_SPACE_CHECK_RESERVED) - + metaslab_class_get_deferred(spa_normal_class(dp->dp_spa)); + uint64_t used = dp->dp_root_dir->dd_phys->dd_used_bytes; + /* MOS space is triple-dittoed, so we multiply by 3. */ + if (dst->dst_space > 0 && used + dst->dst_space * 3 > quota) { + dst->dst_error = SET_ERROR(ENOSPC); + if (dst->dst_nowaiter) + kmem_free(dst, sizeof (*dst)); + return; + } } /* diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c index 7f2c26f766e..b6878d7ecc4 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. */ @@ -317,7 +317,8 @@ dsl_dataset_user_hold(nvlist_t *holds, minor_t cleanup_minor, nvlist_t *errlist) dduha.dduha_minor = cleanup_minor; ret = dsl_sync_task(nvpair_name(pair), dsl_dataset_user_hold_check, - dsl_dataset_user_hold_sync, &dduha, fnvlist_num_pairs(holds)); + dsl_dataset_user_hold_sync, &dduha, + fnvlist_num_pairs(holds), ZFS_SPACE_CHECK_RESERVED); fnvlist_free(dduha.dduha_chkholds); return (ret); @@ -600,8 +601,7 @@ dsl_dataset_user_release_impl(nvlist_t *holds, nvlist_t *errlist, ddura.ddura_chkholds = fnvlist_alloc(); error = dsl_sync_task(pool, dsl_dataset_user_release_check, - dsl_dataset_user_release_sync, &ddura, - fnvlist_num_pairs(holds)); + dsl_dataset_user_release_sync, &ddura, 0, ZFS_SPACE_CHECK_NONE); fnvlist_free(ddura.ddura_todelete); fnvlist_free(ddura.ddura_chkholds); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c index 407c6eaf429..370556fcfb7 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c @@ -32,6 +32,7 @@ #include #include #include +#include SYSCTL_DECL(_vfs_zfs); SYSCTL_NODE(_vfs_zfs, OID_AUTO, metaslab, CTLFLAG_RW, 0, "ZFS metaslab"); @@ -55,7 +56,6 @@ SYSCTL_NODE(_vfs_zfs, OID_AUTO, metaslab, CTLFLAG_RW, 0, "ZFS metaslab"); uint64_t metaslab_aliquot = 512ULL << 10; uint64_t metaslab_gang_bang = SPA_MAXBLOCKSIZE + 1; /* force gang blocks */ -TUNABLE_QUAD("vfs.zfs.metaslab.gang_bang", &metaslab_gang_bang); SYSCTL_QUAD(_vfs_zfs_metaslab, OID_AUTO, gang_bang, CTLFLAG_RWTUN, &metaslab_gang_bang, 0, "Force gang block allocation for blocks larger than or equal to this value"); @@ -67,16 +67,30 @@ SYSCTL_QUAD(_vfs_zfs_metaslab, OID_AUTO, gang_bang, CTLFLAG_RWTUN, * Values should be greater than or equal to 100. */ int zfs_condense_pct = 200; -TUNABLE_INT("vfs.zfs.condense_pct", &zfs_condense_pct); SYSCTL_INT(_vfs_zfs, OID_AUTO, condense_pct, CTLFLAG_RWTUN, &zfs_condense_pct, 0, "Condense on-disk spacemap when it is more than this many percents" " of in-memory counterpart"); +/* + * Condensing a metaslab is not guaranteed to actually reduce the amount of + * space used on disk. In particular, a space map uses data in increments of + * MAX(1 << ashift, SPACE_MAP_INITIAL_BLOCKSIZE), so a metaslab might use the + * same number of blocks after condensing. Since the goal of condensing is to + * reduce the number of IOPs required to read the space map, we only want to + * condense when we can be sure we will reduce the number of blocks used by the + * space map. Unfortunately, we cannot precisely compute whether or not this is + * the case in metaslab_should_condense since we are holding ms_lock. Instead, + * we apply the following heuristic: do not condense a spacemap unless the + * uncondensed size consumes greater than zfs_metaslab_condense_block_threshold + * blocks. + */ +int zfs_metaslab_condense_block_threshold = 4; + /* * The zfs_mg_noalloc_threshold defines which metaslab groups should * be eligible for allocation. The value is defined as a percentage of - * a free space. Metaslab groups that have more free space than + * free space. Metaslab groups that have more free space than * zfs_mg_noalloc_threshold are always eligible for allocations. Once * a metaslab group's free space is less than or equal to the * zfs_mg_noalloc_threshold the allocator will avoid allocating to that @@ -87,17 +101,40 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, condense_pct, CTLFLAG_RWTUN, * no metaslab group will be excluded based on this criterion. */ int zfs_mg_noalloc_threshold = 0; -TUNABLE_INT("vfs.zfs.mg_noalloc_threshold", &zfs_mg_noalloc_threshold); SYSCTL_INT(_vfs_zfs, OID_AUTO, mg_noalloc_threshold, CTLFLAG_RWTUN, &zfs_mg_noalloc_threshold, 0, "Percentage of metaslab group size that should be free" " to make it eligible for allocation"); +/* + * Metaslab groups are considered eligible for allocations if their + * fragmenation metric (measured as a percentage) is less than or equal to + * zfs_mg_fragmentation_threshold. If a metaslab group exceeds this threshold + * then it will be skipped unless all metaslab groups within the metaslab + * class have also crossed this threshold. + */ +int zfs_mg_fragmentation_threshold = 85; +SYSCTL_INT(_vfs_zfs, OID_AUTO, mg_fragmentation_threshold, CTLFLAG_RWTUN, + &zfs_mg_fragmentation_threshold, 0, + "Percentage of metaslab group size that should be considered " + "eligible for allocations unless all metaslab groups within the metaslab class " + "have also crossed this threshold"); + +/* + * Allow metaslabs to keep their active state as long as their fragmentation + * percentage is less than or equal to zfs_metaslab_fragmentation_threshold. An + * active metaslab that exceeds this threshold will no longer keep its active + * status allowing better metaslabs to be selected. + */ +int zfs_metaslab_fragmentation_threshold = 70; +SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, fragmentation_threshold, CTLFLAG_RWTUN, + &zfs_metaslab_fragmentation_threshold, 0, + "Maximum percentage of metaslab fragmentation level to keep their active state"); + /* * When set will load all metaslabs when pool is first opened. */ int metaslab_debug_load = 0; -TUNABLE_INT("vfs.zfs.metaslab.debug_load", &metaslab_debug_load); SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, debug_load, CTLFLAG_RWTUN, &metaslab_debug_load, 0, "Load all metaslabs when pool is first opened"); @@ -106,7 +143,6 @@ SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, debug_load, CTLFLAG_RWTUN, * When set will prevent metaslabs from being unloaded. */ int metaslab_debug_unload = 0; -TUNABLE_INT("vfs.zfs.metaslab.debug_unload", &metaslab_debug_unload); SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, debug_unload, CTLFLAG_RWTUN, &metaslab_debug_unload, 0, "Prevent metaslabs from being unloaded"); @@ -118,8 +154,6 @@ SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, debug_unload, CTLFLAG_RWTUN, * aggressive strategy (i.e search by size rather than offset). */ uint64_t metaslab_df_alloc_threshold = SPA_MAXBLOCKSIZE; -TUNABLE_QUAD("vfs.zfs.metaslab.df_alloc_threshold", - &metaslab_df_alloc_threshold); SYSCTL_QUAD(_vfs_zfs_metaslab, OID_AUTO, df_alloc_threshold, CTLFLAG_RWTUN, &metaslab_df_alloc_threshold, 0, "Minimum size which forces the dynamic allocator to change it's allocation strategy"); @@ -131,27 +165,25 @@ SYSCTL_QUAD(_vfs_zfs_metaslab, OID_AUTO, df_alloc_threshold, CTLFLAG_RWTUN, * switch to using best-fit allocations. */ int metaslab_df_free_pct = 4; -TUNABLE_INT("vfs.zfs.metaslab.df_free_pct", &metaslab_df_free_pct); SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, df_free_pct, CTLFLAG_RWTUN, &metaslab_df_free_pct, 0, - "The minimum free space, in percent, which must be available in a space map to continue allocations in a first-fit fashion"); + "The minimum free space, in percent, which must be available in a " + "space map to continue allocations in a first-fit fashion"); /* * A metaslab is considered "free" if it contains a contiguous * segment which is greater than metaslab_min_alloc_size. */ uint64_t metaslab_min_alloc_size = DMU_MAX_ACCESS; -TUNABLE_QUAD("vfs.zfs.metaslab.min_alloc_size", - &metaslab_min_alloc_size); SYSCTL_QUAD(_vfs_zfs_metaslab, OID_AUTO, min_alloc_size, CTLFLAG_RWTUN, &metaslab_min_alloc_size, 0, - "A metaslab is considered \"free\" if it contains a contiguous segment which is greater than vfs.zfs.metaslab.min_alloc_size"); + "A metaslab is considered \"free\" if it contains a contiguous " + "segment which is greater than vfs.zfs.metaslab.min_alloc_size"); /* * Percentage of all cpus that can be used by the metaslab taskq. */ int metaslab_load_pct = 50; -TUNABLE_INT("vfs.zfs.metaslab.load_pct", &metaslab_load_pct); SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, load_pct, CTLFLAG_RWTUN, &metaslab_load_pct, 0, "Percentage of cpus that can be used by the metaslab taskq"); @@ -162,24 +194,14 @@ SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, load_pct, CTLFLAG_RWTUN, * keep it loaded. */ int metaslab_unload_delay = TXG_SIZE * 2; -TUNABLE_INT("vfs.zfs.metaslab.unload_delay", &metaslab_unload_delay); SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, unload_delay, CTLFLAG_RWTUN, &metaslab_unload_delay, 0, "Number of TXGs that an unused metaslab can be kept in memory"); -/* - * Should we be willing to write data to degraded vdevs? - */ -boolean_t zfs_write_to_degraded = B_FALSE; -SYSCTL_INT(_vfs_zfs, OID_AUTO, write_to_degraded, CTLFLAG_RWTUN, - &zfs_write_to_degraded, 0, "Allow writing data to degraded vdevs"); -TUNABLE_INT("vfs.zfs.write_to_degraded", &zfs_write_to_degraded); - /* * Max number of metaslabs per group to preload. */ int metaslab_preload_limit = SPA_DVAS_PER_BP; -TUNABLE_INT("vfs.zfs.metaslab.preload_limit", &metaslab_preload_limit); SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, preload_limit, CTLFLAG_RWTUN, &metaslab_preload_limit, 0, "Max number of metaslabs per group to preload"); @@ -188,21 +210,35 @@ SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, preload_limit, CTLFLAG_RWTUN, * Enable/disable preloading of metaslab. */ boolean_t metaslab_preload_enabled = B_TRUE; -TUNABLE_INT("vfs.zfs.metaslab.preload_enabled", &metaslab_preload_enabled); SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, preload_enabled, CTLFLAG_RWTUN, &metaslab_preload_enabled, 0, "Max number of metaslabs per group to preload"); /* - * Enable/disable additional weight factor for each metaslab. + * Enable/disable fragmentation weighting on metaslabs. */ -boolean_t metaslab_weight_factor_enable = B_FALSE; -TUNABLE_INT("vfs.zfs.metaslab.weight_factor_enable", - &metaslab_weight_factor_enable); -SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, weight_factor_enable, CTLFLAG_RWTUN, - &metaslab_weight_factor_enable, 0, - "Enable additional weight factor for each metaslab"); +boolean_t metaslab_fragmentation_factor_enabled = B_TRUE; +SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, fragmentation_factor_enabled, CTLFLAG_RWTUN, + &metaslab_fragmentation_factor_enabled, 0, + "Enable fragmentation weighting on metaslabs"); +/* + * Enable/disable lba weighting (i.e. outer tracks are given preference). + */ +boolean_t metaslab_lba_weighting_enabled = B_TRUE; +SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, lba_weighting_enabled, CTLFLAG_RWTUN, + &metaslab_lba_weighting_enabled, 0, + "Enable LBA weighting (i.e. outer tracks are given preference)"); + +/* + * Enable/disable metaslab group biasing. + */ +boolean_t metaslab_bias_enabled = B_TRUE; +SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, bias_enabled, CTLFLAG_RWTUN, + &metaslab_bias_enabled, 0, + "Enable metaslab group biasing"); + +static uint64_t metaslab_fragmentation(metaslab_t *); /* * ========================================================================== @@ -322,6 +358,121 @@ metaslab_class_get_minblocksize(metaslab_class_t *mc) return (mc->mc_minblocksize); } +void +metaslab_class_histogram_verify(metaslab_class_t *mc) +{ + vdev_t *rvd = mc->mc_spa->spa_root_vdev; + uint64_t *mc_hist; + int i; + + if ((zfs_flags & ZFS_DEBUG_HISTOGRAM_VERIFY) == 0) + return; + + mc_hist = kmem_zalloc(sizeof (uint64_t) * RANGE_TREE_HISTOGRAM_SIZE, + KM_SLEEP); + + for (int c = 0; c < rvd->vdev_children; c++) { + vdev_t *tvd = rvd->vdev_child[c]; + metaslab_group_t *mg = tvd->vdev_mg; + + /* + * Skip any holes, uninitialized top-levels, or + * vdevs that are not in this metalab class. + */ + if (tvd->vdev_ishole || tvd->vdev_ms_shift == 0 || + mg->mg_class != mc) { + continue; + } + + for (i = 0; i < RANGE_TREE_HISTOGRAM_SIZE; i++) + mc_hist[i] += mg->mg_histogram[i]; + } + + for (i = 0; i < RANGE_TREE_HISTOGRAM_SIZE; i++) + VERIFY3U(mc_hist[i], ==, mc->mc_histogram[i]); + + kmem_free(mc_hist, sizeof (uint64_t) * RANGE_TREE_HISTOGRAM_SIZE); +} + +/* + * Calculate the metaslab class's fragmentation metric. The metric + * is weighted based on the space contribution of each metaslab group. + * The return value will be a number between 0 and 100 (inclusive), or + * ZFS_FRAG_INVALID if the metric has not been set. See comment above the + * zfs_frag_table for more information about the metric. + */ +uint64_t +metaslab_class_fragmentation(metaslab_class_t *mc) +{ + vdev_t *rvd = mc->mc_spa->spa_root_vdev; + uint64_t fragmentation = 0; + + spa_config_enter(mc->mc_spa, SCL_VDEV, FTAG, RW_READER); + + for (int c = 0; c < rvd->vdev_children; c++) { + vdev_t *tvd = rvd->vdev_child[c]; + metaslab_group_t *mg = tvd->vdev_mg; + + /* + * Skip any holes, uninitialized top-levels, or + * vdevs that are not in this metalab class. + */ + if (tvd->vdev_ishole || tvd->vdev_ms_shift == 0 || + mg->mg_class != mc) { + continue; + } + + /* + * If a metaslab group does not contain a fragmentation + * metric then just bail out. + */ + if (mg->mg_fragmentation == ZFS_FRAG_INVALID) { + spa_config_exit(mc->mc_spa, SCL_VDEV, FTAG); + return (ZFS_FRAG_INVALID); + } + + /* + * Determine how much this metaslab_group is contributing + * to the overall pool fragmentation metric. + */ + fragmentation += mg->mg_fragmentation * + metaslab_group_get_space(mg); + } + fragmentation /= metaslab_class_get_space(mc); + + ASSERT3U(fragmentation, <=, 100); + spa_config_exit(mc->mc_spa, SCL_VDEV, FTAG); + return (fragmentation); +} + +/* + * Calculate the amount of expandable space that is available in + * this metaslab class. If a device is expanded then its expandable + * space will be the amount of allocatable space that is currently not + * part of this metaslab class. + */ +uint64_t +metaslab_class_expandable_space(metaslab_class_t *mc) +{ + vdev_t *rvd = mc->mc_spa->spa_root_vdev; + uint64_t space = 0; + + spa_config_enter(mc->mc_spa, SCL_VDEV, FTAG, RW_READER); + for (int c = 0; c < rvd->vdev_children; c++) { + vdev_t *tvd = rvd->vdev_child[c]; + metaslab_group_t *mg = tvd->vdev_mg; + + if (tvd->vdev_ishole || tvd->vdev_ms_shift == 0 || + mg->mg_class != mc) { + continue; + } + + space += tvd->vdev_max_asize - tvd->vdev_asize; + } + spa_config_exit(mc->mc_spa, SCL_VDEV, FTAG); + return (space); +} + /* * ========================================================================== * Metaslab groups @@ -374,7 +525,15 @@ metaslab_group_alloc_update(metaslab_group_t *mg) mg->mg_free_capacity = ((vs->vs_space - vs->vs_alloc) * 100) / (vs->vs_space + 1); - mg->mg_allocatable = (mg->mg_free_capacity > zfs_mg_noalloc_threshold); + /* + * A metaslab group is considered allocatable if it has plenty + * of free space or is not heavily fragmented. We only take + * fragmentation into account if the metaslab group has a valid + * fragmentation metric (i.e. a value between 0 and 100). + */ + mg->mg_allocatable = (mg->mg_free_capacity > zfs_mg_noalloc_threshold && + (mg->mg_fragmentation == ZFS_FRAG_INVALID || + mg->mg_fragmentation <= zfs_mg_fragmentation_threshold)); /* * The mc_alloc_groups maintains a count of the number of @@ -395,6 +554,7 @@ metaslab_group_alloc_update(metaslab_group_t *mg) mc->mc_alloc_groups--; else if (!was_allocatable && mg->mg_allocatable) mc->mc_alloc_groups++; + mutex_exit(&mg->mg_lock); } @@ -485,6 +645,7 @@ metaslab_group_passivate(metaslab_group_t *mg) } taskq_wait(mg->mg_taskq); + metaslab_group_alloc_update(mg); mgprev = mg->mg_prev; mgnext = mg->mg_next; @@ -502,20 +663,113 @@ metaslab_group_passivate(metaslab_group_t *mg) metaslab_class_minblocksize_update(mc); } +uint64_t +metaslab_group_get_space(metaslab_group_t *mg) +{ + return ((1ULL << mg->mg_vd->vdev_ms_shift) * mg->mg_vd->vdev_ms_count); +} + +void +metaslab_group_histogram_verify(metaslab_group_t *mg) +{ + uint64_t *mg_hist; + vdev_t *vd = mg->mg_vd; + uint64_t ashift = vd->vdev_ashift; + int i; + + if ((zfs_flags & ZFS_DEBUG_HISTOGRAM_VERIFY) == 0) + return; + + mg_hist = kmem_zalloc(sizeof (uint64_t) * RANGE_TREE_HISTOGRAM_SIZE, + KM_SLEEP); + + ASSERT3U(RANGE_TREE_HISTOGRAM_SIZE, >=, + SPACE_MAP_HISTOGRAM_SIZE + ashift); + + for (int m = 0; m < vd->vdev_ms_count; m++) { + metaslab_t *msp = vd->vdev_ms[m]; + + if (msp->ms_sm == NULL) + continue; + + for (i = 0; i < SPACE_MAP_HISTOGRAM_SIZE; i++) + mg_hist[i + ashift] += + msp->ms_sm->sm_phys->smp_histogram[i]; + } + + for (i = 0; i < RANGE_TREE_HISTOGRAM_SIZE; i ++) + VERIFY3U(mg_hist[i], ==, mg->mg_histogram[i]); + + kmem_free(mg_hist, sizeof (uint64_t) * RANGE_TREE_HISTOGRAM_SIZE); +} + +static void +metaslab_group_histogram_add(metaslab_group_t *mg, metaslab_t *msp) +{ + metaslab_class_t *mc = mg->mg_class; + uint64_t ashift = mg->mg_vd->vdev_ashift; + + ASSERT(MUTEX_HELD(&msp->ms_lock)); + if (msp->ms_sm == NULL) + return; + + mutex_enter(&mg->mg_lock); + for (int i = 0; i < SPACE_MAP_HISTOGRAM_SIZE; i++) { + mg->mg_histogram[i + ashift] += + msp->ms_sm->sm_phys->smp_histogram[i]; + mc->mc_histogram[i + ashift] += + msp->ms_sm->sm_phys->smp_histogram[i]; + } + mutex_exit(&mg->mg_lock); +} + +void +metaslab_group_histogram_remove(metaslab_group_t *mg, metaslab_t *msp) +{ + metaslab_class_t *mc = mg->mg_class; + uint64_t ashift = mg->mg_vd->vdev_ashift; + + ASSERT(MUTEX_HELD(&msp->ms_lock)); + if (msp->ms_sm == NULL) + return; + + mutex_enter(&mg->mg_lock); + for (int i = 0; i < SPACE_MAP_HISTOGRAM_SIZE; i++) { + ASSERT3U(mg->mg_histogram[i + ashift], >=, + msp->ms_sm->sm_phys->smp_histogram[i]); + ASSERT3U(mc->mc_histogram[i + ashift], >=, + msp->ms_sm->sm_phys->smp_histogram[i]); + + mg->mg_histogram[i + ashift] -= + msp->ms_sm->sm_phys->smp_histogram[i]; + mc->mc_histogram[i + ashift] -= + msp->ms_sm->sm_phys->smp_histogram[i]; + } + mutex_exit(&mg->mg_lock); +} + static void metaslab_group_add(metaslab_group_t *mg, metaslab_t *msp) { - mutex_enter(&mg->mg_lock); ASSERT(msp->ms_group == NULL); + mutex_enter(&mg->mg_lock); msp->ms_group = mg; msp->ms_weight = 0; avl_add(&mg->mg_metaslab_tree, msp); mutex_exit(&mg->mg_lock); + + mutex_enter(&msp->ms_lock); + metaslab_group_histogram_add(mg, msp); + mutex_exit(&msp->ms_lock); } static void metaslab_group_remove(metaslab_group_t *mg, metaslab_t *msp) { + mutex_enter(&msp->ms_lock); + metaslab_group_histogram_remove(mg, msp); + mutex_exit(&msp->ms_lock); + mutex_enter(&mg->mg_lock); ASSERT(msp->ms_group == mg); avl_remove(&mg->mg_metaslab_tree, msp); @@ -528,9 +782,9 @@ metaslab_group_sort(metaslab_group_t *mg, metaslab_t *msp, uint64_t weight) { /* * Although in principle the weight can be any value, in - * practice we do not use values in the range [1, 510]. + * practice we do not use values in the range [1, 511]. */ - ASSERT(weight >= SPA_MINBLOCKSIZE-1 || weight == 0); + ASSERT(weight >= SPA_MINBLOCKSIZE || weight == 0); ASSERT(MUTEX_HELD(&msp->ms_lock)); mutex_enter(&mg->mg_lock); @@ -541,10 +795,43 @@ metaslab_group_sort(metaslab_group_t *mg, metaslab_t *msp, uint64_t weight) mutex_exit(&mg->mg_lock); } +/* + * Calculate the fragmentation for a given metaslab group. We can use + * a simple average here since all metaslabs within the group must have + * the same size. The return value will be a value between 0 and 100 + * (inclusive), or ZFS_FRAG_INVALID if less than half of the metaslab in this + * group have a fragmentation metric. + */ +uint64_t +metaslab_group_fragmentation(metaslab_group_t *mg) +{ + vdev_t *vd = mg->mg_vd; + uint64_t fragmentation = 0; + uint64_t valid_ms = 0; + + for (int m = 0; m < vd->vdev_ms_count; m++) { + metaslab_t *msp = vd->vdev_ms[m]; + + if (msp->ms_fragmentation == ZFS_FRAG_INVALID) + continue; + + valid_ms++; + fragmentation += msp->ms_fragmentation; + } + + if (valid_ms <= vd->vdev_ms_count / 2) + return (ZFS_FRAG_INVALID); + + fragmentation /= valid_ms; + ASSERT3U(fragmentation, <=, 100); + return (fragmentation); +} + /* * Determine if a given metaslab group should skip allocations. A metaslab - * group should avoid allocations if its used capacity has crossed the - * zfs_mg_noalloc_threshold and there is at least one metaslab group + * group should avoid allocations if its free capacity is less than the + * zfs_mg_noalloc_threshold or its fragmentation metric is greater than + * zfs_mg_fragmentation_threshold and there is at least one metaslab group * that can still handle allocations. */ static boolean_t @@ -555,12 +842,19 @@ metaslab_group_allocatable(metaslab_group_t *mg) metaslab_class_t *mc = mg->mg_class; /* - * A metaslab group is considered allocatable if its free capacity - * is greater than the set value of zfs_mg_noalloc_threshold, it's - * associated with a slog, or there are no other metaslab groups - * with free capacity greater than zfs_mg_noalloc_threshold. + * We use two key metrics to determine if a metaslab group is + * considered allocatable -- free space and fragmentation. If + * the free space is greater than the free space threshold and + * the fragmentation is less than the fragmentation threshold then + * consider the group allocatable. There are two case when we will + * not consider these key metrics. The first is if the group is + * associated with a slog device and the second is if all groups + * in this metaslab class have already been consider ineligible + * for allocations. */ - return (mg->mg_free_capacity > zfs_mg_noalloc_threshold || + return ((mg->mg_free_capacity > zfs_mg_noalloc_threshold && + (mg->mg_fragmentation == ZFS_FRAG_INVALID || + mg->mg_fragmentation <= zfs_mg_fragmentation_threshold)) || mc != spa_normal_class(spa) || mc->mc_alloc_groups == 0); } @@ -784,16 +1078,8 @@ metaslab_ff_alloc(metaslab_t *msp, uint64_t size) return (metaslab_block_picker(t, cursor, size, align)); } -/* ARGSUSED */ -static boolean_t -metaslab_ff_fragmented(metaslab_t *msp) -{ - return (B_TRUE); -} - static metaslab_ops_t metaslab_ff_ops = { - metaslab_ff_alloc, - metaslab_ff_fragmented + metaslab_ff_alloc }; /* @@ -840,23 +1126,8 @@ metaslab_df_alloc(metaslab_t *msp, uint64_t size) return (metaslab_block_picker(t, cursor, size, 1ULL)); } -static boolean_t -metaslab_df_fragmented(metaslab_t *msp) -{ - range_tree_t *rt = msp->ms_tree; - uint64_t max_size = metaslab_block_maxsize(msp); - int free_pct = range_tree_space(rt) * 100 / msp->ms_size; - - if (max_size >= metaslab_df_alloc_threshold && - free_pct >= metaslab_df_free_pct) - return (B_FALSE); - - return (B_TRUE); -} - static metaslab_ops_t metaslab_df_ops = { - metaslab_df_alloc, - metaslab_df_fragmented + metaslab_df_alloc }; /* @@ -899,15 +1170,8 @@ metaslab_cf_alloc(metaslab_t *msp, uint64_t size) return (offset); } -static boolean_t -metaslab_cf_fragmented(metaslab_t *msp) -{ - return (metaslab_block_maxsize(msp) < metaslab_min_alloc_size); -} - static metaslab_ops_t metaslab_cf_ops = { - metaslab_cf_alloc, - metaslab_cf_fragmented + metaslab_cf_alloc }; /* @@ -964,16 +1228,8 @@ metaslab_ndf_alloc(metaslab_t *msp, uint64_t size) return (-1ULL); } -static boolean_t -metaslab_ndf_fragmented(metaslab_t *msp) -{ - return (metaslab_block_maxsize(msp) <= - (metaslab_min_alloc_size << metaslab_ndf_clump_shift)); -} - static metaslab_ops_t metaslab_ndf_ops = { - metaslab_ndf_alloc, - metaslab_ndf_fragmented + metaslab_ndf_alloc }; metaslab_ops_t *zfs_metaslab_ops = &metaslab_df_ops; @@ -1075,6 +1331,7 @@ metaslab_init(metaslab_group_t *mg, uint64_t id, uint64_t object, uint64_t txg) msp->ms_tree = range_tree_create(&metaslab_rt_ops, msp, &msp->ms_lock); metaslab_group_add(mg, msp); + msp->ms_fragmentation = metaslab_fragmentation(msp); msp->ms_ops = mg->mg_class->mc_ops; /* @@ -1140,69 +1397,113 @@ metaslab_fini(metaslab_t *msp) kmem_free(msp, sizeof (metaslab_t)); } +#define FRAGMENTATION_TABLE_SIZE 17 + /* - * Apply a weighting factor based on the histogram information for this - * metaslab. The current weighting factor is somewhat arbitrary and requires - * additional investigation. The implementation provides a measure of - * "weighted" free space and gives a higher weighting for larger contiguous - * regions. The weighting factor is determined by counting the number of - * sm_shift sectors that exist in each region represented by the histogram. - * That value is then multiplied by the power of 2 exponent and the sm_shift - * value. + * This table defines a segment size based fragmentation metric that will + * allow each metaslab to derive its own fragmentation value. This is done + * by calculating the space in each bucket of the spacemap histogram and + * multiplying that by the fragmetation metric in this table. Doing + * this for all buckets and dividing it by the total amount of free + * space in this metaslab (i.e. the total free space in all buckets) gives + * us the fragmentation metric. This means that a high fragmentation metric + * equates to most of the free space being comprised of small segments. + * Conversely, if the metric is low, then most of the free space is in + * large segments. A 10% change in fragmentation equates to approximately + * double the number of segments. * - * For example, assume the 2^21 histogram bucket has 4 2MB regions and the - * metaslab has an sm_shift value of 9 (512B): - * - * 1) calculate the number of sm_shift sectors in the region: - * 2^21 / 2^9 = 2^12 = 4096 * 4 (number of regions) = 16384 - * 2) multiply by the power of 2 exponent and the sm_shift value: - * 16384 * 21 * 9 = 3096576 - * This value will be added to the weighting of the metaslab. + * This table defines 0% fragmented space using 16MB segments. Testing has + * shown that segments that are greater than or equal to 16MB do not suffer + * from drastic performance problems. Using this value, we derive the rest + * of the table. Since the fragmentation value is never stored on disk, it + * is possible to change these calculations in the future. + */ +int zfs_frag_table[FRAGMENTATION_TABLE_SIZE] = { + 100, /* 512B */ + 100, /* 1K */ + 98, /* 2K */ + 95, /* 4K */ + 90, /* 8K */ + 80, /* 16K */ + 70, /* 32K */ + 60, /* 64K */ + 50, /* 128K */ + 40, /* 256K */ + 30, /* 512K */ + 20, /* 1M */ + 15, /* 2M */ + 10, /* 4M */ + 5, /* 8M */ + 0 /* 16M */ +}; + +/* + * Calclate the metaslab's fragmentation metric. A return value + * of ZFS_FRAG_INVALID means that the metaslab has not been upgraded and does + * not support this metric. Otherwise, the return value should be in the + * range [0, 100]. */ static uint64_t -metaslab_weight_factor(metaslab_t *msp) +metaslab_fragmentation(metaslab_t *msp) { - uint64_t factor = 0; - uint64_t sectors; - int i; + spa_t *spa = msp->ms_group->mg_vd->vdev_spa; + uint64_t fragmentation = 0; + uint64_t total = 0; + boolean_t feature_enabled = spa_feature_is_enabled(spa, + SPA_FEATURE_SPACEMAP_HISTOGRAM); + + if (!feature_enabled) + return (ZFS_FRAG_INVALID); /* - * A null space map means that the entire metaslab is free, - * calculate a weight factor that spans the entire size of the - * metaslab. + * A null space map means that the entire metaslab is free + * and thus is not fragmented. */ - if (msp->ms_sm == NULL) { - vdev_t *vd = msp->ms_group->mg_vd; - - i = highbit64(msp->ms_size) - 1; - sectors = msp->ms_size >> vd->vdev_ashift; - return (sectors * i * vd->vdev_ashift); - } - - if (msp->ms_sm->sm_dbuf->db_size != sizeof (space_map_phys_t)) + if (msp->ms_sm == NULL) return (0); - for (i = 0; i < SPACE_MAP_HISTOGRAM_SIZE(msp->ms_sm); i++) { + /* + * If this metaslab's space_map has not been upgraded, flag it + * so that we upgrade next time we encounter it. + */ + if (msp->ms_sm->sm_dbuf->db_size != sizeof (space_map_phys_t)) { + uint64_t txg = spa_syncing_txg(spa); + vdev_t *vd = msp->ms_group->mg_vd; + + msp->ms_condense_wanted = B_TRUE; + vdev_dirty(vd, VDD_METASLAB, msp, txg + 1); + spa_dbgmsg(spa, "txg %llu, requesting force condense: " + "msp %p, vd %p", txg, msp, vd); + return (ZFS_FRAG_INVALID); + } + + for (int i = 0; i < SPACE_MAP_HISTOGRAM_SIZE; i++) { + uint64_t space = 0; + uint8_t shift = msp->ms_sm->sm_shift; + int idx = MIN(shift - SPA_MINBLOCKSHIFT + i, + FRAGMENTATION_TABLE_SIZE - 1); + if (msp->ms_sm->sm_phys->smp_histogram[i] == 0) continue; - /* - * Determine the number of sm_shift sectors in the region - * indicated by the histogram. For example, given an - * sm_shift value of 9 (512 bytes) and i = 4 then we know - * that we're looking at an 8K region in the histogram - * (i.e. 9 + 4 = 13, 2^13 = 8192). To figure out the - * number of sm_shift sectors (512 bytes in this example), - * we would take 8192 / 512 = 16. Since the histogram - * is offset by sm_shift we can simply use the value of - * of i to calculate this (i.e. 2^i = 16 where i = 4). - */ - sectors = msp->ms_sm->sm_phys->smp_histogram[i] << i; - factor += (i + msp->ms_sm->sm_shift) * sectors; + space = msp->ms_sm->sm_phys->smp_histogram[i] << (i + shift); + total += space; + + ASSERT3U(idx, <, FRAGMENTATION_TABLE_SIZE); + fragmentation += space * zfs_frag_table[idx]; } - return (factor * msp->ms_sm->sm_shift); + + if (total > 0) + fragmentation /= total; + ASSERT3U(fragmentation, <=, 100); + return (fragmentation); } +/* + * Compute a weight -- a selection preference value -- for the given metaslab. + * This is based on the amount of free space, the level of fragmentation, + * the LBA range, and whether the metaslab is loaded. + */ static uint64_t metaslab_weight(metaslab_t *msp) { @@ -1226,6 +1527,29 @@ metaslab_weight(metaslab_t *msp) * The baseline weight is the metaslab's free space. */ space = msp->ms_size - space_map_allocated(msp->ms_sm); + + msp->ms_fragmentation = metaslab_fragmentation(msp); + if (metaslab_fragmentation_factor_enabled && + msp->ms_fragmentation != ZFS_FRAG_INVALID) { + /* + * Use the fragmentation information to inversely scale + * down the baseline weight. We need to ensure that we + * don't exclude this metaslab completely when it's 100% + * fragmented. To avoid this we reduce the fragmented value + * by 1. + */ + space = (space * (100 - (msp->ms_fragmentation - 1))) / 100; + + /* + * If space < SPA_MINBLOCKSIZE, then we will not allocate from + * this metaslab again. The fragmentation metric may have + * decreased the space to something smaller than + * SPA_MINBLOCKSIZE, so reset the space to SPA_MINBLOCKSIZE + * so that we can consume any remaining space. + */ + if (space > 0 && space < SPA_MINBLOCKSIZE) + space = SPA_MINBLOCKSIZE; + } weight = space; /* @@ -1237,19 +1561,19 @@ metaslab_weight(metaslab_t *msp) * In effect, this means that we'll select the metaslab with the most * free bandwidth rather than simply the one with the most free space. */ - weight = 2 * weight - (msp->ms_id * weight) / vd->vdev_ms_count; - ASSERT(weight >= space && weight <= 2 * space); + if (metaslab_lba_weighting_enabled) { + weight = 2 * weight - (msp->ms_id * weight) / vd->vdev_ms_count; + ASSERT(weight >= space && weight <= 2 * space); + } - msp->ms_factor = metaslab_weight_factor(msp); - if (metaslab_weight_factor_enable) - weight += msp->ms_factor; - - if (msp->ms_loaded && !msp->ms_ops->msop_fragmented(msp)) { - /* - * If this metaslab is one we're actively using, adjust its - * weight to make it preferable to any inactive metaslab so - * we'll polish it off. - */ + /* + * If this metaslab is one we're actively using, adjust its + * weight to make it preferable to any inactive metaslab so + * we'll polish it off. If the fragmentation on this metaslab + * has exceed our threshold, then don't mark it active. + */ + if (msp->ms_loaded && msp->ms_fragmentation != ZFS_FRAG_INVALID && + msp->ms_fragmentation <= zfs_metaslab_fragmentation_threshold) { weight |= (msp->ms_weight & METASLAB_ACTIVE_MASK); } @@ -1299,6 +1623,8 @@ metaslab_preload(void *arg) metaslab_t *msp = arg; spa_t *spa = msp->ms_group->mg_vd->vdev_spa; + ASSERT(!MUTEX_HELD(&msp->ms_group->mg_lock)); + mutex_enter(&msp->ms_lock); metaslab_load_wait(msp); if (!msp->ms_loaded) @@ -1323,19 +1649,43 @@ metaslab_group_preload(metaslab_group_t *mg) taskq_wait(mg->mg_taskq); return; } + mutex_enter(&mg->mg_lock); - /* - * Prefetch the next potential metaslabs + * Load the next potential metaslabs */ - for (msp = avl_first(t); msp != NULL; msp = AVL_NEXT(t, msp)) { + msp = avl_first(t); + while (msp != NULL) { + metaslab_t *msp_next = AVL_NEXT(t, msp); - /* If we have reached our preload limit then we're done */ - if (++m > metaslab_preload_limit) - break; + /* + * We preload only the maximum number of metaslabs specified + * by metaslab_preload_limit. If a metaslab is being forced + * to condense then we preload it too. This will ensure + * that force condensing happens in the next txg. + */ + if (++m > metaslab_preload_limit && !msp->ms_condense_wanted) { + msp = msp_next; + continue; + } + /* + * We must drop the metaslab group lock here to preserve + * lock ordering with the ms_lock (when grabbing both + * the mg_lock and the ms_lock, the ms_lock must be taken + * first). As a result, it is possible that the ordering + * of the metaslabs within the avl tree may change before + * we reacquire the lock. The metaslab cannot be removed from + * the tree while we're in syncing context so it is safe to + * drop the mg_lock here. If the metaslabs are reordered + * nothing will break -- we just may end up loading a + * less than optimal one. + */ + mutex_exit(&mg->mg_lock); VERIFY(taskq_dispatch(mg->mg_taskq, metaslab_preload, msp, TQ_SLEEP) != 0); + mutex_enter(&mg->mg_lock); + msp = msp_next; } mutex_exit(&mg->mg_lock); } @@ -1352,6 +1702,8 @@ metaslab_group_preload(metaslab_group_t *mg) * times the size than the free space range tree representation * (i.e. zfs_condense_pct = 110 and in-core = 1MB, minimal = 1.1.MB). * + * 3. The on-disk size of the space map should actually decrease. + * * Checking the first condition is tricky since we don't want to walk * the entire AVL tree calculating the estimated on-disk size. Instead we * use the size-ordered range tree in the metaslab and calculate the @@ -1362,24 +1714,33 @@ metaslab_group_preload(metaslab_group_t *mg) * To determine the second criterion we use a best-case estimate and assume * each segment can be represented on-disk as a single 64-bit entry. We refer * to this best-case estimate as the space map's minimal form. + * + * Unfortunately, we cannot compute the on-disk size of the space map in this + * context because we cannot accurately compute the effects of compression, etc. + * Instead, we apply the heuristic described in the block comment for + * zfs_metaslab_condense_block_threshold - we only condense if the space used + * is greater than a threshold number of blocks. */ static boolean_t metaslab_should_condense(metaslab_t *msp) { space_map_t *sm = msp->ms_sm; range_seg_t *rs; - uint64_t size, entries, segsz; + uint64_t size, entries, segsz, object_size, optimal_size, record_size; + dmu_object_info_t doi; + uint64_t vdev_blocksize = 1 << msp->ms_group->mg_vd->vdev_ashift; ASSERT(MUTEX_HELD(&msp->ms_lock)); ASSERT(msp->ms_loaded); /* * Use the ms_size_tree range tree, which is ordered by size, to - * obtain the largest segment in the free tree. If the tree is empty - * then we should condense the map. + * obtain the largest segment in the free tree. We always condense + * metaslabs that are empty and metaslabs for which a condense + * request has been made. */ rs = avl_last(&msp->ms_size_tree); - if (rs == NULL) + if (rs == NULL || msp->ms_condense_wanted) return (B_TRUE); /* @@ -1392,9 +1753,15 @@ metaslab_should_condense(metaslab_t *msp) entries = size / (MIN(size, SM_RUN_MAX)); segsz = entries * sizeof (uint64_t); - return (segsz <= space_map_length(msp->ms_sm) && - space_map_length(msp->ms_sm) >= (zfs_condense_pct * - sizeof (uint64_t) * avl_numnodes(&msp->ms_tree->rt_root)) / 100); + optimal_size = sizeof (uint64_t) * avl_numnodes(&msp->ms_tree->rt_root); + object_size = space_map_length(msp->ms_sm); + + dmu_object_info_from_db(sm->sm_dbuf, &doi); + record_size = MAX(doi.doi_data_block_size, vdev_blocksize); + + return (segsz <= object_size && + object_size >= (optimal_size * zfs_condense_pct / 100) && + object_size > zfs_metaslab_condense_block_threshold * record_size); } /* @@ -1414,9 +1781,14 @@ metaslab_condense(metaslab_t *msp, uint64_t txg, dmu_tx_t *tx) ASSERT3U(spa_sync_pass(spa), ==, 1); ASSERT(msp->ms_loaded); + spa_dbgmsg(spa, "condensing: txg %llu, msp[%llu] %p, " - "smp size %llu, segments %lu", txg, msp->ms_id, msp, - space_map_length(msp->ms_sm), avl_numnodes(&msp->ms_tree->rt_root)); + "smp size %llu, segments %lu, forcing condense=%s", txg, + msp->ms_id, msp, space_map_length(msp->ms_sm), + avl_numnodes(&msp->ms_tree->rt_root), + msp->ms_condense_wanted ? "TRUE" : "FALSE"); + + msp->ms_condense_wanted = B_FALSE; /* * Create an range tree that is 100% allocated. We remove segments @@ -1509,8 +1881,14 @@ metaslab_sync(metaslab_t *msp, uint64_t txg) ASSERT3P(*freetree, !=, NULL); ASSERT3P(*freed_tree, !=, NULL); + /* + * Normally, we don't want to process a metaslab if there + * are no allocations or frees to perform. However, if the metaslab + * is being forced to condense we need to let it through. + */ if (range_tree_space(alloctree) == 0 && - range_tree_space(*freetree) == 0) + range_tree_space(*freetree) == 0 && + !msp->ms_condense_wanted) return; /* @@ -1547,8 +1925,9 @@ metaslab_sync(metaslab_t *msp, uint64_t txg) space_map_write(msp->ms_sm, *freetree, SM_FREE, tx); } - range_tree_vacate(alloctree, NULL, NULL); - + metaslab_group_histogram_verify(mg); + metaslab_class_histogram_verify(mg->mg_class); + metaslab_group_histogram_remove(mg, msp); if (msp->ms_loaded) { /* * When the space map is loaded, we have an accruate @@ -1568,6 +1947,9 @@ metaslab_sync(metaslab_t *msp, uint64_t txg) */ space_map_histogram_add(msp->ms_sm, *freetree, tx); } + metaslab_group_histogram_add(mg, msp); + metaslab_group_histogram_verify(mg); + metaslab_class_histogram_verify(mg->mg_class); /* * For sync pass 1, we avoid traversing this txg's free range tree @@ -1580,6 +1962,7 @@ metaslab_sync(metaslab_t *msp, uint64_t txg) } else { range_tree_vacate(*freetree, range_tree_add, *freed_tree); } + range_tree_vacate(alloctree, NULL, NULL); ASSERT0(range_tree_space(msp->ms_alloctree[txg & TXG_MASK])); ASSERT0(range_tree_space(msp->ms_freetree[txg & TXG_MASK])); @@ -1690,13 +2073,13 @@ metaslab_sync_done(metaslab_t *msp, uint64_t txg) metaslab_group_sort(mg, msp, metaslab_weight(msp)); mutex_exit(&msp->ms_lock); - } void metaslab_sync_reassess(metaslab_group_t *mg) { metaslab_group_alloc_update(mg); + mg->mg_fragmentation = metaslab_group_fragmentation(mg); /* * Preload the next potential metaslabs @@ -1958,9 +2341,7 @@ metaslab_alloc_dva(spa_t *spa, metaslab_class_t *mc, uint64_t psize, */ if ((vd->vdev_stat.vs_write_errors > 0 || vd->vdev_state < VDEV_STATE_HEALTHY) && - d == 0 && dshift == 3 && - !(zfs_write_to_degraded && vd->vdev_state == - VDEV_STATE_DEGRADED)) { + d == 0 && dshift == 3 && vd->vdev_children == 0) { all_zero = B_FALSE; goto next; } @@ -1985,7 +2366,7 @@ metaslab_alloc_dva(spa_t *spa, metaslab_class_t *mc, uint64_t psize, * over- or under-used relative to the pool, * and set an allocation bias to even it out. */ - if (mc->mc_aliquot == 0) { + if (mc->mc_aliquot == 0 && metaslab_bias_enabled) { vdev_stat_t *vs = &vd->vdev_stat; int64_t vu, cu; @@ -2007,6 +2388,8 @@ metaslab_alloc_dva(spa_t *spa, metaslab_class_t *mc, uint64_t psize, */ mg->mg_bias = ((cu - vu) * (int64_t)mg->mg_aliquot) / 100; + } else if (!metaslab_bias_enabled) { + mg->mg_bias = 0; } if (atomic_add_64_nv(&mc->mc_aliquot, asize) >= diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/range_tree.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/range_tree.c index 15e123ef5fb..22175e06ab3 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/range_tree.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/range_tree.c @@ -81,6 +81,7 @@ range_tree_stat_incr(range_tree_t *rt, range_seg_t *rs) uint64_t size = rs->rs_end - rs->rs_start; int idx = highbit64(size) - 1; + ASSERT(size != 0); ASSERT3U(idx, <, sizeof (rt->rt_histogram) / sizeof (*rt->rt_histogram)); @@ -95,6 +96,7 @@ range_tree_stat_decr(range_tree_t *rt, range_seg_t *rs) uint64_t size = rs->rs_end - rs->rs_start; int idx = highbit64(size) - 1; + ASSERT(size != 0); ASSERT3U(idx, <, sizeof (rt->rt_histogram) / sizeof (*rt->rt_histogram)); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c index 8e80166c7d1..e3aa01a31c7 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c @@ -286,3 +286,91 @@ rrw_tsd_destroy(void *arg) (void *)curthread, (void *)rn->rn_rrl); } } + +/* + * A reader-mostly lock implementation, tuning above reader-writer locks + * for hightly parallel read acquisitions, while pessimizing writes. + * + * The idea is to split single busy lock into array of locks, so that + * each reader can lock only one of them for read, depending on result + * of simple hash function. That proportionally reduces lock congestion. + * Writer same time has to sequentially aquire write on all the locks. + * That makes write aquisition proportionally slower, but in places where + * it is used (filesystem unmount) performance is not critical. + * + * All the functions below are direct wrappers around functions above. + */ +void +rrm_init(rrmlock_t *rrl, boolean_t track_all) +{ + int i; + + for (i = 0; i < RRM_NUM_LOCKS; i++) + rrw_init(&rrl->locks[i], track_all); +} + +void +rrm_destroy(rrmlock_t *rrl) +{ + int i; + + for (i = 0; i < RRM_NUM_LOCKS; i++) + rrw_destroy(&rrl->locks[i]); +} + +void +rrm_enter(rrmlock_t *rrl, krw_t rw, void *tag) +{ + if (rw == RW_READER) + rrm_enter_read(rrl, tag); + else + rrm_enter_write(rrl); +} + +/* + * This maps the current thread to a specific lock. Note that the lock + * must be released by the same thread that acquired it. We do this + * mapping by taking the thread pointer mod a prime number. We examine + * only the low 32 bits of the thread pointer, because 32-bit division + * is faster than 64-bit division, and the high 32 bits have little + * entropy anyway. + */ +#define RRM_TD_LOCK() (((uint32_t)(uintptr_t)(curthread)) % RRM_NUM_LOCKS) + +void +rrm_enter_read(rrmlock_t *rrl, void *tag) +{ + rrw_enter_read(&rrl->locks[RRM_TD_LOCK()], tag); +} + +void +rrm_enter_write(rrmlock_t *rrl) +{ + int i; + + for (i = 0; i < RRM_NUM_LOCKS; i++) + rrw_enter_write(&rrl->locks[i]); +} + +void +rrm_exit(rrmlock_t *rrl, void *tag) +{ + int i; + + if (rrl->locks[0].rr_writer == curthread) { + for (i = 0; i < RRM_NUM_LOCKS; i++) + rrw_exit(&rrl->locks[i], tag); + } else { + rrw_exit(&rrl->locks[RRM_TD_LOCK()], tag); + } +} + +boolean_t +rrm_held(rrmlock_t *rrl, krw_t rw) +{ + if (rw == RW_WRITER) { + return (rrw_held(&rrl->locks[0], rw)); + } else { + return (rrw_held(&rrl->locks[RRM_TD_LOCK()], rw)); + } +} diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c index b45bf95e6fc..5d8c731c886 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c @@ -1111,6 +1111,9 @@ sa_setup(objset_t *os, uint64_t sa_obj, sa_attr_reg_t *reg_attrs, int count, if (sa->sa_user_table) kmem_free(sa->sa_user_table, sa->sa_user_table_sz); mutex_exit(&sa->sa_lock); + avl_destroy(&sa->sa_layout_hash_tree); + avl_destroy(&sa->sa_layout_num_tree); + mutex_destroy(&sa->sa_lock); kmem_free(sa, sizeof (sa_os_t)); return ((error == ECKSUM) ? EIO : error); } @@ -1146,6 +1149,7 @@ sa_tear_down(objset_t *os) avl_destroy(&sa->sa_layout_hash_tree); avl_destroy(&sa->sa_layout_num_tree); + mutex_destroy(&sa->sa_lock); kmem_free(sa, sizeof (sa_os_t)); os->os_sa = NULL; diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c index c753511479d..a0e19ec7b86 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c @@ -22,7 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2014 by Delphix. All rights reserved. - * Copyright 2013 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2013, 2014, Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013 Martin Matuska . All rights reserved. */ @@ -84,8 +84,7 @@ static int check_hostid = 1; SYSCTL_DECL(_vfs_zfs); -TUNABLE_INT("vfs.zfs.check_hostid", &check_hostid); -SYSCTL_INT(_vfs_zfs, OID_AUTO, check_hostid, CTLFLAG_RW, &check_hostid, 0, +SYSCTL_INT(_vfs_zfs, OID_AUTO, check_hostid, CTLFLAG_RWTUN, &check_hostid, 0, "Check hostid on import?"); /* @@ -211,12 +210,10 @@ spa_prop_get_config(spa_t *spa, nvlist_t **nvp) { vdev_t *rvd = spa->spa_root_vdev; dsl_pool_t *pool = spa->spa_dsl_pool; - uint64_t size; - uint64_t alloc; - uint64_t space; - uint64_t cap, version; + uint64_t size, alloc, cap, version; zprop_source_t src = ZPROP_SRC_NONE; spa_config_dirent_t *dp; + metaslab_class_t *mc = spa_normal_class(spa); ASSERT(MUTEX_HELD(&spa->spa_props_lock)); @@ -229,14 +226,10 @@ spa_prop_get_config(spa_t *spa, nvlist_t **nvp) spa_prop_add_list(*nvp, ZPOOL_PROP_FREE, NULL, size - alloc, src); - space = 0; - for (int c = 0; c < rvd->vdev_children; c++) { - vdev_t *tvd = rvd->vdev_child[c]; - space += tvd->vdev_max_asize - tvd->vdev_asize; - } - spa_prop_add_list(*nvp, ZPOOL_PROP_EXPANDSZ, NULL, space, - src); - + spa_prop_add_list(*nvp, ZPOOL_PROP_FRAGMENTATION, NULL, + metaslab_class_fragmentation(mc), src); + spa_prop_add_list(*nvp, ZPOOL_PROP_EXPANDSZ, NULL, + metaslab_class_expandable_space(mc), src); spa_prop_add_list(*nvp, ZPOOL_PROP_READONLY, NULL, (spa_mode(spa) == FREAD), src); @@ -258,19 +251,25 @@ spa_prop_get_config(spa_t *spa, nvlist_t **nvp) } if (pool != NULL) { - dsl_dir_t *freedir = pool->dp_free_dir; - /* * The $FREE directory was introduced in SPA_VERSION_DEADLISTS, * when opening pools before this version freedir will be NULL. */ - if (freedir != NULL) { + if (pool->dp_free_dir != NULL) { spa_prop_add_list(*nvp, ZPOOL_PROP_FREEING, NULL, - freedir->dd_phys->dd_used_bytes, src); + pool->dp_free_dir->dd_phys->dd_used_bytes, src); } else { spa_prop_add_list(*nvp, ZPOOL_PROP_FREEING, NULL, 0, src); } + + if (pool->dp_leak_dir != NULL) { + spa_prop_add_list(*nvp, ZPOOL_PROP_LEAKED, NULL, + pool->dp_leak_dir->dd_phys->dd_used_bytes, src); + } else { + spa_prop_add_list(*nvp, ZPOOL_PROP_LEAKED, + NULL, 0, src); + } } spa_prop_add_list(*nvp, ZPOOL_PROP_GUID, NULL, spa_guid(spa), src); @@ -684,7 +683,8 @@ spa_prop_set(spa_t *spa, nvlist_t *nvp) * feature descriptions object. */ error = dsl_sync_task(spa->spa_name, NULL, - spa_sync_version, &ver, 6); + spa_sync_version, &ver, + 6, ZFS_SPACE_CHECK_RESERVED); if (error) return (error); continue; @@ -696,7 +696,7 @@ spa_prop_set(spa_t *spa, nvlist_t *nvp) if (need_sync) { return (dsl_sync_task(spa->spa_name, NULL, spa_sync_props, - nvp, 6)); + nvp, 6, ZFS_SPACE_CHECK_RESERVED)); } return (0); @@ -777,7 +777,7 @@ spa_change_guid(spa_t *spa) guid = spa_generate_guid(NULL); error = dsl_sync_task(spa->spa_name, spa_change_guid_check, - spa_change_guid_sync, &guid, 5); + spa_change_guid_sync, &guid, 5, ZFS_SPACE_CHECK_RESERVED); if (error == 0) { spa_config_sync(spa, B_FALSE, B_TRUE); @@ -804,7 +804,7 @@ spa_error_entry_compare(const void *a, const void *b) int ret; ret = bcmp(&sa->se_bookmark, &sb->se_bookmark, - sizeof (zbookmark_t)); + sizeof (zbookmark_phys_t)); if (ret < 0) return (-1); @@ -953,7 +953,11 @@ spa_taskq_dispatch_ent(spa_t *spa, zio_type_t t, zio_taskq_type_t q, if (tqs->stqs_count == 1) { tq = tqs->stqs_taskq[0]; } else { +#ifdef _KERNEL + tq = tqs->stqs_taskq[cpu_ticks() % tqs->stqs_count]; +#else tq = tqs->stqs_taskq[gethrtime() % tqs->stqs_count]; +#endif } taskq_dispatch_ent(tq, func, arg, flags, ent); @@ -1863,6 +1867,7 @@ spa_load_verify_done(zio_t *zio) spa_load_error_t *sle = zio->io_private; dmu_object_type_t type = BP_GET_TYPE(bp); int error = zio->io_error; + spa_t *spa = zio->io_spa; if (error) { if ((BP_GET_LEVEL(bp) != 0 || DMU_OT_IS_METADATA(type)) && @@ -1872,23 +1877,65 @@ spa_load_verify_done(zio_t *zio) atomic_add_64(&sle->sle_data_count, 1); } zio_data_buf_free(zio->io_data, zio->io_size); + + mutex_enter(&spa->spa_scrub_lock); + spa->spa_scrub_inflight--; + cv_broadcast(&spa->spa_scrub_io_cv); + mutex_exit(&spa->spa_scrub_lock); } +/* + * Maximum number of concurrent scrub i/os to create while verifying + * a pool while importing it. + */ +int spa_load_verify_maxinflight = 10000; +boolean_t spa_load_verify_metadata = B_TRUE; +boolean_t spa_load_verify_data = B_TRUE; + +SYSCTL_INT(_vfs_zfs, OID_AUTO, spa_load_verify_maxinflight, CTLFLAG_RWTUN, + &spa_load_verify_maxinflight, 0, + "Maximum number of concurrent scrub I/Os to create while verifying a " + "pool while importing it"); + +SYSCTL_INT(_vfs_zfs, OID_AUTO, spa_load_verify_metadata, CTLFLAG_RWTUN, + &spa_load_verify_metadata, 0, + "Check metadata on import?"); + +SYSCTL_INT(_vfs_zfs, OID_AUTO, spa_load_verify_data, CTLFLAG_RWTUN, + &spa_load_verify_data, 0, + "Check user data on import?"); + /*ARGSUSED*/ static int spa_load_verify_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, - const zbookmark_t *zb, const dnode_phys_t *dnp, void *arg) + const zbookmark_phys_t *zb, const dnode_phys_t *dnp, void *arg) { - if (!BP_IS_HOLE(bp)) { - zio_t *rio = arg; - size_t size = BP_GET_PSIZE(bp); - void *data = zio_data_buf_alloc(size); + if (BP_IS_HOLE(bp) || BP_IS_EMBEDDED(bp)) + return (0); + /* + * Note: normally this routine will not be called if + * spa_load_verify_metadata is not set. However, it may be useful + * to manually set the flag after the traversal has begun. + */ + if (!spa_load_verify_metadata) + return (0); + if (BP_GET_BUFC_TYPE(bp) == ARC_BUFC_DATA && !spa_load_verify_data) + return (0); - zio_nowait(zio_read(rio, spa, bp, data, size, - spa_load_verify_done, rio->io_private, ZIO_PRIORITY_SCRUB, - ZIO_FLAG_SPECULATIVE | ZIO_FLAG_CANFAIL | - ZIO_FLAG_SCRUB | ZIO_FLAG_RAW, zb)); - } + zio_t *rio = arg; + size_t size = BP_GET_PSIZE(bp); + void *data = zio_data_buf_alloc(size); + + mutex_enter(&spa->spa_scrub_lock); + while (spa->spa_scrub_inflight >= spa_load_verify_maxinflight) + cv_wait(&spa->spa_scrub_io_cv, &spa->spa_scrub_lock); + spa->spa_scrub_inflight++; + mutex_exit(&spa->spa_scrub_lock); + + zio_nowait(zio_read(rio, spa, bp, data, size, + spa_load_verify_done, rio->io_private, ZIO_PRIORITY_SCRUB, + ZIO_FLAG_SPECULATIVE | ZIO_FLAG_CANFAIL | + ZIO_FLAG_SCRUB | ZIO_FLAG_RAW, zb)); return (0); } @@ -1899,7 +1946,7 @@ spa_load_verify(spa_t *spa) spa_load_error_t sle = { 0 }; zpool_rewind_policy_t policy; boolean_t verify_ok = B_FALSE; - int error; + int error = 0; zpool_get_rewind_policy(spa->spa_config, &policy); @@ -1909,8 +1956,11 @@ spa_load_verify(spa_t *spa) rio = zio_root(spa, NULL, &sle, ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE); - error = traverse_pool(spa, spa->spa_verify_min_txg, - TRAVERSE_PRE | TRAVERSE_PREFETCH, spa_load_verify_cb, rio); + if (spa_load_verify_metadata) { + error = traverse_pool(spa, spa->spa_verify_min_txg, + TRAVERSE_PRE | TRAVERSE_PREFETCH_METADATA, + spa_load_verify_cb, rio); + } (void) zio_wait(rio); @@ -2427,9 +2477,8 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config, if (spa_feature_is_active(spa, SPA_FEATURE_ENABLED_TXG)) { if (spa_dir_prop(spa, DMU_POOL_FEATURE_ENABLED_TXG, - &spa->spa_feat_enabled_txg_obj) != 0) { + &spa->spa_feat_enabled_txg_obj) != 0) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); - } } spa->spa_is_initializing = B_TRUE; @@ -2786,7 +2835,7 @@ spa_load_retry(spa_t *spa, spa_load_state_t state, int mosconfig) spa_unload(spa); spa_deactivate(spa); - spa->spa_load_max_txg--; + spa->spa_load_max_txg = spa->spa_uberblock.ub_txg - 1; spa_activate(spa, mode); spa_async_suspend(spa); @@ -2816,6 +2865,8 @@ spa_load_best(spa_t *spa, spa_load_state_t state, int mosconfig, spa_set_log_state(spa, SPA_LOG_CLEAR); } else { spa->spa_load_max_txg = max_request; + if (max_request != UINT64_MAX) + spa->spa_extreme_rewind = B_TRUE; } load_error = rewind_error = spa_load(spa, state, SPA_IMPORT_EXISTING, @@ -3919,9 +3970,6 @@ spa_generate_rootconf(const char *name) } } - /* - * Multi-vdev root pool configuration discovery is not supported yet. - */ nchildren = 1; nvlist_lookup_uint64(best_cfg, ZPOOL_CONFIG_VDEV_CHILDREN, &nchildren); holes = NULL; @@ -5535,11 +5583,6 @@ spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t unspare) ASSERT(!locked); ASSERT(vd == vd->vdev_top); - /* - * XXX - Once we have bp-rewrite this should - * become the common case. - */ - mg = vd->vdev_mg; /* @@ -6425,6 +6468,22 @@ spa_sync_upgrades(spa_t *spa, dmu_tx_t *tx) spa->spa_uberblock.ub_version >= SPA_VERSION_FEATURES) { spa_feature_create_zap_objects(spa, tx); } + + /* + * LZ4_COMPRESS feature's behaviour was changed to activate_on_enable + * when possibility to use lz4 compression for metadata was added + * Old pools that have this feature enabled must be upgraded to have + * this feature active + */ + if (spa->spa_uberblock.ub_version >= SPA_VERSION_FEATURES) { + boolean_t lz4_en = spa_feature_is_enabled(spa, + SPA_FEATURE_LZ4_COMPRESS); + boolean_t lz4_ac = spa_feature_is_active(spa, + SPA_FEATURE_LZ4_COMPRESS); + + if (lz4_en && !lz4_ac) + spa_feature_incr(spa, SPA_FEATURE_LZ4_COMPRESS, tx); + } rrw_exit(&dp->dp_config_rwlock, FTAG); } @@ -6771,7 +6830,7 @@ spa_upgrade(spa_t *spa, uint64_t version) * possible. */ ASSERT(SPA_VERSION_IS_SUPPORTED(spa->spa_uberblock.ub_version)); - ASSERT(version >= spa->spa_uberblock.ub_version); + ASSERT3U(version, >=, spa->spa_uberblock.ub_version); spa->spa_uberblock.ub_version = version; vdev_config_dirty(spa->spa_root_vdev); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c index 0dd6c7a489b..168f3acc2e8 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013, 2014 by Delphix. All rights reserved. */ /* @@ -35,7 +35,7 @@ * deleted from the log when the scrub completes. * * The log is stored using a ZAP object whose key is a string form of the - * zbookmark tuple (objset, object, level, blkid), and whose contents is an + * zbookmark_phys tuple (objset, object, level, blkid), and whose contents is an * optional 'objset:object' human-readable string describing the data. When an * error is first logged, this string will be empty, indicating that no name is * known. This prevents us from having to issue a potentially large amount of @@ -59,7 +59,7 @@ * Convert a bookmark to a string. */ static void -bookmark_to_name(zbookmark_t *zb, char *buf, size_t len) +bookmark_to_name(zbookmark_phys_t *zb, char *buf, size_t len) { (void) snprintf(buf, len, "%llx:%llx:%llx:%llx", (u_longlong_t)zb->zb_objset, (u_longlong_t)zb->zb_object, @@ -71,7 +71,7 @@ bookmark_to_name(zbookmark_t *zb, char *buf, size_t len) */ #ifdef _KERNEL static void -name_to_bookmark(char *buf, zbookmark_t *zb) +name_to_bookmark(char *buf, zbookmark_phys_t *zb) { zb->zb_objset = strtonum(buf, &buf); ASSERT(*buf == ':'); @@ -92,7 +92,7 @@ name_to_bookmark(char *buf, zbookmark_t *zb) void spa_log_error(spa_t *spa, zio_t *zio) { - zbookmark_t *zb = &zio->io_logical->io_bookmark; + zbookmark_phys_t *zb = &zio->io_logical->io_bookmark; spa_error_entry_t search; spa_error_entry_t *new; avl_tree_t *tree; @@ -165,7 +165,7 @@ process_error_log(spa_t *spa, uint64_t obj, void *addr, size_t *count) { zap_cursor_t zc; zap_attribute_t za; - zbookmark_t zb; + zbookmark_phys_t zb; if (obj == 0) return (0); @@ -182,8 +182,8 @@ process_error_log(spa_t *spa, uint64_t obj, void *addr, size_t *count) name_to_bookmark(za.za_name, &zb); if (copyout(&zb, (char *)addr + - (*count - 1) * sizeof (zbookmark_t), - sizeof (zbookmark_t)) != 0) { + (*count - 1) * sizeof (zbookmark_phys_t), + sizeof (zbookmark_phys_t)) != 0) { zap_cursor_fini(&zc); return (SET_ERROR(EFAULT)); } @@ -207,8 +207,8 @@ process_error_list(avl_tree_t *list, void *addr, size_t *count) return (SET_ERROR(ENOMEM)); if (copyout(&se->se_bookmark, (char *)addr + - (*count - 1) * sizeof (zbookmark_t), - sizeof (zbookmark_t)) != 0) + (*count - 1) * sizeof (zbookmark_phys_t), + sizeof (zbookmark_phys_t)) != 0) return (SET_ERROR(EFAULT)); *count -= 1; diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c index f6e02770eec..83e521765ac 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. */ #include @@ -324,7 +324,7 @@ spa_history_log_nvl(spa_t *spa, nvlist_t *nvl) /* Kick this off asynchronously; errors are ignored. */ dsl_sync_task_nowait(spa_get_dsl(spa), spa_history_log_sync, - nvarg, 0, tx); + nvarg, 0, ZFS_SPACE_CHECK_NONE, tx); dmu_tx_commit(tx); /* spa_history_log_sync will free nvl */ @@ -465,7 +465,7 @@ log_internal(nvlist_t *nvl, const char *operation, spa_t *spa, spa_history_log_sync(nvl, tx); } else { dsl_sync_task_nowait(spa_get_dsl(spa), - spa_history_log_sync, nvl, 0, tx); + spa_history_log_sync, nvl, 0, ZFS_SPACE_CHECK_NONE, tx); } /* spa_history_log_sync() will free nvl */ } diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c index dbcb72916f0..2573b66fb75 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright 2013 Martin Matuska . All rights reserved. */ @@ -244,7 +244,6 @@ int zfs_flags = ~(ZFS_DEBUG_DPRINTF | ZFS_DEBUG_SPA); int zfs_flags = 0; #endif SYSCTL_DECL(_debug); -TUNABLE_INT("debug.zfs_flags", &zfs_flags); SYSCTL_INT(_debug, OID_AUTO, zfs_flags, CTLFLAG_RWTUN, &zfs_flags, 0, "ZFS debug flags."); @@ -255,12 +254,42 @@ SYSCTL_INT(_debug, OID_AUTO, zfs_flags, CTLFLAG_RWTUN, &zfs_flags, 0, * This should only be used as a last resort, as it typically results * in leaked space, or worse. */ -int zfs_recover = 0; +boolean_t zfs_recover = B_FALSE; SYSCTL_DECL(_vfs_zfs); -TUNABLE_INT("vfs.zfs.recover", &zfs_recover); SYSCTL_INT(_vfs_zfs, OID_AUTO, recover, CTLFLAG_RDTUN, &zfs_recover, 0, "Try to recover from otherwise-fatal errors."); +/* + * If destroy encounters an EIO while reading metadata (e.g. indirect + * blocks), space referenced by the missing metadata can not be freed. + * Normally this causes the background destroy to become "stalled", as + * it is unable to make forward progress. While in this stalled state, + * all remaining space to free from the error-encountering filesystem is + * "temporarily leaked". Set this flag to cause it to ignore the EIO, + * permanently leak the space from indirect blocks that can not be read, + * and continue to free everything else that it can. + * + * The default, "stalling" behavior is useful if the storage partially + * fails (i.e. some but not all i/os fail), and then later recovers. In + * this case, we will be able to continue pool operations while it is + * partially failed, and when it recovers, we can continue to free the + * space, with no leaks. However, note that this case is actually + * fairly rare. + * + * Typically pools either (a) fail completely (but perhaps temporarily, + * e.g. a top-level vdev going offline), or (b) have localized, + * permanent errors (e.g. disk returns the wrong data due to bit flip or + * firmware bug). In case (a), this setting does not matter because the + * pool will be suspended and the sync thread will not be able to make + * forward progress regardless. In case (b), because the error is + * permanent, the best we can do is leak the minimum amount of space, + * which is what setting this flag will do. Therefore, it is reasonable + * for this flag to normally be set, but we chose the more conservative + * approach of not setting it, so that there is no possibility of + * leaking space in the "partial temporary" failure case. + */ +boolean_t zfs_free_leak_on_eio = B_FALSE; + /* * Expiration time in milliseconds. This value has two meanings. First it is * used to determine when the spa_deadman() logic should fire. By default the @@ -270,7 +299,6 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, recover, CTLFLAG_RDTUN, &zfs_recover, 0, * in a system panic. */ uint64_t zfs_deadman_synctime_ms = 1000000ULL; -TUNABLE_QUAD("vfs.zfs.deadman_synctime_ms", &zfs_deadman_synctime_ms); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_synctime_ms, CTLFLAG_RDTUN, &zfs_deadman_synctime_ms, 0, "Stalled ZFS I/O expiration time in milliseconds"); @@ -280,7 +308,6 @@ SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_synctime_ms, CTLFLAG_RDTUN, * for hung I/O. */ uint64_t zfs_deadman_checktime_ms = 5000ULL; -TUNABLE_QUAD("vfs.zfs.deadman_checktime_ms", &zfs_deadman_checktime_ms); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_checktime_ms, CTLFLAG_RDTUN, &zfs_deadman_checktime_ms, 0, "Period of checks for stalled ZFS I/O in milliseconds"); @@ -290,7 +317,6 @@ SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_checktime_ms, CTLFLAG_RDTUN, * zfs_deadman_init() */ int zfs_deadman_enabled = -1; -TUNABLE_INT("vfs.zfs.deadman_enabled", &zfs_deadman_enabled); SYSCTL_INT(_vfs_zfs, OID_AUTO, deadman_enabled, CTLFLAG_RDTUN, &zfs_deadman_enabled, 0, "Kernel panic on stalled ZFS I/O"); @@ -304,7 +330,6 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, deadman_enabled, CTLFLAG_RDTUN, * (VDEV_RAIDZ_MAXPARITY + 1) * SPA_DVAS_PER_BP * 2 == 24 */ int spa_asize_inflation = 24; -TUNABLE_INT("vfs.zfs.spa_asize_inflation", &spa_asize_inflation); SYSCTL_INT(_vfs_zfs, OID_AUTO, spa_asize_inflation, CTLFLAG_RWTUN, &spa_asize_inflation, 0, "Worst case inflation factor for single sector writes"); @@ -328,6 +353,32 @@ zfs_deadman_init() #endif /* _KERNEL */ #endif /* !illumos */ +/* + * Normally, we don't allow the last 3.2% (1/(2^spa_slop_shift)) of space in + * the pool to be consumed. This ensures that we don't run the pool + * completely out of space, due to unaccounted changes (e.g. to the MOS). + * It also limits the worst-case time to allocate space. If we have + * less than this amount of free space, most ZPL operations (e.g. write, + * create) will return ENOSPC. + * + * Certain operations (e.g. file removal, most administrative actions) can + * use half the slop space. They will only return ENOSPC if less than half + * the slop space is free. Typically, once the pool has less than the slop + * space free, the user will use these operations to free up space in the pool. + * These are the operations that call dsl_pool_adjustedsize() with the netfree + * argument set to TRUE. + * + * A very restricted set of operations are always permitted, regardless of + * the amount of free space. These are the operations that call + * dsl_sync_task(ZFS_SPACE_CHECK_NONE), e.g. "zfs destroy". If these + * operations result in a net increase in the amount of space used, + * it is possible to run the pool completely out of space, causing it to + * be permanently read-only. + * + * See also the comments in zfs_space_check_t. + */ +int spa_slop_shift = 5; + /* * ========================================================================== * SPA config locking @@ -1391,7 +1442,10 @@ snprintf_blkptr(char *buf, size_t buflen, const blkptr_t *bp) (void) strlcpy(type, dmu_ot[BP_GET_TYPE(bp)].ot_name, sizeof (type)); } - checksum = zio_checksum_table[BP_GET_CHECKSUM(bp)].ci_name; + if (!BP_IS_EMBEDDED(bp)) { + checksum = + zio_checksum_table[BP_GET_CHECKSUM(bp)].ci_name; + } compress = zio_compress_table[BP_GET_COMPRESS(bp)].ci_name; } @@ -1594,6 +1648,18 @@ spa_get_asize(spa_t *spa, uint64_t lsize) return (lsize * spa_asize_inflation); } +/* + * Return the amount of slop space in bytes. It is 1/32 of the pool (3.2%), + * or at least 32MB. + * + * See the comment above spa_slop_shift for details. + */ +uint64_t +spa_get_slop_space(spa_t *spa) { + uint64_t space = spa_get_dspace(spa); + return (MAX(space >> spa_slop_shift, SPA_MINDEVSIZE >> 1)); +} + uint64_t spa_get_dspace(spa_t *spa) { @@ -1693,7 +1759,7 @@ bp_get_dsize_sync(spa_t *spa, const blkptr_t *bp) { uint64_t dsize = 0; - for (int d = 0; d < SPA_DVAS_PER_BP; d++) + for (int d = 0; d < BP_GET_NDVAS(bp); d++) dsize += dva_get_dsize_sync(spa, &bp->blk_dva[d]); return (dsize); @@ -1706,7 +1772,7 @@ bp_get_dsize(spa_t *spa, const blkptr_t *bp) spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER); - for (int d = 0; d < SPA_DVAS_PER_BP; d++) + for (int d = 0; d < BP_GET_NDVAS(bp); d++) dsize += dva_get_dsize_sync(spa, &bp->blk_dva[d]); spa_config_exit(spa, SCL_VDEV, FTAG); @@ -1866,6 +1932,16 @@ spa_writeable(spa_t *spa) return (!!(spa->spa_mode & FWRITE)); } +/* + * Returns true if there is a pending sync task in any of the current + * syncing txg, the current quiescing txg, or the current open txg. + */ +boolean_t +spa_has_pending_synctask(spa_t *spa) +{ + return (!txg_all_lists_empty(&spa->spa_dsl_pool->dp_sync_tasks)); +} + int spa_mode(spa_t *spa) { diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c index 629870b6784..d158b246d8c 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c @@ -202,10 +202,10 @@ space_map_histogram_add(space_map_t *sm, range_tree_t *rt, dmu_tx_t *tx) * reached the maximum bucket size. Accumulate all ranges * larger than the max bucket size into the last bucket. */ - if (idx < SPACE_MAP_HISTOGRAM_SIZE(sm) - 1) { + if (idx < SPACE_MAP_HISTOGRAM_SIZE - 1) { ASSERT3U(idx + sm->sm_shift, ==, i); idx++; - ASSERT3U(idx, <, SPACE_MAP_HISTOGRAM_SIZE(sm)); + ASSERT3U(idx, <, SPACE_MAP_HISTOGRAM_SIZE); } } } diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h index bc622845d48..8bf07c3ec8c 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ @@ -95,7 +95,6 @@ boolean_t arc_buf_remove_ref(arc_buf_t *buf, void *tag); int arc_buf_size(arc_buf_t *buf); void arc_release(arc_buf_t *buf, void *tag); int arc_released(arc_buf_t *buf); -int arc_has_callback(arc_buf_t *buf); void arc_buf_freeze(arc_buf_t *buf); void arc_buf_thaw(arc_buf_t *buf); boolean_t arc_buf_eviction_needed(arc_buf_t *buf); @@ -105,16 +104,16 @@ int arc_referenced(arc_buf_t *buf); int arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, arc_done_func_t *done, void *priv, zio_priority_t priority, int flags, - uint32_t *arc_flags, const zbookmark_t *zb); + uint32_t *arc_flags, const zbookmark_phys_t *zb); zio_t *arc_write(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, boolean_t l2arc_compress, const zio_prop_t *zp, arc_done_func_t *ready, arc_done_func_t *physdone, arc_done_func_t *done, void *priv, zio_priority_t priority, - int zio_flags, const zbookmark_t *zb); + int zio_flags, const zbookmark_phys_t *zb); void arc_freed(spa_t *spa, const blkptr_t *bp); void arc_set_callback(arc_buf_t *buf, arc_evict_func_t *func, void *priv); -int arc_buf_evict(arc_buf_t *buf); +boolean_t arc_clear_callback(arc_buf_t *buf); void arc_flush(spa_t *spa); void arc_tempreserve_clear(uint64_t reserve); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/blkptr.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/blkptr.h new file mode 100644 index 00000000000..b720482a73f --- /dev/null +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/blkptr.h @@ -0,0 +1,38 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2013 by Delphix. All rights reserved. + */ + +#ifndef _SYS_BLKPTR_H +#define _SYS_BLKPTR_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void encode_embedded_bp_compressed(blkptr_t *, void *, + enum zio_compress, int, int); +void decode_embedded_bp_compressed(const blkptr_t *, void *); + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_BLKPTR_H */ diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/bptree.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/bptree.h index 97150721187..327c128bf49 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/bptree.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/bptree.h @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #ifndef _SYS_BPTREE_H @@ -43,13 +43,14 @@ typedef struct bptree_phys { typedef struct bptree_entry_phys { blkptr_t be_bp; uint64_t be_birth_txg; /* only delete blocks born after this txg */ - zbookmark_t be_zb; /* holds traversal resume point if needed */ + zbookmark_phys_t be_zb; /* holds traversal resume point if needed */ } bptree_entry_phys_t; typedef int bptree_itor_t(void *arg, const blkptr_t *bp, dmu_tx_t *tx); uint64_t bptree_alloc(objset_t *os, dmu_tx_t *tx); int bptree_free(objset_t *os, uint64_t obj, dmu_tx_t *tx); +boolean_t bptree_is_empty(objset_t *os, uint64_t obj); void bptree_add(objset_t *os, uint64_t obj, blkptr_t *bp, uint64_t birth_txg, uint64_t bytes, uint64_t comp, uint64_t uncomp, dmu_tx_t *tx); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h index 207834dfd48..c80b7ffba34 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h @@ -274,6 +274,9 @@ void dmu_buf_fill_done(dmu_buf_t *db, dmu_tx_t *tx); void dbuf_assign_arcbuf(dmu_buf_impl_t *db, arc_buf_t *buf, dmu_tx_t *tx); dbuf_dirty_record_t *dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx); arc_buf_t *dbuf_loan_arcbuf(dmu_buf_impl_t *db); +void dmu_buf_write_embedded(dmu_buf_t *dbuf, void *data, + bp_embedded_type_t etype, enum zio_compress comp, + int uncompressed_size, int compressed_size, int byteorder, dmu_tx_t *tx); void dbuf_clear(dmu_buf_impl_t *db); void dbuf_evict(dmu_buf_impl_t *db); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h index 35f94d239bb..2c0b5ae2cab 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright 2013 DEY Storage Systems, Inc. @@ -64,7 +64,7 @@ struct dsl_pool; struct dnode; struct drr_begin; struct drr_end; -struct zbookmark; +struct zbookmark_phys; struct spa; struct nvlist; struct arc_buf; @@ -119,6 +119,14 @@ typedef enum dmu_object_byteswap { ((ot) & DMU_OT_METADATA) : \ dmu_ot[(ot)].ot_metadata) +/* + * These object types use bp_fill != 1 for their L0 bp's. Therefore they can't + * have their data embedded (i.e. use a BP_IS_EMBEDDED() bp), because bp_fill + * is repurposed for embedded BPs. + */ +#define DMU_OT_HAS_FILL(ot) \ + ((ot) == DMU_OT_DNODE || (ot) == DMU_OT_OBJSET) + #define DMU_OT_BYTESWAP(ot) (((ot) & DMU_OT_NEWTYPE) ? \ ((ot) & DMU_OT_BYTESWAP_MASK) : \ dmu_ot[(ot)].ot_byteswap) @@ -245,7 +253,6 @@ void zfs_znode_byteswap(void *buf, size_t size); #define DMU_USERUSED_OBJECT (-1ULL) #define DMU_GROUPUSED_OBJECT (-2ULL) -#define DMU_DEADLIST_OBJECT (-3ULL) /* * artificial blkids for bonus buffer and spill blocks @@ -396,6 +403,11 @@ void dmu_object_set_checksum(objset_t *os, uint64_t object, uint8_t checksum, void dmu_object_set_compress(objset_t *os, uint64_t object, uint8_t compress, dmu_tx_t *tx); +void +dmu_write_embedded(objset_t *os, uint64_t object, uint64_t offset, + void *data, uint8_t etype, uint8_t comp, int uncompressed_size, + int compressed_size, int byteorder, dmu_tx_t *tx); + /* * Decide how to write a block: checksum, compression, number of copies, etc. */ @@ -557,6 +569,7 @@ void dmu_tx_abort(dmu_tx_t *tx); int dmu_tx_assign(dmu_tx_t *tx, enum txg_how txg_how); void dmu_tx_wait(dmu_tx_t *tx); void dmu_tx_commit(dmu_tx_t *tx); +void dmu_tx_mark_netfree(dmu_tx_t *tx); /* * To register a commit callback, dmu_tx_callback_register() must be called. @@ -746,8 +759,8 @@ extern struct dsl_dataset *dmu_objset_ds(objset_t *os); extern void dmu_objset_name(objset_t *os, char *buf); extern dmu_objset_type_t dmu_objset_type(objset_t *os); extern uint64_t dmu_objset_id(objset_t *os); -extern uint64_t dmu_objset_syncprop(objset_t *os); -extern uint64_t dmu_objset_logbias(objset_t *os); +extern zfs_sync_type_t dmu_objset_syncprop(objset_t *os); +extern zfs_logbias_op_t dmu_objset_logbias(objset_t *os); extern int dmu_snapshot_list_next(objset_t *os, int namelen, char *name, uint64_t *id, uint64_t *offp, boolean_t *case_conflict); extern int dmu_snapshot_realname(objset_t *os, char *name, char *real, diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h index 63440646a42..6f67b5a0b9b 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h @@ -297,12 +297,15 @@ typedef struct dmu_sendarg { int dsa_err; dmu_pendop_t dsa_pending_op; boolean_t dsa_incremental; + uint64_t dsa_featureflags; uint64_t dsa_last_data_object; uint64_t dsa_last_data_offset; } dmu_sendarg_t; void dmu_object_zapify(objset_t *, uint64_t, dmu_object_type_t, dmu_tx_t *); void dmu_object_free_zapified(objset_t *, uint64_t, dmu_tx_t *); +int dmu_buf_hold_noread(objset_t *, uint64_t, uint64_t, + void *, dmu_buf_t **); #ifdef __cplusplus } diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h index df8f03103e3..23d88fd048b 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ @@ -85,15 +85,16 @@ struct objset { zilog_t *os_zil; /* can change, under dsl_dir's locks: */ - uint8_t os_checksum; - uint8_t os_compress; + enum zio_checksum os_checksum; + enum zio_compress os_compress; uint8_t os_copies; - uint8_t os_dedup_checksum; - uint8_t os_dedup_verify; - uint8_t os_logbias; - uint8_t os_primary_cache; - uint8_t os_secondary_cache; - uint8_t os_sync; + enum zio_checksum os_dedup_checksum; + boolean_t os_dedup_verify; + zfs_logbias_op_t os_logbias; + zfs_cache_type_t os_primary_cache; + zfs_cache_type_t os_secondary_cache; + zfs_sync_type_t os_sync; + zfs_redundant_metadata_type_t os_redundant_metadata; /* no lock needed: */ struct dmu_tx *os_synctx; /* XXX sketchy */ diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h index 2b95b8cf7f8..b5d617025bd 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h @@ -36,19 +36,19 @@ struct dsl_dataset; struct drr_begin; struct avl_tree; -int dmu_send(const char *tosnap, const char *fromsnap, int outfd, +int dmu_send(const char *tosnap, const char *fromsnap, boolean_t embedok, #ifdef illumos - struct vnode *vp, offset_t *off); + int outfd, struct vnode *vp, offset_t *off); #else - struct file *fp, offset_t *off); + int outfd, struct file *fp, offset_t *off); #endif int dmu_send_estimate(struct dsl_dataset *ds, struct dsl_dataset *fromds, uint64_t *sizep); int dmu_send_obj(const char *pool, uint64_t tosnap, uint64_t fromsnap, #ifdef illumos - int outfd, struct vnode *vp, offset_t *off); + boolean_t embedok, int outfd, vnode_t *vp, offset_t *off); #else - int outfd, struct file *fp, offset_t *off); + boolean_t embedok, int outfd, struct file *fp, offset_t *off); #endif typedef struct dmu_recv_cookie { diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_traverse.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_traverse.h index bc1590bc3aa..544b721e461 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_traverse.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_traverse.h @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #ifndef _SYS_DMU_TRAVERSE_H @@ -40,7 +40,7 @@ struct zilog; struct arc_buf; typedef int (blkptr_cb_t)(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, - const zbookmark_t *zb, const struct dnode_phys *dnp, void *arg); + const zbookmark_phys_t *zb, const struct dnode_phys *dnp, void *arg); #define TRAVERSE_PRE (1<<0) #define TRAVERSE_POST (1<<1) @@ -55,7 +55,7 @@ typedef int (blkptr_cb_t)(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, int traverse_dataset(struct dsl_dataset *ds, uint64_t txg_start, int flags, blkptr_cb_t func, void *arg); int traverse_dataset_destroyed(spa_t *spa, blkptr_t *blkptr, - uint64_t txg_start, zbookmark_t *resume, int flags, + uint64_t txg_start, zbookmark_phys_t *resume, int flags, blkptr_cb_t func, void *arg); int traverse_pool(spa_t *spa, uint64_t txg_start, int flags, blkptr_cb_t func, void *arg); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h index 752ccadb729..a9c4f67515a 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h @@ -160,6 +160,7 @@ boolean_t dsl_dir_is_zapified(dsl_dir_t *dd); #define ORIGIN_DIR_NAME "$ORIGIN" #define XLATION_DIR_NAME "$XLATION" #define FREE_DIR_NAME "$FREE" +#define LEAK_DIR_NAME "$LEAK" #ifdef ZFS_DEBUG #define dprintf_dd(dd, fmt, ...) do { \ diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h index ea180c9a5b8..a6fb201047b 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h @@ -84,6 +84,7 @@ typedef struct dsl_pool { struct dsl_dir *dp_root_dir; struct dsl_dir *dp_mos_dir; struct dsl_dir *dp_free_dir; + struct dsl_dir *dp_leak_dir; struct dsl_dataset *dp_origin_snap; uint64_t dp_root_dir_obj; struct taskq *dp_vnrele_taskq; diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_scan.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_scan.h index bf8c5ac824a..ee8512c07da 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_scan.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_scan.h @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #ifndef _SYS_DSL_SCAN_H @@ -62,7 +62,7 @@ typedef struct dsl_scan_phys { uint64_t scn_errors; /* scan I/O error count */ uint64_t scn_ddt_class_max; ddt_bookmark_t scn_ddt_bookmark; - zbookmark_t scn_bookmark; + zbookmark_phys_t scn_bookmark; uint64_t scn_flags; /* dsl_scan_flags_t */ } dsl_scan_phys_t; @@ -114,6 +114,7 @@ typedef struct dsl_scan { /* for freeing blocks */ boolean_t scn_is_bptree; boolean_t scn_async_destroying; + boolean_t scn_async_stalled; /* for debugging / information */ uint64_t scn_visited_this_txg; diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h index ef86fb64cf0..6139303c156 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #ifndef _SYS_DSL_SYNCTASK_H @@ -38,11 +38,41 @@ struct dsl_pool; typedef int (dsl_checkfunc_t)(void *, dmu_tx_t *); typedef void (dsl_syncfunc_t)(void *, dmu_tx_t *); +typedef enum zfs_space_check { + /* + * Normal space check: if there is less than 3.2% free space, + * the operation will fail. Operations which are logically + * creating things should use this (e.g. "zfs create", "zfs snapshot"). + * User writes (via the ZPL / ZVOL) also fail at this point. + */ + ZFS_SPACE_CHECK_NORMAL, + + /* + * Space check allows use of half the slop space. If there + * is less than 1.6% free space, the operation will fail. Most + * operations should use this (e.g. "zfs set", "zfs rename"), + * because we want them to succeed even after user writes are failing, + * so that they can be used as part of the space recovery process. + */ + ZFS_SPACE_CHECK_RESERVED, + + /* + * No space check is performed. Only operations which we expect to + * result in a net reduction in space should use this + * (e.g. "zfs destroy". Setting quotas & reservations also uses + * this because it needs to circumvent the quota/reservation checks). + * + * See also the comments above spa_slop_shift. + */ + ZFS_SPACE_CHECK_NONE, +} zfs_space_check_t; + typedef struct dsl_sync_task { txg_node_t dst_node; struct dsl_pool *dst_pool; uint64_t dst_txg; int dst_space; + zfs_space_check_t dst_space_check; dsl_checkfunc_t *dst_checkfunc; dsl_syncfunc_t *dst_syncfunc; void *dst_arg; @@ -50,11 +80,11 @@ typedef struct dsl_sync_task { boolean_t dst_nowaiter; } dsl_sync_task_t; -void dsl_sync_task_sync(dsl_sync_task_t *dst, dmu_tx_t *tx); -int dsl_sync_task(const char *pool, dsl_checkfunc_t *checkfunc, - dsl_syncfunc_t *syncfunc, void *arg, int blocks_modified); -void dsl_sync_task_nowait(struct dsl_pool *dp, dsl_syncfunc_t *syncfunc, - void *arg, int blocks_modified, dmu_tx_t *tx); +void dsl_sync_task_sync(dsl_sync_task_t *, dmu_tx_t *); +int dsl_sync_task(const char *, dsl_checkfunc_t *, + dsl_syncfunc_t *, void *, int, zfs_space_check_t); +void dsl_sync_task_nowait(struct dsl_pool *, dsl_syncfunc_t *, + void *, int, zfs_space_check_t, dmu_tx_t *); #ifdef __cplusplus } diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h index fda9fffc70d..deefb196fde 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. */ #ifndef _SYS_METASLAB_H @@ -38,23 +38,22 @@ extern "C" { typedef struct metaslab_ops { uint64_t (*msop_alloc)(metaslab_t *msp, uint64_t size); - boolean_t (*msop_fragmented)(metaslab_t *msp); } metaslab_ops_t; extern metaslab_ops_t *zfs_metaslab_ops; -metaslab_t *metaslab_init(metaslab_group_t *mg, uint64_t id, - uint64_t object, uint64_t txg); -void metaslab_fini(metaslab_t *msp); +metaslab_t *metaslab_init(metaslab_group_t *, uint64_t, + uint64_t, uint64_t); +void metaslab_fini(metaslab_t *); -void metaslab_load_wait(metaslab_t *msp); -int metaslab_load(metaslab_t *msp); -void metaslab_unload(metaslab_t *msp); +void metaslab_load_wait(metaslab_t *); +int metaslab_load(metaslab_t *); +void metaslab_unload(metaslab_t *); -void metaslab_sync(metaslab_t *msp, uint64_t txg); -void metaslab_sync_done(metaslab_t *msp, uint64_t txg); -void metaslab_sync_reassess(metaslab_group_t *mg); -uint64_t metaslab_block_maxsize(metaslab_t *msp); +void metaslab_sync(metaslab_t *, uint64_t); +void metaslab_sync_done(metaslab_t *, uint64_t); +void metaslab_sync_reassess(metaslab_group_t *); +uint64_t metaslab_block_maxsize(metaslab_t *); #define METASLAB_HINTBP_FAVOR 0x0 #define METASLAB_HINTBP_AVOID 0x1 @@ -62,29 +61,35 @@ uint64_t metaslab_block_maxsize(metaslab_t *msp); #define METASLAB_GANG_CHILD 0x4 #define METASLAB_GANG_AVOID 0x8 -int metaslab_alloc(spa_t *spa, metaslab_class_t *mc, uint64_t psize, - blkptr_t *bp, int ncopies, uint64_t txg, blkptr_t *hintbp, int flags); -void metaslab_free(spa_t *spa, const blkptr_t *bp, uint64_t txg, boolean_t now); -int metaslab_claim(spa_t *spa, const blkptr_t *bp, uint64_t txg); -void metaslab_check_free(spa_t *spa, const blkptr_t *bp); +int metaslab_alloc(spa_t *, metaslab_class_t *, uint64_t, + blkptr_t *, int, uint64_t, blkptr_t *, int); +void metaslab_free(spa_t *, const blkptr_t *, uint64_t, boolean_t); +int metaslab_claim(spa_t *, const blkptr_t *, uint64_t); +void metaslab_check_free(spa_t *, const blkptr_t *); -metaslab_class_t *metaslab_class_create(spa_t *spa, metaslab_ops_t *ops); -void metaslab_class_destroy(metaslab_class_t *mc); -int metaslab_class_validate(metaslab_class_t *mc); +metaslab_class_t *metaslab_class_create(spa_t *, metaslab_ops_t *); +void metaslab_class_destroy(metaslab_class_t *); +int metaslab_class_validate(metaslab_class_t *); +void metaslab_class_histogram_verify(metaslab_class_t *); +uint64_t metaslab_class_fragmentation(metaslab_class_t *); +uint64_t metaslab_class_expandable_space(metaslab_class_t *); -void metaslab_class_space_update(metaslab_class_t *mc, - int64_t alloc_delta, int64_t defer_delta, - int64_t space_delta, int64_t dspace_delta); -uint64_t metaslab_class_get_alloc(metaslab_class_t *mc); -uint64_t metaslab_class_get_space(metaslab_class_t *mc); -uint64_t metaslab_class_get_dspace(metaslab_class_t *mc); -uint64_t metaslab_class_get_deferred(metaslab_class_t *mc); +void metaslab_class_space_update(metaslab_class_t *, int64_t, int64_t, + int64_t, int64_t); +uint64_t metaslab_class_get_alloc(metaslab_class_t *); +uint64_t metaslab_class_get_space(metaslab_class_t *); +uint64_t metaslab_class_get_dspace(metaslab_class_t *); +uint64_t metaslab_class_get_deferred(metaslab_class_t *); uint64_t metaslab_class_get_minblocksize(metaslab_class_t *mc); -metaslab_group_t *metaslab_group_create(metaslab_class_t *mc, vdev_t *vd); -void metaslab_group_destroy(metaslab_group_t *mg); -void metaslab_group_activate(metaslab_group_t *mg); -void metaslab_group_passivate(metaslab_group_t *mg); +metaslab_group_t *metaslab_group_create(metaslab_class_t *, vdev_t *); +void metaslab_group_destroy(metaslab_group_t *); +void metaslab_group_activate(metaslab_group_t *); +void metaslab_group_passivate(metaslab_group_t *); +uint64_t metaslab_group_get_space(metaslab_group_t *); +void metaslab_group_histogram_verify(metaslab_group_t *); +uint64_t metaslab_group_fragmentation(metaslab_group_t *); +void metaslab_group_histogram_remove(metaslab_group_t *, metaslab_t *); #ifdef __cplusplus } diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h index 36d11d9907b..eb7c9320592 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h @@ -41,6 +41,23 @@ extern "C" { #endif +/* + * A metaslab class encompasses a category of allocatable top-level vdevs. + * Each top-level vdev is associated with a metaslab group which defines + * the allocatable region for that vdev. Examples of these categories include + * "normal" for data block allocations (i.e. main pool allocations) or "log" + * for allocations designated for intent log devices (i.e. slog devices). + * When a block allocation is requested from the SPA it is associated with a + * metaslab_class_t, and only top-level vdevs (i.e. metaslab groups) belonging + * to the class can be used to satisfy that request. Allocations are done + * by traversing the metaslab groups that are linked off of the mc_rotor field. + * This rotor points to the next metaslab group where allocations will be + * attempted. Allocating a block is a 3 step process -- select the metaslab + * group, select the metaslab, and then allocate the block. The metaslab + * class defines the low-level block allocator that will be used as the + * final step in allocation. These allocators are pluggable allowing each class + * to use a block allocator that best suits that class. + */ struct metaslab_class { spa_t *mc_spa; metaslab_group_t *mc_rotor; @@ -52,8 +69,18 @@ struct metaslab_class { uint64_t mc_space; /* total space (alloc + free) */ uint64_t mc_dspace; /* total deflated space */ uint64_t mc_minblocksize; + uint64_t mc_histogram[RANGE_TREE_HISTOGRAM_SIZE]; }; +/* + * Metaslab groups encapsulate all the allocatable regions (i.e. metaslabs) + * of a top-level vdev. They are linked togther to form a circular linked + * list and can belong to only one metaslab class. Metaslab groups may become + * ineligible for allocations for a number of reasons such as limited free + * space, fragmentation, or going offline. When this happens the allocator will + * simply find the next metaslab group in the linked list and attempt + * to allocate from that group instead. + */ struct metaslab_group { kmutex_t mg_lock; avl_tree_t mg_metaslab_tree; @@ -67,12 +94,14 @@ struct metaslab_group { taskq_t *mg_taskq; metaslab_group_t *mg_prev; metaslab_group_t *mg_next; + uint64_t mg_fragmentation; + uint64_t mg_histogram[RANGE_TREE_HISTOGRAM_SIZE]; }; /* * This value defines the number of elements in the ms_lbas array. The value - * of 64 was chosen as it covers to cover all power of 2 buckets up to - * UINT64_MAX. This is the equivalent of highbit(UINT64_MAX). + * of 64 was chosen as it covers all power of 2 buckets up to UINT64_MAX. + * This is the equivalent of highbit(UINT64_MAX). */ #define MAX_LBAS 64 @@ -135,6 +164,7 @@ struct metaslab { uint64_t ms_id; uint64_t ms_start; uint64_t ms_size; + uint64_t ms_fragmentation; range_tree_t *ms_alloctree[TXG_SIZE]; range_tree_t *ms_freetree[TXG_SIZE]; @@ -142,12 +172,12 @@ struct metaslab { range_tree_t *ms_tree; boolean_t ms_condensing; /* condensing? */ + boolean_t ms_condense_wanted; boolean_t ms_loaded; boolean_t ms_loading; int64_t ms_deferspace; /* sum of ms_defermap[] space */ uint64_t ms_weight; /* weight vs. others in group */ - uint64_t ms_factor; uint64_t ms_access_txg; /* diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/rrwlock.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/rrwlock.h index fb44fbe183f..5ac2794bd94 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/rrwlock.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/rrwlock.h @@ -79,6 +79,31 @@ void rrw_tsd_destroy(void *arg); #define RRW_LOCK_HELD(x) \ (rrw_held(x, RW_WRITER) || rrw_held(x, RW_READER)) +/* + * A reader-mostly lock implementation, tuning above reader-writer locks + * for hightly parallel read acquisitions, pessimizing write acquisitions. + * + * This should be a prime number. See comment in rrwlock.c near + * RRM_TD_LOCK() for details. + */ +#define RRM_NUM_LOCKS 17 +typedef struct rrmlock { + rrwlock_t locks[RRM_NUM_LOCKS]; +} rrmlock_t; + +void rrm_init(rrmlock_t *rrl, boolean_t track_all); +void rrm_destroy(rrmlock_t *rrl); +void rrm_enter(rrmlock_t *rrl, krw_t rw, void *tag); +void rrm_enter_read(rrmlock_t *rrl, void *tag); +void rrm_enter_write(rrmlock_t *rrl); +void rrm_exit(rrmlock_t *rrl, void *tag); +boolean_t rrm_held(rrmlock_t *rrl, krw_t rw); + +#define RRM_READ_HELD(x) rrm_held(x, RW_READER) +#define RRM_WRITE_HELD(x) rrm_held(x, RW_WRITER) +#define RRM_LOCK_HELD(x) \ + (rrm_held(x, RW_WRITER) || rrm_held(x, RW_READER)) + #ifdef __cplusplus } #endif diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h index 64609c6326c..f62e3151f87 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. */ @@ -170,7 +170,7 @@ typedef struct zio_cksum { * +-------+-------+-------+-------+-------+-------+-------+-------+ * 5 |G| offset3 | * +-------+-------+-------+-------+-------+-------+-------+-------+ - * 6 |BDX|lvl| type | cksum | comp | PSIZE | LSIZE | + * 6 |BDX|lvl| type | cksum |E| comp| PSIZE | LSIZE | * +-------+-------+-------+-------+-------+-------+-------+-------+ * 7 | padding | * +-------+-------+-------+-------+-------+-------+-------+-------+ @@ -204,7 +204,8 @@ typedef struct zio_cksum { * G gang block indicator * B byteorder (endianness) * D dedup - * X unused + * X encryption (on version 30, which is not supported) + * E blkptr_t contains embedded data (see below) * lvl level of indirection * type DMU object type * phys birth txg of block allocation; zero if same as logical birth txg @@ -212,6 +213,100 @@ typedef struct zio_cksum { * fill count number of non-zero blocks under this bp * checksum[4] 256-bit checksum of the data this bp describes */ + +/* + * "Embedded" blkptr_t's don't actually point to a block, instead they + * have a data payload embedded in the blkptr_t itself. See the comment + * in blkptr.c for more details. + * + * The blkptr_t is laid out as follows: + * + * 64 56 48 40 32 24 16 8 0 + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 0 | payload | + * 1 | payload | + * 2 | payload | + * 3 | payload | + * 4 | payload | + * 5 | payload | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 6 |BDX|lvl| type | etype |E| comp| PSIZE| LSIZE | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 7 | payload | + * 8 | payload | + * 9 | payload | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * a | logical birth txg | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * b | payload | + * c | payload | + * d | payload | + * e | payload | + * f | payload | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * + * Legend: + * + * payload contains the embedded data + * B (byteorder) byteorder (endianness) + * D (dedup) padding (set to zero) + * X encryption (set to zero; see above) + * E (embedded) set to one + * lvl indirection level + * type DMU object type + * etype how to interpret embedded data (BP_EMBEDDED_TYPE_*) + * comp compression function of payload + * PSIZE size of payload after compression, in bytes + * LSIZE logical size of payload, in bytes + * note that 25 bits is enough to store the largest + * "normal" BP's LSIZE (2^16 * 2^9) in bytes + * log. birth transaction group in which the block was logically born + * + * Note that LSIZE and PSIZE are stored in bytes, whereas for non-embedded + * bp's they are stored in units of SPA_MINBLOCKSHIFT. + * Generally, the generic BP_GET_*() macros can be used on embedded BP's. + * The B, D, X, lvl, type, and comp fields are stored the same as with normal + * BP's so the BP_SET_* macros can be used with them. etype, PSIZE, LSIZE must + * be set with the BPE_SET_* macros. BP_SET_EMBEDDED() should be called before + * other macros, as they assert that they are only used on BP's of the correct + * "embedded-ness". + */ + +#define BPE_GET_ETYPE(bp) \ + (ASSERT(BP_IS_EMBEDDED(bp)), \ + BF64_GET((bp)->blk_prop, 40, 8)) +#define BPE_SET_ETYPE(bp, t) do { \ + ASSERT(BP_IS_EMBEDDED(bp)); \ + BF64_SET((bp)->blk_prop, 40, 8, t); \ +_NOTE(CONSTCOND) } while (0) + +#define BPE_GET_LSIZE(bp) \ + (ASSERT(BP_IS_EMBEDDED(bp)), \ + BF64_GET_SB((bp)->blk_prop, 0, 25, 0, 1)) +#define BPE_SET_LSIZE(bp, x) do { \ + ASSERT(BP_IS_EMBEDDED(bp)); \ + BF64_SET_SB((bp)->blk_prop, 0, 25, 0, 1, x); \ +_NOTE(CONSTCOND) } while (0) + +#define BPE_GET_PSIZE(bp) \ + (ASSERT(BP_IS_EMBEDDED(bp)), \ + BF64_GET_SB((bp)->blk_prop, 25, 7, 0, 1)) +#define BPE_SET_PSIZE(bp, x) do { \ + ASSERT(BP_IS_EMBEDDED(bp)); \ + BF64_SET_SB((bp)->blk_prop, 25, 7, 0, 1, x); \ +_NOTE(CONSTCOND) } while (0) + +typedef enum bp_embedded_type { + BP_EMBEDDED_TYPE_DATA, + BP_EMBEDDED_TYPE_RESERVED, /* Reserved for an unintegrated feature. */ + NUM_BP_EMBEDDED_TYPES = BP_EMBEDDED_TYPE_RESERVED +} bp_embedded_type_t; + +#define BPE_NUM_WORDS 14 +#define BPE_PAYLOAD_SIZE (BPE_NUM_WORDS * sizeof (uint64_t)) +#define BPE_IS_PAYLOADWORD(bp, wp) \ + ((wp) != &(bp)->blk_prop && (wp) != &(bp)->blk_birth) + #define SPA_BLKPTRSHIFT 7 /* blkptr_t is 128 bytes */ #define SPA_DVAS_PER_BP 3 /* Number of DVAs in a bp */ @@ -258,20 +353,37 @@ typedef struct blkptr { #define DVA_SET_GANG(dva, x) BF64_SET((dva)->dva_word[1], 63, 1, x) #define BP_GET_LSIZE(bp) \ - BF64_GET_SB((bp)->blk_prop, 0, SPA_LSIZEBITS, SPA_MINBLOCKSHIFT, 1) -#define BP_SET_LSIZE(bp, x) \ - BF64_SET_SB((bp)->blk_prop, 0, SPA_LSIZEBITS, SPA_MINBLOCKSHIFT, 1, x) + (BP_IS_EMBEDDED(bp) ? \ + (BPE_GET_ETYPE(bp) == BP_EMBEDDED_TYPE_DATA ? BPE_GET_LSIZE(bp) : 0): \ + BF64_GET_SB((bp)->blk_prop, 0, SPA_LSIZEBITS, SPA_MINBLOCKSHIFT, 1)) +#define BP_SET_LSIZE(bp, x) do { \ + ASSERT(!BP_IS_EMBEDDED(bp)); \ + BF64_SET_SB((bp)->blk_prop, \ + 0, SPA_LSIZEBITS, SPA_MINBLOCKSHIFT, 1, x); \ +_NOTE(CONSTCOND) } while (0) #define BP_GET_PSIZE(bp) \ - BF64_GET_SB((bp)->blk_prop, 16, SPA_PSIZEBITS, SPA_MINBLOCKSHIFT, 1) -#define BP_SET_PSIZE(bp, x) \ - BF64_SET_SB((bp)->blk_prop, 16, SPA_PSIZEBITS, SPA_MINBLOCKSHIFT, 1, x) + (BP_IS_EMBEDDED(bp) ? 0 : \ + BF64_GET_SB((bp)->blk_prop, 16, SPA_PSIZEBITS, SPA_MINBLOCKSHIFT, 1)) +#define BP_SET_PSIZE(bp, x) do { \ + ASSERT(!BP_IS_EMBEDDED(bp)); \ + BF64_SET_SB((bp)->blk_prop, \ + 16, SPA_PSIZEBITS, SPA_MINBLOCKSHIFT, 1, x); \ +_NOTE(CONSTCOND) } while (0) -#define BP_GET_COMPRESS(bp) BF64_GET((bp)->blk_prop, 32, 8) -#define BP_SET_COMPRESS(bp, x) BF64_SET((bp)->blk_prop, 32, 8, x) +#define BP_GET_COMPRESS(bp) BF64_GET((bp)->blk_prop, 32, 7) +#define BP_SET_COMPRESS(bp, x) BF64_SET((bp)->blk_prop, 32, 7, x) -#define BP_GET_CHECKSUM(bp) BF64_GET((bp)->blk_prop, 40, 8) -#define BP_SET_CHECKSUM(bp, x) BF64_SET((bp)->blk_prop, 40, 8, x) +#define BP_IS_EMBEDDED(bp) BF64_GET((bp)->blk_prop, 39, 1) +#define BP_SET_EMBEDDED(bp, x) BF64_SET((bp)->blk_prop, 39, 1, x) + +#define BP_GET_CHECKSUM(bp) \ + (BP_IS_EMBEDDED(bp) ? ZIO_CHECKSUM_OFF : \ + BF64_GET((bp)->blk_prop, 40, 8)) +#define BP_SET_CHECKSUM(bp, x) do { \ + ASSERT(!BP_IS_EMBEDDED(bp)); \ + BF64_SET((bp)->blk_prop, 40, 8, x); \ +_NOTE(CONSTCOND) } while (0) #define BP_GET_TYPE(bp) BF64_GET((bp)->blk_prop, 48, 8) #define BP_SET_TYPE(bp, x) BF64_SET((bp)->blk_prop, 48, 8, x) @@ -279,9 +391,6 @@ typedef struct blkptr { #define BP_GET_LEVEL(bp) BF64_GET((bp)->blk_prop, 56, 5) #define BP_SET_LEVEL(bp, x) BF64_SET((bp)->blk_prop, 56, 5, x) -#define BP_GET_PROP_BIT_61(bp) BF64_GET((bp)->blk_prop, 61, 1) -#define BP_SET_PROP_BIT_61(bp, x) BF64_SET((bp)->blk_prop, 61, 1, x) - #define BP_GET_DEDUP(bp) BF64_GET((bp)->blk_prop, 62, 1) #define BP_SET_DEDUP(bp, x) BF64_SET((bp)->blk_prop, 62, 1, x) @@ -289,31 +398,39 @@ typedef struct blkptr { #define BP_SET_BYTEORDER(bp, x) BF64_SET((bp)->blk_prop, 63, 1, x) #define BP_PHYSICAL_BIRTH(bp) \ - ((bp)->blk_phys_birth ? (bp)->blk_phys_birth : (bp)->blk_birth) + (BP_IS_EMBEDDED(bp) ? 0 : \ + (bp)->blk_phys_birth ? (bp)->blk_phys_birth : (bp)->blk_birth) #define BP_SET_BIRTH(bp, logical, physical) \ { \ + ASSERT(!BP_IS_EMBEDDED(bp)); \ (bp)->blk_birth = (logical); \ (bp)->blk_phys_birth = ((logical) == (physical) ? 0 : (physical)); \ } +#define BP_GET_FILL(bp) (BP_IS_EMBEDDED(bp) ? 1 : (bp)->blk_fill) + #define BP_GET_ASIZE(bp) \ - (DVA_GET_ASIZE(&(bp)->blk_dva[0]) + DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \ - DVA_GET_ASIZE(&(bp)->blk_dva[2])) + (BP_IS_EMBEDDED(bp) ? 0 : \ + DVA_GET_ASIZE(&(bp)->blk_dva[0]) + \ + DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \ + DVA_GET_ASIZE(&(bp)->blk_dva[2])) #define BP_GET_UCSIZE(bp) \ ((BP_GET_LEVEL(bp) > 0 || DMU_OT_IS_METADATA(BP_GET_TYPE(bp))) ? \ BP_GET_PSIZE(bp) : BP_GET_LSIZE(bp)) #define BP_GET_NDVAS(bp) \ - (!!DVA_GET_ASIZE(&(bp)->blk_dva[0]) + \ + (BP_IS_EMBEDDED(bp) ? 0 : \ + !!DVA_GET_ASIZE(&(bp)->blk_dva[0]) + \ !!DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \ !!DVA_GET_ASIZE(&(bp)->blk_dva[2])) #define BP_COUNT_GANG(bp) \ + (BP_IS_EMBEDDED(bp) ? 0 : \ (DVA_GET_GANG(&(bp)->blk_dva[0]) + \ DVA_GET_GANG(&(bp)->blk_dva[1]) + \ - DVA_GET_GANG(&(bp)->blk_dva[2])) + DVA_GET_GANG(&(bp)->blk_dva[2]))) #define DVA_EQUAL(dva1, dva2) \ ((dva1)->dva_word[1] == (dva2)->dva_word[1] && \ @@ -321,6 +438,7 @@ typedef struct blkptr { #define BP_EQUAL(bp1, bp2) \ (BP_PHYSICAL_BIRTH(bp1) == BP_PHYSICAL_BIRTH(bp2) && \ + (bp1)->blk_birth == (bp2)->blk_birth && \ DVA_EQUAL(&(bp1)->blk_dva[0], &(bp2)->blk_dva[0]) && \ DVA_EQUAL(&(bp1)->blk_dva[1], &(bp2)->blk_dva[1]) && \ DVA_EQUAL(&(bp1)->blk_dva[2], &(bp2)->blk_dva[2])) @@ -341,11 +459,13 @@ typedef struct blkptr { (zcp)->zc_word[3] = w3; \ } -#define BP_IDENTITY(bp) (&(bp)->blk_dva[0]) -#define BP_IS_GANG(bp) DVA_GET_GANG(BP_IDENTITY(bp)) +#define BP_IDENTITY(bp) (ASSERT(!BP_IS_EMBEDDED(bp)), &(bp)->blk_dva[0]) +#define BP_IS_GANG(bp) \ + (BP_IS_EMBEDDED(bp) ? B_FALSE : DVA_GET_GANG(BP_IDENTITY(bp))) #define DVA_IS_EMPTY(dva) ((dva)->dva_word[0] == 0ULL && \ (dva)->dva_word[1] == 0ULL) -#define BP_IS_HOLE(bp) DVA_IS_EMPTY(BP_IDENTITY(bp)) +#define BP_IS_HOLE(bp) \ + (!BP_IS_EMBEDDED(bp) && DVA_IS_EMPTY(BP_IDENTITY(bp))) /* BP_IS_RAIDZ(bp) assumes no block compression */ #define BP_IS_RAIDZ(bp) (DVA_GET_ASIZE(&(bp)->blk_dva[0]) > \ @@ -399,6 +519,17 @@ typedef struct blkptr { " birth=%lluL", \ (u_longlong_t)bp->blk_birth); \ } \ + } else if (BP_IS_EMBEDDED(bp)) { \ + len = func(buf + len, size - len, \ + "EMBEDDED [L%llu %s] et=%u %s " \ + "size=%llxL/%llxP birth=%lluL", \ + (u_longlong_t)BP_GET_LEVEL(bp), \ + type, \ + (int)BPE_GET_ETYPE(bp), \ + compress, \ + (u_longlong_t)BPE_GET_LSIZE(bp), \ + (u_longlong_t)BPE_GET_PSIZE(bp), \ + (u_longlong_t)bp->blk_birth); \ } else { \ for (int d = 0; d < BP_GET_NDVAS(bp); d++) { \ const dva_t *dva = &bp->blk_dva[d]; \ @@ -432,7 +563,7 @@ typedef struct blkptr { (u_longlong_t)BP_GET_PSIZE(bp), \ (u_longlong_t)bp->blk_birth, \ (u_longlong_t)BP_PHYSICAL_BIRTH(bp), \ - (u_longlong_t)bp->blk_fill, \ + (u_longlong_t)BP_GET_FILL(bp), \ ws, \ (u_longlong_t)bp->blk_cksum.zc_word[0], \ (u_longlong_t)bp->blk_cksum.zc_word[1], \ @@ -628,6 +759,7 @@ extern spa_load_state_t spa_load_state(spa_t *spa); extern uint64_t spa_freeze_txg(spa_t *spa); extern uint64_t spa_get_asize(spa_t *spa, uint64_t lsize); extern uint64_t spa_get_dspace(spa_t *spa); +extern uint64_t spa_get_slop_space(spa_t *spa); extern void spa_update_dspace(spa_t *spa); extern uint64_t spa_version(spa_t *spa); extern boolean_t spa_deflate(spa_t *spa); @@ -668,6 +800,7 @@ extern uint64_t bp_get_dsize(spa_t *spa, const blkptr_t *bp); extern boolean_t spa_has_slogs(spa_t *spa); extern boolean_t spa_is_root(spa_t *spa); extern boolean_t spa_writeable(spa_t *spa); +extern boolean_t spa_has_pending_synctask(spa_t *spa); extern int spa_mode(spa_t *spa); extern uint64_t zfs_strtonum(const char *str, char **nptr); @@ -689,7 +822,7 @@ extern void spa_history_log_internal_dd(dsl_dir_t *dd, const char *operation, dmu_tx_t *tx, const char *fmt, ...); /* error handling */ -struct zbookmark; +struct zbookmark_phys; extern void spa_log_error(spa_t *spa, zio_t *zio); extern void zfs_ereport_post(const char *cls, spa_t *spa, vdev_t *vd, zio_t *zio, uint64_t stateoroffset, uint64_t length); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h index 6fd44c89d97..a1943e72b03 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright 2013 Martin Matuska . All rights reserved. */ @@ -39,6 +39,7 @@ #include #include #include +#include #include #ifdef __cplusplus @@ -46,9 +47,9 @@ extern "C" { #endif typedef struct spa_error_entry { - zbookmark_t se_bookmark; - char *se_name; - avl_node_t se_avl; + zbookmark_phys_t se_bookmark; + char *se_name; + avl_node_t se_avl; } spa_error_entry_t; typedef struct spa_history_phys { diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h index 3691803306d..67fa2767b1f 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h @@ -24,7 +24,7 @@ */ /* - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #ifndef _SYS_SPACE_MAP_H @@ -44,9 +44,7 @@ extern "C" { * maintain backward compatibility. */ #define SPACE_MAP_SIZE_V0 (3 * sizeof (uint64_t)) -#define SPACE_MAP_HISTOGRAM_SIZE(sm) \ - (sizeof ((sm)->sm_phys->smp_histogram) / \ - sizeof ((sm)->sm_phys->smp_histogram[0])) +#define SPACE_MAP_HISTOGRAM_SIZE 32 /* * The space_map_phys is the on-disk representation of the space map. @@ -68,7 +66,7 @@ typedef struct space_map_phys { * whose size is: * 2^(i+sm_shift) <= size of free region in bytes < 2^(i+sm_shift+1) */ - uint64_t smp_histogram[32]; /* histogram of free space */ + uint64_t smp_histogram[SPACE_MAP_HISTOGRAM_SIZE]; } space_map_phys_t; /* diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h index e96c1fa8aac..77e2dba251c 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h @@ -23,7 +23,7 @@ * Use is subject to license terms. */ /* - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #ifndef _SYS_TXG_H @@ -112,6 +112,7 @@ extern boolean_t txg_sync_waiting(struct dsl_pool *dp); extern void txg_list_create(txg_list_t *tl, size_t offset); extern void txg_list_destroy(txg_list_t *tl); extern boolean_t txg_list_empty(txg_list_t *tl, uint64_t txg); +extern boolean_t txg_all_lists_empty(txg_list_t *tl); extern boolean_t txg_list_add(txg_list_t *tl, void *p, uint64_t txg); extern boolean_t txg_list_add_tail(txg_list_t *tl, void *p, uint64_t txg); extern void *txg_list_remove(txg_list_t *tl, uint64_t txg); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h index 768d00e7236..642a4c05d64 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #ifndef _SYS_VDEV_IMPL_H @@ -253,8 +253,11 @@ struct vdev { #define VDEV_PHYS_SIZE (112 << 10) #define VDEV_UBERBLOCK_RING (128 << 10) +/* The largest uberblock we support is 8k. */ +#define MAX_UBERBLOCK_SHIFT (13) #define VDEV_UBERBLOCK_SHIFT(vd) \ - MAX((vd)->vdev_top->vdev_ashift, UBERBLOCK_SHIFT) + MIN(MAX((vd)->vdev_top->vdev_ashift, UBERBLOCK_SHIFT), \ + MAX_UBERBLOCK_SHIFT) #define VDEV_UBERBLOCK_COUNT(vd) \ (VDEV_UBERBLOCK_RING >> VDEV_UBERBLOCK_SHIFT(vd)) #define VDEV_UBERBLOCK_OFFSET(vd, n) \ diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_debug.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_debug.h index f55251f8572..6dc521baef1 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_debug.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_debug.h @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #ifndef _SYS_ZFS_DEBUG_H @@ -49,15 +49,17 @@ extern "C" { #endif extern int zfs_flags; -extern int zfs_recover; +extern boolean_t zfs_recover; +extern boolean_t zfs_free_leak_on_eio; -#define ZFS_DEBUG_DPRINTF (1<<0) -#define ZFS_DEBUG_DBUF_VERIFY (1<<1) -#define ZFS_DEBUG_DNODE_VERIFY (1<<2) -#define ZFS_DEBUG_SNAPNAMES (1<<3) -#define ZFS_DEBUG_MODIFY (1<<4) -#define ZFS_DEBUG_SPA (1<<5) -#define ZFS_DEBUG_ZIO_FREE (1<<6) +#define ZFS_DEBUG_DPRINTF (1<<0) +#define ZFS_DEBUG_DBUF_VERIFY (1<<1) +#define ZFS_DEBUG_DNODE_VERIFY (1<<2) +#define ZFS_DEBUG_SNAPNAMES (1<<3) +#define ZFS_DEBUG_MODIFY (1<<4) +#define ZFS_DEBUG_SPA (1<<5) +#define ZFS_DEBUG_ZIO_FREE (1<<6) +#define ZFS_DEBUG_HISTOGRAM_VERIFY (1<<7) #ifdef ZFS_DEBUG extern void __dprintf(const char *file, const char *func, diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h index af2def2da67..73fbf3c9c0e 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. */ #ifndef _SYS_ZFS_IOCTL_H @@ -79,15 +79,19 @@ typedef enum drr_headertype { * Feature flags for zfs send streams (flags in drr_versioninfo) */ -#define DMU_BACKUP_FEATURE_DEDUP (0x1) -#define DMU_BACKUP_FEATURE_DEDUPPROPS (0x2) -#define DMU_BACKUP_FEATURE_SA_SPILL (0x4) +#define DMU_BACKUP_FEATURE_DEDUP (1<<0) +#define DMU_BACKUP_FEATURE_DEDUPPROPS (1<<1) +#define DMU_BACKUP_FEATURE_SA_SPILL (1<<2) +/* flags #3 - #15 are reserved for incompatible closed-source implementations */ +#define DMU_BACKUP_FEATURE_EMBED_DATA (1<<16) +#define DMU_BACKUP_FEATURE_EMBED_DATA_LZ4 (1<<17) /* * Mask of all supported backup features */ #define DMU_BACKUP_FEATURE_MASK (DMU_BACKUP_FEATURE_DEDUP | \ - DMU_BACKUP_FEATURE_DEDUPPROPS | DMU_BACKUP_FEATURE_SA_SPILL) + DMU_BACKUP_FEATURE_DEDUPPROPS | DMU_BACKUP_FEATURE_SA_SPILL | \ + DMU_BACKUP_FEATURE_EMBED_DATA | DMU_BACKUP_FEATURE_EMBED_DATA_LZ4) /* Are all features in the given flag word currently supported? */ #define DMU_STREAM_SUPPORTED(x) (!((x) & ~DMU_BACKUP_FEATURE_MASK)) @@ -210,7 +214,7 @@ typedef struct dmu_replay_record { enum { DRR_BEGIN, DRR_OBJECT, DRR_FREEOBJECTS, DRR_WRITE, DRR_FREE, DRR_END, DRR_WRITE_BYREF, - DRR_SPILL, DRR_NUMTYPES + DRR_SPILL, DRR_WRITE_EMBEDDED, DRR_NUMTYPES } drr_type; uint32_t drr_payloadlen; union { @@ -222,6 +226,19 @@ typedef struct dmu_replay_record { struct drr_free drr_free; struct drr_write_byref drr_write_byref; struct drr_spill drr_spill; + struct drr_write_embedded { + uint64_t drr_object; + uint64_t drr_offset; + /* logical length, should equal blocksize */ + uint64_t drr_length; + uint64_t drr_toguid; + uint8_t drr_compression; + uint8_t drr_etype; + uint8_t drr_pad[6]; + uint32_t drr_lsize; /* uncompressed size of payload */ + uint32_t drr_psize; /* compr. (real) size of payload */ + /* (possibly compressed) content follows */ + } drr_write_embedded; } drr_u; } dmu_replay_record_t; @@ -324,8 +341,8 @@ typedef struct zfs_cmd { dmu_objset_stats_t zc_objset_stats; struct drr_begin zc_begin_record; zinject_record_t zc_inject_record; - boolean_t zc_defer_destroy; - boolean_t zc_temphold; + uint32_t zc_defer_destroy; + uint32_t zc_flags; uint64_t zc_action_handle; int zc_cleanup_fd; uint8_t zc_simple; diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h index 65da239e7dd..412088324ab 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h @@ -64,7 +64,7 @@ struct zfsvfs { int z_norm; /* normalization flags */ boolean_t z_atime; /* enable atimes mount option */ boolean_t z_unmounted; /* unmounted */ - rrwlock_t z_teardown_lock; + rrmlock_t z_teardown_lock; krwlock_t z_teardown_inactive_lock; list_t z_all_znodes; /* all vnodes in the fs */ kmutex_t z_znodes_lock; /* lock for z_all_znodes */ diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h index 3439641d788..dae099b7915 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h @@ -256,7 +256,7 @@ VTOZ(vnode_t *vp) /* Called on entry to each ZFS vnode and vfs operation */ #define ZFS_ENTER(zfsvfs) \ { \ - rrw_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \ + rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \ if ((zfsvfs)->z_unmounted) { \ ZFS_EXIT(zfsvfs); \ return (EIO); \ @@ -265,10 +265,10 @@ VTOZ(vnode_t *vp) /* Called on entry to each ZFS vnode and vfs operation that can not return EIO */ #define ZFS_ENTER_NOERROR(zfsvfs) \ - rrw_enter(&(zfsvfs)->z_teardown_lock, RW_READER, FTAG) + rrm_enter(&(zfsvfs)->z_teardown_lock, RW_READER, FTAG) /* Must be called before exiting the vop */ -#define ZFS_EXIT(zfsvfs) rrw_exit(&(zfsvfs)->z_teardown_lock, FTAG) +#define ZFS_EXIT(zfsvfs) rrm_exit(&(zfsvfs)->z_teardown_lock, FTAG) /* Verifies the znode is valid */ #define ZFS_VERIFY_ZP(zp) \ diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h index 84187a843b1..d2a8fa33638 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h @@ -22,8 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ @@ -85,6 +84,12 @@ enum zio_checksum { ZIO_CHECKSUM_FUNCTIONS }; +/* + * The number of "legacy" compression functions which can be set on individual + * objects. + */ +#define ZIO_CHECKSUM_LEGACY_FUNCTIONS ZIO_CHECKSUM_ZILOG2 + #define ZIO_CHECKSUM_ON_VALUE ZIO_CHECKSUM_FLETCHER_4 #define ZIO_CHECKSUM_DEFAULT ZIO_CHECKSUM_ON @@ -114,6 +119,12 @@ enum zio_compress { ZIO_COMPRESS_FUNCTIONS }; +/* + * The number of "legacy" compression functions which can be set on individual + * objects. + */ +#define ZIO_COMPRESS_LEGACY_FUNCTIONS ZIO_COMPRESS_LZ4 + /* N.B. when altering this value, also change BOOTFS_COMPRESS_VALID below */ #define ZIO_COMPRESS_ON_VALUE ZIO_COMPRESS_LZJB #define ZIO_COMPRESS_DEFAULT ZIO_COMPRESS_OFF @@ -155,19 +166,20 @@ enum zio_flag { ZIO_FLAG_RESILVER = 1 << 3, ZIO_FLAG_SCRUB = 1 << 4, ZIO_FLAG_SCAN_THREAD = 1 << 5, + ZIO_FLAG_PHYSICAL = 1 << 6, #define ZIO_FLAG_AGG_INHERIT (ZIO_FLAG_CANFAIL - 1) /* * Flags inherited by ddt, gang, and vdev children. */ - ZIO_FLAG_CANFAIL = 1 << 6, /* must be first for INHERIT */ - ZIO_FLAG_SPECULATIVE = 1 << 7, - ZIO_FLAG_CONFIG_WRITER = 1 << 8, - ZIO_FLAG_DONT_RETRY = 1 << 9, - ZIO_FLAG_DONT_CACHE = 1 << 10, - ZIO_FLAG_NODATA = 1 << 11, - ZIO_FLAG_INDUCE_DAMAGE = 1 << 12, + ZIO_FLAG_CANFAIL = 1 << 7, /* must be first for INHERIT */ + ZIO_FLAG_SPECULATIVE = 1 << 8, + ZIO_FLAG_CONFIG_WRITER = 1 << 9, + ZIO_FLAG_DONT_RETRY = 1 << 10, + ZIO_FLAG_DONT_CACHE = 1 << 11, + ZIO_FLAG_NODATA = 1 << 12, + ZIO_FLAG_INDUCE_DAMAGE = 1 << 13, #define ZIO_FLAG_DDT_INHERIT (ZIO_FLAG_IO_RETRY - 1) #define ZIO_FLAG_GANG_INHERIT (ZIO_FLAG_IO_RETRY - 1) @@ -175,28 +187,28 @@ enum zio_flag { /* * Flags inherited by vdev children. */ - ZIO_FLAG_IO_RETRY = 1 << 13, /* must be first for INHERIT */ - ZIO_FLAG_PROBE = 1 << 14, - ZIO_FLAG_TRYHARD = 1 << 15, - ZIO_FLAG_OPTIONAL = 1 << 16, + ZIO_FLAG_IO_RETRY = 1 << 14, /* must be first for INHERIT */ + ZIO_FLAG_PROBE = 1 << 15, + ZIO_FLAG_TRYHARD = 1 << 16, + ZIO_FLAG_OPTIONAL = 1 << 17, #define ZIO_FLAG_VDEV_INHERIT (ZIO_FLAG_DONT_QUEUE - 1) /* * Flags not inherited by any children. */ - ZIO_FLAG_DONT_QUEUE = 1 << 17, /* must be first for INHERIT */ - ZIO_FLAG_DONT_PROPAGATE = 1 << 18, - ZIO_FLAG_IO_BYPASS = 1 << 19, - ZIO_FLAG_IO_REWRITE = 1 << 20, - ZIO_FLAG_RAW = 1 << 21, - ZIO_FLAG_GANG_CHILD = 1 << 22, - ZIO_FLAG_DDT_CHILD = 1 << 23, - ZIO_FLAG_GODFATHER = 1 << 24, - ZIO_FLAG_NOPWRITE = 1 << 25, - ZIO_FLAG_REEXECUTED = 1 << 26, - ZIO_FLAG_DELEGATED = 1 << 27, - ZIO_FLAG_QUEUE_IO_DONE = 1 << 28, + ZIO_FLAG_DONT_QUEUE = 1 << 18, /* must be first for INHERIT */ + ZIO_FLAG_DONT_PROPAGATE = 1 << 19, + ZIO_FLAG_IO_BYPASS = 1 << 20, + ZIO_FLAG_IO_REWRITE = 1 << 21, + ZIO_FLAG_RAW = 1 << 22, + ZIO_FLAG_GANG_CHILD = 1 << 23, + ZIO_FLAG_DDT_CHILD = 1 << 24, + ZIO_FLAG_GODFATHER = 1 << 25, + ZIO_FLAG_NOPWRITE = 1 << 26, + ZIO_FLAG_REEXECUTED = 1 << 27, + ZIO_FLAG_DELEGATED = 1 << 28, + ZIO_FLAG_QUEUE_IO_DONE = 1 << 29, }; #define ZIO_FLAG_MUSTSUCCEED 0 @@ -252,16 +264,16 @@ extern const char *zio_type_name[ZIO_TYPES]; * Note: this structure is called a bookmark because its original purpose * was to remember where to resume a pool-wide traverse. * - * Note: this structure is passed between userland and the kernel. - * Therefore it must not change size or alignment between 32/64 bit - * compilation options. + * Note: this structure is passed between userland and the kernel, and is + * stored on disk (by virtue of being incorporated into other on-disk + * structures, e.g. dsl_scan_phys_t). */ -typedef struct zbookmark { +typedef struct zbookmark_phys { uint64_t zb_objset; uint64_t zb_object; int64_t zb_level; uint64_t zb_blkid; -} zbookmark_t; +} zbookmark_phys_t; #define SET_BOOKMARK(zb, objset, object, level, blkid) \ { \ @@ -405,7 +417,7 @@ extern zio_trim_stats_t zio_trim_stats; struct zio { /* Core information about this I/O */ - zbookmark_t io_bookmark; + zbookmark_phys_t io_bookmark; zio_prop_t io_prop; zio_type_t io_type; enum zio_child io_child_type; @@ -487,17 +499,17 @@ extern zio_t *zio_root(spa_t *spa, extern zio_t *zio_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, void *data, uint64_t size, zio_done_func_t *done, void *priv, - zio_priority_t priority, enum zio_flag flags, const zbookmark_t *zb); + zio_priority_t priority, enum zio_flag flags, const zbookmark_phys_t *zb); extern zio_t *zio_write(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, void *data, uint64_t size, const zio_prop_t *zp, zio_done_func_t *ready, zio_done_func_t *physdone, zio_done_func_t *done, void *priv, - zio_priority_t priority, enum zio_flag flags, const zbookmark_t *zb); + zio_priority_t priority, enum zio_flag flags, const zbookmark_phys_t *zb); extern zio_t *zio_rewrite(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, void *data, uint64_t size, zio_done_func_t *done, void *priv, - zio_priority_t priority, enum zio_flag flags, zbookmark_t *zb); + zio_priority_t priority, enum zio_flag flags, zbookmark_phys_t *zb); extern void zio_write_override(zio_t *zio, blkptr_t *bp, int copies, boolean_t nopwrite); @@ -619,9 +631,9 @@ extern void zfs_ereport_post_checksum(spa_t *spa, vdev_t *vd, /* Called from spa_sync(), but primarily an injection handler */ extern void spa_handle_ignored_writes(spa_t *spa); -/* zbookmark functions */ +/* zbookmark_phys functions */ boolean_t zbookmark_is_before(const struct dnode_phys *dnp, - const zbookmark_t *zb1, const zbookmark_t *zb2); + const zbookmark_phys_t *zb1, const zbookmark_phys_t *zb2); #ifdef __cplusplus } diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h index c0be314e63b..a617735315f 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h @@ -81,7 +81,7 @@ extern int lz4_decompress(void *src, void *dst, size_t s_len, size_t d_len, * Compress and decompress data if necessary. */ extern size_t zio_compress_data(enum zio_compress c, void *src, void *dst, - size_t s_len, size_t minblocksize); + size_t s_len); extern int zio_decompress_data(enum zio_compress c, void *src, void *dst, size_t s_len, size_t d_len); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c index 7e981993ca4..5c52042a014 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c @@ -85,31 +85,22 @@ static u_int trim_vdev_max_pending = 64; SYSCTL_DECL(_vfs_zfs); SYSCTL_NODE(_vfs_zfs, OID_AUTO, trim, CTLFLAG_RD, 0, "ZFS TRIM"); -TUNABLE_INT("vfs.zfs.trim.txg_delay", &trim_txg_delay); SYSCTL_UINT(_vfs_zfs_trim, OID_AUTO, txg_delay, CTLFLAG_RWTUN, &trim_txg_delay, 0, "Delay TRIMs by up to this many TXGs"); - -TUNABLE_INT("vfs.zfs.trim.timeout", &trim_timeout); SYSCTL_UINT(_vfs_zfs_trim, OID_AUTO, timeout, CTLFLAG_RWTUN, &trim_timeout, 0, "Delay TRIMs by up to this many seconds"); - -TUNABLE_INT("vfs.zfs.trim.max_interval", &trim_max_interval); SYSCTL_UINT(_vfs_zfs_trim, OID_AUTO, max_interval, CTLFLAG_RWTUN, &trim_max_interval, 0, "Maximum interval between TRIM queue processing (seconds)"); SYSCTL_DECL(_vfs_zfs_vdev); -TUNABLE_QUAD("vfs.zfs.vdev.trim_max_bytes", &trim_vdev_max_bytes); SYSCTL_QUAD(_vfs_zfs_vdev, OID_AUTO, trim_max_bytes, CTLFLAG_RWTUN, &trim_vdev_max_bytes, 0, "Maximum pending TRIM bytes for a vdev"); - -TUNABLE_INT("vfs.zfs.vdev.trim_max_pending", &trim_vdev_max_pending); SYSCTL_UINT(_vfs_zfs_vdev, OID_AUTO, trim_max_pending, CTLFLAG_RWTUN, &trim_vdev_max_pending, 0, "Maximum pending TRIM segments for a vdev"); - static void trim_map_vdev_commit_done(spa_t *spa, vdev_t *vd); static int diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c index 0201bef3ae9..5ab32326cd9 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Portions Copyright 2011 Martin Matuska - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #include @@ -112,8 +112,7 @@ int zfs_txg_timeout = 5; /* max seconds worth of delta per txg */ SYSCTL_DECL(_vfs_zfs); SYSCTL_NODE(_vfs_zfs, OID_AUTO, txg, CTLFLAG_RW, 0, "ZFS TXG"); -TUNABLE_INT("vfs.zfs.txg.timeout", &zfs_txg_timeout); -SYSCTL_INT(_vfs_zfs_txg, OID_AUTO, timeout, CTLFLAG_RW, &zfs_txg_timeout, 0, +SYSCTL_INT(_vfs_zfs_txg, OID_AUTO, timeout, CTLFLAG_RWTUN, &zfs_txg_timeout, 0, "Maximum seconds worth of delta per txg"); /* @@ -726,6 +725,24 @@ txg_list_empty(txg_list_t *tl, uint64_t txg) return (tl->tl_head[txg & TXG_MASK] == NULL); } +/* + * Returns true if all txg lists are empty. + * + * Warning: this is inherently racy (an item could be added immediately after this + * function returns). We don't bother with the lock because it wouldn't change the + * semantics. + */ +boolean_t +txg_all_lists_empty(txg_list_t *tl) +{ + for (int i = 0; i < TXG_SIZE; i++) { + if (!txg_list_empty(tl, i)) { + return (B_FALSE); + } + } + return (B_TRUE); +} + /* * Add an entry to the list (unless it's already on the list). * Returns B_TRUE if it was actually added. diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c index 9c26d2c6e50..885c43239ef 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c @@ -2257,6 +2257,11 @@ vdev_remove(vdev_t *vd, uint64_t txg) tx = dmu_tx_create_assigned(spa_get_dsl(spa), txg); if (vd->vdev_ms != NULL) { + metaslab_group_t *mg = vd->vdev_mg; + + metaslab_group_histogram_verify(mg); + metaslab_class_histogram_verify(mg->mg_class); + for (int m = 0; m < vd->vdev_ms_count; m++) { metaslab_t *msp = vd->vdev_ms[m]; @@ -2264,12 +2269,27 @@ vdev_remove(vdev_t *vd, uint64_t txg) continue; mutex_enter(&msp->ms_lock); + /* + * If the metaslab was not loaded when the vdev + * was removed then the histogram accounting may + * not be accurate. Update the histogram information + * here so that we ensure that the metaslab group + * and metaslab class are up-to-date. + */ + metaslab_group_histogram_remove(mg, msp); + VERIFY0(space_map_allocated(msp->ms_sm)); space_map_free(msp->ms_sm, tx); space_map_close(msp->ms_sm); msp->ms_sm = NULL; mutex_exit(&msp->ms_lock); } + + metaslab_group_histogram_verify(mg); + metaslab_class_histogram_verify(mg->mg_class); + for (int i = 0; i < RANGE_TREE_HISTOGRAM_SIZE; i++) + ASSERT0(mg->mg_histogram[i]); + } if (vd->vdev_ms_array) { @@ -2729,7 +2749,10 @@ vdev_accessible(vdev_t *vd, zio_t *zio) void vdev_get_stats(vdev_t *vd, vdev_stat_t *vs) { - vdev_t *rvd = vd->vdev_spa->spa_root_vdev; + spa_t *spa = vd->vdev_spa; + vdev_t *rvd = spa->spa_root_vdev; + + ASSERT(spa_config_held(spa, SCL_ALL, RW_READER) != 0); mutex_enter(&vd->vdev_stat_lock); bcopy(&vd->vdev_stat, vs, sizeof (*vs)); @@ -2743,7 +2766,8 @@ vdev_get_stats(vdev_t *vd, vdev_stat_t *vs) ? vd->vdev_top->vdev_ashift : vd->vdev_ashift; vs->vs_logical_ashift = vd->vdev_logical_ashift; vs->vs_physical_ashift = vd->vdev_physical_ashift; - mutex_exit(&vd->vdev_stat_lock); + if (vd->vdev_aux == NULL && vd == vd->vdev_top) + vs->vs_fragmentation = vd->vdev_mg->mg_fragmentation; /* * If we're getting stats on the root vdev, aggregate the I/O counts @@ -2754,15 +2778,14 @@ vdev_get_stats(vdev_t *vd, vdev_stat_t *vs) vdev_t *cvd = rvd->vdev_child[c]; vdev_stat_t *cvs = &cvd->vdev_stat; - mutex_enter(&vd->vdev_stat_lock); for (int t = 0; t < ZIO_TYPES; t++) { vs->vs_ops[t] += cvs->vs_ops[t]; vs->vs_bytes[t] += cvs->vs_bytes[t]; } cvs->vs_scan_removing = cvd->vdev_removing; - mutex_exit(&vd->vdev_stat_lock); } } + mutex_exit(&vd->vdev_stat_lock); } void diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c index 2ad15fe8227..a3e9b02a71c 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c @@ -90,13 +90,10 @@ int zfs_vdev_cache_bshift = 16; SYSCTL_DECL(_vfs_zfs_vdev); SYSCTL_NODE(_vfs_zfs_vdev, OID_AUTO, cache, CTLFLAG_RW, 0, "ZFS VDEV Cache"); -TUNABLE_INT("vfs.zfs.vdev.cache.max", &zfs_vdev_cache_max); SYSCTL_INT(_vfs_zfs_vdev_cache, OID_AUTO, max, CTLFLAG_RDTUN, &zfs_vdev_cache_max, 0, "Maximum I/O request size that increase read size"); -TUNABLE_INT("vfs.zfs.vdev.cache.size", &zfs_vdev_cache_size); SYSCTL_INT(_vfs_zfs_vdev_cache, OID_AUTO, size, CTLFLAG_RDTUN, &zfs_vdev_cache_size, 0, "Size of VDEV cache"); -TUNABLE_INT("vfs.zfs.vdev.cache.bshift", &zfs_vdev_cache_bshift); SYSCTL_INT(_vfs_zfs_vdev_cache, OID_AUTO, bshift, CTLFLAG_RDTUN, &zfs_vdev_cache_bshift, 0, "Turn too small requests into 1 << this value"); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c index b64ebddbcb1..c38a2fc869c 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c @@ -53,14 +53,12 @@ DECLARE_GEOM_CLASS(zfs_vdev_class, zfs_vdev); SYSCTL_DECL(_vfs_zfs_vdev); /* Don't send BIO_FLUSH. */ -static int vdev_geom_bio_flush_disable = 0; -TUNABLE_INT("vfs.zfs.vdev.bio_flush_disable", &vdev_geom_bio_flush_disable); -SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, bio_flush_disable, CTLFLAG_RW, +static int vdev_geom_bio_flush_disable; +SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, bio_flush_disable, CTLFLAG_RWTUN, &vdev_geom_bio_flush_disable, 0, "Disable BIO_FLUSH"); /* Don't send BIO_DELETE. */ -static int vdev_geom_bio_delete_disable = 0; -TUNABLE_INT("vfs.zfs.vdev.bio_delete_disable", &vdev_geom_bio_delete_disable); -SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, bio_delete_disable, CTLFLAG_RW, +static int vdev_geom_bio_delete_disable; +SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, bio_delete_disable, CTLFLAG_RWTUN, &vdev_geom_bio_delete_disable, 0, "Disable BIO_DELETE"); static void diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c index 0b8d449f4aa..d9b15db400f 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c @@ -74,32 +74,26 @@ static SYSCTL_NODE(_vfs_zfs_vdev, OID_AUTO, mirror, CTLFLAG_RD, 0, /* Rotating media load calculation configuration. */ static int rotating_inc = 0; -TUNABLE_INT("vfs.zfs.vdev.mirror.rotating_inc", &rotating_inc); -SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, rotating_inc, CTLFLAG_RW, +SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, rotating_inc, CTLFLAG_RWTUN, &rotating_inc, 0, "Rotating media load increment for non-seeking I/O's"); static int rotating_seek_inc = 5; -TUNABLE_INT("vfs.zfs.vdev.mirror.rotating_seek_inc", &rotating_seek_inc); -SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, rotating_seek_inc, CTLFLAG_RW, +SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, rotating_seek_inc, CTLFLAG_RWTUN, &rotating_seek_inc, 0, "Rotating media load increment for seeking I/O's"); static int rotating_seek_offset = 1 * 1024 * 1024; -TUNABLE_INT("vfs.zfs.vdev.mirror.rotating_seek_offset", &rotating_seek_offset); -SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, rotating_seek_offset, CTLFLAG_RW, +SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, rotating_seek_offset, CTLFLAG_RWTUN, &rotating_seek_offset, 0, "Offset in bytes from the last I/O which " "triggers a reduced rotating media seek increment"); /* Non-rotating media load calculation configuration. */ static int non_rotating_inc = 0; -TUNABLE_INT("vfs.zfs.vdev.mirror.non_rotating_inc", &non_rotating_inc); -SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, non_rotating_inc, CTLFLAG_RW, +SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, non_rotating_inc, CTLFLAG_RWTUN, &non_rotating_inc, 0, "Non-rotating media load increment for non-seeking I/O's"); static int non_rotating_seek_inc = 1; -TUNABLE_INT("vfs.zfs.vdev.mirror.non_rotating_seek_inc", - &non_rotating_seek_inc); -SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, non_rotating_seek_inc, CTLFLAG_RW, +SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, non_rotating_seek_inc, CTLFLAG_RWTUN, &non_rotating_seek_inc, 0, "Non-rotating media load increment for seeking I/O's"); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c index 60fd4c3eedf..f0a050db946 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c @@ -24,7 +24,7 @@ */ /* - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #include @@ -176,23 +176,18 @@ int zfs_vdev_write_gap_limit = 4 << 10; #ifdef __FreeBSD__ SYSCTL_DECL(_vfs_zfs_vdev); -TUNABLE_INT("vfs.zfs.vdev.max_active", &zfs_vdev_max_active); -SYSCTL_UINT(_vfs_zfs_vdev, OID_AUTO, max_active, CTLFLAG_RW, +SYSCTL_UINT(_vfs_zfs_vdev, OID_AUTO, max_active, CTLFLAG_RWTUN, &zfs_vdev_max_active, 0, "The maximum number of I/Os of all types active for each device."); #define ZFS_VDEV_QUEUE_KNOB_MIN(name) \ -TUNABLE_INT("vfs.zfs.vdev." #name "_min_active", \ - &zfs_vdev_ ## name ## _min_active); \ -SYSCTL_UINT(_vfs_zfs_vdev, OID_AUTO, name ## _min_active, CTLFLAG_RW, \ +SYSCTL_UINT(_vfs_zfs_vdev, OID_AUTO, name ## _min_active, CTLFLAG_RWTUN,\ &zfs_vdev_ ## name ## _min_active, 0, \ "Initial number of I/O requests of type " #name \ " active for each device"); #define ZFS_VDEV_QUEUE_KNOB_MAX(name) \ -TUNABLE_INT("vfs.zfs.vdev." #name "_max_active", \ - &zfs_vdev_ ## name ## _max_active); \ -SYSCTL_UINT(_vfs_zfs_vdev, OID_AUTO, name ## _max_active, CTLFLAG_RW, \ +SYSCTL_UINT(_vfs_zfs_vdev, OID_AUTO, name ## _max_active, CTLFLAG_RWTUN,\ &zfs_vdev_ ## name ## _max_active, 0, \ "Maximum number of I/O requests of type " #name \ " active for each device"); @@ -212,16 +207,13 @@ ZFS_VDEV_QUEUE_KNOB_MAX(trim); #undef ZFS_VDEV_QUEUE_KNOB -TUNABLE_INT("vfs.zfs.vdev.aggregation_limit", &zfs_vdev_aggregation_limit); -SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, aggregation_limit, CTLFLAG_RW, +SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, aggregation_limit, CTLFLAG_RWTUN, &zfs_vdev_aggregation_limit, 0, "I/O requests are aggregated up to this size"); -TUNABLE_INT("vfs.zfs.vdev.read_gap_limit", &zfs_vdev_read_gap_limit); -SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, read_gap_limit, CTLFLAG_RW, +SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, read_gap_limit, CTLFLAG_RWTUN, &zfs_vdev_read_gap_limit, 0, "Acceptable gap between two reads being aggregated"); -TUNABLE_INT("vfs.zfs.vdev.write_gap_limit", &zfs_vdev_write_gap_limit); -SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, write_gap_limit, CTLFLAG_RW, +SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, write_gap_limit, CTLFLAG_RWTUN, &zfs_vdev_write_gap_limit, 0, "Acceptable gap between two writes being aggregated"); #endif @@ -424,14 +416,23 @@ vdev_queue_class_min_active(zio_priority_t p) } static int -vdev_queue_max_async_writes(uint64_t dirty) +vdev_queue_max_async_writes(spa_t *spa) { int writes; + uint64_t dirty = spa->spa_dsl_pool->dp_dirty_total; uint64_t min_bytes = zfs_dirty_data_max * zfs_vdev_async_write_active_min_dirty_percent / 100; uint64_t max_bytes = zfs_dirty_data_max * zfs_vdev_async_write_active_max_dirty_percent / 100; + /* + * Sync tasks correspond to interactive user actions. To reduce the + * execution time of those actions we push data out as fast as possible. + */ + if (spa_has_pending_synctask(spa)) { + return (zfs_vdev_async_write_max_active); + } + if (dirty < min_bytes) return (zfs_vdev_async_write_min_active); if (dirty > max_bytes) @@ -464,8 +465,7 @@ vdev_queue_class_max_active(spa_t *spa, zio_priority_t p) case ZIO_PRIORITY_ASYNC_READ: return (zfs_vdev_async_read_max_active); case ZIO_PRIORITY_ASYNC_WRITE: - return (vdev_queue_max_async_writes( - spa->spa_dsl_pool->dp_dirty_total)); + return (vdev_queue_max_async_writes(spa)); case ZIO_PRIORITY_SCRUB: return (zfs_vdev_scrub_max_active); case ZIO_PRIORITY_TRIM: diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_debug.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_debug.c index 26ea561eb1d..a9cbe4dfe39 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_debug.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_debug.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #include @@ -28,7 +28,7 @@ list_t zfs_dbgmsgs; int zfs_dbgmsg_size; kmutex_t zfs_dbgmsgs_lock; -int zfs_dbgmsg_maxsize = 1<<20; /* 1MB */ +int zfs_dbgmsg_maxsize = 4<<20; /* 4MB */ void zfs_dbgmsg_init(void) @@ -57,7 +57,10 @@ zfs_dbgmsg_fini(void) * echo ::zfs_dbgmsg | mdb -k * * Monitor these messages by running: - * dtrace -q -n 'zfs-dbgmsg{printf("%s\n", stringof(arg0))}' + * dtrace -qn 'zfs-dbgmsg{printf("%s\n", stringof(arg0))}' + * + * When used with libzpool, monitor with: + * dtrace -qn 'zfs$pid::zfs_dbgmsg:probe1{printf("%s\n", copyinstr(arg1))}' */ void zfs_dbgmsg(const char *fmt, ...) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c index be96da91c43..f7c2b6a7e67 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013, 2014 by Delphix. All rights reserved. */ #include @@ -559,6 +559,7 @@ zfs_purgedir(znode_t *dzp) dmu_tx_hold_zap(tx, zfsvfs->z_unlinkedobj, FALSE, NULL); /* Is this really needed ? */ zfs_sa_upgrade_txholds(tx, xzp); + dmu_tx_mark_netfree(tx); error = dmu_tx_assign(tx, TXG_WAIT); if (error) { dmu_tx_abort(tx); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c index 4f7c082cbef..a6246ccc9a8 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c @@ -24,11 +24,13 @@ * Copyright (c) 2011-2012 Pawel Jakub Dawidek . * All rights reserved. * Copyright 2013 Martin Matuska . All rights reserved. + * Copyright 2014 Xin Li . All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2014, Joyent, Inc. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. + * Copyright (c) 2014, Nexenta Systems, Inc. All rights reserved. */ /* @@ -195,8 +197,7 @@ CTASSERT(sizeof(zfs_cmd_t) < IOCPARM_MAX); static int snapshot_list_prefetch; SYSCTL_DECL(_vfs_zfs); -TUNABLE_INT("vfs.zfs.snapshot_list_prefetch", &snapshot_list_prefetch); -SYSCTL_INT(_vfs_zfs, OID_AUTO, snapshot_list_prefetch, CTLFLAG_RW, +SYSCTL_INT(_vfs_zfs, OID_AUTO, snapshot_list_prefetch, CTLFLAG_RWTUN, &snapshot_list_prefetch, 0, "Prefetch data when listing snapshots"); static struct cdev *zfsdev; @@ -1464,7 +1465,7 @@ zfsvfs_hold(const char *name, void *tag, zfsvfs_t **zfvp, boolean_t writer) if (getzfsvfs(name, zfvp) != 0) error = zfsvfs_create(name, zfvp); if (error == 0) { - rrw_enter(&(*zfvp)->z_teardown_lock, (writer) ? RW_WRITER : + rrm_enter(&(*zfvp)->z_teardown_lock, (writer) ? RW_WRITER : RW_READER, tag); if ((*zfvp)->z_unmounted) { /* @@ -1472,7 +1473,7 @@ zfsvfs_hold(const char *name, void *tag, zfsvfs_t **zfvp, boolean_t writer) * thread should be just about to disassociate the * objset from the zfsvfs. */ - rrw_exit(&(*zfvp)->z_teardown_lock, tag); + rrm_exit(&(*zfvp)->z_teardown_lock, tag); return (SET_ERROR(EBUSY)); } } @@ -1482,7 +1483,7 @@ zfsvfs_hold(const char *name, void *tag, zfsvfs_t **zfvp, boolean_t writer) static void zfsvfs_rele(zfsvfs_t *zfsvfs, void *tag) { - rrw_exit(&zfsvfs->z_teardown_lock, tag); + rrm_exit(&zfsvfs->z_teardown_lock, tag); if (zfsvfs->z_vfs) { VFS_RELE(zfsvfs->z_vfs); @@ -2504,37 +2505,6 @@ zfs_prop_set_special(const char *dsname, zprop_source_t source, } break; } - case ZFS_PROP_COMPRESSION: - { - if (intval == ZIO_COMPRESS_LZ4) { - spa_t *spa; - - if ((err = spa_open(dsname, &spa, FTAG)) != 0) - return (err); - - /* - * Setting the LZ4 compression algorithm activates - * the feature. - */ - if (!spa_feature_is_active(spa, - SPA_FEATURE_LZ4_COMPRESS)) { - if ((err = zfs_prop_activate_feature(spa, - SPA_FEATURE_LZ4_COMPRESS)) != 0) { - spa_close(spa, FTAG); - return (err); - } - } - - spa_close(spa, FTAG); - } - /* - * We still want the default set action to be performed in the - * caller, we only performed zfeature settings here. - */ - err = -1; - break; - } - default: err = -1; } @@ -3987,7 +3957,7 @@ zfs_prop_activate_feature(spa_t *spa, spa_feature_t feature) /* EBUSY here indicates that the feature is already active */ err = dsl_sync_task(spa_name(spa), zfs_prop_activate_feature_check, zfs_prop_activate_feature_sync, - &feature, 2); + &feature, 2, ZFS_SPACE_CHECK_RESERVED); if (err != 0 && err != EBUSY) return (err); @@ -4354,6 +4324,7 @@ zfs_ioc_recv(zfs_cmd_t *zc) * zc_fromobj objsetid of incremental fromsnap (may be zero) * zc_guid if set, estimate size of stream only. zc_cookie is ignored. * output size in zc_objset_type. + * zc_flags if =1, WRITE_EMBEDDED records are permitted * * outputs: * zc_objset_type estimated size, if zc_guid is set @@ -4364,6 +4335,7 @@ zfs_ioc_send(zfs_cmd_t *zc) int error; offset_t off; boolean_t estimate = (zc->zc_guid != 0); + boolean_t embedok = (zc->zc_flags & 0x1); if (zc->zc_obj != 0) { dsl_pool_t *dp; @@ -4429,9 +4401,9 @@ zfs_ioc_send(zfs_cmd_t *zc) off = fp->f_offset; error = dmu_send_obj(zc->zc_name, zc->zc_sendobj, #ifdef illumos - zc->zc_fromobj, zc->zc_cookie, fp->f_vnode, &off); + zc->zc_fromobj, embedok, zc->zc_cookie, fp->f_vnode, &off); #else - zc->zc_fromobj, zc->zc_cookie, fp, &off); + zc->zc_fromobj, embedok, zc->zc_cookie, fp, &off); #endif if (off >= 0 && off <= MAXOFFSET_T) @@ -5369,6 +5341,8 @@ zfs_ioc_unjail(zfs_cmd_t *zc) * innvl: { * "fd" -> file descriptor to write stream to (int32) * (optional) "fromsnap" -> full snap name to send an incremental from + * (optional) "embedok" -> (value ignored) + * presence indicates DRR_WRITE_EMBEDDED records are permitted * } * * outnvl is unused @@ -5382,6 +5356,7 @@ zfs_ioc_send_new(const char *snapname, nvlist_t *innvl, nvlist_t *outnvl) offset_t off; char *fromname = NULL; int fd; + boolean_t embedok; error = nvlist_lookup_int32(innvl, "fd", &fd); if (error != 0) @@ -5389,15 +5364,17 @@ zfs_ioc_send_new(const char *snapname, nvlist_t *innvl, nvlist_t *outnvl) (void) nvlist_lookup_string(innvl, "fromsnap", &fromname); + embedok = nvlist_exists(innvl, "embedok"); + file_t *fp = getf(fd, cap_rights_init(&rights, CAP_READ)); if (fp == NULL) return (SET_ERROR(EBADF)); off = fp->f_offset; #ifdef illumos - error = dmu_send(snapname, fromname, fd, fp->f_vnode, &off); + error = dmu_send(snapname, fromname, embedok, fd, fp->f_vnode, &off); #else - error = dmu_send(snapname, fromname, fd, fp, &off); + error = dmu_send(snapname, fromname, embedok, fd, fp, &off); #endif #ifdef illumos @@ -5916,6 +5893,7 @@ zfsdev_ioctl(struct cdev *dev, u_long zcmd, caddr_t arg, int flag, zfs_iocparm_t *zc_iocparm; int cflag, cmd, oldvecnum; boolean_t newioc, compat; + void *compat_zc = NULL; cred_t *cr = td->td_ucred; #endif const zfs_ioc_vec_t *vec; @@ -5924,10 +5902,10 @@ zfsdev_ioctl(struct cdev *dev, u_long zcmd, caddr_t arg, int flag, cflag = ZFS_CMD_COMPAT_NONE; compat = B_FALSE; - newioc = B_TRUE; + newioc = B_TRUE; /* "new" style (zfs_iocparm_t) ioctl */ len = IOCPARM_LEN(zcmd); - cmd = zcmd & 0xff; + vecnum = cmd = zcmd & 0xff; /* * Check if we are talking to supported older binaries @@ -5935,84 +5913,112 @@ zfsdev_ioctl(struct cdev *dev, u_long zcmd, caddr_t arg, int flag, */ if (len != sizeof(zfs_iocparm_t)) { newioc = B_FALSE; - if (len == sizeof(zfs_cmd_t)) { - cflag = ZFS_CMD_COMPAT_LZC; - vecnum = cmd; - } else if (len == sizeof(zfs_cmd_deadman_t)) { - cflag = ZFS_CMD_COMPAT_DEADMAN; - compat = B_TRUE; - vecnum = cmd; - } else if (len == sizeof(zfs_cmd_v28_t)) { - cflag = ZFS_CMD_COMPAT_V28; - compat = B_TRUE; - vecnum = cmd; - } else if (len == sizeof(zfs_cmd_v15_t)) { - cflag = ZFS_CMD_COMPAT_V15; - compat = B_TRUE; - vecnum = zfs_ioctl_v15_to_v28[cmd]; - } else - return (EINVAL); - } else + compat = B_TRUE; + vecnum = cmd; + switch (len) { + case sizeof(zfs_cmd_zcmd_t): + cflag = ZFS_CMD_COMPAT_LZC; + break; + case sizeof(zfs_cmd_deadman_t): + cflag = ZFS_CMD_COMPAT_DEADMAN; + break; + case sizeof(zfs_cmd_v28_t): + cflag = ZFS_CMD_COMPAT_V28; + break; + case sizeof(zfs_cmd_v15_t): + cflag = ZFS_CMD_COMPAT_V15; + vecnum = zfs_ioctl_v15_to_v28[cmd]; + + /* + * Return without further handling + * if the command is blacklisted. + */ + if (vecnum == ZFS_IOC_COMPAT_PASS) + return (0); + else if (vecnum == ZFS_IOC_COMPAT_FAIL) + return (ENOTSUP); + break; + default: + return (EINVAL); + } + } + #ifdef illumos vecnum = cmd - ZFS_IOC_FIRST; ASSERT3U(getmajor(dev), ==, ddi_driver_major(zfs_dip)); #endif - if (compat) { - if (vecnum == ZFS_IOC_COMPAT_PASS) - return (0); - else if (vecnum == ZFS_IOC_COMPAT_FAIL) - return (ENOTSUP); - } - - /* - * Check if we have sufficient kernel memory allocated - * for the zfs_cmd_t request. Bail out if not so we - * will not access undefined memory region. - */ if (vecnum >= sizeof (zfs_ioc_vec) / sizeof (zfs_ioc_vec[0])) return (SET_ERROR(EINVAL)); vec = &zfs_ioc_vec[vecnum]; -#ifdef illumos zc = kmem_zalloc(sizeof(zfs_cmd_t), KM_SLEEP); - bzero(zc, sizeof(zfs_cmd_t)); +#ifdef illumos error = ddi_copyin((void *)arg, zc, sizeof (zfs_cmd_t), flag); if (error != 0) { error = SET_ERROR(EFAULT); goto out; } #else /* !illumos */ - /* - * We don't alloc/free zc only if talking to library ioctl version 2 - */ - if (cflag != ZFS_CMD_COMPAT_LZC) { - zc = kmem_zalloc(sizeof(zfs_cmd_t), KM_SLEEP); - bzero(zc, sizeof(zfs_cmd_t)); - } else { - zc = (void *)arg; - error = 0; - } + bzero(zc, sizeof(zfs_cmd_t)); if (newioc) { zc_iocparm = (void *)arg; - if (zc_iocparm->zfs_cmd_size != sizeof(zfs_cmd_t)) { - error = SET_ERROR(EFAULT); + + switch (zc_iocparm->zfs_ioctl_version) { + case ZFS_IOCVER_CURRENT: + if (zc_iocparm->zfs_cmd_size != sizeof(zfs_cmd_t)) { + error = SET_ERROR(EINVAL); + goto out; + } + break; + case ZFS_IOCVER_ZCMD: + if (zc_iocparm->zfs_cmd_size > sizeof(zfs_cmd_t) || + zc_iocparm->zfs_cmd_size < sizeof(zfs_cmd_zcmd_t)) { + error = SET_ERROR(EFAULT); + goto out; + } + compat = B_TRUE; + cflag = ZFS_CMD_COMPAT_ZCMD; + break; + default: + error = SET_ERROR(EINVAL); goto out; + /* NOTREACHED */ } - error = ddi_copyin((void *)(uintptr_t)zc_iocparm->zfs_cmd, zc, - sizeof(zfs_cmd_t), flag); - if (error != 0) { - error = SET_ERROR(EFAULT); - goto out; + + if (compat) { + ASSERT(sizeof(zfs_cmd_t) >= zc_iocparm->zfs_cmd_size); + compat_zc = kmem_zalloc(sizeof(zfs_cmd_t), KM_SLEEP); + bzero(compat_zc, sizeof(zfs_cmd_t)); + + error = ddi_copyin((void *)(uintptr_t)zc_iocparm->zfs_cmd, + compat_zc, zc_iocparm->zfs_cmd_size, flag); + if (error != 0) { + error = SET_ERROR(EFAULT); + goto out; + } + } else { + error = ddi_copyin((void *)(uintptr_t)zc_iocparm->zfs_cmd, + zc, zc_iocparm->zfs_cmd_size, flag); + if (error != 0) { + error = SET_ERROR(EFAULT); + goto out; + } } } if (compat) { - zfs_cmd_compat_get(zc, arg, cflag); + if (newioc) { + ASSERT(compat_zc != NULL); + zfs_cmd_compat_get(zc, compat_zc, cflag); + } else { + ASSERT(compat_zc == NULL); + zfs_cmd_compat_get(zc, arg, cflag); + } oldvecnum = vecnum; error = zfs_ioctl_compat_pre(zc, &vecnum, cflag); if (error != 0) @@ -6108,7 +6114,7 @@ zfsdev_ioctl(struct cdev *dev, u_long zcmd, caddr_t arg, int flag, fnvlist_free(lognv); /* rewrite outnvl for backwards compatibility */ - if (cflag != ZFS_CMD_COMPAT_NONE && cflag != ZFS_CMD_COMPAT_LZC) + if (compat) outnvl = zfs_ioctl_compat_outnvl(zc, outnvl, vecnum, cflag); @@ -6133,17 +6139,30 @@ zfsdev_ioctl(struct cdev *dev, u_long zcmd, caddr_t arg, int flag, out: nvlist_free(innvl); - if (compat) { - zfs_ioctl_compat_post(zc, cmd, cflag); - zfs_cmd_compat_put(zc, arg, vecnum, cflag); - } - #ifdef illumos rc = ddi_copyout(zc, (void *)arg, sizeof (zfs_cmd_t), flag); if (error == 0 && rc != 0) error = SET_ERROR(EFAULT); #else - if (newioc) { + if (compat) { + zfs_ioctl_compat_post(zc, cmd, cflag); + if (newioc) { + ASSERT(compat_zc != NULL); + ASSERT(sizeof(zfs_cmd_t) >= zc_iocparm->zfs_cmd_size); + + zfs_cmd_compat_put(zc, compat_zc, vecnum, cflag); + rc = ddi_copyout(compat_zc, + (void *)(uintptr_t)zc_iocparm->zfs_cmd, + zc_iocparm->zfs_cmd_size, flag); + if (error == 0 && rc != 0) + error = SET_ERROR(EFAULT); + kmem_free(compat_zc, sizeof (zfs_cmd_t)); + } else { + zfs_cmd_compat_put(zc, arg, vecnum, cflag); + } + } else { + ASSERT(newioc); + rc = ddi_copyout(zc, (void *)(uintptr_t)zc_iocparm->zfs_cmd, sizeof (zfs_cmd_t), flag); if (error == 0 && rc != 0) @@ -6160,15 +6179,7 @@ zfsdev_ioctl(struct cdev *dev, u_long zcmd, caddr_t arg, int flag, strfree(saved_poolname); } -#ifdef illumos kmem_free(zc, sizeof (zfs_cmd_t)); -#else - /* - * We don't alloc/free zc only if talking to library ioctl version 2 - */ - if (cflag != ZFS_CMD_COMPAT_LZC) - kmem_free(zc, sizeof (zfs_cmd_t)); -#endif return (error); } diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c index 7ce41a137a1..33748fe37b1 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c @@ -74,8 +74,7 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, super_owner, CTLFLAG_RW, &zfs_super_owner, 0, "File system owner can perform privileged operation on his file systems"); int zfs_debug_level; -TUNABLE_INT("vfs.zfs.debug", &zfs_debug_level); -SYSCTL_INT(_vfs_zfs, OID_AUTO, debug, CTLFLAG_RW, &zfs_debug_level, 0, +SYSCTL_INT(_vfs_zfs, OID_AUTO, debug, CTLFLAG_RWTUN, &zfs_debug_level, 0, "Debug level"); SYSCTL_NODE(_vfs_zfs, OID_AUTO, version, CTLFLAG_RD, 0, "ZFS versions"); @@ -988,7 +987,7 @@ zfsvfs_create(const char *osname, zfsvfs_t **zfvp) mutex_init(&zfsvfs->z_lock, NULL, MUTEX_DEFAULT, NULL); list_create(&zfsvfs->z_all_znodes, sizeof (znode_t), offsetof(znode_t, z_link_node)); - rrw_init(&zfsvfs->z_teardown_lock, B_FALSE); + rrm_init(&zfsvfs->z_teardown_lock, B_FALSE); rw_init(&zfsvfs->z_teardown_inactive_lock, NULL, RW_DEFAULT, NULL); rw_init(&zfsvfs->z_fuid_lock, NULL, RW_DEFAULT, NULL); for (i = 0; i != ZFS_OBJ_MTX_SZ; i++) @@ -1104,7 +1103,7 @@ zfsvfs_free(zfsvfs_t *zfsvfs) mutex_destroy(&zfsvfs->z_znodes_lock); mutex_destroy(&zfsvfs->z_lock); list_destroy(&zfsvfs->z_all_znodes); - rrw_destroy(&zfsvfs->z_teardown_lock); + rrm_destroy(&zfsvfs->z_teardown_lock); rw_destroy(&zfsvfs->z_teardown_inactive_lock); rw_destroy(&zfsvfs->z_fuid_lock); for (i = 0; i != ZFS_OBJ_MTX_SZ; i++) @@ -1833,7 +1832,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting) { znode_t *zp; - rrw_enter(&zfsvfs->z_teardown_lock, RW_WRITER, FTAG); + rrm_enter(&zfsvfs->z_teardown_lock, RW_WRITER, FTAG); if (!unmounting) { /* @@ -1866,7 +1865,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting) */ if (!unmounting && (zfsvfs->z_unmounted || zfsvfs->z_os == NULL)) { rw_exit(&zfsvfs->z_teardown_inactive_lock); - rrw_exit(&zfsvfs->z_teardown_lock, FTAG); + rrm_exit(&zfsvfs->z_teardown_lock, FTAG); return (SET_ERROR(EIO)); } @@ -1893,7 +1892,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting) */ if (unmounting) { zfsvfs->z_unmounted = B_TRUE; - rrw_exit(&zfsvfs->z_teardown_lock, FTAG); + rrm_exit(&zfsvfs->z_teardown_lock, FTAG); rw_exit(&zfsvfs->z_teardown_inactive_lock); } @@ -1970,9 +1969,9 @@ zfs_umount(vfs_t *vfsp, int fflag) * vflush(FORCECLOSE). This way we ensure no future vnops * will be called and risk operating on DOOMED vnodes. */ - rrw_enter(&zfsvfs->z_teardown_lock, RW_WRITER, FTAG); + rrm_enter(&zfsvfs->z_teardown_lock, RW_WRITER, FTAG); zfsvfs->z_unmounted = B_TRUE; - rrw_exit(&zfsvfs->z_teardown_lock, FTAG); + rrm_exit(&zfsvfs->z_teardown_lock, FTAG); } /* @@ -2076,8 +2075,6 @@ zfs_vget(vfs_t *vfsp, ino_t ino, int flags, vnode_t **vpp) err = vn_lock(*vpp, flags); if (err != 0) *vpp = NULL; - else - (*vpp)->v_hash = ino; return (err); } @@ -2240,7 +2237,7 @@ zfs_resume_fs(zfsvfs_t *zfsvfs, const char *osname) znode_t *zp; uint64_t sa_obj = 0; - ASSERT(RRW_WRITE_HELD(&zfsvfs->z_teardown_lock)); + ASSERT(RRM_WRITE_HELD(&zfsvfs->z_teardown_lock)); ASSERT(RW_WRITE_HELD(&zfsvfs->z_teardown_inactive_lock)); /* @@ -2296,7 +2293,7 @@ zfs_resume_fs(zfsvfs_t *zfsvfs, const char *osname) bail: /* release the VOPs */ rw_exit(&zfsvfs->z_teardown_inactive_lock); - rrw_exit(&zfsvfs->z_teardown_lock, FTAG); + rrm_exit(&zfsvfs->z_teardown_lock, FTAG); if (err) { /* diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c index cc471b0690f..1553a818136 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013, 2014 by Delphix. All rights reserved. * Copyright 2014 Nexenta Systems, Inc. All rights reserved. */ @@ -1568,7 +1568,7 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct componentname *cnp, * cr - credentials of caller. * flag - large file flag [UNUSED]. * ct - caller context - * vsecp - ACL to be set + * vsecp - ACL to be set * * OUT: vpp - vnode of created or trunc'd entry. * @@ -1850,7 +1850,7 @@ zfs_remove(vnode_t *dvp, char *name, cred_t *cr, caller_context_t *ct, zfsvfs_t *zfsvfs = dzp->z_zfsvfs; zilog_t *zilog; uint64_t acl_obj, xattr_obj; - uint64_t xattr_obj_unlinked = 0; + uint64_t xattr_obj_unlinked = 0; uint64_t obj = 0; zfs_dirlock_t *dl; dmu_tx_t *tx; @@ -1950,6 +1950,14 @@ zfs_remove(vnode_t *dvp, char *name, cred_t *cr, caller_context_t *ct, /* charge as an update -- would be nice not to charge at all */ dmu_tx_hold_zap(tx, zfsvfs->z_unlinkedobj, FALSE, NULL); + /* + * Mark this transaction as typically resulting in a net free of + * space, unless object removal will be delayed indefinitely + * (due to active holds on the vnode due to the file being open). + */ + if (may_delete_now) + dmu_tx_mark_netfree(tx); + error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT); if (error) { zfs_dirent_unlock(dl); @@ -1980,7 +1988,6 @@ zfs_remove(vnode_t *dvp, char *name, cred_t *cr, caller_context_t *ct, } if (unlinked) { - /* * Hold z_lock so that we can make sure that the ACL obj * hasn't changed. Could have been deleted due to @@ -5056,13 +5063,13 @@ zfs_addmap(vnode_t *vp, offset_t off, struct as *as, caddr_t addr, * last page is pushed. The problem occurs when the msync() call is omitted, * which by far the most common case: * - * open() - * mmap() - * - * munmap() - * close() - *